0001
0002 #ifndef _LINUX_OF_PLATFORM_H
0003 #define _LINUX_OF_PLATFORM_H
0004
0005
0006
0007
0008
0009 #include <linux/device.h>
0010 #include <linux/mod_devicetable.h>
0011 #include <linux/pm.h>
0012 #include <linux/of_device.h>
0013 #include <linux/platform_device.h>
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037 struct of_dev_auxdata {
0038 char *compatible;
0039 resource_size_t phys_addr;
0040 char *name;
0041 void *platform_data;
0042 };
0043
0044
0045 #define OF_DEV_AUXDATA(_compat,_phys,_name,_pdata) \
0046 { .compatible = _compat, .phys_addr = _phys, .name = _name, \
0047 .platform_data = _pdata }
0048
0049 extern const struct of_device_id of_default_bus_match_table[];
0050
0051
0052 extern struct platform_device *of_device_alloc(struct device_node *np,
0053 const char *bus_id,
0054 struct device *parent);
0055 #ifdef CONFIG_OF
0056 extern struct platform_device *of_find_device_by_node(struct device_node *np);
0057 #else
0058 static inline struct platform_device *of_find_device_by_node(struct device_node *np)
0059 {
0060 return NULL;
0061 }
0062 #endif
0063
0064 extern int of_platform_bus_probe(struct device_node *root,
0065 const struct of_device_id *matches,
0066 struct device *parent);
0067
0068 #ifdef CONFIG_OF_ADDRESS
0069
0070 extern struct platform_device *of_platform_device_create(struct device_node *np,
0071 const char *bus_id,
0072 struct device *parent);
0073
0074 extern int of_platform_device_destroy(struct device *dev, void *data);
0075
0076 extern int of_platform_populate(struct device_node *root,
0077 const struct of_device_id *matches,
0078 const struct of_dev_auxdata *lookup,
0079 struct device *parent);
0080 extern int of_platform_default_populate(struct device_node *root,
0081 const struct of_dev_auxdata *lookup,
0082 struct device *parent);
0083 extern void of_platform_depopulate(struct device *parent);
0084
0085 extern int devm_of_platform_populate(struct device *dev);
0086
0087 extern void devm_of_platform_depopulate(struct device *dev);
0088 #else
0089
0090 static inline struct platform_device *of_platform_device_create(struct device_node *np,
0091 const char *bus_id,
0092 struct device *parent)
0093 {
0094 return NULL;
0095 }
0096 static inline int of_platform_device_destroy(struct device *dev, void *data)
0097 {
0098 return -ENODEV;
0099 }
0100
0101 static inline int of_platform_populate(struct device_node *root,
0102 const struct of_device_id *matches,
0103 const struct of_dev_auxdata *lookup,
0104 struct device *parent)
0105 {
0106 return -ENODEV;
0107 }
0108 static inline int of_platform_default_populate(struct device_node *root,
0109 const struct of_dev_auxdata *lookup,
0110 struct device *parent)
0111 {
0112 return -ENODEV;
0113 }
0114 static inline void of_platform_depopulate(struct device *parent) { }
0115
0116 static inline int devm_of_platform_populate(struct device *dev)
0117 {
0118 return -ENODEV;
0119 }
0120
0121 static inline void devm_of_platform_depopulate(struct device *dev) { }
0122 #endif
0123
0124 #if defined(CONFIG_OF_DYNAMIC) && defined(CONFIG_OF_ADDRESS)
0125 extern void of_platform_register_reconfig_notifier(void);
0126 #else
0127 static inline void of_platform_register_reconfig_notifier(void) { }
0128 #endif
0129
0130 #endif