cvmx-helper-jtag.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Copyright (C) 2020 Marvell International Ltd.
  4. *
  5. * Helper utilities for qlm_jtag.
  6. */
  7. #ifndef __CVMX_HELPER_JTAG_H__
  8. #define __CVMX_HELPER_JTAG_H__
  9. /**
  10. * The JTAG chain for CN52XX and CN56XX is 4 * 268 bits long, or 1072.
  11. * CN5XXX full chain shift is:
  12. * new data => lane 3 => lane 2 => lane 1 => lane 0 => data out
  13. * The JTAG chain for CN63XX is 4 * 300 bits long, or 1200.
  14. * The JTAG chain for CN68XX is 4 * 304 bits long, or 1216.
  15. * The JTAG chain for CN66XX/CN61XX/CNF71XX is 4 * 304 bits long, or 1216.
  16. * CN6XXX full chain shift is:
  17. * new data => lane 0 => lane 1 => lane 2 => lane 3 => data out
  18. * Shift LSB first, get LSB out
  19. */
  20. extern const __cvmx_qlm_jtag_field_t __cvmx_qlm_jtag_field_cn63xx[];
  21. extern const __cvmx_qlm_jtag_field_t __cvmx_qlm_jtag_field_cn66xx[];
  22. extern const __cvmx_qlm_jtag_field_t __cvmx_qlm_jtag_field_cn68xx[];
  23. #define CVMX_QLM_JTAG_UINT32 40
  24. typedef u32 qlm_jtag_uint32_t[CVMX_QLM_JTAG_UINT32 * 8];
  25. /**
  26. * Initialize the internal QLM JTAG logic to allow programming
  27. * of the JTAG chain by the cvmx_helper_qlm_jtag_*() functions.
  28. * These functions should only be used at the direction of Cavium
  29. * Networks. Programming incorrect values into the JTAG chain
  30. * can cause chip damage.
  31. */
  32. void cvmx_helper_qlm_jtag_init(void);
  33. /**
  34. * Write up to 32bits into the QLM jtag chain. Bits are shifted
  35. * into the MSB and out the LSB, so you should shift in the low
  36. * order bits followed by the high order bits. The JTAG chain for
  37. * CN52XX and CN56XX is 4 * 268 bits long, or 1072. The JTAG chain
  38. * for CN63XX is 4 * 300 bits long, or 1200.
  39. *
  40. * @param qlm QLM to shift value into
  41. * @param bits Number of bits to shift in (1-32).
  42. * @param data Data to shift in. Bit 0 enters the chain first, followed by
  43. * bit 1, etc.
  44. *
  45. * Return: The low order bits of the JTAG chain that shifted out of the
  46. * circle.
  47. */
  48. u32 cvmx_helper_qlm_jtag_shift(int qlm, int bits, u32 data);
  49. /**
  50. * Shift long sequences of zeros into the QLM JTAG chain. It is
  51. * common to need to shift more than 32 bits of zeros into the
  52. * chain. This function is a convience wrapper around
  53. * cvmx_helper_qlm_jtag_shift() to shift more than 32 bits of
  54. * zeros at a time.
  55. *
  56. * @param qlm QLM to shift zeros into
  57. * @param bits
  58. */
  59. void cvmx_helper_qlm_jtag_shift_zeros(int qlm, int bits);
  60. /**
  61. * Program the QLM JTAG chain into all lanes of the QLM. You must
  62. * have already shifted in the proper number of bits into the
  63. * JTAG chain. Updating invalid values can possibly cause chip damage.
  64. *
  65. * @param qlm QLM to program
  66. */
  67. void cvmx_helper_qlm_jtag_update(int qlm);
  68. /**
  69. * Load the QLM JTAG chain with data from all lanes of the QLM.
  70. *
  71. * @param qlm QLM to program
  72. */
  73. void cvmx_helper_qlm_jtag_capture(int qlm);
  74. #endif /* __CVMX_HELPER_JTAG_H__ */