2024-03-21 22:00:21

by Andrew Lunn

[permalink] [raw]
Subject: Re: [PATCH 2/2] arm64: dts: add description for solidrun cn9130 som and clearfog boards

On Thu, Mar 21, 2024 at 10:47:12PM +0100, Josua Mayer wrote:
> Add description for the SolidRun CN9130 SoM, and Clearfog Base / Pro
> reference boards.
>
> The SoM has been designed as a pin-compatible replacement for the older
> Armada 388 based SoM. Therefore it supports the same boards and a
> similar feature set.
>
> Most notable upgrades:
> - 4x Cortex-A72
> - 10Gbps SFP
> - Both eMMC and SD supported at the same time
>
> The developer first supporting this product at SolidRun decided to use
> different filenames for the DTBs: Armada 388 uses the full
> "clearfog" string while cn9130 uses the abbreviation "cf".
> This name is already hard-coded in pre-installed vendor u-boot and can
> not be changed easily.
>
> NOTICE IN CASE ANYBODY WANTS TO SELF-UPGRADE:
> CN9130 SoM has a different footprint from Armada 388 SoM.
> Components on the carrier board below the SoM may collide causing
> damage, such as on Clearfog Base.
>
> Signed-off-by: Josua Mayer <[email protected]>
> ---
> arch/arm64/boot/dts/marvell/Makefile | 2 +
> arch/arm64/boot/dts/marvell/cn9130-cf-base.dts | 138 ++++++++++++++
> arch/arm64/boot/dts/marvell/cn9130-cf-pro.dts | 249 +++++++++++++++++++++++++
> arch/arm64/boot/dts/marvell/cn9130-cf.dtsi | 198 ++++++++++++++++++++
> arch/arm64/boot/dts/marvell/cn9130-sr-som.dtsi | 160 ++++++++++++++++
> 5 files changed, 747 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/marvell/Makefile b/arch/arm64/boot/dts/marvell/Makefile
> index 99b8cb3c49e1..019f2251d696 100644
> --- a/arch/arm64/boot/dts/marvell/Makefile
> +++ b/arch/arm64/boot/dts/marvell/Makefile
> @@ -28,3 +28,5 @@ dtb-$(CONFIG_ARCH_MVEBU) += cn9130-crb-A.dtb
> dtb-$(CONFIG_ARCH_MVEBU) += cn9130-crb-B.dtb
> dtb-$(CONFIG_ARCH_MVEBU) += ac5x-rd-carrier-cn9131.dtb
> dtb-$(CONFIG_ARCH_MVEBU) += ac5-98dx35xx-rd.dtb
> +dtb-$(CONFIG_ARCH_MVEBU) += cn9130-cf-base.dtb
> +dtb-$(CONFIG_ARCH_MVEBU) += cn9130-cf-pro.dtb
> diff --git a/arch/arm64/boot/dts/marvell/cn9130-cf-base.dts b/arch/arm64/boot/dts/marvell/cn9130-cf-base.dts
> new file mode 100644
> index 000000000000..b0067940d5e4
> --- /dev/null
> +++ b/arch/arm64/boot/dts/marvell/cn9130-cf-base.dts
> @@ -0,0 +1,138 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * Copyright (C) 2024 Josua Mayer <[email protected]>
> + *
> + * DTS for SolidRun CN9130 Clearfog Base.
> + *
> + */
> +
> +/dts-v1/;
> +
> +#include <dt-bindings/input/input.h>
> +
> +#include "cn9130.dtsi"
> +#include "cn9130-sr-som.dtsi"
> +#include "cn9130-cf.dtsi"
> +
> +/ {
> + model = "SolidRun CN9130 Clearfog Base";
> + compatible = "solidrun,clearfog-base-a1", "solidrun,clearfog-a1",
> + "solidrun,cn9130-sr-som","marvell,cn9130",
> + "marvell,armada-ap807-quad", "marvell,armada-ap807";
> +
> + gpio-keys {
> + compatible = "gpio-keys";
> + pinctrl-0 = <&rear_button_pins>;
> + pinctrl-names = "default";
> +
> + button-0 {
> + /* The rear SW3 button */
> + label = "Rear Button";
> + gpios = <&cp0_gpio1 31 GPIO_ACTIVE_LOW>;
> + linux,can-disable;
> + linux,code = <BTN_0>;
> + };
> + };
> +
> + rfkill-m2-gnss {
> + compatible = "rfkill-gpio";
> + label = "m.2 GNSS";
> + radio-type = "gps";
> + /* rfkill-gpio inverts internally */
> + shutdown-gpios = <&expander0 9 GPIO_ACTIVE_HIGH>;
> + };
> +
> + /* M.2 is B-keyed, so w-disable is for WWAN */
> + rfkill-m2-wwan {
> + compatible = "rfkill-gpio";
> + label = "m.2 WWAN";
> + radio-type = "wwan";
> + /* rfkill-gpio inverts internally */
> + shutdown-gpios = <&expander0 8 GPIO_ACTIVE_HIGH>;
> + };
> +};
> +
> +/* SRDS #3 - SGMII 1GE */
> +&cp0_eth1 {
> + phy = <&phy1>;
> + phys = <&cp0_comphy3 1>;
> + phy-mode = "sgmii";
> + status = "okay";
> +};
> +

> +&cp0_eth2_phy {
> + /*
> + * Configure LEDs:
> + * - LED[0]: link/activity: On/blink (green)
> + * - LED[1]: link is 100/1000Mbps: On (yellow)
> + * - LED[2]: high impedance (floating)
> + */
> + marvell,reg-init = <3 16 0xf000 0x0a61>;

Sorry, but no. List the LEDs in the PHY node, and they can then be
controlled via /sys/class/leds.

arch/arm/boot/dts/marvell/armada-370-rd.dts is an example.

Andrew


2024-03-22 09:54:30

by Josua Mayer

[permalink] [raw]
Subject: Re: [PATCH 2/2] arm64: dts: add description for solidrun cn9130 som and clearfog boards

Am 21.03.24 um 22:59 schrieb Andrew Lunn:
> On Thu, Mar 21, 2024 at 10:47:12PM +0100, Josua Mayer wrote:
>> Add description for the SolidRun CN9130 SoM, and Clearfog Base / Pro
>> reference boards.
>>
>> The SoM has been designed as a pin-compatible replacement for the older
>> Armada 388 based SoM. Therefore it supports the same boards and a
>> similar feature set.
>>
>> Most notable upgrades:
>> - 4x Cortex-A72
>> - 10Gbps SFP
>> - Both eMMC and SD supported at the same time
>>
>> The developer first supporting this product at SolidRun decided to use
>> different filenames for the DTBs: Armada 388 uses the full
>> "clearfog" string while cn9130 uses the abbreviation "cf".
>> This name is already hard-coded in pre-installed vendor u-boot and can
>> not be changed easily.
>>
>> NOTICE IN CASE ANYBODY WANTS TO SELF-UPGRADE:
>> CN9130 SoM has a different footprint from Armada 388 SoM.
>> Components on the carrier board below the SoM may collide causing
>> damage, such as on Clearfog Base.
>>
>> Signed-off-by: Josua Mayer <[email protected]>
>> ---
>> arch/arm64/boot/dts/marvell/Makefile | 2 +
>> arch/arm64/boot/dts/marvell/cn9130-cf-base.dts | 138 ++++++++++++++
>> arch/arm64/boot/dts/marvell/cn9130-cf-pro.dts | 249 +++++++++++++++++++++++++
>> arch/arm64/boot/dts/marvell/cn9130-cf.dtsi | 198 ++++++++++++++++++++
>> arch/arm64/boot/dts/marvell/cn9130-sr-som.dtsi | 160 ++++++++++++++++
>> 5 files changed, 747 insertions(+)
>>
>> diff --git a/arch/arm64/boot/dts/marvell/Makefile b/arch/arm64/boot/dts/marvell/Makefile
>> index 99b8cb3c49e1..019f2251d696 100644
>> --- a/arch/arm64/boot/dts/marvell/Makefile
>> +++ b/arch/arm64/boot/dts/marvell/Makefile
>> @@ -28,3 +28,5 @@ dtb-$(CONFIG_ARCH_MVEBU) += cn9130-crb-A.dtb
>> dtb-$(CONFIG_ARCH_MVEBU) += cn9130-crb-B.dtb
>> dtb-$(CONFIG_ARCH_MVEBU) += ac5x-rd-carrier-cn9131.dtb
>> dtb-$(CONFIG_ARCH_MVEBU) += ac5-98dx35xx-rd.dtb
>> +dtb-$(CONFIG_ARCH_MVEBU) += cn9130-cf-base.dtb
>> +dtb-$(CONFIG_ARCH_MVEBU) += cn9130-cf-pro.dtb
>> diff --git a/arch/arm64/boot/dts/marvell/cn9130-cf-base.dts b/arch/arm64/boot/dts/marvell/cn9130-cf-base.dts
>> new file mode 100644
>> index 000000000000..b0067940d5e4
>> --- /dev/null
>> +++ b/arch/arm64/boot/dts/marvell/cn9130-cf-base.dts
>> @@ -0,0 +1,138 @@
>> +// SPDX-License-Identifier: GPL-2.0+
>> +/*
>> + * Copyright (C) 2024 Josua Mayer <[email protected]>
>> + *
>> + * DTS for SolidRun CN9130 Clearfog Base.
>> + *
>> + */
>> +
>> +/dts-v1/;
>> +
>> +#include <dt-bindings/input/input.h>
>> +
>> +#include "cn9130.dtsi"
>> +#include "cn9130-sr-som.dtsi"
>> +#include "cn9130-cf.dtsi"
>> +
>> +/ {
>> + model = "SolidRun CN9130 Clearfog Base";
>> + compatible = "solidrun,clearfog-base-a1", "solidrun,clearfog-a1",
>> + "solidrun,cn9130-sr-som","marvell,cn9130",
>> + "marvell,armada-ap807-quad", "marvell,armada-ap807";
>> +
>> + gpio-keys {
>> + compatible = "gpio-keys";
>> + pinctrl-0 = <&rear_button_pins>;
>> + pinctrl-names = "default";
>> +
>> + button-0 {
>> + /* The rear SW3 button */
>> + label = "Rear Button";
>> + gpios = <&cp0_gpio1 31 GPIO_ACTIVE_LOW>;
>> + linux,can-disable;
>> + linux,code = <BTN_0>;
>> + };
>> + };
>> +
>> + rfkill-m2-gnss {
>> + compatible = "rfkill-gpio";
>> + label = "m.2 GNSS";
>> + radio-type = "gps";
>> + /* rfkill-gpio inverts internally */
>> + shutdown-gpios = <&expander0 9 GPIO_ACTIVE_HIGH>;
>> + };
>> +
>> + /* M.2 is B-keyed, so w-disable is for WWAN */
>> + rfkill-m2-wwan {
>> + compatible = "rfkill-gpio";
>> + label = "m.2 WWAN";
>> + radio-type = "wwan";
>> + /* rfkill-gpio inverts internally */
>> + shutdown-gpios = <&expander0 8 GPIO_ACTIVE_HIGH>;
>> + };
>> +};
>> +
>> +/* SRDS #3 - SGMII 1GE */
>> +&cp0_eth1 {
>> + phy = <&phy1>;
>> + phys = <&cp0_comphy3 1>;
>> + phy-mode = "sgmii";
>> + status = "okay";
>> +};
>> +
>> +&cp0_eth2_phy {
>> + /*
>> + * Configure LEDs:
>> + * - LED[0]: link/activity: On/blink (green)
>> + * - LED[1]: link is 100/1000Mbps: On (yellow)
>> + * - LED[2]: high impedance (floating)
>> + */
>> + marvell,reg-init = <3 16 0xf000 0x0a61>;
> Sorry, but no. List the LEDs in the PHY node, and they can then be
> controlled via /sys/class/leds.
May I ask more precisely the motivation?
Does this replace the phy's builtin automatic led control?
> arch/arm/boot/dts/marvell/armada-370-rd.dts is an example.

I will investigate it.

My main motivation for tweaking the led controls was to make them all consistent across the two boards:
- LEDs under control of PHYs on cpu mdio bus
- LEDs under control of ethernet switch on mdio bus
- LEDs under control of ethernet phy on external mdio bus behind ethernet switch

It looks as if the marvell phy driver supports led subnodes,
The switch driver does not.
Finally one phy can only be written to but not read,
the cpu can never know its link state.

So I prefer (for the Clearfog Pro) board to explicitly use the phys
autonomous management of LEDs.
Is that still possible if I added led subnodes?

2024-03-22 13:11:29

by Andrew Lunn

[permalink] [raw]
Subject: Re: [PATCH 2/2] arm64: dts: add description for solidrun cn9130 som and clearfog boards

> > Sorry, but no. List the LEDs in the PHY node, and they can then be
> > controlled via /sys/class/leds.
> May I ask more precisely the motivation?
> Does this replace the phy's builtin automatic led control?
> > arch/arm/boot/dts/marvell/armada-370-rd.dts is an example.
>
> I will investigate it.
>
> My main motivation for tweaking the led controls was to make them all consistent across the two boards:
> - LEDs under control of PHYs on cpu mdio bus
> - LEDs under control of ethernet switch on mdio bus
> - LEDs under control of ethernet phy on external mdio bus behind ethernet switch
>
> It looks as if the marvell phy driver supports led subnodes,
> The switch driver does not.

https://lwn.net/Articles/965775/

There has been quite a bit of interest in mv88e6xxx driver support, so
i expect support for other families outside of 6352 will be added
after it has been merged, and it is not difficult code to write.

> Finally one phy can only be written to but not read,
> the cpu can never know its link state.

O.K. That one cannot use the LED infrastructure in a meaningful way.

> So I prefer (for the Clearfog Pro) board to explicitly use the phys
> autonomous management of LEDs.
> Is that still possible if I added led subnodes?

You can combine both. The horrible marvell,reg-init will be applied
first. The generic LED code will then take over controlling the LEDs.

For the discrete PHYs, the generic LED code can make use of the
hardware offload support to read back the hardware configuration and
configure itself to match. The switch code is missing hardware offload
at the moment. So it cannot read back the current
configuration. However, it is simple code to add, and the discrete
code is a good example to follow.

marvell,reg-init is not going to go away, because of backwards
compatibility with old DT blobs. But in general, i expect all vendor
proprietary methods of configuring LEDs to be deprecated and replaced
with the vendor neutral /sys/class/leds.

Andrew


2024-03-22 15:38:46

by Josua Mayer

[permalink] [raw]
Subject: Re: [PATCH 2/2] arm64: dts: add description for solidrun cn9130 som and clearfog boards

Am 22.03.24 um 14:11 schrieb Andrew Lunn:
>>> Sorry, but no. List the LEDs in the PHY node, and they can then be
>>> controlled via /sys/class/leds.
>> May I ask more precisely the motivation?
>> Does this replace the phy's builtin automatic led control?
>>> arch/arm/boot/dts/marvell/armada-370-rd.dts is an example.
>> I will investigate it.
>>
>> My main motivation for tweaking the led controls was to make them all consistent across the two boards:
>> - LEDs under control of PHYs on cpu mdio bus
>> - LEDs under control of ethernet switch on mdio bus
>> - LEDs under control of ethernet phy on external mdio bus behind ethernet switch
>>
>> It looks as if the marvell phy driver supports led subnodes,
>> The switch driver does not.
> https://lwn.net/Articles/965775/
Great!
>
> There has been quite a bit of interest in mv88e6xxx driver support, so
> i expect support for other families outside of 6352 will be added
> after it has been merged, and it is not difficult code to write.
>
>> Finally one phy can only be written to but not read,
>> the cpu can never know its link state.
> O.K. That one cannot use the LED infrastructure in a meaningful way.
>
>> So I prefer (for the Clearfog Pro) board to explicitly use the phys
>> autonomous management of LEDs.
>> Is that still possible if I added led subnodes?
> You can combine both. The horrible marvell,reg-init will be applied
> first. The generic LED code will then take over controlling the LEDs.
I (currently) can't put in the led node e.g.
linux,default-trigger = "link100|link1000|tx|rx";
Right?
>
> For the discrete PHYs, the generic LED code can make use of the
> hardware offload support to read back the hardware configuration and
> configure itself to match. The switch code is missing hardware offload
> at the moment. So it cannot read back the current
> configuration. However, it is simple code to add, and the discrete
> code is a good example to follow.
>
> marvell,reg-init is not going to go away, because of backwards
> compatibility with old DT blobs. But in general, i expect all vendor
> proprietary methods of configuring LEDs to be deprecated and replaced
> with the vendor neutral /sys/class/leds.
Sounds good.

2024-03-22 15:50:08

by Andrew Lunn

[permalink] [raw]
Subject: Re: [PATCH 2/2] arm64: dts: add description for solidrun cn9130 som and clearfog boards

> I (currently) can't put in the led node e.g.
> linux,default-trigger = "link100|link1000|tx|rx";
> Right?

No. The trigger will be 'netdev'. Or 'heartbeat', or
'kbd-numlock'. They are just LEDs, they can be used for
anything. While testing some of this code i had the keyboard numlock
indicating network packets, since it easier to see than the RJ45
socket... The same applies the other way. The RJ45 LEDs are just Linux
LEDs, they can be used for anything...

I do have some code adding additional properties for the blink
reason. However, it is very debatable if it belongs in DT. DT
describes hardware, not configuration of hardware.

Do you actually have labels on the case indicating what the LEDs mean?
It could be we describe the label, which is hardware, not the
configuration of the LED, which is policy from user space.

Andrew

2024-03-22 15:59:05

by Josua Mayer

[permalink] [raw]
Subject: Re: [PATCH 2/2] arm64: dts: add description for solidrun cn9130 som and clearfog boards

Am 22.03.24 um 16:49 schrieb Andrew Lunn:
>> I (currently) can't put in the led node e.g.
>> linux,default-trigger = "link100|link1000|tx|rx";
>> Right?
> No. The trigger will be 'netdev'. Or 'heartbeat', or
> 'kbd-numlock'.
OK.
> They are just LEDs, they can be used for
> anything. While testing some of this code i had the keyboard numlock
> indicating network packets, since it easier to see than the RJ45
> socket... The same applies the other way. The RJ45 LEDs are just Linux
> LEDs, they can be used for anything...
>
> I do have some code adding additional properties for the blink
> reason. However, it is very debatable if it belongs in DT. DT
> describes hardware, not configuration of hardware.
>
> Do you actually have labels on the case indicating what the LEDs mean?
> It could be we describe the label, which is hardware, not the
> configuration of the LED, which is policy from user space.

I have seen it on customer products, and I have seen it in manuals,
and it can help in customer support.
Personally I would want it for consistency reasons, so that even if
hardware engineers confused 0 and 1 I can ensure consistent
behaviour out of the box.

It could be the vendor recommended or intended configuration ...

2024-03-22 18:22:51

by Josua Mayer

[permalink] [raw]
Subject: Re: [PATCH 2/2] arm64: dts: add description for solidrun cn9130 som and clearfog boards

Am 22.03.24 um 16:38 schrieb Josua Mayer:
> For the discrete PHYs, the generic LED code can make use of the
> hardware offload support to read back the hardware configuration and
> configure itself to match. The switch code is missing hardware offload
> at the moment. So it cannot read back the current
> configuration. However, it is simple code to add, and the discrete
> code is a good example to follow.
I have prototyped this on top of your patch-set, supporting offload
for a single mode.
It works as explained by you - first after boot-up the LEDs
are executing their default function autonomously.

When I set trigger netdev, I can see offloaded property is 1,
and when I enable extra bits offload turns off.


For Clearfog Base I have added the requested LED descriptions,
it should be ready now.

The Pro version I could
1) submit new version with only phy leds
2) wait (not preferred)
3) submit new version with an separate patch adding switch leds
(can hold of ack on it till the fait of your patch-set becomes clear)

2024-03-22 18:28:03

by Andrew Lunn

[permalink] [raw]
Subject: Re: [PATCH 2/2] arm64: dts: add description for solidrun cn9130 som and clearfog boards

On Fri, Mar 22, 2024 at 06:14:38PM +0000, Josua Mayer wrote:
> Am 22.03.24 um 16:38 schrieb Josua Mayer:
> > For the discrete PHYs, the generic LED code can make use of the
> > hardware offload support to read back the hardware configuration and
> > configure itself to match. The switch code is missing hardware offload
> > at the moment. So it cannot read back the current
> > configuration. However, it is simple code to add, and the discrete
> > code is a good example to follow.
> I have prototyped this on top of your patch-set, supporting offload
> for a single mode.
> It works as explained by you - first after boot-up the LEDs
> are executing their default function autonomously.
>
> When I set trigger netdev, I can see offloaded property is 1,
> and when I enable extra bits offload turns off.
>
>
> For Clearfog Base I have added the requested LED descriptions,
> it should be ready now.
>
> The Pro version I could
> 1) submit new version with only phy leds
> 2) wait (not preferred)
> 3) submit new version with an separate patch adding switch leds
> (can hold of ack on it till the fait of your patch-set becomes clear)

You probably need to wait whatever. We are in the merge window. Many
maintainers don't accept patches during these two weeks. They want you
to submit against -rc1 once it is released. And there is no rush. The
next merge window is not for another 7 weeks or so. Gregory will
accept patches for mvebu for around 5 of those weeks.

Andrew