[PATCH 1/3] net: eqos: rename i.MX8 driver glue code to i.MX

Ahmad Fatoum a.fatoum at pengutronix.de
Sun Nov 12 23:19:23 PST 2023


On 10.11.23 14:02, Sascha Hauer wrote:
> The i.MX8 glue code for the designware ethernet driver will be used by
> i.MX9 as well. Rename the file accordingly.
> 
> Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
> ---
>  arch/arm/configs/imx_v8_defconfig             |  2 +-
>  arch/arm/configs/multi_v8_defconfig           |  2 +-
>  drivers/net/Kconfig                           |  6 +-
>  drivers/net/Makefile                          |  2 +-
>  .../{designware_imx8.c => designware_imx.c}   | 58 +++++++++----------
>  5 files changed, 35 insertions(+), 35 deletions(-)
>  rename drivers/net/{designware_imx8.c => designware_imx.c} (73%)
> 
> diff --git a/arch/arm/configs/imx_v8_defconfig b/arch/arm/configs/imx_v8_defconfig
> index 8084e72ea0..66dab8c4a7 100644
> --- a/arch/arm/configs/imx_v8_defconfig
> +++ b/arch/arm/configs/imx_v8_defconfig
> @@ -92,7 +92,7 @@ CONFIG_NET_NETCONSOLE=y
>  CONFIG_OFDEVICE=y
>  CONFIG_OF_BAREBOX_DRIVERS=y
>  CONFIG_SERIAL_DEV_BUS=y
> -CONFIG_DRIVER_NET_DESIGNWARE_IMX8=y
> +CONFIG_DRIVER_NET_DESIGNWARE_IMX=y
>  CONFIG_DRIVER_NET_FEC_IMX=y
>  CONFIG_DP83867_PHY=y
>  CONFIG_MICREL_PHY=y
> diff --git a/arch/arm/configs/multi_v8_defconfig b/arch/arm/configs/multi_v8_defconfig
> index 9c538e698d..2599519351 100644
> --- a/arch/arm/configs/multi_v8_defconfig
> +++ b/arch/arm/configs/multi_v8_defconfig
> @@ -141,7 +141,7 @@ CONFIG_SERIAL_AMBA_PL011=y
>  CONFIG_DRIVER_SERIAL_NS16550=y
>  CONFIG_DRIVER_SERIAL_CADENCE=y
>  CONFIG_VIRTIO_CONSOLE=y
> -CONFIG_DRIVER_NET_DESIGNWARE_IMX8=y
> +CONFIG_DRIVER_NET_DESIGNWARE_IMX=y
>  CONFIG_DRIVER_NET_DESIGNWARE_ROCKCHIP=y
>  CONFIG_DRIVER_NET_FEC_IMX=y
>  CONFIG_DRIVER_NET_MACB=y
> diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
> index 1c89cf9e41..9be03cf20c 100644
> --- a/drivers/net/Kconfig
> +++ b/drivers/net/Kconfig
> @@ -107,14 +107,14 @@ config DRIVER_NET_DESIGNWARE_EQOS
>  	  This option enables support for the Synopsys
>  	  Designware Ethernet Quality-of-Service (GMAC4).
>  
> -config DRIVER_NET_DESIGNWARE_IMX8
> -	bool "Designware EQOS i.MX8 Ethernet driver"
> +config DRIVER_NET_DESIGNWARE_IMX
> +	bool "Designware EQOS i.MX Ethernet driver"
>  	depends on HAS_DMA && COMMON_CLK && OFTREE && (ARCH_IMX8M || COMPILE_TEST)
>  	select DRIVER_NET_DESIGNWARE_EQOS
>  	select MFD_SYSCON

Please add an imply of a def_bool, so existing users with i.MX8MP defconfigs
don't lose driver support on an olddefconfig.

>  	help
>  	  This option enables support for the Designware EQOS MAC implemented on
> -	  the NXP i.MX8 SoCs.
> +	  the NXP i.MX SoCs.
>  
>  config DRIVER_NET_DESIGNWARE_STM32
>  	bool "STM32 Designware Ethernet driver"
> diff --git a/drivers/net/Makefile b/drivers/net/Makefile
> index 1a272d9158..697b5bdfb7 100644
> --- a/drivers/net/Makefile
> +++ b/drivers/net/Makefile
> @@ -15,7 +15,7 @@ obj-$(CONFIG_DRIVER_NET_DESIGNWARE_GENERIC) += designware_generic.o
>  obj-$(CONFIG_DRIVER_NET_DESIGNWARE_SOCFPGA) += designware_socfpga.o
>  obj-$(CONFIG_DRIVER_NET_DESIGNWARE_STARFIVE) += designware_starfive.o
>  obj-$(CONFIG_DRIVER_NET_DESIGNWARE_EQOS) += designware_eqos.o
> -obj-$(CONFIG_DRIVER_NET_DESIGNWARE_IMX8) += designware_imx8.o
> +obj-$(CONFIG_DRIVER_NET_DESIGNWARE_IMX) += designware_imx.o
>  obj-$(CONFIG_DRIVER_NET_DESIGNWARE_STM32) += designware_stm32.o
>  obj-$(CONFIG_DRIVER_NET_DESIGNWARE_TEGRA186) += designware_tegra186.o
>  obj-$(CONFIG_DRIVER_NET_DESIGNWARE_ROCKCHIP) += designware_rockchip.o
> diff --git a/drivers/net/designware_imx8.c b/drivers/net/designware_imx.c
> similarity index 73%
> rename from drivers/net/designware_imx8.c
> rename to drivers/net/designware_imx.c
> index 73a16d5e65..00164fa7c7 100644
> --- a/drivers/net/designware_imx8.c
> +++ b/drivers/net/designware_imx.c
> @@ -18,7 +18,7 @@
>  #define GPR_ENET_QOS_RGMII_EN		BIT(21)
>  
>  
> -struct eqos_imx8_priv {
> +struct eqos_imx_priv {
>  	struct device *dev;
>  	struct clk_bulk_data *clks;
>  	int num_clks;
> @@ -28,25 +28,25 @@ struct eqos_imx8_priv {
>  };
>  
>  enum { CLK_STMMACETH, CLK_PCLK, CLK_PTP_REF, CLK_TX};
> -static const struct clk_bulk_data imx8_clks[] = {
> +static const struct clk_bulk_data imx_clks[] = {
>  	[CLK_STMMACETH] = { .id = "stmmaceth" },
>  	[CLK_PCLK]      = { .id = "pclk" },
>  	[CLK_PTP_REF]   = { .id = "ptp_ref" },
>  	[CLK_TX]        = { .id = "tx" },
>  };
>  
> -static unsigned long eqos_get_csr_clk_rate_imx8(struct eqos *eqos)
> +static unsigned long eqos_get_csr_clk_rate_imx(struct eqos *eqos)
>  {
> -	struct eqos_imx8_priv *priv = eqos->priv;
> +	struct eqos_imx_priv *priv = eqos->priv;
>  
>  	return clk_get_rate(priv->clks[CLK_PCLK].clk);
>  }
>  
>  
> -static void eqos_adjust_link_imx8(struct eth_device *edev)
> +static void eqos_adjust_link_imx(struct eth_device *edev)
>  {
>  	struct eqos *eqos = edev->priv;
> -	struct eqos_imx8_priv *priv = eqos->priv;
> +	struct eqos_imx_priv *priv = eqos->priv;
>  	unsigned long rate;
>  	int ret;
>  
> @@ -74,9 +74,9 @@ static void eqos_adjust_link_imx8(struct eth_device *edev)
>  	eqos_adjust_link(edev);
>  }
>  
> -static void eqos_imx8_set_interface_mode(struct eqos *eqos)
> +static void eqos_imx_set_interface_mode(struct eqos *eqos)
>  {
> -	struct eqos_imx8_priv *priv = eqos->priv;
> +	struct eqos_imx_priv *priv = eqos->priv;
>  	struct device_node *np = priv->dev->device_node;
>  	int val;
>  
> @@ -109,10 +109,10 @@ static void eqos_imx8_set_interface_mode(struct eqos *eqos)
>  			   GPR_ENET_QOS_INTF_MODE_MASK, val);
>  }
>  
> -static int eqos_init_imx8(struct device *dev, struct eqos *eqos)
> +static int eqos_init_imx(struct device *dev, struct eqos *eqos)
>  {
>  	struct device_node *np = dev->device_node;
> -	struct eqos_imx8_priv *priv = eqos->priv;
> +	struct eqos_imx_priv *priv = eqos->priv;
>  	int ret;
>  
>  	priv->dev = dev;
> @@ -132,9 +132,9 @@ static int eqos_init_imx8(struct device *dev, struct eqos *eqos)
>  		}
>  	}
>  
> -	priv->num_clks = ARRAY_SIZE(imx8_clks);
> +	priv->num_clks = ARRAY_SIZE(imx_clks);
>  	priv->clks = xmalloc(priv->num_clks * sizeof(*priv->clks));
> -	memcpy(priv->clks, imx8_clks, sizeof imx8_clks);
> +	memcpy(priv->clks, imx_clks, sizeof imx_clks);
>  
>  	ret = clk_bulk_get(dev, priv->num_clks, priv->clks);
>  	if (ret) {
> @@ -148,31 +148,31 @@ static int eqos_init_imx8(struct device *dev, struct eqos *eqos)
>  		return ret;
>  	}
>  
> -	eqos_imx8_set_interface_mode(eqos);
> +	eqos_imx_set_interface_mode(eqos);
>  
>  	return 0;
>  }
>  
> -static struct eqos_ops imx8_ops = {
> -	.init = eqos_init_imx8,
> +static struct eqos_ops imx_ops = {
> +	.init = eqos_init_imx,
>  	.get_ethaddr = eqos_get_ethaddr,
>  	.set_ethaddr = eqos_set_ethaddr,
> -	.adjust_link = eqos_adjust_link_imx8,
> -	.get_csr_clk_rate = eqos_get_csr_clk_rate_imx8,
> +	.adjust_link = eqos_adjust_link_imx,
> +	.get_csr_clk_rate = eqos_get_csr_clk_rate_imx,
>  
>  	.clk_csr = EQOS_MDIO_ADDR_CR_250_300,
>  	.config_mac = EQOS_MAC_RXQ_CTRL0_RXQ0EN_ENABLED_DCB,
>  };
>  
> -static int eqos_probe_imx8(struct device *dev)
> +static int eqos_probe_imx(struct device *dev)
>  {
> -	return eqos_probe(dev, &imx8_ops, xzalloc(sizeof(struct eqos_imx8_priv)));
> +	return eqos_probe(dev, &imx_ops, xzalloc(sizeof(struct eqos_imx_priv)));
>  }
>  
> -static void eqos_remove_imx8(struct device *dev)
> +static void eqos_remove_imx(struct device *dev)
>  {
>  	struct eqos *eqos = dev->priv;
> -	struct eqos_imx8_priv *priv = eqos->priv;
> +	struct eqos_imx_priv *priv = eqos->priv;
>  
>  	eqos_remove(dev);
>  
> @@ -180,16 +180,16 @@ static void eqos_remove_imx8(struct device *dev)
>  	clk_bulk_put(priv->num_clks, priv->clks);
>  }
>  
> -static __maybe_unused struct of_device_id eqos_imx8_ids[] = {
> +static __maybe_unused struct of_device_id eqos_imx_ids[] = {
>  	{ .compatible = "nxp,imx8mp-dwmac-eqos"},
>  	{ /* sentinel */ }
>  };
> -MODULE_DEVICE_TABLE(of, eqos_imx8_ids);
> +MODULE_DEVICE_TABLE(of, eqos_imx_ids);
>  
> -static struct driver eqos_imx8_driver = {
> -	.name = "eqos-imx8",
> -	.probe = eqos_probe_imx8,
> -	.remove = eqos_remove_imx8,
> -	.of_compatible = DRV_OF_COMPAT(eqos_imx8_ids),
> +static struct driver eqos_imx_driver = {
> +	.name = "eqos-imx",
> +	.probe = eqos_probe_imx,
> +	.remove = eqos_remove_imx,
> +	.of_compatible = DRV_OF_COMPAT(eqos_imx_ids),
>  };
> -device_platform_driver(eqos_imx8_driver);
> +device_platform_driver(eqos_imx_driver);

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |




More information about the barebox mailing list