开发环境:win10 64位 + VMware12 + Ubuntu14.04 32位
工具链:linaro提供的gcc-linaro-6.1.1-2016.08-x86_64_arm-linux-gnueabi
要移植的u-boot版本:u-boot-2016-11
Tiny4412开发板硬件版本为:
底板: Tiny4412SDK 1312B
核心板:Tiny4412 - 1306
----------------------------------------------------------------------------------------------------------------------------------------------
经过两天的调试,终于发现上一节ext2文件格式的问题,其实是SD卡驱动有问题,在/arch/arm/dts/exynos4412-tiny4412.dts下
diff --git a/arch/arm/dts/exynos4412-tiny4412.dts b/arch/arm/dts/exynos4412-tiny index 36e2c6a..88c336a 100644 --- a/arch/arm/dts/exynos4412-tiny4412.dts +++ b/arch/arm/dts/exynos4412-tiny4412.dts @@ -78,24 +78,20 @@ }; sdhci@12510000 { - compatible = "samsung,exynos4412-sdhci"; status = "disable"; }; sdhci@12520000 { - compatible = "samsung,exynos4412-sdhci"; status = "disable"; }; sdhci@12530000 { - compatible = "samsung,exynos4412-sdhci"; samsung,bus-width = <4>; samsung,timing = <1 2 3>; cd-gpios = <&gpk2 2 0>; }; sdhci@12540000 { - compatible = "samsung,exynos4412-sdhci"; status = "disable"; }; @@ -124,6 +120,7 @@ compatible = "samsung,emmc-reset"; reset-gpio = <&gpk1 2 0>; }; + }; status = "disable"; }; sdhci@12520000 { - compatible = "samsung,exynos4412-sdhci"; status = "disable"; }; sdhci@12530000 { - compatible = "samsung,exynos4412-sdhci"; samsung,bus-width = <4>; samsung,timing = <1 2 3>; cd-gpios = <&gpk2 2 0>; }; sdhci@12540000 { - compatible = "samsung,exynos4412-sdhci"; status = "disable"; };
原因就在于设备树的compatible信息,compatible属性中的字符和操作系统选择什么样的驱动来初始化设备有关,网上查到的信息如下:compatible属性,该属性的值是string list,定义了一系列的modle(每个string是一个model)。这些字符串列表被操作系统用来选择用哪一个driver来驱动该设备。假设定义该属性:compatible = “aaaaaa”, “bbbbb”。那么操作操作系统可能首先使用aaaaaa来匹配适合的driver,如果没有匹配到,那么使用字符串bbbbb来继续寻找适合的driver。在/drives/mmc/s5p_sdhci.c。设备定义的信息为samsung,exynos4412-sdhci,但不知为何设备数中加上这句后,就找不到该驱动。
修改后
修改环境变量:
setenv bootcmd "load mmc 0 0x40007000 uImage; load mmc 0 0x48000000 ramdisk.img; load mmc 0 0x42000000 exynos4412-tiny4412.dtb; bootm 0x40007000 0x48000000 0x42000000"
boot启动:
注意,在第一次修改驱动相关代码后,会出现如下情况
解决方法为:
diff --git a/arch/arm/mach-exynos/clock.c b/arch/arm/mach-exynos/clock.c index 3d31f9d..a8fc72a 100644 --- a/arch/arm/mach-exynos/clock.c +++ b/arch/arm/mach-exynos/clock.c @@ -1688,8 +1688,8 @@ unsigned long get_mmc_clk(int dev_index) void set_mmc_clk(int dev_index, unsigned int div) { /* If want to set correct value, it needs to substract one from div.*/ - if (div > 0) - div -= 1; +// if (div > 0) +// div -= 1; if (cpu_is_exynos5()) { if (proid_is_exynos5420() || proid_is_exynos5422())
具体原因未知,据说4G卡不会出现此情况;;