aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-powerpc
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-powerpc')
-rw-r--r--include/asm-powerpc/of_device.h22
-rw-r--r--include/asm-powerpc/of_platform.h38
-rw-r--r--include/asm-powerpc/prom.h50
3 files changed, 24 insertions, 86 deletions
diff --git a/include/asm-powerpc/of_device.h b/include/asm-powerpc/of_device.h
index e9af49eb1aa8..ec2a8a2c737c 100644
--- a/include/asm-powerpc/of_device.h
+++ b/include/asm-powerpc/of_device.h
@@ -3,14 +3,12 @@
3#ifdef __KERNEL__ 3#ifdef __KERNEL__
4 4
5#include <linux/device.h> 5#include <linux/device.h>
6#include <linux/mod_devicetable.h> 6#include <linux/of.h>
7#include <asm/prom.h>
8
9 7
10/* 8/*
11 * The of_device is a kind of "base class" that is a superset of 9 * The of_device is a kind of "base class" that is a superset of
12 * struct device for use by devices attached to an OF node and 10 * struct device for use by devices attached to an OF node and
13 * probed using OF properties 11 * probed using OF properties.
14 */ 12 */
15struct of_device 13struct of_device
16{ 14{
@@ -18,24 +16,14 @@ struct of_device
18 u64 dma_mask; /* DMA mask */ 16 u64 dma_mask; /* DMA mask */
19 struct device dev; /* Generic device interface */ 17 struct device dev; /* Generic device interface */
20}; 18};
21#define to_of_device(d) container_of(d, struct of_device, dev)
22
23extern const struct of_device_id *of_match_node(
24 const struct of_device_id *matches, const struct device_node *node);
25extern const struct of_device_id *of_match_device(
26 const struct of_device_id *matches, const struct of_device *dev);
27
28extern struct of_device *of_dev_get(struct of_device *dev);
29extern void of_dev_put(struct of_device *dev);
30
31extern int of_device_register(struct of_device *ofdev);
32extern void of_device_unregister(struct of_device *ofdev);
33extern void of_release_dev(struct device *dev);
34 19
35extern ssize_t of_device_get_modalias(struct of_device *ofdev, 20extern ssize_t of_device_get_modalias(struct of_device *ofdev,
36 char *str, ssize_t len); 21 char *str, ssize_t len);
37extern int of_device_uevent(struct device *dev, 22extern int of_device_uevent(struct device *dev,
38 char **envp, int num_envp, char *buffer, int buffer_size); 23 char **envp, int num_envp, char *buffer, int buffer_size);
39 24
25/* This is just here during the transition */
26#include <linux/of_device.h>
27
40#endif /* __KERNEL__ */ 28#endif /* __KERNEL__ */
41#endif /* _ASM_POWERPC_OF_DEVICE_H */ 29#endif /* _ASM_POWERPC_OF_DEVICE_H */
diff --git a/include/asm-powerpc/of_platform.h b/include/asm-powerpc/of_platform.h
index 217eafb167e9..80e6fad28b4f 100644
--- a/include/asm-powerpc/of_platform.h
+++ b/include/asm-powerpc/of_platform.h
@@ -1,3 +1,5 @@
1#ifndef _ASM_POWERPC_OF_PLATFORM_H
2#define _ASM_POWERPC_OF_PLATFORM_H
1/* 3/*
2 * Copyright (C) 2006 Benjamin Herrenschmidt, IBM Corp. 4 * Copyright (C) 2006 Benjamin Herrenschmidt, IBM Corp.
3 * <benh@kernel.crashing.org> 5 * <benh@kernel.crashing.org>
@@ -9,37 +11,8 @@
9 * 11 *
10 */ 12 */
11 13
12#include <asm/of_device.h> 14/* This is just here during the transition */
13 15#include <linux/of_platform.h>
14/*
15 * The of_platform_bus_type is a bus type used by drivers that do not
16 * attach to a macio or similar bus but still use OF probing
17 * mechanism
18 */
19extern struct bus_type of_platform_bus_type;
20
21/*
22 * An of_platform_driver driver is attached to a basic of_device on
23 * the "platform bus" (of_platform_bus_type)
24 */
25struct of_platform_driver
26{
27 char *name;
28 struct of_device_id *match_table;
29 struct module *owner;
30
31 int (*probe)(struct of_device* dev,
32 const struct of_device_id *match);
33 int (*remove)(struct of_device* dev);
34
35 int (*suspend)(struct of_device* dev, pm_message_t state);
36 int (*resume)(struct of_device* dev);
37 int (*shutdown)(struct of_device* dev);
38
39 struct device_driver driver;
40};
41#define to_of_platform_driver(drv) \
42 container_of(drv,struct of_platform_driver, driver)
43 16
44/* Platform drivers register/unregister */ 17/* Platform drivers register/unregister */
45extern int of_register_platform_driver(struct of_platform_driver *drv); 18extern int of_register_platform_driver(struct of_platform_driver *drv);
@@ -56,5 +29,6 @@ extern int of_platform_bus_probe(struct device_node *root,
56 struct of_device_id *matches, 29 struct of_device_id *matches,
57 struct device *parent); 30 struct device *parent);
58 31
59extern struct of_device *of_find_device_by_node(struct device_node *np);
60extern struct of_device *of_find_device_by_phandle(phandle ph); 32extern struct of_device *of_find_device_by_phandle(phandle ph);
33
34#endif /* _ASM_POWERPC_OF_PLATFORM_H */
diff --git a/include/asm-powerpc/prom.h b/include/asm-powerpc/prom.h
index 1632baa17dc6..6e391c9894ce 100644
--- a/include/asm-powerpc/prom.h
+++ b/include/asm-powerpc/prom.h
@@ -21,6 +21,13 @@
21#include <asm/irq.h> 21#include <asm/irq.h>
22#include <asm/atomic.h> 22#include <asm/atomic.h>
23 23
24#define OF_ROOT_NODE_ADDR_CELLS_DEFAULT 1
25#define OF_ROOT_NODE_SIZE_CELLS_DEFAULT 1
26
27#define of_compat_cmp(s1, s2, l) strncasecmp((s1), (s2), (l))
28#define of_prop_cmp(s1, s2) strcmp((s1), (s2))
29#define of_node_cmp(s1, s2) strcasecmp((s1), (s2))
30
24/* Definitions used by the flattened device tree */ 31/* Definitions used by the flattened device tree */
25#define OF_DT_HEADER 0xd00dfeed /* marker */ 32#define OF_DT_HEADER 0xd00dfeed /* marker */
26#define OF_DT_BEGIN_NODE 0x1 /* Start of node, full name */ 33#define OF_DT_BEGIN_NODE 0x1 /* Start of node, full name */
@@ -97,10 +104,6 @@ struct device_node {
97 104
98extern struct device_node *of_chosen; 105extern struct device_node *of_chosen;
99 106
100/* flag descriptions */
101#define OF_DYNAMIC 1 /* node and properties were allocated via kmalloc */
102#define OF_DETACHED 2 /* node has been detached from the device tree */
103
104static inline int of_node_check_flag(struct device_node *n, unsigned long flag) 107static inline int of_node_check_flag(struct device_node *n, unsigned long flag)
105{ 108{
106 return test_bit(flag, &n->_flags); 109 return test_bit(flag, &n->_flags);
@@ -120,31 +123,7 @@ static inline void set_node_proc_entry(struct device_node *dn, struct proc_dir_e
120} 123}
121 124
122 125
123/* New style node lookup */
124extern struct device_node *of_find_node_by_name(struct device_node *from,
125 const char *name);
126#define for_each_node_by_name(dn, name) \
127 for (dn = of_find_node_by_name(NULL, name); dn; \
128 dn = of_find_node_by_name(dn, name))
129extern struct device_node *of_find_node_by_type(struct device_node *from,
130 const char *type);
131#define for_each_node_by_type(dn, type) \
132 for (dn = of_find_node_by_type(NULL, type); dn; \
133 dn = of_find_node_by_type(dn, type))
134extern struct device_node *of_find_compatible_node(struct device_node *from,
135 const char *type, const char *compat);
136#define for_each_compatible_node(dn, type, compatible) \
137 for (dn = of_find_compatible_node(NULL, type, compatible); dn; \
138 dn = of_find_compatible_node(dn, type, compatible))
139extern struct device_node *of_find_node_by_path(const char *path);
140extern struct device_node *of_find_node_by_phandle(phandle handle);
141extern struct device_node *of_find_all_nodes(struct device_node *prev); 126extern struct device_node *of_find_all_nodes(struct device_node *prev);
142extern struct device_node *of_get_parent(const struct device_node *node);
143extern struct device_node *of_get_next_child(const struct device_node *node,
144 struct device_node *prev);
145extern struct property *of_find_property(const struct device_node *np,
146 const char *name,
147 int *lenp);
148extern struct device_node *of_node_get(struct device_node *node); 127extern struct device_node *of_node_get(struct device_node *node);
149extern void of_node_put(struct device_node *node); 128extern void of_node_put(struct device_node *node);
150 129
@@ -166,17 +145,9 @@ extern void of_detach_node(const struct device_node *);
166extern void finish_device_tree(void); 145extern void finish_device_tree(void);
167extern void unflatten_device_tree(void); 146extern void unflatten_device_tree(void);
168extern void early_init_devtree(void *); 147extern void early_init_devtree(void *);
169extern int of_device_is_compatible(const struct device_node *device,
170 const char *);
171#define device_is_compatible(d, c) of_device_is_compatible((d), (c)) 148#define device_is_compatible(d, c) of_device_is_compatible((d), (c))
172extern int machine_is_compatible(const char *compat); 149extern int machine_is_compatible(const char *compat);
173extern const void *of_get_property(const struct device_node *node,
174 const char *name,
175 int *lenp);
176#define get_property(a, b, c) of_get_property((a), (b), (c))
177extern void print_properties(struct device_node *node); 150extern void print_properties(struct device_node *node);
178extern int of_n_addr_cells(struct device_node* np);
179extern int of_n_size_cells(struct device_node* np);
180extern int prom_n_intr_cells(struct device_node* np); 151extern int prom_n_intr_cells(struct device_node* np);
181extern void prom_get_irq_senses(unsigned char *senses, int off, int max); 152extern void prom_get_irq_senses(unsigned char *senses, int off, int max);
182extern int prom_add_property(struct device_node* np, struct property* prop); 153extern int prom_add_property(struct device_node* np, struct property* prop);
@@ -230,7 +201,6 @@ static inline unsigned long of_read_ulong(const u32 *cell, int size)
230 201
231/* Translate an OF address block into a CPU physical address 202/* Translate an OF address block into a CPU physical address
232 */ 203 */
233#define OF_BAD_ADDR ((u64)-1)
234extern u64 of_translate_address(struct device_node *np, const u32 *addr); 204extern u64 of_translate_address(struct device_node *np, const u32 *addr);
235 205
236/* Extract an address from a device, returns the region size and 206/* Extract an address from a device, returns the region size and
@@ -357,5 +327,11 @@ extern int of_irq_to_resource(struct device_node *dev, int index,
357 */ 327 */
358extern void __iomem *of_iomap(struct device_node *device, int index); 328extern void __iomem *of_iomap(struct device_node *device, int index);
359 329
330/*
331 * NB: This is here while we transition from using asm/prom.h
332 * to linux/of.h
333 */
334#include <linux/of.h>
335
360#endif /* __KERNEL__ */ 336#endif /* __KERNEL__ */
361#endif /* _POWERPC_PROM_H */ 337#endif /* _POWERPC_PROM_H */