[PATCH]add-reboot-function-for-atsam9261.patch

发布于 2022-09-18 04:51:28 字数 3836 浏览 28 评论 0

From f633ace3ffa50d5cc6e0e81823b7c8b62c189a5f Mon Sep 17 00:00:00 2001
From: wham <wham.xia@gmail.com>
Date: Mon, 2 Nov 2009 17:35:14 +0800
Subject: [PATCH] add reboot function for atsam9261

---
app/boot/reboot.c                 |   26 ++++++++++++++++++++++++++
arch/arm/atmel/at91sam9261-plat.c |    6 ++++++
include/arch/at91sam9261reg.h     |    4 ++++
3 files changed, 36 insertions(+), 0 deletions(-)
create mode 100644 app/boot/reboot.c

diff --git a/app/boot/reboot.c b/app/boot/reboot.c
new file mode 100644
index 0000000..c1d0ee9
--- /dev/null
+++ b/app/boot/reboot.c
@@ -0,0 +1,26 @@
+#include <g-bios.h>
+
+static void (*ReBoot)(void) = NULL;
+
+int GkRegistReBoot(void (*fun)(void))
+{
+        if (fun == NULL)
+        {
+                return -EINVAL;
+        }
+
+        ReBoot = fun;
+
+        return 0;
+}
+
+int main(int argc, char *argv[])
+{
+        printf("0x=%x\n",ReBoot);
+        if (ReBoot)
+                ReBoot();
+
+        printf("Error: you should init ReBoot function on this board!\n");
+
+        return -EFAULT;       
+}
diff --git a/arch/arm/atmel/at91sam9261-plat.c b/arch/arm/atmel/at91sam9261-plat.c
index de0cee2..89546c0 100644
--- a/arch/arm/atmel/at91sam9261-plat.c
+++ b/arch/arm/atmel/at91sam9261-plat.c
@@ -39,6 +39,10 @@ static const struct PartAttr g_v9261PartTab[] =
        },
};

+static void AtSam9261ReBoot(void)
+{
+        WriteLong(0xa5 << 24 | 0xd, AT91SAM926X_PA_RSTC);
+}

// fixme
#define CONF_DM9000_PIO_RESET  PIOC
@@ -70,6 +74,8 @@ static int __INIT__ MW9261Init(void)

        GuSysConfInitPartTabTmpl(g_v9261PartTab, ARRAY_ELEM_NUM(g_v9261PartTab));

+        GkRegistReBoot(AtSam9261ReBoot);
+
        return 0;
}

diff --git a/include/arch/at91sam9261reg.h b/include/arch/at91sam9261reg.h
index 093406d..bab68e1 100644
--- a/include/arch/at91sam9261reg.h
+++ b/include/arch/at91sam9261reg.h
@@ -137,6 +137,10 @@

#define AT91SAM926X_PA_RSTC           0xFFFFFD00
+        #define RSTC_CR                                                 0x00
+        #define RSTC_SR                                                 0x04
+        #define RSTC_MR                                                 0x08
+

#define AT91SAM926X_PA_SHDWC          0xFFFFFD10

--
1.6.0.4

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

只涨不跌 2022-09-25 04:51:28

From c836c8d7e21c4b21d5f794b0fc9fac5e9fbe38a5 Mon Sep 17 00:00:00 2001
From: = <=>
Date: Mon, 2 Nov 2009 18:41:09 +0800
Subject: [PATCH] modify 9263 board's reg definition

---
include/arch/at91sam9263reg.h |   15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/include/arch/at91sam9263reg.h b/include/arch/at91sam9263reg.h
index 40409d7..86df14a 100644
--- a/include/arch/at91sam9263reg.h
+++ b/include/arch/at91sam9263reg.h
@@ -3,6 +3,13 @@
#define SDRAM_BASE       0x20000000
#define SDRAM_SIZE       0x04000000

+#define MULA            31
+#define DIVA            3
+#define MAIN_CLOCK      18432000
+#define PLLA_CLOCK      (MAIN_CLOCK * ((MULA) + 1) / (DIVA))
+#define MASTER_CLOCK    ((PLLA_CLOCK) / 2)
+
+
#define AT91SAM926X_PA_NAND           0x40000000
        #define NAND_DATA                 0x000000
        #define NAND_ADDR                 0x200000
@@ -81,6 +88,14 @@
        #define SDRAMC_ISR                  0x20
        #define SDRAMC_MDR                  0x24

+#define SDR_CAS(n)           ((n) << 5)
+#define SDR_tWR(n)           ((n) <<
+#define SDR_tRC(n)           ((n) << 12)
+#define SDR_tRP(n)           ((n) << 16)
+#define SDR_tRCD(n)          ((n) << 20)
+#define SDR_tRAS(n)          ((n) << 24)
+#define SDR_tXSR(n)          ((n) << 2
+
#define AT91SAM926X_PA_MATRIX         0xFFFFEC00
        #define MATRIX_SCFG4               0x050
        #define MATRIX_EBI0CSA             0x120
--
1.6.0.4

等风来 2022-09-25 04:51:28

add reboot function for atsam9263
From 140887cd3ef96043944937ca2050eae80c39643d Mon Sep 17 00:00:00 2001
From: = <=>
Date: Mon, 2 Nov 2009 18:53:10 +0800
Subject: [PATCH] add reboot function for atsam9263

---
app/boot/reboot.c                 |    1 -
arch/arm/atmel/at91sam9263-plat.c |    8 +++++++-
2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/app/boot/reboot.c b/app/boot/reboot.c
index fe7551d..a464bbf 100644
--- a/app/boot/reboot.c
+++ b/app/boot/reboot.c
@@ -16,7 +16,6 @@ int GkRegistReBoot(void (*fun)(void))

int main(int argc, char *argv[])
{
-        printf("0x=%x\n",ReBoot);
        if (ReBoot)
                ReBoot();

diff --git a/arch/arm/atmel/at91sam9263-plat.c b/arch/arm/atmel/at91sam9263-plat.c
index 27164c6..ba5f9fc 100644
--- a/arch/arm/atmel/at91sam9263-plat.c
+++ b/arch/arm/atmel/at91sam9263-plat.c
@@ -53,12 +53,16 @@ int At91DisableClock(int nClockID)
        WriteLong(1 << nClockID, AT91SAM926X_PA_PMC + PMC_PCDR);
}

+static void AtSam9263ReBoot(void)
+{
+        WriteLong(0xa5 << 24 | 0xd, AT91SAM926X_PA_RSTC);
+}
+
static int __INIT__ MW9263Init(void)
{
        UINT32 dwMask;

-
        At91PioConfInput(PIOE, 1 << 31, 0);
//        WriteLong(1 << 31, AT91SAM926X_PA_PIOE + PIO_IFER);

@@ -87,6 +91,8 @@ static int __INIT__ MW9263Init(void)

        GuSysConfInitPartTabTmpl(g_v9263PartTab, ARRAY_ELEM_NUM(g_v9263PartTab));

+        GkRegistReBoot(AtSam9263ReBoot);
+
        return 0;
}

--
1.6.0.4

拍不死你 2022-09-25 04:51:28

add reboot function for s3c2440
From 47b9aed488de005cf39312aa94c437bdd374d3f0 Mon Sep 17 00:00:00 2001
From: = <=>
Date: Mon, 2 Nov 2009 19:21:19 +0800
Subject: [PATCH] add reboot function for s3c2440

---
arch/arm/samsung/s3c2440-plat.c |   13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/arch/arm/samsung/s3c2440-plat.c b/arch/arm/samsung/s3c2440-plat.c
index 618e2aa..04eac94 100644
--- a/arch/arm/samsung/s3c2440-plat.c
+++ b/arch/arm/samsung/s3c2440-plat.c
@@ -2,6 +2,7 @@
#include <core/init.h>
#include <core/io.h>
#include <arch/s3c24xx.h>
+#include <arch/s3c24xxreg.h>
#include <flash/flash.h>

@@ -43,6 +44,16 @@ static const struct PartAttr g_v2440PartTab[] =
        },
};

+static void S3c2440ReBoot(void)
+{
+        UINT16 uTmp;
+
+        uTmp = ReadShort(WATCHDOG_BASE);
+        uTmp = uTmp | (1 << 5) | 1;
+        WriteShort(uTmp, WATCHDOG_BASE);
+
+        while(1);
+}

static int __INIT__ MW2440XInit(void)
{
@@ -82,6 +93,8 @@ static int __INIT__ MW2440XInit(void)

        GuSysConfInitPartTabTmpl(g_v2440PartTab, ARRAY_ELEM_NUM(g_v2440PartTab));

+        GkRegistReBoot(S3c2440ReBoot);
+
        return 0;
}

--
1.6.0.4

面犯桃花 2022-09-25 04:51:28

From e2d54730b29ce76de1c968e276f83402fe39db6a Mon Sep 17 00:00:00 2001
From: tiger <tigerflying.yu@gmail.com>
Date: Mon, 2 Nov 2009 21:27:16 +0800
Subject: [PATCH] add reboot function for s3c2410

---
arch/arm/samsung/s3c2410-plat.c |   13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/arch/arm/samsung/s3c2410-plat.c b/arch/arm/samsung/s3c2410-plat.c
index c80d94e..37e3fbe 100644
--- a/arch/arm/samsung/s3c2410-plat.c
+++ b/arch/arm/samsung/s3c2410-plat.c
@@ -1,5 +1,6 @@
#include <core/irq.h>
#include <core/init.h>
+#include <core/io.h>
#include <arch/s3c24xxreg.h>
#include <flash/flash.h>

@@ -42,6 +43,16 @@ static const struct PartAttr g_v2410PartTab[] =
        },
};

+static void S3c2410ReBoot(void)
+{
+        UINT16 uTmp;
+
+        uTmp = ReadShort(WATCHDOG_BASE);
+        uTmp = uTmp | (1 << 5) | 1;
+        WriteShort(uTmp, WATCHDOG_BASE);
+
+        while(1);
+}

static int __INIT__ MW2410Init(void)
{
@@ -52,6 +63,8 @@ static int __INIT__ MW2410Init(void)

        GuSysConfInitPartTabTmpl(g_v2410PartTab, ARRAY_ELEM_NUM(g_v2410PartTab));

+        GkRegistReBoot(S3c2410ReBoot);
+
        return 0;
}

--
1.6.0.4

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文