免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3008 | 回复: 4

[PATCH]add-reboot-function-for-atsam9261.patch [复制链接]

论坛徽章:
0
发表于 2009-11-02 17:47 |显示全部楼层
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

0002-add-reboot-function-for-atsam9261.patch.tar.gz

1.05 KB, 下载次数: 20

论坛徽章:
0
发表于 2009-11-02 19:24 |显示全部楼层
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

0001-modify-9263-board-s-reg-definition.patch.gz

645 Bytes, 下载次数: 20

论坛徽章:
0
发表于 2009-11-02 19:26 |显示全部楼层
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

0002-add-reboot-function-for-atsam9263.patch.gz

769 Bytes, 下载次数: 26

论坛徽章:
0
发表于 2009-11-02 19:27 |显示全部楼层
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

0003-add-reboot-function-for-s3c2440.patch.gz

652 Bytes, 下载次数: 16

论坛徽章:
0
发表于 2009-11-02 21:29 |显示全部楼层
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

0002-add-reboot-function-for-s3c2410.patch.gz

669 Bytes, 下载次数: 11

您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP