Access to Phy Regs on Custom Board

Hello Community,

i have a custom board with an 8devices carambola2 and a marvell mv88e6352. The switch is connected with port 1 to eth1 as the management interface. The mdio bus is connected to the switch via gpios 19 and 21 on the carambola. Phys are connected to ports 5 and 6 and have the Phy addresses 0x05 and 0x06. The Phys are IEEE 802. 3u Clause 22 compatible. The mdio interface of the Phys is connected to mdc_phy / mdio_phy of the switch. The Phys have the same addresses as the ports so that the Phy Polling Unit (PPU) of the switch can access the registers of the Phys. Now i am trying to access the registers with mdio-tools. However, this only works for the Phy with the address 0x05.

Currently the connections of the Phys are fixed links so the network traffic works normally. Although the Phy detect bit for port 6 is not set. If i remove the fixed link so that the PPU can work, the Phy can no longer be found on port 6.

If i disconnect the SMI connection to the Phy 5 i can access the Phy 6. Also if i set the addresses to 0x15 and 0x16 i can see both Phys and access the registers. But i would prefer it to work with the PPU.

Device Tree Section of the Switch

mdio_gpio: mdio-gpio {
		compatible = "virtual,mdio-gpio";
		gpios = <&gpio 19 GPIO_ACTIVE_HIGH>,
				<&gpio 21 GPIO_ACTIVE_HIGH>;

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

		switch2@20 {
			compatible = "marvell,mv88e6085";
			reg = <0>;
			dsa,member = <0 0>;

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

				port@1 {
					reg = <1>;
					phy-mode = "mii";
					ethernet = <&eth1>;
					label = "cpu";
					fixed-link {
						speed = <100>;
						full-duplex;
					};
				};

				port@3 {
					reg = <3>;
					label = "ensw2p3";
				};

				port@4 {
					reg = <4>;
					label = "ensw2p4";
				};

				port@5 {
					reg = <5>;
					phy-mode = "rgmii";
					label = "ensw2p5";
					fixed-link {
						speed = <1000>;
						full-duplex;
					};
				};

				port@6 {
					reg = <6>;
					phy-mode = "rgmii";
					label = "ensw2p6";
					fixed-link {
						speed = <1000>;
						full-duplex;
					};
				};
			};
		};
	};

Bootlog of the Switch with Fixed Link

[    1.573250] mv88e6085 gpio-0:00: switch 0x3520 detected: Marvell 88E6352, revision 1
[    2.017411] mv88e6085 gpio-0:00: configuring for fixed/mii link mode
[    2.026558] mv88e6085 gpio-0:00: Link is Up - 100Mbps/Full - flow control off
[    2.038838] mv88e6085 gpio-0:00 ensw2p3 (uninitialized): PHY [mv88e6xxx-1:03] driver [Marvell 88E1540] (irq=24)
[    2.064806] mv88e6085 gpio-0:00 ensw2p4 (uninitialized): PHY [mv88e6xxx-1:04] driver [Marvell 88E1540] (irq=25)

mv88e6xxx_dump --ports output

Using device <mdio_bus/gpio-0:00>
                           0    1    2    3    4    5    6
00 Port status            100f 1d0f 100f 100f 1e0f 1e07 0e07
01 Physical control       0003 003d 0003 0003 0003 003e 003e
02 Jamming control        ff00 0000 ff00 0000 0000 0000 0000
03 Switch ID              3521 3521 3521 3521 3521 3521 3521
04 Port control           007c 373f 007c 043c 043f 043f 043f
05 Port control 1         0000 0000 0000 0000 0000 0000 0000
06 Port base VLAN map     007e 007d 007b 0072 006a 005a 003a
07 Def VLAN ID & Prio     0001 0000 0001 0001 0001 0001 0001
08 Port control 2         2080 1080 2080 0c80 0c80 0c80 0c80
09 Egress rate control    0001 0001 0001 0001 0001 0001 0001
0a Egress rate control 2  8000 0000 8000 0000 0000 0000 0000
0b Port association vec   0001 1000 0004 1008 1010 1020 1040
0c Port ATU control       0000 0000 0000 0000 0000 0000 0000
0d Override               0000 0000 0000 0000 0000 0000 0000
0e Policy control         0000 0000 0000 0000 0000 0000 0000
0f Port ether type        9100 dada 9100 9100 9100 9100 9100
10 In discard low         0000 0000 0000 0000 0000 0000 0000
11 In discard high        0000 0000 0000 0000 0000 0000 0000
12 In filtered            0000 0000 0000 0000 0000 0000 0000
13 RX frame count         0000 049b 0000 0000 0142 0000 0000
14 Reserved               0000 0000 0000 0000 0000 0000 0000
15 Reserved               0000 0000 0000 0000 0000 0000 0000
16 LED control            0000 0000 0000 0000 0000 0000 0000
17 Reserved               0000 0000 0000 0000 0000 0000 0000
18 Tag remap low          3210 3210 3210 3210 3210 3210 3210
19 Tag remap high         7654 7654 7654 7654 7654 7654 7654
1a Reserved               0000 0000 0000 0000 0000 0000 0000
1b Queue counters         8000 8000 8000 8000 8000 8000 8000
1c Reserved               0000 0000 0000 0000 0000 0000 0000
1d Reserved               0000 0000 0000 0000 0000 0000 0000
1e Reserved               0000 0000 0000 0000 0000 0000 0000
1f Reserved               0000 0000 0000 0000 0000 0000 0000

mdio-tools output

 root@OpenWrt:/# mdio
fixed-0
gpio-0
mdio.0
mdio.0:1f
mv88e6xxx-1
root@OpenWrt:/# mdio mv88e6xxx-1
 DEV      PHY-ID  LINK
0x00  0x01410eb1  down
0x01  0x01410eb1  up
0x02  0x01410eb1  down
0x03  0x01410eb1  down
0x04  0x01410eb1  up
0x05  0x00000000  down
0x0f  0x00000000  down

If i remove the Fixed Link settings from the device tree so the PPU is in use the output looking like that

Bootlog of the Switch without Fixed Link

[    1.573783] mv88e6085 gpio-0:00: switch 0x3520 detected: Marvell 88E6352, revision 1
[    2.007977] mv88e6085 gpio-0:00: configuring for fixed/mii link mode
[    2.017104] mv88e6085 gpio-0:00: Link is Up - 100Mbps/Full - flow control off
[    2.029392] mv88e6085 gpio-0:00 ensw2p3 (uninitialized): PHY [mv88e6xxx-1:03] driver [Marvell 88E1540] (irq=24)
[    2.056419] mv88e6085 gpio-0:00 ensw2p4 (uninitialized): PHY [mv88e6xxx-1:04] driver [Marvell 88E1540] (irq=25)
[    2.079478] mv88e6085 gpio-0:00 ensw2p5 (uninitialized): PHY [mv88e6xxx-1:05] driver [Generic PHY] (irq=POLL)
[    2.089914] mv88e6085 gpio-0:00 ensw2p6 (uninitialized): no phy at 6
[    2.094837] mv88e6085 gpio-0:00 ensw2p6 (uninitialized): failed to connect to PHY: -ENODEV
[    2.103153] mv88e6085 gpio-0:00 ensw2p6 (uninitialized): error -19 setting up PHY for tree 0, switch 0, port 6
[    2.113121] ------------[ cut here ]------------
[    2.117697] WARNING: CPU: 0 PID: 150 at net/core/devlink.c:8180 dsa_register_switch+0xb34/0xc4c
[    2.126379] Modules linked in:
[    2.129409] CPU: 0 PID: 150 Comm: kworker/0:2 Not tainted 5.10.176 #0
[    2.135811] Workqueue: events deferred_probe_work_func
[    2.140934] Stack : 80730000 80c74180 805dc81c 00000009 80f00d80 800bfff4 80740000 00000017
[    2.149261]         80c741bc 80d07c0c 80d07bdc 80154d4c 805dc81c 00000001 80d07bb0 79dc86e5
[    2.157581]         00000000 00000000 80688f8c 80d07a30 ffffefff 00000000 00000000 ffffffea
[    2.165927]         00000067 80d07a3c 00000067 8073fb08 00000000 00000009 00000000 805dc81c
[    2.174260]         00000009 80f00d80 00000001 80f0679c 00000018 00000030 00000000 808f0000
[    2.182594]         ...
[    2.185013] Call Trace:
[    2.187477] [<80066ea4>] show_stack+0x30/0x100
[    2.191911] [<80085b54>] __warn+0xb0/0x11c
[    2.195960] [<80085c1c>] warn_slowpath_fmt+0x5c/0xac
[    2.200936] [<805dc81c>] dsa_register_switch+0xb34/0xc4c
[    2.206237] [<803fb748>] mv88e6xxx_probe+0x78c/0x7ac
[    2.211184] [<803dd65c>] mdio_probe+0x34/0x90
[    2.215495] [<803959cc>] really_probe+0x108/0x4d8
[    2.220230] [<80393640>] bus_for_each_drv+0x70/0xb0
[    2.225040] [<80395fcc>] __device_attach+0x110/0x1c8
[    2.230008] [<80394944>] bus_probe_device+0x9c/0xb8
[    2.234848] [<80394ea4>] deferred_probe_work_func+0x90/0xd0
[    2.240434] [<8009d0dc>] process_one_work+0x1f0/0x460
[    2.245439] [<8009d69c>] worker_thread+0x350/0x5c4
[    2.250251] [<800a37dc>] kthread+0x13c/0x144
[    2.254471] [<80062258>] ret_from_kernel_thread+0x14/0x1c
[    2.259871]
[    2.261318] ---[ end trace f76342513c5ebe68 ]---

Maybe someone has an idea what could be wrong or has suggestions what could be controlled.

Best regards