diff options
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/busses/i2c-mxs.c | 40 |
1 files changed, 3 insertions, 37 deletions
diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c index 120f24646696..d1ba6b403b84 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 | ||
@@ -113,9 +112,7 @@ struct mxs_i2c_dev { | |||
113 | uint32_t timing1; | 112 | uint32_t timing1; |
114 | 113 | ||
115 | /* DMA support components */ | 114 | /* DMA support components */ |
116 | int dma_channel; | ||
117 | struct dma_chan *dmach; | 115 | struct dma_chan *dmach; |
118 | struct mxs_dma_data dma_data; | ||
119 | uint32_t pio_data[2]; | 116 | uint32_t pio_data[2]; |
120 | uint32_t addr_data; | 117 | uint32_t addr_data; |
121 | struct scatterlist sg_io[2]; | 118 | struct scatterlist sg_io[2]; |
@@ -518,21 +515,6 @@ static const struct i2c_algorithm mxs_i2c_algo = { | |||
518 | .functionality = mxs_i2c_func, | 515 | .functionality = mxs_i2c_func, |
519 | }; | 516 | }; |
520 | 517 | ||
521 | static bool mxs_i2c_dma_filter(struct dma_chan *chan, void *param) | ||
522 | { | ||
523 | struct mxs_i2c_dev *i2c = param; | ||
524 | |||
525 | if (!mxs_dma_is_apbx(chan)) | ||
526 | return false; | ||
527 | |||
528 | if (chan->chan_id != i2c->dma_channel) | ||
529 | return false; | ||
530 | |||
531 | chan->private = &i2c->dma_data; | ||
532 | |||
533 | return true; | ||
534 | } | ||
535 | |||
536 | static void mxs_i2c_derive_timing(struct mxs_i2c_dev *i2c, int speed) | 518 | static void mxs_i2c_derive_timing(struct mxs_i2c_dev *i2c, int speed) |
537 | { | 519 | { |
538 | /* The I2C block clock run at 24MHz */ | 520 | /* The I2C block clock run at 24MHz */ |
@@ -577,17 +559,6 @@ static int mxs_i2c_get_ofdata(struct mxs_i2c_dev *i2c) | |||
577 | struct device_node *node = dev->of_node; | 559 | struct device_node *node = dev->of_node; |
578 | int ret; | 560 | int ret; |
579 | 561 | ||
580 | /* | ||
581 | * TODO: This is a temporary solution and should be changed | ||
582 | * to use generic DMA binding later when the helpers get in. | ||
583 | */ | ||
584 | ret = of_property_read_u32(node, "fsl,i2c-dma-channel", | ||
585 | &i2c->dma_channel); | ||
586 | if (ret) { | ||
587 | dev_err(dev, "Failed to get DMA channel!\n"); | ||
588 | return -ENODEV; | ||
589 | } | ||
590 | |||
591 | ret = of_property_read_u32(node, "clock-frequency", &speed); | 562 | ret = of_property_read_u32(node, "clock-frequency", &speed); |
592 | if (ret) { | 563 | if (ret) { |
593 | dev_warn(dev, "No I2C speed selected, using 100kHz\n"); | 564 | dev_warn(dev, "No I2C speed selected, using 100kHz\n"); |
@@ -607,8 +578,7 @@ static int mxs_i2c_probe(struct platform_device *pdev) | |||
607 | struct pinctrl *pinctrl; | 578 | struct pinctrl *pinctrl; |
608 | struct resource *res; | 579 | struct resource *res; |
609 | resource_size_t res_size; | 580 | resource_size_t res_size; |
610 | int err, irq, dmairq; | 581 | int err, irq; |
611 | dma_cap_mask_t mask; | ||
612 | 582 | ||
613 | pinctrl = devm_pinctrl_get_select_default(dev); | 583 | pinctrl = devm_pinctrl_get_select_default(dev); |
614 | if (IS_ERR(pinctrl)) | 584 | if (IS_ERR(pinctrl)) |
@@ -620,9 +590,8 @@ static int mxs_i2c_probe(struct platform_device *pdev) | |||
620 | 590 | ||
621 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 591 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
622 | irq = platform_get_irq(pdev, 0); | 592 | irq = platform_get_irq(pdev, 0); |
623 | dmairq = platform_get_irq(pdev, 1); | ||
624 | 593 | ||
625 | if (!res || irq < 0 || dmairq < 0) | 594 | if (!res || irq < 0) |
626 | return -ENOENT; | 595 | return -ENOENT; |
627 | 596 | ||
628 | res_size = resource_size(res); | 597 | res_size = resource_size(res); |
@@ -648,10 +617,7 @@ static int mxs_i2c_probe(struct platform_device *pdev) | |||
648 | } | 617 | } |
649 | 618 | ||
650 | /* Setup the DMA */ | 619 | /* Setup the DMA */ |
651 | dma_cap_zero(mask); | 620 | i2c->dmach = dma_request_slave_channel(dev, "rx-tx"); |
652 | dma_cap_set(DMA_SLAVE, mask); | ||
653 | i2c->dma_data.chan_irq = dmairq; | ||
654 | i2c->dmach = dma_request_channel(mask, mxs_i2c_dma_filter, i2c); | ||
655 | if (!i2c->dmach) { | 621 | if (!i2c->dmach) { |
656 | dev_err(dev, "Failed to request dma\n"); | 622 | dev_err(dev, "Failed to request dma\n"); |
657 | return -ENODEV; | 623 | return -ENODEV; |