omap_hsmmc: regulator usage cleanup and fixes
Subsystems (2)
v3 cover omap_hsmmc: regulator usage cleanup and fixes
This patch series does the following
*) Uses devm_regulator_get_optional() for vmmc and then removes the
CONFIG_REGULATOR check altogether.
*) return on -EPROBE_DEFER and any other fatal errors
*) enable/disable vmmc_aux regulator based on prior state
Changes from v2:
*) rebased to mmc -next branch
*) dropped using "mmc_of_parse_voltage" to get ocr_avail patch.
Changes from v1:
*) return on -EPROBE_DEFER and other fatal errors. (Don't return only
if the return value is -ENODEV)
*) Remove the beagle x15 dts patch. It can be part of a different
series.
*) Avoid using regulator_is_enabled for vqmmc since if the regulator
is shared and the other users are not using regulator_is_enabled then there can be unbalanced regulator_enable/regulator_disable
I've pushed this patch series togit://git.ti.com/linux-phy/linux-phy.git mmc_for-next
Please note the branch also has the pbias fixes [1].
[1] -> https://lkml.org/lkml/2015/7/27/358
This series is in preparation for implementing the voltage switch sequence so that UHS cards can be supported.
Did basic read/write test in J6, J6 Eco, Beagle-x15, AM437x EVM, Beaglebone black, OMAP5 uEVM, OMAP4 PANDA and OMAP3gle xm.
Kishon Vijay Abraham I (15):
mmc: host: omap_hsmmc: use devm_regulator_get_optional() for vmmc
mmc: host: omap_hsmmc: return on fatal errors from omap_hsmmc_reg_get
mmc: host: omap_hsmmc: cleanup omap_hsmmc_reg_get()
mmc: host: omap_hsmmc: use the ocrmask provided by the vmmc regulator
mmc: host: omap_hsmmc: use mmc_host's vmmc and vqmmc
mmc: host: omap_hsmmc: remove unnecessary pbias set_voltage
mmc: host: omap_hsmmc: return error if any of the regulator APIs fail
mmc: host: omap_hsmmc: add separate functions for enable/disable
supply
mmc: host: omap_hsmmc: add separate function to set pbias
mmc: host: omap_hsmmc: avoid pbias regulator enable on power off
mmc: host: omap_hsmmc: don't use ->set_power to set initial regulator
state
mmc: host: omap_hsmmc: enable/disable vmmc_aux regulator based on
previous state
mmc: host: omap_hsmmc: use regulator_is_enabled to find pbias status
mmc: host: omap_hsmmc: use ios->vdd for setting vmmc voltage
mmc: host: omap_hsmmc: remove CONFIG_REGULATOR check
drivers/mmc/host/omap_hsmmc.c | 326 +++++++++++++++++++++++++++-------------- 1 file changed, 212 insertions(+), 114 deletions(-)
Signature · 1 line
1.7.9.5
PATCH v3 1/15 mmc: host: omap_hsmmc: use devm_regulator_get_optional() for vmmc
Since vmmc can be optional for some platforms, use devm_regulator_get_optional() for vmmc. Now return error only if the return value of devm_regulator_get_optional() is not the same as -ENODEV, since with -EPROBE_DEFER, the regulator can be obtained later and all other errors are fatal.
--- drivers/mmc/host/omap_hsmmc.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/mmc/host/omap_hsmmc.c +7 -3
@@ -345,15 +345,19 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host) {struct regulator *reg;int ocr_value =0 ; +int ret;if (mmc_pdata (host)->set_power)return 0 ; - reg =devm_regulator_get (host->dev,"vmmc" ); + reg =devm_regulator_get_optional (host->dev,"vmmc" );if (IS_ERR (reg)) { -dev_err (host->dev,"unable to get vmmc regulator %ld\n" , + ret =PTR_ERR (reg); +if (ret != -ENODEV ) +return ret; + host->vcc =NULL ; +dev_dbg (host->dev,"unable to get vmmc regulator %ld\n" ,PTR_ERR (reg)); -return PTR_ERR (reg); }else { host->vcc = reg; ocr_value =mmc_regulator_get_ocrmask (reg);
Signature · 1 line
1.7.9.5
PATCH v3 2/15 mmc: host: omap_hsmmc: return on fatal errors from omap_hsmmc_reg_get
In reply to Kishon Vijay Abraham INow return error only if the return value of devm_regulator_get_optional() is not the same as -ENODEV, since with -EPROBE_DEFER, the regulator can be obtained later and all other errors are fatal.
--- drivers/mmc/host/omap_hsmmc.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-)
drivers/mmc/host/omap_hsmmc.c +20 -2
@@ -375,10 +375,28 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)/* Allow an aux regulator */ reg =devm_regulator_get_optional (host->dev,"vmmc_aux" ); - host->vcc_aux =IS_ERR (reg) ?NULL : reg; +if (IS_ERR (reg)) { + ret =PTR_ERR (reg); +if (ret != -ENODEV ) +return ret; + host->vcc_aux =NULL ; +dev_dbg (host->dev,"unable to get vmmc_aux regulator %ld\n" , +PTR_ERR (reg)); + }else { + host->vcc_aux = reg; + } reg =devm_regulator_get_optional (host->dev,"pbias" ); - host->pbias =IS_ERR (reg) ?NULL : reg; +if (IS_ERR (reg)) { + ret =PTR_ERR (reg); +if (ret != -ENODEV ) +return ret; + host->pbias =NULL ; +dev_dbg (host->dev,"unable to get pbias regulator %ld\n" , +PTR_ERR (reg)); + }else { + host->pbias = reg; + }/* For eMMC do not power off when not in sleep state */ if (mmc_pdata (host)->no_regulator_off_init)
Signature · 1 line
1.7.9.5
Re: [PATCH v3 02/15] mmc: host: omap_hsmmc: return on fatal errors from omap_hsmmc_reg_get
Hi,
Quoted 7 lines · Kishon Vijay Abraham I
Now return error only if the return value of
devm_regulator_get_optional()is not the same as-ENODEV, since with -EPROBE_DEFER, the regulator can be obtained later and all other errors are fatal.Signed-off-by Kishon Vijay Abraham I <[email protected]>Tested-by Tony Lindgren <[email protected]>
I bisected boot failures on Panda ES with multi_v7_defconfig down to this commit on last night's -next build:
http://arm-soc.lixom.net/bootlogs/next/next-20150828/pandaes-arm-multi_v7_defconfig.html
-Olof
Re: [PATCH v3 02/15] mmc: host: omap_hsmmc: return on fatal errors from omap_hsmmc_reg_get
Quoted 8 lines · Olof Johansson
Hi,
Quoted 5 lines · Kishon Vijay Abraham I
Now return error only if the return value of
devm_regulator_get_optional()is not the same as-ENODEV, since with -EPROBE_DEFER, the regulator can be obtained later and all other errors are fatal.
Quoted 7 lines
Quoted 2 lines
Signed-off-by Kishon Vijay Abraham I <[email protected]>Tested-by Tony Lindgren <[email protected]>I bisected boot failures on Panda ES with
multi_v7_defconfigdown to this commit on last night's -next build:http://arm-soc.lixom.net/bootlogs/next/next-20150828/pandaes-arm-multi_v7_defconfig.html
MMC is working for me at least on Duovero. Interesting that you also have all kind of errors there, I guess this is some older revision of the board.
Anyways, Kishon, care to look into what might be causing this?
Regards,
Tony
Re: [PATCH v3 02/15] mmc: host: omap_hsmmc: return on fatal errors from omap_hsmmc_reg_get
Hi,
Quoted 15 lines · Tony Lindgren
Quoted 14 lines · Olof Johansson
Hi,
Quoted 7 lines · Kishon Vijay Abraham I
Now return error only if the return value of
devm_regulator_get_optional()is not the same as-ENODEV, since with -EPROBE_DEFER, the regulator can be obtained later and all other errors are fatal.Signed-off-by Kishon Vijay Abraham I <[email protected]>Tested-by Tony Lindgren <[email protected]>I bisected boot failures on Panda ES with
multi_v7_defconfigdown to this commit on last night's -next build:
Quoted 7 lines
Quoted 1 line
http://arm-soc.lixom.net/bootlogs/next/next-20150828/pandaes-arm-multi_v7_defconfig.html
MMC is working for me at least on Duovero. Interesting that you also have all kind of errors there, I guess this is some older revision of the board.
Anyways, Kishon, care to look into what might be causing this?
I think this might be because my pbias fix [1] patch wasn't merged yet. I'll try to get that resolved asap.
Thanks
Kishon
[1] -> http://lkml.iu.edu/hypermail/linux/kernel/1507.3/01594.html
Quoted 5 lines
Regards,
Tony
Re: [PATCH v3 02/15] mmc: host: omap_hsmmc: return on fatal errors from omap_hsmmc_reg_get
Quoted 20 lines · Kishon Vijay Abraham I
Hi,
Quoted 17 lines · Tony Lindgren
Quoted 15 lines · Olof Johansson
Hi,
Quoted 7 lines · Kishon Vijay Abraham I
Now return error only if the return value of
devm_regulator_get_optional()is not the same as-ENODEV, since with -EPROBE_DEFER, the regulator can be obtained later and all other errors are fatal.Signed-off-by Kishon Vijay Abraham I <[email protected]>Tested-by Tony Lindgren <[email protected]>I bisected boot failures on Panda ES with
multi_v7_defconfigdown to this commit on last night's -next build:http://arm-soc.lixom.net/bootlogs/next/next-20150828/pandaes-arm-multi_v7_defconfig.html
Quoted 8 lines
Quoted 5 lines
MMC is working for me at least on Duovero. Interesting that you also have all kind of errors there, I guess this is some older revision of the board.
Anyways, Kishon, care to look into what might be causing this?
I think this might be because my pbias fix [1] patch wasn't merged yet. I'll try to get that resolved asap.
Kishon, as there seems to be an ongoing discussion with the regulator regmap stuff for pbias, I suggest you provide a fix for the hsmmc driver instead for now or revert some patches to remove the dependency and get things working.
And I must have tested next-20150827 instead of next-20150828. Or else it does not happen on every boot. In any case, I'm now getting the following on next-20150831 most of the time:
[ 9.493133] omap_hsmmc 4809c000.mmc: using lookup tables for GPIO lookup [ 9.500274] omap_hsmmc 4809c000.mmc: lookup for GPIO wp failed [ 9.506378] ------------[ cut here ]------------ [ 9.508941] WARNING: CPU: 0 PID: 6 at drivers/bus/omap_l3_noc.c:147 l3_interrupt_handler+0x224/0x350() [ 9.520568] 44000000.ocp:L3 Custom Error: MASTER MPU TARGET L4PER2 (Read): Data Access in User mode during Functional access [ 9.524810] Modules linked in: rtc_twl twl4030_wdt [ 9.534820] CPU: 0 PID: 6 Comm: kworker/u4:0 Not tainted 4.2.0-next-20150831-00002-gf55bad8 #1113 [ 9.544830] Hardware name: Generic OMAP4 (Flattened Device Tree) [ 9.544830] Workqueue: deferwq deferred_probe_work_func [ 9.554809] [<c001770c>] (unwind_backtrace) from [<c0013a58>] (show_stack+0x10/0x14) [ 9.564819] [<c0013a58>] (show_stack) from [<c034efb4>] (dump_stack+0x84/0x9c) [ 9.574829] [<c034efb4>] (dump_stack) from [<c003e994>] (warn_slowpath_common+0x78/0xb4) [ 9.574951] [<c003e994>] (warn_slowpath_common) from [<c003ea00>] (warn_slowpath_fmt+0x30/0x40) [ 9.584686] [<c003ea00>] (warn_slowpath_fmt) from [<c037cc7c>] (l3_interrupt_handler+0x224/0x350) [ 9.594818] [<c037cc7c>] (l3_interrupt_handler) from [<c009e7b4>] (handle_irq_event_percpu+0x44/0x1f0) [ 9.604827] [<c009e7b4>] (handle_irq_event_percpu) from [<c009e9a0>] (handle_irq_event+0x40/0x64) [ 9.614807] [<c009e9a0>] (handle_irq_event) from [<c00a1a4c>] (handle_fasteoi_irq+0xcc/0x1c4) [ 9.625396] [<c00a1a4c>] (handle_fasteoi_irq) from [<c009de58>] (generic_handle_irq+0x28/0x3c) [ 9.638732] [<c009de58>] (generic_handle_irq) from [<c009e140>] (__handle_domain_irq+0x64/0xe0) [ 9.647827] [<c009e140>] (__handle_domain_irq) from [<c0009514>] (gic_handle_irq+0x40/0x8c) [ 9.654693] [<c0009514>] (gic_handle_irq) from [<c064ccb8>] (__irq_svc+0x58/0x78) [ 9.664367] Exception stack(0xee0cfd80 to 0xee0cfdc8) [ 9.665130] fd80: ee1ec010 c082f174 000000d0 00000000 ee6b0800 ee6ae850 ee1ec000 ee1ec010 [ 9.674835] fda0: 00000000 ee6b0cc0 000000ee fa09c000 00000003 ee0cfdd0 c04cd748 c04df4e0 [ 9.684814] fdc0: 20000113 ffffffff [ 9.684814] [<c064ccb8>] (__irq_svc) from [<c04df4e0>] (devm_clk_get+0x8/0x70) [ 9.694824] [<c04df4e0>] (devm_clk_get) from [<c04cd748>] (omap_hsmmc_probe+0x2e8/0x9f0) [ 9.704833] [<c04cd748>] (omap_hsmmc_probe) from [<c03e97f4>] (platform_drv_probe+0x44/0xac) [ 9.714691] [<c03e97f4>] (platform_drv_probe) from [<c03e7ea8>] (driver_probe_device+0x1f4/0x2f0) [ 9.724548] [<c03e7ea8>] (driver_probe_device) from [<c03e63b4>] (bus_for_each_drv+0x64/0x98) [ 9.733459] [<c03e63b4>] (bus_for_each_drv) from [<c03e7c28>] (__device_attach+0xb0/0x118) [ 9.734832] [<c03e7c28>] (__device_attach) from [<c03e71d0>] (bus_probe_device+0x88/0x90) [ 9.744812] [<c03e71d0>] (bus_probe_device) from [<c03e75f8>] (deferred_probe_work_func+0x60/0x90) [ 9.760040] [<c03e75f8>] (deferred_probe_work_func) from [<c00589f8>] (process_one_work+0x1a4/0x558) [ 9.769470] [<c00589f8>] (process_one_work) from [<c0058de8>] (worker_thread+0x3c/0x514) [ 9.774688] [<c0058de8>] (worker_thread) from [<c005eb88>] (kthread+0xd4/0xf0) [ 9.785614] [<c005eb88>] (kthread) from [<c000f710>] (ret_from_fork+0x14/0x24) [ 9.785614] ---[ end trace 402743bd8cfdde2f ]---
Quoted 1 line
[1] -> http://lkml.iu.edu/hypermail/linux/kernel/1507.3/01594.html
With patch 1/2 of the above applied, I'm getting this instead:
[ 2.930938] ------------[ cut here ]------------ [ 2.935852] WARNING: CPU: 0 PID: 6 at drivers/regulator/core.c:2105 _regulator_disable+0x13c/0x1d4() [ 2.945465] unbalanced disables for pbias_mmc_omap4 [ 2.945465] Modules linked in: [ 2.950592] CPU: 0 PID: 6 Comm: kworker/u4:0 Not tainted 4.2.0-next-20150831-00003-gc5112ac-dirty #1114 [ 2.963684] Hardware name: Generic OMAP4 (Flattened Device Tree) [ 2.970031] Workqueue: deferwq deferred_probe_work_func [ 2.975585] [<c001770c>] (unwind_backtrace) from [<c0013a58>] (show_stack+0x10/0x14) [ 2.983764] [<c0013a58>] (show_stack) from [<c034efb4>] (dump_stack+0x84/0x9c) [ 2.983764] [<c034efb4>] (dump_stack) from [<c003e994>] (warn_slowpath_common+0x78/0xb4) [ 2.999877] [<c003e994>] (warn_slowpath_common) from [<c003ea00>] (warn_slowpath_fmt+0x30/0x40) [ 3.009063] [<c003ea00>] (warn_slowpath_fmt) from [<c03ad830>] (_regulator_disable+0x13c/0x1d4) [ 3.018218] [<c03ad830>] (_regulator_disable) from [<c03ad8f8>] (regulator_disable+0x30/0x6c) [ 3.027221] [<c03ad8f8>] (regulator_disable) from [<c04cdfe8>] (omap_hsmmc_set_power+0x158/0x1e8) [ 3.027252] [<c04cdfe8>] (omap_hsmmc_set_power) from [<c04ce210>] (omap_hsmmc_set_ios+0x198/0x318) [ 3.046020] [<c04ce210>] (omap_hsmmc_set_ios) from [<c04b7da4>] (mmc_power_up.part.10+0x30/0xf8) [ 3.055267] [<c04b7da4>] (mmc_power_up.part.10) from [<c04b8cb0>] (mmc_start_host+0x40/0x7c) [ 3.064178] [<c04b8cb0>] (mmc_start_host) from [<c04b9dc4>] (mmc_add_host+0x5c/0x84) [ 3.072326] [<c04b9dc4>] (mmc_add_host) from [<c04cda50>] (omap_hsmmc_probe+0x5b0/0x9f0) [ 3.080871] [<c04cda50>] (omap_hsmmc_probe) from [<c03e9834>] (platform_drv_probe+0x44/0xac) [ 3.089752] [<c03e9834>] (platform_drv_probe) from [<c03e7ee8>] (driver_probe_device+0x1f4/0x2f0) [ 3.099090] [<c03e7ee8>] (driver_probe_device) from [<c03e63f4>] (bus_for_each_drv+0x64/0x98) [ 3.108093] [<c03e63f4>] (bus_for_each_drv) from [<c03e7c68>] (__device_attach+0xb0/0x118) [ 3.116790] [<c03e7c68>] (__device_attach) from [<c03e7210>] (bus_probe_device+0x88/0x90) [ 3.125427] [<c03e7210>] (bus_probe_device) from [<c03e7638>] (deferred_probe_work_func+0x60/0x90) [ 3.125427] [<c03e7638>] (deferred_probe_work_func) from [<c00589f8>] (process_one_work+0x1a4/0x558) [ 3.144470] [<c00589f8>] (process_one_work) from [<c0058de8>] (worker_thread+0x3c/0x514) [ 3.152984] [<c0058de8>] (worker_thread) from [<c005eb88>] (kthread+0xd4/0xf0) [ 3.160614] [<c005eb88>] (kthread) from [<c000f710>] (ret_from_fork+0x14/0x24) [ 3.160644] ---[ end trace 2869621ad5ef511c ]---
Regards,
Tony
Re: [PATCH v3 02/15] mmc: host: omap_hsmmc: return on fatal errors from omap_hsmmc_reg_get
Quoted 35 lines · Tony Lindgren
And I must have tested next-20150827 instead of next-20150828. Or else it does not happen on every boot. In any case, I'm now getting the following on next-20150831 most of the time:
[ 9.493133] omap_hsmmc 4809c000.mmc: using lookup tables for GPIO lookup [ 9.500274] omap_hsmmc 4809c000.mmc: lookup for GPIO wp failed [ 9.506378] ------------[ cut here ]------------ [ 9.508941] WARNING: CPU: 0 PID: 6 at drivers/bus/omap_l3_noc.c:147 l3_interrupt_handler+0x224/0x350() [ 9.520568] 44000000.ocp:L3 Custom Error: MASTER MPU TARGET L4PER2 (Read): Data Access in User mode during Functional access [ 9.524810] Modules linked in: rtc_twl twl4030_wdt [ 9.534820] CPU: 0 PID: 6 Comm: kworker/u4:0 Not tainted 4.2.0-next-20150831-00002-gf55bad8 #1113 [ 9.544830] Hardware name: Generic OMAP4 (Flattened Device Tree) [ 9.544830] Workqueue: deferwq deferred_probe_work_func [ 9.554809] [<c001770c>] (unwind_backtrace) from [<c0013a58>] (show_stack+0x10/0x14) [ 9.564819] [<c0013a58>] (show_stack) from [<c034efb4>] (dump_stack+0x84/0x9c) [ 9.574829] [<c034efb4>] (dump_stack) from [<c003e994>] (warn_slowpath_common+0x78/0xb4) [ 9.574951] [<c003e994>] (warn_slowpath_common) from [<c003ea00>] (warn_slowpath_fmt+0x30/0x40) [ 9.584686] [<c003ea00>] (warn_slowpath_fmt) from [<c037cc7c>] (l3_interrupt_handler+0x224/0x350) [ 9.594818] [<c037cc7c>] (l3_interrupt_handler) from [<c009e7b4>] (handle_irq_event_percpu+0x44/0x1f0) [ 9.604827] [<c009e7b4>] (handle_irq_event_percpu) from [<c009e9a0>] (handle_irq_event+0x40/0x64) [ 9.614807] [<c009e9a0>] (handle_irq_event) from [<c00a1a4c>] (handle_fasteoi_irq+0xcc/0x1c4) [ 9.625396] [<c00a1a4c>] (handle_fasteoi_irq) from [<c009de58>] (generic_handle_irq+0x28/0x3c) [ 9.638732] [<c009de58>] (generic_handle_irq) from [<c009e140>] (__handle_domain_irq+0x64/0xe0) [ 9.647827] [<c009e140>] (__handle_domain_irq) from [<c0009514>] (gic_handle_irq+0x40/0x8c) [ 9.654693] [<c0009514>] (gic_handle_irq) from [<c064ccb8>] (__irq_svc+0x58/0x78) [ 9.664367] Exception stack(0xee0cfd80 to 0xee0cfdc8) [ 9.665130] fd80: ee1ec010 c082f174 000000d0 00000000 ee6b0800 ee6ae850 ee1ec000 ee1ec010 [ 9.674835] fda0: 00000000 ee6b0cc0 000000ee fa09c000 00000003 ee0cfdd0 c04cd748 c04df4e0 [ 9.684814] fdc0: 20000113 ffffffff [ 9.684814] [<c064ccb8>] (__irq_svc) from [<c04df4e0>] (devm_clk_get+0x8/0x70) [ 9.694824] [<c04df4e0>] (devm_clk_get) from [<c04cd748>] (omap_hsmmc_probe+0x2e8/0x9f0) [ 9.704833] [<c04cd748>] (omap_hsmmc_probe) from [<c03e97f4>] (platform_drv_probe+0x44/0xac) [ 9.714691] [<c03e97f4>] (platform_drv_probe) from [<c03e7ea8>] (driver_probe_device+0x1f4/0x2f0) [ 9.724548] [<c03e7ea8>] (driver_probe_device) from [<c03e63b4>] (bus_for_each_drv+0x64/0x98)
Quoted 8 lines
[ 9.733459] [<c03e63b4>] (bus_for_each_drv) from [<c03e7c28>] (__device_attach+0xb0/0x118) [ 9.734832] [<c03e7c28>] (__device_attach) from [<c03e71d0>] (bus_probe_device+0x88/0x90) [ 9.744812] [<c03e71d0>] (bus_probe_device) from [<c03e75f8>] (deferred_probe_work_func+0x60/0x90) [ 9.760040] [<c03e75f8>] (deferred_probe_work_func) from [<c00589f8>] (process_one_work+0x1a4/0x558) [ 9.769470] [<c00589f8>] (process_one_work) from [<c0058de8>] (worker_thread+0x3c/0x514) [ 9.774688] [<c0058de8>] (worker_thread) from [<c005eb88>] (kthread+0xd4/0xf0) [ 9.785614] [<c005eb88>] (kthread) from [<c000f710>] (ret_from_fork+0x14/0x24) [ 9.785614] ---[ end trace 402743bd8cfdde2f ]---
And with the (currently almost useless) l3 interrupt stuff taken out by removing the ti,omap4-l3-noc compatible from omap4.dtsi, we get a real trace that might be of some help to you:
[ 8.440917] omap_hsmmc 4809c000.mmc: lookup for GPIO wp failed [ 8.447418] Unhandled fault: imprecise external abort (0x1406) at 0xbeafaa10 [ 8.454925] pgd = c0004000 [ 8.454986] [beafaa10] *pgd=00000000/root/init: line 14: /sys/devices/68000000.ocp/4 8098000.spi/spi_master/spi1/spi1[ 8.461334] Internal error: : 1406 [#1] SMP ARM .2/backlight/acx565akm/brightness: No such file [ 8.473175] Modules linked in:or directory rtc_twl twl4030_wdt [ 8.483520] CPU: 1 PID: 66 Comm: kworker/u4:1 Not tainted 4.2.0-next-20150831-00002-gf55bad8-dirty #1115 [ 8.493652] Hardware name: Generic OMAP4 (Flattened Device Tree) [ 8.498352] Workqueue: deferwq deferred_probe_work_func [ 8.505493] task: ee5f4f40 ti: ee5f6000 task.ti: ee5f6000 [ 8.510803] PC is at devm_clk_get+0x8/0x70 [ 8.514801] LR is at omap_hsmmc_probe+0x2e8/0x9f0 [ 8.520385] pc : [<c04df4e0>] lr : [<c04cd748>] psr: 20010013 [ 8.520385] sp : ee5f7dd0 ip : 00000003 fp : fa09c000 [ 8.532470] r10: 000000ee r9 : ee6904c0 r8 : 00000000 [ 8.537963] r7 : ee1ec010 r6 : ee1ec000 r5 : ee6e7dd0 r4 : ee690000 [ 8.544769] r3 : 00000000 r2 : 000000d0 r1 : c082f184 r0 : ee1ec010 [ 8.551666] Flags: nzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none [ 8.559143] Control: 10c5387d Table: ae73804a DAC: 00000051 [ 8.564727] Process kworker/u4:1 (pid: 66, stack limit = 0xee5f6218) [ 8.571441] Stack: (0xee5f7dd0 to 0xee5f8000) [ 8.576263] 7dc0: ee690000 ee6e7dd0 ee1ec000 c04cd748 [ 8.584930] 7de0: 00000000 c09cf8f8 ee1ed270 ee5de150 00000000 ee090248 c11cb0d4 c09ae55c [ 8.593597] 7e00: 00000000 ee1ec010 ee1ec010 c09ae55c fffffdfb 0000001d c09cf8f8 00000000 [ 8.601837] 7e20: c09cf8f8 c03e97f4 ee1ec010 c11cb118 c09ae55c 00000000 0000001d c03e7ea8 [ 8.610107] 7e40: 00000000 ee5f7e70 c03e803c 00000001 ee5f7ec8 c03e63b4 ee0f2ed4 ee5d6594 [ 8.619323] 7e60: ee1ec010 ee1ec010 ee1ec044 c03e7c28 ee1ec010 00000001 c099b110 ee1ec010 [ 8.627777] 7e80: ee1ec010 c099a708 ee61cf00 c03e71d0 ee1ec010 c099a3fc c099a3b8 c03e75f8 [ 8.636535] 7ea0: c099a434 ee371940 ee08a400 c00589f8 00000001 00000000 c0058968 ee08a400 [ 8.644805] 7ec0: c0058e5c 00000001 c099a434 c0b2a770 00000000 c0811a00 ee08a400 ee08a400 [ 8.653503] 7ee0: ee371958 ee08a430 ee5f6000 00000088 c09cf04c ee371940 ee08a400 c0058de8 [ 8.662261] 7f00: ee08a5d0 00000000 c0058dac 00000000 ee56af40 ee371940 c0058dac 00000000 [ 8.670532] 7f20: 00000000 00000000 00000000 c005eb88 1c4eefdf 00000000 00000000 ee371940 [ 8.679290] 7f40: 00000000 00000000 dead4ead ffffffff ffffffff c09d6da0 00000000 00000000 [ 8.679290] 7f60: c07d16a0 ee5f7f64 ee5f7f64 00000000 00000000 dead4ead ffffffff ffffffff [ 8.696411] 7f80: c09d6da0 00000000 00000000 c07d16a0 ee5f7f90 ee5f7f90 ee5f7fac ee56af40 [ 8.705047] 7fa0: c005eab4 00000000 00000000 c000f710 00000000 00000000 00000000 00000000 [ 8.713562] 7fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 [ 8.721435] 7fe0: 00000000 00000000 00000000 00000000 00000013 00000000 2eade3dd cf5fffcd [ 8.730743] [<c04df4e0>] (devm_clk_get) from [<c04cd748>] (omap_hsmmc_probe+0x2e8/0x9f0) [ 8.738952] [<c04cd748>] (omap_hsmmc_probe) from [<c03e97f4>] (platform_drv_probe+0x44/0xac) [ 8.748077] [<c03e97f4>] (platform_drv_probe) from [<c03e7ea8>] (driver_probe_device+0x1f4/0x2f0) [ 8.757385] [<c03e7ea8>] (driver_probe_device) from [<c03e63b4>] (bus_for_each_drv+0x64/0x98) [ 8.766326] [<c03e63b4>] (bus_for_each_drv) from [<c03e7c28>] (__device_attach+0xb0/0x118) [ 8.774993] [<c03e7c28>] (__device_attach) from [<c03e71d0>] (bus_probe_device+0x88/0x90) [ 8.783538] [<c03e71d0>] (bus_probe_device) from [<c03e75f8>] (deferred_probe_work_func+0x60/0x90) [ 8.792907] [<c03e75f8>] (deferred_probe_work_func) from [<c00589f8>] (process_one_work+0x1a4/0x558) [ 8.802490] [<c00589f8>] (process_one_work) from [<c0058de8>] (worker_thread+0x3c/0x514) [ 8.810943] [<c0058de8>] (worker_thread) from [<c005eb88>] (kthread+0xd4/0xf0) [ 8.818511] [<c005eb88>] (kthread) from [<c000f710>] (ret_from_fork+0x14/0x24) [ 8.824737] Code: e5910000 ea000091 e92d4070 e3a020d0 (e1a06000) [ 8.826141] ---[ end trace a89146bc4a70cc4d ]---
Regards,
Tony
Re: [PATCH v3 02/15] mmc: host: omap_hsmmc: return on fatal errors from omap_hsmmc_reg_get
Quoted 94 lines · Tony Lindgren
Quoted 35 lines · Tony Lindgren
And I must have tested next-20150827 instead of next-20150828. Or else it does not happen on every boot. In any case, I'm now getting the following on next-20150831 most of the time:
[ 9.493133] omap_hsmmc 4809c000.mmc: using lookup tables for GPIO lookup [ 9.500274] omap_hsmmc 4809c000.mmc: lookup for GPIO wp failed [ 9.506378] ------------[ cut here ]------------ [ 9.508941] WARNING: CPU: 0 PID: 6 at drivers/bus/omap_l3_noc.c:147 l3_interrupt_handler+0x224/0x350() [ 9.520568] 44000000.ocp:L3 Custom Error: MASTER MPU TARGET L4PER2 (Read): Data Access in User mode during Functional access [ 9.524810] Modules linked in: rtc_twl twl4030_wdt [ 9.534820] CPU: 0 PID: 6 Comm: kworker/u4:0 Not tainted 4.2.0-next-20150831-00002-gf55bad8 #1113 [ 9.544830] Hardware name: Generic OMAP4 (Flattened Device Tree) [ 9.544830] Workqueue: deferwq deferred_probe_work_func [ 9.554809] [<c001770c>] (unwind_backtrace) from [<c0013a58>] (show_stack+0x10/0x14) [ 9.564819] [<c0013a58>] (show_stack) from [<c034efb4>] (dump_stack+0x84/0x9c) [ 9.574829] [<c034efb4>] (dump_stack) from [<c003e994>] (warn_slowpath_common+0x78/0xb4) [ 9.574951] [<c003e994>] (warn_slowpath_common) from [<c003ea00>] (warn_slowpath_fmt+0x30/0x40) [ 9.584686] [<c003ea00>] (warn_slowpath_fmt) from [<c037cc7c>] (l3_interrupt_handler+0x224/0x350) [ 9.594818] [<c037cc7c>] (l3_interrupt_handler) from [<c009e7b4>] (handle_irq_event_percpu+0x44/0x1f0) [ 9.604827] [<c009e7b4>] (handle_irq_event_percpu) from [<c009e9a0>] (handle_irq_event+0x40/0x64) [ 9.614807] [<c009e9a0>] (handle_irq_event) from [<c00a1a4c>] (handle_fasteoi_irq+0xcc/0x1c4) [ 9.625396] [<c00a1a4c>] (handle_fasteoi_irq) from [<c009de58>] (generic_handle_irq+0x28/0x3c) [ 9.638732] [<c009de58>] (generic_handle_irq) from [<c009e140>] (__handle_domain_irq+0x64/0xe0) [ 9.647827] [<c009e140>] (__handle_domain_irq) from [<c0009514>] (gic_handle_irq+0x40/0x8c) [ 9.654693] [<c0009514>] (gic_handle_irq) from [<c064ccb8>] (__irq_svc+0x58/0x78) [ 9.664367] Exception stack(0xee0cfd80 to 0xee0cfdc8) [ 9.665130] fd80: ee1ec010 c082f174 000000d0 00000000 ee6b0800 ee6ae850 ee1ec000 ee1ec010 [ 9.674835] fda0: 00000000 ee6b0cc0 000000ee fa09c000 00000003 ee0cfdd0 c04cd748 c04df4e0 [ 9.684814] fdc0: 20000113 ffffffff [ 9.684814] [<c064ccb8>] (__irq_svc) from [<c04df4e0>] (devm_clk_get+0x8/0x70) [ 9.694824] [<c04df4e0>] (devm_clk_get) from [<c04cd748>] (omap_hsmmc_probe+0x2e8/0x9f0) [ 9.704833] [<c04cd748>] (omap_hsmmc_probe) from [<c03e97f4>] (platform_drv_probe+0x44/0xac) [ 9.714691] [<c03e97f4>] (platform_drv_probe) from [<c03e7ea8>] (driver_probe_device+0x1f4/0x2f0) [ 9.724548] [<c03e7ea8>] (driver_probe_device) from [<c03e63b4>] (bus_for_each_drv+0x64/0x98)Quoted 8 lines
[ 9.733459] [<c03e63b4>] (bus_for_each_drv) from [<c03e7c28>] (__device_attach+0xb0/0x118) [ 9.734832] [<c03e7c28>] (__device_attach) from [<c03e71d0>] (bus_probe_device+0x88/0x90) [ 9.744812] [<c03e71d0>] (bus_probe_device) from [<c03e75f8>] (deferred_probe_work_func+0x60/0x90) [ 9.760040] [<c03e75f8>] (deferred_probe_work_func) from [<c00589f8>] (process_one_work+0x1a4/0x558) [ 9.769470] [<c00589f8>] (process_one_work) from [<c0058de8>] (worker_thread+0x3c/0x514) [ 9.774688] [<c0058de8>] (worker_thread) from [<c005eb88>] (kthread+0xd4/0xf0) [ 9.785614] [<c005eb88>] (kthread) from [<c000f710>] (ret_from_fork+0x14/0x24) [ 9.785614] ---[ end trace 402743bd8cfdde2f ]---And with the (currently almost useless) l3 interrupt stuff taken out by removing the ti,omap4-l3-noc compatible from
omap4.dtsi, we get a real trace that might be of some help to you:[ 8.440917] omap_hsmmc 4809c000.mmc: lookup for GPIO wp failed [ 8.447418] Unhandled fault: imprecise external abort (0x1406) at 0xbeafaa10 [ 8.454925] pgd = c0004000 [ 8.454986] [beafaa10] *pgd=00000000/root/init: line 14: /sys/devices/68000000.ocp/4 8098000.spi/spi_master/spi1/spi1[ 8.461334] Internal error: : 1406 [#1] SMP ARM .2/backlight/acx565akm/brightness: No such file [ 8.473175] Modules linked in:or directory rtc_twl twl4030_wdt [ 8.483520] CPU: 1 PID: 66 Comm: kworker/u4:1 Not tainted 4.2.0-next-20150831-00002-gf55bad8-dirty #1115 [ 8.493652] Hardware name: Generic OMAP4 (Flattened Device Tree) [ 8.498352] Workqueue: deferwq deferred_probe_work_func [ 8.505493] task: ee5f4f40 ti: ee5f6000 task.ti: ee5f6000 [ 8.510803] PC is at devm_clk_get+0x8/0x70 [ 8.514801] LR is at omap_hsmmc_probe+0x2e8/0x9f0 [ 8.520385] pc : [<c04df4e0>] lr : [<c04cd748>] psr: 20010013 [ 8.520385] sp : ee5f7dd0 ip : 00000003 fp : fa09c000 [ 8.532470] r10: 000000ee r9 : ee6904c0 r8 : 00000000 [ 8.537963] r7 : ee1ec010 r6 : ee1ec000 r5 : ee6e7dd0 r4 : ee690000 [ 8.544769] r3 : 00000000 r2 : 000000d0 r1 : c082f184 r0 : ee1ec010 [ 8.551666] Flags: nzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none [ 8.559143] Control: 10c5387d Table: ae73804a DAC: 00000051 [ 8.564727] Process kworker/u4:1 (pid: 66, stack limit = 0xee5f6218) [ 8.571441] Stack: (0xee5f7dd0 to 0xee5f8000) [ 8.576263] 7dc0: ee690000 ee6e7dd0 ee1ec000 c04cd748 [ 8.584930] 7de0: 00000000 c09cf8f8 ee1ed270 ee5de150 00000000 ee090248 c11cb0d4 c09ae55c [ 8.593597] 7e00: 00000000 ee1ec010 ee1ec010 c09ae55c fffffdfb 0000001d c09cf8f8 00000000 [ 8.601837] 7e20: c09cf8f8 c03e97f4 ee1ec010 c11cb118 c09ae55c 00000000 0000001d c03e7ea8 [ 8.610107] 7e40: 00000000 ee5f7e70 c03e803c 00000001 ee5f7ec8 c03e63b4 ee0f2ed4 ee5d6594 [ 8.619323] 7e60: ee1ec010 ee1ec010 ee1ec044 c03e7c28 ee1ec010 00000001 c099b110 ee1ec010 [ 8.627777] 7e80: ee1ec010 c099a708 ee61cf00 c03e71d0 ee1ec010 c099a3fc c099a3b8 c03e75f8 [ 8.636535] 7ea0: c099a434 ee371940 ee08a400 c00589f8 00000001 00000000 c0058968 ee08a400 [ 8.644805] 7ec0: c0058e5c 00000001 c099a434 c0b2a770 00000000 c0811a00 ee08a400 ee08a400 [ 8.653503] 7ee0: ee371958 ee08a430 ee5f6000 00000088 c09cf04c ee371940 ee08a400 c0058de8 [ 8.662261] 7f00: ee08a5d0 00000000 c0058dac 00000000 ee56af40 ee371940 c0058dac 00000000 [ 8.670532] 7f20: 00000000 00000000 00000000 c005eb88 1c4eefdf 00000000 00000000 ee371940 [ 8.679290] 7f40: 00000000 00000000 dead4ead ffffffff ffffffff c09d6da0 00000000 00000000 [ 8.679290] 7f60: c07d16a0 ee5f7f64 ee5f7f64 00000000 00000000 dead4ead ffffffff ffffffff [ 8.696411] 7f80: c09d6da0 00000000 00000000 c07d16a0 ee5f7f90 ee5f7f90 ee5f7fac ee56af40 [ 8.705047] 7fa0: c005eab4 00000000 00000000 c000f710 00000000 00000000 00000000 00000000 [ 8.713562] 7fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 [ 8.721435] 7fe0: 00000000 00000000 00000000 00000000 00000013 00000000 2eade3dd cf5fffcd [ 8.730743] [<c04df4e0>] (devm_clk_get) from [<c04cd748>] (omap_hsmmc_probe+0x2e8/0x9f0) [ 8.738952] [<c04cd748>] (omap_hsmmc_probe) from [<c03e97f4>] (platform_drv_probe+0x44/0xac) [ 8.748077] [<c03e97f4>] (platform_drv_probe) from [<c03e7ea8>] (driver_probe_device+0x1f4/0x2f0) [ 8.757385] [<c03e7ea8>] (driver_probe_device) from [<c03e63b4>] (bus_for_each_drv+0x64/0x98) [ 8.766326] [<c03e63b4>] (bus_for_each_drv) from [<c03e7c28>] (__device_attach+0xb0/0x118)
Quoted 9 lines
[ 8.774993] [<c03e7c28>] (__device_attach) from [<c03e71d0>] (bus_probe_device+0x88/0x90) [ 8.783538] [<c03e71d0>] (bus_probe_device) from [<c03e75f8>] (deferred_probe_work_func+0x60/0x90) [ 8.792907] [<c03e75f8>] (deferred_probe_work_func) from [<c00589f8>] (process_one_work+0x1a4/0x558) [ 8.802490] [<c00589f8>] (process_one_work) from [<c0058de8>] (worker_thread+0x3c/0x514) [ 8.810943] [<c0058de8>] (worker_thread) from [<c005eb88>] (kthread+0xd4/0xf0) [ 8.818511] [<c005eb88>] (kthread) from [<c000f710>] (ret_from_fork+0x14/0x24) [ 8.824737] Code: e5910000 ea000091 e92d4070 e3a020d0 (e1a06000) [ 8.826141] ---[ end trace a89146bc4a70cc4d ]---
On -next, Above crash signature could be related to race
"ARM: OMAP2+: omap-device: fix race deferred probe of omap_hsmmc vs omap_device_late_init"
http://www.spinics.net/lists/linux-omap/msg121622.html
Especially if before crash smth. like below appears in log:
Quoted 2 lines
[ 1.840364] omap_hsmmc 480b4000.mmc: omap_device_late_idle: enabled but no driver. Idling [ 1.840634] ldousb: disabling
Signature · 2 lines
regards, -grygorii
Re: [PATCH v3 02/15] mmc: host: omap_hsmmc: return on fatal errors from omap_hsmmc_reg_get
Quoted 105 lines · Grygorii Strashko
Quoted 94 lines · Tony Lindgren
Quoted 35 lines · Tony Lindgren
And I must have tested next-20150827 instead of next-20150828. Or else it does not happen on every boot. In any case, I'm now getting the following on next-20150831 most of the time:
[ 9.493133] omap_hsmmc 4809c000.mmc: using lookup tables for GPIO lookup [ 9.500274] omap_hsmmc 4809c000.mmc: lookup for GPIO wp failed [ 9.506378] ------------[ cut here ]------------ [ 9.508941] WARNING: CPU: 0 PID: 6 at drivers/bus/omap_l3_noc.c:147 l3_interrupt_handler+0x224/0x350() [ 9.520568] 44000000.ocp:L3 Custom Error: MASTER MPU TARGET L4PER2 (Read): Data Access in User mode during Functional access [ 9.524810] Modules linked in: rtc_twl twl4030_wdt [ 9.534820] CPU: 0 PID: 6 Comm: kworker/u4:0 Not tainted 4.2.0-next-20150831-00002-gf55bad8 #1113 [ 9.544830] Hardware name: Generic OMAP4 (Flattened Device Tree) [ 9.544830] Workqueue: deferwq deferred_probe_work_func [ 9.554809] [<c001770c>] (unwind_backtrace) from [<c0013a58>] (show_stack+0x10/0x14) [ 9.564819] [<c0013a58>] (show_stack) from [<c034efb4>] (dump_stack+0x84/0x9c) [ 9.574829] [<c034efb4>] (dump_stack) from [<c003e994>] (warn_slowpath_common+0x78/0xb4) [ 9.574951] [<c003e994>] (warn_slowpath_common) from [<c003ea00>] (warn_slowpath_fmt+0x30/0x40) [ 9.584686] [<c003ea00>] (warn_slowpath_fmt) from [<c037cc7c>] (l3_interrupt_handler+0x224/0x350) [ 9.594818] [<c037cc7c>] (l3_interrupt_handler) from [<c009e7b4>] (handle_irq_event_percpu+0x44/0x1f0) [ 9.604827] [<c009e7b4>] (handle_irq_event_percpu) from [<c009e9a0>] (handle_irq_event+0x40/0x64) [ 9.614807] [<c009e9a0>] (handle_irq_event) from [<c00a1a4c>] (handle_fasteoi_irq+0xcc/0x1c4) [ 9.625396] [<c00a1a4c>] (handle_fasteoi_irq) from [<c009de58>] (generic_handle_irq+0x28/0x3c) [ 9.638732] [<c009de58>] (generic_handle_irq) from [<c009e140>] (__handle_domain_irq+0x64/0xe0) [ 9.647827] [<c009e140>] (__handle_domain_irq) from [<c0009514>] (gic_handle_irq+0x40/0x8c) [ 9.654693] [<c0009514>] (gic_handle_irq) from [<c064ccb8>] (__irq_svc+0x58/0x78) [ 9.664367] Exception stack(0xee0cfd80 to 0xee0cfdc8) [ 9.665130] fd80: ee1ec010 c082f174 000000d0 00000000 ee6b0800 ee6ae850 ee1ec000 ee1ec010 [ 9.674835] fda0: 00000000 ee6b0cc0 000000ee fa09c000 00000003 ee0cfdd0 c04cd748 c04df4e0 [ 9.684814] fdc0: 20000113 ffffffff [ 9.684814] [<c064ccb8>] (__irq_svc) from [<c04df4e0>] (devm_clk_get+0x8/0x70) [ 9.694824] [<c04df4e0>] (devm_clk_get) from [<c04cd748>] (omap_hsmmc_probe+0x2e8/0x9f0) [ 9.704833] [<c04cd748>] (omap_hsmmc_probe) from [<c03e97f4>] (platform_drv_probe+0x44/0xac) [ 9.714691] [<c03e97f4>] (platform_drv_probe) from [<c03e7ea8>] (driver_probe_device+0x1f4/0x2f0) [ 9.724548] [<c03e7ea8>] (driver_probe_device) from [<c03e63b4>] (bus_for_each_drv+0x64/0x98)Quoted 8 lines
[ 9.733459] [<c03e63b4>] (bus_for_each_drv) from [<c03e7c28>] (__device_attach+0xb0/0x118) [ 9.734832] [<c03e7c28>] (__device_attach) from [<c03e71d0>] (bus_probe_device+0x88/0x90) [ 9.744812] [<c03e71d0>] (bus_probe_device) from [<c03e75f8>] (deferred_probe_work_func+0x60/0x90) [ 9.760040] [<c03e75f8>] (deferred_probe_work_func) from [<c00589f8>] (process_one_work+0x1a4/0x558) [ 9.769470] [<c00589f8>] (process_one_work) from [<c0058de8>] (worker_thread+0x3c/0x514) [ 9.774688] [<c0058de8>] (worker_thread) from [<c005eb88>] (kthread+0xd4/0xf0) [ 9.785614] [<c005eb88>] (kthread) from [<c000f710>] (ret_from_fork+0x14/0x24) [ 9.785614] ---[ end trace 402743bd8cfdde2f ]---And with the (currently almost useless) l3 interrupt stuff taken out by removing the ti,omap4-l3-noc compatible from
omap4.dtsi, we get a real trace that might be of some help to you:[ 8.440917] omap_hsmmc 4809c000.mmc: lookup for GPIO wp failed [ 8.447418] Unhandled fault: imprecise external abort (0x1406) at 0xbeafaa10 [ 8.454925] pgd = c0004000 [ 8.454986] [beafaa10] *pgd=00000000/root/init: line 14: /sys/devices/68000000.ocp/4 8098000.spi/spi_master/spi1/spi1[ 8.461334] Internal error: : 1406 [#1] SMP ARM .2/backlight/acx565akm/brightness: No such file [ 8.473175] Modules linked in:or directory rtc_twl twl4030_wdt [ 8.483520] CPU: 1 PID: 66 Comm: kworker/u4:1 Not tainted 4.2.0-next-20150831-00002-gf55bad8-dirty #1115 [ 8.493652] Hardware name: Generic OMAP4 (Flattened Device Tree) [ 8.498352] Workqueue: deferwq deferred_probe_work_func [ 8.505493] task: ee5f4f40 ti: ee5f6000 task.ti: ee5f6000 [ 8.510803] PC is at devm_clk_get+0x8/0x70 [ 8.514801] LR is at omap_hsmmc_probe+0x2e8/0x9f0 [ 8.520385] pc : [<c04df4e0>] lr : [<c04cd748>] psr: 20010013 [ 8.520385] sp : ee5f7dd0 ip : 00000003 fp : fa09c000 [ 8.532470] r10: 000000ee r9 : ee6904c0 r8 : 00000000 [ 8.537963] r7 : ee1ec010 r6 : ee1ec000 r5 : ee6e7dd0 r4 : ee690000 [ 8.544769] r3 : 00000000 r2 : 000000d0 r1 : c082f184 r0 : ee1ec010 [ 8.551666] Flags: nzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none [ 8.559143] Control: 10c5387d Table: ae73804a DAC: 00000051 [ 8.564727] Process kworker/u4:1 (pid: 66, stack limit = 0xee5f6218) [ 8.571441] Stack: (0xee5f7dd0 to 0xee5f8000) [ 8.576263] 7dc0: ee690000 ee6e7dd0 ee1ec000 c04cd748 [ 8.584930] 7de0: 00000000 c09cf8f8 ee1ed270 ee5de150 00000000 ee090248 c11cb0d4 c09ae55c [ 8.593597] 7e00: 00000000 ee1ec010 ee1ec010 c09ae55c fffffdfb 0000001d c09cf8f8 00000000 [ 8.601837] 7e20: c09cf8f8 c03e97f4 ee1ec010 c11cb118 c09ae55c 00000000 0000001d c03e7ea8 [ 8.610107] 7e40: 00000000 ee5f7e70 c03e803c 00000001 ee5f7ec8 c03e63b4 ee0f2ed4 ee5d6594 [ 8.619323] 7e60: ee1ec010 ee1ec010 ee1ec044 c03e7c28 ee1ec010 00000001 c099b110 ee1ec010 [ 8.627777] 7e80: ee1ec010 c099a708 ee61cf00 c03e71d0 ee1ec010 c099a3fc c099a3b8 c03e75f8 [ 8.636535] 7ea0: c099a434 ee371940 ee08a400 c00589f8 00000001 00000000 c0058968 ee08a400 [ 8.644805] 7ec0: c0058e5c 00000001 c099a434 c0b2a770 00000000 c0811a00 ee08a400 ee08a400 [ 8.653503] 7ee0: ee371958 ee08a430 ee5f6000 00000088 c09cf04c ee371940 ee08a400 c0058de8 [ 8.662261] 7f00: ee08a5d0 00000000 c0058dac 00000000 ee56af40 ee371940 c0058dac 00000000 [ 8.670532] 7f20: 00000000 00000000 00000000 c005eb88 1c4eefdf 00000000 00000000 ee371940 [ 8.679290] 7f40: 00000000 00000000 dead4ead ffffffff ffffffff c09d6da0 00000000 00000000 [ 8.679290] 7f60: c07d16a0 ee5f7f64 ee5f7f64 00000000 00000000 dead4ead ffffffff ffffffff [ 8.696411] 7f80: c09d6da0 00000000 00000000 c07d16a0 ee5f7f90 ee5f7f90 ee5f7fac ee56af40 [ 8.705047] 7fa0: c005eab4 00000000 00000000 c000f710 00000000 00000000 00000000 00000000 [ 8.713562] 7fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 [ 8.721435] 7fe0: 00000000 00000000 00000000 00000000 00000013 00000000 2eade3dd cf5fffcd [ 8.730743] [<c04df4e0>] (devm_clk_get) from [<c04cd748>] (omap_hsmmc_probe+0x2e8/0x9f0) [ 8.738952] [<c04cd748>] (omap_hsmmc_probe) from [<c03e97f4>] (platform_drv_probe+0x44/0xac) [ 8.748077] [<c03e97f4>] (platform_drv_probe) from [<c03e7ea8>] (driver_probe_device+0x1f4/0x2f0) [ 8.757385] [<c03e7ea8>] (driver_probe_device) from [<c03e63b4>] (bus_for_each_drv+0x64/0x98) [ 8.766326] [<c03e63b4>] (bus_for_each_drv) from [<c03e7c28>] (__device_attach+0xb0/0x118)Quoted 9 lines
[ 8.774993] [<c03e7c28>] (__device_attach) from [<c03e71d0>] (bus_probe_device+0x88/0x90) [ 8.783538] [<c03e71d0>] (bus_probe_device) from [<c03e75f8>] (deferred_probe_work_func+0x60/0x90) [ 8.792907] [<c03e75f8>] (deferred_probe_work_func) from [<c00589f8>] (process_one_work+0x1a4/0x558) [ 8.802490] [<c00589f8>] (process_one_work) from [<c0058de8>] (worker_thread+0x3c/0x514) [ 8.810943] [<c0058de8>] (worker_thread) from [<c005eb88>] (kthread+0xd4/0xf0) [ 8.818511] [<c005eb88>] (kthread) from [<c000f710>] (ret_from_fork+0x14/0x24) [ 8.824737] Code: e5910000 ea000091 e92d4070 e3a020d0 (e1a06000) [ 8.826141] ---[ end trace a89146bc4a70cc4d ]---
Quoted 3 lines
On -next, Above crash signature could be related to race
"ARM: OMAP2+: omap-device: fix race deferred probe ofomap_hsmmcvsomap_device_late_init"
http://www.spinics.net/lists/linux-omap/msg121622.html
Good point thanks, yes that's the case. MMC probing fails and then we hit this separate issue while MMC is trying to probe. Applying your fix makes the abort disappear, but naturally does not get MMC working again.
Regards,
Tony
Re: [PATCH v3 02/15] mmc: host: omap_hsmmc: return on fatal errors from omap_hsmmc_reg_get
Quoted 106 lines · Tony Lindgren
Quoted 105 lines · Grygorii Strashko
Quoted 103 lines · Tony Lindgren
Quoted 35 lines · Tony Lindgren
And I must have tested next-20150827 instead of next-20150828. Or else it does not happen on every boot. In any case, I'm now getting the following on next-20150831 most of the time:
[ 9.493133] omap_hsmmc 4809c000.mmc: using lookup tables for GPIO lookup [ 9.500274] omap_hsmmc 4809c000.mmc: lookup for GPIO wp failed [ 9.506378] ------------[ cut here ]------------ [ 9.508941] WARNING: CPU: 0 PID: 6 at drivers/bus/omap_l3_noc.c:147 l3_interrupt_handler+0x224/0x350() [ 9.520568] 44000000.ocp:L3 Custom Error: MASTER MPU TARGET L4PER2 (Read): Data Access in User mode during Functional access [ 9.524810] Modules linked in: rtc_twl twl4030_wdt [ 9.534820] CPU: 0 PID: 6 Comm: kworker/u4:0 Not tainted 4.2.0-next-20150831-00002-gf55bad8 #1113 [ 9.544830] Hardware name: Generic OMAP4 (Flattened Device Tree) [ 9.544830] Workqueue: deferwq deferred_probe_work_func [ 9.554809] [<c001770c>] (unwind_backtrace) from [<c0013a58>] (show_stack+0x10/0x14) [ 9.564819] [<c0013a58>] (show_stack) from [<c034efb4>] (dump_stack+0x84/0x9c) [ 9.574829] [<c034efb4>] (dump_stack) from [<c003e994>] (warn_slowpath_common+0x78/0xb4) [ 9.574951] [<c003e994>] (warn_slowpath_common) from [<c003ea00>] (warn_slowpath_fmt+0x30/0x40) [ 9.584686] [<c003ea00>] (warn_slowpath_fmt) from [<c037cc7c>] (l3_interrupt_handler+0x224/0x350) [ 9.594818] [<c037cc7c>] (l3_interrupt_handler) from [<c009e7b4>] (handle_irq_event_percpu+0x44/0x1f0) [ 9.604827] [<c009e7b4>] (handle_irq_event_percpu) from [<c009e9a0>] (handle_irq_event+0x40/0x64) [ 9.614807] [<c009e9a0>] (handle_irq_event) from [<c00a1a4c>] (handle_fasteoi_irq+0xcc/0x1c4) [ 9.625396] [<c00a1a4c>] (handle_fasteoi_irq) from [<c009de58>] (generic_handle_irq+0x28/0x3c) [ 9.638732] [<c009de58>] (generic_handle_irq) from [<c009e140>] (__handle_domain_irq+0x64/0xe0) [ 9.647827] [<c009e140>] (__handle_domain_irq) from [<c0009514>] (gic_handle_irq+0x40/0x8c) [ 9.654693] [<c0009514>] (gic_handle_irq) from [<c064ccb8>] (__irq_svc+0x58/0x78) [ 9.664367] Exception stack(0xee0cfd80 to 0xee0cfdc8) [ 9.665130] fd80: ee1ec010 c082f174 000000d0 00000000 ee6b0800 ee6ae850 ee1ec000 ee1ec010 [ 9.674835] fda0: 00000000 ee6b0cc0 000000ee fa09c000 00000003 ee0cfdd0 c04cd748 c04df4e0 [ 9.684814] fdc0: 20000113 ffffffff [ 9.684814] [<c064ccb8>] (__irq_svc) from [<c04df4e0>] (devm_clk_get+0x8/0x70) [ 9.694824] [<c04df4e0>] (devm_clk_get) from [<c04cd748>] (omap_hsmmc_probe+0x2e8/0x9f0) [ 9.704833] [<c04cd748>] (omap_hsmmc_probe) from [<c03e97f4>] (platform_drv_probe+0x44/0xac) [ 9.714691] [<c03e97f4>] (platform_drv_probe) from [<c03e7ea8>] (driver_probe_device+0x1f4/0x2f0) [ 9.724548] [<c03e7ea8>] (driver_probe_device) from [<c03e63b4>] (bus_for_each_drv+0x64/0x98)Quoted 8 lines
[ 9.733459] [<c03e63b4>] (bus_for_each_drv) from [<c03e7c28>] (__device_attach+0xb0/0x118) [ 9.734832] [<c03e7c28>] (__device_attach) from [<c03e71d0>] (bus_probe_device+0x88/0x90) [ 9.744812] [<c03e71d0>] (bus_probe_device) from [<c03e75f8>] (deferred_probe_work_func+0x60/0x90) [ 9.760040] [<c03e75f8>] (deferred_probe_work_func) from [<c00589f8>] (process_one_work+0x1a4/0x558) [ 9.769470] [<c00589f8>] (process_one_work) from [<c0058de8>] (worker_thread+0x3c/0x514) [ 9.774688] [<c0058de8>] (worker_thread) from [<c005eb88>] (kthread+0xd4/0xf0) [ 9.785614] [<c005eb88>] (kthread) from [<c000f710>] (ret_from_fork+0x14/0x24) [ 9.785614] ---[ end trace 402743bd8cfdde2f ]---And with the (currently almost useless) l3 interrupt stuff taken out by removing the ti,omap4-l3-noc compatible from
omap4.dtsi, we get a real trace that might be of some help to you:[ 8.440917] omap_hsmmc 4809c000.mmc: lookup for GPIO wp failed [ 8.447418] Unhandled fault: imprecise external abort (0x1406) at 0xbeafaa10 [ 8.454925] pgd = c0004000 [ 8.454986] [beafaa10] *pgd=00000000/root/init: line 14: /sys/devices/68000000.ocp/4 8098000.spi/spi_master/spi1/spi1[ 8.461334] Internal error: : 1406 [#1] SMP ARM .2/backlight/acx565akm/brightness: No such file [ 8.473175] Modules linked in:or directory rtc_twl twl4030_wdt [ 8.483520] CPU: 1 PID: 66 Comm: kworker/u4:1 Not tainted 4.2.0-next-20150831-00002-gf55bad8-dirty #1115 [ 8.493652] Hardware name: Generic OMAP4 (Flattened Device Tree) [ 8.498352] Workqueue: deferwq deferred_probe_work_func [ 8.505493] task: ee5f4f40 ti: ee5f6000 task.ti: ee5f6000 [ 8.510803] PC is at devm_clk_get+0x8/0x70 [ 8.514801] LR is at omap_hsmmc_probe+0x2e8/0x9f0 [ 8.520385] pc : [<c04df4e0>] lr : [<c04cd748>] psr: 20010013 [ 8.520385] sp : ee5f7dd0 ip : 00000003 fp : fa09c000 [ 8.532470] r10: 000000ee r9 : ee6904c0 r8 : 00000000 [ 8.537963] r7 : ee1ec010 r6 : ee1ec000 r5 : ee6e7dd0 r4 : ee690000 [ 8.544769] r3 : 00000000 r2 : 000000d0 r1 : c082f184 r0 : ee1ec010 [ 8.551666] Flags: nzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none [ 8.559143] Control: 10c5387d Table: ae73804a DAC: 00000051 [ 8.564727] Process kworker/u4:1 (pid: 66, stack limit = 0xee5f6218) [ 8.571441] Stack: (0xee5f7dd0 to 0xee5f8000) [ 8.576263] 7dc0: ee690000 ee6e7dd0 ee1ec000 c04cd748 [ 8.584930] 7de0: 00000000 c09cf8f8 ee1ed270 ee5de150 00000000 ee090248 c11cb0d4 c09ae55c [ 8.593597] 7e00: 00000000 ee1ec010 ee1ec010 c09ae55c fffffdfb 0000001d c09cf8f8 00000000 [ 8.601837] 7e20: c09cf8f8 c03e97f4 ee1ec010 c11cb118 c09ae55c 00000000 0000001d c03e7ea8 [ 8.610107] 7e40: 00000000 ee5f7e70 c03e803c 00000001 ee5f7ec8 c03e63b4 ee0f2ed4 ee5d6594 [ 8.619323] 7e60: ee1ec010 ee1ec010 ee1ec044 c03e7c28 ee1ec010 00000001 c099b110 ee1ec010 [ 8.627777] 7e80: ee1ec010 c099a708 ee61cf00 c03e71d0 ee1ec010 c099a3fc c099a3b8 c03e75f8 [ 8.636535] 7ea0: c099a434 ee371940 ee08a400 c00589f8 00000001 00000000 c0058968 ee08a400 [ 8.644805] 7ec0: c0058e5c 00000001 c099a434 c0b2a770 00000000 c0811a00 ee08a400 ee08a400 [ 8.653503] 7ee0: ee371958 ee08a430 ee5f6000 00000088 c09cf04c ee371940 ee08a400 c0058de8 [ 8.662261] 7f00: ee08a5d0 00000000 c0058dac 00000000 ee56af40 ee371940 c0058dac 00000000 [ 8.670532] 7f20: 00000000 00000000 00000000 c005eb88 1c4eefdf 00000000 00000000 ee371940 [ 8.679290] 7f40: 00000000 00000000 dead4ead ffffffff ffffffff c09d6da0 00000000 00000000 [ 8.679290] 7f60: c07d16a0 ee5f7f64 ee5f7f64 00000000 00000000 dead4ead ffffffff ffffffff [ 8.696411] 7f80: c09d6da0 00000000 00000000 c07d16a0 ee5f7f90 ee5f7f90 ee5f7fac ee56af40 [ 8.705047] 7fa0: c005eab4 00000000 00000000 c000f710 00000000 00000000 00000000 00000000 [ 8.713562] 7fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 [ 8.721435] 7fe0: 00000000 00000000 00000000 00000000 00000013 00000000 2eade3dd cf5fffcd [ 8.730743] [<c04df4e0>] (devm_clk_get) from [<c04cd748>] (omap_hsmmc_probe+0x2e8/0x9f0) [ 8.738952] [<c04cd748>] (omap_hsmmc_probe) from [<c03e97f4>] (platform_drv_probe+0x44/0xac) [ 8.748077] [<c03e97f4>] (platform_drv_probe) from [<c03e7ea8>] (driver_probe_device+0x1f4/0x2f0) [ 8.757385] [<c03e7ea8>] (driver_probe_device) from [<c03e63b4>] (bus_for_each_drv+0x64/0x98) [ 8.766326] [<c03e63b4>] (bus_for_each_drv) from [<c03e7c28>] (__device_attach+0xb0/0x118) [ 8.774993] [<c03e7c28>] (__device_attach) from [<c03e71d0>] (bus_probe_device+0x88/0x90) [ 8.783538] [<c03e71d0>] (bus_probe_device) from [<c03e75f8>] (deferred_probe_work_func+0x60/0x90) [ 8.792907] [<c03e75f8>] (deferred_probe_work_func) from [<c00589f8>] (process_one_work+0x1a4/0x558) [ 8.802490] [<c00589f8>] (process_one_work) from [<c0058de8>] (worker_thread+0x3c/0x514) [ 8.810943] [<c0058de8>] (worker_thread) from [<c005eb88>] (kthread+0xd4/0xf0) [ 8.818511] [<c005eb88>] (kthread) from [<c000f710>] (ret_from_fork+0x14/0x24) [ 8.824737] Code: e5910000 ea000091 e92d4070 e3a020d0 (e1a06000) [ 8.826141] ---[ end trace a89146bc4a70cc4d ]---
Quoted 7 lines
Quoted 3 lines
On -next, Above crash signature could be related to race
"ARM: OMAP2+: omap-device: fix race deferred probe ofomap_hsmmcvsomap_device_late_init"
http://www.spinics.net/lists/linux-omap/msg121622.htmlGood point thanks, yes that's the case. MMC probing fails and then we hit this separate issue while MMC is trying to probe. Applying your fix makes the abort disappear, but naturally does not get MMC working again.
you may need CONFIG_GPIO_PCF857X=y for dra7-evm
Signature · 2 lines
regards, -grygorii
Re: [PATCH v3 02/15] mmc: host: omap_hsmmc: return on fatal errors from omap_hsmmc_reg_get
Quoted 11 lines · Grygorii Strashko
Quoted 8 lines · Tony Lindgren
Quoted 4 lines
On -next, Above crash signature could be related to race
"ARM: OMAP2+: omap-device: fix race deferred probe ofomap_hsmmcvsomap_device_late_init"
http://www.spinics.net/lists/linux-omap/msg121622.htmlGood point thanks, yes that's the case. MMC probing fails and then we hit this separate issue while MMC is trying to probe. Applying your fix makes the abort disappear, but naturally does not get MMC working again.
you may need
CONFIG_GPIO_PCF857X=yfor dra7-evm
This is a regression at least on omap4 as pointed out by Olof.
Regards,
Tony
Re: [PATCH v3 02/15] mmc: host: omap_hsmmc: return on fatal errors from omap_hsmmc_reg_get
Quoted 7 lines · Tony Lindgren
Quoted 6 lines · Grygorii Strashko
Quoted 5 lines · Tony Lindgren
Quoted 4 lines
On -next, Above crash signature could be related to race
"ARM: OMAP2+: omap-device: fix race deferred probe ofomap_hsmmcvsomap_device_late_init"
http://www.spinics.net/lists/linux-omap/msg121622.html
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Good point thanks, yes that's the case. MMC probing fails and then we hit this separate issue while MMC is trying to probe. Applying your fix makes the abort disappear, but naturally does not get MMC working again.
you may need
CONFIG_GPIO_PCF857X=yfor dra7-evmThis is a regression at least on omap4 as pointed out by Olof.
FWIW, this problem still exists in mainline[1], and note that it fails for omap2plus_defconfig which already has CONFIG_REGULATOR_PBIAS=y, so that is not the fix for this issue.
Kevin
[1] http://kernelci.org/boot/omap4-panda-es/?mainline&omap2plus_defconfig&lab-khilman
Re: [PATCH v3 02/15] mmc: host: omap_hsmmc: return on fatal errors from omap_hsmmc_reg_get
Quoted 12 lines · Kevin Hilman
Quoted 11 lines · Tony Lindgren
Quoted 10 lines · Grygorii Strashko
Quoted 8 lines · Tony Lindgren
Quoted 4 lines
On -next, Above crash signature could be related to race
"ARM: OMAP2+: omap-device: fix race deferred probe ofomap_hsmmcvsomap_device_late_init"
http://www.spinics.net/lists/linux-omap/msg121622.htmlGood point thanks, yes that's the case. MMC probing fails and then we hit this separate issue while MMC is trying to probe. Applying your fix makes the abort disappear, but naturally does not get MMC working again.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
you may need
CONFIG_GPIO_PCF857X=yfor dra7-evmThis is a regression at least on omap4 as pointed out by Olof.
FWIW, this problem still exists in mainline[1], and note that it fails for
omap2plus_defconfigwhich already hasCONFIG_REGULATOR_PBIAS=y, so that is not the fix for this issue.
There are also the pbias regulator fixes pending.. And the .dts fixes pending.. So looks like it's going to be few more days.
AFAIK, also the multi_v7_defconfig change is needed..
Regards,
Tony
PATCH v3 3/15 mmc: host: omap_hsmmc: cleanup omap_hsmmc_reg_get()
In reply to Kishon Vijay Abraham INo functional change. Instead of using a local regulator variable in omap_hsmmc_reg_get() for holding the return value of devm_regulator_get_optional() and then assigning to omap_hsmmc_host regulator members: vcc, vcc_aux and pbias, directly use the omap_hsmmc_host regulator members.
--- drivers/mmc/host/omap_hsmmc.c | 38 ++++++++++++++++---------------------- 1 file changed, 16 insertions(+), 22 deletions(-)
drivers/mmc/host/omap_hsmmc.c +16 -22
@@ -343,24 +343,22 @@ error_set_power:static int omap_hsmmc_reg_get (struct omap_hsmmc_host *host) { -struct regulator *reg;int ocr_value =0 ;int ret;if (mmc_pdata (host)->set_power)return 0 ; - reg =devm_regulator_get_optional (host->dev,"vmmc" ); -if (IS_ERR (reg)) { - ret =PTR_ERR (reg); + host->vcc =devm_regulator_get_optional (host->dev,"vmmc" ); +if (IS_ERR (host->vcc)) { + ret =PTR_ERR (host->vcc);if (ret != -ENODEV )return ret; - host->vcc =NULL ;dev_dbg (host->dev,"unable to get vmmc regulator %ld\n" , -PTR_ERR (reg)); +PTR_ERR (host->vcc)); + host->vcc =NULL ; }else { - host->vcc = reg; - ocr_value =mmc_regulator_get_ocrmask (reg); + ocr_value =mmc_regulator_get_ocrmask (host->vcc);if (!mmc_pdata (host)->ocr_mask) {mmc_pdata (host)->ocr_mask = ocr_value; }else {
@@ -374,28 +372,24 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host) }/* Allow an aux regulator */ - reg =devm_regulator_get_optional (host->dev,"vmmc_aux" ); -if (IS_ERR (reg)) { - ret =PTR_ERR (reg); + host->vcc_aux =devm_regulator_get_optional (host->dev,"vmmc_aux" ); +if (IS_ERR (host->vcc_aux)) { + ret =PTR_ERR (host->vcc_aux);if (ret != -ENODEV )return ret; - host->vcc_aux =NULL ;dev_dbg (host->dev,"unable to get vmmc_aux regulator %ld\n" , -PTR_ERR (reg)); - }else { - host->vcc_aux = reg; +PTR_ERR (host->vcc_aux)); + host->vcc_aux =NULL ; } - reg =devm_regulator_get_optional (host->dev,"pbias" ); -if (IS_ERR (reg)) { - ret =PTR_ERR (reg); + host->pbias =devm_regulator_get_optional (host->dev,"pbias" ); +if (IS_ERR (host->pbias)) { + ret =PTR_ERR (host->pbias);if (ret != -ENODEV )return ret; - host->pbias =NULL ;dev_dbg (host->dev,"unable to get pbias regulator %ld\n" , -PTR_ERR (reg)); - }else { - host->pbias = reg; +PTR_ERR (host->pbias)); + host->pbias =NULL ; }/* For eMMC do not power off when not in sleep state */
Signature · 1 line
1.7.9.5
PATCH v3 4/15 mmc: host: omap_hsmmc: use the ocrmask provided by the vmmc regulator
In reply to Kishon Vijay Abraham IIf the vmmc regulator provides a valid ocrmask, use it. By this even if the pdata has a valid ocrmask, it will be overwritten with the ocrmask of the vmmc regulator.
Also remove the unnecessary compatibility check between the ocrmask in the pdata and the ocrmask from the vmmc regulator.
--- drivers/mmc/host/omap_hsmmc.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-)
drivers/mmc/host/omap_hsmmc.c +1 -9
@@ -359,16 +359,8 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host) host->vcc =NULL ; }else { ocr_value =mmc_regulator_get_ocrmask (host->vcc); -if (!mmc_pdata (host)->ocr_mask) { +if (ocr_value >0 )mmc_pdata (host)->ocr_mask = ocr_value; - }else { -if (!(mmc_pdata (host)->ocr_mask & ocr_value)) { -dev_err (host->dev,"ocrmask %x is not supported\n" , -mmc_pdata (host)->ocr_mask); -mmc_pdata (host)->ocr_mask =0 ; -return -EINVAL ; - } - } }/* Allow an aux regulator */
Signature · 1 line
1.7.9.5
PATCH v3 5/15 mmc: host: omap_hsmmc: use mmc_host's vmmc and vqmmc
In reply to Kishon Vijay Abraham INo functional change. Instead of using omap_hsmmc_host's vcc and vcc_aux members, use vmmc and vqmmc present in mmc_host which is present for the same purpose.
--- drivers/mmc/host/omap_hsmmc.c | 63 ++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 35 deletions(-)
drivers/mmc/host/omap_hsmmc.c +28 -35
@@ -181,15 +181,6 @@ struct omap_hsmmc_host {struct mmc_data *data;struct clk *fclk;struct clk *dbclk; -/* -* vcc == configured supply -* vcc_aux == optional -* - MMC1, supply for DAT4..DAT7 -* - MMC2/MMC2, external level shifter voltage supply, for -* chip (SDIO, eMMC, etc) or transceiver (MMC2 only) -*/ -struct regulator *vcc; -struct regulator *vcc_aux;struct regulator *pbias;bool pbias_enabled;void __iomem *base;
@@ -259,6 +250,7 @@ static int omap_hsmmc_set_power(struct device *dev, int power_on, int vdd) {struct omap_hsmmc_host *host =platform_get_drvdata (to_platform_device (dev)); +struct mmc_host *mmc = host->mmc;int ret =0 ;if (mmc_pdata (host)->set_power)
@@ -268,7 +260,7 @@ static int omap_hsmmc_set_power(struct device *dev, int power_on, int vdd)* If we don't see a Vcc regulator, assume it's a fixed * voltage always-on regulator. */ -if (!host->vcc) +if (!mmc->supply.vmmc)return 0 ;if (mmc_pdata (host)->before_set_reg)
@@ -297,23 +289,23 @@ static int omap_hsmmc_set_power(struct device *dev, int power_on, int vdd)* chips/cards need an interface voltage rail too. */ if (power_on) { -if (host->vcc) - ret =mmc_regulator_set_ocr (host->mmc, host->vcc, vdd); +if (mmc->supply.vmmc) + ret =mmc_regulator_set_ocr (mmc, mmc->supply.vmmc, vdd);/* Enable interface voltage rail, if needed */ -if (ret ==0 && host->vcc_aux) { - ret =regulator_enable (host->vcc_aux); -if (ret <0 && host->vcc) - ret =mmc_regulator_set_ocr (host->mmc, - host->vcc,0 ); +if (ret ==0 && mmc->supply.vqmmc) { + ret =regulator_enable (mmc->supply.vqmmc); +if (ret <0 && mmc->supply.vmmc) + ret =mmc_regulator_set_ocr (mmc, + mmc->supply.vmmc, +0 ); } }else {/* Shut down the rail */ -if (host->vcc_aux) - ret =regulator_disable (host->vcc_aux); -if (host->vcc) { +if (mmc->supply.vqmmc) + ret =regulator_disable (mmc->supply.vqmmc); +if (mmc->supply.vmmc) {/* Then proceed to shut down the local regulator */ - ret =mmc_regulator_set_ocr (host->mmc, - host->vcc,0 ); + ret =mmc_regulator_set_ocr (mmc, mmc->supply.vmmc,0 ); } }
@@ -345,33 +337,34 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host) {int ocr_value =0 ;int ret; +struct mmc_host *mmc = host->mmc;if (mmc_pdata (host)->set_power)return 0 ; - host->vcc =devm_regulator_get_optional (host->dev,"vmmc" ); -if (IS_ERR (host->vcc)) { - ret =PTR_ERR (host->vcc); + mmc->supply.vmmc =devm_regulator_get_optional (host->dev,"vmmc" ); +if (IS_ERR (mmc->supply.vmmc)) { + ret =PTR_ERR (mmc->supply.vmmc);if (ret != -ENODEV )return ret;dev_dbg (host->dev,"unable to get vmmc regulator %ld\n" , -PTR_ERR (host->vcc)); - host->vcc =NULL ; +PTR_ERR (mmc->supply.vmmc)); + mmc->supply.vmmc =NULL ; }else { - ocr_value =mmc_regulator_get_ocrmask (host->vcc); + ocr_value =mmc_regulator_get_ocrmask (mmc->supply.vmmc);if (ocr_value >0 )mmc_pdata (host)->ocr_mask = ocr_value; }/* Allow an aux regulator */ - host->vcc_aux =devm_regulator_get_optional (host->dev,"vmmc_aux" ); -if (IS_ERR (host->vcc_aux)) { - ret =PTR_ERR (host->vcc_aux); + mmc->supply.vqmmc =devm_regulator_get_optional (host->dev,"vmmc_aux" ); +if (IS_ERR (mmc->supply.vqmmc)) { + ret =PTR_ERR (mmc->supply.vqmmc);if (ret != -ENODEV )return ret;dev_dbg (host->dev,"unable to get vmmc_aux regulator %ld\n" , -PTR_ERR (host->vcc_aux)); - host->vcc_aux =NULL ; +PTR_ERR (mmc->supply.vqmmc)); + mmc->supply.vqmmc =NULL ; } host->pbias =devm_regulator_get_optional (host->dev,"pbias" );
@@ -391,8 +384,8 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)* To disable boot_on regulator, enable regulator * to increase usecount and then disable it. */ -if ((host->vcc &®ulator_is_enabled (host->vcc) >0 ) || - (host->vcc_aux &®ulator_is_enabled (host->vcc_aux))) { +if ((mmc->supply.vmmc &®ulator_is_enabled (mmc->supply.vmmc) >0 ) || + (mmc->supply.vqmmc &®ulator_is_enabled (mmc->supply.vqmmc))) {int vdd =ffs (mmc_pdata (host)->ocr_mask) -1 ;omap_hsmmc_set_power (host->dev,1 , vdd);
Signature · 1 line
1.7.9.5
PATCH v3 6/15 mmc: host: omap_hsmmc: remove unnecessary pbias set_voltage
In reply to Kishon Vijay Abraham IRemove the unnecessary pbias regulator_set_voltage done after pbias regulator_disable in omap_hsmmc_set_power.
--- drivers/mmc/host/omap_hsmmc.c | 1 - 1 file changed, 1 deletion(-)
drivers/mmc/host/omap_hsmmc.c +0 -1
@@ -272,7 +272,6 @@ static int omap_hsmmc_set_power(struct device *dev, int power_on, int vdd)if (!ret) host->pbias_enabled =0 ; } -regulator_set_voltage (host->pbias,VDD_3V0 ,VDD_3V0 ); }/*
Signature · 1 line
1.7.9.5
PATCH v3 7/15 mmc: host: omap_hsmmc: return error if any of the regulator APIs fail
In reply to Kishon Vijay Abraham IReturn error if any of the regulator APIs (regulator_enable, regulator_disable, regulator_set_voltage) fails in omap_hsmmc_set_power to avoid undefined behavior.
--- drivers/mmc/host/omap_hsmmc.c | 52 +++++++++++++++++++++++++++++++---------- 1 file changed, 40 insertions(+), 12 deletions(-)
drivers/mmc/host/omap_hsmmc.c +40 -12
@@ -269,8 +269,11 @@ static int omap_hsmmc_set_power(struct device *dev, int power_on, int vdd)if (host->pbias) {if (host->pbias_enabled ==1 ) { ret =regulator_disable (host->pbias); -if (!ret) - host->pbias_enabled =0 ; +if (ret) { +dev_err (dev,"pbias reg disable failed\n" ); +return ret; + } + host->pbias_enabled =0 ; } }
@@ -288,23 +291,35 @@ static int omap_hsmmc_set_power(struct device *dev, int power_on, int vdd)* chips/cards need an interface voltage rail too. */ if (power_on) { -if (mmc->supply.vmmc) +if (mmc->supply.vmmc) { ret =mmc_regulator_set_ocr (mmc, mmc->supply.vmmc, vdd); +if (ret) +return ret; + } +/* Enable interface voltage rail, if needed */ -if (ret ==0 && mmc->supply.vqmmc) { +if (mmc->supply.vqmmc) { ret =regulator_enable (mmc->supply.vqmmc); -if (ret <0 && mmc->supply.vmmc) - ret =mmc_regulator_set_ocr (mmc, - mmc->supply.vmmc, -0 ); +if (ret) { +dev_err (dev,"vmmc_aux reg enable failed\n" ); + goto err_set_vqmmc; + } } }else {/* Shut down the rail */ -if (mmc->supply.vqmmc) +if (mmc->supply.vqmmc) { ret =regulator_disable (mmc->supply.vqmmc); +if (ret) { +dev_err (dev,"vmmc_aux reg disable failed\n" ); +return ret; + } + } +if (mmc->supply.vmmc) {/* Then proceed to shut down the local regulator */ ret =mmc_regulator_set_ocr (mmc, mmc->supply.vmmc,0 ); +if (ret) +return ret; } }
@@ -316,19 +331,32 @@ static int omap_hsmmc_set_power(struct device *dev, int power_on, int vdd) ret =regulator_set_voltage (host->pbias,VDD_3V0 ,VDD_3V0 );if (ret <0 ) - goto error_set_power; + goto err_set_voltage;if (host->pbias_enabled ==0 ) { ret =regulator_enable (host->pbias); -if (!ret) +if (ret) { +dev_err (dev,"pbias reg enable failed\n" ); + goto err_set_voltage; + }else { host->pbias_enabled =1 ; + } } }if (mmc_pdata (host)->after_set_reg)mmc_pdata (host)->after_set_reg (dev, power_on, vdd); -error_set_power: +return 0 ; + +err_set_voltage: +if (mmc->supply.vqmmc) +regulator_disable (mmc->supply.vqmmc); + +err_set_vqmmc: +if (mmc->supply.vmmc) +mmc_regulator_set_ocr (mmc, mmc->supply.vmmc,0 ); +return ret; }
Signature · 1 line
1.7.9.5
PATCH v3 8/15 mmc: host: omap_hsmmc: add separate functions for enable/disable supply
In reply to Kishon Vijay Abraham INo functional change. Cleanup omap_hsmmc_set_power by adding separate functions for enable/disable supply and invoke it from omap_hsmmc_set_power.
--- drivers/mmc/host/omap_hsmmc.c | 101 +++++++++++++++++++++++++++-------------- 1 file changed, 66 insertions(+), 35 deletions(-)
drivers/mmc/host/omap_hsmmc.c +66 -35
@@ -246,6 +246,65 @@ static int omap_hsmmc_get_cover_state(struct device *dev)#ifdef CONFIG_REGULATOR +static int omap_hsmmc_enable_supply (struct mmc_host *mmc,int vdd) +{ +int ret; + +if (mmc->supply.vmmc) { + ret =mmc_regulator_set_ocr (mmc, mmc->supply.vmmc, vdd); +if (ret) +return ret; + } + +/* Enable interface voltage rail, if needed */ +if (mmc->supply.vqmmc) { + ret =regulator_enable (mmc->supply.vqmmc); +if (ret) { +dev_err (mmc_dev (mmc),"vmmc_aux reg enable failed\n" ); + goto err_vqmmc; + } + } + +return 0 ; + +err_vqmmc: +if (mmc->supply.vmmc) +mmc_regulator_set_ocr (mmc, mmc->supply.vmmc,0 ); + +return ret; +} + +static int omap_hsmmc_disable_supply (struct mmc_host *mmc) +{ +int ret; +int status; + +if (mmc->supply.vqmmc) { + ret =regulator_disable (mmc->supply.vqmmc); +if (ret) { +dev_err (mmc_dev (mmc),"vmmc_aux reg disable failed\n" ); +return ret; + } + } + +if (mmc->supply.vmmc) { + ret =mmc_regulator_set_ocr (mmc, mmc->supply.vmmc,0 ); +if (ret) + goto err_set_ocr; + } + +return 0 ; + +err_set_ocr: +if (mmc->supply.vqmmc) { + status =regulator_enable (mmc->supply.vqmmc); +if (status) +dev_err (mmc_dev (mmc),"vmmc_aux re-enable failed\n" ); + } + +return ret; +} +static int omap_hsmmc_set_power (struct device *dev,int power_on,int vdd) { struct omap_hsmmc_host *host =
@@ -291,36 +350,13 @@ static int omap_hsmmc_set_power(struct device *dev, int power_on, int vdd)* chips/cards need an interface voltage rail too. */ if (power_on) { -if (mmc->supply.vmmc) { - ret =mmc_regulator_set_ocr (mmc, mmc->supply.vmmc, vdd); -if (ret) -return ret; - } - -/* Enable interface voltage rail, if needed */ -if (mmc->supply.vqmmc) { - ret =regulator_enable (mmc->supply.vqmmc); -if (ret) { -dev_err (dev,"vmmc_aux reg enable failed\n" ); - goto err_set_vqmmc; - } - } + ret =omap_hsmmc_enable_supply (mmc, vdd); +if (ret) +return ret; }else { -/* Shut down the rail */ -if (mmc->supply.vqmmc) { - ret =regulator_disable (mmc->supply.vqmmc); -if (ret) { -dev_err (dev,"vmmc_aux reg disable failed\n" ); -return ret; - } - } - -if (mmc->supply.vmmc) { -/* Then proceed to shut down the local regulator */ - ret =mmc_regulator_set_ocr (mmc, mmc->supply.vmmc,0 ); -if (ret) -return ret; - } + ret =omap_hsmmc_disable_supply (mmc); +if (ret) +return ret; }if (host->pbias) {
@@ -350,12 +386,7 @@ static int omap_hsmmc_set_power(struct device *dev, int power_on, int vdd)return 0 ; err_set_voltage: -if (mmc->supply.vqmmc) -regulator_disable (mmc->supply.vqmmc); - -err_set_vqmmc: -if (mmc->supply.vmmc) -mmc_regulator_set_ocr (mmc, mmc->supply.vmmc,0 ); +omap_hsmmc_disable_supply (mmc);return ret; }
Signature · 1 line
1.7.9.5
PATCH v3 9/15 mmc: host: omap_hsmmc: add separate function to set pbias
In reply to Kishon Vijay Abraham INo functional change. Cleanup omap_hsmmc_set_power by adding separate functions to set pbias and invoke it from omap_hsmmc_set_power.
--- drivers/mmc/host/omap_hsmmc.c | 78 +++++++++++++++++++++++++---------------- 1 file changed, 48 insertions(+), 30 deletions(-)
drivers/mmc/host/omap_hsmmc.c +48 -30
@@ -305,6 +305,48 @@ err_set_ocr:return ret; } +static int omap_hsmmc_set_pbias (struct omap_hsmmc_host *host,bool power_on, +int vdd) +{ +int ret; + +if (!host->pbias) +return 0 ; + +if (power_on) { +if (vdd <=VDD_165_195 ) + ret =regulator_set_voltage (host->pbias,VDD_1V8 , +VDD_1V8 ); +else + ret =regulator_set_voltage (host->pbias,VDD_3V0 , +VDD_3V0 ); +if (ret <0 ) { +dev_err (host->dev,"pbias set voltage fail\n" ); +return ret; + } + +if (host->pbias_enabled ==0 ) { + ret =regulator_enable (host->pbias); +if (ret) { +dev_err (host->dev,"pbias reg enable fail\n" ); +return ret; + } + host->pbias_enabled =1 ; + } + }else { +if (host->pbias_enabled ==1 ) { + ret =regulator_disable (host->pbias); +if (ret) { +dev_err (host->dev,"pbias reg disable fail\n" ); +return ret; + } + host->pbias_enabled =0 ; + } + } + +return 0 ; +} +static int omap_hsmmc_set_power (struct device *dev,int power_on,int vdd) { struct omap_hsmmc_host *host =
@@ -325,16 +367,9 @@ static int omap_hsmmc_set_power(struct device *dev, int power_on, int vdd)if (mmc_pdata (host)->before_set_reg)mmc_pdata (host)->before_set_reg (dev, power_on, vdd); -if (host->pbias) { -if (host->pbias_enabled ==1 ) { - ret =regulator_disable (host->pbias); -if (ret) { -dev_err (dev,"pbias reg disable failed\n" ); -return ret; - } - host->pbias_enabled =0 ; - } - } + ret =omap_hsmmc_set_pbias (host, false,0 ); +if (ret) +return ret;/* * Assume Vcc regulator is used only to power the card ... OMAP
@@ -359,26 +394,9 @@ static int omap_hsmmc_set_power(struct device *dev, int power_on, int vdd)return ret; } -if (host->pbias) { -if (vdd <=VDD_165_195 ) - ret =regulator_set_voltage (host->pbias,VDD_1V8 , -VDD_1V8 ); -else - ret =regulator_set_voltage (host->pbias,VDD_3V0 , -VDD_3V0 ); -if (ret <0 ) - goto err_set_voltage; - -if (host->pbias_enabled ==0 ) { - ret =regulator_enable (host->pbias); -if (ret) { -dev_err (dev,"pbias reg enable failed\n" ); - goto err_set_voltage; - }else { - host->pbias_enabled =1 ; - } - } - } + ret =omap_hsmmc_set_pbias (host, true, vdd); +if (ret) + goto err_set_voltage;if (mmc_pdata (host)->after_set_reg)mmc_pdata (host)->after_set_reg (dev, power_on, vdd);
Signature · 1 line
1.7.9.5
PATCH v3 10/15 mmc: host: omap_hsmmc: avoid pbias regulator enable on power off
In reply to Kishon Vijay Abraham IFix omap_hsmmc_set_power so that pbias regulator is not enabled during power off.
--- drivers/mmc/host/omap_hsmmc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/mmc/host/omap_hsmmc.c +4 -4
@@ -388,16 +388,16 @@ static int omap_hsmmc_set_power(struct device *dev, int power_on, int vdd) ret =omap_hsmmc_enable_supply (mmc, vdd);if (ret)return ret; + + ret =omap_hsmmc_set_pbias (host, true, vdd); +if (ret) + goto err_set_voltage; }else { ret =omap_hsmmc_disable_supply (mmc);if (ret)return ret; } - ret =omap_hsmmc_set_pbias (host, true, vdd); -if (ret) - goto err_set_voltage; -if (mmc_pdata (host)->after_set_reg)mmc_pdata (host)->after_set_reg (dev, power_on, vdd);
Signature · 1 line
1.7.9.5
PATCH v3 11/15 mmc: host: omap_hsmmc: don't use ->set_power to set initial regulator state
In reply to Kishon Vijay Abraham IIf the regulator is enabled on boot (checked using regulator_is_enabled), invoke regulator_enable() so that the usecount reflects the correct state of the regulator and then disable the regulator so that the initial state of the regulator is disabled. Avoid using ->set_power, since set_power also takes care of setting the voltages which is not needed at this point.
--- drivers/mmc/host/omap_hsmmc.c | 66 ++++++++++++++++++++++++++++++++++------- 1 file changed, 56 insertions(+), 10 deletions(-)
drivers/mmc/host/omap_hsmmc.c +56 -10
@@ -409,6 +409,59 @@ err_set_voltage:return ret; } +static int omap_hsmmc_disable_boot_regulator (struct regulator *reg) +{ +int ret; + +if (!reg) +return 0 ; + +if (regulator_is_enabled (reg)) { + ret =regulator_enable (reg); +if (ret) +return ret; + + ret =regulator_disable (reg); +if (ret) +return ret; + } + +return 0 ; +} + +static int omap_hsmmc_disable_boot_regulators (struct omap_hsmmc_host *host) +{ +struct mmc_host *mmc = host->mmc; +int ret; + +/* +* disable regulators enabled during boot and get the usecount +* right so that regulators can be enabled/disabled by checking +* the return value of regulator_is_enabled +*/ + ret =omap_hsmmc_disable_boot_regulator (mmc->supply.vmmc); +if (ret) { +dev_err (host->dev,"fail to disable boot enabled vmmc reg\n" ); +return ret; + } + + ret =omap_hsmmc_disable_boot_regulator (mmc->supply.vqmmc); +if (ret) { +dev_err (host->dev, +"fail to disable boot enabled vmmc_aux reg\n" ); +return ret; + } + + ret =omap_hsmmc_disable_boot_regulator (host->pbias); +if (ret) { +dev_err (host->dev, +"failed to disable boot enabled pbias reg\n" ); +return ret; + } + +return 0 ; +} +static int omap_hsmmc_reg_get (struct omap_hsmmc_host *host) {int ocr_value =0 ;
@@ -456,17 +509,10 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)/* For eMMC do not power off when not in sleep state */ if (mmc_pdata (host)->no_regulator_off_init)return 0 ; -/* -* To disable boot_on regulator, enable regulator -* to increase usecount and then disable it. -*/ -if ((mmc->supply.vmmc &®ulator_is_enabled (mmc->supply.vmmc) >0 ) || - (mmc->supply.vqmmc &®ulator_is_enabled (mmc->supply.vqmmc))) { -int vdd =ffs (mmc_pdata (host)->ocr_mask) -1 ; -omap_hsmmc_set_power (host->dev,1 , vdd); -omap_hsmmc_set_power (host->dev,0 ,0 ); - } + ret =omap_hsmmc_disable_boot_regulators (host); +if (ret) +return ret;return 0 ; }
Signature · 1 line
1.7.9.5
PATCH v3 12/15 mmc: host: omap_hsmmc: enable/disable vmmc_aux regulator based on previous state
In reply to Kishon Vijay Abraham Ienable vmmc_aux regulator only if it is in disabled state and disable vmmc_aux regulator only if it is in enabled state.
--- drivers/mmc/host/omap_hsmmc.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/mmc/host/omap_hsmmc.c +8 -2
@@ -184,6 +184,7 @@ struct omap_hsmmc_host {struct regulator *pbias;bool pbias_enabled;void __iomem *base; +int vqmmc_enabled;resource_size_t mapbase;spinlock_t irq_lock;/* Prevent races with irq handler */ unsigned int dma_len;
@@ -249,6 +250,7 @@ static int omap_hsmmc_get_cover_state(struct device *dev)static int omap_hsmmc_enable_supply (struct mmc_host *mmc,int vdd) {int ret; +struct omap_hsmmc_host *host =mmc_priv (mmc);if (mmc->supply.vmmc) { ret =mmc_regulator_set_ocr (mmc, mmc->supply.vmmc, vdd);
@@ -257,12 +259,13 @@ static int omap_hsmmc_enable_supply(struct mmc_host *mmc, int vdd) }/* Enable interface voltage rail, if needed */ -if (mmc->supply.vqmmc) { +if (mmc->supply.vqmmc && !host->vqmmc_enabled) { ret =regulator_enable (mmc->supply.vqmmc);if (ret) {dev_err (mmc_dev (mmc),"vmmc_aux reg enable failed\n" ); goto err_vqmmc; } + host->vqmmc_enabled =1 ; }return 0 ;
@@ -278,13 +281,15 @@ static int omap_hsmmc_disable_supply(struct mmc_host *mmc) {int ret;int status; +struct omap_hsmmc_host *host =mmc_priv (mmc); -if (mmc->supply.vqmmc) { +if (mmc->supply.vqmmc && host->vqmmc_enabled) { ret =regulator_disable (mmc->supply.vqmmc);if (ret) {dev_err (mmc_dev (mmc),"vmmc_aux reg disable failed\n" );return ret; } + host->vqmmc_enabled =0 ; }if (mmc->supply.vmmc) {
@@ -2077,6 +2082,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev) host->power_mode =MMC_POWER_OFF ; host->next_data.cookie =1 ; host->pbias_enabled =0 ; + host->vqmmc_enabled =0 ; ret =omap_hsmmc_gpio_init (mmc, host, pdata);if (ret)
Signature · 1 line
1.7.9.5
PATCH v3 13/15 mmc: host: omap_hsmmc: use regulator_is_enabled to find pbias status
In reply to Kishon Vijay Abraham IUse regulator_is_enabled of pbias regulator to find pbias regulator status instead of maintaining a custom bookkeeping pbias_enabled variable.
--- drivers/mmc/host/omap_hsmmc.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/mmc/host/omap_hsmmc.c +2 -6
@@ -182,7 +182,6 @@ struct omap_hsmmc_host {struct clk *fclk;struct clk *dbclk;struct regulator *pbias; -bool pbias_enabled;void __iomem *base;int vqmmc_enabled;resource_size_t mapbase;
@@ -330,22 +329,20 @@ static int omap_hsmmc_set_pbias(struct omap_hsmmc_host *host, bool power_on,return ret; } -if (host->pbias_enabled ==0 ) { +if (!regulator_is_enabled (host->pbias)) { ret =regulator_enable (host->pbias);if (ret) {dev_err (host->dev,"pbias reg enable fail\n" );return ret; } - host->pbias_enabled =1 ; } }else { -if (host->pbias_enabled ==1 ) { +if (regulator_is_enabled (host->pbias)) { ret =regulator_disable (host->pbias);if (ret) {dev_err (host->dev,"pbias reg disable fail\n" );return ret; } - host->pbias_enabled =0 ; } }
@@ -2081,7 +2078,6 @@ static int omap_hsmmc_probe(struct platform_device *pdev) host->base = base + pdata->reg_offset; host->power_mode =MMC_POWER_OFF ; host->next_data.cookie =1 ; - host->pbias_enabled =0 ; host->vqmmc_enabled =0 ; ret =omap_hsmmc_gpio_init (mmc, host, pdata);
Signature · 1 line
1.7.9.5
Re: [PATCH v3 13/15] mmc: host: omap_hsmmc: use regulator_is_enabled to find pbias status
Quoted 3 lines · Kishon Vijay Abraham I
Use
regulator_is_enabledof pbias regulator to find pbias regulator status instead of maintaining a custom bookkeepingpbias_enabledvariable.
Doesn't this cause a problem for the scenario when the initial state of the regulator is enabled?
Both in the sense that you will increase the enable count for it (potentially it may then become disabled when you need it enabled) but also from a enable/disable imbalance point of view.
Kind regards
Uffe
Quoted 55 lines
Signed-off-by Kishon Vijay Abraham I <[email protected]>Tested-by Tony Lindgren <[email protected]>--- drivers/mmc/host/omap_hsmmc.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)drivers/mmc/host/omap_hsmmc.c +2
-7@@ -182,7 +182,6 @@ struct omap_hsmmc_host {struct clk *fclk;struct clk *dbclk;struct regulator *pbias; -bool pbias_enabled;void __iomem *base;int vqmmc_enabled;resource_size_t mapbase;@@ -330,22 +329,20 @@ static int omap_hsmmc_set_pbias(struct omap_hsmmc_host *host, bool power_on,return ret; } -if (host->pbias_enabled ==0 ) { +if (!regulator_is_enabled (host->pbias)) { ret =regulator_enable (host->pbias);if (ret) {dev_err (host->dev,"pbias reg enable fail\n" );return ret; } - host->pbias_enabled =1 ; } }else { -if (host->pbias_enabled ==1 ) { +if (regulator_is_enabled (host->pbias)) { ret =regulator_disable (host->pbias);if (ret) {dev_err (host->dev,"pbias reg disable fail\n" );return ret; } - host->pbias_enabled =0 ; } }@@ -2081,7 +2078,6 @@ static int omap_hsmmc_probe(struct platform_device *pdev) host->base = base + pdata->reg_offset; host->power_mode =MMC_POWER_OFF ; host->next_data.cookie =1 ; - host->pbias_enabled =0 ; host->vqmmc_enabled =0 ; ret =omap_hsmmc_gpio_init (mmc, host, pdata); --1.7.9.5
Re: [PATCH v3 13/15] mmc: host: omap_hsmmc: use regulator_is_enabled to find pbias status
Quoted 9 lines · Ulf Hansson
Quoted 3 lines · Kishon Vijay Abraham I
Use
regulator_is_enabledof pbias regulator to find pbias regulator status instead of maintaining a custom bookkeepingpbias_enabledvariable.Doesn't this cause a problem for the scenario when the initial state of the regulator is enabled?
Both in the sense that you will increase the enable count for it
/s/will/won't
Quoted 61 lines
(potentially it may then become disabled when you need it enabled) but also from a enable/disable imbalance point of view.
Kind regards
UffeQuoted 55 lines
Signed-off-by Kishon Vijay Abraham I <[email protected]>Tested-by Tony Lindgren <[email protected]>--- drivers/mmc/host/omap_hsmmc.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)drivers/mmc/host/omap_hsmmc.c +2
-7@@ -182,7 +182,6 @@ struct omap_hsmmc_host {struct clk *fclk;struct clk *dbclk;struct regulator *pbias; -bool pbias_enabled;void __iomem *base;int vqmmc_enabled;resource_size_t mapbase;@@ -330,22 +329,20 @@ static int omap_hsmmc_set_pbias(struct omap_hsmmc_host *host, bool power_on,return ret; } -if (host->pbias_enabled ==0 ) { +if (!regulator_is_enabled (host->pbias)) { ret =regulator_enable (host->pbias);if (ret) {dev_err (host->dev,"pbias reg enable fail\n" );return ret; } - host->pbias_enabled =1 ; } }else { -if (host->pbias_enabled ==1 ) { +if (regulator_is_enabled (host->pbias)) { ret =regulator_disable (host->pbias);if (ret) {dev_err (host->dev,"pbias reg disable fail\n" );return ret; } - host->pbias_enabled =0 ; } }@@ -2081,7 +2078,6 @@ static int omap_hsmmc_probe(struct platform_device *pdev) host->base = base + pdata->reg_offset; host->power_mode =MMC_POWER_OFF ; host->next_data.cookie =1 ; - host->pbias_enabled =0 ; host->vqmmc_enabled =0 ; ret =omap_hsmmc_gpio_init (mmc, host, pdata); --1.7.9.5
Re: [PATCH v3 13/15] mmc: host: omap_hsmmc: use regulator_is_enabled to find pbias status
Hi Uffe,
Quoted 8 lines · Ulf Hansson
Quoted 7 lines · Ulf Hansson
Quoted 3 lines · Kishon Vijay Abraham I
Use
regulator_is_enabledof pbias regulator to find pbias regulator status instead of maintaining a custom bookkeepingpbias_enabledvariable.Doesn't this cause a problem for the scenario when the initial state of the regulator is enabled?
Patch 11 of this series "mmc: host: omap_hsmmc: don't use ->set_power to set initial regulator state" disables the pbias regulator if the initial state of the regulator is enabled.
Thanks
Kishon
Quoted 66 lines
Quoted 2 lines
Both in the sense that you will increase the enable count for it
/s/will/won't
Quoted 61 lines
(potentially it may then become disabled when you need it enabled) but also from a enable/disable imbalance point of view.
Kind regards
UffeQuoted 55 lines
Signed-off-by Kishon Vijay Abraham I <[email protected]>Tested-by Tony Lindgren <[email protected]>--- drivers/mmc/host/omap_hsmmc.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)drivers/mmc/host/omap_hsmmc.c +2
-7@@ -182,7 +182,6 @@ struct omap_hsmmc_host {struct clk *fclk;struct clk *dbclk;struct regulator *pbias; -bool pbias_enabled;void __iomem *base;int vqmmc_enabled;resource_size_t mapbase;@@ -330,22 +329,20 @@ static int omap_hsmmc_set_pbias(struct omap_hsmmc_host *host, bool power_on,return ret; } -if (host->pbias_enabled ==0 ) { +if (!regulator_is_enabled (host->pbias)) { ret =regulator_enable (host->pbias);if (ret) {dev_err (host->dev,"pbias reg enable fail\n" );return ret; } - host->pbias_enabled =1 ; } }else { -if (host->pbias_enabled ==1 ) { +if (regulator_is_enabled (host->pbias)) { ret =regulator_disable (host->pbias);if (ret) {dev_err (host->dev,"pbias reg disable fail\n" );return ret; } - host->pbias_enabled =0 ; } }@@ -2081,7 +2078,6 @@ static int omap_hsmmc_probe(struct platform_device *pdev) host->base = base + pdata->reg_offset; host->power_mode =MMC_POWER_OFF ; host->next_data.cookie =1 ; - host->pbias_enabled =0 ; host->vqmmc_enabled =0 ; ret =omap_hsmmc_gpio_init (mmc, host, pdata); --1.7.9.5
Re: [PATCH v3 13/15] mmc: host: omap_hsmmc: use regulator_is_enabled to find pbias status
Quoted 9 lines · Kishon Vijay Abraham I
Hi Uffe,
Quoted 6 lines · Ulf Hansson
Quoted 5 lines · Ulf Hansson
Quoted 3 lines · Kishon Vijay Abraham I
Use
regulator_is_enabledof pbias regulator to find pbias regulator status instead of maintaining a custom bookkeepingpbias_enabledvariable.
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines
Doesn't this cause a problem for the scenario when the initial state of the regulator is enabled?
Patch 11 of this series "mmc: host:
omap_hsmmc: don't use ->set_power to set initial regulator state" disables the pbias regulator if the initial state of the regulator is enabled.
Got it, thanks!
[...]
Kind regards
Uffe
PATCH v3 14/15 mmc: host: omap_hsmmc: use ios->vdd for setting vmmc voltage
In reply to Kishon Vijay Abraham Ivdd voltage is set in mmc core to ios->vdd and vmmc should actually be set to this voltage. Modify omap_hsmmc_enable_supply to not take vdd as argument since now it's directly set to the voltage in ios->vdd.
--- drivers/mmc/host/omap_hsmmc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/mmc/host/omap_hsmmc.c +4 -3
@@ -246,13 +246,14 @@ static int omap_hsmmc_get_cover_state(struct device *dev)#ifdef CONFIG_REGULATOR -static int omap_hsmmc_enable_supply (struct mmc_host *mmc,int vdd) +static int omap_hsmmc_enable_supply (struct mmc_host *mmc) {int ret;struct omap_hsmmc_host *host =mmc_priv (mmc); +struct mmc_ios *ios = &mmc->ios;if (mmc->supply.vmmc) { - ret =mmc_regulator_set_ocr (mmc, mmc->supply.vmmc, vdd); + ret =mmc_regulator_set_ocr (mmc, mmc->supply.vmmc, ios->vdd);if (ret)return ret; }
@@ -387,7 +388,7 @@ static int omap_hsmmc_set_power(struct device *dev, int power_on, int vdd)* chips/cards need an interface voltage rail too. */ if (power_on) { - ret =omap_hsmmc_enable_supply (mmc, vdd); + ret =omap_hsmmc_enable_supply (mmc);if (ret)return ret;
Signature · 1 line
1.7.9.5
PATCH v3 15/15 mmc: host: omap_hsmmc: remove CONFIG_REGULATOR check
In reply to Kishon Vijay Abraham INow that support for platforms which have optional regulator is added, remove CONFIG_REGULATOR check in omap_hsmmc.
--- drivers/mmc/host/omap_hsmmc.c | 34 +++------------------------------- 1 file changed, 3 insertions(+), 31 deletions(-)
drivers/mmc/host/omap_hsmmc.c +3 -31
@@ -244,8 +244,6 @@ static int omap_hsmmc_get_cover_state(struct device *dev)return mmc_gpio_get_cd (host->mmc); } -#ifdef CONFIG_REGULATOR -static int omap_hsmmc_enable_supply (struct mmc_host *mmc) {int ret;
@@ -520,30 +518,6 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)return 0 ; } -static inline int omap_hsmmc_have_reg (void ) -{ -return 1 ; -} - -#else - -static int omap_hsmmc_set_power (struct device *dev,int power_on,int vdd) -{ -return 0 ; -} - -static inline int omap_hsmmc_reg_get (struct omap_hsmmc_host *host) -{ -return -EINVAL ; -} - -static inline int omap_hsmmc_have_reg (void ) -{ -return 0 ; -} - -#endif -static irqreturn_t omap_hsmmc_cover_irq (int irq,void *dev_id); static int omap_hsmmc_gpio_init(struct mmc_host *mmc,
@@ -2204,11 +2178,9 @@ static int omap_hsmmc_probe(struct platform_device *pdev) goto err_irq; } -if (omap_hsmmc_have_reg ()) { - ret =omap_hsmmc_reg_get (host); -if (ret) - goto err_irq; - } + ret =omap_hsmmc_reg_get (host); +if (ret) + goto err_irq; mmc->ocr_avail =mmc_pdata (host)->ocr_mask;
Signature · 1 line
1.7.9.5
Ulf Hansson
AppliedQuoted 51 lines · Kishon Vijay Abraham I
This patch series does the following
*) Usesdevm_regulator_get_optional()for vmmc and then removes the
CONFIG_REGULATORcheck altogether.
*) return on -EPROBE_DEFER and any other fatal errors
*) enable/disablevmmc_auxregulator based on prior stateChanges from v2:
*) rebased to mmc -next branch
*) dropped using "mmc_of_parse_voltage" to getocr_availpatch.Changes from v1:
*) return on -EPROBE_DEFER and other fatal errors. (Don't return only
if the return value is-ENODEV)
*) Remove the beagle x15 dts patch. It can be part of a different
series.
*) Avoid usingregulator_is_enabledfor vqmmc since if the regulator
is shared and the other users are not usingregulator_is_enabledthen there can be unbalanced regulator_enable/regulator_disableI've pushed this patch series to
git://git.ti.com/linux-phy/linux-phy.gitmmc_for-nextPlease note the branch also has the pbias fixes [1].
[1] -> https://lkml.org/lkml/2015/7/27/358This series is in preparation for implementing the voltage switch sequence so that UHS cards can be supported.
Did basic read/write test in J6, J6 Eco, Beagle-x15, AM437x EVM, Beaglebone black, OMAP5 uEVM, OMAP4 PANDA and OMAP3gle xm.
Kishon Vijay Abraham I (15):
mmc: host:omap_hsmmc: usedevm_regulator_get_optional()for vmmc
mmc: host:omap_hsmmc: return on fatal errors fromomap_hsmmc_reg_get
mmc: host:omap_hsmmc: cleanupomap_hsmmc_reg_get()
mmc: host:omap_hsmmc: use the ocrmask provided by the vmmc regulator
mmc: host:omap_hsmmc: use mmc_host's vmmc and vqmmc
mmc: host:omap_hsmmc: remove unnecessary pbiasset_voltage
mmc: host:omap_hsmmc: return error if any of the regulator APIs fail
mmc: host:omap_hsmmc: add separate functions for enable/disable
supply
mmc: host:omap_hsmmc: add separate function to set pbias
mmc: host:omap_hsmmc: avoid pbias regulator enable on power off
mmc: host:omap_hsmmc: don't use ->set_power to set initial regulator
state
mmc: host:omap_hsmmc: enable/disablevmmc_auxregulator based on
previous state
mmc: host:omap_hsmmc: useregulator_is_enabledto find pbias status
mmc: host:omap_hsmmc: useios->vddfor setting vmmc voltage
mmc: host:omap_hsmmc: removeCONFIG_REGULATORcheck
Quoted 6 lines
drivers/mmc/host/omap_hsmmc.c | 326 +++++++++++++++++++++++++++-------------- 1 file changed, 212 insertions(+), 114 deletions(-)--
1.7.9.5
Thanks, applied for next!
Kind regards
Uffe
Quoted 52 lines · Ulf Hansson
Quoted 51 lines · Kishon Vijay Abraham I
This patch series does the following
*) Usesdevm_regulator_get_optional()for vmmc and then removes the
CONFIG_REGULATORcheck altogether.
*) return on -EPROBE_DEFER and any other fatal errors
*) enable/disablevmmc_auxregulator based on prior stateChanges from v2:
*) rebased to mmc -next branch
*) dropped using "mmc_of_parse_voltage" to getocr_availpatch.Changes from v1:
*) return on -EPROBE_DEFER and other fatal errors. (Don't return only
if the return value is-ENODEV)
*) Remove the beagle x15 dts patch. It can be part of a different
series.
*) Avoid usingregulator_is_enabledfor vqmmc since if the regulator
is shared and the other users are not usingregulator_is_enabledthen there can be unbalanced regulator_enable/regulator_disableI've pushed this patch series to
git://git.ti.com/linux-phy/linux-phy.gitmmc_for-nextPlease note the branch also has the pbias fixes [1].
[1] -> https://lkml.org/lkml/2015/7/27/358This series is in preparation for implementing the voltage switch sequence so that UHS cards can be supported.
Did basic read/write test in J6, J6 Eco, Beagle-x15, AM437x EVM, Beaglebone black, OMAP5 uEVM, OMAP4 PANDA and OMAP3gle xm.
Kishon Vijay Abraham I (15):
mmc: host:omap_hsmmc: usedevm_regulator_get_optional()for vmmc
mmc: host:omap_hsmmc: return on fatal errors fromomap_hsmmc_reg_get
mmc: host:omap_hsmmc: cleanupomap_hsmmc_reg_get()
mmc: host:omap_hsmmc: use the ocrmask provided by the vmmc regulator
mmc: host:omap_hsmmc: use mmc_host's vmmc and vqmmc
mmc: host:omap_hsmmc: remove unnecessary pbiasset_voltage
mmc: host:omap_hsmmc: return error if any of the regulator APIs fail
mmc: host:omap_hsmmc: add separate functions for enable/disable
supply
mmc: host:omap_hsmmc: add separate function to set pbias
mmc: host:omap_hsmmc: avoid pbias regulator enable on power off
mmc: host:omap_hsmmc: don't use ->set_power to set initial regulator
state
mmc: host:omap_hsmmc: enable/disablevmmc_auxregulator based on
previous state
mmc: host:omap_hsmmc: useregulator_is_enabledto find pbias status
mmc: host:omap_hsmmc: useios->vddfor setting vmmc voltage
mmc: host:omap_hsmmc: removeCONFIG_REGULATORcheck
Quoted 8 lines
Quoted 6 lines
drivers/mmc/host/omap_hsmmc.c | 326 +++++++++++++++++++++++++++-------------- 1 file changed, 212 insertions(+), 114 deletions(-)--
1.7.9.5Thanks, applied for next!
Thank you.
-Kishon