#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/io.h>
#include <linux/clk.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/delay.h>
#include <linux/dma-mapping.h>
#include <linux/err.h>
#include <linux/interrupt.h>
#include <linux/spi/spi.h>
#include <linux/mutex.h>
#include <linux/of.h>
#include <linux/spi/spi-mem.h>
#include <linux/pm_runtime.h>
#define HSSPI_GLOBAL_CTRL_REG …
#define GLOBAL_CTRL_CS_POLARITY_SHIFT …
#define GLOBAL_CTRL_CS_POLARITY_MASK …
#define GLOBAL_CTRL_PLL_CLK_CTRL_SHIFT …
#define GLOBAL_CTRL_PLL_CLK_CTRL_MASK …
#define GLOBAL_CTRL_CLK_GATE_SSOFF …
#define GLOBAL_CTRL_CLK_POLARITY …
#define GLOBAL_CTRL_MOSI_IDLE …
#define HSSPI_GLOBAL_EXT_TRIGGER_REG …
#define HSSPI_INT_STATUS_REG …
#define HSSPI_INT_STATUS_MASKED_REG …
#define HSSPI_INT_MASK_REG …
#define HSSPI_PINGx_CMD_DONE(i) …
#define HSSPI_PINGx_RX_OVER(i) …
#define HSSPI_PINGx_TX_UNDER(i) …
#define HSSPI_PINGx_POLL_TIMEOUT(i) …
#define HSSPI_PINGx_CTRL_INVAL(i) …
#define HSSPI_INT_CLEAR_ALL …
#define HSSPI_PINGPONG_COMMAND_REG(x) …
#define PINGPONG_CMD_COMMAND_MASK …
#define PINGPONG_COMMAND_NOOP …
#define PINGPONG_COMMAND_START_NOW …
#define PINGPONG_COMMAND_START_TRIGGER …
#define PINGPONG_COMMAND_HALT …
#define PINGPONG_COMMAND_FLUSH …
#define PINGPONG_CMD_PROFILE_SHIFT …
#define PINGPONG_CMD_SS_SHIFT …
#define HSSPI_PINGPONG_STATUS_REG(x) …
#define HSSPI_PINGPONG_STATUS_SRC_BUSY …
#define HSSPI_PROFILE_CLK_CTRL_REG(x) …
#define CLK_CTRL_FREQ_CTRL_MASK …
#define CLK_CTRL_SPI_CLK_2X_SEL …
#define CLK_CTRL_ACCUM_RST_ON_LOOP …
#define CLK_CTRL_CLK_POLARITY …
#define HSSPI_PROFILE_SIGNAL_CTRL_REG(x) …
#define SIGNAL_CTRL_LATCH_RISING …
#define SIGNAL_CTRL_LAUNCH_RISING …
#define SIGNAL_CTRL_ASYNC_INPUT_PATH …
#define HSSPI_PROFILE_MODE_CTRL_REG(x) …
#define MODE_CTRL_MULTIDATA_RD_STRT_SHIFT …
#define MODE_CTRL_MULTIDATA_WR_STRT_SHIFT …
#define MODE_CTRL_MULTIDATA_RD_SIZE_SHIFT …
#define MODE_CTRL_MULTIDATA_WR_SIZE_SHIFT …
#define MODE_CTRL_MODE_3WIRE …
#define MODE_CTRL_PREPENDBYTE_CNT_SHIFT …
#define HSSPI_FIFO_REG(x) …
#define HSSPI_OP_MULTIBIT …
#define HSSPI_OP_CODE_SHIFT …
#define HSSPI_OP_SLEEP …
#define HSSPI_OP_READ_WRITE …
#define HSSPI_OP_WRITE …
#define HSSPI_OP_READ …
#define HSSPI_OP_SETIRQ …
#define HSSPI_BUFFER_LEN …
#define HSSPI_OPCODE_LEN …
#define HSSPI_MAX_PREPEND_LEN …
#define HSSPI_MAX_SYNC_CLOCK …
#define HSSPI_SPI_MAX_CS …
#define HSSPI_BUS_NUM …
#define HSSPI_POLL_STATUS_TIMEOUT_MS …
#define HSSPI_WAIT_MODE_POLLING …
#define HSSPI_WAIT_MODE_INTR …
#define HSSPI_WAIT_MODE_MAX …
#define SPIM_CTRL_CS_OVERRIDE_SEL_SHIFT …
#define SPIM_CTRL_CS_OVERRIDE_SEL_MASK …
#define SPIM_CTRL_CS_OVERRIDE_VAL_SHIFT …
#define SPIM_CTRL_CS_OVERRIDE_VAL_MASK …
struct bcmbca_hsspi { … };
static ssize_t wait_mode_show(struct device *dev, struct device_attribute *attr,
char *buf)
{ … }
static ssize_t wait_mode_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static DEVICE_ATTR_RW(wait_mode);
static struct attribute *bcmbca_hsspi_attrs[] = …;
static const struct attribute_group bcmbca_hsspi_group = …;
static void bcmbca_hsspi_set_cs(struct bcmbca_hsspi *bs, unsigned int cs,
bool active)
{ … }
static void bcmbca_hsspi_set_clk(struct bcmbca_hsspi *bs,
struct spi_device *spi, int hz)
{ … }
static int bcmbca_hsspi_wait_cmd(struct bcmbca_hsspi *bs, unsigned int cs)
{ … }
static int bcmbca_hsspi_do_txrx(struct spi_device *spi, struct spi_transfer *t,
struct spi_message *msg)
{ … }
static int bcmbca_hsspi_setup(struct spi_device *spi)
{ … }
static int bcmbca_hsspi_transfer_one(struct spi_controller *host,
struct spi_message *msg)
{ … }
static irqreturn_t bcmbca_hsspi_interrupt(int irq, void *dev_id)
{ … }
static int bcmbca_hsspi_probe(struct platform_device *pdev)
{ … }
static void bcmbca_hsspi_remove(struct platform_device *pdev)
{ … }
#ifdef CONFIG_PM_SLEEP
static int bcmbca_hsspi_suspend(struct device *dev)
{ … }
static int bcmbca_hsspi_resume(struct device *dev)
{ … }
#endif
static SIMPLE_DEV_PM_OPS(bcmbca_hsspi_pm_ops, bcmbca_hsspi_suspend,
bcmbca_hsspi_resume);
static const struct of_device_id bcmbca_hsspi_of_match[] = …;
MODULE_DEVICE_TABLE(of, bcmbca_hsspi_of_match);
static struct platform_driver bcmbca_hsspi_driver = …;
module_platform_driver(…) …;
MODULE_ALIAS(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;