OpenWrt – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | From b7d1d1f345bb3b25c360c1df812d98866e2ee7fb Mon Sep 17 00:00:00 2001 |
2 | From: Jonas Gorski <jonas.gorski@gmail.com> |
||
3 | Date: Sat, 30 Sep 2017 13:50:03 +0200 |
||
4 | Subject: [PATCH 2/4] bcm63xx_enet: use platform data for dma channel numbers |
||
5 | |||
6 | To reduce the reliance on device ids, pass the dma channel numbers to |
||
7 | the enet devices as platform data. |
||
8 | |||
9 | Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com> |
||
10 | --- |
||
11 | arch/mips/bcm63xx/dev-enet.c | 8 ++++++++ |
||
12 | arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h | 4 ++++ |
||
13 | drivers/net/ethernet/broadcom/bcm63xx_enet.c | 11 ++--------- |
||
14 | 3 files changed, 14 insertions(+), 9 deletions(-) |
||
15 | |||
16 | --- a/arch/mips/bcm63xx/dev-enet.c |
||
17 | +++ b/arch/mips/bcm63xx/dev-enet.c |
||
18 | @@ -265,6 +265,14 @@ int __init bcm63xx_enet_register(int uni |
||
19 | dpd->dma_chan_width = ENETDMA_CHAN_WIDTH; |
||
20 | } |
||
21 | |||
22 | + if (unit == 0) { |
||
23 | + dpd->rx_chan = 0; |
||
24 | + dpd->tx_chan = 1; |
||
25 | + } else { |
||
26 | + dpd->rx_chan = 2; |
||
27 | + dpd->tx_chan = 3; |
||
28 | + } |
||
29 | + |
||
30 | ret = platform_device_register(pdev); |
||
31 | if (ret) |
||
32 | return ret; |
||
33 | --- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h |
||
34 | +++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h |
||
35 | @@ -55,6 +55,10 @@ struct bcm63xx_enet_platform_data { |
||
36 | |||
37 | /* DMA descriptor shift */ |
||
38 | unsigned int dma_desc_shift; |
||
39 | + |
||
40 | + /* dma channel ids */ |
||
41 | + int rx_chan; |
||
42 | + int tx_chan; |
||
43 | }; |
||
44 | |||
45 | /* |
||
46 | --- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c |
||
47 | +++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c |
||
48 | @@ -1755,15 +1755,6 @@ static int bcm_enet_probe(struct platfor |
||
49 | priv->irq_tx = res_irq_tx->start; |
||
50 | priv->mac_id = pdev->id; |
||
51 | |||
52 | - /* get rx & tx dma channel id for this mac */ |
||
53 | - if (priv->mac_id == 0) { |
||
54 | - priv->rx_chan = 0; |
||
55 | - priv->tx_chan = 1; |
||
56 | - } else { |
||
57 | - priv->rx_chan = 2; |
||
58 | - priv->tx_chan = 3; |
||
59 | - } |
||
60 | - |
||
61 | priv->mac_clk = devm_clk_get(&pdev->dev, "enet"); |
||
62 | if (IS_ERR(priv->mac_clk)) { |
||
63 | ret = PTR_ERR(priv->mac_clk); |
||
64 | @@ -1795,6 +1786,8 @@ static int bcm_enet_probe(struct platfor |
||
65 | priv->dma_chan_width = pd->dma_chan_width; |
||
66 | priv->dma_has_sram = pd->dma_has_sram; |
||
67 | priv->dma_desc_shift = pd->dma_desc_shift; |
||
68 | + priv->rx_chan = pd->rx_chan; |
||
69 | + priv->tx_chan = pd->tx_chan; |
||
70 | } |
||
71 | |||
72 | if (priv->mac_id == 0 && priv->has_phy && !priv->use_external_mii) { |