PXA can use EABI, too
[openwrt.git] / target / linux / ar7 / files / drivers / vlynq / vlynq.c
index 374562c..3358bb7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006, 2007 OpenWrt.org
+ * Copyright (C) 2006, 2007 Eugene Konev <ejka@openwrt.org>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -68,7 +68,7 @@ struct vlynq_regs {
        u32 autonego;
        u32 unused[6];
        u32 int_device[8];
-} __attribute__ ((packed));
+};
 
 #define vlynq_reg_read(reg) readl(&(reg))
 #define vlynq_reg_write(reg, val)  writel(val, &(reg))
@@ -369,9 +369,18 @@ static int __vlynq_enable_device(struct vlynq_device *dev)
        if (result)
                return result;
 
+       vlynq_reg_write(dev->local->control, 0);
+       vlynq_reg_write(dev->remote->control, 0);
+       if (vlynq_linked(dev)) {
+               printk(KERN_DEBUG "%s: using external clock\n",
+                       dev->dev.bus_id);
+               return 0;
+       }
+
        switch (dev->divisor) {
        case vlynq_div_auto:
                /* Only try locally supplied clock, others cause problems */
+               vlynq_reg_write(dev->local->control, 0);
                vlynq_reg_write(dev->remote->control, 0);
                for (i = vlynq_ldiv2; i <= vlynq_ldiv8; i++) {
                        vlynq_reg_write(dev->local->control,
@@ -387,11 +396,11 @@ static int __vlynq_enable_device(struct vlynq_device *dev)
                }
        case vlynq_ldiv1: case vlynq_ldiv2: case vlynq_ldiv3: case vlynq_ldiv4:
        case vlynq_ldiv5: case vlynq_ldiv6: case vlynq_ldiv7: case vlynq_ldiv8:
-               vlynq_reg_write(dev->remote->control, 0);
                vlynq_reg_write(dev->local->control,
                                VLYNQ_CTRL_CLOCK_INT |
                                VLYNQ_CTRL_CLOCK_DIV(dev->divisor -
                                                     vlynq_ldiv1));
+               vlynq_reg_write(dev->remote->control, 0);
                if (vlynq_linked(dev)) {
                        printk(KERN_DEBUG
                               "%s: using local clock divisor %d\n",
@@ -413,15 +422,6 @@ static int __vlynq_enable_device(struct vlynq_device *dev)
                        return 0;
                }
                break;
-       case vlynq_div_external:
-               vlynq_reg_write(dev->local->control, 0);
-               vlynq_reg_write(dev->remote->control, 0);
-               if (vlynq_linked(dev)) {
-                       printk(KERN_DEBUG "%s: using external clock\n",
-                              dev->dev.bus_id);
-                       return 0;
-               }
-               break;
        }
 
        ops->off(dev);
This page took 0.029735 seconds and 4 git commands to generate.