bcm63xx_enet: use platform data for dma channel numbers
authorJonas Gorski <jonas.gorski@gmail.com>
Sun, 17 Dec 2017 16:02:53 +0000 (17:02 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 19 Dec 2017 16:07:16 +0000 (11:07 -0500)
To reduce the reliance on device ids, pass the dma channel numbers to
the enet devices as platform data.

Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
arch/mips/bcm63xx/dev-enet.c
arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h
drivers/net/ethernet/broadcom/bcm63xx_enet.c

index e8284771d62036d04c8f1942b80d56bd3bb71d15..07b4c65a88a43708467626b410baf79936bac203 100644 (file)
@@ -265,6 +265,14 @@ int __init bcm63xx_enet_register(int unit,
                dpd->dma_chan_width = ENETDMA_CHAN_WIDTH;
        }
 
+       if (unit == 0) {
+               dpd->rx_chan = 0;
+               dpd->tx_chan = 1;
+       } else {
+               dpd->rx_chan = 2;
+               dpd->tx_chan = 3;
+       }
+
        ret = platform_device_register(pdev);
        if (ret)
                return ret;
index c0bd47444cffdee2bc244efaf6b41a9b990bb01a..da39e4d326baa7aa2b5dc7a20f6ab92956216b55 100644 (file)
@@ -55,6 +55,10 @@ struct bcm63xx_enet_platform_data {
 
        /* DMA descriptor shift */
        unsigned int dma_desc_shift;
+
+       /* dma channel ids */
+       int rx_chan;
+       int tx_chan;
 };
 
 /*
index 5a5886345da2d38db9b321c8fecba3308af37013..e603a6fe63494457d0cb34d8c9197ad5a46ea999 100644 (file)
@@ -1752,15 +1752,6 @@ static int bcm_enet_probe(struct platform_device *pdev)
        priv->irq_tx = res_irq_tx->start;
        priv->mac_id = pdev->id;
 
-       /* get rx & tx dma channel id for this mac */
-       if (priv->mac_id == 0) {
-               priv->rx_chan = 0;
-               priv->tx_chan = 1;
-       } else {
-               priv->rx_chan = 2;
-               priv->tx_chan = 3;
-       }
-
        priv->mac_clk = devm_clk_get(&pdev->dev, "enet");
        if (IS_ERR(priv->mac_clk)) {
                ret = PTR_ERR(priv->mac_clk);
@@ -1792,6 +1783,8 @@ static int bcm_enet_probe(struct platform_device *pdev)
                priv->dma_chan_width = pd->dma_chan_width;
                priv->dma_has_sram = pd->dma_has_sram;
                priv->dma_desc_shift = pd->dma_desc_shift;
+               priv->rx_chan = pd->rx_chan;
+               priv->tx_chan = pd->tx_chan;
        }
 
        if (priv->mac_id == 0 && priv->has_phy && !priv->use_external_mii) {