Hi,
I'm using linux sdk 3.0.0 with kernel 4.4.x on a custom hardware (am335x).
I found a possibly race condition between gpio driver module amd mmc initialization on kernel bootstrap.
With beaglebone black dts all works properly but in my dts there's a difference that shows us the race condition.
In BBB the mmc1 cd-gpio pins is set to <&gpio0 6 GPIO_ACTIVE_LOW> so, when I boot on my sdcard, Linux, set gpio 0_6 as sdcard_cs, notices that sdcard is present and init it as mmc0. Then rootfs is mount on mmcblk0p1 and all is OK.
Insted, In my dts I use <&gpio3 18 GPIO_ACTIVE_LOW> and in other section I use also
&gpio3 {
pinctrl-names = "default";
pinctrl-0 = <&lcd_pins_lvds_pup &dsp_reset>;
lcd_lvds_pup {
gpio-hog;
gpios = <21 GPIO_ACTIVE_HIGH>;
output-high;
line-name = "lcd_lvds_pup";
};
dsp_reset {
gpio-hog;
gpios = <20 GPIO_ACTIVE_HIGH>;
output-low;
line-name = "dsp_reset";
};
};
Note that all gpios are on bank3.
In this case, Linux boots in the same way as before but when try to set gpio3_18 as sdcard_cs, mmc_of_parse() returns an error (-517 = -EPROBE_DEFER), so init procedure pass to the other mmc controller and sets the internal EMMC as mmc0 and then (I don't undertand why) tries again to init sdcard controller. This time gpio3 bank is not busy and the cs gpio is be setted correctly, so sdcard controller is initialized as mmc1.
Problems is rootfs could not be mounted becuse kernel inits sdcard controller as mmc1 instead of mmc0.
If I commented out gpio3 secton, sdcard returns to be initialied as mmc0 and all works properly.
I think is a BUG because if present, sdcard is usually mounted as mmc0.
Is possible to patch >=4.4.x versions and fix it?
I also try kernel mainline and this problem not appear.
Regards,
Matteo
Here, the bad trace:
swapper-1 [000] ....... 5.423726: omap_hsmmc_probe <-platform_drv_probe
swapper-1 [000] ....... 5.423779: mmc_alloc_host <-omap_hsmmc_probe
swapper-1 [000] ....... 5.423809: mmc_of_parse <-omap_hsmmc_probe <=== return -EPROBE_DEFER
swapper-1 [000] ....... 5.423929: omap_hsmmc_probe <-platform_drv_probe
swapper-1 [000] ....... 5.423951: mmc_alloc_host <-omap_hsmmc_probe
swapper-1 [000] ....... 5.423963: mmc_of_parse <-omap_hsmmc_probe
swapper-1 [000] ....... 5.424138: omap_hsmmc_conf_bus_power <-omap_hsmmc_probe
swapper-1 [000] ....... 5.424313: mmc_add_host <-omap_hsmmc_probe
kworker/0:1-10 [000] ....... 5.484477: omap_hsmmc_get_cd <-mmc_rescan
kworker/0:1-10 [000] ....... 5.592549: omap_hsmmc_init_card <-mmc_init_card
kworker/u2:0-6 [000] ....... 5.737132: omap_hsmmc_probe <-platform_drv_probe
kworker/u2:0-6 [000] ....... 5.737179: mmc_alloc_host <-omap_hsmmc_probe
kworker/u2:0-6 [000] ....... 5.737210: mmc_of_parse <-omap_hsmmc_probe
kworker/u2:0-6 [000] ....... 5.742066: omap_hsmmc_conf_bus_power <-omap_hsmmc_probe
kworker/u2:0-6 [000] ....... 5.742251: mmc_add_host <-omap_hsmmc_probe
kworker/0:1-10 [000] ....... 5.795185: omap_hsmmc_get_cd <-mmc_rescan
kworker/0:1-10 [000] ....... 5.916195: omap_hsmmc_init_card <-mmc_sd_init_card
Here, the right trace:
swapper-1 [000] ....... 5.433750: omap_hsmmc_probe <-platform_drv_probe
swapper-1 [000] ....... 5.433803: mmc_alloc_host <-omap_hsmmc_probe
swapper-1 [000] ....... 5.433834: mmc_of_parse <-omap_hsmmc_probe
swapper-1 [000] ....... 5.438754: omap_hsmmc_conf_bus_power <-omap_hsmmc_probe
swapper-1 [000] ....... 5.438948: mmc_add_host <-omap_hsmmc_probe
kworker/0:1-10 [000] ....... 5.494823: omap_hsmmc_get_cd <-mmc_rescan
swapper-1 [000] ....... 5.494977: omap_hsmmc_probe <-platform_drv_probe
swapper-1 [000] ....... 5.495014: mmc_alloc_host <-omap_hsmmc_probe
swapper-1 [000] ....... 5.495037: mmc_of_parse <-omap_hsmmc_probe
swapper-1 [000] ....... 5.495253: omap_hsmmc_conf_bus_power <-omap_hsmmc_probe
swapper-1 [000] ....... 5.495366: mmc_add_host <-omap_hsmmc_probe
kworker/0:3-61 [000] ....... 5.566819: omap_hsmmc_get_cd <-mmc_rescan
kworker/0:1-10 [000] ....... 5.620274: omap_hsmmc_init_card <-mmc_sd_init_card
kworker/0:3-61 [000] ....... 5.666908: omap_hsmmc_init_card <-mmc_init_card