aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-10-27 02:35:41 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-10-27 02:35:41 -0400
commit5fffb9513cb7fdd39e03c4cab1cda9c2f2694576 (patch)
treef28f1c232dd5774c9157ba257df37e66d4097870
parentb96d71571f7745216ef63f13770b5a10b94ddd34 (diff)
parentae97159aed6eff68f4ac86472b018985f071fed5 (diff)
Merge branch 'devicetree/next' of git://git.secretlab.ca/git/linux-2.6
* 'devicetree/next' of git://git.secretlab.ca/git/linux-2.6: of_mdio: Don't phy_scan_fixups() twice Devicetree: Expand on ARM Primecell binding documentation dt: Add empty of_match_node() macro dt: add empty dt helpers for non-dt build devicetree: fix build error on drivers/tty/serial/altera_jtaguart.c devicetree: Add ARM pl022 spi controller binding doc devicetree: Add ARM pl061 gpio controller binding doc of/irq: of_irq_find_parent: check for parent equal to child MAINTAINERS: update devicetree maintainers dt: add helper to read 64-bit integers tty: use of_match_ptr() for of_match_table entry OF: Add of_match_ptr() macro dt: add empty for_each_child_of_node, of_find_property devicetree: Document Qualcomm and Atmel prefixes serial/imx: add of_alias_get_id() reference back dt: add of_alias_scan and of_alias_get_id devicetree: Add a registry of vendor prefixes
-rw-r--r--Documentation/devicetree/bindings/arm/primecell.txt4
-rw-r--r--Documentation/devicetree/bindings/gpio/pl061-gpio.txt10
-rw-r--r--Documentation/devicetree/bindings/spi/spi_pl022.txt12
-rw-r--r--Documentation/devicetree/bindings/vendor-prefixes.txt40
-rw-r--r--MAINTAINERS2
-rw-r--r--drivers/of/base.c150
-rw-r--r--drivers/of/fdt.c6
-rw-r--r--drivers/of/irq.c14
-rw-r--r--drivers/of/of_mdio.c1
-rw-r--r--drivers/of/pdt.c8
-rw-r--r--drivers/tty/serial/altera_jtaguart.c5
-rw-r--r--drivers/tty/serial/altera_uart.c4
-rw-r--r--drivers/tty/serial/imx.c11
-rw-r--r--drivers/tty/serial/uartlite.c4
-rw-r--r--include/linux/of.h41
15 files changed, 286 insertions, 26 deletions
diff --git a/Documentation/devicetree/bindings/arm/primecell.txt b/Documentation/devicetree/bindings/arm/primecell.txt
index 1d5d7a870ec7..951ca46789d4 100644
--- a/Documentation/devicetree/bindings/arm/primecell.txt
+++ b/Documentation/devicetree/bindings/arm/primecell.txt
@@ -6,7 +6,9 @@ driver matching.
6 6
7Required properties: 7Required properties:
8 8
9- compatible : should be a specific value for peripheral and "arm,primecell" 9- compatible : should be a specific name for the peripheral and
10 "arm,primecell". The specific name will match the ARM
11 engineering name for the logic block in the form: "arm,pl???"
10 12
11Optional properties: 13Optional properties:
12 14
diff --git a/Documentation/devicetree/bindings/gpio/pl061-gpio.txt b/Documentation/devicetree/bindings/gpio/pl061-gpio.txt
new file mode 100644
index 000000000000..a2c416bcbccc
--- /dev/null
+++ b/Documentation/devicetree/bindings/gpio/pl061-gpio.txt
@@ -0,0 +1,10 @@
1ARM PL061 GPIO controller
2
3Required properties:
4- compatible : "arm,pl061", "arm,primecell"
5- #gpio-cells : Should be two. The first cell is the pin number and the
6 second cell is used to specify optional parameters:
7 - bit 0 specifies polarity (0 for normal, 1 for inverted)
8- gpio-controller : Marks the device node as a GPIO controller.
9- interrupts : Interrupt mapping for GPIO IRQ.
10
diff --git a/Documentation/devicetree/bindings/spi/spi_pl022.txt b/Documentation/devicetree/bindings/spi/spi_pl022.txt
new file mode 100644
index 000000000000..306ec3ff3c0e
--- /dev/null
+++ b/Documentation/devicetree/bindings/spi/spi_pl022.txt
@@ -0,0 +1,12 @@
1ARM PL022 SPI controller
2
3Required properties:
4- compatible : "arm,pl022", "arm,primecell"
5- reg : Offset and length of the register set for the device
6- interrupts : Should contain SPI controller interrupt
7
8Optional properties:
9- cs-gpios : should specify GPIOs used for chipselects.
10 The gpios will be referred to as reg = <index> in the SPI child nodes.
11 If unspecified, a single SPI device without a chip select can be used.
12
diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt
new file mode 100644
index 000000000000..e8552782b440
--- /dev/null
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -0,0 +1,40 @@
1Device tree binding vendor prefix registry. Keep list in alphabetical order.
2
3This isn't an exhaustive list, but you should add new prefixes to it before
4using them to avoid name-space collisions.
5
6adi Analog Devices, Inc.
7amcc Applied Micro Circuits Corporation (APM, formally AMCC)
8apm Applied Micro Circuits Corporation (APM)
9arm ARM Ltd.
10atmel Atmel Corporation
11chrp Common Hardware Reference Platform
12dallas Maxim Integrated Products (formerly Dallas Semiconductor)
13denx Denx Software Engineering
14epson Seiko Epson Corp.
15est ESTeem Wireless Modems
16fsl Freescale Semiconductor
17GEFanuc GE Fanuc Intelligent Platforms Embedded Systems, Inc.
18gef GE Fanuc Intelligent Platforms Embedded Systems, Inc.
19hp Hewlett Packard
20ibm International Business Machines (IBM)
21idt Integrated Device Technologies, Inc.
22intercontrol Inter Control Group
23linux Linux-specific binding
24marvell Marvell Technology Group Ltd.
25maxim Maxim Integrated Products
26mosaixtech Mosaix Technologies, Inc.
27national National Semiconductor
28nintendo Nintendo
29nvidia NVIDIA
30nxp NXP Semiconductors
31powervr Imagination Technologies
32qcom Qualcomm, Inc.
33ramtron Ramtron International
34samsung Samsung Semiconductor
35schindler Schindler
36simtek
37sirf SiRF Technology, Inc.
38stericsson ST-Ericsson
39ti Texas Instruments
40xlnx Xilinx
diff --git a/MAINTAINERS b/MAINTAINERS
index 27af9c95ef41..506fe49a4c78 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4760,10 +4760,12 @@ F: drivers/i2c/busses/i2c-ocores.c
4760 4760
4761OPEN FIRMWARE AND FLATTENED DEVICE TREE 4761OPEN FIRMWARE AND FLATTENED DEVICE TREE
4762M: Grant Likely <grant.likely@secretlab.ca> 4762M: Grant Likely <grant.likely@secretlab.ca>
4763M: Rob Herring <rob.herring@calxeda.com>
4763L: devicetree-discuss@lists.ozlabs.org (moderated for non-subscribers) 4764L: devicetree-discuss@lists.ozlabs.org (moderated for non-subscribers)
4764W: http://fdt.secretlab.ca 4765W: http://fdt.secretlab.ca
4765T: git git://git.secretlab.ca/git/linux-2.6.git 4766T: git git://git.secretlab.ca/git/linux-2.6.git
4766S: Maintained 4767S: Maintained
4768F: Documentation/devicetree
4767F: drivers/of 4769F: drivers/of
4768F: include/linux/of*.h 4770F: include/linux/of*.h
4769K: of_get_property 4771K: of_get_property
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 3ff22e32b602..b970562e0111 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -17,14 +17,39 @@
17 * as published by the Free Software Foundation; either version 17 * as published by the Free Software Foundation; either version
18 * 2 of the License, or (at your option) any later version. 18 * 2 of the License, or (at your option) any later version.
19 */ 19 */
20#include <linux/ctype.h>
20#include <linux/module.h> 21#include <linux/module.h>
21#include <linux/of.h> 22#include <linux/of.h>
22#include <linux/spinlock.h> 23#include <linux/spinlock.h>
23#include <linux/slab.h> 24#include <linux/slab.h>
24#include <linux/proc_fs.h> 25#include <linux/proc_fs.h>
25 26
27/**
28 * struct alias_prop - Alias property in 'aliases' node
29 * @link: List node to link the structure in aliases_lookup list
30 * @alias: Alias property name
31 * @np: Pointer to device_node that the alias stands for
32 * @id: Index value from end of alias name
33 * @stem: Alias string without the index
34 *
35 * The structure represents one alias property of 'aliases' node as
36 * an entry in aliases_lookup list.
37 */
38struct alias_prop {
39 struct list_head link;
40 const char *alias;
41 struct device_node *np;
42 int id;
43 char stem[0];
44};
45
46static LIST_HEAD(aliases_lookup);
47
26struct device_node *allnodes; 48struct device_node *allnodes;
27struct device_node *of_chosen; 49struct device_node *of_chosen;
50struct device_node *of_aliases;
51
52static DEFINE_MUTEX(of_aliases_mutex);
28 53
29/* use when traversing tree through the allnext, child, sibling, 54/* use when traversing tree through the allnext, child, sibling,
30 * or parent members of struct device_node. 55 * or parent members of struct device_node.
@@ -632,6 +657,35 @@ int of_property_read_u32_array(const struct device_node *np,
632EXPORT_SYMBOL_GPL(of_property_read_u32_array); 657EXPORT_SYMBOL_GPL(of_property_read_u32_array);
633 658
634/** 659/**
660 * of_property_read_u64 - Find and read a 64 bit integer from a property
661 * @np: device node from which the property value is to be read.
662 * @propname: name of the property to be searched.
663 * @out_value: pointer to return value, modified only if return value is 0.
664 *
665 * Search for a property in a device node and read a 64-bit value from
666 * it. Returns 0 on success, -EINVAL if the property does not exist,
667 * -ENODATA if property does not have a value, and -EOVERFLOW if the
668 * property data isn't large enough.
669 *
670 * The out_value is modified only if a valid u64 value can be decoded.
671 */
672int of_property_read_u64(const struct device_node *np, const char *propname,
673 u64 *out_value)
674{
675 struct property *prop = of_find_property(np, propname, NULL);
676
677 if (!prop)
678 return -EINVAL;
679 if (!prop->value)
680 return -ENODATA;
681 if (sizeof(*out_value) > prop->length)
682 return -EOVERFLOW;
683 *out_value = of_read_number(prop->value, 2);
684 return 0;
685}
686EXPORT_SYMBOL_GPL(of_property_read_u64);
687
688/**
635 * of_property_read_string - Find and read a string from a property 689 * of_property_read_string - Find and read a string from a property
636 * @np: device node from which the property value is to be read. 690 * @np: device node from which the property value is to be read.
637 * @propname: name of the property to be searched. 691 * @propname: name of the property to be searched.
@@ -988,3 +1042,99 @@ out_unlock:
988} 1042}
989#endif /* defined(CONFIG_OF_DYNAMIC) */ 1043#endif /* defined(CONFIG_OF_DYNAMIC) */
990 1044
1045static void of_alias_add(struct alias_prop *ap, struct device_node *np,
1046 int id, const char *stem, int stem_len)
1047{
1048 ap->np = np;
1049 ap->id = id;
1050 strncpy(ap->stem, stem, stem_len);
1051 ap->stem[stem_len] = 0;
1052 list_add_tail(&ap->link, &aliases_lookup);
1053 pr_debug("adding DT alias:%s: stem=%s id=%i node=%s\n",
1054 ap->alias, ap->stem, ap->id, np ? np->full_name : NULL);
1055}
1056
1057/**
1058 * of_alias_scan - Scan all properties of 'aliases' node
1059 *
1060 * The function scans all the properties of 'aliases' node and populate
1061 * the the global lookup table with the properties. It returns the
1062 * number of alias_prop found, or error code in error case.
1063 *
1064 * @dt_alloc: An allocator that provides a virtual address to memory
1065 * for the resulting tree
1066 */
1067void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align))
1068{
1069 struct property *pp;
1070
1071 of_chosen = of_find_node_by_path("/chosen");
1072 if (of_chosen == NULL)
1073 of_chosen = of_find_node_by_path("/chosen@0");
1074 of_aliases = of_find_node_by_path("/aliases");
1075 if (!of_aliases)
1076 return;
1077
1078 for_each_property(pp, of_aliases->properties) {
1079 const char *start = pp->name;
1080 const char *end = start + strlen(start);
1081 struct device_node *np;
1082 struct alias_prop *ap;
1083 int id, len;
1084
1085 /* Skip those we do not want to proceed */
1086 if (!strcmp(pp->name, "name") ||
1087 !strcmp(pp->name, "phandle") ||
1088 !strcmp(pp->name, "linux,phandle"))
1089 continue;
1090
1091 np = of_find_node_by_path(pp->value);
1092 if (!np)
1093 continue;
1094
1095 /* walk the alias backwards to extract the id and work out
1096 * the 'stem' string */
1097 while (isdigit(*(end-1)) && end > start)
1098 end--;
1099 len = end - start;
1100
1101 if (kstrtoint(end, 10, &id) < 0)
1102 continue;
1103
1104 /* Allocate an alias_prop with enough space for the stem */
1105 ap = dt_alloc(sizeof(*ap) + len + 1, 4);
1106 if (!ap)
1107 continue;
1108 ap->alias = start;
1109 of_alias_add(ap, np, id, start, len);
1110 }
1111}
1112
1113/**
1114 * of_alias_get_id - Get alias id for the given device_node
1115 * @np: Pointer to the given device_node
1116 * @stem: Alias stem of the given device_node
1117 *
1118 * The function travels the lookup table to get alias id for the given
1119 * device_node and alias stem. It returns the alias id if find it.
1120 */
1121int of_alias_get_id(struct device_node *np, const char *stem)
1122{
1123 struct alias_prop *app;
1124 int id = -ENODEV;
1125
1126 mutex_lock(&of_aliases_mutex);
1127 list_for_each_entry(app, &aliases_lookup, link) {
1128 if (strcmp(app->stem, stem) != 0)
1129 continue;
1130
1131 if (np == app->np) {
1132 id = app->id;
1133 break;
1134 }
1135 }
1136 mutex_unlock(&of_aliases_mutex);
1137
1138 return id;
1139}
1140EXPORT_SYMBOL_GPL(of_alias_get_id);
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 65200af29c52..aeec35bc3789 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -707,10 +707,8 @@ void __init unflatten_device_tree(void)
707 __unflatten_device_tree(initial_boot_params, &allnodes, 707 __unflatten_device_tree(initial_boot_params, &allnodes,
708 early_init_dt_alloc_memory_arch); 708 early_init_dt_alloc_memory_arch);
709 709
710 /* Get pointer to OF "/chosen" node for use everywhere */ 710 /* Get pointer to "/chosen" and "/aliasas" nodes for use everywhere */
711 of_chosen = of_find_node_by_path("/chosen"); 711 of_alias_scan(early_init_dt_alloc_memory_arch);
712 if (of_chosen == NULL)
713 of_chosen = of_find_node_by_path("/chosen@0");
714} 712}
715 713
716#endif /* CONFIG_OF_EARLY_FLATTREE */ 714#endif /* CONFIG_OF_EARLY_FLATTREE */
diff --git a/drivers/of/irq.c b/drivers/of/irq.c
index 9f689f1da0fc..6a5b5e777dd2 100644
--- a/drivers/of/irq.c
+++ b/drivers/of/irq.c
@@ -58,27 +58,27 @@ EXPORT_SYMBOL_GPL(irq_of_parse_and_map);
58 */ 58 */
59struct device_node *of_irq_find_parent(struct device_node *child) 59struct device_node *of_irq_find_parent(struct device_node *child)
60{ 60{
61 struct device_node *p; 61 struct device_node *p, *c = child;
62 const __be32 *parp; 62 const __be32 *parp;
63 63
64 if (!of_node_get(child)) 64 if (!of_node_get(c))
65 return NULL; 65 return NULL;
66 66
67 do { 67 do {
68 parp = of_get_property(child, "interrupt-parent", NULL); 68 parp = of_get_property(c, "interrupt-parent", NULL);
69 if (parp == NULL) 69 if (parp == NULL)
70 p = of_get_parent(child); 70 p = of_get_parent(c);
71 else { 71 else {
72 if (of_irq_workarounds & OF_IMAP_NO_PHANDLE) 72 if (of_irq_workarounds & OF_IMAP_NO_PHANDLE)
73 p = of_node_get(of_irq_dflt_pic); 73 p = of_node_get(of_irq_dflt_pic);
74 else 74 else
75 p = of_find_node_by_phandle(be32_to_cpup(parp)); 75 p = of_find_node_by_phandle(be32_to_cpup(parp));
76 } 76 }
77 of_node_put(child); 77 of_node_put(c);
78 child = p; 78 c = p;
79 } while (p && of_get_property(p, "#interrupt-cells", NULL) == NULL); 79 } while (p && of_get_property(p, "#interrupt-cells", NULL) == NULL);
80 80
81 return p; 81 return (p == child) ? NULL : p;
82} 82}
83 83
84/** 84/**
diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c
index d35e300b0ad1..980c079e4443 100644
--- a/drivers/of/of_mdio.c
+++ b/drivers/of/of_mdio.c
@@ -83,7 +83,6 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np)
83 addr); 83 addr);
84 continue; 84 continue;
85 } 85 }
86 phy_scan_fixups(phy);
87 86
88 /* Associate the OF node with the device structure so it 87 /* Associate the OF node with the device structure so it
89 * can be looked up later */ 88 * can be looked up later */
diff --git a/drivers/of/pdt.c b/drivers/of/pdt.c
index 4d87b5dc9284..bc5b3990f6ed 100644
--- a/drivers/of/pdt.c
+++ b/drivers/of/pdt.c
@@ -229,6 +229,11 @@ static struct device_node * __init of_pdt_build_tree(struct device_node *parent,
229 return ret; 229 return ret;
230} 230}
231 231
232static void *kernel_tree_alloc(u64 size, u64 align)
233{
234 return prom_early_alloc(size);
235}
236
232void __init of_pdt_build_devicetree(phandle root_node, struct of_pdt_ops *ops) 237void __init of_pdt_build_devicetree(phandle root_node, struct of_pdt_ops *ops)
233{ 238{
234 struct device_node **nextp; 239 struct device_node **nextp;
@@ -245,4 +250,7 @@ void __init of_pdt_build_devicetree(phandle root_node, struct of_pdt_ops *ops)
245 nextp = &allnodes->allnext; 250 nextp = &allnodes->allnext;
246 allnodes->child = of_pdt_build_tree(allnodes, 251 allnodes->child = of_pdt_build_tree(allnodes,
247 of_pdt_prom_ops->getchild(allnodes->phandle), &nextp); 252 of_pdt_prom_ops->getchild(allnodes->phandle), &nextp);
253
254 /* Get pointer to "/chosen" and "/aliasas" nodes for use everywhere */
255 of_alias_scan(kernel_tree_alloc);
248} 256}
diff --git a/drivers/tty/serial/altera_jtaguart.c b/drivers/tty/serial/altera_jtaguart.c
index 00a73ecb2dfb..530181e49f6b 100644
--- a/drivers/tty/serial/altera_jtaguart.c
+++ b/drivers/tty/serial/altera_jtaguart.c
@@ -18,6 +18,7 @@
18#include <linux/interrupt.h> 18#include <linux/interrupt.h>
19#include <linux/module.h> 19#include <linux/module.h>
20#include <linux/console.h> 20#include <linux/console.h>
21#include <linux/of.h>
21#include <linux/tty.h> 22#include <linux/tty.h>
22#include <linux/tty_flip.h> 23#include <linux/tty_flip.h>
23#include <linux/serial.h> 24#include <linux/serial.h>
@@ -472,8 +473,6 @@ static struct of_device_id altera_jtaguart_match[] = {
472 {}, 473 {},
473}; 474};
474MODULE_DEVICE_TABLE(of, altera_jtaguart_match); 475MODULE_DEVICE_TABLE(of, altera_jtaguart_match);
475#else
476#define altera_jtaguart_match NULL
477#endif /* CONFIG_OF */ 476#endif /* CONFIG_OF */
478 477
479static struct platform_driver altera_jtaguart_platform_driver = { 478static struct platform_driver altera_jtaguart_platform_driver = {
@@ -482,7 +481,7 @@ static struct platform_driver altera_jtaguart_platform_driver = {
482 .driver = { 481 .driver = {
483 .name = DRV_NAME, 482 .name = DRV_NAME,
484 .owner = THIS_MODULE, 483 .owner = THIS_MODULE,
485 .of_match_table = altera_jtaguart_match, 484 .of_match_table = of_match_ptr(altera_jtaguart_match),
486 }, 485 },
487}; 486};
488 487
diff --git a/drivers/tty/serial/altera_uart.c b/drivers/tty/serial/altera_uart.c
index d902558ccfd2..1d04c5037f25 100644
--- a/drivers/tty/serial/altera_uart.c
+++ b/drivers/tty/serial/altera_uart.c
@@ -616,8 +616,6 @@ static struct of_device_id altera_uart_match[] = {
616 {}, 616 {},
617}; 617};
618MODULE_DEVICE_TABLE(of, altera_uart_match); 618MODULE_DEVICE_TABLE(of, altera_uart_match);
619#else
620#define altera_uart_match NULL
621#endif /* CONFIG_OF */ 619#endif /* CONFIG_OF */
622 620
623static struct platform_driver altera_uart_platform_driver = { 621static struct platform_driver altera_uart_platform_driver = {
@@ -626,7 +624,7 @@ static struct platform_driver altera_uart_platform_driver = {
626 .driver = { 624 .driver = {
627 .name = DRV_NAME, 625 .name = DRV_NAME,
628 .owner = THIS_MODULE, 626 .owner = THIS_MODULE,
629 .of_match_table = altera_uart_match, 627 .of_match_table = of_match_ptr(altera_uart_match),
630 }, 628 },
631}; 629};
632 630
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 54ffdc6243f9..163fc9021f5a 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -1290,17 +1290,20 @@ static int serial_imx_resume(struct platform_device *dev)
1290static int serial_imx_probe_dt(struct imx_port *sport, 1290static int serial_imx_probe_dt(struct imx_port *sport,
1291 struct platform_device *pdev) 1291 struct platform_device *pdev)
1292{ 1292{
1293 static int portnum = 0;
1294 struct device_node *np = pdev->dev.of_node; 1293 struct device_node *np = pdev->dev.of_node;
1295 const struct of_device_id *of_id = 1294 const struct of_device_id *of_id =
1296 of_match_device(imx_uart_dt_ids, &pdev->dev); 1295 of_match_device(imx_uart_dt_ids, &pdev->dev);
1296 int ret;
1297 1297
1298 if (!np) 1298 if (!np)
1299 return -ENODEV; 1299 return -ENODEV;
1300 1300
1301 sport->port.line = portnum++; 1301 ret = of_alias_get_id(np, "serial");
1302 if (sport->port.line >= UART_NR) 1302 if (ret < 0) {
1303 return -EINVAL; 1303 dev_err(&pdev->dev, "failed to get alias id, errno %d\n", ret);
1304 return -ENODEV;
1305 }
1306 sport->port.line = ret;
1304 1307
1305 if (of_get_property(np, "fsl,uart-has-rtscts", NULL)) 1308 if (of_get_property(np, "fsl,uart-has-rtscts", NULL))
1306 sport->have_rtscts = 1; 1309 sport->have_rtscts = 1;
diff --git a/drivers/tty/serial/uartlite.c b/drivers/tty/serial/uartlite.c
index b908615ccaaf..6cd414341d5e 100644
--- a/drivers/tty/serial/uartlite.c
+++ b/drivers/tty/serial/uartlite.c
@@ -569,8 +569,6 @@ static struct of_device_id ulite_of_match[] __devinitdata = {
569 {} 569 {}
570}; 570};
571MODULE_DEVICE_TABLE(of, ulite_of_match); 571MODULE_DEVICE_TABLE(of, ulite_of_match);
572#else /* CONFIG_OF */
573#define ulite_of_match NULL
574#endif /* CONFIG_OF */ 572#endif /* CONFIG_OF */
575 573
576static int __devinit ulite_probe(struct platform_device *pdev) 574static int __devinit ulite_probe(struct platform_device *pdev)
@@ -610,7 +608,7 @@ static struct platform_driver ulite_platform_driver = {
610 .driver = { 608 .driver = {
611 .owner = THIS_MODULE, 609 .owner = THIS_MODULE,
612 .name = "uartlite", 610 .name = "uartlite",
613 .of_match_table = ulite_of_match, 611 .of_match_table = of_match_ptr(ulite_of_match),
614 }, 612 },
615}; 613};
616 614
diff --git a/include/linux/of.h b/include/linux/of.h
index 9180dc5cb00b..92c40a142243 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -68,6 +68,7 @@ struct device_node {
68/* Pointer for first entry in chain of all nodes. */ 68/* Pointer for first entry in chain of all nodes. */
69extern struct device_node *allnodes; 69extern struct device_node *allnodes;
70extern struct device_node *of_chosen; 70extern struct device_node *of_chosen;
71extern struct device_node *of_aliases;
71extern rwlock_t devtree_lock; 72extern rwlock_t devtree_lock;
72 73
73static inline bool of_have_populated_dt(void) 74static inline bool of_have_populated_dt(void)
@@ -199,6 +200,8 @@ extern int of_property_read_u32_array(const struct device_node *np,
199 const char *propname, 200 const char *propname,
200 u32 *out_values, 201 u32 *out_values,
201 size_t sz); 202 size_t sz);
203extern int of_property_read_u64(const struct device_node *np,
204 const char *propname, u64 *out_value);
202 205
203extern int of_property_read_string(struct device_node *np, 206extern int of_property_read_string(struct device_node *np,
204 const char *propname, 207 const char *propname,
@@ -209,6 +212,9 @@ extern int of_device_is_available(const struct device_node *device);
209extern const void *of_get_property(const struct device_node *node, 212extern const void *of_get_property(const struct device_node *node,
210 const char *name, 213 const char *name,
211 int *lenp); 214 int *lenp);
215#define for_each_property(pp, properties) \
216 for (pp = properties; pp != NULL; pp = pp->next)
217
212extern int of_n_addr_cells(struct device_node *np); 218extern int of_n_addr_cells(struct device_node *np);
213extern int of_n_size_cells(struct device_node *np); 219extern int of_n_size_cells(struct device_node *np);
214extern const struct of_device_id *of_match_node( 220extern const struct of_device_id *of_match_node(
@@ -221,6 +227,9 @@ extern int of_parse_phandles_with_args(struct device_node *np,
221 const char *list_name, const char *cells_name, int index, 227 const char *list_name, const char *cells_name, int index,
222 struct device_node **out_node, const void **out_args); 228 struct device_node **out_node, const void **out_args);
223 229
230extern void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align));
231extern int of_alias_get_id(struct device_node *np, const char *stem);
232
224extern int of_machine_is_compatible(const char *compat); 233extern int of_machine_is_compatible(const char *compat);
225 234
226extern int prom_add_property(struct device_node* np, struct property* prop); 235extern int prom_add_property(struct device_node* np, struct property* prop);
@@ -235,6 +244,7 @@ extern void of_attach_node(struct device_node *);
235extern void of_detach_node(struct device_node *); 244extern void of_detach_node(struct device_node *);
236#endif 245#endif
237 246
247#define of_match_ptr(_ptr) (_ptr)
238#else /* CONFIG_OF */ 248#else /* CONFIG_OF */
239 249
240static inline bool of_have_populated_dt(void) 250static inline bool of_have_populated_dt(void)
@@ -242,6 +252,22 @@ static inline bool of_have_populated_dt(void)
242 return false; 252 return false;
243} 253}
244 254
255#define for_each_child_of_node(parent, child) \
256 while (0)
257
258static inline int of_device_is_compatible(const struct device_node *device,
259 const char *name)
260{
261 return 0;
262}
263
264static inline struct property *of_find_property(const struct device_node *np,
265 const char *name,
266 int *lenp)
267{
268 return NULL;
269}
270
245static inline int of_property_read_u32_array(const struct device_node *np, 271static inline int of_property_read_u32_array(const struct device_node *np,
246 const char *propname, 272 const char *propname,
247 u32 *out_values, size_t sz) 273 u32 *out_values, size_t sz)
@@ -263,6 +289,21 @@ static inline const void *of_get_property(const struct device_node *node,
263 return NULL; 289 return NULL;
264} 290}
265 291
292static inline int of_property_read_u64(const struct device_node *np,
293 const char *propname, u64 *out_value)
294{
295 return -ENOSYS;
296}
297
298static inline struct device_node *of_parse_phandle(struct device_node *np,
299 const char *phandle_name,
300 int index)
301{
302 return NULL;
303}
304
305#define of_match_ptr(_ptr) NULL
306#define of_match_node(_matches, _node) NULL
266#endif /* CONFIG_OF */ 307#endif /* CONFIG_OF */
267 308
268static inline int of_property_read_u32(const struct device_node *np, 309static inline int of_property_read_u32(const struct device_node *np,