【TINY4412】U-BOOT移植笔记:(9)SD卡启动U-BOOT
宿主机 : 虚拟机 Ubuntu 16.04 LTS / X64
目标板[底板]: Tiny4412SDK - 1506
目标板[核心板]: Tiny4412 - 1412
U-BOOT版本: 2017.03
交叉编译器: gcc-arm-none-eabi-5_4-2016q3
日期: 2017-4-28 22:11:22
作者: SY
设置正确的时钟频率
参考Android_Exynos4412_iROM_Secure_Booting_Guide_Ver.1.00.00.pdf
提示:
Warning: The frequency of clocks supplied to SDMMC and eMMC are 20Mhz at the Booting time. MPLL is thesource of these clocks
因此,根据原理图可以得知,开发板使用SDMMC2,需要设置SDMMC2的时钟为20MHz。
root@ubuntu:/opt/u-boot-2017.03# git diff 565d 1071 diff --git a/arch/arm/mach-exynos/clock_init_exynos4412.c b/arch/arm mach-exynos/clock_init_exynos4412.c
index d1b4de5..b07fb2d 100644
--- a/arch/arm/mach-exynos/clock_init_exynos4412.c
+++ b/arch/arm/mach-exynos/clock_init_exynos4412.c
@@ -298,9 +298,9 @@ void system_clock_init(void)
* DOUTmmc3 = MOUTmmc3 / (ratio + 1) = 100 (7)
* sclk_mmc3 = DOUTmmc3 / (ratio + 1) = 50 (1)
* DOUTmmc2 = MOUTmmc2 / (ratio + 1) = 100 (7)
- * sclk_mmc2 = DOUTmmc2 / (ratio + 1) = 50 (1)
+ * sclk_mmc2 = DOUTmmc2 / (ratio + 1) = 20 (4)
*/
- set = MMC2_RATIO(7) | MMC2_PRE_RATIO(1) | MMC3_RATIO(7) |
+ set = MMC2_RATIO(7) | MMC2_PRE_RATIO(4) | MMC3_RATIO(7) |
MMC3_PRE_RATIO(1);
clrsetbits_le32(&clk->div_fsys2, clr, set);
TZSW
- 必须关掉 tzpc_init(),否则从SPL跳转到UBOOT执行时死机。
diff --git a/arch/arm/mach-exynos/lowlevel_init.c b/arch/arm/mach-exynos/lowlevel_init.c
index 3dd4645..596f6a7 100644
--- a/arch/arm/mach-exynos/lowlevel_init.c
+++ b/arch/arm/mach-exynos/lowlevel_init.c
@@ -224,7 +224,7 @@ int do_lowlevel_init(void)
#endif
#endif
mem_ctrl_init(actions & DO_MEM_RESET);
- tzpc_init();
+ /* tzpc_init(); */
}
return actions & DO_WAKEUP;
修改其他文件
diff --git a/include/configs/tiny4412.h b/include/configs/tiny4412.h
index f65affc..081d1b5 100644
--- a/include/configs/tiny4412.h
+++ b/include/configs/tiny4412.h
@@ -96,15 +96,26 @@
#define CONFIG_CLK_1000_400_200
-/* MIU (Memory Interleaving Unit) */
#define CONFIG_MIU_2BIT_21_7_INTERLEAVED
+/*
+ * SD MMC layout:
+ * +------------+------------------------------------------------------------+
+ * | |
+ * | | | | | |
+ * | 512B | 8K(bl1) | 16k(bl2) | 16k(ENV) | 512k(u-boot) |
+ * | | | | | |
+ * | |
+ * +------------+------------------------------------------------------------+
+ *
+ */
#define CONFIG_ENV_IS_IN_MMC
-#define CONFIG_SYS_MMC_ENV_DEV 0
+#define CONFIG_SYS_MMC_ENV_DEV 0
#define CONFIG_ENV_SIZE (16 << 10) /* 16 KB */
#define RESERVE_BLOCK_SIZE (512)
-#define BL1_SIZE (8 << 10) /* 8K reserved for BL1*/
-#define CONFIG_ENV_OFFSET (RESERVE_BLOCK_SIZE + BL1_SIZE)
+#define BL1_SIZE (8 << 10) /* 8K reserved for BL1*/
+#define BL2_SIZE (16 << 10) /* 16K reserved for BL2 */
+#define CONFIG_ENV_OFFSET (RESERVE_BLOCK_SIZE + BL1_SIZE + BL2_SIZE)
#define CONFIG_SPL_LDSCRIPT "board/samsung/common/exynos-uboot-spl.lds"
#define CONFIG_SPL_MAX_FOOTPRINT (14 * 1024)
@@ -116,3 +127,6 @@
#define BL2_START_OFFSET ((CONFIG_ENV_OFFSET + CONFIG_ENV_SIZE)/512)
#define BL2_SIZE_BLOC_COUNT (COPY_BL2_SIZE/512)
#endif /* __CONFIG_H */
+
+
+
diff --git a/sd_fuse/tiny4412/sd_fusing.sh b/sd_fuse/tiny4412/sd_fusing.sh
index f210d2f..bedf4d4 100755
--- a/sd_fuse/tiny4412/sd_fusing.sh
+++ b/sd_fuse/tiny4412/sd_fusing.sh
@@ -62,8 +62,8 @@ ${MKBL2} ${E4412_UBOOT} bl2.bin 14336
signed_bl1_position=1
bl2_position=17
-uboot_position=49
-tzsw_position=705
+uboot_position=81
+tzsw_position=1105
#<BL1 fusing>
echo "---------------------------------------"
@@ -82,9 +82,9 @@ echo "u-boot fusing"
dd iflag=dsync oflag=dsync if=${E4412_UBOOT} of=$1 seek=$uboot_position
#<TrustZone S/W fusing>
-#echo "---------------------------------------"
-#echo "TrustZone S/W fusing"
-#dd iflag=dsync oflag=dsync if=./E4412_tzsw.bin of=$1 seek=$tzsw_position
+echo "---------------------------------------"
+echo "TrustZone S/W fusing"
+dd iflag=dsync oflag=dsync if=./E4412_tzsw.bin of=$1 seek=$tzsw_position
#<flush to disk>
sync
(END)
- 测试
U-Boot 2017.03-g1071979-dirty (Apr 28 2017 - 18:23:36 -0700) for TINY4412
CPU: Exynos4412 @ 1.4 GHz
Model: Tiny4412 based on Exynos4412
Board: Tiny4412 based on Exynos4412
DRAM: 1 GiB
WARNING: Caches not enabled
MMC: process_nodes: failed to decode dev 0 (-22)
process_nodes: failed to decode dev 1 (-22)
process_nodes: failed to decode dev 2 (-22)
process_nodes: failed to decode dev 3 (-22)
DWMMC56: Can't get the dev index
exynos_dwmci_process_node: failed to decode dev 0
MMC Device 0 not found
*** Warning - No MMC card found, using default environment
Hit any key to stop autoboot: 0
No MMC device available
MMC Device 0 not found
MMC Device 0 not found
** Bad device mmc 0 **
Wrong Image Format for bootm command
ERROR: can't get kernel image!
TINY4412#