linux-rockchip.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arm64: dts: rockchip: add attiny_rst_gate to Ringneck
@ 2024-02-01 12:44 Jakob Unterwurzacher
  2024-09-26 11:24 ` Quentin Schulz
  0 siblings, 1 reply; 8+ messages in thread
From: Jakob Unterwurzacher @ 2024-02-01 12:44 UTC (permalink / raw)
  To: linux-rockchip; +Cc: Heiko Stuebner, jakob.unterwurzacher, linux-kernel

Ringneck v1.4 can contain (placement option) an on-board ATtiny
microcontroller instead of an STM32. In normal operation, this
is transparent to the software, as both microcontrollers emulate
the same ICs (amc6821 and isl1208).

For flashing the ATtiny, the SWITCH_REG1 regulator of the board's PMIC is
used to enable the ATtiny UPDI debug interface. If the STM32 is placed, or if
we are running on an older Ringneck revision, SWITCH_REG1 is not connected
and has no effect.

Add attiny-updi-gate-regulator so userspace can control it via sysfs:

  echo enabled > /sys/devices/platform/attiny-updi-gate-regulator/state

Signed-off-by: Jakob Unterwurzacher <jakob.unterwurzacher@theobroma-systems.com>
---
 arch/arm64/boot/dts/rockchip/px30-ringneck.dtsi | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/arch/arm64/boot/dts/rockchip/px30-ringneck.dtsi b/arch/arm64/boot/dts/rockchip/px30-ringneck.dtsi
index dec29a75d361..1f7f4b2ea66a 100644
--- a/arch/arm64/boot/dts/rockchip/px30-ringneck.dtsi
+++ b/arch/arm64/boot/dts/rockchip/px30-ringneck.dtsi
@@ -15,6 +15,12 @@ aliases {
 		rtc1 = &rk809;
 	};
 
+	/* allows userspace to control the gate of the ATtiny UPDI pass FET via sysfs */
+	attiny-updi-gate-regulator {
+		compatible = "regulator-output";
+		vout-supply = <&vg_attiny_updi>;
+	};
+
 	emmc_pwrseq: emmc-pwrseq {
 		compatible = "mmc-pwrseq-emmc";
 		pinctrl-0 = <&emmc_reset>;
@@ -146,6 +152,7 @@ rk809: pmic@20 {
 		vcc5-supply = <&vcc_3v3>;
 		vcc6-supply = <&vcc_3v3>;
 		vcc7-supply = <&vcc_3v3>;
+		vcc8-supply = <&vcc5v0_sys>;
 		vcc9-supply = <&vcc5v0_sys>;
 
 		regulators {
@@ -290,6 +297,11 @@ regulator-state-mem {
 					regulator-suspend-microvolt = <1800000>;
 				};
 			};
+
+			/* supplies the gate of the ATtiny UPDI pass FET */
+			vg_attiny_updi: SWITCH_REG1 {
+				regulator-name = "vg_attiny_updi";
+			};
 		};
 	};
 };
-- 
2.43.0


_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

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

* Re: [PATCH] arm64: dts: rockchip: add attiny_rst_gate to Ringneck
  2024-02-01 12:44 [PATCH] arm64: dts: rockchip: add attiny_rst_gate to Ringneck Jakob Unterwurzacher
@ 2024-09-26 11:24 ` Quentin Schulz
  2024-09-26 13:20   ` [PATCH v2] " Jakob Unterwurzacher
  0 siblings, 1 reply; 8+ messages in thread
From: Quentin Schulz @ 2024-09-26 11:24 UTC (permalink / raw)
  To: Jakob Unterwurzacher, linux-rockchip
  Cc: Heiko Stuebner, jakob.unterwurzacher, linux-kernel

Hi Jakob,

On 2/1/24 1:44 PM, Jakob Unterwurzacher wrote:
> Ringneck v1.4 can contain (placement option) an on-board ATtiny
> microcontroller instead of an STM32. In normal operation, this
> is transparent to the software, as both microcontrollers emulate
> the same ICs (amc6821 and isl1208).
> 
> For flashing the ATtiny, the SWITCH_REG1 regulator of the board's PMIC is
> used to enable the ATtiny UPDI debug interface. If the STM32 is placed, or if
> we are running on an older Ringneck revision, SWITCH_REG1 is not connected
> and has no effect.
> 
> Add attiny-updi-gate-regulator so userspace can control it via sysfs:
> 
>    echo enabled > /sys/devices/platform/attiny-updi-gate-regulator/state
> 

CONFIG_REGULATOR_USERSPACE_CONSUMER needs to be enabled for this to 
work. Just putting this here as I had forgotten and was wondering why 
this sysfs file wasn't available to me :)

> Signed-off-by: Jakob Unterwurzacher <jakob.unterwurzacher@theobroma-systems.com>

I finally have access to some HW to test this, and therefore can give my:

Tested-by: Quentin Schulz <quentin.schulz@cherry.de>

> ---
>   arch/arm64/boot/dts/rockchip/px30-ringneck.dtsi | 12 ++++++++++++
>   1 file changed, 12 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/rockchip/px30-ringneck.dtsi b/arch/arm64/boot/dts/rockchip/px30-ringneck.dtsi
> index dec29a75d361..1f7f4b2ea66a 100644
> --- a/arch/arm64/boot/dts/rockchip/px30-ringneck.dtsi
> +++ b/arch/arm64/boot/dts/rockchip/px30-ringneck.dtsi
> @@ -15,6 +15,12 @@ aliases {
>   		rtc1 = &rk809;
>   	};
>   
> +	/* allows userspace to control the gate of the ATtiny UPDI pass FET via sysfs */
> +	attiny-updi-gate-regulator {
> +		compatible = "regulator-output";
> +		vout-supply = <&vg_attiny_updi>;
> +	};
> +
>   	emmc_pwrseq: emmc-pwrseq {
>   		compatible = "mmc-pwrseq-emmc";
>   		pinctrl-0 = <&emmc_reset>;
> @@ -146,6 +152,7 @@ rk809: pmic@20 {
>   		vcc5-supply = <&vcc_3v3>;
>   		vcc6-supply = <&vcc_3v3>;
>   		vcc7-supply = <&vcc_3v3>;
> +		vcc8-supply = <&vcc5v0_sys>;

According to the schematics, vcc8 is routed to SWITCH_REG2 and not 
SWITCH_REG1, which is fed vcc9. Even more so, vcc8 on the PMIC isn't 
actually routed.

I therefore think we can simply remove this line here.

@Jakob, do you agree? Can you send a v2 if so?

Cheers,
Quentin

_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

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

* [PATCH v2] arm64: dts: rockchip: add attiny_rst_gate to Ringneck
  2024-09-26 11:24 ` Quentin Schulz
@ 2024-09-26 13:20   ` Jakob Unterwurzacher
  2024-09-26 13:24     ` Quentin Schulz
  2024-09-30 10:55     ` Heiko Stuebner
  0 siblings, 2 replies; 8+ messages in thread
From: Jakob Unterwurzacher @ 2024-09-26 13:20 UTC (permalink / raw)
  To: quentin.schulz
  Cc: heiko, jakobunt, linux-kernel, linux-rockchip,
	Jakob Unterwurzacher

Ringneck v1.4 can contain (placement option) an on-board ATtiny
microcontroller instead of an STM32. In normal operation, this
is transparent to the software, as both microcontrollers emulate
the same ICs (amc6821 and isl1208).

For flashing the ATtiny, the SWITCH_REG1 regulator of the board's PMIC is
used to enable the ATtiny UPDI debug interface. If the STM32 is placed, or if
we are running on an older Ringneck revision, SWITCH_REG1 is not connected
and has no effect.

Add attiny-updi-gate-regulator so userspace can control it via sysfs
(needs CONFIG_REGULATOR_USERSPACE_CONSUMER):

  echo enabled > /sys/devices/platform/attiny-updi-gate-regulator/state

Signed-off-by: Jakob Unterwurzacher <jakob.unterwurzacher@cherry.de>
Tested-by: Quentin Schulz <quentin.schulz@cherry.de>
---
v2: remove vcc8-supply

 arch/arm64/boot/dts/rockchip/px30-ringneck.dtsi | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/arch/arm64/boot/dts/rockchip/px30-ringneck.dtsi b/arch/arm64/boot/dts/rockchip/px30-ringneck.dtsi
index bb1aea82e666e..216a6b6a6ee74 100644
--- a/arch/arm64/boot/dts/rockchip/px30-ringneck.dtsi
+++ b/arch/arm64/boot/dts/rockchip/px30-ringneck.dtsi
@@ -15,6 +15,12 @@ aliases {
 		rtc1 = &rk809;
 	};
 
+	/* allows userspace to control the gate of the ATtiny UPDI pass FET via sysfs */
+	attiny-updi-gate-regulator {
+		compatible = "regulator-output";
+		vout-supply = <&vg_attiny_updi>;
+	};
+
 	emmc_pwrseq: emmc-pwrseq {
 		compatible = "mmc-pwrseq-emmc";
 		pinctrl-0 = <&emmc_reset>;
@@ -281,6 +287,11 @@ regulator-state-mem {
 					regulator-suspend-microvolt = <1800000>;
 				};
 			};
+
+			/* supplies the gate of the ATtiny UPDI pass FET */
+			vg_attiny_updi: SWITCH_REG1 {
+				regulator-name = "vg_attiny_updi";
+			};
 		};
 	};
 };
-- 
2.39.2


_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

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

* Re: [PATCH v2] arm64: dts: rockchip: add attiny_rst_gate to Ringneck
  2024-09-26 13:20   ` [PATCH v2] " Jakob Unterwurzacher
@ 2024-09-26 13:24     ` Quentin Schulz
  2024-09-27  9:39       ` Heiko Stuebner
  2024-09-30 10:55     ` Heiko Stuebner
  1 sibling, 1 reply; 8+ messages in thread
From: Quentin Schulz @ 2024-09-26 13:24 UTC (permalink / raw)
  To: Jakob Unterwurzacher
  Cc: heiko, linux-kernel, linux-rockchip, Jakob Unterwurzacher

Hi Jakob,

On 9/26/24 3:20 PM, Jakob Unterwurzacher wrote:
> Ringneck v1.4 can contain (placement option) an on-board ATtiny
> microcontroller instead of an STM32. In normal operation, this
> is transparent to the software, as both microcontrollers emulate
> the same ICs (amc6821 and isl1208).
> 
> For flashing the ATtiny, the SWITCH_REG1 regulator of the board's PMIC is
> used to enable the ATtiny UPDI debug interface. If the STM32 is placed, or if
> we are running on an older Ringneck revision, SWITCH_REG1 is not connected
> and has no effect.
> 
> Add attiny-updi-gate-regulator so userspace can control it via sysfs
> (needs CONFIG_REGULATOR_USERSPACE_CONSUMER):
> 
>    echo enabled > /sys/devices/platform/attiny-updi-gate-regulator/state
> 
> Signed-off-by: Jakob Unterwurzacher <jakob.unterwurzacher@cherry.de>
> Tested-by: Quentin Schulz <quentin.schulz@cherry.de>

Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>

This is a candidate for backporting to stable branches as well I assume, 
@Heiko?

Thanks!
Quentin

_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

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

* Re: [PATCH v2] arm64: dts: rockchip: add attiny_rst_gate to Ringneck
  2024-09-26 13:24     ` Quentin Schulz
@ 2024-09-27  9:39       ` Heiko Stuebner
  2024-09-27  9:50         ` Quentin Schulz
  0 siblings, 1 reply; 8+ messages in thread
From: Heiko Stuebner @ 2024-09-27  9:39 UTC (permalink / raw)
  To: Jakob Unterwurzacher, Quentin Schulz
  Cc: linux-kernel, linux-rockchip, Jakob Unterwurzacher

Am Donnerstag, 26. September 2024, 15:24:03 CEST schrieb Quentin Schulz:
> Hi Jakob,
> 
> On 9/26/24 3:20 PM, Jakob Unterwurzacher wrote:
> > Ringneck v1.4 can contain (placement option) an on-board ATtiny
> > microcontroller instead of an STM32. In normal operation, this
> > is transparent to the software, as both microcontrollers emulate
> > the same ICs (amc6821 and isl1208).
> > 
> > For flashing the ATtiny, the SWITCH_REG1 regulator of the board's PMIC is
> > used to enable the ATtiny UPDI debug interface. If the STM32 is placed, or if
> > we are running on an older Ringneck revision, SWITCH_REG1 is not connected
> > and has no effect.
> > 
> > Add attiny-updi-gate-regulator so userspace can control it via sysfs
> > (needs CONFIG_REGULATOR_USERSPACE_CONSUMER):
> > 
> >    echo enabled > /sys/devices/platform/attiny-updi-gate-regulator/state
> > 
> > Signed-off-by: Jakob Unterwurzacher <jakob.unterwurzacher@cherry.de>
> > Tested-by: Quentin Schulz <quentin.schulz@cherry.de>
> 
> Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
> 
> This is a candidate for backporting to stable branches as well I assume, 
> @Heiko?

That is more on the darker side of gray here.

Looking at the stable-kernel-rules [0] the criteria is
  "It must either fix a real bug that bothers people or just add a device ID"

This change instead is adding a new feature to allow said flashing from a
running system.

sidenote: please don't post new versions as replies to previous versions,
as that confuses tooling a lot.

Heiko


[0] https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html



_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

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

* Re: [PATCH v2] arm64: dts: rockchip: add attiny_rst_gate to Ringneck
  2024-09-27  9:39       ` Heiko Stuebner
@ 2024-09-27  9:50         ` Quentin Schulz
  2024-09-27 14:48           ` Heiko Stuebner
  0 siblings, 1 reply; 8+ messages in thread
From: Quentin Schulz @ 2024-09-27  9:50 UTC (permalink / raw)
  To: Heiko Stuebner, Jakob Unterwurzacher
  Cc: linux-kernel, linux-rockchip, Jakob Unterwurzacher

Hi Heiko,

On 9/27/24 11:39 AM, Heiko Stuebner wrote:
> Am Donnerstag, 26. September 2024, 15:24:03 CEST schrieb Quentin Schulz:
>> Hi Jakob,
>>
>> On 9/26/24 3:20 PM, Jakob Unterwurzacher wrote:
>>> Ringneck v1.4 can contain (placement option) an on-board ATtiny
>>> microcontroller instead of an STM32. In normal operation, this
>>> is transparent to the software, as both microcontrollers emulate
>>> the same ICs (amc6821 and isl1208).
>>>
>>> For flashing the ATtiny, the SWITCH_REG1 regulator of the board's PMIC is
>>> used to enable the ATtiny UPDI debug interface. If the STM32 is placed, or if
>>> we are running on an older Ringneck revision, SWITCH_REG1 is not connected
>>> and has no effect.
>>>
>>> Add attiny-updi-gate-regulator so userspace can control it via sysfs
>>> (needs CONFIG_REGULATOR_USERSPACE_CONSUMER):
>>>
>>>     echo enabled > /sys/devices/platform/attiny-updi-gate-regulator/state
>>>
>>> Signed-off-by: Jakob Unterwurzacher <jakob.unterwurzacher@cherry.de>
>>> Tested-by: Quentin Schulz <quentin.schulz@cherry.de>
>>
>> Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
>>
>> This is a candidate for backporting to stable branches as well I assume,
>> @Heiko?
> 
> That is more on the darker side of gray here.
> 
> Looking at the stable-kernel-rules [0] the criteria is
>    "It must either fix a real bug that bothers people or just add a device ID"
> 
> This change instead is adding a new feature to allow said flashing from a
> running system.
> 

This does mean that the new version of the device won't work as well 
with an older kernel though.

I thought the rules for DT backporting were a bit more permissive than 
for drivers. Maybe because most of the DT patches I posted were actual 
fixes :)

Up to you!

Cheers,
Quentin

_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

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

* Re: [PATCH v2] arm64: dts: rockchip: add attiny_rst_gate to Ringneck
  2024-09-27  9:50         ` Quentin Schulz
@ 2024-09-27 14:48           ` Heiko Stuebner
  0 siblings, 0 replies; 8+ messages in thread
From: Heiko Stuebner @ 2024-09-27 14:48 UTC (permalink / raw)
  To: Jakob Unterwurzacher, Quentin Schulz
  Cc: linux-kernel, linux-rockchip, Jakob Unterwurzacher

Hey Quentin,

Am Freitag, 27. September 2024, 11:50:46 CEST schrieb Quentin Schulz:
> On 9/27/24 11:39 AM, Heiko Stuebner wrote:
> > Am Donnerstag, 26. September 2024, 15:24:03 CEST schrieb Quentin Schulz:
> >> Hi Jakob,
> >>
> >> On 9/26/24 3:20 PM, Jakob Unterwurzacher wrote:
> >>> Ringneck v1.4 can contain (placement option) an on-board ATtiny
> >>> microcontroller instead of an STM32. In normal operation, this
> >>> is transparent to the software, as both microcontrollers emulate
> >>> the same ICs (amc6821 and isl1208).
> >>>
> >>> For flashing the ATtiny, the SWITCH_REG1 regulator of the board's PMIC is
> >>> used to enable the ATtiny UPDI debug interface. If the STM32 is placed, or if
> >>> we are running on an older Ringneck revision, SWITCH_REG1 is not connected
> >>> and has no effect.
> >>>
> >>> Add attiny-updi-gate-regulator so userspace can control it via sysfs
> >>> (needs CONFIG_REGULATOR_USERSPACE_CONSUMER):
> >>>
> >>>     echo enabled > /sys/devices/platform/attiny-updi-gate-regulator/state
> >>>
> >>> Signed-off-by: Jakob Unterwurzacher <jakob.unterwurzacher@cherry.de>
> >>> Tested-by: Quentin Schulz <quentin.schulz@cherry.de>
> >>
> >> Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
> >>
> >> This is a candidate for backporting to stable branches as well I assume,
> >> @Heiko?
> > 
> > That is more on the darker side of gray here.
> > 
> > Looking at the stable-kernel-rules [0] the criteria is
> >    "It must either fix a real bug that bothers people or just add a device ID"
> > 
> > This change instead is adding a new feature to allow said flashing from a
> > running system.
> > 
> 
> This does mean that the new version of the device won't work as well 
> with an older kernel though.

"new version of the device" being the key here ;-) .

You also would not expect a new board dts or a new board variant to be
added to stable-kernels.


Heiko



_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

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

* Re: [PATCH v2] arm64: dts: rockchip: add attiny_rst_gate to Ringneck
  2024-09-26 13:20   ` [PATCH v2] " Jakob Unterwurzacher
  2024-09-26 13:24     ` Quentin Schulz
@ 2024-09-30 10:55     ` Heiko Stuebner
  1 sibling, 0 replies; 8+ messages in thread
From: Heiko Stuebner @ 2024-09-30 10:55 UTC (permalink / raw)
  To: Jakob Unterwurzacher, quentin.schulz
  Cc: Heiko Stuebner, linux-rockchip, linux-kernel,
	Jakob Unterwurzacher

On Thu, 26 Sep 2024 15:20:30 +0200, Jakob Unterwurzacher wrote:
> Ringneck v1.4 can contain (placement option) an on-board ATtiny
> microcontroller instead of an STM32. In normal operation, this
> is transparent to the software, as both microcontrollers emulate
> the same ICs (amc6821 and isl1208).
> 
> For flashing the ATtiny, the SWITCH_REG1 regulator of the board's PMIC is
> used to enable the ATtiny UPDI debug interface. If the STM32 is placed, or if
> we are running on an older Ringneck revision, SWITCH_REG1 is not connected
> and has no effect.
> 
> [...]

Applied, thanks!

[1/1] arm64: dts: rockchip: add attiny_rst_gate to Ringneck
      commit: 1871e6f7c5e606b97708af50a7fec83a904a761b

Best regards,
-- 
Heiko Stuebner <heiko@sntech.de>

_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

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

end of thread, other threads:[~2024-09-30 10:58 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-01 12:44 [PATCH] arm64: dts: rockchip: add attiny_rst_gate to Ringneck Jakob Unterwurzacher
2024-09-26 11:24 ` Quentin Schulz
2024-09-26 13:20   ` [PATCH v2] " Jakob Unterwurzacher
2024-09-26 13:24     ` Quentin Schulz
2024-09-27  9:39       ` Heiko Stuebner
2024-09-27  9:50         ` Quentin Schulz
2024-09-27 14:48           ` Heiko Stuebner
2024-09-30 10:55     ` Heiko Stuebner

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