Aw: Re: [PATCH 0/3] Fix for KSZ DSA switch shutdown

Lino Sanfilippo
2021-09-09T13:22:54Z

Hi Vladimir, Andrew,

sorry for the late response.

> Gesendet: Donnerstag, 09. September 2021 um 14:56 Uhr
> Von: "Vladimir Oltean" <olteanv@gmail.com>
> An: "Lino Sanfilippo" <LinoSanfilippo@gmx.de>
> Cc: p.rosenberger@kunbus.com, woojung.huh@microchip.com, UNGLinuxDriver@microchip.com, andrew@lunn.ch, vivien.didelot@gmail.com, f.fainelli@gmail.com, davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org
> Betreff: Re: [PATCH 0/3] Fix for KSZ DSA switch shutdown
>
> On Thu, Sep 09, 2021 at 02:42:48PM +0300, Vladimir Oltean wrote:
> > I feel that something is missing in your system. Is the device link
> > created? Is it deleted before going into effect on shutdown?
>
> So in case my questions were confusing, you can check the presence of
> the device links via sysfs.
>
> On my board, eno2 is the top-level DSA master, there is a switch which
> is PCIe PF 0000:00:00.5 which is its consumer:
>
> ls -la /sys/class/net/eno2/device/consumer\:pci\:0000\:00\:00.5
> lrwxrwxrwx 1 root root 0 Jan 1 00:00 /sys/class/net/eno2/device/consumer:pci:0000:00:00.5 -> ../../../../../virtual/devlink/pci:0000:00:00.2--pci:0000:00:00.5
>
> In turn, that switch is a DSA master on two ports for SPI-attached switches:
>
> ls -la /sys/class/net/swp0/device/consumer\:spi\:spi2.*
> lrwxrwxrwx 1 root root 0 Jan 1 00:04 /sys/class/net/swp0/device/consumer:spi:spi2.0 -> ../../../../../virtual/devlink/pci:0000:00:00.5--spi:spi2.0
> lrwxrwxrwx 1 root root 0 Jan 1 00:04 /sys/class/net/swp0/device/consumer:spi:spi2.1 -> ../../../../../virtual/devlink/pci:0000:00:00.5--spi:spi2.1
>
> Do you see similar things on your 5.10 kernel?

For the master device is see

lrwxrwxrwx 1 root root 0 Sep 9 14:10 /sys/class/net/eth0/device/consumer:spi:spi3.0 -> ../../../virtual/devlink/platform:fd580000.ethernet--spi:spi3.0

>
> Please note that I don't think that particular patch with device links
> was backported to v5.10, at least I don't see it when I run:

> git tag --contains 07b90056cb15f
>
> So how did it reach your tree?
>

The kernel I use is the Raspberry Pi 5.10 kernel. The commit number in this kernel is d0b97c8cd63e37e6d4dc9fefd6381b09f6c31a67

Andrew: the switch is not on a hat, the device tree part I use is:

spi@7e204c00 {
cs-gpios = <0x0000000f 0x00000010 0x00000001 0x0000000f 0x00000012 0x00000001>;
pinctrl-0 = <0x000000e5 0x000000e6>;
pinctrl-names = "default";
compatible = "brcm,bcm2835-spi";
reg = <0x7e204c00 0x00000200>;
interrupts = <0x00000000 0x00000076 0x00000004>;
clocks = <0x00000007 0x00000014>;
#address-cells = <0x00000001>;
#size-cells = <0x00000000>;
status = "okay";
phandle = <0x000000be>;
tpm@1 {
phandle = <0x000000ed>;
status = "okay";
interrupts = <0x0000000a 0x00000008>;
#interrupt-cells = <0x00000002>;
interrupt-parent = <0x0000000f>;
spi-max-frequency = <0x000f4240>;
reg = <0x00000001>;
pinctrl-0 = <0x000000e7>;
pinctrl-names = "default";
compatible = "infineon,slb9670";
};
ksz9897@0 {
phandle = <0x000000ec>;
status = "okay";
reset-gpios = <0x000000e1 0x0000000d 0x00000001>;
spi-cpol;
spi-cpha;
spi-max-frequency = <0x01f78a40>;
reg = <0x00000000>;
compatible = "microchip,ksz9897";
ports {
#size-cells = <0x00000000>;
#address-cells = <0x00000001>;
port@2 {
label = "piright";
reg = <0x00000002>;
};
port@1 {
label = "pileft";
reg = <0x00000001>;
};
port@0 {
ethernet = <0x000000d7>;
label = "cpu";
reg = <0x00000000>;
};
};
};

Regards,
Lino