Enable SERDES power up/down
Subsystems (4)
cover Enable SERDES power up/down
This patch is to enable Intel SERDES power up/down sequence. The SERDES converts 8/10 bits data to SGMII signal.
1. Two new files intel_serdes.c and intel.h have been created to include the power up/down logic.
2. Platform data has_serdes is created to identify HW system that requires SERDES for SGMII mode. Expecting all Intel HW system will require it. The identification logic is added in hwif.
3. A new stmmac_serdes_ops struct is introduced as helpers to program SERDES.
Voon Weifeng (1):
net: stmmac: Enable SERDES power up/down sequence
drivers/net/ethernet/stmicro/stmmac/Makefile | 2 +- drivers/net/ethernet/stmicro/stmmac/common.h | 1 + .../net/ethernet/stmicro/stmmac/dwmac4_core.c | 1 + drivers/net/ethernet/stmicro/stmmac/hwif.c | 44 ++++- drivers/net/ethernet/stmicro/stmmac/hwif.h | 12 ++ .../ethernet/stmicro/stmmac/intel_serdes.c | 181 ++++++++++++++++++ .../ethernet/stmicro/stmmac/intel_serdes.h | 23 +++ .../net/ethernet/stmicro/stmmac/stmmac_main.c | 8 + .../net/ethernet/stmicro/stmmac/stmmac_pci.c | 6 + include/linux/stmmac.h | 2 + 10 files changed, 278 insertions(+), 2 deletions(-) create mode 100644 drivers/net/ethernet/stmicro/stmmac/intel_serdes.c create mode 100644 drivers/net/ethernet/stmicro/stmmac/intel_serdes.h
Signature · 1 line
2.17.1
RFC 1/1 net: stmmac: Enable SERDES power up/down sequence
This patch is to enable Intel SERDES power up/down sequence. The SERDES converts 8/10 bits data to SGMII signal. Below is an example of HW configuration for SGMII mode. The SERDES is located in the PHY IF in the diagram below.
<-----------------GBE Controller---------->|<--External PHY chip-->
+----------+ +----+ +---+ +----------+
| EQoS | <-GMII->| DW | < ------ > |PHY| <-SGMII-> | External |
| MAC | |xPCS| |IF | | PHY |
+----------+ +----+ +---+ +----------+
^ ^ ^ ^
| | | |
+---------------------MDIO-------------------------+PHY IF configuration and status registers are accessible through mdio address 0x15 which is defined as intel_adhoc_addr. During D0, The driver will need to power up PHY IF by changing the power state to P0. Likewise, for D3, the driver sets PHY IF power state to P3.
--- drivers/net/ethernet/stmicro/stmmac/Makefile | 2 +- drivers/net/ethernet/stmicro/stmmac/common.h | 1 + .../net/ethernet/stmicro/stmmac/dwmac4_core.c | 1 + drivers/net/ethernet/stmicro/stmmac/hwif.c | 44 ++++- drivers/net/ethernet/stmicro/stmmac/hwif.h | 12 ++ .../ethernet/stmicro/stmmac/intel_serdes.c | 181 ++++++++++++++++++ .../ethernet/stmicro/stmmac/intel_serdes.h | 23 +++ .../net/ethernet/stmicro/stmmac/stmmac_main.c | 8 + .../net/ethernet/stmicro/stmmac/stmmac_pci.c | 6 + include/linux/stmmac.h | 2 + 10 files changed, 278 insertions(+), 2 deletions(-) create mode 100644 drivers/net/ethernet/stmicro/stmmac/intel_serdes.c create mode 100644 drivers/net/ethernet/stmicro/stmmac/intel_serdes.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) + intel_serdes.o $(stmmac-y) stmmac-$(CONFIG_STMMAC_SELFTESTS) += stmmac_selftests.o
drivers/net/ethernet/stmicro/stmmac/common.h +1 -0
@@ -452,6 +452,7 @@ struct mii_regs {struct mac_device_info {const struct stmmac_ops *mac; +const struct stmmac_serdes_ops *serdes;const struct stmmac_desc_ops *desc;const struct stmmac_dma_ops *dma;const struct stmmac_mode_ops *mode;
drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c +1 -0
@@ -17,6 +17,7 @@#include <net/dsa.h> #include "stmmac.h" #include "stmmac_pcs.h" +#include "intel_serdes.h" #include "dwmac4.h" #include "dwmac5.h"
drivers/net/ethernet/stmicro/stmmac/hwif.c +43 -1
176 lines not on this page · raw message
drivers/net/ethernet/stmicro/stmmac/hwif.h +12 -0
@@ -476,6 +476,17 @@ struct stmmac_ops { #define stmmac_fpe_configure(__priv, __args...) \ stmmac_do_void_callback(__priv, mac, fpe_configure, __args) +/* Helpers for serdes */ +struct stmmac_serdes_ops { +int (*serdes_powerup)(struct net_device *ndev); +int (*serdes_powerdown)(struct net_device *ndev); +}; + +#define stmmac_serdes_powerup(__priv, __args...) \ + stmmac_do_callback(__priv, serdes, serdes_powerup, __args) +#define stmmac_serdes_powerdown(__priv, __args...) \ + stmmac_do_callback(__priv, serdes, serdes_powerdown, __args) +/* PTP and HW Timer helpers */ struct stmmac_hwtimestamp {void (*config_hw_tstamping) (void __iomem *ioaddr,u32 data);
@@ -595,6 +606,7 @@ struct stmmac_regs_off { };extern const struct stmmac_ops dwmac100_ops; +extern const struct stmmac_serdes_ops intel_serdes_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;
drivers/net/ethernet/stmicro/stmmac/intel_serdes.c new file +181 -0
181 lines not on this page · raw message
drivers/net/ethernet/stmicro/stmmac/intel_serdes.h new file +23 -0
@@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Copyright (c) 2020, Intel Corporation +* Intel Serdes +*/ + +#ifndef __INTEL_SERDES_H__ +#define __INTEL_SERDES_H__ + +#define POLL_DELAY_US 8 + +/* SERDES Register */ +#define SERDES_GSR0 0x5/* Global Status Reg0 */ +#define SERDES_GCR0 0xb/* Global Configuration Reg0 */ + +/* SERDES defines */ +#define SERDES_PLL_CLK BIT(0)/* PLL clk valid signal */ +#define SERDES_RST BIT(2)/* Serdes Reset */ +#define SERDES_PWR_ST_MASK GENMASK(6, 4)/* Serdes Power state*/ +#define SERDES_PWR_ST_SHIFT 4 +#define SERDES_PWR_ST_P0 0x0 +#define SERDES_PWR_ST_P3 0x3 + +#endif /* __INTEL_SERDES_H__ */
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +8 -0
@@ -45,6 +45,7 @@#include "dwmac1000.h" #include "dwxgmac2.h" #include "hwif.h" +#include "intel_serdes.h" #define STMMAC_ALIGN (x) ALIGN(ALIGN(x, SMP_CACHE_BYTES), 16)#define TSO_MAX_BUFF_SIZE (SZ_16K - 1)
@@ -2629,6 +2630,10 @@ static int stmmac_hw_setup(struct net_device *dev, bool init_ptp)u32 chan;int ret; +/* Power up Serdes */ +if (priv->plat->has_serdes) +stmmac_serdes_powerup (priv, dev); +/* DMA initialization and SW reset */ ret =stmmac_init_dma_engine (priv);if (ret <0 ) {
@@ -5015,6 +5020,9 @@ int stmmac_dvr_remove(struct device *dev)stmmac_stop_all_dma (priv); +if (priv->plat->has_serdes) +stmmac_serdes_powerdown (priv, ndev); +stmmac_mac_set (priv, priv->ioaddr, false);netif_carrier_off (ndev);unregister_netdev (ndev);
drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c +6 -0
@@ -119,6 +119,9 @@ static int intel_mgbe_common_data(struct pci_dev *pdev, plat->force_sf_dma_mode =0 ; plat->tso_en =1 ; +/* intel specific adhoc (mdio) address for serdes & etc */ + plat->intel_adhoc_addr =0x15 ; + plat->rx_sched_algorithm =MTL_RX_ALGORITHM_SP ;for (i =0 ; i < plat->rx_queues_to_use; i++) {
@@ -194,6 +197,9 @@ static int intel_mgbe_common_data(struct pci_dev *pdev,/* Set the maxmtu to a default of JUMBO_LEN */ plat->maxmtu =JUMBO_LEN ; +if (plat->phy_interface ==PHY_INTERFACE_MODE_SGMII ) + plat->has_serdes =1 ; +return 0 ; }
include/linux/stmmac.h +2 -0
@@ -146,6 +146,7 @@ struct stmmac_txq_cfg {struct plat_stmmacenet_data {int bus_id;int phy_addr; +int intel_adhoc_addr;int interface;phy_interface_t phy_interface;struct stmmac_mdio_bus_data *mdio_bus_data;
@@ -190,6 +191,7 @@ struct plat_stmmacenet_data {struct reset_control *stmmac_rst;struct stmmac_axi *axi;int has_gmac4; +int has_serdes;bool has_sun8i;bool tso_en;int rss_en;
Signature · 1 line
2.17.1
kbuild test robot
build botRe: [RFC, net-next, v1, 1/1] net: stmmac: Enable SERDES power up/down sequence
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please…
Hi Voon,
[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on next-20200320]
[cannot apply to linus/master sparc-next/master ipvs/master v5.6-rc6 v5.6-rc5 v5.6-rc4 v5.6-rc6] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Voon-Weifeng/Enable-SERDES-power-up-down/20200322-230318 base: d8f289c16fbb72e17b783175c1fb0942816264fd config: arm64-defconfig (attached as .config) compiler: aarch64-linux-gcc (GCC) 9.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=9.2.0 make.cross ARCH=arm64
If you fix the issue, kindly add following tag
All warnings (new ones prefixed by >>):
aarch64-linux-ld: warning: drivers/net/ethernet/stmicro/stmmac/stmmac_main.o: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0000000
aarch64-linux-ld: warning: drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.o: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0000000
aarch64-linux-ld: warning: drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.o: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0000000
aarch64-linux-ld: warning: drivers/net/ethernet/stmicro/stmmac/ring_mode.o: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0000000
aarch64-linux-ld: warning: drivers/net/ethernet/stmicro/stmmac/chain_mode.o: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0000000
aarch64-linux-ld: warning: drivers/net/ethernet/stmicro/stmmac/dwmac_lib.o: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0000000
aarch64-linux-ld: warning: drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.o: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0000000
aarch64-linux-ld: warning: drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.o: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0000000
aarch64-linux-ld: warning: drivers/net/ethernet/stmicro/stmmac/dwmac100_core.o: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0000000
aarch64-linux-ld: warning: drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.o: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0000000
aarch64-linux-ld: warning: drivers/net/ethernet/stmicro/stmmac/enh_desc.o: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0000000
aarch64-linux-ld: warning: drivers/net/ethernet/stmicro/stmmac/norm_desc.o: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0000000
aarch64-linux-ld: warning: drivers/net/ethernet/stmicro/stmmac/mmc_core.o: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0000000
aarch64-linux-ld: warning: drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.o: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0000000
aarch64-linux-ld: warning: drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.o: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0000000
aarch64-linux-ld: warning: drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.o: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0000000
aarch64-linux-ld: warning: drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.o: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0000000
aarch64-linux-ld: warning: drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.o: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0000000
aarch64-linux-ld: warning: drivers/net/ethernet/stmicro/stmmac/dwmac4_core.o: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0000000
aarch64-linux-ld: warning: drivers/net/ethernet/stmicro/stmmac/dwmac5.o: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0000000
aarch64-linux-ld: warning: drivers/net/ethernet/stmicro/stmmac/hwif.o: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0000000
aarch64-linux-ld: warning: drivers/net/ethernet/stmicro/stmmac/stmmac_tc.o: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0000000
aarch64-linux-ld: warning: drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.o: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0000000
aarch64-linux-ld: warning: drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.o: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0000000
aarch64-linux-ld: warning: drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.o: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0000000
>> aarch64-linux-ld: warning: drivers/net/ethernet/stmicro/stmmac/intel_serdes.o: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0000000
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
RE: [RFC,net-next,v1, 1/1] net: stmmac: Enable SERDES power up/down sequence
In reply to Voon WeifengFrom: Voon Weifeng <[email protected]>
Date: Mar/22/2020, 13:23:42 (UTC+00:00)
Quoted 14 lines
This patch is to enable Intel SERDES power up/down sequence. The SERDES converts 8/10 bits data to SGMII signal. Below is an example of HW configuration for SGMII mode. The SERDES is located in the PHY IF in the diagram below.
<-----------------GBE Controller---------->|<--External PHY chip-->
+----------+ +----+ +---+ +----------+ | EQoS | <-GMII->| DW | < ------ > |PHY| <-SGMII-> | External | | MAC | |xPCS| |IF | | PHY | +----------+ +----+ +---+ +----------+ ^ ^ ^ ^ | | | | +---------------------MDIO-------------------------+
Quoted 4 lines
PHY IF configuration and status registers are accessible through mdio address
0x15which is defined asintel_adhoc_addr. During D0, The driver will need to power up PHY IF by changing the power state to P0. Likewise, for D3, the driver sets PHY IF power state to P3.
I don't think this is the right approach.
You could just add a new "mdio-intel-serdes" to phy/ folder just like I did with XPCS because this is mostly related with PHY settings rather than EQoS.
Perhaps Andrew has better insight on this.
BTW, are you using the standard XPCS helpers in phy/ folder ? Is it working fine for you ?
---
Thanks,
Jose Miguel Abreu
RE: [RFC,net-next,v1, 1/1] net: stmmac: Enable SERDES power up/down sequence
Quoted 19 lines
Quoted 14 lines
This patch is to enable Intel SERDES power up/down sequence. The SERDES converts 8/10 bits data to SGMII signal. Below is an example of HW configuration for SGMII mode. The SERDES is located in the PHY IF in the diagram below.
<-----------------GBE Controller---------->|<--External PHY chip-->
+----------+ +----+ +---+ +----------+ | EQoS | <-GMII->| DW | < ------ > |PHY| <-SGMII-> | External | | MAC | |xPCS| |IF | | PHY | +----------+ +----+ +---+ +----------+ ^ ^ ^ ^ | | | | +---------------------MDIO-------------------------+Quoted 4 lines
PHY IF configuration and status registers are accessible through mdio address
0x15which is defined asintel_adhoc_addr. During D0, The driver will need to power up PHY IF by changing the power state to P0. Likewise, for D3, the driver sets PHY IF power state to P3.
Quoted 5 lines
I don't think this is the right approach.
You could just add a new "mdio-intel-serdes" to phy/ folder just like I did with XPCS because this is mostly related with PHY settings rather than EQoS.
I am taking this approach to put it in stmmac folder rather than phy folder as a generic mdio-intel-serdes as this is a specific Intel serdes architecture which would only pair with DW EQos and DW xPCS HW. Since this serdes will not able to pair other MAC or other non-Intel platform, I would like you to reconsider this approach. I am open for discussion.
Thanks Jose for the fast response.
Regards,
Weifeng
Quoted 9 lines
Perhaps Andrew has better insight on this.
BTW, are you using the standard XPCS helpers in phy/ folder ? Is it working fine for you ?
---
Thanks,
Jose Miguel Abreu
RE: [RFC,net-next,v1, 1/1] net: stmmac: Enable SERDES power up/down sequence
From: Voon, Weifeng <[email protected]>
Date: Mar/23/2020, 08:16:29 (UTC+00:00)
Quoted 24 lines
Quoted 19 lines
Quoted 14 lines
This patch is to enable Intel SERDES power up/down sequence. The SERDES converts 8/10 bits data to SGMII signal. Below is an example of HW configuration for SGMII mode. The SERDES is located in the PHY IF in the diagram below.
<-----------------GBE Controller---------->|<--External PHY chip-->
+----------+ +----+ +---+ +----------+ | EQoS | <-GMII->| DW | < ------ > |PHY| <-SGMII-> | External | | MAC | |xPCS| |IF | | PHY | +----------+ +----+ +---+ +----------+ ^ ^ ^ ^ | | | | +---------------------MDIO-------------------------+Quoted 4 lines
PHY IF configuration and status registers are accessible through mdio address
0x15which is defined asintel_adhoc_addr. During D0, The driver will need to power up PHY IF by changing the power state to P0. Likewise, for D3, the driver sets PHY IF power state to P3.Quoted 5 lines
I don't think this is the right approach.
You could just add a new "mdio-intel-serdes" to phy/ folder just like I did with XPCS because this is mostly related with PHY settings rather than EQoS.
Quoted 6 lines
I am taking this approach to put it in stmmac folder rather than phy folder as a generic mdio-intel-serdes as this is a specific Intel serdes architecture which would only pair with DW EQos and DW xPCS HW. Since this serdes will not able to pair other MAC or other non-Intel platform, I would like you to reconsider this approach. I am open for discussion.
Thanks Jose for the fast response.
OK, then I think we should use the BSP init/exit functions that are already available for platform setups (.init and .exit callback of plat_stmmacenet_data struct). We just need to extend this to PCI based setups.
You can take a look at stmmac_platform.c and check what's done. Basically:
- Call priv->plat->init() at probe() and resume()
- Call priv->plat->exit() at remove() and suspend()
---
Thanks,
Jose Miguel Abreu
RE: [RFC,net-next,v1, 1/1] net: stmmac: Enable SERDES power up/down sequence
Quoted 43 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
This patch is to enable Intel SERDES power up/down sequence. The SERDES converts 8/10 bits data to SGMII signal. Below is an example of HW configuration for SGMII mode. The SERDES is located in the PHY IF in the diagram below.
<-----------------GBE Controller---------->|<--External PHY chip-->
+----------+ +----+ +---+ +----------+
Quoted 1 line
Quoted 1 line
Quoted 1 line
| EQoS | <-GMII->| DW | < ------ > |PHY| <-SGMII-> | External
|
Quoted 1 line
Quoted 1 line
Quoted 1 line
| MAC | |xPCS| |IF | | PHY
|
Quoted 1 line
Quoted 1 line
Quoted 1 line
+----------+ +----+ +---+ +----------
+
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
^ ^ ^ ^ | | | | +---------------------MDIO-------------------------+PHY IF configuration and status registers are accessible through mdio address
0x15which is defined asintel_adhoc_addr. During D0, The driver will need to power up PHY IF by changing the powerstate to P0.
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
Likewise, for D3, the driver sets PHY IF power state to P3.
I don't think this is the right approach.
Quoted 8 lines
Quoted 3 lines
You could just add a new "mdio-intel-serdes" to phy/ folder just like I did with XPCS because this is mostly related with PHY settings rather than EQoS.
I am taking this approach to put it in stmmac folder rather than phy folder as a generic mdio-intel-serdes as this is a specific Intel serdes architecture which would only pair with DW EQos and DW xPCS HW. Since this serdes will not able to pair other MAC or other non-Intel platform, I would like you to reconsider this approach. I am open for
discussion.
Quoted 1 line
Thanks Jose for the fast response.
OK, then I think we should use the BSP init/exit functions that are already available for platform setups (.init and .exit callback of
plat_stmmacenet_datastruct). We just need to extend this to PCI based setups.
Quoted 5 lines
You can take a look at
stmmac_platform.cand check what's done. Basically:
- Callpriv->plat->init()atprobe()andresume()
- Callpriv->plat->exit()atremove()andsuspend()
I have 2 concern if using the suggested BSP init/exit function.
1. Serdes is configured through MDIO bus. But the mdio bus register only happens in stmmac_dvr_probe() in stmmac_main.c.
2. All tx/rx packets requires serdes to be in the correct power state. If the driver power-down before stopping all the dma, it will cause tx queue timeout as packets are not able to be transmitted out. Hence, the serdes cannot be power-down before calling the stmmac_dvr_remove(). The stmmac_dvr_remove() will unregister the mdio bus. So, the driver cannot powerdown the serdes after the stmmac_dvr_remove() too.
Regards,
Weifeng
Quoted 3 lines
---
Thanks,
Jose Miguel Abreu
RE: [RFC,net-next,v1, 1/1] net: stmmac: Enable SERDES power up/down sequence
Quoted 58 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
This patch is to enable Intel SERDES power up/down sequence. The SERDES converts 8/10 bits data to SGMII signal. Below is an example of HW configuration for SGMII mode. The SERDES is located in the PHY IF in the diagram below.
<-----------------GBE Controller---------->|<--External PHY chip-->
+----------+ +----+ +---+ +----------
Quoted 2 lines
+
Quoted 1 line
Quoted 1 line
Quoted 1 line
| EQoS | <-GMII->| DW | < ------ > |PHY| <-SGMII-> |
External
Quoted 4 lines
|
Quoted 1 line
Quoted 1 line
Quoted 1 line
| MAC | |xPCS| |IF | | PHY
|
Quoted 1 line
Quoted 1 line
Quoted 1 line
+----------+ +----+ +---+ +--------
--
Quoted 5 lines
+
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
^ ^ ^ ^ | | | | +---------------------MDIO-------------------------+Quoted 15 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
PHY IF configuration and status registers are accessible through mdio address
0x15which is defined asintel_adhoc_addr. During D0, The driver will need to power up PHY IF by changing the powerstate to P0.
Quoted 10 lines
Quoted 7 lines
Quoted 1 line
Likewise, for D3, the driver sets PHY IF power state to P3.
I don't think this is the right approach.
You could just add a new "mdio-intel-serdes" to phy/ folder just like I did with XPCS because this is mostly related with PHY settings rather than EQoS.
I am taking this approach to put it in stmmac folder rather than phy folder as a generic mdio-intel-serdes as this is a specific Intel serdes architecture which would only pair with DW EQos and DW xPCS
HW.
Quoted 11 lines
Quoted 3 lines
Since this serdes will not able to pair other MAC or other non-Intel platform, I would like you to reconsider this approach. I am open for
discussion.
Quoted 1 line
Thanks Jose for the fast response.
OK, then I think we should use the BSP init/exit functions that are already available for platform setups (.init and .exit callback of
plat_stmmacenet_datastruct). We just need to extend this to PCI based setups.Quoted 5 lines
You can take a look at
stmmac_platform.cand check what's done. Basically:
- Callpriv->plat->init()atprobe()andresume()
- Callpriv->plat->exit()atremove()andsuspend()I have 2 concern if using the suggested BSP init/exit function.
1. Serdes is configured through MDIO bus. But the mdio bus register only happens instmmac_dvr_probe()instmmac_main.c.
Quoted 6 lines
2. All tx/rx packets requires serdes to be in the correct power state. If the driver power-down before stopping all the dma, it will cause tx queue timeout as packets are not able to be transmitted out. Hence, the serdes cannot be power-down before calling the
stmmac_dvr_remove(). Thestmmac_dvr_remove()will unregister the mdio bus. So, the driver cannot powerdown the serdes after thestmmac_dvr_remove()too.
I went through the code again, I understand that your intention is to keep the platform specific setup in its own file and keep the main dwmac logic clean. But, I did not see any way to separate this SERDES configuration from the stmmac_main logic cleanly.
Hope to get more ideas and discussion. Thanks.
Weifeng
Quoted 7 lines
Regards,
WeifengQuoted 3 lines
---
Thanks,
Jose Miguel Abreu
RE: [RFC,net-next,v1, 1/1] net: stmmac: Enable SERDES power up/down sequence
From: Voon, Weifeng <[email protected]>
Date: Apr/01/2020, 15:23:09 (UTC+00:00)
Quoted 65 lines
Quoted 58 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
This patch is to enable Intel SERDES power up/down sequence. The SERDES converts 8/10 bits data to SGMII signal. Below is an example of HW configuration for SGMII mode. The SERDES is located in the PHY IF in the diagram below.
<-----------------GBE Controller---------->|<--External PHY chip-->
+----------+ +----+ +---+ +----------
Quoted 2 lines
+
Quoted 1 line
Quoted 1 line
Quoted 1 line
| EQoS | <-GMII->| DW | < ------ > |PHY| <-SGMII-> |
External
Quoted 4 lines
|
Quoted 1 line
Quoted 1 line
Quoted 1 line
| MAC | |xPCS| |IF | | PHY
|
Quoted 1 line
Quoted 1 line
Quoted 1 line
+----------+ +----+ +---+ +--------
--
Quoted 5 lines
+
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
^ ^ ^ ^ | | | | +---------------------MDIO-------------------------+Quoted 15 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
PHY IF configuration and status registers are accessible through mdio address
0x15which is defined asintel_adhoc_addr. During D0, The driver will need to power up PHY IF by changing the powerstate to P0.
Quoted 10 lines
Quoted 7 lines
Quoted 1 line
Likewise, for D3, the driver sets PHY IF power state to P3.
I don't think this is the right approach.
You could just add a new "mdio-intel-serdes" to phy/ folder just like I did with XPCS because this is mostly related with PHY settings rather than EQoS.
I am taking this approach to put it in stmmac folder rather than phy folder as a generic mdio-intel-serdes as this is a specific Intel serdes architecture which would only pair with DW EQos and DW xPCS
HW.
Quoted 11 lines
Quoted 3 lines
Since this serdes will not able to pair other MAC or other non-Intel platform, I would like you to reconsider this approach. I am open for
discussion.
Quoted 1 line
Thanks Jose for the fast response.
OK, then I think we should use the BSP init/exit functions that are already available for platform setups (.init and .exit callback of
plat_stmmacenet_datastruct). We just need to extend this to PCI based setups.Quoted 5 lines
You can take a look at
stmmac_platform.cand check what's done. Basically:
- Callpriv->plat->init()atprobe()andresume()
- Callpriv->plat->exit()atremove()andsuspend()I have 2 concern if using the suggested BSP init/exit function.
1. Serdes is configured through MDIO bus. But the mdio bus register only happens instmmac_dvr_probe()instmmac_main.c.Quoted 6 lines
2. All tx/rx packets requires serdes to be in the correct power state. If the driver power-down before stopping all the dma, it will cause tx queue timeout as packets are not able to be transmitted out. Hence, the serdes cannot be power-down before calling the
stmmac_dvr_remove(). Thestmmac_dvr_remove()will unregister the mdio bus. So, the driver cannot powerdown the serdes after thestmmac_dvr_remove()too.
Quoted 5 lines
I went through the code again, I understand that your intention is to keep the platform specific setup in its own file and keep the main dwmac logic clean. But, I did not see any way to separate this SERDES configuration from the
stmmac_mainlogic cleanly.
Hope to get more ideas and discussion. Thanks.
Sorry for the late reply!
Yes, that's exactly my intention. Maybe we can add a new set of callbacks for BSP. Something like ->start(), ->stop() ?
---
Thanks,
Jose Miguel Abreu