• Home
  • Raw
  • Download

Lines Matching +full:dma +full:- +full:controller

2  * Device tree helpers for DMA request / controller
6 * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
25 * of_dma_find_controller - Get a DMA controller in DT DMA helpers list
26 * @dma_spec: pointer to DMA specifier as found in the device tree
28 * Finds a DMA controller with matching device node and number for dma cells
29 * in a list of registered DMA controllers. If a match is found a valid pointer
30 * to the DMA data stored is retuned. A NULL pointer is returned if no match is
38 if (ofdma->of_node == dma_spec->np) in of_dma_find_controller()
41 pr_debug("%s: can't find DMA controller %pOF\n", __func__, in of_dma_find_controller()
42 dma_spec->np); in of_dma_find_controller()
48 * of_dma_router_xlate - translation function for router devices
49 * @dma_spec: pointer to DMA specifier as found in the device tree
50 * @of_dma: pointer to DMA controller data (router information)
54 * to request channel from the real DMA controller.
64 /* translate the request for the real DMA controller */ in of_dma_router_xlate()
66 route_data = ofdma->of_dma_route_allocate(&dma_spec_target, ofdma); in of_dma_router_xlate()
74 chan = ofdma_target->of_dma_xlate(&dma_spec_target, ofdma_target); in of_dma_router_xlate()
76 ofdma->dma_router->route_free(ofdma->dma_router->dev, in of_dma_router_xlate()
79 chan->router = ofdma->dma_router; in of_dma_router_xlate()
80 chan->route_data = route_data; in of_dma_router_xlate()
84 * Need to put the node back since the ofdma->of_dma_route_allocate in of_dma_router_xlate()
92 * of_dma_controller_register - Register a DMA controller to DT DMA helpers
93 * @np: device node of DMA controller
96 * @data pointer to controller specific data to be used by
113 return -EINVAL; in of_dma_controller_register()
118 return -ENOMEM; in of_dma_controller_register()
120 ofdma->of_node = np; in of_dma_controller_register()
121 ofdma->of_dma_xlate = of_dma_xlate; in of_dma_controller_register()
122 ofdma->of_dma_data = data; in of_dma_controller_register()
124 /* Now queue of_dma controller structure in list */ in of_dma_controller_register()
126 list_add_tail(&ofdma->of_dma_controllers, &of_dma_list); in of_dma_controller_register()
134 * of_dma_controller_free - Remove a DMA controller from DT DMA helpers list
135 * @np: device node of DMA controller
146 if (ofdma->of_node == np) { in of_dma_controller_free()
147 list_del(&ofdma->of_dma_controllers); in of_dma_controller_free()
157 * of_dma_router_register - Register a DMA router to DT DMA helpers as a
158 * controller
159 * @np: device node of DMA router
161 * modify the dma_spec for the DMA controller to
180 return -EINVAL; in of_dma_router_register()
185 return -ENOMEM; in of_dma_router_register()
187 ofdma->of_node = np; in of_dma_router_register()
188 ofdma->of_dma_xlate = of_dma_router_xlate; in of_dma_router_register()
189 ofdma->of_dma_route_allocate = of_dma_route_allocate; in of_dma_router_register()
190 ofdma->dma_router = dma_router; in of_dma_router_register()
192 /* Now queue of_dma controller structure in list */ in of_dma_router_register()
194 list_add_tail(&ofdma->of_dma_controllers, &of_dma_list); in of_dma_router_register()
202 * of_dma_match_channel - Check if a DMA specifier matches name
203 * @np: device node to look for DMA channels
205 * @index: index of DMA specifier in list of DMA specifiers
206 * @dma_spec: pointer to DMA specifier as found in the device tree
208 * Check if the DMA specifier pointed to by the index in a list of DMA
210 * a valid pointer to the DMA specifier is found. Otherwise returns -ENODEV.
217 if (of_property_read_string_index(np, "dma-names", index, &s)) in of_dma_match_channel()
218 return -ENODEV; in of_dma_match_channel()
221 return -ENODEV; in of_dma_match_channel()
223 if (of_parse_phandle_with_args(np, "dmas", "#dma-cells", index, in of_dma_match_channel()
225 return -ENODEV; in of_dma_match_channel()
231 * of_dma_request_slave_channel - Get the DMA slave channel
232 * @np: device node to get DMA request from
235 * Returns pointer to appropriate DMA channel on success or an error pointer.
244 int ret_no_channel = -ENODEV; in of_dma_request_slave_channel()
249 return ERR_PTR(-ENODEV); in of_dma_request_slave_channel()
254 return ERR_PTR(-ENODEV); in of_dma_request_slave_channel()
256 count = of_property_count_strings(np, "dma-names"); in of_dma_request_slave_channel()
258 pr_err("%s: dma-names property of node '%pOF' missing or empty\n", in of_dma_request_slave_channel()
260 return ERR_PTR(-ENODEV); in of_dma_request_slave_channel()
278 chan = ofdma->of_dma_xlate(&dma_spec, ofdma); in of_dma_request_slave_channel()
280 ret_no_channel = -EPROBE_DEFER; in of_dma_request_slave_channel()
297 * of_dma_simple_xlate - Simple DMA engine translation function
298 * @dma_spec: pointer to DMA specifier as found in the device tree
299 * @of_dma: pointer to DMA controller data
301 * A simple translation function for devices that use a 32-bit value for the
302 * filter_param when calling the DMA engine dma_request_channel() function.
303 * Note that this translation function requires that #dma-cells is equal to 1
304 * and the argument of the dma specifier is the 32-bit filter_param. Returns
305 * pointer to appropriate dma channel on success or NULL on error.
310 int count = dma_spec->args_count; in of_dma_simple_xlate()
311 struct of_dma_filter_info *info = ofdma->of_dma_data; in of_dma_simple_xlate()
313 if (!info || !info->filter_fn) in of_dma_simple_xlate()
319 return dma_request_channel(info->dma_cap, info->filter_fn, in of_dma_simple_xlate()
320 &dma_spec->args[0]); in of_dma_simple_xlate()
325 * of_dma_xlate_by_chan_id - Translate dt property to DMA channel by channel id
326 * @dma_spec: pointer to DMA specifier as found in the device tree
327 * @of_dma: pointer to DMA controller data
329 * This function can be used as the of xlate callback for DMA driver which wants
331 * the #dma-cells propety of the DMA controller dt node needs to be set to 1.
335 * Returns pointer to appropriate dma channel on success or NULL on error.
340 struct dma_device *dev = ofdma->of_dma_data; in of_dma_xlate_by_chan_id()
343 if (!dev || dma_spec->args_count != 1) in of_dma_xlate_by_chan_id()
346 list_for_each_entry(chan, &dev->channels, device_node) in of_dma_xlate_by_chan_id()
347 if (chan->chan_id == dma_spec->args[0]) { in of_dma_xlate_by_chan_id()