aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/sysdev/qe_lib
diff options
context:
space:
mode:
authorAnton Vorontsov <avorontsov@ru.mvista.com>2008-05-23 12:39:06 -0400
committerKumar Gala <galak@kernel.crashing.org>2008-06-10 12:11:21 -0400
commit5093bb965a163fe288c3e5db0275165f86c895c2 (patch)
tree77af9fbf28f45e277443be5abffb85feacc0097c /arch/powerpc/sysdev/qe_lib
parentb13e930906b313d787f4dd07fe78b74a3a8c22c4 (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/qe_lib')
-rw-r--r--arch/powerpc/sysdev/qe_lib/qe.c92
1 files changed, 0 insertions, 92 deletions
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
37static void qe_snums_init(void); 37static void qe_snums_init(void);
38static void qe_muram_init(void);
39static int qe_sdma_init(void); 38static int qe_sdma_init(void);
40 39
41static DEFINE_SPINLOCK(qe_lock); 40static 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 */
331static DEFINE_SPINLOCK(qe_muram_lock);
332
333/* 16 blocks should be enough to satisfy all requests
334 * until the memory subsystem goes up... */
335static rh_block_t qe_boot_muram_rh_block[16];
336static rh_info_t qe_muram_info;
337
338static 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 */
373unsigned 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}
384EXPORT_SYMBOL(qe_muram_alloc);
385
386int 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}
397EXPORT_SYMBOL(qe_muram_free);
398
399/* not sure if this is ever needed */
400unsigned 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}
411EXPORT_SYMBOL(qe_muram_alloc_fixed);
412
413void qe_muram_dump(void)
414{
415 rh_dump(&qe_muram_info);
416}
417EXPORT_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