diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-11-04 10:49:29 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-11-04 10:49:29 -0400 |
| commit | 6b1506c66809ddf6afd17e330db2999c878b5d90 (patch) | |
| tree | eb93535fcc3e568ffabd5400b019463633ea2c22 | |
| parent | 1a67a573b8d9f02211f36fbab50f6265dc49384a (diff) | |
| parent | 50e07f888cb24b55e0d8283f631907794dd757c2 (diff) | |
Merge branch 'devicetree/merge' of git://git.secretlab.ca/git/linux-2.6
* 'devicetree/merge' of git://git.secretlab.ca/git/linux-2.6:
dt: add empty of_machine_is_compatible
ahci: add DT binding for Calxeda AHCI controller
dt/platform: minor cleanup
dt: add empty of_alias_get_id() for non-dt builds
| -rw-r--r-- | Documentation/devicetree/bindings/ata/calxeda-sata.txt | 17 | ||||
| -rw-r--r-- | drivers/ata/ahci_platform.c | 7 | ||||
| -rw-r--r-- | drivers/of/platform.c | 28 | ||||
| -rw-r--r-- | include/linux/of.h | 10 |
4 files changed, 50 insertions, 12 deletions
diff --git a/Documentation/devicetree/bindings/ata/calxeda-sata.txt b/Documentation/devicetree/bindings/ata/calxeda-sata.txt new file mode 100644 index 000000000000..79caa5651f53 --- /dev/null +++ b/Documentation/devicetree/bindings/ata/calxeda-sata.txt | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | * Calxeda SATA Controller | ||
| 2 | |||
| 3 | SATA nodes are defined to describe on-chip Serial ATA controllers. | ||
| 4 | Each SATA controller should have its own node. | ||
| 5 | |||
| 6 | Required properties: | ||
| 7 | - compatible : compatible list, contains "calxeda,hb-ahci" | ||
| 8 | - interrupts : <interrupt mapping for SATA IRQ> | ||
| 9 | - reg : <registers mapping> | ||
| 10 | |||
| 11 | Example: | ||
| 12 | sata@ffe08000 { | ||
| 13 | compatible = "calxeda,hb-ahci"; | ||
| 14 | reg = <0xffe08000 0x1000>; | ||
| 15 | interrupts = <115>; | ||
| 16 | }; | ||
| 17 | |||
diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c index c03277d37748..004f2ce3dc73 100644 --- a/drivers/ata/ahci_platform.c +++ b/drivers/ata/ahci_platform.c | |||
| @@ -202,11 +202,18 @@ static int __devexit ahci_remove(struct platform_device *pdev) | |||
| 202 | return 0; | 202 | return 0; |
| 203 | } | 203 | } |
| 204 | 204 | ||
| 205 | static const struct of_device_id ahci_of_match[] = { | ||
| 206 | { .compatible = "calxeda,hb-ahci", }, | ||
| 207 | {}, | ||
| 208 | }; | ||
| 209 | MODULE_DEVICE_TABLE(of, ahci_of_match); | ||
| 210 | |||
| 205 | static struct platform_driver ahci_driver = { | 211 | static struct platform_driver ahci_driver = { |
| 206 | .remove = __devexit_p(ahci_remove), | 212 | .remove = __devexit_p(ahci_remove), |
| 207 | .driver = { | 213 | .driver = { |
| 208 | .name = "ahci", | 214 | .name = "ahci", |
| 209 | .owner = THIS_MODULE, | 215 | .owner = THIS_MODULE, |
| 216 | .of_match_table = ahci_of_match, | ||
| 210 | }, | 217 | }, |
| 211 | .id_table = ahci_devtype, | 218 | .id_table = ahci_devtype, |
| 212 | }; | 219 | }; |
diff --git a/drivers/of/platform.c b/drivers/of/platform.c index ed5a6d3c26aa..cbd5d701c7e0 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c | |||
| @@ -310,18 +310,21 @@ static const struct of_dev_auxdata *of_dev_lookup(const struct of_dev_auxdata *l | |||
| 310 | struct device_node *np) | 310 | struct device_node *np) |
| 311 | { | 311 | { |
| 312 | struct resource res; | 312 | struct resource res; |
| 313 | if (lookup) { | 313 | |
| 314 | for(; lookup->name != NULL; lookup++) { | 314 | if (!lookup) |
| 315 | if (!of_device_is_compatible(np, lookup->compatible)) | 315 | return NULL; |
| 316 | continue; | 316 | |
| 317 | if (of_address_to_resource(np, 0, &res)) | 317 | for(; lookup->name != NULL; lookup++) { |
| 318 | continue; | 318 | if (!of_device_is_compatible(np, lookup->compatible)) |
| 319 | if (res.start != lookup->phys_addr) | 319 | continue; |
| 320 | continue; | 320 | if (of_address_to_resource(np, 0, &res)) |
| 321 | pr_debug("%s: devname=%s\n", np->full_name, lookup->name); | 321 | continue; |
| 322 | return lookup; | 322 | if (res.start != lookup->phys_addr) |
| 323 | } | 323 | continue; |
| 324 | pr_debug("%s: devname=%s\n", np->full_name, lookup->name); | ||
| 325 | return lookup; | ||
| 324 | } | 326 | } |
| 327 | |||
| 325 | return NULL; | 328 | return NULL; |
| 326 | } | 329 | } |
| 327 | 330 | ||
| @@ -329,8 +332,9 @@ static const struct of_dev_auxdata *of_dev_lookup(const struct of_dev_auxdata *l | |||
| 329 | * of_platform_bus_create() - Create a device for a node and its children. | 332 | * of_platform_bus_create() - Create a device for a node and its children. |
| 330 | * @bus: device node of the bus to instantiate | 333 | * @bus: device node of the bus to instantiate |
| 331 | * @matches: match table for bus nodes | 334 | * @matches: match table for bus nodes |
| 332 | * disallow recursive creation of child buses | 335 | * @lookup: auxdata table for matching id and platform_data with device nodes |
| 333 | * @parent: parent for new device, or NULL for top level. | 336 | * @parent: parent for new device, or NULL for top level. |
| 337 | * @strict: require compatible property | ||
| 334 | * | 338 | * |
| 335 | * Creates a platform_device for the provided device_node, and optionally | 339 | * Creates a platform_device for the provided device_node, and optionally |
| 336 | * recursively create devices for all the child nodes. | 340 | * recursively create devices for all the child nodes. |
diff --git a/include/linux/of.h b/include/linux/of.h index f01ba8a209c0..0e89aa0bf07a 100644 --- a/include/linux/of.h +++ b/include/linux/of.h | |||
| @@ -321,6 +321,16 @@ static inline struct device_node *of_parse_phandle(struct device_node *np, | |||
| 321 | return NULL; | 321 | return NULL; |
| 322 | } | 322 | } |
| 323 | 323 | ||
| 324 | static inline int of_alias_get_id(struct device_node *np, const char *stem) | ||
| 325 | { | ||
| 326 | return -ENOSYS; | ||
| 327 | } | ||
| 328 | |||
| 329 | static inline int of_machine_is_compatible(const char *compat) | ||
| 330 | { | ||
| 331 | return 0; | ||
| 332 | } | ||
| 333 | |||
| 324 | #define of_match_ptr(_ptr) NULL | 334 | #define of_match_ptr(_ptr) NULL |
| 325 | #define of_match_node(_matches, _node) NULL | 335 | #define of_match_node(_matches, _node) NULL |
| 326 | #endif /* CONFIG_OF */ | 336 | #endif /* CONFIG_OF */ |
