diff mbox series

[v2] arm64: dts: rockchip: add attiny_rst_gate to Ringneck

Message ID 20240926132028.21910-1-jakob.unterwurzacher@cherry.de (mailing list archive)
State New
Headers show
Series [v2] arm64: dts: rockchip: add attiny_rst_gate to Ringneck | expand

Commit Message

Jakob Unterwurzacher Sept. 26, 2024, 1:20 p.m. UTC
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(+)

Comments

Quentin Schulz Sept. 26, 2024, 1:24 p.m. UTC | #1
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
Heiko Stuebner Sept. 27, 2024, 9:39 a.m. UTC | #2
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
Quentin Schulz Sept. 27, 2024, 9:50 a.m. UTC | #3
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
Heiko Stuebner Sept. 27, 2024, 2:48 p.m. UTC | #4
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
Heiko Stuebner Sept. 30, 2024, 10:55 a.m. UTC | #5
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,
diff mbox series

Patch

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";
+			};
 		};
 	};
 };