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>
20 * of_match_device - Tell if a struct device matches an of_device_id list
30 if ((!matches) || (!dev->of_node)) in of_match_device()
32 return of_match_node(matches, dev->of_node); in of_match_device()
42 tmp = get_device(&dev->dev); in of_dev_get()
53 put_device(&dev->dev); in of_dev_put()
59 BUG_ON(ofdev->dev.of_node == NULL); in of_device_add()
63 ofdev->name = dev_name(&ofdev->dev); in of_device_add()
64 ofdev->id = PLATFORM_DEVID_NONE; in of_device_add()
71 set_dev_node(&ofdev->dev, of_node_to_nid(ofdev->dev.of_node)); in of_device_add()
73 return device_add(&ofdev->dev); in of_device_add()
77 * of_dma_configure - Setup DMA configuration
81 * DMA capability is not explicitly described by firmware.
105 * DMA configuration regardless of whether "dma-ranges" is in of_dma_configure_id()
109 return ret == -ENODEV ? 0 : ret; in of_dma_configure_id()
115 for (dma_start = ~0; r->size; r++) { in of_dma_configure_id()
117 if (r->dma_start < dma_start) in of_dma_configure_id()
118 dma_start = r->dma_start; in of_dma_configure_id()
119 if (r->dma_start + r->size > dma_end) in of_dma_configure_id()
120 dma_end = r->dma_start + r->size; in of_dma_configure_id()
122 size = dma_end - dma_start; in of_dma_configure_id()
129 dev_warn(dev, "Invalid size 0x%llx for dma-range(s)\n", in of_dma_configure_id()
137 return -EINVAL; in of_dma_configure_id()
142 * If @dev is expected to be DMA-capable then the bus code that created in of_dma_configure_id()
143 * it should have initialised its dma_mask pointer by this point. For in of_dma_configure_id()
147 if (!dev->dma_mask) { in of_dma_configure_id()
149 dev->dma_mask = &dev->coherent_dma_mask; in of_dma_configure_id()
152 if (!size && dev->coherent_dma_mask) in of_dma_configure_id()
153 size = max(dev->coherent_dma_mask, dev->coherent_dma_mask + 1); in of_dma_configure_id()
161 end = dma_start + size - 1; in of_dma_configure_id()
163 dev->coherent_dma_mask &= mask; in of_dma_configure_id()
164 *dev->dma_mask &= mask; in of_dma_configure_id()
165 /* ...but only set bus limit if we found valid dma-ranges earlier */ in of_dma_configure_id()
167 dev->bus_dma_limit = end; in of_dma_configure_id()
174 if (PTR_ERR(iommu) == -EPROBE_DEFER) { in of_dma_configure_id()
176 return -EPROBE_DEFER; in of_dma_configure_id()
184 dev->dma_range_map = map; in of_dma_configure_id()
191 device_initialize(&pdev->dev); in of_device_register()
198 device_unregister(&ofdev->dev); in of_device_unregister()
206 match = of_match_device(dev->driver->of_match_table, dev); in of_device_get_match_data()
210 return match->data; in of_device_get_match_data()
222 if ((!dev) || (!dev->of_node)) in of_device_get_modalias()
223 return -ENODEV; in of_device_get_modalias()
227 csize = snprintf(str, len, "of:N%pOFn%c%s", dev->of_node, 'T', in of_device_get_modalias()
228 of_node_get_device_type(dev->of_node)); in of_device_get_modalias()
230 len -= csize; in of_device_get_modalias()
234 of_property_for_each_string(dev->of_node, "compatible", p, compat) { in of_device_get_modalias()
246 len -= csize; in of_device_get_modalias()
265 return -ENOMEM; in of_device_request_module()
277 * of_device_modalias - Fill buffer with newline terminated modalias string
281 ssize_t sl = of_device_get_modalias(dev, str, len - 2); in of_device_modalias()
284 if (sl > len - 2) in of_device_modalias()
285 return -ENOMEM; in of_device_modalias()
294 * of_device_uevent - Display OF related uevent information
303 if ((!dev) || (!dev->of_node)) in of_device_uevent()
306 add_uevent_var(env, "OF_NAME=%pOFn", dev->of_node); in of_device_uevent()
307 add_uevent_var(env, "OF_FULLNAME=%pOF", dev->of_node); in of_device_uevent()
308 type = of_node_get_device_type(dev->of_node); in of_device_uevent()
315 of_property_for_each_string(dev->of_node, "compatible", p, compat) { in of_device_uevent()
324 if (dev->of_node == app->np) { in of_device_uevent()
326 app->alias); in of_device_uevent()
337 if ((!dev) || (!dev->of_node)) in of_device_uevent_modalias()
338 return -ENODEV; in of_device_uevent_modalias()
342 return -ENOMEM; in of_device_uevent_modalias()
344 sl = of_device_get_modalias(dev, &env->buf[env->buflen-1], in of_device_uevent_modalias()
345 sizeof(env->buf) - env->buflen); in of_device_uevent_modalias()
346 if (sl >= (sizeof(env->buf) - env->buflen)) in of_device_uevent_modalias()
347 return -ENOMEM; in of_device_uevent_modalias()
348 env->buflen += sl; in of_device_uevent_modalias()