All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/6] regulator: Fix pbias regulator enable
@ 2015-09-03  6:50 ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 28+ messages in thread
From: Kishon Vijay Abraham I @ 2015-09-03  6:50 UTC (permalink / raw)
  To: tony, broonie, devicetree, linux-mmc, linux-kernel
  Cc: ulf.hansson, robh+dt, pawel.moll, mark.rutland, ijc+devicetree,
	galak, bcousson, linux, lgirdwood, linux-omap, linux-arm-kernel,
	nsekhar, kishon

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 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 (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                |   56 +++++++++++++++++---
 7 files changed, 61 insertions(+), 12 deletions(-)

-- 
1.7.9.5


^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH v2 0/6] regulator: Fix pbias regulator enable
@ 2015-09-03  6:50 ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 28+ messages in thread
From: Kishon Vijay Abraham I @ 2015-09-03  6:50 UTC (permalink / raw)
  To: tony, broonie, devicetree, linux-mmc, linux-kernel
  Cc: ulf.hansson, robh+dt, pawel.moll, mark.rutland, ijc+devicetree,
	galak, bcousson, linux, lgirdwood, linux-omap, linux-arm-kernel,
	nsekhar, kishon

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 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 (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                |   56 +++++++++++++++++---
 7 files changed, 61 insertions(+), 12 deletions(-)

-- 
1.7.9.5

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH v2 0/6] regulator: Fix pbias regulator enable
@ 2015-09-03  6:50 ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 28+ messages in thread
From: Kishon Vijay Abraham I @ 2015-09-03  6:50 UTC (permalink / raw)
  To: linux-arm-kernel

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 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 (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                |   56 +++++++++++++++++---
 7 files changed, 61 insertions(+), 12 deletions(-)

-- 
1.7.9.5

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH v2 1/6] regulator: pbias: program pbias register offset in pbias driver
  2015-09-03  6:50 ` Kishon Vijay Abraham I
  (?)
@ 2015-09-03  6:50   ` Kishon Vijay Abraham I
  -1 siblings, 0 replies; 28+ messages in thread
From: Kishon Vijay Abraham I @ 2015-09-03  6:50 UTC (permalink / raw)
  To: tony, broonie, devicetree, linux-mmc, linux-kernel
  Cc: ulf.hansson, robh+dt, pawel.moll, mark.rutland, ijc+devicetree,
	galak, bcousson, linux, lgirdwood, linux-omap, linux-arm-kernel,
	nsekhar, kishon

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 for the new compatible
strings.

Suggested-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
---
 .../bindings/regulator/pbias-regulator.txt         |    7 ++-
 drivers/regulator/pbias-regulator.c                |   56 +++++++++++++++++---
 2 files changed, 56 insertions(+), 7 deletions(-)

diff --git a/Documentation/devicetree/bindings/regulator/pbias-regulator.txt b/Documentation/devicetree/bindings/regulator/pbias-regulator.txt
index 32aa26f..acbcb45 100644
--- a/Documentation/devicetree/bindings/regulator/pbias-regulator.txt
+++ b/Documentation/devicetree/bindings/regulator/pbias-regulator.txt
@@ -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
diff --git a/drivers/regulator/pbias-regulator.c b/drivers/regulator/pbias-regulator.c
index bd2b75c..c21cedb 100644
--- a/drivers/regulator/pbias-regulator.c
+++ b/drivers/regulator/pbias-regulator.c
@@ -44,6 +44,10 @@ struct pbias_regulator_data {
 	int voltage;
 };
 
+struct pbias_of_data {
+	unsigned int offset;
+};
+
 static const unsigned int pbias_volt_table[] = {
 	1800000,
 	3000000
@@ -98,8 +102,35 @@ static struct of_regulator_match pbias_matches[] = {
 };
 #define PBIAS_NUM_REGS	ARRAY_SIZE(pbias_matches)
 
+/* Offset from SCM general area (and syscon) base */
+
+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, },
 	{},
 };
 MODULE_DEVICE_TABLE(of, pbias_of_match);
@@ -114,6 +145,9 @@ static int pbias_regulator_probe(struct platform_device *pdev)
 	const struct pbias_reg_info *info;
 	int ret = 0;
 	int count, idx, data_idx = 0;
+	const struct of_device_id *match;
+	const struct pbias_of_data *data;
+	unsigned int offset;
 
 	count = of_regulator_match(&pdev->dev, np, pbias_matches,
 						PBIAS_NUM_REGS);
@@ -129,6 +163,20 @@ 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 {
+		res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+		if (!res)
+			return -EINVAL;
+
+		offset = res->start;
+		dev_WARN(&pdev->dev,
+			 "using legacy dt data for pbias offset\n");
+	}
+
 	cfg.regmap = syscon;
 	cfg.dev = &pdev->dev;
 
@@ -141,10 +189,6 @@ static int pbias_regulator_probe(struct platform_device *pdev)
 		if (!info)
 			return -ENODEV;
 
-		res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-		if (!res)
-			return -EINVAL;
-
 		drvdata[data_idx].syscon = syscon;
 		drvdata[data_idx].info = info;
 		drvdata[data_idx].desc.name = info->name;
@@ -154,9 +198,9 @@ static int pbias_regulator_probe(struct platform_device *pdev)
 		drvdata[data_idx].desc.volt_table = pbias_volt_table;
 		drvdata[data_idx].desc.n_voltages = 2;
 		drvdata[data_idx].desc.enable_time = info->enable_time;
-		drvdata[data_idx].desc.vsel_reg = res->start;
+		drvdata[data_idx].desc.vsel_reg = offset;
 		drvdata[data_idx].desc.vsel_mask = info->vmode;
-		drvdata[data_idx].desc.enable_reg = res->start;
+		drvdata[data_idx].desc.enable_reg = offset;
 		drvdata[data_idx].desc.enable_mask = info->enable_mask;
 		drvdata[data_idx].desc.enable_val = info->enable;
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH v2 1/6] regulator: pbias: program pbias register offset in pbias driver
@ 2015-09-03  6:50   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 28+ messages in thread
From: Kishon Vijay Abraham I @ 2015-09-03  6:50 UTC (permalink / raw)
  To: tony, broonie, devicetree, linux-mmc, linux-kernel
  Cc: mark.rutland, ulf.hansson, linux, pawel.moll, ijc+devicetree,
	nsekhar, lgirdwood, kishon, robh+dt, bcousson, galak, linux-omap,
	linux-arm-kernel

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 for the new compatible
strings.

Suggested-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
---
 .../bindings/regulator/pbias-regulator.txt         |    7 ++-
 drivers/regulator/pbias-regulator.c                |   56 +++++++++++++++++---
 2 files changed, 56 insertions(+), 7 deletions(-)

diff --git a/Documentation/devicetree/bindings/regulator/pbias-regulator.txt b/Documentation/devicetree/bindings/regulator/pbias-regulator.txt
index 32aa26f..acbcb45 100644
--- a/Documentation/devicetree/bindings/regulator/pbias-regulator.txt
+++ b/Documentation/devicetree/bindings/regulator/pbias-regulator.txt
@@ -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
diff --git a/drivers/regulator/pbias-regulator.c b/drivers/regulator/pbias-regulator.c
index bd2b75c..c21cedb 100644
--- a/drivers/regulator/pbias-regulator.c
+++ b/drivers/regulator/pbias-regulator.c
@@ -44,6 +44,10 @@ struct pbias_regulator_data {
 	int voltage;
 };
 
+struct pbias_of_data {
+	unsigned int offset;
+};
+
 static const unsigned int pbias_volt_table[] = {
 	1800000,
 	3000000
@@ -98,8 +102,35 @@ static struct of_regulator_match pbias_matches[] = {
 };
 #define PBIAS_NUM_REGS	ARRAY_SIZE(pbias_matches)
 
+/* Offset from SCM general area (and syscon) base */
+
+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, },
 	{},
 };
 MODULE_DEVICE_TABLE(of, pbias_of_match);
@@ -114,6 +145,9 @@ static int pbias_regulator_probe(struct platform_device *pdev)
 	const struct pbias_reg_info *info;
 	int ret = 0;
 	int count, idx, data_idx = 0;
+	const struct of_device_id *match;
+	const struct pbias_of_data *data;
+	unsigned int offset;
 
 	count = of_regulator_match(&pdev->dev, np, pbias_matches,
 						PBIAS_NUM_REGS);
@@ -129,6 +163,20 @@ 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 {
+		res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+		if (!res)
+			return -EINVAL;
+
+		offset = res->start;
+		dev_WARN(&pdev->dev,
+			 "using legacy dt data for pbias offset\n");
+	}
+
 	cfg.regmap = syscon;
 	cfg.dev = &pdev->dev;
 
@@ -141,10 +189,6 @@ static int pbias_regulator_probe(struct platform_device *pdev)
 		if (!info)
 			return -ENODEV;
 
-		res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-		if (!res)
-			return -EINVAL;
-
 		drvdata[data_idx].syscon = syscon;
 		drvdata[data_idx].info = info;
 		drvdata[data_idx].desc.name = info->name;
@@ -154,9 +198,9 @@ static int pbias_regulator_probe(struct platform_device *pdev)
 		drvdata[data_idx].desc.volt_table = pbias_volt_table;
 		drvdata[data_idx].desc.n_voltages = 2;
 		drvdata[data_idx].desc.enable_time = info->enable_time;
-		drvdata[data_idx].desc.vsel_reg = res->start;
+		drvdata[data_idx].desc.vsel_reg = offset;
 		drvdata[data_idx].desc.vsel_mask = info->vmode;
-		drvdata[data_idx].desc.enable_reg = res->start;
+		drvdata[data_idx].desc.enable_reg = offset;
 		drvdata[data_idx].desc.enable_mask = info->enable_mask;
 		drvdata[data_idx].desc.enable_val = info->enable;
 
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH v2 1/6] regulator: pbias: program pbias register offset in pbias driver
@ 2015-09-03  6:50   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 28+ messages in thread
From: Kishon Vijay Abraham I @ 2015-09-03  6:50 UTC (permalink / raw)
  To: linux-arm-kernel

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 for the new compatible
strings.

Suggested-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
---
 .../bindings/regulator/pbias-regulator.txt         |    7 ++-
 drivers/regulator/pbias-regulator.c                |   56 +++++++++++++++++---
 2 files changed, 56 insertions(+), 7 deletions(-)

diff --git a/Documentation/devicetree/bindings/regulator/pbias-regulator.txt b/Documentation/devicetree/bindings/regulator/pbias-regulator.txt
index 32aa26f..acbcb45 100644
--- a/Documentation/devicetree/bindings/regulator/pbias-regulator.txt
+++ b/Documentation/devicetree/bindings/regulator/pbias-regulator.txt
@@ -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
diff --git a/drivers/regulator/pbias-regulator.c b/drivers/regulator/pbias-regulator.c
index bd2b75c..c21cedb 100644
--- a/drivers/regulator/pbias-regulator.c
+++ b/drivers/regulator/pbias-regulator.c
@@ -44,6 +44,10 @@ struct pbias_regulator_data {
 	int voltage;
 };
 
+struct pbias_of_data {
+	unsigned int offset;
+};
+
 static const unsigned int pbias_volt_table[] = {
 	1800000,
 	3000000
@@ -98,8 +102,35 @@ static struct of_regulator_match pbias_matches[] = {
 };
 #define PBIAS_NUM_REGS	ARRAY_SIZE(pbias_matches)
 
+/* Offset from SCM general area (and syscon) base */
+
+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, },
 	{},
 };
 MODULE_DEVICE_TABLE(of, pbias_of_match);
@@ -114,6 +145,9 @@ static int pbias_regulator_probe(struct platform_device *pdev)
 	const struct pbias_reg_info *info;
 	int ret = 0;
 	int count, idx, data_idx = 0;
+	const struct of_device_id *match;
+	const struct pbias_of_data *data;
+	unsigned int offset;
 
 	count = of_regulator_match(&pdev->dev, np, pbias_matches,
 						PBIAS_NUM_REGS);
@@ -129,6 +163,20 @@ 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 {
+		res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+		if (!res)
+			return -EINVAL;
+
+		offset = res->start;
+		dev_WARN(&pdev->dev,
+			 "using legacy dt data for pbias offset\n");
+	}
+
 	cfg.regmap = syscon;
 	cfg.dev = &pdev->dev;
 
@@ -141,10 +189,6 @@ static int pbias_regulator_probe(struct platform_device *pdev)
 		if (!info)
 			return -ENODEV;
 
-		res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-		if (!res)
-			return -EINVAL;
-
 		drvdata[data_idx].syscon = syscon;
 		drvdata[data_idx].info = info;
 		drvdata[data_idx].desc.name = info->name;
@@ -154,9 +198,9 @@ static int pbias_regulator_probe(struct platform_device *pdev)
 		drvdata[data_idx].desc.volt_table = pbias_volt_table;
 		drvdata[data_idx].desc.n_voltages = 2;
 		drvdata[data_idx].desc.enable_time = info->enable_time;
-		drvdata[data_idx].desc.vsel_reg = res->start;
+		drvdata[data_idx].desc.vsel_reg = offset;
 		drvdata[data_idx].desc.vsel_mask = info->vmode;
-		drvdata[data_idx].desc.enable_reg = res->start;
+		drvdata[data_idx].desc.enable_reg = offset;
 		drvdata[data_idx].desc.enable_mask = info->enable_mask;
 		drvdata[data_idx].desc.enable_val = info->enable;
 
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH v2 2/6] ARM: dts: dra7: use "ti,pbias-dra7" compatible string for pbias
  2015-09-03  6:50 ` Kishon Vijay Abraham I
  (?)
@ 2015-09-03  6:50   ` Kishon Vijay Abraham I
  -1 siblings, 0 replies; 28+ messages in thread
From: Kishon Vijay Abraham I @ 2015-09-03  6:50 UTC (permalink / raw)
  To: tony, broonie, devicetree, linux-mmc, linux-kernel
  Cc: ulf.hansson, robh+dt, pawel.moll, mark.rutland, ijc+devicetree,
	galak, bcousson, linux, lgirdwood, linux-omap, linux-arm-kernel,
	nsekhar, kishon

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

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/boot/dts/dra7.dtsi |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
index 1e29ccf..d6bc6db 100644
--- a/arch/arm/boot/dts/dra7.dtsi
+++ b/arch/arm/boot/dts/dra7.dtsi
@@ -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 {
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH v2 2/6] ARM: dts: dra7: use "ti,pbias-dra7" compatible string for pbias
@ 2015-09-03  6:50   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 28+ messages in thread
From: Kishon Vijay Abraham I @ 2015-09-03  6:50 UTC (permalink / raw)
  To: tony, broonie, devicetree, linux-mmc, linux-kernel
  Cc: ulf.hansson, robh+dt, pawel.moll, mark.rutland, ijc+devicetree,
	galak, bcousson, linux, lgirdwood, linux-omap, linux-arm-kernel,
	nsekhar, kishon

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

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/boot/dts/dra7.dtsi |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
index 1e29ccf..d6bc6db 100644
--- a/arch/arm/boot/dts/dra7.dtsi
+++ b/arch/arm/boot/dts/dra7.dtsi
@@ -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 {
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH v2 2/6] ARM: dts: dra7: use "ti, pbias-dra7" compatible string for pbias
@ 2015-09-03  6:50   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 28+ messages in thread
From: Kishon Vijay Abraham I @ 2015-09-03  6:50 UTC (permalink / raw)
  To: linux-arm-kernel

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

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/boot/dts/dra7.dtsi |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
index 1e29ccf..d6bc6db 100644
--- a/arch/arm/boot/dts/dra7.dtsi
+++ b/arch/arm/boot/dts/dra7.dtsi
@@ -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 {
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH v2 3/6] ARM: dts: omap243x: use "ti,pbias-omap2" compatible string for pbias
@ 2015-09-03  6:50   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 28+ messages in thread
From: Kishon Vijay Abraham I @ 2015-09-03  6:50 UTC (permalink / raw)
  To: tony, broonie, devicetree, linux-mmc, linux-kernel
  Cc: ulf.hansson, robh+dt, pawel.moll, mark.rutland, ijc+devicetree,
	galak, bcousson, linux, lgirdwood, linux-omap, linux-arm-kernel,
	nsekhar, kishon

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

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/boot/dts/omap2430.dtsi |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/omap2430.dtsi b/arch/arm/boot/dts/omap2430.dtsi
index 2390f38..3961a6f 100644
--- a/arch/arm/boot/dts/omap2430.dtsi
+++ b/arch/arm/boot/dts/omap2430.dtsi
@@ -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 {
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH v2 3/6] ARM: dts: omap243x: use "ti,pbias-omap2" compatible string for pbias
@ 2015-09-03  6:50   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 28+ messages in thread
From: Kishon Vijay Abraham I @ 2015-09-03  6:50 UTC (permalink / raw)
  To: tony-4v6yS6AI5VpBDgjK7y7TUQ, broonie-DgEjT+Ai2ygdnm+yROfE0A,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-mmc-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA
  Cc: ulf.hansson-QSEj5FYQhm4dnm+yROfE0A,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A, pawel.moll-5wv7dgnIgG8,
	mark.rutland-5wv7dgnIgG8, ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
	galak-sgV2jX0FEOL9JmXXK+q4OQ, bcousson-rdvid1DuHRBWk0Htik3J/w,
	linux-lFZ/pmaqli7XmaaqVzeoHQ, lgirdwood-Re5JQEeQqe8AvxtiuMwx3w,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	nsekhar-l0cyMroinI0, kishon-l0cyMroinI0

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

Signed-off-by: Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org>
Acked-by: Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
---
 arch/arm/boot/dts/omap2430.dtsi |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/omap2430.dtsi b/arch/arm/boot/dts/omap2430.dtsi
index 2390f38..3961a6f 100644
--- a/arch/arm/boot/dts/omap2430.dtsi
+++ b/arch/arm/boot/dts/omap2430.dtsi
@@ -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 {
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH v2 3/6] ARM: dts: omap243x: use "ti, pbias-omap2" compatible string for pbias
@ 2015-09-03  6:50   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 28+ messages in thread
From: Kishon Vijay Abraham I @ 2015-09-03  6:50 UTC (permalink / raw)
  To: linux-arm-kernel

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

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/boot/dts/omap2430.dtsi |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/omap2430.dtsi b/arch/arm/boot/dts/omap2430.dtsi
index 2390f38..3961a6f 100644
--- a/arch/arm/boot/dts/omap2430.dtsi
+++ b/arch/arm/boot/dts/omap2430.dtsi
@@ -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 {
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH v2 4/6] ARM: dts: omap3: use "ti,pbias-omap3" compatible string for pbias
  2015-09-03  6:50 ` Kishon Vijay Abraham I
  (?)
@ 2015-09-03  6:50   ` Kishon Vijay Abraham I
  -1 siblings, 0 replies; 28+ messages in thread
From: Kishon Vijay Abraham I @ 2015-09-03  6:50 UTC (permalink / raw)
  To: tony, broonie, devicetree, linux-mmc, linux-kernel
  Cc: ulf.hansson, robh+dt, pawel.moll, mark.rutland, ijc+devicetree,
	galak, bcousson, linux, lgirdwood, linux-omap, linux-arm-kernel,
	nsekhar, kishon

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

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/boot/dts/omap3.dtsi |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/omap3.dtsi b/arch/arm/boot/dts/omap3.dtsi
index 69a40cf..9af9ae1 100644
--- a/arch/arm/boot/dts/omap3.dtsi
+++ b/arch/arm/boot/dts/omap3.dtsi
@@ -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 {
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH v2 4/6] ARM: dts: omap3: use "ti, pbias-omap3" compatible string for pbias
@ 2015-09-03  6:50   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 28+ messages in thread
From: Kishon Vijay Abraham I @ 2015-09-03  6:50 UTC (permalink / raw)
  To: tony, broonie, devicetree, linux-mmc, linux-kernel
  Cc: mark.rutland, ulf.hansson, linux, pawel.moll, ijc+devicetree,
	nsekhar, lgirdwood, kishon, robh+dt, bcousson, galak, linux-omap,
	linux-arm-kernel

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

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/boot/dts/omap3.dtsi |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/omap3.dtsi b/arch/arm/boot/dts/omap3.dtsi
index 69a40cf..9af9ae1 100644
--- a/arch/arm/boot/dts/omap3.dtsi
+++ b/arch/arm/boot/dts/omap3.dtsi
@@ -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 {
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH v2 4/6] ARM: dts: omap3: use "ti, pbias-omap3" compatible string for pbias
@ 2015-09-03  6:50   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 28+ messages in thread
From: Kishon Vijay Abraham I @ 2015-09-03  6:50 UTC (permalink / raw)
  To: linux-arm-kernel

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

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/boot/dts/omap3.dtsi |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/omap3.dtsi b/arch/arm/boot/dts/omap3.dtsi
index 69a40cf..9af9ae1 100644
--- a/arch/arm/boot/dts/omap3.dtsi
+++ b/arch/arm/boot/dts/omap3.dtsi
@@ -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 {
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH v2 5/6] ARM: dts: omap4: use "ti,pbias-omap4" compatible string for pbias
  2015-09-03  6:50 ` Kishon Vijay Abraham I
  (?)
@ 2015-09-03  6:50   ` Kishon Vijay Abraham I
  -1 siblings, 0 replies; 28+ messages in thread
From: Kishon Vijay Abraham I @ 2015-09-03  6:50 UTC (permalink / raw)
  To: tony, broonie, devicetree, linux-mmc, linux-kernel
  Cc: ulf.hansson, robh+dt, pawel.moll, mark.rutland, ijc+devicetree,
	galak, bcousson, linux, lgirdwood, linux-omap, linux-arm-kernel,
	nsekhar, kishon

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

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/boot/dts/omap4.dtsi |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index abc4473..5aad7f3 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -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 {
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH v2 5/6] ARM: dts: omap4: use "ti,pbias-omap4" compatible string for pbias
@ 2015-09-03  6:50   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 28+ messages in thread
From: Kishon Vijay Abraham I @ 2015-09-03  6:50 UTC (permalink / raw)
  To: tony, broonie, devicetree, linux-mmc, linux-kernel
  Cc: ulf.hansson, robh+dt, pawel.moll, mark.rutland, ijc+devicetree,
	galak, bcousson, linux, lgirdwood, linux-omap, linux-arm-kernel,
	nsekhar, kishon

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

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/boot/dts/omap4.dtsi |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index abc4473..5aad7f3 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -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 {
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH v2 5/6] ARM: dts: omap4: use "ti, pbias-omap4" compatible string for pbias
@ 2015-09-03  6:50   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 28+ messages in thread
From: Kishon Vijay Abraham I @ 2015-09-03  6:50 UTC (permalink / raw)
  To: linux-arm-kernel

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

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/boot/dts/omap4.dtsi |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index abc4473..5aad7f3 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -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 {
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH v2 6/6] ARM: dts: omap5: use "ti,pbias-omap5" compatible string for pbias
  2015-09-03  6:50 ` Kishon Vijay Abraham I
  (?)
@ 2015-09-03  6:50   ` Kishon Vijay Abraham I
  -1 siblings, 0 replies; 28+ messages in thread
From: Kishon Vijay Abraham I @ 2015-09-03  6:50 UTC (permalink / raw)
  To: tony, broonie, devicetree, linux-mmc, linux-kernel
  Cc: ulf.hansson, robh+dt, pawel.moll, mark.rutland, ijc+devicetree,
	galak, bcousson, linux, lgirdwood, linux-omap, linux-arm-kernel,
	nsekhar, kishon

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

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/boot/dts/omap5.dtsi |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/omap5.dtsi b/arch/arm/boot/dts/omap5.dtsi
index b1a1263..76ef595 100644
--- a/arch/arm/boot/dts/omap5.dtsi
+++ b/arch/arm/boot/dts/omap5.dtsi
@@ -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 {
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH v2 6/6] ARM: dts: omap5: use "ti,pbias-omap5" compatible string for pbias
@ 2015-09-03  6:50   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 28+ messages in thread
From: Kishon Vijay Abraham I @ 2015-09-03  6:50 UTC (permalink / raw)
  To: tony, broonie, devicetree, linux-mmc, linux-kernel
  Cc: ulf.hansson, robh+dt, pawel.moll, mark.rutland, ijc+devicetree,
	galak, bcousson, linux, lgirdwood, linux-omap, linux-arm-kernel,
	nsekhar, kishon

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

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/boot/dts/omap5.dtsi |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/omap5.dtsi b/arch/arm/boot/dts/omap5.dtsi
index b1a1263..76ef595 100644
--- a/arch/arm/boot/dts/omap5.dtsi
+++ b/arch/arm/boot/dts/omap5.dtsi
@@ -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 {
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH v2 6/6] ARM: dts: omap5: use "ti, pbias-omap5" compatible string for pbias
@ 2015-09-03  6:50   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 28+ messages in thread
From: Kishon Vijay Abraham I @ 2015-09-03  6:50 UTC (permalink / raw)
  To: linux-arm-kernel

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

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/boot/dts/omap5.dtsi |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/omap5.dtsi b/arch/arm/boot/dts/omap5.dtsi
index b1a1263..76ef595 100644
--- a/arch/arm/boot/dts/omap5.dtsi
+++ b/arch/arm/boot/dts/omap5.dtsi
@@ -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 {
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* Re: [PATCH v2 0/6] regulator: Fix pbias regulator enable
  2015-09-03  6:50 ` Kishon Vijay Abraham I
@ 2015-09-03  7:39   ` Ulf Hansson
  -1 siblings, 0 replies; 28+ messages in thread
From: Ulf Hansson @ 2015-09-03  7:39 UTC (permalink / raw)
  To: Kishon Vijay Abraham I, Olof Johansson, Tony Lindgren, Mark Brown
  Cc: devicetree, linux-mmc, linux-kernel, Rob Herring,
	Paweł Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Benoit Cousson, Russell King - ARM Linux, Liam Girdwood,
	linux-omap, linux-arm-kernel, Sekhar Nori

+Olof

On 3 September 2015 at 08:50, Kishon Vijay Abraham I <kishon@ti.com> wrote:
> 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 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 (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                |   56 +++++++++++++++++---
>  7 files changed, 61 insertions(+), 12 deletions(-)
>
> --
> 1.7.9.5
>

I have recently queued another patchset [1] for the mmc omap driver
for 4.3 through my mmc tree for which Olof Johansson reported a
regression [2] for Panda ES with multi_v7_defconfig.

Kishon, could you please clarify if $subject patchset solves that
regression reported by Olof? Or perhaps Olof can run a test?

Finally, perhaps it's better if we queue this through my mmc tree
since we would then be able to avoid the regression - if I put
$subject patchset before [1], right? Then I need an ack from Mark for
the regulator patch.
Please tell me if you guys prefer another way.

Kind regards
Uffe

[1]
http://permalink.gmane.org/gmane.linux.kernel/2027789

[2]
http://www.spinics.net/lists/linux-mmc/msg33146.html

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH v2 0/6] regulator: Fix pbias regulator enable
@ 2015-09-03  7:39   ` Ulf Hansson
  0 siblings, 0 replies; 28+ messages in thread
From: Ulf Hansson @ 2015-09-03  7:39 UTC (permalink / raw)
  To: linux-arm-kernel

+Olof

On 3 September 2015 at 08:50, Kishon Vijay Abraham I <kishon@ti.com> wrote:
> 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 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 (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                |   56 +++++++++++++++++---
>  7 files changed, 61 insertions(+), 12 deletions(-)
>
> --
> 1.7.9.5
>

I have recently queued another patchset [1] for the mmc omap driver
for 4.3 through my mmc tree for which Olof Johansson reported a
regression [2] for Panda ES with multi_v7_defconfig.

Kishon, could you please clarify if $subject patchset solves that
regression reported by Olof? Or perhaps Olof can run a test?

Finally, perhaps it's better if we queue this through my mmc tree
since we would then be able to avoid the regression - if I put
$subject patchset before [1], right? Then I need an ack from Mark for
the regulator patch.
Please tell me if you guys prefer another way.

Kind regards
Uffe

[1]
http://permalink.gmane.org/gmane.linux.kernel/2027789

[2]
http://www.spinics.net/lists/linux-mmc/msg33146.html

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH v2 0/6] regulator: Fix pbias regulator enable
  2015-09-03  7:39   ` Ulf Hansson
@ 2015-09-03  9:21     ` Kishon Vijay Abraham I
  -1 siblings, 0 replies; 28+ messages in thread
From: Kishon Vijay Abraham I @ 2015-09-03  9:21 UTC (permalink / raw)
  To: Ulf Hansson, Olof Johansson, Tony Lindgren, Mark Brown
  Cc: devicetree, linux-mmc, linux-kernel, Rob Herring,
	Paweł Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Benoit Cousson, Russell King - ARM Linux, Liam Girdwood,
	linux-omap, linux-arm-kernel, Sekhar Nori

Hi,

On Thursday 03 September 2015 01:09 PM, Ulf Hansson wrote:
> +Olof
> 
> On 3 September 2015 at 08:50, Kishon Vijay Abraham I <kishon@ti.com> wrote:
>> 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 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 (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                |   56 +++++++++++++++++---
>>  7 files changed, 61 insertions(+), 12 deletions(-)
>>
>> --
>> 1.7.9.5
>>
> 
> I have recently queued another patchset [1] for the mmc omap driver
> for 4.3 through my mmc tree for which Olof Johansson reported a
> regression [2] for Panda ES with multi_v7_defconfig.

I generally perform my tests with omap2plus_defconfig and without this
series MMC doesn't work with omap2plus_defconfig.
> 
> Kishon, could you please clarify if $subject patchset solves that
> regression reported by Olof? Or perhaps Olof can run a test?

Just checked multi_v7_defconfig and this series is definitely required
to get MMC working. But we also have to enable 'CONFIG_REGULATOR_PBIAS'
which is not enabled by default in multi_v7_defconfig.

So we should have a patch to enable 'CONFIG_REGULATOR_PBIAS' in
multi_v7_defconfig to completely solve the problem reported by Olof.
I'll prepare a patch for multi_v7_defconfig and post it asap.

Thanks
Kishon

> 
> Finally, perhaps it's better if we queue this through my mmc tree
> since we would then be able to avoid the regression - if I put
> $subject patchset before [1], right? Then I need an ack from Mark for
> the regulator patch.
> Please tell me if you guys prefer another way.
> 
> Kind regards
> Uffe
> 
> [1]
> http://permalink.gmane.org/gmane.linux.kernel/2027789
> 
> [2]
> http://www.spinics.net/lists/linux-mmc/msg33146.html
> 

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH v2 0/6] regulator: Fix pbias regulator enable
@ 2015-09-03  9:21     ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 28+ messages in thread
From: Kishon Vijay Abraham I @ 2015-09-03  9:21 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Thursday 03 September 2015 01:09 PM, Ulf Hansson wrote:
> +Olof
> 
> On 3 September 2015 at 08:50, Kishon Vijay Abraham I <kishon@ti.com> wrote:
>> 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 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 (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                |   56 +++++++++++++++++---
>>  7 files changed, 61 insertions(+), 12 deletions(-)
>>
>> --
>> 1.7.9.5
>>
> 
> I have recently queued another patchset [1] for the mmc omap driver
> for 4.3 through my mmc tree for which Olof Johansson reported a
> regression [2] for Panda ES with multi_v7_defconfig.

I generally perform my tests with omap2plus_defconfig and without this
series MMC doesn't work with omap2plus_defconfig.
> 
> Kishon, could you please clarify if $subject patchset solves that
> regression reported by Olof? Or perhaps Olof can run a test?

Just checked multi_v7_defconfig and this series is definitely required
to get MMC working. But we also have to enable 'CONFIG_REGULATOR_PBIAS'
which is not enabled by default in multi_v7_defconfig.

So we should have a patch to enable 'CONFIG_REGULATOR_PBIAS' in
multi_v7_defconfig to completely solve the problem reported by Olof.
I'll prepare a patch for multi_v7_defconfig and post it asap.

Thanks
Kishon

> 
> Finally, perhaps it's better if we queue this through my mmc tree
> since we would then be able to avoid the regression - if I put
> $subject patchset before [1], right? Then I need an ack from Mark for
> the regulator patch.
> Please tell me if you guys prefer another way.
> 
> Kind regards
> Uffe
> 
> [1]
> http://permalink.gmane.org/gmane.linux.kernel/2027789
> 
> [2]
> http://www.spinics.net/lists/linux-mmc/msg33146.html
> 

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH v2 0/6] regulator: Fix pbias regulator enable
  2015-09-03  9:21     ` Kishon Vijay Abraham I
@ 2015-09-03 15:04       ` Tony Lindgren
  -1 siblings, 0 replies; 28+ messages in thread
From: Tony Lindgren @ 2015-09-03 15:04 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: Ulf Hansson, Olof Johansson, Mark Brown, devicetree, linux-mmc,
	linux-kernel, Rob Herring, Paweł Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, Benoit Cousson,
	Russell King - ARM Linux, Liam Girdwood, linux-omap,
	linux-arm-kernel, Sekhar Nori

* Kishon Vijay Abraham I <kishon@ti.com> [150903 02:25]:
> On Thursday 03 September 2015 01:09 PM, Ulf Hansson wrote:
> > 
> > Finally, perhaps it's better if we queue this through my mmc tree
> > since we would then be able to avoid the regression - if I put
> > $subject patchset before [1], right? Then I need an ack from Mark for
> > the regulator patch.
> > Please tell me if you guys prefer another way.

That works for me too. Or Mark can set up an immutable signed
branch that you can merge in, up to you guys.

It's still going to break git bisect for booting but
removes the regression when mergeing to mainline.

I'd squash all the one liner dts changes into a single
patch though when applying to cut down on the commit
noise.

Regards,

Tony

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH v2 0/6] regulator: Fix pbias regulator enable
@ 2015-09-03 15:04       ` Tony Lindgren
  0 siblings, 0 replies; 28+ messages in thread
From: Tony Lindgren @ 2015-09-03 15:04 UTC (permalink / raw)
  To: linux-arm-kernel

* Kishon Vijay Abraham I <kishon@ti.com> [150903 02:25]:
> On Thursday 03 September 2015 01:09 PM, Ulf Hansson wrote:
> > 
> > Finally, perhaps it's better if we queue this through my mmc tree
> > since we would then be able to avoid the regression - if I put
> > $subject patchset before [1], right? Then I need an ack from Mark for
> > the regulator patch.
> > Please tell me if you guys prefer another way.

That works for me too. Or Mark can set up an immutable signed
branch that you can merge in, up to you guys.

It's still going to break git bisect for booting but
removes the regression when mergeing to mainline.

I'd squash all the one liner dts changes into a single
patch though when applying to cut down on the commit
noise.

Regards,

Tony

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Applied "regulator: pbias: program pbias register offset in pbias driver" to the regulator tree
  2015-09-03  6:50   ` Kishon Vijay Abraham I
  (?)
  (?)
@ 2015-09-06  0:09   ` Mark Brown
  -1 siblings, 0 replies; 28+ messages in thread
From: Mark Brown @ 2015-09-06  0:09 UTC (permalink / raw)
  To: Kishon Vijay Abraham I, Tony Lindgren, Mark Brown; +Cc: linux-kernel

The patch

   regulator: pbias: program pbias register offset in pbias driver

has been applied to the regulator tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From b9c93646fd5cb669d096fec5ad25a01f04cfde27 Mon Sep 17 00:00:00 2001
From: Kishon Vijay Abraham I <kishon@ti.com>
Date: Thu, 3 Sep 2015 12:20:37 +0530
Subject: [PATCH] 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 for the new compatible
strings.

Suggested-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 .../bindings/regulator/pbias-regulator.txt         |  7 ++-
 drivers/regulator/pbias-regulator.c                | 56 +++++++++++++++++++---
 2 files changed, 56 insertions(+), 7 deletions(-)

diff --git a/Documentation/devicetree/bindings/regulator/pbias-regulator.txt b/Documentation/devicetree/bindings/regulator/pbias-regulator.txt
index 32aa26f1e434..acbcb452a69a 100644
--- a/Documentation/devicetree/bindings/regulator/pbias-regulator.txt
+++ b/Documentation/devicetree/bindings/regulator/pbias-regulator.txt
@@ -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
diff --git a/drivers/regulator/pbias-regulator.c b/drivers/regulator/pbias-regulator.c
index bd2b75c0d1d1..c21cedbdf451 100644
--- a/drivers/regulator/pbias-regulator.c
+++ b/drivers/regulator/pbias-regulator.c
@@ -44,6 +44,10 @@ struct pbias_regulator_data {
 	int voltage;
 };
 
+struct pbias_of_data {
+	unsigned int offset;
+};
+
 static const unsigned int pbias_volt_table[] = {
 	1800000,
 	3000000
@@ -98,8 +102,35 @@ static struct of_regulator_match pbias_matches[] = {
 };
 #define PBIAS_NUM_REGS	ARRAY_SIZE(pbias_matches)
 
+/* Offset from SCM general area (and syscon) base */
+
+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, },
 	{},
 };
 MODULE_DEVICE_TABLE(of, pbias_of_match);
@@ -114,6 +145,9 @@ static int pbias_regulator_probe(struct platform_device *pdev)
 	const struct pbias_reg_info *info;
 	int ret = 0;
 	int count, idx, data_idx = 0;
+	const struct of_device_id *match;
+	const struct pbias_of_data *data;
+	unsigned int offset;
 
 	count = of_regulator_match(&pdev->dev, np, pbias_matches,
 						PBIAS_NUM_REGS);
@@ -129,6 +163,20 @@ 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 {
+		res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+		if (!res)
+			return -EINVAL;
+
+		offset = res->start;
+		dev_WARN(&pdev->dev,
+			 "using legacy dt data for pbias offset\n");
+	}
+
 	cfg.regmap = syscon;
 	cfg.dev = &pdev->dev;
 
@@ -141,10 +189,6 @@ static int pbias_regulator_probe(struct platform_device *pdev)
 		if (!info)
 			return -ENODEV;
 
-		res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-		if (!res)
-			return -EINVAL;
-
 		drvdata[data_idx].syscon = syscon;
 		drvdata[data_idx].info = info;
 		drvdata[data_idx].desc.name = info->name;
@@ -154,9 +198,9 @@ static int pbias_regulator_probe(struct platform_device *pdev)
 		drvdata[data_idx].desc.volt_table = pbias_volt_table;
 		drvdata[data_idx].desc.n_voltages = 2;
 		drvdata[data_idx].desc.enable_time = info->enable_time;
-		drvdata[data_idx].desc.vsel_reg = res->start;
+		drvdata[data_idx].desc.vsel_reg = offset;
 		drvdata[data_idx].desc.vsel_mask = info->vmode;
-		drvdata[data_idx].desc.enable_reg = res->start;
+		drvdata[data_idx].desc.enable_reg = offset;
 		drvdata[data_idx].desc.enable_mask = info->enable_mask;
 		drvdata[data_idx].desc.enable_val = info->enable;
 
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2015-09-06  0:09 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-03  6:50 [PATCH v2 0/6] regulator: Fix pbias regulator enable Kishon Vijay Abraham I
2015-09-03  6:50 ` Kishon Vijay Abraham I
2015-09-03  6:50 ` Kishon Vijay Abraham I
2015-09-03  6:50 ` [PATCH v2 1/6] regulator: pbias: program pbias register offset in pbias driver Kishon Vijay Abraham I
2015-09-03  6:50   ` Kishon Vijay Abraham I
2015-09-03  6:50   ` Kishon Vijay Abraham I
2015-09-06  0:09   ` Applied "regulator: pbias: program pbias register offset in pbias driver" to the regulator tree Mark Brown
2015-09-03  6:50 ` [PATCH v2 2/6] ARM: dts: dra7: use "ti,pbias-dra7" compatible string for pbias Kishon Vijay Abraham I
2015-09-03  6:50   ` [PATCH v2 2/6] ARM: dts: dra7: use "ti, pbias-dra7" " Kishon Vijay Abraham I
2015-09-03  6:50   ` [PATCH v2 2/6] ARM: dts: dra7: use "ti,pbias-dra7" " Kishon Vijay Abraham I
2015-09-03  6:50 ` [PATCH v2 3/6] ARM: dts: omap243x: use "ti,pbias-omap2" " Kishon Vijay Abraham I
2015-09-03  6:50   ` [PATCH v2 3/6] ARM: dts: omap243x: use "ti, pbias-omap2" " Kishon Vijay Abraham I
2015-09-03  6:50   ` [PATCH v2 3/6] ARM: dts: omap243x: use "ti,pbias-omap2" " Kishon Vijay Abraham I
2015-09-03  6:50 ` [PATCH v2 4/6] ARM: dts: omap3: use "ti,pbias-omap3" " Kishon Vijay Abraham I
2015-09-03  6:50   ` [PATCH v2 4/6] ARM: dts: omap3: use "ti, pbias-omap3" " Kishon Vijay Abraham I
2015-09-03  6:50   ` Kishon Vijay Abraham I
2015-09-03  6:50 ` [PATCH v2 5/6] ARM: dts: omap4: use "ti,pbias-omap4" " Kishon Vijay Abraham I
2015-09-03  6:50   ` [PATCH v2 5/6] ARM: dts: omap4: use "ti, pbias-omap4" " Kishon Vijay Abraham I
2015-09-03  6:50   ` [PATCH v2 5/6] ARM: dts: omap4: use "ti,pbias-omap4" " Kishon Vijay Abraham I
2015-09-03  6:50 ` [PATCH v2 6/6] ARM: dts: omap5: use "ti,pbias-omap5" " Kishon Vijay Abraham I
2015-09-03  6:50   ` [PATCH v2 6/6] ARM: dts: omap5: use "ti, pbias-omap5" " Kishon Vijay Abraham I
2015-09-03  6:50   ` [PATCH v2 6/6] ARM: dts: omap5: use "ti,pbias-omap5" " Kishon Vijay Abraham I
2015-09-03  7:39 ` [PATCH v2 0/6] regulator: Fix pbias regulator enable Ulf Hansson
2015-09-03  7:39   ` Ulf Hansson
2015-09-03  9:21   ` Kishon Vijay Abraham I
2015-09-03  9:21     ` Kishon Vijay Abraham I
2015-09-03 15:04     ` Tony Lindgren
2015-09-03 15:04       ` Tony Lindgren

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.