2019-09-12 04:16:28 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2019 Western Digital Corporation or its affiliates
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "spi_context.h"
|
|
|
|
|
|
|
|
#define SPI_OC_SIMPLE_DATA(dev) \
|
2020-05-29 03:23:02 +08:00
|
|
|
((struct spi_oc_simple_data *) ((dev)->data))
|
2019-09-12 04:16:28 +08:00
|
|
|
|
|
|
|
#define SPI_OC_SIMPLE_REG(info, offset) \
|
|
|
|
((mem_addr_t) (info->base + \
|
|
|
|
(offset * CONFIG_SPI_OC_SIMPLE_BUS_WIDTH / 8)))
|
|
|
|
|
|
|
|
#define SPI_OC_SIMPLE_SPCR(dev) SPI_OC_SIMPLE_REG(dev, 0x0)
|
|
|
|
#define SPI_OC_SIMPLE_SPSR(dev) SPI_OC_SIMPLE_REG(dev, 0x1)
|
|
|
|
#define SPI_OC_SIMPLE_SPDR(dev) SPI_OC_SIMPLE_REG(dev, 0x2)
|
|
|
|
#define SPI_OC_SIMPLE_SPER(dev) SPI_OC_SIMPLE_REG(dev, 0x3)
|
|
|
|
#define SPI_OC_SIMPLE_SPSS(dev) SPI_OC_SIMPLE_REG(dev, 0x4)
|
|
|
|
|
|
|
|
#define SPI_OC_SIMPLE_SPCR_SPE BIT(6)
|
|
|
|
#define SPI_OC_SIMPLE_SPCR_CPOL BIT(3)
|
|
|
|
#define SPI_OC_SIMPLE_SPCR_CPHA BIT(2)
|
|
|
|
|
|
|
|
struct spi_oc_simple_cfg {
|
2020-05-28 00:26:57 +08:00
|
|
|
uint32_t base;
|
|
|
|
uint32_t f_sys;
|
2019-09-12 04:16:28 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct spi_oc_simple_data {
|
|
|
|
struct spi_context ctx;
|
|
|
|
};
|