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