Netdev Archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 net-next 0/2] update stmmac fix_mac_speed
@ 2023-08-04 14:46 Shenwei Wang
  2023-08-04 14:46 ` [PATCH v4 net-next 1/2] net: stmmac: add new mode parameter for fix_mac_speed Shenwei Wang
  2023-08-04 14:46 ` [PATCH v4 net-next 2/2] net: stmmac: dwmac-imx: pause the TXC clock in fixed-link Shenwei Wang
  0 siblings, 2 replies; 6+ messages in thread
From: Shenwei Wang @ 2023-08-04 14:46 UTC (permalink / raw
  To: Marc Kleine-Budde, Russell King, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Maxime Coquelin, Shawn Guo,
	Sascha Hauer, Neil Armstrong, Kevin Hilman, Vinod Koul,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland
  Cc: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Jerome Brunet, Martin Blumenstingl, Bhupesh Sharma,
	Nobuhiro Iwamatsu, Simon Horman, Andrew Halaney,
	Bartosz Golaszewski, Shenwei Wang, Wong Vee Khee,
	Revanth Kumar Uppala, Jochen Henneberg, netdev, linux-stm32,
	linux-arm-kernel, linux-kernel, linux-amlogic, imx

Changes in V4:
  - Keep the 'unsigned int' type specifier in the fix_mac_speed
    function declarations.
  - Move imx93_dwmac_fix_mac_speed into the SoC specific ops.
  - Use a read back to replace the wmb() instruction.
  - Correct the target to 'net-next'.

Changes in V3:
  - fixed the build errors reported by 'kernel test robot'.
  - Only perform clock pause in RGMII fixed-link usecase.

Changes in V2:
  - Call fix_mac_speed() with new mode parameter added.
  - reorg the function of imx_dwmac_fix_speed_mx93 by using the
    mode parameter.

Shenwei Wang (2):
  net: stmmac: add new mode parameter for fix_mac_speed
  net: stmmac: dwmac-imx: pause the TXC clock in fixed-link

 .../stmicro/stmmac/dwmac-dwc-qos-eth.c        |  2 +-
 .../net/ethernet/stmicro/stmmac/dwmac-imx.c   | 45 ++++++++++++++++++-
 .../stmicro/stmmac/dwmac-intel-plat.c         |  4 +-
 .../ethernet/stmicro/stmmac/dwmac-ipq806x.c   |  2 +-
 .../net/ethernet/stmicro/stmmac/dwmac-meson.c |  2 +-
 .../stmicro/stmmac/dwmac-qcom-ethqos.c        |  2 +-
 .../net/ethernet/stmicro/stmmac/dwmac-rk.c    |  2 +-
 .../ethernet/stmicro/stmmac/dwmac-socfpga.c   |  2 +-
 .../ethernet/stmicro/stmmac/dwmac-starfive.c  |  2 +-
 .../net/ethernet/stmicro/stmmac/dwmac-sunxi.c |  2 +-
 .../ethernet/stmicro/stmmac/dwmac-visconti.c  |  2 +-
 .../net/ethernet/stmicro/stmmac/stmmac_main.c |  2 +-
 include/linux/stmmac.h                        |  2 +-
 13 files changed, 57 insertions(+), 14 deletions(-)

--
2.34.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v4 net-next 1/2] net: stmmac: add new mode parameter for fix_mac_speed
  2023-08-04 14:46 [PATCH v4 net-next 0/2] update stmmac fix_mac_speed Shenwei Wang
@ 2023-08-04 14:46 ` Shenwei Wang
  2023-08-06  2:48   ` kernel test robot
  2023-08-04 14:46 ` [PATCH v4 net-next 2/2] net: stmmac: dwmac-imx: pause the TXC clock in fixed-link Shenwei Wang
  1 sibling, 1 reply; 6+ messages in thread
From: Shenwei Wang @ 2023-08-04 14:46 UTC (permalink / raw
  To: Marc Kleine-Budde, Russell King, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Maxime Coquelin, Shawn Guo,
	Sascha Hauer, Neil Armstrong, Kevin Hilman, Vinod Koul,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland
  Cc: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Jerome Brunet, Martin Blumenstingl, Bhupesh Sharma,
	Nobuhiro Iwamatsu, Simon Horman, Andrew Halaney,
	Bartosz Golaszewski, Shenwei Wang, Wong Vee Khee,
	Revanth Kumar Uppala, Jochen Henneberg, netdev, linux-stm32,
	linux-arm-kernel, linux-kernel, linux-amlogic, imx

A mode parameter has been added to the callback function of fix_mac_speed
to indicate the physical layer type.

The mode can be one the following:
	MLO_AN_PHY	- Conventional PHY
	MLO_AN_FIXED	- Fixed-link mode
	MLO_AN_INBAND	- In-band protocol

Signed-off-by: Shenwei Wang <shenwei.wang@nxp.com>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c | 2 +-
 drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c         | 2 +-
 drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c  | 4 ++--
 drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c     | 2 +-
 drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c       | 2 +-
 drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 2 +-
 drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c          | 2 +-
 drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c     | 2 +-
 drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c    | 2 +-
 drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c       | 2 +-
 drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c    | 2 +-
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c       | 2 +-
 include/linux/stmmac.h                                  | 2 +-
 13 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
index b5efd9c2eac7..55162d798319 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
@@ -178,7 +178,7 @@ static void dwc_qos_remove(struct platform_device *pdev)
 #define AUTO_CAL_STATUS 0x880c
 #define  AUTO_CAL_STATUS_ACTIVE BIT(31)
 
-static void tegra_eqos_fix_speed(void *priv, unsigned int speed)
+static void tegra_eqos_fix_speed(void *priv, unsigned int speed, unsigned int mode)
 {
 	struct tegra_eqos *eqos = priv;
 	unsigned long rate = 125000000;
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c
index b9378a63f0e8..3eb6b4457494 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c
@@ -178,7 +178,7 @@ static void imx_dwmac_exit(struct platform_device *pdev, void *priv)
 	/* nothing to do now */
 }
 
-static void imx_dwmac_fix_speed(void *priv, unsigned int speed)
+static void imx_dwmac_fix_speed(void *priv, unsigned int speed, unsigned int mode)
 {
 	struct plat_stmmacenet_data *plat_dat;
 	struct imx_priv_data *dwmac = priv;
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c
index a5e639ab0b9e..d352a14f9d48 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c
@@ -22,13 +22,13 @@ struct intel_dwmac {
 };
 
 struct intel_dwmac_data {
-	void (*fix_mac_speed)(void *priv, unsigned int speed);
+	void (*fix_mac_speed)(void *priv, unsigned int speed, unsigned int mode);
 	unsigned long ptp_ref_clk_rate;
 	unsigned long tx_clk_rate;
 	bool tx_clk_en;
 };
 
-static void kmb_eth_fix_mac_speed(void *priv, unsigned int speed)
+static void kmb_eth_fix_mac_speed(void *priv, unsigned int speed, unsigned int mode)
 {
 	struct intel_dwmac *dwmac = priv;
 	unsigned long rate;
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c
index e39406df8516..9b0200749109 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c
@@ -257,7 +257,7 @@ static int ipq806x_gmac_of_parse(struct ipq806x_gmac *gmac)
 	return PTR_ERR_OR_ZERO(gmac->qsgmii_csr);
 }
 
-static void ipq806x_gmac_fix_mac_speed(void *priv, unsigned int speed)
+static void ipq806x_gmac_fix_mac_speed(void *priv, unsigned int speed, unsigned int mode)
 {
 	struct ipq806x_gmac *gmac = priv;
 
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c
index 7aa5e6bc04eb..959f88c6da16 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c
@@ -22,7 +22,7 @@ struct meson_dwmac {
 	void __iomem	*reg;
 };
 
-static void meson6_dwmac_fix_mac_speed(void *priv, unsigned int speed)
+static void meson6_dwmac_fix_mac_speed(void *priv, unsigned int speed, unsigned int mode)
 {
 	struct meson_dwmac *dwmac = priv;
 	unsigned int val;
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
index 735525ba8b93..405ab645f1cb 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
@@ -631,7 +631,7 @@ static int ethqos_configure(struct qcom_ethqos *ethqos)
 	return ethqos->configure_func(ethqos);
 }
 
-static void ethqos_fix_mac_speed(void *priv, unsigned int speed)
+static void ethqos_fix_mac_speed(void *priv, unsigned int speed, unsigned int mode)
 {
 	struct qcom_ethqos *ethqos = priv;
 
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
index d81591b470a2..91553475c38b 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
@@ -1785,7 +1785,7 @@ static void rk_gmac_powerdown(struct rk_priv_data *gmac)
 	gmac_clk_enable(gmac, false);
 }
 
-static void rk_fix_speed(void *priv, unsigned int speed)
+static void rk_fix_speed(void *priv, unsigned int speed, unsigned int mode)
 {
 	struct rk_priv_data *bsp_priv = priv;
 	struct device *dev = &bsp_priv->pdev->dev;
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
index 6267bcb60206..7db176e8691f 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
@@ -61,7 +61,7 @@ struct socfpga_dwmac {
 	struct mdio_device *pcs_mdiodev;
 };
 
-static void socfpga_dwmac_fix_mac_speed(void *priv, unsigned int speed)
+static void socfpga_dwmac_fix_mac_speed(void *priv, unsigned int speed, unsigned int mode)
 {
 	struct socfpga_dwmac *dwmac = (struct socfpga_dwmac *)priv;
 	void __iomem *splitter_base = dwmac->splitter_base;
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c
index d3a39d2fb3a9..9c700590bf25 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c
@@ -22,7 +22,7 @@ struct starfive_dwmac {
 	struct clk *clk_tx;
 };
 
-static void starfive_dwmac_fix_mac_speed(void *priv, unsigned int speed)
+static void starfive_dwmac_fix_mac_speed(void *priv, unsigned int speed, unsigned int mode)
 {
 	struct starfive_dwmac *dwmac = priv;
 	unsigned long rate;
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c
index 50963e91c347..beceeae579bf 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c
@@ -72,7 +72,7 @@ static void sun7i_gmac_exit(struct platform_device *pdev, void *priv)
 		regulator_disable(gmac->regulator);
 }
 
-static void sun7i_fix_speed(void *priv, unsigned int speed)
+static void sun7i_fix_speed(void *priv, unsigned int speed, unsigned int mode)
 {
 	struct sunxi_priv_data *gmac = priv;
 
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c
index acbb284be174..ae2a0ff664c1 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c
@@ -53,7 +53,7 @@ struct visconti_eth {
 	spinlock_t lock; /* lock to protect register update */
 };
 
-static void visconti_eth_fix_mac_speed(void *priv, unsigned int speed)
+static void visconti_eth_fix_mac_speed(void *priv, unsigned int speed, unsigned int mode)
 {
 	struct visconti_eth *dwmac = priv;
 	struct net_device *netdev = dev_get_drvdata(dwmac->dev);
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index e1f1c034d325..1c26d60886be 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1060,7 +1060,7 @@ static void stmmac_mac_link_up(struct phylink_config *config,
 	priv->speed = speed;
 
 	if (priv->plat->fix_mac_speed)
-		priv->plat->fix_mac_speed(priv->plat->bsp_priv, speed);
+		priv->plat->fix_mac_speed(priv->plat->bsp_priv, speed, mode);
 
 	if (!duplex)
 		ctrl &= ~priv->hw->link.duplex;
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index ef67dba775d0..4876735ebe41 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -253,7 +253,7 @@ struct plat_stmmacenet_data {
 	u8 tx_sched_algorithm;
 	struct stmmac_rxq_cfg rx_queues_cfg[MTL_MAX_RX_QUEUES];
 	struct stmmac_txq_cfg tx_queues_cfg[MTL_MAX_TX_QUEUES];
-	void (*fix_mac_speed)(void *priv, unsigned int speed);
+	void (*fix_mac_speed)(void *priv, unsigned int speed, unsigned int mode);
 	int (*fix_soc_reset)(void *priv, void __iomem *ioaddr);
 	int (*serdes_powerup)(struct net_device *ndev, void *priv);
 	void (*serdes_powerdown)(struct net_device *ndev, void *priv);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v4 net-next 2/2] net: stmmac: dwmac-imx: pause the TXC clock in fixed-link
  2023-08-04 14:46 [PATCH v4 net-next 0/2] update stmmac fix_mac_speed Shenwei Wang
  2023-08-04 14:46 ` [PATCH v4 net-next 1/2] net: stmmac: add new mode parameter for fix_mac_speed Shenwei Wang
@ 2023-08-04 14:46 ` Shenwei Wang
  2023-08-04 14:56   ` Russell King (Oracle)
  1 sibling, 1 reply; 6+ messages in thread
From: Shenwei Wang @ 2023-08-04 14:46 UTC (permalink / raw
  To: Marc Kleine-Budde, Russell King, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Maxime Coquelin, Shawn Guo,
	Sascha Hauer, Neil Armstrong, Kevin Hilman, Vinod Koul,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland
  Cc: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Jerome Brunet, Martin Blumenstingl, Bhupesh Sharma,
	Nobuhiro Iwamatsu, Simon Horman, Andrew Halaney,
	Bartosz Golaszewski, Shenwei Wang, Wong Vee Khee,
	Revanth Kumar Uppala, Jochen Henneberg, netdev, linux-stm32,
	linux-arm-kernel, linux-kernel, linux-amlogic, imx, Frank Li

When using a fixed-link setup, certain devices like the SJA1105 require a
small pause in the TXC clock line to enable their internal tunable
delay line (TDL).

To satisfy this requirement, this patch temporarily disables the TX clock,
and restarts it after a required period. This provides the required
silent interval on the clock line for SJA1105 to complete the frequency
transition and enable the internal TDLs. This action occurs before the link
is built up, so it does not impact a normal device too. There is no
need to identify if the connected device is an SJA1105 alike or not during
the implementation.

So far we have only enabled this feature on the i.MX93 platform.

Signed-off-by: Shenwei Wang <shenwei.wang@nxp.com>
Reviewed-by: Frank Li <frank.li@nxp.com>
---
 .../net/ethernet/stmicro/stmmac/dwmac-imx.c   | 43 +++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c
index 3eb6b4457494..0aca089ef510 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c
@@ -32,6 +32,7 @@
 #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_MASK		GENMASK(3, 1)
 #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)
@@ -40,6 +41,7 @@
 #define DMA_BUS_MODE			0x00001000
 #define DMA_BUS_MODE_SFT_RESET		(0x1 << 0)
 #define RMII_RESET_SPEED		(0x3 << 14)
+#define CTRL_SPEED_MASK			GENMASK(15, 14)
 
 struct imx_dwmac_ops {
 	u32 addr_width;
@@ -47,6 +49,7 @@ struct imx_dwmac_ops {
 
 	int (*fix_soc_reset)(void *priv, void __iomem *ioaddr);
 	int (*set_intf_mode)(struct plat_stmmacenet_data *plat_dat);
+	void (*fix_mac_speed)(void *priv, unsigned int speed, unsigned int mode);
 };
 
 struct imx_priv_data {
@@ -56,6 +59,7 @@ struct imx_priv_data {
 	struct regmap *intf_regmap;
 	u32 intf_reg_off;
 	bool rmii_refclk_ext;
+	void __iomem *base_addr;
 
 	const struct imx_dwmac_ops *ops;
 	struct plat_stmmacenet_data *plat_dat;
@@ -212,6 +216,41 @@ static void imx_dwmac_fix_speed(void *priv, unsigned int speed, unsigned int mod
 		dev_err(dwmac->dev, "failed to set tx rate %lu\n", rate);
 }
 
+static void imx93_dwmac_fix_speed(void *priv, unsigned int speed, unsigned int mode)
+{
+	struct imx_priv_data *dwmac = priv;
+	unsigned int iface;
+	int ctrl, old_ctrl;
+
+	imx_dwmac_fix_speed(priv, speed, mode);
+
+	if (!dwmac || mode != MLO_AN_FIXED)
+		return;
+
+	if (regmap_read(dwmac->intf_regmap, dwmac->intf_reg_off, &iface))
+		return;
+
+	iface &= MX93_GPR_ENET_QOS_INTF_MASK;
+	if (iface != MX93_GPR_ENET_QOS_INTF_SEL_RGMII)
+		return;
+
+	old_ctrl = readl(dwmac->base_addr + MAC_CTRL_REG);
+	ctrl = old_ctrl & ~CTRL_SPEED_MASK;
+	regmap_update_bits(dwmac->intf_regmap, dwmac->intf_reg_off,
+			   MX93_GPR_ENET_QOS_INTF_MODE_MASK, 0);
+	writel(ctrl, dwmac->base_addr + MAC_CTRL_REG);
+
+	 /* Ensure the settings for CTRL are applied. */
+	readl(dwmac->base_addr + MAC_CTRL_REG);
+
+	usleep_range(10, 20);
+	iface |= MX93_GPR_ENET_QOS_CLK_GEN_EN;
+	regmap_update_bits(dwmac->intf_regmap, dwmac->intf_reg_off,
+			   MX93_GPR_ENET_QOS_INTF_MODE_MASK, iface);
+
+	writel(old_ctrl, dwmac->base_addr + MAC_CTRL_REG);
+}
+
 static int imx_dwmac_mx93_reset(void *priv, void __iomem *ioaddr)
 {
 	struct plat_stmmacenet_data *plat_dat = priv;
@@ -319,6 +358,7 @@ static int imx_dwmac_probe(struct platform_device *pdev)
 	plat_dat->fix_mac_speed = imx_dwmac_fix_speed;
 	plat_dat->bsp_priv = dwmac;
 	dwmac->plat_dat = plat_dat;
+	dwmac->base_addr = stmmac_res.addr;
 
 	ret = imx_dwmac_clks_config(dwmac, true);
 	if (ret)
@@ -328,6 +368,8 @@ static int imx_dwmac_probe(struct platform_device *pdev)
 	if (ret)
 		goto err_dwmac_init;
 
+	if (dwmac->ops->fix_soc_reset)
+		plat_dat->fix_mac_speed = dwmac->ops->fix_mac_speed;
 	dwmac->plat_dat->fix_soc_reset = dwmac->ops->fix_soc_reset;
 
 	ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
@@ -364,6 +406,7 @@ static struct imx_dwmac_ops imx93_dwmac_data = {
 	.mac_rgmii_txclk_auto_adj = true,
 	.set_intf_mode = imx93_set_intf_mode,
 	.fix_soc_reset = imx_dwmac_mx93_reset,
+	.fix_mac_speed = imx93_dwmac_fix_speed,
 };
 
 static const struct of_device_id imx_dwmac_match[] = {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v4 net-next 2/2] net: stmmac: dwmac-imx: pause the TXC clock in fixed-link
  2023-08-04 14:46 ` [PATCH v4 net-next 2/2] net: stmmac: dwmac-imx: pause the TXC clock in fixed-link Shenwei Wang
@ 2023-08-04 14:56   ` Russell King (Oracle)
  2023-08-04 15:08     ` [EXT] " Shenwei Wang
  0 siblings, 1 reply; 6+ messages in thread
From: Russell King (Oracle) @ 2023-08-04 14:56 UTC (permalink / raw
  To: Shenwei Wang
  Cc: Marc Kleine-Budde, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Maxime Coquelin, Shawn Guo, Sascha Hauer,
	Neil Armstrong, Kevin Hilman, Vinod Koul, Chen-Yu Tsai,
	Jernej Skrabec, Samuel Holland, Giuseppe Cavallaro,
	Alexandre Torgue, Jose Abreu, Pengutronix Kernel Team,
	Fabio Estevam, NXP Linux Team, Jerome Brunet, Martin Blumenstingl,
	Bhupesh Sharma, Nobuhiro Iwamatsu, Simon Horman, Andrew Halaney,
	Bartosz Golaszewski, Wong Vee Khee, Revanth Kumar Uppala,
	Jochen Henneberg, netdev, linux-stm32, linux-arm-kernel,
	linux-kernel, linux-amlogic, imx, Frank Li

On Fri, Aug 04, 2023 at 09:46:29AM -0500, Shenwei Wang wrote:
> +	if (dwmac->ops->fix_soc_reset)
> +		plat_dat->fix_mac_speed = dwmac->ops->fix_mac_speed;

The if() condition looks like a typo to me.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [EXT] Re: [PATCH v4 net-next 2/2] net: stmmac: dwmac-imx: pause the TXC clock in fixed-link
  2023-08-04 14:56   ` Russell King (Oracle)
@ 2023-08-04 15:08     ` Shenwei Wang
  0 siblings, 0 replies; 6+ messages in thread
From: Shenwei Wang @ 2023-08-04 15:08 UTC (permalink / raw
  To: Russell King
  Cc: Marc Kleine-Budde, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Maxime Coquelin, Shawn Guo, Sascha Hauer,
	Neil Armstrong, Kevin Hilman, Vinod Koul, Chen-Yu Tsai,
	Jernej Skrabec, Samuel Holland, Giuseppe Cavallaro,
	Alexandre Torgue, Jose Abreu, Pengutronix Kernel Team,
	Fabio Estevam, dl-linux-imx, Jerome Brunet, Martin Blumenstingl,
	Bhupesh Sharma, Nobuhiro Iwamatsu, Simon Horman, Andrew Halaney,
	Bartosz Golaszewski, Wong Vee Khee, Revanth Kumar Uppala,
	Jochen Henneberg, netdev@vger.kernel.org,
	linux-stm32@st-md-mailman.stormreply.com,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-amlogic@lists.infradead.org,
	imx@lists.linux.dev, Frank Li



> -----Original Message-----
> From: Russell King <linux@armlinux.org.uk>
> Sent: Friday, August 4, 2023 9:56 AM
> To: Shenwei Wang <shenwei.wang@nxp.com>
> On Fri, Aug 04, 2023 at 09:46:29AM -0500, Shenwei Wang wrote:
> > +     if (dwmac->ops->fix_soc_reset)
> > +             plat_dat->fix_mac_speed = dwmac->ops->fix_mac_speed;
>
> The if() condition looks like a typo to me.
>

My bad. Thank you very much for pointing that out!

Thanks,
Shenwei

> --
> RMK's Patch system:
> https://www.ar/
> mlinux.org.uk%2Fdeveloper%2Fpatches%2F&data=05%7C01%7Cshenwei.wang
> %40nxp.com%7C893e89bfb80c46549b3c08db94fafd80%7C686ea1d3bc2b4c6fa
> 92cd99c5c301635%7C0%7C0%7C638267577931730269%7CUnknown%7CTWFp
> bGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6
> Mn0%3D%7C3000%7C%7C%7C&sdata=xR58pNE5yNXCj6Fl8aWS1an5wgdDI%2F
> k1mv%2Fw%2BnLBhl0%3D&reserved=0
> FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v4 net-next 1/2] net: stmmac: add new mode parameter for fix_mac_speed
  2023-08-04 14:46 ` [PATCH v4 net-next 1/2] net: stmmac: add new mode parameter for fix_mac_speed Shenwei Wang
@ 2023-08-06  2:48   ` kernel test robot
  0 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2023-08-06  2:48 UTC (permalink / raw
  To: Shenwei Wang, Marc Kleine-Budde, Russell King, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Maxime Coquelin,
	Shawn Guo, Sascha Hauer, Neil Armstrong, Kevin Hilman, Vinod Koul,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland
  Cc: oe-kbuild-all, netdev, Giuseppe Cavallaro, Alexandre Torgue,
	Jose Abreu, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Jerome Brunet, Martin Blumenstingl,
	Bhupesh Sharma, Nobuhiro Iwamatsu, Simon Horman, Andrew Halaney,
	Bartosz Golaszewski, Shenwei Wang

Hi Shenwei,

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/Shenwei-Wang/net-stmmac-add-new-mode-parameter-for-fix_mac_speed/20230804-224841
base:   net-next/main
patch link:    https://lore.kernel.org/r/20230804144629.358455-2-shenwei.wang%40nxp.com
patch subject: [PATCH v4 net-next 1/2] net: stmmac: add new mode parameter for fix_mac_speed
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20230806/202308061048.nLnNqNUP-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce: (https://download.01.org/0day-ci/archive/20230806/202308061048.nLnNqNUP-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/202308061048.nLnNqNUP-lkp@intel.com/

All errors (new ones prefixed by >>):

   drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c: In function 'sti_dwmac_probe':
>> drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c:295:33: error: assignment to 'void (*)(void *, unsigned int,  unsigned int)' from incompatible pointer type 'void (*)(void *, unsigned int)' [-Werror=incompatible-pointer-types]
     295 |         plat_dat->fix_mac_speed = data->fix_retime_src;
         |                                 ^
   cc1: some warnings being treated as errors


vim +295 drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c

d15891ca1fdd7f Srinivas Kandagatla 2014-02-11  257  
8387ee21f972de Joachim Eastwood    2015-07-29  258  static int sti_dwmac_probe(struct platform_device *pdev)
d15891ca1fdd7f Srinivas Kandagatla 2014-02-11  259  {
8387ee21f972de Joachim Eastwood    2015-07-29  260  	struct plat_stmmacenet_data *plat_dat;
07ca3749cec2b8 Joachim Eastwood    2015-07-29  261  	const struct sti_dwmac_of_data *data;
8387ee21f972de Joachim Eastwood    2015-07-29  262  	struct stmmac_resources stmmac_res;
d15891ca1fdd7f Srinivas Kandagatla 2014-02-11  263  	struct sti_dwmac *dwmac;
d15891ca1fdd7f Srinivas Kandagatla 2014-02-11  264  	int ret;
d15891ca1fdd7f Srinivas Kandagatla 2014-02-11  265  
149adedd7696cb Joachim Eastwood    2015-07-29  266  	data = of_device_get_match_data(&pdev->dev);
149adedd7696cb Joachim Eastwood    2015-07-29  267  	if (!data) {
149adedd7696cb Joachim Eastwood    2015-07-29  268  		dev_err(&pdev->dev, "No OF match data provided\n");
149adedd7696cb Joachim Eastwood    2015-07-29  269  		return -EINVAL;
149adedd7696cb Joachim Eastwood    2015-07-29  270  	}
149adedd7696cb Joachim Eastwood    2015-07-29  271  
8387ee21f972de Joachim Eastwood    2015-07-29  272  	ret = stmmac_get_platform_resources(pdev, &stmmac_res);
8387ee21f972de Joachim Eastwood    2015-07-29  273  	if (ret)
8387ee21f972de Joachim Eastwood    2015-07-29  274  		return ret;
8387ee21f972de Joachim Eastwood    2015-07-29  275  
83216e3988cd19 Michael Walle       2021-04-12  276  	plat_dat = stmmac_probe_config_dt(pdev, stmmac_res.mac);
8387ee21f972de Joachim Eastwood    2015-07-29  277  	if (IS_ERR(plat_dat))
8387ee21f972de Joachim Eastwood    2015-07-29  278  		return PTR_ERR(plat_dat);
8387ee21f972de Joachim Eastwood    2015-07-29  279  
d15891ca1fdd7f Srinivas Kandagatla 2014-02-11  280  	dwmac = devm_kzalloc(&pdev->dev, sizeof(*dwmac), GFP_KERNEL);
d2ed0a7755fe14 Johan Hovold        2016-11-30  281  	if (!dwmac) {
d2ed0a7755fe14 Johan Hovold        2016-11-30  282  		ret = -ENOMEM;
d2ed0a7755fe14 Johan Hovold        2016-11-30  283  		goto err_remove_config_dt;
d2ed0a7755fe14 Johan Hovold        2016-11-30  284  	}
d15891ca1fdd7f Srinivas Kandagatla 2014-02-11  285  
d15891ca1fdd7f Srinivas Kandagatla 2014-02-11  286  	ret = sti_dwmac_parse_data(dwmac, pdev);
d15891ca1fdd7f Srinivas Kandagatla 2014-02-11  287  	if (ret) {
d15891ca1fdd7f Srinivas Kandagatla 2014-02-11  288  		dev_err(&pdev->dev, "Unable to parse OF data\n");
d2ed0a7755fe14 Johan Hovold        2016-11-30  289  		goto err_remove_config_dt;
d15891ca1fdd7f Srinivas Kandagatla 2014-02-11  290  	}
d15891ca1fdd7f Srinivas Kandagatla 2014-02-11  291  
16b1adbb16c8a5 Joachim Eastwood    2015-07-29  292  	dwmac->fix_retime_src = data->fix_retime_src;
16b1adbb16c8a5 Joachim Eastwood    2015-07-29  293  
8387ee21f972de Joachim Eastwood    2015-07-29  294  	plat_dat->bsp_priv = dwmac;
16b1adbb16c8a5 Joachim Eastwood    2015-07-29 @295  	plat_dat->fix_mac_speed = data->fix_retime_src;
8387ee21f972de Joachim Eastwood    2015-07-29  296  
b89cbfb01a2855 Joachim Eastwood    2016-11-04  297  	ret = clk_prepare_enable(dwmac->clk);
8387ee21f972de Joachim Eastwood    2015-07-29  298  	if (ret)
d2ed0a7755fe14 Johan Hovold        2016-11-30  299  		goto err_remove_config_dt;
8387ee21f972de Joachim Eastwood    2015-07-29  300  
0eebedc2fd284e Joachim Eastwood    2016-11-04  301  	ret = sti_dwmac_set_mode(dwmac);
b89cbfb01a2855 Joachim Eastwood    2016-11-04  302  	if (ret)
b89cbfb01a2855 Joachim Eastwood    2016-11-04  303  		goto disable_clk;
b89cbfb01a2855 Joachim Eastwood    2016-11-04  304  
b89cbfb01a2855 Joachim Eastwood    2016-11-04  305  	ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
b89cbfb01a2855 Joachim Eastwood    2016-11-04  306  	if (ret)
b89cbfb01a2855 Joachim Eastwood    2016-11-04  307  		goto disable_clk;
b89cbfb01a2855 Joachim Eastwood    2016-11-04  308  
b89cbfb01a2855 Joachim Eastwood    2016-11-04  309  	return 0;
b89cbfb01a2855 Joachim Eastwood    2016-11-04  310  
b89cbfb01a2855 Joachim Eastwood    2016-11-04  311  disable_clk:
b89cbfb01a2855 Joachim Eastwood    2016-11-04  312  	clk_disable_unprepare(dwmac->clk);
d2ed0a7755fe14 Johan Hovold        2016-11-30  313  err_remove_config_dt:
d2ed0a7755fe14 Johan Hovold        2016-11-30  314  	stmmac_remove_config_dt(pdev, plat_dat);
0a9e22715ee384 Johan Hovold        2016-11-30  315  
b89cbfb01a2855 Joachim Eastwood    2016-11-04  316  	return ret;
d15891ca1fdd7f Srinivas Kandagatla 2014-02-11  317  }
d15891ca1fdd7f Srinivas Kandagatla 2014-02-11  318  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-08-06  2:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-04 14:46 [PATCH v4 net-next 0/2] update stmmac fix_mac_speed Shenwei Wang
2023-08-04 14:46 ` [PATCH v4 net-next 1/2] net: stmmac: add new mode parameter for fix_mac_speed Shenwei Wang
2023-08-06  2:48   ` kernel test robot
2023-08-04 14:46 ` [PATCH v4 net-next 2/2] net: stmmac: dwmac-imx: pause the TXC clock in fixed-link Shenwei Wang
2023-08-04 14:56   ` Russell King (Oracle)
2023-08-04 15:08     ` [EXT] " Shenwei Wang

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 read-only IMAP folder(s) and NNTP newsgroup(s).