device.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Copyright (c) 2019 Synopsys, Inc. and/or its affiliates.
  4. *
  5. * Author: Vitor Soares <vitor.soares@synopsys.com>
  6. */
  7. #ifndef _UAPI_LINUX_I3C_DEVICE_H
  8. #define _UAPI_LINUX_I3C_DEVICE_H
  9. #include <linux/types.h>
  10. /**
  11. * enum i3c_error_code - I3C error codes
  12. *
  13. * These are the standard error codes as defined by the I3C specification.
  14. * When -EIO is returned by the i3c_device_do_priv_xfers() or
  15. * i3c_device_send_hdr_cmds() one can check the error code in
  16. * &struct_i3c_priv_xfer.err or &struct i3c_hdr_cmd.err to get a better idea of
  17. * what went wrong.
  18. *
  19. * @I3C_ERROR_UNKNOWN: unknown error, usually means the error is not I3C
  20. * related
  21. * @I3C_ERROR_M0: M0 error
  22. * @I3C_ERROR_M1: M1 error
  23. * @I3C_ERROR_M2: M2 error
  24. */
  25. enum i3c_error_code {
  26. I3C_ERROR_UNKNOWN = 0,
  27. I3C_ERROR_M0 = 1,
  28. I3C_ERROR_M1,
  29. I3C_ERROR_M2,
  30. };
  31. /**
  32. * enum i3c_hdr_mode - HDR mode ids
  33. * @I3C_HDR_DDR: DDR mode
  34. * @I3C_HDR_TSP: TSP mode
  35. * @I3C_HDR_TSL: TSL mode
  36. */
  37. enum i3c_hdr_mode {
  38. I3C_HDR_DDR,
  39. I3C_HDR_TSP,
  40. I3C_HDR_TSL,
  41. };
  42. /**
  43. * struct i3c_priv_xfer - I3C SDR private transfer
  44. * @rnw: encodes the transfer direction. true for a read, false for a write
  45. * @len: transfer length in bytes of the transfer
  46. * @data: input/output buffer
  47. * @data.in: input buffer. Must point to a DMA-able buffer
  48. * @data.out: output buffer. Must point to a DMA-able buffer
  49. * @err: I3C error code
  50. */
  51. struct i3c_priv_xfer {
  52. __u8 rnw;
  53. __u16 len;
  54. union {
  55. void *in;
  56. const void *out;
  57. } data;
  58. enum i3c_error_code err;
  59. };
  60. #endif /* _UAPI_LINUX_I3C_DEVICE_H */