lan9303 switch device tree stm32mp1
Hi
I try to implement lan9303 switch with stm32mp1.
My current achievement is working only one channel
My working dts is
ðernet0{
pinctrl-names = "default", "sleep";
pinctrl-0 = <ð1_pins_mx>;
pinctrl-1 = <ð1_sleep_pins_mx>;
status = "okay";
phy-mode = "rmii";
max-speed = <100>;
phy-handle = <&switch>;
nvmem-cells = <ðernet_mac_address>;
nvmem-cell-names = "mac-address";
st,eth-ref-clk-sel;
clock-names = "stmmaceth",
"eth-ck",
"mac-clk-tx",
"mac-clk-rx",
"ethstp";
clocks = <&rcc ETHMAC>,
<&rcc ETHCK_K>,
<&rcc ETHTX>,
<&rcc ETHRX>,
<&rcc ETHSTP>;
mdio0 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "snps,dwmac-mdio";
switch: switch-phy@0 {
compatible = "ethernet-phy-id0007.C0D1","ethernet-phy-ieee802.3-c22";
/*compatible = "smsc,lan9303-mdio";*/
reg = <0>;
clocks = <&rcc ETHCK_K>;
clock-names = "rmii-ref";
reset-gpios = <&gpioa 4 GPIO_ACTIVE_LOW>;
reset-duration = <100>;
interrupt-parent = <&gpiog>;
interrupts = <12 IRQ_TYPE_EDGE_FALLING>; /* ETH_MDINT# */
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
label = "cpu";
ethernet = <ðernet0>;
};
port@1 { /* external port 1 */
reg = <1>;
label = "lan1";
};
port@2 { /* external port 2 */
reg = <2>;
label = "lan2";
};
};
};
};
};but works only one channel
log
[ 0.000000] psci: probing for conduit method from DT.
[ 1.521077] usbcore: registered new interface driver cdc_ether
[ 2.821806] stm32-dwmac 5800a000.ethernet: IRQ eth_lpi not found
[ 2.826787] stm32-dwmac 5800a000.ethernet: PTP uses main clock
[ 2.832343] stm32-dwmac 5800a000.ethernet: no reset control found
[ 2.839174] stm32-dwmac 5800a000.ethernet: User ID: 0x40, Synopsys ID: 0x42
[ 2.845637] stm32-dwmac 5800a000.ethernet: DWMAC4/5
[ 2.850598] stm32-dwmac 5800a000.ethernet: DMA HW capability register supported
[ 2.858071] stm32-dwmac 5800a000.ethernet: RX Checksum Offload Engine supported
[ 2.865439] stm32-dwmac 5800a000.ethernet: TX Checksum insertion supported
[ 2.872380] stm32-dwmac 5800a000.ethernet: Wake-Up On Lan supported
[ 2.878880] stm32-dwmac 5800a000.ethernet: TSO supported
[ 2.884145] stm32-dwmac 5800a000.ethernet: Enable RX Mitigation via HW Watchdog Timer
[ 2.892063] stm32-dwmac 5800a000.ethernet: device MAC address 26:b3:aa:be:d2:74
[ 2.899487] stm32-dwmac 5800a000.ethernet: Enabled Flow TC (entries=2)
[ 2.906093] stm32-dwmac 5800a000.ethernet: TSO feature enabled
[ 2.911986] stm32-dwmac 5800a000.ethernet: Using 32 bits DMA width
[ 51.455894] using random self ethernet address
[ 51.458948] using random host ethernet address
[ 51.974713] stm32-dwmac 5800a000.ethernet eth0: PHY [stmmac-0:00] driver [SMSC LAN911x Internal PHY] (irq=52)
[ 52.037633] stm32-dwmac 5800a000.ethernet eth0: No Safety Features support found
[ 52.070669] stm32-dwmac 5800a000.ethernet eth0: IEEE 1588-2008 Advanced Timestamp supported
[ 52.093902] stm32-dwmac 5800a000.ethernet eth0: registered PTP clock
[ 52.118405] stm32-dwmac 5800a000.ethernet eth0: configuring for phy/rmii link mode
[ 52.161436] stm32-dwmac 5800a000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx
[ 52.212295] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
when I change to
ðernet0{
pinctrl-names = "default", "sleep";
pinctrl-0 = <ð1_pins_mx>;
pinctrl-1 = <ð1_sleep_pins_mx>;
status = "okay";
phy-mode = "rmii";
max-speed = <100>;
phy-handle = <&switch>;
nvmem-cells = <ðernet_mac_address>;
nvmem-cell-names = "mac-address";
st,eth-ref-clk-sel;
clock-names = "stmmaceth",
"eth-ck",
"mac-clk-tx",
"mac-clk-rx",
"ethstp";
clocks = <&rcc ETHMAC>,
<&rcc ETHCK_K>,
<&rcc ETHTX>,
<&rcc ETHRX>,
<&rcc ETHSTP>;
mdio0 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "snps,dwmac-mdio";
switch: switch-phy@0 {
/*compatible = "ethernet-phy-id0007.C0D1","ethernet-phy-ieee802.3-c22";*/
compatible = "smsc,lan9303-mdio";
reg = <0>;
clocks = <&rcc ETHCK_K>;
clock-names = "rmii-ref";
reset-gpios = <&gpioa 4 GPIO_ACTIVE_LOW>;
reset-duration = <100>;
interrupt-parent = <&gpiog>;
interrupts = <12 IRQ_TYPE_EDGE_FALLING>; /* ETH_MDINT# */
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
label = "cpu";
ethernet = <ðernet0>;
};
port@1 { /* external port 1 */
reg = <1>;
label = "lan1";
};
port@2 { /* external port 2 */
reg = <2>;
label = "lan2";
};
};
};
};
};I have a result
[ 2.920866] libphy: stmmac: probed
[ 3.046999] LAN9303_MDIO stmmac-0:00: Found LAN9303 rev. 1
[ 3.426832] LAN9303_MDIO stmmac-0:00: Found LAN9303 rev. 1
[ 3.465957] LAN9303_MDIO stmmac-0:00: Using legacy PHYLIB callbacks. Please migrate to PHYLINK!
[ 3.475721] LAN9303_MDIO stmmac-0:00 lan1 (uninitialized): PHY [dsa-0.0:01] driver [SMSC LAN911x Internal PHY] (irq=POLL)
[ 3.487748] LAN9303_MDIO stmmac-0:00 lan2 (uninitialized): PHY [dsa-0.0:02] driver [SMSC LAN911x Internal PHY] (irq=POLL)
[ 3.500408] LAN9303_MDIO stmmac-0:00: LAN9303 MDIO driver loaded successfully
[ 69.119209] stm32-dwmac 5800a000.ethernet eth0: stmmac_open: Cannot attach to PHY (error: -19)
What I do wrong?
