Fix divisor calculation and configuration from previous commit, thanks sn9
authorflorian <florian@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Mon, 1 Sep 2008 11:49:57 +0000 (11:49 +0000)
committerflorian <florian@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Mon, 1 Sep 2008 11:49:57 +0000 (11:49 +0000)
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@12454 3c298f89-4303-0410-b956-a3cf2f4a3e73

target/linux/ar7/files/arch/mips/ar7/platform.c
target/linux/ar7/files/arch/mips/ar7/prom.c
target/linux/ar7/files/drivers/vlynq/vlynq.c
target/linux/ar7/files/include/asm-mips/ar7/prom.h
target/linux/ar7/patches-2.6.26/100-board_support.patch

index 81d4290..1464ccd 100644 (file)
@@ -493,11 +493,11 @@ static int __init ar7_register_devices(void)
        if (res)
                return res;
 
        if (res)
                return res;
 
+       ar7_device_disable(vlynq_low_data.reset_bit);
        res = platform_device_register(&vlynq_low);
        if (res)
                return res;
 
        res = platform_device_register(&vlynq_low);
        if (res)
                return res;
 
-       ar7_device_disable(vlynq_low_data.reset_bit);
        if (ar7_has_high_vlynq()) {
                ar7_device_disable(vlynq_high_data.reset_bit);
                res = platform_device_register(&vlynq_high);
        if (ar7_has_high_vlynq()) {
                ar7_device_disable(vlynq_high_data.reset_bit);
                res = platform_device_register(&vlynq_high);
index 249aab5..4a6cd29 100644 (file)
@@ -39,7 +39,7 @@ struct env_var {
 
 static struct env_var adam2_env[MAX_ENTRY] = { { 0, }, };
 
 
 static struct env_var adam2_env[MAX_ENTRY] = { { 0, }, };
 
-char *prom_getenv(char *name)
+char *prom_getenv(const char *name)
 {
        int i;
        for (i = 0; (i < MAX_ENTRY) && adam2_env[i].name; i++)
 {
        int i;
        for (i = 0; (i < MAX_ENTRY) && adam2_env[i].name; i++)
@@ -288,7 +288,7 @@ int prom_putchar(char c)
 }
 
 /* from adm5120/prom.c */
 }
 
 /* from adm5120/prom.c */
-void prom_printf(char *fmt, ...)
+void prom_printf(const char *fmt, ...)
 {
        va_list args;
        int l;
 {
        va_list args;
        int l;
index 1de5789..14022b1 100644 (file)
@@ -26,6 +26,7 @@
 #include <linux/platform_device.h>
 #include <linux/interrupt.h>
 #include <linux/device.h>
 #include <linux/platform_device.h>
 #include <linux/interrupt.h>
 #include <linux/device.h>
+#include <linux/delay.h>
 #include <linux/io.h>
 
 #include <linux/vlynq.h>
 #include <linux/io.h>
 
 #include <linux/vlynq.h>
@@ -301,39 +302,19 @@ static int vlynq_device_match(struct device *dev,
 {
        struct vlynq_device *vdev = to_vlynq_device(dev);
        struct vlynq_driver *vdrv = to_vlynq_driver(drv);
 {
        struct vlynq_device *vdev = to_vlynq_device(dev);
        struct vlynq_driver *vdrv = to_vlynq_driver(drv);
-       struct plat_vlynq_ops *ops = dev->platform_data;
        struct vlynq_device_id *ids = vdrv->id_table;
        struct vlynq_device_id *ids = vdrv->id_table;
-       u32 id = 0;
-       int result, flag;
 
        while (ids->id) {
 
        while (ids->id) {
-               flag = 0;
-               if (ids->divisor != vlynq_div_auto
-                               && vdev->divisor == vlynq_div_auto) {
-                       flag = 1;
+               if (ids->id == vdev->dev_id) {
                        vdev->divisor = ids->divisor;
                        vdev->divisor = ids->divisor;
-                       result = __vlynq_enable_device(vdev);
-                       if (result == 0) {
-                               id = vlynq_reg_read(vdev->remote->chip);
-                               vlynq_reg_write(vdev->local->control, 0);
-                               vlynq_reg_write(vdev->remote->control, 0);
-                               ops->off(vdev);
-                       } else
-                               id = vdev->dev_id;
-               } else
-                       id = vdev->dev_id;
-               if (ids->id == id) {
-                       vdev->dev_id = id;
                        vlynq_set_drvdata(vdev, ids);
                        printk(KERN_INFO "Driver found for VLYNQ " \
                        vlynq_set_drvdata(vdev, ids);
                        printk(KERN_INFO "Driver found for VLYNQ " \
-                               "device: %08x\n", id);
+                               "device: %08x\n", vdev->dev_id);
                        return 1;
                }
                        return 1;
                }
-               printk(KERN_INFO "Not using the %08x VLYNQ device's " \
-                       "driver for VLYNQ device: %08x\n", ids->id, id);
+               printk(KERN_DEBUG "Not using the %08x VLYNQ device's driver" \
+                       " for VLYNQ device: %08x\n", ids->id, vdev->dev_id);
                ids++;
                ids++;
-               if (flag)
-                       vdev->divisor = vlynq_div_auto;
        }
        return 0;
 }
        }
        return 0;
 }
@@ -385,20 +366,20 @@ static int __vlynq_enable_device(struct vlynq_device *dev)
        if (result)
                return result;
 
        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);
        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++) {
+               if (vlynq_linked(dev)) {
+                       dev->divisor = vlynq_div_external;
+                       printk(KERN_DEBUG "%s: using external clock\n",
+                               dev->dev.bus_id);
+                       return 0;
+               }
+               for (i = dev->dev_id ? vlynq_ldiv2 : vlynq_ldiv8; dev->dev_id ?
+                               i <= vlynq_ldiv8 : i >= vlynq_ldiv2;
+                               dev->dev_id ? i++ : i--) {
                        vlynq_reg_write(dev->local->control,
                                        VLYNQ_CTRL_CLOCK_INT |
                                        VLYNQ_CTRL_CLOCK_DIV(i - vlynq_ldiv1));
                        vlynq_reg_write(dev->local->control,
                                        VLYNQ_CTRL_CLOCK_INT |
                                        VLYNQ_CTRL_CLOCK_DIV(i - vlynq_ldiv1));
@@ -618,15 +599,13 @@ static int vlynq_probe(struct platform_device *pdev)
               dev->dev.bus_id, (void *)dev->regs_start, dev->irq,
               (void *)dev->mem_start);
 
               dev->dev.bus_id, (void *)dev->regs_start, dev->irq,
               (void *)dev->mem_start);
 
+       dev->dev_id = 0;
        dev->divisor = vlynq_div_auto;
        result = __vlynq_enable_device(dev);
        if (result == 0) {
                dev->dev_id = vlynq_reg_read(dev->remote->chip);
        dev->divisor = vlynq_div_auto;
        result = __vlynq_enable_device(dev);
        if (result == 0) {
                dev->dev_id = vlynq_reg_read(dev->remote->chip);
-               vlynq_reg_write(dev->local->control, 0);
-               vlynq_reg_write(dev->remote->control, 0);
                ((struct plat_vlynq_ops *)(dev->dev.platform_data))->off(dev);
                ((struct plat_vlynq_ops *)(dev->dev.platform_data))->off(dev);
-       } else
-               dev->dev_id = 0;
+       }
        if (dev->dev_id)
                printk(KERN_INFO "Found a VLYNQ device: %08x\n", dev->dev_id);
 
        if (dev->dev_id)
                printk(KERN_INFO "Found a VLYNQ device: %08x\n", dev->dev_id);
 
index 2f3f67f..55f5939 100644 (file)
@@ -19,8 +19,8 @@
 #ifndef __PROM_H__
 #define __PROM_H__
 
 #ifndef __PROM_H__
 #define __PROM_H__
 
-extern char *prom_getenv(char *name);
-extern void prom_printf(char *fmt, ...);
+extern char *prom_getenv(const char *name);
+extern void prom_printf(const char *fmt, ...) __attribute__((format(printf, 1, 2)));
 extern void prom_meminit(void);
 
 #endif /* __PROM_H__ */
 extern void prom_meminit(void);
 
 #endif /* __PROM_H__ */
index 658a80e..33b0b8b 100644 (file)
@@ -1,6 +1,6 @@
 --- a/arch/mips/Kconfig
 +++ b/arch/mips/Kconfig
 --- a/arch/mips/Kconfig
 +++ b/arch/mips/Kconfig
-@@ -18,6 +18,24 @@
+@@ -18,6 +18,23 @@
        prompt "System type"
        default SGI_IP22
  
        prompt "System type"
        default SGI_IP22
  
@@ -11,7 +11,6 @@
 +      select CEVT_R4K
 +      select CSRC_R4K
 +      select IRQ_CPU
 +      select CEVT_R4K
 +      select CSRC_R4K
 +      select IRQ_CPU
-+      select NO_EXCEPT_FILL
 +      select SWAP_IO_SPACE
 +      select SYS_HAS_CPU_MIPS32_R1
 +      select SYS_HAS_EARLY_PRINTK
 +      select SWAP_IO_SPACE
 +      select SYS_HAS_CPU_MIPS32_R1
 +      select SYS_HAS_EARLY_PRINTK
This page took 0.033553 seconds and 4 git commands to generate.