aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2017-12-19 11:07:17 -0500
committerDavid S. Miller <davem@davemloft.net>2017-12-19 11:07:17 -0500
commite2948dd1b8f922535044ebf0f6a16fc630712366 (patch)
treec6829fbcdb7cbd6d2fc343110d70aa0372e30eba
parent8e6d60435da8a911b67c36b17ff0319162e29563 (diff)
parentc7fe89e30054c50fe7f8236bfbab3801643bd32b (diff)
Merge branch 'bcm63xx_enet-remove-mac_id-usage'
Jonas Gorski says: ==================== bcm63xx_enet: remove mac_id usage This patchset aims at reducing the platform device id number usage with the target of making it eventually possible to probe the driver through OF. Runtested on BCM6358. Since the patches touch mostly net/, they should go through net-next. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--arch/mips/bcm63xx/dev-enet.c8
-rw-r--r--arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h4
-rw-r--r--drivers/net/ethernet/broadcom/bcm63xx_enet.c21
-rw-r--r--drivers/net/ethernet/broadcom/bcm63xx_enet.h3
4 files changed, 17 insertions, 19 deletions
diff --git a/arch/mips/bcm63xx/dev-enet.c b/arch/mips/bcm63xx/dev-enet.c
index e8284771d620..07b4c65a88a4 100644
--- a/arch/mips/bcm63xx/dev-enet.c
+++ b/arch/mips/bcm63xx/dev-enet.c
@@ -265,6 +265,14 @@ int __init bcm63xx_enet_register(int unit,
265 dpd->dma_chan_width = ENETDMA_CHAN_WIDTH; 265 dpd->dma_chan_width = ENETDMA_CHAN_WIDTH;
266 } 266 }
267 267
268 if (unit == 0) {
269 dpd->rx_chan = 0;
270 dpd->tx_chan = 1;
271 } else {
272 dpd->rx_chan = 2;
273 dpd->tx_chan = 3;
274 }
275
268 ret = platform_device_register(pdev); 276 ret = platform_device_register(pdev);
269 if (ret) 277 if (ret)
270 return ret; 278 return ret;
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h
index c0bd47444cff..da39e4d326ba 100644
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h
@@ -55,6 +55,10 @@ struct bcm63xx_enet_platform_data {
55 55
56 /* DMA descriptor shift */ 56 /* DMA descriptor shift */
57 unsigned int dma_desc_shift; 57 unsigned int dma_desc_shift;
58
59 /* dma channel ids */
60 int rx_chan;
61 int tx_chan;
58}; 62};
59 63
60/* 64/*
diff --git a/drivers/net/ethernet/broadcom/bcm63xx_enet.c b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
index d9346e2ac720..1fbbbabe7588 100644
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
@@ -1716,7 +1716,6 @@ static int bcm_enet_probe(struct platform_device *pdev)
1716 struct bcm63xx_enet_platform_data *pd; 1716 struct bcm63xx_enet_platform_data *pd;
1717 struct resource *res_mem, *res_irq, *res_irq_rx, *res_irq_tx; 1717 struct resource *res_mem, *res_irq, *res_irq_rx, *res_irq_tx;
1718 struct mii_bus *bus; 1718 struct mii_bus *bus;
1719 const char *clk_name;
1720 int i, ret; 1719 int i, ret;
1721 1720
1722 if (!bcm_enet_shared_base[0]) 1721 if (!bcm_enet_shared_base[0])
@@ -1751,20 +1750,8 @@ static int bcm_enet_probe(struct platform_device *pdev)
1751 dev->irq = priv->irq = res_irq->start; 1750 dev->irq = priv->irq = res_irq->start;
1752 priv->irq_rx = res_irq_rx->start; 1751 priv->irq_rx = res_irq_rx->start;
1753 priv->irq_tx = res_irq_tx->start; 1752 priv->irq_tx = res_irq_tx->start;
1754 priv->mac_id = pdev->id;
1755 1753
1756 /* get rx & tx dma channel id for this mac */ 1754 priv->mac_clk = devm_clk_get(&pdev->dev, "enet");
1757 if (priv->mac_id == 0) {
1758 priv->rx_chan = 0;
1759 priv->tx_chan = 1;
1760 clk_name = "enet0";
1761 } else {
1762 priv->rx_chan = 2;
1763 priv->tx_chan = 3;
1764 clk_name = "enet1";
1765 }
1766
1767 priv->mac_clk = devm_clk_get(&pdev->dev, clk_name);
1768 if (IS_ERR(priv->mac_clk)) { 1755 if (IS_ERR(priv->mac_clk)) {
1769 ret = PTR_ERR(priv->mac_clk); 1756 ret = PTR_ERR(priv->mac_clk);
1770 goto out; 1757 goto out;
@@ -1795,9 +1782,11 @@ static int bcm_enet_probe(struct platform_device *pdev)
1795 priv->dma_chan_width = pd->dma_chan_width; 1782 priv->dma_chan_width = pd->dma_chan_width;
1796 priv->dma_has_sram = pd->dma_has_sram; 1783 priv->dma_has_sram = pd->dma_has_sram;
1797 priv->dma_desc_shift = pd->dma_desc_shift; 1784 priv->dma_desc_shift = pd->dma_desc_shift;
1785 priv->rx_chan = pd->rx_chan;
1786 priv->tx_chan = pd->tx_chan;
1798 } 1787 }
1799 1788
1800 if (priv->mac_id == 0 && priv->has_phy && !priv->use_external_mii) { 1789 if (priv->has_phy && !priv->use_external_mii) {
1801 /* using internal PHY, enable clock */ 1790 /* using internal PHY, enable clock */
1802 priv->phy_clk = devm_clk_get(&pdev->dev, "ephy"); 1791 priv->phy_clk = devm_clk_get(&pdev->dev, "ephy");
1803 if (IS_ERR(priv->phy_clk)) { 1792 if (IS_ERR(priv->phy_clk)) {
@@ -1828,7 +1817,7 @@ static int bcm_enet_probe(struct platform_device *pdev)
1828 bus->priv = priv; 1817 bus->priv = priv;
1829 bus->read = bcm_enet_mdio_read_phylib; 1818 bus->read = bcm_enet_mdio_read_phylib;
1830 bus->write = bcm_enet_mdio_write_phylib; 1819 bus->write = bcm_enet_mdio_write_phylib;
1831 sprintf(bus->id, "%s-%d", pdev->name, priv->mac_id); 1820 sprintf(bus->id, "%s-%d", pdev->name, pdev->id);
1832 1821
1833 /* only probe bus where we think the PHY is, because 1822 /* only probe bus where we think the PHY is, because
1834 * the mdio read operation return 0 instead of 0xffff 1823 * the mdio read operation return 0 instead of 0xffff
diff --git a/drivers/net/ethernet/broadcom/bcm63xx_enet.h b/drivers/net/ethernet/broadcom/bcm63xx_enet.h
index 5a66728d4776..1d3c917eb830 100644
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.h
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.h
@@ -193,9 +193,6 @@ struct bcm_enet_mib_counters {
193 193
194struct bcm_enet_priv { 194struct bcm_enet_priv {
195 195
196 /* mac id (from platform device id) */
197 int mac_id;
198
199 /* base remapped address of device */ 196 /* base remapped address of device */
200 void __iomem *base; 197 void __iomem *base;
201 198