tiny4412 --Uboot移植(6) SD卡驅動,啓動內核

開發環境: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

 ----------------------------------------------------------------------------------------------------------------------------------------------html

 

    通過兩天的調試,終於發現上一節ext2文件格式的問題,實際上是SD卡驅動有問題,在/arch/arm/dts/exynos4412-tiny4412.dts下linux

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,但不知爲什麼設備數中加上這句後,就找不到該驅動。ios

 

修改後

修改環境變量:

setenv bootcmd "load mmc 0 0x40007000 uImage; load mmc 0 0x48000000 ramdisk.img; load mmc 0 0x42000000 exynos4412-tiny4412.dtb; bootm 0x40007000 0x48000000 0x42000000"git

 

 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卡不會出現此狀況;;工具

 

 

參考:

https://www.cnblogs.com/LoTGu/p/6405131.html

https://blog.csdn.net/u013779722/article/details/60311216

相關文章
相關標籤/搜索