sparc: Move SBUS DMA attribute interfaces out of asm/sbus.h
authorDavid S. Miller <davem@davemloft.net>
Wed, 27 Aug 2008 06:33:42 +0000 (23:33 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 29 Aug 2008 09:13:31 +0000 (02:13 -0700)
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>
12 files changed:
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

index 10d7da450070c952a8e2094375676067b50752de..3ab3164bd73502138ebf1c9070406aa2a370ebb1 100644 (file)
@@ -308,6 +308,17 @@ extern void sbus_iounmap(volatile void __iomem *vaddr, unsigned long size);
 #define RTC_PORT(x)   (rtc_port + (x))
 #define RTC_ALWAYS_BCD  0
 
+static inline int sbus_can_dma_64bit(void)
+{
+       return 0; /* actually, sparc_cpu_model==sun4d */
+}
+static inline int sbus_can_burst64(void)
+{
+       return 0; /* actually, sparc_cpu_model==sun4d */
+}
+struct device;
+extern void sbus_set_sbus64(struct device *, int);
+
 #endif
 
 #define __ARCH_HAS_NO_PAGE_ZERO_MAPPED         1
index 0bff078ffdd05a223060c5a06f9428108949baa5..73a9c5d41954b4f1c2695de9b05eaea70d66f9c6 100644 (file)
@@ -495,6 +495,17 @@ extern void pci_iounmap(struct pci_dev *dev, void __iomem *);
 #define sbus_iounmap(__addr, __size)   \
        release_region((unsigned long)(__addr), (__size))
 
+static inline int sbus_can_dma_64bit(void)
+{
+       return 1;
+}
+static inline int sbus_can_burst64(void)
+{
+       return 1;
+}
+struct device;
+extern void sbus_set_sbus64(struct device *, int);
+
 /*
  * Convert a physical pointer to a virtual kernel pointer for /dev/mem
  * access
index b09284b5ee063ea5b94d55c0167978c3c57e5063..435ae394d2bd1894bf5b6a3d3417e558e035bde2 100644 (file)
@@ -102,10 +102,6 @@ sbus_is_slave(struct sbus_dev *dev)
        for ((bus) = sbus_root; (bus); (bus) = (bus)->next) \
                for ((device) = (bus)->devices; (device); (device) = (device)->next)
 
-/* Driver DVMA interfaces. */
-#define sbus_can_dma_64bit(sdev)       (0) /* actually, sparc_cpu_model==sun4d */
-#define sbus_can_burst64(sdev)         (0) /* actually, sparc_cpu_model==sun4d */
-extern void sbus_set_sbus64(struct sbus_dev *, int);
 extern void sbus_fill_device_irq(struct sbus_dev *);
 
 /* These yield IOMMU mappings in consistent mode. */
index 9a2f27188f6adc81f6b88f857f8f47e2f9550276..79719c2e5fa6fab4240d06b12ae2abfac49bcb47 100644 (file)
@@ -94,10 +94,6 @@ extern struct sbus_bus *sbus_root;
        for ((bus) = sbus_root; (bus); (bus) = (bus)->next) \
                for ((device) = (bus)->devices; (device); (device) = (device)->next)
 
-/* Driver DVMA interfaces. */
-#define sbus_can_dma_64bit(sdev)       (1)
-#define sbus_can_burst64(sdev)         (1)
-extern void sbus_set_sbus64(struct sbus_dev *, int);
 extern void sbus_fill_device_irq(struct sbus_dev *);
 
 extern void sbus_arch_bus_ranges_init(struct device_node *, struct sbus_bus *);
index 0b3035978e0d2d6cdca13943c0cb022ff61b0caf..e87ed519ffaf6e5cf962e0011a3e62dde62652e3 100644 (file)
@@ -250,7 +250,7 @@ static void _sparc_free_io(struct resource *res)
 
 #ifdef CONFIG_SBUS
 
-void sbus_set_sbus64(struct sbus_dev *sdev, int x)
+void sbus_set_sbus64(struct device *dev, int x)
 {
        printk("sbus_set_sbus64: unsupported\n");
 }
index e33a8a660e9e5ab0ca27199732b7758dde3d8819..aa47022e13f3960578e78d3ead27574136ba3bef 100644 (file)
 #define STRBUF_TAG_VALID       0x02UL
 
 /* Enable 64-bit DVMA mode for the given device. */
-void sbus_set_sbus64(struct sbus_dev *sdev, int bursts)
+void sbus_set_sbus64(struct device *dev, int bursts)
 {
-       struct iommu *iommu = sdev->ofdev.dev.archdata.iommu;
-       int slot = sdev->slot;
+       struct iommu *iommu = dev->archdata.iommu;
+       struct of_device *op = to_of_device(dev);
+       const struct linux_prom_registers *regs;
        unsigned long cfg_reg;
+       int slot;
        u64 val;
 
+       regs = of_get_property(op->node, "reg", NULL);
+       if (!regs) {
+               printk(KERN_ERR "sbus_set_sbus64: Cannot find regs for %s\n",
+                      op->node->full_name);
+               return;
+       }
+       slot = regs->which_io;
+
        cfg_reg = iommu->write_complete_reg;
        switch (slot) {
        case 0:
index f607e59bffae1a832521f8e9ba7a134b9b118edd..7213590b485d6b88784e99d4a588e076770a5a5a 100644 (file)
@@ -819,8 +819,8 @@ fore200e_sba_map(struct fore200e* fore200e)
     /* get the supported DVMA burst sizes */
     bursts = prom_getintdefault(sbus_dev->bus->prom_node, "burst-sizes", 0x00);
 
-    if (sbus_can_dma_64bit(sbus_dev))
-       sbus_set_sbus64(sbus_dev, bursts);
+    if (sbus_can_dma_64bit())
+       sbus_set_sbus64(&sbus_dev->ofdev.dev, bursts);
 
     fore200e->state = FORE200E_STATE_MAP;
     return 0;
index 858880b619ced8d4853118d5cf6f5eef710c1033..f2a3ff24de44012809cc93e3fab1a93dc15b1216 100644 (file)
@@ -1050,7 +1050,7 @@ static int __devinit myri_ether_init(struct sbus_dev *sdev)
        mp->myri_bursts = prom_getintdefault(mp->myri_sdev->bus->prom_node,
                                             "burst-sizes", 0x00);
 
-       if (!sbus_can_burst64(sdev))
+       if (!sbus_can_burst64())
                mp->myri_bursts &= ~(DMA_BURST64);
 
        DET(("MYRI bursts %02x\n", mp->myri_bursts));
index 69cc77192961f1044899a2c0cc966030896eb441..d15da947c56ae9b076af4ce202e2873a81b40bde 100644 (file)
@@ -1575,7 +1575,7 @@ static int happy_meal_init(struct happy_meal *hp)
        if ((hp->happy_bursts & DMA_BURST64) &&
            ((hp->happy_flags & HFLAG_PCI) != 0
 #ifdef CONFIG_SBUS
-            || sbus_can_burst64(hp->happy_dev)
+            || sbus_can_burst64()
 #endif
             || 0)) {
                u32 gcfg = GREG_CFG_BURST64;
@@ -1585,11 +1585,13 @@ static int happy_meal_init(struct happy_meal *hp)
                 * do not.  -DaveM
                 */
 #ifdef CONFIG_SBUS
-               if ((hp->happy_flags & HFLAG_PCI) == 0 &&
-                   sbus_can_dma_64bit(hp->happy_dev)) {
-                       sbus_set_sbus64(hp->happy_dev,
-                                       hp->happy_bursts);
-                       gcfg |= GREG_CFG_64BIT;
+               if ((hp->happy_flags & HFLAG_PCI) == 0) {
+                       struct sbus_dev *sdev = hp->happy_dev;
+                       if (sbus_can_dma_64bit()) {
+                               sbus_set_sbus64(&sdev->ofdev.dev,
+                                               hp->happy_bursts);
+                               gcfg |= GREG_CFG_64BIT;
+                       }
                }
 #endif
 
index 66f66ee8ca637fc2c6a29b12123a0cb7329a68ca..4521972fbf3d2b2524c8b6672ef7b422834881c2 100644 (file)
@@ -722,7 +722,7 @@ static inline void qec_init_once(struct sunqec *qecp, struct sbus_dev *qsdev)
 {
        u8 bsizes = qecp->qec_bursts;
 
-       if (sbus_can_burst64(qsdev) && (bsizes & DMA_BURST64)) {
+       if (sbus_can_burst64() && (bsizes & DMA_BURST64)) {
                sbus_writel(GLOB_CTRL_B64, qecp->gregs + GLOB_CTRL);
        } else if (bsizes & DMA_BURST32) {
                sbus_writel(GLOB_CTRL_B32, qecp->gregs + GLOB_CTRL);
index 1559d455b2b7fc5134a88db0d0e75ee5556408fb..e16c56c515f1dfe85da1c7e270ec345b44190a4b 100644 (file)
@@ -158,7 +158,7 @@ static inline void set_sbus_cfg1(struct qlogicpti *qpti)
         * is a nop and the chip ends up using the smallest burst
         * size. -DaveM
         */
-       if (sbus_can_burst64(qpti->sdev) && (bursts & DMA_BURST64)) {
+       if (sbus_can_burst64() && (bursts & DMA_BURST64)) {
                val = (SBUS_CFG1_BENAB | SBUS_CFG1_B64);
        } else
 #endif
index f7508743f70512d949001591800e27f1d9edaa76..ea0c572c75046848e23f2c932a5271e8b64699c0 100644 (file)
@@ -265,15 +265,17 @@ static void sbus_esp_reset_dma(struct esp *esp)
 {
        int can_do_burst16, can_do_burst32, can_do_burst64;
        int can_do_sbus64, lim;
+       struct sbus_dev *sdev;
        u32 val;
 
        can_do_burst16 = (esp->bursts & DMA_BURST16) != 0;
        can_do_burst32 = (esp->bursts & DMA_BURST32) != 0;
        can_do_burst64 = 0;
        can_do_sbus64 = 0;
-       if (sbus_can_dma_64bit(esp->dev))
+       sdev = esp->dev;
+       if (sbus_can_dma_64bit())
                can_do_sbus64 = 1;
-       if (sbus_can_burst64(esp->sdev))
+       if (sbus_can_burst64())
                can_do_burst64 = (esp->bursts & DMA_BURST64) != 0;
 
        /* Put the DVMA into a known state. */
@@ -300,7 +302,7 @@ static void sbus_esp_reset_dma(struct esp *esp)
 
                if (can_do_sbus64) {
                        esp->prev_hme_dmacsr |= DMA_SCSI_SBUS64;
-                       sbus_set_sbus64(esp->dev, esp->bursts);
+                       sbus_set_sbus64(&sdev->ofdev.dev, esp->bursts);
                }
 
                lim = 1000;
This page took 0.032253 seconds and 5 git commands to generate.