Commit | Line | Data |
---|---|---|
8e04187c XY |
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 | ||
b0c3d935 | 8 | #include <linux/interrupt.h> |
8e04187c XY |
9 | #include <linux/regmap.h> |
10 | #include <linux/spi/spi.h> | |
11 | #include <linux/types.h> | |
12 | ||
b0c3d935 MG |
13 | #define ALTERA_SPI_MAX_CS 32 |
14 | ||
8e04187c XY |
15 | /** |
16 | * struct altera_spi_platform_data - Platform data of the Altera SPI driver | |
17 | * @mode_bits: Mode bits of SPI master. | |
18 | * @num_chipselect: Number of chipselects. | |
19 | * @bits_per_word_mask: bitmask of supported bits_per_word for transfers. | |
1fccd182 XY |
20 | * @num_devices: Number of devices that shall be added when the driver |
21 | * is probed. | |
22 | * @devices: The devices to add. | |
8e04187c XY |
23 | */ |
24 | struct altera_spi_platform_data { | |
25 | u16 mode_bits; | |
26 | u16 num_chipselect; | |
27 | u32 bits_per_word_mask; | |
1fccd182 XY |
28 | u16 num_devices; |
29 | struct spi_board_info *devices; | |
8e04187c XY |
30 | }; |
31 | ||
b0c3d935 MG |
32 | struct altera_spi { |
33 | int irq; | |
34 | int len; | |
35 | int count; | |
36 | int bytes_per_word; | |
37 | u32 imr; | |
38 | ||
39 | /* data buffers */ | |
40 | const unsigned char *tx; | |
41 | unsigned char *rx; | |
42 | ||
43 | struct regmap *regmap; | |
44 | u32 regoff; | |
45 | struct device *dev; | |
46 | }; | |
47 | ||
48 | extern irqreturn_t altera_spi_irq(int irq, void *dev); | |
49 | extern void altera_spi_init_master(struct spi_master *master); | |
8e04187c | 50 | #endif /* __LINUX_SPI_ALTERA_H */ |