linux/drivers/spi/spi-bcm63xx.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Broadcom BCM63xx SPI controller support
 *
 * Copyright (C) 2009-2012 Florian Fainelli <[email protected]>
 * Copyright (C) 2010 Tanguy Bouzeloc <[email protected]>
 */

#include <linux/kernel.h>
#include <linux/clk.h>
#include <linux/io.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/delay.h>
#include <linux/interrupt.h>
#include <linux/spi/spi.h>
#include <linux/completion.h>
#include <linux/err.h>
#include <linux/pm_runtime.h>
#include <linux/of.h>
#include <linux/reset.h>

/* BCM 6338/6348 SPI core */
#define SPI_6348_RSET_SIZE
#define SPI_6348_CMD
#define SPI_6348_INT_STATUS
#define SPI_6348_INT_MASK_ST
#define SPI_6348_INT_MASK
#define SPI_6348_ST
#define SPI_6348_CLK_CFG
#define SPI_6348_FILL_BYTE
#define SPI_6348_MSG_TAIL
#define SPI_6348_RX_TAIL
#define SPI_6348_MSG_CTL
#define SPI_6348_MSG_CTL_WIDTH
#define SPI_6348_MSG_DATA
#define SPI_6348_MSG_DATA_SIZE
#define SPI_6348_RX_DATA
#define SPI_6348_RX_DATA_SIZE

/* BCM 3368/6358/6262/6368 SPI core */
#define SPI_6358_RSET_SIZE
#define SPI_6358_MSG_CTL
#define SPI_6358_MSG_CTL_WIDTH
#define SPI_6358_MSG_DATA
#define SPI_6358_MSG_DATA_SIZE
#define SPI_6358_RX_DATA
#define SPI_6358_RX_DATA_SIZE
#define SPI_6358_CMD
#define SPI_6358_INT_STATUS
#define SPI_6358_INT_MASK_ST
#define SPI_6358_INT_MASK
#define SPI_6358_ST
#define SPI_6358_CLK_CFG
#define SPI_6358_FILL_BYTE
#define SPI_6358_MSG_TAIL
#define SPI_6358_RX_TAIL

/* Shared SPI definitions */

/* Message configuration */
#define SPI_FD_RW
#define SPI_HD_W
#define SPI_HD_R
#define SPI_BYTE_CNT_SHIFT
#define SPI_6348_MSG_TYPE_SHIFT
#define SPI_6358_MSG_TYPE_SHIFT

/* Command */
#define SPI_CMD_NOOP
#define SPI_CMD_SOFT_RESET
#define SPI_CMD_HARD_RESET
#define SPI_CMD_START_IMMEDIATE
#define SPI_CMD_COMMAND_SHIFT
#define SPI_CMD_COMMAND_MASK
#define SPI_CMD_DEVICE_ID_SHIFT
#define SPI_CMD_PREPEND_BYTE_CNT_SHIFT
#define SPI_CMD_ONE_BYTE_SHIFT
#define SPI_CMD_ONE_WIRE_SHIFT
#define SPI_DEV_ID_0
#define SPI_DEV_ID_1
#define SPI_DEV_ID_2
#define SPI_DEV_ID_3

/* Interrupt mask */
#define SPI_INTR_CMD_DONE
#define SPI_INTR_RX_OVERFLOW
#define SPI_INTR_TX_UNDERFLOW
#define SPI_INTR_TX_OVERFLOW
#define SPI_INTR_RX_UNDERFLOW
#define SPI_INTR_CLEAR_ALL

/* Status */
#define SPI_RX_EMPTY
#define SPI_CMD_BUSY
#define SPI_SERIAL_BUSY

/* Clock configuration */
#define SPI_CLK_20MHZ
#define SPI_CLK_0_391MHZ
#define SPI_CLK_0_781MHZ
#define SPI_CLK_1_563MHZ
#define SPI_CLK_3_125MHZ
#define SPI_CLK_6_250MHZ
#define SPI_CLK_12_50MHZ
#define SPI_CLK_MASK
#define SPI_SSOFFTIME_MASK
#define SPI_SSOFFTIME_SHIFT
#define SPI_BYTE_SWAP

enum bcm63xx_regs_spi {};

#define BCM63XX_SPI_MAX_PREPEND

#define BCM63XX_SPI_MAX_CS
#define BCM63XX_SPI_BUS_NUM

struct bcm63xx_spi {};

static inline u8 bcm_spi_readb(struct bcm63xx_spi *bs,
			       unsigned int offset)
{}

static inline void bcm_spi_writeb(struct bcm63xx_spi *bs,
				  u8 value, unsigned int offset)
{}

static inline void bcm_spi_writew(struct bcm63xx_spi *bs,
				  u16 value, unsigned int offset)
{}

static const unsigned int bcm63xx_spi_freq_table[SPI_CLK_MASK][2] =;

static void bcm63xx_spi_setup_transfer(struct spi_device *spi,
				      struct spi_transfer *t)
{}

/* the spi->mode bits understood by this driver: */
#define MODEBITS

static int bcm63xx_txrx_bufs(struct spi_device *spi, struct spi_transfer *first,
				unsigned int num_transfers)
{}

static int bcm63xx_spi_transfer_one(struct spi_controller *host,
					struct spi_message *m)
{}

/* This driver supports single host mode only. Hence
 * CMD_DONE is the only interrupt we care about
 */
static irqreturn_t bcm63xx_spi_interrupt(int irq, void *dev_id)
{}

static size_t bcm63xx_spi_max_length(struct spi_device *spi)
{}

static const unsigned long bcm6348_spi_reg_offsets[] =;

static const unsigned long bcm6358_spi_reg_offsets[] =;

static const struct platform_device_id bcm63xx_spi_dev_match[] =;

static const struct of_device_id bcm63xx_spi_of_match[] =;

static int bcm63xx_spi_probe(struct platform_device *pdev)
{}

static void bcm63xx_spi_remove(struct platform_device *pdev)
{}

static int bcm63xx_spi_suspend(struct device *dev)
{}

static int bcm63xx_spi_resume(struct device *dev)
{}

static DEFINE_SIMPLE_DEV_PM_OPS(bcm63xx_spi_pm_ops, bcm63xx_spi_suspend, bcm63xx_spi_resume);

static struct platform_driver bcm63xx_spi_driver =;

module_platform_driver();

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