linux/drivers/spi/spi-hisi-kunpeng.c

// SPDX-License-Identifier: GPL-2.0-only
//
// HiSilicon SPI Controller Driver for Kunpeng SoCs
//
// Copyright (c) 2021 HiSilicon Technologies Co., Ltd.
// Author: Jay Fang <[email protected]>
//
// This code is based on spi-dw-core.c.

#include <linux/acpi.h>
#include <linux/bitfield.h>
#include <linux/debugfs.h>
#include <linux/delay.h>
#include <linux/err.h>
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/property.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/spi/spi.h>

/* Register offsets */
#define HISI_SPI_CSCR
#define HISI_SPI_CR
#define HISI_SPI_ENR
#define HISI_SPI_FIFOC
#define HISI_SPI_IMR
#define HISI_SPI_DIN
#define HISI_SPI_DOUT
#define HISI_SPI_SR
#define HISI_SPI_RISR
#define HISI_SPI_ISR
#define HISI_SPI_ICR
#define HISI_SPI_VERSION

/* Bit fields in HISI_SPI_CR */
#define CR_LOOP_MASK
#define CR_CPOL_MASK
#define CR_CPHA_MASK
#define CR_DIV_PRE_MASK
#define CR_DIV_POST_MASK
#define CR_BPW_MASK
#define CR_SPD_MODE_MASK

/* Bit fields in HISI_SPI_FIFOC */
#define FIFOC_TX_MASK
#define FIFOC_RX_MASK

/* Bit fields in HISI_SPI_IMR, 4 bits */
#define IMR_RXOF
#define IMR_RXTO
#define IMR_RX
#define IMR_TX
#define IMR_MASK

/* Bit fields in HISI_SPI_SR, 5 bits */
#define SR_TXE
#define SR_TXNF
#define SR_RXNE
#define SR_RXF
#define SR_BUSY

/* Bit fields in HISI_SPI_ISR, 4 bits */
#define ISR_RXOF
#define ISR_RXTO
#define ISR_RX
#define ISR_TX
#define ISR_MASK

/* Bit fields in HISI_SPI_ICR, 2 bits */
#define ICR_RXOF
#define ICR_RXTO
#define ICR_MASK

#define DIV_POST_MAX
#define DIV_POST_MIN
#define DIV_PRE_MAX
#define DIV_PRE_MIN
#define CLK_DIV_MAX
#define CLK_DIV_MIN

#define DEFAULT_NUM_CS

#define HISI_SPI_WAIT_TIMEOUT_MS

enum hisi_spi_rx_level_trig {};

enum hisi_spi_tx_level_trig {};

enum hisi_spi_frame_n_bytes {};

/* Slave spi_dev related */
struct hisi_chip_data {};

struct hisi_spi {};

#define HISI_SPI_DBGFS_REG(_name, _off)

static const struct debugfs_reg32 hisi_spi_regs[] =;

static int hisi_spi_debugfs_init(struct hisi_spi *hs)
{}

static u32 hisi_spi_busy(struct hisi_spi *hs)
{}

static u32 hisi_spi_rx_not_empty(struct hisi_spi *hs)
{}

static u32 hisi_spi_tx_not_full(struct hisi_spi *hs)
{}

static void hisi_spi_flush_fifo(struct hisi_spi *hs)
{}

/* Disable the controller and all interrupts */
static void hisi_spi_disable(struct hisi_spi *hs)
{}

static u8 hisi_spi_n_bytes(struct spi_transfer *transfer)
{}

static void hisi_spi_reader(struct hisi_spi *hs)
{}

static void hisi_spi_writer(struct hisi_spi *hs)
{}

static void __hisi_calc_div_reg(struct hisi_chip_data *chip)
{}

static u32 hisi_calc_effective_speed(struct spi_controller *host,
			struct hisi_chip_data *chip, u32 speed_hz)
{}

static u32 hisi_spi_prepare_cr(struct spi_device *spi)
{}

static void hisi_spi_hw_init(struct hisi_spi *hs)
{}

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

static int hisi_spi_transfer_one(struct spi_controller *host,
		struct spi_device *spi, struct spi_transfer *transfer)
{}

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

static int hisi_spi_setup(struct spi_device *spi)
{}

static void hisi_spi_cleanup(struct spi_device *spi)
{}

static int hisi_spi_probe(struct platform_device *pdev)
{}

static void hisi_spi_remove(struct platform_device *pdev)
{}

static const struct acpi_device_id hisi_spi_acpi_match[] =;
MODULE_DEVICE_TABLE(acpi, hisi_spi_acpi_match);

static struct platform_driver hisi_spi_driver =;
module_platform_driver();

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