Message ID | 20230331205759.92309-2-shenwei.wang@nxp.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v3,1/2] net: stmmac: add support for platform specific reset | expand |
Hi Shenwei, On Fri, Mar 31, 2023 at 5:58 PM Shenwei Wang <shenwei.wang@nxp.com> wrote: > > The patch addresses an issue with the reset logic on the i.MX93 SoC, which > requires configuration of the correct interface speed under RMII mode to > complete the reset. The patch implements a fix_soc_reset function and uses > it specifically for the i.MX93 SoCs. > > Signed-off-by: Shenwei Wang <shenwei.wang@nxp.com> > --- > .../net/ethernet/stmicro/stmmac/dwmac-imx.c | 29 ++++++++++++++++++- > 1 file changed, 28 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c > index ac8580f501e2..3dfd13840535 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c > +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c > @@ -19,9 +19,9 @@ > #include <linux/pm_wakeirq.h> > #include <linux/regmap.h> > #include <linux/slab.h> > -#include <linux/stmmac.h> > > #include "stmmac_platform.h" > +#include "common.h" These changes in the header seem to be unrelated. Apart from that: Reviewed-by: Fabio Estevam <festevam@gmail.com>
> -----Original Message----- > From: Fabio Estevam <festevam@gmail.com> > Sent: Friday, March 31, 2023 4:08 PM > To: Shenwei Wang <shenwei.wang@nxp.com> > Cc: David S. Miller <davem@davemloft.net>; Eric Dumazet > <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>; Paolo Abeni > <pabeni@redhat.com>; Maxime Coquelin <mcoquelin.stm32@gmail.com>; > Shawn Guo <shawnguo@kernel.org>; Sascha Hauer <s.hauer@pengutronix.de>; > Giuseppe Cavallaro <peppe.cavallaro@st.com>; Alexandre Torgue > <alexandre.torgue@foss.st.com>; Jose Abreu <joabreu@synopsys.com>; > Pengutronix Kernel Team <kernel@pengutronix.de>; dl-linux-imx <linux- > imx@nxp.com>; Wong Vee Khee <veekhee@apple.com>; Tan Tee Min > <tee.min.tan@linux.intel.com>; Revanth Kumar Uppala <ruppala@nvidia.com>; > Jon Hunter <jonathanh@nvidia.com>; Andrey Konovalov > <andrey.konovalov@linaro.org>; netdev@vger.kernel.org; linux-stm32@st-md- > mailman.stormreply.com; linux-arm-kernel@lists.infradead.org; > imx@lists.linux.dev > Subject: [EXT] Re: [PATCH v3 2/2] net: stmmac: dwmac-imx: use platform > specific reset for imx93 SoCs > > Caution: EXT Email > > Hi Shenwei, > > On Fri, Mar 31, 2023 at 5:58 PM Shenwei Wang <shenwei.wang@nxp.com> > wrote: > > > > The patch addresses an issue with the reset logic on the i.MX93 SoC, > > which requires configuration of the correct interface speed under RMII > > mode to complete the reset. The patch implements a fix_soc_reset > > function and uses it specifically for the i.MX93 SoCs. > > > > Signed-off-by: Shenwei Wang <shenwei.wang@nxp.com> > > --- > > .../net/ethernet/stmicro/stmmac/dwmac-imx.c | 29 ++++++++++++++++++- > > 1 file changed, 28 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c > > b/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c > > index ac8580f501e2..3dfd13840535 100644 > > --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c > > +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c > > @@ -19,9 +19,9 @@ > > #include <linux/pm_wakeirq.h> > > #include <linux/regmap.h> > > #include <linux/slab.h> > > -#include <linux/stmmac.h> > > > > #include "stmmac_platform.h" > > +#include "common.h" > > These changes in the header seem to be unrelated. > You are right. Will fixed. Thanks, Shenwei > Apart from that: > > Reviewed-by: Fabio Estevam <festevam@gmail.com>
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c index ac8580f501e2..3dfd13840535 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c @@ -19,9 +19,9 @@ #include <linux/pm_wakeirq.h> #include <linux/regmap.h> #include <linux/slab.h> -#include <linux/stmmac.h> #include "stmmac_platform.h" +#include "common.h" #define GPR_ENET_QOS_INTF_MODE_MASK GENMASK(21, 16) #define GPR_ENET_QOS_INTF_SEL_MII (0x0 << 16) @@ -37,10 +37,15 @@ #define MX93_GPR_ENET_QOS_INTF_SEL_RGMII (0x1 << 1) #define MX93_GPR_ENET_QOS_CLK_GEN_EN (0x1 << 0) +#define DMA_BUS_MODE 0x00001000 +#define DMA_BUS_MODE_SFT_RESET (0x1 << 0) +#define RMII_RESET_SPEED (0x3 << 14) + struct imx_dwmac_ops { u32 addr_width; bool mac_rgmii_txclk_auto_adj; + int (*fix_soc_reset)(void *priv, void __iomem *ioaddr); int (*set_intf_mode)(struct plat_stmmacenet_data *plat_dat); }; @@ -207,6 +212,25 @@ static void imx_dwmac_fix_speed(void *priv, unsigned int speed) dev_err(dwmac->dev, "failed to set tx rate %lu\n", rate); } +static int imx_dwmac_mx93_reset(void *priv, void __iomem *ioaddr) +{ + u32 value = readl(ioaddr + DMA_BUS_MODE); + struct plat_stmmacenet_data *plat_dat = priv; + + /* DMA SW reset */ + value |= DMA_BUS_MODE_SFT_RESET; + writel(value, ioaddr + DMA_BUS_MODE); + + if (plat_dat->interface == PHY_INTERFACE_MODE_RMII) { + usleep_range(100, 200); + writel(RMII_RESET_SPEED, ioaddr + MAC_CTRL_REG); + } + + return readl_poll_timeout(ioaddr + DMA_BUS_MODE, value, + !(value & DMA_BUS_MODE_SFT_RESET), + 10000, 1000000); +} + static int imx_dwmac_parse_dt(struct imx_priv_data *dwmac, struct device *dev) { @@ -305,6 +329,8 @@ static int imx_dwmac_probe(struct platform_device *pdev) if (ret) goto err_dwmac_init; + dwmac->plat_dat->fix_soc_reset = dwmac->ops->fix_soc_reset; + ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res); if (ret) goto err_drv_probe; @@ -338,6 +364,7 @@ static struct imx_dwmac_ops imx93_dwmac_data = { .addr_width = 32, .mac_rgmii_txclk_auto_adj = true, .set_intf_mode = imx93_set_intf_mode, + .fix_soc_reset = imx_dwmac_mx93_reset, }; static const struct of_device_id imx_dwmac_match[] = {
The patch addresses an issue with the reset logic on the i.MX93 SoC, which requires configuration of the correct interface speed under RMII mode to complete the reset. The patch implements a fix_soc_reset function and uses it specifically for the i.MX93 SoCs. Signed-off-by: Shenwei Wang <shenwei.wang@nxp.com> --- .../net/ethernet/stmicro/stmmac/dwmac-imx.c | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-)