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_config { 13 uint8_t cs_gpio, sclk_gpio, mosi_gpio, miso_gpio, reset_gpio; 14 unsigned int spi_mode; 15 uint32_t spi_max_clock; 16 }; 17 18 struct spi_priv; 19 20 struct spi_ops { 21 int (*get_access)(struct spi_priv *context); 22 void (*release_access)(struct spi_priv *context); 23 void (*start)(struct spi_priv *context); 24 void (*stop)(struct spi_priv *context); 25 int (*xfer)(struct spi_priv *context, unsigned int bytes, 26 const void *dout, void *din); 27 }; 28 29 struct spi_plat { 30 struct spi_priv *priv; 31 const struct spi_ops *ops; 32 }; 33 34 struct spi_plat *gpio_spi_init(const struct gpio_spi_config *gpio_spi_config); 35 36 #endif /* GPIO_SPI_H */ 37