1 #ifndef __OF_DEVICE_H__
2 #define __OF_DEVICE_H__
4 #include <linux/device.h>
5 #include <linux/mod_devicetable.h>
9 * The of_platform_bus_type is a bus type used by drivers that do not
10 * attach to a macio or similar bus but still use OF probing
13 extern struct bus_type of_platform_bus_type
;
16 * The of_device is a kind of "base class" that is a superset of
17 * struct device for use by devices attached to an OF node and
18 * probed using OF properties
22 struct device_node
*node
; /* OF device node */
23 u64 dma_mask
; /* DMA mask */
24 struct device dev
; /* Generic device interface */
26 #define to_of_device(d) container_of(d, struct of_device, dev)
28 extern const struct of_device_id
*of_match_device(
29 const struct of_device_id
*matches
, const struct of_device
*dev
);
31 extern struct of_device
*of_dev_get(struct of_device
*dev
);
32 extern void of_dev_put(struct of_device
*dev
);
35 * An of_platform_driver driver is attached to a basic of_device on
36 * the "platform bus" (of_platform_bus_type)
38 struct of_platform_driver
41 struct of_device_id
*match_table
;
44 int (*probe
)(struct of_device
* dev
, const struct of_device_id
*match
);
45 int (*remove
)(struct of_device
* dev
);
47 int (*suspend
)(struct of_device
* dev
, pm_message_t state
);
48 int (*resume
)(struct of_device
* dev
);
49 int (*shutdown
)(struct of_device
* dev
);
51 struct device_driver driver
;
53 #define to_of_platform_driver(drv) container_of(drv,struct of_platform_driver, driver)
55 extern int of_register_driver(struct of_platform_driver
*drv
);
56 extern void of_unregister_driver(struct of_platform_driver
*drv
);
57 extern int of_device_register(struct of_device
*ofdev
);
58 extern void of_device_unregister(struct of_device
*ofdev
);
59 extern struct of_device
*of_platform_device_create(struct device_node
*np
,
61 struct device
*parent
);
62 extern void of_release_dev(struct device
*dev
);
64 #endif /* __OF_DEVICE_H__ */