ucc.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * Copyright (C) 2006 Freescale Semiconductor, 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. #include <asm/immap_qe.h>
  18. #include <asm/qe.h>
  19. #define STATISTICS
  20. #define UCC_MAX_NUM 8
  21. /* Slow or fast type for UCCs.
  22. */
  23. enum ucc_speed_type {
  24. UCC_SPEED_TYPE_FAST = UCC_GUEMR_MODE_FAST_RX | UCC_GUEMR_MODE_FAST_TX,
  25. UCC_SPEED_TYPE_SLOW = UCC_GUEMR_MODE_SLOW_RX | UCC_GUEMR_MODE_SLOW_TX
  26. };
  27. /* ucc_set_type
  28. * Sets UCC to slow or fast mode.
  29. *
  30. * ucc_num - (In) number of UCC (0-7).
  31. * speed - (In) slow or fast mode for UCC.
  32. */
  33. int ucc_set_type(unsigned int ucc_num, enum ucc_speed_type speed);
  34. int ucc_set_qe_mux_mii_mng(unsigned int ucc_num);
  35. int ucc_set_qe_mux_rxtx(unsigned int ucc_num, enum qe_clock clock,
  36. enum comm_dir mode);
  37. int ucc_mux_set_grant_tsa_bkpt(unsigned int ucc_num, int set, u32 mask);
  38. /* QE MUX clock routing for UCC
  39. */
  40. static inline int ucc_set_qe_mux_grant(unsigned int ucc_num, int set)
  41. {
  42. return ucc_mux_set_grant_tsa_bkpt(ucc_num, set, QE_CMXUCR_GRANT);
  43. }
  44. static inline int ucc_set_qe_mux_tsa(unsigned int ucc_num, int set)
  45. {
  46. return ucc_mux_set_grant_tsa_bkpt(ucc_num, set, QE_CMXUCR_TSA);
  47. }
  48. static inline int ucc_set_qe_mux_bkpt(unsigned int ucc_num, int set)
  49. {
  50. return ucc_mux_set_grant_tsa_bkpt(ucc_num, set, QE_CMXUCR_BKPT);
  51. }
  52. #endif /* __UCC_H__ */