I need to change usb1-port1 from USB 2.0 to USB 3.0. The rest fits your description.
@arinc9 : Have you seen "net: dsa: add support for RTL8365MB-VC" on the linux kernel mailing list.
That may help in setting up the rtl8365mb switch.
No I haven't seen this. That's huge! DSA support for rtl8365mb means a lot now that more and more targets are being switched to DSA on OpenWrt. For now, bcm53xx (target of RT-AC88U) uses swconfig, I think it would be fairly easy to port this DSA driver to swconfig.
Devices can be moved to DSA individually, even if the rest of the target isn't ready yet.
Hey @slh, I'm aware of that but kconfig are for targets, right? If I were to change kconfig to use DSA instead, that would change the settings for the whole target, therefore I can't submit a patch to have this device on the OpenWrt repository, correct?
Precedent would be mvebu and the turris omnia, in OpenWrt this device was (only) merged with DSA support from day 1, even though the rest of the mvebu target was still using swconfig.
Thanks for pointing this out. I checked the support commit for Turris Omnia. You're right, this change on the kconfig shows that DSA was enabled along with swconfig, making it possible for different devices on the same target to have DSA and swconfig support.
I'm not sure whether this will work for RT-AC88U though. There are DSA and swconfig drivers for the broadcom switch, which swconfig might try to probe the broadcom switch. I'll try a few things, see if we can make it work.
Update:
Disclaimer, I'm not familiar with the bcm53xx target.
If there are DSA drivers for the other supported bcm53xx targets, you might also be able to coordinate with the target maintainers to migrate the target as a whole.
@arinc9 you were right about the Wifi LEDs, after flashing Merlin and DD-WRT and back to OpenWrt the LEDs did work for a moment. But after flashing OpenWrt a few more times they are now off again. Well so be it for the moment.
Are you working on the rtl8365mb? I may find time in the next few weeks but would purely have to take 8367 as a template and improvise the rest (swconfig based then of course).
Could there be something (or something missing) on NVRAM that causes this? Can you reset NVRAM (only way I know is to get into CFE web recovery, there's a button for it) and see if Wi-Fi LEDs start working? Or you could print everything in NVRAM and compare them in these two situations:
- When Wi-Fi LEDs work
- When Wi-Fi LEDs won't work
I actually did what you specifically stated on this branch:
I added the rtl8367s driver and tried to tweak it to work on rtl8365mb. No dice.
I don't see any reason to add swconfig support for rtl8365mb now that there's DSA support in the works upstream.
If you'd still like to develop a swconfig driver for whatever reason, I see three ways of doing so:
- Tweak rtl8367s swconfig driver (like I attempted)
- Tweak rtl8367b swconfig driver (like dengqf6 did to support rtl8367s)[1]
- Modify upcoming rtl8365mb DSA driver for swconfig to handle the switch instead
Wifi LEDs: I'll check the NVRAM, I did save nvram show
the last time I check for the USB ports. But did only look for USB related stuff. It has to be possible since on Merlin the brightness_zero
works too. But maybe it's some driver function. We'll
I'll work on that for now, creating a /etc/rc.button/brightness_zero script to be able to switch the LEDs on and off.
rtl8365mb: I don't really need the ethernet ports, only three are used. After the LEDs I'l check if I find anything to go by with the new DSA patches in regards to entry points and address, etc. But of course - again - you're right that it's easier to wait for the DSA driver.
Not much luck with the NVRAM settings: OpenWrt got 431 and ASUS Merlin 3078 (!) nvram values.
I did install ASUS Merlin again and saved the outputs of nvram show
for Wifi On/Off and LEDs On/Off etc. That way it was possible to pinpoint the NVRAM settings changes. None of these NVRAM values are present in OpenWrt and setting them doesn't change anything.
The simplest to test was one called AllLED
which is used to turn off or on all LEDs by setting it to 0 or 1 - no effect on OpenWrt.
That call on Merlin is made to a binary-only Quantenna module function:
qcsapi_wifi_run_script("router_command.sh", "wifi_led_off");
There's an old thread OpenWrt Got wifi working on Netgear R7500 version 1 where that function is mentioned and that Quantenna offer GPL code to the module.
Tl;dr: seems quite complicated and I'm not sure I'll go down that lets-compile-that-code-and-include-it.
@arinc9 two questions came up:
reset: does resetting using the button work for you? It never did for me, everytime I have to go through firmware restoration (which works just fine).
broadcom switch: according to hwinfo
this switch is a bcm53012 which would be already be supported by DSA. See drivers/net/dsa/b53/b53_{priv.h,common.c}
in build_dir/target/...
.
Would you by any chance know how one would go about to try to compile it? I did try enabling DSA in kernel_config and disabling SWSWITCH but wasn't successful in compiling it (MDIO method missing).
I did follow Build for Linksys EA9500 which seems similar in that area. To be fair they haven't enabled DSA for the 53012 but for the second 4 port switch which is also from Broadcom.
hwinfo:
platform device: name = 18007000.ethernet-switch
path = /devices/platform/18007000.ethernet-switch
type = "ethernet-switch", modalias = "of:Nethernet-switchT(null)Cbrcm,bcm53012-srabCbrcm,bcm5301x-srab", driver = ""
I remember that when pressed, it resets OpenWrt to default settings. I'll try it again.
That's right.
My dsa branch for RT-AC88U uses DSA for the broadcom switch.
See if you can cherry pick this commit. kernel configuration might get into conflict so enable DSA & disable swconfig manually with make kernel_menuconfig
If I remember correctly, switch and switchports must be defined on device tree (DTS) for DSA to probe the switch. My commit does that along with other things.
Keep in mind that I couldn't get the broadcom switch to send proper frames with DSA using the current commit. Check the history of this thread. Let me know how it goes for you.
Thanks for your quick reply, I'm trying to compile your branch while I type. Still getting the same error as I got before (see below) but I'll see if I can solve it
mdio-netlink.c:447:14: error: implicit declaration of function 'mdio_find_bus'; did you mean 'mdio_nl_flush'? [-Werror=implicit-function-declaration]
xfer.mdio = mdio_find_bus(nla_data(info->attrs[MDIO_NLA_BUS_ID]));
I got a maybe (unrelated) dumb question: what is eth2
representing? CPU2?
And: While reading up on the DSA and Linksys EA9500 topic, I read through ARM: dts: BCM5301X: Add support for Linksys EA9500. And was wondering about the connection from the internal to the external switch in the RT-AC88U. Am I right to assume that it's port 5 on the internal switch which connects to the external switch?
In the NVRAM settings of Merlin you can find rgmii_port=5
which would indicate as such. Not relevant right now, just for my curiosity.
Switch reset: in the Merlin NVRAM is an entry reset_switch_gpio=10
, just FYI if not clear (it wasn't to me). Not sure if it resets the internal or external, or both switches.
Not dumb at all. There’re eth0, eth1 & eth2 interfaces so the router can control the switch.
From what I’ve seen on a few devices:
- port 5, 7 & 8 are CPU ports
- port 5 -> eth0
- port 7 -> eth1
- port 8 -> eth2
If I remember correctly, the device manufacturer decides which interface (therefore the corresponding CPU port) to use.
On this device, eth1 (port 7) is chosen. You can check the DTS file on dsa branch and see that port 7 is enabled while 5 & 8 are disabled because they’re not used.
From the code of swconfig drivers for rtl8367x switches, I see that port 6 is used to connect these switches. I suppose that is the port to connect an external switch on the broadcom switch.
From what I’ve seen on the conversation, EA9500 uses port 8 to connect the external switch to the internal switch. Looks like this is incorrect and port 0 is used on internal switch. Then, the internal switch uses whichever port that’s defined to connect the router to the internal switch.
We haven’t found which port on the external switch is used to connect to the internal switch. So it could be port 8 on internal switch (broadcom) and port 6 on external switch (realtek). This picture is good enough to illustrate:
Add port 6 on realtek and connect it to port 8 on broadcom. Then figure out 0 - 4 ports for lan5 - lan8.
That’s a type of Media-independent interface which, I suppose, connects the switch to the router which is not used for this device.
I see. I’m not sure what’s the meaning of resetting a switch though. Does this like restart the switch without rebooting the device?
The reset button on the device has got GPIO 11. It’s hardcoded on the DTS file to initiate KEY_RESTART linux function where OpenWrt can reset to defaults reboots the device when the button is pressed.
The good news first: DSA with the internal switch works so far. Not done any VLANs yet but just a bridge over LAN{1..4}. Connection to WAN/Internet works great.
root@OpenWrt:~# ethtool -S wan
NIC statistics:
tx_packets: 2221
tx_bytes: 363211
rx_packets: 7348
rx_bytes: 5503474
TxOctets: 372735
...
TxCollisions: 0
TxSingleCollision: 0
TxMultipleCollision: 0
TxDeferredTransmit: 0
TxLateCollision: 0
TxExcessiveCollision: 0
TxPausePkts: 0
...
RxFCSErrors: 0
RxGoodOctets: 5606346
RxDropPkts: 0
RxUnicastPkts: 4914
RxMulticastPkts: 797
RxBroadcastPkts: 1637
RxSAChanges: 1816
RxFragments: 0
RxJumboPkts: 0
RxSymbolErrors: 0
RxDiscarded: 0
The only thing necessary to change was the port of the switch as Vivek did for the Linksys EA9500 -> Comment #9 ARM: dts: BCM5301X: Add support for Linksys EA9500 .
In drivers/net/dsa/b53/b53_common.c
, changing
.cpu_port = B53_CPU_PORT_25
to
.cpu_port = B53_CPU_PORT
... did it.
2213 {
2214 .chip_id = BCM53012_DEVICE_ID,
2215 .dev_name = "BCM53012",
2216 .vlans = 4096,
2217 .enabled_ports = 0x1bf,
2218 .arl_entries = 4,
2219 .cpu_port = B53_CPU_PORT, /* TODO: auto detect */
2220 .vta_regs = B53_VTA_REGS,
2221 .duplex_reg = B53_DUPLEX_STAT_GE,
2222 .jumbo_pm_reg = B53_JUMBO_PORT_MASK,
2223 .jumbo_size_reg = B53_JUMBO_MAX_SIZE,
2224 },
CPU ports: Thanks for the diagram, I do understand now.
RGMII: I just thought that they wouldn't export an NVRAM setting rgmii_port=5
if not useful/necessary. And the +1 port on the RealTek rtl8365mb supports RGMII RTL8365MB-VC-CG. We'll see if it's helpful when we get to config/access this switch with DSA.
Switch reset: I did assume that you can reset the switch if you want to get ride of VLAN configs and similar. But I don't know yet, will test it later this week.
USB Work
Make USB ports work
I just tried your findings and USB ports start working after GPIO 9 set as output high! I couldn't possibly find this myself, thank you very much!
We can specify GPIO 9 as output-high on the device tree to fix this. I don't know how to do that, so I leave this to the people on the mailing list (or you) to figure it out.
ACTUALLY, this line from the EA9500 patch you linked has got these. I wonder if this would work.
&usb2 {
vcc-gpio = <&chipcommon 13 GPIO_ACTIVE_HIGH>;
};
&usb3 {
vcc-gpio = <&chipcommon 14 GPIO_ACTIVE_HIGH>;
};
USB LEDs
I updated my commits on swconfig & dsa branches with correct LED mappings for USB.
kmod-usb-ledtrig-usbport
is already included with $(USB3_PACKAGES)
on the makefile for the device. We shouldn't include the luci package on the stock image so this is all good.
I see your PR is merged, congrats! I've compiled master and tried latest luci including your PR. Everything works fine!
Reset Button
Understood. I just realised the KEY_RESTART function reboots the device. It does not make OpenWrt reset to defaults. I tried it today on my RT-AC88U, the button works fine.
DSA
I'll try the DSA branch on my device and see if this does the trick.
Just a quick note before bedtime:
USB power up: that's great, never thought of that. I just added the commands to rc.local
. But I tried what you suggested and it works flawless, USBs are up without the need of rc.local
.
External switch: The external switch is on port 5 of the internal switch. I tried 6, then 8 and last 5.
Now the ports LAN5 to LAN8 are accessible through the interface extswitch
.
+ sw0port0: port@5 {
+ reg = <5>;
+ label = "extswitch";
+
+ fixed-link {
+ speed = <1000>;
+ full-duplex;
+ };
+ };
I haven't tested anything like VLANs yet. I added the extswitch
to the LAN bridge and now I can connect through them too.
Whoa there, you gotta let me catch up
How did you include the DSA driver for rtl8365mb? What's your current DTS file with USB & Realtek switch definitions?
USB & LED Work
I've updated my commit on swconfig branch with my changes to better adapt LED configuration on device tree and OpenWrt. I also added the vcc-gpio
entry on device tree.
Therefore, USB & LEDs are completely finished!
Since we have the same GPIO for both usb2 & usb3, specifying vcc-gpio
on one of the usb nodes will be sufficient.
swconfig & DSA branches
I'm going to make the commits between the swconfig & DSA branches better organised and in sync by the morning.