};
struct rtmdio_phy_info {
- unsigned int phy_id;
- bool phy_unknown;
int mac_type;
bool has_giga_lite;
bool has_res_reg;
return phydev->phy_id;
}
-static void rtmdio_get_phy_info(struct mii_bus *bus, int addr, struct rtmdio_phy_info *phyinfo)
+static int rtmdio_get_phy_info(struct mii_bus *bus, int addr, struct rtmdio_phy_info *phyinfo)
{
struct phy_device *phydev = mdiobus_get_phy(bus, addr);
u32 phyid = rtmdio_get_phy_id(phydev);
+ int ret = 0;
/*
* Depending on the attached PHY the polling mechanism must be fine tuned. Basically
phyinfo->poll_lpa_1000 = RTMDIO_PHY_POLL_MMD(31, 0xa414, 11);
break;
default:
- phyinfo->phy_unknown = true;
+ pr_warn("skip polling setup for unknown PHY %08x on port %d\n", phyid, addr);
+ ret = -EINVAL;
break;
}
+
+ return ret;
}
static int rtmdio_838x_reset(struct mii_bus *bus)
/* Define PHY specific polling parameters */
for_each_port(ctrl, addr) {
- rtmdio_get_phy_info(bus, addr, &phyinfo);
- if (phyinfo.phy_unknown) {
- pr_warn("skip polling setup for unknown PHY %08x on port %d\n",
- phyinfo.phy_id, addr);
+ if (rtmdio_get_phy_info(bus, addr, &phyinfo))
continue;
- }
/* port MAC type */
mask = addr > 23 ? 0x7 << ((addr - 24) * 3 + 12): 0x3 << ((addr / 4) * 2);
int smi = ctrl->smi_bus[addr];
unsigned int mask, val;
- rtmdio_get_phy_info(bus, addr, &phyinfo);
- if (phyinfo.phy_unknown) {
- pr_warn("skip polling setup for unknown PHY %08x on port %d\n",
- phyinfo.phy_id, addr);
+ if (rtmdio_get_phy_info(bus, addr, &phyinfo))
continue;
- }
mask = val = 0;