UPSTREAM: 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> Signed-off-by: David Wu <david.wu@rock-chips.com> Change-Id: Iae1c8e2414b655639c42f7098a097c6a0a1e5792
This commit is contained in:
parent
296978b3f4
commit
5b8d12099d
|
|
@ -611,7 +611,7 @@ static struct phy_driver *get_phy_driver(struct phy_device *phydev,
|
|||
}
|
||||
|
||||
static struct phy_device *phy_device_create(struct mii_dev *bus, int addr,
|
||||
u32 phy_id,
|
||||
u32 phy_id, bool is_c45,
|
||||
phy_interface_t interface)
|
||||
{
|
||||
struct phy_device *dev;
|
||||
|
|
@ -639,6 +639,7 @@ static struct phy_device *phy_device_create(struct mii_dev *bus, int addr,
|
|||
|
||||
dev->addr = addr;
|
||||
dev->phy_id = phy_id;
|
||||
dev->is_c45 = is_c45;
|
||||
dev->bus = bus;
|
||||
|
||||
dev->drv = get_phy_driver(dev, interface);
|
||||
|
|
@ -687,12 +688,17 @@ static struct phy_device *create_phy_by_mask(struct mii_dev *bus,
|
|||
unsigned phy_mask, int devad, phy_interface_t interface)
|
||||
{
|
||||
u32 phy_id = 0xffffffff;
|
||||
bool is_c45;
|
||||
|
||||
while (phy_mask) {
|
||||
int addr = ffs(phy_mask) - 1;
|
||||
int r = get_phy_id(bus, addr, devad, &phy_id);
|
||||
/* If the PHY ID is mostly f's, we didn't find anything */
|
||||
if (r == 0 && (phy_id & 0x1fffffff) != 0x1fffffff)
|
||||
return phy_device_create(bus, addr, phy_id, interface);
|
||||
if (r == 0 && (phy_id & 0x1fffffff) != 0x1fffffff) {
|
||||
is_c45 = (devad == MDIO_DEVAD_NONE) ? false : true;
|
||||
return phy_device_create(bus, addr, phy_id, is_c45,
|
||||
interface);
|
||||
}
|
||||
phy_mask &= ~(1 << addr);
|
||||
}
|
||||
return NULL;
|
||||
|
|
@ -870,9 +876,9 @@ struct phy_device *phy_connect(struct mii_dev *bus, int addr,
|
|||
sn = fdt_first_subnode(gd->fdt_blob, dev_of_offset(dev));
|
||||
while (sn > 0) {
|
||||
name = fdt_get_name(gd->fdt_blob, sn, NULL);
|
||||
if (name != NULL && strcmp(name, "fixed-link") == 0) {
|
||||
phydev = phy_device_create(bus,
|
||||
sn, PHY_FIXED_ID, interface);
|
||||
if (name && strcmp(name, "fixed-link") == 0) {
|
||||
phydev = phy_device_create(bus, sn, PHY_FIXED_ID, false,
|
||||
interface);
|
||||
break;
|
||||
}
|
||||
sn = fdt_next_subnode(gd->fdt_blob, sn);
|
||||
|
|
|
|||
|
|
@ -139,6 +139,7 @@ struct phy_device {
|
|||
int pause;
|
||||
int asym_pause;
|
||||
u32 phy_id;
|
||||
bool is_c45;
|
||||
u32 flags;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue