[PATCH] dm: pmic: ignore disabled node in pmic_bind_children

Ignore the disabled children node in pmic_bind_children() so the disabled regulators in device tree are not registered.
This patch is based on the dm_scan_fdt_node() code - only the activated nodes are bound - and it solves possible issue when a deactivated regulator is bound, error for duplicated regulator name for example.
Signed-off-by: Patrick Delaunay patrick.delaunay@foss.st.com --- This patch solves the errors for duplicated regulator names on STM32MP15x boards since the alignment with Linux device tree with the commit 9157a4ce36b18 ("ARM: dts: stm32: update SCMI dedicated file").
When SCMI is activated in "<board>-scmi.dts" device tree, the 3 regulators reg11, reg18, usb33 are duplicated (children of scmi_reguls and of pwr_regulators) even if the children of pwr_regulators are deactivated in the file arch/arm/dts/stm32mp15-scmi.dtsi.
drivers/power/pmic/pmic-uclass.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/drivers/power/pmic/pmic-uclass.c b/drivers/power/pmic/pmic-uclass.c index 5dcf6d8079d2..0e2f5e1f4111 100644 --- a/drivers/power/pmic/pmic-uclass.c +++ b/drivers/power/pmic/pmic-uclass.c @@ -39,6 +39,10 @@ int pmic_bind_children(struct udevice *pmic, ofnode parent, node_name = ofnode_get_name(node);
debug("* Found child node: '%s'\n", node_name); + if (!ofnode_is_enabled(node)) { + debug(" - ignoring disabled device\n"); + continue; + }
child = NULL; for (info = child_info; info->prefix && info->driver; info++) {

On Wed, 26 Oct 2022 at 07:05, Patrick Delaunay patrick.delaunay@foss.st.com wrote:
Ignore the disabled children node in pmic_bind_children() so the disabled regulators in device tree are not registered.
This patch is based on the dm_scan_fdt_node() code - only the activated nodes are bound - and it solves possible issue when a deactivated regulator is bound, error for duplicated regulator name for example.
Signed-off-by: Patrick Delaunay patrick.delaunay@foss.st.com
This patch solves the errors for duplicated regulator names on STM32MP15x boards since the alignment with Linux device tree with the commit 9157a4ce36b18 ("ARM: dts: stm32: update SCMI dedicated file").
When SCMI is activated in "<board>-scmi.dts" device tree, the 3 regulators reg11, reg18, usb33 are duplicated (children of scmi_reguls and of pwr_regulators) even if the children of pwr_regulators are deactivated in the file arch/arm/dts/stm32mp15-scmi.dtsi.
drivers/power/pmic/pmic-uclass.c | 4 ++++ 1 file changed, 4 insertions(+)
Reviewed-by: Simon Glass sjg@chromium.org

Hi Patrick
On 10/27/22 17:22, Simon Glass wrote:
On Wed, 26 Oct 2022 at 07:05, Patrick Delaunay patrick.delaunay@foss.st.com wrote:
Ignore the disabled children node in pmic_bind_children() so the disabled regulators in device tree are not registered.
This patch is based on the dm_scan_fdt_node() code - only the activated nodes are bound - and it solves possible issue when a deactivated regulator is bound, error for duplicated regulator name for example.
Signed-off-by: Patrick Delaunay patrick.delaunay@foss.st.com
This patch solves the errors for duplicated regulator names on STM32MP15x boards since the alignment with Linux device tree with the commit 9157a4ce36b18 ("ARM: dts: stm32: update SCMI dedicated file").
When SCMI is activated in "<board>-scmi.dts" device tree, the 3 regulators reg11, reg18, usb33 are duplicated (children of scmi_reguls and of pwr_regulators) even if the children of pwr_regulators are deactivated in the file arch/arm/dts/stm32mp15-scmi.dtsi.
drivers/power/pmic/pmic-uclass.c | 4 ++++ 1 file changed, 4 insertions(+)
Reviewed-by: Simon Glass sjg@chromium.org _______________________________________________ Uboot-stm32 mailing list Uboot-stm32@st-md-mailman.stormreply.com https://st-md-mailman.stormreply.com/mailman/listinfo/uboot-stm32
Applied to u-boot-stm/master
Thanks Patrice

Hi Jaehoon,
On 10/26/22 15:05, Patrick Delaunay wrote:
Ignore the disabled children node in pmic_bind_children() so the disabled regulators in device tree are not registered.
This patch is based on the dm_scan_fdt_node() code - only the activated nodes are bound - and it solves possible issue when a deactivated regulator is bound, error for duplicated regulator name for example.
Signed-off-by: Patrick Delaunay patrick.delaunay@foss.st.com
This patch solves the errors for duplicated regulator names on STM32MP15x boards since the alignment with Linux device tree with the commit 9157a4ce36b18 ("ARM: dts: stm32: update SCMI dedicated file").
When SCMI is activated in "<board>-scmi.dts" device tree, the 3 regulators reg11, reg18, usb33 are duplicated (children of scmi_reguls and of pwr_regulators) even if the children of pwr_regulators are deactivated in the file arch/arm/dts/stm32mp15-scmi.dtsi.
drivers/power/pmic/pmic-uclass.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/drivers/power/pmic/pmic-uclass.c b/drivers/power/pmic/pmic-uclass.c index 5dcf6d8079d2..0e2f5e1f4111 100644 --- a/drivers/power/pmic/pmic-uclass.c +++ b/drivers/power/pmic/pmic-uclass.c @@ -39,6 +39,10 @@ int pmic_bind_children(struct udevice *pmic, ofnode parent, node_name = ofnode_get_name(node);
debug("* Found child node: '%s'\n", node_name);
if (!ofnode_is_enabled(node)) {
debug(" - ignoring disabled device\n");
continue;
}
child = NULL; for (info = child_info; info->prefix && info->driver; info++) {
Gentle reminder,
it is possible to review have this patch in the next v2023.01 pull request,
or, if you prefere, I can integrate it in the next stm32 pull request.
Patrick
participants (4)
-
Patrice CHOTARD
-
Patrick DELAUNAY
-
Patrick Delaunay
-
Simon Glass