Lines Matching +full:dma +full:- +full:protection +full:- +full:control

1 // SPDX-License-Identifier: GPL-2.0
3 * Platform driver for the Synopsys DesignWare DMA Controller
5 * Copyright (C) 2007-2008 Atmel Corporation
6 * Copyright (C) 2010-2011 ST Microelectronics
19 struct dw_dma *dw = ofdma->of_dma_data; in dw_dma_of_xlate()
21 .dma_dev = dw->dma.dev, in dw_dma_of_xlate()
25 if (dma_spec->args_count < 3 || dma_spec->args_count > 4) in dw_dma_of_xlate()
28 slave.src_id = dma_spec->args[0]; in dw_dma_of_xlate()
29 slave.dst_id = dma_spec->args[0]; in dw_dma_of_xlate()
30 slave.m_master = dma_spec->args[1]; in dw_dma_of_xlate()
31 slave.p_master = dma_spec->args[2]; in dw_dma_of_xlate()
32 if (dma_spec->args_count >= 4) in dw_dma_of_xlate()
33 slave.channels = dma_spec->args[3]; in dw_dma_of_xlate()
37 slave.m_master >= dw->pdata->nr_masters || in dw_dma_of_xlate()
38 slave.p_master >= dw->pdata->nr_masters || in dw_dma_of_xlate()
39 slave.channels >= BIT(dw->pdata->nr_channels))) in dw_dma_of_xlate()
51 struct device_node *np = pdev->dev.of_node; in dw_dma_parse_dt()
57 if (of_property_read_u32(np, "dma-masters", &nr_masters)) in dw_dma_parse_dt()
62 if (of_property_read_u32(np, "dma-channels", &nr_channels)) in dw_dma_parse_dt()
67 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); in dw_dma_parse_dt()
71 pdata->nr_masters = nr_masters; in dw_dma_parse_dt()
72 pdata->nr_channels = nr_channels; in dw_dma_parse_dt()
74 of_property_read_u32(np, "chan_allocation_order", &pdata->chan_allocation_order); in dw_dma_parse_dt()
75 of_property_read_u32(np, "chan_priority", &pdata->chan_priority); in dw_dma_parse_dt()
77 of_property_read_u32(np, "block_size", &pdata->block_size); in dw_dma_parse_dt()
82 pdata->data_width[tmp] = BIT(arr[tmp] & 0x07); in dw_dma_parse_dt()
85 /* If "data_width" and "data-width" both provided use the latter one */ in dw_dma_parse_dt()
86 of_property_read_u32_array(np, "data-width", pdata->data_width, nr_masters); in dw_dma_parse_dt()
88 memset32(pdata->multi_block, 1, nr_channels); in dw_dma_parse_dt()
89 of_property_read_u32_array(np, "multi-block", pdata->multi_block, nr_channels); in dw_dma_parse_dt()
91 memset32(pdata->max_burst, DW_DMA_MAX_BURST, nr_channels); in dw_dma_parse_dt()
92 of_property_read_u32_array(np, "snps,max-burst-len", pdata->max_burst, nr_channels); in dw_dma_parse_dt()
94 of_property_read_u32(np, "snps,dma-protection-control", &pdata->protctl); in dw_dma_parse_dt()
95 if (pdata->protctl > CHAN_PROTCTL_MASK) in dw_dma_parse_dt()
103 struct device *dev = dw->dma.dev; in dw_dma_of_controller_register()
106 if (!dev->of_node) in dw_dma_of_controller_register()
109 ret = of_dma_controller_register(dev->of_node, dw_dma_of_xlate, dw); in dw_dma_of_controller_register()
116 struct device *dev = dw->dma.dev; in dw_dma_of_controller_free()
118 if (!dev->of_node) in dw_dma_of_controller_free()
121 of_dma_controller_free(dev->of_node); in dw_dma_of_controller_free()