Message ID | 20180528174752.6806-1-linus.walleij@linaro.org |
---|---|
Headers | show |
Series | Realtek SMI RTL836x DSA driver | expand |
On Mon, May 28, 2018 at 07:47:48PM +0200, Linus Walleij wrote: > This is a second RFC version of the DSA driver for Realtek > RTL8366x especially RTL8366RB. > > I've been beating my head against this one and I'm not really > clear on why my ethernet frames are not coming through to the > CPU port on the chip. > > It appears when using ethtool -S on the ports that packets > are passing fine into the router fabric and through to the > CPU port but the ethernet driver where the fixed link is > connected refuse to accept the packages. Hi Linus Have you played with RGMII delays? Andrew
On 28.05.2018 20:47, Linus Walleij wrote: > This is a second RFC version of the DSA driver for Realtek > RTL8366x especially RTL8366RB. > > I've been beating my head against this one and I'm not really > clear on why my ethernet frames are not coming through to the > CPU port on the chip. > > It appears when using ethtool -S on the ports that packets > are passing fine into the router fabric and through to the > CPU port but the ethernet driver where the fixed link is > connected refuse to accept the packages. > > Of course packages needs VLAN tagging/untagging, this is not > the problem as it seems. The OpenWRT userspace even kicks > the interface in promiscuous mode so all packages should be > accepted, I also tried tcpdump on the interface to no avail: > the ethernet frames are so broken that they do not even make > it through the fixed link. > > The do cause error statistics on the ethernet port on the > system side. > > It might very well be that the problem is on the ethernet > driver side, and this driver "just works" with other > routers, so reposting it along with the DTS example so others > can try it while I keep banging my head against it. Maybe > I should just try to obtain another router with this chip > so as to establish that it is not the DSA router driver that > is wrong. > > I did try this hardware with the present OpenWRT driver > (not DSA) and that failed too. > > Anyways check out the new DT bindings etc. > > Linus Walleij (4): > net: phy: realtek: Support RTL8366RB variant > net: dsa: Add bindings for Realtek SMI DSAs > net: dsa: realtek-smi: Add Realtek SMI driver > ARM: dts: Add ethernet and switch to D-Link DIR-685 > > .../bindings/net/dsa/realtek-smi.txt | 153 ++ > arch/arm/boot/dts/gemini-dlink-dir-685.dts | 153 +- > drivers/net/dsa/Kconfig | 12 + > drivers/net/dsa/Makefile | 2 + > drivers/net/dsa/realtek-smi.c | 488 ++++++ > drivers/net/dsa/realtek-smi.h | 146 ++ > drivers/net/dsa/rtl8366.c | 524 ++++++ > drivers/net/dsa/rtl8366rb.c | 1411 +++++++++++++++++ > drivers/net/phy/realtek.c | 33 + > 9 files changed, 2921 insertions(+), 1 deletion(-) > create mode 100644 Documentation/devicetree/bindings/net/dsa/realtek-smi.txt > create mode 100644 drivers/net/dsa/realtek-smi.c > create mode 100644 drivers/net/dsa/realtek-smi.h > create mode 100644 drivers/net/dsa/rtl8366.c > create mode 100644 drivers/net/dsa/rtl8366rb.c > I have a very strange problem with this switch too, porting the 1043nd-v1 ar71xx target to ath79 dts using the *standard* drivers (John validated that they work in that config), I can see the packets on the interface but no actual traffic routed or accepted, from time to time, after a power off, the exact image is working, then after 2-3 reboots is not working anymore. I'll try the dsa drivers on the new ath79 target and come back at you Regards
On Mon, May 28, 2018 at 8:20 PM, Andrew Lunn <andrew@lunn.ch> wrote: > On Mon, May 28, 2018 at 07:47:48PM +0200, Linus Walleij wrote: >> This is a second RFC version of the DSA driver for Realtek >> RTL8366x especially RTL8366RB. >> >> I've been beating my head against this one and I'm not really >> clear on why my ethernet frames are not coming through to the >> CPU port on the chip. >> >> It appears when using ethtool -S on the ports that packets >> are passing fine into the router fabric and through to the >> CPU port but the ethernet driver where the fixed link is >> connected refuse to accept the packages. > > Hi Linus > > Have you played with RGMII delays? No not like I changed them or anything... the SoC has some set-up for skew and delay on the nanosecond level, but I used the vendor defaults, verified to be the same in their custom kernel tree. It's this stuff from the DTS: + conf0 { + pins = "V8 GMAC0 RXDV", "T10 GMAC1 RXDV"; + skew-delay = <0>; + }; + conf1 { + pins = "Y7 GMAC0 RXC", "Y11 GMAC1 RXC"; + skew-delay = <15>; + }; + conf2 { + pins = "T8 GMAC0 TXEN", "W11 GMAC1 TXEN"; + skew-delay = <7>; + }; + conf3 { + pins = "U8 GMAC0 TXC"; + skew-delay = <11>; + }; + conf4 { + pins = "V11 GMAC1 TXC"; + skew-delay = <10>; + }; Yours, Linus Walleij
On Tue, May 29, 2018 at 10:49:46AM +0200, Linus Walleij wrote: > On Mon, May 28, 2018 at 8:20 PM, Andrew Lunn <andrew@lunn.ch> wrote: > > On Mon, May 28, 2018 at 07:47:48PM +0200, Linus Walleij wrote: > >> This is a second RFC version of the DSA driver for Realtek > >> RTL8366x especially RTL8366RB. > >> > >> I've been beating my head against this one and I'm not really > >> clear on why my ethernet frames are not coming through to the > >> CPU port on the chip. > >> > >> It appears when using ethtool -S on the ports that packets > >> are passing fine into the router fabric and through to the > >> CPU port but the ethernet driver where the fixed link is > >> connected refuse to accept the packages. > > > > Hi Linus > > > > Have you played with RGMII delays? > > No not like I changed them or anything... the SoC has some > set-up for skew and delay on the nanosecond level, but I used the > vendor defaults, verified to be the same in their custom > kernel tree. Hi Linus Did you look at the switch end? I found a datasheet for the 8366/8369. Register at 0x0050, P8GCR. It has two bits for RGMII delays. With RGMII delays, you have 3 'choices'. 1) The hardware design includes the delay, by zig-zagging the clock line to make it longer. 2) The 'MAC' side does the delay. 3) The 'PHY' side does the delay. I normally recommend the PHY side doing it, because that's what most board do. Gives us some consistency. But it does not really matter. Just make sure one side, and only once side is inserting the delays. Andrew
On Tue, May 29, 2018 at 2:24 PM, Andrew Lunn <andrew@lunn.ch> wrote: > Did you look at the switch end? I found a datasheet for the > 8366/8369. Register at 0x0050, P8GCR. It has two bits for RGMII > delays. Unfortunately this datasheet is not applicable to RTL8366RB. RTL documentation and model numbers are a complete mess around the time when this chip came out, unfortunately... I even started to implement using that datasheet and had to toss a bunch of stuff away. There might not even be a proper datasheet for RTL8366RB, I'm afraid. The best we have is different (3 different AFAICT) vendor code drops. Here is one drop over at DD-WRT: https://svn.dd-wrt.com//browser/src/linux/universal/linux-3.2/drivers/net/ethernet/raeth/rb As you can see, the RTL8366RB vendor driver consists of a hacked version of their RTL8368S driver, so apparently those two ASICs are similar, they even kept the same filenames. For example the register defintions: https://svn.dd-wrt.com/browser/src/linux/universal/linux-3.2/drivers/net/ethernet/raeth/rb/rtl8368s_reg.h > With RGMII delays, you have 3 'choices'. > > 1) The hardware design includes the delay, by zig-zagging the clock > line to make it longer. > 2) The 'MAC' side does the delay. > 3) The 'PHY' side does the delay. > > I normally recommend the PHY side doing it, because that's what most > board do. Gives us some consistency. But it does not really > matter. Just make sure one side, and only once side is inserting the > delays. Makes sense! But I haven't found anything applicable in the RTL8366RB registers. There are some jam tables with magic values written all over the place that have no documentation, I fear this is one of the settings poked around with there. However, even if this router did not come with any code for the RTL8366RB driver, I disassembled the binary to verify that they use the same magic jam table, so the ASIC is initialized in the same way. Yours, Linus Walleij
The sender domain has a DMARC Reject/Quarantine policy which disallows sending mailing list messages using the original "From" header. To mitigate this problem, the original message has been wrapped automatically by the mailing list software. > On 29 May 2018, at 19:41, Linus Walleij <linus.walleij@linaro.org> wrote: > > On Tue, May 29, 2018 at 2:24 PM, Andrew Lunn <andrew@lunn.ch> wrote: > >> Did you look at the switch end? I found a datasheet for the >> 8366/8369. Register at 0x0050, P8GCR. It has two bits for RGMII >> delays. > > Unfortunately this datasheet is not applicable to RTL8366RB. > > RTL documentation and model numbers are a complete mess > around the time when this chip came out, unfortunately... I even > started to implement using that datasheet and had to toss a bunch > of stuff away. > > There might not even be a proper datasheet for RTL8366RB, > I'm afraid. The best we have is different (3 different AFAICT) > vendor code drops. Here is one drop over at DD-WRT: > https://svn.dd-wrt.com//browser/src/linux/universal/linux-3.2/drivers/net/ethernet/raeth/rb > > As you can see, the RTL8366RB vendor driver consists of > a hacked version of their RTL8368S driver, so apparently those > two ASICs are similar, they even kept the same filenames. > > For example the register defintions: > https://svn.dd-wrt.com/browser/src/linux/universal/linux-3.2/drivers/net/ethernet/raeth/rb/rtl8368s_reg.h > >> With RGMII delays, you have 3 'choices'. >> >> 1) The hardware design includes the delay, by zig-zagging the clock >> line to make it longer. >> 2) The 'MAC' side does the delay. >> 3) The 'PHY' side does the delay. >> >> I normally recommend the PHY side doing it, because that's what most >> board do. Gives us some consistency. But it does not really >> matter. Just make sure one side, and only once side is inserting the >> delays. > > Makes sense! But I haven't found anything applicable in the > RTL8366RB registers. > > There are some jam tables with magic values written all over > the place that have no documentation, I fear this is one of the > settings poked around with there. > > However, even if this router did not come with any code for > the RTL8366RB driver, I disassembled the binary to verify > that they use the same magic jam table, so the ASIC is > initialized in the same way. > > Yours, > Linus Walleij > > _______________________________________________ > openwrt-devel mailing list > openwrt-devel@lists.openwrt.org > https://lists.openwrt.org/listinfo/openwrt-devel Oh lordy, that horrible device as exhibited in the netgear DGN3500. Talk about magic values https://git.openwrt.org/?p=openwrt/openwrt.git;a=commit;h=42120bd7f323ff7170b32a5fd4674babd8b184bc Cheers, Kevin D-B 012C ACB2 28C6 C53E 9775 9123 B3A2 389B 9DE2 334A
On Tue, May 29, 2018 at 8:57 PM, Kevin Darbyshire-Bryant <kevin@darbyshire-bryant.me.uk> wrote: > Oh lordy, that horrible device as exhibited in the netgear DGN3500. Talk about magic values > https://git.openwrt.org/?p=openwrt/openwrt.git;a=commit;h=42120bd7f323ff7170b32a5fd4674babd8b184bc Yeah I even copied that init sequence over to this driver, however I actually think I have the LED activity somewhat under control in this new driver as those registers were kind-of-sort-of documented in the vendor code drop. It turns out the D-Link thing I am playing with doesn't even have any LEDs mounted so I can't test it though. Yours, Linus Walleij