Li Yang | 9865853 | 2006-10-03 23:10:46 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2006 Freescale Semicondutor, Inc. All rights reserved. |
| 3 | * |
| 4 | * Authors: Shlomi Gridish <gridish@freescale.com> |
| 5 | * Li Yang <leoli@freescale.com> |
| 6 | * |
| 7 | * Description: |
| 8 | * Internal header file for UCC unit routines. |
| 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 | #ifndef __UCC_H__ |
| 16 | #define __UCC_H__ |
| 17 | |
| 18 | #include <asm/immap_qe.h> |
| 19 | #include <asm/qe.h> |
| 20 | |
| 21 | #define STATISTICS |
| 22 | |
| 23 | #define UCC_MAX_NUM 8 |
| 24 | |
| 25 | /* Slow or fast type for UCCs. |
| 26 | */ |
| 27 | enum ucc_speed_type { |
Timur Tabi | 6b0b594 | 2007-10-03 11:34:59 -0500 | [diff] [blame^] | 28 | UCC_SPEED_TYPE_FAST = UCC_GUEMR_MODE_FAST_RX | UCC_GUEMR_MODE_FAST_TX, |
| 29 | UCC_SPEED_TYPE_SLOW = UCC_GUEMR_MODE_SLOW_RX | UCC_GUEMR_MODE_SLOW_TX |
Li Yang | 9865853 | 2006-10-03 23:10:46 -0500 | [diff] [blame] | 30 | }; |
| 31 | |
| 32 | /* ucc_set_type |
| 33 | * Sets UCC to slow or fast mode. |
| 34 | * |
| 35 | * ucc_num - (In) number of UCC (0-7). |
Li Yang | 9865853 | 2006-10-03 23:10:46 -0500 | [diff] [blame] | 36 | * speed - (In) slow or fast mode for UCC. |
| 37 | */ |
Timur Tabi | 6b0b594 | 2007-10-03 11:34:59 -0500 | [diff] [blame^] | 38 | int ucc_set_type(unsigned int ucc_num, enum ucc_speed_type speed); |
Li Yang | 9865853 | 2006-10-03 23:10:46 -0500 | [diff] [blame] | 39 | |
Timur Tabi | 6b0b594 | 2007-10-03 11:34:59 -0500 | [diff] [blame^] | 40 | int ucc_set_qe_mux_mii_mng(unsigned int ucc_num); |
Li Yang | 9865853 | 2006-10-03 23:10:46 -0500 | [diff] [blame] | 41 | |
Timur Tabi | 6b0b594 | 2007-10-03 11:34:59 -0500 | [diff] [blame^] | 42 | int ucc_set_qe_mux_rxtx(unsigned int ucc_num, enum qe_clock clock, |
| 43 | enum comm_dir mode); |
Li Yang | 9865853 | 2006-10-03 23:10:46 -0500 | [diff] [blame] | 44 | |
Timur Tabi | 6b0b594 | 2007-10-03 11:34:59 -0500 | [diff] [blame^] | 45 | int ucc_mux_set_grant_tsa_bkpt(unsigned int ucc_num, int set, u32 mask); |
Li Yang | 9865853 | 2006-10-03 23:10:46 -0500 | [diff] [blame] | 46 | |
| 47 | /* QE MUX clock routing for UCC |
| 48 | */ |
Timur Tabi | 6b0b594 | 2007-10-03 11:34:59 -0500 | [diff] [blame^] | 49 | static inline int ucc_set_qe_mux_grant(unsigned int ucc_num, int set) |
Li Yang | 9865853 | 2006-10-03 23:10:46 -0500 | [diff] [blame] | 50 | { |
| 51 | return ucc_mux_set_grant_tsa_bkpt(ucc_num, set, QE_CMXUCR_GRANT); |
| 52 | } |
| 53 | |
Timur Tabi | 6b0b594 | 2007-10-03 11:34:59 -0500 | [diff] [blame^] | 54 | static inline int ucc_set_qe_mux_tsa(unsigned int ucc_num, int set) |
Li Yang | 9865853 | 2006-10-03 23:10:46 -0500 | [diff] [blame] | 55 | { |
| 56 | return ucc_mux_set_grant_tsa_bkpt(ucc_num, set, QE_CMXUCR_TSA); |
| 57 | } |
| 58 | |
Timur Tabi | 6b0b594 | 2007-10-03 11:34:59 -0500 | [diff] [blame^] | 59 | static inline int ucc_set_qe_mux_bkpt(unsigned int ucc_num, int set) |
Li Yang | 9865853 | 2006-10-03 23:10:46 -0500 | [diff] [blame] | 60 | { |
| 61 | return ucc_mux_set_grant_tsa_bkpt(ucc_num, set, QE_CMXUCR_BKPT); |
| 62 | } |
| 63 | |
| 64 | #endif /* __UCC_H__ */ |