net: lan743x: Add support to SGMII register dump for PCI11010/PCI11414 chips
Subsystems (3)
PATCH v4 1/1 net: lan743x: Add support to SGMII register dump for PCI11010/PCI11414 chips
Add support to SGMII register dump
---
V3 -> V4:
- No changes. Patch on tags 6.1-rc1
V2 -> V3:
- Remove the private flag option.
As per review comment, use -w/-W to configure dump flag. But, change to -w/-W option, EEPROM/OTP data might be corrupt in case of wrong flag input.
Need to fix this properly in future development.
V1 -> V2:
- Add set_dump and get_dump_flag functions
V0 -> V1:
- Removed unwanted code
.../net/ethernet/microchip/lan743x_ethtool.c | 101 ++++++++++++++++-- .../net/ethernet/microchip/lan743x_ethtool.h | 71 +++++++++++- drivers/net/ethernet/microchip/lan743x_main.c | 14 +++ drivers/net/ethernet/microchip/lan743x_main.h | 2 + 4 files changed, 180 insertions(+), 8 deletions(-)
drivers/net/ethernet/microchip/lan743x_ethtool.c +94 -7
@@ -24,6 +24,9 @@#define LOCK_TIMEOUT_MAX_CNT (100) // 1 sec (10 msce * 100)#define LAN743X_CSR_READ_OP (offset) lan743x_csr_read(adapter, offset) +#define VSPEC1 MDIO_MMD_VEND1 +#define VSPEC2 MDIO_MMD_VEND2 +#define SGMII_RD (adp, dev, adr) lan743x_sgmii_dump_read(adp, dev, adr)static int lan743x_otp_power_up (struct lan743x_adapter *adapter) {
@@ -1190,15 +1193,11 @@ static int lan743x_ethtool_set_wol(struct net_device *netdev, }#endif /* CONFIG_PM */ -static void lan743x_common_regs (struct net_device *dev, -struct ethtool_regs *regs,void *p) - +static void lan743x_common_regs (struct net_device *dev,void *p) {struct lan743x_adapter *adapter =netdev_priv (dev);u32 *rb = p; -memset (p,0 , (MAX_LAN743X_ETH_REGS *sizeof (u32))); - rb[ETH_PRIV_FLAGS ] = adapter->flags; rb[ETH_ID_REV ] =lan743x_csr_read (adapter,ID_REV ); rb[ETH_FPGA_REV ] =lan743x_csr_read (adapter,FPGA_REV );
@@ -1220,17 +1219,105 @@ static void lan743x_common_regs(struct net_device *dev, rb[ETH_WK_SRC ] =lan743x_csr_read (adapter,MAC_WK_SRC ); } +static void lan743x_sgmii_regs (struct net_device *dev,void *p) +{ +struct lan743x_adapter *adp =netdev_priv (dev); +u32 *rb = p; + + rb[ETH_SR_VSMMD_DEV_ID1 ] =SGMII_RD (adp,VSPEC1 ,0x0002 ); + rb[ETH_SR_VSMMD_DEV_ID2 ] =SGMII_RD (adp,VSPEC1 ,0x0003 ); + rb[ETH_SR_VSMMD_PCS_ID1 ] =SGMII_RD (adp,VSPEC1 ,0x0004 ); + rb[ETH_SR_VSMMD_PCS_ID2 ] =SGMII_RD (adp,VSPEC1 ,0x0005 ); + rb[ETH_SR_VSMMD_STS ] =SGMII_RD (adp,VSPEC1 ,0x0008 ); + rb[ETH_SR_VSMMD_CTRL ] =SGMII_RD (adp,VSPEC1 ,0x0009 ); + rb[ETH_SR_MII_CTRL ] =SGMII_RD (adp,VSPEC2 ,0x0000 ); + rb[ETH_SR_MII_STS ] =SGMII_RD (adp,VSPEC2 ,0x0001 ); + rb[ETH_SR_MII_DEV_ID1 ] =SGMII_RD (adp,VSPEC2 ,0x0002 ); + rb[ETH_SR_MII_DEV_ID2 ] =SGMII_RD (adp,VSPEC2 ,0x0003 ); + rb[ETH_SR_MII_AN_ADV ] =SGMII_RD (adp,VSPEC2 ,0x0004 ); + rb[ETH_SR_MII_LP_BABL ] =SGMII_RD (adp,VSPEC2 ,0x0005 ); + rb[ETH_SR_MII_EXPN ] =SGMII_RD (adp,VSPEC2 ,0x0006 ); + rb[ETH_SR_MII_EXT_STS ] =SGMII_RD (adp,VSPEC2 ,0x000F ); + rb[ETH_SR_MII_TIME_SYNC_ABL ] =SGMII_RD (adp,VSPEC2 ,0x0708 ); + rb[ETH_SR_MII_TIME_SYNC_TX_MAX_DLY_LWR ] =SGMII_RD (adp,VSPEC2 ,0x0709 ); + rb[ETH_SR_MII_TIME_SYNC_TX_MAX_DLY_UPR ] =SGMII_RD (adp,VSPEC2 ,0x070A ); + rb[ETH_SR_MII_TIME_SYNC_TX_MIN_DLY_LWR ] =SGMII_RD (adp,VSPEC2 ,0x070B ); + rb[ETH_SR_MII_TIME_SYNC_TX_MIN_DLY_UPR ] =SGMII_RD (adp,VSPEC2 ,0x070C ); + rb[ETH_SR_MII_TIME_SYNC_RX_MAX_DLY_LWR ] =SGMII_RD (adp,VSPEC2 ,0x070D ); + rb[ETH_SR_MII_TIME_SYNC_RX_MAX_DLY_UPR ] =SGMII_RD (adp,VSPEC2 ,0x070E ); + rb[ETH_SR_MII_TIME_SYNC_RX_MIN_DLY_LWR ] =SGMII_RD (adp,VSPEC2 ,0x070F ); + rb[ETH_SR_MII_TIME_SYNC_RX_MIN_DLY_UPR ] =SGMII_RD (adp,VSPEC2 ,0x0710 ); + rb[ETH_VR_MII_DIG_CTRL1 ] =SGMII_RD (adp,VSPEC2 ,0x8000 ); + rb[ETH_VR_MII_AN_CTRL ] =SGMII_RD (adp,VSPEC2 ,0x8001 ); + rb[ETH_VR_MII_AN_INTR_STS ] =SGMII_RD (adp,VSPEC2 ,0x8002 ); + rb[ETH_VR_MII_TC ] =SGMII_RD (adp,VSPEC2 ,0x8003 ); + rb[ETH_VR_MII_DBG_CTRL ] =SGMII_RD (adp,VSPEC2 ,0x8005 ); + rb[ETH_VR_MII_EEE_MCTRL0 ] =SGMII_RD (adp,VSPEC2 ,0x8006 ); + rb[ETH_VR_MII_EEE_TXTIMER ] =SGMII_RD (adp,VSPEC2 ,0x8008 ); + rb[ETH_VR_MII_EEE_RXTIMER ] =SGMII_RD (adp,VSPEC2 ,0x8009 ); + rb[ETH_VR_MII_LINK_TIMER_CTRL ] =SGMII_RD (adp,VSPEC2 ,0x800A ); + rb[ETH_VR_MII_EEE_MCTRL1 ] =SGMII_RD (adp,VSPEC2 ,0x800B ); + rb[ETH_VR_MII_DIG_STS ] =SGMII_RD (adp,VSPEC2 ,0x8010 ); + rb[ETH_VR_MII_ICG_ERRCNT1 ] =SGMII_RD (adp,VSPEC2 ,0x8011 ); + rb[ETH_VR_MII_GPIO ] =SGMII_RD (adp,VSPEC2 ,0x8015 ); + rb[ETH_VR_MII_EEE_LPI_STATUS ] =SGMII_RD (adp,VSPEC2 ,0x8016 ); + rb[ETH_VR_MII_EEE_WKERR ] =SGMII_RD (adp,VSPEC2 ,0x8017 ); + rb[ETH_VR_MII_MISC_STS ] =SGMII_RD (adp,VSPEC2 ,0x8018 ); + rb[ETH_VR_MII_RX_LSTS ] =SGMII_RD (adp,VSPEC2 ,0x8020 ); + rb[ETH_VR_MII_GEN2_GEN4_TX_BSTCTRL0 ] =SGMII_RD (adp,VSPEC2 ,0x8038 ); + rb[ETH_VR_MII_GEN2_GEN4_TX_LVLCTRL0 ] =SGMII_RD (adp,VSPEC2 ,0x803A ); + rb[ETH_VR_MII_GEN2_GEN4_TXGENCTRL0 ] =SGMII_RD (adp,VSPEC2 ,0x803C ); + rb[ETH_VR_MII_GEN2_GEN4_TXGENCTRL1 ] =SGMII_RD (adp,VSPEC2 ,0x803D ); + rb[ETH_VR_MII_GEN4_TXGENCTRL2 ] =SGMII_RD (adp,VSPEC2 ,0x803E ); + rb[ETH_VR_MII_GEN2_GEN4_TX_STS ] =SGMII_RD (adp,VSPEC2 ,0x8048 ); + rb[ETH_VR_MII_GEN2_GEN4_RXGENCTRL0 ] =SGMII_RD (adp,VSPEC2 ,0x8058 ); + rb[ETH_VR_MII_GEN2_GEN4_RXGENCTRL1 ] =SGMII_RD (adp,VSPEC2 ,0x8059 ); + rb[ETH_VR_MII_GEN4_RXEQ_CTRL ] =SGMII_RD (adp,VSPEC2 ,0x805B ); + rb[ETH_VR_MII_GEN4_RXLOS_CTRL0 ] =SGMII_RD (adp,VSPEC2 ,0x805D ); + rb[ETH_VR_MII_GEN2_GEN4_MPLL_CTRL0 ] =SGMII_RD (adp,VSPEC2 ,0x8078 ); + rb[ETH_VR_MII_GEN2_GEN4_MPLL_CTRL1 ] =SGMII_RD (adp,VSPEC2 ,0x8079 ); + rb[ETH_VR_MII_GEN2_GEN4_MPLL_STS ] =SGMII_RD (adp,VSPEC2 ,0x8088 ); + rb[ETH_VR_MII_GEN2_GEN4_LVL_CTRL ] =SGMII_RD (adp,VSPEC2 ,0x8090 ); + rb[ETH_VR_MII_GEN4_MISC_CTRL2 ] =SGMII_RD (adp,VSPEC2 ,0x8093 ); + rb[ETH_VR_MII_GEN2_GEN4_MISC_CTRL0 ] =SGMII_RD (adp,VSPEC2 ,0x8099 ); + rb[ETH_VR_MII_GEN2_GEN4_MISC_CTRL1 ] =SGMII_RD (adp,VSPEC2 ,0x809A ); + rb[ETH_VR_MII_SNPS_CR_CTRL ] =SGMII_RD (adp,VSPEC2 ,0x80A0 ); + rb[ETH_VR_MII_SNPS_CR_ADDR ] =SGMII_RD (adp,VSPEC2 ,0x80A1 ); + rb[ETH_VR_MII_SNPS_CR_DATA ] =SGMII_RD (adp,VSPEC2 ,0x80A2 ); + rb[ETH_VR_MII_DIG_CTRL2 ] =SGMII_RD (adp,VSPEC2 ,0x80E1 ); + rb[ETH_VR_MII_DIG_ERRCNT ] =SGMII_RD (adp,VSPEC2 ,0x80E2 ); +} +static int lan743x_get_regs_len (struct net_device *dev) { -return MAX_LAN743X_ETH_REGS *sizeof (u32); +struct lan743x_adapter *adapter =netdev_priv (dev); +u32 num_regs =MAX_LAN743X_ETH_COMMON_REGS ; + +if (adapter->is_sgmii_en) + num_regs +=MAX_LAN743X_ETH_SGMII_REGS ; + +return num_regs *sizeof (u32); }static void lan743x_get_regs (struct net_device *dev,struct ethtool_regs *regs,void *p) { +struct lan743x_adapter *adapter =netdev_priv (dev); +int regs_len; + + regs_len =lan743x_get_regs_len (dev); +memset (p,0 , regs_len); + regs->version =LAN743X_ETH_REG_VERSION ; + regs->len = regs_len; + +lan743x_common_regs (dev, p); + p = (u32 *)p +MAX_LAN743X_ETH_COMMON_REGS ; -lan743x_common_regs (dev, regs, p); +if (adapter->is_sgmii_en) { +lan743x_sgmii_regs (dev, p); + p = (u32 *)p +MAX_LAN743X_ETH_SGMII_REGS ; + } }const struct ethtool_ops lan743x_ethtool_ops = {
drivers/net/ethernet/microchip/lan743x_ethtool.h +70 -1
77 lines not on this page · raw message
drivers/net/ethernet/microchip/lan743x_main.c +14 -0
@@ -25,6 +25,20 @@#define PCS_POWER_STATE_DOWN 0x6#define PCS_POWER_STATE_UP 0x4 +static int lan743x_sgmii_read (struct lan743x_adapter *adapter, +u8 mmd,u16 addr); +int lan743x_sgmii_dump_read (struct lan743x_adapter *adapter, +u8 dev,u16 adr) +{ +int ret; + + ret =lan743x_sgmii_read (adapter, dev, adr); +if (ret <0 ) +pr_warn ("SGMII read fail\n" ); + +return ret; +} +static void pci11x1x_strap_get_status (struct lan743x_adapter *adapter) {u32 chip_rev;
drivers/net/ethernet/microchip/lan743x_main.h +2 -0
@@ -1159,5 +1159,7 @@ u32 lan743x_csr_read(struct lan743x_adapter *adapter, int offset);void lan743x_csr_write (struct lan743x_adapter *adapter,int offset,u32 data);int lan743x_hs_syslock_acquire (struct lan743x_adapter *adapter,u16 timeout);void lan743x_hs_syslock_release (struct lan743x_adapter *adapter); +int lan743x_sgmii_dump_read (struct lan743x_adapter *adapter, +u8 dev,u16 adr);#endif /* _LAN743X_H */
Signature · 1 line
2.25.1
Jakub Kicinski
maintainerdrivers/net/ethernet/microchip/lan743x_ethtool.c line 29
Quoted 10 lines · On Tue, 18 Oct 2022 11:44:25 +0530 Raju Lakkaraju wrote:
Add support to SGMII register dump
+++
b/drivers/net/ethernet/microchip/lan743x_ethtool.cdrivers/net/ethernet/microchip/lan743x_ethtool.c +3
-0@@ -24,6 +24,9 @@#define LOCK_TIMEOUT_MAX_CNT (100) // 1 sec (10 msce * 100)#define LAN743X_CSR_READ_OP (offset) lan743x_csr_read(adapter, offset) +#define VSPEC1 MDIO_MMD_VEND1 +#define VSPEC2 MDIO_MMD_VEND2 +#define SGMII_RD (adp, dev, adr) lan743x_sgmii_dump_read(adp, dev, adr)
These defines help limit the line length?
Please don't obfuscate code like that, see below.
Quoted 11 lines
drivers/net/ethernet/microchip/lan743x_ethtool.c +11
-0+static void lan743x_sgmii_regs (struct net_device *dev,void *p) +{ +struct lan743x_adapter *adp =netdev_priv (dev); +u32 *rb = p; + + rb[ETH_SR_VSMMD_DEV_ID1 ] =SGMII_RD (adp,VSPEC1 ,0x0002 ); + rb[ETH_SR_VSMMD_DEV_ID2 ] =SGMII_RD (adp,VSPEC1 ,0x0003 ); + rb[ETH_SR_VSMMD_PCS_ID1 ] =SGMII_RD (adp,VSPEC1 ,0x0004 ); + rb[ETH_SR_VSMMD_PCS_ID2 ] =SGMII_RD (adp,VSPEC1 ,0x0005 ); + rb[ETH_SR_VSMMD_STS ] =SGMII_RD (adp,VSPEC1 ,0x0008 ); + rb[ETH_SR_VSMMD_CTRL ] =SGMII_RD (adp,VSPEC1 ,0x0009 );
drivers/net/ethernet/microchip/lan743x_ethtool.c static void lan743x_common_regs(struct net_device *dev, · line 1242
Quoted 10 lines
drivers/net/ethernet/microchip/lan743x_ethtool.c +10
-0+ rb[ETH_SR_MII_CTRL ] =SGMII_RD (adp,VSPEC2 ,0x0000 ); + rb[ETH_SR_MII_STS ] =SGMII_RD (adp,VSPEC2 ,0x0001 ); + rb[ETH_SR_MII_DEV_ID1 ] =SGMII_RD (adp,VSPEC2 ,0x0002 ); + rb[ETH_SR_MII_DEV_ID2 ] =SGMII_RD (adp,VSPEC2 ,0x0003 ); + rb[ETH_SR_MII_AN_ADV ] =SGMII_RD (adp,VSPEC2 ,0x0004 ); + rb[ETH_SR_MII_LP_BABL ] =SGMII_RD (adp,VSPEC2 ,0x0005 ); + rb[ETH_SR_MII_EXPN ] =SGMII_RD (adp,VSPEC2 ,0x0006 ); + rb[ETH_SR_MII_EXT_STS ] =SGMII_RD (adp,VSPEC2 ,0x000F ); + rb[ETH_SR_MII_TIME_SYNC_ABL ] =SGMII_RD (adp,VSPEC2 ,0x0708 ); + rb[ETH_SR_MII_TIME_SYNC_TX_MAX_DLY_LWR ] =SGMII_RD (adp,VSPEC2 ,0x0709 );
You can declare a structure holding the params and save the info there:
struct {
u8 id;
u8 dev;
u16 addr;
} regs[] = {
{ ETH_SR_MII_TIME_SYNC_TX_MAX_DLY_LWR, MDIO_MMD_VEND2, 0x0709 },
};that should fit on the line.
You can then read the values in a loop. And inside that loop you can handle errors (perhaps avoiding the need for lan743x_sgmii_dump_read() which seems rather unnecessary as lan743x_sgmii_read() already prints errors).
FWIW I like Andrew's suggestion from v3 to use version as a bitfield, too.
Hi Jakub,
Thank you for review comments.
Quoted 9 lines · Jakub Kicinski
EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
Quoted 6 lines · On Tue, 18 Oct 2022 11:44:25 +0530 Raju Lakkaraju wrote:
Add support to SGMII register dump
+++
b/drivers/net/ethernet/microchip/lan743x_ethtool.cdrivers/net/ethernet/microchip/lan743x_ethtool.c +0
-0@@ -24,6 +24,9 @@#define LOCK_TIMEOUT_MAX_CNT (100) // 1 sec (10 msce * 100)
Quoted 8 lines
drivers/net/ethernet/microchip/lan743x_ethtool.c line 29
Quoted 4 lines
drivers/net/ethernet/microchip/lan743x_ethtool.c +3
-0#define LAN743X_CSR_READ_OP (offset) lan743x_csr_read(adapter, offset) +#define VSPEC1 MDIO_MMD_VEND1 +#define VSPEC2 MDIO_MMD_VEND2 +#define SGMII_RD (adp, dev, adr) lan743x_sgmii_dump_read(adp, dev, adr)These defines help limit the line length?
Please don't obfuscate code like that, see below.
Accepted. I will remove the above code.
Quoted 32 lines
Quoted 11 lines
drivers/net/ethernet/microchip/lan743x_ethtool.c +11
-0+static void lan743x_sgmii_regs (struct net_device *dev,void *p) +{ +struct lan743x_adapter *adp =netdev_priv (dev); +u32 *rb = p; + + rb[ETH_SR_VSMMD_DEV_ID1 ] =SGMII_RD (adp,VSPEC1 ,0x0002 ); + rb[ETH_SR_VSMMD_DEV_ID2 ] =SGMII_RD (adp,VSPEC1 ,0x0003 ); + rb[ETH_SR_VSMMD_PCS_ID1 ] =SGMII_RD (adp,VSPEC1 ,0x0004 ); + rb[ETH_SR_VSMMD_PCS_ID2 ] =SGMII_RD (adp,VSPEC1 ,0x0005 ); + rb[ETH_SR_VSMMD_STS ] =SGMII_RD (adp,VSPEC1 ,0x0008 ); + rb[ETH_SR_VSMMD_CTRL ] =SGMII_RD (adp,VSPEC1 ,0x0009 );drivers/net/ethernet/microchip/lan743x_ethtool.c static void lan743x_common_regs(struct net_device *dev, · line 1242
Quoted 10 lines
drivers/net/ethernet/microchip/lan743x_ethtool.c +10
-0+ rb[ETH_SR_MII_CTRL ] =SGMII_RD (adp,VSPEC2 ,0x0000 ); + rb[ETH_SR_MII_STS ] =SGMII_RD (adp,VSPEC2 ,0x0001 ); + rb[ETH_SR_MII_DEV_ID1 ] =SGMII_RD (adp,VSPEC2 ,0x0002 ); + rb[ETH_SR_MII_DEV_ID2 ] =SGMII_RD (adp,VSPEC2 ,0x0003 ); + rb[ETH_SR_MII_AN_ADV ] =SGMII_RD (adp,VSPEC2 ,0x0004 ); + rb[ETH_SR_MII_LP_BABL ] =SGMII_RD (adp,VSPEC2 ,0x0005 ); + rb[ETH_SR_MII_EXPN ] =SGMII_RD (adp,VSPEC2 ,0x0006 ); + rb[ETH_SR_MII_EXT_STS ] =SGMII_RD (adp,VSPEC2 ,0x000F ); + rb[ETH_SR_MII_TIME_SYNC_ABL ] =SGMII_RD (adp,VSPEC2 ,0x0708 ); + rb[ETH_SR_MII_TIME_SYNC_TX_MAX_DLY_LWR ] =SGMII_RD (adp,VSPEC2 ,0x0709 );You can declare a structure holding the params and save the info there:
struct { u8 id; u8 dev; u16 addr; } regs[] = { { ETH_SR_MII_TIME_SYNC_TX_MAX_DLY_LWR, MDIO_MMD_VEND2, 0x0709 }, };
Quoted 1 line
that should fit on the line.
O.K. I will change.
Quoted 7 lines
You can then read the values in a loop. And inside that loop you can handle errors (perhaps avoiding the need for
lan743x_sgmii_dump_read()which seems rather unnecessary aslan743x_sgmii_read()already prints errors).FWIW I like Andrew's suggestion from v3 to use version as a bitfield, too.
I will implement Andrew's suggestion in my next regdump function patch. Is it OK ?
--------
Thanks,
Raju
Jakub Kicinski
maintainerQuoted 9 lines · On Mon, 31 Oct 2022 12:23:36 +0530 Raju Lakkaraju wrote:
Quoted 6 lines
You can then read the values in a loop. And inside that loop you can handle errors (perhaps avoiding the need for
lan743x_sgmii_dump_read()which seems rather unnecessary aslan743x_sgmii_read()already prints errors).FWIW I like Andrew's suggestion from v3 to use version as a bitfield, too.
I will implement Andrew's suggestion in my next regdump function patch. Is it OK ?
SG, thanks!
Quoted 57 lines · Raju Lakkaraju
drivers/net/ethernet/microchip/lan743x_ethtool.c +57
-0+static void lan743x_sgmii_regs (struct net_device *dev,void *p) +{ +struct lan743x_adapter *adp =netdev_priv (dev); +u32 *rb = p; + + rb[ETH_SR_VSMMD_DEV_ID1 ] =SGMII_RD (adp,VSPEC1 ,0x0002 ); + rb[ETH_SR_VSMMD_DEV_ID2 ] =SGMII_RD (adp,VSPEC1 ,0x0003 ); + rb[ETH_SR_VSMMD_PCS_ID1 ] =SGMII_RD (adp,VSPEC1 ,0x0004 ); + rb[ETH_SR_VSMMD_PCS_ID2 ] =SGMII_RD (adp,VSPEC1 ,0x0005 ); + rb[ETH_SR_VSMMD_STS ] =SGMII_RD (adp,VSPEC1 ,0x0008 ); + rb[ETH_SR_VSMMD_CTRL ] =SGMII_RD (adp,VSPEC1 ,0x0009 ); + rb[ETH_SR_MII_CTRL ] =SGMII_RD (adp,VSPEC2 ,0x0000 ); + rb[ETH_SR_MII_STS ] =SGMII_RD (adp,VSPEC2 ,0x0001 ); + rb[ETH_SR_MII_DEV_ID1 ] =SGMII_RD (adp,VSPEC2 ,0x0002 ); + rb[ETH_SR_MII_DEV_ID2 ] =SGMII_RD (adp,VSPEC2 ,0x0003 ); + rb[ETH_SR_MII_AN_ADV ] =SGMII_RD (adp,VSPEC2 ,0x0004 ); + rb[ETH_SR_MII_LP_BABL ] =SGMII_RD (adp,VSPEC2 ,0x0005 ); + rb[ETH_SR_MII_EXPN ] =SGMII_RD (adp,VSPEC2 ,0x0006 ); + rb[ETH_SR_MII_EXT_STS ] =SGMII_RD (adp,VSPEC2 ,0x000F ); + rb[ETH_SR_MII_TIME_SYNC_ABL ] =SGMII_RD (adp,VSPEC2 ,0x0708 ); + rb[ETH_SR_MII_TIME_SYNC_TX_MAX_DLY_LWR ] =SGMII_RD (adp,VSPEC2 ,0x0709 ); + rb[ETH_SR_MII_TIME_SYNC_TX_MAX_DLY_UPR ] =SGMII_RD (adp,VSPEC2 ,0x070A ); + rb[ETH_SR_MII_TIME_SYNC_TX_MIN_DLY_LWR ] =SGMII_RD (adp,VSPEC2 ,0x070B ); + rb[ETH_SR_MII_TIME_SYNC_TX_MIN_DLY_UPR ] =SGMII_RD (adp,VSPEC2 ,0x070C ); + rb[ETH_SR_MII_TIME_SYNC_RX_MAX_DLY_LWR ] =SGMII_RD (adp,VSPEC2 ,0x070D ); + rb[ETH_SR_MII_TIME_SYNC_RX_MAX_DLY_UPR ] =SGMII_RD (adp,VSPEC2 ,0x070E ); + rb[ETH_SR_MII_TIME_SYNC_RX_MIN_DLY_LWR ] =SGMII_RD (adp,VSPEC2 ,0x070F ); + rb[ETH_SR_MII_TIME_SYNC_RX_MIN_DLY_UPR ] =SGMII_RD (adp,VSPEC2 ,0x0710 ); + rb[ETH_VR_MII_DIG_CTRL1 ] =SGMII_RD (adp,VSPEC2 ,0x8000 ); + rb[ETH_VR_MII_AN_CTRL ] =SGMII_RD (adp,VSPEC2 ,0x8001 ); + rb[ETH_VR_MII_AN_INTR_STS ] =SGMII_RD (adp,VSPEC2 ,0x8002 ); + rb[ETH_VR_MII_TC ] =SGMII_RD (adp,VSPEC2 ,0x8003 ); + rb[ETH_VR_MII_DBG_CTRL ] =SGMII_RD (adp,VSPEC2 ,0x8005 ); + rb[ETH_VR_MII_EEE_MCTRL0 ] =SGMII_RD (adp,VSPEC2 ,0x8006 ); + rb[ETH_VR_MII_EEE_TXTIMER ] =SGMII_RD (adp,VSPEC2 ,0x8008 ); + rb[ETH_VR_MII_EEE_RXTIMER ] =SGMII_RD (adp,VSPEC2 ,0x8009 ); + rb[ETH_VR_MII_LINK_TIMER_CTRL ] =SGMII_RD (adp,VSPEC2 ,0x800A ); + rb[ETH_VR_MII_EEE_MCTRL1 ] =SGMII_RD (adp,VSPEC2 ,0x800B ); + rb[ETH_VR_MII_DIG_STS ] =SGMII_RD (adp,VSPEC2 ,0x8010 ); + rb[ETH_VR_MII_ICG_ERRCNT1 ] =SGMII_RD (adp,VSPEC2 ,0x8011 ); + rb[ETH_VR_MII_GPIO ] =SGMII_RD (adp,VSPEC2 ,0x8015 ); + rb[ETH_VR_MII_EEE_LPI_STATUS ] =SGMII_RD (adp,VSPEC2 ,0x8016 ); + rb[ETH_VR_MII_EEE_WKERR ] =SGMII_RD (adp,VSPEC2 ,0x8017 ); + rb[ETH_VR_MII_MISC_STS ] =SGMII_RD (adp,VSPEC2 ,0x8018 ); + rb[ETH_VR_MII_RX_LSTS ] =SGMII_RD (adp,VSPEC2 ,0x8020 ); + rb[ETH_VR_MII_GEN2_GEN4_TX_BSTCTRL0 ] =SGMII_RD (adp,VSPEC2 ,0x8038 ); + rb[ETH_VR_MII_GEN2_GEN4_TX_LVLCTRL0 ] =SGMII_RD (adp,VSPEC2 ,0x803A ); + rb[ETH_VR_MII_GEN2_GEN4_TXGENCTRL0 ] =SGMII_RD (adp,VSPEC2 ,0x803C ); + rb[ETH_VR_MII_GEN2_GEN4_TXGENCTRL1 ] =SGMII_RD (adp,VSPEC2 ,0x803D ); + rb[ETH_VR_MII_GEN4_TXGENCTRL2 ] =SGMII_RD (adp,VSPEC2 ,0x803E ); + rb[ETH_VR_MII_GEN2_GEN4_TX_STS ] =SGMII_RD (adp,VSPEC2 ,0x8048 ); + rb[ETH_VR_MII_GEN2_GEN4_RXGENCTRL0 ] =SGMII_RD (adp,VSPEC2 ,0x8058 ); + rb[ETH_VR_MII_GEN2_GEN4_RXGENCTRL1 ] =SGMII_RD (adp,VSPEC2 ,0x8059 ); + rb[ETH_VR_MII_GEN4_RXEQ_CTRL ] =SGMII_RD (adp,VSPEC2 ,0x805B ); + rb[ETH_VR_MII_GEN4_RXLOS_CTRL0 ] =SGMII_RD (adp,VSPEC2 ,0x805D ); + rb[ETH_VR_MII_GEN2_GEN4_MPLL_CTRL0 ] =SGMII_RD (adp,VSPEC2 ,0x8078 ); + rb[ETH_VR_MII_GEN2_GEN4_MPLL_CTRL1 ] =SGMII_RD (adp,VSPEC2 ,0x8079 );
drivers/net/ethernet/microchip/lan743x_ethtool.c static void lan743x_common_regs(struct net_device *dev, · line 1288
Quoted 10 lines
drivers/net/ethernet/microchip/lan743x_ethtool.c +10
-0+ rb[ETH_VR_MII_GEN2_GEN4_MPLL_STS ] =SGMII_RD (adp,VSPEC2 ,0x8088 ); + rb[ETH_VR_MII_GEN2_GEN4_LVL_CTRL ] =SGMII_RD (adp,VSPEC2 ,0x8090 ); + rb[ETH_VR_MII_GEN4_MISC_CTRL2 ] =SGMII_RD (adp,VSPEC2 ,0x8093 ); + rb[ETH_VR_MII_GEN2_GEN4_MISC_CTRL0 ] =SGMII_RD (adp,VSPEC2 ,0x8099 ); + rb[ETH_VR_MII_GEN2_GEN4_MISC_CTRL1 ] =SGMII_RD (adp,VSPEC2 ,0x809A ); + rb[ETH_VR_MII_SNPS_CR_CTRL ] =SGMII_RD (adp,VSPEC2 ,0x80A0 ); + rb[ETH_VR_MII_SNPS_CR_ADDR ] =SGMII_RD (adp,VSPEC2 ,0x80A1 ); + rb[ETH_VR_MII_SNPS_CR_DATA ] =SGMII_RD (adp,VSPEC2 ,0x80A2 ); + rb[ETH_VR_MII_DIG_CTRL2 ] =SGMII_RD (adp,VSPEC2 ,0x80E1 ); + rb[ETH_VR_MII_DIG_ERRCNT ] =SGMII_RD (adp,VSPEC2 ,0x80E2 );
What a nice DesignWare XPCS register layout... Is there any chance the lan743x driver could use phylink and the XPCS driver from drivers/net/pcs/pcs-xpcs.c? I'm thinking it would be nice if we could all have access to a register dump procedure for it somehow.
Hi Vladimir,
Thank you for review comments.
Quoted 65 lines · Vladimir Oltean
EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
Quoted 62 lines · Raju Lakkaraju
drivers/net/ethernet/microchip/lan743x_ethtool.c +62
-0+static void lan743x_sgmii_regs (struct net_device *dev,void *p) +{ +struct lan743x_adapter *adp =netdev_priv (dev); +u32 *rb = p; + + rb[ETH_SR_VSMMD_DEV_ID1 ] =SGMII_RD (adp,VSPEC1 ,0x0002 ); + rb[ETH_SR_VSMMD_DEV_ID2 ] =SGMII_RD (adp,VSPEC1 ,0x0003 ); + rb[ETH_SR_VSMMD_PCS_ID1 ] =SGMII_RD (adp,VSPEC1 ,0x0004 ); + rb[ETH_SR_VSMMD_PCS_ID2 ] =SGMII_RD (adp,VSPEC1 ,0x0005 ); + rb[ETH_SR_VSMMD_STS ] =SGMII_RD (adp,VSPEC1 ,0x0008 ); + rb[ETH_SR_VSMMD_CTRL ] =SGMII_RD (adp,VSPEC1 ,0x0009 ); + rb[ETH_SR_MII_CTRL ] =SGMII_RD (adp,VSPEC2 ,0x0000 ); + rb[ETH_SR_MII_STS ] =SGMII_RD (adp,VSPEC2 ,0x0001 ); + rb[ETH_SR_MII_DEV_ID1 ] =SGMII_RD (adp,VSPEC2 ,0x0002 ); + rb[ETH_SR_MII_DEV_ID2 ] =SGMII_RD (adp,VSPEC2 ,0x0003 ); + rb[ETH_SR_MII_AN_ADV ] =SGMII_RD (adp,VSPEC2 ,0x0004 ); + rb[ETH_SR_MII_LP_BABL ] =SGMII_RD (adp,VSPEC2 ,0x0005 ); + rb[ETH_SR_MII_EXPN ] =SGMII_RD (adp,VSPEC2 ,0x0006 ); + rb[ETH_SR_MII_EXT_STS ] =SGMII_RD (adp,VSPEC2 ,0x000F ); + rb[ETH_SR_MII_TIME_SYNC_ABL ] =SGMII_RD (adp,VSPEC2 ,0x0708 ); + rb[ETH_SR_MII_TIME_SYNC_TX_MAX_DLY_LWR ] =SGMII_RD (adp,VSPEC2 ,0x0709 ); + rb[ETH_SR_MII_TIME_SYNC_TX_MAX_DLY_UPR ] =SGMII_RD (adp,VSPEC2 ,0x070A ); + rb[ETH_SR_MII_TIME_SYNC_TX_MIN_DLY_LWR ] =SGMII_RD (adp,VSPEC2 ,0x070B ); + rb[ETH_SR_MII_TIME_SYNC_TX_MIN_DLY_UPR ] =SGMII_RD (adp,VSPEC2 ,0x070C ); + rb[ETH_SR_MII_TIME_SYNC_RX_MAX_DLY_LWR ] =SGMII_RD (adp,VSPEC2 ,0x070D ); + rb[ETH_SR_MII_TIME_SYNC_RX_MAX_DLY_UPR ] =SGMII_RD (adp,VSPEC2 ,0x070E ); + rb[ETH_SR_MII_TIME_SYNC_RX_MIN_DLY_LWR ] =SGMII_RD (adp,VSPEC2 ,0x070F ); + rb[ETH_SR_MII_TIME_SYNC_RX_MIN_DLY_UPR ] =SGMII_RD (adp,VSPEC2 ,0x0710 ); + rb[ETH_VR_MII_DIG_CTRL1 ] =SGMII_RD (adp,VSPEC2 ,0x8000 ); + rb[ETH_VR_MII_AN_CTRL ] =SGMII_RD (adp,VSPEC2 ,0x8001 ); + rb[ETH_VR_MII_AN_INTR_STS ] =SGMII_RD (adp,VSPEC2 ,0x8002 ); + rb[ETH_VR_MII_TC ] =SGMII_RD (adp,VSPEC2 ,0x8003 ); + rb[ETH_VR_MII_DBG_CTRL ] =SGMII_RD (adp,VSPEC2 ,0x8005 ); + rb[ETH_VR_MII_EEE_MCTRL0 ] =SGMII_RD (adp,VSPEC2 ,0x8006 ); + rb[ETH_VR_MII_EEE_TXTIMER ] =SGMII_RD (adp,VSPEC2 ,0x8008 ); + rb[ETH_VR_MII_EEE_RXTIMER ] =SGMII_RD (adp,VSPEC2 ,0x8009 ); + rb[ETH_VR_MII_LINK_TIMER_CTRL ] =SGMII_RD (adp,VSPEC2 ,0x800A ); + rb[ETH_VR_MII_EEE_MCTRL1 ] =SGMII_RD (adp,VSPEC2 ,0x800B ); + rb[ETH_VR_MII_DIG_STS ] =SGMII_RD (adp,VSPEC2 ,0x8010 ); + rb[ETH_VR_MII_ICG_ERRCNT1 ] =SGMII_RD (adp,VSPEC2 ,0x8011 ); + rb[ETH_VR_MII_GPIO ] =SGMII_RD (adp,VSPEC2 ,0x8015 ); + rb[ETH_VR_MII_EEE_LPI_STATUS ] =SGMII_RD (adp,VSPEC2 ,0x8016 ); + rb[ETH_VR_MII_EEE_WKERR ] =SGMII_RD (adp,VSPEC2 ,0x8017 ); + rb[ETH_VR_MII_MISC_STS ] =SGMII_RD (adp,VSPEC2 ,0x8018 ); + rb[ETH_VR_MII_RX_LSTS ] =SGMII_RD (adp,VSPEC2 ,0x8020 ); + rb[ETH_VR_MII_GEN2_GEN4_TX_BSTCTRL0 ] =SGMII_RD (adp,VSPEC2 ,0x8038 ); + rb[ETH_VR_MII_GEN2_GEN4_TX_LVLCTRL0 ] =SGMII_RD (adp,VSPEC2 ,0x803A ); + rb[ETH_VR_MII_GEN2_GEN4_TXGENCTRL0 ] =SGMII_RD (adp,VSPEC2 ,0x803C ); + rb[ETH_VR_MII_GEN2_GEN4_TXGENCTRL1 ] =SGMII_RD (adp,VSPEC2 ,0x803D ); + rb[ETH_VR_MII_GEN4_TXGENCTRL2 ] =SGMII_RD (adp,VSPEC2 ,0x803E ); + rb[ETH_VR_MII_GEN2_GEN4_TX_STS ] =SGMII_RD (adp,VSPEC2 ,0x8048 ); + rb[ETH_VR_MII_GEN2_GEN4_RXGENCTRL0 ] =SGMII_RD (adp,VSPEC2 ,0x8058 ); + rb[ETH_VR_MII_GEN2_GEN4_RXGENCTRL1 ] =SGMII_RD (adp,VSPEC2 ,0x8059 ); + rb[ETH_VR_MII_GEN4_RXEQ_CTRL ] =SGMII_RD (adp,VSPEC2 ,0x805B ); + rb[ETH_VR_MII_GEN4_RXLOS_CTRL0 ] =SGMII_RD (adp,VSPEC2 ,0x805D ); + rb[ETH_VR_MII_GEN2_GEN4_MPLL_CTRL0 ] =SGMII_RD (adp,VSPEC2 ,0x8078 ); + rb[ETH_VR_MII_GEN2_GEN4_MPLL_CTRL1 ] =SGMII_RD (adp,VSPEC2 ,0x8079 ); + rb[ETH_VR_MII_GEN2_GEN4_MPLL_STS ] =SGMII_RD (adp,VSPEC2 ,0x8088 ); + rb[ETH_VR_MII_GEN2_GEN4_LVL_CTRL ] =SGMII_RD (adp,VSPEC2 ,0x8090 ); + rb[ETH_VR_MII_GEN4_MISC_CTRL2 ] =SGMII_RD (adp,VSPEC2 ,0x8093 ); + rb[ETH_VR_MII_GEN2_GEN4_MISC_CTRL0 ] =SGMII_RD (adp,VSPEC2 ,0x8099 ); + rb[ETH_VR_MII_GEN2_GEN4_MISC_CTRL1 ] =SGMII_RD (adp,VSPEC2 ,0x809A );
Quoted 8 lines
drivers/net/ethernet/microchip/lan743x_ethtool.c static void lan743x_common_regs(struct net_device *dev, · line 1288
Quoted 5 lines
drivers/net/ethernet/microchip/lan743x_ethtool.c +5
-0+ rb[ETH_VR_MII_SNPS_CR_CTRL ] =SGMII_RD (adp,VSPEC2 ,0x80A0 ); + rb[ETH_VR_MII_SNPS_CR_ADDR ] =SGMII_RD (adp,VSPEC2 ,0x80A1 ); + rb[ETH_VR_MII_SNPS_CR_DATA ] =SGMII_RD (adp,VSPEC2 ,0x80A2 ); + rb[ETH_VR_MII_DIG_CTRL2 ] =SGMII_RD (adp,VSPEC2 ,0x80E1 ); + rb[ETH_VR_MII_DIG_ERRCNT ] =SGMII_RD (adp,VSPEC2 ,0x80E2 );What a nice DesignWare XPCS register layout... Is there any chance the lan743x driver could use phylink and the XPCS driver from
drivers/net/pcs/pcs-xpcs.c?
Yes. I would like to use phylink for SFP support. I'm working on phylink.
Quoted 2 lines
I'm thinking it would be nice if we could all have access to a register dump procedure for it somehow.
Sure. I will check pcs-xpcs code and chnage regdump function after implement phylink.
--------
Thanks,
Raju