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
8#include <linux/interrupt.h>
9#include <linux/regmap.h>
10#include <linux/spi/spi.h>
11#include <linux/types.h>
12
13#define ALTERA_SPI_MAX_CS		32
14
15/**
16 * struct altera_spi_platform_data - Platform data of the Altera SPI driver
17 * @mode_bits:		Mode bits of SPI host.
18 * @num_chipselect:	Number of chipselects.
19 * @bits_per_word_mask:	bitmask of supported bits_per_word for transfers.
20 * @num_devices:	Number of devices that shall be added when the driver
21 *			is probed.
22 * @devices:		The devices to add.
23 */
24struct altera_spi_platform_data {
25	u16				mode_bits;
26	u16				num_chipselect;
27	u32				bits_per_word_mask;
28	u16				num_devices;
29	struct spi_board_info		*devices;
30};
31
32struct 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
48extern irqreturn_t altera_spi_irq(int irq, void *dev);
49extern void altera_spi_init_host(struct spi_controller *host);
50#endif /* __LINUX_SPI_ALTERA_H */
51