linux/drivers/spi/spi-axi-spi-engine.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * SPI-Engine SPI controller driver
 * Copyright 2015 Analog Devices Inc.
 *  Author: Lars-Peter Clausen <[email protected]>
 */

#include <linux/clk.h>
#include <linux/completion.h>
#include <linux/fpga/adi-axi-common.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/of.h>
#include <linux/module.h>
#include <linux/overflow.h>
#include <linux/platform_device.h>
#include <linux/spi/spi.h>

#define SPI_ENGINE_REG_RESET

#define SPI_ENGINE_REG_INT_ENABLE
#define SPI_ENGINE_REG_INT_PENDING
#define SPI_ENGINE_REG_INT_SOURCE

#define SPI_ENGINE_REG_SYNC_ID

#define SPI_ENGINE_REG_CMD_FIFO_ROOM
#define SPI_ENGINE_REG_SDO_FIFO_ROOM
#define SPI_ENGINE_REG_SDI_FIFO_LEVEL

#define SPI_ENGINE_REG_CMD_FIFO
#define SPI_ENGINE_REG_SDO_DATA_FIFO
#define SPI_ENGINE_REG_SDI_DATA_FIFO
#define SPI_ENGINE_REG_SDI_DATA_FIFO_PEEK

#define SPI_ENGINE_INT_CMD_ALMOST_EMPTY
#define SPI_ENGINE_INT_SDO_ALMOST_EMPTY
#define SPI_ENGINE_INT_SDI_ALMOST_FULL
#define SPI_ENGINE_INT_SYNC

#define SPI_ENGINE_CONFIG_CPHA
#define SPI_ENGINE_CONFIG_CPOL
#define SPI_ENGINE_CONFIG_3WIRE

#define SPI_ENGINE_INST_TRANSFER
#define SPI_ENGINE_INST_ASSERT
#define SPI_ENGINE_INST_WRITE
#define SPI_ENGINE_INST_MISC
#define SPI_ENGINE_INST_CS_INV

#define SPI_ENGINE_CMD_REG_CLK_DIV
#define SPI_ENGINE_CMD_REG_CONFIG
#define SPI_ENGINE_CMD_REG_XFER_BITS

#define SPI_ENGINE_MISC_SYNC
#define SPI_ENGINE_MISC_SLEEP

#define SPI_ENGINE_TRANSFER_WRITE
#define SPI_ENGINE_TRANSFER_READ

/* Arbitrary sync ID for use by host->cur_msg */
#define AXI_SPI_ENGINE_CUR_MSG_SYNC_ID

#define SPI_ENGINE_CMD(inst, arg1, arg2)

#define SPI_ENGINE_CMD_TRANSFER(flags, n)
#define SPI_ENGINE_CMD_ASSERT(delay, cs)
#define SPI_ENGINE_CMD_WRITE(reg, val)
#define SPI_ENGINE_CMD_SLEEP(delay)
#define SPI_ENGINE_CMD_SYNC(id)
#define SPI_ENGINE_CMD_CS_INV(flags)

struct spi_engine_program {};

/**
 * struct spi_engine_message_state - SPI engine per-message state
 */
struct spi_engine_message_state {};

struct spi_engine {};

static void spi_engine_program_add_cmd(struct spi_engine_program *p,
	bool dry, uint16_t cmd)
{}

static unsigned int spi_engine_get_config(struct spi_device *spi)
{}

static void spi_engine_gen_xfer(struct spi_engine_program *p, bool dry,
	struct spi_transfer *xfer)
{}

static void spi_engine_gen_sleep(struct spi_engine_program *p, bool dry,
				 int delay_ns, int inst_ns, u32 sclk_hz)
{}

static void spi_engine_gen_cs(struct spi_engine_program *p, bool dry,
		struct spi_device *spi, bool assert)
{}

/*
 * Performs precompile steps on the message.
 *
 * The SPI core does most of the message/transfer validation and filling in
 * fields for us via __spi_validate(). This fixes up anything remaining not
 * done there.
 *
 * NB: This is separate from spi_engine_compile_message() because the latter
 * is called twice and would otherwise result in double-evaluation.
 */
static void spi_engine_precompile_message(struct spi_message *msg)
{}

static void spi_engine_compile_message(struct spi_message *msg, bool dry,
				       struct spi_engine_program *p)
{}

static void spi_engine_xfer_next(struct spi_message *msg,
	struct spi_transfer **_xfer)
{}

static void spi_engine_tx_next(struct spi_message *msg)
{}

static void spi_engine_rx_next(struct spi_message *msg)
{}

static bool spi_engine_write_cmd_fifo(struct spi_engine *spi_engine,
				      struct spi_message *msg)
{}

static bool spi_engine_write_tx_fifo(struct spi_engine *spi_engine,
				     struct spi_message *msg)
{}

static bool spi_engine_read_rx_fifo(struct spi_engine *spi_engine,
				    struct spi_message *msg)
{}

static irqreturn_t spi_engine_irq(int irq, void *devid)
{}

static int spi_engine_optimize_message(struct spi_message *msg)
{}

static int spi_engine_unoptimize_message(struct spi_message *msg)
{}

static int spi_engine_setup(struct spi_device *device)
{}

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

static void spi_engine_release_hw(void *p)
{}

static int spi_engine_probe(struct platform_device *pdev)
{}

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

static struct platform_driver spi_engine_driver =;
module_platform_driver();

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