linux/drivers/spi/spi-topcliff-pch.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * SPI bus driver for the Topcliff PCH used by Intel SoCs
 *
 * Copyright (C) 2011 LAPIS Semiconductor Co., Ltd.
 */

#include <linux/delay.h>
#include <linux/pci.h>
#include <linux/wait.h>
#include <linux/spi/spi.h>
#include <linux/interrupt.h>
#include <linux/sched.h>
#include <linux/spi/spidev.h>
#include <linux/module.h>
#include <linux/device.h>
#include <linux/platform_device.h>

#include <linux/dmaengine.h>
#include <linux/pch_dma.h>

/* Register offsets */
#define PCH_SPCR
#define PCH_SPBRR
#define PCH_SPSR
#define PCH_SPDWR
#define PCH_SPDRR
#define PCH_SSNXCR
#define PCH_SRST
#define PCH_ADDRESS_SIZE

#define PCH_SPSR_TFD
#define PCH_SPSR_RFD

#define PCH_READABLE(x)
#define PCH_WRITABLE(x)

#define PCH_RX_THOLD
#define PCH_RX_THOLD_MAX

#define PCH_TX_THOLD

#define PCH_MAX_BAUDRATE
#define PCH_MAX_FIFO_DEPTH

#define STATUS_RUNNING
#define STATUS_EXITING
#define PCH_SLEEP_TIME

#define SSN_LOW
#define SSN_HIGH
#define SSN_NO_CONTROL
#define PCH_MAX_CS
#define PCI_DEVICE_ID_GE_SPI

#define SPCR_SPE_BIT
#define SPCR_MSTR_BIT
#define SPCR_LSBF_BIT
#define SPCR_CPHA_BIT
#define SPCR_CPOL_BIT
#define SPCR_TFIE_BIT
#define SPCR_RFIE_BIT
#define SPCR_FIE_BIT
#define SPCR_ORIE_BIT
#define SPCR_MDFIE_BIT
#define SPCR_FICLR_BIT
#define SPSR_TFI_BIT
#define SPSR_RFI_BIT
#define SPSR_FI_BIT
#define SPSR_ORF_BIT
#define SPBRR_SIZE_BIT

#define PCH_ALL

#define SPCR_RFIC_FIELD
#define SPCR_TFIC_FIELD

#define MASK_SPBRR_SPBR_BITS
#define MASK_RFIC_SPCR_BITS
#define MASK_TFIC_SPCR_BITS

#define PCH_CLOCK_HZ
#define PCH_MAX_SPBR

/* Definition for ML7213/ML7223/ML7831 by LAPIS Semiconductor */
#define PCI_DEVICE_ID_ML7213_SPI
#define PCI_DEVICE_ID_ML7223_SPI
#define PCI_DEVICE_ID_ML7831_SPI

/*
 * Set the number of SPI instance max
 * Intel EG20T PCH :		1ch
 * LAPIS Semiconductor ML7213 IOH :	2ch
 * LAPIS Semiconductor ML7223 IOH :	1ch
 * LAPIS Semiconductor ML7831 IOH :	1ch
*/
#define PCH_SPI_MAX_DEV

#define PCH_BUF_SIZE
#define PCH_DMA_TRANS_SIZE

static int use_dma =;

struct pch_spi_dma_ctrl {};
/**
 * struct pch_spi_data - Holds the SPI channel specific details
 * @io_remap_addr:		The remapped PCI base address
 * @io_base_addr:		Base address
 * @host:			Pointer to the SPI controller structure
 * @work:			Reference to work queue handler
 * @wait:			Wait queue for waking up upon receiving an
 *				interrupt.
 * @transfer_complete:		Status of SPI Transfer
 * @bcurrent_msg_processing:	Status flag for message processing
 * @lock:			Lock for protecting this structure
 * @queue:			SPI Message queue
 * @status:			Status of the SPI driver
 * @bpw_len:			Length of data to be transferred in bits per
 *				word
 * @transfer_active:		Flag showing active transfer
 * @tx_index:			Transmit data count; for bookkeeping during
 *				transfer
 * @rx_index:			Receive data count; for bookkeeping during
 *				transfer
 * @pkt_tx_buff:		Buffer for data to be transmitted
 * @pkt_rx_buff:		Buffer for received data
 * @n_curnt_chip:		The chip number that this SPI driver currently
 *				operates on
 * @current_chip:		Reference to the current chip that this SPI
 *				driver currently operates on
 * @current_msg:		The current message that this SPI driver is
 *				handling
 * @cur_trans:			The current transfer that this SPI driver is
 *				handling
 * @board_dat:			Reference to the SPI device data structure
 * @plat_dev:			platform_device structure
 * @ch:				SPI channel number
 * @dma:			Local DMA information
 * @use_dma:			True if DMA is to be used
 * @irq_reg_sts:		Status of IRQ registration
 * @save_total_len:		Save length while data is being transferred
 */
struct pch_spi_data {};

/**
 * struct pch_spi_board_data - Holds the SPI device specific details
 * @pdev:		Pointer to the PCI device
 * @suspend_sts:	Status of suspend
 * @num:		The number of SPI device instance
 */
struct pch_spi_board_data {};

struct pch_pd_dev_save {};

static const struct pci_device_id pch_spi_pcidev_id[] =;

/**
 * pch_spi_writereg() - Performs  register writes
 * @host:	Pointer to struct spi_controller.
 * @idx:	Register offset.
 * @val:	Value to be written to register.
 */
static inline void pch_spi_writereg(struct spi_controller *host, int idx, u32 val)
{}

/**
 * pch_spi_readreg() - Performs register reads
 * @host:	Pointer to struct spi_controller.
 * @idx:	Register offset.
 */
static inline u32 pch_spi_readreg(struct spi_controller *host, int idx)
{}

static inline void pch_spi_setclr_reg(struct spi_controller *host, int idx,
				      u32 set, u32 clr)
{}

static void pch_spi_set_host_mode(struct spi_controller *host)
{}

/**
 * pch_spi_clear_fifo() - Clears the Transmit and Receive FIFOs
 * @host:	Pointer to struct spi_controller.
 */
static void pch_spi_clear_fifo(struct spi_controller *host)
{}

static void pch_spi_handler_sub(struct pch_spi_data *data, u32 reg_spsr_val,
				void __iomem *io_remap_addr)
{}

/**
 * pch_spi_handler() - Interrupt handler
 * @irq:	The interrupt number.
 * @dev_id:	Pointer to struct pch_spi_board_data.
 */
static irqreturn_t pch_spi_handler(int irq, void *dev_id)
{}

/**
 * pch_spi_set_baud_rate() - Sets SPBR field in SPBRR
 * @host:	Pointer to struct spi_controller.
 * @speed_hz:	Baud rate.
 */
static void pch_spi_set_baud_rate(struct spi_controller *host, u32 speed_hz)
{}

/**
 * pch_spi_set_bits_per_word() - Sets SIZE field in SPBRR
 * @host:		Pointer to struct spi_controller.
 * @bits_per_word:	Bits per word for SPI transfer.
 */
static void pch_spi_set_bits_per_word(struct spi_controller *host,
				      u8 bits_per_word)
{}

/**
 * pch_spi_setup_transfer() - Configures the PCH SPI hardware for transfer
 * @spi:	Pointer to struct spi_device.
 */
static void pch_spi_setup_transfer(struct spi_device *spi)
{}

/**
 * pch_spi_reset() - Clears SPI registers
 * @host:	Pointer to struct spi_controller.
 */
static void pch_spi_reset(struct spi_controller *host)
{}

static int pch_spi_transfer(struct spi_device *pspi, struct spi_message *pmsg)
{}

static inline void pch_spi_select_chip(struct pch_spi_data *data,
				       struct spi_device *pspi)
{}

static void pch_spi_set_tx(struct pch_spi_data *data, int *bpw)
{}

static void pch_spi_nomore_transfer(struct pch_spi_data *data)
{}

static void pch_spi_set_ir(struct pch_spi_data *data)
{}

static void pch_spi_copy_rx_data(struct pch_spi_data *data, int bpw)
{}

static void pch_spi_copy_rx_data_for_dma(struct pch_spi_data *data, int bpw)
{}

static int pch_spi_start_transfer(struct pch_spi_data *data)
{}

static void pch_dma_rx_complete(void *arg)
{}

static bool pch_spi_filter(struct dma_chan *chan, void *slave)
{}

static void pch_spi_request_dma(struct pch_spi_data *data, int bpw)
{}

static void pch_spi_release_dma(struct pch_spi_data *data)
{}

static void pch_spi_handle_dma(struct pch_spi_data *data, int *bpw)
{}

static void pch_spi_process_messages(struct work_struct *pwork)
{}

static void pch_spi_free_resources(struct pch_spi_board_data *board_dat,
				   struct pch_spi_data *data)
{}

static int pch_spi_get_resources(struct pch_spi_board_data *board_dat,
				 struct pch_spi_data *data)
{}

static void pch_free_dma_buf(struct pch_spi_board_data *board_dat,
			     struct pch_spi_data *data)
{}

static int pch_alloc_dma_buf(struct pch_spi_board_data *board_dat,
			      struct pch_spi_data *data)
{}

static int pch_spi_pd_probe(struct platform_device *plat_dev)
{}

static void pch_spi_pd_remove(struct platform_device *plat_dev)
{}
#ifdef CONFIG_PM
static int pch_spi_pd_suspend(struct platform_device *pd_dev,
			      pm_message_t state)
{}

static int pch_spi_pd_resume(struct platform_device *pd_dev)
{}
#else
#define pch_spi_pd_suspend
#define pch_spi_pd_resume
#endif

static struct platform_driver pch_spi_pd_driver =;

static int pch_spi_probe(struct pci_dev *pdev, const struct pci_device_id *id)
{}

static void pch_spi_remove(struct pci_dev *pdev)
{}

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

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

static SIMPLE_DEV_PM_OPS(pch_spi_pm_ops, pch_spi_suspend, pch_spi_resume);

static struct pci_driver pch_spi_pcidev_driver =;

static int __init pch_spi_init(void)
{}
module_init();

static void __exit pch_spi_exit(void)
{}
module_exit(pch_spi_exit);

module_param(use_dma, int, 0644);
MODULE_PARM_DESC();

MODULE_LICENSE();
MODULE_DESCRIPTION();
MODULE_DEVICE_TABLE(pci, pch_spi_pcidev_id);