This doesn't work me as well. What did you do (which packages?) to solve this?
I haven't done any sort of performance test on DSA yet. We're going to put this sort of information on the device wiki, so your findings would be very helpful.
Device Tree Specification of RTL8365MB
We need to figure out the GPIO IDs for mdc-gpios
, mdio-gpios
, reset-gpios
& interrupts
compatible = "realtek,rtl8365mb";
/* 7 = MDIO (has input reads), 6 = MDC (clock, output only) */
/* reset-gpios: 14? */
mdc-gpios = <&chipcommon 6 GPIO_ACTIVE_HIGH>;
mdio-gpios = <&chipcommon 7 GPIO_ACTIVE_HIGH>;
reset-gpios = <&chipcommon 14 GPIO_ACTIVE_LOW>;
I assumed the GPIO IDs for mdc-gpios
& mdio-gpios
according to the rtl8365mb driver from Asuswrt tarball smi.c source code:
/*******************************************************************************/
/* I2C porting */
/*******************************************************************************/
/* Define the GPIO ID for SCK & SDA */
rtk_uint32 smi_SCK = 6; /* GPIO used for SMI Clock Generation */
rtk_uint32 smi_SDA = 7; /* GPIO used for SMI Data signal */
There's also the PHY ID. I don't know whether to include it on device tree.
/*******************************************************************************/
/* MDC/MDIO porting */
/*******************************************************************************/
/* define the PHY ID currently used */
#define MDC_MDIO_PHY_ID 0 /* PHY ID 0 or 29 */
Current device tree:
switch@1 {
compatible = "realtek,rtl8365mb";
/* 7 = MDIO (has input reads), 6 = MDC (clock, output only) */
/* reset-gpios: 14? */
mdc-gpios = <&chipcommon 6 GPIO_ACTIVE_HIGH>;
mdio-gpios = <&chipcommon 7 GPIO_ACTIVE_HIGH>;
reset-gpios = <&chipcommon 14 GPIO_ACTIVE_LOW>;
dsa,member = <0 1>;
switch_intc: interrupt-controller {
/* GPIO 15 provides the interrupt */
interrupt-parent = <&chipcommon>;
interrupts = <15 IRQ_TYPE_LEVEL_LOW>;
interrupt-controller;
#address-cells = <0>;
#interrupt-cells = <1>;
};
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
label = "lan8";
phy-handle = <&phy0>;
};
port@1 {
reg = <1>;
label = "lan7";
phy-handle = <&phy1>;
};
port@2 {
reg = <2>;
label = "lan6";
phy-handle = <&phy2>;
};
port@3 {
reg = <3>;
label = "lan5";
phy-handle = <&phy3>;
};
port@4 {
reg = <4>;
label = "cpu";
ethernet = <&sw0_p5>;
phy-mode = "rgmii";
fixed-link {
speed = <1000>;
full-duplex;
};
};
};
mdio {
compatible = "realtek,smi-mdio", "dsa-mdio";
#address-cells = <1>;
#size-cells = <0>;
phy0: phy@0 {
reg = <0>;
interrupt-parent = <&switch_intc>;
interrupts = <0>;
};
phy1: phy@1 {
reg = <1>;
interrupt-parent = <&switch_intc>;
interrupts = <1>;
};
phy2: phy@2 {
reg = <2>;
interrupt-parent = <&switch_intc>;
interrupts = <2>;
};
phy3: phy@3 {
reg = <3>;
interrupt-parent = <&switch_intc>;
interrupts = <3>;
};
};
};
Switch cannot be probed properly with the current device tree:
[ 1.598858] realtek-smi switch@1: failed to get RESET GPIO
---
[ 3.015528] realtek-smi switch@1: deasserted RESET
[ 3.021171] realtek-smi switch@1: found an RTL8365MB-VC switch (ver=0x0040)
[ 3.028193] realtek-smi switch@1: unable to register switch ret = -517
---
[ 3.405527] realtek-smi switch@1: deasserted RESET
[ 3.411165] realtek-smi switch@1: found an RTL8365MB-VC switch (ver=0x0040)
[ 3.418449] DSA: tree 0 already setup! Disjoint trees?
[ 3.423607] realtek-smi switch@1: unable to register switch ret = -17
[ 3.430137] realtek-smi: probe of switch@1 failed with error -17
Any ideas how we figure out the GPIO ID for reset-gpios
?