aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma/ti-dma-crossbar.c
diff options
context:
space:
mode:
authorPeter Ujfalusi <peter.ujfalusi@ti.com>2015-07-22 04:48:10 -0400
committerVinod Koul <vinod.koul@intel.com>2015-07-22 10:26:07 -0400
commit1eb995bbf7a85e18f54fb162eade381320a3fcea (patch)
tree0fd203a646e77e86a2d43ec133623b28c1106f1f /drivers/dma/ti-dma-crossbar.c
parentbe559daabfaac74a7acd8cb56fae86fca7349f10 (diff)
dmaengine: ti-dma-crossbar: Add support for eDMA
The crossbar for eDMA works exactly the same way as sDMA, but sDMA requires an offset of 1, while no offset is needed for eDMA. Based on the patch from Misael Lopez Cruz <misael.lopez@ti.com> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> CC: Misael Lopez Cruz <misael.lopez@ti.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Diffstat (limited to 'drivers/dma/ti-dma-crossbar.c')
-rw-r--r--drivers/dma/ti-dma-crossbar.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/drivers/dma/ti-dma-crossbar.c b/drivers/dma/ti-dma-crossbar.c
index 1fd3fb73d6e8..10487d91e60d 100644
--- a/drivers/dma/ti-dma-crossbar.c
+++ b/drivers/dma/ti-dma-crossbar.c
@@ -20,6 +20,9 @@
20#define TI_XBAR_OUTPUTS 127 20#define TI_XBAR_OUTPUTS 127
21#define TI_XBAR_INPUTS 256 21#define TI_XBAR_INPUTS 256
22 22
23#define TI_XBAR_EDMA_OFFSET 0
24#define TI_XBAR_SDMA_OFFSET 1
25
23struct ti_dma_xbar_data { 26struct ti_dma_xbar_data {
24 void __iomem *iomem; 27 void __iomem *iomem;
25 28
@@ -29,6 +32,7 @@ struct ti_dma_xbar_data {
29 u16 safe_val; /* Value to rest the crossbar lines */ 32 u16 safe_val; /* Value to rest the crossbar lines */
30 u32 xbar_requests; /* number of DMA requests connected to XBAR */ 33 u32 xbar_requests; /* number of DMA requests connected to XBAR */
31 u32 dma_requests; /* number of DMA requests forwarded to DMA */ 34 u32 dma_requests; /* number of DMA requests forwarded to DMA */
35 u32 dma_offset;
32}; 36};
33 37
34struct ti_dma_xbar_map { 38struct ti_dma_xbar_map {
@@ -84,8 +88,7 @@ static void *ti_dma_xbar_route_allocate(struct of_phandle_args *dma_spec,
84 GFP_KERNEL); 88 GFP_KERNEL);
85 map->xbar_in = (u16)dma_spec->args[0]; 89 map->xbar_in = (u16)dma_spec->args[0];
86 90
87 /* The DMA request is 1 based in sDMA */ 91 dma_spec->args[0] = map->xbar_out + xbar->dma_offset;
88 dma_spec->args[0] = map->xbar_out + 1;
89 92
90 dev_dbg(&pdev->dev, "Mapping XBAR%u to DMA%d\n", 93 dev_dbg(&pdev->dev, "Mapping XBAR%u to DMA%d\n",
91 map->xbar_in, map->xbar_out); 94 map->xbar_in, map->xbar_out);
@@ -95,9 +98,22 @@ static void *ti_dma_xbar_route_allocate(struct of_phandle_args *dma_spec,
95 return map; 98 return map;
96} 99}
97 100
101static const struct of_device_id ti_dma_master_match[] = {
102 {
103 .compatible = "ti,omap4430-sdma",
104 .data = (void *)TI_XBAR_SDMA_OFFSET,
105 },
106 {
107 .compatible = "ti,edma3",
108 .data = (void *)TI_XBAR_EDMA_OFFSET,
109 },
110 {},
111};
112
98static int ti_dma_xbar_probe(struct platform_device *pdev) 113static int ti_dma_xbar_probe(struct platform_device *pdev)
99{ 114{
100 struct device_node *node = pdev->dev.of_node; 115 struct device_node *node = pdev->dev.of_node;
116 const struct of_device_id *match;
101 struct device_node *dma_node; 117 struct device_node *dma_node;
102 struct ti_dma_xbar_data *xbar; 118 struct ti_dma_xbar_data *xbar;
103 struct resource *res; 119 struct resource *res;
@@ -120,6 +136,12 @@ static int ti_dma_xbar_probe(struct platform_device *pdev)
120 return -ENODEV; 136 return -ENODEV;
121 } 137 }
122 138
139 match = of_match_node(ti_dma_master_match, dma_node);
140 if (!match) {
141 dev_err(&pdev->dev, "DMA master is not supported\n");
142 return -EINVAL;
143 }
144
123 if (of_property_read_u32(dma_node, "dma-requests", 145 if (of_property_read_u32(dma_node, "dma-requests",
124 &xbar->dma_requests)) { 146 &xbar->dma_requests)) {
125 dev_info(&pdev->dev, 147 dev_info(&pdev->dev,
@@ -151,6 +173,7 @@ static int ti_dma_xbar_probe(struct platform_device *pdev)
151 173
152 xbar->dmarouter.dev = &pdev->dev; 174 xbar->dmarouter.dev = &pdev->dev;
153 xbar->dmarouter.route_free = ti_dma_xbar_free; 175 xbar->dmarouter.route_free = ti_dma_xbar_free;
176 xbar->dma_offset = (u32)match->data;
154 177
155 platform_set_drvdata(pdev, xbar); 178 platform_set_drvdata(pdev, xbar);
156 179