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

// SPDX-License-Identifier: GPL-2.0+
/*
 * FSI-attached I2C controller algorithm
 *
 * Copyright 2018 IBM Corporation
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version
 * 2 of the License, or (at your option) any later version.
 */

#include <linux/bitfield.h>
#include <linux/bitops.h>
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/errno.h>
#include <linux/fsi.h>
#include <linux/i2c.h>
#include <linux/jiffies.h>
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/of.h>
#include <linux/slab.h>

#define FSI_ENGID_I2C

#define I2C_DEFAULT_CLK_DIV

/* i2c registers */
#define I2C_FSI_FIFO
#define I2C_FSI_CMD
#define I2C_FSI_MODE
#define I2C_FSI_WATER_MARK
#define I2C_FSI_INT_MASK
#define I2C_FSI_INT_COND
#define I2C_FSI_OR_INT_MASK
#define I2C_FSI_INTS
#define I2C_FSI_AND_INT_MASK
#define I2C_FSI_STAT
#define I2C_FSI_RESET_I2C
#define I2C_FSI_ESTAT
#define I2C_FSI_RESET_ERR
#define I2C_FSI_RESID_LEN
#define I2C_FSI_SET_SCL
#define I2C_FSI_PORT_BUSY
#define I2C_FSI_RESET_SCL
#define I2C_FSI_SET_SDA
#define I2C_FSI_RESET_SDA

/* cmd register */
#define I2C_CMD_WITH_START
#define I2C_CMD_WITH_ADDR
#define I2C_CMD_RD_CONT
#define I2C_CMD_WITH_STOP
#define I2C_CMD_FORCELAUNCH
#define I2C_CMD_ADDR
#define I2C_CMD_READ
#define I2C_CMD_LEN

/* mode register */
#define I2C_MODE_CLKDIV
#define I2C_MODE_PORT
#define I2C_MODE_ENHANCED
#define I2C_MODE_DIAG
#define I2C_MODE_PACE_ALLOW
#define I2C_MODE_WRAP

/* watermark register */
#define I2C_WATERMARK_HI
#define I2C_WATERMARK_LO

#define I2C_FIFO_HI_LVL
#define I2C_FIFO_LO_LVL

/* interrupt register */
#define I2C_INT_INV_CMD
#define I2C_INT_PARITY
#define I2C_INT_BE_OVERRUN
#define I2C_INT_BE_ACCESS
#define I2C_INT_LOST_ARB
#define I2C_INT_NACK
#define I2C_INT_DAT_REQ
#define I2C_INT_CMD_COMP
#define I2C_INT_STOP_ERR
#define I2C_INT_BUSY
#define I2C_INT_IDLE

/* status register */
#define I2C_STAT_INV_CMD
#define I2C_STAT_PARITY
#define I2C_STAT_BE_OVERRUN
#define I2C_STAT_BE_ACCESS
#define I2C_STAT_LOST_ARB
#define I2C_STAT_NACK
#define I2C_STAT_DAT_REQ
#define I2C_STAT_CMD_COMP
#define I2C_STAT_STOP_ERR
#define I2C_STAT_MAX_PORT
#define I2C_STAT_ANY_INT
#define I2C_STAT_SCL_IN
#define I2C_STAT_SDA_IN
#define I2C_STAT_PORT_BUSY
#define I2C_STAT_SELF_BUSY
#define I2C_STAT_FIFO_COUNT

#define I2C_STAT_ERR
#define I2C_STAT_ANY_RESP

/* extended status register */
#define I2C_ESTAT_FIFO_SZ
#define I2C_ESTAT_SCL_IN_SY
#define I2C_ESTAT_SDA_IN_SY
#define I2C_ESTAT_S_SCL
#define I2C_ESTAT_S_SDA
#define I2C_ESTAT_M_SCL
#define I2C_ESTAT_M_SDA
#define I2C_ESTAT_HI_WATER
#define I2C_ESTAT_LO_WATER
#define I2C_ESTAT_PORT_BUSY
#define I2C_ESTAT_SELF_BUSY
#define I2C_ESTAT_VERSION

/* port busy register */
#define I2C_PORT_BUSY_RESET

/* wait for command complete or data request */
#define I2C_CMD_SLEEP_MAX_US
#define I2C_CMD_SLEEP_MIN_US

/* wait after reset; choose time from legacy driver */
#define I2C_RESET_SLEEP_MAX_US
#define I2C_RESET_SLEEP_MIN_US

/* choose timeout length from legacy driver; it's well tested */
#define I2C_ABORT_TIMEOUT

struct fsi_i2c_ctrl {};

struct fsi_i2c_port {};

static int fsi_i2c_read_reg(struct fsi_device *fsi, unsigned int reg,
			    u32 *data)
{}

static int fsi_i2c_write_reg(struct fsi_device *fsi, unsigned int reg,
			     u32 *data)
{}

static int fsi_i2c_dev_init(struct fsi_i2c_ctrl *i2c)
{}

static int fsi_i2c_set_port(struct fsi_i2c_port *port)
{}

static int fsi_i2c_start(struct fsi_i2c_port *port, struct i2c_msg *msg,
			 bool stop)
{}

static int fsi_i2c_get_op_bytes(int op_bytes)
{}

static int fsi_i2c_write_fifo(struct fsi_i2c_port *port, struct i2c_msg *msg,
			      u8 fifo_count)
{}

static int fsi_i2c_read_fifo(struct fsi_i2c_port *port, struct i2c_msg *msg,
			     u8 fifo_count)
{}

static int fsi_i2c_get_scl(struct i2c_adapter *adap)
{}

static void fsi_i2c_set_scl(struct i2c_adapter *adap, int val)
{}

static int fsi_i2c_get_sda(struct i2c_adapter *adap)
{}

static void fsi_i2c_set_sda(struct i2c_adapter *adap, int val)
{}

static void fsi_i2c_prepare_recovery(struct i2c_adapter *adap)
{}

static void fsi_i2c_unprepare_recovery(struct i2c_adapter *adap)
{}

static int fsi_i2c_reset_bus(struct fsi_i2c_ctrl *i2c,
			     struct fsi_i2c_port *port)
{}

static int fsi_i2c_reset_engine(struct fsi_i2c_ctrl *i2c, u16 port)
{}

static int fsi_i2c_abort(struct fsi_i2c_port *port, u32 status)
{}

static int fsi_i2c_handle_status(struct fsi_i2c_port *port,
				 struct i2c_msg *msg, u32 status)
{}

static int fsi_i2c_wait(struct fsi_i2c_port *port, struct i2c_msg *msg,
			unsigned long timeout)
{}

static int fsi_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
			int num)
{}

static u32 fsi_i2c_functionality(struct i2c_adapter *adap)
{}

static struct i2c_bus_recovery_info fsi_i2c_bus_recovery_info =;

static const struct i2c_algorithm fsi_i2c_algorithm =;

static struct device_node *fsi_i2c_find_port_of_node(struct device_node *fsi,
						     int port)
{}

static int fsi_i2c_probe(struct device *dev)
{}

static int fsi_i2c_remove(struct device *dev)
{}

static const struct fsi_device_id fsi_i2c_ids[] =;

static struct fsi_driver fsi_i2c_driver =;

module_fsi_driver();

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