2022-02-15 09:55:41

by Oleksij Rempel

[permalink] [raw]
Subject: [PATCH v3 1/8] dt-bindings: net: add schema for ASIX USB Ethernet controllers

Create schema for ASIX USB Ethernet controllers and import some of
currently supported USB IDs form drivers/net/usb/asix_devices.c

This devices are already used in some of DTs. So, this schema makes it official.
NOTE: there was no previously documented txt based DT binding for this
controllers.

Signed-off-by: Oleksij Rempel <[email protected]>
---
.../devicetree/bindings/net/asix,ax88178.yaml | 68 +++++++++++++++++++
1 file changed, 68 insertions(+)
create mode 100644 Documentation/devicetree/bindings/net/asix,ax88178.yaml

diff --git a/Documentation/devicetree/bindings/net/asix,ax88178.yaml b/Documentation/devicetree/bindings/net/asix,ax88178.yaml
new file mode 100644
index 000000000000..1af52358de4c
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/asix,ax88178.yaml
@@ -0,0 +1,68 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/asix,ax88178.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: The device tree bindings for the USB Ethernet controllers
+
+maintainers:
+ - Oleksij Rempel <[email protected]>
+
+description: |
+ Device tree properties for hard wired USB Ethernet devices.
+
+allOf:
+ - $ref: ethernet-controller.yaml#
+
+properties:
+ compatible:
+ items:
+ - enum:
+ - usbb95,1720 # ASIX AX88172
+ - usbb95,172a # ASIX AX88172A
+ - usbb95,1780 # ASIX AX88178
+ - usbb95,7720 # ASIX AX88772
+ - usbb95,772a # ASIX AX88772A
+ - usbb95,772b # ASIX AX88772B
+ - usbb95,7e2b # ASIX AX88772B
+
+ reg: true
+ local-mac-address: true
+ mac-address: true
+
+required:
+ - compatible
+ - reg
+
+additionalProperties: false
+
+examples:
+ - |
+ usb {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ ethernet@1 {
+ compatible = "usbb95,7e2b";
+ reg = <1>;
+ local-mac-address = [00 00 00 00 00 00];
+ };
+ };
+ - |
+ usb {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ usb1@1 {
+ compatible = "usb1234,5678";
+ reg = <1>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ ethernet@1 {
+ compatible = "usbb95,772b";
+ reg = <1>;
+ };
+ };
+ };
--
2.30.2


2022-02-15 10:01:09

by Oleksij Rempel

[permalink] [raw]
Subject: [PATCH v3 3/8] dt-bindings: usb: ci-hdrc-usb2: fix node node for ethernet controller

This documentation provides wrong node name for the Ethernet controller.
It should be "ethernet" instead of "smsc"

Signed-off-by: Oleksij Rempel <[email protected]>
---
Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt
index a5c5db6a0b2d..ba51fb1252b9 100644
--- a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt
+++ b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt
@@ -151,7 +151,7 @@ Example for HSIC:
#address-cells = <1>;
#size-cells = <0>;

- usbnet: smsc@1 {
+ usbnet: ethernet@1 {
compatible = "usb424,9730";
reg = <1>;
};
--
2.30.2

2022-02-15 10:56:15

by Oleksij Rempel

[permalink] [raw]
Subject: [PATCH v3 4/8] ARM: dts: bcm283x: fix ethernet node name

It should be "ethernet@x" instead of "usbether@x"

Signed-off-by: Oleksij Rempel <[email protected]>
---
arch/arm/boot/dts/bcm283x-rpi-smsc9512.dtsi | 2 +-
arch/arm/boot/dts/bcm283x-rpi-smsc9514.dtsi | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/bcm283x-rpi-smsc9512.dtsi b/arch/arm/boot/dts/bcm283x-rpi-smsc9512.dtsi
index 967e081cb9c2..882b13807075 100644
--- a/arch/arm/boot/dts/bcm283x-rpi-smsc9512.dtsi
+++ b/arch/arm/boot/dts/bcm283x-rpi-smsc9512.dtsi
@@ -12,7 +12,7 @@ usb1@1 {
#address-cells = <1>;
#size-cells = <0>;

- ethernet: usbether@1 {
+ ethernet: ethernet@1 {
compatible = "usb424,ec00";
reg = <1>;
};
diff --git a/arch/arm/boot/dts/bcm283x-rpi-smsc9514.dtsi b/arch/arm/boot/dts/bcm283x-rpi-smsc9514.dtsi
index dc7ae776db5f..4273b90b53cc 100644
--- a/arch/arm/boot/dts/bcm283x-rpi-smsc9514.dtsi
+++ b/arch/arm/boot/dts/bcm283x-rpi-smsc9514.dtsi
@@ -11,7 +11,7 @@ usb1@1 {
#address-cells = <1>;
#size-cells = <0>;

- ethernet: usbether@1 {
+ ethernet: ethernet@1 {
compatible = "usb424,ec00";
reg = <1>;
};
--
2.30.2

2022-02-15 12:34:16

by Oleksij Rempel

[permalink] [raw]
Subject: [PATCH v3 7/8] ARM: dts: tegra20/30: fix ethernet node name for different tegra boards

The node name of Ethernet controller should be "ethernet" instead of
"asix" or "smsc"

Signed-off-by: Oleksij Rempel <[email protected]>
---
arch/arm/boot/dts/tegra20-colibri.dtsi | 2 +-
arch/arm/boot/dts/tegra30-colibri.dtsi | 2 +-
arch/arm/boot/dts/tegra30-ouya.dts | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/tegra20-colibri.dtsi b/arch/arm/boot/dts/tegra20-colibri.dtsi
index 1eefb9ee4ac8..8ebd8afc857d 100644
--- a/arch/arm/boot/dts/tegra20-colibri.dtsi
+++ b/arch/arm/boot/dts/tegra20-colibri.dtsi
@@ -691,7 +691,7 @@ usb@c5004000 {
#address-cells = <1>;
#size-cells = <0>;

- asix@1 {
+ ethernet@1 {
compatible = "usbb95,772b";
reg = <1>;
local-mac-address = [00 00 00 00 00 00];
diff --git a/arch/arm/boot/dts/tegra30-colibri.dtsi b/arch/arm/boot/dts/tegra30-colibri.dtsi
index be691a1c33a1..22231d450b1b 100644
--- a/arch/arm/boot/dts/tegra30-colibri.dtsi
+++ b/arch/arm/boot/dts/tegra30-colibri.dtsi
@@ -960,7 +960,7 @@ usb@7d004000 {
#address-cells = <1>;
#size-cells = <0>;

- asix@1 {
+ ethernet@1 {
compatible = "usbb95,772b";
reg = <1>;
local-mac-address = [00 00 00 00 00 00];
diff --git a/arch/arm/boot/dts/tegra30-ouya.dts b/arch/arm/boot/dts/tegra30-ouya.dts
index a5cfbab5f565..e58dda4f9d2c 100644
--- a/arch/arm/boot/dts/tegra30-ouya.dts
+++ b/arch/arm/boot/dts/tegra30-ouya.dts
@@ -4553,7 +4553,7 @@ usb@7d004000 {
#address-cells = <1>;
#size-cells = <0>;

- smsc@2 { /* SMSC 10/100T Ethernet Controller */
+ ethernet@2 { /* SMSC 10/100T Ethernet Controller */
compatible = "usb424,9e00";
reg = <2>;
local-mac-address = [00 11 22 33 44 55];
--
2.30.2

2022-02-15 15:37:22

by Oleksij Rempel

[permalink] [raw]
Subject: [PATCH v3 5/8] ARM: dts: exynos: fix ethernet node name for different odroid boards

The node name of Ethernet controller should be "ethernet" instead of
"usbether"

Signed-off-by: Oleksij Rempel <[email protected]>
---
arch/arm/boot/dts/exynos4412-odroidu3.dts | 4 ++--
arch/arm/boot/dts/exynos4412-odroidx.dts | 8 ++++----
arch/arm/boot/dts/exynos5410-odroidxu.dts | 4 ++--
arch/arm/boot/dts/exynos5422-odroidxu3-lite.dts | 6 +++---
arch/arm/boot/dts/exynos5422-odroidxu3.dts | 6 +++---
5 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/arch/arm/boot/dts/exynos4412-odroidu3.dts b/arch/arm/boot/dts/exynos4412-odroidu3.dts
index efaf7533e84f..36c369c42b77 100644
--- a/arch/arm/boot/dts/exynos4412-odroidu3.dts
+++ b/arch/arm/boot/dts/exynos4412-odroidu3.dts
@@ -119,8 +119,8 @@ &ehci {
phys = <&exynos_usbphy 2>, <&exynos_usbphy 3>;
phy-names = "hsic0", "hsic1";

- ethernet: usbether@2 {
- compatible = "usb0424,9730";
+ ethernet: ethernet@2 {
+ compatible = "usb424,9730";
reg = <2>;
local-mac-address = [00 00 00 00 00 00]; /* Filled in by a bootloader */
};
diff --git a/arch/arm/boot/dts/exynos4412-odroidx.dts b/arch/arm/boot/dts/exynos4412-odroidx.dts
index 440135d0ff2a..ba46baf9117f 100644
--- a/arch/arm/boot/dts/exynos4412-odroidx.dts
+++ b/arch/arm/boot/dts/exynos4412-odroidx.dts
@@ -70,19 +70,19 @@ &ehci {
phy-names = "hsic0";

hub@2 {
- compatible = "usb0424,3503";
+ compatible = "usb424,3503";
reg = <2>;
#address-cells = <1>;
#size-cells = <0>;

hub@1 {
- compatible = "usb0424,9514";
+ compatible = "usb424,9514";
reg = <1>;
#address-cells = <1>;
#size-cells = <0>;

- ethernet: usbether@1 {
- compatible = "usb0424,ec00";
+ ethernet: ethernet@1 {
+ compatible = "usb424,ec00";
reg = <1>;
/* Filled in by a bootloader */
local-mac-address = [00 00 00 00 00 00];
diff --git a/arch/arm/boot/dts/exynos5410-odroidxu.dts b/arch/arm/boot/dts/exynos5410-odroidxu.dts
index 884fef55836c..4c7039e771db 100644
--- a/arch/arm/boot/dts/exynos5410-odroidxu.dts
+++ b/arch/arm/boot/dts/exynos5410-odroidxu.dts
@@ -675,8 +675,8 @@ &usbhost2 {
#address-cells = <1>;
#size-cells = <0>;

- ethernet: usbether@2 {
- compatible = "usb0424,9730";
+ ethernet: ethernet@2 {
+ compatible = "usb424,9730";
reg = <2>;
local-mac-address = [00 00 00 00 00 00]; /* Filled in by a bootloader */
};
diff --git a/arch/arm/boot/dts/exynos5422-odroidxu3-lite.dts b/arch/arm/boot/dts/exynos5422-odroidxu3-lite.dts
index 62c5928aa994..e3154a1cae23 100644
--- a/arch/arm/boot/dts/exynos5422-odroidxu3-lite.dts
+++ b/arch/arm/boot/dts/exynos5422-odroidxu3-lite.dts
@@ -113,13 +113,13 @@ &usbhost2 {
#size-cells = <0>;

hub@1 {
- compatible = "usb0424,9514";
+ compatible = "usb424,9514";
reg = <1>;
#address-cells = <1>;
#size-cells = <0>;

- ethernet: usbether@1 {
- compatible = "usb0424,ec00";
+ ethernet: ethernet@1 {
+ compatible = "usb424,ec00";
reg = <1>;
local-mac-address = [00 00 00 00 00 00]; /* Filled in by a bootloader */
};
diff --git a/arch/arm/boot/dts/exynos5422-odroidxu3.dts b/arch/arm/boot/dts/exynos5422-odroidxu3.dts
index cecaeb69e623..a378d4937ff7 100644
--- a/arch/arm/boot/dts/exynos5422-odroidxu3.dts
+++ b/arch/arm/boot/dts/exynos5422-odroidxu3.dts
@@ -80,13 +80,13 @@ &usbhost2 {
#size-cells = <0>;

hub@1 {
- compatible = "usb0424,9514";
+ compatible = "usb424,9514";
reg = <1>;
#address-cells = <1>;
#size-cells = <0>;

- ethernet: usbether@1 {
- compatible = "usb0424,ec00";
+ ethernet: ethernet@1 {
+ compatible = "usb424,ec00";
reg = <1>;
local-mac-address = [00 00 00 00 00 00]; /* Filled in by a bootloader */
};
--
2.30.2

2022-02-15 22:40:36

by Florian Fainelli

[permalink] [raw]
Subject: Re: [PATCH v3 4/8] ARM: dts: bcm283x: fix ethernet node name

On 2/15/22 12:09 AM, Oleksij Rempel wrote:
> It should be "ethernet@x" instead of "usbether@x"
>
> Signed-off-by: Oleksij Rempel <[email protected]>

This looks like, a quick grep on the u-boot source code seems to suggest
that only one file is assuming that 'usbether@1' is to be used as a node
name and the error message does not even match the code it is patching:

board/liebherr/xea/xea.c:
#ifdef CONFIG_OF_BOARD_SETUP
static int fdt_fixup_l2switch(void *blob)
{
u8 ethaddr[6];
int ret;

if (eth_env_get_enetaddr("ethaddr", ethaddr)) {
ret = fdt_find_and_setprop(blob,

"/ahb@80080000/switch@800f0000",
"local-mac-address",
ethaddr, 6, 1);
if (ret < 0)
printf("%s: can't find usbether@1 node: %d\n",
__func__, ret);
}

return 0;
}

I will wait for the other maintainers on the other patches to provide
some feedback, but if all is well, will apply this one soon.
--
Florian

2022-02-16 07:42:09

by Oleksij Rempel

[permalink] [raw]
Subject: Re: [PATCH v3 5/8] ARM: dts: exynos: fix ethernet node name for different odroid boards

On Tue, Feb 15, 2022 at 09:56:50PM +0100, Andrew Lunn wrote:
> > > > - ethernet: usbether@2 {
> > > > - compatible = "usb0424,9730";
> > > > + ethernet: ethernet@2 {
> > > > + compatible = "usb424,9730";
> > >
> > > The change of the compatible is not mentioned in the patch description.
> > > Is this intentional?
> >
> > No, I forgot to mentione it. According to the USB schema 0 should be
> > removed. So, this compatible was incorrect as well. With leading zero
> > present yaml schema was not able to detect and validate this node.
>
> Does the current code not actually care about a leading 0? It will
> match with or without it? It would be good to mention that as well in
> the commit message, otherwise somebody like me is going to ask if this
> breaks backwards compatibility, since normally compatible is an exact
> string match.

Current kernel code do not care about exact this compatibles. There is
no driver matching against it. The USB Ethernet driver will take the
node provided by the USB core drivers without validating the compatible
against USB ID.
See:
drivers/usb/core/of.c
drivers/usb/core/message.c:2093

On other hand, DT validations tools do care about it and this nodes was
not detected automatically. I found it accidentally by grepping the
sources.

> And i actually think this is the sort of change which should be as a
> patch of its own. If this causes a regression, a git bisect would then
> tell you if it is the change of usbether -> ethernet, or 0424 to
> 424. That is part of why we ask for lots of small changes.

Sounds good, I'll update it.

Regards,
Oleksij
--
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 |

2022-02-16 07:50:43

by Oleksij Rempel

[permalink] [raw]
Subject: Re: [PATCH v3 4/8] ARM: dts: bcm283x: fix ethernet node name

On Tue, Feb 15, 2022 at 01:01:06PM -0800, Florian Fainelli wrote:
> On 2/15/22 12:09 AM, Oleksij Rempel wrote:
> > It should be "ethernet@x" instead of "usbether@x"
> >
> > Signed-off-by: Oleksij Rempel <[email protected]>
>
> This looks like, a quick grep on the u-boot source code seems to suggest
> that only one file is assuming that 'usbether@1' is to be used as a node
> name and the error message does not even match the code it is patching:
>
> board/liebherr/xea/xea.c:
> #ifdef CONFIG_OF_BOARD_SETUP
> static int fdt_fixup_l2switch(void *blob)
> {
> u8 ethaddr[6];
> int ret;
>
> if (eth_env_get_enetaddr("ethaddr", ethaddr)) {
> ret = fdt_find_and_setprop(blob,
>
> "/ahb@80080000/switch@800f0000",
> "local-mac-address",
> ethaddr, 6, 1);
> if (ret < 0)
> printf("%s: can't find usbether@1 node: %d\n",
> __func__, ret);
> }

\o/ :)

> return 0;
> }
>
> I will wait for the other maintainers on the other patches to provide
> some feedback, but if all is well, will apply this one soon.

Full path fdt matching has proven to be not stable enough. Especially on
chips with early DT adaptation like iMX. It is better to use aliases
where possible.

Regards,
Oleksij
--
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 |