aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/busses/Kconfig2
-rw-r--r--drivers/i2c/busses/i2c-imx.c8
-rw-r--r--drivers/i2c/busses/i2c-mxs.c6
-rw-r--r--drivers/i2c/busses/i2c-pnx.c157
-rw-r--r--drivers/i2c/busses/i2c-s6000.c2
-rw-r--r--drivers/i2c/busses/i2c-s6000.h2
6 files changed, 134 insertions, 43 deletions
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
index d2c5095deeac..94468a64ce3a 100644
--- a/drivers/i2c/busses/Kconfig
+++ b/drivers/i2c/busses/Kconfig
@@ -351,7 +351,7 @@ config I2C_DAVINCI
351 For details please see http://www.ti.com/davinci 351 For details please see http://www.ti.com/davinci
352 352
353config I2C_DESIGNWARE_PLATFORM 353config I2C_DESIGNWARE_PLATFORM
354 tristate "Synopsys DesignWare Platfrom" 354 tristate "Synopsys DesignWare Platform"
355 depends on HAVE_CLK 355 depends on HAVE_CLK
356 help 356 help
357 If you say yes to this option, support will be included for the 357 If you say yes to this option, support will be included for the
diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
index dfb84b7ee550..56bce9a8bcbb 100644
--- a/drivers/i2c/busses/i2c-imx.c
+++ b/drivers/i2c/busses/i2c-imx.c
@@ -51,6 +51,7 @@
51#include <linux/of.h> 51#include <linux/of.h>
52#include <linux/of_device.h> 52#include <linux/of_device.h>
53#include <linux/of_i2c.h> 53#include <linux/of_i2c.h>
54#include <linux/pinctrl/consumer.h>
54 55
55#include <mach/irqs.h> 56#include <mach/irqs.h>
56#include <mach/hardware.h> 57#include <mach/hardware.h>
@@ -470,6 +471,7 @@ static int __init i2c_imx_probe(struct platform_device *pdev)
470 struct imx_i2c_struct *i2c_imx; 471 struct imx_i2c_struct *i2c_imx;
471 struct resource *res; 472 struct resource *res;
472 struct imxi2c_platform_data *pdata = pdev->dev.platform_data; 473 struct imxi2c_platform_data *pdata = pdev->dev.platform_data;
474 struct pinctrl *pinctrl;
473 void __iomem *base; 475 void __iomem *base;
474 resource_size_t res_size; 476 resource_size_t res_size;
475 int irq, bitrate; 477 int irq, bitrate;
@@ -520,6 +522,12 @@ static int __init i2c_imx_probe(struct platform_device *pdev)
520 i2c_imx->base = base; 522 i2c_imx->base = base;
521 i2c_imx->res = res; 523 i2c_imx->res = res;
522 524
525 pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
526 if (IS_ERR(pinctrl)) {
527 ret = PTR_ERR(pinctrl);
528 goto fail3;
529 }
530
523 /* Get I2C clock */ 531 /* Get I2C clock */
524 i2c_imx->clk = clk_get(&pdev->dev, "i2c_clk"); 532 i2c_imx->clk = clk_get(&pdev->dev, "i2c_clk");
525 if (IS_ERR(i2c_imx->clk)) { 533 if (IS_ERR(i2c_imx->clk)) {
diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c
index 76b8af44f634..7fa73eed84a7 100644
--- a/drivers/i2c/busses/i2c-mxs.c
+++ b/drivers/i2c/busses/i2c-mxs.c
@@ -26,6 +26,7 @@
26#include <linux/platform_device.h> 26#include <linux/platform_device.h>
27#include <linux/jiffies.h> 27#include <linux/jiffies.h>
28#include <linux/io.h> 28#include <linux/io.h>
29#include <linux/pinctrl/consumer.h>
29 30
30#include <mach/common.h> 31#include <mach/common.h>
31 32
@@ -325,10 +326,15 @@ static int __devinit mxs_i2c_probe(struct platform_device *pdev)
325 struct device *dev = &pdev->dev; 326 struct device *dev = &pdev->dev;
326 struct mxs_i2c_dev *i2c; 327 struct mxs_i2c_dev *i2c;
327 struct i2c_adapter *adap; 328 struct i2c_adapter *adap;
329 struct pinctrl *pinctrl;
328 struct resource *res; 330 struct resource *res;
329 resource_size_t res_size; 331 resource_size_t res_size;
330 int err, irq; 332 int err, irq;
331 333
334 pinctrl = devm_pinctrl_get_select_default(dev);
335 if (IS_ERR(pinctrl))
336 return PTR_ERR(pinctrl);
337
332 i2c = devm_kzalloc(dev, sizeof(struct mxs_i2c_dev), GFP_KERNEL); 338 i2c = devm_kzalloc(dev, sizeof(struct mxs_i2c_dev), GFP_KERNEL);
333 if (!i2c) 339 if (!i2c)
334 return -ENOMEM; 340 return -ENOMEM;
diff --git a/drivers/i2c/busses/i2c-pnx.c b/drivers/i2c/busses/i2c-pnx.c
index eb8ad538c79f..99389d2eae51 100644
--- a/drivers/i2c/busses/i2c-pnx.c
+++ b/drivers/i2c/busses/i2c-pnx.c
@@ -23,16 +23,61 @@
23#include <linux/err.h> 23#include <linux/err.h>
24#include <linux/clk.h> 24#include <linux/clk.h>
25#include <linux/slab.h> 25#include <linux/slab.h>
26#include <linux/of_i2c.h>
27
28#define I2C_PNX_TIMEOUT_DEFAULT 10 /* msec */
29#define I2C_PNX_SPEED_KHZ_DEFAULT 100
30#define I2C_PNX_REGION_SIZE 0x100
31
32enum {
33 mstatus_tdi = 0x00000001,
34 mstatus_afi = 0x00000002,
35 mstatus_nai = 0x00000004,
36 mstatus_drmi = 0x00000008,
37 mstatus_active = 0x00000020,
38 mstatus_scl = 0x00000040,
39 mstatus_sda = 0x00000080,
40 mstatus_rff = 0x00000100,
41 mstatus_rfe = 0x00000200,
42 mstatus_tff = 0x00000400,
43 mstatus_tfe = 0x00000800,
44};
26 45
27#include <mach/hardware.h> 46enum {
28#include <mach/i2c.h> 47 mcntrl_tdie = 0x00000001,
48 mcntrl_afie = 0x00000002,
49 mcntrl_naie = 0x00000004,
50 mcntrl_drmie = 0x00000008,
51 mcntrl_daie = 0x00000020,
52 mcntrl_rffie = 0x00000040,
53 mcntrl_tffie = 0x00000080,
54 mcntrl_reset = 0x00000100,
55 mcntrl_cdbmode = 0x00000400,
56};
29 57
30#define I2C_PNX_TIMEOUT 10 /* msec */ 58enum {
31#define I2C_PNX_SPEED_KHZ 100 59 rw_bit = 1 << 0,
32#define I2C_PNX_REGION_SIZE 0x100 60 start_bit = 1 << 8,
61 stop_bit = 1 << 9,
62};
33 63
34static inline int wait_timeout(long timeout, struct i2c_pnx_algo_data *data) 64#define I2C_REG_RX(a) ((a)->ioaddr) /* Rx FIFO reg (RO) */
65#define I2C_REG_TX(a) ((a)->ioaddr) /* Tx FIFO reg (WO) */
66#define I2C_REG_STS(a) ((a)->ioaddr + 0x04) /* Status reg (RO) */
67#define I2C_REG_CTL(a) ((a)->ioaddr + 0x08) /* Ctl reg */
68#define I2C_REG_CKL(a) ((a)->ioaddr + 0x0c) /* Clock divider low */
69#define I2C_REG_CKH(a) ((a)->ioaddr + 0x10) /* Clock divider high */
70#define I2C_REG_ADR(a) ((a)->ioaddr + 0x14) /* I2C address */
71#define I2C_REG_RFL(a) ((a)->ioaddr + 0x18) /* Rx FIFO level (RO) */
72#define I2C_REG_TFL(a) ((a)->ioaddr + 0x1c) /* Tx FIFO level (RO) */
73#define I2C_REG_RXB(a) ((a)->ioaddr + 0x20) /* Num of bytes Rx-ed (RO) */
74#define I2C_REG_TXB(a) ((a)->ioaddr + 0x24) /* Num of bytes Tx-ed (RO) */
75#define I2C_REG_TXS(a) ((a)->ioaddr + 0x28) /* Tx slave FIFO (RO) */
76#define I2C_REG_STFL(a) ((a)->ioaddr + 0x2c) /* Tx slave FIFO level (RO) */
77
78static inline int wait_timeout(struct i2c_pnx_algo_data *data)
35{ 79{
80 long timeout = data->timeout;
36 while (timeout > 0 && 81 while (timeout > 0 &&
37 (ioread32(I2C_REG_STS(data)) & mstatus_active)) { 82 (ioread32(I2C_REG_STS(data)) & mstatus_active)) {
38 mdelay(1); 83 mdelay(1);
@@ -41,8 +86,9 @@ static inline int wait_timeout(long timeout, struct i2c_pnx_algo_data *data)
41 return (timeout <= 0); 86 return (timeout <= 0);
42} 87}
43 88
44static inline int wait_reset(long timeout, struct i2c_pnx_algo_data *data) 89static inline int wait_reset(struct i2c_pnx_algo_data *data)
45{ 90{
91 long timeout = data->timeout;
46 while (timeout > 0 && 92 while (timeout > 0 &&
47 (ioread32(I2C_REG_CTL(data)) & mcntrl_reset)) { 93 (ioread32(I2C_REG_CTL(data)) & mcntrl_reset)) {
48 mdelay(1); 94 mdelay(1);
@@ -54,7 +100,7 @@ static inline int wait_reset(long timeout, struct i2c_pnx_algo_data *data)
54static inline void i2c_pnx_arm_timer(struct i2c_pnx_algo_data *alg_data) 100static inline void i2c_pnx_arm_timer(struct i2c_pnx_algo_data *alg_data)
55{ 101{
56 struct timer_list *timer = &alg_data->mif.timer; 102 struct timer_list *timer = &alg_data->mif.timer;
57 unsigned long expires = msecs_to_jiffies(I2C_PNX_TIMEOUT); 103 unsigned long expires = msecs_to_jiffies(alg_data->timeout);
58 104
59 if (expires <= 1) 105 if (expires <= 1)
60 expires = 2; 106 expires = 2;
@@ -92,7 +138,7 @@ static int i2c_pnx_start(unsigned char slave_addr,
92 } 138 }
93 139
94 /* First, make sure bus is idle */ 140 /* First, make sure bus is idle */
95 if (wait_timeout(I2C_PNX_TIMEOUT, alg_data)) { 141 if (wait_timeout(alg_data)) {
96 /* Somebody else is monopolizing the bus */ 142 /* Somebody else is monopolizing the bus */
97 dev_err(&alg_data->adapter.dev, 143 dev_err(&alg_data->adapter.dev,
98 "%s: Bus busy. Slave addr = %02x, cntrl = %x, stat = %x\n", 144 "%s: Bus busy. Slave addr = %02x, cntrl = %x, stat = %x\n",
@@ -185,7 +231,7 @@ static int i2c_pnx_master_xmit(struct i2c_pnx_algo_data *alg_data)
185 if (alg_data->mif.len == 0) { 231 if (alg_data->mif.len == 0) {
186 if (alg_data->last) { 232 if (alg_data->last) {
187 /* Wait until the STOP is seen. */ 233 /* Wait until the STOP is seen. */
188 if (wait_timeout(I2C_PNX_TIMEOUT, alg_data)) 234 if (wait_timeout(alg_data))
189 dev_err(&alg_data->adapter.dev, 235 dev_err(&alg_data->adapter.dev,
190 "The bus is still active after timeout\n"); 236 "The bus is still active after timeout\n");
191 } 237 }
@@ -283,7 +329,7 @@ static int i2c_pnx_master_rcv(struct i2c_pnx_algo_data *alg_data)
283 if (alg_data->mif.len == 0) { 329 if (alg_data->mif.len == 0) {
284 if (alg_data->last) 330 if (alg_data->last)
285 /* Wait until the STOP is seen. */ 331 /* Wait until the STOP is seen. */
286 if (wait_timeout(I2C_PNX_TIMEOUT, alg_data)) 332 if (wait_timeout(alg_data))
287 dev_err(&alg_data->adapter.dev, 333 dev_err(&alg_data->adapter.dev,
288 "The bus is still active after timeout\n"); 334 "The bus is still active after timeout\n");
289 335
@@ -399,7 +445,7 @@ static void i2c_pnx_timeout(unsigned long data)
399 445
400 ctl |= mcntrl_reset; 446 ctl |= mcntrl_reset;
401 iowrite32(ctl, I2C_REG_CTL(alg_data)); 447 iowrite32(ctl, I2C_REG_CTL(alg_data));
402 wait_reset(I2C_PNX_TIMEOUT, alg_data); 448 wait_reset(alg_data);
403 alg_data->mif.ret = -EIO; 449 alg_data->mif.ret = -EIO;
404 complete(&alg_data->mif.complete); 450 complete(&alg_data->mif.complete);
405} 451}
@@ -414,18 +460,18 @@ static inline void bus_reset_if_active(struct i2c_pnx_algo_data *alg_data)
414 alg_data->adapter.name); 460 alg_data->adapter.name);
415 iowrite32(ioread32(I2C_REG_CTL(alg_data)) | mcntrl_reset, 461 iowrite32(ioread32(I2C_REG_CTL(alg_data)) | mcntrl_reset,
416 I2C_REG_CTL(alg_data)); 462 I2C_REG_CTL(alg_data));
417 wait_reset(I2C_PNX_TIMEOUT, alg_data); 463 wait_reset(alg_data);
418 } else if (!(stat & mstatus_rfe) || !(stat & mstatus_tfe)) { 464 } else if (!(stat & mstatus_rfe) || !(stat & mstatus_tfe)) {
419 /* If there is data in the fifo's after transfer, 465 /* If there is data in the fifo's after transfer,
420 * flush fifo's by reset. 466 * flush fifo's by reset.
421 */ 467 */
422 iowrite32(ioread32(I2C_REG_CTL(alg_data)) | mcntrl_reset, 468 iowrite32(ioread32(I2C_REG_CTL(alg_data)) | mcntrl_reset,
423 I2C_REG_CTL(alg_data)); 469 I2C_REG_CTL(alg_data));
424 wait_reset(I2C_PNX_TIMEOUT, alg_data); 470 wait_reset(alg_data);
425 } else if (stat & mstatus_nai) { 471 } else if (stat & mstatus_nai) {
426 iowrite32(ioread32(I2C_REG_CTL(alg_data)) | mcntrl_reset, 472 iowrite32(ioread32(I2C_REG_CTL(alg_data)) | mcntrl_reset,
427 I2C_REG_CTL(alg_data)); 473 I2C_REG_CTL(alg_data));
428 wait_reset(I2C_PNX_TIMEOUT, alg_data); 474 wait_reset(alg_data);
429 } 475 }
430} 476}
431 477
@@ -568,14 +614,8 @@ static int __devinit i2c_pnx_probe(struct platform_device *pdev)
568 int ret = 0; 614 int ret = 0;
569 struct i2c_pnx_algo_data *alg_data; 615 struct i2c_pnx_algo_data *alg_data;
570 unsigned long freq; 616 unsigned long freq;
571 struct i2c_pnx_data *i2c_pnx = pdev->dev.platform_data; 617 struct resource *res;
572 618 u32 speed = I2C_PNX_SPEED_KHZ_DEFAULT * 1000;
573 if (!i2c_pnx || !i2c_pnx->name) {
574 dev_err(&pdev->dev, "%s: no platform data supplied\n",
575 __func__);
576 ret = -EINVAL;
577 goto out;
578 }
579 619
580 alg_data = kzalloc(sizeof(*alg_data), GFP_KERNEL); 620 alg_data = kzalloc(sizeof(*alg_data), GFP_KERNEL);
581 if (!alg_data) { 621 if (!alg_data) {
@@ -585,14 +625,27 @@ static int __devinit i2c_pnx_probe(struct platform_device *pdev)
585 625
586 platform_set_drvdata(pdev, alg_data); 626 platform_set_drvdata(pdev, alg_data);
587 627
588 strlcpy(alg_data->adapter.name, i2c_pnx->name,
589 sizeof(alg_data->adapter.name));
590 alg_data->adapter.dev.parent = &pdev->dev; 628 alg_data->adapter.dev.parent = &pdev->dev;
591 alg_data->adapter.algo = &pnx_algorithm; 629 alg_data->adapter.algo = &pnx_algorithm;
592 alg_data->adapter.algo_data = alg_data; 630 alg_data->adapter.algo_data = alg_data;
593 alg_data->adapter.nr = pdev->id; 631 alg_data->adapter.nr = pdev->id;
594 alg_data->i2c_pnx = i2c_pnx;
595 632
633 alg_data->timeout = I2C_PNX_TIMEOUT_DEFAULT;
634#ifdef CONFIG_OF
635 alg_data->adapter.dev.of_node = of_node_get(pdev->dev.of_node);
636 if (pdev->dev.of_node) {
637 of_property_read_u32(pdev->dev.of_node, "clock-frequency",
638 &speed);
639 /*
640 * At this point, it is planned to add an OF timeout property.
641 * As soon as there is a consensus about how to call and handle
642 * this, sth. like the following can be put here:
643 *
644 * of_property_read_u32(pdev->dev.of_node, "timeout",
645 * &alg_data->timeout);
646 */
647 }
648#endif
596 alg_data->clk = clk_get(&pdev->dev, NULL); 649 alg_data->clk = clk_get(&pdev->dev, NULL);
597 if (IS_ERR(alg_data->clk)) { 650 if (IS_ERR(alg_data->clk)) {
598 ret = PTR_ERR(alg_data->clk); 651 ret = PTR_ERR(alg_data->clk);
@@ -603,17 +656,27 @@ static int __devinit i2c_pnx_probe(struct platform_device *pdev)
603 alg_data->mif.timer.function = i2c_pnx_timeout; 656 alg_data->mif.timer.function = i2c_pnx_timeout;
604 alg_data->mif.timer.data = (unsigned long)alg_data; 657 alg_data->mif.timer.data = (unsigned long)alg_data;
605 658
659 snprintf(alg_data->adapter.name, sizeof(alg_data->adapter.name),
660 "%s", pdev->name);
661
606 /* Register I/O resource */ 662 /* Register I/O resource */
607 if (!request_mem_region(i2c_pnx->base, I2C_PNX_REGION_SIZE, 663 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
664 if (!res) {
665 dev_err(&pdev->dev, "Unable to get mem resource.\n");
666 ret = -EBUSY;
667 goto out_clkget;
668 }
669 if (!request_mem_region(res->start, I2C_PNX_REGION_SIZE,
608 pdev->name)) { 670 pdev->name)) {
609 dev_err(&pdev->dev, 671 dev_err(&pdev->dev,
610 "I/O region 0x%08x for I2C already in use.\n", 672 "I/O region 0x%08x for I2C already in use.\n",
611 i2c_pnx->base); 673 res->start);
612 ret = -ENODEV; 674 ret = -ENOMEM;
613 goto out_clkget; 675 goto out_clkget;
614 } 676 }
615 677
616 alg_data->ioaddr = ioremap(i2c_pnx->base, I2C_PNX_REGION_SIZE); 678 alg_data->base = res->start;
679 alg_data->ioaddr = ioremap(res->start, I2C_PNX_REGION_SIZE);
617 if (!alg_data->ioaddr) { 680 if (!alg_data->ioaddr) {
618 dev_err(&pdev->dev, "Couldn't ioremap I2C I/O region\n"); 681 dev_err(&pdev->dev, "Couldn't ioremap I2C I/O region\n");
619 ret = -ENOMEM; 682 ret = -ENOMEM;
@@ -637,20 +700,25 @@ static int __devinit i2c_pnx_probe(struct platform_device *pdev)
637 * the deglitching filter length. 700 * the deglitching filter length.
638 */ 701 */
639 702
640 tmp = ((freq / 1000) / I2C_PNX_SPEED_KHZ) / 2 - 2; 703 tmp = (freq / speed) / 2 - 2;
641 if (tmp > 0x3FF) 704 if (tmp > 0x3FF)
642 tmp = 0x3FF; 705 tmp = 0x3FF;
643 iowrite32(tmp, I2C_REG_CKH(alg_data)); 706 iowrite32(tmp, I2C_REG_CKH(alg_data));
644 iowrite32(tmp, I2C_REG_CKL(alg_data)); 707 iowrite32(tmp, I2C_REG_CKL(alg_data));
645 708
646 iowrite32(mcntrl_reset, I2C_REG_CTL(alg_data)); 709 iowrite32(mcntrl_reset, I2C_REG_CTL(alg_data));
647 if (wait_reset(I2C_PNX_TIMEOUT, alg_data)) { 710 if (wait_reset(alg_data)) {
648 ret = -ENODEV; 711 ret = -ENODEV;
649 goto out_clock; 712 goto out_clock;
650 } 713 }
651 init_completion(&alg_data->mif.complete); 714 init_completion(&alg_data->mif.complete);
652 715
653 ret = request_irq(i2c_pnx->irq, i2c_pnx_interrupt, 716 alg_data->irq = platform_get_irq(pdev, 0);
717 if (alg_data->irq < 0) {
718 dev_err(&pdev->dev, "Failed to get IRQ from platform resource\n");
719 goto out_irq;
720 }
721 ret = request_irq(alg_data->irq, i2c_pnx_interrupt,
654 0, pdev->name, alg_data); 722 0, pdev->name, alg_data);
655 if (ret) 723 if (ret)
656 goto out_clock; 724 goto out_clock;
@@ -662,39 +730,39 @@ static int __devinit i2c_pnx_probe(struct platform_device *pdev)
662 goto out_irq; 730 goto out_irq;
663 } 731 }
664 732
733 of_i2c_register_devices(&alg_data->adapter);
734
665 dev_dbg(&pdev->dev, "%s: Master at %#8x, irq %d.\n", 735 dev_dbg(&pdev->dev, "%s: Master at %#8x, irq %d.\n",
666 alg_data->adapter.name, i2c_pnx->base, i2c_pnx->irq); 736 alg_data->adapter.name, res->start, alg_data->irq);
667 737
668 return 0; 738 return 0;
669 739
670out_irq: 740out_irq:
671 free_irq(i2c_pnx->irq, alg_data); 741 free_irq(alg_data->irq, alg_data);
672out_clock: 742out_clock:
673 clk_disable(alg_data->clk); 743 clk_disable(alg_data->clk);
674out_unmap: 744out_unmap:
675 iounmap(alg_data->ioaddr); 745 iounmap(alg_data->ioaddr);
676out_release: 746out_release:
677 release_mem_region(i2c_pnx->base, I2C_PNX_REGION_SIZE); 747 release_mem_region(res->start, I2C_PNX_REGION_SIZE);
678out_clkget: 748out_clkget:
679 clk_put(alg_data->clk); 749 clk_put(alg_data->clk);
680out_drvdata: 750out_drvdata:
681 kfree(alg_data); 751 kfree(alg_data);
682err_kzalloc: 752err_kzalloc:
683 platform_set_drvdata(pdev, NULL); 753 platform_set_drvdata(pdev, NULL);
684out:
685 return ret; 754 return ret;
686} 755}
687 756
688static int __devexit i2c_pnx_remove(struct platform_device *pdev) 757static int __devexit i2c_pnx_remove(struct platform_device *pdev)
689{ 758{
690 struct i2c_pnx_algo_data *alg_data = platform_get_drvdata(pdev); 759 struct i2c_pnx_algo_data *alg_data = platform_get_drvdata(pdev);
691 struct i2c_pnx_data *i2c_pnx = alg_data->i2c_pnx;
692 760
693 free_irq(i2c_pnx->irq, alg_data); 761 free_irq(alg_data->irq, alg_data);
694 i2c_del_adapter(&alg_data->adapter); 762 i2c_del_adapter(&alg_data->adapter);
695 clk_disable(alg_data->clk); 763 clk_disable(alg_data->clk);
696 iounmap(alg_data->ioaddr); 764 iounmap(alg_data->ioaddr);
697 release_mem_region(i2c_pnx->base, I2C_PNX_REGION_SIZE); 765 release_mem_region(alg_data->base, I2C_PNX_REGION_SIZE);
698 clk_put(alg_data->clk); 766 clk_put(alg_data->clk);
699 kfree(alg_data); 767 kfree(alg_data);
700 platform_set_drvdata(pdev, NULL); 768 platform_set_drvdata(pdev, NULL);
@@ -702,10 +770,19 @@ static int __devexit i2c_pnx_remove(struct platform_device *pdev)
702 return 0; 770 return 0;
703} 771}
704 772
773#ifdef CONFIG_OF
774static const struct of_device_id i2c_pnx_of_match[] = {
775 { .compatible = "nxp,pnx-i2c" },
776 { },
777};
778MODULE_DEVICE_TABLE(of, i2c_pnx_of_match);
779#endif
780
705static struct platform_driver i2c_pnx_driver = { 781static struct platform_driver i2c_pnx_driver = {
706 .driver = { 782 .driver = {
707 .name = "pnx-i2c", 783 .name = "pnx-i2c",
708 .owner = THIS_MODULE, 784 .owner = THIS_MODULE,
785 .of_match_table = of_match_ptr(i2c_pnx_of_match),
709 }, 786 },
710 .probe = i2c_pnx_probe, 787 .probe = i2c_pnx_probe,
711 .remove = __devexit_p(i2c_pnx_remove), 788 .remove = __devexit_p(i2c_pnx_remove),
diff --git a/drivers/i2c/busses/i2c-s6000.c b/drivers/i2c/busses/i2c-s6000.c
index c64ba736f480..b76a29d1f8e4 100644
--- a/drivers/i2c/busses/i2c-s6000.c
+++ b/drivers/i2c/busses/i2c-s6000.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Description: Driver for S6000 Family I2C Interface 4 * Description: Driver for S6000 Family I2C Interface
5 * Copyright (c) 2008 emlix GmbH 5 * Copyright (c) 2008 emlix GmbH
6 * Author: Oskar Schirmer <os@emlix.com> 6 * Author: Oskar Schirmer <oskar@scara.com>
7 * 7 *
8 * Partially based on i2c-bfin-twi.c driver by <sonic.zhang@analog.com> 8 * Partially based on i2c-bfin-twi.c driver by <sonic.zhang@analog.com>
9 * Copyright (c) 2005-2007 Analog Devices, Inc. 9 * Copyright (c) 2005-2007 Analog Devices, Inc.
diff --git a/drivers/i2c/busses/i2c-s6000.h b/drivers/i2c/busses/i2c-s6000.h
index ff23b81ded44..4936f9f2256f 100644
--- a/drivers/i2c/busses/i2c-s6000.h
+++ b/drivers/i2c/busses/i2c-s6000.h
@@ -6,7 +6,7 @@
6 * for more details. 6 * for more details.
7 * 7 *
8 * Copyright (C) 2008 Emlix GmbH <info@emlix.com> 8 * Copyright (C) 2008 Emlix GmbH <info@emlix.com>
9 * Author: Oskar Schirmer <os@emlix.com> 9 * Author: Oskar Schirmer <oskar@scara.com>
10 */ 10 */
11 11
12#ifndef __DRIVERS_I2C_BUSSES_I2C_S6000_H 12#ifndef __DRIVERS_I2C_BUSSES_I2C_S6000_H