Skip to contentSkip to conversation

power: Add a driver to handle the PBIAS cell of the TI SOCs

PATCH Superseded Jean-Jacques Hiblot 5 participants 14 messages Jul 12, 2017 – Jul 14, 2017

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover power: Add a driver to handle the PBIAS cell of the TI SOCs

In the TI SOCs a PBIAS cell exists to provide a bias voltage to the MMC1 IO cells. Without this bias voltage these I/O cells can not function properly. This bias voltage is either 1.8v or 3.0v.

The first patch implements the support for this PBIAS cell as a regulator driver.
The sencond patch enables it in the default config for am57x and dra7x. The last patch is here to allow the binding of the driver. In the DTS of the dra7x and am57x platforms, the pbias entry is a child of a syscon.

Jean-Jacques Hiblot (3):
regulator: pbias: Add PBIAS regulator for proper voltage switching on
MMC1
configs: dra7xx_evm: am57xx_evm: Enable DM_REGULATOR_PBIAS
dm: syscon: scan sub-nodes of the syscon node

 configs/am57xx_evm_defconfig              |   3 +
 configs/dra7xx_evm_defconfig              |   1 +
 drivers/core/syscon-uclass.c              |   1 +
 drivers/power/regulator/Kconfig           |  10 +
 drivers/power/regulator/Makefile          |   1 +
 drivers/power/regulator/pbias_regulator.c | 305 ++++++++++++++++++++++++++++++
 6 files changed, 321 insertions(+)
 create mode 100644 drivers/power/regulator/pbias_regulator.c
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/3 regulator: pbias: Add PBIAS regulator for proper voltage switching on MMC1

In the TI SOCs a PBIAS cell exists to provide a bias voltage to the MMC1 IO cells. Without this bias voltage these I/O cells can not function properly. The PBIAS cell is controlled by software.

---
 drivers/power/regulator/Kconfig           |  10 +
 drivers/power/regulator/Makefile          |   1 +
 drivers/power/regulator/pbias_regulator.c | 305 ++++++++++++++++++++++++++++++
 3 files changed, 316 insertions(+)
 create mode 100644 drivers/power/regulator/pbias_regulator.c
drivers/power/regulator/Kconfig +10 -0
index f213487..f4ed3cc 100644
@@ -142,6 +142,16 @@ config DM_REGULATOR_PALMAS
 	features for REGULATOR PALMAS and the family of PALMAS PMICs.
 	The driver implements get/set api for: value and enable.
 
+config DM_REGULATOR_PBIAS
+	bool "Enable driver for PBIAS regulator"
+	---help---
+	This enables implementation of driver-model regulator uclass
+	features for pseudo-regulator PBIAS found in the OMAP SOCs.
+	This pseudo-regulator is used to provide a BIAS voltage to MMC1
+	signal pads and must be configured properly during a voltage switch.
+	Voltage switching is required by some operating modes of SDcards and
+	eMMC.
+
 config DM_REGULATOR_LP873X
 	bool "Enable driver for LP873X PMIC regulators"
         depends on PMIC_LP873X
drivers/power/regulator/Makefile +1 -0
index ce14d08..75d611a 100644
@@ -17,5 +17,6 @@ obj-$(CONFIG_REGULATOR_S5M8767) += s5m8767.o
 obj-$(CONFIG_DM_REGULATOR_SANDBOX) += sandbox.o
 obj-$(CONFIG_REGULATOR_TPS65090) += tps65090_regulator.o
 obj-$(CONFIG_$(SPL_)DM_REGULATOR_PALMAS) += palmas_regulator.o
+obj-$(CONFIG_$(SPL_)DM_REGULATOR_PBIAS) += pbias_regulator.o
 obj-$(CONFIG_$(SPL_)DM_REGULATOR_LP873X) += lp873x_regulator.o
 obj-$(CONFIG_$(SPL_)DM_REGULATOR_LP87565) += lp87565_regulator.o
drivers/power/regulator/pbias_regulator.c new file +305 -0

305 lines not on this page · raw message

Signature · 1 line
1.9.1
#2 lore raw

PATCH 1/3 regulator: pbias: Add PBIAS regulator for proper voltage switching on MMC1

Quoted 5 lines · Jean-Jacques Hiblot

In the TI SOCs a PBIAS cell exists to provide a bias voltage to the MMC1 IO cells. Without this bias voltage these I/O cells can not function properly. The PBIAS cell is controlled by software.

But a minor thing:

drivers/power/regulator/pbias_regulator.c line 203

Quoted 13 lines
drivers/power/regulator/pbias_regulator.c new file +13 -0
+	if (!*p) {
+#ifdef DEBUG
+		int i = 0;
+		const char *s;
+
+		debug("regulator ");
+		while ((s = fdt_stringlist_get(gd->fdt_blob, dev_of_offset(dev),
+				       "regulator-name", i++, NULL)))
+			debug("%s'%s' ", (i > 1) ? ", " : "", s);
+		debug("%s not supported\n", (i > 2) ? "are" : "is");
+#endif
+		return -EINVAL;
+	}

We should not need the DEBUG guard here as the string constants will get discarded with gcc-6.x (default min requirement starting in v2018.01) and a while(...) do nothing should get optimized away, and even if not, it's just the error case. I think we can stand clearer reading code here compared with a few extra bytes.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170712/f46b1999/attachment.sig>
#3 lore raw

PATCH 1/3 regulator: pbias: Add PBIAS regulator for proper voltage switching on MMC1

In reply to Jean-Jacques Hiblot

Hi,

Quoted 11 lines · Jean-Jacques Hiblot

In the TI SOCs a PBIAS cell exists to provide a bias voltage to the MMC1 IO cells. Without this bias voltage these I/O cells can not function properly. The PBIAS cell is controlled by software.

---
 drivers/power/regulator/Kconfig           |  10 +
 drivers/power/regulator/Makefile          |   1 +
 drivers/power/regulator/pbias_regulator.c | 305 ++++++++++++++++++++++++++++++
 3 files changed, 316 insertions(+)
 create mode 100644 drivers/power/regulator/pbias_regulator.c

But do I suggest using the dev_read() API instead of fdtdec for new code.

Regards,
Simon

#4 lore raw

PATCH 2/3 configs: dra7xx_evm: am57xx_evm: Enable DM_REGULATOR_PBIAS

In reply to Jean-Jacques Hiblot

This regulator is used for voltage switching on MMC1 IO lines.

---
 configs/am57xx_evm_defconfig | 3 +++
 configs/dra7xx_evm_defconfig | 1 +
 2 files changed, 4 insertions(+)
configs/am57xx_evm_defconfig +3 -0
index 658ab92..214fcc5 100644
@@ -40,6 +40,8 @@ CONFIG_SPL_OF_CONTROL=y
 CONFIG_OF_LIST="am57xx-beagle-x15 am57xx-beagle-x15-revb1 am572x-idk am571x-idk"
 CONFIG_DM=y
 CONFIG_SPL_DM=y
+CONFIG_REGMAP=y
+CONFIG_SYSCON=y
 # CONFIG_BLK is not set
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
@@ -55,6 +57,7 @@ CONFIG_DM_PMIC=y
 CONFIG_PMIC_PALMAS=y
 CONFIG_DM_REGULATOR=y
 CONFIG_DM_REGULATOR_PALMAS=y
+CONFIG_DM_REGULATOR_PBIAS=y
 CONFIG_DM_SERIAL=y
 CONFIG_SYS_NS16550=y
 CONFIG_DM_SPI=y
configs/dra7xx_evm_defconfig +1 -0
index 6dd1baf..ac80231 100644
@@ -67,6 +67,7 @@ CONFIG_DM_REGULATOR=y
 CONFIG_DM_REGULATOR_FIXED=y
 CONFIG_DM_REGULATOR_GPIO=y
 CONFIG_DM_REGULATOR_PALMAS=y
+CONFIG_DM_REGULATOR_PBIAS=y
 CONFIG_DM_REGULATOR_LP873X=y
 CONFIG_DM_SERIAL=y
 CONFIG_SYS_NS16550=y
Signature · 1 line
1.9.1
#5 lore raw

PATCH 2/3 configs: dra7xx_evm: am57xx_evm: Enable DM_REGULATOR_PBIAS

+ Andrew

Quoted 1 line · Jean-Jacques Hiblot

This regulator is used for voltage switching on MMC1 IO lines.

Can you enable on HS platforms as well.

Thanks and regards,
Lokesh

Quoted 41 lines
---
 configs/am57xx_evm_defconfig | 3 +++
 configs/dra7xx_evm_defconfig | 1 +
 2 files changed, 4 insertions(+)
configs/am57xx_evm_defconfig +3 -0
index 658ab92..214fcc5 100644
@@ -40,6 +40,8 @@ CONFIG_SPL_OF_CONTROL=y
 CONFIG_OF_LIST="am57xx-beagle-x15 am57xx-beagle-x15-revb1 am572x-idk am571x-idk"
 CONFIG_DM=y
 CONFIG_SPL_DM=y
+CONFIG_REGMAP=y
+CONFIG_SYSCON=y
 # CONFIG_BLK is not set
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
@@ -55,6 +57,7 @@ CONFIG_DM_PMIC=y
 CONFIG_PMIC_PALMAS=y
 CONFIG_DM_REGULATOR=y
 CONFIG_DM_REGULATOR_PALMAS=y
+CONFIG_DM_REGULATOR_PBIAS=y
 CONFIG_DM_SERIAL=y
 CONFIG_SYS_NS16550=y
 CONFIG_DM_SPI=y
configs/dra7xx_evm_defconfig +1 -0
index 6dd1baf..ac80231 100644
@@ -67,6 +67,7 @@ CONFIG_DM_REGULATOR=y
 CONFIG_DM_REGULATOR_FIXED=y
 CONFIG_DM_REGULATOR_GPIO=y
 CONFIG_DM_REGULATOR_PALMAS=y
+CONFIG_DM_REGULATOR_PBIAS=y
 CONFIG_DM_REGULATOR_LP873X=y
 CONFIG_DM_SERIAL=y
 CONFIG_SYS_NS16550=y
#6 lore raw

PATCH 2/3 configs: dra7xx_evm: am57xx_evm: Enable DM_REGULATOR_PBIAS

Quoted 6 lines · Lokesh Vutla

+ Andrew

Quoted 1 line · Jean-Jacques Hiblot

This regulator is used for voltage switching on MMC1 IO lines.

Can you enable on HS platforms as well.

Is this a SoC thing (which includes a strongly encouraged to use in designs) or a board choice (you really can expect to find custom boards that wouldn't want this) ? I'm asking because it sounds like perhaps we should be imply'ing somewhere instead so that HS and EVM and custom boards are in sync. Thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170712/f2024c32/attachment.sig>
#7 lore raw

PATCH 2/3 configs: dra7xx_evm: am57xx_evm: Enable DM_REGULATOR_PBIAS

Quoted 7 lines · Tom Rini
Quoted 5 lines · Lokesh Vutla

+ Andrew

Quoted 1 line · Jean-Jacques Hiblot

This regulator is used for voltage switching on MMC1 IO lines.

Quoted 8 lines
Quoted 1 line

Can you enable on HS platforms as well.

Is this a SoC thing (which includes a strongly encouraged to use in designs) or a board choice (you really can expect to find custom boards that wouldn't want this) ? I'm asking because it sounds like perhaps we should be imply'ing somewhere instead so that HS and EVM and custom boards are in sync. Thanks!

Regulators are a board choice. Yes, that makes sense. These can be implied for TARGET_DRA7XX_EVM.

Andrew do you have any objections with this?

Thanks and regards,
Lokesh

#8 lore raw

PATCH 2/3 configs: dra7xx_evm: am57xx_evm: Enable DM_REGULATOR_PBIAS

Quoted 19 lines · Lokesh Vutla
Quoted 7 lines · Tom Rini
Quoted 5 lines · Lokesh Vutla

+ Andrew

Quoted 1 line · Jean-Jacques Hiblot

This regulator is used for voltage switching on MMC1 IO lines.

Quoted 8 lines
Quoted 1 line

Can you enable on HS platforms as well.

Is this a SoC thing (which includes a strongly encouraged to use in designs) or a board choice (you really can expect to find custom boards that wouldn't want this) ? I'm asking because it sounds like perhaps we should be imply'ing somewhere instead so that HS and EVM and custom boards are in sync. Thanks!

Quoted 4 lines

Regulators are a board choice. Yes, that makes sense. These can be implied for TARGET_DRA7XX_EVM.

Andrew do you have any objections with this?

No objection. The more common stuff we can factor out of these defconfigs the better.

Andrew

Quoted 4 lines

Thanks and regards,
Lokesh

#9 lore raw

PATCH 2/3 configs: dra7xx_evm: am57xx_evm: Enable DM_REGULATOR_PBIAS

In reply to Lokesh Vutla
Quoted 12 lines · Lokesh Vutla
Quoted 9 lines · Tom Rini
Quoted 6 lines · Lokesh Vutla

+ Andrew

Quoted 1 line · Jean-Jacques Hiblot

This regulator is used for voltage switching on MMC1 IO lines.

Can you enable on HS platforms as well.

Quoted 8 lines
Quoted 5 lines

Is this a SoC thing (which includes a strongly encouraged to use in designs) or a board choice (you really can expect to find custom boards that wouldn't want this) ? I'm asking because it sounds like perhaps we should be imply'ing somewhere instead so that HS and EVM and custom boards are in sync. Thanks!

Regulators are a board choice. Yes, that makes sense. These can be implied for TARGET_DRA7XX_EVM.

And that's really true? I ask since I recall there's some SoCs where it's a lot more theoretical than practical to have a PMIC other than the one the EVM uses. But, yes, board level imply is the way to go then. The rule of thumb should be that if it's not really optional, the board or SoC should imply it if there's a reason to not have it, or select it if it's required.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170712/9ad20330/attachment-0001.sig>
#10 lore raw

PATCH 2/3 configs: dra7xx_evm: am57xx_evm: Enable DM_REGULATOR_PBIAS

Quoted 19 lines · Tom Rini
Quoted 18 lines · Lokesh Vutla
Quoted 14 lines · Tom Rini
Quoted 6 lines · Lokesh Vutla

+ Andrew

Quoted 1 line · Jean-Jacques Hiblot

This regulator is used for voltage switching on MMC1 IO lines.

Can you enable on HS platforms as well.

Is this a SoC thing (which includes a strongly encouraged to use in designs) or a board choice (you really can expect to find custom boards that wouldn't want this) ? I'm asking because it sounds like perhaps we should be imply'ing somewhere instead so that HS and EVM and custom boards are in sync. Thanks!

Quoted 5 lines
Quoted 2 lines

Regulators are a board choice. Yes, that makes sense. These can be implied for TARGET_DRA7XX_EVM.

And that's really true? I ask since I recall there's some SoCs where it's a lot more theoretical than practical to have a PMIC other than the

Well, it is still possible to use a different PMIC and I guess it is better to stick it that way.

Quoted 5 lines

one the EVM uses. But, yes, board level imply is the way to go then. The rule of thumb should be that if it's not really optional, the board or SoC should imply it if there's a reason to not have it, or select it if it's required.

Jean,
Can you repost the patch as Tom suggested?

Thanks and regards,
Lokesh

#11 lore raw

PATCH 2/3 configs: dra7xx_evm: am57xx_evm: Enable DM_REGULATOR_PBIAS

Quoted 17 lines · Lokesh Vutla
Quoted 15 lines · Tom Rini
Quoted 14 lines · Lokesh Vutla
Quoted 12 lines · Tom Rini
Quoted 5 lines · Lokesh Vutla

+ Andrew

Quoted 1 line · Jean-Jacques Hiblot

This regulator is used for voltage switching on MMC1 IO lines.

Can you enable on HS platforms as well.

Is this a SoC thing (which includes a strongly encouraged to use in designs) or a board choice (you really can expect to find custom boards that wouldn't want this) ? I'm asking because it sounds like perhaps we should be imply'ing somewhere instead so that HS and EVM and custom boards are in sync. Thanks!

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

Regulators are a board choice. Yes, that makes sense. These can be implied for TARGET_DRA7XX_EVM.

And that's really true? I ask since I recall there's some SoCs where it's a lot more theoretical than practical to have a PMIC other than the

Well, it is still possible to use a different PMIC and I guess it is better to stick it that way.

PBIAS is not board specific, it's in the SOC. I should probably make the hsmmc select it automatically when using DM_MMC and DM_REGULATOR.

Quoted 13 lines
Quoted 6 lines

one the EVM uses. But, yes, board level imply is the way to go then. The rule of thumb should be that if it's not really optional, the board or SoC should imply it if there's a reason to not have it, or select it if it's required.

Jean,
Can you repost the patch as Tom suggested?

Thanks and regards,
Lokesh

#12 lore raw

PATCH 3/3 dm: syscon: scan sub-nodes of the syscon node

In reply to Jean-Jacques Hiblot

This allow to probe devices that are defined under a syscon node

---
 drivers/core/syscon-uclass.c | 1 +
 1 file changed, 1 insertion(+)
drivers/core/syscon-uclass.c +1 -0
index 2148469..b06ca6a 100644
@@ -104,5 +104,6 @@ static const struct udevice_id generic_syscon_ids[] = {
 U_BOOT_DRIVER(generic_syscon) = {
 	.name	= "syscon",
 	.id	= UCLASS_SYSCON,
+	.bind           = dm_scan_fdt_dev,
 	.of_match = generic_syscon_ids,
 };
Signature · 1 line
1.9.1