[U-Boot] [PATCH] regulator: pwm: Fix handling of missing init voltage
Since priv->init_voltage is an unsigned integer it can never be negative. So the current code fails to detect a missing 'regulator-init-microvolt' property and instead misconfigures the PWM device. Fix this by making the relevant members of 'struct pwm_regulator_info' signed integers. Signed-off-by: Mark Kettenis --- The current device tree for the Firefly-RK3399 does not have a 'regulator-init-microvolt' property for the 'vdd-log' regulator. Without this fix U-Boot configures a voltage that is too low which causes the Ethernet interface to drop almost all packets. This is the same patch that I sent a couple of days ago, but was bounced since I wasn't subscribed to the mailing list at that point. Funily enough the message did make it into the mailing list archive. Resending to make sure it does reach subscribers. drivers/power/regulator/pwm_regulator.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/power/regulator/pwm_regulator.c b/drivers/power/regulator/pwm_regulator.c index a6c9fccd68..00a7cca7f7 100644 --- a/drivers/power/regulator/pwm_regulator.c +++ b/drivers/power/regulator/pwm_regulator.c @@ -32,13 +32,13 @@ struct pwm_regulator_info { bool polarity; struct udevice *pwm; /* initialize voltage of regulator */ - unsigned int init_voltage; + int init_voltage; /* the maximum voltage of regulator */ - unsigned int max_voltage; + int max_voltage; /* the minimum voltage of regulator */ - unsigned int min_voltage; + int min_voltage; /* the current voltage of regulator */ - unsigned int volt_uV; + int volt_uV; }; static int pwm_regulator_enable(struct udevice *dev, bool enable) -- 2.13.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] regulator: pwm: Fix handling of missing init voltage
Since priv->init_voltage is an unsigned integer it can never be negative. So the current code fails to detect a missing 'regulator-init-microvolt' property and instead misconfigures the PWM device. Fix this by making the relevant members of 'struct pwm_regulator_info' signed integers. Signed-off-by: Mark Kettenis --- The current device tree for the Firefly-RK3399 does not have a 'regulator-init-microvolt' property for the 'vdd-log' regulator. Without this fix U-Boot configures a voltage that is too low which causes the Ethernet interface to drop almost all packets. drivers/power/regulator/pwm_regulator.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/power/regulator/pwm_regulator.c b/drivers/power/regulator/pwm_regulator.c index a6c9fccd68..00a7cca7f7 100644 --- a/drivers/power/regulator/pwm_regulator.c +++ b/drivers/power/regulator/pwm_regulator.c @@ -32,13 +32,13 @@ struct pwm_regulator_info { bool polarity; struct udevice *pwm; /* initialize voltage of regulator */ - unsigned int init_voltage; + int init_voltage; /* the maximum voltage of regulator */ - unsigned int max_voltage; + int max_voltage; /* the minimum voltage of regulator */ - unsigned int min_voltage; + int min_voltage; /* the current voltage of regulator */ - unsigned int volt_uV; + int volt_uV; }; static int pwm_regulator_enable(struct udevice *dev, bool enable) -- 2.13.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] regulator: pwm: Fix handling of missing init voltage
Since priv->init_voltage is an unsigned integer it can never be negative. So the current code fails to detect a missing 'regulator-init-microvolt' property and instead misconfigures the PWM device. Fix this by making the relevant members of 'struct pwm_regulator_info' signed integers. Signed-off-by: Mark Kettenis --- The current device tree for the Firefly-RK3399 does not have a 'regulator-init-microvolt' property for the 'vdd-log' regulator. Without this fix U-Boot configures a voltage that is too low which causes the Ethernet interface to drop almost all packets. This is the same patch that I sent a couple of days ago, but was bounced since I wasn't subscribed to the mailing list at that point. Funily enough the message did make it into the mailing list archive. Resending to make sure it does reach subscribers. drivers/power/regulator/pwm_regulator.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) Applied to u-boot-rockchip, thanks! ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot