Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * Header File for Altera SPI Driver.
0004  */
0005 #ifndef __LINUX_SPI_ALTERA_H
0006 #define __LINUX_SPI_ALTERA_H
0007 
0008 #include <linux/interrupt.h>
0009 #include <linux/regmap.h>
0010 #include <linux/spi/spi.h>
0011 #include <linux/types.h>
0012 
0013 #define ALTERA_SPI_MAX_CS       32
0014 
0015 /**
0016  * struct altera_spi_platform_data - Platform data of the Altera SPI driver
0017  * @mode_bits:      Mode bits of SPI master.
0018  * @num_chipselect: Number of chipselects.
0019  * @bits_per_word_mask: bitmask of supported bits_per_word for transfers.
0020  * @num_devices:    Number of devices that shall be added when the driver
0021  *          is probed.
0022  * @devices:        The devices to add.
0023  */
0024 struct altera_spi_platform_data {
0025     u16             mode_bits;
0026     u16             num_chipselect;
0027     u32             bits_per_word_mask;
0028     u16             num_devices;
0029     struct spi_board_info       *devices;
0030 };
0031 
0032 struct altera_spi {
0033     int irq;
0034     int len;
0035     int count;
0036     int bytes_per_word;
0037     u32 imr;
0038 
0039     /* data buffers */
0040     const unsigned char *tx;
0041     unsigned char *rx;
0042 
0043     struct regmap *regmap;
0044     u32 regoff;
0045     struct device *dev;
0046 };
0047 
0048 extern irqreturn_t altera_spi_irq(int irq, void *dev);
0049 extern void altera_spi_init_master(struct spi_master *master);
0050 #endif /* __LINUX_SPI_ALTERA_H */