linux/drivers/i2c/busses/i2c-sun6i-p2wi.c

/*
 * P2WI (Push-Pull Two Wire Interface) bus driver.
 *
 * Author: Boris BREZILLON <[email protected]>
 *
 * This file is licensed under the terms of the GNU General Public License
 * version 2.  This program is licensed "as is" without any warranty of any
 * kind, whether express or implied.
 *
 * The P2WI controller looks like an SMBus controller which only supports byte
 * data transfers. But, it differs from standard SMBus protocol on several
 * aspects:
 * - it supports only one target device, and thus drop the address field
 * - it adds a parity bit every 8bits of data
 * - only one read access is required to read a byte (instead of a write
 *   followed by a read access in standard SMBus protocol)
 * - there's no Ack bit after each byte transfer
 *
 * This means this bus cannot be used to interface with standard SMBus
 * devices (the only known device to support this interface is the AXP221
 * PMIC).
 *
 */
#include <linux/clk.h>
#include <linux/i2c.h>
#include <linux/io.h>
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/reset.h>


/* P2WI registers */
#define P2WI_CTRL
#define P2WI_CCR
#define P2WI_INTE
#define P2WI_INTS
#define P2WI_DADDR0
#define P2WI_DADDR1
#define P2WI_DLEN
#define P2WI_DATA0
#define P2WI_DATA1
#define P2WI_LCR
#define P2WI_PMCR

/* CTRL fields */
#define P2WI_CTRL_START_TRANS
#define P2WI_CTRL_ABORT_TRANS
#define P2WI_CTRL_GLOBAL_INT_ENB
#define P2WI_CTRL_SOFT_RST

/* CLK CTRL fields */
#define P2WI_CCR_SDA_OUT_DELAY(v)
#define P2WI_CCR_MAX_CLK_DIV
#define P2WI_CCR_CLK_DIV(v)

/* STATUS fields */
#define P2WI_INTS_TRANS_ERR_ID(v)
#define P2WI_INTS_LOAD_BSY
#define P2WI_INTS_TRANS_ERR
#define P2WI_INTS_TRANS_OVER

/* DATA LENGTH fields*/
#define P2WI_DLEN_READ
#define P2WI_DLEN_DATA_LENGTH(v)

/* LINE CTRL fields*/
#define P2WI_LCR_SCL_STATE
#define P2WI_LCR_SDA_STATE
#define P2WI_LCR_SCL_CTL
#define P2WI_LCR_SCL_CTL_EN
#define P2WI_LCR_SDA_CTL
#define P2WI_LCR_SDA_CTL_EN

/* PMU MODE CTRL fields */
#define P2WI_PMCR_PMU_INIT_SEND
#define P2WI_PMCR_PMU_INIT_DATA(v)
#define P2WI_PMCR_PMU_MODE_REG(v)
#define P2WI_PMCR_PMU_DEV_ADDR(v)

#define P2WI_MAX_FREQ

struct p2wi {};

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

static u32 p2wi_functionality(struct i2c_adapter *adap)
{}

static int p2wi_smbus_xfer(struct i2c_adapter *adap, u16 addr,
			   unsigned short flags, char read_write,
			   u8 command, int size, union i2c_smbus_data *data)
{}

static const struct i2c_algorithm p2wi_algo =;

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

static int p2wi_probe(struct platform_device *pdev)
{}

static void p2wi_remove(struct platform_device *dev)
{}

static struct platform_driver p2wi_driver =;
module_platform_driver();

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