Message ID | 20210719053212.11244-1-lxu@maxlinear.com |
---|---|
State | New |
Headers | show |
Series | [v6,1/2] net: phy: add API to read 802.3-c45 IDs | expand |
On 7/19/21 7:32 AM, Xu Liang wrote: > Add API to read 802.3-c45 IDs so that C22/C45 mixed device can use > C45 APIs without failing ID checks. > > Signed-off-by: Xu Liang <lxu@maxlinear.com> Acked-by: Hauke Mehrtens <hmehrtens@maxlinear.com> > --- > v5 changes: > Fix incorrect prototype name in comment. > > drivers/net/phy/phy_device.c | 14 ++++++++++++++ > include/linux/phy.h | 1 + > 2 files changed, 15 insertions(+) > > diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c > index 5d5f9a9ee768..107aa6d7bc6b 100644 > --- a/drivers/net/phy/phy_device.c > +++ b/drivers/net/phy/phy_device.c > @@ -968,6 +968,20 @@ void phy_device_remove(struct phy_device *phydev) > } > EXPORT_SYMBOL(phy_device_remove); > > +/** > + * phy_get_c45_ids - Read 802.3-c45 IDs for phy device. > + * @phydev: phy_device structure to read 802.3-c45 IDs > + * > + * Returns zero on success, %-EIO on bus access error, or %-ENODEV if > + * the "devices in package" is invalid. > + */ > +int phy_get_c45_ids(struct phy_device *phydev) > +{ > + return get_phy_c45_ids(phydev->mdio.bus, phydev->mdio.addr, > + &phydev->c45_ids); > +} > +EXPORT_SYMBOL(phy_get_c45_ids); > + > /** > * phy_find_first - finds the first PHY device on the bus > * @bus: the target MII bus > diff --git a/include/linux/phy.h b/include/linux/phy.h > index 3b80dc3ed68b..736e1d1a47c4 100644 > --- a/include/linux/phy.h > +++ b/include/linux/phy.h > @@ -1431,6 +1431,7 @@ static inline int phy_device_register(struct phy_device *phy) > static inline void phy_device_free(struct phy_device *phydev) { } > #endif /* CONFIG_PHYLIB */ > void phy_device_remove(struct phy_device *phydev); > +int phy_get_c45_ids(struct phy_device *phydev); > int phy_init_hw(struct phy_device *phydev); > int phy_suspend(struct phy_device *phydev); > int phy_resume(struct phy_device *phydev); >
> +/* PHY ID */ > +#define PHY_ID_GPYx15B_MASK 0xFFFFFFFC > +#define PHY_ID_GPY21xB_MASK 0xFFFFFFF9 That is an odd mask. Is that really correct? Andrew
On Mon, Jul 19, 2021 at 01:32:12PM +0800, Xu Liang wrote: > Add driver to support the Maxlinear GPY115, GPY211, GPY212, GPY215, > GPY241, GPY245 PHYs. Separate from XWAY PHY driver because this series > has different register layout and new features not supported in XWAY PHY. > > Signed-off-by: Xu Liang <lxu@maxlinear.com> > --- Tested-by: Wong Vee Khee <vee.khee.wong@linux.intel.com>
On Mon, Jul 19, 2021 at 01:32:12PM +0800, Xu Liang wrote: > Add driver to support the Maxlinear GPY115, GPY211, GPY212, GPY215, > GPY241, GPY245 PHYs. Separate from XWAY PHY driver because this series > has different register layout and new features not supported in XWAY PHY. > > Signed-off-by: Xu Liang <lxu@maxlinear.com> > --- Tested-by: Wong Vee Khee <vee.khee.wong@linux.intel.com>
On 20/7/2021 4:48 am, Andrew Lunn wrote: > This email was sent from outside of MaxLinear. > > >> +/* PHY ID */ >> +#define PHY_ID_GPYx15B_MASK 0xFFFFFFFC >> +#define PHY_ID_GPY21xB_MASK 0xFFFFFFF9 > That is an odd mask. Is that really correct? > > Andrew > Hi Andrew, Yes, this is correct and has been tested. It's special because of a PHY ID scheme change during manufacturing. Thanks & Regards, Xu Liang
On Tue, Jul 20, 2021 at 03:35:17AM +0000, Liang Xu wrote: > On 20/7/2021 4:48 am, Andrew Lunn wrote: > > This email was sent from outside of MaxLinear. > > > > > >> +/* PHY ID */ > >> +#define PHY_ID_GPYx15B_MASK 0xFFFFFFFC > >> +#define PHY_ID_GPY21xB_MASK 0xFFFFFFF9 > > That is an odd mask. Is that really correct? > > > > Andrew > > > Hi Andrew, > > > Yes, this is correct and has been tested. > > It's special because of a PHY ID scheme change during manufacturing. O.K. It is just a really odd mask. And putting the revision in the middle, not at the end? And none of the IDs have bit 0 set. It just all adds up to it looking wrong. So i had to ask. Andrew
On 20/7/2021 9:02 pm, Andrew Lunn wrote: > This email was sent from outside of MaxLinear. > > > On Tue, Jul 20, 2021 at 03:35:17AM +0000, Liang Xu wrote: >> On 20/7/2021 4:48 am, Andrew Lunn wrote: >>> This email was sent from outside of MaxLinear. >>> >>> >>>> +/* PHY ID */ >>>> +#define PHY_ID_GPYx15B_MASK 0xFFFFFFFC >>>> +#define PHY_ID_GPY21xB_MASK 0xFFFFFFF9 >>> That is an odd mask. Is that really correct? >>> >>> Andrew >>> >> Hi Andrew, >> >> >> Yes, this is correct and has been tested. >> >> It's special because of a PHY ID scheme change during manufacturing. > O.K. It is just a really odd mask. And putting the revision in the > middle, not at the end? And none of the IDs have bit 0 set. It just > all adds up to it looking wrong. So i had to ask. > > Andrew > Understood. Here are the revisions already in the market (shipped): 1. GPY211B - 67C9DE08, 67C9DE0A 2. GPY212B - 67C9DE09, 67C9DE0B
On Mon, Jul 19, 2021 at 01:32:12PM +0800, Xu Liang wrote: > Add driver to support the Maxlinear GPY115, GPY211, GPY212, GPY215, > GPY241, GPY245 PHYs. Separate from XWAY PHY driver because this series > has different register layout and new features not supported in XWAY PHY. > > Signed-off-by: Xu Liang <lxu@maxlinear.com> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Andrew
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 5d5f9a9ee768..107aa6d7bc6b 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -968,6 +968,20 @@ void phy_device_remove(struct phy_device *phydev) } EXPORT_SYMBOL(phy_device_remove); +/** + * phy_get_c45_ids - Read 802.3-c45 IDs for phy device. + * @phydev: phy_device structure to read 802.3-c45 IDs + * + * Returns zero on success, %-EIO on bus access error, or %-ENODEV if + * the "devices in package" is invalid. + */ +int phy_get_c45_ids(struct phy_device *phydev) +{ + return get_phy_c45_ids(phydev->mdio.bus, phydev->mdio.addr, + &phydev->c45_ids); +} +EXPORT_SYMBOL(phy_get_c45_ids); + /** * phy_find_first - finds the first PHY device on the bus * @bus: the target MII bus diff --git a/include/linux/phy.h b/include/linux/phy.h index 3b80dc3ed68b..736e1d1a47c4 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -1431,6 +1431,7 @@ static inline int phy_device_register(struct phy_device *phy) static inline void phy_device_free(struct phy_device *phydev) { } #endif /* CONFIG_PHYLIB */ void phy_device_remove(struct phy_device *phydev); +int phy_get_c45_ids(struct phy_device *phydev); int phy_init_hw(struct phy_device *phydev); int phy_suspend(struct phy_device *phydev); int phy_resume(struct phy_device *phydev);
Add API to read 802.3-c45 IDs so that C22/C45 mixed device can use C45 APIs without failing ID checks. Signed-off-by: Xu Liang <lxu@maxlinear.com> --- v5 changes: Fix incorrect prototype name in comment. drivers/net/phy/phy_device.c | 14 ++++++++++++++ include/linux/phy.h | 1 + 2 files changed, 15 insertions(+)