Commit e2948dd1 authored by David S. Miller's avatar David S. Miller

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: default avatarDavid S. Miller <davem@davemloft.net>
parents 8e6d6043 c7fe89e3
...@@ -265,6 +265,14 @@ int __init bcm63xx_enet_register(int unit, ...@@ -265,6 +265,14 @@ int __init bcm63xx_enet_register(int unit,
dpd->dma_chan_width = ENETDMA_CHAN_WIDTH; 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); ret = platform_device_register(pdev);
if (ret) if (ret)
return ret; return ret;
......
...@@ -55,6 +55,10 @@ struct bcm63xx_enet_platform_data { ...@@ -55,6 +55,10 @@ struct bcm63xx_enet_platform_data {
/* DMA descriptor shift */ /* DMA descriptor shift */
unsigned int dma_desc_shift; unsigned int dma_desc_shift;
/* dma channel ids */
int rx_chan;
int tx_chan;
}; };
/* /*
......
...@@ -1716,7 +1716,6 @@ static int bcm_enet_probe(struct platform_device *pdev) ...@@ -1716,7 +1716,6 @@ static int bcm_enet_probe(struct platform_device *pdev)
struct bcm63xx_enet_platform_data *pd; struct bcm63xx_enet_platform_data *pd;
struct resource *res_mem, *res_irq, *res_irq_rx, *res_irq_tx; struct resource *res_mem, *res_irq, *res_irq_rx, *res_irq_tx;
struct mii_bus *bus; struct mii_bus *bus;
const char *clk_name;
int i, ret; int i, ret;
if (!bcm_enet_shared_base[0]) if (!bcm_enet_shared_base[0])
...@@ -1751,20 +1750,8 @@ static int bcm_enet_probe(struct platform_device *pdev) ...@@ -1751,20 +1750,8 @@ static int bcm_enet_probe(struct platform_device *pdev)
dev->irq = priv->irq = res_irq->start; dev->irq = priv->irq = res_irq->start;
priv->irq_rx = res_irq_rx->start; priv->irq_rx = res_irq_rx->start;
priv->irq_tx = res_irq_tx->start; priv->irq_tx = res_irq_tx->start;
priv->mac_id = pdev->id;
/* get rx & tx dma channel id for this mac */ priv->mac_clk = devm_clk_get(&pdev->dev, "enet");
if (priv->mac_id == 0) {
priv->rx_chan = 0;
priv->tx_chan = 1;
clk_name = "enet0";
} else {
priv->rx_chan = 2;
priv->tx_chan = 3;
clk_name = "enet1";
}
priv->mac_clk = devm_clk_get(&pdev->dev, clk_name);
if (IS_ERR(priv->mac_clk)) { if (IS_ERR(priv->mac_clk)) {
ret = PTR_ERR(priv->mac_clk); ret = PTR_ERR(priv->mac_clk);
goto out; goto out;
...@@ -1795,9 +1782,11 @@ static int bcm_enet_probe(struct platform_device *pdev) ...@@ -1795,9 +1782,11 @@ static int bcm_enet_probe(struct platform_device *pdev)
priv->dma_chan_width = pd->dma_chan_width; priv->dma_chan_width = pd->dma_chan_width;
priv->dma_has_sram = pd->dma_has_sram; priv->dma_has_sram = pd->dma_has_sram;
priv->dma_desc_shift = pd->dma_desc_shift; 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) { if (priv->has_phy && !priv->use_external_mii) {
/* using internal PHY, enable clock */ /* using internal PHY, enable clock */
priv->phy_clk = devm_clk_get(&pdev->dev, "ephy"); priv->phy_clk = devm_clk_get(&pdev->dev, "ephy");
if (IS_ERR(priv->phy_clk)) { if (IS_ERR(priv->phy_clk)) {
...@@ -1828,7 +1817,7 @@ static int bcm_enet_probe(struct platform_device *pdev) ...@@ -1828,7 +1817,7 @@ static int bcm_enet_probe(struct platform_device *pdev)
bus->priv = priv; bus->priv = priv;
bus->read = bcm_enet_mdio_read_phylib; bus->read = bcm_enet_mdio_read_phylib;
bus->write = bcm_enet_mdio_write_phylib; bus->write = bcm_enet_mdio_write_phylib;
sprintf(bus->id, "%s-%d", pdev->name, priv->mac_id); sprintf(bus->id, "%s-%d", pdev->name, pdev->id);
/* only probe bus where we think the PHY is, because /* only probe bus where we think the PHY is, because
* the mdio read operation return 0 instead of 0xffff * the mdio read operation return 0 instead of 0xffff
......
...@@ -193,9 +193,6 @@ struct bcm_enet_mib_counters { ...@@ -193,9 +193,6 @@ struct bcm_enet_mib_counters {
struct bcm_enet_priv { struct bcm_enet_priv {
/* mac id (from platform device id) */
int mac_id;
/* base remapped address of device */ /* base remapped address of device */
void __iomem *base; void __iomem *base;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment