linux/drivers/spi/spi-meson-spifc.c

// SPDX-License-Identifier: GPL-2.0+
//
// Driver for Amlogic Meson SPI flash controller (SPIFC)
//
// Copyright (C) 2014 Beniamino Galvani <[email protected]>
//

#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/io.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/regmap.h>
#include <linux/spi/spi.h>
#include <linux/types.h>

/* register map */
#define REG_CMD
#define REG_ADDR
#define REG_CTRL
#define REG_CTRL1
#define REG_STATUS
#define REG_CTRL2
#define REG_CLOCK
#define REG_USER
#define REG_USER1
#define REG_USER2
#define REG_USER3
#define REG_USER4
#define REG_SLAVE
#define REG_SLAVE1
#define REG_SLAVE2
#define REG_SLAVE3
#define REG_C0
#define REG_B8
#define REG_MAX

/* register fields */
#define CMD_USER
#define CTRL_ENABLE_AHB
#define CLOCK_SOURCE
#define CLOCK_DIV_SHIFT
#define CLOCK_DIV_MASK
#define CLOCK_CNT_HIGH_SHIFT
#define CLOCK_CNT_HIGH_MASK
#define CLOCK_CNT_LOW_SHIFT
#define CLOCK_CNT_LOW_MASK
#define USER_DIN_EN_MS
#define USER_CMP_MODE
#define USER_UC_DOUT_SEL
#define USER_UC_DIN_SEL
#define USER_UC_MASK
#define USER1_BN_UC_DOUT_SHIFT
#define USER1_BN_UC_DOUT_MASK
#define USER1_BN_UC_DIN_SHIFT
#define USER1_BN_UC_DIN_MASK
#define USER4_CS_ACT
#define SLAVE_TRST_DONE
#define SLAVE_OP_MODE
#define SLAVE_SW_RST

#define SPIFC_BUFFER_SIZE

/**
 * struct meson_spifc
 * @host:	the SPI host
 * @regmap:	regmap for device registers
 * @clk:	input clock of the built-in baud rate generator
 * @dev:	the device structure
 */
struct meson_spifc {};

static const struct regmap_config spifc_regmap_config =;

/**
 * meson_spifc_wait_ready() - wait for the current operation to terminate
 * @spifc:	the Meson SPI device
 * Return:	0 on success, a negative value on error
 */
static int meson_spifc_wait_ready(struct meson_spifc *spifc)
{}

/**
 * meson_spifc_drain_buffer() - copy data from device buffer to memory
 * @spifc:	the Meson SPI device
 * @buf:	the destination buffer
 * @len:	number of bytes to copy
 */
static void meson_spifc_drain_buffer(struct meson_spifc *spifc, u8 *buf,
				     int len)
{}

/**
 * meson_spifc_fill_buffer() - copy data from memory to device buffer
 * @spifc:	the Meson SPI device
 * @buf:	the source buffer
 * @len:	number of bytes to copy
 */
static void meson_spifc_fill_buffer(struct meson_spifc *spifc, const u8 *buf,
				    int len)
{}

/**
 * meson_spifc_setup_speed() - program the clock divider
 * @spifc:	the Meson SPI device
 * @speed:	desired speed in Hz
 */
static void meson_spifc_setup_speed(struct meson_spifc *spifc, u32 speed)
{}

/**
 * meson_spifc_txrx() - transfer a chunk of data
 * @spifc:	the Meson SPI device
 * @xfer:	the current SPI transfer
 * @offset:	offset of the data to transfer
 * @len:	length of the data to transfer
 * @last_xfer:	whether this is the last transfer of the message
 * @last_chunk:	whether this is the last chunk of the transfer
 * Return:	0 on success, a negative value on error
 */
static int meson_spifc_txrx(struct meson_spifc *spifc,
			    struct spi_transfer *xfer,
			    int offset, int len, bool last_xfer,
			    bool last_chunk)
{}

/**
 * meson_spifc_transfer_one() - perform a single transfer
 * @host:	the SPI host
 * @spi:	the SPI device
 * @xfer:	the current SPI transfer
 * Return:	0 on success, a negative value on error
 */
static int meson_spifc_transfer_one(struct spi_controller *host,
				    struct spi_device *spi,
				    struct spi_transfer *xfer)
{}

/**
 * meson_spifc_hw_init() - reset and initialize the SPI controller
 * @spifc:	the Meson SPI device
 */
static void meson_spifc_hw_init(struct meson_spifc *spifc)
{}

static int meson_spifc_probe(struct platform_device *pdev)
{}

static void meson_spifc_remove(struct platform_device *pdev)
{}

#ifdef CONFIG_PM_SLEEP
static int meson_spifc_suspend(struct device *dev)
{}

static int meson_spifc_resume(struct device *dev)
{}
#endif /* CONFIG_PM_SLEEP */

#ifdef CONFIG_PM
static int meson_spifc_runtime_suspend(struct device *dev)
{}

static int meson_spifc_runtime_resume(struct device *dev)
{}
#endif /* CONFIG_PM */

static const struct dev_pm_ops meson_spifc_pm_ops =;

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

static struct platform_driver meson_spifc_driver =;

module_platform_driver();

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