vf610_qspi.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /*
  2. * Copyright 2013 Freescale Semiconductor, Inc.
  3. *
  4. * See file CREDITS for list of people who contributed to this
  5. * project.
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License as
  9. * published by the Free Software Foundation; either version 2 of
  10. * the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  20. * MA 02111-1307 USA
  21. */
  22. #ifndef __DRIVERS_SPI_VF600QSPI_H__
  23. #define __DRIVERS_SPI_VF600QSPI_H__
  24. #define __swap_16(x) \
  25. ({ unsigned short x_ = (unsigned short)x; \
  26. (unsigned short)( \
  27. ((x_ & 0x00FFU) << 8) | ((x_ & 0xFF00U) >> 8)); \
  28. })
  29. #define __swap_32(x) \
  30. ({ unsigned long x_ = (unsigned long)x; \
  31. (unsigned long)( \
  32. ((x_ & 0x000000FFUL) << 24) | \
  33. ((x_ & 0x0000FF00UL) << 8) | \
  34. ((x_ & 0x00FF0000UL) >> 8) | \
  35. ((x_ & 0xFF000000UL) >> 24)); \
  36. })
  37. #define QSPI_ARDB (*(volatile unsigned int *) 0x7C000000)
  38. /* Lookup Table Instructions */
  39. #define STOP 0
  40. #define CMD 1
  41. #define ADDR 2
  42. #define DUMMY 3
  43. #define MODE 4
  44. #define MODE2 5
  45. #define MODE4 6
  46. #define READ 7
  47. #define WRITE 8
  48. #define JMP_ON_CS 9
  49. #define ADDR_DDR 10
  50. #define MODE_DDR 11
  51. #define MODE2_DDR 12
  52. #define MODE4_DDR 13
  53. #define READ_DDR 14
  54. #define WRITE_DDR 15
  55. #define DATA_LEARN 16
  56. #define QSPI_FLASH_PGSZ 0x100
  57. #define QSPI0_FLASH_BASE_ADDR 0x20000000
  58. #define QSPI1_FLASH_BASE_ADDR 0x50000000
  59. #ifndef QSPI0_TOP_FLASH_A1_ADDR
  60. #define QSPI0_TOP_FLASH_A1_ADDR 0x21000000
  61. #endif
  62. #ifndef QSPI0_TOP_FLASH_B1_ADDR
  63. #define QSPI0_TOP_FLASH_B1_ADDR 0x22000000
  64. #endif
  65. #ifndef QSPI1_TOP_FLASH_A1_ADDR
  66. #define QSPI1_TOP_FLASH_A1_ADDR 0x51000000
  67. #endif
  68. #ifndef QSPI1_TOP_FLASH_B1_ADDR
  69. #define QSPI1_TOP_FLASH_B1_ADDR 0x52000000
  70. #endif
  71. /* QuadSPI LUT Bit Fields */
  72. #define QuadSPI_LUT_OPRND0_MASK 0xFFu
  73. #define QuadSPI_LUT_OPRND0_SHIFT 0
  74. #define QuadSPI_LUT_OPRND0(x) ((u32)(((u32)(x))<<QuadSPI_LUT_OPRND0_SHIFT))
  75. #define QuadSPI_LUT_PAD0_MASK 0x300u
  76. #define QuadSPI_LUT_PAD0_SHIFT 8
  77. #define QuadSPI_LUT_PAD0(x) ((u32)(((u32)(x))<<QuadSPI_LUT_PAD0_SHIFT))
  78. #define QuadSPI_LUT_INSTR0_MASK 0xFC00u
  79. #define QuadSPI_LUT_INSTR0_SHIFT 10
  80. #define QuadSPI_LUT_INSTR0(x) ((u32)(((u32)(x))<<QuadSPI_LUT_INSTR0_SHIFT))
  81. #define QuadSPI_LUT_OPRND1_MASK 0xFF0000u
  82. #define QuadSPI_LUT_OPRND1_SHIFT 16
  83. #define QuadSPI_LUT_OPRND1(x) ((u32)(((u32)(x))<<QuadSPI_LUT_OPRND1_SHIFT))
  84. #define QuadSPI_LUT_PAD1_MASK 0x3000000u
  85. #define QuadSPI_LUT_PAD1_SHIFT 24
  86. #define QuadSPI_LUT_PAD1(x) ((u32)(((u32)(x))<<QuadSPI_LUT_PAD1_SHIFT))
  87. #define QuadSPI_LUT_INSTR1_MASK 0xFC000000u
  88. #define QuadSPI_LUT_INSTR1_SHIFT 26
  89. #define QuadSPI_LUT_INSTR1(x) ((u32)(((u32)(x))<<QuadSPI_LUT_INSTR1_SHIFT))
  90. #endif