diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-05 18:57:35 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-05 18:57:35 -0400 |
commit | 03c0c29aff7e56b722eb6c47eace222b140d0377 (patch) | |
tree | 47267a19b523159cf36a050ef3c35f4dbdb33016 /include | |
parent | c60c6a96b7bb0f1f8bb635fdfcf5b592aaf062b4 (diff) | |
parent | 7fb8f881c54beb05dd4d2c947dada1c636581d87 (diff) |
Merge branch 'next-devicetree' of git://git.secretlab.ca/git/linux-2.6
* 'next-devicetree' of git://git.secretlab.ca/git/linux-2.6: (63 commits)
of/platform: Register of_platform_drivers with an "of:" prefix
of/address: Clean up function declarations
of/spi: call of_register_spi_devices() from spi core code
of: Provide default of_node_to_nid() implementation.
of/device: Make of_device_make_bus_id() usable by other code.
of/irq: Fix endian issues in parsing interrupt specifiers
of: Fix phandle endian issues
of/flattree: fix of_flat_dt_is_compatible() to match the full compatible string
of: remove of_default_bus_ids
of: make of_find_device_by_node generic
microblaze: remove references to of_device and to_of_device
sparc: remove references to of_device and to_of_device
powerpc: remove references to of_device and to_of_device
of/device: Replace of_device with platform_device in includes and core code
of/device: Protect against binding of_platform_drivers to non-OF devices
of: remove asm/of_device.h
of: remove asm/of_platform.h
of/platform: remove all of_bus_type and of_platform_bus_type references
of: Merge of_platform_bus_type with platform_bus_type
drivercore/of: Add OF style matching to platform bus
...
Fix up trivial conflicts in arch/microblaze/kernel/Makefile due to just
some obj-y removals by the devicetree branch, while the microblaze
updates added a new file.
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-generic/gpio.h | 15 | ||||
-rw-r--r-- | include/linux/of.h | 10 | ||||
-rw-r--r-- | include/linux/of_address.h | 44 | ||||
-rw-r--r-- | include/linux/of_device.h | 61 | ||||
-rw-r--r-- | include/linux/of_gpio.h | 35 | ||||
-rw-r--r-- | include/linux/of_i2c.h | 13 | ||||
-rw-r--r-- | include/linux/of_irq.h | 70 | ||||
-rw-r--r-- | include/linux/of_platform.h | 53 | ||||
-rw-r--r-- | include/linux/of_spi.h | 11 |
9 files changed, 250 insertions, 62 deletions
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h index 4f3d75e1ad3..c7376bf80b0 100644 --- a/include/asm-generic/gpio.h +++ b/include/asm-generic/gpio.h | |||
@@ -31,6 +31,7 @@ static inline int gpio_is_valid(int number) | |||
31 | struct device; | 31 | struct device; |
32 | struct seq_file; | 32 | struct seq_file; |
33 | struct module; | 33 | struct module; |
34 | struct device_node; | ||
34 | 35 | ||
35 | /** | 36 | /** |
36 | * struct gpio_chip - abstract a GPIO controller | 37 | * struct gpio_chip - abstract a GPIO controller |
@@ -106,6 +107,17 @@ struct gpio_chip { | |||
106 | const char *const *names; | 107 | const char *const *names; |
107 | unsigned can_sleep:1; | 108 | unsigned can_sleep:1; |
108 | unsigned exported:1; | 109 | unsigned exported:1; |
110 | |||
111 | #if defined(CONFIG_OF_GPIO) | ||
112 | /* | ||
113 | * If CONFIG_OF is enabled, then all GPIO controllers described in the | ||
114 | * device tree automatically may have an OF translation | ||
115 | */ | ||
116 | struct device_node *of_node; | ||
117 | int of_gpio_n_cells; | ||
118 | int (*of_xlate)(struct gpio_chip *gc, struct device_node *np, | ||
119 | const void *gpio_spec, u32 *flags); | ||
120 | #endif | ||
109 | }; | 121 | }; |
110 | 122 | ||
111 | extern const char *gpiochip_is_requested(struct gpio_chip *chip, | 123 | extern const char *gpiochip_is_requested(struct gpio_chip *chip, |
@@ -115,6 +127,9 @@ extern int __must_check gpiochip_reserve(int start, int ngpio); | |||
115 | /* add/remove chips */ | 127 | /* add/remove chips */ |
116 | extern int gpiochip_add(struct gpio_chip *chip); | 128 | extern int gpiochip_add(struct gpio_chip *chip); |
117 | extern int __must_check gpiochip_remove(struct gpio_chip *chip); | 129 | extern int __must_check gpiochip_remove(struct gpio_chip *chip); |
130 | extern struct gpio_chip *gpiochip_find(void *data, | ||
131 | int (*match)(struct gpio_chip *chip, | ||
132 | void *data)); | ||
118 | 133 | ||
119 | 134 | ||
120 | /* Always use the library code for GPIO management calls, | 135 | /* Always use the library code for GPIO management calls, |
diff --git a/include/linux/of.h b/include/linux/of.h index a367e19bb3a..cad7cf0ab27 100644 --- a/include/linux/of.h +++ b/include/linux/of.h | |||
@@ -70,6 +70,11 @@ extern struct device_node *allnodes; | |||
70 | extern struct device_node *of_chosen; | 70 | extern struct device_node *of_chosen; |
71 | extern rwlock_t devtree_lock; | 71 | extern rwlock_t devtree_lock; |
72 | 72 | ||
73 | static inline bool of_node_is_root(const struct device_node *node) | ||
74 | { | ||
75 | return node && (node->parent == NULL); | ||
76 | } | ||
77 | |||
73 | static inline int of_node_check_flag(struct device_node *n, unsigned long flag) | 78 | static inline int of_node_check_flag(struct device_node *n, unsigned long flag) |
74 | { | 79 | { |
75 | return test_bit(flag, &n->_flags); | 80 | return test_bit(flag, &n->_flags); |
@@ -141,6 +146,11 @@ static inline unsigned long of_read_ulong(const __be32 *cell, int size) | |||
141 | 146 | ||
142 | #define OF_BAD_ADDR ((u64)-1) | 147 | #define OF_BAD_ADDR ((u64)-1) |
143 | 148 | ||
149 | #ifndef of_node_to_nid | ||
150 | static inline int of_node_to_nid(struct device_node *np) { return -1; } | ||
151 | #define of_node_to_nid of_node_to_nid | ||
152 | #endif | ||
153 | |||
144 | extern struct device_node *of_find_node_by_name(struct device_node *from, | 154 | extern struct device_node *of_find_node_by_name(struct device_node *from, |
145 | const char *name); | 155 | const char *name); |
146 | #define for_each_node_by_name(dn, name) \ | 156 | #define for_each_node_by_name(dn, name) \ |
diff --git a/include/linux/of_address.h b/include/linux/of_address.h new file mode 100644 index 00000000000..8aea06f0564 --- /dev/null +++ b/include/linux/of_address.h | |||
@@ -0,0 +1,44 @@ | |||
1 | #ifndef __OF_ADDRESS_H | ||
2 | #define __OF_ADDRESS_H | ||
3 | #include <linux/ioport.h> | ||
4 | #include <linux/of.h> | ||
5 | |||
6 | extern u64 of_translate_address(struct device_node *np, const u32 *addr); | ||
7 | extern int of_address_to_resource(struct device_node *dev, int index, | ||
8 | struct resource *r); | ||
9 | extern void __iomem *of_iomap(struct device_node *device, int index); | ||
10 | |||
11 | /* Extract an address from a device, returns the region size and | ||
12 | * the address space flags too. The PCI version uses a BAR number | ||
13 | * instead of an absolute index | ||
14 | */ | ||
15 | extern const u32 *of_get_address(struct device_node *dev, int index, | ||
16 | u64 *size, unsigned int *flags); | ||
17 | |||
18 | #ifndef pci_address_to_pio | ||
19 | static inline unsigned long pci_address_to_pio(phys_addr_t addr) { return -1; } | ||
20 | #define pci_address_to_pio pci_address_to_pio | ||
21 | #endif | ||
22 | |||
23 | #ifdef CONFIG_PCI | ||
24 | extern const u32 *of_get_pci_address(struct device_node *dev, int bar_no, | ||
25 | u64 *size, unsigned int *flags); | ||
26 | extern int of_pci_address_to_resource(struct device_node *dev, int bar, | ||
27 | struct resource *r); | ||
28 | #else /* CONFIG_PCI */ | ||
29 | static inline int of_pci_address_to_resource(struct device_node *dev, int bar, | ||
30 | struct resource *r) | ||
31 | { | ||
32 | return -ENOSYS; | ||
33 | } | ||
34 | |||
35 | static inline const u32 *of_get_pci_address(struct device_node *dev, | ||
36 | int bar_no, u64 *size, unsigned int *flags) | ||
37 | { | ||
38 | return NULL; | ||
39 | } | ||
40 | #endif /* CONFIG_PCI */ | ||
41 | |||
42 | |||
43 | #endif /* __OF_ADDRESS_H */ | ||
44 | |||
diff --git a/include/linux/of_device.h b/include/linux/of_device.h index 11651facc5f..35aa44ad9f2 100644 --- a/include/linux/of_device.h +++ b/include/linux/of_device.h | |||
@@ -1,32 +1,77 @@ | |||
1 | #ifndef _LINUX_OF_DEVICE_H | 1 | #ifndef _LINUX_OF_DEVICE_H |
2 | #define _LINUX_OF_DEVICE_H | 2 | #define _LINUX_OF_DEVICE_H |
3 | 3 | ||
4 | /* | ||
5 | * The of_device *was* a kind of "base class" that was a superset of | ||
6 | * struct device for use by devices attached to an OF node and probed | ||
7 | * using OF properties. However, the important bit of OF-style | ||
8 | * probing, namely the device node pointer, has been moved into the | ||
9 | * common struct device when CONFIG_OF is set to make OF-style probing | ||
10 | * available to all bus types. So now, just make of_device and | ||
11 | * platform_device equivalent so that current of_platform bus users | ||
12 | * can be transparently migrated over to using the platform bus. | ||
13 | * | ||
14 | * This line will go away once all references to of_device are removed | ||
15 | * from the kernel. | ||
16 | */ | ||
17 | #define of_device platform_device | ||
18 | #include <linux/platform_device.h> | ||
19 | #include <linux/of_platform.h> /* temporary until merge */ | ||
20 | |||
4 | #ifdef CONFIG_OF_DEVICE | 21 | #ifdef CONFIG_OF_DEVICE |
5 | #include <linux/device.h> | 22 | #include <linux/device.h> |
6 | #include <linux/of.h> | 23 | #include <linux/of.h> |
7 | #include <linux/mod_devicetable.h> | 24 | #include <linux/mod_devicetable.h> |
8 | 25 | ||
9 | #include <asm/of_device.h> | ||
10 | |||
11 | #define to_of_device(d) container_of(d, struct of_device, dev) | 26 | #define to_of_device(d) container_of(d, struct of_device, dev) |
12 | 27 | ||
13 | extern const struct of_device_id *of_match_device( | 28 | extern const struct of_device_id *of_match_device( |
14 | const struct of_device_id *matches, const struct device *dev); | 29 | const struct of_device_id *matches, const struct device *dev); |
30 | extern void of_device_make_bus_id(struct device *dev); | ||
31 | |||
32 | /** | ||
33 | * of_driver_match_device - Tell if a driver's of_match_table matches a device. | ||
34 | * @drv: the device_driver structure to test | ||
35 | * @dev: the device structure to match against | ||
36 | */ | ||
37 | static inline int of_driver_match_device(const struct device *dev, | ||
38 | const struct device_driver *drv) | ||
39 | { | ||
40 | return of_match_device(drv->of_match_table, dev) != NULL; | ||
41 | } | ||
15 | 42 | ||
16 | extern struct of_device *of_dev_get(struct of_device *dev); | 43 | extern struct platform_device *of_dev_get(struct platform_device *dev); |
17 | extern void of_dev_put(struct of_device *dev); | 44 | extern void of_dev_put(struct platform_device *dev); |
18 | 45 | ||
19 | extern int of_device_register(struct of_device *ofdev); | 46 | extern int of_device_register(struct platform_device *ofdev); |
20 | extern void of_device_unregister(struct of_device *ofdev); | 47 | extern void of_device_unregister(struct platform_device *ofdev); |
21 | extern void of_release_dev(struct device *dev); | 48 | extern void of_release_dev(struct device *dev); |
22 | 49 | ||
23 | static inline void of_device_free(struct of_device *dev) | 50 | static inline void of_device_free(struct platform_device *dev) |
24 | { | 51 | { |
25 | of_release_dev(&dev->dev); | 52 | of_release_dev(&dev->dev); |
26 | } | 53 | } |
27 | 54 | ||
28 | extern ssize_t of_device_get_modalias(struct of_device *ofdev, | 55 | extern ssize_t of_device_get_modalias(struct device *dev, |
29 | char *str, ssize_t len); | 56 | char *str, ssize_t len); |
57 | |||
58 | extern int of_device_uevent(struct device *dev, struct kobj_uevent_env *env); | ||
59 | |||
60 | |||
61 | #else /* CONFIG_OF_DEVICE */ | ||
62 | |||
63 | static inline int of_driver_match_device(struct device *dev, | ||
64 | struct device_driver *drv) | ||
65 | { | ||
66 | return 0; | ||
67 | } | ||
68 | |||
69 | static inline int of_device_uevent(struct device *dev, | ||
70 | struct kobj_uevent_env *env) | ||
71 | { | ||
72 | return -ENODEV; | ||
73 | } | ||
74 | |||
30 | #endif /* CONFIG_OF_DEVICE */ | 75 | #endif /* CONFIG_OF_DEVICE */ |
31 | 76 | ||
32 | #endif /* _LINUX_OF_DEVICE_H */ | 77 | #endif /* _LINUX_OF_DEVICE_H */ |
diff --git a/include/linux/of_gpio.h b/include/linux/of_gpio.h index fc2472c3c25..6598c04dab0 100644 --- a/include/linux/of_gpio.h +++ b/include/linux/of_gpio.h | |||
@@ -33,34 +33,17 @@ enum of_gpio_flags { | |||
33 | #ifdef CONFIG_OF_GPIO | 33 | #ifdef CONFIG_OF_GPIO |
34 | 34 | ||
35 | /* | 35 | /* |
36 | * Generic OF GPIO chip | ||
37 | */ | ||
38 | struct of_gpio_chip { | ||
39 | struct gpio_chip gc; | ||
40 | int gpio_cells; | ||
41 | int (*xlate)(struct of_gpio_chip *of_gc, struct device_node *np, | ||
42 | const void *gpio_spec, enum of_gpio_flags *flags); | ||
43 | }; | ||
44 | |||
45 | static inline struct of_gpio_chip *to_of_gpio_chip(struct gpio_chip *gc) | ||
46 | { | ||
47 | return container_of(gc, struct of_gpio_chip, gc); | ||
48 | } | ||
49 | |||
50 | /* | ||
51 | * OF GPIO chip for memory mapped banks | 36 | * OF GPIO chip for memory mapped banks |
52 | */ | 37 | */ |
53 | struct of_mm_gpio_chip { | 38 | struct of_mm_gpio_chip { |
54 | struct of_gpio_chip of_gc; | 39 | struct gpio_chip gc; |
55 | void (*save_regs)(struct of_mm_gpio_chip *mm_gc); | 40 | void (*save_regs)(struct of_mm_gpio_chip *mm_gc); |
56 | void __iomem *regs; | 41 | void __iomem *regs; |
57 | }; | 42 | }; |
58 | 43 | ||
59 | static inline struct of_mm_gpio_chip *to_of_mm_gpio_chip(struct gpio_chip *gc) | 44 | static inline struct of_mm_gpio_chip *to_of_mm_gpio_chip(struct gpio_chip *gc) |
60 | { | 45 | { |
61 | struct of_gpio_chip *of_gc = to_of_gpio_chip(gc); | 46 | return container_of(gc, struct of_mm_gpio_chip, gc); |
62 | |||
63 | return container_of(of_gc, struct of_mm_gpio_chip, of_gc); | ||
64 | } | 47 | } |
65 | 48 | ||
66 | extern int of_get_gpio_flags(struct device_node *np, int index, | 49 | extern int of_get_gpio_flags(struct device_node *np, int index, |
@@ -69,11 +52,12 @@ extern unsigned int of_gpio_count(struct device_node *np); | |||
69 | 52 | ||
70 | extern int of_mm_gpiochip_add(struct device_node *np, | 53 | extern int of_mm_gpiochip_add(struct device_node *np, |
71 | struct of_mm_gpio_chip *mm_gc); | 54 | struct of_mm_gpio_chip *mm_gc); |
72 | extern int of_gpio_simple_xlate(struct of_gpio_chip *of_gc, | 55 | |
73 | struct device_node *np, | 56 | extern void of_gpiochip_add(struct gpio_chip *gc); |
74 | const void *gpio_spec, | 57 | extern void of_gpiochip_remove(struct gpio_chip *gc); |
75 | enum of_gpio_flags *flags); | 58 | extern struct gpio_chip *of_node_to_gpiochip(struct device_node *np); |
76 | #else | 59 | |
60 | #else /* CONFIG_OF_GPIO */ | ||
77 | 61 | ||
78 | /* Drivers may not strictly depend on the GPIO support, so let them link. */ | 62 | /* Drivers may not strictly depend on the GPIO support, so let them link. */ |
79 | static inline int of_get_gpio_flags(struct device_node *np, int index, | 63 | static inline int of_get_gpio_flags(struct device_node *np, int index, |
@@ -87,6 +71,9 @@ static inline unsigned int of_gpio_count(struct device_node *np) | |||
87 | return 0; | 71 | return 0; |
88 | } | 72 | } |
89 | 73 | ||
74 | static inline void of_gpiochip_add(struct gpio_chip *gc) { } | ||
75 | static inline void of_gpiochip_remove(struct gpio_chip *gc) { } | ||
76 | |||
90 | #endif /* CONFIG_OF_GPIO */ | 77 | #endif /* CONFIG_OF_GPIO */ |
91 | 78 | ||
92 | /** | 79 | /** |
diff --git a/include/linux/of_i2c.h b/include/linux/of_i2c.h index 34974b5a76f..0efe8d465f5 100644 --- a/include/linux/of_i2c.h +++ b/include/linux/of_i2c.h | |||
@@ -12,12 +12,19 @@ | |||
12 | #ifndef __LINUX_OF_I2C_H | 12 | #ifndef __LINUX_OF_I2C_H |
13 | #define __LINUX_OF_I2C_H | 13 | #define __LINUX_OF_I2C_H |
14 | 14 | ||
15 | #if defined(CONFIG_OF_I2C) || defined(CONFIG_OF_I2C_MODULE) | ||
15 | #include <linux/i2c.h> | 16 | #include <linux/i2c.h> |
16 | 17 | ||
17 | void of_register_i2c_devices(struct i2c_adapter *adap, | 18 | extern void of_i2c_register_devices(struct i2c_adapter *adap); |
18 | struct device_node *adap_node); | ||
19 | 19 | ||
20 | /* must call put_device() when done with returned i2c_client device */ | 20 | /* must call put_device() when done with returned i2c_client device */ |
21 | struct i2c_client *of_find_i2c_device_by_node(struct device_node *node); | 21 | extern struct i2c_client *of_find_i2c_device_by_node(struct device_node *node); |
22 | |||
23 | #else | ||
24 | static inline void of_i2c_register_devices(struct i2c_adapter *adap) | ||
25 | { | ||
26 | return; | ||
27 | } | ||
28 | #endif /* CONFIG_OF_I2C */ | ||
22 | 29 | ||
23 | #endif /* __LINUX_OF_I2C_H */ | 30 | #endif /* __LINUX_OF_I2C_H */ |
diff --git a/include/linux/of_irq.h b/include/linux/of_irq.h new file mode 100644 index 00000000000..5929781c104 --- /dev/null +++ b/include/linux/of_irq.h | |||
@@ -0,0 +1,70 @@ | |||
1 | #ifndef __OF_IRQ_H | ||
2 | #define __OF_IRQ_H | ||
3 | |||
4 | #if defined(CONFIG_OF) | ||
5 | struct of_irq; | ||
6 | #include <linux/types.h> | ||
7 | #include <linux/errno.h> | ||
8 | #include <linux/ioport.h> | ||
9 | #include <linux/of.h> | ||
10 | |||
11 | /* | ||
12 | * irq_of_parse_and_map() is used ba all OF enabled platforms; but SPARC | ||
13 | * implements it differently. However, the prototype is the same for all, | ||
14 | * so declare it here regardless of the CONFIG_OF_IRQ setting. | ||
15 | */ | ||
16 | extern unsigned int irq_of_parse_and_map(struct device_node *node, int index); | ||
17 | |||
18 | #if defined(CONFIG_OF_IRQ) | ||
19 | /** | ||
20 | * of_irq - container for device_node/irq_specifier pair for an irq controller | ||
21 | * @controller: pointer to interrupt controller device tree node | ||
22 | * @size: size of interrupt specifier | ||
23 | * @specifier: array of cells @size long specifing the specific interrupt | ||
24 | * | ||
25 | * This structure is returned when an interrupt is mapped. The controller | ||
26 | * field needs to be put() after use | ||
27 | */ | ||
28 | #define OF_MAX_IRQ_SPEC 4 /* We handle specifiers of at most 4 cells */ | ||
29 | struct of_irq { | ||
30 | struct device_node *controller; /* Interrupt controller node */ | ||
31 | u32 size; /* Specifier size */ | ||
32 | u32 specifier[OF_MAX_IRQ_SPEC]; /* Specifier copy */ | ||
33 | }; | ||
34 | |||
35 | /* | ||
36 | * Workarounds only applied to 32bit powermac machines | ||
37 | */ | ||
38 | #define OF_IMAP_OLDWORLD_MAC 0x00000001 | ||
39 | #define OF_IMAP_NO_PHANDLE 0x00000002 | ||
40 | |||
41 | #if defined(CONFIG_PPC32) && defined(CONFIG_PPC_PMAC) | ||
42 | extern unsigned int of_irq_workarounds; | ||
43 | extern struct device_node *of_irq_dflt_pic; | ||
44 | extern int of_irq_map_oldworld(struct device_node *device, int index, | ||
45 | struct of_irq *out_irq); | ||
46 | #else /* CONFIG_PPC32 && CONFIG_PPC_PMAC */ | ||
47 | #define of_irq_workarounds (0) | ||
48 | #define of_irq_dflt_pic (NULL) | ||
49 | static inline int of_irq_map_oldworld(struct device_node *device, int index, | ||
50 | struct of_irq *out_irq) | ||
51 | { | ||
52 | return -EINVAL; | ||
53 | } | ||
54 | #endif /* CONFIG_PPC32 && CONFIG_PPC_PMAC */ | ||
55 | |||
56 | |||
57 | extern int of_irq_map_raw(struct device_node *parent, const u32 *intspec, | ||
58 | u32 ointsize, const u32 *addr, | ||
59 | struct of_irq *out_irq); | ||
60 | extern int of_irq_map_one(struct device_node *device, int index, | ||
61 | struct of_irq *out_irq); | ||
62 | extern unsigned int irq_create_of_mapping(struct device_node *controller, | ||
63 | const u32 *intspec, | ||
64 | unsigned int intsize); | ||
65 | extern int of_irq_to_resource(struct device_node *dev, int index, | ||
66 | struct resource *r); | ||
67 | |||
68 | #endif /* CONFIG_OF_IRQ */ | ||
69 | #endif /* CONFIG_OF */ | ||
70 | #endif /* __OF_IRQ_H */ | ||
diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h index 1643d3761eb..4e6d989c06d 100644 --- a/include/linux/of_platform.h +++ b/include/linux/of_platform.h | |||
@@ -17,29 +17,24 @@ | |||
17 | #include <linux/mod_devicetable.h> | 17 | #include <linux/mod_devicetable.h> |
18 | #include <linux/pm.h> | 18 | #include <linux/pm.h> |
19 | #include <linux/of_device.h> | 19 | #include <linux/of_device.h> |
20 | 20 | #include <linux/platform_device.h> | |
21 | /* | ||
22 | * The of_platform_bus_type is a bus type used by drivers that do not | ||
23 | * attach to a macio or similar bus but still use OF probing | ||
24 | * mechanism | ||
25 | */ | ||
26 | extern struct bus_type of_platform_bus_type; | ||
27 | 21 | ||
28 | /* | 22 | /* |
29 | * An of_platform_driver driver is attached to a basic of_device on | 23 | * An of_platform_driver driver is attached to a basic of_device on |
30 | * the "platform bus" (of_platform_bus_type). | 24 | * the "platform bus" (platform_bus_type). |
31 | */ | 25 | */ |
32 | struct of_platform_driver | 26 | struct of_platform_driver |
33 | { | 27 | { |
34 | int (*probe)(struct of_device* dev, | 28 | int (*probe)(struct platform_device* dev, |
35 | const struct of_device_id *match); | 29 | const struct of_device_id *match); |
36 | int (*remove)(struct of_device* dev); | 30 | int (*remove)(struct platform_device* dev); |
37 | 31 | ||
38 | int (*suspend)(struct of_device* dev, pm_message_t state); | 32 | int (*suspend)(struct platform_device* dev, pm_message_t state); |
39 | int (*resume)(struct of_device* dev); | 33 | int (*resume)(struct platform_device* dev); |
40 | int (*shutdown)(struct of_device* dev); | 34 | int (*shutdown)(struct platform_device* dev); |
41 | 35 | ||
42 | struct device_driver driver; | 36 | struct device_driver driver; |
37 | struct platform_driver platform_driver; | ||
43 | }; | 38 | }; |
44 | #define to_of_platform_driver(drv) \ | 39 | #define to_of_platform_driver(drv) \ |
45 | container_of(drv,struct of_platform_driver, driver) | 40 | container_of(drv,struct of_platform_driver, driver) |
@@ -49,20 +44,30 @@ extern int of_register_driver(struct of_platform_driver *drv, | |||
49 | extern void of_unregister_driver(struct of_platform_driver *drv); | 44 | extern void of_unregister_driver(struct of_platform_driver *drv); |
50 | 45 | ||
51 | /* Platform drivers register/unregister */ | 46 | /* Platform drivers register/unregister */ |
52 | static inline int of_register_platform_driver(struct of_platform_driver *drv) | 47 | extern int of_register_platform_driver(struct of_platform_driver *drv); |
53 | { | 48 | extern void of_unregister_platform_driver(struct of_platform_driver *drv); |
54 | return of_register_driver(drv, &of_platform_bus_type); | ||
55 | } | ||
56 | static inline void of_unregister_platform_driver(struct of_platform_driver *drv) | ||
57 | { | ||
58 | of_unregister_driver(drv); | ||
59 | } | ||
60 | 49 | ||
61 | #include <asm/of_platform.h> | 50 | extern struct platform_device *of_device_alloc(struct device_node *np, |
62 | 51 | const char *bus_id, | |
63 | extern struct of_device *of_find_device_by_node(struct device_node *np); | 52 | struct device *parent); |
53 | extern struct platform_device *of_find_device_by_node(struct device_node *np); | ||
64 | 54 | ||
65 | extern int of_bus_type_init(struct bus_type *bus, const char *name); | 55 | extern int of_bus_type_init(struct bus_type *bus, const char *name); |
56 | |||
57 | #if !defined(CONFIG_SPARC) /* SPARC has its own device registration method */ | ||
58 | /* Platform devices and busses creation */ | ||
59 | extern struct platform_device *of_platform_device_create(struct device_node *np, | ||
60 | const char *bus_id, | ||
61 | struct device *parent); | ||
62 | |||
63 | /* pseudo "matches" value to not do deep probe */ | ||
64 | #define OF_NO_DEEP_PROBE ((struct of_device_id *)-1) | ||
65 | |||
66 | extern int of_platform_bus_probe(struct device_node *root, | ||
67 | const struct of_device_id *matches, | ||
68 | struct device *parent); | ||
69 | #endif /* !CONFIG_SPARC */ | ||
70 | |||
66 | #endif /* CONFIG_OF_DEVICE */ | 71 | #endif /* CONFIG_OF_DEVICE */ |
67 | 72 | ||
68 | #endif /* _LINUX_OF_PLATFORM_H */ | 73 | #endif /* _LINUX_OF_PLATFORM_H */ |
diff --git a/include/linux/of_spi.h b/include/linux/of_spi.h index 5f71ee8c086..9e3e70f78ae 100644 --- a/include/linux/of_spi.h +++ b/include/linux/of_spi.h | |||
@@ -9,10 +9,15 @@ | |||
9 | #ifndef __LINUX_OF_SPI_H | 9 | #ifndef __LINUX_OF_SPI_H |
10 | #define __LINUX_OF_SPI_H | 10 | #define __LINUX_OF_SPI_H |
11 | 11 | ||
12 | #include <linux/of.h> | ||
13 | #include <linux/spi/spi.h> | 12 | #include <linux/spi/spi.h> |
14 | 13 | ||
15 | extern void of_register_spi_devices(struct spi_master *master, | 14 | #if defined(CONFIG_OF_SPI) || defined(CONFIG_OF_SPI_MODULE) |
16 | struct device_node *np); | 15 | extern void of_register_spi_devices(struct spi_master *master); |
16 | #else | ||
17 | static inline void of_register_spi_devices(struct spi_master *master) | ||
18 | { | ||
19 | return; | ||
20 | } | ||
21 | #endif /* CONFIG_OF_SPI */ | ||
17 | 22 | ||
18 | #endif /* __LINUX_OF_SPI */ | 23 | #endif /* __LINUX_OF_SPI */ |