aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/platforms')
-rw-r--r--arch/powerpc/platforms/40x/ep405.c2
-rw-r--r--arch/powerpc/platforms/40x/ppc40x_simple.c2
-rw-r--r--arch/powerpc/platforms/40x/walnut.c2
-rw-r--r--arch/powerpc/platforms/44x/canyonlands.c2
-rw-r--r--arch/powerpc/platforms/44x/ebony.c2
-rw-r--r--arch/powerpc/platforms/44x/ppc44x_simple.c2
-rw-r--r--arch/powerpc/platforms/44x/sam440ep.c2
-rw-r--r--arch/powerpc/platforms/52xx/Kconfig8
-rw-r--r--arch/powerpc/platforms/52xx/Makefile1
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_gpio.c380
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_pci.c10
-rw-r--r--arch/powerpc/platforms/82xx/pq2.c2
-rw-r--r--arch/powerpc/platforms/83xx/km83xx.c4
-rw-r--r--arch/powerpc/platforms/83xx/mpc832x_mds.c4
-rw-r--r--arch/powerpc/platforms/83xx/mpc834x_itx.c2
-rw-r--r--arch/powerpc/platforms/83xx/mpc834x_mds.c4
-rw-r--r--arch/powerpc/platforms/83xx/mpc836x_mds.c4
-rw-r--r--arch/powerpc/platforms/83xx/sbc834x.c2
-rw-r--r--arch/powerpc/platforms/83xx/usb.c2
-rw-r--r--arch/powerpc/platforms/85xx/Kconfig31
-rw-r--r--arch/powerpc/platforms/85xx/Makefile3
-rw-r--r--arch/powerpc/platforms/85xx/corenet_ds.c41
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_cds.c2
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_ds.c3
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_mds.c2
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_rdb.c5
-rw-r--r--arch/powerpc/platforms/85xx/p1010rdb.c122
-rw-r--r--arch/powerpc/platforms/85xx/p1022_ds.c18
-rw-r--r--arch/powerpc/platforms/85xx/p1023_rds.c162
-rw-r--r--arch/powerpc/platforms/85xx/p2040_rdb.c88
-rw-r--r--arch/powerpc/platforms/85xx/p3041_ds.c28
-rw-r--r--arch/powerpc/platforms/85xx/p4080_ds.c38
-rw-r--r--arch/powerpc/platforms/85xx/p5020_ds.c32
-rw-r--r--arch/powerpc/platforms/85xx/sbc8548.c2
-rw-r--r--arch/powerpc/platforms/85xx/sbc8560.c2
-rw-r--r--arch/powerpc/platforms/85xx/smp.c30
-rw-r--r--arch/powerpc/platforms/85xx/xes_mpc85xx.c2
-rw-r--r--arch/powerpc/platforms/86xx/mpc8610_hpcd.c107
-rw-r--r--arch/powerpc/platforms/Kconfig8
-rw-r--r--arch/powerpc/platforms/Kconfig.cputype2
-rw-r--r--arch/powerpc/platforms/amigaone/Kconfig2
-rw-r--r--arch/powerpc/platforms/cell/celleb_scc_epci.c8
-rw-r--r--arch/powerpc/platforms/cell/celleb_scc_pciex.c2
-rw-r--r--arch/powerpc/platforms/cell/cpufreq_spudemand.c2
-rw-r--r--arch/powerpc/platforms/cell/smp.c2
-rw-r--r--arch/powerpc/platforms/cell/spu_manage.c2
-rw-r--r--arch/powerpc/platforms/cell/spufs/context.c2
-rw-r--r--arch/powerpc/platforms/cell/spufs/file.c11
-rw-r--r--arch/powerpc/platforms/cell/spufs/inode.c29
-rw-r--r--arch/powerpc/platforms/cell/spufs/spufs.h2
-rw-r--r--arch/powerpc/platforms/cell/spufs/syscalls.c22
-rw-r--r--arch/powerpc/platforms/chrp/Kconfig1
-rw-r--r--arch/powerpc/platforms/chrp/pci.c4
-rw-r--r--arch/powerpc/platforms/chrp/smp.c2
-rw-r--r--arch/powerpc/platforms/iseries/exception.S2
-rw-r--r--arch/powerpc/platforms/iseries/exception.h4
-rw-r--r--arch/powerpc/platforms/iseries/smp.c4
-rw-r--r--arch/powerpc/platforms/maple/setup.c41
-rw-r--r--arch/powerpc/platforms/pasemi/dma_lib.c2
-rw-r--r--arch/powerpc/platforms/powermac/backlight.c2
-rw-r--r--arch/powerpc/platforms/powermac/nvram.c4
-rw-r--r--arch/powerpc/platforms/powermac/pci.c29
-rw-r--r--arch/powerpc/platforms/powermac/setup.c3
-rw-r--r--arch/powerpc/platforms/powermac/smp.c4
-rw-r--r--arch/powerpc/platforms/powermac/time.c2
-rw-r--r--arch/powerpc/platforms/prep/Kconfig1
-rw-r--r--arch/powerpc/platforms/ps3/interrupt.c23
-rw-r--r--arch/powerpc/platforms/ps3/platform.h1
-rw-r--r--arch/powerpc/platforms/ps3/smp.c2
-rw-r--r--arch/powerpc/platforms/pseries/Kconfig1
-rw-r--r--arch/powerpc/platforms/pseries/dlpar.c14
-rw-r--r--arch/powerpc/platforms/pseries/dtl.c2
-rw-r--r--arch/powerpc/platforms/pseries/eeh.c4
-rw-r--r--arch/powerpc/platforms/pseries/eeh_cache.c2
-rw-r--r--arch/powerpc/platforms/pseries/hotplug-cpu.c14
-rw-r--r--arch/powerpc/platforms/pseries/hotplug-memory.c16
-rw-r--r--arch/powerpc/platforms/pseries/hvCall_inst.c4
-rw-r--r--arch/powerpc/platforms/pseries/hvconsole.c2
-rw-r--r--arch/powerpc/platforms/pseries/io_event_irq.c8
-rw-r--r--arch/powerpc/platforms/pseries/kexec.c34
-rw-r--r--arch/powerpc/platforms/pseries/lpar.c212
-rw-r--r--arch/powerpc/platforms/pseries/plpar_wrappers.h12
-rw-r--r--arch/powerpc/platforms/pseries/pseries.h3
-rw-r--r--arch/powerpc/platforms/pseries/reconfig.c28
-rw-r--r--arch/powerpc/platforms/pseries/setup.c10
-rw-r--r--arch/powerpc/platforms/pseries/smp.c5
-rw-r--r--arch/powerpc/platforms/wsp/smp.c2
87 files changed, 852 insertions, 901 deletions
diff --git a/arch/powerpc/platforms/40x/ep405.c b/arch/powerpc/platforms/40x/ep405.c
index 4058fd1e7fc..b0389bbe4f9 100644
--- a/arch/powerpc/platforms/40x/ep405.c
+++ b/arch/powerpc/platforms/40x/ep405.c
@@ -100,7 +100,7 @@ static void __init ep405_setup_arch(void)
100 /* Find & init the BCSR CPLD */ 100 /* Find & init the BCSR CPLD */
101 ep405_init_bcsr(); 101 ep405_init_bcsr();
102 102
103 ppc_pci_set_flags(PPC_PCI_REASSIGN_ALL_RSRC); 103 pci_set_flags(PCI_REASSIGN_ALL_RSRC);
104} 104}
105 105
106static int __init ep405_probe(void) 106static int __init ep405_probe(void)
diff --git a/arch/powerpc/platforms/40x/ppc40x_simple.c b/arch/powerpc/platforms/40x/ppc40x_simple.c
index 2521d93ef13..e8dd5c5df7d 100644
--- a/arch/powerpc/platforms/40x/ppc40x_simple.c
+++ b/arch/powerpc/platforms/40x/ppc40x_simple.c
@@ -61,7 +61,7 @@ static const char *board[] __initdata = {
61static int __init ppc40x_probe(void) 61static int __init ppc40x_probe(void)
62{ 62{
63 if (of_flat_dt_match(of_get_flat_dt_root(), board)) { 63 if (of_flat_dt_match(of_get_flat_dt_root(), board)) {
64 ppc_pci_set_flags(PPC_PCI_REASSIGN_ALL_RSRC); 64 pci_set_flags(PCI_REASSIGN_ALL_RSRC);
65 return 1; 65 return 1;
66 } 66 }
67 67
diff --git a/arch/powerpc/platforms/40x/walnut.c b/arch/powerpc/platforms/40x/walnut.c
index 335df91fbee..8b691df72f7 100644
--- a/arch/powerpc/platforms/40x/walnut.c
+++ b/arch/powerpc/platforms/40x/walnut.c
@@ -51,7 +51,7 @@ static int __init walnut_probe(void)
51 if (!of_flat_dt_is_compatible(root, "ibm,walnut")) 51 if (!of_flat_dt_is_compatible(root, "ibm,walnut"))
52 return 0; 52 return 0;
53 53
54 ppc_pci_flags = PPC_PCI_REASSIGN_ALL_RSRC; 54 pci_set_flags(PCI_REASSIGN_ALL_RSRC);
55 55
56 return 1; 56 return 1;
57} 57}
diff --git a/arch/powerpc/platforms/44x/canyonlands.c b/arch/powerpc/platforms/44x/canyonlands.c
index afc5e8ea377..e300dd4c89b 100644
--- a/arch/powerpc/platforms/44x/canyonlands.c
+++ b/arch/powerpc/platforms/44x/canyonlands.c
@@ -55,7 +55,7 @@ static int __init ppc460ex_probe(void)
55{ 55{
56 unsigned long root = of_get_flat_dt_root(); 56 unsigned long root = of_get_flat_dt_root();
57 if (of_flat_dt_is_compatible(root, "amcc,canyonlands")) { 57 if (of_flat_dt_is_compatible(root, "amcc,canyonlands")) {
58 ppc_pci_set_flags(PPC_PCI_REASSIGN_ALL_RSRC); 58 pci_set_flags(PCI_REASSIGN_ALL_RSRC);
59 return 1; 59 return 1;
60 } 60 }
61 return 0; 61 return 0;
diff --git a/arch/powerpc/platforms/44x/ebony.c b/arch/powerpc/platforms/44x/ebony.c
index 88b9117fa69..6a4232bbdf8 100644
--- a/arch/powerpc/platforms/44x/ebony.c
+++ b/arch/powerpc/platforms/44x/ebony.c
@@ -54,7 +54,7 @@ static int __init ebony_probe(void)
54 if (!of_flat_dt_is_compatible(root, "ibm,ebony")) 54 if (!of_flat_dt_is_compatible(root, "ibm,ebony"))
55 return 0; 55 return 0;
56 56
57 ppc_pci_set_flags(PPC_PCI_REASSIGN_ALL_RSRC); 57 pci_set_flags(PCI_REASSIGN_ALL_RSRC);
58 58
59 return 1; 59 return 1;
60} 60}
diff --git a/arch/powerpc/platforms/44x/ppc44x_simple.c b/arch/powerpc/platforms/44x/ppc44x_simple.c
index c81c19c0b3d..8d220276341 100644
--- a/arch/powerpc/platforms/44x/ppc44x_simple.c
+++ b/arch/powerpc/platforms/44x/ppc44x_simple.c
@@ -72,7 +72,7 @@ static int __init ppc44x_probe(void)
72 72
73 for (i = 0; i < ARRAY_SIZE(board); i++) { 73 for (i = 0; i < ARRAY_SIZE(board); i++) {
74 if (of_flat_dt_is_compatible(root, board[i])) { 74 if (of_flat_dt_is_compatible(root, board[i])) {
75 ppc_pci_set_flags(PPC_PCI_REASSIGN_ALL_RSRC); 75 pci_set_flags(PCI_REASSIGN_ALL_RSRC);
76 return 1; 76 return 1;
77 } 77 }
78 } 78 }
diff --git a/arch/powerpc/platforms/44x/sam440ep.c b/arch/powerpc/platforms/44x/sam440ep.c
index a78e8eb6da4..9e09b835758 100644
--- a/arch/powerpc/platforms/44x/sam440ep.c
+++ b/arch/powerpc/platforms/44x/sam440ep.c
@@ -51,7 +51,7 @@ static int __init sam440ep_probe(void)
51 if (!of_flat_dt_is_compatible(root, "acube,sam440ep")) 51 if (!of_flat_dt_is_compatible(root, "acube,sam440ep"))
52 return 0; 52 return 0;
53 53
54 ppc_pci_set_flags(PPC_PCI_REASSIGN_ALL_RSRC); 54 pci_set_flags(PCI_REASSIGN_ALL_RSRC);
55 55
56 return 1; 56 return 1;
57} 57}
diff --git a/arch/powerpc/platforms/52xx/Kconfig b/arch/powerpc/platforms/52xx/Kconfig
index 47ea1be1481..90f4496017e 100644
--- a/arch/powerpc/platforms/52xx/Kconfig
+++ b/arch/powerpc/platforms/52xx/Kconfig
@@ -55,14 +55,6 @@ config PPC_MPC5200_BUGFIX
55 55
56 It is safe to say 'Y' here 56 It is safe to say 'Y' here
57 57
58config PPC_MPC5200_GPIO
59 bool "MPC5200 GPIO support"
60 depends on PPC_MPC52xx
61 select ARCH_REQUIRE_GPIOLIB
62 select GENERIC_GPIO
63 help
64 Enable gpiolib support for mpc5200 based boards
65
66config PPC_MPC5200_LPBFIFO 58config PPC_MPC5200_LPBFIFO
67 tristate "MPC5200 LocalPlus bus FIFO driver" 59 tristate "MPC5200 LocalPlus bus FIFO driver"
68 depends on PPC_MPC52xx 60 depends on PPC_MPC52xx
diff --git a/arch/powerpc/platforms/52xx/Makefile b/arch/powerpc/platforms/52xx/Makefile
index 2bc8cd0c5cf..4e62486791e 100644
--- a/arch/powerpc/platforms/52xx/Makefile
+++ b/arch/powerpc/platforms/52xx/Makefile
@@ -14,5 +14,4 @@ ifeq ($(CONFIG_PPC_LITE5200),y)
14 obj-$(CONFIG_PM) += lite5200_sleep.o lite5200_pm.o 14 obj-$(CONFIG_PM) += lite5200_sleep.o lite5200_pm.o
15endif 15endif
16 16
17obj-$(CONFIG_PPC_MPC5200_GPIO) += mpc52xx_gpio.o
18obj-$(CONFIG_PPC_MPC5200_LPBFIFO) += mpc52xx_lpbfifo.o 17obj-$(CONFIG_PPC_MPC5200_LPBFIFO) += mpc52xx_lpbfifo.o
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_gpio.c b/arch/powerpc/platforms/52xx/mpc52xx_gpio.c
deleted file mode 100644
index 1757d1db4b5..00000000000
--- a/arch/powerpc/platforms/52xx/mpc52xx_gpio.c
+++ /dev/null
@@ -1,380 +0,0 @@
1/*
2 * MPC52xx gpio driver
3 *
4 * Copyright (c) 2008 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2
8 * as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#include <linux/of.h>
21#include <linux/kernel.h>
22#include <linux/slab.h>
23#include <linux/of_gpio.h>
24#include <linux/io.h>
25#include <linux/of_platform.h>
26
27#include <asm/gpio.h>
28#include <asm/mpc52xx.h>
29#include <sysdev/fsl_soc.h>
30
31static DEFINE_SPINLOCK(gpio_lock);
32
33struct mpc52xx_gpiochip {
34 struct of_mm_gpio_chip mmchip;
35 unsigned int shadow_dvo;
36 unsigned int shadow_gpioe;
37 unsigned int shadow_ddr;
38};
39
40/*
41 * GPIO LIB API implementation for wakeup GPIOs.
42 *
43 * There's a maximum of 8 wakeup GPIOs. Which of these are available
44 * for use depends on your board setup.
45 *
46 * 0 -> GPIO_WKUP_7
47 * 1 -> GPIO_WKUP_6
48 * 2 -> PSC6_1
49 * 3 -> PSC6_0
50 * 4 -> ETH_17
51 * 5 -> PSC3_9
52 * 6 -> PSC2_4
53 * 7 -> PSC1_4
54 *
55 */
56static int mpc52xx_wkup_gpio_get(struct gpio_chip *gc, unsigned int gpio)
57{
58 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
59 struct mpc52xx_gpio_wkup __iomem *regs = mm_gc->regs;
60 unsigned int ret;
61
62 ret = (in_8(&regs->wkup_ival) >> (7 - gpio)) & 1;
63
64 pr_debug("%s: gpio: %d ret: %d\n", __func__, gpio, ret);
65
66 return ret;
67}
68
69static inline void
70__mpc52xx_wkup_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val)
71{
72 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
73 struct mpc52xx_gpiochip *chip = container_of(mm_gc,
74 struct mpc52xx_gpiochip, mmchip);
75 struct mpc52xx_gpio_wkup __iomem *regs = mm_gc->regs;
76
77 if (val)
78 chip->shadow_dvo |= 1 << (7 - gpio);
79 else
80 chip->shadow_dvo &= ~(1 << (7 - gpio));
81
82 out_8(&regs->wkup_dvo, chip->shadow_dvo);
83}
84
85static void
86mpc52xx_wkup_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val)
87{
88 unsigned long flags;
89
90 spin_lock_irqsave(&gpio_lock, flags);
91
92 __mpc52xx_wkup_gpio_set(gc, gpio, val);
93
94 spin_unlock_irqrestore(&gpio_lock, flags);
95
96 pr_debug("%s: gpio: %d val: %d\n", __func__, gpio, val);
97}
98
99static int mpc52xx_wkup_gpio_dir_in(struct gpio_chip *gc, unsigned int gpio)
100{
101 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
102 struct mpc52xx_gpiochip *chip = container_of(mm_gc,
103 struct mpc52xx_gpiochip, mmchip);
104 struct mpc52xx_gpio_wkup __iomem *regs = mm_gc->regs;
105 unsigned long flags;
106
107 spin_lock_irqsave(&gpio_lock, flags);
108
109 /* set the direction */
110 chip->shadow_ddr &= ~(1 << (7 - gpio));
111 out_8(&regs->wkup_ddr, chip->shadow_ddr);
112
113 /* and enable the pin */
114 chip->shadow_gpioe |= 1 << (7 - gpio);
115 out_8(&regs->wkup_gpioe, chip->shadow_gpioe);
116
117 spin_unlock_irqrestore(&gpio_lock, flags);
118
119 return 0;
120}
121
122static int
123mpc52xx_wkup_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val)
124{
125 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
126 struct mpc52xx_gpio_wkup __iomem *regs = mm_gc->regs;
127 struct mpc52xx_gpiochip *chip = container_of(mm_gc,
128 struct mpc52xx_gpiochip, mmchip);
129 unsigned long flags;
130
131 spin_lock_irqsave(&gpio_lock, flags);
132
133 __mpc52xx_wkup_gpio_set(gc, gpio, val);
134
135 /* Then set direction */
136 chip->shadow_ddr |= 1 << (7 - gpio);
137 out_8(&regs->wkup_ddr, chip->shadow_ddr);
138
139 /* Finally enable the pin */
140 chip->shadow_gpioe |= 1 << (7 - gpio);
141 out_8(&regs->wkup_gpioe, chip->shadow_gpioe);
142
143 spin_unlock_irqrestore(&gpio_lock, flags);
144
145 pr_debug("%s: gpio: %d val: %d\n", __func__, gpio, val);
146
147 return 0;
148}
149
150static int __devinit mpc52xx_wkup_gpiochip_probe(struct platform_device *ofdev)
151{
152 struct mpc52xx_gpiochip *chip;
153 struct mpc52xx_gpio_wkup __iomem *regs;
154 struct gpio_chip *gc;
155 int ret;
156
157 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
158 if (!chip)
159 return -ENOMEM;
160
161 gc = &chip->mmchip.gc;
162
163 gc->ngpio = 8;
164 gc->direction_input = mpc52xx_wkup_gpio_dir_in;
165 gc->direction_output = mpc52xx_wkup_gpio_dir_out;
166 gc->get = mpc52xx_wkup_gpio_get;
167 gc->set = mpc52xx_wkup_gpio_set;
168
169 ret = of_mm_gpiochip_add(ofdev->dev.of_node, &chip->mmchip);
170 if (ret)
171 return ret;
172
173 regs = chip->mmchip.regs;
174 chip->shadow_gpioe = in_8(&regs->wkup_gpioe);
175 chip->shadow_ddr = in_8(&regs->wkup_ddr);
176 chip->shadow_dvo = in_8(&regs->wkup_dvo);
177
178 return 0;
179}
180
181static int mpc52xx_gpiochip_remove(struct platform_device *ofdev)
182{
183 return -EBUSY;
184}
185
186static const struct of_device_id mpc52xx_wkup_gpiochip_match[] = {
187 {
188 .compatible = "fsl,mpc5200-gpio-wkup",
189 },
190 {}
191};
192
193static struct platform_driver mpc52xx_wkup_gpiochip_driver = {
194 .driver = {
195 .name = "gpio_wkup",
196 .owner = THIS_MODULE,
197 .of_match_table = mpc52xx_wkup_gpiochip_match,
198 },
199 .probe = mpc52xx_wkup_gpiochip_probe,
200 .remove = mpc52xx_gpiochip_remove,
201};
202
203/*
204 * GPIO LIB API implementation for simple GPIOs
205 *
206 * There's a maximum of 32 simple GPIOs. Which of these are available
207 * for use depends on your board setup.
208 * The numbering reflects the bit numbering in the port registers:
209 *
210 * 0..1 > reserved
211 * 2..3 > IRDA
212 * 4..7 > ETHR
213 * 8..11 > reserved
214 * 12..15 > USB
215 * 16..17 > reserved
216 * 18..23 > PSC3
217 * 24..27 > PSC2
218 * 28..31 > PSC1
219 */
220static int mpc52xx_simple_gpio_get(struct gpio_chip *gc, unsigned int gpio)
221{
222 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
223 struct mpc52xx_gpio __iomem *regs = mm_gc->regs;
224 unsigned int ret;
225
226 ret = (in_be32(&regs->simple_ival) >> (31 - gpio)) & 1;
227
228 return ret;
229}
230
231static inline void
232__mpc52xx_simple_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val)
233{
234 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
235 struct mpc52xx_gpiochip *chip = container_of(mm_gc,
236 struct mpc52xx_gpiochip, mmchip);
237 struct mpc52xx_gpio __iomem *regs = mm_gc->regs;
238
239 if (val)
240 chip->shadow_dvo |= 1 << (31 - gpio);
241 else
242 chip->shadow_dvo &= ~(1 << (31 - gpio));
243 out_be32(&regs->simple_dvo, chip->shadow_dvo);
244}
245
246static void
247mpc52xx_simple_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val)
248{
249 unsigned long flags;
250
251 spin_lock_irqsave(&gpio_lock, flags);
252
253 __mpc52xx_simple_gpio_set(gc, gpio, val);
254
255 spin_unlock_irqrestore(&gpio_lock, flags);
256
257 pr_debug("%s: gpio: %d val: %d\n", __func__, gpio, val);
258}
259
260static int mpc52xx_simple_gpio_dir_in(struct gpio_chip *gc, unsigned int gpio)
261{
262 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
263 struct mpc52xx_gpiochip *chip = container_of(mm_gc,
264 struct mpc52xx_gpiochip, mmchip);
265 struct mpc52xx_gpio __iomem *regs = mm_gc->regs;
266 unsigned long flags;
267
268 spin_lock_irqsave(&gpio_lock, flags);
269
270 /* set the direction */
271 chip->shadow_ddr &= ~(1 << (31 - gpio));
272 out_be32(&regs->simple_ddr, chip->shadow_ddr);
273
274 /* and enable the pin */
275 chip->shadow_gpioe |= 1 << (31 - gpio);
276 out_be32(&regs->simple_gpioe, chip->shadow_gpioe);
277
278 spin_unlock_irqrestore(&gpio_lock, flags);
279
280 return 0;
281}
282
283static int
284mpc52xx_simple_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val)
285{
286 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
287 struct mpc52xx_gpiochip *chip = container_of(mm_gc,
288 struct mpc52xx_gpiochip, mmchip);
289 struct mpc52xx_gpio __iomem *regs = mm_gc->regs;
290 unsigned long flags;
291
292 spin_lock_irqsave(&gpio_lock, flags);
293
294 /* First set initial value */
295 __mpc52xx_simple_gpio_set(gc, gpio, val);
296
297 /* Then set direction */
298 chip->shadow_ddr |= 1 << (31 - gpio);
299 out_be32(&regs->simple_ddr, chip->shadow_ddr);
300
301 /* Finally enable the pin */
302 chip->shadow_gpioe |= 1 << (31 - gpio);
303 out_be32(&regs->simple_gpioe, chip->shadow_gpioe);
304
305 spin_unlock_irqrestore(&gpio_lock, flags);
306
307 pr_debug("%s: gpio: %d val: %d\n", __func__, gpio, val);
308
309 return 0;
310}
311
312static int __devinit mpc52xx_simple_gpiochip_probe(struct platform_device *ofdev)
313{
314 struct mpc52xx_gpiochip *chip;
315 struct gpio_chip *gc;
316 struct mpc52xx_gpio __iomem *regs;
317 int ret;
318
319 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
320 if (!chip)
321 return -ENOMEM;
322
323 gc = &chip->mmchip.gc;
324
325 gc->ngpio = 32;
326 gc->direction_input = mpc52xx_simple_gpio_dir_in;
327 gc->direction_output = mpc52xx_simple_gpio_dir_out;
328 gc->get = mpc52xx_simple_gpio_get;
329 gc->set = mpc52xx_simple_gpio_set;
330
331 ret = of_mm_gpiochip_add(ofdev->dev.of_node, &chip->mmchip);
332 if (ret)
333 return ret;
334
335 regs = chip->mmchip.regs;
336 chip->shadow_gpioe = in_be32(&regs->simple_gpioe);
337 chip->shadow_ddr = in_be32(&regs->simple_ddr);
338 chip->shadow_dvo = in_be32(&regs->simple_dvo);
339
340 return 0;
341}
342
343static const struct of_device_id mpc52xx_simple_gpiochip_match[] = {
344 {
345 .compatible = "fsl,mpc5200-gpio",
346 },
347 {}
348};
349
350static struct platform_driver mpc52xx_simple_gpiochip_driver = {
351 .driver = {
352 .name = "gpio",
353 .owner = THIS_MODULE,
354 .of_match_table = mpc52xx_simple_gpiochip_match,
355 },
356 .probe = mpc52xx_simple_gpiochip_probe,
357 .remove = mpc52xx_gpiochip_remove,
358};
359
360static int __init mpc52xx_gpio_init(void)
361{
362 if (platform_driver_register(&mpc52xx_wkup_gpiochip_driver))
363 printk(KERN_ERR "Unable to register wakeup GPIO driver\n");
364
365 if (platform_driver_register(&mpc52xx_simple_gpiochip_driver))
366 printk(KERN_ERR "Unable to register simple GPIO driver\n");
367
368 return 0;
369}
370
371
372/* Make sure we get initialised before anyone else tries to use us */
373subsys_initcall(mpc52xx_gpio_init);
374
375/* No exit call at the moment as we cannot unregister of gpio chips */
376
377MODULE_DESCRIPTION("Freescale MPC52xx gpio driver");
378MODULE_AUTHOR("Sascha Hauer <s.hauer@pengutronix.de");
379MODULE_LICENSE("GPL v2");
380
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_pci.c b/arch/powerpc/platforms/52xx/mpc52xx_pci.c
index da110bd8834..bfb11e01133 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_pci.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_pci.c
@@ -264,7 +264,7 @@ mpc52xx_pci_setup(struct pci_controller *hose,
264 (unsigned long long)res->flags); 264 (unsigned long long)res->flags);
265 out_be32(&pci_regs->iw0btar, 265 out_be32(&pci_regs->iw0btar,
266 MPC52xx_PCI_IWBTAR_TRANSLATION(res->start, res->start, 266 MPC52xx_PCI_IWBTAR_TRANSLATION(res->start, res->start,
267 res->end - res->start + 1)); 267 resource_size(res)));
268 iwcr0 = MPC52xx_PCI_IWCR_ENABLE | MPC52xx_PCI_IWCR_MEM; 268 iwcr0 = MPC52xx_PCI_IWCR_ENABLE | MPC52xx_PCI_IWCR_MEM;
269 if (res->flags & IORESOURCE_PREFETCH) 269 if (res->flags & IORESOURCE_PREFETCH)
270 iwcr0 |= MPC52xx_PCI_IWCR_READ_MULTI; 270 iwcr0 |= MPC52xx_PCI_IWCR_READ_MULTI;
@@ -278,7 +278,7 @@ mpc52xx_pci_setup(struct pci_controller *hose,
278 res->start, res->end, res->flags); 278 res->start, res->end, res->flags);
279 out_be32(&pci_regs->iw1btar, 279 out_be32(&pci_regs->iw1btar,
280 MPC52xx_PCI_IWBTAR_TRANSLATION(res->start, res->start, 280 MPC52xx_PCI_IWBTAR_TRANSLATION(res->start, res->start,
281 res->end - res->start + 1)); 281 resource_size(res)));
282 iwcr1 = MPC52xx_PCI_IWCR_ENABLE | MPC52xx_PCI_IWCR_MEM; 282 iwcr1 = MPC52xx_PCI_IWCR_ENABLE | MPC52xx_PCI_IWCR_MEM;
283 if (res->flags & IORESOURCE_PREFETCH) 283 if (res->flags & IORESOURCE_PREFETCH)
284 iwcr1 |= MPC52xx_PCI_IWCR_READ_MULTI; 284 iwcr1 |= MPC52xx_PCI_IWCR_READ_MULTI;
@@ -300,7 +300,7 @@ mpc52xx_pci_setup(struct pci_controller *hose,
300 out_be32(&pci_regs->iw2btar, 300 out_be32(&pci_regs->iw2btar,
301 MPC52xx_PCI_IWBTAR_TRANSLATION(hose->io_base_phys, 301 MPC52xx_PCI_IWBTAR_TRANSLATION(hose->io_base_phys,
302 res->start, 302 res->start,
303 res->end - res->start + 1)); 303 resource_size(res)));
304 iwcr2 = MPC52xx_PCI_IWCR_ENABLE | MPC52xx_PCI_IWCR_IO; 304 iwcr2 = MPC52xx_PCI_IWCR_ENABLE | MPC52xx_PCI_IWCR_IO;
305 305
306 /* Set all the IWCR fields at once; they're in the same reg */ 306 /* Set all the IWCR fields at once; they're in the same reg */
@@ -371,7 +371,7 @@ mpc52xx_add_bridge(struct device_node *node)
371 371
372 pr_debug("Adding MPC52xx PCI host bridge %s\n", node->full_name); 372 pr_debug("Adding MPC52xx PCI host bridge %s\n", node->full_name);
373 373
374 ppc_pci_add_flags(PPC_PCI_REASSIGN_ALL_BUS); 374 pci_add_flags(PCI_REASSIGN_ALL_BUS);
375 375
376 if (of_address_to_resource(node, 0, &rsrc) != 0) { 376 if (of_address_to_resource(node, 0, &rsrc) != 0) {
377 printk(KERN_ERR "Can't get %s resources\n", node->full_name); 377 printk(KERN_ERR "Can't get %s resources\n", node->full_name);
@@ -402,7 +402,7 @@ mpc52xx_add_bridge(struct device_node *node)
402 402
403 hose->ops = &mpc52xx_pci_ops; 403 hose->ops = &mpc52xx_pci_ops;
404 404
405 pci_regs = ioremap(rsrc.start, rsrc.end - rsrc.start + 1); 405 pci_regs = ioremap(rsrc.start, resource_size(&rsrc));
406 if (!pci_regs) 406 if (!pci_regs)
407 return -ENOMEM; 407 return -ENOMEM;
408 408
diff --git a/arch/powerpc/platforms/82xx/pq2.c b/arch/powerpc/platforms/82xx/pq2.c
index 9761a59f175..d111b024eaf 100644
--- a/arch/powerpc/platforms/82xx/pq2.c
+++ b/arch/powerpc/platforms/82xx/pq2.c
@@ -53,7 +53,7 @@ static void __init pq2_pci_add_bridge(struct device_node *np)
53 if (of_address_to_resource(np, 0, &r) || r.end - r.start < 0x10b) 53 if (of_address_to_resource(np, 0, &r) || r.end - r.start < 0x10b)
54 goto err; 54 goto err;
55 55
56 ppc_pci_add_flags(PPC_PCI_REASSIGN_ALL_BUS); 56 pci_add_flags(PCI_REASSIGN_ALL_BUS);
57 57
58 hose = pcibios_alloc_controller(np); 58 hose = pcibios_alloc_controller(np);
59 if (!hose) 59 if (!hose)
diff --git a/arch/powerpc/platforms/83xx/km83xx.c b/arch/powerpc/platforms/83xx/km83xx.c
index a2b9b9ef124..c55129f5760 100644
--- a/arch/powerpc/platforms/83xx/km83xx.c
+++ b/arch/powerpc/platforms/83xx/km83xx.c
@@ -28,7 +28,7 @@
28#include <linux/of_device.h> 28#include <linux/of_device.h>
29 29
30#include <asm/system.h> 30#include <asm/system.h>
31#include <asm/atomic.h> 31#include <linux/atomic.h>
32#include <asm/time.h> 32#include <asm/time.h>
33#include <asm/io.h> 33#include <asm/io.h>
34#include <asm/machdep.h> 34#include <asm/machdep.h>
@@ -101,7 +101,7 @@ static void __init mpc83xx_km_setup_arch(void)
101 __func__); 101 __func__);
102 return; 102 return;
103 } 103 }
104 base = ioremap(res.start, res.end - res.start + 1); 104 base = ioremap(res.start, resource_size(&res));
105 105
106 /* 106 /*
107 * IMMR + 0x14A8[4:5] = 11 (clk delay for UCC 2) 107 * IMMR + 0x14A8[4:5] = 11 (clk delay for UCC 2)
diff --git a/arch/powerpc/platforms/83xx/mpc832x_mds.c b/arch/powerpc/platforms/83xx/mpc832x_mds.c
index ec0b401bc9c..32a52896822 100644
--- a/arch/powerpc/platforms/83xx/mpc832x_mds.c
+++ b/arch/powerpc/platforms/83xx/mpc832x_mds.c
@@ -27,7 +27,7 @@
27#include <linux/of_device.h> 27#include <linux/of_device.h>
28 28
29#include <asm/system.h> 29#include <asm/system.h>
30#include <asm/atomic.h> 30#include <linux/atomic.h>
31#include <asm/time.h> 31#include <asm/time.h>
32#include <asm/io.h> 32#include <asm/io.h>
33#include <asm/machdep.h> 33#include <asm/machdep.h>
@@ -68,7 +68,7 @@ static void __init mpc832x_sys_setup_arch(void)
68 struct resource res; 68 struct resource res;
69 69
70 of_address_to_resource(np, 0, &res); 70 of_address_to_resource(np, 0, &res);
71 bcsr_regs = ioremap(res.start, res.end - res.start +1); 71 bcsr_regs = ioremap(res.start, resource_size(&res));
72 of_node_put(np); 72 of_node_put(np);
73 } 73 }
74 74
diff --git a/arch/powerpc/platforms/83xx/mpc834x_itx.c b/arch/powerpc/platforms/83xx/mpc834x_itx.c
index 81e44fa1c64..6b45969567d 100644
--- a/arch/powerpc/platforms/83xx/mpc834x_itx.c
+++ b/arch/powerpc/platforms/83xx/mpc834x_itx.c
@@ -26,7 +26,7 @@
26#include <linux/of_platform.h> 26#include <linux/of_platform.h>
27 27
28#include <asm/system.h> 28#include <asm/system.h>
29#include <asm/atomic.h> 29#include <linux/atomic.h>
30#include <asm/time.h> 30#include <asm/time.h>
31#include <asm/io.h> 31#include <asm/io.h>
32#include <asm/machdep.h> 32#include <asm/machdep.h>
diff --git a/arch/powerpc/platforms/83xx/mpc834x_mds.c b/arch/powerpc/platforms/83xx/mpc834x_mds.c
index d0a634b056c..041c5177e73 100644
--- a/arch/powerpc/platforms/83xx/mpc834x_mds.c
+++ b/arch/powerpc/platforms/83xx/mpc834x_mds.c
@@ -26,7 +26,7 @@
26#include <linux/of_platform.h> 26#include <linux/of_platform.h>
27 27
28#include <asm/system.h> 28#include <asm/system.h>
29#include <asm/atomic.h> 29#include <linux/atomic.h>
30#include <asm/time.h> 30#include <asm/time.h>
31#include <asm/io.h> 31#include <asm/io.h>
32#include <asm/machdep.h> 32#include <asm/machdep.h>
@@ -53,7 +53,7 @@ static int mpc834xemds_usb_cfg(void)
53 struct resource res; 53 struct resource res;
54 54
55 of_address_to_resource(np, 0, &res); 55 of_address_to_resource(np, 0, &res);
56 bcsr_regs = ioremap(res.start, res.end - res.start + 1); 56 bcsr_regs = ioremap(res.start, resource_size(&res));
57 of_node_put(np); 57 of_node_put(np);
58 } 58 }
59 if (!bcsr_regs) 59 if (!bcsr_regs)
diff --git a/arch/powerpc/platforms/83xx/mpc836x_mds.c b/arch/powerpc/platforms/83xx/mpc836x_mds.c
index 09e9d6fb741..934cc8c46bb 100644
--- a/arch/powerpc/platforms/83xx/mpc836x_mds.c
+++ b/arch/powerpc/platforms/83xx/mpc836x_mds.c
@@ -34,7 +34,7 @@
34#include <linux/of_device.h> 34#include <linux/of_device.h>
35 35
36#include <asm/system.h> 36#include <asm/system.h>
37#include <asm/atomic.h> 37#include <linux/atomic.h>
38#include <asm/time.h> 38#include <asm/time.h>
39#include <asm/io.h> 39#include <asm/io.h>
40#include <asm/machdep.h> 40#include <asm/machdep.h>
@@ -76,7 +76,7 @@ static void __init mpc836x_mds_setup_arch(void)
76 struct resource res; 76 struct resource res;
77 77
78 of_address_to_resource(np, 0, &res); 78 of_address_to_resource(np, 0, &res);
79 bcsr_regs = ioremap(res.start, res.end - res.start +1); 79 bcsr_regs = ioremap(res.start, resource_size(&res));
80 of_node_put(np); 80 of_node_put(np);
81 } 81 }
82 82
diff --git a/arch/powerpc/platforms/83xx/sbc834x.c b/arch/powerpc/platforms/83xx/sbc834x.c
index 49023dbe157..af41d8c810a 100644
--- a/arch/powerpc/platforms/83xx/sbc834x.c
+++ b/arch/powerpc/platforms/83xx/sbc834x.c
@@ -28,7 +28,7 @@
28#include <linux/of_platform.h> 28#include <linux/of_platform.h>
29 29
30#include <asm/system.h> 30#include <asm/system.h>
31#include <asm/atomic.h> 31#include <linux/atomic.h>
32#include <asm/time.h> 32#include <asm/time.h>
33#include <asm/io.h> 33#include <asm/io.h>
34#include <asm/machdep.h> 34#include <asm/machdep.h>
diff --git a/arch/powerpc/platforms/83xx/usb.c b/arch/powerpc/platforms/83xx/usb.c
index 2c64164722d..1ad748bb39b 100644
--- a/arch/powerpc/platforms/83xx/usb.c
+++ b/arch/powerpc/platforms/83xx/usb.c
@@ -171,7 +171,7 @@ int mpc831x_usb_cfg(void)
171 of_node_put(np); 171 of_node_put(np);
172 return ret; 172 return ret;
173 } 173 }
174 usb_regs = ioremap(res.start, res.end - res.start + 1); 174 usb_regs = ioremap(res.start, resource_size(&res));
175 175
176 /* Using on-chip PHY */ 176 /* Using on-chip PHY */
177 if (prop && (!strcmp(prop, "utmi_wide") || 177 if (prop && (!strcmp(prop, "utmi_wide") ||
diff --git a/arch/powerpc/platforms/85xx/Kconfig b/arch/powerpc/platforms/85xx/Kconfig
index b6976e1726e..498534cd526 100644
--- a/arch/powerpc/platforms/85xx/Kconfig
+++ b/arch/powerpc/platforms/85xx/Kconfig
@@ -67,6 +67,16 @@ config MPC85xx_RDB
67 help 67 help
68 This option enables support for the MPC85xx RDB (P2020 RDB) board 68 This option enables support for the MPC85xx RDB (P2020 RDB) board
69 69
70config P1010_RDB
71 bool "Freescale P1010RDB"
72 select DEFAULT_UIMAGE
73 help
74 This option enables support for the MPC85xx RDB (P1010 RDB) board
75
76 P1010RDB contains P1010Si, which provides CPU performance up to 800
77 MHz and 1600 DMIPS, additional functionality and faster interfaces
78 (DDR3/3L, SATA II, and PCI Express).
79
70config P1022_DS 80config P1022_DS
71 bool "Freescale P1022 DS" 81 bool "Freescale P1022 DS"
72 select DEFAULT_UIMAGE 82 select DEFAULT_UIMAGE
@@ -75,6 +85,12 @@ config P1022_DS
75 help 85 help
76 This option enables support for the Freescale P1022DS reference board. 86 This option enables support for the Freescale P1022DS reference board.
77 87
88config P1023_RDS
89 bool "Freescale P1023 RDS"
90 select DEFAULT_UIMAGE
91 help
92 This option enables support for the P1023 RDS board
93
78config SOCRATES 94config SOCRATES
79 bool "Socrates" 95 bool "Socrates"
80 select DEFAULT_UIMAGE 96 select DEFAULT_UIMAGE
@@ -155,6 +171,18 @@ config SBC8560
155 help 171 help
156 This option enables support for the Wind River SBC8560 board 172 This option enables support for the Wind River SBC8560 board
157 173
174config P2040_RDB
175 bool "Freescale P2040 RDB"
176 select DEFAULT_UIMAGE
177 select PPC_E500MC
178 select PHYS_64BIT
179 select SWIOTLB
180 select MPC8xxx_GPIO
181 select HAS_RAPIDIO
182 select PPC_EPAPR_HV_PIC
183 help
184 This option enables support for the P2040 RDB board
185
158config P3041_DS 186config P3041_DS
159 bool "Freescale P3041 DS" 187 bool "Freescale P3041 DS"
160 select DEFAULT_UIMAGE 188 select DEFAULT_UIMAGE
@@ -163,6 +191,7 @@ config P3041_DS
163 select SWIOTLB 191 select SWIOTLB
164 select MPC8xxx_GPIO 192 select MPC8xxx_GPIO
165 select HAS_RAPIDIO 193 select HAS_RAPIDIO
194 select PPC_EPAPR_HV_PIC
166 help 195 help
167 This option enables support for the P3041 DS board 196 This option enables support for the P3041 DS board
168 197
@@ -174,6 +203,7 @@ config P4080_DS
174 select SWIOTLB 203 select SWIOTLB
175 select MPC8xxx_GPIO 204 select MPC8xxx_GPIO
176 select HAS_RAPIDIO 205 select HAS_RAPIDIO
206 select PPC_EPAPR_HV_PIC
177 help 207 help
178 This option enables support for the P4080 DS board 208 This option enables support for the P4080 DS board
179 209
@@ -188,6 +218,7 @@ config P5020_DS
188 select SWIOTLB 218 select SWIOTLB
189 select MPC8xxx_GPIO 219 select MPC8xxx_GPIO
190 select HAS_RAPIDIO 220 select HAS_RAPIDIO
221 select PPC_EPAPR_HV_PIC
191 help 222 help
192 This option enables support for the P5020 DS board 223 This option enables support for the P5020 DS board
193 224
diff --git a/arch/powerpc/platforms/85xx/Makefile b/arch/powerpc/platforms/85xx/Makefile
index dd70db77d63..a971b32c5c0 100644
--- a/arch/powerpc/platforms/85xx/Makefile
+++ b/arch/powerpc/platforms/85xx/Makefile
@@ -10,7 +10,10 @@ obj-$(CONFIG_MPC8536_DS) += mpc8536_ds.o
10obj-$(CONFIG_MPC85xx_DS) += mpc85xx_ds.o 10obj-$(CONFIG_MPC85xx_DS) += mpc85xx_ds.o
11obj-$(CONFIG_MPC85xx_MDS) += mpc85xx_mds.o 11obj-$(CONFIG_MPC85xx_MDS) += mpc85xx_mds.o
12obj-$(CONFIG_MPC85xx_RDB) += mpc85xx_rdb.o 12obj-$(CONFIG_MPC85xx_RDB) += mpc85xx_rdb.o
13obj-$(CONFIG_P1010_RDB) += p1010rdb.o
13obj-$(CONFIG_P1022_DS) += p1022_ds.o 14obj-$(CONFIG_P1022_DS) += p1022_ds.o
15obj-$(CONFIG_P1023_RDS) += p1023_rds.o
16obj-$(CONFIG_P2040_RDB) += p2040_rdb.o corenet_ds.o
14obj-$(CONFIG_P3041_DS) += p3041_ds.o corenet_ds.o 17obj-$(CONFIG_P3041_DS) += p3041_ds.o corenet_ds.o
15obj-$(CONFIG_P4080_DS) += p4080_ds.o corenet_ds.o 18obj-$(CONFIG_P4080_DS) += p4080_ds.o corenet_ds.o
16obj-$(CONFIG_P5020_DS) += p5020_ds.o corenet_ds.o 19obj-$(CONFIG_P5020_DS) += p5020_ds.o corenet_ds.o
diff --git a/arch/powerpc/platforms/85xx/corenet_ds.c b/arch/powerpc/platforms/85xx/corenet_ds.c
index 2ab338c9ac3..802ad110b75 100644
--- a/arch/powerpc/platforms/85xx/corenet_ds.c
+++ b/arch/powerpc/platforms/85xx/corenet_ds.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Maintained by Kumar Gala (see MAINTAINERS for contact information) 4 * Maintained by Kumar Gala (see MAINTAINERS for contact information)
5 * 5 *
6 * Copyright 2009 Freescale Semiconductor Inc. 6 * Copyright 2009-2011 Freescale Semiconductor Inc.
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify it 8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the 9 * under the terms of the GNU General Public License as published by the
@@ -22,6 +22,7 @@
22#include <asm/time.h> 22#include <asm/time.h>
23#include <asm/machdep.h> 23#include <asm/machdep.h>
24#include <asm/pci-bridge.h> 24#include <asm/pci-bridge.h>
25#include <asm/ppc-pci.h>
25#include <mm/mmu_decl.h> 26#include <mm/mmu_decl.h>
26#include <asm/prom.h> 27#include <asm/prom.h>
27#include <asm/udbg.h> 28#include <asm/udbg.h>
@@ -61,10 +62,6 @@ void __init corenet_ds_pic_init(void)
61 mpic_init(mpic); 62 mpic_init(mpic);
62} 63}
63 64
64#ifdef CONFIG_PCI
65static int primary_phb_addr;
66#endif
67
68/* 65/*
69 * Setup the architecture 66 * Setup the architecture
70 */ 67 */
@@ -85,18 +82,19 @@ void __init corenet_ds_setup_arch(void)
85#endif 82#endif
86 83
87#ifdef CONFIG_PCI 84#ifdef CONFIG_PCI
88 for_each_compatible_node(np, "pci", "fsl,p4080-pcie") { 85 for_each_node_by_type(np, "pci") {
89 struct resource rsrc; 86 if (of_device_is_compatible(np, "fsl,p4080-pcie") ||
90 of_address_to_resource(np, 0, &rsrc); 87 of_device_is_compatible(np, "fsl,qoriq-pcie-v2.2")) {
91 if ((rsrc.start & 0xfffff) == primary_phb_addr)
92 fsl_add_bridge(np, 1);
93 else
94 fsl_add_bridge(np, 0); 88 fsl_add_bridge(np, 0);
95 89 hose = pci_find_hose_for_OF_device(np);
96 hose = pci_find_hose_for_OF_device(np); 90 max = min(max, hose->dma_window_base_cur +
97 max = min(max, hose->dma_window_base_cur + 91 hose->dma_window_size);
98 hose->dma_window_size); 92 }
99 } 93 }
94
95#ifdef CONFIG_PPC64
96 pci_devs_phb_init();
97#endif
100#endif 98#endif
101 99
102#ifdef CONFIG_SWIOTLB 100#ifdef CONFIG_SWIOTLB
@@ -116,6 +114,19 @@ static const struct of_device_id of_device_ids[] __devinitconst = {
116 { 114 {
117 .compatible = "fsl,rapidio-delta", 115 .compatible = "fsl,rapidio-delta",
118 }, 116 },
117 {
118 .compatible = "fsl,p4080-pcie",
119 },
120 {
121 .compatible = "fsl,qoriq-pcie-v2.2",
122 },
123 /* The following two are for the Freescale hypervisor */
124 {
125 .name = "hypervisor",
126 },
127 {
128 .name = "handles",
129 },
119 {} 130 {}
120}; 131};
121 132
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_cds.c b/arch/powerpc/platforms/85xx/mpc85xx_cds.c
index 6299a2a51ae..2bf99786d24 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_cds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_cds.c
@@ -31,7 +31,7 @@
31#include <asm/system.h> 31#include <asm/system.h>
32#include <asm/pgtable.h> 32#include <asm/pgtable.h>
33#include <asm/page.h> 33#include <asm/page.h>
34#include <asm/atomic.h> 34#include <linux/atomic.h>
35#include <asm/time.h> 35#include <asm/time.h>
36#include <asm/io.h> 36#include <asm/io.h>
37#include <asm/machdep.h> 37#include <asm/machdep.h>
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ds.c b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
index c7b97f70312..1b9a8cf1873 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_ds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
@@ -83,7 +83,8 @@ void __init mpc85xx_ds_pic_init(void)
83 if (of_flat_dt_is_compatible(root, "fsl,MPC8572DS-CAMP")) { 83 if (of_flat_dt_is_compatible(root, "fsl,MPC8572DS-CAMP")) {
84 mpic = mpic_alloc(np, r.start, 84 mpic = mpic_alloc(np, r.start,
85 MPIC_PRIMARY | 85 MPIC_PRIMARY |
86 MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS, 86 MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS |
87 MPIC_SINGLE_DEST_CPU,
87 0, 256, " OpenPIC "); 88 0, 256, " OpenPIC ");
88 } else { 89 } else {
89 mpic = mpic_alloc(np, r.start, 90 mpic = mpic_alloc(np, r.start,
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_mds.c b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
index 747d1ee661f..973b3f4a4b4 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_mds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
@@ -36,7 +36,7 @@
36#include <linux/memblock.h> 36#include <linux/memblock.h>
37 37
38#include <asm/system.h> 38#include <asm/system.h>
39#include <asm/atomic.h> 39#include <linux/atomic.h>
40#include <asm/time.h> 40#include <asm/time.h>
41#include <asm/io.h> 41#include <asm/io.h>
42#include <asm/machdep.h> 42#include <asm/machdep.h>
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_rdb.c b/arch/powerpc/platforms/85xx/mpc85xx_rdb.c
index 088f30b0c08..f5ff9110c97 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_rdb.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_rdb.c
@@ -58,10 +58,11 @@ void __init mpc85xx_rdb_pic_init(void)
58 return; 58 return;
59 } 59 }
60 60
61 if (of_flat_dt_is_compatible(root, "fsl,85XXRDB-CAMP")) { 61 if (of_flat_dt_is_compatible(root, "fsl,MPC85XXRDB-CAMP")) {
62 mpic = mpic_alloc(np, r.start, 62 mpic = mpic_alloc(np, r.start,
63 MPIC_PRIMARY | 63 MPIC_PRIMARY |
64 MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS, 64 MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS |
65 MPIC_SINGLE_DEST_CPU,
65 0, 256, " OpenPIC "); 66 0, 256, " OpenPIC ");
66 } else { 67 } else {
67 mpic = mpic_alloc(np, r.start, 68 mpic = mpic_alloc(np, r.start,
diff --git a/arch/powerpc/platforms/85xx/p1010rdb.c b/arch/powerpc/platforms/85xx/p1010rdb.c
new file mode 100644
index 00000000000..d7387fa7f53
--- /dev/null
+++ b/arch/powerpc/platforms/85xx/p1010rdb.c
@@ -0,0 +1,122 @@
1/*
2 * P1010RDB Board Setup
3 *
4 * Copyright 2011 Freescale Semiconductor Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 */
11
12#include <linux/stddef.h>
13#include <linux/kernel.h>
14#include <linux/pci.h>
15#include <linux/delay.h>
16#include <linux/interrupt.h>
17#include <linux/of_platform.h>
18
19#include <asm/system.h>
20#include <asm/time.h>
21#include <asm/machdep.h>
22#include <asm/pci-bridge.h>
23#include <mm/mmu_decl.h>
24#include <asm/prom.h>
25#include <asm/udbg.h>
26#include <asm/mpic.h>
27
28#include <sysdev/fsl_soc.h>
29#include <sysdev/fsl_pci.h>
30
31void __init p1010_rdb_pic_init(void)
32{
33 struct mpic *mpic;
34 struct resource r;
35 struct device_node *np;
36
37 np = of_find_node_by_type(NULL, "open-pic");
38 if (np == NULL) {
39 printk(KERN_ERR "Could not find open-pic node\n");
40 return;
41 }
42
43 if (of_address_to_resource(np, 0, &r)) {
44 printk(KERN_ERR "Failed to map mpic register space\n");
45 of_node_put(np);
46 return;
47 }
48
49 mpic = mpic_alloc(np, r.start, MPIC_PRIMARY | MPIC_WANTS_RESET |
50 MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS | MPIC_SINGLE_DEST_CPU,
51 0, 256, " OpenPIC ");
52
53 BUG_ON(mpic == NULL);
54 of_node_put(np);
55
56 mpic_init(mpic);
57
58}
59
60
61/*
62 * Setup the architecture
63 */
64static void __init p1010_rdb_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("p1010_rdb_setup_arch()", 0);
72
73#ifdef CONFIG_PCI
74 for_each_node_by_type(np, "pci") {
75 if (of_device_is_compatible(np, "fsl,p1010-pcie"))
76 fsl_add_bridge(np, 0);
77 }
78
79#endif
80
81 printk(KERN_INFO "P1010 RDB board from Freescale Semiconductor\n");
82}
83
84static struct of_device_id __initdata p1010rdb_ids[] = {
85 { .type = "soc", },
86 { .compatible = "soc", },
87 { .compatible = "simple-bus", },
88 {},
89};
90
91static int __init p1010rdb_publish_devices(void)
92{
93 return of_platform_bus_probe(NULL, p1010rdb_ids, NULL);
94}
95machine_device_initcall(p1010_rdb, p1010rdb_publish_devices);
96machine_arch_initcall(p1010_rdb, swiotlb_setup_bus_notifier);
97
98/*
99 * Called very early, device-tree isn't unflattened
100 */
101static int __init p1010_rdb_probe(void)
102{
103 unsigned long root = of_get_flat_dt_root();
104
105 if (of_flat_dt_is_compatible(root, "fsl,P1010RDB"))
106 return 1;
107 return 0;
108}
109
110define_machine(p1010_rdb) {
111 .name = "P1010 RDB",
112 .probe = p1010_rdb_probe,
113 .setup_arch = p1010_rdb_setup_arch,
114 .init_IRQ = p1010_rdb_pic_init,
115#ifdef CONFIG_PCI
116 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
117#endif
118 .get_irq = mpic_get_irq,
119 .restart = fsl_rstcr_restart,
120 .calibrate_decr = generic_calibrate_decr,
121 .progress = udbg_progress,
122};
diff --git a/arch/powerpc/platforms/85xx/p1022_ds.c b/arch/powerpc/platforms/85xx/p1022_ds.c
index 7eb5c40c069..266b3aadfe5 100644
--- a/arch/powerpc/platforms/85xx/p1022_ds.c
+++ b/arch/powerpc/platforms/85xx/p1022_ds.c
@@ -129,6 +129,7 @@ static void p1022ds_set_gamma_table(int monitor_port, char *gamma_table_base)
129static void p1022ds_set_monitor_port(int monitor_port) 129static void p1022ds_set_monitor_port(int monitor_port)
130{ 130{
131 struct device_node *pixis_node; 131 struct device_node *pixis_node;
132 void __iomem *pixis;
132 u8 __iomem *brdcfg1; 133 u8 __iomem *brdcfg1;
133 134
134 pixis_node = of_find_compatible_node(NULL, NULL, "fsl,p1022ds-pixis"); 135 pixis_node = of_find_compatible_node(NULL, NULL, "fsl,p1022ds-pixis");
@@ -137,12 +138,12 @@ static void p1022ds_set_monitor_port(int monitor_port)
137 return; 138 return;
138 } 139 }
139 140
140 brdcfg1 = of_iomap(pixis_node, 0); 141 pixis = of_iomap(pixis_node, 0);
141 if (!brdcfg1) { 142 if (!pixis) {
142 pr_err("p1022ds: could not map ngPIXIS registers\n"); 143 pr_err("p1022ds: could not map ngPIXIS registers\n");
143 return; 144 return;
144 } 145 }
145 brdcfg1 += 9; /* BRDCFG1 is at offset 9 in the ngPIXIS */ 146 brdcfg1 = pixis + 9; /* BRDCFG1 is at offset 9 in the ngPIXIS */
146 147
147 switch (monitor_port) { 148 switch (monitor_port) {
148 case 0: /* DVI */ 149 case 0: /* DVI */
@@ -158,6 +159,8 @@ static void p1022ds_set_monitor_port(int monitor_port)
158 default: 159 default:
159 pr_err("p1022ds: unsupported monitor port %i\n", monitor_port); 160 pr_err("p1022ds: unsupported monitor port %i\n", monitor_port);
160 } 161 }
162
163 iounmap(pixis);
161} 164}
162 165
163/** 166/**
@@ -192,8 +195,13 @@ void p1022ds_set_pixel_clock(unsigned int pixclock)
192 do_div(temp, pixclock); 195 do_div(temp, pixclock);
193 freq = temp; 196 freq = temp;
194 197
195 /* pixclk is the ratio of the platform clock to the pixel clock */ 198 /*
199 * 'pxclk' is the ratio of the platform clock to the pixel clock.
200 * This number is programmed into the CLKDVDR register, and the valid
201 * range of values is 2-255.
202 */
196 pxclk = DIV_ROUND_CLOSEST(fsl_get_sys_freq(), freq); 203 pxclk = DIV_ROUND_CLOSEST(fsl_get_sys_freq(), freq);
204 pxclk = clamp_t(u32, pxclk, 2, 255);
197 205
198 /* Disable the pixel clock, and set it to non-inverted and no delay */ 206 /* Disable the pixel clock, and set it to non-inverted and no delay */
199 clrbits32(&guts->clkdvdr, 207 clrbits32(&guts->clkdvdr,
@@ -201,6 +209,8 @@ void p1022ds_set_pixel_clock(unsigned int pixclock)
201 209
202 /* Enable the clock and set the pxclk */ 210 /* Enable the clock and set the pxclk */
203 setbits32(&guts->clkdvdr, CLKDVDR_PXCKEN | (pxclk << 16)); 211 setbits32(&guts->clkdvdr, CLKDVDR_PXCKEN | (pxclk << 16));
212
213 iounmap(guts);
204} 214}
205 215
206/** 216/**
diff --git a/arch/powerpc/platforms/85xx/p1023_rds.c b/arch/powerpc/platforms/85xx/p1023_rds.c
new file mode 100644
index 00000000000..835e0b335bf
--- /dev/null
+++ b/arch/powerpc/platforms/85xx/p1023_rds.c
@@ -0,0 +1,162 @@
1/*
2 * Copyright 2010-2011 Freescale Semiconductor, Inc.
3 *
4 * Author: Roy Zang <tie-fei.zang@freescale.com>
5 *
6 * Description:
7 * P1023 RDS Board Setup
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 */
14
15#include <linux/kernel.h>
16#include <linux/init.h>
17#include <linux/errno.h>
18#include <linux/pci.h>
19#include <linux/delay.h>
20#include <linux/module.h>
21#include <linux/fsl_devices.h>
22#include <linux/of_platform.h>
23#include <linux/of_device.h>
24
25#include <asm/system.h>
26#include <asm/time.h>
27#include <asm/machdep.h>
28#include <asm/pci-bridge.h>
29#include <mm/mmu_decl.h>
30#include <asm/prom.h>
31#include <asm/udbg.h>
32#include <asm/mpic.h>
33
34#include <sysdev/fsl_soc.h>
35#include <sysdev/fsl_pci.h>
36
37/* ************************************************************************
38 *
39 * Setup the architecture
40 *
41 */
42#ifdef CONFIG_SMP
43void __init mpc85xx_smp_init(void);
44#endif
45
46static void __init mpc85xx_rds_setup_arch(void)
47{
48 struct device_node *np;
49
50 if (ppc_md.progress)
51 ppc_md.progress("p1023_rds_setup_arch()", 0);
52
53 /* Map BCSR area */
54 np = of_find_node_by_name(NULL, "bcsr");
55 if (np != NULL) {
56 static u8 __iomem *bcsr_regs;
57
58 bcsr_regs = of_iomap(np, 0);
59 of_node_put(np);
60
61 if (!bcsr_regs) {
62 printk(KERN_ERR
63 "BCSR: Failed to map bcsr register space\n");
64 return;
65 } else {
66#define BCSR15_I2C_BUS0_SEG_CLR 0x07
67#define BCSR15_I2C_BUS0_SEG2 0x02
68/*
69 * Note: Accessing exclusively i2c devices.
70 *
71 * The i2c controller selects initially ID EEPROM in the u-boot;
72 * but if menu configuration selects RTC support in the kernel,
73 * the i2c controller switches to select RTC chip in the kernel.
74 */
75#ifdef CONFIG_RTC_CLASS
76 /* Enable RTC chip on the segment #2 of i2c */
77 clrbits8(&bcsr_regs[15], BCSR15_I2C_BUS0_SEG_CLR);
78 setbits8(&bcsr_regs[15], BCSR15_I2C_BUS0_SEG2);
79#endif
80
81 iounmap(bcsr_regs);
82 }
83 }
84
85#ifdef CONFIG_PCI
86 for_each_compatible_node(np, "pci", "fsl,p1023-pcie")
87 fsl_add_bridge(np, 0);
88#endif
89
90#ifdef CONFIG_SMP
91 mpc85xx_smp_init();
92#endif
93}
94
95static struct of_device_id p1023_ids[] = {
96 { .type = "soc", },
97 { .compatible = "soc", },
98 { .compatible = "simple-bus", },
99 {},
100};
101
102
103static int __init p1023_publish_devices(void)
104{
105 of_platform_bus_probe(NULL, p1023_ids, NULL);
106
107 return 0;
108}
109
110machine_device_initcall(p1023_rds, p1023_publish_devices);
111
112static void __init mpc85xx_rds_pic_init(void)
113{
114 struct mpic *mpic;
115 struct resource r;
116 struct device_node *np = NULL;
117
118 np = of_find_node_by_type(NULL, "open-pic");
119 if (!np) {
120 printk(KERN_ERR "Could not find open-pic node\n");
121 return;
122 }
123
124 if (of_address_to_resource(np, 0, &r)) {
125 printk(KERN_ERR "Failed to map mpic register space\n");
126 of_node_put(np);
127 return;
128 }
129
130 mpic = mpic_alloc(np, r.start,
131 MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN |
132 MPIC_BROKEN_FRR_NIRQS | MPIC_SINGLE_DEST_CPU,
133 0, 256, " OpenPIC ");
134
135 BUG_ON(mpic == NULL);
136 of_node_put(np);
137
138 mpic_init(mpic);
139}
140
141static int __init p1023_rds_probe(void)
142{
143 unsigned long root = of_get_flat_dt_root();
144
145 return of_flat_dt_is_compatible(root, "fsl,P1023RDS");
146
147}
148
149define_machine(p1023_rds) {
150 .name = "P1023 RDS",
151 .probe = p1023_rds_probe,
152 .setup_arch = mpc85xx_rds_setup_arch,
153 .init_IRQ = mpc85xx_rds_pic_init,
154 .get_irq = mpic_get_irq,
155 .restart = fsl_rstcr_restart,
156 .calibrate_decr = generic_calibrate_decr,
157 .progress = udbg_progress,
158#ifdef CONFIG_PCI
159 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
160#endif
161};
162
diff --git a/arch/powerpc/platforms/85xx/p2040_rdb.c b/arch/powerpc/platforms/85xx/p2040_rdb.c
new file mode 100644
index 00000000000..32b56ac73df
--- /dev/null
+++ b/arch/powerpc/platforms/85xx/p2040_rdb.c
@@ -0,0 +1,88 @@
1/*
2 * P2040 RDB Setup
3 *
4 * Copyright 2011 Freescale Semiconductor Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 */
11
12#include <linux/kernel.h>
13#include <linux/pci.h>
14#include <linux/kdev_t.h>
15#include <linux/delay.h>
16#include <linux/interrupt.h>
17#include <linux/phy.h>
18
19#include <asm/system.h>
20#include <asm/time.h>
21#include <asm/machdep.h>
22#include <asm/pci-bridge.h>
23#include <mm/mmu_decl.h>
24#include <asm/prom.h>
25#include <asm/udbg.h>
26#include <asm/mpic.h>
27
28#include <linux/of_platform.h>
29#include <sysdev/fsl_soc.h>
30#include <sysdev/fsl_pci.h>
31#include <asm/ehv_pic.h>
32
33#include "corenet_ds.h"
34
35/*
36 * Called very early, device-tree isn't unflattened
37 */
38static int __init p2040_rdb_probe(void)
39{
40 unsigned long root = of_get_flat_dt_root();
41#ifdef CONFIG_SMP
42 extern struct smp_ops_t smp_85xx_ops;
43#endif
44
45 if (of_flat_dt_is_compatible(root, "fsl,P2040RDB"))
46 return 1;
47
48 /* Check if we're running under the Freescale hypervisor */
49 if (of_flat_dt_is_compatible(root, "fsl,P2040RDB-hv")) {
50 ppc_md.init_IRQ = ehv_pic_init;
51 ppc_md.get_irq = ehv_pic_get_irq;
52 ppc_md.restart = fsl_hv_restart;
53 ppc_md.power_off = fsl_hv_halt;
54 ppc_md.halt = fsl_hv_halt;
55#ifdef CONFIG_SMP
56 /*
57 * Disable the timebase sync operations because we can't write
58 * to the timebase registers under the hypervisor.
59 */
60 smp_85xx_ops.give_timebase = NULL;
61 smp_85xx_ops.take_timebase = NULL;
62#endif
63 return 1;
64 }
65
66 return 0;
67}
68
69define_machine(p2040_rdb) {
70 .name = "P2040 RDB",
71 .probe = p2040_rdb_probe,
72 .setup_arch = corenet_ds_setup_arch,
73 .init_IRQ = corenet_ds_pic_init,
74#ifdef CONFIG_PCI
75 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
76#endif
77 .get_irq = mpic_get_coreint_irq,
78 .restart = fsl_rstcr_restart,
79 .calibrate_decr = generic_calibrate_decr,
80 .progress = udbg_progress,
81 .power_save = e500_idle,
82};
83
84machine_device_initcall(p2040_rdb, corenet_ds_publish_devices);
85
86#ifdef CONFIG_SWIOTLB
87machine_arch_initcall(p2040_rdb, swiotlb_setup_bus_notifier);
88#endif
diff --git a/arch/powerpc/platforms/85xx/p3041_ds.c b/arch/powerpc/platforms/85xx/p3041_ds.c
index 0ed52e18298..96d99a374dc 100644
--- a/arch/powerpc/platforms/85xx/p3041_ds.c
+++ b/arch/powerpc/platforms/85xx/p3041_ds.c
@@ -30,6 +30,7 @@
30#include <linux/of_platform.h> 30#include <linux/of_platform.h>
31#include <sysdev/fsl_soc.h> 31#include <sysdev/fsl_soc.h>
32#include <sysdev/fsl_pci.h> 32#include <sysdev/fsl_pci.h>
33#include <asm/ehv_pic.h>
33 34
34#include "corenet_ds.h" 35#include "corenet_ds.h"
35 36
@@ -39,8 +40,32 @@
39static int __init p3041_ds_probe(void) 40static int __init p3041_ds_probe(void)
40{ 41{
41 unsigned long root = of_get_flat_dt_root(); 42 unsigned long root = of_get_flat_dt_root();
43#ifdef CONFIG_SMP
44 extern struct smp_ops_t smp_85xx_ops;
45#endif
46
47 if (of_flat_dt_is_compatible(root, "fsl,P3041DS"))
48 return 1;
49
50 /* Check if we're running under the Freescale hypervisor */
51 if (of_flat_dt_is_compatible(root, "fsl,P3041DS-hv")) {
52 ppc_md.init_IRQ = ehv_pic_init;
53 ppc_md.get_irq = ehv_pic_get_irq;
54 ppc_md.restart = fsl_hv_restart;
55 ppc_md.power_off = fsl_hv_halt;
56 ppc_md.halt = fsl_hv_halt;
57#ifdef CONFIG_SMP
58 /*
59 * Disable the timebase sync operations because we can't write
60 * to the timebase registers under the hypervisor.
61 */
62 smp_85xx_ops.give_timebase = NULL;
63 smp_85xx_ops.take_timebase = NULL;
64#endif
65 return 1;
66 }
42 67
43 return of_flat_dt_is_compatible(root, "fsl,P3041DS"); 68 return 0;
44} 69}
45 70
46define_machine(p3041_ds) { 71define_machine(p3041_ds) {
@@ -55,6 +80,7 @@ define_machine(p3041_ds) {
55 .restart = fsl_rstcr_restart, 80 .restart = fsl_rstcr_restart,
56 .calibrate_decr = generic_calibrate_decr, 81 .calibrate_decr = generic_calibrate_decr,
57 .progress = udbg_progress, 82 .progress = udbg_progress,
83 .power_save = e500_idle,
58}; 84};
59 85
60machine_device_initcall(p3041_ds, corenet_ds_publish_devices); 86machine_device_initcall(p3041_ds, corenet_ds_publish_devices);
diff --git a/arch/powerpc/platforms/85xx/p4080_ds.c b/arch/powerpc/platforms/85xx/p4080_ds.c
index 84170460497..d1b21d7663e 100644
--- a/arch/powerpc/platforms/85xx/p4080_ds.c
+++ b/arch/powerpc/platforms/85xx/p4080_ds.c
@@ -29,31 +29,42 @@
29#include <linux/of_platform.h> 29#include <linux/of_platform.h>
30#include <sysdev/fsl_soc.h> 30#include <sysdev/fsl_soc.h>
31#include <sysdev/fsl_pci.h> 31#include <sysdev/fsl_pci.h>
32#include <asm/ehv_pic.h>
32 33
33#include "corenet_ds.h" 34#include "corenet_ds.h"
34 35
35#ifdef CONFIG_PCI
36static int primary_phb_addr;
37#endif
38
39/* 36/*
40 * Called very early, device-tree isn't unflattened 37 * Called very early, device-tree isn't unflattened
41 */ 38 */
42static int __init p4080_ds_probe(void) 39static int __init p4080_ds_probe(void)
43{ 40{
44 unsigned long root = of_get_flat_dt_root(); 41 unsigned long root = of_get_flat_dt_root();
42#ifdef CONFIG_SMP
43 extern struct smp_ops_t smp_85xx_ops;
44#endif
45 45
46 if (of_flat_dt_is_compatible(root, "fsl,P4080DS")) { 46 if (of_flat_dt_is_compatible(root, "fsl,P4080DS"))
47#ifdef CONFIG_PCI 47 return 1;
48 /* treat PCIe1 as primary, 48
49 * shouldn't matter as we have no ISA on the board 49 /* Check if we're running under the Freescale hypervisor */
50 */ 50 if (of_flat_dt_is_compatible(root, "fsl,P4080DS-hv")) {
51 primary_phb_addr = 0x0000; 51 ppc_md.init_IRQ = ehv_pic_init;
52 ppc_md.get_irq = ehv_pic_get_irq;
53 ppc_md.restart = fsl_hv_restart;
54 ppc_md.power_off = fsl_hv_halt;
55 ppc_md.halt = fsl_hv_halt;
56#ifdef CONFIG_SMP
57 /*
58 * Disable the timebase sync operations because we can't write
59 * to the timebase registers under the hypervisor.
60 */
61 smp_85xx_ops.give_timebase = NULL;
62 smp_85xx_ops.take_timebase = NULL;
52#endif 63#endif
53 return 1; 64 return 1;
54 } else {
55 return 0;
56 } 65 }
66
67 return 0;
57} 68}
58 69
59define_machine(p4080_ds) { 70define_machine(p4080_ds) {
@@ -68,7 +79,10 @@ define_machine(p4080_ds) {
68 .restart = fsl_rstcr_restart, 79 .restart = fsl_rstcr_restart,
69 .calibrate_decr = generic_calibrate_decr, 80 .calibrate_decr = generic_calibrate_decr,
70 .progress = udbg_progress, 81 .progress = udbg_progress,
82 .power_save = e500_idle,
71}; 83};
72 84
73machine_device_initcall(p4080_ds, corenet_ds_publish_devices); 85machine_device_initcall(p4080_ds, corenet_ds_publish_devices);
86#ifdef CONFIG_SWIOTLB
74machine_arch_initcall(p4080_ds, swiotlb_setup_bus_notifier); 87machine_arch_initcall(p4080_ds, swiotlb_setup_bus_notifier);
88#endif
diff --git a/arch/powerpc/platforms/85xx/p5020_ds.c b/arch/powerpc/platforms/85xx/p5020_ds.c
index 7467b712ee0..e8cba5004fd 100644
--- a/arch/powerpc/platforms/85xx/p5020_ds.c
+++ b/arch/powerpc/platforms/85xx/p5020_ds.c
@@ -30,6 +30,7 @@
30#include <linux/of_platform.h> 30#include <linux/of_platform.h>
31#include <sysdev/fsl_soc.h> 31#include <sysdev/fsl_soc.h>
32#include <sysdev/fsl_pci.h> 32#include <sysdev/fsl_pci.h>
33#include <asm/ehv_pic.h>
33 34
34#include "corenet_ds.h" 35#include "corenet_ds.h"
35 36
@@ -39,8 +40,32 @@
39static int __init p5020_ds_probe(void) 40static int __init p5020_ds_probe(void)
40{ 41{
41 unsigned long root = of_get_flat_dt_root(); 42 unsigned long root = of_get_flat_dt_root();
43#ifdef CONFIG_SMP
44 extern struct smp_ops_t smp_85xx_ops;
45#endif
46
47 if (of_flat_dt_is_compatible(root, "fsl,P5020DS"))
48 return 1;
49
50 /* Check if we're running under the Freescale hypervisor */
51 if (of_flat_dt_is_compatible(root, "fsl,P5020DS-hv")) {
52 ppc_md.init_IRQ = ehv_pic_init;
53 ppc_md.get_irq = ehv_pic_get_irq;
54 ppc_md.restart = fsl_hv_restart;
55 ppc_md.power_off = fsl_hv_halt;
56 ppc_md.halt = fsl_hv_halt;
57#ifdef CONFIG_SMP
58 /*
59 * Disable the timebase sync operations because we can't write
60 * to the timebase registers under the hypervisor.
61 */
62 smp_85xx_ops.give_timebase = NULL;
63 smp_85xx_ops.take_timebase = NULL;
64#endif
65 return 1;
66 }
42 67
43 return of_flat_dt_is_compatible(root, "fsl,P5020DS"); 68 return 0;
44} 69}
45 70
46define_machine(p5020_ds) { 71define_machine(p5020_ds) {
@@ -60,6 +85,11 @@ define_machine(p5020_ds) {
60 .restart = fsl_rstcr_restart, 85 .restart = fsl_rstcr_restart,
61 .calibrate_decr = generic_calibrate_decr, 86 .calibrate_decr = generic_calibrate_decr,
62 .progress = udbg_progress, 87 .progress = udbg_progress,
88#ifdef CONFIG_PPC64
89 .power_save = book3e_idle,
90#else
91 .power_save = e500_idle,
92#endif
63}; 93};
64 94
65machine_device_initcall(p5020_ds, corenet_ds_publish_devices); 95machine_device_initcall(p5020_ds, corenet_ds_publish_devices);
diff --git a/arch/powerpc/platforms/85xx/sbc8548.c b/arch/powerpc/platforms/85xx/sbc8548.c
index ecdd8c09e4e..d07dcb7f4ee 100644
--- a/arch/powerpc/platforms/85xx/sbc8548.c
+++ b/arch/powerpc/platforms/85xx/sbc8548.c
@@ -34,7 +34,7 @@
34#include <asm/system.h> 34#include <asm/system.h>
35#include <asm/pgtable.h> 35#include <asm/pgtable.h>
36#include <asm/page.h> 36#include <asm/page.h>
37#include <asm/atomic.h> 37#include <linux/atomic.h>
38#include <asm/time.h> 38#include <asm/time.h>
39#include <asm/io.h> 39#include <asm/io.h>
40#include <asm/machdep.h> 40#include <asm/machdep.h>
diff --git a/arch/powerpc/platforms/85xx/sbc8560.c b/arch/powerpc/platforms/85xx/sbc8560.c
index d2dfd465fbf..09ced722175 100644
--- a/arch/powerpc/platforms/85xx/sbc8560.c
+++ b/arch/powerpc/platforms/85xx/sbc8560.c
@@ -285,7 +285,7 @@ static int __init sbc8560_bdrstcr_init(void)
285 285
286 printk(KERN_INFO "sbc8560: Found BRSTCR at i/o 0x%x\n", res.start); 286 printk(KERN_INFO "sbc8560: Found BRSTCR at i/o 0x%x\n", res.start);
287 287
288 brstcr = ioremap(res.start, res.end - res.start); 288 brstcr = ioremap(res.start, resource_size(&res));
289 if(!brstcr) 289 if(!brstcr)
290 printk(KERN_WARNING "sbc8560: ioremap of brstcr failed.\n"); 290 printk(KERN_WARNING "sbc8560: ioremap of brstcr failed.\n");
291 291
diff --git a/arch/powerpc/platforms/85xx/smp.c b/arch/powerpc/platforms/85xx/smp.c
index d6a93a10c0f..5b9b901f644 100644
--- a/arch/powerpc/platforms/85xx/smp.c
+++ b/arch/powerpc/platforms/85xx/smp.c
@@ -2,7 +2,7 @@
2 * Author: Andy Fleming <afleming@freescale.com> 2 * Author: Andy Fleming <afleming@freescale.com>
3 * Kumar Gala <galak@kernel.crashing.org> 3 * Kumar Gala <galak@kernel.crashing.org>
4 * 4 *
5 * Copyright 2006-2008 Freescale Semiconductor Inc. 5 * Copyright 2006-2008, 2011 Freescale Semiconductor Inc.
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify it 7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the 8 * under the terms of the GNU General Public License as published by the
@@ -111,14 +111,6 @@ smp_85xx_kick_cpu(int nr)
111 return 0; 111 return 0;
112} 112}
113 113
114static void __init
115smp_85xx_setup_cpu(int cpu_nr)
116{
117 mpic_setup_this_cpu();
118 if (cpu_has_feature(CPU_FTR_DBELL))
119 doorbell_setup_this_cpu();
120}
121
122struct smp_ops_t smp_85xx_ops = { 114struct smp_ops_t smp_85xx_ops = {
123 .kick_cpu = smp_85xx_kick_cpu, 115 .kick_cpu = smp_85xx_kick_cpu,
124#ifdef CONFIG_KEXEC 116#ifdef CONFIG_KEXEC
@@ -224,24 +216,36 @@ static void mpc85xx_smp_machine_kexec(struct kimage *image)
224} 216}
225#endif /* CONFIG_KEXEC */ 217#endif /* CONFIG_KEXEC */
226 218
219static void __init
220smp_85xx_setup_cpu(int cpu_nr)
221{
222 if (smp_85xx_ops.probe == smp_mpic_probe)
223 mpic_setup_this_cpu();
224
225 if (cpu_has_feature(CPU_FTR_DBELL))
226 doorbell_setup_this_cpu();
227}
228
227void __init mpc85xx_smp_init(void) 229void __init mpc85xx_smp_init(void)
228{ 230{
229 struct device_node *np; 231 struct device_node *np;
230 232
233 smp_85xx_ops.setup_cpu = smp_85xx_setup_cpu;
234
231 np = of_find_node_by_type(NULL, "open-pic"); 235 np = of_find_node_by_type(NULL, "open-pic");
232 if (np) { 236 if (np) {
233 smp_85xx_ops.probe = smp_mpic_probe; 237 smp_85xx_ops.probe = smp_mpic_probe;
234 smp_85xx_ops.setup_cpu = smp_85xx_setup_cpu;
235 smp_85xx_ops.message_pass = smp_mpic_message_pass; 238 smp_85xx_ops.message_pass = smp_mpic_message_pass;
236 } 239 }
237 240
238 if (cpu_has_feature(CPU_FTR_DBELL)) { 241 if (cpu_has_feature(CPU_FTR_DBELL)) {
239 smp_85xx_ops.message_pass = smp_muxed_ipi_message_pass; 242 /*
243 * If left NULL, .message_pass defaults to
244 * smp_muxed_ipi_message_pass
245 */
240 smp_85xx_ops.cause_ipi = doorbell_cause_ipi; 246 smp_85xx_ops.cause_ipi = doorbell_cause_ipi;
241 } 247 }
242 248
243 BUG_ON(!smp_85xx_ops.message_pass);
244
245 smp_ops = &smp_85xx_ops; 249 smp_ops = &smp_85xx_ops;
246 250
247#ifdef CONFIG_KEXEC 251#ifdef CONFIG_KEXEC
diff --git a/arch/powerpc/platforms/85xx/xes_mpc85xx.c b/arch/powerpc/platforms/85xx/xes_mpc85xx.c
index 0125604d096..a9dc5e79512 100644
--- a/arch/powerpc/platforms/85xx/xes_mpc85xx.c
+++ b/arch/powerpc/platforms/85xx/xes_mpc85xx.c
@@ -123,7 +123,7 @@ static void xes_mpc85xx_fixups(void)
123 continue; 123 continue;
124 } 124 }
125 125
126 l2_base = ioremap(r[0].start, r[0].end - r[0].start + 1); 126 l2_base = ioremap(r[0].start, resource_size(&r[0]));
127 127
128 xes_mpc85xx_configure_l2(l2_base); 128 xes_mpc85xx_configure_l2(l2_base);
129 } 129 }
diff --git a/arch/powerpc/platforms/86xx/mpc8610_hpcd.c b/arch/powerpc/platforms/86xx/mpc8610_hpcd.c
index a896511690c..74e018ef724 100644
--- a/arch/powerpc/platforms/86xx/mpc8610_hpcd.c
+++ b/arch/powerpc/platforms/86xx/mpc8610_hpcd.c
@@ -39,12 +39,19 @@
39#include <sysdev/fsl_pci.h> 39#include <sysdev/fsl_pci.h>
40#include <sysdev/fsl_soc.h> 40#include <sysdev/fsl_soc.h>
41#include <sysdev/simple_gpio.h> 41#include <sysdev/simple_gpio.h>
42#include <asm/fsl_guts.h>
42 43
43#include "mpc86xx.h" 44#include "mpc86xx.h"
44 45
45static struct device_node *pixis_node; 46static struct device_node *pixis_node;
46static unsigned char *pixis_bdcfg0, *pixis_arch; 47static unsigned char *pixis_bdcfg0, *pixis_arch;
47 48
49/* DIU Pixel Clock bits of the CLKDVDR Global Utilities register */
50#define CLKDVDR_PXCKEN 0x80000000
51#define CLKDVDR_PXCKINV 0x10000000
52#define CLKDVDR_PXCKDLY 0x06000000
53#define CLKDVDR_PXCLK_MASK 0x001F0000
54
48#ifdef CONFIG_SUSPEND 55#ifdef CONFIG_SUSPEND
49static irqreturn_t mpc8610_sw9_irq(int irq, void *data) 56static irqreturn_t mpc8610_sw9_irq(int irq, void *data)
50{ 57{
@@ -205,72 +212,54 @@ void mpc8610hpcd_set_monitor_port(int monitor_port)
205 bdcfg[monitor_port]); 212 bdcfg[monitor_port]);
206} 213}
207 214
215/**
216 * mpc8610hpcd_set_pixel_clock: program the DIU's clock
217 *
218 * @pixclock: the wavelength, in picoseconds, of the clock
219 */
208void mpc8610hpcd_set_pixel_clock(unsigned int pixclock) 220void mpc8610hpcd_set_pixel_clock(unsigned int pixclock)
209{ 221{
210 u32 __iomem *clkdvdr; 222 struct device_node *guts_np = NULL;
211 u32 temp; 223 struct ccsr_guts_86xx __iomem *guts;
212 /* variables for pixel clock calcs */ 224 unsigned long freq;
213 ulong bestval, bestfreq, speed_ccb, minpixclock, maxpixclock; 225 u64 temp;
214 ulong pixval; 226 u32 pxclk;
215 long err; 227
216 int i; 228 /* Map the global utilities registers. */
217 229 guts_np = of_find_compatible_node(NULL, NULL, "fsl,mpc8610-guts");
218 clkdvdr = ioremap(get_immrbase() + 0xe0800, sizeof(u32)); 230 if (!guts_np) {
219 if (!clkdvdr) { 231 pr_err("mpc8610hpcd: missing global utilties device node\n");
220 printk(KERN_ERR "Err: can't map clock divider register!\n");
221 return; 232 return;
222 } 233 }
223 234
224 /* Pixel Clock configuration */ 235 guts = of_iomap(guts_np, 0);
225 speed_ccb = fsl_get_sys_freq(); 236 of_node_put(guts_np);
226 237 if (!guts) {
227 /* Calculate the pixel clock with the smallest error */ 238 pr_err("mpc8610hpcd: could not map global utilties device\n");
228 /* calculate the following in steps to avoid overflow */ 239 return;
229 pr_debug("DIU pixclock in ps - %d\n", pixclock);
230 temp = 1000000000/pixclock;
231 temp *= 1000;
232 pixclock = temp;
233 pr_debug("DIU pixclock freq - %u\n", pixclock);
234
235 temp = pixclock * 5 / 100;
236 pr_debug("deviation = %d\n", temp);
237 minpixclock = pixclock - temp;
238 maxpixclock = pixclock + temp;
239 pr_debug("DIU minpixclock - %lu\n", minpixclock);
240 pr_debug("DIU maxpixclock - %lu\n", maxpixclock);
241 pixval = speed_ccb/pixclock;
242 pr_debug("DIU pixval = %lu\n", pixval);
243
244 err = 100000000;
245 bestval = pixval;
246 pr_debug("DIU bestval = %lu\n", bestval);
247
248 bestfreq = 0;
249 for (i = -1; i <= 1; i++) {
250 temp = speed_ccb / ((pixval+i) + 1);
251 pr_debug("DIU test pixval i= %d, pixval=%lu, temp freq. = %u\n",
252 i, pixval, temp);
253 if ((temp < minpixclock) || (temp > maxpixclock))
254 pr_debug("DIU exceeds monitor range (%lu to %lu)\n",
255 minpixclock, maxpixclock);
256 else if (abs(temp - pixclock) < err) {
257 pr_debug("Entered the else if block %d\n", i);
258 err = abs(temp - pixclock);
259 bestval = pixval+i;
260 bestfreq = temp;
261 }
262 } 240 }
263 241
264 pr_debug("DIU chose = %lx\n", bestval); 242 /* Convert pixclock from a wavelength to a frequency */
265 pr_debug("DIU error = %ld\n NomPixClk ", err); 243 temp = 1000000000000ULL;
266 pr_debug("DIU: Best Freq = %lx\n", bestfreq); 244 do_div(temp, pixclock);
267 /* Modify PXCLK in GUTS CLKDVDR */ 245 freq = temp;
268 pr_debug("DIU: Current value of CLKDVDR = 0x%08x\n", (*clkdvdr)); 246
269 temp = (*clkdvdr) & 0x2000FFFF; 247 /*
270 *clkdvdr = temp; /* turn off clock */ 248 * 'pxclk' is the ratio of the platform clock to the pixel clock.
271 *clkdvdr = temp | 0x80000000 | (((bestval) & 0x1F) << 16); 249 * On the MPC8610, the value programmed into CLKDVDR is the ratio
272 pr_debug("DIU: Modified value of CLKDVDR = 0x%08x\n", (*clkdvdr)); 250 * minus one. The valid range of values is 2-31.
273 iounmap(clkdvdr); 251 */
252 pxclk = DIV_ROUND_CLOSEST(fsl_get_sys_freq(), freq) - 1;
253 pxclk = clamp_t(u32, pxclk, 2, 31);
254
255 /* Disable the pixel clock, and set it to non-inverted and no delay */
256 clrbits32(&guts->clkdvdr,
257 CLKDVDR_PXCKEN | CLKDVDR_PXCKDLY | CLKDVDR_PXCLK_MASK);
258
259 /* Enable the clock and set the pxclk */
260 setbits32(&guts->clkdvdr, CLKDVDR_PXCKEN | (pxclk << 16));
261
262 iounmap(guts);
274} 263}
275 264
276ssize_t mpc8610hpcd_show_monitor_port(int monitor_port, char *buf) 265ssize_t mpc8610hpcd_show_monitor_port(int monitor_port, char *buf)
diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig
index f970ca2b180..b9ba86191ae 100644
--- a/arch/powerpc/platforms/Kconfig
+++ b/arch/powerpc/platforms/Kconfig
@@ -24,7 +24,7 @@ source "arch/powerpc/platforms/wsp/Kconfig"
24 24
25config KVM_GUEST 25config KVM_GUEST
26 bool "KVM Guest support" 26 bool "KVM Guest support"
27 default y 27 default n
28 ---help--- 28 ---help---
29 This option enables various optimizations for running under the KVM 29 This option enables various optimizations for running under the KVM
30 hypervisor. Overhead for the kernel when not running inside KVM should 30 hypervisor. Overhead for the kernel when not running inside KVM should
@@ -78,6 +78,10 @@ config MPIC
78 bool 78 bool
79 default n 79 default n
80 80
81config PPC_EPAPR_HV_PIC
82 bool
83 default n
84
81config MPIC_WEIRD 85config MPIC_WEIRD
82 bool 86 bool
83 default n 87 default n
@@ -266,7 +270,7 @@ config TAU_AVERAGE
266 270
267config QUICC_ENGINE 271config QUICC_ENGINE
268 bool "Freescale QUICC Engine (QE) Support" 272 bool "Freescale QUICC Engine (QE) Support"
269 depends on FSL_SOC 273 depends on FSL_SOC && PPC32
270 select PPC_LIB_RHEAP 274 select PPC_LIB_RHEAP
271 select CRC32 275 select CRC32
272 help 276 help
diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
index 2165b65876f..e06e39589a0 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -1,7 +1,6 @@
1config PPC64 1config PPC64
2 bool "64-bit kernel" 2 bool "64-bit kernel"
3 default n 3 default n
4 select PPC_HAVE_PMU_SUPPORT
5 help 4 help
6 This option selects whether a 32-bit or a 64-bit kernel 5 This option selects whether a 32-bit or a 64-bit kernel
7 will be built. 6 will be built.
@@ -69,6 +68,7 @@ choice
69config PPC_BOOK3S_64 68config PPC_BOOK3S_64
70 bool "Server processors" 69 bool "Server processors"
71 select PPC_FPU 70 select PPC_FPU
71 select PPC_HAVE_PMU_SUPPORT
72 72
73config PPC_BOOK3E_64 73config PPC_BOOK3E_64
74 bool "Embedded processors" 74 bool "Embedded processors"
diff --git a/arch/powerpc/platforms/amigaone/Kconfig b/arch/powerpc/platforms/amigaone/Kconfig
index 02247671771..128de25cc28 100644
--- a/arch/powerpc/platforms/amigaone/Kconfig
+++ b/arch/powerpc/platforms/amigaone/Kconfig
@@ -8,7 +8,7 @@ config AMIGAONE
8 select NOT_COHERENT_CACHE 8 select NOT_COHERENT_CACHE
9 select CHECK_CACHE_COHERENCY 9 select CHECK_CACHE_COHERENCY
10 select DEFAULT_UIMAGE 10 select DEFAULT_UIMAGE
11 select PCSPKR_PLATFORM 11 select HAVE_PCSPKR_PLATFORM
12 help 12 help
13 Select AmigaOne for the following machines: 13 Select AmigaOne for the following machines:
14 - AmigaOne SE/Teron CX (G3 only) 14 - AmigaOne SE/Teron CX (G3 only)
diff --git a/arch/powerpc/platforms/cell/celleb_scc_epci.c b/arch/powerpc/platforms/cell/celleb_scc_epci.c
index 05b0db3ef63..844c0facb4f 100644
--- a/arch/powerpc/platforms/cell/celleb_scc_epci.c
+++ b/arch/powerpc/platforms/cell/celleb_scc_epci.c
@@ -393,19 +393,19 @@ static int __init celleb_setup_epci(struct device_node *node,
393 393
394 if (of_address_to_resource(node, 0, &r)) 394 if (of_address_to_resource(node, 0, &r))
395 goto error; 395 goto error;
396 hose->cfg_addr = ioremap(r.start, (r.end - r.start + 1)); 396 hose->cfg_addr = ioremap(r.start, resource_size(&r));
397 if (!hose->cfg_addr) 397 if (!hose->cfg_addr)
398 goto error; 398 goto error;
399 pr_debug("EPCI: cfg_addr map 0x%016llx->0x%016lx + 0x%016llx\n", 399 pr_debug("EPCI: cfg_addr map 0x%016llx->0x%016lx + 0x%016llx\n",
400 r.start, (unsigned long)hose->cfg_addr, (r.end - r.start + 1)); 400 r.start, (unsigned long)hose->cfg_addr, resource_size(&r));
401 401
402 if (of_address_to_resource(node, 2, &r)) 402 if (of_address_to_resource(node, 2, &r))
403 goto error; 403 goto error;
404 hose->cfg_data = ioremap(r.start, (r.end - r.start + 1)); 404 hose->cfg_data = ioremap(r.start, resource_size(&r));
405 if (!hose->cfg_data) 405 if (!hose->cfg_data)
406 goto error; 406 goto error;
407 pr_debug("EPCI: cfg_data map 0x%016llx->0x%016lx + 0x%016llx\n", 407 pr_debug("EPCI: cfg_data map 0x%016llx->0x%016lx + 0x%016llx\n",
408 r.start, (unsigned long)hose->cfg_data, (r.end - r.start + 1)); 408 r.start, (unsigned long)hose->cfg_data, resource_size(&r));
409 409
410 hose->ops = &celleb_epci_ops; 410 hose->ops = &celleb_epci_ops;
411 celleb_epci_init(hose); 411 celleb_epci_init(hose);
diff --git a/arch/powerpc/platforms/cell/celleb_scc_pciex.c b/arch/powerpc/platforms/cell/celleb_scc_pciex.c
index a881bbee8de..ae790ac4a58 100644
--- a/arch/powerpc/platforms/cell/celleb_scc_pciex.c
+++ b/arch/powerpc/platforms/cell/celleb_scc_pciex.c
@@ -494,7 +494,7 @@ static __init int celleb_setup_pciex(struct device_node *node,
494 pr_err("PCIEXC:Failed to get config resource.\n"); 494 pr_err("PCIEXC:Failed to get config resource.\n");
495 return 1; 495 return 1;
496 } 496 }
497 phb->cfg_addr = ioremap(r.start, r.end - r.start + 1); 497 phb->cfg_addr = ioremap(r.start, resource_size(&r));
498 if (!phb->cfg_addr) { 498 if (!phb->cfg_addr) {
499 pr_err("PCIEXC:Failed to remap SMMIO region.\n"); 499 pr_err("PCIEXC:Failed to remap SMMIO region.\n");
500 return 1; 500 return 1;
diff --git a/arch/powerpc/platforms/cell/cpufreq_spudemand.c b/arch/powerpc/platforms/cell/cpufreq_spudemand.c
index d809836bcf5..7f92096fe96 100644
--- a/arch/powerpc/platforms/cell/cpufreq_spudemand.c
+++ b/arch/powerpc/platforms/cell/cpufreq_spudemand.c
@@ -24,7 +24,7 @@
24#include <linux/sched.h> 24#include <linux/sched.h>
25#include <linux/timer.h> 25#include <linux/timer.h>
26#include <linux/workqueue.h> 26#include <linux/workqueue.h>
27#include <asm/atomic.h> 27#include <linux/atomic.h>
28#include <asm/machdep.h> 28#include <asm/machdep.h>
29#include <asm/spu.h> 29#include <asm/spu.h>
30 30
diff --git a/arch/powerpc/platforms/cell/smp.c b/arch/powerpc/platforms/cell/smp.c
index dbb641ea90d..f2e1dfe4bf3 100644
--- a/arch/powerpc/platforms/cell/smp.c
+++ b/arch/powerpc/platforms/cell/smp.c
@@ -28,7 +28,7 @@
28#include <linux/cpu.h> 28#include <linux/cpu.h>
29 29
30#include <asm/ptrace.h> 30#include <asm/ptrace.h>
31#include <asm/atomic.h> 31#include <linux/atomic.h>
32#include <asm/irq.h> 32#include <asm/irq.h>
33#include <asm/page.h> 33#include <asm/page.h>
34#include <asm/pgtable.h> 34#include <asm/pgtable.h>
diff --git a/arch/powerpc/platforms/cell/spu_manage.c b/arch/powerpc/platforms/cell/spu_manage.c
index f465d474ad9..4e5c91489c0 100644
--- a/arch/powerpc/platforms/cell/spu_manage.c
+++ b/arch/powerpc/platforms/cell/spu_manage.c
@@ -222,7 +222,7 @@ static int spu_map_resource(struct spu *spu, int nr,
222 return ret; 222 return ret;
223 if (phys) 223 if (phys)
224 *phys = resource.start; 224 *phys = resource.start;
225 len = resource.end - resource.start + 1; 225 len = resource_size(&resource);
226 *virt = ioremap(resource.start, len); 226 *virt = ioremap(resource.start, len);
227 if (!*virt) 227 if (!*virt)
228 return -EINVAL; 228 return -EINVAL;
diff --git a/arch/powerpc/platforms/cell/spufs/context.c b/arch/powerpc/platforms/cell/spufs/context.c
index 0c87bcd2452..bf4d41d8fa1 100644
--- a/arch/powerpc/platforms/cell/spufs/context.c
+++ b/arch/powerpc/platforms/cell/spufs/context.c
@@ -24,7 +24,7 @@
24#include <linux/mm.h> 24#include <linux/mm.h>
25#include <linux/module.h> 25#include <linux/module.h>
26#include <linux/slab.h> 26#include <linux/slab.h>
27#include <asm/atomic.h> 27#include <linux/atomic.h>
28#include <asm/spu.h> 28#include <asm/spu.h>
29#include <asm/spu_csa.h> 29#include <asm/spu_csa.h>
30#include "spufs.h" 30#include "spufs.h"
diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c
index 3c7c3f82d84..fb59c46e9e9 100644
--- a/arch/powerpc/platforms/cell/spufs/file.c
+++ b/arch/powerpc/platforms/cell/spufs/file.c
@@ -1850,9 +1850,16 @@ out:
1850 return ret; 1850 return ret;
1851} 1851}
1852 1852
1853static int spufs_mfc_fsync(struct file *file, int datasync) 1853static int spufs_mfc_fsync(struct file *file, loff_t start, loff_t end, int datasync)
1854{ 1854{
1855 return spufs_mfc_flush(file, NULL); 1855 struct inode *inode = file->f_path.dentry->d_inode;
1856 int err = filemap_write_and_wait_range(inode->i_mapping, start, end);
1857 if (!err) {
1858 mutex_lock(&inode->i_mutex);
1859 err = spufs_mfc_flush(file, NULL);
1860 mutex_unlock(&inode->i_mutex);
1861 }
1862 return err;
1856} 1863}
1857 1864
1858static int spufs_mfc_fasync(int fd, struct file *file, int on) 1865static int spufs_mfc_fasync(int fd, struct file *file, int on)
diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c
index 856e9c39806..e481f6b9a78 100644
--- a/arch/powerpc/platforms/cell/spufs/inode.c
+++ b/arch/powerpc/platforms/cell/spufs/inode.c
@@ -611,15 +611,14 @@ out:
611 611
612static struct file_system_type spufs_type; 612static struct file_system_type spufs_type;
613 613
614long spufs_create(struct nameidata *nd, unsigned int flags, mode_t mode, 614long spufs_create(struct path *path, struct dentry *dentry,
615 struct file *filp) 615 unsigned int flags, mode_t mode, struct file *filp)
616{ 616{
617 struct dentry *dentry;
618 int ret; 617 int ret;
619 618
620 ret = -EINVAL; 619 ret = -EINVAL;
621 /* check if we are on spufs */ 620 /* check if we are on spufs */
622 if (nd->path.dentry->d_sb->s_type != &spufs_type) 621 if (path->dentry->d_sb->s_type != &spufs_type)
623 goto out; 622 goto out;
624 623
625 /* don't accept undefined flags */ 624 /* don't accept undefined flags */
@@ -627,33 +626,27 @@ long spufs_create(struct nameidata *nd, unsigned int flags, mode_t mode,
627 goto out; 626 goto out;
628 627
629 /* only threads can be underneath a gang */ 628 /* only threads can be underneath a gang */
630 if (nd->path.dentry != nd->path.dentry->d_sb->s_root) { 629 if (path->dentry != path->dentry->d_sb->s_root) {
631 if ((flags & SPU_CREATE_GANG) || 630 if ((flags & SPU_CREATE_GANG) ||
632 !SPUFS_I(nd->path.dentry->d_inode)->i_gang) 631 !SPUFS_I(path->dentry->d_inode)->i_gang)
633 goto out; 632 goto out;
634 } 633 }
635 634
636 dentry = lookup_create(nd, 1);
637 ret = PTR_ERR(dentry);
638 if (IS_ERR(dentry))
639 goto out_dir;
640
641 mode &= ~current_umask(); 635 mode &= ~current_umask();
642 636
643 if (flags & SPU_CREATE_GANG) 637 if (flags & SPU_CREATE_GANG)
644 ret = spufs_create_gang(nd->path.dentry->d_inode, 638 ret = spufs_create_gang(path->dentry->d_inode,
645 dentry, nd->path.mnt, mode); 639 dentry, path->mnt, mode);
646 else 640 else
647 ret = spufs_create_context(nd->path.dentry->d_inode, 641 ret = spufs_create_context(path->dentry->d_inode,
648 dentry, nd->path.mnt, flags, mode, 642 dentry, path->mnt, flags, mode,
649 filp); 643 filp);
650 if (ret >= 0) 644 if (ret >= 0)
651 fsnotify_mkdir(nd->path.dentry->d_inode, dentry); 645 fsnotify_mkdir(path->dentry->d_inode, dentry);
652 return ret; 646 return ret;
653 647
654out_dir:
655 mutex_unlock(&nd->path.dentry->d_inode->i_mutex);
656out: 648out:
649 mutex_unlock(&path->dentry->d_inode->i_mutex);
657 return ret; 650 return ret;
658} 651}
659 652
diff --git a/arch/powerpc/platforms/cell/spufs/spufs.h b/arch/powerpc/platforms/cell/spufs/spufs.h
index c448bac6551..099245f230b 100644
--- a/arch/powerpc/platforms/cell/spufs/spufs.h
+++ b/arch/powerpc/platforms/cell/spufs/spufs.h
@@ -248,7 +248,7 @@ extern const struct spufs_tree_descr spufs_dir_debug_contents[];
248/* system call implementation */ 248/* system call implementation */
249extern struct spufs_calls spufs_calls; 249extern struct spufs_calls spufs_calls;
250long spufs_run_spu(struct spu_context *ctx, u32 *npc, u32 *status); 250long spufs_run_spu(struct spu_context *ctx, u32 *npc, u32 *status);
251long spufs_create(struct nameidata *nd, unsigned int flags, 251long spufs_create(struct path *nd, struct dentry *dentry, unsigned int flags,
252 mode_t mode, struct file *filp); 252 mode_t mode, struct file *filp);
253/* ELF coredump callbacks for writing SPU ELF notes */ 253/* ELF coredump callbacks for writing SPU ELF notes */
254extern int spufs_coredump_extra_notes_size(void); 254extern int spufs_coredump_extra_notes_size(void);
diff --git a/arch/powerpc/platforms/cell/spufs/syscalls.c b/arch/powerpc/platforms/cell/spufs/syscalls.c
index a3d2ce54ea2..609e016e92d 100644
--- a/arch/powerpc/platforms/cell/spufs/syscalls.c
+++ b/arch/powerpc/platforms/cell/spufs/syscalls.c
@@ -62,21 +62,17 @@ out:
62static long do_spu_create(const char __user *pathname, unsigned int flags, 62static long do_spu_create(const char __user *pathname, unsigned int flags,
63 mode_t mode, struct file *neighbor) 63 mode_t mode, struct file *neighbor)
64{ 64{
65 char *tmp; 65 struct path path;
66 struct dentry *dentry;
66 int ret; 67 int ret;
67 68
68 tmp = getname(pathname); 69 dentry = user_path_create(AT_FDCWD, pathname, &path, 1);
69 ret = PTR_ERR(tmp); 70 ret = PTR_ERR(dentry);
70 if (!IS_ERR(tmp)) { 71 if (!IS_ERR(dentry)) {
71 struct nameidata nd; 72 ret = spufs_create(&path, dentry, flags, mode, neighbor);
72 73 mutex_unlock(&path.dentry->d_inode->i_mutex);
73 ret = kern_path_parent(tmp, &nd); 74 dput(dentry);
74 if (!ret) { 75 path_put(&path);
75 nd.flags |= LOOKUP_OPEN | LOOKUP_CREATE;
76 ret = spufs_create(&nd, flags, mode, neighbor);
77 path_put(&nd.path);
78 }
79 putname(tmp);
80 } 76 }
81 77
82 return ret; 78 return ret;
diff --git a/arch/powerpc/platforms/chrp/Kconfig b/arch/powerpc/platforms/chrp/Kconfig
index bc0b0efdc5f..d3cdab582c5 100644
--- a/arch/powerpc/platforms/chrp/Kconfig
+++ b/arch/powerpc/platforms/chrp/Kconfig
@@ -1,6 +1,7 @@
1config PPC_CHRP 1config PPC_CHRP
2 bool "Common Hardware Reference Platform (CHRP) based machines" 2 bool "Common Hardware Reference Platform (CHRP) based machines"
3 depends on 6xx 3 depends on 6xx
4 select HAVE_PCSPKR_PLATFORM
4 select MPIC 5 select MPIC
5 select PPC_I8259 6 select PPC_I8259
6 select PPC_INDIRECT_PCI 7 select PPC_INDIRECT_PCI
diff --git a/arch/powerpc/platforms/chrp/pci.c b/arch/powerpc/platforms/chrp/pci.c
index 8f67a394b2d..83285c5a204 100644
--- a/arch/powerpc/platforms/chrp/pci.c
+++ b/arch/powerpc/platforms/chrp/pci.c
@@ -142,7 +142,7 @@ hydra_init(void)
142 return 0; 142 return 0;
143 } 143 }
144 of_node_put(np); 144 of_node_put(np);
145 Hydra = ioremap(r.start, r.end-r.start); 145 Hydra = ioremap(r.start, resource_size(&r));
146 printk("Hydra Mac I/O at %llx\n", (unsigned long long)r.start); 146 printk("Hydra Mac I/O at %llx\n", (unsigned long long)r.start);
147 printk("Hydra Feature_Control was %x", 147 printk("Hydra Feature_Control was %x",
148 in_le32(&Hydra->Feature_Control)); 148 in_le32(&Hydra->Feature_Control));
@@ -199,7 +199,7 @@ static void __init setup_peg2(struct pci_controller *hose, struct device_node *d
199 printk ("RTAS supporting Pegasos OF not found, please upgrade" 199 printk ("RTAS supporting Pegasos OF not found, please upgrade"
200 " your firmware\n"); 200 " your firmware\n");
201 } 201 }
202 ppc_pci_add_flags(PPC_PCI_REASSIGN_ALL_BUS); 202 pci_add_flags(PCI_REASSIGN_ALL_BUS);
203 /* keep the reference to the root node */ 203 /* keep the reference to the root node */
204} 204}
205 205
diff --git a/arch/powerpc/platforms/chrp/smp.c b/arch/powerpc/platforms/chrp/smp.c
index a800122e4dd..feab30bbae2 100644
--- a/arch/powerpc/platforms/chrp/smp.c
+++ b/arch/powerpc/platforms/chrp/smp.c
@@ -18,7 +18,7 @@
18#include <linux/spinlock.h> 18#include <linux/spinlock.h>
19 19
20#include <asm/ptrace.h> 20#include <asm/ptrace.h>
21#include <asm/atomic.h> 21#include <linux/atomic.h>
22#include <asm/irq.h> 22#include <asm/irq.h>
23#include <asm/page.h> 23#include <asm/page.h>
24#include <asm/pgtable.h> 24#include <asm/pgtable.h>
diff --git a/arch/powerpc/platforms/iseries/exception.S b/arch/powerpc/platforms/iseries/exception.S
index 29c02f36b32..f519ee17ff7 100644
--- a/arch/powerpc/platforms/iseries/exception.S
+++ b/arch/powerpc/platforms/iseries/exception.S
@@ -167,7 +167,7 @@ BEGIN_FTR_SECTION
167 std r12,PACA_EXGEN+EX_R13(r13) 167 std r12,PACA_EXGEN+EX_R13(r13)
168 EXCEPTION_PROLOG_ISERIES_1 168 EXCEPTION_PROLOG_ISERIES_1
169FTR_SECTION_ELSE 169FTR_SECTION_ELSE
170 EXCEPTION_PROLOG_1(PACA_EXGEN) 170 EXCEPTION_PROLOG_1(PACA_EXGEN, NOTEST, 0)
171 EXCEPTION_PROLOG_ISERIES_1 171 EXCEPTION_PROLOG_ISERIES_1
172ALT_MMU_FTR_SECTION_END_IFCLR(MMU_FTR_SLB) 172ALT_MMU_FTR_SECTION_END_IFCLR(MMU_FTR_SLB)
173 b data_access_common 173 b data_access_common
diff --git a/arch/powerpc/platforms/iseries/exception.h b/arch/powerpc/platforms/iseries/exception.h
index bae3fba5ad8..50271b550a9 100644
--- a/arch/powerpc/platforms/iseries/exception.h
+++ b/arch/powerpc/platforms/iseries/exception.h
@@ -39,7 +39,7 @@
39label##_iSeries: \ 39label##_iSeries: \
40 HMT_MEDIUM; \ 40 HMT_MEDIUM; \
41 mtspr SPRN_SPRG_SCRATCH0,r13; /* save r13 */ \ 41 mtspr SPRN_SPRG_SCRATCH0,r13; /* save r13 */ \
42 EXCEPTION_PROLOG_1(area); \ 42 EXCEPTION_PROLOG_1(area, NOTEST, 0); \
43 EXCEPTION_PROLOG_ISERIES_1; \ 43 EXCEPTION_PROLOG_ISERIES_1; \
44 b label##_common 44 b label##_common
45 45
@@ -48,7 +48,7 @@ label##_iSeries: \
48label##_iSeries: \ 48label##_iSeries: \
49 HMT_MEDIUM; \ 49 HMT_MEDIUM; \
50 mtspr SPRN_SPRG_SCRATCH0,r13; /* save r13 */ \ 50 mtspr SPRN_SPRG_SCRATCH0,r13; /* save r13 */ \
51 EXCEPTION_PROLOG_1(PACA_EXGEN); \ 51 EXCEPTION_PROLOG_1(PACA_EXGEN, NOTEST, 0); \
52 lbz r10,PACASOFTIRQEN(r13); \ 52 lbz r10,PACASOFTIRQEN(r13); \
53 cmpwi 0,r10,0; \ 53 cmpwi 0,r10,0; \
54 beq- label##_iSeries_masked; \ 54 beq- label##_iSeries_masked; \
diff --git a/arch/powerpc/platforms/iseries/smp.c b/arch/powerpc/platforms/iseries/smp.c
index e3265adde5d..8bda9be06fa 100644
--- a/arch/powerpc/platforms/iseries/smp.c
+++ b/arch/powerpc/platforms/iseries/smp.c
@@ -29,7 +29,7 @@
29#include <linux/cpu.h> 29#include <linux/cpu.h>
30 30
31#include <asm/ptrace.h> 31#include <asm/ptrace.h>
32#include <asm/atomic.h> 32#include <linux/atomic.h>
33#include <asm/irq.h> 33#include <asm/irq.h>
34#include <asm/page.h> 34#include <asm/page.h>
35#include <asm/pgtable.h> 35#include <asm/pgtable.h>
@@ -75,7 +75,7 @@ static void __devinit smp_iSeries_setup_cpu(int nr)
75} 75}
76 76
77static struct smp_ops_t iSeries_smp_ops = { 77static struct smp_ops_t iSeries_smp_ops = {
78 .message_pass = smp_muxed_ipi_message_pass, 78 .message_pass = NULL, /* Use smp_muxed_ipi_message_pass */
79 .cause_ipi = smp_iSeries_cause_ipi, 79 .cause_ipi = smp_iSeries_cause_ipi,
80 .probe = smp_iSeries_probe, 80 .probe = smp_iSeries_probe,
81 .kick_cpu = smp_iSeries_kick_cpu, 81 .kick_cpu = smp_iSeries_kick_cpu,
diff --git a/arch/powerpc/platforms/maple/setup.c b/arch/powerpc/platforms/maple/setup.c
index fe34c3d9bb7..5b3388b9f91 100644
--- a/arch/powerpc/platforms/maple/setup.c
+++ b/arch/powerpc/platforms/maple/setup.c
@@ -338,35 +338,16 @@ define_machine(maple) {
338#ifdef CONFIG_EDAC 338#ifdef CONFIG_EDAC
339/* 339/*
340 * Register a platform device for CPC925 memory controller on 340 * Register a platform device for CPC925 memory controller on
341 * Motorola ATCA-6101 blade. 341 * all boards with U3H (CPC925) bridge.
342 */ 342 */
343#define MAPLE_CPC925_MODEL "Motorola,ATCA-6101"
344static int __init maple_cpc925_edac_setup(void) 343static int __init maple_cpc925_edac_setup(void)
345{ 344{
346 struct platform_device *pdev; 345 struct platform_device *pdev;
347 struct device_node *np = NULL; 346 struct device_node *np = NULL;
348 struct resource r; 347 struct resource r;
349 const unsigned char *model;
350 int ret; 348 int ret;
351 349 volatile void __iomem *mem;
352 np = of_find_node_by_path("/"); 350 u32 rev;
353 if (!np) {
354 printk(KERN_ERR "%s: Unable to get root node\n", __func__);
355 return -ENODEV;
356 }
357
358 model = (const unsigned char *)of_get_property(np, "model", NULL);
359 if (!model) {
360 printk(KERN_ERR "%s: Unabel to get model info\n", __func__);
361 of_node_put(np);
362 return -ENODEV;
363 }
364
365 ret = strcmp(model, MAPLE_CPC925_MODEL);
366 of_node_put(np);
367
368 if (ret != 0)
369 return 0;
370 351
371 np = of_find_node_by_type(NULL, "memory-controller"); 352 np = of_find_node_by_type(NULL, "memory-controller");
372 if (!np) { 353 if (!np) {
@@ -384,6 +365,22 @@ static int __init maple_cpc925_edac_setup(void)
384 return -ENODEV; 365 return -ENODEV;
385 } 366 }
386 367
368 mem = ioremap(r.start, resource_size(&r));
369 if (!mem) {
370 printk(KERN_ERR "%s: Unable to map memory-controller memory\n",
371 __func__);
372 return -ENOMEM;
373 }
374
375 rev = __raw_readl(mem);
376 iounmap(mem);
377
378 if (rev < 0x34 || rev > 0x3f) { /* U3H */
379 printk(KERN_ERR "%s: Non-CPC925(U3H) bridge revision: %02x\n",
380 __func__, rev);
381 return 0;
382 }
383
387 pdev = platform_device_register_simple("cpc925_edac", 0, &r, 1); 384 pdev = platform_device_register_simple("cpc925_edac", 0, &r, 1);
388 if (IS_ERR(pdev)) 385 if (IS_ERR(pdev))
389 return PTR_ERR(pdev); 386 return PTR_ERR(pdev);
diff --git a/arch/powerpc/platforms/pasemi/dma_lib.c b/arch/powerpc/platforms/pasemi/dma_lib.c
index 321a9b3a2d0..756123bf06a 100644
--- a/arch/powerpc/platforms/pasemi/dma_lib.c
+++ b/arch/powerpc/platforms/pasemi/dma_lib.c
@@ -576,7 +576,7 @@ int pasemi_dma_init(void)
576 res.start = 0xfd800000; 576 res.start = 0xfd800000;
577 res.end = res.start + 0x1000; 577 res.end = res.start + 0x1000;
578 } 578 }
579 dma_status = __ioremap(res.start, res.end-res.start, 0); 579 dma_status = __ioremap(res.start, resource_size(&res), 0);
580 pci_dev_put(iob_pdev); 580 pci_dev_put(iob_pdev);
581 581
582 for (i = 0; i < MAX_TXCH; i++) 582 for (i = 0; i < MAX_TXCH; i++)
diff --git a/arch/powerpc/platforms/powermac/backlight.c b/arch/powerpc/platforms/powermac/backlight.c
index d679964ae2a..c2f3e861f5e 100644
--- a/arch/powerpc/platforms/powermac/backlight.c
+++ b/arch/powerpc/platforms/powermac/backlight.c
@@ -12,7 +12,7 @@
12#include <linux/backlight.h> 12#include <linux/backlight.h>
13#include <linux/adb.h> 13#include <linux/adb.h>
14#include <linux/pmu.h> 14#include <linux/pmu.h>
15#include <asm/atomic.h> 15#include <linux/atomic.h>
16#include <asm/prom.h> 16#include <asm/prom.h>
17#include <asm/backlight.h> 17#include <asm/backlight.h>
18 18
diff --git a/arch/powerpc/platforms/powermac/nvram.c b/arch/powerpc/platforms/powermac/nvram.c
index b1cdcf94aa8..695443bfdb0 100644
--- a/arch/powerpc/platforms/powermac/nvram.c
+++ b/arch/powerpc/platforms/powermac/nvram.c
@@ -580,10 +580,10 @@ int __init pmac_nvram_init(void)
580 /* Try to obtain an address */ 580 /* Try to obtain an address */
581 if (of_address_to_resource(dp, 0, &r1) == 0) { 581 if (of_address_to_resource(dp, 0, &r1) == 0) {
582 nvram_naddrs = 1; 582 nvram_naddrs = 1;
583 s1 = (r1.end - r1.start) + 1; 583 s1 = resource_size(&r1);
584 if (of_address_to_resource(dp, 1, &r2) == 0) { 584 if (of_address_to_resource(dp, 1, &r2) == 0) {
585 nvram_naddrs = 2; 585 nvram_naddrs = 2;
586 s2 = (r2.end - r2.start) + 1; 586 s2 = resource_size(&r2);
587 } 587 }
588 } 588 }
589 589
diff --git a/arch/powerpc/platforms/powermac/pci.c b/arch/powerpc/platforms/powermac/pci.c
index f33e08d573c..31a7d3a7ce2 100644
--- a/arch/powerpc/platforms/powermac/pci.c
+++ b/arch/powerpc/platforms/powermac/pci.c
@@ -17,6 +17,7 @@
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/bootmem.h> 18#include <linux/bootmem.h>
19#include <linux/irq.h> 19#include <linux/irq.h>
20#include <linux/of_pci.h>
20 21
21#include <asm/sections.h> 22#include <asm/sections.h>
22#include <asm/io.h> 23#include <asm/io.h>
@@ -235,7 +236,7 @@ static int chaos_validate_dev(struct pci_bus *bus, int devfn, int offset)
235 236
236 if (offset >= 0x100) 237 if (offset >= 0x100)
237 return PCIBIOS_BAD_REGISTER_NUMBER; 238 return PCIBIOS_BAD_REGISTER_NUMBER;
238 np = pci_busdev_to_OF_node(bus, devfn); 239 np = of_pci_find_child_device(bus->dev.of_node, devfn);
239 if (np == NULL) 240 if (np == NULL)
240 return PCIBIOS_DEVICE_NOT_FOUND; 241 return PCIBIOS_DEVICE_NOT_FOUND;
241 242
@@ -560,6 +561,20 @@ static struct pci_ops u4_pcie_pci_ops =
560 .write = u4_pcie_write_config, 561 .write = u4_pcie_write_config,
561}; 562};
562 563
564static void __devinit pmac_pci_fixup_u4_of_node(struct pci_dev *dev)
565{
566 /* Apple's device-tree "hides" the root complex virtual P2P bridge
567 * on U4. However, Linux sees it, causing the PCI <-> OF matching
568 * code to fail to properly match devices below it. This works around
569 * it by setting the node of the bridge to point to the PHB node,
570 * which is not entirely correct but fixes the matching code and
571 * doesn't break anything else. It's also the simplest possible fix.
572 */
573 if (dev->dev.of_node == NULL)
574 dev->dev.of_node = pcibios_get_phb_of_node(dev->bus);
575}
576DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_APPLE, 0x5b, pmac_pci_fixup_u4_of_node);
577
563#endif /* CONFIG_PPC64 */ 578#endif /* CONFIG_PPC64 */
564 579
565#ifdef CONFIG_PPC32 580#ifdef CONFIG_PPC32
@@ -731,7 +746,7 @@ static void __init setup_bandit(struct pci_controller *hose,
731static int __init setup_uninorth(struct pci_controller *hose, 746static int __init setup_uninorth(struct pci_controller *hose,
732 struct resource *addr) 747 struct resource *addr)
733{ 748{
734 ppc_pci_add_flags(PPC_PCI_REASSIGN_ALL_BUS); 749 pci_add_flags(PCI_REASSIGN_ALL_BUS);
735 has_uninorth = 1; 750 has_uninorth = 1;
736 hose->ops = &macrisc_pci_ops; 751 hose->ops = &macrisc_pci_ops;
737 hose->cfg_addr = ioremap(addr->start + 0x800000, 0x1000); 752 hose->cfg_addr = ioremap(addr->start + 0x800000, 0x1000);
@@ -838,8 +853,7 @@ static void __init setup_u3_ht(struct pci_controller* hose)
838 * into cfg_addr 853 * into cfg_addr
839 */ 854 */
840 hose->cfg_data = ioremap(cfg_res.start, 0x02000000); 855 hose->cfg_data = ioremap(cfg_res.start, 0x02000000);
841 hose->cfg_addr = ioremap(self_res.start, 856 hose->cfg_addr = ioremap(self_res.start, resource_size(&self_res));
842 self_res.end - self_res.start + 1);
843 857
844 /* 858 /*
845 * /ht node doesn't expose a "ranges" property, we read the register 859 * /ht node doesn't expose a "ranges" property, we read the register
@@ -998,7 +1012,7 @@ void __init pmac_pci_init(void)
998 struct device_node *np, *root; 1012 struct device_node *np, *root;
999 struct device_node *ht = NULL; 1013 struct device_node *ht = NULL;
1000 1014
1001 ppc_pci_set_flags(PPC_PCI_CAN_SKIP_ISA_ALIGN); 1015 pci_set_flags(PCI_CAN_SKIP_ISA_ALIGN);
1002 1016
1003 root = of_find_node_by_path("/"); 1017 root = of_find_node_by_path("/");
1004 if (root == NULL) { 1018 if (root == NULL) {
@@ -1057,7 +1071,7 @@ void __init pmac_pci_init(void)
1057 * some offset between bus number and domains for now when we 1071 * some offset between bus number and domains for now when we
1058 * assign all busses should help for now 1072 * assign all busses should help for now
1059 */ 1073 */
1060 if (ppc_pci_has_flag(PPC_PCI_REASSIGN_ALL_BUS)) 1074 if (pci_has_flag(PCI_REASSIGN_ALL_BUS))
1061 pcibios_assign_bus_offset = 0x10; 1075 pcibios_assign_bus_offset = 0x10;
1062#endif 1076#endif
1063} 1077}
@@ -1323,8 +1337,7 @@ static void fixup_u4_pcie(struct pci_dev* dev)
1323 */ 1337 */
1324 if (r->start >= 0xf0000000 && r->start < 0xf3000000) 1338 if (r->start >= 0xf0000000 && r->start < 0xf3000000)
1325 continue; 1339 continue;
1326 if (!region || (r->end - r->start) > 1340 if (!region || resource_size(r) > resource_size(region))
1327 (region->end - region->start))
1328 region = r; 1341 region = r;
1329 } 1342 }
1330 /* Nothing found, bail */ 1343 /* Nothing found, bail */
diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c
index aa45281bd29..a028f08309d 100644
--- a/arch/powerpc/platforms/powermac/setup.c
+++ b/arch/powerpc/platforms/powermac/setup.c
@@ -355,9 +355,6 @@ static int initializing = 1;
355static int pmac_late_init(void) 355static int pmac_late_init(void)
356{ 356{
357 initializing = 0; 357 initializing = 0;
358 /* this is udbg (which is __init) and we can later use it during
359 * cpu hotplug (in smp_core99_kick_cpu) */
360 ppc_md.progress = NULL;
361 return 0; 358 return 0;
362} 359}
363machine_late_initcall(powermac, pmac_late_init); 360machine_late_initcall(powermac, pmac_late_init);
diff --git a/arch/powerpc/platforms/powermac/smp.c b/arch/powerpc/platforms/powermac/smp.c
index db092d7c4c5..9a521dc8e48 100644
--- a/arch/powerpc/platforms/powermac/smp.c
+++ b/arch/powerpc/platforms/powermac/smp.c
@@ -35,7 +35,7 @@
35#include <linux/compiler.h> 35#include <linux/compiler.h>
36 36
37#include <asm/ptrace.h> 37#include <asm/ptrace.h>
38#include <asm/atomic.h> 38#include <linux/atomic.h>
39#include <asm/code-patching.h> 39#include <asm/code-patching.h>
40#include <asm/irq.h> 40#include <asm/irq.h>
41#include <asm/page.h> 41#include <asm/page.h>
@@ -447,7 +447,7 @@ void __init smp_psurge_give_timebase(void)
447 447
448/* PowerSurge-style Macs */ 448/* PowerSurge-style Macs */
449struct smp_ops_t psurge_smp_ops = { 449struct smp_ops_t psurge_smp_ops = {
450 .message_pass = smp_muxed_ipi_message_pass, 450 .message_pass = NULL, /* Use smp_muxed_ipi_message_pass */
451 .cause_ipi = smp_psurge_cause_ipi, 451 .cause_ipi = smp_psurge_cause_ipi,
452 .probe = smp_psurge_probe, 452 .probe = smp_psurge_probe,
453 .kick_cpu = smp_psurge_kick_cpu, 453 .kick_cpu = smp_psurge_kick_cpu,
diff --git a/arch/powerpc/platforms/powermac/time.c b/arch/powerpc/platforms/powermac/time.c
index 48211ca134c..11c9fce43b5 100644
--- a/arch/powerpc/platforms/powermac/time.c
+++ b/arch/powerpc/platforms/powermac/time.c
@@ -274,7 +274,7 @@ int __init via_calibrate_decr(void)
274 return 0; 274 return 0;
275 } 275 }
276 of_node_put(vias); 276 of_node_put(vias);
277 via = ioremap(rsrc.start, rsrc.end - rsrc.start + 1); 277 via = ioremap(rsrc.start, resource_size(&rsrc));
278 if (via == NULL) { 278 if (via == NULL) {
279 printk(KERN_ERR "Failed to map VIA for timer calibration !\n"); 279 printk(KERN_ERR "Failed to map VIA for timer calibration !\n");
280 return 0; 280 return 0;
diff --git a/arch/powerpc/platforms/prep/Kconfig b/arch/powerpc/platforms/prep/Kconfig
index bf8330ef2e7..f0536c7cda9 100644
--- a/arch/powerpc/platforms/prep/Kconfig
+++ b/arch/powerpc/platforms/prep/Kconfig
@@ -1,6 +1,7 @@
1config PPC_PREP 1config PPC_PREP
2 bool "PowerPC Reference Platform (PReP) based machines" 2 bool "PowerPC Reference Platform (PReP) based machines"
3 depends on 6xx && BROKEN 3 depends on 6xx && BROKEN
4 select HAVE_PCSPKR_PLATFORM
4 select MPIC 5 select MPIC
5 select PPC_I8259 6 select PPC_I8259
6 select PPC_INDIRECT_PCI 7 select PPC_INDIRECT_PCI
diff --git a/arch/powerpc/platforms/ps3/interrupt.c b/arch/powerpc/platforms/ps3/interrupt.c
index 600ed2c0ed5..1aa478b97aa 100644
--- a/arch/powerpc/platforms/ps3/interrupt.c
+++ b/arch/powerpc/platforms/ps3/interrupt.c
@@ -88,6 +88,7 @@ struct ps3_private {
88 struct ps3_bmp bmp __attribute__ ((aligned (PS3_BMP_MINALIGN))); 88 struct ps3_bmp bmp __attribute__ ((aligned (PS3_BMP_MINALIGN)));
89 u64 ppe_id; 89 u64 ppe_id;
90 u64 thread_id; 90 u64 thread_id;
91 unsigned long ipi_mask;
91}; 92};
92 93
93static DEFINE_PER_CPU(struct ps3_private, ps3_private); 94static DEFINE_PER_CPU(struct ps3_private, ps3_private);
@@ -144,7 +145,11 @@ static void ps3_chip_unmask(struct irq_data *d)
144static void ps3_chip_eoi(struct irq_data *d) 145static void ps3_chip_eoi(struct irq_data *d)
145{ 146{
146 const struct ps3_private *pd = irq_data_get_irq_chip_data(d); 147 const struct ps3_private *pd = irq_data_get_irq_chip_data(d);
147 lv1_end_of_interrupt_ext(pd->ppe_id, pd->thread_id, d->irq); 148
149 /* non-IPIs are EOIed here. */
150
151 if (!test_bit(63 - d->irq, &pd->ipi_mask))
152 lv1_end_of_interrupt_ext(pd->ppe_id, pd->thread_id, d->irq);
148} 153}
149 154
150/** 155/**
@@ -691,6 +696,16 @@ void __init ps3_register_ipi_debug_brk(unsigned int cpu, unsigned int virq)
691 cpu, virq, pd->bmp.ipi_debug_brk_mask); 696 cpu, virq, pd->bmp.ipi_debug_brk_mask);
692} 697}
693 698
699void __init ps3_register_ipi_irq(unsigned int cpu, unsigned int virq)
700{
701 struct ps3_private *pd = &per_cpu(ps3_private, cpu);
702
703 set_bit(63 - virq, &pd->ipi_mask);
704
705 DBG("%s:%d: cpu %u, virq %u, ipi_mask %lxh\n", __func__, __LINE__,
706 cpu, virq, pd->ipi_mask);
707}
708
694static unsigned int ps3_get_irq(void) 709static unsigned int ps3_get_irq(void)
695{ 710{
696 struct ps3_private *pd = &__get_cpu_var(ps3_private); 711 struct ps3_private *pd = &__get_cpu_var(ps3_private);
@@ -720,6 +735,12 @@ static unsigned int ps3_get_irq(void)
720 BUG(); 735 BUG();
721 } 736 }
722#endif 737#endif
738
739 /* IPIs are EOIed here. */
740
741 if (test_bit(63 - plug, &pd->ipi_mask))
742 lv1_end_of_interrupt_ext(pd->ppe_id, pd->thread_id, plug);
743
723 return plug; 744 return plug;
724} 745}
725 746
diff --git a/arch/powerpc/platforms/ps3/platform.h b/arch/powerpc/platforms/ps3/platform.h
index 9a196a88eda..1a633ed0fe9 100644
--- a/arch/powerpc/platforms/ps3/platform.h
+++ b/arch/powerpc/platforms/ps3/platform.h
@@ -43,6 +43,7 @@ void ps3_mm_shutdown(void);
43void ps3_init_IRQ(void); 43void ps3_init_IRQ(void);
44void ps3_shutdown_IRQ(int cpu); 44void ps3_shutdown_IRQ(int cpu);
45void __init ps3_register_ipi_debug_brk(unsigned int cpu, unsigned int virq); 45void __init ps3_register_ipi_debug_brk(unsigned int cpu, unsigned int virq);
46void __init ps3_register_ipi_irq(unsigned int cpu, unsigned int virq);
46 47
47/* smp */ 48/* smp */
48 49
diff --git a/arch/powerpc/platforms/ps3/smp.c b/arch/powerpc/platforms/ps3/smp.c
index 4c44794faac..f609345b6c3 100644
--- a/arch/powerpc/platforms/ps3/smp.c
+++ b/arch/powerpc/platforms/ps3/smp.c
@@ -94,6 +94,8 @@ static void __init ps3_smp_setup_cpu(int cpu)
94 94
95 if (result) 95 if (result)
96 virqs[i] = NO_IRQ; 96 virqs[i] = NO_IRQ;
97 else
98 ps3_register_ipi_irq(cpu, virqs[i]);
97 } 99 }
98 100
99 ps3_register_ipi_debug_brk(cpu, virqs[PPC_MSG_DEBUGGER_BREAK]); 101 ps3_register_ipi_debug_brk(cpu, virqs[PPC_MSG_DEBUGGER_BREAK]);
diff --git a/arch/powerpc/platforms/pseries/Kconfig b/arch/powerpc/platforms/pseries/Kconfig
index 71af4c5d6c0..05cf4769b88 100644
--- a/arch/powerpc/platforms/pseries/Kconfig
+++ b/arch/powerpc/platforms/pseries/Kconfig
@@ -1,6 +1,7 @@
1config PPC_PSERIES 1config PPC_PSERIES
2 depends on PPC64 && PPC_BOOK3S 2 depends on PPC64 && PPC_BOOK3S
3 bool "IBM pSeries & new (POWER5-based) iSeries" 3 bool "IBM pSeries & new (POWER5-based) iSeries"
4 select HAVE_PCSPKR_PLATFORM
4 select MPIC 5 select MPIC
5 select PCI_MSI 6 select PCI_MSI
6 select PPC_XICS 7 select PPC_XICS
diff --git a/arch/powerpc/platforms/pseries/dlpar.c b/arch/powerpc/platforms/pseries/dlpar.c
index 57ceb92b228..0f1b706506e 100644
--- a/arch/powerpc/platforms/pseries/dlpar.c
+++ b/arch/powerpc/platforms/pseries/dlpar.c
@@ -112,6 +112,7 @@ void dlpar_free_cc_nodes(struct device_node *dn)
112 dlpar_free_one_cc_node(dn); 112 dlpar_free_one_cc_node(dn);
113} 113}
114 114
115#define COMPLETE 0
115#define NEXT_SIBLING 1 116#define NEXT_SIBLING 1
116#define NEXT_CHILD 2 117#define NEXT_CHILD 2
117#define NEXT_PROPERTY 3 118#define NEXT_PROPERTY 3
@@ -158,6 +159,9 @@ struct device_node *dlpar_configure_connector(u32 drc_index)
158 spin_unlock(&rtas_data_buf_lock); 159 spin_unlock(&rtas_data_buf_lock);
159 160
160 switch (rc) { 161 switch (rc) {
162 case COMPLETE:
163 break;
164
161 case NEXT_SIBLING: 165 case NEXT_SIBLING:
162 dn = dlpar_parse_cc_node(ccwa); 166 dn = dlpar_parse_cc_node(ccwa);
163 if (!dn) 167 if (!dn)
@@ -262,12 +266,11 @@ int dlpar_attach_node(struct device_node *dn)
262 if (!dn->parent) 266 if (!dn->parent)
263 return -ENOMEM; 267 return -ENOMEM;
264 268
265 rc = blocking_notifier_call_chain(&pSeries_reconfig_chain, 269 rc = pSeries_reconfig_notify(PSERIES_RECONFIG_ADD, dn);
266 PSERIES_RECONFIG_ADD, dn); 270 if (rc) {
267 if (rc == NOTIFY_BAD) {
268 printk(KERN_ERR "Failed to add device node %s\n", 271 printk(KERN_ERR "Failed to add device node %s\n",
269 dn->full_name); 272 dn->full_name);
270 return -ENOMEM; /* For now, safe to assume kmalloc failure */ 273 return rc;
271 } 274 }
272 275
273 of_attach_node(dn); 276 of_attach_node(dn);
@@ -297,8 +300,7 @@ int dlpar_detach_node(struct device_node *dn)
297 remove_proc_entry(dn->pde->name, parent->pde); 300 remove_proc_entry(dn->pde->name, parent->pde);
298#endif 301#endif
299 302
300 blocking_notifier_call_chain(&pSeries_reconfig_chain, 303 pSeries_reconfig_notify(PSERIES_RECONFIG_REMOVE, dn);
301 PSERIES_RECONFIG_REMOVE, dn);
302 of_detach_node(dn); 304 of_detach_node(dn);
303 of_node_put(dn); /* Must decrement the refcount */ 305 of_node_put(dn); /* Must decrement the refcount */
304 306
diff --git a/arch/powerpc/platforms/pseries/dtl.c b/arch/powerpc/platforms/pseries/dtl.c
index e9190073bb9..0e865637006 100644
--- a/arch/powerpc/platforms/pseries/dtl.c
+++ b/arch/powerpc/platforms/pseries/dtl.c
@@ -181,7 +181,7 @@ static void dtl_stop(struct dtl *dtl)
181 181
182 lppaca_of(dtl->cpu).dtl_enable_mask = 0x0; 182 lppaca_of(dtl->cpu).dtl_enable_mask = 0x0;
183 183
184 unregister_dtl(hwcpu, __pa(dtl->buf)); 184 unregister_dtl(hwcpu);
185} 185}
186 186
187static u64 dtl_current_index(struct dtl *dtl) 187static u64 dtl_current_index(struct dtl *dtl)
diff --git a/arch/powerpc/platforms/pseries/eeh.c b/arch/powerpc/platforms/pseries/eeh.c
index 46b55cf563e..d42f37d8a44 100644
--- a/arch/powerpc/platforms/pseries/eeh.c
+++ b/arch/powerpc/platforms/pseries/eeh.c
@@ -31,7 +31,7 @@
31#include <linux/spinlock.h> 31#include <linux/spinlock.h>
32#include <linux/of.h> 32#include <linux/of.h>
33 33
34#include <asm/atomic.h> 34#include <linux/atomic.h>
35#include <asm/eeh.h> 35#include <asm/eeh.h>
36#include <asm/eeh_event.h> 36#include <asm/eeh_event.h>
37#include <asm/io.h> 37#include <asm/io.h>
@@ -1338,7 +1338,7 @@ static const struct file_operations proc_eeh_operations = {
1338static int __init eeh_init_proc(void) 1338static int __init eeh_init_proc(void)
1339{ 1339{
1340 if (machine_is(pseries)) 1340 if (machine_is(pseries))
1341 proc_create("ppc64/eeh", 0, NULL, &proc_eeh_operations); 1341 proc_create("powerpc/eeh", 0, NULL, &proc_eeh_operations);
1342 return 0; 1342 return 0;
1343} 1343}
1344__initcall(eeh_init_proc); 1344__initcall(eeh_init_proc);
diff --git a/arch/powerpc/platforms/pseries/eeh_cache.c b/arch/powerpc/platforms/pseries/eeh_cache.c
index 8ed0d2d0e1b..fc5ae767989 100644
--- a/arch/powerpc/platforms/pseries/eeh_cache.c
+++ b/arch/powerpc/platforms/pseries/eeh_cache.c
@@ -25,7 +25,7 @@
25#include <linux/rbtree.h> 25#include <linux/rbtree.h>
26#include <linux/slab.h> 26#include <linux/slab.h>
27#include <linux/spinlock.h> 27#include <linux/spinlock.h>
28#include <asm/atomic.h> 28#include <linux/atomic.h>
29#include <asm/pci-bridge.h> 29#include <asm/pci-bridge.h>
30#include <asm/ppc-pci.h> 30#include <asm/ppc-pci.h>
31 31
diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c
index 46f13a3c5d0..83a3ca2fd28 100644
--- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
+++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
@@ -135,7 +135,7 @@ static void pseries_mach_cpu_die(void)
135 get_lppaca()->idle = 0; 135 get_lppaca()->idle = 0;
136 136
137 if (get_preferred_offline_state(cpu) == CPU_STATE_ONLINE) { 137 if (get_preferred_offline_state(cpu) == CPU_STATE_ONLINE) {
138 unregister_slb_shadow(hwcpu, __pa(get_slb_shadow())); 138 unregister_slb_shadow(hwcpu);
139 139
140 /* 140 /*
141 * Call to start_secondary_resume() will not return. 141 * Call to start_secondary_resume() will not return.
@@ -150,7 +150,7 @@ static void pseries_mach_cpu_die(void)
150 WARN_ON(get_preferred_offline_state(cpu) != CPU_STATE_OFFLINE); 150 WARN_ON(get_preferred_offline_state(cpu) != CPU_STATE_OFFLINE);
151 151
152 set_cpu_current_state(cpu, CPU_STATE_OFFLINE); 152 set_cpu_current_state(cpu, CPU_STATE_OFFLINE);
153 unregister_slb_shadow(hwcpu, __pa(get_slb_shadow())); 153 unregister_slb_shadow(hwcpu);
154 rtas_stop_self(); 154 rtas_stop_self();
155 155
156 /* Should never get here... */ 156 /* Should never get here... */
@@ -330,21 +330,17 @@ static void pseries_remove_processor(struct device_node *np)
330static int pseries_smp_notifier(struct notifier_block *nb, 330static int pseries_smp_notifier(struct notifier_block *nb,
331 unsigned long action, void *node) 331 unsigned long action, void *node)
332{ 332{
333 int err = NOTIFY_OK; 333 int err = 0;
334 334
335 switch (action) { 335 switch (action) {
336 case PSERIES_RECONFIG_ADD: 336 case PSERIES_RECONFIG_ADD:
337 if (pseries_add_processor(node)) 337 err = pseries_add_processor(node);
338 err = NOTIFY_BAD;
339 break; 338 break;
340 case PSERIES_RECONFIG_REMOVE: 339 case PSERIES_RECONFIG_REMOVE:
341 pseries_remove_processor(node); 340 pseries_remove_processor(node);
342 break; 341 break;
343 default:
344 err = NOTIFY_DONE;
345 break;
346 } 342 }
347 return err; 343 return notifier_from_errno(err);
348} 344}
349 345
350static struct notifier_block pseries_smp_nb = { 346static struct notifier_block pseries_smp_nb = {
diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c
index 9d6a8effeda..11d8e0544ac 100644
--- a/arch/powerpc/platforms/pseries/hotplug-memory.c
+++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
@@ -205,27 +205,21 @@ static int pseries_drconf_memory(unsigned long *base, unsigned int action)
205static int pseries_memory_notifier(struct notifier_block *nb, 205static int pseries_memory_notifier(struct notifier_block *nb,
206 unsigned long action, void *node) 206 unsigned long action, void *node)
207{ 207{
208 int err = NOTIFY_OK; 208 int err = 0;
209 209
210 switch (action) { 210 switch (action) {
211 case PSERIES_RECONFIG_ADD: 211 case PSERIES_RECONFIG_ADD:
212 if (pseries_add_memory(node)) 212 err = pseries_add_memory(node);
213 err = NOTIFY_BAD;
214 break; 213 break;
215 case PSERIES_RECONFIG_REMOVE: 214 case PSERIES_RECONFIG_REMOVE:
216 if (pseries_remove_memory(node)) 215 err = pseries_remove_memory(node);
217 err = NOTIFY_BAD;
218 break; 216 break;
219 case PSERIES_DRCONF_MEM_ADD: 217 case PSERIES_DRCONF_MEM_ADD:
220 case PSERIES_DRCONF_MEM_REMOVE: 218 case PSERIES_DRCONF_MEM_REMOVE:
221 if (pseries_drconf_memory(node, action)) 219 err = pseries_drconf_memory(node, action);
222 err = NOTIFY_BAD;
223 break;
224 default:
225 err = NOTIFY_DONE;
226 break; 220 break;
227 } 221 }
228 return err; 222 return notifier_from_errno(err);
229} 223}
230 224
231static struct notifier_block pseries_mem_nb = { 225static struct notifier_block pseries_mem_nb = {
diff --git a/arch/powerpc/platforms/pseries/hvCall_inst.c b/arch/powerpc/platforms/pseries/hvCall_inst.c
index f106662f438..c9311cfdfca 100644
--- a/arch/powerpc/platforms/pseries/hvCall_inst.c
+++ b/arch/powerpc/platforms/pseries/hvCall_inst.c
@@ -109,7 +109,7 @@ static void probe_hcall_entry(void *ignored, unsigned long opcode, unsigned long
109 if (opcode > MAX_HCALL_OPCODE) 109 if (opcode > MAX_HCALL_OPCODE)
110 return; 110 return;
111 111
112 h = &get_cpu_var(hcall_stats)[opcode / 4]; 112 h = &__get_cpu_var(hcall_stats)[opcode / 4];
113 h->tb_start = mftb(); 113 h->tb_start = mftb();
114 h->purr_start = mfspr(SPRN_PURR); 114 h->purr_start = mfspr(SPRN_PURR);
115} 115}
@@ -126,8 +126,6 @@ static void probe_hcall_exit(void *ignored, unsigned long opcode, unsigned long
126 h->num_calls++; 126 h->num_calls++;
127 h->tb_total += mftb() - h->tb_start; 127 h->tb_total += mftb() - h->tb_start;
128 h->purr_total += mfspr(SPRN_PURR) - h->purr_start; 128 h->purr_total += mfspr(SPRN_PURR) - h->purr_start;
129
130 put_cpu_var(hcall_stats);
131} 129}
132 130
133static int __init hcall_inst_init(void) 131static int __init hcall_inst_init(void)
diff --git a/arch/powerpc/platforms/pseries/hvconsole.c b/arch/powerpc/platforms/pseries/hvconsole.c
index 3f6a89b0981..041e87ca189 100644
--- a/arch/powerpc/platforms/pseries/hvconsole.c
+++ b/arch/powerpc/platforms/pseries/hvconsole.c
@@ -73,7 +73,7 @@ int hvc_put_chars(uint32_t vtermno, const char *buf, int count)
73 if (ret == H_SUCCESS) 73 if (ret == H_SUCCESS)
74 return count; 74 return count;
75 if (ret == H_BUSY) 75 if (ret == H_BUSY)
76 return 0; 76 return -EAGAIN;
77 return -EIO; 77 return -EIO;
78} 78}
79 79
diff --git a/arch/powerpc/platforms/pseries/io_event_irq.c b/arch/powerpc/platforms/pseries/io_event_irq.c
index c829e6067d5..2c4dd1fb833 100644
--- a/arch/powerpc/platforms/pseries/io_event_irq.c
+++ b/arch/powerpc/platforms/pseries/io_event_irq.c
@@ -212,17 +212,15 @@ static int __init ioei_init(void)
212 struct device_node *np; 212 struct device_node *np;
213 213
214 ioei_check_exception_token = rtas_token("check-exception"); 214 ioei_check_exception_token = rtas_token("check-exception");
215 if (ioei_check_exception_token == RTAS_UNKNOWN_SERVICE) { 215 if (ioei_check_exception_token == RTAS_UNKNOWN_SERVICE)
216 pr_warning("IO Event IRQ not supported on this system !\n");
217 return -ENODEV; 216 return -ENODEV;
218 } 217
219 np = of_find_node_by_path("/event-sources/ibm,io-events"); 218 np = of_find_node_by_path("/event-sources/ibm,io-events");
220 if (np) { 219 if (np) {
221 request_event_sources_irqs(np, ioei_interrupt, "IO_EVENT"); 220 request_event_sources_irqs(np, ioei_interrupt, "IO_EVENT");
221 pr_info("IBM I/O event interrupts enabled\n");
222 of_node_put(np); 222 of_node_put(np);
223 } else { 223 } else {
224 pr_err("io_event_irq: No ibm,io-events on system! "
225 "IO Event interrupt disabled.\n");
226 return -ENODEV; 224 return -ENODEV;
227 } 225 }
228 return 0; 226 return 0;
diff --git a/arch/powerpc/platforms/pseries/kexec.c b/arch/powerpc/platforms/pseries/kexec.c
index 54cf3a4aa16..7d94bdc63d5 100644
--- a/arch/powerpc/platforms/pseries/kexec.c
+++ b/arch/powerpc/platforms/pseries/kexec.c
@@ -25,20 +25,30 @@ static void pseries_kexec_cpu_down(int crash_shutdown, int secondary)
25{ 25{
26 /* Don't risk a hypervisor call if we're crashing */ 26 /* Don't risk a hypervisor call if we're crashing */
27 if (firmware_has_feature(FW_FEATURE_SPLPAR) && !crash_shutdown) { 27 if (firmware_has_feature(FW_FEATURE_SPLPAR) && !crash_shutdown) {
28 unsigned long addr; 28 int ret;
29 int cpu = smp_processor_id();
30 int hwcpu = hard_smp_processor_id();
29 31
30 addr = __pa(get_slb_shadow()); 32 if (get_lppaca()->dtl_enable_mask) {
31 if (unregister_slb_shadow(hard_smp_processor_id(), addr)) 33 ret = unregister_dtl(hwcpu);
32 printk("SLB shadow buffer deregistration of " 34 if (ret) {
33 "cpu %u (hw_cpu_id %d) failed\n", 35 pr_err("WARNING: DTL deregistration for cpu "
34 smp_processor_id(), 36 "%d (hw %d) failed with %d\n",
35 hard_smp_processor_id()); 37 cpu, hwcpu, ret);
38 }
39 }
40
41 ret = unregister_slb_shadow(hwcpu);
42 if (ret) {
43 pr_err("WARNING: SLB shadow buffer deregistration "
44 "for cpu %d (hw %d) failed with %d\n",
45 cpu, hwcpu, ret);
46 }
36 47
37 addr = __pa(get_lppaca()); 48 ret = unregister_vpa(hwcpu);
38 if (unregister_vpa(hard_smp_processor_id(), addr)) { 49 if (ret) {
39 printk("VPA deregistration of cpu %u (hw_cpu_id %d) " 50 pr_err("WARNING: VPA deregistration for cpu %d "
40 "failed\n", smp_processor_id(), 51 "(hw %d) failed with %d\n", cpu, hwcpu, ret);
41 hard_smp_processor_id());
42 } 52 }
43 } 53 }
44} 54}
diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
index 39e6e0a7b2f..2178cc4cdaa 100644
--- a/arch/powerpc/platforms/pseries/lpar.c
+++ b/arch/powerpc/platforms/pseries/lpar.c
@@ -52,197 +52,6 @@ EXPORT_SYMBOL(plpar_hcall_norets);
52 52
53extern void pSeries_find_serial_port(void); 53extern void pSeries_find_serial_port(void);
54 54
55
56static int vtermno; /* virtual terminal# for udbg */
57
58#define __ALIGNED__ __attribute__((__aligned__(sizeof(long))))
59static void udbg_hvsi_putc(char c)
60{
61 /* packet's seqno isn't used anyways */
62 uint8_t packet[] __ALIGNED__ = { 0xff, 5, 0, 0, c };
63 int rc;
64
65 if (c == '\n')
66 udbg_hvsi_putc('\r');
67
68 do {
69 rc = plpar_put_term_char(vtermno, sizeof(packet), packet);
70 } while (rc == H_BUSY);
71}
72
73static long hvsi_udbg_buf_len;
74static uint8_t hvsi_udbg_buf[256];
75
76static int udbg_hvsi_getc_poll(void)
77{
78 unsigned char ch;
79 int rc, i;
80
81 if (hvsi_udbg_buf_len == 0) {
82 rc = plpar_get_term_char(vtermno, &hvsi_udbg_buf_len, hvsi_udbg_buf);
83 if (rc != H_SUCCESS || hvsi_udbg_buf[0] != 0xff) {
84 /* bad read or non-data packet */
85 hvsi_udbg_buf_len = 0;
86 } else {
87 /* remove the packet header */
88 for (i = 4; i < hvsi_udbg_buf_len; i++)
89 hvsi_udbg_buf[i-4] = hvsi_udbg_buf[i];
90 hvsi_udbg_buf_len -= 4;
91 }
92 }
93
94 if (hvsi_udbg_buf_len <= 0 || hvsi_udbg_buf_len > 256) {
95 /* no data ready */
96 hvsi_udbg_buf_len = 0;
97 return -1;
98 }
99
100 ch = hvsi_udbg_buf[0];
101 /* shift remaining data down */
102 for (i = 1; i < hvsi_udbg_buf_len; i++) {
103 hvsi_udbg_buf[i-1] = hvsi_udbg_buf[i];
104 }
105 hvsi_udbg_buf_len--;
106
107 return ch;
108}
109
110static int udbg_hvsi_getc(void)
111{
112 int ch;
113 for (;;) {
114 ch = udbg_hvsi_getc_poll();
115 if (ch == -1) {
116 /* This shouldn't be needed...but... */
117 volatile unsigned long delay;
118 for (delay=0; delay < 2000000; delay++)
119 ;
120 } else {
121 return ch;
122 }
123 }
124}
125
126static void udbg_putcLP(char c)
127{
128 char buf[16];
129 unsigned long rc;
130
131 if (c == '\n')
132 udbg_putcLP('\r');
133
134 buf[0] = c;
135 do {
136 rc = plpar_put_term_char(vtermno, 1, buf);
137 } while(rc == H_BUSY);
138}
139
140/* Buffered chars getc */
141static long inbuflen;
142static long inbuf[2]; /* must be 2 longs */
143
144static int udbg_getc_pollLP(void)
145{
146 /* The interface is tricky because it may return up to 16 chars.
147 * We save them statically for future calls to udbg_getc().
148 */
149 char ch, *buf = (char *)inbuf;
150 int i;
151 long rc;
152 if (inbuflen == 0) {
153 /* get some more chars. */
154 inbuflen = 0;
155 rc = plpar_get_term_char(vtermno, &inbuflen, buf);
156 if (rc != H_SUCCESS)
157 inbuflen = 0; /* otherwise inbuflen is garbage */
158 }
159 if (inbuflen <= 0 || inbuflen > 16) {
160 /* Catch error case as well as other oddities (corruption) */
161 inbuflen = 0;
162 return -1;
163 }
164 ch = buf[0];
165 for (i = 1; i < inbuflen; i++) /* shuffle them down. */
166 buf[i-1] = buf[i];
167 inbuflen--;
168 return ch;
169}
170
171static int udbg_getcLP(void)
172{
173 int ch;
174 for (;;) {
175 ch = udbg_getc_pollLP();
176 if (ch == -1) {
177 /* This shouldn't be needed...but... */
178 volatile unsigned long delay;
179 for (delay=0; delay < 2000000; delay++)
180 ;
181 } else {
182 return ch;
183 }
184 }
185}
186
187/* call this from early_init() for a working debug console on
188 * vterm capable LPAR machines
189 */
190void __init udbg_init_debug_lpar(void)
191{
192 vtermno = 0;
193 udbg_putc = udbg_putcLP;
194 udbg_getc = udbg_getcLP;
195 udbg_getc_poll = udbg_getc_pollLP;
196
197 register_early_udbg_console();
198}
199
200/* returns 0 if couldn't find or use /chosen/stdout as console */
201void __init find_udbg_vterm(void)
202{
203 struct device_node *stdout_node;
204 const u32 *termno;
205 const char *name;
206
207 /* find the boot console from /chosen/stdout */
208 if (!of_chosen)
209 return;
210 name = of_get_property(of_chosen, "linux,stdout-path", NULL);
211 if (name == NULL)
212 return;
213 stdout_node = of_find_node_by_path(name);
214 if (!stdout_node)
215 return;
216 name = of_get_property(stdout_node, "name", NULL);
217 if (!name) {
218 printk(KERN_WARNING "stdout node missing 'name' property!\n");
219 goto out;
220 }
221
222 /* Check if it's a virtual terminal */
223 if (strncmp(name, "vty", 3) != 0)
224 goto out;
225 termno = of_get_property(stdout_node, "reg", NULL);
226 if (termno == NULL)
227 goto out;
228 vtermno = termno[0];
229
230 if (of_device_is_compatible(stdout_node, "hvterm1")) {
231 udbg_putc = udbg_putcLP;
232 udbg_getc = udbg_getcLP;
233 udbg_getc_poll = udbg_getc_pollLP;
234 add_preferred_console("hvc", termno[0] & 0xff, NULL);
235 } else if (of_device_is_compatible(stdout_node, "hvterm-protocol")) {
236 vtermno = termno[0];
237 udbg_putc = udbg_hvsi_putc;
238 udbg_getc = udbg_hvsi_getc;
239 udbg_getc_poll = udbg_hvsi_getc_poll;
240 add_preferred_console("hvsi", termno[0] & 0xff, NULL);
241 }
242out:
243 of_node_put(stdout_node);
244}
245
246void vpa_init(int cpu) 55void vpa_init(int cpu)
247{ 56{
248 int hwcpu = get_hard_smp_processor_id(cpu); 57 int hwcpu = get_hard_smp_processor_id(cpu);
@@ -258,9 +67,8 @@ void vpa_init(int cpu)
258 ret = register_vpa(hwcpu, addr); 67 ret = register_vpa(hwcpu, addr);
259 68
260 if (ret) { 69 if (ret) {
261 printk(KERN_ERR "WARNING: vpa_init: VPA registration for " 70 pr_err("WARNING: VPA registration for cpu %d (hw %d) of area "
262 "cpu %d (hw %d) of area %lx returns %ld\n", 71 "%lx failed with %ld\n", cpu, hwcpu, addr, ret);
263 cpu, hwcpu, addr, ret);
264 return; 72 return;
265 } 73 }
266 /* 74 /*
@@ -271,10 +79,9 @@ void vpa_init(int cpu)
271 if (firmware_has_feature(FW_FEATURE_SPLPAR)) { 79 if (firmware_has_feature(FW_FEATURE_SPLPAR)) {
272 ret = register_slb_shadow(hwcpu, addr); 80 ret = register_slb_shadow(hwcpu, addr);
273 if (ret) 81 if (ret)
274 printk(KERN_ERR 82 pr_err("WARNING: SLB shadow buffer registration for "
275 "WARNING: vpa_init: SLB shadow buffer " 83 "cpu %d (hw %d) of area %lx failed with %ld\n",
276 "registration for cpu %d (hw %d) of area %lx " 84 cpu, hwcpu, addr, ret);
277 "returns %ld\n", cpu, hwcpu, addr, ret);
278 } 85 }
279 86
280 /* 87 /*
@@ -291,8 +98,9 @@ void vpa_init(int cpu)
291 dtl->enqueue_to_dispatch_time = DISPATCH_LOG_BYTES; 98 dtl->enqueue_to_dispatch_time = DISPATCH_LOG_BYTES;
292 ret = register_dtl(hwcpu, __pa(dtl)); 99 ret = register_dtl(hwcpu, __pa(dtl));
293 if (ret) 100 if (ret)
294 pr_warn("DTL registration failed for cpu %d (%ld)\n", 101 pr_err("WARNING: DTL registration of cpu %d (hw %d) "
295 cpu, ret); 102 "failed with %ld\n", smp_processor_id(),
103 hwcpu, ret);
296 lppaca_of(cpu).dtl_enable_mask = 2; 104 lppaca_of(cpu).dtl_enable_mask = 2;
297 } 105 }
298} 106}
@@ -395,7 +203,7 @@ static void pSeries_lpar_hptab_clear(void)
395 unsigned long ptel; 203 unsigned long ptel;
396 } ptes[4]; 204 } ptes[4];
397 long lpar_rc; 205 long lpar_rc;
398 int i, j; 206 unsigned long i, j;
399 207
400 /* Read in batches of 4, 208 /* Read in batches of 4,
401 * invalidate only valid entries not in the VRMA 209 * invalidate only valid entries not in the VRMA
@@ -745,6 +553,7 @@ void __trace_hcall_entry(unsigned long opcode, unsigned long *args)
745 goto out; 553 goto out;
746 554
747 (*depth)++; 555 (*depth)++;
556 preempt_disable();
748 trace_hcall_entry(opcode, args); 557 trace_hcall_entry(opcode, args);
749 (*depth)--; 558 (*depth)--;
750 559
@@ -767,6 +576,7 @@ void __trace_hcall_exit(long opcode, unsigned long retval,
767 576
768 (*depth)++; 577 (*depth)++;
769 trace_hcall_exit(opcode, retval, retbuf); 578 trace_hcall_exit(opcode, retval, retbuf);
579 preempt_enable();
770 (*depth)--; 580 (*depth)--;
771 581
772out: 582out:
diff --git a/arch/powerpc/platforms/pseries/plpar_wrappers.h b/arch/powerpc/platforms/pseries/plpar_wrappers.h
index 4bf21207d7d..41c24c146d6 100644
--- a/arch/powerpc/platforms/pseries/plpar_wrappers.h
+++ b/arch/powerpc/platforms/pseries/plpar_wrappers.h
@@ -53,9 +53,9 @@ static inline long vpa_call(unsigned long flags, unsigned long cpu,
53 return plpar_hcall_norets(H_REGISTER_VPA, flags, cpu, vpa); 53 return plpar_hcall_norets(H_REGISTER_VPA, flags, cpu, vpa);
54} 54}
55 55
56static inline long unregister_vpa(unsigned long cpu, unsigned long vpa) 56static inline long unregister_vpa(unsigned long cpu)
57{ 57{
58 return vpa_call(0x5, cpu, vpa); 58 return vpa_call(0x5, cpu, 0);
59} 59}
60 60
61static inline long register_vpa(unsigned long cpu, unsigned long vpa) 61static inline long register_vpa(unsigned long cpu, unsigned long vpa)
@@ -63,9 +63,9 @@ static inline long register_vpa(unsigned long cpu, unsigned long vpa)
63 return vpa_call(0x1, cpu, vpa); 63 return vpa_call(0x1, cpu, vpa);
64} 64}
65 65
66static inline long unregister_slb_shadow(unsigned long cpu, unsigned long vpa) 66static inline long unregister_slb_shadow(unsigned long cpu)
67{ 67{
68 return vpa_call(0x7, cpu, vpa); 68 return vpa_call(0x7, cpu, 0);
69} 69}
70 70
71static inline long register_slb_shadow(unsigned long cpu, unsigned long vpa) 71static inline long register_slb_shadow(unsigned long cpu, unsigned long vpa)
@@ -73,9 +73,9 @@ static inline long register_slb_shadow(unsigned long cpu, unsigned long vpa)
73 return vpa_call(0x3, cpu, vpa); 73 return vpa_call(0x3, cpu, vpa);
74} 74}
75 75
76static inline long unregister_dtl(unsigned long cpu, unsigned long vpa) 76static inline long unregister_dtl(unsigned long cpu)
77{ 77{
78 return vpa_call(0x6, cpu, vpa); 78 return vpa_call(0x6, cpu, 0);
79} 79}
80 80
81static inline long register_dtl(unsigned long cpu, unsigned long vpa) 81static inline long register_dtl(unsigned long cpu, unsigned long vpa)
diff --git a/arch/powerpc/platforms/pseries/pseries.h b/arch/powerpc/platforms/pseries/pseries.h
index e9f6d2859c3..24c7162f11d 100644
--- a/arch/powerpc/platforms/pseries/pseries.h
+++ b/arch/powerpc/platforms/pseries/pseries.h
@@ -47,7 +47,8 @@ extern void pSeries_final_fixup(void);
47/* Poweron flag used for enabling auto ups restart */ 47/* Poweron flag used for enabling auto ups restart */
48extern unsigned long rtas_poweron_auto; 48extern unsigned long rtas_poweron_auto;
49 49
50extern void find_udbg_vterm(void); 50/* Provided by HVC VIO */
51extern void hvc_vio_init_early(void);
51 52
52/* Dynamic logical Partitioning/Mobility */ 53/* Dynamic logical Partitioning/Mobility */
53extern void dlpar_free_cc_nodes(struct device_node *); 54extern void dlpar_free_cc_nodes(struct device_node *);
diff --git a/arch/powerpc/platforms/pseries/reconfig.c b/arch/powerpc/platforms/pseries/reconfig.c
index 1de2cbb9230..168651acdd8 100644
--- a/arch/powerpc/platforms/pseries/reconfig.c
+++ b/arch/powerpc/platforms/pseries/reconfig.c
@@ -97,7 +97,7 @@ static struct device_node *derive_parent(const char *path)
97 return parent; 97 return parent;
98} 98}
99 99
100BLOCKING_NOTIFIER_HEAD(pSeries_reconfig_chain); 100static BLOCKING_NOTIFIER_HEAD(pSeries_reconfig_chain);
101 101
102int pSeries_reconfig_notifier_register(struct notifier_block *nb) 102int pSeries_reconfig_notifier_register(struct notifier_block *nb)
103{ 103{
@@ -109,6 +109,14 @@ void pSeries_reconfig_notifier_unregister(struct notifier_block *nb)
109 blocking_notifier_chain_unregister(&pSeries_reconfig_chain, nb); 109 blocking_notifier_chain_unregister(&pSeries_reconfig_chain, nb);
110} 110}
111 111
112int pSeries_reconfig_notify(unsigned long action, void *p)
113{
114 int err = blocking_notifier_call_chain(&pSeries_reconfig_chain,
115 action, p);
116
117 return notifier_to_errno(err);
118}
119
112static int pSeries_reconfig_add_node(const char *path, struct property *proplist) 120static int pSeries_reconfig_add_node(const char *path, struct property *proplist)
113{ 121{
114 struct device_node *np; 122 struct device_node *np;
@@ -132,11 +140,9 @@ static int pSeries_reconfig_add_node(const char *path, struct property *proplist
132 goto out_err; 140 goto out_err;
133 } 141 }
134 142
135 err = blocking_notifier_call_chain(&pSeries_reconfig_chain, 143 err = pSeries_reconfig_notify(PSERIES_RECONFIG_ADD, np);
136 PSERIES_RECONFIG_ADD, np); 144 if (err) {
137 if (err == NOTIFY_BAD) {
138 printk(KERN_ERR "Failed to add device node %s\n", path); 145 printk(KERN_ERR "Failed to add device node %s\n", path);
139 err = -ENOMEM; /* For now, safe to assume kmalloc failure */
140 goto out_err; 146 goto out_err;
141 } 147 }
142 148
@@ -173,8 +179,7 @@ static int pSeries_reconfig_remove_node(struct device_node *np)
173 179
174 remove_node_proc_entries(np); 180 remove_node_proc_entries(np);
175 181
176 blocking_notifier_call_chain(&pSeries_reconfig_chain, 182 pSeries_reconfig_notify(PSERIES_RECONFIG_REMOVE, np);
177 PSERIES_RECONFIG_REMOVE, np);
178 of_detach_node(np); 183 of_detach_node(np);
179 184
180 of_node_put(parent); 185 of_node_put(parent);
@@ -472,11 +477,10 @@ static int do_update_property(char *buf, size_t bufsize)
472 else 477 else
473 action = PSERIES_DRCONF_MEM_REMOVE; 478 action = PSERIES_DRCONF_MEM_REMOVE;
474 479
475 rc = blocking_notifier_call_chain(&pSeries_reconfig_chain, 480 rc = pSeries_reconfig_notify(action, value);
476 action, value); 481 if (rc) {
477 if (rc == NOTIFY_BAD) { 482 prom_update_property(np, oldprop, newprop);
478 rc = prom_update_property(np, oldprop, newprop); 483 return rc;
479 return -ENOMEM;
480 } 484 }
481 } 485 }
482 486
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index 593acceeff9..0969fd98c4f 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -324,8 +324,9 @@ static int alloc_dispatch_logs(void)
324 dtl->enqueue_to_dispatch_time = DISPATCH_LOG_BYTES; 324 dtl->enqueue_to_dispatch_time = DISPATCH_LOG_BYTES;
325 ret = register_dtl(hard_smp_processor_id(), __pa(dtl)); 325 ret = register_dtl(hard_smp_processor_id(), __pa(dtl));
326 if (ret) 326 if (ret)
327 pr_warn("DTL registration failed for boot cpu %d (%d)\n", 327 pr_err("WARNING: DTL registration of cpu %d (hw %d) failed "
328 smp_processor_id(), ret); 328 "with %d\n", smp_processor_id(),
329 hard_smp_processor_id(), ret);
329 get_paca()->lppaca_ptr->dtl_enable_mask = 2; 330 get_paca()->lppaca_ptr->dtl_enable_mask = 2;
330 331
331 return 0; 332 return 0;
@@ -512,9 +513,10 @@ static void __init pSeries_init_early(void)
512{ 513{
513 pr_debug(" -> pSeries_init_early()\n"); 514 pr_debug(" -> pSeries_init_early()\n");
514 515
516#ifdef CONFIG_HVC_CONSOLE
515 if (firmware_has_feature(FW_FEATURE_LPAR)) 517 if (firmware_has_feature(FW_FEATURE_LPAR))
516 find_udbg_vterm(); 518 hvc_vio_init_early();
517 519#endif
518 if (firmware_has_feature(FW_FEATURE_DABR)) 520 if (firmware_has_feature(FW_FEATURE_DABR))
519 ppc_md.set_dabr = pseries_set_dabr; 521 ppc_md.set_dabr = pseries_set_dabr;
520 else if (firmware_has_feature(FW_FEATURE_XDABR)) 522 else if (firmware_has_feature(FW_FEATURE_XDABR))
diff --git a/arch/powerpc/platforms/pseries/smp.c b/arch/powerpc/platforms/pseries/smp.c
index fbffd7e47ab..4e44c4dcd11 100644
--- a/arch/powerpc/platforms/pseries/smp.c
+++ b/arch/powerpc/platforms/pseries/smp.c
@@ -27,7 +27,7 @@
27#include <linux/cpu.h> 27#include <linux/cpu.h>
28 28
29#include <asm/ptrace.h> 29#include <asm/ptrace.h>
30#include <asm/atomic.h> 30#include <linux/atomic.h>
31#include <asm/irq.h> 31#include <asm/irq.h>
32#include <asm/page.h> 32#include <asm/page.h>
33#include <asm/pgtable.h> 33#include <asm/pgtable.h>
@@ -44,7 +44,6 @@
44#include <asm/mpic.h> 44#include <asm/mpic.h>
45#include <asm/vdso_datapage.h> 45#include <asm/vdso_datapage.h>
46#include <asm/cputhreads.h> 46#include <asm/cputhreads.h>
47#include <asm/mpic.h>
48#include <asm/xics.h> 47#include <asm/xics.h>
49 48
50#include "plpar_wrappers.h" 49#include "plpar_wrappers.h"
@@ -207,7 +206,7 @@ static struct smp_ops_t pSeries_mpic_smp_ops = {
207}; 206};
208 207
209static struct smp_ops_t pSeries_xics_smp_ops = { 208static struct smp_ops_t pSeries_xics_smp_ops = {
210 .message_pass = smp_muxed_ipi_message_pass, 209 .message_pass = NULL, /* Use smp_muxed_ipi_message_pass */
211 .cause_ipi = NULL, /* Filled at runtime by xics_smp_probe() */ 210 .cause_ipi = NULL, /* Filled at runtime by xics_smp_probe() */
212 .probe = xics_smp_probe, 211 .probe = xics_smp_probe,
213 .kick_cpu = smp_pSeries_kick_cpu, 212 .kick_cpu = smp_pSeries_kick_cpu,
diff --git a/arch/powerpc/platforms/wsp/smp.c b/arch/powerpc/platforms/wsp/smp.c
index 9d20fa9d371..71bd105f386 100644
--- a/arch/powerpc/platforms/wsp/smp.c
+++ b/arch/powerpc/platforms/wsp/smp.c
@@ -75,7 +75,7 @@ static int __init smp_a2_probe(void)
75} 75}
76 76
77static struct smp_ops_t a2_smp_ops = { 77static struct smp_ops_t a2_smp_ops = {
78 .message_pass = smp_muxed_ipi_message_pass, 78 .message_pass = NULL, /* Use smp_muxed_ipi_message_pass */
79 .cause_ipi = doorbell_cause_ipi, 79 .cause_ipi = doorbell_cause_ipi,
80 .probe = smp_a2_probe, 80 .probe = smp_a2_probe,
81 .kick_cpu = smp_a2_kick_cpu, 81 .kick_cpu = smp_a2_kick_cpu,