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_platform.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_platform.h')
-rw-r--r-- | include/asm-powerpc/of_platform.h | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/include/asm-powerpc/of_platform.h b/include/asm-powerpc/of_platform.h new file mode 100644 index 000000000000..217eafb167e9 --- /dev/null +++ b/include/asm-powerpc/of_platform.h | |||
@@ -0,0 +1,60 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2006 Benjamin Herrenschmidt, IBM Corp. | ||
3 | * <benh@kernel.crashing.org> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or | ||
6 | * modify it under the terms of the GNU General Public License | ||
7 | * as published by the Free Software Foundation; either version | ||
8 | * 2 of the License, or (at your option) any later version. | ||
9 | * | ||
10 | */ | ||
11 | |||
12 | #include <asm/of_device.h> | ||
13 | |||
14 | /* | ||
15 | * The of_platform_bus_type is a bus type used by drivers that do not | ||
16 | * attach to a macio or similar bus but still use OF probing | ||
17 | * mechanism | ||
18 | */ | ||
19 | extern struct bus_type of_platform_bus_type; | ||
20 | |||
21 | /* | ||
22 | * An of_platform_driver driver is attached to a basic of_device on | ||
23 | * the "platform bus" (of_platform_bus_type) | ||
24 | */ | ||
25 | struct of_platform_driver | ||
26 | { | ||
27 | char *name; | ||
28 | struct of_device_id *match_table; | ||
29 | struct module *owner; | ||
30 | |||
31 | int (*probe)(struct of_device* dev, | ||
32 | const struct of_device_id *match); | ||
33 | int (*remove)(struct of_device* dev); | ||
34 | |||
35 | int (*suspend)(struct of_device* dev, pm_message_t state); | ||
36 | int (*resume)(struct of_device* dev); | ||
37 | int (*shutdown)(struct of_device* dev); | ||
38 | |||
39 | struct device_driver driver; | ||
40 | }; | ||
41 | #define to_of_platform_driver(drv) \ | ||
42 | container_of(drv,struct of_platform_driver, driver) | ||
43 | |||
44 | /* Platform drivers register/unregister */ | ||
45 | extern int of_register_platform_driver(struct of_platform_driver *drv); | ||
46 | extern void of_unregister_platform_driver(struct of_platform_driver *drv); | ||
47 | |||
48 | /* Platform devices and busses creation */ | ||
49 | extern struct of_device *of_platform_device_create(struct device_node *np, | ||
50 | const char *bus_id, | ||
51 | struct device *parent); | ||
52 | /* pseudo "matches" value to not do deep probe */ | ||
53 | #define OF_NO_DEEP_PROBE ((struct of_device_id *)-1) | ||
54 | |||
55 | extern int of_platform_bus_probe(struct device_node *root, | ||
56 | struct of_device_id *matches, | ||
57 | struct device *parent); | ||
58 | |||
59 | extern struct of_device *of_find_device_by_node(struct device_node *np); | ||
60 | extern struct of_device *of_find_device_by_phandle(phandle ph); | ||