2019-09-11 21:49:19 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2019 Antmicro <www.antmicro.com>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _SPI_LITESPI__H
|
|
|
|
#define _SPI_LITESPI__H
|
|
|
|
|
|
|
|
#include "spi_context.h"
|
|
|
|
|
2022-05-06 16:25:46 +08:00
|
|
|
#include <zephyr/sys/sys_io.h>
|
|
|
|
#include <zephyr/device.h>
|
|
|
|
#include <zephyr/drivers/spi.h>
|
2019-09-11 21:49:19 +08:00
|
|
|
|
2022-05-23 21:17:45 +08:00
|
|
|
#define SPI_BASE_ADDR DT_INST_REG_ADDR(0)
|
|
|
|
#define SPI_CONTROL_ADDR DT_INST_REG_ADDR_BY_NAME(0, control)
|
|
|
|
#define SPI_STATUS_ADDR DT_INST_REG_ADDR_BY_NAME(0, status)
|
|
|
|
#define SPI_MOSI_DATA_ADDR DT_INST_REG_ADDR_BY_NAME(0, mosi)
|
|
|
|
#define SPI_MISO_DATA_ADDR DT_INST_REG_ADDR_BY_NAME(0, miso)
|
|
|
|
#define SPI_CS_ADDR DT_INST_REG_ADDR_BY_NAME(0, cs)
|
|
|
|
#define SPI_LOOPBACK_ADDR DT_INST_REG_ADDR_BY_NAME(0, loopback)
|
2019-09-11 21:49:19 +08:00
|
|
|
|
|
|
|
#define POSITION_WORD_SIZE 8
|
|
|
|
#define SPI_MAX_CS_SIZE 0x100
|
|
|
|
#define SPI_WORD_SIZE 8
|
|
|
|
|
|
|
|
#define SPI_ENABLE 0x1
|
|
|
|
|
2020-05-29 03:23:02 +08:00
|
|
|
#define SPI_DATA(dev) ((struct spi_litespi_data *) ((dev)->data))
|
2019-09-11 21:49:19 +08:00
|
|
|
|
|
|
|
/* Structure Declarations */
|
|
|
|
|
|
|
|
struct spi_litespi_data {
|
|
|
|
struct spi_context ctx;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct spi_litespi_cfg {
|
2020-05-28 00:26:57 +08:00
|
|
|
uint32_t base;
|
|
|
|
uint32_t f_sys;
|
2019-09-11 21:49:19 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* _SPI_LITESPI__H */
|