net: stmmac: Power up SERDES after the PHY link
Subsystems (5)
PATCH 1/2 net: stmmac: Power up SERDES after the PHY link
The Tegra MGBE ethernet controller requires that the SERDES link is powered-up after the PHY link is up, otherwise the link fails to become ready following a resume from suspend. Add a variable to indicate that the SERDES link must be powered-up after the PHY link.
--- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 7 +++++-- include/linux/stmmac.h | 1 + 2 files changed, 6 insertions(+), 2 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +5 -2
@@ -988,6 +988,9 @@ static void stmmac_mac_link_up(struct phylink_config *config,struct stmmac_priv *priv =netdev_priv (to_net_dev (config->dev));u32 old_ctrl, ctrl; +if (priv->plat->serdes_up_after_phy_linkup && priv->plat->serdes_powerup) + priv->plat->serdes_powerup (priv->dev, priv->plat->bsp_priv); + old_ctrl =readl (priv->ioaddr +MAC_CTRL_REG ); ctrl = old_ctrl & ~priv->hw->link.speed_mask;
@@ -3801,7 +3804,7 @@ static int __stmmac_open(struct net_device *dev,stmmac_reset_queues_param (priv); -if (priv->plat->serdes_powerup) { +if (!priv->plat->serdes_up_after_phy_linkup && priv->plat->serdes_powerup) { ret = priv->plat->serdes_powerup (dev, priv->plat->bsp_priv);if (ret <0 ) { netdev_err(priv->dev, "%s: Serdes powerup failed\n",
@@ -7510,7 +7513,7 @@ int stmmac_resume(struct device *dev)stmmac_mdio_reset (priv->mii); } -if (priv->plat->serdes_powerup) { +if (!priv->plat->serdes_up_after_phy_linkup && priv->plat->serdes_powerup) { ret = priv->plat->serdes_powerup (ndev, priv->plat->bsp_priv);
include/linux/stmmac.h +1 -0
@@ -271,5 +271,6 @@ struct plat_stmmacenet_data {int msi_tx_base_vec;bool use_phy_wol;bool sph_disable; + bool serdes_up_after_phy_linkup; };#endif
Signature · 1 line
2.25.1
PATCH 2/2 net: stmmac: tegra: Add MGBE support
From: Bhadram Varka <[email protected]>
Add support for the Multi-Gigabit Ethernet (MGBE/XPCS) IP found on NVIDIA Tegra234 SoCs.
--- drivers/net/ethernet/stmicro/stmmac/Kconfig | 6 + drivers/net/ethernet/stmicro/stmmac/Makefile | 1 + .../net/ethernet/stmicro/stmmac/dwmac-tegra.c | 387 ++++++++++++++++++ 3 files changed, 394 insertions(+) create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-tegra.c
drivers/net/ethernet/stmicro/stmmac/Kconfig +6 -0
@@ -235,6 +235,12 @@ config DWMAC_INTEL_PLAT the stmmac device driver. This driver is used for the Intel Keem Bay SoC. +config DWMAC_TEGRA + tristate "NVIDIA Tegra MGBE support" + depends on ARCH_TEGRA || COMPILE_TEST + help + Support for the MGBE controller found on Tegra SoCs. + config DWMAC_VISCONTI tristate "Toshiba Visconti DWMAC support" default ARCH_VISCONTI
drivers/net/ethernet/stmicro/stmmac/Makefile +1 -0
@@ -31,6 +31,7 @@ obj-$(CONFIG_DWMAC_DWC_QOS_ETH) += dwmac-dwc-qos-eth.o obj-$(CONFIG_DWMAC_INTEL_PLAT) += dwmac-intel-plat.o obj-$(CONFIG_DWMAC_GENERIC) += dwmac-generic.o obj-$(CONFIG_DWMAC_IMX8) += dwmac-imx.o +obj-$(CONFIG_DWMAC_TEGRA) += dwmac-tegra.o obj-$(CONFIG_DWMAC_VISCONTI) += dwmac-visconti.o stmmac-platform-objs:= stmmac_platform.o dwmac-altr-socfpga-objs := altr_tse_pcs.o dwmac-socfpga.o
drivers/net/ethernet/stmicro/stmmac/dwmac-tegra.c new file +387 -0
387 lines not on this page · raw message
Signature · 1 line
2.25.1
Re: [PATCH 2/2] net: stmmac: tegra: Add MGBE support
Quoted 10 lines · Revanth Kumar Uppala
From: Bhadram Varka <[email protected]>
Add support for the Multi-Gigabit Ethernet (MGBE/XPCS) IP found on NVIDIA Tegra234 SoCs.
Signed-off-by Thierry Reding <[email protected]>Signed-off-by Bhadram Varka <[email protected]>Co-developed-by Revanth Kumar Uppala <[email protected]>Signed-off-by Revanth Kumar Uppala <[email protected]>---
This should have been marked as 'V5'. If we need to resend please let us know. We are also missing what has been changed since the last version. I know that in this version the following changes were made:
1. Reduce time spent polling for the RX link to be ready
2. Propagate the errors when bringing up the link fails.
3. Added suspend/resume support
4. Ensure clocks are disabled again on probe/resume failure
Otherwise ...
Thanks
Jon
Signature · 1 line
nvpublic
Paolo Abeni
maintainerRe: [PATCH 2/2] net: stmmac: tegra: Add MGBE support
In reply to Revanth Kumar UppalaHello,
drivers/net/ethernet/stmicro/stmmac/Kconfig config DWMAC_INTEL_PLAT · line 242
Quoted 13 lines · Revanth Kumar Uppala
drivers/net/ethernet/stmicro/stmmac/Kconfig +5
-0@@ -235,6 +235,12 @@ config DWMAC_INTEL_PLAT the stmmac device driver. This driver is used for the Intel Keem Bay SoC. +config DWMAC_TEGRA + tristate "NVIDIA Tegra MGBE support" + depends on ARCH_TEGRA || COMPILE_TEST + help + Support for the MGBE controller found on Tegra SoCs.
Minor nit: checkpatch is complaining for a more descriptive config option text.
Quoted 44 lines
drivers/net/ethernet/stmicro/stmmac/Kconfig +44
-0+static int tegra_mgbe_probe(struct platform_device *pdev) +{ + struct plat_stmmacenet_data *plat; + struct stmmac_resources res; + struct tegra_mgbe *mgbe; + int irq, err, i; + u32 value; + + mgbe = devm_kzalloc(&pdev->dev, sizeof(*mgbe), GFP_KERNEL); + if (!mgbe) + return -ENOMEM; + + mgbe->dev = &pdev->dev; + + memset(&res, 0, sizeof(res)); + + irq = platform_get_irq(pdev, 0); + if (irq < 0) + return irq; + + mgbe->hv = devm_platform_ioremap_resource_byname(pdev, "hypervisor"); + if (IS_ERR(mgbe->hv)) + return PTR_ERR(mgbe->hv); + + mgbe->regs = devm_platform_ioremap_resource_byname(pdev, "mac"); + if (IS_ERR(mgbe->regs)) + return PTR_ERR(mgbe->regs); + + mgbe->xpcs = devm_platform_ioremap_resource_byname(pdev, "xpcs"); + if (IS_ERR(mgbe->xpcs)) + return PTR_ERR(mgbe->xpcs); + + res.addr = mgbe->regs; + res.irq = irq; + + mgbe->clks = devm_kzalloc(&pdev->dev, sizeof(*mgbe->clks), GFP_KERNEL); + if (!mgbe->clks) + return -ENOMEM; + + for (i = 0; i < ARRAY_SIZE(mgbe_clks); i++) + mgbe->clks[i].id = mgbe_clks[i]; + + err = devm_clk_bulk_get(mgbe->dev, ARRAY_SIZE(mgbe_clks), mgbe->clks); + if (err < 0)
drivers/net/ethernet/stmicro/stmmac/Kconfig config DWMAC_INTEL_PLAT
Quoted 10 lines
drivers/net/ethernet/stmicro/stmmac/Kconfig +10
-0+ return err; + + err = clk_bulk_prepare_enable(ARRAY_SIZE(mgbe_clks), mgbe->clks); + if (err < 0) + return err; + + /* Perform MAC reset */ + mgbe->rst_mac = devm_reset_control_get(&pdev->dev, "mac"); + if (IS_ERR(mgbe->rst_mac)) { + err = PTR_ERR(mgbe->rst_mac);
This triggers a clang warning:
../drivers/net/ethernet/stmicro/stmmac/dwmac-tegra.c:283:6: warning: variable 'plat' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
I guess you have to init plat to NULL and explcitly check for NULL values under the 'remove' label.
Cheers,
Paolo