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 @@ +* Calxeda SATA Controller + +SATA nodes are defined to describe on-chip Serial ATA controllers. +Each SATA controller should have its own node. + +Required properties: +- compatible : compatible list, contains "calxeda,hb-ahci" +- interrupts : +- reg : + +Example: + sata@ffe08000 { + compatible = "calxeda,hb-ahci"; + reg = <0xffe08000 0x1000>; + interrupts = <115>; + }; + 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) return 0; } +static const struct of_device_id ahci_of_match[] = { + { .compatible = "calxeda,hb-ahci", }, + {}, +}; +MODULE_DEVICE_TABLE(of, ahci_of_match); + static struct platform_driver ahci_driver = { .remove = __devexit_p(ahci_remove), .driver = { .name = "ahci", .owner = THIS_MODULE, + .of_match_table = ahci_of_match, }, .id_table = ahci_devtype, }; 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 struct device_node *np) { struct resource res; - if (lookup) { - for(; lookup->name != NULL; lookup++) { - if (!of_device_is_compatible(np, lookup->compatible)) - continue; - if (of_address_to_resource(np, 0, &res)) - continue; - if (res.start != lookup->phys_addr) - continue; - pr_debug("%s: devname=%s\n", np->full_name, lookup->name); - return lookup; - } + + if (!lookup) + return NULL; + + for(; lookup->name != NULL; lookup++) { + if (!of_device_is_compatible(np, lookup->compatible)) + continue; + if (of_address_to_resource(np, 0, &res)) + continue; + if (res.start != lookup->phys_addr) + continue; + pr_debug("%s: devname=%s\n", np->full_name, lookup->name); + return lookup; } + return NULL; } @@ -329,8 +332,9 @@ static const struct of_dev_auxdata *of_dev_lookup(const struct of_dev_auxdata *l * of_platform_bus_create() - Create a device for a node and its children. * @bus: device node of the bus to instantiate * @matches: match table for bus nodes - * disallow recursive creation of child buses + * @lookup: auxdata table for matching id and platform_data with device nodes * @parent: parent for new device, or NULL for top level. + * @strict: require compatible property * * Creates a platform_device for the provided device_node, and optionally * 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, return NULL; } +static inline int of_alias_get_id(struct device_node *np, const char *stem) +{ + return -ENOSYS; +} + +static inline int of_machine_is_compatible(const char *compat) +{ + return 0; +} + #define of_match_ptr(_ptr) NULL #define of_match_node(_matches, _node) NULL #endif /* CONFIG_OF */