mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 0/5] PHYTEC patches to be mainlined
@ 2021-11-15 13:02 Andrej Picej
  2021-11-15 13:02 ` [PATCH 1/5] flash-header-phytec-pcl063: Set SOC voltage to 1.25 V during boot Andrej Picej
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Andrej Picej @ 2021-11-15 13:02 UTC (permalink / raw)
  To: barebox; +Cc: Y.Bas, s.riedmueller

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 2194000.mmc@2194000.of: 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

-- 
2.25.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 1/5] flash-header-phytec-pcl063: Set SOC voltage to 1.25 V during boot
  2021-11-15 13:02 [PATCH 0/5] PHYTEC patches to be mainlined Andrej Picej
@ 2021-11-15 13:02 ` Andrej Picej
  2021-11-15 13:02 ` [PATCH 2/5] ARM: configs: phytec-som-imx6.config Andrej Picej
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 12+ messages in thread
From: Andrej Picej @ 2021-11-15 13:02 UTC (permalink / raw)
  To: barebox; +Cc: Y.Bas, s.riedmueller

From: Stefan Riedmueller <s.riedmueller@phytec.de>

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.

Signed-off-by: Stefan Riedmueller <s.riedmueller@phytec.de>
Signed-off-by: Andrej Picej <andrej.picej@norik.com>
---
 arch/arm/boards/phytec-som-imx6/flash-header-phytec-pcl063.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/boards/phytec-som-imx6/flash-header-phytec-pcl063.h b/arch/arm/boards/phytec-som-imx6/flash-header-phytec-pcl063.h
index 9a8f5f18e..8e0ab6f58 100644
--- a/arch/arm/boards/phytec-som-imx6/flash-header-phytec-pcl063.h
+++ b/arch/arm/boards/phytec-som-imx6/flash-header-phytec-pcl063.h
@@ -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
-- 
2.25.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 2/5] ARM: configs: phytec-som-imx6.config
  2021-11-15 13:02 [PATCH 0/5] PHYTEC patches to be mainlined Andrej Picej
  2021-11-15 13:02 ` [PATCH 1/5] flash-header-phytec-pcl063: Set SOC voltage to 1.25 V during boot Andrej Picej
@ 2021-11-15 13:02 ` Andrej Picej
  2021-11-17  7:03   ` Sascha Hauer
  2021-11-15 13:02 ` [PATCH 3/5] regulator: allow use of dummy regulator Andrej Picej
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 12+ messages in thread
From: Andrej Picej @ 2021-11-15 13:02 UTC (permalink / raw)
  To: barebox; +Cc: Y.Bas, s.riedmueller

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

Signed-off-by: Andrej Picej <andrej.picej@norik.com>
---
 arch/arm/configs/phytec-som-imx6.config | 10 ++++++++++
 1 file changed, 10 insertions(+)
 create mode 100644 arch/arm/configs/phytec-som-imx6.config

diff --git a/arch/arm/configs/phytec-som-imx6.config b/arch/arm/configs/phytec-som-imx6.config
new file mode 100644
index 000000000..a7d5bae59
--- /dev/null
+++ b/arch/arm/configs/phytec-som-imx6.config
@@ -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
-- 
2.25.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 3/5] regulator: allow use of dummy regulator
  2021-11-15 13:02 [PATCH 0/5] PHYTEC patches to be mainlined Andrej Picej
  2021-11-15 13:02 ` [PATCH 1/5] flash-header-phytec-pcl063: Set SOC voltage to 1.25 V during boot Andrej Picej
  2021-11-15 13:02 ` [PATCH 2/5] ARM: configs: phytec-som-imx6.config Andrej Picej
@ 2021-11-15 13:02 ` Andrej Picej
  2021-11-17  7:21   ` Sascha Hauer
  2021-11-15 13:02 ` [PATCH 4/5] ARM: dts: imx6qdl: pfla02: allow use of dummy regulators Andrej Picej
  2021-11-15 13:02 ` [PATCH 5/5] documentation: regulator: add dummy-supply Andrej Picej
  4 siblings, 1 reply; 12+ messages in thread
From: Andrej Picej @ 2021-11-15 13:02 UTC (permalink / raw)
  To: barebox; +Cc: Y.Bas, s.riedmueller

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.

Signed-off-by: Andrej Picej <andrej.picej@norik.com>
---
 drivers/regulator/core.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 097f7d779..1c58932e1 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -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) {
-- 
2.25.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 4/5] ARM: dts: imx6qdl: pfla02: allow use of dummy regulators
  2021-11-15 13:02 [PATCH 0/5] PHYTEC patches to be mainlined Andrej Picej
                   ` (2 preceding siblings ...)
  2021-11-15 13:02 ` [PATCH 3/5] regulator: allow use of dummy regulator Andrej Picej
@ 2021-11-15 13:02 ` Andrej Picej
  2021-11-15 13:02 ` [PATCH 5/5] documentation: regulator: add dummy-supply Andrej Picej
  4 siblings, 0 replies; 12+ messages in thread
From: Andrej Picej @ 2021-11-15 13:02 UTC (permalink / raw)
  To: barebox; +Cc: Y.Bas, s.riedmueller

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.

Signed-off-by: Andrej Picej <andrej.picej@norik.com>
---
 arch/arm/dts/imx6qdl-phytec-pfla02.dtsi | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/arch/arm/dts/imx6qdl-phytec-pfla02.dtsi b/arch/arm/dts/imx6qdl-phytec-pfla02.dtsi
index 0653fcc3c..42d243058 100644
--- a/arch/arm/dts/imx6qdl-phytec-pfla02.dtsi
+++ b/arch/arm/dts/imx6qdl-phytec-pfla02.dtsi
@@ -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>;
-- 
2.25.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 5/5] documentation: regulator: add dummy-supply
  2021-11-15 13:02 [PATCH 0/5] PHYTEC patches to be mainlined Andrej Picej
                   ` (3 preceding siblings ...)
  2021-11-15 13:02 ` [PATCH 4/5] ARM: dts: imx6qdl: pfla02: allow use of dummy regulators Andrej Picej
@ 2021-11-15 13:02 ` Andrej Picej
  4 siblings, 0 replies; 12+ messages in thread
From: Andrej Picej @ 2021-11-15 13:02 UTC (permalink / raw)
  To: barebox; +Cc: Y.Bas, s.riedmueller

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

Signed-off-by: Andrej Picej <andrej.picej@norik.com>
---
 .../bindings/regulator/regulator.rst          | 31 +++++++++++++++++++
 1 file changed, 31 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/regulator.rst

diff --git a/Documentation/devicetree/bindings/regulator/regulator.rst b/Documentation/devicetree/bindings/regulator/regulator.rst
new file mode 100644
index 000000000..4c7f70295
--- /dev/null
+++ b/Documentation/devicetree/bindings/regulator/regulator.rst
@@ -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>;
+  	};
+  };
-- 
2.25.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/5] ARM: configs: phytec-som-imx6.config
  2021-11-15 13:02 ` [PATCH 2/5] ARM: configs: phytec-som-imx6.config Andrej Picej
@ 2021-11-17  7:03   ` Sascha Hauer
  2021-11-17  9:59     ` Stefan Riedmüller
  0 siblings, 1 reply; 12+ messages in thread
From: Sascha Hauer @ 2021-11-17  7:03 UTC (permalink / raw)
  To: Andrej Picej; +Cc: barebox, Y.Bas, s.riedmueller

On Mon, Nov 15, 2021 at 02:02:05PM +0100, Andrej Picej wrote:
> 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.

>      - 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

-- 
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


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 3/5] regulator: allow use of dummy regulator
  2021-11-15 13:02 ` [PATCH 3/5] regulator: allow use of dummy regulator Andrej Picej
@ 2021-11-17  7:21   ` Sascha Hauer
  2021-11-17  8:11     ` Andrej Picej
  0 siblings, 1 reply; 12+ messages in thread
From: Sascha Hauer @ 2021-11-17  7:21 UTC (permalink / raw)
  To: Andrej Picej; +Cc: barebox, Y.Bas, s.riedmueller

On Mon, Nov 15, 2021 at 02:02:06PM +0100, Andrej Picej wrote:
> 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.
> 
> Signed-off-by: Andrej Picej <andrej.picej@norik.com>
> ---
>  drivers/regulator/core.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
> index 097f7d779..1c58932e1 100644
> --- a/drivers/regulator/core.c
> +++ b/drivers/regulator/core.c
> @@ -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);

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


-- 
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


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 3/5] regulator: allow use of dummy regulator
  2021-11-17  7:21   ` Sascha Hauer
@ 2021-11-17  8:11     ` Andrej Picej
  2021-11-17  9:29       ` Andrej Picej
  0 siblings, 1 reply; 12+ messages in thread
From: Andrej Picej @ 2021-11-17  8:11 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox, Y.Bas, s.riedmueller



On 17. 11. 21 08:21, Sascha Hauer wrote:
> On Mon, Nov 15, 2021 at 02:02:06PM +0100, Andrej Picej wrote:
>> 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.
>>
>> Signed-off-by: Andrej Picej <andrej.picej@norik.com>
>> ---
>>   drivers/regulator/core.c | 9 ++++++++-
>>   1 file changed, 8 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
>> index 097f7d779..1c58932e1 100644
>> --- a/drivers/regulator/core.c
>> +++ b/drivers/regulator/core.c
>> @@ -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);
> 
> 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?

>                 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?

>                 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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 3/5] regulator: allow use of dummy regulator
  2021-11-17  8:11     ` Andrej Picej
@ 2021-11-17  9:29       ` Andrej Picej
  0 siblings, 0 replies; 12+ messages in thread
From: Andrej Picej @ 2021-11-17  9:29 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox, Y.Bas, s.riedmueller

On 17. 11. 21 09:11, Andrej Picej wrote:
> 
> 
> On 17. 11. 21 08:21, Sascha Hauer wrote:
>> On Mon, Nov 15, 2021 at 02:02:06PM +0100, Andrej Picej wrote:
>>> 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.
>>>
>>> Signed-off-by: Andrej Picej <andrej.picej@norik.com>
>>> ---
>>>   drivers/regulator/core.c | 9 ++++++++-
>>>   1 file changed, 8 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
>>> index 097f7d779..1c58932e1 100644
>>> --- a/drivers/regulator/core.c
>>> +++ b/drivers/regulator/core.c
>>> @@ -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);
>>
>> 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?
> 
>>                 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?
> 
>>                 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?
> 

Like this:

> diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
> index 097f7d779..4ff7e1c2f 100644
> --- a/drivers/regulator/core.c
> +++ b/drivers/regulator/core.c
> @@ -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 " \
> +                               "%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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/5] ARM: configs: phytec-som-imx6.config
  2021-11-17  7:03   ` Sascha Hauer
@ 2021-11-17  9:59     ` Stefan Riedmüller
  2021-11-17 10:08       ` Andrej Picej
  0 siblings, 1 reply; 12+ messages in thread
From: Stefan Riedmüller @ 2021-11-17  9:59 UTC (permalink / raw)
  To: sha; +Cc: andrej.picej, barebox, Yunus Bas

Hi Sascha,

On Wed, 2021-11-17 at 08:03 +0100, Sascha Hauer wrote:
> On Mon, Nov 15, 2021 at 02:02:05PM +0100, Andrej Picej wrote:
> > 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.

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.

> 
> >      - 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

> 
> Sascha
> 
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/5] ARM: configs: phytec-som-imx6.config
  2021-11-17  9:59     ` Stefan Riedmüller
@ 2021-11-17 10:08       ` Andrej Picej
  0 siblings, 0 replies; 12+ messages in thread
From: Andrej Picej @ 2021-11-17 10:08 UTC (permalink / raw)
  To: Stefan Riedmüller, sha; +Cc: barebox, Yunus Bas

Hi Stefan,

I was waiting for your insight.

> 
> 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.
> 
>>
>>>       - 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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2021-11-17 10:10 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-15 13:02 [PATCH 0/5] PHYTEC patches to be mainlined Andrej Picej
2021-11-15 13:02 ` [PATCH 1/5] flash-header-phytec-pcl063: Set SOC voltage to 1.25 V during boot Andrej Picej
2021-11-15 13:02 ` [PATCH 2/5] ARM: configs: phytec-som-imx6.config Andrej Picej
2021-11-17  7:03   ` Sascha Hauer
2021-11-17  9:59     ` Stefan Riedmüller
2021-11-17 10:08       ` Andrej Picej
2021-11-15 13:02 ` [PATCH 3/5] regulator: allow use of dummy regulator Andrej Picej
2021-11-17  7:21   ` Sascha Hauer
2021-11-17  8:11     ` Andrej Picej
2021-11-17  9:29       ` Andrej Picej
2021-11-15 13:02 ` [PATCH 4/5] ARM: dts: imx6qdl: pfla02: allow use of dummy regulators Andrej Picej
2021-11-15 13:02 ` [PATCH 5/5] documentation: regulator: add dummy-supply Andrej Picej

mail archive of the barebox mailing list

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://lore.barebox.org/barebox/0 barebox/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 barebox barebox/ https://lore.barebox.org/barebox \
		barebox@lists.infradead.org
	public-inbox-index barebox

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git