Re: [net-next PATCH v3 4/5] net: phy: Introduce fwnode_get_phy_id()

2020-05-11 Thread Calvin Johnson
On Mon, May 11, 2020 at 03:04:57PM +0200, Andrew Lunn wrote: > > NXP's LX2160ARDB platform currently has the following MDIO-PHY connection. > > > > MDIO-1 ==> one 40G PHY, two 1G PHYs(C45), two 10G PHYs(C22) > > MDIO-2 ==> one 25G PHY > > It has been suggested that ACPI only support a one to one

Re: [net-next PATCH v3 4/5] net: phy: Introduce fwnode_get_phy_id()

2020-05-11 Thread Russell King - ARM Linux admin
On Mon, May 11, 2020 at 03:04:57PM +0200, Andrew Lunn wrote: > > NXP's LX2160ARDB platform currently has the following MDIO-PHY connection. > > > > MDIO-1 ==> one 40G PHY, two 1G PHYs(C45), two 10G PHYs(C22) > > MDIO-2 ==> one 25G PHY > > It has been suggested that ACPI only support a one to one

Re: [net-next PATCH v3 4/5] net: phy: Introduce fwnode_get_phy_id()

2020-05-11 Thread Andrew Lunn
> NXP's LX2160ARDB platform currently has the following MDIO-PHY connection. > > MDIO-1 ==> one 40G PHY, two 1G PHYs(C45), two 10G PHYs(C22) > MDIO-2 ==> one 25G PHY It has been suggested that ACPI only support a one to one mapping. Each MAC has one MDIO bus, with one PHY on it. KISS. This

Re: [net-next PATCH v3 4/5] net: phy: Introduce fwnode_get_phy_id()

2020-05-11 Thread Andrew Lunn
On Mon, May 11, 2020 at 11:22:31AM +0530, Calvin Johnson wrote: > Thanks Andrew and Jeremy for the detailed discussion! > > On Fri, May 08, 2020 at 08:13:01PM +0200, Andrew Lunn wrote: > > > > It does have a numeric version defined for EISA types. OTOH I suspect > > > > that > > > > your right.

Re: [net-next PATCH v3 4/5] net: phy: Introduce fwnode_get_phy_id()

2020-05-11 Thread Calvin Johnson
On Mon, May 11, 2020 at 11:48:17AM +0100, Russell King - ARM Linux admin wrote: > On Mon, May 11, 2020 at 03:59:30PM +0530, Calvin Johnson wrote: > > On Mon, May 11, 2020 at 10:38:49AM +0100, Russell King - ARM Linux admin > > wrote: > > > On Mon, May 11, 2020 at 01:30:40PM +0530, Calvin Johnson

Re: [net-next PATCH v3 4/5] net: phy: Introduce fwnode_get_phy_id()

2020-05-11 Thread Russell King - ARM Linux admin
On Mon, May 11, 2020 at 03:59:30PM +0530, Calvin Johnson wrote: > On Mon, May 11, 2020 at 10:38:49AM +0100, Russell King - ARM Linux admin > wrote: > > On Mon, May 11, 2020 at 01:30:40PM +0530, Calvin Johnson wrote: > > > On Sat, May 09, 2020 at 01:42:57AM +0200, Andrew Lunn wrote: > > > > On

Re: [net-next PATCH v3 4/5] net: phy: Introduce fwnode_get_phy_id()

2020-05-11 Thread Calvin Johnson
On Mon, May 11, 2020 at 10:38:49AM +0100, Russell King - ARM Linux admin wrote: > On Mon, May 11, 2020 at 01:30:40PM +0530, Calvin Johnson wrote: > > On Sat, May 09, 2020 at 01:42:57AM +0200, Andrew Lunn wrote: > > > On Fri, May 08, 2020 at 05:48:33PM -0500, Jeremy Linton wrote: > > > > Hi, > > >

Re: [net-next PATCH v3 4/5] net: phy: Introduce fwnode_get_phy_id()

2020-05-11 Thread Russell King - ARM Linux admin
On Mon, May 11, 2020 at 01:30:40PM +0530, Calvin Johnson wrote: > On Sat, May 09, 2020 at 01:42:57AM +0200, Andrew Lunn wrote: > > On Fri, May 08, 2020 at 05:48:33PM -0500, Jeremy Linton wrote: > > > Hi, > > > > > > On 5/8/20 3:27 PM, Andrew Lunn wrote: > > > > > > There is a very small number of

Re: [net-next PATCH v3 4/5] net: phy: Introduce fwnode_get_phy_id()

2020-05-11 Thread Calvin Johnson
On Sat, May 09, 2020 at 01:42:57AM +0200, Andrew Lunn wrote: > On Fri, May 08, 2020 at 05:48:33PM -0500, Jeremy Linton wrote: > > Hi, > > > > On 5/8/20 3:27 PM, Andrew Lunn wrote: > > > > > There is a very small number of devices where the vendor messed up, > > > > > and did not put valid

Re: [net-next PATCH v3 4/5] net: phy: Introduce fwnode_get_phy_id()

2020-05-11 Thread Calvin Johnson
On Fri, May 08, 2020 at 05:48:33PM -0500, Jeremy Linton wrote: > Hi, > > On 5/8/20 3:27 PM, Andrew Lunn wrote: > > > > There is a very small number of devices where the vendor messed up, > > > > and did not put valid contents in the ID registers. In such cases, we > > > > can read the IDs from

Re: [net-next PATCH v3 4/5] net: phy: Introduce fwnode_get_phy_id()

2020-05-10 Thread Calvin Johnson
Thanks Andrew and Jeremy for the detailed discussion! On Fri, May 08, 2020 at 08:13:01PM +0200, Andrew Lunn wrote: > > > It does have a numeric version defined for EISA types. OTOH I suspect that > > > your right. If there were a "PHY\VEN_ID_" definition, it may > > > not > > > be ideal

Re: [net-next PATCH v3 4/5] net: phy: Introduce fwnode_get_phy_id()

2020-05-08 Thread Jeremy Linton
On 5/8/20 6:42 PM, Andrew Lunn wrote: On Fri, May 08, 2020 at 05:48:33PM -0500, Jeremy Linton wrote: Hi, On 5/8/20 3:27 PM, Andrew Lunn wrote: There is a very small number of devices where the vendor messed up, and did not put valid contents in the ID registers. In such cases, we can read the

Re: [net-next PATCH v3 4/5] net: phy: Introduce fwnode_get_phy_id()

2020-05-08 Thread Andrew Lunn
On Fri, May 08, 2020 at 05:48:33PM -0500, Jeremy Linton wrote: > Hi, > > On 5/8/20 3:27 PM, Andrew Lunn wrote: > > > > There is a very small number of devices where the vendor messed up, > > > > and did not put valid contents in the ID registers. In such cases, we > > > > can read the IDs from

Re: [net-next PATCH v3 4/5] net: phy: Introduce fwnode_get_phy_id()

2020-05-08 Thread Jeremy Linton
Hi, On 5/8/20 3:27 PM, Andrew Lunn wrote: There is a very small number of devices where the vendor messed up, and did not put valid contents in the ID registers. In such cases, we can read the IDs from device tree. These are then used in exactly the same way as if they were read from the

Re: [net-next PATCH v3 4/5] net: phy: Introduce fwnode_get_phy_id()

2020-05-08 Thread Andrew Lunn
> > There is a very small number of devices where the vendor messed up, > > and did not put valid contents in the ID registers. In such cases, we > > can read the IDs from device tree. These are then used in exactly the > > same way as if they were read from the device. > > > > Is that the case

Re: [net-next PATCH v3 4/5] net: phy: Introduce fwnode_get_phy_id()

2020-05-08 Thread Jeremy Linton
Hi, On 5/8/20 1:13 PM, Andrew Lunn wrote: It does have a numeric version defined for EISA types. OTOH I suspect that your right. If there were a "PHY\VEN_ID_" definition, it may not be ideal to parse it. Instead the normal ACPI model of exactly matching the complete string in the phy

Re: [net-next PATCH v3 4/5] net: phy: Introduce fwnode_get_phy_id()

2020-05-08 Thread Andrew Lunn
> > It does have a numeric version defined for EISA types. OTOH I suspect that > > your right. If there were a "PHY\VEN_ID_" definition, it may not > > be ideal to parse it. Instead the normal ACPI model of exactly matching the > > complete string in the phy driver might be more

Re: [net-next PATCH v3 4/5] net: phy: Introduce fwnode_get_phy_id()

2020-05-08 Thread Calvin Johnson
On Thu, May 07, 2020 at 02:54:09PM -0500, Jeremy Linton wrote: > Hi, > > On 5/7/20 12:27 PM, Andy Shevchenko wrote: > > On Thu, May 7, 2020 at 4:26 PM Jeremy Linton wrote: > > > On 5/5/20 8:29 AM, Calvin Johnson wrote: > > > > > > + if (sscanf(cp, "ethernet-phy-id%4x.%4x", > > > > +

Re: [net-next PATCH v3 4/5] net: phy: Introduce fwnode_get_phy_id()

2020-05-07 Thread Jeremy Linton
Hi, On 5/7/20 12:27 PM, Andy Shevchenko wrote: On Thu, May 7, 2020 at 4:26 PM Jeremy Linton wrote: On 5/5/20 8:29 AM, Calvin Johnson wrote: + if (sscanf(cp, "ethernet-phy-id%4x.%4x", +, ) == 2) { + *phy_id = ((upper & 0x) << 16) |

Re: [net-next PATCH v3 4/5] net: phy: Introduce fwnode_get_phy_id()

2020-05-07 Thread Andy Shevchenko
On Thu, May 7, 2020 at 4:26 PM Jeremy Linton wrote: > On 5/5/20 8:29 AM, Calvin Johnson wrote: > > + if (sscanf(cp, "ethernet-phy-id%4x.%4x", > > +, ) == 2) { > > + *phy_id = ((upper & 0x) << 16) | (lower & 0x); > > +

Re: [net-next PATCH v3 4/5] net: phy: Introduce fwnode_get_phy_id()

2020-05-07 Thread Jeremy Linton
Hi, On 5/5/20 8:29 AM, Calvin Johnson wrote: Extract phy_id from compatible string. This will be used by fwnode_mdiobus_register_phy() to create phy device using the phy_id. Signed-off-by: Calvin Johnson --- Changes in v3: None Changes in v2: None drivers/net/phy/phy_device.c | 21

Re: [net-next PATCH v3 4/5] net: phy: Introduce fwnode_get_phy_id()

2020-05-05 Thread Russell King - ARM Linux admin
On Tue, May 05, 2020 at 05:15:16PM +0300, Andy Shevchenko wrote: > On Tue, May 5, 2020 at 4:29 PM Calvin Johnson > > + if (sscanf(cp, "ethernet-phy-id%4x.%4x", > > + , ) == 2) { > > > + *phy_id = ((upper & 0x) << 16) | (lower & > >

Re: [net-next PATCH v3 4/5] net: phy: Introduce fwnode_get_phy_id()

2020-05-05 Thread Andy Shevchenko
On Tue, May 5, 2020 at 4:29 PM Calvin Johnson wrote: > > Extract phy_id from compatible string. This will be used by > fwnode_mdiobus_register_phy() to create phy device using the > phy_id. > +int fwnode_get_phy_id(struct fwnode_handle *fwnode, u32 *phy_id) > +{ > + const char *cp; > +

[net-next PATCH v3 4/5] net: phy: Introduce fwnode_get_phy_id()

2020-05-05 Thread Calvin Johnson
Extract phy_id from compatible string. This will be used by fwnode_mdiobus_register_phy() to create phy device using the phy_id. Signed-off-by: Calvin Johnson --- Changes in v3: None Changes in v2: None drivers/net/phy/phy_device.c | 21 + include/linux/phy.h | 5