Commit be559daa authored by Misael Lopez Cruz's avatar Misael Lopez Cruz Committed by Vinod Koul

dmaengine: ti-dma-crossbar: Make idr xbar instance-specific

In preparation for supporting multiple DMA crossbar instances,
make the idr xbar instance specific.
Signed-off-by: default avatarMisael Lopez Cruz <misael.lopez@ti.com>
Signed-off-by: default avatarPeter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: default avatarVinod Koul <vinod.koul@intel.com>
parent d770e558
...@@ -20,12 +20,11 @@ ...@@ -20,12 +20,11 @@
#define TI_XBAR_OUTPUTS 127 #define TI_XBAR_OUTPUTS 127
#define TI_XBAR_INPUTS 256 #define TI_XBAR_INPUTS 256
static DEFINE_IDR(map_idr);
struct ti_dma_xbar_data { struct ti_dma_xbar_data {
void __iomem *iomem; void __iomem *iomem;
struct dma_router dmarouter; struct dma_router dmarouter;
struct idr map_idr;
u16 safe_val; /* Value to rest the crossbar lines */ u16 safe_val; /* Value to rest the crossbar lines */
u32 xbar_requests; /* number of DMA requests connected to XBAR */ u32 xbar_requests; /* number of DMA requests connected to XBAR */
...@@ -51,7 +50,7 @@ static void ti_dma_xbar_free(struct device *dev, void *route_data) ...@@ -51,7 +50,7 @@ static void ti_dma_xbar_free(struct device *dev, void *route_data)
map->xbar_in, map->xbar_out); map->xbar_in, map->xbar_out);
ti_dma_xbar_write(xbar->iomem, map->xbar_out, xbar->safe_val); ti_dma_xbar_write(xbar->iomem, map->xbar_out, xbar->safe_val);
idr_remove(&map_idr, map->xbar_out); idr_remove(&xbar->map_idr, map->xbar_out);
kfree(map); kfree(map);
} }
...@@ -81,7 +80,7 @@ static void *ti_dma_xbar_route_allocate(struct of_phandle_args *dma_spec, ...@@ -81,7 +80,7 @@ static void *ti_dma_xbar_route_allocate(struct of_phandle_args *dma_spec,
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
} }
map->xbar_out = idr_alloc(&map_idr, NULL, 0, xbar->dma_requests, map->xbar_out = idr_alloc(&xbar->map_idr, NULL, 0, xbar->dma_requests,
GFP_KERNEL); GFP_KERNEL);
map->xbar_in = (u16)dma_spec->args[0]; map->xbar_in = (u16)dma_spec->args[0];
...@@ -113,6 +112,8 @@ static int ti_dma_xbar_probe(struct platform_device *pdev) ...@@ -113,6 +112,8 @@ static int ti_dma_xbar_probe(struct platform_device *pdev)
if (!xbar) if (!xbar)
return -ENOMEM; return -ENOMEM;
idr_init(&xbar->map_idr);
dma_node = of_parse_phandle(node, "dma-masters", 0); dma_node = of_parse_phandle(node, "dma-masters", 0);
if (!dma_node) { if (!dma_node) {
dev_err(&pdev->dev, "Can't get DMA master node\n"); dev_err(&pdev->dev, "Can't get DMA master node\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment