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

// SPDX-License-Identifier: GPL-2.0-only
/*
 * I2C bus driver for Amlogic Meson SoCs
 *
 * Copyright (C) 2014 Beniamino Galvani <[email protected]>
 */

#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/iopoll.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/types.h>

/* Meson I2C register map */
#define REG_CTRL
#define REG_SLAVE_ADDR
#define REG_TOK_LIST0
#define REG_TOK_LIST1
#define REG_TOK_WDATA0
#define REG_TOK_WDATA1
#define REG_TOK_RDATA0
#define REG_TOK_RDATA1

/* Control register fields */
#define REG_CTRL_START
#define REG_CTRL_ACK_IGNORE
#define REG_CTRL_STATUS
#define REG_CTRL_ERROR
#define REG_CTRL_CLKDIV_SHIFT
#define REG_CTRL_CLKDIV_MASK
#define REG_CTRL_CLKDIVEXT_SHIFT
#define REG_CTRL_CLKDIVEXT_MASK

#define REG_SLV_ADDR_MASK
#define REG_SLV_SDA_FILTER_MASK
#define REG_SLV_SCL_FILTER_MASK
#define REG_SLV_SCL_LOW_SHIFT
#define REG_SLV_SCL_LOW_MASK
#define REG_SLV_SCL_LOW_EN

#define I2C_TIMEOUT_MS
#define FILTER_DELAY

enum {};

enum {};

/**
 * struct meson_i2c - Meson I2C device private data
 *
 * @adap:	I2C adapter instance
 * @dev:	Pointer to device structure
 * @regs:	Base address of the device memory mapped registers
 * @clk:	Pointer to clock structure
 * @msg:	Pointer to the current I2C message
 * @state:	Current state in the driver state machine
 * @last:	Flag set for the last message in the transfer
 * @count:	Number of bytes to be sent/received in current transfer
 * @pos:	Current position in the send/receive buffer
 * @error:	Flag set when an error is received
 * @lock:	To avoid race conditions between irq handler and xfer code
 * @done:	Completion used to wait for transfer termination
 * @tokens:	Sequence of tokens to be written to the device
 * @num_tokens:	Number of tokens
 * @data:	Pointer to the controller's platform data
 */
struct meson_i2c {};

struct meson_i2c_data {};

static void meson_i2c_set_mask(struct meson_i2c *i2c, int reg, u32 mask,
			       u32 val)
{}

static void meson_i2c_reset_tokens(struct meson_i2c *i2c)
{}

static void meson_i2c_add_token(struct meson_i2c *i2c, int token)
{}

static void meson_gxbb_axg_i2c_set_clk_div(struct meson_i2c *i2c, unsigned int freq)
{}

static void meson6_i2c_set_clk_div(struct meson_i2c *i2c, unsigned int freq)
{}

static void meson_i2c_get_data(struct meson_i2c *i2c, char *buf, int len)
{}

static void meson_i2c_put_data(struct meson_i2c *i2c, char *buf, int len)
{}

static void meson_i2c_prepare_xfer(struct meson_i2c *i2c)
{}

static void meson_i2c_transfer_complete(struct meson_i2c *i2c, u32 ctrl)
{}

static irqreturn_t meson_i2c_irq(int irqno, void *dev_id)
{}

static void meson_i2c_do_start(struct meson_i2c *i2c, struct i2c_msg *msg)
{}

static int meson_i2c_xfer_msg(struct meson_i2c *i2c, struct i2c_msg *msg,
			      int last, bool atomic)
{}

static int meson_i2c_xfer_messages(struct i2c_adapter *adap,
				   struct i2c_msg *msgs, int num, bool atomic)
{}

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

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

static u32 meson_i2c_func(struct i2c_adapter *adap)
{}

static const struct i2c_algorithm meson_i2c_algorithm =;

static int meson_i2c_probe(struct platform_device *pdev)
{}

static void meson_i2c_remove(struct platform_device *pdev)
{}

static const struct meson_i2c_data i2c_meson6_data =;

static const struct meson_i2c_data i2c_gxbb_data =;

static const struct meson_i2c_data i2c_axg_data =;

static const struct of_device_id meson_i2c_match[] =;

MODULE_DEVICE_TABLE(of, meson_i2c_match);

static struct platform_driver meson_i2c_driver =;

module_platform_driver();

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