All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net 1/3] lan78xx: Set ASD in MAC_CR when EEE is enabled.
@ 2018-03-22  7:41 Raghuram Chary J
  2018-03-22  9:26 ` Sergei Shtylyov
  0 siblings, 1 reply; 3+ messages in thread
From: Raghuram Chary J @ 2018-03-22  7:41 UTC (permalink / raw)
  To: davem; +Cc: netdev, unglinuxdriver, woojung.huh, raghuramchary.jallipalli

Description:
EEE does not work with lan7800 when AutoSpeed is not set.
(This can happen when EEPROM is not populated or configured incorrectly)

Root-Cause:
When EEE is enabled, the mac config register ASD is not set
i.e in default state,causing EEE fail.

Fix:
Set the register when eeprom is not present.

Fixes: 55d7de9de6c3 ("Microchip's LAN7800 family USB 2/3 to 10/100/1000 Ethernet device driver")
Signed-off-by: Raghuram Chary J <raghuramchary.jallipalli@microchip.com>
---
 drivers/net/usb/lan78xx.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
index 11176070b345..e2d26f9c0f6a 100644
--- a/drivers/net/usb/lan78xx.c
+++ b/drivers/net/usb/lan78xx.c
@@ -2351,6 +2351,7 @@ static int lan78xx_reset(struct lan78xx_net *dev)
 	u32 buf;
 	int ret = 0;
 	unsigned long timeout;
+	u8 sig;
 
 	ret = lan78xx_read_reg(dev, HW_CFG, &buf);
 	buf |= HW_CFG_LRST_;
@@ -2450,6 +2451,15 @@ static int lan78xx_reset(struct lan78xx_net *dev)
 	/* LAN7801 only has RGMII mode */
 	if (dev->chipid == ID_REV_CHIP_ID_7801_)
 		buf &= ~MAC_CR_GMII_EN_;
+
+	if(dev->chipid == ID_REV_CHIP_ID_7800_) {
+		ret = lan78xx_read_raw_eeprom(dev, 0, 1, &sig);
+		if ((!ret) && (sig != EEPROM_INDICATOR)) {
+			/*Implies there is no external eeprom. Set mac speed*/
+			netdev_info(dev->net, "No External EEPROM. Setting MAC Speed \n");
+			buf |= MAC_CR_AUTO_DUPLEX_ | MAC_CR_AUTO_SPEED_;
+		}
+	}
 	ret = lan78xx_write_reg(dev, MAC_CR, buf);
 
 	ret = lan78xx_read_reg(dev, MAC_TX, &buf);
-- 
2.16.2

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

* Re: [PATCH net 1/3] lan78xx: Set ASD in MAC_CR when EEE is enabled.
  2018-03-22  7:41 [PATCH net 1/3] lan78xx: Set ASD in MAC_CR when EEE is enabled Raghuram Chary J
@ 2018-03-22  9:26 ` Sergei Shtylyov
  2018-03-23  7:21   ` RaghuramChary.Jallipalli
  0 siblings, 1 reply; 3+ messages in thread
From: Sergei Shtylyov @ 2018-03-22  9:26 UTC (permalink / raw)
  To: Raghuram Chary J, davem; +Cc: netdev, unglinuxdriver, woojung.huh

Hello!

    Only stylistic comments.

On 3/22/2018 10:41 AM, Raghuram Chary J wrote:

> Description:
> EEE does not work with lan7800 when AutoSpeed is not set.
> (This can happen when EEPROM is not populated or configured incorrectly)
> 
> Root-Cause:
> When EEE is enabled, the mac config register ASD is not set
> i.e in default state,causing EEE fail.

    Need a period after "i.e" and a space after comma.

> Fix:
> Set the register when eeprom is not present.
> 
> Fixes: 55d7de9de6c3 ("Microchip's LAN7800 family USB 2/3 to 10/100/1000 Ethernet device driver")
> Signed-off-by: Raghuram Chary J <raghuramchary.jallipalli@microchip.com>
> ---
>   drivers/net/usb/lan78xx.c | 10 ++++++++++
>   1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
> index 11176070b345..e2d26f9c0f6a 100644
> --- a/drivers/net/usb/lan78xx.c
> +++ b/drivers/net/usb/lan78xx.c
> @@ -2351,6 +2351,7 @@ static int lan78xx_reset(struct lan78xx_net *dev)
>   	u32 buf;
>   	int ret = 0;
>   	unsigned long timeout;
> +	u8 sig;
>   
>   	ret = lan78xx_read_reg(dev, HW_CFG, &buf);
>   	buf |= HW_CFG_LRST_;
> @@ -2450,6 +2451,15 @@ static int lan78xx_reset(struct lan78xx_net *dev)
>   	/* LAN7801 only has RGMII mode */
>   	if (dev->chipid == ID_REV_CHIP_ID_7801_)
>   		buf &= ~MAC_CR_GMII_EN_;
> +
> +	if(dev->chipid == ID_REV_CHIP_ID_7800_) {

    Please run your patches thru scripts/checkpatch.pl -- it would have 
complained because of a missing space between *if* and (.

> +		ret = lan78xx_read_raw_eeprom(dev, 0, 1, &sig);
> +		if ((!ret) && (sig != EEPROM_INDICATOR)) {

    No need for the inner parens here, especially the 1st pair...

> +			/*Implies there is no external eeprom. Set mac speed*/

    Please add space after /*  and before */.

> +			netdev_info(dev->net, "No External EEPROM. Setting MAC Speed \n");
> +			buf |= MAC_CR_AUTO_DUPLEX_ | MAC_CR_AUTO_SPEED_;
> +		}
> +	}
>   	ret = lan78xx_write_reg(dev, MAC_CR, buf);
>   
>   	ret = lan78xx_read_reg(dev, MAC_TX, &buf);

MBR, Sergei

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

* RE: [PATCH net 1/3] lan78xx: Set ASD in MAC_CR when EEE is enabled.
  2018-03-22  9:26 ` Sergei Shtylyov
@ 2018-03-23  7:21   ` RaghuramChary.Jallipalli
  0 siblings, 0 replies; 3+ messages in thread
From: RaghuramChary.Jallipalli @ 2018-03-23  7:21 UTC (permalink / raw)
  To: sergei.shtylyov, davem; +Cc: netdev, UNGLinuxDriver, Woojung.Huh

Hi Sergei,

> Hello!
> 
>     Only stylistic comments.

Thanks for the comments. Will address them and submit in v1 patch.

Thanks,
-Raghu

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

end of thread, other threads:[~2018-03-23  7:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-22  7:41 [PATCH net 1/3] lan78xx: Set ASD in MAC_CR when EEE is enabled Raghuram Chary J
2018-03-22  9:26 ` Sergei Shtylyov
2018-03-23  7:21   ` RaghuramChary.Jallipalli

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.