1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  * Copyright (C) 2005 Stephen Street / StreetFire Sound Labs
4  */
5 #ifndef __LINUX_SPI_PXA2XX_SPI_H
6 #define __LINUX_SPI_PXA2XX_SPI_H
7 
8 #include <linux/types.h>
9 
10 #include <linux/pxa2xx_ssp.h>
11 
12 #define PXA2XX_CS_ASSERT (0x01)
13 #define PXA2XX_CS_DEASSERT (0x02)
14 
15 struct dma_chan;
16 
17 /*
18  * The platform data for SSP controller devices
19  * (resides in device.platform_data).
20  */
21 struct pxa2xx_spi_controller {
22 	u16 num_chipselect;
23 	u8 enable_dma;
24 	u8 dma_burst_size;
25 	bool is_slave;
26 
27 	/* DMA engine specific config */
28 	bool (*dma_filter)(struct dma_chan *chan, void *param);
29 	void *tx_param;
30 	void *rx_param;
31 
32 	/* For non-PXA arches */
33 	struct ssp_device ssp;
34 };
35 
36 /*
37  * The controller specific data for SPI slave devices
38  * (resides in spi_board_info.controller_data),
39  * copied to spi_device.platform_data ... mostly for
40  * DMA tuning.
41  */
42 struct pxa2xx_spi_chip {
43 	u8 tx_threshold;
44 	u8 tx_hi_threshold;
45 	u8 rx_threshold;
46 	u8 dma_burst_size;
47 	u32 timeout;
48 	u8 enable_loopback;
49 	int gpio_cs;
50 	void (*cs_control)(u32 command);
51 };
52 
53 #if defined(CONFIG_ARCH_PXA) || defined(CONFIG_ARCH_MMP)
54 
55 #include <linux/clk.h>
56 
57 extern void pxa2xx_set_spi_info(unsigned id, struct pxa2xx_spi_controller *info);
58 
59 #endif
60 
61 #endif	/* __LINUX_SPI_PXA2XX_SPI_H */
62