1 /* 2 * Copyright (c) 2019 Antmicro <www.antmicro.com> 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #ifndef _SPI_LITESPI__H 8 #define _SPI_LITESPI__H 9 10 #include "spi_context.h" 11 12 #include <zephyr/sys/sys_io.h> 13 #include <zephyr/device.h> 14 #include <zephyr/drivers/spi.h> 15 16 #define SPI_BASE_ADDR DT_INST_REG_ADDR(0) 17 #define SPI_CONTROL_ADDR DT_INST_REG_ADDR_BY_NAME(0, control) 18 #define SPI_STATUS_ADDR DT_INST_REG_ADDR_BY_NAME(0, status) 19 #define SPI_MOSI_DATA_ADDR DT_INST_REG_ADDR_BY_NAME(0, mosi) 20 #define SPI_MISO_DATA_ADDR DT_INST_REG_ADDR_BY_NAME(0, miso) 21 #define SPI_CS_ADDR DT_INST_REG_ADDR_BY_NAME(0, cs) 22 #define SPI_LOOPBACK_ADDR DT_INST_REG_ADDR_BY_NAME(0, loopback) 23 24 #define POSITION_WORD_SIZE 8 25 #define SPI_MAX_CS_SIZE 0x100 26 #define SPI_WORD_SIZE 8 27 28 #define SPI_ENABLE 0x1 29 30 #define SPI_DATA(dev) ((struct spi_litespi_data *) ((dev)->data)) 31 32 /* Structure Declarations */ 33 34 struct spi_litespi_data { 35 struct spi_context ctx; 36 }; 37 38 struct spi_litespi_cfg { 39 uint32_t base; 40 uint32_t f_sys; 41 }; 42 43 #endif /* _SPI_LITESPI__H */ 44