aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-05-07 14:06:17 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-05-07 14:06:17 -0400
commit38f56f33ca381751f9b8910f67e7a805ec0b68cb (patch)
tree202f2ce60f3f43a948607ec76c8cc48c1cf73a4b /drivers/i2c
parentfcba914542082b272f31c8e4c40000b88ed3208d (diff)
parent4183bef2e093a2f0aab45f2d5fed82b0e02aeacf (diff)
Merge tag 'dt-for-linus-2' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull ARM SoC device tree updates (part 2) from Arnd Bergmann: "These are mostly new device tree bindings for existing drivers, as well as changes to the device tree source files to add support for those devices, and a couple of new boards, most notably Samsung's Exynos5 based Chromebook. The changes depend on earlier platform specific updates and touch the usual platforms: omap, exynos, tegra, mxs, mvebu and davinci." * tag 'dt-for-linus-2' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (169 commits) ARM: exynos: dts: cros5250: add EC device ARM: dts: Add sbs-battery for exynos5250-snow ARM: dts: Add i2c-arbitrator bus for exynos5250-snow ARM: dts: add mshc controller node for Exynos4x12 SoCs ARM: dts: Add chip-id controller node on Exynos4/5 SoC ARM: EXYNOS: Create virtual I/O mapping for Chip-ID controller using device tree ARM: davinci: da850-evm: add SPI flash support ARM: davinci: da850: override SPI DT node device name ARM: davinci: da850: add SPI1 DT node spi/davinci: add DT binding documentation spi/davinci: no wildcards in DT compatible property ARM: dts: mvebu: Convert mvebu device tree files to 64 bits ARM: dts: mvebu: introduce internal-regs node ARM: dts: mvebu: Convert all the mvebu files to use the range property ARM: dts: mvebu: move all peripherals inside soc ARM: dts: mvebu: fix cpus section indentation ARM: davinci: da850: add EHRPWM & ECAP DT node ARM/dts: OMAP3: fix pinctrl-single configuration ARM: dts: Add OMAP3430 SDP NOR flash memory binding ARM: dts: Add NOR flash bindings for OMAP2420 H4 ...
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/busses/i2c-mxs.c40
1 files changed, 3 insertions, 37 deletions
diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c
index c67d89fc6254..2039f230482d 100644
--- a/drivers/i2c/busses/i2c-mxs.c
+++ b/drivers/i2c/busses/i2c-mxs.c
@@ -31,7 +31,6 @@
31#include <linux/of_i2c.h> 31#include <linux/of_i2c.h>
32#include <linux/dma-mapping.h> 32#include <linux/dma-mapping.h>
33#include <linux/dmaengine.h> 33#include <linux/dmaengine.h>
34#include <linux/fsl/mxs-dma.h>
35 34
36#define DRIVER_NAME "mxs-i2c" 35#define DRIVER_NAME "mxs-i2c"
37 36
@@ -118,9 +117,7 @@ struct mxs_i2c_dev {
118 uint32_t timing1; 117 uint32_t timing1;
119 118
120 /* DMA support components */ 119 /* DMA support components */
121 int dma_channel;
122 struct dma_chan *dmach; 120 struct dma_chan *dmach;
123 struct mxs_dma_data dma_data;
124 uint32_t pio_data[2]; 121 uint32_t pio_data[2];
125 uint32_t addr_data; 122 uint32_t addr_data;
126 struct scatterlist sg_io[2]; 123 struct scatterlist sg_io[2];
@@ -581,21 +578,6 @@ static const struct i2c_algorithm mxs_i2c_algo = {
581 .functionality = mxs_i2c_func, 578 .functionality = mxs_i2c_func,
582}; 579};
583 580
584static bool mxs_i2c_dma_filter(struct dma_chan *chan, void *param)
585{
586 struct mxs_i2c_dev *i2c = param;
587
588 if (!mxs_dma_is_apbx(chan))
589 return false;
590
591 if (chan->chan_id != i2c->dma_channel)
592 return false;
593
594 chan->private = &i2c->dma_data;
595
596 return true;
597}
598
599static void mxs_i2c_derive_timing(struct mxs_i2c_dev *i2c, int speed) 581static void mxs_i2c_derive_timing(struct mxs_i2c_dev *i2c, int speed)
600{ 582{
601 /* The I2C block clock run at 24MHz */ 583 /* The I2C block clock run at 24MHz */
@@ -640,17 +622,6 @@ static int mxs_i2c_get_ofdata(struct mxs_i2c_dev *i2c)
640 struct device_node *node = dev->of_node; 622 struct device_node *node = dev->of_node;
641 int ret; 623 int ret;
642 624
643 /*
644 * TODO: This is a temporary solution and should be changed
645 * to use generic DMA binding later when the helpers get in.
646 */
647 ret = of_property_read_u32(node, "fsl,i2c-dma-channel",
648 &i2c->dma_channel);
649 if (ret) {
650 dev_err(dev, "Failed to get DMA channel!\n");
651 return -ENODEV;
652 }
653
654 ret = of_property_read_u32(node, "clock-frequency", &speed); 625 ret = of_property_read_u32(node, "clock-frequency", &speed);
655 if (ret) { 626 if (ret) {
656 dev_warn(dev, "No I2C speed selected, using 100kHz\n"); 627 dev_warn(dev, "No I2C speed selected, using 100kHz\n");
@@ -670,8 +641,7 @@ static int mxs_i2c_probe(struct platform_device *pdev)
670 struct pinctrl *pinctrl; 641 struct pinctrl *pinctrl;
671 struct resource *res; 642 struct resource *res;
672 resource_size_t res_size; 643 resource_size_t res_size;
673 int err, irq, dmairq; 644 int err, irq;
674 dma_cap_mask_t mask;
675 645
676 pinctrl = devm_pinctrl_get_select_default(dev); 646 pinctrl = devm_pinctrl_get_select_default(dev);
677 if (IS_ERR(pinctrl)) 647 if (IS_ERR(pinctrl))
@@ -683,9 +653,8 @@ static int mxs_i2c_probe(struct platform_device *pdev)
683 653
684 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 654 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
685 irq = platform_get_irq(pdev, 0); 655 irq = platform_get_irq(pdev, 0);
686 dmairq = platform_get_irq(pdev, 1);
687 656
688 if (!res || irq < 0 || dmairq < 0) 657 if (!res || irq < 0)
689 return -ENOENT; 658 return -ENOENT;
690 659
691 res_size = resource_size(res); 660 res_size = resource_size(res);
@@ -711,10 +680,7 @@ static int mxs_i2c_probe(struct platform_device *pdev)
711 } 680 }
712 681
713 /* Setup the DMA */ 682 /* Setup the DMA */
714 dma_cap_zero(mask); 683 i2c->dmach = dma_request_slave_channel(dev, "rx-tx");
715 dma_cap_set(DMA_SLAVE, mask);
716 i2c->dma_data.chan_irq = dmairq;
717 i2c->dmach = dma_request_channel(mask, mxs_i2c_dma_filter, i2c);
718 if (!i2c->dmach) { 684 if (!i2c->dmach) {
719 dev_err(dev, "Failed to request dma\n"); 685 dev_err(dev, "Failed to request dma\n");
720 return -ENODEV; 686 return -ENODEV;