summaryrefslogtreecommitdiffstats
path: root/include/of_address.h
diff options
context:
space:
mode:
authorSebastian Hesselbarth <sebastian.hesselbarth@gmail.com>2013-07-02 20:14:30 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2013-07-05 08:26:57 +0200
commitd0a6aaea6ac113354834b71e1fc19f18eda75088 (patch)
tree94b26c2f652d7b26b8c8347e712ea7fbb6c1e07e /include/of_address.h
parent9ab76a48a2b70735d63a1221a2d7b78484fb198a (diff)
downloadbarebox-d0a6aaea6ac113354834b71e1fc19f18eda75088.tar.gz
barebox-d0a6aaea6ac113354834b71e1fc19f18eda75088.tar.xz
OF: import address related functions from Linux OF API
This imports drivers/of/address.c from Linux with some minor modifications. of_translate_address is not yet enabled and PCI and ISA related bus translations have not been imported. Also, a corresponding include header is created with prototypes and non-OF function stubs. Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/of_address.h')
-rw-r--r--include/of_address.h64
1 files changed, 64 insertions, 0 deletions
diff --git a/include/of_address.h b/include/of_address.h
new file mode 100644
index 0000000000..a82e2e57b9
--- /dev/null
+++ b/include/of_address.h
@@ -0,0 +1,64 @@
+#ifndef __OF_ADDRESS_H
+#define __OF_ADDRESS_H
+
+#include <common.h>
+#include <of.h>
+
+#ifndef pci_address_to_pio
+static inline unsigned long pci_address_to_pio(phys_addr_t addr) { return -1; }
+#endif
+
+#ifdef CONFIG_OFTREE
+
+extern u64 of_translate_dma_address(struct device_node *dev,
+ const __be32 *in_addr);
+extern bool of_can_translate_address(struct device_node *dev);
+extern const __be32 *of_get_address(struct device_node *dev, int index,
+ u64 *size, unsigned int *flags);
+extern int of_address_to_resource(struct device_node *dev, int index,
+ struct resource *r);
+extern struct device_node *of_find_matching_node_by_address(
+ struct device_node *from, const struct of_device_id *matches,
+ u64 base_address);
+extern void __iomem *of_iomap(struct device_node *np, int index);
+
+#else /* CONFIG_OFTREE */
+
+static inline u64 of_translate_dma_address(struct device_node *dev,
+ const __be32 *in_addr)
+{
+ return OF_BAD_ADDR;
+}
+
+static inline bool of_can_translate_address(struct device_node *dev)
+{
+ return false;
+}
+
+static inline const __be32 *of_get_address(struct device_node *dev, int index,
+ u64 *size, unsigned int *flags)
+{
+ return 0;
+}
+
+static inline int of_address_to_resource(struct device_node *dev, int index,
+ struct resource *r)
+{
+ return -ENOSYS;
+}
+
+static inline struct device_node *of_find_matching_node_by_address(
+ struct device_node *from, const struct of_device_id *matches,
+ u64 base_address)
+{
+ return NULL;
+}
+
+static inline void __iomem *of_iomap(struct device_node *np, int index)
+{
+ return NULL;
+}
+
+#endif /* CONFIG_OFTREE */
+
+#endif /* __OF_ADDRESS_H */