qspi.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * Queue Serial Peripheral Interface Memory Map
  4. *
  5. * Copyright (C) 2004-2007 Freescale Semiconductor, Inc.
  6. * TsiChung Liew (Tsi-Chung.Liew@freescale.com)
  7. */
  8. #ifndef __QSPI_H__
  9. #define __QSPI_H__
  10. /* QSPI module registers */
  11. typedef struct qspi_ctrl {
  12. u16 mr; /* 0x00 Mode */
  13. u16 res1;
  14. u16 dlyr; /* 0x04 Delay */
  15. u16 res2;
  16. u16 wr; /* 0x08 Wrap */
  17. u16 res3;
  18. u16 ir; /* 0x0C Interrupt */
  19. u16 res4;
  20. u16 ar; /* 0x10 Address */
  21. u16 res5;
  22. u16 dr; /* 0x14 Data */
  23. u16 res6;
  24. } qspi_t;
  25. /* MR */
  26. #define QSPI_QMR_MSTR (0x8000)
  27. #define QSPI_QMR_DOHIE (0x4000)
  28. #define QSPI_QMR_BITS(x) (((x)&0x000F)<<10)
  29. #define QSPI_QMR_BITS_MASK (0xC3FF)
  30. #define QSPI_QMR_BITS_8 (0x2000)
  31. #define QSPI_QMR_BITS_9 (0x2400)
  32. #define QSPI_QMR_BITS_10 (0x2800)
  33. #define QSPI_QMR_BITS_11 (0x2C00)
  34. #define QSPI_QMR_BITS_12 (0x3000)
  35. #define QSPI_QMR_BITS_13 (0x3400)
  36. #define QSPI_QMR_BITS_14 (0x3800)
  37. #define QSPI_QMR_BITS_15 (0x3C00)
  38. #define QSPI_QMR_BITS_16 (0x0000)
  39. #define QSPI_QMR_CPOL (0x0200)
  40. #define QSPI_QMR_CPHA (0x0100)
  41. #define QSPI_QMR_BAUD(x) ((x)&0x00FF)
  42. #define QSPI_QMR_BAUD_MASK (0xFF00)
  43. /* DLYR */
  44. #define QSPI_QDLYR_SPE (0x8000)
  45. #define QSPI_QDLYR_QCD(x) (((x)&0x007F)<<8)
  46. #define QSPI_QDLYR_QCD_MASK (0x80FF)
  47. #define QSPI_QDLYR_DTL(x) ((x)&0x00FF)
  48. #define QSPI_QDLYR_DTL_MASK (0xFF00)
  49. /* WR */
  50. #define QSPI_QWR_HALT (0x8000)
  51. #define QSPI_QWR_WREN (0x4000)
  52. #define QSPI_QWR_WRTO (0x2000)
  53. #define QSPI_QWR_CSIV (0x1000)
  54. #define QSPI_QWR_ENDQP(x) (((x)&0x000F)<<8)
  55. #define QSPI_QWR_ENDQP_MASK (0xF0FF)
  56. #define QSPI_QWR_CPTQP(x) (((x)&0x000F)<<4)
  57. #define QSPI_QWR_CPTQP_MASK (0xFF0F)
  58. #define QSPI_QWR_NEWQP(x) ((x)&0x000F)
  59. #define QSPI_QWR_NEWQP_MASK (0xFFF0)
  60. /* IR */
  61. #define QSPI_QIR_WCEFB (0x8000)
  62. #define QSPI_QIR_ABRTB (0x4000)
  63. #define QSPI_QIR_ABRTL (0x1000)
  64. #define QSPI_QIR_WCEFE (0x0800)
  65. #define QSPI_QIR_ABRTE (0x0400)
  66. #define QSPI_QIR_SPIFE (0x0100)
  67. #define QSPI_QIR_WCEF (0x0008)
  68. #define QSPI_QIR_ABRT (0x0004)
  69. #define QSPI_QIR_SPIF (0x0001)
  70. /* AR */
  71. #define QSPI_QAR_ADDR(x) ((x)&0x003F)
  72. #define QSPI_QAR_ADDR_MASK (0xFFC0)
  73. #define QSPI_QAR_TRANS (0x0000)
  74. #define QSPI_QAR_RECV (0x0010)
  75. #define QSPI_QAR_CMD (0x0020)
  76. /* DR with RAM command word definitions */
  77. #define QSPI_QDR_CONT (0x8000)
  78. #define QSPI_QDR_BITSE (0x4000)
  79. #define QSPI_QDR_DT (0x2000)
  80. #define QSPI_QDR_DSCK (0x1000)
  81. #define QSPI_QDR_QSPI_CS3 (0x0800)
  82. #define QSPI_QDR_QSPI_CS2 (0x0400)
  83. #define QSPI_QDR_QSPI_CS1 (0x0200)
  84. #define QSPI_QDR_QSPI_CS0 (0x0100)
  85. #endif /* __QSPI_H__ */