移植u-boot-2016.09至Jz2440

时间:2021-08-15 06:35:28

开发板:Jz2440v3
编译器:4.5.1
Uboot:u-boot-2016.09.tar.bz2

在新版本的uboot中,不再有了mkconfig脚本和board.cfg文件,采用和内核一样的config方式。
在网上找到了一张图,很好的说明了在新版uboot中启动的流程。
移植u-boot-2016.09至Jz2440


在start.S中,添加系统主频,修改分频系数:

+++ uboot/arch/arm/cpu/arm920t/start.S  2018-01-21 06:05:05.198078809 -0800
@@ -79,12 +79,23 @@
        ldr     r0, =INTSUBMSK
        str     r1, [r0]
 # endif
+#define MPLLCON 0x4C000004
+#define CLKDIVN 0x4C000014

        /* FCLK:HCLK:PCLK = 1:2:4 */
        /* default FCLK is 120 MHz ! */
        ldr     r0, =CLKDIVN
-       mov     r1, #3
+       mov     r1, #(2<<1)|(1<<0) //3
        str     r1, [r0]
+       
+       mrc p15,0,r0,c1,c0,0
+        orr r0,r0,#0xc0000000//R1_nF:OR:R1_iA
+        mcr p15,0,r0,c1,c0,0
+
+        ldr     r0,=MPLLCON         @Clock Init 400:100:50
+        ldr     r1,=(192<<12)|(4<<4)|(1<<0)
+        str     r1,[r0]
+
 #endif /* CONFIG_S3C24X0 */

        /*

修改lowlevel_init.S中对内存控制器的配置:

+++ uboot/board/samsung/smdk2410/lowlevel_init.S 2018-01-21 06:08:21.359730903 -0800
@@ -131,6 +131,7 @@
 /* the literal pools origin */

 SMRDATA:
+#if 0
     .word (0+(B1_BWSCON<<4)+(B2_BWSCON<<8)+(B3_BWSCON<<12)+(B4_BWSCON<<16)+(B5_BWSCON<<20)+(B6_BWSCON<<24)+(B7_BWSCON<<28))
     .word ((B0_Tacs<<13)+(B0_Tcos<<11)+(B0_Tacc<<8)+(B0_Tcoh<<6)+(B0_Tah<<4)+(B0_Tacp<<2)+(B0_PMC))
     .word ((B1_Tacs<<13)+(B1_Tcos<<11)+(B1_Tacc<<8)+(B1_Tcoh<<6)+(B1_Tah<<4)+(B1_Tacp<<2)+(B1_PMC))
@@ -144,3 +145,18 @@
     .word 0x32
     .word 0x30
     .word 0x30
+#else
+ .long 0x22011110 @ BWSCON
+ .long 0x00000700 @ BANKCON0
+ .long 0x00000700 @ BANKCON1
+ .long 0x00000700 @ BANKCON2
+ .long 0x00000700 @ BANKCON3
+ .long 0x00000700 @ BANKCON4
+ .long 0x00000700 @ BANKCON5
+ .long 0x00018005 @ BANKCON6
+ .long 0x00018005 @ BANKCON7
+ .long 0x008C07A3 @ REFRESH
+ .long 0x000000B1 @ BANKSIZE
+ .long 0x00000030 @ MRSRB6
+ .long 0x00000030 @ MRSRB7 
+#endif

去掉smdk2410.c中对时钟的配置:

+++ uboot/board/samsung/smdk2410/smdk2410.c 2018-01-21 06:05:38.599914626 -0800
@@ -58,14 +58,14 @@
        struct s3c24x0_gpio * const gpio = s3c24x0_get_base_gpio();

        /* to reduce PLL lock time, adjust the LOCKTIME register */
- writel(0xFFFFFF, &clk_power->locktime);
+ //writel(0xFFFFFF, &clk_power->locktime);

        /* configure MPLL */
- writel((M_MDIV << 12) + (M_PDIV << 4) + M_SDIV,
- &clk_power->mpllcon);
+ //writel((M_MDIV << 12) + (M_PDIV << 4) + M_SDIV,
+ //&clk_power->mpllcon);

        /* some delay between MPLL and UPLL */
- pll_delay(4000);
+ //pll_delay(4000);

        /* configure UPLL */
        writel((U_M_MDIV << 12) + (U_M_PDIV << 4) + U_M_SDIV,

把Soc改为2440:

+++ uboot/include/configs/smdk2410.h    2018-01-21 06:36:03.399485783 -0800
@@ -18,7 +18,10 @@
  * (easy to change)
  */
 #define CONFIG_S3C24X0 /* This is a SAMSUNG S3C24x0-type SoC */
+#if 0
 #define CONFIG_S3C2410 /* specifically a SAMSUNG S3C2410 SoC */
+#endif
+#define CONFIG_S3C2440
 #define CONFIG_SMDK2410 /* on a SAMSUNG SMDK2410 Board */

 #define CONFIG_SYS_TEXT_BASE 0x0

修改Makefile:

+++ uboot/Makefile 2018-01-21 06:08:48.000856545 -0800
@@ -246,6 +246,9 @@
 CROSS_COMPILE ?=
 endif

+ARCH= arm
+CROSS_COMPILE ?= arm-linux-
+
 KCONFIG_CONFIG ?= .config
 export KCONFIG_CONFIG

效果图:
移植u-boot-2016.09至Jz2440
奉上修改后的uboot:
http://download.csdn.net/download/qq_33160790/10217110
使用方式:
tar zxvf uboot.tar.bz2
cd uboot
make smdk2410_defconfig
make