diff mbox series

[3/3] ARM: dts: marvell: add support for D-Link DNS-320L

Message ID 20240629113450.127561-3-wigyori@uid0.hu (mailing list archive)
State New
Headers show
Series [1/3] dt-bindings: marvell: add D-Link DNS-320L | expand

Commit Message

Zoltan Herpai June 29, 2024, 11:34 a.m. UTC
Dual-slot NAS based on Marvell Kirkwood.

Specifications:
 - Marvell 88F6702 @1GHz
 - 256Mb RAM
 - 128Mb NAND
 - 1x GbE LAN (Marvell 88E1318R)
 - 1x USB 2.0
 - 2x SATA
 - Weltrend WT69P3 ("supervisor" MCU chip)
 - Serial on J2 (115200,8n1)
 - Newer bootROM so kwboot-ing via serial is possible

Signed-off-by: Zoltan HERPAI <wigyori@uid0.hu>
---
 arch/arm/boot/dts/marvell/Makefile            |   1 +
 .../arm/boot/dts/marvell/kirkwood-dns320l.dts | 197 ++++++++++++++++++
 2 files changed, 198 insertions(+)
 create mode 100644 arch/arm/boot/dts/marvell/kirkwood-dns320l.dts

Comments

Andrew Lunn June 29, 2024, 2:34 p.m. UTC | #1
It has been a long time since i reviewed a kirkwood DT
description. Also, best practices have changed, so the example you
copied is probably doing things which today would be classed as wrong.

> +// SPDX-License-Identifier: GPL-2.0-or-later

It is typical to use a dual license now:

// SPDX-License-Identifier: (GPL-2.0+ OR MIT)

However, if this is mostly Sunke Schluters work, you probably cannot
change the license without his agreement.

> +/*
> + * Device Tree file for D-Link DNS-320L
> + *
> + * Copyright (C) 2024, Zoltan HERPAI <wigyori@uid0.hu>
> + * Copyright (C) 2015, Sunke Schluters <sunke-dev@schlueters.de>
> + *
> + * This file is based on the works of:
> + * - Sunke Schluters <sunke-dev@schlueters.de>
> + *   - https://github.com/scus1/dns320l/blob/master/kernel/dts/kirkwood-dns320l.dts
> + * - Andreas Bohler <dev@aboehler.at>:
> + *   - http://www.aboehler.at/doku/doku.php/projects:dns320l
> + *   - http://www.aboehler.at/hg/linux-dns320l/file/ba7a60ad7687/linux-3.12/kirkwood-dns320l.dts
> + */
> +
> +/dts-v1/;
> +
> +#include "kirkwood.dtsi"
> +#include "kirkwood-6281.dtsi"
> +
> +/ {
> +	model = "D-Link DNS-320L";
> +	compatible = "dlink,dns320l", "marvell,kirkwood-88f6702", "marvell,kirkwood";
> +
> +	memory {
> +		device_type = "memory";
> +		reg = <0x00000000 0x10000000>;
> +	};

> +
> +	chosen {
> +		bootargs = "console=ttyS0,115200n8 earlyprintk";
> +		stdout-path = &uart0;

I _think_ current best practice is to make the serial port speed part
of the stdout-path

	stdout-path = &uart0:115200n8;

Also, earlyprintk is a debug flag, it should not be needed for a
production DT file.

> +	};
> +
> +	gpio-keys {
> +		compatible = "gpio-keys";
> +		#address-cells = <1>;
> +		#size-cells = <0>;
> +		pinctrl-0 = <&pmx_buttons>;
> +		pinctrl-names = "default";
> +
> +		button@1 {
> +			label = "Reset push button";
> +			linux,code = <KEY_RESTART>;
> +			gpios = <&gpio0 28 1>;

Please use GPIO_ACTIVE_LOW rather than 1. Also for other places gpios
are used.

Thanks

	Andrew
Krzysztof Kozlowski July 1, 2024, 6:01 a.m. UTC | #2
On 29/06/2024 13:34, Zoltan HERPAI wrote:
> Dual-slot NAS based on Marvell Kirkwood.
> 
> Specifications:
>  - Marvell 88F6702 @1GHz
>  - 256Mb RAM
>  - 128Mb NAND
>  - 1x GbE LAN (Marvell 88E1318R)
>  - 1x USB 2.0
>  - 2x SATA
>  - Weltrend WT69P3 ("supervisor" MCU chip)
>  - Serial on J2 (115200,8n1)
>  - Newer bootROM so kwboot-ing via serial is possible
> 
> Signed-off-by: Zoltan HERPAI <wigyori@uid0.hu>
> ---
>  arch/arm/boot/dts/marvell/Makefile            |   1 +
>  .../arm/boot/dts/marvell/kirkwood-dns320l.dts | 197 ++++++++++++++++++
>  2 files changed, 198 insertions(+)
>  create mode 100644 arch/arm/boot/dts/marvell/kirkwood-dns320l.dts
> 
> diff --git a/arch/arm/boot/dts/marvell/Makefile b/arch/arm/boot/dts/marvell/Makefile
> index 1e0f5ff492f7..cadd4039b783 100644
> --- a/arch/arm/boot/dts/marvell/Makefile
> +++ b/arch/arm/boot/dts/marvell/Makefile
> @@ -92,6 +92,7 @@ dtb-$(CONFIG_MACH_KIRKWOOD) += \
>  	kirkwood-db-88f6282.dtb \
>  	kirkwood-dir665.dtb \
>  	kirkwood-dns320.dtb \
> +	kirkwood-dns320l.dtb \
>  	kirkwood-dns325.dtb \
>  	kirkwood-dockstar.dtb \
>  	kirkwood-dreamplug.dtb \
> diff --git a/arch/arm/boot/dts/marvell/kirkwood-dns320l.dts b/arch/arm/boot/dts/marvell/kirkwood-dns320l.dts
> new file mode 100644
> index 000000000000..82a2d60376f7
> --- /dev/null
> +++ b/arch/arm/boot/dts/marvell/kirkwood-dns320l.dts
> @@ -0,0 +1,197 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + * Device Tree file for D-Link DNS-320L
> + *
> + * Copyright (C) 2024, Zoltan HERPAI <wigyori@uid0.hu>
> + * Copyright (C) 2015, Sunke Schluters <sunke-dev@schlueters.de>
> + *
> + * This file is based on the works of:
> + * - Sunke Schluters <sunke-dev@schlueters.de>
> + *   - https://github.com/scus1/dns320l/blob/master/kernel/dts/kirkwood-dns320l.dts
> + * - Andreas Bohler <dev@aboehler.at>:
> + *   - http://www.aboehler.at/doku/doku.php/projects:dns320l
> + *   - http://www.aboehler.at/hg/linux-dns320l/file/ba7a60ad7687/linux-3.12/kirkwood-dns320l.dts
> + */
> +
> +/dts-v1/;
> +
> +#include "kirkwood.dtsi"
> +#include "kirkwood-6281.dtsi"
> +
> +/ {
> +	model = "D-Link DNS-320L";
> +	compatible = "dlink,dns320l", "marvell,kirkwood-88f6702", "marvell,kirkwood";
> +
> +	memory {
> +		device_type = "memory";
> +		reg = <0x00000000 0x10000000>;
> +	};
> +
> +	chosen {
> +		bootargs = "console=ttyS0,115200n8 earlyprintk";
> +		stdout-path = &uart0;
> +	};
> +
> +	gpio-keys {
> +		compatible = "gpio-keys";
> +		#address-cells = <1>;
> +		#size-cells = <0>;

Nope, these cannot be there.

It does not look like you tested the DTS against bindings. Please run
`make dtbs_check W=1` (see
Documentation/devicetree/bindings/writing-schema.rst or
https://www.linaro.org/blog/tips-and-tricks-for-validating-devicetree-sources-with-the-devicetree-schema/
for instructions).

> +		pinctrl-0 = <&pmx_buttons>;
> +		pinctrl-names = "default";
> +
> +		button@1 {
> +			label = "Reset push button";
> +			linux,code = <KEY_RESTART>;
> +			gpios = <&gpio0 28 1>;
> +		};
> +
> +		button@2 {
> +			label = "USB unmount button";
> +			linux,code = <KEY_EJECTCD>;
> +			gpios = <&gpio0 27 1>;
> +		};
> +	};
> +
> +	gpio-leds {
> +		compatible = "gpio-leds";
> +		pinctrl-0 = <&pmx_leds>;
> +		pinctrl-names = "default";
> +
> +		blue-usb {

It does not look like you tested the DTS against bindings. Please run
`make dtbs_check W=1` (see
Documentation/devicetree/bindings/writing-schema.rst or
https://www.linaro.org/blog/tips-and-tricks-for-validating-devicetree-sources-with-the-devicetree-schema/
for instructions).

> +			label = "dns320l:usb:blue";
> +			gpios = <&gpio0 25 GPIO_ACTIVE_HIGH>;
> +			linux,default-trigger = "usbport";
> +		};
> +
> +		orange-usb {
> +			label = "dns320l:usb:orange";
> +			gpios = <&gpio0 26 GPIO_ACTIVE_HIGH>;
> +		};
> +
> +		orange-l-hdd {
> +			label = "dns320l:orange:l_hdd";
> +			gpios = <&gpio0 23 GPIO_ACTIVE_HIGH>;
> +		};
> +
> +		orange-r-hdd {
> +			label = "dns320l:orange:r_hdd";
> +			gpios = <&gpio0 22 GPIO_ACTIVE_HIGH>;
> +		};
> +	};
> +
> +	ocp@f1000000 {

Why you are not overriding by label/phandle?

> +		sata@80000 {
> +			status = "okay";
> +			nr-ports = <2>;
> +		};
> +
> +		serial@12000 {
> +			status = "okay";
> +		};
> +
> +		serial@12100 {
> +			pinctrl-0 = <&pmx_uart1>;
> +			pinctrl-names = "default";
> +			status = "okay";
> +		};
> +	};
> +
> +	regulators {

No, there is no such node/bus. Drop

> +		compatible = "simple-bus";
> +		#address-cells = <1>;
> +		#size-cells = <0>;
> +		pinctrl-0 = <&pmx_power_sata>;
> +		pinctrl-names = "default";
> +
> +		sata_power: regulator@1 {
> +			compatible = "regulator-fixed";
> +			reg = <1>;
> +			regulator-name = "SATA Power";
> +			regulator-min-microvolt = <5000000>;
> +			regulator-max-microvolt = <5000000>;
> +			enable-active-high;
> +			regulator-always-on;
> +			regulator-boot-on;
> +			gpio = <&gpio0 24 0>;
> +		};
> +	};
> +};
> +


Best regards,
Krzysztof
Zoltan Herpai July 1, 2024, 8:15 a.m. UTC | #3
Hi Andrew,

On 06/29/2024 16:34, Andrew Lunn wrote:
> It has been a long time since i reviewed a kirkwood DT
> description. Also, best practices have changed, so the example you
> copied is probably doing things which today would be classed as wrong.
>
>> +// SPDX-License-Identifier: GPL-2.0-or-later
> It is typical to use a dual license now:
>
> // SPDX-License-Identifier: (GPL-2.0+ OR MIT)
>
> However, if this is mostly Sunke Schluters work, you probably cannot
> change the license without his agreement.
That's correct, a significant portion of the DTS was taken from Sunke, 
and there is at least one other DTS with this license, so I didn't want 
to change this.

>> +/*
>> + * Device Tree file for D-Link DNS-320L
>> + *
>> + * Copyright (C) 2024, Zoltan HERPAI<wigyori@uid0.hu>
>> + * Copyright (C) 2015, Sunke Schluters<sunke-dev@schlueters.de>
>> + *
>> + * This file is based on the works of:
>> + * - Sunke Schluters<sunke-dev@schlueters.de>
>> + *   -https://github.com/scus1/dns320l/blob/master/kernel/dts/kirkwood-dns320l.dts
>> + * - Andreas Bohler<dev@aboehler.at>:
>> + *   -http://www.aboehler.at/doku/doku.php/projects:dns320l
>> + *   -http://www.aboehler.at/hg/linux-dns320l/file/ba7a60ad7687/linux-3.12/kirkwood-dns320l.dts
>> + */
>> +
>> +/dts-v1/;
>> +
>> +#include "kirkwood.dtsi"
>> +#include "kirkwood-6281.dtsi"
>> +
>> +/ {
>> +	model = "D-Link DNS-320L";
>> +	compatible = "dlink,dns320l", "marvell,kirkwood-88f6702", "marvell,kirkwood";
>> +
>> +	memory {
>> +		device_type = "memory";
>> +		reg = <0x00000000 0x10000000>;
>> +	};
>> +
>> +	chosen {
>> +		bootargs = "console=ttyS0,115200n8 earlyprintk";
>> +		stdout-path = &uart0;
> I _think_ current best practice is to make the serial port speed part
> of the stdout-path
>
> 	stdout-path = &uart0:115200n8;
>
> Also, earlyprintk is a debug flag, it should not be needed for a
> production DT file.
Indeed, I'll update these.

>> +	};
>> +
>> +	gpio-keys {
>> +		compatible = "gpio-keys";
>> +		#address-cells = <1>;
>> +		#size-cells = <0>;
>> +		pinctrl-0 = <&pmx_buttons>;
>> +		pinctrl-names = "default";
>> +
>> +		button@1 {
>> +			label = "Reset push button";
>> +			linux,code = <KEY_RESTART>;
>> +			gpios = <&gpio0 28 1>;
> Please use GPIO_ACTIVE_LOW rather than 1. Also for other places gpios
> are used.
Ack, will send a v2 with these updates - thanks for reviewing.

Regards,
Zoltan Herpai
Andrew Lunn July 1, 2024, 1:04 p.m. UTC | #4
On Mon, Jul 01, 2024 at 10:15:40AM +0200, Zoltan Herpai wrote:
> Hi Andrew,
> 
> On 06/29/2024 16:34, Andrew Lunn wrote:
> > It has been a long time since i reviewed a kirkwood DT
> > description. Also, best practices have changed, so the example you
> > copied is probably doing things which today would be classed as wrong.
> > 
> > > +// SPDX-License-Identifier: GPL-2.0-or-later
> > It is typical to use a dual license now:
> > 
> > // SPDX-License-Identifier: (GPL-2.0+ OR MIT)
> > 
> > However, if this is mostly Sunke Schluters work, you probably cannot
> > change the license without his agreement.
> That's correct, a significant portion of the DTS was taken from Sunke, and
> there is at least one other DTS with this license, so I didn't want to
> change this.

O.K. Please at least Cc: Sunke on the next revision anyway.

     Andrew
Andrew Lunn July 1, 2024, 1:25 p.m. UTC | #5
On Mon, Jul 01, 2024 at 08:01:46AM +0200, Krzysztof Kozlowski wrote:
> On 29/06/2024 13:34, Zoltan HERPAI wrote:

> > +++ b/arch/arm/boot/dts/marvell/kirkwood-dns320l.dts
> > @@ -0,0 +1,197 @@
> > +// SPDX-License-Identifier: GPL-2.0-or-later
> > +/*
> > + * Device Tree file for D-Link DNS-320L
> > + *
> > + * Copyright (C) 2024, Zoltan HERPAI <wigyori@uid0.hu>
> > + * Copyright (C) 2015, Sunke Schluters <sunke-dev@schlueters.de>
> > + *
> > + * This file is based on the works of:
> > + * - Sunke Schluters <sunke-dev@schlueters.de>
> > + *   - https://github.com/scus1/dns320l/blob/master/kernel/dts/kirkwood-dns320l.dts
> > + * - Andreas Bohler <dev@aboehler.at>:
> > + *   - http://www.aboehler.at/doku/doku.php/projects:dns320l
> > + *   - http://www.aboehler.at/hg/linux-dns320l/file/ba7a60ad7687/linux-3.12/kirkwood-dns320l.dts
> > + */
> > +
> > +/dts-v1/;
> > +
> > +#include "kirkwood.dtsi"
> > +#include "kirkwood-6281.dtsi"
> > +
> > +/ {
> > +	model = "D-Link DNS-320L";
> > +	compatible = "dlink,dns320l", "marvell,kirkwood-88f6702", "marvell,kirkwood";
> > +
> > +	memory {
> > +		device_type = "memory";
> > +		reg = <0x00000000 0x10000000>;
> > +	};
> > +
> > +	chosen {
> > +		bootargs = "console=ttyS0,115200n8 earlyprintk";
> > +		stdout-path = &uart0;
> > +	};
> > +
> > +	gpio-keys {
> > +		compatible = "gpio-keys";
> > +		#address-cells = <1>;
> > +		#size-cells = <0>;
> 
> Nope, these cannot be there.

Depends. The kernel, which is what really matters, is happy with them
there. Have a look at all the other kirkwood dts files.

> It does not look like you tested the DTS against bindings. Please run
> `make dtbs_check W=1` (see
> Documentation/devicetree/bindings/writing-schema.rst or
> https://www.linaro.org/blog/tips-and-tricks-for-validating-devicetree-sources-with-the-devicetree-schema/
> for instructions).

I suspect that is not going to be easy to interpret. kirkwood is very
old, much older than the YAML descriptions. DT descriptions of this
age were considered correct if the kernel understood them, and the
kernel is much more flexible than the YAML bindings. As a result,
there are going to be a huge number of warnings, and it will take a
lot of skill to pick out real warning which can be fixed from the
noise. Also, nobody really cares, because these devices have been out
of production for a decade. Nobody is going to clean up the DT files.

> > +		pinctrl-0 = <&pmx_buttons>;
> > +		pinctrl-names = "default";
> > +
> > +		button@1 {
> > +			label = "Reset push button";
> > +			linux,code = <KEY_RESTART>;
> > +			gpios = <&gpio0 28 1>;
> > +		};
> > +
> > +		button@2 {
> > +			label = "USB unmount button";
> > +			linux,code = <KEY_EJECTCD>;
> > +			gpios = <&gpio0 27 1>;
> > +		};
> > +	};
> > +
> > +	gpio-leds {
> > +		compatible = "gpio-leds";
> > +		pinctrl-0 = <&pmx_leds>;
> > +		pinctrl-names = "default";
> > +
> > +		blue-usb {
> 
> It does not look like you tested the DTS against bindings. Please run
> `make dtbs_check W=1` (see
> Documentation/devicetree/bindings/writing-schema.rst or
> https://www.linaro.org/blog/tips-and-tricks-for-validating-devicetree-sources-with-the-devicetree-schema/
> for instructions).

> > +	ocp@f1000000 {
> 
> Why you are not overriding by label/phandle?

Look at the old .dts files. That is the way it was done 10 years
ago. This is uniform with other kirkwood .dts files. There is
something to be said for being uniform with other files of the same
sort.

I think we need to find a balance here. I agree with some of your
comments, removing the regulator container, moving gpio-keys and
gpio-leds. But i think ocp@f1000000 and not using labels can stay.

	Andrew
Krzysztof Kozlowski July 1, 2024, 1:29 p.m. UTC | #6
On 01/07/2024 15:25, Andrew Lunn wrote:
> On Mon, Jul 01, 2024 at 08:01:46AM +0200, Krzysztof Kozlowski wrote:
>> On 29/06/2024 13:34, Zoltan HERPAI wrote:
> 
>>> +++ b/arch/arm/boot/dts/marvell/kirkwood-dns320l.dts
>>> @@ -0,0 +1,197 @@
>>> +// SPDX-License-Identifier: GPL-2.0-or-later
>>> +/*
>>> + * Device Tree file for D-Link DNS-320L
>>> + *
>>> + * Copyright (C) 2024, Zoltan HERPAI <wigyori@uid0.hu>
>>> + * Copyright (C) 2015, Sunke Schluters <sunke-dev@schlueters.de>
>>> + *
>>> + * This file is based on the works of:
>>> + * - Sunke Schluters <sunke-dev@schlueters.de>
>>> + *   - https://github.com/scus1/dns320l/blob/master/kernel/dts/kirkwood-dns320l.dts
>>> + * - Andreas Bohler <dev@aboehler.at>:
>>> + *   - http://www.aboehler.at/doku/doku.php/projects:dns320l
>>> + *   - http://www.aboehler.at/hg/linux-dns320l/file/ba7a60ad7687/linux-3.12/kirkwood-dns320l.dts
>>> + */
>>> +
>>> +/dts-v1/;
>>> +
>>> +#include "kirkwood.dtsi"
>>> +#include "kirkwood-6281.dtsi"
>>> +
>>> +/ {
>>> +	model = "D-Link DNS-320L";
>>> +	compatible = "dlink,dns320l", "marvell,kirkwood-88f6702", "marvell,kirkwood";
>>> +
>>> +	memory {
>>> +		device_type = "memory";
>>> +		reg = <0x00000000 0x10000000>;
>>> +	};
>>> +
>>> +	chosen {
>>> +		bootargs = "console=ttyS0,115200n8 earlyprintk";
>>> +		stdout-path = &uart0;
>>> +	};
>>> +
>>> +	gpio-keys {
>>> +		compatible = "gpio-keys";
>>> +		#address-cells = <1>;
>>> +		#size-cells = <0>;
>>
>> Nope, these cannot be there.
> 
> Depends. The kernel, which is what really matters, is happy with them
> there. Have a look at all the other kirkwood dts files.

They cannot be here because the binding does not allow it. They are
redundant though, in a way that kernel will work.

> 
>> It does not look like you tested the DTS against bindings. Please run
>> `make dtbs_check W=1` (see
>> Documentation/devicetree/bindings/writing-schema.rst or
>> https://www.linaro.org/blog/tips-and-tricks-for-validating-devicetree-sources-with-the-devicetree-schema/
>> for instructions).
> 
> I suspect that is not going to be easy to interpret. kirkwood is very
> old, much older than the YAML descriptions. DT descriptions of this
> age were considered correct if the kernel understood them, and the
> kernel is much more flexible than the YAML bindings. As a result,
> there are going to be a huge number of warnings, and it will take a
> lot of skill to pick out real warning which can be fixed from the
> noise. Also, nobody really cares, because these devices have been out
> of production for a decade. Nobody is going to clean up the DT files.

One can just read the binding. Is there address/size cells?

That's true that you need cleaned up platform to make efficient use of
the tools, but one can test one particular schema which would print just
limited amount of bindings.

> 
>>> +		pinctrl-0 = <&pmx_buttons>;
>>> +		pinctrl-names = "default";
>>> +
>>> +		button@1 {
>>> +			label = "Reset push button";
>>> +			linux,code = <KEY_RESTART>;
>>> +			gpios = <&gpio0 28 1>;
>>> +		};
>>> +
>>> +		button@2 {
>>> +			label = "USB unmount button";
>>> +			linux,code = <KEY_EJECTCD>;
>>> +			gpios = <&gpio0 27 1>;
>>> +		};
>>> +	};
>>> +
>>> +	gpio-leds {
>>> +		compatible = "gpio-leds";
>>> +		pinctrl-0 = <&pmx_leds>;
>>> +		pinctrl-names = "default";
>>> +
>>> +		blue-usb {
>>
>> It does not look like you tested the DTS against bindings. Please run
>> `make dtbs_check W=1` (see
>> Documentation/devicetree/bindings/writing-schema.rst or
>> https://www.linaro.org/blog/tips-and-tricks-for-validating-devicetree-sources-with-the-devicetree-schema/
>> for instructions).
> 
>>> +	ocp@f1000000 {
>>
>> Why you are not overriding by label/phandle?
> 
> Look at the old .dts files. That is the way it was done 10 years
> ago. This is uniform with other kirkwood .dts files. There is
> something to be said for being uniform with other files of the same
> sort.

That's ok.

> 

Best regards,
Krzysztof
Andrew Lunn July 1, 2024, 1:39 p.m. UTC | #7
> > I suspect that is not going to be easy to interpret. kirkwood is very
> > old, much older than the YAML descriptions. DT descriptions of this
> > age were considered correct if the kernel understood them, and the
> > kernel is much more flexible than the YAML bindings. As a result,
> > there are going to be a huge number of warnings, and it will take a
> > lot of skill to pick out real warning which can be fixed from the
> > noise. Also, nobody really cares, because these devices have been out
> > of production for a decade. Nobody is going to clean up the DT files.
> 
> One can just read the binding. Is there address/size cells?

And i suspect this developer also does not know that. This is a
typical cut/paste .dts file, copied from a 10 year old working
example. If the tools are not helpful, we Maintainers need to fill in
the gaps.

In this case, I would suggest looking in
arch/arm64/boot/dts/marvell/*.dts and follow what is done there. These
files are more modern, so are more likely to follow the bindings. Look
where the gpip-keys and gpip-led nodes are placed.

      Andrew
Krzysztof Kozlowski July 1, 2024, 1:47 p.m. UTC | #8
On 01/07/2024 15:29, Krzysztof Kozlowski wrote:
> 
>>
>>> It does not look like you tested the DTS against bindings. Please run
>>> `make dtbs_check W=1` (see
>>> Documentation/devicetree/bindings/writing-schema.rst or
>>> https://www.linaro.org/blog/tips-and-tricks-for-validating-devicetree-sources-with-the-devicetree-schema/
>>> for instructions).
>>
>> I suspect that is not going to be easy to interpret. kirkwood is very
>> old, much older than the YAML descriptions. DT descriptions of this
>> age were considered correct if the kernel understood them, and the
>> kernel is much more flexible than the YAML bindings. As a result,
>> there are going to be a huge number of warnings, and it will take a
>> lot of skill to pick out real warning which can be fixed from the
>> noise. Also, nobody really cares, because these devices have been out
>> of production for a decade. Nobody is going to clean up the DT files.
> 
> One can just read the binding. Is there address/size cells?
> 
> That's true that you need cleaned up platform to make efficient use of
> the tools, but one can test one particular schema which would print just
> limited amount of bindings.

BTW, I'll fix up few trivial things in Kirkwood and Orion files.

Best regards,
Krzysztof
Rob Herring (Arm) July 1, 2024, 6:05 p.m. UTC | #9
On Sat, Jun 29, 2024 at 04:34:25PM +0200, Andrew Lunn wrote:
> It has been a long time since i reviewed a kirkwood DT
> description. Also, best practices have changed, so the example you
> copied is probably doing things which today would be classed as wrong.
> 
> > +// SPDX-License-Identifier: GPL-2.0-or-later
> 
> It is typical to use a dual license now:
> 
> // SPDX-License-Identifier: (GPL-2.0+ OR MIT)

Yes, but more importantly, they should be consistent...

GPL-2.0+ in favor of GPL-2.0-or-later

> 
> However, if this is mostly Sunke Schluters work, you probably cannot
> change the license without his agreement.
> 
> > +/*
> > + * Device Tree file for D-Link DNS-320L
> > + *
> > + * Copyright (C) 2024, Zoltan HERPAI <wigyori@uid0.hu>
> > + * Copyright (C) 2015, Sunke Schluters <sunke-dev@schlueters.de>
> > + *
> > + * This file is based on the works of:
> > + * - Sunke Schluters <sunke-dev@schlueters.de>
> > + *   - https://github.com/scus1/dns320l/blob/master/kernel/dts/kirkwood-dns320l.dts
> > + * - Andreas Bohler <dev@aboehler.at>:
> > + *   - http://www.aboehler.at/doku/doku.php/projects:dns320l
> > + *   - http://www.aboehler.at/hg/linux-dns320l/file/ba7a60ad7687/linux-3.12/kirkwood-dns320l.dts
> > + */
> > +
> > +/dts-v1/;
> > +
> > +#include "kirkwood.dtsi"
> > +#include "kirkwood-6281.dtsi"

And these are GPL-2.0-only, so this one should match.

Rob
diff mbox series

Patch

diff --git a/arch/arm/boot/dts/marvell/Makefile b/arch/arm/boot/dts/marvell/Makefile
index 1e0f5ff492f7..cadd4039b783 100644
--- a/arch/arm/boot/dts/marvell/Makefile
+++ b/arch/arm/boot/dts/marvell/Makefile
@@ -92,6 +92,7 @@  dtb-$(CONFIG_MACH_KIRKWOOD) += \
 	kirkwood-db-88f6282.dtb \
 	kirkwood-dir665.dtb \
 	kirkwood-dns320.dtb \
+	kirkwood-dns320l.dtb \
 	kirkwood-dns325.dtb \
 	kirkwood-dockstar.dtb \
 	kirkwood-dreamplug.dtb \
diff --git a/arch/arm/boot/dts/marvell/kirkwood-dns320l.dts b/arch/arm/boot/dts/marvell/kirkwood-dns320l.dts
new file mode 100644
index 000000000000..82a2d60376f7
--- /dev/null
+++ b/arch/arm/boot/dts/marvell/kirkwood-dns320l.dts
@@ -0,0 +1,197 @@ 
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Device Tree file for D-Link DNS-320L
+ *
+ * Copyright (C) 2024, Zoltan HERPAI <wigyori@uid0.hu>
+ * Copyright (C) 2015, Sunke Schluters <sunke-dev@schlueters.de>
+ *
+ * This file is based on the works of:
+ * - Sunke Schluters <sunke-dev@schlueters.de>
+ *   - https://github.com/scus1/dns320l/blob/master/kernel/dts/kirkwood-dns320l.dts
+ * - Andreas Bohler <dev@aboehler.at>:
+ *   - http://www.aboehler.at/doku/doku.php/projects:dns320l
+ *   - http://www.aboehler.at/hg/linux-dns320l/file/ba7a60ad7687/linux-3.12/kirkwood-dns320l.dts
+ */
+
+/dts-v1/;
+
+#include "kirkwood.dtsi"
+#include "kirkwood-6281.dtsi"
+
+/ {
+	model = "D-Link DNS-320L";
+	compatible = "dlink,dns320l", "marvell,kirkwood-88f6702", "marvell,kirkwood";
+
+	memory {
+		device_type = "memory";
+		reg = <0x00000000 0x10000000>;
+	};
+
+	chosen {
+		bootargs = "console=ttyS0,115200n8 earlyprintk";
+		stdout-path = &uart0;
+	};
+
+	gpio-keys {
+		compatible = "gpio-keys";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		pinctrl-0 = <&pmx_buttons>;
+		pinctrl-names = "default";
+
+		button@1 {
+			label = "Reset push button";
+			linux,code = <KEY_RESTART>;
+			gpios = <&gpio0 28 1>;
+		};
+
+		button@2 {
+			label = "USB unmount button";
+			linux,code = <KEY_EJECTCD>;
+			gpios = <&gpio0 27 1>;
+		};
+	};
+
+	gpio-leds {
+		compatible = "gpio-leds";
+		pinctrl-0 = <&pmx_leds>;
+		pinctrl-names = "default";
+
+		blue-usb {
+			label = "dns320l:usb:blue";
+			gpios = <&gpio0 25 GPIO_ACTIVE_HIGH>;
+			linux,default-trigger = "usbport";
+		};
+
+		orange-usb {
+			label = "dns320l:usb:orange";
+			gpios = <&gpio0 26 GPIO_ACTIVE_HIGH>;
+		};
+
+		orange-l-hdd {
+			label = "dns320l:orange:l_hdd";
+			gpios = <&gpio0 23 GPIO_ACTIVE_HIGH>;
+		};
+
+		orange-r-hdd {
+			label = "dns320l:orange:r_hdd";
+			gpios = <&gpio0 22 GPIO_ACTIVE_HIGH>;
+		};
+	};
+
+	ocp@f1000000 {
+		sata@80000 {
+			status = "okay";
+			nr-ports = <2>;
+		};
+
+		serial@12000 {
+			status = "okay";
+		};
+
+		serial@12100 {
+			pinctrl-0 = <&pmx_uart1>;
+			pinctrl-names = "default";
+			status = "okay";
+		};
+	};
+
+	regulators {
+		compatible = "simple-bus";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		pinctrl-0 = <&pmx_power_sata>;
+		pinctrl-names = "default";
+
+		sata_power: regulator@1 {
+			compatible = "regulator-fixed";
+			reg = <1>;
+			regulator-name = "SATA Power";
+			regulator-min-microvolt = <5000000>;
+			regulator-max-microvolt = <5000000>;
+			enable-active-high;
+			regulator-always-on;
+			regulator-boot-on;
+			gpio = <&gpio0 24 0>;
+		};
+	};
+};
+
+&nand {
+	pinctrl-0 = <&pmx_nand>;
+	pinctrl-names = "default";
+	chip-delay = <40>;
+	status = "okay";
+
+	partition@0 {
+		label = "u-boot";
+		reg = <0x0000000 0x100000>;
+	};
+
+	partition@100000 {
+		label = "ubootenv";
+		reg = <0x100000 0x20000>;
+	};
+
+	partition@120000 {
+		label = "ubi";
+		reg = <0x120000 0x6de0000>;
+	};
+
+	partition@6f00000 {
+		label = "mini firmware";
+		reg = <0x6f00000 0xa00000>;
+	};
+
+	partition@7900000 {
+		label = "config";
+		reg = <0x7900000 0x500000>;
+	};
+
+	partition@7e00000 {
+		label = "my-dlink";
+		reg = <0x7e00000 0x200000>;
+	};
+};
+
+&mdio {
+	status = "okay";
+
+	ethphy0: ethernet-phy@0 {
+		reg = <0>;
+	};
+};
+
+&pinctrl {
+	pmx_sata1: pmx-sata1 {
+		marvell,pins = "mpp20";
+		marvell,function = "sata1";
+	};
+
+	pmx_sata0: pmx-sata0 {
+		marvell,pins = "mpp21";
+		marvell,function = "sata0";
+	};
+
+	pmx_power_sata: pmx-power-sata {
+		marvell,pins = "mpp24";
+		marvell,function = "gpio";
+	};
+
+	pmx_leds: pmx-leds {
+		marvell,pins = "mpp22", "mpp23", "mpp25", "mpp26";
+		marvell,function = "gpio";
+	};
+
+	pmx_buttons: pmx-buttons {
+		marvell,pins = "mpp27", "mpp28", "mpp29";
+		marvell,function = "gpio";
+	};
+};
+
+&eth0 {
+	status = "okay";
+	ethernet0-port@0 {
+		phy-handle = <&ethphy0>;
+	};
+};