diff options
Diffstat (limited to 'arch/powerpc/platforms')
71 files changed, 764 insertions, 855 deletions
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 | ||
58 | config 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 | |||
66 | config PPC_MPC5200_LPBFIFO | 58 | config 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 |
15 | endif | 15 | endif |
16 | 16 | ||
17 | obj-$(CONFIG_PPC_MPC5200_GPIO) += mpc52xx_gpio.o | ||
18 | obj-$(CONFIG_PPC_MPC5200_LPBFIFO) += mpc52xx_lpbfifo.o | 17 | obj-$(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 | |||
31 | static DEFINE_SPINLOCK(gpio_lock); | ||
32 | |||
33 | struct 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 | */ | ||
56 | static 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(®s->wkup_ival) >> (7 - gpio)) & 1; | ||
63 | |||
64 | pr_debug("%s: gpio: %d ret: %d\n", __func__, gpio, ret); | ||
65 | |||
66 | return ret; | ||
67 | } | ||
68 | |||
69 | static 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(®s->wkup_dvo, chip->shadow_dvo); | ||
83 | } | ||
84 | |||
85 | static void | ||
86 | mpc52xx_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 | |||
99 | static 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(®s->wkup_ddr, chip->shadow_ddr); | ||
112 | |||
113 | /* and enable the pin */ | ||
114 | chip->shadow_gpioe |= 1 << (7 - gpio); | ||
115 | out_8(®s->wkup_gpioe, chip->shadow_gpioe); | ||
116 | |||
117 | spin_unlock_irqrestore(&gpio_lock, flags); | ||
118 | |||
119 | return 0; | ||
120 | } | ||
121 | |||
122 | static int | ||
123 | mpc52xx_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(®s->wkup_ddr, chip->shadow_ddr); | ||
138 | |||
139 | /* Finally enable the pin */ | ||
140 | chip->shadow_gpioe |= 1 << (7 - gpio); | ||
141 | out_8(®s->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 | |||
150 | static 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(®s->wkup_gpioe); | ||
175 | chip->shadow_ddr = in_8(®s->wkup_ddr); | ||
176 | chip->shadow_dvo = in_8(®s->wkup_dvo); | ||
177 | |||
178 | return 0; | ||
179 | } | ||
180 | |||
181 | static int mpc52xx_gpiochip_remove(struct platform_device *ofdev) | ||
182 | { | ||
183 | return -EBUSY; | ||
184 | } | ||
185 | |||
186 | static const struct of_device_id mpc52xx_wkup_gpiochip_match[] = { | ||
187 | { | ||
188 | .compatible = "fsl,mpc5200-gpio-wkup", | ||
189 | }, | ||
190 | {} | ||
191 | }; | ||
192 | |||
193 | static 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 | */ | ||
220 | static 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(®s->simple_ival) >> (31 - gpio)) & 1; | ||
227 | |||
228 | return ret; | ||
229 | } | ||
230 | |||
231 | static 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(®s->simple_dvo, chip->shadow_dvo); | ||
244 | } | ||
245 | |||
246 | static void | ||
247 | mpc52xx_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 | |||
260 | static 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(®s->simple_ddr, chip->shadow_ddr); | ||
273 | |||
274 | /* and enable the pin */ | ||
275 | chip->shadow_gpioe |= 1 << (31 - gpio); | ||
276 | out_be32(®s->simple_gpioe, chip->shadow_gpioe); | ||
277 | |||
278 | spin_unlock_irqrestore(&gpio_lock, flags); | ||
279 | |||
280 | return 0; | ||
281 | } | ||
282 | |||
283 | static int | ||
284 | mpc52xx_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(®s->simple_ddr, chip->shadow_ddr); | ||
300 | |||
301 | /* Finally enable the pin */ | ||
302 | chip->shadow_gpioe |= 1 << (31 - gpio); | ||
303 | out_be32(®s->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 | |||
312 | static 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(®s->simple_gpioe); | ||
337 | chip->shadow_ddr = in_be32(®s->simple_ddr); | ||
338 | chip->shadow_dvo = in_be32(®s->simple_dvo); | ||
339 | |||
340 | return 0; | ||
341 | } | ||
342 | |||
343 | static const struct of_device_id mpc52xx_simple_gpiochip_match[] = { | ||
344 | { | ||
345 | .compatible = "fsl,mpc5200-gpio", | ||
346 | }, | ||
347 | {} | ||
348 | }; | ||
349 | |||
350 | static 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 | |||
360 | static 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 */ | ||
373 | subsys_initcall(mpc52xx_gpio_init); | ||
374 | |||
375 | /* No exit call at the moment as we cannot unregister of gpio chips */ | ||
376 | |||
377 | MODULE_DESCRIPTION("Freescale MPC52xx gpio driver"); | ||
378 | MODULE_AUTHOR("Sascha Hauer <s.hauer@pengutronix.de"); | ||
379 | MODULE_LICENSE("GPL v2"); | ||
380 | |||
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_pci.c b/arch/powerpc/platforms/52xx/mpc52xx_pci.c index da110bd8834..5f5e6930908 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 */ |
@@ -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/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 | ||
70 | config 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 | |||
70 | config P1022_DS | 80 | config 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 | ||
88 | config P1023_RDS | ||
89 | bool "Freescale P1023 RDS" | ||
90 | select DEFAULT_UIMAGE | ||
91 | help | ||
92 | This option enables support for the P1023 RDS board | ||
93 | |||
78 | config SOCRATES | 94 | config 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 | ||
174 | config 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 | |||
158 | config P3041_DS | 186 | config 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 | |||
10 | obj-$(CONFIG_MPC85xx_DS) += mpc85xx_ds.o | 10 | obj-$(CONFIG_MPC85xx_DS) += mpc85xx_ds.o |
11 | obj-$(CONFIG_MPC85xx_MDS) += mpc85xx_mds.o | 11 | obj-$(CONFIG_MPC85xx_MDS) += mpc85xx_mds.o |
12 | obj-$(CONFIG_MPC85xx_RDB) += mpc85xx_rdb.o | 12 | obj-$(CONFIG_MPC85xx_RDB) += mpc85xx_rdb.o |
13 | obj-$(CONFIG_P1010_RDB) += p1010rdb.o | ||
13 | obj-$(CONFIG_P1022_DS) += p1022_ds.o | 14 | obj-$(CONFIG_P1022_DS) += p1022_ds.o |
15 | obj-$(CONFIG_P1023_RDS) += p1023_rds.o | ||
16 | obj-$(CONFIG_P2040_RDB) += p2040_rdb.o corenet_ds.o | ||
14 | obj-$(CONFIG_P3041_DS) += p3041_ds.o corenet_ds.o | 17 | obj-$(CONFIG_P3041_DS) += p3041_ds.o corenet_ds.o |
15 | obj-$(CONFIG_P4080_DS) += p4080_ds.o corenet_ds.o | 18 | obj-$(CONFIG_P4080_DS) += p4080_ds.o corenet_ds.o |
16 | obj-$(CONFIG_P5020_DS) += p5020_ds.o corenet_ds.o | 19 | obj-$(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 | ||
65 | static 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 | |||
31 | void __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 | */ | ||
64 | static 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 | |||
84 | static struct of_device_id __initdata p1010rdb_ids[] = { | ||
85 | { .type = "soc", }, | ||
86 | { .compatible = "soc", }, | ||
87 | { .compatible = "simple-bus", }, | ||
88 | {}, | ||
89 | }; | ||
90 | |||
91 | static int __init p1010rdb_publish_devices(void) | ||
92 | { | ||
93 | return of_platform_bus_probe(NULL, p1010rdb_ids, NULL); | ||
94 | } | ||
95 | machine_device_initcall(p1010_rdb, p1010rdb_publish_devices); | ||
96 | machine_arch_initcall(p1010_rdb, swiotlb_setup_bus_notifier); | ||
97 | |||
98 | /* | ||
99 | * Called very early, device-tree isn't unflattened | ||
100 | */ | ||
101 | static 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 | |||
110 | define_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) | |||
129 | static void p1022ds_set_monitor_port(int monitor_port) | 129 | static 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 | ||
43 | void __init mpc85xx_smp_init(void); | ||
44 | #endif | ||
45 | |||
46 | static 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 | |||
95 | static struct of_device_id p1023_ids[] = { | ||
96 | { .type = "soc", }, | ||
97 | { .compatible = "soc", }, | ||
98 | { .compatible = "simple-bus", }, | ||
99 | {}, | ||
100 | }; | ||
101 | |||
102 | |||
103 | static int __init p1023_publish_devices(void) | ||
104 | { | ||
105 | of_platform_bus_probe(NULL, p1023_ids, NULL); | ||
106 | |||
107 | return 0; | ||
108 | } | ||
109 | |||
110 | machine_device_initcall(p1023_rds, p1023_publish_devices); | ||
111 | |||
112 | static 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 | |||
141 | static 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 | |||
149 | define_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 | */ | ||
38 | static 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 | |||
69 | define_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 | |||
84 | machine_device_initcall(p2040_rdb, corenet_ds_publish_devices); | ||
85 | |||
86 | #ifdef CONFIG_SWIOTLB | ||
87 | machine_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 @@ | |||
39 | static int __init p3041_ds_probe(void) | 40 | static 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 | ||
46 | define_machine(p3041_ds) { | 71 | define_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 | ||
60 | machine_device_initcall(p3041_ds, corenet_ds_publish_devices); | 86 | machine_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 | ||
36 | static 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 | */ |
42 | static int __init p4080_ds_probe(void) | 39 | static 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 | ||
59 | define_machine(p4080_ds) { | 70 | define_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 | ||
73 | machine_device_initcall(p4080_ds, corenet_ds_publish_devices); | 85 | machine_device_initcall(p4080_ds, corenet_ds_publish_devices); |
86 | #ifdef CONFIG_SWIOTLB | ||
74 | machine_arch_initcall(p4080_ds, swiotlb_setup_bus_notifier); | 87 | machine_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 @@ | |||
39 | static int __init p5020_ds_probe(void) | 40 | static 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 | ||
46 | define_machine(p5020_ds) { | 71 | define_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 | ||
65 | machine_device_initcall(p5020_ds, corenet_ds_publish_devices); | 95 | machine_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 | ||
114 | static void __init | ||
115 | smp_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 | |||
122 | struct smp_ops_t smp_85xx_ops = { | 114 | struct 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 | ||
219 | static void __init | ||
220 | smp_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 | |||
227 | void __init mpc85xx_smp_init(void) | 229 | void __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 | ||
45 | static struct device_node *pixis_node; | 46 | static struct device_node *pixis_node; |
46 | static unsigned char *pixis_bdcfg0, *pixis_arch; | 47 | static 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 |
49 | static irqreturn_t mpc8610_sw9_irq(int irq, void *data) | 56 | static 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 | */ | ||
208 | void mpc8610hpcd_set_pixel_clock(unsigned int pixclock) | 220 | void 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 | ||
276 | ssize_t mpc8610hpcd_show_monitor_port(int monitor_port, char *buf) | 265 | ssize_t mpc8610hpcd_show_monitor_port(int monitor_port, char *buf) |
diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig index f970ca2b180..d0af7fb2f34 100644 --- a/arch/powerpc/platforms/Kconfig +++ b/arch/powerpc/platforms/Kconfig | |||
@@ -78,6 +78,10 @@ config MPIC | |||
78 | bool | 78 | bool |
79 | default n | 79 | default n |
80 | 80 | ||
81 | config PPC_EPAPR_HV_PIC | ||
82 | bool | ||
83 | default n | ||
84 | |||
81 | config MPIC_WEIRD | 85 | config MPIC_WEIRD |
82 | bool | 86 | bool |
83 | default n | 87 | default n |
@@ -266,7 +270,7 @@ config TAU_AVERAGE | |||
266 | 270 | ||
267 | config QUICC_ENGINE | 271 | config 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 @@ | |||
1 | config PPC64 | 1 | config 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 | |||
69 | config PPC_BOOK3S_64 | 68 | config 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 | ||
73 | config PPC_BOOK3E_64 | 73 | config 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 | ||
1853 | static int spufs_mfc_fsync(struct file *file, int datasync) | 1853 | static 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 | ||
1858 | static int spufs_mfc_fasync(int fd, struct file *file, int on) | 1865 | static 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 | ||
612 | static struct file_system_type spufs_type; | 612 | static struct file_system_type spufs_type; |
613 | 613 | ||
614 | long spufs_create(struct nameidata *nd, unsigned int flags, mode_t mode, | 614 | long 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 | ||
654 | out_dir: | ||
655 | mutex_unlock(&nd->path.dentry->d_inode->i_mutex); | ||
656 | out: | 648 | out: |
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 */ |
249 | extern struct spufs_calls spufs_calls; | 249 | extern struct spufs_calls spufs_calls; |
250 | long spufs_run_spu(struct spu_context *ctx, u32 *npc, u32 *status); | 250 | long spufs_run_spu(struct spu_context *ctx, u32 *npc, u32 *status); |
251 | long spufs_create(struct nameidata *nd, unsigned int flags, | 251 | long 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 */ |
254 | extern int spufs_coredump_extra_notes_size(void); | 254 | extern 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: | |||
62 | static long do_spu_create(const char __user *pathname, unsigned int flags, | 62 | static 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 @@ | |||
1 | config PPC_CHRP | 1 | config 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..3f65443f171 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)); |
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 |
169 | FTR_SECTION_ELSE | 169 | FTR_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 |
172 | ALT_MMU_FTR_SECTION_END_IFCLR(MMU_FTR_SLB) | 172 | ALT_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 @@ | |||
39 | label##_iSeries: \ | 39 | label##_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: \ | |||
48 | label##_iSeries: \ | 48 | label##_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 | ||
77 | static struct smp_ops_t iSeries_smp_ops = { | 77 | static 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" | ||
344 | static int __init maple_cpc925_edac_setup(void) | 343 | static 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..41a80a4fb97 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 | ||
@@ -838,8 +839,7 @@ static void __init setup_u3_ht(struct pci_controller* hose) | |||
838 | * into cfg_addr | 839 | * into cfg_addr |
839 | */ | 840 | */ |
840 | hose->cfg_data = ioremap(cfg_res.start, 0x02000000); | 841 | hose->cfg_data = ioremap(cfg_res.start, 0x02000000); |
841 | hose->cfg_addr = ioremap(self_res.start, | 842 | hose->cfg_addr = ioremap(self_res.start, resource_size(&self_res)); |
842 | self_res.end - self_res.start + 1); | ||
843 | 843 | ||
844 | /* | 844 | /* |
845 | * /ht node doesn't expose a "ranges" property, we read the register | 845 | * /ht node doesn't expose a "ranges" property, we read the register |
@@ -1323,8 +1323,7 @@ static void fixup_u4_pcie(struct pci_dev* dev) | |||
1323 | */ | 1323 | */ |
1324 | if (r->start >= 0xf0000000 && r->start < 0xf3000000) | 1324 | if (r->start >= 0xf0000000 && r->start < 0xf3000000) |
1325 | continue; | 1325 | continue; |
1326 | if (!region || (r->end - r->start) > | 1326 | if (!region || resource_size(r) > resource_size(region)) |
1327 | (region->end - region->start)) | ||
1328 | region = r; | 1327 | region = r; |
1329 | } | 1328 | } |
1330 | /* Nothing found, bail */ | 1329 | /* 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; | |||
355 | static int pmac_late_init(void) | 355 | static 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 | } |
363 | machine_late_initcall(powermac, pmac_late_init); | 360 | machine_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 */ |
449 | struct smp_ops_t psurge_smp_ops = { | 449 | struct 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 @@ | |||
1 | config PPC_PREP | 1 | config 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/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 @@ | |||
1 | config PPC_PSERIES | 1 | config 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..e9be25bc571 100644 --- a/arch/powerpc/platforms/pseries/dlpar.c +++ b/arch/powerpc/platforms/pseries/dlpar.c | |||
@@ -262,12 +262,11 @@ int dlpar_attach_node(struct device_node *dn) | |||
262 | if (!dn->parent) | 262 | if (!dn->parent) |
263 | return -ENOMEM; | 263 | return -ENOMEM; |
264 | 264 | ||
265 | rc = blocking_notifier_call_chain(&pSeries_reconfig_chain, | 265 | rc = pSeries_reconfig_notify(PSERIES_RECONFIG_ADD, dn); |
266 | PSERIES_RECONFIG_ADD, dn); | 266 | if (rc) { |
267 | if (rc == NOTIFY_BAD) { | ||
268 | printk(KERN_ERR "Failed to add device node %s\n", | 267 | printk(KERN_ERR "Failed to add device node %s\n", |
269 | dn->full_name); | 268 | dn->full_name); |
270 | return -ENOMEM; /* For now, safe to assume kmalloc failure */ | 269 | return rc; |
271 | } | 270 | } |
272 | 271 | ||
273 | of_attach_node(dn); | 272 | of_attach_node(dn); |
@@ -297,8 +296,7 @@ int dlpar_detach_node(struct device_node *dn) | |||
297 | remove_proc_entry(dn->pde->name, parent->pde); | 296 | remove_proc_entry(dn->pde->name, parent->pde); |
298 | #endif | 297 | #endif |
299 | 298 | ||
300 | blocking_notifier_call_chain(&pSeries_reconfig_chain, | 299 | pSeries_reconfig_notify(PSERIES_RECONFIG_REMOVE, dn); |
301 | PSERIES_RECONFIG_REMOVE, dn); | ||
302 | of_detach_node(dn); | 300 | of_detach_node(dn); |
303 | of_node_put(dn); /* Must decrement the refcount */ | 301 | of_node_put(dn); /* Must decrement the refcount */ |
304 | 302 | ||
diff --git a/arch/powerpc/platforms/pseries/eeh.c b/arch/powerpc/platforms/pseries/eeh.c index 46b55cf563e..ada6e07532e 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> |
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..bc0288501f1 100644 --- a/arch/powerpc/platforms/pseries/hotplug-cpu.c +++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c | |||
@@ -330,21 +330,17 @@ static void pseries_remove_processor(struct device_node *np) | |||
330 | static int pseries_smp_notifier(struct notifier_block *nb, | 330 | static 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 | ||
350 | static struct notifier_block pseries_smp_nb = { | 346 | static 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 33867ec4a23..11d8e0544ac 100644 --- a/arch/powerpc/platforms/pseries/hotplug-memory.c +++ b/arch/powerpc/platforms/pseries/hotplug-memory.c | |||
@@ -12,6 +12,8 @@ | |||
12 | #include <linux/of.h> | 12 | #include <linux/of.h> |
13 | #include <linux/memblock.h> | 13 | #include <linux/memblock.h> |
14 | #include <linux/vmalloc.h> | 14 | #include <linux/vmalloc.h> |
15 | #include <linux/memory.h> | ||
16 | |||
15 | #include <asm/firmware.h> | 17 | #include <asm/firmware.h> |
16 | #include <asm/machdep.h> | 18 | #include <asm/machdep.h> |
17 | #include <asm/pSeries_reconfig.h> | 19 | #include <asm/pSeries_reconfig.h> |
@@ -20,24 +22,25 @@ | |||
20 | static unsigned long get_memblock_size(void) | 22 | static unsigned long get_memblock_size(void) |
21 | { | 23 | { |
22 | struct device_node *np; | 24 | struct device_node *np; |
23 | unsigned int memblock_size = 0; | 25 | unsigned int memblock_size = MIN_MEMORY_BLOCK_SIZE; |
26 | struct resource r; | ||
24 | 27 | ||
25 | np = of_find_node_by_path("/ibm,dynamic-reconfiguration-memory"); | 28 | np = of_find_node_by_path("/ibm,dynamic-reconfiguration-memory"); |
26 | if (np) { | 29 | if (np) { |
27 | const unsigned long *size; | 30 | const __be64 *size; |
28 | 31 | ||
29 | size = of_get_property(np, "ibm,lmb-size", NULL); | 32 | size = of_get_property(np, "ibm,lmb-size", NULL); |
30 | memblock_size = size ? *size : 0; | 33 | if (size) |
31 | 34 | memblock_size = be64_to_cpup(size); | |
32 | of_node_put(np); | 35 | of_node_put(np); |
33 | } else { | 36 | } else if (machine_is(pseries)) { |
37 | /* This fallback really only applies to pseries */ | ||
34 | unsigned int memzero_size = 0; | 38 | unsigned int memzero_size = 0; |
35 | const unsigned int *regs; | ||
36 | 39 | ||
37 | np = of_find_node_by_path("/memory@0"); | 40 | np = of_find_node_by_path("/memory@0"); |
38 | if (np) { | 41 | if (np) { |
39 | regs = of_get_property(np, "reg", NULL); | 42 | if (!of_address_to_resource(np, 0, &r)) |
40 | memzero_size = regs ? regs[3] : 0; | 43 | memzero_size = resource_size(&r); |
41 | of_node_put(np); | 44 | of_node_put(np); |
42 | } | 45 | } |
43 | 46 | ||
@@ -50,16 +53,21 @@ static unsigned long get_memblock_size(void) | |||
50 | sprintf(buf, "/memory@%x", memzero_size); | 53 | sprintf(buf, "/memory@%x", memzero_size); |
51 | np = of_find_node_by_path(buf); | 54 | np = of_find_node_by_path(buf); |
52 | if (np) { | 55 | if (np) { |
53 | regs = of_get_property(np, "reg", NULL); | 56 | if (!of_address_to_resource(np, 0, &r)) |
54 | memblock_size = regs ? regs[3] : 0; | 57 | memblock_size = resource_size(&r); |
55 | of_node_put(np); | 58 | of_node_put(np); |
56 | } | 59 | } |
57 | } | 60 | } |
58 | } | 61 | } |
59 | |||
60 | return memblock_size; | 62 | return memblock_size; |
61 | } | 63 | } |
62 | 64 | ||
65 | /* WARNING: This is going to override the generic definition whenever | ||
66 | * pseries is built-in regardless of what platform is active at boot | ||
67 | * time. This is fine for now as this is the only "option" and it | ||
68 | * should work everywhere. If not, we'll have to turn this into a | ||
69 | * ppc_md. callback | ||
70 | */ | ||
63 | unsigned long memory_block_size_bytes(void) | 71 | unsigned long memory_block_size_bytes(void) |
64 | { | 72 | { |
65 | return get_memblock_size(); | 73 | return get_memblock_size(); |
@@ -197,27 +205,21 @@ static int pseries_drconf_memory(unsigned long *base, unsigned int action) | |||
197 | static int pseries_memory_notifier(struct notifier_block *nb, | 205 | static int pseries_memory_notifier(struct notifier_block *nb, |
198 | unsigned long action, void *node) | 206 | unsigned long action, void *node) |
199 | { | 207 | { |
200 | int err = NOTIFY_OK; | 208 | int err = 0; |
201 | 209 | ||
202 | switch (action) { | 210 | switch (action) { |
203 | case PSERIES_RECONFIG_ADD: | 211 | case PSERIES_RECONFIG_ADD: |
204 | if (pseries_add_memory(node)) | 212 | err = pseries_add_memory(node); |
205 | err = NOTIFY_BAD; | ||
206 | break; | 213 | break; |
207 | case PSERIES_RECONFIG_REMOVE: | 214 | case PSERIES_RECONFIG_REMOVE: |
208 | if (pseries_remove_memory(node)) | 215 | err = pseries_remove_memory(node); |
209 | err = NOTIFY_BAD; | ||
210 | break; | 216 | break; |
211 | case PSERIES_DRCONF_MEM_ADD: | 217 | case PSERIES_DRCONF_MEM_ADD: |
212 | case PSERIES_DRCONF_MEM_REMOVE: | 218 | case PSERIES_DRCONF_MEM_REMOVE: |
213 | if (pseries_drconf_memory(node, action)) | 219 | err = pseries_drconf_memory(node, action); |
214 | err = NOTIFY_BAD; | ||
215 | break; | ||
216 | default: | ||
217 | err = NOTIFY_DONE; | ||
218 | break; | 220 | break; |
219 | } | 221 | } |
220 | return err; | 222 | return notifier_from_errno(err); |
221 | } | 223 | } |
222 | 224 | ||
223 | static struct notifier_block pseries_mem_nb = { | 225 | static struct notifier_block pseries_mem_nb = { |
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/lpar.c b/arch/powerpc/platforms/pseries/lpar.c index 39e6e0a7b2f..f7205d344ef 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 | ||
53 | extern void pSeries_find_serial_port(void); | 53 | extern void pSeries_find_serial_port(void); |
54 | 54 | ||
55 | |||
56 | static int vtermno; /* virtual terminal# for udbg */ | ||
57 | |||
58 | #define __ALIGNED__ __attribute__((__aligned__(sizeof(long)))) | ||
59 | static 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 | |||
73 | static long hvsi_udbg_buf_len; | ||
74 | static uint8_t hvsi_udbg_buf[256]; | ||
75 | |||
76 | static 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 | |||
110 | static 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 | |||
126 | static 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 */ | ||
141 | static long inbuflen; | ||
142 | static long inbuf[2]; /* must be 2 longs */ | ||
143 | |||
144 | static 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 | |||
171 | static 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 | */ | ||
190 | void __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 */ | ||
201 | void __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 | } | ||
242 | out: | ||
243 | of_node_put(stdout_node); | ||
244 | } | ||
245 | |||
246 | void vpa_init(int cpu) | 55 | void vpa_init(int cpu) |
247 | { | 56 | { |
248 | int hwcpu = get_hard_smp_processor_id(cpu); | 57 | int hwcpu = get_hard_smp_processor_id(cpu); |
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 */ |
48 | extern unsigned long rtas_poweron_auto; | 48 | extern unsigned long rtas_poweron_auto; |
49 | 49 | ||
50 | extern void find_udbg_vterm(void); | 50 | /* Provided by HVC VIO */ |
51 | extern void hvc_vio_init_early(void); | ||
51 | 52 | ||
52 | /* Dynamic logical Partitioning/Mobility */ | 53 | /* Dynamic logical Partitioning/Mobility */ |
53 | extern void dlpar_free_cc_nodes(struct device_node *); | 54 | extern 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 | ||
100 | BLOCKING_NOTIFIER_HEAD(pSeries_reconfig_chain); | 100 | static BLOCKING_NOTIFIER_HEAD(pSeries_reconfig_chain); |
101 | 101 | ||
102 | int pSeries_reconfig_notifier_register(struct notifier_block *nb) | 102 | int 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 | ||
112 | int 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 | |||
112 | static int pSeries_reconfig_add_node(const char *path, struct property *proplist) | 120 | static 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..d00e52926b7 100644 --- a/arch/powerpc/platforms/pseries/setup.c +++ b/arch/powerpc/platforms/pseries/setup.c | |||
@@ -512,9 +512,10 @@ static void __init pSeries_init_early(void) | |||
512 | { | 512 | { |
513 | pr_debug(" -> pSeries_init_early()\n"); | 513 | pr_debug(" -> pSeries_init_early()\n"); |
514 | 514 | ||
515 | #ifdef CONFIG_HVC_CONSOLE | ||
515 | if (firmware_has_feature(FW_FEATURE_LPAR)) | 516 | if (firmware_has_feature(FW_FEATURE_LPAR)) |
516 | find_udbg_vterm(); | 517 | hvc_vio_init_early(); |
517 | 518 | #endif | |
518 | if (firmware_has_feature(FW_FEATURE_DABR)) | 519 | if (firmware_has_feature(FW_FEATURE_DABR)) |
519 | ppc_md.set_dabr = pseries_set_dabr; | 520 | ppc_md.set_dabr = pseries_set_dabr; |
520 | else if (firmware_has_feature(FW_FEATURE_XDABR)) | 521 | 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 | ||
209 | static struct smp_ops_t pSeries_xics_smp_ops = { | 208 | static 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 | ||
77 | static struct smp_ops_t a2_smp_ops = { | 77 | static 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, |