if (dma_spec->args[0] >= xbar->dma_requests) {
dev_err(&pdev->dev, "Invalid DMA request line number: %d\n",
dma_spec->args[0]); return ERR_PTR(-EINVAL);
}
/* The of_node_put() will be done in the core for the node */
dma_spec->np = of_parse_phandle(ofdma->of_node, "dma-masters", 0); if (!dma_spec->np) {
dev_err(&pdev->dev, "Can't get DMA master\n"); return ERR_PTR(-EINVAL);
}
xbar = devm_kzalloc(&pdev->dev, sizeof(*xbar), GFP_KERNEL); if (!xbar) return -ENOMEM;
dma_node = of_parse_phandle(node, "dma-masters", 0); if (!dma_node) {
dev_err(&pdev->dev, "Can't get DMA master node\n"); return -ENODEV;
}
match = of_match_node(ti_am335x_master_match, dma_node); if (!match) {
dev_err(&pdev->dev, "DMA master is not supported\n");
of_node_put(dma_node); return -EINVAL;
}
if (of_property_read_u32(dma_node, "dma-requests",
&xbar->dma_requests)) {
dev_info(&pdev->dev, "Missing XBAR output information, using %u.\n",
TI_AM335X_XBAR_LINES);
xbar->dma_requests = TI_AM335X_XBAR_LINES;
}
of_node_put(dma_node);
if (of_property_read_u32(node, "dma-requests", &xbar->xbar_events)) {
dev_info(&pdev->dev, "Missing XBAR input information, using %u.\n",
TI_AM335X_XBAR_LINES);
xbar->xbar_events = TI_AM335X_XBAR_LINES;
}
iomem = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(iomem)) return PTR_ERR(iomem);
u16 safe_val; /* Value to rest the crossbar lines */
u32 xbar_requests; /* number of DMA requests connected to XBAR */
u32 dma_requests; /* number of DMA requests forwarded to DMA */
u32 dma_offset;
};
struct ti_dra7_xbar_map {
u16 xbar_in; int xbar_out;
};
/* The of_node_put() will be done in the core for the node */
dma_spec->np = of_parse_phandle(ofdma->of_node, "dma-masters", 0); if (!dma_spec->np) {
dev_err(&pdev->dev, "Can't get DMA master\n");
put_device(&pdev->dev); return ERR_PTR(-EINVAL);
}
xbar = devm_kzalloc(&pdev->dev, sizeof(*xbar), GFP_KERNEL); if (!xbar) return -ENOMEM;
dma_node = of_parse_phandle(node, "dma-masters", 0); if (!dma_node) {
dev_err(&pdev->dev, "Can't get DMA master node\n"); return -ENODEV;
}
match = of_match_node(ti_dra7_master_match, dma_node); if (!match) {
dev_err(&pdev->dev, "DMA master is not supported\n");
of_node_put(dma_node); return -EINVAL;
}
if (of_property_read_u32(dma_node, "dma-requests",
&xbar->dma_requests)) {
dev_info(&pdev->dev, "Missing XBAR output information, using %u.\n",
TI_DRA7_XBAR_OUTPUTS);
xbar->dma_requests = TI_DRA7_XBAR_OUTPUTS;
}
of_node_put(dma_node);
xbar->dma_inuse = devm_kcalloc(&pdev->dev,
BITS_TO_LONGS(xbar->dma_requests), sizeof(unsignedlong), GFP_KERNEL); if (!xbar->dma_inuse) return -ENOMEM;
if (of_property_read_u32(node, "dma-requests", &xbar->xbar_requests)) {
dev_info(&pdev->dev, "Missing XBAR input information, using %u.\n",
TI_DRA7_XBAR_INPUTS);
xbar->xbar_requests = TI_DRA7_XBAR_INPUTS;
}
if (!of_property_read_u32(node, "ti,dma-safe-map", &safe_val))
xbar->safe_val = (u16)safe_val;
/* Reset the crossbar */ for (i = 0; i < xbar->dma_requests; i++) { if (!test_bit(i, xbar->dma_inuse))
ti_dra7_xbar_write(xbar->iomem, i, xbar->safe_val);
}
ret = of_dma_router_register(node, ti_dra7_xbar_route_allocate,
&xbar->dmarouter); if (ret) { /* Restore the defaults for the crossbar */ for (i = 0; i < xbar->dma_requests; i++) { if (!test_bit(i, xbar->dma_inuse))
ti_dra7_xbar_write(xbar->iomem, i, i);
}
}
return ret;
}
staticint ti_dma_xbar_probe(struct platform_device *pdev)
{ conststruct of_device_id *match; int ret;
match = of_match_node(ti_dma_xbar_match, pdev->dev.of_node); if (unlikely(!match)) return -EINVAL;
switch (*(u32 *)match->data) { case TI_XBAR_DRA7:
ret = ti_dra7_xbar_probe(pdev); break; case TI_XBAR_AM335X:
ret = ti_am335x_xbar_probe(pdev); break; default:
dev_err(&pdev->dev, "Unsupported crossbar\n");
ret = -ENODEV; break;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.