aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ppc/8xx_io/commproc.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/ppc/8xx_io/commproc.c')
-rw-r--r--arch/ppc/8xx_io/commproc.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/arch/ppc/8xx_io/commproc.c b/arch/ppc/8xx_io/commproc.c
index 3b23bcb35b7a..7a8722beac12 100644
--- a/arch/ppc/8xx_io/commproc.c
+++ b/arch/ppc/8xx_io/commproc.c
@@ -39,6 +39,21 @@
39#include <asm/tlbflush.h> 39#include <asm/tlbflush.h>
40#include <asm/rheap.h> 40#include <asm/rheap.h>
41 41
42#define immr_map(member) \
43({ \
44 u32 offset = offsetof(immap_t, member); \
45 void *addr = ioremap (IMAP_ADDR + offset, \
46 sizeof( ((immap_t*)0)->member)); \
47 addr; \
48})
49
50#define immr_map_size(member, size) \
51({ \
52 u32 offset = offsetof(immap_t, member); \
53 void *addr = ioremap (IMAP_ADDR + offset, size); \
54 addr; \
55})
56
42static void m8xx_cpm_dpinit(void); 57static void m8xx_cpm_dpinit(void);
43static uint host_buffer; /* One page of host buffer */ 58static uint host_buffer; /* One page of host buffer */
44static uint host_end; /* end + 1 */ 59static uint host_end; /* end + 1 */
@@ -364,11 +379,16 @@ static rh_block_t cpm_boot_dpmem_rh_block[16];
364static rh_info_t cpm_dpmem_info; 379static rh_info_t cpm_dpmem_info;
365 380
366#define CPM_DPMEM_ALIGNMENT 8 381#define CPM_DPMEM_ALIGNMENT 8
382static u8* dpram_vbase;
383static uint dpram_pbase;
367 384
368void m8xx_cpm_dpinit(void) 385void m8xx_cpm_dpinit(void)
369{ 386{
370 spin_lock_init(&cpm_dpmem_lock); 387 spin_lock_init(&cpm_dpmem_lock);
371 388
389 dpram_vbase = immr_map_size(im_cpm.cp_dpmem, CPM_DATAONLY_BASE + CPM_DATAONLY_SIZE);
390 dpram_pbase = (uint)&((immap_t *)IMAP_ADDR)->im_cpm.cp_dpmem;
391
372 /* Initialize the info header */ 392 /* Initialize the info header */
373 rh_init(&cpm_dpmem_info, CPM_DPMEM_ALIGNMENT, 393 rh_init(&cpm_dpmem_info, CPM_DPMEM_ALIGNMENT,
374 sizeof(cpm_boot_dpmem_rh_block) / 394 sizeof(cpm_boot_dpmem_rh_block) /
@@ -442,3 +462,9 @@ void *cpm_dpram_addr(uint offset)
442 return ((immap_t *)IMAP_ADDR)->im_cpm.cp_dpmem + offset; 462 return ((immap_t *)IMAP_ADDR)->im_cpm.cp_dpmem + offset;
443} 463}
444EXPORT_SYMBOL(cpm_dpram_addr); 464EXPORT_SYMBOL(cpm_dpram_addr);
465
466uint cpm_dpram_phys(u8* addr)
467{
468 return (dpram_pbase + (uint)(addr - dpram_vbase));
469}
470EXPORT_SYMBOL(cpm_dpram_phys);