altera.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Header File for Altera SPI Driver.
  4. */
  5. #ifndef __LINUX_SPI_ALTERA_H
  6. #define __LINUX_SPI_ALTERA_H
  7. #include <linux/interrupt.h>
  8. #include <linux/regmap.h>
  9. #include <linux/spi/spi.h>
  10. #include <linux/types.h>
  11. #define ALTERA_SPI_MAX_CS 32
  12. /**
  13. * struct altera_spi_platform_data - Platform data of the Altera SPI driver
  14. * @mode_bits: Mode bits of SPI master.
  15. * @num_chipselect: Number of chipselects.
  16. * @bits_per_word_mask: bitmask of supported bits_per_word for transfers.
  17. * @num_devices: Number of devices that shall be added when the driver
  18. * is probed.
  19. * @devices: The devices to add.
  20. */
  21. struct altera_spi_platform_data {
  22. u16 mode_bits;
  23. u16 num_chipselect;
  24. u32 bits_per_word_mask;
  25. u16 num_devices;
  26. struct spi_board_info *devices;
  27. };
  28. struct altera_spi {
  29. int irq;
  30. int len;
  31. int count;
  32. int bytes_per_word;
  33. u32 imr;
  34. /* data buffers */
  35. const unsigned char *tx;
  36. unsigned char *rx;
  37. struct regmap *regmap;
  38. u32 regoff;
  39. struct device *dev;
  40. };
  41. extern irqreturn_t altera_spi_irq(int irq, void *dev);
  42. extern void altera_spi_init_master(struct spi_master *master);
  43. #endif /* __LINUX_SPI_ALTERA_H */