Skip to contentSkip to conversation

Fix pbias regulator enable

PATCH Superseded Kishon Vijay Abraham I 3 participants 9 messages Sep 2, 2015

Subsystems (4)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover 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.

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

Kishon Vijay Abraham I (6):
regulator: pbias: program pbias register offset in pbias driver
ARM: dts: dra7: use "ti,pbias-dra7" compatible string for pbias
ARM: dts: omap243x: use "ti,pbias-omap2" compatible string for pbias
ARM: dts: omap3: use "ti,pbias-omap3" compatible string for pbias
ARM: dts: OMAP4: use "ti,pbias-omap4" compatible string for pbias
ARM: dts: OMAP5: use "ti,pbias-omap5" 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                |   52 +++++++++++++++++---
 7 files changed, 57 insertions(+), 12 deletions(-)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/6 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                |   52 +++++++++++++++++---
 2 files changed, 52 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 +46 -6

91 lines not on this page · raw message

Signature · 1 line
1.7.9.5
maintainer Acked-by on v1 1/6
#2 lore raw

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

drivers/regulator/pbias-regulator.c

Quoted 2 lines · Kishon Vijay Abraham I
drivers/regulator/pbias-regulator.c +0 -0

How about add a comment here:

/* Offset from SCM general area (and syscon) base */

Quoted 29 lines
drivers/regulator/pbias-regulator.c +25 -0
+static const struct pbias_of_data pbias_of_data_omap2 = {
+	.offset = 0x230,
+};
+
+static const struct pbias_of_data pbias_of_data_omap3 = {
+	.offset = 0x2b0,
+};
+
+static const struct pbias_of_data pbias_of_data_omap4 = {
+	.offset = 0x60,
+};
+
+static const struct pbias_of_data pbias_of_data_omap5 = {
+	.offset = 0x60,
+};
+
+static const struct pbias_of_data pbias_of_data_dra7 = {
+	.offset = 0xe00,
+};
+
 static const struct of_device_id pbias_of_match[] = {
 	{ .compatible = "ti,pbias-omap", },
+	{ .compatible = "ti,pbias-omap2", .data = &pbias_of_data_omap2, },
+	{ .compatible = "ti,pbias-omap3", .data = &pbias_of_data_omap3, },
+	{ .compatible = "ti,pbias-omap4", .data = &pbias_of_data_omap4, },
+	{ .compatible = "ti,pbias-omap5", .data = &pbias_of_data_omap5, },
+	{ .compatible = "ti,pbias-dra7", .data = &pbias_of_data_dra7, },
 	{},
 };

...

Quoted 9 lines
drivers/regulator/pbias-regulator.c +5 -0
@@ -129,6 +161,18 @@ static int pbias_regulator_probe(struct platform_device *pdev)
 	if (IS_ERR(syscon))
 		return PTR_ERR(syscon);
 
+	match = of_match_device(of_match_ptr(pbias_of_match), &pdev->dev);
+	if (match && match->data) {
+		data = match->data;
+		offset = data->offset;
+	} else {

drivers/regulator/pbias-regulator.c static int pbias_regulator_probe(struct platform_device *pdev) · line 178

Quoted 10 lines
drivers/regulator/pbias-regulator.c +7 -0
+		res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+		if (!res)
+			return -EINVAL;
+
+		offset = res->start;
+	}
+
 	cfg.regmap = syscon;
 	cfg.dev = &pdev->dev;
 

Maybe add a warning here for parsing the legacy broken IORESOURCE_MEM that's known to be broken from DT point of view?

Other than that, looks OK to me and should allow also changing to use a generic solution, Mark may have some other comments.

Anyways, something like this is needed for v4.3-rc cycle, probably best that Mark queues all these after review. So feel free to add for the whole series:

maintainer
#3 lore raw

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

In reply to Kishon Vijay Abraham I
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.

Can you respin with Tony's comment please and I'll apply?
-------------- 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/20150902/4b5d276d/attachment.sig>

#4 lore raw

PATCH 2/6 ARM: dts: dra7: use "ti,pbias-dra7" compatible string for pbias

In reply to Kishon Vijay Abraham I

Use "ti,pbias-dra7" compatible string which is specifically added for DRA7 SoCs.

---
 arch/arm/boot/dts/dra7.dtsi |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
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 {
Signature · 1 line
1.7.9.5
#5 lore raw

PATCH 3/6 ARM: dts: omap243x: use "ti,pbias-omap2" compatible string for pbias

In reply to Kishon Vijay Abraham I

Use "ti,pbias-omap2" compatible string which is specifically added for OMAP2.

---
 arch/arm/boot/dts/omap2430.dtsi |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
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 {
Signature · 1 line
1.7.9.5
#6 lore raw

PATCH 4/6 ARM: dts: omap3: use "ti,pbias-omap3" compatible string for pbias

In reply to Kishon Vijay Abraham I

Use "ti,pbias-omap3" compatible string which is specifically added for OMAP3.

---
 arch/arm/boot/dts/omap3.dtsi |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
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 {
Signature · 1 line
1.7.9.5
#7 lore raw

PATCH 5/6 ARM: dts: OMAP4: use "ti,pbias-omap4" compatible string for pbias

In reply to Kishon Vijay Abraham I

Use "ti,pbias-omap4" compatible string which is specifically added for OMAP4.

---
 arch/arm/boot/dts/omap4.dtsi |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
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 {
Signature · 1 line
1.7.9.5
#8 lore raw

PATCH 6/6 ARM: dts: OMAP5: use "ti,pbias-omap5" compatible string for pbias

In reply to Kishon Vijay Abraham I

Use "ti,pbias-omap5" compatible string which is specifically added for OMAP5.

---
 arch/arm/boot/dts/omap5.dtsi |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
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