Paul Mackerras | 2e686bc | 2005-10-06 13:22:17 +1000 | [diff] [blame] | 1 | #ifndef _ASM_POWERPC_OF_DEVICE_H |
| 2 | #define _ASM_POWERPC_OF_DEVICE_H |
Arnd Bergmann | 88ced03 | 2005-12-16 22:43:46 +0100 | [diff] [blame] | 3 | #ifdef __KERNEL__ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4 | |
| 5 | #include <linux/device.h> |
Benjamin Herrenschmidt | 0365ba7 | 2005-09-22 21:44:06 -0700 | [diff] [blame] | 6 | #include <linux/mod_devicetable.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7 | #include <asm/prom.h> |
| 8 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 9 | |
| 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 | */ |
| 15 | struct of_device |
| 16 | { |
Benjamin Herrenschmidt | 12d04ee | 2006-11-11 17:25:02 +1100 | [diff] [blame] | 17 | struct device_node *node; /* to be obsoleted */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18 | 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 Herrenschmidt | 7eebde7 | 2006-11-11 17:24:59 +1100 | [diff] [blame] | 23 | extern const struct of_device_id *of_match_node( |
| 24 | const struct of_device_id *matches, const struct device_node *node); |
Jeff Mahoney | 5e65577 | 2005-07-06 15:44:41 -0400 | [diff] [blame] | 25 | extern const struct of_device_id *of_match_device( |
| 26 | const struct of_device_id *matches, const struct of_device *dev); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 27 | |
| 28 | extern struct of_device *of_dev_get(struct of_device *dev); |
| 29 | extern void of_dev_put(struct of_device *dev); |
| 30 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | extern int of_device_register(struct of_device *ofdev); |
| 32 | extern void of_device_unregister(struct of_device *ofdev); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 33 | extern void of_release_dev(struct device *dev); |
| 34 | |
Arnd Bergmann | 88ced03 | 2005-12-16 22:43:46 +0100 | [diff] [blame] | 35 | #endif /* __KERNEL__ */ |
Paul Mackerras | 2e686bc | 2005-10-06 13:22:17 +1000 | [diff] [blame] | 36 | #endif /* _ASM_POWERPC_OF_DEVICE_H */ |