blob: a889b2005bf558f66d702e4ba74f27ee1eede700 [file] [log] [blame]
Paul Mackerras2e686bc2005-10-06 13:22:17 +10001#ifndef _ASM_POWERPC_OF_DEVICE_H
2#define _ASM_POWERPC_OF_DEVICE_H
Arnd Bergmann88ced032005-12-16 22:43:46 +01003#ifdef __KERNEL__
Linus Torvalds1da177e2005-04-16 15:20:36 -07004
5#include <linux/device.h>
Benjamin Herrenschmidt0365ba72005-09-22 21:44:06 -07006#include <linux/mod_devicetable.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -07007#include <asm/prom.h>
8
Linus Torvalds1da177e2005-04-16 15:20:36 -07009
10/*
11 * The of_device is a kind of "base class" that is a superset of
12 * struct device for use by devices attached to an OF node and
13 * probed using OF properties
14 */
15struct of_device
16{
Benjamin Herrenschmidt12d04ee2006-11-11 17:25:02 +110017 struct device_node *node; /* to be obsoleted */
Linus Torvalds1da177e2005-04-16 15:20:36 -070018 u64 dma_mask; /* DMA mask */
19 struct device dev; /* Generic device interface */
20};
21#define to_of_device(d) container_of(d, struct of_device, dev)
22
Benjamin Herrenschmidt7eebde72006-11-11 17:24:59 +110023extern const struct of_device_id *of_match_node(
24 const struct of_device_id *matches, const struct device_node *node);
Jeff Mahoney5e655772005-07-06 15:44:41 -040025extern const struct of_device_id *of_match_device(
26 const struct of_device_id *matches, const struct of_device *dev);
Linus Torvalds1da177e2005-04-16 15:20:36 -070027
28extern struct of_device *of_dev_get(struct of_device *dev);
29extern void of_dev_put(struct of_device *dev);
30
Linus Torvalds1da177e2005-04-16 15:20:36 -070031extern int of_device_register(struct of_device *ofdev);
32extern void of_device_unregister(struct of_device *ofdev);
Linus Torvalds1da177e2005-04-16 15:20:36 -070033extern void of_release_dev(struct device *dev);
34
Arnd Bergmann88ced032005-12-16 22:43:46 +010035#endif /* __KERNEL__ */
Paul Mackerras2e686bc2005-10-06 13:22:17 +100036#endif /* _ASM_POWERPC_OF_DEVICE_H */