diff options
Diffstat (limited to 'arch/powerpc/include/asm/cpm.h')
-rw-r--r-- | arch/powerpc/include/asm/cpm.h | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/cpm.h b/arch/powerpc/include/asm/cpm.h index 24d79e3abd8e..0835eb977ba9 100644 --- a/arch/powerpc/include/asm/cpm.h +++ b/arch/powerpc/include/asm/cpm.h | |||
@@ -3,8 +3,47 @@ | |||
3 | 3 | ||
4 | #include <linux/compiler.h> | 4 | #include <linux/compiler.h> |
5 | #include <linux/types.h> | 5 | #include <linux/types.h> |
6 | #include <linux/errno.h> | ||
6 | #include <linux/of.h> | 7 | #include <linux/of.h> |
7 | 8 | ||
9 | /* | ||
10 | * USB Controller pram common to QE and CPM. | ||
11 | */ | ||
12 | struct usb_ctlr { | ||
13 | u8 usb_usmod; | ||
14 | u8 usb_usadr; | ||
15 | u8 usb_uscom; | ||
16 | u8 res1[1]; | ||
17 | __be16 usb_usep[4]; | ||
18 | u8 res2[4]; | ||
19 | __be16 usb_usber; | ||
20 | u8 res3[2]; | ||
21 | __be16 usb_usbmr; | ||
22 | u8 res4[1]; | ||
23 | u8 usb_usbs; | ||
24 | /* Fields down below are QE-only */ | ||
25 | __be16 usb_ussft; | ||
26 | u8 res5[2]; | ||
27 | __be16 usb_usfrn; | ||
28 | u8 res6[0x22]; | ||
29 | } __attribute__ ((packed)); | ||
30 | |||
31 | /* | ||
32 | * Function code bits, usually generic to devices. | ||
33 | */ | ||
34 | #ifdef CONFIG_CPM1 | ||
35 | #define CPMFCR_GBL ((u_char)0x00) /* Flag doesn't exist in CPM1 */ | ||
36 | #define CPMFCR_TC2 ((u_char)0x00) /* Flag doesn't exist in CPM1 */ | ||
37 | #define CPMFCR_DTB ((u_char)0x00) /* Flag doesn't exist in CPM1 */ | ||
38 | #define CPMFCR_BDB ((u_char)0x00) /* Flag doesn't exist in CPM1 */ | ||
39 | #else | ||
40 | #define CPMFCR_GBL ((u_char)0x20) /* Set memory snooping */ | ||
41 | #define CPMFCR_TC2 ((u_char)0x04) /* Transfer code 2 value */ | ||
42 | #define CPMFCR_DTB ((u_char)0x02) /* Use local bus for data when set */ | ||
43 | #define CPMFCR_BDB ((u_char)0x01) /* Use local bus for BD when set */ | ||
44 | #endif | ||
45 | #define CPMFCR_EB ((u_char)0x10) /* Set big endian byte order */ | ||
46 | |||
8 | /* Opcodes common to CPM1 and CPM2 | 47 | /* Opcodes common to CPM1 and CPM2 |
9 | */ | 48 | */ |
10 | #define CPM_CR_INIT_TRX ((ushort)0x0000) | 49 | #define CPM_CR_INIT_TRX ((ushort)0x0000) |
@@ -93,13 +132,56 @@ typedef struct cpm_buf_desc { | |||
93 | #define BD_I2C_START (0x0400) | 132 | #define BD_I2C_START (0x0400) |
94 | 133 | ||
95 | int cpm_muram_init(void); | 134 | int cpm_muram_init(void); |
135 | |||
136 | #if defined(CONFIG_CPM) || defined(CONFIG_QUICC_ENGINE) | ||
96 | unsigned long cpm_muram_alloc(unsigned long size, unsigned long align); | 137 | unsigned long cpm_muram_alloc(unsigned long size, unsigned long align); |
97 | int cpm_muram_free(unsigned long offset); | 138 | int cpm_muram_free(unsigned long offset); |
98 | unsigned long cpm_muram_alloc_fixed(unsigned long offset, unsigned long size); | 139 | unsigned long cpm_muram_alloc_fixed(unsigned long offset, unsigned long size); |
99 | void __iomem *cpm_muram_addr(unsigned long offset); | 140 | void __iomem *cpm_muram_addr(unsigned long offset); |
100 | unsigned long cpm_muram_offset(void __iomem *addr); | 141 | unsigned long cpm_muram_offset(void __iomem *addr); |
101 | dma_addr_t cpm_muram_dma(void __iomem *addr); | 142 | dma_addr_t cpm_muram_dma(void __iomem *addr); |
143 | #else | ||
144 | static inline unsigned long cpm_muram_alloc(unsigned long size, | ||
145 | unsigned long align) | ||
146 | { | ||
147 | return -ENOSYS; | ||
148 | } | ||
149 | |||
150 | static inline int cpm_muram_free(unsigned long offset) | ||
151 | { | ||
152 | return -ENOSYS; | ||
153 | } | ||
154 | |||
155 | static inline unsigned long cpm_muram_alloc_fixed(unsigned long offset, | ||
156 | unsigned long size) | ||
157 | { | ||
158 | return -ENOSYS; | ||
159 | } | ||
160 | |||
161 | static inline void __iomem *cpm_muram_addr(unsigned long offset) | ||
162 | { | ||
163 | return NULL; | ||
164 | } | ||
165 | |||
166 | static inline unsigned long cpm_muram_offset(void __iomem *addr) | ||
167 | { | ||
168 | return -ENOSYS; | ||
169 | } | ||
170 | |||
171 | static inline dma_addr_t cpm_muram_dma(void __iomem *addr) | ||
172 | { | ||
173 | return 0; | ||
174 | } | ||
175 | #endif /* defined(CONFIG_CPM) || defined(CONFIG_QUICC_ENGINE) */ | ||
176 | |||
177 | #ifdef CONFIG_CPM | ||
102 | int cpm_command(u32 command, u8 opcode); | 178 | int cpm_command(u32 command, u8 opcode); |
179 | #else | ||
180 | static inline int cpm_command(u32 command, u8 opcode) | ||
181 | { | ||
182 | return -ENOSYS; | ||
183 | } | ||
184 | #endif /* CONFIG_CPM */ | ||
103 | 185 | ||
104 | int cpm2_gpiochip_add32(struct device_node *np); | 186 | int cpm2_gpiochip_add32(struct device_node *np); |
105 | 187 | ||