aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-10-25 11:19:14 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-10-25 11:19:14 -0400
commit51f00a471ce8f359627dd99aeac322947a0e491b (patch)
treede3f0c26359d7846fc5d6d0fdd147e225d979add /arch/powerpc
parenta7f505c6b15fb35c0de8136e370d2927ce29452c (diff)
parent97ff46cb69da22037346670ae515217c658ace02 (diff)
Merge branch 'next-devicetree' of git://git.secretlab.ca/git/linux-2.6
* 'next-devicetree' of git://git.secretlab.ca/git/linux-2.6: mtd/m25p80: add support to parse the partitions by OF node of/irq: of_irq.c needs to include linux/irq.h of/mips: Cleanup some include directives/files. of/mips: Add device tree support to MIPS of/flattree: Eliminate need to provide early_init_dt_scan_chosen_arch of/device: Rework to use common platform_device_alloc() for allocating devices of/xsysace: Fix OF probing on little-endian systems of: use __be32 types for big-endian device tree data of/irq: remove references to NO_IRQ in drivers/of/platform.c of/promtree: add package-to-path support to pdt of/promtree: add of_pdt namespace to pdt code of/promtree: no longer call prom_ functions directly; use an ops structure of/promtree: make drivers/of/pdt.c no longer sparc-only sparc: break out some PROM device-tree building code out into drivers/of of/sparc: convert various prom_* functions to use phandle sparc: stop exporting openprom.h header powerpc, of_serial: Endianness issues setting up the serial ports of: MTD: Fix OF probing on little-endian systems of: GPIO: Fix OF probing on little-endian systems
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/kernel/ibmebus.c11
-rw-r--r--arch/powerpc/kernel/legacy_serial.c22
-rw-r--r--arch/powerpc/kernel/prom.c12
3 files changed, 25 insertions, 20 deletions
diff --git a/arch/powerpc/kernel/ibmebus.c b/arch/powerpc/kernel/ibmebus.c
index 9b626cfffce1..f62efdfd1769 100644
--- a/arch/powerpc/kernel/ibmebus.c
+++ b/arch/powerpc/kernel/ibmebus.c
@@ -162,13 +162,10 @@ static int ibmebus_create_device(struct device_node *dn)
162 dev->dev.bus = &ibmebus_bus_type; 162 dev->dev.bus = &ibmebus_bus_type;
163 dev->dev.archdata.dma_ops = &ibmebus_dma_ops; 163 dev->dev.archdata.dma_ops = &ibmebus_dma_ops;
164 164
165 ret = of_device_register(dev); 165 ret = of_device_add(dev);
166 if (ret) { 166 if (ret)
167 of_device_free(dev); 167 platform_device_put(dev);
168 return ret; 168 return ret;
169 }
170
171 return 0;
172} 169}
173 170
174static int ibmebus_create_devices(const struct of_device_id *matches) 171static int ibmebus_create_devices(const struct of_device_id *matches)
diff --git a/arch/powerpc/kernel/legacy_serial.c b/arch/powerpc/kernel/legacy_serial.c
index c1fd0f9658fd..c834757bebc0 100644
--- a/arch/powerpc/kernel/legacy_serial.c
+++ b/arch/powerpc/kernel/legacy_serial.c
@@ -52,14 +52,14 @@ static int __init add_legacy_port(struct device_node *np, int want_index,
52 phys_addr_t taddr, unsigned long irq, 52 phys_addr_t taddr, unsigned long irq,
53 upf_t flags, int irq_check_parent) 53 upf_t flags, int irq_check_parent)
54{ 54{
55 const u32 *clk, *spd; 55 const __be32 *clk, *spd;
56 u32 clock = BASE_BAUD * 16; 56 u32 clock = BASE_BAUD * 16;
57 int index; 57 int index;
58 58
59 /* get clock freq. if present */ 59 /* get clock freq. if present */
60 clk = of_get_property(np, "clock-frequency", NULL); 60 clk = of_get_property(np, "clock-frequency", NULL);
61 if (clk && *clk) 61 if (clk && *clk)
62 clock = *clk; 62 clock = be32_to_cpup(clk);
63 63
64 /* get default speed if present */ 64 /* get default speed if present */
65 spd = of_get_property(np, "current-speed", NULL); 65 spd = of_get_property(np, "current-speed", NULL);
@@ -109,7 +109,7 @@ static int __init add_legacy_port(struct device_node *np, int want_index,
109 legacy_serial_infos[index].taddr = taddr; 109 legacy_serial_infos[index].taddr = taddr;
110 legacy_serial_infos[index].np = of_node_get(np); 110 legacy_serial_infos[index].np = of_node_get(np);
111 legacy_serial_infos[index].clock = clock; 111 legacy_serial_infos[index].clock = clock;
112 legacy_serial_infos[index].speed = spd ? *spd : 0; 112 legacy_serial_infos[index].speed = spd ? be32_to_cpup(spd) : 0;
113 legacy_serial_infos[index].irq_check_parent = irq_check_parent; 113 legacy_serial_infos[index].irq_check_parent = irq_check_parent;
114 114
115 printk(KERN_DEBUG "Found legacy serial port %d for %s\n", 115 printk(KERN_DEBUG "Found legacy serial port %d for %s\n",
@@ -168,7 +168,7 @@ static int __init add_legacy_soc_port(struct device_node *np,
168static int __init add_legacy_isa_port(struct device_node *np, 168static int __init add_legacy_isa_port(struct device_node *np,
169 struct device_node *isa_brg) 169 struct device_node *isa_brg)
170{ 170{
171 const u32 *reg; 171 const __be32 *reg;
172 const char *typep; 172 const char *typep;
173 int index = -1; 173 int index = -1;
174 u64 taddr; 174 u64 taddr;
@@ -181,7 +181,7 @@ static int __init add_legacy_isa_port(struct device_node *np,
181 return -1; 181 return -1;
182 182
183 /* Verify it's an IO port, we don't support anything else */ 183 /* Verify it's an IO port, we don't support anything else */
184 if (!(reg[0] & 0x00000001)) 184 if (!(be32_to_cpu(reg[0]) & 0x00000001))
185 return -1; 185 return -1;
186 186
187 /* Now look for an "ibm,aix-loc" property that gives us ordering 187 /* Now look for an "ibm,aix-loc" property that gives us ordering
@@ -202,7 +202,7 @@ static int __init add_legacy_isa_port(struct device_node *np,
202 taddr = 0; 202 taddr = 0;
203 203
204 /* Add port, irq will be dealt with later */ 204 /* Add port, irq will be dealt with later */
205 return add_legacy_port(np, index, UPIO_PORT, reg[1], taddr, 205 return add_legacy_port(np, index, UPIO_PORT, be32_to_cpu(reg[1]), taddr,
206 NO_IRQ, UPF_BOOT_AUTOCONF, 0); 206 NO_IRQ, UPF_BOOT_AUTOCONF, 0);
207 207
208} 208}
@@ -251,9 +251,9 @@ static int __init add_legacy_pci_port(struct device_node *np,
251 * we get to their "reg" property 251 * we get to their "reg" property
252 */ 252 */
253 if (np != pci_dev) { 253 if (np != pci_dev) {
254 const u32 *reg = of_get_property(np, "reg", NULL); 254 const __be32 *reg = of_get_property(np, "reg", NULL);
255 if (reg && (*reg < 4)) 255 if (reg && (be32_to_cpup(reg) < 4))
256 index = lindex = *reg; 256 index = lindex = be32_to_cpup(reg);
257 } 257 }
258 258
259 /* Local index means it's the Nth port in the PCI chip. Unfortunately 259 /* Local index means it's the Nth port in the PCI chip. Unfortunately
@@ -507,7 +507,7 @@ static int __init check_legacy_serial_console(void)
507 struct device_node *prom_stdout = NULL; 507 struct device_node *prom_stdout = NULL;
508 int i, speed = 0, offset = 0; 508 int i, speed = 0, offset = 0;
509 const char *name; 509 const char *name;
510 const u32 *spd; 510 const __be32 *spd;
511 511
512 DBG(" -> check_legacy_serial_console()\n"); 512 DBG(" -> check_legacy_serial_console()\n");
513 513
@@ -547,7 +547,7 @@ static int __init check_legacy_serial_console(void)
547 } 547 }
548 spd = of_get_property(prom_stdout, "current-speed", NULL); 548 spd = of_get_property(prom_stdout, "current-speed", NULL);
549 if (spd) 549 if (spd)
550 speed = *spd; 550 speed = be32_to_cpup(spd);
551 551
552 if (strcmp(name, "serial") != 0) 552 if (strcmp(name, "serial") != 0)
553 goto not_found; 553 goto not_found;
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index c3c6a8857544..9e3132db718b 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -364,10 +364,15 @@ static int __init early_init_dt_scan_cpus(unsigned long node,
364 return 0; 364 return 0;
365} 365}
366 366
367void __init early_init_dt_scan_chosen_arch(unsigned long node) 367int __init early_init_dt_scan_chosen_ppc(unsigned long node, const char *uname,
368 int depth, void *data)
368{ 369{
369 unsigned long *lprop; 370 unsigned long *lprop;
370 371
372 /* Use common scan routine to determine if this is the chosen node */
373 if (early_init_dt_scan_chosen(node, uname, depth, data) == 0)
374 return 0;
375
371#ifdef CONFIG_PPC64 376#ifdef CONFIG_PPC64
372 /* check if iommu is forced on or off */ 377 /* check if iommu is forced on or off */
373 if (of_get_flat_dt_prop(node, "linux,iommu-off", NULL) != NULL) 378 if (of_get_flat_dt_prop(node, "linux,iommu-off", NULL) != NULL)
@@ -399,6 +404,9 @@ void __init early_init_dt_scan_chosen_arch(unsigned long node)
399 if (lprop) 404 if (lprop)
400 crashk_res.end = crashk_res.start + *lprop - 1; 405 crashk_res.end = crashk_res.start + *lprop - 1;
401#endif 406#endif
407
408 /* break now */
409 return 1;
402} 410}
403 411
404#ifdef CONFIG_PPC_PSERIES 412#ifdef CONFIG_PPC_PSERIES
@@ -683,7 +691,7 @@ void __init early_init_devtree(void *params)
683 * device-tree, including the platform type, initrd location and 691 * device-tree, including the platform type, initrd location and
684 * size, TCE reserve, and more ... 692 * size, TCE reserve, and more ...
685 */ 693 */
686 of_scan_flat_dt(early_init_dt_scan_chosen, NULL); 694 of_scan_flat_dt(early_init_dt_scan_chosen_ppc, NULL);
687 695
688 /* Scan memory nodes and rebuild MEMBLOCKs */ 696 /* Scan memory nodes and rebuild MEMBLOCKs */
689 memblock_init(); 697 memblock_init();