blob: 8fdc1b3113b9ec23093a10ffc115bc9fd66b09b3 [file] [log] [blame]
David S. Millerfd531432006-06-23 15:55:17 -07001#include <linux/string.h>
2#include <linux/kernel.h>
Stephen Rothwellf85ff302007-05-01 16:40:36 +10003#include <linux/of.h>
David S. Millerfd531432006-06-23 15:55:17 -07004#include <linux/init.h>
5#include <linux/module.h>
6#include <linux/mod_devicetable.h>
7#include <linux/slab.h>
Stephen Rothwell3f23de12007-05-03 02:38:57 +10008#include <linux/errno.h>
9#include <linux/of_device.h>
10#include <linux/of_platform.h>
David S. Millerfd531432006-06-23 15:55:17 -070011
David S. Miller8f96cd12006-06-29 15:08:02 -070012static int node_match(struct device *dev, void *data)
13{
14 struct of_device *op = to_of_device(dev);
15 struct device_node *dp = data;
16
17 return (op->node == dp);
18}
19
20struct of_device *of_find_device_by_node(struct device_node *dp)
21{
Stephen Rothwell37b77542007-04-30 17:43:56 +100022 struct device *dev = bus_find_device(&of_platform_bus_type, NULL,
David S. Miller8f96cd12006-06-29 15:08:02 -070023 dp, node_match);
24
25 if (dev)
26 return to_of_device(dev);
27
28 return NULL;
29}
30EXPORT_SYMBOL(of_find_device_by_node);
31
David S. Miller51e0f002008-08-25 16:44:58 -070032unsigned int irq_of_parse_and_map(struct device_node *node, int index)
David S. Miller44266212008-08-20 16:34:39 -070033{
34 struct of_device *op = of_find_device_by_node(node);
35
36 if (!op || index >= op->num_irqs)
David S. Miller51e0f002008-08-25 16:44:58 -070037 return 0;
David S. Miller44266212008-08-20 16:34:39 -070038
39 return op->irqs[index];
40}
41EXPORT_SYMBOL(irq_of_parse_and_map);
42
David S. Miller50596252008-08-27 04:22:37 -070043/* Take the archdata values for IOMMU, STC, and HOSTDATA found in
44 * BUS and propagate to all child of_device objects.
45 */
46void of_propagate_archdata(struct of_device *bus)
47{
48 struct dev_archdata *bus_sd = &bus->dev.archdata;
49 struct device_node *bus_dp = bus->node;
50 struct device_node *dp;
51
52 for (dp = bus_dp->child; dp; dp = dp->sibling) {
53 struct of_device *op = of_find_device_by_node(dp);
54
55 op->dev.archdata.iommu = bus_sd->iommu;
56 op->dev.archdata.stc = bus_sd->stc;
57 op->dev.archdata.host_controller = bus_sd->host_controller;
58 op->dev.archdata.numa_node = bus_sd->numa_node;
59
60 if (dp->child)
61 of_propagate_archdata(op);
62 }
63}
64
David S. Millerfd531432006-06-23 15:55:17 -070065#ifdef CONFIG_PCI
Stephen Rothwell3f23de12007-05-03 02:38:57 +100066struct bus_type ebus_bus_type;
David S. Miller69853912006-06-25 01:21:38 -070067EXPORT_SYMBOL(ebus_bus_type);
David S. Millerfd531432006-06-23 15:55:17 -070068#endif
69
70#ifdef CONFIG_SBUS
Stephen Rothwell3f23de12007-05-03 02:38:57 +100071struct bus_type sbus_bus_type;
David S. Miller69853912006-06-25 01:21:38 -070072EXPORT_SYMBOL(sbus_bus_type);
David S. Millerfd531432006-06-23 15:55:17 -070073#endif
74
Stephen Rothwell3f23de12007-05-03 02:38:57 +100075struct bus_type of_platform_bus_type;
Stephen Rothwell37b77542007-04-30 17:43:56 +100076EXPORT_SYMBOL(of_platform_bus_type);
David S. Millercf44bbc2006-06-29 14:34:50 -070077
David S. Millera83f9822006-07-12 23:19:31 -070078static inline u64 of_read_addr(const u32 *cell, int size)
David S. Millercf44bbc2006-06-29 14:34:50 -070079{
80 u64 r = 0;
81 while (size--)
82 r = (r << 32) | *(cell++);
83 return r;
84}
85
86static void __init get_cells(struct device_node *dp,
87 int *addrc, int *sizec)
88{
89 if (addrc)
90 *addrc = of_n_addr_cells(dp);
91 if (sizec)
92 *sizec = of_n_size_cells(dp);
93}
94
95/* Max address size we deal with */
96#define OF_MAX_ADDR_CELLS 4
97
98struct of_bus {
99 const char *name;
100 const char *addr_prop_name;
101 int (*match)(struct device_node *parent);
102 void (*count_cells)(struct device_node *child,
103 int *addrc, int *sizec);
David S. Millera83f9822006-07-12 23:19:31 -0700104 int (*map)(u32 *addr, const u32 *range,
105 int na, int ns, int pna);
Stephen Rothwell8271f042007-03-29 00:47:23 -0700106 unsigned int (*get_flags)(const u32 *addr);
David S. Millercf44bbc2006-06-29 14:34:50 -0700107};
108
109/*
110 * Default translator (generic bus)
111 */
112
113static void of_bus_default_count_cells(struct device_node *dev,
114 int *addrc, int *sizec)
115{
116 get_cells(dev, addrc, sizec);
117}
118
David S. Millera83f9822006-07-12 23:19:31 -0700119/* Make sure the least significant 64-bits are in-range. Even
120 * for 3 or 4 cell values it is a good enough approximation.
121 */
122static int of_out_of_range(const u32 *addr, const u32 *base,
123 const u32 *size, int na, int ns)
David S. Millercf44bbc2006-06-29 14:34:50 -0700124{
125 u64 a = of_read_addr(addr, na);
David S. Millera83f9822006-07-12 23:19:31 -0700126 u64 b = of_read_addr(base, na);
127
128 if (a < b)
129 return 1;
130
131 b += of_read_addr(size, ns);
132 if (a >= b)
133 return 1;
134
135 return 0;
136}
137
138static int of_bus_default_map(u32 *addr, const u32 *range,
139 int na, int ns, int pna)
140{
141 u32 result[OF_MAX_ADDR_CELLS];
142 int i;
143
144 if (ns > 2) {
145 printk("of_device: Cannot handle size cells (%d) > 2.", ns);
146 return -EINVAL;
147 }
148
149 if (of_out_of_range(addr, range, range + na + pna, na, ns))
150 return -EINVAL;
151
152 /* Start with the parent range base. */
153 memcpy(result, range + na, pna * 4);
154
155 /* Add in the child address offset. */
156 for (i = 0; i < na; i++)
157 result[pna - 1 - i] +=
158 (addr[na - 1 - i] -
159 range[na - 1 - i]);
160
161 memcpy(addr, result, pna * 4);
David S. Millercf44bbc2006-06-29 14:34:50 -0700162
163 return 0;
164}
165
Stephen Rothwell8271f042007-03-29 00:47:23 -0700166static unsigned int of_bus_default_get_flags(const u32 *addr)
David S. Millercf44bbc2006-06-29 14:34:50 -0700167{
168 return IORESOURCE_MEM;
169}
170
David S. Millercf44bbc2006-06-29 14:34:50 -0700171/*
172 * PCI bus specific translator
173 */
174
175static int of_bus_pci_match(struct device_node *np)
176{
David S. Millera83f9822006-07-12 23:19:31 -0700177 if (!strcmp(np->type, "pci") || !strcmp(np->type, "pciex")) {
178 /* Do not do PCI specific frobbing if the
179 * PCI bridge lacks a ranges property. We
180 * want to pass it through up to the next
181 * parent as-is, not with the PCI translate
182 * method which chops off the top address cell.
183 */
184 if (!of_find_property(np, "ranges", NULL))
185 return 0;
186
187 return 1;
188 }
189
190 return 0;
David S. Millercf44bbc2006-06-29 14:34:50 -0700191}
192
193static void of_bus_pci_count_cells(struct device_node *np,
194 int *addrc, int *sizec)
195{
196 if (addrc)
197 *addrc = 3;
198 if (sizec)
199 *sizec = 2;
200}
201
David S. Millera83f9822006-07-12 23:19:31 -0700202static int of_bus_pci_map(u32 *addr, const u32 *range,
203 int na, int ns, int pna)
David S. Millercf44bbc2006-06-29 14:34:50 -0700204{
David S. Millera83f9822006-07-12 23:19:31 -0700205 u32 result[OF_MAX_ADDR_CELLS];
206 int i;
David S. Millercf44bbc2006-06-29 14:34:50 -0700207
208 /* Check address type match */
209 if ((addr[0] ^ range[0]) & 0x03000000)
David S. Millera83f9822006-07-12 23:19:31 -0700210 return -EINVAL;
David S. Millercf44bbc2006-06-29 14:34:50 -0700211
David S. Millera83f9822006-07-12 23:19:31 -0700212 if (of_out_of_range(addr + 1, range + 1, range + na + pna,
213 na - 1, ns))
214 return -EINVAL;
David S. Millercf44bbc2006-06-29 14:34:50 -0700215
David S. Millera83f9822006-07-12 23:19:31 -0700216 /* Start with the parent range base. */
217 memcpy(result, range + na, pna * 4);
David S. Millercf44bbc2006-06-29 14:34:50 -0700218
David S. Millera83f9822006-07-12 23:19:31 -0700219 /* Add in the child address offset, skipping high cell. */
220 for (i = 0; i < na - 1; i++)
221 result[pna - 1 - i] +=
222 (addr[na - 1 - i] -
223 range[na - 1 - i]);
224
225 memcpy(addr, result, pna * 4);
226
227 return 0;
David S. Millercf44bbc2006-06-29 14:34:50 -0700228}
229
Stephen Rothwell8271f042007-03-29 00:47:23 -0700230static unsigned int of_bus_pci_get_flags(const u32 *addr)
David S. Millercf44bbc2006-06-29 14:34:50 -0700231{
232 unsigned int flags = 0;
233 u32 w = addr[0];
234
235 switch((w >> 24) & 0x03) {
236 case 0x01:
237 flags |= IORESOURCE_IO;
238 case 0x02: /* 32 bits */
239 case 0x03: /* 64 bits */
240 flags |= IORESOURCE_MEM;
241 }
242 if (w & 0x40000000)
243 flags |= IORESOURCE_PREFETCH;
244 return flags;
245}
246
247/*
248 * SBUS bus specific translator
249 */
250
251static int of_bus_sbus_match(struct device_node *np)
252{
253 return !strcmp(np->name, "sbus") ||
254 !strcmp(np->name, "sbi");
255}
256
257static void of_bus_sbus_count_cells(struct device_node *child,
258 int *addrc, int *sizec)
259{
260 if (addrc)
261 *addrc = 2;
262 if (sizec)
263 *sizec = 1;
264}
265
David S. Millera83f9822006-07-12 23:19:31 -0700266static int of_bus_sbus_map(u32 *addr, const u32 *range, int na, int ns, int pna)
David S. Millercf44bbc2006-06-29 14:34:50 -0700267{
268 return of_bus_default_map(addr, range, na, ns, pna);
269}
270
Stephen Rothwell8271f042007-03-29 00:47:23 -0700271static unsigned int of_bus_sbus_get_flags(const u32 *addr)
David S. Millercf44bbc2006-06-29 14:34:50 -0700272{
273 return IORESOURCE_MEM;
274}
275
276
277/*
278 * Array of bus specific translators
279 */
280
281static struct of_bus of_busses[] = {
282 /* PCI */
283 {
284 .name = "pci",
285 .addr_prop_name = "assigned-addresses",
286 .match = of_bus_pci_match,
287 .count_cells = of_bus_pci_count_cells,
288 .map = of_bus_pci_map,
David S. Millercf44bbc2006-06-29 14:34:50 -0700289 .get_flags = of_bus_pci_get_flags,
290 },
291 /* SBUS */
292 {
293 .name = "sbus",
294 .addr_prop_name = "reg",
295 .match = of_bus_sbus_match,
296 .count_cells = of_bus_sbus_count_cells,
297 .map = of_bus_sbus_map,
David S. Millercf44bbc2006-06-29 14:34:50 -0700298 .get_flags = of_bus_sbus_get_flags,
299 },
300 /* Default */
301 {
302 .name = "default",
303 .addr_prop_name = "reg",
304 .match = NULL,
305 .count_cells = of_bus_default_count_cells,
306 .map = of_bus_default_map,
David S. Millercf44bbc2006-06-29 14:34:50 -0700307 .get_flags = of_bus_default_get_flags,
308 },
309};
310
311static struct of_bus *of_match_bus(struct device_node *np)
312{
313 int i;
314
315 for (i = 0; i < ARRAY_SIZE(of_busses); i ++)
316 if (!of_busses[i].match || of_busses[i].match(np))
317 return &of_busses[i];
318 BUG();
319 return NULL;
320}
321
322static int __init build_one_resource(struct device_node *parent,
323 struct of_bus *bus,
324 struct of_bus *pbus,
325 u32 *addr,
326 int na, int ns, int pna)
327{
Stephen Rothwell8271f042007-03-29 00:47:23 -0700328 const u32 *ranges;
David S. Millercf44bbc2006-06-29 14:34:50 -0700329 unsigned int rlen;
330 int rone;
David S. Millercf44bbc2006-06-29 14:34:50 -0700331
332 ranges = of_get_property(parent, "ranges", &rlen);
333 if (ranges == NULL || rlen == 0) {
David S. Millera83f9822006-07-12 23:19:31 -0700334 u32 result[OF_MAX_ADDR_CELLS];
335 int i;
336
337 memset(result, 0, pna * 4);
338 for (i = 0; i < na; i++)
339 result[pna - 1 - i] =
340 addr[na - 1 - i];
341
342 memcpy(addr, result, pna * 4);
343 return 0;
David S. Millercf44bbc2006-06-29 14:34:50 -0700344 }
345
346 /* Now walk through the ranges */
347 rlen /= 4;
348 rone = na + pna + ns;
349 for (; rlen >= rone; rlen -= rone, ranges += rone) {
David S. Millera83f9822006-07-12 23:19:31 -0700350 if (!bus->map(addr, ranges, na, ns, pna))
351 return 0;
David S. Millercf44bbc2006-06-29 14:34:50 -0700352 }
David S. Millercf44bbc2006-06-29 14:34:50 -0700353
David S. Millera83f9822006-07-12 23:19:31 -0700354 return 1;
David S. Millercf44bbc2006-06-29 14:34:50 -0700355}
356
David S. Millera83f9822006-07-12 23:19:31 -0700357static int of_resource_verbose;
358
David S. Millercf44bbc2006-06-29 14:34:50 -0700359static void __init build_device_resources(struct of_device *op,
360 struct device *parent)
361{
362 struct of_device *p_op;
363 struct of_bus *bus;
364 int na, ns;
365 int index, num_reg;
Stephen Rothwell8271f042007-03-29 00:47:23 -0700366 const void *preg;
David S. Millercf44bbc2006-06-29 14:34:50 -0700367
368 if (!parent)
369 return;
370
371 p_op = to_of_device(parent);
372 bus = of_match_bus(p_op->node);
373 bus->count_cells(op->node, &na, &ns);
374
375 preg = of_get_property(op->node, bus->addr_prop_name, &num_reg);
376 if (!preg || num_reg == 0)
377 return;
378
379 /* Convert to num-cells. */
380 num_reg /= 4;
381
382 /* Conver to num-entries. */
383 num_reg /= na + ns;
384
385 for (index = 0; index < num_reg; index++) {
386 struct resource *r = &op->resource[index];
387 u32 addr[OF_MAX_ADDR_CELLS];
Stephen Rothwell8271f042007-03-29 00:47:23 -0700388 const u32 *reg = (preg + (index * ((na + ns) * 4)));
David S. Millercf44bbc2006-06-29 14:34:50 -0700389 struct device_node *dp = op->node;
390 struct device_node *pp = p_op->node;
David S. Millerb85cdd42007-02-28 23:20:12 -0800391 struct of_bus *pbus, *dbus;
David S. Millercf44bbc2006-06-29 14:34:50 -0700392 u64 size, result = OF_BAD_ADDR;
393 unsigned long flags;
394 int dna, dns;
395 int pna, pns;
396
397 size = of_read_addr(reg + na, ns);
398 flags = bus->get_flags(reg);
399
400 memcpy(addr, reg, na * 4);
401
402 /* If the immediate parent has no ranges property to apply,
403 * just use a 1<->1 mapping.
404 */
405 if (of_find_property(pp, "ranges", NULL) == NULL) {
406 result = of_read_addr(addr, na);
407 goto build_res;
408 }
409
410 dna = na;
411 dns = ns;
David S. Millerb85cdd42007-02-28 23:20:12 -0800412 dbus = bus;
David S. Millercf44bbc2006-06-29 14:34:50 -0700413
414 while (1) {
415 dp = pp;
416 pp = dp->parent;
417 if (!pp) {
418 result = of_read_addr(addr, dna);
419 break;
420 }
421
422 pbus = of_match_bus(pp);
423 pbus->count_cells(dp, &pna, &pns);
424
David S. Millerb85cdd42007-02-28 23:20:12 -0800425 if (build_one_resource(dp, dbus, pbus, addr,
David S. Millera83f9822006-07-12 23:19:31 -0700426 dna, dns, pna))
David S. Millercf44bbc2006-06-29 14:34:50 -0700427 break;
428
429 dna = pna;
430 dns = pns;
David S. Millerb85cdd42007-02-28 23:20:12 -0800431 dbus = pbus;
David S. Millercf44bbc2006-06-29 14:34:50 -0700432 }
433
434 build_res:
435 memset(r, 0, sizeof(*r));
David S. Millera83f9822006-07-12 23:19:31 -0700436
437 if (of_resource_verbose)
438 printk("%s reg[%d] -> %llx\n",
439 op->node->full_name, index,
440 result);
441
David S. Millercf44bbc2006-06-29 14:34:50 -0700442 if (result != OF_BAD_ADDR) {
David S. Miller95714e12006-06-29 14:35:14 -0700443 r->start = result & 0xffffffff;
David S. Millercf44bbc2006-06-29 14:34:50 -0700444 r->end = result + size - 1;
David S. Miller95714e12006-06-29 14:35:14 -0700445 r->flags = flags | ((result >> 32ULL) & 0xffUL);
David S. Millercf44bbc2006-06-29 14:34:50 -0700446 }
447 r->name = op->node->name;
448 }
449}
450
451static struct of_device * __init scan_one_device(struct device_node *dp,
452 struct device *parent)
453{
454 struct of_device *op = kzalloc(sizeof(*op), GFP_KERNEL);
Stephen Rothwell8271f042007-03-29 00:47:23 -0700455 const struct linux_prom_irqs *intr;
David S. Miller3d6e4702007-07-18 22:03:25 -0700456 struct dev_archdata *sd;
David S. Miller8f96cd12006-06-29 15:08:02 -0700457 int len, i;
David S. Millercf44bbc2006-06-29 14:34:50 -0700458
459 if (!op)
460 return NULL;
461
David S. Miller3d6e4702007-07-18 22:03:25 -0700462 sd = &op->dev.archdata;
463 sd->prom_node = dp;
464 sd->op = op;
465
David S. Millercf44bbc2006-06-29 14:34:50 -0700466 op->node = dp;
467
468 op->clock_freq = of_getintprop_default(dp, "clock-frequency",
469 (25*1000*1000));
470 op->portid = of_getintprop_default(dp, "upa-portid", -1);
471 if (op->portid == -1)
472 op->portid = of_getintprop_default(dp, "portid", -1);
473
David S. Miller8f96cd12006-06-29 15:08:02 -0700474 intr = of_get_property(dp, "intr", &len);
475 if (intr) {
476 op->num_irqs = len / sizeof(struct linux_prom_irqs);
477 for (i = 0; i < op->num_irqs; i++)
478 op->irqs[i] = intr[i].pri;
479 } else {
Stephen Rothwell8271f042007-03-29 00:47:23 -0700480 const unsigned int *irq =
481 of_get_property(dp, "interrupts", &len);
David S. Miller8f96cd12006-06-29 15:08:02 -0700482
483 if (irq) {
484 op->num_irqs = len / sizeof(unsigned int);
485 for (i = 0; i < op->num_irqs; i++)
486 op->irqs[i] = irq[i];
487 } else {
488 op->num_irqs = 0;
489 }
490 }
491 if (sparc_cpu_model == sun4d) {
492 static int pil_to_sbus[] = {
493 0, 0, 1, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 0, 0,
494 };
David S. Miller9d7ab1f2006-07-17 21:39:09 -0700495 struct device_node *io_unit, *sbi = dp->parent;
Stephen Rothwell8271f042007-03-29 00:47:23 -0700496 const struct linux_prom_registers *regs;
David S. Miller9d7ab1f2006-07-17 21:39:09 -0700497 int board, slot;
498
499 while (sbi) {
500 if (!strcmp(sbi->name, "sbi"))
501 break;
502
503 sbi = sbi->parent;
504 }
505 if (!sbi)
506 goto build_resources;
David S. Miller8f96cd12006-06-29 15:08:02 -0700507
508 regs = of_get_property(dp, "reg", NULL);
David S. Miller9d7ab1f2006-07-17 21:39:09 -0700509 if (!regs)
510 goto build_resources;
511
David S. Miller8f96cd12006-06-29 15:08:02 -0700512 slot = regs->which_io;
513
David S. Miller9d7ab1f2006-07-17 21:39:09 -0700514 /* If SBI's parent is not io-unit or the io-unit lacks
515 * a "board#" property, something is very wrong.
516 */
517 if (!sbi->parent || strcmp(sbi->parent->name, "io-unit")) {
518 printk("%s: Error, parent is not io-unit.\n",
519 sbi->full_name);
520 goto build_resources;
521 }
522 io_unit = sbi->parent;
523 board = of_getintprop_default(io_unit, "board#", -1);
524 if (board == -1) {
525 printk("%s: Error, lacks board# property.\n",
526 io_unit->full_name);
527 goto build_resources;
528 }
529
David S. Miller8f96cd12006-06-29 15:08:02 -0700530 for (i = 0; i < op->num_irqs; i++) {
531 int this_irq = op->irqs[i];
532 int sbusl = pil_to_sbus[this_irq];
533
534 if (sbusl)
535 this_irq = (((board + 1) << 5) +
536 (sbusl << 2) +
537 slot);
538
539 op->irqs[i] = this_irq;
540 }
541 }
David S. Millercf44bbc2006-06-29 14:34:50 -0700542
David S. Miller9d7ab1f2006-07-17 21:39:09 -0700543build_resources:
David S. Millercf44bbc2006-06-29 14:34:50 -0700544 build_device_resources(op, parent);
545
546 op->dev.parent = parent;
Stephen Rothwell37b77542007-04-30 17:43:56 +1000547 op->dev.bus = &of_platform_bus_type;
David S. Millercf44bbc2006-06-29 14:34:50 -0700548 if (!parent)
549 strcpy(op->dev.bus_id, "root");
550 else
David S. Millerf5ef9d12006-10-27 01:03:31 -0700551 sprintf(op->dev.bus_id, "%08x", dp->node);
David S. Millercf44bbc2006-06-29 14:34:50 -0700552
553 if (of_device_register(op)) {
554 printk("%s: Could not register of device.\n",
555 dp->full_name);
556 kfree(op);
557 op = NULL;
558 }
559
560 return op;
561}
562
563static void __init scan_tree(struct device_node *dp, struct device *parent)
564{
565 while (dp) {
566 struct of_device *op = scan_one_device(dp, parent);
567
568 if (op)
569 scan_tree(dp->child, &op->dev);
570
571 dp = dp->sibling;
572 }
573}
574
575static void __init scan_of_devices(void)
576{
577 struct device_node *root = of_find_node_by_path("/");
578 struct of_device *parent;
579
580 parent = scan_one_device(root, NULL);
581 if (!parent)
582 return;
583
584 scan_tree(root->child, &parent->dev);
585}
586
David S. Millerfd531432006-06-23 15:55:17 -0700587static int __init of_bus_driver_init(void)
588{
David S. Millercf44bbc2006-06-29 14:34:50 -0700589 int err;
David S. Millerfd531432006-06-23 15:55:17 -0700590
Stephen Rothwell3f23de12007-05-03 02:38:57 +1000591 err = of_bus_type_init(&of_platform_bus_type, "of");
David S. Millerfd531432006-06-23 15:55:17 -0700592#ifdef CONFIG_PCI
593 if (!err)
Stephen Rothwell3f23de12007-05-03 02:38:57 +1000594 err = of_bus_type_init(&ebus_bus_type, "ebus");
David S. Millerfd531432006-06-23 15:55:17 -0700595#endif
596#ifdef CONFIG_SBUS
597 if (!err)
Stephen Rothwell3f23de12007-05-03 02:38:57 +1000598 err = of_bus_type_init(&sbus_bus_type, "sbus");
David S. Millerfd531432006-06-23 15:55:17 -0700599#endif
David S. Millercf44bbc2006-06-29 14:34:50 -0700600
601 if (!err)
602 scan_of_devices();
603
604 return err;
David S. Millerfd531432006-06-23 15:55:17 -0700605}
606
607postcore_initcall(of_bus_driver_init);
608
David S. Millera83f9822006-07-12 23:19:31 -0700609static int __init of_debug(char *str)
610{
611 int val = 0;
612
613 get_option(&str, &val);
614 if (val & 1)
615 of_resource_verbose = 1;
616 return 1;
617}
618
619__setup("of_debug=", of_debug);