| 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 |  | 
|  | 9 | /* | 
|  | 10 | * The of_platform_bus_type is a bus type used by drivers that do not | 
|  | 11 | * attach to a macio or similar bus but still use OF probing | 
| Adrian Bunk | b3c2ffd | 2006-06-30 18:20:44 +0200 | [diff] [blame] | 12 | * mechanism | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | */ | 
|  | 14 | extern struct bus_type of_platform_bus_type; | 
|  | 15 |  | 
|  | 16 | /* | 
|  | 17 | * The of_device is a kind of "base class" that is a superset of | 
|  | 18 | * struct device for use by devices attached to an OF node and | 
|  | 19 | * probed using OF properties | 
|  | 20 | */ | 
|  | 21 | struct of_device | 
|  | 22 | { | 
|  | 23 | struct device_node	*node;		/* OF device node */ | 
|  | 24 | u64			dma_mask;	/* DMA mask */ | 
|  | 25 | struct device		dev;		/* Generic device interface */ | 
|  | 26 | }; | 
|  | 27 | #define	to_of_device(d) container_of(d, struct of_device, dev) | 
|  | 28 |  | 
| Jeff Mahoney | 5e65577 | 2005-07-06 15:44:41 -0400 | [diff] [blame] | 29 | extern const struct of_device_id *of_match_device( | 
|  | 30 | const struct of_device_id *matches, const struct of_device *dev); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 |  | 
|  | 32 | extern struct of_device *of_dev_get(struct of_device *dev); | 
|  | 33 | extern void of_dev_put(struct of_device *dev); | 
|  | 34 |  | 
|  | 35 | /* | 
|  | 36 | * An of_platform_driver driver is attached to a basic of_device on | 
|  | 37 | * the "platform bus" (of_platform_bus_type) | 
|  | 38 | */ | 
|  | 39 | struct of_platform_driver | 
|  | 40 | { | 
|  | 41 | char			*name; | 
| Jeff Mahoney | 5e65577 | 2005-07-06 15:44:41 -0400 | [diff] [blame] | 42 | struct of_device_id	*match_table; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | struct module		*owner; | 
|  | 44 |  | 
| Jeff Mahoney | 5e65577 | 2005-07-06 15:44:41 -0400 | [diff] [blame] | 45 | int	(*probe)(struct of_device* dev, const struct of_device_id *match); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 46 | int	(*remove)(struct of_device* dev); | 
|  | 47 |  | 
| Pavel Machek | b1c4285 | 2005-04-16 15:25:34 -0700 | [diff] [blame] | 48 | int	(*suspend)(struct of_device* dev, pm_message_t state); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | int	(*resume)(struct of_device* dev); | 
|  | 50 | int	(*shutdown)(struct of_device* dev); | 
|  | 51 |  | 
|  | 52 | struct device_driver	driver; | 
|  | 53 | }; | 
|  | 54 | #define	to_of_platform_driver(drv) container_of(drv,struct of_platform_driver, driver) | 
|  | 55 |  | 
|  | 56 | extern int of_register_driver(struct of_platform_driver *drv); | 
|  | 57 | extern void of_unregister_driver(struct of_platform_driver *drv); | 
|  | 58 | extern int of_device_register(struct of_device *ofdev); | 
|  | 59 | extern void of_device_unregister(struct of_device *ofdev); | 
| Benjamin Herrenschmidt | 0365ba7 | 2005-09-22 21:44:06 -0700 | [diff] [blame] | 60 | extern struct of_device *of_platform_device_create(struct device_node *np, | 
|  | 61 | const char *bus_id, | 
|  | 62 | struct device *parent); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 63 | extern void of_release_dev(struct device *dev); | 
|  | 64 |  | 
| Arnd Bergmann | 88ced03 | 2005-12-16 22:43:46 +0100 | [diff] [blame] | 65 | #endif /* __KERNEL__ */ | 
| Paul Mackerras | 2e686bc | 2005-10-06 13:22:17 +1000 | [diff] [blame] | 66 | #endif /* _ASM_POWERPC_OF_DEVICE_H */ |