diff options
-rw-r--r-- | Documentation/devicetree/bindings/dma/fsl-mxs-dma.txt | 19 | ||||
-rw-r--r-- | drivers/dma/mxs-dma.c | 29 |
2 files changed, 43 insertions, 5 deletions
diff --git a/Documentation/devicetree/bindings/dma/fsl-mxs-dma.txt b/Documentation/devicetree/bindings/dma/fsl-mxs-dma.txt new file mode 100644 index 000000000000..ded0398d3bdc --- /dev/null +++ b/Documentation/devicetree/bindings/dma/fsl-mxs-dma.txt | |||
@@ -0,0 +1,19 @@ | |||
1 | * Freescale MXS DMA | ||
2 | |||
3 | Required properties: | ||
4 | - compatible : Should be "fsl,<chip>-dma-apbh" or "fsl,<chip>-dma-apbx" | ||
5 | - reg : Should contain registers location and length | ||
6 | |||
7 | Supported chips: | ||
8 | imx23, imx28. | ||
9 | |||
10 | Examples: | ||
11 | dma-apbh@80004000 { | ||
12 | compatible = "fsl,imx28-dma-apbh"; | ||
13 | reg = <0x80004000 2000>; | ||
14 | }; | ||
15 | |||
16 | dma-apbx@80024000 { | ||
17 | compatible = "fsl,imx28-dma-apbx"; | ||
18 | reg = <0x80024000 2000>; | ||
19 | }; | ||
diff --git a/drivers/dma/mxs-dma.c b/drivers/dma/mxs-dma.c index b1cab087cd04..1cb9b974493f 100644 --- a/drivers/dma/mxs-dma.c +++ b/drivers/dma/mxs-dma.c | |||
@@ -22,8 +22,11 @@ | |||
22 | #include <linux/platform_device.h> | 22 | #include <linux/platform_device.h> |
23 | #include <linux/dmaengine.h> | 23 | #include <linux/dmaengine.h> |
24 | #include <linux/delay.h> | 24 | #include <linux/delay.h> |
25 | #include <linux/module.h> | ||
25 | #include <linux/fsl/mxs-dma.h> | 26 | #include <linux/fsl/mxs-dma.h> |
26 | #include <linux/stmp_device.h> | 27 | #include <linux/stmp_device.h> |
28 | #include <linux/of.h> | ||
29 | #include <linux/of_device.h> | ||
27 | 30 | ||
28 | #include <asm/irq.h> | 31 | #include <asm/irq.h> |
29 | #include <mach/mxs.h> | 32 | #include <mach/mxs.h> |
@@ -177,6 +180,15 @@ static struct platform_device_id mxs_dma_ids[] = { | |||
177 | } | 180 | } |
178 | }; | 181 | }; |
179 | 182 | ||
183 | static const struct of_device_id mxs_dma_dt_ids[] = { | ||
184 | { .compatible = "fsl,imx23-dma-apbh", .data = &mxs_dma_ids[0], }, | ||
185 | { .compatible = "fsl,imx23-dma-apbx", .data = &mxs_dma_ids[1], }, | ||
186 | { .compatible = "fsl,imx28-dma-apbh", .data = &mxs_dma_ids[2], }, | ||
187 | { .compatible = "fsl,imx28-dma-apbx", .data = &mxs_dma_ids[3], }, | ||
188 | { /* sentinel */ } | ||
189 | }; | ||
190 | MODULE_DEVICE_TABLE(of, mxs_dma_dt_ids); | ||
191 | |||
180 | static struct mxs_dma_chan *to_mxs_dma_chan(struct dma_chan *chan) | 192 | static struct mxs_dma_chan *to_mxs_dma_chan(struct dma_chan *chan) |
181 | { | 193 | { |
182 | return container_of(chan, struct mxs_dma_chan, chan); | 194 | return container_of(chan, struct mxs_dma_chan, chan); |
@@ -652,10 +664,9 @@ err_out: | |||
652 | 664 | ||
653 | static int __init mxs_dma_probe(struct platform_device *pdev) | 665 | static int __init mxs_dma_probe(struct platform_device *pdev) |
654 | { | 666 | { |
655 | const struct platform_device_id *id_entry = | 667 | const struct platform_device_id *id_entry; |
656 | platform_get_device_id(pdev); | 668 | const struct of_device_id *of_id; |
657 | const struct mxs_dma_type *dma_type = | 669 | const struct mxs_dma_type *dma_type; |
658 | (struct mxs_dma_type *)id_entry->driver_data; | ||
659 | struct mxs_dma_engine *mxs_dma; | 670 | struct mxs_dma_engine *mxs_dma; |
660 | struct resource *iores; | 671 | struct resource *iores; |
661 | int ret, i; | 672 | int ret, i; |
@@ -664,8 +675,15 @@ static int __init mxs_dma_probe(struct platform_device *pdev) | |||
664 | if (!mxs_dma) | 675 | if (!mxs_dma) |
665 | return -ENOMEM; | 676 | return -ENOMEM; |
666 | 677 | ||
667 | mxs_dma->dev_id = dma_type->id; | 678 | of_id = of_match_device(mxs_dma_dt_ids, &pdev->dev); |
679 | if (of_id) | ||
680 | id_entry = of_id->data; | ||
681 | else | ||
682 | id_entry = platform_get_device_id(pdev); | ||
683 | |||
684 | dma_type = (struct mxs_dma_type *)id_entry->driver_data; | ||
668 | mxs_dma->type = dma_type->type; | 685 | mxs_dma->type = dma_type->type; |
686 | mxs_dma->dev_id = dma_type->id; | ||
669 | 687 | ||
670 | iores = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 688 | iores = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
671 | 689 | ||
@@ -751,6 +769,7 @@ err_request_region: | |||
751 | static struct platform_driver mxs_dma_driver = { | 769 | static struct platform_driver mxs_dma_driver = { |
752 | .driver = { | 770 | .driver = { |
753 | .name = "mxs-dma", | 771 | .name = "mxs-dma", |
772 | .of_match_table = mxs_dma_dt_ids, | ||
754 | }, | 773 | }, |
755 | .id_table = mxs_dma_ids, | 774 | .id_table = mxs_dma_ids, |
756 | }; | 775 | }; |