* [PATCH v1 net] lan743x: Expand phy search for LAN7431
@ 2018-12-17 21:44 Bryan Whitehead
2018-12-18 12:12 ` Andrew Lunn
2018-12-19 5:36 ` David Miller
0 siblings, 2 replies; 5+ messages in thread
From: Bryan Whitehead @ 2018-12-17 21:44 UTC (permalink / raw)
To: davem; +Cc: netdev, UNGLinuxDriver
The LAN7431 uses an external phy, and it can be found anywhere in
the phy address space. This patch uses phy address 1 for LAN7430
only. And searches all addresses otherwise.
Signed-off-by: Bryan Whitehead <Bryan.Whitehead@microchip.com>
---
drivers/net/ethernet/microchip/lan743x_main.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c
index e8ca98c..1ba8ea0 100644
--- a/drivers/net/ethernet/microchip/lan743x_main.c
+++ b/drivers/net/ethernet/microchip/lan743x_main.c
@@ -2719,8 +2719,9 @@ static int lan743x_mdiobus_init(struct lan743x_adapter *adapter)
snprintf(adapter->mdiobus->id, MII_BUS_ID_SIZE,
"pci-%s", pci_name(adapter->pdev));
- /* set to internal PHY id */
- adapter->mdiobus->phy_mask = ~(u32)BIT(1);
+ if ((adapter->csr.id_rev & ID_REV_ID_MASK_) == ID_REV_ID_LAN7430_)
+ /* LAN7430 uses internal phy at address 1 */
+ adapter->mdiobus->phy_mask = ~(u32)BIT(1);
/* register mdiobus */
ret = mdiobus_register(adapter->mdiobus);
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v1 net] lan743x: Expand phy search for LAN7431
2018-12-17 21:44 [PATCH v1 net] lan743x: Expand phy search for LAN7431 Bryan Whitehead
@ 2018-12-18 12:12 ` Andrew Lunn
2018-12-18 16:41 ` Bryan.Whitehead
2018-12-19 5:36 ` David Miller
1 sibling, 1 reply; 5+ messages in thread
From: Andrew Lunn @ 2018-12-18 12:12 UTC (permalink / raw)
To: Bryan Whitehead; +Cc: davem, netdev, UNGLinuxDriver
On Mon, Dec 17, 2018 at 04:44:50PM -0500, Bryan Whitehead wrote:
> The LAN7431 uses an external phy, and it can be found anywhere in
> the phy address space. This patch uses phy address 1 for LAN7430
> only. And searches all addresses otherwise.
>
> Signed-off-by: Bryan Whitehead <Bryan.Whitehead@microchip.com>
> ---
> drivers/net/ethernet/microchip/lan743x_main.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c
> index e8ca98c..1ba8ea0 100644
> --- a/drivers/net/ethernet/microchip/lan743x_main.c
> +++ b/drivers/net/ethernet/microchip/lan743x_main.c
> @@ -2719,8 +2719,9 @@ static int lan743x_mdiobus_init(struct lan743x_adapter *adapter)
> snprintf(adapter->mdiobus->id, MII_BUS_ID_SIZE,
> "pci-%s", pci_name(adapter->pdev));
>
> - /* set to internal PHY id */
> - adapter->mdiobus->phy_mask = ~(u32)BIT(1);
> + if ((adapter->csr.id_rev & ID_REV_ID_MASK_) == ID_REV_ID_LAN7430_)
> + /* LAN7430 uses internal phy at address 1 */
> + adapter->mdiobus->phy_mask = ~(u32)BIT(1);
Hi Bryan
Does LAN7430 have an external MDIO bus as well as the internal one? Is
there a possibility for a PHY at address 0? If not, you can probably
just not have a mask at all.
Andrew
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH v1 net] lan743x: Expand phy search for LAN7431
2018-12-18 12:12 ` Andrew Lunn
@ 2018-12-18 16:41 ` Bryan.Whitehead
2018-12-18 16:45 ` Andrew Lunn
0 siblings, 1 reply; 5+ messages in thread
From: Bryan.Whitehead @ 2018-12-18 16:41 UTC (permalink / raw)
To: andrew; +Cc: davem, netdev, UNGLinuxDriver
> > - /* set to internal PHY id */
> > - adapter->mdiobus->phy_mask = ~(u32)BIT(1);
> > + if ((adapter->csr.id_rev & ID_REV_ID_MASK_) ==
> ID_REV_ID_LAN7430_)
> > + /* LAN7430 uses internal phy at address 1 */
> > + adapter->mdiobus->phy_mask = ~(u32)BIT(1);
>
> Hi Bryan
>
> Does LAN7430 have an external MDIO bus as well as the internal one? Is
> there a possibility for a PHY at address 0? If not, you can probably just not
> have a mask at all.
>
> Andrew
Hi Andrew,
The LAN7430 does not have an external MDIO bus.
And there is no possibility for a PHY at address 0.
The reason I kept the mask for LAN7430 case is to reduce effort in finding the phy.
Since Linux will scan all addresses in that case unnecessarily.
But I have tested your suggestion and it does work without a mask.
So I'm fine either way.
If you prefer I do not use a mask for LAN7430 case, then let me know and I will
submit a new patch version.
Bryan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v1 net] lan743x: Expand phy search for LAN7431
2018-12-18 16:41 ` Bryan.Whitehead
@ 2018-12-18 16:45 ` Andrew Lunn
0 siblings, 0 replies; 5+ messages in thread
From: Andrew Lunn @ 2018-12-18 16:45 UTC (permalink / raw)
To: Bryan.Whitehead; +Cc: davem, netdev, UNGLinuxDriver
On Tue, Dec 18, 2018 at 04:41:20PM +0000, Bryan.Whitehead@microchip.com wrote:
> > > - /* set to internal PHY id */
> > > - adapter->mdiobus->phy_mask = ~(u32)BIT(1);
> > > + if ((adapter->csr.id_rev & ID_REV_ID_MASK_) ==
> > ID_REV_ID_LAN7430_)
> > > + /* LAN7430 uses internal phy at address 1 */
> > > + adapter->mdiobus->phy_mask = ~(u32)BIT(1);
> >
> > Hi Bryan
> >
> > Does LAN7430 have an external MDIO bus as well as the internal one? Is
> > there a possibility for a PHY at address 0? If not, you can probably just not
> > have a mask at all.
> >
> > Andrew
>
> Hi Andrew,
>
> The LAN7430 does not have an external MDIO bus.
> And there is no possibility for a PHY at address 0.
> The reason I kept the mask for LAN7430 case is to reduce effort in finding the phy.
> Since Linux will scan all addresses in that case unnecessarily.
>
> But I have tested your suggestion and it does work without a mask.
> So I'm fine either way.
Hi Bryan
Lets keep the patch as it is. As you said, it speeds things up, and
since there is no external MDIO bus, nobody can add a second PHY, or a
switch chip, etc.
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v1 net] lan743x: Expand phy search for LAN7431
2018-12-17 21:44 [PATCH v1 net] lan743x: Expand phy search for LAN7431 Bryan Whitehead
2018-12-18 12:12 ` Andrew Lunn
@ 2018-12-19 5:36 ` David Miller
1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2018-12-19 5:36 UTC (permalink / raw)
To: Bryan.Whitehead; +Cc: netdev, UNGLinuxDriver
From: Bryan Whitehead <Bryan.Whitehead@microchip.com>
Date: Mon, 17 Dec 2018 16:44:50 -0500
> The LAN7431 uses an external phy, and it can be found anywhere in
> the phy address space. This patch uses phy address 1 for LAN7430
> only. And searches all addresses otherwise.
>
> Signed-off-by: Bryan Whitehead <Bryan.Whitehead@microchip.com>
Applied, thanks Bryan.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-12-19 5:36 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-17 21:44 [PATCH v1 net] lan743x: Expand phy search for LAN7431 Bryan Whitehead
2018-12-18 12:12 ` Andrew Lunn
2018-12-18 16:41 ` Bryan.Whitehead
2018-12-18 16:45 ` Andrew Lunn
2018-12-19 5:36 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).