diff options
Diffstat (limited to 'drivers/net/stmmac/dwmac1000_dma.c')
-rw-r--r-- | drivers/net/stmmac/dwmac1000_dma.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/drivers/net/stmmac/dwmac1000_dma.c b/drivers/net/stmmac/dwmac1000_dma.c index 415805057cb0..ce6163e39cd5 100644 --- a/drivers/net/stmmac/dwmac1000_dma.c +++ b/drivers/net/stmmac/dwmac1000_dma.c | |||
@@ -29,14 +29,22 @@ | |||
29 | #include "dwmac1000.h" | 29 | #include "dwmac1000.h" |
30 | #include "dwmac_dma.h" | 30 | #include "dwmac_dma.h" |
31 | 31 | ||
32 | static int dwmac1000_dma_init(unsigned long ioaddr, int pbl, u32 dma_tx, | 32 | static int dwmac1000_dma_init(void __iomem *ioaddr, int pbl, u32 dma_tx, |
33 | u32 dma_rx) | 33 | u32 dma_rx) |
34 | { | 34 | { |
35 | u32 value = readl(ioaddr + DMA_BUS_MODE); | 35 | u32 value = readl(ioaddr + DMA_BUS_MODE); |
36 | int limit; | ||
37 | |||
36 | /* DMA SW reset */ | 38 | /* DMA SW reset */ |
37 | value |= DMA_BUS_MODE_SFT_RESET; | 39 | value |= DMA_BUS_MODE_SFT_RESET; |
38 | writel(value, ioaddr + DMA_BUS_MODE); | 40 | writel(value, ioaddr + DMA_BUS_MODE); |
39 | do {} while ((readl(ioaddr + DMA_BUS_MODE) & DMA_BUS_MODE_SFT_RESET)); | 41 | limit = 15000; |
42 | while (limit--) { | ||
43 | if (!(readl(ioaddr + DMA_BUS_MODE) & DMA_BUS_MODE_SFT_RESET)) | ||
44 | break; | ||
45 | } | ||
46 | if (limit < 0) | ||
47 | return -EBUSY; | ||
40 | 48 | ||
41 | value = /* DMA_BUS_MODE_FB | */ DMA_BUS_MODE_4PBL | | 49 | value = /* DMA_BUS_MODE_FB | */ DMA_BUS_MODE_4PBL | |
42 | ((pbl << DMA_BUS_MODE_PBL_SHIFT) | | 50 | ((pbl << DMA_BUS_MODE_PBL_SHIFT) | |
@@ -58,7 +66,7 @@ static int dwmac1000_dma_init(unsigned long ioaddr, int pbl, u32 dma_tx, | |||
58 | return 0; | 66 | return 0; |
59 | } | 67 | } |
60 | 68 | ||
61 | static void dwmac1000_dma_operation_mode(unsigned long ioaddr, int txmode, | 69 | static void dwmac1000_dma_operation_mode(void __iomem *ioaddr, int txmode, |
62 | int rxmode) | 70 | int rxmode) |
63 | { | 71 | { |
64 | u32 csr6 = readl(ioaddr + DMA_CONTROL); | 72 | u32 csr6 = readl(ioaddr + DMA_CONTROL); |
@@ -111,12 +119,12 @@ static void dwmac1000_dma_operation_mode(unsigned long ioaddr, int txmode, | |||
111 | 119 | ||
112 | /* Not yet implemented --- no RMON module */ | 120 | /* Not yet implemented --- no RMON module */ |
113 | static void dwmac1000_dma_diagnostic_fr(void *data, | 121 | static void dwmac1000_dma_diagnostic_fr(void *data, |
114 | struct stmmac_extra_stats *x, unsigned long ioaddr) | 122 | struct stmmac_extra_stats *x, void __iomem *ioaddr) |
115 | { | 123 | { |
116 | return; | 124 | return; |
117 | } | 125 | } |
118 | 126 | ||
119 | static void dwmac1000_dump_dma_regs(unsigned long ioaddr) | 127 | static void dwmac1000_dump_dma_regs(void __iomem *ioaddr) |
120 | { | 128 | { |
121 | int i; | 129 | int i; |
122 | pr_info(" DMA registers\n"); | 130 | pr_info(" DMA registers\n"); |