renesas-rpc-if.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Renesas RPC-IF core driver
  4. *
  5. * Copyright (C) 2018~2019 Renesas Solutions Corp.
  6. * Copyright (C) 2019 Macronix International Co., Ltd.
  7. * Copyright (C) 2019-2020 Cogent Embedded, Inc.
  8. */
  9. #ifndef __RENESAS_RPC_IF_H
  10. #define __RENESAS_RPC_IF_H
  11. #include <linux/pm_runtime.h>
  12. #include <linux/types.h>
  13. enum rpcif_data_dir {
  14. RPCIF_NO_DATA,
  15. RPCIF_DATA_IN,
  16. RPCIF_DATA_OUT,
  17. };
  18. struct rpcif_op {
  19. struct {
  20. u8 buswidth;
  21. u8 opcode;
  22. bool ddr;
  23. } cmd, ocmd;
  24. struct {
  25. u8 nbytes;
  26. u8 buswidth;
  27. bool ddr;
  28. u64 val;
  29. } addr;
  30. struct {
  31. u8 ncycles;
  32. u8 buswidth;
  33. } dummy;
  34. struct {
  35. u8 nbytes;
  36. u8 buswidth;
  37. bool ddr;
  38. u32 val;
  39. } option;
  40. struct {
  41. u8 buswidth;
  42. unsigned int nbytes;
  43. enum rpcif_data_dir dir;
  44. bool ddr;
  45. union {
  46. void *in;
  47. const void *out;
  48. } buf;
  49. } data;
  50. };
  51. enum rpcif_type {
  52. RPCIF_RCAR_GEN3,
  53. RPCIF_RCAR_GEN4,
  54. RPCIF_RZ_G2L,
  55. XSPI_RZ_G3E,
  56. };
  57. struct rpcif {
  58. struct device *dev;
  59. void __iomem *dirmap;
  60. size_t size;
  61. bool xspi;
  62. };
  63. int rpcif_sw_init(struct rpcif *rpc, struct device *dev);
  64. int rpcif_hw_init(struct device *dev, bool hyperflash);
  65. void rpcif_prepare(struct device *dev, const struct rpcif_op *op, u64 *offs,
  66. size_t *len);
  67. int rpcif_manual_xfer(struct device *dev);
  68. ssize_t rpcif_dirmap_read(struct device *dev, u64 offs, size_t len, void *buf);
  69. ssize_t xspi_dirmap_write(struct device *dev, u64 offs, size_t len,
  70. const void *buf);
  71. #endif // __RENESAS_RPC_IF_H