linux/drivers/spi/spi-bcm2835aux.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Driver for Broadcom BCM2835 auxiliary SPI Controllers
 *
 * the driver does not rely on the native chipselects at all
 * but only uses the gpio type chipselects
 *
 * Based on: spi-bcm2835.c
 *
 * Copyright (C) 2015 Martin Sperl
 */

#include <linux/clk.h>
#include <linux/completion.h>
#include <linux/debugfs.h>
#include <linux/delay.h>
#include <linux/err.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
#include <linux/spi/spi.h>
#include <linux/spinlock.h>

/* define polling limits */
static unsigned int polling_limit_us =;
module_param(polling_limit_us, uint, 0664);
MODULE_PARM_DESC();

/*
 * spi register defines
 *
 * note there is garbage in the "official" documentation,
 * so some data is taken from the file:
 *   brcm_usrlib/dag/vmcsx/vcinclude/bcm2708_chip/aux_io.h
 * inside of:
 *   http://www.broadcom.com/docs/support/videocore/Brcm_Android_ICS_Graphics_Stack.tar.gz
 */

/* SPI register offsets */
#define BCM2835_AUX_SPI_CNTL0
#define BCM2835_AUX_SPI_CNTL1
#define BCM2835_AUX_SPI_STAT
#define BCM2835_AUX_SPI_PEEK
#define BCM2835_AUX_SPI_IO
#define BCM2835_AUX_SPI_TXHOLD

/* Bitfields in CNTL0 */
#define BCM2835_AUX_SPI_CNTL0_SPEED
#define BCM2835_AUX_SPI_CNTL0_SPEED_MAX
#define BCM2835_AUX_SPI_CNTL0_SPEED_SHIFT
#define BCM2835_AUX_SPI_CNTL0_CS
#define BCM2835_AUX_SPI_CNTL0_POSTINPUT
#define BCM2835_AUX_SPI_CNTL0_VAR_CS
#define BCM2835_AUX_SPI_CNTL0_VAR_WIDTH
#define BCM2835_AUX_SPI_CNTL0_DOUTHOLD
#define BCM2835_AUX_SPI_CNTL0_ENABLE
#define BCM2835_AUX_SPI_CNTL0_IN_RISING
#define BCM2835_AUX_SPI_CNTL0_CLEARFIFO
#define BCM2835_AUX_SPI_CNTL0_OUT_RISING
#define BCM2835_AUX_SPI_CNTL0_CPOL
#define BCM2835_AUX_SPI_CNTL0_MSBF_OUT
#define BCM2835_AUX_SPI_CNTL0_SHIFTLEN

/* Bitfields in CNTL1 */
#define BCM2835_AUX_SPI_CNTL1_CSHIGH
#define BCM2835_AUX_SPI_CNTL1_TXEMPTY
#define BCM2835_AUX_SPI_CNTL1_IDLE
#define BCM2835_AUX_SPI_CNTL1_MSBF_IN
#define BCM2835_AUX_SPI_CNTL1_KEEP_IN

/* Bitfields in STAT */
#define BCM2835_AUX_SPI_STAT_TX_LVL
#define BCM2835_AUX_SPI_STAT_RX_LVL
#define BCM2835_AUX_SPI_STAT_TX_FULL
#define BCM2835_AUX_SPI_STAT_TX_EMPTY
#define BCM2835_AUX_SPI_STAT_RX_FULL
#define BCM2835_AUX_SPI_STAT_RX_EMPTY
#define BCM2835_AUX_SPI_STAT_BUSY
#define BCM2835_AUX_SPI_STAT_BITCOUNT

struct bcm2835aux_spi {};

#if defined(CONFIG_DEBUG_FS)
static void bcm2835aux_debugfs_create(struct bcm2835aux_spi *bs,
				      const char *dname)
{}

static void bcm2835aux_debugfs_remove(struct bcm2835aux_spi *bs)
{}
#else
static void bcm2835aux_debugfs_create(struct bcm2835aux_spi *bs,
				      const char *dname)
{
}

static void bcm2835aux_debugfs_remove(struct bcm2835aux_spi *bs)
{
}
#endif /* CONFIG_DEBUG_FS */

static inline u32 bcm2835aux_rd(struct bcm2835aux_spi *bs, unsigned int reg)
{}

static inline void bcm2835aux_wr(struct bcm2835aux_spi *bs, unsigned int reg,
				 u32 val)
{}

static inline void bcm2835aux_rd_fifo(struct bcm2835aux_spi *bs)
{}

static inline void bcm2835aux_wr_fifo(struct bcm2835aux_spi *bs)
{}

static void bcm2835aux_spi_reset_hw(struct bcm2835aux_spi *bs)
{}

static void bcm2835aux_spi_transfer_helper(struct bcm2835aux_spi *bs)
{}

static irqreturn_t bcm2835aux_spi_interrupt(int irq, void *dev_id)
{}

static int __bcm2835aux_spi_transfer_one_irq(struct spi_controller *host,
					     struct spi_device *spi,
					     struct spi_transfer *tfr)
{}

static int bcm2835aux_spi_transfer_one_irq(struct spi_controller *host,
					   struct spi_device *spi,
					   struct spi_transfer *tfr)
{}

static int bcm2835aux_spi_transfer_one_poll(struct spi_controller *host,
					    struct spi_device *spi,
					struct spi_transfer *tfr)
{}

static int bcm2835aux_spi_transfer_one(struct spi_controller *host,
				       struct spi_device *spi,
				       struct spi_transfer *tfr)
{}

static int bcm2835aux_spi_prepare_message(struct spi_controller *host,
					  struct spi_message *msg)
{}

static int bcm2835aux_spi_unprepare_message(struct spi_controller *host,
					    struct spi_message *msg)
{}

static void bcm2835aux_spi_handle_err(struct spi_controller *host,
				      struct spi_message *msg)
{}

static int bcm2835aux_spi_setup(struct spi_device *spi)
{}

static int bcm2835aux_spi_probe(struct platform_device *pdev)
{}

static void bcm2835aux_spi_remove(struct platform_device *pdev)
{}

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

static struct platform_driver bcm2835aux_spi_driver =;
module_platform_driver();

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