tegra_slink.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*
  2. * NVIDIA Tegra SPI-SLINK controller
  3. *
  4. * Copyright 2010-2013 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_SLINK_H_
  25. #define _TEGRA_SLINK_H_
  26. #include <asm/types.h>
  27. struct slink_tegra {
  28. u32 command; /* SLINK_COMMAND_0 register */
  29. u32 command2; /* SLINK_COMMAND2_0 reg */
  30. u32 status; /* SLINK_STATUS_0 register */
  31. u32 reserved; /* Reserved offset 0C */
  32. u32 mas_data; /* SLINK_MAS_DATA_0 reg */
  33. u32 slav_data; /* SLINK_SLAVE_DATA_0 reg */
  34. u32 dma_ctl; /* SLINK_DMA_CTL_0 register */
  35. u32 status2; /* SLINK_STATUS2_0 reg */
  36. u32 rsvd[56]; /* 0x20 to 0xFF reserved */
  37. u32 tx_fifo; /* SLINK_TX_FIFO_0 reg off 100h */
  38. u32 rsvd2[31]; /* 0x104 to 0x17F reserved */
  39. u32 rx_fifo; /* SLINK_RX_FIFO_0 reg off 180h */
  40. };
  41. /* COMMAND */
  42. #define SLINK_CMD_ENB (1 << 31)
  43. #define SLINK_CMD_GO (1 << 30)
  44. #define SLINK_CMD_M_S (1 << 28)
  45. #define SLINK_CMD_CK_SDA (1 << 21)
  46. #define SLINK_CMD_CS_POL (1 << 13)
  47. #define SLINK_CMD_CS_VAL (1 << 12)
  48. #define SLINK_CMD_CS_SOFT (1 << 11)
  49. #define SLINK_CMD_BIT_LENGTH (1 << 4)
  50. #define SLINK_CMD_BIT_LENGTH_MASK 0x0000001F
  51. /* COMMAND2 */
  52. #define SLINK_CMD2_TXEN (1 << 30)
  53. #define SLINK_CMD2_RXEN (1 << 31)
  54. #define SLINK_CMD2_SS_EN (1 << 18)
  55. #define SLINK_CMD2_SS_EN_SHIFT 18
  56. #define SLINK_CMD2_SS_EN_MASK 0x000C0000
  57. #define SLINK_CMD2_CS_ACTIVE_BETWEEN (1 << 17)
  58. /* STATUS */
  59. #define SLINK_STAT_BSY (1 << 31)
  60. #define SLINK_STAT_RDY (1 << 30)
  61. #define SLINK_STAT_ERR (1 << 29)
  62. #define SLINK_STAT_RXF_FLUSH (1 << 27)
  63. #define SLINK_STAT_TXF_FLUSH (1 << 26)
  64. #define SLINK_STAT_RXF_OVF (1 << 25)
  65. #define SLINK_STAT_TXF_UNR (1 << 24)
  66. #define SLINK_STAT_RXF_EMPTY (1 << 23)
  67. #define SLINK_STAT_RXF_FULL (1 << 22)
  68. #define SLINK_STAT_TXF_EMPTY (1 << 21)
  69. #define SLINK_STAT_TXF_FULL (1 << 20)
  70. #define SLINK_STAT_TXF_OVF (1 << 19)
  71. #define SLINK_STAT_RXF_UNR (1 << 18)
  72. #define SLINK_STAT_CUR_BLKCNT (1 << 15)
  73. /* STATUS2 */
  74. #define SLINK_STAT2_RXF_FULL_CNT (1 << 16)
  75. #define SLINK_STAT2_TXF_FULL_CNT (1 << 0)
  76. #define SPI_TIMEOUT 1000
  77. #define TEGRA_SPI_MAX_FREQ 52000000
  78. #endif /* _TEGRA_SLINK_H_ */