* [PATCH v4 0/4] net: stmmac: dwc-qos: Add FSD EQoS support
[not found] <CGME20240730092847epcas5p1338397b0ec01a4f0c8387704fb390a40@epcas5p1.samsung.com>
@ 2024-07-30 9:16 ` Swathi K S
[not found] ` <CGME20240730092855epcas5p49902519f31bddcfe7da8f4b96a7d0527@epcas5p4.samsung.com>
` (3 more replies)
0 siblings, 4 replies; 15+ messages in thread
From: Swathi K S @ 2024-07-30 9:16 UTC (permalink / raw)
To: krzk, robh, davem, edumazet, kuba, pabeni, conor+dt,
richardcochran, mcoquelin.stm32, andrew, alim.akhtar, linux-fsd
Cc: netdev, devicetree, linux-kernel, linux-stm32, linux-arm-kernel,
linux-samsung-soc, alexandre.torgue, peppe.cavallaro, joabreu,
swathi.ks, rcsekar, ssiddha, jayati.sahu, pankaj.dubey,
ravi.patel, gost.dev
SD platform has two instances of EQoS IP, one is in FSYS0 block and
another one is in PERIC block. This patch series add required DT binding,
DT file modifications and platform driver specific changes for the same.
Changes since v3:
1. Avoided using alias-id to configure the HW.
2. Addressed the review cooments on DT files given by Krzysztof
3. Modified the clock implementation.
Here is the link to v3 patches for reference:
https://patchwork.kernel.org/project/linux-arm-kernel/patch/20230814112539.70453-2-sriranjani.p@samsung.com/
https://patchwork.kernel.org/project/linux-arm-kernel/patch/20230814112539.70453-3-sriranjani.p@samsung.com/
https://patchwork.kernel.org/project/linux-arm-kernel/patch/20230814112539.70453-4-sriranjani.p@samsung.com/
https://patchwork.kernel.org/project/linux-arm-kernel/patch/20230814112539.70453-5-sriranjani.p@samsung.com/
Swathi K S (4):
dt-bindings: net: Add FSD EQoS device tree bindings
net: stmmac: dwc-qos: Add FSD EQoS support
arm64: dts: fsd: Add Ethernet support for FSYS0 Block of FSD SoC
arm64: dts: fsd: Add Ethernet support for PERIC Block of FSD SoC
.../devicetree/bindings/net/snps,dwmac.yaml | 5 +-
.../devicetree/bindings/net/tesla,ethqos.yaml | 91 ++++++++++++++
arch/arm64/boot/dts/tesla/fsd-evb.dts | 18 +++
arch/arm64/boot/dts/tesla/fsd-pinctrl.dtsi | 112 ++++++++++++++++++
arch/arm64/boot/dts/tesla/fsd.dtsi | 47 ++++++++
.../stmicro/stmmac/dwmac-dwc-qos-eth.c | 90 ++++++++++++++
.../net/ethernet/stmicro/stmmac/stmmac_main.c | 28 ++++-
include/linux/stmmac.h | 1 +
8 files changed, 388 insertions(+), 4 deletions(-)
create mode 100644 Documentation/devicetree/bindings/net/tesla,ethqos.yaml
--
2.17.1
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v4 1/4] dt-bindings: net: Add FSD EQoS device tree bindings
[not found] ` <CGME20240730092855epcas5p49902519f31bddcfe7da8f4b96a7d0527@epcas5p4.samsung.com>
@ 2024-07-30 9:16 ` Swathi K S
2024-08-06 14:57 ` Rob Herring
0 siblings, 1 reply; 15+ messages in thread
From: Swathi K S @ 2024-07-30 9:16 UTC (permalink / raw)
To: krzk, robh, davem, edumazet, kuba, pabeni, conor+dt,
richardcochran, mcoquelin.stm32, andrew, alim.akhtar, linux-fsd
Cc: netdev, devicetree, linux-kernel, linux-stm32, linux-arm-kernel,
linux-samsung-soc, alexandre.torgue, peppe.cavallaro, joabreu,
swathi.ks, rcsekar, ssiddha, jayati.sahu, pankaj.dubey,
ravi.patel, gost.dev
Add FSD Ethernet compatible in Synopsys dt-bindings document. Add FSD
Ethernet YAML schema to enable the DT validation.
Signed-off-by: Pankaj Dubey <pankaj.dubey@samsung.com>
Signed-off-by: Ravi Patel <ravi.patel@samsung.com>
Signed-off-by: Swathi K S <swathi.ks@samsung.com>
---
.../devicetree/bindings/net/snps,dwmac.yaml | 5 +-
.../devicetree/bindings/net/tesla,ethqos.yaml | 91 +++++++++++++++++++
2 files changed, 94 insertions(+), 2 deletions(-)
create mode 100644 Documentation/devicetree/bindings/net/tesla,ethqos.yaml
diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
index 3eb65e63fdae..0da11fe98cec 100644
--- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml
+++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
@@ -98,6 +98,7 @@ properties:
- snps,dwxgmac-2.10
- starfive,jh7100-dwmac
- starfive,jh7110-dwmac
+ - tesla,fsd-ethqos
reg:
minItems: 1
@@ -121,7 +122,7 @@ properties:
clocks:
minItems: 1
- maxItems: 8
+ maxItems: 10
additionalItems: true
items:
- description: GMAC main clock
@@ -133,7 +134,7 @@ properties:
clock-names:
minItems: 1
- maxItems: 8
+ maxItems: 10
additionalItems: true
contains:
enum:
diff --git a/Documentation/devicetree/bindings/net/tesla,ethqos.yaml b/Documentation/devicetree/bindings/net/tesla,ethqos.yaml
new file mode 100644
index 000000000000..9246b0395126
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/tesla,ethqos.yaml
@@ -0,0 +1,91 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/tesla,ethqos.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: FSD Ethernet Quality of Service
+
+maintainers:
+ - Swathi K S <swathi.ks@samsung.com>
+
+description:
+ dwmmac based tesla ethernet devices which support Gigabit
+ ethernet.
+
+allOf:
+ - $ref: snps,dwmac.yaml#
+
+properties:
+ compatible:
+ const: tesla,fsd-ethqos.yaml
+
+ reg:
+ maxItems: 1
+
+ interrupts:
+ maxItems: 1
+
+ clocks:
+ minItems: 5
+ maxItems: 10
+
+ clock-names:
+ minItems: 5
+ maxItems: 10
+
+ iommus:
+ maxItems: 1
+
+ phy-mode:
+ $ref: ethernet-controller.yaml#/properties/phy-connection-type
+
+required:
+ - compatible
+ - reg
+ - interrupts
+ - clocks
+ - clock-names
+ - iommus
+ - phy-mode
+
+unevaluatedProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/clock/fsd-clk.h>
+ #include <dt-bindings/interrupt-controller/arm-gic.h>
+
+ ethernet_1: ethernet@14300000 {
+ compatible = "tesla,fsd-ethqos";
+ reg = <0x0 0x14300000 0x0 0x10000>;
+ interrupts = <GIC_SPI 176 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&clock_peric PERIC_EQOS_TOP_IPCLKPORT_CLK_PTP_REF_I>,
+ <&clock_peric PERIC_EQOS_TOP_IPCLKPORT_ACLK_I>,
+ <&clock_peric PERIC_EQOS_TOP_IPCLKPORT_HCLK_I>,
+ <&clock_peric PERIC_EQOS_TOP_IPCLKPORT_RGMII_CLK_I>,
+ <&clock_peric PERIC_EQOS_TOP_IPCLKPORT_CLK_RX_I>,
+ <&clock_peric PERIC_BUS_D_PERIC_IPCLKPORT_EQOSCLK>,
+ <&clock_peric PERIC_BUS_P_PERIC_IPCLKPORT_EQOSCLK>,
+ <&clock_peric PERIC_EQOS_PHYRXCLK_MUX>,
+ <&clock_peric PERIC_EQOS_PHYRXCLK>,
+ <&clock_peric PERIC_DOUT_RGMII_CLK>;
+ clock-names = "ptp_ref",
+ "master_bus",
+ "slave_bus",
+ "tx",
+ "rx",
+ "master2_bus",
+ "slave2_bus",
+ "eqos_rxclk_mux",
+ "eqos_phyrxclk",
+ "dout_peric_rgmii_clk";
+ pinctrl-names = "default";
+ pinctrl-0 = <ð1_tx_clk>, <ð1_tx_data>, <ð1_tx_ctrl>,
+ <ð1_phy_intr>, <ð1_rx_clk>, <ð1_rx_data>,
+ <ð1_rx_ctrl>, <ð1_mdio>;
+ iommus = <&smmu_peric 0x0 0x1>;
+ phy-mode = "rgmii-id";
+ };
+
+...
--
2.17.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v4 2/4] net: stmmac: dwc-qos: Add FSD EQoS support
[not found] ` <CGME20240730092902epcas5p1520f9cac624dad29f74a92ed4c559b25@epcas5p1.samsung.com>
@ 2024-07-30 9:16 ` Swathi K S
2024-07-30 20:14 ` Andrew Lunn
2024-08-01 19:09 ` Serge Semin
0 siblings, 2 replies; 15+ messages in thread
From: Swathi K S @ 2024-07-30 9:16 UTC (permalink / raw)
To: krzk, robh, davem, edumazet, kuba, pabeni, conor+dt,
richardcochran, mcoquelin.stm32, andrew, alim.akhtar, linux-fsd
Cc: netdev, devicetree, linux-kernel, linux-stm32, linux-arm-kernel,
linux-samsung-soc, alexandre.torgue, peppe.cavallaro, joabreu,
swathi.ks, rcsekar, ssiddha, jayati.sahu, pankaj.dubey,
ravi.patel, gost.dev
The FSD SoC contains two instance of the Synopsys DWC ethernet QOS IP core.
The binding that it uses is slightly different from existing ones because
of the integration (clocks, resets).
For FSD SoC, a mux switch is needed between internal and external clocks.
By default after reset internal clock is used but for receiving packets
properly, external clock is needed. Mux switch to external clock happens
only when the external clock is present.
Signed-off-by: Chandrasekar R <rcsekar@samsung.com>
Signed-off-by: Suresh Siddha <ssiddha@tesla.com>
Signed-off-by: Swathi K S <swathi.ks@samsung.com>
---
.../stmicro/stmmac/dwmac-dwc-qos-eth.c | 90 +++++++++++++++++++
.../net/ethernet/stmicro/stmmac/stmmac_main.c | 28 +++++-
include/linux/stmmac.h | 1 +
3 files changed, 117 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
index ec924c6c76c6..bc97b3b573b7 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
@@ -20,6 +20,7 @@
#include <linux/platform_device.h>
#include <linux/reset.h>
#include <linux/stmmac.h>
+#include <linux/regmap.h>
#include "stmmac_platform.h"
#include "dwmac4.h"
@@ -37,6 +38,13 @@ struct tegra_eqos {
struct gpio_desc *reset;
};
+struct fsd_eqos_plat_data {
+ const struct fsd_eqos_variant *fsd_eqos_inst_var;
+ struct clk_bulk_data *clks;
+ int num_clks;
+ struct device *dev;
+};
+
static int dwc_eth_dwmac_config_dt(struct platform_device *pdev,
struct plat_stmmacenet_data *plat_dat)
{
@@ -265,6 +273,82 @@ static int tegra_eqos_init(struct platform_device *pdev, void *priv)
return 0;
}
+static int dwc_eqos_rxmux_setup(void *priv, bool external)
+{
+ int i = 0;
+ struct fsd_eqos_plat_data *plat = priv;
+ struct clk *rx1 = NULL;
+ struct clk *rx2 = NULL;
+ struct clk *rx3 = NULL;
+
+ for (i = 0; i < plat->num_clks; i++) {
+ if (strcmp(plat->clks[i].id, "eqos_rxclk_mux") == 0)
+ rx1 = plat->clks[i].clk;
+ else if (strcmp(plat->clks[i].id, "eqos_phyrxclk") == 0)
+ rx2 = plat->clks[i].clk;
+ else if (strcmp(plat->clks[i].id, "dout_peric_rgmii_clk") == 0)
+ rx3 = plat->clks[i].clk;
+ }
+
+ /* doesn't support RX clock mux */
+ if (!rx1)
+ return 0;
+
+ if (external)
+ return clk_set_parent(rx1, rx2);
+ else
+ return clk_set_parent(rx1, rx3);
+}
+
+static int fsd_clks_endisable(void *priv, bool enabled)
+{
+ struct fsd_eqos_plat_data *plat = priv;
+
+ if (enabled) {
+ return clk_bulk_prepare_enable(plat->num_clks, plat->clks);
+ } else {
+ clk_bulk_disable_unprepare(plat->num_clks, plat->clks);
+ return 0;
+ }
+}
+
+static int fsd_eqos_probe(struct platform_device *pdev,
+ struct plat_stmmacenet_data *data,
+ struct stmmac_resources *res)
+{
+ struct fsd_eqos_plat_data *priv_plat;
+ int ret = 0;
+
+ priv_plat = devm_kzalloc(&pdev->dev, sizeof(*priv_plat), GFP_KERNEL);
+ if (!priv_plat)
+ return -ENOMEM;
+
+ priv_plat->dev = &pdev->dev;
+
+ ret = devm_clk_bulk_get_all(&pdev->dev, &priv_plat->clks);
+ if (ret < 0)
+ return dev_err_probe(&pdev->dev, ret, "No clocks available\n");
+
+ priv_plat->num_clks = ret;
+
+ data->bsp_priv = priv_plat;
+ data->clks_config = fsd_clks_endisable;
+ data->rxmux_setup = dwc_eqos_rxmux_setup;
+
+ ret = fsd_clks_endisable(priv_plat, true);
+ if (ret)
+ return dev_err_probe(&pdev->dev, ret, "Unable to enable fsd clock\n");
+
+ return 0;
+}
+
+static void fsd_eqos_remove(struct platform_device *pdev)
+{
+ struct fsd_eqos_plat_data *priv_plat = get_stmmac_bsp_priv(&pdev->dev);
+
+ fsd_clks_endisable(priv_plat, false);
+}
+
static int tegra_eqos_probe(struct platform_device *pdev,
struct plat_stmmacenet_data *data,
struct stmmac_resources *res)
@@ -411,6 +495,11 @@ static const struct dwc_eth_dwmac_data tegra_eqos_data = {
.remove = tegra_eqos_remove,
};
+static const struct dwc_eth_dwmac_data fsd_eqos_data = {
+ .probe = fsd_eqos_probe,
+ .remove = fsd_eqos_remove,
+};
+
static int dwc_eth_dwmac_probe(struct platform_device *pdev)
{
const struct dwc_eth_dwmac_data *data;
@@ -473,6 +562,7 @@ static void dwc_eth_dwmac_remove(struct platform_device *pdev)
static const struct of_device_id dwc_eth_dwmac_match[] = {
{ .compatible = "snps,dwc-qos-ethernet-4.10", .data = &dwc_qos_data },
{ .compatible = "nvidia,tegra186-eqos", .data = &tegra_eqos_data },
+ { .compatible = "tesla,fsd-ethqos", .data = &fsd_eqos_data },
{ }
};
MODULE_DEVICE_TABLE(of, dwc_eth_dwmac_match);
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 12689774d755..2ef82edec522 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -4001,6 +4001,12 @@ static int __stmmac_open(struct net_device *dev,
netif_tx_start_all_queues(priv->dev);
stmmac_enable_all_dma_irq(priv);
+ if (priv->plat->rxmux_setup) {
+ ret = priv->plat->rxmux_setup(priv->plat->bsp_priv, true);
+ if (ret)
+ netdev_err(priv->dev, "Rxmux setup failed\n");
+ }
+
return 0;
irq_error:
@@ -4056,7 +4062,13 @@ static void stmmac_fpe_stop_wq(struct stmmac_priv *priv)
static int stmmac_release(struct net_device *dev)
{
struct stmmac_priv *priv = netdev_priv(dev);
- u32 chan;
+ u32 chan, ret;
+
+ if (priv->plat->rxmux_setup) {
+ ret = priv->plat->rxmux_setup(priv->plat->bsp_priv, false);
+ if (ret)
+ netdev_err(priv->dev, "Rxmux setup failed\n");
+ }
if (device_may_wakeup(priv->device))
phylink_speed_down(priv->phylink, false);
@@ -7848,11 +7860,17 @@ int stmmac_suspend(struct device *dev)
{
struct net_device *ndev = dev_get_drvdata(dev);
struct stmmac_priv *priv = netdev_priv(ndev);
- u32 chan;
+ u32 chan, ret;
if (!ndev || !netif_running(ndev))
return 0;
+ if (priv->plat->rxmux_setup) {
+ ret = priv->plat->rxmux_setup(priv->plat->bsp_priv, false);
+ if (ret)
+ netdev_err(priv->dev, "Rxmux setup failed\n");
+ }
+
mutex_lock(&priv->lock);
netif_device_detach(ndev);
@@ -8018,6 +8036,12 @@ int stmmac_resume(struct device *dev)
mutex_unlock(&priv->lock);
rtnl_unlock();
+ if (priv->plat->rxmux_setup) {
+ ret = priv->plat->rxmux_setup(priv->plat->bsp_priv, true);
+ if (ret)
+ netdev_err(priv->dev, "Rxmux setup failed\n");
+ }
+
netif_device_attach(ndev);
return 0;
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index 84e13bd5df28..f017b818d421 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -264,6 +264,7 @@ struct plat_stmmacenet_data {
void (*ptp_clk_freq_config)(struct stmmac_priv *priv);
int (*init)(struct platform_device *pdev, void *priv);
void (*exit)(struct platform_device *pdev, void *priv);
+ int (*rxmux_setup)(void *priv, bool external);
struct mac_device_info *(*setup)(void *priv);
int (*clks_config)(void *priv, bool enabled);
int (*crosststamp)(ktime_t *device, struct system_counterval_t *system,
--
2.17.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v4 3/4] arm64: dts: fsd: Add Ethernet support for FSYS0 Block of FSD SoC
[not found] ` <CGME20240730092907epcas5p1b81eaf13a57535e32e11709602aeee06@epcas5p1.samsung.com>
@ 2024-07-30 9:16 ` Swathi K S
2024-07-30 20:16 ` Andrew Lunn
0 siblings, 1 reply; 15+ messages in thread
From: Swathi K S @ 2024-07-30 9:16 UTC (permalink / raw)
To: krzk, robh, davem, edumazet, kuba, pabeni, conor+dt,
richardcochran, mcoquelin.stm32, andrew, alim.akhtar, linux-fsd
Cc: netdev, devicetree, linux-kernel, linux-stm32, linux-arm-kernel,
linux-samsung-soc, alexandre.torgue, peppe.cavallaro, joabreu,
swathi.ks, rcsekar, ssiddha, jayati.sahu, pankaj.dubey,
ravi.patel, gost.dev
The FSD SoC contains two instances of Synopsys DWC QoS Ethernet IP, one
in FSYS0 block and other in PERIC block.
Adds device tree node for Ethernet in FSYS0 Block and enables the same for
FSD platform.
Signed-off-by: Pankaj Dubey <pankaj.dubey@samsung.com>
Signed-off-by: Jayati Sahu <jayati.sahu@samsung.com>
Signed-off-by: Swathi K S <swathi.ks@samsung.com>
---
arch/arm64/boot/dts/tesla/fsd-evb.dts | 9 ++++
arch/arm64/boot/dts/tesla/fsd-pinctrl.dtsi | 56 ++++++++++++++++++++++
arch/arm64/boot/dts/tesla/fsd.dtsi | 20 ++++++++
3 files changed, 85 insertions(+)
diff --git a/arch/arm64/boot/dts/tesla/fsd-evb.dts b/arch/arm64/boot/dts/tesla/fsd-evb.dts
index 8d7794642900..2c37097c709a 100644
--- a/arch/arm64/boot/dts/tesla/fsd-evb.dts
+++ b/arch/arm64/boot/dts/tesla/fsd-evb.dts
@@ -64,6 +64,15 @@
};
};
+ðernet_0 {
+ status = "okay";
+
+ fixed-link {
+ speed = <1000>;
+ full-duplex;
+ };
+};
+
&fin_pll {
clock-frequency = <24000000>;
};
diff --git a/arch/arm64/boot/dts/tesla/fsd-pinctrl.dtsi b/arch/arm64/boot/dts/tesla/fsd-pinctrl.dtsi
index 3f898cf4874c..cb437483ff6e 100644
--- a/arch/arm64/boot/dts/tesla/fsd-pinctrl.dtsi
+++ b/arch/arm64/boot/dts/tesla/fsd-pinctrl.dtsi
@@ -64,6 +64,62 @@
samsung,pin-pud = <FSD_PIN_PULL_UP>;
samsung,pin-drv = <FSD_PIN_DRV_LV4>;
};
+
+ eth0_tx_clk: eth0-tx-clk-pins {
+ samsung,pins = "gpf0-0";
+ samsung,pin-function = <FSD_PIN_FUNC_2>;
+ samsung,pin-pud = <FSD_PIN_PULL_DOWN>;
+ samsung,pin-drv = <FSD_PIN_DRV_LV6>;
+ };
+
+ eth0_tx_data: eth0-tx-data-pins {
+ samsung,pins = "gpf0-1", "gpf0-2", "gpf0-3", "gpf0-4";
+ samsung,pin-function = <FSD_PIN_FUNC_2>;
+ samsung,pin-pud = <FSD_PIN_PULL_UP>;
+ samsung,pin-drv = <FSD_PIN_DRV_LV6>;
+ };
+
+ eth0_tx_ctrl: eth0-tx-ctrl-pins {
+ samsung,pins = "gpf0-5";
+ samsung,pin-function = <FSD_PIN_FUNC_2>;
+ samsung,pin-pud = <FSD_PIN_PULL_UP>;
+ samsung,pin-drv = <FSD_PIN_DRV_LV6>;
+ };
+
+ eth0_phy_intr: eth0-phy-intr-pins {
+ samsung,pins = "gpf0-6";
+ samsung,pin-function = <FSD_PIN_FUNC_2>;
+ samsung,pin-pud = <FSD_PIN_PULL_NONE>;
+ samsung,pin-drv = <FSD_PIN_DRV_LV4>;
+ };
+
+ eth0_rx_clk: eth0-rx-clk-pins {
+ samsung,pins = "gpf1-0";
+ samsung,pin-function = <FSD_PIN_FUNC_2>;
+ samsung,pin-pud = <FSD_PIN_PULL_UP>;
+ samsung,pin-drv = <FSD_PIN_DRV_LV6>;
+ };
+
+ eth0_rx_data: eth0-rx-data-pins {
+ samsung,pins = "gpf1-1", "gpf1-2", "gpf1-3", "gpf1-4";
+ samsung,pin-function = <FSD_PIN_FUNC_2>;
+ samsung,pin-pud = <FSD_PIN_PULL_UP>;
+ samsung,pin-drv = <FSD_PIN_DRV_LV6>;
+ };
+
+ eth0_rx_ctrl: eth0-rx-ctrl-pins {
+ samsung,pins = "gpf1-5";
+ samsung,pin-function = <FSD_PIN_FUNC_2>;
+ samsung,pin-pud = <FSD_PIN_PULL_UP>;
+ samsung,pin-drv = <FSD_PIN_DRV_LV6>;
+ };
+
+ eth0_mdio: eth0-mdio-pins {
+ samsung,pins = "gpf1-6", "gpf1-7";
+ samsung,pin-function = <FSD_PIN_FUNC_2>;
+ samsung,pin-pud = <FSD_PIN_PULL_NONE>;
+ samsung,pin-drv = <FSD_PIN_DRV_LV4>;
+ };
};
&pinctrl_peric {
diff --git a/arch/arm64/boot/dts/tesla/fsd.dtsi b/arch/arm64/boot/dts/tesla/fsd.dtsi
index 690b4ed9c29b..cc67930ebf78 100644
--- a/arch/arm64/boot/dts/tesla/fsd.dtsi
+++ b/arch/arm64/boot/dts/tesla/fsd.dtsi
@@ -1007,6 +1007,26 @@
clocks = <&clock_fsys0 UFS0_MPHY_REFCLK_IXTAL26>;
clock-names = "ref_clk";
};
+
+ ethernet_0: ethernet@15300000 {
+ compatible = "tesla,fsd-ethqos";
+ reg = <0x0 0x15300000 0x0 0x10000>;
+ interrupts = <GIC_SPI 102 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&clock_fsys0 FSYS0_EQOS_TOP0_IPCLKPORT_CLK_PTP_REF_I>,
+ <&clock_fsys0 FSYS0_EQOS_TOP0_IPCLKPORT_ACLK_I>,
+ <&clock_fsys0 FSYS0_EQOS_TOP0_IPCLKPORT_HCLK_I>,
+ <&clock_fsys0 FSYS0_EQOS_TOP0_IPCLKPORT_RGMII_CLK_I>,
+ <&clock_fsys0 FSYS0_EQOS_TOP0_IPCLKPORT_CLK_RX_I>;
+ clock-names = "ptp_ref", "master_bus", "slave_bus", "tx", "rx";
+ pinctrl-names = "default";
+ pinctrl-0 = <ð0_tx_clk>, <ð0_tx_data>, <ð0_tx_ctrl>,
+ <ð0_phy_intr>, <ð0_rx_clk>, <ð0_rx_data>,
+ <ð0_rx_ctrl>, <ð0_mdio>;
+ local-mac-address = [00 00 00 00 00 00];
+ iommus = <&smmu_fsys0 0x0 0x1>;
+ phy-mode = "rgmii-id";
+ status = "disabled";
+ };
};
};
--
2.17.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v4 4/4] arm64: dts: fsd: Add Ethernet support for PERIC Block of FSD SoC
[not found] ` <CGME20240730092913epcas5p18c3be42421fffe1a229f83ceeca1ace0@epcas5p1.samsung.com>
@ 2024-07-30 9:16 ` Swathi K S
2024-07-30 20:17 ` Andrew Lunn
0 siblings, 1 reply; 15+ messages in thread
From: Swathi K S @ 2024-07-30 9:16 UTC (permalink / raw)
To: krzk, robh, davem, edumazet, kuba, pabeni, conor+dt,
richardcochran, mcoquelin.stm32, andrew, alim.akhtar, linux-fsd
Cc: netdev, devicetree, linux-kernel, linux-stm32, linux-arm-kernel,
linux-samsung-soc, alexandre.torgue, peppe.cavallaro, joabreu,
swathi.ks, rcsekar, ssiddha, jayati.sahu, pankaj.dubey,
ravi.patel, gost.dev
The FSD SoC contains two instances of Synopsys DWC QoS Ethernet IP, one in
FSYS0 block and other in PERIC block.
Adds device tree node for Ethernet in PERIC Block and enables the same for
FSD platform.
Signed-off-by: Pankaj Dubey <pankaj.dubey@samsung.com>
Signed-off-by: Jayati Sahu <jayati.sahu@samsung.com>
Signed-off-by: Swathi K S <swathi.ks@samsung.com>
---
arch/arm64/boot/dts/tesla/fsd-evb.dts | 9 ++++
arch/arm64/boot/dts/tesla/fsd-pinctrl.dtsi | 56 ++++++++++++++++++++++
arch/arm64/boot/dts/tesla/fsd.dtsi | 27 +++++++++++
3 files changed, 92 insertions(+)
diff --git a/arch/arm64/boot/dts/tesla/fsd-evb.dts b/arch/arm64/boot/dts/tesla/fsd-evb.dts
index 2c37097c709a..80ca120b3d7f 100644
--- a/arch/arm64/boot/dts/tesla/fsd-evb.dts
+++ b/arch/arm64/boot/dts/tesla/fsd-evb.dts
@@ -73,6 +73,15 @@
};
};
+ðernet_1 {
+ status = "okay";
+
+ fixed-link {
+ speed = <1000>;
+ full-duplex;
+ };
+};
+
&fin_pll {
clock-frequency = <24000000>;
};
diff --git a/arch/arm64/boot/dts/tesla/fsd-pinctrl.dtsi b/arch/arm64/boot/dts/tesla/fsd-pinctrl.dtsi
index cb437483ff6e..6f4658f57453 100644
--- a/arch/arm64/boot/dts/tesla/fsd-pinctrl.dtsi
+++ b/arch/arm64/boot/dts/tesla/fsd-pinctrl.dtsi
@@ -437,6 +437,62 @@
samsung,pin-pud = <FSD_PIN_PULL_DOWN>;
samsung,pin-drv = <FSD_PIN_DRV_LV4>;
};
+
+ eth1_tx_clk: eth1-tx-clk-pins {
+ samsung,pins = "gpf2-0";
+ samsung,pin-function = <FSD_PIN_FUNC_2>;
+ samsung,pin-pud = <FSD_PIN_PULL_DOWN>;
+ samsung,pin-drv = <FSD_PIN_DRV_LV6>;
+ };
+
+ eth1_tx_data: eth1-tx-data-pins {
+ samsung,pins = "gpf2-1", "gpf2-2", "gpf2-3", "gpf2-4";
+ samsung,pin-function = <FSD_PIN_FUNC_2>;
+ samsung,pin-pud = <FSD_PIN_PULL_UP>;
+ samsung,pin-drv = <FSD_PIN_DRV_LV6>;
+ };
+
+ eth1_tx_ctrl: eth1-tx-ctrl-pins {
+ samsung,pins = "gpf2-5";
+ samsung,pin-function = <FSD_PIN_FUNC_2>;
+ samsung,pin-pud = <FSD_PIN_PULL_UP>;
+ samsung,pin-drv = <FSD_PIN_DRV_LV6>;
+ };
+
+ eth1_phy_intr: eth1-phy-intr-pins {
+ samsung,pins = "gpf2-6";
+ samsung,pin-function = <FSD_PIN_FUNC_2>;
+ samsung,pin-pud = <FSD_PIN_PULL_UP>;
+ samsung,pin-drv = <FSD_PIN_DRV_LV4>;
+ };
+
+ eth1_rx_clk: eth1-rx-clk-pins {
+ samsung,pins = "gpf3-0";
+ samsung,pin-function = <FSD_PIN_FUNC_2>;
+ samsung,pin-pud = <FSD_PIN_PULL_UP>;
+ samsung,pin-drv = <FSD_PIN_DRV_LV6>;
+ };
+
+ eth1_rx_data: eth1-rx-data-pins {
+ samsung,pins = "gpf3-1", "gpf3-2", "gpf3-3", "gpf3-4";
+ samsung,pin-function = <FSD_PIN_FUNC_2>;
+ samsung,pin-pud = <FSD_PIN_PULL_UP>;
+ samsung,pin-drv = <FSD_PIN_DRV_LV6>;
+ };
+
+ eth1_rx_ctrl: eth1-rx-ctrl-pins {
+ samsung,pins = "gpf3-5";
+ samsung,pin-function = <FSD_PIN_FUNC_2>;
+ samsung,pin-pud = <FSD_PIN_PULL_UP>;
+ samsung,pin-drv = <FSD_PIN_DRV_LV6>;
+ };
+
+ eth1_mdio: eth1-mdio-pins {
+ samsung,pins = "gpf3-6", "gpf3-7";
+ samsung,pin-function = <FSD_PIN_FUNC_2>;
+ samsung,pin-pud = <FSD_PIN_PULL_UP>;
+ samsung,pin-drv = <FSD_PIN_DRV_LV4>;
+ };
};
&pinctrl_pmu {
diff --git a/arch/arm64/boot/dts/tesla/fsd.dtsi b/arch/arm64/boot/dts/tesla/fsd.dtsi
index cc67930ebf78..670f6a852542 100644
--- a/arch/arm64/boot/dts/tesla/fsd.dtsi
+++ b/arch/arm64/boot/dts/tesla/fsd.dtsi
@@ -1027,6 +1027,33 @@
phy-mode = "rgmii-id";
status = "disabled";
};
+
+ ethernet_1: ethernet@14300000 {
+ compatible = "tesla,fsd-ethqos";
+ reg = <0x0 0x14300000 0x0 0x10000>;
+ interrupts = <GIC_SPI 176 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&clock_peric PERIC_EQOS_TOP_IPCLKPORT_CLK_PTP_REF_I>,
+ <&clock_peric PERIC_EQOS_TOP_IPCLKPORT_ACLK_I>,
+ <&clock_peric PERIC_EQOS_TOP_IPCLKPORT_HCLK_I>,
+ <&clock_peric PERIC_EQOS_TOP_IPCLKPORT_RGMII_CLK_I>,
+ <&clock_peric PERIC_EQOS_TOP_IPCLKPORT_CLK_RX_I>,
+ <&clock_peric PERIC_BUS_D_PERIC_IPCLKPORT_EQOSCLK>,
+ <&clock_peric PERIC_BUS_P_PERIC_IPCLKPORT_EQOSCLK>,
+ <&clock_peric PERIC_EQOS_PHYRXCLK_MUX>,
+ <&clock_peric PERIC_EQOS_PHYRXCLK>,
+ <&clock_peric PERIC_DOUT_RGMII_CLK>;
+ clock-names = "ptp_ref", "master_bus", "slave_bus", "tx", "rx",
+ "master2_bus", "slave2_bus", "eqos_rxclk_mux",
+ "eqos_phyrxclk", "dout_peric_rgmii_clk";
+ pinctrl-names = "default";
+ pinctrl-0 = <ð1_tx_clk>, <ð1_tx_data>, <ð1_tx_ctrl>,
+ <ð1_phy_intr>, <ð1_rx_clk>, <ð1_rx_data>,
+ <ð1_rx_ctrl>, <ð1_mdio>;
+ local-mac-address = [00 00 00 00 00 00];
+ iommus = <&smmu_peric 0x0 0x1>;
+ phy-mode = "rgmii-id";
+ status = "disabled";
+ };
};
};
--
2.17.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH v4 2/4] net: stmmac: dwc-qos: Add FSD EQoS support
2024-07-30 9:16 ` [PATCH v4 2/4] net: stmmac: dwc-qos: Add FSD EQoS support Swathi K S
@ 2024-07-30 20:14 ` Andrew Lunn
2024-07-31 4:38 ` Swathi K S
2024-08-01 19:09 ` Serge Semin
1 sibling, 1 reply; 15+ messages in thread
From: Andrew Lunn @ 2024-07-30 20:14 UTC (permalink / raw)
To: Swathi K S
Cc: krzk, robh, davem, edumazet, kuba, pabeni, conor+dt,
richardcochran, mcoquelin.stm32, alim.akhtar, linux-fsd, netdev,
devicetree, linux-kernel, linux-stm32, linux-arm-kernel,
linux-samsung-soc, alexandre.torgue, peppe.cavallaro, joabreu,
rcsekar, ssiddha, jayati.sahu, pankaj.dubey, ravi.patel, gost.dev
> +static int dwc_eqos_rxmux_setup(void *priv, bool external)
> +{
> + int i = 0;
> + struct fsd_eqos_plat_data *plat = priv;
> + struct clk *rx1 = NULL;
> + struct clk *rx2 = NULL;
> + struct clk *rx3 = NULL;
Reverse Christmas tree please.
> @@ -264,6 +264,7 @@ struct plat_stmmacenet_data {
> void (*ptp_clk_freq_config)(struct stmmac_priv *priv);
> int (*init)(struct platform_device *pdev, void *priv);
> void (*exit)(struct platform_device *pdev, void *priv);
> + int (*rxmux_setup)(void *priv, bool external);
> struct mac_device_info *(*setup)(void *priv);
> int (*clks_config)(void *priv, bool enabled);
> int (*crosststamp)(ktime_t *device, struct system_counterval_t *system,
It would be good if one of the stmmas Maintainers looked at
this. There are already a lot of function pointers here, we should not
be added another one if one of the exiting ones could be used.
Andrew
---
pw-bot: cr
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v4 3/4] arm64: dts: fsd: Add Ethernet support for FSYS0 Block of FSD SoC
2024-07-30 9:16 ` [PATCH v4 3/4] arm64: dts: fsd: Add Ethernet support for FSYS0 Block of FSD SoC Swathi K S
@ 2024-07-30 20:16 ` Andrew Lunn
2024-07-31 4:40 ` Swathi K S
0 siblings, 1 reply; 15+ messages in thread
From: Andrew Lunn @ 2024-07-30 20:16 UTC (permalink / raw)
To: Swathi K S
Cc: krzk, robh, davem, edumazet, kuba, pabeni, conor+dt,
richardcochran, mcoquelin.stm32, alim.akhtar, linux-fsd, netdev,
devicetree, linux-kernel, linux-stm32, linux-arm-kernel,
linux-samsung-soc, alexandre.torgue, peppe.cavallaro, joabreu,
rcsekar, ssiddha, jayati.sahu, pankaj.dubey, ravi.patel, gost.dev
> +ðernet_0 {
> + status = "okay";
> +
> + fixed-link {
> + speed = <1000>;
> + full-duplex;
> + };
> +};
> +
What is the interface connected to? A switch?
Andrew
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v4 4/4] arm64: dts: fsd: Add Ethernet support for PERIC Block of FSD SoC
2024-07-30 9:16 ` [PATCH v4 4/4] arm64: dts: fsd: Add Ethernet support for PERIC " Swathi K S
@ 2024-07-30 20:17 ` Andrew Lunn
0 siblings, 0 replies; 15+ messages in thread
From: Andrew Lunn @ 2024-07-30 20:17 UTC (permalink / raw)
To: Swathi K S
Cc: krzk, robh, davem, edumazet, kuba, pabeni, conor+dt,
richardcochran, mcoquelin.stm32, alim.akhtar, linux-fsd, netdev,
devicetree, linux-kernel, linux-stm32, linux-arm-kernel,
linux-samsung-soc, alexandre.torgue, peppe.cavallaro, joabreu,
rcsekar, ssiddha, jayati.sahu, pankaj.dubey, ravi.patel, gost.dev
> +ðernet_1 {
> + status = "okay";
> +
> + fixed-link {
> + speed = <1000>;
> + full-duplex;
> + };
Another fixed link? That is a bit unusual.
\x11 Andrew
^ permalink raw reply [flat|nested] 15+ messages in thread
* RE: [PATCH v4 2/4] net: stmmac: dwc-qos: Add FSD EQoS support
2024-07-30 20:14 ` Andrew Lunn
@ 2024-07-31 4:38 ` Swathi K S
0 siblings, 0 replies; 15+ messages in thread
From: Swathi K S @ 2024-07-31 4:38 UTC (permalink / raw)
To: 'Andrew Lunn'
Cc: krzk, robh, davem, edumazet, kuba, pabeni, conor+dt,
richardcochran, mcoquelin.stm32, alim.akhtar, linux-fsd, netdev,
devicetree, linux-kernel, linux-stm32, linux-arm-kernel,
linux-samsung-soc, alexandre.torgue, peppe.cavallaro, joabreu,
rcsekar, ssiddha, jayati.sahu, pankaj.dubey, ravi.patel, gost.dev
> -----Original Message-----
> From: Andrew Lunn <andrew@lunn.ch>
> Sent: 31 July 2024 01:44
> To: Swathi K S <swathi.ks@samsung.com>
> Cc: krzk@kernel.org; robh@kernel.org; davem@davemloft.net;
> edumazet@google.com; kuba@kernel.org; pabeni@redhat.com;
> conor+dt@kernel.org; richardcochran@gmail.com;
> mcoquelin.stm32@gmail.com; alim.akhtar@samsung.com; linux-
> fsd@tesla.com; netdev@vger.kernel.org; devicetree@vger.kernel.org; linux-
> kernel@vger.kernel.org; linux-stm32@st-md-mailman.stormreply.com; linux-
> arm-kernel@lists.infradead.org; linux-samsung-soc@vger.kernel.org;
> alexandre.torgue@foss.st.com; peppe.cavallaro@st.com;
> joabreu@synopsys.com; rcsekar@samsung.com; ssiddha@tesla.com;
> jayati.sahu@samsung.com; pankaj.dubey@samsung.com;
> ravi.patel@samsung.com; gost.dev@samsung.com
> Subject: Re: [PATCH v4 2/4] net: stmmac: dwc-qos: Add FSD EQoS support
>
> > +static int dwc_eqos_rxmux_setup(void *priv, bool external) {
> > + int i = 0;
> > + struct fsd_eqos_plat_data *plat = priv;
> > + struct clk *rx1 = NULL;
> > + struct clk *rx2 = NULL;
> > + struct clk *rx3 = NULL;
>
> Reverse Christmas tree please.
Thanks for review.
We will take care in next patch version after waiting for other review
comments.
>
> > @@ -264,6 +264,7 @@ struct plat_stmmacenet_data {
> > void (*ptp_clk_freq_config)(struct stmmac_priv *priv);
> > int (*init)(struct platform_device *pdev, void *priv);
> > void (*exit)(struct platform_device *pdev, void *priv);
> > + int (*rxmux_setup)(void *priv, bool external);
> > struct mac_device_info *(*setup)(void *priv);
> > int (*clks_config)(void *priv, bool enabled);
> > int (*crosststamp)(ktime_t *device, struct system_counterval_t
> > *system,
>
> It would be good if one of the stmmas Maintainers looked at this. There
are
> already a lot of function pointers here, we should not be added another
one if
> one of the exiting ones could be used.
>
> Andrew
>
> ---
> pw-bot: cr
^ permalink raw reply [flat|nested] 15+ messages in thread
* RE: [PATCH v4 3/4] arm64: dts: fsd: Add Ethernet support for FSYS0 Block of FSD SoC
2024-07-30 20:16 ` Andrew Lunn
@ 2024-07-31 4:40 ` Swathi K S
2024-08-01 0:17 ` Andrew Lunn
0 siblings, 1 reply; 15+ messages in thread
From: Swathi K S @ 2024-07-31 4:40 UTC (permalink / raw)
To: 'Andrew Lunn'
Cc: krzk, robh, davem, edumazet, kuba, pabeni, conor+dt,
richardcochran, mcoquelin.stm32, alim.akhtar, linux-fsd, netdev,
devicetree, linux-kernel, linux-stm32, linux-arm-kernel,
linux-samsung-soc, alexandre.torgue, peppe.cavallaro, joabreu,
rcsekar, ssiddha, jayati.sahu, pankaj.dubey, ravi.patel, gost.dev
> -----Original Message-----
> From: Andrew Lunn <andrew@lunn.ch>
> Sent: 31 July 2024 01:46
> To: Swathi K S <swathi.ks@samsung.com>
> Cc: krzk@kernel.org; robh@kernel.org; davem@davemloft.net;
> edumazet@google.com; kuba@kernel.org; pabeni@redhat.com;
> conor+dt@kernel.org; richardcochran@gmail.com;
> mcoquelin.stm32@gmail.com; alim.akhtar@samsung.com; linux-
> fsd@tesla.com; netdev@vger.kernel.org; devicetree@vger.kernel.org; linux-
> kernel@vger.kernel.org; linux-stm32@st-md-mailman.stormreply.com; linux-
> arm-kernel@lists.infradead.org; linux-samsung-soc@vger.kernel.org;
> alexandre.torgue@foss.st.com; peppe.cavallaro@st.com;
> joabreu@synopsys.com; rcsekar@samsung.com; ssiddha@tesla.com;
> jayati.sahu@samsung.com; pankaj.dubey@samsung.com;
> ravi.patel@samsung.com; gost.dev@samsung.com
> Subject: Re: [PATCH v4 3/4] arm64: dts: fsd: Add Ethernet support for
FSYS0
> Block of FSD SoC
>
> > +ðernet_0 {
> > + status = "okay";
> > +
> > + fixed-link {
> > + speed = <1000>;
> > + full-duplex;
> > + };
> > +};
> > +
>
> What is the interface connected to? A switch?
Hi Andrew,
Thanks for the quick review. AFAIK, this has been discussed earlier. I am
providing the links to the same here for quick reference.
[1] https://lkml.org/lkml/2024/7/29/419
[2] https://lkml.org/lkml/2024/6/6/817
[3] https://lkml.org/lkml/2024/6/6/507
[4] https://lkml.org/lkml/2023/8/14/1341
Please let us know if you have any further queries on this.
>
> Andrew
Regards,
Swathi
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v4 3/4] arm64: dts: fsd: Add Ethernet support for FSYS0 Block of FSD SoC
2024-07-31 4:40 ` Swathi K S
@ 2024-08-01 0:17 ` Andrew Lunn
2024-08-01 3:22 ` Swathi K S
0 siblings, 1 reply; 15+ messages in thread
From: Andrew Lunn @ 2024-08-01 0:17 UTC (permalink / raw)
To: Swathi K S
Cc: krzk, robh, davem, edumazet, kuba, pabeni, conor+dt,
richardcochran, mcoquelin.stm32, alim.akhtar, linux-fsd, netdev,
devicetree, linux-kernel, linux-stm32, linux-arm-kernel,
linux-samsung-soc, alexandre.torgue, peppe.cavallaro, joabreu,
rcsekar, ssiddha, jayati.sahu, pankaj.dubey, ravi.patel, gost.dev
> > What is the interface connected to? A switch?
>
> Hi Andrew,
> Thanks for the quick review. AFAIK, this has been discussed earlier. I am
> providing the links to the same here for quick reference.
>
> [1] https://lkml.org/lkml/2024/7/29/419
> [2] https://lkml.org/lkml/2024/6/6/817
> [3] https://lkml.org/lkml/2024/6/6/507
> [4] https://lkml.org/lkml/2023/8/14/1341
>
> Please let us know if you have any further queries on this.
Ah, O.K.
It would make sense to add to the commit message something like:
The Ethernet interface is connected to a switch, which Linux is not
managing.
Part of the purpose of the commit message is to answer questions
reviewers might have. This is one such question.
Andrew
^ permalink raw reply [flat|nested] 15+ messages in thread
* RE: [PATCH v4 3/4] arm64: dts: fsd: Add Ethernet support for FSYS0 Block of FSD SoC
2024-08-01 0:17 ` Andrew Lunn
@ 2024-08-01 3:22 ` Swathi K S
0 siblings, 0 replies; 15+ messages in thread
From: Swathi K S @ 2024-08-01 3:22 UTC (permalink / raw)
To: 'Andrew Lunn'
Cc: krzk, robh, davem, edumazet, kuba, pabeni, conor+dt,
richardcochran, mcoquelin.stm32, alim.akhtar, linux-fsd, netdev,
devicetree, linux-kernel, linux-stm32, linux-arm-kernel,
linux-samsung-soc, alexandre.torgue, peppe.cavallaro, joabreu,
rcsekar, ssiddha, jayati.sahu, pankaj.dubey, ravi.patel, gost.dev
> -----Original Message-----
> From: Andrew Lunn <andrew@lunn.ch>
> Sent: 01 August 2024 05:48
> To: Swathi K S <swathi.ks@samsung.com>
> Cc: krzk@kernel.org; robh@kernel.org; davem@davemloft.net;
> edumazet@google.com; kuba@kernel.org; pabeni@redhat.com;
> conor+dt@kernel.org; richardcochran@gmail.com;
> mcoquelin.stm32@gmail.com; alim.akhtar@samsung.com; linux-
> fsd@tesla.com; netdev@vger.kernel.org; devicetree@vger.kernel.org; linux-
> kernel@vger.kernel.org; linux-stm32@st-md-mailman.stormreply.com; linux-
> arm-kernel@lists.infradead.org; linux-samsung-soc@vger.kernel.org;
> alexandre.torgue@foss.st.com; peppe.cavallaro@st.com;
> joabreu@synopsys.com; rcsekar@samsung.com; ssiddha@tesla.com;
> jayati.sahu@samsung.com; pankaj.dubey@samsung.com;
> ravi.patel@samsung.com; gost.dev@samsung.com
> Subject: Re: [PATCH v4 3/4] arm64: dts: fsd: Add Ethernet support for
FSYS0
> Block of FSD SoC
>
> > > What is the interface connected to? A switch?
> >
> > Hi Andrew,
> > Thanks for the quick review. AFAIK, this has been discussed earlier. I
> > am providing the links to the same here for quick reference.
> >
> > [1]
> > https://protect2.fireeye.com/v1/url?k=137f9a1c-72027264-137e1153-74fe4
> > 85fffb1-6e7bf5aa53b8cc75&q=1&e=46ff39bb-87c6-4b24-9cee-
> a6ed900a5b7f&u=
> > https%3A%2F%2Flkml.org%2Flkml%2F2024%2F7%2F29%2F419
> > [2]
> > https://protect2.fireeye.com/v1/url?k=dca2820d-bddf6a75-dca30942-74fe4
> > 85fffb1-9b7f4695da0bf0b8&q=1&e=46ff39bb-87c6-4b24-9cee-
> a6ed900a5b7f&u=
> > https%3A%2F%2Flkml.org%2Flkml%2F2024%2F6%2F6%2F817
> > [3]
> > https://protect2.fireeye.com/v1/url?k=552d5dcd-3450b5b5-552cd682-74fe4
> > 85fffb1-3bb7c6c469af30f5&q=1&e=46ff39bb-87c6-4b24-9cee-
> a6ed900a5b7f&u=
> > https%3A%2F%2Flkml.org%2Flkml%2F2024%2F6%2F6%2F507
> > [4]
> > https://protect2.fireeye.com/v1/url?k=c613c4f6-a76e2c8e-c6124fb9-74fe4
> > 85fffb1-469219b2dcdd3e0e&q=1&e=46ff39bb-87c6-4b24-9cee-
> a6ed900a5b7f&u=
> > https%3A%2F%2Flkml.org%2Flkml%2F2023%2F8%2F14%2F1341
> >
> > Please let us know if you have any further queries on this.
>
> Ah, O.K.
>
> It would make sense to add to the commit message something like:
>
> The Ethernet interface is connected to a switch, which Linux is not
managing.
Thanks for the suggestion and it makes sense. Will update the commit
message this way in the next version.
>
> Part of the purpose of the commit message is to answer questions reviewers
> might have. This is one such question.
>
> Andrew
Regards,
Swathi
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v4 2/4] net: stmmac: dwc-qos: Add FSD EQoS support
2024-07-30 9:16 ` [PATCH v4 2/4] net: stmmac: dwc-qos: Add FSD EQoS support Swathi K S
2024-07-30 20:14 ` Andrew Lunn
@ 2024-08-01 19:09 ` Serge Semin
2025-01-27 9:45 ` Swathi K S
1 sibling, 1 reply; 15+ messages in thread
From: Serge Semin @ 2024-08-01 19:09 UTC (permalink / raw)
To: Swathi K S, Andrew Lunn
Cc: krzk, robh, davem, edumazet, kuba, pabeni, conor+dt,
richardcochran, mcoquelin.stm32, alim.akhtar, linux-fsd, netdev,
devicetree, linux-kernel, linux-stm32, linux-arm-kernel,
linux-samsung-soc, alexandre.torgue, peppe.cavallaro, joabreu,
rcsekar, ssiddha, jayati.sahu, pankaj.dubey, ravi.patel, gost.dev
Hi Swathi, Andrew
On Tue, Jul 30, 2024 at 02:46:46PM +0530, Swathi K S wrote:
> The FSD SoC contains two instance of the Synopsys DWC ethernet QOS IP core.
> The binding that it uses is slightly different from existing ones because
> of the integration (clocks, resets).
>
> For FSD SoC, a mux switch is needed between internal and external clocks.
> By default after reset internal clock is used but for receiving packets
> properly, external clock is needed. Mux switch to external clock happens
> only when the external clock is present.
>
> Signed-off-by: Chandrasekar R <rcsekar@samsung.com>
> Signed-off-by: Suresh Siddha <ssiddha@tesla.com>
> Signed-off-by: Swathi K S <swathi.ks@samsung.com>
> ---
> .../stmicro/stmmac/dwmac-dwc-qos-eth.c | 90 +++++++++++++++++++
> .../net/ethernet/stmicro/stmmac/stmmac_main.c | 28 +++++-
> include/linux/stmmac.h | 1 +
> 3 files changed, 117 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
> index ec924c6c76c6..bc97b3b573b7 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
> @@ -20,6 +20,7 @@
> #include <linux/platform_device.h>
> #include <linux/reset.h>
> #include <linux/stmmac.h>
> +#include <linux/regmap.h>
>
> #include "stmmac_platform.h"
> #include "dwmac4.h"
> @@ -37,6 +38,13 @@ struct tegra_eqos {
> struct gpio_desc *reset;
> };
>
> +struct fsd_eqos_plat_data {
> + const struct fsd_eqos_variant *fsd_eqos_inst_var;
> + struct clk_bulk_data *clks;
> + int num_clks;
> + struct device *dev;
> +};
> +
> static int dwc_eth_dwmac_config_dt(struct platform_device *pdev,
> struct plat_stmmacenet_data *plat_dat)
> {
> @@ -265,6 +273,82 @@ static int tegra_eqos_init(struct platform_device *pdev, void *priv)
> return 0;
> }
>
> +static int dwc_eqos_rxmux_setup(void *priv, bool external)
> +{
> + int i = 0;
> + struct fsd_eqos_plat_data *plat = priv;
> + struct clk *rx1 = NULL;
> + struct clk *rx2 = NULL;
> + struct clk *rx3 = NULL;
> +
> + for (i = 0; i < plat->num_clks; i++) {
> + if (strcmp(plat->clks[i].id, "eqos_rxclk_mux") == 0)
> + rx1 = plat->clks[i].clk;
> + else if (strcmp(plat->clks[i].id, "eqos_phyrxclk") == 0)
> + rx2 = plat->clks[i].clk;
> + else if (strcmp(plat->clks[i].id, "dout_peric_rgmii_clk") == 0)
> + rx3 = plat->clks[i].clk;
> + }
> +
> + /* doesn't support RX clock mux */
> + if (!rx1)
> + return 0;
> +
> + if (external)
> + return clk_set_parent(rx1, rx2);
> + else
> + return clk_set_parent(rx1, rx3);
> +}
Andrew is right asking about this implementation. It does seem
questionable:
1. AFAIR RGMII Rx clock is supposed to be retrieved the PHY. So the
eqos_phyrxclk and dout_peric_rgmii_clk are the PHY clocks. Do you have
a PHY integrated in the SoC? If so you should have defined it as a
separate DT-node and moved the clocks definition in there.
2. Do you really need to perform the "eqos_rxclk_mux" clock
re-parenting on each interface open/close? Based on the commit log you
don't. So the re-parenting can be done in the glue driver or even in
the device tree by means of the "assigned-clock-parents" property.
-Serge(y)
> +
> +static int fsd_clks_endisable(void *priv, bool enabled)
> +{
> + struct fsd_eqos_plat_data *plat = priv;
> +
> + if (enabled) {
> + return clk_bulk_prepare_enable(plat->num_clks, plat->clks);
> + } else {
> + clk_bulk_disable_unprepare(plat->num_clks, plat->clks);
> + return 0;
> + }
> +}
> +
> +static int fsd_eqos_probe(struct platform_device *pdev,
> + struct plat_stmmacenet_data *data,
> + struct stmmac_resources *res)
> +{
> + struct fsd_eqos_plat_data *priv_plat;
> + int ret = 0;
> +
> + priv_plat = devm_kzalloc(&pdev->dev, sizeof(*priv_plat), GFP_KERNEL);
> + if (!priv_plat)
> + return -ENOMEM;
> +
> + priv_plat->dev = &pdev->dev;
> +
> + ret = devm_clk_bulk_get_all(&pdev->dev, &priv_plat->clks);
> + if (ret < 0)
> + return dev_err_probe(&pdev->dev, ret, "No clocks available\n");
> +
> + priv_plat->num_clks = ret;
> +
> + data->bsp_priv = priv_plat;
> + data->clks_config = fsd_clks_endisable;
> + data->rxmux_setup = dwc_eqos_rxmux_setup;
> +
> + ret = fsd_clks_endisable(priv_plat, true);
> + if (ret)
> + return dev_err_probe(&pdev->dev, ret, "Unable to enable fsd clock\n");
> +
> + return 0;
> +}
> +
> +static void fsd_eqos_remove(struct platform_device *pdev)
> +{
> + struct fsd_eqos_plat_data *priv_plat = get_stmmac_bsp_priv(&pdev->dev);
> +
> + fsd_clks_endisable(priv_plat, false);
> +}
> +
> static int tegra_eqos_probe(struct platform_device *pdev,
> struct plat_stmmacenet_data *data,
> struct stmmac_resources *res)
> @@ -411,6 +495,11 @@ static const struct dwc_eth_dwmac_data tegra_eqos_data = {
> .remove = tegra_eqos_remove,
> };
>
> +static const struct dwc_eth_dwmac_data fsd_eqos_data = {
> + .probe = fsd_eqos_probe,
> + .remove = fsd_eqos_remove,
> +};
> +
> static int dwc_eth_dwmac_probe(struct platform_device *pdev)
> {
> const struct dwc_eth_dwmac_data *data;
> @@ -473,6 +562,7 @@ static void dwc_eth_dwmac_remove(struct platform_device *pdev)
> static const struct of_device_id dwc_eth_dwmac_match[] = {
> { .compatible = "snps,dwc-qos-ethernet-4.10", .data = &dwc_qos_data },
> { .compatible = "nvidia,tegra186-eqos", .data = &tegra_eqos_data },
> + { .compatible = "tesla,fsd-ethqos", .data = &fsd_eqos_data },
> { }
> };
> MODULE_DEVICE_TABLE(of, dwc_eth_dwmac_match);
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index 12689774d755..2ef82edec522 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -4001,6 +4001,12 @@ static int __stmmac_open(struct net_device *dev,
> netif_tx_start_all_queues(priv->dev);
> stmmac_enable_all_dma_irq(priv);
>
> + if (priv->plat->rxmux_setup) {
> + ret = priv->plat->rxmux_setup(priv->plat->bsp_priv, true);
> + if (ret)
> + netdev_err(priv->dev, "Rxmux setup failed\n");
> + }
> +
> return 0;
>
> irq_error:
> @@ -4056,7 +4062,13 @@ static void stmmac_fpe_stop_wq(struct stmmac_priv *priv)
> static int stmmac_release(struct net_device *dev)
> {
> struct stmmac_priv *priv = netdev_priv(dev);
> - u32 chan;
> + u32 chan, ret;
> +
> + if (priv->plat->rxmux_setup) {
> + ret = priv->plat->rxmux_setup(priv->plat->bsp_priv, false);
> + if (ret)
> + netdev_err(priv->dev, "Rxmux setup failed\n");
> + }
>
> if (device_may_wakeup(priv->device))
> phylink_speed_down(priv->phylink, false);
> @@ -7848,11 +7860,17 @@ int stmmac_suspend(struct device *dev)
> {
> struct net_device *ndev = dev_get_drvdata(dev);
> struct stmmac_priv *priv = netdev_priv(ndev);
> - u32 chan;
> + u32 chan, ret;
>
> if (!ndev || !netif_running(ndev))
> return 0;
>
> + if (priv->plat->rxmux_setup) {
> + ret = priv->plat->rxmux_setup(priv->plat->bsp_priv, false);
> + if (ret)
> + netdev_err(priv->dev, "Rxmux setup failed\n");
> + }
> +
> mutex_lock(&priv->lock);
>
> netif_device_detach(ndev);
> @@ -8018,6 +8036,12 @@ int stmmac_resume(struct device *dev)
> mutex_unlock(&priv->lock);
> rtnl_unlock();
>
> + if (priv->plat->rxmux_setup) {
> + ret = priv->plat->rxmux_setup(priv->plat->bsp_priv, true);
> + if (ret)
> + netdev_err(priv->dev, "Rxmux setup failed\n");
> + }
> +
> netif_device_attach(ndev);
>
> return 0;
> diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
> index 84e13bd5df28..f017b818d421 100644
> --- a/include/linux/stmmac.h
> +++ b/include/linux/stmmac.h
> @@ -264,6 +264,7 @@ struct plat_stmmacenet_data {
> void (*ptp_clk_freq_config)(struct stmmac_priv *priv);
> int (*init)(struct platform_device *pdev, void *priv);
> void (*exit)(struct platform_device *pdev, void *priv);
> + int (*rxmux_setup)(void *priv, bool external);
> struct mac_device_info *(*setup)(void *priv);
> int (*clks_config)(void *priv, bool enabled);
> int (*crosststamp)(ktime_t *device, struct system_counterval_t *system,
> --
> 2.17.1
>
>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v4 1/4] dt-bindings: net: Add FSD EQoS device tree bindings
2024-07-30 9:16 ` [PATCH v4 1/4] dt-bindings: net: Add FSD EQoS device tree bindings Swathi K S
@ 2024-08-06 14:57 ` Rob Herring
0 siblings, 0 replies; 15+ messages in thread
From: Rob Herring @ 2024-08-06 14:57 UTC (permalink / raw)
To: Swathi K S
Cc: krzk, davem, edumazet, kuba, pabeni, conor+dt, richardcochran,
mcoquelin.stm32, andrew, alim.akhtar, linux-fsd, netdev,
devicetree, linux-kernel, linux-stm32, linux-arm-kernel,
linux-samsung-soc, alexandre.torgue, peppe.cavallaro, joabreu,
rcsekar, ssiddha, jayati.sahu, pankaj.dubey, ravi.patel, gost.dev
On Tue, Jul 30, 2024 at 02:46:45PM +0530, Swathi K S wrote:
> Add FSD Ethernet compatible in Synopsys dt-bindings document. Add FSD
> Ethernet YAML schema to enable the DT validation.
>
> Signed-off-by: Pankaj Dubey <pankaj.dubey@samsung.com>
> Signed-off-by: Ravi Patel <ravi.patel@samsung.com>
> Signed-off-by: Swathi K S <swathi.ks@samsung.com>
> ---
> .../devicetree/bindings/net/snps,dwmac.yaml | 5 +-
> .../devicetree/bindings/net/tesla,ethqos.yaml | 91 +++++++++++++++++++
> 2 files changed, 94 insertions(+), 2 deletions(-)
> create mode 100644 Documentation/devicetree/bindings/net/tesla,ethqos.yaml
>
> diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
> index 3eb65e63fdae..0da11fe98cec 100644
> --- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml
> +++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
> @@ -98,6 +98,7 @@ properties:
> - snps,dwxgmac-2.10
> - starfive,jh7100-dwmac
> - starfive,jh7110-dwmac
> + - tesla,fsd-ethqos
>
> reg:
> minItems: 1
> @@ -121,7 +122,7 @@ properties:
>
> clocks:
> minItems: 1
> - maxItems: 8
> + maxItems: 10
> additionalItems: true
> items:
> - description: GMAC main clock
> @@ -133,7 +134,7 @@ properties:
>
> clock-names:
> minItems: 1
> - maxItems: 8
> + maxItems: 10
> additionalItems: true
> contains:
> enum:
> diff --git a/Documentation/devicetree/bindings/net/tesla,ethqos.yaml b/Documentation/devicetree/bindings/net/tesla,ethqos.yaml
> new file mode 100644
> index 000000000000..9246b0395126
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/net/tesla,ethqos.yaml
> @@ -0,0 +1,91 @@
> +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/net/tesla,ethqos.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: FSD Ethernet Quality of Service
> +
> +maintainers:
> + - Swathi K S <swathi.ks@samsung.com>
> +
> +description:
> + dwmmac based tesla ethernet devices which support Gigabit
> + ethernet.
Please write complete sentences.
> +
> +allOf:
> + - $ref: snps,dwmac.yaml#
> +
> +properties:
> + compatible:
> + const: tesla,fsd-ethqos.yaml
???
Filename matching compatible means for compatible string
"tesla,fsd-ethqos" the filename should be tesla,fsd-ethqos.yaml.
> +
> + reg:
> + maxItems: 1
> +
> + interrupts:
> + maxItems: 1
> +
> + clocks:
> + minItems: 5
> + maxItems: 10
> +
> + clock-names:
> + minItems: 5
> + maxItems: 10
> +
> + iommus:
> + maxItems: 1
> +
> + phy-mode:
> + $ref: ethernet-controller.yaml#/properties/phy-connection-type
No need for this. phy-mode should already be included by snps,dwmac.yaml
including ethernet-controller.yaml.
Though you may want to define what subset of modes are valid.
> +
> +required:
> + - compatible
> + - reg
> + - interrupts
> + - clocks
> + - clock-names
> + - iommus
> + - phy-mode
> +
> +unevaluatedProperties: false
> +
> +examples:
> + - |
> + #include <dt-bindings/clock/fsd-clk.h>
> + #include <dt-bindings/interrupt-controller/arm-gic.h>
> +
> + ethernet_1: ethernet@14300000 {
Drop unused label.
> + compatible = "tesla,fsd-ethqos";
> + reg = <0x0 0x14300000 0x0 0x10000>;
> + interrupts = <GIC_SPI 176 IRQ_TYPE_LEVEL_HIGH>;
> + clocks = <&clock_peric PERIC_EQOS_TOP_IPCLKPORT_CLK_PTP_REF_I>,
> + <&clock_peric PERIC_EQOS_TOP_IPCLKPORT_ACLK_I>,
> + <&clock_peric PERIC_EQOS_TOP_IPCLKPORT_HCLK_I>,
> + <&clock_peric PERIC_EQOS_TOP_IPCLKPORT_RGMII_CLK_I>,
> + <&clock_peric PERIC_EQOS_TOP_IPCLKPORT_CLK_RX_I>,
> + <&clock_peric PERIC_BUS_D_PERIC_IPCLKPORT_EQOSCLK>,
> + <&clock_peric PERIC_BUS_P_PERIC_IPCLKPORT_EQOSCLK>,
> + <&clock_peric PERIC_EQOS_PHYRXCLK_MUX>,
> + <&clock_peric PERIC_EQOS_PHYRXCLK>,
> + <&clock_peric PERIC_DOUT_RGMII_CLK>;
> + clock-names = "ptp_ref",
> + "master_bus",
> + "slave_bus",
> + "tx",
> + "rx",
> + "master2_bus",
> + "slave2_bus",
> + "eqos_rxclk_mux",
> + "eqos_phyrxclk",
> + "dout_peric_rgmii_clk";
> + pinctrl-names = "default";
> + pinctrl-0 = <ð1_tx_clk>, <ð1_tx_data>, <ð1_tx_ctrl>,
> + <ð1_phy_intr>, <ð1_rx_clk>, <ð1_rx_data>,
> + <ð1_rx_ctrl>, <ð1_mdio>;
> + iommus = <&smmu_peric 0x0 0x1>;
> + phy-mode = "rgmii-id";
> + };
> +
> +...
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 15+ messages in thread
* RE: [PATCH v4 2/4] net: stmmac: dwc-qos: Add FSD EQoS support
2024-08-01 19:09 ` Serge Semin
@ 2025-01-27 9:45 ` Swathi K S
0 siblings, 0 replies; 15+ messages in thread
From: Swathi K S @ 2025-01-27 9:45 UTC (permalink / raw)
To: 'Serge Semin', 'Andrew Lunn'
Cc: krzk, robh, davem, edumazet, kuba, pabeni, conor+dt,
richardcochran, mcoquelin.stm32, alim.akhtar, linux-fsd, netdev,
devicetree, linux-kernel, linux-stm32, linux-arm-kernel,
linux-samsung-soc, alexandre.torgue, peppe.cavallaro, joabreu,
rcsekar, ssiddha, jayati.sahu, pankaj.dubey, ravi.patel, gost.dev
> -----Original Message-----
> From: Serge Semin <fancer.lancer@gmail.com>
> Sent: 02 August 2024 00:40
> To: Swathi K S <swathi.ks@samsung.com>; Andrew Lunn <andrew@lunn.ch>
> Cc: krzk@kernel.org; robh@kernel.org; davem@davemloft.net;
> edumazet@google.com; kuba@kernel.org; pabeni@redhat.com;
> conor+dt@kernel.org; richardcochran@gmail.com;
> mcoquelin.stm32@gmail.com; alim.akhtar@samsung.com; linux-
> fsd@tesla.com; netdev@vger.kernel.org; devicetree@vger.kernel.org; linux-
> kernel@vger.kernel.org; linux-stm32@st-md-mailman.stormreply.com;
> linux-arm-kernel@lists.infradead.org; linux-samsung-soc@vger.kernel.org;
> alexandre.torgue@foss.st.com; peppe.cavallaro@st.com;
> joabreu@synopsys.com; rcsekar@samsung.com; ssiddha@tesla.com;
> jayati.sahu@samsung.com; pankaj.dubey@samsung.com;
> ravi.patel@samsung.com; gost.dev@samsung.com
> Subject: Re: [PATCH v4 2/4] net: stmmac: dwc-qos: Add FSD EQoS support
>
> Hi Swathi, Andrew
>
> On Tue, Jul 30, 2024 at 02:46:46PM +0530, Swathi K S wrote:
> > The FSD SoC contains two instance of the Synopsys DWC ethernet QOS IP
> core.
> > The binding that it uses is slightly different from existing ones
> > because of the integration (clocks, resets).
> >
>
> > For FSD SoC, a mux switch is needed between internal and external
clocks.
> > By default after reset internal clock is used but for receiving
> > packets properly, external clock is needed. Mux switch to external
> > clock happens only when the external clock is present.
> >
> > Signed-off-by: Chandrasekar R <rcsekar@samsung.com>
> > Signed-off-by: Suresh Siddha <ssiddha@tesla.com>
> > Signed-off-by: Swathi K S <swathi.ks@samsung.com>
> > ---
> > .../stmicro/stmmac/dwmac-dwc-qos-eth.c | 90
> +++++++++++++++++++
> > .../net/ethernet/stmicro/stmmac/stmmac_main.c | 28 +++++-
> > include/linux/stmmac.h | 1 +
> > 3 files changed, 117 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
> > b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
> > index ec924c6c76c6..bc97b3b573b7 100644
> > --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
> > +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
> > @@ -20,6 +20,7 @@
> > #include <linux/platform_device.h>
> > #include <linux/reset.h>
> > #include <linux/stmmac.h>
> > +#include <linux/regmap.h>
> >
> > #include "stmmac_platform.h"
> > #include "dwmac4.h"
> > @@ -37,6 +38,13 @@ struct tegra_eqos {
> > struct gpio_desc *reset;
> > };
> >
> > +struct fsd_eqos_plat_data {
> > + const struct fsd_eqos_variant *fsd_eqos_inst_var;
> > + struct clk_bulk_data *clks;
> > + int num_clks;
> > + struct device *dev;
> > +};
> > +
> > static int dwc_eth_dwmac_config_dt(struct platform_device *pdev,
> > struct plat_stmmacenet_data *plat_dat) {
> @@ -265,6 +273,82 @@
> > static int tegra_eqos_init(struct platform_device *pdev, void *priv)
> > return 0;
> > }
> >
> > +static int dwc_eqos_rxmux_setup(void *priv, bool external) {
> > + int i = 0;
> > + struct fsd_eqos_plat_data *plat = priv;
> > + struct clk *rx1 = NULL;
> > + struct clk *rx2 = NULL;
> > + struct clk *rx3 = NULL;
> > +
> > + for (i = 0; i < plat->num_clks; i++) {
> > + if (strcmp(plat->clks[i].id, "eqos_rxclk_mux") == 0)
> > + rx1 = plat->clks[i].clk;
> > + else if (strcmp(plat->clks[i].id, "eqos_phyrxclk") == 0)
> > + rx2 = plat->clks[i].clk;
> > + else if (strcmp(plat->clks[i].id, "dout_peric_rgmii_clk") ==
0)
> > + rx3 = plat->clks[i].clk;
> > + }
> > +
> > + /* doesn't support RX clock mux */
> > + if (!rx1)
> > + return 0;
> > +
> > + if (external)
> > + return clk_set_parent(rx1, rx2);
> > + else
> > + return clk_set_parent(rx1, rx3);
> > +}
>
> Andrew is right asking about this implementation. It does seem
> questionable:
>
> 1. AFAIR RGMII Rx clock is supposed to be retrieved the PHY. So the
> eqos_phyrxclk and dout_peric_rgmii_clk are the PHY clocks. Do you have a
> PHY integrated in the SoC? If so you should have defined it as a separate
DT-
> node and moved the clocks definition in there.
In this case, there is no PHY integrated in the SoC.
>
> 2. Do you really need to perform the "eqos_rxclk_mux" clock re-parenting
on
> each interface open/close? Based on the commit log you don't. So the re-
> parenting can be done in the glue driver or even in the device tree by
means
> of the "assigned-clock-parents" property.
Thanks for the insight, we investigated further and realized that this is
not mandatory. So I will remove the reparenting done in every open/ close in
the updated patchset v5.
-Swathi
>
> -Serge(y)
>
> > +
> > +static int fsd_clks_endisable(void *priv, bool enabled) {
> > + struct fsd_eqos_plat_data *plat = priv;
> > +
> > + if (enabled) {
> > + return clk_bulk_prepare_enable(plat->num_clks, plat->clks);
> > + } else {
> > + clk_bulk_disable_unprepare(plat->num_clks, plat->clks);
> > + return 0;
> > + }
> > +}
> > +
> > +static int fsd_eqos_probe(struct platform_device *pdev,
> > + struct plat_stmmacenet_data *data,
> > + struct stmmac_resources *res)
> > +{
> > + struct fsd_eqos_plat_data *priv_plat;
> > + int ret = 0;
> > +
> > + priv_plat = devm_kzalloc(&pdev->dev, sizeof(*priv_plat),
> GFP_KERNEL);
> > + if (!priv_plat)
> > + return -ENOMEM;
> > +
> > + priv_plat->dev = &pdev->dev;
> > +
> > + ret = devm_clk_bulk_get_all(&pdev->dev, &priv_plat->clks);
> > + if (ret < 0)
> > + return dev_err_probe(&pdev->dev, ret, "No clocks
> available\n");
> > +
> > + priv_plat->num_clks = ret;
> > +
> > + data->bsp_priv = priv_plat;
> > + data->clks_config = fsd_clks_endisable;
> > + data->rxmux_setup = dwc_eqos_rxmux_setup;
> > +
> > + ret = fsd_clks_endisable(priv_plat, true);
> > + if (ret)
> > + return dev_err_probe(&pdev->dev, ret, "Unable to enable
> fsd
> > +clock\n");
> > +
> > + return 0;
> > +}
> > +
> > +static void fsd_eqos_remove(struct platform_device *pdev) {
> > + struct fsd_eqos_plat_data *priv_plat =
> > +get_stmmac_bsp_priv(&pdev->dev);
> > +
> > + fsd_clks_endisable(priv_plat, false); }
> > +
> > static int tegra_eqos_probe(struct platform_device *pdev,
> > struct plat_stmmacenet_data *data,
> > struct stmmac_resources *res)
> > @@ -411,6 +495,11 @@ static const struct dwc_eth_dwmac_data
> tegra_eqos_data = {
> > .remove = tegra_eqos_remove,
> > };
> >
> > +static const struct dwc_eth_dwmac_data fsd_eqos_data = {
> > + .probe = fsd_eqos_probe,
> > + .remove = fsd_eqos_remove,
> > +};
> > +
> > static int dwc_eth_dwmac_probe(struct platform_device *pdev) {
> > const struct dwc_eth_dwmac_data *data; @@ -473,6 +562,7 @@
> static
> > void dwc_eth_dwmac_remove(struct platform_device *pdev) static const
> > struct of_device_id dwc_eth_dwmac_match[] = {
> > { .compatible = "snps,dwc-qos-ethernet-4.10", .data =
> &dwc_qos_data },
> > { .compatible = "nvidia,tegra186-eqos", .data = &tegra_eqos_data },
> > + { .compatible = "tesla,fsd-ethqos", .data = &fsd_eqos_data },
> > { }
> > };
> > MODULE_DEVICE_TABLE(of, dwc_eth_dwmac_match); diff --git
> > a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > index 12689774d755..2ef82edec522 100644
> > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > @@ -4001,6 +4001,12 @@ static int __stmmac_open(struct net_device
> *dev,
> > netif_tx_start_all_queues(priv->dev);
> > stmmac_enable_all_dma_irq(priv);
> >
> > + if (priv->plat->rxmux_setup) {
> > + ret = priv->plat->rxmux_setup(priv->plat->bsp_priv, true);
> > + if (ret)
> > + netdev_err(priv->dev, "Rxmux setup failed\n");
> > + }
> > +
> > return 0;
> >
> > irq_error:
> > @@ -4056,7 +4062,13 @@ static void stmmac_fpe_stop_wq(struct
> > stmmac_priv *priv) static int stmmac_release(struct net_device *dev)
> > {
> > struct stmmac_priv *priv = netdev_priv(dev);
> > - u32 chan;
> > + u32 chan, ret;
> > +
> > + if (priv->plat->rxmux_setup) {
> > + ret = priv->plat->rxmux_setup(priv->plat->bsp_priv, false);
> > + if (ret)
> > + netdev_err(priv->dev, "Rxmux setup failed\n");
> > + }
> >
> > if (device_may_wakeup(priv->device))
> > phylink_speed_down(priv->phylink, false); @@ -7848,11
> +7860,17 @@
> > int stmmac_suspend(struct device *dev) {
> > struct net_device *ndev = dev_get_drvdata(dev);
> > struct stmmac_priv *priv = netdev_priv(ndev);
> > - u32 chan;
> > + u32 chan, ret;
> >
> > if (!ndev || !netif_running(ndev))
> > return 0;
> >
> > + if (priv->plat->rxmux_setup) {
> > + ret = priv->plat->rxmux_setup(priv->plat->bsp_priv, false);
> > + if (ret)
> > + netdev_err(priv->dev, "Rxmux setup failed\n");
> > + }
> > +
> > mutex_lock(&priv->lock);
> >
> > netif_device_detach(ndev);
> > @@ -8018,6 +8036,12 @@ int stmmac_resume(struct device *dev)
> > mutex_unlock(&priv->lock);
> > rtnl_unlock();
> >
> > + if (priv->plat->rxmux_setup) {
> > + ret = priv->plat->rxmux_setup(priv->plat->bsp_priv, true);
> > + if (ret)
> > + netdev_err(priv->dev, "Rxmux setup failed\n");
> > + }
> > +
> > netif_device_attach(ndev);
> >
> > return 0;
> > diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h index
> > 84e13bd5df28..f017b818d421 100644
> > --- a/include/linux/stmmac.h
> > +++ b/include/linux/stmmac.h
> > @@ -264,6 +264,7 @@ struct plat_stmmacenet_data {
> > void (*ptp_clk_freq_config)(struct stmmac_priv *priv);
> > int (*init)(struct platform_device *pdev, void *priv);
> > void (*exit)(struct platform_device *pdev, void *priv);
> > + int (*rxmux_setup)(void *priv, bool external);
> > struct mac_device_info *(*setup)(void *priv);
> > int (*clks_config)(void *priv, bool enabled);
> > int (*crosststamp)(ktime_t *device, struct system_counterval_t
> > *system,
> > --
> > 2.17.1
> >
> >
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2025-01-27 10:32 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CGME20240730092847epcas5p1338397b0ec01a4f0c8387704fb390a40@epcas5p1.samsung.com>
2024-07-30 9:16 ` [PATCH v4 0/4] net: stmmac: dwc-qos: Add FSD EQoS support Swathi K S
[not found] ` <CGME20240730092855epcas5p49902519f31bddcfe7da8f4b96a7d0527@epcas5p4.samsung.com>
2024-07-30 9:16 ` [PATCH v4 1/4] dt-bindings: net: Add FSD EQoS device tree bindings Swathi K S
2024-08-06 14:57 ` Rob Herring
[not found] ` <CGME20240730092902epcas5p1520f9cac624dad29f74a92ed4c559b25@epcas5p1.samsung.com>
2024-07-30 9:16 ` [PATCH v4 2/4] net: stmmac: dwc-qos: Add FSD EQoS support Swathi K S
2024-07-30 20:14 ` Andrew Lunn
2024-07-31 4:38 ` Swathi K S
2024-08-01 19:09 ` Serge Semin
2025-01-27 9:45 ` Swathi K S
[not found] ` <CGME20240730092907epcas5p1b81eaf13a57535e32e11709602aeee06@epcas5p1.samsung.com>
2024-07-30 9:16 ` [PATCH v4 3/4] arm64: dts: fsd: Add Ethernet support for FSYS0 Block of FSD SoC Swathi K S
2024-07-30 20:16 ` Andrew Lunn
2024-07-31 4:40 ` Swathi K S
2024-08-01 0:17 ` Andrew Lunn
2024-08-01 3:22 ` Swathi K S
[not found] ` <CGME20240730092913epcas5p18c3be42421fffe1a229f83ceeca1ace0@epcas5p1.samsung.com>
2024-07-30 9:16 ` [PATCH v4 4/4] arm64: dts: fsd: Add Ethernet support for PERIC " Swathi K S
2024-07-30 20:17 ` Andrew Lunn
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).