1 // SPDX-License-Identifier: GPL-2.0+
5 * Copyright (c) 2013 Google, Inc
8 * Pavel Herrmann <morpheus.ibis@gmail.com>
14 #include <asm/global_data.h>
18 #include <fdt_support.h>
20 #include <asm/cache.h>
21 #include <dm/device.h>
22 #include <dm/device-internal.h>
24 #include <dm/of_access.h>
25 #include <dm/pinctrl.h>
26 #include <dm/platdata.h>
28 #include <dm/uclass.h>
29 #include <dm/uclass-internal.h>
32 #include <linux/err.h>
33 #include <linux/list.h>
34 #include <power-domain.h>
36 DECLARE_GLOBAL_DATA_PTR;
38 static int device_bind_common(struct udevice *parent, const struct driver *drv,
39 const char *name, void *plat,
40 ulong driver_data, ofnode node,
41 uint of_plat_size, struct udevice **devp)
49 if (CONFIG_IS_ENABLED(OF_PLATDATA_NO_BIND))
57 ret = uclass_get(drv->id, &uc);
59 debug("Missing uclass for driver %s\n", drv->name);
63 dev = calloc(1, sizeof(struct udevice));
67 INIT_LIST_HEAD(&dev->sibling_node);
68 INIT_LIST_HEAD(&dev->child_head);
69 INIT_LIST_HEAD(&dev->uclass_node);
71 INIT_LIST_HEAD(&dev->devres_head);
73 dev_set_plat(dev, plat);
74 dev->driver_data = driver_data;
76 dev_set_ofnode(dev, node);
82 if (CONFIG_IS_ENABLED(DM_SEQ_ALIAS) &&
83 (uc->uc_drv->flags & DM_UC_FLAG_SEQ_ALIAS)) {
85 * Some devices, such as a SPI bus, I2C bus and serial ports
86 * are numbered using aliases.
88 if (CONFIG_IS_ENABLED(OF_CONTROL) &&
89 !CONFIG_IS_ENABLED(OF_PLATDATA)) {
90 if (uc->uc_drv->name && ofnode_valid(node)) {
91 if (!dev_read_alias_seq(dev, &dev->seq_)) {
93 log_debug(" - seq=%d\n", dev->seq_);
98 if (auto_seq && !(uc->uc_drv->flags & DM_UC_FLAG_NO_AUTO_SEQ))
99 dev->seq_ = uclass_find_next_free_seq(uc);
101 /* Check if we need to allocate plat */
102 if (drv->plat_auto) {
106 * For of-platdata, we try use the existing data, but if
107 * plat_auto is larger, we must allocate a new space
109 if (CONFIG_IS_ENABLED(OF_PLATDATA)) {
111 dev_or_flags(dev, DM_FLAG_OF_PLATDATA);
112 if (of_plat_size < drv->plat_auto)
116 dev_or_flags(dev, DM_FLAG_ALLOC_PDATA);
117 ptr = calloc(1, drv->plat_auto);
124 * For of-platdata, copy the old plat into the new
127 if (CONFIG_IS_ENABLED(OF_PLATDATA) && plat)
128 memcpy(ptr, plat, of_plat_size);
129 dev_set_plat(dev, ptr);
133 size = uc->uc_drv->per_device_plat_auto;
135 dev_or_flags(dev, DM_FLAG_ALLOC_UCLASS_PDATA);
136 ptr = calloc(1, size);
141 dev_set_uclass_plat(dev, ptr);
145 size = parent->driver->per_child_plat_auto;
147 size = parent->uclass->uc_drv->per_child_plat_auto;
149 dev_or_flags(dev, DM_FLAG_ALLOC_PARENT_PDATA);
150 ptr = calloc(1, size);
155 dev_set_parent_plat(dev, ptr);
157 /* put dev into parent's successor list */
158 list_add_tail(&dev->sibling_node, &parent->child_head);
161 ret = uclass_bind_device(dev);
163 goto fail_uclass_bind;
165 /* if we fail to bind we remove device from successors and free it */
167 ret = drv->bind(dev);
171 if (parent && parent->driver->child_post_bind) {
172 ret = parent->driver->child_post_bind(dev);
174 goto fail_child_post_bind;
176 if (uc->uc_drv->post_bind) {
177 ret = uc->uc_drv->post_bind(dev);
179 goto fail_uclass_post_bind;
183 pr_debug("Bound device %s to %s\n", dev->name, parent->name);
187 dev_or_flags(dev, DM_FLAG_BOUND);
191 fail_uclass_post_bind:
192 /* There is no child unbind() method, so no clean-up required */
193 fail_child_post_bind:
194 if (CONFIG_IS_ENABLED(DM_DEVICE_REMOVE)) {
195 if (drv->unbind && drv->unbind(dev)) {
196 dm_warn("unbind() method failed on dev '%s' on error path\n",
202 if (CONFIG_IS_ENABLED(DM_DEVICE_REMOVE)) {
203 if (uclass_unbind_device(dev)) {
204 dm_warn("Failed to unbind dev '%s' on error path\n",
209 if (CONFIG_IS_ENABLED(DM_DEVICE_REMOVE)) {
210 list_del(&dev->sibling_node);
211 if (dev_get_flags(dev) & DM_FLAG_ALLOC_PARENT_PDATA) {
212 free(dev_get_parent_plat(dev));
213 dev_set_parent_plat(dev, NULL);
217 if (CONFIG_IS_ENABLED(DM_DEVICE_REMOVE)) {
218 if (dev_get_flags(dev) & DM_FLAG_ALLOC_UCLASS_PDATA) {
219 free(dev_get_uclass_plat(dev));
220 dev_set_uclass_plat(dev, NULL);
224 if (CONFIG_IS_ENABLED(DM_DEVICE_REMOVE)) {
225 if (dev_get_flags(dev) & DM_FLAG_ALLOC_PDATA) {
226 free(dev_get_plat(dev));
227 dev_set_plat(dev, NULL);
231 devres_release_all(dev);
238 int device_bind_with_driver_data(struct udevice *parent,
239 const struct driver *drv, const char *name,
240 ulong driver_data, ofnode node,
241 struct udevice **devp)
243 return device_bind_common(parent, drv, name, NULL, driver_data, node,
247 int device_bind(struct udevice *parent, const struct driver *drv,
248 const char *name, void *plat, ofnode node,
249 struct udevice **devp)
251 return device_bind_common(parent, drv, name, plat, 0, node, 0,
255 int device_bind_by_name(struct udevice *parent, bool pre_reloc_only,
256 const struct driver_info *info, struct udevice **devp)
262 drv = lists_driver_lookup_name(info->name);
265 if (pre_reloc_only && !(drv->flags & DM_FLAG_PRE_RELOC))
268 #if CONFIG_IS_ENABLED(OF_PLATDATA)
269 plat_size = info->plat_size;
271 ret = device_bind_common(parent, drv, info->name, (void *)info->plat, 0,
272 ofnode_null(), plat_size, devp);
279 int device_reparent(struct udevice *dev, struct udevice *new_parent)
281 struct udevice *pos, *n;
286 list_for_each_entry_safe(pos, n, &dev->parent->child_head,
288 if (pos->driver != dev->driver)
291 list_del(&dev->sibling_node);
292 list_add_tail(&dev->sibling_node, &new_parent->child_head);
293 dev->parent = new_parent;
301 static void *alloc_priv(int size, uint flags)
305 if (flags & DM_FLAG_ALLOC_PRIV_DMA) {
306 size = ROUND(size, ARCH_DMA_MINALIGN);
307 priv = memalign(ARCH_DMA_MINALIGN, size);
309 memset(priv, '\0', size);
312 * Ensure that the zero bytes are flushed to memory.
313 * This prevents problems if the driver uses this as
314 * both an input and an output buffer:
316 * 1. Zeroes written to buffer (here) and sit in the
318 * 2. Driver issues a read command to DMA
319 * 3. CPU runs out of cache space and evicts some cache
320 * data in the buffer, writing zeroes to RAM from
323 * 5. Buffer now has some DMA data and some zeroes
324 * 6. Data being read is now incorrect
326 * To prevent this, ensure that the cache is clean
327 * within this range at the start. The driver can then
328 * use normal flush-after-write, invalidate-before-read
331 * TODO(sjg@chromium.org): Drop this microblaze
334 #ifndef CONFIG_MICROBLAZE
335 flush_dcache_range((ulong)priv, (ulong)priv + size);
339 priv = calloc(1, size);
346 * device_alloc_priv() - Allocate priv/plat data required by the device
348 * @dev: Device to process
349 * Return: 0 if OK, -ENOMEM if out of memory
351 static int device_alloc_priv(struct udevice *dev)
353 const struct driver *drv;
360 /* Allocate private data if requested and not reentered */
361 if (drv->priv_auto && !dev_get_priv(dev)) {
362 ptr = alloc_priv(drv->priv_auto, drv->flags);
365 dev_set_priv(dev, ptr);
368 /* Allocate private data if requested and not reentered */
369 size = dev->uclass->uc_drv->per_device_auto;
370 if (size && !dev_get_uclass_priv(dev)) {
371 ptr = alloc_priv(size, dev->uclass->uc_drv->flags);
374 dev_set_uclass_priv(dev, ptr);
377 /* Allocate parent data for this child */
379 size = dev->parent->driver->per_child_auto;
381 size = dev->parent->uclass->uc_drv->per_child_auto;
382 if (size && !dev_get_parent_priv(dev)) {
383 ptr = alloc_priv(size, drv->flags);
386 dev_set_parent_priv(dev, ptr);
393 int device_of_to_plat(struct udevice *dev)
395 const struct driver *drv;
401 if (dev_get_flags(dev) & DM_FLAG_PLATDATA_VALID)
405 * This is not needed if binding is disabled, since data is allocated
408 if (!CONFIG_IS_ENABLED(OF_PLATDATA_NO_BIND)) {
409 /* Ensure all parents have ofdata */
411 ret = device_of_to_plat(dev->parent);
416 * The device might have already been probed during
417 * the call to device_probe() on its parent device
418 * (e.g. PCI bridge devices). Test the flags again
419 * so that we don't mess up the device.
421 if (dev_get_flags(dev) & DM_FLAG_PLATDATA_VALID)
425 ret = device_alloc_priv(dev);
432 if (drv->of_to_plat &&
433 (CONFIG_IS_ENABLED(OF_PLATDATA) || dev_has_ofnode(dev))) {
434 ret = drv->of_to_plat(dev);
439 dev_or_flags(dev, DM_FLAG_PLATDATA_VALID);
449 * device_get_dma_constraints() - Populate device's DMA constraints
451 * Gets a device's DMA constraints from firmware. This information is later
452 * used by drivers to translate physcal addresses to the device's bus address
453 * space. For now only device-tree is supported.
455 * @dev: Pointer to target device
456 * Return: 0 if OK or if no DMA constraints were found, error otherwise
458 static int device_get_dma_constraints(struct udevice *dev)
460 struct udevice *parent = dev->parent;
466 if (!CONFIG_IS_ENABLED(DM_DMA) || !parent || !dev_has_ofnode(parent))
470 * We start parsing for dma-ranges from the device's bus node. This is
471 * specially important on nested buses.
473 ret = dev_get_dma_range(parent, &cpu, &bus, &size);
474 /* Don't return an error if no 'dma-ranges' were found */
475 if (ret && ret != -ENOENT) {
476 dm_warn("%s: failed to get DMA range, %d\n", dev->name, ret);
480 dev_set_dma_offset(dev, cpu - bus);
485 int device_probe(struct udevice *dev)
487 const struct driver *drv;
493 if (dev_get_flags(dev) & DM_FLAG_ACTIVATED)
499 ret = device_of_to_plat(dev);
503 /* Ensure all parents are probed */
505 ret = device_probe(dev->parent);
510 * The device might have already been probed during
511 * the call to device_probe() on its parent device
512 * (e.g. PCI bridge devices). Test the flags again
513 * so that we don't mess up the device.
515 if (dev_get_flags(dev) & DM_FLAG_ACTIVATED)
519 dev_or_flags(dev, DM_FLAG_ACTIVATED);
521 if (CONFIG_IS_ENABLED(POWER_DOMAIN) && dev->parent &&
522 (device_get_uclass_id(dev) != UCLASS_POWER_DOMAIN) &&
523 !(drv->flags & DM_FLAG_DEFAULT_PD_CTRL_OFF)) {
524 ret = dev_power_domain_on(dev);
530 * Process pinctrl for everything except the root device, and
531 * continue regardless of the result of pinctrl. Don't process pinctrl
532 * settings for pinctrl devices since the device may not yet be
535 * This call can produce some non-intuitive results. For example, on an
536 * x86 device where dev is the main PCI bus, the pinctrl device may be
537 * child or grandchild of that bus, meaning that the child will be
538 * probed here. If the child happens to be the P2SB and the pinctrl
539 * device is a child of that, then both the pinctrl and P2SB will be
540 * probed by this call. This works because the DM_FLAG_ACTIVATED flag
541 * is set just above. However, the PCI bus' probe() method and
542 * associated uclass methods have not yet been called.
544 if (dev->parent && device_get_uclass_id(dev) != UCLASS_PINCTRL) {
545 ret = pinctrl_select_state(dev, "default");
546 if (ret && ret != -ENOSYS)
547 log_debug("Device '%s' failed to configure default pinctrl: %d (%s)\n",
548 dev->name, ret, errno_str(ret));
551 if (CONFIG_IS_ENABLED(IOMMU) && dev->parent &&
552 (device_get_uclass_id(dev) != UCLASS_IOMMU)) {
553 ret = dev_iommu_enable(dev);
558 ret = device_get_dma_constraints(dev);
562 ret = uclass_pre_probe_device(dev);
566 if (dev->parent && dev->parent->driver->child_pre_probe) {
567 ret = dev->parent->driver->child_pre_probe(dev);
572 /* Only handle devices that have a valid ofnode */
573 if (dev_has_ofnode(dev)) {
575 * Process 'assigned-{clocks/clock-parents/clock-rates}'
578 ret = clk_set_defaults(dev, CLK_DEFAULTS_PRE);
584 ret = drv->probe(dev);
589 ret = uclass_post_probe_device(dev);
593 if (dev->parent && device_get_uclass_id(dev) == UCLASS_PINCTRL) {
594 ret = pinctrl_select_state(dev, "default");
595 if (ret && ret != -ENOSYS)
596 log_debug("Device '%s' failed to configure default pinctrl: %d (%s)\n",
597 dev->name, ret, errno_str(ret));
602 if (device_remove(dev, DM_REMOVE_NORMAL)) {
603 dm_warn("%s: Device '%s' failed to remove on error path\n",
604 __func__, dev->name);
607 dev_bic_flags(dev, DM_FLAG_ACTIVATED);
614 void *dev_get_plat(const struct udevice *dev)
617 dm_warn("%s: null device\n", __func__);
621 return dm_priv_to_rw(dev->plat_);
624 void *dev_get_parent_plat(const struct udevice *dev)
627 dm_warn("%s: null device\n", __func__);
631 return dm_priv_to_rw(dev->parent_plat_);
634 void *dev_get_uclass_plat(const struct udevice *dev)
637 dm_warn("%s: null device\n", __func__);
641 return dm_priv_to_rw(dev->uclass_plat_);
644 void *dev_get_priv(const struct udevice *dev)
647 dm_warn("%s: null device\n", __func__);
651 return dm_priv_to_rw(dev->priv_);
654 void *dev_get_uclass_priv(const struct udevice *dev)
657 dm_warn("%s: null device\n", __func__);
661 return dm_priv_to_rw(dev->uclass_priv_);
664 void *dev_get_parent_priv(const struct udevice *dev)
667 dm_warn("%s: null device\n", __func__);
671 return dm_priv_to_rw(dev->parent_priv_);
674 static int device_get_device_tail(struct udevice *dev, int ret,
675 struct udevice **devp)
680 ret = device_probe(dev);
689 #if CONFIG_IS_ENABLED(OF_REAL)
691 * device_find_by_ofnode() - Return device associated with given ofnode
693 * The returned device is *not* activated.
695 * @node: The ofnode for which a associated device should be looked up
696 * @devp: Pointer to structure to hold the found device
697 * Return: 0 if OK, -ve on error
699 static int device_find_by_ofnode(ofnode node, struct udevice **devp)
705 list_for_each_entry(uc, gd->uclass_root, sibling_node) {
706 ret = uclass_find_device_by_ofnode(uc->uc_drv->id, node,
718 int device_get_child(const struct udevice *parent, int index,
719 struct udevice **devp)
723 list_for_each_entry(dev, &parent->child_head, sibling_node) {
725 return device_get_device_tail(dev, 0, devp);
731 int device_get_child_count(const struct udevice *parent)
736 list_for_each_entry(dev, &parent->child_head, sibling_node)
742 int device_get_decendent_count(const struct udevice *parent)
744 const struct udevice *dev;
747 list_for_each_entry(dev, &parent->child_head, sibling_node)
748 count += device_get_decendent_count(dev);
753 int device_find_child_by_seq(const struct udevice *parent, int seq,
754 struct udevice **devp)
760 list_for_each_entry(dev, &parent->child_head, sibling_node) {
761 if (dev->seq_ == seq) {
770 int device_get_child_by_seq(const struct udevice *parent, int seq,
771 struct udevice **devp)
777 ret = device_find_child_by_seq(parent, seq, &dev);
779 return device_get_device_tail(dev, ret, devp);
782 int device_find_child_by_of_offset(const struct udevice *parent, int of_offset,
783 struct udevice **devp)
789 list_for_each_entry(dev, &parent->child_head, sibling_node) {
790 if (dev_of_offset(dev) == of_offset) {
799 int device_get_child_by_of_offset(const struct udevice *parent, int node,
800 struct udevice **devp)
806 ret = device_find_child_by_of_offset(parent, node, &dev);
807 return device_get_device_tail(dev, ret, devp);
810 static struct udevice *_device_find_global_by_ofnode(struct udevice *parent,
813 struct udevice *dev, *found;
815 if (ofnode_equal(dev_ofnode(parent), ofnode))
818 list_for_each_entry(dev, &parent->child_head, sibling_node) {
819 found = _device_find_global_by_ofnode(dev, ofnode);
827 int device_find_global_by_ofnode(ofnode ofnode, struct udevice **devp)
829 *devp = _device_find_global_by_ofnode(gd->dm_root, ofnode);
831 return *devp ? 0 : -ENOENT;
834 int device_get_global_by_ofnode(ofnode ofnode, struct udevice **devp)
838 dev = _device_find_global_by_ofnode(gd->dm_root, ofnode);
839 return device_get_device_tail(dev, dev ? 0 : -ENOENT, devp);
842 #if CONFIG_IS_ENABLED(OF_PLATDATA)
843 int device_get_by_ofplat_idx(uint idx, struct udevice **devp)
847 if (CONFIG_IS_ENABLED(OF_PLATDATA_INST)) {
848 struct udevice *base = ll_entry_start(struct udevice, udevice);
852 struct driver_rt *drt = gd_dm_driver_rt() + idx;
858 return device_get_device_tail(dev, dev ? 0 : -ENOENT, devp);
862 int device_find_first_child(const struct udevice *parent, struct udevice **devp)
864 if (list_empty(&parent->child_head)) {
867 *devp = list_first_entry(&parent->child_head, struct udevice,
874 int device_find_next_child(struct udevice **devp)
876 struct udevice *dev = *devp;
877 struct udevice *parent = dev->parent;
879 if (list_is_last(&dev->sibling_node, &parent->child_head)) {
882 *devp = list_entry(dev->sibling_node.next, struct udevice,
889 int device_find_first_inactive_child(const struct udevice *parent,
890 enum uclass_id uclass_id,
891 struct udevice **devp)
896 list_for_each_entry(dev, &parent->child_head, sibling_node) {
897 if (!device_active(dev) &&
898 device_get_uclass_id(dev) == uclass_id) {
907 int device_find_first_child_by_uclass(const struct udevice *parent,
908 enum uclass_id uclass_id,
909 struct udevice **devp)
914 list_for_each_entry(dev, &parent->child_head, sibling_node) {
915 if (device_get_uclass_id(dev) == uclass_id) {
924 int device_find_child_by_namelen(const struct udevice *parent, const char *name,
925 int len, struct udevice **devp)
931 list_for_each_entry(dev, &parent->child_head, sibling_node) {
932 if (!strncmp(dev->name, name, len) &&
933 strlen(dev->name) == len) {
942 int device_find_child_by_name(const struct udevice *parent, const char *name,
943 struct udevice **devp)
945 return device_find_child_by_namelen(parent, name, strlen(name), devp);
948 int device_first_child_err(struct udevice *parent, struct udevice **devp)
952 device_find_first_child(parent, &dev);
956 return device_get_device_tail(dev, 0, devp);
959 int device_next_child_err(struct udevice **devp)
961 struct udevice *dev = *devp;
963 device_find_next_child(&dev);
967 return device_get_device_tail(dev, 0, devp);
970 int device_first_child_ofdata_err(struct udevice *parent, struct udevice **devp)
975 device_find_first_child(parent, &dev);
979 ret = device_of_to_plat(dev);
988 int device_next_child_ofdata_err(struct udevice **devp)
990 struct udevice *dev = *devp;
993 device_find_next_child(&dev);
997 ret = device_of_to_plat(dev);
1006 struct udevice *dev_get_parent(const struct udevice *child)
1008 return child->parent;
1011 ulong dev_get_driver_data(const struct udevice *dev)
1013 return dev->driver_data;
1016 const void *dev_get_driver_ops(const struct udevice *dev)
1018 if (!dev || !dev->driver->ops)
1021 return dev->driver->ops;
1024 enum uclass_id device_get_uclass_id(const struct udevice *dev)
1026 return dev->uclass->uc_drv->id;
1029 const char *dev_get_uclass_name(const struct udevice *dev)
1034 return dev->uclass->uc_drv->name;
1037 bool device_has_children(const struct udevice *dev)
1039 return !list_empty(&dev->child_head);
1042 bool device_has_active_children(const struct udevice *dev)
1044 struct udevice *child;
1046 for (device_find_first_child(dev, &child);
1048 device_find_next_child(&child)) {
1049 if (device_active(child))
1056 bool device_is_last_sibling(const struct udevice *dev)
1058 struct udevice *parent = dev->parent;
1062 return list_is_last(&dev->sibling_node, &parent->child_head);
1065 void device_set_name_alloced(struct udevice *dev)
1067 dev_or_flags(dev, DM_FLAG_NAME_ALLOCED);
1070 int device_set_name(struct udevice *dev, const char *name)
1072 name = strdup(name);
1076 device_set_name_alloced(dev);
1081 void dev_set_priv(struct udevice *dev, void *priv)
1086 void dev_set_parent_priv(struct udevice *dev, void *parent_priv)
1088 dev->parent_priv_ = parent_priv;
1091 void dev_set_uclass_priv(struct udevice *dev, void *uclass_priv)
1093 dev->uclass_priv_ = uclass_priv;
1096 void dev_set_plat(struct udevice *dev, void *plat)
1101 void dev_set_parent_plat(struct udevice *dev, void *parent_plat)
1103 dev->parent_plat_ = parent_plat;
1106 void dev_set_uclass_plat(struct udevice *dev, void *uclass_plat)
1108 dev->uclass_plat_ = uclass_plat;
1111 #if CONFIG_IS_ENABLED(OF_REAL)
1112 bool device_is_compatible(const struct udevice *dev, const char *compat)
1114 return ofnode_device_is_compatible(dev_ofnode(dev), compat);
1117 bool of_machine_is_compatible(const char *compat)
1119 const void *fdt = gd->fdt_blob;
1121 return !fdt_node_check_compatible(fdt, 0, compat);
1124 int dev_disable_by_path(const char *path)
1127 ofnode node = ofnode_path(path);
1128 struct udevice *dev;
1131 if (!of_live_active())
1134 list_for_each_entry(uc, gd->uclass_root, sibling_node) {
1135 ret = uclass_find_device_by_ofnode(uc->uc_drv->id, node, &dev);
1143 ret = device_remove(dev, DM_REMOVE_NORMAL);
1147 ret = device_unbind(dev);
1151 return ofnode_set_enabled(node, false);
1154 int dev_enable_by_path(const char *path)
1156 ofnode node = ofnode_path(path);
1157 ofnode pnode = ofnode_get_parent(node);
1158 struct udevice *parent;
1161 if (!of_live_active())
1164 ret = device_find_by_ofnode(pnode, &parent);
1168 ret = ofnode_set_enabled(node, true);
1172 return lists_bind_fdt(parent, node, NULL, NULL, false);
1176 #if CONFIG_IS_ENABLED(OF_PLATDATA_RT)
1177 static struct udevice_rt *dev_get_rt(const struct udevice *dev)
1179 struct udevice *base = ll_entry_start(struct udevice, udevice);
1180 int idx = dev - base;
1182 struct udevice_rt *urt = gd_dm_udevice_rt() + idx;
1187 u32 dev_get_flags(const struct udevice *dev)
1189 const struct udevice_rt *urt = dev_get_rt(dev);
1194 void dev_or_flags(const struct udevice *dev, u32 or)
1196 struct udevice_rt *urt = dev_get_rt(dev);
1201 void dev_bic_flags(const struct udevice *dev, u32 bic)
1203 struct udevice_rt *urt = dev_get_rt(dev);
1205 urt->flags_ &= ~bic;
1207 #endif /* OF_PLATDATA_RT */