diff options
Diffstat (limited to 'arch/powerpc/sysdev/cpm2_common.c')
-rw-r--r-- | arch/powerpc/sysdev/cpm2_common.c | 35 |
1 files changed, 12 insertions, 23 deletions
diff --git a/arch/powerpc/sysdev/cpm2_common.c b/arch/powerpc/sysdev/cpm2_common.c index fc4c99565381..859362fecb7c 100644 --- a/arch/powerpc/sysdev/cpm2_common.c +++ b/arch/powerpc/sysdev/cpm2_common.c | |||
@@ -46,7 +46,10 @@ | |||
46 | 46 | ||
47 | #include <sysdev/fsl_soc.h> | 47 | #include <sysdev/fsl_soc.h> |
48 | 48 | ||
49 | #ifndef CONFIG_PPC_CPM_NEW_BINDING | ||
49 | static void cpm2_dpinit(void); | 50 | static void cpm2_dpinit(void); |
51 | #endif | ||
52 | |||
50 | cpm_cpm2_t __iomem *cpmp; /* Pointer to comm processor space */ | 53 | cpm_cpm2_t __iomem *cpmp; /* Pointer to comm processor space */ |
51 | 54 | ||
52 | /* We allocate this here because it is used almost exclusively for | 55 | /* We allocate this here because it is used almost exclusively for |
@@ -69,7 +72,11 @@ cpm2_reset(void) | |||
69 | 72 | ||
70 | /* Reclaim the DP memory for our use. | 73 | /* Reclaim the DP memory for our use. |
71 | */ | 74 | */ |
75 | #ifdef CONFIG_PPC_CPM_NEW_BINDING | ||
76 | cpm_muram_init(); | ||
77 | #else | ||
72 | cpm2_dpinit(); | 78 | cpm2_dpinit(); |
79 | #endif | ||
73 | 80 | ||
74 | /* Tell everyone where the comm processor resides. | 81 | /* Tell everyone where the comm processor resides. |
75 | */ | 82 | */ |
@@ -316,6 +323,7 @@ int cpm2_smc_clk_setup(enum cpm_clk_target target, int clock) | |||
316 | return ret; | 323 | return ret; |
317 | } | 324 | } |
318 | 325 | ||
326 | #ifndef CONFIG_PPC_CPM_NEW_BINDING | ||
319 | /* | 327 | /* |
320 | * dpalloc / dpfree bits. | 328 | * dpalloc / dpfree bits. |
321 | */ | 329 | */ |
@@ -328,28 +336,6 @@ static u8 __iomem *im_dprambase; | |||
328 | 336 | ||
329 | static void cpm2_dpinit(void) | 337 | static void cpm2_dpinit(void) |
330 | { | 338 | { |
331 | struct resource r; | ||
332 | |||
333 | #ifdef CONFIG_PPC_CPM_NEW_BINDING | ||
334 | struct device_node *np; | ||
335 | |||
336 | np = of_find_compatible_node(NULL, NULL, "fsl,cpm2"); | ||
337 | if (!np) | ||
338 | panic("Cannot find CPM2 node"); | ||
339 | |||
340 | if (of_address_to_resource(np, 1, &r)) | ||
341 | panic("Cannot get CPM2 resource 1"); | ||
342 | |||
343 | of_node_put(np); | ||
344 | #else | ||
345 | r.start = CPM_MAP_ADDR; | ||
346 | r.end = r.start + CPM_DATAONLY_BASE + CPM_DATAONLY_SIZE - 1; | ||
347 | #endif | ||
348 | |||
349 | im_dprambase = ioremap(r.start, r.end - r.start + 1); | ||
350 | if (!im_dprambase) | ||
351 | panic("Cannot map DPRAM"); | ||
352 | |||
353 | spin_lock_init(&cpm_dpmem_lock); | 339 | spin_lock_init(&cpm_dpmem_lock); |
354 | 340 | ||
355 | /* initialize the info header */ | 341 | /* initialize the info header */ |
@@ -358,13 +344,15 @@ static void cpm2_dpinit(void) | |||
358 | sizeof(cpm_boot_dpmem_rh_block[0]), | 344 | sizeof(cpm_boot_dpmem_rh_block[0]), |
359 | cpm_boot_dpmem_rh_block); | 345 | cpm_boot_dpmem_rh_block); |
360 | 346 | ||
347 | im_dprambase = cpm2_immr; | ||
348 | |||
361 | /* Attach the usable dpmem area */ | 349 | /* Attach the usable dpmem area */ |
362 | /* XXX: This is actually crap. CPM_DATAONLY_BASE and | 350 | /* XXX: This is actually crap. CPM_DATAONLY_BASE and |
363 | * CPM_DATAONLY_SIZE is only a subset of the available dpram. It | 351 | * CPM_DATAONLY_SIZE is only a subset of the available dpram. It |
364 | * varies with the processor and the microcode patches activated. | 352 | * varies with the processor and the microcode patches activated. |
365 | * But the following should be at least safe. | 353 | * But the following should be at least safe. |
366 | */ | 354 | */ |
367 | rh_attach_region(&cpm_dpmem_info, 0, r.end - r.start + 1); | 355 | rh_attach_region(&cpm_dpmem_info, CPM_DATAONLY_BASE, CPM_DATAONLY_SIZE); |
368 | } | 356 | } |
369 | 357 | ||
370 | /* This function returns an index into the DPRAM area. | 358 | /* This function returns an index into the DPRAM area. |
@@ -422,6 +410,7 @@ void *cpm_dpram_addr(unsigned long offset) | |||
422 | return (void *)(im_dprambase + offset); | 410 | return (void *)(im_dprambase + offset); |
423 | } | 411 | } |
424 | EXPORT_SYMBOL(cpm_dpram_addr); | 412 | EXPORT_SYMBOL(cpm_dpram_addr); |
413 | #endif /* !CONFIG_PPC_CPM_NEW_BINDING */ | ||
425 | 414 | ||
426 | struct cpm2_ioports { | 415 | struct cpm2_ioports { |
427 | u32 dir, par, sor, odr, dat; | 416 | u32 dir, par, sor, odr, dat; |