aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-12 00:55:47 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-12 00:55:47 -0400
commite86908614f2c7fec401827e5cefd7a6ea9407f85 (patch)
treefcb5d9e52422b37bdaf0e647126ebdfc1680f162 /include
parent547307420931344a868275bd7ea7a30f117a15a9 (diff)
parent9b4b8feb962f4b3e74768b7205f1f8f6cce87238 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc
* 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc: (408 commits) [POWERPC] Add memchr() to the bootwrapper [POWERPC] Implement logging of unhandled signals [POWERPC] Add legacy serial support for OPB with flattened device tree [POWERPC] Use 1TB segments [POWERPC] XilinxFB: Allow fixed framebuffer base address [POWERPC] XilinxFB: Add support for custom screen resolution [POWERPC] XilinxFB: Use pdata to pass around framebuffer parameters [POWERPC] PCI: Add 64-bit physical address support to setup_indirect_pci [POWERPC] 4xx: Kilauea defconfig file [POWERPC] 4xx: Kilauea DTS [POWERPC] 4xx: Add AMCC Kilauea eval board support to platforms/40x [POWERPC] 4xx: Add AMCC 405EX support to cputable.c [POWERPC] Adjust TASK_SIZE on ppc32 systems to 3GB that are capable [POWERPC] Use PAGE_OFFSET to tell if an address is user/kernel in SW TLB handlers [POWERPC] 85xx: Enable FP emulation in MPC8560 ADS defconfig [POWERPC] 85xx: Killed <asm/mpc85xx.h> [POWERPC] 85xx: Add cpm nodes for 8541/8555 CDS [POWERPC] 85xx: Convert mpc8560ads to the new CPM binding. [POWERPC] mpc8272ads: Remove muram from the CPM reg property. [POWERPC] Make clockevents work on PPC601 processors ... Fixed up conflict in Documentation/powerpc/booting-without-of.txt manually.
Diffstat (limited to 'include')
-rw-r--r--include/asm-powerpc/8xx_immap.h564
-rw-r--r--include/asm-powerpc/atomic.h34
-rw-r--r--include/asm-powerpc/cell-regs.h315
-rw-r--r--include/asm-powerpc/clk_interface.h20
-rw-r--r--include/asm-powerpc/commproc.h755
-rw-r--r--include/asm-powerpc/cpm.h14
-rw-r--r--include/asm-powerpc/cpm2.h1274
-rw-r--r--include/asm-powerpc/cputable.h40
-rw-r--r--include/asm-powerpc/dcr-mmio.h6
-rw-r--r--include/asm-powerpc/dcr-native.h6
-rw-r--r--include/asm-powerpc/dma-mapping.h24
-rw-r--r--include/asm-powerpc/elf.h9
-rw-r--r--include/asm-powerpc/exception.h311
-rw-r--r--include/asm-powerpc/fs_pd.h40
-rw-r--r--include/asm-powerpc/highmem.h135
-rw-r--r--include/asm-powerpc/hydra.h102
-rw-r--r--include/asm-powerpc/ide.h2
-rw-r--r--include/asm-powerpc/immap_86xx.h219
-rw-r--r--include/asm-powerpc/immap_cpm2.h650
-rw-r--r--include/asm-powerpc/immap_qe.h35
-rw-r--r--include/asm-powerpc/io.h28
-rw-r--r--include/asm-powerpc/irq.h8
-rw-r--r--include/asm-powerpc/iseries/hv_call_event.h10
-rw-r--r--include/asm-powerpc/iseries/iommu.h4
-rw-r--r--include/asm-powerpc/iseries/lpar_map.h3
-rw-r--r--include/asm-powerpc/iseries/vio.h116
-rw-r--r--include/asm-powerpc/kgdb.h57
-rw-r--r--include/asm-powerpc/lmb.h6
-rw-r--r--include/asm-powerpc/machdep.h10
-rw-r--r--include/asm-powerpc/mmu-40x.h65
-rw-r--r--include/asm-powerpc/mmu-hash64.h141
-rw-r--r--include/asm-powerpc/mmu.h3
-rw-r--r--include/asm-powerpc/mpc52xx.h12
-rw-r--r--include/asm-powerpc/mpc52xx_psc.h191
-rw-r--r--include/asm-powerpc/mpc85xx.h45
-rw-r--r--include/asm-powerpc/mpic.h13
-rw-r--r--include/asm-powerpc/nvram.h6
-rw-r--r--include/asm-powerpc/paca.h11
-rw-r--r--include/asm-powerpc/page_64.h17
-rw-r--r--include/asm-powerpc/pci-bridge.h3
-rw-r--r--include/asm-powerpc/percpu.h2
-rw-r--r--include/asm-powerpc/pgtable-4k.h2
-rw-r--r--include/asm-powerpc/pgtable-64k.h2
-rw-r--r--include/asm-powerpc/ppc_asm.h18
-rw-r--r--include/asm-powerpc/processor.h4
-rw-r--r--include/asm-powerpc/prom.h3
-rw-r--r--include/asm-powerpc/ps3.h9
-rw-r--r--include/asm-powerpc/qe.h246
-rw-r--r--include/asm-powerpc/qe_ic.h68
-rw-r--r--include/asm-powerpc/reg.h52
-rw-r--r--include/asm-powerpc/rwsem.h4
-rw-r--r--include/asm-powerpc/smp.h2
-rw-r--r--include/asm-powerpc/spu.h28
-rw-r--r--include/asm-powerpc/system.h3
-rw-r--r--include/asm-powerpc/time.h3
-rw-r--r--include/asm-powerpc/tlb.h2
-rw-r--r--include/asm-powerpc/tlbflush.h3
-rw-r--r--include/asm-powerpc/types.h2
-rw-r--r--include/asm-powerpc/ucc.h40
-rw-r--r--include/asm-powerpc/ucc_slow.h9
-rw-r--r--include/asm-powerpc/udbg.h1
-rw-r--r--include/asm-powerpc/vio.h6
-rw-r--r--include/asm-powerpc/xilinx_intc.h20
-rw-r--r--include/asm-ppc/amigahw.h16
-rw-r--r--include/asm-ppc/amigaints.h133
-rw-r--r--include/asm-ppc/amigappc.h85
-rw-r--r--include/asm-ppc/ans-lcd.h11
-rw-r--r--include/asm-ppc/bootinfo.h5
-rw-r--r--include/asm-ppc/io.h51
-rw-r--r--include/asm-ppc/machdep.h4
-rw-r--r--include/asm-ppc/ocp.h2
-rw-r--r--include/asm-ppc/page.h44
-rw-r--r--include/asm-ppc/pgtable.h8
-rw-r--r--include/asm-ppc/prom.h1
-rw-r--r--include/linux/elf.h14
-rw-r--r--include/linux/of.h1
-rw-r--r--include/linux/pci_ids.h3
-rw-r--r--include/linux/xilinxfb.h30
78 files changed, 5412 insertions, 829 deletions
diff --git a/include/asm-powerpc/8xx_immap.h b/include/asm-powerpc/8xx_immap.h
new file mode 100644
index 000000000000..1311cefdfd30
--- /dev/null
+++ b/include/asm-powerpc/8xx_immap.h
@@ -0,0 +1,564 @@
1/*
2 * MPC8xx Internal Memory Map
3 * Copyright (c) 1997 Dan Malek (dmalek@jlc.net)
4 *
5 * The I/O on the MPC860 is comprised of blocks of special registers
6 * and the dual port ram for the Communication Processor Module.
7 * Within this space are functional units such as the SIU, memory
8 * controller, system timers, and other control functions. It is
9 * a combination that I found difficult to separate into logical
10 * functional files.....but anyone else is welcome to try. -- Dan
11 */
12#ifdef __KERNEL__
13#ifndef __IMMAP_8XX__
14#define __IMMAP_8XX__
15
16/* System configuration registers.
17*/
18typedef struct sys_conf {
19 uint sc_siumcr;
20 uint sc_sypcr;
21 uint sc_swt;
22 char res1[2];
23 ushort sc_swsr;
24 uint sc_sipend;
25 uint sc_simask;
26 uint sc_siel;
27 uint sc_sivec;
28 uint sc_tesr;
29 char res2[0xc];
30 uint sc_sdcr;
31 char res3[0x4c];
32} sysconf8xx_t;
33
34/* PCMCIA configuration registers.
35*/
36typedef struct pcmcia_conf {
37 uint pcmc_pbr0;
38 uint pcmc_por0;
39 uint pcmc_pbr1;
40 uint pcmc_por1;
41 uint pcmc_pbr2;
42 uint pcmc_por2;
43 uint pcmc_pbr3;
44 uint pcmc_por3;
45 uint pcmc_pbr4;
46 uint pcmc_por4;
47 uint pcmc_pbr5;
48 uint pcmc_por5;
49 uint pcmc_pbr6;
50 uint pcmc_por6;
51 uint pcmc_pbr7;
52 uint pcmc_por7;
53 char res1[0x20];
54 uint pcmc_pgcra;
55 uint pcmc_pgcrb;
56 uint pcmc_pscr;
57 char res2[4];
58 uint pcmc_pipr;
59 char res3[4];
60 uint pcmc_per;
61 char res4[4];
62} pcmconf8xx_t;
63
64/* Memory controller registers.
65*/
66typedef struct mem_ctlr {
67 uint memc_br0;
68 uint memc_or0;
69 uint memc_br1;
70 uint memc_or1;
71 uint memc_br2;
72 uint memc_or2;
73 uint memc_br3;
74 uint memc_or3;
75 uint memc_br4;
76 uint memc_or4;
77 uint memc_br5;
78 uint memc_or5;
79 uint memc_br6;
80 uint memc_or6;
81 uint memc_br7;
82 uint memc_or7;
83 char res1[0x24];
84 uint memc_mar;
85 uint memc_mcr;
86 char res2[4];
87 uint memc_mamr;
88 uint memc_mbmr;
89 ushort memc_mstat;
90 ushort memc_mptpr;
91 uint memc_mdr;
92 char res3[0x80];
93} memctl8xx_t;
94
95/*-----------------------------------------------------------------------
96 * BR - Memory Controler: Base Register 16-9
97 */
98#define BR_BA_MSK 0xffff8000 /* Base Address Mask */
99#define BR_AT_MSK 0x00007000 /* Address Type Mask */
100#define BR_PS_MSK 0x00000c00 /* Port Size Mask */
101#define BR_PS_32 0x00000000 /* 32 bit port size */
102#define BR_PS_16 0x00000800 /* 16 bit port size */
103#define BR_PS_8 0x00000400 /* 8 bit port size */
104#define BR_PARE 0x00000200 /* Parity Enable */
105#define BR_WP 0x00000100 /* Write Protect */
106#define BR_MS_MSK 0x000000c0 /* Machine Select Mask */
107#define BR_MS_GPCM 0x00000000 /* G.P.C.M. Machine Select */
108#define BR_MS_UPMA 0x00000080 /* U.P.M.A Machine Select */
109#define BR_MS_UPMB 0x000000c0 /* U.P.M.B Machine Select */
110#define BR_V 0x00000001 /* Bank Valid */
111
112/*-----------------------------------------------------------------------
113 * OR - Memory Controler: Option Register 16-11
114 */
115#define OR_AM_MSK 0xffff8000 /* Address Mask Mask */
116#define OR_ATM_MSK 0x00007000 /* Address Type Mask Mask */
117#define OR_CSNT_SAM 0x00000800 /* Chip Select Negation Time/ Start */
118 /* Address Multiplex */
119#define OR_ACS_MSK 0x00000600 /* Address to Chip Select Setup mask */
120#define OR_ACS_DIV1 0x00000000 /* CS is output at the same time */
121#define OR_ACS_DIV4 0x00000400 /* CS is output 1/4 a clock later */
122#define OR_ACS_DIV2 0x00000600 /* CS is output 1/2 a clock later */
123#define OR_G5LA 0x00000400 /* Output #GPL5 on #GPL_A5 */
124#define OR_G5LS 0x00000200 /* Drive #GPL high on falling edge of...*/
125#define OR_BI 0x00000100 /* Burst inhibit */
126#define OR_SCY_MSK 0x000000f0 /* Cycle Lenght in Clocks */
127#define OR_SCY_0_CLK 0x00000000 /* 0 clock cycles wait states */
128#define OR_SCY_1_CLK 0x00000010 /* 1 clock cycles wait states */
129#define OR_SCY_2_CLK 0x00000020 /* 2 clock cycles wait states */
130#define OR_SCY_3_CLK 0x00000030 /* 3 clock cycles wait states */
131#define OR_SCY_4_CLK 0x00000040 /* 4 clock cycles wait states */
132#define OR_SCY_5_CLK 0x00000050 /* 5 clock cycles wait states */
133#define OR_SCY_6_CLK 0x00000060 /* 6 clock cycles wait states */
134#define OR_SCY_7_CLK 0x00000070 /* 7 clock cycles wait states */
135#define OR_SCY_8_CLK 0x00000080 /* 8 clock cycles wait states */
136#define OR_SCY_9_CLK 0x00000090 /* 9 clock cycles wait states */
137#define OR_SCY_10_CLK 0x000000a0 /* 10 clock cycles wait states */
138#define OR_SCY_11_CLK 0x000000b0 /* 11 clock cycles wait states */
139#define OR_SCY_12_CLK 0x000000c0 /* 12 clock cycles wait states */
140#define OR_SCY_13_CLK 0x000000d0 /* 13 clock cycles wait states */
141#define OR_SCY_14_CLK 0x000000e0 /* 14 clock cycles wait states */
142#define OR_SCY_15_CLK 0x000000f0 /* 15 clock cycles wait states */
143#define OR_SETA 0x00000008 /* External Transfer Acknowledge */
144#define OR_TRLX 0x00000004 /* Timing Relaxed */
145#define OR_EHTR 0x00000002 /* Extended Hold Time on Read */
146
147/* System Integration Timers.
148*/
149typedef struct sys_int_timers {
150 ushort sit_tbscr;
151 char res0[0x02];
152 uint sit_tbreff0;
153 uint sit_tbreff1;
154 char res1[0x14];
155 ushort sit_rtcsc;
156 char res2[0x02];
157 uint sit_rtc;
158 uint sit_rtsec;
159 uint sit_rtcal;
160 char res3[0x10];
161 ushort sit_piscr;
162 char res4[2];
163 uint sit_pitc;
164 uint sit_pitr;
165 char res5[0x34];
166} sit8xx_t;
167
168#define TBSCR_TBIRQ_MASK ((ushort)0xff00)
169#define TBSCR_REFA ((ushort)0x0080)
170#define TBSCR_REFB ((ushort)0x0040)
171#define TBSCR_REFAE ((ushort)0x0008)
172#define TBSCR_REFBE ((ushort)0x0004)
173#define TBSCR_TBF ((ushort)0x0002)
174#define TBSCR_TBE ((ushort)0x0001)
175
176#define RTCSC_RTCIRQ_MASK ((ushort)0xff00)
177#define RTCSC_SEC ((ushort)0x0080)
178#define RTCSC_ALR ((ushort)0x0040)
179#define RTCSC_38K ((ushort)0x0010)
180#define RTCSC_SIE ((ushort)0x0008)
181#define RTCSC_ALE ((ushort)0x0004)
182#define RTCSC_RTF ((ushort)0x0002)
183#define RTCSC_RTE ((ushort)0x0001)
184
185#define PISCR_PIRQ_MASK ((ushort)0xff00)
186#define PISCR_PS ((ushort)0x0080)
187#define PISCR_PIE ((ushort)0x0004)
188#define PISCR_PTF ((ushort)0x0002)
189#define PISCR_PTE ((ushort)0x0001)
190
191/* Clocks and Reset.
192*/
193typedef struct clk_and_reset {
194 uint car_sccr;
195 uint car_plprcr;
196 uint car_rsr;
197 char res[0x74]; /* Reserved area */
198} car8xx_t;
199
200/* System Integration Timers keys.
201*/
202typedef struct sitk {
203 uint sitk_tbscrk;
204 uint sitk_tbreff0k;
205 uint sitk_tbreff1k;
206 uint sitk_tbk;
207 char res1[0x10];
208 uint sitk_rtcsck;
209 uint sitk_rtck;
210 uint sitk_rtseck;
211 uint sitk_rtcalk;
212 char res2[0x10];
213 uint sitk_piscrk;
214 uint sitk_pitck;
215 char res3[0x38];
216} sitk8xx_t;
217
218/* Clocks and reset keys.
219*/
220typedef struct cark {
221 uint cark_sccrk;
222 uint cark_plprcrk;
223 uint cark_rsrk;
224 char res[0x474];
225} cark8xx_t;
226
227/* The key to unlock registers maintained by keep-alive power.
228*/
229#define KAPWR_KEY ((unsigned int)0x55ccaa33)
230
231/* Video interface. MPC823 Only.
232*/
233typedef struct vid823 {
234 ushort vid_vccr;
235 ushort res1;
236 u_char vid_vsr;
237 u_char res2;
238 u_char vid_vcmr;
239 u_char res3;
240 uint vid_vbcb;
241 uint res4;
242 uint vid_vfcr0;
243 uint vid_vfaa0;
244 uint vid_vfba0;
245 uint vid_vfcr1;
246 uint vid_vfaa1;
247 uint vid_vfba1;
248 u_char res5[0x18];
249} vid823_t;
250
251/* LCD interface. 823 Only.
252*/
253typedef struct lcd {
254 uint lcd_lccr;
255 uint lcd_lchcr;
256 uint lcd_lcvcr;
257 char res1[4];
258 uint lcd_lcfaa;
259 uint lcd_lcfba;
260 char lcd_lcsr;
261 char res2[0x7];
262} lcd823_t;
263
264/* I2C
265*/
266typedef struct i2c {
267 u_char i2c_i2mod;
268 char res1[3];
269 u_char i2c_i2add;
270 char res2[3];
271 u_char i2c_i2brg;
272 char res3[3];
273 u_char i2c_i2com;
274 char res4[3];
275 u_char i2c_i2cer;
276 char res5[3];
277 u_char i2c_i2cmr;
278 char res6[0x8b];
279} i2c8xx_t;
280
281/* DMA control/status registers.
282*/
283typedef struct sdma_csr {
284 char res1[4];
285 uint sdma_sdar;
286 u_char sdma_sdsr;
287 char res3[3];
288 u_char sdma_sdmr;
289 char res4[3];
290 u_char sdma_idsr1;
291 char res5[3];
292 u_char sdma_idmr1;
293 char res6[3];
294 u_char sdma_idsr2;
295 char res7[3];
296 u_char sdma_idmr2;
297 char res8[0x13];
298} sdma8xx_t;
299
300/* Communication Processor Module Interrupt Controller.
301*/
302typedef struct cpm_ic {
303 ushort cpic_civr;
304 char res[0xe];
305 uint cpic_cicr;
306 uint cpic_cipr;
307 uint cpic_cimr;
308 uint cpic_cisr;
309} cpic8xx_t;
310
311/* Input/Output Port control/status registers.
312*/
313typedef struct io_port {
314 ushort iop_padir;
315 ushort iop_papar;
316 ushort iop_paodr;
317 ushort iop_padat;
318 char res1[8];
319 ushort iop_pcdir;
320 ushort iop_pcpar;
321 ushort iop_pcso;
322 ushort iop_pcdat;
323 ushort iop_pcint;
324 char res2[6];
325 ushort iop_pddir;
326 ushort iop_pdpar;
327 char res3[2];
328 ushort iop_pddat;
329 uint utmode;
330 char res4[4];
331} iop8xx_t;
332
333/* Communication Processor Module Timers
334*/
335typedef struct cpm_timers {
336 ushort cpmt_tgcr;
337 char res1[0xe];
338 ushort cpmt_tmr1;
339 ushort cpmt_tmr2;
340 ushort cpmt_trr1;
341 ushort cpmt_trr2;
342 ushort cpmt_tcr1;
343 ushort cpmt_tcr2;
344 ushort cpmt_tcn1;
345 ushort cpmt_tcn2;
346 ushort cpmt_tmr3;
347 ushort cpmt_tmr4;
348 ushort cpmt_trr3;
349 ushort cpmt_trr4;
350 ushort cpmt_tcr3;
351 ushort cpmt_tcr4;
352 ushort cpmt_tcn3;
353 ushort cpmt_tcn4;
354 ushort cpmt_ter1;
355 ushort cpmt_ter2;
356 ushort cpmt_ter3;
357 ushort cpmt_ter4;
358 char res2[8];
359} cpmtimer8xx_t;
360
361/* Finally, the Communication Processor stuff.....
362*/
363typedef struct scc { /* Serial communication channels */
364 uint scc_gsmrl;
365 uint scc_gsmrh;
366 ushort scc_psmr;
367 char res1[2];
368 ushort scc_todr;
369 ushort scc_dsr;
370 ushort scc_scce;
371 char res2[2];
372 ushort scc_sccm;
373 char res3;
374 u_char scc_sccs;
375 char res4[8];
376} scc_t;
377
378typedef struct smc { /* Serial management channels */
379 char res1[2];
380 ushort smc_smcmr;
381 char res2[2];
382 u_char smc_smce;
383 char res3[3];
384 u_char smc_smcm;
385 char res4[5];
386} smc_t;
387
388/* MPC860T Fast Ethernet Controller. It isn't part of the CPM, but
389 * it fits within the address space.
390 */
391
392typedef struct fec {
393 uint fec_addr_low; /* lower 32 bits of station address */
394 ushort fec_addr_high; /* upper 16 bits of station address */
395 ushort res1; /* reserved */
396 uint fec_hash_table_high; /* upper 32-bits of hash table */
397 uint fec_hash_table_low; /* lower 32-bits of hash table */
398 uint fec_r_des_start; /* beginning of Rx descriptor ring */
399 uint fec_x_des_start; /* beginning of Tx descriptor ring */
400 uint fec_r_buff_size; /* Rx buffer size */
401 uint res2[9]; /* reserved */
402 uint fec_ecntrl; /* ethernet control register */
403 uint fec_ievent; /* interrupt event register */
404 uint fec_imask; /* interrupt mask register */
405 uint fec_ivec; /* interrupt level and vector status */
406 uint fec_r_des_active; /* Rx ring updated flag */
407 uint fec_x_des_active; /* Tx ring updated flag */
408 uint res3[10]; /* reserved */
409 uint fec_mii_data; /* MII data register */
410 uint fec_mii_speed; /* MII speed control register */
411 uint res4[17]; /* reserved */
412 uint fec_r_bound; /* end of RAM (read-only) */
413 uint fec_r_fstart; /* Rx FIFO start address */
414 uint res5[6]; /* reserved */
415 uint fec_x_fstart; /* Tx FIFO start address */
416 uint res6[17]; /* reserved */
417 uint fec_fun_code; /* fec SDMA function code */
418 uint res7[3]; /* reserved */
419 uint fec_r_cntrl; /* Rx control register */
420 uint fec_r_hash; /* Rx hash register */
421 uint res8[14]; /* reserved */
422 uint fec_x_cntrl; /* Tx control register */
423 uint res9[0x1e]; /* reserved */
424} fec_t;
425
426/* The FEC and LCD color map share the same address space....
427 * I guess we will never see an 823T :-).
428 */
429union fec_lcd {
430 fec_t fl_un_fec;
431 u_char fl_un_cmap[0x200];
432};
433
434typedef struct comm_proc {
435 /* General control and status registers.
436 */
437 ushort cp_cpcr;
438 u_char res1[2];
439 ushort cp_rccr;
440 u_char res2;
441 u_char cp_rmds;
442 u_char res3[4];
443 ushort cp_cpmcr1;
444 ushort cp_cpmcr2;
445 ushort cp_cpmcr3;
446 ushort cp_cpmcr4;
447 u_char res4[2];
448 ushort cp_rter;
449 u_char res5[2];
450 ushort cp_rtmr;
451 u_char res6[0x14];
452
453 /* Baud rate generators.
454 */
455 uint cp_brgc1;
456 uint cp_brgc2;
457 uint cp_brgc3;
458 uint cp_brgc4;
459
460 /* Serial Communication Channels.
461 */
462 scc_t cp_scc[4];
463
464 /* Serial Management Channels.
465 */
466 smc_t cp_smc[2];
467
468 /* Serial Peripheral Interface.
469 */
470 ushort cp_spmode;
471 u_char res7[4];
472 u_char cp_spie;
473 u_char res8[3];
474 u_char cp_spim;
475 u_char res9[2];
476 u_char cp_spcom;
477 u_char res10[2];
478
479 /* Parallel Interface Port.
480 */
481 u_char res11[2];
482 ushort cp_pipc;
483 u_char res12[2];
484 ushort cp_ptpr;
485 uint cp_pbdir;
486 uint cp_pbpar;
487 u_char res13[2];
488 ushort cp_pbodr;
489 uint cp_pbdat;
490
491 /* Port E - MPC87x/88x only.
492 */
493 uint cp_pedir;
494 uint cp_pepar;
495 uint cp_peso;
496 uint cp_peodr;
497 uint cp_pedat;
498
499 /* Communications Processor Timing Register -
500 Contains RMII Timing for the FECs on MPC87x/88x only.
501 */
502 uint cp_cptr;
503
504 /* Serial Interface and Time Slot Assignment.
505 */
506 uint cp_simode;
507 u_char cp_sigmr;
508 u_char res15;
509 u_char cp_sistr;
510 u_char cp_sicmr;
511 u_char res16[4];
512 uint cp_sicr;
513 uint cp_sirp;
514 u_char res17[0xc];
515
516 /* 256 bytes of MPC823 video controller RAM array.
517 */
518 u_char cp_vcram[0x100];
519 u_char cp_siram[0x200];
520
521 /* The fast ethernet controller is not really part of the CPM,
522 * but it resides in the address space.
523 * The LCD color map is also here.
524 */
525 union fec_lcd fl_un;
526#define cp_fec fl_un.fl_un_fec
527#define lcd_cmap fl_un.fl_un_cmap
528 char res18[0xE00];
529
530 /* The DUET family has a second FEC here */
531 fec_t cp_fec2;
532#define cp_fec1 cp_fec /* consistency macro */
533
534 /* Dual Ported RAM follows.
535 * There are many different formats for this memory area
536 * depending upon the devices used and options chosen.
537 * Some processors don't have all of it populated.
538 */
539 u_char cp_dpmem[0x1C00]; /* BD / Data / ucode */
540 u_char cp_dparam[0x400]; /* Parameter RAM */
541} cpm8xx_t;
542
543/* Internal memory map.
544*/
545typedef struct immap {
546 sysconf8xx_t im_siu_conf; /* SIU Configuration */
547 pcmconf8xx_t im_pcmcia; /* PCMCIA Configuration */
548 memctl8xx_t im_memctl; /* Memory Controller */
549 sit8xx_t im_sit; /* System integration timers */
550 car8xx_t im_clkrst; /* Clocks and reset */
551 sitk8xx_t im_sitk; /* Sys int timer keys */
552 cark8xx_t im_clkrstk; /* Clocks and reset keys */
553 vid823_t im_vid; /* Video (823 only) */
554 lcd823_t im_lcd; /* LCD (823 only) */
555 i2c8xx_t im_i2c; /* I2C control/status */
556 sdma8xx_t im_sdma; /* SDMA control/status */
557 cpic8xx_t im_cpic; /* CPM Interrupt Controller */
558 iop8xx_t im_ioport; /* IO Port control/status */
559 cpmtimer8xx_t im_cpmtimer; /* CPM timers */
560 cpm8xx_t im_cpm; /* Communication processor */
561} immap_t;
562
563#endif /* __IMMAP_8XX__ */
564#endif /* __KERNEL__ */
diff --git a/include/asm-powerpc/atomic.h b/include/asm-powerpc/atomic.h
index c44810b9d322..f3fc733758f5 100644
--- a/include/asm-powerpc/atomic.h
+++ b/include/asm-powerpc/atomic.h
@@ -5,7 +5,7 @@
5 * PowerPC atomic operations 5 * PowerPC atomic operations
6 */ 6 */
7 7
8typedef struct { volatile int counter; } atomic_t; 8typedef struct { int counter; } atomic_t;
9 9
10#ifdef __KERNEL__ 10#ifdef __KERNEL__
11#include <linux/compiler.h> 11#include <linux/compiler.h>
@@ -15,8 +15,19 @@ typedef struct { volatile int counter; } atomic_t;
15 15
16#define ATOMIC_INIT(i) { (i) } 16#define ATOMIC_INIT(i) { (i) }
17 17
18#define atomic_read(v) ((v)->counter) 18static __inline__ int atomic_read(const atomic_t *v)
19#define atomic_set(v,i) (((v)->counter) = (i)) 19{
20 int t;
21
22 __asm__ __volatile__("lwz%U1%X1 %0,%1" : "=r"(t) : "m"(v->counter));
23
24 return t;
25}
26
27static __inline__ void atomic_set(atomic_t *v, int i)
28{
29 __asm__ __volatile__("stw%U0%X0 %1,%0" : "=m"(v->counter) : "r"(i));
30}
20 31
21static __inline__ void atomic_add(int a, atomic_t *v) 32static __inline__ void atomic_add(int a, atomic_t *v)
22{ 33{
@@ -240,12 +251,23 @@ static __inline__ int atomic_dec_if_positive(atomic_t *v)
240 251
241#ifdef __powerpc64__ 252#ifdef __powerpc64__
242 253
243typedef struct { volatile long counter; } atomic64_t; 254typedef struct { long counter; } atomic64_t;
244 255
245#define ATOMIC64_INIT(i) { (i) } 256#define ATOMIC64_INIT(i) { (i) }
246 257
247#define atomic64_read(v) ((v)->counter) 258static __inline__ long atomic64_read(const atomic64_t *v)
248#define atomic64_set(v,i) (((v)->counter) = (i)) 259{
260 long t;
261
262 __asm__ __volatile__("ld%U1%X1 %0,%1" : "=r"(t) : "m"(v->counter));
263
264 return t;
265}
266
267static __inline__ void atomic64_set(atomic64_t *v, long i)
268{
269 __asm__ __volatile__("std%U0%X0 %1,%0" : "=m"(v->counter) : "r"(i));
270}
249 271
250static __inline__ void atomic64_add(long a, atomic64_t *v) 272static __inline__ void atomic64_add(long a, atomic64_t *v)
251{ 273{
diff --git a/include/asm-powerpc/cell-regs.h b/include/asm-powerpc/cell-regs.h
new file mode 100644
index 000000000000..fd6fd00434ef
--- /dev/null
+++ b/include/asm-powerpc/cell-regs.h
@@ -0,0 +1,315 @@
1/*
2 * cbe_regs.h
3 *
4 * This file is intended to hold the various register definitions for CBE
5 * on-chip system devices (memory controller, IO controller, etc...)
6 *
7 * (C) Copyright IBM Corporation 2001,2006
8 *
9 * Authors: Maximino Aguilar (maguilar@us.ibm.com)
10 * David J. Erb (djerb@us.ibm.com)
11 *
12 * (c) 2006 Benjamin Herrenschmidt <benh@kernel.crashing.org>, IBM Corp.
13 */
14
15#ifndef CBE_REGS_H
16#define CBE_REGS_H
17
18#include <asm/cell-pmu.h>
19
20/*
21 *
22 * Some HID register definitions
23 *
24 */
25
26/* CBE specific HID0 bits */
27#define HID0_CBE_THERM_WAKEUP 0x0000020000000000ul
28#define HID0_CBE_SYSERR_WAKEUP 0x0000008000000000ul
29#define HID0_CBE_THERM_INT_EN 0x0000000400000000ul
30#define HID0_CBE_SYSERR_INT_EN 0x0000000200000000ul
31
32#define MAX_CBE 2
33
34/*
35 *
36 * Pervasive unit register definitions
37 *
38 */
39
40union spe_reg {
41 u64 val;
42 u8 spe[8];
43};
44
45union ppe_spe_reg {
46 u64 val;
47 struct {
48 u32 ppe;
49 u32 spe;
50 };
51};
52
53
54struct cbe_pmd_regs {
55 /* Debug Bus Control */
56 u64 pad_0x0000; /* 0x0000 */
57
58 u64 group_control; /* 0x0008 */
59
60 u8 pad_0x0010_0x00a8 [0x00a8 - 0x0010]; /* 0x0010 */
61
62 u64 debug_bus_control; /* 0x00a8 */
63
64 u8 pad_0x00b0_0x0100 [0x0100 - 0x00b0]; /* 0x00b0 */
65
66 u64 trace_aux_data; /* 0x0100 */
67 u64 trace_buffer_0_63; /* 0x0108 */
68 u64 trace_buffer_64_127; /* 0x0110 */
69 u64 trace_address; /* 0x0118 */
70 u64 ext_tr_timer; /* 0x0120 */
71
72 u8 pad_0x0128_0x0400 [0x0400 - 0x0128]; /* 0x0128 */
73
74 /* Performance Monitor */
75 u64 pm_status; /* 0x0400 */
76 u64 pm_control; /* 0x0408 */
77 u64 pm_interval; /* 0x0410 */
78 u64 pm_ctr[4]; /* 0x0418 */
79 u64 pm_start_stop; /* 0x0438 */
80 u64 pm07_control[8]; /* 0x0440 */
81
82 u8 pad_0x0480_0x0800 [0x0800 - 0x0480]; /* 0x0480 */
83
84 /* Thermal Sensor Registers */
85 union spe_reg ts_ctsr1; /* 0x0800 */
86 u64 ts_ctsr2; /* 0x0808 */
87 union spe_reg ts_mtsr1; /* 0x0810 */
88 u64 ts_mtsr2; /* 0x0818 */
89 union spe_reg ts_itr1; /* 0x0820 */
90 u64 ts_itr2; /* 0x0828 */
91 u64 ts_gitr; /* 0x0830 */
92 u64 ts_isr; /* 0x0838 */
93 u64 ts_imr; /* 0x0840 */
94 union spe_reg tm_cr1; /* 0x0848 */
95 u64 tm_cr2; /* 0x0850 */
96 u64 tm_simr; /* 0x0858 */
97 union ppe_spe_reg tm_tpr; /* 0x0860 */
98 union spe_reg tm_str1; /* 0x0868 */
99 u64 tm_str2; /* 0x0870 */
100 union ppe_spe_reg tm_tsr; /* 0x0878 */
101
102 /* Power Management */
103 u64 pmcr; /* 0x0880 */
104#define CBE_PMD_PAUSE_ZERO_CONTROL 0x10000
105 u64 pmsr; /* 0x0888 */
106
107 /* Time Base Register */
108 u64 tbr; /* 0x0890 */
109
110 u8 pad_0x0898_0x0c00 [0x0c00 - 0x0898]; /* 0x0898 */
111
112 /* Fault Isolation Registers */
113 u64 checkstop_fir; /* 0x0c00 */
114 u64 recoverable_fir; /* 0x0c08 */
115 u64 spec_att_mchk_fir; /* 0x0c10 */
116 u32 fir_mode_reg; /* 0x0c18 */
117 u8 pad_0x0c1c_0x0c20 [4]; /* 0x0c1c */
118#define CBE_PMD_FIR_MODE_M8 0x00800
119 u64 fir_enable_mask; /* 0x0c20 */
120
121 u8 pad_0x0c28_0x0ca8 [0x0ca8 - 0x0c28]; /* 0x0c28 */
122 u64 ras_esc_0; /* 0x0ca8 */
123 u8 pad_0x0cb0_0x1000 [0x1000 - 0x0cb0]; /* 0x0cb0 */
124};
125
126extern struct cbe_pmd_regs __iomem *cbe_get_pmd_regs(struct device_node *np);
127extern struct cbe_pmd_regs __iomem *cbe_get_cpu_pmd_regs(int cpu);
128
129/*
130 * PMU shadow registers
131 *
132 * Many of the registers in the performance monitoring unit are write-only,
133 * so we need to save a copy of what we write to those registers.
134 *
135 * The actual data counters are read/write. However, writing to the counters
136 * only takes effect if the PMU is enabled. Otherwise the value is stored in
137 * a hardware latch until the next time the PMU is enabled. So we save a copy
138 * of the counter values if we need to read them back while the PMU is
139 * disabled. The counter_value_in_latch field is a bitmap indicating which
140 * counters currently have a value waiting to be written.
141 */
142
143struct cbe_pmd_shadow_regs {
144 u32 group_control;
145 u32 debug_bus_control;
146 u32 trace_address;
147 u32 ext_tr_timer;
148 u32 pm_status;
149 u32 pm_control;
150 u32 pm_interval;
151 u32 pm_start_stop;
152 u32 pm07_control[NR_CTRS];
153
154 u32 pm_ctr[NR_PHYS_CTRS];
155 u32 counter_value_in_latch;
156};
157
158extern struct cbe_pmd_shadow_regs *cbe_get_pmd_shadow_regs(struct device_node *np);
159extern struct cbe_pmd_shadow_regs *cbe_get_cpu_pmd_shadow_regs(int cpu);
160
161/*
162 *
163 * IIC unit register definitions
164 *
165 */
166
167struct cbe_iic_pending_bits {
168 u32 data;
169 u8 flags;
170 u8 class;
171 u8 source;
172 u8 prio;
173};
174
175#define CBE_IIC_IRQ_VALID 0x80
176#define CBE_IIC_IRQ_IPI 0x40
177
178struct cbe_iic_thread_regs {
179 struct cbe_iic_pending_bits pending;
180 struct cbe_iic_pending_bits pending_destr;
181 u64 generate;
182 u64 prio;
183};
184
185struct cbe_iic_regs {
186 u8 pad_0x0000_0x0400[0x0400 - 0x0000]; /* 0x0000 */
187
188 /* IIC interrupt registers */
189 struct cbe_iic_thread_regs thread[2]; /* 0x0400 */
190
191 u64 iic_ir; /* 0x0440 */
192#define CBE_IIC_IR_PRIO(x) (((x) & 0xf) << 12)
193#define CBE_IIC_IR_DEST_NODE(x) (((x) & 0xf) << 4)
194#define CBE_IIC_IR_DEST_UNIT(x) ((x) & 0xf)
195#define CBE_IIC_IR_IOC_0 0x0
196#define CBE_IIC_IR_IOC_1S 0xb
197#define CBE_IIC_IR_PT_0 0xe
198#define CBE_IIC_IR_PT_1 0xf
199
200 u64 iic_is; /* 0x0448 */
201#define CBE_IIC_IS_PMI 0x2
202
203 u8 pad_0x0450_0x0500[0x0500 - 0x0450]; /* 0x0450 */
204
205 /* IOC FIR */
206 u64 ioc_fir_reset; /* 0x0500 */
207 u64 ioc_fir_set; /* 0x0508 */
208 u64 ioc_checkstop_enable; /* 0x0510 */
209 u64 ioc_fir_error_mask; /* 0x0518 */
210 u64 ioc_syserr_enable; /* 0x0520 */
211 u64 ioc_fir; /* 0x0528 */
212
213 u8 pad_0x0530_0x1000[0x1000 - 0x0530]; /* 0x0530 */
214};
215
216extern struct cbe_iic_regs __iomem *cbe_get_iic_regs(struct device_node *np);
217extern struct cbe_iic_regs __iomem *cbe_get_cpu_iic_regs(int cpu);
218
219
220struct cbe_mic_tm_regs {
221 u8 pad_0x0000_0x0040[0x0040 - 0x0000]; /* 0x0000 */
222
223 u64 mic_ctl_cnfg2; /* 0x0040 */
224#define CBE_MIC_ENABLE_AUX_TRC 0x8000000000000000LL
225#define CBE_MIC_DISABLE_PWR_SAV_2 0x0200000000000000LL
226#define CBE_MIC_DISABLE_AUX_TRC_WRAP 0x0100000000000000LL
227#define CBE_MIC_ENABLE_AUX_TRC_INT 0x0080000000000000LL
228
229 u64 pad_0x0048; /* 0x0048 */
230
231 u64 mic_aux_trc_base; /* 0x0050 */
232 u64 mic_aux_trc_max_addr; /* 0x0058 */
233 u64 mic_aux_trc_cur_addr; /* 0x0060 */
234 u64 mic_aux_trc_grf_addr; /* 0x0068 */
235 u64 mic_aux_trc_grf_data; /* 0x0070 */
236
237 u64 pad_0x0078; /* 0x0078 */
238
239 u64 mic_ctl_cnfg_0; /* 0x0080 */
240#define CBE_MIC_DISABLE_PWR_SAV_0 0x8000000000000000LL
241
242 u64 pad_0x0088; /* 0x0088 */
243
244 u64 slow_fast_timer_0; /* 0x0090 */
245 u64 slow_next_timer_0; /* 0x0098 */
246
247 u8 pad_0x00a0_0x00f8[0x00f8 - 0x00a0]; /* 0x00a0 */
248 u64 mic_df_ecc_address_0; /* 0x00f8 */
249
250 u8 pad_0x0100_0x01b8[0x01b8 - 0x0100]; /* 0x0100 */
251 u64 mic_df_ecc_address_1; /* 0x01b8 */
252
253 u64 mic_ctl_cnfg_1; /* 0x01c0 */
254#define CBE_MIC_DISABLE_PWR_SAV_1 0x8000000000000000LL
255
256 u64 pad_0x01c8; /* 0x01c8 */
257
258 u64 slow_fast_timer_1; /* 0x01d0 */
259 u64 slow_next_timer_1; /* 0x01d8 */
260
261 u8 pad_0x01e0_0x0208[0x0208 - 0x01e0]; /* 0x01e0 */
262 u64 mic_exc; /* 0x0208 */
263#define CBE_MIC_EXC_BLOCK_SCRUB 0x0800000000000000ULL
264#define CBE_MIC_EXC_FAST_SCRUB 0x0100000000000000ULL
265
266 u64 mic_mnt_cfg; /* 0x0210 */
267#define CBE_MIC_MNT_CFG_CHAN_0_POP 0x0002000000000000ULL
268#define CBE_MIC_MNT_CFG_CHAN_1_POP 0x0004000000000000ULL
269
270 u64 mic_df_config; /* 0x0218 */
271#define CBE_MIC_ECC_DISABLE_0 0x4000000000000000ULL
272#define CBE_MIC_ECC_REP_SINGLE_0 0x2000000000000000ULL
273#define CBE_MIC_ECC_DISABLE_1 0x0080000000000000ULL
274#define CBE_MIC_ECC_REP_SINGLE_1 0x0040000000000000ULL
275
276 u8 pad_0x0220_0x0230[0x0230 - 0x0220]; /* 0x0220 */
277 u64 mic_fir; /* 0x0230 */
278#define CBE_MIC_FIR_ECC_SINGLE_0_ERR 0x0200000000000000ULL
279#define CBE_MIC_FIR_ECC_MULTI_0_ERR 0x0100000000000000ULL
280#define CBE_MIC_FIR_ECC_SINGLE_1_ERR 0x0080000000000000ULL
281#define CBE_MIC_FIR_ECC_MULTI_1_ERR 0x0040000000000000ULL
282#define CBE_MIC_FIR_ECC_ERR_MASK 0xffff000000000000ULL
283#define CBE_MIC_FIR_ECC_SINGLE_0_CTE 0x0000020000000000ULL
284#define CBE_MIC_FIR_ECC_MULTI_0_CTE 0x0000010000000000ULL
285#define CBE_MIC_FIR_ECC_SINGLE_1_CTE 0x0000008000000000ULL
286#define CBE_MIC_FIR_ECC_MULTI_1_CTE 0x0000004000000000ULL
287#define CBE_MIC_FIR_ECC_CTE_MASK 0x0000ffff00000000ULL
288#define CBE_MIC_FIR_ECC_SINGLE_0_RESET 0x0000000002000000ULL
289#define CBE_MIC_FIR_ECC_MULTI_0_RESET 0x0000000001000000ULL
290#define CBE_MIC_FIR_ECC_SINGLE_1_RESET 0x0000000000800000ULL
291#define CBE_MIC_FIR_ECC_MULTI_1_RESET 0x0000000000400000ULL
292#define CBE_MIC_FIR_ECC_RESET_MASK 0x00000000ffff0000ULL
293#define CBE_MIC_FIR_ECC_SINGLE_0_SET 0x0000000000000200ULL
294#define CBE_MIC_FIR_ECC_MULTI_0_SET 0x0000000000000100ULL
295#define CBE_MIC_FIR_ECC_SINGLE_1_SET 0x0000000000000080ULL
296#define CBE_MIC_FIR_ECC_MULTI_1_SET 0x0000000000000040ULL
297#define CBE_MIC_FIR_ECC_SET_MASK 0x000000000000ffffULL
298 u64 mic_fir_debug; /* 0x0238 */
299
300 u8 pad_0x0240_0x1000[0x1000 - 0x0240]; /* 0x0240 */
301};
302
303extern struct cbe_mic_tm_regs __iomem *cbe_get_mic_tm_regs(struct device_node *np);
304extern struct cbe_mic_tm_regs __iomem *cbe_get_cpu_mic_tm_regs(int cpu);
305
306/* some utility functions to deal with SMT */
307extern u32 cbe_get_hw_thread_id(int cpu);
308extern u32 cbe_cpu_to_node(int cpu);
309extern u32 cbe_node_to_cpu(int node);
310
311/* Init this module early */
312extern void cbe_regs_init(void);
313
314
315#endif /* CBE_REGS_H */
diff --git a/include/asm-powerpc/clk_interface.h b/include/asm-powerpc/clk_interface.h
new file mode 100644
index 000000000000..ab1882c1e176
--- /dev/null
+++ b/include/asm-powerpc/clk_interface.h
@@ -0,0 +1,20 @@
1#ifndef __ASM_POWERPC_CLK_INTERFACE_H
2#define __ASM_POWERPC_CLK_INTERFACE_H
3
4#include <linux/clk.h>
5
6struct clk_interface {
7 struct clk* (*clk_get) (struct device *dev, const char *id);
8 int (*clk_enable) (struct clk *clk);
9 void (*clk_disable) (struct clk *clk);
10 unsigned long (*clk_get_rate) (struct clk *clk);
11 void (*clk_put) (struct clk *clk);
12 long (*clk_round_rate) (struct clk *clk, unsigned long rate);
13 int (*clk_set_rate) (struct clk *clk, unsigned long rate);
14 int (*clk_set_parent) (struct clk *clk, struct clk *parent);
15 struct clk* (*clk_get_parent) (struct clk *clk);
16};
17
18extern struct clk_interface clk_functions;
19
20#endif /* __ASM_POWERPC_CLK_INTERFACE_H */
diff --git a/include/asm-powerpc/commproc.h b/include/asm-powerpc/commproc.h
new file mode 100644
index 000000000000..0307c84a5c1d
--- /dev/null
+++ b/include/asm-powerpc/commproc.h
@@ -0,0 +1,755 @@
1/*
2 * MPC8xx Communication Processor Module.
3 * Copyright (c) 1997 Dan Malek (dmalek@jlc.net)
4 *
5 * This file contains structures and information for the communication
6 * processor channels. Some CPM control and status is available
7 * throught the MPC8xx internal memory map. See immap.h for details.
8 * This file only contains what I need for the moment, not the total
9 * CPM capabilities. I (or someone else) will add definitions as they
10 * are needed. -- Dan
11 *
12 * On the MBX board, EPPC-Bug loads CPM microcode into the first 512
13 * bytes of the DP RAM and relocates the I2C parameter area to the
14 * IDMA1 space. The remaining DP RAM is available for buffer descriptors
15 * or other use.
16 */
17#ifndef __CPM_8XX__
18#define __CPM_8XX__
19
20#include <asm/8xx_immap.h>
21#include <asm/ptrace.h>
22#include <asm/cpm.h>
23
24/* CPM Command register.
25*/
26#define CPM_CR_RST ((ushort)0x8000)
27#define CPM_CR_OPCODE ((ushort)0x0f00)
28#define CPM_CR_CHAN ((ushort)0x00f0)
29#define CPM_CR_FLG ((ushort)0x0001)
30
31/* Some commands (there are more...later)
32*/
33#define CPM_CR_INIT_TRX ((ushort)0x0000)
34#define CPM_CR_INIT_RX ((ushort)0x0001)
35#define CPM_CR_INIT_TX ((ushort)0x0002)
36#define CPM_CR_HUNT_MODE ((ushort)0x0003)
37#define CPM_CR_STOP_TX ((ushort)0x0004)
38#define CPM_CR_GRA_STOP_TX ((ushort)0x0005)
39#define CPM_CR_RESTART_TX ((ushort)0x0006)
40#define CPM_CR_CLOSE_RX_BD ((ushort)0x0007)
41#define CPM_CR_SET_GADDR ((ushort)0x0008)
42#define CPM_CR_SET_TIMER CPM_CR_SET_GADDR
43
44/* Channel numbers.
45*/
46#define CPM_CR_CH_SCC1 ((ushort)0x0000)
47#define CPM_CR_CH_I2C ((ushort)0x0001) /* I2C and IDMA1 */
48#define CPM_CR_CH_SCC2 ((ushort)0x0004)
49#define CPM_CR_CH_SPI ((ushort)0x0005) /* SPI / IDMA2 / Timers */
50#define CPM_CR_CH_TIMER CPM_CR_CH_SPI
51#define CPM_CR_CH_SCC3 ((ushort)0x0008)
52#define CPM_CR_CH_SMC1 ((ushort)0x0009) /* SMC1 / DSP1 */
53#define CPM_CR_CH_SCC4 ((ushort)0x000c)
54#define CPM_CR_CH_SMC2 ((ushort)0x000d) /* SMC2 / DSP2 */
55
56#define mk_cr_cmd(CH, CMD) ((CMD << 8) | (CH << 4))
57
58#ifndef CONFIG_PPC_CPM_NEW_BINDING
59/* The dual ported RAM is multi-functional. Some areas can be (and are
60 * being) used for microcode. There is an area that can only be used
61 * as data ram for buffer descriptors, which is all we use right now.
62 * Currently the first 512 and last 256 bytes are used for microcode.
63 */
64#define CPM_DATAONLY_BASE ((uint)0x0800)
65#define CPM_DATAONLY_SIZE ((uint)0x0700)
66#define CPM_DP_NOSPACE ((uint)0x7fffffff)
67#endif
68
69/* Export the base address of the communication processor registers
70 * and dual port ram.
71 */
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
80extern unsigned long cpm_dpalloc(uint size, uint align);
81extern int cpm_dpfree(unsigned long offset);
82extern unsigned long cpm_dpalloc_fixed(unsigned long offset, uint size, uint align);
83extern void cpm_dpdump(void);
84extern void *cpm_dpram_addr(unsigned long offset);
85extern uint cpm_dpram_phys(u8* addr);
86#endif
87
88extern void cpm_setbrg(uint brg, uint rate);
89
90extern uint m8xx_cpm_hostalloc(uint size);
91extern int m8xx_cpm_hostfree(uint start);
92extern void m8xx_cpm_hostdump(void);
93
94extern void cpm_load_patch(volatile immap_t *immr);
95
96/* Buffer descriptors used by many of the CPM protocols.
97*/
98typedef struct cpm_buf_desc {
99 ushort cbd_sc; /* Status and Control */
100 ushort cbd_datlen; /* Data length in buffer */
101 uint cbd_bufaddr; /* Buffer address in host memory */
102} cbd_t;
103
104#define BD_SC_EMPTY ((ushort)0x8000) /* Receive is empty */
105#define BD_SC_READY ((ushort)0x8000) /* Transmit is ready */
106#define BD_SC_WRAP ((ushort)0x2000) /* Last buffer descriptor */
107#define BD_SC_INTRPT ((ushort)0x1000) /* Interrupt on change */
108#define BD_SC_LAST ((ushort)0x0800) /* Last buffer in frame */
109#define BD_SC_TC ((ushort)0x0400) /* Transmit CRC */
110#define BD_SC_CM ((ushort)0x0200) /* Continous mode */
111#define BD_SC_ID ((ushort)0x0100) /* Rec'd too many idles */
112#define BD_SC_P ((ushort)0x0100) /* xmt preamble */
113#define BD_SC_BR ((ushort)0x0020) /* Break received */
114#define BD_SC_FR ((ushort)0x0010) /* Framing error */
115#define BD_SC_PR ((ushort)0x0008) /* Parity error */
116#define BD_SC_NAK ((ushort)0x0004) /* NAK - did not respond */
117#define BD_SC_OV ((ushort)0x0002) /* Overrun */
118#define BD_SC_UN ((ushort)0x0002) /* Underrun */
119#define BD_SC_CD ((ushort)0x0001) /* ?? */
120#define BD_SC_CL ((ushort)0x0001) /* Collision */
121
122/* Parameter RAM offsets.
123*/
124#define PROFF_SCC1 ((uint)0x0000)
125#define PROFF_IIC ((uint)0x0080)
126#define PROFF_SCC2 ((uint)0x0100)
127#define PROFF_SPI ((uint)0x0180)
128#define PROFF_SCC3 ((uint)0x0200)
129#define PROFF_SMC1 ((uint)0x0280)
130#define PROFF_SCC4 ((uint)0x0300)
131#define PROFF_SMC2 ((uint)0x0380)
132
133/* Define enough so I can at least use the serial port as a UART.
134 * The MBX uses SMC1 as the host serial port.
135 */
136typedef struct smc_uart {
137 ushort smc_rbase; /* Rx Buffer descriptor base address */
138 ushort smc_tbase; /* Tx Buffer descriptor base address */
139 u_char smc_rfcr; /* Rx function code */
140 u_char smc_tfcr; /* Tx function code */
141 ushort smc_mrblr; /* Max receive buffer length */
142 uint smc_rstate; /* Internal */
143 uint smc_idp; /* Internal */
144 ushort smc_rbptr; /* Internal */
145 ushort smc_ibc; /* Internal */
146 uint smc_rxtmp; /* Internal */
147 uint smc_tstate; /* Internal */
148 uint smc_tdp; /* Internal */
149 ushort smc_tbptr; /* Internal */
150 ushort smc_tbc; /* Internal */
151 uint smc_txtmp; /* Internal */
152 ushort smc_maxidl; /* Maximum idle characters */
153 ushort smc_tmpidl; /* Temporary idle counter */
154 ushort smc_brklen; /* Last received break length */
155 ushort smc_brkec; /* rcv'd break condition counter */
156 ushort smc_brkcr; /* xmt break count register */
157 ushort smc_rmask; /* Temporary bit mask */
158 char res1[8]; /* Reserved */
159 ushort smc_rpbase; /* Relocation pointer */
160} smc_uart_t;
161
162/* Function code bits.
163*/
164#define SMC_EB ((u_char)0x10) /* Set big endian byte order */
165
166/* SMC uart mode register.
167*/
168#define SMCMR_REN ((ushort)0x0001)
169#define SMCMR_TEN ((ushort)0x0002)
170#define SMCMR_DM ((ushort)0x000c)
171#define SMCMR_SM_GCI ((ushort)0x0000)
172#define SMCMR_SM_UART ((ushort)0x0020)
173#define SMCMR_SM_TRANS ((ushort)0x0030)
174#define SMCMR_SM_MASK ((ushort)0x0030)
175#define SMCMR_PM_EVEN ((ushort)0x0100) /* Even parity, else odd */
176#define SMCMR_REVD SMCMR_PM_EVEN
177#define SMCMR_PEN ((ushort)0x0200) /* Parity enable */
178#define SMCMR_BS SMCMR_PEN
179#define SMCMR_SL ((ushort)0x0400) /* Two stops, else one */
180#define SMCR_CLEN_MASK ((ushort)0x7800) /* Character length */
181#define smcr_mk_clen(C) (((C) << 11) & SMCR_CLEN_MASK)
182
183/* SMC2 as Centronics parallel printer. It is half duplex, in that
184 * it can only receive or transmit. The parameter ram values for
185 * each direction are either unique or properly overlap, so we can
186 * include them in one structure.
187 */
188typedef struct smc_centronics {
189 ushort scent_rbase;
190 ushort scent_tbase;
191 u_char scent_cfcr;
192 u_char scent_smask;
193 ushort scent_mrblr;
194 uint scent_rstate;
195 uint scent_r_ptr;
196 ushort scent_rbptr;
197 ushort scent_r_cnt;
198 uint scent_rtemp;
199 uint scent_tstate;
200 uint scent_t_ptr;
201 ushort scent_tbptr;
202 ushort scent_t_cnt;
203 uint scent_ttemp;
204 ushort scent_max_sl;
205 ushort scent_sl_cnt;
206 ushort scent_character1;
207 ushort scent_character2;
208 ushort scent_character3;
209 ushort scent_character4;
210 ushort scent_character5;
211 ushort scent_character6;
212 ushort scent_character7;
213 ushort scent_character8;
214 ushort scent_rccm;
215 ushort scent_rccr;
216} smc_cent_t;
217
218/* Centronics Status Mask Register.
219*/
220#define SMC_CENT_F ((u_char)0x08)
221#define SMC_CENT_PE ((u_char)0x04)
222#define SMC_CENT_S ((u_char)0x02)
223
224/* SMC Event and Mask register.
225*/
226#define SMCM_BRKE ((unsigned char)0x40) /* When in UART Mode */
227#define SMCM_BRK ((unsigned char)0x10) /* When in UART Mode */
228#define SMCM_TXE ((unsigned char)0x10) /* When in Transparent Mode */
229#define SMCM_BSY ((unsigned char)0x04)
230#define SMCM_TX ((unsigned char)0x02)
231#define SMCM_RX ((unsigned char)0x01)
232
233/* Baud rate generators.
234*/
235#define CPM_BRG_RST ((uint)0x00020000)
236#define CPM_BRG_EN ((uint)0x00010000)
237#define CPM_BRG_EXTC_INT ((uint)0x00000000)
238#define CPM_BRG_EXTC_CLK2 ((uint)0x00004000)
239#define CPM_BRG_EXTC_CLK6 ((uint)0x00008000)
240#define CPM_BRG_ATB ((uint)0x00002000)
241#define CPM_BRG_CD_MASK ((uint)0x00001ffe)
242#define CPM_BRG_DIV16 ((uint)0x00000001)
243
244/* SI Clock Route Register
245*/
246#define SICR_RCLK_SCC1_BRG1 ((uint)0x00000000)
247#define SICR_TCLK_SCC1_BRG1 ((uint)0x00000000)
248#define SICR_RCLK_SCC2_BRG2 ((uint)0x00000800)
249#define SICR_TCLK_SCC2_BRG2 ((uint)0x00000100)
250#define SICR_RCLK_SCC3_BRG3 ((uint)0x00100000)
251#define SICR_TCLK_SCC3_BRG3 ((uint)0x00020000)
252#define SICR_RCLK_SCC4_BRG4 ((uint)0x18000000)
253#define SICR_TCLK_SCC4_BRG4 ((uint)0x03000000)
254
255/* SCCs.
256*/
257#define SCC_GSMRH_IRP ((uint)0x00040000)
258#define SCC_GSMRH_GDE ((uint)0x00010000)
259#define SCC_GSMRH_TCRC_CCITT ((uint)0x00008000)
260#define SCC_GSMRH_TCRC_BISYNC ((uint)0x00004000)
261#define SCC_GSMRH_TCRC_HDLC ((uint)0x00000000)
262#define SCC_GSMRH_REVD ((uint)0x00002000)
263#define SCC_GSMRH_TRX ((uint)0x00001000)
264#define SCC_GSMRH_TTX ((uint)0x00000800)
265#define SCC_GSMRH_CDP ((uint)0x00000400)
266#define SCC_GSMRH_CTSP ((uint)0x00000200)
267#define SCC_GSMRH_CDS ((uint)0x00000100)
268#define SCC_GSMRH_CTSS ((uint)0x00000080)
269#define SCC_GSMRH_TFL ((uint)0x00000040)
270#define SCC_GSMRH_RFW ((uint)0x00000020)
271#define SCC_GSMRH_TXSY ((uint)0x00000010)
272#define SCC_GSMRH_SYNL16 ((uint)0x0000000c)
273#define SCC_GSMRH_SYNL8 ((uint)0x00000008)
274#define SCC_GSMRH_SYNL4 ((uint)0x00000004)
275#define SCC_GSMRH_RTSM ((uint)0x00000002)
276#define SCC_GSMRH_RSYN ((uint)0x00000001)
277
278#define SCC_GSMRL_SIR ((uint)0x80000000) /* SCC2 only */
279#define SCC_GSMRL_EDGE_NONE ((uint)0x60000000)
280#define SCC_GSMRL_EDGE_NEG ((uint)0x40000000)
281#define SCC_GSMRL_EDGE_POS ((uint)0x20000000)
282#define SCC_GSMRL_EDGE_BOTH ((uint)0x00000000)
283#define SCC_GSMRL_TCI ((uint)0x10000000)
284#define SCC_GSMRL_TSNC_3 ((uint)0x0c000000)
285#define SCC_GSMRL_TSNC_4 ((uint)0x08000000)
286#define SCC_GSMRL_TSNC_14 ((uint)0x04000000)
287#define SCC_GSMRL_TSNC_INF ((uint)0x00000000)
288#define SCC_GSMRL_RINV ((uint)0x02000000)
289#define SCC_GSMRL_TINV ((uint)0x01000000)
290#define SCC_GSMRL_TPL_128 ((uint)0x00c00000)
291#define SCC_GSMRL_TPL_64 ((uint)0x00a00000)
292#define SCC_GSMRL_TPL_48 ((uint)0x00800000)
293#define SCC_GSMRL_TPL_32 ((uint)0x00600000)
294#define SCC_GSMRL_TPL_16 ((uint)0x00400000)
295#define SCC_GSMRL_TPL_8 ((uint)0x00200000)
296#define SCC_GSMRL_TPL_NONE ((uint)0x00000000)
297#define SCC_GSMRL_TPP_ALL1 ((uint)0x00180000)
298#define SCC_GSMRL_TPP_01 ((uint)0x00100000)
299#define SCC_GSMRL_TPP_10 ((uint)0x00080000)
300#define SCC_GSMRL_TPP_ZEROS ((uint)0x00000000)
301#define SCC_GSMRL_TEND ((uint)0x00040000)
302#define SCC_GSMRL_TDCR_32 ((uint)0x00030000)
303#define SCC_GSMRL_TDCR_16 ((uint)0x00020000)
304#define SCC_GSMRL_TDCR_8 ((uint)0x00010000)
305#define SCC_GSMRL_TDCR_1 ((uint)0x00000000)
306#define SCC_GSMRL_RDCR_32 ((uint)0x0000c000)
307#define SCC_GSMRL_RDCR_16 ((uint)0x00008000)
308#define SCC_GSMRL_RDCR_8 ((uint)0x00004000)
309#define SCC_GSMRL_RDCR_1 ((uint)0x00000000)
310#define SCC_GSMRL_RENC_DFMAN ((uint)0x00003000)
311#define SCC_GSMRL_RENC_MANCH ((uint)0x00002000)
312#define SCC_GSMRL_RENC_FM0 ((uint)0x00001000)
313#define SCC_GSMRL_RENC_NRZI ((uint)0x00000800)
314#define SCC_GSMRL_RENC_NRZ ((uint)0x00000000)
315#define SCC_GSMRL_TENC_DFMAN ((uint)0x00000600)
316#define SCC_GSMRL_TENC_MANCH ((uint)0x00000400)
317#define SCC_GSMRL_TENC_FM0 ((uint)0x00000200)
318#define SCC_GSMRL_TENC_NRZI ((uint)0x00000100)
319#define SCC_GSMRL_TENC_NRZ ((uint)0x00000000)
320#define SCC_GSMRL_DIAG_LE ((uint)0x000000c0) /* Loop and echo */
321#define SCC_GSMRL_DIAG_ECHO ((uint)0x00000080)
322#define SCC_GSMRL_DIAG_LOOP ((uint)0x00000040)
323#define SCC_GSMRL_DIAG_NORM ((uint)0x00000000)
324#define SCC_GSMRL_ENR ((uint)0x00000020)
325#define SCC_GSMRL_ENT ((uint)0x00000010)
326#define SCC_GSMRL_MODE_ENET ((uint)0x0000000c)
327#define SCC_GSMRL_MODE_QMC ((uint)0x0000000a)
328#define SCC_GSMRL_MODE_DDCMP ((uint)0x00000009)
329#define SCC_GSMRL_MODE_BISYNC ((uint)0x00000008)
330#define SCC_GSMRL_MODE_V14 ((uint)0x00000007)
331#define SCC_GSMRL_MODE_AHDLC ((uint)0x00000006)
332#define SCC_GSMRL_MODE_PROFIBUS ((uint)0x00000005)
333#define SCC_GSMRL_MODE_UART ((uint)0x00000004)
334#define SCC_GSMRL_MODE_SS7 ((uint)0x00000003)
335#define SCC_GSMRL_MODE_ATALK ((uint)0x00000002)
336#define SCC_GSMRL_MODE_HDLC ((uint)0x00000000)
337
338#define SCC_TODR_TOD ((ushort)0x8000)
339
340/* SCC Event and Mask register.
341*/
342#define SCCM_TXE ((unsigned char)0x10)
343#define SCCM_BSY ((unsigned char)0x04)
344#define SCCM_TX ((unsigned char)0x02)
345#define SCCM_RX ((unsigned char)0x01)
346
347typedef struct scc_param {
348 ushort scc_rbase; /* Rx Buffer descriptor base address */
349 ushort scc_tbase; /* Tx Buffer descriptor base address */
350 u_char scc_rfcr; /* Rx function code */
351 u_char scc_tfcr; /* Tx function code */
352 ushort scc_mrblr; /* Max receive buffer length */
353 uint scc_rstate; /* Internal */
354 uint scc_idp; /* Internal */
355 ushort scc_rbptr; /* Internal */
356 ushort scc_ibc; /* Internal */
357 uint scc_rxtmp; /* Internal */
358 uint scc_tstate; /* Internal */
359 uint scc_tdp; /* Internal */
360 ushort scc_tbptr; /* Internal */
361 ushort scc_tbc; /* Internal */
362 uint scc_txtmp; /* Internal */
363 uint scc_rcrc; /* Internal */
364 uint scc_tcrc; /* Internal */
365} sccp_t;
366
367/* Function code bits.
368*/
369#define SCC_EB ((u_char)0x10) /* Set big endian byte order */
370
371/* CPM Ethernet through SCCx.
372 */
373typedef struct scc_enet {
374 sccp_t sen_genscc;
375 uint sen_cpres; /* Preset CRC */
376 uint sen_cmask; /* Constant mask for CRC */
377 uint sen_crcec; /* CRC Error counter */
378 uint sen_alec; /* alignment error counter */
379 uint sen_disfc; /* discard frame counter */
380 ushort sen_pads; /* Tx short frame pad character */
381 ushort sen_retlim; /* Retry limit threshold */
382 ushort sen_retcnt; /* Retry limit counter */
383 ushort sen_maxflr; /* maximum frame length register */
384 ushort sen_minflr; /* minimum frame length register */
385 ushort sen_maxd1; /* maximum DMA1 length */
386 ushort sen_maxd2; /* maximum DMA2 length */
387 ushort sen_maxd; /* Rx max DMA */
388 ushort sen_dmacnt; /* Rx DMA counter */
389 ushort sen_maxb; /* Max BD byte count */
390 ushort sen_gaddr1; /* Group address filter */
391 ushort sen_gaddr2;
392 ushort sen_gaddr3;
393 ushort sen_gaddr4;
394 uint sen_tbuf0data0; /* Save area 0 - current frame */
395 uint sen_tbuf0data1; /* Save area 1 - current frame */
396 uint sen_tbuf0rba; /* Internal */
397 uint sen_tbuf0crc; /* Internal */
398 ushort sen_tbuf0bcnt; /* Internal */
399 ushort sen_paddrh; /* physical address (MSB) */
400 ushort sen_paddrm;
401 ushort sen_paddrl; /* physical address (LSB) */
402 ushort sen_pper; /* persistence */
403 ushort sen_rfbdptr; /* Rx first BD pointer */
404 ushort sen_tfbdptr; /* Tx first BD pointer */
405 ushort sen_tlbdptr; /* Tx last BD pointer */
406 uint sen_tbuf1data0; /* Save area 0 - current frame */
407 uint sen_tbuf1data1; /* Save area 1 - current frame */
408 uint sen_tbuf1rba; /* Internal */
409 uint sen_tbuf1crc; /* Internal */
410 ushort sen_tbuf1bcnt; /* Internal */
411 ushort sen_txlen; /* Tx Frame length counter */
412 ushort sen_iaddr1; /* Individual address filter */
413 ushort sen_iaddr2;
414 ushort sen_iaddr3;
415 ushort sen_iaddr4;
416 ushort sen_boffcnt; /* Backoff counter */
417
418 /* NOTE: Some versions of the manual have the following items
419 * incorrectly documented. Below is the proper order.
420 */
421 ushort sen_taddrh; /* temp address (MSB) */
422 ushort sen_taddrm;
423 ushort sen_taddrl; /* temp address (LSB) */
424} scc_enet_t;
425
426/* SCC Event register as used by Ethernet.
427*/
428#define SCCE_ENET_GRA ((ushort)0x0080) /* Graceful stop complete */
429#define SCCE_ENET_TXE ((ushort)0x0010) /* Transmit Error */
430#define SCCE_ENET_RXF ((ushort)0x0008) /* Full frame received */
431#define SCCE_ENET_BSY ((ushort)0x0004) /* All incoming buffers full */
432#define SCCE_ENET_TXB ((ushort)0x0002) /* A buffer was transmitted */
433#define SCCE_ENET_RXB ((ushort)0x0001) /* A buffer was received */
434
435/* SCC Mode Register (PMSR) as used by Ethernet.
436*/
437#define SCC_PSMR_HBC ((ushort)0x8000) /* Enable heartbeat */
438#define SCC_PSMR_FC ((ushort)0x4000) /* Force collision */
439#define SCC_PSMR_RSH ((ushort)0x2000) /* Receive short frames */
440#define SCC_PSMR_IAM ((ushort)0x1000) /* Check individual hash */
441#define SCC_PSMR_ENCRC ((ushort)0x0800) /* Ethernet CRC mode */
442#define SCC_PSMR_PRO ((ushort)0x0200) /* Promiscuous mode */
443#define SCC_PSMR_BRO ((ushort)0x0100) /* Catch broadcast pkts */
444#define SCC_PSMR_SBT ((ushort)0x0080) /* Special backoff timer */
445#define SCC_PSMR_LPB ((ushort)0x0040) /* Set Loopback mode */
446#define SCC_PSMR_SIP ((ushort)0x0020) /* Sample Input Pins */
447#define SCC_PSMR_LCW ((ushort)0x0010) /* Late collision window */
448#define SCC_PSMR_NIB22 ((ushort)0x000a) /* Start frame search */
449#define SCC_PSMR_FDE ((ushort)0x0001) /* Full duplex enable */
450
451/* Buffer descriptor control/status used by Ethernet receive.
452*/
453#define BD_ENET_RX_EMPTY ((ushort)0x8000)
454#define BD_ENET_RX_WRAP ((ushort)0x2000)
455#define BD_ENET_RX_INTR ((ushort)0x1000)
456#define BD_ENET_RX_LAST ((ushort)0x0800)
457#define BD_ENET_RX_FIRST ((ushort)0x0400)
458#define BD_ENET_RX_MISS ((ushort)0x0100)
459#define BD_ENET_RX_LG ((ushort)0x0020)
460#define BD_ENET_RX_NO ((ushort)0x0010)
461#define BD_ENET_RX_SH ((ushort)0x0008)
462#define BD_ENET_RX_CR ((ushort)0x0004)
463#define BD_ENET_RX_OV ((ushort)0x0002)
464#define BD_ENET_RX_CL ((ushort)0x0001)
465#define BD_ENET_RX_BC ((ushort)0x0080) /* DA is Broadcast */
466#define BD_ENET_RX_MC ((ushort)0x0040) /* DA is Multicast */
467#define BD_ENET_RX_STATS ((ushort)0x013f) /* All status bits */
468
469/* Buffer descriptor control/status used by Ethernet transmit.
470*/
471#define BD_ENET_TX_READY ((ushort)0x8000)
472#define BD_ENET_TX_PAD ((ushort)0x4000)
473#define BD_ENET_TX_WRAP ((ushort)0x2000)
474#define BD_ENET_TX_INTR ((ushort)0x1000)
475#define BD_ENET_TX_LAST ((ushort)0x0800)
476#define BD_ENET_TX_TC ((ushort)0x0400)
477#define BD_ENET_TX_DEF ((ushort)0x0200)
478#define BD_ENET_TX_HB ((ushort)0x0100)
479#define BD_ENET_TX_LC ((ushort)0x0080)
480#define BD_ENET_TX_RL ((ushort)0x0040)
481#define BD_ENET_TX_RCMASK ((ushort)0x003c)
482#define BD_ENET_TX_UN ((ushort)0x0002)
483#define BD_ENET_TX_CSL ((ushort)0x0001)
484#define BD_ENET_TX_STATS ((ushort)0x03ff) /* All status bits */
485
486/* SCC as UART
487*/
488typedef struct scc_uart {
489 sccp_t scc_genscc;
490 char res1[8]; /* Reserved */
491 ushort scc_maxidl; /* Maximum idle chars */
492 ushort scc_idlc; /* temp idle counter */
493 ushort scc_brkcr; /* Break count register */
494 ushort scc_parec; /* receive parity error counter */
495 ushort scc_frmec; /* receive framing error counter */
496 ushort scc_nosec; /* receive noise counter */
497 ushort scc_brkec; /* receive break condition counter */
498 ushort scc_brkln; /* last received break length */
499 ushort scc_uaddr1; /* UART address character 1 */
500 ushort scc_uaddr2; /* UART address character 2 */
501 ushort scc_rtemp; /* Temp storage */
502 ushort scc_toseq; /* Transmit out of sequence char */
503 ushort scc_char1; /* control character 1 */
504 ushort scc_char2; /* control character 2 */
505 ushort scc_char3; /* control character 3 */
506 ushort scc_char4; /* control character 4 */
507 ushort scc_char5; /* control character 5 */
508 ushort scc_char6; /* control character 6 */
509 ushort scc_char7; /* control character 7 */
510 ushort scc_char8; /* control character 8 */
511 ushort scc_rccm; /* receive control character mask */
512 ushort scc_rccr; /* receive control character register */
513 ushort scc_rlbc; /* receive last break character */
514} scc_uart_t;
515
516/* SCC Event and Mask registers when it is used as a UART.
517*/
518#define UART_SCCM_GLR ((ushort)0x1000)
519#define UART_SCCM_GLT ((ushort)0x0800)
520#define UART_SCCM_AB ((ushort)0x0200)
521#define UART_SCCM_IDL ((ushort)0x0100)
522#define UART_SCCM_GRA ((ushort)0x0080)
523#define UART_SCCM_BRKE ((ushort)0x0040)
524#define UART_SCCM_BRKS ((ushort)0x0020)
525#define UART_SCCM_CCR ((ushort)0x0008)
526#define UART_SCCM_BSY ((ushort)0x0004)
527#define UART_SCCM_TX ((ushort)0x0002)
528#define UART_SCCM_RX ((ushort)0x0001)
529
530/* The SCC PMSR when used as a UART.
531*/
532#define SCU_PSMR_FLC ((ushort)0x8000)
533#define SCU_PSMR_SL ((ushort)0x4000)
534#define SCU_PSMR_CL ((ushort)0x3000)
535#define SCU_PSMR_UM ((ushort)0x0c00)
536#define SCU_PSMR_FRZ ((ushort)0x0200)
537#define SCU_PSMR_RZS ((ushort)0x0100)
538#define SCU_PSMR_SYN ((ushort)0x0080)
539#define SCU_PSMR_DRT ((ushort)0x0040)
540#define SCU_PSMR_PEN ((ushort)0x0010)
541#define SCU_PSMR_RPM ((ushort)0x000c)
542#define SCU_PSMR_REVP ((ushort)0x0008)
543#define SCU_PSMR_TPM ((ushort)0x0003)
544#define SCU_PSMR_TEVP ((ushort)0x0002)
545
546/* CPM Transparent mode SCC.
547 */
548typedef struct scc_trans {
549 sccp_t st_genscc;
550 uint st_cpres; /* Preset CRC */
551 uint st_cmask; /* Constant mask for CRC */
552} scc_trans_t;
553
554#define BD_SCC_TX_LAST ((ushort)0x0800)
555
556/* IIC parameter RAM.
557*/
558typedef struct iic {
559 ushort iic_rbase; /* Rx Buffer descriptor base address */
560 ushort iic_tbase; /* Tx Buffer descriptor base address */
561 u_char iic_rfcr; /* Rx function code */
562 u_char iic_tfcr; /* Tx function code */
563 ushort iic_mrblr; /* Max receive buffer length */
564 uint iic_rstate; /* Internal */
565 uint iic_rdp; /* Internal */
566 ushort iic_rbptr; /* Internal */
567 ushort iic_rbc; /* Internal */
568 uint iic_rxtmp; /* Internal */
569 uint iic_tstate; /* Internal */
570 uint iic_tdp; /* Internal */
571 ushort iic_tbptr; /* Internal */
572 ushort iic_tbc; /* Internal */
573 uint iic_txtmp; /* Internal */
574 char res1[4]; /* Reserved */
575 ushort iic_rpbase; /* Relocation pointer */
576 char res2[2]; /* Reserved */
577} iic_t;
578
579#define BD_IIC_START ((ushort)0x0400)
580
581/* SPI parameter RAM.
582*/
583typedef struct spi {
584 ushort spi_rbase; /* Rx Buffer descriptor base address */
585 ushort spi_tbase; /* Tx Buffer descriptor base address */
586 u_char spi_rfcr; /* Rx function code */
587 u_char spi_tfcr; /* Tx function code */
588 ushort spi_mrblr; /* Max receive buffer length */
589 uint spi_rstate; /* Internal */
590 uint spi_rdp; /* Internal */
591 ushort spi_rbptr; /* Internal */
592 ushort spi_rbc; /* Internal */
593 uint spi_rxtmp; /* Internal */
594 uint spi_tstate; /* Internal */
595 uint spi_tdp; /* Internal */
596 ushort spi_tbptr; /* Internal */
597 ushort spi_tbc; /* Internal */
598 uint spi_txtmp; /* Internal */
599 uint spi_res;
600 ushort spi_rpbase; /* Relocation pointer */
601 ushort spi_res2;
602} spi_t;
603
604/* SPI Mode register.
605*/
606#define SPMODE_LOOP ((ushort)0x4000) /* Loopback */
607#define SPMODE_CI ((ushort)0x2000) /* Clock Invert */
608#define SPMODE_CP ((ushort)0x1000) /* Clock Phase */
609#define SPMODE_DIV16 ((ushort)0x0800) /* BRG/16 mode */
610#define SPMODE_REV ((ushort)0x0400) /* Reversed Data */
611#define SPMODE_MSTR ((ushort)0x0200) /* SPI Master */
612#define SPMODE_EN ((ushort)0x0100) /* Enable */
613#define SPMODE_LENMSK ((ushort)0x00f0) /* character length */
614#define SPMODE_LEN4 ((ushort)0x0030) /* 4 bits per char */
615#define SPMODE_LEN8 ((ushort)0x0070) /* 8 bits per char */
616#define SPMODE_LEN16 ((ushort)0x00f0) /* 16 bits per char */
617#define SPMODE_PMMSK ((ushort)0x000f) /* prescale modulus */
618
619/* SPIE fields */
620#define SPIE_MME 0x20
621#define SPIE_TXE 0x10
622#define SPIE_BSY 0x04
623#define SPIE_TXB 0x02
624#define SPIE_RXB 0x01
625
626/*
627 * RISC Controller Configuration Register definitons
628 */
629#define RCCR_TIME 0x8000 /* RISC Timer Enable */
630#define RCCR_TIMEP(t) (((t) & 0x3F)<<8) /* RISC Timer Period */
631#define RCCR_TIME_MASK 0x00FF /* not RISC Timer related bits */
632
633/* RISC Timer Parameter RAM offset */
634#define PROFF_RTMR ((uint)0x01B0)
635
636typedef struct risc_timer_pram {
637 unsigned short tm_base; /* RISC Timer Table Base Address */
638 unsigned short tm_ptr; /* RISC Timer Table Pointer (internal) */
639 unsigned short r_tmr; /* RISC Timer Mode Register */
640 unsigned short r_tmv; /* RISC Timer Valid Register */
641 unsigned long tm_cmd; /* RISC Timer Command Register */
642 unsigned long tm_cnt; /* RISC Timer Internal Count */
643} rt_pram_t;
644
645/* Bits in RISC Timer Command Register */
646#define TM_CMD_VALID 0x80000000 /* Valid - Enables the timer */
647#define TM_CMD_RESTART 0x40000000 /* Restart - for automatic restart */
648#define TM_CMD_PWM 0x20000000 /* Run in Pulse Width Modulation Mode */
649#define TM_CMD_NUM(n) (((n)&0xF)<<16) /* Timer Number */
650#define TM_CMD_PERIOD(p) ((p)&0xFFFF) /* Timer Period */
651
652/* CPM interrupts. There are nearly 32 interrupts generated by CPM
653 * channels or devices. All of these are presented to the PPC core
654 * as a single interrupt. The CPM interrupt handler dispatches its
655 * own handlers, in a similar fashion to the PPC core handler. We
656 * use the table as defined in the manuals (i.e. no special high
657 * priority and SCC1 == SCCa, etc...).
658 */
659#define CPMVEC_NR 32
660#define CPMVEC_PIO_PC15 ((ushort)0x1f)
661#define CPMVEC_SCC1 ((ushort)0x1e)
662#define CPMVEC_SCC2 ((ushort)0x1d)
663#define CPMVEC_SCC3 ((ushort)0x1c)
664#define CPMVEC_SCC4 ((ushort)0x1b)
665#define CPMVEC_PIO_PC14 ((ushort)0x1a)
666#define CPMVEC_TIMER1 ((ushort)0x19)
667#define CPMVEC_PIO_PC13 ((ushort)0x18)
668#define CPMVEC_PIO_PC12 ((ushort)0x17)
669#define CPMVEC_SDMA_CB_ERR ((ushort)0x16)
670#define CPMVEC_IDMA1 ((ushort)0x15)
671#define CPMVEC_IDMA2 ((ushort)0x14)
672#define CPMVEC_TIMER2 ((ushort)0x12)
673#define CPMVEC_RISCTIMER ((ushort)0x11)
674#define CPMVEC_I2C ((ushort)0x10)
675#define CPMVEC_PIO_PC11 ((ushort)0x0f)
676#define CPMVEC_PIO_PC10 ((ushort)0x0e)
677#define CPMVEC_TIMER3 ((ushort)0x0c)
678#define CPMVEC_PIO_PC9 ((ushort)0x0b)
679#define CPMVEC_PIO_PC8 ((ushort)0x0a)
680#define CPMVEC_PIO_PC7 ((ushort)0x09)
681#define CPMVEC_TIMER4 ((ushort)0x07)
682#define CPMVEC_PIO_PC6 ((ushort)0x06)
683#define CPMVEC_SPI ((ushort)0x05)
684#define CPMVEC_SMC1 ((ushort)0x04)
685#define CPMVEC_SMC2 ((ushort)0x03)
686#define CPMVEC_PIO_PC5 ((ushort)0x02)
687#define CPMVEC_PIO_PC4 ((ushort)0x01)
688#define CPMVEC_ERROR ((ushort)0x00)
689
690/* CPM interrupt configuration vector.
691*/
692#define CICR_SCD_SCC4 ((uint)0x00c00000) /* SCC4 @ SCCd */
693#define CICR_SCC_SCC3 ((uint)0x00200000) /* SCC3 @ SCCc */
694#define CICR_SCB_SCC2 ((uint)0x00040000) /* SCC2 @ SCCb */
695#define CICR_SCA_SCC1 ((uint)0x00000000) /* SCC1 @ SCCa */
696#define CICR_IRL_MASK ((uint)0x0000e000) /* Core interrrupt */
697#define CICR_HP_MASK ((uint)0x00001f00) /* Hi-pri int. */
698#define CICR_IEN ((uint)0x00000080) /* Int. enable */
699#define CICR_SPS ((uint)0x00000001) /* SCC Spread */
700
701extern void cpm_install_handler(int vec, void (*handler)(void *), void *dev_id);
702extern void cpm_free_handler(int vec);
703
704#define IMAP_ADDR (get_immrbase())
705
706#define CPM_PIN_INPUT 0
707#define CPM_PIN_OUTPUT 1
708#define CPM_PIN_PRIMARY 0
709#define CPM_PIN_SECONDARY 2
710#define CPM_PIN_GPIO 4
711#define CPM_PIN_OPENDRAIN 8
712
713enum cpm_port {
714 CPM_PORTA,
715 CPM_PORTB,
716 CPM_PORTC,
717 CPM_PORTD,
718 CPM_PORTE,
719};
720
721void cpm1_set_pin(enum cpm_port port, int pin, int flags);
722
723enum cpm_clk_dir {
724 CPM_CLK_RX,
725 CPM_CLK_TX,
726 CPM_CLK_RTX
727};
728
729enum cpm_clk_target {
730 CPM_CLK_SCC1,
731 CPM_CLK_SCC2,
732 CPM_CLK_SCC3,
733 CPM_CLK_SCC4,
734 CPM_CLK_SMC1,
735 CPM_CLK_SMC2,
736};
737
738enum cpm_clk {
739 CPM_BRG1, /* Baud Rate Generator 1 */
740 CPM_BRG2, /* Baud Rate Generator 2 */
741 CPM_BRG3, /* Baud Rate Generator 3 */
742 CPM_BRG4, /* Baud Rate Generator 4 */
743 CPM_CLK1, /* Clock 1 */
744 CPM_CLK2, /* Clock 2 */
745 CPM_CLK3, /* Clock 3 */
746 CPM_CLK4, /* Clock 4 */
747 CPM_CLK5, /* Clock 5 */
748 CPM_CLK6, /* Clock 6 */
749 CPM_CLK7, /* Clock 7 */
750 CPM_CLK8, /* Clock 8 */
751};
752
753int cpm1_clk_setup(enum cpm_clk_target target, int clock, int mode);
754
755#endif /* __CPM_8XX__ */
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
new file mode 100644
index 000000000000..f1112c15ef96
--- /dev/null
+++ b/include/asm-powerpc/cpm2.h
@@ -0,0 +1,1274 @@
1/*
2 * Communication Processor Module v2.
3 *
4 * This file contains structures and information for the communication
5 * processor channels found in the dual port RAM or parameter RAM.
6 * All CPM control and status is available through the CPM2 internal
7 * memory map. See immap_cpm2.h for details.
8 */
9#ifdef __KERNEL__
10#ifndef __CPM2__
11#define __CPM2__
12
13#include <asm/immap_cpm2.h>
14#include <asm/cpm.h>
15
16#ifdef CONFIG_PPC_85xx
17#define CPM_MAP_ADDR (get_immrbase() + 0x80000)
18#endif
19
20/* CPM Command register.
21*/
22#define CPM_CR_RST ((uint)0x80000000)
23#define CPM_CR_PAGE ((uint)0x7c000000)
24#define CPM_CR_SBLOCK ((uint)0x03e00000)
25#define CPM_CR_FLG ((uint)0x00010000)
26#define CPM_CR_MCN ((uint)0x00003fc0)
27#define CPM_CR_OPCODE ((uint)0x0000000f)
28
29/* Device sub-block and page codes.
30*/
31#define CPM_CR_SCC1_SBLOCK (0x04)
32#define CPM_CR_SCC2_SBLOCK (0x05)
33#define CPM_CR_SCC3_SBLOCK (0x06)
34#define CPM_CR_SCC4_SBLOCK (0x07)
35#define CPM_CR_SMC1_SBLOCK (0x08)
36#define CPM_CR_SMC2_SBLOCK (0x09)
37#define CPM_CR_SPI_SBLOCK (0x0a)
38#define CPM_CR_I2C_SBLOCK (0x0b)
39#define CPM_CR_TIMER_SBLOCK (0x0f)
40#define CPM_CR_RAND_SBLOCK (0x0e)
41#define CPM_CR_FCC1_SBLOCK (0x10)
42#define CPM_CR_FCC2_SBLOCK (0x11)
43#define CPM_CR_FCC3_SBLOCK (0x12)
44#define CPM_CR_IDMA1_SBLOCK (0x14)
45#define CPM_CR_IDMA2_SBLOCK (0x15)
46#define CPM_CR_IDMA3_SBLOCK (0x16)
47#define CPM_CR_IDMA4_SBLOCK (0x17)
48#define CPM_CR_MCC1_SBLOCK (0x1c)
49
50#define CPM_CR_FCC_SBLOCK(x) (x + 0x10)
51
52#define CPM_CR_SCC1_PAGE (0x00)
53#define CPM_CR_SCC2_PAGE (0x01)
54#define CPM_CR_SCC3_PAGE (0x02)
55#define CPM_CR_SCC4_PAGE (0x03)
56#define CPM_CR_SMC1_PAGE (0x07)
57#define CPM_CR_SMC2_PAGE (0x08)
58#define CPM_CR_SPI_PAGE (0x09)
59#define CPM_CR_I2C_PAGE (0x0a)
60#define CPM_CR_TIMER_PAGE (0x0a)
61#define CPM_CR_RAND_PAGE (0x0a)
62#define CPM_CR_FCC1_PAGE (0x04)
63#define CPM_CR_FCC2_PAGE (0x05)
64#define CPM_CR_FCC3_PAGE (0x06)
65#define CPM_CR_IDMA1_PAGE (0x07)
66#define CPM_CR_IDMA2_PAGE (0x08)
67#define CPM_CR_IDMA3_PAGE (0x09)
68#define CPM_CR_IDMA4_PAGE (0x0a)
69#define CPM_CR_MCC1_PAGE (0x07)
70#define CPM_CR_MCC2_PAGE (0x08)
71
72#define CPM_CR_FCC_PAGE(x) (x + 0x04)
73
74/* Some opcodes (there are more...later)
75*/
76#define CPM_CR_INIT_TRX ((ushort)0x0000)
77#define CPM_CR_INIT_RX ((ushort)0x0001)
78#define CPM_CR_INIT_TX ((ushort)0x0002)
79#define CPM_CR_HUNT_MODE ((ushort)0x0003)
80#define CPM_CR_STOP_TX ((ushort)0x0004)
81#define CPM_CR_GRA_STOP_TX ((ushort)0x0005)
82#define CPM_CR_RESTART_TX ((ushort)0x0006)
83#define CPM_CR_SET_GADDR ((ushort)0x0008)
84#define CPM_CR_START_IDMA ((ushort)0x0009)
85#define CPM_CR_STOP_IDMA ((ushort)0x000b)
86
87#define mk_cr_cmd(PG, SBC, MCN, OP) \
88 ((PG << 26) | (SBC << 21) | (MCN << 6) | OP)
89
90#ifndef CONFIG_PPC_CPM_NEW_BINDING
91/* Dual Port RAM addresses. The first 16K is available for almost
92 * any CPM use, so we put the BDs there. The first 128 bytes are
93 * used for SMC1 and SMC2 parameter RAM, so we start allocating
94 * BDs above that. All of this must change when we start
95 * downloading RAM microcode.
96 */
97#define CPM_DATAONLY_BASE ((uint)128)
98#define CPM_DP_NOSPACE ((uint)0x7fffffff)
99#if defined(CONFIG_8272) || defined(CONFIG_MPC8555)
100#define CPM_DATAONLY_SIZE ((uint)(8 * 1024) - CPM_DATAONLY_BASE)
101#define CPM_FCC_SPECIAL_BASE ((uint)0x00009000)
102#else
103#define CPM_DATAONLY_SIZE ((uint)(16 * 1024) - CPM_DATAONLY_BASE)
104#define CPM_FCC_SPECIAL_BASE ((uint)0x0000b000)
105#endif
106#endif
107
108/* The number of pages of host memory we allocate for CPM. This is
109 * done early in kernel initialization to get physically contiguous
110 * pages.
111 */
112#define NUM_CPM_HOST_PAGES 2
113
114/* Export the base address of the communication processor registers
115 * and dual port ram.
116 */
117extern cpm_cpm2_t __iomem *cpmp; /* Pointer to comm processor */
118
119#ifdef CONFIG_PPC_CPM_NEW_BINDING
120#define cpm_dpalloc cpm_muram_alloc
121#define cpm_dpfree cpm_muram_free
122#define cpm_dpram_addr cpm_muram_addr
123#else
124extern unsigned long cpm_dpalloc(uint size, uint align);
125extern int cpm_dpfree(unsigned long offset);
126extern unsigned long cpm_dpalloc_fixed(unsigned long offset, uint size, uint align);
127extern void cpm_dpdump(void);
128extern void *cpm_dpram_addr(unsigned long offset);
129#endif
130
131extern void cpm_setbrg(uint brg, uint rate);
132extern void cpm2_fastbrg(uint brg, uint rate, int div16);
133extern void cpm2_reset(void);
134
135
136/* Buffer descriptors used by many of the CPM protocols.
137*/
138typedef struct cpm_buf_desc {
139 ushort cbd_sc; /* Status and Control */
140 ushort cbd_datlen; /* Data length in buffer */
141 uint cbd_bufaddr; /* Buffer address in host memory */
142} cbd_t;
143
144#define BD_SC_EMPTY ((ushort)0x8000) /* Receive is empty */
145#define BD_SC_READY ((ushort)0x8000) /* Transmit is ready */
146#define BD_SC_WRAP ((ushort)0x2000) /* Last buffer descriptor */
147#define BD_SC_INTRPT ((ushort)0x1000) /* Interrupt on change */
148#define BD_SC_LAST ((ushort)0x0800) /* Last buffer in frame */
149#define BD_SC_CM ((ushort)0x0200) /* Continous mode */
150#define BD_SC_ID ((ushort)0x0100) /* Rec'd too many idles */
151#define BD_SC_P ((ushort)0x0100) /* xmt preamble */
152#define BD_SC_BR ((ushort)0x0020) /* Break received */
153#define BD_SC_FR ((ushort)0x0010) /* Framing error */
154#define BD_SC_PR ((ushort)0x0008) /* Parity error */
155#define BD_SC_OV ((ushort)0x0002) /* Overrun */
156#define BD_SC_CD ((ushort)0x0001) /* ?? */
157
158/* Function code bits, usually generic to devices.
159*/
160#define CPMFCR_GBL ((u_char)0x20) /* Set memory snooping */
161#define CPMFCR_EB ((u_char)0x10) /* Set big endian byte order */
162#define CPMFCR_TC2 ((u_char)0x04) /* Transfer code 2 value */
163#define CPMFCR_DTB ((u_char)0x02) /* Use local bus for data when set */
164#define CPMFCR_BDB ((u_char)0x01) /* Use local bus for BD when set */
165
166/* Parameter RAM offsets from the base.
167*/
168#define PROFF_SCC1 ((uint)0x8000)
169#define PROFF_SCC2 ((uint)0x8100)
170#define PROFF_SCC3 ((uint)0x8200)
171#define PROFF_SCC4 ((uint)0x8300)
172#define PROFF_FCC1 ((uint)0x8400)
173#define PROFF_FCC2 ((uint)0x8500)
174#define PROFF_FCC3 ((uint)0x8600)
175#define PROFF_MCC1 ((uint)0x8700)
176#define PROFF_SMC1_BASE ((uint)0x87fc)
177#define PROFF_IDMA1_BASE ((uint)0x87fe)
178#define PROFF_MCC2 ((uint)0x8800)
179#define PROFF_SMC2_BASE ((uint)0x88fc)
180#define PROFF_IDMA2_BASE ((uint)0x88fe)
181#define PROFF_SPI_BASE ((uint)0x89fc)
182#define PROFF_IDMA3_BASE ((uint)0x89fe)
183#define PROFF_TIMERS ((uint)0x8ae0)
184#define PROFF_REVNUM ((uint)0x8af0)
185#define PROFF_RAND ((uint)0x8af8)
186#define PROFF_I2C_BASE ((uint)0x8afc)
187#define PROFF_IDMA4_BASE ((uint)0x8afe)
188
189#define PROFF_SCC_SIZE ((uint)0x100)
190#define PROFF_FCC_SIZE ((uint)0x100)
191#define PROFF_SMC_SIZE ((uint)64)
192
193/* The SMCs are relocated to any of the first eight DPRAM pages.
194 * We will fix these at the first locations of DPRAM, until we
195 * get some microcode patches :-).
196 * The parameter ram space for the SMCs is fifty-some bytes, and
197 * they are required to start on a 64 byte boundary.
198 */
199#define PROFF_SMC1 (0)
200#define PROFF_SMC2 (64)
201
202
203/* Define enough so I can at least use the serial port as a UART.
204 */
205typedef struct smc_uart {
206 ushort smc_rbase; /* Rx Buffer descriptor base address */
207 ushort smc_tbase; /* Tx Buffer descriptor base address */
208 u_char smc_rfcr; /* Rx function code */
209 u_char smc_tfcr; /* Tx function code */
210 ushort smc_mrblr; /* Max receive buffer length */
211 uint smc_rstate; /* Internal */
212 uint smc_idp; /* Internal */
213 ushort smc_rbptr; /* Internal */
214 ushort smc_ibc; /* Internal */
215 uint smc_rxtmp; /* Internal */
216 uint smc_tstate; /* Internal */
217 uint smc_tdp; /* Internal */
218 ushort smc_tbptr; /* Internal */
219 ushort smc_tbc; /* Internal */
220 uint smc_txtmp; /* Internal */
221 ushort smc_maxidl; /* Maximum idle characters */
222 ushort smc_tmpidl; /* Temporary idle counter */
223 ushort smc_brklen; /* Last received break length */
224 ushort smc_brkec; /* rcv'd break condition counter */
225 ushort smc_brkcr; /* xmt break count register */
226 ushort smc_rmask; /* Temporary bit mask */
227 uint smc_stmp; /* SDMA Temp */
228} smc_uart_t;
229
230/* SMC uart mode register (Internal memory map).
231*/
232#define SMCMR_REN ((ushort)0x0001)
233#define SMCMR_TEN ((ushort)0x0002)
234#define SMCMR_DM ((ushort)0x000c)
235#define SMCMR_SM_GCI ((ushort)0x0000)
236#define SMCMR_SM_UART ((ushort)0x0020)
237#define SMCMR_SM_TRANS ((ushort)0x0030)
238#define SMCMR_SM_MASK ((ushort)0x0030)
239#define SMCMR_PM_EVEN ((ushort)0x0100) /* Even parity, else odd */
240#define SMCMR_REVD SMCMR_PM_EVEN
241#define SMCMR_PEN ((ushort)0x0200) /* Parity enable */
242#define SMCMR_BS SMCMR_PEN
243#define SMCMR_SL ((ushort)0x0400) /* Two stops, else one */
244#define SMCR_CLEN_MASK ((ushort)0x7800) /* Character length */
245#define smcr_mk_clen(C) (((C) << 11) & SMCR_CLEN_MASK)
246
247/* SMC Event and Mask register.
248*/
249#define SMCM_BRKE ((unsigned char)0x40) /* When in UART Mode */
250#define SMCM_BRK ((unsigned char)0x10) /* When in UART Mode */
251#define SMCM_TXE ((unsigned char)0x10)
252#define SMCM_BSY ((unsigned char)0x04)
253#define SMCM_TX ((unsigned char)0x02)
254#define SMCM_RX ((unsigned char)0x01)
255
256/* Baud rate generators.
257*/
258#define CPM_BRG_RST ((uint)0x00020000)
259#define CPM_BRG_EN ((uint)0x00010000)
260#define CPM_BRG_EXTC_INT ((uint)0x00000000)
261#define CPM_BRG_EXTC_CLK3_9 ((uint)0x00004000)
262#define CPM_BRG_EXTC_CLK5_15 ((uint)0x00008000)
263#define CPM_BRG_ATB ((uint)0x00002000)
264#define CPM_BRG_CD_MASK ((uint)0x00001ffe)
265#define CPM_BRG_DIV16 ((uint)0x00000001)
266
267/* SCCs.
268*/
269#define SCC_GSMRH_IRP ((uint)0x00040000)
270#define SCC_GSMRH_GDE ((uint)0x00010000)
271#define SCC_GSMRH_TCRC_CCITT ((uint)0x00008000)
272#define SCC_GSMRH_TCRC_BISYNC ((uint)0x00004000)
273#define SCC_GSMRH_TCRC_HDLC ((uint)0x00000000)
274#define SCC_GSMRH_REVD ((uint)0x00002000)
275#define SCC_GSMRH_TRX ((uint)0x00001000)
276#define SCC_GSMRH_TTX ((uint)0x00000800)
277#define SCC_GSMRH_CDP ((uint)0x00000400)
278#define SCC_GSMRH_CTSP ((uint)0x00000200)
279#define SCC_GSMRH_CDS ((uint)0x00000100)
280#define SCC_GSMRH_CTSS ((uint)0x00000080)
281#define SCC_GSMRH_TFL ((uint)0x00000040)
282#define SCC_GSMRH_RFW ((uint)0x00000020)
283#define SCC_GSMRH_TXSY ((uint)0x00000010)
284#define SCC_GSMRH_SYNL16 ((uint)0x0000000c)
285#define SCC_GSMRH_SYNL8 ((uint)0x00000008)
286#define SCC_GSMRH_SYNL4 ((uint)0x00000004)
287#define SCC_GSMRH_RTSM ((uint)0x00000002)
288#define SCC_GSMRH_RSYN ((uint)0x00000001)
289
290#define SCC_GSMRL_SIR ((uint)0x80000000) /* SCC2 only */
291#define SCC_GSMRL_EDGE_NONE ((uint)0x60000000)
292#define SCC_GSMRL_EDGE_NEG ((uint)0x40000000)
293#define SCC_GSMRL_EDGE_POS ((uint)0x20000000)
294#define SCC_GSMRL_EDGE_BOTH ((uint)0x00000000)
295#define SCC_GSMRL_TCI ((uint)0x10000000)
296#define SCC_GSMRL_TSNC_3 ((uint)0x0c000000)
297#define SCC_GSMRL_TSNC_4 ((uint)0x08000000)
298#define SCC_GSMRL_TSNC_14 ((uint)0x04000000)
299#define SCC_GSMRL_TSNC_INF ((uint)0x00000000)
300#define SCC_GSMRL_RINV ((uint)0x02000000)
301#define SCC_GSMRL_TINV ((uint)0x01000000)
302#define SCC_GSMRL_TPL_128 ((uint)0x00c00000)
303#define SCC_GSMRL_TPL_64 ((uint)0x00a00000)
304#define SCC_GSMRL_TPL_48 ((uint)0x00800000)
305#define SCC_GSMRL_TPL_32 ((uint)0x00600000)
306#define SCC_GSMRL_TPL_16 ((uint)0x00400000)
307#define SCC_GSMRL_TPL_8 ((uint)0x00200000)
308#define SCC_GSMRL_TPL_NONE ((uint)0x00000000)
309#define SCC_GSMRL_TPP_ALL1 ((uint)0x00180000)
310#define SCC_GSMRL_TPP_01 ((uint)0x00100000)
311#define SCC_GSMRL_TPP_10 ((uint)0x00080000)
312#define SCC_GSMRL_TPP_ZEROS ((uint)0x00000000)
313#define SCC_GSMRL_TEND ((uint)0x00040000)
314#define SCC_GSMRL_TDCR_32 ((uint)0x00030000)
315#define SCC_GSMRL_TDCR_16 ((uint)0x00020000)
316#define SCC_GSMRL_TDCR_8 ((uint)0x00010000)
317#define SCC_GSMRL_TDCR_1 ((uint)0x00000000)
318#define SCC_GSMRL_RDCR_32 ((uint)0x0000c000)
319#define SCC_GSMRL_RDCR_16 ((uint)0x00008000)
320#define SCC_GSMRL_RDCR_8 ((uint)0x00004000)
321#define SCC_GSMRL_RDCR_1 ((uint)0x00000000)
322#define SCC_GSMRL_RENC_DFMAN ((uint)0x00003000)
323#define SCC_GSMRL_RENC_MANCH ((uint)0x00002000)
324#define SCC_GSMRL_RENC_FM0 ((uint)0x00001000)
325#define SCC_GSMRL_RENC_NRZI ((uint)0x00000800)
326#define SCC_GSMRL_RENC_NRZ ((uint)0x00000000)
327#define SCC_GSMRL_TENC_DFMAN ((uint)0x00000600)
328#define SCC_GSMRL_TENC_MANCH ((uint)0x00000400)
329#define SCC_GSMRL_TENC_FM0 ((uint)0x00000200)
330#define SCC_GSMRL_TENC_NRZI ((uint)0x00000100)
331#define SCC_GSMRL_TENC_NRZ ((uint)0x00000000)
332#define SCC_GSMRL_DIAG_LE ((uint)0x000000c0) /* Loop and echo */
333#define SCC_GSMRL_DIAG_ECHO ((uint)0x00000080)
334#define SCC_GSMRL_DIAG_LOOP ((uint)0x00000040)
335#define SCC_GSMRL_DIAG_NORM ((uint)0x00000000)
336#define SCC_GSMRL_ENR ((uint)0x00000020)
337#define SCC_GSMRL_ENT ((uint)0x00000010)
338#define SCC_GSMRL_MODE_ENET ((uint)0x0000000c)
339#define SCC_GSMRL_MODE_DDCMP ((uint)0x00000009)
340#define SCC_GSMRL_MODE_BISYNC ((uint)0x00000008)
341#define SCC_GSMRL_MODE_V14 ((uint)0x00000007)
342#define SCC_GSMRL_MODE_AHDLC ((uint)0x00000006)
343#define SCC_GSMRL_MODE_PROFIBUS ((uint)0x00000005)
344#define SCC_GSMRL_MODE_UART ((uint)0x00000004)
345#define SCC_GSMRL_MODE_SS7 ((uint)0x00000003)
346#define SCC_GSMRL_MODE_ATALK ((uint)0x00000002)
347#define SCC_GSMRL_MODE_HDLC ((uint)0x00000000)
348
349#define SCC_TODR_TOD ((ushort)0x8000)
350
351/* SCC Event and Mask register.
352*/
353#define SCCM_TXE ((unsigned char)0x10)
354#define SCCM_BSY ((unsigned char)0x04)
355#define SCCM_TX ((unsigned char)0x02)
356#define SCCM_RX ((unsigned char)0x01)
357
358typedef struct scc_param {
359 ushort scc_rbase; /* Rx Buffer descriptor base address */
360 ushort scc_tbase; /* Tx Buffer descriptor base address */
361 u_char scc_rfcr; /* Rx function code */
362 u_char scc_tfcr; /* Tx function code */
363 ushort scc_mrblr; /* Max receive buffer length */
364 uint scc_rstate; /* Internal */
365 uint scc_idp; /* Internal */
366 ushort scc_rbptr; /* Internal */
367 ushort scc_ibc; /* Internal */
368 uint scc_rxtmp; /* Internal */
369 uint scc_tstate; /* Internal */
370 uint scc_tdp; /* Internal */
371 ushort scc_tbptr; /* Internal */
372 ushort scc_tbc; /* Internal */
373 uint scc_txtmp; /* Internal */
374 uint scc_rcrc; /* Internal */
375 uint scc_tcrc; /* Internal */
376} sccp_t;
377
378/* CPM Ethernet through SCC1.
379 */
380typedef struct scc_enet {
381 sccp_t sen_genscc;
382 uint sen_cpres; /* Preset CRC */
383 uint sen_cmask; /* Constant mask for CRC */
384 uint sen_crcec; /* CRC Error counter */
385 uint sen_alec; /* alignment error counter */
386 uint sen_disfc; /* discard frame counter */
387 ushort sen_pads; /* Tx short frame pad character */
388 ushort sen_retlim; /* Retry limit threshold */
389 ushort sen_retcnt; /* Retry limit counter */
390 ushort sen_maxflr; /* maximum frame length register */
391 ushort sen_minflr; /* minimum frame length register */
392 ushort sen_maxd1; /* maximum DMA1 length */
393 ushort sen_maxd2; /* maximum DMA2 length */
394 ushort sen_maxd; /* Rx max DMA */
395 ushort sen_dmacnt; /* Rx DMA counter */
396 ushort sen_maxb; /* Max BD byte count */
397 ushort sen_gaddr1; /* Group address filter */
398 ushort sen_gaddr2;
399 ushort sen_gaddr3;
400 ushort sen_gaddr4;
401 uint sen_tbuf0data0; /* Save area 0 - current frame */
402 uint sen_tbuf0data1; /* Save area 1 - current frame */
403 uint sen_tbuf0rba; /* Internal */
404 uint sen_tbuf0crc; /* Internal */
405 ushort sen_tbuf0bcnt; /* Internal */
406 ushort sen_paddrh; /* physical address (MSB) */
407 ushort sen_paddrm;
408 ushort sen_paddrl; /* physical address (LSB) */
409 ushort sen_pper; /* persistence */
410 ushort sen_rfbdptr; /* Rx first BD pointer */
411 ushort sen_tfbdptr; /* Tx first BD pointer */
412 ushort sen_tlbdptr; /* Tx last BD pointer */
413 uint sen_tbuf1data0; /* Save area 0 - current frame */
414 uint sen_tbuf1data1; /* Save area 1 - current frame */
415 uint sen_tbuf1rba; /* Internal */
416 uint sen_tbuf1crc; /* Internal */
417 ushort sen_tbuf1bcnt; /* Internal */
418 ushort sen_txlen; /* Tx Frame length counter */
419 ushort sen_iaddr1; /* Individual address filter */
420 ushort sen_iaddr2;
421 ushort sen_iaddr3;
422 ushort sen_iaddr4;
423 ushort sen_boffcnt; /* Backoff counter */
424
425 /* NOTE: Some versions of the manual have the following items
426 * incorrectly documented. Below is the proper order.
427 */
428 ushort sen_taddrh; /* temp address (MSB) */
429 ushort sen_taddrm;
430 ushort sen_taddrl; /* temp address (LSB) */
431} scc_enet_t;
432
433
434/* SCC Event register as used by Ethernet.
435*/
436#define SCCE_ENET_GRA ((ushort)0x0080) /* Graceful stop complete */
437#define SCCE_ENET_TXE ((ushort)0x0010) /* Transmit Error */
438#define SCCE_ENET_RXF ((ushort)0x0008) /* Full frame received */
439#define SCCE_ENET_BSY ((ushort)0x0004) /* All incoming buffers full */
440#define SCCE_ENET_TXB ((ushort)0x0002) /* A buffer was transmitted */
441#define SCCE_ENET_RXB ((ushort)0x0001) /* A buffer was received */
442
443/* SCC Mode Register (PSMR) as used by Ethernet.
444*/
445#define SCC_PSMR_HBC ((ushort)0x8000) /* Enable heartbeat */
446#define SCC_PSMR_FC ((ushort)0x4000) /* Force collision */
447#define SCC_PSMR_RSH ((ushort)0x2000) /* Receive short frames */
448#define SCC_PSMR_IAM ((ushort)0x1000) /* Check individual hash */
449#define SCC_PSMR_ENCRC ((ushort)0x0800) /* Ethernet CRC mode */
450#define SCC_PSMR_PRO ((ushort)0x0200) /* Promiscuous mode */
451#define SCC_PSMR_BRO ((ushort)0x0100) /* Catch broadcast pkts */
452#define SCC_PSMR_SBT ((ushort)0x0080) /* Special backoff timer */
453#define SCC_PSMR_LPB ((ushort)0x0040) /* Set Loopback mode */
454#define SCC_PSMR_SIP ((ushort)0x0020) /* Sample Input Pins */
455#define SCC_PSMR_LCW ((ushort)0x0010) /* Late collision window */
456#define SCC_PSMR_NIB22 ((ushort)0x000a) /* Start frame search */
457#define SCC_PSMR_FDE ((ushort)0x0001) /* Full duplex enable */
458
459/* Buffer descriptor control/status used by Ethernet receive.
460 * Common to SCC and FCC.
461 */
462#define BD_ENET_RX_EMPTY ((ushort)0x8000)
463#define BD_ENET_RX_WRAP ((ushort)0x2000)
464#define BD_ENET_RX_INTR ((ushort)0x1000)
465#define BD_ENET_RX_LAST ((ushort)0x0800)
466#define BD_ENET_RX_FIRST ((ushort)0x0400)
467#define BD_ENET_RX_MISS ((ushort)0x0100)
468#define BD_ENET_RX_BC ((ushort)0x0080) /* FCC Only */
469#define BD_ENET_RX_MC ((ushort)0x0040) /* FCC Only */
470#define BD_ENET_RX_LG ((ushort)0x0020)
471#define BD_ENET_RX_NO ((ushort)0x0010)
472#define BD_ENET_RX_SH ((ushort)0x0008)
473#define BD_ENET_RX_CR ((ushort)0x0004)
474#define BD_ENET_RX_OV ((ushort)0x0002)
475#define BD_ENET_RX_CL ((ushort)0x0001)
476#define BD_ENET_RX_STATS ((ushort)0x01ff) /* All status bits */
477
478/* Buffer descriptor control/status used by Ethernet transmit.
479 * Common to SCC and FCC.
480 */
481#define BD_ENET_TX_READY ((ushort)0x8000)
482#define BD_ENET_TX_PAD ((ushort)0x4000)
483#define BD_ENET_TX_WRAP ((ushort)0x2000)
484#define BD_ENET_TX_INTR ((ushort)0x1000)
485#define BD_ENET_TX_LAST ((ushort)0x0800)
486#define BD_ENET_TX_TC ((ushort)0x0400)
487#define BD_ENET_TX_DEF ((ushort)0x0200)
488#define BD_ENET_TX_HB ((ushort)0x0100)
489#define BD_ENET_TX_LC ((ushort)0x0080)
490#define BD_ENET_TX_RL ((ushort)0x0040)
491#define BD_ENET_TX_RCMASK ((ushort)0x003c)
492#define BD_ENET_TX_UN ((ushort)0x0002)
493#define BD_ENET_TX_CSL ((ushort)0x0001)
494#define BD_ENET_TX_STATS ((ushort)0x03ff) /* All status bits */
495
496/* SCC as UART
497*/
498typedef struct scc_uart {
499 sccp_t scc_genscc;
500 uint scc_res1; /* Reserved */
501 uint scc_res2; /* Reserved */
502 ushort scc_maxidl; /* Maximum idle chars */
503 ushort scc_idlc; /* temp idle counter */
504 ushort scc_brkcr; /* Break count register */
505 ushort scc_parec; /* receive parity error counter */
506 ushort scc_frmec; /* receive framing error counter */
507 ushort scc_nosec; /* receive noise counter */
508 ushort scc_brkec; /* receive break condition counter */
509 ushort scc_brkln; /* last received break length */
510 ushort scc_uaddr1; /* UART address character 1 */
511 ushort scc_uaddr2; /* UART address character 2 */
512 ushort scc_rtemp; /* Temp storage */
513 ushort scc_toseq; /* Transmit out of sequence char */
514 ushort scc_char1; /* control character 1 */
515 ushort scc_char2; /* control character 2 */
516 ushort scc_char3; /* control character 3 */
517 ushort scc_char4; /* control character 4 */
518 ushort scc_char5; /* control character 5 */
519 ushort scc_char6; /* control character 6 */
520 ushort scc_char7; /* control character 7 */
521 ushort scc_char8; /* control character 8 */
522 ushort scc_rccm; /* receive control character mask */
523 ushort scc_rccr; /* receive control character register */
524 ushort scc_rlbc; /* receive last break character */
525} scc_uart_t;
526
527/* SCC Event and Mask registers when it is used as a UART.
528*/
529#define UART_SCCM_GLR ((ushort)0x1000)
530#define UART_SCCM_GLT ((ushort)0x0800)
531#define UART_SCCM_AB ((ushort)0x0200)
532#define UART_SCCM_IDL ((ushort)0x0100)
533#define UART_SCCM_GRA ((ushort)0x0080)
534#define UART_SCCM_BRKE ((ushort)0x0040)
535#define UART_SCCM_BRKS ((ushort)0x0020)
536#define UART_SCCM_CCR ((ushort)0x0008)
537#define UART_SCCM_BSY ((ushort)0x0004)
538#define UART_SCCM_TX ((ushort)0x0002)
539#define UART_SCCM_RX ((ushort)0x0001)
540
541/* The SCC PSMR when used as a UART.
542*/
543#define SCU_PSMR_FLC ((ushort)0x8000)
544#define SCU_PSMR_SL ((ushort)0x4000)
545#define SCU_PSMR_CL ((ushort)0x3000)
546#define SCU_PSMR_UM ((ushort)0x0c00)
547#define SCU_PSMR_FRZ ((ushort)0x0200)
548#define SCU_PSMR_RZS ((ushort)0x0100)
549#define SCU_PSMR_SYN ((ushort)0x0080)
550#define SCU_PSMR_DRT ((ushort)0x0040)
551#define SCU_PSMR_PEN ((ushort)0x0010)
552#define SCU_PSMR_RPM ((ushort)0x000c)
553#define SCU_PSMR_REVP ((ushort)0x0008)
554#define SCU_PSMR_TPM ((ushort)0x0003)
555#define SCU_PSMR_TEVP ((ushort)0x0002)
556
557/* CPM Transparent mode SCC.
558 */
559typedef struct scc_trans {
560 sccp_t st_genscc;
561 uint st_cpres; /* Preset CRC */
562 uint st_cmask; /* Constant mask for CRC */
563} scc_trans_t;
564
565#define BD_SCC_TX_LAST ((ushort)0x0800)
566
567/* How about some FCCs.....
568*/
569#define FCC_GFMR_DIAG_NORM ((uint)0x00000000)
570#define FCC_GFMR_DIAG_LE ((uint)0x40000000)
571#define FCC_GFMR_DIAG_AE ((uint)0x80000000)
572#define FCC_GFMR_DIAG_ALE ((uint)0xc0000000)
573#define FCC_GFMR_TCI ((uint)0x20000000)
574#define FCC_GFMR_TRX ((uint)0x10000000)
575#define FCC_GFMR_TTX ((uint)0x08000000)
576#define FCC_GFMR_TTX ((uint)0x08000000)
577#define FCC_GFMR_CDP ((uint)0x04000000)
578#define FCC_GFMR_CTSP ((uint)0x02000000)
579#define FCC_GFMR_CDS ((uint)0x01000000)
580#define FCC_GFMR_CTSS ((uint)0x00800000)
581#define FCC_GFMR_SYNL_NONE ((uint)0x00000000)
582#define FCC_GFMR_SYNL_AUTO ((uint)0x00004000)
583#define FCC_GFMR_SYNL_8 ((uint)0x00008000)
584#define FCC_GFMR_SYNL_16 ((uint)0x0000c000)
585#define FCC_GFMR_RTSM ((uint)0x00002000)
586#define FCC_GFMR_RENC_NRZ ((uint)0x00000000)
587#define FCC_GFMR_RENC_NRZI ((uint)0x00000800)
588#define FCC_GFMR_REVD ((uint)0x00000400)
589#define FCC_GFMR_TENC_NRZ ((uint)0x00000000)
590#define FCC_GFMR_TENC_NRZI ((uint)0x00000100)
591#define FCC_GFMR_TCRC_16 ((uint)0x00000000)
592#define FCC_GFMR_TCRC_32 ((uint)0x00000080)
593#define FCC_GFMR_ENR ((uint)0x00000020)
594#define FCC_GFMR_ENT ((uint)0x00000010)
595#define FCC_GFMR_MODE_ENET ((uint)0x0000000c)
596#define FCC_GFMR_MODE_ATM ((uint)0x0000000a)
597#define FCC_GFMR_MODE_HDLC ((uint)0x00000000)
598
599/* Generic FCC parameter ram.
600*/
601typedef struct fcc_param {
602 ushort fcc_riptr; /* Rx Internal temp pointer */
603 ushort fcc_tiptr; /* Tx Internal temp pointer */
604 ushort fcc_res1;
605 ushort fcc_mrblr; /* Max receive buffer length, mod 32 bytes */
606 uint fcc_rstate; /* Upper byte is Func code, must be set */
607 uint fcc_rbase; /* Receive BD base */
608 ushort fcc_rbdstat; /* RxBD status */
609 ushort fcc_rbdlen; /* RxBD down counter */
610 uint fcc_rdptr; /* RxBD internal data pointer */
611 uint fcc_tstate; /* Upper byte is Func code, must be set */
612 uint fcc_tbase; /* Transmit BD base */
613 ushort fcc_tbdstat; /* TxBD status */
614 ushort fcc_tbdlen; /* TxBD down counter */
615 uint fcc_tdptr; /* TxBD internal data pointer */
616 uint fcc_rbptr; /* Rx BD Internal buf pointer */
617 uint fcc_tbptr; /* Tx BD Internal buf pointer */
618 uint fcc_rcrc; /* Rx temp CRC */
619 uint fcc_res2;
620 uint fcc_tcrc; /* Tx temp CRC */
621} fccp_t;
622
623
624/* Ethernet controller through FCC.
625*/
626typedef struct fcc_enet {
627 fccp_t fen_genfcc;
628 uint fen_statbuf; /* Internal status buffer */
629 uint fen_camptr; /* CAM address */
630 uint fen_cmask; /* Constant mask for CRC */
631 uint fen_cpres; /* Preset CRC */
632 uint fen_crcec; /* CRC Error counter */
633 uint fen_alec; /* alignment error counter */
634 uint fen_disfc; /* discard frame counter */
635 ushort fen_retlim; /* Retry limit */
636 ushort fen_retcnt; /* Retry counter */
637 ushort fen_pper; /* Persistence */
638 ushort fen_boffcnt; /* backoff counter */
639 uint fen_gaddrh; /* Group address filter, high 32-bits */
640 uint fen_gaddrl; /* Group address filter, low 32-bits */
641 ushort fen_tfcstat; /* out of sequence TxBD */
642 ushort fen_tfclen;
643 uint fen_tfcptr;
644 ushort fen_mflr; /* Maximum frame length (1518) */
645 ushort fen_paddrh; /* MAC address */
646 ushort fen_paddrm;
647 ushort fen_paddrl;
648 ushort fen_ibdcount; /* Internal BD counter */
649 ushort fen_ibdstart; /* Internal BD start pointer */
650 ushort fen_ibdend; /* Internal BD end pointer */
651 ushort fen_txlen; /* Internal Tx frame length counter */
652 uint fen_ibdbase[8]; /* Internal use */
653 uint fen_iaddrh; /* Individual address filter */
654 uint fen_iaddrl;
655 ushort fen_minflr; /* Minimum frame length (64) */
656 ushort fen_taddrh; /* Filter transfer MAC address */
657 ushort fen_taddrm;
658 ushort fen_taddrl;
659 ushort fen_padptr; /* Pointer to pad byte buffer */
660 ushort fen_cftype; /* control frame type */
661 ushort fen_cfrange; /* control frame range */
662 ushort fen_maxb; /* maximum BD count */
663 ushort fen_maxd1; /* Max DMA1 length (1520) */
664 ushort fen_maxd2; /* Max DMA2 length (1520) */
665 ushort fen_maxd; /* internal max DMA count */
666 ushort fen_dmacnt; /* internal DMA counter */
667 uint fen_octc; /* Total octect counter */
668 uint fen_colc; /* Total collision counter */
669 uint fen_broc; /* Total broadcast packet counter */
670 uint fen_mulc; /* Total multicast packet count */
671 uint fen_uspc; /* Total packets < 64 bytes */
672 uint fen_frgc; /* Total packets < 64 bytes with errors */
673 uint fen_ospc; /* Total packets > 1518 */
674 uint fen_jbrc; /* Total packets > 1518 with errors */
675 uint fen_p64c; /* Total packets == 64 bytes */
676 uint fen_p65c; /* Total packets 64 < bytes <= 127 */
677 uint fen_p128c; /* Total packets 127 < bytes <= 255 */
678 uint fen_p256c; /* Total packets 256 < bytes <= 511 */
679 uint fen_p512c; /* Total packets 512 < bytes <= 1023 */
680 uint fen_p1024c; /* Total packets 1024 < bytes <= 1518 */
681 uint fen_cambuf; /* Internal CAM buffer poiner */
682 ushort fen_rfthr; /* Received frames threshold */
683 ushort fen_rfcnt; /* Received frames count */
684} fcc_enet_t;
685
686/* FCC Event/Mask register as used by Ethernet.
687*/
688#define FCC_ENET_GRA ((ushort)0x0080) /* Graceful stop complete */
689#define FCC_ENET_RXC ((ushort)0x0040) /* Control Frame Received */
690#define FCC_ENET_TXC ((ushort)0x0020) /* Out of seq. Tx sent */
691#define FCC_ENET_TXE ((ushort)0x0010) /* Transmit Error */
692#define FCC_ENET_RXF ((ushort)0x0008) /* Full frame received */
693#define FCC_ENET_BSY ((ushort)0x0004) /* Busy. Rx Frame dropped */
694#define FCC_ENET_TXB ((ushort)0x0002) /* A buffer was transmitted */
695#define FCC_ENET_RXB ((ushort)0x0001) /* A buffer was received */
696
697/* FCC Mode Register (FPSMR) as used by Ethernet.
698*/
699#define FCC_PSMR_HBC ((uint)0x80000000) /* Enable heartbeat */
700#define FCC_PSMR_FC ((uint)0x40000000) /* Force Collision */
701#define FCC_PSMR_SBT ((uint)0x20000000) /* Stop backoff timer */
702#define FCC_PSMR_LPB ((uint)0x10000000) /* Local protect. 1 = FDX */
703#define FCC_PSMR_LCW ((uint)0x08000000) /* Late collision select */
704#define FCC_PSMR_FDE ((uint)0x04000000) /* Full Duplex Enable */
705#define FCC_PSMR_MON ((uint)0x02000000) /* RMON Enable */
706#define FCC_PSMR_PRO ((uint)0x00400000) /* Promiscuous Enable */
707#define FCC_PSMR_FCE ((uint)0x00200000) /* Flow Control Enable */
708#define FCC_PSMR_RSH ((uint)0x00100000) /* Receive Short Frames */
709#define FCC_PSMR_CAM ((uint)0x00000400) /* CAM enable */
710#define FCC_PSMR_BRO ((uint)0x00000200) /* Broadcast pkt discard */
711#define FCC_PSMR_ENCRC ((uint)0x00000080) /* Use 32-bit CRC */
712
713/* IIC parameter RAM.
714*/
715typedef struct iic {
716 ushort iic_rbase; /* Rx Buffer descriptor base address */
717 ushort iic_tbase; /* Tx Buffer descriptor base address */
718 u_char iic_rfcr; /* Rx function code */
719 u_char iic_tfcr; /* Tx function code */
720 ushort iic_mrblr; /* Max receive buffer length */
721 uint iic_rstate; /* Internal */
722 uint iic_rdp; /* Internal */
723 ushort iic_rbptr; /* Internal */
724 ushort iic_rbc; /* Internal */
725 uint iic_rxtmp; /* Internal */
726 uint iic_tstate; /* Internal */
727 uint iic_tdp; /* Internal */
728 ushort iic_tbptr; /* Internal */
729 ushort iic_tbc; /* Internal */
730 uint iic_txtmp; /* Internal */
731} iic_t;
732
733/* SPI parameter RAM.
734*/
735typedef struct spi {
736 ushort spi_rbase; /* Rx Buffer descriptor base address */
737 ushort spi_tbase; /* Tx Buffer descriptor base address */
738 u_char spi_rfcr; /* Rx function code */
739 u_char spi_tfcr; /* Tx function code */
740 ushort spi_mrblr; /* Max receive buffer length */
741 uint spi_rstate; /* Internal */
742 uint spi_rdp; /* Internal */
743 ushort spi_rbptr; /* Internal */
744 ushort spi_rbc; /* Internal */
745 uint spi_rxtmp; /* Internal */
746 uint spi_tstate; /* Internal */
747 uint spi_tdp; /* Internal */
748 ushort spi_tbptr; /* Internal */
749 ushort spi_tbc; /* Internal */
750 uint spi_txtmp; /* Internal */
751 uint spi_res; /* Tx temp. */
752 uint spi_res1[4]; /* SDMA temp. */
753} spi_t;
754
755/* SPI Mode register.
756*/
757#define SPMODE_LOOP ((ushort)0x4000) /* Loopback */
758#define SPMODE_CI ((ushort)0x2000) /* Clock Invert */
759#define SPMODE_CP ((ushort)0x1000) /* Clock Phase */
760#define SPMODE_DIV16 ((ushort)0x0800) /* BRG/16 mode */
761#define SPMODE_REV ((ushort)0x0400) /* Reversed Data */
762#define SPMODE_MSTR ((ushort)0x0200) /* SPI Master */
763#define SPMODE_EN ((ushort)0x0100) /* Enable */
764#define SPMODE_LENMSK ((ushort)0x00f0) /* character length */
765#define SPMODE_PMMSK ((ushort)0x000f) /* prescale modulus */
766
767#define SPMODE_LEN(x) ((((x)-1)&0xF)<<4)
768#define SPMODE_PM(x) ((x) &0xF)
769
770#define SPI_EB ((u_char)0x10) /* big endian byte order */
771
772#define BD_IIC_START ((ushort)0x0400)
773
774/* IDMA parameter RAM
775*/
776typedef struct idma {
777 ushort ibase; /* IDMA buffer descriptor table base address */
778 ushort dcm; /* DMA channel mode */
779 ushort ibdptr; /* IDMA current buffer descriptor pointer */
780 ushort dpr_buf; /* IDMA transfer buffer base address */
781 ushort buf_inv; /* internal buffer inventory */
782 ushort ss_max; /* steady-state maximum transfer size */
783 ushort dpr_in_ptr; /* write pointer inside the internal buffer */
784 ushort sts; /* source transfer size */
785 ushort dpr_out_ptr; /* read pointer inside the internal buffer */
786 ushort seob; /* source end of burst */
787 ushort deob; /* destination end of burst */
788 ushort dts; /* destination transfer size */
789 ushort ret_add; /* return address when working in ERM=1 mode */
790 ushort res0; /* reserved */
791 uint bd_cnt; /* internal byte count */
792 uint s_ptr; /* source internal data pointer */
793 uint d_ptr; /* destination internal data pointer */
794 uint istate; /* internal state */
795 u_char res1[20]; /* pad to 64-byte length */
796} idma_t;
797
798/* DMA channel mode bit fields
799*/
800#define IDMA_DCM_FB ((ushort)0x8000) /* fly-by mode */
801#define IDMA_DCM_LP ((ushort)0x4000) /* low priority */
802#define IDMA_DCM_TC2 ((ushort)0x0400) /* value driven on TC[2] */
803#define IDMA_DCM_DMA_WRAP_MASK ((ushort)0x01c0) /* mask for DMA wrap */
804#define IDMA_DCM_DMA_WRAP_64 ((ushort)0x0000) /* 64-byte DMA xfer buffer */
805#define IDMA_DCM_DMA_WRAP_128 ((ushort)0x0040) /* 128-byte DMA xfer buffer */
806#define IDMA_DCM_DMA_WRAP_256 ((ushort)0x0080) /* 256-byte DMA xfer buffer */
807#define IDMA_DCM_DMA_WRAP_512 ((ushort)0x00c0) /* 512-byte DMA xfer buffer */
808#define IDMA_DCM_DMA_WRAP_1024 ((ushort)0x0100) /* 1024-byte DMA xfer buffer */
809#define IDMA_DCM_DMA_WRAP_2048 ((ushort)0x0140) /* 2048-byte DMA xfer buffer */
810#define IDMA_DCM_SINC ((ushort)0x0020) /* source inc addr */
811#define IDMA_DCM_DINC ((ushort)0x0010) /* destination inc addr */
812#define IDMA_DCM_ERM ((ushort)0x0008) /* external request mode */
813#define IDMA_DCM_DT ((ushort)0x0004) /* DONE treatment */
814#define IDMA_DCM_SD_MASK ((ushort)0x0003) /* mask for SD bit field */
815#define IDMA_DCM_SD_MEM2MEM ((ushort)0x0000) /* memory-to-memory xfer */
816#define IDMA_DCM_SD_PER2MEM ((ushort)0x0002) /* peripheral-to-memory xfer */
817#define IDMA_DCM_SD_MEM2PER ((ushort)0x0001) /* memory-to-peripheral xfer */
818
819/* IDMA Buffer Descriptors
820*/
821typedef struct idma_bd {
822 uint flags;
823 uint len; /* data length */
824 uint src; /* source data buffer pointer */
825 uint dst; /* destination data buffer pointer */
826} idma_bd_t;
827
828/* IDMA buffer descriptor flag bit fields
829*/
830#define IDMA_BD_V ((uint)0x80000000) /* valid */
831#define IDMA_BD_W ((uint)0x20000000) /* wrap */
832#define IDMA_BD_I ((uint)0x10000000) /* interrupt */
833#define IDMA_BD_L ((uint)0x08000000) /* last */
834#define IDMA_BD_CM ((uint)0x02000000) /* continuous mode */
835#define IDMA_BD_SDN ((uint)0x00400000) /* source done */
836#define IDMA_BD_DDN ((uint)0x00200000) /* destination done */
837#define IDMA_BD_DGBL ((uint)0x00100000) /* destination global */
838#define IDMA_BD_DBO_LE ((uint)0x00040000) /* little-end dest byte order */
839#define IDMA_BD_DBO_BE ((uint)0x00080000) /* big-end dest byte order */
840#define IDMA_BD_DDTB ((uint)0x00010000) /* destination data bus */
841#define IDMA_BD_SGBL ((uint)0x00002000) /* source global */
842#define IDMA_BD_SBO_LE ((uint)0x00000800) /* little-end src byte order */
843#define IDMA_BD_SBO_BE ((uint)0x00001000) /* big-end src byte order */
844#define IDMA_BD_SDTB ((uint)0x00000200) /* source data bus */
845
846/* per-channel IDMA registers
847*/
848typedef struct im_idma {
849 u_char idsr; /* IDMAn event status register */
850 u_char res0[3];
851 u_char idmr; /* IDMAn event mask register */
852 u_char res1[3];
853} im_idma_t;
854
855/* IDMA event register bit fields
856*/
857#define IDMA_EVENT_SC ((unsigned char)0x08) /* stop completed */
858#define IDMA_EVENT_OB ((unsigned char)0x04) /* out of buffers */
859#define IDMA_EVENT_EDN ((unsigned char)0x02) /* external DONE asserted */
860#define IDMA_EVENT_BC ((unsigned char)0x01) /* buffer descriptor complete */
861
862/* RISC Controller Configuration Register (RCCR) bit fields
863*/
864#define RCCR_TIME ((uint)0x80000000) /* timer enable */
865#define RCCR_TIMEP_MASK ((uint)0x3f000000) /* mask for timer period bit field */
866#define RCCR_DR0M ((uint)0x00800000) /* IDMA0 request mode */
867#define RCCR_DR1M ((uint)0x00400000) /* IDMA1 request mode */
868#define RCCR_DR2M ((uint)0x00000080) /* IDMA2 request mode */
869#define RCCR_DR3M ((uint)0x00000040) /* IDMA3 request mode */
870#define RCCR_DR0QP_MASK ((uint)0x00300000) /* mask for IDMA0 req priority */
871#define RCCR_DR0QP_HIGH ((uint)0x00000000) /* IDMA0 has high req priority */
872#define RCCR_DR0QP_MED ((uint)0x00100000) /* IDMA0 has medium req priority */
873#define RCCR_DR0QP_LOW ((uint)0x00200000) /* IDMA0 has low req priority */
874#define RCCR_DR1QP_MASK ((uint)0x00030000) /* mask for IDMA1 req priority */
875#define RCCR_DR1QP_HIGH ((uint)0x00000000) /* IDMA1 has high req priority */
876#define RCCR_DR1QP_MED ((uint)0x00010000) /* IDMA1 has medium req priority */
877#define RCCR_DR1QP_LOW ((uint)0x00020000) /* IDMA1 has low req priority */
878#define RCCR_DR2QP_MASK ((uint)0x00000030) /* mask for IDMA2 req priority */
879#define RCCR_DR2QP_HIGH ((uint)0x00000000) /* IDMA2 has high req priority */
880#define RCCR_DR2QP_MED ((uint)0x00000010) /* IDMA2 has medium req priority */
881#define RCCR_DR2QP_LOW ((uint)0x00000020) /* IDMA2 has low req priority */
882#define RCCR_DR3QP_MASK ((uint)0x00000003) /* mask for IDMA3 req priority */
883#define RCCR_DR3QP_HIGH ((uint)0x00000000) /* IDMA3 has high req priority */
884#define RCCR_DR3QP_MED ((uint)0x00000001) /* IDMA3 has medium req priority */
885#define RCCR_DR3QP_LOW ((uint)0x00000002) /* IDMA3 has low req priority */
886#define RCCR_EIE ((uint)0x00080000) /* external interrupt enable */
887#define RCCR_SCD ((uint)0x00040000) /* scheduler configuration */
888#define RCCR_ERAM_MASK ((uint)0x0000e000) /* mask for enable RAM microcode */
889#define RCCR_ERAM_0KB ((uint)0x00000000) /* use 0KB of dpram for microcode */
890#define RCCR_ERAM_2KB ((uint)0x00002000) /* use 2KB of dpram for microcode */
891#define RCCR_ERAM_4KB ((uint)0x00004000) /* use 4KB of dpram for microcode */
892#define RCCR_ERAM_6KB ((uint)0x00006000) /* use 6KB of dpram for microcode */
893#define RCCR_ERAM_8KB ((uint)0x00008000) /* use 8KB of dpram for microcode */
894#define RCCR_ERAM_10KB ((uint)0x0000a000) /* use 10KB of dpram for microcode */
895#define RCCR_ERAM_12KB ((uint)0x0000c000) /* use 12KB of dpram for microcode */
896#define RCCR_EDM0 ((uint)0x00000800) /* DREQ0 edge detect mode */
897#define RCCR_EDM1 ((uint)0x00000400) /* DREQ1 edge detect mode */
898#define RCCR_EDM2 ((uint)0x00000200) /* DREQ2 edge detect mode */
899#define RCCR_EDM3 ((uint)0x00000100) /* DREQ3 edge detect mode */
900#define RCCR_DEM01 ((uint)0x00000008) /* DONE0/DONE1 edge detect mode */
901#define RCCR_DEM23 ((uint)0x00000004) /* DONE2/DONE3 edge detect mode */
902
903/*-----------------------------------------------------------------------
904 * CMXFCR - CMX FCC Clock Route Register
905 */
906#define CMXFCR_FC1 0x40000000 /* FCC1 connection */
907#define CMXFCR_RF1CS_MSK 0x38000000 /* Receive FCC1 Clock Source Mask */
908#define CMXFCR_TF1CS_MSK 0x07000000 /* Transmit FCC1 Clock Source Mask */
909#define CMXFCR_FC2 0x00400000 /* FCC2 connection */
910#define CMXFCR_RF2CS_MSK 0x00380000 /* Receive FCC2 Clock Source Mask */
911#define CMXFCR_TF2CS_MSK 0x00070000 /* Transmit FCC2 Clock Source Mask */
912#define CMXFCR_FC3 0x00004000 /* FCC3 connection */
913#define CMXFCR_RF3CS_MSK 0x00003800 /* Receive FCC3 Clock Source Mask */
914#define CMXFCR_TF3CS_MSK 0x00000700 /* Transmit FCC3 Clock Source Mask */
915
916#define CMXFCR_RF1CS_BRG5 0x00000000 /* Receive FCC1 Clock Source is BRG5 */
917#define CMXFCR_RF1CS_BRG6 0x08000000 /* Receive FCC1 Clock Source is BRG6 */
918#define CMXFCR_RF1CS_BRG7 0x10000000 /* Receive FCC1 Clock Source is BRG7 */
919#define CMXFCR_RF1CS_BRG8 0x18000000 /* Receive FCC1 Clock Source is BRG8 */
920#define CMXFCR_RF1CS_CLK9 0x20000000 /* Receive FCC1 Clock Source is CLK9 */
921#define CMXFCR_RF1CS_CLK10 0x28000000 /* Receive FCC1 Clock Source is CLK10 */
922#define CMXFCR_RF1CS_CLK11 0x30000000 /* Receive FCC1 Clock Source is CLK11 */
923#define CMXFCR_RF1CS_CLK12 0x38000000 /* Receive FCC1 Clock Source is CLK12 */
924
925#define CMXFCR_TF1CS_BRG5 0x00000000 /* Transmit FCC1 Clock Source is BRG5 */
926#define CMXFCR_TF1CS_BRG6 0x01000000 /* Transmit FCC1 Clock Source is BRG6 */
927#define CMXFCR_TF1CS_BRG7 0x02000000 /* Transmit FCC1 Clock Source is BRG7 */
928#define CMXFCR_TF1CS_BRG8 0x03000000 /* Transmit FCC1 Clock Source is BRG8 */
929#define CMXFCR_TF1CS_CLK9 0x04000000 /* Transmit FCC1 Clock Source is CLK9 */
930#define CMXFCR_TF1CS_CLK10 0x05000000 /* Transmit FCC1 Clock Source is CLK10 */
931#define CMXFCR_TF1CS_CLK11 0x06000000 /* Transmit FCC1 Clock Source is CLK11 */
932#define CMXFCR_TF1CS_CLK12 0x07000000 /* Transmit FCC1 Clock Source is CLK12 */
933
934#define CMXFCR_RF2CS_BRG5 0x00000000 /* Receive FCC2 Clock Source is BRG5 */
935#define CMXFCR_RF2CS_BRG6 0x00080000 /* Receive FCC2 Clock Source is BRG6 */
936#define CMXFCR_RF2CS_BRG7 0x00100000 /* Receive FCC2 Clock Source is BRG7 */
937#define CMXFCR_RF2CS_BRG8 0x00180000 /* Receive FCC2 Clock Source is BRG8 */
938#define CMXFCR_RF2CS_CLK13 0x00200000 /* Receive FCC2 Clock Source is CLK13 */
939#define CMXFCR_RF2CS_CLK14 0x00280000 /* Receive FCC2 Clock Source is CLK14 */
940#define CMXFCR_RF2CS_CLK15 0x00300000 /* Receive FCC2 Clock Source is CLK15 */
941#define CMXFCR_RF2CS_CLK16 0x00380000 /* Receive FCC2 Clock Source is CLK16 */
942
943#define CMXFCR_TF2CS_BRG5 0x00000000 /* Transmit FCC2 Clock Source is BRG5 */
944#define CMXFCR_TF2CS_BRG6 0x00010000 /* Transmit FCC2 Clock Source is BRG6 */
945#define CMXFCR_TF2CS_BRG7 0x00020000 /* Transmit FCC2 Clock Source is BRG7 */
946#define CMXFCR_TF2CS_BRG8 0x00030000 /* Transmit FCC2 Clock Source is BRG8 */
947#define CMXFCR_TF2CS_CLK13 0x00040000 /* Transmit FCC2 Clock Source is CLK13 */
948#define CMXFCR_TF2CS_CLK14 0x00050000 /* Transmit FCC2 Clock Source is CLK14 */
949#define CMXFCR_TF2CS_CLK15 0x00060000 /* Transmit FCC2 Clock Source is CLK15 */
950#define CMXFCR_TF2CS_CLK16 0x00070000 /* Transmit FCC2 Clock Source is CLK16 */
951
952#define CMXFCR_RF3CS_BRG5 0x00000000 /* Receive FCC3 Clock Source is BRG5 */
953#define CMXFCR_RF3CS_BRG6 0x00000800 /* Receive FCC3 Clock Source is BRG6 */
954#define CMXFCR_RF3CS_BRG7 0x00001000 /* Receive FCC3 Clock Source is BRG7 */
955#define CMXFCR_RF3CS_BRG8 0x00001800 /* Receive FCC3 Clock Source is BRG8 */
956#define CMXFCR_RF3CS_CLK13 0x00002000 /* Receive FCC3 Clock Source is CLK13 */
957#define CMXFCR_RF3CS_CLK14 0x00002800 /* Receive FCC3 Clock Source is CLK14 */
958#define CMXFCR_RF3CS_CLK15 0x00003000 /* Receive FCC3 Clock Source is CLK15 */
959#define CMXFCR_RF3CS_CLK16 0x00003800 /* Receive FCC3 Clock Source is CLK16 */
960
961#define CMXFCR_TF3CS_BRG5 0x00000000 /* Transmit FCC3 Clock Source is BRG5 */
962#define CMXFCR_TF3CS_BRG6 0x00000100 /* Transmit FCC3 Clock Source is BRG6 */
963#define CMXFCR_TF3CS_BRG7 0x00000200 /* Transmit FCC3 Clock Source is BRG7 */
964#define CMXFCR_TF3CS_BRG8 0x00000300 /* Transmit FCC3 Clock Source is BRG8 */
965#define CMXFCR_TF3CS_CLK13 0x00000400 /* Transmit FCC3 Clock Source is CLK13 */
966#define CMXFCR_TF3CS_CLK14 0x00000500 /* Transmit FCC3 Clock Source is CLK14 */
967#define CMXFCR_TF3CS_CLK15 0x00000600 /* Transmit FCC3 Clock Source is CLK15 */
968#define CMXFCR_TF3CS_CLK16 0x00000700 /* Transmit FCC3 Clock Source is CLK16 */
969
970/*-----------------------------------------------------------------------
971 * CMXSCR - CMX SCC Clock Route Register
972 */
973#define CMXSCR_GR1 0x80000000 /* Grant Support of SCC1 */
974#define CMXSCR_SC1 0x40000000 /* SCC1 connection */
975#define CMXSCR_RS1CS_MSK 0x38000000 /* Receive SCC1 Clock Source Mask */
976#define CMXSCR_TS1CS_MSK 0x07000000 /* Transmit SCC1 Clock Source Mask */
977#define CMXSCR_GR2 0x00800000 /* Grant Support of SCC2 */
978#define CMXSCR_SC2 0x00400000 /* SCC2 connection */
979#define CMXSCR_RS2CS_MSK 0x00380000 /* Receive SCC2 Clock Source Mask */
980#define CMXSCR_TS2CS_MSK 0x00070000 /* Transmit SCC2 Clock Source Mask */
981#define CMXSCR_GR3 0x00008000 /* Grant Support of SCC3 */
982#define CMXSCR_SC3 0x00004000 /* SCC3 connection */
983#define CMXSCR_RS3CS_MSK 0x00003800 /* Receive SCC3 Clock Source Mask */
984#define CMXSCR_TS3CS_MSK 0x00000700 /* Transmit SCC3 Clock Source Mask */
985#define CMXSCR_GR4 0x00000080 /* Grant Support of SCC4 */
986#define CMXSCR_SC4 0x00000040 /* SCC4 connection */
987#define CMXSCR_RS4CS_MSK 0x00000038 /* Receive SCC4 Clock Source Mask */
988#define CMXSCR_TS4CS_MSK 0x00000007 /* Transmit SCC4 Clock Source Mask */
989
990#define CMXSCR_RS1CS_BRG1 0x00000000 /* SCC1 Rx Clock Source is BRG1 */
991#define CMXSCR_RS1CS_BRG2 0x08000000 /* SCC1 Rx Clock Source is BRG2 */
992#define CMXSCR_RS1CS_BRG3 0x10000000 /* SCC1 Rx Clock Source is BRG3 */
993#define CMXSCR_RS1CS_BRG4 0x18000000 /* SCC1 Rx Clock Source is BRG4 */
994#define CMXSCR_RS1CS_CLK11 0x20000000 /* SCC1 Rx Clock Source is CLK11 */
995#define CMXSCR_RS1CS_CLK12 0x28000000 /* SCC1 Rx Clock Source is CLK12 */
996#define CMXSCR_RS1CS_CLK3 0x30000000 /* SCC1 Rx Clock Source is CLK3 */
997#define CMXSCR_RS1CS_CLK4 0x38000000 /* SCC1 Rx Clock Source is CLK4 */
998
999#define CMXSCR_TS1CS_BRG1 0x00000000 /* SCC1 Tx Clock Source is BRG1 */
1000#define CMXSCR_TS1CS_BRG2 0x01000000 /* SCC1 Tx Clock Source is BRG2 */
1001#define CMXSCR_TS1CS_BRG3 0x02000000 /* SCC1 Tx Clock Source is BRG3 */
1002#define CMXSCR_TS1CS_BRG4 0x03000000 /* SCC1 Tx Clock Source is BRG4 */
1003#define CMXSCR_TS1CS_CLK11 0x04000000 /* SCC1 Tx Clock Source is CLK11 */
1004#define CMXSCR_TS1CS_CLK12 0x05000000 /* SCC1 Tx Clock Source is CLK12 */
1005#define CMXSCR_TS1CS_CLK3 0x06000000 /* SCC1 Tx Clock Source is CLK3 */
1006#define CMXSCR_TS1CS_CLK4 0x07000000 /* SCC1 Tx Clock Source is CLK4 */
1007
1008#define CMXSCR_RS2CS_BRG1 0x00000000 /* SCC2 Rx Clock Source is BRG1 */
1009#define CMXSCR_RS2CS_BRG2 0x00080000 /* SCC2 Rx Clock Source is BRG2 */
1010#define CMXSCR_RS2CS_BRG3 0x00100000 /* SCC2 Rx Clock Source is BRG3 */
1011#define CMXSCR_RS2CS_BRG4 0x00180000 /* SCC2 Rx Clock Source is BRG4 */
1012#define CMXSCR_RS2CS_CLK11 0x00200000 /* SCC2 Rx Clock Source is CLK11 */
1013#define CMXSCR_RS2CS_CLK12 0x00280000 /* SCC2 Rx Clock Source is CLK12 */
1014#define CMXSCR_RS2CS_CLK3 0x00300000 /* SCC2 Rx Clock Source is CLK3 */
1015#define CMXSCR_RS2CS_CLK4 0x00380000 /* SCC2 Rx Clock Source is CLK4 */
1016
1017#define CMXSCR_TS2CS_BRG1 0x00000000 /* SCC2 Tx Clock Source is BRG1 */
1018#define CMXSCR_TS2CS_BRG2 0x00010000 /* SCC2 Tx Clock Source is BRG2 */
1019#define CMXSCR_TS2CS_BRG3 0x00020000 /* SCC2 Tx Clock Source is BRG3 */
1020#define CMXSCR_TS2CS_BRG4 0x00030000 /* SCC2 Tx Clock Source is BRG4 */
1021#define CMXSCR_TS2CS_CLK11 0x00040000 /* SCC2 Tx Clock Source is CLK11 */
1022#define CMXSCR_TS2CS_CLK12 0x00050000 /* SCC2 Tx Clock Source is CLK12 */
1023#define CMXSCR_TS2CS_CLK3 0x00060000 /* SCC2 Tx Clock Source is CLK3 */
1024#define CMXSCR_TS2CS_CLK4 0x00070000 /* SCC2 Tx Clock Source is CLK4 */
1025
1026#define CMXSCR_RS3CS_BRG1 0x00000000 /* SCC3 Rx Clock Source is BRG1 */
1027#define CMXSCR_RS3CS_BRG2 0x00000800 /* SCC3 Rx Clock Source is BRG2 */
1028#define CMXSCR_RS3CS_BRG3 0x00001000 /* SCC3 Rx Clock Source is BRG3 */
1029#define CMXSCR_RS3CS_BRG4 0x00001800 /* SCC3 Rx Clock Source is BRG4 */
1030#define CMXSCR_RS3CS_CLK5 0x00002000 /* SCC3 Rx Clock Source is CLK5 */
1031#define CMXSCR_RS3CS_CLK6 0x00002800 /* SCC3 Rx Clock Source is CLK6 */
1032#define CMXSCR_RS3CS_CLK7 0x00003000 /* SCC3 Rx Clock Source is CLK7 */
1033#define CMXSCR_RS3CS_CLK8 0x00003800 /* SCC3 Rx Clock Source is CLK8 */
1034
1035#define CMXSCR_TS3CS_BRG1 0x00000000 /* SCC3 Tx Clock Source is BRG1 */
1036#define CMXSCR_TS3CS_BRG2 0x00000100 /* SCC3 Tx Clock Source is BRG2 */
1037#define CMXSCR_TS3CS_BRG3 0x00000200 /* SCC3 Tx Clock Source is BRG3 */
1038#define CMXSCR_TS3CS_BRG4 0x00000300 /* SCC3 Tx Clock Source is BRG4 */
1039#define CMXSCR_TS3CS_CLK5 0x00000400 /* SCC3 Tx Clock Source is CLK5 */
1040#define CMXSCR_TS3CS_CLK6 0x00000500 /* SCC3 Tx Clock Source is CLK6 */
1041#define CMXSCR_TS3CS_CLK7 0x00000600 /* SCC3 Tx Clock Source is CLK7 */
1042#define CMXSCR_TS3CS_CLK8 0x00000700 /* SCC3 Tx Clock Source is CLK8 */
1043
1044#define CMXSCR_RS4CS_BRG1 0x00000000 /* SCC4 Rx Clock Source is BRG1 */
1045#define CMXSCR_RS4CS_BRG2 0x00000008 /* SCC4 Rx Clock Source is BRG2 */
1046#define CMXSCR_RS4CS_BRG3 0x00000010 /* SCC4 Rx Clock Source is BRG3 */
1047#define CMXSCR_RS4CS_BRG4 0x00000018 /* SCC4 Rx Clock Source is BRG4 */
1048#define CMXSCR_RS4CS_CLK5 0x00000020 /* SCC4 Rx Clock Source is CLK5 */
1049#define CMXSCR_RS4CS_CLK6 0x00000028 /* SCC4 Rx Clock Source is CLK6 */
1050#define CMXSCR_RS4CS_CLK7 0x00000030 /* SCC4 Rx Clock Source is CLK7 */
1051#define CMXSCR_RS4CS_CLK8 0x00000038 /* SCC4 Rx Clock Source is CLK8 */
1052
1053#define CMXSCR_TS4CS_BRG1 0x00000000 /* SCC4 Tx Clock Source is BRG1 */
1054#define CMXSCR_TS4CS_BRG2 0x00000001 /* SCC4 Tx Clock Source is BRG2 */
1055#define CMXSCR_TS4CS_BRG3 0x00000002 /* SCC4 Tx Clock Source is BRG3 */
1056#define CMXSCR_TS4CS_BRG4 0x00000003 /* SCC4 Tx Clock Source is BRG4 */
1057#define CMXSCR_TS4CS_CLK5 0x00000004 /* SCC4 Tx Clock Source is CLK5 */
1058#define CMXSCR_TS4CS_CLK6 0x00000005 /* SCC4 Tx Clock Source is CLK6 */
1059#define CMXSCR_TS4CS_CLK7 0x00000006 /* SCC4 Tx Clock Source is CLK7 */
1060#define CMXSCR_TS4CS_CLK8 0x00000007 /* SCC4 Tx Clock Source is CLK8 */
1061
1062/*-----------------------------------------------------------------------
1063 * SIUMCR - SIU Module Configuration Register 4-31
1064 */
1065#define SIUMCR_BBD 0x80000000 /* Bus Busy Disable */
1066#define SIUMCR_ESE 0x40000000 /* External Snoop Enable */
1067#define SIUMCR_PBSE 0x20000000 /* Parity Byte Select Enable */
1068#define SIUMCR_CDIS 0x10000000 /* Core Disable */
1069#define SIUMCR_DPPC00 0x00000000 /* Data Parity Pins Configuration*/
1070#define SIUMCR_DPPC01 0x04000000 /* - " - */
1071#define SIUMCR_DPPC10 0x08000000 /* - " - */
1072#define SIUMCR_DPPC11 0x0c000000 /* - " - */
1073#define SIUMCR_L2CPC00 0x00000000 /* L2 Cache Pins Configuration */
1074#define SIUMCR_L2CPC01 0x01000000 /* - " - */
1075#define SIUMCR_L2CPC10 0x02000000 /* - " - */
1076#define SIUMCR_L2CPC11 0x03000000 /* - " - */
1077#define SIUMCR_LBPC00 0x00000000 /* Local Bus Pins Configuration */
1078#define SIUMCR_LBPC01 0x00400000 /* - " - */
1079#define SIUMCR_LBPC10 0x00800000 /* - " - */
1080#define SIUMCR_LBPC11 0x00c00000 /* - " - */
1081#define SIUMCR_APPC00 0x00000000 /* Address Parity Pins Configuration*/
1082#define SIUMCR_APPC01 0x00100000 /* - " - */
1083#define SIUMCR_APPC10 0x00200000 /* - " - */
1084#define SIUMCR_APPC11 0x00300000 /* - " - */
1085#define SIUMCR_CS10PC00 0x00000000 /* CS10 Pin Configuration */
1086#define SIUMCR_CS10PC01 0x00040000 /* - " - */
1087#define SIUMCR_CS10PC10 0x00080000 /* - " - */
1088#define SIUMCR_CS10PC11 0x000c0000 /* - " - */
1089#define SIUMCR_BCTLC00 0x00000000 /* Buffer Control Configuration */
1090#define SIUMCR_BCTLC01 0x00010000 /* - " - */
1091#define SIUMCR_BCTLC10 0x00020000 /* - " - */
1092#define SIUMCR_BCTLC11 0x00030000 /* - " - */
1093#define SIUMCR_MMR00 0x00000000 /* Mask Masters Requests */
1094#define SIUMCR_MMR01 0x00004000 /* - " - */
1095#define SIUMCR_MMR10 0x00008000 /* - " - */
1096#define SIUMCR_MMR11 0x0000c000 /* - " - */
1097#define SIUMCR_LPBSE 0x00002000 /* LocalBus Parity Byte Select Enable*/
1098
1099/*-----------------------------------------------------------------------
1100 * SCCR - System Clock Control Register 9-8
1101*/
1102#define SCCR_PCI_MODE 0x00000100 /* PCI Mode */
1103#define SCCR_PCI_MODCK 0x00000080 /* Value of PCI_MODCK pin */
1104#define SCCR_PCIDF_MSK 0x00000078 /* PCI division factor */
1105#define SCCR_PCIDF_SHIFT 3
1106
1107#ifndef CPM_IMMR_OFFSET
1108#define CPM_IMMR_OFFSET 0x101a8
1109#endif
1110
1111#define FCC_PSMR_RMII ((uint)0x00020000) /* Use RMII interface */
1112
1113/* FCC iop & clock configuration. BSP code is responsible to define Fx_RXCLK & Fx_TXCLK
1114 * in order to use clock-computing stuff below for the FCC x
1115 */
1116
1117/* Automatically generates register configurations */
1118#define PC_CLK(x) ((uint)(1<<(x-1))) /* FCC CLK I/O ports */
1119
1120#define CMXFCR_RF1CS(x) ((uint)((x-5)<<27)) /* FCC1 Receive Clock Source */
1121#define CMXFCR_TF1CS(x) ((uint)((x-5)<<24)) /* FCC1 Transmit Clock Source */
1122#define CMXFCR_RF2CS(x) ((uint)((x-9)<<19)) /* FCC2 Receive Clock Source */
1123#define CMXFCR_TF2CS(x) ((uint)((x-9)<<16)) /* FCC2 Transmit Clock Source */
1124#define CMXFCR_RF3CS(x) ((uint)((x-9)<<11)) /* FCC3 Receive Clock Source */
1125#define CMXFCR_TF3CS(x) ((uint)((x-9)<<8)) /* FCC3 Transmit Clock Source */
1126
1127#define PC_F1RXCLK PC_CLK(F1_RXCLK)
1128#define PC_F1TXCLK PC_CLK(F1_TXCLK)
1129#define CMX1_CLK_ROUTE (CMXFCR_RF1CS(F1_RXCLK) | CMXFCR_TF1CS(F1_TXCLK))
1130#define CMX1_CLK_MASK ((uint)0xff000000)
1131
1132#define PC_F2RXCLK PC_CLK(F2_RXCLK)
1133#define PC_F2TXCLK PC_CLK(F2_TXCLK)
1134#define CMX2_CLK_ROUTE (CMXFCR_RF2CS(F2_RXCLK) | CMXFCR_TF2CS(F2_TXCLK))
1135#define CMX2_CLK_MASK ((uint)0x00ff0000)
1136
1137#define PC_F3RXCLK PC_CLK(F3_RXCLK)
1138#define PC_F3TXCLK PC_CLK(F3_TXCLK)
1139#define CMX3_CLK_ROUTE (CMXFCR_RF3CS(F3_RXCLK) | CMXFCR_TF3CS(F3_TXCLK))
1140#define CMX3_CLK_MASK ((uint)0x0000ff00)
1141
1142#define CPMUX_CLK_MASK (CMX3_CLK_MASK | CMX2_CLK_MASK)
1143#define CPMUX_CLK_ROUTE (CMX3_CLK_ROUTE | CMX2_CLK_ROUTE)
1144
1145#define CLK_TRX (PC_F3TXCLK | PC_F3RXCLK | PC_F2TXCLK | PC_F2RXCLK)
1146
1147/* I/O Pin assignment for FCC1. I don't yet know the best way to do this,
1148 * but there is little variation among the choices.
1149 */
1150#define PA1_COL 0x00000001U
1151#define PA1_CRS 0x00000002U
1152#define PA1_TXER 0x00000004U
1153#define PA1_TXEN 0x00000008U
1154#define PA1_RXDV 0x00000010U
1155#define PA1_RXER 0x00000020U
1156#define PA1_TXDAT 0x00003c00U
1157#define PA1_RXDAT 0x0003c000U
1158#define PA1_PSORA0 (PA1_RXDAT | PA1_TXDAT)
1159#define PA1_PSORA1 (PA1_COL | PA1_CRS | PA1_TXER | PA1_TXEN | \
1160 PA1_RXDV | PA1_RXER)
1161#define PA1_DIRA0 (PA1_RXDAT | PA1_CRS | PA1_COL | PA1_RXER | PA1_RXDV)
1162#define PA1_DIRA1 (PA1_TXDAT | PA1_TXEN | PA1_TXER)
1163
1164
1165/* I/O Pin assignment for FCC2. I don't yet know the best way to do this,
1166 * but there is little variation among the choices.
1167 */
1168#define PB2_TXER 0x00000001U
1169#define PB2_RXDV 0x00000002U
1170#define PB2_TXEN 0x00000004U
1171#define PB2_RXER 0x00000008U
1172#define PB2_COL 0x00000010U
1173#define PB2_CRS 0x00000020U
1174#define PB2_TXDAT 0x000003c0U
1175#define PB2_RXDAT 0x00003c00U
1176#define PB2_PSORB0 (PB2_RXDAT | PB2_TXDAT | PB2_CRS | PB2_COL | \
1177 PB2_RXER | PB2_RXDV | PB2_TXER)
1178#define PB2_PSORB1 (PB2_TXEN)
1179#define PB2_DIRB0 (PB2_RXDAT | PB2_CRS | PB2_COL | PB2_RXER | PB2_RXDV)
1180#define PB2_DIRB1 (PB2_TXDAT | PB2_TXEN | PB2_TXER)
1181
1182
1183/* I/O Pin assignment for FCC3. I don't yet know the best way to do this,
1184 * but there is little variation among the choices.
1185 */
1186#define PB3_RXDV 0x00004000U
1187#define PB3_RXER 0x00008000U
1188#define PB3_TXER 0x00010000U
1189#define PB3_TXEN 0x00020000U
1190#define PB3_COL 0x00040000U
1191#define PB3_CRS 0x00080000U
1192#define PB3_TXDAT 0x0f000000U
1193#define PC3_TXDAT 0x00000010U
1194#define PB3_RXDAT 0x00f00000U
1195#define PB3_PSORB0 (PB3_RXDAT | PB3_TXDAT | PB3_CRS | PB3_COL | \
1196 PB3_RXER | PB3_RXDV | PB3_TXER | PB3_TXEN)
1197#define PB3_PSORB1 0
1198#define PB3_DIRB0 (PB3_RXDAT | PB3_CRS | PB3_COL | PB3_RXER | PB3_RXDV)
1199#define PB3_DIRB1 (PB3_TXDAT | PB3_TXEN | PB3_TXER)
1200#define PC3_DIRC1 (PC3_TXDAT)
1201
1202/* Handy macro to specify mem for FCCs*/
1203#define FCC_MEM_OFFSET(x) (CPM_FCC_SPECIAL_BASE + (x*128))
1204#define FCC1_MEM_OFFSET FCC_MEM_OFFSET(0)
1205#define FCC2_MEM_OFFSET FCC_MEM_OFFSET(1)
1206#define FCC3_MEM_OFFSET FCC_MEM_OFFSET(2)
1207
1208/* Clocks and GRG's */
1209
1210enum cpm_clk_dir {
1211 CPM_CLK_RX,
1212 CPM_CLK_TX,
1213 CPM_CLK_RTX
1214};
1215
1216enum cpm_clk_target {
1217 CPM_CLK_SCC1,
1218 CPM_CLK_SCC2,
1219 CPM_CLK_SCC3,
1220 CPM_CLK_SCC4,
1221 CPM_CLK_FCC1,
1222 CPM_CLK_FCC2,
1223 CPM_CLK_FCC3,
1224 CPM_CLK_SMC1,
1225 CPM_CLK_SMC2,
1226};
1227
1228enum cpm_clk {
1229 CPM_CLK_NONE = 0,
1230 CPM_BRG1, /* Baud Rate Generator 1 */
1231 CPM_BRG2, /* Baud Rate Generator 2 */
1232 CPM_BRG3, /* Baud Rate Generator 3 */
1233 CPM_BRG4, /* Baud Rate Generator 4 */
1234 CPM_BRG5, /* Baud Rate Generator 5 */
1235 CPM_BRG6, /* Baud Rate Generator 6 */
1236 CPM_BRG7, /* Baud Rate Generator 7 */
1237 CPM_BRG8, /* Baud Rate Generator 8 */
1238 CPM_CLK1, /* Clock 1 */
1239 CPM_CLK2, /* Clock 2 */
1240 CPM_CLK3, /* Clock 3 */
1241 CPM_CLK4, /* Clock 4 */
1242 CPM_CLK5, /* Clock 5 */
1243 CPM_CLK6, /* Clock 6 */
1244 CPM_CLK7, /* Clock 7 */
1245 CPM_CLK8, /* Clock 8 */
1246 CPM_CLK9, /* Clock 9 */
1247 CPM_CLK10, /* Clock 10 */
1248 CPM_CLK11, /* Clock 11 */
1249 CPM_CLK12, /* Clock 12 */
1250 CPM_CLK13, /* Clock 13 */
1251 CPM_CLK14, /* Clock 14 */
1252 CPM_CLK15, /* Clock 15 */
1253 CPM_CLK16, /* Clock 16 */
1254 CPM_CLK17, /* Clock 17 */
1255 CPM_CLK18, /* Clock 18 */
1256 CPM_CLK19, /* Clock 19 */
1257 CPM_CLK20, /* Clock 20 */
1258 CPM_CLK_DUMMY
1259};
1260
1261extern int cpm2_clk_setup(enum cpm_clk_target target, int clock, int mode);
1262extern int cpm2_smc_clk_setup(enum cpm_clk_target target, int clock);
1263
1264#define CPM_PIN_INPUT 0
1265#define CPM_PIN_OUTPUT 1
1266#define CPM_PIN_PRIMARY 0
1267#define CPM_PIN_SECONDARY 2
1268#define CPM_PIN_GPIO 4
1269#define CPM_PIN_OPENDRAIN 8
1270
1271void cpm2_set_pin(int port, int pin, int flags);
1272
1273#endif /* __CPM2__ */
1274#endif /* __KERNEL__ */
diff --git a/include/asm-powerpc/cputable.h b/include/asm-powerpc/cputable.h
index 3dc8e2dfca84..ae093ef68363 100644
--- a/include/asm-powerpc/cputable.h
+++ b/include/asm-powerpc/cputable.h
@@ -57,6 +57,7 @@ enum powerpc_pmc_type {
57 PPC_PMC_PA6T = 2, 57 PPC_PMC_PA6T = 2,
58}; 58};
59 59
60/* NOTE WELL: Update identify_cpu() if fields are added or removed! */
60struct cpu_spec { 61struct cpu_spec {
61 /* CPU is matched via (PVR & pvr_mask) == pvr_value */ 62 /* CPU is matched via (PVR & pvr_mask) == pvr_value */
62 unsigned int pvr_mask; 63 unsigned int pvr_mask;
@@ -136,6 +137,7 @@ extern void do_feature_fixups(unsigned long value, void *fixup_start,
136#define CPU_FTR_REAL_LE ASM_CONST(0x0000000000400000) 137#define CPU_FTR_REAL_LE ASM_CONST(0x0000000000400000)
137#define CPU_FTR_FPU_UNAVAILABLE ASM_CONST(0x0000000000800000) 138#define CPU_FTR_FPU_UNAVAILABLE ASM_CONST(0x0000000000800000)
138#define CPU_FTR_UNIFIED_ID_CACHE ASM_CONST(0x0000000001000000) 139#define CPU_FTR_UNIFIED_ID_CACHE ASM_CONST(0x0000000001000000)
140#define CPU_FTR_SPE ASM_CONST(0x0000000002000000)
139 141
140/* 142/*
141 * Add the 64-bit processor unique features in the top half of the word; 143 * Add the 64-bit processor unique features in the top half of the word;
@@ -162,6 +164,7 @@ extern void do_feature_fixups(unsigned long value, void *fixup_start,
162#define CPU_FTR_CELL_TB_BUG LONG_ASM_CONST(0x0000800000000000) 164#define CPU_FTR_CELL_TB_BUG LONG_ASM_CONST(0x0000800000000000)
163#define CPU_FTR_SPURR LONG_ASM_CONST(0x0001000000000000) 165#define CPU_FTR_SPURR LONG_ASM_CONST(0x0001000000000000)
164#define CPU_FTR_DSCR LONG_ASM_CONST(0x0002000000000000) 166#define CPU_FTR_DSCR LONG_ASM_CONST(0x0002000000000000)
167#define CPU_FTR_1T_SEGMENT LONG_ASM_CONST(0x0004000000000000)
165 168
166#ifndef __ASSEMBLY__ 169#ifndef __ASSEMBLY__
167 170
@@ -180,12 +183,27 @@ extern void do_feature_fixups(unsigned long value, void *fixup_start,
180#define PPC_FEATURE_HAS_ALTIVEC_COMP 0 183#define PPC_FEATURE_HAS_ALTIVEC_COMP 0
181#endif 184#endif
182 185
183/* We need to mark all pages as being coherent if we're SMP or we 186/* We only set the spe features if the kernel was compiled with spe
184 * have a 74[45]x and an MPC107 host bridge. Also 83xx requires 187 * support
185 * it for PCI "streaming/prefetch" to work properly. 188 */
189#ifdef CONFIG_SPE
190#define CPU_FTR_SPE_COMP CPU_FTR_SPE
191#define PPC_FEATURE_HAS_SPE_COMP PPC_FEATURE_HAS_SPE
192#define PPC_FEATURE_HAS_EFP_SINGLE_COMP PPC_FEATURE_HAS_EFP_SINGLE
193#define PPC_FEATURE_HAS_EFP_DOUBLE_COMP PPC_FEATURE_HAS_EFP_DOUBLE
194#else
195#define CPU_FTR_SPE_COMP 0
196#define PPC_FEATURE_HAS_SPE_COMP 0
197#define PPC_FEATURE_HAS_EFP_SINGLE_COMP 0
198#define PPC_FEATURE_HAS_EFP_DOUBLE_COMP 0
199#endif
200
201/* We need to mark all pages as being coherent if we're SMP or we have a
202 * 74[45]x and an MPC107 host bridge. Also 83xx and PowerQUICC II
203 * require it for PCI "streaming/prefetch" to work properly.
186 */ 204 */
187#if defined(CONFIG_SMP) || defined(CONFIG_MPC10X_BRIDGE) \ 205#if defined(CONFIG_SMP) || defined(CONFIG_MPC10X_BRIDGE) \
188 || defined(CONFIG_PPC_83xx) 206 || defined(CONFIG_PPC_83xx) || defined(CONFIG_8260)
189#define CPU_FTR_COMMON CPU_FTR_NEED_COHERENT 207#define CPU_FTR_COMMON CPU_FTR_NEED_COHERENT
190#else 208#else
191#define CPU_FTR_COMMON 0 209#define CPU_FTR_COMMON 0
@@ -297,7 +315,7 @@ extern void do_feature_fixups(unsigned long value, void *fixup_start,
297 CPU_FTR_PPC_LE) 315 CPU_FTR_PPC_LE)
298#define CPU_FTRS_82XX (CPU_FTR_COMMON | \ 316#define CPU_FTRS_82XX (CPU_FTR_COMMON | \
299 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB) 317 CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB)
300#define CPU_FTRS_G2_LE (CPU_FTR_MAYBE_CAN_DOZE | \ 318#define CPU_FTRS_G2_LE (CPU_FTR_COMMON | CPU_FTR_MAYBE_CAN_DOZE | \
301 CPU_FTR_USE_TB | CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_HAS_HIGH_BATS) 319 CPU_FTR_USE_TB | CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_HAS_HIGH_BATS)
302#define CPU_FTRS_E300 (CPU_FTR_MAYBE_CAN_DOZE | \ 320#define CPU_FTRS_E300 (CPU_FTR_MAYBE_CAN_DOZE | \
303 CPU_FTR_USE_TB | CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_HAS_HIGH_BATS | \ 321 CPU_FTR_USE_TB | CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_HAS_HIGH_BATS | \
@@ -310,10 +328,12 @@ extern void do_feature_fixups(unsigned long value, void *fixup_start,
310#define CPU_FTRS_8XX (CPU_FTR_USE_TB) 328#define CPU_FTRS_8XX (CPU_FTR_USE_TB)
311#define CPU_FTRS_40X (CPU_FTR_USE_TB | CPU_FTR_NODSISRALIGN) 329#define CPU_FTRS_40X (CPU_FTR_USE_TB | CPU_FTR_NODSISRALIGN)
312#define CPU_FTRS_44X (CPU_FTR_USE_TB | CPU_FTR_NODSISRALIGN) 330#define CPU_FTRS_44X (CPU_FTR_USE_TB | CPU_FTR_NODSISRALIGN)
313#define CPU_FTRS_E200 (CPU_FTR_USE_TB | CPU_FTR_NODSISRALIGN | \ 331#define CPU_FTRS_E200 (CPU_FTR_USE_TB | CPU_FTR_SPE_COMP | \
314 CPU_FTR_COHERENT_ICACHE | CPU_FTR_UNIFIED_ID_CACHE) 332 CPU_FTR_NODSISRALIGN | CPU_FTR_COHERENT_ICACHE | \
315#define CPU_FTRS_E500 (CPU_FTR_USE_TB | CPU_FTR_NODSISRALIGN) 333 CPU_FTR_UNIFIED_ID_CACHE)
316#define CPU_FTRS_E500_2 (CPU_FTR_USE_TB | \ 334#define CPU_FTRS_E500 (CPU_FTR_USE_TB | CPU_FTR_SPE_COMP | \
335 CPU_FTR_NODSISRALIGN)
336#define CPU_FTRS_E500_2 (CPU_FTR_USE_TB | CPU_FTR_SPE_COMP | \
317 CPU_FTR_BIG_PHYS | CPU_FTR_NODSISRALIGN) 337 CPU_FTR_BIG_PHYS | CPU_FTR_NODSISRALIGN)
318#define CPU_FTRS_GENERIC_32 (CPU_FTR_COMMON | CPU_FTR_NODSISRALIGN) 338#define CPU_FTRS_GENERIC_32 (CPU_FTR_COMMON | CPU_FTR_NODSISRALIGN)
319 339
@@ -355,7 +375,7 @@ extern void do_feature_fixups(unsigned long value, void *fixup_start,
355#define CPU_FTRS_POSSIBLE \ 375#define CPU_FTRS_POSSIBLE \
356 (CPU_FTRS_POWER3 | CPU_FTRS_RS64 | CPU_FTRS_POWER4 | \ 376 (CPU_FTRS_POWER3 | CPU_FTRS_RS64 | CPU_FTRS_POWER4 | \
357 CPU_FTRS_PPC970 | CPU_FTRS_POWER5 | CPU_FTRS_POWER6 | \ 377 CPU_FTRS_PPC970 | CPU_FTRS_POWER5 | CPU_FTRS_POWER6 | \
358 CPU_FTRS_CELL | CPU_FTRS_PA6T) 378 CPU_FTRS_CELL | CPU_FTRS_PA6T | CPU_FTR_1T_SEGMENT)
359#else 379#else
360enum { 380enum {
361 CPU_FTRS_POSSIBLE = 381 CPU_FTRS_POSSIBLE =
diff --git a/include/asm-powerpc/dcr-mmio.h b/include/asm-powerpc/dcr-mmio.h
index 5dbfca8dde36..6b82c3ba495a 100644
--- a/include/asm-powerpc/dcr-mmio.h
+++ b/include/asm-powerpc/dcr-mmio.h
@@ -23,7 +23,11 @@
23 23
24#include <asm/io.h> 24#include <asm/io.h>
25 25
26typedef struct { void __iomem *token; unsigned int stride; } dcr_host_t; 26typedef struct {
27 void __iomem *token;
28 unsigned int stride;
29 unsigned int base;
30} dcr_host_t;
27 31
28#define DCR_MAP_OK(host) ((host).token != NULL) 32#define DCR_MAP_OK(host) ((host).token != NULL)
29 33
diff --git a/include/asm-powerpc/dcr-native.h b/include/asm-powerpc/dcr-native.h
index 05af081222f6..f41058c0f6cb 100644
--- a/include/asm-powerpc/dcr-native.h
+++ b/include/asm-powerpc/dcr-native.h
@@ -22,11 +22,13 @@
22#ifdef __KERNEL__ 22#ifdef __KERNEL__
23#ifndef __ASSEMBLY__ 23#ifndef __ASSEMBLY__
24 24
25typedef struct {} dcr_host_t; 25typedef struct {
26 unsigned int base;
27} dcr_host_t;
26 28
27#define DCR_MAP_OK(host) (1) 29#define DCR_MAP_OK(host) (1)
28 30
29#define dcr_map(dev, dcr_n, dcr_c) ((dcr_host_t){}) 31#define dcr_map(dev, dcr_n, dcr_c) ((dcr_host_t){ .base = (dcr_n) })
30#define dcr_unmap(host, dcr_n, dcr_c) do {} while (0) 32#define dcr_unmap(host, dcr_n, dcr_c) do {} while (0)
31#define dcr_read(host, dcr_n) mfdcr(dcr_n) 33#define dcr_read(host, dcr_n) mfdcr(dcr_n)
32#define dcr_write(host, dcr_n, value) mtdcr(dcr_n, value) 34#define dcr_write(host, dcr_n, value) mtdcr(dcr_n, value)
diff --git a/include/asm-powerpc/dma-mapping.h b/include/asm-powerpc/dma-mapping.h
index 744d6bb24116..d05891608f74 100644
--- a/include/asm-powerpc/dma-mapping.h
+++ b/include/asm-powerpc/dma-mapping.h
@@ -249,8 +249,12 @@ dma_map_single(struct device *dev, void *ptr, size_t size,
249 return virt_to_bus(ptr); 249 return virt_to_bus(ptr);
250} 250}
251 251
252/* We do nothing. */ 252static inline void dma_unmap_single(struct device *dev, dma_addr_t dma_addr,
253#define dma_unmap_single(dev, addr, size, dir) ((void)0) 253 size_t size,
254 enum dma_data_direction direction)
255{
256 /* We do nothing. */
257}
254 258
255static inline dma_addr_t 259static inline dma_addr_t
256dma_map_page(struct device *dev, struct page *page, 260dma_map_page(struct device *dev, struct page *page,
@@ -264,8 +268,12 @@ dma_map_page(struct device *dev, struct page *page,
264 return page_to_bus(page) + offset; 268 return page_to_bus(page) + offset;
265} 269}
266 270
267/* We do nothing. */ 271static inline void dma_unmap_page(struct device *dev, dma_addr_t dma_address,
268#define dma_unmap_page(dev, handle, size, dir) ((void)0) 272 size_t size,
273 enum dma_data_direction direction)
274{
275 /* We do nothing. */
276}
269 277
270static inline int 278static inline int
271dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, 279dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
@@ -284,8 +292,12 @@ dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
284 return nents; 292 return nents;
285} 293}
286 294
287/* We don't do anything here. */ 295static inline void dma_unmap_sg(struct device *dev, struct scatterlist *sg,
288#define dma_unmap_sg(dev, sg, nents, dir) ((void)0) 296 int nhwentries,
297 enum dma_data_direction direction)
298{
299 /* We don't do anything here. */
300}
289 301
290#endif /* CONFIG_PPC64 */ 302#endif /* CONFIG_PPC64 */
291 303
diff --git a/include/asm-powerpc/elf.h b/include/asm-powerpc/elf.h
index de507995c7b1..e42820d6d25b 100644
--- a/include/asm-powerpc/elf.h
+++ b/include/asm-powerpc/elf.h
@@ -413,13 +413,8 @@ do { \
413/* Notes used in ET_CORE. Note name is "SPU/<fd>/<filename>". */ 413/* Notes used in ET_CORE. Note name is "SPU/<fd>/<filename>". */
414#define NT_SPU 1 414#define NT_SPU 1
415 415
416extern int arch_notes_size(void);
417extern void arch_write_notes(struct file *file);
418
419#define ELF_CORE_EXTRA_NOTES_SIZE arch_notes_size()
420#define ELF_CORE_WRITE_EXTRA_NOTES arch_write_notes(file)
421
422#define ARCH_HAVE_EXTRA_ELF_NOTES 416#define ARCH_HAVE_EXTRA_ELF_NOTES
423#endif /* CONFIG_PPC_CELL */ 417
418#endif /* CONFIG_SPU_BASE */
424 419
425#endif /* _ASM_POWERPC_ELF_H */ 420#endif /* _ASM_POWERPC_ELF_H */
diff --git a/include/asm-powerpc/exception.h b/include/asm-powerpc/exception.h
new file mode 100644
index 000000000000..39abdb02fdef
--- /dev/null
+++ b/include/asm-powerpc/exception.h
@@ -0,0 +1,311 @@
1#ifndef _ASM_POWERPC_EXCEPTION_H
2#define _ASM_POWERPC_EXCEPTION_H
3/*
4 * Extracted from head_64.S
5 *
6 * PowerPC version
7 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
8 *
9 * Rewritten by Cort Dougan (cort@cs.nmt.edu) for PReP
10 * Copyright (C) 1996 Cort Dougan <cort@cs.nmt.edu>
11 * Adapted for Power Macintosh by Paul Mackerras.
12 * Low-level exception handlers and MMU support
13 * rewritten by Paul Mackerras.
14 * Copyright (C) 1996 Paul Mackerras.
15 *
16 * Adapted for 64bit PowerPC by Dave Engebretsen, Peter Bergner, and
17 * Mike Corrigan {engebret|bergner|mikejc}@us.ibm.com
18 *
19 * This file contains the low-level support and setup for the
20 * PowerPC-64 platform, including trap and interrupt dispatch.
21 *
22 * This program is free software; you can redistribute it and/or
23 * modify it under the terms of the GNU General Public License
24 * as published by the Free Software Foundation; either version
25 * 2 of the License, or (at your option) any later version.
26 */
27/*
28 * The following macros define the code that appears as
29 * the prologue to each of the exception handlers. They
30 * are split into two parts to allow a single kernel binary
31 * to be used for pSeries and iSeries.
32 *
33 * We make as much of the exception code common between native
34 * exception handlers (including pSeries LPAR) and iSeries LPAR
35 * implementations as possible.
36 */
37
38#define EX_R9 0
39#define EX_R10 8
40#define EX_R11 16
41#define EX_R12 24
42#define EX_R13 32
43#define EX_SRR0 40
44#define EX_DAR 48
45#define EX_DSISR 56
46#define EX_CCR 60
47#define EX_R3 64
48#define EX_LR 72
49
50/*
51 * We're short on space and time in the exception prolog, so we can't
52 * use the normal SET_REG_IMMEDIATE macro. Normally we just need the
53 * low halfword of the address, but for Kdump we need the whole low
54 * word.
55 */
56#ifdef CONFIG_CRASH_DUMP
57#define LOAD_HANDLER(reg, label) \
58 oris reg,reg,(label)@h; /* virt addr of handler ... */ \
59 ori reg,reg,(label)@l; /* .. and the rest */
60#else
61#define LOAD_HANDLER(reg, label) \
62 ori reg,reg,(label)@l; /* virt addr of handler ... */
63#endif
64
65#define EXCEPTION_PROLOG_1(area) \
66 mfspr r13,SPRN_SPRG3; /* get paca address into r13 */ \
67 std r9,area+EX_R9(r13); /* save r9 - r12 */ \
68 std r10,area+EX_R10(r13); \
69 std r11,area+EX_R11(r13); \
70 std r12,area+EX_R12(r13); \
71 mfspr r9,SPRN_SPRG1; \
72 std r9,area+EX_R13(r13); \
73 mfcr r9
74
75/*
76 * Equal to EXCEPTION_PROLOG_PSERIES, except that it forces 64bit mode.
77 * The firmware calls the registered system_reset_fwnmi and
78 * machine_check_fwnmi handlers in 32bit mode if the cpu happens to run
79 * a 32bit application at the time of the event.
80 * This firmware bug is present on POWER4 and JS20.
81 */
82#define EXCEPTION_PROLOG_PSERIES_FORCE_64BIT(area, label) \
83 EXCEPTION_PROLOG_1(area); \
84 clrrdi r12,r13,32; /* get high part of &label */ \
85 mfmsr r10; \
86 /* force 64bit mode */ \
87 li r11,5; /* MSR_SF_LG|MSR_ISF_LG */ \
88 rldimi r10,r11,61,0; /* insert into top 3 bits */ \
89 /* done 64bit mode */ \
90 mfspr r11,SPRN_SRR0; /* save SRR0 */ \
91 LOAD_HANDLER(r12,label) \
92 ori r10,r10,MSR_IR|MSR_DR|MSR_RI; \
93 mtspr SPRN_SRR0,r12; \
94 mfspr r12,SPRN_SRR1; /* and SRR1 */ \
95 mtspr SPRN_SRR1,r10; \
96 rfid; \
97 b . /* prevent speculative execution */
98
99#define EXCEPTION_PROLOG_PSERIES(area, label) \
100 EXCEPTION_PROLOG_1(area); \
101 clrrdi r12,r13,32; /* get high part of &label */ \
102 mfmsr r10; \
103 mfspr r11,SPRN_SRR0; /* save SRR0 */ \
104 LOAD_HANDLER(r12,label) \
105 ori r10,r10,MSR_IR|MSR_DR|MSR_RI; \
106 mtspr SPRN_SRR0,r12; \
107 mfspr r12,SPRN_SRR1; /* and SRR1 */ \
108 mtspr SPRN_SRR1,r10; \
109 rfid; \
110 b . /* prevent speculative execution */
111
112/*
113 * The common exception prolog is used for all except a few exceptions
114 * such as a segment miss on a kernel address. We have to be prepared
115 * to take another exception from the point where we first touch the
116 * kernel stack onwards.
117 *
118 * On entry r13 points to the paca, r9-r13 are saved in the paca,
119 * r9 contains the saved CR, r11 and r12 contain the saved SRR0 and
120 * SRR1, and relocation is on.
121 */
122#define EXCEPTION_PROLOG_COMMON(n, area) \
123 andi. r10,r12,MSR_PR; /* See if coming from user */ \
124 mr r10,r1; /* Save r1 */ \
125 subi r1,r1,INT_FRAME_SIZE; /* alloc frame on kernel stack */ \
126 beq- 1f; \
127 ld r1,PACAKSAVE(r13); /* kernel stack to use */ \
1281: cmpdi cr1,r1,0; /* check if r1 is in userspace */ \
129 bge- cr1,2f; /* abort if it is */ \
130 b 3f; \
1312: li r1,(n); /* will be reloaded later */ \
132 sth r1,PACA_TRAP_SAVE(r13); \
133 b bad_stack; \
1343: std r9,_CCR(r1); /* save CR in stackframe */ \
135 std r11,_NIP(r1); /* save SRR0 in stackframe */ \
136 std r12,_MSR(r1); /* save SRR1 in stackframe */ \
137 std r10,0(r1); /* make stack chain pointer */ \
138 std r0,GPR0(r1); /* save r0 in stackframe */ \
139 std r10,GPR1(r1); /* save r1 in stackframe */ \
140 ACCOUNT_CPU_USER_ENTRY(r9, r10); \
141 std r2,GPR2(r1); /* save r2 in stackframe */ \
142 SAVE_4GPRS(3, r1); /* save r3 - r6 in stackframe */ \
143 SAVE_2GPRS(7, r1); /* save r7, r8 in stackframe */ \
144 ld r9,area+EX_R9(r13); /* move r9, r10 to stackframe */ \
145 ld r10,area+EX_R10(r13); \
146 std r9,GPR9(r1); \
147 std r10,GPR10(r1); \
148 ld r9,area+EX_R11(r13); /* move r11 - r13 to stackframe */ \
149 ld r10,area+EX_R12(r13); \
150 ld r11,area+EX_R13(r13); \
151 std r9,GPR11(r1); \
152 std r10,GPR12(r1); \
153 std r11,GPR13(r1); \
154 ld r2,PACATOC(r13); /* get kernel TOC into r2 */ \
155 mflr r9; /* save LR in stackframe */ \
156 std r9,_LINK(r1); \
157 mfctr r10; /* save CTR in stackframe */ \
158 std r10,_CTR(r1); \
159 lbz r10,PACASOFTIRQEN(r13); \
160 mfspr r11,SPRN_XER; /* save XER in stackframe */ \
161 std r10,SOFTE(r1); \
162 std r11,_XER(r1); \
163 li r9,(n)+1; \
164 std r9,_TRAP(r1); /* set trap number */ \
165 li r10,0; \
166 ld r11,exception_marker@toc(r2); \
167 std r10,RESULT(r1); /* clear regs->result */ \
168 std r11,STACK_FRAME_OVERHEAD-16(r1); /* mark the frame */
169
170/*
171 * Exception vectors.
172 */
173#define STD_EXCEPTION_PSERIES(n, label) \
174 . = n; \
175 .globl label##_pSeries; \
176label##_pSeries: \
177 HMT_MEDIUM; \
178 mtspr SPRN_SPRG1,r13; /* save r13 */ \
179 EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, label##_common)
180
181#define HSTD_EXCEPTION_PSERIES(n, label) \
182 . = n; \
183 .globl label##_pSeries; \
184label##_pSeries: \
185 HMT_MEDIUM; \
186 mtspr SPRN_SPRG1,r20; /* save r20 */ \
187 mfspr r20,SPRN_HSRR0; /* copy HSRR0 to SRR0 */ \
188 mtspr SPRN_SRR0,r20; \
189 mfspr r20,SPRN_HSRR1; /* copy HSRR0 to SRR0 */ \
190 mtspr SPRN_SRR1,r20; \
191 mfspr r20,SPRN_SPRG1; /* restore r20 */ \
192 mtspr SPRN_SPRG1,r13; /* save r13 */ \
193 EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, label##_common)
194
195
196#define MASKABLE_EXCEPTION_PSERIES(n, label) \
197 . = n; \
198 .globl label##_pSeries; \
199label##_pSeries: \
200 HMT_MEDIUM; \
201 mtspr SPRN_SPRG1,r13; /* save r13 */ \
202 mfspr r13,SPRN_SPRG3; /* get paca address into r13 */ \
203 std r9,PACA_EXGEN+EX_R9(r13); /* save r9, r10 */ \
204 std r10,PACA_EXGEN+EX_R10(r13); \
205 lbz r10,PACASOFTIRQEN(r13); \
206 mfcr r9; \
207 cmpwi r10,0; \
208 beq masked_interrupt; \
209 mfspr r10,SPRN_SPRG1; \
210 std r10,PACA_EXGEN+EX_R13(r13); \
211 std r11,PACA_EXGEN+EX_R11(r13); \
212 std r12,PACA_EXGEN+EX_R12(r13); \
213 clrrdi r12,r13,32; /* get high part of &label */ \
214 mfmsr r10; \
215 mfspr r11,SPRN_SRR0; /* save SRR0 */ \
216 LOAD_HANDLER(r12,label##_common) \
217 ori r10,r10,MSR_IR|MSR_DR|MSR_RI; \
218 mtspr SPRN_SRR0,r12; \
219 mfspr r12,SPRN_SRR1; /* and SRR1 */ \
220 mtspr SPRN_SRR1,r10; \
221 rfid; \
222 b . /* prevent speculative execution */
223
224#ifdef CONFIG_PPC_ISERIES
225#define DISABLE_INTS \
226 li r11,0; \
227 stb r11,PACASOFTIRQEN(r13); \
228BEGIN_FW_FTR_SECTION; \
229 stb r11,PACAHARDIRQEN(r13); \
230END_FW_FTR_SECTION_IFCLR(FW_FEATURE_ISERIES); \
231BEGIN_FW_FTR_SECTION; \
232 mfmsr r10; \
233 ori r10,r10,MSR_EE; \
234 mtmsrd r10,1; \
235END_FW_FTR_SECTION_IFSET(FW_FEATURE_ISERIES)
236
237#else
238#define DISABLE_INTS \
239 li r11,0; \
240 stb r11,PACASOFTIRQEN(r13); \
241 stb r11,PACAHARDIRQEN(r13)
242
243#endif /* CONFIG_PPC_ISERIES */
244
245#define ENABLE_INTS \
246 ld r12,_MSR(r1); \
247 mfmsr r11; \
248 rlwimi r11,r12,0,MSR_EE; \
249 mtmsrd r11,1
250
251#define STD_EXCEPTION_COMMON(trap, label, hdlr) \
252 .align 7; \
253 .globl label##_common; \
254label##_common: \
255 EXCEPTION_PROLOG_COMMON(trap, PACA_EXGEN); \
256 DISABLE_INTS; \
257 bl .save_nvgprs; \
258 addi r3,r1,STACK_FRAME_OVERHEAD; \
259 bl hdlr; \
260 b .ret_from_except
261
262/*
263 * Like STD_EXCEPTION_COMMON, but for exceptions that can occur
264 * in the idle task and therefore need the special idle handling.
265 */
266#define STD_EXCEPTION_COMMON_IDLE(trap, label, hdlr) \
267 .align 7; \
268 .globl label##_common; \
269label##_common: \
270 EXCEPTION_PROLOG_COMMON(trap, PACA_EXGEN); \
271 FINISH_NAP; \
272 DISABLE_INTS; \
273 bl .save_nvgprs; \
274 addi r3,r1,STACK_FRAME_OVERHEAD; \
275 bl hdlr; \
276 b .ret_from_except
277
278#define STD_EXCEPTION_COMMON_LITE(trap, label, hdlr) \
279 .align 7; \
280 .globl label##_common; \
281label##_common: \
282 EXCEPTION_PROLOG_COMMON(trap, PACA_EXGEN); \
283 FINISH_NAP; \
284 DISABLE_INTS; \
285BEGIN_FTR_SECTION \
286 bl .ppc64_runlatch_on; \
287END_FTR_SECTION_IFSET(CPU_FTR_CTRL) \
288 addi r3,r1,STACK_FRAME_OVERHEAD; \
289 bl hdlr; \
290 b .ret_from_except_lite
291
292/*
293 * When the idle code in power4_idle puts the CPU into NAP mode,
294 * it has to do so in a loop, and relies on the external interrupt
295 * and decrementer interrupt entry code to get it out of the loop.
296 * It sets the _TLF_NAPPING bit in current_thread_info()->local_flags
297 * to signal that it is in the loop and needs help to get out.
298 */
299#ifdef CONFIG_PPC_970_NAP
300#define FINISH_NAP \
301BEGIN_FTR_SECTION \
302 clrrdi r11,r1,THREAD_SHIFT; \
303 ld r9,TI_LOCAL_FLAGS(r11); \
304 andi. r10,r9,_TLF_NAPPING; \
305 bnel power4_fixup_nap; \
306END_FTR_SECTION_IFSET(CPU_FTR_CAN_NAP)
307#else
308#define FINISH_NAP
309#endif
310
311#endif /* _ASM_POWERPC_EXCEPTION_H */
diff --git a/include/asm-powerpc/fs_pd.h b/include/asm-powerpc/fs_pd.h
index c624915b757e..9361cd5342cc 100644
--- a/include/asm-powerpc/fs_pd.h
+++ b/include/asm-powerpc/fs_pd.h
@@ -19,48 +19,22 @@
19 19
20#if defined(CONFIG_8260) 20#if defined(CONFIG_8260)
21#include <asm/mpc8260.h> 21#include <asm/mpc8260.h>
22#elif defined(CONFIG_85xx)
23#include <asm/mpc85xx.h>
24#endif 22#endif
25 23
26#define cpm2_map(member) \ 24#define cpm2_map(member) (&cpm2_immr->member)
27({ \ 25#define cpm2_map_size(member, size) (&cpm2_immr->member)
28 u32 offset = offsetof(cpm2_map_t, member); \ 26#define cpm2_unmap(addr) do {} while(0)
29 void *addr = ioremap (CPM_MAP_ADDR + offset, \
30 sizeof( ((cpm2_map_t*)0)->member)); \
31 addr; \
32})
33
34#define cpm2_map_size(member, size) \
35({ \
36 u32 offset = offsetof(cpm2_map_t, member); \
37 void *addr = ioremap (CPM_MAP_ADDR + offset, size); \
38 addr; \
39})
40
41#define cpm2_unmap(addr) iounmap(addr)
42#endif 27#endif
43 28
44#ifdef CONFIG_8xx 29#ifdef CONFIG_8xx
45#include <asm/8xx_immap.h> 30#include <asm/8xx_immap.h>
46#include <asm/mpc8xx.h> 31#include <asm/mpc8xx.h>
47 32
48#define immr_map(member) \ 33extern immap_t __iomem *mpc8xx_immr;
49({ \
50 u32 offset = offsetof(immap_t, member); \
51 void *addr = ioremap (IMAP_ADDR + offset, \
52 sizeof( ((immap_t*)0)->member)); \
53 addr; \
54})
55
56#define immr_map_size(member, size) \
57({ \
58 u32 offset = offsetof(immap_t, member); \
59 void *addr = ioremap (IMAP_ADDR + offset, size); \
60 addr; \
61})
62 34
63#define immr_unmap(addr) iounmap(addr) 35#define immr_map(member) (&mpc8xx_immr->member)
36#define immr_map_size(member, size) (&mpc8xx_immr->member)
37#define immr_unmap(addr) do {} while (0)
64#endif 38#endif
65 39
66static inline int uart_baudrate(void) 40static inline int uart_baudrate(void)
diff --git a/include/asm-powerpc/highmem.h b/include/asm-powerpc/highmem.h
new file mode 100644
index 000000000000..f7b21ee302b4
--- /dev/null
+++ b/include/asm-powerpc/highmem.h
@@ -0,0 +1,135 @@
1/*
2 * highmem.h: virtual kernel memory mappings for high memory
3 *
4 * PowerPC version, stolen from the i386 version.
5 *
6 * Used in CONFIG_HIGHMEM systems for memory pages which
7 * are not addressable by direct kernel virtual addresses.
8 *
9 * Copyright (C) 1999 Gerhard Wichert, Siemens AG
10 * Gerhard.Wichert@pdb.siemens.de
11 *
12 *
13 * Redesigned the x86 32-bit VM architecture to deal with
14 * up to 16 Terrabyte physical memory. With current x86 CPUs
15 * we now support up to 64 Gigabytes physical RAM.
16 *
17 * Copyright (C) 1999 Ingo Molnar <mingo@redhat.com>
18 */
19
20#ifndef _ASM_HIGHMEM_H
21#define _ASM_HIGHMEM_H
22
23#ifdef __KERNEL__
24
25#include <linux/init.h>
26#include <linux/interrupt.h>
27#include <asm/kmap_types.h>
28#include <asm/tlbflush.h>
29#include <asm/page.h>
30
31/* undef for production */
32#define HIGHMEM_DEBUG 1
33
34extern pte_t *kmap_pte;
35extern pgprot_t kmap_prot;
36extern pte_t *pkmap_page_table;
37
38/*
39 * Right now we initialize only a single pte table. It can be extended
40 * easily, subsequent pte tables have to be allocated in one physical
41 * chunk of RAM.
42 */
43#define PKMAP_BASE CONFIG_HIGHMEM_START
44#define LAST_PKMAP (1 << PTE_SHIFT)
45#define LAST_PKMAP_MASK (LAST_PKMAP-1)
46#define PKMAP_NR(virt) ((virt-PKMAP_BASE) >> PAGE_SHIFT)
47#define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT))
48
49#define KMAP_FIX_BEGIN (PKMAP_BASE + 0x00400000UL)
50
51extern void *kmap_high(struct page *page);
52extern void kunmap_high(struct page *page);
53
54static inline void *kmap(struct page *page)
55{
56 might_sleep();
57 if (!PageHighMem(page))
58 return page_address(page);
59 return kmap_high(page);
60}
61
62static inline void kunmap(struct page *page)
63{
64 BUG_ON(in_interrupt());
65 if (!PageHighMem(page))
66 return;
67 kunmap_high(page);
68}
69
70/*
71 * The use of kmap_atomic/kunmap_atomic is discouraged - kmap/kunmap
72 * gives a more generic (and caching) interface. But kmap_atomic can
73 * be used in IRQ contexts, so in some (very limited) cases we need
74 * it.
75 */
76static inline void *kmap_atomic(struct page *page, enum km_type type)
77{
78 unsigned int idx;
79 unsigned long vaddr;
80
81 /* even !CONFIG_PREEMPT needs this, for in_atomic in do_page_fault */
82 pagefault_disable();
83 if (!PageHighMem(page))
84 return page_address(page);
85
86 idx = type + KM_TYPE_NR*smp_processor_id();
87 vaddr = KMAP_FIX_BEGIN + idx * PAGE_SIZE;
88#ifdef HIGHMEM_DEBUG
89 BUG_ON(!pte_none(*(kmap_pte+idx)));
90#endif
91 set_pte_at(&init_mm, vaddr, kmap_pte+idx, mk_pte(page, kmap_prot));
92 flush_tlb_page(NULL, vaddr);
93
94 return (void*) vaddr;
95}
96
97static inline void kunmap_atomic(void *kvaddr, enum km_type type)
98{
99#ifdef HIGHMEM_DEBUG
100 unsigned long vaddr = (unsigned long) kvaddr & PAGE_MASK;
101 unsigned int idx = type + KM_TYPE_NR*smp_processor_id();
102
103 if (vaddr < KMAP_FIX_BEGIN) { // FIXME
104 pagefault_enable();
105 return;
106 }
107
108 BUG_ON(vaddr != KMAP_FIX_BEGIN + idx * PAGE_SIZE);
109
110 /*
111 * force other mappings to Oops if they'll try to access
112 * this pte without first remap it
113 */
114 pte_clear(&init_mm, vaddr, kmap_pte+idx);
115 flush_tlb_page(NULL, vaddr);
116#endif
117 pagefault_enable();
118}
119
120static inline struct page *kmap_atomic_to_page(void *ptr)
121{
122 unsigned long idx, vaddr = (unsigned long) ptr;
123
124 if (vaddr < KMAP_FIX_BEGIN)
125 return virt_to_page(ptr);
126
127 idx = (vaddr - KMAP_FIX_BEGIN) >> PAGE_SHIFT;
128 return pte_page(kmap_pte[idx]);
129}
130
131#define flush_cache_kmaps() flush_cache_all()
132
133#endif /* __KERNEL__ */
134
135#endif /* _ASM_HIGHMEM_H */
diff --git a/include/asm-powerpc/hydra.h b/include/asm-powerpc/hydra.h
new file mode 100644
index 000000000000..1ad4eed07fbe
--- /dev/null
+++ b/include/asm-powerpc/hydra.h
@@ -0,0 +1,102 @@
1/*
2 * include/asm-ppc/hydra.h -- Mac I/O `Hydra' definitions
3 *
4 * Copyright (C) 1997 Geert Uytterhoeven
5 *
6 * This file is based on the following documentation:
7 *
8 * Macintosh Technology in the Common Hardware Reference Platform
9 * Apple Computer, Inc.
10 *
11 * © Copyright 1995 Apple Computer, Inc. All rights reserved.
12 *
13 * It's available online from http://chrp.apple.com/MacTech.pdf.
14 * You can obtain paper copies of this book from computer bookstores or by
15 * writing Morgan Kaufmann Publishers, Inc., 340 Pine Street, Sixth Floor, San
16 * Francisco, CA 94104. Reference ISBN 1-55860-393-X.
17 *
18 * This file is subject to the terms and conditions of the GNU General Public
19 * License. See the file COPYING in the main directory of this archive
20 * for more details.
21 */
22
23#ifndef _ASMPPC_HYDRA_H
24#define _ASMPPC_HYDRA_H
25
26#ifdef __KERNEL__
27
28struct Hydra {
29 /* DBDMA Controller Register Space */
30 char Pad1[0x30];
31 u_int CachePD;
32 u_int IDs;
33 u_int Feature_Control;
34 char Pad2[0x7fc4];
35 /* DBDMA Channel Register Space */
36 char SCSI_DMA[0x100];
37 char Pad3[0x300];
38 char SCCA_Tx_DMA[0x100];
39 char SCCA_Rx_DMA[0x100];
40 char SCCB_Tx_DMA[0x100];
41 char SCCB_Rx_DMA[0x100];
42 char Pad4[0x7800];
43 /* Device Register Space */
44 char SCSI[0x1000];
45 char ADB[0x1000];
46 char SCC_Legacy[0x1000];
47 char SCC[0x1000];
48 char Pad9[0x2000];
49 char VIA[0x2000];
50 char Pad10[0x28000];
51 char OpenPIC[0x40000];
52};
53
54extern volatile struct Hydra __iomem *Hydra;
55
56
57 /*
58 * Feature Control Register
59 */
60
61#define HYDRA_FC_SCC_CELL_EN 0x00000001 /* Enable SCC Clock */
62#define HYDRA_FC_SCSI_CELL_EN 0x00000002 /* Enable SCSI Clock */
63#define HYDRA_FC_SCCA_ENABLE 0x00000004 /* Enable SCC A Lines */
64#define HYDRA_FC_SCCB_ENABLE 0x00000008 /* Enable SCC B Lines */
65#define HYDRA_FC_ARB_BYPASS 0x00000010 /* Bypass Internal Arbiter */
66#define HYDRA_FC_RESET_SCC 0x00000020 /* Reset SCC */
67#define HYDRA_FC_MPIC_ENABLE 0x00000040 /* Enable OpenPIC */
68#define HYDRA_FC_SLOW_SCC_PCLK 0x00000080 /* 1=15.6672, 0=25 MHz */
69#define HYDRA_FC_MPIC_IS_MASTER 0x00000100 /* OpenPIC Master Mode */
70
71
72 /*
73 * OpenPIC Interrupt Sources
74 */
75
76#define HYDRA_INT_SIO 0
77#define HYDRA_INT_SCSI_DMA 1
78#define HYDRA_INT_SCCA_TX_DMA 2
79#define HYDRA_INT_SCCA_RX_DMA 3
80#define HYDRA_INT_SCCB_TX_DMA 4
81#define HYDRA_INT_SCCB_RX_DMA 5
82#define HYDRA_INT_SCSI 6
83#define HYDRA_INT_SCCA 7
84#define HYDRA_INT_SCCB 8
85#define HYDRA_INT_VIA 9
86#define HYDRA_INT_ADB 10
87#define HYDRA_INT_ADB_NMI 11
88#define HYDRA_INT_EXT1 12 /* PCI IRQW */
89#define HYDRA_INT_EXT2 13 /* PCI IRQX */
90#define HYDRA_INT_EXT3 14 /* PCI IRQY */
91#define HYDRA_INT_EXT4 15 /* PCI IRQZ */
92#define HYDRA_INT_EXT5 16 /* IDE Primay/Secondary */
93#define HYDRA_INT_EXT6 17 /* IDE Secondary */
94#define HYDRA_INT_EXT7 18 /* Power Off Request */
95#define HYDRA_INT_SPARE 19
96
97extern int hydra_init(void);
98extern void macio_adb_init(void);
99
100#endif /* __KERNEL__ */
101
102#endif /* _ASMPPC_HYDRA_H */
diff --git a/include/asm-powerpc/ide.h b/include/asm-powerpc/ide.h
index 0f66f0f82c32..1644e44c8757 100644
--- a/include/asm-powerpc/ide.h
+++ b/include/asm-powerpc/ide.h
@@ -67,7 +67,7 @@ static __inline__ unsigned long ide_default_io_base(int index)
67#define ide_init_default_irq(base) ide_default_irq(base) 67#define ide_init_default_irq(base) ide_default_irq(base)
68#endif 68#endif
69 69
70#if (defined CONFIG_APUS || defined CONFIG_BLK_DEV_MPC8xx_IDE ) 70#ifdef CONFIG_BLK_DEV_MPC8xx_IDE
71#define IDE_ARCH_ACK_INTR 1 71#define IDE_ARCH_ACK_INTR 1
72#define ide_ack_intr(hwif) (hwif->hw.ack_intr ? hwif->hw.ack_intr(hwif) : 1) 72#define ide_ack_intr(hwif) (hwif->hw.ack_intr ? hwif->hw.ack_intr(hwif) : 1)
73#endif 73#endif
diff --git a/include/asm-powerpc/immap_86xx.h b/include/asm-powerpc/immap_86xx.h
index 59b9e07b8e99..0ad4e653d464 100644
--- a/include/asm-powerpc/immap_86xx.h
+++ b/include/asm-powerpc/immap_86xx.h
@@ -1,124 +1,135 @@
1/* 1/**
2 * MPC86xx Internal Memory Map 2 * MPC86xx Internal Memory Map
3 * 3 *
4 * Author: Jeff Brown 4 * Authors: Jeff Brown
5 * Timur Tabi <timur@freescale.com>
5 * 6 *
6 * Copyright 2004 Freescale Semiconductor, Inc 7 * Copyright 2004,2007 Freescale Semiconductor, Inc
7 * 8 *
8 * This program is free software; you can redistribute it and/or modify it 9 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the 10 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your 11 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version. 12 * option) any later version.
12 * 13 *
14 * This header file defines structures for various 86xx SOC devices that are
15 * used by multiple source files.
13 */ 16 */
14 17
15#ifndef __ASM_POWERPC_IMMAP_86XX_H__ 18#ifndef __ASM_POWERPC_IMMAP_86XX_H__
16#define __ASM_POWERPC_IMMAP_86XX_H__ 19#define __ASM_POWERPC_IMMAP_86XX_H__
17#ifdef __KERNEL__ 20#ifdef __KERNEL__
18 21
19/* Eventually this should define all the IO block registers in 86xx */ 22/* Global Utility Registers */
23struct ccsr_guts {
24 __be32 porpllsr; /* 0x.0000 - POR PLL Ratio Status Register */
25 __be32 porbmsr; /* 0x.0004 - POR Boot Mode Status Register */
26 __be32 porimpscr; /* 0x.0008 - POR I/O Impedance Status and Control Register */
27 __be32 pordevsr; /* 0x.000c - POR I/O Device Status Register */
28 __be32 pordbgmsr; /* 0x.0010 - POR Debug Mode Status Register */
29 u8 res1[0x20 - 0x14];
30 __be32 porcir; /* 0x.0020 - POR Configuration Information Register */
31 u8 res2[0x30 - 0x24];
32 __be32 gpiocr; /* 0x.0030 - GPIO Control Register */
33 u8 res3[0x40 - 0x34];
34 __be32 gpoutdr; /* 0x.0040 - General-Purpose Output Data Register */
35 u8 res4[0x50 - 0x44];
36 __be32 gpindr; /* 0x.0050 - General-Purpose Input Data Register */
37 u8 res5[0x60 - 0x54];
38 __be32 pmuxcr; /* 0x.0060 - Alternate Function Signal Multiplex Control */
39 u8 res6[0x70 - 0x64];
40 __be32 devdisr; /* 0x.0070 - Device Disable Control */
41 __be32 devdisr2; /* 0x.0074 - Device Disable Control 2 */
42 u8 res7[0x80 - 0x78];
43 __be32 powmgtcsr; /* 0x.0080 - Power Management Status and Control Register */
44 u8 res8[0x90 - 0x84];
45 __be32 mcpsumr; /* 0x.0090 - Machine Check Summary Register */
46 __be32 rstrscr; /* 0x.0094 - Reset Request Status and Control Register */
47 u8 res9[0xA0 - 0x98];
48 __be32 pvr; /* 0x.00a0 - Processor Version Register */
49 __be32 svr; /* 0x.00a4 - System Version Register */
50 u8 res10[0xB0 - 0xA8];
51 __be32 rstcr; /* 0x.00b0 - Reset Control Register */
52 u8 res11[0xC0 - 0xB4];
53 __be32 elbcvselcr; /* 0x.00c0 - eLBC Voltage Select Ctrl Reg */
54 u8 res12[0x800 - 0xC4];
55 __be32 clkdvdr; /* 0x.0800 - Clock Divide Register */
56 u8 res13[0x900 - 0x804];
57 __be32 ircr; /* 0x.0900 - Infrared Control Register */
58 u8 res14[0x908 - 0x904];
59 __be32 dmacr; /* 0x.0908 - DMA Control Register */
60 u8 res15[0x914 - 0x90C];
61 __be32 elbccr; /* 0x.0914 - eLBC Control Register */
62 u8 res16[0xB20 - 0x918];
63 __be32 ddr1clkdr; /* 0x.0b20 - DDR1 Clock Disable Register */
64 __be32 ddr2clkdr; /* 0x.0b24 - DDR2 Clock Disable Register */
65 __be32 ddrclkdr; /* 0x.0b28 - DDR Clock Disable Register */
66 u8 res17[0xE00 - 0xB2C];
67 __be32 clkocr; /* 0x.0e00 - Clock Out Select Register */
68 u8 res18[0xE10 - 0xE04];
69 __be32 ddrdllcr; /* 0x.0e10 - DDR DLL Control Register */
70 u8 res19[0xE20 - 0xE14];
71 __be32 lbcdllcr; /* 0x.0e20 - LBC DLL Control Register */
72 u8 res20[0xF04 - 0xE24];
73 __be32 srds1cr0; /* 0x.0f04 - SerDes1 Control Register 0 */
74 __be32 srds1cr1; /* 0x.0f08 - SerDes1 Control Register 0 */
75 u8 res21[0xF40 - 0xF0C];
76 __be32 srds2cr0; /* 0x.0f40 - SerDes1 Control Register 0 */
77 __be32 srds2cr1; /* 0x.0f44 - SerDes1 Control Register 0 */
78} __attribute__ ((packed));
20 79
21/* PCI Registers */ 80#define CCSR_GUTS_DMACR_DEV_SSI 0 /* DMA controller/channel set to SSI */
22typedef struct ccsr_pci { 81#define CCSR_GUTS_DMACR_DEV_IR 1 /* DMA controller/channel set to IR */
23 uint cfg_addr; /* 0x.000 - PCI Configuration Address Register */
24 uint cfg_data; /* 0x.004 - PCI Configuration Data Register */
25 uint int_ack; /* 0x.008 - PCI Interrupt Acknowledge Register */
26 char res1[3060];
27 uint potar0; /* 0x.c00 - PCI Outbound Transaction Address Register 0 */
28 uint potear0; /* 0x.c04 - PCI Outbound Translation Extended Address Register 0 */
29 uint powbar0; /* 0x.c08 - PCI Outbound Window Base Address Register 0 */
30 char res2[4];
31 uint powar0; /* 0x.c10 - PCI Outbound Window Attributes Register 0 */
32 char res3[12];
33 uint potar1; /* 0x.c20 - PCI Outbound Transaction Address Register 1 */
34 uint potear1; /* 0x.c24 - PCI Outbound Translation Extended Address Register 1 */
35 uint powbar1; /* 0x.c28 - PCI Outbound Window Base Address Register 1 */
36 char res4[4];
37 uint powar1; /* 0x.c30 - PCI Outbound Window Attributes Register 1 */
38 char res5[12];
39 uint potar2; /* 0x.c40 - PCI Outbound Transaction Address Register 2 */
40 uint potear2; /* 0x.c44 - PCI Outbound Translation Extended Address Register 2 */
41 uint powbar2; /* 0x.c48 - PCI Outbound Window Base Address Register 2 */
42 char res6[4];
43 uint powar2; /* 0x.c50 - PCI Outbound Window Attributes Register 2 */
44 char res7[12];
45 uint potar3; /* 0x.c60 - PCI Outbound Transaction Address Register 3 */
46 uint potear3; /* 0x.c64 - PCI Outbound Translation Extended Address Register 3 */
47 uint powbar3; /* 0x.c68 - PCI Outbound Window Base Address Register 3 */
48 char res8[4];
49 uint powar3; /* 0x.c70 - PCI Outbound Window Attributes Register 3 */
50 char res9[12];
51 uint potar4; /* 0x.c80 - PCI Outbound Transaction Address Register 4 */
52 uint potear4; /* 0x.c84 - PCI Outbound Translation Extended Address Register 4 */
53 uint powbar4; /* 0x.c88 - PCI Outbound Window Base Address Register 4 */
54 char res10[4];
55 uint powar4; /* 0x.c90 - PCI Outbound Window Attributes Register 4 */
56 char res11[268];
57 uint pitar3; /* 0x.da0 - PCI Inbound Translation Address Register 3 */
58 char res12[4];
59 uint piwbar3; /* 0x.da8 - PCI Inbound Window Base Address Register 3 */
60 uint piwbear3; /* 0x.dac - PCI Inbound Window Base Extended Address Register 3 */
61 uint piwar3; /* 0x.db0 - PCI Inbound Window Attributes Register 3 */
62 char res13[12];
63 uint pitar2; /* 0x.dc0 - PCI Inbound Translation Address Register 2 */
64 char res14[4];
65 uint piwbar2; /* 0x.dc8 - PCI Inbound Window Base Address Register 2 */
66 uint piwbear2; /* 0x.dcc - PCI Inbound Window Base Extended Address Register 2 */
67 uint piwar2; /* 0x.dd0 - PCI Inbound Window Attributes Register 2 */
68 char res15[12];
69 uint pitar1; /* 0x.de0 - PCI Inbound Translation Address Register 1 */
70 char res16[4];
71 uint piwbar1; /* 0x.de8 - PCI Inbound Window Base Address Register 1 */
72 char res17[4];
73 uint piwar1; /* 0x.df0 - PCI Inbound Window Attributes Register 1 */
74 char res18[12];
75 uint err_dr; /* 0x.e00 - PCI Error Detect Register */
76 uint err_cap_dr; /* 0x.e04 - PCI Error Capture Disable Register */
77 uint err_en; /* 0x.e08 - PCI Error Enable Register */
78 uint err_attrib; /* 0x.e0c - PCI Error Attributes Capture Register */
79 uint err_addr; /* 0x.e10 - PCI Error Address Capture Register */
80 uint err_ext_addr; /* 0x.e14 - PCI Error Extended Address Capture Register */
81 uint err_dl; /* 0x.e18 - PCI Error Data Low Capture Register */
82 uint err_dh; /* 0x.e1c - PCI Error Data High Capture Register */
83 uint gas_timr; /* 0x.e20 - PCI Gasket Timer Register */
84 uint pci_timr; /* 0x.e24 - PCI Timer Register */
85 char res19[472];
86} ccsr_pci_t;
87 82
88/* Global Utility Registers */ 83/*
89typedef struct ccsr_guts { 84 * Set the DMACR register in the GUTS
90 uint porpllsr; /* 0x.0000 - POR PLL Ratio Status Register */ 85 *
91 uint porbmsr; /* 0x.0004 - POR Boot Mode Status Register */ 86 * The DMACR register determines the source of initiated transfers for each
92 uint porimpscr; /* 0x.0008 - POR I/O Impedance Status and Control Register */ 87 * channel on each DMA controller. Rather than have a bunch of repetitive
93 uint pordevsr; /* 0x.000c - POR I/O Device Status Register */ 88 * macros for the bit patterns, we just have a function that calculates
94 uint pordbgmsr; /* 0x.0010 - POR Debug Mode Status Register */ 89 * them.
95 char res1[12]; 90 *
96 uint gpporcr; /* 0x.0020 - General-Purpose POR Configuration Register */ 91 * guts: Pointer to GUTS structure
97 char res2[12]; 92 * co: The DMA controller (1 or 2)
98 uint gpiocr; /* 0x.0030 - GPIO Control Register */ 93 * ch: The channel on the DMA controller (0, 1, 2, or 3)
99 char res3[12]; 94 * device: The device to set as the source (CCSR_GUTS_DMACR_DEV_xx)
100 uint gpoutdr; /* 0x.0040 - General-Purpose Output Data Register */ 95 */
101 char res4[12]; 96static inline void guts_set_dmacr(struct ccsr_guts __iomem *guts,
102 uint gpindr; /* 0x.0050 - General-Purpose Input Data Register */ 97 unsigned int co, unsigned int ch, unsigned int device)
103 char res5[12]; 98{
104 uint pmuxcr; /* 0x.0060 - Alternate Function Signal Multiplex Control */ 99 unsigned int shift = 16 + (8 * (2 - co) + 2 * (3 - ch));
105 char res6[12]; 100
106 uint devdisr; /* 0x.0070 - Device Disable Control */ 101 clrsetbits_be32(&guts->dmacr, 3 << shift, device << shift);
107 char res7[12]; 102}
108 uint powmgtcsr; /* 0x.0080 - Power Management Status and Control Register */ 103
109 char res8[12]; 104#define CCSR_GUTS_PMUXCR_LDPSEL 0x00010000
110 uint mcpsumr; /* 0x.0090 - Machine Check Summary Register */ 105#define CCSR_GUTS_PMUXCR_SSI1_MASK 0x0000C000 /* Bitmask for SSI1 */
111 char res9[12]; 106#define CCSR_GUTS_PMUXCR_SSI1_LA 0x00000000 /* Latched address */
112 uint pvr; /* 0x.00a0 - Processor Version Register */ 107#define CCSR_GUTS_PMUXCR_SSI1_HI 0x00004000 /* High impedance */
113 uint svr; /* 0x.00a4 - System Version Register */ 108#define CCSR_GUTS_PMUXCR_SSI1_SSI 0x00008000 /* Used for SSI1 */
114 char res10[3416]; 109#define CCSR_GUTS_PMUXCR_SSI2_MASK 0x00003000 /* Bitmask for SSI2 */
115 uint clkocr; /* 0x.0e00 - Clock Out Select Register */ 110#define CCSR_GUTS_PMUXCR_SSI2_LA 0x00000000 /* Latched address */
116 char res11[12]; 111#define CCSR_GUTS_PMUXCR_SSI2_HI 0x00001000 /* High impedance */
117 uint ddrdllcr; /* 0x.0e10 - DDR DLL Control Register */ 112#define CCSR_GUTS_PMUXCR_SSI2_SSI 0x00002000 /* Used for SSI2 */
118 char res12[12]; 113#define CCSR_GUTS_PMUXCR_LA_22_25_LA 0x00000000 /* Latched Address */
119 uint lbcdllcr; /* 0x.0e20 - LBC DLL Control Register */ 114#define CCSR_GUTS_PMUXCR_LA_22_25_HI 0x00000400 /* High impedance */
120 char res13[61916]; 115#define CCSR_GUTS_PMUXCR_DBGDRV 0x00000200 /* Signals not driven */
121} ccsr_guts_t; 116#define CCSR_GUTS_PMUXCR_DMA2_0 0x00000008
117#define CCSR_GUTS_PMUXCR_DMA2_3 0x00000004
118#define CCSR_GUTS_PMUXCR_DMA1_0 0x00000002
119#define CCSR_GUTS_PMUXCR_DMA1_3 0x00000001
120
121#define CCSR_GUTS_CLKDVDR_PXCKEN 0x80000000
122#define CCSR_GUTS_CLKDVDR_SSICKEN 0x20000000
123#define CCSR_GUTS_CLKDVDR_PXCKINV 0x10000000
124#define CCSR_GUTS_CLKDVDR_PXCKDLY_SHIFT 25
125#define CCSR_GUTS_CLKDVDR_PXCKDLY_MASK 0x06000000
126#define CCSR_GUTS_CLKDVDR_PXCKDLY(x) \
127 (((x) & 3) << CCSR_GUTS_CLKDVDR_PXCKDLY_SHIFT)
128#define CCSR_GUTS_CLKDVDR_PXCLK_SHIFT 16
129#define CCSR_GUTS_CLKDVDR_PXCLK_MASK 0x001F0000
130#define CCSR_GUTS_CLKDVDR_PXCLK(x) (((x) & 31) << CCSR_GUTS_CLKDVDR_PXCLK_SHIFT)
131#define CCSR_GUTS_CLKDVDR_SSICLK_MASK 0x000000FF
132#define CCSR_GUTS_CLKDVDR_SSICLK(x) ((x) & CCSR_GUTS_CLKDVDR_SSICLK_MASK)
122 133
123#endif /* __ASM_POWERPC_IMMAP_86XX_H__ */ 134#endif /* __ASM_POWERPC_IMMAP_86XX_H__ */
124#endif /* __KERNEL__ */ 135#endif /* __KERNEL__ */
diff --git a/include/asm-powerpc/immap_cpm2.h b/include/asm-powerpc/immap_cpm2.h
new file mode 100644
index 000000000000..4080bab0468c
--- /dev/null
+++ b/include/asm-powerpc/immap_cpm2.h
@@ -0,0 +1,650 @@
1/*
2 * CPM2 Internal Memory Map
3 * Copyright (c) 1999 Dan Malek (dmalek@jlc.net)
4 *
5 * The Internal Memory Map for devices with CPM2 on them. This
6 * is the superset of all CPM2 devices (8260, 8266, 8280, 8272,
7 * 8560).
8 */
9#ifdef __KERNEL__
10#ifndef __IMMAP_CPM2__
11#define __IMMAP_CPM2__
12
13#include <linux/types.h>
14
15/* System configuration registers.
16*/
17typedef struct sys_82xx_conf {
18 u32 sc_siumcr;
19 u32 sc_sypcr;
20 u8 res1[6];
21 u16 sc_swsr;
22 u8 res2[20];
23 u32 sc_bcr;
24 u8 sc_ppc_acr;
25 u8 res3[3];
26 u32 sc_ppc_alrh;
27 u32 sc_ppc_alrl;
28 u8 sc_lcl_acr;
29 u8 res4[3];
30 u32 sc_lcl_alrh;
31 u32 sc_lcl_alrl;
32 u32 sc_tescr1;
33 u32 sc_tescr2;
34 u32 sc_ltescr1;
35 u32 sc_ltescr2;
36 u32 sc_pdtea;
37 u8 sc_pdtem;
38 u8 res5[3];
39 u32 sc_ldtea;
40 u8 sc_ldtem;
41 u8 res6[163];
42} sysconf_82xx_cpm2_t;
43
44typedef struct sys_85xx_conf {
45 u32 sc_cear;
46 u16 sc_ceer;
47 u16 sc_cemr;
48 u8 res1[70];
49 u32 sc_smaer;
50 u8 res2[4];
51 u32 sc_smevr;
52 u32 sc_smctr;
53 u32 sc_lmaer;
54 u8 res3[4];
55 u32 sc_lmevr;
56 u32 sc_lmctr;
57 u8 res4[144];
58} sysconf_85xx_cpm2_t;
59
60typedef union sys_conf {
61 sysconf_82xx_cpm2_t siu_82xx;
62 sysconf_85xx_cpm2_t siu_85xx;
63} sysconf_cpm2_t;
64
65
66
67/* Memory controller registers.
68*/
69typedef struct mem_ctlr {
70 u32 memc_br0;
71 u32 memc_or0;
72 u32 memc_br1;
73 u32 memc_or1;
74 u32 memc_br2;
75 u32 memc_or2;
76 u32 memc_br3;
77 u32 memc_or3;
78 u32 memc_br4;
79 u32 memc_or4;
80 u32 memc_br5;
81 u32 memc_or5;
82 u32 memc_br6;
83 u32 memc_or6;
84 u32 memc_br7;
85 u32 memc_or7;
86 u32 memc_br8;
87 u32 memc_or8;
88 u32 memc_br9;
89 u32 memc_or9;
90 u32 memc_br10;
91 u32 memc_or10;
92 u32 memc_br11;
93 u32 memc_or11;
94 u8 res1[8];
95 u32 memc_mar;
96 u8 res2[4];
97 u32 memc_mamr;
98 u32 memc_mbmr;
99 u32 memc_mcmr;
100 u8 res3[8];
101 u16 memc_mptpr;
102 u8 res4[2];
103 u32 memc_mdr;
104 u8 res5[4];
105 u32 memc_psdmr;
106 u32 memc_lsdmr;
107 u8 memc_purt;
108 u8 res6[3];
109 u8 memc_psrt;
110 u8 res7[3];
111 u8 memc_lurt;
112 u8 res8[3];
113 u8 memc_lsrt;
114 u8 res9[3];
115 u32 memc_immr;
116 u32 memc_pcibr0;
117 u32 memc_pcibr1;
118 u8 res10[16];
119 u32 memc_pcimsk0;
120 u32 memc_pcimsk1;
121 u8 res11[52];
122} memctl_cpm2_t;
123
124/* System Integration Timers.
125*/
126typedef struct sys_int_timers {
127 u8 res1[32];
128 u16 sit_tmcntsc;
129 u8 res2[2];
130 u32 sit_tmcnt;
131 u8 res3[4];
132 u32 sit_tmcntal;
133 u8 res4[16];
134 u16 sit_piscr;
135 u8 res5[2];
136 u32 sit_pitc;
137 u32 sit_pitr;
138 u8 res6[94];
139 u8 res7[390];
140} sit_cpm2_t;
141
142#define PISCR_PIRQ_MASK ((u16)0xff00)
143#define PISCR_PS ((u16)0x0080)
144#define PISCR_PIE ((u16)0x0004)
145#define PISCR_PTF ((u16)0x0002)
146#define PISCR_PTE ((u16)0x0001)
147
148/* PCI Controller.
149*/
150typedef struct pci_ctlr {
151 u32 pci_omisr;
152 u32 pci_omimr;
153 u8 res1[8];
154 u32 pci_ifqpr;
155 u32 pci_ofqpr;
156 u8 res2[8];
157 u32 pci_imr0;
158 u32 pci_imr1;
159 u32 pci_omr0;
160 u32 pci_omr1;
161 u32 pci_odr;
162 u8 res3[4];
163 u32 pci_idr;
164 u8 res4[20];
165 u32 pci_imisr;
166 u32 pci_imimr;
167 u8 res5[24];
168 u32 pci_ifhpr;
169 u8 res6[4];
170 u32 pci_iftpr;
171 u8 res7[4];
172 u32 pci_iphpr;
173 u8 res8[4];
174 u32 pci_iptpr;
175 u8 res9[4];
176 u32 pci_ofhpr;
177 u8 res10[4];
178 u32 pci_oftpr;
179 u8 res11[4];
180 u32 pci_ophpr;
181 u8 res12[4];
182 u32 pci_optpr;
183 u8 res13[8];
184 u32 pci_mucr;
185 u8 res14[8];
186 u32 pci_qbar;
187 u8 res15[12];
188 u32 pci_dmamr0;
189 u32 pci_dmasr0;
190 u32 pci_dmacdar0;
191 u8 res16[4];
192 u32 pci_dmasar0;
193 u8 res17[4];
194 u32 pci_dmadar0;
195 u8 res18[4];
196 u32 pci_dmabcr0;
197 u32 pci_dmandar0;
198 u8 res19[86];
199 u32 pci_dmamr1;
200 u32 pci_dmasr1;
201 u32 pci_dmacdar1;
202 u8 res20[4];
203 u32 pci_dmasar1;
204 u8 res21[4];
205 u32 pci_dmadar1;
206 u8 res22[4];
207 u32 pci_dmabcr1;
208 u32 pci_dmandar1;
209 u8 res23[88];
210 u32 pci_dmamr2;
211 u32 pci_dmasr2;
212 u32 pci_dmacdar2;
213 u8 res24[4];
214 u32 pci_dmasar2;
215 u8 res25[4];
216 u32 pci_dmadar2;
217 u8 res26[4];
218 u32 pci_dmabcr2;
219 u32 pci_dmandar2;
220 u8 res27[88];
221 u32 pci_dmamr3;
222 u32 pci_dmasr3;
223 u32 pci_dmacdar3;
224 u8 res28[4];
225 u32 pci_dmasar3;
226 u8 res29[4];
227 u32 pci_dmadar3;
228 u8 res30[4];
229 u32 pci_dmabcr3;
230 u32 pci_dmandar3;
231 u8 res31[344];
232 u32 pci_potar0;
233 u8 res32[4];
234 u32 pci_pobar0;
235 u8 res33[4];
236 u32 pci_pocmr0;
237 u8 res34[4];
238 u32 pci_potar1;
239 u8 res35[4];
240 u32 pci_pobar1;
241 u8 res36[4];
242 u32 pci_pocmr1;
243 u8 res37[4];
244 u32 pci_potar2;
245 u8 res38[4];
246 u32 pci_pobar2;
247 u8 res39[4];
248 u32 pci_pocmr2;
249 u8 res40[50];
250 u32 pci_ptcr;
251 u32 pci_gpcr;
252 u32 pci_gcr;
253 u32 pci_esr;
254 u32 pci_emr;
255 u32 pci_ecr;
256 u32 pci_eacr;
257 u8 res41[4];
258 u32 pci_edcr;
259 u8 res42[4];
260 u32 pci_eccr;
261 u8 res43[44];
262 u32 pci_pitar1;
263 u8 res44[4];
264 u32 pci_pibar1;
265 u8 res45[4];
266 u32 pci_picmr1;
267 u8 res46[4];
268 u32 pci_pitar0;
269 u8 res47[4];
270 u32 pci_pibar0;
271 u8 res48[4];
272 u32 pci_picmr0;
273 u8 res49[4];
274 u32 pci_cfg_addr;
275 u32 pci_cfg_data;
276 u32 pci_int_ack;
277 u8 res50[756];
278} pci_cpm2_t;
279
280/* Interrupt Controller.
281*/
282typedef struct interrupt_controller {
283 u16 ic_sicr;
284 u8 res1[2];
285 u32 ic_sivec;
286 u32 ic_sipnrh;
287 u32 ic_sipnrl;
288 u32 ic_siprr;
289 u32 ic_scprrh;
290 u32 ic_scprrl;
291 u32 ic_simrh;
292 u32 ic_simrl;
293 u32 ic_siexr;
294 u8 res2[88];
295} intctl_cpm2_t;
296
297/* Clocks and Reset.
298*/
299typedef struct clk_and_reset {
300 u32 car_sccr;
301 u8 res1[4];
302 u32 car_scmr;
303 u8 res2[4];
304 u32 car_rsr;
305 u32 car_rmr;
306 u8 res[104];
307} car_cpm2_t;
308
309/* Input/Output Port control/status registers.
310 * Names consistent with processor manual, although they are different
311 * from the original 8xx names.......
312 */
313typedef struct io_port {
314 u32 iop_pdira;
315 u32 iop_ppara;
316 u32 iop_psora;
317 u32 iop_podra;
318 u32 iop_pdata;
319 u8 res1[12];
320 u32 iop_pdirb;
321 u32 iop_pparb;
322 u32 iop_psorb;
323 u32 iop_podrb;
324 u32 iop_pdatb;
325 u8 res2[12];
326 u32 iop_pdirc;
327 u32 iop_pparc;
328 u32 iop_psorc;
329 u32 iop_podrc;
330 u32 iop_pdatc;
331 u8 res3[12];
332 u32 iop_pdird;
333 u32 iop_ppard;
334 u32 iop_psord;
335 u32 iop_podrd;
336 u32 iop_pdatd;
337 u8 res4[12];
338} iop_cpm2_t;
339
340/* Communication Processor Module Timers
341*/
342typedef struct cpm_timers {
343 u8 cpmt_tgcr1;
344 u8 res1[3];
345 u8 cpmt_tgcr2;
346 u8 res2[11];
347 u16 cpmt_tmr1;
348 u16 cpmt_tmr2;
349 u16 cpmt_trr1;
350 u16 cpmt_trr2;
351 u16 cpmt_tcr1;
352 u16 cpmt_tcr2;
353 u16 cpmt_tcn1;
354 u16 cpmt_tcn2;
355 u16 cpmt_tmr3;
356 u16 cpmt_tmr4;
357 u16 cpmt_trr3;
358 u16 cpmt_trr4;
359 u16 cpmt_tcr3;
360 u16 cpmt_tcr4;
361 u16 cpmt_tcn3;
362 u16 cpmt_tcn4;
363 u16 cpmt_ter1;
364 u16 cpmt_ter2;
365 u16 cpmt_ter3;
366 u16 cpmt_ter4;
367 u8 res3[584];
368} cpmtimer_cpm2_t;
369
370/* DMA control/status registers.
371*/
372typedef struct sdma_csr {
373 u8 res0[24];
374 u8 sdma_sdsr;
375 u8 res1[3];
376 u8 sdma_sdmr;
377 u8 res2[3];
378 u8 sdma_idsr1;
379 u8 res3[3];
380 u8 sdma_idmr1;
381 u8 res4[3];
382 u8 sdma_idsr2;
383 u8 res5[3];
384 u8 sdma_idmr2;
385 u8 res6[3];
386 u8 sdma_idsr3;
387 u8 res7[3];
388 u8 sdma_idmr3;
389 u8 res8[3];
390 u8 sdma_idsr4;
391 u8 res9[3];
392 u8 sdma_idmr4;
393 u8 res10[707];
394} sdma_cpm2_t;
395
396/* Fast controllers
397*/
398typedef struct fcc {
399 u32 fcc_gfmr;
400 u32 fcc_fpsmr;
401 u16 fcc_ftodr;
402 u8 res1[2];
403 u16 fcc_fdsr;
404 u8 res2[2];
405 u16 fcc_fcce;
406 u8 res3[2];
407 u16 fcc_fccm;
408 u8 res4[2];
409 u8 fcc_fccs;
410 u8 res5[3];
411 u8 fcc_ftirr_phy[4];
412} fcc_t;
413
414/* Fast controllers continued
415 */
416typedef struct fcc_c {
417 u32 fcc_firper;
418 u32 fcc_firer;
419 u32 fcc_firsr_hi;
420 u32 fcc_firsr_lo;
421 u8 fcc_gfemr;
422 u8 res1[15];
423} fcc_c_t;
424
425/* TC Layer
426 */
427typedef struct tclayer {
428 u16 tc_tcmode;
429 u16 tc_cdsmr;
430 u16 tc_tcer;
431 u16 tc_rcc;
432 u16 tc_tcmr;
433 u16 tc_fcc;
434 u16 tc_ccc;
435 u16 tc_icc;
436 u16 tc_tcc;
437 u16 tc_ecc;
438 u8 res1[12];
439} tclayer_t;
440
441
442/* I2C
443*/
444typedef struct i2c {
445 u8 i2c_i2mod;
446 u8 res1[3];
447 u8 i2c_i2add;
448 u8 res2[3];
449 u8 i2c_i2brg;
450 u8 res3[3];
451 u8 i2c_i2com;
452 u8 res4[3];
453 u8 i2c_i2cer;
454 u8 res5[3];
455 u8 i2c_i2cmr;
456 u8 res6[331];
457} i2c_cpm2_t;
458
459typedef struct scc { /* Serial communication channels */
460 u32 scc_gsmrl;
461 u32 scc_gsmrh;
462 u16 scc_psmr;
463 u8 res1[2];
464 u16 scc_todr;
465 u16 scc_dsr;
466 u16 scc_scce;
467 u8 res2[2];
468 u16 scc_sccm;
469 u8 res3;
470 u8 scc_sccs;
471 u8 res4[8];
472} scc_t;
473
474typedef struct smc { /* Serial management channels */
475 u8 res1[2];
476 u16 smc_smcmr;
477 u8 res2[2];
478 u8 smc_smce;
479 u8 res3[3];
480 u8 smc_smcm;
481 u8 res4[5];
482} smc_t;
483
484/* Serial Peripheral Interface.
485*/
486typedef struct spi_ctrl {
487 u16 spi_spmode;
488 u8 res1[4];
489 u8 spi_spie;
490 u8 res2[3];
491 u8 spi_spim;
492 u8 res3[2];
493 u8 spi_spcom;
494 u8 res4[82];
495} spictl_cpm2_t;
496
497/* CPM Mux.
498*/
499typedef struct cpmux {
500 u8 cmx_si1cr;
501 u8 res1;
502 u8 cmx_si2cr;
503 u8 res2;
504 u32 cmx_fcr;
505 u32 cmx_scr;
506 u8 cmx_smr;
507 u8 res3;
508 u16 cmx_uar;
509 u8 res4[16];
510} cpmux_t;
511
512/* SIRAM control
513*/
514typedef struct siram {
515 u16 si_amr;
516 u16 si_bmr;
517 u16 si_cmr;
518 u16 si_dmr;
519 u8 si_gmr;
520 u8 res1;
521 u8 si_cmdr;
522 u8 res2;
523 u8 si_str;
524 u8 res3;
525 u16 si_rsr;
526} siramctl_t;
527
528typedef struct mcc {
529 u16 mcc_mcce;
530 u8 res1[2];
531 u16 mcc_mccm;
532 u8 res2[2];
533 u8 mcc_mccf;
534 u8 res3[7];
535} mcc_t;
536
537typedef struct comm_proc {
538 u32 cp_cpcr;
539 u32 cp_rccr;
540 u8 res1[14];
541 u16 cp_rter;
542 u8 res2[2];
543 u16 cp_rtmr;
544 u16 cp_rtscr;
545 u8 res3[2];
546 u32 cp_rtsr;
547 u8 res4[12];
548} cpm_cpm2_t;
549
550/* USB Controller.
551*/
552typedef struct usb_ctlr {
553 u8 usb_usmod;
554 u8 usb_usadr;
555 u8 usb_uscom;
556 u8 res1[1];
557 u16 usb_usep1;
558 u16 usb_usep2;
559 u16 usb_usep3;
560 u16 usb_usep4;
561 u8 res2[4];
562 u16 usb_usber;
563 u8 res3[2];
564 u16 usb_usbmr;
565 u8 usb_usbs;
566 u8 res4[7];
567} usb_cpm2_t;
568
569/* ...and the whole thing wrapped up....
570*/
571
572typedef struct immap {
573 /* Some references are into the unique and known dpram spaces,
574 * others are from the generic base.
575 */
576#define im_dprambase im_dpram1
577 u8 im_dpram1[16*1024];
578 u8 res1[16*1024];
579 u8 im_dpram2[4*1024];
580 u8 res2[8*1024];
581 u8 im_dpram3[4*1024];
582 u8 res3[16*1024];
583
584 sysconf_cpm2_t im_siu_conf; /* SIU Configuration */
585 memctl_cpm2_t im_memctl; /* Memory Controller */
586 sit_cpm2_t im_sit; /* System Integration Timers */
587 pci_cpm2_t im_pci; /* PCI Controller */
588 intctl_cpm2_t im_intctl; /* Interrupt Controller */
589 car_cpm2_t im_clkrst; /* Clocks and reset */
590 iop_cpm2_t im_ioport; /* IO Port control/status */
591 cpmtimer_cpm2_t im_cpmtimer; /* CPM timers */
592 sdma_cpm2_t im_sdma; /* SDMA control/status */
593
594 fcc_t im_fcc[3]; /* Three FCCs */
595 u8 res4z[32];
596 fcc_c_t im_fcc_c[3]; /* Continued FCCs */
597
598 u8 res4[32];
599
600 tclayer_t im_tclayer[8]; /* Eight TCLayers */
601 u16 tc_tcgsr;
602 u16 tc_tcger;
603
604 /* First set of baud rate generators.
605 */
606 u8 res[236];
607 u32 im_brgc5;
608 u32 im_brgc6;
609 u32 im_brgc7;
610 u32 im_brgc8;
611
612 u8 res5[608];
613
614 i2c_cpm2_t im_i2c; /* I2C control/status */
615 cpm_cpm2_t im_cpm; /* Communication processor */
616
617 /* Second set of baud rate generators.
618 */
619 u32 im_brgc1;
620 u32 im_brgc2;
621 u32 im_brgc3;
622 u32 im_brgc4;
623
624 scc_t im_scc[4]; /* Four SCCs */
625 smc_t im_smc[2]; /* Couple of SMCs */
626 spictl_cpm2_t im_spi; /* A SPI */
627 cpmux_t im_cpmux; /* CPM clock route mux */
628 siramctl_t im_siramctl1; /* First SI RAM Control */
629 mcc_t im_mcc1; /* First MCC */
630 siramctl_t im_siramctl2; /* Second SI RAM Control */
631 mcc_t im_mcc2; /* Second MCC */
632 usb_cpm2_t im_usb; /* USB Controller */
633
634 u8 res6[1153];
635
636 u16 im_si1txram[256];
637 u8 res7[512];
638 u16 im_si1rxram[256];
639 u8 res8[512];
640 u16 im_si2txram[256];
641 u8 res9[512];
642 u16 im_si2rxram[256];
643 u8 res10[512];
644 u8 res11[4096];
645} cpm2_map_t;
646
647extern cpm2_map_t __iomem *cpm2_immr;
648
649#endif /* __IMMAP_CPM2__ */
650#endif /* __KERNEL__ */
diff --git a/include/asm-powerpc/immap_qe.h b/include/asm-powerpc/immap_qe.h
index 1020b7fc0129..aba9806b31c9 100644
--- a/include/asm-powerpc/immap_qe.h
+++ b/include/asm-powerpc/immap_qe.h
@@ -86,8 +86,9 @@ struct cp_qe {
86 __be16 ceexe4; /* QE external request 4 event register */ 86 __be16 ceexe4; /* QE external request 4 event register */
87 u8 res11[0x2]; 87 u8 res11[0x2];
88 __be16 ceexm4; /* QE external request 4 mask register */ 88 __be16 ceexm4; /* QE external request 4 mask register */
89 u8 res12[0x2]; 89 u8 res12[0x3A];
90 u8 res13[0x280]; 90 __be32 ceurnr; /* QE microcode revision number register */
91 u8 res13[0x244];
91} __attribute__ ((packed)); 92} __attribute__ ((packed));
92 93
93/* QE Multiplexer */ 94/* QE Multiplexer */
@@ -96,10 +97,7 @@ struct qe_mux {
96 __be32 cmxsi1cr_l; /* CMX SI1 clock route low register */ 97 __be32 cmxsi1cr_l; /* CMX SI1 clock route low register */
97 __be32 cmxsi1cr_h; /* CMX SI1 clock route high register */ 98 __be32 cmxsi1cr_h; /* CMX SI1 clock route high register */
98 __be32 cmxsi1syr; /* CMX SI1 SYNC route register */ 99 __be32 cmxsi1syr; /* CMX SI1 SYNC route register */
99 __be32 cmxucr1; /* CMX UCC1, UCC3 clock route register */ 100 __be32 cmxucr[4]; /* CMX UCCx clock route registers */
100 __be32 cmxucr2; /* CMX UCC5, UCC7 clock route register */
101 __be32 cmxucr3; /* CMX UCC2, UCC4 clock route register */
102 __be32 cmxucr4; /* CMX UCC6, UCC8 clock route register */
103 __be32 cmxupcr; /* CMX UPC clock route register */ 101 __be32 cmxupcr; /* CMX UPC clock route register */
104 u8 res0[0x1C]; 102 u8 res0[0x1C];
105} __attribute__ ((packed)); 103} __attribute__ ((packed));
@@ -260,7 +258,6 @@ struct ucc_slow {
260 __be16 utpt; 258 __be16 utpt;
261 u8 res4[0x52]; 259 u8 res4[0x52];
262 u8 guemr; /* UCC general extended mode register */ 260 u8 guemr; /* UCC general extended mode register */
263 u8 res5[0x200 - 0x091];
264} __attribute__ ((packed)); 261} __attribute__ ((packed));
265 262
266/* QE UCC Fast */ 263/* QE UCC Fast */
@@ -293,21 +290,13 @@ struct ucc_fast {
293 __be32 urtry; /* UCC retry counter register */ 290 __be32 urtry; /* UCC retry counter register */
294 u8 res8[0x4C]; 291 u8 res8[0x4C];
295 u8 guemr; /* UCC general extended mode register */ 292 u8 guemr; /* UCC general extended mode register */
296 u8 res9[0x100 - 0x091];
297} __attribute__ ((packed));
298
299/* QE UCC */
300struct ucc_common {
301 u8 res1[0x90];
302 u8 guemr;
303 u8 res2[0x200 - 0x091];
304} __attribute__ ((packed)); 293} __attribute__ ((packed));
305 294
306struct ucc { 295struct ucc {
307 union { 296 union {
308 struct ucc_slow slow; 297 struct ucc_slow slow;
309 struct ucc_fast fast; 298 struct ucc_fast fast;
310 struct ucc_common common; 299 u8 res[0x200]; /* UCC blocks are 512 bytes each */
311 }; 300 };
312} __attribute__ ((packed)); 301} __attribute__ ((packed));
313 302
@@ -406,7 +395,7 @@ struct dbg {
406 395
407/* RISC Special Registers (Trap and Breakpoint) */ 396/* RISC Special Registers (Trap and Breakpoint) */
408struct rsp { 397struct rsp {
409 u8 fixme[0x100]; 398 u32 reg[0x40]; /* 64 32-bit registers */
410} __attribute__ ((packed)); 399} __attribute__ ((packed));
411 400
412struct qe_immap { 401struct qe_immap {
@@ -435,11 +424,13 @@ struct qe_immap {
435 u8 res13[0x600]; 424 u8 res13[0x600];
436 struct upc upc2; /* MultiPHY UTOPIA POS Ctrlr 2*/ 425 struct upc upc2; /* MultiPHY UTOPIA POS Ctrlr 2*/
437 struct sdma sdma; /* SDMA */ 426 struct sdma sdma; /* SDMA */
438 struct dbg dbg; /* Debug Space */ 427 struct dbg dbg; /* 0x104080 - 0x1040FF
439 struct rsp rsp[0x2]; /* RISC Special Registers 428 Debug Space */
429 struct rsp rsp[0x2]; /* 0x104100 - 0x1042FF
430 RISC Special Registers
440 (Trap and Breakpoint) */ 431 (Trap and Breakpoint) */
441 u8 res14[0x300]; 432 u8 res14[0x300]; /* 0x104300 - 0x1045FF */
442 u8 res15[0x3A00]; 433 u8 res15[0x3A00]; /* 0x104600 - 0x107FFF */
443 u8 res16[0x8000]; /* 0x108000 - 0x110000 */ 434 u8 res16[0x8000]; /* 0x108000 - 0x110000 */
444 u8 muram[0xC000]; /* 0x110000 - 0x11C000 435 u8 muram[0xC000]; /* 0x110000 - 0x11C000
445 Multi-user RAM */ 436 Multi-user RAM */
@@ -450,7 +441,7 @@ struct qe_immap {
450extern struct qe_immap *qe_immr; 441extern struct qe_immap *qe_immr;
451extern phys_addr_t get_qe_base(void); 442extern phys_addr_t get_qe_base(void);
452 443
453static inline unsigned long immrbar_virt_to_phys(volatile void * address) 444static inline unsigned long immrbar_virt_to_phys(void *address)
454{ 445{
455 if ( ((u32)address >= (u32)qe_immr) && 446 if ( ((u32)address >= (u32)qe_immr) &&
456 ((u32)address < ((u32)qe_immr + QE_IMMAP_SIZE)) ) 447 ((u32)address < ((u32)qe_immr + QE_IMMAP_SIZE)) )
diff --git a/include/asm-powerpc/io.h b/include/asm-powerpc/io.h
index bb8d965f96c6..affba7052fb6 100644
--- a/include/asm-powerpc/io.h
+++ b/include/asm-powerpc/io.h
@@ -86,7 +86,7 @@ extern unsigned long pci_dram_offset;
86 */ 86 */
87 87
88#ifdef CONFIG_PPC64 88#ifdef CONFIG_PPC64
89#define IO_SET_SYNC_FLAG() do { get_paca()->io_sync = 1; } while(0) 89#define IO_SET_SYNC_FLAG() do { local_paca->io_sync = 1; } while(0)
90#else 90#else
91#define IO_SET_SYNC_FLAG() 91#define IO_SET_SYNC_FLAG()
92#endif 92#endif
@@ -734,6 +734,32 @@ static inline void * bus_to_virt(unsigned long address)
734#define setbits16(_addr, _v) out_be16((_addr), in_be16(_addr) | (_v)) 734#define setbits16(_addr, _v) out_be16((_addr), in_be16(_addr) | (_v))
735#define clrbits16(_addr, _v) out_be16((_addr), in_be16(_addr) & ~(_v)) 735#define clrbits16(_addr, _v) out_be16((_addr), in_be16(_addr) & ~(_v))
736 736
737#define setbits8(_addr, _v) out_8((_addr), in_8(_addr) | (_v))
738#define clrbits8(_addr, _v) out_8((_addr), in_8(_addr) & ~(_v))
739
740/* Clear and set bits in one shot. These macros can be used to clear and
741 * set multiple bits in a register using a single read-modify-write. These
742 * macros can also be used to set a multiple-bit bit pattern using a mask,
743 * by specifying the mask in the 'clear' parameter and the new bit pattern
744 * in the 'set' parameter.
745 */
746
747#define clrsetbits(type, addr, clear, set) \
748 out_##type((addr), (in_##type(addr) & ~(clear)) | (set))
749
750#ifdef __powerpc64__
751#define clrsetbits_be64(addr, clear, set) clrsetbits(be64, addr, clear, set)
752#define clrsetbits_le64(addr, clear, set) clrsetbits(le64, addr, clear, set)
753#endif
754
755#define clrsetbits_be32(addr, clear, set) clrsetbits(be32, addr, clear, set)
756#define clrsetbits_le32(addr, clear, set) clrsetbits(le32, addr, clear, set)
757
758#define clrsetbits_be16(addr, clear, set) clrsetbits(be16, addr, clear, set)
759#define clrsetbits_le16(addr, clear, set) clrsetbits(le32, addr, clear, set)
760
761#define clrsetbits_8(addr, clear, set) clrsetbits(8, addr, clear, set)
762
737#endif /* __KERNEL__ */ 763#endif /* __KERNEL__ */
738 764
739#endif /* _ASM_POWERPC_IO_H */ 765#endif /* _ASM_POWERPC_IO_H */
diff --git a/include/asm-powerpc/irq.h b/include/asm-powerpc/irq.h
index 0485c53db2b5..1392db456523 100644
--- a/include/asm-powerpc/irq.h
+++ b/include/asm-powerpc/irq.h
@@ -124,6 +124,9 @@ struct irq_host {
124 struct irq_host_ops *ops; 124 struct irq_host_ops *ops;
125 void *host_data; 125 void *host_data;
126 irq_hw_number_t inval_irq; 126 irq_hw_number_t inval_irq;
127
128 /* Optional device node pointer */
129 struct device_node *of_node;
127}; 130};
128 131
129/* The main irq map itself is an array of NR_IRQ entries containing the 132/* The main irq map itself is an array of NR_IRQ entries containing the
@@ -142,7 +145,7 @@ extern irq_hw_number_t virq_to_hw(unsigned int virq);
142 145
143/** 146/**
144 * irq_alloc_host - Allocate a new irq_host data structure 147 * irq_alloc_host - Allocate a new irq_host data structure
145 * @node: device-tree node of the interrupt controller 148 * @of_node: optional device-tree node of the interrupt controller
146 * @revmap_type: type of reverse mapping to use 149 * @revmap_type: type of reverse mapping to use
147 * @revmap_arg: for IRQ_HOST_MAP_LINEAR linear only: size of the map 150 * @revmap_arg: for IRQ_HOST_MAP_LINEAR linear only: size of the map
148 * @ops: map/unmap host callbacks 151 * @ops: map/unmap host callbacks
@@ -156,7 +159,8 @@ extern irq_hw_number_t virq_to_hw(unsigned int virq);
156 * later during boot automatically (the reverse mapping will use the slow path 159 * later during boot automatically (the reverse mapping will use the slow path
157 * until that happens). 160 * until that happens).
158 */ 161 */
159extern struct irq_host *irq_alloc_host(unsigned int revmap_type, 162extern struct irq_host *irq_alloc_host(struct device_node *of_node,
163 unsigned int revmap_type,
160 unsigned int revmap_arg, 164 unsigned int revmap_arg,
161 struct irq_host_ops *ops, 165 struct irq_host_ops *ops,
162 irq_hw_number_t inval_irq); 166 irq_hw_number_t inval_irq);
diff --git a/include/asm-powerpc/iseries/hv_call_event.h b/include/asm-powerpc/iseries/hv_call_event.h
index 4cec4762076d..cc029d388e11 100644
--- a/include/asm-powerpc/iseries/hv_call_event.h
+++ b/include/asm-powerpc/iseries/hv_call_event.h
@@ -21,6 +21,9 @@
21#ifndef _ASM_POWERPC_ISERIES_HV_CALL_EVENT_H 21#ifndef _ASM_POWERPC_ISERIES_HV_CALL_EVENT_H
22#define _ASM_POWERPC_ISERIES_HV_CALL_EVENT_H 22#define _ASM_POWERPC_ISERIES_HV_CALL_EVENT_H
23 23
24#include <linux/types.h>
25#include <linux/dma-mapping.h>
26
24#include <asm/iseries/hv_call_sc.h> 27#include <asm/iseries/hv_call_sc.h>
25#include <asm/iseries/hv_types.h> 28#include <asm/iseries/hv_types.h>
26#include <asm/abs_addr.h> 29#include <asm/abs_addr.h>
@@ -113,6 +116,13 @@ static inline HvLpEvent_Rc HvCallEvent_signalLpEventFast(HvLpIndex targetLp,
113 eventData3, eventData4, eventData5); 116 eventData3, eventData4, eventData5);
114} 117}
115 118
119extern void *iseries_hv_alloc(size_t size, dma_addr_t *dma_handle, gfp_t flag);
120extern void iseries_hv_free(size_t size, void *vaddr, dma_addr_t dma_handle);
121extern dma_addr_t iseries_hv_map(void *vaddr, size_t size,
122 enum dma_data_direction direction);
123extern void iseries_hv_unmap(dma_addr_t dma_handle, size_t size,
124 enum dma_data_direction direction);
125
116static inline HvLpEvent_Rc HvCallEvent_ackLpEvent(struct HvLpEvent *event) 126static inline HvLpEvent_Rc HvCallEvent_ackLpEvent(struct HvLpEvent *event)
117{ 127{
118 return HvCall1(HvCallEventAckLpEvent, virt_to_abs(event)); 128 return HvCall1(HvCallEventAckLpEvent, virt_to_abs(event));
diff --git a/include/asm-powerpc/iseries/iommu.h b/include/asm-powerpc/iseries/iommu.h
index 6e323a13ac30..c59ee7e4bed1 100644
--- a/include/asm-powerpc/iseries/iommu.h
+++ b/include/asm-powerpc/iseries/iommu.h
@@ -22,6 +22,7 @@
22 */ 22 */
23 23
24struct pci_dev; 24struct pci_dev;
25struct vio_dev;
25struct device_node; 26struct device_node;
26struct iommu_table; 27struct iommu_table;
27 28
@@ -34,4 +35,7 @@ extern void iommu_table_getparms_iSeries(unsigned long busno,
34 unsigned char slotno, unsigned char virtbus, 35 unsigned char slotno, unsigned char virtbus,
35 struct iommu_table *tbl); 36 struct iommu_table *tbl);
36 37
38extern struct iommu_table *vio_build_iommu_table_iseries(struct vio_dev *dev);
39extern void iommu_vio_init(void);
40
37#endif /* _ASM_POWERPC_ISERIES_IOMMU_H */ 41#endif /* _ASM_POWERPC_ISERIES_IOMMU_H */
diff --git a/include/asm-powerpc/iseries/lpar_map.h b/include/asm-powerpc/iseries/lpar_map.h
index 2ec384d66abb..5e9f3e128ee2 100644
--- a/include/asm-powerpc/iseries/lpar_map.h
+++ b/include/asm-powerpc/iseries/lpar_map.h
@@ -22,6 +22,8 @@
22 22
23#include <asm/types.h> 23#include <asm/types.h>
24 24
25#endif
26
25/* 27/*
26 * The iSeries hypervisor will set up mapping for one or more 28 * The iSeries hypervisor will set up mapping for one or more
27 * ESID/VSID pairs (in SLB/segment registers) and will set up 29 * ESID/VSID pairs (in SLB/segment registers) and will set up
@@ -56,6 +58,7 @@
56/* Hypervisor initially maps 32MB of the load area */ 58/* Hypervisor initially maps 32MB of the load area */
57#define HvPagesToMap 8192 59#define HvPagesToMap 8192
58 60
61#ifndef __ASSEMBLY__
59struct LparMap { 62struct LparMap {
60 u64 xNumberEsids; // Number of ESID/VSID pairs 63 u64 xNumberEsids; // Number of ESID/VSID pairs
61 u64 xNumberRanges; // Number of VA ranges to map 64 u64 xNumberRanges; // Number of VA ranges to map
diff --git a/include/asm-powerpc/iseries/vio.h b/include/asm-powerpc/iseries/vio.h
index 7a95d296abd1..f9ac0d00b951 100644
--- a/include/asm-powerpc/iseries/vio.h
+++ b/include/asm-powerpc/iseries/vio.h
@@ -51,6 +51,116 @@
51 */ 51 */
52#define VIO_MAX_SUBTYPES 8 52#define VIO_MAX_SUBTYPES 8
53 53
54#define VIOMAXBLOCKDMA 12
55
56struct open_data {
57 u64 disk_size;
58 u16 max_disk;
59 u16 cylinders;
60 u16 tracks;
61 u16 sectors;
62 u16 bytes_per_sector;
63};
64
65struct rw_data {
66 u64 offset;
67 struct {
68 u32 token;
69 u32 reserved;
70 u64 len;
71 } dma_info[VIOMAXBLOCKDMA];
72};
73
74struct vioblocklpevent {
75 struct HvLpEvent event;
76 u32 reserved;
77 u16 version;
78 u16 sub_result;
79 u16 disk;
80 u16 flags;
81 union {
82 struct open_data open_data;
83 struct rw_data rw_data;
84 u64 changed;
85 } u;
86};
87
88#define vioblockflags_ro 0x0001
89
90enum vioblocksubtype {
91 vioblockopen = 0x0001,
92 vioblockclose = 0x0002,
93 vioblockread = 0x0003,
94 vioblockwrite = 0x0004,
95 vioblockflush = 0x0005,
96 vioblockcheck = 0x0007
97};
98
99struct viocdlpevent {
100 struct HvLpEvent event;
101 u32 reserved;
102 u16 version;
103 u16 sub_result;
104 u16 disk;
105 u16 flags;
106 u32 token;
107 u64 offset; /* On open, max number of disks */
108 u64 len; /* On open, size of the disk */
109 u32 block_size; /* Only set on open */
110 u32 media_size; /* Only set on open */
111};
112
113enum viocdsubtype {
114 viocdopen = 0x0001,
115 viocdclose = 0x0002,
116 viocdread = 0x0003,
117 viocdwrite = 0x0004,
118 viocdlockdoor = 0x0005,
119 viocdgetinfo = 0x0006,
120 viocdcheck = 0x0007
121};
122
123struct viotapelpevent {
124 struct HvLpEvent event;
125 u32 reserved;
126 u16 version;
127 u16 sub_type_result;
128 u16 tape;
129 u16 flags;
130 u32 token;
131 u64 len;
132 union {
133 struct {
134 u32 tape_op;
135 u32 count;
136 } op;
137 struct {
138 u32 type;
139 u32 resid;
140 u32 dsreg;
141 u32 gstat;
142 u32 erreg;
143 u32 file_no;
144 u32 block_no;
145 } get_status;
146 struct {
147 u32 block_no;
148 } get_pos;
149 } u;
150};
151
152enum viotapesubtype {
153 viotapeopen = 0x0001,
154 viotapeclose = 0x0002,
155 viotaperead = 0x0003,
156 viotapewrite = 0x0004,
157 viotapegetinfo = 0x0005,
158 viotapeop = 0x0006,
159 viotapegetpos = 0x0007,
160 viotapesetpos = 0x0008,
161 viotapegetstatus = 0x0009
162};
163
54/* 164/*
55 * Each subtype can register a handler to process their events. 165 * Each subtype can register a handler to process their events.
56 * The handler must have this interface. 166 * The handler must have this interface.
@@ -68,6 +178,8 @@ extern void vio_set_hostlp(void);
68extern void *vio_get_event_buffer(int subtype); 178extern void *vio_get_event_buffer(int subtype);
69extern void vio_free_event_buffer(int subtype, void *buffer); 179extern void vio_free_event_buffer(int subtype, void *buffer);
70 180
181extern struct vio_dev *vio_create_viodasd(u32 unit);
182
71extern HvLpIndex viopath_hostLp; 183extern HvLpIndex viopath_hostLp;
72extern HvLpIndex viopath_ourLp; 184extern HvLpIndex viopath_ourLp;
73 185
@@ -150,8 +262,4 @@ enum viochar_rc {
150 viochar_rc_ebusy = 1 262 viochar_rc_ebusy = 1
151}; 263};
152 264
153struct device;
154
155extern struct device *iSeries_vio_dev;
156
157#endif /* _ASM_POWERPC_ISERIES_VIO_H */ 265#endif /* _ASM_POWERPC_ISERIES_VIO_H */
diff --git a/include/asm-powerpc/kgdb.h b/include/asm-powerpc/kgdb.h
new file mode 100644
index 000000000000..b617dac82969
--- /dev/null
+++ b/include/asm-powerpc/kgdb.h
@@ -0,0 +1,57 @@
1/*
2 * kgdb.h: Defines and declarations for serial line source level
3 * remote debugging of the Linux kernel using gdb.
4 *
5 * PPC Mods (C) 1998 Michael Tesch (tesch@cs.wisc.edu)
6 *
7 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
8 */
9#ifdef __KERNEL__
10#ifndef _PPC_KGDB_H
11#define _PPC_KGDB_H
12
13#ifndef __ASSEMBLY__
14
15/* Things specific to the gen550 backend. */
16struct uart_port;
17
18extern void gen550_progress(char *, unsigned short);
19extern void gen550_kgdb_map_scc(void);
20extern void gen550_init(int, struct uart_port *);
21
22/* Things specific to the pmac backend. */
23extern void zs_kgdb_hook(int tty_num);
24
25/* To init the kgdb engine. (called by serial hook)*/
26extern void set_debug_traps(void);
27
28/* To enter the debugger explicitly. */
29extern void breakpoint(void);
30
31/* For taking exceptions
32 * these are defined in traps.c
33 */
34extern int (*debugger)(struct pt_regs *regs);
35extern int (*debugger_bpt)(struct pt_regs *regs);
36extern int (*debugger_sstep)(struct pt_regs *regs);
37extern int (*debugger_iabr_match)(struct pt_regs *regs);
38extern int (*debugger_dabr_match)(struct pt_regs *regs);
39extern void (*debugger_fault_handler)(struct pt_regs *regs);
40
41/* What we bring to the party */
42int kgdb_bpt(struct pt_regs *regs);
43int kgdb_sstep(struct pt_regs *regs);
44void kgdb(struct pt_regs *regs);
45int kgdb_iabr_match(struct pt_regs *regs);
46int kgdb_dabr_match(struct pt_regs *regs);
47
48/*
49 * external low-level support routines (ie macserial.c)
50 */
51extern void kgdb_interruptible(int); /* control interrupts from serial */
52extern void putDebugChar(char); /* write a single character */
53extern char getDebugChar(void); /* read and return a single char */
54
55#endif /* !(__ASSEMBLY__) */
56#endif /* !(_PPC_KGDB_H) */
57#endif /* __KERNEL__ */
diff --git a/include/asm-powerpc/lmb.h b/include/asm-powerpc/lmb.h
index 0c5880f70225..b5f9f4c9c294 100644
--- a/include/asm-powerpc/lmb.h
+++ b/include/asm-powerpc/lmb.h
@@ -1,5 +1,5 @@
1#ifndef _PPC64_LMB_H 1#ifndef _ASM_POWERPC_LMB_H
2#define _PPC64_LMB_H 2#define _ASM_POWERPC_LMB_H
3#ifdef __KERNEL__ 3#ifdef __KERNEL__
4 4
5/* 5/*
@@ -77,4 +77,4 @@ lmb_end_pfn(struct lmb_region *type, unsigned long region_nr)
77} 77}
78 78
79#endif /* __KERNEL__ */ 79#endif /* __KERNEL__ */
80#endif /* _PPC64_LMB_H */ 80#endif /* _ASM_POWERPC_LMB_H */
diff --git a/include/asm-powerpc/machdep.h b/include/asm-powerpc/machdep.h
index 71c6e7eb2a26..6968f4300dca 100644
--- a/include/asm-powerpc/machdep.h
+++ b/include/asm-powerpc/machdep.h
@@ -51,22 +51,22 @@ struct machdep_calls {
51#ifdef CONFIG_PPC64 51#ifdef CONFIG_PPC64
52 void (*hpte_invalidate)(unsigned long slot, 52 void (*hpte_invalidate)(unsigned long slot,
53 unsigned long va, 53 unsigned long va,
54 int psize, 54 int psize, int ssize,
55 int local); 55 int local);
56 long (*hpte_updatepp)(unsigned long slot, 56 long (*hpte_updatepp)(unsigned long slot,
57 unsigned long newpp, 57 unsigned long newpp,
58 unsigned long va, 58 unsigned long va,
59 int pize, 59 int psize, int ssize,
60 int local); 60 int local);
61 void (*hpte_updateboltedpp)(unsigned long newpp, 61 void (*hpte_updateboltedpp)(unsigned long newpp,
62 unsigned long ea, 62 unsigned long ea,
63 int psize); 63 int psize, int ssize);
64 long (*hpte_insert)(unsigned long hpte_group, 64 long (*hpte_insert)(unsigned long hpte_group,
65 unsigned long va, 65 unsigned long va,
66 unsigned long prpn, 66 unsigned long prpn,
67 unsigned long rflags, 67 unsigned long rflags,
68 unsigned long vflags, 68 unsigned long vflags,
69 int psize); 69 int psize, int ssize);
70 long (*hpte_remove)(unsigned long hpte_group); 70 long (*hpte_remove)(unsigned long hpte_group);
71 void (*flush_hash_range)(unsigned long number, int local); 71 void (*flush_hash_range)(unsigned long number, int local);
72 72
@@ -99,7 +99,7 @@ struct machdep_calls {
99#endif /* CONFIG_PPC64 */ 99#endif /* CONFIG_PPC64 */
100 100
101 int (*probe)(void); 101 int (*probe)(void);
102 void (*setup_arch)(void); 102 void (*setup_arch)(void); /* Optional, may be NULL */
103 void (*init_early)(void); 103 void (*init_early)(void);
104 /* Optional, may be NULL. */ 104 /* Optional, may be NULL. */
105 void (*show_cpuinfo)(struct seq_file *m); 105 void (*show_cpuinfo)(struct seq_file *m);
diff --git a/include/asm-powerpc/mmu-40x.h b/include/asm-powerpc/mmu-40x.h
new file mode 100644
index 000000000000..7d37f77043ac
--- /dev/null
+++ b/include/asm-powerpc/mmu-40x.h
@@ -0,0 +1,65 @@
1#ifndef _ASM_POWERPC_MMU_40X_H_
2#define _ASM_POWERPC_MMU_40X_H_
3
4/*
5 * PPC40x support
6 */
7
8#define PPC40X_TLB_SIZE 64
9
10/*
11 * TLB entries are defined by a "high" tag portion and a "low" data
12 * portion. On all architectures, the data portion is 32-bits.
13 *
14 * TLB entries are managed entirely under software control by reading,
15 * writing, and searchoing using the 4xx-specific tlbre, tlbwr, and tlbsx
16 * instructions.
17 */
18
19#define TLB_LO 1
20#define TLB_HI 0
21
22#define TLB_DATA TLB_LO
23#define TLB_TAG TLB_HI
24
25/* Tag portion */
26
27#define TLB_EPN_MASK 0xFFFFFC00 /* Effective Page Number */
28#define TLB_PAGESZ_MASK 0x00000380
29#define TLB_PAGESZ(x) (((x) & 0x7) << 7)
30#define PAGESZ_1K 0
31#define PAGESZ_4K 1
32#define PAGESZ_16K 2
33#define PAGESZ_64K 3
34#define PAGESZ_256K 4
35#define PAGESZ_1M 5
36#define PAGESZ_4M 6
37#define PAGESZ_16M 7
38#define TLB_VALID 0x00000040 /* Entry is valid */
39
40/* Data portion */
41
42#define TLB_RPN_MASK 0xFFFFFC00 /* Real Page Number */
43#define TLB_PERM_MASK 0x00000300
44#define TLB_EX 0x00000200 /* Instruction execution allowed */
45#define TLB_WR 0x00000100 /* Writes permitted */
46#define TLB_ZSEL_MASK 0x000000F0
47#define TLB_ZSEL(x) (((x) & 0xF) << 4)
48#define TLB_ATTR_MASK 0x0000000F
49#define TLB_W 0x00000008 /* Caching is write-through */
50#define TLB_I 0x00000004 /* Caching is inhibited */
51#define TLB_M 0x00000002 /* Memory is coherent */
52#define TLB_G 0x00000001 /* Memory is guarded from prefetch */
53
54#ifndef __ASSEMBLY__
55
56typedef unsigned long phys_addr_t;
57
58typedef struct {
59 unsigned long id;
60 unsigned long vdso_base;
61} mm_context_t;
62
63#endif /* !__ASSEMBLY__ */
64
65#endif /* _ASM_POWERPC_MMU_40X_H_ */
diff --git a/include/asm-powerpc/mmu-hash64.h b/include/asm-powerpc/mmu-hash64.h
index 3112ad14ad95..82328dec2b52 100644
--- a/include/asm-powerpc/mmu-hash64.h
+++ b/include/asm-powerpc/mmu-hash64.h
@@ -47,6 +47,8 @@ extern char initial_stab[];
47 47
48/* Bits in the SLB VSID word */ 48/* Bits in the SLB VSID word */
49#define SLB_VSID_SHIFT 12 49#define SLB_VSID_SHIFT 12
50#define SLB_VSID_SHIFT_1T 24
51#define SLB_VSID_SSIZE_SHIFT 62
50#define SLB_VSID_B ASM_CONST(0xc000000000000000) 52#define SLB_VSID_B ASM_CONST(0xc000000000000000)
51#define SLB_VSID_B_256M ASM_CONST(0x0000000000000000) 53#define SLB_VSID_B_256M ASM_CONST(0x0000000000000000)
52#define SLB_VSID_B_1T ASM_CONST(0x4000000000000000) 54#define SLB_VSID_B_1T ASM_CONST(0x4000000000000000)
@@ -66,6 +68,7 @@ extern char initial_stab[];
66#define SLB_VSID_USER (SLB_VSID_KP|SLB_VSID_KS|SLB_VSID_C) 68#define SLB_VSID_USER (SLB_VSID_KP|SLB_VSID_KS|SLB_VSID_C)
67 69
68#define SLBIE_C (0x08000000) 70#define SLBIE_C (0x08000000)
71#define SLBIE_SSIZE_SHIFT 25
69 72
70/* 73/*
71 * Hash table 74 * Hash table
@@ -77,7 +80,7 @@ extern char initial_stab[];
77#define HPTE_V_AVPN_SHIFT 7 80#define HPTE_V_AVPN_SHIFT 7
78#define HPTE_V_AVPN ASM_CONST(0x3fffffffffffff80) 81#define HPTE_V_AVPN ASM_CONST(0x3fffffffffffff80)
79#define HPTE_V_AVPN_VAL(x) (((x) & HPTE_V_AVPN) >> HPTE_V_AVPN_SHIFT) 82#define HPTE_V_AVPN_VAL(x) (((x) & HPTE_V_AVPN) >> HPTE_V_AVPN_SHIFT)
80#define HPTE_V_COMPARE(x,y) (!(((x) ^ (y)) & HPTE_V_AVPN)) 83#define HPTE_V_COMPARE(x,y) (!(((x) ^ (y)) & 0xffffffffffffff80))
81#define HPTE_V_BOLTED ASM_CONST(0x0000000000000010) 84#define HPTE_V_BOLTED ASM_CONST(0x0000000000000010)
82#define HPTE_V_LOCK ASM_CONST(0x0000000000000008) 85#define HPTE_V_LOCK ASM_CONST(0x0000000000000008)
83#define HPTE_V_LARGE ASM_CONST(0x0000000000000004) 86#define HPTE_V_LARGE ASM_CONST(0x0000000000000004)
@@ -164,16 +167,19 @@ struct mmu_psize_def
164#define MMU_SEGSIZE_256M 0 167#define MMU_SEGSIZE_256M 0
165#define MMU_SEGSIZE_1T 1 168#define MMU_SEGSIZE_1T 1
166 169
170
167#ifndef __ASSEMBLY__ 171#ifndef __ASSEMBLY__
168 172
169/* 173/*
170 * The current system page sizes 174 * The current system page and segment sizes
171 */ 175 */
172extern struct mmu_psize_def mmu_psize_defs[MMU_PAGE_COUNT]; 176extern struct mmu_psize_def mmu_psize_defs[MMU_PAGE_COUNT];
173extern int mmu_linear_psize; 177extern int mmu_linear_psize;
174extern int mmu_virtual_psize; 178extern int mmu_virtual_psize;
175extern int mmu_vmalloc_psize; 179extern int mmu_vmalloc_psize;
176extern int mmu_io_psize; 180extern int mmu_io_psize;
181extern int mmu_kernel_ssize;
182extern int mmu_highuser_ssize;
177 183
178/* 184/*
179 * If the processor supports 64k normal pages but not 64k cache 185 * If the processor supports 64k normal pages but not 64k cache
@@ -195,13 +201,15 @@ extern int mmu_huge_psize;
195 * This function sets the AVPN and L fields of the HPTE appropriately 201 * This function sets the AVPN and L fields of the HPTE appropriately
196 * for the page size 202 * for the page size
197 */ 203 */
198static inline unsigned long hpte_encode_v(unsigned long va, int psize) 204static inline unsigned long hpte_encode_v(unsigned long va, int psize,
205 int ssize)
199{ 206{
200 unsigned long v = 207 unsigned long v;
201 v = (va >> 23) & ~(mmu_psize_defs[psize].avpnm); 208 v = (va >> 23) & ~(mmu_psize_defs[psize].avpnm);
202 v <<= HPTE_V_AVPN_SHIFT; 209 v <<= HPTE_V_AVPN_SHIFT;
203 if (psize != MMU_PAGE_4K) 210 if (psize != MMU_PAGE_4K)
204 v |= HPTE_V_LARGE; 211 v |= HPTE_V_LARGE;
212 v |= ((unsigned long) ssize) << HPTE_V_SSIZE_SHIFT;
205 return v; 213 return v;
206} 214}
207 215
@@ -226,20 +234,40 @@ static inline unsigned long hpte_encode_r(unsigned long pa, int psize)
226} 234}
227 235
228/* 236/*
229 * This hashes a virtual address for a 256Mb segment only for now 237 * Build a VA given VSID, EA and segment size
230 */ 238 */
239static inline unsigned long hpt_va(unsigned long ea, unsigned long vsid,
240 int ssize)
241{
242 if (ssize == MMU_SEGSIZE_256M)
243 return (vsid << 28) | (ea & 0xfffffffUL);
244 return (vsid << 40) | (ea & 0xffffffffffUL);
245}
231 246
232static inline unsigned long hpt_hash(unsigned long va, unsigned int shift) 247/*
248 * This hashes a virtual address
249 */
250
251static inline unsigned long hpt_hash(unsigned long va, unsigned int shift,
252 int ssize)
233{ 253{
234 return ((va >> 28) & 0x7fffffffffUL) ^ ((va & 0x0fffffffUL) >> shift); 254 unsigned long hash, vsid;
255
256 if (ssize == MMU_SEGSIZE_256M) {
257 hash = (va >> 28) ^ ((va & 0x0fffffffUL) >> shift);
258 } else {
259 vsid = va >> 40;
260 hash = vsid ^ (vsid << 25) ^ ((va & 0xffffffffffUL) >> shift);
261 }
262 return hash & 0x7fffffffffUL;
235} 263}
236 264
237extern int __hash_page_4K(unsigned long ea, unsigned long access, 265extern int __hash_page_4K(unsigned long ea, unsigned long access,
238 unsigned long vsid, pte_t *ptep, unsigned long trap, 266 unsigned long vsid, pte_t *ptep, unsigned long trap,
239 unsigned int local); 267 unsigned int local, int ssize);
240extern int __hash_page_64K(unsigned long ea, unsigned long access, 268extern int __hash_page_64K(unsigned long ea, unsigned long access,
241 unsigned long vsid, pte_t *ptep, unsigned long trap, 269 unsigned long vsid, pte_t *ptep, unsigned long trap,
242 unsigned int local); 270 unsigned int local, int ssize);
243struct mm_struct; 271struct mm_struct;
244extern int hash_page(unsigned long ea, unsigned long access, unsigned long trap); 272extern int hash_page(unsigned long ea, unsigned long access, unsigned long trap);
245extern int hash_huge_page(struct mm_struct *mm, unsigned long access, 273extern int hash_huge_page(struct mm_struct *mm, unsigned long access,
@@ -248,7 +276,7 @@ extern int hash_huge_page(struct mm_struct *mm, unsigned long access,
248 276
249extern int htab_bolt_mapping(unsigned long vstart, unsigned long vend, 277extern int htab_bolt_mapping(unsigned long vstart, unsigned long vend,
250 unsigned long pstart, unsigned long mode, 278 unsigned long pstart, unsigned long mode,
251 int psize); 279 int psize, int ssize);
252 280
253extern void htab_initialize(void); 281extern void htab_initialize(void);
254extern void htab_initialize_secondary(void); 282extern void htab_initialize_secondary(void);
@@ -256,6 +284,7 @@ extern void hpte_init_native(void);
256extern void hpte_init_lpar(void); 284extern void hpte_init_lpar(void);
257extern void hpte_init_iSeries(void); 285extern void hpte_init_iSeries(void);
258extern void hpte_init_beat(void); 286extern void hpte_init_beat(void);
287extern void hpte_init_beat_v3(void);
259 288
260extern void stabs_alloc(void); 289extern void stabs_alloc(void);
261extern void slb_initialize(void); 290extern void slb_initialize(void);
@@ -316,12 +345,17 @@ extern void slb_vmalloc_update(void);
316 * which are used by the iSeries firmware. 345 * which are used by the iSeries firmware.
317 */ 346 */
318 347
319#define VSID_MULTIPLIER ASM_CONST(200730139) /* 28-bit prime */ 348#define VSID_MULTIPLIER_256M ASM_CONST(200730139) /* 28-bit prime */
320#define VSID_BITS 36 349#define VSID_BITS_256M 36
321#define VSID_MODULUS ((1UL<<VSID_BITS)-1) 350#define VSID_MODULUS_256M ((1UL<<VSID_BITS_256M)-1)
322 351
323#define CONTEXT_BITS 19 352#define VSID_MULTIPLIER_1T ASM_CONST(12538073) /* 24-bit prime */
324#define USER_ESID_BITS 16 353#define VSID_BITS_1T 24
354#define VSID_MODULUS_1T ((1UL<<VSID_BITS_1T)-1)
355
356#define CONTEXT_BITS 19
357#define USER_ESID_BITS 16
358#define USER_ESID_BITS_1T 4
325 359
326#define USER_VSID_RANGE (1UL << (USER_ESID_BITS + SID_SHIFT)) 360#define USER_VSID_RANGE (1UL << (USER_ESID_BITS + SID_SHIFT))
327 361
@@ -335,17 +369,17 @@ extern void slb_vmalloc_update(void);
335 * rx = scratch register (clobbered) 369 * rx = scratch register (clobbered)
336 * 370 *
337 * - rt and rx must be different registers 371 * - rt and rx must be different registers
338 * - The answer will end up in the low 36 bits of rt. The higher 372 * - The answer will end up in the low VSID_BITS bits of rt. The higher
339 * bits may contain other garbage, so you may need to mask the 373 * bits may contain other garbage, so you may need to mask the
340 * result. 374 * result.
341 */ 375 */
342#define ASM_VSID_SCRAMBLE(rt, rx) \ 376#define ASM_VSID_SCRAMBLE(rt, rx, size) \
343 lis rx,VSID_MULTIPLIER@h; \ 377 lis rx,VSID_MULTIPLIER_##size@h; \
344 ori rx,rx,VSID_MULTIPLIER@l; \ 378 ori rx,rx,VSID_MULTIPLIER_##size@l; \
345 mulld rt,rt,rx; /* rt = rt * MULTIPLIER */ \ 379 mulld rt,rt,rx; /* rt = rt * MULTIPLIER */ \
346 \ 380 \
347 srdi rx,rt,VSID_BITS; \ 381 srdi rx,rt,VSID_BITS_##size; \
348 clrldi rt,rt,(64-VSID_BITS); \ 382 clrldi rt,rt,(64-VSID_BITS_##size); \
349 add rt,rt,rx; /* add high and low bits */ \ 383 add rt,rt,rx; /* add high and low bits */ \
350 /* Now, r3 == VSID (mod 2^36-1), and lies between 0 and \ 384 /* Now, r3 == VSID (mod 2^36-1), and lies between 0 and \
351 * 2^36-1+2^28-1. That in particular means that if r3 >= \ 385 * 2^36-1+2^28-1. That in particular means that if r3 >= \
@@ -354,7 +388,7 @@ extern void slb_vmalloc_update(void);
354 * doesn't, the answer is the low 36 bits of r3+1. So in all \ 388 * doesn't, the answer is the low 36 bits of r3+1. So in all \
355 * cases the answer is the low 36 bits of (r3 + ((r3+1) >> 36))*/\ 389 * cases the answer is the low 36 bits of (r3 + ((r3+1) >> 36))*/\
356 addi rx,rt,1; \ 390 addi rx,rt,1; \
357 srdi rx,rx,VSID_BITS; /* extract 2^36 bit */ \ 391 srdi rx,rx,VSID_BITS_##size; /* extract 2^VSID_BITS bit */ \
358 add rt,rt,rx 392 add rt,rt,rx
359 393
360 394
@@ -376,37 +410,60 @@ typedef struct {
376} mm_context_t; 410} mm_context_t;
377 411
378 412
379static inline unsigned long vsid_scramble(unsigned long protovsid)
380{
381#if 0 413#if 0
382 /* The code below is equivalent to this function for arguments 414/*
383 * < 2^VSID_BITS, which is all this should ever be called 415 * The code below is equivalent to this function for arguments
384 * with. However gcc is not clever enough to compute the 416 * < 2^VSID_BITS, which is all this should ever be called
385 * modulus (2^n-1) without a second multiply. */ 417 * with. However gcc is not clever enough to compute the
386 return ((protovsid * VSID_MULTIPLIER) % VSID_MODULUS); 418 * modulus (2^n-1) without a second multiply.
387#else /* 1 */ 419 */
388 unsigned long x; 420#define vsid_scrample(protovsid, size) \
421 ((((protovsid) * VSID_MULTIPLIER_##size) % VSID_MODULUS_##size))
389 422
390 x = protovsid * VSID_MULTIPLIER; 423#else /* 1 */
391 x = (x >> VSID_BITS) + (x & VSID_MODULUS); 424#define vsid_scramble(protovsid, size) \
392 return (x + ((x+1) >> VSID_BITS)) & VSID_MODULUS; 425 ({ \
426 unsigned long x; \
427 x = (protovsid) * VSID_MULTIPLIER_##size; \
428 x = (x >> VSID_BITS_##size) + (x & VSID_MODULUS_##size); \
429 (x + ((x+1) >> VSID_BITS_##size)) & VSID_MODULUS_##size; \
430 })
393#endif /* 1 */ 431#endif /* 1 */
394}
395 432
396/* This is only valid for addresses >= KERNELBASE */ 433/* This is only valid for addresses >= KERNELBASE */
397static inline unsigned long get_kernel_vsid(unsigned long ea) 434static inline unsigned long get_kernel_vsid(unsigned long ea, int ssize)
398{ 435{
399 return vsid_scramble(ea >> SID_SHIFT); 436 if (ssize == MMU_SEGSIZE_256M)
437 return vsid_scramble(ea >> SID_SHIFT, 256M);
438 return vsid_scramble(ea >> SID_SHIFT_1T, 1T);
400} 439}
401 440
402/* This is only valid for user addresses (which are below 2^41) */ 441/* Returns the segment size indicator for a user address */
403static inline unsigned long get_vsid(unsigned long context, unsigned long ea) 442static inline int user_segment_size(unsigned long addr)
404{ 443{
405 return vsid_scramble((context << USER_ESID_BITS) 444 /* Use 1T segments if possible for addresses >= 1T */
406 | (ea >> SID_SHIFT)); 445 if (addr >= (1UL << SID_SHIFT_1T))
446 return mmu_highuser_ssize;
447 return MMU_SEGSIZE_256M;
407} 448}
408 449
409#define VSID_SCRAMBLE(pvsid) (((pvsid) * VSID_MULTIPLIER) % VSID_MODULUS) 450/* This is only valid for user addresses (which are below 2^44) */
451static inline unsigned long get_vsid(unsigned long context, unsigned long ea,
452 int ssize)
453{
454 if (ssize == MMU_SEGSIZE_256M)
455 return vsid_scramble((context << USER_ESID_BITS)
456 | (ea >> SID_SHIFT), 256M);
457 return vsid_scramble((context << USER_ESID_BITS_1T)
458 | (ea >> SID_SHIFT_1T), 1T);
459}
460
461/*
462 * This is only used on legacy iSeries in lparmap.c,
463 * hence the 256MB segment assumption.
464 */
465#define VSID_SCRAMBLE(pvsid) (((pvsid) * VSID_MULTIPLIER_256M) % \
466 VSID_MODULUS_256M)
410#define KERNEL_VSID(ea) VSID_SCRAMBLE(GET_ESID(ea)) 467#define KERNEL_VSID(ea) VSID_SCRAMBLE(GET_ESID(ea))
411 468
412/* Physical address used by some IO functions */ 469/* Physical address used by some IO functions */
diff --git a/include/asm-powerpc/mmu.h b/include/asm-powerpc/mmu.h
index d44d211e7588..4c0e1b4f975c 100644
--- a/include/asm-powerpc/mmu.h
+++ b/include/asm-powerpc/mmu.h
@@ -8,6 +8,9 @@
8#elif defined(CONFIG_PPC_STD_MMU) 8#elif defined(CONFIG_PPC_STD_MMU)
9/* 32-bit classic hash table MMU */ 9/* 32-bit classic hash table MMU */
10# include <asm/mmu-hash32.h> 10# include <asm/mmu-hash32.h>
11#elif defined(CONFIG_40x)
12/* 40x-style software loaded TLB */
13# include <asm/mmu-40x.h>
11#elif defined(CONFIG_44x) 14#elif defined(CONFIG_44x)
12/* 44x-style software loaded TLB */ 15/* 44x-style software loaded TLB */
13# include <asm/mmu-44x.h> 16# include <asm/mmu-44x.h>
diff --git a/include/asm-powerpc/mpc52xx.h b/include/asm-powerpc/mpc52xx.h
index c4631f6dd4f9..24751df791ac 100644
--- a/include/asm-powerpc/mpc52xx.h
+++ b/include/asm-powerpc/mpc52xx.h
@@ -243,7 +243,7 @@ struct mpc52xx_cdm {
243 243
244extern void __iomem * mpc52xx_find_and_map(const char *); 244extern void __iomem * mpc52xx_find_and_map(const char *);
245extern unsigned int mpc52xx_find_ipb_freq(struct device_node *node); 245extern unsigned int mpc52xx_find_ipb_freq(struct device_node *node);
246extern void mpc52xx_setup_cpu(void); 246extern void mpc5200_setup_xlb_arbiter(void);
247extern void mpc52xx_declare_of_platform_devices(void); 247extern void mpc52xx_declare_of_platform_devices(void);
248 248
249extern void mpc52xx_init_irq(void); 249extern void mpc52xx_init_irq(void);
@@ -262,6 +262,16 @@ struct mpc52xx_suspend {
262extern struct mpc52xx_suspend mpc52xx_suspend; 262extern struct mpc52xx_suspend mpc52xx_suspend;
263extern int __init mpc52xx_pm_init(void); 263extern int __init mpc52xx_pm_init(void);
264extern int mpc52xx_set_wakeup_gpio(u8 pin, u8 level); 264extern int mpc52xx_set_wakeup_gpio(u8 pin, u8 level);
265
266#ifdef CONFIG_PPC_LITE5200
267extern int __init lite5200_pm_init(void);
268
269/* lite5200 calls mpc5200 suspend functions, so here they are */
270extern int mpc52xx_pm_prepare(suspend_state_t);
271extern int mpc52xx_pm_enter(suspend_state_t);
272extern int mpc52xx_pm_finish(suspend_state_t);
273extern char saved_sram[0x4000]; /* reuse buffer from mpc52xx suspend */
274#endif
265#endif /* CONFIG_PM */ 275#endif /* CONFIG_PM */
266 276
267#endif /* __ASM_POWERPC_MPC52xx_H__ */ 277#endif /* __ASM_POWERPC_MPC52xx_H__ */
diff --git a/include/asm-powerpc/mpc52xx_psc.h b/include/asm-powerpc/mpc52xx_psc.h
new file mode 100644
index 000000000000..26690d2b32f5
--- /dev/null
+++ b/include/asm-powerpc/mpc52xx_psc.h
@@ -0,0 +1,191 @@
1/*
2 * include/asm-ppc/mpc52xx_psc.h
3 *
4 * Definitions of consts/structs to drive the Freescale MPC52xx OnChip
5 * PSCs. Theses are shared between multiple drivers since a PSC can be
6 * UART, AC97, IR, I2S, ... So this header is in asm-ppc.
7 *
8 *
9 * Maintainer : Sylvain Munaut <tnt@246tNt.com>
10 *
11 * Based/Extracted from some header of the 2.4 originally written by
12 * Dale Farnsworth <dfarnsworth@mvista.com>
13 *
14 * Copyright (C) 2004 Sylvain Munaut <tnt@246tNt.com>
15 * Copyright (C) 2003 MontaVista, Software, Inc.
16 *
17 * This file is licensed under the terms of the GNU General Public License
18 * version 2. This program is licensed "as is" without any warranty of any
19 * kind, whether express or implied.
20 */
21
22#ifndef __ASM_MPC52xx_PSC_H__
23#define __ASM_MPC52xx_PSC_H__
24
25#include <asm/types.h>
26
27/* Max number of PSCs */
28#define MPC52xx_PSC_MAXNUM 6
29
30/* Programmable Serial Controller (PSC) status register bits */
31#define MPC52xx_PSC_SR_CDE 0x0080
32#define MPC52xx_PSC_SR_RXRDY 0x0100
33#define MPC52xx_PSC_SR_RXFULL 0x0200
34#define MPC52xx_PSC_SR_TXRDY 0x0400
35#define MPC52xx_PSC_SR_TXEMP 0x0800
36#define MPC52xx_PSC_SR_OE 0x1000
37#define MPC52xx_PSC_SR_PE 0x2000
38#define MPC52xx_PSC_SR_FE 0x4000
39#define MPC52xx_PSC_SR_RB 0x8000
40
41/* PSC Command values */
42#define MPC52xx_PSC_RX_ENABLE 0x0001
43#define MPC52xx_PSC_RX_DISABLE 0x0002
44#define MPC52xx_PSC_TX_ENABLE 0x0004
45#define MPC52xx_PSC_TX_DISABLE 0x0008
46#define MPC52xx_PSC_SEL_MODE_REG_1 0x0010
47#define MPC52xx_PSC_RST_RX 0x0020
48#define MPC52xx_PSC_RST_TX 0x0030
49#define MPC52xx_PSC_RST_ERR_STAT 0x0040
50#define MPC52xx_PSC_RST_BRK_CHG_INT 0x0050
51#define MPC52xx_PSC_START_BRK 0x0060
52#define MPC52xx_PSC_STOP_BRK 0x0070
53
54/* PSC TxRx FIFO status bits */
55#define MPC52xx_PSC_RXTX_FIFO_ERR 0x0040
56#define MPC52xx_PSC_RXTX_FIFO_UF 0x0020
57#define MPC52xx_PSC_RXTX_FIFO_OF 0x0010
58#define MPC52xx_PSC_RXTX_FIFO_FR 0x0008
59#define MPC52xx_PSC_RXTX_FIFO_FULL 0x0004
60#define MPC52xx_PSC_RXTX_FIFO_ALARM 0x0002
61#define MPC52xx_PSC_RXTX_FIFO_EMPTY 0x0001
62
63/* PSC interrupt mask bits */
64#define MPC52xx_PSC_IMR_TXRDY 0x0100
65#define MPC52xx_PSC_IMR_RXRDY 0x0200
66#define MPC52xx_PSC_IMR_DB 0x0400
67#define MPC52xx_PSC_IMR_IPC 0x8000
68
69/* PSC input port change bit */
70#define MPC52xx_PSC_CTS 0x01
71#define MPC52xx_PSC_DCD 0x02
72#define MPC52xx_PSC_D_CTS 0x10
73#define MPC52xx_PSC_D_DCD 0x20
74
75/* PSC mode fields */
76#define MPC52xx_PSC_MODE_5_BITS 0x00
77#define MPC52xx_PSC_MODE_6_BITS 0x01
78#define MPC52xx_PSC_MODE_7_BITS 0x02
79#define MPC52xx_PSC_MODE_8_BITS 0x03
80#define MPC52xx_PSC_MODE_BITS_MASK 0x03
81#define MPC52xx_PSC_MODE_PAREVEN 0x00
82#define MPC52xx_PSC_MODE_PARODD 0x04
83#define MPC52xx_PSC_MODE_PARFORCE 0x08
84#define MPC52xx_PSC_MODE_PARNONE 0x10
85#define MPC52xx_PSC_MODE_ERR 0x20
86#define MPC52xx_PSC_MODE_FFULL 0x40
87#define MPC52xx_PSC_MODE_RXRTS 0x80
88
89#define MPC52xx_PSC_MODE_ONE_STOP_5_BITS 0x00
90#define MPC52xx_PSC_MODE_ONE_STOP 0x07
91#define MPC52xx_PSC_MODE_TWO_STOP 0x0f
92
93#define MPC52xx_PSC_RFNUM_MASK 0x01ff
94
95
96/* Structure of the hardware registers */
97struct mpc52xx_psc {
98 u8 mode; /* PSC + 0x00 */
99 u8 reserved0[3];
100 union { /* PSC + 0x04 */
101 u16 status;
102 u16 clock_select;
103 } sr_csr;
104#define mpc52xx_psc_status sr_csr.status
105#define mpc52xx_psc_clock_select sr_csr.clock_select
106 u16 reserved1;
107 u8 command; /* PSC + 0x08 */
108 u8 reserved2[3];
109 union { /* PSC + 0x0c */
110 u8 buffer_8;
111 u16 buffer_16;
112 u32 buffer_32;
113 } buffer;
114#define mpc52xx_psc_buffer_8 buffer.buffer_8
115#define mpc52xx_psc_buffer_16 buffer.buffer_16
116#define mpc52xx_psc_buffer_32 buffer.buffer_32
117 union { /* PSC + 0x10 */
118 u8 ipcr;
119 u8 acr;
120 } ipcr_acr;
121#define mpc52xx_psc_ipcr ipcr_acr.ipcr
122#define mpc52xx_psc_acr ipcr_acr.acr
123 u8 reserved3[3];
124 union { /* PSC + 0x14 */
125 u16 isr;
126 u16 imr;
127 } isr_imr;
128#define mpc52xx_psc_isr isr_imr.isr
129#define mpc52xx_psc_imr isr_imr.imr
130 u16 reserved4;
131 u8 ctur; /* PSC + 0x18 */
132 u8 reserved5[3];
133 u8 ctlr; /* PSC + 0x1c */
134 u8 reserved6[3];
135 u16 ccr; /* PSC + 0x20 */
136 u8 reserved7[14];
137 u8 ivr; /* PSC + 0x30 */
138 u8 reserved8[3];
139 u8 ip; /* PSC + 0x34 */
140 u8 reserved9[3];
141 u8 op1; /* PSC + 0x38 */
142 u8 reserved10[3];
143 u8 op0; /* PSC + 0x3c */
144 u8 reserved11[3];
145 u32 sicr; /* PSC + 0x40 */
146 u8 ircr1; /* PSC + 0x44 */
147 u8 reserved13[3];
148 u8 ircr2; /* PSC + 0x44 */
149 u8 reserved14[3];
150 u8 irsdr; /* PSC + 0x4c */
151 u8 reserved15[3];
152 u8 irmdr; /* PSC + 0x50 */
153 u8 reserved16[3];
154 u8 irfdr; /* PSC + 0x54 */
155 u8 reserved17[3];
156 u16 rfnum; /* PSC + 0x58 */
157 u16 reserved18;
158 u16 tfnum; /* PSC + 0x5c */
159 u16 reserved19;
160 u32 rfdata; /* PSC + 0x60 */
161 u16 rfstat; /* PSC + 0x64 */
162 u16 reserved20;
163 u8 rfcntl; /* PSC + 0x68 */
164 u8 reserved21[5];
165 u16 rfalarm; /* PSC + 0x6e */
166 u16 reserved22;
167 u16 rfrptr; /* PSC + 0x72 */
168 u16 reserved23;
169 u16 rfwptr; /* PSC + 0x76 */
170 u16 reserved24;
171 u16 rflrfptr; /* PSC + 0x7a */
172 u16 reserved25;
173 u16 rflwfptr; /* PSC + 0x7e */
174 u32 tfdata; /* PSC + 0x80 */
175 u16 tfstat; /* PSC + 0x84 */
176 u16 reserved26;
177 u8 tfcntl; /* PSC + 0x88 */
178 u8 reserved27[5];
179 u16 tfalarm; /* PSC + 0x8e */
180 u16 reserved28;
181 u16 tfrptr; /* PSC + 0x92 */
182 u16 reserved29;
183 u16 tfwptr; /* PSC + 0x96 */
184 u16 reserved30;
185 u16 tflrfptr; /* PSC + 0x9a */
186 u16 reserved31;
187 u16 tflwfptr; /* PSC + 0x9e */
188};
189
190
191#endif /* __ASM_MPC52xx_PSC_H__ */
diff --git a/include/asm-powerpc/mpc85xx.h b/include/asm-powerpc/mpc85xx.h
deleted file mode 100644
index 54142997a584..000000000000
--- a/include/asm-powerpc/mpc85xx.h
+++ /dev/null
@@ -1,45 +0,0 @@
1/*
2 * include/asm-powerpc/mpc85xx.h
3 *
4 * MPC85xx definitions
5 *
6 * Maintainer: Kumar Gala <galak@kernel.crashing.org>
7 *
8 * Copyright 2004 Freescale Semiconductor, Inc
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 */
15
16#ifdef __KERNEL__
17#ifndef __ASM_MPC85xx_H__
18#define __ASM_MPC85xx_H__
19
20#include <asm/mmu.h>
21
22#ifdef CONFIG_85xx
23
24#if defined(CONFIG_MPC8540_ADS) || defined(CONFIG_MPC8560_ADS)
25#include <platforms/85xx/mpc85xx_ads.h>
26#endif
27#if defined(CONFIG_MPC8555_CDS) || defined(CONFIG_MPC8548_CDS)
28#include <platforms/85xx/mpc8555_cds.h>
29#endif
30#ifdef CONFIG_MPC85xx_CDS
31#include <platforms/85xx/mpc85xx_cds.h>
32#endif
33
34/* Let modules/drivers get at CCSRBAR */
35extern phys_addr_t get_ccsrbar(void);
36
37#ifdef MODULE
38#define CCSRBAR get_ccsrbar()
39#else
40#define CCSRBAR BOARD_CCSRBAR
41#endif
42
43#endif /* CONFIG_85xx */
44#endif /* __ASM_MPC85xx_H__ */
45#endif /* __KERNEL__ */
diff --git a/include/asm-powerpc/mpic.h b/include/asm-powerpc/mpic.h
index 262db6b8da73..ae84dde3bc7f 100644
--- a/include/asm-powerpc/mpic.h
+++ b/include/asm-powerpc/mpic.h
@@ -224,8 +224,6 @@ struct mpic_reg_bank {
224 u32 __iomem *base; 224 u32 __iomem *base;
225#ifdef CONFIG_PPC_DCR 225#ifdef CONFIG_PPC_DCR
226 dcr_host_t dhost; 226 dcr_host_t dhost;
227 unsigned int dbase;
228 unsigned int doff;
229#endif /* CONFIG_PPC_DCR */ 227#endif /* CONFIG_PPC_DCR */
230}; 228};
231 229
@@ -240,9 +238,6 @@ struct mpic_irq_save {
240/* The instance data of a given MPIC */ 238/* The instance data of a given MPIC */
241struct mpic 239struct mpic
242{ 240{
243 /* The device node of the interrupt controller */
244 struct device_node *of_node;
245
246 /* The remapper for this MPIC */ 241 /* The remapper for this MPIC */
247 struct irq_host *irqhost; 242 struct irq_host *irqhost;
248 243
@@ -292,10 +287,6 @@ struct mpic
292 struct mpic_reg_bank cpuregs[MPIC_MAX_CPUS]; 287 struct mpic_reg_bank cpuregs[MPIC_MAX_CPUS];
293 struct mpic_reg_bank isus[MPIC_MAX_ISU]; 288 struct mpic_reg_bank isus[MPIC_MAX_ISU];
294 289
295#ifdef CONFIG_PPC_DCR
296 unsigned int dcr_base;
297#endif
298
299 /* Protected sources */ 290 /* Protected sources */
300 unsigned long *protected; 291 unsigned long *protected;
301 292
@@ -309,6 +300,10 @@ struct mpic
309 unsigned long *hwirq_bitmap; 300 unsigned long *hwirq_bitmap;
310#endif 301#endif
311 302
303#ifdef CONFIG_MPIC_BROKEN_REGREAD
304 u32 isu_reg0_shadow[MPIC_MAX_IRQ_SOURCES];
305#endif
306
312 /* link */ 307 /* link */
313 struct mpic *next; 308 struct mpic *next;
314 309
diff --git a/include/asm-powerpc/nvram.h b/include/asm-powerpc/nvram.h
index f3563e11e260..9877982508bf 100644
--- a/include/asm-powerpc/nvram.h
+++ b/include/asm-powerpc/nvram.h
@@ -63,8 +63,10 @@ struct nvram_partition {
63}; 63};
64 64
65 65
66extern int nvram_write_error_log(char * buff, int length, unsigned int err_type); 66extern int nvram_write_error_log(char * buff, int length,
67extern int nvram_read_error_log(char * buff, int length, unsigned int * err_type); 67 unsigned int err_type, unsigned int err_seq);
68extern int nvram_read_error_log(char * buff, int length,
69 unsigned int * err_type, unsigned int *err_seq);
68extern int nvram_clear_error_log(void); 70extern int nvram_clear_error_log(void);
69extern struct nvram_partition *nvram_find_partition(int sig, const char *name); 71extern struct nvram_partition *nvram_find_partition(int sig, const char *name);
70 72
diff --git a/include/asm-powerpc/paca.h b/include/asm-powerpc/paca.h
index c6a5b1735666..fcd7b428ed0b 100644
--- a/include/asm-powerpc/paca.h
+++ b/include/asm-powerpc/paca.h
@@ -21,7 +21,18 @@
21#include <asm/mmu.h> 21#include <asm/mmu.h>
22 22
23register struct paca_struct *local_paca asm("r13"); 23register struct paca_struct *local_paca asm("r13");
24
25#if defined(CONFIG_DEBUG_PREEMPT) && defined(CONFIG_SMP)
26extern unsigned int debug_smp_processor_id(void); /* from linux/smp.h */
27/*
28 * Add standard checks that preemption cannot occur when using get_paca():
29 * otherwise the paca_struct it points to may be the wrong one just after.
30 */
31#define get_paca() ((void) debug_smp_processor_id(), local_paca)
32#else
24#define get_paca() local_paca 33#define get_paca() local_paca
34#endif
35
25#define get_lppaca() (get_paca()->lppaca_ptr) 36#define get_lppaca() (get_paca()->lppaca_ptr)
26#define get_slb_shadow() (get_paca()->slb_shadow_ptr) 37#define get_slb_shadow() (get_paca()->slb_shadow_ptr)
27 38
diff --git a/include/asm-powerpc/page_64.h b/include/asm-powerpc/page_64.h
index 3448a3d4bc64..4ee82c61e4d7 100644
--- a/include/asm-powerpc/page_64.h
+++ b/include/asm-powerpc/page_64.h
@@ -26,12 +26,18 @@
26 */ 26 */
27#define PAGE_FACTOR (PAGE_SHIFT - HW_PAGE_SHIFT) 27#define PAGE_FACTOR (PAGE_SHIFT - HW_PAGE_SHIFT)
28 28
29/* Segment size */ 29/* Segment size; normal 256M segments */
30#define SID_SHIFT 28 30#define SID_SHIFT 28
31#define SID_MASK 0xfffffffffUL 31#define SID_MASK ASM_CONST(0xfffffffff)
32#define ESID_MASK 0xfffffffff0000000UL 32#define ESID_MASK 0xfffffffff0000000UL
33#define GET_ESID(x) (((x) >> SID_SHIFT) & SID_MASK) 33#define GET_ESID(x) (((x) >> SID_SHIFT) & SID_MASK)
34 34
35/* 1T segments */
36#define SID_SHIFT_1T 40
37#define SID_MASK_1T 0xffffffUL
38#define ESID_MASK_1T 0xffffff0000000000UL
39#define GET_ESID_1T(x) (((x) >> SID_SHIFT_1T) & SID_MASK_1T)
40
35#ifndef __ASSEMBLY__ 41#ifndef __ASSEMBLY__
36#include <asm/cache.h> 42#include <asm/cache.h>
37 43
@@ -121,6 +127,7 @@ extern unsigned int get_slice_psize(struct mm_struct *mm,
121 127
122extern void slice_init_context(struct mm_struct *mm, unsigned int psize); 128extern void slice_init_context(struct mm_struct *mm, unsigned int psize);
123extern void slice_set_user_psize(struct mm_struct *mm, unsigned int psize); 129extern void slice_set_user_psize(struct mm_struct *mm, unsigned int psize);
130#define slice_mm_new_context(mm) ((mm)->context.id == 0)
124 131
125#define ARCH_HAS_HUGEPAGE_ONLY_RANGE 132#define ARCH_HAS_HUGEPAGE_ONLY_RANGE
126extern int is_hugepage_only_range(struct mm_struct *m, 133extern int is_hugepage_only_range(struct mm_struct *m,
@@ -130,6 +137,12 @@ extern int is_hugepage_only_range(struct mm_struct *m,
130#endif /* __ASSEMBLY__ */ 137#endif /* __ASSEMBLY__ */
131#else 138#else
132#define slice_init() 139#define slice_init()
140#define slice_set_user_psize(mm, psize) \
141do { \
142 (mm)->context.user_psize = (psize); \
143 (mm)->context.sllp = SLB_VSID_USER | mmu_psize_defs[(psize)].sllp; \
144} while (0)
145#define slice_mm_new_context(mm) 1
133#endif /* CONFIG_PPC_MM_SLICES */ 146#endif /* CONFIG_PPC_MM_SLICES */
134 147
135#ifdef CONFIG_HUGETLB_PAGE 148#ifdef CONFIG_HUGETLB_PAGE
diff --git a/include/asm-powerpc/pci-bridge.h b/include/asm-powerpc/pci-bridge.h
index e909769b6410..dc318458b5fe 100644
--- a/include/asm-powerpc/pci-bridge.h
+++ b/include/asm-powerpc/pci-bridge.h
@@ -98,7 +98,8 @@ extern int early_find_capability(struct pci_controller *hose, int bus,
98 int dev_fn, int cap); 98 int dev_fn, int cap);
99 99
100extern void setup_indirect_pci(struct pci_controller* hose, 100extern void setup_indirect_pci(struct pci_controller* hose,
101 u32 cfg_addr, u32 cfg_data, u32 flags); 101 resource_size_t cfg_addr,
102 resource_size_t cfg_data, u32 flags);
102extern void setup_grackle(struct pci_controller *hose); 103extern void setup_grackle(struct pci_controller *hose);
103extern void __init update_bridge_resource(struct pci_dev *dev, 104extern void __init update_bridge_resource(struct pci_dev *dev,
104 struct resource *res); 105 struct resource *res);
diff --git a/include/asm-powerpc/percpu.h b/include/asm-powerpc/percpu.h
index 73dc8ba4010d..6b229626d3ff 100644
--- a/include/asm-powerpc/percpu.h
+++ b/include/asm-powerpc/percpu.h
@@ -28,7 +28,7 @@
28/* var is in discarded region: offset to particular copy we want */ 28/* var is in discarded region: offset to particular copy we want */
29#define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset(cpu))) 29#define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset(cpu)))
30#define __get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __my_cpu_offset())) 30#define __get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __my_cpu_offset()))
31#define __raw_get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __my_cpu_offset())) 31#define __raw_get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, local_paca->data_offset))
32 32
33/* A macro to avoid #include hell... */ 33/* A macro to avoid #include hell... */
34#define percpu_modcopy(pcpudst, src, size) \ 34#define percpu_modcopy(pcpudst, src, size) \
diff --git a/include/asm-powerpc/pgtable-4k.h b/include/asm-powerpc/pgtable-4k.h
index add5481fd7c7..818e2abc81e2 100644
--- a/include/asm-powerpc/pgtable-4k.h
+++ b/include/asm-powerpc/pgtable-4k.h
@@ -10,10 +10,12 @@
10#define PUD_INDEX_SIZE 7 10#define PUD_INDEX_SIZE 7
11#define PGD_INDEX_SIZE 9 11#define PGD_INDEX_SIZE 9
12 12
13#ifndef __ASSEMBLY__
13#define PTE_TABLE_SIZE (sizeof(pte_t) << PTE_INDEX_SIZE) 14#define PTE_TABLE_SIZE (sizeof(pte_t) << PTE_INDEX_SIZE)
14#define PMD_TABLE_SIZE (sizeof(pmd_t) << PMD_INDEX_SIZE) 15#define PMD_TABLE_SIZE (sizeof(pmd_t) << PMD_INDEX_SIZE)
15#define PUD_TABLE_SIZE (sizeof(pud_t) << PUD_INDEX_SIZE) 16#define PUD_TABLE_SIZE (sizeof(pud_t) << PUD_INDEX_SIZE)
16#define PGD_TABLE_SIZE (sizeof(pgd_t) << PGD_INDEX_SIZE) 17#define PGD_TABLE_SIZE (sizeof(pgd_t) << PGD_INDEX_SIZE)
18#endif /* __ASSEMBLY__ */
17 19
18#define PTRS_PER_PTE (1 << PTE_INDEX_SIZE) 20#define PTRS_PER_PTE (1 << PTE_INDEX_SIZE)
19#define PTRS_PER_PMD (1 << PMD_INDEX_SIZE) 21#define PTRS_PER_PMD (1 << PMD_INDEX_SIZE)
diff --git a/include/asm-powerpc/pgtable-64k.h b/include/asm-powerpc/pgtable-64k.h
index 33ae9018fe72..bd54b772fbc6 100644
--- a/include/asm-powerpc/pgtable-64k.h
+++ b/include/asm-powerpc/pgtable-64k.h
@@ -9,9 +9,11 @@
9#define PUD_INDEX_SIZE 0 9#define PUD_INDEX_SIZE 0
10#define PGD_INDEX_SIZE 4 10#define PGD_INDEX_SIZE 4
11 11
12#ifndef __ASSEMBLY__
12#define PTE_TABLE_SIZE (sizeof(real_pte_t) << PTE_INDEX_SIZE) 13#define PTE_TABLE_SIZE (sizeof(real_pte_t) << PTE_INDEX_SIZE)
13#define PMD_TABLE_SIZE (sizeof(pmd_t) << PMD_INDEX_SIZE) 14#define PMD_TABLE_SIZE (sizeof(pmd_t) << PMD_INDEX_SIZE)
14#define PGD_TABLE_SIZE (sizeof(pgd_t) << PGD_INDEX_SIZE) 15#define PGD_TABLE_SIZE (sizeof(pgd_t) << PGD_INDEX_SIZE)
16#endif /* __ASSEMBLY__ */
15 17
16#define PTRS_PER_PTE (1 << PTE_INDEX_SIZE) 18#define PTRS_PER_PTE (1 << PTE_INDEX_SIZE)
17#define PTRS_PER_PMD (1 << PMD_INDEX_SIZE) 19#define PTRS_PER_PMD (1 << PMD_INDEX_SIZE)
diff --git a/include/asm-powerpc/ppc_asm.h b/include/asm-powerpc/ppc_asm.h
index 65325721446d..2dbd4e7884fa 100644
--- a/include/asm-powerpc/ppc_asm.h
+++ b/include/asm-powerpc/ppc_asm.h
@@ -155,6 +155,20 @@ name: \
155 .type GLUE(.,name),@function; \ 155 .type GLUE(.,name),@function; \
156GLUE(.,name): 156GLUE(.,name):
157 157
158#define _INIT_GLOBAL(name) \
159 .section ".text.init.refok"; \
160 .align 2 ; \
161 .globl name; \
162 .globl GLUE(.,name); \
163 .section ".opd","aw"; \
164name: \
165 .quad GLUE(.,name); \
166 .quad .TOC.@tocbase; \
167 .quad 0; \
168 .previous; \
169 .type GLUE(.,name),@function; \
170GLUE(.,name):
171
158#define _KPROBE(name) \ 172#define _KPROBE(name) \
159 .section ".kprobes.text","a"; \ 173 .section ".kprobes.text","a"; \
160 .align 2 ; \ 174 .align 2 ; \
@@ -195,6 +209,10 @@ GLUE(.,name):
195 209
196#else /* 32-bit */ 210#else /* 32-bit */
197 211
212#define _ENTRY(n) \
213 .globl n; \
214n:
215
198#define _GLOBAL(n) \ 216#define _GLOBAL(n) \
199 .text; \ 217 .text; \
200 .stabs __stringify(n:F-1),N_FUN,0,0,n;\ 218 .stabs __stringify(n:F-1),N_FUN,0,0,n;\
diff --git a/include/asm-powerpc/processor.h b/include/asm-powerpc/processor.h
index e28b10805159..dba7c948189d 100644
--- a/include/asm-powerpc/processor.h
+++ b/include/asm-powerpc/processor.h
@@ -145,9 +145,9 @@ struct thread_struct {
145 unsigned long dabr; /* Data address breakpoint register */ 145 unsigned long dabr; /* Data address breakpoint register */
146#ifdef CONFIG_ALTIVEC 146#ifdef CONFIG_ALTIVEC
147 /* Complete AltiVec register set */ 147 /* Complete AltiVec register set */
148 vector128 vr[32] __attribute((aligned(16))); 148 vector128 vr[32] __attribute__((aligned(16)));
149 /* AltiVec status */ 149 /* AltiVec status */
150 vector128 vscr __attribute((aligned(16))); 150 vector128 vscr __attribute__((aligned(16)));
151 unsigned long vrsave; 151 unsigned long vrsave;
152 int used_vr; /* set if process has used altivec */ 152 int used_vr; /* set if process has used altivec */
153#endif /* CONFIG_ALTIVEC */ 153#endif /* CONFIG_ALTIVEC */
diff --git a/include/asm-powerpc/prom.h b/include/asm-powerpc/prom.h
index 672083787a1d..925e2d384bb3 100644
--- a/include/asm-powerpc/prom.h
+++ b/include/asm-powerpc/prom.h
@@ -24,7 +24,7 @@
24#define OF_ROOT_NODE_ADDR_CELLS_DEFAULT 1 24#define OF_ROOT_NODE_ADDR_CELLS_DEFAULT 1
25#define OF_ROOT_NODE_SIZE_CELLS_DEFAULT 1 25#define OF_ROOT_NODE_SIZE_CELLS_DEFAULT 1
26 26
27#define of_compat_cmp(s1, s2, l) strncasecmp((s1), (s2), (l)) 27#define of_compat_cmp(s1, s2, l) strcasecmp((s1), (s2))
28#define of_prop_cmp(s1, s2) strcmp((s1), (s2)) 28#define of_prop_cmp(s1, s2) strcmp((s1), (s2))
29#define of_node_cmp(s1, s2) strcasecmp((s1), (s2)) 29#define of_node_cmp(s1, s2) strcasecmp((s1), (s2))
30 30
@@ -145,7 +145,6 @@ extern void of_detach_node(struct device_node *);
145extern void finish_device_tree(void); 145extern void finish_device_tree(void);
146extern void unflatten_device_tree(void); 146extern void unflatten_device_tree(void);
147extern void early_init_devtree(void *); 147extern void early_init_devtree(void *);
148#define device_is_compatible(d, c) of_device_is_compatible((d), (c))
149extern int machine_is_compatible(const char *compat); 148extern int machine_is_compatible(const char *compat);
150extern void print_properties(struct device_node *node); 149extern void print_properties(struct device_node *node);
151extern int prom_n_intr_cells(struct device_node* np); 150extern int prom_n_intr_cells(struct device_node* np);
diff --git a/include/asm-powerpc/ps3.h b/include/asm-powerpc/ps3.h
index a6f3f5ee7ca7..f577a16c6728 100644
--- a/include/asm-powerpc/ps3.h
+++ b/include/asm-powerpc/ps3.h
@@ -229,6 +229,9 @@ enum lv1_result {
229 LV1_INVALID_CLASS_ID = -21, 229 LV1_INVALID_CLASS_ID = -21,
230 LV1_CONSTRAINT_NOT_SATISFIED = -22, 230 LV1_CONSTRAINT_NOT_SATISFIED = -22,
231 LV1_ALIGNMENT_ERROR = -23, 231 LV1_ALIGNMENT_ERROR = -23,
232 LV1_HARDWARE_ERROR = -24,
233 LV1_INVALID_DATA_FORMAT = -25,
234 LV1_INVALID_OPERATION = -26,
232 LV1_INTERNAL_ERROR = -32768, 235 LV1_INTERNAL_ERROR = -32768,
233}; 236};
234 237
@@ -284,6 +287,12 @@ static inline const char* ps3_result(int result)
284 return "LV1_CONSTRAINT_NOT_SATISFIED (-22)"; 287 return "LV1_CONSTRAINT_NOT_SATISFIED (-22)";
285 case LV1_ALIGNMENT_ERROR: 288 case LV1_ALIGNMENT_ERROR:
286 return "LV1_ALIGNMENT_ERROR (-23)"; 289 return "LV1_ALIGNMENT_ERROR (-23)";
290 case LV1_HARDWARE_ERROR:
291 return "LV1_HARDWARE_ERROR (-24)";
292 case LV1_INVALID_DATA_FORMAT:
293 return "LV1_INVALID_DATA_FORMAT (-25)";
294 case LV1_INVALID_OPERATION:
295 return "LV1_INVALID_OPERATION (-26)";
287 case LV1_INTERNAL_ERROR: 296 case LV1_INTERNAL_ERROR:
288 return "LV1_INTERNAL_ERROR (-32768)"; 297 return "LV1_INTERNAL_ERROR (-32768)";
289 default: 298 default:
diff --git a/include/asm-powerpc/qe.h b/include/asm-powerpc/qe.h
index 9d304b1f1608..0dabe46a29d2 100644
--- a/include/asm-powerpc/qe.h
+++ b/include/asm-powerpc/qe.h
@@ -32,10 +32,13 @@
32extern void qe_reset(void); 32extern void qe_reset(void);
33extern int par_io_init(struct device_node *np); 33extern int par_io_init(struct device_node *np);
34extern int par_io_of_config(struct device_node *np); 34extern int par_io_of_config(struct device_node *np);
35extern int par_io_config_pin(u8 port, u8 pin, int dir, int open_drain,
36 int assignment, int has_irq);
37extern int par_io_data_set(u8 port, u8 pin, u8 val);
35 38
36/* QE internal API */ 39/* QE internal API */
37int qe_issue_cmd(u32 cmd, u32 device, u8 mcn_protocol, u32 cmd_input); 40int qe_issue_cmd(u32 cmd, u32 device, u8 mcn_protocol, u32 cmd_input);
38void qe_setbrg(u32 brg, u32 rate); 41void qe_setbrg(unsigned int brg, unsigned int rate, unsigned int multiplier);
39int qe_get_snum(void); 42int qe_get_snum(void);
40void qe_put_snum(u8 snum); 43void qe_put_snum(u8 snum);
41unsigned long qe_muram_alloc(int size, int align); 44unsigned long qe_muram_alloc(int size, int align);
@@ -46,14 +49,28 @@ void *qe_muram_addr(unsigned long offset);
46 49
47/* Buffer descriptors */ 50/* Buffer descriptors */
48struct qe_bd { 51struct qe_bd {
49 u16 status; 52 __be16 status;
50 u16 length; 53 __be16 length;
51 u32 buf; 54 __be32 buf;
52} __attribute__ ((packed)); 55} __attribute__ ((packed));
53 56
54#define BD_STATUS_MASK 0xffff0000 57#define BD_STATUS_MASK 0xffff0000
55#define BD_LENGTH_MASK 0x0000ffff 58#define BD_LENGTH_MASK 0x0000ffff
56 59
60#define BD_SC_EMPTY 0x8000 /* Receive is empty */
61#define BD_SC_READY 0x8000 /* Transmit is ready */
62#define BD_SC_WRAP 0x2000 /* Last buffer descriptor */
63#define BD_SC_INTRPT 0x1000 /* Interrupt on change */
64#define BD_SC_LAST 0x0800 /* Last buffer in frame */
65#define BD_SC_CM 0x0200 /* Continous mode */
66#define BD_SC_ID 0x0100 /* Rec'd too many idles */
67#define BD_SC_P 0x0100 /* xmt preamble */
68#define BD_SC_BR 0x0020 /* Break received */
69#define BD_SC_FR 0x0010 /* Framing error */
70#define BD_SC_PR 0x0008 /* Parity error */
71#define BD_SC_OV 0x0002 /* Overrun */
72#define BD_SC_CD 0x0001 /* ?? */
73
57/* Alignment */ 74/* Alignment */
58#define QE_INTR_TABLE_ALIGN 16 /* ??? */ 75#define QE_INTR_TABLE_ALIGN 16 /* ??? */
59#define QE_ALIGNMENT_OF_BD 8 76#define QE_ALIGNMENT_OF_BD 8
@@ -266,15 +283,12 @@ enum qe_clock {
266/* QE CECR Protocol - For non-MCC, specifies mode for QE CECR command */ 283/* QE CECR Protocol - For non-MCC, specifies mode for QE CECR command */
267#define QE_CR_PROTOCOL_UNSPECIFIED 0x00 /* For all other protocols */ 284#define QE_CR_PROTOCOL_UNSPECIFIED 0x00 /* For all other protocols */
268#define QE_CR_PROTOCOL_HDLC_TRANSPARENT 0x00 285#define QE_CR_PROTOCOL_HDLC_TRANSPARENT 0x00
286#define QE_CR_PROTOCOL_QMC 0x02
287#define QE_CR_PROTOCOL_UART 0x04
269#define QE_CR_PROTOCOL_ATM_POS 0x0A 288#define QE_CR_PROTOCOL_ATM_POS 0x0A
270#define QE_CR_PROTOCOL_ETHERNET 0x0C 289#define QE_CR_PROTOCOL_ETHERNET 0x0C
271#define QE_CR_PROTOCOL_L2_SWITCH 0x0D 290#define QE_CR_PROTOCOL_L2_SWITCH 0x0D
272 291
273/* BMR byte order */
274#define QE_BMR_BYTE_ORDER_BO_PPC 0x08 /* powerpc little endian */
275#define QE_BMR_BYTE_ORDER_BO_MOT 0x10 /* motorola big endian */
276#define QE_BMR_BYTE_ORDER_BO_MAX 0x18
277
278/* BRG configuration register */ 292/* BRG configuration register */
279#define QE_BRGC_ENABLE 0x00010000 293#define QE_BRGC_ENABLE 0x00010000
280#define QE_BRGC_DIVISOR_SHIFT 1 294#define QE_BRGC_DIVISOR_SHIFT 1
@@ -321,41 +335,41 @@ enum qe_clock {
321#define UPGCR_ADDR 0x10000000 /* Master MPHY Addr multiplexing */ 335#define UPGCR_ADDR 0x10000000 /* Master MPHY Addr multiplexing */
322#define UPGCR_DIAG 0x01000000 /* Diagnostic mode */ 336#define UPGCR_DIAG 0x01000000 /* Diagnostic mode */
323 337
324/* UCC */ 338/* UCC GUEMR register */
325#define UCC_GUEMR_MODE_MASK_RX 0x02 339#define UCC_GUEMR_MODE_MASK_RX 0x02
326#define UCC_GUEMR_MODE_MASK_TX 0x01
327#define UCC_GUEMR_MODE_FAST_RX 0x02 340#define UCC_GUEMR_MODE_FAST_RX 0x02
328#define UCC_GUEMR_MODE_FAST_TX 0x01
329#define UCC_GUEMR_MODE_SLOW_RX 0x00 341#define UCC_GUEMR_MODE_SLOW_RX 0x00
342#define UCC_GUEMR_MODE_MASK_TX 0x01
343#define UCC_GUEMR_MODE_FAST_TX 0x01
330#define UCC_GUEMR_MODE_SLOW_TX 0x00 344#define UCC_GUEMR_MODE_SLOW_TX 0x00
345#define UCC_GUEMR_MODE_MASK (UCC_GUEMR_MODE_MASK_RX | UCC_GUEMR_MODE_MASK_TX)
331#define UCC_GUEMR_SET_RESERVED3 0x10 /* Bit 3 in the guemr is reserved but 346#define UCC_GUEMR_SET_RESERVED3 0x10 /* Bit 3 in the guemr is reserved but
332 must be set 1 */ 347 must be set 1 */
333 348
334/* structure representing UCC SLOW parameter RAM */ 349/* structure representing UCC SLOW parameter RAM */
335struct ucc_slow_pram { 350struct ucc_slow_pram {
336 u16 rbase; /* RX BD base address */ 351 __be16 rbase; /* RX BD base address */
337 u16 tbase; /* TX BD base address */ 352 __be16 tbase; /* TX BD base address */
338 u8 rfcr; /* Rx function code */ 353 u8 rbmr; /* RX bus mode register (same as CPM's RFCR) */
339 u8 tfcr; /* Tx function code */ 354 u8 tbmr; /* TX bus mode register (same as CPM's TFCR) */
340 u16 mrblr; /* Rx buffer length */ 355 __be16 mrblr; /* Rx buffer length */
341 u32 rstate; /* Rx internal state */ 356 __be32 rstate; /* Rx internal state */
342 u32 rptr; /* Rx internal data pointer */ 357 __be32 rptr; /* Rx internal data pointer */
343 u16 rbptr; /* rb BD Pointer */ 358 __be16 rbptr; /* rb BD Pointer */
344 u16 rcount; /* Rx internal byte count */ 359 __be16 rcount; /* Rx internal byte count */
345 u32 rtemp; /* Rx temp */ 360 __be32 rtemp; /* Rx temp */
346 u32 tstate; /* Tx internal state */ 361 __be32 tstate; /* Tx internal state */
347 u32 tptr; /* Tx internal data pointer */ 362 __be32 tptr; /* Tx internal data pointer */
348 u16 tbptr; /* Tx BD pointer */ 363 __be16 tbptr; /* Tx BD pointer */
349 u16 tcount; /* Tx byte count */ 364 __be16 tcount; /* Tx byte count */
350 u32 ttemp; /* Tx temp */ 365 __be32 ttemp; /* Tx temp */
351 u32 rcrc; /* temp receive CRC */ 366 __be32 rcrc; /* temp receive CRC */
352 u32 tcrc; /* temp transmit CRC */ 367 __be32 tcrc; /* temp transmit CRC */
353} __attribute__ ((packed)); 368} __attribute__ ((packed));
354 369
355/* General UCC SLOW Mode Register (GUMRH & GUMRL) */ 370/* General UCC SLOW Mode Register (GUMRH & GUMRL) */
356#define UCC_SLOW_GUMR_H_CRC16 0x00004000 371#define UCC_SLOW_GUMR_H_SAM_QMC 0x00000000
357#define UCC_SLOW_GUMR_H_CRC16CCITT 0x00000000 372#define UCC_SLOW_GUMR_H_SAM_SATM 0x00008000
358#define UCC_SLOW_GUMR_H_CRC32CCITT 0x00008000
359#define UCC_SLOW_GUMR_H_REVD 0x00002000 373#define UCC_SLOW_GUMR_H_REVD 0x00002000
360#define UCC_SLOW_GUMR_H_TRX 0x00001000 374#define UCC_SLOW_GUMR_H_TRX 0x00001000
361#define UCC_SLOW_GUMR_H_TTX 0x00000800 375#define UCC_SLOW_GUMR_H_TTX 0x00000800
@@ -375,9 +389,33 @@ struct ucc_slow_pram {
375#define UCC_SLOW_GUMR_L_TCI 0x10000000 389#define UCC_SLOW_GUMR_L_TCI 0x10000000
376#define UCC_SLOW_GUMR_L_RINV 0x02000000 390#define UCC_SLOW_GUMR_L_RINV 0x02000000
377#define UCC_SLOW_GUMR_L_TINV 0x01000000 391#define UCC_SLOW_GUMR_L_TINV 0x01000000
378#define UCC_SLOW_GUMR_L_TEND 0x00020000 392#define UCC_SLOW_GUMR_L_TEND 0x00040000
393#define UCC_SLOW_GUMR_L_TDCR_MASK 0x00030000
394#define UCC_SLOW_GUMR_L_TDCR_32 0x00030000
395#define UCC_SLOW_GUMR_L_TDCR_16 0x00020000
396#define UCC_SLOW_GUMR_L_TDCR_8 0x00010000
397#define UCC_SLOW_GUMR_L_TDCR_1 0x00000000
398#define UCC_SLOW_GUMR_L_RDCR_MASK 0x0000c000
399#define UCC_SLOW_GUMR_L_RDCR_32 0x0000c000
400#define UCC_SLOW_GUMR_L_RDCR_16 0x00008000
401#define UCC_SLOW_GUMR_L_RDCR_8 0x00004000
402#define UCC_SLOW_GUMR_L_RDCR_1 0x00000000
403#define UCC_SLOW_GUMR_L_RENC_NRZI 0x00000800
404#define UCC_SLOW_GUMR_L_RENC_NRZ 0x00000000
405#define UCC_SLOW_GUMR_L_TENC_NRZI 0x00000100
406#define UCC_SLOW_GUMR_L_TENC_NRZ 0x00000000
407#define UCC_SLOW_GUMR_L_DIAG_MASK 0x000000c0
408#define UCC_SLOW_GUMR_L_DIAG_LE 0x000000c0
409#define UCC_SLOW_GUMR_L_DIAG_ECHO 0x00000080
410#define UCC_SLOW_GUMR_L_DIAG_LOOP 0x00000040
411#define UCC_SLOW_GUMR_L_DIAG_NORM 0x00000000
379#define UCC_SLOW_GUMR_L_ENR 0x00000020 412#define UCC_SLOW_GUMR_L_ENR 0x00000020
380#define UCC_SLOW_GUMR_L_ENT 0x00000010 413#define UCC_SLOW_GUMR_L_ENT 0x00000010
414#define UCC_SLOW_GUMR_L_MODE_MASK 0x0000000F
415#define UCC_SLOW_GUMR_L_MODE_BISYNC 0x00000008
416#define UCC_SLOW_GUMR_L_MODE_AHDLC 0x00000006
417#define UCC_SLOW_GUMR_L_MODE_UART 0x00000004
418#define UCC_SLOW_GUMR_L_MODE_QMC 0x00000002
381 419
382/* General UCC FAST Mode Register */ 420/* General UCC FAST Mode Register */
383#define UCC_FAST_GUMR_TCI 0x20000000 421#define UCC_FAST_GUMR_TCI 0x20000000
@@ -394,53 +432,111 @@ struct ucc_slow_pram {
394#define UCC_FAST_GUMR_ENR 0x00000020 432#define UCC_FAST_GUMR_ENR 0x00000020
395#define UCC_FAST_GUMR_ENT 0x00000010 433#define UCC_FAST_GUMR_ENT 0x00000010
396 434
397/* Slow UCC Event Register (UCCE) */ 435/* UART Slow UCC Event Register (UCCE) */
398#define UCC_SLOW_UCCE_GLR 0x1000 436#define UCC_UART_UCCE_AB 0x0200
399#define UCC_SLOW_UCCE_GLT 0x0800 437#define UCC_UART_UCCE_IDLE 0x0100
400#define UCC_SLOW_UCCE_DCC 0x0400 438#define UCC_UART_UCCE_GRA 0x0080
401#define UCC_SLOW_UCCE_FLG 0x0200 439#define UCC_UART_UCCE_BRKE 0x0040
402#define UCC_SLOW_UCCE_AB 0x0200 440#define UCC_UART_UCCE_BRKS 0x0020
403#define UCC_SLOW_UCCE_IDLE 0x0100 441#define UCC_UART_UCCE_CCR 0x0008
404#define UCC_SLOW_UCCE_GRA 0x0080 442#define UCC_UART_UCCE_BSY 0x0004
405#define UCC_SLOW_UCCE_TXE 0x0010 443#define UCC_UART_UCCE_TX 0x0002
406#define UCC_SLOW_UCCE_RXF 0x0008 444#define UCC_UART_UCCE_RX 0x0001
407#define UCC_SLOW_UCCE_CCR 0x0008 445
408#define UCC_SLOW_UCCE_RCH 0x0008 446/* HDLC Slow UCC Event Register (UCCE) */
409#define UCC_SLOW_UCCE_BSY 0x0004 447#define UCC_HDLC_UCCE_GLR 0x1000
410#define UCC_SLOW_UCCE_TXB 0x0002 448#define UCC_HDLC_UCCE_GLT 0x0800
411#define UCC_SLOW_UCCE_TX 0x0002 449#define UCC_HDLC_UCCE_IDLE 0x0100
412#define UCC_SLOW_UCCE_RX 0x0001 450#define UCC_HDLC_UCCE_BRKE 0x0040
413#define UCC_SLOW_UCCE_GOV 0x0001 451#define UCC_HDLC_UCCE_BRKS 0x0020
414#define UCC_SLOW_UCCE_GUN 0x0002 452#define UCC_HDLC_UCCE_TXE 0x0010
415#define UCC_SLOW_UCCE_GINT 0x0004 453#define UCC_HDLC_UCCE_RXF 0x0008
416#define UCC_SLOW_UCCE_IQOV 0x0008 454#define UCC_HDLC_UCCE_BSY 0x0004
417 455#define UCC_HDLC_UCCE_TXB 0x0002
418#define UCC_SLOW_UCCE_HDLC_SET (UCC_SLOW_UCCE_TXE | UCC_SLOW_UCCE_BSY | \ 456#define UCC_HDLC_UCCE_RXB 0x0001
419 UCC_SLOW_UCCE_GRA | UCC_SLOW_UCCE_TXB | UCC_SLOW_UCCE_RXF | \ 457
420 UCC_SLOW_UCCE_DCC | UCC_SLOW_UCCE_GLT | UCC_SLOW_UCCE_GLR) 458/* BISYNC Slow UCC Event Register (UCCE) */
421#define UCC_SLOW_UCCE_ENET_SET (UCC_SLOW_UCCE_TXE | UCC_SLOW_UCCE_BSY | \ 459#define UCC_BISYNC_UCCE_GRA 0x0080
422 UCC_SLOW_UCCE_GRA | UCC_SLOW_UCCE_TXB | UCC_SLOW_UCCE_RXF) 460#define UCC_BISYNC_UCCE_TXE 0x0010
423#define UCC_SLOW_UCCE_TRANS_SET (UCC_SLOW_UCCE_TXE | UCC_SLOW_UCCE_BSY | \ 461#define UCC_BISYNC_UCCE_RCH 0x0008
424 UCC_SLOW_UCCE_GRA | UCC_SLOW_UCCE_TX | UCC_SLOW_UCCE_RX | \ 462#define UCC_BISYNC_UCCE_BSY 0x0004
425 UCC_SLOW_UCCE_DCC | UCC_SLOW_UCCE_GLT | UCC_SLOW_UCCE_GLR) 463#define UCC_BISYNC_UCCE_TXB 0x0002
426#define UCC_SLOW_UCCE_UART_SET (UCC_SLOW_UCCE_BSY | UCC_SLOW_UCCE_GRA | \ 464#define UCC_BISYNC_UCCE_RXB 0x0001
427 UCC_SLOW_UCCE_TXB | UCC_SLOW_UCCE_TX | UCC_SLOW_UCCE_RX | \ 465
428 UCC_SLOW_UCCE_GLT | UCC_SLOW_UCCE_GLR) 466/* Gigabit Ethernet Fast UCC Event Register (UCCE) */
429#define UCC_SLOW_UCCE_QMC_SET (UCC_SLOW_UCCE_IQOV | UCC_SLOW_UCCE_GINT | \ 467#define UCC_GETH_UCCE_MPD 0x80000000
430 UCC_SLOW_UCCE_GUN | UCC_SLOW_UCCE_GOV) 468#define UCC_GETH_UCCE_SCAR 0x40000000
431 469#define UCC_GETH_UCCE_GRA 0x20000000
432#define UCC_SLOW_UCCE_OTHER (UCC_SLOW_UCCE_TXE | UCC_SLOW_UCCE_BSY | \ 470#define UCC_GETH_UCCE_CBPR 0x10000000
433 UCC_SLOW_UCCE_GRA | UCC_SLOW_UCCE_DCC | UCC_SLOW_UCCE_GLT | \ 471#define UCC_GETH_UCCE_BSY 0x08000000
434 UCC_SLOW_UCCE_GLR) 472#define UCC_GETH_UCCE_RXC 0x04000000
435 473#define UCC_GETH_UCCE_TXC 0x02000000
436#define UCC_SLOW_INTR_TX UCC_SLOW_UCCE_TXB 474#define UCC_GETH_UCCE_TXE 0x01000000
437#define UCC_SLOW_INTR_RX (UCC_SLOW_UCCE_RXF | UCC_SLOW_UCCE_RX) 475#define UCC_GETH_UCCE_TXB7 0x00800000
438#define UCC_SLOW_INTR (UCC_SLOW_INTR_TX | UCC_SLOW_INTR_RX) 476#define UCC_GETH_UCCE_TXB6 0x00400000
477#define UCC_GETH_UCCE_TXB5 0x00200000
478#define UCC_GETH_UCCE_TXB4 0x00100000
479#define UCC_GETH_UCCE_TXB3 0x00080000
480#define UCC_GETH_UCCE_TXB2 0x00040000
481#define UCC_GETH_UCCE_TXB1 0x00020000
482#define UCC_GETH_UCCE_TXB0 0x00010000
483#define UCC_GETH_UCCE_RXB7 0x00008000
484#define UCC_GETH_UCCE_RXB6 0x00004000
485#define UCC_GETH_UCCE_RXB5 0x00002000
486#define UCC_GETH_UCCE_RXB4 0x00001000
487#define UCC_GETH_UCCE_RXB3 0x00000800
488#define UCC_GETH_UCCE_RXB2 0x00000400
489#define UCC_GETH_UCCE_RXB1 0x00000200
490#define UCC_GETH_UCCE_RXB0 0x00000100
491#define UCC_GETH_UCCE_RXF7 0x00000080
492#define UCC_GETH_UCCE_RXF6 0x00000040
493#define UCC_GETH_UCCE_RXF5 0x00000020
494#define UCC_GETH_UCCE_RXF4 0x00000010
495#define UCC_GETH_UCCE_RXF3 0x00000008
496#define UCC_GETH_UCCE_RXF2 0x00000004
497#define UCC_GETH_UCCE_RXF1 0x00000002
498#define UCC_GETH_UCCE_RXF0 0x00000001
499
500/* UPSMR, when used as a UART */
501#define UCC_UART_UPSMR_FLC 0x8000
502#define UCC_UART_UPSMR_SL 0x4000
503#define UCC_UART_UPSMR_CL_MASK 0x3000
504#define UCC_UART_UPSMR_CL_8 0x3000
505#define UCC_UART_UPSMR_CL_7 0x2000
506#define UCC_UART_UPSMR_CL_6 0x1000
507#define UCC_UART_UPSMR_CL_5 0x0000
508#define UCC_UART_UPSMR_UM_MASK 0x0c00
509#define UCC_UART_UPSMR_UM_NORMAL 0x0000
510#define UCC_UART_UPSMR_UM_MAN_MULTI 0x0400
511#define UCC_UART_UPSMR_UM_AUTO_MULTI 0x0c00
512#define UCC_UART_UPSMR_FRZ 0x0200
513#define UCC_UART_UPSMR_RZS 0x0100
514#define UCC_UART_UPSMR_SYN 0x0080
515#define UCC_UART_UPSMR_DRT 0x0040
516#define UCC_UART_UPSMR_PEN 0x0010
517#define UCC_UART_UPSMR_RPM_MASK 0x000c
518#define UCC_UART_UPSMR_RPM_ODD 0x0000
519#define UCC_UART_UPSMR_RPM_LOW 0x0004
520#define UCC_UART_UPSMR_RPM_EVEN 0x0008
521#define UCC_UART_UPSMR_RPM_HIGH 0x000C
522#define UCC_UART_UPSMR_TPM_MASK 0x0003
523#define UCC_UART_UPSMR_TPM_ODD 0x0000
524#define UCC_UART_UPSMR_TPM_LOW 0x0001
525#define UCC_UART_UPSMR_TPM_EVEN 0x0002
526#define UCC_UART_UPSMR_TPM_HIGH 0x0003
439 527
440/* UCC Transmit On Demand Register (UTODR) */ 528/* UCC Transmit On Demand Register (UTODR) */
441#define UCC_SLOW_TOD 0x8000 529#define UCC_SLOW_TOD 0x8000
442#define UCC_FAST_TOD 0x8000 530#define UCC_FAST_TOD 0x8000
443 531
532/* UCC Bus Mode Register masks */
533/* Not to be confused with the Bundle Mode Register */
534#define UCC_BMR_GBL 0x20
535#define UCC_BMR_BO_BE 0x10
536#define UCC_BMR_CETM 0x04
537#define UCC_BMR_DTB 0x02
538#define UCC_BMR_BDB 0x01
539
444/* Function code masks */ 540/* Function code masks */
445#define FC_GBL 0x20 541#define FC_GBL 0x20
446#define FC_DTB_LCL 0x02 542#define FC_DTB_LCL 0x02
diff --git a/include/asm-powerpc/qe_ic.h b/include/asm-powerpc/qe_ic.h
index e386fb7e44b0..a779b2c9eaf1 100644
--- a/include/asm-powerpc/qe_ic.h
+++ b/include/asm-powerpc/qe_ic.h
@@ -56,9 +56,75 @@ enum qe_ic_grp_id {
56 QE_IC_GRP_RISCB /* QE interrupt controller RISC group B */ 56 QE_IC_GRP_RISCB /* QE interrupt controller RISC group B */
57}; 57};
58 58
59void qe_ic_init(struct device_node *node, unsigned int flags); 59void qe_ic_init(struct device_node *node, unsigned int flags,
60 void (*low_handler)(unsigned int irq, struct irq_desc *desc),
61 void (*high_handler)(unsigned int irq, struct irq_desc *desc));
60void qe_ic_set_highest_priority(unsigned int virq, int high); 62void qe_ic_set_highest_priority(unsigned int virq, int high);
61int qe_ic_set_priority(unsigned int virq, unsigned int priority); 63int qe_ic_set_priority(unsigned int virq, unsigned int priority);
62int qe_ic_set_high_priority(unsigned int virq, unsigned int priority, int high); 64int qe_ic_set_high_priority(unsigned int virq, unsigned int priority, int high);
63 65
66struct qe_ic;
67unsigned int qe_ic_get_low_irq(struct qe_ic *qe_ic);
68unsigned int qe_ic_get_high_irq(struct qe_ic *qe_ic);
69
70static inline void qe_ic_cascade_low_ipic(unsigned int irq,
71 struct irq_desc *desc)
72{
73 struct qe_ic *qe_ic = desc->handler_data;
74 unsigned int cascade_irq = qe_ic_get_low_irq(qe_ic);
75
76 if (cascade_irq != NO_IRQ)
77 generic_handle_irq(cascade_irq);
78}
79
80static inline void qe_ic_cascade_high_ipic(unsigned int irq,
81 struct irq_desc *desc)
82{
83 struct qe_ic *qe_ic = desc->handler_data;
84 unsigned int cascade_irq = qe_ic_get_high_irq(qe_ic);
85
86 if (cascade_irq != NO_IRQ)
87 generic_handle_irq(cascade_irq);
88}
89
90static inline void qe_ic_cascade_low_mpic(unsigned int irq,
91 struct irq_desc *desc)
92{
93 struct qe_ic *qe_ic = desc->handler_data;
94 unsigned int cascade_irq = qe_ic_get_low_irq(qe_ic);
95
96 if (cascade_irq != NO_IRQ)
97 generic_handle_irq(cascade_irq);
98
99 desc->chip->eoi(irq);
100}
101
102static inline void qe_ic_cascade_high_mpic(unsigned int irq,
103 struct irq_desc *desc)
104{
105 struct qe_ic *qe_ic = desc->handler_data;
106 unsigned int cascade_irq = qe_ic_get_high_irq(qe_ic);
107
108 if (cascade_irq != NO_IRQ)
109 generic_handle_irq(cascade_irq);
110
111 desc->chip->eoi(irq);
112}
113
114static inline void qe_ic_cascade_muxed_mpic(unsigned int irq,
115 struct irq_desc *desc)
116{
117 struct qe_ic *qe_ic = desc->handler_data;
118 unsigned int cascade_irq;
119
120 cascade_irq = qe_ic_get_high_irq(qe_ic);
121 if (cascade_irq == NO_IRQ)
122 cascade_irq = qe_ic_get_low_irq(qe_ic);
123
124 if (cascade_irq != NO_IRQ)
125 generic_handle_irq(cascade_irq);
126
127 desc->chip->eoi(irq);
128}
129
64#endif /* _ASM_POWERPC_QE_IC_H */ 130#endif /* _ASM_POWERPC_QE_IC_H */
diff --git a/include/asm-powerpc/reg.h b/include/asm-powerpc/reg.h
index 281011e953ec..e775ff1ca413 100644
--- a/include/asm-powerpc/reg.h
+++ b/include/asm-powerpc/reg.h
@@ -102,12 +102,8 @@
102#else /* 32-bit */ 102#else /* 32-bit */
103/* Default MSR for kernel mode. */ 103/* Default MSR for kernel mode. */
104#ifndef MSR_KERNEL /* reg_booke.h also defines this */ 104#ifndef MSR_KERNEL /* reg_booke.h also defines this */
105#ifdef CONFIG_APUS_FAST_EXCEPT
106#define MSR_KERNEL (MSR_ME|MSR_IP|MSR_RI|MSR_IR|MSR_DR)
107#else
108#define MSR_KERNEL (MSR_ME|MSR_RI|MSR_IR|MSR_DR) 105#define MSR_KERNEL (MSR_ME|MSR_RI|MSR_IR|MSR_DR)
109#endif 106#endif
110#endif
111 107
112#define MSR_USER (MSR_KERNEL|MSR_PR|MSR_EE) 108#define MSR_USER (MSR_KERNEL|MSR_PR|MSR_EE)
113#endif 109#endif
@@ -518,21 +514,47 @@
518#define PA6T_MMCR1_ES4 0x0000000000ff0000UL 514#define PA6T_MMCR1_ES4 0x0000000000ff0000UL
519#define PA6T_MMCR1_ES5 0x00000000ff000000UL 515#define PA6T_MMCR1_ES5 0x00000000ff000000UL
520 516
521#define SPRN_PA6T_SIAR 780 517#define SPRN_PA6T_UPMC0 771 /* User PerfMon Counter 0 */
522#define SPRN_PA6T_UPMC0 771 518#define SPRN_PA6T_UPMC1 772 /* ... */
523#define SPRN_PA6T_UPMC1 772
524#define SPRN_PA6T_UPMC2 773 519#define SPRN_PA6T_UPMC2 773
525#define SPRN_PA6T_UPMC3 774 520#define SPRN_PA6T_UPMC3 774
526#define SPRN_PA6T_UPMC4 775 521#define SPRN_PA6T_UPMC4 775
527#define SPRN_PA6T_UPMC5 776 522#define SPRN_PA6T_UPMC5 776
528#define SPRN_PA6T_UMMCR0 779 523#define SPRN_PA6T_UMMCR0 779 /* User Monitor Mode Control Register 0 */
529#define SPRN_PA6T_UMMCR1 782 524#define SPRN_PA6T_SIAR 780 /* Sampled Instruction Address */
530#define SPRN_PA6T_PMC0 787 525#define SPRN_PA6T_UMMCR1 782 /* User Monitor Mode Control Register 1 */
531#define SPRN_PA6T_PMC1 788 526#define SPRN_PA6T_SIER 785 /* Sampled Instruction Event Register */
532#define SPRN_PA6T_PMC2 789 527#define SPRN_PA6T_PMC0 787
533#define SPRN_PA6T_PMC3 790 528#define SPRN_PA6T_PMC1 788
534#define SPRN_PA6T_PMC4 791 529#define SPRN_PA6T_PMC2 789
535#define SPRN_PA6T_PMC5 792 530#define SPRN_PA6T_PMC3 790
531#define SPRN_PA6T_PMC4 791
532#define SPRN_PA6T_PMC5 792
533#define SPRN_PA6T_TSR0 793 /* Timestamp Register 0 */
534#define SPRN_PA6T_TSR1 794 /* Timestamp Register 1 */
535#define SPRN_PA6T_TSR2 799 /* Timestamp Register 2 */
536#define SPRN_PA6T_TSR3 784 /* Timestamp Register 3 */
537
538#define SPRN_PA6T_IER 981 /* Icache Error Register */
539#define SPRN_PA6T_DER 982 /* Dcache Error Register */
540#define SPRN_PA6T_BER 862 /* BIU Error Address Register */
541#define SPRN_PA6T_MER 849 /* MMU Error Register */
542
543#define SPRN_PA6T_IMA0 880 /* Instruction Match Array 0 */
544#define SPRN_PA6T_IMA1 881 /* ... */
545#define SPRN_PA6T_IMA2 882
546#define SPRN_PA6T_IMA3 883
547#define SPRN_PA6T_IMA4 884
548#define SPRN_PA6T_IMA5 885
549#define SPRN_PA6T_IMA6 886
550#define SPRN_PA6T_IMA7 887
551#define SPRN_PA6T_IMA8 888
552#define SPRN_PA6T_IMA9 889
553#define SPRN_PA6T_BTCR 978 /* Breakpoint and Tagging Control Register */
554#define SPRN_PA6T_IMAAT 979 /* Instruction Match Array Action Table */
555#define SPRN_PA6T_PCCR 1019 /* Power Counter Control Register */
556#define SPRN_PA6T_RPCCR 1021 /* Retire PC Trace Control Register */
557
536 558
537#else /* 32-bit */ 559#else /* 32-bit */
538#define SPRN_MMCR0 952 /* Monitor Mode Control Register 0 */ 560#define SPRN_MMCR0 952 /* Monitor Mode Control Register 0 */
diff --git a/include/asm-powerpc/rwsem.h b/include/asm-powerpc/rwsem.h
index e929145e1e46..cefc14728cc5 100644
--- a/include/asm-powerpc/rwsem.h
+++ b/include/asm-powerpc/rwsem.h
@@ -1,6 +1,10 @@
1#ifndef _ASM_POWERPC_RWSEM_H 1#ifndef _ASM_POWERPC_RWSEM_H
2#define _ASM_POWERPC_RWSEM_H 2#define _ASM_POWERPC_RWSEM_H
3 3
4#ifndef _LINUX_RWSEM_H
5#error "Please don't include <asm/rwsem.h> directly, use <linux/rwsem.h> instead."
6#endif
7
4#ifdef __KERNEL__ 8#ifdef __KERNEL__
5 9
6/* 10/*
diff --git a/include/asm-powerpc/smp.h b/include/asm-powerpc/smp.h
index d037f50580e2..19102bfc14ca 100644
--- a/include/asm-powerpc/smp.h
+++ b/include/asm-powerpc/smp.h
@@ -45,7 +45,7 @@ void generic_mach_cpu_die(void);
45#endif 45#endif
46 46
47#ifdef CONFIG_PPC64 47#ifdef CONFIG_PPC64
48#define raw_smp_processor_id() (get_paca()->paca_index) 48#define raw_smp_processor_id() (local_paca->paca_index)
49#define hard_smp_processor_id() (get_paca()->hw_cpu_id) 49#define hard_smp_processor_id() (get_paca()->hw_cpu_id)
50#else 50#else
51/* 32-bit */ 51/* 32-bit */
diff --git a/include/asm-powerpc/spu.h b/include/asm-powerpc/spu.h
index 5bde3980bf49..b1accce77bb5 100644
--- a/include/asm-powerpc/spu.h
+++ b/include/asm-powerpc/spu.h
@@ -238,19 +238,14 @@ extern long spu_sys_callback(struct spu_syscall_block *s);
238 238
239/* syscalls implemented in spufs */ 239/* syscalls implemented in spufs */
240struct file; 240struct file;
241extern struct spufs_calls { 241struct spufs_calls {
242 asmlinkage long (*create_thread)(const char __user *name, 242 long (*create_thread)(const char __user *name,
243 unsigned int flags, mode_t mode, 243 unsigned int flags, mode_t mode,
244 struct file *neighbor); 244 struct file *neighbor);
245 asmlinkage long (*spu_run)(struct file *filp, __u32 __user *unpc, 245 long (*spu_run)(struct file *filp, __u32 __user *unpc,
246 __u32 __user *ustatus); 246 __u32 __user *ustatus);
247 struct module *owner; 247 int (*coredump_extra_notes_size)(void);
248} spufs_calls; 248 int (*coredump_extra_notes_write)(struct file *file, loff_t *foffset);
249
250/* coredump calls implemented in spufs */
251struct spu_coredump_calls {
252 asmlinkage int (*arch_notes_size)(void);
253 asmlinkage void (*arch_write_notes)(struct file *file);
254 struct module *owner; 249 struct module *owner;
255}; 250};
256 251
@@ -274,21 +269,8 @@ struct spu_coredump_calls {
274#define SPU_CREATE_FLAG_ALL 0x003f /* mask of all valid flags */ 269#define SPU_CREATE_FLAG_ALL 0x003f /* mask of all valid flags */
275 270
276 271
277#ifdef CONFIG_SPU_FS_MODULE
278int register_spu_syscalls(struct spufs_calls *calls); 272int register_spu_syscalls(struct spufs_calls *calls);
279void unregister_spu_syscalls(struct spufs_calls *calls); 273void unregister_spu_syscalls(struct spufs_calls *calls);
280#else
281static inline int register_spu_syscalls(struct spufs_calls *calls)
282{
283 return 0;
284}
285static inline void unregister_spu_syscalls(struct spufs_calls *calls)
286{
287}
288#endif /* MODULE */
289
290int register_arch_coredump_calls(struct spu_coredump_calls *calls);
291void unregister_arch_coredump_calls(struct spu_coredump_calls *calls);
292 274
293int spu_add_sysdev_attr(struct sysdev_attribute *attr); 275int spu_add_sysdev_attr(struct sysdev_attribute *attr);
294void spu_remove_sysdev_attr(struct sysdev_attribute *attr); 276void spu_remove_sysdev_attr(struct sysdev_attribute *attr);
diff --git a/include/asm-powerpc/system.h b/include/asm-powerpc/system.h
index 41520b7a7b76..d10e99bf5001 100644
--- a/include/asm-powerpc/system.h
+++ b/include/asm-powerpc/system.h
@@ -189,6 +189,9 @@ extern int mem_init_done; /* set on boot once kmalloc can be called */
189extern unsigned long memory_limit; 189extern unsigned long memory_limit;
190extern unsigned long klimit; 190extern unsigned long klimit;
191 191
192extern void *alloc_maybe_bootmem(size_t size, gfp_t mask);
193extern void *zalloc_maybe_bootmem(size_t size, gfp_t mask);
194
192extern int powersave_nap; /* set if nap mode can be used in idle loop */ 195extern int powersave_nap; /* set if nap mode can be used in idle loop */
193 196
194/* 197/*
diff --git a/include/asm-powerpc/time.h b/include/asm-powerpc/time.h
index c104c15c6625..f05895522f7f 100644
--- a/include/asm-powerpc/time.h
+++ b/include/asm-powerpc/time.h
@@ -179,7 +179,7 @@ static inline unsigned int get_dec(void)
179static inline void set_dec(int val) 179static inline void set_dec(int val)
180{ 180{
181#if defined(CONFIG_40x) 181#if defined(CONFIG_40x)
182 return; /* Have to let it auto-reload */ 182 mtspr(SPRN_PIT, val);
183#elif defined(CONFIG_8xx_CPU6) 183#elif defined(CONFIG_8xx_CPU6)
184 set_dec_cpu6(val); 184 set_dec_cpu6(val);
185#else 185#else
@@ -245,6 +245,7 @@ extern void snapshot_timebases(void);
245#define snapshot_timebases() do { } while (0) 245#define snapshot_timebases() do { } while (0)
246#endif 246#endif
247 247
248extern void secondary_cpu_time_init(void);
248extern void iSeries_time_init_early(void); 249extern void iSeries_time_init_early(void);
249 250
250#endif /* __KERNEL__ */ 251#endif /* __KERNEL__ */
diff --git a/include/asm-powerpc/tlb.h b/include/asm-powerpc/tlb.h
index 66714042e438..e20ff7541f36 100644
--- a/include/asm-powerpc/tlb.h
+++ b/include/asm-powerpc/tlb.h
@@ -23,6 +23,8 @@
23#include <asm/mmu.h> 23#include <asm/mmu.h>
24#endif 24#endif
25 25
26#include <linux/pagemap.h>
27
26struct mmu_gather; 28struct mmu_gather;
27 29
28#define tlb_start_vma(tlb, vma) do { } while (0) 30#define tlb_start_vma(tlb, vma) do { } while (0)
diff --git a/include/asm-powerpc/tlbflush.h b/include/asm-powerpc/tlbflush.h
index 99a0439baa50..a022f806bb21 100644
--- a/include/asm-powerpc/tlbflush.h
+++ b/include/asm-powerpc/tlbflush.h
@@ -97,6 +97,7 @@ struct ppc64_tlb_batch {
97 real_pte_t pte[PPC64_TLB_BATCH_NR]; 97 real_pte_t pte[PPC64_TLB_BATCH_NR];
98 unsigned long vaddr[PPC64_TLB_BATCH_NR]; 98 unsigned long vaddr[PPC64_TLB_BATCH_NR];
99 unsigned int psize; 99 unsigned int psize;
100 int ssize;
100}; 101};
101DECLARE_PER_CPU(struct ppc64_tlb_batch, ppc64_tlb_batch); 102DECLARE_PER_CPU(struct ppc64_tlb_batch, ppc64_tlb_batch);
102 103
@@ -127,7 +128,7 @@ static inline void arch_leave_lazy_mmu_mode(void)
127 128
128 129
129extern void flush_hash_page(unsigned long va, real_pte_t pte, int psize, 130extern void flush_hash_page(unsigned long va, real_pte_t pte, int psize,
130 int local); 131 int ssize, int local);
131extern void flush_hash_range(unsigned long number, int local); 132extern void flush_hash_range(unsigned long number, int local);
132 133
133 134
diff --git a/include/asm-powerpc/types.h b/include/asm-powerpc/types.h
index 3b363757a2bb..a584341c87e3 100644
--- a/include/asm-powerpc/types.h
+++ b/include/asm-powerpc/types.h
@@ -48,7 +48,7 @@ typedef unsigned long long __u64;
48 48
49typedef struct { 49typedef struct {
50 __u32 u[4]; 50 __u32 u[4];
51} __attribute((aligned(16))) __vector128; 51} __attribute__((aligned(16))) __vector128;
52 52
53#endif /* __ASSEMBLY__ */ 53#endif /* __ASSEMBLY__ */
54 54
diff --git a/include/asm-powerpc/ucc.h b/include/asm-powerpc/ucc.h
index afe3076bdc03..46b09ba6bead 100644
--- a/include/asm-powerpc/ucc.h
+++ b/include/asm-powerpc/ucc.h
@@ -25,58 +25,38 @@
25/* Slow or fast type for UCCs. 25/* Slow or fast type for UCCs.
26*/ 26*/
27enum ucc_speed_type { 27enum ucc_speed_type {
28 UCC_SPEED_TYPE_FAST, UCC_SPEED_TYPE_SLOW 28 UCC_SPEED_TYPE_FAST = UCC_GUEMR_MODE_FAST_RX | UCC_GUEMR_MODE_FAST_TX,
29}; 29 UCC_SPEED_TYPE_SLOW = UCC_GUEMR_MODE_SLOW_RX | UCC_GUEMR_MODE_SLOW_TX
30
31/* Initial UCCs Parameter RAM address relative to: MEM_MAP_BASE (IMMR).
32*/
33enum ucc_pram_initial_offset {
34 UCC_PRAM_OFFSET_UCC1 = 0x8400,
35 UCC_PRAM_OFFSET_UCC2 = 0x8500,
36 UCC_PRAM_OFFSET_UCC3 = 0x8600,
37 UCC_PRAM_OFFSET_UCC4 = 0x9000,
38 UCC_PRAM_OFFSET_UCC5 = 0x8000,
39 UCC_PRAM_OFFSET_UCC6 = 0x8100,
40 UCC_PRAM_OFFSET_UCC7 = 0x8200,
41 UCC_PRAM_OFFSET_UCC8 = 0x8300
42}; 30};
43 31
44/* ucc_set_type 32/* ucc_set_type
45 * Sets UCC to slow or fast mode. 33 * Sets UCC to slow or fast mode.
46 * 34 *
47 * ucc_num - (In) number of UCC (0-7). 35 * ucc_num - (In) number of UCC (0-7).
48 * regs - (In) pointer to registers base for the UCC.
49 * speed - (In) slow or fast mode for UCC. 36 * speed - (In) slow or fast mode for UCC.
50 */ 37 */
51int ucc_set_type(int ucc_num, struct ucc_common *regs, 38int ucc_set_type(unsigned int ucc_num, enum ucc_speed_type speed);
52 enum ucc_speed_type speed);
53
54/* ucc_init_guemr
55 * Init the Guemr register.
56 *
57 * regs - (In) pointer to registers base for the UCC.
58 */
59int ucc_init_guemr(struct ucc_common *regs);
60 39
61int ucc_set_qe_mux_mii_mng(int ucc_num); 40int ucc_set_qe_mux_mii_mng(unsigned int ucc_num);
62 41
63int ucc_set_qe_mux_rxtx(int ucc_num, enum qe_clock clock, enum comm_dir mode); 42int ucc_set_qe_mux_rxtx(unsigned int ucc_num, enum qe_clock clock,
43 enum comm_dir mode);
64 44
65int ucc_mux_set_grant_tsa_bkpt(int ucc_num, int set, u32 mask); 45int ucc_mux_set_grant_tsa_bkpt(unsigned int ucc_num, int set, u32 mask);
66 46
67/* QE MUX clock routing for UCC 47/* QE MUX clock routing for UCC
68*/ 48*/
69static inline int ucc_set_qe_mux_grant(int ucc_num, int set) 49static inline int ucc_set_qe_mux_grant(unsigned int ucc_num, int set)
70{ 50{
71 return ucc_mux_set_grant_tsa_bkpt(ucc_num, set, QE_CMXUCR_GRANT); 51 return ucc_mux_set_grant_tsa_bkpt(ucc_num, set, QE_CMXUCR_GRANT);
72} 52}
73 53
74static inline int ucc_set_qe_mux_tsa(int ucc_num, int set) 54static inline int ucc_set_qe_mux_tsa(unsigned int ucc_num, int set)
75{ 55{
76 return ucc_mux_set_grant_tsa_bkpt(ucc_num, set, QE_CMXUCR_TSA); 56 return ucc_mux_set_grant_tsa_bkpt(ucc_num, set, QE_CMXUCR_TSA);
77} 57}
78 58
79static inline int ucc_set_qe_mux_bkpt(int ucc_num, int set) 59static inline int ucc_set_qe_mux_bkpt(unsigned int ucc_num, int set)
80{ 60{
81 return ucc_mux_set_grant_tsa_bkpt(ucc_num, set, QE_CMXUCR_BKPT); 61 return ucc_mux_set_grant_tsa_bkpt(ucc_num, set, QE_CMXUCR_BKPT);
82} 62}
diff --git a/include/asm-powerpc/ucc_slow.h b/include/asm-powerpc/ucc_slow.h
index fdaac9d762bb..0980e6ad335b 100644
--- a/include/asm-powerpc/ucc_slow.h
+++ b/include/asm-powerpc/ucc_slow.h
@@ -148,9 +148,10 @@ enum ucc_slow_diag_mode {
148 148
149struct ucc_slow_info { 149struct ucc_slow_info {
150 int ucc_num; 150 int ucc_num;
151 int protocol; /* QE_CR_PROTOCOL_xxx */
151 enum qe_clock rx_clock; 152 enum qe_clock rx_clock;
152 enum qe_clock tx_clock; 153 enum qe_clock tx_clock;
153 u32 regs; 154 phys_addr_t regs;
154 int irq; 155 int irq;
155 u16 uccm_mask; 156 u16 uccm_mask;
156 int data_mem_part; 157 int data_mem_part;
@@ -186,7 +187,7 @@ struct ucc_slow_info {
186 187
187struct ucc_slow_private { 188struct ucc_slow_private {
188 struct ucc_slow_info *us_info; 189 struct ucc_slow_info *us_info;
189 struct ucc_slow *us_regs; /* a pointer to memory map of UCC regs */ 190 struct ucc_slow __iomem *us_regs; /* Ptr to memory map of UCC regs */
190 struct ucc_slow_pram *us_pram; /* a pointer to the parameter RAM */ 191 struct ucc_slow_pram *us_pram; /* a pointer to the parameter RAM */
191 u32 us_pram_offset; 192 u32 us_pram_offset;
192 int enabled_tx; /* Whether channel is enabled for Tx (ENT) */ 193 int enabled_tx; /* Whether channel is enabled for Tx (ENT) */
@@ -277,12 +278,12 @@ void ucc_slow_graceful_stop_tx(struct ucc_slow_private * uccs);
277 */ 278 */
278void ucc_slow_stop_tx(struct ucc_slow_private * uccs); 279void ucc_slow_stop_tx(struct ucc_slow_private * uccs);
279 280
280/* ucc_slow_restart_x 281/* ucc_slow_restart_tx
281 * Restarts transmitting on a specified slow UCC. 282 * Restarts transmitting on a specified slow UCC.
282 * 283 *
283 * uccs - (In) pointer to the slow UCC structure. 284 * uccs - (In) pointer to the slow UCC structure.
284 */ 285 */
285void ucc_slow_restart_x(struct ucc_slow_private * uccs); 286void ucc_slow_restart_tx(struct ucc_slow_private *uccs);
286 287
287u32 ucc_slow_get_qe_cr_subblock(int uccs_num); 288u32 ucc_slow_get_qe_cr_subblock(int uccs_num);
288 289
diff --git a/include/asm-powerpc/udbg.h b/include/asm-powerpc/udbg.h
index ce9d82fb7b68..a9e0b0ebcb0f 100644
--- a/include/asm-powerpc/udbg.h
+++ b/include/asm-powerpc/udbg.h
@@ -48,6 +48,7 @@ extern void __init udbg_init_rtas_console(void);
48extern void __init udbg_init_debug_beat(void); 48extern void __init udbg_init_debug_beat(void);
49extern void __init udbg_init_btext(void); 49extern void __init udbg_init_btext(void);
50extern void __init udbg_init_44x_as1(void); 50extern void __init udbg_init_44x_as1(void);
51extern void __init udbg_init_cpm(void);
51 52
52#endif /* __KERNEL__ */ 53#endif /* __KERNEL__ */
53#endif /* _ASM_POWERPC_UDBG_H */ 54#endif /* _ASM_POWERPC_UDBG_H */
diff --git a/include/asm-powerpc/vio.h b/include/asm-powerpc/vio.h
index 3a0975e2adad..9204c15839c5 100644
--- a/include/asm-powerpc/vio.h
+++ b/include/asm-powerpc/vio.h
@@ -53,18 +53,12 @@ struct vio_dev {
53}; 53};
54 54
55struct vio_driver { 55struct vio_driver {
56 struct list_head node;
57 const struct vio_device_id *id_table; 56 const struct vio_device_id *id_table;
58 int (*probe)(struct vio_dev *dev, const struct vio_device_id *id); 57 int (*probe)(struct vio_dev *dev, const struct vio_device_id *id);
59 int (*remove)(struct vio_dev *dev); 58 int (*remove)(struct vio_dev *dev);
60 void (*shutdown)(struct vio_dev *dev);
61 unsigned long driver_data;
62 struct device_driver driver; 59 struct device_driver driver;
63}; 60};
64 61
65extern struct dma_mapping_ops vio_dma_ops;
66extern struct bus_type vio_bus_type;
67
68extern int vio_register_driver(struct vio_driver *drv); 62extern int vio_register_driver(struct vio_driver *drv);
69extern void vio_unregister_driver(struct vio_driver *drv); 63extern void vio_unregister_driver(struct vio_driver *drv);
70 64
diff --git a/include/asm-powerpc/xilinx_intc.h b/include/asm-powerpc/xilinx_intc.h
new file mode 100644
index 000000000000..343612f8fece
--- /dev/null
+++ b/include/asm-powerpc/xilinx_intc.h
@@ -0,0 +1,20 @@
1/*
2 * Xilinx intc external definitions
3 *
4 * Copyright 2007 Secret Lab Technologies Ltd.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 */
11#ifndef _ASM_POWERPC_XILINX_INTC_H
12#define _ASM_POWERPC_XILINX_INTC_H
13
14#ifdef __KERNEL__
15
16extern void __init xilinx_intc_init_tree(void);
17extern unsigned int xilinx_intc_get_irq(void);
18
19#endif /* __KERNEL__ */
20#endif /* _ASM_POWERPC_XILINX_INTC_H */
diff --git a/include/asm-ppc/amigahw.h b/include/asm-ppc/amigahw.h
deleted file mode 100644
index 90fd1274d727..000000000000
--- a/include/asm-ppc/amigahw.h
+++ /dev/null
@@ -1,16 +0,0 @@
1#ifdef __KERNEL__
2#ifndef __ASMPPC_AMIGAHW_H
3#define __ASMPPC_AMIGAHW_H
4
5#include <asm-m68k/amigahw.h>
6
7#undef CHIP_PHYSADDR
8#ifdef CONFIG_APUS_FAST_EXCEPT
9#define CHIP_PHYSADDR (0x000000)
10#else
11#define CHIP_PHYSADDR (0x004000)
12#endif
13
14
15#endif /* __ASMPPC_AMIGAHW_H */
16#endif /* __KERNEL__ */
diff --git a/include/asm-ppc/amigaints.h b/include/asm-ppc/amigaints.h
deleted file mode 100644
index aa3ff6349e81..000000000000
--- a/include/asm-ppc/amigaints.h
+++ /dev/null
@@ -1,133 +0,0 @@
1/*
2** amigaints.h -- Amiga Linux interrupt handling structs and prototypes
3**
4** Copyright 1992 by Greg Harp
5**
6** This file is subject to the terms and conditions of the GNU General Public
7** License. See the file COPYING in the main directory of this archive
8** for more details.
9**
10** Created 10/2/92 by Greg Harp
11*/
12
13#ifdef __KERNEL__
14#ifndef _ASMm68k_AMIGAINTS_H_
15#define _ASMm68k_AMIGAINTS_H_
16
17/*
18** Amiga Interrupt sources.
19**
20*/
21
22#define AUTO_IRQS (8)
23#define AMI_STD_IRQS (14)
24#define CIA_IRQS (5)
25#define AMI_IRQS (32) /* AUTO_IRQS+AMI_STD_IRQS+2*CIA_IRQS */
26
27/* vertical blanking interrupt */
28#define IRQ_AMIGA_VERTB 0
29
30/* copper interrupt */
31#define IRQ_AMIGA_COPPER 1
32
33/* Audio interrupts */
34#define IRQ_AMIGA_AUD0 2
35#define IRQ_AMIGA_AUD1 3
36#define IRQ_AMIGA_AUD2 4
37#define IRQ_AMIGA_AUD3 5
38
39/* Blitter done interrupt */
40#define IRQ_AMIGA_BLIT 6
41
42/* floppy disk interrupts */
43#define IRQ_AMIGA_DSKSYN 7
44#define IRQ_AMIGA_DSKBLK 8
45
46/* builtin serial port interrupts */
47#define IRQ_AMIGA_RBF 9
48#define IRQ_AMIGA_TBE 10
49
50/* software interrupts */
51#define IRQ_AMIGA_SOFT 11
52
53/* interrupts from external hardware */
54#define IRQ_AMIGA_PORTS 12
55#define IRQ_AMIGA_EXTER 13
56
57/* CIA interrupt sources */
58#define IRQ_AMIGA_CIAA 14
59#define IRQ_AMIGA_CIAA_TA 14
60#define IRQ_AMIGA_CIAA_TB 15
61#define IRQ_AMIGA_CIAA_ALRM 16
62#define IRQ_AMIGA_CIAA_SP 17
63#define IRQ_AMIGA_CIAA_FLG 18
64#define IRQ_AMIGA_CIAB 19
65#define IRQ_AMIGA_CIAB_TA 19
66#define IRQ_AMIGA_CIAB_TB 20
67#define IRQ_AMIGA_CIAB_ALRM 21
68#define IRQ_AMIGA_CIAB_SP 22
69#define IRQ_AMIGA_CIAB_FLG 23
70
71/* auto-vector interrupts */
72#define IRQ_AMIGA_AUTO 24
73#define IRQ_AMIGA_AUTO_0 24 /* This is just a dummy */
74#define IRQ_AMIGA_AUTO_1 25
75#define IRQ_AMIGA_AUTO_2 26
76#define IRQ_AMIGA_AUTO_3 27
77#define IRQ_AMIGA_AUTO_4 28
78#define IRQ_AMIGA_AUTO_5 29
79#define IRQ_AMIGA_AUTO_6 30
80#define IRQ_AMIGA_AUTO_7 31
81
82#define IRQ_FLOPPY IRQ_AMIGA_DSKBLK
83
84/* INTREQR masks */
85#define IRQ1_MASK 0x0007 /* INTREQR mask for IRQ 1 */
86#define IRQ2_MASK 0x0008 /* INTREQR mask for IRQ 2 */
87#define IRQ3_MASK 0x0070 /* INTREQR mask for IRQ 3 */
88#define IRQ4_MASK 0x0780 /* INTREQR mask for IRQ 4 */
89#define IRQ5_MASK 0x1800 /* INTREQR mask for IRQ 5 */
90#define IRQ6_MASK 0x2000 /* INTREQR mask for IRQ 6 */
91#define IRQ7_MASK 0x4000 /* INTREQR mask for IRQ 7 */
92
93#define IF_SETCLR 0x8000 /* set/clr bit */
94#define IF_INTEN 0x4000 /* master interrupt bit in INT* registers */
95#define IF_EXTER 0x2000 /* external level 6 and CIA B interrupt */
96#define IF_DSKSYN 0x1000 /* disk sync interrupt */
97#define IF_RBF 0x0800 /* serial receive buffer full interrupt */
98#define IF_AUD3 0x0400 /* audio channel 3 done interrupt */
99#define IF_AUD2 0x0200 /* audio channel 2 done interrupt */
100#define IF_AUD1 0x0100 /* audio channel 1 done interrupt */
101#define IF_AUD0 0x0080 /* audio channel 0 done interrupt */
102#define IF_BLIT 0x0040 /* blitter done interrupt */
103#define IF_VERTB 0x0020 /* vertical blanking interrupt */
104#define IF_COPER 0x0010 /* copper interrupt */
105#define IF_PORTS 0x0008 /* external level 2 and CIA A interrupt */
106#define IF_SOFT 0x0004 /* software initiated interrupt */
107#define IF_DSKBLK 0x0002 /* diskblock DMA finished */
108#define IF_TBE 0x0001 /* serial transmit buffer empty interrupt */
109
110extern void amiga_do_irq(int irq, struct pt_regs *fp);
111extern void amiga_do_irq_list(int irq, struct pt_regs *fp);
112
113/* CIA interrupt control register bits */
114
115#define CIA_ICR_TA 0x01
116#define CIA_ICR_TB 0x02
117#define CIA_ICR_ALRM 0x04
118#define CIA_ICR_SP 0x08
119#define CIA_ICR_FLG 0x10
120#define CIA_ICR_ALL 0x1f
121#define CIA_ICR_SETCLR 0x80
122
123/* to access the interrupt control registers of CIA's use only
124** these functions, they behave exactly like the amiga os routines
125*/
126
127extern struct ciabase ciaa_base, ciab_base;
128
129extern unsigned char cia_set_irq(unsigned int irq, int set);
130extern unsigned char cia_able_irq(unsigned int irq, int enable);
131
132#endif /* asm-m68k/amigaints.h */
133#endif /* __KERNEL__ */
diff --git a/include/asm-ppc/amigappc.h b/include/asm-ppc/amigappc.h
deleted file mode 100644
index 35114ce5135f..000000000000
--- a/include/asm-ppc/amigappc.h
+++ /dev/null
@@ -1,85 +0,0 @@
1/*
2** asm-ppc/amigappc.h -- This header defines some values and pointers for
3** the Phase 5 PowerUp card.
4**
5** Copyright 1997, 1998 by Phase5, Germany.
6**
7** This file is subject to the terms and conditions of the GNU General Public
8** License. See the file COPYING in the main directory of this archive
9** for more details.
10**
11** Created: 7/22/97 by Jesper Skov
12*/
13
14#ifdef __KERNEL__
15#ifndef _M68K_AMIGAPPC_H
16#define _M68K_AMIGAPPC_H
17
18#ifndef __ASSEMBLY__
19
20/* #include <asm/system.h> */
21#define mb() __asm__ __volatile__ ("sync" : : : "memory")
22
23#define APUS_WRITE(_a_, _v_) \
24do { \
25 (*((volatile unsigned char *)(_a_)) = (_v_)); \
26 mb(); \
27} while (0)
28
29#define APUS_READ(_a_, _v_) \
30do { \
31 (_v_) = (*((volatile unsigned char *)(_a_))); \
32 mb(); \
33} while (0)
34#endif /* ndef __ASSEMBLY__ */
35
36/* Maybe add a [#ifdef WANT_ZTWOBASE] condition to amigahw.h? */
37#define zTwoBase (0x80000000)
38
39#define APUS_IPL_BASE (zTwoBase + 0x00f60000)
40#define APUS_REG_RESET (APUS_IPL_BASE + 0x00)
41#define APUS_REG_WAITSTATE (APUS_IPL_BASE + 0x10)
42#define APUS_REG_SHADOW (APUS_IPL_BASE + 0x18)
43#define APUS_REG_LOCK (APUS_IPL_BASE + 0x20)
44#define APUS_REG_INT (APUS_IPL_BASE + 0x28)
45#define APUS_IPL_EMU (APUS_IPL_BASE + 0x30)
46#define APUS_INT_LVL (APUS_IPL_BASE + 0x38)
47
48#define REGSHADOW_SETRESET (0x80)
49#define REGSHADOW_SELFRESET (0x40)
50
51#define REGLOCK_SETRESET (0x80)
52#define REGLOCK_BLACKMAGICK1 (0x40)
53#define REGLOCK_BLACKMAGICK2 (0x20)
54#define REGLOCK_BLACKMAGICK3 (0x10)
55
56#define REGWAITSTATE_SETRESET (0x80)
57#define REGWAITSTATE_PPCW (0x08)
58#define REGWAITSTATE_PPCR (0x04)
59
60#define REGRESET_SETRESET (0x80)
61#define REGRESET_PPCRESET (0x10)
62#define REGRESET_M68KRESET (0x08)
63#define REGRESET_AMIGARESET (0x04)
64#define REGRESET_AUXRESET (0x02)
65#define REGRESET_SCSIRESET (0x01)
66
67#define REGINT_SETRESET (0x80)
68#define REGINT_ENABLEIPL (0x02)
69#define REGINT_INTMASTER (0x01)
70
71#define IPLEMU_SETRESET (0x80)
72#define IPLEMU_DISABLEINT (0x40)
73#define IPLEMU_IPL2 (0x20)
74#define IPLEMU_IPL1 (0x10)
75#define IPLEMU_IPL0 (0x08)
76#define IPLEMU_PPCIPL2 (0x04)
77#define IPLEMU_PPCIPL1 (0x02)
78#define IPLEMU_PPCIPL0 (0x01)
79#define IPLEMU_IPLMASK (IPLEMU_PPCIPL2|IPLEMU_PPCIPL1|IPLEMU_PPCIPL0)
80
81#define INTLVL_SETRESET (0x80)
82#define INTLVL_MASK (0x7f)
83
84#endif /* _M68k_AMIGAPPC_H */
85#endif /* __KERNEL__ */
diff --git a/include/asm-ppc/ans-lcd.h b/include/asm-ppc/ans-lcd.h
deleted file mode 100644
index d795b9fd2db6..000000000000
--- a/include/asm-ppc/ans-lcd.h
+++ /dev/null
@@ -1,11 +0,0 @@
1#ifndef _PPC_ANS_LCD_H
2#define _PPC_ANS_LCD_H
3
4#define ANSLCD_MINOR 156
5
6#define ANSLCD_CLEAR 0x01
7#define ANSLCD_SENDCTRL 0x02
8#define ANSLCD_SETSHORTDELAY 0x03
9#define ANSLCD_SETLONGDELAY 0x04
10
11#endif
diff --git a/include/asm-ppc/bootinfo.h b/include/asm-ppc/bootinfo.h
index 2ace4a74f263..f6ed77aee328 100644
--- a/include/asm-ppc/bootinfo.h
+++ b/include/asm-ppc/bootinfo.h
@@ -11,10 +11,6 @@
11 11
12#include <asm/page.h> 12#include <asm/page.h>
13 13
14#if defined(CONFIG_APUS) && !defined(__BOOTER__)
15#include <asm-m68k/bootinfo.h>
16#else
17
18struct bi_record { 14struct bi_record {
19 unsigned long tag; /* tag ID */ 15 unsigned long tag; /* tag ID */
20 unsigned long size; /* size of record (in bytes) */ 16 unsigned long size; /* size of record (in bytes) */
@@ -44,7 +40,6 @@ bootinfo_addr(unsigned long offset)
44 return (struct bi_record *)_ALIGN((offset) + (1 << 20) - 1, 40 return (struct bi_record *)_ALIGN((offset) + (1 << 20) - 1,
45 (1 << 20)); 41 (1 << 20));
46} 42}
47#endif /* CONFIG_APUS */
48 43
49 44
50#endif /* _PPC_BOOTINFO_H */ 45#endif /* _PPC_BOOTINFO_H */
diff --git a/include/asm-ppc/io.h b/include/asm-ppc/io.h
index 95d590423cf2..8f58231a8bc6 100644
--- a/include/asm-ppc/io.h
+++ b/include/asm-ppc/io.h
@@ -30,7 +30,7 @@
30#include <asm/mpc8xx.h> 30#include <asm/mpc8xx.h>
31#elif defined(CONFIG_8260) 31#elif defined(CONFIG_8260)
32#include <asm/mpc8260.h> 32#include <asm/mpc8260.h>
33#elif defined(CONFIG_APUS) || !defined(CONFIG_PCI) 33#elif !defined(CONFIG_PCI)
34#define _IO_BASE 0 34#define _IO_BASE 0
35#define _ISA_MEM_BASE 0 35#define _ISA_MEM_BASE 0
36#define PCI_DRAM_OFFSET 0 36#define PCI_DRAM_OFFSET 0
@@ -145,24 +145,7 @@ static inline void writeb(__u8 b, volatile void __iomem *addr)
145} 145}
146#endif 146#endif
147 147
148#if defined(CONFIG_APUS) 148#if defined (CONFIG_8260_PCI9)
149static inline __u16 readw(const volatile void __iomem *addr)
150{
151 return *(__force volatile __u16 *)(addr);
152}
153static inline __u32 readl(const volatile void __iomem *addr)
154{
155 return *(__force volatile __u32 *)(addr);
156}
157static inline void writew(__u16 b, volatile void __iomem *addr)
158{
159 *(__force volatile __u16 *)(addr) = b;
160}
161static inline void writel(__u32 b, volatile void __iomem *addr)
162{
163 *(__force volatile __u32 *)(addr) = b;
164}
165#elif defined (CONFIG_8260_PCI9)
166/* Use macros if PCI9 workaround enabled */ 149/* Use macros if PCI9 workaround enabled */
167#define readw(addr) in_le16((volatile u16 *)(addr)) 150#define readw(addr) in_le16((volatile u16 *)(addr))
168#define readl(addr) in_le32((volatile u32 *)(addr)) 151#define readl(addr) in_le32((volatile u32 *)(addr))
@@ -185,7 +168,7 @@ static inline void writel(__u32 b, volatile void __iomem *addr)
185{ 168{
186 out_le32(addr, b); 169 out_le32(addr, b);
187} 170}
188#endif /* CONFIG_APUS */ 171#endif /* CONFIG_8260_PCI9 */
189 172
190#define readb_relaxed(addr) readb(addr) 173#define readb_relaxed(addr) readb(addr)
191#define readw_relaxed(addr) readw(addr) 174#define readw_relaxed(addr) readw(addr)
@@ -300,13 +283,7 @@ extern __inline__ void name(unsigned int val, unsigned int port) \
300} 283}
301 284
302__do_out_asm(outb, "stbx") 285__do_out_asm(outb, "stbx")
303#ifdef CONFIG_APUS 286#if defined (CONFIG_8260_PCI9)
304__do_in_asm(inb, "lbzx")
305__do_in_asm(inw, "lhz%U1%X1")
306__do_in_asm(inl, "lwz%U1%X1")
307__do_out_asm(outl,"stw%U0%X0")
308__do_out_asm(outw, "sth%U0%X0")
309#elif defined (CONFIG_8260_PCI9)
310/* in asm cannot be defined if PCI9 workaround is used */ 287/* in asm cannot be defined if PCI9 workaround is used */
311#define inb(port) in_8((port)+___IO_BASE) 288#define inb(port) in_8((port)+___IO_BASE)
312#define inw(port) in_le16((port)+___IO_BASE) 289#define inw(port) in_le16((port)+___IO_BASE)
@@ -371,7 +348,6 @@ extern void __iomem *ioremap64(unsigned long long address, unsigned long size);
371#define ioremap_nocache(addr, size) ioremap((addr), (size)) 348#define ioremap_nocache(addr, size) ioremap((addr), (size))
372extern void iounmap(volatile void __iomem *addr); 349extern void iounmap(volatile void __iomem *addr);
373extern unsigned long iopa(unsigned long addr); 350extern unsigned long iopa(unsigned long addr);
374extern unsigned long mm_ptov(unsigned long addr) __attribute_const__;
375extern void io_block_mapping(unsigned long virt, phys_addr_t phys, 351extern void io_block_mapping(unsigned long virt, phys_addr_t phys,
376 unsigned int size, int flags); 352 unsigned int size, int flags);
377 353
@@ -384,24 +360,16 @@ extern void io_block_mapping(unsigned long virt, phys_addr_t phys,
384 */ 360 */
385extern inline unsigned long virt_to_bus(volatile void * address) 361extern inline unsigned long virt_to_bus(volatile void * address)
386{ 362{
387#ifndef CONFIG_APUS
388 if (address == (void *)0) 363 if (address == (void *)0)
389 return 0; 364 return 0;
390 return (unsigned long)address - KERNELBASE + PCI_DRAM_OFFSET; 365 return (unsigned long)address - KERNELBASE + PCI_DRAM_OFFSET;
391#else
392 return iopa ((unsigned long) address);
393#endif
394} 366}
395 367
396extern inline void * bus_to_virt(unsigned long address) 368extern inline void * bus_to_virt(unsigned long address)
397{ 369{
398#ifndef CONFIG_APUS
399 if (address == 0) 370 if (address == 0)
400 return NULL; 371 return NULL;
401 return (void *)(address - PCI_DRAM_OFFSET + KERNELBASE); 372 return (void *)(address - PCI_DRAM_OFFSET + KERNELBASE);
402#else
403 return (void*) mm_ptov (address);
404#endif
405} 373}
406 374
407/* 375/*
@@ -410,20 +378,12 @@ extern inline void * bus_to_virt(unsigned long address)
410 */ 378 */
411extern inline unsigned long virt_to_phys(volatile void * address) 379extern inline unsigned long virt_to_phys(volatile void * address)
412{ 380{
413#ifndef CONFIG_APUS
414 return (unsigned long) address - KERNELBASE; 381 return (unsigned long) address - KERNELBASE;
415#else
416 return iopa ((unsigned long) address);
417#endif
418} 382}
419 383
420extern inline void * phys_to_virt(unsigned long address) 384extern inline void * phys_to_virt(unsigned long address)
421{ 385{
422#ifndef CONFIG_APUS
423 return (void *) (address + KERNELBASE); 386 return (void *) (address + KERNELBASE);
424#else
425 return (void*) mm_ptov (address);
426#endif
427} 387}
428 388
429/* 389/*
@@ -553,4 +513,7 @@ extern void pci_iounmap(struct pci_dev *dev, void __iomem *);
553#define setbits16(_addr, _v) out_be16((_addr), in_be16(_addr) | (_v)) 513#define setbits16(_addr, _v) out_be16((_addr), in_be16(_addr) | (_v))
554#define clrbits16(_addr, _v) out_be16((_addr), in_be16(_addr) & ~(_v)) 514#define clrbits16(_addr, _v) out_be16((_addr), in_be16(_addr) & ~(_v))
555 515
516#define setbits8(_addr, _v) out_8((_addr), in_8(_addr) | (_v))
517#define clrbits8(_addr, _v) out_8((_addr), in_8(_addr) & ~(_v))
518
556#endif /* __KERNEL__ */ 519#endif /* __KERNEL__ */
diff --git a/include/asm-ppc/machdep.h b/include/asm-ppc/machdep.h
index 293a444a1d77..a20b499b0186 100644
--- a/include/asm-ppc/machdep.h
+++ b/include/asm-ppc/machdep.h
@@ -8,10 +8,6 @@
8#include <asm/setup.h> 8#include <asm/setup.h>
9#include <asm/page.h> 9#include <asm/page.h>
10 10
11#ifdef CONFIG_APUS
12#include <asm-m68k/machdep.h>
13#endif
14
15struct pt_regs; 11struct pt_regs;
16struct pci_bus; 12struct pci_bus;
17struct pci_dev; 13struct pci_dev;
diff --git a/include/asm-ppc/ocp.h b/include/asm-ppc/ocp.h
index 16dbc7d17450..1379a4f76de3 100644
--- a/include/asm-ppc/ocp.h
+++ b/include/asm-ppc/ocp.h
@@ -27,10 +27,10 @@
27#include <linux/init.h> 27#include <linux/init.h>
28#include <linux/list.h> 28#include <linux/list.h>
29#include <linux/device.h> 29#include <linux/device.h>
30#include <linux/rwsem.h>
30 31
31#include <asm/mmu.h> 32#include <asm/mmu.h>
32#include <asm/ocp_ids.h> 33#include <asm/ocp_ids.h>
33#include <asm/rwsem.h>
34#include <asm/semaphore.h> 34#include <asm/semaphore.h>
35 35
36#ifdef CONFIG_PPC_OCP 36#ifdef CONFIG_PPC_OCP
diff --git a/include/asm-ppc/page.h b/include/asm-ppc/page.h
index fe95c8258cf9..ad4c5a1bc9d6 100644
--- a/include/asm-ppc/page.h
+++ b/include/asm-ppc/page.h
@@ -97,62 +97,22 @@ extern void clear_user_page(void *page, unsigned long vaddr, struct page *pg);
97extern void copy_user_page(void *to, void *from, unsigned long vaddr, 97extern void copy_user_page(void *to, void *from, unsigned long vaddr,
98 struct page *pg); 98 struct page *pg);
99 99
100#ifndef CONFIG_APUS
101#define PPC_MEMSTART 0 100#define PPC_MEMSTART 0
102#define PPC_PGSTART 0
103#define PPC_MEMOFFSET PAGE_OFFSET 101#define PPC_MEMOFFSET PAGE_OFFSET
104#else
105extern unsigned long ppc_memstart;
106extern unsigned long ppc_pgstart;
107extern unsigned long ppc_memoffset;
108#define PPC_MEMSTART ppc_memstart
109#define PPC_PGSTART ppc_pgstart
110#define PPC_MEMOFFSET ppc_memoffset
111#endif
112 102
113#if defined(CONFIG_APUS) && !defined(MODULE)
114/* map phys->virtual and virtual->phys for RAM pages */
115static inline unsigned long ___pa(unsigned long v)
116{
117 unsigned long p;
118 asm volatile ("1: addis %0, %1, %2;"
119 ".section \".vtop_fixup\",\"aw\";"
120 ".align 1;"
121 ".long 1b;"
122 ".previous;"
123 : "=r" (p)
124 : "b" (v), "K" (((-PAGE_OFFSET) >> 16) & 0xffff));
125
126 return p;
127}
128static inline void* ___va(unsigned long p)
129{
130 unsigned long v;
131 asm volatile ("1: addis %0, %1, %2;"
132 ".section \".ptov_fixup\",\"aw\";"
133 ".align 1;"
134 ".long 1b;"
135 ".previous;"
136 : "=r" (v)
137 : "b" (p), "K" (((PAGE_OFFSET) >> 16) & 0xffff));
138
139 return (void*) v;
140}
141#else
142#define ___pa(vaddr) ((vaddr)-PPC_MEMOFFSET) 103#define ___pa(vaddr) ((vaddr)-PPC_MEMOFFSET)
143#define ___va(paddr) ((paddr)+PPC_MEMOFFSET) 104#define ___va(paddr) ((paddr)+PPC_MEMOFFSET)
144#endif
145 105
146extern int page_is_ram(unsigned long pfn); 106extern int page_is_ram(unsigned long pfn);
147 107
148#define __pa(x) ___pa((unsigned long)(x)) 108#define __pa(x) ___pa((unsigned long)(x))
149#define __va(x) ((void *)(___va((unsigned long)(x)))) 109#define __va(x) ((void *)(___va((unsigned long)(x))))
150 110
151#define ARCH_PFN_OFFSET (PPC_PGSTART) 111#define ARCH_PFN_OFFSET 0
152#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) 112#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
153#define page_to_virt(page) __va(page_to_pfn(page) << PAGE_SHIFT) 113#define page_to_virt(page) __va(page_to_pfn(page) << PAGE_SHIFT)
154 114
155#define pfn_valid(pfn) (((pfn) - PPC_PGSTART) < max_mapnr) 115#define pfn_valid(pfn) ((pfn) < max_mapnr)
156#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) 116#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
157 117
158/* Pure 2^n version of get_order */ 118/* Pure 2^n version of get_order */
diff --git a/include/asm-ppc/pgtable.h b/include/asm-ppc/pgtable.h
index c159315d2c8f..063ad91cbbcc 100644
--- a/include/asm-ppc/pgtable.h
+++ b/include/asm-ppc/pgtable.h
@@ -765,14 +765,6 @@ extern void paging_init(void);
765#define pte_to_pgoff(pte) (pte_val(pte) >> 3) 765#define pte_to_pgoff(pte) (pte_val(pte) >> 3)
766#define pgoff_to_pte(off) ((pte_t) { ((off) << 3) | _PAGE_FILE }) 766#define pgoff_to_pte(off) ((pte_t) { ((off) << 3) | _PAGE_FILE })
767 767
768/* CONFIG_APUS */
769/* For virtual address to physical address conversion */
770extern void cache_clear(__u32 addr, int length);
771extern void cache_push(__u32 addr, int length);
772extern int mm_end_of_chunk (unsigned long addr, int len);
773extern unsigned long iopa(unsigned long addr);
774extern unsigned long mm_ptov(unsigned long addr) __attribute_const__;
775
776/* Values for nocacheflag and cmode */ 768/* Values for nocacheflag and cmode */
777/* These are not used by the APUS kernel_map, but prevents 769/* These are not used by the APUS kernel_map, but prevents
778 compilation errors. */ 770 compilation errors. */
diff --git a/include/asm-ppc/prom.h b/include/asm-ppc/prom.h
index 901f7fa8b2d7..71f4c996fe75 100644
--- a/include/asm-ppc/prom.h
+++ b/include/asm-ppc/prom.h
@@ -35,7 +35,6 @@ extern unsigned long sub_reloc_offset(unsigned long);
35#define machine_is_compatible(x) 0 35#define machine_is_compatible(x) 0
36#define of_find_compatible_node(f, t, c) NULL 36#define of_find_compatible_node(f, t, c) NULL
37#define of_get_property(p, n, l) NULL 37#define of_get_property(p, n, l) NULL
38#define get_property(a, b, c) of_get_property((a), (b), (c))
39 38
40#endif /* _PPC_PROM_H */ 39#endif /* _PPC_PROM_H */
41#endif /* __KERNEL__ */ 40#endif /* __KERNEL__ */
diff --git a/include/linux/elf.h b/include/linux/elf.h
index 8b17ffe222c4..d2da84acf45d 100644
--- a/include/linux/elf.h
+++ b/include/linux/elf.h
@@ -389,12 +389,14 @@ extern Elf64_Dyn _DYNAMIC [];
389 389
390#endif 390#endif
391 391
392/* Optional callbacks to write extra ELF notes. */
392#ifndef ARCH_HAVE_EXTRA_ELF_NOTES 393#ifndef ARCH_HAVE_EXTRA_ELF_NOTES
393static inline int arch_notes_size(void) { return 0; } 394static inline int elf_coredump_extra_notes_size(void) { return 0; }
394static inline void arch_write_notes(struct file *file) { } 395static inline int elf_coredump_extra_notes_write(struct file *file,
395 396 loff_t *foffset) { return 0; }
396#define ELF_CORE_EXTRA_NOTES_SIZE arch_notes_size() 397#else
397#define ELF_CORE_WRITE_EXTRA_NOTES arch_write_notes(file) 398extern int elf_coredump_extra_notes_size(void);
398#endif /* ARCH_HAVE_EXTRA_ELF_NOTES */ 399extern int elf_coredump_extra_notes_write(struct file *file, loff_t *foffset);
400#endif
399 401
400#endif /* _LINUX_ELF_H */ 402#endif /* _LINUX_ELF_H */
diff --git a/include/linux/of.h b/include/linux/of.h
index 47734ffd9745..6df80e985914 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -54,7 +54,6 @@ extern int of_device_is_compatible(const struct device_node *device,
54extern const void *of_get_property(const struct device_node *node, 54extern const void *of_get_property(const struct device_node *node,
55 const char *name, 55 const char *name,
56 int *lenp); 56 int *lenp);
57#define get_property(a, b, c) of_get_property((a), (b), (c))
58extern int of_n_addr_cells(struct device_node *np); 57extern int of_n_addr_cells(struct device_node *np);
59extern int of_n_size_cells(struct device_node *np); 58extern int of_n_size_cells(struct device_node *np);
60 59
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 8acae4eeaa76..3948708c42ca 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -2113,8 +2113,11 @@
2113#define PCI_DEVICE_ID_MPC8533 0x0031 2113#define PCI_DEVICE_ID_MPC8533 0x0031
2114#define PCI_DEVICE_ID_MPC8544E 0x0032 2114#define PCI_DEVICE_ID_MPC8544E 0x0032
2115#define PCI_DEVICE_ID_MPC8544 0x0033 2115#define PCI_DEVICE_ID_MPC8544 0x0033
2116#define PCI_DEVICE_ID_MPC8572E 0x0040
2117#define PCI_DEVICE_ID_MPC8572 0x0041
2116#define PCI_DEVICE_ID_MPC8641 0x7010 2118#define PCI_DEVICE_ID_MPC8641 0x7010
2117#define PCI_DEVICE_ID_MPC8641D 0x7011 2119#define PCI_DEVICE_ID_MPC8641D 0x7011
2120#define PCI_DEVICE_ID_MPC8610 0x7018
2118 2121
2119#define PCI_VENDOR_ID_PASEMI 0x1959 2122#define PCI_VENDOR_ID_PASEMI 0x1959
2120 2123
diff --git a/include/linux/xilinxfb.h b/include/linux/xilinxfb.h
new file mode 100644
index 000000000000..f2463f559fb9
--- /dev/null
+++ b/include/linux/xilinxfb.h
@@ -0,0 +1,30 @@
1/*
2 * Platform device data for Xilinx Framebuffer device
3 *
4 * Copyright 2007 Secret Lab Technologies Ltd.
5 *
6 * This file is licensed under the terms of the GNU General Public License
7 * version 2. This program is licensed "as is" without any warranty of any
8 * kind, whether express or implied.
9 */
10
11#ifndef __XILINXFB_H__
12#define __XILINXFB_H__
13
14#include <linux/types.h>
15
16/* ML300/403 reference design framebuffer driver platform data struct */
17struct xilinxfb_platform_data {
18 u32 rotate_screen; /* Flag to rotate display 180 degrees */
19 u32 screen_height_mm; /* Physical dimentions of screen in mm */
20 u32 screen_width_mm;
21 u32 xres, yres; /* resolution of screen in pixels */
22 u32 xvirt, yvirt; /* resolution of memory buffer */
23
24 /* Physical address of framebuffer memory; If non-zero, driver
25 * will use provided memory address instead of allocating one from
26 * the consistent pool. */
27 u32 fb_phys;
28};
29
30#endif /* __XILINXFB_H__ */