ucc.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. #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_SPEED_TYPE_SLOW
  25. };
  26. /* Initial UCCs Parameter RAM address relative to: MEM_MAP_BASE (IMMR).
  27. */
  28. enum ucc_pram_initial_offset {
  29. UCC_PRAM_OFFSET_UCC1 = 0x8400,
  30. UCC_PRAM_OFFSET_UCC2 = 0x8500,
  31. UCC_PRAM_OFFSET_UCC3 = 0x8600,
  32. UCC_PRAM_OFFSET_UCC4 = 0x9000,
  33. UCC_PRAM_OFFSET_UCC5 = 0x8000,
  34. UCC_PRAM_OFFSET_UCC6 = 0x8100,
  35. UCC_PRAM_OFFSET_UCC7 = 0x8200,
  36. UCC_PRAM_OFFSET_UCC8 = 0x8300
  37. };
  38. /* ucc_set_type
  39. * Sets UCC to slow or fast mode.
  40. *
  41. * ucc_num - (In) number of UCC (0-7).
  42. * regs - (In) pointer to registers base for the UCC.
  43. * speed - (In) slow or fast mode for UCC.
  44. */
  45. int ucc_set_type(int ucc_num, struct ucc_common *regs,
  46. enum ucc_speed_type speed);
  47. /* ucc_init_guemr
  48. * Init the Guemr register.
  49. *
  50. * regs - (In) pointer to registers base for the UCC.
  51. */
  52. int ucc_init_guemr(struct ucc_common *regs);
  53. int ucc_set_qe_mux_mii_mng(int ucc_num);
  54. int ucc_set_qe_mux_rxtx(int ucc_num, enum qe_clock clock, enum comm_dir mode);
  55. int ucc_mux_set_grant_tsa_bkpt(int ucc_num, int set, u32 mask);
  56. /* QE MUX clock routing for UCC
  57. */
  58. static inline int ucc_set_qe_mux_grant(int ucc_num, int set)
  59. {
  60. return ucc_mux_set_grant_tsa_bkpt(ucc_num, set, QE_CMXUCR_GRANT);
  61. }
  62. static inline int ucc_set_qe_mux_tsa(int ucc_num, int set)
  63. {
  64. return ucc_mux_set_grant_tsa_bkpt(ucc_num, set, QE_CMXUCR_TSA);
  65. }
  66. static inline int ucc_set_qe_mux_bkpt(int ucc_num, int set)
  67. {
  68. return ucc_mux_set_grant_tsa_bkpt(ucc_num, set, QE_CMXUCR_BKPT);
  69. }
  70. #endif /* __UCC_H__ */