aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-04-21 18:50:49 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-21 18:50:49 -0400
commit9a64388d83f6ef08dfff405a9d122e3dbcb6bf38 (patch)
treea77532ce4d6d56be6c6c7f405cd901a0184250fb /arch/powerpc/platforms
parente80ab411e589e00550e2e6e5a6a02d59cc730357 (diff)
parent14b3ca4022f050f8622ed282b734ddf445464583 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc
* 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc: (202 commits) [POWERPC] Fix compile breakage for 64-bit UP configs [POWERPC] Define copy_siginfo_from_user32 [POWERPC] Add compat handler for PTRACE_GETSIGINFO [POWERPC] i2c: Fix build breakage introduced by OF helpers [POWERPC] Optimize fls64() on 64-bit processors [POWERPC] irqtrace support for 64-bit powerpc [POWERPC] Stacktrace support for lockdep [POWERPC] Move stackframe definitions to common header [POWERPC] Fix device-tree locking vs. interrupts [POWERPC] Make pci_bus_to_host()'s struct pci_bus * argument const [POWERPC] Remove unused __max_memory variable [POWERPC] Simplify xics direct/lpar irq_host setup [POWERPC] Use pseries_setup_i8259_cascade() in pseries_mpic_init_IRQ() [POWERPC] Turn xics_setup_8259_cascade() into a generic pseries_setup_i8259_cascade() [POWERPC] Move xics_setup_8259_cascade() into platforms/pseries/setup.c [POWERPC] Use asm-generic/bitops/find.h in bitops.h [POWERPC] 83xx: mpc8315 - fix USB UTMI Host setup [POWERPC] 85xx: Fix the size of qe muram for MPC8568E [POWERPC] 86xx: mpc86xx_hpcn - Temporarily accept old dts node identifier. [POWERPC] 86xx: mark functions static, other minor cleanups ...
Diffstat (limited to 'arch/powerpc/platforms')
-rw-r--r--arch/powerpc/platforms/40x/ep405.c2
-rw-r--r--arch/powerpc/platforms/40x/kilauea.c4
-rw-r--r--arch/powerpc/platforms/40x/makalu.c2
-rw-r--r--arch/powerpc/platforms/40x/virtex.c2
-rw-r--r--arch/powerpc/platforms/40x/walnut.c4
-rw-r--r--arch/powerpc/platforms/44x/44x.h1
-rw-r--r--arch/powerpc/platforms/44x/Kconfig27
-rw-r--r--arch/powerpc/platforms/44x/Makefile4
-rw-r--r--arch/powerpc/platforms/44x/bamboo.c15
-rw-r--r--arch/powerpc/platforms/44x/canyonlands.c63
-rw-r--r--arch/powerpc/platforms/44x/ebony.c5
-rw-r--r--arch/powerpc/platforms/44x/idle.c67
-rw-r--r--arch/powerpc/platforms/44x/katmai.c5
-rw-r--r--arch/powerpc/platforms/44x/misc_44x.S11
-rw-r--r--arch/powerpc/platforms/44x/rainier.c4
-rw-r--r--arch/powerpc/platforms/44x/sequoia.c4
-rw-r--r--arch/powerpc/platforms/44x/taishan.c5
-rw-r--r--arch/powerpc/platforms/44x/warp-nand.c3
-rw-r--r--arch/powerpc/platforms/44x/warp.c6
-rw-r--r--arch/powerpc/platforms/52xx/lite5200.c4
-rw-r--r--arch/powerpc/platforms/82xx/Kconfig3
-rw-r--r--arch/powerpc/platforms/83xx/mpc837x_rdb.c1
-rw-r--r--arch/powerpc/platforms/83xx/mpc83xx.h2
-rw-r--r--arch/powerpc/platforms/83xx/usb.c12
-rw-r--r--arch/powerpc/platforms/85xx/Kconfig13
-rw-r--r--arch/powerpc/platforms/85xx/Makefile1
-rw-r--r--arch/powerpc/platforms/85xx/ksi8560.c257
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_ads.c2
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_ds.c15
-rw-r--r--arch/powerpc/platforms/86xx/Kconfig8
-rw-r--r--arch/powerpc/platforms/86xx/Makefile1
-rw-r--r--arch/powerpc/platforms/86xx/mpc8610_hpcd.c4
-rw-r--r--arch/powerpc/platforms/86xx/mpc86xx_hpcn.c14
-rw-r--r--arch/powerpc/platforms/86xx/sbc8641d.c164
-rw-r--r--arch/powerpc/platforms/8xx/Kconfig4
-rw-r--r--arch/powerpc/platforms/8xx/m8xx_setup.c7
-rw-r--r--arch/powerpc/platforms/Kconfig8
-rw-r--r--arch/powerpc/platforms/Kconfig.cputype2
-rw-r--r--arch/powerpc/platforms/cell/iommu.c10
-rw-r--r--arch/powerpc/platforms/cell/pervasive.c2
-rw-r--r--arch/powerpc/platforms/cell/ras.c10
-rw-r--r--arch/powerpc/platforms/cell/spu_base.c8
-rw-r--r--arch/powerpc/platforms/cell/spu_callbacks.c2
-rw-r--r--arch/powerpc/platforms/cell/spu_manage.c8
-rw-r--r--arch/powerpc/platforms/cell/spufs/coredump.c8
-rw-r--r--arch/powerpc/platforms/cell/spufs/file.c8
-rw-r--r--arch/powerpc/platforms/cell/spufs/run.c14
-rw-r--r--arch/powerpc/platforms/cell/spufs/switch.c2
-rw-r--r--arch/powerpc/platforms/celleb/beat.c17
-rw-r--r--arch/powerpc/platforms/celleb/beat.h4
-rw-r--r--arch/powerpc/platforms/celleb/beat_wrapper.h3
-rw-r--r--arch/powerpc/platforms/celleb/htab.c7
-rw-r--r--arch/powerpc/platforms/celleb/interrupt.c26
-rw-r--r--arch/powerpc/platforms/celleb/scc_epci.c8
-rw-r--r--arch/powerpc/platforms/celleb/scc_sio.c4
-rw-r--r--arch/powerpc/platforms/celleb/spu_priv1.c3
-rw-r--r--arch/powerpc/platforms/celleb/udbg_beat.c5
-rw-r--r--arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c10
-rw-r--r--arch/powerpc/platforms/embedded6xx/prpmc2800.c4
-rw-r--r--arch/powerpc/platforms/iseries/exception.S12
-rw-r--r--arch/powerpc/platforms/iseries/ipl_parms.h2
-rw-r--r--arch/powerpc/platforms/iseries/lpardata.c121
-rw-r--r--arch/powerpc/platforms/iseries/naca.h2
-rw-r--r--arch/powerpc/platforms/iseries/pci.c3
-rw-r--r--arch/powerpc/platforms/iseries/release_data.h2
-rw-r--r--arch/powerpc/platforms/iseries/spcomm_area.h2
-rw-r--r--arch/powerpc/platforms/iseries/vpd_areas.h4
-rw-r--r--arch/powerpc/platforms/maple/pci.c47
-rw-r--r--arch/powerpc/platforms/maple/setup.c4
-rw-r--r--arch/powerpc/platforms/pasemi/dma_lib.c144
-rw-r--r--arch/powerpc/platforms/pasemi/iommu.c19
-rw-r--r--arch/powerpc/platforms/powermac/setup.c2
-rw-r--r--arch/powerpc/platforms/ps3/device-init.c78
-rw-r--r--arch/powerpc/platforms/ps3/htab.c3
-rw-r--r--arch/powerpc/platforms/ps3/interrupt.c2
-rw-r--r--arch/powerpc/platforms/ps3/mm.c3
-rw-r--r--arch/powerpc/platforms/ps3/os-area.c3
-rw-r--r--arch/powerpc/platforms/ps3/setup.c14
-rw-r--r--arch/powerpc/platforms/ps3/spu.c7
-rw-r--r--arch/powerpc/platforms/pseries/Makefile1
-rw-r--r--arch/powerpc/platforms/pseries/eeh.c5
-rw-r--r--arch/powerpc/platforms/pseries/lpar.c25
-rw-r--r--arch/powerpc/platforms/pseries/pci_dlpar.c2
-rw-r--r--arch/powerpc/platforms/pseries/phyp_dump.c507
-rw-r--r--arch/powerpc/platforms/pseries/pseries.h2
-rw-r--r--arch/powerpc/platforms/pseries/reconfig.c12
-rw-r--r--arch/powerpc/platforms/pseries/scanlog.c37
-rw-r--r--arch/powerpc/platforms/pseries/setup.c105
-rw-r--r--arch/powerpc/platforms/pseries/xics.c87
-rw-r--r--arch/powerpc/platforms/pseries/xics.h3
90 files changed, 1738 insertions, 441 deletions
diff --git a/arch/powerpc/platforms/40x/ep405.c b/arch/powerpc/platforms/40x/ep405.c
index 13d1345026da..ae2e7f67c18e 100644
--- a/arch/powerpc/platforms/40x/ep405.c
+++ b/arch/powerpc/platforms/40x/ep405.c
@@ -29,6 +29,7 @@
29#include <asm/time.h> 29#include <asm/time.h>
30#include <asm/uic.h> 30#include <asm/uic.h>
31#include <asm/pci-bridge.h> 31#include <asm/pci-bridge.h>
32#include <asm/ppc4xx.h>
32 33
33static struct device_node *bcsr_node; 34static struct device_node *bcsr_node;
34static void __iomem *bcsr_regs; 35static void __iomem *bcsr_regs;
@@ -119,5 +120,6 @@ define_machine(ep405) {
119 .progress = udbg_progress, 120 .progress = udbg_progress,
120 .init_IRQ = uic_init_tree, 121 .init_IRQ = uic_init_tree,
121 .get_irq = uic_get_irq, 122 .get_irq = uic_get_irq,
123 .restart = ppc4xx_reset_system,
122 .calibrate_decr = generic_calibrate_decr, 124 .calibrate_decr = generic_calibrate_decr,
123}; 125};
diff --git a/arch/powerpc/platforms/40x/kilauea.c b/arch/powerpc/platforms/40x/kilauea.c
index f9206a7fede0..1dd24ffc0dc1 100644
--- a/arch/powerpc/platforms/40x/kilauea.c
+++ b/arch/powerpc/platforms/40x/kilauea.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Kilauea board specific routines 2 * Kilauea board specific routines
3 * 3 *
4 * Copyright 2007 DENX Software Engineering, Stefan Roese <sr@denx.de> 4 * Copyright 2007-2008 DENX Software Engineering, Stefan Roese <sr@denx.de>
5 * 5 *
6 * Based on the Walnut code by 6 * Based on the Walnut code by
7 * Josh Boyer <jwboyer@linux.vnet.ibm.com> 7 * Josh Boyer <jwboyer@linux.vnet.ibm.com>
@@ -20,6 +20,7 @@
20#include <asm/time.h> 20#include <asm/time.h>
21#include <asm/uic.h> 21#include <asm/uic.h>
22#include <asm/pci-bridge.h> 22#include <asm/pci-bridge.h>
23#include <asm/ppc4xx.h>
23 24
24static __initdata struct of_device_id kilauea_of_bus[] = { 25static __initdata struct of_device_id kilauea_of_bus[] = {
25 { .compatible = "ibm,plb4", }, 26 { .compatible = "ibm,plb4", },
@@ -54,5 +55,6 @@ define_machine(kilauea) {
54 .progress = udbg_progress, 55 .progress = udbg_progress,
55 .init_IRQ = uic_init_tree, 56 .init_IRQ = uic_init_tree,
56 .get_irq = uic_get_irq, 57 .get_irq = uic_get_irq,
58 .restart = ppc4xx_reset_system,
57 .calibrate_decr = generic_calibrate_decr, 59 .calibrate_decr = generic_calibrate_decr,
58}; 60};
diff --git a/arch/powerpc/platforms/40x/makalu.c b/arch/powerpc/platforms/40x/makalu.c
index 4e4df72fc9cd..a6a1d6017b71 100644
--- a/arch/powerpc/platforms/40x/makalu.c
+++ b/arch/powerpc/platforms/40x/makalu.c
@@ -20,6 +20,7 @@
20#include <asm/time.h> 20#include <asm/time.h>
21#include <asm/uic.h> 21#include <asm/uic.h>
22#include <asm/pci-bridge.h> 22#include <asm/pci-bridge.h>
23#include <asm/ppc4xx.h>
23 24
24static __initdata struct of_device_id makalu_of_bus[] = { 25static __initdata struct of_device_id makalu_of_bus[] = {
25 { .compatible = "ibm,plb4", }, 26 { .compatible = "ibm,plb4", },
@@ -54,5 +55,6 @@ define_machine(makalu) {
54 .progress = udbg_progress, 55 .progress = udbg_progress,
55 .init_IRQ = uic_init_tree, 56 .init_IRQ = uic_init_tree,
56 .get_irq = uic_get_irq, 57 .get_irq = uic_get_irq,
58 .restart = ppc4xx_reset_system,
57 .calibrate_decr = generic_calibrate_decr, 59 .calibrate_decr = generic_calibrate_decr,
58}; 60};
diff --git a/arch/powerpc/platforms/40x/virtex.c b/arch/powerpc/platforms/40x/virtex.c
index 0422590040db..fc7fb001276c 100644
--- a/arch/powerpc/platforms/40x/virtex.c
+++ b/arch/powerpc/platforms/40x/virtex.c
@@ -14,6 +14,7 @@
14#include <asm/prom.h> 14#include <asm/prom.h>
15#include <asm/time.h> 15#include <asm/time.h>
16#include <asm/xilinx_intc.h> 16#include <asm/xilinx_intc.h>
17#include <asm/ppc4xx.h>
17 18
18static struct of_device_id xilinx_of_bus_ids[] __initdata = { 19static struct of_device_id xilinx_of_bus_ids[] __initdata = {
19 { .compatible = "xlnx,plb-v46-1.00.a", }, 20 { .compatible = "xlnx,plb-v46-1.00.a", },
@@ -48,5 +49,6 @@ define_machine(virtex) {
48 .probe = virtex_probe, 49 .probe = virtex_probe,
49 .init_IRQ = xilinx_intc_init_tree, 50 .init_IRQ = xilinx_intc_init_tree,
50 .get_irq = xilinx_intc_get_irq, 51 .get_irq = xilinx_intc_get_irq,
52 .restart = ppc4xx_reset_system,
51 .calibrate_decr = generic_calibrate_decr, 53 .calibrate_decr = generic_calibrate_decr,
52}; 54};
diff --git a/arch/powerpc/platforms/40x/walnut.c b/arch/powerpc/platforms/40x/walnut.c
index b8b257efeb77..335df91fbee5 100644
--- a/arch/powerpc/platforms/40x/walnut.c
+++ b/arch/powerpc/platforms/40x/walnut.c
@@ -26,6 +26,7 @@
26#include <asm/time.h> 26#include <asm/time.h>
27#include <asm/uic.h> 27#include <asm/uic.h>
28#include <asm/pci-bridge.h> 28#include <asm/pci-bridge.h>
29#include <asm/ppc4xx.h>
29 30
30static __initdata struct of_device_id walnut_of_bus[] = { 31static __initdata struct of_device_id walnut_of_bus[] = {
31 { .compatible = "ibm,plb3", }, 32 { .compatible = "ibm,plb3", },
@@ -61,5 +62,6 @@ define_machine(walnut) {
61 .progress = udbg_progress, 62 .progress = udbg_progress,
62 .init_IRQ = uic_init_tree, 63 .init_IRQ = uic_init_tree,
63 .get_irq = uic_get_irq, 64 .get_irq = uic_get_irq,
64 .calibrate_decr = generic_calibrate_decr, 65 .restart = ppc4xx_reset_system,
66 .calibrate_decr = generic_calibrate_decr,
65}; 67};
diff --git a/arch/powerpc/platforms/44x/44x.h b/arch/powerpc/platforms/44x/44x.h
index 42eabf87fea3..dbc4d2b4301a 100644
--- a/arch/powerpc/platforms/44x/44x.h
+++ b/arch/powerpc/platforms/44x/44x.h
@@ -3,6 +3,5 @@
3 3
4extern u8 as1_readb(volatile u8 __iomem *addr); 4extern u8 as1_readb(volatile u8 __iomem *addr);
5extern void as1_writeb(u8 data, volatile u8 __iomem *addr); 5extern void as1_writeb(u8 data, volatile u8 __iomem *addr);
6extern void ppc44x_reset_system(char *cmd);
7 6
8#endif /* __POWERPC_PLATFORMS_44X_44X_H */ 7#endif /* __POWERPC_PLATFORMS_44X_44X_H */
diff --git a/arch/powerpc/platforms/44x/Kconfig b/arch/powerpc/platforms/44x/Kconfig
index 1bfb2191010a..6abe91357eee 100644
--- a/arch/powerpc/platforms/44x/Kconfig
+++ b/arch/powerpc/platforms/44x/Kconfig
@@ -67,6 +67,25 @@ config WARP
67 See http://www.pikatechnologies.com/ and follow the "PIKA for Computer 67 See http://www.pikatechnologies.com/ and follow the "PIKA for Computer
68 Telephony Developers" link for more information. 68 Telephony Developers" link for more information.
69 69
70config CANYONLANDS
71 bool "Canyonlands"
72 depends on 44x
73 default n
74 select 460EX
75 select PCI
76 select PPC4xx_PCI_EXPRESS
77 help
78 This option enables support for the AMCC PPC460EX evaluation board.
79
80config YOSEMITE
81 bool "Yosemite"
82 depends on 44x
83 default n
84 select 440EP
85 select PCI
86 help
87 This option enables support for the AMCC PPC440EP evaluation board.
88
70#config LUAN 89#config LUAN
71# bool "Luan" 90# bool "Luan"
72# depends on 44x 91# depends on 44x
@@ -122,6 +141,14 @@ config 440SPe
122 bool 141 bool
123 select IBM_NEW_EMAC_EMAC4 142 select IBM_NEW_EMAC_EMAC4
124 143
144config 460EX
145 bool
146 select PPC_FPU
147 select IBM_NEW_EMAC_EMAC4
148 select IBM_NEW_EMAC_RGMII
149 select IBM_NEW_EMAC_ZMII
150 select IBM_NEW_EMAC_TAH
151
125# 44x errata/workaround config symbols, selected by the CPU models above 152# 44x errata/workaround config symbols, selected by the CPU models above
126config IBM440EP_ERR42 153config IBM440EP_ERR42
127 bool 154 bool
diff --git a/arch/powerpc/platforms/44x/Makefile b/arch/powerpc/platforms/44x/Makefile
index 0864d4f1cbc2..774165f9acdd 100644
--- a/arch/powerpc/platforms/44x/Makefile
+++ b/arch/powerpc/platforms/44x/Makefile
@@ -1,9 +1,11 @@
1obj-$(CONFIG_44x) := misc_44x.o 1obj-$(CONFIG_44x) := misc_44x.o idle.o
2obj-$(CONFIG_EBONY) += ebony.o 2obj-$(CONFIG_EBONY) += ebony.o
3obj-$(CONFIG_TAISHAN) += taishan.o 3obj-$(CONFIG_TAISHAN) += taishan.o
4obj-$(CONFIG_BAMBOO) += bamboo.o 4obj-$(CONFIG_BAMBOO) += bamboo.o
5obj-$(CONFIG_YOSEMITE) += bamboo.o
5obj-$(CONFIG_SEQUOIA) += sequoia.o 6obj-$(CONFIG_SEQUOIA) += sequoia.o
6obj-$(CONFIG_KATMAI) += katmai.o 7obj-$(CONFIG_KATMAI) += katmai.o
7obj-$(CONFIG_RAINIER) += rainier.o 8obj-$(CONFIG_RAINIER) += rainier.o
8obj-$(CONFIG_WARP) += warp.o 9obj-$(CONFIG_WARP) += warp.o
9obj-$(CONFIG_WARP) += warp-nand.o 10obj-$(CONFIG_WARP) += warp-nand.o
11obj-$(CONFIG_CANYONLANDS) += canyonlands.o
diff --git a/arch/powerpc/platforms/44x/bamboo.c b/arch/powerpc/platforms/44x/bamboo.c
index fb9a22a7e8d0..cef169e95156 100644
--- a/arch/powerpc/platforms/44x/bamboo.c
+++ b/arch/powerpc/platforms/44x/bamboo.c
@@ -22,8 +22,7 @@
22#include <asm/time.h> 22#include <asm/time.h>
23#include <asm/uic.h> 23#include <asm/uic.h>
24#include <asm/pci-bridge.h> 24#include <asm/pci-bridge.h>
25 25#include <asm/ppc4xx.h>
26#include "44x.h"
27 26
28static __initdata struct of_device_id bamboo_of_bus[] = { 27static __initdata struct of_device_id bamboo_of_bus[] = {
29 { .compatible = "ibm,plb4", }, 28 { .compatible = "ibm,plb4", },
@@ -53,11 +52,11 @@ static int __init bamboo_probe(void)
53} 52}
54 53
55define_machine(bamboo) { 54define_machine(bamboo) {
56 .name = "Bamboo", 55 .name = "Bamboo",
57 .probe = bamboo_probe, 56 .probe = bamboo_probe,
58 .progress = udbg_progress, 57 .progress = udbg_progress,
59 .init_IRQ = uic_init_tree, 58 .init_IRQ = uic_init_tree,
60 .get_irq = uic_get_irq, 59 .get_irq = uic_get_irq,
61 .restart = ppc44x_reset_system, 60 .restart = ppc4xx_reset_system,
62 .calibrate_decr = generic_calibrate_decr, 61 .calibrate_decr = generic_calibrate_decr,
63}; 62};
diff --git a/arch/powerpc/platforms/44x/canyonlands.c b/arch/powerpc/platforms/44x/canyonlands.c
new file mode 100644
index 000000000000..3949289f51df
--- /dev/null
+++ b/arch/powerpc/platforms/44x/canyonlands.c
@@ -0,0 +1,63 @@
1/*
2 * Canyonlands board specific routines
3 *
4 * Copyright 2008 DENX Software Engineering, Stefan Roese <sr@denx.de>
5 *
6 * Based on the Katmai code by
7 * Benjamin Herrenschmidt <benh@kernel.crashing.org>
8 * Copyright 2007 IBM Corp.
9 * Josh Boyer <jwboyer@linux.vnet.ibm.com>
10 * Copyright 2007 IBM Corporation
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
16 */
17#include <linux/init.h>
18#include <linux/of_platform.h>
19
20#include <asm/machdep.h>
21#include <asm/prom.h>
22#include <asm/udbg.h>
23#include <asm/time.h>
24#include <asm/uic.h>
25#include <asm/pci-bridge.h>
26#include <asm/ppc4xx.h>
27
28static __initdata struct of_device_id canyonlands_of_bus[] = {
29 { .compatible = "ibm,plb4", },
30 { .compatible = "ibm,opb", },
31 { .compatible = "ibm,ebc", },
32 {},
33};
34
35static int __init canyonlands_device_probe(void)
36{
37 of_platform_bus_probe(NULL, canyonlands_of_bus, NULL);
38
39 return 0;
40}
41machine_device_initcall(canyonlands, canyonlands_device_probe);
42
43static int __init canyonlands_probe(void)
44{
45 unsigned long root = of_get_flat_dt_root();
46
47 if (!of_flat_dt_is_compatible(root, "amcc,canyonlands"))
48 return 0;
49
50 ppc_pci_flags = PPC_PCI_REASSIGN_ALL_RSRC;
51
52 return 1;
53}
54
55define_machine(canyonlands) {
56 .name = "Canyonlands",
57 .probe = canyonlands_probe,
58 .progress = udbg_progress,
59 .init_IRQ = uic_init_tree,
60 .get_irq = uic_get_irq,
61 .restart = ppc4xx_reset_system,
62 .calibrate_decr = generic_calibrate_decr,
63};
diff --git a/arch/powerpc/platforms/44x/ebony.c b/arch/powerpc/platforms/44x/ebony.c
index 1a8d467bff85..a0e8fe4662f6 100644
--- a/arch/powerpc/platforms/44x/ebony.c
+++ b/arch/powerpc/platforms/44x/ebony.c
@@ -26,8 +26,7 @@
26#include <asm/time.h> 26#include <asm/time.h>
27#include <asm/uic.h> 27#include <asm/uic.h>
28#include <asm/pci-bridge.h> 28#include <asm/pci-bridge.h>
29 29#include <asm/ppc4xx.h>
30#include "44x.h"
31 30
32static __initdata struct of_device_id ebony_of_bus[] = { 31static __initdata struct of_device_id ebony_of_bus[] = {
33 { .compatible = "ibm,plb4", }, 32 { .compatible = "ibm,plb4", },
@@ -66,6 +65,6 @@ define_machine(ebony) {
66 .progress = udbg_progress, 65 .progress = udbg_progress,
67 .init_IRQ = uic_init_tree, 66 .init_IRQ = uic_init_tree,
68 .get_irq = uic_get_irq, 67 .get_irq = uic_get_irq,
69 .restart = ppc44x_reset_system, 68 .restart = ppc4xx_reset_system,
70 .calibrate_decr = generic_calibrate_decr, 69 .calibrate_decr = generic_calibrate_decr,
71}; 70};
diff --git a/arch/powerpc/platforms/44x/idle.c b/arch/powerpc/platforms/44x/idle.c
new file mode 100644
index 000000000000..7a81f921fef9
--- /dev/null
+++ b/arch/powerpc/platforms/44x/idle.c
@@ -0,0 +1,67 @@
1/*
2 * Copyright 2008 IBM Corp.
3 *
4 * Based on arch/powerpc/platforms/pasemi/idle.c:
5 * Copyright (C) 2006-2007 PA Semi, Inc
6 *
7 * Added by: Jerone Young <jyoung5@us.ibm.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 *
22 */
23
24#include <linux/of.h>
25#include <linux/kernel.h>
26#include <asm/machdep.h>
27
28static int mode_spin;
29
30static void ppc44x_idle(void)
31{
32 unsigned long msr_save;
33
34 msr_save = mfmsr();
35 /* set wait state MSR */
36 mtmsr(msr_save|MSR_WE|MSR_EE|MSR_CE|MSR_DE);
37 isync();
38 /* return to initial state */
39 mtmsr(msr_save);
40 isync();
41}
42
43int __init ppc44x_idle_init(void)
44{
45 if (!mode_spin) {
46 /* If we are not setting spin mode
47 then we set to wait mode */
48 ppc_md.power_save = &ppc44x_idle;
49 }
50
51 return 0;
52}
53
54arch_initcall(ppc44x_idle_init);
55
56static int __init idle_param(char *p)
57{
58
59 if (!strcmp("spin", p)) {
60 mode_spin = 1;
61 ppc_md.power_save = NULL;
62 }
63
64 return 0;
65}
66
67early_param("idle", idle_param);
diff --git a/arch/powerpc/platforms/44x/katmai.c b/arch/powerpc/platforms/44x/katmai.c
index 11134121f272..44f4b3a00ced 100644
--- a/arch/powerpc/platforms/44x/katmai.c
+++ b/arch/powerpc/platforms/44x/katmai.c
@@ -22,8 +22,7 @@
22#include <asm/time.h> 22#include <asm/time.h>
23#include <asm/uic.h> 23#include <asm/uic.h>
24#include <asm/pci-bridge.h> 24#include <asm/pci-bridge.h>
25 25#include <asm/ppc4xx.h>
26#include "44x.h"
27 26
28static __initdata struct of_device_id katmai_of_bus[] = { 27static __initdata struct of_device_id katmai_of_bus[] = {
29 { .compatible = "ibm,plb4", }, 28 { .compatible = "ibm,plb4", },
@@ -58,6 +57,6 @@ define_machine(katmai) {
58 .progress = udbg_progress, 57 .progress = udbg_progress,
59 .init_IRQ = uic_init_tree, 58 .init_IRQ = uic_init_tree,
60 .get_irq = uic_get_irq, 59 .get_irq = uic_get_irq,
61 .restart = ppc44x_reset_system, 60 .restart = ppc4xx_reset_system,
62 .calibrate_decr = generic_calibrate_decr, 61 .calibrate_decr = generic_calibrate_decr,
63}; 62};
diff --git a/arch/powerpc/platforms/44x/misc_44x.S b/arch/powerpc/platforms/44x/misc_44x.S
index 3bce71d5d756..dc12b8009e48 100644
--- a/arch/powerpc/platforms/44x/misc_44x.S
+++ b/arch/powerpc/platforms/44x/misc_44x.S
@@ -44,14 +44,3 @@ _GLOBAL(as1_writeb)
44 sync 44 sync
45 isync 45 isync
46 blr 46 blr
47
48/*
49 * void ppc44x_reset_system(char *cmd)
50 *
51 * At present, this routine just applies a system reset.
52 */
53_GLOBAL(ppc44x_reset_system)
54 mfspr r13,SPRN_DBCR0
55 oris r13,r13,DBCR0_RST_SYSTEM@h
56 mtspr SPRN_DBCR0,r13
57 b . /* Just in case the reset doesn't work */
diff --git a/arch/powerpc/platforms/44x/rainier.c b/arch/powerpc/platforms/44x/rainier.c
index a7fae1cf69c1..4f1ff84c4b63 100644
--- a/arch/powerpc/platforms/44x/rainier.c
+++ b/arch/powerpc/platforms/44x/rainier.c
@@ -22,7 +22,7 @@
22#include <asm/time.h> 22#include <asm/time.h>
23#include <asm/uic.h> 23#include <asm/uic.h>
24#include <asm/pci-bridge.h> 24#include <asm/pci-bridge.h>
25#include "44x.h" 25#include <asm/ppc4xx.h>
26 26
27static __initdata struct of_device_id rainier_of_bus[] = { 27static __initdata struct of_device_id rainier_of_bus[] = {
28 { .compatible = "ibm,plb4", }, 28 { .compatible = "ibm,plb4", },
@@ -57,6 +57,6 @@ define_machine(rainier) {
57 .progress = udbg_progress, 57 .progress = udbg_progress,
58 .init_IRQ = uic_init_tree, 58 .init_IRQ = uic_init_tree,
59 .get_irq = uic_get_irq, 59 .get_irq = uic_get_irq,
60 .restart = ppc44x_reset_system, 60 .restart = ppc4xx_reset_system,
61 .calibrate_decr = generic_calibrate_decr, 61 .calibrate_decr = generic_calibrate_decr,
62}; 62};
diff --git a/arch/powerpc/platforms/44x/sequoia.c b/arch/powerpc/platforms/44x/sequoia.c
index d279db42c896..49eb73daacdf 100644
--- a/arch/powerpc/platforms/44x/sequoia.c
+++ b/arch/powerpc/platforms/44x/sequoia.c
@@ -23,7 +23,7 @@
23#include <asm/uic.h> 23#include <asm/uic.h>
24#include <asm/pci-bridge.h> 24#include <asm/pci-bridge.h>
25 25
26#include "44x.h" 26#include <asm/ppc4xx.h>
27 27
28static __initdata struct of_device_id sequoia_of_bus[] = { 28static __initdata struct of_device_id sequoia_of_bus[] = {
29 { .compatible = "ibm,plb4", }, 29 { .compatible = "ibm,plb4", },
@@ -58,6 +58,6 @@ define_machine(sequoia) {
58 .progress = udbg_progress, 58 .progress = udbg_progress,
59 .init_IRQ = uic_init_tree, 59 .init_IRQ = uic_init_tree,
60 .get_irq = uic_get_irq, 60 .get_irq = uic_get_irq,
61 .restart = ppc44x_reset_system, 61 .restart = ppc4xx_reset_system,
62 .calibrate_decr = generic_calibrate_decr, 62 .calibrate_decr = generic_calibrate_decr,
63}; 63};
diff --git a/arch/powerpc/platforms/44x/taishan.c b/arch/powerpc/platforms/44x/taishan.c
index 28ab7e2e02c3..49c78b2098b4 100644
--- a/arch/powerpc/platforms/44x/taishan.c
+++ b/arch/powerpc/platforms/44x/taishan.c
@@ -29,8 +29,7 @@
29#include <asm/time.h> 29#include <asm/time.h>
30#include <asm/uic.h> 30#include <asm/uic.h>
31#include <asm/pci-bridge.h> 31#include <asm/pci-bridge.h>
32 32#include <asm/ppc4xx.h>
33#include "44x.h"
34 33
35static __initdata struct of_device_id taishan_of_bus[] = { 34static __initdata struct of_device_id taishan_of_bus[] = {
36 { .compatible = "ibm,plb4", }, 35 { .compatible = "ibm,plb4", },
@@ -68,6 +67,6 @@ define_machine(taishan) {
68 .progress = udbg_progress, 67 .progress = udbg_progress,
69 .init_IRQ = uic_init_tree, 68 .init_IRQ = uic_init_tree,
70 .get_irq = uic_get_irq, 69 .get_irq = uic_get_irq,
71 .restart = ppc44x_reset_system, 70 .restart = ppc4xx_reset_system,
72 .calibrate_decr = generic_calibrate_decr, 71 .calibrate_decr = generic_calibrate_decr,
73}; 72};
diff --git a/arch/powerpc/platforms/44x/warp-nand.c b/arch/powerpc/platforms/44x/warp-nand.c
index 84ab78ff8c03..9150318cfc56 100644
--- a/arch/powerpc/platforms/44x/warp-nand.c
+++ b/arch/powerpc/platforms/44x/warp-nand.c
@@ -11,6 +11,7 @@
11#include <linux/mtd/partitions.h> 11#include <linux/mtd/partitions.h>
12#include <linux/mtd/nand.h> 12#include <linux/mtd/nand.h>
13#include <linux/mtd/ndfc.h> 13#include <linux/mtd/ndfc.h>
14#include <asm/machdep.h>
14 15
15#ifdef CONFIG_MTD_NAND_NDFC 16#ifdef CONFIG_MTD_NAND_NDFC
16 17
@@ -100,6 +101,6 @@ static int warp_setup_nand_flash(void)
100 101
101 return 0; 102 return 0;
102} 103}
103device_initcall(warp_setup_nand_flash); 104machine_device_initcall(warp, warp_setup_nand_flash);
104 105
105#endif 106#endif
diff --git a/arch/powerpc/platforms/44x/warp.c b/arch/powerpc/platforms/44x/warp.c
index da5b7b7599db..39cf6150a72b 100644
--- a/arch/powerpc/platforms/44x/warp.c
+++ b/arch/powerpc/platforms/44x/warp.c
@@ -18,9 +18,7 @@
18#include <asm/udbg.h> 18#include <asm/udbg.h>
19#include <asm/time.h> 19#include <asm/time.h>
20#include <asm/uic.h> 20#include <asm/uic.h>
21 21#include <asm/ppc4xx.h>
22#include "44x.h"
23
24 22
25static __initdata struct of_device_id warp_of_bus[] = { 23static __initdata struct of_device_id warp_of_bus[] = {
26 { .compatible = "ibm,plb4", }, 24 { .compatible = "ibm,plb4", },
@@ -49,7 +47,7 @@ define_machine(warp) {
49 .progress = udbg_progress, 47 .progress = udbg_progress,
50 .init_IRQ = uic_init_tree, 48 .init_IRQ = uic_init_tree,
51 .get_irq = uic_get_irq, 49 .get_irq = uic_get_irq,
52 .restart = ppc44x_reset_system, 50 .restart = ppc4xx_reset_system,
53 .calibrate_decr = generic_calibrate_decr, 51 .calibrate_decr = generic_calibrate_decr,
54}; 52};
55 53
diff --git a/arch/powerpc/platforms/52xx/lite5200.c b/arch/powerpc/platforms/52xx/lite5200.c
index 956f459e175c..6d584f4e3c9a 100644
--- a/arch/powerpc/platforms/52xx/lite5200.c
+++ b/arch/powerpc/platforms/52xx/lite5200.c
@@ -63,7 +63,7 @@ lite5200_fix_clock_config(void)
63 of_node_put(np); 63 of_node_put(np);
64 if (!cdm) { 64 if (!cdm) {
65 printk(KERN_ERR "%s() failed; expect abnormal behaviour\n", 65 printk(KERN_ERR "%s() failed; expect abnormal behaviour\n",
66 __FUNCTION__); 66 __func__);
67 return; 67 return;
68 } 68 }
69 69
@@ -98,7 +98,7 @@ lite5200_fix_port_config(void)
98 of_node_put(np); 98 of_node_put(np);
99 if (!gpio) { 99 if (!gpio) {
100 printk(KERN_ERR "%s() failed. expect abnormal behavior\n", 100 printk(KERN_ERR "%s() failed. expect abnormal behavior\n",
101 __FUNCTION__); 101 __func__);
102 return; 102 return;
103 } 103 }
104 104
diff --git a/arch/powerpc/platforms/82xx/Kconfig b/arch/powerpc/platforms/82xx/Kconfig
index 4fad6c7bf9f1..917ac8891555 100644
--- a/arch/powerpc/platforms/82xx/Kconfig
+++ b/arch/powerpc/platforms/82xx/Kconfig
@@ -11,7 +11,6 @@ config MPC8272_ADS
11 select 8260 11 select 8260
12 select FSL_SOC 12 select FSL_SOC
13 select PQ2_ADS_PCI_PIC if PCI 13 select PQ2_ADS_PCI_PIC if PCI
14 select PPC_CPM_NEW_BINDING
15 help 14 help
16 This option enables support for the MPC8272 ADS board 15 This option enables support for the MPC8272 ADS board
17 16
@@ -22,7 +21,6 @@ config PQ2FADS
22 select 8260 21 select 8260
23 select FSL_SOC 22 select FSL_SOC
24 select PQ2_ADS_PCI_PIC if PCI 23 select PQ2_ADS_PCI_PIC if PCI
25 select PPC_CPM_NEW_BINDING
26 help 24 help
27 This option enables support for the PQ2FADS board 25 This option enables support for the PQ2FADS board
28 26
@@ -31,7 +29,6 @@ config EP8248E
31 select 8272 29 select 8272
32 select 8260 30 select 8260
33 select FSL_SOC 31 select FSL_SOC
34 select PPC_CPM_NEW_BINDING
35 select MDIO_BITBANG 32 select MDIO_BITBANG
36 help 33 help
37 This enables support for the Embedded Planet EP8248E board. 34 This enables support for the Embedded Planet EP8248E board.
diff --git a/arch/powerpc/platforms/83xx/mpc837x_rdb.c b/arch/powerpc/platforms/83xx/mpc837x_rdb.c
index 2293ae51383d..c00356bdb1dd 100644
--- a/arch/powerpc/platforms/83xx/mpc837x_rdb.c
+++ b/arch/powerpc/platforms/83xx/mpc837x_rdb.c
@@ -46,6 +46,7 @@ static void __init mpc837x_rdb_setup_arch(void)
46static struct of_device_id mpc837x_ids[] = { 46static struct of_device_id mpc837x_ids[] = {
47 { .type = "soc", }, 47 { .type = "soc", },
48 { .compatible = "soc", }, 48 { .compatible = "soc", },
49 { .compatible = "simple-bus", },
49 {}, 50 {},
50}; 51};
51 52
diff --git a/arch/powerpc/platforms/83xx/mpc83xx.h b/arch/powerpc/platforms/83xx/mpc83xx.h
index 68065e62fc3d..88a3b5cabb18 100644
--- a/arch/powerpc/platforms/83xx/mpc83xx.h
+++ b/arch/powerpc/platforms/83xx/mpc83xx.h
@@ -16,6 +16,7 @@
16#define MPC83XX_SCCR_USB_DRCM_10 0x00200000 16#define MPC83XX_SCCR_USB_DRCM_10 0x00200000
17#define MPC8315_SCCR_USB_MASK 0x00c00000 17#define MPC8315_SCCR_USB_MASK 0x00c00000
18#define MPC8315_SCCR_USB_DRCM_11 0x00c00000 18#define MPC8315_SCCR_USB_DRCM_11 0x00c00000
19#define MPC8315_SCCR_USB_DRCM_01 0x00400000
19#define MPC837X_SCCR_USB_DRCM_11 0x00c00000 20#define MPC837X_SCCR_USB_DRCM_11 0x00c00000
20 21
21/* system i/o configuration register low */ 22/* system i/o configuration register low */
@@ -37,6 +38,7 @@
37/* USB Control Register */ 38/* USB Control Register */
38#define FSL_USB2_CONTROL_OFFS 0x500 39#define FSL_USB2_CONTROL_OFFS 0x500
39#define CONTROL_UTMI_PHY_EN 0x00000200 40#define CONTROL_UTMI_PHY_EN 0x00000200
41#define CONTROL_REFSEL_24MHZ 0x00000040
40#define CONTROL_REFSEL_48MHZ 0x00000080 42#define CONTROL_REFSEL_48MHZ 0x00000080
41#define CONTROL_PHY_CLK_SEL_ULPI 0x00000400 43#define CONTROL_PHY_CLK_SEL_ULPI 0x00000400
42#define CONTROL_OTG_PORT 0x00000020 44#define CONTROL_OTG_PORT 0x00000020
diff --git a/arch/powerpc/platforms/83xx/usb.c b/arch/powerpc/platforms/83xx/usb.c
index 471fdd8f4108..64bcf0a33c71 100644
--- a/arch/powerpc/platforms/83xx/usb.c
+++ b/arch/powerpc/platforms/83xx/usb.c
@@ -129,7 +129,7 @@ int mpc831x_usb_cfg(void)
129 if (immr_node && of_device_is_compatible(immr_node, "fsl,mpc8315-immr")) 129 if (immr_node && of_device_is_compatible(immr_node, "fsl,mpc8315-immr"))
130 clrsetbits_be32(immap + MPC83XX_SCCR_OFFS, 130 clrsetbits_be32(immap + MPC83XX_SCCR_OFFS,
131 MPC8315_SCCR_USB_MASK, 131 MPC8315_SCCR_USB_MASK,
132 MPC8315_SCCR_USB_DRCM_11); 132 MPC8315_SCCR_USB_DRCM_01);
133 else 133 else
134 clrsetbits_be32(immap + MPC83XX_SCCR_OFFS, 134 clrsetbits_be32(immap + MPC83XX_SCCR_OFFS,
135 MPC83XX_SCCR_USB_MASK, 135 MPC83XX_SCCR_USB_MASK,
@@ -164,9 +164,15 @@ int mpc831x_usb_cfg(void)
164 /* Using on-chip PHY */ 164 /* Using on-chip PHY */
165 if (prop && (!strcmp(prop, "utmi_wide") || 165 if (prop && (!strcmp(prop, "utmi_wide") ||
166 !strcmp(prop, "utmi"))) { 166 !strcmp(prop, "utmi"))) {
167 /* Set UTMI_PHY_EN, REFSEL to 48MHZ */ 167 u32 refsel;
168
169 if (of_device_is_compatible(immr_node, "fsl,mpc8315-immr"))
170 refsel = CONTROL_REFSEL_24MHZ;
171 else
172 refsel = CONTROL_REFSEL_48MHZ;
173 /* Set UTMI_PHY_EN and REFSEL */
168 out_be32(usb_regs + FSL_USB2_CONTROL_OFFS, 174 out_be32(usb_regs + FSL_USB2_CONTROL_OFFS,
169 CONTROL_UTMI_PHY_EN | CONTROL_REFSEL_48MHZ); 175 CONTROL_UTMI_PHY_EN | refsel);
170 /* Using external UPLI PHY */ 176 /* Using external UPLI PHY */
171 } else if (prop && !strcmp(prop, "ulpi")) { 177 } else if (prop && !strcmp(prop, "ulpi")) {
172 /* Set PHY_CLK_SEL to ULPI */ 178 /* Set PHY_CLK_SEL to ULPI */
diff --git a/arch/powerpc/platforms/85xx/Kconfig b/arch/powerpc/platforms/85xx/Kconfig
index 7e76ddbd5821..7ff29d53dc2d 100644
--- a/arch/powerpc/platforms/85xx/Kconfig
+++ b/arch/powerpc/platforms/85xx/Kconfig
@@ -19,7 +19,6 @@ config MPC8540_ADS
19config MPC8560_ADS 19config MPC8560_ADS
20 bool "Freescale MPC8560 ADS" 20 bool "Freescale MPC8560 ADS"
21 select DEFAULT_UIMAGE 21 select DEFAULT_UIMAGE
22 select PPC_CPM_NEW_BINDING
23 select CPM2 22 select CPM2
24 help 23 help
25 This option enables support for the MPC 8560 ADS board 24 This option enables support for the MPC 8560 ADS board
@@ -46,6 +45,12 @@ config MPC85xx_DS
46 help 45 help
47 This option enables support for the MPC85xx DS (MPC8544 DS) board 46 This option enables support for the MPC85xx DS (MPC8544 DS) board
48 47
48config KSI8560
49 bool "Emerson KSI8560"
50 select DEFAULT_UIMAGE
51 help
52 This option enables support for the Emerson KSI8560 board
53
49config STX_GP3 54config STX_GP3
50 bool "Silicon Turnkey Express GP3" 55 bool "Silicon Turnkey Express GP3"
51 help 56 help
@@ -53,14 +58,12 @@ config STX_GP3
53 board. 58 board.
54 select CPM2 59 select CPM2
55 select DEFAULT_UIMAGE 60 select DEFAULT_UIMAGE
56 select PPC_CPM_NEW_BINDING
57 61
58config TQM8540 62config TQM8540
59 bool "TQ Components TQM8540" 63 bool "TQ Components TQM8540"
60 help 64 help
61 This option enables support for the TQ Components TQM8540 board. 65 This option enables support for the TQ Components TQM8540 board.
62 select DEFAULT_UIMAGE 66 select DEFAULT_UIMAGE
63 select PPC_CPM_NEW_BINDING
64 select TQM85xx 67 select TQM85xx
65 68
66config TQM8541 69config TQM8541
@@ -68,7 +71,6 @@ config TQM8541
68 help 71 help
69 This option enables support for the TQ Components TQM8541 board. 72 This option enables support for the TQ Components TQM8541 board.
70 select DEFAULT_UIMAGE 73 select DEFAULT_UIMAGE
71 select PPC_CPM_NEW_BINDING
72 select TQM85xx 74 select TQM85xx
73 select CPM2 75 select CPM2
74 76
@@ -77,7 +79,6 @@ config TQM8555
77 help 79 help
78 This option enables support for the TQ Components TQM8555 board. 80 This option enables support for the TQ Components TQM8555 board.
79 select DEFAULT_UIMAGE 81 select DEFAULT_UIMAGE
80 select PPC_CPM_NEW_BINDING
81 select TQM85xx 82 select TQM85xx
82 select CPM2 83 select CPM2
83 84
@@ -86,7 +87,6 @@ config TQM8560
86 help 87 help
87 This option enables support for the TQ Components TQM8560 board. 88 This option enables support for the TQ Components TQM8560 board.
88 select DEFAULT_UIMAGE 89 select DEFAULT_UIMAGE
89 select PPC_CPM_NEW_BINDING
90 select TQM85xx 90 select TQM85xx
91 select CPM2 91 select CPM2
92 92
@@ -99,7 +99,6 @@ config SBC8548
99config SBC8560 99config SBC8560
100 bool "Wind River SBC8560" 100 bool "Wind River SBC8560"
101 select DEFAULT_UIMAGE 101 select DEFAULT_UIMAGE
102 select PPC_CPM_NEW_BINDING if CPM2
103 help 102 help
104 This option enables support for the Wind River SBC8560 board 103 This option enables support for the Wind River SBC8560 board
105 104
diff --git a/arch/powerpc/platforms/85xx/Makefile b/arch/powerpc/platforms/85xx/Makefile
index cb7af4ebd75f..6cea185f62b2 100644
--- a/arch/powerpc/platforms/85xx/Makefile
+++ b/arch/powerpc/platforms/85xx/Makefile
@@ -10,3 +10,4 @@ obj-$(CONFIG_STX_GP3) += stx_gp3.o
10obj-$(CONFIG_TQM85xx) += tqm85xx.o 10obj-$(CONFIG_TQM85xx) += tqm85xx.o
11obj-$(CONFIG_SBC8560) += sbc8560.o 11obj-$(CONFIG_SBC8560) += sbc8560.o
12obj-$(CONFIG_SBC8548) += sbc8548.o 12obj-$(CONFIG_SBC8548) += sbc8548.o
13obj-$(CONFIG_KSI8560) += ksi8560.o
diff --git a/arch/powerpc/platforms/85xx/ksi8560.c b/arch/powerpc/platforms/85xx/ksi8560.c
new file mode 100644
index 000000000000..2145adeb220c
--- /dev/null
+++ b/arch/powerpc/platforms/85xx/ksi8560.c
@@ -0,0 +1,257 @@
1/*
2 * Board setup routines for the Emerson KSI8560
3 *
4 * Author: Alexandr Smirnov <asmirnov@ru.mvista.com>
5 *
6 * Based on mpc85xx_ads.c maintained by Kumar Gala
7 *
8 * 2008 (c) MontaVista, Software, Inc. This file is licensed under
9 * the terms of the GNU General Public License version 2. This program
10 * is licensed "as is" without any warranty of any kind, whether express
11 * or implied.
12 *
13 */
14
15#include <linux/stddef.h>
16#include <linux/kernel.h>
17#include <linux/pci.h>
18#include <linux/kdev_t.h>
19#include <linux/delay.h>
20#include <linux/seq_file.h>
21#include <linux/of_platform.h>
22
23#include <asm/system.h>
24#include <asm/time.h>
25#include <asm/machdep.h>
26#include <asm/pci-bridge.h>
27#include <asm/mpic.h>
28#include <mm/mmu_decl.h>
29#include <asm/udbg.h>
30#include <asm/prom.h>
31
32#include <sysdev/fsl_soc.h>
33#include <sysdev/fsl_pci.h>
34
35#include <asm/cpm2.h>
36#include <sysdev/cpm2_pic.h>
37
38
39#define KSI8560_CPLD_HVR 0x04 /* Hardware Version Register */
40#define KSI8560_CPLD_PVR 0x08 /* PLD Version Register */
41#define KSI8560_CPLD_RCR1 0x30 /* Reset Command Register 1 */
42
43#define KSI8560_CPLD_RCR1_CPUHR 0x80 /* CPU Hard Reset */
44
45static void __iomem *cpld_base = NULL;
46
47static void machine_restart(char *cmd)
48{
49 if (cpld_base)
50 out_8(cpld_base + KSI8560_CPLD_RCR1, KSI8560_CPLD_RCR1_CPUHR);
51 else
52 printk(KERN_ERR "Can't find CPLD base, hang forever\n");
53
54 for (;;);
55}
56
57static void cpm2_cascade(unsigned int irq, struct irq_desc *desc)
58{
59 int cascade_irq;
60
61 while ((cascade_irq = cpm2_get_irq()) >= 0)
62 generic_handle_irq(cascade_irq);
63
64 desc->chip->eoi(irq);
65}
66
67static void __init ksi8560_pic_init(void)
68{
69 struct mpic *mpic;
70 struct resource r;
71 struct device_node *np;
72#ifdef CONFIG_CPM2
73 int irq;
74#endif
75
76 np = of_find_node_by_type(NULL, "open-pic");
77
78 if (np == NULL) {
79 printk(KERN_ERR "Could not find open-pic node\n");
80 return;
81 }
82
83 if (of_address_to_resource(np, 0, &r)) {
84 printk(KERN_ERR "Could not map mpic register space\n");
85 of_node_put(np);
86 return;
87 }
88
89 mpic = mpic_alloc(np, r.start,
90 MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN,
91 0, 256, " OpenPIC ");
92 BUG_ON(mpic == NULL);
93 of_node_put(np);
94
95 mpic_init(mpic);
96
97#ifdef CONFIG_CPM2
98 /* Setup CPM2 PIC */
99 np = of_find_compatible_node(NULL, NULL, "fsl,cpm2-pic");
100 if (np == NULL) {
101 printk(KERN_ERR "PIC init: can not find fsl,cpm2-pic node\n");
102 return;
103 }
104 irq = irq_of_parse_and_map(np, 0);
105
106 cpm2_pic_init(np);
107 of_node_put(np);
108 set_irq_chained_handler(irq, cpm2_cascade);
109
110 setup_irq(0, NULL);
111#endif
112}
113
114#ifdef CONFIG_CPM2
115/*
116 * Setup I/O ports
117 */
118struct cpm_pin {
119 int port, pin, flags;
120};
121
122static struct cpm_pin __initdata ksi8560_pins[] = {
123 /* SCC1 */
124 {3, 29, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
125 {3, 30, CPM_PIN_OUTPUT | CPM_PIN_SECONDARY},
126 {3, 31, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
127
128 /* SCC2 */
129 {3, 26, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
130 {3, 27, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
131 {3, 28, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
132
133 /* FCC1 */
134 {0, 14, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
135 {0, 15, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
136 {0, 16, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
137 {0, 17, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
138 {0, 18, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
139 {0, 19, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
140 {0, 20, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
141 {0, 21, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
142 {0, 26, CPM_PIN_INPUT | CPM_PIN_SECONDARY},
143 {0, 27, CPM_PIN_INPUT | CPM_PIN_SECONDARY},
144 {0, 28, CPM_PIN_OUTPUT | CPM_PIN_SECONDARY},
145 {0, 29, CPM_PIN_OUTPUT | CPM_PIN_SECONDARY},
146 {0, 30, CPM_PIN_INPUT | CPM_PIN_SECONDARY},
147 {0, 31, CPM_PIN_INPUT | CPM_PIN_SECONDARY},
148 {2, 23, CPM_PIN_INPUT | CPM_PIN_PRIMARY}, /* CLK9 */
149 {2, 22, CPM_PIN_INPUT | CPM_PIN_PRIMARY}, /* CLK10 */
150
151};
152
153static void __init init_ioports(void)
154{
155 int i;
156
157 for (i = 0; i < ARRAY_SIZE(ksi8560_pins); i++) {
158 struct cpm_pin *pin = &ksi8560_pins[i];
159 cpm2_set_pin(pin->port, pin->pin, pin->flags);
160 }
161
162 cpm2_clk_setup(CPM_CLK_SCC1, CPM_BRG1, CPM_CLK_RX);
163 cpm2_clk_setup(CPM_CLK_SCC1, CPM_BRG1, CPM_CLK_TX);
164 cpm2_clk_setup(CPM_CLK_SCC2, CPM_BRG2, CPM_CLK_RX);
165 cpm2_clk_setup(CPM_CLK_SCC2, CPM_BRG2, CPM_CLK_TX);
166 cpm2_clk_setup(CPM_CLK_FCC1, CPM_CLK9, CPM_CLK_RX);
167 cpm2_clk_setup(CPM_CLK_FCC1, CPM_CLK10, CPM_CLK_TX);
168}
169#endif
170
171/*
172 * Setup the architecture
173 */
174static void __init ksi8560_setup_arch(void)
175{
176 struct device_node *cpld;
177
178 cpld = of_find_compatible_node(NULL, NULL, "emerson,KSI8560-cpld");
179 if (cpld)
180 cpld_base = of_iomap(cpld, 0);
181 else
182 printk(KERN_ERR "Can't find CPLD in device tree\n");
183
184 if (ppc_md.progress)
185 ppc_md.progress("ksi8560_setup_arch()", 0);
186
187#ifdef CONFIG_CPM2
188 cpm2_reset();
189 init_ioports();
190#endif
191}
192
193static void ksi8560_show_cpuinfo(struct seq_file *m)
194{
195 uint pvid, svid, phid1;
196 uint memsize = total_memory;
197
198 pvid = mfspr(SPRN_PVR);
199 svid = mfspr(SPRN_SVR);
200
201 seq_printf(m, "Vendor\t\t: Emerson Network Power\n");
202 seq_printf(m, "Board\t\t: KSI8560\n");
203
204 if (cpld_base) {
205 seq_printf(m, "Hardware rev\t: %d\n",
206 in_8(cpld_base + KSI8560_CPLD_HVR));
207 seq_printf(m, "CPLD rev\t: %d\n",
208 in_8(cpld_base + KSI8560_CPLD_PVR));
209 } else
210 seq_printf(m, "Unknown Hardware and CPLD revs\n");
211
212 seq_printf(m, "PVR\t\t: 0x%x\n", pvid);
213 seq_printf(m, "SVR\t\t: 0x%x\n", svid);
214
215 /* Display cpu Pll setting */
216 phid1 = mfspr(SPRN_HID1);
217 seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
218
219 /* Display the amount of memory */
220 seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024));
221}
222
223static struct of_device_id __initdata of_bus_ids[] = {
224 { .type = "soc", },
225 { .name = "cpm", },
226 { .name = "localbus", },
227 {},
228};
229
230static int __init declare_of_platform_devices(void)
231{
232 of_platform_bus_probe(NULL, of_bus_ids, NULL);
233
234 return 0;
235}
236machine_device_initcall(ksi8560, declare_of_platform_devices);
237
238/*
239 * Called very early, device-tree isn't unflattened
240 */
241static int __init ksi8560_probe(void)
242{
243 unsigned long root = of_get_flat_dt_root();
244
245 return of_flat_dt_is_compatible(root, "emerson,KSI8560");
246}
247
248define_machine(ksi8560) {
249 .name = "KSI8560",
250 .probe = ksi8560_probe,
251 .setup_arch = ksi8560_setup_arch,
252 .init_IRQ = ksi8560_pic_init,
253 .show_cpuinfo = ksi8560_show_cpuinfo,
254 .get_irq = mpic_get_irq,
255 .restart = machine_restart,
256 .calibrate_decr = generic_calibrate_decr,
257};
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ads.c b/arch/powerpc/platforms/85xx/mpc85xx_ads.c
index 4e0305096114..3582c841844b 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_ads.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_ads.c
@@ -165,7 +165,7 @@ static void __init init_ioports(void)
165 int i; 165 int i;
166 166
167 for (i = 0; i < ARRAY_SIZE(mpc8560_ads_pins); i++) { 167 for (i = 0; i < ARRAY_SIZE(mpc8560_ads_pins); i++) {
168 struct cpm_pin *pin = &mpc8560_ads_pins[i]; 168 const struct cpm_pin *pin = &mpc8560_ads_pins[i];
169 cpm2_set_pin(pin->port, pin->pin, pin->flags); 169 cpm2_set_pin(pin->port, pin->pin, pin->flags);
170 } 170 }
171 171
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ds.c b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
index bdb3d0b38cd2..dfd8b4ad9b28 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_ds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
@@ -19,6 +19,7 @@
19#include <linux/delay.h> 19#include <linux/delay.h>
20#include <linux/seq_file.h> 20#include <linux/seq_file.h>
21#include <linux/interrupt.h> 21#include <linux/interrupt.h>
22#include <linux/of_platform.h>
22 23
23#include <asm/system.h> 24#include <asm/system.h>
24#include <asm/time.h> 25#include <asm/time.h>
@@ -36,7 +37,7 @@
36#undef DEBUG 37#undef DEBUG
37 38
38#ifdef DEBUG 39#ifdef DEBUG
39#define DBG(fmt, args...) printk(KERN_ERR "%s: " fmt, __FUNCTION__, ## args) 40#define DBG(fmt, args...) printk(KERN_ERR "%s: " fmt, __func__, ## args)
40#else 41#else
41#define DBG(fmt, args...) 42#define DBG(fmt, args...)
42#endif 43#endif
@@ -183,6 +184,18 @@ static int __init mpc8544_ds_probe(void)
183 } 184 }
184} 185}
185 186
187static struct of_device_id mpc85xxds_ids[] = {
188 { .type = "soc", },
189 { .compatible = "soc", },
190 {},
191};
192
193static int __init mpc85xxds_publish_devices(void)
194{
195 return of_platform_bus_probe(NULL, mpc85xxds_ids, NULL);
196}
197machine_device_initcall(mpc8544_ds, mpc85xxds_publish_devices);
198
186/* 199/*
187 * Called very early, device-tree isn't unflattened 200 * Called very early, device-tree isn't unflattened
188 */ 201 */
diff --git a/arch/powerpc/platforms/86xx/Kconfig b/arch/powerpc/platforms/86xx/Kconfig
index 21d113536b86..7442c58d44f5 100644
--- a/arch/powerpc/platforms/86xx/Kconfig
+++ b/arch/powerpc/platforms/86xx/Kconfig
@@ -11,6 +11,12 @@ config MPC8641_HPCN
11 help 11 help
12 This option enables support for the MPC8641 HPCN board. 12 This option enables support for the MPC8641 HPCN board.
13 13
14config SBC8641D
15 bool "Wind River SBC8641D"
16 select DEFAULT_UIMAGE
17 help
18 This option enables support for the WRS SBC8641D board.
19
14config MPC8610_HPCD 20config MPC8610_HPCD
15 bool "Freescale MPC8610 HPCD" 21 bool "Freescale MPC8610 HPCD"
16 select DEFAULT_UIMAGE 22 select DEFAULT_UIMAGE
@@ -24,7 +30,7 @@ config MPC8641
24 select FSL_PCI if PCI 30 select FSL_PCI if PCI
25 select PPC_UDBG_16550 31 select PPC_UDBG_16550
26 select MPIC 32 select MPIC
27 default y if MPC8641_HPCN 33 default y if MPC8641_HPCN || SBC8641D
28 34
29config MPC8610 35config MPC8610
30 bool 36 bool
diff --git a/arch/powerpc/platforms/86xx/Makefile b/arch/powerpc/platforms/86xx/Makefile
index c96706327eaa..1b9b4a9b2525 100644
--- a/arch/powerpc/platforms/86xx/Makefile
+++ b/arch/powerpc/platforms/86xx/Makefile
@@ -4,4 +4,5 @@
4 4
5obj-$(CONFIG_SMP) += mpc86xx_smp.o 5obj-$(CONFIG_SMP) += mpc86xx_smp.o
6obj-$(CONFIG_MPC8641_HPCN) += mpc86xx_hpcn.o 6obj-$(CONFIG_MPC8641_HPCN) += mpc86xx_hpcn.o
7obj-$(CONFIG_SBC8641D) += sbc8641d.o
7obj-$(CONFIG_MPC8610_HPCD) += mpc8610_hpcd.o 8obj-$(CONFIG_MPC8610_HPCD) += mpc8610_hpcd.o
diff --git a/arch/powerpc/platforms/86xx/mpc8610_hpcd.c b/arch/powerpc/platforms/86xx/mpc8610_hpcd.c
index 0b07485641fe..18b8ebe930d5 100644
--- a/arch/powerpc/platforms/86xx/mpc8610_hpcd.c
+++ b/arch/powerpc/platforms/86xx/mpc8610_hpcd.c
@@ -52,7 +52,7 @@ static int __init mpc8610_declare_of_platform_devices(void)
52} 52}
53machine_device_initcall(mpc86xx_hpcd, mpc8610_declare_of_platform_devices); 53machine_device_initcall(mpc86xx_hpcd, mpc8610_declare_of_platform_devices);
54 54
55void __init 55static void __init
56mpc86xx_hpcd_init_irq(void) 56mpc86xx_hpcd_init_irq(void)
57{ 57{
58 struct mpic *mpic1; 58 struct mpic *mpic1;
@@ -200,7 +200,7 @@ static int __init mpc86xx_hpcd_probe(void)
200 return 0; 200 return 0;
201} 201}
202 202
203long __init 203static long __init
204mpc86xx_time_init(void) 204mpc86xx_time_init(void)
205{ 205{
206 unsigned int temp; 206 unsigned int temp;
diff --git a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
index cfbe8c52e263..f947f555fd46 100644
--- a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
+++ b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
@@ -55,7 +55,7 @@ static void mpc86xx_8259_cascade(unsigned int irq, struct irq_desc *desc)
55} 55}
56#endif /* CONFIG_PCI */ 56#endif /* CONFIG_PCI */
57 57
58void __init 58static void __init
59mpc86xx_hpcn_init_irq(void) 59mpc86xx_hpcn_init_irq(void)
60{ 60{
61 struct mpic *mpic1; 61 struct mpic *mpic1;
@@ -162,7 +162,7 @@ mpc86xx_hpcn_setup_arch(void)
162} 162}
163 163
164 164
165void 165static void
166mpc86xx_hpcn_show_cpuinfo(struct seq_file *m) 166mpc86xx_hpcn_show_cpuinfo(struct seq_file *m)
167{ 167{
168 struct device_node *root; 168 struct device_node *root;
@@ -190,13 +190,19 @@ static int __init mpc86xx_hpcn_probe(void)
190{ 190{
191 unsigned long root = of_get_flat_dt_root(); 191 unsigned long root = of_get_flat_dt_root();
192 192
193 if (of_flat_dt_is_compatible(root, "mpc86xx")) 193 if (of_flat_dt_is_compatible(root, "fsl,mpc8641hpcn"))
194 return 1; /* Looks good */ 194 return 1; /* Looks good */
195 195
196 /* Be nice and don't give silent boot death. Delete this in 2.6.27 */
197 if (of_flat_dt_is_compatible(root, "mpc86xx")) {
198 pr_warning("WARNING: your dts/dtb is old. You must update before the next kernel release\n");
199 return 1;
200 }
201
196 return 0; 202 return 0;
197} 203}
198 204
199long __init 205static long __init
200mpc86xx_time_init(void) 206mpc86xx_time_init(void)
201{ 207{
202 unsigned int temp; 208 unsigned int temp;
diff --git a/arch/powerpc/platforms/86xx/sbc8641d.c b/arch/powerpc/platforms/86xx/sbc8641d.c
new file mode 100644
index 000000000000..510a06ef0b55
--- /dev/null
+++ b/arch/powerpc/platforms/86xx/sbc8641d.c
@@ -0,0 +1,164 @@
1/*
2 * SBC8641D board specific routines
3 *
4 * Copyright 2008 Wind River Systems Inc.
5 *
6 * By Paul Gortmaker (see MAINTAINERS for contact information)
7 *
8 * Based largely on the 8641 HPCN support by Freescale Semiconductor Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 */
15
16#include <linux/stddef.h>
17#include <linux/kernel.h>
18#include <linux/pci.h>
19#include <linux/kdev_t.h>
20#include <linux/delay.h>
21#include <linux/seq_file.h>
22#include <linux/of_platform.h>
23
24#include <asm/system.h>
25#include <asm/time.h>
26#include <asm/machdep.h>
27#include <asm/pci-bridge.h>
28#include <asm/mpc86xx.h>
29#include <asm/prom.h>
30#include <mm/mmu_decl.h>
31#include <asm/udbg.h>
32
33#include <asm/mpic.h>
34
35#include <sysdev/fsl_pci.h>
36#include <sysdev/fsl_soc.h>
37
38#include "mpc86xx.h"
39
40static void __init
41sbc8641_init_irq(void)
42{
43 struct mpic *mpic1;
44 struct device_node *np;
45 struct resource res;
46
47 /* Determine PIC address. */
48 np = of_find_node_by_type(NULL, "open-pic");
49 if (np == NULL)
50 return;
51 of_address_to_resource(np, 0, &res);
52
53 /* Alloc mpic structure and per isu has 16 INT entries. */
54 mpic1 = mpic_alloc(np, res.start,
55 MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN,
56 0, 256, " MPIC ");
57 of_node_put(np);
58 BUG_ON(mpic1 == NULL);
59
60 mpic_init(mpic1);
61}
62
63static void __init
64sbc8641_setup_arch(void)
65{
66#ifdef CONFIG_PCI
67 struct device_node *np;
68#endif
69
70 if (ppc_md.progress)
71 ppc_md.progress("sbc8641_setup_arch()", 0);
72
73#ifdef CONFIG_PCI
74 for_each_compatible_node(np, "pci", "fsl,mpc8641-pcie")
75 fsl_add_bridge(np, 0);
76#endif
77
78 printk("SBC8641 board from Wind River\n");
79
80#ifdef CONFIG_SMP
81 mpc86xx_smp_init();
82#endif
83}
84
85
86static void
87sbc8641_show_cpuinfo(struct seq_file *m)
88{
89 struct device_node *root;
90 uint memsize = total_memory;
91 const char *model = "";
92 uint svid = mfspr(SPRN_SVR);
93
94 seq_printf(m, "Vendor\t\t: Wind River Systems\n");
95
96 root = of_find_node_by_path("/");
97 if (root)
98 model = of_get_property(root, "model", NULL);
99 seq_printf(m, "Machine\t\t: %s\n", model);
100 of_node_put(root);
101
102 seq_printf(m, "SVR\t\t: 0x%x\n", svid);
103 seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024));
104}
105
106
107/*
108 * Called very early, device-tree isn't unflattened
109 */
110static int __init sbc8641_probe(void)
111{
112 unsigned long root = of_get_flat_dt_root();
113
114 if (of_flat_dt_is_compatible(root, "wind,sbc8641"))
115 return 1; /* Looks good */
116
117 return 0;
118}
119
120static long __init
121mpc86xx_time_init(void)
122{
123 unsigned int temp;
124
125 /* Set the time base to zero */
126 mtspr(SPRN_TBWL, 0);
127 mtspr(SPRN_TBWU, 0);
128
129 temp = mfspr(SPRN_HID0);
130 temp |= HID0_TBEN;
131 mtspr(SPRN_HID0, temp);
132 asm volatile("isync");
133
134 return 0;
135}
136
137static __initdata struct of_device_id of_bus_ids[] = {
138 { .compatible = "simple-bus", },
139 {},
140};
141
142static int __init declare_of_platform_devices(void)
143{
144 of_platform_bus_probe(NULL, of_bus_ids, NULL);
145
146 return 0;
147}
148machine_device_initcall(sbc8641, declare_of_platform_devices);
149
150define_machine(sbc8641) {
151 .name = "SBC8641D",
152 .probe = sbc8641_probe,
153 .setup_arch = sbc8641_setup_arch,
154 .init_IRQ = sbc8641_init_irq,
155 .show_cpuinfo = sbc8641_show_cpuinfo,
156 .get_irq = mpic_get_irq,
157 .restart = fsl_rstcr_restart,
158 .time_init = mpc86xx_time_init,
159 .calibrate_decr = generic_calibrate_decr,
160 .progress = udbg_progress,
161#ifdef CONFIG_PCI
162 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
163#endif
164};
diff --git a/arch/powerpc/platforms/8xx/Kconfig b/arch/powerpc/platforms/8xx/Kconfig
index 7fd224ca233d..6fc849e51e48 100644
--- a/arch/powerpc/platforms/8xx/Kconfig
+++ b/arch/powerpc/platforms/8xx/Kconfig
@@ -18,7 +18,6 @@ config MPC8XXFADS
18config MPC86XADS 18config MPC86XADS
19 bool "MPC86XADS" 19 bool "MPC86XADS"
20 select CPM1 20 select CPM1
21 select PPC_CPM_NEW_BINDING
22 help 21 help
23 MPC86x Application Development System by Freescale Semiconductor. 22 MPC86x Application Development System by Freescale Semiconductor.
24 The MPC86xADS is meant to serve as a platform for s/w and h/w 23 The MPC86xADS is meant to serve as a platform for s/w and h/w
@@ -27,7 +26,6 @@ config MPC86XADS
27config MPC885ADS 26config MPC885ADS
28 bool "MPC885ADS" 27 bool "MPC885ADS"
29 select CPM1 28 select CPM1
30 select PPC_CPM_NEW_BINDING
31 help 29 help
32 Freescale Semiconductor MPC885 Application Development System (ADS). 30 Freescale Semiconductor MPC885 Application Development System (ADS).
33 Also known as DUET. 31 Also known as DUET.
@@ -37,7 +35,6 @@ config MPC885ADS
37config PPC_EP88XC 35config PPC_EP88XC
38 bool "Embedded Planet EP88xC (a.k.a. CWH-PPC-885XN-VE)" 36 bool "Embedded Planet EP88xC (a.k.a. CWH-PPC-885XN-VE)"
39 select CPM1 37 select CPM1
40 select PPC_CPM_NEW_BINDING
41 help 38 help
42 This enables support for the Embedded Planet EP88xC board. 39 This enables support for the Embedded Planet EP88xC board.
43 40
@@ -47,7 +44,6 @@ config PPC_EP88XC
47config PPC_ADDER875 44config PPC_ADDER875
48 bool "Analogue & Micro Adder 875" 45 bool "Analogue & Micro Adder 875"
49 select CPM1 46 select CPM1
50 select PPC_CPM_NEW_BINDING
51 select REDBOOT 47 select REDBOOT
52 help 48 help
53 This enables support for the Analogue & Micro Adder 875 49 This enables support for the Analogue & Micro Adder 875
diff --git a/arch/powerpc/platforms/8xx/m8xx_setup.c b/arch/powerpc/platforms/8xx/m8xx_setup.c
index 184f998d1be2..0d9f75c74f8c 100644
--- a/arch/powerpc/platforms/8xx/m8xx_setup.c
+++ b/arch/powerpc/platforms/8xx/m8xx_setup.c
@@ -111,17 +111,12 @@ void __init mpc8xx_calibrate_decr(void)
111 111
112 /* Processor frequency is MHz. 112 /* Processor frequency is MHz.
113 */ 113 */
114 ppc_tb_freq = 50000000;
115 if (!get_freq("bus-frequency", &ppc_tb_freq)) {
116 printk(KERN_ERR "WARNING: Estimating decrementer frequency "
117 "(not found)\n");
118 }
119 ppc_tb_freq /= 16;
120 ppc_proc_freq = 50000000; 114 ppc_proc_freq = 50000000;
121 if (!get_freq("clock-frequency", &ppc_proc_freq)) 115 if (!get_freq("clock-frequency", &ppc_proc_freq))
122 printk(KERN_ERR "WARNING: Estimating processor frequency " 116 printk(KERN_ERR "WARNING: Estimating processor frequency "
123 "(not found)\n"); 117 "(not found)\n");
124 118
119 ppc_tb_freq = ppc_proc_freq / 16;
125 printk("Decrementer Frequency = 0x%lx\n", ppc_tb_freq); 120 printk("Decrementer Frequency = 0x%lx\n", ppc_tb_freq);
126 121
127 /* Perform some more timer/timebase initialization. This used 122 /* Perform some more timer/timebase initialization. This used
diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig
index a578b966ecbc..f38c50b4ce56 100644
--- a/arch/powerpc/platforms/Kconfig
+++ b/arch/powerpc/platforms/Kconfig
@@ -290,13 +290,7 @@ config CPM2
290config PPC_CPM_NEW_BINDING 290config PPC_CPM_NEW_BINDING
291 bool 291 bool
292 depends on CPM1 || CPM2 292 depends on CPM1 || CPM2
293 help 293 default y
294 Select this if your board has been converted to use the new
295 device tree bindings for CPM, and no longer needs the
296 ioport callbacks or the platform device glue code.
297
298 The fs_enet and cpm_uart drivers will be built as
299 of_platform devices.
300 294
301config AXON_RAM 295config AXON_RAM
302 tristate "Axon DDR2 memory device driver" 296 tristate "Axon DDR2 memory device driver"
diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
index 0c3face0ddbb..5fc7fac10e93 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -41,11 +41,13 @@ config 40x
41 bool "AMCC 40x" 41 bool "AMCC 40x"
42 select PPC_DCR_NATIVE 42 select PPC_DCR_NATIVE
43 select PPC_UDBG_16550 43 select PPC_UDBG_16550
44 select 4xx_SOC
44 45
45config 44x 46config 44x
46 bool "AMCC 44x" 47 bool "AMCC 44x"
47 select PPC_DCR_NATIVE 48 select PPC_DCR_NATIVE
48 select PPC_UDBG_16550 49 select PPC_UDBG_16550
50 select 4xx_SOC
49 51
50config E200 52config E200
51 bool "Freescale e200" 53 bool "Freescale e200"
diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c
index d75ccded7f10..45646b2b4af4 100644
--- a/arch/powerpc/platforms/cell/iommu.c
+++ b/arch/powerpc/platforms/cell/iommu.c
@@ -28,13 +28,13 @@
28#include <linux/notifier.h> 28#include <linux/notifier.h>
29#include <linux/of.h> 29#include <linux/of.h>
30#include <linux/of_platform.h> 30#include <linux/of_platform.h>
31#include <linux/lmb.h>
31 32
32#include <asm/prom.h> 33#include <asm/prom.h>
33#include <asm/iommu.h> 34#include <asm/iommu.h>
34#include <asm/machdep.h> 35#include <asm/machdep.h>
35#include <asm/pci-bridge.h> 36#include <asm/pci-bridge.h>
36#include <asm/udbg.h> 37#include <asm/udbg.h>
37#include <asm/lmb.h>
38#include <asm/firmware.h> 38#include <asm/firmware.h>
39#include <asm/cell-regs.h> 39#include <asm/cell-regs.h>
40 40
@@ -316,7 +316,7 @@ static void cell_iommu_setup_stab(struct cbe_iommu *iommu,
316 segments = max(dbase + dsize, fbase + fsize) >> IO_SEGMENT_SHIFT; 316 segments = max(dbase + dsize, fbase + fsize) >> IO_SEGMENT_SHIFT;
317 317
318 pr_debug("%s: iommu[%d]: segments: %lu\n", 318 pr_debug("%s: iommu[%d]: segments: %lu\n",
319 __FUNCTION__, iommu->nid, segments); 319 __func__, iommu->nid, segments);
320 320
321 /* set up the segment table */ 321 /* set up the segment table */
322 stab_size = segments * sizeof(unsigned long); 322 stab_size = segments * sizeof(unsigned long);
@@ -343,7 +343,7 @@ static unsigned long *cell_iommu_alloc_ptab(struct cbe_iommu *iommu,
343 (1 << 12) / sizeof(unsigned long)); 343 (1 << 12) / sizeof(unsigned long));
344 344
345 ptab_size = segments * pages_per_segment * sizeof(unsigned long); 345 ptab_size = segments * pages_per_segment * sizeof(unsigned long);
346 pr_debug("%s: iommu[%d]: ptab_size: %lu, order: %d\n", __FUNCTION__, 346 pr_debug("%s: iommu[%d]: ptab_size: %lu, order: %d\n", __func__,
347 iommu->nid, ptab_size, get_order(ptab_size)); 347 iommu->nid, ptab_size, get_order(ptab_size));
348 page = alloc_pages_node(iommu->nid, GFP_KERNEL, get_order(ptab_size)); 348 page = alloc_pages_node(iommu->nid, GFP_KERNEL, get_order(ptab_size));
349 BUG_ON(!page); 349 BUG_ON(!page);
@@ -355,7 +355,7 @@ static unsigned long *cell_iommu_alloc_ptab(struct cbe_iommu *iommu,
355 n_pte_pages = (pages_per_segment * sizeof(unsigned long)) >> 12; 355 n_pte_pages = (pages_per_segment * sizeof(unsigned long)) >> 12;
356 356
357 pr_debug("%s: iommu[%d]: stab at %p, ptab at %p, n_pte_pages: %lu\n", 357 pr_debug("%s: iommu[%d]: stab at %p, ptab at %p, n_pte_pages: %lu\n",
358 __FUNCTION__, iommu->nid, iommu->stab, ptab, 358 __func__, iommu->nid, iommu->stab, ptab,
359 n_pte_pages); 359 n_pte_pages);
360 360
361 /* initialise the STEs */ 361 /* initialise the STEs */
@@ -394,7 +394,7 @@ static void cell_iommu_enable_hardware(struct cbe_iommu *iommu)
394 394
395 if (cell_iommu_find_ioc(iommu->nid, &xlate_base)) 395 if (cell_iommu_find_ioc(iommu->nid, &xlate_base))
396 panic("%s: missing IOC register mappings for node %d\n", 396 panic("%s: missing IOC register mappings for node %d\n",
397 __FUNCTION__, iommu->nid); 397 __func__, iommu->nid);
398 398
399 iommu->xlate_regs = ioremap(xlate_base, IOC_Reg_Size); 399 iommu->xlate_regs = ioremap(xlate_base, IOC_Reg_Size);
400 iommu->cmd_regs = iommu->xlate_regs + IOC_IOCmd_Offset; 400 iommu->cmd_regs = iommu->xlate_regs + IOC_IOCmd_Offset;
diff --git a/arch/powerpc/platforms/cell/pervasive.c b/arch/powerpc/platforms/cell/pervasive.c
index 0304589c0a80..8a3631ce912b 100644
--- a/arch/powerpc/platforms/cell/pervasive.c
+++ b/arch/powerpc/platforms/cell/pervasive.c
@@ -65,7 +65,7 @@ static void cbe_power_save(void)
65 break; 65 break;
66 default: 66 default:
67 printk(KERN_WARNING "%s: unknown configuration\n", 67 printk(KERN_WARNING "%s: unknown configuration\n",
68 __FUNCTION__); 68 __func__);
69 break; 69 break;
70 } 70 }
71 mtspr(SPRN_TSC_CELL, thread_switch_control); 71 mtspr(SPRN_TSC_CELL, thread_switch_control);
diff --git a/arch/powerpc/platforms/cell/ras.c b/arch/powerpc/platforms/cell/ras.c
index e43024c0392e..655704ad03cf 100644
--- a/arch/powerpc/platforms/cell/ras.c
+++ b/arch/powerpc/platforms/cell/ras.c
@@ -132,7 +132,7 @@ static int __init cbe_ptcal_enable_on_node(int nid, int order)
132 (unsigned int)(addr >> 32), 132 (unsigned int)(addr >> 32),
133 (unsigned int)(addr & 0xffffffff))) { 133 (unsigned int)(addr & 0xffffffff))) {
134 printk(KERN_ERR "%s: error enabling PTCAL on node %d!\n", 134 printk(KERN_ERR "%s: error enabling PTCAL on node %d!\n",
135 __FUNCTION__, nid); 135 __func__, nid);
136 goto out_free_pages; 136 goto out_free_pages;
137 } 137 }
138 138
@@ -162,7 +162,7 @@ static int __init cbe_ptcal_enable(void)
162 if (!size) 162 if (!size)
163 return -ENODEV; 163 return -ENODEV;
164 164
165 pr_debug("%s: enabling PTCAL, size = 0x%x\n", __FUNCTION__, *size); 165 pr_debug("%s: enabling PTCAL, size = 0x%x\n", __func__, *size);
166 order = get_order(*size); 166 order = get_order(*size);
167 of_node_put(np); 167 of_node_put(np);
168 168
@@ -180,7 +180,7 @@ static int __init cbe_ptcal_enable(void)
180 const u32 *nid = of_get_property(np, "node-id", NULL); 180 const u32 *nid = of_get_property(np, "node-id", NULL);
181 if (!nid) { 181 if (!nid) {
182 printk(KERN_ERR "%s: node %s is missing node-id?\n", 182 printk(KERN_ERR "%s: node %s is missing node-id?\n",
183 __FUNCTION__, np->full_name); 183 __func__, np->full_name);
184 continue; 184 continue;
185 } 185 }
186 cbe_ptcal_enable_on_node(*nid, order); 186 cbe_ptcal_enable_on_node(*nid, order);
@@ -195,13 +195,13 @@ static int cbe_ptcal_disable(void)
195 struct ptcal_area *area, *tmp; 195 struct ptcal_area *area, *tmp;
196 int ret = 0; 196 int ret = 0;
197 197
198 pr_debug("%s: disabling PTCAL\n", __FUNCTION__); 198 pr_debug("%s: disabling PTCAL\n", __func__);
199 199
200 list_for_each_entry_safe(area, tmp, &ptcal_list, list) { 200 list_for_each_entry_safe(area, tmp, &ptcal_list, list) {
201 /* disable ptcal on this node */ 201 /* disable ptcal on this node */
202 if (rtas_call(ptcal_stop_tok, 1, 1, NULL, area->nid)) { 202 if (rtas_call(ptcal_stop_tok, 1, 1, NULL, area->nid)) {
203 printk(KERN_ERR "%s: error disabling PTCAL " 203 printk(KERN_ERR "%s: error disabling PTCAL "
204 "on node %d!\n", __FUNCTION__, 204 "on node %d!\n", __func__,
205 area->nid); 205 area->nid);
206 ret = -EIO; 206 ret = -EIO;
207 continue; 207 continue;
diff --git a/arch/powerpc/platforms/cell/spu_base.c b/arch/powerpc/platforms/cell/spu_base.c
index 712001f6b7da..6bab44b7716b 100644
--- a/arch/powerpc/platforms/cell/spu_base.c
+++ b/arch/powerpc/platforms/cell/spu_base.c
@@ -165,7 +165,7 @@ static int __spu_trap_data_seg(struct spu *spu, unsigned long ea)
165 struct spu_slb slb; 165 struct spu_slb slb;
166 int psize; 166 int psize;
167 167
168 pr_debug("%s\n", __FUNCTION__); 168 pr_debug("%s\n", __func__);
169 169
170 slb.esid = (ea & ESID_MASK) | SLB_ESID_V; 170 slb.esid = (ea & ESID_MASK) | SLB_ESID_V;
171 171
@@ -215,7 +215,7 @@ static int __spu_trap_data_seg(struct spu *spu, unsigned long ea)
215extern int hash_page(unsigned long ea, unsigned long access, unsigned long trap); //XXX 215extern int hash_page(unsigned long ea, unsigned long access, unsigned long trap); //XXX
216static int __spu_trap_data_map(struct spu *spu, unsigned long ea, u64 dsisr) 216static int __spu_trap_data_map(struct spu *spu, unsigned long ea, u64 dsisr)
217{ 217{
218 pr_debug("%s, %lx, %lx\n", __FUNCTION__, dsisr, ea); 218 pr_debug("%s, %lx, %lx\n", __func__, dsisr, ea);
219 219
220 /* Handle kernel space hash faults immediately. 220 /* Handle kernel space hash faults immediately.
221 User hash faults need to be deferred to process context. */ 221 User hash faults need to be deferred to process context. */
@@ -351,7 +351,7 @@ spu_irq_class_1(int irq, void *data)
351 __spu_trap_data_seg(spu, dar); 351 __spu_trap_data_seg(spu, dar);
352 352
353 spin_unlock(&spu->register_lock); 353 spin_unlock(&spu->register_lock);
354 pr_debug("%s: %lx %lx %lx %lx\n", __FUNCTION__, mask, stat, 354 pr_debug("%s: %lx %lx %lx %lx\n", __func__, mask, stat,
355 dar, dsisr); 355 dar, dsisr);
356 356
357 if (stat & CLASS1_STORAGE_FAULT_INTR) 357 if (stat & CLASS1_STORAGE_FAULT_INTR)
@@ -726,7 +726,7 @@ static int __init init_spu_base(void)
726 726
727 if (ret < 0) { 727 if (ret < 0) {
728 printk(KERN_WARNING "%s: Error initializing spus\n", 728 printk(KERN_WARNING "%s: Error initializing spus\n",
729 __FUNCTION__); 729 __func__);
730 goto out_unregister_sysdev_class; 730 goto out_unregister_sysdev_class;
731 } 731 }
732 732
diff --git a/arch/powerpc/platforms/cell/spu_callbacks.c b/arch/powerpc/platforms/cell/spu_callbacks.c
index dceb8b6a9382..19f6bfdbb933 100644
--- a/arch/powerpc/platforms/cell/spu_callbacks.c
+++ b/arch/powerpc/platforms/cell/spu_callbacks.c
@@ -54,7 +54,7 @@ long spu_sys_callback(struct spu_syscall_block *s)
54 long (*syscall)(u64 a1, u64 a2, u64 a3, u64 a4, u64 a5, u64 a6); 54 long (*syscall)(u64 a1, u64 a2, u64 a3, u64 a4, u64 a5, u64 a6);
55 55
56 if (s->nr_ret >= ARRAY_SIZE(spu_syscall_table)) { 56 if (s->nr_ret >= ARRAY_SIZE(spu_syscall_table)) {
57 pr_debug("%s: invalid syscall #%ld", __FUNCTION__, s->nr_ret); 57 pr_debug("%s: invalid syscall #%ld", __func__, s->nr_ret);
58 return -ENOSYS; 58 return -ENOSYS;
59 } 59 }
60 60
diff --git a/arch/powerpc/platforms/cell/spu_manage.c b/arch/powerpc/platforms/cell/spu_manage.c
index d351bdebf5f1..4c506c1463cd 100644
--- a/arch/powerpc/platforms/cell/spu_manage.c
+++ b/arch/powerpc/platforms/cell/spu_manage.c
@@ -92,7 +92,7 @@ static int __init spu_map_interrupts_old(struct spu *spu,
92 92
93 tmp = of_get_property(np->parent->parent, "node-id", NULL); 93 tmp = of_get_property(np->parent->parent, "node-id", NULL);
94 if (!tmp) { 94 if (!tmp) {
95 printk(KERN_WARNING "%s: can't find node-id\n", __FUNCTION__); 95 printk(KERN_WARNING "%s: can't find node-id\n", __func__);
96 nid = spu->node; 96 nid = spu->node;
97 } else 97 } else
98 nid = tmp[0]; 98 nid = tmp[0];
@@ -296,7 +296,7 @@ static int __init of_enumerate_spus(int (*fn)(void *data))
296 ret = fn(node); 296 ret = fn(node);
297 if (ret) { 297 if (ret) {
298 printk(KERN_WARNING "%s: Error initializing %s\n", 298 printk(KERN_WARNING "%s: Error initializing %s\n",
299 __FUNCTION__, node->name); 299 __func__, node->name);
300 break; 300 break;
301 } 301 }
302 n++; 302 n++;
@@ -327,7 +327,7 @@ static int __init of_create_spu(struct spu *spu, void *data)
327 if (!legacy_map) { 327 if (!legacy_map) {
328 legacy_map = 1; 328 legacy_map = 1;
329 printk(KERN_WARNING "%s: Legacy device tree found, " 329 printk(KERN_WARNING "%s: Legacy device tree found, "
330 "trying to map old style\n", __FUNCTION__); 330 "trying to map old style\n", __func__);
331 } 331 }
332 ret = spu_map_device_old(spu); 332 ret = spu_map_device_old(spu);
333 if (ret) { 333 if (ret) {
@@ -342,7 +342,7 @@ static int __init of_create_spu(struct spu *spu, void *data)
342 if (!legacy_irq) { 342 if (!legacy_irq) {
343 legacy_irq = 1; 343 legacy_irq = 1;
344 printk(KERN_WARNING "%s: Legacy device tree found, " 344 printk(KERN_WARNING "%s: Legacy device tree found, "
345 "trying old style irq\n", __FUNCTION__); 345 "trying old style irq\n", __func__);
346 } 346 }
347 ret = spu_map_interrupts_old(spu, spe); 347 ret = spu_map_interrupts_old(spu, spe);
348 if (ret) { 348 if (ret) {
diff --git a/arch/powerpc/platforms/cell/spufs/coredump.c b/arch/powerpc/platforms/cell/spufs/coredump.c
index 0c6a96b82b2d..b962c3ab470c 100644
--- a/arch/powerpc/platforms/cell/spufs/coredump.c
+++ b/arch/powerpc/platforms/cell/spufs/coredump.c
@@ -133,8 +133,6 @@ static struct spu_context *coredump_next_context(int *fd)
133 if (ctx->flags & SPU_CREATE_NOSCHED) 133 if (ctx->flags & SPU_CREATE_NOSCHED)
134 continue; 134 continue;
135 135
136 /* start searching the next fd next time we're called */
137 (*fd)++;
138 break; 136 break;
139 } 137 }
140 138
@@ -157,6 +155,9 @@ int spufs_coredump_extra_notes_size(void)
157 break; 155 break;
158 156
159 size += rc; 157 size += rc;
158
159 /* start searching the next fd next time */
160 fd++;
160 } 161 }
161 162
162 return size; 163 return size;
@@ -239,6 +240,9 @@ int spufs_coredump_extra_notes_write(struct file *file, loff_t *foffset)
239 } 240 }
240 241
241 spu_release_saved(ctx); 242 spu_release_saved(ctx);
243
244 /* start searching the next fd next time */
245 fd++;
242 } 246 }
243 247
244 return 0; 248 return 0;
diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c
index c7df0a6cfa1b..08f44d1971ac 100644
--- a/arch/powerpc/platforms/cell/spufs/file.c
+++ b/arch/powerpc/platforms/cell/spufs/file.c
@@ -1336,7 +1336,7 @@ static u64 spufs_signal1_type_get(struct spu_context *ctx)
1336 return ctx->ops->signal1_type_get(ctx); 1336 return ctx->ops->signal1_type_get(ctx);
1337} 1337}
1338DEFINE_SPUFS_ATTRIBUTE(spufs_signal1_type, spufs_signal1_type_get, 1338DEFINE_SPUFS_ATTRIBUTE(spufs_signal1_type, spufs_signal1_type_get,
1339 spufs_signal1_type_set, "%llu", SPU_ATTR_ACQUIRE); 1339 spufs_signal1_type_set, "%llu\n", SPU_ATTR_ACQUIRE);
1340 1340
1341 1341
1342static int spufs_signal2_type_set(void *data, u64 val) 1342static int spufs_signal2_type_set(void *data, u64 val)
@@ -1358,7 +1358,7 @@ static u64 spufs_signal2_type_get(struct spu_context *ctx)
1358 return ctx->ops->signal2_type_get(ctx); 1358 return ctx->ops->signal2_type_get(ctx);
1359} 1359}
1360DEFINE_SPUFS_ATTRIBUTE(spufs_signal2_type, spufs_signal2_type_get, 1360DEFINE_SPUFS_ATTRIBUTE(spufs_signal2_type, spufs_signal2_type_get,
1361 spufs_signal2_type_set, "%llu", SPU_ATTR_ACQUIRE); 1361 spufs_signal2_type_set, "%llu\n", SPU_ATTR_ACQUIRE);
1362 1362
1363#if SPUFS_MMAP_4K 1363#if SPUFS_MMAP_4K
1364static unsigned long spufs_mss_mmap_nopfn(struct vm_area_struct *vma, 1364static unsigned long spufs_mss_mmap_nopfn(struct vm_area_struct *vma,
@@ -1555,7 +1555,7 @@ void spufs_mfc_callback(struct spu *spu)
1555 1555
1556 wake_up_all(&ctx->mfc_wq); 1556 wake_up_all(&ctx->mfc_wq);
1557 1557
1558 pr_debug("%s %s\n", __FUNCTION__, spu->name); 1558 pr_debug("%s %s\n", __func__, spu->name);
1559 if (ctx->mfc_fasync) { 1559 if (ctx->mfc_fasync) {
1560 u32 free_elements, tagstatus; 1560 u32 free_elements, tagstatus;
1561 unsigned int mask; 1561 unsigned int mask;
@@ -1789,7 +1789,7 @@ static unsigned int spufs_mfc_poll(struct file *file,poll_table *wait)
1789 if (tagstatus & ctx->tagwait) 1789 if (tagstatus & ctx->tagwait)
1790 mask |= POLLIN | POLLRDNORM; 1790 mask |= POLLIN | POLLRDNORM;
1791 1791
1792 pr_debug("%s: free %d tagstatus %d tagwait %d\n", __FUNCTION__, 1792 pr_debug("%s: free %d tagstatus %d tagwait %d\n", __func__,
1793 free_elements, tagstatus, ctx->tagwait); 1793 free_elements, tagstatus, ctx->tagwait);
1794 1794
1795 return mask; 1795 return mask;
diff --git a/arch/powerpc/platforms/cell/spufs/run.c b/arch/powerpc/platforms/cell/spufs/run.c
index cac69e116776..96bf7c2b86fc 100644
--- a/arch/powerpc/platforms/cell/spufs/run.c
+++ b/arch/powerpc/platforms/cell/spufs/run.c
@@ -98,7 +98,7 @@ static int spu_setup_isolated(struct spu_context *ctx)
98 != MFC_CNTL_PURGE_DMA_COMPLETE) { 98 != MFC_CNTL_PURGE_DMA_COMPLETE) {
99 if (time_after(jiffies, timeout)) { 99 if (time_after(jiffies, timeout)) {
100 printk(KERN_ERR "%s: timeout flushing MFC DMA queue\n", 100 printk(KERN_ERR "%s: timeout flushing MFC DMA queue\n",
101 __FUNCTION__); 101 __func__);
102 ret = -EIO; 102 ret = -EIO;
103 goto out; 103 goto out;
104 } 104 }
@@ -124,7 +124,7 @@ static int spu_setup_isolated(struct spu_context *ctx)
124 status_loading) { 124 status_loading) {
125 if (time_after(jiffies, timeout)) { 125 if (time_after(jiffies, timeout)) {
126 printk(KERN_ERR "%s: timeout waiting for loader\n", 126 printk(KERN_ERR "%s: timeout waiting for loader\n",
127 __FUNCTION__); 127 __func__);
128 ret = -EIO; 128 ret = -EIO;
129 goto out_drop_priv; 129 goto out_drop_priv;
130 } 130 }
@@ -134,7 +134,7 @@ static int spu_setup_isolated(struct spu_context *ctx)
134 if (!(status & SPU_STATUS_RUNNING)) { 134 if (!(status & SPU_STATUS_RUNNING)) {
135 /* If isolated LOAD has failed: run SPU, we will get a stop-and 135 /* If isolated LOAD has failed: run SPU, we will get a stop-and
136 * signal later. */ 136 * signal later. */
137 pr_debug("%s: isolated LOAD failed\n", __FUNCTION__); 137 pr_debug("%s: isolated LOAD failed\n", __func__);
138 ctx->ops->runcntl_write(ctx, SPU_RUNCNTL_RUNNABLE); 138 ctx->ops->runcntl_write(ctx, SPU_RUNCNTL_RUNNABLE);
139 ret = -EACCES; 139 ret = -EACCES;
140 goto out_drop_priv; 140 goto out_drop_priv;
@@ -142,7 +142,7 @@ static int spu_setup_isolated(struct spu_context *ctx)
142 142
143 if (!(status & SPU_STATUS_ISOLATED_STATE)) { 143 if (!(status & SPU_STATUS_ISOLATED_STATE)) {
144 /* This isn't allowed by the CBEA, but check anyway */ 144 /* This isn't allowed by the CBEA, but check anyway */
145 pr_debug("%s: SPU fell out of isolated mode?\n", __FUNCTION__); 145 pr_debug("%s: SPU fell out of isolated mode?\n", __func__);
146 ctx->ops->runcntl_write(ctx, SPU_RUNCNTL_STOP); 146 ctx->ops->runcntl_write(ctx, SPU_RUNCNTL_STOP);
147 ret = -EINVAL; 147 ret = -EINVAL;
148 goto out_drop_priv; 148 goto out_drop_priv;
@@ -282,7 +282,7 @@ static int spu_handle_restartsys(struct spu_context *ctx, long *spu_ret,
282 break; 282 break;
283 default: 283 default:
284 printk(KERN_WARNING "%s: unexpected return code %ld\n", 284 printk(KERN_WARNING "%s: unexpected return code %ld\n",
285 __FUNCTION__, *spu_ret); 285 __func__, *spu_ret);
286 ret = 0; 286 ret = 0;
287 } 287 }
288 return ret; 288 return ret;
@@ -323,6 +323,10 @@ static int spu_process_callback(struct spu_context *ctx)
323 return -EINTR; 323 return -EINTR;
324 } 324 }
325 325
326 /* need to re-get the ls, as it may have changed when we released the
327 * spu */
328 ls = (void __iomem *)ctx->ops->get_ls(ctx);
329
326 /* write result, jump over indirect pointer */ 330 /* write result, jump over indirect pointer */
327 memcpy_toio(ls + ls_pointer, &spu_ret, sizeof(spu_ret)); 331 memcpy_toio(ls + ls_pointer, &spu_ret, sizeof(spu_ret));
328 ctx->ops->npc_write(ctx, npc); 332 ctx->ops->npc_write(ctx, npc);
diff --git a/arch/powerpc/platforms/cell/spufs/switch.c b/arch/powerpc/platforms/cell/spufs/switch.c
index e9dc7a55d1b9..d2a1249d36dd 100644
--- a/arch/powerpc/platforms/cell/spufs/switch.c
+++ b/arch/powerpc/platforms/cell/spufs/switch.c
@@ -1815,6 +1815,7 @@ static void save_csa(struct spu_state *prev, struct spu *spu)
1815 save_mfc_csr_ato(prev, spu); /* Step 24. */ 1815 save_mfc_csr_ato(prev, spu); /* Step 24. */
1816 save_mfc_tclass_id(prev, spu); /* Step 25. */ 1816 save_mfc_tclass_id(prev, spu); /* Step 25. */
1817 set_mfc_tclass_id(prev, spu); /* Step 26. */ 1817 set_mfc_tclass_id(prev, spu); /* Step 26. */
1818 save_mfc_cmd(prev, spu); /* Step 26a - moved from 44. */
1818 purge_mfc_queue(prev, spu); /* Step 27. */ 1819 purge_mfc_queue(prev, spu); /* Step 27. */
1819 wait_purge_complete(prev, spu); /* Step 28. */ 1820 wait_purge_complete(prev, spu); /* Step 28. */
1820 setup_mfc_sr1(prev, spu); /* Step 30. */ 1821 setup_mfc_sr1(prev, spu); /* Step 30. */
@@ -1831,7 +1832,6 @@ static void save_csa(struct spu_state *prev, struct spu *spu)
1831 save_ppuint_mb(prev, spu); /* Step 41. */ 1832 save_ppuint_mb(prev, spu); /* Step 41. */
1832 save_ch_part1(prev, spu); /* Step 42. */ 1833 save_ch_part1(prev, spu); /* Step 42. */
1833 save_spu_mb(prev, spu); /* Step 43. */ 1834 save_spu_mb(prev, spu); /* Step 43. */
1834 save_mfc_cmd(prev, spu); /* Step 44. */
1835 reset_ch(prev, spu); /* Step 45. */ 1835 reset_ch(prev, spu); /* Step 45. */
1836} 1836}
1837 1837
diff --git a/arch/powerpc/platforms/celleb/beat.c b/arch/powerpc/platforms/celleb/beat.c
index 93ebb7d85120..b64b171f245b 100644
--- a/arch/powerpc/platforms/celleb/beat.c
+++ b/arch/powerpc/platforms/celleb/beat.c
@@ -48,6 +48,7 @@ void beat_power_off(void)
48} 48}
49 49
50u64 beat_halt_code = 0x1000000000000000UL; 50u64 beat_halt_code = 0x1000000000000000UL;
51EXPORT_SYMBOL(beat_halt_code);
51 52
52void beat_halt(void) 53void beat_halt(void)
53{ 54{
@@ -94,9 +95,8 @@ ssize_t beat_nvram_read(char *buf, size_t count, loff_t *index)
94 len = count; 95 len = count;
95 if (len > BEAT_NVRW_CNT) 96 if (len > BEAT_NVRW_CNT)
96 len = BEAT_NVRW_CNT; 97 len = BEAT_NVRW_CNT;
97 if (beat_eeprom_read(i, len, p)) { 98 if (beat_eeprom_read(i, len, p))
98 return -EIO; 99 return -EIO;
99 }
100 100
101 p += len; 101 p += len;
102 i += len; 102 i += len;
@@ -121,9 +121,8 @@ ssize_t beat_nvram_write(char *buf, size_t count, loff_t *index)
121 len = count; 121 len = count;
122 if (len > BEAT_NVRW_CNT) 122 if (len > BEAT_NVRW_CNT)
123 len = BEAT_NVRW_CNT; 123 len = BEAT_NVRW_CNT;
124 if (beat_eeprom_write(i, len, p)) { 124 if (beat_eeprom_write(i, len, p))
125 return -EIO; 125 return -EIO;
126 }
127 126
128 p += len; 127 p += len;
129 i += len; 128 i += len;
@@ -149,13 +148,14 @@ int64_t beat_get_term_char(u64 vterm, u64 *len, u64 *t1, u64 *t2)
149 u64 db[2]; 148 u64 db[2];
150 s64 ret; 149 s64 ret;
151 150
152 ret = beat_get_characters_from_console(vterm, len, (u8*)db); 151 ret = beat_get_characters_from_console(vterm, len, (u8 *)db);
153 if (ret == 0) { 152 if (ret == 0) {
154 *t1 = db[0]; 153 *t1 = db[0];
155 *t2 = db[1]; 154 *t2 = db[1];
156 } 155 }
157 return ret; 156 return ret;
158} 157}
158EXPORT_SYMBOL(beat_get_term_char);
159 159
160int64_t beat_put_term_char(u64 vterm, u64 len, u64 t1, u64 t2) 160int64_t beat_put_term_char(u64 vterm, u64 len, u64 t1, u64 t2)
161{ 161{
@@ -163,8 +163,9 @@ int64_t beat_put_term_char(u64 vterm, u64 len, u64 t1, u64 t2)
163 163
164 db[0] = t1; 164 db[0] = t1;
165 db[1] = t2; 165 db[1] = t2;
166 return beat_put_characters_to_console(vterm, len, (u8*)db); 166 return beat_put_characters_to_console(vterm, len, (u8 *)db);
167} 167}
168EXPORT_SYMBOL(beat_put_term_char);
168 169
169void beat_power_save(void) 170void beat_power_save(void)
170{ 171{
@@ -261,7 +262,3 @@ static int __init beat_event_init(void)
261} 262}
262 263
263device_initcall(beat_event_init); 264device_initcall(beat_event_init);
264
265EXPORT_SYMBOL(beat_get_term_char);
266EXPORT_SYMBOL(beat_put_term_char);
267EXPORT_SYMBOL(beat_halt_code);
diff --git a/arch/powerpc/platforms/celleb/beat.h b/arch/powerpc/platforms/celleb/beat.h
index ac82ac35b991..32c8efcedc80 100644
--- a/arch/powerpc/platforms/celleb/beat.h
+++ b/arch/powerpc/platforms/celleb/beat.h
@@ -21,8 +21,8 @@
21#ifndef _CELLEB_BEAT_H 21#ifndef _CELLEB_BEAT_H
22#define _CELLEB_BEAT_H 22#define _CELLEB_BEAT_H
23 23
24int64_t beat_get_term_char(uint64_t,uint64_t*,uint64_t*,uint64_t*); 24int64_t beat_get_term_char(uint64_t, uint64_t *, uint64_t *, uint64_t *);
25int64_t beat_put_term_char(uint64_t,uint64_t,uint64_t,uint64_t); 25int64_t beat_put_term_char(uint64_t, uint64_t, uint64_t, uint64_t);
26int64_t beat_repository_encode(int, const char *, uint64_t[4]); 26int64_t beat_repository_encode(int, const char *, uint64_t[4]);
27void beat_restart(char *); 27void beat_restart(char *);
28void beat_power_off(void); 28void beat_power_off(void);
diff --git a/arch/powerpc/platforms/celleb/beat_wrapper.h b/arch/powerpc/platforms/celleb/beat_wrapper.h
index cbc1487df7de..b47dfda48d06 100644
--- a/arch/powerpc/platforms/celleb/beat_wrapper.h
+++ b/arch/powerpc/platforms/celleb/beat_wrapper.h
@@ -197,7 +197,8 @@ static inline s64 beat_put_characters_to_console(u64 termno, u64 len,
197 u64 b[2]; 197 u64 b[2];
198 198
199 memcpy(b, buffer, len); 199 memcpy(b, buffer, len);
200 return beat_hcall_norets(HV_put_characters_to_console, termno, len, b[0], b[1]); 200 return beat_hcall_norets(HV_put_characters_to_console, termno, len,
201 b[0], b[1]);
201} 202}
202 203
203static inline s64 beat_get_spe_privileged_state_1_registers( 204static inline s64 beat_get_spe_privileged_state_1_registers(
diff --git a/arch/powerpc/platforms/celleb/htab.c b/arch/powerpc/platforms/celleb/htab.c
index fbf27c74ebda..81467ff055c8 100644
--- a/arch/powerpc/platforms/celleb/htab.c
+++ b/arch/powerpc/platforms/celleb/htab.c
@@ -35,9 +35,9 @@
35#include "beat_wrapper.h" 35#include "beat_wrapper.h"
36 36
37#ifdef DEBUG_LOW 37#ifdef DEBUG_LOW
38#define DBG_LOW(fmt...) do { udbg_printf(fmt); } while(0) 38#define DBG_LOW(fmt...) do { udbg_printf(fmt); } while (0)
39#else 39#else
40#define DBG_LOW(fmt...) do { } while(0) 40#define DBG_LOW(fmt...) do { } while (0)
41#endif 41#endif
42 42
43static DEFINE_SPINLOCK(beat_htab_lock); 43static DEFINE_SPINLOCK(beat_htab_lock);
@@ -116,7 +116,8 @@ static long beat_lpar_hpte_insert(unsigned long hpte_group,
116 hpte_r &= ~_PAGE_COHERENT; 116 hpte_r &= ~_PAGE_COHERENT;
117 117
118 spin_lock(&beat_htab_lock); 118 spin_lock(&beat_htab_lock);
119 if ((lpar_rc = beat_read_mask(hpte_group)) == 0) { 119 lpar_rc = beat_read_mask(hpte_group);
120 if (lpar_rc == 0) {
120 if (!(vflags & HPTE_V_BOLTED)) 121 if (!(vflags & HPTE_V_BOLTED))
121 DBG_LOW(" full\n"); 122 DBG_LOW(" full\n");
122 spin_unlock(&beat_htab_lock); 123 spin_unlock(&beat_htab_lock);
diff --git a/arch/powerpc/platforms/celleb/interrupt.c b/arch/powerpc/platforms/celleb/interrupt.c
index c7c68ca70c82..69562a867876 100644
--- a/arch/powerpc/platforms/celleb/interrupt.c
+++ b/arch/powerpc/platforms/celleb/interrupt.c
@@ -34,7 +34,7 @@ static DEFINE_SPINLOCK(beatic_irq_mask_lock);
34static uint64_t beatic_irq_mask_enable[(MAX_IRQS+255)/64]; 34static uint64_t beatic_irq_mask_enable[(MAX_IRQS+255)/64];
35static uint64_t beatic_irq_mask_ack[(MAX_IRQS+255)/64]; 35static uint64_t beatic_irq_mask_ack[(MAX_IRQS+255)/64];
36 36
37static struct irq_host *beatic_host = NULL; 37static struct irq_host *beatic_host;
38 38
39/* 39/*
40 * In this implementation, "virq" == "IRQ plug number", 40 * In this implementation, "virq" == "IRQ plug number",
@@ -49,13 +49,13 @@ static inline void beatic_update_irq_mask(unsigned int irq_plug)
49 49
50 off = (irq_plug / 256) * 4; 50 off = (irq_plug / 256) * 4;
51 masks[0] = beatic_irq_mask_enable[off + 0] 51 masks[0] = beatic_irq_mask_enable[off + 0]
52 & beatic_irq_mask_ack[off + 0]; 52 & beatic_irq_mask_ack[off + 0];
53 masks[1] = beatic_irq_mask_enable[off + 1] 53 masks[1] = beatic_irq_mask_enable[off + 1]
54 & beatic_irq_mask_ack[off + 1]; 54 & beatic_irq_mask_ack[off + 1];
55 masks[2] = beatic_irq_mask_enable[off + 2] 55 masks[2] = beatic_irq_mask_enable[off + 2]
56 & beatic_irq_mask_ack[off + 2]; 56 & beatic_irq_mask_ack[off + 2];
57 masks[3] = beatic_irq_mask_enable[off + 3] 57 masks[3] = beatic_irq_mask_enable[off + 3]
58 & beatic_irq_mask_ack[off + 3]; 58 & beatic_irq_mask_ack[off + 3];
59 if (beat_set_interrupt_mask(irq_plug&~255UL, 59 if (beat_set_interrupt_mask(irq_plug&~255UL,
60 masks[0], masks[1], masks[2], masks[3]) != 0) 60 masks[0], masks[1], masks[2], masks[3]) != 0)
61 panic("Failed to set mask IRQ!"); 61 panic("Failed to set mask IRQ!");
@@ -96,7 +96,8 @@ static void beatic_end_irq(unsigned int irq_plug)
96 s64 err; 96 s64 err;
97 unsigned long flags; 97 unsigned long flags;
98 98
99 if ((err = beat_downcount_of_interrupt(irq_plug)) != 0) { 99 err = beat_downcount_of_interrupt(irq_plug);
100 if (err != 0) {
100 if ((err & 0xFFFFFFFF) != 0xFFFFFFF5) /* -11: wrong state */ 101 if ((err & 0xFFFFFFFF) != 0xFFFFFFF5) /* -11: wrong state */
101 panic("Failed to downcount IRQ! Error = %16lx", err); 102 panic("Failed to downcount IRQ! Error = %16lx", err);
102 103
@@ -138,7 +139,8 @@ static int beatic_pic_host_map(struct irq_host *h, unsigned int virq,
138 struct irq_desc *desc = get_irq_desc(virq); 139 struct irq_desc *desc = get_irq_desc(virq);
139 int64_t err; 140 int64_t err;
140 141
141 if ((err = beat_construct_and_connect_irq_plug(virq, hw)) < 0) 142 err = beat_construct_and_connect_irq_plug(virq, hw);
143 if (err < 0)
142 return -EIO; 144 return -EIO;
143 145
144 desc->status |= IRQ_LEVEL; 146 desc->status |= IRQ_LEVEL;
@@ -202,22 +204,22 @@ static inline unsigned int beatic_get_irq_plug(void)
202 beat_detect_pending_interrupts(i, pending); 204 beat_detect_pending_interrupts(i, pending);
203 __asm__ ("cntlzd %0,%1":"=r"(ub): 205 __asm__ ("cntlzd %0,%1":"=r"(ub):
204 "r"(pending[0] & beatic_irq_mask_enable[i/64+0] 206 "r"(pending[0] & beatic_irq_mask_enable[i/64+0]
205 & beatic_irq_mask_ack[i/64+0])); 207 & beatic_irq_mask_ack[i/64+0]));
206 if (ub != 64) 208 if (ub != 64)
207 return i + ub + 0; 209 return i + ub + 0;
208 __asm__ ("cntlzd %0,%1":"=r"(ub): 210 __asm__ ("cntlzd %0,%1":"=r"(ub):
209 "r"(pending[1] & beatic_irq_mask_enable[i/64+1] 211 "r"(pending[1] & beatic_irq_mask_enable[i/64+1]
210 & beatic_irq_mask_ack[i/64+1])); 212 & beatic_irq_mask_ack[i/64+1]));
211 if (ub != 64) 213 if (ub != 64)
212 return i + ub + 64; 214 return i + ub + 64;
213 __asm__ ("cntlzd %0,%1":"=r"(ub): 215 __asm__ ("cntlzd %0,%1":"=r"(ub):
214 "r"(pending[2] & beatic_irq_mask_enable[i/64+2] 216 "r"(pending[2] & beatic_irq_mask_enable[i/64+2]
215 & beatic_irq_mask_ack[i/64+2])); 217 & beatic_irq_mask_ack[i/64+2]));
216 if (ub != 64) 218 if (ub != 64)
217 return i + ub + 128; 219 return i + ub + 128;
218 __asm__ ("cntlzd %0,%1":"=r"(ub): 220 __asm__ ("cntlzd %0,%1":"=r"(ub):
219 "r"(pending[3] & beatic_irq_mask_enable[i/64+3] 221 "r"(pending[3] & beatic_irq_mask_enable[i/64+3]
220 & beatic_irq_mask_ack[i/64+3])); 222 & beatic_irq_mask_ack[i/64+3]));
221 if (ub != 64) 223 if (ub != 64)
222 return i + ub + 192; 224 return i + ub + 192;
223 } 225 }
@@ -250,7 +252,7 @@ void __init beatic_init_IRQ(void)
250 252
251 /* Allocate an irq host */ 253 /* Allocate an irq host */
252 beatic_host = irq_alloc_host(NULL, IRQ_HOST_MAP_NOMAP, 0, 254 beatic_host = irq_alloc_host(NULL, IRQ_HOST_MAP_NOMAP, 0,
253 &beatic_pic_host_ops, 255 &beatic_pic_host_ops,
254 0); 256 0);
255 BUG_ON(beatic_host == NULL); 257 BUG_ON(beatic_host == NULL);
256 irq_set_default_host(beatic_host); 258 irq_set_default_host(beatic_host);
diff --git a/arch/powerpc/platforms/celleb/scc_epci.c b/arch/powerpc/platforms/celleb/scc_epci.c
index a3c7cfbcb323..a999b393f6f6 100644
--- a/arch/powerpc/platforms/celleb/scc_epci.c
+++ b/arch/powerpc/platforms/celleb/scc_epci.c
@@ -161,9 +161,9 @@ static PCI_IO_ADDR celleb_epci_make_config_addr(
161 if (bus != hose->bus) 161 if (bus != hose->bus)
162 addr = celleb_epci_get_epci_cfg(hose) + 162 addr = celleb_epci_get_epci_cfg(hose) +
163 (((bus->number & 0xff) << 16) 163 (((bus->number & 0xff) << 16)
164 | ((devfn & 0xff) << 8) 164 | ((devfn & 0xff) << 8)
165 | (where & 0xff) 165 | (where & 0xff)
166 | 0x01000000); 166 | 0x01000000);
167 else 167 else
168 addr = celleb_epci_get_epci_cfg(hose) + 168 addr = celleb_epci_get_epci_cfg(hose) +
169 (((devfn & 0xff) << 8) | (where & 0xff)); 169 (((devfn & 0xff) << 8) | (where & 0xff));
@@ -174,7 +174,7 @@ static PCI_IO_ADDR celleb_epci_make_config_addr(
174} 174}
175 175
176static int celleb_epci_read_config(struct pci_bus *bus, 176static int celleb_epci_read_config(struct pci_bus *bus,
177 unsigned int devfn, int where, int size, u32 * val) 177 unsigned int devfn, int where, int size, u32 *val)
178{ 178{
179 PCI_IO_ADDR epci_base; 179 PCI_IO_ADDR epci_base;
180 PCI_IO_ADDR addr; 180 PCI_IO_ADDR addr;
diff --git a/arch/powerpc/platforms/celleb/scc_sio.c b/arch/powerpc/platforms/celleb/scc_sio.c
index 610008211ca1..3a16c5b3c464 100644
--- a/arch/powerpc/platforms/celleb/scc_sio.c
+++ b/arch/powerpc/platforms/celleb/scc_sio.c
@@ -28,7 +28,7 @@
28 28
29/* sio irq0=0xb00010022 irq0=0xb00010023 irq2=0xb00010024 29/* sio irq0=0xb00010022 irq0=0xb00010023 irq2=0xb00010024
30 mmio=0xfff000-0x1000,0xff2000-0x1000 */ 30 mmio=0xfff000-0x1000,0xff2000-0x1000 */
31static int txx9_serial_bitmap __initdata = 0; 31static int txx9_serial_bitmap __initdata;
32 32
33static struct { 33static struct {
34 uint32_t offset; 34 uint32_t offset;
@@ -84,7 +84,7 @@ static int __init txx9_serial_config(char *ptr)
84 int i; 84 int i;
85 85
86 for (;;) { 86 for (;;) {
87 switch(get_option(&ptr, &i)) { 87 switch (get_option(&ptr, &i)) {
88 default: 88 default:
89 return 0; 89 return 0;
90 case 2: 90 case 2:
diff --git a/arch/powerpc/platforms/celleb/spu_priv1.c b/arch/powerpc/platforms/celleb/spu_priv1.c
index 2bf6700f747a..bcc17f7fe8ad 100644
--- a/arch/powerpc/platforms/celleb/spu_priv1.c
+++ b/arch/powerpc/platforms/celleb/spu_priv1.c
@@ -183,8 +183,7 @@ static u64 resource_allocation_enable_get(struct spu *spu)
183 return enable; 183 return enable;
184} 184}
185 185
186const struct spu_priv1_ops spu_priv1_beat_ops = 186const struct spu_priv1_ops spu_priv1_beat_ops = {
187{
188 .int_mask_and = int_mask_and, 187 .int_mask_and = int_mask_and,
189 .int_mask_or = int_mask_or, 188 .int_mask_or = int_mask_or,
190 .int_mask_set = int_mask_set, 189 .int_mask_set = int_mask_set,
diff --git a/arch/powerpc/platforms/celleb/udbg_beat.c b/arch/powerpc/platforms/celleb/udbg_beat.c
index d888c4674c62..6b418f6b6175 100644
--- a/arch/powerpc/platforms/celleb/udbg_beat.c
+++ b/arch/powerpc/platforms/celleb/udbg_beat.c
@@ -54,7 +54,8 @@ static int udbg_getc_poll_beat(void)
54 if (inbuflen == 0) { 54 if (inbuflen == 0) {
55 /* get some more chars. */ 55 /* get some more chars. */
56 inbuflen = 0; 56 inbuflen = 0;
57 rc = beat_get_term_char(celleb_vtermno, &inbuflen, inbuf+0, inbuf+1); 57 rc = beat_get_term_char(celleb_vtermno, &inbuflen,
58 inbuf+0, inbuf+1);
58 if (rc != 0) 59 if (rc != 0)
59 inbuflen = 0; /* otherwise inbuflen is garbage */ 60 inbuflen = 0; /* otherwise inbuflen is garbage */
60 } 61 }
@@ -78,7 +79,7 @@ static int udbg_getc_beat(void)
78 if (ch == -1) { 79 if (ch == -1) {
79 /* This shouldn't be needed...but... */ 80 /* This shouldn't be needed...but... */
80 volatile unsigned long delay; 81 volatile unsigned long delay;
81 for (delay=0; delay < 2000000; delay++) 82 for (delay = 0; delay < 2000000; delay++)
82 ; 83 ;
83 } else { 84 } else {
84 return ch; 85 return ch;
diff --git a/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c b/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c
index d4f8bf581e3a..84e2d78b9a62 100644
--- a/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c
+++ b/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c
@@ -117,11 +117,11 @@ static void __init mpc7448_hpc2_init_IRQ(void)
117 } 117 }
118 118
119 if (mpic_paddr == 0) { 119 if (mpic_paddr == 0) {
120 printk("%s: No tsi108 PIC found !\n", __FUNCTION__); 120 printk("%s: No tsi108 PIC found !\n", __func__);
121 return; 121 return;
122 } 122 }
123 123
124 DBG("%s: tsi108 pic phys_addr = 0x%x\n", __FUNCTION__, 124 DBG("%s: tsi108 pic phys_addr = 0x%x\n", __func__,
125 (u32) mpic_paddr); 125 (u32) mpic_paddr);
126 126
127 mpic = mpic_alloc(tsi_pic, mpic_paddr, 127 mpic = mpic_alloc(tsi_pic, mpic_paddr,
@@ -140,17 +140,17 @@ static void __init mpc7448_hpc2_init_IRQ(void)
140#ifdef CONFIG_PCI 140#ifdef CONFIG_PCI
141 tsi_pci = of_find_node_by_type(NULL, "pci"); 141 tsi_pci = of_find_node_by_type(NULL, "pci");
142 if (tsi_pci == NULL) { 142 if (tsi_pci == NULL) {
143 printk("%s: No tsi108 pci node found !\n", __FUNCTION__); 143 printk("%s: No tsi108 pci node found !\n", __func__);
144 return; 144 return;
145 } 145 }
146 cascade_node = of_find_node_by_type(NULL, "pic-router"); 146 cascade_node = of_find_node_by_type(NULL, "pic-router");
147 if (cascade_node == NULL) { 147 if (cascade_node == NULL) {
148 printk("%s: No tsi108 pci cascade node found !\n", __FUNCTION__); 148 printk("%s: No tsi108 pci cascade node found !\n", __func__);
149 return; 149 return;
150 } 150 }
151 151
152 cascade_pci_irq = irq_of_parse_and_map(tsi_pci, 0); 152 cascade_pci_irq = irq_of_parse_and_map(tsi_pci, 0);
153 DBG("%s: tsi108 cascade_pci_irq = 0x%x\n", __FUNCTION__, 153 DBG("%s: tsi108 cascade_pci_irq = 0x%x\n", __func__,
154 (u32) cascade_pci_irq); 154 (u32) cascade_pci_irq);
155 tsi108_pci_int_init(cascade_node); 155 tsi108_pci_int_init(cascade_node);
156 set_irq_data(cascade_pci_irq, mpic); 156 set_irq_data(cascade_pci_irq, mpic);
diff --git a/arch/powerpc/platforms/embedded6xx/prpmc2800.c b/arch/powerpc/platforms/embedded6xx/prpmc2800.c
index 653a5eb91c90..5a19b9a1457c 100644
--- a/arch/powerpc/platforms/embedded6xx/prpmc2800.c
+++ b/arch/powerpc/platforms/embedded6xx/prpmc2800.c
@@ -49,13 +49,13 @@ static void __init prpmc2800_setup_arch(void)
49 * ioremap mpp and gpp registers in case they are later 49 * ioremap mpp and gpp registers in case they are later
50 * needed by prpmc2800_reset_board(). 50 * needed by prpmc2800_reset_board().
51 */ 51 */
52 np = of_find_compatible_node(NULL, NULL, "marvell,mv64x60-mpp"); 52 np = of_find_compatible_node(NULL, NULL, "marvell,mv64360-mpp");
53 reg = of_get_property(np, "reg", NULL); 53 reg = of_get_property(np, "reg", NULL);
54 paddr = of_translate_address(np, reg); 54 paddr = of_translate_address(np, reg);
55 of_node_put(np); 55 of_node_put(np);
56 mv64x60_mpp_reg_base = ioremap(paddr, reg[1]); 56 mv64x60_mpp_reg_base = ioremap(paddr, reg[1]);
57 57
58 np = of_find_compatible_node(NULL, NULL, "marvell,mv64x60-gpp"); 58 np = of_find_compatible_node(NULL, NULL, "marvell,mv64360-gpp");
59 reg = of_get_property(np, "reg", NULL); 59 reg = of_get_property(np, "reg", NULL);
60 paddr = of_translate_address(np, reg); 60 paddr = of_translate_address(np, reg);
61 of_node_put(np); 61 of_node_put(np);
diff --git a/arch/powerpc/platforms/iseries/exception.S b/arch/powerpc/platforms/iseries/exception.S
index 5381038f0881..c775cd4b3d6e 100644
--- a/arch/powerpc/platforms/iseries/exception.S
+++ b/arch/powerpc/platforms/iseries/exception.S
@@ -38,11 +38,19 @@
38 38
39 .globl system_reset_iSeries 39 .globl system_reset_iSeries
40system_reset_iSeries: 40system_reset_iSeries:
41 mfspr r13,SPRN_SPRG3 /* Get paca address */ 41 mfspr r13,SPRN_SPRG3 /* Get alpaca address */
42 LOAD_REG_IMMEDIATE(r23, alpaca)
43 li r0,ALPACA_SIZE
44 sub r23,r13,r23
45 divdu r23,r23,r0 /* r23 has cpu number */
46 LOAD_REG_IMMEDIATE(r13, paca)
47 mulli r0,r23,PACA_SIZE
48 add r13,r13,r0
49 mtspr SPRN_SPRG3,r13 /* Save it away for the future */
42 mfmsr r24 50 mfmsr r24
43 ori r24,r24,MSR_RI 51 ori r24,r24,MSR_RI
44 mtmsrd r24 /* RI on */ 52 mtmsrd r24 /* RI on */
45 lhz r24,PACAPACAINDEX(r13) /* Get processor # */ 53 mr r24,r23
46 cmpwi 0,r24,0 /* Are we processor 0? */ 54 cmpwi 0,r24,0 /* Are we processor 0? */
47 bne 1f 55 bne 1f
48 b .__start_initialization_iSeries /* Start up the first processor */ 56 b .__start_initialization_iSeries /* Start up the first processor */
diff --git a/arch/powerpc/platforms/iseries/ipl_parms.h b/arch/powerpc/platforms/iseries/ipl_parms.h
index 77c135ddbf1b..83e4ca42fc57 100644
--- a/arch/powerpc/platforms/iseries/ipl_parms.h
+++ b/arch/powerpc/platforms/iseries/ipl_parms.h
@@ -65,6 +65,4 @@ struct ItIplParmsReal {
65 u64 xRsvd13; // Reserved x38-x3F 65 u64 xRsvd13; // Reserved x38-x3F
66}; 66};
67 67
68extern struct ItIplParmsReal xItIplParmsReal;
69
70#endif /* _ISERIES_IPL_PARMS_H */ 68#endif /* _ISERIES_IPL_PARMS_H */
diff --git a/arch/powerpc/platforms/iseries/lpardata.c b/arch/powerpc/platforms/iseries/lpardata.c
index 8162049bb04d..98bd2d37038a 100644
--- a/arch/powerpc/platforms/iseries/lpardata.c
+++ b/arch/powerpc/platforms/iseries/lpardata.c
@@ -14,10 +14,10 @@
14#include <asm/ptrace.h> 14#include <asm/ptrace.h>
15#include <asm/abs_addr.h> 15#include <asm/abs_addr.h>
16#include <asm/lppaca.h> 16#include <asm/lppaca.h>
17#include <asm/iseries/it_lp_reg_save.h>
18#include <asm/paca.h> 17#include <asm/paca.h>
19#include <asm/iseries/lpar_map.h> 18#include <asm/iseries/lpar_map.h>
20#include <asm/iseries/it_lp_queue.h> 19#include <asm/iseries/it_lp_queue.h>
20#include <asm/iseries/alpaca.h>
21 21
22#include "naca.h" 22#include "naca.h"
23#include "vpd_areas.h" 23#include "vpd_areas.h"
@@ -31,7 +31,7 @@
31/* The HvReleaseData is the root of the information shared between 31/* The HvReleaseData is the root of the information shared between
32 * the hypervisor and Linux. 32 * the hypervisor and Linux.
33 */ 33 */
34struct HvReleaseData hvReleaseData = { 34const struct HvReleaseData hvReleaseData = {
35 .xDesc = 0xc8a5d9c4, /* "HvRD" ebcdic */ 35 .xDesc = 0xc8a5d9c4, /* "HvRD" ebcdic */
36 .xSize = sizeof(struct HvReleaseData), 36 .xSize = sizeof(struct HvReleaseData),
37 .xVpdAreasPtrOffset = offsetof(struct naca_struct, xItVpdAreas), 37 .xVpdAreasPtrOffset = offsetof(struct naca_struct, xItVpdAreas),
@@ -61,6 +61,63 @@ struct naca_struct naca = {
61 .xRamDiskSize = 0, 61 .xRamDiskSize = 0,
62}; 62};
63 63
64struct ItLpRegSave {
65 u32 xDesc; // Eye catcher "LpRS" ebcdic 000-003
66 u16 xSize; // Size of this class 004-005
67 u8 xInUse; // Area is live 006-007
68 u8 xRsvd1[9]; // Reserved 007-00F
69
70 u8 xFixedRegSave[352]; // Fixed Register Save Area 010-16F
71 u32 xCTRL; // Control Register 170-173
72 u32 xDEC; // Decrementer 174-177
73 u32 xFPSCR; // FP Status and Control Reg 178-17B
74 u32 xPVR; // Processor Version Number 17C-17F
75
76 u64 xMMCR0; // Monitor Mode Control Reg 0 180-187
77 u32 xPMC1; // Perf Monitor Counter 1 188-18B
78 u32 xPMC2; // Perf Monitor Counter 2 18C-18F
79 u32 xPMC3; // Perf Monitor Counter 3 190-193
80 u32 xPMC4; // Perf Monitor Counter 4 194-197
81 u32 xPIR; // Processor ID Reg 198-19B
82
83 u32 xMMCR1; // Monitor Mode Control Reg 1 19C-19F
84 u32 xMMCRA; // Monitor Mode Control Reg A 1A0-1A3
85 u32 xPMC5; // Perf Monitor Counter 5 1A4-1A7
86 u32 xPMC6; // Perf Monitor Counter 6 1A8-1AB
87 u32 xPMC7; // Perf Monitor Counter 7 1AC-1AF
88 u32 xPMC8; // Perf Monitor Counter 8 1B0-1B3
89 u32 xTSC; // Thread Switch Control 1B4-1B7
90 u32 xTST; // Thread Switch Timeout 1B8-1BB
91 u32 xRsvd; // Reserved 1BC-1BF
92
93 u64 xACCR; // Address Compare Control Reg 1C0-1C7
94 u64 xIMR; // Instruction Match Register 1C8-1CF
95 u64 xSDR1; // Storage Description Reg 1 1D0-1D7
96 u64 xSPRG0; // Special Purpose Reg General0 1D8-1DF
97 u64 xSPRG1; // Special Purpose Reg General1 1E0-1E7
98 u64 xSPRG2; // Special Purpose Reg General2 1E8-1EF
99 u64 xSPRG3; // Special Purpose Reg General3 1F0-1F7
100 u64 xTB; // Time Base Register 1F8-1FF
101
102 u64 xFPR[32]; // Floating Point Registers 200-2FF
103
104 u64 xMSR; // Machine State Register 300-307
105 u64 xNIA; // Next Instruction Address 308-30F
106
107 u64 xDABR; // Data Address Breakpoint Reg 310-317
108 u64 xIABR; // Inst Address Breakpoint Reg 318-31F
109
110 u64 xHID0; // HW Implementation Dependent0 320-327
111
112 u64 xHID4; // HW Implementation Dependent4 328-32F
113 u64 xSCOMd; // SCON Data Reg (SPRG4) 330-337
114 u64 xSCOMc; // SCON Command Reg (SPRG5) 338-33F
115 u64 xSDAR; // Sample Data Address Register 340-347
116 u64 xSIAR; // Sample Inst Address Register 348-34F
117
118 u8 xRsvd3[176]; // Reserved 350-3FF
119};
120
64extern void system_reset_iSeries(void); 121extern void system_reset_iSeries(void);
65extern void machine_check_iSeries(void); 122extern void machine_check_iSeries(void);
66extern void data_access_iSeries(void); 123extern void data_access_iSeries(void);
@@ -129,7 +186,7 @@ struct ItLpNaca itLpNaca = {
129}; 186};
130 187
131/* May be filled in by the hypervisor so cannot end up in the BSS */ 188/* May be filled in by the hypervisor so cannot end up in the BSS */
132struct ItIplParmsReal xItIplParmsReal __attribute__((__section__(".data"))); 189static struct ItIplParmsReal xItIplParmsReal __attribute__((__section__(".data")));
133 190
134/* May be filled in by the hypervisor so cannot end up in the BSS */ 191/* May be filled in by the hypervisor so cannot end up in the BSS */
135struct ItExtVpdPanel xItExtVpdPanel __attribute__((__section__(".data"))); 192struct ItExtVpdPanel xItExtVpdPanel __attribute__((__section__(".data")));
@@ -152,13 +209,54 @@ u64 xMsVpd[3400] __attribute__((__section__(".data")));
152 209
153/* Space for Recovery Log Buffer */ 210/* Space for Recovery Log Buffer */
154/* May be filled in by the hypervisor so cannot end up in the BSS */ 211/* May be filled in by the hypervisor so cannot end up in the BSS */
155u64 xRecoveryLogBuffer[32] __attribute__((__section__(".data"))); 212static u64 xRecoveryLogBuffer[32] __attribute__((__section__(".data")));
156 213
157struct SpCommArea xSpCommArea = { 214static const struct SpCommArea xSpCommArea = {
158 .xDesc = 0xE2D7C3C2, 215 .xDesc = 0xE2D7C3C2,
159 .xFormat = 1, 216 .xFormat = 1,
160}; 217};
161 218
219static const struct ItLpRegSave iseries_reg_save[] = {
220 [0 ... (NR_CPUS-1)] = {
221 .xDesc = 0xd397d9e2, /* "LpRS" */
222 .xSize = sizeof(struct ItLpRegSave),
223 },
224};
225
226#define ALPACA_INIT(number) \
227{ \
228 .lppaca_ptr = &lppaca[number], \
229 .reg_save_ptr = &iseries_reg_save[number], \
230}
231
232const struct alpaca alpaca[] = {
233 ALPACA_INIT( 0),
234#if NR_CPUS > 1
235 ALPACA_INIT( 1), ALPACA_INIT( 2), ALPACA_INIT( 3),
236#if NR_CPUS > 4
237 ALPACA_INIT( 4), ALPACA_INIT( 5), ALPACA_INIT( 6), ALPACA_INIT( 7),
238#if NR_CPUS > 8
239 ALPACA_INIT( 8), ALPACA_INIT( 9), ALPACA_INIT(10), ALPACA_INIT(11),
240 ALPACA_INIT(12), ALPACA_INIT(13), ALPACA_INIT(14), ALPACA_INIT(15),
241 ALPACA_INIT(16), ALPACA_INIT(17), ALPACA_INIT(18), ALPACA_INIT(19),
242 ALPACA_INIT(20), ALPACA_INIT(21), ALPACA_INIT(22), ALPACA_INIT(23),
243 ALPACA_INIT(24), ALPACA_INIT(25), ALPACA_INIT(26), ALPACA_INIT(27),
244 ALPACA_INIT(28), ALPACA_INIT(29), ALPACA_INIT(30), ALPACA_INIT(31),
245#if NR_CPUS > 32
246 ALPACA_INIT(32), ALPACA_INIT(33), ALPACA_INIT(34), ALPACA_INIT(35),
247 ALPACA_INIT(36), ALPACA_INIT(37), ALPACA_INIT(38), ALPACA_INIT(39),
248 ALPACA_INIT(40), ALPACA_INIT(41), ALPACA_INIT(42), ALPACA_INIT(43),
249 ALPACA_INIT(44), ALPACA_INIT(45), ALPACA_INIT(46), ALPACA_INIT(47),
250 ALPACA_INIT(48), ALPACA_INIT(49), ALPACA_INIT(50), ALPACA_INIT(51),
251 ALPACA_INIT(52), ALPACA_INIT(53), ALPACA_INIT(54), ALPACA_INIT(55),
252 ALPACA_INIT(56), ALPACA_INIT(57), ALPACA_INIT(58), ALPACA_INIT(59),
253 ALPACA_INIT(60), ALPACA_INIT(61), ALPACA_INIT(62), ALPACA_INIT(63),
254#endif
255#endif
256#endif
257#endif
258};
259
162/* The LparMap data is now located at offset 0x6000 in head.S 260/* The LparMap data is now located at offset 0x6000 in head.S
163 * It was put there so that the HvReleaseData could address it 261 * It was put there so that the HvReleaseData could address it
164 * with a 32-bit offset as required by the iSeries hypervisor 262 * with a 32-bit offset as required by the iSeries hypervisor
@@ -167,7 +265,7 @@ struct SpCommArea xSpCommArea = {
167 * the Naca via the HvReleaseData area. The HvReleaseData has the 265 * the Naca via the HvReleaseData area. The HvReleaseData has the
168 * offset into the Naca of the pointer to the ItVpdAreas. 266 * offset into the Naca of the pointer to the ItVpdAreas.
169 */ 267 */
170struct ItVpdAreas itVpdAreas = { 268const struct ItVpdAreas itVpdAreas = {
171 .xSlicDesc = 0xc9a3e5c1, /* "ItVA" */ 269 .xSlicDesc = 0xc9a3e5c1, /* "ItVA" */
172 .xSlicSize = sizeof(struct ItVpdAreas), 270 .xSlicSize = sizeof(struct ItVpdAreas),
173 .xSlicVpdEntries = ItVpdMaxEntries, /* # VPD array entries */ 271 .xSlicVpdEntries = ItVpdMaxEntries, /* # VPD array entries */
@@ -185,7 +283,7 @@ struct ItVpdAreas itVpdAreas = {
185 .xSlicVpdLens = { /* VPD lengths */ 283 .xSlicVpdLens = { /* VPD lengths */
186 0,0,0, /* 0 - 2 */ 284 0,0,0, /* 0 - 2 */
187 sizeof(xItExtVpdPanel), /* 3 Extended VPD */ 285 sizeof(xItExtVpdPanel), /* 3 Extended VPD */
188 sizeof(struct paca_struct), /* 4 length of Paca */ 286 sizeof(struct alpaca), /* 4 length of (fake) Paca */
189 0, /* 5 */ 287 0, /* 5 */
190 sizeof(struct ItIplParmsReal),/* 6 length of IPL parms */ 288 sizeof(struct ItIplParmsReal),/* 6 length of IPL parms */
191 26992, /* 7 length of MS VPD */ 289 26992, /* 7 length of MS VPD */
@@ -203,7 +301,7 @@ struct ItVpdAreas itVpdAreas = {
203 .xSlicVpdAdrs = { /* VPD addresses */ 301 .xSlicVpdAdrs = { /* VPD addresses */
204 0,0,0, /* 0 - 2 */ 302 0,0,0, /* 0 - 2 */
205 &xItExtVpdPanel, /* 3 Extended VPD */ 303 &xItExtVpdPanel, /* 3 Extended VPD */
206 &paca[0], /* 4 first Paca */ 304 &alpaca[0], /* 4 first (fake) Paca */
207 0, /* 5 */ 305 0, /* 5 */
208 &xItIplParmsReal, /* 6 IPL parms */ 306 &xItIplParmsReal, /* 6 IPL parms */
209 &xMsVpd, /* 7 MS Vpd */ 307 &xMsVpd, /* 7 MS Vpd */
@@ -219,10 +317,3 @@ struct ItVpdAreas itVpdAreas = {
219 0,0 317 0,0
220 } 318 }
221}; 319};
222
223struct ItLpRegSave iseries_reg_save[] = {
224 [0 ... (NR_CPUS-1)] = {
225 .xDesc = 0xd397d9e2, /* "LpRS" */
226 .xSize = sizeof(struct ItLpRegSave),
227 },
228};
diff --git a/arch/powerpc/platforms/iseries/naca.h b/arch/powerpc/platforms/iseries/naca.h
index ab2372eb8d2e..f01708e12862 100644
--- a/arch/powerpc/platforms/iseries/naca.h
+++ b/arch/powerpc/platforms/iseries/naca.h
@@ -14,7 +14,7 @@
14 14
15struct naca_struct { 15struct naca_struct {
16 /* Kernel only data - undefined for user space */ 16 /* Kernel only data - undefined for user space */
17 void *xItVpdAreas; /* VPD Data 0x00 */ 17 const void *xItVpdAreas; /* VPD Data 0x00 */
18 void *xRamDisk; /* iSeries ramdisk 0x08 */ 18 void *xRamDisk; /* iSeries ramdisk 0x08 */
19 u64 xRamDiskSize; /* In pages 0x10 */ 19 u64 xRamDiskSize; /* In pages 0x10 */
20}; 20};
diff --git a/arch/powerpc/platforms/iseries/pci.c b/arch/powerpc/platforms/iseries/pci.c
index cc562e4c2f32..02a634faedbe 100644
--- a/arch/powerpc/platforms/iseries/pci.c
+++ b/arch/powerpc/platforms/iseries/pci.c
@@ -23,6 +23,7 @@
23 23
24#undef DEBUG 24#undef DEBUG
25 25
26#include <linux/jiffies.h>
26#include <linux/kernel.h> 27#include <linux/kernel.h>
27#include <linux/list.h> 28#include <linux/list.h>
28#include <linux/string.h> 29#include <linux/string.h>
@@ -586,7 +587,7 @@ static inline struct device_node *xlate_iomm_address(
586 static unsigned long last_jiffies; 587 static unsigned long last_jiffies;
587 static int num_printed; 588 static int num_printed;
588 589
589 if ((jiffies - last_jiffies) > 60 * HZ) { 590 if (time_after(jiffies, last_jiffies + 60 * HZ)) {
590 last_jiffies = jiffies; 591 last_jiffies = jiffies;
591 num_printed = 0; 592 num_printed = 0;
592 } 593 }
diff --git a/arch/powerpc/platforms/iseries/release_data.h b/arch/powerpc/platforms/iseries/release_data.h
index 66189fd2e32d..6ad7d843e8fc 100644
--- a/arch/powerpc/platforms/iseries/release_data.h
+++ b/arch/powerpc/platforms/iseries/release_data.h
@@ -58,6 +58,6 @@ struct HvReleaseData {
58 char xRsvd3[20]; /* Reserved x2C-x3F */ 58 char xRsvd3[20]; /* Reserved x2C-x3F */
59}; 59};
60 60
61extern struct HvReleaseData hvReleaseData; 61extern const struct HvReleaseData hvReleaseData;
62 62
63#endif /* _ISERIES_RELEASE_DATA_H */ 63#endif /* _ISERIES_RELEASE_DATA_H */
diff --git a/arch/powerpc/platforms/iseries/spcomm_area.h b/arch/powerpc/platforms/iseries/spcomm_area.h
index 6e3b685115c9..598b7c14573a 100644
--- a/arch/powerpc/platforms/iseries/spcomm_area.h
+++ b/arch/powerpc/platforms/iseries/spcomm_area.h
@@ -31,6 +31,4 @@ struct SpCommArea {
31 u8 xRsvd2[80]; // Reserved 030-07F 31 u8 xRsvd2[80]; // Reserved 030-07F
32}; 32};
33 33
34extern struct SpCommArea xSpCommArea;
35
36#endif /* _ISERIES_SPCOMM_AREA_H */ 34#endif /* _ISERIES_SPCOMM_AREA_H */
diff --git a/arch/powerpc/platforms/iseries/vpd_areas.h b/arch/powerpc/platforms/iseries/vpd_areas.h
index 601e6dd860ed..feb001f3a5fe 100644
--- a/arch/powerpc/platforms/iseries/vpd_areas.h
+++ b/arch/powerpc/platforms/iseries/vpd_areas.h
@@ -80,9 +80,9 @@ struct ItVpdAreas {
80 u32 xPlicDmaLens[ItDmaMaxEntries];// Array of DMA lengths 080-0A7 80 u32 xPlicDmaLens[ItDmaMaxEntries];// Array of DMA lengths 080-0A7
81 u32 xPlicDmaToks[ItDmaMaxEntries];// Array of DMA tokens 0A8-0CF 81 u32 xPlicDmaToks[ItDmaMaxEntries];// Array of DMA tokens 0A8-0CF
82 u32 xSlicVpdLens[ItVpdMaxEntries];// Array of VPD lengths 0D0-12F 82 u32 xSlicVpdLens[ItVpdMaxEntries];// Array of VPD lengths 0D0-12F
83 void *xSlicVpdAdrs[ItVpdMaxEntries];// Array of VPD buffers 130-1EF 83 const void *xSlicVpdAdrs[ItVpdMaxEntries];// Array of VPD buffers 130-1EF
84}; 84};
85 85
86extern struct ItVpdAreas itVpdAreas; 86extern const struct ItVpdAreas itVpdAreas;
87 87
88#endif /* _ISERIES_VPD_AREAS_H */ 88#endif /* _ISERIES_VPD_AREAS_H */
diff --git a/arch/powerpc/platforms/maple/pci.c b/arch/powerpc/platforms/maple/pci.c
index 3ffa0ac170ee..301855263b81 100644
--- a/arch/powerpc/platforms/maple/pci.c
+++ b/arch/powerpc/platforms/maple/pci.c
@@ -592,50 +592,3 @@ int maple_pci_get_legacy_ide_irq(struct pci_dev *pdev, int channel)
592 } 592 }
593 return irq; 593 return irq;
594} 594}
595
596/* XXX: To remove once all firmwares are ok */
597static void fixup_maple_ide(struct pci_dev* dev)
598{
599 if (!machine_is(maple))
600 return;
601
602#if 0 /* Enable this to enable IDE port 0 */
603 {
604 u8 v;
605
606 pci_read_config_byte(dev, 0x40, &v);
607 v |= 2;
608 pci_write_config_byte(dev, 0x40, v);
609 }
610#endif
611#if 0 /* fix bus master base */
612 pci_write_config_dword(dev, 0x20, 0xcc01);
613 printk("old ide resource: %lx -> %lx \n",
614 dev->resource[4].start, dev->resource[4].end);
615 dev->resource[4].start = 0xcc00;
616 dev->resource[4].end = 0xcc10;
617#endif
618#if 0 /* Enable this to fixup IDE sense/polarity of irqs in IO-APICs */
619 {
620 struct pci_dev *apicdev;
621 u32 v;
622
623 apicdev = pci_get_slot (dev->bus, PCI_DEVFN(5,0));
624 if (apicdev == NULL)
625 printk("IDE Fixup IRQ: Can't find IO-APIC !\n");
626 else {
627 pci_write_config_byte(apicdev, 0xf2, 0x10 + 2*14);
628 pci_read_config_dword(apicdev, 0xf4, &v);
629 v &= ~0x00000022;
630 pci_write_config_dword(apicdev, 0xf4, v);
631 pci_write_config_byte(apicdev, 0xf2, 0x10 + 2*15);
632 pci_read_config_dword(apicdev, 0xf4, &v);
633 v &= ~0x00000022;
634 pci_write_config_dword(apicdev, 0xf4, v);
635 pci_dev_put(apicdev);
636 }
637 }
638#endif
639}
640DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8111_IDE,
641 fixup_maple_ide);
diff --git a/arch/powerpc/platforms/maple/setup.c b/arch/powerpc/platforms/maple/setup.c
index 3ce2d73b4177..364714757cf1 100644
--- a/arch/powerpc/platforms/maple/setup.c
+++ b/arch/powerpc/platforms/maple/setup.c
@@ -43,6 +43,7 @@
43#include <linux/smp.h> 43#include <linux/smp.h>
44#include <linux/bitops.h> 44#include <linux/bitops.h>
45#include <linux/of_device.h> 45#include <linux/of_device.h>
46#include <linux/lmb.h>
46 47
47#include <asm/processor.h> 48#include <asm/processor.h>
48#include <asm/sections.h> 49#include <asm/sections.h>
@@ -57,7 +58,6 @@
57#include <asm/dma.h> 58#include <asm/dma.h>
58#include <asm/cputable.h> 59#include <asm/cputable.h>
59#include <asm/time.h> 60#include <asm/time.h>
60#include <asm/lmb.h>
61#include <asm/mpic.h> 61#include <asm/mpic.h>
62#include <asm/rtas.h> 62#include <asm/rtas.h>
63#include <asm/udbg.h> 63#include <asm/udbg.h>
@@ -319,7 +319,7 @@ static int __init maple_probe(void)
319 return 1; 319 return 1;
320} 320}
321 321
322define_machine(maple_md) { 322define_machine(maple) {
323 .name = "Maple", 323 .name = "Maple",
324 .probe = maple_probe, 324 .probe = maple_probe,
325 .setup_arch = maple_setup_arch, 325 .setup_arch = maple_setup_arch,
diff --git a/arch/powerpc/platforms/pasemi/dma_lib.c b/arch/powerpc/platforms/pasemi/dma_lib.c
index c529d8dff395..217af321b0ca 100644
--- a/arch/powerpc/platforms/pasemi/dma_lib.c
+++ b/arch/powerpc/platforms/pasemi/dma_lib.c
@@ -17,6 +17,7 @@
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */ 18 */
19 19
20#include <linux/kernel.h>
20#include <linux/init.h> 21#include <linux/init.h>
21#include <linux/module.h> 22#include <linux/module.h>
22#include <linux/pci.h> 23#include <linux/pci.h>
@@ -26,6 +27,8 @@
26 27
27#define MAX_TXCH 64 28#define MAX_TXCH 64
28#define MAX_RXCH 64 29#define MAX_RXCH 64
30#define MAX_FLAGS 64
31#define MAX_FUN 8
29 32
30static struct pasdma_status *dma_status; 33static struct pasdma_status *dma_status;
31 34
@@ -43,6 +46,8 @@ static struct pci_dev *dma_pdev;
43 46
44static DECLARE_BITMAP(txch_free, MAX_TXCH); 47static DECLARE_BITMAP(txch_free, MAX_TXCH);
45static DECLARE_BITMAP(rxch_free, MAX_RXCH); 48static DECLARE_BITMAP(rxch_free, MAX_RXCH);
49static DECLARE_BITMAP(flags_free, MAX_FLAGS);
50static DECLARE_BITMAP(fun_free, MAX_FUN);
46 51
47/* pasemi_read_iob_reg - read IOB register 52/* pasemi_read_iob_reg - read IOB register
48 * @reg: Register to read (offset into PCI CFG space) 53 * @reg: Register to read (offset into PCI CFG space)
@@ -373,6 +378,106 @@ void pasemi_dma_free_buf(struct pasemi_dmachan *chan, int size,
373} 378}
374EXPORT_SYMBOL(pasemi_dma_free_buf); 379EXPORT_SYMBOL(pasemi_dma_free_buf);
375 380
381/* pasemi_dma_alloc_flag - Allocate a flag (event) for channel syncronization
382 *
383 * Allocates a flag for use with channel syncronization (event descriptors).
384 * Returns allocated flag (0-63), < 0 on error.
385 */
386int pasemi_dma_alloc_flag(void)
387{
388 int bit;
389
390retry:
391 bit = find_next_bit(flags_free, MAX_FLAGS, 0);
392 if (bit >= MAX_FLAGS)
393 return -ENOSPC;
394 if (!test_and_clear_bit(bit, flags_free))
395 goto retry;
396
397 return bit;
398}
399EXPORT_SYMBOL(pasemi_dma_alloc_flag);
400
401
402/* pasemi_dma_free_flag - Deallocates a flag (event)
403 * @flag: Flag number to deallocate
404 *
405 * Frees up a flag so it can be reused for other purposes.
406 */
407void pasemi_dma_free_flag(int flag)
408{
409 BUG_ON(test_bit(flag, flags_free));
410 BUG_ON(flag >= MAX_FLAGS);
411 set_bit(flag, flags_free);
412}
413EXPORT_SYMBOL(pasemi_dma_free_flag);
414
415
416/* pasemi_dma_set_flag - Sets a flag (event) to 1
417 * @flag: Flag number to set active
418 *
419 * Sets the flag provided to 1.
420 */
421void pasemi_dma_set_flag(int flag)
422{
423 BUG_ON(flag >= MAX_FLAGS);
424 if (flag < 32)
425 pasemi_write_dma_reg(PAS_DMA_TXF_SFLG0, 1 << flag);
426 else
427 pasemi_write_dma_reg(PAS_DMA_TXF_SFLG1, 1 << flag);
428}
429EXPORT_SYMBOL(pasemi_dma_set_flag);
430
431/* pasemi_dma_clear_flag - Sets a flag (event) to 0
432 * @flag: Flag number to set inactive
433 *
434 * Sets the flag provided to 0.
435 */
436void pasemi_dma_clear_flag(int flag)
437{
438 BUG_ON(flag >= MAX_FLAGS);
439 if (flag < 32)
440 pasemi_write_dma_reg(PAS_DMA_TXF_CFLG0, 1 << flag);
441 else
442 pasemi_write_dma_reg(PAS_DMA_TXF_CFLG1, 1 << flag);
443}
444EXPORT_SYMBOL(pasemi_dma_clear_flag);
445
446/* pasemi_dma_alloc_fun - Allocate a function engine
447 *
448 * Allocates a function engine to use for crypto/checksum offload
449 * Returns allocated engine (0-8), < 0 on error.
450 */
451int pasemi_dma_alloc_fun(void)
452{
453 int bit;
454
455retry:
456 bit = find_next_bit(fun_free, MAX_FLAGS, 0);
457 if (bit >= MAX_FLAGS)
458 return -ENOSPC;
459 if (!test_and_clear_bit(bit, fun_free))
460 goto retry;
461
462 return bit;
463}
464EXPORT_SYMBOL(pasemi_dma_alloc_fun);
465
466
467/* pasemi_dma_free_fun - Deallocates a function engine
468 * @flag: Engine number to deallocate
469 *
470 * Frees up a function engine so it can be used for other purposes.
471 */
472void pasemi_dma_free_fun(int fun)
473{
474 BUG_ON(test_bit(fun, fun_free));
475 BUG_ON(fun >= MAX_FLAGS);
476 set_bit(fun, fun_free);
477}
478EXPORT_SYMBOL(pasemi_dma_free_fun);
479
480
376static void *map_onedev(struct pci_dev *p, int index) 481static void *map_onedev(struct pci_dev *p, int index)
377{ 482{
378 struct device_node *dn; 483 struct device_node *dn;
@@ -410,6 +515,7 @@ int pasemi_dma_init(void)
410 struct resource res; 515 struct resource res;
411 struct device_node *dn; 516 struct device_node *dn;
412 int i, intf, err = 0; 517 int i, intf, err = 0;
518 unsigned long timeout;
413 u32 tmp; 519 u32 tmp;
414 520
415 if (!machine_is(pasemi)) 521 if (!machine_is(pasemi))
@@ -478,6 +584,44 @@ int pasemi_dma_init(void)
478 for (i = 0; i < MAX_RXCH; i++) 584 for (i = 0; i < MAX_RXCH; i++)
479 __set_bit(i, rxch_free); 585 __set_bit(i, rxch_free);
480 586
587 timeout = jiffies + HZ;
588 pasemi_write_dma_reg(PAS_DMA_COM_RXCMD, 0);
589 while (pasemi_read_dma_reg(PAS_DMA_COM_RXSTA) & 1) {
590 if (time_after(jiffies, timeout)) {
591 pr_warning("Warning: Could not disable RX section\n");
592 break;
593 }
594 }
595
596 timeout = jiffies + HZ;
597 pasemi_write_dma_reg(PAS_DMA_COM_TXCMD, 0);
598 while (pasemi_read_dma_reg(PAS_DMA_COM_TXSTA) & 1) {
599 if (time_after(jiffies, timeout)) {
600 pr_warning("Warning: Could not disable TX section\n");
601 break;
602 }
603 }
604
605 /* setup resource allocations for the different DMA sections */
606 tmp = pasemi_read_dma_reg(PAS_DMA_COM_CFG);
607 pasemi_write_dma_reg(PAS_DMA_COM_CFG, tmp | 0x18000000);
608
609 /* enable tx section */
610 pasemi_write_dma_reg(PAS_DMA_COM_TXCMD, PAS_DMA_COM_TXCMD_EN);
611
612 /* enable rx section */
613 pasemi_write_dma_reg(PAS_DMA_COM_RXCMD, PAS_DMA_COM_RXCMD_EN);
614
615 for (i = 0; i < MAX_FLAGS; i++)
616 __set_bit(i, flags_free);
617
618 for (i = 0; i < MAX_FUN; i++)
619 __set_bit(i, fun_free);
620
621 /* clear all status flags */
622 pasemi_write_dma_reg(PAS_DMA_TXF_CFLG0, 0xffffffff);
623 pasemi_write_dma_reg(PAS_DMA_TXF_CFLG1, 0xffffffff);
624
481 printk(KERN_INFO "PA Semi PWRficient DMA library initialized " 625 printk(KERN_INFO "PA Semi PWRficient DMA library initialized "
482 "(%d tx, %d rx channels)\n", num_txch, num_rxch); 626 "(%d tx, %d rx channels)\n", num_txch, num_rxch);
483 627
diff --git a/arch/powerpc/platforms/pasemi/iommu.c b/arch/powerpc/platforms/pasemi/iommu.c
index 5803f11c77fc..86967bdd8774 100644
--- a/arch/powerpc/platforms/pasemi/iommu.c
+++ b/arch/powerpc/platforms/pasemi/iommu.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2005-2007, PA Semi, Inc 2 * Copyright (C) 2005-2008, PA Semi, Inc
3 * 3 *
4 * Maintained by: Olof Johansson <olof@lixom.net> 4 * Maintained by: Olof Johansson <olof@lixom.net>
5 * 5 *
@@ -27,7 +27,6 @@
27#include <asm/abs_addr.h> 27#include <asm/abs_addr.h>
28#include <asm/firmware.h> 28#include <asm/firmware.h>
29 29
30
31#define IOBMAP_PAGE_SHIFT 12 30#define IOBMAP_PAGE_SHIFT 12
32#define IOBMAP_PAGE_SIZE (1 << IOBMAP_PAGE_SHIFT) 31#define IOBMAP_PAGE_SIZE (1 << IOBMAP_PAGE_SHIFT)
33#define IOBMAP_PAGE_MASK (IOBMAP_PAGE_SIZE - 1) 32#define IOBMAP_PAGE_MASK (IOBMAP_PAGE_SIZE - 1)
@@ -35,13 +34,13 @@
35#define IOB_BASE 0xe0000000 34#define IOB_BASE 0xe0000000
36#define IOB_SIZE 0x3000 35#define IOB_SIZE 0x3000
37/* Configuration registers */ 36/* Configuration registers */
38#define IOBCAP_REG 0x10 37#define IOBCAP_REG 0x40
39#define IOBCOM_REG 0x40 38#define IOBCOM_REG 0x100
40/* Enable IOB address translation */ 39/* Enable IOB address translation */
41#define IOBCOM_ATEN 0x00000100 40#define IOBCOM_ATEN 0x00000100
42 41
43/* Address decode configuration register */ 42/* Address decode configuration register */
44#define IOB_AD_REG 0x53 43#define IOB_AD_REG 0x14c
45/* IOBCOM_AD_REG fields */ 44/* IOBCOM_AD_REG fields */
46#define IOB_AD_VGPRT 0x00000e00 45#define IOB_AD_VGPRT 0x00000e00
47#define IOB_AD_VGAEN 0x00000100 46#define IOB_AD_VGAEN 0x00000100
@@ -56,13 +55,13 @@
56#define IOB_AD_TRNG_2G 0x00000001 55#define IOB_AD_TRNG_2G 0x00000001
57#define IOB_AD_TRNG_128G 0x00000003 56#define IOB_AD_TRNG_128G 0x00000003
58 57
59#define IOB_TABLEBASE_REG 0x55 58#define IOB_TABLEBASE_REG 0x154
60 59
61/* Base of the 64 4-byte L1 registers */ 60/* Base of the 64 4-byte L1 registers */
62#define IOB_XLT_L1_REGBASE 0xac0 61#define IOB_XLT_L1_REGBASE 0x2b00
63 62
64/* Register to invalidate TLB entries */ 63/* Register to invalidate TLB entries */
65#define IOB_AT_INVAL_TLB_REG 0xb40 64#define IOB_AT_INVAL_TLB_REG 0x2d00
66 65
67/* The top two bits of the level 1 entry contains valid and type flags */ 66/* The top two bits of the level 1 entry contains valid and type flags */
68#define IOBMAP_L1E_V 0x40000000 67#define IOBMAP_L1E_V 0x40000000
@@ -76,7 +75,7 @@
76#define IOBMAP_L2E_V 0x80000000 75#define IOBMAP_L2E_V 0x80000000
77#define IOBMAP_L2E_V_CACHED 0xc0000000 76#define IOBMAP_L2E_V_CACHED 0xc0000000
78 77
79static u32 __iomem *iob; 78static void __iomem *iob;
80static u32 iob_l1_emptyval; 79static u32 iob_l1_emptyval;
81static u32 iob_l2_emptyval; 80static u32 iob_l2_emptyval;
82static u32 *iob_l2_base; 81static u32 *iob_l2_base;
@@ -219,7 +218,7 @@ int __init iob_init(struct device_node *dn)
219 for (i = 0; i < 64; i++) { 218 for (i = 0; i < 64; i++) {
220 /* Each L1 covers 32MB, i.e. 8K entries = 32K of ram */ 219 /* Each L1 covers 32MB, i.e. 8K entries = 32K of ram */
221 regword = IOBMAP_L1E_V | (__pa(iob_l2_base + i*0x2000) >> 12); 220 regword = IOBMAP_L1E_V | (__pa(iob_l2_base + i*0x2000) >> 12);
222 out_le32(iob+IOB_XLT_L1_REGBASE+i, regword); 221 out_le32(iob+IOB_XLT_L1_REGBASE+i*4, regword);
223 } 222 }
224 223
225 /* set 2GB translation window, based at 0 */ 224 /* set 2GB translation window, based at 0 */
diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c
index 2693fc371eab..bf44c5441a36 100644
--- a/arch/powerpc/platforms/powermac/setup.c
+++ b/arch/powerpc/platforms/powermac/setup.c
@@ -53,6 +53,7 @@
53#include <linux/suspend.h> 53#include <linux/suspend.h>
54#include <linux/of_device.h> 54#include <linux/of_device.h>
55#include <linux/of_platform.h> 55#include <linux/of_platform.h>
56#include <linux/lmb.h>
56 57
57#include <asm/reg.h> 58#include <asm/reg.h>
58#include <asm/sections.h> 59#include <asm/sections.h>
@@ -74,7 +75,6 @@
74#include <asm/iommu.h> 75#include <asm/iommu.h>
75#include <asm/smu.h> 76#include <asm/smu.h>
76#include <asm/pmc.h> 77#include <asm/pmc.h>
77#include <asm/lmb.h>
78#include <asm/udbg.h> 78#include <asm/udbg.h>
79 79
80#include "pmac.h" 80#include "pmac.h"
diff --git a/arch/powerpc/platforms/ps3/device-init.c b/arch/powerpc/platforms/ps3/device-init.c
index 9d251d0ca8c6..3866debfa3c4 100644
--- a/arch/powerpc/platforms/ps3/device-init.c
+++ b/arch/powerpc/platforms/ps3/device-init.c
@@ -499,41 +499,14 @@ static int __init ps3_register_graphics_devices(void)
499} 499}
500 500
501/** 501/**
502 * ps3_register_repository_device - Register a device from the repositiory info. 502 * ps3_setup_dynamic_device - Setup a dynamic device from the repository
503 *
504 */ 503 */
505 504
506static int ps3_register_repository_device( 505static int ps3_setup_dynamic_device(const struct ps3_repository_device *repo)
507 const struct ps3_repository_device *repo)
508{ 506{
509 int result; 507 int result;
510 508
511 switch (repo->dev_type) { 509 switch (repo->dev_type) {
512 case PS3_DEV_TYPE_SB_GELIC:
513 result = ps3_setup_gelic_device(repo);
514 if (result) {
515 pr_debug("%s:%d ps3_setup_gelic_device failed\n",
516 __func__, __LINE__);
517 }
518 break;
519 case PS3_DEV_TYPE_SB_USB:
520
521 /* Each USB device has both an EHCI and an OHCI HC */
522
523 result = ps3_setup_ehci_device(repo);
524
525 if (result) {
526 pr_debug("%s:%d ps3_setup_ehci_device failed\n",
527 __func__, __LINE__);
528 }
529
530 result = ps3_setup_ohci_device(repo);
531
532 if (result) {
533 pr_debug("%s:%d ps3_setup_ohci_device failed\n",
534 __func__, __LINE__);
535 }
536 break;
537 case PS3_DEV_TYPE_STOR_DISK: 510 case PS3_DEV_TYPE_STOR_DISK:
538 result = ps3_setup_storage_dev(repo, PS3_MATCH_ID_STOR_DISK); 511 result = ps3_setup_storage_dev(repo, PS3_MATCH_ID_STOR_DISK);
539 512
@@ -572,6 +545,48 @@ static int ps3_register_repository_device(
572 return result; 545 return result;
573} 546}
574 547
548/**
549 * ps3_setup_static_device - Setup a static device from the repository
550 */
551
552static int __init ps3_setup_static_device(const struct ps3_repository_device *repo)
553{
554 int result;
555
556 switch (repo->dev_type) {
557 case PS3_DEV_TYPE_SB_GELIC:
558 result = ps3_setup_gelic_device(repo);
559 if (result) {
560 pr_debug("%s:%d ps3_setup_gelic_device failed\n",
561 __func__, __LINE__);
562 }
563 break;
564 case PS3_DEV_TYPE_SB_USB:
565
566 /* Each USB device has both an EHCI and an OHCI HC */
567
568 result = ps3_setup_ehci_device(repo);
569
570 if (result) {
571 pr_debug("%s:%d ps3_setup_ehci_device failed\n",
572 __func__, __LINE__);
573 }
574
575 result = ps3_setup_ohci_device(repo);
576
577 if (result) {
578 pr_debug("%s:%d ps3_setup_ohci_device failed\n",
579 __func__, __LINE__);
580 }
581 break;
582
583 default:
584 return ps3_setup_dynamic_device(repo);
585 }
586
587 return result;
588}
589
575static void ps3_find_and_add_device(u64 bus_id, u64 dev_id) 590static void ps3_find_and_add_device(u64 bus_id, u64 dev_id)
576{ 591{
577 struct ps3_repository_device repo; 592 struct ps3_repository_device repo;
@@ -601,7 +616,7 @@ found:
601 pr_debug("%s:%u: device %lu:%lu found after %u retries\n", 616 pr_debug("%s:%u: device %lu:%lu found after %u retries\n",
602 __func__, __LINE__, bus_id, dev_id, retries); 617 __func__, __LINE__, bus_id, dev_id, retries);
603 618
604 ps3_register_repository_device(&repo); 619 ps3_setup_dynamic_device(&repo);
605 return; 620 return;
606} 621}
607 622
@@ -905,8 +920,7 @@ static int __init ps3_register_devices(void)
905 920
906 ps3_register_graphics_devices(); 921 ps3_register_graphics_devices();
907 922
908 ps3_repository_find_devices(PS3_BUS_TYPE_SB, 923 ps3_repository_find_devices(PS3_BUS_TYPE_SB, ps3_setup_static_device);
909 ps3_register_repository_device);
910 924
911 ps3_register_sound_devices(); 925 ps3_register_sound_devices();
912 926
diff --git a/arch/powerpc/platforms/ps3/htab.c b/arch/powerpc/platforms/ps3/htab.c
index 7382f195c4f8..1cf901fa9031 100644
--- a/arch/powerpc/platforms/ps3/htab.c
+++ b/arch/powerpc/platforms/ps3/htab.c
@@ -19,9 +19,10 @@
19 */ 19 */
20 20
21#include <linux/kernel.h> 21#include <linux/kernel.h>
22#include <linux/lmb.h>
22 23
23#include <asm/machdep.h> 24#include <asm/machdep.h>
24#include <asm/lmb.h> 25#include <asm/prom.h>
25#include <asm/udbg.h> 26#include <asm/udbg.h>
26#include <asm/lv1call.h> 27#include <asm/lv1call.h>
27#include <asm/ps3fb.h> 28#include <asm/ps3fb.h>
diff --git a/arch/powerpc/platforms/ps3/interrupt.c b/arch/powerpc/platforms/ps3/interrupt.c
index 3a6db04aa940..a14e5cdc2fed 100644
--- a/arch/powerpc/platforms/ps3/interrupt.c
+++ b/arch/powerpc/platforms/ps3/interrupt.c
@@ -709,7 +709,7 @@ static unsigned int ps3_get_irq(void)
709 asm volatile("cntlzd %0,%1" : "=r" (plug) : "r" (x)); 709 asm volatile("cntlzd %0,%1" : "=r" (plug) : "r" (x));
710 plug &= 0x3f; 710 plug &= 0x3f;
711 711
712 if (unlikely(plug) == NO_IRQ) { 712 if (unlikely(plug == NO_IRQ)) {
713 pr_debug("%s:%d: no plug found: thread_id %lu\n", __func__, 713 pr_debug("%s:%d: no plug found: thread_id %lu\n", __func__,
714 __LINE__, pd->thread_id); 714 __LINE__, pd->thread_id);
715 dump_bmp(&per_cpu(ps3_private, 0)); 715 dump_bmp(&per_cpu(ps3_private, 0));
diff --git a/arch/powerpc/platforms/ps3/mm.c b/arch/powerpc/platforms/ps3/mm.c
index 68900476c842..5b3fb2b321ab 100644
--- a/arch/powerpc/platforms/ps3/mm.c
+++ b/arch/powerpc/platforms/ps3/mm.c
@@ -21,9 +21,10 @@
21#include <linux/kernel.h> 21#include <linux/kernel.h>
22#include <linux/module.h> 22#include <linux/module.h>
23#include <linux/memory_hotplug.h> 23#include <linux/memory_hotplug.h>
24#include <linux/lmb.h>
24 25
25#include <asm/firmware.h> 26#include <asm/firmware.h>
26#include <asm/lmb.h> 27#include <asm/prom.h>
27#include <asm/udbg.h> 28#include <asm/udbg.h>
28#include <asm/lv1call.h> 29#include <asm/lv1call.h>
29 30
diff --git a/arch/powerpc/platforms/ps3/os-area.c b/arch/powerpc/platforms/ps3/os-area.c
index b9ea09d9d2fb..c73379ec9141 100644
--- a/arch/powerpc/platforms/ps3/os-area.c
+++ b/arch/powerpc/platforms/ps3/os-area.c
@@ -24,8 +24,9 @@
24#include <linux/fs.h> 24#include <linux/fs.h>
25#include <linux/syscalls.h> 25#include <linux/syscalls.h>
26#include <linux/ctype.h> 26#include <linux/ctype.h>
27#include <linux/lmb.h>
27 28
28#include <asm/lmb.h> 29#include <asm/prom.h>
29 30
30#include "platform.h" 31#include "platform.h"
31 32
diff --git a/arch/powerpc/platforms/ps3/setup.c b/arch/powerpc/platforms/ps3/setup.c
index 5c2cbb08eb52..a413abbd4123 100644
--- a/arch/powerpc/platforms/ps3/setup.c
+++ b/arch/powerpc/platforms/ps3/setup.c
@@ -95,6 +95,14 @@ static void ps3_power_off(void)
95 ps3_sys_manager_power_off(); /* never returns */ 95 ps3_sys_manager_power_off(); /* never returns */
96} 96}
97 97
98static void ps3_halt(void)
99{
100 DBG("%s:%d\n", __func__, __LINE__);
101
102 smp_send_stop();
103 ps3_sys_manager_halt(); /* never returns */
104}
105
98static void ps3_panic(char *str) 106static void ps3_panic(char *str)
99{ 107{
100 DBG("%s:%d %s\n", __func__, __LINE__, str); 108 DBG("%s:%d %s\n", __func__, __LINE__, str);
@@ -105,7 +113,8 @@ static void ps3_panic(char *str)
105 printk(" Please press POWER button.\n"); 113 printk(" Please press POWER button.\n");
106 printk("\n"); 114 printk("\n");
107 115
108 while(1); 116 while(1)
117 lv1_pause(1);
109} 118}
110 119
111#if defined(CONFIG_FB_PS3) || defined(CONFIG_FB_PS3_MODULE) || \ 120#if defined(CONFIG_FB_PS3) || defined(CONFIG_FB_PS3_MODULE) || \
@@ -117,7 +126,7 @@ static void __init prealloc(struct ps3_prealloc *p)
117 126
118 p->address = __alloc_bootmem(p->size, p->align, __pa(MAX_DMA_ADDRESS)); 127 p->address = __alloc_bootmem(p->size, p->align, __pa(MAX_DMA_ADDRESS));
119 if (!p->address) { 128 if (!p->address) {
120 printk(KERN_ERR "%s: Cannot allocate %s\n", __FUNCTION__, 129 printk(KERN_ERR "%s: Cannot allocate %s\n", __func__,
121 p->name); 130 p->name);
122 return; 131 return;
123 } 132 }
@@ -266,6 +275,7 @@ define_machine(ps3) {
266 .progress = ps3_progress, 275 .progress = ps3_progress,
267 .restart = ps3_restart, 276 .restart = ps3_restart,
268 .power_off = ps3_power_off, 277 .power_off = ps3_power_off,
278 .halt = ps3_halt,
269#if defined(CONFIG_KEXEC) 279#if defined(CONFIG_KEXEC)
270 .kexec_cpu_down = ps3_kexec_cpu_down, 280 .kexec_cpu_down = ps3_kexec_cpu_down,
271 .machine_kexec = default_machine_kexec, 281 .machine_kexec = default_machine_kexec,
diff --git a/arch/powerpc/platforms/ps3/spu.c b/arch/powerpc/platforms/ps3/spu.c
index 5ad41189b494..d135cef9ed6a 100644
--- a/arch/powerpc/platforms/ps3/spu.c
+++ b/arch/powerpc/platforms/ps3/spu.c
@@ -27,6 +27,7 @@
27#include <asm/spu.h> 27#include <asm/spu.h>
28#include <asm/spu_priv1.h> 28#include <asm/spu_priv1.h>
29#include <asm/lv1call.h> 29#include <asm/lv1call.h>
30#include <asm/ps3.h>
30 31
31#include "../cell/spufs/spufs.h" 32#include "../cell/spufs/spufs.h"
32#include "platform.h" 33#include "platform.h"
@@ -140,6 +141,12 @@ static void _dump_areas(unsigned int spe_id, unsigned long priv2,
140 pr_debug("%s:%d: shadow: %lxh\n", func, line, shadow); 141 pr_debug("%s:%d: shadow: %lxh\n", func, line, shadow);
141} 142}
142 143
144inline u64 ps3_get_spe_id(void *arg)
145{
146 return spu_pdata(arg)->spe_id;
147}
148EXPORT_SYMBOL_GPL(ps3_get_spe_id);
149
143static unsigned long get_vas_id(void) 150static unsigned long get_vas_id(void)
144{ 151{
145 unsigned long id; 152 unsigned long id;
diff --git a/arch/powerpc/platforms/pseries/Makefile b/arch/powerpc/platforms/pseries/Makefile
index 992ba6753cf2..bdae04bb7a01 100644
--- a/arch/powerpc/platforms/pseries/Makefile
+++ b/arch/powerpc/platforms/pseries/Makefile
@@ -18,3 +18,4 @@ obj-$(CONFIG_HOTPLUG_CPU) += hotplug-cpu.o
18obj-$(CONFIG_HVC_CONSOLE) += hvconsole.o 18obj-$(CONFIG_HVC_CONSOLE) += hvconsole.o
19obj-$(CONFIG_HVCS) += hvcserver.o 19obj-$(CONFIG_HVCS) += hvcserver.o
20obj-$(CONFIG_HCALL_STATS) += hvCall_inst.o 20obj-$(CONFIG_HCALL_STATS) += hvCall_inst.o
21obj-$(CONFIG_PHYP_DUMP) += phyp_dump.o
diff --git a/arch/powerpc/platforms/pseries/eeh.c b/arch/powerpc/platforms/pseries/eeh.c
index 9eb539ee5f9a..550b2f7d2cc1 100644
--- a/arch/powerpc/platforms/pseries/eeh.c
+++ b/arch/powerpc/platforms/pseries/eeh.c
@@ -945,7 +945,6 @@ static void *early_enable_eeh(struct device_node *dn, void *data)
945 unsigned int rets[3]; 945 unsigned int rets[3];
946 struct eeh_early_enable_info *info = data; 946 struct eeh_early_enable_info *info = data;
947 int ret; 947 int ret;
948 const char *status = of_get_property(dn, "status", NULL);
949 const u32 *class_code = of_get_property(dn, "class-code", NULL); 948 const u32 *class_code = of_get_property(dn, "class-code", NULL);
950 const u32 *vendor_id = of_get_property(dn, "vendor-id", NULL); 949 const u32 *vendor_id = of_get_property(dn, "vendor-id", NULL);
951 const u32 *device_id = of_get_property(dn, "device-id", NULL); 950 const u32 *device_id = of_get_property(dn, "device-id", NULL);
@@ -959,8 +958,8 @@ static void *early_enable_eeh(struct device_node *dn, void *data)
959 pdn->eeh_freeze_count = 0; 958 pdn->eeh_freeze_count = 0;
960 pdn->eeh_false_positives = 0; 959 pdn->eeh_false_positives = 0;
961 960
962 if (status && strncmp(status, "ok", 2) != 0) 961 if (!of_device_is_available(dn))
963 return NULL; /* ignore devices with bad status */ 962 return NULL;
964 963
965 /* Ignore bad nodes. */ 964 /* Ignore bad nodes. */
966 if (!class_code || !vendor_id || !device_id) 965 if (!class_code || !vendor_id || !device_id)
diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
index 9a455d46379d..9235c469449e 100644
--- a/arch/powerpc/platforms/pseries/lpar.c
+++ b/arch/powerpc/platforms/pseries/lpar.c
@@ -40,6 +40,7 @@
40#include <asm/smp.h> 40#include <asm/smp.h>
41 41
42#include "plpar_wrappers.h" 42#include "plpar_wrappers.h"
43#include "pseries.h"
43 44
44#ifdef DEBUG_LOW 45#ifdef DEBUG_LOW
45#define DBG_LOW(fmt...) do { udbg_printf(fmt); } while(0) 46#define DBG_LOW(fmt...) do { udbg_printf(fmt); } while(0)
@@ -203,7 +204,6 @@ void __init find_udbg_vterm(void)
203 struct device_node *stdout_node; 204 struct device_node *stdout_node;
204 const u32 *termno; 205 const u32 *termno;
205 const char *name; 206 const char *name;
206 int add_console;
207 207
208 /* find the boot console from /chosen/stdout */ 208 /* find the boot console from /chosen/stdout */
209 if (!of_chosen) 209 if (!of_chosen)
@@ -219,8 +219,6 @@ void __init find_udbg_vterm(void)
219 printk(KERN_WARNING "stdout node missing 'name' property!\n"); 219 printk(KERN_WARNING "stdout node missing 'name' property!\n");
220 goto out; 220 goto out;
221 } 221 }
222 /* The user has requested a console so this is already set up. */
223 add_console = !strstr(cmd_line, "console=");
224 222
225 /* Check if it's a virtual terminal */ 223 /* Check if it's a virtual terminal */
226 if (strncmp(name, "vty", 3) != 0) 224 if (strncmp(name, "vty", 3) != 0)
@@ -234,15 +232,13 @@ void __init find_udbg_vterm(void)
234 udbg_putc = udbg_putcLP; 232 udbg_putc = udbg_putcLP;
235 udbg_getc = udbg_getcLP; 233 udbg_getc = udbg_getcLP;
236 udbg_getc_poll = udbg_getc_pollLP; 234 udbg_getc_poll = udbg_getc_pollLP;
237 if (add_console) 235 add_preferred_console("hvc", termno[0] & 0xff, NULL);
238 add_preferred_console("hvc", termno[0] & 0xff, NULL);
239 } else if (of_device_is_compatible(stdout_node, "hvterm-protocol")) { 236 } else if (of_device_is_compatible(stdout_node, "hvterm-protocol")) {
240 vtermno = termno[0]; 237 vtermno = termno[0];
241 udbg_putc = udbg_hvsi_putc; 238 udbg_putc = udbg_hvsi_putc;
242 udbg_getc = udbg_hvsi_getc; 239 udbg_getc = udbg_hvsi_getc;
243 udbg_getc_poll = udbg_hvsi_getc_poll; 240 udbg_getc_poll = udbg_hvsi_getc_poll;
244 if (add_console) 241 add_preferred_console("hvsi", termno[0] & 0xff, NULL);
245 add_preferred_console("hvsi", termno[0] & 0xff, NULL);
246 } 242 }
247out: 243out:
248 of_node_put(stdout_node); 244 of_node_put(stdout_node);
@@ -520,6 +516,20 @@ static void pSeries_lpar_hpte_invalidate(unsigned long slot, unsigned long va,
520 BUG_ON(lpar_rc != H_SUCCESS); 516 BUG_ON(lpar_rc != H_SUCCESS);
521} 517}
522 518
519static void pSeries_lpar_hpte_removebolted(unsigned long ea,
520 int psize, int ssize)
521{
522 unsigned long slot, vsid, va;
523
524 vsid = get_kernel_vsid(ea, ssize);
525 va = hpt_va(ea, vsid, ssize);
526
527 slot = pSeries_lpar_hpte_find(va, psize, ssize);
528 BUG_ON(slot == -1);
529
530 pSeries_lpar_hpte_invalidate(slot, va, psize, ssize, 0);
531}
532
523/* Flag bits for H_BULK_REMOVE */ 533/* Flag bits for H_BULK_REMOVE */
524#define HBR_REQUEST 0x4000000000000000UL 534#define HBR_REQUEST 0x4000000000000000UL
525#define HBR_RESPONSE 0x8000000000000000UL 535#define HBR_RESPONSE 0x8000000000000000UL
@@ -597,6 +607,7 @@ void __init hpte_init_lpar(void)
597 ppc_md.hpte_updateboltedpp = pSeries_lpar_hpte_updateboltedpp; 607 ppc_md.hpte_updateboltedpp = pSeries_lpar_hpte_updateboltedpp;
598 ppc_md.hpte_insert = pSeries_lpar_hpte_insert; 608 ppc_md.hpte_insert = pSeries_lpar_hpte_insert;
599 ppc_md.hpte_remove = pSeries_lpar_hpte_remove; 609 ppc_md.hpte_remove = pSeries_lpar_hpte_remove;
610 ppc_md.hpte_removebolted = pSeries_lpar_hpte_removebolted;
600 ppc_md.flush_hash_range = pSeries_lpar_flush_hash_range; 611 ppc_md.flush_hash_range = pSeries_lpar_flush_hash_range;
601 ppc_md.hpte_clear_all = pSeries_lpar_hptab_clear; 612 ppc_md.hpte_clear_all = pSeries_lpar_hptab_clear;
602} 613}
diff --git a/arch/powerpc/platforms/pseries/pci_dlpar.c b/arch/powerpc/platforms/pseries/pci_dlpar.c
index 5a5a19e40bb4..0d7229cde0e9 100644
--- a/arch/powerpc/platforms/pseries/pci_dlpar.c
+++ b/arch/powerpc/platforms/pseries/pci_dlpar.c
@@ -123,7 +123,7 @@ pcibios_pci_config_bridge(struct pci_dev *dev)
123 /* Add to children of PCI bridge dev->bus */ 123 /* Add to children of PCI bridge dev->bus */
124 child_bus = pci_add_new_bus(dev->bus, dev, sec_busno); 124 child_bus = pci_add_new_bus(dev->bus, dev, sec_busno);
125 if (!child_bus) { 125 if (!child_bus) {
126 printk (KERN_ERR "%s: could not add second bus\n", __FUNCTION__); 126 printk (KERN_ERR "%s: could not add second bus\n", __func__);
127 return -EIO; 127 return -EIO;
128 } 128 }
129 sprintf(child_bus->name, "PCI Bus #%02x", child_bus->number); 129 sprintf(child_bus->name, "PCI Bus #%02x", child_bus->number);
diff --git a/arch/powerpc/platforms/pseries/phyp_dump.c b/arch/powerpc/platforms/pseries/phyp_dump.c
new file mode 100644
index 000000000000..edbc012c2ebc
--- /dev/null
+++ b/arch/powerpc/platforms/pseries/phyp_dump.c
@@ -0,0 +1,507 @@
1/*
2 * Hypervisor-assisted dump
3 *
4 * Linas Vepstas, Manish Ahuja 2008
5 * Copyright 2008 IBM Corp.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 *
12 */
13
14#include <linux/init.h>
15#include <linux/kobject.h>
16#include <linux/mm.h>
17#include <linux/of.h>
18#include <linux/pfn.h>
19#include <linux/swap.h>
20#include <linux/sysfs.h>
21
22#include <asm/page.h>
23#include <asm/phyp_dump.h>
24#include <asm/machdep.h>
25#include <asm/prom.h>
26#include <asm/rtas.h>
27
28/* Variables, used to communicate data between early boot and late boot */
29static struct phyp_dump phyp_dump_vars;
30struct phyp_dump *phyp_dump_info = &phyp_dump_vars;
31
32static int ibm_configure_kernel_dump;
33/* ------------------------------------------------- */
34/* RTAS interfaces to declare the dump regions */
35
36struct dump_section {
37 u32 dump_flags;
38 u16 source_type;
39 u16 error_flags;
40 u64 source_address;
41 u64 source_length;
42 u64 length_copied;
43 u64 destination_address;
44};
45
46struct phyp_dump_header {
47 u32 version;
48 u16 num_of_sections;
49 u16 status;
50
51 u32 first_offset_section;
52 u32 dump_disk_section;
53 u64 block_num_dd;
54 u64 num_of_blocks_dd;
55 u32 offset_dd;
56 u32 maxtime_to_auto;
57 /* No dump disk path string used */
58
59 struct dump_section cpu_data;
60 struct dump_section hpte_data;
61 struct dump_section kernel_data;
62};
63
64/* The dump header *must be* in low memory, so .bss it */
65static struct phyp_dump_header phdr;
66
67#define NUM_DUMP_SECTIONS 3
68#define DUMP_HEADER_VERSION 0x1
69#define DUMP_REQUEST_FLAG 0x1
70#define DUMP_SOURCE_CPU 0x0001
71#define DUMP_SOURCE_HPTE 0x0002
72#define DUMP_SOURCE_RMO 0x0011
73#define DUMP_ERROR_FLAG 0x2000
74#define DUMP_TRIGGERED 0x4000
75#define DUMP_PERFORMED 0x8000
76
77
78/**
79 * init_dump_header() - initialize the header declaring a dump
80 * Returns: length of dump save area.
81 *
82 * When the hypervisor saves crashed state, it needs to put
83 * it somewhere. The dump header tells the hypervisor where
84 * the data can be saved.
85 */
86static unsigned long init_dump_header(struct phyp_dump_header *ph)
87{
88 unsigned long addr_offset = 0;
89
90 /* Set up the dump header */
91 ph->version = DUMP_HEADER_VERSION;
92 ph->num_of_sections = NUM_DUMP_SECTIONS;
93 ph->status = 0;
94
95 ph->first_offset_section =
96 (u32)offsetof(struct phyp_dump_header, cpu_data);
97 ph->dump_disk_section = 0;
98 ph->block_num_dd = 0;
99 ph->num_of_blocks_dd = 0;
100 ph->offset_dd = 0;
101
102 ph->maxtime_to_auto = 0; /* disabled */
103
104 /* The first two sections are mandatory */
105 ph->cpu_data.dump_flags = DUMP_REQUEST_FLAG;
106 ph->cpu_data.source_type = DUMP_SOURCE_CPU;
107 ph->cpu_data.source_address = 0;
108 ph->cpu_data.source_length = phyp_dump_info->cpu_state_size;
109 ph->cpu_data.destination_address = addr_offset;
110 addr_offset += phyp_dump_info->cpu_state_size;
111
112 ph->hpte_data.dump_flags = DUMP_REQUEST_FLAG;
113 ph->hpte_data.source_type = DUMP_SOURCE_HPTE;
114 ph->hpte_data.source_address = 0;
115 ph->hpte_data.source_length = phyp_dump_info->hpte_region_size;
116 ph->hpte_data.destination_address = addr_offset;
117 addr_offset += phyp_dump_info->hpte_region_size;
118
119 /* This section describes the low kernel region */
120 ph->kernel_data.dump_flags = DUMP_REQUEST_FLAG;
121 ph->kernel_data.source_type = DUMP_SOURCE_RMO;
122 ph->kernel_data.source_address = PHYP_DUMP_RMR_START;
123 ph->kernel_data.source_length = PHYP_DUMP_RMR_END;
124 ph->kernel_data.destination_address = addr_offset;
125 addr_offset += ph->kernel_data.source_length;
126
127 return addr_offset;
128}
129
130static void print_dump_header(const struct phyp_dump_header *ph)
131{
132#ifdef DEBUG
133 printk(KERN_INFO "dump header:\n");
134 /* setup some ph->sections required */
135 printk(KERN_INFO "version = %d\n", ph->version);
136 printk(KERN_INFO "Sections = %d\n", ph->num_of_sections);
137 printk(KERN_INFO "Status = 0x%x\n", ph->status);
138
139 /* No ph->disk, so all should be set to 0 */
140 printk(KERN_INFO "Offset to first section 0x%x\n",
141 ph->first_offset_section);
142 printk(KERN_INFO "dump disk sections should be zero\n");
143 printk(KERN_INFO "dump disk section = %d\n", ph->dump_disk_section);
144 printk(KERN_INFO "block num = %ld\n", ph->block_num_dd);
145 printk(KERN_INFO "number of blocks = %ld\n", ph->num_of_blocks_dd);
146 printk(KERN_INFO "dump disk offset = %d\n", ph->offset_dd);
147 printk(KERN_INFO "Max auto time= %d\n", ph->maxtime_to_auto);
148
149 /*set cpu state and hpte states as well scratch pad area */
150 printk(KERN_INFO " CPU AREA \n");
151 printk(KERN_INFO "cpu dump_flags =%d\n", ph->cpu_data.dump_flags);
152 printk(KERN_INFO "cpu source_type =%d\n", ph->cpu_data.source_type);
153 printk(KERN_INFO "cpu error_flags =%d\n", ph->cpu_data.error_flags);
154 printk(KERN_INFO "cpu source_address =%lx\n",
155 ph->cpu_data.source_address);
156 printk(KERN_INFO "cpu source_length =%lx\n",
157 ph->cpu_data.source_length);
158 printk(KERN_INFO "cpu length_copied =%lx\n",
159 ph->cpu_data.length_copied);
160
161 printk(KERN_INFO " HPTE AREA \n");
162 printk(KERN_INFO "HPTE dump_flags =%d\n", ph->hpte_data.dump_flags);
163 printk(KERN_INFO "HPTE source_type =%d\n", ph->hpte_data.source_type);
164 printk(KERN_INFO "HPTE error_flags =%d\n", ph->hpte_data.error_flags);
165 printk(KERN_INFO "HPTE source_address =%lx\n",
166 ph->hpte_data.source_address);
167 printk(KERN_INFO "HPTE source_length =%lx\n",
168 ph->hpte_data.source_length);
169 printk(KERN_INFO "HPTE length_copied =%lx\n",
170 ph->hpte_data.length_copied);
171
172 printk(KERN_INFO " SRSD AREA \n");
173 printk(KERN_INFO "SRSD dump_flags =%d\n", ph->kernel_data.dump_flags);
174 printk(KERN_INFO "SRSD source_type =%d\n", ph->kernel_data.source_type);
175 printk(KERN_INFO "SRSD error_flags =%d\n", ph->kernel_data.error_flags);
176 printk(KERN_INFO "SRSD source_address =%lx\n",
177 ph->kernel_data.source_address);
178 printk(KERN_INFO "SRSD source_length =%lx\n",
179 ph->kernel_data.source_length);
180 printk(KERN_INFO "SRSD length_copied =%lx\n",
181 ph->kernel_data.length_copied);
182#endif
183}
184
185static ssize_t show_phyp_dump_active(struct kobject *kobj,
186 struct kobj_attribute *attr, char *buf)
187{
188
189 /* create filesystem entry so kdump is phyp-dump aware */
190 return sprintf(buf, "%lx\n", phyp_dump_info->phyp_dump_at_boot);
191}
192
193static struct kobj_attribute pdl = __ATTR(phyp_dump_active, 0600,
194 show_phyp_dump_active,
195 NULL);
196
197static void register_dump_area(struct phyp_dump_header *ph, unsigned long addr)
198{
199 int rc;
200
201 /* Add addr value if not initialized before */
202 if (ph->cpu_data.destination_address == 0) {
203 ph->cpu_data.destination_address += addr;
204 ph->hpte_data.destination_address += addr;
205 ph->kernel_data.destination_address += addr;
206 }
207
208 /* ToDo Invalidate kdump and free memory range. */
209
210 do {
211 rc = rtas_call(ibm_configure_kernel_dump, 3, 1, NULL,
212 1, ph, sizeof(struct phyp_dump_header));
213 } while (rtas_busy_delay(rc));
214
215 if (rc) {
216 printk(KERN_ERR "phyp-dump: unexpected error (%d) on "
217 "register\n", rc);
218 print_dump_header(ph);
219 return;
220 }
221
222 rc = sysfs_create_file(kernel_kobj, &pdl.attr);
223 if (rc)
224 printk(KERN_ERR "phyp-dump: unable to create sysfs"
225 " file (%d)\n", rc);
226}
227
228static
229void invalidate_last_dump(struct phyp_dump_header *ph, unsigned long addr)
230{
231 int rc;
232
233 /* Add addr value if not initialized before */
234 if (ph->cpu_data.destination_address == 0) {
235 ph->cpu_data.destination_address += addr;
236 ph->hpte_data.destination_address += addr;
237 ph->kernel_data.destination_address += addr;
238 }
239
240 do {
241 rc = rtas_call(ibm_configure_kernel_dump, 3, 1, NULL,
242 2, ph, sizeof(struct phyp_dump_header));
243 } while (rtas_busy_delay(rc));
244
245 if (rc) {
246 printk(KERN_ERR "phyp-dump: unexpected error (%d) "
247 "on invalidate\n", rc);
248 print_dump_header(ph);
249 }
250}
251
252/* ------------------------------------------------- */
253/**
254 * release_memory_range -- release memory previously lmb_reserved
255 * @start_pfn: starting physical frame number
256 * @nr_pages: number of pages to free.
257 *
258 * This routine will release memory that had been previously
259 * lmb_reserved in early boot. The released memory becomes
260 * available for genreal use.
261 */
262static void release_memory_range(unsigned long start_pfn,
263 unsigned long nr_pages)
264{
265 struct page *rpage;
266 unsigned long end_pfn;
267 long i;
268
269 end_pfn = start_pfn + nr_pages;
270
271 for (i = start_pfn; i <= end_pfn; i++) {
272 rpage = pfn_to_page(i);
273 if (PageReserved(rpage)) {
274 ClearPageReserved(rpage);
275 init_page_count(rpage);
276 __free_page(rpage);
277 totalram_pages++;
278 }
279 }
280}
281
282/**
283 * track_freed_range -- Counts the range being freed.
284 * Once the counter goes to zero, it re-registers dump for
285 * future use.
286 */
287static void
288track_freed_range(unsigned long addr, unsigned long length)
289{
290 static unsigned long scratch_area_size, reserved_area_size;
291
292 if (addr < phyp_dump_info->init_reserve_start)
293 return;
294
295 if ((addr >= phyp_dump_info->init_reserve_start) &&
296 (addr <= phyp_dump_info->init_reserve_start +
297 phyp_dump_info->init_reserve_size))
298 reserved_area_size += length;
299
300 if ((addr >= phyp_dump_info->reserved_scratch_addr) &&
301 (addr <= phyp_dump_info->reserved_scratch_addr +
302 phyp_dump_info->reserved_scratch_size))
303 scratch_area_size += length;
304
305 if ((reserved_area_size == phyp_dump_info->init_reserve_size) &&
306 (scratch_area_size == phyp_dump_info->reserved_scratch_size)) {
307
308 invalidate_last_dump(&phdr,
309 phyp_dump_info->reserved_scratch_addr);
310 register_dump_area(&phdr,
311 phyp_dump_info->reserved_scratch_addr);
312 }
313}
314
315/* ------------------------------------------------- */
316/**
317 * sysfs_release_region -- sysfs interface to release memory range.
318 *
319 * Usage:
320 * "echo <start addr> <length> > /sys/kernel/release_region"
321 *
322 * Example:
323 * "echo 0x40000000 0x10000000 > /sys/kernel/release_region"
324 *
325 * will release 256MB starting at 1GB.
326 */
327static ssize_t store_release_region(struct kobject *kobj,
328 struct kobj_attribute *attr,
329 const char *buf, size_t count)
330{
331 unsigned long start_addr, length, end_addr;
332 unsigned long start_pfn, nr_pages;
333 ssize_t ret;
334
335 ret = sscanf(buf, "%lx %lx", &start_addr, &length);
336 if (ret != 2)
337 return -EINVAL;
338
339 track_freed_range(start_addr, length);
340
341 /* Range-check - don't free any reserved memory that
342 * wasn't reserved for phyp-dump */
343 if (start_addr < phyp_dump_info->init_reserve_start)
344 start_addr = phyp_dump_info->init_reserve_start;
345
346 end_addr = phyp_dump_info->init_reserve_start +
347 phyp_dump_info->init_reserve_size;
348 if (start_addr+length > end_addr)
349 length = end_addr - start_addr;
350
351 /* Release the region of memory assed in by user */
352 start_pfn = PFN_DOWN(start_addr);
353 nr_pages = PFN_DOWN(length);
354 release_memory_range(start_pfn, nr_pages);
355
356 return count;
357}
358
359static ssize_t show_release_region(struct kobject *kobj,
360 struct kobj_attribute *attr, char *buf)
361{
362 u64 second_addr_range;
363
364 /* total reserved size - start of scratch area */
365 second_addr_range = phyp_dump_info->init_reserve_size -
366 phyp_dump_info->reserved_scratch_size;
367 return sprintf(buf, "CPU:0x%lx-0x%lx: HPTE:0x%lx-0x%lx:"
368 " DUMP:0x%lx-0x%lx, 0x%lx-0x%lx:\n",
369 phdr.cpu_data.destination_address,
370 phdr.cpu_data.length_copied,
371 phdr.hpte_data.destination_address,
372 phdr.hpte_data.length_copied,
373 phdr.kernel_data.destination_address,
374 phdr.kernel_data.length_copied,
375 phyp_dump_info->init_reserve_start,
376 second_addr_range);
377}
378
379static struct kobj_attribute rr = __ATTR(release_region, 0600,
380 show_release_region,
381 store_release_region);
382
383static int __init phyp_dump_setup(void)
384{
385 struct device_node *rtas;
386 const struct phyp_dump_header *dump_header = NULL;
387 unsigned long dump_area_start;
388 unsigned long dump_area_length;
389 int header_len = 0;
390 int rc;
391
392 /* If no memory was reserved in early boot, there is nothing to do */
393 if (phyp_dump_info->init_reserve_size == 0)
394 return 0;
395
396 /* Return if phyp dump not supported */
397 if (!phyp_dump_info->phyp_dump_configured)
398 return -ENOSYS;
399
400 /* Is there dump data waiting for us? If there isn't,
401 * then register a new dump area, and release all of
402 * the rest of the reserved ram.
403 *
404 * The /rtas/ibm,kernel-dump rtas node is present only
405 * if there is dump data waiting for us.
406 */
407 rtas = of_find_node_by_path("/rtas");
408 if (rtas) {
409 dump_header = of_get_property(rtas, "ibm,kernel-dump",
410 &header_len);
411 of_node_put(rtas);
412 }
413
414 print_dump_header(dump_header);
415 dump_area_length = init_dump_header(&phdr);
416 /* align down */
417 dump_area_start = phyp_dump_info->init_reserve_start & PAGE_MASK;
418
419 if (dump_header == NULL) {
420 register_dump_area(&phdr, dump_area_start);
421 return 0;
422 }
423
424 /* re-register the dump area, if old dump was invalid */
425 if ((dump_header) && (dump_header->status & DUMP_ERROR_FLAG)) {
426 invalidate_last_dump(&phdr, dump_area_start);
427 register_dump_area(&phdr, dump_area_start);
428 return 0;
429 }
430
431 if (dump_header) {
432 phyp_dump_info->reserved_scratch_addr =
433 dump_header->cpu_data.destination_address;
434 phyp_dump_info->reserved_scratch_size =
435 dump_header->cpu_data.source_length +
436 dump_header->hpte_data.source_length +
437 dump_header->kernel_data.source_length;
438 }
439
440 /* Should we create a dump_subsys, analogous to s390/ipl.c ? */
441 rc = sysfs_create_file(kernel_kobj, &rr.attr);
442 if (rc)
443 printk(KERN_ERR "phyp-dump: unable to create sysfs file (%d)\n",
444 rc);
445
446 /* ToDo: re-register the dump area, for next time. */
447 return 0;
448}
449machine_subsys_initcall(pseries, phyp_dump_setup);
450
451int __init early_init_dt_scan_phyp_dump(unsigned long node,
452 const char *uname, int depth, void *data)
453{
454 const unsigned int *sizes;
455
456 phyp_dump_info->phyp_dump_configured = 0;
457 phyp_dump_info->phyp_dump_is_active = 0;
458
459 if (depth != 1 || strcmp(uname, "rtas") != 0)
460 return 0;
461
462 if (of_get_flat_dt_prop(node, "ibm,configure-kernel-dump", NULL))
463 phyp_dump_info->phyp_dump_configured++;
464
465 if (of_get_flat_dt_prop(node, "ibm,dump-kernel", NULL))
466 phyp_dump_info->phyp_dump_is_active++;
467
468 sizes = of_get_flat_dt_prop(node, "ibm,configure-kernel-dump-sizes",
469 NULL);
470 if (!sizes)
471 return 0;
472
473 if (sizes[0] == 1)
474 phyp_dump_info->cpu_state_size = *((unsigned long *)&sizes[1]);
475
476 if (sizes[3] == 2)
477 phyp_dump_info->hpte_region_size =
478 *((unsigned long *)&sizes[4]);
479 return 1;
480}
481
482/* Look for phyp_dump= cmdline option */
483static int __init early_phyp_dump_enabled(char *p)
484{
485 phyp_dump_info->phyp_dump_at_boot = 1;
486
487 if (!p)
488 return 0;
489
490 if (strncmp(p, "1", 1) == 0)
491 phyp_dump_info->phyp_dump_at_boot = 1;
492 else if (strncmp(p, "0", 1) == 0)
493 phyp_dump_info->phyp_dump_at_boot = 0;
494
495 return 0;
496}
497early_param("phyp_dump", early_phyp_dump_enabled);
498
499/* Look for phyp_dump_reserve_size= cmdline option */
500static int __init early_phyp_dump_reserve_size(char *p)
501{
502 if (p)
503 phyp_dump_info->reserve_bootvar = memparse(p, &p);
504
505 return 0;
506}
507early_param("phyp_dump_reserve_size", early_phyp_dump_reserve_size);
diff --git a/arch/powerpc/platforms/pseries/pseries.h b/arch/powerpc/platforms/pseries/pseries.h
index 61136d019554..9e17c0d2a0c8 100644
--- a/arch/powerpc/platforms/pseries/pseries.h
+++ b/arch/powerpc/platforms/pseries/pseries.h
@@ -38,4 +38,6 @@ extern void pSeries_final_fixup(void);
38/* Poweron flag used for enabling auto ups restart */ 38/* Poweron flag used for enabling auto ups restart */
39extern unsigned long rtas_poweron_auto; 39extern unsigned long rtas_poweron_auto;
40 40
41extern void find_udbg_vterm(void);
42
41#endif /* _PSERIES_PSERIES_H */ 43#endif /* _PSERIES_PSERIES_H */
diff --git a/arch/powerpc/platforms/pseries/reconfig.c b/arch/powerpc/platforms/pseries/reconfig.c
index 2800fced8c7c..ac75c10de278 100644
--- a/arch/powerpc/platforms/pseries/reconfig.c
+++ b/arch/powerpc/platforms/pseries/reconfig.c
@@ -222,14 +222,14 @@ static char * parse_next_property(char *buf, char *end, char **name, int *length
222 tmp = strchr(buf, ' '); 222 tmp = strchr(buf, ' ');
223 if (!tmp) { 223 if (!tmp) {
224 printk(KERN_ERR "property parse failed in %s at line %d\n", 224 printk(KERN_ERR "property parse failed in %s at line %d\n",
225 __FUNCTION__, __LINE__); 225 __func__, __LINE__);
226 return NULL; 226 return NULL;
227 } 227 }
228 *tmp = '\0'; 228 *tmp = '\0';
229 229
230 if (++tmp >= end) { 230 if (++tmp >= end) {
231 printk(KERN_ERR "property parse failed in %s at line %d\n", 231 printk(KERN_ERR "property parse failed in %s at line %d\n",
232 __FUNCTION__, __LINE__); 232 __func__, __LINE__);
233 return NULL; 233 return NULL;
234 } 234 }
235 235
@@ -238,12 +238,12 @@ static char * parse_next_property(char *buf, char *end, char **name, int *length
238 *length = simple_strtoul(tmp, &tmp, 10); 238 *length = simple_strtoul(tmp, &tmp, 10);
239 if (*length == -1) { 239 if (*length == -1) {
240 printk(KERN_ERR "property parse failed in %s at line %d\n", 240 printk(KERN_ERR "property parse failed in %s at line %d\n",
241 __FUNCTION__, __LINE__); 241 __func__, __LINE__);
242 return NULL; 242 return NULL;
243 } 243 }
244 if (*tmp != ' ' || ++tmp >= end) { 244 if (*tmp != ' ' || ++tmp >= end) {
245 printk(KERN_ERR "property parse failed in %s at line %d\n", 245 printk(KERN_ERR "property parse failed in %s at line %d\n",
246 __FUNCTION__, __LINE__); 246 __func__, __LINE__);
247 return NULL; 247 return NULL;
248 } 248 }
249 249
@@ -252,12 +252,12 @@ static char * parse_next_property(char *buf, char *end, char **name, int *length
252 tmp += *length; 252 tmp += *length;
253 if (tmp > end) { 253 if (tmp > end) {
254 printk(KERN_ERR "property parse failed in %s at line %d\n", 254 printk(KERN_ERR "property parse failed in %s at line %d\n",
255 __FUNCTION__, __LINE__); 255 __func__, __LINE__);
256 return NULL; 256 return NULL;
257 } 257 }
258 else if (tmp < end && *tmp != ' ' && *tmp != '\0') { 258 else if (tmp < end && *tmp != ' ' && *tmp != '\0') {
259 printk(KERN_ERR "property parse failed in %s at line %d\n", 259 printk(KERN_ERR "property parse failed in %s at line %d\n",
260 __FUNCTION__, __LINE__); 260 __func__, __LINE__);
261 return NULL; 261 return NULL;
262 } 262 }
263 tmp++; 263 tmp++;
diff --git a/arch/powerpc/platforms/pseries/scanlog.c b/arch/powerpc/platforms/pseries/scanlog.c
index 8e1ef168e2dd..e5b0ea870164 100644
--- a/arch/powerpc/platforms/pseries/scanlog.c
+++ b/arch/powerpc/platforms/pseries/scanlog.c
@@ -195,31 +195,30 @@ const struct file_operations scanlog_fops = {
195static int __init scanlog_init(void) 195static int __init scanlog_init(void)
196{ 196{
197 struct proc_dir_entry *ent; 197 struct proc_dir_entry *ent;
198 void *data;
199 int err = -ENOMEM;
198 200
199 ibm_scan_log_dump = rtas_token("ibm,scan-log-dump"); 201 ibm_scan_log_dump = rtas_token("ibm,scan-log-dump");
200 if (ibm_scan_log_dump == RTAS_UNKNOWN_SERVICE) { 202 if (ibm_scan_log_dump == RTAS_UNKNOWN_SERVICE)
201 printk(KERN_ERR "scan-log-dump not implemented on this system\n"); 203 return -ENODEV;
202 return -EIO;
203 }
204 204
205 ent = create_proc_entry("ppc64/rtas/scan-log-dump", S_IRUSR, NULL); 205 /* Ideally we could allocate a buffer < 4G */
206 if (ent) { 206 data = kzalloc(RTAS_DATA_BUF_SIZE, GFP_KERNEL);
207 ent->proc_fops = &scanlog_fops; 207 if (!data)
208 /* Ideally we could allocate a buffer < 4G */ 208 goto err;
209 ent->data = kmalloc(RTAS_DATA_BUF_SIZE, GFP_KERNEL); 209
210 if (!ent->data) { 210 ent = proc_create("ppc64/rtas/scan-log-dump", S_IRUSR, NULL,
211 printk(KERN_ERR "Failed to allocate a buffer\n"); 211 &scanlog_fops);
212 remove_proc_entry("scan-log-dump", ent->parent); 212 if (!ent)
213 return -ENOMEM; 213 goto err;
214 } 214
215 ((unsigned int *)ent->data)[0] = 0; 215 ent->data = data;
216 } else {
217 printk(KERN_ERR "Failed to create ppc64/scan-log-dump proc entry\n");
218 return -EIO;
219 }
220 proc_ppc64_scan_log_dump = ent; 216 proc_ppc64_scan_log_dump = ent;
221 217
222 return 0; 218 return 0;
219err:
220 kfree(data);
221 return err;
223} 222}
224 223
225static void __exit scanlog_cleanup(void) 224static void __exit scanlog_cleanup(void)
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index fdb9b1c8f977..f66aa9c3b135 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -76,9 +76,6 @@
76#define DBG(fmt...) 76#define DBG(fmt...)
77#endif 77#endif
78 78
79/* move those away to a .h */
80extern void find_udbg_vterm(void);
81
82int fwnmi_active; /* TRUE if an FWNMI handler is present */ 79int fwnmi_active; /* TRUE if an FWNMI handler is present */
83 80
84static void pseries_shared_idle_sleep(void); 81static void pseries_shared_idle_sleep(void);
@@ -127,14 +124,60 @@ void pseries_8259_cascade(unsigned int irq, struct irq_desc *desc)
127 desc->chip->eoi(irq); 124 desc->chip->eoi(irq);
128} 125}
129 126
130static void __init pseries_mpic_init_IRQ(void) 127static void __init pseries_setup_i8259_cascade(void)
131{ 128{
132 struct device_node *np, *old, *cascade = NULL; 129 struct device_node *np, *old, *found = NULL;
133 const unsigned int *addrp; 130 unsigned int cascade;
131 const u32 *addrp;
134 unsigned long intack = 0; 132 unsigned long intack = 0;
133 int naddr;
134
135 for_each_node_by_type(np, "interrupt-controller") {
136 if (of_device_is_compatible(np, "chrp,iic")) {
137 found = np;
138 break;
139 }
140 }
141
142 if (found == NULL) {
143 printk(KERN_DEBUG "pic: no ISA interrupt controller\n");
144 return;
145 }
146
147 cascade = irq_of_parse_and_map(found, 0);
148 if (cascade == NO_IRQ) {
149 printk(KERN_ERR "pic: failed to map cascade interrupt");
150 return;
151 }
152 pr_debug("pic: cascade mapped to irq %d\n", cascade);
153
154 for (old = of_node_get(found); old != NULL ; old = np) {
155 np = of_get_parent(old);
156 of_node_put(old);
157 if (np == NULL)
158 break;
159 if (strcmp(np->name, "pci") != 0)
160 continue;
161 addrp = of_get_property(np, "8259-interrupt-acknowledge", NULL);
162 if (addrp == NULL)
163 continue;
164 naddr = of_n_addr_cells(np);
165 intack = addrp[naddr-1];
166 if (naddr > 1)
167 intack |= ((unsigned long)addrp[naddr-2]) << 32;
168 }
169 if (intack)
170 printk(KERN_DEBUG "pic: PCI 8259 intack at 0x%016lx\n", intack);
171 i8259_init(found, intack);
172 of_node_put(found);
173 set_irq_chained_handler(cascade, pseries_8259_cascade);
174}
175
176static void __init pseries_mpic_init_IRQ(void)
177{
178 struct device_node *np;
135 const unsigned int *opprop; 179 const unsigned int *opprop;
136 unsigned long openpic_addr = 0; 180 unsigned long openpic_addr = 0;
137 unsigned int cascade_irq;
138 int naddr, n, i, opplen; 181 int naddr, n, i, opplen;
139 struct mpic *mpic; 182 struct mpic *mpic;
140 183
@@ -167,43 +210,13 @@ static void __init pseries_mpic_init_IRQ(void)
167 mpic_init(mpic); 210 mpic_init(mpic);
168 211
169 /* Look for cascade */ 212 /* Look for cascade */
170 for_each_node_by_type(np, "interrupt-controller") 213 pseries_setup_i8259_cascade();
171 if (of_device_is_compatible(np, "chrp,iic")) { 214}
172 cascade = np;
173 break;
174 }
175 if (cascade == NULL)
176 return;
177
178 cascade_irq = irq_of_parse_and_map(cascade, 0);
179 if (cascade_irq == NO_IRQ) {
180 printk(KERN_ERR "mpic: failed to map cascade interrupt");
181 return;
182 }
183 215
184 /* Check ACK type */ 216static void __init pseries_xics_init_IRQ(void)
185 for (old = of_node_get(cascade); old != NULL ; old = np) { 217{
186 np = of_get_parent(old); 218 xics_init_IRQ();
187 of_node_put(old); 219 pseries_setup_i8259_cascade();
188 if (np == NULL)
189 break;
190 if (strcmp(np->name, "pci") != 0)
191 continue;
192 addrp = of_get_property(np, "8259-interrupt-acknowledge",
193 NULL);
194 if (addrp == NULL)
195 continue;
196 naddr = of_n_addr_cells(np);
197 intack = addrp[naddr-1];
198 if (naddr > 1)
199 intack |= ((unsigned long)addrp[naddr-2]) << 32;
200 }
201 if (intack)
202 printk(KERN_DEBUG "mpic: PCI 8259 intack at 0x%016lx\n",
203 intack);
204 i8259_init(cascade, intack);
205 of_node_put(cascade);
206 set_irq_chained_handler(cascade_irq, pseries_8259_cascade);
207} 220}
208 221
209static void pseries_lpar_enable_pmcs(void) 222static void pseries_lpar_enable_pmcs(void)
@@ -235,7 +248,7 @@ static void __init pseries_discover_pic(void)
235 smp_init_pseries_mpic(); 248 smp_init_pseries_mpic();
236 return; 249 return;
237 } else if (strstr(typep, "ppc-xicp")) { 250 } else if (strstr(typep, "ppc-xicp")) {
238 ppc_md.init_IRQ = xics_init_IRQ; 251 ppc_md.init_IRQ = pseries_xics_init_IRQ;
239 setup_kexec_cpu_down_xics(); 252 setup_kexec_cpu_down_xics();
240 smp_init_pseries_xics(); 253 smp_init_pseries_xics();
241 return; 254 return;
@@ -393,6 +406,7 @@ static void pseries_dedicated_idle_sleep(void)
393{ 406{
394 unsigned int cpu = smp_processor_id(); 407 unsigned int cpu = smp_processor_id();
395 unsigned long start_snooze; 408 unsigned long start_snooze;
409 unsigned long in_purr, out_purr;
396 410
397 /* 411 /*
398 * Indicate to the HV that we are idle. Now would be 412 * Indicate to the HV that we are idle. Now would be
@@ -400,6 +414,7 @@ static void pseries_dedicated_idle_sleep(void)
400 */ 414 */
401 get_lppaca()->idle = 1; 415 get_lppaca()->idle = 1;
402 get_lppaca()->donate_dedicated_cpu = 1; 416 get_lppaca()->donate_dedicated_cpu = 1;
417 in_purr = mfspr(SPRN_PURR);
403 418
404 /* 419 /*
405 * We come in with interrupts disabled, and need_resched() 420 * We come in with interrupts disabled, and need_resched()
@@ -432,6 +447,8 @@ static void pseries_dedicated_idle_sleep(void)
432 447
433out: 448out:
434 HMT_medium(); 449 HMT_medium();
450 out_purr = mfspr(SPRN_PURR);
451 get_lppaca()->wait_state_cycles += out_purr - in_purr;
435 get_lppaca()->donate_dedicated_cpu = 0; 452 get_lppaca()->donate_dedicated_cpu = 0;
436 get_lppaca()->idle = 0; 453 get_lppaca()->idle = 0;
437} 454}
diff --git a/arch/powerpc/platforms/pseries/xics.c b/arch/powerpc/platforms/pseries/xics.c
index a977f200db89..43df53c30aa0 100644
--- a/arch/powerpc/platforms/pseries/xics.c
+++ b/arch/powerpc/platforms/pseries/xics.c
@@ -516,6 +516,8 @@ static struct irq_chip xics_pic_lpar = {
516 .set_affinity = xics_set_affinity 516 .set_affinity = xics_set_affinity
517}; 517};
518 518
519/* Points to the irq_chip we're actually using */
520static struct irq_chip *xics_irq_chip;
519 521
520static int xics_host_match(struct irq_host *h, struct device_node *node) 522static int xics_host_match(struct irq_host *h, struct device_node *node)
521{ 523{
@@ -526,23 +528,13 @@ static int xics_host_match(struct irq_host *h, struct device_node *node)
526 return !of_device_is_compatible(node, "chrp,iic"); 528 return !of_device_is_compatible(node, "chrp,iic");
527} 529}
528 530
529static int xics_host_map_direct(struct irq_host *h, unsigned int virq, 531static int xics_host_map(struct irq_host *h, unsigned int virq,
530 irq_hw_number_t hw) 532 irq_hw_number_t hw)
531{ 533{
532 pr_debug("xics: map_direct virq %d, hwirq 0x%lx\n", virq, hw); 534 pr_debug("xics: map virq %d, hwirq 0x%lx\n", virq, hw);
533 535
534 get_irq_desc(virq)->status |= IRQ_LEVEL; 536 get_irq_desc(virq)->status |= IRQ_LEVEL;
535 set_irq_chip_and_handler(virq, &xics_pic_direct, handle_fasteoi_irq); 537 set_irq_chip_and_handler(virq, xics_irq_chip, handle_fasteoi_irq);
536 return 0;
537}
538
539static int xics_host_map_lpar(struct irq_host *h, unsigned int virq,
540 irq_hw_number_t hw)
541{
542 pr_debug("xics: map_direct virq %d, hwirq 0x%lx\n", virq, hw);
543
544 get_irq_desc(virq)->status |= IRQ_LEVEL;
545 set_irq_chip_and_handler(virq, &xics_pic_lpar, handle_fasteoi_irq);
546 return 0; 538 return 0;
547} 539}
548 540
@@ -561,27 +553,20 @@ static int xics_host_xlate(struct irq_host *h, struct device_node *ct,
561 return 0; 553 return 0;
562} 554}
563 555
564static struct irq_host_ops xics_host_direct_ops = { 556static struct irq_host_ops xics_host_ops = {
565 .match = xics_host_match, 557 .match = xics_host_match,
566 .map = xics_host_map_direct, 558 .map = xics_host_map,
567 .xlate = xics_host_xlate,
568};
569
570static struct irq_host_ops xics_host_lpar_ops = {
571 .match = xics_host_match,
572 .map = xics_host_map_lpar,
573 .xlate = xics_host_xlate, 559 .xlate = xics_host_xlate,
574}; 560};
575 561
576static void __init xics_init_host(void) 562static void __init xics_init_host(void)
577{ 563{
578 struct irq_host_ops *ops;
579
580 if (firmware_has_feature(FW_FEATURE_LPAR)) 564 if (firmware_has_feature(FW_FEATURE_LPAR))
581 ops = &xics_host_lpar_ops; 565 xics_irq_chip = &xics_pic_lpar;
582 else 566 else
583 ops = &xics_host_direct_ops; 567 xics_irq_chip = &xics_pic_direct;
584 xics_host = irq_alloc_host(NULL, IRQ_HOST_MAP_TREE, 0, ops, 568
569 xics_host = irq_alloc_host(NULL, IRQ_HOST_MAP_TREE, 0, &xics_host_ops,
585 XICS_IRQ_SPURIOUS); 570 XICS_IRQ_SPURIOUS);
586 BUG_ON(xics_host == NULL); 571 BUG_ON(xics_host == NULL);
587 irq_set_default_host(xics_host); 572 irq_set_default_host(xics_host);
@@ -655,52 +640,6 @@ static void __init xics_init_one_node(struct device_node *np,
655 } 640 }
656} 641}
657 642
658
659static void __init xics_setup_8259_cascade(void)
660{
661 struct device_node *np, *old, *found = NULL;
662 int cascade, naddr;
663 const u32 *addrp;
664 unsigned long intack = 0;
665
666 for_each_node_by_type(np, "interrupt-controller")
667 if (of_device_is_compatible(np, "chrp,iic")) {
668 found = np;
669 break;
670 }
671 if (found == NULL) {
672 printk(KERN_DEBUG "xics: no ISA interrupt controller\n");
673 return;
674 }
675 cascade = irq_of_parse_and_map(found, 0);
676 if (cascade == NO_IRQ) {
677 printk(KERN_ERR "xics: failed to map cascade interrupt");
678 return;
679 }
680 pr_debug("xics: cascade mapped to irq %d\n", cascade);
681
682 for (old = of_node_get(found); old != NULL ; old = np) {
683 np = of_get_parent(old);
684 of_node_put(old);
685 if (np == NULL)
686 break;
687 if (strcmp(np->name, "pci") != 0)
688 continue;
689 addrp = of_get_property(np, "8259-interrupt-acknowledge", NULL);
690 if (addrp == NULL)
691 continue;
692 naddr = of_n_addr_cells(np);
693 intack = addrp[naddr-1];
694 if (naddr > 1)
695 intack |= ((unsigned long)addrp[naddr-2]) << 32;
696 }
697 if (intack)
698 printk(KERN_DEBUG "xics: PCI 8259 intack at 0x%016lx\n", intack);
699 i8259_init(found, intack);
700 of_node_put(found);
701 set_irq_chained_handler(cascade, pseries_8259_cascade);
702}
703
704void __init xics_init_IRQ(void) 643void __init xics_init_IRQ(void)
705{ 644{
706 struct device_node *np; 645 struct device_node *np;
@@ -733,8 +672,6 @@ void __init xics_init_IRQ(void)
733 672
734 xics_setup_cpu(); 673 xics_setup_cpu();
735 674
736 xics_setup_8259_cascade();
737
738 ppc64_boot_msg(0x21, "XICS Done"); 675 ppc64_boot_msg(0x21, "XICS Done");
739} 676}
740 677
diff --git a/arch/powerpc/platforms/pseries/xics.h b/arch/powerpc/platforms/pseries/xics.h
index c26bcff47b6d..1c5321ae8f2f 100644
--- a/arch/powerpc/platforms/pseries/xics.h
+++ b/arch/powerpc/platforms/pseries/xics.h
@@ -28,7 +28,4 @@ struct xics_ipi_struct {
28 28
29extern struct xics_ipi_struct xics_ipi_message[NR_CPUS] __cacheline_aligned; 29extern struct xics_ipi_struct xics_ipi_message[NR_CPUS] __cacheline_aligned;
30 30
31struct irq_desc;
32extern void pseries_8259_cascade(unsigned int irq, struct irq_desc *desc);
33
34#endif /* _POWERPC_KERNEL_XICS_H */ 31#endif /* _POWERPC_KERNEL_XICS_H */