#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>
#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 …
#define PCI_DEVICE_ID_ML7213_SPI …
#define PCI_DEVICE_ID_ML7223_SPI …
#define PCI_DEVICE_ID_ML7831_SPI …
#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 { … };
struct pch_spi_board_data { … };
struct pch_pd_dev_save { … };
static const struct pci_device_id pch_spi_pcidev_id[] = …;
static inline void pch_spi_writereg(struct spi_controller *host, int idx, u32 val)
{ … }
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)
{ … }
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)
{ … }
static irqreturn_t pch_spi_handler(int irq, void *dev_id)
{ … }
static void pch_spi_set_baud_rate(struct spi_controller *host, u32 speed_hz)
{ … }
static void pch_spi_set_bits_per_word(struct spi_controller *host,
u8 bits_per_word)
{ … }
static void pch_spi_setup_transfer(struct spi_device *spi)
{ … }
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);