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 <sys/sys_io.h>
13 #include <device.h>
14 #include <drivers/spi.h>
15 
16 #define SPI_BASE_ADDR DT_INST_REG_ADDR(0)
17 #define SPI_CONTROL_REG SPI_BASE_ADDR
18 #define SPI_STATUS_REG (SPI_BASE_ADDR + 0x08)
19 #define SPI_MOSI_DATA_REG (SPI_BASE_ADDR + 0x0c)
20 #define SPI_MISO_DATA_REG (SPI_BASE_ADDR + 0x10)
21 #define SPI_CS_REG (SPI_BASE_ADDR + 0x14)
22 #define SPI_LOOPBACK_REG (SPI_BASE_ADDR + 0x18)
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