Switch integration
# │forum
On the Turing Pi there is according to the docs a switch Realtek RTL8370MB-CG. Are there any official docs how the data and control lines are connected to the Allwinner T113-S3? The used Linux 5.4 in the current firmware version has already support in the Distributed Switch Architecture (DSA) for the RTL8366 and RTL8367 switch ASICs. There are no official sources for the datasheets, but so far I found datasheets for all those ASICs in the internet, the control registers are are identical (or Realtek is expert in Cut'n'Paste 😉 ). DSA would allow breaking out every switchport as an seperate interface on linux. VLAN and switching is offloaded to the switch ASIC. The idea would be extending the network capabilites of the BMC linux. Eg you could group the Pis into two clusters on two LAN segments via VLAN for example. Many more ideas might be interessting.
I know of no official docs, but have found that the RTL8370MB-CG is connected to T113 pins PE12/PE13, the same pins that go to the I²C bus that the 24C02 is on. It's strapped in "Realtek-style I²C-like mode" and can be reached at I²C address 0x5C, and you can write to registers by sending a message like: [WRITE/0x5C, REGL, REGH, VALL, VALH], but since it's in "Realtek-style" mode, read transactions require "NOSTART" support which the Sunxi I²C driver can't (yet) do.
I'm excited that there's already DSA support for this ASIC in the kernel. The kernel seems to call the "Realtek-style" mode "SMI," though it's actually way more I²C-like than MDIO-like.
Since the switch is on the same bus as the 24C02, we can't really use the SMI bitbang driver, since it would cut off access to the 24C02. I think we might need to write a
which can handle speaking either MSB/LSB-mode I²C or SMI-via-NOSTART.
Honestly I'm sorely tempted to see if upstream Linux is interested in a patch that replaces the
driver with i2c-gpio internally, and extends it to allow managing Realtek switches on an existing bus.
Cool, I searched a bit in OpenWRT as they have Allwinner support, but board with t113 is support for inspiration though. I ve seen patches to support the rtl8370 as on this board in main. I wonder for what the 24c02 is actually used?
I wonder the same. When I first saw it, I thought "ah ha! That's where the factory data (permanent MAC, serial, manufacture date, ...) is kept.
But on both of my boards they contained all-FF bytes
I guess the same Also as far as I understand the ASIC uses the same lines for eeprom configuration according to a datasheet. In chapter 7.4 Pin Definitions is PIN 80 described for the EEPROM size selection. How it is working in chapter 11. Maybe it was also be destined for this originally?
So I did spend a few hours poking and prodding at the switch's peripherals with a logic analyzer and found absolutely no sign that it tries to read either the EEPROM or the SPI-NOR (the little Winbond chip tucked behind node 4) on startup.
I suspect the 2-pin jumper near the node 2 slot is the "DIS_AUTOLOAD" line. It does go to the switch, I just don't know which pin.
So probably adding a jumper there would cause it to autoconfigure from the SPI-NOR on reset?
(I do not know whether it's strapped to read from 24C02 or the SPI-NOR when autoload is enabled.)