summaryrefslogtreecommitdiffstats
path: root/target/linux/ar7/files
diff options
context:
space:
mode:
authorflorian <florian@3c298f89-4303-0410-b956-a3cf2f4a3e73>2008-08-31 11:32:26 +0000
committerflorian <florian@3c298f89-4303-0410-b956-a3cf2f4a3e73>2008-08-31 11:32:26 +0000
commitf46a1a6ee4fab418b689aad17cd6c2126688aea9 (patch)
treecd8426f9608a1efe8707f15638750f0e087cfb97 /target/linux/ar7/files
parent668080e69c87eb8c4b91f8e4ba5a8c93275aa7c6 (diff)
Fix divisor settings for external devices like wireless devices, thanks sn9
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@12443 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/ar7/files')
-rw-r--r--target/linux/ar7/files/drivers/vlynq/vlynq.c54
-rw-r--r--target/linux/ar7/files/include/linux/vlynq.h2
2 files changed, 42 insertions, 14 deletions
diff --git a/target/linux/ar7/files/drivers/vlynq/vlynq.c b/target/linux/ar7/files/drivers/vlynq/vlynq.c
index 3358bb711..1de5789b7 100644
--- a/target/linux/ar7/files/drivers/vlynq/vlynq.c
+++ b/target/linux/ar7/files/drivers/vlynq/vlynq.c
@@ -304,20 +304,36 @@ static int vlynq_device_match(struct device *dev,
struct plat_vlynq_ops *ops = dev->platform_data;
struct vlynq_device_id *ids = vdrv->id_table;
u32 id = 0;
- int result;
+ int result, flag;
while (ids->id) {
- vdev->divisor = ids->divisor;
- result = __vlynq_enable_device(vdev);
- if (result == 0) {
- id = vlynq_reg_read(vdev->remote->chip);
- ops->off(vdev);
- if (ids->id == id) {
- vlynq_set_drvdata(vdev, ids);
- return 1;
- }
+ flag = 0;
+ if (ids->divisor != vlynq_div_auto
+ && vdev->divisor == vlynq_div_auto) {
+ flag = 1;
+ 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 " \
+ "device: %08x\n", id);
+ return 1;
}
+ printk(KERN_INFO "Not using the %08x VLYNQ device's " \
+ "driver for VLYNQ device: %08x\n", ids->id, id);
ids++;
+ if (flag)
+ vdev->divisor = vlynq_div_auto;
}
return 0;
}
@@ -602,6 +618,18 @@ static int vlynq_probe(struct platform_device *pdev)
dev->dev.bus_id, (void *)dev->regs_start, dev->irq,
(void *)dev->mem_start);
+ 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);
+ } else
+ dev->dev_id = 0;
+ if (dev->dev_id)
+ printk(KERN_INFO "Found a VLYNQ device: %08x\n", dev->dev_id);
+
return 0;
fail_register:
@@ -626,7 +654,7 @@ static int vlynq_remove(struct platform_device *pdev)
return 0;
}
-static struct platform_driver vlynq_driver = {
+static struct platform_driver vlynq_platform_driver = {
.driver.name = "vlynq",
.probe = vlynq_probe,
.remove = __devexit_p(vlynq_remove),
@@ -648,7 +676,7 @@ static int __devinit vlynq_init(void)
if (res)
goto fail_bus;
- res = platform_driver_register(&vlynq_driver);
+ res = platform_driver_register(&vlynq_platform_driver);
if (res)
goto fail_platform;
@@ -662,7 +690,7 @@ fail_bus:
static void __devexit vlynq_exit(void)
{
- platform_driver_unregister(&vlynq_driver);
+ platform_driver_unregister(&vlynq_platform_driver);
bus_unregister(&vlynq_bus_type);
}
diff --git a/target/linux/ar7/files/include/linux/vlynq.h b/target/linux/ar7/files/include/linux/vlynq.h
index 7658fe414..8f6a95882 100644
--- a/target/linux/ar7/files/include/linux/vlynq.h
+++ b/target/linux/ar7/files/include/linux/vlynq.h
@@ -59,7 +59,7 @@ struct vlynq_device_id {
struct vlynq_regs;
struct vlynq_device {
- u32 id;
+ u32 id, dev_id;
int local_irq;
int remote_irq;
enum vlynq_divisor divisor;