Lines Matching +full:firmware +full:- +full:initialised

1 // SPDX-License-Identifier: GPL-2.0
8 #include <linux/dma-direct.h> /* for bus_dma_region */
9 #include <linux/dma-map-ops.h>
19 * of_match_device - Tell if a struct device matches an of_device_id list
29 if (!matches || !dev->of_node || dev->of_node_reused) in of_match_device()
31 return of_match_node(matches, dev->of_node); in of_match_device()
38 struct device_node *node, *of_node = dev->of_node; in of_dma_set_restricted_buffer()
44 count = of_property_count_elems_of_size(of_node, "memory-region", in of_dma_set_restricted_buffer()
47 * If dev->of_node doesn't exist or doesn't contain memory-region, try in of_dma_set_restricted_buffer()
53 of_node, "memory-region", sizeof(u32)); in of_dma_set_restricted_buffer()
57 node = of_parse_phandle(of_node, "memory-region", i); in of_dma_set_restricted_buffer()
60 * restricted-dma-pool region is allowed. in of_dma_set_restricted_buffer()
62 if (of_device_is_compatible(node, "restricted-dma-pool") && in of_dma_set_restricted_buffer()
71 * Attempt to initialize a restricted-dma-pool region if one was found. in of_dma_set_restricted_buffer()
75 dev_warn(dev, "failed to initialise \"restricted-dma-pool\" memory node\n"); in of_dma_set_restricted_buffer()
79 * of_dma_configure_id - Setup DMA configuration
83 * DMA capability is not explicitly described by firmware.
102 if (dev->dma_range_map) { in of_dma_configure_id()
107 if (np == dev->of_node) in of_dma_configure_id()
117 * DMA configuration regardless of whether "dma-ranges" is in of_dma_configure_id()
121 return ret == -ENODEV ? 0 : ret; in of_dma_configure_id()
129 * If @dev is expected to be DMA-capable then the bus code that created in of_dma_configure_id()
130 * it should have initialised its dma_mask pointer by this point. For in of_dma_configure_id()
134 if (!dev->dma_mask) { in of_dma_configure_id()
136 dev->dma_mask = &dev->coherent_dma_mask; in of_dma_configure_id()
139 if (!end && dev->coherent_dma_mask) in of_dma_configure_id()
140 end = dev->coherent_dma_mask; in of_dma_configure_id()
142 end = (1ULL << 32) - 1; in of_dma_configure_id()
149 dev->coherent_dma_mask &= mask; in of_dma_configure_id()
150 *dev->dma_mask &= mask; in of_dma_configure_id()
151 /* ...but only set bus limit and range map if we found valid dma-ranges earlier */ in of_dma_configure_id()
153 dev->bus_dma_limit = end; in of_dma_configure_id()
154 dev->dma_range_map = map; in of_dma_configure_id()
162 if (ret == -EPROBE_DEFER) { in of_dma_configure_id()
163 /* Don't touch range map if it wasn't set from a valid dma-ranges */ in of_dma_configure_id()
165 dev->dma_range_map = NULL; in of_dma_configure_id()
167 return -EPROBE_DEFER; in of_dma_configure_id()
186 match = of_match_device(dev->driver->of_match_table, dev); in of_device_get_match_data()
190 return match->data; in of_device_get_match_data()
195 * of_device_modalias - Fill buffer with newline terminated modalias string
204 if (!dev || !dev->of_node || dev->of_node_reused) in of_device_modalias()
205 return -ENODEV; in of_device_modalias()
207 sl = of_modalias(dev->of_node, str, len - 2); in of_device_modalias()
210 if (sl > len - 2) in of_device_modalias()
211 return -ENOMEM; in of_device_modalias()
220 * of_device_uevent - Display OF related uevent information
231 if ((!dev) || (!dev->of_node)) in of_device_uevent()
234 add_uevent_var(env, "OF_NAME=%pOFn", dev->of_node); in of_device_uevent()
235 add_uevent_var(env, "OF_FULLNAME=%pOF", dev->of_node); in of_device_uevent()
236 type = of_node_get_device_type(dev->of_node); in of_device_uevent()
243 of_property_for_each_string(dev->of_node, "compatible", p, compat) { in of_device_uevent()
252 if (dev->of_node == app->np) { in of_device_uevent()
254 app->alias); in of_device_uevent()
266 if ((!dev) || (!dev->of_node) || dev->of_node_reused) in of_device_uevent_modalias()
267 return -ENODEV; in of_device_uevent_modalias()
271 return -ENOMEM; in of_device_uevent_modalias()
273 sl = of_modalias(dev->of_node, &env->buf[env->buflen-1], in of_device_uevent_modalias()
274 sizeof(env->buf) - env->buflen); in of_device_uevent_modalias()
277 if (sl >= (sizeof(env->buf) - env->buflen)) in of_device_uevent_modalias()
278 return -ENOMEM; in of_device_uevent_modalias()
279 env->buflen += sl; in of_device_uevent_modalias()
286 * of_device_make_bus_id - Use the device node data to assign a unique name
295 struct device_node *node = dev->of_node; in of_device_make_bus_id()
301 while (node->parent) { in of_device_make_bus_id()
310 addr, ffs(mask) - 1, node, dev_name(dev)); in of_device_make_bus_id()
320 kbasename(node->full_name), dev_name(dev)); in of_device_make_bus_id()
321 node = node->parent; in of_device_make_bus_id()