aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2010-08-03 20:26:03 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2010-08-03 20:26:03 -0400
commit412a4ac5e9cf7fdeb6af562c25547a9b9da7674f (patch)
treea8ce13cbc9c47c99799e5e3e3ad26ba78274ee73 /arch/powerpc
parente8e5c2155b0035b6e04f29be67f6444bc914005b (diff)
parent0c2daaafcdec726e89cbccca61d576de8429c537 (diff)
Merge commit 'gcl/next' into next
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/Kconfig2
-rw-r--r--arch/powerpc/boot/dts/pdm360ng.dts410
-rw-r--r--arch/powerpc/include/asm/abs_addr.h2
-rw-r--r--arch/powerpc/include/asm/cpm.h24
-rw-r--r--arch/powerpc/include/asm/cpm1.h3
-rw-r--r--arch/powerpc/include/asm/lmb.h15
-rw-r--r--arch/powerpc/include/asm/memblock.h15
-rw-r--r--arch/powerpc/include/asm/mpc5121.h32
-rw-r--r--arch/powerpc/kernel/btext.c2
-rw-r--r--arch/powerpc/kernel/crash.c2
-rw-r--r--arch/powerpc/kernel/crash_dump.c4
-rw-r--r--arch/powerpc/kernel/dma-swiotlb.c2
-rw-r--r--arch/powerpc/kernel/dma.c4
-rw-r--r--arch/powerpc/kernel/fsl_booke_entry_mapping.S4
-rw-r--r--arch/powerpc/kernel/machine_kexec.c12
-rw-r--r--arch/powerpc/kernel/paca.c8
-rw-r--r--arch/powerpc/kernel/prom.c62
-rw-r--r--arch/powerpc/kernel/rtas.c6
-rw-r--r--arch/powerpc/kernel/setup-common.c2
-rw-r--r--arch/powerpc/kernel/setup_32.c16
-rw-r--r--arch/powerpc/kernel/setup_64.c20
-rw-r--r--arch/powerpc/kernel/vdso.c4
-rw-r--r--arch/powerpc/mm/40x_mmu.c2
-rw-r--r--arch/powerpc/mm/hash_utils_64.c26
-rw-r--r--arch/powerpc/mm/init_32.c16
-rw-r--r--arch/powerpc/mm/init_64.c2
-rw-r--r--arch/powerpc/mm/mem.c78
-rw-r--r--arch/powerpc/mm/numa.c84
-rw-r--r--arch/powerpc/mm/pgtable_32.c6
-rw-r--r--arch/powerpc/mm/pgtable_64.c4
-rw-r--r--arch/powerpc/mm/ppc_mmu_32.c4
-rw-r--r--arch/powerpc/mm/stab.c4
-rw-r--r--arch/powerpc/mm/tlb_nohash.c4
-rw-r--r--arch/powerpc/platforms/512x/Kconfig20
-rw-r--r--arch/powerpc/platforms/512x/Makefile1
-rw-r--r--arch/powerpc/platforms/512x/clock.c18
-rw-r--r--arch/powerpc/platforms/512x/mpc5121_ads.c2
-rw-r--r--arch/powerpc/platforms/512x/mpc5121_generic.c2
-rw-r--r--arch/powerpc/platforms/512x/mpc512x.h2
-rw-r--r--arch/powerpc/platforms/512x/mpc512x_shared.c284
-rw-r--r--arch/powerpc/platforms/512x/pdm360ng.c129
-rw-r--r--arch/powerpc/platforms/85xx/corenet_ds.c4
-rw-r--r--arch/powerpc/platforms/85xx/mpc8536_ds.c4
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_ds.c4
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_mds.c4
-rw-r--r--arch/powerpc/platforms/86xx/mpc86xx_hpcn.c4
-rw-r--r--arch/powerpc/platforms/cell/iommu.c10
-rw-r--r--arch/powerpc/platforms/embedded6xx/wii.c12
-rw-r--r--arch/powerpc/platforms/maple/setup.c2
-rw-r--r--arch/powerpc/platforms/pasemi/iommu.c4
-rw-r--r--arch/powerpc/platforms/powermac/setup.c4
-rw-r--r--arch/powerpc/platforms/ps3/htab.c2
-rw-r--r--arch/powerpc/platforms/ps3/mm.c6
-rw-r--r--arch/powerpc/platforms/ps3/os-area.c4
-rw-r--r--arch/powerpc/platforms/pseries/hotplug-memory.c38
-rw-r--r--arch/powerpc/platforms/pseries/iommu.c2
-rw-r--r--arch/powerpc/platforms/pseries/phyp_dump.c4
-rw-r--r--arch/powerpc/sysdev/dart_iommu.c8
-rw-r--r--arch/powerpc/sysdev/fsl_pci.c4
-rw-r--r--arch/powerpc/sysdev/fsl_soc.h1
-rw-r--r--arch/powerpc/sysdev/micropatch.c30
61 files changed, 1201 insertions, 289 deletions
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 4fa420381044..ae29761469b3 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -132,7 +132,7 @@ config PPC
132 select HAVE_ARCH_KGDB 132 select HAVE_ARCH_KGDB
133 select HAVE_KRETPROBES 133 select HAVE_KRETPROBES
134 select HAVE_ARCH_TRACEHOOK 134 select HAVE_ARCH_TRACEHOOK
135 select HAVE_LMB 135 select HAVE_MEMBLOCK
136 select HAVE_DMA_ATTRS 136 select HAVE_DMA_ATTRS
137 select HAVE_DMA_API_DEBUG 137 select HAVE_DMA_API_DEBUG
138 select USE_GENERIC_SMP_HELPERS if SMP 138 select USE_GENERIC_SMP_HELPERS if SMP
diff --git a/arch/powerpc/boot/dts/pdm360ng.dts b/arch/powerpc/boot/dts/pdm360ng.dts
new file mode 100644
index 000000000000..94dfa5c9a7f9
--- /dev/null
+++ b/arch/powerpc/boot/dts/pdm360ng.dts
@@ -0,0 +1,410 @@
1/*
2 * Device Tree Source for IFM PDM360NG.
3 *
4 * Copyright 2009 - 2010 DENX Software Engineering.
5 * Anatolij Gustschin <agust@denx.de>
6 *
7 * Based on MPC5121E ADS dts.
8 * Copyright 2008 Freescale Semiconductor Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 */
15
16/dts-v1/;
17
18/ {
19 model = "pdm360ng";
20 compatible = "ifm,pdm360ng";
21 #address-cells = <1>;
22 #size-cells = <1>;
23 interrupt-parent = <&ipic>;
24
25 aliases {
26 ethernet0 = &eth0;
27 };
28
29 cpus {
30 #address-cells = <1>;
31 #size-cells = <0>;
32
33 PowerPC,5121@0 {
34 device_type = "cpu";
35 reg = <0>;
36 d-cache-line-size = <0x20>; // 32 bytes
37 i-cache-line-size = <0x20>; // 32 bytes
38 d-cache-size = <0x8000>; // L1, 32K
39 i-cache-size = <0x8000>; // L1, 32K
40 timebase-frequency = <49500000>;// 49.5 MHz (csb/4)
41 bus-frequency = <198000000>; // 198 MHz csb bus
42 clock-frequency = <396000000>; // 396 MHz ppc core
43 };
44 };
45
46 memory {
47 device_type = "memory";
48 reg = <0x00000000 0x20000000>; // 512MB at 0
49 };
50
51 nfc@40000000 {
52 compatible = "fsl,mpc5121-nfc";
53 reg = <0x40000000 0x100000>;
54 interrupts = <0x6 0x8>;
55 #address-cells = <0x1>;
56 #size-cells = <0x1>;
57 bank-width = <0x1>;
58 chips = <0x1>;
59
60 partition@0 {
61 label = "nand0";
62 reg = <0x0 0x40000000>;
63 };
64 };
65
66 sram@50000000 {
67 compatible = "fsl,mpc5121-sram";
68 reg = <0x50000000 0x20000>; // 128K at 0x50000000
69 };
70
71 localbus@80000020 {
72 compatible = "fsl,mpc5121-localbus";
73 #address-cells = <2>;
74 #size-cells = <1>;
75 reg = <0x80000020 0x40>;
76
77 ranges = <0x0 0x0 0xf0000000 0x10000000 /* Flash */
78 0x2 0x0 0x50040000 0x00020000>; /* CS2: MRAM */
79
80 flash@0,0 {
81 compatible = "amd,s29gl01gp", "cfi-flash";
82 reg = <0 0x00000000 0x08000000
83 0 0x08000000 0x08000000>;
84 #address-cells = <1>;
85 #size-cells = <1>;
86 bank-width = <4>;
87 device-width = <2>;
88
89 partition@0 {
90 label = "u-boot";
91 reg = <0x00000000 0x00080000>;
92 read-only;
93 };
94 partition@80000 {
95 label = "environment";
96 reg = <0x00080000 0x00080000>;
97 read-only;
98 };
99 partition@100000 {
100 label = "splash-image";
101 reg = <0x00100000 0x00080000>;
102 read-only;
103 };
104 partition@180000 {
105 label = "device-tree";
106 reg = <0x00180000 0x00040000>;
107 };
108 partition@1c0000 {
109 label = "kernel";
110 reg = <0x001c0000 0x00500000>;
111 };
112 partition@6c0000 {
113 label = "filesystem";
114 reg = <0x006c0000 0x07940000>;
115 };
116 };
117
118 mram0@2,0 {
119 compatible = "mtd-ram";
120 reg = <2 0x00000 0x10000>;
121 bank-width = <2>;
122 };
123
124 mram1@2,10000 {
125 compatible = "mtd-ram";
126 reg = <2 0x010000 0x10000>;
127 bank-width = <2>;
128 };
129 };
130
131 soc@80000000 {
132 compatible = "fsl,mpc5121-immr";
133 #address-cells = <1>;
134 #size-cells = <1>;
135 #interrupt-cells = <2>;
136 ranges = <0x0 0x80000000 0x400000>;
137 reg = <0x80000000 0x400000>;
138 bus-frequency = <66000000>; // 66 MHz ips bus
139
140 // IPIC
141 // interrupts cell = <intr #, sense>
142 // sense values match linux IORESOURCE_IRQ_* defines:
143 // sense == 8: Level, low assertion
144 // sense == 2: Edge, high-to-low change
145 //
146 ipic: interrupt-controller@c00 {
147 compatible = "fsl,mpc5121-ipic", "fsl,ipic";
148 interrupt-controller;
149 #address-cells = <0>;
150 #interrupt-cells = <2>;
151 reg = <0xc00 0x100>;
152 };
153
154 rtc@a00 { // Real time clock
155 compatible = "fsl,mpc5121-rtc";
156 reg = <0xa00 0x100>;
157 interrupts = <79 0x8 80 0x8>;
158 };
159
160 reset@e00 { // Reset module
161 compatible = "fsl,mpc5121-reset";
162 reg = <0xe00 0x100>;
163 };
164
165 clock@f00 { // Clock control
166 compatible = "fsl,mpc5121-clock";
167 reg = <0xf00 0x100>;
168 };
169
170 pmc@1000{ //Power Management Controller
171 compatible = "fsl,mpc5121-pmc";
172 reg = <0x1000 0x100>;
173 interrupts = <83 0x2>;
174 };
175
176 gpio@1100 {
177 compatible = "fsl,mpc5121-gpio";
178 reg = <0x1100 0x100>;
179 interrupts = <78 0x8>;
180 };
181
182 can@1300 {
183 compatible = "fsl,mpc5121-mscan";
184 interrupts = <12 0x8>;
185 reg = <0x1300 0x80>;
186 };
187
188 can@1380 {
189 compatible = "fsl,mpc5121-mscan";
190 interrupts = <13 0x8>;
191 reg = <0x1380 0x80>;
192 };
193
194 i2c@1700 {
195 #address-cells = <1>;
196 #size-cells = <0>;
197 compatible = "fsl,mpc5121-i2c";
198 reg = <0x1700 0x20>;
199 interrupts = <0x9 0x8>;
200 fsl,preserve-clocking;
201
202 eeprom@50 {
203 compatible = "at,24c01";
204 reg = <0x50>;
205 };
206
207 rtc@68 {
208 compatible = "stm,m41t00";
209 reg = <0x68>;
210 };
211 };
212
213 i2c@1740 {
214 #address-cells = <1>;
215 #size-cells = <0>;
216 compatible = "fsl,mpc5121-i2c";
217 reg = <0x1740 0x20>;
218 interrupts = <0xb 0x8>;
219 fsl,preserve-clocking;
220 };
221
222 i2ccontrol@1760 {
223 compatible = "fsl,mpc5121-i2c-ctrl";
224 reg = <0x1760 0x8>;
225 };
226
227 axe@2000 {
228 compatible = "fsl,mpc5121-axe";
229 reg = <0x2000 0x100>;
230 interrupts = <42 0x8>;
231 };
232
233 display@2100 {
234 compatible = "fsl,mpc5121-diu";
235 reg = <0x2100 0x100>;
236 interrupts = <64 0x8>;
237 };
238
239 can@2300 {
240 compatible = "fsl,mpc5121-mscan";
241 interrupts = <90 0x8>;
242 reg = <0x2300 0x80>;
243 };
244
245 can@2380 {
246 compatible = "fsl,mpc5121-mscan";
247 interrupts = <91 0x8>;
248 reg = <0x2380 0x80>;
249 };
250
251 viu@2400 {
252 compatible = "fsl,mpc5121-viu";
253 reg = <0x2400 0x400>;
254 interrupts = <67 0x8>;
255 };
256
257 mdio@2800 {
258 compatible = "fsl,mpc5121-fec-mdio";
259 reg = <0x2800 0x200>;
260 #address-cells = <1>;
261 #size-cells = <0>;
262 phy: ethernet-phy@0 {
263 compatible = "smsc,lan8700";
264 reg = <0x1f>;
265 };
266 };
267
268 eth0: ethernet@2800 {
269 compatible = "fsl,mpc5121-fec";
270 reg = <0x2800 0x200>;
271 local-mac-address = [ 00 00 00 00 00 00 ];
272 interrupts = <4 0x8>;
273 phy-handle = < &phy >;
274 };
275
276 // USB1 using external ULPI PHY
277 usb@3000 {
278 compatible = "fsl,mpc5121-usb2-dr";
279 reg = <0x3000 0x600>;
280 #address-cells = <1>;
281 #size-cells = <0>;
282 interrupts = <43 0x8>;
283 dr_mode = "host";
284 phy_type = "ulpi";
285 };
286
287 // USB0 using internal UTMI PHY
288 usb@4000 {
289 compatible = "fsl,mpc5121-usb2-dr";
290 reg = <0x4000 0x600>;
291 #address-cells = <1>;
292 #size-cells = <0>;
293 interrupts = <44 0x8>;
294 dr_mode = "otg";
295 phy_type = "utmi_wide";
296 fsl,invert-pwr-fault;
297 };
298
299 // IO control
300 ioctl@a000 {
301 compatible = "fsl,mpc5121-ioctl";
302 reg = <0xA000 0x1000>;
303 };
304
305 // 512x PSCs are not 52xx PSCs compatible
306 serial@11000 {
307 compatible = "fsl,mpc5121-psc-uart", "fsl,mpc5121-psc";
308 cell-index = <0>;
309 reg = <0x11000 0x100>;
310 interrupts = <40 0x8>;
311 fsl,rx-fifo-size = <16>;
312 fsl,tx-fifo-size = <16>;
313 };
314
315 serial@11100 {
316 compatible = "fsl,mpc5121-psc-uart", "fsl,mpc5121-psc";
317 cell-index = <1>;
318 reg = <0x11100 0x100>;
319 interrupts = <40 0x8>;
320 fsl,rx-fifo-size = <16>;
321 fsl,tx-fifo-size = <16>;
322 };
323
324 serial@11200 {
325 compatible = "fsl,mpc5121-psc-uart", "fsl,mpc5121-psc";
326 cell-index = <2>;
327 reg = <0x11200 0x100>;
328 interrupts = <40 0x8>;
329 fsl,rx-fifo-size = <16>;
330 fsl,tx-fifo-size = <16>;
331 };
332
333 serial@11300 {
334 compatible = "fsl,mpc5121-psc-uart", "fsl,mpc5121-psc";
335 cell-index = <3>;
336 reg = <0x11300 0x100>;
337 interrupts = <40 0x8>;
338 fsl,rx-fifo-size = <16>;
339 fsl,tx-fifo-size = <16>;
340 };
341
342 serial@11400 {
343 compatible = "fsl,mpc5121-psc-uart", "fsl,mpc5121-psc";
344 cell-index = <4>;
345 reg = <0x11400 0x100>;
346 interrupts = <40 0x8>;
347 fsl,rx-fifo-size = <16>;
348 fsl,tx-fifo-size = <16>;
349 };
350
351 serial@11600 {
352 compatible = "fsl,mpc5121-psc-uart", "fsl,mpc5121-psc";
353 cell-index = <6>;
354 reg = <0x11600 0x100>;
355 interrupts = <40 0x8>;
356 fsl,rx-fifo-size = <16>;
357 fsl,tx-fifo-size = <16>;
358 };
359
360 serial@11800 {
361 compatible = "fsl,mpc5121-psc-uart", "fsl,mpc5121-psc";
362 cell-index = <8>;
363 reg = <0x11800 0x100>;
364 interrupts = <40 0x8>;
365 fsl,rx-fifo-size = <16>;
366 fsl,tx-fifo-size = <16>;
367 };
368
369 serial@11B00 {
370 compatible = "fsl,mpc5121-psc-uart", "fsl,mpc5121-psc";
371 cell-index = <11>;
372 reg = <0x11B00 0x100>;
373 interrupts = <40 0x8>;
374 fsl,rx-fifo-size = <16>;
375 fsl,tx-fifo-size = <16>;
376 };
377
378 pscfifo@11f00 {
379 compatible = "fsl,mpc5121-psc-fifo";
380 reg = <0x11f00 0x100>;
381 interrupts = <40 0x8>;
382 };
383
384 spi@11900 {
385 compatible = "fsl,mpc5121-psc-spi", "fsl,mpc5121-psc";
386 cell-index = <9>;
387 #address-cells = <1>;
388 #size-cells = <0>;
389 reg = <0x11900 0x100>;
390 interrupts = <40 0x8>;
391 fsl,rx-fifo-size = <16>;
392 fsl,tx-fifo-size = <16>;
393
394 // 7845 touch screen controller
395 ts@0 {
396 compatible = "ti,ads7846";
397 reg = <0x0>;
398 spi-max-frequency = <3000000>;
399 // pen irq is GPIO25
400 interrupts = <78 0x8>;
401 };
402 };
403
404 dma@14000 {
405 compatible = "fsl,mpc5121-dma";
406 reg = <0x14000 0x1800>;
407 interrupts = <65 0x8>;
408 };
409 };
410};
diff --git a/arch/powerpc/include/asm/abs_addr.h b/arch/powerpc/include/asm/abs_addr.h
index c3bffc3fa1de..5ab0b71531be 100644
--- a/arch/powerpc/include/asm/abs_addr.h
+++ b/arch/powerpc/include/asm/abs_addr.h
@@ -12,7 +12,7 @@
12 * 2 of the License, or (at your option) any later version. 12 * 2 of the License, or (at your option) any later version.
13 */ 13 */
14 14
15#include <linux/lmb.h> 15#include <linux/memblock.h>
16 16
17#include <asm/types.h> 17#include <asm/types.h>
18#include <asm/page.h> 18#include <asm/page.h>
diff --git a/arch/powerpc/include/asm/cpm.h b/arch/powerpc/include/asm/cpm.h
index 0835eb977ba9..e50323fe941f 100644
--- a/arch/powerpc/include/asm/cpm.h
+++ b/arch/powerpc/include/asm/cpm.h
@@ -7,6 +7,30 @@
7#include <linux/of.h> 7#include <linux/of.h>
8 8
9/* 9/*
10 * SPI Parameter RAM common to QE and CPM.
11 */
12struct spi_pram {
13 __be16 rbase; /* Rx Buffer descriptor base address */
14 __be16 tbase; /* Tx Buffer descriptor base address */
15 u8 rfcr; /* Rx function code */
16 u8 tfcr; /* Tx function code */
17 __be16 mrblr; /* Max receive buffer length */
18 __be32 rstate; /* Internal */
19 __be32 rdp; /* Internal */
20 __be16 rbptr; /* Internal */
21 __be16 rbc; /* Internal */
22 __be32 rxtmp; /* Internal */
23 __be32 tstate; /* Internal */
24 __be32 tdp; /* Internal */
25 __be16 tbptr; /* Internal */
26 __be16 tbc; /* Internal */
27 __be32 txtmp; /* Internal */
28 __be32 res; /* Tx temp. */
29 __be16 rpbase; /* Relocation pointer (CPM1 only) */
30 __be16 res1; /* Reserved */
31};
32
33/*
10 * USB Controller pram common to QE and CPM. 34 * USB Controller pram common to QE and CPM.
11 */ 35 */
12struct usb_ctlr { 36struct usb_ctlr {
diff --git a/arch/powerpc/include/asm/cpm1.h b/arch/powerpc/include/asm/cpm1.h
index 81b01192f440..bd07650dca56 100644
--- a/arch/powerpc/include/asm/cpm1.h
+++ b/arch/powerpc/include/asm/cpm1.h
@@ -17,6 +17,7 @@
17#ifndef __CPM1__ 17#ifndef __CPM1__
18#define __CPM1__ 18#define __CPM1__
19 19
20#include <linux/init.h>
20#include <asm/8xx_immap.h> 21#include <asm/8xx_immap.h>
21#include <asm/ptrace.h> 22#include <asm/ptrace.h>
22#include <asm/cpm.h> 23#include <asm/cpm.h>
@@ -54,7 +55,7 @@ extern cpm8xx_t __iomem *cpmp; /* Pointer to comm processor */
54 55
55extern void cpm_setbrg(uint brg, uint rate); 56extern void cpm_setbrg(uint brg, uint rate);
56 57
57extern void cpm_load_patch(cpm8xx_t *cp); 58extern void __init cpm_load_patch(cpm8xx_t *cp);
58 59
59extern void cpm_reset(void); 60extern void cpm_reset(void);
60 61
diff --git a/arch/powerpc/include/asm/lmb.h b/arch/powerpc/include/asm/lmb.h
deleted file mode 100644
index 6f5fdf0a19ae..000000000000
--- a/arch/powerpc/include/asm/lmb.h
+++ /dev/null
@@ -1,15 +0,0 @@
1#ifndef _ASM_POWERPC_LMB_H
2#define _ASM_POWERPC_LMB_H
3
4#include <asm/udbg.h>
5
6#define LMB_DBG(fmt...) udbg_printf(fmt)
7
8#ifdef CONFIG_PPC32
9extern phys_addr_t lowmem_end_addr;
10#define LMB_REAL_LIMIT lowmem_end_addr
11#else
12#define LMB_REAL_LIMIT 0
13#endif
14
15#endif /* _ASM_POWERPC_LMB_H */
diff --git a/arch/powerpc/include/asm/memblock.h b/arch/powerpc/include/asm/memblock.h
new file mode 100644
index 000000000000..3c29728b56b1
--- /dev/null
+++ b/arch/powerpc/include/asm/memblock.h
@@ -0,0 +1,15 @@
1#ifndef _ASM_POWERPC_MEMBLOCK_H
2#define _ASM_POWERPC_MEMBLOCK_H
3
4#include <asm/udbg.h>
5
6#define MEMBLOCK_DBG(fmt...) udbg_printf(fmt)
7
8#ifdef CONFIG_PPC32
9extern phys_addr_t lowmem_end_addr;
10#define MEMBLOCK_REAL_LIMIT lowmem_end_addr
11#else
12#define MEMBLOCK_REAL_LIMIT 0
13#endif
14
15#endif /* _ASM_POWERPC_MEMBLOCK_H */
diff --git a/arch/powerpc/include/asm/mpc5121.h b/arch/powerpc/include/asm/mpc5121.h
index e6a30bb1d16a..8c0ab2ca689c 100644
--- a/arch/powerpc/include/asm/mpc5121.h
+++ b/arch/powerpc/include/asm/mpc5121.h
@@ -21,4 +21,36 @@ struct mpc512x_reset_module {
21 u32 rcer; /* Reset Control Enable Register */ 21 u32 rcer; /* Reset Control Enable Register */
22}; 22};
23 23
24/*
25 * Clock Control Module
26 */
27struct mpc512x_ccm {
28 u32 spmr; /* System PLL Mode Register */
29 u32 sccr1; /* System Clock Control Register 1 */
30 u32 sccr2; /* System Clock Control Register 2 */
31 u32 scfr1; /* System Clock Frequency Register 1 */
32 u32 scfr2; /* System Clock Frequency Register 2 */
33 u32 scfr2s; /* System Clock Frequency Shadow Register 2 */
34 u32 bcr; /* Bread Crumb Register */
35 u32 p0ccr; /* PSC0 Clock Control Register */
36 u32 p1ccr; /* PSC1 CCR */
37 u32 p2ccr; /* PSC2 CCR */
38 u32 p3ccr; /* PSC3 CCR */
39 u32 p4ccr; /* PSC4 CCR */
40 u32 p5ccr; /* PSC5 CCR */
41 u32 p6ccr; /* PSC6 CCR */
42 u32 p7ccr; /* PSC7 CCR */
43 u32 p8ccr; /* PSC8 CCR */
44 u32 p9ccr; /* PSC9 CCR */
45 u32 p10ccr; /* PSC10 CCR */
46 u32 p11ccr; /* PSC11 CCR */
47 u32 spccr; /* SPDIF Clock Control Register */
48 u32 cccr; /* CFM Clock Control Register */
49 u32 dccr; /* DIU Clock Control Register */
50 u32 m1ccr; /* MSCAN1 CCR */
51 u32 m2ccr; /* MSCAN2 CCR */
52 u32 m3ccr; /* MSCAN3 CCR */
53 u32 m4ccr; /* MSCAN4 CCR */
54 u8 res[0x98]; /* Reserved */
55};
24#endif /* __ASM_POWERPC_MPC5121_H__ */ 56#endif /* __ASM_POWERPC_MPC5121_H__ */
diff --git a/arch/powerpc/kernel/btext.c b/arch/powerpc/kernel/btext.c
index 26e58630ed7b..625942ae5585 100644
--- a/arch/powerpc/kernel/btext.c
+++ b/arch/powerpc/kernel/btext.c
@@ -7,7 +7,7 @@
7#include <linux/string.h> 7#include <linux/string.h>
8#include <linux/init.h> 8#include <linux/init.h>
9#include <linux/module.h> 9#include <linux/module.h>
10#include <linux/lmb.h> 10#include <linux/memblock.h>
11 11
12#include <asm/sections.h> 12#include <asm/sections.h>
13#include <asm/prom.h> 13#include <asm/prom.h>
diff --git a/arch/powerpc/kernel/crash.c b/arch/powerpc/kernel/crash.c
index 29df48f2b61a..417f7b05a9ce 100644
--- a/arch/powerpc/kernel/crash.c
+++ b/arch/powerpc/kernel/crash.c
@@ -24,7 +24,7 @@
24#include <linux/init.h> 24#include <linux/init.h>
25#include <linux/irq.h> 25#include <linux/irq.h>
26#include <linux/types.h> 26#include <linux/types.h>
27#include <linux/lmb.h> 27#include <linux/memblock.h>
28 28
29#include <asm/processor.h> 29#include <asm/processor.h>
30#include <asm/machdep.h> 30#include <asm/machdep.h>
diff --git a/arch/powerpc/kernel/crash_dump.c b/arch/powerpc/kernel/crash_dump.c
index d254132f08f6..8e05c16344e4 100644
--- a/arch/powerpc/kernel/crash_dump.c
+++ b/arch/powerpc/kernel/crash_dump.c
@@ -13,7 +13,7 @@
13 13
14#include <linux/crash_dump.h> 14#include <linux/crash_dump.h>
15#include <linux/bootmem.h> 15#include <linux/bootmem.h>
16#include <linux/lmb.h> 16#include <linux/memblock.h>
17#include <asm/code-patching.h> 17#include <asm/code-patching.h>
18#include <asm/kdump.h> 18#include <asm/kdump.h>
19#include <asm/prom.h> 19#include <asm/prom.h>
@@ -33,7 +33,7 @@ unsigned long long elfcorehdr_addr = ELFCORE_ADDR_MAX;
33#ifndef CONFIG_RELOCATABLE 33#ifndef CONFIG_RELOCATABLE
34void __init reserve_kdump_trampoline(void) 34void __init reserve_kdump_trampoline(void)
35{ 35{
36 lmb_reserve(0, KDUMP_RESERVE_LIMIT); 36 memblock_reserve(0, KDUMP_RESERVE_LIMIT);
37} 37}
38 38
39static void __init create_trampoline(unsigned long addr) 39static void __init create_trampoline(unsigned long addr)
diff --git a/arch/powerpc/kernel/dma-swiotlb.c b/arch/powerpc/kernel/dma-swiotlb.c
index e7fe218b8697..02f724f36753 100644
--- a/arch/powerpc/kernel/dma-swiotlb.c
+++ b/arch/powerpc/kernel/dma-swiotlb.c
@@ -71,7 +71,7 @@ static int ppc_swiotlb_bus_notify(struct notifier_block *nb,
71 sd->max_direct_dma_addr = 0; 71 sd->max_direct_dma_addr = 0;
72 72
73 /* May need to bounce if the device can't address all of DRAM */ 73 /* May need to bounce if the device can't address all of DRAM */
74 if ((dma_get_mask(dev) + 1) < lmb_end_of_DRAM()) 74 if ((dma_get_mask(dev) + 1) < memblock_end_of_DRAM())
75 set_dma_ops(dev, &swiotlb_dma_ops); 75 set_dma_ops(dev, &swiotlb_dma_ops);
76 76
77 return NOTIFY_DONE; 77 return NOTIFY_DONE;
diff --git a/arch/powerpc/kernel/dma.c b/arch/powerpc/kernel/dma.c
index 8d1de6f31d5a..84d6367ec003 100644
--- a/arch/powerpc/kernel/dma.c
+++ b/arch/powerpc/kernel/dma.c
@@ -9,7 +9,7 @@
9#include <linux/dma-mapping.h> 9#include <linux/dma-mapping.h>
10#include <linux/dma-debug.h> 10#include <linux/dma-debug.h>
11#include <linux/gfp.h> 11#include <linux/gfp.h>
12#include <linux/lmb.h> 12#include <linux/memblock.h>
13#include <asm/bug.h> 13#include <asm/bug.h>
14#include <asm/abs_addr.h> 14#include <asm/abs_addr.h>
15 15
@@ -89,7 +89,7 @@ static int dma_direct_dma_supported(struct device *dev, u64 mask)
89 /* Could be improved so platforms can set the limit in case 89 /* Could be improved so platforms can set the limit in case
90 * they have limited DMA windows 90 * they have limited DMA windows
91 */ 91 */
92 return mask >= (lmb_end_of_DRAM() - 1); 92 return mask >= (memblock_end_of_DRAM() - 1);
93#else 93#else
94 return 1; 94 return 1;
95#endif 95#endif
diff --git a/arch/powerpc/kernel/fsl_booke_entry_mapping.S b/arch/powerpc/kernel/fsl_booke_entry_mapping.S
index beb4d78a2304..a92c79be2728 100644
--- a/arch/powerpc/kernel/fsl_booke_entry_mapping.S
+++ b/arch/powerpc/kernel/fsl_booke_entry_mapping.S
@@ -205,8 +205,7 @@ next_tlb_setup:
205 bdnz+ next_tlb_setup 205 bdnz+ next_tlb_setup
206 206
207/* 7. Jump to our 1:1 mapping */ 207/* 7. Jump to our 1:1 mapping */
208 li r6, 0 208 mr r6, r25
209
210#else 209#else
211 #error You need to specify the mapping or not use this at all. 210 #error You need to specify the mapping or not use this at all.
212#endif 211#endif
@@ -217,7 +216,6 @@ next_tlb_setup:
2171: mflr r9 2161: mflr r9
218 rlwimi r6,r9,0,20,31 217 rlwimi r6,r9,0,20,31
219 addi r6,r6,(2f - 1b) 218 addi r6,r6,(2f - 1b)
220 add r6, r6, r25
221 mtspr SPRN_SRR0,r6 219 mtspr SPRN_SRR0,r6
222 mtspr SPRN_SRR1,r7 220 mtspr SPRN_SRR1,r7
223 rfi /* start execution out of TLB1[0] entry */ 221 rfi /* start execution out of TLB1[0] entry */
diff --git a/arch/powerpc/kernel/machine_kexec.c b/arch/powerpc/kernel/machine_kexec.c
index 47905c092861..dd6c141f1662 100644
--- a/arch/powerpc/kernel/machine_kexec.c
+++ b/arch/powerpc/kernel/machine_kexec.c
@@ -12,7 +12,7 @@
12#include <linux/kexec.h> 12#include <linux/kexec.h>
13#include <linux/reboot.h> 13#include <linux/reboot.h>
14#include <linux/threads.h> 14#include <linux/threads.h>
15#include <linux/lmb.h> 15#include <linux/memblock.h>
16#include <linux/of.h> 16#include <linux/of.h>
17#include <asm/machdep.h> 17#include <asm/machdep.h>
18#include <asm/prom.h> 18#include <asm/prom.h>
@@ -78,11 +78,11 @@ void __init reserve_crashkernel(void)
78 unsigned long long crash_size, crash_base; 78 unsigned long long crash_size, crash_base;
79 int ret; 79 int ret;
80 80
81 /* this is necessary because of lmb_phys_mem_size() */ 81 /* this is necessary because of memblock_phys_mem_size() */
82 lmb_analyze(); 82 memblock_analyze();
83 83
84 /* use common parsing */ 84 /* use common parsing */
85 ret = parse_crashkernel(boot_command_line, lmb_phys_mem_size(), 85 ret = parse_crashkernel(boot_command_line, memblock_phys_mem_size(),
86 &crash_size, &crash_base); 86 &crash_size, &crash_base);
87 if (ret == 0 && crash_size > 0) { 87 if (ret == 0 && crash_size > 0) {
88 crashk_res.start = crash_base; 88 crashk_res.start = crash_base;
@@ -145,9 +145,9 @@ void __init reserve_crashkernel(void)
145 "for crashkernel (System RAM: %ldMB)\n", 145 "for crashkernel (System RAM: %ldMB)\n",
146 (unsigned long)(crash_size >> 20), 146 (unsigned long)(crash_size >> 20),
147 (unsigned long)(crashk_res.start >> 20), 147 (unsigned long)(crashk_res.start >> 20),
148 (unsigned long)(lmb_phys_mem_size() >> 20)); 148 (unsigned long)(memblock_phys_mem_size() >> 20));
149 149
150 lmb_reserve(crashk_res.start, crash_size); 150 memblock_reserve(crashk_res.start, crash_size);
151} 151}
152 152
153int overlaps_crashkernel(unsigned long start, unsigned long size) 153int overlaps_crashkernel(unsigned long start, unsigned long size)
diff --git a/arch/powerpc/kernel/paca.c b/arch/powerpc/kernel/paca.c
index 3db8d64f40e1..d0a26f1770fe 100644
--- a/arch/powerpc/kernel/paca.c
+++ b/arch/powerpc/kernel/paca.c
@@ -9,7 +9,7 @@
9 9
10#include <linux/threads.h> 10#include <linux/threads.h>
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/lmb.h> 12#include <linux/memblock.h>
13 13
14#include <asm/firmware.h> 14#include <asm/firmware.h>
15#include <asm/lppaca.h> 15#include <asm/lppaca.h>
@@ -127,7 +127,7 @@ void __init allocate_pacas(void)
127 * the first segment. On iSeries they must be within the area mapped 127 * the first segment. On iSeries they must be within the area mapped
128 * by the HV, which is HvPagesToMap * HVPAGESIZE bytes. 128 * by the HV, which is HvPagesToMap * HVPAGESIZE bytes.
129 */ 129 */
130 limit = min(0x10000000ULL, lmb.rmo_size); 130 limit = min(0x10000000ULL, memblock.rmo_size);
131 if (firmware_has_feature(FW_FEATURE_ISERIES)) 131 if (firmware_has_feature(FW_FEATURE_ISERIES))
132 limit = min(limit, HvPagesToMap * HVPAGESIZE); 132 limit = min(limit, HvPagesToMap * HVPAGESIZE);
133 133
@@ -138,7 +138,7 @@ void __init allocate_pacas(void)
138 138
139 paca_size = PAGE_ALIGN(sizeof(struct paca_struct) * nr_cpus); 139 paca_size = PAGE_ALIGN(sizeof(struct paca_struct) * nr_cpus);
140 140
141 paca = __va(lmb_alloc_base(paca_size, PAGE_SIZE, limit)); 141 paca = __va(memblock_alloc_base(paca_size, PAGE_SIZE, limit));
142 memset(paca, 0, paca_size); 142 memset(paca, 0, paca_size);
143 143
144 printk(KERN_DEBUG "Allocated %u bytes for %d pacas at %p\n", 144 printk(KERN_DEBUG "Allocated %u bytes for %d pacas at %p\n",
@@ -158,7 +158,7 @@ void __init free_unused_pacas(void)
158 if (new_size >= paca_size) 158 if (new_size >= paca_size)
159 return; 159 return;
160 160
161 lmb_free(__pa(paca) + new_size, paca_size - new_size); 161 memblock_free(__pa(paca) + new_size, paca_size - new_size);
162 162
163 printk(KERN_DEBUG "Freed %u bytes for unused pacas\n", 163 printk(KERN_DEBUG "Freed %u bytes for unused pacas\n",
164 paca_size - new_size); 164 paca_size - new_size);
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 05131d634e73..9d3953983fb7 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -31,7 +31,7 @@
31#include <linux/kexec.h> 31#include <linux/kexec.h>
32#include <linux/debugfs.h> 32#include <linux/debugfs.h>
33#include <linux/irq.h> 33#include <linux/irq.h>
34#include <linux/lmb.h> 34#include <linux/memblock.h>
35 35
36#include <asm/prom.h> 36#include <asm/prom.h>
37#include <asm/rtas.h> 37#include <asm/rtas.h>
@@ -98,7 +98,7 @@ static void __init move_device_tree(void)
98 98
99 if ((memory_limit && (start + size) > memory_limit) || 99 if ((memory_limit && (start + size) > memory_limit) ||
100 overlaps_crashkernel(start, size)) { 100 overlaps_crashkernel(start, size)) {
101 p = __va(lmb_alloc_base(size, PAGE_SIZE, lmb.rmo_size)); 101 p = __va(memblock_alloc_base(size, PAGE_SIZE, memblock.rmo_size));
102 memcpy(p, initial_boot_params, size); 102 memcpy(p, initial_boot_params, size);
103 initial_boot_params = (struct boot_param_header *)p; 103 initial_boot_params = (struct boot_param_header *)p;
104 DBG("Moved device tree to 0x%p\n", p); 104 DBG("Moved device tree to 0x%p\n", p);
@@ -411,13 +411,13 @@ static int __init early_init_dt_scan_drconf_memory(unsigned long node)
411{ 411{
412 __be32 *dm, *ls, *usm; 412 __be32 *dm, *ls, *usm;
413 unsigned long l, n, flags; 413 unsigned long l, n, flags;
414 u64 base, size, lmb_size; 414 u64 base, size, memblock_size;
415 unsigned int is_kexec_kdump = 0, rngs; 415 unsigned int is_kexec_kdump = 0, rngs;
416 416
417 ls = of_get_flat_dt_prop(node, "ibm,lmb-size", &l); 417 ls = of_get_flat_dt_prop(node, "ibm,memblock-size", &l);
418 if (ls == NULL || l < dt_root_size_cells * sizeof(__be32)) 418 if (ls == NULL || l < dt_root_size_cells * sizeof(__be32))
419 return 0; 419 return 0;
420 lmb_size = dt_mem_next_cell(dt_root_size_cells, &ls); 420 memblock_size = dt_mem_next_cell(dt_root_size_cells, &ls);
421 421
422 dm = of_get_flat_dt_prop(node, "ibm,dynamic-memory", &l); 422 dm = of_get_flat_dt_prop(node, "ibm,dynamic-memory", &l);
423 if (dm == NULL || l < sizeof(__be32)) 423 if (dm == NULL || l < sizeof(__be32))
@@ -442,11 +442,11 @@ static int __init early_init_dt_scan_drconf_memory(unsigned long node)
442 or if the block is not assigned to this partition (0x8) */ 442 or if the block is not assigned to this partition (0x8) */
443 if ((flags & 0x80) || !(flags & 0x8)) 443 if ((flags & 0x80) || !(flags & 0x8))
444 continue; 444 continue;
445 size = lmb_size; 445 size = memblock_size;
446 rngs = 1; 446 rngs = 1;
447 if (is_kexec_kdump) { 447 if (is_kexec_kdump) {
448 /* 448 /*
449 * For each lmb in ibm,dynamic-memory, a corresponding 449 * For each memblock in ibm,dynamic-memory, a corresponding
450 * entry in linux,drconf-usable-memory property contains 450 * entry in linux,drconf-usable-memory property contains
451 * a counter 'p' followed by 'p' (base, size) duple. 451 * a counter 'p' followed by 'p' (base, size) duple.
452 * Now read the counter from 452 * Now read the counter from
@@ -469,10 +469,10 @@ static int __init early_init_dt_scan_drconf_memory(unsigned long node)
469 if ((base + size) > 0x80000000ul) 469 if ((base + size) > 0x80000000ul)
470 size = 0x80000000ul - base; 470 size = 0x80000000ul - base;
471 } 471 }
472 lmb_add(base, size); 472 memblock_add(base, size);
473 } while (--rngs); 473 } while (--rngs);
474 } 474 }
475 lmb_dump_all(); 475 memblock_dump_all();
476 return 0; 476 return 0;
477} 477}
478#else 478#else
@@ -501,14 +501,14 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size)
501 } 501 }
502#endif 502#endif
503 503
504 lmb_add(base, size); 504 memblock_add(base, size);
505 505
506 memstart_addr = min((u64)memstart_addr, base); 506 memstart_addr = min((u64)memstart_addr, base);
507} 507}
508 508
509u64 __init early_init_dt_alloc_memory_arch(u64 size, u64 align) 509u64 __init early_init_dt_alloc_memory_arch(u64 size, u64 align)
510{ 510{
511 return lmb_alloc(size, align); 511 return memblock_alloc(size, align);
512} 512}
513 513
514#ifdef CONFIG_BLK_DEV_INITRD 514#ifdef CONFIG_BLK_DEV_INITRD
@@ -534,12 +534,12 @@ static void __init early_reserve_mem(void)
534 /* before we do anything, lets reserve the dt blob */ 534 /* before we do anything, lets reserve the dt blob */
535 self_base = __pa((unsigned long)initial_boot_params); 535 self_base = __pa((unsigned long)initial_boot_params);
536 self_size = initial_boot_params->totalsize; 536 self_size = initial_boot_params->totalsize;
537 lmb_reserve(self_base, self_size); 537 memblock_reserve(self_base, self_size);
538 538
539#ifdef CONFIG_BLK_DEV_INITRD 539#ifdef CONFIG_BLK_DEV_INITRD
540 /* then reserve the initrd, if any */ 540 /* then reserve the initrd, if any */
541 if (initrd_start && (initrd_end > initrd_start)) 541 if (initrd_start && (initrd_end > initrd_start))
542 lmb_reserve(__pa(initrd_start), initrd_end - initrd_start); 542 memblock_reserve(__pa(initrd_start), initrd_end - initrd_start);
543#endif /* CONFIG_BLK_DEV_INITRD */ 543#endif /* CONFIG_BLK_DEV_INITRD */
544 544
545#ifdef CONFIG_PPC32 545#ifdef CONFIG_PPC32
@@ -560,7 +560,7 @@ static void __init early_reserve_mem(void)
560 if (base_32 == self_base && size_32 == self_size) 560 if (base_32 == self_base && size_32 == self_size)
561 continue; 561 continue;
562 DBG("reserving: %x -> %x\n", base_32, size_32); 562 DBG("reserving: %x -> %x\n", base_32, size_32);
563 lmb_reserve(base_32, size_32); 563 memblock_reserve(base_32, size_32);
564 } 564 }
565 return; 565 return;
566 } 566 }
@@ -571,7 +571,7 @@ static void __init early_reserve_mem(void)
571 if (size == 0) 571 if (size == 0)
572 break; 572 break;
573 DBG("reserving: %llx -> %llx\n", base, size); 573 DBG("reserving: %llx -> %llx\n", base, size);
574 lmb_reserve(base, size); 574 memblock_reserve(base, size);
575 } 575 }
576} 576}
577 577
@@ -594,7 +594,7 @@ static inline unsigned long phyp_dump_calculate_reserve_size(void)
594 return phyp_dump_info->reserve_bootvar; 594 return phyp_dump_info->reserve_bootvar;
595 595
596 /* divide by 20 to get 5% of value */ 596 /* divide by 20 to get 5% of value */
597 tmp = lmb_end_of_DRAM(); 597 tmp = memblock_end_of_DRAM();
598 do_div(tmp, 20); 598 do_div(tmp, 20);
599 599
600 /* round it down in multiples of 256 */ 600 /* round it down in multiples of 256 */
@@ -633,11 +633,11 @@ static void __init phyp_dump_reserve_mem(void)
633 if (phyp_dump_info->phyp_dump_is_active) { 633 if (phyp_dump_info->phyp_dump_is_active) {
634 /* Reserve *everything* above RMR.Area freed by userland tools*/ 634 /* Reserve *everything* above RMR.Area freed by userland tools*/
635 base = variable_reserve_size; 635 base = variable_reserve_size;
636 size = lmb_end_of_DRAM() - base; 636 size = memblock_end_of_DRAM() - base;
637 637
638 /* XXX crashed_ram_end is wrong, since it may be beyond 638 /* XXX crashed_ram_end is wrong, since it may be beyond
639 * the memory_limit, it will need to be adjusted. */ 639 * the memory_limit, it will need to be adjusted. */
640 lmb_reserve(base, size); 640 memblock_reserve(base, size);
641 641
642 phyp_dump_info->init_reserve_start = base; 642 phyp_dump_info->init_reserve_start = base;
643 phyp_dump_info->init_reserve_size = size; 643 phyp_dump_info->init_reserve_size = size;
@@ -645,8 +645,8 @@ static void __init phyp_dump_reserve_mem(void)
645 size = phyp_dump_info->cpu_state_size + 645 size = phyp_dump_info->cpu_state_size +
646 phyp_dump_info->hpte_region_size + 646 phyp_dump_info->hpte_region_size +
647 variable_reserve_size; 647 variable_reserve_size;
648 base = lmb_end_of_DRAM() - size; 648 base = memblock_end_of_DRAM() - size;
649 lmb_reserve(base, size); 649 memblock_reserve(base, size);
650 phyp_dump_info->init_reserve_start = base; 650 phyp_dump_info->init_reserve_start = base;
651 phyp_dump_info->init_reserve_size = size; 651 phyp_dump_info->init_reserve_size = size;
652 } 652 }
@@ -681,8 +681,8 @@ void __init early_init_devtree(void *params)
681 */ 681 */
682 of_scan_flat_dt(early_init_dt_scan_chosen, NULL); 682 of_scan_flat_dt(early_init_dt_scan_chosen, NULL);
683 683
684 /* Scan memory nodes and rebuild LMBs */ 684 /* Scan memory nodes and rebuild MEMBLOCKs */
685 lmb_init(); 685 memblock_init();
686 of_scan_flat_dt(early_init_dt_scan_root, NULL); 686 of_scan_flat_dt(early_init_dt_scan_root, NULL);
687 of_scan_flat_dt(early_init_dt_scan_memory_ppc, NULL); 687 of_scan_flat_dt(early_init_dt_scan_memory_ppc, NULL);
688 688
@@ -690,11 +690,11 @@ void __init early_init_devtree(void *params)
690 strlcpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE); 690 strlcpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE);
691 parse_early_param(); 691 parse_early_param();
692 692
693 /* Reserve LMB regions used by kernel, initrd, dt, etc... */ 693 /* Reserve MEMBLOCK regions used by kernel, initrd, dt, etc... */
694 lmb_reserve(PHYSICAL_START, __pa(klimit) - PHYSICAL_START); 694 memblock_reserve(PHYSICAL_START, __pa(klimit) - PHYSICAL_START);
695 /* If relocatable, reserve first 32k for interrupt vectors etc. */ 695 /* If relocatable, reserve first 32k for interrupt vectors etc. */
696 if (PHYSICAL_START > MEMORY_START) 696 if (PHYSICAL_START > MEMORY_START)
697 lmb_reserve(MEMORY_START, 0x8000); 697 memblock_reserve(MEMORY_START, 0x8000);
698 reserve_kdump_trampoline(); 698 reserve_kdump_trampoline();
699 reserve_crashkernel(); 699 reserve_crashkernel();
700 early_reserve_mem(); 700 early_reserve_mem();
@@ -706,17 +706,17 @@ void __init early_init_devtree(void *params)
706 706
707 /* Ensure that total memory size is page-aligned, because 707 /* Ensure that total memory size is page-aligned, because
708 * otherwise mark_bootmem() gets upset. */ 708 * otherwise mark_bootmem() gets upset. */
709 lmb_analyze(); 709 memblock_analyze();
710 memsize = lmb_phys_mem_size(); 710 memsize = memblock_phys_mem_size();
711 if ((memsize & PAGE_MASK) != memsize) 711 if ((memsize & PAGE_MASK) != memsize)
712 limit = memsize & PAGE_MASK; 712 limit = memsize & PAGE_MASK;
713 } 713 }
714 lmb_enforce_memory_limit(limit); 714 memblock_enforce_memory_limit(limit);
715 715
716 lmb_analyze(); 716 memblock_analyze();
717 lmb_dump_all(); 717 memblock_dump_all();
718 718
719 DBG("Phys. mem: %llx\n", lmb_phys_mem_size()); 719 DBG("Phys. mem: %llx\n", memblock_phys_mem_size());
720 720
721 /* We may need to relocate the flat tree, do it now. 721 /* We may need to relocate the flat tree, do it now.
722 * FIXME .. and the initrd too? */ 722 * FIXME .. and the initrd too? */
diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
index 41cfde0ca11b..41048de3c6c3 100644
--- a/arch/powerpc/kernel/rtas.c
+++ b/arch/powerpc/kernel/rtas.c
@@ -22,7 +22,7 @@
22#include <linux/smp.h> 22#include <linux/smp.h>
23#include <linux/completion.h> 23#include <linux/completion.h>
24#include <linux/cpumask.h> 24#include <linux/cpumask.h>
25#include <linux/lmb.h> 25#include <linux/memblock.h>
26#include <linux/slab.h> 26#include <linux/slab.h>
27 27
28#include <asm/prom.h> 28#include <asm/prom.h>
@@ -969,11 +969,11 @@ void __init rtas_initialize(void)
969 */ 969 */
970#ifdef CONFIG_PPC64 970#ifdef CONFIG_PPC64
971 if (machine_is(pseries) && firmware_has_feature(FW_FEATURE_LPAR)) { 971 if (machine_is(pseries) && firmware_has_feature(FW_FEATURE_LPAR)) {
972 rtas_region = min(lmb.rmo_size, RTAS_INSTANTIATE_MAX); 972 rtas_region = min(memblock.rmo_size, RTAS_INSTANTIATE_MAX);
973 ibm_suspend_me_token = rtas_token("ibm,suspend-me"); 973 ibm_suspend_me_token = rtas_token("ibm,suspend-me");
974 } 974 }
975#endif 975#endif
976 rtas_rmo_buf = lmb_alloc_base(RTAS_RMOBUF_MAX, PAGE_SIZE, rtas_region); 976 rtas_rmo_buf = memblock_alloc_base(RTAS_RMOBUF_MAX, PAGE_SIZE, rtas_region);
977 977
978#ifdef CONFIG_RTAS_ERROR_LOGGING 978#ifdef CONFIG_RTAS_ERROR_LOGGING
979 rtas_last_error_token = rtas_token("rtas-last-error"); 979 rtas_last_error_token = rtas_token("rtas-last-error");
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index 8b6ada66060b..70decd8068ca 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -33,7 +33,7 @@
33#include <linux/serial_8250.h> 33#include <linux/serial_8250.h>
34#include <linux/debugfs.h> 34#include <linux/debugfs.h>
35#include <linux/percpu.h> 35#include <linux/percpu.h>
36#include <linux/lmb.h> 36#include <linux/memblock.h>
37#include <linux/of_platform.h> 37#include <linux/of_platform.h>
38#include <asm/io.h> 38#include <asm/io.h>
39#include <asm/paca.h> 39#include <asm/paca.h>
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
index 7d84b210f168..a10ffc85ada7 100644
--- a/arch/powerpc/kernel/setup_32.c
+++ b/arch/powerpc/kernel/setup_32.c
@@ -16,7 +16,7 @@
16#include <linux/root_dev.h> 16#include <linux/root_dev.h>
17#include <linux/cpu.h> 17#include <linux/cpu.h>
18#include <linux/console.h> 18#include <linux/console.h>
19#include <linux/lmb.h> 19#include <linux/memblock.h>
20 20
21#include <asm/io.h> 21#include <asm/io.h>
22#include <asm/prom.h> 22#include <asm/prom.h>
@@ -246,12 +246,12 @@ static void __init irqstack_early_init(void)
246 unsigned int i; 246 unsigned int i;
247 247
248 /* interrupt stacks must be in lowmem, we get that for free on ppc32 248 /* interrupt stacks must be in lowmem, we get that for free on ppc32
249 * as the lmb is limited to lowmem by LMB_REAL_LIMIT */ 249 * as the memblock is limited to lowmem by MEMBLOCK_REAL_LIMIT */
250 for_each_possible_cpu(i) { 250 for_each_possible_cpu(i) {
251 softirq_ctx[i] = (struct thread_info *) 251 softirq_ctx[i] = (struct thread_info *)
252 __va(lmb_alloc(THREAD_SIZE, THREAD_SIZE)); 252 __va(memblock_alloc(THREAD_SIZE, THREAD_SIZE));
253 hardirq_ctx[i] = (struct thread_info *) 253 hardirq_ctx[i] = (struct thread_info *)
254 __va(lmb_alloc(THREAD_SIZE, THREAD_SIZE)); 254 __va(memblock_alloc(THREAD_SIZE, THREAD_SIZE));
255 } 255 }
256} 256}
257 257
@@ -261,15 +261,15 @@ static void __init exc_lvl_early_init(void)
261 unsigned int i; 261 unsigned int i;
262 262
263 /* interrupt stacks must be in lowmem, we get that for free on ppc32 263 /* interrupt stacks must be in lowmem, we get that for free on ppc32
264 * as the lmb is limited to lowmem by LMB_REAL_LIMIT */ 264 * as the memblock is limited to lowmem by MEMBLOCK_REAL_LIMIT */
265 for_each_possible_cpu(i) { 265 for_each_possible_cpu(i) {
266 critirq_ctx[i] = (struct thread_info *) 266 critirq_ctx[i] = (struct thread_info *)
267 __va(lmb_alloc(THREAD_SIZE, THREAD_SIZE)); 267 __va(memblock_alloc(THREAD_SIZE, THREAD_SIZE));
268#ifdef CONFIG_BOOKE 268#ifdef CONFIG_BOOKE
269 dbgirq_ctx[i] = (struct thread_info *) 269 dbgirq_ctx[i] = (struct thread_info *)
270 __va(lmb_alloc(THREAD_SIZE, THREAD_SIZE)); 270 __va(memblock_alloc(THREAD_SIZE, THREAD_SIZE));
271 mcheckirq_ctx[i] = (struct thread_info *) 271 mcheckirq_ctx[i] = (struct thread_info *)
272 __va(lmb_alloc(THREAD_SIZE, THREAD_SIZE)); 272 __va(memblock_alloc(THREAD_SIZE, THREAD_SIZE));
273#endif 273#endif
274 } 274 }
275} 275}
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index 96e662c1d46b..1bee4b68fa45 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -34,7 +34,7 @@
34#include <linux/bootmem.h> 34#include <linux/bootmem.h>
35#include <linux/pci.h> 35#include <linux/pci.h>
36#include <linux/lockdep.h> 36#include <linux/lockdep.h>
37#include <linux/lmb.h> 37#include <linux/memblock.h>
38#include <asm/io.h> 38#include <asm/io.h>
39#include <asm/kdump.h> 39#include <asm/kdump.h>
40#include <asm/prom.h> 40#include <asm/prom.h>
@@ -148,7 +148,7 @@ early_param("smt-enabled", early_smt_enabled);
148 * the CPU that ignores the top 2 bits of the address in real 148 * the CPU that ignores the top 2 bits of the address in real
149 * mode so we can access kernel globals normally provided we 149 * mode so we can access kernel globals normally provided we
150 * only toy with things in the RMO region. From here, we do 150 * only toy with things in the RMO region. From here, we do
151 * some early parsing of the device-tree to setup out LMB 151 * some early parsing of the device-tree to setup out MEMBLOCK
152 * data structures, and allocate & initialize the hash table 152 * data structures, and allocate & initialize the hash table
153 * and segment tables so we can start running with translation 153 * and segment tables so we can start running with translation
154 * enabled. 154 * enabled.
@@ -394,7 +394,7 @@ void __init setup_system(void)
394 394
395 printk("-----------------------------------------------------\n"); 395 printk("-----------------------------------------------------\n");
396 printk("ppc64_pft_size = 0x%llx\n", ppc64_pft_size); 396 printk("ppc64_pft_size = 0x%llx\n", ppc64_pft_size);
397 printk("physicalMemorySize = 0x%llx\n", lmb_phys_mem_size()); 397 printk("physicalMemorySize = 0x%llx\n", memblock_phys_mem_size());
398 if (ppc64_caches.dline_size != 0x80) 398 if (ppc64_caches.dline_size != 0x80)
399 printk("ppc64_caches.dcache_line_size = 0x%x\n", 399 printk("ppc64_caches.dcache_line_size = 0x%x\n",
400 ppc64_caches.dline_size); 400 ppc64_caches.dline_size);
@@ -433,10 +433,10 @@ static void __init irqstack_early_init(void)
433 */ 433 */
434 for_each_possible_cpu(i) { 434 for_each_possible_cpu(i) {
435 softirq_ctx[i] = (struct thread_info *) 435 softirq_ctx[i] = (struct thread_info *)
436 __va(lmb_alloc_base(THREAD_SIZE, 436 __va(memblock_alloc_base(THREAD_SIZE,
437 THREAD_SIZE, limit)); 437 THREAD_SIZE, limit));
438 hardirq_ctx[i] = (struct thread_info *) 438 hardirq_ctx[i] = (struct thread_info *)
439 __va(lmb_alloc_base(THREAD_SIZE, 439 __va(memblock_alloc_base(THREAD_SIZE,
440 THREAD_SIZE, limit)); 440 THREAD_SIZE, limit));
441 } 441 }
442} 442}
@@ -448,11 +448,11 @@ static void __init exc_lvl_early_init(void)
448 448
449 for_each_possible_cpu(i) { 449 for_each_possible_cpu(i) {
450 critirq_ctx[i] = (struct thread_info *) 450 critirq_ctx[i] = (struct thread_info *)
451 __va(lmb_alloc(THREAD_SIZE, THREAD_SIZE)); 451 __va(memblock_alloc(THREAD_SIZE, THREAD_SIZE));
452 dbgirq_ctx[i] = (struct thread_info *) 452 dbgirq_ctx[i] = (struct thread_info *)
453 __va(lmb_alloc(THREAD_SIZE, THREAD_SIZE)); 453 __va(memblock_alloc(THREAD_SIZE, THREAD_SIZE));
454 mcheckirq_ctx[i] = (struct thread_info *) 454 mcheckirq_ctx[i] = (struct thread_info *)
455 __va(lmb_alloc(THREAD_SIZE, THREAD_SIZE)); 455 __va(memblock_alloc(THREAD_SIZE, THREAD_SIZE));
456 } 456 }
457} 457}
458#else 458#else
@@ -477,11 +477,11 @@ static void __init emergency_stack_init(void)
477 * bringup, we need to get at them in real mode. This means they 477 * bringup, we need to get at them in real mode. This means they
478 * must also be within the RMO region. 478 * must also be within the RMO region.
479 */ 479 */
480 limit = min(slb0_limit(), lmb.rmo_size); 480 limit = min(slb0_limit(), memblock.rmo_size);
481 481
482 for_each_possible_cpu(i) { 482 for_each_possible_cpu(i) {
483 unsigned long sp; 483 unsigned long sp;
484 sp = lmb_alloc_base(THREAD_SIZE, THREAD_SIZE, limit); 484 sp = memblock_alloc_base(THREAD_SIZE, THREAD_SIZE, limit);
485 sp += THREAD_SIZE; 485 sp += THREAD_SIZE;
486 paca[i].emergency_sp = __va(sp); 486 paca[i].emergency_sp = __va(sp);
487 } 487 }
diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c
index d84d19224a95..13002fe206e7 100644
--- a/arch/powerpc/kernel/vdso.c
+++ b/arch/powerpc/kernel/vdso.c
@@ -22,7 +22,7 @@
22#include <linux/elf.h> 22#include <linux/elf.h>
23#include <linux/security.h> 23#include <linux/security.h>
24#include <linux/bootmem.h> 24#include <linux/bootmem.h>
25#include <linux/lmb.h> 25#include <linux/memblock.h>
26 26
27#include <asm/pgtable.h> 27#include <asm/pgtable.h>
28#include <asm/system.h> 28#include <asm/system.h>
@@ -734,7 +734,7 @@ static int __init vdso_init(void)
734 vdso_data->platform = machine_is(iseries) ? 0x200 : 0x100; 734 vdso_data->platform = machine_is(iseries) ? 0x200 : 0x100;
735 if (firmware_has_feature(FW_FEATURE_LPAR)) 735 if (firmware_has_feature(FW_FEATURE_LPAR))
736 vdso_data->platform |= 1; 736 vdso_data->platform |= 1;
737 vdso_data->physicalMemorySize = lmb_phys_mem_size(); 737 vdso_data->physicalMemorySize = memblock_phys_mem_size();
738 vdso_data->dcache_size = ppc64_caches.dsize; 738 vdso_data->dcache_size = ppc64_caches.dsize;
739 vdso_data->dcache_line_size = ppc64_caches.dline_size; 739 vdso_data->dcache_line_size = ppc64_caches.dline_size;
740 vdso_data->icache_size = ppc64_caches.isize; 740 vdso_data->icache_size = ppc64_caches.isize;
diff --git a/arch/powerpc/mm/40x_mmu.c b/arch/powerpc/mm/40x_mmu.c
index 65abfcfaaa9e..1dc2fa5ce1bd 100644
--- a/arch/powerpc/mm/40x_mmu.c
+++ b/arch/powerpc/mm/40x_mmu.c
@@ -135,7 +135,7 @@ unsigned long __init mmu_mapin_ram(unsigned long top)
135 /* If the size of RAM is not an exact power of two, we may not 135 /* If the size of RAM is not an exact power of two, we may not
136 * have covered RAM in its entirety with 16 and 4 MiB 136 * have covered RAM in its entirety with 16 and 4 MiB
137 * pages. Consequently, restrict the top end of RAM currently 137 * pages. Consequently, restrict the top end of RAM currently
138 * allocable so that calls to the LMB to allocate PTEs for "tail" 138 * allocable so that calls to the MEMBLOCK to allocate PTEs for "tail"
139 * coverage with normal-sized pages (or other reasons) do not 139 * coverage with normal-sized pages (or other reasons) do not
140 * attempt to allocate outside the allowed range. 140 * attempt to allocate outside the allowed range.
141 */ 141 */
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index 3ecdcec0a39e..98f262de5585 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -31,7 +31,7 @@
31#include <linux/cache.h> 31#include <linux/cache.h>
32#include <linux/init.h> 32#include <linux/init.h>
33#include <linux/signal.h> 33#include <linux/signal.h>
34#include <linux/lmb.h> 34#include <linux/memblock.h>
35 35
36#include <asm/processor.h> 36#include <asm/processor.h>
37#include <asm/pgtable.h> 37#include <asm/pgtable.h>
@@ -384,8 +384,8 @@ static int __init htab_dt_scan_hugepage_blocks(unsigned long node,
384 printk(KERN_INFO "Huge page(16GB) memory: " 384 printk(KERN_INFO "Huge page(16GB) memory: "
385 "addr = 0x%lX size = 0x%lX pages = %d\n", 385 "addr = 0x%lX size = 0x%lX pages = %d\n",
386 phys_addr, block_size, expected_pages); 386 phys_addr, block_size, expected_pages);
387 if (phys_addr + (16 * GB) <= lmb_end_of_DRAM()) { 387 if (phys_addr + (16 * GB) <= memblock_end_of_DRAM()) {
388 lmb_reserve(phys_addr, block_size * expected_pages); 388 memblock_reserve(phys_addr, block_size * expected_pages);
389 add_gpage(phys_addr, block_size, expected_pages); 389 add_gpage(phys_addr, block_size, expected_pages);
390 } 390 }
391 return 0; 391 return 0;
@@ -458,7 +458,7 @@ static void __init htab_init_page_sizes(void)
458 * and we have at least 1G of RAM at boot 458 * and we have at least 1G of RAM at boot
459 */ 459 */
460 if (mmu_psize_defs[MMU_PAGE_16M].shift && 460 if (mmu_psize_defs[MMU_PAGE_16M].shift &&
461 lmb_phys_mem_size() >= 0x40000000) 461 memblock_phys_mem_size() >= 0x40000000)
462 mmu_vmemmap_psize = MMU_PAGE_16M; 462 mmu_vmemmap_psize = MMU_PAGE_16M;
463 else if (mmu_psize_defs[MMU_PAGE_64K].shift) 463 else if (mmu_psize_defs[MMU_PAGE_64K].shift)
464 mmu_vmemmap_psize = MMU_PAGE_64K; 464 mmu_vmemmap_psize = MMU_PAGE_64K;
@@ -520,7 +520,7 @@ static unsigned long __init htab_get_table_size(void)
520 return 1UL << ppc64_pft_size; 520 return 1UL << ppc64_pft_size;
521 521
522 /* round mem_size up to next power of 2 */ 522 /* round mem_size up to next power of 2 */
523 mem_size = lmb_phys_mem_size(); 523 mem_size = memblock_phys_mem_size();
524 rnd_mem_size = 1UL << __ilog2(mem_size); 524 rnd_mem_size = 1UL << __ilog2(mem_size);
525 if (rnd_mem_size < mem_size) 525 if (rnd_mem_size < mem_size)
526 rnd_mem_size <<= 1; 526 rnd_mem_size <<= 1;
@@ -627,7 +627,7 @@ static void __init htab_initialize(void)
627 else 627 else
628 limit = 0; 628 limit = 0;
629 629
630 table = lmb_alloc_base(htab_size_bytes, htab_size_bytes, limit); 630 table = memblock_alloc_base(htab_size_bytes, htab_size_bytes, limit);
631 631
632 DBG("Hash table allocated at %lx, size: %lx\n", table, 632 DBG("Hash table allocated at %lx, size: %lx\n", table,
633 htab_size_bytes); 633 htab_size_bytes);
@@ -647,9 +647,9 @@ static void __init htab_initialize(void)
647 prot = pgprot_val(PAGE_KERNEL); 647 prot = pgprot_val(PAGE_KERNEL);
648 648
649#ifdef CONFIG_DEBUG_PAGEALLOC 649#ifdef CONFIG_DEBUG_PAGEALLOC
650 linear_map_hash_count = lmb_end_of_DRAM() >> PAGE_SHIFT; 650 linear_map_hash_count = memblock_end_of_DRAM() >> PAGE_SHIFT;
651 linear_map_hash_slots = __va(lmb_alloc_base(linear_map_hash_count, 651 linear_map_hash_slots = __va(memblock_alloc_base(linear_map_hash_count,
652 1, lmb.rmo_size)); 652 1, memblock.rmo_size));
653 memset(linear_map_hash_slots, 0, linear_map_hash_count); 653 memset(linear_map_hash_slots, 0, linear_map_hash_count);
654#endif /* CONFIG_DEBUG_PAGEALLOC */ 654#endif /* CONFIG_DEBUG_PAGEALLOC */
655 655
@@ -659,16 +659,16 @@ static void __init htab_initialize(void)
659 */ 659 */
660 660
661 /* create bolted the linear mapping in the hash table */ 661 /* create bolted the linear mapping in the hash table */
662 for (i=0; i < lmb.memory.cnt; i++) { 662 for (i=0; i < memblock.memory.cnt; i++) {
663 base = (unsigned long)__va(lmb.memory.region[i].base); 663 base = (unsigned long)__va(memblock.memory.region[i].base);
664 size = lmb.memory.region[i].size; 664 size = memblock.memory.region[i].size;
665 665
666 DBG("creating mapping for region: %lx..%lx (prot: %lx)\n", 666 DBG("creating mapping for region: %lx..%lx (prot: %lx)\n",
667 base, size, prot); 667 base, size, prot);
668 668
669#ifdef CONFIG_U3_DART 669#ifdef CONFIG_U3_DART
670 /* Do not map the DART space. Fortunately, it will be aligned 670 /* Do not map the DART space. Fortunately, it will be aligned
671 * in such a way that it will not cross two lmb regions and 671 * in such a way that it will not cross two memblock regions and
672 * will fit within a single 16Mb page. 672 * will fit within a single 16Mb page.
673 * The DART space is assumed to be a full 16Mb region even if 673 * The DART space is assumed to be a full 16Mb region even if
674 * we only use 2Mb of that space. We will use more of it later 674 * we only use 2Mb of that space. We will use more of it later
diff --git a/arch/powerpc/mm/init_32.c b/arch/powerpc/mm/init_32.c
index 767333005eb4..6a6975dc2654 100644
--- a/arch/powerpc/mm/init_32.c
+++ b/arch/powerpc/mm/init_32.c
@@ -30,7 +30,7 @@
30#include <linux/highmem.h> 30#include <linux/highmem.h>
31#include <linux/initrd.h> 31#include <linux/initrd.h>
32#include <linux/pagemap.h> 32#include <linux/pagemap.h>
33#include <linux/lmb.h> 33#include <linux/memblock.h>
34#include <linux/gfp.h> 34#include <linux/gfp.h>
35 35
36#include <asm/pgalloc.h> 36#include <asm/pgalloc.h>
@@ -136,17 +136,17 @@ void __init MMU_init(void)
136 /* parse args from command line */ 136 /* parse args from command line */
137 MMU_setup(); 137 MMU_setup();
138 138
139 if (lmb.memory.cnt > 1) { 139 if (memblock.memory.cnt > 1) {
140#ifndef CONFIG_WII 140#ifndef CONFIG_WII
141 lmb.memory.cnt = 1; 141 memblock.memory.cnt = 1;
142 lmb_analyze(); 142 memblock_analyze();
143 printk(KERN_WARNING "Only using first contiguous memory region"); 143 printk(KERN_WARNING "Only using first contiguous memory region");
144#else 144#else
145 wii_memory_fixups(); 145 wii_memory_fixups();
146#endif 146#endif
147 } 147 }
148 148
149 total_lowmem = total_memory = lmb_end_of_DRAM() - memstart_addr; 149 total_lowmem = total_memory = memblock_end_of_DRAM() - memstart_addr;
150 lowmem_end_addr = memstart_addr + total_lowmem; 150 lowmem_end_addr = memstart_addr + total_lowmem;
151 151
152#ifdef CONFIG_FSL_BOOKE 152#ifdef CONFIG_FSL_BOOKE
@@ -161,8 +161,8 @@ void __init MMU_init(void)
161 lowmem_end_addr = memstart_addr + total_lowmem; 161 lowmem_end_addr = memstart_addr + total_lowmem;
162#ifndef CONFIG_HIGHMEM 162#ifndef CONFIG_HIGHMEM
163 total_memory = total_lowmem; 163 total_memory = total_lowmem;
164 lmb_enforce_memory_limit(lowmem_end_addr); 164 memblock_enforce_memory_limit(lowmem_end_addr);
165 lmb_analyze(); 165 memblock_analyze();
166#endif /* CONFIG_HIGHMEM */ 166#endif /* CONFIG_HIGHMEM */
167 } 167 }
168 168
@@ -200,7 +200,7 @@ void __init *early_get_page(void)
200 if (init_bootmem_done) { 200 if (init_bootmem_done) {
201 p = alloc_bootmem_pages(PAGE_SIZE); 201 p = alloc_bootmem_pages(PAGE_SIZE);
202 } else { 202 } else {
203 p = __va(lmb_alloc_base(PAGE_SIZE, PAGE_SIZE, 203 p = __va(memblock_alloc_base(PAGE_SIZE, PAGE_SIZE,
204 __initial_memory_limit_addr)); 204 __initial_memory_limit_addr));
205 } 205 }
206 return p; 206 return p;
diff --git a/arch/powerpc/mm/init_64.c b/arch/powerpc/mm/init_64.c
index e267f223fdff..71f1415e2472 100644
--- a/arch/powerpc/mm/init_64.c
+++ b/arch/powerpc/mm/init_64.c
@@ -40,7 +40,7 @@
40#include <linux/nodemask.h> 40#include <linux/nodemask.h>
41#include <linux/module.h> 41#include <linux/module.h>
42#include <linux/poison.h> 42#include <linux/poison.h>
43#include <linux/lmb.h> 43#include <linux/memblock.h>
44#include <linux/hugetlb.h> 44#include <linux/hugetlb.h>
45#include <linux/slab.h> 45#include <linux/slab.h>
46 46
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index 0f594d774bf7..1a84a8d00005 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -32,7 +32,7 @@
32#include <linux/initrd.h> 32#include <linux/initrd.h>
33#include <linux/pagemap.h> 33#include <linux/pagemap.h>
34#include <linux/suspend.h> 34#include <linux/suspend.h>
35#include <linux/lmb.h> 35#include <linux/memblock.h>
36#include <linux/hugetlb.h> 36#include <linux/hugetlb.h>
37 37
38#include <asm/pgalloc.h> 38#include <asm/pgalloc.h>
@@ -83,13 +83,13 @@ int page_is_ram(unsigned long pfn)
83#else 83#else
84 unsigned long paddr = (pfn << PAGE_SHIFT); 84 unsigned long paddr = (pfn << PAGE_SHIFT);
85 int i; 85 int i;
86 for (i=0; i < lmb.memory.cnt; i++) { 86 for (i=0; i < memblock.memory.cnt; i++) {
87 unsigned long base; 87 unsigned long base;
88 88
89 base = lmb.memory.region[i].base; 89 base = memblock.memory.region[i].base;
90 90
91 if ((paddr >= base) && 91 if ((paddr >= base) &&
92 (paddr < (base + lmb.memory.region[i].size))) { 92 (paddr < (base + memblock.memory.region[i].size))) {
93 return 1; 93 return 1;
94 } 94 }
95 } 95 }
@@ -142,14 +142,14 @@ int arch_add_memory(int nid, u64 start, u64 size)
142/* 142/*
143 * walk_memory_resource() needs to make sure there is no holes in a given 143 * walk_memory_resource() needs to make sure there is no holes in a given
144 * memory range. PPC64 does not maintain the memory layout in /proc/iomem. 144 * memory range. PPC64 does not maintain the memory layout in /proc/iomem.
145 * Instead it maintains it in lmb.memory structures. Walk through the 145 * Instead it maintains it in memblock.memory structures. Walk through the
146 * memory regions, find holes and callback for contiguous regions. 146 * memory regions, find holes and callback for contiguous regions.
147 */ 147 */
148int 148int
149walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages, 149walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages,
150 void *arg, int (*func)(unsigned long, unsigned long, void *)) 150 void *arg, int (*func)(unsigned long, unsigned long, void *))
151{ 151{
152 struct lmb_property res; 152 struct memblock_property res;
153 unsigned long pfn, len; 153 unsigned long pfn, len;
154 u64 end; 154 u64 end;
155 int ret = -1; 155 int ret = -1;
@@ -158,7 +158,7 @@ walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages,
158 res.size = (u64) nr_pages << PAGE_SHIFT; 158 res.size = (u64) nr_pages << PAGE_SHIFT;
159 159
160 end = res.base + res.size - 1; 160 end = res.base + res.size - 1;
161 while ((res.base < end) && (lmb_find(&res) >= 0)) { 161 while ((res.base < end) && (memblock_find(&res) >= 0)) {
162 pfn = (unsigned long)(res.base >> PAGE_SHIFT); 162 pfn = (unsigned long)(res.base >> PAGE_SHIFT);
163 len = (unsigned long)(res.size >> PAGE_SHIFT); 163 len = (unsigned long)(res.size >> PAGE_SHIFT);
164 ret = (*func)(pfn, len, arg); 164 ret = (*func)(pfn, len, arg);
@@ -184,8 +184,8 @@ void __init do_init_bootmem(void)
184 unsigned long total_pages; 184 unsigned long total_pages;
185 int boot_mapsize; 185 int boot_mapsize;
186 186
187 max_low_pfn = max_pfn = lmb_end_of_DRAM() >> PAGE_SHIFT; 187 max_low_pfn = max_pfn = memblock_end_of_DRAM() >> PAGE_SHIFT;
188 total_pages = (lmb_end_of_DRAM() - memstart_addr) >> PAGE_SHIFT; 188 total_pages = (memblock_end_of_DRAM() - memstart_addr) >> PAGE_SHIFT;
189#ifdef CONFIG_HIGHMEM 189#ifdef CONFIG_HIGHMEM
190 total_pages = total_lowmem >> PAGE_SHIFT; 190 total_pages = total_lowmem >> PAGE_SHIFT;
191 max_low_pfn = lowmem_end_addr >> PAGE_SHIFT; 191 max_low_pfn = lowmem_end_addr >> PAGE_SHIFT;
@@ -198,16 +198,16 @@ void __init do_init_bootmem(void)
198 */ 198 */
199 bootmap_pages = bootmem_bootmap_pages(total_pages); 199 bootmap_pages = bootmem_bootmap_pages(total_pages);
200 200
201 start = lmb_alloc(bootmap_pages << PAGE_SHIFT, PAGE_SIZE); 201 start = memblock_alloc(bootmap_pages << PAGE_SHIFT, PAGE_SIZE);
202 202
203 min_low_pfn = MEMORY_START >> PAGE_SHIFT; 203 min_low_pfn = MEMORY_START >> PAGE_SHIFT;
204 boot_mapsize = init_bootmem_node(NODE_DATA(0), start >> PAGE_SHIFT, min_low_pfn, max_low_pfn); 204 boot_mapsize = init_bootmem_node(NODE_DATA(0), start >> PAGE_SHIFT, min_low_pfn, max_low_pfn);
205 205
206 /* Add active regions with valid PFNs */ 206 /* Add active regions with valid PFNs */
207 for (i = 0; i < lmb.memory.cnt; i++) { 207 for (i = 0; i < memblock.memory.cnt; i++) {
208 unsigned long start_pfn, end_pfn; 208 unsigned long start_pfn, end_pfn;
209 start_pfn = lmb.memory.region[i].base >> PAGE_SHIFT; 209 start_pfn = memblock.memory.region[i].base >> PAGE_SHIFT;
210 end_pfn = start_pfn + lmb_size_pages(&lmb.memory, i); 210 end_pfn = start_pfn + memblock_size_pages(&memblock.memory, i);
211 add_active_range(0, start_pfn, end_pfn); 211 add_active_range(0, start_pfn, end_pfn);
212 } 212 }
213 213
@@ -218,17 +218,17 @@ void __init do_init_bootmem(void)
218 free_bootmem_with_active_regions(0, lowmem_end_addr >> PAGE_SHIFT); 218 free_bootmem_with_active_regions(0, lowmem_end_addr >> PAGE_SHIFT);
219 219
220 /* reserve the sections we're already using */ 220 /* reserve the sections we're already using */
221 for (i = 0; i < lmb.reserved.cnt; i++) { 221 for (i = 0; i < memblock.reserved.cnt; i++) {
222 unsigned long addr = lmb.reserved.region[i].base + 222 unsigned long addr = memblock.reserved.region[i].base +
223 lmb_size_bytes(&lmb.reserved, i) - 1; 223 memblock_size_bytes(&memblock.reserved, i) - 1;
224 if (addr < lowmem_end_addr) 224 if (addr < lowmem_end_addr)
225 reserve_bootmem(lmb.reserved.region[i].base, 225 reserve_bootmem(memblock.reserved.region[i].base,
226 lmb_size_bytes(&lmb.reserved, i), 226 memblock_size_bytes(&memblock.reserved, i),
227 BOOTMEM_DEFAULT); 227 BOOTMEM_DEFAULT);
228 else if (lmb.reserved.region[i].base < lowmem_end_addr) { 228 else if (memblock.reserved.region[i].base < lowmem_end_addr) {
229 unsigned long adjusted_size = lowmem_end_addr - 229 unsigned long adjusted_size = lowmem_end_addr -
230 lmb.reserved.region[i].base; 230 memblock.reserved.region[i].base;
231 reserve_bootmem(lmb.reserved.region[i].base, 231 reserve_bootmem(memblock.reserved.region[i].base,
232 adjusted_size, BOOTMEM_DEFAULT); 232 adjusted_size, BOOTMEM_DEFAULT);
233 } 233 }
234 } 234 }
@@ -236,9 +236,9 @@ void __init do_init_bootmem(void)
236 free_bootmem_with_active_regions(0, max_pfn); 236 free_bootmem_with_active_regions(0, max_pfn);
237 237
238 /* reserve the sections we're already using */ 238 /* reserve the sections we're already using */
239 for (i = 0; i < lmb.reserved.cnt; i++) 239 for (i = 0; i < memblock.reserved.cnt; i++)
240 reserve_bootmem(lmb.reserved.region[i].base, 240 reserve_bootmem(memblock.reserved.region[i].base,
241 lmb_size_bytes(&lmb.reserved, i), 241 memblock_size_bytes(&memblock.reserved, i),
242 BOOTMEM_DEFAULT); 242 BOOTMEM_DEFAULT);
243 243
244#endif 244#endif
@@ -251,20 +251,20 @@ void __init do_init_bootmem(void)
251/* mark pages that don't exist as nosave */ 251/* mark pages that don't exist as nosave */
252static int __init mark_nonram_nosave(void) 252static int __init mark_nonram_nosave(void)
253{ 253{
254 unsigned long lmb_next_region_start_pfn, 254 unsigned long memblock_next_region_start_pfn,
255 lmb_region_max_pfn; 255 memblock_region_max_pfn;
256 int i; 256 int i;
257 257
258 for (i = 0; i < lmb.memory.cnt - 1; i++) { 258 for (i = 0; i < memblock.memory.cnt - 1; i++) {
259 lmb_region_max_pfn = 259 memblock_region_max_pfn =
260 (lmb.memory.region[i].base >> PAGE_SHIFT) + 260 (memblock.memory.region[i].base >> PAGE_SHIFT) +
261 (lmb.memory.region[i].size >> PAGE_SHIFT); 261 (memblock.memory.region[i].size >> PAGE_SHIFT);
262 lmb_next_region_start_pfn = 262 memblock_next_region_start_pfn =
263 lmb.memory.region[i+1].base >> PAGE_SHIFT; 263 memblock.memory.region[i+1].base >> PAGE_SHIFT;
264 264
265 if (lmb_region_max_pfn < lmb_next_region_start_pfn) 265 if (memblock_region_max_pfn < memblock_next_region_start_pfn)
266 register_nosave_region(lmb_region_max_pfn, 266 register_nosave_region(memblock_region_max_pfn,
267 lmb_next_region_start_pfn); 267 memblock_next_region_start_pfn);
268 } 268 }
269 269
270 return 0; 270 return 0;
@@ -275,8 +275,8 @@ static int __init mark_nonram_nosave(void)
275 */ 275 */
276void __init paging_init(void) 276void __init paging_init(void)
277{ 277{
278 unsigned long total_ram = lmb_phys_mem_size(); 278 unsigned long total_ram = memblock_phys_mem_size();
279 phys_addr_t top_of_ram = lmb_end_of_DRAM(); 279 phys_addr_t top_of_ram = memblock_end_of_DRAM();
280 unsigned long max_zone_pfns[MAX_NR_ZONES]; 280 unsigned long max_zone_pfns[MAX_NR_ZONES];
281 281
282#ifdef CONFIG_PPC32 282#ifdef CONFIG_PPC32
@@ -327,7 +327,7 @@ void __init mem_init(void)
327 swiotlb_init(1); 327 swiotlb_init(1);
328#endif 328#endif
329 329
330 num_physpages = lmb.memory.size >> PAGE_SHIFT; 330 num_physpages = memblock.memory.size >> PAGE_SHIFT;
331 high_memory = (void *) __va(max_low_pfn * PAGE_SIZE); 331 high_memory = (void *) __va(max_low_pfn * PAGE_SIZE);
332 332
333#ifdef CONFIG_NEED_MULTIPLE_NODES 333#ifdef CONFIG_NEED_MULTIPLE_NODES
@@ -364,7 +364,7 @@ void __init mem_init(void)
364 highmem_mapnr = lowmem_end_addr >> PAGE_SHIFT; 364 highmem_mapnr = lowmem_end_addr >> PAGE_SHIFT;
365 for (pfn = highmem_mapnr; pfn < max_mapnr; ++pfn) { 365 for (pfn = highmem_mapnr; pfn < max_mapnr; ++pfn) {
366 struct page *page = pfn_to_page(pfn); 366 struct page *page = pfn_to_page(pfn);
367 if (lmb_is_reserved(pfn << PAGE_SHIFT)) 367 if (memblock_is_reserved(pfn << PAGE_SHIFT))
368 continue; 368 continue;
369 ClearPageReserved(page); 369 ClearPageReserved(page);
370 init_page_count(page); 370 init_page_count(page);
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index f78f19e0a2a4..338c6f39eab2 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -17,7 +17,7 @@
17#include <linux/nodemask.h> 17#include <linux/nodemask.h>
18#include <linux/cpu.h> 18#include <linux/cpu.h>
19#include <linux/notifier.h> 19#include <linux/notifier.h>
20#include <linux/lmb.h> 20#include <linux/memblock.h>
21#include <linux/of.h> 21#include <linux/of.h>
22#include <linux/pfn.h> 22#include <linux/pfn.h>
23#include <asm/sparsemem.h> 23#include <asm/sparsemem.h>
@@ -407,7 +407,7 @@ struct of_drconf_cell {
407#define DRCONF_MEM_RESERVED 0x00000080 407#define DRCONF_MEM_RESERVED 0x00000080
408 408
409/* 409/*
410 * Read the next lmb list entry from the ibm,dynamic-memory property 410 * Read the next memblock list entry from the ibm,dynamic-memory property
411 * and return the information in the provided of_drconf_cell structure. 411 * and return the information in the provided of_drconf_cell structure.
412 */ 412 */
413static void read_drconf_cell(struct of_drconf_cell *drmem, const u32 **cellp) 413static void read_drconf_cell(struct of_drconf_cell *drmem, const u32 **cellp)
@@ -428,8 +428,8 @@ static void read_drconf_cell(struct of_drconf_cell *drmem, const u32 **cellp)
428/* 428/*
429 * Retreive and validate the ibm,dynamic-memory property of the device tree. 429 * Retreive and validate the ibm,dynamic-memory property of the device tree.
430 * 430 *
431 * The layout of the ibm,dynamic-memory property is a number N of lmb 431 * The layout of the ibm,dynamic-memory property is a number N of memblock
432 * list entries followed by N lmb list entries. Each lmb list entry 432 * list entries followed by N memblock list entries. Each memblock list entry
433 * contains information as layed out in the of_drconf_cell struct above. 433 * contains information as layed out in the of_drconf_cell struct above.
434 */ 434 */
435static int of_get_drconf_memory(struct device_node *memory, const u32 **dm) 435static int of_get_drconf_memory(struct device_node *memory, const u32 **dm)
@@ -454,15 +454,15 @@ static int of_get_drconf_memory(struct device_node *memory, const u32 **dm)
454} 454}
455 455
456/* 456/*
457 * Retreive and validate the ibm,lmb-size property for drconf memory 457 * Retreive and validate the ibm,memblock-size property for drconf memory
458 * from the device tree. 458 * from the device tree.
459 */ 459 */
460static u64 of_get_lmb_size(struct device_node *memory) 460static u64 of_get_memblock_size(struct device_node *memory)
461{ 461{
462 const u32 *prop; 462 const u32 *prop;
463 u32 len; 463 u32 len;
464 464
465 prop = of_get_property(memory, "ibm,lmb-size", &len); 465 prop = of_get_property(memory, "ibm,memblock-size", &len);
466 if (!prop || len < sizeof(unsigned int)) 466 if (!prop || len < sizeof(unsigned int))
467 return 0; 467 return 0;
468 468
@@ -596,19 +596,19 @@ static unsigned long __init numa_enforce_memory_limit(unsigned long start,
596 unsigned long size) 596 unsigned long size)
597{ 597{
598 /* 598 /*
599 * We use lmb_end_of_DRAM() in here instead of memory_limit because 599 * We use memblock_end_of_DRAM() in here instead of memory_limit because
600 * we've already adjusted it for the limit and it takes care of 600 * we've already adjusted it for the limit and it takes care of
601 * having memory holes below the limit. Also, in the case of 601 * having memory holes below the limit. Also, in the case of
602 * iommu_is_off, memory_limit is not set but is implicitly enforced. 602 * iommu_is_off, memory_limit is not set but is implicitly enforced.
603 */ 603 */
604 604
605 if (start + size <= lmb_end_of_DRAM()) 605 if (start + size <= memblock_end_of_DRAM())
606 return size; 606 return size;
607 607
608 if (start >= lmb_end_of_DRAM()) 608 if (start >= memblock_end_of_DRAM())
609 return 0; 609 return 0;
610 610
611 return lmb_end_of_DRAM() - start; 611 return memblock_end_of_DRAM() - start;
612} 612}
613 613
614/* 614/*
@@ -618,7 +618,7 @@ static unsigned long __init numa_enforce_memory_limit(unsigned long start,
618static inline int __init read_usm_ranges(const u32 **usm) 618static inline int __init read_usm_ranges(const u32 **usm)
619{ 619{
620 /* 620 /*
621 * For each lmb in ibm,dynamic-memory a corresponding 621 * For each memblock in ibm,dynamic-memory a corresponding
622 * entry in linux,drconf-usable-memory property contains 622 * entry in linux,drconf-usable-memory property contains
623 * a counter followed by that many (base, size) duple. 623 * a counter followed by that many (base, size) duple.
624 * read the counter from linux,drconf-usable-memory 624 * read the counter from linux,drconf-usable-memory
@@ -634,7 +634,7 @@ static void __init parse_drconf_memory(struct device_node *memory)
634{ 634{
635 const u32 *dm, *usm; 635 const u32 *dm, *usm;
636 unsigned int n, rc, ranges, is_kexec_kdump = 0; 636 unsigned int n, rc, ranges, is_kexec_kdump = 0;
637 unsigned long lmb_size, base, size, sz; 637 unsigned long memblock_size, base, size, sz;
638 int nid; 638 int nid;
639 struct assoc_arrays aa; 639 struct assoc_arrays aa;
640 640
@@ -642,8 +642,8 @@ static void __init parse_drconf_memory(struct device_node *memory)
642 if (!n) 642 if (!n)
643 return; 643 return;
644 644
645 lmb_size = of_get_lmb_size(memory); 645 memblock_size = of_get_memblock_size(memory);
646 if (!lmb_size) 646 if (!memblock_size)
647 return; 647 return;
648 648
649 rc = of_get_assoc_arrays(memory, &aa); 649 rc = of_get_assoc_arrays(memory, &aa);
@@ -667,7 +667,7 @@ static void __init parse_drconf_memory(struct device_node *memory)
667 continue; 667 continue;
668 668
669 base = drmem.base_addr; 669 base = drmem.base_addr;
670 size = lmb_size; 670 size = memblock_size;
671 ranges = 1; 671 ranges = 1;
672 672
673 if (is_kexec_kdump) { 673 if (is_kexec_kdump) {
@@ -787,7 +787,7 @@ new_range:
787 } 787 }
788 788
789 /* 789 /*
790 * Now do the same thing for each LMB listed in the ibm,dynamic-memory 790 * Now do the same thing for each MEMBLOCK listed in the ibm,dynamic-memory
791 * property in the ibm,dynamic-reconfiguration-memory node. 791 * property in the ibm,dynamic-reconfiguration-memory node.
792 */ 792 */
793 memory = of_find_node_by_path("/ibm,dynamic-reconfiguration-memory"); 793 memory = of_find_node_by_path("/ibm,dynamic-reconfiguration-memory");
@@ -799,8 +799,8 @@ new_range:
799 799
800static void __init setup_nonnuma(void) 800static void __init setup_nonnuma(void)
801{ 801{
802 unsigned long top_of_ram = lmb_end_of_DRAM(); 802 unsigned long top_of_ram = memblock_end_of_DRAM();
803 unsigned long total_ram = lmb_phys_mem_size(); 803 unsigned long total_ram = memblock_phys_mem_size();
804 unsigned long start_pfn, end_pfn; 804 unsigned long start_pfn, end_pfn;
805 unsigned int i, nid = 0; 805 unsigned int i, nid = 0;
806 806
@@ -809,9 +809,9 @@ static void __init setup_nonnuma(void)
809 printk(KERN_DEBUG "Memory hole size: %ldMB\n", 809 printk(KERN_DEBUG "Memory hole size: %ldMB\n",
810 (top_of_ram - total_ram) >> 20); 810 (top_of_ram - total_ram) >> 20);
811 811
812 for (i = 0; i < lmb.memory.cnt; ++i) { 812 for (i = 0; i < memblock.memory.cnt; ++i) {
813 start_pfn = lmb.memory.region[i].base >> PAGE_SHIFT; 813 start_pfn = memblock.memory.region[i].base >> PAGE_SHIFT;
814 end_pfn = start_pfn + lmb_size_pages(&lmb.memory, i); 814 end_pfn = start_pfn + memblock_size_pages(&memblock.memory, i);
815 815
816 fake_numa_create_new_node(end_pfn, &nid); 816 fake_numa_create_new_node(end_pfn, &nid);
817 add_active_range(nid, start_pfn, end_pfn); 817 add_active_range(nid, start_pfn, end_pfn);
@@ -869,7 +869,7 @@ static void __init dump_numa_memory_topology(void)
869 869
870 count = 0; 870 count = 0;
871 871
872 for (i = 0; i < lmb_end_of_DRAM(); 872 for (i = 0; i < memblock_end_of_DRAM();
873 i += (1 << SECTION_SIZE_BITS)) { 873 i += (1 << SECTION_SIZE_BITS)) {
874 if (early_pfn_to_nid(i >> PAGE_SHIFT) == node) { 874 if (early_pfn_to_nid(i >> PAGE_SHIFT) == node) {
875 if (count == 0) 875 if (count == 0)
@@ -889,7 +889,7 @@ static void __init dump_numa_memory_topology(void)
889} 889}
890 890
891/* 891/*
892 * Allocate some memory, satisfying the lmb or bootmem allocator where 892 * Allocate some memory, satisfying the memblock or bootmem allocator where
893 * required. nid is the preferred node and end is the physical address of 893 * required. nid is the preferred node and end is the physical address of
894 * the highest address in the node. 894 * the highest address in the node.
895 * 895 *
@@ -903,11 +903,11 @@ static void __init *careful_zallocation(int nid, unsigned long size,
903 int new_nid; 903 int new_nid;
904 unsigned long ret_paddr; 904 unsigned long ret_paddr;
905 905
906 ret_paddr = __lmb_alloc_base(size, align, end_pfn << PAGE_SHIFT); 906 ret_paddr = __memblock_alloc_base(size, align, end_pfn << PAGE_SHIFT);
907 907
908 /* retry over all memory */ 908 /* retry over all memory */
909 if (!ret_paddr) 909 if (!ret_paddr)
910 ret_paddr = __lmb_alloc_base(size, align, lmb_end_of_DRAM()); 910 ret_paddr = __memblock_alloc_base(size, align, memblock_end_of_DRAM());
911 911
912 if (!ret_paddr) 912 if (!ret_paddr)
913 panic("numa.c: cannot allocate %lu bytes for node %d", 913 panic("numa.c: cannot allocate %lu bytes for node %d",
@@ -917,14 +917,14 @@ static void __init *careful_zallocation(int nid, unsigned long size,
917 917
918 /* 918 /*
919 * We initialize the nodes in numeric order: 0, 1, 2... 919 * We initialize the nodes in numeric order: 0, 1, 2...
920 * and hand over control from the LMB allocator to the 920 * and hand over control from the MEMBLOCK allocator to the
921 * bootmem allocator. If this function is called for 921 * bootmem allocator. If this function is called for
922 * node 5, then we know that all nodes <5 are using the 922 * node 5, then we know that all nodes <5 are using the
923 * bootmem allocator instead of the LMB allocator. 923 * bootmem allocator instead of the MEMBLOCK allocator.
924 * 924 *
925 * So, check the nid from which this allocation came 925 * So, check the nid from which this allocation came
926 * and double check to see if we need to use bootmem 926 * and double check to see if we need to use bootmem
927 * instead of the LMB. We don't free the LMB memory 927 * instead of the MEMBLOCK. We don't free the MEMBLOCK memory
928 * since it would be useless. 928 * since it would be useless.
929 */ 929 */
930 new_nid = early_pfn_to_nid(ret_paddr >> PAGE_SHIFT); 930 new_nid = early_pfn_to_nid(ret_paddr >> PAGE_SHIFT);
@@ -949,9 +949,9 @@ static void mark_reserved_regions_for_nid(int nid)
949 struct pglist_data *node = NODE_DATA(nid); 949 struct pglist_data *node = NODE_DATA(nid);
950 int i; 950 int i;
951 951
952 for (i = 0; i < lmb.reserved.cnt; i++) { 952 for (i = 0; i < memblock.reserved.cnt; i++) {
953 unsigned long physbase = lmb.reserved.region[i].base; 953 unsigned long physbase = memblock.reserved.region[i].base;
954 unsigned long size = lmb.reserved.region[i].size; 954 unsigned long size = memblock.reserved.region[i].size;
955 unsigned long start_pfn = physbase >> PAGE_SHIFT; 955 unsigned long start_pfn = physbase >> PAGE_SHIFT;
956 unsigned long end_pfn = PFN_UP(physbase + size); 956 unsigned long end_pfn = PFN_UP(physbase + size);
957 struct node_active_region node_ar; 957 struct node_active_region node_ar;
@@ -959,7 +959,7 @@ static void mark_reserved_regions_for_nid(int nid)
959 node->node_spanned_pages; 959 node->node_spanned_pages;
960 960
961 /* 961 /*
962 * Check to make sure that this lmb.reserved area is 962 * Check to make sure that this memblock.reserved area is
963 * within the bounds of the node that we care about. 963 * within the bounds of the node that we care about.
964 * Checking the nid of the start and end points is not 964 * Checking the nid of the start and end points is not
965 * sufficient because the reserved area could span the 965 * sufficient because the reserved area could span the
@@ -1017,7 +1017,7 @@ void __init do_init_bootmem(void)
1017 int nid; 1017 int nid;
1018 1018
1019 min_low_pfn = 0; 1019 min_low_pfn = 0;
1020 max_low_pfn = lmb_end_of_DRAM() >> PAGE_SHIFT; 1020 max_low_pfn = memblock_end_of_DRAM() >> PAGE_SHIFT;
1021 max_pfn = max_low_pfn; 1021 max_pfn = max_low_pfn;
1022 1022
1023 if (parse_numa_properties()) 1023 if (parse_numa_properties())
@@ -1094,7 +1094,7 @@ void __init paging_init(void)
1094{ 1094{
1095 unsigned long max_zone_pfns[MAX_NR_ZONES]; 1095 unsigned long max_zone_pfns[MAX_NR_ZONES];
1096 memset(max_zone_pfns, 0, sizeof(max_zone_pfns)); 1096 memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
1097 max_zone_pfns[ZONE_DMA] = lmb_end_of_DRAM() >> PAGE_SHIFT; 1097 max_zone_pfns[ZONE_DMA] = memblock_end_of_DRAM() >> PAGE_SHIFT;
1098 free_area_init_nodes(max_zone_pfns); 1098 free_area_init_nodes(max_zone_pfns);
1099} 1099}
1100 1100
@@ -1128,7 +1128,7 @@ static int hot_add_drconf_scn_to_nid(struct device_node *memory,
1128{ 1128{
1129 const u32 *dm; 1129 const u32 *dm;
1130 unsigned int drconf_cell_cnt, rc; 1130 unsigned int drconf_cell_cnt, rc;
1131 unsigned long lmb_size; 1131 unsigned long memblock_size;
1132 struct assoc_arrays aa; 1132 struct assoc_arrays aa;
1133 int nid = -1; 1133 int nid = -1;
1134 1134
@@ -1136,8 +1136,8 @@ static int hot_add_drconf_scn_to_nid(struct device_node *memory,
1136 if (!drconf_cell_cnt) 1136 if (!drconf_cell_cnt)
1137 return -1; 1137 return -1;
1138 1138
1139 lmb_size = of_get_lmb_size(memory); 1139 memblock_size = of_get_memblock_size(memory);
1140 if (!lmb_size) 1140 if (!memblock_size)
1141 return -1; 1141 return -1;
1142 1142
1143 rc = of_get_assoc_arrays(memory, &aa); 1143 rc = of_get_assoc_arrays(memory, &aa);
@@ -1156,7 +1156,7 @@ static int hot_add_drconf_scn_to_nid(struct device_node *memory,
1156 continue; 1156 continue;
1157 1157
1158 if ((scn_addr < drmem.base_addr) 1158 if ((scn_addr < drmem.base_addr)
1159 || (scn_addr >= (drmem.base_addr + lmb_size))) 1159 || (scn_addr >= (drmem.base_addr + memblock_size)))
1160 continue; 1160 continue;
1161 1161
1162 nid = of_drconf_to_nid_single(&drmem, &aa); 1162 nid = of_drconf_to_nid_single(&drmem, &aa);
@@ -1169,7 +1169,7 @@ static int hot_add_drconf_scn_to_nid(struct device_node *memory,
1169/* 1169/*
1170 * Find the node associated with a hot added memory section for memory 1170 * Find the node associated with a hot added memory section for memory
1171 * represented in the device tree as a node (i.e. memory@XXXX) for 1171 * represented in the device tree as a node (i.e. memory@XXXX) for
1172 * each lmb. 1172 * each memblock.
1173 */ 1173 */
1174int hot_add_node_scn_to_nid(unsigned long scn_addr) 1174int hot_add_node_scn_to_nid(unsigned long scn_addr)
1175{ 1175{
@@ -1210,8 +1210,8 @@ int hot_add_node_scn_to_nid(unsigned long scn_addr)
1210 1210
1211/* 1211/*
1212 * Find the node associated with a hot added memory section. Section 1212 * Find the node associated with a hot added memory section. Section
1213 * corresponds to a SPARSEMEM section, not an LMB. It is assumed that 1213 * corresponds to a SPARSEMEM section, not an MEMBLOCK. It is assumed that
1214 * sections are fully contained within a single LMB. 1214 * sections are fully contained within a single MEMBLOCK.
1215 */ 1215 */
1216int hot_add_scn_to_nid(unsigned long scn_addr) 1216int hot_add_scn_to_nid(unsigned long scn_addr)
1217{ 1217{
diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c
index 34347b2e7e31..a87ead0138b4 100644
--- a/arch/powerpc/mm/pgtable_32.c
+++ b/arch/powerpc/mm/pgtable_32.c
@@ -26,7 +26,7 @@
26#include <linux/vmalloc.h> 26#include <linux/vmalloc.h>
27#include <linux/init.h> 27#include <linux/init.h>
28#include <linux/highmem.h> 28#include <linux/highmem.h>
29#include <linux/lmb.h> 29#include <linux/memblock.h>
30#include <linux/slab.h> 30#include <linux/slab.h>
31 31
32#include <asm/pgtable.h> 32#include <asm/pgtable.h>
@@ -198,7 +198,7 @@ __ioremap_caller(phys_addr_t addr, unsigned long size, unsigned long flags,
198 * mem_init() sets high_memory so only do the check after that. 198 * mem_init() sets high_memory so only do the check after that.
199 */ 199 */
200 if (mem_init_done && (p < virt_to_phys(high_memory)) && 200 if (mem_init_done && (p < virt_to_phys(high_memory)) &&
201 !(__allow_ioremap_reserved && lmb_is_region_reserved(p, size))) { 201 !(__allow_ioremap_reserved && memblock_is_region_reserved(p, size))) {
202 printk("__ioremap(): phys addr 0x%llx is RAM lr %p\n", 202 printk("__ioremap(): phys addr 0x%llx is RAM lr %p\n",
203 (unsigned long long)p, __builtin_return_address(0)); 203 (unsigned long long)p, __builtin_return_address(0));
204 return NULL; 204 return NULL;
@@ -331,7 +331,7 @@ void __init mapin_ram(void)
331 s = mmu_mapin_ram(top); 331 s = mmu_mapin_ram(top);
332 __mapin_ram_chunk(s, top); 332 __mapin_ram_chunk(s, top);
333 333
334 top = lmb_end_of_DRAM(); 334 top = memblock_end_of_DRAM();
335 s = wii_mmu_mapin_mem2(top); 335 s = wii_mmu_mapin_mem2(top);
336 __mapin_ram_chunk(s, top); 336 __mapin_ram_chunk(s, top);
337 } 337 }
diff --git a/arch/powerpc/mm/pgtable_64.c b/arch/powerpc/mm/pgtable_64.c
index d050fc8d9714..21d6dfab7942 100644
--- a/arch/powerpc/mm/pgtable_64.c
+++ b/arch/powerpc/mm/pgtable_64.c
@@ -34,7 +34,7 @@
34#include <linux/vmalloc.h> 34#include <linux/vmalloc.h>
35#include <linux/init.h> 35#include <linux/init.h>
36#include <linux/bootmem.h> 36#include <linux/bootmem.h>
37#include <linux/lmb.h> 37#include <linux/memblock.h>
38#include <linux/slab.h> 38#include <linux/slab.h>
39 39
40#include <asm/pgalloc.h> 40#include <asm/pgalloc.h>
@@ -67,7 +67,7 @@ static void *early_alloc_pgtable(unsigned long size)
67 if (init_bootmem_done) 67 if (init_bootmem_done)
68 pt = __alloc_bootmem(size, size, __pa(MAX_DMA_ADDRESS)); 68 pt = __alloc_bootmem(size, size, __pa(MAX_DMA_ADDRESS));
69 else 69 else
70 pt = __va(lmb_alloc_base(size, size, 70 pt = __va(memblock_alloc_base(size, size,
71 __pa(MAX_DMA_ADDRESS))); 71 __pa(MAX_DMA_ADDRESS)));
72 memset(pt, 0, size); 72 memset(pt, 0, size);
73 73
diff --git a/arch/powerpc/mm/ppc_mmu_32.c b/arch/powerpc/mm/ppc_mmu_32.c
index f11c2cdcb0fe..f8a01829d64f 100644
--- a/arch/powerpc/mm/ppc_mmu_32.c
+++ b/arch/powerpc/mm/ppc_mmu_32.c
@@ -26,7 +26,7 @@
26#include <linux/mm.h> 26#include <linux/mm.h>
27#include <linux/init.h> 27#include <linux/init.h>
28#include <linux/highmem.h> 28#include <linux/highmem.h>
29#include <linux/lmb.h> 29#include <linux/memblock.h>
30 30
31#include <asm/prom.h> 31#include <asm/prom.h>
32#include <asm/mmu.h> 32#include <asm/mmu.h>
@@ -223,7 +223,7 @@ void __init MMU_init_hw(void)
223 * Find some memory for the hash table. 223 * Find some memory for the hash table.
224 */ 224 */
225 if ( ppc_md.progress ) ppc_md.progress("hash:find piece", 0x322); 225 if ( ppc_md.progress ) ppc_md.progress("hash:find piece", 0x322);
226 Hash = __va(lmb_alloc_base(Hash_size, Hash_size, 226 Hash = __va(memblock_alloc_base(Hash_size, Hash_size,
227 __initial_memory_limit_addr)); 227 __initial_memory_limit_addr));
228 cacheable_memzero(Hash, Hash_size); 228 cacheable_memzero(Hash, Hash_size);
229 _SDR1 = __pa(Hash) | SDR1_LOW_BITS; 229 _SDR1 = __pa(Hash) | SDR1_LOW_BITS;
diff --git a/arch/powerpc/mm/stab.c b/arch/powerpc/mm/stab.c
index 687fddaa24c5..446a01842a73 100644
--- a/arch/powerpc/mm/stab.c
+++ b/arch/powerpc/mm/stab.c
@@ -12,7 +12,7 @@
12 * 2 of the License, or (at your option) any later version. 12 * 2 of the License, or (at your option) any later version.
13 */ 13 */
14 14
15#include <linux/lmb.h> 15#include <linux/memblock.h>
16 16
17#include <asm/pgtable.h> 17#include <asm/pgtable.h>
18#include <asm/mmu.h> 18#include <asm/mmu.h>
@@ -252,7 +252,7 @@ void __init stabs_alloc(void)
252 if (cpu == 0) 252 if (cpu == 0)
253 continue; /* stab for CPU 0 is statically allocated */ 253 continue; /* stab for CPU 0 is statically allocated */
254 254
255 newstab = lmb_alloc_base(HW_PAGE_SIZE, HW_PAGE_SIZE, 255 newstab = memblock_alloc_base(HW_PAGE_SIZE, HW_PAGE_SIZE,
256 1<<SID_SHIFT); 256 1<<SID_SHIFT);
257 newstab = (unsigned long)__va(newstab); 257 newstab = (unsigned long)__va(newstab);
258 258
diff --git a/arch/powerpc/mm/tlb_nohash.c b/arch/powerpc/mm/tlb_nohash.c
index 3b10f804b735..fe391e942521 100644
--- a/arch/powerpc/mm/tlb_nohash.c
+++ b/arch/powerpc/mm/tlb_nohash.c
@@ -34,7 +34,7 @@
34#include <linux/pagemap.h> 34#include <linux/pagemap.h>
35#include <linux/preempt.h> 35#include <linux/preempt.h>
36#include <linux/spinlock.h> 36#include <linux/spinlock.h>
37#include <linux/lmb.h> 37#include <linux/memblock.h>
38 38
39#include <asm/tlbflush.h> 39#include <asm/tlbflush.h>
40#include <asm/tlb.h> 40#include <asm/tlb.h>
@@ -503,7 +503,7 @@ static void __early_init_mmu(int boot_cpu)
503 /* Set the global containing the top of the linear mapping 503 /* Set the global containing the top of the linear mapping
504 * for use by the TLB miss code 504 * for use by the TLB miss code
505 */ 505 */
506 linear_map_top = lmb_end_of_DRAM(); 506 linear_map_top = memblock_end_of_DRAM();
507 507
508 /* A sync won't hurt us after mucking around with 508 /* A sync won't hurt us after mucking around with
509 * the MMU configuration 509 * the MMU configuration
diff --git a/arch/powerpc/platforms/512x/Kconfig b/arch/powerpc/platforms/512x/Kconfig
index 4dac9b0525a4..27b0651221d1 100644
--- a/arch/powerpc/platforms/512x/Kconfig
+++ b/arch/powerpc/platforms/512x/Kconfig
@@ -1,32 +1,34 @@
1config PPC_MPC512x 1config PPC_MPC512x
2 bool 2 bool "512x-based boards"
3 depends on 6xx
3 select FSL_SOC 4 select FSL_SOC
4 select IPIC 5 select IPIC
5 select PPC_CLOCK 6 select PPC_CLOCK
6 select PPC_PCI_CHOICE 7 select PPC_PCI_CHOICE
7 select FSL_PCI if PCI 8 select FSL_PCI if PCI
8 9
9config PPC_MPC5121
10 bool
11 select PPC_MPC512x
12
13config MPC5121_ADS 10config MPC5121_ADS
14 bool "Freescale MPC5121E ADS" 11 bool "Freescale MPC5121E ADS"
15 depends on 6xx 12 depends on PPC_MPC512x
16 select DEFAULT_UIMAGE 13 select DEFAULT_UIMAGE
17 select PPC_MPC5121
18 select MPC5121_ADS_CPLD 14 select MPC5121_ADS_CPLD
19 help 15 help
20 This option enables support for the MPC5121E ADS board. 16 This option enables support for the MPC5121E ADS board.
21 17
22config MPC5121_GENERIC 18config MPC5121_GENERIC
23 bool "Generic support for simple MPC5121 based boards" 19 bool "Generic support for simple MPC5121 based boards"
24 depends on 6xx 20 depends on PPC_MPC512x
25 select DEFAULT_UIMAGE 21 select DEFAULT_UIMAGE
26 select PPC_MPC5121
27 help 22 help
28 This option enables support for simple MPC5121 based boards 23 This option enables support for simple MPC5121 based boards
29 which do not need custom platform specific setup. 24 which do not need custom platform specific setup.
30 25
31 Compatible boards include: Protonic LVT base boards (ZANMCU 26 Compatible boards include: Protonic LVT base boards (ZANMCU
32 and VICVT2). 27 and VICVT2).
28
29config PDM360NG
30 bool "ifm PDM360NG board"
31 depends on PPC_MPC512x
32 select DEFAULT_UIMAGE
33 help
34 This option enables support for the PDM360NG board.
diff --git a/arch/powerpc/platforms/512x/Makefile b/arch/powerpc/platforms/512x/Makefile
index 90be2f5717e6..4efc1c4b6fb5 100644
--- a/arch/powerpc/platforms/512x/Makefile
+++ b/arch/powerpc/platforms/512x/Makefile
@@ -4,3 +4,4 @@
4obj-y += clock.o mpc512x_shared.o 4obj-y += clock.o mpc512x_shared.o
5obj-$(CONFIG_MPC5121_ADS) += mpc5121_ads.o mpc5121_ads_cpld.o 5obj-$(CONFIG_MPC5121_ADS) += mpc5121_ads.o mpc5121_ads_cpld.o
6obj-$(CONFIG_MPC5121_GENERIC) += mpc5121_generic.o 6obj-$(CONFIG_MPC5121_GENERIC) += mpc5121_generic.o
7obj-$(CONFIG_PDM360NG) += pdm360ng.o
diff --git a/arch/powerpc/platforms/512x/clock.c b/arch/powerpc/platforms/512x/clock.c
index 4c42246b86a7..e1c5cd6650b1 100644
--- a/arch/powerpc/platforms/512x/clock.c
+++ b/arch/powerpc/platforms/512x/clock.c
@@ -292,6 +292,15 @@ static void diu_clk_calc(struct clk *clk)
292 clk->rate = rate; 292 clk->rate = rate;
293} 293}
294 294
295static void viu_clk_calc(struct clk *clk)
296{
297 unsigned long rate;
298
299 rate = sys_clk.rate;
300 rate /= 2;
301 clk->rate = rate;
302}
303
295static void half_clk_calc(struct clk *clk) 304static void half_clk_calc(struct clk *clk)
296{ 305{
297 clk->rate = clk->parent->rate / 2; 306 clk->rate = clk->parent->rate / 2;
@@ -412,6 +421,14 @@ static struct clk diu_clk = {
412 .calc = diu_clk_calc, 421 .calc = diu_clk_calc,
413}; 422};
414 423
424static struct clk viu_clk = {
425 .name = "viu_clk",
426 .flags = CLK_HAS_CTRL,
427 .reg = 1,
428 .bit = 18,
429 .calc = viu_clk_calc,
430};
431
415static struct clk axe_clk = { 432static struct clk axe_clk = {
416 .name = "axe_clk", 433 .name = "axe_clk",
417 .flags = CLK_HAS_CTRL, 434 .flags = CLK_HAS_CTRL,
@@ -535,6 +552,7 @@ struct clk *rate_clks[] = {
535 &ref_clk, 552 &ref_clk,
536 &sys_clk, 553 &sys_clk,
537 &diu_clk, 554 &diu_clk,
555 &viu_clk,
538 &csb_clk, 556 &csb_clk,
539 &e300_clk, 557 &e300_clk,
540 &ips_clk, 558 &ips_clk,
diff --git a/arch/powerpc/platforms/512x/mpc5121_ads.c b/arch/powerpc/platforms/512x/mpc5121_ads.c
index ee6ae129c25c..dcef6ade48e1 100644
--- a/arch/powerpc/platforms/512x/mpc5121_ads.c
+++ b/arch/powerpc/platforms/512x/mpc5121_ads.c
@@ -42,6 +42,7 @@ static void __init mpc5121_ads_setup_arch(void)
42 for_each_compatible_node(np, "pci", "fsl,mpc5121-pci") 42 for_each_compatible_node(np, "pci", "fsl,mpc5121-pci")
43 mpc83xx_add_bridge(np); 43 mpc83xx_add_bridge(np);
44#endif 44#endif
45 mpc512x_setup_diu();
45} 46}
46 47
47static void __init mpc5121_ads_init_IRQ(void) 48static void __init mpc5121_ads_init_IRQ(void)
@@ -65,6 +66,7 @@ define_machine(mpc5121_ads) {
65 .probe = mpc5121_ads_probe, 66 .probe = mpc5121_ads_probe,
66 .setup_arch = mpc5121_ads_setup_arch, 67 .setup_arch = mpc5121_ads_setup_arch,
67 .init = mpc512x_init, 68 .init = mpc512x_init,
69 .init_early = mpc512x_init_diu,
68 .init_IRQ = mpc5121_ads_init_IRQ, 70 .init_IRQ = mpc5121_ads_init_IRQ,
69 .get_irq = ipic_get_irq, 71 .get_irq = ipic_get_irq,
70 .calibrate_decr = generic_calibrate_decr, 72 .calibrate_decr = generic_calibrate_decr,
diff --git a/arch/powerpc/platforms/512x/mpc5121_generic.c b/arch/powerpc/platforms/512x/mpc5121_generic.c
index a6c0e3a2615d..e487eb06ec6b 100644
--- a/arch/powerpc/platforms/512x/mpc5121_generic.c
+++ b/arch/powerpc/platforms/512x/mpc5121_generic.c
@@ -52,6 +52,8 @@ define_machine(mpc5121_generic) {
52 .name = "MPC5121 generic", 52 .name = "MPC5121 generic",
53 .probe = mpc5121_generic_probe, 53 .probe = mpc5121_generic_probe,
54 .init = mpc512x_init, 54 .init = mpc512x_init,
55 .init_early = mpc512x_init_diu,
56 .setup_arch = mpc512x_setup_diu,
55 .init_IRQ = mpc512x_init_IRQ, 57 .init_IRQ = mpc512x_init_IRQ,
56 .get_irq = ipic_get_irq, 58 .get_irq = ipic_get_irq,
57 .calibrate_decr = generic_calibrate_decr, 59 .calibrate_decr = generic_calibrate_decr,
diff --git a/arch/powerpc/platforms/512x/mpc512x.h b/arch/powerpc/platforms/512x/mpc512x.h
index b2daca0d1488..1ab6d11d0b19 100644
--- a/arch/powerpc/platforms/512x/mpc512x.h
+++ b/arch/powerpc/platforms/512x/mpc512x.h
@@ -16,4 +16,6 @@ extern void __init mpc512x_init(void);
16extern int __init mpc5121_clk_init(void); 16extern int __init mpc5121_clk_init(void);
17void __init mpc512x_declare_of_platform_devices(void); 17void __init mpc512x_declare_of_platform_devices(void);
18extern void mpc512x_restart(char *cmd); 18extern void mpc512x_restart(char *cmd);
19extern void mpc512x_init_diu(void);
20extern void mpc512x_setup_diu(void);
19#endif /* __MPC512X_H__ */ 21#endif /* __MPC512X_H__ */
diff --git a/arch/powerpc/platforms/512x/mpc512x_shared.c b/arch/powerpc/platforms/512x/mpc512x_shared.c
index 707e572b7c40..e41ebbdb3e12 100644
--- a/arch/powerpc/platforms/512x/mpc512x_shared.c
+++ b/arch/powerpc/platforms/512x/mpc512x_shared.c
@@ -16,7 +16,11 @@
16#include <linux/io.h> 16#include <linux/io.h>
17#include <linux/irq.h> 17#include <linux/irq.h>
18#include <linux/of_platform.h> 18#include <linux/of_platform.h>
19#include <linux/fsl-diu-fb.h>
20#include <linux/bootmem.h>
21#include <sysdev/fsl_soc.h>
19 22
23#include <asm/cacheflush.h>
20#include <asm/machdep.h> 24#include <asm/machdep.h>
21#include <asm/ipic.h> 25#include <asm/ipic.h>
22#include <asm/prom.h> 26#include <asm/prom.h>
@@ -54,6 +58,286 @@ void mpc512x_restart(char *cmd)
54 ; 58 ;
55} 59}
56 60
61struct fsl_diu_shared_fb {
62 u8 gamma[0x300]; /* 32-bit aligned! */
63 struct diu_ad ad0; /* 32-bit aligned! */
64 phys_addr_t fb_phys;
65 size_t fb_len;
66 bool in_use;
67};
68
69unsigned int mpc512x_get_pixel_format(unsigned int bits_per_pixel,
70 int monitor_port)
71{
72 switch (bits_per_pixel) {
73 case 32:
74 return 0x88883316;
75 case 24:
76 return 0x88082219;
77 case 16:
78 return 0x65053118;
79 }
80 return 0x00000400;
81}
82
83void mpc512x_set_gamma_table(int monitor_port, char *gamma_table_base)
84{
85}
86
87void mpc512x_set_monitor_port(int monitor_port)
88{
89}
90
91#define DIU_DIV_MASK 0x000000ff
92void mpc512x_set_pixel_clock(unsigned int pixclock)
93{
94 unsigned long bestval, bestfreq, speed, busfreq;
95 unsigned long minpixclock, maxpixclock, pixval;
96 struct mpc512x_ccm __iomem *ccm;
97 struct device_node *np;
98 u32 temp;
99 long err;
100 int i;
101
102 np = of_find_compatible_node(NULL, NULL, "fsl,mpc5121-clock");
103 if (!np) {
104 pr_err("Can't find clock control module.\n");
105 return;
106 }
107
108 ccm = of_iomap(np, 0);
109 of_node_put(np);
110 if (!ccm) {
111 pr_err("Can't map clock control module reg.\n");
112 return;
113 }
114
115 np = of_find_node_by_type(NULL, "cpu");
116 if (np) {
117 const unsigned int *prop =
118 of_get_property(np, "bus-frequency", NULL);
119
120 of_node_put(np);
121 if (prop) {
122 busfreq = *prop;
123 } else {
124 pr_err("Can't get bus-frequency property\n");
125 return;
126 }
127 } else {
128 pr_err("Can't find 'cpu' node.\n");
129 return;
130 }
131
132 /* Pixel Clock configuration */
133 pr_debug("DIU: Bus Frequency = %lu\n", busfreq);
134 speed = busfreq * 4; /* DIU_DIV ratio is 4 * CSB_CLK / DIU_CLK */
135
136 /* Calculate the pixel clock with the smallest error */
137 /* calculate the following in steps to avoid overflow */
138 pr_debug("DIU pixclock in ps - %d\n", pixclock);
139 temp = (1000000000 / pixclock) * 1000;
140 pixclock = temp;
141 pr_debug("DIU pixclock freq - %u\n", pixclock);
142
143 temp = temp / 20; /* pixclock * 0.05 */
144 pr_debug("deviation = %d\n", temp);
145 minpixclock = pixclock - temp;
146 maxpixclock = pixclock + temp;
147 pr_debug("DIU minpixclock - %lu\n", minpixclock);
148 pr_debug("DIU maxpixclock - %lu\n", maxpixclock);
149 pixval = speed/pixclock;
150 pr_debug("DIU pixval = %lu\n", pixval);
151
152 err = LONG_MAX;
153 bestval = pixval;
154 pr_debug("DIU bestval = %lu\n", bestval);
155
156 bestfreq = 0;
157 for (i = -1; i <= 1; i++) {
158 temp = speed / (pixval+i);
159 pr_debug("DIU test pixval i=%d, pixval=%lu, temp freq. = %u\n",
160 i, pixval, temp);
161 if ((temp < minpixclock) || (temp > maxpixclock))
162 pr_debug("DIU exceeds monitor range (%lu to %lu)\n",
163 minpixclock, maxpixclock);
164 else if (abs(temp - pixclock) < err) {
165 pr_debug("Entered the else if block %d\n", i);
166 err = abs(temp - pixclock);
167 bestval = pixval + i;
168 bestfreq = temp;
169 }
170 }
171
172 pr_debug("DIU chose = %lx\n", bestval);
173 pr_debug("DIU error = %ld\n NomPixClk ", err);
174 pr_debug("DIU: Best Freq = %lx\n", bestfreq);
175 /* Modify DIU_DIV in CCM SCFR1 */
176 temp = in_be32(&ccm->scfr1);
177 pr_debug("DIU: Current value of SCFR1: 0x%08x\n", temp);
178 temp &= ~DIU_DIV_MASK;
179 temp |= (bestval & DIU_DIV_MASK);
180 out_be32(&ccm->scfr1, temp);
181 pr_debug("DIU: Modified value of SCFR1: 0x%08x\n", temp);
182 iounmap(ccm);
183}
184
185ssize_t mpc512x_show_monitor_port(int monitor_port, char *buf)
186{
187 return sprintf(buf, "0 - 5121 LCD\n");
188}
189
190int mpc512x_set_sysfs_monitor_port(int val)
191{
192 return 0;
193}
194
195static struct fsl_diu_shared_fb __attribute__ ((__aligned__(8))) diu_shared_fb;
196
197#if defined(CONFIG_FB_FSL_DIU) || \
198 defined(CONFIG_FB_FSL_DIU_MODULE)
199static inline void mpc512x_free_bootmem(struct page *page)
200{
201 __ClearPageReserved(page);
202 BUG_ON(PageTail(page));
203 BUG_ON(atomic_read(&page->_count) > 1);
204 atomic_set(&page->_count, 1);
205 __free_page(page);
206 totalram_pages++;
207}
208
209void mpc512x_release_bootmem(void)
210{
211 unsigned long addr = diu_shared_fb.fb_phys & PAGE_MASK;
212 unsigned long size = diu_shared_fb.fb_len;
213 unsigned long start, end;
214
215 if (diu_shared_fb.in_use) {
216 start = PFN_UP(addr);
217 end = PFN_DOWN(addr + size);
218
219 for (; start < end; start++)
220 mpc512x_free_bootmem(pfn_to_page(start));
221
222 diu_shared_fb.in_use = false;
223 }
224 diu_ops.release_bootmem = NULL;
225}
226#endif
227
228/*
229 * Check if DIU was pre-initialized. If so, perform steps
230 * needed to continue displaying through the whole boot process.
231 * Move area descriptor and gamma table elsewhere, they are
232 * destroyed by bootmem allocator otherwise. The frame buffer
233 * address range will be reserved in setup_arch() after bootmem
234 * allocator is up.
235 */
236void __init mpc512x_init_diu(void)
237{
238 struct device_node *np;
239 struct diu __iomem *diu_reg;
240 phys_addr_t desc;
241 void __iomem *vaddr;
242 unsigned long mode, pix_fmt, res, bpp;
243 unsigned long dst;
244
245 np = of_find_compatible_node(NULL, NULL, "fsl,mpc5121-diu");
246 if (!np) {
247 pr_err("No DIU node\n");
248 return;
249 }
250
251 diu_reg = of_iomap(np, 0);
252 of_node_put(np);
253 if (!diu_reg) {
254 pr_err("Can't map DIU\n");
255 return;
256 }
257
258 mode = in_be32(&diu_reg->diu_mode);
259 if (mode != MFB_MODE1) {
260 pr_info("%s: DIU OFF\n", __func__);
261 goto out;
262 }
263
264 desc = in_be32(&diu_reg->desc[0]);
265 vaddr = ioremap(desc, sizeof(struct diu_ad));
266 if (!vaddr) {
267 pr_err("Can't map DIU area desc.\n");
268 goto out;
269 }
270 memcpy(&diu_shared_fb.ad0, vaddr, sizeof(struct diu_ad));
271 /* flush fb area descriptor */
272 dst = (unsigned long)&diu_shared_fb.ad0;
273 flush_dcache_range(dst, dst + sizeof(struct diu_ad) - 1);
274
275 res = in_be32(&diu_reg->disp_size);
276 pix_fmt = in_le32(vaddr);
277 bpp = ((pix_fmt >> 16) & 0x3) + 1;
278 diu_shared_fb.fb_phys = in_le32(vaddr + 4);
279 diu_shared_fb.fb_len = ((res & 0xfff0000) >> 16) * (res & 0xfff) * bpp;
280 diu_shared_fb.in_use = true;
281 iounmap(vaddr);
282
283 desc = in_be32(&diu_reg->gamma);
284 vaddr = ioremap(desc, sizeof(diu_shared_fb.gamma));
285 if (!vaddr) {
286 pr_err("Can't map DIU area desc.\n");
287 diu_shared_fb.in_use = false;
288 goto out;
289 }
290 memcpy(&diu_shared_fb.gamma, vaddr, sizeof(diu_shared_fb.gamma));
291 /* flush gamma table */
292 dst = (unsigned long)&diu_shared_fb.gamma;
293 flush_dcache_range(dst, dst + sizeof(diu_shared_fb.gamma) - 1);
294
295 iounmap(vaddr);
296 out_be32(&diu_reg->gamma, virt_to_phys(&diu_shared_fb.gamma));
297 out_be32(&diu_reg->desc[1], 0);
298 out_be32(&diu_reg->desc[2], 0);
299 out_be32(&diu_reg->desc[0], virt_to_phys(&diu_shared_fb.ad0));
300
301out:
302 iounmap(diu_reg);
303}
304
305void __init mpc512x_setup_diu(void)
306{
307 int ret;
308
309 /*
310 * We do not allocate and configure new area for bitmap buffer
311 * because it would requere copying bitmap data (splash image)
312 * and so negatively affect boot time. Instead we reserve the
313 * already configured frame buffer area so that it won't be
314 * destroyed. The starting address of the area to reserve and
315 * also it's length is passed to reserve_bootmem(). It will be
316 * freed later on first open of fbdev, when splash image is not
317 * needed any more.
318 */
319 if (diu_shared_fb.in_use) {
320 ret = reserve_bootmem(diu_shared_fb.fb_phys,
321 diu_shared_fb.fb_len,
322 BOOTMEM_EXCLUSIVE);
323 if (ret) {
324 pr_err("%s: reserve bootmem failed\n", __func__);
325 diu_shared_fb.in_use = false;
326 }
327 }
328
329#if defined(CONFIG_FB_FSL_DIU) || \
330 defined(CONFIG_FB_FSL_DIU_MODULE)
331 diu_ops.get_pixel_format = mpc512x_get_pixel_format;
332 diu_ops.set_gamma_table = mpc512x_set_gamma_table;
333 diu_ops.set_monitor_port = mpc512x_set_monitor_port;
334 diu_ops.set_pixel_clock = mpc512x_set_pixel_clock;
335 diu_ops.show_monitor_port = mpc512x_show_monitor_port;
336 diu_ops.set_sysfs_monitor_port = mpc512x_set_sysfs_monitor_port;
337 diu_ops.release_bootmem = mpc512x_release_bootmem;
338#endif
339}
340
57void __init mpc512x_init_IRQ(void) 341void __init mpc512x_init_IRQ(void)
58{ 342{
59 struct device_node *np; 343 struct device_node *np;
diff --git a/arch/powerpc/platforms/512x/pdm360ng.c b/arch/powerpc/platforms/512x/pdm360ng.c
new file mode 100644
index 000000000000..0575e858291c
--- /dev/null
+++ b/arch/powerpc/platforms/512x/pdm360ng.c
@@ -0,0 +1,129 @@
1/*
2 * Copyright (C) 2010 DENX Software Engineering
3 *
4 * Anatolij Gustschin, <agust@denx.de>
5 *
6 * PDM360NG board setup
7 *
8 * This is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 */
14
15#include <linux/kernel.h>
16#include <linux/io.h>
17#include <linux/of_platform.h>
18
19#include <asm/machdep.h>
20#include <asm/ipic.h>
21
22#include "mpc512x.h"
23
24#if defined(CONFIG_TOUCHSCREEN_ADS7846) || \
25 defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
26#include <linux/interrupt.h>
27#include <linux/spi/ads7846.h>
28#include <linux/spi/spi.h>
29#include <linux/notifier.h>
30
31static void *pdm360ng_gpio_base;
32
33static int pdm360ng_get_pendown_state(void)
34{
35 u32 reg;
36
37 reg = in_be32(pdm360ng_gpio_base + 0xc);
38 if (reg & 0x40)
39 setbits32(pdm360ng_gpio_base + 0xc, 0x40);
40
41 reg = in_be32(pdm360ng_gpio_base + 0x8);
42
43 /* return 1 if pen is down */
44 return (reg & 0x40) == 0;
45}
46
47static struct ads7846_platform_data pdm360ng_ads7846_pdata = {
48 .model = 7845,
49 .get_pendown_state = pdm360ng_get_pendown_state,
50 .irq_flags = IRQF_TRIGGER_LOW,
51};
52
53static int __init pdm360ng_penirq_init(void)
54{
55 struct device_node *np;
56
57 np = of_find_compatible_node(NULL, NULL, "fsl,mpc5121-gpio");
58 if (!np) {
59 pr_err("%s: Can't find 'mpc5121-gpio' node\n", __func__);
60 return -ENODEV;
61 }
62
63 pdm360ng_gpio_base = of_iomap(np, 0);
64 of_node_put(np);
65 if (!pdm360ng_gpio_base) {
66 pr_err("%s: Can't map gpio regs.\n", __func__);
67 return -ENODEV;
68 }
69 out_be32(pdm360ng_gpio_base + 0xc, 0xffffffff);
70 setbits32(pdm360ng_gpio_base + 0x18, 0x2000);
71 setbits32(pdm360ng_gpio_base + 0x10, 0x40);
72
73 return 0;
74}
75
76static int pdm360ng_touchscreen_notifier_call(struct notifier_block *nb,
77 unsigned long event, void *__dev)
78{
79 struct device *dev = __dev;
80
81 if ((event == BUS_NOTIFY_ADD_DEVICE) &&
82 of_device_is_compatible(dev->of_node, "ti,ads7846")) {
83 dev->platform_data = &pdm360ng_ads7846_pdata;
84 return NOTIFY_OK;
85 }
86 return NOTIFY_DONE;
87}
88
89static struct notifier_block pdm360ng_touchscreen_nb = {
90 .notifier_call = pdm360ng_touchscreen_notifier_call,
91};
92
93static void __init pdm360ng_touchscreen_init(void)
94{
95 if (pdm360ng_penirq_init())
96 return;
97
98 bus_register_notifier(&spi_bus_type, &pdm360ng_touchscreen_nb);
99}
100#else
101static inline void __init pdm360ng_touchscreen_init(void)
102{
103}
104#endif /* CONFIG_TOUCHSCREEN_ADS7846 */
105
106void __init pdm360ng_init(void)
107{
108 mpc512x_init();
109 pdm360ng_touchscreen_init();
110}
111
112static int __init pdm360ng_probe(void)
113{
114 unsigned long root = of_get_flat_dt_root();
115
116 return of_flat_dt_is_compatible(root, "ifm,pdm360ng");
117}
118
119define_machine(pdm360ng) {
120 .name = "PDM360NG",
121 .probe = pdm360ng_probe,
122 .setup_arch = mpc512x_setup_diu,
123 .init = pdm360ng_init,
124 .init_early = mpc512x_init_diu,
125 .init_IRQ = mpc512x_init_IRQ,
126 .get_irq = ipic_get_irq,
127 .calibrate_decr = generic_calibrate_decr,
128 .restart = mpc512x_restart,
129};
diff --git a/arch/powerpc/platforms/85xx/corenet_ds.c b/arch/powerpc/platforms/85xx/corenet_ds.c
index 534c2ecc89d9..2ab338c9ac37 100644
--- a/arch/powerpc/platforms/85xx/corenet_ds.c
+++ b/arch/powerpc/platforms/85xx/corenet_ds.c
@@ -16,7 +16,7 @@
16#include <linux/kdev_t.h> 16#include <linux/kdev_t.h>
17#include <linux/delay.h> 17#include <linux/delay.h>
18#include <linux/interrupt.h> 18#include <linux/interrupt.h>
19#include <linux/lmb.h> 19#include <linux/memblock.h>
20 20
21#include <asm/system.h> 21#include <asm/system.h>
22#include <asm/time.h> 22#include <asm/time.h>
@@ -100,7 +100,7 @@ void __init corenet_ds_setup_arch(void)
100#endif 100#endif
101 101
102#ifdef CONFIG_SWIOTLB 102#ifdef CONFIG_SWIOTLB
103 if (lmb_end_of_DRAM() > max) { 103 if (memblock_end_of_DRAM() > max) {
104 ppc_swiotlb_enable = 1; 104 ppc_swiotlb_enable = 1;
105 set_pci_dma_ops(&swiotlb_dma_ops); 105 set_pci_dma_ops(&swiotlb_dma_ops);
106 ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb; 106 ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
diff --git a/arch/powerpc/platforms/85xx/mpc8536_ds.c b/arch/powerpc/platforms/85xx/mpc8536_ds.c
index 004b7d36cdb7..f79f2f102141 100644
--- a/arch/powerpc/platforms/85xx/mpc8536_ds.c
+++ b/arch/powerpc/platforms/85xx/mpc8536_ds.c
@@ -17,7 +17,7 @@
17#include <linux/seq_file.h> 17#include <linux/seq_file.h>
18#include <linux/interrupt.h> 18#include <linux/interrupt.h>
19#include <linux/of_platform.h> 19#include <linux/of_platform.h>
20#include <linux/lmb.h> 20#include <linux/memblock.h>
21 21
22#include <asm/system.h> 22#include <asm/system.h>
23#include <asm/time.h> 23#include <asm/time.h>
@@ -94,7 +94,7 @@ static void __init mpc8536_ds_setup_arch(void)
94#endif 94#endif
95 95
96#ifdef CONFIG_SWIOTLB 96#ifdef CONFIG_SWIOTLB
97 if (lmb_end_of_DRAM() > max) { 97 if (memblock_end_of_DRAM() > max) {
98 ppc_swiotlb_enable = 1; 98 ppc_swiotlb_enable = 1;
99 set_pci_dma_ops(&swiotlb_dma_ops); 99 set_pci_dma_ops(&swiotlb_dma_ops);
100 ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb; 100 ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ds.c b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
index 544011a562fb..8190bc25bf27 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_ds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
@@ -20,7 +20,7 @@
20#include <linux/seq_file.h> 20#include <linux/seq_file.h>
21#include <linux/interrupt.h> 21#include <linux/interrupt.h>
22#include <linux/of_platform.h> 22#include <linux/of_platform.h>
23#include <linux/lmb.h> 23#include <linux/memblock.h>
24 24
25#include <asm/system.h> 25#include <asm/system.h>
26#include <asm/time.h> 26#include <asm/time.h>
@@ -190,7 +190,7 @@ static void __init mpc85xx_ds_setup_arch(void)
190#endif 190#endif
191 191
192#ifdef CONFIG_SWIOTLB 192#ifdef CONFIG_SWIOTLB
193 if (lmb_end_of_DRAM() > max) { 193 if (memblock_end_of_DRAM() > max) {
194 ppc_swiotlb_enable = 1; 194 ppc_swiotlb_enable = 1;
195 set_pci_dma_ops(&swiotlb_dma_ops); 195 set_pci_dma_ops(&swiotlb_dma_ops);
196 ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb; 196 ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_mds.c b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
index 8fe87fc61485..494513682d70 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_mds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
@@ -33,7 +33,7 @@
33#include <linux/of_platform.h> 33#include <linux/of_platform.h>
34#include <linux/of_device.h> 34#include <linux/of_device.h>
35#include <linux/phy.h> 35#include <linux/phy.h>
36#include <linux/lmb.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 <asm/atomic.h>
@@ -325,7 +325,7 @@ static void __init mpc85xx_mds_setup_arch(void)
325#endif /* CONFIG_QUICC_ENGINE */ 325#endif /* CONFIG_QUICC_ENGINE */
326 326
327#ifdef CONFIG_SWIOTLB 327#ifdef CONFIG_SWIOTLB
328 if (lmb_end_of_DRAM() > max) { 328 if (memblock_end_of_DRAM() > max) {
329 ppc_swiotlb_enable = 1; 329 ppc_swiotlb_enable = 1;
330 set_pci_dma_ops(&swiotlb_dma_ops); 330 set_pci_dma_ops(&swiotlb_dma_ops);
331 ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb; 331 ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
diff --git a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
index 2aa69a69bcc8..b11c3535f350 100644
--- a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
+++ b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
@@ -19,7 +19,7 @@
19#include <linux/delay.h> 19#include <linux/delay.h>
20#include <linux/seq_file.h> 20#include <linux/seq_file.h>
21#include <linux/of_platform.h> 21#include <linux/of_platform.h>
22#include <linux/lmb.h> 22#include <linux/memblock.h>
23 23
24#include <asm/system.h> 24#include <asm/system.h>
25#include <asm/time.h> 25#include <asm/time.h>
@@ -103,7 +103,7 @@ mpc86xx_hpcn_setup_arch(void)
103#endif 103#endif
104 104
105#ifdef CONFIG_SWIOTLB 105#ifdef CONFIG_SWIOTLB
106 if (lmb_end_of_DRAM() > max) { 106 if (memblock_end_of_DRAM() > max) {
107 ppc_swiotlb_enable = 1; 107 ppc_swiotlb_enable = 1;
108 set_pci_dma_ops(&swiotlb_dma_ops); 108 set_pci_dma_ops(&swiotlb_dma_ops);
109 ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb; 109 ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c
index 4326b737d913..3712900471ba 100644
--- a/arch/powerpc/platforms/cell/iommu.c
+++ b/arch/powerpc/platforms/cell/iommu.c
@@ -29,7 +29,7 @@
29#include <linux/of.h> 29#include <linux/of.h>
30#include <linux/of_platform.h> 30#include <linux/of_platform.h>
31#include <linux/slab.h> 31#include <linux/slab.h>
32#include <linux/lmb.h> 32#include <linux/memblock.h>
33 33
34#include <asm/prom.h> 34#include <asm/prom.h>
35#include <asm/iommu.h> 35#include <asm/iommu.h>
@@ -845,10 +845,10 @@ static int __init cell_iommu_init_disabled(void)
845 /* If we found a DMA window, we check if it's big enough to enclose 845 /* If we found a DMA window, we check if it's big enough to enclose
846 * all of physical memory. If not, we force enable IOMMU 846 * all of physical memory. If not, we force enable IOMMU
847 */ 847 */
848 if (np && size < lmb_end_of_DRAM()) { 848 if (np && size < memblock_end_of_DRAM()) {
849 printk(KERN_WARNING "iommu: force-enabled, dma window" 849 printk(KERN_WARNING "iommu: force-enabled, dma window"
850 " (%ldMB) smaller than total memory (%lldMB)\n", 850 " (%ldMB) smaller than total memory (%lldMB)\n",
851 size >> 20, lmb_end_of_DRAM() >> 20); 851 size >> 20, memblock_end_of_DRAM() >> 20);
852 return -ENODEV; 852 return -ENODEV;
853 } 853 }
854 854
@@ -1064,7 +1064,7 @@ static int __init cell_iommu_fixed_mapping_init(void)
1064 } 1064 }
1065 1065
1066 fbase = _ALIGN_UP(fbase, 1 << IO_SEGMENT_SHIFT); 1066 fbase = _ALIGN_UP(fbase, 1 << IO_SEGMENT_SHIFT);
1067 fsize = lmb_phys_mem_size(); 1067 fsize = memblock_phys_mem_size();
1068 1068
1069 if ((fbase + fsize) <= 0x800000000ul) 1069 if ((fbase + fsize) <= 0x800000000ul)
1070 hbase = 0; /* use the device tree window */ 1070 hbase = 0; /* use the device tree window */
@@ -1169,7 +1169,7 @@ static int __init cell_iommu_init(void)
1169 * Note: should we make sure we have the IOMMU actually disabled ? 1169 * Note: should we make sure we have the IOMMU actually disabled ?
1170 */ 1170 */
1171 if (iommu_is_off || 1171 if (iommu_is_off ||
1172 (!iommu_force_on && lmb_end_of_DRAM() <= 0x80000000ull)) 1172 (!iommu_force_on && memblock_end_of_DRAM() <= 0x80000000ull))
1173 if (cell_iommu_init_disabled() == 0) 1173 if (cell_iommu_init_disabled() == 0)
1174 goto bail; 1174 goto bail;
1175 1175
diff --git a/arch/powerpc/platforms/embedded6xx/wii.c b/arch/powerpc/platforms/embedded6xx/wii.c
index 174a04ac4806..5cdcc7c8d973 100644
--- a/arch/powerpc/platforms/embedded6xx/wii.c
+++ b/arch/powerpc/platforms/embedded6xx/wii.c
@@ -20,7 +20,7 @@
20#include <linux/seq_file.h> 20#include <linux/seq_file.h>
21#include <linux/kexec.h> 21#include <linux/kexec.h>
22#include <linux/of_platform.h> 22#include <linux/of_platform.h>
23#include <linux/lmb.h> 23#include <linux/memblock.h>
24#include <mm/mmu_decl.h> 24#include <mm/mmu_decl.h>
25 25
26#include <asm/io.h> 26#include <asm/io.h>
@@ -65,7 +65,7 @@ static int __init page_aligned(unsigned long x)
65 65
66void __init wii_memory_fixups(void) 66void __init wii_memory_fixups(void)
67{ 67{
68 struct lmb_property *p = lmb.memory.region; 68 struct memblock_property *p = memblock.memory.region;
69 69
70 /* 70 /*
71 * This is part of a workaround to allow the use of two 71 * This is part of a workaround to allow the use of two
@@ -77,7 +77,7 @@ void __init wii_memory_fixups(void)
77 * between both ranges. 77 * between both ranges.
78 */ 78 */
79 79
80 BUG_ON(lmb.memory.cnt != 2); 80 BUG_ON(memblock.memory.cnt != 2);
81 BUG_ON(!page_aligned(p[0].base) || !page_aligned(p[1].base)); 81 BUG_ON(!page_aligned(p[0].base) || !page_aligned(p[1].base));
82 82
83 p[0].size = _ALIGN_DOWN(p[0].size, PAGE_SIZE); 83 p[0].size = _ALIGN_DOWN(p[0].size, PAGE_SIZE);
@@ -92,11 +92,11 @@ void __init wii_memory_fixups(void)
92 92
93 p[0].size += wii_hole_size + p[1].size; 93 p[0].size += wii_hole_size + p[1].size;
94 94
95 lmb.memory.cnt = 1; 95 memblock.memory.cnt = 1;
96 lmb_analyze(); 96 memblock_analyze();
97 97
98 /* reserve the hole */ 98 /* reserve the hole */
99 lmb_reserve(wii_hole_start, wii_hole_size); 99 memblock_reserve(wii_hole_start, wii_hole_size);
100 100
101 /* allow ioremapping the address space in the hole */ 101 /* allow ioremapping the address space in the hole */
102 __allow_ioremap_reserved = 1; 102 __allow_ioremap_reserved = 1;
diff --git a/arch/powerpc/platforms/maple/setup.c b/arch/powerpc/platforms/maple/setup.c
index 39df70529d29..3fff8d979b41 100644
--- a/arch/powerpc/platforms/maple/setup.c
+++ b/arch/powerpc/platforms/maple/setup.c
@@ -41,7 +41,7 @@
41#include <linux/smp.h> 41#include <linux/smp.h>
42#include <linux/bitops.h> 42#include <linux/bitops.h>
43#include <linux/of_device.h> 43#include <linux/of_device.h>
44#include <linux/lmb.h> 44#include <linux/memblock.h>
45 45
46#include <asm/processor.h> 46#include <asm/processor.h>
47#include <asm/sections.h> 47#include <asm/sections.h>
diff --git a/arch/powerpc/platforms/pasemi/iommu.c b/arch/powerpc/platforms/pasemi/iommu.c
index 7b1d608ea3c8..1f9fb2c57761 100644
--- a/arch/powerpc/platforms/pasemi/iommu.c
+++ b/arch/powerpc/platforms/pasemi/iommu.c
@@ -204,7 +204,7 @@ int __init iob_init(struct device_node *dn)
204 pr_debug(" -> %s\n", __func__); 204 pr_debug(" -> %s\n", __func__);
205 205
206 /* Allocate a spare page to map all invalid IOTLB pages. */ 206 /* Allocate a spare page to map all invalid IOTLB pages. */
207 tmp = lmb_alloc(IOBMAP_PAGE_SIZE, IOBMAP_PAGE_SIZE); 207 tmp = memblock_alloc(IOBMAP_PAGE_SIZE, IOBMAP_PAGE_SIZE);
208 if (!tmp) 208 if (!tmp)
209 panic("IOBMAP: Cannot allocate spare page!"); 209 panic("IOBMAP: Cannot allocate spare page!");
210 /* Empty l1 is marked invalid */ 210 /* Empty l1 is marked invalid */
@@ -275,7 +275,7 @@ void __init alloc_iobmap_l2(void)
275 return; 275 return;
276#endif 276#endif
277 /* For 2G space, 8x64 pages (2^21 bytes) is max total l2 size */ 277 /* For 2G space, 8x64 pages (2^21 bytes) is max total l2 size */
278 iob_l2_base = (u32 *)abs_to_virt(lmb_alloc_base(1UL<<21, 1UL<<21, 0x80000000)); 278 iob_l2_base = (u32 *)abs_to_virt(memblock_alloc_base(1UL<<21, 1UL<<21, 0x80000000));
279 279
280 printk(KERN_INFO "IOBMAP L2 allocated at: %p\n", iob_l2_base); 280 printk(KERN_INFO "IOBMAP L2 allocated at: %p\n", iob_l2_base);
281} 281}
diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c
index f1d0132ebcc7..9deb274841f1 100644
--- a/arch/powerpc/platforms/powermac/setup.c
+++ b/arch/powerpc/platforms/powermac/setup.c
@@ -51,7 +51,7 @@
51#include <linux/suspend.h> 51#include <linux/suspend.h>
52#include <linux/of_device.h> 52#include <linux/of_device.h>
53#include <linux/of_platform.h> 53#include <linux/of_platform.h>
54#include <linux/lmb.h> 54#include <linux/memblock.h>
55 55
56#include <asm/reg.h> 56#include <asm/reg.h>
57#include <asm/sections.h> 57#include <asm/sections.h>
@@ -619,7 +619,7 @@ static int __init pmac_probe(void)
619 * driver needs that. We have to allocate it now. We allocate 4k 619 * driver needs that. We have to allocate it now. We allocate 4k
620 * (1 small page) for now. 620 * (1 small page) for now.
621 */ 621 */
622 smu_cmdbuf_abs = lmb_alloc_base(4096, 4096, 0x80000000UL); 622 smu_cmdbuf_abs = memblock_alloc_base(4096, 4096, 0x80000000UL);
623#endif /* CONFIG_PMAC_SMU */ 623#endif /* CONFIG_PMAC_SMU */
624 624
625 return 1; 625 return 1;
diff --git a/arch/powerpc/platforms/ps3/htab.c b/arch/powerpc/platforms/ps3/htab.c
index 1e8a1e39dfe8..2c0ed87f2024 100644
--- a/arch/powerpc/platforms/ps3/htab.c
+++ b/arch/powerpc/platforms/ps3/htab.c
@@ -19,7 +19,7 @@
19 */ 19 */
20 20
21#include <linux/kernel.h> 21#include <linux/kernel.h>
22#include <linux/lmb.h> 22#include <linux/memblock.h>
23 23
24#include <asm/machdep.h> 24#include <asm/machdep.h>
25#include <asm/prom.h> 25#include <asm/prom.h>
diff --git a/arch/powerpc/platforms/ps3/mm.c b/arch/powerpc/platforms/ps3/mm.c
index 7925751e464a..c2045880e674 100644
--- a/arch/powerpc/platforms/ps3/mm.c
+++ b/arch/powerpc/platforms/ps3/mm.c
@@ -21,7 +21,7 @@
21#include <linux/kernel.h> 21#include <linux/kernel.h>
22#include <linux/module.h> 22#include <linux/module.h>
23#include <linux/memory_hotplug.h> 23#include <linux/memory_hotplug.h>
24#include <linux/lmb.h> 24#include <linux/memblock.h>
25#include <linux/slab.h> 25#include <linux/slab.h>
26 26
27#include <asm/cell-regs.h> 27#include <asm/cell-regs.h>
@@ -318,8 +318,8 @@ static int __init ps3_mm_add_memory(void)
318 return result; 318 return result;
319 } 319 }
320 320
321 lmb_add(start_addr, map.r1.size); 321 memblock_add(start_addr, map.r1.size);
322 lmb_analyze(); 322 memblock_analyze();
323 323
324 result = online_pages(start_pfn, nr_pages); 324 result = online_pages(start_pfn, nr_pages);
325 325
diff --git a/arch/powerpc/platforms/ps3/os-area.c b/arch/powerpc/platforms/ps3/os-area.c
index dd521a181f23..5b759b669598 100644
--- a/arch/powerpc/platforms/ps3/os-area.c
+++ b/arch/powerpc/platforms/ps3/os-area.c
@@ -24,7 +24,7 @@
24#include <linux/fs.h> 24#include <linux/fs.h>
25#include <linux/syscalls.h> 25#include <linux/syscalls.h>
26#include <linux/ctype.h> 26#include <linux/ctype.h>
27#include <linux/lmb.h> 27#include <linux/memblock.h>
28#include <linux/of.h> 28#include <linux/of.h>
29#include <linux/slab.h> 29#include <linux/slab.h>
30 30
@@ -723,7 +723,7 @@ static void os_area_queue_work(void)
723 * flash to a high address in the boot memory region and then puts that RAM 723 * flash to a high address in the boot memory region and then puts that RAM
724 * address and the byte count into the repository for retrieval by the guest. 724 * address and the byte count into the repository for retrieval by the guest.
725 * We copy the data we want into a static variable and allow the memory setup 725 * We copy the data we want into a static variable and allow the memory setup
726 * by the HV to be claimed by the lmb manager. 726 * by the HV to be claimed by the memblock manager.
727 * 727 *
728 * The os area mirror will not be available to a second stage kernel, and 728 * The os area mirror will not be available to a second stage kernel, and
729 * the header verify will fail. In this case, the saved_params values will 729 * the header verify will fail. In this case, the saved_params values will
diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c
index 01e7b5bb3c1d..deab5f946090 100644
--- a/arch/powerpc/platforms/pseries/hotplug-memory.c
+++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
@@ -10,14 +10,14 @@
10 */ 10 */
11 11
12#include <linux/of.h> 12#include <linux/of.h>
13#include <linux/lmb.h> 13#include <linux/memblock.h>
14#include <linux/vmalloc.h> 14#include <linux/vmalloc.h>
15#include <asm/firmware.h> 15#include <asm/firmware.h>
16#include <asm/machdep.h> 16#include <asm/machdep.h>
17#include <asm/pSeries_reconfig.h> 17#include <asm/pSeries_reconfig.h>
18#include <asm/sparsemem.h> 18#include <asm/sparsemem.h>
19 19
20static int pseries_remove_lmb(unsigned long base, unsigned int lmb_size) 20static int pseries_remove_memblock(unsigned long base, unsigned int memblock_size)
21{ 21{
22 unsigned long start, start_pfn; 22 unsigned long start, start_pfn;
23 struct zone *zone; 23 struct zone *zone;
@@ -26,7 +26,7 @@ static int pseries_remove_lmb(unsigned long base, unsigned int lmb_size)
26 start_pfn = base >> PAGE_SHIFT; 26 start_pfn = base >> PAGE_SHIFT;
27 27
28 if (!pfn_valid(start_pfn)) { 28 if (!pfn_valid(start_pfn)) {
29 lmb_remove(base, lmb_size); 29 memblock_remove(base, memblock_size);
30 return 0; 30 return 0;
31 } 31 }
32 32
@@ -41,20 +41,20 @@ static int pseries_remove_lmb(unsigned long base, unsigned int lmb_size)
41 * to sysfs "state" file and we can't remove sysfs entries 41 * to sysfs "state" file and we can't remove sysfs entries
42 * while writing to it. So we have to defer it to here. 42 * while writing to it. So we have to defer it to here.
43 */ 43 */
44 ret = __remove_pages(zone, start_pfn, lmb_size >> PAGE_SHIFT); 44 ret = __remove_pages(zone, start_pfn, memblock_size >> PAGE_SHIFT);
45 if (ret) 45 if (ret)
46 return ret; 46 return ret;
47 47
48 /* 48 /*
49 * Update memory regions for memory remove 49 * Update memory regions for memory remove
50 */ 50 */
51 lmb_remove(base, lmb_size); 51 memblock_remove(base, memblock_size);
52 52
53 /* 53 /*
54 * Remove htab bolted mappings for this section of memory 54 * Remove htab bolted mappings for this section of memory
55 */ 55 */
56 start = (unsigned long)__va(base); 56 start = (unsigned long)__va(base);
57 ret = remove_section_mapping(start, start + lmb_size); 57 ret = remove_section_mapping(start, start + memblock_size);
58 58
59 /* Ensure all vmalloc mappings are flushed in case they also 59 /* Ensure all vmalloc mappings are flushed in case they also
60 * hit that section of memory 60 * hit that section of memory
@@ -69,7 +69,7 @@ static int pseries_remove_memory(struct device_node *np)
69 const char *type; 69 const char *type;
70 const unsigned int *regs; 70 const unsigned int *regs;
71 unsigned long base; 71 unsigned long base;
72 unsigned int lmb_size; 72 unsigned int memblock_size;
73 int ret = -EINVAL; 73 int ret = -EINVAL;
74 74
75 /* 75 /*
@@ -80,16 +80,16 @@ static int pseries_remove_memory(struct device_node *np)
80 return 0; 80 return 0;
81 81
82 /* 82 /*
83 * Find the bae address and size of the lmb 83 * Find the bae address and size of the memblock
84 */ 84 */
85 regs = of_get_property(np, "reg", NULL); 85 regs = of_get_property(np, "reg", NULL);
86 if (!regs) 86 if (!regs)
87 return ret; 87 return ret;
88 88
89 base = *(unsigned long *)regs; 89 base = *(unsigned long *)regs;
90 lmb_size = regs[3]; 90 memblock_size = regs[3];
91 91
92 ret = pseries_remove_lmb(base, lmb_size); 92 ret = pseries_remove_memblock(base, memblock_size);
93 return ret; 93 return ret;
94} 94}
95 95
@@ -98,7 +98,7 @@ static int pseries_add_memory(struct device_node *np)
98 const char *type; 98 const char *type;
99 const unsigned int *regs; 99 const unsigned int *regs;
100 unsigned long base; 100 unsigned long base;
101 unsigned int lmb_size; 101 unsigned int memblock_size;
102 int ret = -EINVAL; 102 int ret = -EINVAL;
103 103
104 /* 104 /*
@@ -109,43 +109,43 @@ static int pseries_add_memory(struct device_node *np)
109 return 0; 109 return 0;
110 110
111 /* 111 /*
112 * Find the base and size of the lmb 112 * Find the base and size of the memblock
113 */ 113 */
114 regs = of_get_property(np, "reg", NULL); 114 regs = of_get_property(np, "reg", NULL);
115 if (!regs) 115 if (!regs)
116 return ret; 116 return ret;
117 117
118 base = *(unsigned long *)regs; 118 base = *(unsigned long *)regs;
119 lmb_size = regs[3]; 119 memblock_size = regs[3];
120 120
121 /* 121 /*
122 * Update memory region to represent the memory add 122 * Update memory region to represent the memory add
123 */ 123 */
124 ret = lmb_add(base, lmb_size); 124 ret = memblock_add(base, memblock_size);
125 return (ret < 0) ? -EINVAL : 0; 125 return (ret < 0) ? -EINVAL : 0;
126} 126}
127 127
128static int pseries_drconf_memory(unsigned long *base, unsigned int action) 128static int pseries_drconf_memory(unsigned long *base, unsigned int action)
129{ 129{
130 struct device_node *np; 130 struct device_node *np;
131 const unsigned long *lmb_size; 131 const unsigned long *memblock_size;
132 int rc; 132 int rc;
133 133
134 np = of_find_node_by_path("/ibm,dynamic-reconfiguration-memory"); 134 np = of_find_node_by_path("/ibm,dynamic-reconfiguration-memory");
135 if (!np) 135 if (!np)
136 return -EINVAL; 136 return -EINVAL;
137 137
138 lmb_size = of_get_property(np, "ibm,lmb-size", NULL); 138 memblock_size = of_get_property(np, "ibm,memblock-size", NULL);
139 if (!lmb_size) { 139 if (!memblock_size) {
140 of_node_put(np); 140 of_node_put(np);
141 return -EINVAL; 141 return -EINVAL;
142 } 142 }
143 143
144 if (action == PSERIES_DRCONF_MEM_ADD) { 144 if (action == PSERIES_DRCONF_MEM_ADD) {
145 rc = lmb_add(*base, *lmb_size); 145 rc = memblock_add(*base, *memblock_size);
146 rc = (rc < 0) ? -EINVAL : 0; 146 rc = (rc < 0) ? -EINVAL : 0;
147 } else if (action == PSERIES_DRCONF_MEM_REMOVE) { 147 } else if (action == PSERIES_DRCONF_MEM_REMOVE) {
148 rc = pseries_remove_lmb(*base, *lmb_size); 148 rc = pseries_remove_memblock(*base, *memblock_size);
149 } else { 149 } else {
150 rc = -EINVAL; 150 rc = -EINVAL;
151 } 151 }
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
index d26182d42cbf..395848e30c52 100644
--- a/arch/powerpc/platforms/pseries/iommu.c
+++ b/arch/powerpc/platforms/pseries/iommu.c
@@ -66,7 +66,7 @@ static int tce_build_pSeries(struct iommu_table *tbl, long index,
66 tcep = ((u64 *)tbl->it_base) + index; 66 tcep = ((u64 *)tbl->it_base) + index;
67 67
68 while (npages--) { 68 while (npages--) {
69 /* can't move this out since we might cross LMB boundary */ 69 /* can't move this out since we might cross MEMBLOCK boundary */
70 rpn = (virt_to_abs(uaddr)) >> TCE_SHIFT; 70 rpn = (virt_to_abs(uaddr)) >> TCE_SHIFT;
71 *tcep = proto_tce | (rpn & TCE_RPN_MASK) << TCE_RPN_SHIFT; 71 *tcep = proto_tce | (rpn & TCE_RPN_MASK) << TCE_RPN_SHIFT;
72 72
diff --git a/arch/powerpc/platforms/pseries/phyp_dump.c b/arch/powerpc/platforms/pseries/phyp_dump.c
index 7ebd9e88d369..6e7742da0072 100644
--- a/arch/powerpc/platforms/pseries/phyp_dump.c
+++ b/arch/powerpc/platforms/pseries/phyp_dump.c
@@ -255,12 +255,12 @@ void invalidate_last_dump(struct phyp_dump_header *ph, unsigned long addr)
255 255
256/* ------------------------------------------------- */ 256/* ------------------------------------------------- */
257/** 257/**
258 * release_memory_range -- release memory previously lmb_reserved 258 * release_memory_range -- release memory previously memblock_reserved
259 * @start_pfn: starting physical frame number 259 * @start_pfn: starting physical frame number
260 * @nr_pages: number of pages to free. 260 * @nr_pages: number of pages to free.
261 * 261 *
262 * This routine will release memory that had been previously 262 * This routine will release memory that had been previously
263 * lmb_reserved in early boot. The released memory becomes 263 * memblock_reserved in early boot. The released memory becomes
264 * available for genreal use. 264 * available for genreal use.
265 */ 265 */
266static void release_memory_range(unsigned long start_pfn, 266static void release_memory_range(unsigned long start_pfn,
diff --git a/arch/powerpc/sysdev/dart_iommu.c b/arch/powerpc/sysdev/dart_iommu.c
index c8b96ed7c015..559db2b846a9 100644
--- a/arch/powerpc/sysdev/dart_iommu.c
+++ b/arch/powerpc/sysdev/dart_iommu.c
@@ -36,7 +36,7 @@
36#include <linux/dma-mapping.h> 36#include <linux/dma-mapping.h>
37#include <linux/vmalloc.h> 37#include <linux/vmalloc.h>
38#include <linux/suspend.h> 38#include <linux/suspend.h>
39#include <linux/lmb.h> 39#include <linux/memblock.h>
40#include <linux/gfp.h> 40#include <linux/gfp.h>
41#include <asm/io.h> 41#include <asm/io.h>
42#include <asm/prom.h> 42#include <asm/prom.h>
@@ -232,7 +232,7 @@ static int __init dart_init(struct device_node *dart_node)
232 * that to work around what looks like a problem with the HT bridge 232 * that to work around what looks like a problem with the HT bridge
233 * prefetching into invalid pages and corrupting data 233 * prefetching into invalid pages and corrupting data
234 */ 234 */
235 tmp = lmb_alloc(DART_PAGE_SIZE, DART_PAGE_SIZE); 235 tmp = memblock_alloc(DART_PAGE_SIZE, DART_PAGE_SIZE);
236 dart_emptyval = DARTMAP_VALID | ((tmp >> DART_PAGE_SHIFT) & 236 dart_emptyval = DARTMAP_VALID | ((tmp >> DART_PAGE_SHIFT) &
237 DARTMAP_RPNMASK); 237 DARTMAP_RPNMASK);
238 238
@@ -407,7 +407,7 @@ void __init alloc_dart_table(void)
407 if (iommu_is_off) 407 if (iommu_is_off)
408 return; 408 return;
409 409
410 if (!iommu_force_on && lmb_end_of_DRAM() <= 0x40000000ull) 410 if (!iommu_force_on && memblock_end_of_DRAM() <= 0x40000000ull)
411 return; 411 return;
412 412
413 /* 512 pages (2MB) is max DART tablesize. */ 413 /* 512 pages (2MB) is max DART tablesize. */
@@ -416,7 +416,7 @@ void __init alloc_dart_table(void)
416 * will blow up an entire large page anyway in the kernel mapping 416 * will blow up an entire large page anyway in the kernel mapping
417 */ 417 */
418 dart_tablebase = (unsigned long) 418 dart_tablebase = (unsigned long)
419 abs_to_virt(lmb_alloc_base(1UL<<24, 1UL<<24, 0x80000000L)); 419 abs_to_virt(memblock_alloc_base(1UL<<24, 1UL<<24, 0x80000000L));
420 420
421 printk(KERN_INFO "DART table allocated at: %lx\n", dart_tablebase); 421 printk(KERN_INFO "DART table allocated at: %lx\n", dart_tablebase);
422} 422}
diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
index a14760fe513a..356c6a0e1b23 100644
--- a/arch/powerpc/sysdev/fsl_pci.c
+++ b/arch/powerpc/sysdev/fsl_pci.c
@@ -23,7 +23,7 @@
23#include <linux/string.h> 23#include <linux/string.h>
24#include <linux/init.h> 24#include <linux/init.h>
25#include <linux/bootmem.h> 25#include <linux/bootmem.h>
26#include <linux/lmb.h> 26#include <linux/memblock.h>
27#include <linux/log2.h> 27#include <linux/log2.h>
28#include <linux/slab.h> 28#include <linux/slab.h>
29 29
@@ -190,7 +190,7 @@ static void __init setup_pci_atmu(struct pci_controller *hose,
190 pr_info("%s: PCICSRBAR @ 0x%x\n", name, pcicsrbar); 190 pr_info("%s: PCICSRBAR @ 0x%x\n", name, pcicsrbar);
191 191
192 /* Setup inbound mem window */ 192 /* Setup inbound mem window */
193 mem = lmb_end_of_DRAM(); 193 mem = memblock_end_of_DRAM();
194 sz = min(mem, paddr_lo); 194 sz = min(mem, paddr_lo);
195 mem_log = __ilog2_u64(sz); 195 mem_log = __ilog2_u64(sz);
196 196
diff --git a/arch/powerpc/sysdev/fsl_soc.h b/arch/powerpc/sysdev/fsl_soc.h
index 42381bb6cd51..53609489a62b 100644
--- a/arch/powerpc/sysdev/fsl_soc.h
+++ b/arch/powerpc/sysdev/fsl_soc.h
@@ -30,6 +30,7 @@ struct platform_diu_data_ops {
30 void (*set_pixel_clock) (unsigned int pixclock); 30 void (*set_pixel_clock) (unsigned int pixclock);
31 ssize_t (*show_monitor_port) (int monitor_port, char *buf); 31 ssize_t (*show_monitor_port) (int monitor_port, char *buf);
32 int (*set_sysfs_monitor_port) (int val); 32 int (*set_sysfs_monitor_port) (int val);
33 void (*release_bootmem) (void);
33}; 34};
34 35
35extern struct platform_diu_data_ops diu_ops; 36extern struct platform_diu_data_ops diu_ops;
diff --git a/arch/powerpc/sysdev/micropatch.c b/arch/powerpc/sysdev/micropatch.c
index d8d602840757..c0bb76ef7242 100644
--- a/arch/powerpc/sysdev/micropatch.c
+++ b/arch/powerpc/sysdev/micropatch.c
@@ -4,6 +4,7 @@
4 * also relocates SMC2, but this would require additional changes 4 * also relocates SMC2, but this would require additional changes
5 * to uart.c, so I am holding off on that for a moment. 5 * to uart.c, so I am holding off on that for a moment.
6 */ 6 */
7#include <linux/init.h>
7#include <linux/errno.h> 8#include <linux/errno.h>
8#include <linux/sched.h> 9#include <linux/sched.h>
9#include <linux/kernel.h> 10#include <linux/kernel.h>
@@ -16,6 +17,7 @@
16#include <asm/page.h> 17#include <asm/page.h>
17#include <asm/pgtable.h> 18#include <asm/pgtable.h>
18#include <asm/8xx_immap.h> 19#include <asm/8xx_immap.h>
20#include <asm/cpm.h>
19#include <asm/cpm1.h> 21#include <asm/cpm1.h>
20 22
21/* 23/*
@@ -24,7 +26,7 @@
24 26
25#ifdef CONFIG_I2C_SPI_UCODE_PATCH 27#ifdef CONFIG_I2C_SPI_UCODE_PATCH
26 28
27uint patch_2000[] = { 29static uint patch_2000[] __initdata = {
28 0x7FFFEFD9, 30 0x7FFFEFD9,
29 0x3FFD0000, 31 0x3FFD0000,
30 0x7FFB49F7, 32 0x7FFB49F7,
@@ -143,7 +145,7 @@ uint patch_2000[] = {
143 0x5F8247F8 145 0x5F8247F8
144}; 146};
145 147
146uint patch_2f00[] = { 148static uint patch_2f00[] __initdata = {
147 0x3E303430, 149 0x3E303430,
148 0x34343737, 150 0x34343737,
149 0xABF7BF9B, 151 0xABF7BF9B,
@@ -182,7 +184,7 @@ uint patch_2f00[] = {
182 184
183#ifdef CONFIG_I2C_SPI_SMC1_UCODE_PATCH 185#ifdef CONFIG_I2C_SPI_SMC1_UCODE_PATCH
184 186
185uint patch_2000[] = { 187static uint patch_2000[] __initdata = {
186 0x3fff0000, 188 0x3fff0000,
187 0x3ffd0000, 189 0x3ffd0000,
188 0x3ffb0000, 190 0x3ffb0000,
@@ -505,7 +507,7 @@ uint patch_2000[] = {
505 0x6079e2bb 507 0x6079e2bb
506}; 508};
507 509
508uint patch_2f00[] = { 510static uint patch_2f00[] __initdata = {
509 0x30303030, 511 0x30303030,
510 0x3e3e3434, 512 0x3e3e3434,
511 0xabbf9b99, 513 0xabbf9b99,
@@ -572,7 +574,7 @@ uint patch_2f00[] = {
572 0xf22f3f23 574 0xf22f3f23
573}; 575};
574 576
575uint patch_2e00[] = { 577static uint patch_2e00[] __initdata = {
576 0x27eeeeee, 578 0x27eeeeee,
577 0xeeeeeeee, 579 0xeeeeeeee,
578 0xeeeeeeee, 580 0xeeeeeeee,
@@ -598,7 +600,7 @@ uint patch_2e00[] = {
598 600
599#ifdef CONFIG_USB_SOF_UCODE_PATCH 601#ifdef CONFIG_USB_SOF_UCODE_PATCH
600 602
601uint patch_2000[] = { 603static uint patch_2000[] __initdata = {
602 0x7fff0000, 604 0x7fff0000,
603 0x7ffd0000, 605 0x7ffd0000,
604 0x7ffb0000, 606 0x7ffb0000,
@@ -613,21 +615,25 @@ uint patch_2000[] = {
613 0x60750000 615 0x60750000
614}; 616};
615 617
616uint patch_2f00[] = { 618static uint patch_2f00[] __initdata = {
617 0x3030304c, 619 0x3030304c,
618 0xcab9e441, 620 0xcab9e441,
619 0xa1aaf220 621 0xa1aaf220
620}; 622};
621#endif 623#endif
622 624
623void 625void __init cpm_load_patch(cpm8xx_t *cp)
624cpm_load_patch(cpm8xx_t *cp)
625{ 626{
626 volatile uint *dp; /* Dual-ported RAM. */ 627 volatile uint *dp; /* Dual-ported RAM. */
627 volatile cpm8xx_t *commproc; 628 volatile cpm8xx_t *commproc;
629#if defined(CONFIG_I2C_SPI_UCODE_PATCH) || \
630 defined(CONFIG_I2C_SPI_SMC1_UCODE_PATCH)
628 volatile iic_t *iip; 631 volatile iic_t *iip;
629 volatile spi_t *spp; 632 volatile struct spi_pram *spp;
633#ifdef CONFIG_I2C_SPI_SMC1_UCODE_PATCH
630 volatile smc_uart_t *smp; 634 volatile smc_uart_t *smp;
635#endif
636#endif
631 int i; 637 int i;
632 638
633 commproc = cp; 639 commproc = cp;
@@ -668,8 +674,8 @@ cpm_load_patch(cpm8xx_t *cp)
668 /* Put SPI above the IIC, also 32-byte aligned. 674 /* Put SPI above the IIC, also 32-byte aligned.
669 */ 675 */
670 i = (RPBASE + sizeof(iic_t) + 31) & ~31; 676 i = (RPBASE + sizeof(iic_t) + 31) & ~31;
671 spp = (spi_t *)&commproc->cp_dparam[PROFF_SPI]; 677 spp = (struct spi_pram *)&commproc->cp_dparam[PROFF_SPI];
672 spp->spi_rpbase = i; 678 spp->rpbase = i;
673 679
674# if defined(CONFIG_I2C_SPI_UCODE_PATCH) 680# if defined(CONFIG_I2C_SPI_UCODE_PATCH)
675 commproc->cp_cpmcr1 = 0x802a; 681 commproc->cp_cpmcr1 = 0x802a;