1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * Copyright (c) 2017 Google, Inc
6 * Pavel Herrmann <morpheus.ibis@gmail.com>
7 * Marek Vasut <marex@denx.de>
18 * devfdt_get_addr() - Get the reg property of a device
20 * @dev: Pointer to a device
24 fdt_addr_t devfdt_get_addr(const struct udevice *dev);
27 * devfdt_get_addr_ptr() - Return pointer to the address of the reg property
30 * @dev: Pointer to a device
32 * @return Pointer to addr, or NULL if there is no such property
34 void *devfdt_get_addr_ptr(const struct udevice *dev);
37 * devfdt_remap_addr() - Return pointer to the memory-mapped I/O address
38 * of the reg property of a device
40 * @dev: Pointer to a device
42 * @return Pointer to addr, or NULL if there is no such property
44 void *devfdt_remap_addr(const struct udevice *dev);
47 * devfdt_remap_addr_index() - Return indexed pointer to the memory-mapped
48 * I/O address of the reg property of a device
49 * @index: the 'reg' property can hold a list of <addr, size> pairs
50 * and @index is used to select which one is required
52 * @dev: Pointer to a device
54 * @return Pointer to addr, or NULL if there is no such property
56 void *devfdt_remap_addr_index(const struct udevice *dev, int index);
59 * devfdt_remap_addr_name() - Get the reg property of a device, indexed by
60 * name, as a memory-mapped I/O pointer
61 * @name: the 'reg' property can hold a list of <addr, size> pairs, with the
62 * 'reg-names' property providing named-based identification. @index
63 * indicates the value to search for in 'reg-names'.
65 * @dev: Pointer to a device
67 * @return Pointer to addr, or NULL if there is no such property
69 void *devfdt_remap_addr_name(const struct udevice *dev, const char *name);
72 * devfdt_map_physmem() - Read device address from reg property of the
73 * device node and map the address into CPU address
76 * @dev: Pointer to device
77 * @size: size of the memory to map
79 * @return mapped address, or NULL if the device does not have reg
82 void *devfdt_map_physmem(const struct udevice *dev, unsigned long size);
85 * devfdt_get_addr_index() - Get the indexed reg property of a device
87 * @dev: Pointer to a device
88 * @index: the 'reg' property can hold a list of <addr, size> pairs
89 * and @index is used to select which one is required
93 fdt_addr_t devfdt_get_addr_index(const struct udevice *dev, int index);
96 * devfdt_get_addr_index_ptr() - Return indexed pointer to the address of the
97 * reg property of a device
99 * @dev: Pointer to a device
100 * @index: the 'reg' property can hold a list of <addr, size> pairs
101 * and @index is used to select which one is required
103 * @return Pointer to addr, or NULL if there is no such property
105 void *devfdt_get_addr_index_ptr(const struct udevice *dev, int index);
108 * devfdt_get_addr_size_index() - Get the indexed reg property of a device
110 * Returns the address and size specified in the 'reg' property of a device.
112 * @dev: Pointer to a device
113 * @index: the 'reg' property can hold a list of <addr, size> pairs
114 * and @index is used to select which one is required
115 * @size: Pointer to size varible - this function returns the size
116 * specified in the 'reg' property here
120 fdt_addr_t devfdt_get_addr_size_index(const struct udevice *dev, int index,
124 * devfdt_get_addr_name() - Get the reg property of a device, indexed by name
126 * @dev: Pointer to a device
127 * @name: the 'reg' property can hold a list of <addr, size> pairs, with the
128 * 'reg-names' property providing named-based identification. @index
129 * indicates the value to search for in 'reg-names'.
133 fdt_addr_t devfdt_get_addr_name(const struct udevice *dev, const char *name);
136 * devfdt_get_addr_size_name() - Get the reg property and its size for a device,
139 * Returns the address and size specified in the 'reg' property of a device.
141 * @dev: Pointer to a device
142 * @name: the 'reg' property can hold a list of <addr, size> pairs, with the
143 * 'reg-names' property providing named-based identification. @index
144 * indicates the value to search for in 'reg-names'.
145 * @size: Pointer to size variable - this function returns the size
146 * specified in the 'reg' property here
150 fdt_addr_t devfdt_get_addr_size_name(const struct udevice *dev,
151 const char *name, fdt_size_t *size);
154 * devfdt_get_addr_pci() - Read an address and handle PCI address translation
156 * @dev: Device to read from
157 * @return address or FDT_ADDR_T_NONE if not found
159 fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev);