1
2#ifndef _LINUX_OF_PLATFORM_H
3#define _LINUX_OF_PLATFORM_H
4
5
6
7
8
9#include <linux/device.h>
10#include <linux/mod_devicetable.h>
11#include <linux/pm.h>
12#include <linux/of_device.h>
13#include <linux/platform_device.h>
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37struct of_dev_auxdata {
38 char *compatible;
39 resource_size_t phys_addr;
40 char *name;
41 void *platform_data;
42};
43
44
45#define OF_DEV_AUXDATA(_compat,_phys,_name,_pdata) \
46 { .compatible = _compat, .phys_addr = _phys, .name = _name, \
47 .platform_data = _pdata }
48
49extern const struct of_device_id of_default_bus_match_table[];
50
51
52extern struct platform_device *of_device_alloc(struct device_node *np,
53 const char *bus_id,
54 struct device *parent);
55#ifdef CONFIG_OF
56extern struct platform_device *of_find_device_by_node(struct device_node *np);
57#else
58static inline struct platform_device *of_find_device_by_node(struct device_node *np)
59{
60 return NULL;
61}
62#endif
63
64
65extern struct platform_device *of_platform_device_create(struct device_node *np,
66 const char *bus_id,
67 struct device *parent);
68
69extern int of_platform_device_destroy(struct device *dev, void *data);
70extern int of_platform_bus_probe(struct device_node *root,
71 const struct of_device_id *matches,
72 struct device *parent);
73#ifdef CONFIG_OF_ADDRESS
74extern int of_platform_populate(struct device_node *root,
75 const struct of_device_id *matches,
76 const struct of_dev_auxdata *lookup,
77 struct device *parent);
78extern int of_platform_default_populate(struct device_node *root,
79 const struct of_dev_auxdata *lookup,
80 struct device *parent);
81extern void of_platform_depopulate(struct device *parent);
82
83extern int devm_of_platform_populate(struct device *dev);
84
85extern void devm_of_platform_depopulate(struct device *dev);
86#else
87static inline int of_platform_populate(struct device_node *root,
88 const struct of_device_id *matches,
89 const struct of_dev_auxdata *lookup,
90 struct device *parent)
91{
92 return -ENODEV;
93}
94static inline int of_platform_default_populate(struct device_node *root,
95 const struct of_dev_auxdata *lookup,
96 struct device *parent)
97{
98 return -ENODEV;
99}
100static inline void of_platform_depopulate(struct device *parent) { }
101
102static inline int devm_of_platform_populate(struct device *dev)
103{
104 return -ENODEV;
105}
106
107static inline void devm_of_platform_depopulate(struct device *dev) { }
108#endif
109
110#if defined(CONFIG_OF_DYNAMIC) && defined(CONFIG_OF_ADDRESS)
111extern void of_platform_register_reconfig_notifier(void);
112#else
113static inline void of_platform_register_reconfig_notifier(void) { }
114#endif
115
116#endif
117