Commit 63237eeb5ac92d618a0a6055f4b1f65c5d14682b
1 parent
738f2b7b81
Exists in
master
and in
7 other branches
sparc: Move SBUS DMA attribute interfaces out of asm/sbus.h
This is in preparation for the subsequent asm/sbus.h removal. Also, make these routines take a "struct device" or no arguments, as appropriate. Signed-off-by: David S. Miller <davem@davemloft.net>
Showing 12 changed files with 54 additions and 26 deletions Side-by-side Diff
- arch/sparc/include/asm/io_32.h
- arch/sparc/include/asm/io_64.h
- arch/sparc/include/asm/sbus_32.h
- arch/sparc/include/asm/sbus_64.h
- arch/sparc/kernel/ioport.c
- arch/sparc64/kernel/sbus.c
- drivers/atm/fore200e.c
- drivers/net/myri_sbus.c
- drivers/net/sunhme.c
- drivers/net/sunqe.c
- drivers/scsi/qlogicpti.c
- drivers/scsi/sun_esp.c
arch/sparc/include/asm/io_32.h
... | ... | @@ -308,6 +308,17 @@ |
308 | 308 | #define RTC_PORT(x) (rtc_port + (x)) |
309 | 309 | #define RTC_ALWAYS_BCD 0 |
310 | 310 | |
311 | +static inline int sbus_can_dma_64bit(void) | |
312 | +{ | |
313 | + return 0; /* actually, sparc_cpu_model==sun4d */ | |
314 | +} | |
315 | +static inline int sbus_can_burst64(void) | |
316 | +{ | |
317 | + return 0; /* actually, sparc_cpu_model==sun4d */ | |
318 | +} | |
319 | +struct device; | |
320 | +extern void sbus_set_sbus64(struct device *, int); | |
321 | + | |
311 | 322 | #endif |
312 | 323 | |
313 | 324 | #define __ARCH_HAS_NO_PAGE_ZERO_MAPPED 1 |
arch/sparc/include/asm/io_64.h
... | ... | @@ -495,6 +495,17 @@ |
495 | 495 | #define sbus_iounmap(__addr, __size) \ |
496 | 496 | release_region((unsigned long)(__addr), (__size)) |
497 | 497 | |
498 | +static inline int sbus_can_dma_64bit(void) | |
499 | +{ | |
500 | + return 1; | |
501 | +} | |
502 | +static inline int sbus_can_burst64(void) | |
503 | +{ | |
504 | + return 1; | |
505 | +} | |
506 | +struct device; | |
507 | +extern void sbus_set_sbus64(struct device *, int); | |
508 | + | |
498 | 509 | /* |
499 | 510 | * Convert a physical pointer to a virtual kernel pointer for /dev/mem |
500 | 511 | * access |
arch/sparc/include/asm/sbus_32.h
... | ... | @@ -102,10 +102,6 @@ |
102 | 102 | for ((bus) = sbus_root; (bus); (bus) = (bus)->next) \ |
103 | 103 | for ((device) = (bus)->devices; (device); (device) = (device)->next) |
104 | 104 | |
105 | -/* Driver DVMA interfaces. */ | |
106 | -#define sbus_can_dma_64bit(sdev) (0) /* actually, sparc_cpu_model==sun4d */ | |
107 | -#define sbus_can_burst64(sdev) (0) /* actually, sparc_cpu_model==sun4d */ | |
108 | -extern void sbus_set_sbus64(struct sbus_dev *, int); | |
109 | 105 | extern void sbus_fill_device_irq(struct sbus_dev *); |
110 | 106 | |
111 | 107 | /* These yield IOMMU mappings in consistent mode. */ |
arch/sparc/include/asm/sbus_64.h
... | ... | @@ -94,10 +94,6 @@ |
94 | 94 | for ((bus) = sbus_root; (bus); (bus) = (bus)->next) \ |
95 | 95 | for ((device) = (bus)->devices; (device); (device) = (device)->next) |
96 | 96 | |
97 | -/* Driver DVMA interfaces. */ | |
98 | -#define sbus_can_dma_64bit(sdev) (1) | |
99 | -#define sbus_can_burst64(sdev) (1) | |
100 | -extern void sbus_set_sbus64(struct sbus_dev *, int); | |
101 | 97 | extern void sbus_fill_device_irq(struct sbus_dev *); |
102 | 98 | |
103 | 99 | extern void sbus_arch_bus_ranges_init(struct device_node *, struct sbus_bus *); |
arch/sparc/kernel/ioport.c
arch/sparc64/kernel/sbus.c
... | ... | @@ -52,12 +52,22 @@ |
52 | 52 | #define STRBUF_TAG_VALID 0x02UL |
53 | 53 | |
54 | 54 | /* Enable 64-bit DVMA mode for the given device. */ |
55 | -void sbus_set_sbus64(struct sbus_dev *sdev, int bursts) | |
55 | +void sbus_set_sbus64(struct device *dev, int bursts) | |
56 | 56 | { |
57 | - struct iommu *iommu = sdev->ofdev.dev.archdata.iommu; | |
58 | - int slot = sdev->slot; | |
57 | + struct iommu *iommu = dev->archdata.iommu; | |
58 | + struct of_device *op = to_of_device(dev); | |
59 | + const struct linux_prom_registers *regs; | |
59 | 60 | unsigned long cfg_reg; |
61 | + int slot; | |
60 | 62 | u64 val; |
63 | + | |
64 | + regs = of_get_property(op->node, "reg", NULL); | |
65 | + if (!regs) { | |
66 | + printk(KERN_ERR "sbus_set_sbus64: Cannot find regs for %s\n", | |
67 | + op->node->full_name); | |
68 | + return; | |
69 | + } | |
70 | + slot = regs->which_io; | |
61 | 71 | |
62 | 72 | cfg_reg = iommu->write_complete_reg; |
63 | 73 | switch (slot) { |
drivers/atm/fore200e.c
... | ... | @@ -819,8 +819,8 @@ |
819 | 819 | /* get the supported DVMA burst sizes */ |
820 | 820 | bursts = prom_getintdefault(sbus_dev->bus->prom_node, "burst-sizes", 0x00); |
821 | 821 | |
822 | - if (sbus_can_dma_64bit(sbus_dev)) | |
823 | - sbus_set_sbus64(sbus_dev, bursts); | |
822 | + if (sbus_can_dma_64bit()) | |
823 | + sbus_set_sbus64(&sbus_dev->ofdev.dev, bursts); | |
824 | 824 | |
825 | 825 | fore200e->state = FORE200E_STATE_MAP; |
826 | 826 | return 0; |
drivers/net/myri_sbus.c
... | ... | @@ -1050,7 +1050,7 @@ |
1050 | 1050 | mp->myri_bursts = prom_getintdefault(mp->myri_sdev->bus->prom_node, |
1051 | 1051 | "burst-sizes", 0x00); |
1052 | 1052 | |
1053 | - if (!sbus_can_burst64(sdev)) | |
1053 | + if (!sbus_can_burst64()) | |
1054 | 1054 | mp->myri_bursts &= ~(DMA_BURST64); |
1055 | 1055 | |
1056 | 1056 | DET(("MYRI bursts %02x\n", mp->myri_bursts)); |
drivers/net/sunhme.c
... | ... | @@ -1575,7 +1575,7 @@ |
1575 | 1575 | if ((hp->happy_bursts & DMA_BURST64) && |
1576 | 1576 | ((hp->happy_flags & HFLAG_PCI) != 0 |
1577 | 1577 | #ifdef CONFIG_SBUS |
1578 | - || sbus_can_burst64(hp->happy_dev) | |
1578 | + || sbus_can_burst64() | |
1579 | 1579 | #endif |
1580 | 1580 | || 0)) { |
1581 | 1581 | u32 gcfg = GREG_CFG_BURST64; |
... | ... | @@ -1585,11 +1585,13 @@ |
1585 | 1585 | * do not. -DaveM |
1586 | 1586 | */ |
1587 | 1587 | #ifdef CONFIG_SBUS |
1588 | - if ((hp->happy_flags & HFLAG_PCI) == 0 && | |
1589 | - sbus_can_dma_64bit(hp->happy_dev)) { | |
1590 | - sbus_set_sbus64(hp->happy_dev, | |
1591 | - hp->happy_bursts); | |
1592 | - gcfg |= GREG_CFG_64BIT; | |
1588 | + if ((hp->happy_flags & HFLAG_PCI) == 0) { | |
1589 | + struct sbus_dev *sdev = hp->happy_dev; | |
1590 | + if (sbus_can_dma_64bit()) { | |
1591 | + sbus_set_sbus64(&sdev->ofdev.dev, | |
1592 | + hp->happy_bursts); | |
1593 | + gcfg |= GREG_CFG_64BIT; | |
1594 | + } | |
1593 | 1595 | } |
1594 | 1596 | #endif |
1595 | 1597 |
drivers/net/sunqe.c
... | ... | @@ -722,7 +722,7 @@ |
722 | 722 | { |
723 | 723 | u8 bsizes = qecp->qec_bursts; |
724 | 724 | |
725 | - if (sbus_can_burst64(qsdev) && (bsizes & DMA_BURST64)) { | |
725 | + if (sbus_can_burst64() && (bsizes & DMA_BURST64)) { | |
726 | 726 | sbus_writel(GLOB_CTRL_B64, qecp->gregs + GLOB_CTRL); |
727 | 727 | } else if (bsizes & DMA_BURST32) { |
728 | 728 | sbus_writel(GLOB_CTRL_B32, qecp->gregs + GLOB_CTRL); |
drivers/scsi/qlogicpti.c
... | ... | @@ -158,7 +158,7 @@ |
158 | 158 | * is a nop and the chip ends up using the smallest burst |
159 | 159 | * size. -DaveM |
160 | 160 | */ |
161 | - if (sbus_can_burst64(qpti->sdev) && (bursts & DMA_BURST64)) { | |
161 | + if (sbus_can_burst64() && (bursts & DMA_BURST64)) { | |
162 | 162 | val = (SBUS_CFG1_BENAB | SBUS_CFG1_B64); |
163 | 163 | } else |
164 | 164 | #endif |
drivers/scsi/sun_esp.c
... | ... | @@ -265,15 +265,17 @@ |
265 | 265 | { |
266 | 266 | int can_do_burst16, can_do_burst32, can_do_burst64; |
267 | 267 | int can_do_sbus64, lim; |
268 | + struct sbus_dev *sdev; | |
268 | 269 | u32 val; |
269 | 270 | |
270 | 271 | can_do_burst16 = (esp->bursts & DMA_BURST16) != 0; |
271 | 272 | can_do_burst32 = (esp->bursts & DMA_BURST32) != 0; |
272 | 273 | can_do_burst64 = 0; |
273 | 274 | can_do_sbus64 = 0; |
274 | - if (sbus_can_dma_64bit(esp->dev)) | |
275 | + sdev = esp->dev; | |
276 | + if (sbus_can_dma_64bit()) | |
275 | 277 | can_do_sbus64 = 1; |
276 | - if (sbus_can_burst64(esp->sdev)) | |
278 | + if (sbus_can_burst64()) | |
277 | 279 | can_do_burst64 = (esp->bursts & DMA_BURST64) != 0; |
278 | 280 | |
279 | 281 | /* Put the DVMA into a known state. */ |
... | ... | @@ -300,7 +302,7 @@ |
300 | 302 | |
301 | 303 | if (can_do_sbus64) { |
302 | 304 | esp->prev_hme_dmacsr |= DMA_SCSI_SBUS64; |
303 | - sbus_set_sbus64(esp->dev, esp->bursts); | |
305 | + sbus_set_sbus64(&sdev->ofdev.dev, esp->bursts); | |
304 | 306 | } |
305 | 307 | |
306 | 308 | lim = 1000; |