1 #ifndef __OF_DEVICE_H__
2 #define __OF_DEVICE_H__
4 #include <linux/device.h>
8 * The of_platform_bus_type is a bus type used by drivers that do not
9 * attach to a macio or similar bus but still use OF probing
12 extern struct bus_type of_platform_bus_type;
15 * The of_device is a kind of "base class" that is a superset of
16 * struct device for use by devices attached to an OF node and
17 * probed using OF properties
21 struct device_node *node; /* OF device node */
22 u64 dma_mask; /* DMA mask */
23 struct device dev; /* Generic device interface */
25 #define to_of_device(d) container_of(d, struct of_device, dev)
28 * Struct used for matching a device
37 #define OF_ANY_MATCH ((char *)-1L)
39 extern const struct of_match *of_match_device(
40 const struct of_match *matches, const struct of_device *dev);
42 extern struct of_device *of_dev_get(struct of_device *dev);
43 extern void of_dev_put(struct of_device *dev);
46 * An of_platform_driver driver is attached to a basic of_device on
47 * the "platform bus" (of_platform_bus_type)
49 struct of_platform_driver
52 struct of_match *match_table;
55 int (*probe)(struct of_device* dev, const struct of_match *match);
56 int (*remove)(struct of_device* dev);
58 int (*suspend)(struct of_device* dev, pm_message_t state);
59 int (*resume)(struct of_device* dev);
60 int (*shutdown)(struct of_device* dev);
62 struct device_driver driver;
64 #define to_of_platform_driver(drv) container_of(drv,struct of_platform_driver, driver)
66 extern int of_register_driver(struct of_platform_driver *drv);
67 extern void of_unregister_driver(struct of_platform_driver *drv);
68 extern int of_device_register(struct of_device *ofdev);
69 extern void of_device_unregister(struct of_device *ofdev);
70 extern struct of_device *of_platform_device_create(struct device_node *np, const char *bus_id);
71 extern void of_release_dev(struct device *dev);
73 #endif /* __OF_DEVICE_H__ */