Re: [U-Boot] [U-Boot, v3] regulator: pbias: Add PBIAS regulator for proper voltage switching on MMC1
Dear JJ, On 08/07/2017 06:43 PM, Jean-Jacques Hiblot wrote: > 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. > > Signed-off-by: Jean-Jacques Hiblot> Reviewed-by: Tom Rini > Reviewed-by: Simon Glass There is an error.. arm: + am57xx_evm +drivers/power/regulator/built-in.o: In function `pbias_regulator_probe': +drivers/power/regulator/pbias_regulator.c:196: undefined reference to `dev_read_string_index' i didn't find the dev_read_string_index()..Is there any patch? Best Regards, Jaehoon Chung > --- > > Hi Jaehoon, > > Here is the patch for the PBIAS regulator. I modified the KConfig to select > the REGMAP and SYSCON features as you suggested. > Thanks. > JJ > > changes since v2: > - automatically select REGMAP and SYSCON if PBIAS is selected. > > changes since v1: > - automatically select the PBIAS driver if DM_REGULATOR, DM_MMC and > MMC_OMAP_HS are set > - use the dev_read_*() API to access the DT > > > drivers/mmc/Kconfig | 1 + > drivers/power/regulator/Kconfig | 13 ++ > drivers/power/regulator/Makefile | 1 + > drivers/power/regulator/pbias_regulator.c | 302 > ++ > 4 files changed, 317 insertions(+) > create mode 100644 drivers/power/regulator/pbias_regulator.c > > diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig > index 588e118..63e1122 100644 > --- a/drivers/mmc/Kconfig > +++ b/drivers/mmc/Kconfig > @@ -158,6 +158,7 @@ config MMC_PCI > config MMC_OMAP_HS > bool "TI OMAP High Speed Multimedia Card Interface support" > select DM_MMC_OPS if DM_MMC > + 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, > diff --git a/drivers/power/regulator/Kconfig b/drivers/power/regulator/Kconfig > index f213487..cb5ea08 100644 > --- a/drivers/power/regulator/Kconfig > +++ b/drivers/power/regulator/Kconfig > @@ -142,6 +142,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 > diff --git a/drivers/power/regulator/Makefile > b/drivers/power/regulator/Makefile > index ce14d08..75d611a 100644 > --- a/drivers/power/regulator/Makefile > +++ b/drivers/power/regulator/Makefile > @@ -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 > diff --git a/drivers/power/regulator/pbias_regulator.c > b/drivers/power/regulator/pbias_regulator.c > new file mode 100644 > index 000..303eca9 > --- /dev/null > +++ b/drivers/power/regulator/pbias_regulator.c > @@ -0,0 +1,302 @@ > +/* > + * (C) Copyright 2016 Texas Instruments Incorporated, > + * Jean-Jacques Hiblot > + * > + * SPDX-License-Identifier: GPL-2.0+ > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +DECLARE_GLOBAL_DATA_PTR; > + > +struct pbias_reg_info { > + u32 enable; > + u32 enable_mask; > + u32 disable_val; > + u32 vmode; > + unsigned int enable_time; > + char *name; > +}; > + > +struct pbias_priv { > + struct regmap *regmap; > + int offset; > +}; > + > +static const struct pmic_child_info pmic_children_info[] = { > + { .prefix = "pbias", .driver = "pbias_regulator"}, > + { }, > +}; > + > +static int pbias_write(struct udevice *dev, uint reg, const uint8_t *buff, > + int len) > +{ > + struct pbias_priv *priv = dev_get_priv(dev); > + uint32_t val = *(uint32_t *)buff; > + > + if (len != 4) > + return -EINVAL; > + > + return
Re: [U-Boot] [U-Boot, v3] regulator: pbias: Add PBIAS regulator for proper voltage switching on MMC1
On 08/07/2017 06:43 PM, Jean-Jacques Hiblot wrote: > 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. > > Signed-off-by: Jean-Jacques Hiblot> Reviewed-by: Tom Rini > Reviewed-by: Simon Glass Applied to u-boot-mmc! Sorry for late. Best Regards, Jaehoon Chung > --- > > Hi Jaehoon, > > Here is the patch for the PBIAS regulator. I modified the KConfig to select > the REGMAP and SYSCON features as you suggested. > Thanks. > JJ > > changes since v2: > - automatically select REGMAP and SYSCON if PBIAS is selected. > > changes since v1: > - automatically select the PBIAS driver if DM_REGULATOR, DM_MMC and > MMC_OMAP_HS are set > - use the dev_read_*() API to access the DT > > > drivers/mmc/Kconfig | 1 + > drivers/power/regulator/Kconfig | 13 ++ > drivers/power/regulator/Makefile | 1 + > drivers/power/regulator/pbias_regulator.c | 302 > ++ > 4 files changed, 317 insertions(+) > create mode 100644 drivers/power/regulator/pbias_regulator.c > > diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig > index 588e118..63e1122 100644 > --- a/drivers/mmc/Kconfig > +++ b/drivers/mmc/Kconfig > @@ -158,6 +158,7 @@ config MMC_PCI > config MMC_OMAP_HS > bool "TI OMAP High Speed Multimedia Card Interface support" > select DM_MMC_OPS if DM_MMC > + 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, > diff --git a/drivers/power/regulator/Kconfig b/drivers/power/regulator/Kconfig > index f213487..cb5ea08 100644 > --- a/drivers/power/regulator/Kconfig > +++ b/drivers/power/regulator/Kconfig > @@ -142,6 +142,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 > diff --git a/drivers/power/regulator/Makefile > b/drivers/power/regulator/Makefile > index ce14d08..75d611a 100644 > --- a/drivers/power/regulator/Makefile > +++ b/drivers/power/regulator/Makefile > @@ -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 > diff --git a/drivers/power/regulator/pbias_regulator.c > b/drivers/power/regulator/pbias_regulator.c > new file mode 100644 > index 000..303eca9 > --- /dev/null > +++ b/drivers/power/regulator/pbias_regulator.c > @@ -0,0 +1,302 @@ > +/* > + * (C) Copyright 2016 Texas Instruments Incorporated, > + * Jean-Jacques Hiblot > + * > + * SPDX-License-Identifier: GPL-2.0+ > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +DECLARE_GLOBAL_DATA_PTR; > + > +struct pbias_reg_info { > + u32 enable; > + u32 enable_mask; > + u32 disable_val; > + u32 vmode; > + unsigned int enable_time; > + char *name; > +}; > + > +struct pbias_priv { > + struct regmap *regmap; > + int offset; > +}; > + > +static const struct pmic_child_info pmic_children_info[] = { > + { .prefix = "pbias", .driver = "pbias_regulator"}, > + { }, > +}; > + > +static int pbias_write(struct udevice *dev, uint reg, const uint8_t *buff, > + int len) > +{ > + struct pbias_priv *priv = dev_get_priv(dev); > + uint32_t val = *(uint32_t *)buff; > + > + if (len != 4) > + return -EINVAL; > + > + return regmap_write(priv->regmap, priv->offset, val); > +} > + > +static int pbias_read(struct udevice *dev, uint reg, uint8_t *buff, int len) > +{ > + struct pbias_priv *priv = dev_get_priv(dev); > + > + if (len != 4) > + return -EINVAL;