spi_imx.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*
  2. * include/asm-arm/arch-imx/spi_imx.h
  3. *
  4. * Copyright (C) 2006 SWAPP
  5. * Andrea Paterniani <a.paterniani@swapp-eng.it>
  6. *
  7. * Initial version inspired by:
  8. * linux-2.6.17-rc3-mm1/include/asm-arm/arch-pxa/pxa2xx_spi.h
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License as published by
  12. * the Free Software Foundation; either version 2 of the License, or
  13. * (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  23. */
  24. #ifndef SPI_IMX_H_
  25. #define SPI_IMX_H_
  26. /*-------------------------------------------------------------------------*/
  27. /**
  28. * struct spi_imx_master - device.platform_data for SPI controller devices.
  29. * @num_chipselect: chipselects are used to distinguish individual
  30. * SPI slaves, and are numbered from zero to num_chipselects - 1.
  31. * each slave has a chipselect signal, but it's common that not
  32. * every chipselect is connected to a slave.
  33. * @enable_dma: if true enables DMA driven transfers.
  34. */
  35. struct spi_imx_master {
  36. u8 num_chipselect;
  37. u8 enable_dma:1;
  38. };
  39. /*-------------------------------------------------------------------------*/
  40. /*-------------------------------------------------------------------------*/
  41. /**
  42. * struct spi_imx_chip - spi_board_info.controller_data for SPI
  43. * slave devices, copied to spi_device.controller_data.
  44. * @enable_loopback : used for test purpouse to internally connect RX and TX
  45. * sections.
  46. * @enable_dma : enables dma transfer (provided that controller driver has
  47. * dma enabled too).
  48. * @ins_ss_pulse : enable /SS pulse insertion between SPI burst.
  49. * @bclk_wait : number of bclk waits between each bits_per_word SPI burst.
  50. * @cs_control : function pointer to board-specific function to assert/deassert
  51. * I/O port to control HW generation of devices chip-select.
  52. */
  53. struct spi_imx_chip {
  54. u8 enable_loopback:1;
  55. u8 enable_dma:1;
  56. u8 ins_ss_pulse:1;
  57. u16 bclk_wait:15;
  58. void (*cs_control)(u32 control);
  59. };
  60. /* Chip-select state */
  61. #define SPI_CS_ASSERT (1 << 0)
  62. #define SPI_CS_DEASSERT (1 << 1)
  63. /*-------------------------------------------------------------------------*/
  64. #endif /* SPI_IMX_H_*/