All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 0/2] power: palmas: Allow changing the voltage of LDO1
@ 2017-07-12  9:42 Jean-Jacques Hiblot
  2017-07-12  9:42 ` [U-Boot] [PATCH 1/2] regulator: palmas: Add support for LDO1 regulator to provide 1.8V Jean-Jacques Hiblot
  2017-07-12  9:42 ` [U-Boot] [PATCH 2/2] regulator: palmas: disable bypass when the LDO is enabled Jean-Jacques Hiblot
  0 siblings, 2 replies; 8+ messages in thread
From: Jean-Jacques Hiblot @ 2017-07-12  9:42 UTC (permalink / raw)
  To: u-boot

This will be required by the hsmmc driver to support UHS modes. UHS modes only
work with 1.8v not 3.0v or 3.3v.

Jean-Jacques Hiblot (1):
  regulator: palmas: disable bypass when the LDO is enabled

Kishon Vijay Abraham I (1):
  regulator: palmas: Add support for LDO1 regulator to provide 1.8V

 drivers/power/palmas.c                     |  5 ++---
 drivers/power/regulator/palmas_regulator.c | 36 ++++++++++++++++++++++++++++++
 include/power/palmas.h                     |  1 +
 3 files changed, 39 insertions(+), 3 deletions(-)

-- 
1.9.1

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

* [U-Boot] [PATCH 1/2] regulator: palmas: Add support for LDO1 regulator to provide 1.8V
  2017-07-12  9:42 [U-Boot] [PATCH 0/2] power: palmas: Allow changing the voltage of LDO1 Jean-Jacques Hiblot
@ 2017-07-12  9:42 ` Jean-Jacques Hiblot
  2017-07-12 17:31   ` Tom Rini
       [not found]   ` <CGME20170728125351epcas1p180185a03f084270211486a856a097b1a@epcas1p1.samsung.com>
  2017-07-12  9:42 ` [U-Boot] [PATCH 2/2] regulator: palmas: disable bypass when the LDO is enabled Jean-Jacques Hiblot
  1 sibling, 2 replies; 8+ messages in thread
From: Jean-Jacques Hiblot @ 2017-07-12  9:42 UTC (permalink / raw)
  To: u-boot

From: Kishon Vijay Abraham I <kishon@ti.com>

Modify palmas_mmc1_poweron_ldo() API to set the voltage based on the
voltage parameter passed as argument instead of always setting it to
3.0V. This allows MMC1 to set the LDO1 regulator voltage to 3.3V or 1.8V.
1.8V is required to add support for UHS mode.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
---
 drivers/power/palmas.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/power/palmas.c b/drivers/power/palmas.c
index c813b21..4e98959 100644
--- a/drivers/power/palmas.c
+++ b/drivers/power/palmas.c
@@ -50,10 +50,9 @@ int palmas_mmc1_poweron_ldo(uint voltage)
 	int ret;
 	/*
 	 * Currently valid for the dra7xx_evm board:
-	 * Set TPS659038 LDO1 to 3.0 V
+	 * Set TPS659038 LDO1 to 3.0 V or 1.8V
 	 */
-	val = LDO_VOLT_3V0;
-	ret = palmas_i2c_write_u8(TPS65903X_CHIP_P1, LDO1_VOLTAGE, val);
+	ret = palmas_i2c_write_u8(TPS65903X_CHIP_P1, LDO1_VOLTAGE, voltage);
 	if (ret) {
 		printf("tps65903x: could not set LDO1 voltage.\n");
 		return ret;
-- 
1.9.1

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

* [U-Boot] [PATCH 2/2] regulator: palmas: disable bypass when the LDO is enabled
  2017-07-12  9:42 [U-Boot] [PATCH 0/2] power: palmas: Allow changing the voltage of LDO1 Jean-Jacques Hiblot
  2017-07-12  9:42 ` [U-Boot] [PATCH 1/2] regulator: palmas: Add support for LDO1 regulator to provide 1.8V Jean-Jacques Hiblot
@ 2017-07-12  9:42 ` Jean-Jacques Hiblot
  2017-07-12 10:22   ` Keerthy
                     ` (2 more replies)
  1 sibling, 3 replies; 8+ messages in thread
From: Jean-Jacques Hiblot @ 2017-07-12  9:42 UTC (permalink / raw)
  To: u-boot

Some LDOs have a bypass capability. Make sure that the bypass is disabled
when is the LDO is enabled (otherwise the voltage can't be changed).

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
---
 drivers/power/regulator/palmas_regulator.c | 36 ++++++++++++++++++++++++++++++
 include/power/palmas.h                     |  1 +
 2 files changed, 37 insertions(+)

diff --git a/drivers/power/regulator/palmas_regulator.c b/drivers/power/regulator/palmas_regulator.c
index 99614b0..24a7977 100644
--- a/drivers/power/regulator/palmas_regulator.c
+++ b/drivers/power/regulator/palmas_regulator.c
@@ -163,6 +163,38 @@ static int palmas_smps_val(struct udevice *dev, int op, int *uV)
 	return pmic_reg_write(dev->parent, adr, ret);
 }
 
+static int palmas_ldo_bypass_enable(struct udevice *dev, bool enabled)
+{
+	int type = dev_get_driver_data(dev_get_parent(dev));
+	struct dm_regulator_uclass_platdata *p;
+	unsigned int adr;
+	int reg;
+
+	if (type == TPS65917) {
+		/* bypass available only on LDO1 and LDO2 */
+		if (dev->driver_data > 2)
+			return -ENOTSUPP;
+	} else if (type == TPS659038) {
+		/* bypass available only on LDO9 */
+		if (dev->driver_data != 9)
+			return -ENOTSUPP;
+	}
+
+	p = dev_get_uclass_platdata(dev);
+	adr = p->ctrl_reg;
+
+	reg = pmic_reg_read(dev->parent, adr);
+	if (reg < 0)
+		return reg;
+
+	if (enabled)
+		reg |= PALMAS_LDO_BYPASS_EN;
+	else
+		reg &= ~PALMAS_LDO_BYPASS_EN;
+
+	return pmic_reg_write(dev->parent, adr, reg);
+}
+
 static int palmas_ldo_enable(struct udevice *dev, int op, bool *enable)
 {
 	int ret;
@@ -194,6 +226,10 @@ static int palmas_ldo_enable(struct udevice *dev, int op, bool *enable)
 		ret = pmic_reg_write(dev->parent, adr, ret);
 		if (ret)
 			return ret;
+
+		ret = palmas_ldo_bypass_enable(dev, false);
+		if (ret && (ret != -ENOTSUPP))
+			return ret;
 	}
 
 	return 0;
diff --git a/include/power/palmas.h b/include/power/palmas.h
index bad5a35..df5f15c 100644
--- a/include/power/palmas.h
+++ b/include/power/palmas.h
@@ -23,3 +23,4 @@
 #define PALMAS_LDO_VOLT_MAX     3300000
 #define PALMAS_LDO_MODE_MASK	0x1
 #define PALMAS_LDO_STATUS_MASK	0x10
+#define PALMAS_LDO_BYPASS_EN	0x40
-- 
1.9.1

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

* [U-Boot] [PATCH 2/2] regulator: palmas: disable bypass when the LDO is enabled
  2017-07-12  9:42 ` [U-Boot] [PATCH 2/2] regulator: palmas: disable bypass when the LDO is enabled Jean-Jacques Hiblot
@ 2017-07-12 10:22   ` Keerthy
  2017-07-12 17:31   ` Tom Rini
       [not found]   ` <CGME20170728125411epcas1p4a5fa2ee87f338a567f3bdf7e281bf452@epcas1p4.samsung.com>
  2 siblings, 0 replies; 8+ messages in thread
From: Keerthy @ 2017-07-12 10:22 UTC (permalink / raw)
  To: u-boot



On Wednesday 12 July 2017 03:12 PM, Jean-Jacques Hiblot wrote:
> Some LDOs have a bypass capability. Make sure that the bypass is disabled
> when is the LDO is enabled (otherwise the voltage can't be changed).

Reviewed-by: Keerthy <j-keerthy@ti.com>

> 
> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
> ---
>  drivers/power/regulator/palmas_regulator.c | 36 ++++++++++++++++++++++++++++++
>  include/power/palmas.h                     |  1 +
>  2 files changed, 37 insertions(+)
> 
> diff --git a/drivers/power/regulator/palmas_regulator.c b/drivers/power/regulator/palmas_regulator.c
> index 99614b0..24a7977 100644
> --- a/drivers/power/regulator/palmas_regulator.c
> +++ b/drivers/power/regulator/palmas_regulator.c
> @@ -163,6 +163,38 @@ static int palmas_smps_val(struct udevice *dev, int op, int *uV)
>  	return pmic_reg_write(dev->parent, adr, ret);
>  }
>  
> +static int palmas_ldo_bypass_enable(struct udevice *dev, bool enabled)
> +{
> +	int type = dev_get_driver_data(dev_get_parent(dev));
> +	struct dm_regulator_uclass_platdata *p;
> +	unsigned int adr;
> +	int reg;
> +
> +	if (type == TPS65917) {
> +		/* bypass available only on LDO1 and LDO2 */
> +		if (dev->driver_data > 2)
> +			return -ENOTSUPP;
> +	} else if (type == TPS659038) {
> +		/* bypass available only on LDO9 */
> +		if (dev->driver_data != 9)
> +			return -ENOTSUPP;
> +	}
> +
> +	p = dev_get_uclass_platdata(dev);
> +	adr = p->ctrl_reg;
> +
> +	reg = pmic_reg_read(dev->parent, adr);
> +	if (reg < 0)
> +		return reg;
> +
> +	if (enabled)
> +		reg |= PALMAS_LDO_BYPASS_EN;
> +	else
> +		reg &= ~PALMAS_LDO_BYPASS_EN;
> +
> +	return pmic_reg_write(dev->parent, adr, reg);
> +}
> +
>  static int palmas_ldo_enable(struct udevice *dev, int op, bool *enable)
>  {
>  	int ret;
> @@ -194,6 +226,10 @@ static int palmas_ldo_enable(struct udevice *dev, int op, bool *enable)
>  		ret = pmic_reg_write(dev->parent, adr, ret);
>  		if (ret)
>  			return ret;
> +
> +		ret = palmas_ldo_bypass_enable(dev, false);
> +		if (ret && (ret != -ENOTSUPP))
> +			return ret;
>  	}
>  
>  	return 0;
> diff --git a/include/power/palmas.h b/include/power/palmas.h
> index bad5a35..df5f15c 100644
> --- a/include/power/palmas.h
> +++ b/include/power/palmas.h
> @@ -23,3 +23,4 @@
>  #define PALMAS_LDO_VOLT_MAX     3300000
>  #define PALMAS_LDO_MODE_MASK	0x1
>  #define PALMAS_LDO_STATUS_MASK	0x10
> +#define PALMAS_LDO_BYPASS_EN	0x40
> 

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

* [U-Boot] [PATCH 1/2] regulator: palmas: Add support for LDO1 regulator to provide 1.8V
  2017-07-12  9:42 ` [U-Boot] [PATCH 1/2] regulator: palmas: Add support for LDO1 regulator to provide 1.8V Jean-Jacques Hiblot
@ 2017-07-12 17:31   ` Tom Rini
       [not found]   ` <CGME20170728125351epcas1p180185a03f084270211486a856a097b1a@epcas1p1.samsung.com>
  1 sibling, 0 replies; 8+ messages in thread
From: Tom Rini @ 2017-07-12 17:31 UTC (permalink / raw)
  To: u-boot

On Wed, Jul 12, 2017 at 11:42:46AM +0200, Jean-Jacques Hiblot wrote:

> From: Kishon Vijay Abraham I <kishon@ti.com>
> 
> Modify palmas_mmc1_poweron_ldo() API to set the voltage based on the
> voltage parameter passed as argument instead of always setting it to
> 3.0V. This allows MMC1 to set the LDO1 regulator voltage to 3.3V or 1.8V.
> 1.8V is required to add support for UHS mode.
> 
> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>

Reviewed-by: Tom Rini <trini@konsulko.com>

-- 
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/be0e2d94/attachment.sig>

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

* [U-Boot] [PATCH 2/2] regulator: palmas: disable bypass when the LDO is enabled
  2017-07-12  9:42 ` [U-Boot] [PATCH 2/2] regulator: palmas: disable bypass when the LDO is enabled Jean-Jacques Hiblot
  2017-07-12 10:22   ` Keerthy
@ 2017-07-12 17:31   ` Tom Rini
       [not found]   ` <CGME20170728125411epcas1p4a5fa2ee87f338a567f3bdf7e281bf452@epcas1p4.samsung.com>
  2 siblings, 0 replies; 8+ messages in thread
From: Tom Rini @ 2017-07-12 17:31 UTC (permalink / raw)
  To: u-boot

On Wed, Jul 12, 2017 at 11:42:47AM +0200, Jean-Jacques Hiblot wrote:

> Some LDOs have a bypass capability. Make sure that the bypass is disabled
> when is the LDO is enabled (otherwise the voltage can't be changed).
> 
> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>

Reviewed-by: Tom Rini <trini@konsulko.com>

-- 
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/ecdd8481/attachment.sig>

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

* [U-Boot] [U-Boot, 1/2] regulator: palmas: Add support for LDO1 regulator to provide 1.8V
       [not found]   ` <CGME20170728125351epcas1p180185a03f084270211486a856a097b1a@epcas1p1.samsung.com>
@ 2017-07-28 12:53     ` Jaehoon Chung
  0 siblings, 0 replies; 8+ messages in thread
From: Jaehoon Chung @ 2017-07-28 12:53 UTC (permalink / raw)
  To: u-boot

Hi,

On 07/12/2017 06:42 PM, Jean-Jacques Hiblot wrote:
> From: Kishon Vijay Abraham I <kishon@ti.com>
> 
> Modify palmas_mmc1_poweron_ldo() API to set the voltage based on the
> voltage parameter passed as argument instead of always setting it to
> 3.0V. This allows MMC1 to set the LDO1 regulator voltage to 3.3V or 1.8V.
> 1.8V is required to add support for UHS mode.
> 
> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
> Reviewed-by: Tom Rini <trini@konsulko.com>

Applied to u-boot-mmc for pmic! Thanks!

Best Regards,
Jaehoon Chung

> ---
>  drivers/power/palmas.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/power/palmas.c b/drivers/power/palmas.c
> index c813b21..4e98959 100644
> --- a/drivers/power/palmas.c
> +++ b/drivers/power/palmas.c
> @@ -50,10 +50,9 @@ int palmas_mmc1_poweron_ldo(uint voltage)
>  	int ret;
>  	/*
>  	 * Currently valid for the dra7xx_evm board:
> -	 * Set TPS659038 LDO1 to 3.0 V
> +	 * Set TPS659038 LDO1 to 3.0 V or 1.8V
>  	 */
> -	val = LDO_VOLT_3V0;
> -	ret = palmas_i2c_write_u8(TPS65903X_CHIP_P1, LDO1_VOLTAGE, val);
> +	ret = palmas_i2c_write_u8(TPS65903X_CHIP_P1, LDO1_VOLTAGE, voltage);
>  	if (ret) {
>  		printf("tps65903x: could not set LDO1 voltage.\n");
>  		return ret;
> 

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

* [U-Boot] [U-Boot, 2/2] regulator: palmas: disable bypass when the LDO is enabled
       [not found]   ` <CGME20170728125411epcas1p4a5fa2ee87f338a567f3bdf7e281bf452@epcas1p4.samsung.com>
@ 2017-07-28 12:54     ` Jaehoon Chung
  0 siblings, 0 replies; 8+ messages in thread
From: Jaehoon Chung @ 2017-07-28 12:54 UTC (permalink / raw)
  To: u-boot

On 07/12/2017 06:42 PM, Jean-Jacques Hiblot wrote:
> Some LDOs have a bypass capability. Make sure that the bypass is disabled
> when is the LDO is enabled (otherwise the voltage can't be changed).
> 
> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
> Reviewed-by: Keerthy <j-keerthy@ti.com>
> Reviewed-by: Tom Rini <trini@konsulko.com>

Applied to u-boot-mmc for pmic. Thanks!

Best Regards,
Jaehoon Chung

> ---
>  drivers/power/regulator/palmas_regulator.c | 36 ++++++++++++++++++++++++++++++
>  include/power/palmas.h                     |  1 +
>  2 files changed, 37 insertions(+)
> 
> diff --git a/drivers/power/regulator/palmas_regulator.c b/drivers/power/regulator/palmas_regulator.c
> index 99614b0..24a7977 100644
> --- a/drivers/power/regulator/palmas_regulator.c
> +++ b/drivers/power/regulator/palmas_regulator.c
> @@ -163,6 +163,38 @@ static int palmas_smps_val(struct udevice *dev, int op, int *uV)
>  	return pmic_reg_write(dev->parent, adr, ret);
>  }
>  
> +static int palmas_ldo_bypass_enable(struct udevice *dev, bool enabled)
> +{
> +	int type = dev_get_driver_data(dev_get_parent(dev));
> +	struct dm_regulator_uclass_platdata *p;
> +	unsigned int adr;
> +	int reg;
> +
> +	if (type == TPS65917) {
> +		/* bypass available only on LDO1 and LDO2 */
> +		if (dev->driver_data > 2)
> +			return -ENOTSUPP;
> +	} else if (type == TPS659038) {
> +		/* bypass available only on LDO9 */
> +		if (dev->driver_data != 9)
> +			return -ENOTSUPP;
> +	}
> +
> +	p = dev_get_uclass_platdata(dev);
> +	adr = p->ctrl_reg;
> +
> +	reg = pmic_reg_read(dev->parent, adr);
> +	if (reg < 0)
> +		return reg;
> +
> +	if (enabled)
> +		reg |= PALMAS_LDO_BYPASS_EN;
> +	else
> +		reg &= ~PALMAS_LDO_BYPASS_EN;
> +
> +	return pmic_reg_write(dev->parent, adr, reg);
> +}
> +
>  static int palmas_ldo_enable(struct udevice *dev, int op, bool *enable)
>  {
>  	int ret;
> @@ -194,6 +226,10 @@ static int palmas_ldo_enable(struct udevice *dev, int op, bool *enable)
>  		ret = pmic_reg_write(dev->parent, adr, ret);
>  		if (ret)
>  			return ret;
> +
> +		ret = palmas_ldo_bypass_enable(dev, false);
> +		if (ret && (ret != -ENOTSUPP))
> +			return ret;
>  	}
>  
>  	return 0;
> diff --git a/include/power/palmas.h b/include/power/palmas.h
> index bad5a35..df5f15c 100644
> --- a/include/power/palmas.h
> +++ b/include/power/palmas.h
> @@ -23,3 +23,4 @@
>  #define PALMAS_LDO_VOLT_MAX     3300000
>  #define PALMAS_LDO_MODE_MASK	0x1
>  #define PALMAS_LDO_STATUS_MASK	0x10
> +#define PALMAS_LDO_BYPASS_EN	0x40
> 

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

end of thread, other threads:[~2017-07-28 12:54 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-12  9:42 [U-Boot] [PATCH 0/2] power: palmas: Allow changing the voltage of LDO1 Jean-Jacques Hiblot
2017-07-12  9:42 ` [U-Boot] [PATCH 1/2] regulator: palmas: Add support for LDO1 regulator to provide 1.8V Jean-Jacques Hiblot
2017-07-12 17:31   ` Tom Rini
     [not found]   ` <CGME20170728125351epcas1p180185a03f084270211486a856a097b1a@epcas1p1.samsung.com>
2017-07-28 12:53     ` [U-Boot] [U-Boot, " Jaehoon Chung
2017-07-12  9:42 ` [U-Boot] [PATCH 2/2] regulator: palmas: disable bypass when the LDO is enabled Jean-Jacques Hiblot
2017-07-12 10:22   ` Keerthy
2017-07-12 17:31   ` Tom Rini
     [not found]   ` <CGME20170728125411epcas1p4a5fa2ee87f338a567f3bdf7e281bf452@epcas1p4.samsung.com>
2017-07-28 12:54     ` [U-Boot] [U-Boot, " Jaehoon Chung

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.