Add more ar7 fixes by DerAgo. Fix vlnyq initialistion on fritzbox, add prom_printf...
[openwrt.git] / target / linux / ar7-2.6 / files / arch / mips / ar7 / vlynq.c
index 80cb836..e085c5b 100644 (file)
@@ -32,6 +32,7 @@
 #include <linux/device.h>
 #include <asm/addrspace.h>
 #include <asm/io.h>
 #include <linux/device.h>
 #include <asm/addrspace.h>
 #include <asm/io.h>
+#include <asm/ar7/ar7.h>
 #include <asm/ar7/vlynq.h>
 
 #define PER_DEVICE_IRQS 32
 #include <asm/ar7/vlynq.h>
 
 #define PER_DEVICE_IRQS 32
@@ -117,7 +118,7 @@ static void vlynq_irq_unmask(unsigned int irq)
        BUG_ON(!dev);
        virq = irq - dev->irq_start;
        val = dev->remote->int_device[virq >> 2];
        BUG_ON(!dev);
        virq = irq - dev->irq_start;
        val = dev->remote->int_device[virq >> 2];
-       val |= VINT_ENABLE << VINT_OFFSET(virq);
+       val |= (VINT_ENABLE | virq) << VINT_OFFSET(virq);
        dev->remote->int_device[virq >> 2] = val;
 }
 
        dev->remote->int_device[virq >> 2] = val;
 }
 
@@ -196,10 +197,11 @@ static irqreturn_t vlynq_irq(int irq, void *dev_id)
 }
 
 static struct irq_chip vlynq_irq_chip = {
 }
 
 static struct irq_chip vlynq_irq_chip = {
+        .typename = "VLYNQ",
         .name = "vlynq",
         .unmask = vlynq_irq_unmask,
         .mask = vlynq_irq_mask,
         .name = "vlynq",
         .unmask = vlynq_irq_unmask,
         .mask = vlynq_irq_mask,
-       .set_type = vlynq_irq_type,
+        .set_type = vlynq_irq_type,
 };
 
 static int vlynq_setup_irq(struct vlynq_device *dev)
 };
 
 static int vlynq_setup_irq(struct vlynq_device *dev)
@@ -235,7 +237,7 @@ static int vlynq_setup_irq(struct vlynq_device *dev)
                dev->remote->int_device[i >> 2] = 0;
        }
 
                dev->remote->int_device[i >> 2] = 0;
        }
 
-       if (request_irq(dev->irq, vlynq_irq, SA_SHIRQ, "AR7 VLYNQ", dev)) {
+       if (request_irq(dev->irq, vlynq_irq, SA_SHIRQ, "vlynq", dev)) {
                printk("%s: request_irq failed\n", dev->dev.bus_id);
                return -EAGAIN;
        }
                printk("%s: request_irq failed\n", dev->dev.bus_id);
                return -EAGAIN;
        }
@@ -287,7 +289,7 @@ EXPORT_SYMBOL(vlynq_unregister_driver);
 
 int vlynq_device_enable(struct vlynq_device *dev)
 {
 
 int vlynq_device_enable(struct vlynq_device *dev)
 {
-       u32 val;
+    u32 div;
        int result;
        struct plat_vlynq_ops *ops = dev->dev.platform_data;
 
        int result;
        struct plat_vlynq_ops *ops = dev->dev.platform_data;
 
@@ -298,15 +300,24 @@ int vlynq_device_enable(struct vlynq_device *dev)
        dev->local->control = 0;
        dev->remote->control = 0;
 
        dev->local->control = 0;
        dev->remote->control = 0;
 
-       if (vlynq_linked(dev)) 
+    div = ar7_dsp_freq() / 62500000;
+    if(ar7_dsp_freq() / div != 62500000)
+    {
+               printk(KERN_WARNING
+                      "VLYNQ: Adjusted requested frequency %d to %d\n",
+                      62500000, ar7_dsp_freq() / div);
+    }
+    
+    printk("VLYNQ: Setting clock to %d (clock divider %u)\n", ar7_dsp_freq() / div, div);
+       dev->local->control = VLYNQ_CTRL_CLOCK_DIV((div - 1)) |
+               VLYNQ_CTRL_CLOCK_INT;
+
+//     dev->local->control = VLYNQ_CTRL_CLOCK_INT;
+
+    if (vlynq_linked(dev)) 
                return vlynq_setup_irq(dev);
 
                return vlynq_setup_irq(dev);
 
-       for (val = 0; val < 8; val++) {
-               dev->local->control = VLYNQ_CTRL_CLOCK_DIV(val) |
-                       VLYNQ_CTRL_CLOCK_INT;
-               if (vlynq_linked(dev)) 
-                       return vlynq_setup_irq(dev);
-       }
+    return -ENODEV;
 }
 
 void vlynq_device_disable(struct vlynq_device *dev)
 }
 
 void vlynq_device_disable(struct vlynq_device *dev)
This page took 0.042429 seconds and 4 git commands to generate.