linux/drivers/spi/spi-sifive.c

// SPDX-License-Identifier: GPL-2.0
//
// Copyright 2018 SiFive, Inc.
//
// SiFive SPI controller driver (master mode only)
//
// Author: SiFive, Inc.
// [email protected]

#include <linux/clk.h>
#include <linux/module.h>
#include <linux/interrupt.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/spi/spi.h>
#include <linux/io.h>
#include <linux/log2.h>

#define SIFIVE_SPI_DRIVER_NAME

#define SIFIVE_SPI_MAX_CS
#define SIFIVE_SPI_DEFAULT_DEPTH
#define SIFIVE_SPI_DEFAULT_MAX_BITS

/* register offsets */
#define SIFIVE_SPI_REG_SCKDIV
#define SIFIVE_SPI_REG_SCKMODE
#define SIFIVE_SPI_REG_CSID
#define SIFIVE_SPI_REG_CSDEF
#define SIFIVE_SPI_REG_CSMODE
#define SIFIVE_SPI_REG_DELAY0
#define SIFIVE_SPI_REG_DELAY1
#define SIFIVE_SPI_REG_FMT
#define SIFIVE_SPI_REG_TXDATA
#define SIFIVE_SPI_REG_RXDATA
#define SIFIVE_SPI_REG_TXMARK
#define SIFIVE_SPI_REG_RXMARK
#define SIFIVE_SPI_REG_FCTRL
#define SIFIVE_SPI_REG_FFMT
#define SIFIVE_SPI_REG_IE
#define SIFIVE_SPI_REG_IP

/* sckdiv bits */
#define SIFIVE_SPI_SCKDIV_DIV_MASK

/* sckmode bits */
#define SIFIVE_SPI_SCKMODE_PHA
#define SIFIVE_SPI_SCKMODE_POL
#define SIFIVE_SPI_SCKMODE_MODE_MASK

/* csmode bits */
#define SIFIVE_SPI_CSMODE_MODE_AUTO
#define SIFIVE_SPI_CSMODE_MODE_HOLD
#define SIFIVE_SPI_CSMODE_MODE_OFF

/* delay0 bits */
#define SIFIVE_SPI_DELAY0_CSSCK(x)
#define SIFIVE_SPI_DELAY0_CSSCK_MASK
#define SIFIVE_SPI_DELAY0_SCKCS(x)
#define SIFIVE_SPI_DELAY0_SCKCS_MASK

/* delay1 bits */
#define SIFIVE_SPI_DELAY1_INTERCS(x)
#define SIFIVE_SPI_DELAY1_INTERCS_MASK
#define SIFIVE_SPI_DELAY1_INTERXFR(x)
#define SIFIVE_SPI_DELAY1_INTERXFR_MASK

/* fmt bits */
#define SIFIVE_SPI_FMT_PROTO_SINGLE
#define SIFIVE_SPI_FMT_PROTO_DUAL
#define SIFIVE_SPI_FMT_PROTO_QUAD
#define SIFIVE_SPI_FMT_PROTO_MASK
#define SIFIVE_SPI_FMT_ENDIAN
#define SIFIVE_SPI_FMT_DIR
#define SIFIVE_SPI_FMT_LEN(x)
#define SIFIVE_SPI_FMT_LEN_MASK

/* txdata bits */
#define SIFIVE_SPI_TXDATA_DATA_MASK
#define SIFIVE_SPI_TXDATA_FULL

/* rxdata bits */
#define SIFIVE_SPI_RXDATA_DATA_MASK
#define SIFIVE_SPI_RXDATA_EMPTY

/* ie and ip bits */
#define SIFIVE_SPI_IP_TXWM
#define SIFIVE_SPI_IP_RXWM

struct sifive_spi {};

static void sifive_spi_write(struct sifive_spi *spi, int offset, u32 value)
{}

static u32 sifive_spi_read(struct sifive_spi *spi, int offset)
{}

static void sifive_spi_init(struct sifive_spi *spi)
{}

static int
sifive_spi_prepare_message(struct spi_controller *host, struct spi_message *msg)
{}

static void sifive_spi_set_cs(struct spi_device *device, bool is_high)
{}

static int
sifive_spi_prep_transfer(struct sifive_spi *spi, struct spi_device *device,
			 struct spi_transfer *t)
{}

static irqreturn_t sifive_spi_irq(int irq, void *dev_id)
{}

static void sifive_spi_wait(struct sifive_spi *spi, u32 bit, int poll)
{}

static void sifive_spi_tx(struct sifive_spi *spi, const u8 *tx_ptr)
{}

static void sifive_spi_rx(struct sifive_spi *spi, u8 *rx_ptr)
{}

static int
sifive_spi_transfer_one(struct spi_controller *host, struct spi_device *device,
			struct spi_transfer *t)
{}

static int sifive_spi_probe(struct platform_device *pdev)
{}

static void sifive_spi_remove(struct platform_device *pdev)
{}

static int sifive_spi_suspend(struct device *dev)
{}

static int sifive_spi_resume(struct device *dev)
{}

static DEFINE_SIMPLE_DEV_PM_OPS(sifive_spi_pm_ops,
				sifive_spi_suspend, sifive_spi_resume);


static const struct of_device_id sifive_spi_of_match[] =;
MODULE_DEVICE_TABLE(of, sifive_spi_of_match);

static struct platform_driver sifive_spi_driver =;
module_platform_driver();

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();