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(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(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(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(struct udevice *dev, int index);
59 * devfdt_map_physmem() - Read device address from reg property of the
60 * device node and map the address into CPU address
63 * @dev: Pointer to device
64 * @size: size of the memory to map
66 * @return mapped address, or NULL if the device does not have reg
69 void *devfdt_map_physmem(struct udevice *dev, unsigned long size);
72 * devfdt_get_addr_index() - Get the indexed reg property of a device
74 * @dev: Pointer to a device
75 * @index: the 'reg' property can hold a list of <addr, size> pairs
76 * and @index is used to select which one is required
80 fdt_addr_t devfdt_get_addr_index(struct udevice *dev, int index);
83 * devfdt_get_addr_size_index() - Get the indexed reg property of a device
85 * Returns the address and size specified in the '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
90 * @size: Pointer to size varible - this function returns the size
91 * specified in the 'reg' property here
95 fdt_addr_t devfdt_get_addr_size_index(struct udevice *dev, int index,
99 * devfdt_get_addr_name() - Get the reg property of a device, indexed by name
101 * @dev: Pointer to a device
102 * @name: the 'reg' property can hold a list of <addr, size> pairs, with the
103 * 'reg-names' property providing named-based identification. @index
104 * indicates the value to search for in 'reg-names'.
108 fdt_addr_t devfdt_get_addr_name(struct udevice *dev, const char *name);
111 * dm_set_translation_offset() - Set translation offset
112 * @offs: Translation offset
114 * Some platforms need a special address translation. Those
115 * platforms (e.g. mvebu in SPL) can configure a translation
116 * offset in the DM by calling this function. It will be
117 * added to all addresses returned in devfdt_get_addr().
119 void dm_set_translation_offset(fdt_addr_t offs);
122 * dm_get_translation_offset() - Get translation offset
124 * This function returns the translation offset that can
125 * be configured by calling dm_set_translation_offset().
127 * @return translation offset for the device address (0 as default).
129 fdt_addr_t dm_get_translation_offset(void);