diff options
author | Sam Ravnborg <sam@ravnborg.org> | 2014-05-16 17:25:41 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-05-18 22:01:26 -0400 |
commit | 1918660b9045c04545f5c5088f573c67ecff9927 (patch) | |
tree | 48b84269991dfa858e1f261f57ff292ba0456230 | |
parent | f977ea49ae24c3bf0595725465b9ca25385de307 (diff) |
sparc32: fix sparse warning in io-unit.c
Fix following warning:
io-unit.c:56:13: warning: incorrect type in assignment (different address spaces)
The page table for the io unit resides in __iomem.
Fix up all users of the io unit page table.
Introduce sbus helers for all read/write operations.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | arch/sparc/include/asm/io-unit.h | 2 | ||||
-rw-r--r-- | arch/sparc/mm/io-unit.c | 21 |
2 files changed, 13 insertions, 10 deletions
diff --git a/arch/sparc/include/asm/io-unit.h b/arch/sparc/include/asm/io-unit.h index 01ab2f613e91..04a9701e7202 100644 --- a/arch/sparc/include/asm/io-unit.h +++ b/arch/sparc/include/asm/io-unit.h | |||
@@ -43,7 +43,7 @@ | |||
43 | struct iounit_struct { | 43 | struct iounit_struct { |
44 | unsigned long bmap[(IOUNIT_DMA_SIZE >> (PAGE_SHIFT + 3)) / sizeof(unsigned long)]; | 44 | unsigned long bmap[(IOUNIT_DMA_SIZE >> (PAGE_SHIFT + 3)) / sizeof(unsigned long)]; |
45 | spinlock_t lock; | 45 | spinlock_t lock; |
46 | iopte_t *page_table; | 46 | iopte_t __iomem *page_table; |
47 | unsigned long rotor[3]; | 47 | unsigned long rotor[3]; |
48 | unsigned long limit[4]; | 48 | unsigned long limit[4]; |
49 | }; | 49 | }; |
diff --git a/arch/sparc/mm/io-unit.c b/arch/sparc/mm/io-unit.c index eb99862e9654..f311bf219016 100644 --- a/arch/sparc/mm/io-unit.c +++ b/arch/sparc/mm/io-unit.c | |||
@@ -25,6 +25,8 @@ | |||
25 | #include <asm/dma.h> | 25 | #include <asm/dma.h> |
26 | #include <asm/oplib.h> | 26 | #include <asm/oplib.h> |
27 | 27 | ||
28 | #include "mm_32.h" | ||
29 | |||
28 | /* #define IOUNIT_DEBUG */ | 30 | /* #define IOUNIT_DEBUG */ |
29 | #ifdef IOUNIT_DEBUG | 31 | #ifdef IOUNIT_DEBUG |
30 | #define IOD(x) printk(x) | 32 | #define IOD(x) printk(x) |
@@ -38,7 +40,8 @@ | |||
38 | static void __init iounit_iommu_init(struct platform_device *op) | 40 | static void __init iounit_iommu_init(struct platform_device *op) |
39 | { | 41 | { |
40 | struct iounit_struct *iounit; | 42 | struct iounit_struct *iounit; |
41 | iopte_t *xpt, *xptend; | 43 | iopte_t __iomem *xpt; |
44 | iopte_t __iomem *xptend; | ||
42 | 45 | ||
43 | iounit = kzalloc(sizeof(struct iounit_struct), GFP_ATOMIC); | 46 | iounit = kzalloc(sizeof(struct iounit_struct), GFP_ATOMIC); |
44 | if (!iounit) { | 47 | if (!iounit) { |
@@ -62,10 +65,10 @@ static void __init iounit_iommu_init(struct platform_device *op) | |||
62 | op->dev.archdata.iommu = iounit; | 65 | op->dev.archdata.iommu = iounit; |
63 | iounit->page_table = xpt; | 66 | iounit->page_table = xpt; |
64 | spin_lock_init(&iounit->lock); | 67 | spin_lock_init(&iounit->lock); |
65 | 68 | ||
66 | for (xptend = iounit->page_table + (16 * PAGE_SIZE) / sizeof(iopte_t); | 69 | xptend = iounit->page_table + (16 * PAGE_SIZE) / sizeof(iopte_t); |
67 | xpt < xptend;) | 70 | for (; xpt < xptend; xpt++) |
68 | iopte_val(*xpt++) = 0; | 71 | sbus_writel(0, xpt); |
69 | } | 72 | } |
70 | 73 | ||
71 | static int __init iounit_init(void) | 74 | static int __init iounit_init(void) |
@@ -130,7 +133,7 @@ nexti: scan = find_next_zero_bit(iounit->bmap, limit, scan); | |||
130 | vaddr = IOUNIT_DMA_BASE + (scan << PAGE_SHIFT) + (vaddr & ~PAGE_MASK); | 133 | vaddr = IOUNIT_DMA_BASE + (scan << PAGE_SHIFT) + (vaddr & ~PAGE_MASK); |
131 | for (k = 0; k < npages; k++, iopte = __iopte(iopte_val(iopte) + 0x100), scan++) { | 134 | for (k = 0; k < npages; k++, iopte = __iopte(iopte_val(iopte) + 0x100), scan++) { |
132 | set_bit(scan, iounit->bmap); | 135 | set_bit(scan, iounit->bmap); |
133 | iounit->page_table[scan] = iopte; | 136 | sbus_writel(iopte, &iounit->page_table[scan]); |
134 | } | 137 | } |
135 | IOD(("%08lx\n", vaddr)); | 138 | IOD(("%08lx\n", vaddr)); |
136 | return vaddr; | 139 | return vaddr; |
@@ -202,7 +205,7 @@ static int iounit_map_dma_area(struct device *dev, dma_addr_t *pba, unsigned lon | |||
202 | struct iounit_struct *iounit = dev->archdata.iommu; | 205 | struct iounit_struct *iounit = dev->archdata.iommu; |
203 | unsigned long page, end; | 206 | unsigned long page, end; |
204 | pgprot_t dvma_prot; | 207 | pgprot_t dvma_prot; |
205 | iopte_t *iopte; | 208 | iopte_t __iomem *iopte; |
206 | 209 | ||
207 | *pba = addr; | 210 | *pba = addr; |
208 | 211 | ||
@@ -224,8 +227,8 @@ static int iounit_map_dma_area(struct device *dev, dma_addr_t *pba, unsigned lon | |||
224 | 227 | ||
225 | i = ((addr - IOUNIT_DMA_BASE) >> PAGE_SHIFT); | 228 | i = ((addr - IOUNIT_DMA_BASE) >> PAGE_SHIFT); |
226 | 229 | ||
227 | iopte = (iopte_t *)(iounit->page_table + i); | 230 | iopte = iounit->page_table + i; |
228 | *iopte = MKIOPTE(__pa(page)); | 231 | sbus_writel(MKIOPTE(__pa(page)), iopte); |
229 | } | 232 | } |
230 | addr += PAGE_SIZE; | 233 | addr += PAGE_SIZE; |
231 | va += PAGE_SIZE; | 234 | va += PAGE_SIZE; |