update stmmac fix_mac_speed
Subsystems (12)
v3 cover update stmmac fix_mac_speed
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 | 44 ++++++++++++++++++- .../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, 56 insertions(+), 14 deletions(-)
--
2.34.1
PATCH v3 1/2 net: stmmac: add new mode parameter for fix_mac_speed
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
Also use short version of 'uint' to replace the 'unsigned int' in the function definitions.
--- 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(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c +1 -1
@@ -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,uint speed,uint mode) {struct tegra_eqos *eqos = priv;unsigned long rate =125000000 ;
drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c +1 -1
@@ -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,uint speed,uint mode) {struct plat_stmmacenet_data *plat_dat;struct imx_priv_data *dwmac = priv;
drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c +2 -2
@@ -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,uint speed,uint 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,uint speed,uint mode) {struct intel_dwmac *dwmac = priv;unsigned long rate;
drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c +1 -1
@@ -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,uint speed,uint mode) {struct ipq806x_gmac *gmac = priv;
drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c +1 -1
@@ -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,uint speed,uint mode) {struct meson_dwmac *dwmac = priv;unsigned int val;
drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +1 -1
@@ -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,uint speed,uint mode) {struct qcom_ethqos *ethqos = priv;
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +1 -1
@@ -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,uint speed,uint mode) {struct rk_priv_data *bsp_priv = priv;struct device *dev = &bsp_priv->pdev->dev;
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c +1 -1
@@ -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,uint speed,uint mode) {struct socfpga_dwmac *dwmac = (struct socfpga_dwmac *)priv;void __iomem *splitter_base = dwmac->splitter_base;
drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c +1 -1
@@ -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,uint speed,uint mode) {struct starfive_dwmac *dwmac = priv;unsigned long rate;
drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c +1 -1
@@ -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,uint speed,uint mode) {struct sunxi_priv_data *gmac = priv;
drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c +1 -1
@@ -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,uint speed,uint mode) {struct visconti_eth *dwmac = priv;struct net_device *netdev =dev_get_drvdata (dwmac->dev);
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +1 -1
@@ -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;
include/linux/stmmac.h +1 -1
@@ -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,uint speed,uint 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);
Signature · 1 line
2.34.1
Re: [PATCH v3 net 1/2] net: stmmac: add new mode parameter for fix_mac_speed
Quoted 10 lines · Shenwei Wang
A mode parameter has been added to the callback function of
fix_mac_speedto 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 protocolAlso use short version of 'uint' to replace the 'unsigned int' in the function definitions.
There are not many users of 'uint' in the kernel and it's not used in the stmmac driver so far. From my point of view I would not introduce it and stick to the standard 'unsigned int'.
Just my 2 cent,
Marc
Signature · 4 lines
Pengutronix e.K. | Marc Kleine-Budde | Embedded Linux | https://www.pengutronix.de | Vertretung Nürnberg | Phone: +49-5121-206917-129 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |
RE: [EXT] Re: [PATCH v3 net 1/2] net: stmmac: add new mode parameter for fix_mac_speed
Quoted 41 lines
-----Original Message-----
From: Marc Kleine-Budde <[email protected]>
Sent: Tuesday, August 1, 2023 1:37 AM
To: Shenwei Wang <[email protected]>
Cc: Russell King <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; Maxime Coquelin <[email protected]>; Shawn Guo <[email protected]>; Sascha Hauer <[email protected]>; Neil Armstrong <[email protected]>; Kevin Hilman <[email protected]>; Vinod Koul <[email protected]>; Chen-Yu Tsai <[email protected]>; Jernej Skrabec <[email protected]>; Samuel Holland <[email protected]>; Jose Abreu <[email protected]>; [email protected]; Simon Horman <[email protected]>; Alexandre Torgue <[email protected]>; Giuseppe Cavallaro <[email protected]>; Nobuhiro Iwamatsu <[email protected]>; Fabio Estevam <[email protected]>; [email protected]; Jerome Brunet <[email protected]>; Bartosz Golaszewski <[email protected]>; Wong Vee Khee <[email protected]>; dl- linux-imx <[email protected]>; Andrew Halaney <[email protected]>; Bhupesh Sharma <[email protected]>; Martin Blumenstingl <[email protected]>; Revanth Kumar Uppala <[email protected]>; Jochen Henneberg <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; Pengutronix Kernel Team <[email protected]>
Subject: [EXT] Re: [PATCH v3 net 1/2] net: stmmac: add new mode parameter forfix_mac_speedQuoted 8 lines · Shenwei Wang
A mode parameter has been added to the callback function of
fix_mac_speedto 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
Quoted 7 lines
Quoted 2 lines
Also use short version of 'uint' to replace the 'unsigned int' in the function definitions.
There are not many users of 'uint' in the kernel and it's not used in the stmmac driver so far. From my point of view I would not introduce it and stick to the standard 'unsigned int'.
Using 'uint' makes the code look cleaner because adding one extra parameter may cause some function declarations to span multiple lines. This change keeps function declarations compact on a single line.
Thanks,
Shenwei
Quoted 8 lines
Just my 2 cent,
Marc--
Pengutronix e.K. | Marc Kleine-Budde | Embedded Linux | https://www.pengutronix.de |Vertretung Nürnberg | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |
Jakub Kicinski
maintainerRe: [EXT] Re: [PATCH v3 net 1/2] net: stmmac: add new mode parameter for fix_mac_speed
Quoted 1 line · On Tue, 1 Aug 2023 18:43:52 +0000 Shenwei Wang wrote:
Subject: RE: [EXT] Re: [PATCH v3 net 1/2] net: stmmac: add new mode parameter for
fix_mac_speed
Looks like new platform enablement, the correct tree to target this at is net-next (i.e. [PATCH net-next]).
Quoted 21 lines
Quoted 21 lines
-----Original Message-----
From: Marc Kleine-Budde <[email protected]>
Sent: Tuesday, August 1, 2023 1:37 AM
To: Shenwei Wang <[email protected]>
Cc: Russell King <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; Maxime Coquelin <[email protected]>; Shawn Guo <[email protected]>; Sascha Hauer <[email protected]>; Neil Armstrong <[email protected]>; Kevin Hilman <[email protected]>; Vinod Koul <[email protected]>; Chen-Yu Tsai <[email protected]>; Jernej Skrabec <[email protected]>; Samuel Holland <[email protected]>; Jose Abreu <[email protected]>; [email protected]; Simon Horman <[email protected]>; Alexandre Torgue <[email protected]>; Giuseppe Cavallaro <[email protected]>; Nobuhiro Iwamatsu <[email protected]>; Fabio Estevam <[email protected]>; [email protected]; Jerome Brunet <[email protected]>; Bartosz Golaszewski <[email protected]>; Wong Vee Khee <[email protected]>; dl- linux-imx <[email protected]>; Andrew Halaney <[email protected]>;
Quoted 8 lines
Quoted 8 lines
Bhupesh Sharma <[email protected]>; Martin Blumenstingl <[email protected]>; Revanth Kumar Uppala <[email protected]>; Jochen Henneberg <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; Pengutronix Kernel Team <[email protected]>
Subject: [EXT] Re: [PATCH v3 net 1/2] net: stmmac: add new mode parameter forfix_mac_speed
Why is this quote included? Please get a sane email client.
Quoted 12 lines
Quoted 12 lines · Shenwei Wang
Quoted 10 lines
A mode parameter has been added to the callback function of
fix_mac_speedto 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 protocolAlso use short version of 'uint' to replace the 'unsigned int' in the function definitions.
Quoted 8 lines
Quoted 3 lines
There are not many users of 'uint' in the kernel and it's not used in the stmmac driver so far. From my point of view I would not introduce it and stick to the standard 'unsigned int'.
Using 'uint' makes the code look cleaner because adding one extra parameter may cause some function declarations to span multiple lines. This change keeps function declarations compact on a single line.
Marc is right. Just do it.
RE: [EXT] Re: [PATCH v3 net 1/2] net: stmmac: add new mode parameter for fix_mac_speed
Quoted 11 lines
-----Original Message-----
From: Jakub Kicinski <[email protected]>
Sent: Tuesday, August 1, 2023 2:58 PM
To: Shenwei Wang <[email protected]>Quoted 2 lines
Quoted 2 lines
Subject: [EXT] Re: [PATCH v3 net 1/2] net: stmmac: add new mode parameter for
fix_mac_speedWhy is this quote included? Please get a sane email client.
I have no idea. We are using Office Outlook.
Regards,
Shenwei
Quoted 21 lines
Quoted 12 lines
Quoted 12 lines · Shenwei Wang
Quoted 10 lines
A mode parameter has been added to the callback function of
fix_mac_speedto 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 protocolAlso use short version of 'uint' to replace the 'unsigned int' in the function definitions.
Quoted 7 lines
Quoted 3 lines
There are not many users of 'uint' in the kernel and it's not used in the stmmac driver so far. From my point of view I would not introduce it and stick to the standard 'unsigned int'.
Using 'uint' makes the code look cleaner because adding one extra parameter may cause some function declarations to span multiple lines. This change keeps function declarations compact on a single line.
Marc is right. Just do it.
kernel test robot
build botRe: [PATCH v3 net 1/2] net: stmmac: add new mode parameter for fix_mac_speed
In reply to Shenwei Wangkernel test robot noticed the following build errors:
Hi Shenwei,
kernel test robot noticed the following build errors:
[auto build test ERROR on net/main]
url: https://github.com/intel-lab-lkp/linux/commits/Shenwei-Wang/net-stmmac-add-new-mode-parameter-for-fix_mac_speed/20230801-002328 base: net/main patch link: https://lore.kernel.org/r/20230731161929.2341584-2-shenwei.wang%40nxp.com patch subject: [PATCH v3 net 1/2] net: stmmac: add new mode parameter for fix_mac_speed config: s390-allyesconfig (https://download.01.org/0day-ci/archive/20230801/[email protected]/config) compiler: s390-linux-gcc (GCC) 12.3.0 reproduce: (https://download.01.org/0day-ci/archive/20230801/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
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:296:33: error: assignment to 'void (*)(void *, uint, uint)' {aka 'void (*)(void *, unsigned int, unsigned int)'} from incompatible pointer type 'void (*)(void *, unsigned int)' [-Werror=incompatible-pointer-types]
296 | plat_dat->fix_mac_speed = data->fix_retime_src;
| ^cc1: some warnings being treated as errors
vim +296 drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c
d15891ca1fdd7f Srinivas Kandagatla 2014-02-11 258
8387ee21f972de Joachim Eastwood 2015-07-29 259 static int sti_dwmac_probe(struct platform_device *pdev)
d15891ca1fdd7f Srinivas Kandagatla 2014-02-11 260 {
8387ee21f972de Joachim Eastwood 2015-07-29 261 struct plat_stmmacenet_data *plat_dat;
07ca3749cec2b8 Joachim Eastwood 2015-07-29 262 const struct sti_dwmac_of_data *data;
8387ee21f972de Joachim Eastwood 2015-07-29 263 struct stmmac_resources stmmac_res;
d15891ca1fdd7f Srinivas Kandagatla 2014-02-11 264 struct sti_dwmac *dwmac;
d15891ca1fdd7f Srinivas Kandagatla 2014-02-11 265 int ret;
d15891ca1fdd7f Srinivas Kandagatla 2014-02-11 266
149adedd7696cb Joachim Eastwood 2015-07-29 267 data = of_device_get_match_data(&pdev->dev);
149adedd7696cb Joachim Eastwood 2015-07-29 268 if (!data) {
149adedd7696cb Joachim Eastwood 2015-07-29 269 dev_err(&pdev->dev, "No OF match data provided\n");
149adedd7696cb Joachim Eastwood 2015-07-29 270 return -EINVAL;
149adedd7696cb Joachim Eastwood 2015-07-29 271 }
149adedd7696cb Joachim Eastwood 2015-07-29 272
8387ee21f972de Joachim Eastwood 2015-07-29 273 ret = stmmac_get_platform_resources(pdev, &stmmac_res);
8387ee21f972de Joachim Eastwood 2015-07-29 274 if (ret)
8387ee21f972de Joachim Eastwood 2015-07-29 275 return ret;
8387ee21f972de Joachim Eastwood 2015-07-29 276
83216e3988cd19 Michael Walle 2021-04-12 277 plat_dat = stmmac_probe_config_dt(pdev, stmmac_res.mac);
8387ee21f972de Joachim Eastwood 2015-07-29 278 if (IS_ERR(plat_dat))
8387ee21f972de Joachim Eastwood 2015-07-29 279 return PTR_ERR(plat_dat);
8387ee21f972de Joachim Eastwood 2015-07-29 280
d15891ca1fdd7f Srinivas Kandagatla 2014-02-11 281 dwmac = devm_kzalloc(&pdev->dev, sizeof(*dwmac), GFP_KERNEL);
d2ed0a7755fe14 Johan Hovold 2016-11-30 282 if (!dwmac) {
d2ed0a7755fe14 Johan Hovold 2016-11-30 283 ret = -ENOMEM;
d2ed0a7755fe14 Johan Hovold 2016-11-30 284 goto err_remove_config_dt;
d2ed0a7755fe14 Johan Hovold 2016-11-30 285 }
d15891ca1fdd7f Srinivas Kandagatla 2014-02-11 286
d15891ca1fdd7f Srinivas Kandagatla 2014-02-11 287 ret = sti_dwmac_parse_data(dwmac, pdev);
d15891ca1fdd7f Srinivas Kandagatla 2014-02-11 288 if (ret) {
d15891ca1fdd7f Srinivas Kandagatla 2014-02-11 289 dev_err(&pdev->dev, "Unable to parse OF data\n");
d2ed0a7755fe14 Johan Hovold 2016-11-30 290 goto err_remove_config_dt;
d15891ca1fdd7f Srinivas Kandagatla 2014-02-11 291 }
d15891ca1fdd7f Srinivas Kandagatla 2014-02-11 292
16b1adbb16c8a5 Joachim Eastwood 2015-07-29 293 dwmac->fix_retime_src = data->fix_retime_src;
16b1adbb16c8a5 Joachim Eastwood 2015-07-29 294
8387ee21f972de Joachim Eastwood 2015-07-29 295 plat_dat->bsp_priv = dwmac;
16b1adbb16c8a5 Joachim Eastwood 2015-07-29 @296 plat_dat->fix_mac_speed = data->fix_retime_src;
8387ee21f972de Joachim Eastwood 2015-07-29 297
b89cbfb01a2855 Joachim Eastwood 2016-11-04 298 ret = clk_prepare_enable(dwmac->clk);
8387ee21f972de Joachim Eastwood 2015-07-29 299 if (ret)
d2ed0a7755fe14 Johan Hovold 2016-11-30 300 goto err_remove_config_dt;
8387ee21f972de Joachim Eastwood 2015-07-29 301
0eebedc2fd284e Joachim Eastwood 2016-11-04 302 ret = sti_dwmac_set_mode(dwmac);
b89cbfb01a2855 Joachim Eastwood 2016-11-04 303 if (ret)
b89cbfb01a2855 Joachim Eastwood 2016-11-04 304 goto disable_clk;
b89cbfb01a2855 Joachim Eastwood 2016-11-04 305
b89cbfb01a2855 Joachim Eastwood 2016-11-04 306 ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
b89cbfb01a2855 Joachim Eastwood 2016-11-04 307 if (ret)
b89cbfb01a2855 Joachim Eastwood 2016-11-04 308 goto disable_clk;
b89cbfb01a2855 Joachim Eastwood 2016-11-04 309
b89cbfb01a2855 Joachim Eastwood 2016-11-04 310 return 0;
b89cbfb01a2855 Joachim Eastwood 2016-11-04 311
b89cbfb01a2855 Joachim Eastwood 2016-11-04 312 disable_clk:
b89cbfb01a2855 Joachim Eastwood 2016-11-04 313 clk_disable_unprepare(dwmac->clk);
d2ed0a7755fe14 Johan Hovold 2016-11-30 314 err_remove_config_dt:
d2ed0a7755fe14 Johan Hovold 2016-11-30 315 stmmac_remove_config_dt(pdev, plat_dat);
0a9e22715ee384 Johan Hovold 2016-11-30 316
b89cbfb01a2855 Joachim Eastwood 2016-11-04 317 return ret;d15891ca1fdd7f Srinivas Kandagatla 2014-02-11 318 } d15891ca1fdd7f Srinivas Kandagatla 2014-02-11 319
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
PATCH v3 2/2 net: stmmac: dwmac-imx: pause the TXC clock in fixed-link
In reply to Shenwei WangWhen 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.
So far we have only enabled this feature on the i.MX93 platform.
--- .../net/ethernet/stmicro/stmmac/dwmac-imx.c | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+)
drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c +42 -0
@@ -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;
@@ -56,6 +58,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 +215,42 @@ static void imx_dwmac_fix_speed(void *priv, uint speed, uint mode)dev_err (dwmac->dev,"failed to set tx rate %lu\n" , rate); } +static void imx_dwmac_fix_speed_mx93 (void *priv,uint speed,uint mode) +{ +struct imx_priv_data *dwmac = priv; +int ctrl, old_ctrl, iface; + +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 and avoid CPU/Compiler +* reordering. +*/ +wmb (); + +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;
@@ -317,8 +356,11 @@ static int imx_dwmac_probe(struct platform_device *pdev) plat_dat->exit = imx_dwmac_exit; plat_dat->clks_config = imx_dwmac_clks_config; plat_dat->fix_mac_speed = imx_dwmac_fix_speed; +if (of_machine_is_compatible ("fsl,imx93" )) + plat_dat->fix_mac_speed = imx_dwmac_fix_speed_mx93; 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)
Signature · 1 line
2.34.1
Re: [PATCH v3 net 2/2] net: stmmac: dwmac-imx: pause the TXC clock in fixed-link
Quoted 46 lines · Shenwei Wang
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.
So far we have only enabled this feature on the i.MX93 platform.
Signed-off-by Shenwei Wang <[email protected]>Reviewed-by Frank Li <[email protected]>--- .../net/ethernet/stmicro/stmmac/dwmac-imx.c | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+)drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c +3
-0@@ -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;@@ -56,6 +58,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;
drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c static void imx_dwmac_fix_speed(void *priv, uint speed, uint mode) · line 221
Quoted 7 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c +4
-0@@ -212,6 +215,42 @@ static void imx_dwmac_fix_speed(void *priv, uint speed, uint mode)dev_err (dwmac->dev,"failed to set tx rate %lu\n" , rate); } +static void imx_dwmac_fix_speed_mx93 (void *priv,uint speed,uint mode) +{ +struct imx_priv_data *dwmac = priv; +int ctrl, old_ctrl, iface;
regmap_read() wants a pointer to an "unsigned int".
Quoted 21 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c +21
-0+ +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 and avoid CPU/Compiler +* reordering.
drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c static void imx_dwmac_fix_speed(void *priv, uint speed, uint mode) · line 252
Quoted 10 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c +10
-0+*/ +wmb (); + +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 ); +}
Marc
Signature · 4 lines
Pengutronix e.K. | Marc Kleine-Budde | Embedded Linux | https://www.pengutronix.de | Vertretung Nürnberg | Phone: +49-5121-206917-129 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |
Re: [PATCH v3 net 2/2] net: stmmac: dwmac-imx: pause the TXC clock in fixed-link
In reply to Shenwei WangHi Shenwei,
thanks for your patch.
Quoted 3 lines · Shenwei Wang
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).
If this is only required for some devices, is it safe to enforce this behaviour unconditionally for any kind of fixed link devices connected to the MX93 EQOS or could this possibly break for other devices?
Best regards
Johannes
Quoted 97 lines
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.
So far we have only enabled this feature on the i.MX93 platform.
Signed-off-by Shenwei Wang <[email protected]>Reviewed-by Frank Li <[email protected]>--- .../net/ethernet/stmicro/stmmac/dwmac-imx.c | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+)drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c +42
-0@@ -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;@@ -56,6 +58,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 +215,42 @@ static void imx_dwmac_fix_speed(void *priv, uint speed, uint mode)dev_err (dwmac->dev,"failed to set tx rate %lu\n" , rate); } +static void imx_dwmac_fix_speed_mx93 (void *priv,uint speed,uint mode) +{ +struct imx_priv_data *dwmac = priv; +int ctrl, old_ctrl, iface; + +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 and avoid CPU/Compiler +* reordering. +*/ +wmb (); + +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;@@ -317,8 +356,11 @@ static int imx_dwmac_probe(struct platform_device *pdev) plat_dat->exit = imx_dwmac_exit; plat_dat->clks_config = imx_dwmac_clks_config; plat_dat->fix_mac_speed = imx_dwmac_fix_speed; +if (of_machine_is_compatible ("fsl,imx93" )) + plat_dat->fix_mac_speed = imx_dwmac_fix_speed_mx93; 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)
Signature · 4 lines
Pengutronix e.K. | Johannes Zink | Steuerwalder Str. 21 | https://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686| Fax: +49-5121-206917-5555 |
Re: [PATCH v3 net 2/2] net: stmmac: dwmac-imx: pause the TXC clock in fixed-link
Quoted 4 lines · Johannes Zink
Hi Shenwei,
thanks for your patch.
Quoted 8 lines
Quoted 3 lines · Shenwei Wang
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).
If this is only required for some devices, is it safe to enforce this behaviour unconditionally for any kind of fixed link devices connected to the MX93 EQOS or could this possibly break for other devices?
This same point has been raised by Andrew Halaney in message-id
<4govb566nypifbtqp5lcbsjhvoyble5luww3onaa2liinboguf@4kgihys6vhrg>
and Fabio Estevam in message-id
<CAOMZO5ANQmVbk_jy7qdVtzs3716FisT2c72W+3WZyu7FoAochw@mail.gmail.com>
but we don't seem to have any answer for it.
Also, the patch still uses wmb() between the write and the delay, and as Will Deacon pointed out in his message, message-id
<20230728153611.GH21718@willie-the-truck>
this is not safe, yet still a new version was sent.
It seems the author of these patches is pretty resistant to comments, and has shown that when I was requesting changes - it was an awful struggle to get changes made. I'm now of the opinion that I really can't be bothered to review these patches, precisely because feedback is clearly not welcome or if welcome, apparently acted upon.
Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
RE: [EXT] Re: [PATCH v3 net 2/2] net: stmmac: dwmac-imx: pause the TXC clock in fixed-link
Quoted 51 lines
-----Original Message-----
From: Russell King <[email protected]>
Sent: Tuesday, August 1, 2023 7:57 AM
To: Johannes Zink <[email protected]>
Cc: Shenwei Wang <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; Maxime Coquelin <[email protected]>; Shawn Guo <[email protected]>; Sascha Hauer <[email protected]>; Neil Armstrong <[email protected]>; Kevin Hilman <[email protected]>; Vinod Koul <[email protected]>; Chen-Yu Tsai <[email protected]>; Jernej Skrabec <[email protected]>; Samuel Holland <[email protected]>; Giuseppe Cavallaro <[email protected]>; Alexandre Torgue <[email protected]>; Jose Abreu <[email protected]>; Pengutronix Kernel Team <[email protected]>; Fabio Estevam <[email protected]>; dl-linux-imx <[email protected]>; Jerome Brunet <[email protected]>; Martin Blumenstingl <[email protected]>; Bhupesh Sharma <[email protected]>; Nobuhiro Iwamatsu <[email protected]>; Simon Horman <[email protected]>; Andrew Halaney <[email protected]>; Bartosz Golaszewski <[email protected]>; Wong Vee Khee <[email protected]>; Revanth Kumar Uppala <[email protected]>; Jochen Henneberg <[email protected]>; [email protected]; linux- [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Frank Li <[email protected]>
Subject: [EXT] Re: [PATCH v3 net 2/2] net: stmmac: dwmac-imx: pause the TXC clock in fixed-linkCaution: This is an external email. Please take care when clicking links or opening attachments. When in doubt, report the message using the 'Report this email' button
Quoted 4 lines · Johannes Zink
Hi Shenwei,
thanks for your patch.
Quoted 8 lines
Quoted 3 lines · Shenwei Wang
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).
If this is only required for some devices, is it safe to enforce this behaviour unconditionally for any kind of fixed link devices connected to the MX93 EQOS or could this possibly break for other devices?
Quoted 8 lines
This same point has been raised by Andrew Halaney in message-id <4govb566nypifbtqp5lcbsjhvoyble5luww3onaa2liinboguf@4kgihys6vhrg> and Fabio Estevam in message-id
<[email protected]. com>
but we don't seem to have any answer for it.
Hi Russell,
I hope you have thoroughly read all of my earlier responses, as I believe I already addressed this question. I'm happy to clarify further, but kindly avoid unsubstantiated comments.
https://lore.kernel.org/imx/[email protected]/T/#m08da3797a056d4d8ea4c1d8956b445ae967e7cfa
" Yes, that's the purpose because it won't hurt even the other side is not SJA1105."
Quoted 5 lines
Also, the patch still uses
wmb()between the write and the delay, and as Will Deacon pointed out in his message, message-id <20230728153611.GH21718@willie-the-truck>
this is not safe, yet still a new version was sent.
Can we conclude that even without the wmb() here, the desired delay time between operations can still be ensured?
Thanks,
Shenwei
Quoted 16 lines
It seems the author of these patches is pretty resistant to comments, and has shown that when I was requesting changes - it was an awful struggle to get changes made. I'm now of the opinion that I really can't be bothered to review these patches, precisely because feedback is clearly not welcome or if welcome, apparently acted upon.
--
RMK's Patch system:
https://www.ar/
mlinux.org.uk%2Fdeveloper%2Fpatches%2F&data=05%7C01%7Cshenwei.wang %40nxp.com%7Ce65ab380ff5b4748da5308db928ec751%7C686ea1d3bc2b4c6fa 92cd99c5c301635%7C0%7C0%7C638264914150592989%7CUnknown%7CTWFp bGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6 Mn0%3D%7C3000%7C%7C%7C&sdata=%2FzSqRqJFRQljX6ky3XJvfkMH9PwgOstb w8HpEppYOIM%3D&reserved=0
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
Re: [EXT] Re: [PATCH v3 net 2/2] net: stmmac: dwmac-imx: pause the TXC clock in fixed-link
Quoted 67 lines · Shenwei Wang
Quoted 51 lines
-----Original Message-----
From: Russell King <[email protected]>
Sent: Tuesday, August 1, 2023 7:57 AM
To: Johannes Zink <[email protected]>
Cc: Shenwei Wang <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; Maxime Coquelin <[email protected]>; Shawn Guo <[email protected]>; Sascha Hauer <[email protected]>; Neil Armstrong <[email protected]>; Kevin Hilman <[email protected]>; Vinod Koul <[email protected]>; Chen-Yu Tsai <[email protected]>; Jernej Skrabec <[email protected]>; Samuel Holland <[email protected]>; Giuseppe Cavallaro <[email protected]>; Alexandre Torgue <[email protected]>; Jose Abreu <[email protected]>; Pengutronix Kernel Team <[email protected]>; Fabio Estevam <[email protected]>; dl-linux-imx <[email protected]>; Jerome Brunet <[email protected]>; Martin Blumenstingl <[email protected]>; Bhupesh Sharma <[email protected]>; Nobuhiro Iwamatsu <[email protected]>; Simon Horman <[email protected]>; Andrew Halaney <[email protected]>; Bartosz Golaszewski <[email protected]>; Wong Vee Khee <[email protected]>; Revanth Kumar Uppala <[email protected]>; Jochen Henneberg <[email protected]>; [email protected]; linux- [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Frank Li <[email protected]>
Subject: [EXT] Re: [PATCH v3 net 2/2] net: stmmac: dwmac-imx: pause the TXC clock in fixed-linkCaution: This is an external email. Please take care when clicking links or opening attachments. When in doubt, report the message using the 'Report this email' button
Quoted 4 lines · Johannes Zink
Hi Shenwei,
thanks for your patch.
Quoted 8 lines
Quoted 3 lines · Shenwei Wang
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).
If this is only required for some devices, is it safe to enforce this behaviour unconditionally for any kind of fixed link devices connected to the MX93 EQOS or could this possibly break for other devices?
Quoted 8 lines
This same point has been raised by Andrew Halaney in message-id <4govb566nypifbtqp5lcbsjhvoyble5luww3onaa2liinboguf@4kgihys6vhrg> and Fabio Estevam in message-id
<[email protected]. com>
but we don't seem to have any answer for it.Hi Russell,
I hope you have thoroughly read all of my earlier responses, as I believe I already addressed this question. I'm happy to clarify further, but kindly avoid unsubstantiated comments.
https://lore.kernel.org/imx/[email protected]/T/#m08da3797a056d4d8ea4c1d8956b445ae967e7cfa
" Yes, that's the purpose because it won't hurt even the other side is not SJA1105."
Quoted 8 lines
Quoted 5 lines
Also, the patch still uses
wmb()between the write and the delay, and as Will Deacon pointed out in his message, message-id <20230728153611.GH21718@willie-the-truck>
this is not safe, yet still a new version was sent.Can we conclude that even without the
wmb()here, the desired delay time between operations can still be ensured?
Will's talk[0] he linked has the sequence you've done here (writel's followed by wmb() followed by a udelay), and he states it is wrong if the goal is for the device to see the writes prior to the udelay. That's discussed at around 28:00 and followed up by (thankfully, cuz I too didn't understand it) a question at 34:10 to discuss why mb() isn't sufficient (it completes the write, but the device *may not* see it yet, the read forces that).
He mentioned that over at [1] in the review here, and suggested reading from the device again prior to the udelay() instead to force the writes to take affect on the device prior to the udelay.
I found a quick example in the ufs-qcom.c driver that I'll copy paste here too from upstream that follows this advice:
writel_relaxed(temp, host->dev_ref_clk_ctrl_mmio); /* * Make sure the write to ref_clk reaches the destination and * not stored in a Write Buffer (WB). */ readl(host->dev_ref_clk_ctrl_mmio); /* * If we call hibern8 exit after this, we need to make sure that * device ref_clk is stable for at least 1us before the hibern8 * exit command. */ if (enable) udelay(1);
[0] https://www.youtube.com/watch?v=i6DayghhA8Q
[1] https://lore.kernel.org/netdev/20230728153611.GH21718@willie-the-truck/
I hope that helps,
Andrew
Re: [EXT] Re: [PATCH v3 net 2/2] net: stmmac: dwmac-imx: pause the TXC clock in fixed-link
In reply to Shenwei WangQuoted 22 lines · Shenwei Wang
Quoted 14 lines · Johannes Zink
Quoted 4 lines
Hi Shenwei,
thanks for your patch.
Quoted 8 lines
Quoted 3 lines · Shenwei Wang
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).
If this is only required for some devices, is it safe to enforce this behaviour unconditionally for any kind of fixed link devices connected to the MX93 EQOS or could this possibly break for other devices?
Quoted 8 lines
This same point has been raised by Andrew Halaney in message-id <4govb566nypifbtqp5lcbsjhvoyble5luww3onaa2liinboguf@4kgihys6vhrg> and Fabio Estevam in message-id
<[email protected]. com>
but we don't seem to have any answer for it.
Quoted 7 lines
Hi Russell,
I hope you have thoroughly read all of my earlier responses, as I believe I already addressed this question. I'm happy to clarify further, but kindly avoid unsubstantiated comments.
https://lore.kernel.org/imx/[email protected]/T/#m08da3797a056d4d8ea4c1d8956b445ae967e7cfa
" Yes, that's the purpose because it won't hurt even the other side is not SJA1105."
So, why not include the answer in the commit message given that you've had to answer it several times already?
Quoted 8 lines
Quoted 5 lines
Also, the patch still uses
wmb()between the write and the delay, and as Will Deacon pointed out in his message, message-id <20230728153611.GH21718@willie-the-truck>
this is not safe, yet still a new version was sent.Can we conclude that even without the
wmb()here, the desired delay time between operations can still be ensured?
How did you come to that conclusion? I see no further discussion after I raised this, Will replied, and you suggested a read-back. However, that isn't what you've implemented on v3, you've gone back to what looks like the original code in v2 which brought up this question - and Will indicated it was _unsafe_.
Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
RE: [EXT] Re: [PATCH v3 net 2/2] net: stmmac: dwmac-imx: pause the TXC clock in fixed-link
In reply to Johannes ZinkQuoted 41 lines
-----Original Message-----
From: Johannes Zink <[email protected]>
Sent: Tuesday, August 1, 2023 7:48 AM
To: Shenwei Wang <[email protected]>; Russell King <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; Maxime Coquelin <[email protected]>; Shawn Guo <[email protected]>; Sascha Hauer <[email protected]>; Neil Armstrong <[email protected]>; Kevin Hilman <[email protected]>; Vinod Koul <[email protected]>; Chen- Yu Tsai <[email protected]>; Jernej Skrabec <[email protected]>; Samuel Holland <[email protected]>
Cc: Giuseppe Cavallaro <[email protected]>; Alexandre Torgue <[email protected]>; Jose Abreu <[email protected]>; Pengutronix Kernel Team <[email protected]>; Fabio Estevam <[email protected]>; dl-linux-imx <[email protected]>; Jerome Brunet <[email protected]>; Martin Blumenstingl <[email protected]>; Bhupesh Sharma <[email protected]>; Nobuhiro Iwamatsu <[email protected]>; Simon Horman <[email protected]>; Andrew Halaney <[email protected]>; Bartosz Golaszewski <[email protected]>; Wong Vee Khee <[email protected]>; Revanth Kumar Uppala <[email protected]>; Jochen Henneberg <[email protected]>; [email protected]; linux- [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Frank Li <[email protected]>
Subject: [EXT] Re: [PATCH v3 net 2/2] net: stmmac: dwmac-imx: pause the TXC clock in fixed-linkCaution: This is an external email. Please take care when clicking links or opening attachments. When in doubt, report the message using the 'Report this email' button
Hi Shenwei,
thanks for your patch.
Quoted 9 lines
Quoted 3 lines · Shenwei Wang
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).
If this is only required for some devices, is it safe to enforce this behaviour unconditionally for any kind of fixed link devices connected to the MX93 EQOS or could this possibly break for other devices?
It won't impact normal devices. The link layer hasn't built up yet.
Thanks,
Shenwei
Quoted 113 lines
Best regards
JohannesQuoted 89 lines
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.
So far we have only enabled this feature on the i.MX93 platform.
Signed-off-by Shenwei Wang <[email protected]>Reviewed-by Frank Li <[email protected]>--- .../net/ethernet/stmicro/stmmac/dwmac-imx.c | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+)drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c +3
-0@@ -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;@@ -56,6 +58,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 +215,42 @@static void
imx_dwmac_fix_speed(void *priv, uint speed, uint mode)dev_err(dwmac->dev, "failed to set tx rate %lu\n", rate);}
drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c +35
-0+static void imx_dwmac_fix_speed_mx93 (void *priv,uint speed,uint +mode) { +struct imx_priv_data *dwmac = priv; +int ctrl, old_ctrl, iface; + +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 and avoid CPU/Compiler +* reordering. +*/ +wmb (); + +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; @@ -317,8 +356,11@@ static int
imx_dwmac_probe(struct platform_device *pdev)plat_dat->exit = imx_dwmac_exit; plat_dat->clks_config = imx_dwmac_clks_config; plat_dat->fix_mac_speed = imx_dwmac_fix_speed;drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c static int imx_dwmac_probe(struct platform_device *pdev) · line 366
Quoted 8 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c +3
-0+if (of_machine_is_compatible ("fsl,imx93" )) + plat_dat->fix_mac_speed = imx_dwmac_fix_speed_mx93; 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)--
Pengutronix e.K. | Johannes Zink |
Steuerwalder Str. 21 |
https://www.pe/
ngutronix.de%2F&data=05%7C01%7Cshenwei.wang%40nxp.com%7C761fbb75c 1c24cfe091508db928d8ade%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C 0%7C638264908852977732%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjA wMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C% 7C&sdata=2l2zNfIaNnRJENmERehNae8g%2F%2BQqlxD2YRx7ksY2X%2BE%3D&r
eserved=0 |31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686| Fax: +49-5121-206917-5555 |
Re: [EXT] Re: [PATCH v3 net 2/2] net: stmmac: dwmac-imx: pause the TXC clock in fixed-link
Hi Shenwei,
Quoted 46 lines · Shenwei Wang
Quoted 46 lines
-----Original Message-----
From: Johannes Zink <[email protected]>
Sent: Tuesday, August 1, 2023 7:48 AM
To: Shenwei Wang <[email protected]>; Russell King <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; Maxime Coquelin <[email protected]>; Shawn Guo <[email protected]>; Sascha Hauer <[email protected]>; Neil Armstrong <[email protected]>; Kevin Hilman <[email protected]>; Vinod Koul <[email protected]>; Chen- Yu Tsai <[email protected]>; Jernej Skrabec <[email protected]>; Samuel Holland <[email protected]>
Cc: Giuseppe Cavallaro <[email protected]>; Alexandre Torgue <[email protected]>; Jose Abreu <[email protected]>; Pengutronix Kernel Team <[email protected]>; Fabio Estevam <[email protected]>; dl-linux-imx <[email protected]>; Jerome Brunet <[email protected]>; Martin Blumenstingl <[email protected]>; Bhupesh Sharma <[email protected]>; Nobuhiro Iwamatsu <[email protected]>; Simon Horman <[email protected]>; Andrew Halaney <[email protected]>; Bartosz Golaszewski <[email protected]>; Wong Vee Khee <[email protected]>; Revanth Kumar Uppala <[email protected]>; Jochen Henneberg <[email protected]>; [email protected]; linux- [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Frank Li <[email protected]>
Subject: [EXT] Re: [PATCH v3 net 2/2] net: stmmac: dwmac-imx: pause the TXC clock in fixed-linkCaution: This is an external email. Please take care when clicking links or opening attachments. When in doubt, report the message using the 'Report this email' button
Hi Shenwei,
thanks for your patch.
Quoted 3 lines · Shenwei Wang
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).
Quoted 7 lines
Quoted 4 lines
If this is only required for some devices, is it safe to enforce this behaviour unconditionally for any kind of fixed link devices connected to the MX93 EQOS or could this possibly break for other devices?
It won't impact normal devices. The link layer hasn't built up yet.
As Russel suggested in [1] - maybe you could rephrase your commit message for your v4 to point this out to future reviewers (apparently multiple people have had questions about this...) and have this fact also recorded in the git log later on.
Also: does this only apply to i.MX93, or would we have to test and enable it on e.g. i.MX8MP as well?
Thanks
Johannes
[1] ZMk/[email protected]
Quoted 118 lines
Thanks,
ShenweiQuoted 113 lines
Best regards
JohannesQuoted 89 lines
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.
So far we have only enabled this feature on the i.MX93 platform.
Signed-off-by Shenwei Wang <[email protected]>Reviewed-by Frank Li <[email protected]>--- .../net/ethernet/stmicro/stmmac/dwmac-imx.c | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+)drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c +3
-0@@ -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;@@ -56,6 +58,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 +215,42 @@static void
imx_dwmac_fix_speed(void *priv, uint speed, uint mode)dev_err(dwmac->dev, "failed to set tx rate %lu\n", rate);}
drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c +35
-0+static void imx_dwmac_fix_speed_mx93 (void *priv,uint speed,uint +mode) { +struct imx_priv_data *dwmac = priv; +int ctrl, old_ctrl, iface; + +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 and avoid CPU/Compiler +* reordering. +*/ +wmb (); + +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; @@ -317,8 +356,11@@ static int
imx_dwmac_probe(struct platform_device *pdev)plat_dat->exit = imx_dwmac_exit; plat_dat->clks_config = imx_dwmac_clks_config; plat_dat->fix_mac_speed = imx_dwmac_fix_speed;drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c static int imx_dwmac_probe(struct platform_device *pdev) · line 366
Quoted 8 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c +3
-0+if (of_machine_is_compatible ("fsl,imx93" )) + plat_dat->fix_mac_speed = imx_dwmac_fix_speed_mx93; 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)--
Pengutronix e.K. | Johannes Zink |
Steuerwalder Str. 21 |
https://www.pe/
ngutronix.de%2F&data=05%7C01%7Cshenwei.wang%40nxp.com%7C761fbb75c 1c24cfe091508db928d8ade%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C 0%7C638264908852977732%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjA wMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C% 7C&sdata=2l2zNfIaNnRJENmERehNae8g%2F%2BQqlxD2YRx7ksY2X%2BE%3D&r
eserved=0 |31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686| Fax: +49-5121-206917-5555 |
Signature · 4 lines
Pengutronix e.K. | Johannes Zink | Steuerwalder Str. 21 | https://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686| Fax: +49-5121-206917-5555 |
RE: [EXT] Re: [PATCH v3 net 2/2] net: stmmac: dwmac-imx: pause the TXC clock in fixed-link
Quoted 94 lines
-----Original Message-----
From: Johannes Zink <[email protected]>
Sent: Wednesday, August 2, 2023 1:26 AM
To: Shenwei Wang <[email protected]>; Russell King <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; Maxime Coquelin <[email protected]>; Shawn Guo <[email protected]>; Sascha Hauer <[email protected]>; Neil Armstrong <[email protected]>; Kevin Hilman <[email protected]>; Vinod Koul <[email protected]>; Chen- Yu Tsai <[email protected]>; Jernej Skrabec <[email protected]>; Samuel Holland <[email protected]>
Cc: Giuseppe Cavallaro <[email protected]>; Alexandre Torgue <[email protected]>; Jose Abreu <[email protected]>; Pengutronix Kernel Team <[email protected]>; Fabio Estevam <[email protected]>; dl-linux-imx <[email protected]>; Jerome Brunet <[email protected]>; Martin Blumenstingl <[email protected]>; Bhupesh Sharma <[email protected]>; Nobuhiro Iwamatsu <[email protected]>; Simon Horman <[email protected]>; Andrew Halaney <[email protected]>; Bartosz Golaszewski <[email protected]>; Wong Vee Khee <[email protected]>; Revanth Kumar Uppala <[email protected]>; Jochen Henneberg <[email protected]>; [email protected]; linux- [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Frank Li <[email protected]>
Subject: Re: [EXT] Re: [PATCH v3 net 2/2] net: stmmac: dwmac-imx: pause the TXC clock in fixed-linkCaution: This is an external email. Please take care when clicking links or opening attachments. When in doubt, report the message using the 'Report this email' button
Hi Shenwei,
Quoted 10 lines · Shenwei Wang
Quoted 10 lines
-----Original Message-----
From: Johannes Zink <[email protected]>
Sent: Tuesday, August 1, 2023 7:48 AM
To: Shenwei Wang <[email protected]>; Russell King <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; Maxime Coquelin <[email protected]>; Shawn Guo <[email protected]>;Sascha
Quoted 43 lines
Quoted 42 lines
Hauer <[email protected]>; Neil Armstrong <[email protected]>; Kevin Hilman <[email protected]>; Vinod Koul <[email protected]>; Chen- Yu Tsai <[email protected]>; Jernej Skrabec <[email protected]>; Samuel Holland <[email protected]>
Cc: Giuseppe Cavallaro <[email protected]>; Alexandre Torgue <[email protected]>; Jose Abreu <[email protected]>; Pengutronix Kernel Team <[email protected]>; Fabio Estevam <[email protected]>; dl-linux-imx <[email protected]>; Jerome Brunet <[email protected]>; Martin Blumenstingl <[email protected]>; Bhupesh Sharma <[email protected]>; Nobuhiro Iwamatsu <[email protected]>; Simon Horman <[email protected]>; Andrew Halaney <[email protected]>; Bartosz Golaszewski <[email protected]>; Wong Vee Khee <[email protected]>; Revanth Kumar Uppala <[email protected]>; Jochen Henneberg <[email protected]>; [email protected]; linux- [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Frank Li <[email protected]>
Subject: [EXT] Re: [PATCH v3 net 2/2] net: stmmac: dwmac-imx: pause the TXC clock in fixed-linkCaution: This is an external email. Please take care when clicking links or opening attachments. When in doubt, report the message using the 'Report this email' button
Hi Shenwei,
thanks for your patch.
Quoted 3 lines · Shenwei Wang
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).
If this is only required for some devices, is it safe to enforce this behaviour unconditionally for any kind of fixed link devices connected to the MX93 EQOS or could this possibly break for other devices?
Quoted 8 lines
Quoted 2 lines
It won't impact normal devices. The link layer hasn't built up yet.
As Russel suggested in [1] - maybe you could rephrase your commit message for your v4 to point this out to future reviewers (apparently multiple people have had questions about this...) and have this fact also recorded in the git log later on.
Okay.
Quoted 3 lines
Also: does this only apply to i.MX93, or would we have to test and enable it on e.g. i.MX8MP as well?
Yes, it is required when the EQOS MAC is selected. However, this patch just enables The feature on i.MX93.
Thanks,
Shenwei
Quoted 155 lines
Thanks
Johannes[1] ZMk/[email protected]
Quoted 18 lines
Thanks,
ShenweiQuoted 15 lines
Best regards
JohannesQuoted 12 lines
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.
So far we have only enabled this feature on the i.MX93 platform.
Signed-off-by Shenwei Wang <[email protected]>Reviewed-by Frank Li <[email protected]>--- .../net/ethernet/stmicro/stmmac/dwmac-imx.c | 42+++++++++++++++++++
Quoted 83 lines
Quoted 83 lines
Quoted 83 lines
1 file changed, 42 insertions(+)drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c +3
-0@@ -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;@@ -56,6 +58,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 +215,42 @@static void
imx_dwmac_fix_speed(void *priv, uint speed, uint mode)dev_err(dwmac->dev, "failed to set tx rate %lu\n", rate);}
drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c +39
-0+static void imx_dwmac_fix_speed_mx93 (void *priv,uint speed,uint +mode) { +struct imx_priv_data *dwmac = priv; +int ctrl, old_ctrl, iface; + +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 and avoid CPU/Compiler +* reordering. +*/ +wmb (); + +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; @@ -317,8 +356,11 @@ static int imx_dwmac_probe(struct platform_device *pdev) plat_dat->exit = imx_dwmac_exit; plat_dat->clks_config = imx_dwmac_clks_config; plat_dat->fix_mac_speed = imx_dwmac_fix_speed; +if (of_machine_is_compatible ("fsl,imx93" )) + plat_dat->fix_mac_speed = imx_dwmac_fix_speed_mx93; plat_dat->bsp_priv = dwmac; dwmac->plat_dat = plat_dat; + dwmac->base_addr = stmmac_res.addr;Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
ret = imx_dwmac_clks_config(dwmac, true); if (ret)--
Pengutronix e.K. | Johannes Zink |
Steuerwalder Str. 21 |
https://www/
.pe%2F&data=05%7C01%7Cshenwei.wang%40nxp.com%7Ccfd142f0d60a461ee01408
Quoted 1 line
Quoted 1 line
db9321578d%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C63826554 36335
Quoted 1 line
Quoted 1 line
61986%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luM zIiLCJ
Quoted 1 line
Quoted 1 line
BTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=CV10o1M%2BOj DPOaH5C
Quoted 2 lines
Quoted 2 lines
y%2Fka%2B0aOMs0IaVapMH7aa3RnTI%3D&reserved=0
ngutronix.de%2F&data=05%7C01%7Cshenwei.wang%40nxp.com%7C761fbb75c
Quoted 1 line
Quoted 1 line
1c24cfe091508db928d8ade%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C
Quoted 1 line
Quoted 1 line
0%7C638264908852977732%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjA
Quoted 1 line
Quoted 1 line
wMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%
Quoted 1 line
Quoted 1 line
7C&sdata=2l2zNfIaNnRJENmERehNae8g%2F%2BQqlxD2YRx7ksY2X%2BE%3D&r
Quoted 5 lines
Quoted 3 lines
eserved=0 |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686| Fax: +49-5121-206917-5555 |--
Pengutronix e.K. | Johannes Zink |
Steuerwalder Str. 21 |
https://www.pe/
ngutronix.de%2F&data=05%7C01%7Cshenwei.wang%40nxp.com%7Ccfd142f0d 60a461ee01408db9321578d%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7 C0%7C638265543633561986%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLj AwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C %7C&sdata=yKzNPsHqD%2FxU%2FRmzLn4JSQjmuT9tU8SabLxHyGTTmms%3D&r
eserved=0 |31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686| Fax: +49-5121-206917-5555 |
Re: [EXT] Re: [PATCH v3 net 2/2] net: stmmac: dwmac-imx: pause the TXC clock in fixed-link
Hi Shenwei,
Quoted 103 lines · Shenwei Wang
Quoted 94 lines
-----Original Message-----
From: Johannes Zink <[email protected]>
Sent: Wednesday, August 2, 2023 1:26 AM
To: Shenwei Wang <[email protected]>; Russell King <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; Maxime Coquelin <[email protected]>; Shawn Guo <[email protected]>; Sascha Hauer <[email protected]>; Neil Armstrong <[email protected]>; Kevin Hilman <[email protected]>; Vinod Koul <[email protected]>; Chen- Yu Tsai <[email protected]>; Jernej Skrabec <[email protected]>; Samuel Holland <[email protected]>
Cc: Giuseppe Cavallaro <[email protected]>; Alexandre Torgue <[email protected]>; Jose Abreu <[email protected]>; Pengutronix Kernel Team <[email protected]>; Fabio Estevam <[email protected]>; dl-linux-imx <[email protected]>; Jerome Brunet <[email protected]>; Martin Blumenstingl <[email protected]>; Bhupesh Sharma <[email protected]>; Nobuhiro Iwamatsu <[email protected]>; Simon Horman <[email protected]>; Andrew Halaney <[email protected]>; Bartosz Golaszewski <[email protected]>; Wong Vee Khee <[email protected]>; Revanth Kumar Uppala <[email protected]>; Jochen Henneberg <[email protected]>; [email protected]; linux- [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Frank Li <[email protected]>
Subject: Re: [EXT] Re: [PATCH v3 net 2/2] net: stmmac: dwmac-imx: pause the TXC clock in fixed-linkCaution: This is an external email. Please take care when clicking links or opening attachments. When in doubt, report the message using the 'Report this email' button
Hi Shenwei,
Quoted 10 lines · Shenwei Wang
Quoted 10 lines
-----Original Message-----
From: Johannes Zink <[email protected]>
Sent: Tuesday, August 1, 2023 7:48 AM
To: Shenwei Wang <[email protected]>; Russell King <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; Maxime Coquelin <[email protected]>; Shawn Guo <[email protected]>;Sascha
Quoted 43 lines
Quoted 42 lines
Hauer <[email protected]>; Neil Armstrong <[email protected]>; Kevin Hilman <[email protected]>; Vinod Koul <[email protected]>; Chen- Yu Tsai <[email protected]>; Jernej Skrabec <[email protected]>; Samuel Holland <[email protected]>
Cc: Giuseppe Cavallaro <[email protected]>; Alexandre Torgue <[email protected]>; Jose Abreu <[email protected]>; Pengutronix Kernel Team <[email protected]>; Fabio Estevam <[email protected]>; dl-linux-imx <[email protected]>; Jerome Brunet <[email protected]>; Martin Blumenstingl <[email protected]>; Bhupesh Sharma <[email protected]>; Nobuhiro Iwamatsu <[email protected]>; Simon Horman <[email protected]>; Andrew Halaney <[email protected]>; Bartosz Golaszewski <[email protected]>; Wong Vee Khee <[email protected]>; Revanth Kumar Uppala <[email protected]>; Jochen Henneberg <[email protected]>; [email protected]; linux- [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Frank Li <[email protected]>
Subject: [EXT] Re: [PATCH v3 net 2/2] net: stmmac: dwmac-imx: pause the TXC clock in fixed-linkCaution: This is an external email. Please take care when clicking links or opening attachments. When in doubt, report the message using the 'Report this email' button
Hi Shenwei,
thanks for your patch.
Quoted 3 lines · Shenwei Wang
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).
If this is only required for some devices, is it safe to enforce this behaviour unconditionally for any kind of fixed link devices connected to the MX93 EQOS or could this possibly break for other devices?
Quoted 8 lines
Quoted 2 lines
It won't impact normal devices. The link layer hasn't built up yet.
As Russel suggested in [1] - maybe you could rephrase your commit message for your v4 to point this out to future reviewers (apparently multiple people have had questions about this...) and have this fact also recorded in the git log later on.
Quoted 8 lines
Okay.
Quoted 3 lines
Also: does this only apply to i.MX93, or would we have to test and enable it on e.g. i.MX8MP as well?
Yes, it is required when the EQOS MAC is selected. However, this patch just enables The feature on i.MX93.
If this behaviour is required on all EQOS, I think the name imx_dwmac_fix_speed_mx93() is misleading. It should either be imx_dwmac_fix_speed() if applicable to all imx implementations, or dwmac_fix_speed() (and moved to a non-gluecode file) if applicable for all implementations in general.
You can then add a second patch for enabling it for the i.mx93 in the gluecode driver.
Johannes
Quoted 161 lines
Thanks,
ShenweiQuoted 155 lines
Thanks
Johannes[1] ZMk/[email protected]
Quoted 18 lines
Thanks,
ShenweiQuoted 15 lines
Best regards
JohannesQuoted 12 lines
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.
So far we have only enabled this feature on the i.MX93 platform.
Signed-off-by Shenwei Wang <[email protected]>Reviewed-by Frank Li <[email protected]>--- .../net/ethernet/stmicro/stmmac/dwmac-imx.c | 42+++++++++++++++++++
Quoted 83 lines
Quoted 83 lines
Quoted 83 lines
1 file changed, 42 insertions(+)drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c +3
-0@@ -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;@@ -56,6 +58,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 +215,42 @@static void
imx_dwmac_fix_speed(void *priv, uint speed, uint mode)dev_err(dwmac->dev, "failed to set tx rate %lu\n", rate); }drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c +39
-0+static void imx_dwmac_fix_speed_mx93 (void *priv,uint speed,uint +mode) { +struct imx_priv_data *dwmac = priv; +int ctrl, old_ctrl, iface; + +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 and avoid CPU/Compiler +* reordering. +*/ +wmb (); + +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; @@ -317,8 +356,11 @@ static int imx_dwmac_probe(struct platform_device *pdev) plat_dat->exit = imx_dwmac_exit; plat_dat->clks_config = imx_dwmac_clks_config; plat_dat->fix_mac_speed = imx_dwmac_fix_speed; +if (of_machine_is_compatible ("fsl,imx93" )) + plat_dat->fix_mac_speed = imx_dwmac_fix_speed_mx93; plat_dat->bsp_priv = dwmac; dwmac->plat_dat = plat_dat; + dwmac->base_addr = stmmac_res.addr;Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
ret = imx_dwmac_clks_config(dwmac, true); if (ret)--
Pengutronix e.K. | Johannes Zink |
Steuerwalder Str. 21 |
https://www/
.pe%2F&data=05%7C01%7Cshenwei.wang%40nxp.com%7Ccfd142f0d60a461ee01408
Quoted 1 line
Quoted 1 line
db9321578d%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C63826554 36335
Quoted 1 line
Quoted 1 line
61986%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luM zIiLCJ
Quoted 1 line
Quoted 1 line
BTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=CV10o1M%2BOj DPOaH5C
Quoted 2 lines
Quoted 2 lines
y%2Fka%2B0aOMs0IaVapMH7aa3RnTI%3D&reserved=0
ngutronix.de%2F&data=05%7C01%7Cshenwei.wang%40nxp.com%7C761fbb75c
Quoted 1 line
Quoted 1 line
1c24cfe091508db928d8ade%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C
Quoted 1 line
Quoted 1 line
0%7C638264908852977732%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjA
Quoted 1 line
Quoted 1 line
wMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%
Quoted 1 line
Quoted 1 line
7C&sdata=2l2zNfIaNnRJENmERehNae8g%2F%2BQqlxD2YRx7ksY2X%2BE%3D&r
Quoted 5 lines
Quoted 3 lines
eserved=0 |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686| Fax: +49-5121-206917-5555 |--
Pengutronix e.K. | Johannes Zink |
Steuerwalder Str. 21 |
https://www.pe/
ngutronix.de%2F&data=05%7C01%7Cshenwei.wang%40nxp.com%7Ccfd142f0d 60a461ee01408db9321578d%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7 C0%7C638265543633561986%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLj AwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C %7C&sdata=yKzNPsHqD%2FxU%2FRmzLn4JSQjmuT9tU8SabLxHyGTTmms%3D&r
eserved=0 |31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686| Fax: +49-5121-206917-5555 |
Signature · 4 lines
Pengutronix e.K. | Johannes Zink | Steuerwalder Str. 21 | https://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686| Fax: +49-5121-206917-5555 |
RE: [EXT] Re: [PATCH v3 net 2/2] net: stmmac: dwmac-imx: pause the TXC clock in fixed-link
Quoted 153 lines
-----Original Message-----
From: Johannes Zink <[email protected]>
Sent: Wednesday, August 2, 2023 9:40 AM
To: Shenwei Wang <[email protected]>; Russell King <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; Maxime Coquelin <[email protected]>; Shawn Guo <[email protected]>; Sascha Hauer <[email protected]>; Neil Armstrong <[email protected]>; Kevin Hilman <[email protected]>; Vinod Koul <[email protected]>; Chen- Yu Tsai <[email protected]>; Jernej Skrabec <[email protected]>; Samuel Holland <[email protected]>
Cc: Giuseppe Cavallaro <[email protected]>; Alexandre Torgue <[email protected]>; Jose Abreu <[email protected]>; Pengutronix Kernel Team <[email protected]>; Fabio Estevam <[email protected]>; dl-linux-imx <[email protected]>; Jerome Brunet <[email protected]>; Martin Blumenstingl <[email protected]>; Bhupesh Sharma <[email protected]>; Nobuhiro Iwamatsu <[email protected]>; Simon Horman <[email protected]>; Andrew Halaney <[email protected]>; Bartosz Golaszewski <[email protected]>; Wong Vee Khee <[email protected]>; Revanth Kumar Uppala <[email protected]>; Jochen Henneberg <[email protected]>; [email protected]; linux- [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Frank Li <[email protected]>
Subject: Re: [EXT] Re: [PATCH v3 net 2/2] net: stmmac: dwmac-imx: pause the TXC clock in fixed-linkCaution: This is an external email. Please take care when clicking links or opening attachments. When in doubt, report the message using the 'Report this email' button
Hi Shenwei,
Quoted 10 lines · Shenwei Wang
Quoted 10 lines
-----Original Message-----
From: Johannes Zink <[email protected]>
Sent: Wednesday, August 2, 2023 1:26 AM
To: Shenwei Wang <[email protected]>; Russell King <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; Maxime Coquelin <[email protected]>; Shawn Guo <[email protected]>;Sascha
Quoted 43 lines
Quoted 43 lines
Hauer <[email protected]>; Neil Armstrong <[email protected]>; Kevin Hilman <[email protected]>; Vinod Koul <[email protected]>; Chen- Yu Tsai <[email protected]>; Jernej Skrabec <[email protected]>; Samuel Holland <[email protected]>
Cc: Giuseppe Cavallaro <[email protected]>; Alexandre Torgue <[email protected]>; Jose Abreu <[email protected]>; Pengutronix Kernel Team <[email protected]>; Fabio Estevam <[email protected]>; dl-linux-imx <[email protected]>; Jerome Brunet <[email protected]>; Martin Blumenstingl <[email protected]>; Bhupesh Sharma <[email protected]>; Nobuhiro Iwamatsu <[email protected]>; Simon Horman <[email protected]>; Andrew Halaney <[email protected]>; Bartosz Golaszewski <[email protected]>; Wong Vee Khee <[email protected]>; Revanth Kumar Uppala <[email protected]>; Jochen Henneberg <[email protected]>; [email protected]; linux- [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Frank Li <[email protected]>
Subject: Re: [EXT] Re: [PATCH v3 net 2/2] net: stmmac: dwmac-imx:
pause the TXC clock in fixed-linkCaution: This is an external email. Please take care when clicking links or opening attachments. When in doubt, report the message using the 'Report this email' button
Hi Shenwei,
Quoted 10 lines · Shenwei Wang
Quoted 10 lines
-----Original Message-----
From: Johannes Zink <[email protected]>
Sent: Tuesday, August 1, 2023 7:48 AM
To: Shenwei Wang <[email protected]>; Russell King <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; Maxime Coquelin <[email protected]>; Shawn Guo <[email protected]>;Sascha
Quoted 14 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Hauer <[email protected]>; Neil Armstrong <[email protected]>; Kevin Hilman <[email protected]>; Vinod Koul <[email protected]>; Chen- Yu Tsai <[email protected]>; Jernej Skrabec <[email protected]>; Samuel Holland <[email protected]>
Cc: Giuseppe Cavallaro <[email protected]>; Alexandre TorgueQuoted 8 lines
Quoted 8 lines
Quoted 8 lines
<[email protected]>; Jose Abreu <[email protected]>; Pengutronix Kernel Team <[email protected]>; Fabio Estevam <[email protected]>; dl-linux-imx <[email protected]>; Jerome Brunet <[email protected]>; Martin Blumenstingl <[email protected]>; Bhupesh Sharma <[email protected]>; Nobuhiro Iwamatsu <[email protected]>; Simon Horman <[email protected]>; Andrew Halaney
Quoted 44 lines
Quoted 29 lines
Quoted 29 lines
Quoted 28 lines
Bartosz Golaszewski <[email protected]>; Wong Vee Khee <[email protected]>; Revanth Kumar Uppala <[email protected]>; Jochen Henneberg <[email protected]>; [email protected]; linux- [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Frank Li <[email protected]>
Subject: [EXT] Re: [PATCH v3 net 2/2] net: stmmac: dwmac-imx: pause the TXC clock in fixed-linkCaution: This is an external email. Please take care when clicking links or opening attachments. When in doubt, report the message using the 'Report this email' button
Hi Shenwei,
thanks for your patch.
Quoted 3 lines · Shenwei Wang
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).
If this is only required for some devices, is it safe to enforce this behaviour unconditionally for any kind of fixed link devices connected to the MX93 EQOS or could this possibly break for other devices?
Quoted 8 lines
Quoted 2 lines
It won't impact normal devices. The link layer hasn't built up yet.
As Russel suggested in [1] - maybe you could rephrase your commit message for your v4 to point this out to future reviewers (apparently multiple people have had questions about this...) and have this fact also recorded in the git log later on.
Okay.
Quoted 3 lines
Also: does this only apply to i.MX93, or would we have to test and enable it on e.g. i.MX8MP as well?
Quoted 9 lines
Quoted 2 lines
Yes, it is required when the EQOS MAC is selected. However, this patch just enables The feature on i.MX93.
If this behaviour is required on all EQOS, I think the name
imx_dwmac_fix_speed_mx93()is misleading. It should either beimx_dwmac_fix_speed()if applicable to all imx implementations, ordwmac_fix_speed()(and moved to a non-gluecode file) if applicable for all implementations in general.
It has the general fix_speed function there named imx_dwmac_fix_speed. This one is the special for this mx93 fix.
Thanks,
Shenwei
Quoted 207 lines
You can then add a second patch for enabling it for the i.mx93 in the gluecode driver.
Johannes
Quoted 121 lines
Thanks,
ShenweiQuoted 117 lines
Thanks
Johannes[1] ZMk/[email protected]
Quoted 18 lines
Thanks,
ShenweiQuoted 15 lines
Best regards
JohannesQuoted 12 lines
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.
So far we have only enabled this feature on the i.MX93 platform.
Signed-off-by Shenwei Wang <[email protected]>Reviewed-by Frank Li <[email protected]>--- .../net/ethernet/stmicro/stmmac/dwmac-imx.c | 42+++++++++++++++++++
Quoted 92 lines
Quoted 92 lines
Quoted 76 lines
1 file changed, 42 insertions(+)drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c +3
-0@@ -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;@@ -56,6 +58,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 +215,42@@ static void
imx_dwmac_fix_speed(void *priv, uint speed, uint mode)dev_err(dwmac->dev, "failed to set tx rate %lu\n", rate); }drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c +37
-0+static void imx_dwmac_fix_speed_mx93 (void *priv,uint speed,uint +mode) { +struct imx_priv_data *dwmac = priv; +int ctrl, old_ctrl, iface; + +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 and avoid CPU/Compiler +* reordering. +*/ +wmb (); + +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; @@ -317,8 +356,11 @@ static int imx_dwmac_probe(struct platform_device +*pdev) plat_dat->exit = imx_dwmac_exit;drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c static void imx_dwmac_fix_speed(void *priv, uint speed, uint mode)
Quoted 10 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c +3
-0plat_dat->clks_config = imx_dwmac_clks_config; plat_dat->fix_mac_speed = imx_dwmac_fix_speed; +if (of_machine_is_compatible ("fsl,imx93" )) + plat_dat->fix_mac_speed = imx_dwmac_fix_speed_mx93; 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)--
Pengutronix e.K. | Johannes Zink |
Steuerwalder Str. 21 |
https://www/
.pe%2F&data=05%7C01%7Cshenwei.wang%40nxp.com%7Ccfd142f0d60a461
Quoted 3 lines
Quoted 3 lines
ee01408
Quoted 1 line
Quoted 1 line
db9321578d%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C63826554
Quoted 3 lines
Quoted 3 lines
36335
Quoted 1 line
Quoted 1 line
61986%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luM
Quoted 3 lines
Quoted 3 lines
zIiLCJ
Quoted 1 line
Quoted 1 line
BTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=CV10o1M%2BOj
Quoted 4 lines
Quoted 4 lines
DPOaH5C
Quoted 2 lines
Quoted 2 lines
y%2Fka%2B0aOMs0IaVapMH7aa3RnTI%3D&reserved=0
ngutronix.de%2F&data=05%7C01%7Cshenwei.wang%40nxp.com%7C761fbb75c
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
Quoted 1 line
1c24cfe091508db928d8ade%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
Quoted 1 line
0%7C638264908852977732%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjA
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
Quoted 1 line
wMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
Quoted 1 line
7C&sdata=2l2zNfIaNnRJENmERehNae8g%2F%2BQqlxD2YRx7ksY2X%2BE%3D&r
Quoted 11 lines
Quoted 11 lines
Quoted 5 lines
Quoted 3 lines
eserved=0 |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686| Fax: +49-5121-206917-5555 |--
Pengutronix e.K. | Johannes Zink |
Steuerwalder Str. 21 |
https://www/
.pe%2F&data=05%7C01%7Cshenwei.wang%40nxp.com%7Cdc64404f8c2c4e
b87a7808Quoted 1 line
Quoted 1 line
db93666ec9%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C63826584 03801
Quoted 1 line
Quoted 1 line
74614%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luM zIiLCJ
Quoted 1 line
Quoted 1 line
BTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=oxLnb3ppqjhMti cQH7P
Quoted 2 lines
Quoted 2 lines
lfRbIlYJ2R1Z8Tg7Bz2vC%2F%2Bc%3D&reserved=0
ngutronix.de%2F&data=05%7C01%7Cshenwei.wang%40nxp.com%7Ccfd142f0d
Quoted 1 line
Quoted 1 line
60a461ee01408db9321578d%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7
Quoted 1 line
Quoted 1 line
C0%7C638265543633561986%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLj
Quoted 1 line
Quoted 1 line
AwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C
Quoted 1 line
Quoted 1 line
%7C&sdata=yKzNPsHqD%2FxU%2FRmzLn4JSQjmuT9tU8SabLxHyGTTmms%3
D&r
Quoted 5 lines
Quoted 3 lines
eserved=0 |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686| Fax: +49-5121-206917-5555 |--
Pengutronix e.K. | Johannes Zink |
Steuerwalder Str. 21 |
https://www.pe/
ngutronix.de%2F&data=05%7C01%7Cshenwei.wang%40nxp.com%7Cdc64404f8 c2c4eb87a7808db93666ec9%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7 C0%7C638265840380174614%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLj AwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C %7C&sdata=r8tFe0Ts3ev2c7lg3MK0Qc40101d7W%2BEwnpmvMDwjho%3D&res
erved=0 |31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686| Fax: +49-5121-206917-5555 |
Re: [EXT] Re: [PATCH v3 net 2/2] net: stmmac: dwmac-imx: pause the TXC clock in fixed-link
Hi Shenwei,
[snip]
Quoted 15 lines
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Also: does this only apply to i.MX93, or would we have to test and enable it on e.g. i.MX8MP as well?
Quoted 9 lines
Quoted 2 lines
Yes, it is required when the EQOS MAC is selected. However, this patch just enables The feature on i.MX93.
If this behaviour is required on all EQOS, I think the name
imx_dwmac_fix_speed_mx93()is misleading. It should either beimx_dwmac_fix_speed()if applicable to all imx implementations, ordwmac_fix_speed()(and moved to a non-gluecode file) if applicable for all implementations in general.
Quoted 2 lines
It has the general
fix_speedfunction there namedimx_dwmac_fix_speed. This one is the special for this mx93 fix.
I think I might have misunderstood your last statement or I failed to express my point. If you need to replace the dwmac_fix_speed() on mx93, because this SoC implementation requires doing so (the usual reason for doing something like this is something like reset quirks because of screwed up IP Core integration), then your approach is imho valid.
But if I got your last comment right, your changes should apply to EQOS MAC in general (but you want to only enable it for mx93 at the moment). In this case this quirk will later be as the fix_mac_speed function for other hardware as well, in which case the name ..._mx93 is misleading, and imho rather a descriptive name should be used (i.e. have the name describe what it does rather than for what hardware it is implemented).
Except if the maintainers have a strong opinion that the ..._mx93 suffix version is exactly how you should proceed...
Best regards
Johannes
Quoted 4 lines
Thanks,
Shenwei
[snip]
Signature · 4 lines
Pengutronix e.K. | Johannes Zink | Steuerwalder Str. 21 | https://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686| Fax: +49-5121-206917-5555 |
RE: [EXT] Re: [PATCH v3 net 2/2] net: stmmac: dwmac-imx: pause the TXC clock in fixed-link
Quoted 31 lines
-----Original Message-----
From: Johannes Zink <[email protected]>
Sent: Thursday, August 3, 2023 1:36 AM
To: Shenwei Wang <[email protected]>; Russell King <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; Maxime Coquelin <[email protected]>; Shawn Guo <[email protected]>; Sascha Hauer <[email protected]>; Neil Armstrong <[email protected]>; Kevin Hilman <[email protected]>; Vinod Koul <[email protected]>; Chen- Yu Tsai <[email protected]>; Jernej Skrabec <[email protected]>; Samuel Holland <[email protected]>
Cc: Giuseppe Cavallaro <[email protected]>; Alexandre Torgue <[email protected]>; Jose Abreu <[email protected]>; Pengutronix Kernel Team <[email protected]>; Fabio Estevam <[email protected]>; dl-linux-imx <[email protected]>; Jerome Brunet <[email protected]>; Martin Blumenstingl <[email protected]>; Bhupesh Sharma <[email protected]>; Nobuhiro Iwamatsu <[email protected]>; Simon HormanQuoted 2 lines
It has the general
fix_speedfunction there namedimx_dwmac_fix_speed. This one is the special for this mx93 fix.I think I might have misunderstood your last statement or I failed to express my point. If you need to replace the
dwmac_fix_speed()on mx93, because this SoC implementation requires doing so (the usual reason for doing something like this is something like reset quirks because of screwed up IP Core integration), then your approach is imho valid.
Quoted 7 lines
But if I got your last comment right, your changes should apply to EQOS MAC in general (but you want to only enable it for mx93 at the moment). In this case this quirk will later be as the
fix_mac_speedfunction for other hardware as well, in which case the name ..._mx93 is misleading, and imho rather a descriptive name should be used (i.e. have the name describe what it does rather than for what hardware it is implemented).
The idea of supporting the SJA1105 is general, but the implementation depends on the specific SoC. This patch provides the implementation for the MX93 SoC. To support the MX8x SoCs, the implementation would need to be rewritten based on the current state of the dwmac-imx driver.
I agree the function name is somewhat ugly. Maybe a better name could be:mx93_dwmac_fix_speed()
The assumption is that the process of pausing the clock can still be considered part of fixing the speed.
Thanks,
Shenwei
Quoted 24 lines
Except if the maintainers have a strong opinion that the ..._mx93 suffix version is exactly how you should proceed...
Best regards
JohannesQuoted 4 lines
Thanks,
Shenwei
[snip]--
Pengutronix e.K. | Johannes Zink |
Steuerwalder Str. 21 |
https://www.pe/
ngutronix.de%2F&data=05%7C01%7Cshenwei.wang%40nxp.com%7Cd328d89d 14e847270d5a08db93ebff01%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7 C0%7C638266414027048795%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLj AwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C %7C&sdata=dkE9Es7kl3uNYx8zJYZt2r6933dSNtYDpQzCEagAV3M%3D&reserved
=0 |31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686| Fax: +49-5121-206917-5555 |