Other Parts Discussed in Thread: DP83TC811
Tool/software: Linux
Hi Ti Engineer,
I meet some questions when porting the DP83TC811R linux driver to my target(s32v234,kernel verson:4.1).
I config the device tree to support 802.3-c45(e.g.compatible = "ethernet-phy-ieee802.3-c45";).But the kernel can't attach the phy device.
I trace the phy driver code in phy_device.c.There is the follow segment:
I read the phy_reg(reg_addr = MII_ADDR_C45 | i << 16 | MDIO_DEVS2,reg_addr = MII_ADDR_C45 | i << 16 | MDIO_DEVS1) is always 0 and c45_ids->devices_in_package is also 0.
so when probing Device Identifiers ,it can not execute the process.
/**
* get_phy_c45_ids - reads the specified addr for its 802.3-c45 IDs.
* @bus: the target MII bus
* @addr: PHY address on the MII bus
* @phy_id: where to store the ID retrieved.
* @c45_ids: where to store the c45 ID information.
*
* If the PHY devices-in-package appears to be valid, it and the
* corresponding identifiers are stored in @c45_ids, zero is stored
* in @phy_id. Otherwise 0xffffffff is stored in @phy_id. Returns
* zero on success.
*
*/
static int get_phy_c45_ids(struct mii_bus *bus, int addr, u32 *phy_id,
struct phy_c45_device_ids *c45_ids) {
int phy_reg;
int i, reg_addr;
const int num_ids = ARRAY_SIZE(c45_ids->device_ids);
/* Find first non-zero Devices In package. Device
* zero is reserved, so don't probe it.
*/
for (i = 1;
i < num_ids && c45_ids->devices_in_package == 0;
i++) {
reg_addr = MII_ADDR_C45 | i << 16 | MDIO_DEVS2;
phy_reg = mdiobus_read(bus, addr, reg_addr);
if (phy_reg < 0)
return -EIO;
c45_ids->devices_in_package = (phy_reg & 0xffff) << 16;
reg_addr = MII_ADDR_C45 | i << 16 | MDIO_DEVS1;
phy_reg = mdiobus_read(bus, addr, reg_addr);
if (phy_reg < 0)
return -EIO;
c45_ids->devices_in_package |= (phy_reg & 0xffff);
/* If mostly Fs, there is no device there,
* let's get out of here.
*/
if ((c45_ids->devices_in_package & 0x1fffffff) == 0x1fffffff) {
*phy_id = 0xffffffff;
return 0;
}
}
/* Now probe Device Identifiers for each device present. */
for (i = 1; i < num_ids; i++) {
if (!(c45_ids->devices_in_package & (1 << i)))
continue;
reg_addr = MII_ADDR_C45 | i << 16 | MII_PHYSID1;
phy_reg = mdiobus_read(bus, addr, reg_addr);
if (phy_reg < 0)
return -EIO;
c45_ids->device_ids[i] = (phy_reg & 0xffff) << 16;
reg_addr = MII_ADDR_C45 | i << 16 | MII_PHYSID2;
phy_reg = mdiobus_read(bus, addr, reg_addr);
if (phy_reg < 0)
return -EIO;
c45_ids->device_ids[i] |= (phy_reg & 0xffff);
}
*phy_id = 0;
return 0;
}