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

// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
/*
 * Mellanox i2c driver
 *
 * Copyright (C) 2016-2020 Mellanox Technologies
 */

#include <linux/delay.h>
#include <linux/i2c.h>
#include <linux/init.h>
#include <linux/io.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/platform_data/mlxreg.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>

/* General defines */
#define MLXPLAT_CPLD_LPC_I2C_BASE_ADDR
#define MLXCPLD_I2C_DEVICE_NAME
#define MLXCPLD_I2C_VALID_FLAG
#define MLXCPLD_I2C_BUS_NUM
#define MLXCPLD_I2C_DATA_REG_SZ
#define MLXCPLD_I2C_DATA_SZ_BIT
#define MLXCPLD_I2C_DATA_EXT2_SZ_BIT
#define MLXCPLD_I2C_DATA_SZ_MASK
#define MLXCPLD_I2C_SMBUS_BLK_BIT
#define MLXCPLD_I2C_MAX_ADDR_LEN
#define MLXCPLD_I2C_RETR_NUM
#define MLXCPLD_I2C_XFER_TO
#define MLXCPLD_I2C_POLL_TIME

/* LPC I2C registers */
#define MLXCPLD_LPCI2C_CPBLTY_REG
#define MLXCPLD_LPCI2C_CTRL_REG
#define MLXCPLD_LPCI2C_HALF_CYC_REG
#define MLXCPLD_LPCI2C_I2C_HOLD_REG
#define MLXCPLD_LPCI2C_CMD_REG
#define MLXCPLD_LPCI2C_NUM_DAT_REG
#define MLXCPLD_LPCI2C_NUM_ADDR_REG
#define MLXCPLD_LPCI2C_STATUS_REG
#define MLXCPLD_LPCI2C_DATA_REG

/* LPC I2C masks and parameters */
#define MLXCPLD_LPCI2C_RST_SEL_MASK
#define MLXCPLD_LPCI2C_TRANS_END
#define MLXCPLD_LPCI2C_STATUS_NACK
#define MLXCPLD_LPCI2C_NO_IND
#define MLXCPLD_LPCI2C_ACK_IND
#define MLXCPLD_LPCI2C_NACK_IND

#define MLXCPLD_I2C_FREQ_1000KHZ_SET
#define MLXCPLD_I2C_FREQ_400KHZ_SET
#define MLXCPLD_I2C_FREQ_100KHZ_SET

enum mlxcpld_i2c_frequency {};

struct  mlxcpld_i2c_curr_xfer {};

struct mlxcpld_i2c_priv {};

static void mlxcpld_i2c_lpc_write_buf(u8 *data, u8 len, u32 addr)
{}

static void mlxcpld_i2c_lpc_read_buf(u8 *data, u8 len, u32 addr)
{}

static void mlxcpld_i2c_read_comm(struct mlxcpld_i2c_priv *priv, u8 offs,
				  u8 *data, u8 datalen)
{}

static void mlxcpld_i2c_write_comm(struct mlxcpld_i2c_priv *priv, u8 offs,
				   u8 *data, u8 datalen)
{}

/*
 * Check validity of received i2c messages parameters.
 * Returns 0 if OK, other - in case of invalid parameters.
 */
static int mlxcpld_i2c_check_msg_params(struct mlxcpld_i2c_priv *priv,
					struct i2c_msg *msgs, int num)
{}

/*
 * Check if transfer is completed and status of operation.
 * Returns 0 - transfer completed (both ACK or NACK),
 * negative - transfer isn't finished.
 */
static int mlxcpld_i2c_check_status(struct mlxcpld_i2c_priv *priv, int *status)
{}

static void mlxcpld_i2c_set_transf_data(struct mlxcpld_i2c_priv *priv,
					struct i2c_msg *msgs, int num,
					u8 comm_len)
{}

/* Reset CPLD LPCI2C block */
static void mlxcpld_i2c_reset(struct mlxcpld_i2c_priv *priv)
{}

/* Make sure the CPLD is ready to start transmitting. */
static int mlxcpld_i2c_check_busy(struct mlxcpld_i2c_priv *priv)
{}

static int mlxcpld_i2c_wait_for_free(struct mlxcpld_i2c_priv *priv)
{}

/*
 * Wait for transfer to complete.
 * It puts current process to sleep until we get interrupt or timeout expires.
 * Returns the number of transferred or read bytes or error (<0).
 */
static int mlxcpld_i2c_wait_for_tc(struct mlxcpld_i2c_priv *priv)
{}

static void mlxcpld_i2c_xfer_msg(struct mlxcpld_i2c_priv *priv)
{}

/*
 * Generic lpc-i2c transfer.
 * Returns the number of processed messages or error (<0).
 */
static int mlxcpld_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
			    int num)
{}

static u32 mlxcpld_i2c_func(struct i2c_adapter *adap)
{}

static const struct i2c_algorithm mlxcpld_i2c_algo =;

static const struct i2c_adapter_quirks mlxcpld_i2c_quirks =;

static const struct i2c_adapter_quirks mlxcpld_i2c_quirks_ext =;

static const struct i2c_adapter_quirks mlxcpld_i2c_quirks_ext2 =;

static struct i2c_adapter mlxcpld_i2c_adapter =;

static int
mlxcpld_i2c_set_frequency(struct mlxcpld_i2c_priv *priv,
			  struct mlxreg_core_hotplug_platform_data *pdata)
{}

static int mlxcpld_i2c_probe(struct platform_device *pdev)
{}

static void mlxcpld_i2c_remove(struct platform_device *pdev)
{}

static struct platform_driver mlxcpld_i2c_driver =;

module_platform_driver();

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