linux/drivers/spi/spi-rzv2m-csi.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Renesas RZ/V2M Clocked Serial Interface (CSI) driver
 *
 * Copyright (C) 2023 Renesas Electronics Corporation
 */

#include <linux/bits.h>
#include <linux/clk.h>
#include <linux/count_zeros.h>
#include <linux/interrupt.h>
#include <linux/iopoll.h>
#include <linux/log2.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/reset.h>
#include <linux/spi/spi.h>
#include <linux/units.h>

/* Registers */
#define CSI_MODE
#define CSI_CLKSEL
#define CSI_CNT
#define CSI_INT
#define CSI_IFIFOL
#define CSI_OFIFOL
#define CSI_IFIFO
#define CSI_OFIFO
#define CSI_FIFOTRG

/* CSI_MODE */
#define CSI_MODE_CSIE
#define CSI_MODE_TRMD
#define CSI_MODE_CCL
#define CSI_MODE_DIR
#define CSI_MODE_CSOT

#define CSI_MODE_SETUP

/* CSI_CLKSEL */
#define CSI_CLKSEL_SS_ENA
#define CSI_CLKSEL_SS_POL
#define CSI_CLKSEL_SS
#define CSI_CLKSEL_CKP
#define CSI_CLKSEL_DAP
#define CSI_CLKSEL_MODE
#define CSI_CLKSEL_SLAVE
#define CSI_CLKSEL_CKS

/* CSI_CNT */
#define CSI_CNT_CSIRST
#define CSI_CNT_R_TRGEN
#define CSI_CNT_UNDER_E
#define CSI_CNT_OVERF_E
#define CSI_CNT_TREND_E
#define CSI_CNT_CSIEND_E
#define CSI_CNT_T_TRGR_E
#define CSI_CNT_R_TRGR_E

/* CSI_INT */
#define CSI_INT_UNDER
#define CSI_INT_OVERF
#define CSI_INT_TREND
#define CSI_INT_CSIEND
#define CSI_INT_T_TRGR
#define CSI_INT_R_TRGR

/* CSI_FIFOTRG */
#define CSI_FIFOTRG_R_TRG

#define CSI_FIFO_SIZE_BYTES
#define CSI_FIFO_HALF_SIZE
#define CSI_EN_DIS_TIMEOUT_US
/*
 * Clock "csiclk" gets divided by 2 * CSI_CLKSEL_CKS in order to generate the
 * serial clock (output from master), with CSI_CLKSEL_CKS ranging from 0x1 (that
 * means "csiclk" is divided by 2) to 0x3FFF ("csiclk" is divided by 32766).
 */
#define CSI_CKS_MAX

#define UNDERRUN_ERROR
#define OVERFLOW_ERROR
#define TX_TIMEOUT_ERROR
#define RX_TIMEOUT_ERROR

#define CSI_MAX_SPI_SCKO

#define CSI_CLKSEL_SS_DISABLED
#define CSI_CLKSEL_SS_ENABLED_ACTIVE_LOW
#define CSI_CLKSEL_SS_ENABLED_ACTIVE_HIGH

struct rzv2m_csi_priv {};

static void rzv2m_csi_reg_write_bit(const struct rzv2m_csi_priv *csi,
				    int reg_offs, int bit_mask, u32 value)
{}

static int rzv2m_csi_sw_reset(struct rzv2m_csi_priv *csi, int assert)
{}

static int rzv2m_csi_start_stop_operation(const struct rzv2m_csi_priv *csi,
					  int enable, bool wait)
{}

static int rzv2m_csi_fill_txfifo(struct rzv2m_csi_priv *csi)
{}

static int rzv2m_csi_read_rxfifo(struct rzv2m_csi_priv *csi)
{}

static inline void rzv2m_csi_empty_rxfifo(struct rzv2m_csi_priv *csi)
{}

static inline void rzv2m_csi_calc_current_transfer(struct rzv2m_csi_priv *csi)
{}

static inline void rzv2m_csi_set_rx_fifo_trigger_level(struct rzv2m_csi_priv *csi)
{}

static inline void rzv2m_csi_enable_rx_trigger(struct rzv2m_csi_priv *csi,
					       bool enable)
{}

static void rzv2m_csi_disable_irqs(const struct rzv2m_csi_priv *csi,
				   u32 enable_bits)
{}

static void rzv2m_csi_disable_all_irqs(struct rzv2m_csi_priv *csi)
{}

static inline void rzv2m_csi_clear_irqs(struct rzv2m_csi_priv *csi, u32 irqs)
{}

static void rzv2m_csi_clear_all_irqs(struct rzv2m_csi_priv *csi)
{}

static void rzv2m_csi_enable_irqs(struct rzv2m_csi_priv *csi, u32 enable_bits)
{}

static int rzv2m_csi_wait_for_interrupt(struct rzv2m_csi_priv *csi,
					u32 wait_mask, u32 enable_bits)
{}

static inline int rzv2m_csi_wait_for_rx_ready(struct rzv2m_csi_priv *csi)
{}

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

static void rzv2m_csi_setup_clock(struct rzv2m_csi_priv *csi, u32 spi_hz)
{}

static void rzv2m_csi_setup_operating_mode(struct rzv2m_csi_priv *csi,
					   struct spi_transfer *t)
{}

static int rzv2m_csi_setup(struct spi_device *spi)
{}

static int rzv2m_csi_pio_transfer(struct rzv2m_csi_priv *csi)
{}

static int rzv2m_csi_transfer_one(struct spi_controller *controller,
				  struct spi_device *spi,
				  struct spi_transfer *transfer)
{}

static int rzv2m_csi_target_abort(struct spi_controller *ctlr)
{}

static int rzv2m_csi_probe(struct platform_device *pdev)
{}

static void rzv2m_csi_remove(struct platform_device *pdev)
{}

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

static struct platform_driver rzv2m_csi_drv =;
module_platform_driver();

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