Skip to contentSkip to conversation

net: stmmac: RK3566

PATCH Superseded Ezequiel Garcia 3 participants 9 messages Apr 21, 2021 – Apr 25, 2021

Subsystems (6)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover net: stmmac: RK3566

Now that RK3568 SoC devicetree upstreaming is happening [1], here's another round for the RK3566 dwmac. There wasn't any clear consensus on how to implement the two interfaces present on RK3568, so I decided to drop that and just submit RK3566 for now.

This has been tested on a Pine64 RK3566 Quartz64 Model B board, DHCP and iperf are looking good.

For all the people testing, here's Quartz 64 Model B device tree snippet:

        gmac1: ethernet@fe010000 {
                compatible = "rockchip,rk3566-gmac", "snps,dwmac-4.20a";
                reg = <0x0 0xfe010000 0x0 0x10000>;
                interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>,
                             <GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>;
                interrupt-names = "macirq", "eth_wake_irq";
                rockchip,grf = <&grf>;
                clocks = <&cru SCLK_GMAC1>, <&cru SCLK_GMAC1_RX_TX>,
                         <&cru SCLK_GMAC1_RX_TX>, <&cru CLK_MAC1_REFOUT>,
                         <&cru ACLK_GMAC1>, <&cru PCLK_GMAC1>,
                         <&cru SCLK_GMAC1_RX_TX>, <&cru CLK_GMAC1_PTP_REF>;
                clock-names = "stmmaceth", "mac_clk_rx",
                              "mac_clk_tx", "clk_mac_refout",
                              "aclk_mac", "pclk_mac",
                              "clk_mac_speed", "ptp_ref";
                resets = <&cru SRST_A_GMAC1>;
                reset-names = "stmmaceth";

                snps,mixed-burst;
                snps,tso;

                snps,axi-config = <&gmac1_stmmac_axi_setup>;
                snps,mtl-rx-config = <&gmac1_mtl_rx_setup>;
                snps,mtl-tx-config = <&gmac1_mtl_tx_setup>;
                status = "disabled";

                mdio1: mdio {
                        compatible = "snps,dwmac-mdio";
                        #address-cells = <0x1>;
                        #size-cells = <0x0>;
                };

                gmac1_stmmac_axi_setup: stmmac-axi-config {
                        snps,wr_osr_lmt = <4>;
                        snps,rd_osr_lmt = <8>;
                        snps,blen = <0 0 0 0 16 8 4>;
                };

                gmac1_mtl_rx_setup: rx-queues-config {
                        snps,rx-queues-to-use = <1>;
                        queue0 {};
                };

                gmac1_mtl_tx_setup: tx-queues-config {
                        snps,tx-queues-to-use = <1>;
                        queue0 {};
                };
        };

While here, I'm adding a small patch from David Wu, for some sanity checks for dwmac-rockchip-specific non-NULL ops.

Thanks!

[1] http://lore.kernel.org/r/[email protected]

David Wu (2):
net: stmmac: dwmac-rk: Check platform-specific ops
net: stmmac: Add RK3566 SoC support

Ezequiel Garcia (1):
net: stmmac: Don't set has_gmac if has_gmac4 is set

 .../bindings/net/rockchip-dwmac.txt           |   1 +
 .../net/ethernet/stmicro/stmmac/dwmac-rk.c    | 126 +++++++++++++++++-
 2 files changed, 124 insertions(+), 3 deletions(-)
Signature · 1 line
2.30.0
#1 lore raw

PATCH v2 1/3 net: stmmac: Don't set has_gmac if has_gmac4 is set

Some Rockchip platforms have a GMAC4 core, and therefore 'plat_stmmacenet_data.has_gmac' shouldn't be set if 'plat_stmmacenet_data.has_gmac4' is set.

---
 drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +5 -1
index 6ef30252bfe0..c432a9592489 100644
@@ -1400,7 +1400,11 @@ static int rk_gmac_probe(struct platform_device *pdev)
 	if (IS_ERR(plat_dat))
 		return PTR_ERR(plat_dat);
 
-	plat_dat->has_gmac = true;
+	/* If the stmmac is not already selected as gmac4,
+	 * then make sure we fallback to gmac.
+	 */
+	if (!plat_dat->has_gmac4)
+		plat_dat->has_gmac = true;
 	plat_dat->fix_mac_speed = rk_fix_speed;
 
 	plat_dat->bsp_priv = rk_gmac_setup(pdev, plat_dat, data);
Signature · 1 line
2.30.0
#2 lore raw

PATCH v2 2/3 net: stmmac: dwmac-rk: Check platform-specific ops

In reply to Ezequiel Garcia

From: David Wu <[email protected]>

Add a check for non-null struct rk_gmac_ops for the configured PHY interface mode, failing if unsupported.

[Ezequiel: Refactor so it fails if unsupported]
---
 .../net/ethernet/stmicro/stmmac/dwmac-rk.c    | 31 +++++++++++++++++--
 1 file changed, 29 insertions(+), 2 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +29 -2
index c432a9592489..d2637d83899e 100644
@@ -1294,11 +1294,36 @@ static struct rk_priv_data *rk_gmac_setup(struct platform_device *pdev,
 	return bsp_priv;
 }
 
+static int rk_gmac_check_ops(struct rk_priv_data *bsp_priv)
+{
+	switch (bsp_priv->phy_iface) {
+	case PHY_INTERFACE_MODE_RGMII:
+	case PHY_INTERFACE_MODE_RGMII_ID:
+	case PHY_INTERFACE_MODE_RGMII_RXID:
+	case PHY_INTERFACE_MODE_RGMII_TXID:
+		if (!bsp_priv->ops->set_to_rgmii)
+			return -EINVAL;
+		break;
+	case PHY_INTERFACE_MODE_RMII:
+		if (!bsp_priv->ops->set_to_rmii)
+			return -EINVAL;
+		break;
+	default:
+		dev_err(&bsp_priv->pdev->dev,
+			"unsupported interface %d", bsp_priv->phy_iface);
+	}
+	return 0;
+}
+
 static int rk_gmac_powerup(struct rk_priv_data *bsp_priv)
 {
 	int ret;
 	struct device *dev = &bsp_priv->pdev->dev;
 
+	ret = rk_gmac_check_ops(bsp_priv);
+	if (ret)
+		return ret;
+
 	ret = gmac_clk_enable(bsp_priv, true);
 	if (ret)
 		return ret;
@@ -1369,10 +1394,12 @@ static void rk_fix_speed(void *priv, unsigned int speed)
 	case PHY_INTERFACE_MODE_RGMII_ID:
 	case PHY_INTERFACE_MODE_RGMII_RXID:
 	case PHY_INTERFACE_MODE_RGMII_TXID:
-		bsp_priv->ops->set_rgmii_speed(bsp_priv, speed);
+		if (bsp_priv->ops->set_rgmii_speed)
+			bsp_priv->ops->set_rgmii_speed(bsp_priv, speed);
 		break;
 	case PHY_INTERFACE_MODE_RMII:
-		bsp_priv->ops->set_rmii_speed(bsp_priv, speed);
+		if (bsp_priv->ops->set_rmii_speed)
+			bsp_priv->ops->set_rmii_speed(bsp_priv, speed);
 		break;
 	default:
 		dev_err(dev, "unsupported interface %d", bsp_priv->phy_iface);
Signature · 1 line
2.30.0
#3 lore raw

PATCH v2 3/3 net: stmmac: Add RK3566 SoC support

In reply to Ezequiel Garcia

From: David Wu <[email protected]>

Add constants and callback functions for the dwmac present on RK3566 SoCs. As can be seen, the base structure
is the same, only registers and the bits in them moved slightly.

The dwmac IP core version v5.1, and so the compatible string is expected to be:

  compatible = "rockchip,rk3566-gmac", "snps,dwmac-4.20a";
[Ezequiel: Separate rk3566-gmac support]
---
 .../bindings/net/rockchip-dwmac.txt           |  1 +
 .../net/ethernet/stmicro/stmmac/dwmac-rk.c    | 89 +++++++++++++++++++
 2 files changed, 90 insertions(+)
Documentation/devicetree/bindings/net/rockchip-dwmac.txt +1 -0
index 3b71da7e8742..3bd4bbcd6c65 100644
@@ -12,6 +12,7 @@ Required properties:
    "rockchip,rk3366-gmac": found on RK3366 SoCs
    "rockchip,rk3368-gmac": found on RK3368 SoCs
    "rockchip,rk3399-gmac": found on RK3399 SoCs
+   "rockchip,rk3566-gmac", "snps,dwmac-4.20a": found on RK3566 SoCs
    "rockchip,rv1108-gmac": found on RV1108 SoCs
  - reg: addresses and length of the register sets for the device.
  - interrupts: Should contain the GMAC interrupts.
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +89 -0

101 lines not on this page · raw message

Signature · 1 line
2.30.0
#4 lore raw

Re: [PATCH v2 3/3] net: stmmac: Add RK3566 SoC support

Quoted 24 lines · Ezequiel Garcia

From: David Wu <[email protected]>

Add constants and callback functions for the dwmac present on RK3566 SoCs. As can be seen, the base structure
is the same, only registers and the bits in them moved slightly.

The dwmac IP core version v5.1, and so the compatible string is expected to be:

  compatible = "rockchip,rk3566-gmac", "snps,dwmac-4.20a";
[Ezequiel: Separate rk3566-gmac support]
---
 .../bindings/net/rockchip-dwmac.txt           |  1 +
 .../net/ethernet/stmicro/stmmac/dwmac-rk.c    | 89 +++++++++++++++++++
 2 files changed, 90 insertions(+)
Documentation/devicetree/bindings/net/rockchip-dwmac.txt +0 -0
index 3b71da7e8742..3bd4bbcd6c65 100644

Documentation/devicetree/bindings/net/rockchip-dwmac.txt Required properties: · line 16

Quoted 5 lines
Documentation/devicetree/bindings/net/rockchip-dwmac.txt +1 -0
@@ -12,6 +12,7 @@ Required properties:
    "rockchip,rk3366-gmac": found on RK3366 SoCs
    "rockchip,rk3368-gmac": found on RK3368 SoCs
    "rockchip,rk3399-gmac": found on RK3399 SoCs
 
+   "rockchip,rk3566-gmac", "snps,dwmac-4.20a": found on RK3566 SoCs

This is still a text document.
rob+dt has now scripts that check for undocumented compatibility strings, so first convert rockchip-dwmac.txt to YAML and then add this in a separated patch.

Johan

Quoted 111 lines
Documentation/devicetree/bindings/net/rockchip-dwmac.txt +0 -0
    "rockchip,rv1108-gmac": found on RV1108 SoCs
  - reg: addresses and length of the register sets for the device.

- interrupts: Should contain the GMAC interrupts.

drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +89 -0
index d2637d83899e..a8850bcd980f 100644
@@ -948,6 +948,94 @@ static const struct rk_gmac_ops rk3399_ops = {
 	.set_rmii_speed = rk3399_set_rmii_speed,
 };
 
+#define RK3568_GRF_GMAC0_CON0		0x0380
+#define RK3568_GRF_GMAC0_CON1		0x0384
+#define RK3568_GRF_GMAC1_CON0		0x0388
+#define RK3568_GRF_GMAC1_CON1		0x038c
+
+/* RK3568_GRF_GMAC0_CON1 && RK3568_GRF_GMAC1_CON1 */
+#define RK3568_GMAC_PHY_INTF_SEL_RGMII	\
+		(GRF_BIT(4) | GRF_CLR_BIT(5) | GRF_CLR_BIT(6))
+#define RK3568_GMAC_PHY_INTF_SEL_RMII	\
+		(GRF_CLR_BIT(4) | GRF_CLR_BIT(5) | GRF_BIT(6))
+#define RK3568_GMAC_FLOW_CTRL			GRF_BIT(3)
+#define RK3568_GMAC_FLOW_CTRL_CLR		GRF_CLR_BIT(3)
+#define RK3568_GMAC_RXCLK_DLY_ENABLE		GRF_BIT(1)
+#define RK3568_GMAC_RXCLK_DLY_DISABLE		GRF_CLR_BIT(1)
+#define RK3568_GMAC_TXCLK_DLY_ENABLE		GRF_BIT(0)
+#define RK3568_GMAC_TXCLK_DLY_DISABLE		GRF_CLR_BIT(0)
+
+/* RK3568_GRF_GMAC0_CON0 && RK3568_GRF_GMAC1_CON0 */
+#define RK3568_GMAC_CLK_RX_DL_CFG(val)	HIWORD_UPDATE(val, 0x7F, 8)
+#define RK3568_GMAC_CLK_TX_DL_CFG(val)	HIWORD_UPDATE(val, 0x7F, 0)
+
+static void rk3566_set_to_rgmii(struct rk_priv_data *bsp_priv,
+				int tx_delay, int rx_delay)
+{
+	struct device *dev = &bsp_priv->pdev->dev;
+
+	if (IS_ERR(bsp_priv->grf)) {
+		dev_err(dev, "Missing rockchip,grf property\n");
+		return;
+	}
+
+	regmap_write(bsp_priv->grf, RK3568_GRF_GMAC1_CON1,
+		     RK3568_GMAC_PHY_INTF_SEL_RGMII |
+		     RK3568_GMAC_RXCLK_DLY_ENABLE |
+		     RK3568_GMAC_TXCLK_DLY_ENABLE);
+
+	regmap_write(bsp_priv->grf, RK3568_GRF_GMAC1_CON0,
+		     RK3568_GMAC_CLK_RX_DL_CFG(rx_delay) |
+		     RK3568_GMAC_CLK_TX_DL_CFG(tx_delay));
+}
+
+static void rk3566_set_to_rmii(struct rk_priv_data *bsp_priv)
+{
+	struct device *dev = &bsp_priv->pdev->dev;
+
+	if (IS_ERR(bsp_priv->grf)) {
+		dev_err(dev, "%s: Missing rockchip,grf property\n", __func__);
+		return;
+	}
+
+	regmap_write(bsp_priv->grf, RK3568_GRF_GMAC1_CON1,
+		     RK3568_GMAC_PHY_INTF_SEL_RMII);
+}
+
+static void rk3566_set_gmac_speed(struct rk_priv_data *bsp_priv, int speed)
+{
+	struct device *dev = &bsp_priv->pdev->dev;
+	unsigned long rate;
+	int ret;
+
+	switch (speed) {
+	case 10:
+		rate = 2500000;
+		break;
+	case 100:
+		rate = 25000000;
+		break;
+	case 1000:
+		rate = 125000000;
+		break;
+	default:
+		dev_err(dev, "unknown speed value for GMAC speed=%d", speed);
+		return;
+	}
+
+	ret = clk_set_rate(bsp_priv->clk_mac_speed, rate);
+	if (ret)
+		dev_err(dev, "%s: set clk_mac_speed rate %ld failed %d\n",
+			__func__, rate, ret);
+}
+
+static const struct rk_gmac_ops rk3566_ops = {
+	.set_to_rgmii = rk3566_set_to_rgmii,
+	.set_to_rmii = rk3566_set_to_rmii,
+	.set_rgmii_speed = rk3566_set_gmac_speed,
+	.set_rmii_speed = rk3566_set_gmac_speed,
+};
+
 #define RV1108_GRF_GMAC_CON0		0X0900
 
 /* RV1108_GRF_GMAC_CON0 */
@@ -1512,6 +1600,7 @@ static const struct of_device_id rk_gmac_dwmac_match[] = {
 	{ .compatible = "rockchip,rk3366-gmac", .data = &rk3366_ops },
 	{ .compatible = "rockchip,rk3368-gmac", .data = &rk3368_ops },
 	{ .compatible = "rockchip,rk3399-gmac", .data = &rk3399_ops },
+	{ .compatible = "rockchip,rk3566-gmac", .data = &rk3566_ops },
 	{ .compatible = "rockchip,rv1108-gmac", .data = &rv1108_ops },
 	{ }
 };
#5 lore raw

Re: [PATCH v2 3/3] net: stmmac: Add RK3566 SoC support

Quoted 29 lines · Johan Jonker
Quoted 27 lines · Ezequiel Garcia

From: David Wu <[email protected]>

Add constants and callback functions for the dwmac present on RK3566 SoCs. As can be seen, the base structure
is the same, only registers and the bits in them moved slightly.

The dwmac IP core version v5.1, and so the compatible string is expected to be:

  compatible = "rockchip,rk3566-gmac", "snps,dwmac-4.20a";

[Ezequiel: Separate rk3566-gmac support]

---
 .../bindings/net/rockchip-dwmac.txt           |  1 + .../net/ethernet/stmicro/stmmac/dwmac-rk.c    | 89 +++++++++++++++++++

 2 files changed, 90 insertions(+)
Documentation/devicetree/bindings/net/rockchip-dwmac.txt +0 -0
index 3b71da7e8742..3bd4bbcd6c65 100644
@@ -12,6 +12,7 @@ Required properties:

    "rockchip,rk3366-gmac": found on RK3366 SoCs "rockchip,rk3368-gmac": found on RK3368 SoCs "rockchip,rk3399-gmac": found on RK3399 SoCs

Quoted 7 lines
Quoted 1 line

+   "rockchip,rk3566-gmac", "snps,dwmac-4.20a": found on RK3566 SoCs

This is still a text document.
rob+dt has now scripts that check for undocumented compatibility strings, so first convert rockchip-dwmac.txt to YAML and then add this in a separated patch.

Is it a showstopper to convert devicetree bindings to YAML, for driver submission?

Thanks,
Ezequiel

#6 lore raw
In reply to Ezequiel Garcia

Hi Ezequiel,

Quoted 5 lines · Ezequiel Garcia

Now that RK3568 SoC devicetree upstreaming is happening [1], here's another round for the RK3566 dwmac. There wasn't any clear consensus on how to implement the two interfaces present on RK3568, so I decided to drop that and just submit RK3566 for now.

Quoted 8 lines

This has been tested on a Pine64 RK3566 Quartz64 Model B board, DHCP and iperf are looking good.

For all the people testing, here's Quartz 64 Model B device tree snippet:

         gmac1: ethernet@fe010000 {
                 compatible = "rockchip,rk3566-gmac", "snps,dwmac-4.20a";

It is better to use "rockchip,rk3568-gmac" here, "rockchip,rk3566-gmac" is not compatible, 3568 has two gmacs, which are compatible with 3566.

If there is no better way, using bus_id from alias is good, it is a fixed id, and U-Boot also use the id to write MAC address into kernel DTB.

plat->bus_id = of_alias_get_id(np, "ethernet");

Quoted 58 lines
                 reg = <0x0 0xfe010000 0x0 0x10000>;
                 interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>,
                              <GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>;
                 interrupt-names = "macirq", "eth_wake_irq";
                 rockchip,grf = <&grf>;
                 clocks = <&cru SCLK_GMAC1>, <&cru SCLK_GMAC1_RX_TX>,
                          <&cru SCLK_GMAC1_RX_TX>, <&cru CLK_MAC1_REFOUT>,
                          <&cru ACLK_GMAC1>, <&cru PCLK_GMAC1>,
                          <&cru SCLK_GMAC1_RX_TX>, <&cru CLK_GMAC1_PTP_REF>;
                 clock-names = "stmmaceth", "mac_clk_rx",
                               "mac_clk_tx", "clk_mac_refout",
                               "aclk_mac", "pclk_mac",
                               "clk_mac_speed", "ptp_ref";
                 resets = <&cru SRST_A_GMAC1>;
                 reset-names = "stmmaceth";

                 snps,mixed-burst;
                 snps,tso;

                 snps,axi-config = <&gmac1_stmmac_axi_setup>;
                 snps,mtl-rx-config = <&gmac1_mtl_rx_setup>;
                 snps,mtl-tx-config = <&gmac1_mtl_tx_setup>;
                 status = "disabled";

                 mdio1: mdio {
                         compatible = "snps,dwmac-mdio";
                         #address-cells = <0x1>;
                         #size-cells = <0x0>;
                 };

                 gmac1_stmmac_axi_setup: stmmac-axi-config {
                         snps,wr_osr_lmt = <4>;
                         snps,rd_osr_lmt = <8>;
                         snps,blen = <0 0 0 0 16 8 4>;
                 };

                 gmac1_mtl_rx_setup: rx-queues-config {
                         snps,rx-queues-to-use = <1>;
                         queue0 {};
                 };

                 gmac1_mtl_tx_setup: tx-queues-config {
                         snps,tx-queues-to-use = <1>;
                         queue0 {};
                 };
         };

While here, I'm adding a small patch from David Wu, for some sanity checks for dwmac-rockchip-specific non-NULL ops.

Thanks!

[1] http://lore.kernel.org/r/[email protected]

David Wu (2):
net: stmmac: dwmac-rk: Check platform-specific ops
net: stmmac: Add RK3566 SoC support

Quoted 7 lines

Ezequiel Garcia (1):
net: stmmac: Don't set has_gmac if has_gmac4 is set

  .../bindings/net/rockchip-dwmac.txt           |   1 +
  .../net/ethernet/stmicro/stmmac/dwmac-rk.c    | 126 +++++++++++++++++-
  2 files changed, 124 insertions(+), 3 deletions(-)

_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip

#7 lore raw

Hi David,

Thanks a lot for reviewing.

Quoted 17 lines · David Wu

Hi Ezequiel,

Quoted 5 lines · Ezequiel Garcia

Now that RK3568 SoC devicetree upstreaming is happening [1], here's another round for the RK3566 dwmac. There wasn't any clear consensus on how to implement the two interfaces present on RK3568, so I decided to drop that and just submit RK3566 for now.

Quoted 8 lines

This has been tested on a Pine64 RK3566 Quartz64 Model B board, DHCP and iperf are looking good.

For all the people testing, here's Quartz 64 Model B device tree snippet:

         gmac1: ethernet@fe010000 {
                 compatible = "rockchip,rk3566-gmac", "snps,dwmac-4.20a";

Quoted 8 lines

It is better to use "rockchip,rk3568-gmac" here, "rockchip,rk3566-gmac" is not compatible, 3568 has two gmacs, which are compatible with 3566.

If there is no better way, using bus_id from alias is good, it is a fixed id, and U-Boot also use the id to write MAC address into kernel DTB.

plat->bus_id = of_alias_get_id(np, "ethernet");

This was discussed, see ChenYu's reply. I think the idea is considered fragile:

https://lore.kernel.org/netdev/CAGb2v67ZBR=XDFPeXQc429HNu_dbY__-KN50tvBW44fXMs78_w@mail.gmail.com/

However, I agree with you about going back to just "rockchip,rk3568-gmac". Adding rockchip,rk3566-gmac maybe wasn't a great idea :-)

The most accepted way forward seems Heiko's proposal of hardcoding the mmio addresses to identify each block, as it's done in the DSI driver:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c#n1170

Would you agree with it?

Thanks!
Ezequiel

Quoted 67 lines
Quoted 65 lines

                 reg = <0x0 0xfe010000 0x0 0x10000>;
                 interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "macirq", "eth_wake_irq"; rockchip,grf = <&grf>;
                 clocks = <&cru SCLK_GMAC1>, <&cru SCLK_GMAC1_RX_TX>, <&cru SCLK_GMAC1_RX_TX>, <&cru CLK_MAC1_REFOUT>, <&cru ACLK_GMAC1>, <&cru PCLK_GMAC1>, <&cru SCLK_GMAC1_RX_TX>, <&cru CLK_GMAC1_PTP_REF>; clock-names = "stmmaceth", "mac_clk_rx", "mac_clk_tx", "clk_mac_refout", "aclk_mac", "pclk_mac", "clk_mac_speed", "ptp_ref"; resets = <&cru SRST_A_GMAC1>;
                 reset-names = "stmmaceth";

                 snps,mixed-burst;
                 snps,tso;

                 snps,axi-config = <&gmac1_stmmac_axi_setup>; snps,mtl-rx-config = <&gmac1_mtl_rx_setup>; snps,mtl-tx-config = <&gmac1_mtl_tx_setup>; status = "disabled";

                 mdio1: mdio {
                         compatible = "snps,dwmac-mdio"; #address-cells = <0x1>; #size-cells = <0x0>; };

                 gmac1_stmmac_axi_setup: stmmac-axi-config { snps,wr_osr_lmt = <4>; snps,rd_osr_lmt = <8>; snps,blen = <0 0 0 0 16 8 4>; };

                 gmac1_mtl_rx_setup: rx-queues-config { snps,rx-queues-to-use = <1>; queue0 {};
                 };

                 gmac1_mtl_tx_setup: tx-queues-config { snps,tx-queues-to-use = <1>; queue0 {};
                 };
         };

While here, I'm adding a small patch from David Wu, for some sanity checks for dwmac-rockchip-specific non-NULL ops.

Thanks!

[1] http://lore.kernel.org/r/[email protected]

David Wu (2):
   net: stmmac: dwmac-rk: Check platform-specific ops
   net: stmmac: Add RK3566 SoC support

Ezequiel Garcia (1):
   net: stmmac: Don't set has_gmac if has_gmac4 is set

  .../bindings/net/rockchip-dwmac.txt           |   1 + .../net/ethernet/stmicro/stmmac/dwmac-rk.c    | 126 +++++++++++++++++-

  2 files changed, 124 insertions(+), 3 deletions(-)
#8 lore raw

Hi Ezequiel,

Quoted 39 lines · Ezequiel Garcia

Hi David,

Thanks a lot for reviewing.

Quoted 17 lines · David Wu

Hi Ezequiel,

Quoted 5 lines · Ezequiel Garcia

Now that RK3568 SoC devicetree upstreaming is happening [1], here's another round for the RK3566 dwmac. There wasn't any clear consensus on how to implement the two interfaces present on RK3568, so I decided to drop that and just submit RK3566 for now.

Quoted 8 lines

This has been tested on a Pine64 RK3566 Quartz64 Model B board, DHCP and iperf are looking good.

For all the people testing, here's Quartz 64 Model B device tree snippet:

         gmac1: ethernet@fe010000 {
                 compatible = "rockchip,rk3566-gmac", "snps,dwmac-4.20a";

Quoted 8 lines

It is better to use "rockchip,rk3568-gmac" here, "rockchip,rk3566-gmac" is not compatible, 3568 has two gmacs, which are compatible with 3566.

If there is no better way, using bus_id from alias is good, it is a fixed id, and U-Boot also use the id to write MAC address into kernel DTB.

plat->bus_id = of_alias_get_id(np, "ethernet");

This was discussed, see ChenYu's reply. I think the idea is considered fragile:

https://lore.kernel.org/netdev/CAGb2v67ZBR=XDFPeXQc429HNu_dbY__-KN50tvBW44fXMs78_w@mail.gmail.com/

However, I agree with you about going back to just "rockchip,rk3568-gmac". Adding rockchip,rk3566-gmac maybe wasn't a great idea :-)

Quoted 7 lines

The most accepted way forward seems Heiko's proposal of hardcoding the mmio addresses to identify each block, as it's done in the DSI driver:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c#n1170

Would you agree with it?

Yes, I agree.
I also think the alias should be rarely changed. The DSI mmio addresses example here can be used for reference, and it seems that it will be stronger than alias.

Quoted 75 lines

Thanks!
Ezequiel

Quoted 67 lines
Quoted 65 lines

                 reg = <0x0 0xfe010000 0x0 0x10000>;
                 interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "macirq", "eth_wake_irq"; rockchip,grf = <&grf>;
                 clocks = <&cru SCLK_GMAC1>, <&cru SCLK_GMAC1_RX_TX>, <&cru SCLK_GMAC1_RX_TX>, <&cru CLK_MAC1_REFOUT>, <&cru ACLK_GMAC1>, <&cru PCLK_GMAC1>, <&cru SCLK_GMAC1_RX_TX>, <&cru CLK_GMAC1_PTP_REF>; clock-names = "stmmaceth", "mac_clk_rx", "mac_clk_tx", "clk_mac_refout", "aclk_mac", "pclk_mac", "clk_mac_speed", "ptp_ref"; resets = <&cru SRST_A_GMAC1>;
                 reset-names = "stmmaceth";

                 snps,mixed-burst;
                 snps,tso;

                 snps,axi-config = <&gmac1_stmmac_axi_setup>; snps,mtl-rx-config = <&gmac1_mtl_rx_setup>; snps,mtl-tx-config = <&gmac1_mtl_tx_setup>; status = "disabled";

                 mdio1: mdio {
                         compatible = "snps,dwmac-mdio"; #address-cells = <0x1>; #size-cells = <0x0>; };

                 gmac1_stmmac_axi_setup: stmmac-axi-config { snps,wr_osr_lmt = <4>; snps,rd_osr_lmt = <8>; snps,blen = <0 0 0 0 16 8 4>; };

                 gmac1_mtl_rx_setup: rx-queues-config { snps,rx-queues-to-use = <1>; queue0 {};
                 };

                 gmac1_mtl_tx_setup: tx-queues-config { snps,tx-queues-to-use = <1>; queue0 {};
                 };
         };

While here, I'm adding a small patch from David Wu, for some sanity checks for dwmac-rockchip-specific non-NULL ops.

Thanks!

[1] http://lore.kernel.org/r/[email protected]

David Wu (2):
   net: stmmac: dwmac-rk: Check platform-specific ops
   net: stmmac: Add RK3566 SoC support

Ezequiel Garcia (1):
   net: stmmac: Don't set has_gmac if has_gmac4 is set

   .../bindings/net/rockchip-dwmac.txt           |   1 +
   .../net/ethernet/stmicro/stmmac/dwmac-rk.c    | 126 +++++++++++++++++-
   2 files changed, 124 insertions(+), 3 deletions(-)

_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip