All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] net: phy: improve auto-neg emulation in swphy
@ 2019-02-24 16:41 Heiner Kallweit
  2019-02-24 17:56 ` Andrew Lunn
  2019-02-25  6:28 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Heiner Kallweit @ 2019-02-24 16:41 UTC (permalink / raw)
  To: Andrew Lunn, Florian Fainelli, David Miller, Russell King - ARM Linux
  Cc: netdev

Auto-neg emulation currently doesn't set bit BMCR_ANENABLE in BMCR,
add this. Users will ignore speed and duplex settings in BMCR because
we're emulating auto-neg, therefore we can remove related code.
See also following discussion [0].

[0] https://marc.info/?t=155041784900002&r=1&w=2

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/net/phy/swphy.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/drivers/net/phy/swphy.c b/drivers/net/phy/swphy.c
index b9743569e..dad22481d 100644
--- a/drivers/net/phy/swphy.c
+++ b/drivers/net/phy/swphy.c
@@ -19,7 +19,6 @@
 #define MII_REGS_NUM 29
 
 struct swmii_regs {
-	u16 bmcr;
 	u16 bmsr;
 	u16 lpa;
 	u16 lpagb;
@@ -40,16 +39,13 @@ enum {
  */
 static const struct swmii_regs speed[] = {
 	[SWMII_SPEED_10] = {
-		.bmcr  = BMCR_FULLDPLX,
 		.lpa   = LPA_10FULL | LPA_10HALF,
 	},
 	[SWMII_SPEED_100] = {
-		.bmcr  = BMCR_FULLDPLX | BMCR_SPEED100,
 		.bmsr  = BMSR_100FULL | BMSR_100HALF,
 		.lpa   = LPA_100FULL | LPA_100HALF,
 	},
 	[SWMII_SPEED_1000] = {
-		.bmcr  = BMCR_FULLDPLX | BMCR_SPEED1000,
 		.bmsr  = BMSR_ESTATEN,
 		.lpagb = LPA_1000FULL | LPA_1000HALF,
 	},
@@ -57,13 +53,11 @@ static const struct swmii_regs speed[] = {
 
 static const struct swmii_regs duplex[] = {
 	[SWMII_DUPLEX_HALF] = {
-		.bmcr  = ~BMCR_FULLDPLX,
 		.bmsr  = BMSR_ESTATEN | BMSR_100HALF,
 		.lpa   = LPA_10HALF | LPA_100HALF,
 		.lpagb = LPA_1000HALF,
 	},
 	[SWMII_DUPLEX_FULL] = {
-		.bmcr  = ~0,
 		.bmsr  = BMSR_ESTATEN | BMSR_100FULL,
 		.lpa   = LPA_10FULL | LPA_100FULL,
 		.lpagb = LPA_1000FULL,
@@ -118,7 +112,6 @@ int swphy_read_reg(int reg, const struct fixed_phy_status *state)
 {
 	int speed_index, duplex_index;
 	u16 bmsr = BMSR_ANEGCAPABLE;
-	u16 bmcr = 0;
 	u16 lpagb = 0;
 	u16 lpa = 0;
 
@@ -136,7 +129,6 @@ int swphy_read_reg(int reg, const struct fixed_phy_status *state)
 	if (state->link) {
 		bmsr |= BMSR_LSTATUS | BMSR_ANEGCOMPLETE;
 
-		bmcr  |= speed[speed_index].bmcr  & duplex[duplex_index].bmcr;
 		lpa   |= speed[speed_index].lpa   & duplex[duplex_index].lpa;
 		lpagb |= speed[speed_index].lpagb & duplex[duplex_index].lpagb;
 
@@ -149,7 +141,7 @@ int swphy_read_reg(int reg, const struct fixed_phy_status *state)
 
 	switch (reg) {
 	case MII_BMCR:
-		return bmcr;
+		return BMCR_ANENABLE;
 	case MII_BMSR:
 		return bmsr;
 	case MII_PHYSID1:
-- 
2.20.1

Andr

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: phy: improve auto-neg emulation in swphy
  2019-02-24 16:41 [PATCH net-next] net: phy: improve auto-neg emulation in swphy Heiner Kallweit
@ 2019-02-24 17:56 ` Andrew Lunn
  2019-02-25  6:28 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Lunn @ 2019-02-24 17:56 UTC (permalink / raw)
  To: Heiner Kallweit
  Cc: Florian Fainelli, David Miller, Russell King - ARM Linux, netdev

On Sun, Feb 24, 2019 at 05:41:47PM +0100, Heiner Kallweit wrote:
> Auto-neg emulation currently doesn't set bit BMCR_ANENABLE in BMCR,
> add this. Users will ignore speed and duplex settings in BMCR because
> we're emulating auto-neg, therefore we can remove related code.
> See also following discussion [0].
> 
> [0] https://marc.info/?t=155041784900002&r=1&w=2
> 
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>

Tested-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: phy: improve auto-neg emulation in swphy
  2019-02-24 16:41 [PATCH net-next] net: phy: improve auto-neg emulation in swphy Heiner Kallweit
  2019-02-24 17:56 ` Andrew Lunn
@ 2019-02-25  6:28 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2019-02-25  6:28 UTC (permalink / raw)
  To: hkallweit1; +Cc: andrew, f.fainelli, linux, netdev

From: Heiner Kallweit <hkallweit1@gmail.com>
Date: Sun, 24 Feb 2019 17:41:47 +0100

> Auto-neg emulation currently doesn't set bit BMCR_ANENABLE in BMCR,
> add this. Users will ignore speed and duplex settings in BMCR because
> we're emulating auto-neg, therefore we can remove related code.
> See also following discussion [0].
> 
> [0] https://marc.info/?t=155041784900002&r=1&w=2
> 
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>

Applied, thanks Heiner.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-02-25  6:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-24 16:41 [PATCH net-next] net: phy: improve auto-neg emulation in swphy Heiner Kallweit
2019-02-24 17:56 ` Andrew Lunn
2019-02-25  6:28 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.