tiny4412sdk-1506原生uboot卡死

Posted Kevin_Hwang

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了tiny4412sdk-1506原生uboot卡死相关的知识,希望对你有一定的参考价值。

  于16年2月多购买了tiny4412sdk-1506,用友善之臂(以下简称友善)的superboot是可以进入linux,而用三星原始的uboot_tiny4412-20130729则不可以。出现现象是卡在“OK”,

偶尔能继续跑下去。根据以往开发的经验,可以知道这绝对是ddr3配置的问题,查看“Tiny4412-1306-Schematic”是4颗[email protected]用到一个控制器两个片选(chip0,chip1),而“Tiny

4412-1412-Schematic”(对应我购买的PCB)是2颗[email protected],只需要一个控制器一个片选(chip0)。

(1306版本最好是两个控制器一个片选,能把ddr3带宽提升到64bit,可能技术/成本原因没实现)

 

以下是我做的补丁包,代码如下:

diff -uNrp uboot_tiny4412/board/samsung/tiny4412/mem_init_tiny4412.S uboot_tiny4412_kevin/board/samsung/tiny4412/mem_init_tiny4412.S
--- uboot_tiny4412/board/samsung/tiny4412/mem_init_tiny4412.S   2016-04-11 12:32:03.511480729 +0800
+++ uboot_tiny4412_kevin/board/samsung/tiny4412/mem_init_tiny4412.S     2016-04-01 01:39:09.950628589 +0800
@@ -67,12 +67,12 @@ mem_ctrl_asm_init:
 
        ldr     r1, =0x0FFF301A
        str     r1, [r0, #DMC_CONCONTROL]
-       ldr     r1, =0x00312640
+       ldr     r1, =0x00302640          @这里只有一个chip0
        str     r1, [r0, #DMC_MEMCONTROL]
 
-       ldr     r1, =0x40e01323
+       ldr     r1, =0x40C01333          @Row是15bit,偏移地址是0x3FFFFFFF(1GB)
        str     r1, [r0, #DMC_MEMCONFIG0]
-       ldr     r1, =0x60e01323
+       ldr     r1, =0x80C01333          @可以不修改,这里只为了说明控制器0地址到达0x7FFFFFFF
        str     r1, [r0, #DMC_MEMCONFIG1]
 
 #ifdef CONFIG_IV_SIZE
@@ -97,11 +97,11 @@ mem_ctrl_asm_init:
        str     r1, [r0, #DMC_TIMINGPOWER]
 #endif
 #ifdef MCLK_400
-       ldr     r1, =0x4046654f
+       ldr     r1, =0x6946654f          @根据ddr3颗粒规格书微调参数
        str     r1, [r0, #DMC_TIMINGROW] @TimingRow
-       ldr     r1, =0x46400506
+       ldr     r1, =0x46460506          @根据ddr3颗粒规格书微调参数
        str     r1, [r0, #DMC_TIMINGDATA] @TimingData
-       ldr     r1, =0x52000a3c
+       ldr     r1, =0x5200183c          @根据ddr3颗粒规格书微调参数
        str     r1, [r0, #DMC_TIMINGPOWER] @TimingPower
 #endif
 
@@ -133,7 +133,7 @@ mem_ctrl_asm_init:
 4:     subs    r2, r2, #1
        bne     4b
 
-#if 1
+#if 0                                   @去掉chip1代码
        /* chip 1 */
        ldr     r1, =0x07100000
        str     r1, [r0, #DMC_DIRECTCMD]
@@ -209,12 +209,12 @@ mem_ctrl_asm_init:
 
        ldr     r1, =0x0FFF301A
        str     r1, [r0, #DMC_CONCONTROL]
-       ldr     r1, =0x00312640
+       ldr     r1, =0x00302640
        str     r1, [r0, #DMC_MEMCONTROL]
 
-       ldr     r1, =0x40e01323                 @Interleaved?
+       ldr     r1, =0x40c01333                 @Interleaved?
        str     r1, [r0, #DMC_MEMCONFIG0]
-       ldr     r1, =0x60e01323
+       ldr     r1, =0x80C01323
        str     r1, [r0, #DMC_MEMCONFIG1]
 
 #ifdef CONFIG_IV_SIZE
@@ -239,11 +239,11 @@ mem_ctrl_asm_init:
        str     r1, [r0, #DMC_TIMINGPOWER]
 #endif
 #ifdef MCLK_400
-       ldr     r1, =0x4046654f
+       ldr     r1, =0x6946654f          @根据ddr3颗粒规格书微调参数
        str     r1, [r0, #DMC_TIMINGROW] @TimingRow
-       ldr     r1, =0x46400506
+       ldr     r1, =0x46460506          @根据ddr3颗粒规格书微调参数
        str     r1, [r0, #DMC_TIMINGDATA] @TimingData
-       ldr     r1, =0x52000a3c
+       ldr     r1, =0x5200183c          @根据ddr3颗粒规格书微调参数
        str     r1, [r0, #DMC_TIMINGPOWER] @TimingPower
 #endif
 
@@ -275,7 +275,7 @@ mem_ctrl_asm_init:
 4:     subs    r2, r2, #1
        bne     4b
 
-#if 1
+#if 0                                   @去掉chip1代码
        /* chip 1 */
        ldr     r1, =0x07100000
        str     r1, [r0, #DMC_DIRECTCMD]
diff -uNrp uboot_tiny4412/board/samsung/tiny4412/tiny4412.c uboot_tiny4412_kevin/board/samsung/tiny4412/tiny4412.c
--- uboot_tiny4412/board/samsung/tiny4412/tiny4412.c    2016-04-11 12:32:03.511480729 +0800
+++ uboot_tiny4412_kevin/board/samsung/tiny4412/tiny4412.c      2016-03-29 21:37:21.071493254 +0800
@@ -195,6 +195,14 @@ void dram_init_banksize(void)
        gd->bd->bi_dram[2].size = PHYS_SDRAM_3_SIZE;
        gd->bd->bi_dram[3].start = PHYS_SDRAM_4;
        gd->bd->bi_dram[3].size = PHYS_SDRAM_4_SIZE;
+       gd->bd->bi_dram[4].start = PHYS_SDRAM_5;          //BANK数量改变
+       gd->bd->bi_dram[4].size = PHYS_SDRAM_5_SIZE;
+       gd->bd->bi_dram[5].start = PHYS_SDRAM_6;
+       gd->bd->bi_dram[5].size = PHYS_SDRAM_6_SIZE;
+       gd->bd->bi_dram[6].start = PHYS_SDRAM_7;
+       gd->bd->bi_dram[6].size = PHYS_SDRAM_7_SIZE;
+       gd->bd->bi_dram[7].start = PHYS_SDRAM_8;
+       gd->bd->bi_dram[7].size = PHYS_SDRAM_8_SIZE;
 
 #ifdef CONFIG_TRUSTZONE
        gd->bd->bi_dram[nr_dram_banks - 1].size -= CONFIG_TRUSTZONE_RESERVED_DRAM;
diff -uNrp uboot_tiny4412/drivers/mmc/mmc.c uboot_tiny4412_kevin/drivers/mmc/mmc.c
--- uboot_tiny4412/drivers/mmc/mmc.c    2016-04-11 12:32:04.479480708 +0800
+++ uboot_tiny4412_kevin/drivers/mmc/mmc.c      2016-03-30 01:03:42.119732762 +0800
@@ -955,7 +955,7 @@ static int mmc_read_ext_csd(struct mmc *
        ext_csd_struct = ext_csd[EXT_CSD_REV];
        host->ext_csd.boot_size_multi = ext_csd[BOOT_SIZE_MULTI];
 
-       if (ext_csd_struct > 5) {
+       if (ext_csd_struct > 7) {  //若不修改,进入uboot会提示无法识别版本,原因是友善用的emmc颗粒版本较高
                printf("unrecognised EXT_CSD structure "
                        "version %d\n", ext_csd_struct);
                err = -1;
diff -uNrp uboot_tiny4412/include/configs/tiny4412.h uboot_tiny4412_kevin/include/configs/tiny4412.h
--- uboot_tiny4412/include/configs/tiny4412.h   2016-04-11 20:37:03.834845777 +0800
+++ uboot_tiny4412_kevin/include/configs/tiny4412.h     2016-04-11 16:13:01.719191442 +0800
@@ -278,9 +278,9 @@
 #ifdef CONFIG_EVT0_STABLE
 #define CONFIG_NR_DRAM_BANKS   2
 #else
-#define CONFIG_NR_DRAM_BANKS   4
+#define CONFIG_NR_DRAM_BANKS   8               //BANK提高到8
 #endif
-#define SDRAM_BANK_SIZE         0x10000000    /* 256 MB */
+#define SDRAM_BANK_SIZE         0x08000000    /* 128 MB */          //每个BANK容量减小
 #define PHYS_SDRAM_1            CONFIG_SYS_SDRAM_BASE /* SDRAM Bank #1 */
 #define PHYS_SDRAM_1_SIZE       SDRAM_BANK_SIZE
 #define PHYS_SDRAM_2            (CONFIG_SYS_SDRAM_BASE + SDRAM_BANK_SIZE) /* SDRAM Bank #2 */
@@ -326,7 +326,7 @@
 */
 /* Fastboot variables */
 #define CFG_FASTBOOT_TRANSFER_BUFFER            (0x48000000)
-#define CFG_FASTBOOT_TRANSFER_BUFFER_SIZE       (0x18000000)   /* 384MB */
+#define CFG_FASTBOOT_TRANSFER_BUFFER_SIZE       (0x30000000)   /* 768MB */ //当初为了调原生uboot启动android5.0修改,这里跟uboot启动无关   
 #define CFG_FASTBOOT_ADDR_KERNEL                (0x40008000)
 #define CFG_FASTBOOT_ADDR_RAMDISK               (0x41000000)
 #define CFG_FASTBOOT_PAGESIZE                   (2048)  // Page size of booting device

以上的注释都是patch之后后续加上,只为了方便阅读。修改后的uboot启动android 4.2是可以正常启动,但无法运行android 5.0(启动一段时间后自动跑飞),问了其他人均表示此现象。

询问友善说是uboot问题。应该是superboot做了其他处理,这里没有能力继续研究下去。

 

1:友善的售后做的很差,把客户当傻X;

2:开源力度相当低;

3:硬件&PCB设计很差。

以上三点理由让我不会再选择友善的产品!

 

以上是关于tiny4412sdk-1506原生uboot卡死的主要内容,如果未能解决你的问题,请参考以下文章

Tiny4412 Uboot

Tiny4412 烧写uboot到emmc步骤

tiny4412 --Uboot移植 时钟

tiny4412 --Uboot移植 串口

tiny4412 -1312 __Uboot移植

嵌入式ARM技术博客汇总