Skip to contentSkip to conversation

net: systemport: Add support for SYSTEMPORT lite

PATCH In review Florian Fainelli 2 participants 4 messages Jan 20, 2017 – Jan 22, 2017

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover net: systemport: Add support for SYSTEMPORT lite

Hi David,

This patch series adds support for SYSTEMPORT Lite which is an evolution of the existing SYSTEMPORT adapter.

The two generations are largely identical as far as the transmit/receive path are concerned, and there were just a few control path changes here and there.

Thanks!

Florian Fainelli (2):
net: systemport: Dynamically allocate number of TX rings
net: systemport: Add support for SYSTEMPORT Lite

 .../devicetree/bindings/net/brcm,systemport.txt    |   5 +-
 drivers/net/ethernet/broadcom/bcmsysport.c         | 334 +++++++++++++++++----
 drivers/net/ethernet/broadcom/bcmsysport.h         |  80 ++++-
 3 files changed, 339 insertions(+), 80 deletions(-)
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/2 net: systemport: Dynamically allocate number of TX rings

In preparation for adding SYSTEMPORT Lite, which has twice as less transmit queues than SYSTEMPORT make sure we do allocate TX rings based on the systemport,txq property to get an appropriate memory footprint.

---
 drivers/net/ethernet/broadcom/bcmsysport.c | 11 +++++++++++
 drivers/net/ethernet/broadcom/bcmsysport.h |  2 +-
 2 files changed, 12 insertions(+), 1 deletion(-)
drivers/net/ethernet/broadcom/bcmsysport.c +11 -0
index 744ed6ddaf37..31bb2c3696ec 100644
@@ -1752,6 +1752,10 @@ static int bcm_sysport_probe(struct platform_device *pdev)
 	if (of_property_read_u32(dn, "systemport,num-rxq", &rxq))
 		rxq = 1;
 
+	/* Sanity check the number of transmit queues */
+	if (!txq || txq > TDMA_NUM_RINGS)
+		return -EINVAL;
+
 	dev = alloc_etherdev_mqs(sizeof(*priv), txq, rxq);
 	if (!dev)
 		return -ENOMEM;
@@ -1759,6 +1763,13 @@ static int bcm_sysport_probe(struct platform_device *pdev)
 	/* Initialize private members */
 	priv = netdev_priv(dev);
 
+	/* Allocate number of TX rings */
+	priv->tx_rings = devm_kcalloc(&pdev->dev, txq,
+				      sizeof(struct bcm_sysport_tx_ring),
+				      GFP_KERNEL);
+	if (!priv->tx_rings)
+		return -ENOMEM;
+
 	priv->irq0 = platform_get_irq(pdev, 0);
 	priv->irq1 = platform_get_irq(pdev, 1);
 	priv->wol_irq = platform_get_irq(pdev, 2);
drivers/net/ethernet/broadcom/bcmsysport.h +1 -1
index 1c82e3da69a7..f051356b0274 100644
@@ -659,7 +659,7 @@ struct bcm_sysport_priv {
 	int			wol_irq;
 
 	/* Transmit rings */
-	struct bcm_sysport_tx_ring tx_rings[TDMA_NUM_RINGS];
+	struct bcm_sysport_tx_ring *tx_rings;
 
 	/* Receive queue */
 	void __iomem		*rx_bds;
Signature · 1 line
2.11.0
#2 lore raw

PATCH 2/2 net: systemport: Add support for SYSTEMPORT Lite

In reply to Florian Fainelli

Add supporf for the SYSTEMPORT Lite Ethernet controller, this piece of hardware is largely based on the full-blown SYSTEMPORT and differs in the following:

- no full-blown UniMAC, instead we have the MagicPacket matching from UniMAC at same offset, and a GMII Interface Block (GIB) for the MAC-level stuff, since we are always interfaced to an Ethernet switch which is fully Ethernet compliant shortcuts could be made

- 16 transmit queues, whose interrupts are moved into the first Level-2 interrupt controller bank

- slight TDMA offset change (a register was inserted after TDMA_STATUS, *sigh*)

- 256 RX descriptors (512 words) and 256 TX descriptors (not visible)

As a consequence of these two things, update the code paths accordingly to differentiate the full-blown from the light version.

---
 .../devicetree/bindings/net/brcm,systemport.txt    |   5 +-
 drivers/net/ethernet/broadcom/bcmsysport.c         | 323 +++++++++++++++++----
 drivers/net/ethernet/broadcom/bcmsysport.h         |  78 ++++-
 3 files changed, 327 insertions(+), 79 deletions(-)
Documentation/devicetree/bindings/net/brcm,systemport.txt +4 -1
index 877da34145b0..83f29e0e11ba 100644
@@ -1,7 +1,10 @@
 * Broadcom BCM7xxx Ethernet Systemport Controller (SYSTEMPORT)
 
 Required properties:
-- compatible: should be one of "brcm,systemport-v1.00" or "brcm,systemport"
+- compatible: should be one of:
+	      "brcm,systemport-v1.00"
+	      "brcm,systemportlite-v1.00" or
+	      "brcm,systemport"
 - reg: address and length of the register set for the device.
 - interrupts: interrupts for the device, first cell must be for the rx
   interrupts, and the second cell should be for the transmit queues. An
drivers/net/ethernet/broadcom/bcmsysport.c +259 -64

573 lines not on this page · raw message

drivers/net/ethernet/broadcom/bcmsysport.h +64 -14

129 lines not on this page · raw message

Signature · 1 line
2.11.0
maintainer
#3 lore raw
In reply to Florian Fainelli

From: Florian Fainelli <[email protected]>
Date: Fri, 20 Jan 2017 11:08:25 -0800

Quoted 6 lines

This patch series adds support for SYSTEMPORT Lite which is an evolution of the existing SYSTEMPORT adapter.

The two generations are largely identical as far as the transmit/receive path are concerned, and there were just a few control path changes here and there.

Series applied, thanks.