diff mbox series

[net-next,v1] lan78xx: Enable 125 MHz CLK and Auto Speed configuration for LAN7801 if NO EEPROM is detected

Message ID 20240502045503.36298-1-rengarajan.s@microchip.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [net-next,v1] lan78xx: Enable 125 MHz CLK and Auto Speed configuration for LAN7801 if NO EEPROM is detected | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 928 this patch: 928
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/build_clang success Errors and warnings before: 937 this patch: 937
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 939 this patch: 939
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 20 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-05-03--15-00 (tests: 1001)

Commit Message

Rengarajan S May 2, 2024, 4:55 a.m. UTC
The 125MHz and 25MHz clock configurations are done in the initialization
regardless of EEPROM (125MHz is needed for RGMII 1000Mbps operation). After
a lite reset (lan78xx_reset), these contents go back to defaults(all 0, so
no 125MHz or 25MHz clock and no ASD/ADD). Also, after the lite reset, the
LAN7800 enables the ASD/ADD in the absence of EEPROM. There is no such
check for LAN7801.

Signed-off-by: Rengarajan S <rengarajan.s@microchip.com>
---
 drivers/net/usb/lan78xx.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Simon Horman May 4, 2024, 8:49 a.m. UTC | #1
On Thu, May 02, 2024 at 10:25:03AM +0530, Rengarajan S wrote:
> The 125MHz and 25MHz clock configurations are done in the initialization
> regardless of EEPROM (125MHz is needed for RGMII 1000Mbps operation). After
> a lite reset (lan78xx_reset), these contents go back to defaults(all 0, so
> no 125MHz or 25MHz clock and no ASD/ADD). Also, after the lite reset, the
> LAN7800 enables the ASD/ADD in the absence of EEPROM. There is no such
> check for LAN7801.
> 
> Signed-off-by: Rengarajan S <rengarajan.s@microchip.com>

Hi Rengarajan,

This patch seems address two issues.
So I think it would be best to split it into two patches.

Also, are these problems bugs - do they have adverse effect visible by
users? If so perhaps they should be targeted at 'net' rather than
'net-next', and an appropriate Fixes tag should appear just above
the Signed-off-by line (no blank line in between).

...
Rengarajan S May 9, 2024, 6:59 a.m. UTC | #2
Hi Simon,

Apologies for the delay in response. Thanks for reviewing the patch.
Please find my comments inline.

On Sat, 2024-05-04 at 09:49 +0100, Simon Horman wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you
> know the content is safe
> 
> On Thu, May 02, 2024 at 10:25:03AM +0530, Rengarajan S wrote:
> > The 125MHz and 25MHz clock configurations are done in the
> > initialization
> > regardless of EEPROM (125MHz is needed for RGMII 1000Mbps
> > operation). After
> > a lite reset (lan78xx_reset), these contents go back to
> > defaults(all 0, so
> > no 125MHz or 25MHz clock and no ASD/ADD). Also, after the lite
> > reset, the
> > LAN7800 enables the ASD/ADD in the absence of EEPROM. There is no
> > such
> > check for LAN7801.
> > 
> > Signed-off-by: Rengarajan S <rengarajan.s@microchip.com>
> 
> Hi Rengarajan,
> 
> This patch seems address two issues.
> So I think it would be best to split it into two patches.

Sure. Will split the patch into two and will submit the updated patch
in the next revision shortly,

> 
> Also, are these problems bugs - do they have adverse effect visible
> by
> users? If so perhaps they should be targeted at 'net' rather than
> 'net-next', and an appropriate Fixes tag should appear just above
> the Signed-off-by line (no blank line in between).

The changes listed in the patch are feature additions where we give an
option of configuring the clock and speed in the absence of the EEPROM.
The current code does not have any bugs related to this. Since, these
are the additional features/requirements, we are targeting at 'net-
next' rather than 'net'.

> 
> ...
> 
> --
> pw-bot: under-review
Simon Horman May 9, 2024, 1:39 p.m. UTC | #3
On Thu, May 09, 2024 at 06:59:03AM +0000, Rengarajan.S@microchip.com wrote:
> Hi Simon,
> 
> Apologies for the delay in response. Thanks for reviewing the patch.
> Please find my comments inline.
> 
> On Sat, 2024-05-04 at 09:49 +0100, Simon Horman wrote:
> > EXTERNAL EMAIL: Do not click links or open attachments unless you
> > know the content is safe
> > 
> > On Thu, May 02, 2024 at 10:25:03AM +0530, Rengarajan S wrote:
> > > The 125MHz and 25MHz clock configurations are done in the
> > > initialization
> > > regardless of EEPROM (125MHz is needed for RGMII 1000Mbps
> > > operation). After
> > > a lite reset (lan78xx_reset), these contents go back to
> > > defaults(all 0, so
> > > no 125MHz or 25MHz clock and no ASD/ADD). Also, after the lite
> > > reset, the
> > > LAN7800 enables the ASD/ADD in the absence of EEPROM. There is no
> > > such
> > > check for LAN7801.
> > > 
> > > Signed-off-by: Rengarajan S <rengarajan.s@microchip.com>
> > 
> > Hi Rengarajan,
> > 
> > This patch seems address two issues.
> > So I think it would be best to split it into two patches.
> 
> Sure. Will split the patch into two and will submit the updated patch
> in the next revision shortly,
> 
> > 
> > Also, are these problems bugs - do they have adverse effect visible
> > by
> > users? If so perhaps they should be targeted at 'net' rather than
> > 'net-next', and an appropriate Fixes tag should appear just above
> > the Signed-off-by line (no blank line in between).
> 
> The changes listed in the patch are feature additions where we give an
> option of configuring the clock and speed in the absence of the EEPROM.
> The current code does not have any bugs related to this. Since, these
> are the additional features/requirements, we are targeting at 'net-
> next' rather than 'net'.

Thanks, I agree net-next is appropriate for such changes.
diff mbox series

Patch

diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
index ba6c8ac2a736..62dbfff8dad4 100644
--- a/drivers/net/usb/lan78xx.c
+++ b/drivers/net/usb/lan78xx.c
@@ -2944,6 +2944,8 @@  static int lan78xx_reset(struct lan78xx_net *dev)
 		return ret;
 
 	buf |= HW_CFG_MEF_;
+	buf |= HW_CFG_CLK125_EN_;
+	buf |= HW_CFG_REFCLK25_EN_;
 
 	ret = lan78xx_write_reg(dev, HW_CFG, buf);
 	if (ret < 0)
@@ -3032,8 +3034,11 @@  static int lan78xx_reset(struct lan78xx_net *dev)
 		return ret;
 
 	/* LAN7801 only has RGMII mode */
-	if (dev->chipid == ID_REV_CHIP_ID_7801_)
+	if (dev->chipid == ID_REV_CHIP_ID_7801_) {
 		buf &= ~MAC_CR_GMII_EN_;
+		/* Enable Auto Duplex and Auto speed */
+		buf |= MAC_CR_AUTO_DUPLEX_ | MAC_CR_AUTO_SPEED_;
+	}
 
 	if (dev->chipid == ID_REV_CHIP_ID_7800_ ||
 	    dev->chipid == ID_REV_CHIP_ID_7850_) {