aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSimon Glass2017-05-17 17:18:04 -0600
committerSimon Glass2017-06-01 06:57:52 -0600
commitd6ffb00a438ef8ba714feb2c72a7ddbdebad2b2e (patch)
tree0036080d0cc903dcd95ccfda42a1888bd85d1a67 /include
parent9d922450aa9944ecf8c249c892078cda80f40e02 (diff)
dm: core: Move dev_get_addr() etc. into a separate file
Move this group of address-related functions into a new file. These use the flat device tree. Future work will provide new versions of these which can support the live tree. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include')
-rw-r--r--include/dm.h1
-rw-r--r--include/dm/device.h92
-rw-r--r--include/dm/fdtaddr.h110
3 files changed, 111 insertions, 92 deletions
diff --git a/include/dm.h b/include/dm.h
index a179c8a6e38..84f789d8075 100644
--- a/include/dm.h
+++ b/include/dm.h
@@ -8,6 +8,7 @@
#define _DM_H_
#include <dm/device.h>
+#include <dm/fdtaddr.h>
#include <dm/platdata.h>
#include <dm/uclass.h>
diff --git a/include/dm/device.h b/include/dm/device.h
index df02e41df3d..361cdaee483 100644
--- a/include/dm/device.h
+++ b/include/dm/device.h
@@ -499,77 +499,6 @@ int device_find_first_child(struct udevice *parent, struct udevice **devp);
int device_find_next_child(struct udevice **devp);
/**
- * dev_get_addr() - Get the reg property of a device
- *
- * @dev: Pointer to a device
- *
- * @return addr
- */
-fdt_addr_t dev_get_addr(struct udevice *dev);
-
-/**
- * dev_get_addr_ptr() - Return pointer to the address of the reg property
- * of a device
- *
- * @dev: Pointer to a device
- *
- * @return Pointer to addr, or NULL if there is no such property
- */
-void *dev_get_addr_ptr(struct udevice *dev);
-
-/**
- * dev_map_physmem() - Read device address from reg property of the
- * device node and map the address into CPU address
- * space.
- *
- * @dev: Pointer to device
- * @size: size of the memory to map
- *
- * @return mapped address, or NULL if the device does not have reg
- * property.
- */
-void *dev_map_physmem(struct udevice *dev, unsigned long size);
-
-/**
- * dev_get_addr_index() - Get the indexed reg property of a device
- *
- * @dev: Pointer to a device
- * @index: the 'reg' property can hold a list of <addr, size> pairs
- * and @index is used to select which one is required
- *
- * @return addr
- */
-fdt_addr_t dev_get_addr_index(struct udevice *dev, int index);
-
-/**
- * dev_get_addr_size_index() - Get the indexed reg property of a device
- *
- * Returns the address and size specified in the 'reg' property of a device.
- *
- * @dev: Pointer to a device
- * @index: the 'reg' property can hold a list of <addr, size> pairs
- * and @index is used to select which one is required
- * @size: Pointer to size varible - this function returns the size
- * specified in the 'reg' property here
- *
- * @return addr
- */
-fdt_addr_t dev_get_addr_size_index(struct udevice *dev, int index,
- fdt_size_t *size);
-
-/**
- * dev_get_addr_name() - Get the reg property of a device, indexed by name
- *
- * @dev: Pointer to a device
- * @name: the 'reg' property can hold a list of <addr, size> pairs, with the
- * 'reg-names' property providing named-based identification. @index
- * indicates the value to search for in 'reg-names'.
- *
- * @return addr
- */
-fdt_addr_t dev_get_addr_name(struct udevice *dev, const char *name);
-
-/**
* device_has_children() - check if a device has any children
*
* @dev: Device to check
@@ -944,25 +873,4 @@ static inline void devm_kfree(struct udevice *dev, void *ptr)
#endif /* ! CONFIG_DEVRES */
-/**
- * dm_set_translation_offset() - Set translation offset
- * @offs: Translation offset
- *
- * Some platforms need a special address translation. Those
- * platforms (e.g. mvebu in SPL) can configure a translation
- * offset in the DM by calling this function. It will be
- * added to all addresses returned in dev_get_addr().
- */
-void dm_set_translation_offset(fdt_addr_t offs);
-
-/**
- * dm_get_translation_offset() - Get translation offset
- *
- * This function returns the translation offset that can
- * be configured by calling dm_set_translation_offset().
- *
- * @return translation offset for the device address (0 as default).
- */
-fdt_addr_t dm_get_translation_offset(void);
-
#endif
diff --git a/include/dm/fdtaddr.h b/include/dm/fdtaddr.h
new file mode 100644
index 00000000000..fd05b6fe95a
--- /dev/null
+++ b/include/dm/fdtaddr.h
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2017 Google, Inc
+ *
+ * (C) Copyright 2012
+ * Pavel Herrmann <morpheus.ibis@gmail.com>
+ * Marek Vasut <marex@denx.de>
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#ifndef _DM_ADDR_H
+#define _DM_ADDR_H
+
+#include <fdtdec.h>
+
+struct udevice;
+
+/**
+ * dev_get_addr() - Get the reg property of a device
+ *
+ * @dev: Pointer to a device
+ *
+ * @return addr
+ */
+fdt_addr_t dev_get_addr(struct udevice *dev);
+
+/**
+ * dev_get_addr_ptr() - Return pointer to the address of the reg property
+ * of a device
+ *
+ * @dev: Pointer to a device
+ *
+ * @return Pointer to addr, or NULL if there is no such property
+ */
+void *dev_get_addr_ptr(struct udevice *dev);
+
+/**
+ * dev_map_physmem() - Read device address from reg property of the
+ * device node and map the address into CPU address
+ * space.
+ *
+ * @dev: Pointer to device
+ * @size: size of the memory to map
+ *
+ * @return mapped address, or NULL if the device does not have reg
+ * property.
+ */
+void *dev_map_physmem(struct udevice *dev, unsigned long size);
+
+/**
+ * dev_get_addr_index() - Get the indexed reg property of a device
+ *
+ * @dev: Pointer to a device
+ * @index: the 'reg' property can hold a list of <addr, size> pairs
+ * and @index is used to select which one is required
+ *
+ * @return addr
+ */
+fdt_addr_t dev_get_addr_index(struct udevice *dev, int index);
+
+/**
+ * dev_get_addr_size_index() - Get the indexed reg property of a device
+ *
+ * Returns the address and size specified in the 'reg' property of a device.
+ *
+ * @dev: Pointer to a device
+ * @index: the 'reg' property can hold a list of <addr, size> pairs
+ * and @index is used to select which one is required
+ * @size: Pointer to size varible - this function returns the size
+ * specified in the 'reg' property here
+ *
+ * @return addr
+ */
+fdt_addr_t dev_get_addr_size_index(struct udevice *dev, int index,
+ fdt_size_t *size);
+
+/**
+ * dev_get_addr_name() - Get the reg property of a device, indexed by name
+ *
+ * @dev: Pointer to a device
+ * @name: the 'reg' property can hold a list of <addr, size> pairs, with the
+ * 'reg-names' property providing named-based identification. @index
+ * indicates the value to search for in 'reg-names'.
+ *
+ * @return addr
+ */
+fdt_addr_t dev_get_addr_name(struct udevice *dev, const char *name);
+
+/**
+ * dm_set_translation_offset() - Set translation offset
+ * @offs: Translation offset
+ *
+ * Some platforms need a special address translation. Those
+ * platforms (e.g. mvebu in SPL) can configure a translation
+ * offset in the DM by calling this function. It will be
+ * added to all addresses returned in dev_get_addr().
+ */
+void dm_set_translation_offset(fdt_addr_t offs);
+
+/**
+ * dm_get_translation_offset() - Get translation offset
+ *
+ * This function returns the translation offset that can
+ * be configured by calling dm_set_translation_offset().
+ *
+ * @return translation offset for the device address (0 as default).
+ */
+fdt_addr_t dm_get_translation_offset(void);
+
+#endif