lists.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /*
  2. * Copyright (c) 2013 Google, Inc
  3. *
  4. * (C) Copyright 2012
  5. * Pavel Herrmann <morpheus.ibis@gmail.com>
  6. *
  7. * SPDX-License-Identifier: GPL-2.0+
  8. */
  9. #ifndef _DM_LISTS_H_
  10. #define _DM_LISTS_H_
  11. #include <dm/uclass-id.h>
  12. /**
  13. * lists_driver_lookup_name() - Return u_boot_driver corresponding to name
  14. *
  15. * This function returns a pointer to a driver given its name. This is used
  16. * for binding a driver given its name and platdata.
  17. *
  18. * @name: Name of driver to look up
  19. * @return pointer to driver, or NULL if not found
  20. */
  21. struct driver *lists_driver_lookup_name(const char *name);
  22. /**
  23. * lists_uclass_lookup() - Return uclass_driver based on ID of the class
  24. * id: ID of the class
  25. *
  26. * This function returns the pointer to uclass_driver, which is the class's
  27. * base structure based on the ID of the class. Returns NULL on error.
  28. */
  29. struct uclass_driver *lists_uclass_lookup(enum uclass_id id);
  30. /**
  31. * lists_bind_drivers() - search for and bind all drivers to parent
  32. *
  33. * This searches the U_BOOT_DEVICE() structures and creates new devices for
  34. * each one. The devices will have @parent as their parent.
  35. *
  36. * @parent: parent device (root)
  37. * @early_only: If true, bind only drivers with the DM_INIT_F flag. If false
  38. * bind all drivers.
  39. */
  40. int lists_bind_drivers(struct udevice *parent, bool pre_reloc_only);
  41. /**
  42. * lists_bind_fdt() - bind a device tree node
  43. *
  44. * This creates a new device bound to the given device tree node, with
  45. * @parent as its parent.
  46. *
  47. * @parent: parent device (root)
  48. * @blob: device tree blob
  49. * @offset: offset of this device tree node
  50. * @devp: if non-NULL, returns a pointer to the bound device
  51. * @return 0 if device was bound, -EINVAL if the device tree is invalid,
  52. * other -ve value on error
  53. */
  54. int lists_bind_fdt(struct udevice *parent, const void *blob, int offset,
  55. struct udevice **devp);
  56. /**
  57. * device_bind_driver() - bind a device to a driver
  58. *
  59. * This binds a new device to a driver.
  60. *
  61. * @parent: Parent device
  62. * @drv_name: Name of driver to attach to this parent
  63. * @dev_name: Name of the new device thus created
  64. * @devp: If non-NULL, returns the newly bound device
  65. */
  66. int device_bind_driver(struct udevice *parent, const char *drv_name,
  67. const char *dev_name, struct udevice **devp);
  68. /**
  69. * device_bind_driver_to_node() - bind a device to a driver for a node
  70. *
  71. * This binds a new device to a driver for a given device tree node. This
  72. * should only be needed if the node lacks a compatible strings.
  73. *
  74. * @parent: Parent device
  75. * @drv_name: Name of driver to attach to this parent
  76. * @dev_name: Name of the new device thus created
  77. * @node: Device tree node
  78. * @devp: If non-NULL, returns the newly bound device
  79. */
  80. int device_bind_driver_to_node(struct udevice *parent, const char *drv_name,
  81. const char *dev_name, int node,
  82. struct udevice **devp);
  83. #endif