net: phy: add phyid search in vendor specific space
authorFlorin Chiculita <florinlaurentiu.chiculita@nxp.com>
Wed, 29 Apr 2020 11:25:48 +0000 (14:25 +0300)
committerTom Rini <trini@konsulko.com>
Fri, 12 Jun 2020 17:17:23 +0000 (13:17 -0400)
There are devices accesible through mdio clause-45, such as
retimers, that do not have PMA or PCS blocks.
This patch adds MDIO_MMD_VEND1 on the list of device addresses
where phyid is searched. Previous order of devices was kept.

Signed-off-by: Florin Chiculita <florinlaurentiu.chiculita@nxp.com>
Reviewed-by: Madalin Bucur <madalin.bucur@oss.nxp.com>
drivers/net/phy/phy.c

index cce09c47f9dc18e30a701b1c55c9f327226ec9d4..67789897c2569aa969fe21af1adc98a120ef69fd 100644 (file)
@@ -786,17 +786,27 @@ static struct phy_device *get_phy_device_by_mask(struct mii_dev *bus,
                                                 uint phy_mask,
                                                 phy_interface_t interface)
 {
-       int i;
        struct phy_device *phydev;
-
+       int devad[] = {
+               /* Clause-22 */
+               MDIO_DEVAD_NONE,
+               /* Clause-45 */
+               MDIO_MMD_PMAPMD,
+               MDIO_MMD_WIS,
+               MDIO_MMD_PCS,
+               MDIO_MMD_PHYXS,
+               MDIO_MMD_VEND1,
+       };
+       int i, devad_cnt;
+
+       devad_cnt = sizeof(devad)/sizeof(int);
        phydev = search_for_existing_phy(bus, phy_mask, interface);
        if (phydev)
                return phydev;
-       /* Try Standard (ie Clause 22) access */
-       /* Otherwise we have to try Clause 45 */
-       for (i = 0; i < 5; i++) {
+       /* try different access clauses  */
+       for (i = 0; i < devad_cnt; i++) {
                phydev = create_phy_by_mask(bus, phy_mask,
-                                           i ? i : MDIO_DEVAD_NONE, interface);
+                                           devad[i], interface);
                if (IS_ERR(phydev))
                        return NULL;
                if (phydev)