Collection of fixes for master. Ahmad Fatoum (4): pwm: atmel: point MMIO accesses at correct address clk: fixed: record parent name in clk_register_fixed_rate imx-bbu-nand-fcb: suppress compiler warning about uninitialized use regulator: fix broken reference counting on disable Enrico Jorns (1): regulator: respect "regulator-always-on" property common/imx-bbu-nand-fcb.c | 2 +- drivers/clk/clk-fixed.c | 4 ++++ drivers/pwm/pwm-atmel.c | 2 +- drivers/regulator/core.c | 8 +++++++- include/regulator.h | 3 ++- 5 files changed, 15 insertions(+), 4 deletions(-) -- 2.30.2 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
The base address for MMIO writes was the address of the resource struct, not the start address pointed at by it. Change untested, but it doesn't look like this driver could ever have worked. Cc: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> --- drivers/pwm/pwm-atmel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pwm/pwm-atmel.c b/drivers/pwm/pwm-atmel.c index 7819d321d387..648f75fb7292 100644 --- a/drivers/pwm/pwm-atmel.c +++ b/drivers/pwm/pwm-atmel.c @@ -256,7 +256,7 @@ static int atmel_pwm_probe(struct device_d *dev) if (IS_ERR(res)) return PTR_ERR(res); - atmel_pwm->base = IOMEM(res); + atmel_pwm->base = IOMEM(res->start); for (i = 0; i < PWM_CHANNELS; i++) { struct atmel_pwm_chip *chip = &atmel_pwm->atmel_pwm_chip[i]; -- 2.30.2 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
parent_names is allocated, but only populated with zeroes. Fix this. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> --- drivers/clk/clk-fixed.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/clk/clk-fixed.c b/drivers/clk/clk-fixed.c index b961c382ec22..e813f31d76d9 100644 --- a/drivers/clk/clk-fixed.c +++ b/drivers/clk/clk-fixed.c @@ -45,6 +45,10 @@ struct clk *clk_register_fixed_rate(const char *name, if (!parent_names) return ERR_PTR(-ENOMEM); + parent_names[0] = strdup(parent_name); + if (!parent_names[0]) + return ERR_PTR(-ENOMEM); + fix->hw.clk.parent_names = parent_names; fix->hw.clk.num_parents = 1; } -- 2.30.2 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
fw_orig_len is selectively initialized in read_firmware_all. In case it's left uninitialized, fw_orig will keep it's initial value of NULL. fw_orig is checked before fw_orig_len use, so there is no use of an uninitialized variable in practice, but GCC 11.1.1 warns about it anyway. Give it an initial value of 0 to silence the warning. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> --- common/imx-bbu-nand-fcb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/imx-bbu-nand-fcb.c b/common/imx-bbu-nand-fcb.c index 3b07d539ee6e..bde0b227f81c 100644 --- a/common/imx-bbu-nand-fcb.c +++ b/common/imx-bbu-nand-fcb.c @@ -1155,7 +1155,7 @@ static int imx_bbu_nand_update(struct bbu_handler *handler, struct bbu_data *dat enum filetype filetype; unsigned num_blocks_fw, fw_size; int used = 0; - int fw_orig_len; + int fw_orig_len = 0; int used_refresh = 0, unused_refresh = 0; if (data->image) { -- 2.30.2 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
Reference count is maintained correctly when enabling, but the very first disable will ignore the reference count and disable the regulator unconditionally. Make disable with an enable_count > 1 a no-op to fix this. Reported-by: Enrico Jorns <ejo@pengutronix.de> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> --- drivers/regulator/core.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index d1d3a36dfc8d..ac4141c1cdbf 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -71,6 +71,11 @@ static int regulator_disable_internal(struct regulator_internal *ri) if (!ri->enable_count) return -EINVAL; + if (ri->enable_count > 1) { + ri->enable_count--; + return 0; + } + if (!ri->rdev->desc->ops->disable) return -ENOSYS; -- 2.30.2 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
From: Enrico Jorns <ejo@pengutronix.de> As barebox ignored this property, a regulator could have been disabled even if it should not have been. By taking the same path as for 'regulator-boot-on', we ensure always holding an enable count > 0 on the regulator. Signed-off-by: Enrico Jorns <ejo@pengutronix.de> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> --- drivers/regulator/core.c | 3 ++- include/regulator.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index ac4141c1cdbf..b2e5f8caa2ca 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -130,7 +130,7 @@ static struct regulator_internal * __regulator_register(struct regulator_dev *rd if (name) ri->name = xstrdup(name); - if (rd->boot_on) { + if (rd->boot_on && rd->always_on) { ret = regulator_enable_internal(ri); if (ret && ret != -ENOSYS) goto err; @@ -163,6 +163,7 @@ int of_regulator_register(struct regulator_dev *rd, struct device_node *node) return -EINVAL; rd->boot_on = of_property_read_bool(node, "regulator-boot-on"); + rd->always_on = of_property_read_bool(node, "regulator-always-on"); name = of_get_property(node, "regulator-name", NULL); diff --git a/include/regulator.h b/include/regulator.h index bbe8dd91d84b..dfdfbf033262 100644 --- a/include/regulator.h +++ b/include/regulator.h @@ -84,7 +84,8 @@ struct regulator_desc { struct regulator_dev { const struct regulator_desc *desc; struct regmap *regmap; - int boot_on; + bool boot_on; + bool always_on; /* the device this regulator device belongs to */ struct device_d *dev; }; -- 2.30.2 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
Hi Ahmad, On Mon, Jan 03, 2022 at 12:57:14PM +0100, Ahmad Fatoum wrote: > The base address for MMIO writes was the address of the resource struct, > not the start address pointed at by it. > > Change untested, but it doesn't look like this driver could ever have > worked. You are right that I never got around to see backlight dimming work. I recall that backlight worked and then the pwm driver was added as part of several other patches for barebox. I should have dropped the patch until I had seen it actually work. But nice catch! I may try to dust of the skov board where this is used to test it. But these days I play with an i.MX6 board which has a bit more power, so no promises. Sam _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
On Mon, Jan 03, 2022 at 05:11:53PM +0100, Sam Ravnborg wrote: > Hi Ahmad, > > On Mon, Jan 03, 2022 at 12:57:14PM +0100, Ahmad Fatoum wrote: > > The base address for MMIO writes was the address of the resource struct, > > not the start address pointed at by it. > > > > Change untested, but it doesn't look like this driver could ever have > > worked. > > You are right that I never got around to see backlight dimming work. > I recall that backlight worked and then the pwm driver was added as part > of several other patches for barebox. > I should have dropped the patch until I had seen it actually work. > > But nice catch! > > I may try to dust of the skov board where this is used to test it. > But these days I play with an i.MX6 board which has a bit more power, > so no promises. For the patch btw: Reviewed-by: Sam Ravnborg <sam@ravnborg.org> _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
On Mon, Jan 03, 2022 at 12:57:13PM +0100, Ahmad Fatoum wrote: > Collection of fixes for master. > > Ahmad Fatoum (4): > pwm: atmel: point MMIO accesses at correct address > clk: fixed: record parent name in clk_register_fixed_rate > imx-bbu-nand-fcb: suppress compiler warning about uninitialized use > regulator: fix broken reference counting on disable > > Enrico Jorns (1): > regulator: respect "regulator-always-on" property Applied, thanks Sascha -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox