Skip to contentSkip to conversation

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

PATCH New Jean-Jacques Hiblot 3 participants 5 messages Sep 21, 2017 – Sep 25, 2017 MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

v3 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 adds 2 functions to the DM core: to count strings in a stringlist and get a string from a stringlist based on its position in the list.
The second patch implements the support for this PBIAS cell as a regulator driver.

Jean-Jacques

changes since v2:
* rebased on u-boot/master
* automatically select REGMAP and SYSCON if PBIAS is selected.

changes since v1:
- add new functions to get strings from a stringlist in DM core
- use the dev_read_*() API to access the DT
- automatically select the PBIAS driver if DM_REGULATOR, DM_MMC and MMC_OMAP_HS are set.
- removed the patch touching the DRA7 and AM57 config files.

Jean-Jacques Hiblot (2):
dm: core: Add functions to get strings and the string count from a
stringlist
regulator: pbias: Add PBIAS regulator for proper voltage switching on
MMC1

 drivers/core/read.c                       |  11 ++
 drivers/mmc/Kconfig                       |   1 +
 drivers/power/regulator/Kconfig           |  13 ++
 drivers/power/regulator/Makefile          |   1 +
 drivers/power/regulator/pbias_regulator.c | 301 ++++++++++++++++++++++++++++++
 include/dm/read.h                         |  36 ++++
 6 files changed, 363 insertions(+)
 create mode 100644 drivers/power/regulator/pbias_regulator.c
Signature · 1 line
1.9.1
#1 lore raw

PATCH v3 1/2 dm: core: Add functions to get strings and the string count from a stringlist

dev_read_string_count() is used to get the number of strings in a stringlist.
dev_read_string_index() is used to get a string in the stringlist based on its position in the list.

---
 drivers/core/read.c | 11 +++++++++++
 include/dm/read.h   | 36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 47 insertions(+)
drivers/core/read.c +11 -0
index 065589a..eacf171 100644
@@ -81,6 +81,17 @@ int dev_read_stringlist_search(struct udevice *dev, const char *property,
 	return ofnode_stringlist_search(dev_ofnode(dev), property, string);
 }
 
+int dev_read_string_index(struct udevice *dev, const char *propname, int index,
+			  const char **outp)
+{
+	return ofnode_read_string_index(dev_ofnode(dev), propname, index, outp);
+}
+
+int dev_read_string_count(struct udevice *dev, const char *propname)
+{
+	return ofnode_read_string_count(dev_ofnode(dev), propname);
+}
+
 int dev_read_phandle_with_args(struct udevice *dev, const char *list_name,
 				const char *cells_name, int cell_count,
 				int index,
include/dm/read.h +36 -0
index e7f7125..8114037 100644
@@ -166,6 +166,29 @@ int dev_read_stringlist_search(struct udevice *dev, const char *property,
 			  const char *string);
 
 /**
+ * dev_read_string_index() - obtain an indexed string from a string list
+ *
+ * @dev: device to examine
+ * @propname: name of the property containing the string list
+ * @index: index of the string to return
+ * @out: return location for the string
+ *
+ * @return:
+ *   length of string, if found or -ve error value if not found
+ */
+int dev_read_string_index(struct udevice *dev, const char *propname, int index,
+			  const char **outp);
+
+/**
+ * dev_read_string_count() - find the number of strings in a string list
+ *
+ * @dev: device to examine
+ * @propname: name of the property containing the string list
+ * @return:
+ *   number of strings in the list, or -ve error value if not found
+ */
+int dev_read_string_count(struct udevice *dev, const char *propname);
+/**
  * dev_read_phandle_with_args() - Find a node pointed by phandle in a list
  *
  * This function is useful to parse lists of phandles and their arguments.
@@ -451,6 +474,19 @@ static inline int dev_read_stringlist_search(struct udevice *dev,
 	return ofnode_stringlist_search(dev_ofnode(dev), propname, string);
 }
 
+static inline int dev_read_string_index(struct udevice *dev,
+					const char *propname, int index,
+					const char **outp)
+{
+	return ofnode_read_string_index(dev_ofnode(dev), propname, index, outp);
+}
+
+static inline int dev_read_string_count(struct udevice *dev,
+					const char *propname)
+{
+	return ofnode_read_string_count(dev_ofnode(dev), propname);
+}
+
 static inline int dev_read_phandle_with_args(struct udevice *dev,
 		const char *list_name, const char *cells_name, int cell_count,
 		int index, struct ofnode_phandle_args *out_args)
Signature · 1 line
1.9.1
#2 lore raw

PATCH v3 1/2 dm: core: Add functions to get strings and the string count from a stringlist

Hi Jean-Jacques,

Quoted 10 lines · Jean-Jacques Hiblot

dev_read_string_count() is used to get the number of strings in a stringlist.
dev_read_string_index() is used to get a string in the stringlist based on its position in the list.

---
 drivers/core/read.c | 11 +++++++++++
 include/dm/read.h   | 36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 47 insertions(+)

This is marked v3 but I don't see a change log.

Regards,
Simon

#3 lore raw

PATCH v3 2/2 regulator: pbias: Add PBIAS regulator for proper voltage switching on MMC1

In reply to 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/mmc/Kconfig                       |   1 +
 drivers/power/regulator/Kconfig           |  13 ++
 drivers/power/regulator/Makefile          |   1 +
 drivers/power/regulator/pbias_regulator.c | 301 ++++++++++++++++++++++++++++++
 4 files changed, 316 insertions(+)
 create mode 100644 drivers/power/regulator/pbias_regulator.c
drivers/mmc/Kconfig +1 -0
index 78e58d4..4b9bee0 100644
@@ -159,6 +159,7 @@ config MMC_PCI
 config MMC_OMAP_HS
 	bool "TI OMAP High Speed Multimedia Card Interface support"
 	select DM_REGULATOR_PBIAS if DM_MMC && DM_REGULATOR
+	select DM_REGULATOR_PBIAS if DM_MMC && DM_REGULATOR
 	help
 	  This selects the TI OMAP High Speed Multimedia card Interface.
 	  If you have an omap2plus board with a Multimedia Card slot,
drivers/power/regulator/Kconfig +13 -0
index c82a936..2cfade1 100644
@@ -151,6 +151,19 @@ 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"
+	depends on DM_REGULATOR
+	select REGMAP
+	select SYSCON
+	---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 18fb870..6c149a9 100644
@@ -18,5 +18,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 +301 -0

301 lines not on this page · raw message

Signature · 1 line
1.9.1
#4 lore raw

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

In reply to Jean-Jacques Hiblot
Quoted 9 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. This bias voltage is either 1.8v or 3.0v.

The first patch adds 2 functions to the DM core: to count strings in a stringlist and get a string from a stringlist based on its position in the list.
The second patch implements the support for this PBIAS cell as a regulator driver.

Applied to u-boot-mmc for pmic.

Best Regards,
Jaehoon Chung

Quoted 31 lines

Jean-Jacques

changes since v2:
* rebased on u-boot/master
* automatically select REGMAP and SYSCON if PBIAS is selected.

changes since v1:
- add new functions to get strings from a stringlist in DM core
- use the dev_read_*() API to access the DT
- automatically select the PBIAS driver if DM_REGULATOR, DM_MMC and MMC_OMAP_HS are set.
- removed the patch touching the DRA7 and AM57 config files.

Jean-Jacques Hiblot (2):
dm: core: Add functions to get strings and the string count from a
stringlist
regulator: pbias: Add PBIAS regulator for proper voltage switching on
MMC1

 drivers/core/read.c                       |  11 ++
 drivers/mmc/Kconfig                       |   1 +
 drivers/power/regulator/Kconfig           |  13 ++
 drivers/power/regulator/Makefile          |   1 +
 drivers/power/regulator/pbias_regulator.c | 301 ++++++++++++++++++++++++++++++
 include/dm/read.h                         |  36 ++++
 6 files changed, 363 insertions(+)
 create mode 100644 drivers/power/regulator/pbias_regulator.c