Re: How do we allocate virtual floppy irq on sparc64

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 
> So I will look up "SUNW,fdtwo" + "fd" to find the platform_device
> for floppy.
> And in that platform_device I can find the already allocated irq.

Looks like this in patch format.
Not tested yet as I still need to adapt irq_32.c...

	Sam

--- a/arch/sparc/include/asm/floppy_32.h
+++ b/arch/sparc/include/asm/floppy_32.h
@@ -303,6 +303,8 @@ static struct linux_prom_registers fd_regs[2];

 static int sun_floppy_init(void)
 {
+       struct platform_device *op;
+       struct device_node *dp;
        char state[128];
        phandle tnode, fd_node;
        int num_regs;
@@ -310,7 +312,6 @@ static int sun_floppy_init(void)

        use_virtual_dma = 1;

-       FLOPPY_IRQ = 11;
        /* Forget it if we aren't on a machine that could possibly
         * ever have a floppy drive.
         */
@@ -349,6 +350,26 @@ static int sun_floppy_init(void)
        sun_fdc = (struct sun_flpy_controller *)
            of_ioremap(&r, 0, fd_regs[0].reg_size, "floppy");

+       /*
+        * Look up irq in platform_device.
+        * We try "SUNW,fdtwo" and "fd"
+        */
+       for_each_node_by_name(dp, "SUNW,fdtwo") {
+               op = of_find_device_by_node(dp);
+               if (op)
+                       break;
+       }
+       if (!op) {
+               for_each_node_by_name(dp, "fd") {
+                       op = of_find_device_by_node(dp);
+                       if (op)
+                               break;
+               }
+       }
+       if (!op)
+               goto no_sun_fdc;
+
+       FLOPPY_IRQ = op->archdata.irqs[0];
+
        /* Last minute sanity check... */
        if(sun_fdc->status_82072 == 0xff) {
                sun_fdc = NULL;

--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel Development]     [DCCP]     [Linux ARM Development]     [Linux]     [Photo]     [Yosemite Help]     [Linux ARM Kernel]     [Linux SCSI]     [Linux x86_64]     [Linux Hams]

  Powered by Linux