bfin5xx_spi.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*
  2. * Blackfin On-Chip SPI Driver
  3. *
  4. * Copyright 2004-2008 Analog Devices Inc.
  5. *
  6. * Licensed under the GPL-2 or later.
  7. */
  8. #ifndef _SPI_CHANNEL_H_
  9. #define _SPI_CHANNEL_H_
  10. #define MIN_SPI_BAUD_VAL 2
  11. #define BIT_CTL_ENABLE 0x4000
  12. #define BIT_CTL_OPENDRAIN 0x2000
  13. #define BIT_CTL_MASTER 0x1000
  14. #define BIT_CTL_CPOL 0x0800
  15. #define BIT_CTL_CPHA 0x0400
  16. #define BIT_CTL_LSBF 0x0200
  17. #define BIT_CTL_WORDSIZE 0x0100
  18. #define BIT_CTL_EMISO 0x0020
  19. #define BIT_CTL_PSSE 0x0010
  20. #define BIT_CTL_GM 0x0008
  21. #define BIT_CTL_SZ 0x0004
  22. #define BIT_CTL_RXMOD 0x0000
  23. #define BIT_CTL_TXMOD 0x0001
  24. #define BIT_CTL_TIMOD_DMA_TX 0x0003
  25. #define BIT_CTL_TIMOD_DMA_RX 0x0002
  26. #define BIT_CTL_SENDOPT 0x0004
  27. #define BIT_CTL_TIMOD 0x0003
  28. #define BIT_STAT_SPIF 0x0001
  29. #define BIT_STAT_MODF 0x0002
  30. #define BIT_STAT_TXE 0x0004
  31. #define BIT_STAT_TXS 0x0008
  32. #define BIT_STAT_RBSY 0x0010
  33. #define BIT_STAT_RXS 0x0020
  34. #define BIT_STAT_TXCOL 0x0040
  35. #define BIT_STAT_CLR 0xFFFF
  36. #define BIT_STU_SENDOVER 0x0001
  37. #define BIT_STU_RECVFULL 0x0020
  38. /*
  39. * All Blackfin system MMRs are padded to 32bits even if the register
  40. * itself is only 16bits. So use a helper macro to streamline this.
  41. */
  42. #define __BFP(m) u16 m; u16 __pad_##m
  43. /*
  44. * bfin spi registers layout
  45. */
  46. struct bfin_spi_regs {
  47. __BFP(ctl);
  48. __BFP(flg);
  49. __BFP(stat);
  50. __BFP(tdbr);
  51. __BFP(rdbr);
  52. __BFP(baud);
  53. __BFP(shadow);
  54. };
  55. #undef __BFP
  56. #define MAX_CTRL_CS 8 /* cs in spi controller */
  57. /* device.platform_data for SSP controller devices */
  58. struct bfin5xx_spi_master {
  59. u16 num_chipselect;
  60. u8 enable_dma;
  61. u16 pin_req[7];
  62. };
  63. /* spi_board_info.controller_data for SPI slave devices,
  64. * copied to spi_device.platform_data ... mostly for dma tuning
  65. */
  66. struct bfin5xx_spi_chip {
  67. u16 ctl_reg;
  68. u8 enable_dma;
  69. u16 cs_chg_udelay; /* Some devices require 16-bit delays */
  70. /* Value to send if no TX value is supplied, usually 0x0 or 0xFFFF */
  71. u16 idle_tx_val;
  72. u8 pio_interrupt; /* Enable spi data irq */
  73. };
  74. #endif /* _SPI_CHANNEL_H_ */