Skip to contentSkip to conversation

PHYTEC patches to be mainlined

PATCH Superseded Andrej Picej 3 participants 12 messages Nov 15, 2021 – Nov 17, 2021

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover PHYTEC patches to be mainlined

Hi all,

this patch series contains PHYTEC barebox patches which weren't yet introduced to this mailing list (or at least not in this form).

1. The first patch increases the stability during boot in extreme cold conditions.

2. The second patch targets PHYTEC specific config creation. Until now PHYTEC used to patch the default 'imx_v7_defconfig' with their changes. This patch introduces PHYTEC specific i.MX6 SoM config fragment which should be merged with the default 'imx_v7_defconfig' to create a complete config file. This mainly minimizes efforts required to port patches to defconfig with each new PHYTEC BSP release and uniforms config creation between PHYTEC's kernel and barebox.

3. The last three patches (third, fourth and fifth) are meant as a fixup for patches that deleted the PMIC supply nodes. They were introduced because barebox doesn't support DA9063 PMIC regulator driver and instead prints ugly warnings (recently downgraded from error) like:

imx-esdhc [email protected]: Failed to get 'vmmc' regulator (ignored).

In either way, we rely on PMIC's reset default and use dummy regulators. Using barebox specific device-tree property ('barebox,allow-dummy-supply') shouldn't break booting Linux with barebox internal device-tree and allows using dummy regulators in bootloader where regulator support is limited. The complete solution would be porting DA9063 regulator driver to barebox, but let's add that to our "to-do" list for now and use this workaround instead.

Best regards,
Andrej

P.S. I cc-ed some PHYTEC guys so they can be involved in the discussion if necessary.

Andrej Picej (4):
ARM: configs: phytec-som-imx6.config
regulator: allow use of dummy regulator
ARM: dts: imx6qdl: pfla02: allow use of dummy regulators
documentation: regulator: add dummy-supply

Stefan Riedmueller (1):
flash-header-phytec-pcl063: Set SOC voltage to 1.25 V during boot

 .../bindings/regulator/regulator.rst          | 31 +++++++++++++++++++
 .../flash-header-phytec-pcl063.h              |  2 ++
 arch/arm/configs/phytec-som-imx6.config       | 10 ++++++
 arch/arm/dts/imx6qdl-phytec-pfla02.dtsi       | 22 +++++++++++--
 drivers/regulator/core.c                      |  9 +++++-
 5 files changed, 70 insertions(+), 4 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/regulator/regulator.rst
 create mode 100644 arch/arm/configs/phytec-som-imx6.config
Signature · 7 lines
2.25.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw

PATCH 1/5 flash-header-phytec-pcl063: Set SOC voltage to 1.25 V during boot

From: Stefan Riedmueller <[email protected]>

To increase stability during boot in cold conditions (< -30 °C) increase the SOC voltage from 1.15 V to 1.25 V in DCD. The ARM voltage is left unchanged at its default 1.15 V.

---
 arch/arm/boards/phytec-som-imx6/flash-header-phytec-pcl063.h | 2 ++
 1 file changed, 2 insertions(+)
arch/arm/boards/phytec-som-imx6/flash-header-phytec-pcl063.h +2 -0
index 9a8f5f18e..8e0ab6f58 100644
@@ -3,6 +3,8 @@ loadaddr 0x80000000
 soc imx6
 ivtofs 0x400
 
+wm 32 0x020c8140 0x00580012
+
 wm 32 0x020c4068 0xffffffff
 wm 32 0x020c406c 0xffffffff
 wm 32 0x020c4070 0xffffffff
Signature · 7 lines
2.25.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#2 lore raw

PATCH 2/5 ARM: configs: phytec-som-imx6.config

In reply to Andrej Picej

Create PHYTEC specific i.MX6 SoM config fragment, which is intended to be merged with the default imx_v7_defconfig. This way, one can clearly outline the differences between standard defconfig and changes PHYTEC makes for i.MX6 SoMs in their BSP. Nonetheless, at the same time, this minimizes efforts required to port patches to defconfig with each new PHYTEC BSP release.

For now:
- disable BLSPEC,
- disable IPU driver,
- enable of_fixup_status command,
- enable of_overlay command,
- enable of_display_timings command and
- enable OCOTP fuse writing ability.

To manually configure PHYTEC i.MX6 board, config merge can be triggered with:

$ ./scripts/kconfig/merge_config.sh -m arch/arm/config /imx_v7_defconfig
arch/arm/configs/phytec-som-imx6.config && make olddefconfig
---
 arch/arm/configs/phytec-som-imx6.config | 10 ++++++++++
 1 file changed, 10 insertions(+)
 create mode 100644 arch/arm/configs/phytec-som-imx6.config
arch/arm/configs/phytec-som-imx6.config new file +10 -0
new file mode 100644
index 000000000..a7d5bae59
@@ -0,0 +1,10 @@
+# CONFIG_BLSPEC is not set
+CONFIG_CMD_OF_OVERLAY=y
+CONFIG_CMD_OF_DISPLAY_TIMINGS=y
+CONFIG_CMD_OF_FIXUP_STATUS=y
+# CONFIG_DRIVER_VIDEO_IMX_IPUV3 is not set
+# CONFIG_DRIVER_VIDEO_IMX_IPUV3_LVDS is not set
+# CONFIG_DRIVER_VIDEO_IMX_IPUV3_HDMI is not set
+# CONFIG_DRIVER_VIDEO_SIMPLEFB is not set
+# CONFIG_DRIVER_VIDEO_EDID is not set
+CONFIG_IMX_OCOTP_WRITE=y
Signature · 7 lines
2.25.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#3 lore raw

Re: [PATCH 2/5] ARM: configs: phytec-som-imx6.config

Quoted 10 lines · Andrej Picej

Create PHYTEC specific i.MX6 SoM config fragment, which is intended to be merged with the default imx_v7_defconfig. This way, one can clearly outline the differences between standard defconfig and changes PHYTEC makes for i.MX6 SoMs in their BSP. Nonetheless, at the same time, this minimizes efforts required to port patches to defconfig with each new PHYTEC BSP release.

For now:
- disable BLSPEC,
- disable IPU driver,

Why are these disabled? These options shouldn't hurt anyone.

Quoted 4 lines

- enable of_fixup_status command,
- enable of_overlay command,
- enable of_display_timings command and
- enable OCOTP fuse writing ability.

We can enable these in imx_v7_defconfig, no need to overwrite them.

Sascha

Signature · 9 lines
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
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#4 lore raw

Re: [PATCH 2/5] ARM: configs: phytec-som-imx6.config

Hi Sascha,

Quoted 8 lines · Sascha Hauer
Quoted 7 lines · Andrej Picej

Create PHYTEC specific i.MX6 SoM config fragment, which is intended to be merged with the default imx_v7_defconfig. This way, one can clearly outline the differences between standard defconfig and changes PHYTEC makes for i.MX6 SoMs in their BSP. Nonetheless, at the same time, this minimizes efforts required to port patches to defconfig with each new PHYTEC BSP release.

Quoted 5 lines
Quoted 3 lines

For now:
- disable BLSPEC,
- disable IPU driver,

Why are these disabled? These options shouldn't hurt anyone.

You're right, there should be no issue with the BLSPEC config.

Regarding the IPU driver, I only remember that we had an issue some time ago with the IPU driver and since then disable it because we don't make use of it in our BSP. But I can't remember what the actual issue was.

@Andrej, maybe you can take another look at it and see if it can be enabled without issues on our boards nowadays. In that case we could drop disabling the IPU driver as well.

Quoted 7 lines
Quoted 5 lines

- enable of_fixup_status command,
- enable of_overlay command,
- enable of_display_timings command and
- enable OCOTP fuse writing ability.

We can enable these in imx_v7_defconfig, no need to overwrite them.

Sure let's move them to the defconfig then.

Regards,
Stefan

Quoted 3 lines

Sascha

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#5 lore raw

Re: [PATCH 2/5] ARM: configs: phytec-som-imx6.config

Hi Stefan,

I was waiting for your insight.

Quoted 12 lines

You're right, there should be no issue with the BLSPEC config.

Regarding the IPU driver, I only remember that we had an issue some time ago with the IPU driver and since then disable it because we don't make use of it in our BSP. But I can't remember what the actual issue was.

@Andrej, maybe you can take another look at it and see if it can be enabled without issues on our boards nowadays. In that case we could drop disabling the IPU driver as well.

Quoted 1 line
Quoted 9 lines
Quoted 6 lines
Quoted 4 lines

- enable of_fixup_status command,
- enable of_overlay command,
- enable of_display_timings command and
- enable OCOTP fuse writing ability.

We can enable these in imx_v7_defconfig, no need to overwrite them.

Sure let's move them to the defconfig then.

This would be the nicest yes. I will check if IPU driver can be left enabled, and create a new patch (for imx_v7_defconfig) if this is the case.

Thanks to both of you.

BR,
Andrej

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#6 lore raw

PATCH 3/5 regulator: allow use of dummy regulator

In reply to Andrej Picej

It is quite common for users to delete power supply nodes of regulators which aren't yet supported.
The idea of a function call or devicetree property which allows use of dummy regulator is not new. This implementation uses barebox specific devicetree property "barebox,allow-dummy-supply" to allow switching to dummy power regulator.
Basically just catch the regulators ensure_probed error, if this property is set.

---
 drivers/regulator/core.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/regulator/core.c +8 -1
index 097f7d779..1c58932e1 100644
@@ -231,8 +231,15 @@ static struct regulator_internal *of_regulator_get(struct device_d *dev, const c
 	}
 
 	ret = of_device_ensure_probed(node);
-	if (ret)
+	if (ret) {
+		if (of_get_property(dev->device_node, "barebox,allow-dummy-supply", NULL)) {
+			dev_dbg(dev, "Allow use of dummy regulator for " \
+				"%s-supply\n", supply);
+			ri = NULL;
+			goto out;
+		}
 		return ERR_PTR(ret);
+	}
 
 	list_for_each_entry(ri, &regulator_list, list) {
 		if (ri->node == node) {
Signature · 7 lines
2.25.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#7 lore raw

Re: [PATCH 3/5] regulator: allow use of dummy regulator

Quoted 21 lines · Andrej Picej

It is quite common for users to delete power supply nodes of regulators which aren't yet supported.
The idea of a function call or devicetree property which allows use of dummy regulator is not new. This implementation uses barebox specific devicetree property "barebox,allow-dummy-supply" to allow switching to dummy power regulator.
Basically just catch the regulators ensure_probed error, if this property is set.

---
 drivers/regulator/core.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/regulator/core.c +0 -0
index 097f7d779..1c58932e1 100644
@@ -231,8 +231,15 @@ static struct regulator_internal *of_regulator_get(struct device_d *dev, const c
 	}
 

drivers/regulator/core.c static struct regulator_internal *of_regulator_get(struct device_d *dev, const c · line 241

Quoted 10 lines
drivers/regulator/core.c +7 -1
 	ret = of_device_ensure_probed(node);
-	if (ret)
+	if (ret) {
+		if (of_get_property(dev->device_node, "barebox,allow-dummy-supply", NULL)) {
+			dev_dbg(dev, "Allow use of dummy regulator for " \
+				"%s-supply\n", supply);
+			ri = NULL;
+			goto out;
+		}
 		return ERR_PTR(ret);

I wonder if we should rather add a property on the producer side than on the consumer side, i.e. Add a barebox,status = "disabled" property to the regulator node. We had the same discussion with phys recently, maybe we can use the same approach for both issues.

Sascha

Signature · 9 lines
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
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#8 lore raw

Re: [PATCH 3/5] regulator: allow use of dummy regulator

Quoted 22 lines · Sascha Hauer
Quoted 21 lines · Andrej Picej

It is quite common for users to delete power supply nodes of regulators which aren't yet supported.
The idea of a function call or devicetree property which allows use of dummy regulator is not new. This implementation uses barebox specific devicetree property "barebox,allow-dummy-supply" to allow switching to dummy power regulator.
Basically just catch the regulators ensure_probed error, if this property is set.

---
  drivers/regulator/core.c | 9 ++++++++-
  1 file changed, 8 insertions(+), 1 deletion(-)
drivers/regulator/core.c +0 -0
index 097f7d779..1c58932e1 100644
@@ -231,8 +231,15 @@ static struct regulator_internal *of_regulator_get(struct device_d *dev, const c
  	}
 
Quoted 16 lines

drivers/regulator/core.c static struct regulator_internal *of_regulator_get(struct device_d *dev, const c · line 241

Quoted 10 lines
drivers/regulator/core.c +7 -1
  	ret = of_device_ensure_probed(node);
-	if (ret)
+	if (ret) {
+		if (of_get_property(dev->device_node, "barebox,allow-dummy-supply", NULL)) {
+			dev_dbg(dev, "Allow use of dummy regulator for " \
+				"%s-supply\n", supply);
+			ri = NULL;
+			goto out;
+		}
  		return ERR_PTR(ret);

I wonder if we should rather add a property on the producer side than on the consumer side, i.e. Add a barebox,status = "disabled" property to the regulator node. We had the same discussion with phys recently, maybe we can use the same approach for both issues.

I was wandering that too. But decided to go with consumer side so users which might want to use this have to enable this for every consumers which can use dummy regulators. IMO this would mean more thought would go into this and would be consequently more error prone.

So for producer side did you have in mind that this setting will be set for every regulator, like this?

Quoted 7 lines
                regulators {
                        vddcore_reg: bcore1 {
+                               barebox,allow-dummy-supply;
                                regulator-min-microvolt = <730000>;
                                regulator-max-microvolt = <1380000>;
                                regulator-always-on;
                        };

Or should this setting be set for all regulators provided by the same IC, like this?

Quoted 7 lines
                regulators {
+                       barebox,allow-dummy-supply;
                        vddcore_reg: bcore1 {
                                regulator-min-microvolt = <730000>;
                                regulator-max-microvolt = <1380000>;
                                regulator-always-on;
                        };

I guess we could make both cases work, first check if "barebox,allow-dummy-supply" is present in the regulator node and then also check parent node (regulators)? What do you think?

BR,
Andrej

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#9 lore raw

Re: [PATCH 3/5] regulator: allow use of dummy regulator

Quoted 65 lines · Andrej Picej
Quoted 30 lines · Sascha Hauer
Quoted 29 lines · Andrej Picej

It is quite common for users to delete power supply nodes of regulators which aren't yet supported.
The idea of a function call or devicetree property which allows use of dummy regulator is not new. This implementation uses barebox specific devicetree property "barebox,allow-dummy-supply" to allow switching to dummy power regulator.
Basically just catch the regulators ensure_probed error, if this property is set.

---
  drivers/regulator/core.c | 9 ++++++++-

  1 file changed, 8 insertions(+), 1 deletion(-)
drivers/regulator/core.c +5 -1
index 097f7d779..1c58932e1 100644
@@ -231,8 +231,15 @@ static struct regulator_internal 
 *of_regulator_get(struct device_d *dev, const c
       }
       ret = of_device_ensure_probed(node);
-    if (ret)
+    if (ret) {
+        if (of_get_property(dev->device_node, 
 "barebox,allow-dummy-supply", NULL)) {
+            dev_dbg(dev, "Allow use of dummy regulator for " \
+                "%s-supply\n", supply);
+            ri = NULL;
Quoted 9 lines

drivers/regulator/core.c static struct regulator_internal *of_regulator_get(struct device_d *dev, const c · line 241

Quoted 3 lines
drivers/regulator/core.c +2 -0
+            goto out;
+        }
           return ERR_PTR(ret);

I wonder if we should rather add a property on the producer side than on the consumer side, i.e. Add a barebox,status = "disabled" property to the regulator node. We had the same discussion with phys recently, maybe we can use the same approach for both issues.

I was wandering that too. But decided to go with consumer side so users which might want to use this have to enable this for every consumers which can use dummy regulators. IMO this would mean more thought would go into this and would be consequently more error prone.

So for producer side did you have in mind that this setting will be set for every regulator, like this?

Quoted 7 lines

                regulators {
                        vddcore_reg: bcore1 {
+                               barebox,allow-dummy-supply; regulator-min-microvolt = <730000>; regulator-max-microvolt = <1380000>; regulator-always-on;
                        };

Or should this setting be set for all regulators provided by the same IC, like this?

Quoted 7 lines

                regulators {
+                       barebox,allow-dummy-supply;
                        vddcore_reg: bcore1 { regulator-min-microvolt = <730000>; regulator-max-microvolt = <1380000>; regulator-always-on;
                        };

Quoted 2 lines

I guess we could make both cases work, first check if "barebox,allow-dummy-supply" is present in the regulator node and then also check parent node (regulators)? What do you think?

Like this:

Quoted 28 lines
drivers/regulator/core.c +11 -2
index 097f7d779..4ff7e1c2f 100644
@@ -197,7 +197,7 @@ static struct regulator_internal *of_regulator_get(struct device_d *dev, const c
 {
        char *propname;
        struct regulator_internal *ri;
-       struct device_node *node;
+       struct device_node *node, *node_parent;
        int ret;
 
        propname = basprintf("%s-supply", supply);
@@ -231,8 +231,23 @@ static struct regulator_internal *of_regulator_get(struct device_d *dev, const c
        }
 
        ret = of_device_ensure_probed(node);
-       if (ret)
+       if (ret) {
+               /* If "barebox,allow-dummy-supply" property is set for regulator
+                * provider, allow use of dummy regulator -> NULL is returned.
+                * Check regulator node and its parent, if this setting is set
+                * PMIC wide.
+                */
+               node_parent = of_get_parent(node);
+               if (of_get_property(node, "barebox,allow-dummy-supply", NULL) ||
+                   of_get_property(node_parent, "barebox,allow-dummy-supply", NULL)) {
+                       dev_dbg(dev, "Allow use of dummy regulator for " \

drivers/regulator/core.c static struct regulator_internal *of_regulator_get(struct device_d *dev, const c · line 253

Quoted 10 lines
drivers/regulator/core.c +6 -0
+                               "%s-supply\n", supply);
+                       ri = NULL;
+                       goto out;
+               }
+
                return ERR_PTR(ret);
+       }
 
        list_for_each_entry(ri, &regulator_list, list) {
                if (ri->node == node) {

BR,
Andrej

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#10 lore raw

PATCH 4/5 ARM: dts: imx6qdl: pfla02: allow use of dummy regulators

In reply to Andrej Picej

The power for the phyFLEX sd cards and ethernet controller are supplied by the PMIC DA9063 LDOs. There is no barebox driver for the DA9063 to register regulators. So allow use of dummy-regulators for nodes depending on DA9063 power supply.

---
 arch/arm/dts/imx6qdl-phytec-pfla02.dtsi | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)
arch/arm/dts/imx6qdl-phytec-pfla02.dtsi +19 -3
index 0653fcc3c..42d243058 100644
@@ -84,10 +84,10 @@
 &fec {
 	/*
 	 * barebox doesn't have a driver for the PMIC providing the phy-supply
-	 * (dlg,da9063). So remove the phy-supply property and rely on the
-	 * PMIC's reset default which has this supply enabled.
+	 * (dlg,da9063). Allow usage of dummy regulator and rely on the PMIC's
+	 * reset default which has this supply enabled.
 	 */
-	/delete-property/ phy-supply;
+	barebox,allow-dummy-supply;
 };
 
 &gpmi {
@@ -138,10 +138,26 @@
 	pagesize = <32>;
 };
 
+&usdhc2 {
+	/*
+	 * barebox doesn't have a driver for the PMIC providing the vmmc-supply
+	 * (dlg,da9063). Allow usage of dummy regulator and rely on the PMIC's
+	 * reset default which has this supply enabled.
+	 */
+	barebox,allow-dummy-supply;
+};
+
 &usdhc3 {
 	#address-cells = <1>;
 	#size-cells = <1>;
 
+	/*
+	 * barebox doesn't have a driver for the PMIC providing the vmmx-supply
+	 * (dlg,da9063). Allow usage of dummy regulator and rely on the PMIC's
+	 * reset default which has this supply enabled.
+	 */
+	barebox,allow-dummy-supply;
+
 	partition@0 {
 		label = "barebox";
 		reg = <0x0 0xe0000>;
Signature · 7 lines
2.25.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#11 lore raw

PATCH 5/5 documentation: regulator: add dummy-supply

In reply to Andrej Picej

Add "barebox,allow-dummy-supply" documentation.

---
 .../bindings/regulator/regulator.rst          | 31 +++++++++++++++++++
 1 file changed, 31 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/regulator.rst
Documentation/devicetree/bindings/regulator/regulator.rst new file +31 -0
new file mode 100644
index 000000000..4c7f70295
@@ -0,0 +1,31 @@
+Voltage/Current Regulators
+==========================
+
+In addition to the upstream bindings, another property is added:
+
+Optional properties:
+- ``barebox,allow-dummy-supply`` : A property to allow usage of dummy power
+  regulator. This can be added to nodes, whose power is supplied by regulators,
+  which drivers are not yet supported. It will rely on regulator reset default
+  and use dummy regulator instead.
+
+Examples:
+
+.. code-block:: none
+
+  &usdhc3 {
+  	#address-cells = <1>;
+  	#size-cells = <1>;
+  
+  	barebox,allow-dummy-supply;
+  
+  	partition@0 {
+  		label = "barebox";
+  		reg = <0x0 0xe0000>;
+  	};
+  
+  	partition@e0000 {
+  		label = "barebox-environment";
+  		reg = <0xe0000 0x20000>;
+  	};
+  };
Signature · 7 lines
2.25.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox