net: stmmac: enable EHL SGMI
Subsystems (5)
v5 cover net: stmmac: enable EHL SGMI
This patch-set is to enable Ethernet controller
(DW Ethernet QoS and DW Ethernet PCS) with SGMII interface in Elkhart Lake. The DW Ethernet PCS is the Physical Coding Sublayer that is between Ethernet MAC and PHY and uses MDIO Clause-45 as Communication.
Kweh Hock Leong (1):
net: stmmac: enable clause 45 mdio support
Ong Boon Leong (3):
net: stmmac: introducing support for DWC xPCS logics
net: stmmac: add xpcs function hooks into main driver and ethtool
net: stmmac: add xPCS functions for device with DWMACv5.1
Voon Weifeng (1):
net: stmmac: add EHL SGMII 1Gbps PCI info and PCI ID
drivers/net/ethernet/stmicro/stmmac/Makefile | 2 +- drivers/net/ethernet/stmicro/stmmac/common.h | 1 + drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 33 ++++ drivers/net/ethernet/stmicro/stmmac/dwxpcs.c | 198 +++++++++++++++++++++ drivers/net/ethernet/stmicro/stmmac/dwxpcs.h | 51 ++++++ drivers/net/ethernet/stmicro/stmmac/hwif.c | 42 ++++- drivers/net/ethernet/stmicro/stmmac/hwif.h | 21 +++ drivers/net/ethernet/stmicro/stmmac/stmmac.h | 2 + .../net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 50 ++++-- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 140 +++++++++++---- drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 40 ++++- drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c | 111 ++++++++++++ include/linux/phy.h | 2 + include/linux/stmmac.h | 3 + 14 files changed, 638 insertions(+), 58 deletions(-) create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwxpcs.c create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwxpcs.h
Signature · 16 lines
Changelog v5: *Cosmetic touch up *Change axi_wr_osr_lmt and axi_rd_osr_lmt value to 1 since the register has a default value of 1 Changelog v4: *Rebased to latest net-next Changelog v3: *Applied reversed christmas tree Changelog v2: *Added support for the C37 AN for 1000BASE-X and SGMII (MAC side SGMII only) *removed and submitted the fix patch to net "net: stmmac: dma channel control register need to be init first" *Squash the following 2 patches and move it to the end of the patch set: "net: stmmac: add EHL SGMII 1Gbps platform data and PCI ID" "net: stmmac: add xPCS platform data for EHL" 1.9.1
PATCH v5 1/5 net: stmmac: enable clause 45 mdio support
From: Kweh Hock Leong <[email protected]>
DWMAC4 is capable to support clause 45 mdio communication. This patch enable the feature on stmmac_mdio_write() and stmmac_mdio_read() by following phy_write_mmd() and phy_read_mmd() mdiobus read write implementation format.
--- drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 40 ++++++++++++++++++----- include/linux/phy.h | 2 ++ 2 files changed, 34 insertions(+), 8 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c +32 -8
@@ -34,11 +34,27 @@#define MII_BUSY 0x00000001#define MII_WRITE 0x00000002 +#define MII_DATA_MASK GENMASK(15, 0)/* GMAC4 defines */ #define MII_GMAC4_GOC_SHIFT 2 +#define MII_GMAC4_REG_ADDR_SHIFT 16#define MII_GMAC4_WRITE (1 << MII_GMAC4_GOC_SHIFT)#define MII_GMAC4_READ (3 << MII_GMAC4_GOC_SHIFT) +#define MII_GMAC4_C45E BIT(1) + +static void stmmac_mdio_c45_setup (struct stmmac_priv *priv,int phyreg, +u32 *val,u32 *data) +{ +unsigned int reg_shift = priv->hw->mii.reg_shift; +unsigned int reg_mask = priv->hw->mii.reg_mask; + + *val |=MII_GMAC4_C45E ; + *val &= ~reg_mask; + *val |= ((phyreg >>MII_DEVADDR_C45_SHIFT ) << reg_shift) & reg_mask; + + *data |= (phyreg &MII_REGADDR_C45_MASK ) <<MII_GMAC4_REG_ADDR_SHIFT ; +}/* XGMAC defines */ #define MII_XGMAC_SADDR BIT(18)
@@ -165,22 +181,26 @@ static int stmmac_mdio_read(struct mii_bus *bus, int phyaddr, int phyreg)struct stmmac_priv *priv =netdev_priv (ndev);unsigned int mii_address = priv->hw->mii.addr;unsigned int mii_data = priv->hw->mii.data; -u32 v; -int data;u32 value =MII_BUSY ; +int data =0 ; +u32 v; value |= (phyaddr << priv->hw->mii.addr_shift) & priv->hw->mii.addr_mask; value |= (phyreg << priv->hw->mii.reg_shift) & priv->hw->mii.reg_mask; value |= (priv->clk_csr << priv->hw->mii.clk_csr_shift) & priv->hw->mii.clk_csr_mask; -if (priv->plat->has_gmac4) +if (priv->plat->has_gmac4) { value |=MII_GMAC4_READ ; +if (phyreg &MII_ADDR_C45 ) +stmmac_mdio_c45_setup (priv, phyreg, &value, &data); + }if (readl_poll_timeout (priv->ioaddr + mii_address, v, !(v &MII_BUSY ),100 ,10000 ))return -EBUSY ; +writel (data, priv->ioaddr + mii_data);writel (value, priv->ioaddr + mii_address); if (readl_poll_timeout(priv->ioaddr + mii_address, v, !(v & MII_BUSY),
@@ -188,7 +208,7 @@ static int stmmac_mdio_read(struct mii_bus *bus, int phyaddr, int phyreg)return -EBUSY ;/* Read the data from the MII data register */ - data = (int )readl (priv->ioaddr + mii_data); + data = (int )readl (priv->ioaddr + mii_data) &MII_DATA_MASK ;return data; }
@@ -208,8 +228,9 @@ static int stmmac_mdio_write(struct mii_bus *bus, int phyaddr, int phyreg,struct stmmac_priv *priv =netdev_priv (ndev);unsigned int mii_address = priv->hw->mii.addr;unsigned int mii_data = priv->hw->mii.data; -u32 v;u32 value =MII_BUSY ; +int data = phydata; +u32 v; value |= (phyaddr << priv->hw->mii.addr_shift) & priv->hw->mii.addr_mask;
@@ -217,10 +238,13 @@ static int stmmac_mdio_write(struct mii_bus *bus, int phyaddr, int phyreg, value |= (priv->clk_csr << priv->hw->mii.clk_csr_shift) & priv->hw->mii.clk_csr_mask; -if (priv->plat->has_gmac4) +if (priv->plat->has_gmac4) { value |=MII_GMAC4_WRITE ; -else +if (phyreg &MII_ADDR_C45 ) +stmmac_mdio_c45_setup (priv, phyreg, &value, &data); + }else { value |=MII_WRITE ; + }/* Wait until any existing MII operation is complete */ if (readl_poll_timeout(priv->ioaddr + mii_address, v, !(v & MII_BUSY),
@@ -228,7 +252,7 @@ static int stmmac_mdio_write(struct mii_bus *bus, int phyaddr, int phyreg,return -EBUSY ;/* Set the MII address register to write */ -writel (phydata, priv->ioaddr + mii_data); +writel (data, priv->ioaddr + mii_data);writel (value, priv->ioaddr + mii_address);/* Wait until any existing MII operation is complete */
include/linux/phy.h +2 -0
@@ -200,6 +200,8 @@ static inline const char *phy_modes(phy_interface_t interface)/* Or MII_ADDR_C45 into regnum for read/write on mii_bus to enable the 21 bit IEEE 802.3ae clause 45 addressing mode used by 10GIGE phy chips. */ #define MII_ADDR_C45 (1<<30) +#define MII_DEVADDR_C45_SHIFT 16 +#define MII_REGADDR_C45_MASK GENMASK(15, 0)struct device ;struct phylink ;
Signature · 1 line
1.9.1
Re: [PATCH net-next v5 1/5] net: stmmac: enable clause 45 mdio support
Quoted 11 lines · Voon Weifeng
From: Kweh Hock Leong <[email protected]>
DWMAC4 is capable to support clause 45 mdio communication. This patch enable the feature on
stmmac_mdio_write()andstmmac_mdio_read()by followingphy_write_mmd()andphy_read_mmd()mdiobus read write implementation format.Reviewed-by Li, Yifan <[email protected]>Signed-off-by Kweh Hock Leong <[email protected]>Signed-off-by Ong Boon Leong <[email protected]>Signed-off-by Weifeng Voon <[email protected]>
Andrew
PATCH v5 2/5 net: stmmac: introducing support for DWC xPCS logics
In reply to Voon WeifengFrom: Ong Boon Leong <[email protected]>
xPCS is DWC Ethernet Physical Coding Sublayer that may be integrated into a GbE controller that uses DWC EQoS MAC controller. An example of HW configuration is shown below:-
<-----------------GBE Controller---------->|<--External PHY chip-->
+----------+ +----+ +---+ +--------------+
| EQoS | <-GMII->| DW |<-->|PHY| <-- SGMII --> | External GbE |
| MAC | |xPCS| |IF | | PHY Chip |
+----------+ +----+ +---+ +--------------+
^ ^ ^
| | |
+---------------------MDIO-------------------------+xPCS is a Clause-45 MDIO Manageable Device (MMD) and we need a way to differentiate it from external PHY chip that is discovered over MDIO. Therefore, xpcs_phy_addr is introduced in stmmac platform data (plat_stmmacenet_data) for differentiating xPCS from 'phy_addr' that belongs to external PHY.
Basic functionalities for initializing xPCS and configuring auto negotiation (AN), loopback, link status, AN advertisement and Link Partner ability are implemented. The implementation supports the C37 AN for 1000BASE-X and SGMII (MAC side SGMII only).
--- drivers/net/ethernet/stmicro/stmmac/Makefile | 2 +- drivers/net/ethernet/stmicro/stmmac/common.h | 1 + drivers/net/ethernet/stmicro/stmmac/dwxpcs.c | 198 +++++++++++++++++++++++++++ drivers/net/ethernet/stmicro/stmmac/dwxpcs.h | 51 +++++++ drivers/net/ethernet/stmicro/stmmac/hwif.h | 19 +++ include/linux/stmmac.h | 1 + 6 files changed, 271 insertions(+), 1 deletion(-) create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwxpcs.c create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwxpcs.h
drivers/net/ethernet/stmicro/stmmac/Makefile +1 -1
@@ -6,7 +6,7 @@ stmmac-objs:= stmmac_main.o stmmac_ethtool.o stmmac_mdio.o ring_mode.o \ mmc_core.o stmmac_hwtstamp.o stmmac_ptp.o dwmac4_descs.o \ dwmac4_dma.o dwmac4_lib.o dwmac4_core.o dwmac5.o hwif.o \ stmmac_tc.o dwxgmac2_core.o dwxgmac2_dma.o dwxgmac2_descs.o \ - $(stmmac-y) + dwxpcs.o $(stmmac-y) stmmac-$(CONFIG_STMMAC_SELFTESTS) += stmmac_selftests.o
drivers/net/ethernet/stmicro/stmmac/common.h +1 -0
@@ -419,6 +419,7 @@ struct mii_regs {struct mac_device_info {const struct stmmac_ops *mac; +const struct stmmac_xpcs_ops *xpcs;const struct stmmac_desc_ops *desc;const struct stmmac_dma_ops *dma;const struct stmmac_mode_ops *mode;
drivers/net/ethernet/stmicro/stmmac/dwxpcs.c new file +198 -0
198 lines not on this page · raw message
drivers/net/ethernet/stmicro/stmmac/dwxpcs.h new file +51 -0
51 lines not on this page · raw message
drivers/net/ethernet/stmicro/stmmac/hwif.h +19 -0
@@ -398,6 +398,25 @@ struct stmmac_ops { #define stmmac_set_mac_loopback(__priv, __args...) \ stmmac_do_void_callback(__priv, mac, set_mac_loopback, __args) +/* Helpers for DW xPCS */ +struct stmmac_xpcs_ops { +void (*xpcs_init)(struct net_device *ndev,int pcs_mode); +void (*xpcs_ctrl_ane)(struct net_device *ndev,bool ane,bool loopback); +void (*xpcs_get_adv_lp)(struct net_device *ndev,struct rgmii_adv *adv, +int pcs_mode); +int (*xpcs_irq_status)(struct net_device *ndev, +struct stmmac_extra_stats *x,int pcs_mode); +}; + +#define stmmac_xpcs_init(__priv, __args...) \ + stmmac_do_void_callback(__priv, xpcs, xpcs_init, __args) +#define stmmac_xpcs_ctrl_ane(__priv, __args...) \ + stmmac_do_void_callback(__priv, xpcs, xpcs_ctrl_ane, __args) +#define stmmac_xpcs_get_adv_lp(__priv, __args...) \ + stmmac_do_void_callback(__priv, xpcs, xpcs_get_adv_lp, __args) +#define stmmac_xpcs_irq_status(__priv, __args...) \ + stmmac_do_callback(__priv, xpcs, xpcs_irq_status, __args) +/* PTP and HW Timer helpers */ struct stmmac_hwtimestamp {void (*config_hw_tstamping) (void __iomem *ioaddr,u32 data);
include/linux/stmmac.h +1 -0
@@ -148,6 +148,7 @@ struct stmmac_txq_cfg {struct plat_stmmacenet_data {int bus_id;int phy_addr; +int xpcs_phy_addr;int interface;struct stmmac_mdio_bus_data *mdio_bus_data;struct device_node *phy_node;
Signature · 1 line
1.9.1
David Miller
maintainerRe: [PATCH net-next v5 2/5] net: stmmac: introducing support for DWC xPCS logics
From: Voon Weifeng <[email protected]>
Date: Sat, 1 Jun 2019 03:58:11 +0800
drivers/net/ethernet/stmicro/stmmac/dwxpcs.c line 24
Quoted 5 lines
drivers/net/ethernet/stmicro/stmmac/dwxpcs.c new file +5
-0+static void dw_xpcs_init (struct net_device *ndev,int pcs_mode) +{ +struct stmmac_priv *priv =netdev_priv (ndev); +int xpcs_phy_addr = priv->plat->xpcs_phy_addr; +int phydata;
Reverse christmas tree please. Put the assignments onto separate lines if necessary.
drivers/net/ethernet/stmicro/stmmac/dwxpcs.c line 86
Quoted 7 lines
drivers/net/ethernet/stmicro/stmmac/dwxpcs.c new file +7
-0+static void dw_xpcs_ctrl_ane (struct net_device *ndev,bool ane, +bool loopback) +{ +struct stmmac_priv *priv =netdev_priv (ndev); +int xpcs_phy_addr = priv->plat->xpcs_phy_addr; + +int phydata =xpcs_read (XPCS_MDIO_MII_MMD ,MII_BMCR );
Please don't break up the local variable declarations like this, and also reverse christmas tree.
drivers/net/ethernet/stmicro/stmmac/dwxpcs.c line 105
Quoted 9 lines
drivers/net/ethernet/stmicro/stmmac/dwxpcs.c new file +9
-0+static void dw_xpcs_get_adv_lp (struct net_device *ndev, +struct rgmii_adv *adv_lp, +int pcs_mode) +{ +struct stmmac_priv *priv =netdev_priv (ndev); +int xpcs_phy_addr = priv->plat->xpcs_phy_addr; + +/* AN Advertisement Ability */ +int value =xpcs_read (XPCS_MDIO_MII_MMD ,MII_ADVERTISE );
Likewise.
drivers/net/ethernet/stmicro/stmmac/dwxpcs.c line 167
Quoted 10 lines
drivers/net/ethernet/stmicro/stmmac/dwxpcs.c new file +10
-0+static int dw_xpcs_irq_status (struct net_device *ndev, +struct stmmac_extra_stats *x, +int pcs_mode) +{ +struct stmmac_priv *priv =netdev_priv (ndev); +int xpcs_phy_addr = priv->plat->xpcs_phy_addr; +int ret =IRQ_NONE ; + +/* AN status */ +int an_stat =xpcs_read (XPCS_MDIO_MII_MMD ,MDIO_MII_MMD_AN_STAT );
Likewise.
PATCH v5 3/5 net: stmmac: add xpcs function hooks into main driver and ethtool
In reply to Voon WeifengFrom: Ong Boon Leong <[email protected]>
With xPCS functions now ready, we add them into the main driver and ethtool logics. To differentiate from EQoS MAC PCS and DWC Ethernet xPCS, we introduce 'has_xpcs' in platform data as a mean to indicate whether GBE controller includes xPCS or not.
To support platform-specific C37 AN PCS mode selection for MII MMD, we introduce 'pcs_mode' in platform data.
The basic framework for xPCS interrupt handling is implemented too.
--- drivers/net/ethernet/stmicro/stmmac/stmmac.h | 2 + .../net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 50 ++++++-- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 140 +++++++++++++++------ include/linux/stmmac.h | 2 + 4 files changed, 146 insertions(+), 48 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac.h +2 -0
@@ -36,6 +36,7 @@ struct stmmac_resources {const char *mac;int wol_irq;int lpi_irq; +int xpcs_irq;int irq; };
@@ -168,6 +169,7 @@ struct stmmac_priv {int clk_csr;struct timer_list eee_ctrl_timer;int lpi_irq; +int xpcs_irq;int eee_enabled;int eee_active;int tx_lpi_timer;
drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c +39 -11
92 lines not on this page · raw message
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +103 -37
197 lines not on this page · raw message
include/linux/stmmac.h +2 -0
@@ -189,6 +189,8 @@ struct plat_stmmacenet_data {struct reset_control *stmmac_rst;struct stmmac_axi *axi;int has_gmac4; +bool has_xpcs; +int pcs_mode;bool has_sun8i;bool tso_en;int mac_port_sel_speed;
Signature · 1 line
1.9.1
David Miller
maintainerRe: [PATCH net-next v5 3/5] net: stmmac: add xpcs function hooks into main driver and ethtool
From: Voon Weifeng <[email protected]>
Date: Sat, 1 Jun 2019 03:58:12 +0800
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c static void stmmac_mac_flow_ctrl(struct stmmac_priv *priv, u32 duplex) · line 857
Quoted 6 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +6
-0+static bool mac_adjust_link (struct stmmac_priv *priv, +int *speed,int *duplex) +{ +bool new_state = false; + +u32 ctrl =readl (priv->ioaddr +MAC_CTRL_REG );
Again please don't break up the local variable declarations like this.
PATCH v5 4/5 net: stmmac: add xPCS functions for device with DWMACv5.1
In reply to Voon WeifengFrom: Ong Boon Leong <[email protected]>
We introduce support for driver that has v5.10 IP and is also using xPCS as MMD. This can be easily enabled for other product that integrates xPCS that is not using v5.00 IP.
--- drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 33 ++++++++++++++++++ drivers/net/ethernet/stmicro/stmmac/hwif.c | 42 ++++++++++++++++++++++- drivers/net/ethernet/stmicro/stmmac/hwif.h | 2 ++ 3 files changed, 76 insertions(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c +33 -0
@@ -824,6 +824,39 @@ static void dwmac4_set_mac_loopback(void __iomem *ioaddr, bool enable) .set_mac_loopback = dwmac4_set_mac_loopback, }; +const struct stmmac_ops dwmac510_xpcs_ops = { + .core_init = dwmac4_core_init, + .set_mac = stmmac_dwmac4_set_mac, + .rx_ipc = dwmac4_rx_ipc_enable, + .rx_queue_enable = dwmac4_rx_queue_enable, + .rx_queue_prio = dwmac4_rx_queue_priority, + .tx_queue_prio = dwmac4_tx_queue_priority, + .rx_queue_routing = dwmac4_rx_queue_routing, + .prog_mtl_rx_algorithms = dwmac4_prog_mtl_rx_algorithms, + .prog_mtl_tx_algorithms = dwmac4_prog_mtl_tx_algorithms, + .set_mtl_tx_queue_weight = dwmac4_set_mtl_tx_queue_weight, + .map_mtl_to_dma = dwmac4_map_mtl_dma, + .config_cbs = dwmac4_config_cbs, + .dump_regs = dwmac4_dump_regs, + .host_irq_status = dwmac4_irq_status, + .host_mtl_irq_status = dwmac4_irq_mtl_status, + .flow_ctrl = dwmac4_flow_ctrl, + .pmt = dwmac4_pmt, + .set_umac_addr = dwmac4_set_umac_addr, + .get_umac_addr = dwmac4_get_umac_addr, + .set_eee_mode = dwmac4_set_eee_mode, + .reset_eee_mode = dwmac4_reset_eee_mode, + .set_eee_timer = dwmac4_set_eee_timer, + .set_eee_pls = dwmac4_set_eee_pls, + .debug = dwmac4_debug, + .set_filter = dwmac4_set_filter, + .safety_feat_config = dwmac5_safety_feat_config, + .safety_feat_irq_status = dwmac5_safety_feat_irq_status, + .safety_feat_dump = dwmac5_safety_feat_dump, + .rxp_config = dwmac5_rxp_config, + .flex_pps_config = dwmac5_flex_pps_config, +}; +int dwmac4_setup (struct stmmac_priv *priv) {struct mac_device_info *mac = priv->hw;
drivers/net/ethernet/stmicro/stmmac/hwif.c +41 -1
161 lines not on this page · raw message
drivers/net/ethernet/stmicro/stmmac/hwif.h +2 -0
@@ -509,6 +509,7 @@ struct stmmac_regs_off { };extern const struct stmmac_ops dwmac100_ops; +extern const struct stmmac_xpcs_ops xpcs_ops;extern const struct stmmac_dma_ops dwmac100_dma_ops;extern const struct stmmac_ops dwmac1000_ops;extern const struct stmmac_dma_ops dwmac1000_dma_ops;
@@ -517,6 +518,7 @@ struct stmmac_regs_off {extern const struct stmmac_ops dwmac410_ops;extern const struct stmmac_dma_ops dwmac410_dma_ops;extern const struct stmmac_ops dwmac510_ops; +extern const struct stmmac_ops dwmac510_xpcs_ops;extern const struct stmmac_tc_ops dwmac510_tc_ops;extern const struct stmmac_ops dwxgmac210_ops;extern const struct stmmac_dma_ops dwxgmac210_dma_ops;
Signature · 1 line
1.9.1
PATCH v5 5/5 net: stmmac: add EHL SGMII 1Gbps PCI info and PCI ID
In reply to Voon WeifengAdded EHL SGMII 1Gbps PCI ID. Different MII and speed will have different PCI ID.
--- drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c | 111 +++++++++++++++++++++++ 1 file changed, 111 insertions(+)
drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c +111 -0
@@ -23,6 +23,7 @@#include <linux/dmi.h> #include "stmmac.h" +#include "dwxpcs.h" /* * This struct is used to associate PCI Function of MAC controller on a board,
@@ -118,6 +119,113 @@ static int stmmac_default_data(struct pci_dev *pdev, .setup = stmmac_default_data, }; +static int ehl_common_data (struct pci_dev *pdev, +struct plat_stmmacenet_data *plat) +{ +int i; + + plat->bus_id =1 ; + plat->phy_addr =0 ; + plat->clk_csr =5 ; + plat->has_gmac =0 ; + plat->has_gmac4 =1 ; + plat->xpcs_phy_addr =0x16 ; + plat->pcs_mode =AN_CTRL_PCS_MD_C37_SGMII ; + plat->force_sf_dma_mode =0 ; + plat->tso_en =1 ; + + plat->rx_queues_to_use =8 ; + plat->tx_queues_to_use =8 ; + plat->rx_sched_algorithm =MTL_RX_ALGORITHM_SP ; + +for (i =0 ; i < plat->rx_queues_to_use; i++) { + plat->rx_queues_cfg[i].mode_to_use =MTL_QUEUE_DCB ; + plat->rx_queues_cfg[i].chan = i; + +/* Disable Priority config by default */ + plat->rx_queues_cfg[i].use_prio = false; + +/* Disable RX queues routing by default */ + plat->rx_queues_cfg[i].pkt_route =0x0 ; + } + +for (i =0 ; i < plat->tx_queues_to_use; i++) { + plat->tx_queues_cfg[i].mode_to_use =MTL_QUEUE_DCB ; + +/* Disable Priority config by default */ + plat->tx_queues_cfg[i].use_prio = false; + } + + plat->tx_sched_algorithm =MTL_TX_ALGORITHM_WRR ; + plat->tx_queues_cfg[0 ].weight =0x09 ; + plat->tx_queues_cfg[1 ].weight =0x0A ; + plat->tx_queues_cfg[2 ].weight =0x0B ; + plat->tx_queues_cfg[3 ].weight =0x0C ; + plat->tx_queues_cfg[4 ].weight =0x0D ; + plat->tx_queues_cfg[5 ].weight =0x0E ; + plat->tx_queues_cfg[6 ].weight =0x0F ; + plat->tx_queues_cfg[7 ].weight =0x10 ; + + plat->mdio_bus_data->phy_reset =NULL ; + plat->mdio_bus_data->phy_mask =0 ; + + plat->dma_cfg->pbl =32 ; + plat->dma_cfg->pblx8 = true; + plat->dma_cfg->fixed_burst =0 ; + plat->dma_cfg->mixed_burst =0 ; + plat->dma_cfg->aal =0 ; + + plat->axi =devm_kzalloc (&pdev->dev,sizeof (*plat->axi), +GFP_KERNEL ); +if (!plat->axi) +return -ENOMEM ; + + plat->axi->axi_lpi_en =0 ; + plat->axi->axi_xit_frm =0 ; + plat->axi->axi_wr_osr_lmt =1 ; + plat->axi->axi_rd_osr_lmt =1 ; + plat->axi->axi_blen[0 ] =4 ; + plat->axi->axi_blen[1 ] =8 ; + plat->axi->axi_blen[2 ] =16 ; + +/* Set default value for multicast hash bins */ + plat->multicast_filter_bins =HASH_TABLE_SIZE ; + +/* Set default value for unicast filter entries */ + plat->unicast_filter_entries =1 ; + +/* Set the maxmtu to a default of JUMBO_LEN */ + plat->maxmtu =JUMBO_LEN ; + +/* Set 32KB fifo size as the advertised fifo size in +* the HW features is not the same as the HW implementation +*/ + plat->tx_fifo_size =32768 ; + plat->rx_fifo_size =32768 ; + +return 0 ; +} + +static int ehl_sgmii1g_data (struct pci_dev *pdev, +struct plat_stmmacenet_data *plat) +{ +int ret; + +/* Set common default data first */ + ret =ehl_common_data (pdev, plat); +if (ret) +return ret; + + plat->interface =PHY_INTERFACE_MODE_SGMII ; + plat->has_xpcs =1 ; + +return 0 ; +} + +static struct stmmac_pci_info ehl_sgmii1g_pci_info = { + .setup = ehl_sgmii1g_data, +}; +static const struct stmmac_pci_func_data galileo_stmmac_func_data[] = { { .func =6 ,
@@ -290,6 +398,7 @@ static int stmmac_pci_probe(struct pci_dev *pdev, res.addr =pcim_iomap_table (pdev)[i]; res.wol_irq = pdev->irq; res.irq = pdev->irq; + res.xpcs_irq =0 ;return stmmac_dvr_probe (&pdev->dev, plat, &res); }
@@ -359,6 +468,7 @@ static int __maybe_unused stmmac_pci_resume(struct device *dev)#define STMMAC_QUARK_ID 0x0937#define STMMAC_DEVICE_ID 0x1108 +#define STMMAC_EHL_SGMII1G_ID 0x4b31#define STMMAC_DEVICE (vendor_id, dev_id, info) { \ PCI_VDEVICE(vendor_id, dev_id), \
@@ -369,6 +479,7 @@ static int __maybe_unused stmmac_pci_resume(struct device *dev)STMMAC_DEVICE (STMMAC ,STMMAC_DEVICE_ID , stmmac_pci_info),STMMAC_DEVICE (STMICRO ,PCI_DEVICE_ID_STMICRO_MAC , stmmac_pci_info),STMMAC_DEVICE (INTEL ,STMMAC_QUARK_ID , quark_pci_info), + STMMAC_DEVICE(INTEL, STMMAC_EHL_SGMII1G_ID, ehl_sgmii1g_pci_info), {} };
Signature · 1 line
1.9.1
From: Voon Weifeng <[email protected]>
Quoted 4 lines
This patch-set is to enable Ethernet controller
(DW Ethernet QoS and DW Ethernet PCS) with SGMII interface in Elkhart Lake. The DW Ethernet PCS is the Physical Coding Sublayer that is between Ethernet MAC and PHY and uses MDIO Clause-45 as Communication.
This series look fine to me but unfortunately I don't have my GMAC5.10 setup available to test for regressions ... The changes look isolated though.
Could you please run the stmmac selftests at least and add the output here ?
Thanks,
Jose Miguel Abreu
Quoted 11 lines
Quoted 4 lines
This patch-set is to enable Ethernet controller (DW Ethernet QoS and DW Ethernet PCS) with SGMII interface in Elkhart Lake. The DW Ethernet PCS is the Physical Coding Sublayer that is between Ethernet MAC and PHY and uses MDIO Clause-45 as Communication.
This series look fine to me but unfortunately I don't have my GMAC5.10 setup available to test for regressions ... The changes look isolated though.
Could you please run the stmmac selftests at least and add the output here ?
Sure, the selftests feature is good as I am able to detect that the dwmac510_xpcs_ops misses the selftest entry. I will fix and add the selftests results in the v6 cover letter.
Quoted 3 lines
Thanks,
Jose Miguel Abreu