uboot 2014移植手册
合集下载
相关主题
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
NFCONT &= ~(1<<1); }
static void nand_deselect_ll(void) {
NFCONT |= (1<<1);
}
static void nand_cmd(unsigned char cmd) {
volatile int i; NFCMMD = cmd; for (i = 0; i < 10; i++); }
NFADDR = page & 0xff; for (i = 0; i < 10; i++); NFADDR = (page >> 8) & 0xff; for (i = 0; i < 10; i++); NFADDR = (page >> 16) & 0xff; for (i = 0; i < 10; i++); }
u-boot 2014.01 移植手册
移植环境: JZ2440 v2 arm-linux-gcc 4.3.2 u-boot-2014.01
参考资料: 韦东山Βιβλιοθήκη Baidulinux 开发视频
本 uboot 工程的补丁下载: http://download.csdn.net/detail/callmefriend/7089867
ldr r0, =0x4c000004 ldr r1, =S3C2440_MPLL_400MHZ str r1, [r0] smdk2410.c: // writel(0xFFFFFF, &clk_power->locktime); /* configure MPLL */ // writel((M_MDIV << 12) + (M_PDIV << 4) + M_SDIV, // &clk_power->mpllcon);
/* 设置时序 */ NFCONF = (TACLS<<12)|(TWRPH0<<8)|(TWRPH1<<4); /* 使能 NAND Flash 控制器, 初始化 ECC, 禁止片选 */ NFCONT = (1<<4)|(1<<1)|(1<<0); }
static void nand_select(void) {
// addr -= gd->mon_len;
// addr &= ~(4096 - 1);
addr = CONFIG_SYS_TEXT_BASE;
b、在 start.S 里 bl cpu_init_crit 后增加 nand 初始化和 copy 代码,并清 BSS,同
时在增加 copy nand 文件的源文件 init.c:
.long 0x00000030 //MRSRB6
.long 0x00000030 //MRSRB7
4、修改链接选项
在 arch/arm/config.mk 里,取消-pie 选项
在 arch/arm/cpu/u-boot.lds 下增加如下两行:
board/samsung/smdk2440/built-in.o (.text*)
3、初始化内存
在 lowlevel_init.S 里修改 SMRDATA:对应的数值: SMRDATA:
.long 0x22011110 //BWSCON .long 0x00000700 //BANKCON0 .long 0x00000700 //BANKCON1 .long 0x00000700 //BANKCON2 .long 0x00000700 //BANKCON3 .long 0x00000740 //BANKCON4 .long 0x00000700 //BANKCON5 .long 0x00018005 //BANKCON6 .long 0x00018005 //BANKCON7 .long 0x008C04F4 // REFRESH .long 0x000000B1 //BANKSIZE
/* GPIO */ #define GPHCON
(*(volatile unsigned long *)0x56000070)
#define GPHUP
(*(volatile unsigned long *)0x56000078)
/* UART registers*/ #define ULCON0 #define UCON0 #define UFCON0 #define UMCON0 #define UTRSTAT0 #define UTXH0 #define URXH0 #define UBRDIV0
来 S3C2410 单板下的所有文件拷贝到 2440 下。 c、在 include/configs 下执行:cp smdk2410.h smdk2440.h。拷贝原来 2410
的配置文件。 d、发现顶层 makefiel 的一个小 bug:make distclean 的时候,不删除 ln -s 生成
(*(volatile unsigned long *)0x50000000) (*(volatile unsigned long *)0x50000004) (*(volatile unsigned long *)0x50000008) (*(volatile unsigned long *)0x5000000c) (*(volatile unsigned long *)0x50000010) (*(volatile unsigned char *)0x50000020) (*(volatile unsigned char *)0x50000024) (*(volatile unsigned long *)0x50000028)
val = *p; *p = 0x12345678; if (*p == 0x12345678) {
/* 写成功, 是 nand 启动 */ *p = val; return 0; } else { /* NOR 不能像内存一样写 */ return 1; } }
/* *src=0; dest=0x33f80000;len=0x73250 **/ void copy_code_to_sdram(unsigned char *src, unsigned char *dest, unsigned int len) {
static void nand_wait_ready_ll(void) {
while (!(NFSTAT & 1)); }
static unsigned char nand_data(void) {
return NFDATA; } /* *src=0; dest=0x33f80000;len=0x73250 */ void nand_read_ll(unsigned int addr, unsigned char *buf, unsigned int len) {
2、修改时钟
在 start.S 中增加对时钟的初始化,并在 board\samsung\smdk2440\smdk2410.c 的 int board_early_init_f(void)里取消对 时钟初始化的代码。 start.S:
ldr r0, =0x4c000014 // mov r1, #0x03; // FCLK:HCLK:PCLK=1:2:4, HDIVN=1,PDIVN=1 mov r1, #0x05; // FCLK:HCLK:PCLK=1:4:8 str r1, [r0] /* 如果 HDIVN 非 0,CPU 的总线模式应该从“fast bus mode”变为“asynchronous bus mode” */ mrc p15, 0, r1, c1, c0, 0 /* 读出控制寄存器 */ orr r1, r1, #0xc0000000 /* 设置为“asynchronous bus mode” */ mcr p15, 0, r1, c1, c0, 0 /* 写入控制寄存器 */ #define S3C2440_MPLL_400MHZ ((0x5c<<12)|(0x01<<4)|(0x01)) /* MPLLCON = S3C2440_MPLL_200MHZ */
int i = 0;
/* 如果是 NOR 启动 */ if (isBootFromNorFlash()) {
while (i < len) {
dest[i] = src[i]; i++; } } else { //nand_init(); nand_read_ll((unsigned int)src, dest, len); } }
的符号链接文件;这个不影响编译,但是显得不协调。改进办法: unconfig:
@rm -f $(obj)include/config.h $(obj)include/config.mk \
$(obj)board/*/config.tmp $(obj)board/*/*/config.tmp \ $(obj)include/autoconf.mk $(obj)include/autoconf.mk.dep \ $(obj)include/spl-autoconf.mk \ $(obj)include/tpl-autoconf.mk \ $(obj)arch/${ARCH}/include/asm/arch \ $(obj)arch/${ARCH}/include/asm/proc
#define TXD0READY (1<<2)
void nand_read_ll(unsigned int addr, unsigned char *buf, unsigned int len);
static int isBootFromNorFlash(void) {
volatile int *p = (volatile int *)0; int val;
原文地址: http://blog.csdn.net/callmefriend/article/details/21954279
1、增加对 2440 的支持。 a、修改 boards.cfg,仿照 2410,增加 2440. b、在 board/samsung/目录下执行:cp smdk2410/ smdk2440 -rf 。将原
void clear_bss(void) {
extern int __bss_start, __bss_end; int *p = &__bss_start;
for (; p < &__bss_end; p++) *p = 0;
}
void nand_init_ll(void) { #define TACLS 0 #define TWRPH0 1 #define TWRPH1 0
static void nand_addr(unsigned int addr) {
unsigned int col = addr % 2048; unsigned int page = addr / 2048; volatile int i;
NFADDR = col & 0xff; for (i = 0; i < 10; i++); NFADDR = (col >> 8) & 0xff; for (i = 0; i < 10; i++);
/* NAND FLASH 控制器 */ #define NFCONF (*((volatile unsigned long *)0x4E000000)) #define NFCONT (*((volatile unsigned long *)0x4E000004)) #define NFCMMD (*((volatile unsigned char *)0x4E000008)) #define NFADDR (*((volatile unsigned char *)0x4E00000C)) #define NFDATA (*((volatile unsigned char *)0x4E000010)) #define NFSTAT (*((volatile unsigned char *)0x4E000020))
arch/arm/cpu/built-in.o (.text*)
修改 smdk2440.h 里的 CONFIG_SYS_TEXT_BASE 的值为:
#define CONFIG_SYS_TEXT_BASE 0x33f00000
至此,uboot 应该能初始化时钟和内存。
5、修改重定位代码
a、在 addr 的最后位置,去掉
static void nand_deselect_ll(void) {
NFCONT |= (1<<1);
}
static void nand_cmd(unsigned char cmd) {
volatile int i; NFCMMD = cmd; for (i = 0; i < 10; i++); }
NFADDR = page & 0xff; for (i = 0; i < 10; i++); NFADDR = (page >> 8) & 0xff; for (i = 0; i < 10; i++); NFADDR = (page >> 16) & 0xff; for (i = 0; i < 10; i++); }
u-boot 2014.01 移植手册
移植环境: JZ2440 v2 arm-linux-gcc 4.3.2 u-boot-2014.01
参考资料: 韦东山Βιβλιοθήκη Baidulinux 开发视频
本 uboot 工程的补丁下载: http://download.csdn.net/detail/callmefriend/7089867
ldr r0, =0x4c000004 ldr r1, =S3C2440_MPLL_400MHZ str r1, [r0] smdk2410.c: // writel(0xFFFFFF, &clk_power->locktime); /* configure MPLL */ // writel((M_MDIV << 12) + (M_PDIV << 4) + M_SDIV, // &clk_power->mpllcon);
/* 设置时序 */ NFCONF = (TACLS<<12)|(TWRPH0<<8)|(TWRPH1<<4); /* 使能 NAND Flash 控制器, 初始化 ECC, 禁止片选 */ NFCONT = (1<<4)|(1<<1)|(1<<0); }
static void nand_select(void) {
// addr -= gd->mon_len;
// addr &= ~(4096 - 1);
addr = CONFIG_SYS_TEXT_BASE;
b、在 start.S 里 bl cpu_init_crit 后增加 nand 初始化和 copy 代码,并清 BSS,同
时在增加 copy nand 文件的源文件 init.c:
.long 0x00000030 //MRSRB6
.long 0x00000030 //MRSRB7
4、修改链接选项
在 arch/arm/config.mk 里,取消-pie 选项
在 arch/arm/cpu/u-boot.lds 下增加如下两行:
board/samsung/smdk2440/built-in.o (.text*)
3、初始化内存
在 lowlevel_init.S 里修改 SMRDATA:对应的数值: SMRDATA:
.long 0x22011110 //BWSCON .long 0x00000700 //BANKCON0 .long 0x00000700 //BANKCON1 .long 0x00000700 //BANKCON2 .long 0x00000700 //BANKCON3 .long 0x00000740 //BANKCON4 .long 0x00000700 //BANKCON5 .long 0x00018005 //BANKCON6 .long 0x00018005 //BANKCON7 .long 0x008C04F4 // REFRESH .long 0x000000B1 //BANKSIZE
/* GPIO */ #define GPHCON
(*(volatile unsigned long *)0x56000070)
#define GPHUP
(*(volatile unsigned long *)0x56000078)
/* UART registers*/ #define ULCON0 #define UCON0 #define UFCON0 #define UMCON0 #define UTRSTAT0 #define UTXH0 #define URXH0 #define UBRDIV0
来 S3C2410 单板下的所有文件拷贝到 2440 下。 c、在 include/configs 下执行:cp smdk2410.h smdk2440.h。拷贝原来 2410
的配置文件。 d、发现顶层 makefiel 的一个小 bug:make distclean 的时候,不删除 ln -s 生成
(*(volatile unsigned long *)0x50000000) (*(volatile unsigned long *)0x50000004) (*(volatile unsigned long *)0x50000008) (*(volatile unsigned long *)0x5000000c) (*(volatile unsigned long *)0x50000010) (*(volatile unsigned char *)0x50000020) (*(volatile unsigned char *)0x50000024) (*(volatile unsigned long *)0x50000028)
val = *p; *p = 0x12345678; if (*p == 0x12345678) {
/* 写成功, 是 nand 启动 */ *p = val; return 0; } else { /* NOR 不能像内存一样写 */ return 1; } }
/* *src=0; dest=0x33f80000;len=0x73250 **/ void copy_code_to_sdram(unsigned char *src, unsigned char *dest, unsigned int len) {
static void nand_wait_ready_ll(void) {
while (!(NFSTAT & 1)); }
static unsigned char nand_data(void) {
return NFDATA; } /* *src=0; dest=0x33f80000;len=0x73250 */ void nand_read_ll(unsigned int addr, unsigned char *buf, unsigned int len) {
2、修改时钟
在 start.S 中增加对时钟的初始化,并在 board\samsung\smdk2440\smdk2410.c 的 int board_early_init_f(void)里取消对 时钟初始化的代码。 start.S:
ldr r0, =0x4c000014 // mov r1, #0x03; // FCLK:HCLK:PCLK=1:2:4, HDIVN=1,PDIVN=1 mov r1, #0x05; // FCLK:HCLK:PCLK=1:4:8 str r1, [r0] /* 如果 HDIVN 非 0,CPU 的总线模式应该从“fast bus mode”变为“asynchronous bus mode” */ mrc p15, 0, r1, c1, c0, 0 /* 读出控制寄存器 */ orr r1, r1, #0xc0000000 /* 设置为“asynchronous bus mode” */ mcr p15, 0, r1, c1, c0, 0 /* 写入控制寄存器 */ #define S3C2440_MPLL_400MHZ ((0x5c<<12)|(0x01<<4)|(0x01)) /* MPLLCON = S3C2440_MPLL_200MHZ */
int i = 0;
/* 如果是 NOR 启动 */ if (isBootFromNorFlash()) {
while (i < len) {
dest[i] = src[i]; i++; } } else { //nand_init(); nand_read_ll((unsigned int)src, dest, len); } }
的符号链接文件;这个不影响编译,但是显得不协调。改进办法: unconfig:
@rm -f $(obj)include/config.h $(obj)include/config.mk \
$(obj)board/*/config.tmp $(obj)board/*/*/config.tmp \ $(obj)include/autoconf.mk $(obj)include/autoconf.mk.dep \ $(obj)include/spl-autoconf.mk \ $(obj)include/tpl-autoconf.mk \ $(obj)arch/${ARCH}/include/asm/arch \ $(obj)arch/${ARCH}/include/asm/proc
#define TXD0READY (1<<2)
void nand_read_ll(unsigned int addr, unsigned char *buf, unsigned int len);
static int isBootFromNorFlash(void) {
volatile int *p = (volatile int *)0; int val;
原文地址: http://blog.csdn.net/callmefriend/article/details/21954279
1、增加对 2440 的支持。 a、修改 boards.cfg,仿照 2410,增加 2440. b、在 board/samsung/目录下执行:cp smdk2410/ smdk2440 -rf 。将原
void clear_bss(void) {
extern int __bss_start, __bss_end; int *p = &__bss_start;
for (; p < &__bss_end; p++) *p = 0;
}
void nand_init_ll(void) { #define TACLS 0 #define TWRPH0 1 #define TWRPH1 0
static void nand_addr(unsigned int addr) {
unsigned int col = addr % 2048; unsigned int page = addr / 2048; volatile int i;
NFADDR = col & 0xff; for (i = 0; i < 10; i++); NFADDR = (col >> 8) & 0xff; for (i = 0; i < 10; i++);
/* NAND FLASH 控制器 */ #define NFCONF (*((volatile unsigned long *)0x4E000000)) #define NFCONT (*((volatile unsigned long *)0x4E000004)) #define NFCMMD (*((volatile unsigned char *)0x4E000008)) #define NFADDR (*((volatile unsigned char *)0x4E00000C)) #define NFDATA (*((volatile unsigned char *)0x4E000010)) #define NFSTAT (*((volatile unsigned char *)0x4E000020))
arch/arm/cpu/built-in.o (.text*)
修改 smdk2440.h 里的 CONFIG_SYS_TEXT_BASE 的值为:
#define CONFIG_SYS_TEXT_BASE 0x33f00000
至此,uboot 应该能初始化时钟和内存。
5、修改重定位代码
a、在 addr 的最后位置,去掉