diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-22 12:30:52 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-22 12:30:52 -0400 |
commit | b324c67d4800e59171f48d9ddab6cbfb59110482 (patch) | |
tree | a16509a710e76fa24c01514b60aed06b7db13716 /drivers/i2c | |
parent | 8dca6010d44cc722a94dc6da96560f9083dac782 (diff) | |
parent | 396d81cd0fe12ce5d1f6d159f093f9315d2837bc (diff) |
Merge tag 'dt' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull device tree conversions for arm-soc, part 1, from Olof Johansson:
"The spear3xx, lpc32xx, shmobile and mmp platforms are joining the game
of booting using device trees, which is a great step forward for them.
at91 and spear have pretty much completed this process with a huge
amount of work being put into at91. The other platforms are
continuing the process.
We finally start to see the payback on this investment, as new
machines are getting supported purely by adding a .dts source file
that can be completely independent of the kernel source."
Fix up trivial conflict in arch/arm/Kconfig
* tag 'dt' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (83 commits)
ARM: at91: Add ADC driver to at91sam9260/at91sam9g20 dtsi files
arm/dts: omap4-panda: Add LEDs support
arm/dts: omap4-sdp: Add LEDs support
arm/dts: twl4030: Add twl4030-gpio node
OMAP4: devices: Do not create mcpdm device if the dtb has been provided
OMAP4: devices: Do not create dmic device if the dtb has been provided
Documentation: update docs for mmp dt
ARM: dts: refresh dts file for arch mmp
ARM: mmp: support pxa910 with device tree
ARM: mmp: support mmp2 with device tree
gpio: pxa: parse gpio from DTS file
ARM: mmp: support DT in timer
ARM: mmp: support DT in irq
ARM: mmp: append CONFIG_MACH_MMP2_DT
ARM: mmp: fix build issue on mmp with device tree
ARM: ux500: Enable PRCMU Timer 4 (clocksource) for Device Tree
ARM: ux500: Disable SMSC911x platform code registration when DT is enabled
ARM: ux500: Fork cpu-db8500 platform_devs for sequential DT enablement
ARM: ux500: Do not attempt to register non-existent i2c devices on Snowball
ARM: SPEAr3xx: Correct keyboard data passed from DT
...
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/busses/i2c-pnx.c | 157 |
1 files changed, 117 insertions, 40 deletions
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 | |||
32 | enum { | ||
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> | 46 | enum { |
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 */ | 58 | enum { |
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 | ||
34 | static 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 | |||
78 | static 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 | ||
44 | static inline int wait_reset(long timeout, struct i2c_pnx_algo_data *data) | 89 | static 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) | |||
54 | static inline void i2c_pnx_arm_timer(struct i2c_pnx_algo_data *alg_data) | 100 | static 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 | ||
670 | out_irq: | 740 | out_irq: |
671 | free_irq(i2c_pnx->irq, alg_data); | 741 | free_irq(alg_data->irq, alg_data); |
672 | out_clock: | 742 | out_clock: |
673 | clk_disable(alg_data->clk); | 743 | clk_disable(alg_data->clk); |
674 | out_unmap: | 744 | out_unmap: |
675 | iounmap(alg_data->ioaddr); | 745 | iounmap(alg_data->ioaddr); |
676 | out_release: | 746 | out_release: |
677 | release_mem_region(i2c_pnx->base, I2C_PNX_REGION_SIZE); | 747 | release_mem_region(res->start, I2C_PNX_REGION_SIZE); |
678 | out_clkget: | 748 | out_clkget: |
679 | clk_put(alg_data->clk); | 749 | clk_put(alg_data->clk); |
680 | out_drvdata: | 750 | out_drvdata: |
681 | kfree(alg_data); | 751 | kfree(alg_data); |
682 | err_kzalloc: | 752 | err_kzalloc: |
683 | platform_set_drvdata(pdev, NULL); | 753 | platform_set_drvdata(pdev, NULL); |
684 | out: | ||
685 | return ret; | 754 | return ret; |
686 | } | 755 | } |
687 | 756 | ||
688 | static int __devexit i2c_pnx_remove(struct platform_device *pdev) | 757 | static 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 | ||
774 | static const struct of_device_id i2c_pnx_of_match[] = { | ||
775 | { .compatible = "nxp,pnx-i2c" }, | ||
776 | { }, | ||
777 | }; | ||
778 | MODULE_DEVICE_TABLE(of, i2c_pnx_of_match); | ||
779 | #endif | ||
780 | |||
705 | static struct platform_driver i2c_pnx_driver = { | 781 | static 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), |