diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2008-10-21 00:52:04 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2008-10-21 00:52:04 -0400 |
commit | a02efb906d12c9d4eb2ab7c59049ba9545e5412d (patch) | |
tree | bf1f6467978ec63a22f42299ecac2ee7f7e73336 /drivers/i2c | |
parent | 84dfcb4b318463cd4883b6a19937824f49aee564 (diff) | |
parent | 2515ddc6db8eb49a79f0fe5e67ff09ac7c81eab4 (diff) |
Merge commit 'origin' into master
Manual merge of:
arch/powerpc/Kconfig
arch/powerpc/include/asm/page.h
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/busses/i2c-amd756.c | 5 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-omap.c | 12 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-powermac.c | 29 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-viapro.c | 5 | ||||
-rw-r--r-- | drivers/i2c/chips/at24.c | 1 | ||||
-rw-r--r-- | drivers/i2c/chips/ds1682.c | 1 | ||||
-rw-r--r-- | drivers/i2c/chips/menelaus.c | 34 | ||||
-rw-r--r-- | drivers/i2c/i2c-dev.c | 6 |
8 files changed, 59 insertions, 34 deletions
diff --git a/drivers/i2c/busses/i2c-amd756.c b/drivers/i2c/busses/i2c-amd756.c index 1ea39254dac6..424dad6f18d8 100644 --- a/drivers/i2c/busses/i2c-amd756.c +++ b/drivers/i2c/busses/i2c-amd756.c | |||
@@ -332,10 +332,6 @@ static int __devinit amd756_probe(struct pci_dev *pdev, | |||
332 | int error; | 332 | int error; |
333 | u8 temp; | 333 | u8 temp; |
334 | 334 | ||
335 | /* driver_data might come from user-space, so check it */ | ||
336 | if (id->driver_data >= ARRAY_SIZE(chipname)) | ||
337 | return -EINVAL; | ||
338 | |||
339 | if (amd756_ioport) { | 335 | if (amd756_ioport) { |
340 | dev_err(&pdev->dev, "Only one device supported " | 336 | dev_err(&pdev->dev, "Only one device supported " |
341 | "(you have a strange motherboard, btw)\n"); | 337 | "(you have a strange motherboard, btw)\n"); |
@@ -412,7 +408,6 @@ static struct pci_driver amd756_driver = { | |||
412 | .id_table = amd756_ids, | 408 | .id_table = amd756_ids, |
413 | .probe = amd756_probe, | 409 | .probe = amd756_probe, |
414 | .remove = __devexit_p(amd756_remove), | 410 | .remove = __devexit_p(amd756_remove), |
415 | .dynids.use_driver_data = 1, | ||
416 | }; | 411 | }; |
417 | 412 | ||
418 | static int __init amd756_init(void) | 413 | static int __init amd756_init(void) |
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index e7eb7bf9ddec..608038d64f81 100644 --- a/drivers/i2c/busses/i2c-omap.c +++ b/drivers/i2c/busses/i2c-omap.c | |||
@@ -589,11 +589,16 @@ omap_i2c_probe(struct platform_device *pdev) | |||
589 | 589 | ||
590 | dev->dev = &pdev->dev; | 590 | dev->dev = &pdev->dev; |
591 | dev->irq = irq->start; | 591 | dev->irq = irq->start; |
592 | dev->base = (void __iomem *) IO_ADDRESS(mem->start); | 592 | dev->base = ioremap(mem->start, mem->end - mem->start + 1); |
593 | if (!dev->base) { | ||
594 | r = -ENOMEM; | ||
595 | goto err_free_mem; | ||
596 | } | ||
597 | |||
593 | platform_set_drvdata(pdev, dev); | 598 | platform_set_drvdata(pdev, dev); |
594 | 599 | ||
595 | if ((r = omap_i2c_get_clocks(dev)) != 0) | 600 | if ((r = omap_i2c_get_clocks(dev)) != 0) |
596 | goto err_free_mem; | 601 | goto err_iounmap; |
597 | 602 | ||
598 | omap_i2c_unidle(dev); | 603 | omap_i2c_unidle(dev); |
599 | 604 | ||
@@ -640,6 +645,8 @@ err_unuse_clocks: | |||
640 | omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0); | 645 | omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0); |
641 | omap_i2c_idle(dev); | 646 | omap_i2c_idle(dev); |
642 | omap_i2c_put_clocks(dev); | 647 | omap_i2c_put_clocks(dev); |
648 | err_iounmap: | ||
649 | iounmap(dev->base); | ||
643 | err_free_mem: | 650 | err_free_mem: |
644 | platform_set_drvdata(pdev, NULL); | 651 | platform_set_drvdata(pdev, NULL); |
645 | kfree(dev); | 652 | kfree(dev); |
@@ -661,6 +668,7 @@ omap_i2c_remove(struct platform_device *pdev) | |||
661 | i2c_del_adapter(&dev->adapter); | 668 | i2c_del_adapter(&dev->adapter); |
662 | omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0); | 669 | omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0); |
663 | omap_i2c_put_clocks(dev); | 670 | omap_i2c_put_clocks(dev); |
671 | iounmap(dev->base); | ||
664 | kfree(dev); | 672 | kfree(dev); |
665 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 673 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
666 | release_mem_region(mem->start, (mem->end - mem->start) + 1); | 674 | release_mem_region(mem->start, (mem->end - mem->start) + 1); |
diff --git a/drivers/i2c/busses/i2c-powermac.c b/drivers/i2c/busses/i2c-powermac.c index 0e7b1c6724aa..60ca91745e55 100644 --- a/drivers/i2c/busses/i2c-powermac.c +++ b/drivers/i2c/busses/i2c-powermac.c | |||
@@ -259,6 +259,35 @@ static int __devinit i2c_powermac_probe(struct platform_device *dev) | |||
259 | } | 259 | } |
260 | 260 | ||
261 | printk(KERN_INFO "PowerMac i2c bus %s registered\n", name); | 261 | printk(KERN_INFO "PowerMac i2c bus %s registered\n", name); |
262 | |||
263 | if (!strncmp(basename, "uni-n", 5)) { | ||
264 | struct device_node *np; | ||
265 | const u32 *prop; | ||
266 | struct i2c_board_info info; | ||
267 | |||
268 | /* Instantiate I2C motion sensor if present */ | ||
269 | np = of_find_node_by_name(NULL, "accelerometer"); | ||
270 | if (np && of_device_is_compatible(np, "AAPL,accelerometer_1") && | ||
271 | (prop = of_get_property(np, "reg", NULL))) { | ||
272 | int i2c_bus; | ||
273 | const char *tmp_bus; | ||
274 | |||
275 | /* look for bus either using "reg" or by path */ | ||
276 | tmp_bus = strstr(np->full_name, "/i2c-bus@"); | ||
277 | if (tmp_bus) | ||
278 | i2c_bus = *(tmp_bus + 9) - '0'; | ||
279 | else | ||
280 | i2c_bus = ((*prop) >> 8) & 0x0f; | ||
281 | |||
282 | if (pmac_i2c_get_channel(bus) == i2c_bus) { | ||
283 | memset(&info, 0, sizeof(struct i2c_board_info)); | ||
284 | info.addr = ((*prop) & 0xff) >> 1; | ||
285 | strlcpy(info.type, "ams", I2C_NAME_SIZE); | ||
286 | i2c_new_device(adapter, &info); | ||
287 | } | ||
288 | } | ||
289 | } | ||
290 | |||
262 | return rc; | 291 | return rc; |
263 | } | 292 | } |
264 | 293 | ||
diff --git a/drivers/i2c/busses/i2c-viapro.c b/drivers/i2c/busses/i2c-viapro.c index 73dc52e114eb..9f194d9efd91 100644 --- a/drivers/i2c/busses/i2c-viapro.c +++ b/drivers/i2c/busses/i2c-viapro.c | |||
@@ -332,10 +332,6 @@ static int __devinit vt596_probe(struct pci_dev *pdev, | |||
332 | unsigned char temp; | 332 | unsigned char temp; |
333 | int error = -ENODEV; | 333 | int error = -ENODEV; |
334 | 334 | ||
335 | /* driver_data might come from user-space, so check it */ | ||
336 | if (id->driver_data & 1 || id->driver_data > 0xff) | ||
337 | return -EINVAL; | ||
338 | |||
339 | /* Determine the address of the SMBus areas */ | 335 | /* Determine the address of the SMBus areas */ |
340 | if (force_addr) { | 336 | if (force_addr) { |
341 | vt596_smba = force_addr & 0xfff0; | 337 | vt596_smba = force_addr & 0xfff0; |
@@ -483,7 +479,6 @@ static struct pci_driver vt596_driver = { | |||
483 | .name = "vt596_smbus", | 479 | .name = "vt596_smbus", |
484 | .id_table = vt596_ids, | 480 | .id_table = vt596_ids, |
485 | .probe = vt596_probe, | 481 | .probe = vt596_probe, |
486 | .dynids.use_driver_data = 1, | ||
487 | }; | 482 | }; |
488 | 483 | ||
489 | static int __init i2c_vt596_init(void) | 484 | static int __init i2c_vt596_init(void) |
diff --git a/drivers/i2c/chips/at24.c b/drivers/i2c/chips/at24.c index 2a4acb269569..d4775528abc6 100644 --- a/drivers/i2c/chips/at24.c +++ b/drivers/i2c/chips/at24.c | |||
@@ -460,7 +460,6 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
460 | */ | 460 | */ |
461 | at24->bin.attr.name = "eeprom"; | 461 | at24->bin.attr.name = "eeprom"; |
462 | at24->bin.attr.mode = chip.flags & AT24_FLAG_IRUGO ? S_IRUGO : S_IRUSR; | 462 | at24->bin.attr.mode = chip.flags & AT24_FLAG_IRUGO ? S_IRUGO : S_IRUSR; |
463 | at24->bin.attr.owner = THIS_MODULE; | ||
464 | at24->bin.read = at24_bin_read; | 463 | at24->bin.read = at24_bin_read; |
465 | at24->bin.size = chip.byte_len; | 464 | at24->bin.size = chip.byte_len; |
466 | 465 | ||
diff --git a/drivers/i2c/chips/ds1682.c b/drivers/i2c/chips/ds1682.c index 23be4d42cb02..f3ee4a1abb77 100644 --- a/drivers/i2c/chips/ds1682.c +++ b/drivers/i2c/chips/ds1682.c | |||
@@ -190,7 +190,6 @@ static struct bin_attribute ds1682_eeprom_attr = { | |||
190 | .attr = { | 190 | .attr = { |
191 | .name = "eeprom", | 191 | .name = "eeprom", |
192 | .mode = S_IRUGO | S_IWUSR, | 192 | .mode = S_IRUGO | S_IWUSR, |
193 | .owner = THIS_MODULE, | ||
194 | }, | 193 | }, |
195 | .size = DS1682_EEPROM_SIZE, | 194 | .size = DS1682_EEPROM_SIZE, |
196 | .read = ds1682_eeprom_read, | 195 | .read = ds1682_eeprom_read, |
diff --git a/drivers/i2c/chips/menelaus.c b/drivers/i2c/chips/menelaus.c index 176126d3a01d..4b364bae6b3e 100644 --- a/drivers/i2c/chips/menelaus.c +++ b/drivers/i2c/chips/menelaus.c | |||
@@ -832,52 +832,52 @@ static irqreturn_t menelaus_irq(int irq, void *_menelaus) | |||
832 | 832 | ||
833 | static void menelaus_to_time(char *regs, struct rtc_time *t) | 833 | static void menelaus_to_time(char *regs, struct rtc_time *t) |
834 | { | 834 | { |
835 | t->tm_sec = BCD2BIN(regs[0]); | 835 | t->tm_sec = bcd2bin(regs[0]); |
836 | t->tm_min = BCD2BIN(regs[1]); | 836 | t->tm_min = bcd2bin(regs[1]); |
837 | if (the_menelaus->rtc_control & RTC_CTRL_MODE12) { | 837 | if (the_menelaus->rtc_control & RTC_CTRL_MODE12) { |
838 | t->tm_hour = BCD2BIN(regs[2] & 0x1f) - 1; | 838 | t->tm_hour = bcd2bin(regs[2] & 0x1f) - 1; |
839 | if (regs[2] & RTC_HR_PM) | 839 | if (regs[2] & RTC_HR_PM) |
840 | t->tm_hour += 12; | 840 | t->tm_hour += 12; |
841 | } else | 841 | } else |
842 | t->tm_hour = BCD2BIN(regs[2] & 0x3f); | 842 | t->tm_hour = bcd2bin(regs[2] & 0x3f); |
843 | t->tm_mday = BCD2BIN(regs[3]); | 843 | t->tm_mday = bcd2bin(regs[3]); |
844 | t->tm_mon = BCD2BIN(regs[4]) - 1; | 844 | t->tm_mon = bcd2bin(regs[4]) - 1; |
845 | t->tm_year = BCD2BIN(regs[5]) + 100; | 845 | t->tm_year = bcd2bin(regs[5]) + 100; |
846 | } | 846 | } |
847 | 847 | ||
848 | static int time_to_menelaus(struct rtc_time *t, int regnum) | 848 | static int time_to_menelaus(struct rtc_time *t, int regnum) |
849 | { | 849 | { |
850 | int hour, status; | 850 | int hour, status; |
851 | 851 | ||
852 | status = menelaus_write_reg(regnum++, BIN2BCD(t->tm_sec)); | 852 | status = menelaus_write_reg(regnum++, bin2bcd(t->tm_sec)); |
853 | if (status < 0) | 853 | if (status < 0) |
854 | goto fail; | 854 | goto fail; |
855 | 855 | ||
856 | status = menelaus_write_reg(regnum++, BIN2BCD(t->tm_min)); | 856 | status = menelaus_write_reg(regnum++, bin2bcd(t->tm_min)); |
857 | if (status < 0) | 857 | if (status < 0) |
858 | goto fail; | 858 | goto fail; |
859 | 859 | ||
860 | if (the_menelaus->rtc_control & RTC_CTRL_MODE12) { | 860 | if (the_menelaus->rtc_control & RTC_CTRL_MODE12) { |
861 | hour = t->tm_hour + 1; | 861 | hour = t->tm_hour + 1; |
862 | if (hour > 12) | 862 | if (hour > 12) |
863 | hour = RTC_HR_PM | BIN2BCD(hour - 12); | 863 | hour = RTC_HR_PM | bin2bcd(hour - 12); |
864 | else | 864 | else |
865 | hour = BIN2BCD(hour); | 865 | hour = bin2bcd(hour); |
866 | } else | 866 | } else |
867 | hour = BIN2BCD(t->tm_hour); | 867 | hour = bin2bcd(t->tm_hour); |
868 | status = menelaus_write_reg(regnum++, hour); | 868 | status = menelaus_write_reg(regnum++, hour); |
869 | if (status < 0) | 869 | if (status < 0) |
870 | goto fail; | 870 | goto fail; |
871 | 871 | ||
872 | status = menelaus_write_reg(regnum++, BIN2BCD(t->tm_mday)); | 872 | status = menelaus_write_reg(regnum++, bin2bcd(t->tm_mday)); |
873 | if (status < 0) | 873 | if (status < 0) |
874 | goto fail; | 874 | goto fail; |
875 | 875 | ||
876 | status = menelaus_write_reg(regnum++, BIN2BCD(t->tm_mon + 1)); | 876 | status = menelaus_write_reg(regnum++, bin2bcd(t->tm_mon + 1)); |
877 | if (status < 0) | 877 | if (status < 0) |
878 | goto fail; | 878 | goto fail; |
879 | 879 | ||
880 | status = menelaus_write_reg(regnum++, BIN2BCD(t->tm_year - 100)); | 880 | status = menelaus_write_reg(regnum++, bin2bcd(t->tm_year - 100)); |
881 | if (status < 0) | 881 | if (status < 0) |
882 | goto fail; | 882 | goto fail; |
883 | 883 | ||
@@ -914,7 +914,7 @@ static int menelaus_read_time(struct device *dev, struct rtc_time *t) | |||
914 | } | 914 | } |
915 | 915 | ||
916 | menelaus_to_time(regs, t); | 916 | menelaus_to_time(regs, t); |
917 | t->tm_wday = BCD2BIN(regs[6]); | 917 | t->tm_wday = bcd2bin(regs[6]); |
918 | 918 | ||
919 | return 0; | 919 | return 0; |
920 | } | 920 | } |
@@ -927,7 +927,7 @@ static int menelaus_set_time(struct device *dev, struct rtc_time *t) | |||
927 | status = time_to_menelaus(t, MENELAUS_RTC_SEC); | 927 | status = time_to_menelaus(t, MENELAUS_RTC_SEC); |
928 | if (status < 0) | 928 | if (status < 0) |
929 | return status; | 929 | return status; |
930 | status = menelaus_write_reg(MENELAUS_RTC_WKDAY, BIN2BCD(t->tm_wday)); | 930 | status = menelaus_write_reg(MENELAUS_RTC_WKDAY, bin2bcd(t->tm_wday)); |
931 | if (status < 0) { | 931 | if (status < 0) { |
932 | dev_err(&the_menelaus->client->dev, "rtc write reg %02x " | 932 | dev_err(&the_menelaus->client->dev, "rtc write reg %02x " |
933 | "err %d\n", MENELAUS_RTC_WKDAY, status); | 933 | "err %d\n", MENELAUS_RTC_WKDAY, status); |
diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c index 307d976c9b69..c171988a9f51 100644 --- a/drivers/i2c/i2c-dev.c +++ b/drivers/i2c/i2c-dev.c | |||
@@ -521,9 +521,9 @@ static int i2cdev_attach_adapter(struct i2c_adapter *adap) | |||
521 | return PTR_ERR(i2c_dev); | 521 | return PTR_ERR(i2c_dev); |
522 | 522 | ||
523 | /* register this i2c device with the driver core */ | 523 | /* register this i2c device with the driver core */ |
524 | i2c_dev->dev = device_create_drvdata(i2c_dev_class, &adap->dev, | 524 | i2c_dev->dev = device_create(i2c_dev_class, &adap->dev, |
525 | MKDEV(I2C_MAJOR, adap->nr), | 525 | MKDEV(I2C_MAJOR, adap->nr), NULL, |
526 | NULL, "i2c-%d", adap->nr); | 526 | "i2c-%d", adap->nr); |
527 | if (IS_ERR(i2c_dev->dev)) { | 527 | if (IS_ERR(i2c_dev->dev)) { |
528 | res = PTR_ERR(i2c_dev->dev); | 528 | res = PTR_ERR(i2c_dev->dev); |
529 | goto error; | 529 | goto error; |