All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V3 net-next 0/7] ARM: Enable GENET support for RPi 4
@ 2019-11-09 19:00 ` Stefan Wahren
  0 siblings, 0 replies; 34+ messages in thread
From: Stefan Wahren @ 2019-11-09 19:00 UTC (permalink / raw)
  To: Matthias Brugger, Matthias Brugger, David S . Miller, Florian Fainelli
  Cc: Eric Anholt, Nicolas Saenz Julienne, Doug Berger, netdev,
	bcm-kernel-feedback-list, linux-arm-kernel, Stefan Wahren

Raspberry Pi 4 uses the broadcom genet chip in version five.
This chip has a dma controller integrated. Up to now the maximal
burst size was hard-coded to 0x10. But it turns out that Raspberry Pi 4
does only work with the smaller maximal burst size of 0x8.

This series based on Matthias Brugger's V1 series [1].

[1] - https://patchwork.kernel.org/cover/11186193/

Changes in V3:
- introduce SoC-specific compatibles for GENET (incl. dt-binding)
- use platform_get_irq_optional for optional IRQ
- remove Fixes tag from IRQ error handling change
- move most of MDIO stuff to bcm2711.dtsi

Changes in V2:
- add 2 fixes for IRQ retrieval
- add support for missing PHY modes
- declare PHY mode RGMII RXID based on the default settings
- add alias to allow firmware append the MAC address

Stefan Wahren (7):
  net: bcmgenet: Avoid touching non-existent interrupt
  net: bcmgenet: Fix error handling on IRQ retrieval
  dt-bindings: net: bcmgenet: Add BCM2711 support
  net: bcmgenet: Add BCM2711 support
  net: bcmgenet: Refactor register access in bcmgenet_mii_config
  net: bcmgenet: Add RGMII_RXID and RGMII_ID support
  ARM: dts: bcm2711-rpi-4: Enable GENET support

 .../devicetree/bindings/net/brcm,bcmgenet.txt      |  2 +-
 arch/arm/boot/dts/bcm2711-rpi-4-b.dts              | 17 +++++
 arch/arm/boot/dts/bcm2711.dtsi                     | 26 ++++++++
 drivers/net/ethernet/broadcom/genet/bcmgenet.c     | 74 ++++++++++++++++++----
 drivers/net/ethernet/broadcom/genet/bcmgenet.h     |  1 +
 drivers/net/ethernet/broadcom/genet/bcmmii.c       | 51 ++++++++-------
 6 files changed, 133 insertions(+), 38 deletions(-)

--
2.7.4


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

* [PATCH V3 net-next 0/7] ARM: Enable GENET support for RPi 4
@ 2019-11-09 19:00 ` Stefan Wahren
  0 siblings, 0 replies; 34+ messages in thread
From: Stefan Wahren @ 2019-11-09 19:00 UTC (permalink / raw)
  To: Matthias Brugger, Matthias Brugger, David S . Miller, Florian Fainelli
  Cc: Doug Berger, netdev, Eric Anholt, bcm-kernel-feedback-list,
	Nicolas Saenz Julienne, linux-arm-kernel, Stefan Wahren

Raspberry Pi 4 uses the broadcom genet chip in version five.
This chip has a dma controller integrated. Up to now the maximal
burst size was hard-coded to 0x10. But it turns out that Raspberry Pi 4
does only work with the smaller maximal burst size of 0x8.

This series based on Matthias Brugger's V1 series [1].

[1] - https://patchwork.kernel.org/cover/11186193/

Changes in V3:
- introduce SoC-specific compatibles for GENET (incl. dt-binding)
- use platform_get_irq_optional for optional IRQ
- remove Fixes tag from IRQ error handling change
- move most of MDIO stuff to bcm2711.dtsi

Changes in V2:
- add 2 fixes for IRQ retrieval
- add support for missing PHY modes
- declare PHY mode RGMII RXID based on the default settings
- add alias to allow firmware append the MAC address

Stefan Wahren (7):
  net: bcmgenet: Avoid touching non-existent interrupt
  net: bcmgenet: Fix error handling on IRQ retrieval
  dt-bindings: net: bcmgenet: Add BCM2711 support
  net: bcmgenet: Add BCM2711 support
  net: bcmgenet: Refactor register access in bcmgenet_mii_config
  net: bcmgenet: Add RGMII_RXID and RGMII_ID support
  ARM: dts: bcm2711-rpi-4: Enable GENET support

 .../devicetree/bindings/net/brcm,bcmgenet.txt      |  2 +-
 arch/arm/boot/dts/bcm2711-rpi-4-b.dts              | 17 +++++
 arch/arm/boot/dts/bcm2711.dtsi                     | 26 ++++++++
 drivers/net/ethernet/broadcom/genet/bcmgenet.c     | 74 ++++++++++++++++++----
 drivers/net/ethernet/broadcom/genet/bcmgenet.h     |  1 +
 drivers/net/ethernet/broadcom/genet/bcmmii.c       | 51 ++++++++-------
 6 files changed, 133 insertions(+), 38 deletions(-)

--
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH V3 net-next 1/7] net: bcmgenet: Avoid touching non-existent interrupt
  2019-11-09 19:00 ` Stefan Wahren
@ 2019-11-09 19:00   ` Stefan Wahren
  -1 siblings, 0 replies; 34+ messages in thread
From: Stefan Wahren @ 2019-11-09 19:00 UTC (permalink / raw)
  To: Matthias Brugger, Matthias Brugger, David S . Miller, Florian Fainelli
  Cc: Eric Anholt, Nicolas Saenz Julienne, Doug Berger, netdev,
	bcm-kernel-feedback-list, linux-arm-kernel, Stefan Wahren

As platform_get_irq() now prints an error when the interrupt does not
exist, we are getting a confusing error message in case the optional
WOL IRQ is not defined:

  bcmgenet fd58000.ethernet: IRQ index 2 not found

Fix this by using the platform_get_irq_optional().

Fixes: 7723f4c5ecdb8d83 ("driver core: platform: Add an error message to platform_get_irq*()")
Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
---
 drivers/net/ethernet/broadcom/genet/bcmgenet.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index 4f689fb..9f68ee1 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -3465,7 +3465,7 @@ static int bcmgenet_probe(struct platform_device *pdev)
 	priv = netdev_priv(dev);
 	priv->irq0 = platform_get_irq(pdev, 0);
 	priv->irq1 = platform_get_irq(pdev, 1);
-	priv->wol_irq = platform_get_irq(pdev, 2);
+	priv->wol_irq = platform_get_irq_optional(pdev, 2);
 	if (!priv->irq0 || !priv->irq1) {
 		dev_err(&pdev->dev, "can't find IRQs\n");
 		err = -EINVAL;
--
2.7.4


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

* [PATCH V3 net-next 1/7] net: bcmgenet: Avoid touching non-existent interrupt
@ 2019-11-09 19:00   ` Stefan Wahren
  0 siblings, 0 replies; 34+ messages in thread
From: Stefan Wahren @ 2019-11-09 19:00 UTC (permalink / raw)
  To: Matthias Brugger, Matthias Brugger, David S . Miller, Florian Fainelli
  Cc: Doug Berger, netdev, Eric Anholt, bcm-kernel-feedback-list,
	Nicolas Saenz Julienne, linux-arm-kernel, Stefan Wahren

As platform_get_irq() now prints an error when the interrupt does not
exist, we are getting a confusing error message in case the optional
WOL IRQ is not defined:

  bcmgenet fd58000.ethernet: IRQ index 2 not found

Fix this by using the platform_get_irq_optional().

Fixes: 7723f4c5ecdb8d83 ("driver core: platform: Add an error message to platform_get_irq*()")
Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
---
 drivers/net/ethernet/broadcom/genet/bcmgenet.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index 4f689fb..9f68ee1 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -3465,7 +3465,7 @@ static int bcmgenet_probe(struct platform_device *pdev)
 	priv = netdev_priv(dev);
 	priv->irq0 = platform_get_irq(pdev, 0);
 	priv->irq1 = platform_get_irq(pdev, 1);
-	priv->wol_irq = platform_get_irq(pdev, 2);
+	priv->wol_irq = platform_get_irq_optional(pdev, 2);
 	if (!priv->irq0 || !priv->irq1) {
 		dev_err(&pdev->dev, "can't find IRQs\n");
 		err = -EINVAL;
--
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH V3 net-next 2/7] net: bcmgenet: Fix error handling on IRQ retrieval
  2019-11-09 19:00 ` Stefan Wahren
@ 2019-11-09 19:00   ` Stefan Wahren
  -1 siblings, 0 replies; 34+ messages in thread
From: Stefan Wahren @ 2019-11-09 19:00 UTC (permalink / raw)
  To: Matthias Brugger, Matthias Brugger, David S . Miller, Florian Fainelli
  Cc: Eric Anholt, Nicolas Saenz Julienne, Doug Berger, netdev,
	bcm-kernel-feedback-list, linux-arm-kernel, Stefan Wahren

This fixes the error handling for the mandatory IRQs. There is no need
for the error message anymore, this is now handled by platform_get_irq.

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
---
 drivers/net/ethernet/broadcom/genet/bcmgenet.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index 9f68ee1..1858ff7 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -3464,13 +3464,16 @@ static int bcmgenet_probe(struct platform_device *pdev)

 	priv = netdev_priv(dev);
 	priv->irq0 = platform_get_irq(pdev, 0);
+	if (priv->irq0 < 0) {
+		err = priv->irq0;
+		goto err;
+	}
 	priv->irq1 = platform_get_irq(pdev, 1);
-	priv->wol_irq = platform_get_irq_optional(pdev, 2);
-	if (!priv->irq0 || !priv->irq1) {
-		dev_err(&pdev->dev, "can't find IRQs\n");
-		err = -EINVAL;
+	if (priv->irq1 < 0) {
+		err = priv->irq1;
 		goto err;
 	}
+	priv->wol_irq = platform_get_irq_optional(pdev, 2);

 	if (dn)
 		macaddr = of_get_mac_address(dn);
--
2.7.4


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

* [PATCH V3 net-next 2/7] net: bcmgenet: Fix error handling on IRQ retrieval
@ 2019-11-09 19:00   ` Stefan Wahren
  0 siblings, 0 replies; 34+ messages in thread
From: Stefan Wahren @ 2019-11-09 19:00 UTC (permalink / raw)
  To: Matthias Brugger, Matthias Brugger, David S . Miller, Florian Fainelli
  Cc: Doug Berger, netdev, Eric Anholt, bcm-kernel-feedback-list,
	Nicolas Saenz Julienne, linux-arm-kernel, Stefan Wahren

This fixes the error handling for the mandatory IRQs. There is no need
for the error message anymore, this is now handled by platform_get_irq.

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
---
 drivers/net/ethernet/broadcom/genet/bcmgenet.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index 9f68ee1..1858ff7 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -3464,13 +3464,16 @@ static int bcmgenet_probe(struct platform_device *pdev)

 	priv = netdev_priv(dev);
 	priv->irq0 = platform_get_irq(pdev, 0);
+	if (priv->irq0 < 0) {
+		err = priv->irq0;
+		goto err;
+	}
 	priv->irq1 = platform_get_irq(pdev, 1);
-	priv->wol_irq = platform_get_irq_optional(pdev, 2);
-	if (!priv->irq0 || !priv->irq1) {
-		dev_err(&pdev->dev, "can't find IRQs\n");
-		err = -EINVAL;
+	if (priv->irq1 < 0) {
+		err = priv->irq1;
 		goto err;
 	}
+	priv->wol_irq = platform_get_irq_optional(pdev, 2);

 	if (dn)
 		macaddr = of_get_mac_address(dn);
--
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH V3 net-next 3/7] dt-bindings: net: bcmgenet: Add BCM2711 support
  2019-11-09 19:00 ` Stefan Wahren
@ 2019-11-09 19:00   ` Stefan Wahren
  -1 siblings, 0 replies; 34+ messages in thread
From: Stefan Wahren @ 2019-11-09 19:00 UTC (permalink / raw)
  To: Matthias Brugger, Matthias Brugger, David S . Miller, Florian Fainelli
  Cc: Eric Anholt, Nicolas Saenz Julienne, Doug Berger, netdev,
	bcm-kernel-feedback-list, linux-arm-kernel, Stefan Wahren

The BCM2711 has some modifications to the GENET v5. So add this SoC
specific compatible.

Suggested-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
---
 Documentation/devicetree/bindings/net/brcm,bcmgenet.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/net/brcm,bcmgenet.txt b/Documentation/devicetree/bindings/net/brcm,bcmgenet.txt
index 3956af1..33a0d67 100644
--- a/Documentation/devicetree/bindings/net/brcm,bcmgenet.txt
+++ b/Documentation/devicetree/bindings/net/brcm,bcmgenet.txt
@@ -2,7 +2,7 @@

 Required properties:
 - compatible: should contain one of "brcm,genet-v1", "brcm,genet-v2",
-  "brcm,genet-v3", "brcm,genet-v4", "brcm,genet-v5".
+  "brcm,genet-v3", "brcm,genet-v4", "brcm,genet-v5", "brcm,bcm2711-genet-v5".
 - reg: address and length of the register set for the device
 - interrupts and/or interrupts-extended: must be two cells, the first cell
   is the general purpose interrupt line, while the second cell is the
--
2.7.4


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

* [PATCH V3 net-next 3/7] dt-bindings: net: bcmgenet: Add BCM2711 support
@ 2019-11-09 19:00   ` Stefan Wahren
  0 siblings, 0 replies; 34+ messages in thread
From: Stefan Wahren @ 2019-11-09 19:00 UTC (permalink / raw)
  To: Matthias Brugger, Matthias Brugger, David S . Miller, Florian Fainelli
  Cc: Doug Berger, netdev, Eric Anholt, bcm-kernel-feedback-list,
	Nicolas Saenz Julienne, linux-arm-kernel, Stefan Wahren

The BCM2711 has some modifications to the GENET v5. So add this SoC
specific compatible.

Suggested-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
---
 Documentation/devicetree/bindings/net/brcm,bcmgenet.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/net/brcm,bcmgenet.txt b/Documentation/devicetree/bindings/net/brcm,bcmgenet.txt
index 3956af1..33a0d67 100644
--- a/Documentation/devicetree/bindings/net/brcm,bcmgenet.txt
+++ b/Documentation/devicetree/bindings/net/brcm,bcmgenet.txt
@@ -2,7 +2,7 @@

 Required properties:
 - compatible: should contain one of "brcm,genet-v1", "brcm,genet-v2",
-  "brcm,genet-v3", "brcm,genet-v4", "brcm,genet-v5".
+  "brcm,genet-v3", "brcm,genet-v4", "brcm,genet-v5", "brcm,bcm2711-genet-v5".
 - reg: address and length of the register set for the device
 - interrupts and/or interrupts-extended: must be two cells, the first cell
   is the general purpose interrupt line, while the second cell is the
--
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH V3 net-next 4/7] net: bcmgenet: Add BCM2711 support
  2019-11-09 19:00 ` Stefan Wahren
@ 2019-11-09 19:00   ` Stefan Wahren
  -1 siblings, 0 replies; 34+ messages in thread
From: Stefan Wahren @ 2019-11-09 19:00 UTC (permalink / raw)
  To: Matthias Brugger, Matthias Brugger, David S . Miller, Florian Fainelli
  Cc: Eric Anholt, Nicolas Saenz Julienne, Doug Berger, netdev,
	bcm-kernel-feedback-list, linux-arm-kernel, Stefan Wahren

The BCM2711 needs a different maximum DMA burst length. If not set
accordingly a timeout in the transmit queue happens and no package
can be sent. So use the new compatible to derive this value.

Until now the GENET HW version was used as the platform identifier.
This doesn't work with SoC-specific modifications, so introduce a proper
platform data structure.

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
---
 drivers/net/ethernet/broadcom/genet/bcmgenet.c | 63 ++++++++++++++++++++++----
 drivers/net/ethernet/broadcom/genet/bcmgenet.h |  1 +
 2 files changed, 54 insertions(+), 10 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index 1858ff7..7c0c5d1 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -2578,7 +2578,8 @@ static int bcmgenet_init_dma(struct bcmgenet_priv *priv)
 	}

 	/* Init rDma */
-	bcmgenet_rdma_writel(priv, DMA_MAX_BURST_LENGTH, DMA_SCB_BURST_SIZE);
+	bcmgenet_rdma_writel(priv, priv->dma_max_burst_length,
+			     DMA_SCB_BURST_SIZE);

 	/* Initialize Rx queues */
 	ret = bcmgenet_init_rx_queues(priv->dev);
@@ -2591,7 +2592,8 @@ static int bcmgenet_init_dma(struct bcmgenet_priv *priv)
 	}

 	/* Init tDma */
-	bcmgenet_tdma_writel(priv, DMA_MAX_BURST_LENGTH, DMA_SCB_BURST_SIZE);
+	bcmgenet_tdma_writel(priv, priv->dma_max_burst_length,
+			     DMA_SCB_BURST_SIZE);

 	/* Initialize Tx queues */
 	bcmgenet_init_tx_queues(priv->dev);
@@ -3426,12 +3428,48 @@ static void bcmgenet_set_hw_params(struct bcmgenet_priv *priv)
 		params->words_per_bd);
 }

+struct bcmgenet_plat_data {
+	enum bcmgenet_version version;
+	u32 dma_max_burst_length;
+};
+
+static const struct bcmgenet_plat_data v1_plat_data = {
+	.version = GENET_V1,
+	.dma_max_burst_length = DMA_MAX_BURST_LENGTH,
+};
+
+static const struct bcmgenet_plat_data v2_plat_data = {
+	.version = GENET_V2,
+	.dma_max_burst_length = DMA_MAX_BURST_LENGTH,
+};
+
+static const struct bcmgenet_plat_data v3_plat_data = {
+	.version = GENET_V3,
+	.dma_max_burst_length = DMA_MAX_BURST_LENGTH,
+};
+
+static const struct bcmgenet_plat_data v4_plat_data = {
+	.version = GENET_V4,
+	.dma_max_burst_length = DMA_MAX_BURST_LENGTH,
+};
+
+static const struct bcmgenet_plat_data v5_plat_data = {
+	.version = GENET_V5,
+	.dma_max_burst_length = DMA_MAX_BURST_LENGTH,
+};
+
+static const struct bcmgenet_plat_data bcm2711_plat_data = {
+	.version = GENET_V5,
+	.dma_max_burst_length = 0x08,
+};
+
 static const struct of_device_id bcmgenet_match[] = {
-	{ .compatible = "brcm,genet-v1", .data = (void *)GENET_V1 },
-	{ .compatible = "brcm,genet-v2", .data = (void *)GENET_V2 },
-	{ .compatible = "brcm,genet-v3", .data = (void *)GENET_V3 },
-	{ .compatible = "brcm,genet-v4", .data = (void *)GENET_V4 },
-	{ .compatible = "brcm,genet-v5", .data = (void *)GENET_V5 },
+	{ .compatible = "brcm,genet-v1", .data = &v1_plat_data },
+	{ .compatible = "brcm,genet-v2", .data = &v2_plat_data },
+	{ .compatible = "brcm,genet-v3", .data = &v3_plat_data },
+	{ .compatible = "brcm,genet-v4", .data = &v4_plat_data },
+	{ .compatible = "brcm,genet-v5", .data = &v5_plat_data },
+	{ .compatible = "brcm,bcm2711-genet-v5", .data = &bcm2711_plat_data },
 	{ },
 };
 MODULE_DEVICE_TABLE(of, bcmgenet_match);
@@ -3441,6 +3479,7 @@ static int bcmgenet_probe(struct platform_device *pdev)
 	struct bcmgenet_platform_data *pd = pdev->dev.platform_data;
 	struct device_node *dn = pdev->dev.of_node;
 	const struct of_device_id *of_id = NULL;
+	const struct bcmgenet_plat_data *pdata;
 	struct bcmgenet_priv *priv;
 	struct net_device *dev;
 	const void *macaddr;
@@ -3522,10 +3561,14 @@ static int bcmgenet_probe(struct platform_device *pdev)

 	priv->dev = dev;
 	priv->pdev = pdev;
-	if (of_id)
-		priv->version = (enum bcmgenet_version)of_id->data;
-	else
+	if (of_id) {
+		pdata = of_id->data;
+		priv->version = pdata->version;
+		priv->dma_max_burst_length = pdata->dma_max_burst_length;
+	} else {
 		priv->version = pd->genet_version;
+		priv->dma_max_burst_length = DMA_MAX_BURST_LENGTH;
+	}

 	priv->clk = devm_clk_get(&priv->pdev->dev, "enet");
 	if (IS_ERR(priv->clk)) {
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.h b/drivers/net/ethernet/broadcom/genet/bcmgenet.h
index 7fbf573..1b65b73 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.h
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.h
@@ -664,6 +664,7 @@ struct bcmgenet_priv {
 	bool crc_fwd_en;

 	unsigned int dma_rx_chk_bit;
+	u32 dma_max_burst_length;

 	u32 msg_enable;

--
2.7.4


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

* [PATCH V3 net-next 4/7] net: bcmgenet: Add BCM2711 support
@ 2019-11-09 19:00   ` Stefan Wahren
  0 siblings, 0 replies; 34+ messages in thread
From: Stefan Wahren @ 2019-11-09 19:00 UTC (permalink / raw)
  To: Matthias Brugger, Matthias Brugger, David S . Miller, Florian Fainelli
  Cc: Doug Berger, netdev, Eric Anholt, bcm-kernel-feedback-list,
	Nicolas Saenz Julienne, linux-arm-kernel, Stefan Wahren

The BCM2711 needs a different maximum DMA burst length. If not set
accordingly a timeout in the transmit queue happens and no package
can be sent. So use the new compatible to derive this value.

Until now the GENET HW version was used as the platform identifier.
This doesn't work with SoC-specific modifications, so introduce a proper
platform data structure.

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
---
 drivers/net/ethernet/broadcom/genet/bcmgenet.c | 63 ++++++++++++++++++++++----
 drivers/net/ethernet/broadcom/genet/bcmgenet.h |  1 +
 2 files changed, 54 insertions(+), 10 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index 1858ff7..7c0c5d1 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -2578,7 +2578,8 @@ static int bcmgenet_init_dma(struct bcmgenet_priv *priv)
 	}

 	/* Init rDma */
-	bcmgenet_rdma_writel(priv, DMA_MAX_BURST_LENGTH, DMA_SCB_BURST_SIZE);
+	bcmgenet_rdma_writel(priv, priv->dma_max_burst_length,
+			     DMA_SCB_BURST_SIZE);

 	/* Initialize Rx queues */
 	ret = bcmgenet_init_rx_queues(priv->dev);
@@ -2591,7 +2592,8 @@ static int bcmgenet_init_dma(struct bcmgenet_priv *priv)
 	}

 	/* Init tDma */
-	bcmgenet_tdma_writel(priv, DMA_MAX_BURST_LENGTH, DMA_SCB_BURST_SIZE);
+	bcmgenet_tdma_writel(priv, priv->dma_max_burst_length,
+			     DMA_SCB_BURST_SIZE);

 	/* Initialize Tx queues */
 	bcmgenet_init_tx_queues(priv->dev);
@@ -3426,12 +3428,48 @@ static void bcmgenet_set_hw_params(struct bcmgenet_priv *priv)
 		params->words_per_bd);
 }

+struct bcmgenet_plat_data {
+	enum bcmgenet_version version;
+	u32 dma_max_burst_length;
+};
+
+static const struct bcmgenet_plat_data v1_plat_data = {
+	.version = GENET_V1,
+	.dma_max_burst_length = DMA_MAX_BURST_LENGTH,
+};
+
+static const struct bcmgenet_plat_data v2_plat_data = {
+	.version = GENET_V2,
+	.dma_max_burst_length = DMA_MAX_BURST_LENGTH,
+};
+
+static const struct bcmgenet_plat_data v3_plat_data = {
+	.version = GENET_V3,
+	.dma_max_burst_length = DMA_MAX_BURST_LENGTH,
+};
+
+static const struct bcmgenet_plat_data v4_plat_data = {
+	.version = GENET_V4,
+	.dma_max_burst_length = DMA_MAX_BURST_LENGTH,
+};
+
+static const struct bcmgenet_plat_data v5_plat_data = {
+	.version = GENET_V5,
+	.dma_max_burst_length = DMA_MAX_BURST_LENGTH,
+};
+
+static const struct bcmgenet_plat_data bcm2711_plat_data = {
+	.version = GENET_V5,
+	.dma_max_burst_length = 0x08,
+};
+
 static const struct of_device_id bcmgenet_match[] = {
-	{ .compatible = "brcm,genet-v1", .data = (void *)GENET_V1 },
-	{ .compatible = "brcm,genet-v2", .data = (void *)GENET_V2 },
-	{ .compatible = "brcm,genet-v3", .data = (void *)GENET_V3 },
-	{ .compatible = "brcm,genet-v4", .data = (void *)GENET_V4 },
-	{ .compatible = "brcm,genet-v5", .data = (void *)GENET_V5 },
+	{ .compatible = "brcm,genet-v1", .data = &v1_plat_data },
+	{ .compatible = "brcm,genet-v2", .data = &v2_plat_data },
+	{ .compatible = "brcm,genet-v3", .data = &v3_plat_data },
+	{ .compatible = "brcm,genet-v4", .data = &v4_plat_data },
+	{ .compatible = "brcm,genet-v5", .data = &v5_plat_data },
+	{ .compatible = "brcm,bcm2711-genet-v5", .data = &bcm2711_plat_data },
 	{ },
 };
 MODULE_DEVICE_TABLE(of, bcmgenet_match);
@@ -3441,6 +3479,7 @@ static int bcmgenet_probe(struct platform_device *pdev)
 	struct bcmgenet_platform_data *pd = pdev->dev.platform_data;
 	struct device_node *dn = pdev->dev.of_node;
 	const struct of_device_id *of_id = NULL;
+	const struct bcmgenet_plat_data *pdata;
 	struct bcmgenet_priv *priv;
 	struct net_device *dev;
 	const void *macaddr;
@@ -3522,10 +3561,14 @@ static int bcmgenet_probe(struct platform_device *pdev)

 	priv->dev = dev;
 	priv->pdev = pdev;
-	if (of_id)
-		priv->version = (enum bcmgenet_version)of_id->data;
-	else
+	if (of_id) {
+		pdata = of_id->data;
+		priv->version = pdata->version;
+		priv->dma_max_burst_length = pdata->dma_max_burst_length;
+	} else {
 		priv->version = pd->genet_version;
+		priv->dma_max_burst_length = DMA_MAX_BURST_LENGTH;
+	}

 	priv->clk = devm_clk_get(&priv->pdev->dev, "enet");
 	if (IS_ERR(priv->clk)) {
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.h b/drivers/net/ethernet/broadcom/genet/bcmgenet.h
index 7fbf573..1b65b73 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.h
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.h
@@ -664,6 +664,7 @@ struct bcmgenet_priv {
 	bool crc_fwd_en;

 	unsigned int dma_rx_chk_bit;
+	u32 dma_max_burst_length;

 	u32 msg_enable;

--
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH V3 net-next 5/7] net: bcmgenet: Refactor register access in bcmgenet_mii_config
  2019-11-09 19:00 ` Stefan Wahren
@ 2019-11-09 19:00   ` Stefan Wahren
  -1 siblings, 0 replies; 34+ messages in thread
From: Stefan Wahren @ 2019-11-09 19:00 UTC (permalink / raw)
  To: Matthias Brugger, Matthias Brugger, David S . Miller, Florian Fainelli
  Cc: Eric Anholt, Nicolas Saenz Julienne, Doug Berger, netdev,
	bcm-kernel-feedback-list, linux-arm-kernel, Stefan Wahren

The register access in bcmgenet_mii_config() is a little bit opaque and
not easy to extend. In preparation for the missing RGMII PHY modes
move the real register access to the end of the function. This make
the code easier to read and extend.

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
---
 drivers/net/ethernet/broadcom/genet/bcmmii.c | 41 ++++++++++++----------------
 1 file changed, 18 insertions(+), 23 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/genet/bcmmii.c b/drivers/net/ethernet/broadcom/genet/bcmmii.c
index 17bb8d6..8f7b2c0 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmmii.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmmii.c
@@ -223,9 +223,6 @@ int bcmgenet_mii_config(struct net_device *dev, bool init)
 	u32 port_ctrl;
 	u32 reg;

-	priv->ext_phy = !priv->internal_phy &&
-			(priv->phy_interface != PHY_INTERFACE_MODE_MOCA);
-
 	switch (priv->phy_interface) {
 	case PHY_INTERFACE_MODE_INTERNAL:
 	case PHY_INTERFACE_MODE_MOCA:
@@ -238,22 +235,12 @@ int bcmgenet_mii_config(struct net_device *dev, bool init)
 			port_ctrl = PORT_MODE_INT_GPHY;
 		else
 			port_ctrl = PORT_MODE_INT_EPHY;
-
-		bcmgenet_sys_writel(priv, port_ctrl, SYS_PORT_CTRL);
-
-		if (priv->internal_phy) {
-			phy_name = "internal PHY";
-		} else if (priv->phy_interface == PHY_INTERFACE_MODE_MOCA) {
-			phy_name = "MoCA";
-			bcmgenet_moca_phy_setup(priv);
-		}
 		break;

 	case PHY_INTERFACE_MODE_MII:
 		phy_name = "external MII";
 		phy_set_max_speed(phydev, SPEED_100);
-		bcmgenet_sys_writel(priv,
-				    PORT_MODE_EXT_EPHY, SYS_PORT_CTRL);
+		port_ctrl = PORT_MODE_EXT_EPHY;
 		break;

 	case PHY_INTERFACE_MODE_REVMII:
@@ -268,31 +255,34 @@ int bcmgenet_mii_config(struct net_device *dev, bool init)
 			port_ctrl = PORT_MODE_EXT_RVMII_50;
 		else
 			port_ctrl = PORT_MODE_EXT_RVMII_25;
-		bcmgenet_sys_writel(priv, port_ctrl, SYS_PORT_CTRL);
 		break;

 	case PHY_INTERFACE_MODE_RGMII:
 		/* RGMII_NO_ID: TXC transitions at the same time as TXD
 		 *		(requires PCB or receiver-side delay)
-		 * RGMII:	Add 2ns delay on TXC (90 degree shift)
 		 *
 		 * ID is implicitly disabled for 100Mbps (RG)MII operation.
 		 */
+		phy_name = "external RGMII (no delay)";
 		id_mode_dis = BIT(16);
-		/* fall through */
+		port_ctrl = PORT_MODE_EXT_GPHY;
+		break;
+
 	case PHY_INTERFACE_MODE_RGMII_TXID:
-		if (id_mode_dis)
-			phy_name = "external RGMII (no delay)";
-		else
-			phy_name = "external RGMII (TX delay)";
-		bcmgenet_sys_writel(priv,
-				    PORT_MODE_EXT_GPHY, SYS_PORT_CTRL);
+		/* RGMII_TXID:	Add 2ns delay on TXC (90 degree shift) */
+		phy_name = "external RGMII (TX delay)";
+		port_ctrl = PORT_MODE_EXT_GPHY;
 		break;
 	default:
 		dev_err(kdev, "unknown phy mode: %d\n", priv->phy_interface);
 		return -EINVAL;
 	}

+	bcmgenet_sys_writel(priv, port_ctrl, SYS_PORT_CTRL);
+
+	priv->ext_phy = !priv->internal_phy &&
+			(priv->phy_interface != PHY_INTERFACE_MODE_MOCA);
+
 	/* This is an external PHY (xMII), so we need to enable the RGMII
 	 * block for the interface to work
 	 */
@@ -304,6 +294,11 @@ int bcmgenet_mii_config(struct net_device *dev, bool init)
 		else
 			reg |= RGMII_MODE_EN;
 		bcmgenet_ext_writel(priv, reg, EXT_RGMII_OOB_CTRL);
+	} else if (priv->internal_phy) {
+		phy_name = "internal PHY";
+	} else if (priv->phy_interface == PHY_INTERFACE_MODE_MOCA) {
+		phy_name = "MoCA";
+		bcmgenet_moca_phy_setup(priv);
 	}

 	if (init) {
--
2.7.4


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

* [PATCH V3 net-next 5/7] net: bcmgenet: Refactor register access in bcmgenet_mii_config
@ 2019-11-09 19:00   ` Stefan Wahren
  0 siblings, 0 replies; 34+ messages in thread
From: Stefan Wahren @ 2019-11-09 19:00 UTC (permalink / raw)
  To: Matthias Brugger, Matthias Brugger, David S . Miller, Florian Fainelli
  Cc: Doug Berger, netdev, Eric Anholt, bcm-kernel-feedback-list,
	Nicolas Saenz Julienne, linux-arm-kernel, Stefan Wahren

The register access in bcmgenet_mii_config() is a little bit opaque and
not easy to extend. In preparation for the missing RGMII PHY modes
move the real register access to the end of the function. This make
the code easier to read and extend.

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
---
 drivers/net/ethernet/broadcom/genet/bcmmii.c | 41 ++++++++++++----------------
 1 file changed, 18 insertions(+), 23 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/genet/bcmmii.c b/drivers/net/ethernet/broadcom/genet/bcmmii.c
index 17bb8d6..8f7b2c0 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmmii.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmmii.c
@@ -223,9 +223,6 @@ int bcmgenet_mii_config(struct net_device *dev, bool init)
 	u32 port_ctrl;
 	u32 reg;

-	priv->ext_phy = !priv->internal_phy &&
-			(priv->phy_interface != PHY_INTERFACE_MODE_MOCA);
-
 	switch (priv->phy_interface) {
 	case PHY_INTERFACE_MODE_INTERNAL:
 	case PHY_INTERFACE_MODE_MOCA:
@@ -238,22 +235,12 @@ int bcmgenet_mii_config(struct net_device *dev, bool init)
 			port_ctrl = PORT_MODE_INT_GPHY;
 		else
 			port_ctrl = PORT_MODE_INT_EPHY;
-
-		bcmgenet_sys_writel(priv, port_ctrl, SYS_PORT_CTRL);
-
-		if (priv->internal_phy) {
-			phy_name = "internal PHY";
-		} else if (priv->phy_interface == PHY_INTERFACE_MODE_MOCA) {
-			phy_name = "MoCA";
-			bcmgenet_moca_phy_setup(priv);
-		}
 		break;

 	case PHY_INTERFACE_MODE_MII:
 		phy_name = "external MII";
 		phy_set_max_speed(phydev, SPEED_100);
-		bcmgenet_sys_writel(priv,
-				    PORT_MODE_EXT_EPHY, SYS_PORT_CTRL);
+		port_ctrl = PORT_MODE_EXT_EPHY;
 		break;

 	case PHY_INTERFACE_MODE_REVMII:
@@ -268,31 +255,34 @@ int bcmgenet_mii_config(struct net_device *dev, bool init)
 			port_ctrl = PORT_MODE_EXT_RVMII_50;
 		else
 			port_ctrl = PORT_MODE_EXT_RVMII_25;
-		bcmgenet_sys_writel(priv, port_ctrl, SYS_PORT_CTRL);
 		break;

 	case PHY_INTERFACE_MODE_RGMII:
 		/* RGMII_NO_ID: TXC transitions at the same time as TXD
 		 *		(requires PCB or receiver-side delay)
-		 * RGMII:	Add 2ns delay on TXC (90 degree shift)
 		 *
 		 * ID is implicitly disabled for 100Mbps (RG)MII operation.
 		 */
+		phy_name = "external RGMII (no delay)";
 		id_mode_dis = BIT(16);
-		/* fall through */
+		port_ctrl = PORT_MODE_EXT_GPHY;
+		break;
+
 	case PHY_INTERFACE_MODE_RGMII_TXID:
-		if (id_mode_dis)
-			phy_name = "external RGMII (no delay)";
-		else
-			phy_name = "external RGMII (TX delay)";
-		bcmgenet_sys_writel(priv,
-				    PORT_MODE_EXT_GPHY, SYS_PORT_CTRL);
+		/* RGMII_TXID:	Add 2ns delay on TXC (90 degree shift) */
+		phy_name = "external RGMII (TX delay)";
+		port_ctrl = PORT_MODE_EXT_GPHY;
 		break;
 	default:
 		dev_err(kdev, "unknown phy mode: %d\n", priv->phy_interface);
 		return -EINVAL;
 	}

+	bcmgenet_sys_writel(priv, port_ctrl, SYS_PORT_CTRL);
+
+	priv->ext_phy = !priv->internal_phy &&
+			(priv->phy_interface != PHY_INTERFACE_MODE_MOCA);
+
 	/* This is an external PHY (xMII), so we need to enable the RGMII
 	 * block for the interface to work
 	 */
@@ -304,6 +294,11 @@ int bcmgenet_mii_config(struct net_device *dev, bool init)
 		else
 			reg |= RGMII_MODE_EN;
 		bcmgenet_ext_writel(priv, reg, EXT_RGMII_OOB_CTRL);
+	} else if (priv->internal_phy) {
+		phy_name = "internal PHY";
+	} else if (priv->phy_interface == PHY_INTERFACE_MODE_MOCA) {
+		phy_name = "MoCA";
+		bcmgenet_moca_phy_setup(priv);
 	}

 	if (init) {
--
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH V3 net-next 6/7] net: bcmgenet: Add RGMII_RXID and RGMII_ID support
  2019-11-09 19:00 ` Stefan Wahren
@ 2019-11-09 19:00   ` Stefan Wahren
  -1 siblings, 0 replies; 34+ messages in thread
From: Stefan Wahren @ 2019-11-09 19:00 UTC (permalink / raw)
  To: Matthias Brugger, Matthias Brugger, David S . Miller, Florian Fainelli
  Cc: Eric Anholt, Nicolas Saenz Julienne, Doug Berger, netdev,
	bcm-kernel-feedback-list, linux-arm-kernel, Stefan Wahren

This adds the missing support for the PHY modes RGMII_RXID and
RGMII_ID. Based on the used register settings in the downstream tree
the mode RGMII_RXID is necessary for the Raspberry Pi 4.

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
---
 drivers/net/ethernet/broadcom/genet/bcmmii.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/net/ethernet/broadcom/genet/bcmmii.c b/drivers/net/ethernet/broadcom/genet/bcmmii.c
index 8f7b2c0..9091e5b 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmmii.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmmii.c
@@ -273,6 +273,16 @@ int bcmgenet_mii_config(struct net_device *dev, bool init)
 		phy_name = "external RGMII (TX delay)";
 		port_ctrl = PORT_MODE_EXT_GPHY;
 		break;
+
+	case PHY_INTERFACE_MODE_RGMII_RXID:
+		phy_name = "external RGMII (RX delay)";
+		port_ctrl = PORT_MODE_EXT_GPHY;
+		break;
+
+	case PHY_INTERFACE_MODE_RGMII_ID:
+		phy_name = "external RGMII (RX/TX delay)";
+		port_ctrl = PORT_MODE_EXT_GPHY;
+		break;
 	default:
 		dev_err(kdev, "unknown phy mode: %d\n", priv->phy_interface);
 		return -EINVAL;
--
2.7.4


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

* [PATCH V3 net-next 6/7] net: bcmgenet: Add RGMII_RXID and RGMII_ID support
@ 2019-11-09 19:00   ` Stefan Wahren
  0 siblings, 0 replies; 34+ messages in thread
From: Stefan Wahren @ 2019-11-09 19:00 UTC (permalink / raw)
  To: Matthias Brugger, Matthias Brugger, David S . Miller, Florian Fainelli
  Cc: Doug Berger, netdev, Eric Anholt, bcm-kernel-feedback-list,
	Nicolas Saenz Julienne, linux-arm-kernel, Stefan Wahren

This adds the missing support for the PHY modes RGMII_RXID and
RGMII_ID. Based on the used register settings in the downstream tree
the mode RGMII_RXID is necessary for the Raspberry Pi 4.

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
---
 drivers/net/ethernet/broadcom/genet/bcmmii.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/net/ethernet/broadcom/genet/bcmmii.c b/drivers/net/ethernet/broadcom/genet/bcmmii.c
index 8f7b2c0..9091e5b 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmmii.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmmii.c
@@ -273,6 +273,16 @@ int bcmgenet_mii_config(struct net_device *dev, bool init)
 		phy_name = "external RGMII (TX delay)";
 		port_ctrl = PORT_MODE_EXT_GPHY;
 		break;
+
+	case PHY_INTERFACE_MODE_RGMII_RXID:
+		phy_name = "external RGMII (RX delay)";
+		port_ctrl = PORT_MODE_EXT_GPHY;
+		break;
+
+	case PHY_INTERFACE_MODE_RGMII_ID:
+		phy_name = "external RGMII (RX/TX delay)";
+		port_ctrl = PORT_MODE_EXT_GPHY;
+		break;
 	default:
 		dev_err(kdev, "unknown phy mode: %d\n", priv->phy_interface);
 		return -EINVAL;
--
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH V3 net-next 7/7] ARM: dts: bcm2711-rpi-4: Enable GENET support
  2019-11-09 19:00 ` Stefan Wahren
@ 2019-11-09 19:00   ` Stefan Wahren
  -1 siblings, 0 replies; 34+ messages in thread
From: Stefan Wahren @ 2019-11-09 19:00 UTC (permalink / raw)
  To: Matthias Brugger, Matthias Brugger, David S . Miller, Florian Fainelli
  Cc: Eric Anholt, Nicolas Saenz Julienne, Doug Berger, netdev,
	bcm-kernel-feedback-list, linux-arm-kernel, Stefan Wahren

This enables the Gigabit Ethernet support on the Raspberry Pi 4.
The defined PHY mode is equivalent to the default register settings
in the downstream tree.

Signed-off-by: Matthias Brugger <mbrugger@suse.com>
Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
---
 arch/arm/boot/dts/bcm2711-rpi-4-b.dts | 17 +++++++++++++++++
 arch/arm/boot/dts/bcm2711.dtsi        | 26 ++++++++++++++++++++++++++
 2 files changed, 43 insertions(+)

diff --git a/arch/arm/boot/dts/bcm2711-rpi-4-b.dts b/arch/arm/boot/dts/bcm2711-rpi-4-b.dts
index cccc1cc..1b5a835 100644
--- a/arch/arm/boot/dts/bcm2711-rpi-4-b.dts
+++ b/arch/arm/boot/dts/bcm2711-rpi-4-b.dts
@@ -19,6 +19,10 @@
 		reg = <0 0 0>;
 	};

+	aliases {
+		ethernet0 = &genet;
+	};
+
 	leds {
 		act {
 			gpios = <&gpio 42 GPIO_ACTIVE_HIGH>;
@@ -97,6 +101,19 @@
 	status = "okay";
 };

+&genet {
+	phy-handle = <&phy1>;
+	phy-mode = "rgmii-rxid";
+	status = "okay";
+};
+
+&genet_mdio {
+	phy1: ethernet-phy@1 {
+		/* No PHY interrupt */
+		reg = <0x1>;
+	};
+};
+
 /* uart0 communicates with the BT module */
 &uart0 {
 	pinctrl-names = "default";
diff --git a/arch/arm/boot/dts/bcm2711.dtsi b/arch/arm/boot/dts/bcm2711.dtsi
index ac83dac..a571223 100644
--- a/arch/arm/boot/dts/bcm2711.dtsi
+++ b/arch/arm/boot/dts/bcm2711.dtsi
@@ -305,6 +305,32 @@
 			cpu-release-addr = <0x0 0x000000f0>;
 		};
 	};
+
+	scb {
+		compatible = "simple-bus";
+		#address-cells = <2>;
+		#size-cells = <1>;
+
+		ranges = <0x0 0x7c000000  0x0 0xfc000000  0x03800000>;
+
+		genet: ethernet@7d580000 {
+			compatible = "brcm,bcm2711-genet-v5";
+			reg = <0x0 0x7d580000 0x10000>;
+			#address-cells = <0x1>;
+			#size-cells = <0x1>;
+			interrupts = <GIC_SPI 157 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_SPI 158 IRQ_TYPE_LEVEL_HIGH>;
+			status = "disabled";
+
+			genet_mdio: mdio@e14 {
+				compatible = "brcm,genet-mdio-v5";
+				reg = <0xe14 0x8>;
+				reg-names = "mdio";
+				#address-cells = <0x0>;
+				#size-cells = <0x1>;
+			};
+		};
+	};
 };

 &clk_osc {
--
2.7.4


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

* [PATCH V3 net-next 7/7] ARM: dts: bcm2711-rpi-4: Enable GENET support
@ 2019-11-09 19:00   ` Stefan Wahren
  0 siblings, 0 replies; 34+ messages in thread
From: Stefan Wahren @ 2019-11-09 19:00 UTC (permalink / raw)
  To: Matthias Brugger, Matthias Brugger, David S . Miller, Florian Fainelli
  Cc: Doug Berger, netdev, Eric Anholt, bcm-kernel-feedback-list,
	Nicolas Saenz Julienne, linux-arm-kernel, Stefan Wahren

This enables the Gigabit Ethernet support on the Raspberry Pi 4.
The defined PHY mode is equivalent to the default register settings
in the downstream tree.

Signed-off-by: Matthias Brugger <mbrugger@suse.com>
Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
---
 arch/arm/boot/dts/bcm2711-rpi-4-b.dts | 17 +++++++++++++++++
 arch/arm/boot/dts/bcm2711.dtsi        | 26 ++++++++++++++++++++++++++
 2 files changed, 43 insertions(+)

diff --git a/arch/arm/boot/dts/bcm2711-rpi-4-b.dts b/arch/arm/boot/dts/bcm2711-rpi-4-b.dts
index cccc1cc..1b5a835 100644
--- a/arch/arm/boot/dts/bcm2711-rpi-4-b.dts
+++ b/arch/arm/boot/dts/bcm2711-rpi-4-b.dts
@@ -19,6 +19,10 @@
 		reg = <0 0 0>;
 	};

+	aliases {
+		ethernet0 = &genet;
+	};
+
 	leds {
 		act {
 			gpios = <&gpio 42 GPIO_ACTIVE_HIGH>;
@@ -97,6 +101,19 @@
 	status = "okay";
 };

+&genet {
+	phy-handle = <&phy1>;
+	phy-mode = "rgmii-rxid";
+	status = "okay";
+};
+
+&genet_mdio {
+	phy1: ethernet-phy@1 {
+		/* No PHY interrupt */
+		reg = <0x1>;
+	};
+};
+
 /* uart0 communicates with the BT module */
 &uart0 {
 	pinctrl-names = "default";
diff --git a/arch/arm/boot/dts/bcm2711.dtsi b/arch/arm/boot/dts/bcm2711.dtsi
index ac83dac..a571223 100644
--- a/arch/arm/boot/dts/bcm2711.dtsi
+++ b/arch/arm/boot/dts/bcm2711.dtsi
@@ -305,6 +305,32 @@
 			cpu-release-addr = <0x0 0x000000f0>;
 		};
 	};
+
+	scb {
+		compatible = "simple-bus";
+		#address-cells = <2>;
+		#size-cells = <1>;
+
+		ranges = <0x0 0x7c000000  0x0 0xfc000000  0x03800000>;
+
+		genet: ethernet@7d580000 {
+			compatible = "brcm,bcm2711-genet-v5";
+			reg = <0x0 0x7d580000 0x10000>;
+			#address-cells = <0x1>;
+			#size-cells = <0x1>;
+			interrupts = <GIC_SPI 157 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_SPI 158 IRQ_TYPE_LEVEL_HIGH>;
+			status = "disabled";
+
+			genet_mdio: mdio@e14 {
+				compatible = "brcm,genet-mdio-v5";
+				reg = <0xe14 0x8>;
+				reg-names = "mdio";
+				#address-cells = <0x0>;
+				#size-cells = <0x1>;
+			};
+		};
+	};
 };

 &clk_osc {
--
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH V3 net-next 3/7] dt-bindings: net: bcmgenet: Add BCM2711 support
  2019-11-09 19:00   ` Stefan Wahren
@ 2019-11-10 20:23     ` Florian Fainelli
  -1 siblings, 0 replies; 34+ messages in thread
From: Florian Fainelli @ 2019-11-10 20:23 UTC (permalink / raw)
  To: Stefan Wahren, Matthias Brugger, Matthias Brugger,
	David S . Miller, Florian Fainelli
  Cc: Eric Anholt, Nicolas Saenz Julienne, Doug Berger, netdev,
	bcm-kernel-feedback-list, linux-arm-kernel



On 11/9/2019 11:00 AM, Stefan Wahren wrote:
> The BCM2711 has some modifications to the GENET v5. So add this SoC
> specific compatible.
> 
> Suggested-by: Florian Fainelli <f.fainelli@gmail.com>
> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

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

* Re: [PATCH V3 net-next 3/7] dt-bindings: net: bcmgenet: Add BCM2711 support
@ 2019-11-10 20:23     ` Florian Fainelli
  0 siblings, 0 replies; 34+ messages in thread
From: Florian Fainelli @ 2019-11-10 20:23 UTC (permalink / raw)
  To: Stefan Wahren, Matthias Brugger, Matthias Brugger,
	David S . Miller, Florian Fainelli
  Cc: Doug Berger, netdev, Eric Anholt, bcm-kernel-feedback-list,
	Nicolas Saenz Julienne, linux-arm-kernel



On 11/9/2019 11:00 AM, Stefan Wahren wrote:
> The BCM2711 has some modifications to the GENET v5. So add this SoC
> specific compatible.
> 
> Suggested-by: Florian Fainelli <f.fainelli@gmail.com>
> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH V3 net-next 1/7] net: bcmgenet: Avoid touching non-existent interrupt
  2019-11-09 19:00   ` Stefan Wahren
@ 2019-11-10 20:23     ` Florian Fainelli
  -1 siblings, 0 replies; 34+ messages in thread
From: Florian Fainelli @ 2019-11-10 20:23 UTC (permalink / raw)
  To: Stefan Wahren, Matthias Brugger, Matthias Brugger,
	David S . Miller, Florian Fainelli
  Cc: Eric Anholt, Nicolas Saenz Julienne, Doug Berger, netdev,
	bcm-kernel-feedback-list, linux-arm-kernel



On 11/9/2019 11:00 AM, Stefan Wahren wrote:
> As platform_get_irq() now prints an error when the interrupt does not
> exist, we are getting a confusing error message in case the optional
> WOL IRQ is not defined:
> 
>   bcmgenet fd58000.ethernet: IRQ index 2 not found
> 
> Fix this by using the platform_get_irq_optional().
> 
> Fixes: 7723f4c5ecdb8d83 ("driver core: platform: Add an error message to platform_get_irq*()")
> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>

I still don't think this warrant a Fixes tag, as this is not a bug
per-se, just a minor annoyance:

Acked-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

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

* Re: [PATCH V3 net-next 1/7] net: bcmgenet: Avoid touching non-existent interrupt
@ 2019-11-10 20:23     ` Florian Fainelli
  0 siblings, 0 replies; 34+ messages in thread
From: Florian Fainelli @ 2019-11-10 20:23 UTC (permalink / raw)
  To: Stefan Wahren, Matthias Brugger, Matthias Brugger,
	David S . Miller, Florian Fainelli
  Cc: Doug Berger, netdev, Eric Anholt, bcm-kernel-feedback-list,
	Nicolas Saenz Julienne, linux-arm-kernel



On 11/9/2019 11:00 AM, Stefan Wahren wrote:
> As platform_get_irq() now prints an error when the interrupt does not
> exist, we are getting a confusing error message in case the optional
> WOL IRQ is not defined:
> 
>   bcmgenet fd58000.ethernet: IRQ index 2 not found
> 
> Fix this by using the platform_get_irq_optional().
> 
> Fixes: 7723f4c5ecdb8d83 ("driver core: platform: Add an error message to platform_get_irq*()")
> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>

I still don't think this warrant a Fixes tag, as this is not a bug
per-se, just a minor annoyance:

Acked-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH V3 net-next 2/7] net: bcmgenet: Fix error handling on IRQ retrieval
  2019-11-09 19:00   ` Stefan Wahren
@ 2019-11-10 20:24     ` Florian Fainelli
  -1 siblings, 0 replies; 34+ messages in thread
From: Florian Fainelli @ 2019-11-10 20:24 UTC (permalink / raw)
  To: Stefan Wahren, Matthias Brugger, Matthias Brugger,
	David S . Miller, Florian Fainelli
  Cc: Eric Anholt, Nicolas Saenz Julienne, Doug Berger, netdev,
	bcm-kernel-feedback-list, linux-arm-kernel



On 11/9/2019 11:00 AM, Stefan Wahren wrote:
> This fixes the error handling for the mandatory IRQs. There is no need
> for the error message anymore, this is now handled by platform_get_irq.
> 
> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>

Acked-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

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

* Re: [PATCH V3 net-next 2/7] net: bcmgenet: Fix error handling on IRQ retrieval
@ 2019-11-10 20:24     ` Florian Fainelli
  0 siblings, 0 replies; 34+ messages in thread
From: Florian Fainelli @ 2019-11-10 20:24 UTC (permalink / raw)
  To: Stefan Wahren, Matthias Brugger, Matthias Brugger,
	David S . Miller, Florian Fainelli
  Cc: Doug Berger, netdev, Eric Anholt, bcm-kernel-feedback-list,
	Nicolas Saenz Julienne, linux-arm-kernel



On 11/9/2019 11:00 AM, Stefan Wahren wrote:
> This fixes the error handling for the mandatory IRQs. There is no need
> for the error message anymore, this is now handled by platform_get_irq.
> 
> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>

Acked-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH V3 net-next 4/7] net: bcmgenet: Add BCM2711 support
  2019-11-09 19:00   ` Stefan Wahren
@ 2019-11-10 20:26     ` Florian Fainelli
  -1 siblings, 0 replies; 34+ messages in thread
From: Florian Fainelli @ 2019-11-10 20:26 UTC (permalink / raw)
  To: Stefan Wahren, Matthias Brugger, Matthias Brugger,
	David S . Miller, Florian Fainelli
  Cc: Eric Anholt, Nicolas Saenz Julienne, Doug Berger, netdev,
	bcm-kernel-feedback-list, linux-arm-kernel



On 11/9/2019 11:00 AM, Stefan Wahren wrote:
> The BCM2711 needs a different maximum DMA burst length. If not set
> accordingly a timeout in the transmit queue happens and no package
> can be sent. So use the new compatible to derive this value.
> 
> Until now the GENET HW version was used as the platform identifier.
> This doesn't work with SoC-specific modifications, so introduce a proper
> platform data structure.
> 
> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>

Acked-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

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

* Re: [PATCH V3 net-next 4/7] net: bcmgenet: Add BCM2711 support
@ 2019-11-10 20:26     ` Florian Fainelli
  0 siblings, 0 replies; 34+ messages in thread
From: Florian Fainelli @ 2019-11-10 20:26 UTC (permalink / raw)
  To: Stefan Wahren, Matthias Brugger, Matthias Brugger,
	David S . Miller, Florian Fainelli
  Cc: Doug Berger, netdev, Eric Anholt, bcm-kernel-feedback-list,
	Nicolas Saenz Julienne, linux-arm-kernel



On 11/9/2019 11:00 AM, Stefan Wahren wrote:
> The BCM2711 needs a different maximum DMA burst length. If not set
> accordingly a timeout in the transmit queue happens and no package
> can be sent. So use the new compatible to derive this value.
> 
> Until now the GENET HW version was used as the platform identifier.
> This doesn't work with SoC-specific modifications, so introduce a proper
> platform data structure.
> 
> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>

Acked-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH V3 net-next 0/7] ARM: Enable GENET support for RPi 4
  2019-11-09 19:00 ` Stefan Wahren
@ 2019-11-10 20:26   ` Florian Fainelli
  -1 siblings, 0 replies; 34+ messages in thread
From: Florian Fainelli @ 2019-11-10 20:26 UTC (permalink / raw)
  To: Stefan Wahren, Matthias Brugger, Matthias Brugger,
	David S . Miller, Florian Fainelli
  Cc: Eric Anholt, Nicolas Saenz Julienne, Doug Berger, netdev,
	bcm-kernel-feedback-list, linux-arm-kernel

Hi David,

On 11/9/2019 11:00 AM, Stefan Wahren wrote:
> Raspberry Pi 4 uses the broadcom genet chip in version five.
> This chip has a dma controller integrated. Up to now the maximal
> burst size was hard-coded to 0x10. But it turns out that Raspberry Pi 4
> does only work with the smaller maximal burst size of 0x8.
> 
> This series based on Matthias Brugger's V1 series [1].
> 
> [1] - https://patchwork.kernel.org/cover/11186193/
> 
> Changes in V3:
> - introduce SoC-specific compatibles for GENET (incl. dt-binding)
> - use platform_get_irq_optional for optional IRQ
> - remove Fixes tag from IRQ error handling change
> - move most of MDIO stuff to bcm2711.dtsi
> 
> Changes in V2:
> - add 2 fixes for IRQ retrieval
> - add support for missing PHY modes
> - declare PHY mode RGMII RXID based on the default settings
> - add alias to allow firmware append the MAC address

Do you want to merge patches 1-6 through net-next and I will take patch
7 through the Broadcom ARM SoC pull request since this depends on the
Device Tree files being present?

> 
> Stefan Wahren (7):
>   net: bcmgenet: Avoid touching non-existent interrupt
>   net: bcmgenet: Fix error handling on IRQ retrieval
>   dt-bindings: net: bcmgenet: Add BCM2711 support
>   net: bcmgenet: Add BCM2711 support
>   net: bcmgenet: Refactor register access in bcmgenet_mii_config
>   net: bcmgenet: Add RGMII_RXID and RGMII_ID support
>   ARM: dts: bcm2711-rpi-4: Enable GENET support
> 
>  .../devicetree/bindings/net/brcm,bcmgenet.txt      |  2 +-
>  arch/arm/boot/dts/bcm2711-rpi-4-b.dts              | 17 +++++
>  arch/arm/boot/dts/bcm2711.dtsi                     | 26 ++++++++
>  drivers/net/ethernet/broadcom/genet/bcmgenet.c     | 74 ++++++++++++++++++----
>  drivers/net/ethernet/broadcom/genet/bcmgenet.h     |  1 +
>  drivers/net/ethernet/broadcom/genet/bcmmii.c       | 51 ++++++++-------
>  6 files changed, 133 insertions(+), 38 deletions(-)
> 
> --
> 2.7.4
> 

-- 
Florian

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

* Re: [PATCH V3 net-next 0/7] ARM: Enable GENET support for RPi 4
@ 2019-11-10 20:26   ` Florian Fainelli
  0 siblings, 0 replies; 34+ messages in thread
From: Florian Fainelli @ 2019-11-10 20:26 UTC (permalink / raw)
  To: Stefan Wahren, Matthias Brugger, Matthias Brugger,
	David S . Miller, Florian Fainelli
  Cc: Doug Berger, netdev, Eric Anholt, bcm-kernel-feedback-list,
	Nicolas Saenz Julienne, linux-arm-kernel

Hi David,

On 11/9/2019 11:00 AM, Stefan Wahren wrote:
> Raspberry Pi 4 uses the broadcom genet chip in version five.
> This chip has a dma controller integrated. Up to now the maximal
> burst size was hard-coded to 0x10. But it turns out that Raspberry Pi 4
> does only work with the smaller maximal burst size of 0x8.
> 
> This series based on Matthias Brugger's V1 series [1].
> 
> [1] - https://patchwork.kernel.org/cover/11186193/
> 
> Changes in V3:
> - introduce SoC-specific compatibles for GENET (incl. dt-binding)
> - use platform_get_irq_optional for optional IRQ
> - remove Fixes tag from IRQ error handling change
> - move most of MDIO stuff to bcm2711.dtsi
> 
> Changes in V2:
> - add 2 fixes for IRQ retrieval
> - add support for missing PHY modes
> - declare PHY mode RGMII RXID based on the default settings
> - add alias to allow firmware append the MAC address

Do you want to merge patches 1-6 through net-next and I will take patch
7 through the Broadcom ARM SoC pull request since this depends on the
Device Tree files being present?

> 
> Stefan Wahren (7):
>   net: bcmgenet: Avoid touching non-existent interrupt
>   net: bcmgenet: Fix error handling on IRQ retrieval
>   dt-bindings: net: bcmgenet: Add BCM2711 support
>   net: bcmgenet: Add BCM2711 support
>   net: bcmgenet: Refactor register access in bcmgenet_mii_config
>   net: bcmgenet: Add RGMII_RXID and RGMII_ID support
>   ARM: dts: bcm2711-rpi-4: Enable GENET support
> 
>  .../devicetree/bindings/net/brcm,bcmgenet.txt      |  2 +-
>  arch/arm/boot/dts/bcm2711-rpi-4-b.dts              | 17 +++++
>  arch/arm/boot/dts/bcm2711.dtsi                     | 26 ++++++++
>  drivers/net/ethernet/broadcom/genet/bcmgenet.c     | 74 ++++++++++++++++++----
>  drivers/net/ethernet/broadcom/genet/bcmgenet.h     |  1 +
>  drivers/net/ethernet/broadcom/genet/bcmmii.c       | 51 ++++++++-------
>  6 files changed, 133 insertions(+), 38 deletions(-)
> 
> --
> 2.7.4
> 

-- 
Florian

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH V3 net-next 6/7] net: bcmgenet: Add RGMII_RXID and RGMII_ID support
  2019-11-09 19:00   ` Stefan Wahren
@ 2019-11-10 20:32     ` Florian Fainelli
  -1 siblings, 0 replies; 34+ messages in thread
From: Florian Fainelli @ 2019-11-10 20:32 UTC (permalink / raw)
  To: Stefan Wahren, Matthias Brugger, Matthias Brugger,
	David S . Miller, Florian Fainelli
  Cc: Eric Anholt, Nicolas Saenz Julienne, Doug Berger, netdev,
	bcm-kernel-feedback-list, linux-arm-kernel



On 11/9/2019 11:00 AM, Stefan Wahren wrote:
> This adds the missing support for the PHY modes RGMII_RXID and
> RGMII_ID. Based on the used register settings in the downstream tree
> the mode RGMII_RXID is necessary for the Raspberry Pi 4.
> 
> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>

Acked-by: Florian Fainelli <f.fainelli@gmail.com>

> ---
>  drivers/net/ethernet/broadcom/genet/bcmmii.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/net/ethernet/broadcom/genet/bcmmii.c b/drivers/net/ethernet/broadcom/genet/bcmmii.c
> index 8f7b2c0..9091e5b 100644
> --- a/drivers/net/ethernet/broadcom/genet/bcmmii.c
> +++ b/drivers/net/ethernet/broadcom/genet/bcmmii.c
> @@ -273,6 +273,16 @@ int bcmgenet_mii_config(struct net_device *dev, bool init)
>  		phy_name = "external RGMII (TX delay)";
>  		port_ctrl = PORT_MODE_EXT_GPHY;
>  		break;
> +
> +	case PHY_INTERFACE_MODE_RGMII_RXID:
> +		phy_name = "external RGMII (RX delay)";
> +		port_ctrl = PORT_MODE_EXT_GPHY;
> +		break;
> +
> +	case PHY_INTERFACE_MODE_RGMII_ID:
> +		phy_name = "external RGMII (RX/TX delay)";
> +		port_ctrl = PORT_MODE_EXT_GPHY;
> +		break;

Technically for this one we should probably make sure that we do set
id_mode_dis in order for the MAC not to add the delay and leave the PHY
to do it though I don't have such a configuration handy to
prove/disprove that is necessary.
-- 
Florian

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

* Re: [PATCH V3 net-next 6/7] net: bcmgenet: Add RGMII_RXID and RGMII_ID support
@ 2019-11-10 20:32     ` Florian Fainelli
  0 siblings, 0 replies; 34+ messages in thread
From: Florian Fainelli @ 2019-11-10 20:32 UTC (permalink / raw)
  To: Stefan Wahren, Matthias Brugger, Matthias Brugger,
	David S . Miller, Florian Fainelli
  Cc: Doug Berger, netdev, Eric Anholt, bcm-kernel-feedback-list,
	Nicolas Saenz Julienne, linux-arm-kernel



On 11/9/2019 11:00 AM, Stefan Wahren wrote:
> This adds the missing support for the PHY modes RGMII_RXID and
> RGMII_ID. Based on the used register settings in the downstream tree
> the mode RGMII_RXID is necessary for the Raspberry Pi 4.
> 
> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>

Acked-by: Florian Fainelli <f.fainelli@gmail.com>

> ---
>  drivers/net/ethernet/broadcom/genet/bcmmii.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/net/ethernet/broadcom/genet/bcmmii.c b/drivers/net/ethernet/broadcom/genet/bcmmii.c
> index 8f7b2c0..9091e5b 100644
> --- a/drivers/net/ethernet/broadcom/genet/bcmmii.c
> +++ b/drivers/net/ethernet/broadcom/genet/bcmmii.c
> @@ -273,6 +273,16 @@ int bcmgenet_mii_config(struct net_device *dev, bool init)
>  		phy_name = "external RGMII (TX delay)";
>  		port_ctrl = PORT_MODE_EXT_GPHY;
>  		break;
> +
> +	case PHY_INTERFACE_MODE_RGMII_RXID:
> +		phy_name = "external RGMII (RX delay)";
> +		port_ctrl = PORT_MODE_EXT_GPHY;
> +		break;
> +
> +	case PHY_INTERFACE_MODE_RGMII_ID:
> +		phy_name = "external RGMII (RX/TX delay)";
> +		port_ctrl = PORT_MODE_EXT_GPHY;
> +		break;

Technically for this one we should probably make sure that we do set
id_mode_dis in order for the MAC not to add the delay and leave the PHY
to do it though I don't have such a configuration handy to
prove/disprove that is necessary.
-- 
Florian

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH V3 net-next 5/7] net: bcmgenet: Refactor register access in bcmgenet_mii_config
  2019-11-09 19:00   ` Stefan Wahren
@ 2019-11-10 20:34     ` Florian Fainelli
  -1 siblings, 0 replies; 34+ messages in thread
From: Florian Fainelli @ 2019-11-10 20:34 UTC (permalink / raw)
  To: Stefan Wahren, Matthias Brugger, Matthias Brugger,
	David S . Miller, Florian Fainelli
  Cc: Eric Anholt, Nicolas Saenz Julienne, Doug Berger, netdev,
	bcm-kernel-feedback-list, linux-arm-kernel



On 11/9/2019 11:00 AM, Stefan Wahren wrote:
> The register access in bcmgenet_mii_config() is a little bit opaque and
> not easy to extend. In preparation for the missing RGMII PHY modes
> move the real register access to the end of the function. This make
> the code easier to read and extend.
> 
> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>

You will most likely have to resubmit this patch series after Doug's
recent GENET changes:

https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git/commit/drivers/net/ethernet/broadcom/genet?id=3a55402c93877d291b0a612d25edb03d1b4b93ac
https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git/commit/drivers/net/ethernet/broadcom/genet?id=6b6d017fccb4693767d2fcae9ef2fd05243748bb
https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git/commit/drivers/net/ethernet/broadcom/genet?id=0686bd9d5e6863f60e4bb1e78e6fe7bb217a0890

And while you are at it with this patch, you may even take a step
further and do something like this for the INTERNAL and MOCA PHYs:

diff --git a/drivers/net/ethernet/broadcom/genet/bcmmii.c
b/drivers/net/ethernet/broadcom/genet/bcmmii.c
index dbe18cdf6c1b..e363a824d662 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmmii.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmmii.c
@@ -218,6 +218,7 @@ int bcmgenet_mii_config(struct net_device *dev, bool
init)

        switch (priv->phy_interface) {
        case PHY_INTERFACE_MODE_INTERNAL:
+               phy_name = "internal PHY";
        case PHY_INTERFACE_MODE_MOCA:
                /* Irrespective of the actually configured PHY speed (100 or
                 * 1000) GENETv4 only has an internal GPHY so we will
just end
@@ -229,14 +230,8 @@ int bcmgenet_mii_config(struct net_device *dev,
bool init)
                else
                        port_ctrl = PORT_MODE_INT_EPHY;

-               bcmgenet_sys_writel(priv, port_ctrl, SYS_PORT_CTRL);
-
-               if (priv->internal_phy) {
-                       phy_name = "internal PHY";
-               } else if (priv->phy_interface == PHY_INTERFACE_MODE_MOCA) {
+               if (!phy_name)
                        phy_name = "MoCA";
-                       bcmgenet_moca_phy_setup(priv);
-               }
                break;

such that all the port_ctrl and the phy_name are set within the same
location and the register write/configuration is done after the mode has
been determined.
-- 
Florian

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

* Re: [PATCH V3 net-next 5/7] net: bcmgenet: Refactor register access in bcmgenet_mii_config
@ 2019-11-10 20:34     ` Florian Fainelli
  0 siblings, 0 replies; 34+ messages in thread
From: Florian Fainelli @ 2019-11-10 20:34 UTC (permalink / raw)
  To: Stefan Wahren, Matthias Brugger, Matthias Brugger,
	David S . Miller, Florian Fainelli
  Cc: Doug Berger, netdev, Eric Anholt, bcm-kernel-feedback-list,
	Nicolas Saenz Julienne, linux-arm-kernel



On 11/9/2019 11:00 AM, Stefan Wahren wrote:
> The register access in bcmgenet_mii_config() is a little bit opaque and
> not easy to extend. In preparation for the missing RGMII PHY modes
> move the real register access to the end of the function. This make
> the code easier to read and extend.
> 
> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>

You will most likely have to resubmit this patch series after Doug's
recent GENET changes:

https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git/commit/drivers/net/ethernet/broadcom/genet?id=3a55402c93877d291b0a612d25edb03d1b4b93ac
https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git/commit/drivers/net/ethernet/broadcom/genet?id=6b6d017fccb4693767d2fcae9ef2fd05243748bb
https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git/commit/drivers/net/ethernet/broadcom/genet?id=0686bd9d5e6863f60e4bb1e78e6fe7bb217a0890

And while you are at it with this patch, you may even take a step
further and do something like this for the INTERNAL and MOCA PHYs:

diff --git a/drivers/net/ethernet/broadcom/genet/bcmmii.c
b/drivers/net/ethernet/broadcom/genet/bcmmii.c
index dbe18cdf6c1b..e363a824d662 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmmii.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmmii.c
@@ -218,6 +218,7 @@ int bcmgenet_mii_config(struct net_device *dev, bool
init)

        switch (priv->phy_interface) {
        case PHY_INTERFACE_MODE_INTERNAL:
+               phy_name = "internal PHY";
        case PHY_INTERFACE_MODE_MOCA:
                /* Irrespective of the actually configured PHY speed (100 or
                 * 1000) GENETv4 only has an internal GPHY so we will
just end
@@ -229,14 +230,8 @@ int bcmgenet_mii_config(struct net_device *dev,
bool init)
                else
                        port_ctrl = PORT_MODE_INT_EPHY;

-               bcmgenet_sys_writel(priv, port_ctrl, SYS_PORT_CTRL);
-
-               if (priv->internal_phy) {
-                       phy_name = "internal PHY";
-               } else if (priv->phy_interface == PHY_INTERFACE_MODE_MOCA) {
+               if (!phy_name)
                        phy_name = "MoCA";
-                       bcmgenet_moca_phy_setup(priv);
-               }
                break;

such that all the port_ctrl and the phy_name are set within the same
location and the register write/configuration is done after the mode has
been determined.
-- 
Florian

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH V3 net-next 1/7] net: bcmgenet: Avoid touching non-existent interrupt
  2019-11-10 20:23     ` Florian Fainelli
@ 2019-11-10 20:57       ` Stefan Wahren
  -1 siblings, 0 replies; 34+ messages in thread
From: Stefan Wahren @ 2019-11-10 20:57 UTC (permalink / raw)
  To: Florian Fainelli, Matthias Brugger, Matthias Brugger, David S . Miller
  Cc: Eric Anholt, Nicolas Saenz Julienne, Doug Berger, netdev,
	bcm-kernel-feedback-list, linux-arm-kernel

Hi Florian,

Am 10.11.19 um 21:23 schrieb Florian Fainelli:
>
> On 11/9/2019 11:00 AM, Stefan Wahren wrote:
>> As platform_get_irq() now prints an error when the interrupt does not
>> exist, we are getting a confusing error message in case the optional
>> WOL IRQ is not defined:
>>
>>   bcmgenet fd58000.ethernet: IRQ index 2 not found
>>
>> Fix this by using the platform_get_irq_optional().
>>
>> Fixes: 7723f4c5ecdb8d83 ("driver core: platform: Add an error message to platform_get_irq*()")
>> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
> I still don't think this warrant a Fixes tag, as this is not a bug
> per-se, just a minor annoyance:

this confuses me. In V2 you said this about patch "net: bcmgenet: Fix
error handling on IRQ retrieval".

Is it possible you commented the wrong patch last time?


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

* Re: [PATCH V3 net-next 1/7] net: bcmgenet: Avoid touching non-existent interrupt
@ 2019-11-10 20:57       ` Stefan Wahren
  0 siblings, 0 replies; 34+ messages in thread
From: Stefan Wahren @ 2019-11-10 20:57 UTC (permalink / raw)
  To: Florian Fainelli, Matthias Brugger, Matthias Brugger, David S . Miller
  Cc: Doug Berger, netdev, Eric Anholt, bcm-kernel-feedback-list,
	Nicolas Saenz Julienne, linux-arm-kernel

Hi Florian,

Am 10.11.19 um 21:23 schrieb Florian Fainelli:
>
> On 11/9/2019 11:00 AM, Stefan Wahren wrote:
>> As platform_get_irq() now prints an error when the interrupt does not
>> exist, we are getting a confusing error message in case the optional
>> WOL IRQ is not defined:
>>
>>   bcmgenet fd58000.ethernet: IRQ index 2 not found
>>
>> Fix this by using the platform_get_irq_optional().
>>
>> Fixes: 7723f4c5ecdb8d83 ("driver core: platform: Add an error message to platform_get_irq*()")
>> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
> I still don't think this warrant a Fixes tag, as this is not a bug
> per-se, just a minor annoyance:

this confuses me. In V2 you said this about patch "net: bcmgenet: Fix
error handling on IRQ retrieval".

Is it possible you commented the wrong patch last time?


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH V3 net-next 1/7] net: bcmgenet: Avoid touching non-existent interrupt
  2019-11-10 20:57       ` Stefan Wahren
@ 2019-11-10 21:10         ` Florian Fainelli
  -1 siblings, 0 replies; 34+ messages in thread
From: Florian Fainelli @ 2019-11-10 21:10 UTC (permalink / raw)
  To: Stefan Wahren, Matthias Brugger, Matthias Brugger, David S . Miller
  Cc: Eric Anholt, Nicolas Saenz Julienne, Doug Berger, netdev,
	bcm-kernel-feedback-list, linux-arm-kernel



On 11/10/2019 12:57 PM, Stefan Wahren wrote:
> Hi Florian,
> 
> Am 10.11.19 um 21:23 schrieb Florian Fainelli:
>>
>> On 11/9/2019 11:00 AM, Stefan Wahren wrote:
>>> As platform_get_irq() now prints an error when the interrupt does not
>>> exist, we are getting a confusing error message in case the optional
>>> WOL IRQ is not defined:
>>>
>>>   bcmgenet fd58000.ethernet: IRQ index 2 not found
>>>
>>> Fix this by using the platform_get_irq_optional().
>>>
>>> Fixes: 7723f4c5ecdb8d83 ("driver core: platform: Add an error message to platform_get_irq*()")
>>> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
>> I still don't think this warrant a Fixes tag, as this is not a bug
>> per-se, just a minor annoyance:
> 
> this confuses me. In V2 you said this about patch "net: bcmgenet: Fix
> error handling on IRQ retrieval".
> 
> Is it possible you commented the wrong patch last time?

In v2, on patch 1, I wrote this:

Not sure if the Fixes tag is necessary here, this is kind of an
exceptional case anyway since you should be specifying valid interrupt
resources to begin with.

and on v2, on patch 2, I just suggested using
platform_get_irq_optional() but did not comment on your choice of Fixes:
tag, but now I just did, and for the same reasons as patch #1, I think
this is not necessary.
-- 
Florian

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

* Re: [PATCH V3 net-next 1/7] net: bcmgenet: Avoid touching non-existent interrupt
@ 2019-11-10 21:10         ` Florian Fainelli
  0 siblings, 0 replies; 34+ messages in thread
From: Florian Fainelli @ 2019-11-10 21:10 UTC (permalink / raw)
  To: Stefan Wahren, Matthias Brugger, Matthias Brugger, David S . Miller
  Cc: Doug Berger, netdev, Eric Anholt, bcm-kernel-feedback-list,
	Nicolas Saenz Julienne, linux-arm-kernel



On 11/10/2019 12:57 PM, Stefan Wahren wrote:
> Hi Florian,
> 
> Am 10.11.19 um 21:23 schrieb Florian Fainelli:
>>
>> On 11/9/2019 11:00 AM, Stefan Wahren wrote:
>>> As platform_get_irq() now prints an error when the interrupt does not
>>> exist, we are getting a confusing error message in case the optional
>>> WOL IRQ is not defined:
>>>
>>>   bcmgenet fd58000.ethernet: IRQ index 2 not found
>>>
>>> Fix this by using the platform_get_irq_optional().
>>>
>>> Fixes: 7723f4c5ecdb8d83 ("driver core: platform: Add an error message to platform_get_irq*()")
>>> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
>> I still don't think this warrant a Fixes tag, as this is not a bug
>> per-se, just a minor annoyance:
> 
> this confuses me. In V2 you said this about patch "net: bcmgenet: Fix
> error handling on IRQ retrieval".
> 
> Is it possible you commented the wrong patch last time?

In v2, on patch 1, I wrote this:

Not sure if the Fixes tag is necessary here, this is kind of an
exceptional case anyway since you should be specifying valid interrupt
resources to begin with.

and on v2, on patch 2, I just suggested using
platform_get_irq_optional() but did not comment on your choice of Fixes:
tag, but now I just did, and for the same reasons as patch #1, I think
this is not necessary.
-- 
Florian

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2019-11-10 21:10 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-09 19:00 [PATCH V3 net-next 0/7] ARM: Enable GENET support for RPi 4 Stefan Wahren
2019-11-09 19:00 ` Stefan Wahren
2019-11-09 19:00 ` [PATCH V3 net-next 1/7] net: bcmgenet: Avoid touching non-existent interrupt Stefan Wahren
2019-11-09 19:00   ` Stefan Wahren
2019-11-10 20:23   ` Florian Fainelli
2019-11-10 20:23     ` Florian Fainelli
2019-11-10 20:57     ` Stefan Wahren
2019-11-10 20:57       ` Stefan Wahren
2019-11-10 21:10       ` Florian Fainelli
2019-11-10 21:10         ` Florian Fainelli
2019-11-09 19:00 ` [PATCH V3 net-next 2/7] net: bcmgenet: Fix error handling on IRQ retrieval Stefan Wahren
2019-11-09 19:00   ` Stefan Wahren
2019-11-10 20:24   ` Florian Fainelli
2019-11-10 20:24     ` Florian Fainelli
2019-11-09 19:00 ` [PATCH V3 net-next 3/7] dt-bindings: net: bcmgenet: Add BCM2711 support Stefan Wahren
2019-11-09 19:00   ` Stefan Wahren
2019-11-10 20:23   ` Florian Fainelli
2019-11-10 20:23     ` Florian Fainelli
2019-11-09 19:00 ` [PATCH V3 net-next 4/7] " Stefan Wahren
2019-11-09 19:00   ` Stefan Wahren
2019-11-10 20:26   ` Florian Fainelli
2019-11-10 20:26     ` Florian Fainelli
2019-11-09 19:00 ` [PATCH V3 net-next 5/7] net: bcmgenet: Refactor register access in bcmgenet_mii_config Stefan Wahren
2019-11-09 19:00   ` Stefan Wahren
2019-11-10 20:34   ` Florian Fainelli
2019-11-10 20:34     ` Florian Fainelli
2019-11-09 19:00 ` [PATCH V3 net-next 6/7] net: bcmgenet: Add RGMII_RXID and RGMII_ID support Stefan Wahren
2019-11-09 19:00   ` Stefan Wahren
2019-11-10 20:32   ` Florian Fainelli
2019-11-10 20:32     ` Florian Fainelli
2019-11-09 19:00 ` [PATCH V3 net-next 7/7] ARM: dts: bcm2711-rpi-4: Enable GENET support Stefan Wahren
2019-11-09 19:00   ` Stefan Wahren
2019-11-10 20:26 ` [PATCH V3 net-next 0/7] ARM: Enable GENET support for RPi 4 Florian Fainelli
2019-11-10 20:26   ` Florian Fainelli

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.