devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] PHYTEC i.MX6 device-tree fixes
@ 2023-07-04  8:03 Andrej Picej
  2023-07-04  8:03 ` [PATCH 1/2] ARM: dts: imx6: phytec: fix RTC interrupt level Andrej Picej
  2023-07-04  8:03 ` [PATCH 2/2] ARM: dts: imx6: pfla02: Fix SD card reboot problem Andrej Picej
  0 siblings, 2 replies; 13+ messages in thread
From: Andrej Picej @ 2023-07-04  8:03 UTC (permalink / raw)
  To: robh+dt, krzysztof.kozlowski+dt, conor+dt, shawnguo, s.hauer,
	kernel, festevam, linux-imx
  Cc: devicetree, linux-arm-kernel, linux-kernel, upstream

Hi all,

quick evaluation of booting PHYTEC i.MX6 boards with upstream kernel
reveled some obvious problems which are fixed with this two (one-liner)
device-tree patches.

Tested with PHYTEC's phyboard-mira-3 and phyflex-imx6-1 boards.

Best regards,
Andrej

Andrej Picej (2):
  ARM: dts: imx6: phytec: fix RTC interrupt level
  ARM: dts: imx6: pfla02: Fix SD card reboot problem

 arch/arm/boot/dts/imx6qdl-phytec-mira.dtsi   | 2 +-
 arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

-- 
2.25.1


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

* [PATCH 1/2] ARM: dts: imx6: phytec: fix RTC interrupt level
  2023-07-04  8:03 [PATCH 0/2] PHYTEC i.MX6 device-tree fixes Andrej Picej
@ 2023-07-04  8:03 ` Andrej Picej
  2023-07-04  8:03 ` [PATCH 2/2] ARM: dts: imx6: pfla02: Fix SD card reboot problem Andrej Picej
  1 sibling, 0 replies; 13+ messages in thread
From: Andrej Picej @ 2023-07-04  8:03 UTC (permalink / raw)
  To: robh+dt, krzysztof.kozlowski+dt, conor+dt, shawnguo, s.hauer,
	kernel, festevam, linux-imx
  Cc: devicetree, linux-arm-kernel, linux-kernel, upstream

RTC interrupt level should be set to "LOW". This was revealed by the
introduction of commit:

  f181987ef477 ("rtc: m41t80: use IRQ flags obtained from fwnode")

which changed the way IRQ type is obtained.

Signed-off-by: Andrej Picej <andrej.picej@norik.com>
---
 arch/arm/boot/dts/imx6qdl-phytec-mira.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/imx6qdl-phytec-mira.dtsi b/arch/arm/boot/dts/imx6qdl-phytec-mira.dtsi
index 1a599c294ab8..1ca4d219609f 100644
--- a/arch/arm/boot/dts/imx6qdl-phytec-mira.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-phytec-mira.dtsi
@@ -182,7 +182,7 @@ i2c_rtc: rtc@68 {
 		pinctrl-0 = <&pinctrl_rtc_int>;
 		reg = <0x68>;
 		interrupt-parent = <&gpio7>;
-		interrupts = <8 IRQ_TYPE_LEVEL_HIGH>;
+		interrupts = <8 IRQ_TYPE_LEVEL_LOW>;
 		status = "disabled";
 	};
 };
-- 
2.25.1


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

* [PATCH 2/2] ARM: dts: imx6: pfla02: Fix SD card reboot problem
  2023-07-04  8:03 [PATCH 0/2] PHYTEC i.MX6 device-tree fixes Andrej Picej
  2023-07-04  8:03 ` [PATCH 1/2] ARM: dts: imx6: phytec: fix RTC interrupt level Andrej Picej
@ 2023-07-04  8:03 ` Andrej Picej
  2023-07-04  8:15   ` Ahmad Fatoum
  2023-07-04  8:17   ` Marco Felsch
  1 sibling, 2 replies; 13+ messages in thread
From: Andrej Picej @ 2023-07-04  8:03 UTC (permalink / raw)
  To: robh+dt, krzysztof.kozlowski+dt, conor+dt, shawnguo, s.hauer,
	kernel, festevam, linux-imx
  Cc: devicetree, linux-arm-kernel, linux-kernel, upstream

If regulator is not marked as always-on the regulator gets disabled on
reboot breaking the next boot.

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

diff --git a/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi b/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi
index 80adb2a02cc9..25d6a036d5b8 100644
--- a/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi
@@ -192,6 +192,7 @@ vdd_3v3_pmic_io_reg: ldo6 {
 			vdd_sd0_reg: ldo9 {
 				regulator-min-microvolt = <3300000>;
 				regulator-max-microvolt = <3300000>;
+				regulator-always-on;
 			};
 
 			vdd_sd1_reg: ldo10 {
-- 
2.25.1


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

* Re: [PATCH 2/2] ARM: dts: imx6: pfla02: Fix SD card reboot problem
  2023-07-04  8:03 ` [PATCH 2/2] ARM: dts: imx6: pfla02: Fix SD card reboot problem Andrej Picej
@ 2023-07-04  8:15   ` Ahmad Fatoum
       [not found]     ` <02d491bb-2a40-4909-ebc3-be2e183cfcbb@norik.com>
  2023-07-04  8:17   ` Marco Felsch
  1 sibling, 1 reply; 13+ messages in thread
From: Ahmad Fatoum @ 2023-07-04  8:15 UTC (permalink / raw)
  To: Andrej Picej, robh+dt, krzysztof.kozlowski+dt, conor+dt, shawnguo,
	s.hauer, kernel, festevam, linux-imx
  Cc: devicetree, linux-kernel, linux-arm-kernel, upstream

Hello Andrej,

On 04.07.23 10:03, Andrej Picej wrote:
> If regulator is not marked as always-on the regulator gets disabled on
> reboot breaking the next boot.

While this is ok as a fix, the real issue is that your system reset doesn't
restore PMIC rails to a good state. Are you perhaps doing a SoC-internal
reset only or have the PMIC misconfigured?

Cheers,
Ahmad

> 
> Signed-off-by: Andrej Picej <andrej.picej@norik.com>
> ---
>  arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi b/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi
> index 80adb2a02cc9..25d6a036d5b8 100644
> --- a/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi
> +++ b/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi
> @@ -192,6 +192,7 @@ vdd_3v3_pmic_io_reg: ldo6 {
>  			vdd_sd0_reg: ldo9 {
>  				regulator-min-microvolt = <3300000>;
>  				regulator-max-microvolt = <3300000>;
> +				regulator-always-on;
>  			};
>  
>  			vdd_sd1_reg: ldo10 {

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


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

* Re: [PATCH 2/2] ARM: dts: imx6: pfla02: Fix SD card reboot problem
  2023-07-04  8:03 ` [PATCH 2/2] ARM: dts: imx6: pfla02: Fix SD card reboot problem Andrej Picej
  2023-07-04  8:15   ` Ahmad Fatoum
@ 2023-07-04  8:17   ` Marco Felsch
  2023-07-05  8:28     ` Andrej Picej
  1 sibling, 1 reply; 13+ messages in thread
From: Marco Felsch @ 2023-07-04  8:17 UTC (permalink / raw)
  To: Andrej Picej
  Cc: robh+dt, krzysztof.kozlowski+dt, conor+dt, shawnguo, s.hauer,
	kernel, festevam, linux-imx, devicetree, linux-kernel,
	linux-arm-kernel, upstream

On 23-07-04, Andrej Picej wrote:
> If regulator is not marked as always-on the regulator gets disabled on
> reboot breaking the next boot.
> 
> Signed-off-by: Andrej Picej <andrej.picej@norik.com>
> ---
>  arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi b/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi
> index 80adb2a02cc9..25d6a036d5b8 100644
> --- a/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi
> +++ b/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi
> @@ -192,6 +192,7 @@ vdd_3v3_pmic_io_reg: ldo6 {
>  			vdd_sd0_reg: ldo9 {
>  				regulator-min-microvolt = <3300000>;
>  				regulator-max-microvolt = <3300000>;
> +				regulator-always-on;

I think this is the supply for the sd-card, so you can make use of
'vmmc-supply'.

Regards,
  Marco

>  			};
>  
>  			vdd_sd1_reg: ldo10 {
> -- 
> 2.25.1
> 
> 
> 

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

* Re: [PATCH 2/2] ARM: dts: imx6: pfla02: Fix SD card reboot problem
       [not found]     ` <02d491bb-2a40-4909-ebc3-be2e183cfcbb@norik.com>
@ 2023-07-05  8:26       ` Ahmad Fatoum
  0 siblings, 0 replies; 13+ messages in thread
From: Ahmad Fatoum @ 2023-07-05  8:26 UTC (permalink / raw)
  To: Andrej Picej
  Cc: robh+dt, krzysztof.kozlowski+dt, conor+dt, shawnguo, s.hauer,
	kernel, festevam, linux-imx, devicetree, linux-kernel,
	linux-arm-kernel, upstream

Hi Andrej,

[Restoring Cc-list]

On 05.07.23 10:18, Andrej Picej wrote:
> Hi Ahmad,
> 
> On 4. 07. 23 10:15, Ahmad Fatoum wrote:
>> Hello Andrej,
>>
>> On 04.07.23 10:03, Andrej Picej wrote:
>>> If regulator is not marked as always-on the regulator gets disabled on
>>> reboot breaking the next boot.
>>
>> While this is ok as a fix, the real issue is that your system reset doesn't
>> restore PMIC rails to a good state. Are you perhaps doing a SoC-internal
>> reset only or have the PMIC misconfigured?
> 
> yes I would agree, this is just a fix since system reset doesn't reset the PMIC, leaving the configuration as it is in a misconfigured state. The i.MX6 reset is done with imx watchdog.

If PMIC doesn't have own watchdog, i.MX watchdog can be configured to toggle
WDOG_B line, which may be routed to PMIC.

But fix is ok for now:

Acked-by: Ahmad Fatoum <a.fatoum@pengutronix.de>

Cheers,
Ahmad

> 
> Best regards,
> Andrej
> 
>>
>> Cheers,
>> Ahmad
>>
>>>
>>> Signed-off-by: Andrej Picej <andrej.picej@norik.com>
>>> ---
>>>   arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi | 1 +
>>>   1 file changed, 1 insertion(+)
>>>
>>> diff --git a/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi b/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi
>>> index 80adb2a02cc9..25d6a036d5b8 100644
>>> --- a/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi
>>> +++ b/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi
>>> @@ -192,6 +192,7 @@ vdd_3v3_pmic_io_reg: ldo6 {
>>>               vdd_sd0_reg: ldo9 {
>>>                   regulator-min-microvolt = <3300000>;
>>>                   regulator-max-microvolt = <3300000>;
>>> +                regulator-always-on;
>>>               };
>>>                 vdd_sd1_reg: ldo10 {
>>
> 

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


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

* Re: [PATCH 2/2] ARM: dts: imx6: pfla02: Fix SD card reboot problem
  2023-07-04  8:17   ` Marco Felsch
@ 2023-07-05  8:28     ` Andrej Picej
  2023-07-05  8:30       ` Ahmad Fatoum
  0 siblings, 1 reply; 13+ messages in thread
From: Andrej Picej @ 2023-07-05  8:28 UTC (permalink / raw)
  To: Marco Felsch
  Cc: robh+dt, krzysztof.kozlowski+dt, conor+dt, shawnguo, s.hauer,
	kernel, festevam, linux-imx, devicetree, linux-kernel,
	linux-arm-kernel, upstream

Hi Marco,

On 4. 07. 23 10:17, Marco Felsch wrote:
> On 23-07-04, Andrej Picej wrote:
>> If regulator is not marked as always-on the regulator gets disabled on
>> reboot breaking the next boot.
>>
>> Signed-off-by: Andrej Picej <andrej.picej@norik.com>
>> ---
>>   arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi b/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi
>> index 80adb2a02cc9..25d6a036d5b8 100644
>> --- a/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi
>> +++ b/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi
>> @@ -192,6 +192,7 @@ vdd_3v3_pmic_io_reg: ldo6 {
>>   			vdd_sd0_reg: ldo9 {
>>   				regulator-min-microvolt = <3300000>;
>>   				regulator-max-microvolt = <3300000>;
>> +				regulator-always-on;
> 
> I think this is the supply for the sd-card, so you can make use of
> 'vmmc-supply'.

This is already the case:

> &usdhc3 {
> 	pinctrl-names = "default";
> 	pinctrl-0 = <&pinctrl_usdhc3
> 		     &pinctrl_usdhc3_cdwp>;
> 	cd-gpios = <&gpio1 27 GPIO_ACTIVE_LOW>;
> 	wp-gpios = <&gpio1 29 GPIO_ACTIVE_HIGH>;
> 	vmmc-supply = <&vdd_sd0_reg>;
> 	status = "disabled";
> };

I think the main reason for a failed boot is that the PMIC doesn't get 
reset and that the bootloader doesn't specifically enable the SD card 
regulator.

Could this patch still be applied or should we put the fix in reset 
routine/bootloader?

Best regards,
Andrej

> 
> Regards,
>    Marco
> 
>>   			};
>>   
>>   			vdd_sd1_reg: ldo10 {
>> -- 
>> 2.25.1
>>
>>
>>

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

* Re: [PATCH 2/2] ARM: dts: imx6: pfla02: Fix SD card reboot problem
  2023-07-05  8:28     ` Andrej Picej
@ 2023-07-05  8:30       ` Ahmad Fatoum
  2023-07-05  8:40         ` Andrej Picej
  0 siblings, 1 reply; 13+ messages in thread
From: Ahmad Fatoum @ 2023-07-05  8:30 UTC (permalink / raw)
  To: Andrej Picej, Marco Felsch
  Cc: devicetree, conor+dt, krzysztof.kozlowski+dt, festevam, s.hauer,
	linux-kernel, robh+dt, linux-imx, kernel, shawnguo,
	linux-arm-kernel, upstream

On 05.07.23 10:28, Andrej Picej wrote:
> Hi Marco,
> 
> On 4. 07. 23 10:17, Marco Felsch wrote:
>> On 23-07-04, Andrej Picej wrote:
>>> If regulator is not marked as always-on the regulator gets disabled on
>>> reboot breaking the next boot.
>>>
>>> Signed-off-by: Andrej Picej <andrej.picej@norik.com>
>>> ---
>>>   arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi | 1 +
>>>   1 file changed, 1 insertion(+)
>>>
>>> diff --git a/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi b/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi
>>> index 80adb2a02cc9..25d6a036d5b8 100644
>>> --- a/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi
>>> +++ b/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi
>>> @@ -192,6 +192,7 @@ vdd_3v3_pmic_io_reg: ldo6 {
>>>               vdd_sd0_reg: ldo9 {
>>>                   regulator-min-microvolt = <3300000>;
>>>                   regulator-max-microvolt = <3300000>;
>>> +                regulator-always-on;
>>
>> I think this is the supply for the sd-card, so you can make use of
>> 'vmmc-supply'.
> 
> This is already the case:
> 
>> &usdhc3 {
>>     pinctrl-names = "default";
>>     pinctrl-0 = <&pinctrl_usdhc3
>>              &pinctrl_usdhc3_cdwp>;
>>     cd-gpios = <&gpio1 27 GPIO_ACTIVE_LOW>;
>>     wp-gpios = <&gpio1 29 GPIO_ACTIVE_HIGH>;
>>     vmmc-supply = <&vdd_sd0_reg>;
>>     status = "disabled";
>> };
> 
> I think the main reason for a failed boot is that the PMIC doesn't get reset and that the bootloader doesn't specifically enable the SD card regulator.
> 
> Could this patch still be applied or should we put the fix in reset routine/bootloader?

Is SD-Card not main boot medium? From your description, I thought BootROM
will fail to boot before bootloader has a chance to do anything about it.

> 
> Best regards,
> Andrej
> 
>>
>> Regards,
>>    Marco
>>
>>>               };
>>>                 vdd_sd1_reg: ldo10 {
>>> -- 
>>> 2.25.1
>>>
>>>
>>>
> 
> 

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


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

* Re: [PATCH 2/2] ARM: dts: imx6: pfla02: Fix SD card reboot problem
  2023-07-05  8:30       ` Ahmad Fatoum
@ 2023-07-05  8:40         ` Andrej Picej
  2023-07-05 10:39           ` Andrej Picej
  0 siblings, 1 reply; 13+ messages in thread
From: Andrej Picej @ 2023-07-05  8:40 UTC (permalink / raw)
  To: Ahmad Fatoum, Marco Felsch
  Cc: devicetree, conor+dt, krzysztof.kozlowski+dt, festevam, s.hauer,
	linux-kernel, robh+dt, linux-imx, kernel, shawnguo,
	linux-arm-kernel, upstream



On 5. 07. 23 10:30, Ahmad Fatoum wrote:
> On 05.07.23 10:28, Andrej Picej wrote:
>> Hi Marco,
>>
>> On 4. 07. 23 10:17, Marco Felsch wrote:
>>> On 23-07-04, Andrej Picej wrote:
>>>> If regulator is not marked as always-on the regulator gets disabled on
>>>> reboot breaking the next boot.
>>>>
>>>> Signed-off-by: Andrej Picej <andrej.picej@norik.com>
>>>> ---
>>>>    arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi | 1 +
>>>>    1 file changed, 1 insertion(+)
>>>>
>>>> diff --git a/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi b/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi
>>>> index 80adb2a02cc9..25d6a036d5b8 100644
>>>> --- a/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi
>>>> +++ b/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi
>>>> @@ -192,6 +192,7 @@ vdd_3v3_pmic_io_reg: ldo6 {
>>>>                vdd_sd0_reg: ldo9 {
>>>>                    regulator-min-microvolt = <3300000>;
>>>>                    regulator-max-microvolt = <3300000>;
>>>> +                regulator-always-on;
>>>
>>> I think this is the supply for the sd-card, so you can make use of
>>> 'vmmc-supply'.
>>
>> This is already the case:
>>
>>> &usdhc3 {
>>>      pinctrl-names = "default";
>>>      pinctrl-0 = <&pinctrl_usdhc3
>>>               &pinctrl_usdhc3_cdwp>;
>>>      cd-gpios = <&gpio1 27 GPIO_ACTIVE_LOW>;
>>>      wp-gpios = <&gpio1 29 GPIO_ACTIVE_HIGH>;
>>>      vmmc-supply = <&vdd_sd0_reg>;
>>>      status = "disabled";
>>> };
>>
>> I think the main reason for a failed boot is that the PMIC doesn't get reset and that the bootloader doesn't specifically enable the SD card regulator.
>>
>> Could this patch still be applied or should we put the fix in reset routine/bootloader?
> 
> Is SD-Card not main boot medium? From your description, I thought BootROM
> will fail to boot before bootloader has a chance to do anything about it.
> 

Yes sorry, you are absolutly right, the BootROM fails. It confused me 
because I could see the booloader booting, but it was from one of the 
fallback mediums. So I guess fixing the bootloader is not really an option.
Sorry for the confusion.


>>
>> Best regards,
>> Andrej
>>
>>>
>>> Regards,
>>>     Marco
>>>
>>>>                };
>>>>                  vdd_sd1_reg: ldo10 {
>>>> -- 
>>>> 2.25.1
>>>>
>>>>
>>>>
>>
>>
> 

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

* Re: [PATCH 2/2] ARM: dts: imx6: pfla02: Fix SD card reboot problem
  2023-07-05  8:40         ` Andrej Picej
@ 2023-07-05 10:39           ` Andrej Picej
  2023-07-05 12:06             ` Ahmad Fatoum
  0 siblings, 1 reply; 13+ messages in thread
From: Andrej Picej @ 2023-07-05 10:39 UTC (permalink / raw)
  To: Ahmad Fatoum, Marco Felsch
  Cc: devicetree, conor+dt, krzysztof.kozlowski+dt, festevam, s.hauer,
	linux-kernel, robh+dt, linux-imx, kernel, shawnguo,
	linux-arm-kernel, upstream


On 5. 07. 23 10:40, Andrej Picej wrote:
> 
> 
> On 5. 07. 23 10:30, Ahmad Fatoum wrote:
>> On 05.07.23 10:28, Andrej Picej wrote:
>>> Hi Marco,
>>>
>>> On 4. 07. 23 10:17, Marco Felsch wrote:
>>>> On 23-07-04, Andrej Picej wrote:
>>>>> If regulator is not marked as always-on the regulator gets disabled on
>>>>> reboot breaking the next boot.
>>>>>
>>>>> Signed-off-by: Andrej Picej <andrej.picej@norik.com>
>>>>> ---
>>>>>    arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi | 1 +
>>>>>    1 file changed, 1 insertion(+)
>>>>>
>>>>> diff --git a/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi 
>>>>> b/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi
>>>>> index 80adb2a02cc9..25d6a036d5b8 100644
>>>>> --- a/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi
>>>>> +++ b/arch/arm/boot/dts/imx6qdl-phytec-pfla02.dtsi
>>>>> @@ -192,6 +192,7 @@ vdd_3v3_pmic_io_reg: ldo6 {
>>>>>                vdd_sd0_reg: ldo9 {
>>>>>                    regulator-min-microvolt = <3300000>;
>>>>>                    regulator-max-microvolt = <3300000>;
>>>>> +                regulator-always-on;
>>>>
>>>> I think this is the supply for the sd-card, so you can make use of
>>>> 'vmmc-supply'.
>>>
>>> This is already the case:
>>>
>>>> &usdhc3 {
>>>>      pinctrl-names = "default";
>>>>      pinctrl-0 = <&pinctrl_usdhc3
>>>>               &pinctrl_usdhc3_cdwp>;
>>>>      cd-gpios = <&gpio1 27 GPIO_ACTIVE_LOW>;
>>>>      wp-gpios = <&gpio1 29 GPIO_ACTIVE_HIGH>;
>>>>      vmmc-supply = <&vdd_sd0_reg>;
>>>>      status = "disabled";
>>>> };
>>>
>>> I think the main reason for a failed boot is that the PMIC doesn't 
>>> get reset and that the bootloader doesn't specifically enable the SD 
>>> card regulator.
>>>
>>> Could this patch still be applied or should we put the fix in reset 
>>> routine/bootloader?
>>
>> Is SD-Card not main boot medium? From your description, I thought BootROM
>> will fail to boot before bootloader has a chance to do anything about it.
>>
> 
> Yes sorry, you are absolutly right, the BootROM fails. It confused me 
> because I could see the booloader booting, but it was from one of the 
> fallback mediums. So I guess fixing the bootloader is not really an option.
> Sorry for the confusion.
> 

Ok, the main problem is well known, that's why PHYTEC disables the imx 
watchdog and uses a PMIC one for the reboot handler. This one resets the 
board completely. The SD card regulator problem is really just the 
manifestation of that bug. Unfortunately I didn't noticed that. :(

I will create a v2 with a proper fix, where imx watchdog gets disabled.

Thanks for your help,
Andrej


> 
>>>
>>> Best regards,
>>> Andrej
>>>
>>>>
>>>> Regards,
>>>>     Marco
>>>>
>>>>>                };
>>>>>                  vdd_sd1_reg: ldo10 {
>>>>> -- 
>>>>> 2.25.1
>>>>>
>>>>>
>>>>>
>>>
>>>
>>

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

* Re: [PATCH 2/2] ARM: dts: imx6: pfla02: Fix SD card reboot problem
  2023-07-05 10:39           ` Andrej Picej
@ 2023-07-05 12:06             ` Ahmad Fatoum
  2023-07-07  9:28               ` Andrej Picej
  0 siblings, 1 reply; 13+ messages in thread
From: Ahmad Fatoum @ 2023-07-05 12:06 UTC (permalink / raw)
  To: Andrej Picej, Marco Felsch
  Cc: devicetree, conor+dt, krzysztof.kozlowski+dt, festevam, s.hauer,
	linux-kernel, robh+dt, linux-imx, kernel, shawnguo,
	linux-arm-kernel, upstream

On 05.07.23 12:39, Andrej Picej wrote:> On 5. 07. 23 10:40, Andrej Picej wrote:
>> On 5. 07. 23 10:30, Ahmad Fatoum wrote:
>>> On 05.07.23 10:28, Andrej Picej wrote:
>>>> I think the main reason for a failed boot is that the PMIC doesn't get reset and that the bootloader doesn't specifically enable the SD card regulator.
>>>>
>>>> Could this patch still be applied or should we put the fix in reset routine/bootloader?
>>>
>>> Is SD-Card not main boot medium? From your description, I thought BootROM
>>> will fail to boot before bootloader has a chance to do anything about it.
>>>
>>
>> Yes sorry, you are absolutly right, the BootROM fails. It confused me because I could see the booloader booting, but it was from one of the fallback mediums. So I guess fixing the bootloader is not really an option.
>> Sorry for the confusion.
>>
> 
> Ok, the main problem is well known, that's why PHYTEC disables the imx watchdog and uses a PMIC one for the reboot handler. This one resets the board completely. The SD card regulator problem is really just the manifestation of that bug. Unfortunately I didn't noticed that. :(
> 
> I will create a v2 with a proper fix, where imx watchdog gets disabled.

I'd be wary about solving it this way at the DTSI level, because it can
break existing users:

  - Boot flow depends on reading boot reason, but with PMIC reset, everything
    is power-on reset

  - Bootloader starts i.MX watchdog, but new kernel will service only
    PMIC watchdog leading to system reset

  - Even if updating bootloader and kernel together, fallback of kernel
    may end up that bootloader uses PMIC watchdog, but kernel uses i.MX
    watchdog

  - There can be valid reasons to use both watchdogs and disabling
    one at the SoM level breaks that

I had a similar issue once (Board controller reset to be used instead of SoC
reset) and settled on using the barebox watchdog-priority/restart-priority[1]
binding to select the "better" watchdog and then fixed up this choice into
the kernel command line (barebox CONFIG_SYSTEMD_OF_WATCHDOG).

If you decide to fix it for the evaluation kits, please add some text
into the commit message that this fix should not be backported to older kernels.
While it's ultimately the correct thing to do, changing this is IMO not stable
backport material.

[1]: FWIW, there was past discussion about adding restart priorities to Linux, e.g.
https://lore.kernel.org/all/20201006102949.dbw6b2mrgt2ltgpw@pengutronix.de/

Cheers,
Ahmad

> 
> Thanks for your help,
> Andrej
> 
> 
>>
>>>>
>>>> Best regards,
>>>> Andrej
>>>>
>>>>>
>>>>> Regards,
>>>>>     Marco
>>>>>
>>>>>>                };
>>>>>>                  vdd_sd1_reg: ldo10 {
>>>>>> -- 
>>>>>> 2.25.1
>>>>>>
>>>>>>
>>>>>>
>>>>
>>>>
>>>
> 

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


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

* Re: [PATCH 2/2] ARM: dts: imx6: pfla02: Fix SD card reboot problem
  2023-07-05 12:06             ` Ahmad Fatoum
@ 2023-07-07  9:28               ` Andrej Picej
  2023-07-12  8:54                 ` Ahmad Fatoum
  0 siblings, 1 reply; 13+ messages in thread
From: Andrej Picej @ 2023-07-07  9:28 UTC (permalink / raw)
  To: Ahmad Fatoum, Marco Felsch
  Cc: devicetree, conor+dt, krzysztof.kozlowski+dt, festevam, s.hauer,
	linux-kernel, robh+dt, linux-imx, kernel, shawnguo,
	linux-arm-kernel, upstream



On 5. 07. 23 14:06, Ahmad Fatoum wrote:
> On 05.07.23 12:39, Andrej Picej wrote:> On 5. 07. 23 10:40, Andrej Picej wrote:
>>> On 5. 07. 23 10:30, Ahmad Fatoum wrote:
>>>> On 05.07.23 10:28, Andrej Picej wrote:
>>>>> I think the main reason for a failed boot is that the PMIC doesn't get reset and that the bootloader doesn't specifically enable the SD card regulator.
>>>>>
>>>>> Could this patch still be applied or should we put the fix in reset routine/bootloader?
>>>>
>>>> Is SD-Card not main boot medium? From your description, I thought BootROM
>>>> will fail to boot before bootloader has a chance to do anything about it.
>>>>
>>>
>>> Yes sorry, you are absolutly right, the BootROM fails. It confused me because I could see the booloader booting, but it was from one of the fallback mediums. So I guess fixing the bootloader is not really an option.
>>> Sorry for the confusion.
>>>
>>
>> Ok, the main problem is well known, that's why PHYTEC disables the imx watchdog and uses a PMIC one for the reboot handler. This one resets the board completely. The SD card regulator problem is really just the manifestation of that bug. Unfortunately I didn't noticed that. :(
>>
>> I will create a v2 with a proper fix, where imx watchdog gets disabled.
> 
> I'd be wary about solving it this way at the DTSI level, because it can
> break existing users:
> 
>    - Boot flow depends on reading boot reason, but with PMIC reset, everything
>      is power-on reset
> 
>    - Bootloader starts i.MX watchdog, but new kernel will service only
>      PMIC watchdog leading to system reset
> 
>    - Even if updating bootloader and kernel together, fallback of kernel
>      may end up that bootloader uses PMIC watchdog, but kernel uses i.MX
>      watchdog
> 
>    - There can be valid reasons to use both watchdogs and disabling
>      one at the SoM level breaks that
> > I had a similar issue once (Board controller reset to be used instead 
of SoC
> reset) and settled on using the barebox watchdog-priority/restart-priority[1]
> binding to select the "better" watchdog and then fixed up this choice into
> the kernel command line (barebox CONFIG_SYSTEMD_OF_WATCHDOG).
> 
> If you decide to fix it for the evaluation kits, please add some text
> into the commit message that this fix should not be backported to older kernels.
> While it's ultimately the correct thing to do, changing this is IMO not stable
> backport material.
> 
> [1]: FWIW, there was past discussion about adding restart priorities to Linux, e.g.
> https://lore.kernel.org/all/20201006102949.dbw6b2mrgt2ltgpw@pengutronix.de/

Ok I see the problems this might raise. Nevertheless I think it would be 
good to sync upstream and PHYTEC downstream dts with this fix. Since by 
default imx watchdog reset is really a no-go with phyFLEX.
We could add the aliases for the watchdogs, marking the PMIC watchdog as 
watchdog0, and imx watchdog as watchdog1 which I think should tell the 
kernel to use the PMIC reboot handler, but not really sure how is that 
any better then disabling the imx watchdog.

Why do you think this shouldn't be backported to older kernels? Because
someone might use this with "not compatible" bootloader?

Thanks for your help,
Andrej

> 
> Cheers,
> Ahmad
> 
>>
>> Thanks for your help,
>> Andrej
>>
>>
>>>
>>>>>
>>>>> Best regards,
>>>>> Andrej
>>>>>
>>>>>>
>>>>>> Regards,
>>>>>>      Marco
>>>>>>
>>>>>>>                 };
>>>>>>>                   vdd_sd1_reg: ldo10 {
>>>>>>> -- 
>>>>>>> 2.25.1
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>
>>>>>
>>>>
>>
> 

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

* Re: [PATCH 2/2] ARM: dts: imx6: pfla02: Fix SD card reboot problem
  2023-07-07  9:28               ` Andrej Picej
@ 2023-07-12  8:54                 ` Ahmad Fatoum
  0 siblings, 0 replies; 13+ messages in thread
From: Ahmad Fatoum @ 2023-07-12  8:54 UTC (permalink / raw)
  To: Andrej Picej, Marco Felsch
  Cc: devicetree, conor+dt, krzysztof.kozlowski+dt, festevam, s.hauer,
	linux-kernel, robh+dt, linux-imx, kernel, shawnguo,
	linux-arm-kernel, upstream

Hello Andrej,

On 07.07.23 11:28, Andrej Picej wrote:
> 
> 
> On 5. 07. 23 14:06, Ahmad Fatoum wrote:
>> On 05.07.23 12:39, Andrej Picej wrote:> On 5. 07. 23 10:40, Andrej Picej wrote:
>>>> On 5. 07. 23 10:30, Ahmad Fatoum wrote:
>>>>> On 05.07.23 10:28, Andrej Picej wrote:
>>>>>> I think the main reason for a failed boot is that the PMIC doesn't get reset and that the bootloader doesn't specifically enable the SD card regulator.
>>>>>>
>>>>>> Could this patch still be applied or should we put the fix in reset routine/bootloader?
>>>>>
>>>>> Is SD-Card not main boot medium? From your description, I thought BootROM
>>>>> will fail to boot before bootloader has a chance to do anything about it.
>>>>>
>>>>
>>>> Yes sorry, you are absolutly right, the BootROM fails. It confused me because I could see the booloader booting, but it was from one of the fallback mediums. So I guess fixing the bootloader is not really an option.
>>>> Sorry for the confusion.
>>>>
>>>
>>> Ok, the main problem is well known, that's why PHYTEC disables the imx watchdog and uses a PMIC one for the reboot handler. This one resets the board completely. The SD card regulator problem is really just the manifestation of that bug. Unfortunately I didn't noticed that. :(
>>>
>>> I will create a v2 with a proper fix, where imx watchdog gets disabled.
>>
>> I'd be wary about solving it this way at the DTSI level, because it can
>> break existing users:
>>
>>    - Boot flow depends on reading boot reason, but with PMIC reset, everything
>>      is power-on reset
>>
>>    - Bootloader starts i.MX watchdog, but new kernel will service only
>>      PMIC watchdog leading to system reset
>>
>>    - Even if updating bootloader and kernel together, fallback of kernel
>>      may end up that bootloader uses PMIC watchdog, but kernel uses i.MX
>>      watchdog
>>
>>    - There can be valid reasons to use both watchdogs and disabling
>>      one at the SoM level breaks that
>> > I had a similar issue once (Board controller reset to be used instead 
> of SoC
>> reset) and settled on using the barebox watchdog-priority/restart-priority[1]
>> binding to select the "better" watchdog and then fixed up this choice into
>> the kernel command line (barebox CONFIG_SYSTEMD_OF_WATCHDOG).
>>
>> If you decide to fix it for the evaluation kits, please add some text
>> into the commit message that this fix should not be backported to older kernels.
>> While it's ultimately the correct thing to do, changing this is IMO not stable
>> backport material.
>>
>> [1]: FWIW, there was past discussion about adding restart priorities to Linux, e.g.
>> https://lore.kernel.org/all/20201006102949.dbw6b2mrgt2ltgpw@pengutronix.de/
> 
> Ok I see the problems this might raise. Nevertheless I think it would be good to sync upstream and PHYTEC downstream dts with this fix. Since by default imx watchdog reset is really a no-go with phyFLEX.

What does downstream do? Might've been useful to note in the commit message,
especially if there's an erratum.

> We could add the aliases for the watchdogs, marking the PMIC watchdog as watchdog0, and imx watchdog as watchdog1 which I think should tell the kernel to use the PMIC reboot handler, but not really sure how is that any better then disabling the imx watchdog.

Restart priority is set by watchdog_set_restart_priority and both
da906[23] and i.MX watchdog set the same value of 128 here. Might
be worthwhile to increase PMIC over i.MX watchdog priority to ensure
it's taken instead.

> Why do you think this shouldn't be backported to older kernels? Because
> someone might use this with "not compatible" bootloader?

Yes. Selecting a different watchdog is IMO not something that should
come in via a stable update.

Cheers,
Ahmad

> 
> Thanks for your help,
> Andrej
> 
>>
>> Cheers,
>> Ahmad
>>
>>>
>>> Thanks for your help,
>>> Andrej
>>>
>>>
>>>>
>>>>>>
>>>>>> Best regards,
>>>>>> Andrej
>>>>>>
>>>>>>>
>>>>>>> Regards,
>>>>>>>      Marco
>>>>>>>
>>>>>>>>                 };
>>>>>>>>                   vdd_sd1_reg: ldo10 {
>>>>>>>> -- 
>>>>>>>> 2.25.1
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>
>>
> 

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


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

end of thread, other threads:[~2023-07-12  8:54 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-04  8:03 [PATCH 0/2] PHYTEC i.MX6 device-tree fixes Andrej Picej
2023-07-04  8:03 ` [PATCH 1/2] ARM: dts: imx6: phytec: fix RTC interrupt level Andrej Picej
2023-07-04  8:03 ` [PATCH 2/2] ARM: dts: imx6: pfla02: Fix SD card reboot problem Andrej Picej
2023-07-04  8:15   ` Ahmad Fatoum
     [not found]     ` <02d491bb-2a40-4909-ebc3-be2e183cfcbb@norik.com>
2023-07-05  8:26       ` Ahmad Fatoum
2023-07-04  8:17   ` Marco Felsch
2023-07-05  8:28     ` Andrej Picej
2023-07-05  8:30       ` Ahmad Fatoum
2023-07-05  8:40         ` Andrej Picej
2023-07-05 10:39           ` Andrej Picej
2023-07-05 12:06             ` Ahmad Fatoum
2023-07-07  9:28               ` Andrej Picej
2023-07-12  8:54                 ` Ahmad Fatoum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).