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