devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peng Fan <peng.fan@oss.nxp.com>
To: Clark Wang <xiaoning.wang@nxp.com>,
	wei.fang@nxp.com, shenwei.wang@nxp.com, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org,
	shawnguo@kernel.org, s.hauer@pengutronix.de, festevam@gmail.com,
	peppe.cavallaro@st.com, alexandre.torgue@foss.st.com,
	joabreu@synopsys.com, mcoquelin.stm32@gmail.com,
	richardcochran@gmail.com
Cc: linux-imx@nxp.com, kernel@pengutronix.de, netdev@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-stm32@st-md-mailman.stormreply.com
Subject: Re: [PATCH V2 1/7] net: stmmac: add imx93 platform support
Date: Mon, 16 Jan 2023 08:51:32 +0800	[thread overview]
Message-ID: <0a1f5f9f-7ff7-2b23-2c1a-9ccb1e944ad1@oss.nxp.com> (raw)
In-Reply-To: <20230113033347.264135-2-xiaoning.wang@nxp.com>



On 1/13/2023 11:33 AM, Clark Wang wrote:
> Add imx93 platform support for dwmac-imx driver.
> 
> Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>

Reviewed-by: Peng Fan <peng.fan@nxp.com>

> ---
> V2 change:
>   - change pr_debug() to dev_dbg()
> ---
>   .../net/ethernet/stmicro/stmmac/dwmac-imx.c   | 55 +++++++++++++++++--
>   1 file changed, 50 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c
> index bd52fb7cf486..a7ea69d81c11 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c
> @@ -31,6 +31,12 @@
>   #define GPR_ENET_QOS_CLK_TX_CLK_SEL	(0x1 << 20)
>   #define GPR_ENET_QOS_RGMII_EN		(0x1 << 21)
>   
> +#define MX93_GPR_ENET_QOS_INTF_MODE_MASK	GENMASK(3, 0)
> +#define MX93_GPR_ENET_QOS_INTF_SEL_MII		(0x0 << 1)
> +#define MX93_GPR_ENET_QOS_INTF_SEL_RMII		(0x4 << 1)
> +#define MX93_GPR_ENET_QOS_INTF_SEL_RGMII	(0x1 << 1)
> +#define MX93_GPR_ENET_QOS_CLK_GEN_EN		(0x1 << 0)
> +
>   struct imx_dwmac_ops {
>   	u32 addr_width;
>   	bool mac_rgmii_txclk_auto_adj;
> @@ -90,6 +96,35 @@ imx8dxl_set_intf_mode(struct plat_stmmacenet_data *plat_dat)
>   	return ret;
>   }
>   
> +static int imx93_set_intf_mode(struct plat_stmmacenet_data *plat_dat)
> +{
> +	struct imx_priv_data *dwmac = plat_dat->bsp_priv;
> +	int val;
> +
> +	switch (plat_dat->interface) {
> +	case PHY_INTERFACE_MODE_MII:
> +		val = MX93_GPR_ENET_QOS_INTF_SEL_MII;
> +		break;
> +	case PHY_INTERFACE_MODE_RMII:
> +		val = MX93_GPR_ENET_QOS_INTF_SEL_RMII;
> +		break;
> +	case PHY_INTERFACE_MODE_RGMII:
> +	case PHY_INTERFACE_MODE_RGMII_ID:
> +	case PHY_INTERFACE_MODE_RGMII_RXID:
> +	case PHY_INTERFACE_MODE_RGMII_TXID:
> +		val = MX93_GPR_ENET_QOS_INTF_SEL_RGMII;
> +		break;
> +	default:
> +		dev_dbg(dwmac->dev, "imx dwmac doesn't support %d interface\n",
> +			 plat_dat->interface);
> +		return -EINVAL;
> +	}
> +
> +	val |= MX93_GPR_ENET_QOS_CLK_GEN_EN;
> +	return regmap_update_bits(dwmac->intf_regmap, dwmac->intf_reg_off,
> +				  MX93_GPR_ENET_QOS_INTF_MODE_MASK, val);
> +};
> +
>   static int imx_dwmac_clks_config(void *priv, bool enabled)
>   {
>   	struct imx_priv_data *dwmac = priv;
> @@ -188,7 +223,9 @@ imx_dwmac_parse_dt(struct imx_priv_data *dwmac, struct device *dev)
>   	}
>   
>   	dwmac->clk_mem = NULL;
> -	if (of_machine_is_compatible("fsl,imx8dxl")) {
> +
> +	if (of_machine_is_compatible("fsl,imx8dxl") ||
> +	    of_machine_is_compatible("fsl,imx93")) {
>   		dwmac->clk_mem = devm_clk_get(dev, "mem");
>   		if (IS_ERR(dwmac->clk_mem)) {
>   			dev_err(dev, "failed to get mem clock\n");
> @@ -196,10 +233,11 @@ imx_dwmac_parse_dt(struct imx_priv_data *dwmac, struct device *dev)
>   		}
>   	}
>   
> -	if (of_machine_is_compatible("fsl,imx8mp")) {
> -		/* Binding doc describes the property:
> -		   is required by i.MX8MP.
> -		   is optional for i.MX8DXL.
> +	if (of_machine_is_compatible("fsl,imx8mp") ||
> +	    of_machine_is_compatible("fsl,imx93")) {
> +		/* Binding doc describes the propety:
> +		 * is required by i.MX8MP, i.MX93.
> +		 * is optinoal for i.MX8DXL.
>   		 */
>   		dwmac->intf_regmap = syscon_regmap_lookup_by_phandle(np, "intf_mode");
>   		if (IS_ERR(dwmac->intf_regmap))
> @@ -296,9 +334,16 @@ static struct imx_dwmac_ops imx8dxl_dwmac_data = {
>   	.set_intf_mode = imx8dxl_set_intf_mode,
>   };
>   
> +static struct imx_dwmac_ops imx93_dwmac_data = {
> +	.addr_width = 32,
> +	.mac_rgmii_txclk_auto_adj = true,
> +	.set_intf_mode = imx93_set_intf_mode,
> +};
> +
>   static const struct of_device_id imx_dwmac_match[] = {
>   	{ .compatible = "nxp,imx8mp-dwmac-eqos", .data = &imx8mp_dwmac_data },
>   	{ .compatible = "nxp,imx8dxl-dwmac-eqos", .data = &imx8dxl_dwmac_data },
> +	{ .compatible = "nxp,imx93-dwmac-eqos", .data = &imx93_dwmac_data },
>   	{ }
>   };
>   MODULE_DEVICE_TABLE(of, imx_dwmac_match);

  reply	other threads:[~2023-01-16  0:51 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-13  3:33 [PATCH V2 0/7] Add eqos and fec support for imx93 Clark Wang
2023-01-13  3:33 ` [PATCH V2 1/7] net: stmmac: add imx93 platform support Clark Wang
2023-01-16  0:51   ` Peng Fan [this message]
2023-01-13  3:33 ` [PATCH V2 2/7] dt-bindings: add mx93 description Clark Wang
2023-01-13  3:33 ` [PATCH V2 3/7] dt-bindings: net: fec: " Clark Wang
2023-01-13 12:11   ` Krzysztof Kozlowski
2023-01-13  3:33 ` [PATCH V2 4/7] arm64: dts: imx93: add eqos support Clark Wang
2023-01-16  0:52   ` Peng Fan
2023-01-13  3:33 ` [PATCH V2 5/7] arm64: dts: imx93: add FEC support Clark Wang
2023-01-16  0:52   ` Peng Fan
2023-01-13  3:33 ` [PATCH V2 6/7] arm64: dts: imx93-11x11-evk: enable eqos Clark Wang
2023-01-16  0:52   ` Peng Fan
2023-01-13  3:33 ` [PATCH V2 7/7] arm64: dts: imx93-11x11-evk: enable fec function Clark Wang
2023-01-16  0:53   ` Peng Fan
2023-01-17  8:27 ` [PATCH V2 0/7] Add eqos and fec support for imx93 Paolo Abeni
2023-01-26  1:02   ` Shawn Guo
2023-01-18 13:10 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0a1f5f9f-7ff7-2b23-2c1a-9ccb1e944ad1@oss.nxp.com \
    --to=peng.fan@oss.nxp.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@google.com \
    --cc=festevam@gmail.com \
    --cc=joabreu@synopsys.com \
    --cc=kernel@pengutronix.de \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=peppe.cavallaro@st.com \
    --cc=richardcochran@gmail.com \
    --cc=robh+dt@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    --cc=shenwei.wang@nxp.com \
    --cc=wei.fang@nxp.com \
    --cc=xiaoning.wang@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).