qcom-gpi-dma.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Copyright (c) 2020, Linaro Limited
  4. */
  5. #ifndef QCOM_GPI_DMA_H
  6. #define QCOM_GPI_DMA_H
  7. /**
  8. * enum spi_transfer_cmd - spi transfer commands
  9. */
  10. enum spi_transfer_cmd {
  11. SPI_TX = 1,
  12. SPI_RX,
  13. SPI_DUPLEX,
  14. };
  15. /**
  16. * struct gpi_spi_config - spi config for peripheral
  17. *
  18. * @loopback_en: spi loopback enable when set
  19. * @clock_pol_high: clock polarity
  20. * @data_pol_high: data polarity
  21. * @pack_en: process tx/rx buffers as packed
  22. * @word_len: spi word length
  23. * @clk_div: source clock divider
  24. * @clk_src: serial clock
  25. * @cmd: spi cmd
  26. * @fragmentation: keep CS asserted at end of sequence
  27. * @cs: chip select toggle
  28. * @set_config: set peripheral config
  29. * @rx_len: receive length for buffer
  30. */
  31. struct gpi_spi_config {
  32. u8 set_config;
  33. u8 loopback_en;
  34. u8 clock_pol_high;
  35. u8 data_pol_high;
  36. u8 pack_en;
  37. u8 word_len;
  38. u8 fragmentation;
  39. u8 cs;
  40. u32 clk_div;
  41. u32 clk_src;
  42. enum spi_transfer_cmd cmd;
  43. u32 rx_len;
  44. };
  45. enum i2c_op {
  46. I2C_WRITE = 1,
  47. I2C_READ,
  48. };
  49. /**
  50. * struct gpi_i2c_config - i2c config for peripheral
  51. *
  52. * @pack_enable: process tx/rx buffers as packed
  53. * @cycle_count: clock cycles to be sent
  54. * @high_count: high period of clock
  55. * @low_count: low period of clock
  56. * @clk_div: source clock divider
  57. * @addr: i2c bus address
  58. * @stretch: stretch the clock at eot
  59. * @set_config: set peripheral config
  60. * @rx_len: receive length for buffer
  61. * @op: i2c cmd
  62. * @muli-msg: is part of multi i2c r-w msgs
  63. */
  64. struct gpi_i2c_config {
  65. u8 set_config;
  66. u8 pack_enable;
  67. u8 cycle_count;
  68. u8 high_count;
  69. u8 low_count;
  70. u8 addr;
  71. u8 stretch;
  72. u16 clk_div;
  73. u32 rx_len;
  74. enum i2c_op op;
  75. bool multi_msg;
  76. };
  77. #endif /* QCOM_GPI_DMA_H */