net: lan743x: PCI11010 / PCI11414 devices Enhancements
Subsystems (5)
v2 cover net: lan743x: PCI11010 / PCI11414 devices Enhancements
This patch series continues with the addition of supported features for the Ethernet function of the PCI11010 / PCI11414 devices to the LAN743x driver.
Raju Lakkaraju (4):
net: lan743x: Add support to LAN743x register dump
net: lan743x: Add support to Secure-ON WOL
net: lan743x: Add support to SGMII 1G and 2.5G
net: phy: add support to get Master-Slave configuration
.../net/ethernet/microchip/lan743x_ethtool.c | 63 ++- .../net/ethernet/microchip/lan743x_ethtool.h | 26 ++ drivers/net/ethernet/microchip/lan743x_main.c | 378 +++++++++++++++++- drivers/net/ethernet/microchip/lan743x_main.h | 106 +++++ drivers/net/phy/mxl-gpy.c | 3 + 5 files changed, 567 insertions(+), 9 deletions(-)
Signature · 1 line
2.25.1
PATCH v2 1/4 net: lan743x: Add support to LAN743x register dump
Add support to LAN743x common register dump
--- .../net/ethernet/microchip/lan743x_ethtool.c | 45 +++++++++++++++++++ .../net/ethernet/microchip/lan743x_ethtool.h | 26 +++++++++++ 2 files changed, 71 insertions(+)
drivers/net/ethernet/microchip/lan743x_ethtool.c +45 -0
@@ -1178,6 +1178,49 @@ 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) + +{ +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 ); + rb[ETH_STRAP_READ ] =lan743x_csr_read (adapter,STRAP_READ ); + rb[ETH_INT_STS ] =lan743x_csr_read (adapter,INT_STS ); + rb[ETH_HW_CFG ] =lan743x_csr_read (adapter,HW_CFG ); + rb[ETH_PMT_CTL ] =lan743x_csr_read (adapter,PMT_CTL ); + rb[ETH_E2P_CMD ] =lan743x_csr_read (adapter,E2P_CMD ); + rb[ETH_E2P_DATA ] =lan743x_csr_read (adapter,E2P_DATA ); + rb[ETH_MAC_CR ] =lan743x_csr_read (adapter,MAC_CR ); + rb[ETH_MAC_RX ] =lan743x_csr_read (adapter,MAC_RX ); + rb[ETH_MAC_TX ] =lan743x_csr_read (adapter,MAC_TX ); + rb[ETH_FLOW ] =lan743x_csr_read (adapter,MAC_FLOW ); + rb[ETH_MII_ACC ] =lan743x_csr_read (adapter,MAC_MII_ACC ); + rb[ETH_MII_DATA ] =lan743x_csr_read (adapter,MAC_MII_DATA ); + rb[ETH_EEE_TX_LPI_REQ_DLY ] =lan743x_csr_read (adapter, +MAC_EEE_TX_LPI_REQ_DLY_CNT ); + rb[ETH_WUCSR ] =lan743x_csr_read (adapter,MAC_WUCSR ); + rb[ETH_WK_SRC ] =lan743x_csr_read (adapter,MAC_WK_SRC ); +} + +static int lan743x_get_regs_len (struct net_device *dev) +{ +return MAX_LAN743X_ETH_REGS *sizeof (u32); +} + +static void lan743x_get_regs (struct net_device *dev, +struct ethtool_regs *regs,void *p) +{ + regs->version =LAN743X_ETH_REG_VERSION ; + +lan743x_common_regs (dev, regs, p); +} +const struct ethtool_ops lan743x_ethtool_ops = { .get_drvinfo = lan743x_ethtool_get_drvinfo, .get_msglevel = lan743x_ethtool_get_msglevel,
@@ -1202,6 +1245,8 @@ const struct ethtool_ops lan743x_ethtool_ops = { .set_eee = lan743x_ethtool_set_eee, .get_link_ksettings = phy_ethtool_get_link_ksettings, .set_link_ksettings = phy_ethtool_set_link_ksettings, + .get_regs_len = lan743x_get_regs_len, + .get_regs = lan743x_get_regs, #ifdef CONFIG_PM .get_wol = lan743x_ethtool_get_wol, .set_wol = lan743x_ethtool_set_wol,
drivers/net/ethernet/microchip/lan743x_ethtool.h +26 -0
@@ -6,6 +6,32 @@#include "linux/ethtool.h" +#define LAN743X_ETH_REG_VERSION 1 + +enum { +ETH_PRIV_FLAGS , +ETH_ID_REV , +ETH_FPGA_REV , +ETH_STRAP_READ , +ETH_INT_STS , +ETH_HW_CFG , +ETH_PMT_CTL , +ETH_E2P_CMD , +ETH_E2P_DATA , +ETH_MAC_CR , +ETH_MAC_RX , +ETH_MAC_TX , +ETH_FLOW , +ETH_MII_ACC , +ETH_MII_DATA , +ETH_EEE_TX_LPI_REQ_DLY , +ETH_WUCSR , +ETH_WK_SRC , + +/* Add new registers above */ +MAX_LAN743X_ETH_REGS +}; +extern const struct ethtool_ops lan743x_ethtool_ops;#endif /* _LAN743X_ETHTOOL_H */
Signature · 1 line
2.25.1
Re: [PATCH net-next V2 1/4] net: lan743x: Add support to LAN743x register dump
Quoted 3 lines · Raju Lakkaraju
Add support to LAN743x common register dump
Signed-off-by Raju Lakkaraju <[email protected]>
Andrew
PATCH v2 2/4 net: lan743x: Add support to Secure-ON WOL
In reply to Raju LakkarajuAdd support to Magic Packet Detection with Secure-ON for PCI11010/PCI11414 chips
---
Changes:
V0 -> V1:
1. Change to sizeof(wol->sopass) instead of SOPASS_MAX * sizeof(wol->sopass[0])
.../net/ethernet/microchip/lan743x_ethtool.c | 12 ++++++++ drivers/net/ethernet/microchip/lan743x_main.c | 29 +++++++++++++++++++ drivers/net/ethernet/microchip/lan743x_main.h | 10 +++++++ 3 files changed, 51 insertions(+)
drivers/net/ethernet/microchip/lan743x_ethtool.c +12 -0
@@ -1149,7 +1149,12 @@ static void lan743x_ethtool_get_wol(struct net_device *netdev, wol->supported |=WAKE_BCAST |WAKE_UCAST |WAKE_MCAST |WAKE_MAGIC |WAKE_PHY |WAKE_ARP ; +if (adapter->is_pci11x1x) + wol->supported |=WAKE_MAGICSECURE ; + wol->wolopts |= adapter->wolopts; +if (adapter->wolopts &WAKE_MAGICSECURE ) +memcpy (wol->sopass, adapter->sopass,sizeof (wol->sopass)); } static int lan743x_ethtool_set_wol(struct net_device *netdev,
@@ -1170,6 +1175,13 @@ static int lan743x_ethtool_set_wol(struct net_device *netdev, adapter->wolopts |=WAKE_PHY ;if (wol->wolopts &WAKE_ARP ) adapter->wolopts |=WAKE_ARP ; +if (wol->wolopts &WAKE_MAGICSECURE && + wol->wolopts &WAKE_MAGIC ) { +memcpy (adapter->sopass, wol->sopass,sizeof (wol->sopass)); + adapter->wolopts |=WAKE_MAGICSECURE ; + }else { +memset (adapter->sopass,0 ,sizeof (u8) *SOPASS_MAX ); + }device_set_wakeup_enable (&adapter->pdev->dev, (bool )wol->wolopts);
drivers/net/ethernet/microchip/lan743x_main.c +29 -0
@@ -3124,6 +3124,7 @@ static void lan743x_pm_set_wol(struct lan743x_adapter *adapter)const u8 ipv6_multicast[3 ] = {0x33 ,0x33 };const u8 arp_type[2 ] = {0x08 ,0x06 };int mask_index; +u32 sopass;u32 pmtctl;u32 wucsr;u32 macrx;
@@ -3218,6 +3219,14 @@ static void lan743x_pm_set_wol(struct lan743x_adapter *adapter) pmtctl |=PMT_CTL_RX_FCT_RFE_D3_CLK_OVR_ ; } +if (adapter->wolopts &WAKE_MAGICSECURE ) { + sopass = *(u32 *)adapter->sopass; +lan743x_csr_write (adapter,MAC_MP_SO_LO , sopass); + sopass = *(u16 *)&adapter->sopass[4 ]; +lan743x_csr_write (adapter,MAC_MP_SO_HI , sopass); + wucsr |=MAC_MP_SO_EN_ ; + } +lan743x_csr_write (adapter,MAC_WUCSR , wucsr);lan743x_csr_write (adapter,PMT_CTL , pmtctl);lan743x_csr_write (adapter,MAC_RX , macrx);
@@ -3228,6 +3237,7 @@ static int lan743x_pm_suspend(struct device *dev)struct pci_dev *pdev =to_pci_dev (dev);struct net_device *netdev =pci_get_drvdata (pdev);struct lan743x_adapter *adapter =netdev_priv (netdev); +u32 data;lan743x_pcidev_shutdown (pdev);
@@ -3239,6 +3249,18 @@ static int lan743x_pm_suspend(struct device *dev)if (adapter->wolopts)lan743x_pm_set_wol (adapter); +if (adapter->is_pci11x1x) { +/* Save HW_CFG to config again in PM resume */ + data =lan743x_csr_read (adapter,HW_CFG ); + adapter->hw_cfg = data; + data |= (HW_CFG_RST_PROTECT_PCIE_ | +HW_CFG_D3_RESET_DIS_ | +HW_CFG_D3_VAUX_OVR_ | +HW_CFG_HOT_RESET_DIS_ | +HW_CFG_RST_PROTECT_ ); +lan743x_csr_write (adapter,HW_CFG , data); + } +/* Host sets PME_En, put D3hot */ return pci_prepare_to_sleep (pdev); }
@@ -3254,6 +3276,10 @@ static int lan743x_pm_resume(struct device *dev)pci_restore_state (pdev);pci_save_state (pdev); +/* Restore HW_CFG that was saved during pm suspend */ +if (adapter->is_pci11x1x) +lan743x_csr_write (adapter,HW_CFG , adapter->hw_cfg); + ret =lan743x_hardware_init (adapter, pdev);if (ret) { netif_err(adapter, probe, adapter->netdev,
@@ -3270,6 +3296,9 @@ static int lan743x_pm_resume(struct device *dev)lan743x_netdev_open (netdev);netif_device_attach (netdev); + ret =lan743x_csr_read (adapter,MAC_WK_SRC ); +netif_info (adapter, drv, adapter->netdev, +"Wakeup source : 0x%08X\n" , ret);return 0 ; }
drivers/net/ethernet/microchip/lan743x_main.h +10 -0
@@ -43,6 +43,11 @@#define STRAP_READ_ADV_PM_DISABLE_ BIT(0)#define HW_CFG (0x010) +#define HW_CFG_RST_PROTECT_PCIE_ BIT(19) +#define HW_CFG_HOT_RESET_DIS_ BIT(15) +#define HW_CFG_D3_VAUX_OVR_ BIT(14) +#define HW_CFG_D3_RESET_DIS_ BIT(13) +#define HW_CFG_RST_PROTECT_ BIT(12)#define HW_CFG_RELOAD_TYPE_ALL_ (0x00000FC0)#define HW_CFG_EE_OTP_RELOAD_ BIT(4)#define HW_CFG_LRST_ BIT(1)
@@ -214,6 +219,7 @@#define MAC_EEE_TX_LPI_REQ_DLY_CNT (0x130)#define MAC_WUCSR (0x140) +#define MAC_MP_SO_EN_ BIT(21)#define MAC_WUCSR_RFE_WAKE_EN_ BIT(14)#define MAC_WUCSR_PFDA_EN_ BIT(3)#define MAC_WUCSR_WAKE_EN_ BIT(2)
@@ -221,6 +227,8 @@#define MAC_WUCSR_BCST_EN_ BIT(0)#define MAC_WK_SRC (0x144) +#define MAC_MP_SO_HI (0x148) +#define MAC_MP_SO_LO (0x14C)#define MAC_WUF_CFG0 (0x150)#define MAC_NUM_OF_WUF_CFG (32)
@@ -912,6 +920,7 @@ struct lan743x_adapter {int msg_enable;#ifdef CONFIG_PM u32 wolopts; +u8 sopass[SOPASS_MAX ];#endif struct pci_dev *pdev;struct lan743x_csr csr;
@@ -937,6 +946,7 @@ struct lan743x_adapter {#define LAN743X_ADAPTER_FLAG_OTP BIT(0)u32 flags; +u32 hw_cfg; };#define LAN743X_COMPONENT_FLAG_RX (channel) BIT(20 + (channel))
Signature · 1 line
2.25.1
Re: [PATCH net-next V2 2/4] net: lan743x: Add support to Secure-ON WOL
Quoted 3 lines · Raju Lakkaraju
Add support to Magic Packet Detection with Secure-ON for PCI11010/PCI11414 chips
Signed-off-by Raju Lakkaraju <[email protected]>
Andrew
PATCH v2 3/4 net: lan743x: Add support to SGMII 1G and 2.5G
In reply to Raju LakkarajuAdd SGMII access read and write functions
Add support to SGMII 1G and 2.5G for PCI11010/PCI11414 chips
---
V0 -> V1:
1. Remove the unlikely()
From Add support to SGMII 1G and 2.5G patch:
1. Use the MMD devices definitions from mdio.h file
2. Use MII definitions from mii.h
V1 -> V2:
1. Merge SGMII access functions patch and SGMII 1G and 2.5G patch into one patch
.../net/ethernet/microchip/lan743x_ethtool.c | 6 +- drivers/net/ethernet/microchip/lan743x_main.c | 349 +++++++++++++++++- drivers/net/ethernet/microchip/lan743x_main.h | 96 +++++ 3 files changed, 442 insertions(+), 9 deletions(-)
drivers/net/ethernet/microchip/lan743x_ethtool.c +3 -3
@@ -155,8 +155,8 @@ static int lan743x_otp_write(struct lan743x_adapter *adapter, u32 offset,return 0 ; } -static int lan743x_hs_syslock_acquire (struct lan743x_adapter *adapter, -u16 timeout) +int lan743x_hs_syslock_acquire (struct lan743x_adapter *adapter, +u16 timeout) {u16 timeout_cnt =0 ;u32 val;
@@ -192,7 +192,7 @@ static int lan743x_hs_syslock_acquire(struct lan743x_adapter *adapter,return 0 ; } -static void lan743x_hs_syslock_release (struct lan743x_adapter *adapter) +void lan743x_hs_syslock_release (struct lan743x_adapter *adapter) {u32 val;
drivers/net/ethernet/microchip/lan743x_main.c +343 -6
399 lines not on this page · raw message
drivers/net/ethernet/microchip/lan743x_main.h +96 -0
130 lines not on this page · raw message
Signature · 1 line
2.25.1
Re: [PATCH net-next V2 3/4] net: lan743x: Add support to SGMII 1G and 2.5G
Quoted 4 lines · Raju Lakkaraju
Add SGMII access read and write functions
Add support to SGMII 1G and 2.5G for PCI11010/PCI11414 chipsSigned-off-by Raju Lakkaraju <[email protected]>
Andrew
PATCH v2 4/4 net: phy: add support to get Master-Slave configuration
In reply to Raju LakkarajuAdd support to Master-Slave configuration and state
---
Changes:
V0 -> V1:
1. Remove the gpy_master_slave_cfg_get() function and use thegenphy_read_master_slave() funtion.
drivers/net/phy/mxl-gpy.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/phy/mxl-gpy.c +3 -0
@@ -295,6 +295,9 @@ static void gpy_update_interface(struct phy_device *phydev) ret);break ; } + +if (phydev->speed ==SPEED_2500 || phydev->speed ==SPEED_1000 ) +genphy_read_master_slave (phydev); }static int gpy_read_status (struct phy_device *phydev)
Signature · 1 line
2.25.1
Re: [PATCH net-next V2 4/4] net: phy: add support to get Master-Slave configuration
Quoted 8 lines · Raju Lakkaraju
Add support to Master-Slave configuration and state
Signed-off-by Raju Lakkaraju <[email protected]>---
Changes:
V0 -> V1:
1. Remove thegpy_master_slave_cfg_get()function and use thegenphy_read_master_slave()funtion.
So much easier isn't it to make use of existing helpers.
Andrew
This series was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:
Quoted 11 lines · On Thu, 16 Jun 2022 09:42:22 +0530 you wrote:
This patch series continues with the addition of supported features for the Ethernet function of the PCI11010 / PCI11414 devices to the LAN743x driver.
Raju Lakkaraju (4):
net: lan743x: Add support to LAN743x register dump
net: lan743x: Add support to Secure-ON WOL
net: lan743x: Add support to SGMII 1G and 2.5G
net: phy: add support to get Master-Slave configuration[...]
Here is the summary with links:
- [net-next,V2,1/4] net: lan743x: Add support to LAN743x register dump
https://git.kernel.org/netdev/net-next/c/9aeb87d2b5a1 - [net-next,V2,2/4] net: lan743x: Add support to Secure-ON WOL https://git.kernel.org/netdev/net-next/c/6b3768ac8e2b - [net-next,V2,3/4] net: lan743x: Add support to SGMII 1G and 2.5G https://git.kernel.org/netdev/net-next/c/46b777ad9a8c - [net-next,V2,4/4] net: phy: add support to get Master-Slave configuration https://git.kernel.org/netdev/net-next/c/311abcdddc00
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html