aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorStephen Rothwell <sfr@canb.auug.org.au>2007-05-01 02:26:07 -0400
committerStephen Rothwell <sfr@canb.auug.org.au>2007-07-19 23:28:41 -0400
commit97e873e5c8ad8711ce4cca080cff4eb5d21b3aeb (patch)
tree7736415a2086522a083392f9ead34dac76c9560c /arch
parent76c1ce7870fd9b05431da1bbd47fdafcc029a25b (diff)
Start split out of common open firmware code
This creates drivers/of/base.c (depending on CONFIG_OF) and puts the first trivially common bits from the prom.c files into it. Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> Acked-by: Paul Mackerras <paulus@samba.org> Acked-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/Kconfig3
-rw-r--r--arch/powerpc/kernel/prom.c41
-rw-r--r--arch/sparc/Kconfig3
-rw-r--r--arch/sparc/kernel/prom.c42
-rw-r--r--arch/sparc64/Kconfig3
-rw-r--r--arch/sparc64/kernel/prom.c42
6 files changed, 9 insertions, 125 deletions
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index d860b640a140..853c282da22e 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -92,6 +92,9 @@ config ARCH_MAY_HAVE_PC_FDC
92config PPC_OF 92config PPC_OF
93 def_bool y 93 def_bool y
94 94
95config OF
96 def_bool y
97
95config PPC_UDBG_16550 98config PPC_UDBG_16550
96 bool 99 bool
97 default n 100 default n
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 37ff99bd98b4..6c9419a4d70a 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -1056,35 +1056,6 @@ void __init early_init_devtree(void *params)
1056 DBG(" <- early_init_devtree()\n"); 1056 DBG(" <- early_init_devtree()\n");
1057} 1057}
1058 1058
1059int of_n_addr_cells(struct device_node* np)
1060{
1061 const int *ip;
1062 do {
1063 if (np->parent)
1064 np = np->parent;
1065 ip = of_get_property(np, "#address-cells", NULL);
1066 if (ip != NULL)
1067 return *ip;
1068 } while (np->parent);
1069 /* No #address-cells property for the root node, default to 1 */
1070 return 1;
1071}
1072EXPORT_SYMBOL(of_n_addr_cells);
1073
1074int of_n_size_cells(struct device_node* np)
1075{
1076 const int* ip;
1077 do {
1078 if (np->parent)
1079 np = np->parent;
1080 ip = of_get_property(np, "#size-cells", NULL);
1081 if (ip != NULL)
1082 return *ip;
1083 } while (np->parent);
1084 /* No #size-cells property for the root node, default to 1 */
1085 return 1;
1086}
1087EXPORT_SYMBOL(of_n_size_cells);
1088 1059
1089/** Checks if the given "compat" string matches one of the strings in 1060/** Checks if the given "compat" string matches one of the strings in
1090 * the device's "compatible" property 1061 * the device's "compatible" property
@@ -1563,18 +1534,6 @@ struct property *of_find_property(const struct device_node *np,
1563EXPORT_SYMBOL(of_find_property); 1534EXPORT_SYMBOL(of_find_property);
1564 1535
1565/* 1536/*
1566 * Find a property with a given name for a given node
1567 * and return the value.
1568 */
1569const void *of_get_property(const struct device_node *np, const char *name,
1570 int *lenp)
1571{
1572 struct property *pp = of_find_property(np,name,lenp);
1573 return pp ? pp->value : NULL;
1574}
1575EXPORT_SYMBOL(of_get_property);
1576
1577/*
1578 * Add a property to a node 1537 * Add a property to a node
1579 */ 1538 */
1580int prom_add_property(struct device_node* np, struct property* prop) 1539int prom_add_property(struct device_node* np, struct property* prop)
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index 603d83ad65c8..9d327ec59759 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -24,6 +24,9 @@ config GENERIC_ISA_DMA
24config ARCH_NO_VIRT_TO_BUS 24config ARCH_NO_VIRT_TO_BUS
25 def_bool y 25 def_bool y
26 26
27config OF
28 def_bool y
29
27source "init/Kconfig" 30source "init/Kconfig"
28 31
29menu "General machine setup" 32menu "General machine setup"
diff --git a/arch/sparc/kernel/prom.c b/arch/sparc/kernel/prom.c
index eed140b3c739..ac3f3c29b174 100644
--- a/arch/sparc/kernel/prom.c
+++ b/arch/sparc/kernel/prom.c
@@ -168,18 +168,6 @@ struct property *of_find_property(const struct device_node *np,
168} 168}
169EXPORT_SYMBOL(of_find_property); 169EXPORT_SYMBOL(of_find_property);
170 170
171/*
172 * Find a property with a given name for a given node
173 * and return the value.
174 */
175const void *of_get_property(const struct device_node *np, const char *name,
176 int *lenp)
177{
178 struct property *pp = of_find_property(np,name,lenp);
179 return pp ? pp->value : NULL;
180}
181EXPORT_SYMBOL(of_get_property);
182
183int of_getintprop_default(struct device_node *np, const char *name, int def) 171int of_getintprop_default(struct device_node *np, const char *name, int def)
184{ 172{
185 struct property *prop; 173 struct property *prop;
@@ -193,36 +181,6 @@ int of_getintprop_default(struct device_node *np, const char *name, int def)
193} 181}
194EXPORT_SYMBOL(of_getintprop_default); 182EXPORT_SYMBOL(of_getintprop_default);
195 183
196int of_n_addr_cells(struct device_node *np)
197{
198 const int* ip;
199 do {
200 if (np->parent)
201 np = np->parent;
202 ip = of_get_property(np, "#address-cells", NULL);
203 if (ip != NULL)
204 return *ip;
205 } while (np->parent);
206 /* No #address-cells property for the root node, default to 2 */
207 return 2;
208}
209EXPORT_SYMBOL(of_n_addr_cells);
210
211int of_n_size_cells(struct device_node *np)
212{
213 const int* ip;
214 do {
215 if (np->parent)
216 np = np->parent;
217 ip = of_get_property(np, "#size-cells", NULL);
218 if (ip != NULL)
219 return *ip;
220 } while (np->parent);
221 /* No #size-cells property for the root node, default to 1 */
222 return 1;
223}
224EXPORT_SYMBOL(of_n_size_cells);
225
226int of_set_property(struct device_node *dp, const char *name, void *val, int len) 184int of_set_property(struct device_node *dp, const char *name, void *val, int len)
227{ 185{
228 struct property **prevp; 186 struct property **prevp;
diff --git a/arch/sparc64/Kconfig b/arch/sparc64/Kconfig
index df6ee71894d1..f1cc55677ff2 100644
--- a/arch/sparc64/Kconfig
+++ b/arch/sparc64/Kconfig
@@ -65,6 +65,9 @@ config AUDIT_ARCH
65config ARCH_NO_VIRT_TO_BUS 65config ARCH_NO_VIRT_TO_BUS
66 def_bool y 66 def_bool y
67 67
68config OF
69 def_bool y
70
68choice 71choice
69 prompt "Kernel page size" 72 prompt "Kernel page size"
70 default SPARC64_PAGE_SIZE_8KB 73 default SPARC64_PAGE_SIZE_8KB
diff --git a/arch/sparc64/kernel/prom.c b/arch/sparc64/kernel/prom.c
index 5d220302cd50..8f926d439c0f 100644
--- a/arch/sparc64/kernel/prom.c
+++ b/arch/sparc64/kernel/prom.c
@@ -173,18 +173,6 @@ struct property *of_find_property(const struct device_node *np,
173} 173}
174EXPORT_SYMBOL(of_find_property); 174EXPORT_SYMBOL(of_find_property);
175 175
176/*
177 * Find a property with a given name for a given node
178 * and return the value.
179 */
180const void *of_get_property(const struct device_node *np, const char *name,
181 int *lenp)
182{
183 struct property *pp = of_find_property(np,name,lenp);
184 return pp ? pp->value : NULL;
185}
186EXPORT_SYMBOL(of_get_property);
187
188int of_getintprop_default(struct device_node *np, const char *name, int def) 176int of_getintprop_default(struct device_node *np, const char *name, int def)
189{ 177{
190 struct property *prop; 178 struct property *prop;
@@ -198,36 +186,6 @@ int of_getintprop_default(struct device_node *np, const char *name, int def)
198} 186}
199EXPORT_SYMBOL(of_getintprop_default); 187EXPORT_SYMBOL(of_getintprop_default);
200 188
201int of_n_addr_cells(struct device_node *np)
202{
203 const int* ip;
204 do {
205 if (np->parent)
206 np = np->parent;
207 ip = of_get_property(np, "#address-cells", NULL);
208 if (ip != NULL)
209 return *ip;
210 } while (np->parent);
211 /* No #address-cells property for the root node, default to 2 */
212 return 2;
213}
214EXPORT_SYMBOL(of_n_addr_cells);
215
216int of_n_size_cells(struct device_node *np)
217{
218 const int* ip;
219 do {
220 if (np->parent)
221 np = np->parent;
222 ip = of_get_property(np, "#size-cells", NULL);
223 if (ip != NULL)
224 return *ip;
225 } while (np->parent);
226 /* No #size-cells property for the root node, default to 1 */
227 return 1;
228}
229EXPORT_SYMBOL(of_n_size_cells);
230
231int of_set_property(struct device_node *dp, const char *name, void *val, int len) 189int of_set_property(struct device_node *dp, const char *name, void *val, int len)
232{ 190{
233 struct property **prevp; 191 struct property **prevp;