cancel
Showing results for 
Search instead for 
Did you mean: 

STM32MP135F - How to create a DeviceTree for a Switch (Marvell-88E6185)

skarayigit
Associate III

Hi,

I have created a device tree for Marvell 88E6185 (10 port switch).

  • Port9 of the 88E6185 is in PHY mode (MII) connected to STM32MP135F Ethernet2. MDIO lines of the Switch directl connected to Ethernet2 MDIO lines.
  • Port0 is connected to Marvell 88E1112 PHY connected to RJ45.
    • SMI of 88E1112 is connected directly to 88E6185 SMI_PHY 
  • Port7 and Port8 connected to Fiber Connector.

None of the ports are turning on automatically. When I checked the MDC and MDIO lines between CPU and Switch I cannot see any attempt to communicate or connect with the switch. I have installed mdio-tools and I can see the phy and I can control them. I can force them to link up and change speed for every port. After I force them I can ping the google using RJ45 and also Fiber Port.

If I remove the fixed-link from the device tree, it gives me error saying cannot connect to phy (error -19)

I would like to be able to active the links during startup, is it possible?

 

and also Fiber Connectors have Enable pins (Port7 is connected to PB0 and Port8 is connected to PA7).

Where should I add those gpio settings so that, these pins changes with the boot and Enable the Fiber Connectors?

 

Here is my mdio outputs at port9:

root@stm32mp1:~# mdio stmmac-2
DEV PHY-ID LINK
0x10 0x00001a72 down
0x11 0x00001a72 down
0x12 0x00001a72 down
0x13 0x00001a72 down
0x14 0x00001a72 down
0x15 0x00001a72 down
0x16 0x00001a72 down
0x17 0x00001a72 down
0x18 0x00001a72 down
0x19 0x00001a72 down
0x1a 0x00001a72 down
0x1b 0x00000000 down
0x1c 0x0000ffff down
root@stm32mp1:~# mdio stmmac-2 25
BMCR(0x00): 0x608a
flags: -reset +loopback -aneg-enable -power-down -isolate -aneg-restart
+collision-test
speed: 100-half

BMSR(0x01): 0x2003
capabilities: -100-t4 -100-tx-f +100-tx-h -10-t-f -10-t-h -100-t2-f -100-t2-h
flags: -ext-status -aneg-complete -remote-fault -aneg-capable -link
+jabber +ext-register

ID(0x02/0x03): 0x00001a72

 

 

Here is my dmesg and ifconfig:

root@stm32mp1:~# dmesg | grep end2
[ 6.617490] stm32-dwmac 5800e000.eth2 end2: renamed from eth1
[ 32.214446] stm32-dwmac 5800e000.eth2 end2: Register MEM_TYPE_PAGE_POOL RxQ-0
[ 32.263580] stm32-dwmac 5800e000.eth2 end2: No Safety Features support found
[ 32.332789] stm32-dwmac 5800e000.eth2 end2: IEEE 1588-2008 Advanced Timestamp supported
[ 32.375327] stm32-dwmac 5800e000.eth2 end2: registered PTP clock
[ 32.407660] stm32-dwmac 5800e000.eth2 end2: configuring for fixed/mii link mode
[ 32.413716] stm32-dwmac 5800e000.eth2 end2: Link is Up - 100Mbps/Full - flow control off
[ 145.006857] stm32-dwmac 5800e000.eth2 end2: Link is Down
[ 158.679863] stm32-dwmac 5800e000.eth2 end2: Register MEM_TYPE_PAGE_POOL RxQ-0
[ 158.702056] stm32-dwmac 5800e000.eth2 end2: No Safety Features support found
[ 158.920684] stm32-dwmac 5800e000.eth2 end2: IEEE 1588-2008 Advanced Timestamp supported
[ 158.943316] stm32-dwmac 5800e000.eth2 end2: registered PTP clock
[ 158.947989] stm32-dwmac 5800e000.eth2 end2: configuring for fixed/mii link mode
[ 158.963087] stm32-dwmac 5800e000.eth2 end2: Link is Up - 100Mbps/Full - flow control off
[ 158.977089] IPv6: ADDRCONF(NETDEV_CHANGE): end2: link becomes ready
root@stm32mp1:~# ifconfig
end1 Link encap:Ethernet HWaddr AE:FE:24:C1:C5:E8
inet addr:192.168.122.63 Bcast:192.168.122.255 Mask:255.255.255.0
inet6 addr: fe80::acfe:24ff:fec1:c5e8/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:20495 errors:0 dropped:15 overruns:0 frame:0
TX packets:368 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2484491 (2.3 MiB) TX bytes:58762 (57.3 KiB)
Interrupt:50

end2 Link encap:Ethernet HWaddr 2E:37:C1:5D:10:A8
inet6 addr: fe80::2c37:c1ff:fe5d:10a8/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:76 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:14817 (14.4 KiB)
Interrupt:52 Base address:0xc000

 

Device Tree:

&eth2{
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&eth2_pins_mx>;
	pinctrl-1 = <&eth2_sleep_pins_mx>;
	status = "okay";

	/* USER CODE BEGIN eth2 */
	phy-mode = "mii";
	max-speed = <100>;
	phy-handle = <&switch0>;
	nvmem-cells = <&ethernet_mac2_address>;
	nvmem-cell-names = "mac-address";
	fixed-link {
		speed = <100>;
		full-duplex;
	};
	mdio{
		#address-cells = <1>;
		#size-cells = <0>;
		compatible = "snps,dwmac-mdio";

		switch0: switch0@0{
			compatible = "marvell,mv88e6085";
			#address-cells = <1>;
			#size-cells = <0>;
			reg = <0>;
			dsa,member = <0 0>;

			reset-names = "switch";
			reset-gpios = <&gpiod 0 (GPIO_ACTIVE_LOW)>;
			reset-assert-us = <10000>;
			reset-deassert-us = <2000>;

			enable-gpios = <&gpiob 0 GPIO_ACTIVE_LOW>;

			ports {
				#address-cells = <1>;
				#size-cells = <0>;

				port@0 {
					reg = <0>;
					label = "lan0";
				};

				port@7{
					reg = <7>;
					label = "lan7";
				};

				port@8 {
					reg = <8>;
					label = "lan8";
				};

				port@9 { 
					reg = <9>;
					label = "cpu";
					ethernet = <&eth2>;
					phy-mode = "mii";
					fixed-link {
						speed = <100>;
						full-duplex;
					};
				};
			};
		};
	};
	/* USER CODE END eth2 */
};

 

1 REPLY 1
skarayigit
Associate III

@Erwan SZYMANSKI Could you help me out with this?
I've also read this post https://community.st.com/t5/stm32-mpus-products/lan9303-switch-device-tree-stm32mp1/m-p/156033. I don't get similar dmesg about dsa switch and "lan*" nodes.