Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'net-stmmac-deprecate-snps-en-tx-lpi-clockgating-property'

Russell King says:

====================
net: stmmac: deprecate "snps,en-tx-lpi-clockgating" property

This series deprecates the "snps,en-tx-lpi-clockgating" property for
stmmac.

MII Transmit clock gating, where the MAC hardware supports gating this
clock, is a function of the connected PHY capabilities, which it
reports through its status register.

GMAC versions that support transmit clock gating twiddle the LPITCSE
bit accordingly in the LPI control/status register, which is handled
by the GMAC core specific code.

So, "snps,en-tx-lpi-clockgating" not something that is a GMAC property,
but is a work-around for phylib not providing an interface to determine
whether the PHY allows the transmit clock to be disabled.

This series converts the two SoCs that make use of this property (which,
I hasten to add, is set in the SoC code) to use the PHY capability bit
instead of a DT property, then removes the DT property from the .dtsi,
deprecates it in the snps,dwmac binding, and finally in the stmmac code.

I am expecting some discussion on how to merge this, as I think the
order in which these changes is made is important - we don't want to
deprecate the old way until the new code has landed.
====================

Link: https://patch.msgid.link/Z9FVHEf3uUqtKzyt@shell.armlinux.org.uk
Signed-off-by: Paolo Abeni <pabeni@redhat.com>

+22 -9
+1
Documentation/devicetree/bindings/net/snps,dwmac.yaml
··· 494 494 495 495 snps,en-tx-lpi-clockgating: 496 496 $ref: /schemas/types.yaml#/definitions/flag 497 + deprecated: true 497 498 description: 498 499 Enable gating of the MAC TX clock during TX low-power mode 499 500
-1
arch/arm/boot/dts/st/stm32mp151.dtsi
··· 1781 1781 st,syscon = <&syscfg 0x4>; 1782 1782 snps,mixed-burst; 1783 1783 snps,pbl = <2>; 1784 - snps,en-tx-lpi-clockgating; 1785 1784 snps,axi-config = <&stmmac_axi_config_0>; 1786 1785 snps,tso; 1787 1786 access-controllers = <&etzpc 94>;
-2
arch/riscv/boot/dts/starfive/jh7110.dtsi
··· 1022 1022 snps,force_thresh_dma_mode; 1023 1023 snps,axi-config = <&stmmac_axi_setup>; 1024 1024 snps,tso; 1025 - snps,en-tx-lpi-clockgating; 1026 1025 snps,txpbl = <16>; 1027 1026 snps,rxpbl = <16>; 1028 1027 starfive,syscon = <&aon_syscon 0xc 0x12>; ··· 1052 1053 snps,force_thresh_dma_mode; 1053 1054 snps,axi-config = <&stmmac_axi_setup>; 1054 1055 snps,tso; 1055 - snps,en-tx-lpi-clockgating; 1056 1056 snps,txpbl = <16>; 1057 1057 snps,rxpbl = <16>; 1058 1058 starfive,syscon = <&sys_syscon 0x90 0x2>;
+1
drivers/net/ethernet/stmicro/stmmac/dwmac-starfive.c
··· 124 124 plat_dat->set_clk_tx_rate = stmmac_set_clk_tx_rate; 125 125 126 126 dwmac->dev = &pdev->dev; 127 + plat_dat->flags |= STMMAC_FLAG_EN_TX_LPI_CLK_PHY_CAP; 127 128 plat_dat->bsp_priv = dwmac; 128 129 plat_dat->dma_cfg->dche = true; 129 130
+1
drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c
··· 538 538 return ret; 539 539 } 540 540 541 + plat_dat->flags |= STMMAC_FLAG_EN_TX_LPI_CLK_PHY_CAP; 541 542 plat_dat->bsp_priv = dwmac; 542 543 543 544 ret = stm32_dwmac_init(plat_dat, false);
+1
drivers/net/ethernet/stmicro/stmmac/stmmac.h
··· 306 306 struct timer_list eee_ctrl_timer; 307 307 int lpi_irq; 308 308 u32 tx_lpi_timer; 309 + bool tx_lpi_clk_stop; 309 310 bool eee_enabled; 310 311 bool eee_active; 311 312 bool eee_sw_timer_en;
+12 -4
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
··· 457 457 /* Check and enter in LPI mode */ 458 458 if (!priv->tx_path_in_lpi_mode) 459 459 stmmac_set_lpi_mode(priv, priv->hw, STMMAC_LPI_FORCED, 460 - priv->plat->flags & STMMAC_FLAG_EN_TX_LPI_CLOCKGATING, 461 - 0); 460 + priv->tx_lpi_clk_stop, 0); 462 461 } 463 462 464 463 /** ··· 1103 1104 1104 1105 priv->eee_enabled = true; 1105 1106 1107 + /* Update the transmit clock stop according to PHY capability if 1108 + * the platform allows 1109 + */ 1110 + if (priv->plat->flags & STMMAC_FLAG_EN_TX_LPI_CLK_PHY_CAP) 1111 + priv->tx_lpi_clk_stop = tx_clk_stop; 1112 + 1106 1113 stmmac_set_eee_timer(priv, priv->hw, STMMAC_DEFAULT_LIT_LS, 1107 1114 STMMAC_DEFAULT_TWT_LS); 1108 1115 1109 1116 /* Try to cnfigure the hardware timer. */ 1110 1117 ret = stmmac_set_lpi_mode(priv, priv->hw, STMMAC_LPI_TIMER, 1111 - priv->plat->flags & STMMAC_FLAG_EN_TX_LPI_CLOCKGATING, 1112 - priv->tx_lpi_timer); 1118 + priv->tx_lpi_clk_stop, priv->tx_lpi_timer); 1113 1119 1114 1120 if (ret) { 1115 1121 /* Hardware timer mode not supported, or value out of range. ··· 1272 1268 1273 1269 if (!(priv->plat->flags & STMMAC_FLAG_RX_CLK_RUNS_IN_LPI)) 1274 1270 priv->phylink_config.eee_rx_clk_stop_enable = true; 1271 + 1272 + /* Set the default transmit clock stop bit based on the platform glue */ 1273 + priv->tx_lpi_clk_stop = priv->plat->flags & 1274 + STMMAC_FLAG_EN_TX_LPI_CLOCKGATING; 1275 1275 1276 1276 mdio_bus_data = priv->plat->mdio_bus_data; 1277 1277 if (mdio_bus_data)
+4 -1
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
··· 497 497 plat->force_sf_dma_mode = 498 498 of_property_read_bool(np, "snps,force_sf_dma_mode"); 499 499 500 - if (of_property_read_bool(np, "snps,en-tx-lpi-clockgating")) 500 + if (of_property_read_bool(np, "snps,en-tx-lpi-clockgating")) { 501 + dev_warn(&pdev->dev, 502 + "OF property snps,en-tx-lpi-clockgating is deprecated, please convert driver to use STMMAC_FLAG_EN_TX_LPI_CLK_PHY_CAP\n"); 501 503 plat->flags |= STMMAC_FLAG_EN_TX_LPI_CLOCKGATING; 504 + } 502 505 503 506 /* Set the maxmtu to a default of JUMBO_LEN in case the 504 507 * parameter is not present in the device tree.
+2 -1
include/linux/stmmac.h
··· 183 183 #define STMMAC_FLAG_INT_SNAPSHOT_EN BIT(9) 184 184 #define STMMAC_FLAG_RX_CLK_RUNS_IN_LPI BIT(10) 185 185 #define STMMAC_FLAG_EN_TX_LPI_CLOCKGATING BIT(11) 186 - #define STMMAC_FLAG_HWTSTAMP_CORRECT_LATENCY BIT(12) 186 + #define STMMAC_FLAG_EN_TX_LPI_CLK_PHY_CAP BIT(12) 187 + #define STMMAC_FLAG_HWTSTAMP_CORRECT_LATENCY BIT(13) 187 188 188 189 struct plat_stmmacenet_data { 189 190 int bus_id;