linux/drivers/spi/spi-pic32-sqi.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * PIC32 Quad SPI controller driver.
 *
 * Purna Chandra Mandal <[email protected]>
 * Copyright (c) 2016, Microchip Technology Inc.
 */

#include <linux/clk.h>
#include <linux/dma-mapping.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/iopoll.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/spi/spi.h>

/* SQI registers */
#define PESQI_XIP_CONF1_REG
#define PESQI_XIP_CONF2_REG
#define PESQI_CONF_REG
#define PESQI_CTRL_REG
#define PESQI_CLK_CTRL_REG
#define PESQI_CMD_THRES_REG
#define PESQI_INT_THRES_REG
#define PESQI_INT_ENABLE_REG
#define PESQI_INT_STAT_REG
#define PESQI_TX_DATA_REG
#define PESQI_RX_DATA_REG
#define PESQI_STAT1_REG
#define PESQI_STAT2_REG
#define PESQI_BD_CTRL_REG
#define PESQI_BD_CUR_ADDR_REG
#define PESQI_BD_BASE_ADDR_REG
#define PESQI_BD_STAT_REG
#define PESQI_BD_POLL_CTRL_REG
#define PESQI_BD_TX_DMA_STAT_REG
#define PESQI_BD_RX_DMA_STAT_REG
#define PESQI_THRES_REG
#define PESQI_INT_SIGEN_REG

/* PESQI_CONF_REG fields */
#define PESQI_MODE
#define PESQI_MODE_BOOT
#define PESQI_MODE_PIO
#define PESQI_MODE_DMA
#define PESQI_MODE_XIP
#define PESQI_MODE_SHIFT
#define PESQI_CPHA
#define PESQI_CPOL
#define PESQI_LSBF
#define PESQI_RXLATCH
#define PESQI_SERMODE
#define PESQI_WP_EN
#define PESQI_HOLD_EN
#define PESQI_BURST_EN
#define PESQI_CS_CTRL_HW
#define PESQI_SOFT_RESET
#define PESQI_LANES_SHIFT
#define PESQI_SINGLE_LANE
#define PESQI_DUAL_LANE
#define PESQI_QUAD_LANE
#define PESQI_CSEN_SHIFT
#define PESQI_EN

/* PESQI_CLK_CTRL_REG fields */
#define PESQI_CLK_EN
#define PESQI_CLK_STABLE
#define PESQI_CLKDIV_SHIFT
#define PESQI_CLKDIV

/* PESQI_INT_THR/CMD_THR_REG */
#define PESQI_TXTHR_MASK
#define PESQI_TXTHR_SHIFT
#define PESQI_RXTHR_MASK
#define PESQI_RXTHR_SHIFT

/* PESQI_INT_EN/INT_STAT/INT_SIG_EN_REG */
#define PESQI_TXEMPTY
#define PESQI_TXFULL
#define PESQI_TXTHR
#define PESQI_RXEMPTY
#define PESQI_RXFULL
#define PESQI_RXTHR
#define PESQI_BDDONE
#define PESQI_PKTCOMP
#define PESQI_DMAERR

/* PESQI_BD_CTRL_REG */
#define PESQI_DMA_EN
#define PESQI_POLL_EN
#define PESQI_BDP_START

/* PESQI controller buffer descriptor */
struct buf_desc {};

/* bd_ctrl */
#define BD_BUFLEN
#define BD_CBD_INT_EN
#define BD_PKT_INT_EN
#define BD_LIFM
#define BD_LAST
#define BD_DATA_RECV
#define BD_DDR
#define BD_DUAL
#define BD_QUAD
#define BD_LSBF
#define BD_STAT_CHECK
#define BD_DEVSEL_SHIFT
#define BD_CS_DEASSERT
#define BD_EN

/**
 * struct ring_desc - Representation of SQI ring descriptor
 * @list:	list element to add to free or used list.
 * @bd:		PESQI controller buffer descriptor
 * @bd_dma:	DMA address of PESQI controller buffer descriptor
 * @xfer_len:	transfer length
 */
struct ring_desc {};

/* Global constants */
#define PESQI_BD_BUF_LEN_MAX
#define PESQI_BD_COUNT

struct pic32_sqi {};

static inline void pic32_setbits(void __iomem *reg, u32 set)
{}

static inline void pic32_clrbits(void __iomem *reg, u32 clr)
{}

static int pic32_sqi_set_clk_rate(struct pic32_sqi *sqi, u32 sck)
{}

static inline void pic32_sqi_enable_int(struct pic32_sqi *sqi)
{}

static inline void pic32_sqi_disable_int(struct pic32_sqi *sqi)
{}

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

static struct ring_desc *ring_desc_get(struct pic32_sqi *sqi)
{}

static void ring_desc_put(struct pic32_sqi *sqi, struct ring_desc *rdesc)
{}

static int pic32_sqi_one_transfer(struct pic32_sqi *sqi,
				  struct spi_message *mesg,
				  struct spi_transfer *xfer)
{}

static int pic32_sqi_prepare_hardware(struct spi_controller *host)
{}

static bool pic32_sqi_can_dma(struct spi_controller *host,
			      struct spi_device *spi,
			      struct spi_transfer *x)
{}

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

static int pic32_sqi_unprepare_hardware(struct spi_controller *host)
{}

static int ring_desc_ring_alloc(struct pic32_sqi *sqi)
{}

static void ring_desc_ring_free(struct pic32_sqi *sqi)
{}

static void pic32_sqi_hw_init(struct pic32_sqi *sqi)
{}

static int pic32_sqi_probe(struct platform_device *pdev)
{}

static void pic32_sqi_remove(struct platform_device *pdev)
{}

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

static struct platform_driver pic32_sqi_driver =;

module_platform_driver();

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