]> git.ipfire.org Git - people/ms/u-boot.git/blame - include/dm/fdtaddr.h
Merge git://git.denx.de/u-boot-dm
[people/ms/u-boot.git] / include / dm / fdtaddr.h
CommitLineData
d6ffb00a
SG
1/*
2 * Copyright (c) 2017 Google, Inc
3 *
4 * (C) Copyright 2012
5 * Pavel Herrmann <morpheus.ibis@gmail.com>
6 * Marek Vasut <marex@denx.de>
7 *
8 * SPDX-License-Identifier: GPL-2.0+
9 */
10
38d21b41
SG
11#ifndef _DM_FDTADDR_H
12#define _DM_FDTADDR_H
d6ffb00a
SG
13
14#include <fdtdec.h>
15
16struct udevice;
17
18/**
a821c4af 19 * devfdt_get_addr() - Get the reg property of a device
d6ffb00a
SG
20 *
21 * @dev: Pointer to a device
22 *
23 * @return addr
24 */
a821c4af 25fdt_addr_t devfdt_get_addr(struct udevice *dev);
d6ffb00a
SG
26
27/**
a821c4af 28 * devfdt_get_addr_ptr() - Return pointer to the address of the reg property
d6ffb00a
SG
29 * of a device
30 *
31 * @dev: Pointer to a device
32 *
33 * @return Pointer to addr, or NULL if there is no such property
34 */
a821c4af 35void *devfdt_get_addr_ptr(struct udevice *dev);
d6ffb00a
SG
36
37/**
a821c4af 38 * devfdt_map_physmem() - Read device address from reg property of the
d6ffb00a
SG
39 * device node and map the address into CPU address
40 * space.
41 *
42 * @dev: Pointer to device
43 * @size: size of the memory to map
44 *
45 * @return mapped address, or NULL if the device does not have reg
46 * property.
47 */
a821c4af 48void *devfdt_map_physmem(struct udevice *dev, unsigned long size);
d6ffb00a
SG
49
50/**
a821c4af 51 * devfdt_get_addr_index() - Get the indexed reg property of a device
d6ffb00a
SG
52 *
53 * @dev: Pointer to a device
54 * @index: the 'reg' property can hold a list of <addr, size> pairs
55 * and @index is used to select which one is required
56 *
57 * @return addr
58 */
a821c4af 59fdt_addr_t devfdt_get_addr_index(struct udevice *dev, int index);
d6ffb00a
SG
60
61/**
a821c4af 62 * devfdt_get_addr_size_index() - Get the indexed reg property of a device
d6ffb00a
SG
63 *
64 * Returns the address and size specified in the 'reg' property of a device.
65 *
66 * @dev: Pointer to a device
67 * @index: the 'reg' property can hold a list of <addr, size> pairs
68 * and @index is used to select which one is required
69 * @size: Pointer to size varible - this function returns the size
70 * specified in the 'reg' property here
71 *
72 * @return addr
73 */
a821c4af 74fdt_addr_t devfdt_get_addr_size_index(struct udevice *dev, int index,
d6ffb00a
SG
75 fdt_size_t *size);
76
77/**
a821c4af 78 * devfdt_get_addr_name() - Get the reg property of a device, indexed by name
d6ffb00a
SG
79 *
80 * @dev: Pointer to a device
81 * @name: the 'reg' property can hold a list of <addr, size> pairs, with the
82 * 'reg-names' property providing named-based identification. @index
83 * indicates the value to search for in 'reg-names'.
84 *
85 * @return addr
86 */
a821c4af 87fdt_addr_t devfdt_get_addr_name(struct udevice *dev, const char *name);
d6ffb00a
SG
88
89/**
90 * dm_set_translation_offset() - Set translation offset
91 * @offs: Translation offset
92 *
93 * Some platforms need a special address translation. Those
94 * platforms (e.g. mvebu in SPL) can configure a translation
95 * offset in the DM by calling this function. It will be
a821c4af 96 * added to all addresses returned in devfdt_get_addr().
d6ffb00a
SG
97 */
98void dm_set_translation_offset(fdt_addr_t offs);
99
100/**
101 * dm_get_translation_offset() - Get translation offset
102 *
103 * This function returns the translation offset that can
104 * be configured by calling dm_set_translation_offset().
105 *
106 * @return translation offset for the device address (0 as default).
107 */
108fdt_addr_t dm_get_translation_offset(void);
109
110#endif