Commit b3eabd82f21b4d9206622fc5aee16751d2f4be8f
Committed by
Joe Hershberger
1 parent
aff66f22d6
Exists in
smarc_8mq_lf_v2020.04
and in
11 other branches
net: phy: Add clause 45 identifier to phy_device
The phy devices can be accessed via clause 22 or via clause 45. This information can be deduced when we read phy id. if the phy id is read without giving any MDIO Manageable Device Address (MMD), then it conforms to clause 22. otherwise it conforms to clause 45. Signed-off-by: Pankaj Bansal <pankaj.bansal@nxp.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Showing 2 changed files with 11 additions and 5 deletions Side-by-side Diff
drivers/net/phy/phy.c
... | ... | @@ -620,7 +620,7 @@ |
620 | 620 | } |
621 | 621 | |
622 | 622 | static struct phy_device *phy_device_create(struct mii_dev *bus, int addr, |
623 | - u32 phy_id, | |
623 | + u32 phy_id, bool is_c45, | |
624 | 624 | phy_interface_t interface) |
625 | 625 | { |
626 | 626 | struct phy_device *dev; |
... | ... | @@ -650,6 +650,7 @@ |
650 | 650 | |
651 | 651 | dev->addr = addr; |
652 | 652 | dev->phy_id = phy_id; |
653 | + dev->is_c45 = is_c45; | |
653 | 654 | dev->bus = bus; |
654 | 655 | |
655 | 656 | dev->drv = get_phy_driver(dev, interface); |
656 | 657 | |
... | ... | @@ -702,13 +703,17 @@ |
702 | 703 | phy_interface_t interface) |
703 | 704 | { |
704 | 705 | u32 phy_id = 0xffffffff; |
706 | + bool is_c45; | |
705 | 707 | |
706 | 708 | while (phy_mask) { |
707 | 709 | int addr = ffs(phy_mask) - 1; |
708 | 710 | int r = get_phy_id(bus, addr, devad, &phy_id); |
709 | 711 | /* If the PHY ID is mostly f's, we didn't find anything */ |
710 | - if (r == 0 && (phy_id & 0x1fffffff) != 0x1fffffff) | |
711 | - return phy_device_create(bus, addr, phy_id, interface); | |
712 | + if (r == 0 && (phy_id & 0x1fffffff) != 0x1fffffff) { | |
713 | + is_c45 = (devad == MDIO_DEVAD_NONE) ? false : true; | |
714 | + return phy_device_create(bus, addr, phy_id, is_c45, | |
715 | + interface); | |
716 | + } | |
712 | 717 | phy_mask &= ~(1 << addr); |
713 | 718 | } |
714 | 719 | return NULL; |
... | ... | @@ -895,8 +900,8 @@ |
895 | 900 | while (sn > 0) { |
896 | 901 | name = fdt_get_name(gd->fdt_blob, sn, NULL); |
897 | 902 | if (name && strcmp(name, "fixed-link") == 0) { |
898 | - phydev = phy_device_create(bus, | |
899 | - sn, PHY_FIXED_ID, interface); | |
903 | + phydev = phy_device_create(bus, sn, PHY_FIXED_ID, false, | |
904 | + interface); | |
900 | 905 | break; |
901 | 906 | } |
902 | 907 | sn = fdt_next_subnode(gd->fdt_blob, sn); |