Enable MDIO support for a single MAC managing multiple PHYs in macb driver

I am working on OpenWrt 18.06.2 with 4.19.78 kernel in Arm sama5d21 processer , I have run into an issue with Ethernet LAN switch functionality in cadence macb ethernet driver.

I written seperate macb mdio module driver for the same MAC accessing with multilple phys by single mdio bus.

my dtb for mdio which is at top level,

mdio{
	compatible = "cdns,macb-mdio";
	reg = <0xf8008000 0x1000>;
	#address-cells = <1>;
	#size-cells = <0>;
  	status = "okay";

	phy0: ethernet-phy@02 {
		reg = <0x02>;
	};

	phy1: ethernet-phy@03 {
		reg = <0x03>;
	};

	phy2: ethernet-phy@04 {
		reg = <0x04>;
	};

	phy3: ethernet-phy@05 {
		reg = <0x05>;
	};
};

and for macb ethernet dtb is ,

		macb0: ethernet@f8008000 {
			pinctrl-names = "default";
			pinctrl-0 = <&pinctrl_macb0_default &pinctrl_macb0_phy_irq &pinctrl_macb0_rst>;
			phy-mode = "mii";
			status = "okay";

			phy-handle = <&phy0>;
			phy-handle = <&phy1>;
			phy-handle = <&phy2>;
			phy-handle = <&phy3>;

		};

Im calling the phy-handles from macb ethernet for individual phys.

but,

only a single ethernet port seems to be working which is at address 5 .

Remaning phys are not connected because one mac can manage one single phy-handle with mdio.

How to solve this issuee..

i want to make multiple PHY work via single MACB driver (which is latest ).

thanks in advance.....

Do you mean that you connect 4 PHYs to an Ethernet MAC without a dedicated switch chip?

Thanks for your Replay....

Im Using Davicom Switch (Dm8806).

Switch detected and all ports got ping and functionality is working fine but when you want to change a particular port speed or duplex for that each PHY should act as like individual port, so that we can change the individual phy configuration.

So inorder to configuring the each individual phy im Changing the dtb is like as showned above. But only one phy got connected and got ping remaining phys are detected but ping not came means only one last phy got configured as individaul phy . My intention to get like all phys.

Hope you Understand...

Thanks in advance.......

In that case you should refactor the switch driver to use DSA.

Before that each phy should be registered as individual with single mdio bus for this case im mentioning phy addresses in mdio(dtb).

DSA core can handle that automatically.

Thank you for your info...
could you please share any reference dtb and info regarding dsa in my case...

As there is no DSA driver for the DM8806 switch yet, you probably have to refactor it by yourself (and perhaps send it upstream).

For DSA device tree bindings, see https://www.kernel.org/doc/Documentation/devicetree/bindings/net/dsa/

For how to implement DSA API, see https://www.kernel.org/doc/html/latest/networking/dsa/dsa.html

Thank you for your valuable information...