X-Git-Url: https://git.rohieb.name/openwrt.git/blobdiff_plain/87ae2b32716dc915b69561b0eac7c875d2c83f49..2d96209135fb51c77d06c872164a1d7402820a48:/target/linux/ar7/patches-2.6.32/160-vlynq_try_remote_first.patch diff --git a/target/linux/ar7/patches-2.6.32/160-vlynq_try_remote_first.patch b/target/linux/ar7/patches-2.6.32/160-vlynq_try_remote_first.patch index 1241bda2f..e75371bf9 100644 --- a/target/linux/ar7/patches-2.6.32/160-vlynq_try_remote_first.patch +++ b/target/linux/ar7/patches-2.6.32/160-vlynq_try_remote_first.patch @@ -1,8 +1,6 @@ -Index: linux-2.6.32.26/drivers/vlynq/vlynq.c -=================================================================== ---- linux-2.6.32.26.orig/drivers/vlynq/vlynq.c 2010-11-24 13:01:20.459985351 -0800 -+++ linux-2.6.32.26/drivers/vlynq/vlynq.c 2010-11-24 13:01:43.537494084 -0800 -@@ -103,6 +103,12 @@ +--- a/drivers/vlynq/vlynq.c ++++ b/drivers/vlynq/vlynq.c +@@ -103,6 +103,12 @@ static void vlynq_dump_mem(u32 *base, in } #endif @@ -15,7 +13,7 @@ Index: linux-2.6.32.26/drivers/vlynq/vlynq.c /* Check the VLYNQ link status with a given device */ static int vlynq_linked(struct vlynq_device *dev) { -@@ -117,20 +123,43 @@ +@@ -117,20 +123,40 @@ static int vlynq_linked(struct vlynq_dev return 0; } @@ -38,9 +36,6 @@ Index: linux-2.6.32.26/drivers/vlynq/vlynq.c { + u32 rtm = readl(&dev->local->revision); + -+ if (rtm < 0x00010200) -+ return; -+ + rtm = rtm < 0x00010205 || readl(&dev->local->status) & 0x800 == 0 ? + 0 : 0x600000; + @@ -62,7 +57,7 @@ Index: linux-2.6.32.26/drivers/vlynq/vlynq.c } static void vlynq_irq_unmask(unsigned int irq) -@@ -379,6 +408,62 @@ +@@ -379,6 +405,61 @@ void vlynq_unregister_driver(struct vlyn } EXPORT_SYMBOL(vlynq_unregister_driver); @@ -85,9 +80,6 @@ Index: linux-2.6.32.26/drivers/vlynq/vlynq.c + return -EINVAL; + } + -+ printk(KERN_INFO "%s: local VLYNQ protocol rev. is 0x%08x\n", -+ dev_name(&dev->dev), readl(&dev->local->revision)); -+ + reg = readl(&dev->local->control); + if (readl(&dev->local->revision) < 0x00010205) { + if (clk_dir & vlynq_clk_local) @@ -102,6 +94,8 @@ Index: linux-2.6.32.26/drivers/vlynq/vlynq.c + if (!vlynq_linked(dev)) + return -ENODEV; + ++ printk(KERN_INFO "%s: local VLYNQ protocol rev. is 0x%08x\n", ++ dev_name(&dev->dev), readl(&dev->local->revision)); + printk(KERN_INFO "%s: remote VLYNQ protocol rev. is 0x%08x\n", + dev_name(&dev->dev), readl(&dev->remote->revision)); + @@ -125,15 +119,16 @@ Index: linux-2.6.32.26/drivers/vlynq/vlynq.c /* * A VLYNQ remote device can clock the VLYNQ bus master * using a dedicated clock line. In that case, both the -@@ -392,29 +477,15 @@ +@@ -392,29 +473,17 @@ static int __vlynq_try_remote(struct vly int i; vlynq_reset(dev); - for (i = dev->dev_id ? vlynq_rdiv2 : vlynq_rdiv8; dev->dev_id ? - i <= vlynq_rdiv8 : i >= vlynq_rdiv2; - dev->dev_id ? i++ : i--) { -- -+ for (i = 0; i <= 7; i++) { ++ for (i = dev->dev_id ? 0 : 7; dev->dev_id ? i <= 7 : i >= 0; ++ dev->dev_id ? i++ : i--) { + if (!vlynq_linked(dev)) break; @@ -149,18 +144,19 @@ Index: linux-2.6.32.26/drivers/vlynq/vlynq.c - &dev->local->control); - - if (vlynq_linked(dev)) { -+ if (!__vlynq_set_clocks(dev, vlynq_clk_remote, i, i)) { - printk(KERN_DEBUG +- printk(KERN_DEBUG - "%s: using remote clock divisor %d\n", - dev_name(&dev->dev), i - vlynq_rdiv1 + 1); - dev->divisor = i; ++ if (!__vlynq_set_clocks(dev, vlynq_clk_remote, i, i)) { ++ printk(KERN_INFO + "%s: using remote clock divisor %d\n", + dev_name(&dev->dev), i + 1); + dev->divisor = i + vlynq_rdiv1; return 0; } else { vlynq_reset(dev); -@@ -437,21 +508,12 @@ +@@ -437,21 +506,14 @@ static int __vlynq_try_local(struct vlyn vlynq_reset(dev); @@ -175,19 +171,22 @@ Index: linux-2.6.32.26/drivers/vlynq/vlynq.c - &dev->local->control); - - if (vlynq_linked(dev)) { -+ for (i = 0; i <= 7; i++) { -+ if (!__vlynq_set_clocks(dev, vlynq_clk_local, i, 0)) { - printk(KERN_DEBUG +- printk(KERN_DEBUG - "%s: using local clock divisor %d\n", - dev_name(&dev->dev), i - vlynq_ldiv1 + 1); - dev->divisor = i; ++ for (i = dev->dev_id ? 0 : 7; dev->dev_id ? i <= 7 : i >= 0; ++ dev->dev_id ? i++ : i--) { ++ ++ if (!__vlynq_set_clocks(dev, vlynq_clk_local, i, 0)) { ++ printk(KERN_INFO + "%s: using local clock divisor %d\n", + dev_name(&dev->dev), i + 1); + dev->divisor = i + vlynq_ldiv1; return 0; } else { vlynq_reset(dev); -@@ -473,18 +535,10 @@ +@@ -473,18 +535,10 @@ static int __vlynq_try_external(struct v if (!vlynq_linked(dev)) return -ENODEV; @@ -200,16 +199,17 @@ Index: linux-2.6.32.26/drivers/vlynq/vlynq.c - &dev->local->control); - - if (vlynq_linked(dev)) { -+ if (!__vlynq_set_clocks(dev, vlynq_clk_external, 0, 0)) { - printk(KERN_DEBUG "%s: using external clock\n", +- printk(KERN_DEBUG "%s: using external clock\n", - dev_name(&dev->dev)); - dev->divisor = vlynq_div_external; ++ if (!__vlynq_set_clocks(dev, vlynq_clk_external, 0, 0)) { ++ printk(KERN_INFO "%s: using external clock\n", + dev_name(&dev->dev)); + dev->divisor = vlynq_div_external; return 0; } -@@ -507,18 +561,9 @@ +@@ -507,18 +561,9 @@ static int __vlynq_enable_device(struct * generation negotiated by hardware. * Check which device is generating clocks and perform setup * accordingly */ @@ -231,7 +231,7 @@ Index: linux-2.6.32.26/drivers/vlynq/vlynq.c break; case vlynq_ldiv1: case vlynq_ldiv2: -@@ -528,15 +573,12 @@ +@@ -528,15 +573,12 @@ static int __vlynq_enable_device(struct case vlynq_ldiv6: case vlynq_ldiv7: case vlynq_ldiv8: @@ -240,19 +240,20 @@ Index: linux-2.6.32.26/drivers/vlynq/vlynq.c - vlynq_ldiv1), &dev->local->control); - writel(0, &dev->remote->control); - if (vlynq_linked(dev)) { -+ if (!__vlynq_set_clocks(dev, vlynq_clk_local, dev->divisor - -+ vlynq_ldiv1, 0)) { - printk(KERN_DEBUG +- printk(KERN_DEBUG - "%s: using local clock divisor %d\n", - dev_name(&dev->dev), - dev->divisor - vlynq_ldiv1 + 1); ++ if (!__vlynq_set_clocks(dev, vlynq_clk_local, dev->divisor - ++ vlynq_ldiv1, 0)) { ++ printk(KERN_INFO + "%s: using local clock divisor %d\n", + dev_name(&dev->dev), + dev->divisor - vlynq_ldiv1 + 1); return 0; } break; -@@ -548,15 +590,12 @@ +@@ -548,15 +590,12 @@ static int __vlynq_enable_device(struct case vlynq_rdiv6: case vlynq_rdiv7: case vlynq_rdiv8: @@ -261,19 +262,20 @@ Index: linux-2.6.32.26/drivers/vlynq/vlynq.c - VLYNQ_CTRL_CLOCK_DIV(dev->divisor - - vlynq_rdiv1), &dev->remote->control); - if (vlynq_linked(dev)) { -+ if (!__vlynq_set_clocks(dev, vlynq_clk_remote, 0, -+ dev->divisor - vlynq_rdiv1)) { - printk(KERN_DEBUG +- printk(KERN_DEBUG - "%s: using remote clock divisor %d\n", - dev_name(&dev->dev), - dev->divisor - vlynq_rdiv1 + 1); ++ if (!__vlynq_set_clocks(dev, vlynq_clk_remote, 0, ++ dev->divisor - vlynq_rdiv1)) { ++ printk(KERN_INFO + "%s: using remote clock divisor %d\n", + dev_name(&dev->dev), + dev->divisor - vlynq_rdiv1 + 1); return 0; } break; -@@ -732,13 +771,13 @@ +@@ -732,13 +771,12 @@ static int vlynq_probe(struct platform_d platform_set_drvdata(pdev, dev); printk(KERN_INFO "%s: regs 0x%p, irq %d, mem 0x%p\n", @@ -282,21 +284,17 @@ Index: linux-2.6.32.26/drivers/vlynq/vlynq.c + dev_name(&dev->dev), (void *)dev->regs_start, + dev->irq, (void *)dev->mem_start); -- dev->dev_id = 0; + dev->dev_id = 0; dev->divisor = vlynq_div_auto; - result = __vlynq_enable_device(dev); - if (result == 0) { -+ if (__vlynq_enable_device(dev)) -+ dev->dev_id = 0; -+ else { ++ if (!__vlynq_enable_device(dev)) { dev->dev_id = readl(&dev->remote->chip); ((struct plat_vlynq_ops *)(dev->dev.platform_data))->off(dev); } -Index: linux-2.6.32.26/include/linux/vlynq.h -=================================================================== ---- linux-2.6.32.26.orig/include/linux/vlynq.h 2010-11-24 13:07:33.297487888 -0800 -+++ linux-2.6.32.26/include/linux/vlynq.h 2010-11-24 13:08:44.107488596 -0800 -@@ -98,6 +98,7 @@ +--- a/include/linux/vlynq.h ++++ b/include/linux/vlynq.h +@@ -98,6 +98,7 @@ static inline struct vlynq_device *to_vl extern struct bus_type vlynq_bus_type;