Message ID | 20250318205735.122590-4-prabhakar.mahadev-lad.rj@bp.renesas.com (mailing list archive) |
---|---|
State | New |
Delegated to: | Geert Uytterhoeven |
Headers | show |
Series | Add GBETH glue layer driver for Renesas RZ/V2H(P) SoC | expand |
Hi Prabhakar, kernel test robot noticed the following build errors: [auto build test ERROR on net-next/main] url: https://github.com/intel-lab-lkp/linux/commits/Prabhakar/dt-bindings-net-dwmac-Increase-maxItems-for-interrupts-and-interrupt-names/20250319-050021 base: net-next/main patch link: https://lore.kernel.org/r/20250318205735.122590-4-prabhakar.mahadev-lad.rj%40bp.renesas.com patch subject: [PATCH net-next v4 3/3] net: stmmac: Add DWMAC glue layer for Renesas GBETH config: m68k-allmodconfig (https://download.01.org/0day-ci/archive/20250320/202503200200.WXMnn3Kq-lkp@intel.com/config) compiler: m68k-linux-gcc (GCC) 8.5.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250320/202503200200.WXMnn3Kq-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202503200200.WXMnn3Kq-lkp@intel.com/ All errors (new ones prefixed by >>): drivers/net/ethernet/stmicro/stmmac/dwmac-renesas-gbeth.c: In function 'renesas_gbeth_probe': >> drivers/net/ethernet/stmicro/stmmac/dwmac-renesas-gbeth.c:125:7: error: 'STMMAC_FLAG_EN_TX_LPI_CLK_PHY_CAP' undeclared (first use in this function); did you mean 'STMMAC_FLAG_EN_TX_LPI_CLOCKGATING'? STMMAC_FLAG_EN_TX_LPI_CLK_PHY_CAP | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ STMMAC_FLAG_EN_TX_LPI_CLOCKGATING drivers/net/ethernet/stmicro/stmmac/dwmac-renesas-gbeth.c:125:7: note: each undeclared identifier is reported only once for each function it appears in vim +125 drivers/net/ethernet/stmicro/stmmac/dwmac-renesas-gbeth.c 72 73 static int renesas_gbeth_probe(struct platform_device *pdev) 74 { 75 struct plat_stmmacenet_data *plat_dat; 76 struct stmmac_resources stmmac_res; 77 struct device *dev = &pdev->dev; 78 struct renesas_gbeth *gbeth; 79 unsigned int i; 80 int err; 81 82 err = stmmac_get_platform_resources(pdev, &stmmac_res); 83 if (err) 84 return dev_err_probe(dev, err, 85 "failed to get resources\n"); 86 87 plat_dat = devm_stmmac_probe_config_dt(pdev, stmmac_res.mac); 88 if (IS_ERR(plat_dat)) 89 return dev_err_probe(dev, PTR_ERR(plat_dat), 90 "dt configuration failed\n"); 91 92 gbeth = devm_kzalloc(dev, sizeof(*gbeth), GFP_KERNEL); 93 if (!gbeth) 94 return -ENOMEM; 95 96 plat_dat->num_clks = ARRAY_SIZE(renesas_gbeth_clks); 97 plat_dat->clks = devm_kcalloc(dev, plat_dat->num_clks, 98 sizeof(*plat_dat->clks), GFP_KERNEL); 99 if (!plat_dat->clks) 100 return -ENOMEM; 101 102 for (i = 0; i < plat_dat->num_clks; i++) 103 plat_dat->clks[i].id = renesas_gbeth_clks[i]; 104 105 err = devm_clk_bulk_get(dev, plat_dat->num_clks, plat_dat->clks); 106 if (err < 0) 107 return err; 108 109 plat_dat->clk_tx_i = renesas_gbeth_find_clk(plat_dat, "tx"); 110 if (!plat_dat->clk_tx_i) 111 return dev_err_probe(dev, -EINVAL, 112 "error finding tx clock\n"); 113 114 gbeth->rstc = devm_reset_control_get_exclusive(dev, NULL); 115 if (IS_ERR(gbeth->rstc)) 116 return PTR_ERR(gbeth->rstc); 117 118 gbeth->dev = dev; 119 gbeth->regs = stmmac_res.addr; 120 gbeth->plat_dat = plat_dat; 121 plat_dat->bsp_priv = gbeth; 122 plat_dat->set_clk_tx_rate = stmmac_set_clk_tx_rate; 123 plat_dat->clks_config = renesas_gbeth_clks_config; 124 plat_dat->flags |= STMMAC_FLAG_HWTSTAMP_CORRECT_LATENCY | > 125 STMMAC_FLAG_EN_TX_LPI_CLK_PHY_CAP | 126 STMMAC_FLAG_SPH_DISABLE; 127 128 err = renesas_gbeth_clks_config(gbeth, true); 129 if (err) 130 return err; 131 132 err = stmmac_dvr_probe(dev, plat_dat, &stmmac_res); 133 if (err) 134 renesas_gbeth_clks_config(gbeth, false); 135 136 return err; 137 } 138
Hello, On Wed, Mar 19, 2025 at 6:31 PM kernel test robot <lkp@intel.com> wrote: > > Hi Prabhakar, > > kernel test robot noticed the following build errors: > > [auto build test ERROR on net-next/main] > > url: https://github.com/intel-lab-lkp/linux/commits/Prabhakar/dt-bindings-net-dwmac-Increase-maxItems-for-interrupts-and-interrupt-names/20250319-050021 > base: net-next/main > patch link: https://lore.kernel.org/r/20250318205735.122590-4-prabhakar.mahadev-lad.rj%40bp.renesas.com > patch subject: [PATCH net-next v4 3/3] net: stmmac: Add DWMAC glue layer for Renesas GBETH > config: m68k-allmodconfig (https://download.01.org/0day-ci/archive/20250320/202503200200.WXMnn3Kq-lkp@intel.com/config) > compiler: m68k-linux-gcc (GCC) 8.5.0 > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250320/202503200200.WXMnn3Kq-lkp@intel.com/reproduce) > > If you fix the issue in a separate patch/commit (i.e. not just a new version of > the same patch/commit), kindly add following tags > | Reported-by: kernel test robot <lkp@intel.com> > | Closes: https://lore.kernel.org/oe-kbuild-all/202503200200.WXMnn3Kq-lkp@intel.com/ > > All errors (new ones prefixed by >>): > > drivers/net/ethernet/stmicro/stmmac/dwmac-renesas-gbeth.c: In function 'renesas_gbeth_probe': > >> drivers/net/ethernet/stmicro/stmmac/dwmac-renesas-gbeth.c:125:7: error: 'STMMAC_FLAG_EN_TX_LPI_CLK_PHY_CAP' undeclared (first use in this function); did you mean 'STMMAC_FLAG_EN_TX_LPI_CLOCKGATING'? > STMMAC_FLAG_EN_TX_LPI_CLK_PHY_CAP | > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > STMMAC_FLAG_EN_TX_LPI_CLOCKGATING > drivers/net/ethernet/stmicro/stmmac/dwmac-renesas-gbeth.c:125:7: note: each undeclared identifier is reported only once for each function it appears in > The dependent patch [0] has now merged into net-next. [0] https://web.git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=0c1f1eb65425 Cheers, Prabhakar
Hi Prabhakar, kernel test robot noticed the following build errors: [auto build test ERROR on net-next/main] url: https://github.com/intel-lab-lkp/linux/commits/Prabhakar/dt-bindings-net-dwmac-Increase-maxItems-for-interrupts-and-interrupt-names/20250319-050021 base: net-next/main patch link: https://lore.kernel.org/r/20250318205735.122590-4-prabhakar.mahadev-lad.rj%40bp.renesas.com patch subject: [PATCH net-next v4 3/3] net: stmmac: Add DWMAC glue layer for Renesas GBETH config: s390-allmodconfig (https://download.01.org/0day-ci/archive/20250320/202503200755.DoMipQnf-lkp@intel.com/config) compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250320/202503200755.DoMipQnf-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202503200755.DoMipQnf-lkp@intel.com/ All errors (new ones prefixed by >>): >> drivers/net/ethernet/stmicro/stmmac/dwmac-renesas-gbeth.c:125:7: error: use of undeclared identifier 'STMMAC_FLAG_EN_TX_LPI_CLK_PHY_CAP' 125 | STMMAC_FLAG_EN_TX_LPI_CLK_PHY_CAP | | ^ 1 error generated. vim +/STMMAC_FLAG_EN_TX_LPI_CLK_PHY_CAP +125 drivers/net/ethernet/stmicro/stmmac/dwmac-renesas-gbeth.c 72 73 static int renesas_gbeth_probe(struct platform_device *pdev) 74 { 75 struct plat_stmmacenet_data *plat_dat; 76 struct stmmac_resources stmmac_res; 77 struct device *dev = &pdev->dev; 78 struct renesas_gbeth *gbeth; 79 unsigned int i; 80 int err; 81 82 err = stmmac_get_platform_resources(pdev, &stmmac_res); 83 if (err) 84 return dev_err_probe(dev, err, 85 "failed to get resources\n"); 86 87 plat_dat = devm_stmmac_probe_config_dt(pdev, stmmac_res.mac); 88 if (IS_ERR(plat_dat)) 89 return dev_err_probe(dev, PTR_ERR(plat_dat), 90 "dt configuration failed\n"); 91 92 gbeth = devm_kzalloc(dev, sizeof(*gbeth), GFP_KERNEL); 93 if (!gbeth) 94 return -ENOMEM; 95 96 plat_dat->num_clks = ARRAY_SIZE(renesas_gbeth_clks); 97 plat_dat->clks = devm_kcalloc(dev, plat_dat->num_clks, 98 sizeof(*plat_dat->clks), GFP_KERNEL); 99 if (!plat_dat->clks) 100 return -ENOMEM; 101 102 for (i = 0; i < plat_dat->num_clks; i++) 103 plat_dat->clks[i].id = renesas_gbeth_clks[i]; 104 105 err = devm_clk_bulk_get(dev, plat_dat->num_clks, plat_dat->clks); 106 if (err < 0) 107 return err; 108 109 plat_dat->clk_tx_i = renesas_gbeth_find_clk(plat_dat, "tx"); 110 if (!plat_dat->clk_tx_i) 111 return dev_err_probe(dev, -EINVAL, 112 "error finding tx clock\n"); 113 114 gbeth->rstc = devm_reset_control_get_exclusive(dev, NULL); 115 if (IS_ERR(gbeth->rstc)) 116 return PTR_ERR(gbeth->rstc); 117 118 gbeth->dev = dev; 119 gbeth->regs = stmmac_res.addr; 120 gbeth->plat_dat = plat_dat; 121 plat_dat->bsp_priv = gbeth; 122 plat_dat->set_clk_tx_rate = stmmac_set_clk_tx_rate; 123 plat_dat->clks_config = renesas_gbeth_clks_config; 124 plat_dat->flags |= STMMAC_FLAG_HWTSTAMP_CORRECT_LATENCY | > 125 STMMAC_FLAG_EN_TX_LPI_CLK_PHY_CAP | 126 STMMAC_FLAG_SPH_DISABLE; 127 128 err = renesas_gbeth_clks_config(gbeth, true); 129 if (err) 130 return err; 131 132 err = stmmac_dvr_probe(dev, plat_dat, &stmmac_res); 133 if (err) 134 renesas_gbeth_clks_config(gbeth, false); 135 136 return err; 137 } 138
Hi, On Thu, Mar 20, 2025 at 12:29 AM kernel test robot <lkp@intel.com> wrote: > > Hi Prabhakar, > > kernel test robot noticed the following build errors: > > [auto build test ERROR on net-next/main] > > url: https://github.com/intel-lab-lkp/linux/commits/Prabhakar/dt-bindings-net-dwmac-Increase-maxItems-for-interrupts-and-interrupt-names/20250319-050021 > base: net-next/main > patch link: https://lore.kernel.org/r/20250318205735.122590-4-prabhakar.mahadev-lad.rj%40bp.renesas.com > patch subject: [PATCH net-next v4 3/3] net: stmmac: Add DWMAC glue layer for Renesas GBETH > config: s390-allmodconfig (https://download.01.org/0day-ci/archive/20250320/202503200755.DoMipQnf-lkp@intel.com/config) > compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff) > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250320/202503200755.DoMipQnf-lkp@intel.com/reproduce) > > If you fix the issue in a separate patch/commit (i.e. not just a new version of > the same patch/commit), kindly add following tags > | Reported-by: kernel test robot <lkp@intel.com> > | Closes: https://lore.kernel.org/oe-kbuild-all/202503200755.DoMipQnf-lkp@intel.com/ > > All errors (new ones prefixed by >>): > > >> drivers/net/ethernet/stmicro/stmmac/dwmac-renesas-gbeth.c:125:7: error: use of undeclared identifier 'STMMAC_FLAG_EN_TX_LPI_CLK_PHY_CAP' > 125 | STMMAC_FLAG_EN_TX_LPI_CLK_PHY_CAP | > | ^ > 1 error generated. > The dependent patch [0] has now merged into net-next, with this we shouldn't be able to see this build issue. [0] https://web.git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=0c1f1eb65425 Cheers, Prabhakar
diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig index 3c820ef56775..2c99b23f0faa 100644 --- a/drivers/net/ethernet/stmicro/stmmac/Kconfig +++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig @@ -131,6 +131,17 @@ config DWMAC_QCOM_ETHQOS This selects the Qualcomm ETHQOS glue layer support for the stmmac device driver. +config DWMAC_RENESAS_GBETH + tristate "Renesas RZ/V2H(P) GBETH support" + default ARCH_RENESAS + depends on OF && (ARCH_RENESAS || COMPILE_TEST) + help + Support for Gigabit Ethernet Interface (GBETH) on Renesas + RZ/V2H(P) SoCs. + + This selects the Renesas RZ/V2H(P) Soc specific glue layer support + for the stmmac device driver. + config DWMAC_ROCKCHIP tristate "Rockchip dwmac support" default ARCH_ROCKCHIP diff --git a/drivers/net/ethernet/stmicro/stmmac/Makefile b/drivers/net/ethernet/stmicro/stmmac/Makefile index 594883fb4164..91050215511b 100644 --- a/drivers/net/ethernet/stmicro/stmmac/Makefile +++ b/drivers/net/ethernet/stmicro/stmmac/Makefile @@ -20,6 +20,7 @@ obj-$(CONFIG_DWMAC_LPC18XX) += dwmac-lpc18xx.o obj-$(CONFIG_DWMAC_MEDIATEK) += dwmac-mediatek.o obj-$(CONFIG_DWMAC_MESON) += dwmac-meson.o dwmac-meson8b.o obj-$(CONFIG_DWMAC_QCOM_ETHQOS) += dwmac-qcom-ethqos.o +obj-$(CONFIG_DWMAC_RENESAS_GBETH) += dwmac-renesas-gbeth.o obj-$(CONFIG_DWMAC_ROCKCHIP) += dwmac-rk.o obj-$(CONFIG_DWMAC_RZN1) += dwmac-rzn1.o obj-$(CONFIG_DWMAC_S32) += dwmac-s32.o diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-renesas-gbeth.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-renesas-gbeth.c new file mode 100644 index 000000000000..a0f7cacea810 --- /dev/null +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-renesas-gbeth.c @@ -0,0 +1,165 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * dwmac-renesas-gbeth.c - DWMAC Specific Glue layer for Renesas GBETH + * + * The Rx and Tx clocks are supplied as follows for the GBETH IP. + * + * Rx / Tx + * -------+------------- on / off ------- + * | + * | Rx-180 / Tx-180 + * +---- not ---- on / off ------- + * + * Copyright (C) 2025 Renesas Electronics Corporation + */ + +#include <linux/clk.h> +#include <linux/device.h> +#include <linux/module.h> +#include <linux/platform_device.h> +#include <linux/reset.h> + +#include "dwmac4.h" +#include "stmmac_platform.h" + +struct renesas_gbeth { + struct plat_stmmacenet_data *plat_dat; + struct reset_control *rstc; + struct device *dev; + void __iomem *regs; +}; + +static const char *const renesas_gbeth_clks[] = { + "tx", "tx-180", "rx", "rx-180", +}; + +static struct clk *renesas_gbeth_find_clk(struct plat_stmmacenet_data *plat_dat, + const char *name) +{ + for (unsigned int i = 0; i < plat_dat->num_clks; i++) + if (!strcmp(plat_dat->clks[i].id, name)) + return plat_dat->clks[i].clk; + + return NULL; +} + +static int renesas_gbeth_clks_config(void *priv, bool enabled) +{ + struct plat_stmmacenet_data *plat_dat; + struct renesas_gbeth *gbeth = priv; + int ret; + + plat_dat = gbeth->plat_dat; + if (enabled) { + ret = reset_control_deassert(gbeth->rstc); + if (ret) { + dev_err(gbeth->dev, "Reset deassert failed\n"); + return ret; + } + + ret = clk_bulk_prepare_enable(plat_dat->num_clks, plat_dat->clks); + if (ret) + reset_control_assert(gbeth->rstc); + } else { + clk_bulk_disable_unprepare(plat_dat->num_clks, plat_dat->clks); + ret = reset_control_assert(gbeth->rstc); + if (ret) + dev_err(gbeth->dev, "Reset assert failed\n"); + } + + return ret; +} + +static int renesas_gbeth_probe(struct platform_device *pdev) +{ + struct plat_stmmacenet_data *plat_dat; + struct stmmac_resources stmmac_res; + struct device *dev = &pdev->dev; + struct renesas_gbeth *gbeth; + unsigned int i; + int err; + + err = stmmac_get_platform_resources(pdev, &stmmac_res); + if (err) + return dev_err_probe(dev, err, + "failed to get resources\n"); + + plat_dat = devm_stmmac_probe_config_dt(pdev, stmmac_res.mac); + if (IS_ERR(plat_dat)) + return dev_err_probe(dev, PTR_ERR(plat_dat), + "dt configuration failed\n"); + + gbeth = devm_kzalloc(dev, sizeof(*gbeth), GFP_KERNEL); + if (!gbeth) + return -ENOMEM; + + plat_dat->num_clks = ARRAY_SIZE(renesas_gbeth_clks); + plat_dat->clks = devm_kcalloc(dev, plat_dat->num_clks, + sizeof(*plat_dat->clks), GFP_KERNEL); + if (!plat_dat->clks) + return -ENOMEM; + + for (i = 0; i < plat_dat->num_clks; i++) + plat_dat->clks[i].id = renesas_gbeth_clks[i]; + + err = devm_clk_bulk_get(dev, plat_dat->num_clks, plat_dat->clks); + if (err < 0) + return err; + + plat_dat->clk_tx_i = renesas_gbeth_find_clk(plat_dat, "tx"); + if (!plat_dat->clk_tx_i) + return dev_err_probe(dev, -EINVAL, + "error finding tx clock\n"); + + gbeth->rstc = devm_reset_control_get_exclusive(dev, NULL); + if (IS_ERR(gbeth->rstc)) + return PTR_ERR(gbeth->rstc); + + gbeth->dev = dev; + gbeth->regs = stmmac_res.addr; + gbeth->plat_dat = plat_dat; + plat_dat->bsp_priv = gbeth; + plat_dat->set_clk_tx_rate = stmmac_set_clk_tx_rate; + plat_dat->clks_config = renesas_gbeth_clks_config; + plat_dat->flags |= STMMAC_FLAG_HWTSTAMP_CORRECT_LATENCY | + STMMAC_FLAG_EN_TX_LPI_CLK_PHY_CAP | + STMMAC_FLAG_SPH_DISABLE; + + err = renesas_gbeth_clks_config(gbeth, true); + if (err) + return err; + + err = stmmac_dvr_probe(dev, plat_dat, &stmmac_res); + if (err) + renesas_gbeth_clks_config(gbeth, false); + + return err; +} + +static void renesas_gbeth_remove(struct platform_device *pdev) +{ + stmmac_dvr_remove(&pdev->dev); + + renesas_gbeth_clks_config(get_stmmac_bsp_priv(&pdev->dev), false); +} + +static const struct of_device_id renesas_gbeth_match[] = { + { .compatible = "renesas,rzv2h-gbeth", }, + { /* Sentinel */ } +}; +MODULE_DEVICE_TABLE(of, renesas_gbeth_match); + +static struct platform_driver renesas_gbeth_driver = { + .probe = renesas_gbeth_probe, + .remove = renesas_gbeth_remove, + .driver = { + .name = "renesas-gbeth", + .pm = &stmmac_pltfr_pm_ops, + .of_match_table = renesas_gbeth_match, + }, +}; +module_platform_driver(renesas_gbeth_driver); + +MODULE_AUTHOR("Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>"); +MODULE_DESCRIPTION("Renesas GBETH DWMAC Specific Glue layer"); +MODULE_LICENSE("GPL");