]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - include/asm-sparc64/floppy.h
Merge master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6
[linux-2.6-omap-h63xx.git] / include / asm-sparc64 / floppy.h
index f8d57bb5570ca242190ddd4461c2560d509736e7..4aa0925e1b1b6b784bf83850deb28a0be5b5e449 100644 (file)
@@ -208,7 +208,55 @@ static void sun_fd_enable_dma(void)
        pdma_areasize = pdma_size;
 }
 
-extern irqreturn_t sparc_floppy_irq(int, void *, struct pt_regs *);
+irqreturn_t sparc_floppy_irq(int irq, void *dev_cookie)
+{
+       if (likely(doing_pdma)) {
+               void __iomem *stat = (void __iomem *) fdc_status;
+               unsigned char *vaddr = pdma_vaddr;
+               unsigned long size = pdma_size;
+               u8 val;
+
+               while (size) {
+                       val = readb(stat);
+                       if (unlikely(!(val & 0x80))) {
+                               pdma_vaddr = vaddr;
+                               pdma_size = size;
+                               return IRQ_HANDLED;
+                       }
+                       if (unlikely(!(val & 0x20))) {
+                               pdma_vaddr = vaddr;
+                               pdma_size = size;
+                               doing_pdma = 0;
+                               goto main_interrupt;
+                       }
+                       if (val & 0x40) {
+                               /* read */
+                               *vaddr++ = readb(stat + 1);
+                       } else {
+                               unsigned char data = *vaddr++;
+
+                               /* write */
+                               writeb(data, stat + 1);
+                       }
+                       size--;
+               }
+
+               pdma_vaddr = vaddr;
+               pdma_size = size;
+
+               /* Send Terminal Count pulse to floppy controller. */
+               val = readb(auxio_register);
+               val |= AUXIO_AUX1_FTCNT;
+               writeb(val, auxio_register);
+               val &= ~AUXIO_AUX1_FTCNT;
+               writeb(val, auxio_register);
+
+               doing_pdma = 0;
+       }
+
+main_interrupt:
+       return floppy_interrupt(irq, dev_cookie);
+}
 
 static int sun_fd_request_irq(void)
 {
@@ -219,7 +267,7 @@ static int sun_fd_request_irq(void)
                once = 1;
 
                error = request_irq(FLOPPY_IRQ, sparc_floppy_irq, 
-                                   SA_INTERRUPT, "floppy", NULL);
+                                   IRQF_DISABLED, "floppy", NULL);
 
                return ((error == 0) ? 0 : -1);
        }
@@ -263,7 +311,7 @@ struct sun_pci_dma_op {
 static struct sun_pci_dma_op sun_pci_dma_current = { -1U, 0, 0, NULL};
 static struct sun_pci_dma_op sun_pci_dma_pending = { -1U, 0, 0, NULL};
 
-extern irqreturn_t floppy_interrupt(int irq, void *dev_id, struct pt_regs *regs);
+extern irqreturn_t floppy_interrupt(int irq, void *dev_id);
 
 static unsigned char sun_pci_fd_inb(unsigned long port)
 {
@@ -398,7 +446,7 @@ static int sun_pci_fd_eject(int drive)
 
 void sun_pci_fd_dma_callback(struct ebus_dma_info *p, int event, void *cookie)
 {
-       floppy_interrupt(0, NULL, NULL);
+       floppy_interrupt(0, NULL);
 }
 
 /*
@@ -501,7 +549,7 @@ static int __init ebus_fdthree_p(struct linux_ebus_device *edev)
        if (!strcmp(edev->prom_node->name, "fdthree"))
                return 1;
        if (!strcmp(edev->prom_node->name, "floppy")) {
-               char *compat;
+               const char *compat;
 
                compat = of_get_property(edev->prom_node,
                                         "compatible", NULL);
@@ -613,7 +661,7 @@ static unsigned long __init sun_floppy_init(void)
                struct linux_ebus_device *edev = NULL;
                unsigned long config = 0;
                void __iomem *auxio_reg;
-               char *state_prop;
+               const char *state_prop;
 
                for_each_ebus(ebus) {
                        for_each_ebusdev(edev, ebus) {
@@ -806,4 +854,15 @@ static unsigned long __init sun_floppy_init(void)
 
 #define EXTRA_FLOPPY_PARAMS
 
+static DEFINE_SPINLOCK(dma_spin_lock);
+
+#define claim_dma_lock() \
+({     unsigned long flags; \
+       spin_lock_irqsave(&dma_spin_lock, flags); \
+       flags; \
+})
+
+#define release_dma_lock(__flags) \
+       spin_unlock_irqrestore(&dma_spin_lock, __flags);
+
 #endif /* !(__ASM_SPARC64_FLOPPY_H) */