linux/drivers/spi/spi-ep93xx.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Driver for Cirrus Logic EP93xx SPI controller.
 *
 * Copyright (C) 2010-2011 Mika Westerberg
 *
 * Explicit FIFO handling code was inspired by amba-pl022 driver.
 *
 * Chip select support using other than built-in GPIOs by H. Hartley Sweeten.
 *
 * For more information about the SPI controller see documentation on Cirrus
 * Logic web site:
 *     https://www.cirrus.com/en/pubs/manual/EP93xx_Users_Guide_UM1.pdf
 */

#include <linux/io.h>
#include <linux/clk.h>
#include <linux/err.h>
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/dmaengine.h>
#include <linux/bitops.h>
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/sched.h>
#include <linux/scatterlist.h>
#include <linux/spi/spi.h>

#include <linux/platform_data/dma-ep93xx.h>
#include <linux/platform_data/spi-ep93xx.h>

#define SSPCR0
#define SSPCR0_SPO
#define SSPCR0_SPH
#define SSPCR0_SCR_SHIFT

#define SSPCR1
#define SSPCR1_RIE
#define SSPCR1_TIE
#define SSPCR1_RORIE
#define SSPCR1_LBM
#define SSPCR1_SSE
#define SSPCR1_MS
#define SSPCR1_SOD

#define SSPDR

#define SSPSR
#define SSPSR_TFE
#define SSPSR_TNF
#define SSPSR_RNE
#define SSPSR_RFF
#define SSPSR_BSY
#define SSPCPSR

#define SSPIIR
#define SSPIIR_RIS
#define SSPIIR_TIS
#define SSPIIR_RORIS
#define SSPICR

/* timeout in milliseconds */
#define SPI_TIMEOUT
/* maximum depth of RX/TX FIFO */
#define SPI_FIFO_SIZE

/**
 * struct ep93xx_spi - EP93xx SPI controller structure
 * @clk: clock for the controller
 * @mmio: pointer to ioremap()'d registers
 * @sspdr_phys: physical address of the SSPDR register
 * @tx: current byte in transfer to transmit
 * @rx: current byte in transfer to receive
 * @fifo_level: how full is FIFO (%0..%SPI_FIFO_SIZE - %1). Receiving one
 *              frame decreases this level and sending one frame increases it.
 * @dma_rx: RX DMA channel
 * @dma_tx: TX DMA channel
 * @dma_rx_data: RX parameters passed to the DMA engine
 * @dma_tx_data: TX parameters passed to the DMA engine
 * @rx_sgt: sg table for RX transfers
 * @tx_sgt: sg table for TX transfers
 * @zeropage: dummy page used as RX buffer when only TX buffer is passed in by
 *            the client
 */
struct ep93xx_spi {};

/* converts bits per word to CR0.DSS value */
#define bits_per_word_to_dss(bpw)

/**
 * ep93xx_spi_calc_divisors() - calculates SPI clock divisors
 * @host: SPI host
 * @rate: desired SPI output clock rate
 * @div_cpsr: pointer to return the cpsr (pre-scaler) divider
 * @div_scr: pointer to return the scr divider
 */
static int ep93xx_spi_calc_divisors(struct spi_controller *host,
				    u32 rate, u8 *div_cpsr, u8 *div_scr)
{}

static int ep93xx_spi_chip_setup(struct spi_controller *host,
				 struct spi_device *spi,
				 struct spi_transfer *xfer)
{}

static void ep93xx_do_write(struct spi_controller *host)
{}

static void ep93xx_do_read(struct spi_controller *host)
{}

/**
 * ep93xx_spi_read_write() - perform next RX/TX transfer
 * @host: SPI host
 *
 * This function transfers next bytes (or half-words) to/from RX/TX FIFOs. If
 * called several times, the whole transfer will be completed. Returns
 * %-EINPROGRESS when current transfer was not yet completed otherwise %0.
 *
 * When this function is finished, RX FIFO should be empty and TX FIFO should be
 * full.
 */
static int ep93xx_spi_read_write(struct spi_controller *host)
{}

static enum dma_transfer_direction
ep93xx_dma_data_to_trans_dir(enum dma_data_direction dir)
{}

/**
 * ep93xx_spi_dma_prepare() - prepares a DMA transfer
 * @host: SPI host
 * @dir: DMA transfer direction
 *
 * Function configures the DMA, maps the buffer and prepares the DMA
 * descriptor. Returns a valid DMA descriptor in case of success and ERR_PTR
 * in case of failure.
 */
static struct dma_async_tx_descriptor *
ep93xx_spi_dma_prepare(struct spi_controller *host,
		       enum dma_data_direction dir)
{}

/**
 * ep93xx_spi_dma_finish() - finishes with a DMA transfer
 * @host: SPI host
 * @dir: DMA transfer direction
 *
 * Function finishes with the DMA transfer. After this, the DMA buffer is
 * unmapped.
 */
static void ep93xx_spi_dma_finish(struct spi_controller *host,
				  enum dma_data_direction dir)
{}

static void ep93xx_spi_dma_callback(void *callback_param)
{}

static int ep93xx_spi_dma_transfer(struct spi_controller *host)
{}

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

static int ep93xx_spi_transfer_one(struct spi_controller *host,
				   struct spi_device *spi,
				   struct spi_transfer *xfer)
{}

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

static int ep93xx_spi_prepare_hardware(struct spi_controller *host)
{}

static int ep93xx_spi_unprepare_hardware(struct spi_controller *host)
{}

static bool ep93xx_spi_dma_filter(struct dma_chan *chan, void *filter_param)
{}

static int ep93xx_spi_setup_dma(struct ep93xx_spi *espi)
{}

static void ep93xx_spi_release_dma(struct ep93xx_spi *espi)
{}

static int ep93xx_spi_probe(struct platform_device *pdev)
{}

static void ep93xx_spi_remove(struct platform_device *pdev)
{}

static struct platform_driver ep93xx_spi_driver =;
module_platform_driver();

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