aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-powerpc
diff options
context:
space:
mode:
authorTimur Tabi <timur@freescale.com>2007-10-03 12:34:59 -0400
committerKumar Gala <galak@kernel.crashing.org>2007-10-08 09:38:15 -0400
commit6b0b594bb81f86dbc7b0829ee5102abaab242913 (patch)
tree707463987ab05d04596763afa9db1c63cbde4c4a /include/asm-powerpc
parent6039680705906f270411435c05c869ac4f59ef10 (diff)
[POWERPC] qe: miscellaneous code improvements and fixes to the QE library
This patch makes numerous miscellaneous code improvements to the QE library. 1. Remove struct ucc_common and merge ucc_init_guemr() into ucc_set_type() (every caller of ucc_init_guemr() also calls ucc_set_type()). Modify all callers of ucc_set_type() accordingly. 2. Remove the unused enum ucc_pram_initial_offset. 3. Refactor qe_setbrg(), also implement work-around for errata QE_General4. 4. Several printk() calls were missing the terminating \n. 5. Add __iomem where needed, and change u16 to __be16 and u32 to __be32 where appropriate. 6. In ucc_slow_init() the RBASE and TBASE registers in the PRAM were programmed with the wrong value. 7. Add the protocol type to struct us_info and updated ucc_slow_init() to use it, instead of always programming QE_CR_PROTOCOL_UNSPECIFIED. 8. Rename ucc_slow_restart_x() to ucc_slow_restart_tx() 9. Add several macros in qe.h (mostly for slow UCC support, but also to standardize some naming convention) and remove several unused macros. 10. Update ucc_geth.c to use the new macros. 11. Add ucc_slow_info.protocol to specify which QE_CR_PROTOCOL_xxx protcol to use when initializing the UCC in ucc_slow_init(). 12. Rename ucc_slow_pram.rfcr to rbmr and ucc_slow_pram.tfcr to tbmr, since these are the real names of the registers. 13. Use the setbits, clrbits, and clrsetbits where appropriate. 14. Refactor ucc_set_qe_mux_rxtx(). 15. Remove all instances of 'volatile'. 16. Simplify get_cmxucr_reg(); 17. Replace qe_mux.cmxucrX with qe_mux.cmxucr[]. 18. Updated struct ucc_geth because struct ucc_fast is not padded any more. Signed-off-by: Timur Tabi <timur@freescale.com> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'include/asm-powerpc')
-rw-r--r--include/asm-powerpc/immap_qe.h30
-rw-r--r--include/asm-powerpc/qe.h243
-rw-r--r--include/asm-powerpc/ucc.h40
-rw-r--r--include/asm-powerpc/ucc_slow.h9
4 files changed, 193 insertions, 129 deletions
diff --git a/include/asm-powerpc/immap_qe.h b/include/asm-powerpc/immap_qe.h
index 02548f74ccb7..aba9806b31c9 100644
--- a/include/asm-powerpc/immap_qe.h
+++ b/include/asm-powerpc/immap_qe.h
@@ -97,10 +97,7 @@ struct qe_mux {
97 __be32 cmxsi1cr_l; /* CMX SI1 clock route low register */ 97 __be32 cmxsi1cr_l; /* CMX SI1 clock route low register */
98 __be32 cmxsi1cr_h; /* CMX SI1 clock route high register */ 98 __be32 cmxsi1cr_h; /* CMX SI1 clock route high register */
99 __be32 cmxsi1syr; /* CMX SI1 SYNC route register */ 99 __be32 cmxsi1syr; /* CMX SI1 SYNC route register */
100 __be32 cmxucr1; /* CMX UCC1, UCC3 clock route register */ 100 __be32 cmxucr[4]; /* CMX UCCx clock route registers */
101 __be32 cmxucr2; /* CMX UCC5, UCC7 clock route register */
102 __be32 cmxucr3; /* CMX UCC2, UCC4 clock route register */
103 __be32 cmxucr4; /* CMX UCC6, UCC8 clock route register */
104 __be32 cmxupcr; /* CMX UPC clock route register */ 101 __be32 cmxupcr; /* CMX UPC clock route register */
105 u8 res0[0x1C]; 102 u8 res0[0x1C];
106} __attribute__ ((packed)); 103} __attribute__ ((packed));
@@ -261,7 +258,6 @@ struct ucc_slow {
261 __be16 utpt; 258 __be16 utpt;
262 u8 res4[0x52]; 259 u8 res4[0x52];
263 u8 guemr; /* UCC general extended mode register */ 260 u8 guemr; /* UCC general extended mode register */
264 u8 res5[0x200 - 0x091];
265} __attribute__ ((packed)); 261} __attribute__ ((packed));
266 262
267/* QE UCC Fast */ 263/* QE UCC Fast */
@@ -294,21 +290,13 @@ struct ucc_fast {
294 __be32 urtry; /* UCC retry counter register */ 290 __be32 urtry; /* UCC retry counter register */
295 u8 res8[0x4C]; 291 u8 res8[0x4C];
296 u8 guemr; /* UCC general extended mode register */ 292 u8 guemr; /* UCC general extended mode register */
297 u8 res9[0x100 - 0x091];
298} __attribute__ ((packed));
299
300/* QE UCC */
301struct ucc_common {
302 u8 res1[0x90];
303 u8 guemr;
304 u8 res2[0x200 - 0x091];
305} __attribute__ ((packed)); 293} __attribute__ ((packed));
306 294
307struct ucc { 295struct ucc {
308 union { 296 union {
309 struct ucc_slow slow; 297 struct ucc_slow slow;
310 struct ucc_fast fast; 298 struct ucc_fast fast;
311 struct ucc_common common; 299 u8 res[0x200]; /* UCC blocks are 512 bytes each */
312 }; 300 };
313} __attribute__ ((packed)); 301} __attribute__ ((packed));
314 302
@@ -407,7 +395,7 @@ struct dbg {
407 395
408/* RISC Special Registers (Trap and Breakpoint) */ 396/* RISC Special Registers (Trap and Breakpoint) */
409struct rsp { 397struct rsp {
410 u8 fixme[0x100]; 398 u32 reg[0x40]; /* 64 32-bit registers */
411} __attribute__ ((packed)); 399} __attribute__ ((packed));
412 400
413struct qe_immap { 401struct qe_immap {
@@ -436,11 +424,13 @@ struct qe_immap {
436 u8 res13[0x600]; 424 u8 res13[0x600];
437 struct upc upc2; /* MultiPHY UTOPIA POS Ctrlr 2*/ 425 struct upc upc2; /* MultiPHY UTOPIA POS Ctrlr 2*/
438 struct sdma sdma; /* SDMA */ 426 struct sdma sdma; /* SDMA */
439 struct dbg dbg; /* Debug Space */ 427 struct dbg dbg; /* 0x104080 - 0x1040FF
440 struct rsp rsp[0x2]; /* RISC Special Registers 428 Debug Space */
429 struct rsp rsp[0x2]; /* 0x104100 - 0x1042FF
430 RISC Special Registers
441 (Trap and Breakpoint) */ 431 (Trap and Breakpoint) */
442 u8 res14[0x300]; 432 u8 res14[0x300]; /* 0x104300 - 0x1045FF */
443 u8 res15[0x3A00]; 433 u8 res15[0x3A00]; /* 0x104600 - 0x107FFF */
444 u8 res16[0x8000]; /* 0x108000 - 0x110000 */ 434 u8 res16[0x8000]; /* 0x108000 - 0x110000 */
445 u8 muram[0xC000]; /* 0x110000 - 0x11C000 435 u8 muram[0xC000]; /* 0x110000 - 0x11C000
446 Multi-user RAM */ 436 Multi-user RAM */
@@ -451,7 +441,7 @@ struct qe_immap {
451extern struct qe_immap *qe_immr; 441extern struct qe_immap *qe_immr;
452extern phys_addr_t get_qe_base(void); 442extern phys_addr_t get_qe_base(void);
453 443
454static inline unsigned long immrbar_virt_to_phys(volatile void * address) 444static inline unsigned long immrbar_virt_to_phys(void *address)
455{ 445{
456 if ( ((u32)address >= (u32)qe_immr) && 446 if ( ((u32)address >= (u32)qe_immr) &&
457 ((u32)address < ((u32)qe_immr + QE_IMMAP_SIZE)) ) 447 ((u32)address < ((u32)qe_immr + QE_IMMAP_SIZE)) )
diff --git a/include/asm-powerpc/qe.h b/include/asm-powerpc/qe.h
index ad23c580631c..0dabe46a29d2 100644
--- a/include/asm-powerpc/qe.h
+++ b/include/asm-powerpc/qe.h
@@ -38,7 +38,7 @@ extern int par_io_data_set(u8 port, u8 pin, u8 val);
38 38
39/* QE internal API */ 39/* QE internal API */
40int 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);
41void qe_setbrg(u32 brg, u32 rate); 41void qe_setbrg(unsigned int brg, unsigned int rate, unsigned int multiplier);
42int qe_get_snum(void); 42int qe_get_snum(void);
43void qe_put_snum(u8 snum); 43void qe_put_snum(u8 snum);
44unsigned long qe_muram_alloc(int size, int align); 44unsigned long qe_muram_alloc(int size, int align);
@@ -49,14 +49,28 @@ void *qe_muram_addr(unsigned long offset);
49 49
50/* Buffer descriptors */ 50/* Buffer descriptors */
51struct qe_bd { 51struct qe_bd {
52 u16 status; 52 __be16 status;
53 u16 length; 53 __be16 length;
54 u32 buf; 54 __be32 buf;
55} __attribute__ ((packed)); 55} __attribute__ ((packed));
56 56
57#define BD_STATUS_MASK 0xffff0000 57#define BD_STATUS_MASK 0xffff0000
58#define BD_LENGTH_MASK 0x0000ffff 58#define BD_LENGTH_MASK 0x0000ffff
59 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
60/* Alignment */ 74/* Alignment */
61#define QE_INTR_TABLE_ALIGN 16 /* ??? */ 75#define QE_INTR_TABLE_ALIGN 16 /* ??? */
62#define QE_ALIGNMENT_OF_BD 8 76#define QE_ALIGNMENT_OF_BD 8
@@ -269,15 +283,12 @@ enum qe_clock {
269/* 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 */
270#define QE_CR_PROTOCOL_UNSPECIFIED 0x00 /* For all other protocols */ 284#define QE_CR_PROTOCOL_UNSPECIFIED 0x00 /* For all other protocols */
271#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
272#define QE_CR_PROTOCOL_ATM_POS 0x0A 288#define QE_CR_PROTOCOL_ATM_POS 0x0A
273#define QE_CR_PROTOCOL_ETHERNET 0x0C 289#define QE_CR_PROTOCOL_ETHERNET 0x0C
274#define QE_CR_PROTOCOL_L2_SWITCH 0x0D 290#define QE_CR_PROTOCOL_L2_SWITCH 0x0D
275 291
276/* BMR byte order */
277#define QE_BMR_BYTE_ORDER_BO_PPC 0x08 /* powerpc little endian */
278#define QE_BMR_BYTE_ORDER_BO_MOT 0x10 /* motorola big endian */
279#define QE_BMR_BYTE_ORDER_BO_MAX 0x18
280
281/* BRG configuration register */ 292/* BRG configuration register */
282#define QE_BRGC_ENABLE 0x00010000 293#define QE_BRGC_ENABLE 0x00010000
283#define QE_BRGC_DIVISOR_SHIFT 1 294#define QE_BRGC_DIVISOR_SHIFT 1
@@ -324,41 +335,41 @@ enum qe_clock {
324#define UPGCR_ADDR 0x10000000 /* Master MPHY Addr multiplexing */ 335#define UPGCR_ADDR 0x10000000 /* Master MPHY Addr multiplexing */
325#define UPGCR_DIAG 0x01000000 /* Diagnostic mode */ 336#define UPGCR_DIAG 0x01000000 /* Diagnostic mode */
326 337
327/* UCC */ 338/* UCC GUEMR register */
328#define UCC_GUEMR_MODE_MASK_RX 0x02 339#define UCC_GUEMR_MODE_MASK_RX 0x02
329#define UCC_GUEMR_MODE_MASK_TX 0x01
330#define UCC_GUEMR_MODE_FAST_RX 0x02 340#define UCC_GUEMR_MODE_FAST_RX 0x02
331#define UCC_GUEMR_MODE_FAST_TX 0x01
332#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
333#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)
334#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
335 must be set 1 */ 347 must be set 1 */
336 348
337/* structure representing UCC SLOW parameter RAM */ 349/* structure representing UCC SLOW parameter RAM */
338struct ucc_slow_pram { 350struct ucc_slow_pram {
339 u16 rbase; /* RX BD base address */ 351 __be16 rbase; /* RX BD base address */
340 u16 tbase; /* TX BD base address */ 352 __be16 tbase; /* TX BD base address */
341 u8 rfcr; /* Rx function code */ 353 u8 rbmr; /* RX bus mode register (same as CPM's RFCR) */
342 u8 tfcr; /* Tx function code */ 354 u8 tbmr; /* TX bus mode register (same as CPM's TFCR) */
343 u16 mrblr; /* Rx buffer length */ 355 __be16 mrblr; /* Rx buffer length */
344 u32 rstate; /* Rx internal state */ 356 __be32 rstate; /* Rx internal state */
345 u32 rptr; /* Rx internal data pointer */ 357 __be32 rptr; /* Rx internal data pointer */
346 u16 rbptr; /* rb BD Pointer */ 358 __be16 rbptr; /* rb BD Pointer */
347 u16 rcount; /* Rx internal byte count */ 359 __be16 rcount; /* Rx internal byte count */
348 u32 rtemp; /* Rx temp */ 360 __be32 rtemp; /* Rx temp */
349 u32 tstate; /* Tx internal state */ 361 __be32 tstate; /* Tx internal state */
350 u32 tptr; /* Tx internal data pointer */ 362 __be32 tptr; /* Tx internal data pointer */
351 u16 tbptr; /* Tx BD pointer */ 363 __be16 tbptr; /* Tx BD pointer */
352 u16 tcount; /* Tx byte count */ 364 __be16 tcount; /* Tx byte count */
353 u32 ttemp; /* Tx temp */ 365 __be32 ttemp; /* Tx temp */
354 u32 rcrc; /* temp receive CRC */ 366 __be32 rcrc; /* temp receive CRC */
355 u32 tcrc; /* temp transmit CRC */ 367 __be32 tcrc; /* temp transmit CRC */
356} __attribute__ ((packed)); 368} __attribute__ ((packed));
357 369
358/* General UCC SLOW Mode Register (GUMRH & GUMRL) */ 370/* General UCC SLOW Mode Register (GUMRH & GUMRL) */
359#define UCC_SLOW_GUMR_H_CRC16 0x00004000 371#define UCC_SLOW_GUMR_H_SAM_QMC 0x00000000
360#define UCC_SLOW_GUMR_H_CRC16CCITT 0x00000000 372#define UCC_SLOW_GUMR_H_SAM_SATM 0x00008000
361#define UCC_SLOW_GUMR_H_CRC32CCITT 0x00008000
362#define UCC_SLOW_GUMR_H_REVD 0x00002000 373#define UCC_SLOW_GUMR_H_REVD 0x00002000
363#define UCC_SLOW_GUMR_H_TRX 0x00001000 374#define UCC_SLOW_GUMR_H_TRX 0x00001000
364#define UCC_SLOW_GUMR_H_TTX 0x00000800 375#define UCC_SLOW_GUMR_H_TTX 0x00000800
@@ -378,9 +389,33 @@ struct ucc_slow_pram {
378#define UCC_SLOW_GUMR_L_TCI 0x10000000 389#define UCC_SLOW_GUMR_L_TCI 0x10000000
379#define UCC_SLOW_GUMR_L_RINV 0x02000000 390#define UCC_SLOW_GUMR_L_RINV 0x02000000
380#define UCC_SLOW_GUMR_L_TINV 0x01000000 391#define UCC_SLOW_GUMR_L_TINV 0x01000000
381#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
382#define UCC_SLOW_GUMR_L_ENR 0x00000020 412#define UCC_SLOW_GUMR_L_ENR 0x00000020
383#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
384 419
385/* General UCC FAST Mode Register */ 420/* General UCC FAST Mode Register */
386#define UCC_FAST_GUMR_TCI 0x20000000 421#define UCC_FAST_GUMR_TCI 0x20000000
@@ -397,53 +432,111 @@ struct ucc_slow_pram {
397#define UCC_FAST_GUMR_ENR 0x00000020 432#define UCC_FAST_GUMR_ENR 0x00000020
398#define UCC_FAST_GUMR_ENT 0x00000010 433#define UCC_FAST_GUMR_ENT 0x00000010
399 434
400/* Slow UCC Event Register (UCCE) */ 435/* UART Slow UCC Event Register (UCCE) */
401#define UCC_SLOW_UCCE_GLR 0x1000 436#define UCC_UART_UCCE_AB 0x0200
402#define UCC_SLOW_UCCE_GLT 0x0800 437#define UCC_UART_UCCE_IDLE 0x0100
403#define UCC_SLOW_UCCE_DCC 0x0400 438#define UCC_UART_UCCE_GRA 0x0080
404#define UCC_SLOW_UCCE_FLG 0x0200 439#define UCC_UART_UCCE_BRKE 0x0040
405#define UCC_SLOW_UCCE_AB 0x0200 440#define UCC_UART_UCCE_BRKS 0x0020
406#define UCC_SLOW_UCCE_IDLE 0x0100 441#define UCC_UART_UCCE_CCR 0x0008
407#define UCC_SLOW_UCCE_GRA 0x0080 442#define UCC_UART_UCCE_BSY 0x0004
408#define UCC_SLOW_UCCE_TXE 0x0010 443#define UCC_UART_UCCE_TX 0x0002
409#define UCC_SLOW_UCCE_RXF 0x0008 444#define UCC_UART_UCCE_RX 0x0001
410#define UCC_SLOW_UCCE_CCR 0x0008 445
411#define UCC_SLOW_UCCE_RCH 0x0008 446/* HDLC Slow UCC Event Register (UCCE) */
412#define UCC_SLOW_UCCE_BSY 0x0004 447#define UCC_HDLC_UCCE_GLR 0x1000
413#define UCC_SLOW_UCCE_TXB 0x0002 448#define UCC_HDLC_UCCE_GLT 0x0800
414#define UCC_SLOW_UCCE_TX 0x0002 449#define UCC_HDLC_UCCE_IDLE 0x0100
415#define UCC_SLOW_UCCE_RX 0x0001 450#define UCC_HDLC_UCCE_BRKE 0x0040
416#define UCC_SLOW_UCCE_GOV 0x0001 451#define UCC_HDLC_UCCE_BRKS 0x0020
417#define UCC_SLOW_UCCE_GUN 0x0002 452#define UCC_HDLC_UCCE_TXE 0x0010
418#define UCC_SLOW_UCCE_GINT 0x0004 453#define UCC_HDLC_UCCE_RXF 0x0008
419#define UCC_SLOW_UCCE_IQOV 0x0008 454#define UCC_HDLC_UCCE_BSY 0x0004
420 455#define UCC_HDLC_UCCE_TXB 0x0002
421#define UCC_SLOW_UCCE_HDLC_SET (UCC_SLOW_UCCE_TXE | UCC_SLOW_UCCE_BSY | \ 456#define UCC_HDLC_UCCE_RXB 0x0001
422 UCC_SLOW_UCCE_GRA | UCC_SLOW_UCCE_TXB | UCC_SLOW_UCCE_RXF | \ 457
423 UCC_SLOW_UCCE_DCC | UCC_SLOW_UCCE_GLT | UCC_SLOW_UCCE_GLR) 458/* BISYNC Slow UCC Event Register (UCCE) */
424#define UCC_SLOW_UCCE_ENET_SET (UCC_SLOW_UCCE_TXE | UCC_SLOW_UCCE_BSY | \ 459#define UCC_BISYNC_UCCE_GRA 0x0080
425 UCC_SLOW_UCCE_GRA | UCC_SLOW_UCCE_TXB | UCC_SLOW_UCCE_RXF) 460#define UCC_BISYNC_UCCE_TXE 0x0010
426#define UCC_SLOW_UCCE_TRANS_SET (UCC_SLOW_UCCE_TXE | UCC_SLOW_UCCE_BSY | \ 461#define UCC_BISYNC_UCCE_RCH 0x0008
427 UCC_SLOW_UCCE_GRA | UCC_SLOW_UCCE_TX | UCC_SLOW_UCCE_RX | \ 462#define UCC_BISYNC_UCCE_BSY 0x0004
428 UCC_SLOW_UCCE_DCC | UCC_SLOW_UCCE_GLT | UCC_SLOW_UCCE_GLR) 463#define UCC_BISYNC_UCCE_TXB 0x0002
429#define UCC_SLOW_UCCE_UART_SET (UCC_SLOW_UCCE_BSY | UCC_SLOW_UCCE_GRA | \ 464#define UCC_BISYNC_UCCE_RXB 0x0001
430 UCC_SLOW_UCCE_TXB | UCC_SLOW_UCCE_TX | UCC_SLOW_UCCE_RX | \ 465
431 UCC_SLOW_UCCE_GLT | UCC_SLOW_UCCE_GLR) 466/* Gigabit Ethernet Fast UCC Event Register (UCCE) */
432#define UCC_SLOW_UCCE_QMC_SET (UCC_SLOW_UCCE_IQOV | UCC_SLOW_UCCE_GINT | \ 467#define UCC_GETH_UCCE_MPD 0x80000000
433 UCC_SLOW_UCCE_GUN | UCC_SLOW_UCCE_GOV) 468#define UCC_GETH_UCCE_SCAR 0x40000000
434 469#define UCC_GETH_UCCE_GRA 0x20000000
435#define UCC_SLOW_UCCE_OTHER (UCC_SLOW_UCCE_TXE | UCC_SLOW_UCCE_BSY | \ 470#define UCC_GETH_UCCE_CBPR 0x10000000
436 UCC_SLOW_UCCE_GRA | UCC_SLOW_UCCE_DCC | UCC_SLOW_UCCE_GLT | \ 471#define UCC_GETH_UCCE_BSY 0x08000000
437 UCC_SLOW_UCCE_GLR) 472#define UCC_GETH_UCCE_RXC 0x04000000
438 473#define UCC_GETH_UCCE_TXC 0x02000000
439#define UCC_SLOW_INTR_TX UCC_SLOW_UCCE_TXB 474#define UCC_GETH_UCCE_TXE 0x01000000
440#define UCC_SLOW_INTR_RX (UCC_SLOW_UCCE_RXF | UCC_SLOW_UCCE_RX) 475#define UCC_GETH_UCCE_TXB7 0x00800000
441#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
442 527
443/* UCC Transmit On Demand Register (UTODR) */ 528/* UCC Transmit On Demand Register (UTODR) */
444#define UCC_SLOW_TOD 0x8000 529#define UCC_SLOW_TOD 0x8000
445#define UCC_FAST_TOD 0x8000 530#define UCC_FAST_TOD 0x8000
446 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
447/* Function code masks */ 540/* Function code masks */
448#define FC_GBL 0x20 541#define FC_GBL 0x20
449#define FC_DTB_LCL 0x02 542#define FC_DTB_LCL 0x02
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