seq_exec.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Copyright (C) Marvell International Ltd. and its affiliates
  4. */
  5. #ifndef _SEQ_EXEC_H
  6. #define _SEQ_EXEC_H
  7. #define NA 0xff
  8. #define DEFAULT_PARAM 0
  9. #define MV_BOARD_TCLK_ERROR 0xffffffff
  10. #define NO_DATA 0xffffffff
  11. #define MAX_DATA_ARRAY 5
  12. #define FIRST_CELL 0
  13. /* Operation types */
  14. enum mv_op {
  15. WRITE_OP,
  16. DELAY_OP,
  17. POLL_OP,
  18. };
  19. /* Operation parameters */
  20. struct op_params {
  21. u32 unit_base_reg;
  22. u32 unit_offset;
  23. u32 mask;
  24. u32 data[MAX_DATA_ARRAY]; /* data array */
  25. u8 wait_time; /* msec */
  26. u16 num_of_loops; /* for polling only */
  27. };
  28. /*
  29. * Sequence parameters. Each sequence contains:
  30. * 1. Sequence id.
  31. * 2. Sequence size (total amount of operations during the sequence)
  32. * 3. a series of operations. operations can be write, poll or delay
  33. * 4. index in the data array (the entry where the relevant data sits)
  34. */
  35. struct cfg_seq {
  36. struct op_params *op_params_ptr;
  37. u8 cfg_seq_size;
  38. u8 data_arr_idx;
  39. };
  40. extern struct cfg_seq serdes_seq_db[];
  41. /*
  42. * A generic function type for executing an operation (write, poll or delay)
  43. */
  44. typedef int (*op_execute_func_ptr)(u32 serdes_num, struct op_params *params,
  45. u32 data_arr_idx);
  46. /* Specific functions for executing each operation */
  47. int write_op_execute(u32 serdes_num, struct op_params *params,
  48. u32 data_arr_idx);
  49. int delay_op_execute(u32 serdes_num, struct op_params *params,
  50. u32 data_arr_idx);
  51. int poll_op_execute(u32 serdes_num, struct op_params *params, u32 data_arr_idx);
  52. enum mv_op get_cfg_seq_op(struct op_params *params);
  53. int mv_seq_exec(u32 serdes_num, u32 seq_id);
  54. #endif /*_SEQ_EXEC_H*/