qspi.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /*
  2. * Queue Serial Peripheral Interface Memory Map
  3. *
  4. * Copyright (C) 2004-2007 Freescale Semiconductor, Inc.
  5. * TsiChung Liew (Tsi-Chung.Liew@freescale.com)
  6. *
  7. * See file CREDITS for list of people who contributed to this
  8. * project.
  9. *
  10. * This program is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU General Public License as
  12. * published by the Free Software Foundation; either version 2 of
  13. * the License, or (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  23. * MA 02111-1307 USA
  24. */
  25. #ifndef __QSPI_H__
  26. #define __QSPI_H__
  27. /* QSPI module registers */
  28. typedef struct qspi_ctrl {
  29. u16 mr; /* 0x00 Mode */
  30. u16 res1;
  31. u16 dlyr; /* 0x04 Delay */
  32. u16 res2;
  33. u16 wr; /* 0x08 Wrap */
  34. u16 res3;
  35. u16 ir; /* 0x0C Interrupt */
  36. u16 res4;
  37. u16 ar; /* 0x10 Address */
  38. u16 res5;
  39. u16 dr; /* 0x14 Data */
  40. u16 res6;
  41. } qspi_t;
  42. /* MR */
  43. #define QSPI_QMR_MSTR (0x8000)
  44. #define QSPI_QMR_DOHIE (0x4000)
  45. #define QSPI_QMR_BITS(x) (((x)&0x000F)<<10)
  46. #define QSPI_QMR_BITS_MASK (0xC3FF)
  47. #define QSPI_QMR_BITS_8 (0x2000)
  48. #define QSPI_QMR_BITS_9 (0x2400)
  49. #define QSPI_QMR_BITS_10 (0x2800)
  50. #define QSPI_QMR_BITS_11 (0x2C00)
  51. #define QSPI_QMR_BITS_12 (0x3000)
  52. #define QSPI_QMR_BITS_13 (0x3400)
  53. #define QSPI_QMR_BITS_14 (0x3800)
  54. #define QSPI_QMR_BITS_15 (0x3C00)
  55. #define QSPI_QMR_BITS_16 (0x0000)
  56. #define QSPI_QMR_CPOL (0x0200)
  57. #define QSPI_QMR_CPHA (0x0100)
  58. #define QSPI_QMR_BAUD(x) ((x)&0x00FF)
  59. #define QSPI_QMR_BAUD_MASK (0xFF00)
  60. /* DLYR */
  61. #define QSPI_QDLYR_SPE (0x8000)
  62. #define QSPI_QDLYR_QCD(x) (((x)&0x007F)<<8)
  63. #define QSPI_QDLYR_QCD_MASK (0x80FF)
  64. #define QSPI_QDLYR_DTL(x) ((x)&0x00FF)
  65. #define QSPI_QDLYR_DTL_MASK (0xFF00)
  66. /* WR */
  67. #define QSPI_QWR_HALT (0x8000)
  68. #define QSPI_QWR_WREN (0x4000)
  69. #define QSPI_QWR_WRTO (0x2000)
  70. #define QSPI_QWR_CSIV (0x1000)
  71. #define QSPI_QWR_ENDQP(x) (((x)&0x000F)<<8)
  72. #define QSPI_QWR_ENDQP_MASK (0xF0FF)
  73. #define QSPI_QWR_CPTQP(x) (((x)&0x000F)<<4)
  74. #define QSPI_QWR_CPTQP_MASK (0xFF0F)
  75. #define QSPI_QWR_NEWQP(x) ((x)&0x000F)
  76. #define QSPI_QWR_NEWQP_MASK (0xFFF0)
  77. /* IR */
  78. #define QSPI_QIR_WCEFB (0x8000)
  79. #define QSPI_QIR_ABRTB (0x4000)
  80. #define QSPI_QIR_ABRTL (0x1000)
  81. #define QSPI_QIR_WCEFE (0x0800)
  82. #define QSPI_QIR_ABRTE (0x0400)
  83. #define QSPI_QIR_SPIFE (0x0100)
  84. #define QSPI_QIR_WCEF (0x0008)
  85. #define QSPI_QIR_ABRT (0x0004)
  86. #define QSPI_QIR_SPIF (0x0001)
  87. /* AR */
  88. #define QSPI_QAR_ADDR(x) ((x)&0x003F)
  89. #define QSPI_QAR_ADDR_MASK (0xFFC0)
  90. #define QSPI_QAR_TRANS (0x0000)
  91. #define QSPI_QAR_RECV (0x0010)
  92. #define QSPI_QAR_CMD (0x0020)
  93. /* DR */
  94. #define QSPI_QDR_CONT (0x8000)
  95. #define QSPI_QDR_BITSE (0x4000)
  96. #define QSPI_QDR_DT (0x2000)
  97. #define QSPI_QDR_DSCK (0x1000)
  98. #define QSPI_QDR_QSPI_CS3 (0x0800)
  99. #define QSPI_QDR_QSPI_CS2 (0x0400)
  100. #define QSPI_QDR_QSPI_CS1 (0x0200)
  101. #define QSPI_QDR_QSPI_CS0 (0x0100)
  102. #endif /* __QSPI_H__ */