diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2006-11-11 01:24:59 -0500 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-12-04 00:08:52 -0500 |
commit | 7eebde700fe6fd6573e80bd8e5ed82b4ae705575 (patch) | |
tree | 552f1fd982372a704f2fdf9e4dc59ca9a7caef2a /include/asm-powerpc/of_device.h | |
parent | 21fb5a1d9f554970c680b801ba32184bc7c34aa0 (diff) |
[POWERPC] Souped-up of_platform_device support
This patch first splits of_device.c and of_platform.c, the later containing
the bits relative to of_platform_device's. On the "breaks" side of things,
drivers uisng of_platform_device(s) need to include asm/of_platform.h now
and of_(un)register_driver is now of_(un)register_platform_driver.
In addition to a few utility functions to locate of_platform_device(s),
the main new addition is of_platform_bus_probe() which allows the platform
code to trigger an automatic creation of of_platform_devices for a whole
tree of devices.
The function acts based on the type of the various "parent" devices encountered
from a provided root, using either a default known list of bus types that can be
"probed" or a passed-in list. It will only register devices on busses matching
that list, which mean that typically, it will not register PCI devices, as
expected (since they will be picked up by the PCI layer).
This will be used by Cell platforms using 4xx-type IOs in the Axon bridge
and can be used by any embedded-type device as well.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'include/asm-powerpc/of_device.h')
-rw-r--r-- | include/asm-powerpc/of_device.h | 34 |
1 files changed, 2 insertions, 32 deletions
diff --git a/include/asm-powerpc/of_device.h b/include/asm-powerpc/of_device.h index c5c0b0b3cd52..1ef7e9edd1a7 100644 --- a/include/asm-powerpc/of_device.h +++ b/include/asm-powerpc/of_device.h | |||
@@ -6,12 +6,6 @@ | |||
6 | #include <linux/mod_devicetable.h> | 6 | #include <linux/mod_devicetable.h> |
7 | #include <asm/prom.h> | 7 | #include <asm/prom.h> |
8 | 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 | ||
12 | * mechanism | ||
13 | */ | ||
14 | extern struct bus_type of_platform_bus_type; | ||
15 | 9 | ||
16 | /* | 10 | /* |
17 | * The of_device is a kind of "base class" that is a superset of | 11 | * The of_device is a kind of "base class" that is a superset of |
@@ -26,40 +20,16 @@ struct of_device | |||
26 | }; | 20 | }; |
27 | #define to_of_device(d) container_of(d, struct of_device, dev) | 21 | #define to_of_device(d) container_of(d, struct of_device, dev) |
28 | 22 | ||
23 | extern const struct of_device_id *of_match_node( | ||
24 | const struct of_device_id *matches, const struct device_node *node); | ||
29 | extern const struct of_device_id *of_match_device( | 25 | extern const struct of_device_id *of_match_device( |
30 | const struct of_device_id *matches, const struct of_device *dev); | 26 | const struct of_device_id *matches, const struct of_device *dev); |
31 | 27 | ||
32 | extern struct of_device *of_dev_get(struct of_device *dev); | 28 | extern struct of_device *of_dev_get(struct of_device *dev); |
33 | extern void of_dev_put(struct of_device *dev); | 29 | extern void of_dev_put(struct of_device *dev); |
34 | 30 | ||
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; | ||
42 | struct of_device_id *match_table; | ||
43 | struct module *owner; | ||
44 | |||
45 | int (*probe)(struct of_device* dev, const struct of_device_id *match); | ||
46 | int (*remove)(struct of_device* dev); | ||
47 | |||
48 | int (*suspend)(struct of_device* dev, pm_message_t state); | ||
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); | 31 | extern int of_device_register(struct of_device *ofdev); |
59 | extern void of_device_unregister(struct of_device *ofdev); | 32 | extern void of_device_unregister(struct of_device *ofdev); |
60 | extern struct of_device *of_platform_device_create(struct device_node *np, | ||
61 | const char *bus_id, | ||
62 | struct device *parent); | ||
63 | extern void of_release_dev(struct device *dev); | 33 | extern void of_release_dev(struct device *dev); |
64 | 34 | ||
65 | #endif /* __KERNEL__ */ | 35 | #endif /* __KERNEL__ */ |