Skip to contentSkip to conversation

regulator: Fix pbias regulator enable

PATCH In review Kishon Vijay Abraham I 4 participants 7 messages Sep 4, 2015 – Sep 15, 2015

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v3 cover regulator: Fix pbias regulator enable

vsel_reg and enable_reg of the pbias regulator descriptor should actually have the offset from syscon.

However after
"ARM: dts: <platform>: add minimal l4 bus layout with control module support"
vsel_reg and enable_reg started to have the absolute address because of address translation that happens due to pbias node made as the child node of syscon. This breaks the pbias regulator enable.

This series adds the 'offset' to be populated in vsel_reg and enable_reg in the pbias driver itself.

Changes from v2:
*) Squashed all the dt patches into a single patch

Changes from v1:
*) Fixed Tony's review comments on adding a 'comment' for adding offset in
the driver and adding a warning for using platform_get_resource.
*) Added Tony's Acked-by.

Tested these patches against mmc -next in omap4 panda, omap3 beagle xm, dra72 and omap5 uevm

Kishon Vijay Abraham I (2):
regulator: pbias: program pbias register offset in pbias driver
ARM: dts: <omap2/3/4/5/dra7>: use "ti,pbias-<platform>" compatible
string for pbias

 .../bindings/regulator/pbias-regulator.txt         |    7 ++-
 arch/arm/boot/dts/dra7.dtsi                        |    2 +-
 arch/arm/boot/dts/omap2430.dtsi                    |    2 +-
 arch/arm/boot/dts/omap3.dtsi                       |    2 +-
 arch/arm/boot/dts/omap4.dtsi                       |    2 +-
 arch/arm/boot/dts/omap5.dtsi                       |    2 +-
 drivers/regulator/pbias-regulator.c                |   56 +++++++++++++++++---
 7 files changed, 61 insertions(+), 12 deletions(-)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH v3 1/2 regulator: pbias: program pbias register offset in pbias driver

Add separate compatible strings for every platform and populate the pbias register offset in the driver data.
This helps avoid depending on the dt for pbias register offset.

Also update the dt binding documentation with the new compatible strings.

---
 .../bindings/regulator/pbias-regulator.txt         |    7 ++-
 drivers/regulator/pbias-regulator.c                |   56 +++++++++++++++++---
 2 files changed, 56 insertions(+), 7 deletions(-)
Documentation/devicetree/bindings/regulator/pbias-regulator.txt +6 -1
index 32aa26f..acbcb45 100644
@@ -2,7 +2,12 @@ PBIAS internal regulator for SD card dual voltage i/o pads on OMAP SoCs.
 
 Required properties:
 - compatible:
-  - "ti,pbias-omap" for OMAP2, OMAP3, OMAP4, OMAP5, DRA7.
+  - should be "ti,pbias-dra7" for DRA7
+  - should be "ti,pbias-omap2" for OMAP2
+  - should be "ti,pbias-omap3" for OMAP3
+  - should be "ti,pbias-omap4" for OMAP4
+  - should be "ti,pbias-omap5" for OMAP5
+  - "ti,pbias-omap" is deprecated
 - reg: pbias register offset from syscon base and size of pbias register.
 - syscon : phandle of the system control module
 - regulator-name : should be
drivers/regulator/pbias-regulator.c +50 -6

95 lines not on this page · raw message

Signature · 1 line
1.7.9.5
maintainer
#2 lore raw

Re: [PATCH v3 1/2] regulator: pbias: program pbias register offset in pbias driver

Quoted 3 lines · Kishon Vijay Abraham I

Add separate compatible strings for every platform and populate the pbias register offset in the driver data.
This helps avoid depending on the dt for pbias register offset.

If there are any changes from the already applied patch for this please
send an incremental patch. Please don't resend already applied patches.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150904/e4f42a86/attachment-0001.sig>

#3 lore raw

PATCH v3 2/2 ARM: dts: <omap2/3/4/5/dra7>: use "ti,pbias-<platform>" compatible string for pbias

In reply to Kishon Vijay Abraham I

Use platform specific compatible strings instead of the common "ti,pbias-omap" compatible string.

---
 arch/arm/boot/dts/dra7.dtsi     |    2 +-
 arch/arm/boot/dts/omap2430.dtsi |    2 +-
 arch/arm/boot/dts/omap3.dtsi    |    2 +-
 arch/arm/boot/dts/omap4.dtsi    |    2 +-
 arch/arm/boot/dts/omap5.dtsi    |    2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)
arch/arm/boot/dts/dra7.dtsi +1 -1
index 1e29ccf..d6bc6db 100644
@@ -122,7 +122,7 @@
 					#size-cells = <1>;
 
 					pbias_regulator: pbias_regulator {
-						compatible = "ti,pbias-omap";
+						compatible = "ti,pbias-dra7", "ti,pbias-omap";
 						reg = <0xe00 0x4>;
 						syscon = <&scm_conf>;
 						pbias_mmc_reg: pbias_mmc_omap5 {
arch/arm/boot/dts/omap2430.dtsi +1 -1
index 2390f38..3961a6f 100644
@@ -63,7 +63,7 @@
 					};
 
 					pbias_regulator: pbias_regulator {
-						compatible = "ti,pbias-omap";
+						compatible = "ti,pbias-omap2", "ti,pbias-omap";
 						reg = <0x230 0x4>;
 						syscon = <&scm_conf>;
 						pbias_mmc_reg: pbias_mmc_omap2430 {
arch/arm/boot/dts/omap3.dtsi +1 -1
index 69a40cf..9af9ae1 100644
@@ -203,7 +203,7 @@
 		};
 
 		pbias_regulator: pbias_regulator {
-			compatible = "ti,pbias-omap";
+			compatible = "ti,pbias-omap3", "ti,pbias-omap";
 			reg = <0x2b0 0x4>;
 			syscon = <&scm_conf>;
 			pbias_mmc_reg: pbias_mmc_omap2430 {
arch/arm/boot/dts/omap4.dtsi +1 -1
index abc4473..5aad7f3 100644
@@ -198,7 +198,7 @@
 					#size-cells = <1>;
 
 					pbias_regulator: pbias_regulator {
-						compatible = "ti,pbias-omap";
+						compatible = "ti,pbias-omap4", "ti,pbias-omap";
 						reg = <0x60 0x4>;
 						syscon = <&omap4_padconf_global>;
 						pbias_mmc_reg: pbias_mmc_omap4 {
arch/arm/boot/dts/omap5.dtsi +1 -1
index b1a1263..76ef595 100644
@@ -187,7 +187,7 @@
 					#size-cells = <1>;
 
 					pbias_regulator: pbias_regulator {
-						compatible = "ti,pbias-omap";
+						compatible = "ti,pbias-omap5", "ti,pbias-omap";
 						reg = <0x60 0x4>;
 						syscon = <&omap5_padconf_global>;
 						pbias_mmc_reg: pbias_mmc_omap5 {
Signature · 1 line
1.7.9.5
#4 lore raw
In reply to Kishon Vijay Abraham I
Quoted 38 lines · Kishon Vijay Abraham I

vsel_reg and enable_reg of the pbias regulator descriptor should actually have the offset from syscon.

However after
"ARM: dts: <platform>: add minimal l4 bus layout with control module support"
vsel_reg and enable_reg started to have the absolute address because of address translation that happens due to pbias node made as the child node of syscon. This breaks the pbias regulator enable.

This series adds the 'offset' to be populated in vsel_reg and enable_reg in the pbias driver itself.

Changes from v2:
*) Squashed all the dt patches into a single patch

Changes from v1:
*) Fixed Tony's review comments on adding a 'comment' for adding offset in
the driver and adding a warning for using platform_get_resource.
*) Added Tony's Acked-by.

Tested these patches against mmc -next in omap4 panda, omap3 beagle xm, dra72 and omap5 uevm

Kishon Vijay Abraham I (2):
regulator: pbias: program pbias register offset in pbias driver
ARM: dts: <omap2/3/4/5/dra7>: use "ti,pbias-<platform>" compatible
string for pbias

 .../bindings/regulator/pbias-regulator.txt         |    7 ++-
 arch/arm/boot/dts/dra7.dtsi                        |    2 +-
 arch/arm/boot/dts/omap2430.dtsi                    |    2 +-
 arch/arm/boot/dts/omap3.dtsi                       |    2 +-
 arch/arm/boot/dts/omap4.dtsi                       |    2 +-
 arch/arm/boot/dts/omap5.dtsi                       |    2 +-
 drivers/regulator/pbias-regulator.c                |   56 +++++++++++++++++---
 7 files changed, 61 insertions(+), 12 deletions(-)
Quoted 3 lines

--
1.7.9.5

Okay, just to be clear on the way forward. I spoked with Mark Brown offlist, and he will/has picked up the regulator patch and will send it as fix for the 4.3 rc[n].

Regarding the ARM patch here, I guess Tony might as well handle it and send through arm-soc, especially since the regression won't be fixed within my mmc tree anyway.

So, I am going to leave my next branch as is - and thus relying on that the regression for OMAP will be fixed in some the 4.3 rc[n].

Kind regards
Uffe

maintainer
#5 lore raw

Hi,

Quoted 11 lines · Ulf Hansson

Okay, just to be clear on the way forward. I spoked with Mark Brown offlist, and he will/has picked up the regulator patch and will send it as fix for the 4.3 rc[n].

Regarding the ARM patch here, I guess Tony might as well handle it and send through arm-soc, especially since the regression won't be fixed within my mmc tree anyway.

So, I am going to leave my next branch as is - and thus relying on teet the regression for OMAP will be fixed in some the 4.3 rc[n].

I'm picking up the .dts changes from this series into omap-for-v4.3/fixes as those are safe to apply while waiting for the pbias-regulator.c fix to hit mainline.

I'm not yet applying the related dts change "fix address translation for pbias" as that depends on the pbias-regulator.c change.

Howver, when testing all the patches applied, I'm still getting the following splat at least on duovero (with MMC working):

WARNING: CPU: 0 PID: 6 at drivers/regulator/core.c:2105 _regulator_disable+0x13c/0x1d4()
unbalanced disables for pbias_mmc_omap4
Modules linked in:
CPU: 0 PID: 6 Comm: kworker/u4:0 Not tainted 4.3.0-rc1-00015-gf5c4173-dirty #1295
Hardware name: Generic OMAP4 (Flattened Device Tree)
Workqueue: deferwq deferred_probe_work_func
[<c001770c>] (unwind_backtrace) from [<c0013a58>] (show_stack+0x10/0x14)
[<c0013a58>] (show_stack) from [<c0346628>] (dump_stack+0x84/0x9c)
[<c0346628>] (dump_stack) from [<c003e958>] (warn_slowpath_common+0x78/0xb4)
[<c003e958>] (warn_slowpath_common) from [<c003e9c4>] (warn_slowpath_fmt+0x30/0x40)
[<c003e9c4>] (warn_slowpath_fmt) from [<c03a4e74>] (_regulator_disable+0x13c/0x1d4)
[<c03a4e74>] (_regulator_disable) from [<c03a4f3c>] (regulator_disable+0x30/0x6c)
[<c03a4f3c>] (regulator_disable) from [<c04c55a8>] (omap_hsmmc_set_power+0x158/0x1e8)
[<c04c55a8>] (omap_hsmmc_set_power) from [<c04c57d0>] (omap_hsmmc_set_ios+0x198/0x318)
[<c04c57d0>] (omap_hsmmc_set_ios) from [<c04af404>] (mmc_power_up.part.10+0x30/0xf8)
[<c04af404>] (mmc_power_up.part.10) from [<c04b0310>] (mmc_start_host+0x40/0x7c)
[<c04b0310>] (mmc_start_host) from [<c04b1424>] (mmc_add_host+0x5c/0x84)
[<c04b1424>] (mmc_add_host) from [<c04c5010>] (omap_hsmmc_probe+0x5b0/0x9f0)
[<c04c5010>] (omap_hsmmc_probe) from [<c03e0e9c>] (platform_drv_probe+0x44/0xac)
[<c03e0e9c>] (platform_drv_probe) from [<c03df550>] (driver_probe_device+0x1f4/0x2f0)
[<c03df550>] (driver_probe_device) from [<c03dda5c>] (bus_for_each_drv+0x64/0x98)
[<c03dda5c>] (bus_for_each_drv) from [<c03df2d0>] (__device_attach+0xb0/0x118)
[<c03df2d0>] (__device_attach) from [<c03de878>] (bus_probe_device+0x88/0x90)
[<c03de878>] (bus_probe_device) from [<c03deca0>] (deferred_probe_work_func+0x60/0x90)
[<c03deca0>] (deferred_probe_work_func) from [<c005899c>] (process_one_work+0x1a4/0x558)
[<c005899c>] (process_one_work) from [<c0058d8c>] (worker_thread+0x3c/0x514)
[<c0058d8c>] (worker_thread) from [<c005eb1c>] (kthread+0xd4/0xf0)
[<c005eb1c>] (kthread) from [<c000f710>] (ret_from_fork+0x14/0x24)

Kishon, can you please take a look?

Regards,

Tony

#6 lore raw

Hi,

Quoted 54 lines · Tony Lindgren

Hi,

Quoted 11 lines · Ulf Hansson

Okay, just to be clear on the way forward. I spoked with Mark Brown offlist, and he will/has picked up the regulator patch and will send it as fix for the 4.3 rc[n].

Regarding the ARM patch here, I guess Tony might as well handle it and send through arm-soc, especially since the regression won't be fixed within my mmc tree anyway.

So, I am going to leave my next branch as is - and thus relying on teet the regression for OMAP will be fixed in some the 4.3 rc[n].

I'm picking up the .dts changes from this series into omap-for-v4.3/fixes as those are safe to apply while waiting for the pbias-regulator.c fix to hit mainline.

I'm not yet applying the related dts change "fix address translation for pbias" as that depends on the pbias-regulator.c change.

Howver, when testing all the patches applied, I'm still getting the following splat at least on duovero (with MMC working):

WARNING: CPU: 0 PID: 6 at drivers/regulator/core.c:2105 _regulator_disable+0x13c/0x1d4()
unbalanced disables for pbias_mmc_omap4
Modules linked in:
CPU: 0 PID: 6 Comm: kworker/u4:0 Not tainted 4.3.0-rc1-00015-gf5c4173-dirty #1295
Hardware name: Generic OMAP4 (Flattened Device Tree)
Workqueue: deferwq deferred_probe_work_func
[<c001770c>] (unwind_backtrace) from [<c0013a58>] (show_stack+0x10/0x14)
[<c0013a58>] (show_stack) from [<c0346628>] (dump_stack+0x84/0x9c)
[<c0346628>] (dump_stack) from [<c003e958>] (warn_slowpath_common+0x78/0xb4)
[<c003e958>] (warn_slowpath_common) from [<c003e9c4>] (warn_slowpath_fmt+0x30/0x40)
[<c003e9c4>] (warn_slowpath_fmt) from [<c03a4e74>] (_regulator_disable+0x13c/0x1d4)
[<c03a4e74>] (_regulator_disable) from [<c03a4f3c>] (regulator_disable+0x30/0x6c)
[<c03a4f3c>] (regulator_disable) from [<c04c55a8>] (omap_hsmmc_set_power+0x158/0x1e8)
[<c04c55a8>] (omap_hsmmc_set_power) from [<c04c57d0>] (omap_hsmmc_set_ios+0x198/0x318)
[<c04c57d0>] (omap_hsmmc_set_ios) from [<c04af404>] (mmc_power_up.part.10+0x30/0xf8)
[<c04af404>] (mmc_power_up.part.10) from [<c04b0310>] (mmc_start_host+0x40/0x7c)
[<c04b0310>] (mmc_start_host) from [<c04b1424>] (mmc_add_host+0x5c/0x84)
[<c04b1424>] (mmc_add_host) from [<c04c5010>] (omap_hsmmc_probe+0x5b0/0x9f0)
[<c04c5010>] (omap_hsmmc_probe) from [<c03e0e9c>] (platform_drv_probe+0x44/0xac)
[<c03e0e9c>] (platform_drv_probe) from [<c03df550>] (driver_probe_device+0x1f4/0x2f0)
[<c03df550>] (driver_probe_device) from [<c03dda5c>] (bus_for_each_drv+0x64/0x98)
[<c03dda5c>] (bus_for_each_drv) from [<c03df2d0>] (__device_attach+0xb0/0x118)
[<c03df2d0>] (__device_attach) from [<c03de878>] (bus_probe_device+0x88/0x90)
[<c03de878>] (bus_probe_device) from [<c03deca0>] (deferred_probe_work_func+0x60/0x90)
[<c03deca0>] (deferred_probe_work_func) from [<c005899c>] (process_one_work+0x1a4/0x558)
[<c005899c>] (process_one_work) from [<c0058d8c>] (worker_thread+0x3c/0x514)
[<c0058d8c>] (worker_thread) from [<c005eb1c>] (kthread+0xd4/0xf0)
[<c005eb1c>] (kthread) from [<c000f710>] (ret_from_fork+0x14/0x24)
Quoted 1 line

Kishon, can you please take a look?

really weird, since I didn't see any issues with my OMAP4 PANDA. Most likely it's because the PBIAS register is not showing the correct state of PBIAS. So we might have to remove using regulator_is_enabled and use our own bookkeeping pbias_enabled variable. Anyway I'll check this.

Thanks
Kishon