linux/drivers/i2c/busses/i2c-hisi.c

// SPDX-License-Identifier: GPL-2.0
/*
 * HiSilicon I2C Controller Driver for Kunpeng SoC
 *
 * Copyright (c) 2021 HiSilicon Technologies Co., Ltd.
 */

#include <linux/bits.h>
#include <linux/bitfield.h>
#include <linux/clk.h>
#include <linux/completion.h>
#include <linux/i2c.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/module.h>
#include <linux/mod_devicetable.h>
#include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/units.h>

#define HISI_I2C_FRAME_CTRL
#define HISI_I2C_FRAME_CTRL_SPEED_MODE
#define HISI_I2C_FRAME_CTRL_ADDR_TEN
#define HISI_I2C_SLV_ADDR
#define HISI_I2C_SLV_ADDR_VAL
#define HISI_I2C_SLV_ADDR_GC_S_MODE
#define HISI_I2C_SLV_ADDR_GC_S_EN
#define HISI_I2C_CMD_TXDATA
#define HISI_I2C_CMD_TXDATA_DATA
#define HISI_I2C_CMD_TXDATA_RW
#define HISI_I2C_CMD_TXDATA_P_EN
#define HISI_I2C_CMD_TXDATA_SR_EN
#define HISI_I2C_RXDATA
#define HISI_I2C_RXDATA_DATA
#define HISI_I2C_SS_SCL_HCNT
#define HISI_I2C_SS_SCL_LCNT
#define HISI_I2C_FS_SCL_HCNT
#define HISI_I2C_FS_SCL_LCNT
#define HISI_I2C_HS_SCL_HCNT
#define HISI_I2C_HS_SCL_LCNT
#define HISI_I2C_FIFO_CTRL
#define HISI_I2C_FIFO_RX_CLR
#define HISI_I2C_FIFO_TX_CLR
#define HISI_I2C_FIFO_RX_AF_THRESH
#define HISI_I2C_FIFO_TX_AE_THRESH
#define HISI_I2C_FIFO_STATE
#define HISI_I2C_FIFO_STATE_RX_RERR
#define HISI_I2C_FIFO_STATE_RX_WERR
#define HISI_I2C_FIFO_STATE_RX_EMPTY
#define HISI_I2C_FIFO_STATE_TX_RERR
#define HISI_I2C_FIFO_STATE_TX_WERR
#define HISI_I2C_FIFO_STATE_TX_FULL
#define HISI_I2C_SDA_HOLD
#define HISI_I2C_SDA_HOLD_TX
#define HISI_I2C_SDA_HOLD_RX
#define HISI_I2C_FS_SPK_LEN
#define HISI_I2C_FS_SPK_LEN_CNT
#define HISI_I2C_HS_SPK_LEN
#define HISI_I2C_HS_SPK_LEN_CNT
#define HISI_I2C_TX_INT_CLR
#define HISI_I2C_TX_AEMPTY_INT
#define HISI_I2C_INT_MSTAT
#define HISI_I2C_INT_CLR
#define HISI_I2C_INT_MASK
#define HISI_I2C_TRANS_STATE
#define HISI_I2C_TRANS_ERR
#define HISI_I2C_VERSION

#define HISI_I2C_INT_ALL
#define HISI_I2C_INT_TRANS_CPLT
#define HISI_I2C_INT_TRANS_ERR
#define HISI_I2C_INT_FIFO_ERR
#define HISI_I2C_INT_RX_FULL
#define HISI_I2C_INT_TX_EMPTY
#define HISI_I2C_INT_ERR

#define HISI_I2C_STD_SPEED_MODE
#define HISI_I2C_FAST_SPEED_MODE
#define HISI_I2C_HIGH_SPEED_MODE

#define HISI_I2C_TX_FIFO_DEPTH
#define HISI_I2C_RX_FIFO_DEPTH
#define HISI_I2C_TX_F_AE_THRESH
#define HISI_I2C_RX_F_AF_THRESH

#define NSEC_TO_CYCLES(ns, clk_rate_khz)

struct hisi_i2c_controller {};

static void hisi_i2c_enable_int(struct hisi_i2c_controller *ctlr, u32 mask)
{}

static void hisi_i2c_disable_int(struct hisi_i2c_controller *ctlr, u32 mask)
{}

static void hisi_i2c_clear_int(struct hisi_i2c_controller *ctlr, u32 mask)
{}

static void hisi_i2c_clear_tx_int(struct hisi_i2c_controller *ctlr, u32 mask)
{}

static void hisi_i2c_handle_errors(struct hisi_i2c_controller *ctlr)
{}

static int hisi_i2c_start_xfer(struct hisi_i2c_controller *ctlr)
{}

static void hisi_i2c_reset_xfer(struct hisi_i2c_controller *ctlr)
{}

/*
 * Initialize the transfer information and start the I2C bus transfer.
 * We only configure the transfer and do some pre/post works here, and
 * wait for the transfer done. The major transfer process is performed
 * in the IRQ handler.
 */
static int hisi_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
			 int num)
{}

static u32 hisi_i2c_functionality(struct i2c_adapter *adap)
{}

static const struct i2c_algorithm hisi_i2c_algo =;

static int hisi_i2c_read_rx_fifo(struct hisi_i2c_controller *ctlr)
{}

static void hisi_i2c_xfer_msg(struct hisi_i2c_controller *ctlr)
{}

static irqreturn_t hisi_i2c_irq(int irq, void *context)
{}

/*
 * Helper function for calculating and configuring the HIGH and LOW
 * periods of SCL clock. The caller will pass the ratio of the
 * counts (divide / divisor) according to the target speed mode,
 * and the target registers.
 */
static void hisi_i2c_set_scl(struct hisi_i2c_controller *ctlr,
			     u32 divide, u32 divisor,
			     u32 reg_hcnt, u32 reg_lcnt)
{}

static void hisi_i2c_configure_bus(struct hisi_i2c_controller *ctlr)
{}

static int hisi_i2c_probe(struct platform_device *pdev)
{}

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

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

static struct platform_driver hisi_i2c_driver =;
module_platform_driver();

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