tegra_spi.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * NVIDIA Tegra20 SPI-FLASH controller
  3. *
  4. * Copyright 2010-2012 NVIDIA Corporation
  5. *
  6. * This software may be used and distributed according to the
  7. * terms of the GNU Public License, Version 2, incorporated
  8. * herein by reference.
  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
  12. * Version 2 as published by the Free Software Foundation.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  22. * MA 02111-1307 USA
  23. */
  24. #ifndef _TEGRA_SPI_H_
  25. #define _TEGRA_SPI_H_
  26. #include <asm/types.h>
  27. struct spi_tegra {
  28. u32 command; /* SPI_COMMAND_0 register */
  29. u32 status; /* SPI_STATUS_0 register */
  30. u32 rx_cmp; /* SPI_RX_CMP_0 register */
  31. u32 dma_ctl; /* SPI_DMA_CTL_0 register */
  32. u32 tx_fifo; /* SPI_TX_FIFO_0 register */
  33. u32 rsvd[3]; /* offsets 0x14 to 0x1F reserved */
  34. u32 rx_fifo; /* SPI_RX_FIFO_0 register */
  35. };
  36. #define SPI_CMD_GO (1 << 30)
  37. #define SPI_CMD_ACTIVE_SCLK_SHIFT 26
  38. #define SPI_CMD_ACTIVE_SCLK_MASK (3 << SPI_CMD_ACTIVE_SCLK_SHIFT)
  39. #define SPI_CMD_CK_SDA (1 << 21)
  40. #define SPI_CMD_ACTIVE_SDA_SHIFT 18
  41. #define SPI_CMD_ACTIVE_SDA_MASK (3 << SPI_CMD_ACTIVE_SDA_SHIFT)
  42. #define SPI_CMD_CS_POL (1 << 16)
  43. #define SPI_CMD_TXEN (1 << 15)
  44. #define SPI_CMD_RXEN (1 << 14)
  45. #define SPI_CMD_CS_VAL (1 << 13)
  46. #define SPI_CMD_CS_SOFT (1 << 12)
  47. #define SPI_CMD_CS_DELAY (1 << 9)
  48. #define SPI_CMD_CS3_EN (1 << 8)
  49. #define SPI_CMD_CS2_EN (1 << 7)
  50. #define SPI_CMD_CS1_EN (1 << 6)
  51. #define SPI_CMD_CS0_EN (1 << 5)
  52. #define SPI_CMD_BIT_LENGTH (1 << 4)
  53. #define SPI_CMD_BIT_LENGTH_MASK 0x0000001F
  54. #define SPI_STAT_BSY (1 << 31)
  55. #define SPI_STAT_RDY (1 << 30)
  56. #define SPI_STAT_RXF_FLUSH (1 << 29)
  57. #define SPI_STAT_TXF_FLUSH (1 << 28)
  58. #define SPI_STAT_RXF_UNR (1 << 27)
  59. #define SPI_STAT_TXF_OVF (1 << 26)
  60. #define SPI_STAT_RXF_EMPTY (1 << 25)
  61. #define SPI_STAT_RXF_FULL (1 << 24)
  62. #define SPI_STAT_TXF_EMPTY (1 << 23)
  63. #define SPI_STAT_TXF_FULL (1 << 22)
  64. #define SPI_STAT_SEL_TXRX_N (1 << 16)
  65. #define SPI_STAT_CUR_BLKCNT (1 << 15)
  66. #define SPI_TIMEOUT 1000
  67. #define TEGRA20_SPI_MAX_FREQ 52000000
  68. #endif /* _TEGRA_SPI_H_ */