Comment 22 for bug 591941

Revision history for this message
Aapo Rantalainen (aapo-rantalainen) wrote :

I know this is two years old ticket.

I encountered this same 'sd card initialization error with low quality cards' on omap-linux.
Upstream kernels from 2.6.35 to 3.6 has "host->power_mode = MMC_POWER_OFF;" (drivers/mmc/host/omap_hsmmc.c). And with it initializing fails.

Kernels of Ubuntu from 2.6.35-17.23 to (at least) 3.2.0-23.36 has it changed (/reverted) to the "host->power_mode = -1;".

I made this same change and got my SD card initialized and working. That was good, but I also got kernel-warning during boot:

+------------[ cut here ]------------
+WARNING: at drivers/regulator/core.c:1371 _regulator_disable+0x44/0x11c()
+unbalanced disables for VMMC2_IO_18
+Modules linked in:
+[<c005448c>] (unwind_backtrace+0x0/0x120) from [<c008109c>]
(warn_slowpath_common+0x54/0x6c)
+[<c008109c>] (warn_slowpath_common+0x54/0x6c) from [<c008114c>]
(warn_slowpath_fmt+0x34/0x44)
+[<c008114c>] (warn_slowpath_fmt+0x34/0x44) from [<c02b1c2c>]
(_regulator_disable+0x44/0x11c)
+[<c02b1c2c>] (_regulator_disable+0x44/0x11c) from [<c02b1d38>]
(regulator_disable+0x34/0x70)
+[<c02b1d38>] (regulator_disable+0x34/0x70) from [<c03523b4>]
(omap_hsmmc_23_set_power+0xac/0x100)
+[<c03523b4>] (omap_hsmmc_23_set_power+0xac/0x100) from [<c0350c0c>]
(omap_hsmmc_set_ios+0x78/0x2dc)
+[<c0350c0c>] (omap_hsmmc_set_ios+0x78/0x2dc) from [<c03449c4>]
(mmc_power_off+0x9c/0xac)
+[<c03449c4>] (mmc_power_off+0x9c/0xac) from [<c0347048>]
(mmc_start_host+0x14/0x24)
+[<c0347048>] (mmc_start_host+0x14/0x24) from [<c0347bb4>]
(mmc_add_host+0x6c/0x80)
+[<c0347bb4>] (mmc_add_host+0x6c/0x80) from [<c0028020>]
(omap_hsmmc_probe+0x4e8/0x6fc)
+[<c0028020>] (omap_hsmmc_probe+0x4e8/0x6fc) from [<c02e0024>]
(platform_drv_probe+0x1c/0x20)
+[<c02e0024>] (platform_drv_probe+0x1c/0x20) from [<c02debe0>]
(really_probe+0xd8/0x1d4)
+[<c02debe0>] (really_probe+0xd8/0x1d4) from [<c02dee78>]
(driver_probe_device+0x88/0xac)
+[<c02dee78>] (driver_probe_device+0x88/0xac) from [<c02def04>]
(__driver_attach+0x68/0x8c)
+[<c02def04>] (__driver_attach+0x68/0x8c) from [<c02ddc18>]
(bus_for_each_dev+0x54/0x8c)
+[<c02ddc18>] (bus_for_each_dev+0x54/0x8c) from [<c02de4f4>]
(bus_add_driver+0x180/0x30c)
+[<c02de4f4>] (bus_add_driver+0x180/0x30c) from [<c02df140>]
(driver_register+0xb0/0x140)
+[<c02df140>] (driver_register+0xb0/0x140) from [<c02e0470>]
(platform_driver_probe+0x20/0xb4)
+[<c02e0470>] (platform_driver_probe+0x20/0xb4) from [<c00493d8>]
(do_one_initcall+0x3c/0x100)
+[<c00493d8>] (do_one_initcall+0x3c/0x100) from [<c00089b0>]
(kernel_init+0x98/0x144)
+[<c00089b0>] (kernel_init+0x98/0x144) from [<c004fa98>]
(kernel_thread_exit+0x0/0x8)
+---[ end trace 6b67a64bbd611c58 ]---

On code side this seems suspicious :
  unsigned char power_mode;
  host->power_mode = -1;
(negative value to the unsigned char)

----
I got it working when I used vanilla code ("host->power_mode = MMC_POWER_OFF;") and added several printks to the __init omap_hsmmc_probe. So, for me that Ubuntu patch only works because it causes kernel warning, which gives some more time for card-driver to get initialized. I think adding debug messages are hacky as causing intentional kernel-warning, but what is the root cause of this?

Is there people using one of these low quality cards and could check is there that kernel-warning?