aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-powerpc
diff options
context:
space:
mode:
authorScott Wood <scottwood@freescale.com>2007-09-28 15:06:16 -0400
committerKumar Gala <galak@kernel.crashing.org>2007-10-04 16:47:05 -0400
commit15f8c604a79c4840ed76eecf3af5d88b7c1dee9e (patch)
treed86815bc2daf835fee081ee7dac92cef8784f6a3 /include/asm-powerpc
parent3c5df5c26ed17828760945d59653a2e22e3fb63f (diff)
[POWERPC] cpm: Describe multi-user ram in its own device node.
The way the current CPM binding describes available multi-user (a.k.a. dual-ported) RAM doesn't work well when there are multiple free regions, and it doesn't work at all if the region doesn't begin at the start of the muram area (as the hardware needs to be programmed with offsets into this area). The latter situation can happen with SMC UARTs on CPM2, as its parameter RAM is relocatable, u-boot puts it at zero, and the kernel doesn't support moving it. It is now described with a muram node, similar to QE. The current CPM binding is sufficiently recent (i.e. never appeared in an official release) that compatibility with existing device trees is not an issue. The code supporting the new binding is shared between cpm1 and cpm2, rather than remain separated. QE should be able to use this code as well, once minor fixes are made to its device trees. Signed-off-by: Scott Wood <scottwood@freescale.com> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'include/asm-powerpc')
-rw-r--r--include/asm-powerpc/commproc.h12
-rw-r--r--include/asm-powerpc/cpm.h14
-rw-r--r--include/asm-powerpc/cpm2.h10
3 files changed, 36 insertions, 0 deletions
diff --git a/include/asm-powerpc/commproc.h b/include/asm-powerpc/commproc.h
index 5dec32404fa2..0307c84a5c1d 100644
--- a/include/asm-powerpc/commproc.h
+++ b/include/asm-powerpc/commproc.h
@@ -19,6 +19,7 @@
19 19
20#include <asm/8xx_immap.h> 20#include <asm/8xx_immap.h>
21#include <asm/ptrace.h> 21#include <asm/ptrace.h>
22#include <asm/cpm.h>
22 23
23/* CPM Command register. 24/* CPM Command register.
24*/ 25*/
@@ -54,6 +55,7 @@
54 55
55#define mk_cr_cmd(CH, CMD) ((CMD << 8) | (CH << 4)) 56#define mk_cr_cmd(CH, CMD) ((CMD << 8) | (CH << 4))
56 57
58#ifndef CONFIG_PPC_CPM_NEW_BINDING
57/* The dual ported RAM is multi-functional. Some areas can be (and are 59/* The dual ported RAM is multi-functional. Some areas can be (and are
58 * being) used for microcode. There is an area that can only be used 60 * being) used for microcode. There is an area that can only be used
59 * as data ram for buffer descriptors, which is all we use right now. 61 * as data ram for buffer descriptors, which is all we use right now.
@@ -62,17 +64,27 @@
62#define CPM_DATAONLY_BASE ((uint)0x0800) 64#define CPM_DATAONLY_BASE ((uint)0x0800)
63#define CPM_DATAONLY_SIZE ((uint)0x0700) 65#define CPM_DATAONLY_SIZE ((uint)0x0700)
64#define CPM_DP_NOSPACE ((uint)0x7fffffff) 66#define CPM_DP_NOSPACE ((uint)0x7fffffff)
67#endif
65 68
66/* Export the base address of the communication processor registers 69/* Export the base address of the communication processor registers
67 * and dual port ram. 70 * and dual port ram.
68 */ 71 */
69extern cpm8xx_t __iomem *cpmp; /* Pointer to comm processor */ 72extern cpm8xx_t __iomem *cpmp; /* Pointer to comm processor */
73
74#ifdef CONFIG_PPC_CPM_NEW_BINDING
75#define cpm_dpalloc cpm_muram_alloc
76#define cpm_dpfree cpm_muram_free
77#define cpm_dpram_addr cpm_muram_addr
78#define cpm_dpram_phys cpm_muram_dma
79#else
70extern unsigned long cpm_dpalloc(uint size, uint align); 80extern unsigned long cpm_dpalloc(uint size, uint align);
71extern int cpm_dpfree(unsigned long offset); 81extern int cpm_dpfree(unsigned long offset);
72extern unsigned long cpm_dpalloc_fixed(unsigned long offset, uint size, uint align); 82extern unsigned long cpm_dpalloc_fixed(unsigned long offset, uint size, uint align);
73extern void cpm_dpdump(void); 83extern void cpm_dpdump(void);
74extern void *cpm_dpram_addr(unsigned long offset); 84extern void *cpm_dpram_addr(unsigned long offset);
75extern uint cpm_dpram_phys(u8* addr); 85extern uint cpm_dpram_phys(u8* addr);
86#endif
87
76extern void cpm_setbrg(uint brg, uint rate); 88extern void cpm_setbrg(uint brg, uint rate);
77 89
78extern uint m8xx_cpm_hostalloc(uint size); 90extern uint m8xx_cpm_hostalloc(uint size);
diff --git a/include/asm-powerpc/cpm.h b/include/asm-powerpc/cpm.h
new file mode 100644
index 000000000000..48df9f330e76
--- /dev/null
+++ b/include/asm-powerpc/cpm.h
@@ -0,0 +1,14 @@
1#ifndef __CPM_H
2#define __CPM_H
3
4#include <linux/compiler.h>
5#include <linux/types.h>
6
7int cpm_muram_init(void);
8unsigned long cpm_muram_alloc(unsigned long size, unsigned long align);
9int cpm_muram_free(unsigned long offset);
10unsigned long cpm_muram_alloc_fixed(unsigned long offset, unsigned long size);
11void __iomem *cpm_muram_addr(unsigned long offset);
12dma_addr_t cpm_muram_dma(void __iomem *addr);
13
14#endif
diff --git a/include/asm-powerpc/cpm2.h b/include/asm-powerpc/cpm2.h
index d7b57ac55892..e698b1d09dcf 100644
--- a/include/asm-powerpc/cpm2.h
+++ b/include/asm-powerpc/cpm2.h
@@ -11,6 +11,7 @@
11#define __CPM2__ 11#define __CPM2__
12 12
13#include <asm/immap_cpm2.h> 13#include <asm/immap_cpm2.h>
14#include <asm/cpm.h>
14 15
15/* CPM Command register. 16/* CPM Command register.
16*/ 17*/
@@ -82,6 +83,7 @@
82#define mk_cr_cmd(PG, SBC, MCN, OP) \ 83#define mk_cr_cmd(PG, SBC, MCN, OP) \
83 ((PG << 26) | (SBC << 21) | (MCN << 6) | OP) 84 ((PG << 26) | (SBC << 21) | (MCN << 6) | OP)
84 85
86#ifndef CONFIG_PPC_CPM_NEW_BINDING
85/* Dual Port RAM addresses. The first 16K is available for almost 87/* Dual Port RAM addresses. The first 16K is available for almost
86 * any CPM use, so we put the BDs there. The first 128 bytes are 88 * any CPM use, so we put the BDs there. The first 128 bytes are
87 * used for SMC1 and SMC2 parameter RAM, so we start allocating 89 * used for SMC1 and SMC2 parameter RAM, so we start allocating
@@ -97,6 +99,7 @@
97#define CPM_DATAONLY_SIZE ((uint)(16 * 1024) - CPM_DATAONLY_BASE) 99#define CPM_DATAONLY_SIZE ((uint)(16 * 1024) - CPM_DATAONLY_BASE)
98#define CPM_FCC_SPECIAL_BASE ((uint)0x0000b000) 100#define CPM_FCC_SPECIAL_BASE ((uint)0x0000b000)
99#endif 101#endif
102#endif
100 103
101/* The number of pages of host memory we allocate for CPM. This is 104/* The number of pages of host memory we allocate for CPM. This is
102 * done early in kernel initialization to get physically contiguous 105 * done early in kernel initialization to get physically contiguous
@@ -109,11 +112,18 @@
109 */ 112 */
110extern cpm_cpm2_t __iomem *cpmp; /* Pointer to comm processor */ 113extern cpm_cpm2_t __iomem *cpmp; /* Pointer to comm processor */
111 114
115#ifdef CONFIG_PPC_CPM_NEW_BINDING
116#define cpm_dpalloc cpm_muram_alloc
117#define cpm_dpfree cpm_muram_free
118#define cpm_dpram_addr cpm_muram_addr
119#else
112extern unsigned long cpm_dpalloc(uint size, uint align); 120extern unsigned long cpm_dpalloc(uint size, uint align);
113extern int cpm_dpfree(unsigned long offset); 121extern int cpm_dpfree(unsigned long offset);
114extern unsigned long cpm_dpalloc_fixed(unsigned long offset, uint size, uint align); 122extern unsigned long cpm_dpalloc_fixed(unsigned long offset, uint size, uint align);
115extern void cpm_dpdump(void); 123extern void cpm_dpdump(void);
116extern void *cpm_dpram_addr(unsigned long offset); 124extern void *cpm_dpram_addr(unsigned long offset);
125#endif
126
117extern void cpm_setbrg(uint brg, uint rate); 127extern void cpm_setbrg(uint brg, uint rate);
118extern void cpm2_fastbrg(uint brg, uint rate, int div16); 128extern void cpm2_fastbrg(uint brg, uint rate, int div16);
119extern void cpm2_reset(void); 129extern void cpm2_reset(void);