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