* [PATCH net-next V2 0/4] Add support to PHYLINK for LAN743x/PCI11x1x chips
@ 2024-07-16 11:33 Raju Lakkaraju
2024-07-16 11:33 ` [PATCH net-next V2 1/4] net: lan743x: Create separate PCS power reset function Raju Lakkaraju
` (6 more replies)
0 siblings, 7 replies; 17+ messages in thread
From: Raju Lakkaraju @ 2024-07-16 11:33 UTC (permalink / raw)
To: netdev
Cc: davem, kuba, andrew, horms, hkallweit1, richardcochran, rdunlap,
linux, bryan.whitehead, edumazet, pabeni, linux-kernel,
UNGLinuxDriver
This is the follow-up patch series of
https://lkml.iu.edu/hypermail/linux/kernel/2310.2/02078.html
Divide the PHYLINK adaptation and SFP modifications into two separate patch
series.
The current patch series focuses on transitioning the LAN743x driver's PHY
support from phylib to phylink.
Tested on chip PCI11010 Rev-B with Bridgeport Evaluation board Rev-1
Change List:
============
V1 ->V2:
- Fix the Russell King's comments i.e. remove the speed, duplex update in
lan743x_phylink_mac_config( )
- pre-March 2020 legacy support has been removed
V0 -> V1:
- Integrate with Synopsys DesignWare XPCS drivers
- Based on external review comments,
- Changes made to SGMII interface support only 1G/100M/10M bps speed
- Changes made to 2500Base-X interface support only 2.5Gbps speed
- Add check for not is_sgmii_en with is_sfp_support_en support
- Change the "pci11x1x_strap_get_status" function return type from void to
int
- Add ethtool phylink wol, eee, pause get/set functions
Raju Lakkaraju (4):
net: lan743x: Create separate PCS power reset function
net: lan743x: Create separate Link Speed Duplex state function
net: lan743x: Migrate phylib to phylink
net: lan743x: Add support to ethtool phylink get and set settings
drivers/net/ethernet/microchip/Kconfig | 5 +-
.../net/ethernet/microchip/lan743x_ethtool.c | 118 +---
drivers/net/ethernet/microchip/lan743x_main.c | 657 +++++++++++-------
drivers/net/ethernet/microchip/lan743x_main.h | 7 +
4 files changed, 460 insertions(+), 327 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 17+ messages in thread* [PATCH net-next V2 1/4] net: lan743x: Create separate PCS power reset function 2024-07-16 11:33 [PATCH net-next V2 0/4] Add support to PHYLINK for LAN743x/PCI11x1x chips Raju Lakkaraju @ 2024-07-16 11:33 ` Raju Lakkaraju 2024-07-18 3:30 ` Andrew Lunn 2024-07-16 11:33 ` [PATCH net-next V2 2/4] net: lan743x: Create separate Link Speed Duplex state function Raju Lakkaraju ` (5 subsequent siblings) 6 siblings, 1 reply; 17+ messages in thread From: Raju Lakkaraju @ 2024-07-16 11:33 UTC (permalink / raw) To: netdev Cc: davem, kuba, andrew, horms, hkallweit1, richardcochran, rdunlap, linux, bryan.whitehead, edumazet, pabeni, linux-kernel, UNGLinuxDriver Create separate PCS power reset function from lan743x_sgmii_config () to use as subroutine. Signed-off-by: Raju Lakkaraju <Raju.Lakkaraju@microchip.com> --- Change List: ============ V1 -> V2: - No changes drivers/net/ethernet/microchip/lan743x_main.c | 55 ++++++++++--------- 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c index e418539565b1..ce1e104adc20 100644 --- a/drivers/net/ethernet/microchip/lan743x_main.c +++ b/drivers/net/ethernet/microchip/lan743x_main.c @@ -1147,12 +1147,39 @@ static int lan743x_pcs_seq_state(struct lan743x_adapter *adapter, u8 state) return 0; } +static int lan743x_pcs_power_reset(struct lan743x_adapter *adapter) +{ + int mii_ctl; + int ret; + + /* SGMII/1000/2500BASE-X PCS power down */ + mii_ctl = lan743x_sgmii_read(adapter, MDIO_MMD_VEND2, MII_BMCR); + if (mii_ctl < 0) + return mii_ctl; + + mii_ctl |= BMCR_PDOWN; + ret = lan743x_sgmii_write(adapter, MDIO_MMD_VEND2, MII_BMCR, mii_ctl); + if (ret < 0) + return ret; + + ret = lan743x_pcs_seq_state(adapter, PCS_POWER_STATE_DOWN); + if (ret < 0) + return ret; + + /* SGMII/1000/2500BASE-X PCS power up */ + mii_ctl &= ~BMCR_PDOWN; + ret = lan743x_sgmii_write(adapter, MDIO_MMD_VEND2, MII_BMCR, mii_ctl); + if (ret < 0) + return ret; + + return lan743x_pcs_seq_state(adapter, PCS_POWER_STATE_UP); +} + static int lan743x_sgmii_config(struct lan743x_adapter *adapter) { struct net_device *netdev = adapter->netdev; struct phy_device *phydev = netdev->phydev; enum lan743x_sgmii_lsd lsd = POWER_DOWN; - int mii_ctl; bool status; int ret; @@ -1209,31 +1236,7 @@ static int lan743x_sgmii_config(struct lan743x_adapter *adapter) netif_dbg(adapter, drv, adapter->netdev, "SGMII 1G mode enable\n"); - /* SGMII/1000/2500BASE-X PCS power down */ - mii_ctl = lan743x_sgmii_read(adapter, MDIO_MMD_VEND2, MII_BMCR); - if (mii_ctl < 0) - return mii_ctl; - - mii_ctl |= BMCR_PDOWN; - ret = lan743x_sgmii_write(adapter, MDIO_MMD_VEND2, MII_BMCR, mii_ctl); - if (ret < 0) - return ret; - - ret = lan743x_pcs_seq_state(adapter, PCS_POWER_STATE_DOWN); - if (ret < 0) - return ret; - - /* SGMII/1000/2500BASE-X PCS power up */ - mii_ctl &= ~BMCR_PDOWN; - ret = lan743x_sgmii_write(adapter, MDIO_MMD_VEND2, MII_BMCR, mii_ctl); - if (ret < 0) - return ret; - - ret = lan743x_pcs_seq_state(adapter, PCS_POWER_STATE_UP); - if (ret < 0) - return ret; - - return 0; + return lan743x_pcs_power_reset(adapter); } static void lan743x_mac_set_address(struct lan743x_adapter *adapter, -- 2.34.1 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH net-next V2 1/4] net: lan743x: Create separate PCS power reset function 2024-07-16 11:33 ` [PATCH net-next V2 1/4] net: lan743x: Create separate PCS power reset function Raju Lakkaraju @ 2024-07-18 3:30 ` Andrew Lunn 0 siblings, 0 replies; 17+ messages in thread From: Andrew Lunn @ 2024-07-18 3:30 UTC (permalink / raw) To: Raju Lakkaraju Cc: netdev, davem, kuba, horms, hkallweit1, richardcochran, rdunlap, linux, bryan.whitehead, edumazet, pabeni, linux-kernel, UNGLinuxDriver On Tue, Jul 16, 2024 at 05:03:46PM +0530, Raju Lakkaraju wrote: > Create separate PCS power reset function from lan743x_sgmii_config () to use > as subroutine. > > Signed-off-by: Raju Lakkaraju <Raju.Lakkaraju@microchip.com> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Andrew ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH net-next V2 2/4] net: lan743x: Create separate Link Speed Duplex state function 2024-07-16 11:33 [PATCH net-next V2 0/4] Add support to PHYLINK for LAN743x/PCI11x1x chips Raju Lakkaraju 2024-07-16 11:33 ` [PATCH net-next V2 1/4] net: lan743x: Create separate PCS power reset function Raju Lakkaraju @ 2024-07-16 11:33 ` Raju Lakkaraju 2024-07-18 3:33 ` Andrew Lunn 2024-07-16 11:33 ` [PATCH net-next V2 3/4] net: lan743x: Migrate phylib to phylink Raju Lakkaraju ` (4 subsequent siblings) 6 siblings, 1 reply; 17+ messages in thread From: Raju Lakkaraju @ 2024-07-16 11:33 UTC (permalink / raw) To: netdev Cc: davem, kuba, andrew, horms, hkallweit1, richardcochran, rdunlap, linux, bryan.whitehead, edumazet, pabeni, linux-kernel, UNGLinuxDriver Create separate Link Speed Duplex (LSD) update state function from lan743x_sgmii_config () to use as subroutine. Signed-off-by: Raju Lakkaraju <Raju.Lakkaraju@microchip.com> --- Change List: ============ V1 -> V2: - No changes drivers/net/ethernet/microchip/lan743x_main.c | 75 +++++++++++-------- 1 file changed, 45 insertions(+), 30 deletions(-) diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c index ce1e104adc20..b4a4c2840a83 100644 --- a/drivers/net/ethernet/microchip/lan743x_main.c +++ b/drivers/net/ethernet/microchip/lan743x_main.c @@ -992,6 +992,42 @@ static int lan743x_sgmii_write(struct lan743x_adapter *adapter, return ret; } +static int lan743x_get_lsd(int speed, int duplex, u8 mss) +{ + int lsd; + + switch (speed) { + case SPEED_2500: + if (mss == MASTER_SLAVE_STATE_SLAVE) + lsd = LINK_2500_SLAVE; + else + lsd = LINK_2500_MASTER; + break; + case SPEED_1000: + if (mss == MASTER_SLAVE_STATE_SLAVE) + lsd = LINK_1000_SLAVE; + else + lsd = LINK_1000_MASTER; + break; + case SPEED_100: + if (duplex == DUPLEX_FULL) + lsd = LINK_100FD; + else + lsd = LINK_100HD; + break; + case SPEED_10: + if (duplex == DUPLEX_FULL) + lsd = LINK_10FD; + else + lsd = LINK_10HD; + break; + default: + lsd = -EINVAL; + } + + return lsd; +} + static int lan743x_sgmii_mpll_set(struct lan743x_adapter *adapter, u16 baud) { @@ -1179,42 +1215,21 @@ static int lan743x_sgmii_config(struct lan743x_adapter *adapter) { struct net_device *netdev = adapter->netdev; struct phy_device *phydev = netdev->phydev; - enum lan743x_sgmii_lsd lsd = POWER_DOWN; bool status; int ret; - switch (phydev->speed) { - case SPEED_2500: - if (phydev->master_slave_state == MASTER_SLAVE_STATE_MASTER) - lsd = LINK_2500_MASTER; - else - lsd = LINK_2500_SLAVE; - break; - case SPEED_1000: - if (phydev->master_slave_state == MASTER_SLAVE_STATE_MASTER) - lsd = LINK_1000_MASTER; - else - lsd = LINK_1000_SLAVE; - break; - case SPEED_100: - if (phydev->duplex) - lsd = LINK_100FD; - else - lsd = LINK_100HD; - break; - case SPEED_10: - if (phydev->duplex) - lsd = LINK_10FD; - else - lsd = LINK_10HD; - break; - default: + ret = lan743x_get_lsd(phydev->speed, phydev->duplex, + phydev->master_slave_state); + if (ret < 0) { netif_err(adapter, drv, adapter->netdev, - "Invalid speed %d\n", phydev->speed); - return -EINVAL; + "error %d link-speed-duplex(LSD) invalid\n", ret); + return ret; } - adapter->sgmii_lsd = lsd; + adapter->sgmii_lsd = ret; + netif_dbg(adapter, drv, adapter->netdev, + "Link Speed Duplex (lsd) : 0x%X\n", adapter->sgmii_lsd); + ret = lan743x_sgmii_aneg_update(adapter); if (ret < 0) { netif_err(adapter, drv, adapter->netdev, -- 2.34.1 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH net-next V2 2/4] net: lan743x: Create separate Link Speed Duplex state function 2024-07-16 11:33 ` [PATCH net-next V2 2/4] net: lan743x: Create separate Link Speed Duplex state function Raju Lakkaraju @ 2024-07-18 3:33 ` Andrew Lunn 0 siblings, 0 replies; 17+ messages in thread From: Andrew Lunn @ 2024-07-18 3:33 UTC (permalink / raw) To: Raju Lakkaraju Cc: netdev, davem, kuba, horms, hkallweit1, richardcochran, rdunlap, linux, bryan.whitehead, edumazet, pabeni, linux-kernel, UNGLinuxDriver On Tue, Jul 16, 2024 at 05:03:47PM +0530, Raju Lakkaraju wrote: > Create separate Link Speed Duplex (LSD) update state function from > lan743x_sgmii_config () to use as subroutine. > > Signed-off-by: Raju Lakkaraju <Raju.Lakkaraju@microchip.com> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Andrew ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH net-next V2 3/4] net: lan743x: Migrate phylib to phylink 2024-07-16 11:33 [PATCH net-next V2 0/4] Add support to PHYLINK for LAN743x/PCI11x1x chips Raju Lakkaraju 2024-07-16 11:33 ` [PATCH net-next V2 1/4] net: lan743x: Create separate PCS power reset function Raju Lakkaraju 2024-07-16 11:33 ` [PATCH net-next V2 2/4] net: lan743x: Create separate Link Speed Duplex state function Raju Lakkaraju @ 2024-07-16 11:33 ` Raju Lakkaraju 2024-07-18 3:43 ` Andrew Lunn 2024-07-29 9:16 ` Russell King (Oracle) 2024-07-16 11:33 ` [PATCH net-next V2 4/4] net: lan743x: Add support to ethtool phylink get and set settings Raju Lakkaraju ` (3 subsequent siblings) 6 siblings, 2 replies; 17+ messages in thread From: Raju Lakkaraju @ 2024-07-16 11:33 UTC (permalink / raw) To: netdev Cc: davem, kuba, andrew, horms, hkallweit1, richardcochran, rdunlap, linux, bryan.whitehead, edumazet, pabeni, linux-kernel, UNGLinuxDriver Migrate phy support from phylib to phylink. Fixed phy support is still used together with phylink since we need to support dynamic fallback when a phy is not found over mdio. While phylink's FIXED mode supports fixed phys that, it's dynamic and requires device tree entries which are most of the time not present for LAN743x devices Signed-off-by: Raju Lakkaraju <Raju.Lakkaraju@microchip.com> --- Change List: ============ V1 -> V2: - Split the PHYLINK and SFP changes in 2 different patch series drivers/net/ethernet/microchip/Kconfig | 5 +- drivers/net/ethernet/microchip/lan743x_main.c | 574 +++++++++++------- drivers/net/ethernet/microchip/lan743x_main.h | 3 + 3 files changed, 355 insertions(+), 227 deletions(-) diff --git a/drivers/net/ethernet/microchip/Kconfig b/drivers/net/ethernet/microchip/Kconfig index 43ba71e82260..4b7a0433b7e5 100644 --- a/drivers/net/ethernet/microchip/Kconfig +++ b/drivers/net/ethernet/microchip/Kconfig @@ -46,12 +46,13 @@ config LAN743X tristate "LAN743x support" depends on PCI depends on PTP_1588_CLOCK_OPTIONAL - select PHYLIB select FIXED_PHY select CRC16 select CRC32 + select PHYLINK help - Support for the Microchip LAN743x PCI Express Gigabit Ethernet chip + Support for the Microchip LAN743x and PCI11x1x families of PCI + Express Ethernet devices To compile this driver as a module, choose M here. The module will be called lan743x. diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c index b4a4c2840a83..9f958fb27bd8 100644 --- a/drivers/net/ethernet/microchip/lan743x_main.c +++ b/drivers/net/ethernet/microchip/lan743x_main.c @@ -15,6 +15,7 @@ #include <linux/rtnetlink.h> #include <linux/iopoll.h> #include <linux/crc16.h> +#include <linux/phylink.h> #include "lan743x_main.h" #include "lan743x_ethtool.h" @@ -1077,26 +1078,7 @@ static int lan743x_sgmii_2_5G_mode_set(struct lan743x_adapter *adapter, VR_MII_BAUD_RATE_1P25GBPS); } -static int lan743x_is_sgmii_2_5G_mode(struct lan743x_adapter *adapter, - bool *status) -{ - int ret; - - ret = lan743x_sgmii_read(adapter, MDIO_MMD_VEND2, - VR_MII_GEN2_4_MPLL_CTRL1); - if (ret < 0) - return ret; - - if (ret == VR_MII_MPLL_MULTIPLIER_125 || - ret == VR_MII_MPLL_MULTIPLIER_50) - *status = true; - else - *status = false; - - return 0; -} - -static int lan743x_sgmii_aneg_update(struct lan743x_adapter *adapter) +static int lan743x_serdes_clock_and_aneg_update(struct lan743x_adapter *adapter) { enum lan743x_sgmii_lsd lsd = adapter->sgmii_lsd; int mii_ctrl; @@ -1211,49 +1193,6 @@ static int lan743x_pcs_power_reset(struct lan743x_adapter *adapter) return lan743x_pcs_seq_state(adapter, PCS_POWER_STATE_UP); } -static int lan743x_sgmii_config(struct lan743x_adapter *adapter) -{ - struct net_device *netdev = adapter->netdev; - struct phy_device *phydev = netdev->phydev; - bool status; - int ret; - - ret = lan743x_get_lsd(phydev->speed, phydev->duplex, - phydev->master_slave_state); - if (ret < 0) { - netif_err(adapter, drv, adapter->netdev, - "error %d link-speed-duplex(LSD) invalid\n", ret); - return ret; - } - - adapter->sgmii_lsd = ret; - netif_dbg(adapter, drv, adapter->netdev, - "Link Speed Duplex (lsd) : 0x%X\n", adapter->sgmii_lsd); - - ret = lan743x_sgmii_aneg_update(adapter); - if (ret < 0) { - netif_err(adapter, drv, adapter->netdev, - "error %d SGMII cfg failed\n", ret); - return ret; - } - - ret = lan743x_is_sgmii_2_5G_mode(adapter, &status); - if (ret < 0) { - netif_err(adapter, drv, adapter->netdev, - "error %d SGMII get mode failed\n", ret); - return ret; - } - - if (status) - netif_dbg(adapter, drv, adapter->netdev, - "SGMII 2.5G mode enable\n"); - else - netif_dbg(adapter, drv, adapter->netdev, - "SGMII 1G mode enable\n"); - - return lan743x_pcs_power_reset(adapter); -} - static void lan743x_mac_set_address(struct lan743x_adapter *adapter, u8 *addr) { @@ -1407,103 +1346,11 @@ static int lan743x_phy_reset(struct lan743x_adapter *adapter) 50000, 1000000); } -static void lan743x_phy_update_flowcontrol(struct lan743x_adapter *adapter, - u16 local_adv, u16 remote_adv) -{ - struct lan743x_phy *phy = &adapter->phy; - u8 cap; - - if (phy->fc_autoneg) - cap = mii_resolve_flowctrl_fdx(local_adv, remote_adv); - else - cap = phy->fc_request_control; - - lan743x_mac_flow_ctrl_set_enables(adapter, - cap & FLOW_CTRL_TX, - cap & FLOW_CTRL_RX); -} - static int lan743x_phy_init(struct lan743x_adapter *adapter) { return lan743x_phy_reset(adapter); } -static void lan743x_phy_link_status_change(struct net_device *netdev) -{ - struct lan743x_adapter *adapter = netdev_priv(netdev); - struct phy_device *phydev = netdev->phydev; - u32 data; - - phy_print_status(phydev); - if (phydev->state == PHY_RUNNING) { - int remote_advertisement = 0; - int local_advertisement = 0; - - data = lan743x_csr_read(adapter, MAC_CR); - - /* set duplex mode */ - if (phydev->duplex) - data |= MAC_CR_DPX_; - else - data &= ~MAC_CR_DPX_; - - /* set bus speed */ - switch (phydev->speed) { - case SPEED_10: - data &= ~MAC_CR_CFG_H_; - data &= ~MAC_CR_CFG_L_; - break; - case SPEED_100: - data &= ~MAC_CR_CFG_H_; - data |= MAC_CR_CFG_L_; - break; - case SPEED_1000: - data |= MAC_CR_CFG_H_; - data &= ~MAC_CR_CFG_L_; - break; - case SPEED_2500: - data |= MAC_CR_CFG_H_; - data |= MAC_CR_CFG_L_; - break; - } - lan743x_csr_write(adapter, MAC_CR, data); - - local_advertisement = - linkmode_adv_to_mii_adv_t(phydev->advertising); - remote_advertisement = - linkmode_adv_to_mii_adv_t(phydev->lp_advertising); - - lan743x_phy_update_flowcontrol(adapter, local_advertisement, - remote_advertisement); - lan743x_ptp_update_latency(adapter, phydev->speed); - if (phydev->interface == PHY_INTERFACE_MODE_SGMII || - phydev->interface == PHY_INTERFACE_MODE_1000BASEX || - phydev->interface == PHY_INTERFACE_MODE_2500BASEX) - lan743x_sgmii_config(adapter); - - data = lan743x_csr_read(adapter, MAC_CR); - if (phydev->enable_tx_lpi) - data |= MAC_CR_EEE_EN_; - else - data &= ~MAC_CR_EEE_EN_; - lan743x_csr_write(adapter, MAC_CR, data); - } -} - -static void lan743x_phy_close(struct lan743x_adapter *adapter) -{ - struct net_device *netdev = adapter->netdev; - struct phy_device *phydev = netdev->phydev; - - phy_stop(netdev->phydev); - phy_disconnect(netdev->phydev); - - /* using phydev here as phy_disconnect NULLs netdev->phydev */ - if (phy_is_pseudo_fixed_link(phydev)) - fixed_phy_unregister(phydev); - -} - static void lan743x_phy_interface_select(struct lan743x_adapter *adapter) { u32 id_rev; @@ -1520,65 +1367,9 @@ static void lan743x_phy_interface_select(struct lan743x_adapter *adapter) adapter->phy_interface = PHY_INTERFACE_MODE_MII; else adapter->phy_interface = PHY_INTERFACE_MODE_RGMII; -} -static int lan743x_phy_open(struct lan743x_adapter *adapter) -{ - struct net_device *netdev = adapter->netdev; - struct lan743x_phy *phy = &adapter->phy; - struct fixed_phy_status fphy_status = { - .link = 1, - .speed = SPEED_1000, - .duplex = DUPLEX_FULL, - }; - struct phy_device *phydev; - int ret = -EIO; - - /* try devicetree phy, or fixed link */ - phydev = of_phy_get_and_connect(netdev, adapter->pdev->dev.of_node, - lan743x_phy_link_status_change); - - if (!phydev) { - /* try internal phy */ - phydev = phy_find_first(adapter->mdiobus); - if (!phydev) { - if ((adapter->csr.id_rev & ID_REV_ID_MASK_) == - ID_REV_ID_LAN7431_) { - phydev = fixed_phy_register(PHY_POLL, - &fphy_status, NULL); - if (IS_ERR(phydev)) { - netdev_err(netdev, "No PHY/fixed_PHY found\n"); - return PTR_ERR(phydev); - } - } else { - goto return_error; - } - } - - lan743x_phy_interface_select(adapter); - - ret = phy_connect_direct(netdev, phydev, - lan743x_phy_link_status_change, - adapter->phy_interface); - if (ret) - goto return_error; - } - - /* MAC doesn't support 1000T Half */ - phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_1000baseT_Half_BIT); - - /* support both flow controls */ - phy_support_asym_pause(phydev); - phy->fc_request_control = (FLOW_CTRL_RX | FLOW_CTRL_TX); - phy->fc_autoneg = phydev->autoneg; - - phy_start(phydev); - phy_start_aneg(phydev); - phy_attached_info(phydev); - return 0; - -return_error: - return ret; + netif_dbg(adapter, drv, adapter->netdev, + "selected phy interface: 0x%X\n", adapter->phy_interface); } static void lan743x_rfe_open(struct lan743x_adapter *adapter) @@ -3079,6 +2870,319 @@ static int lan743x_rx_open(struct lan743x_rx *rx) return ret; } +static int lan743x_phylink_sgmii_config(struct lan743x_adapter *adapter) +{ + u32 sgmii_ctl; + int ret; + + ret = lan743x_get_lsd(SPEED_1000, DUPLEX_FULL, + MASTER_SLAVE_STATE_MASTER); + if (ret < 0) { + netif_err(adapter, drv, adapter->netdev, + "error %d link-speed-duplex(LSD) invalid\n", ret); + return ret; + } + + adapter->sgmii_lsd = ret; + netif_dbg(adapter, drv, adapter->netdev, + "Link Speed Duplex (lsd) : 0x%X\n", adapter->sgmii_lsd); + + /* LINK_STATUS_SOURCE from the External PHY via SGMII */ + sgmii_ctl = lan743x_csr_read(adapter, SGMII_CTL); + sgmii_ctl &= ~SGMII_CTL_LINK_STATUS_SOURCE_; + lan743x_csr_write(adapter, SGMII_CTL, sgmii_ctl); + + ret = lan743x_serdes_clock_and_aneg_update(adapter); + if (ret < 0) { + netif_err(adapter, drv, adapter->netdev, + "error %d sgmii aneg update failed\n", ret); + return ret; + } + + return lan743x_pcs_power_reset(adapter); +} + +static int lan743x_phylink_1000basex_config(struct lan743x_adapter *adapter) +{ + u32 sgmii_ctl; + int ret; + + ret = lan743x_get_lsd(SPEED_1000, DUPLEX_FULL, + MASTER_SLAVE_STATE_MASTER); + if (ret < 0) { + netif_err(adapter, drv, adapter->netdev, + "error %d link-speed-duplex(LSD) invalid\n", ret); + return ret; + } + + adapter->sgmii_lsd = ret; + netif_dbg(adapter, drv, adapter->netdev, + "Link Speed Duplex (lsd) : 0x%X\n", adapter->sgmii_lsd); + + /* LINK_STATUS_SOURCE from 1000BASE-X PCS link status */ + sgmii_ctl = lan743x_csr_read(adapter, SGMII_CTL); + sgmii_ctl |= SGMII_CTL_LINK_STATUS_SOURCE_; + lan743x_csr_write(adapter, SGMII_CTL, sgmii_ctl); + + ret = lan743x_serdes_clock_and_aneg_update(adapter); + if (ret < 0) { + netif_err(adapter, drv, adapter->netdev, + "error %d 1000basex aneg update failed\n", ret); + return ret; + } + + return lan743x_pcs_power_reset(adapter); +} + +static int lan743x_phylink_2500basex_config(struct lan743x_adapter *adapter) +{ + u32 sgmii_ctl; + int ret; + + ret = lan743x_get_lsd(SPEED_2500, DUPLEX_FULL, + MASTER_SLAVE_STATE_MASTER); + if (ret < 0) { + netif_err(adapter, drv, adapter->netdev, + "error %d link-speed-duplex(LSD) invalid\n", ret); + return ret; + } + + adapter->sgmii_lsd = ret; + netif_dbg(adapter, drv, adapter->netdev, + "Link Speed Duplex (lsd) : 0x%X\n", adapter->sgmii_lsd); + + /* LINK_STATUS_SOURCE from 2500BASE-X PCS link status */ + sgmii_ctl = lan743x_csr_read(adapter, SGMII_CTL); + sgmii_ctl |= SGMII_CTL_LINK_STATUS_SOURCE_; + lan743x_csr_write(adapter, SGMII_CTL, sgmii_ctl); + + ret = lan743x_serdes_clock_and_aneg_update(adapter); + if (ret < 0) { + netif_err(adapter, drv, adapter->netdev, + "error %d 2500basex aneg update failed\n", ret); + return ret; + } + + return lan743x_pcs_power_reset(adapter); +} + +static void lan743x_phylink_mac_config(struct phylink_config *config, + unsigned int link_an_mode, + const struct phylink_link_state *state) +{ + struct net_device *netdev = to_net_dev(config->dev); + struct lan743x_adapter *adapter = netdev_priv(netdev); + int ret; + + switch (state->interface) { + case PHY_INTERFACE_MODE_2500BASEX: + ret = lan743x_phylink_2500basex_config(adapter); + if (ret < 0) + netif_err(adapter, drv, adapter->netdev, + "2500BASEX config failed. Error %d\n", ret); + else + netif_dbg(adapter, drv, adapter->netdev, + "2500BASEX mode selected and configured\n"); + break; + case PHY_INTERFACE_MODE_1000BASEX: + ret = lan743x_phylink_1000basex_config(adapter); + if (ret < 0) + netif_err(adapter, drv, adapter->netdev, + "1000BASEX config failed. Error %d\n", ret); + else + netif_dbg(adapter, drv, adapter->netdev, + "1000BASEX mode selected and configured\n"); + break; + case PHY_INTERFACE_MODE_SGMII: + ret = lan743x_phylink_sgmii_config(adapter); + if (ret < 0) + netif_err(adapter, drv, adapter->netdev, + "SGMII config failed. Error %d\n", ret); + else + netif_dbg(adapter, drv, adapter->netdev, + "SGMII mode selected and configured\n"); + break; + default: + netif_dbg(adapter, drv, adapter->netdev, + "RGMII/GMII/MII(0x%X) mode enable\n", state->interface); + break; + } +} + +static void lan743x_phylink_mac_link_down(struct phylink_config *config, + unsigned int link_an_mode, + phy_interface_t interface) +{ + netif_tx_stop_all_queues(to_net_dev(config->dev)); +} + +static void lan743x_phylink_mac_link_up(struct phylink_config *config, + struct phy_device *phydev, + unsigned int link_an_mode, + phy_interface_t interface, + int speed, int duplex, + bool tx_pause, bool rx_pause) +{ + struct net_device *netdev = to_net_dev(config->dev); + struct lan743x_adapter *adapter = netdev_priv(netdev); + int mac_cr; + u8 cap; + + mac_cr = lan743x_csr_read(adapter, MAC_CR); + /* Pre-initialize register bits. + * Resulting value corresponds to SPEED_10 + */ + mac_cr &= ~(MAC_CR_CFG_H_ | MAC_CR_CFG_L_); + if (speed == SPEED_2500) + mac_cr |= (MAC_CR_CFG_H_ | MAC_CR_CFG_L_); + else if (speed == SPEED_1000) + mac_cr |= (MAC_CR_CFG_H_); + else if (speed == SPEED_100) + mac_cr |= (MAC_CR_CFG_L_); + + lan743x_csr_write(adapter, MAC_CR, mac_cr); + + lan743x_ptp_update_latency(adapter, speed); + + /* Flow Control operation */ + cap = 0; + if (tx_pause) + cap |= FLOW_CTRL_TX; + if (rx_pause) + cap |= FLOW_CTRL_RX; + + lan743x_mac_flow_ctrl_set_enables(adapter, + cap & FLOW_CTRL_TX, + cap & FLOW_CTRL_RX); + + netif_tx_wake_all_queues(to_net_dev(config->dev)); +} + +static const struct phylink_mac_ops lan743x_phylink_mac_ops = { + .mac_config = lan743x_phylink_mac_config, + .mac_link_down = lan743x_phylink_mac_link_down, + .mac_link_up = lan743x_phylink_mac_link_up, +}; + +static int lan743x_phylink_create(struct net_device *netdev) +{ + struct lan743x_adapter *adapter = netdev_priv(netdev); + struct phylink *pl; + + adapter->phylink_config.dev = &netdev->dev; + adapter->phylink_config.type = PHYLINK_NETDEV; + adapter->phylink_config.mac_managed_pm = false; + + adapter->phylink_config.mac_capabilities = MAC_ASYM_PAUSE | + MAC_SYM_PAUSE | MAC_10 | MAC_100 | MAC_1000FD | MAC_2500FD; + + lan743x_phy_interface_select(adapter); + + switch (adapter->phy_interface) { + case PHY_INTERFACE_MODE_SGMII: + __set_bit(PHY_INTERFACE_MODE_SGMII, + adapter->phylink_config.supported_interfaces); + __set_bit(PHY_INTERFACE_MODE_1000BASEX, + adapter->phylink_config.supported_interfaces); + __set_bit(PHY_INTERFACE_MODE_2500BASEX, + adapter->phylink_config.supported_interfaces); + break; + case PHY_INTERFACE_MODE_GMII: + __set_bit(PHY_INTERFACE_MODE_GMII, + adapter->phylink_config.supported_interfaces); + break; + case PHY_INTERFACE_MODE_MII: + __set_bit(PHY_INTERFACE_MODE_MII, + adapter->phylink_config.supported_interfaces); + break; + default: + __set_bit(PHY_INTERFACE_MODE_RGMII, + adapter->phylink_config.supported_interfaces); + } + + pl = phylink_create(&adapter->phylink_config, NULL, + adapter->phy_interface, &lan743x_phylink_mac_ops); + + if (IS_ERR(pl)) { + netdev_err(netdev, "Could not create phylink (%pe)\n", pl); + return PTR_ERR(pl); + } + + adapter->phylink = pl; + netdev_dbg(netdev, "lan743x phylink created"); + + return 0; +} + +static bool lan743x_phy_handle_exists(struct device_node *dn) +{ + dn = of_parse_phandle(dn, "phy-handle", 0); + of_node_put(dn); + if (IS_ERR(dn)) + return false; + + return true; +} + +static int lan743x_phylink_connect(struct lan743x_adapter *adapter) +{ + struct device_node *dn = adapter->pdev->dev.of_node; + struct net_device *dev = adapter->netdev; + struct fixed_phy_status fphy_status = { + .link = 1, + .speed = SPEED_1000, + .duplex = DUPLEX_FULL, + }; + struct phy_device *phydev; + int ret; + + if (dn) + ret = phylink_of_phy_connect(adapter->phylink, dn, 0); + + if (!dn || (ret && !lan743x_phy_handle_exists(dn))) { + phydev = phy_find_first(adapter->mdiobus); + if (!phydev) { + if (((adapter->csr.id_rev & ID_REV_ID_MASK_) == + ID_REV_ID_LAN7431_) || adapter->is_pci11x1x) { + phydev = fixed_phy_register(PHY_POLL, + &fphy_status, + NULL); + if (IS_ERR(phydev)) { + netdev_err(dev, "No PHY/fixed_PHY found\n"); + return PTR_ERR(phydev); + } + } else { + netdev_err(dev, "no PHY found\n"); + return -ENXIO; + } + } + + /* attach the mac to the phy */ + ret = phylink_connect_phy(adapter->phylink, phydev); + if (ret) { + netdev_err(dev, "Could not attach PHY (%d)\n", ret); + return ret; + } + } + + phylink_start(adapter->phylink); + + return 0; +} + +static void lan743x_phylink_disconnect(struct lan743x_adapter *adapter) +{ + struct net_device *netdev = adapter->netdev; + struct phy_device *phydev = netdev->phydev; + + phylink_stop(adapter->phylink); + phylink_disconnect_phy(adapter->phylink); + + if (phydev) + if (phy_is_pseudo_fixed_link(phydev)) + fixed_phy_unregister(phydev); +} + static int lan743x_netdev_close(struct net_device *netdev) { struct lan743x_adapter *adapter = netdev_priv(netdev); @@ -3092,7 +3196,7 @@ static int lan743x_netdev_close(struct net_device *netdev) lan743x_ptp_close(adapter); - lan743x_phy_close(adapter); + lan743x_phylink_disconnect(adapter); lan743x_mac_close(adapter); @@ -3115,13 +3219,13 @@ static int lan743x_netdev_open(struct net_device *netdev) if (ret) goto close_intr; - ret = lan743x_phy_open(adapter); + ret = lan743x_phylink_connect(adapter); if (ret) - goto close_mac; + goto close_phylink; ret = lan743x_ptp_open(adapter); if (ret) - goto close_phy; + goto close_phylink; lan743x_rfe_open(adapter); @@ -3162,10 +3266,8 @@ static int lan743x_netdev_open(struct net_device *netdev) } lan743x_ptp_close(adapter); -close_phy: - lan743x_phy_close(adapter); - -close_mac: +close_phylink: + lan743x_phylink_disconnect(adapter); lan743x_mac_close(adapter); close_intr: @@ -3192,11 +3294,14 @@ static netdev_tx_t lan743x_netdev_xmit_frame(struct sk_buff *skb, static int lan743x_netdev_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) { + struct lan743x_adapter *adapter = netdev_priv(netdev); + if (!netif_running(netdev)) return -EINVAL; if (cmd == SIOCSHWTSTAMP) return lan743x_ptp_ioctl(netdev, ifr, cmd); - return phy_mii_ioctl(netdev->phydev, ifr, cmd); + + return phylink_mii_ioctl(adapter->phylink, ifr, cmd); } static void lan743x_netdev_set_multicast(struct net_device *netdev) @@ -3301,10 +3406,17 @@ static void lan743x_mdiobus_cleanup(struct lan743x_adapter *adapter) mdiobus_unregister(adapter->mdiobus); } +static void lan743x_destroy_phylink(struct lan743x_adapter *adapter) +{ + phylink_destroy(adapter->phylink); + adapter->phylink = NULL; +} + static void lan743x_full_cleanup(struct lan743x_adapter *adapter) { unregister_netdev(adapter->netdev); + lan743x_destroy_phylink(adapter); lan743x_mdiobus_cleanup(adapter); lan743x_hardware_cleanup(adapter); lan743x_pci_cleanup(adapter); @@ -3518,14 +3630,21 @@ static int lan743x_pcidev_probe(struct pci_dev *pdev, NETIF_F_HW_CSUM | NETIF_F_RXCSUM; adapter->netdev->hw_features = adapter->netdev->features; - /* carrier off reporting is important to ethtool even BEFORE open */ - netif_carrier_off(netdev); + ret = lan743x_phylink_create(adapter->netdev); + if (ret < 0) { + netif_err(adapter, probe, netdev, + "failed to setup phylink (%d)\n", ret); + goto cleanup_mdiobus; + } ret = register_netdev(adapter->netdev); if (ret < 0) - goto cleanup_mdiobus; + goto cleanup_phylink; return 0; +cleanup_phylink: + lan743x_destroy_phylink(adapter); + cleanup_mdiobus: lan743x_mdiobus_cleanup(adapter); @@ -3709,6 +3828,7 @@ static int lan743x_pm_suspend(struct device *dev) lan743x_pcidev_shutdown(pdev); + rtnl_lock(); /* clear all wakes */ lan743x_csr_write(adapter, MAC_WUCSR, 0); lan743x_csr_write(adapter, MAC_WUCSR2, 0); @@ -3728,6 +3848,7 @@ static int lan743x_pm_suspend(struct device *dev) HW_CFG_RST_PROTECT_); lan743x_csr_write(adapter, HW_CFG, data); } + rtnl_unlock(); /* Host sets PME_En, put D3hot */ return pci_prepare_to_sleep(pdev); @@ -3745,6 +3866,7 @@ static int lan743x_pm_resume(struct device *dev) pci_restore_state(pdev); pci_save_state(pdev); + rtnl_lock(); /* Restore HW_CFG that was saved during pm suspend */ if (adapter->is_pci11x1x) lan743x_csr_write(adapter, HW_CFG, adapter->hw_cfg); @@ -3754,6 +3876,7 @@ static int lan743x_pm_resume(struct device *dev) netif_err(adapter, probe, adapter->netdev, "lan743x_hardware_init returned %d\n", ret); lan743x_pci_cleanup(adapter); + rtnl_unlock(); return ret; } @@ -3789,6 +3912,7 @@ static int lan743x_pm_resume(struct device *dev) lan743x_netdev_open(netdev); netif_device_attach(netdev); + rtnl_unlock(); return 0; } diff --git a/drivers/net/ethernet/microchip/lan743x_main.h b/drivers/net/ethernet/microchip/lan743x_main.h index 3b2585a384e2..7f73d66854be 100644 --- a/drivers/net/ethernet/microchip/lan743x_main.h +++ b/drivers/net/ethernet/microchip/lan743x_main.h @@ -5,6 +5,7 @@ #define _LAN743X_H #include <linux/phy.h> +#include <linux/phylink.h> #include "lan743x_ptp.h" #define DRIVER_AUTHOR "Bryan Whitehead <Bryan.Whitehead@microchip.com>" @@ -1083,6 +1084,8 @@ struct lan743x_adapter { u32 flags; u32 hw_cfg; phy_interface_t phy_interface; + struct phylink *phylink; + struct phylink_config phylink_config; }; #define LAN743X_COMPONENT_FLAG_RX(channel) BIT(20 + (channel)) -- 2.34.1 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH net-next V2 3/4] net: lan743x: Migrate phylib to phylink 2024-07-16 11:33 ` [PATCH net-next V2 3/4] net: lan743x: Migrate phylib to phylink Raju Lakkaraju @ 2024-07-18 3:43 ` Andrew Lunn 2024-07-25 9:34 ` Raju Lakkaraju 2024-07-29 9:16 ` Russell King (Oracle) 1 sibling, 1 reply; 17+ messages in thread From: Andrew Lunn @ 2024-07-18 3:43 UTC (permalink / raw) To: Raju Lakkaraju Cc: netdev, davem, kuba, horms, hkallweit1, richardcochran, rdunlap, linux, bryan.whitehead, edumazet, pabeni, linux-kernel, UNGLinuxDriver On Tue, Jul 16, 2024 at 05:03:48PM +0530, Raju Lakkaraju wrote: > Migrate phy support from phylib to phylink. > Fixed phy support is still used together with phylink since we need to support > dynamic fallback when a phy is not found over mdio. While phylink's FIXED mode > supports fixed phys that, it's dynamic and requires device tree entries which > are most of the time not present for LAN743x devices > +static int lan743x_phylink_connect(struct lan743x_adapter *adapter) > +{ > + struct device_node *dn = adapter->pdev->dev.of_node; > + struct net_device *dev = adapter->netdev; > + struct fixed_phy_status fphy_status = { > + .link = 1, > + .speed = SPEED_1000, > + .duplex = DUPLEX_FULL, > + }; So you are happy to limit it to 1G, even thought it can do more? That is the problem with fixed PHY done this way. If you were to use PHYLINK fixed PHY you can use the full bandwidth of the hardware. You might want to look at what the wangxun drivers do for some ideas how you can make use of PHYLINK fixed link without having DT. Andrew ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH net-next V2 3/4] net: lan743x: Migrate phylib to phylink 2024-07-18 3:43 ` Andrew Lunn @ 2024-07-25 9:34 ` Raju Lakkaraju 0 siblings, 0 replies; 17+ messages in thread From: Raju Lakkaraju @ 2024-07-25 9:34 UTC (permalink / raw) To: Andrew Lunn Cc: Raju Lakkaraju, netdev, davem, kuba, horms, hkallweit1, richardcochran, rdunlap, linux, bryan.whitehead, edumazet, pabeni, linux-kernel, UNGLinuxDriver Hi Andrew, Thank you for review the patches. The 07/18/2024 05:43, Andrew Lunn wrote: > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe > > On Tue, Jul 16, 2024 at 05:03:48PM +0530, Raju Lakkaraju wrote: > > Migrate phy support from phylib to phylink. > > Fixed phy support is still used together with phylink since we need to support > > dynamic fallback when a phy is not found over mdio. While phylink's FIXED mode > > supports fixed phys that, it's dynamic and requires device tree entries which > > are most of the time not present for LAN743x devices > > > +static int lan743x_phylink_connect(struct lan743x_adapter *adapter) > > +{ > > + struct device_node *dn = adapter->pdev->dev.of_node; > > + struct net_device *dev = adapter->netdev; > > + struct fixed_phy_status fphy_status = { > > + .link = 1, > > + .speed = SPEED_1000, > > + .duplex = DUPLEX_FULL, > > + }; > > > So you are happy to limit it to 1G, even thought it can do more? That > is the problem with fixed PHY done this way. If you were to use > PHYLINK fixed PHY you can use the full bandwidth of the hardware. > I accept your comments. Fixed PHY hard coded to 1Gpbs. Currenly, LAN743x chip don't have Device Tree implemented. As part of SFP support, I would like to add software nodes. After SFP support development, I will add "fixed-link" option in software nodes. > You might want to look at what the wangxun drivers do for some ideas > how you can make use of PHYLINK fixed link without having DT. I refer the wangxun drivers for "fixed-link". currently wangxun driver did not implement "fixed-link" in software node. > > Andrew > -- Thanks, Raju ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH net-next V2 3/4] net: lan743x: Migrate phylib to phylink 2024-07-16 11:33 ` [PATCH net-next V2 3/4] net: lan743x: Migrate phylib to phylink Raju Lakkaraju 2024-07-18 3:43 ` Andrew Lunn @ 2024-07-29 9:16 ` Russell King (Oracle) 2024-07-30 10:48 ` Raju Lakkaraju 1 sibling, 1 reply; 17+ messages in thread From: Russell King (Oracle) @ 2024-07-29 9:16 UTC (permalink / raw) To: Raju Lakkaraju Cc: netdev, davem, kuba, andrew, horms, hkallweit1, richardcochran, rdunlap, bryan.whitehead, edumazet, pabeni, linux-kernel, UNGLinuxDriver On Tue, Jul 16, 2024 at 05:03:48PM +0530, Raju Lakkaraju wrote: > +static void lan743x_phylink_mac_link_up(struct phylink_config *config, > + struct phy_device *phydev, > + unsigned int link_an_mode, > + phy_interface_t interface, > + int speed, int duplex, > + bool tx_pause, bool rx_pause) > +{ > + struct net_device *netdev = to_net_dev(config->dev); > + struct lan743x_adapter *adapter = netdev_priv(netdev); > + int mac_cr; > + u8 cap; > + > + mac_cr = lan743x_csr_read(adapter, MAC_CR); > + /* Pre-initialize register bits. > + * Resulting value corresponds to SPEED_10 > + */ > + mac_cr &= ~(MAC_CR_CFG_H_ | MAC_CR_CFG_L_); > + if (speed == SPEED_2500) > + mac_cr |= (MAC_CR_CFG_H_ | MAC_CR_CFG_L_); > + else if (speed == SPEED_1000) > + mac_cr |= (MAC_CR_CFG_H_); > + else if (speed == SPEED_100) > + mac_cr |= (MAC_CR_CFG_L_); These parens in each of these if() sub-blocks is not required. |= operates the same way as = - all such operators are treated the same in C. > + > + lan743x_csr_write(adapter, MAC_CR, mac_cr); > + > + lan743x_ptp_update_latency(adapter, speed); > + > + /* Flow Control operation */ > + cap = 0; > + if (tx_pause) > + cap |= FLOW_CTRL_TX; > + if (rx_pause) > + cap |= FLOW_CTRL_RX; > + > + lan743x_mac_flow_ctrl_set_enables(adapter, > + cap & FLOW_CTRL_TX, > + cap & FLOW_CTRL_RX); > + > + netif_tx_wake_all_queues(to_net_dev(config->dev)); You already have "netdev", so there's no need to do the to_net_dev() dance again here. > +} > + > +static const struct phylink_mac_ops lan743x_phylink_mac_ops = { > + .mac_config = lan743x_phylink_mac_config, > + .mac_link_down = lan743x_phylink_mac_link_down, > + .mac_link_up = lan743x_phylink_mac_link_up, > +}; I guess as there's no PCS support here, you don't support inband mode for 1000base-X (which is rather fundamental for it). > + > +static int lan743x_phylink_create(struct net_device *netdev) > +{ > + struct lan743x_adapter *adapter = netdev_priv(netdev); > + struct phylink *pl; > + > + adapter->phylink_config.dev = &netdev->dev; > + adapter->phylink_config.type = PHYLINK_NETDEV; > + adapter->phylink_config.mac_managed_pm = false; > + > + adapter->phylink_config.mac_capabilities = MAC_ASYM_PAUSE | > + MAC_SYM_PAUSE | MAC_10 | MAC_100 | MAC_1000FD | MAC_2500FD; > + > + lan743x_phy_interface_select(adapter); > + > + switch (adapter->phy_interface) { > + case PHY_INTERFACE_MODE_SGMII: > + __set_bit(PHY_INTERFACE_MODE_SGMII, > + adapter->phylink_config.supported_interfaces); > + __set_bit(PHY_INTERFACE_MODE_1000BASEX, > + adapter->phylink_config.supported_interfaces); > + __set_bit(PHY_INTERFACE_MODE_2500BASEX, > + adapter->phylink_config.supported_interfaces); > + break; > + case PHY_INTERFACE_MODE_GMII: > + __set_bit(PHY_INTERFACE_MODE_GMII, > + adapter->phylink_config.supported_interfaces); > + break; > + case PHY_INTERFACE_MODE_MII: > + __set_bit(PHY_INTERFACE_MODE_MII, > + adapter->phylink_config.supported_interfaces); > + break; > + default: > + __set_bit(PHY_INTERFACE_MODE_RGMII, > + adapter->phylink_config.supported_interfaces); Do you really only support RGMII and not RGMII_ID/RGMII_TXID/RGMII_RXID (which are normally implemented by tweaking the delays at the PHY end of the RGMII link) ? > +static bool lan743x_phy_handle_exists(struct device_node *dn) > +{ > + dn = of_parse_phandle(dn, "phy-handle", 0); > + of_node_put(dn); > + if (IS_ERR(dn)) > + return false; > + > + return true; This likely doesn't work. Have you checked what the return values for of_parse_phandle() actually are before creating this, because to me this looks like you haven't - and thus what you've created is wrong. of_parse_phandle() doesn't return error-pointers when it fails, it returns NULL. Therefore, this will always return true. We have another implementation of something very similar in the macb driver - see macb_phy_handle_exists(), and this one is implemented correctly. > +} > + > +static int lan743x_phylink_connect(struct lan743x_adapter *adapter) > +{ > + struct device_node *dn = adapter->pdev->dev.of_node; > + struct net_device *dev = adapter->netdev; > + struct fixed_phy_status fphy_status = { > + .link = 1, > + .speed = SPEED_1000, > + .duplex = DUPLEX_FULL, > + }; > + struct phy_device *phydev; > + int ret; > + > + if (dn) > + ret = phylink_of_phy_connect(adapter->phylink, dn, 0); > + > + if (!dn || (ret && !lan743x_phy_handle_exists(dn))) { > + phydev = phy_find_first(adapter->mdiobus); > + if (!phydev) { > + if (((adapter->csr.id_rev & ID_REV_ID_MASK_) == > + ID_REV_ID_LAN7431_) || adapter->is_pci11x1x) { > + phydev = fixed_phy_register(PHY_POLL, > + &fphy_status, > + NULL); > + if (IS_ERR(phydev)) { > + netdev_err(dev, "No PHY/fixed_PHY found\n"); > + return PTR_ERR(phydev); > + } Eww. Given that phylink has its own internal fixed-PHY support, can we not find some way to avoid the legacy fixed-PHY usage here? -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last! ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH net-next V2 3/4] net: lan743x: Migrate phylib to phylink 2024-07-29 9:16 ` Russell King (Oracle) @ 2024-07-30 10:48 ` Raju Lakkaraju 2024-07-30 11:29 ` Russell King (Oracle) 0 siblings, 1 reply; 17+ messages in thread From: Raju Lakkaraju @ 2024-07-30 10:48 UTC (permalink / raw) To: Russell King (Oracle) Cc: Raju Lakkaraju, netdev, davem, kuba, andrew, horms, hkallweit1, richardcochran, rdunlap, bryan.whitehead, edumazet, pabeni, linux-kernel, UNGLinuxDriver Hi Russell King, Thank you for review the patches. The 07/29/2024 10:16, Russell King (Oracle) wrote: > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe > > On Tue, Jul 16, 2024 at 05:03:48PM +0530, Raju Lakkaraju wrote: > > +static void lan743x_phylink_mac_link_up(struct phylink_config *config, > > + struct phy_device *phydev, > > + unsigned int link_an_mode, > > + phy_interface_t interface, > > + int speed, int duplex, > > + bool tx_pause, bool rx_pause) > > +{ > > + struct net_device *netdev = to_net_dev(config->dev); > > + struct lan743x_adapter *adapter = netdev_priv(netdev); > > + int mac_cr; > > + u8 cap; > > + > > + mac_cr = lan743x_csr_read(adapter, MAC_CR); > > + /* Pre-initialize register bits. > > + * Resulting value corresponds to SPEED_10 > > + */ > > + mac_cr &= ~(MAC_CR_CFG_H_ | MAC_CR_CFG_L_); > > + if (speed == SPEED_2500) > > + mac_cr |= (MAC_CR_CFG_H_ | MAC_CR_CFG_L_); > > + else if (speed == SPEED_1000) > > + mac_cr |= (MAC_CR_CFG_H_); > > + else if (speed == SPEED_100) > > + mac_cr |= (MAC_CR_CFG_L_); > > These parens in each of these if() sub-blocks is not required. |= > operates the same way as = - all such operators are treated the same > in C. Accpeted. I will fix. > > > + > > + lan743x_csr_write(adapter, MAC_CR, mac_cr); > > + > > + lan743x_ptp_update_latency(adapter, speed); > > + > > + /* Flow Control operation */ > > + cap = 0; > > + if (tx_pause) > > + cap |= FLOW_CTRL_TX; > > + if (rx_pause) > > + cap |= FLOW_CTRL_RX; > > + > > + lan743x_mac_flow_ctrl_set_enables(adapter, > > + cap & FLOW_CTRL_TX, > > + cap & FLOW_CTRL_RX); > > + > > + netif_tx_wake_all_queues(to_net_dev(config->dev)); > > You already have "netdev", so there's no need to do the to_net_dev() > dance again here. Accepted. I will fix > > > +} > > + > > +static const struct phylink_mac_ops lan743x_phylink_mac_ops = { > > + .mac_config = lan743x_phylink_mac_config, > > + .mac_link_down = lan743x_phylink_mac_link_down, > > + .mac_link_up = lan743x_phylink_mac_link_up, > > +}; > > I guess as there's no PCS support here, you don't support inband mode > for 1000base-X (which is rather fundamental for it). > Initially, I add PHYLINK and SFP support changes in one patch series. Due to too many changes, I split in 2 set of patches (i.e. PHYLINK and SFP support). In SFP support patch series, I would like to use Synopsys Designware's XPCS driver as PCS support. Those changes are ready to submit for code review after this patch series accept. Those changes support 2500basex-x, 1000base-x along with SGMII Interfaces. > > + > > +static int lan743x_phylink_create(struct net_device *netdev) > > +{ > > + struct lan743x_adapter *adapter = netdev_priv(netdev); > > + struct phylink *pl; > > + > > + adapter->phylink_config.dev = &netdev->dev; > > + adapter->phylink_config.type = PHYLINK_NETDEV; > > + adapter->phylink_config.mac_managed_pm = false; > > + > > + adapter->phylink_config.mac_capabilities = MAC_ASYM_PAUSE | > > + MAC_SYM_PAUSE | MAC_10 | MAC_100 | MAC_1000FD | MAC_2500FD; > > + > > + lan743x_phy_interface_select(adapter); > > + > > + switch (adapter->phy_interface) { > > + case PHY_INTERFACE_MODE_SGMII: > > + __set_bit(PHY_INTERFACE_MODE_SGMII, > > + adapter->phylink_config.supported_interfaces); > > + __set_bit(PHY_INTERFACE_MODE_1000BASEX, > > + adapter->phylink_config.supported_interfaces); > > + __set_bit(PHY_INTERFACE_MODE_2500BASEX, > > + adapter->phylink_config.supported_interfaces); > > + break; > > + case PHY_INTERFACE_MODE_GMII: > > + __set_bit(PHY_INTERFACE_MODE_GMII, > > + adapter->phylink_config.supported_interfaces); > > + break; > > + case PHY_INTERFACE_MODE_MII: > > + __set_bit(PHY_INTERFACE_MODE_MII, > > + adapter->phylink_config.supported_interfaces); > > + break; > > + default: > > + __set_bit(PHY_INTERFACE_MODE_RGMII, > > + adapter->phylink_config.supported_interfaces); > > Do you really only support RGMII and not RGMII_ID/RGMII_TXID/RGMII_RXID > (which are normally implemented by tweaking the delays at the PHY end > of the RGMII link) ? Accepted. Microchip's KSZ9131 PHY support RGMII_ID/RGMII_TXID/RGMII_RXID. I will fix. > > > +static bool lan743x_phy_handle_exists(struct device_node *dn) > > +{ > > + dn = of_parse_phandle(dn, "phy-handle", 0); > > + of_node_put(dn); > > + if (IS_ERR(dn)) > > + return false; > > + > > + return true; > > This likely doesn't work. Have you checked what the return values for > of_parse_phandle() actually are before creating this, because to me > this looks like you haven't - and thus what you've created is wrong. > of_parse_phandle() doesn't return error-pointers when it fails, it > returns NULL. Therefore, this will always return true. > > We have another implementation of something very similar in the macb > driver - see macb_phy_handle_exists(), and this one is implemented > correctly. Ok. After change, i ran the checkpatch script. it's giving follwoing warning i.e. "CHECK: Comparison to NULL could be written "dn"" Is it OK ? > > > +} > > + > > +static int lan743x_phylink_connect(struct lan743x_adapter *adapter) > > +{ > > + struct device_node *dn = adapter->pdev->dev.of_node; > > + struct net_device *dev = adapter->netdev; > > + struct fixed_phy_status fphy_status = { > > + .link = 1, > > + .speed = SPEED_1000, > > + .duplex = DUPLEX_FULL, > > + }; > > + struct phy_device *phydev; > > + int ret; > > + > > + if (dn) > > + ret = phylink_of_phy_connect(adapter->phylink, dn, 0); > > + > > + if (!dn || (ret && !lan743x_phy_handle_exists(dn))) { > > + phydev = phy_find_first(adapter->mdiobus); > > + if (!phydev) { > > + if (((adapter->csr.id_rev & ID_REV_ID_MASK_) == > > + ID_REV_ID_LAN7431_) || adapter->is_pci11x1x) { > > + phydev = fixed_phy_register(PHY_POLL, > > + &fphy_status, > > + NULL); > > + if (IS_ERR(phydev)) { > > + netdev_err(dev, "No PHY/fixed_PHY found\n"); > > + return PTR_ERR(phydev); > > + } > > Eww. Given that phylink has its own internal fixed-PHY support, can we > not find some way to avoid the legacy fixed-PHY usage here? Yes. I agree with you. This is very much valid suggestion. Andrew also gave same suggestion. Currently we don't have Device Tree support for LAN743X driver. For SFP support, I create the software-node an passing the paramters there. I don't have fixed-PHY hardware setup currently. I would like to take this as action item to fix it after SFP support commits. > > -- > RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ > FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last! -- Thanks, Raju ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH net-next V2 3/4] net: lan743x: Migrate phylib to phylink 2024-07-30 10:48 ` Raju Lakkaraju @ 2024-07-30 11:29 ` Russell King (Oracle) 0 siblings, 0 replies; 17+ messages in thread From: Russell King (Oracle) @ 2024-07-30 11:29 UTC (permalink / raw) To: Raju Lakkaraju Cc: netdev, davem, kuba, andrew, horms, hkallweit1, richardcochran, rdunlap, bryan.whitehead, edumazet, pabeni, linux-kernel, UNGLinuxDriver On Tue, Jul 30, 2024 at 04:18:20PM +0530, Raju Lakkaraju wrote: > Ok. > After change, i ran the checkpatch script. it's giving follwoing warning > i.e. > "CHECK: Comparison to NULL could be written "dn"" > > Is it OK ? Assuming its referring to: return dn != NULL; in a function that returns a bool, I find that utterly perverse, and I suggest in this case ignoring checkpatch. > > > +static int lan743x_phylink_connect(struct lan743x_adapter *adapter) > > > +{ > > > + struct device_node *dn = adapter->pdev->dev.of_node; > > > + struct net_device *dev = adapter->netdev; > > > + struct fixed_phy_status fphy_status = { > > > + .link = 1, > > > + .speed = SPEED_1000, > > > + .duplex = DUPLEX_FULL, > > > + }; > > > + struct phy_device *phydev; > > > + int ret; > > > + > > > + if (dn) > > > + ret = phylink_of_phy_connect(adapter->phylink, dn, 0); > > > + > > > + if (!dn || (ret && !lan743x_phy_handle_exists(dn))) { > > > + phydev = phy_find_first(adapter->mdiobus); > > > + if (!phydev) { > > > + if (((adapter->csr.id_rev & ID_REV_ID_MASK_) == > > > + ID_REV_ID_LAN7431_) || adapter->is_pci11x1x) { > > > + phydev = fixed_phy_register(PHY_POLL, > > > + &fphy_status, > > > + NULL); > > > + if (IS_ERR(phydev)) { > > > + netdev_err(dev, "No PHY/fixed_PHY found\n"); > > > + return PTR_ERR(phydev); > > > + } > > > > Eww. Given that phylink has its own internal fixed-PHY support, can we > > not find some way to avoid the legacy fixed-PHY usage here? > > Yes. I agree with you. This is very much valid suggestion. > Andrew also gave same suggestion. > > Currently we don't have Device Tree support for LAN743X driver. > For SFP support, I create the software-node an passing the paramters there. > > I don't have fixed-PHY hardware setup currently. > I would like to take this as action item to fix it after SFP support commits. Note that SFP shouldn't be using a fixed-phy at all. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last! ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH net-next V2 4/4] net: lan743x: Add support to ethtool phylink get and set settings 2024-07-16 11:33 [PATCH net-next V2 0/4] Add support to PHYLINK for LAN743x/PCI11x1x chips Raju Lakkaraju ` (2 preceding siblings ...) 2024-07-16 11:33 ` [PATCH net-next V2 3/4] net: lan743x: Migrate phylib to phylink Raju Lakkaraju @ 2024-07-16 11:33 ` Raju Lakkaraju 2024-07-16 13:17 ` [PATCH net-next V2 0/4] Add support to PHYLINK for LAN743x/PCI11x1x chips Paolo Abeni ` (2 subsequent siblings) 6 siblings, 0 replies; 17+ messages in thread From: Raju Lakkaraju @ 2024-07-16 11:33 UTC (permalink / raw) To: netdev Cc: davem, kuba, andrew, horms, hkallweit1, richardcochran, rdunlap, linux, bryan.whitehead, edumazet, pabeni, linux-kernel, UNGLinuxDriver Add support to ethtool phylink functions: - get/set settings like speed, duplex etc - get/set the wake-on-lan (WOL) - get/set the energy-efficient ethernet (EEE) - get/set the pause Signed-off-by: Raju Lakkaraju <Raju.Lakkaraju@microchip.com> --- Change List: ============ V1 -> V2: - Fix the phylink changes .../net/ethernet/microchip/lan743x_ethtool.c | 118 ++++++------------ drivers/net/ethernet/microchip/lan743x_main.c | 25 ++++ drivers/net/ethernet/microchip/lan743x_main.h | 4 + 3 files changed, 67 insertions(+), 80 deletions(-) diff --git a/drivers/net/ethernet/microchip/lan743x_ethtool.c b/drivers/net/ethernet/microchip/lan743x_ethtool.c index 3a63ec091413..a649ea7442a4 100644 --- a/drivers/net/ethernet/microchip/lan743x_ethtool.c +++ b/drivers/net/ethernet/microchip/lan743x_ethtool.c @@ -1058,61 +1058,48 @@ static int lan743x_ethtool_get_eee(struct net_device *netdev, struct ethtool_keee *eee) { struct lan743x_adapter *adapter = netdev_priv(netdev); - struct phy_device *phydev = netdev->phydev; - u32 buf; - int ret; - - if (!phydev) - return -EIO; - if (!phydev->drv) { - netif_err(adapter, drv, adapter->netdev, - "Missing PHY Driver\n"); - return -EIO; - } - ret = phy_ethtool_get_eee(phydev, eee); - if (ret < 0) - return ret; - - buf = lan743x_csr_read(adapter, MAC_CR); - if (buf & MAC_CR_EEE_EN_) { - /* EEE_TX_LPI_REQ_DLY & tx_lpi_timer are same uSec unit */ - buf = lan743x_csr_read(adapter, MAC_EEE_TX_LPI_REQ_DLY_CNT); - eee->tx_lpi_timer = buf; - } else { - eee->tx_lpi_timer = 0; - } + eee->tx_lpi_timer = lan743x_csr_read(adapter, + MAC_EEE_TX_LPI_REQ_DLY_CNT); + eee->eee_enabled = adapter->eee_enabled; + eee->eee_active = adapter->eee_active; + eee->tx_lpi_enabled = adapter->tx_lpi_enabled; - return 0; + return phylink_ethtool_get_eee(adapter->phylink, eee); } static int lan743x_ethtool_set_eee(struct net_device *netdev, struct ethtool_keee *eee) { - struct lan743x_adapter *adapter; - struct phy_device *phydev; - u32 buf = 0; + struct lan743x_adapter *adapter = netdev_priv(netdev); - if (!netdev) - return -EINVAL; - adapter = netdev_priv(netdev); - if (!adapter) - return -EINVAL; - phydev = netdev->phydev; - if (!phydev) - return -EIO; - if (!phydev->drv) { - netif_err(adapter, drv, adapter->netdev, - "Missing PHY Driver\n"); - return -EIO; - } + if (eee->tx_lpi_enabled) + lan743x_csr_write(adapter, MAC_EEE_TX_LPI_REQ_DLY_CNT, + eee->tx_lpi_timer); + else + lan743x_csr_write(adapter, MAC_EEE_TX_LPI_REQ_DLY_CNT, 0); - if (eee->eee_enabled) { - buf = (u32)eee->tx_lpi_timer; - lan743x_csr_write(adapter, MAC_EEE_TX_LPI_REQ_DLY_CNT, buf); - } + adapter->eee_enabled = eee->eee_enabled; + adapter->tx_lpi_enabled = eee->tx_lpi_enabled; + lan743x_set_eee(adapter, eee->tx_lpi_enabled && eee->eee_enabled); - return phy_ethtool_set_eee(phydev, eee); + return phylink_ethtool_set_eee(adapter->phylink, eee); +} + +static int lan743x_ethtool_set_link_ksettings(struct net_device *netdev, + const struct ethtool_link_ksettings *cmd) +{ + struct lan743x_adapter *adapter = netdev_priv(netdev); + + return phylink_ethtool_ksettings_set(adapter->phylink, cmd); +} + +static int lan743x_ethtool_get_link_ksettings(struct net_device *netdev, + struct ethtool_link_ksettings *cmd) +{ + struct lan743x_adapter *adapter = netdev_priv(netdev); + + return phylink_ethtool_ksettings_get(adapter->phylink, cmd); } #ifdef CONFIG_PM @@ -1124,8 +1111,7 @@ static void lan743x_ethtool_get_wol(struct net_device *netdev, wol->supported = 0; wol->wolopts = 0; - if (netdev->phydev) - phy_ethtool_get_wol(netdev->phydev, wol); + phylink_ethtool_get_wol(adapter->phylink, wol); if (wol->supported != adapter->phy_wol_supported) netif_warn(adapter, drv, adapter->netdev, @@ -1166,7 +1152,7 @@ static int lan743x_ethtool_set_wol(struct net_device *netdev, !(adapter->phy_wol_supported & WAKE_MAGICSECURE)) phy_wol.wolopts &= ~WAKE_MAGIC; - ret = phy_ethtool_set_wol(netdev->phydev, &phy_wol); + ret = phylink_ethtool_set_wol(adapter->phylink, wol); if (ret && (ret != -EOPNOTSUPP)) return ret; @@ -1355,44 +1341,16 @@ static void lan743x_get_pauseparam(struct net_device *dev, struct ethtool_pauseparam *pause) { struct lan743x_adapter *adapter = netdev_priv(dev); - struct lan743x_phy *phy = &adapter->phy; - if (phy->fc_request_control & FLOW_CTRL_TX) - pause->tx_pause = 1; - if (phy->fc_request_control & FLOW_CTRL_RX) - pause->rx_pause = 1; - pause->autoneg = phy->fc_autoneg; + phylink_ethtool_get_pauseparam(adapter->phylink, pause); } static int lan743x_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam *pause) { struct lan743x_adapter *adapter = netdev_priv(dev); - struct phy_device *phydev = dev->phydev; - struct lan743x_phy *phy = &adapter->phy; - if (!phydev) - return -ENODEV; - - if (!phy_validate_pause(phydev, pause)) - return -EINVAL; - - phy->fc_request_control = 0; - if (pause->rx_pause) - phy->fc_request_control |= FLOW_CTRL_RX; - - if (pause->tx_pause) - phy->fc_request_control |= FLOW_CTRL_TX; - - phy->fc_autoneg = pause->autoneg; - - if (pause->autoneg == AUTONEG_DISABLE) - lan743x_mac_flow_ctrl_set_enables(adapter, pause->tx_pause, - pause->rx_pause); - else - phy_set_asym_pause(phydev, pause->rx_pause, pause->tx_pause); - - return 0; + return phylink_ethtool_set_pauseparam(adapter->phylink, pause); } const struct ethtool_ops lan743x_ethtool_ops = { @@ -1417,8 +1375,8 @@ const struct ethtool_ops lan743x_ethtool_ops = { .get_ts_info = lan743x_ethtool_get_ts_info, .get_eee = lan743x_ethtool_get_eee, .set_eee = lan743x_ethtool_set_eee, - .get_link_ksettings = phy_ethtool_get_link_ksettings, - .set_link_ksettings = phy_ethtool_set_link_ksettings, + .get_link_ksettings = lan743x_ethtool_get_link_ksettings, + .set_link_ksettings = lan743x_ethtool_set_link_ksettings, .get_regs_len = lan743x_get_regs_len, .get_regs = lan743x_get_regs, .get_pauseparam = lan743x_get_pauseparam, diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c index 9f958fb27bd8..40ef64fa7e5f 100644 --- a/drivers/net/ethernet/microchip/lan743x_main.c +++ b/drivers/net/ethernet/microchip/lan743x_main.c @@ -2966,6 +2966,18 @@ static int lan743x_phylink_2500basex_config(struct lan743x_adapter *adapter) return lan743x_pcs_power_reset(adapter); } +void lan743x_set_eee(struct lan743x_adapter *adapter, bool enable) +{ + u32 lpi_ctl1; + + lpi_ctl1 = lan743x_csr_read(adapter, MAC_CR); + if (enable) + lpi_ctl1 |= MAC_CR_EEE_EN_; + else + lpi_ctl1 &= ~MAC_CR_EEE_EN_; + lan743x_csr_write(adapter, MAC_CR, lpi_ctl1); +} + static void lan743x_phylink_mac_config(struct phylink_config *config, unsigned int link_an_mode, const struct phylink_link_state *state) @@ -3013,7 +3025,12 @@ static void lan743x_phylink_mac_link_down(struct phylink_config *config, unsigned int link_an_mode, phy_interface_t interface) { + struct net_device *netdev = to_net_dev(config->dev); + struct lan743x_adapter *adapter = netdev_priv(netdev); + netif_tx_stop_all_queues(to_net_dev(config->dev)); + adapter->eee_active = false; + lan743x_set_eee(adapter, false); } static void lan743x_phylink_mac_link_up(struct phylink_config *config, @@ -3056,6 +3073,14 @@ static void lan743x_phylink_mac_link_up(struct phylink_config *config, cap & FLOW_CTRL_RX); netif_tx_wake_all_queues(to_net_dev(config->dev)); + + if (phydev && adapter->eee_enabled) { + bool enable; + + adapter->eee_active = phy_init_eee(phydev, false) >= 0; + enable = adapter->eee_active && adapter->tx_lpi_enabled; + lan743x_set_eee(adapter, enable); + } } static const struct phylink_mac_ops lan743x_phylink_mac_ops = { diff --git a/drivers/net/ethernet/microchip/lan743x_main.h b/drivers/net/ethernet/microchip/lan743x_main.h index 7f73d66854be..79f21789eb32 100644 --- a/drivers/net/ethernet/microchip/lan743x_main.h +++ b/drivers/net/ethernet/microchip/lan743x_main.h @@ -1086,6 +1086,9 @@ struct lan743x_adapter { phy_interface_t phy_interface; struct phylink *phylink; struct phylink_config phylink_config; + bool eee_enabled; + bool eee_active; + bool tx_lpi_enabled; }; #define LAN743X_COMPONENT_FLAG_RX(channel) BIT(20 + (channel)) @@ -1206,5 +1209,6 @@ void lan743x_hs_syslock_release(struct lan743x_adapter *adapter); void lan743x_mac_flow_ctrl_set_enables(struct lan743x_adapter *adapter, bool tx_enable, bool rx_enable); int lan743x_sgmii_read(struct lan743x_adapter *adapter, u8 mmd, u16 addr); +void lan743x_set_eee(struct lan743x_adapter *adapter, bool enable); #endif /* _LAN743X_H */ -- 2.34.1 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH net-next V2 0/4] Add support to PHYLINK for LAN743x/PCI11x1x chips 2024-07-16 11:33 [PATCH net-next V2 0/4] Add support to PHYLINK for LAN743x/PCI11x1x chips Raju Lakkaraju ` (3 preceding siblings ...) 2024-07-16 11:33 ` [PATCH net-next V2 4/4] net: lan743x: Add support to ethtool phylink get and set settings Raju Lakkaraju @ 2024-07-16 13:17 ` Paolo Abeni 2024-07-16 13:37 ` Jiri Pirko 2024-07-18 3:27 ` Andrew Lunn 6 siblings, 0 replies; 17+ messages in thread From: Paolo Abeni @ 2024-07-16 13:17 UTC (permalink / raw) To: Raju Lakkaraju, netdev Cc: davem, kuba, andrew, horms, hkallweit1, richardcochran, rdunlap, linux, bryan.whitehead, edumazet, linux-kernel, UNGLinuxDriver On 7/16/24 13:33, Raju Lakkaraju wrote: > This is the follow-up patch series of > https://lkml.iu.edu/hypermail/linux/kernel/2310.2/02078.html > > Divide the PHYLINK adaptation and SFP modifications into two separate patch > series. > > The current patch series focuses on transitioning the LAN743x driver's PHY > support from phylib to phylink. > > Tested on chip PCI11010 Rev-B with Bridgeport Evaluation board Rev-1 ## Form letter - net-next-closed The merge window for v6.11 and therefore net-next is closed for new drivers, features, code refactoring and optimizations. We are currently accepting bug fixes only. Please repost when net-next reopens after July 29th. RFC patches sent for review only are obviously welcome at any time. See: https://www.kernel.org/doc/html/next/process/maintainer-netdev.html#development-cycle -- pw-bot: defer ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH net-next V2 0/4] Add support to PHYLINK for LAN743x/PCI11x1x chips 2024-07-16 11:33 [PATCH net-next V2 0/4] Add support to PHYLINK for LAN743x/PCI11x1x chips Raju Lakkaraju ` (4 preceding siblings ...) 2024-07-16 13:17 ` [PATCH net-next V2 0/4] Add support to PHYLINK for LAN743x/PCI11x1x chips Paolo Abeni @ 2024-07-16 13:37 ` Jiri Pirko 2024-07-18 3:27 ` Andrew Lunn 6 siblings, 0 replies; 17+ messages in thread From: Jiri Pirko @ 2024-07-16 13:37 UTC (permalink / raw) To: Raju Lakkaraju Cc: netdev, davem, kuba, andrew, horms, hkallweit1, richardcochran, rdunlap, linux, bryan.whitehead, edumazet, pabeni, linux-kernel, UNGLinuxDriver Tue, Jul 16, 2024 at 01:33:45PM CEST, Raju.Lakkaraju@microchip.com wrote: >This is the follow-up patch series of >https://lkml.iu.edu/hypermail/linux/kernel/2310.2/02078.html > >Divide the PHYLINK adaptation and SFP modifications into two separate patch >series. > >The current patch series focuses on transitioning the LAN743x driver's PHY >support from phylib to phylink. > >Tested on chip PCI11010 Rev-B with Bridgeport Evaluation board Rev-1 > >Change List: >============ >V1 ->V2: > - Fix the Russell King's comments i.e. remove the speed, duplex update in > lan743x_phylink_mac_config( ) > - pre-March 2020 legacy support has been removed > >V0 -> V1: > - Integrate with Synopsys DesignWare XPCS drivers > - Based on external review comments, > - Changes made to SGMII interface support only 1G/100M/10M bps speed > - Changes made to 2500Base-X interface support only 2.5Gbps speed > - Add check for not is_sgmii_en with is_sfp_support_en support > - Change the "pci11x1x_strap_get_status" function return type from void to > int > - Add ethtool phylink wol, eee, pause get/set functions Net-next is closed. Please repost once it opens again. > > >Raju Lakkaraju (4): > net: lan743x: Create separate PCS power reset function > net: lan743x: Create separate Link Speed Duplex state function > net: lan743x: Migrate phylib to phylink > net: lan743x: Add support to ethtool phylink get and set settings > > drivers/net/ethernet/microchip/Kconfig | 5 +- > .../net/ethernet/microchip/lan743x_ethtool.c | 118 +--- > drivers/net/ethernet/microchip/lan743x_main.c | 657 +++++++++++------- > drivers/net/ethernet/microchip/lan743x_main.h | 7 + > 4 files changed, 460 insertions(+), 327 deletions(-) > >-- >2.34.1 > > ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH net-next V2 0/4] Add support to PHYLINK for LAN743x/PCI11x1x chips 2024-07-16 11:33 [PATCH net-next V2 0/4] Add support to PHYLINK for LAN743x/PCI11x1x chips Raju Lakkaraju ` (5 preceding siblings ...) 2024-07-16 13:37 ` Jiri Pirko @ 2024-07-18 3:27 ` Andrew Lunn 2024-07-18 5:08 ` Raju Lakkaraju 6 siblings, 1 reply; 17+ messages in thread From: Andrew Lunn @ 2024-07-18 3:27 UTC (permalink / raw) To: Raju Lakkaraju Cc: netdev, davem, kuba, horms, hkallweit1, richardcochran, rdunlap, linux, bryan.whitehead, edumazet, pabeni, linux-kernel, UNGLinuxDriver On Tue, Jul 16, 2024 at 05:03:45PM +0530, Raju Lakkaraju wrote: > This is the follow-up patch series of > https://lkml.iu.edu/hypermail/linux/kernel/2310.2/02078.html > > Divide the PHYLINK adaptation and SFP modifications into two separate patch > series. You appear to be missing the PHYLINK maintainer in your Cc: list. Andrew ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH net-next V2 0/4] Add support to PHYLINK for LAN743x/PCI11x1x chips 2024-07-18 3:27 ` Andrew Lunn @ 2024-07-18 5:08 ` Raju Lakkaraju 2024-07-18 15:09 ` Andrew Lunn 0 siblings, 1 reply; 17+ messages in thread From: Raju Lakkaraju @ 2024-07-18 5:08 UTC (permalink / raw) To: Andrew Lunn Cc: Raju Lakkaraju, netdev, davem, kuba, horms, hkallweit1, richardcochran, rdunlap, linux, bryan.whitehead, edumazet, pabeni, linux-kernel, UNGLinuxDriver Hi Andrew, Thank you for review the patches. The 07/18/2024 05:27, Andrew Lunn wrote: > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe > > On Tue, Jul 16, 2024 at 05:03:45PM +0530, Raju Lakkaraju wrote: > > This is the follow-up patch series of > > https://lkml.iu.edu/hypermail/linux/kernel/2310.2/02078.html > > > > Divide the PHYLINK adaptation and SFP modifications into two separate patch > > series. > > You appear to be missing the PHYLINK maintainer in your Cc: list. > I add all PHYLINK maintainers email id's in cc i.e. $ ./scripts/get_maintainer.pl drivers/net/phy/phylink.c Russell King <linux@armlinux.org.uk> (maintainer:SFF/SFP/SFP+ MODULE SUPPORT) Andrew Lunn <andrew@lunn.ch> (maintainer:ETHERNET PHY LIBRARY) Heiner Kallweit <hkallweit1@gmail.com> (maintainer:ETHERNET PHY LIBRARY) "David S. Miller" <davem@davemloft.net> (maintainer:NETWORKING DRIVERS) Eric Dumazet <edumazet@google.com> (maintainer:NETWORKING DRIVERS) Jakub Kicinski <kuba@kernel.org> (maintainer:NETWORKING DRIVERS) Paolo Abeni <pabeni@redhat.com> (maintainer:NETWORKING DRIVERS) netdev@vger.kernel.org (open list:SFF/SFP/SFP+ MODULE SUPPORT) linux-kernel@vger.kernel.org (open list) Do i need to add any more PHY maintainer id's apart from above list ? > Andrew -- Thanks, Raju ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH net-next V2 0/4] Add support to PHYLINK for LAN743x/PCI11x1x chips 2024-07-18 5:08 ` Raju Lakkaraju @ 2024-07-18 15:09 ` Andrew Lunn 0 siblings, 0 replies; 17+ messages in thread From: Andrew Lunn @ 2024-07-18 15:09 UTC (permalink / raw) To: Raju Lakkaraju Cc: netdev, davem, kuba, horms, hkallweit1, richardcochran, rdunlap, linux, bryan.whitehead, edumazet, pabeni, linux-kernel, UNGLinuxDriver On Thu, Jul 18, 2024 at 10:38:52AM +0530, Raju Lakkaraju wrote: > Hi Andrew, > > Thank you for review the patches. > > The 07/18/2024 05:27, Andrew Lunn wrote: > > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe > > > > On Tue, Jul 16, 2024 at 05:03:45PM +0530, Raju Lakkaraju wrote: > > > This is the follow-up patch series of > > > https://lkml.iu.edu/hypermail/linux/kernel/2310.2/02078.html > > > > > > Divide the PHYLINK adaptation and SFP modifications into two separate patch > > > series. > > > > You appear to be missing the PHYLINK maintainer in your Cc: list. > > > I add all PHYLINK maintainers email id's in cc > > i.e. > $ ./scripts/get_maintainer.pl drivers/net/phy/phylink.c > Russell King <linux@armlinux.org.uk> (maintainer:SFF/SFP/SFP+ MODULE SUPPORT) Yes, sorry, Russell is on the list. My error. richardcochran@gmail.com is a bit odd, is PTP involved here? Andrew ^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2024-07-30 11:29 UTC | newest] Thread overview: 17+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-07-16 11:33 [PATCH net-next V2 0/4] Add support to PHYLINK for LAN743x/PCI11x1x chips Raju Lakkaraju 2024-07-16 11:33 ` [PATCH net-next V2 1/4] net: lan743x: Create separate PCS power reset function Raju Lakkaraju 2024-07-18 3:30 ` Andrew Lunn 2024-07-16 11:33 ` [PATCH net-next V2 2/4] net: lan743x: Create separate Link Speed Duplex state function Raju Lakkaraju 2024-07-18 3:33 ` Andrew Lunn 2024-07-16 11:33 ` [PATCH net-next V2 3/4] net: lan743x: Migrate phylib to phylink Raju Lakkaraju 2024-07-18 3:43 ` Andrew Lunn 2024-07-25 9:34 ` Raju Lakkaraju 2024-07-29 9:16 ` Russell King (Oracle) 2024-07-30 10:48 ` Raju Lakkaraju 2024-07-30 11:29 ` Russell King (Oracle) 2024-07-16 11:33 ` [PATCH net-next V2 4/4] net: lan743x: Add support to ethtool phylink get and set settings Raju Lakkaraju 2024-07-16 13:17 ` [PATCH net-next V2 0/4] Add support to PHYLINK for LAN743x/PCI11x1x chips Paolo Abeni 2024-07-16 13:37 ` Jiri Pirko 2024-07-18 3:27 ` Andrew Lunn 2024-07-18 5:08 ` Raju Lakkaraju 2024-07-18 15:09 ` Andrew Lunn
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).