[U-Boot] [PATCH 1/4] rockchip: dts: correct vdd_log setting for firefly-rk3399

Add regulator-init-microvolt for driver to init the regulator, and the min output value is not 800000mV for the PWM2 io domain has changed to VCC3V0 instead of VCC1V8 in rockchip evb, we need to correct it with the value measured when PWM2 output HIGH.
Signed-off-by: Kever Yang kever.yang@rock-chips.com ---
arch/arm/dts/rk3399-firefly.dts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/arm/dts/rk3399-firefly.dts b/arch/arm/dts/rk3399-firefly.dts index a3e9ddf..3d3f507 100644 --- a/arch/arm/dts/rk3399-firefly.dts +++ b/arch/arm/dts/rk3399-firefly.dts @@ -157,8 +157,9 @@ regulator-name = "vdd_log"; regulator-always-on; regulator-boot-on; - regulator-min-microvolt = <800000>; + regulator-min-microvolt = <430000>; regulator-max-microvolt = <1400000>; + regulator-init-microvolt = <950000>; };
vccadc_ref: vccadc-ref {

The rkpwm reg order has fixed by below patch: e3ef41d rockchip: pwm: fix the register layout for the PWM controller
We need to correct the parameter order for pwm_set_config() to make the pwm regulator works correctly.
Signed-off-by: Kever Yang kever.yang@rock-chips.com ---
drivers/power/regulator/pwm_regulator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/power/regulator/pwm_regulator.c b/drivers/power/regulator/pwm_regulator.c index 00a7cca..fcf5e00 100644 --- a/drivers/power/regulator/pwm_regulator.c +++ b/drivers/power/regulator/pwm_regulator.c @@ -80,7 +80,7 @@ static int pwm_regulator_set_voltage(struct udevice *dev, int uvolt) }
ret = pwm_set_config(priv->pwm, priv->pwm_id, - (priv->period_ns / 100) * duty_cycle, priv->period_ns); + priv->period_ns, (priv->period_ns / 100) * duty_cycle); if (ret) { dev_err(dev, "Failed to configure PWM\n"); return ret;

The rkpwm reg order has fixed by below patch: e3ef41d rockchip: pwm: fix the register layout for the PWM controller
We need to correct the parameter order for pwm_set_config() to make the pwm regulator works correctly.
Signed-off-by: Kever Yang kever.yang@rock-chips.com
drivers/power/regulator/pwm_regulator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Acked-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com

The rkpwm reg order has fixed by below patch: e3ef41d rockchip: pwm: fix the register layout for the PWM controller
We need to correct the parameter order for pwm_set_config() to make the pwm regulator works correctly.
Signed-off-by: Kever Yang kever.yang@rock-chips.com Acked-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com
drivers/power/regulator/pwm_regulator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com

The rkpwm reg order has fixed by below patch: e3ef41d rockchip: pwm: fix the register layout for the PWM controller
We need to correct the parameter order for pwm_set_config() to make the pwm regulator works correctly.
Signed-off-by: Kever Yang kever.yang@rock-chips.com Acked-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com Reviewed-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com
drivers/power/regulator/pwm_regulator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Applied to u-boot-rockchip, thanks!

On 19 July 2017 at 05:54, Kever Yang kever.yang@rock-chips.com wrote:
The rkpwm reg order has fixed by below patch: e3ef41d rockchip: pwm: fix the register layout for the PWM controller
We need to correct the parameter order for pwm_set_config() to make the pwm regulator works correctly.
Signed-off-by: Kever Yang kever.yang@rock-chips.com
drivers/power/regulator/pwm_regulator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Simon Glass sjg@chromium.org

The regulator_enable() should be called from upper layer like regulators_enable_boot_on(), remove it from pwm regulator driver.
Signed-off-by: Kever Yang kever.yang@rock-chips.com ---
drivers/power/regulator/pwm_regulator.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/drivers/power/regulator/pwm_regulator.c b/drivers/power/regulator/pwm_regulator.c index fcf5e00..b63f941 100644 --- a/drivers/power/regulator/pwm_regulator.c +++ b/drivers/power/regulator/pwm_regulator.c @@ -86,12 +86,8 @@ static int pwm_regulator_set_voltage(struct udevice *dev, int uvolt) return ret; }
- ret = pwm_set_enable(priv->pwm, priv->pwm_id, true); - if (ret) { - dev_err(dev, "Failed to enable PWM\n"); - return ret; - } priv->volt_uV = uvolt; + return ret; }
@@ -144,8 +140,6 @@ static int pwm_regulator_probe(struct udevice *dev) if (priv->init_voltage) pwm_regulator_set_voltage(dev, priv->init_voltage);
- pwm_regulator_enable(dev, 1); - return 0; }

The regulator_enable() should be called from upper layer like regulators_enable_boot_on(), remove it from pwm regulator driver.
Signed-off-by: Kever Yang kever.yang@rock-chips.com
drivers/power/regulator/pwm_regulator.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
Acked-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com

The regulator_enable() should be called from upper layer like regulators_enable_boot_on(), remove it from pwm regulator driver.
Signed-off-by: Kever Yang kever.yang@rock-chips.com Acked-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com
drivers/power/regulator/pwm_regulator.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
Reviewed-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com

The regulator_enable() should be called from upper layer like regulators_enable_boot_on(), remove it from pwm regulator driver.
Signed-off-by: Kever Yang kever.yang@rock-chips.com Acked-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com Reviewed-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com
drivers/power/regulator/pwm_regulator.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
Applied to u-boot-rockchip, thanks!

On 19 July 2017 at 05:54, Kever Yang kever.yang@rock-chips.com wrote:
The regulator_enable() should be called from upper layer like regulators_enable_boot_on(), remove it from pwm regulator driver.
Signed-off-by: Kever Yang kever.yang@rock-chips.com
drivers/power/regulator/pwm_regulator.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org

Use mask to clear old setting before direct set the new config, or else there it will mess up the config when it's not the same with default value. Fixs: 3851059 rockchip: Setup default PWM flags
Signed-off-by: Kever Yang kever.yang@rock-chips.com ---
arch/arm/include/asm/arch-rockchip/pwm.h | 2 ++ drivers/pwm/rk_pwm.c | 1 + 2 files changed, 3 insertions(+)
diff --git a/arch/arm/include/asm/arch-rockchip/pwm.h b/arch/arm/include/asm/arch-rockchip/pwm.h index 08ff945..b1d8047 100644 --- a/arch/arm/include/asm/arch-rockchip/pwm.h +++ b/arch/arm/include/asm/arch-rockchip/pwm.h @@ -25,9 +25,11 @@ check_member(rk3288_pwm, ctrl, 0xc);
#define PWM_DUTY_POSTIVE (1 << 3) #define PWM_DUTY_NEGATIVE (0 << 3) +#define PWM_DUTY_MASK (1 << 3)
#define PWM_INACTIVE_POSTIVE (1 << 4) #define PWM_INACTIVE_NEGATIVE (0 << 4) +#define PWM_INACTIVE_MASK (1 << 4)
#define PWM_OUTPUT_LEFT (0 << 5) #define PWM_OUTPUT_CENTER (1 << 5) diff --git a/drivers/pwm/rk_pwm.c b/drivers/pwm/rk_pwm.c index 28de62d..2364c2d 100644 --- a/drivers/pwm/rk_pwm.c +++ b/drivers/pwm/rk_pwm.c @@ -29,6 +29,7 @@ static int rk_pwm_set_invert(struct udevice *dev, uint channel, bool polarity) struct rk_pwm_priv *priv = dev_get_priv(dev);
debug("%s: polarity=%u\n", __func__, polarity); + priv->enable_conf &= ~(PWM_DUTY_MASK | PWM_INACTIVE_MASK); if (polarity) priv->enable_conf |= PWM_DUTY_NEGATIVE | PWM_INACTIVE_POSTIVE; else

Use mask to clear old setting before direct set the new config, or else there it will mess up the config when it's not the same with default value. Fixs: 3851059 rockchip: Setup default PWM flags
Signed-off-by: Kever Yang kever.yang@rock-chips.com
arch/arm/include/asm/arch-rockchip/pwm.h | 2 ++ drivers/pwm/rk_pwm.c | 1 + 2 files changed, 3 insertions(+)
Acked-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com

Use mask to clear old setting before direct set the new config, or else there it will mess up the config when it's not the same with default value. Fixs: 3851059 rockchip: Setup default PWM flags
Signed-off-by: Kever Yang kever.yang@rock-chips.com Acked-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com
arch/arm/include/asm/arch-rockchip/pwm.h | 2 ++ drivers/pwm/rk_pwm.c | 1 + 2 files changed, 3 insertions(+)
Reviewed-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com

Use mask to clear old setting before direct set the new config, or else there it will mess up the config when it's not the same with default value. Fixs: 3851059 rockchip: Setup default PWM flags
Signed-off-by: Kever Yang kever.yang@rock-chips.com Acked-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com Reviewed-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com
arch/arm/include/asm/arch-rockchip/pwm.h | 2 ++ drivers/pwm/rk_pwm.c | 1 + 2 files changed, 3 insertions(+)
Applied to u-boot-rockchip, thanks!

On 19 July 2017 at 05:54, Kever Yang kever.yang@rock-chips.com wrote:
Use mask to clear old setting before direct set the new config, or else there it will mess up the config when it's not the same with default value. Fixs: 3851059 rockchip: Setup default PWM flags
Signed-off-by: Kever Yang kever.yang@rock-chips.com
arch/arm/include/asm/arch-rockchip/pwm.h | 2 ++ drivers/pwm/rk_pwm.c | 1 + 2 files changed, 3 insertions(+)
Reviewed-by: Simon Glass sjg@chromium.org

Add regulator-init-microvolt for driver to init the regulator, and the min output value is not 800000mV for the PWM2 io domain has changed to VCC3V0 instead of VCC1V8 in rockchip evb, we need to correct it with the value measured when PWM2 output HIGH.
Signed-off-by: Kever Yang kever.yang@rock-chips.com
arch/arm/dts/rk3399-firefly.dts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Acked-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com

Add regulator-init-microvolt for driver to init the regulator, and the min output value is not 800000mV for the PWM2 io domain has changed to VCC3V0 instead of VCC1V8 in rockchip evb, we need to correct it with the value measured when PWM2 output HIGH.
Signed-off-by: Kever Yang kever.yang@rock-chips.com Acked-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com
arch/arm/dts/rk3399-firefly.dts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Reviewed-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com

Add regulator-init-microvolt for driver to init the regulator, and the min output value is not 800000mV for the PWM2 io domain has changed to VCC3V0 instead of VCC1V8 in rockchip evb, we need to correct it with the value measured when PWM2 output HIGH.
Signed-off-by: Kever Yang kever.yang@rock-chips.com Acked-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com Reviewed-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com
arch/arm/dts/rk3399-firefly.dts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Applied to u-boot-rockchip, thanks!

On 19 July 2017 at 05:54, Kever Yang kever.yang@rock-chips.com wrote:
Add regulator-init-microvolt for driver to init the regulator, and the min output value is not 800000mV for the PWM2 io domain has changed to VCC3V0 instead of VCC1V8 in rockchip evb, we need to correct it with the value measured when PWM2 output HIGH.
Signed-off-by: Kever Yang kever.yang@rock-chips.com
arch/arm/dts/rk3399-firefly.dts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Reviewed-by: Simon Glass sjg@chromium.org
participants (3)
-
Kever Yang
-
Philipp Tomsich
-
Simon Glass