xref: /rk3399_ARM-atf/include/drivers/gpio_spi.h (revision 1727d690d29ef604f1fcf183e35c06d33d974e63)
1 /*
2  * Copyright (c) 2025, Arm Limited. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef GPIO_SPI_H
8 #define GPIO_SPI_H
9 
10 #include <stdint.h>
11 
12 struct gpio_spi_data {
13 	uint8_t cs_gpio, sclk_gpio, mosi_gpio, miso_gpio, reset_gpio;
14 	uint32_t spi_delay_us;
15 	unsigned int spi_mode;
16 };
17 
18 struct spi_ops {
19 	void (*get_access)(void);
20 	void (*start)(void);
21 	void (*stop)(void);
22 	int (*xfer)(unsigned int bitlen, const void *dout, void *din);
23 };
24 
25 struct spi_plat {
26 	struct gpio_spi_data gpio_data;
27 	const struct spi_ops *ops;
28 };
29 
30 struct spi_plat *gpio_spi_init(struct gpio_spi_data *gpio_spi_data);
31 
32 #endif /* GPIO_SPI_H */
33