linux/drivers/spi/spi-geni-qcom.c

// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2017-2018, The Linux foundation. All rights reserved.

#include <linux/clk.h>
#include <linux/dmaengine.h>
#include <linux/dma-mapping.h>
#include <linux/dma/qcom-gpi-dma.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/log2.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/pm_opp.h>
#include <linux/pm_runtime.h>
#include <linux/property.h>
#include <linux/soc/qcom/geni-se.h>
#include <linux/spi/spi.h>
#include <linux/spinlock.h>

/* SPI SE specific registers and respective register fields */
#define SE_SPI_CPHA
#define CPHA

#define SE_SPI_LOOPBACK
#define LOOPBACK_ENABLE
#define NORMAL_MODE
#define LOOPBACK_MSK

#define SE_SPI_CPOL
#define CPOL

#define SE_SPI_DEMUX_OUTPUT_INV
#define CS_DEMUX_OUTPUT_INV_MSK

#define SE_SPI_DEMUX_SEL
#define CS_DEMUX_OUTPUT_SEL

#define SE_SPI_TRANS_CFG
#define CS_TOGGLE

#define SE_SPI_WORD_LEN
#define WORD_LEN_MSK
#define MIN_WORD_LEN

#define SE_SPI_TX_TRANS_LEN
#define SE_SPI_RX_TRANS_LEN
#define TRANS_LEN_MSK

#define SE_SPI_PRE_POST_CMD_DLY

#define SE_SPI_DELAY_COUNTERS
#define SPI_INTER_WORDS_DELAY_MSK
#define SPI_CS_CLK_DELAY_MSK
#define SPI_CS_CLK_DELAY_SHFT

#define SE_SPI_SLAVE_EN
#define SPI_SLAVE_EN

/* M_CMD OP codes for SPI */
#define SPI_TX_ONLY
#define SPI_RX_ONLY
#define SPI_TX_RX
#define SPI_CS_ASSERT
#define SPI_CS_DEASSERT
#define SPI_SCK_ONLY
/* M_CMD params for SPI */
#define SPI_PRE_CMD_DELAY
#define TIMESTAMP_BEFORE
#define FRAGMENTATION
#define TIMESTAMP_AFTER
#define POST_CMD_DELAY

#define GSI_LOOPBACK_EN
#define GSI_CS_TOGGLE
#define GSI_CPHA
#define GSI_CPOL

struct spi_geni_master {};

static void spi_slv_setup(struct spi_geni_master *mas)
{}

static int get_spi_clk_cfg(unsigned int speed_hz,
			struct spi_geni_master *mas,
			unsigned int *clk_idx,
			unsigned int *clk_div)
{}

static void handle_se_timeout(struct spi_controller *spi,
			      struct spi_message *msg)
{}

static void handle_gpi_timeout(struct spi_controller *spi, struct spi_message *msg)
{}

static void spi_geni_handle_err(struct spi_controller *spi, struct spi_message *msg)
{}

static bool spi_geni_is_abort_still_pending(struct spi_geni_master *mas)
{}

static void spi_geni_set_cs(struct spi_device *slv, bool set_flag)
{}

static void spi_setup_word_len(struct spi_geni_master *mas, u16 mode,
					unsigned int bits_per_word)
{}

static int geni_spi_set_clock_and_bw(struct spi_geni_master *mas,
					unsigned long clk_hz)
{}

static int setup_fifo_params(struct spi_device *spi_slv,
					struct spi_controller *spi)
{}

static void
spi_gsi_callback_result(void *cb, const struct dmaengine_result *result)
{}

static int setup_gsi_xfer(struct spi_transfer *xfer, struct spi_geni_master *mas,
			  struct spi_device *spi_slv, struct spi_controller *spi)
{}

static u32 get_xfer_len_in_words(struct spi_transfer *xfer,
				struct spi_geni_master *mas)
{}

static bool geni_can_dma(struct spi_controller *ctlr,
			 struct spi_device *slv, struct spi_transfer *xfer)
{}

static int spi_geni_prepare_message(struct spi_controller *spi,
				    struct spi_message *spi_msg)
{}

static void spi_geni_release_dma_chan(void *data)
{}

static int spi_geni_grab_gpi_chan(struct spi_geni_master *mas)
{}

static int spi_geni_init(struct spi_geni_master *mas)
{}

static unsigned int geni_byte_per_fifo_word(struct spi_geni_master *mas)
{}

static bool geni_spi_handle_tx(struct spi_geni_master *mas)
{}

static void geni_spi_handle_rx(struct spi_geni_master *mas)
{}

static int setup_se_xfer(struct spi_transfer *xfer,
				struct spi_geni_master *mas,
				u16 mode, struct spi_controller *spi)
{}

static int spi_geni_transfer_one(struct spi_controller *spi,
				 struct spi_device *slv,
				 struct spi_transfer *xfer)
{}

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

static int spi_geni_probe(struct platform_device *pdev)
{}

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

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

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

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

static const struct dev_pm_ops spi_geni_pm_ops =;

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

static struct platform_driver spi_geni_driver =;
module_platform_driver();

MODULE_DESCRIPTION();
MODULE_LICENSE();