spi.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * (C) Copyright 2012 SAMSUNG Electronics
  3. * Padmavathi Venna <padma.v@samsung.com>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. */
  19. #ifndef __ASM_ARCH_EXYNOS_COMMON_SPI_H_
  20. #define __ASM_ARCH_EXYNOS_COMMON_SPI_H_
  21. #ifndef __ASSEMBLY__
  22. /* SPI peripheral register map; padded to 64KB */
  23. struct exynos_spi {
  24. unsigned int ch_cfg; /* 0x00 */
  25. unsigned char reserved0[4];
  26. unsigned int mode_cfg; /* 0x08 */
  27. unsigned int cs_reg; /* 0x0c */
  28. unsigned char reserved1[4];
  29. unsigned int spi_sts; /* 0x14 */
  30. unsigned int tx_data; /* 0x18 */
  31. unsigned int rx_data; /* 0x1c */
  32. unsigned int pkt_cnt; /* 0x20 */
  33. unsigned char reserved2[4];
  34. unsigned char reserved3[4];
  35. unsigned int fb_clk; /* 0x2c */
  36. unsigned char padding[0xffd0];
  37. };
  38. #define EXYNOS_SPI_MAX_FREQ 50000000
  39. #define SPI_TIMEOUT_MS 10
  40. /* SPI_CHCFG */
  41. #define SPI_CH_HS_EN (1 << 6)
  42. #define SPI_CH_RST (1 << 5)
  43. #define SPI_SLAVE_MODE (1 << 4)
  44. #define SPI_CH_CPOL_L (1 << 3)
  45. #define SPI_CH_CPHA_B (1 << 2)
  46. #define SPI_RX_CH_ON (1 << 1)
  47. #define SPI_TX_CH_ON (1 << 0)
  48. /* SPI_MODECFG */
  49. #define SPI_MODE_CH_WIDTH_WORD (0x2 << 29)
  50. #define SPI_MODE_BUS_WIDTH_WORD (0x2 << 17)
  51. /* SPI_CSREG */
  52. #define SPI_SLAVE_SIG_INACT (1 << 0)
  53. /* SPI_STS */
  54. #define SPI_ST_TX_DONE (1 << 25)
  55. #define SPI_FIFO_LVL_MASK 0x1ff
  56. #define SPI_TX_LVL_OFFSET 6
  57. #define SPI_RX_LVL_OFFSET 15
  58. /* Feedback Delay */
  59. #define SPI_CLK_BYPASS (0 << 0)
  60. #define SPI_FB_DELAY_90 (1 << 0)
  61. #define SPI_FB_DELAY_180 (2 << 0)
  62. #define SPI_FB_DELAY_270 (3 << 0)
  63. /* Packet Count */
  64. #define SPI_PACKET_CNT_EN (1 << 16)
  65. #endif /* __ASSEMBLY__ */
  66. #endif