diff options
author | Anton Vorontsov <avorontsov@ru.mvista.com> | 2008-05-23 12:39:06 -0400 |
---|---|---|
committer | Kumar Gala <galak@kernel.crashing.org> | 2008-06-10 12:11:21 -0400 |
commit | 5093bb965a163fe288c3e5db0275165f86c895c2 (patch) | |
tree | 77af9fbf28f45e277443be5abffb85feacc0097c /arch/powerpc/sysdev | |
parent | b13e930906b313d787f4dd07fe78b74a3a8c22c4 (diff) |
powerpc/QE: switch to the cpm_muram implementation
This is very trivial patch. We're transitioning to the cpm_muram_*
calls. That's it.
Less trivial changes:
- BD_SC_* defines were defined in the cpm.h and qe.h, so to avoid redefines
we remove BD_SC from the qe.h and use cpm.h along with cpm_muram_*
prototypes;
- qe_muram_dump was unused and thus removed;
- added some code to the cpm_common.c to support legacy QE bindings
(data-only node name).
- For convenience, define qe_* calls to cpm_*. So drivers need not to be
changed.
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/sysdev')
-rw-r--r-- | arch/powerpc/sysdev/Makefile | 1 | ||||
-rw-r--r-- | arch/powerpc/sysdev/cpm_common.c | 16 | ||||
-rw-r--r-- | arch/powerpc/sysdev/qe_lib/qe.c | 92 |
3 files changed, 14 insertions, 95 deletions
diff --git a/arch/powerpc/sysdev/Makefile b/arch/powerpc/sysdev/Makefile index 2bfbb39380e9..16a0ed28eb00 100644 --- a/arch/powerpc/sysdev/Makefile +++ b/arch/powerpc/sysdev/Makefile | |||
@@ -42,6 +42,7 @@ endif | |||
42 | ifeq ($(ARCH),powerpc) | 42 | ifeq ($(ARCH),powerpc) |
43 | obj-$(CONFIG_CPM) += cpm_common.o | 43 | obj-$(CONFIG_CPM) += cpm_common.o |
44 | obj-$(CONFIG_CPM2) += cpm2.o cpm2_pic.o | 44 | obj-$(CONFIG_CPM2) += cpm2.o cpm2_pic.o |
45 | obj-$(CONFIG_QUICC_ENGINE) += cpm_common.o | ||
45 | obj-$(CONFIG_PPC_DCR) += dcr.o | 46 | obj-$(CONFIG_PPC_DCR) += dcr.o |
46 | obj-$(CONFIG_8xx) += mpc8xx_pic.o cpm1.o | 47 | obj-$(CONFIG_8xx) += mpc8xx_pic.o cpm1.o |
47 | obj-$(CONFIG_UCODE_PATCH) += micropatch.o | 48 | obj-$(CONFIG_UCODE_PATCH) += micropatch.o |
diff --git a/arch/powerpc/sysdev/cpm_common.c b/arch/powerpc/sysdev/cpm_common.c index cb7df2dce44f..9b75d164bdf9 100644 --- a/arch/powerpc/sysdev/cpm_common.c +++ b/arch/powerpc/sysdev/cpm_common.c | |||
@@ -85,9 +85,13 @@ int __init cpm_muram_init(void) | |||
85 | 85 | ||
86 | np = of_find_compatible_node(NULL, NULL, "fsl,cpm-muram-data"); | 86 | np = of_find_compatible_node(NULL, NULL, "fsl,cpm-muram-data"); |
87 | if (!np) { | 87 | if (!np) { |
88 | printk(KERN_ERR "Cannot find CPM muram data node"); | 88 | /* try legacy bindings */ |
89 | ret = -ENODEV; | 89 | np = of_find_node_by_name(NULL, "data-only"); |
90 | goto out; | 90 | if (!np) { |
91 | printk(KERN_ERR "Cannot find CPM muram data node"); | ||
92 | ret = -ENODEV; | ||
93 | goto out; | ||
94 | } | ||
91 | } | 95 | } |
92 | 96 | ||
93 | muram_pbase = of_translate_address(np, zero); | 97 | muram_pbase = of_translate_address(np, zero); |
@@ -189,6 +193,12 @@ void __iomem *cpm_muram_addr(unsigned long offset) | |||
189 | } | 193 | } |
190 | EXPORT_SYMBOL(cpm_muram_addr); | 194 | EXPORT_SYMBOL(cpm_muram_addr); |
191 | 195 | ||
196 | unsigned long cpm_muram_offset(void __iomem *addr) | ||
197 | { | ||
198 | return addr - (void __iomem *)muram_vbase; | ||
199 | } | ||
200 | EXPORT_SYMBOL(cpm_muram_offset); | ||
201 | |||
192 | /** | 202 | /** |
193 | * cpm_muram_dma - turn a muram virtual address into a DMA address | 203 | * cpm_muram_dma - turn a muram virtual address into a DMA address |
194 | * @offset: virtual address from cpm_muram_addr() to convert | 204 | * @offset: virtual address from cpm_muram_addr() to convert |
diff --git a/arch/powerpc/sysdev/qe_lib/qe.c b/arch/powerpc/sysdev/qe_lib/qe.c index cff550eec7e8..28e05df952de 100644 --- a/arch/powerpc/sysdev/qe_lib/qe.c +++ b/arch/powerpc/sysdev/qe_lib/qe.c | |||
@@ -35,7 +35,6 @@ | |||
35 | #include <asm/rheap.h> | 35 | #include <asm/rheap.h> |
36 | 36 | ||
37 | static void qe_snums_init(void); | 37 | static void qe_snums_init(void); |
38 | static void qe_muram_init(void); | ||
39 | static int qe_sdma_init(void); | 38 | static int qe_sdma_init(void); |
40 | 39 | ||
41 | static DEFINE_SPINLOCK(qe_lock); | 40 | static DEFINE_SPINLOCK(qe_lock); |
@@ -325,97 +324,6 @@ static int qe_sdma_init(void) | |||
325 | return 0; | 324 | return 0; |
326 | } | 325 | } |
327 | 326 | ||
328 | /* | ||
329 | * muram_alloc / muram_free bits. | ||
330 | */ | ||
331 | static DEFINE_SPINLOCK(qe_muram_lock); | ||
332 | |||
333 | /* 16 blocks should be enough to satisfy all requests | ||
334 | * until the memory subsystem goes up... */ | ||
335 | static rh_block_t qe_boot_muram_rh_block[16]; | ||
336 | static rh_info_t qe_muram_info; | ||
337 | |||
338 | static void qe_muram_init(void) | ||
339 | { | ||
340 | struct device_node *np; | ||
341 | const u32 *address; | ||
342 | u64 size; | ||
343 | unsigned int flags; | ||
344 | |||
345 | /* initialize the info header */ | ||
346 | rh_init(&qe_muram_info, 1, | ||
347 | sizeof(qe_boot_muram_rh_block) / | ||
348 | sizeof(qe_boot_muram_rh_block[0]), qe_boot_muram_rh_block); | ||
349 | |||
350 | /* Attach the usable muram area */ | ||
351 | /* XXX: This is a subset of the available muram. It | ||
352 | * varies with the processor and the microcode patches activated. | ||
353 | */ | ||
354 | np = of_find_compatible_node(NULL, NULL, "fsl,qe-muram-data"); | ||
355 | if (!np) { | ||
356 | np = of_find_node_by_name(NULL, "data-only"); | ||
357 | if (!np) { | ||
358 | WARN_ON(1); | ||
359 | return; | ||
360 | } | ||
361 | } | ||
362 | |||
363 | address = of_get_address(np, 0, &size, &flags); | ||
364 | WARN_ON(!address); | ||
365 | |||
366 | of_node_put(np); | ||
367 | if (address) | ||
368 | rh_attach_region(&qe_muram_info, *address, (int)size); | ||
369 | } | ||
370 | |||
371 | /* This function returns an index into the MURAM area. | ||
372 | */ | ||
373 | unsigned long qe_muram_alloc(int size, int align) | ||
374 | { | ||
375 | unsigned long start; | ||
376 | unsigned long flags; | ||
377 | |||
378 | spin_lock_irqsave(&qe_muram_lock, flags); | ||
379 | start = rh_alloc_align(&qe_muram_info, size, align, "QE"); | ||
380 | spin_unlock_irqrestore(&qe_muram_lock, flags); | ||
381 | |||
382 | return start; | ||
383 | } | ||
384 | EXPORT_SYMBOL(qe_muram_alloc); | ||
385 | |||
386 | int qe_muram_free(unsigned long offset) | ||
387 | { | ||
388 | int ret; | ||
389 | unsigned long flags; | ||
390 | |||
391 | spin_lock_irqsave(&qe_muram_lock, flags); | ||
392 | ret = rh_free(&qe_muram_info, offset); | ||
393 | spin_unlock_irqrestore(&qe_muram_lock, flags); | ||
394 | |||
395 | return ret; | ||
396 | } | ||
397 | EXPORT_SYMBOL(qe_muram_free); | ||
398 | |||
399 | /* not sure if this is ever needed */ | ||
400 | unsigned long qe_muram_alloc_fixed(unsigned long offset, int size) | ||
401 | { | ||
402 | unsigned long start; | ||
403 | unsigned long flags; | ||
404 | |||
405 | spin_lock_irqsave(&qe_muram_lock, flags); | ||
406 | start = rh_alloc_fixed(&qe_muram_info, offset, size, "commproc"); | ||
407 | spin_unlock_irqrestore(&qe_muram_lock, flags); | ||
408 | |||
409 | return start; | ||
410 | } | ||
411 | EXPORT_SYMBOL(qe_muram_alloc_fixed); | ||
412 | |||
413 | void qe_muram_dump(void) | ||
414 | { | ||
415 | rh_dump(&qe_muram_info); | ||
416 | } | ||
417 | EXPORT_SYMBOL(qe_muram_dump); | ||
418 | |||
419 | /* The maximum number of RISCs we support */ | 327 | /* The maximum number of RISCs we support */ |
420 | #define MAX_QE_RISC 2 | 328 | #define MAX_QE_RISC 2 |
421 | 329 | ||