linux/drivers/spi/spi-sprd.c

// SPDX-License-Identifier: GPL-2.0
// Copyright (C) 2018 Spreadtrum Communications Inc.

#include <linux/clk.h>
#include <linux/dmaengine.h>
#include <linux/dma-mapping.h>
#include <linux/dma/sprd-dma.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/iopoll.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_dma.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/spi/spi.h>

#define SPRD_SPI_TXD
#define SPRD_SPI_CLKD
#define SPRD_SPI_CTL0
#define SPRD_SPI_CTL1
#define SPRD_SPI_CTL2
#define SPRD_SPI_CTL3
#define SPRD_SPI_CTL4
#define SPRD_SPI_CTL5
#define SPRD_SPI_INT_EN
#define SPRD_SPI_INT_CLR
#define SPRD_SPI_INT_RAW_STS
#define SPRD_SPI_INT_MASK_STS
#define SPRD_SPI_STS1
#define SPRD_SPI_STS2
#define SPRD_SPI_DSP_WAIT
#define SPRD_SPI_STS3
#define SPRD_SPI_CTL6
#define SPRD_SPI_STS4
#define SPRD_SPI_FIFO_RST
#define SPRD_SPI_CTL7
#define SPRD_SPI_STS5
#define SPRD_SPI_CTL8
#define SPRD_SPI_CTL9
#define SPRD_SPI_CTL10
#define SPRD_SPI_CTL11
#define SPRD_SPI_CTL12
#define SPRD_SPI_STS6
#define SPRD_SPI_STS7
#define SPRD_SPI_STS8
#define SPRD_SPI_STS9

/* Bits & mask definition for register CTL0 */
#define SPRD_SPI_SCK_REV
#define SPRD_SPI_NG_TX
#define SPRD_SPI_NG_RX
#define SPRD_SPI_CHNL_LEN_MASK
#define SPRD_SPI_CSN_MASK
#define SPRD_SPI_CS0_VALID

/* Bits & mask definition for register SPI_INT_EN */
#define SPRD_SPI_TX_END_INT_EN
#define SPRD_SPI_RX_END_INT_EN

/* Bits & mask definition for register SPI_INT_RAW_STS */
#define SPRD_SPI_TX_END_RAW
#define SPRD_SPI_RX_END_RAW

/* Bits & mask definition for register SPI_INT_CLR */
#define SPRD_SPI_TX_END_CLR
#define SPRD_SPI_RX_END_CLR

/* Bits & mask definition for register INT_MASK_STS */
#define SPRD_SPI_MASK_RX_END
#define SPRD_SPI_MASK_TX_END

/* Bits & mask definition for register STS2 */
#define SPRD_SPI_TX_BUSY

/* Bits & mask definition for register CTL1 */
#define SPRD_SPI_RX_MODE
#define SPRD_SPI_TX_MODE
#define SPRD_SPI_RTX_MD_MASK

/* Bits & mask definition for register CTL2 */
#define SPRD_SPI_DMA_EN

/* Bits & mask definition for register CTL4 */
#define SPRD_SPI_START_RX
#define SPRD_SPI_ONLY_RECV_MASK

/* Bits & mask definition for register SPI_INT_CLR */
#define SPRD_SPI_RX_END_INT_CLR
#define SPRD_SPI_TX_END_INT_CLR

/* Bits & mask definition for register SPI_INT_RAW */
#define SPRD_SPI_RX_END_IRQ
#define SPRD_SPI_TX_END_IRQ

/* Bits & mask definition for register CTL12 */
#define SPRD_SPI_SW_RX_REQ
#define SPRD_SPI_SW_TX_REQ

/* Bits & mask definition for register CTL7 */
#define SPRD_SPI_DATA_LINE2_EN
#define SPRD_SPI_MODE_MASK
#define SPRD_SPI_MODE_OFFSET
#define SPRD_SPI_3WIRE_MODE
#define SPRD_SPI_4WIRE_MODE

/* Bits & mask definition for register CTL8 */
#define SPRD_SPI_TX_MAX_LEN_MASK
#define SPRD_SPI_TX_LEN_H_MASK
#define SPRD_SPI_TX_LEN_H_OFFSET

/* Bits & mask definition for register CTL9 */
#define SPRD_SPI_TX_LEN_L_MASK

/* Bits & mask definition for register CTL10 */
#define SPRD_SPI_RX_MAX_LEN_MASK
#define SPRD_SPI_RX_LEN_H_MASK
#define SPRD_SPI_RX_LEN_H_OFFSET

/* Bits & mask definition for register CTL11 */
#define SPRD_SPI_RX_LEN_L_MASK

/* Default & maximum word delay cycles */
#define SPRD_SPI_MIN_DELAY_CYCLE
#define SPRD_SPI_MAX_DELAY_CYCLE

#define SPRD_SPI_FIFO_SIZE
#define SPRD_SPI_CHIP_CS_NUM
#define SPRD_SPI_CHNL_LEN
#define SPRD_SPI_DEFAULT_SOURCE
#define SPRD_SPI_MAX_SPEED_HZ
#define SPRD_SPI_AUTOSUSPEND_DELAY
#define SPRD_SPI_DMA_STEP

enum sprd_spi_dma_channel {};

struct sprd_spi_dma {};

struct sprd_spi {};

static u32 sprd_spi_transfer_max_timeout(struct sprd_spi *ss,
					 struct spi_transfer *t)
{}

static int sprd_spi_wait_for_tx_end(struct sprd_spi *ss, struct spi_transfer *t)
{}

static int sprd_spi_wait_for_rx_end(struct sprd_spi *ss, struct spi_transfer *t)
{}

static void sprd_spi_tx_req(struct sprd_spi *ss)
{}

static void sprd_spi_rx_req(struct sprd_spi *ss)
{}

static void sprd_spi_enter_idle(struct sprd_spi *ss)
{}

static void sprd_spi_set_transfer_bits(struct sprd_spi *ss, u32 bits)
{}

static void sprd_spi_set_tx_length(struct sprd_spi *ss, u32 length)
{}

static void sprd_spi_set_rx_length(struct sprd_spi *ss, u32 length)
{}

static void sprd_spi_chipselect(struct spi_device *sdev, bool cs)
{}

static int sprd_spi_write_only_receive(struct sprd_spi *ss, u32 len)
{}

static int sprd_spi_write_bufs_u8(struct sprd_spi *ss, u32 len)
{}

static int sprd_spi_write_bufs_u16(struct sprd_spi *ss, u32 len)
{}

static int sprd_spi_write_bufs_u32(struct sprd_spi *ss, u32 len)
{}

static int sprd_spi_read_bufs_u8(struct sprd_spi *ss, u32 len)
{}

static int sprd_spi_read_bufs_u16(struct sprd_spi *ss, u32 len)
{}

static int sprd_spi_read_bufs_u32(struct sprd_spi *ss, u32 len)
{}

static int sprd_spi_txrx_bufs(struct spi_device *sdev, struct spi_transfer *t)
{}

static void sprd_spi_irq_enable(struct sprd_spi *ss)
{}

static void sprd_spi_irq_disable(struct sprd_spi *ss)
{}

static void sprd_spi_dma_enable(struct sprd_spi *ss, bool enable)
{}

static int sprd_spi_dma_submit(struct dma_chan *dma_chan,
			       struct dma_slave_config *c,
			       struct sg_table *sg,
			       enum dma_transfer_direction dir)
{}

static int sprd_spi_dma_rx_config(struct sprd_spi *ss, struct spi_transfer *t)
{}

static int sprd_spi_dma_tx_config(struct sprd_spi *ss, struct spi_transfer *t)
{}

static int sprd_spi_dma_request(struct sprd_spi *ss)
{}

static void sprd_spi_dma_release(struct sprd_spi *ss)
{}

static int sprd_spi_dma_txrx_bufs(struct spi_device *sdev,
				  struct spi_transfer *t)
{}

static void sprd_spi_set_speed(struct sprd_spi *ss, u32 speed_hz)
{}

static int sprd_spi_init_hw(struct sprd_spi *ss, struct spi_transfer *t)
{}

static int sprd_spi_setup_transfer(struct spi_device *sdev,
				   struct spi_transfer *t)
{}

static int sprd_spi_transfer_one(struct spi_controller *sctlr,
				 struct spi_device *sdev,
				 struct spi_transfer *t)
{}

static irqreturn_t sprd_spi_handle_irq(int irq, void *data)
{}

static int sprd_spi_irq_init(struct platform_device *pdev, struct sprd_spi *ss)
{}

static int sprd_spi_clk_init(struct platform_device *pdev, struct sprd_spi *ss)
{}

static bool sprd_spi_can_dma(struct spi_controller *sctlr,
			     struct spi_device *spi, struct spi_transfer *t)
{}

static int sprd_spi_dma_init(struct platform_device *pdev, struct sprd_spi *ss)
{}

static int sprd_spi_probe(struct platform_device *pdev)
{}

static void sprd_spi_remove(struct platform_device *pdev)
{}

static int __maybe_unused sprd_spi_runtime_suspend(struct device *dev)
{}

static int __maybe_unused sprd_spi_runtime_resume(struct device *dev)
{}

static const struct dev_pm_ops sprd_spi_pm_ops =;

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

static struct platform_driver sprd_spi_driver =;

module_platform_driver();

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