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

// SPDX-License-Identifier: GPL-2.0-only
/*
 *  Copyright Intel Corporation (C) 2017.
 *
 * Based on the i2c-axxia.c driver.
 */
#include <linux/clk.h>
#include <linux/clkdev.h>
#include <linux/err.h>
#include <linux/i2c.h>
#include <linux/iopoll.h>
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/io.h>
#include <linux/kernel.h>
#include <linux/platform_device.h>

#define ALTR_I2C_TFR_CMD
#define ALTR_I2C_TFR_CMD_STA
#define ALTR_I2C_TFR_CMD_STO
#define ALTR_I2C_TFR_CMD_RW_D
#define ALTR_I2C_RX_DATA
#define ALTR_I2C_CTRL
#define ALTR_I2C_CTRL_RXT_SHFT
#define ALTR_I2C_CTRL_TCT_SHFT
#define ALTR_I2C_CTRL_BSPEED
#define ALTR_I2C_CTRL_EN
#define ALTR_I2C_ISER
#define ALTR_I2C_ISER_RXOF_EN
#define ALTR_I2C_ISER_ARB_EN
#define ALTR_I2C_ISER_NACK_EN
#define ALTR_I2C_ISER_RXRDY_EN
#define ALTR_I2C_ISER_TXRDY_EN
#define ALTR_I2C_ISR
#define ALTR_I2C_ISR_RXOF
#define ALTR_I2C_ISR_ARB
#define ALTR_I2C_ISR_NACK
#define ALTR_I2C_ISR_RXRDY
#define ALTR_I2C_ISR_TXRDY
#define ALTR_I2C_STATUS
#define ALTR_I2C_STAT_CORE
#define ALTR_I2C_TC_FIFO_LVL
#define ALTR_I2C_RX_FIFO_LVL
#define ALTR_I2C_SCL_LOW
#define ALTR_I2C_SCL_HIGH
#define ALTR_I2C_SDA_HOLD

#define ALTR_I2C_ALL_IRQ

#define ALTR_I2C_THRESHOLD
#define ALTR_I2C_DFLT_FIFO_SZ
#define ALTR_I2C_TIMEOUT
#define ALTR_I2C_XFER_TIMEOUT

/**
 * struct altr_i2c_dev - I2C device context
 * @base: pointer to register struct
 * @msg: pointer to current message
 * @msg_len: number of bytes transferred in msg
 * @msg_err: error code for completed message
 * @msg_complete: xfer completion object
 * @dev: device reference
 * @adapter: core i2c abstraction
 * @i2c_clk: clock reference for i2c input clock
 * @bus_clk_rate: current i2c bus clock rate
 * @buf: ptr to msg buffer for easier use.
 * @fifo_size: size of the FIFO passed in.
 * @isr_mask: cached copy of local ISR enables.
 * @isr_status: cached copy of local ISR status.
 * @isr_mutex: mutex for IRQ thread.
 */
struct altr_i2c_dev {};

static void
altr_i2c_int_enable(struct altr_i2c_dev *idev, u32 mask, bool enable)
{}

static void altr_i2c_int_clear(struct altr_i2c_dev *idev, u32 mask)
{}

static void altr_i2c_core_disable(struct altr_i2c_dev *idev)
{}

static void altr_i2c_core_enable(struct altr_i2c_dev *idev)
{}

static void altr_i2c_reset(struct altr_i2c_dev *idev)
{}

static inline void altr_i2c_stop(struct altr_i2c_dev *idev)
{}

static void altr_i2c_init(struct altr_i2c_dev *idev)
{}

/*
 * altr_i2c_transfer - On the last byte to be transmitted, send
 * a Stop bit on the last byte.
 */
static void altr_i2c_transfer(struct altr_i2c_dev *idev, u32 data)
{}

/*
 * altr_i2c_empty_rx_fifo - Fetch data from RX FIFO until end of
 * transfer. Send a Stop bit on the last byte.
 */
static void altr_i2c_empty_rx_fifo(struct altr_i2c_dev *idev)
{}

/*
 * altr_i2c_fill_tx_fifo - Fill TX FIFO from current message buffer.
 */
static int altr_i2c_fill_tx_fifo(struct altr_i2c_dev *idev)
{}

static irqreturn_t altr_i2c_isr_quick(int irq, void *_dev)
{}

static irqreturn_t altr_i2c_isr(int irq, void *_dev)
{}

static int altr_i2c_xfer_msg(struct altr_i2c_dev *idev, struct i2c_msg *msg)
{}

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

static u32 altr_i2c_func(struct i2c_adapter *adap)
{}

static const struct i2c_algorithm altr_i2c_algo =;

static int altr_i2c_probe(struct platform_device *pdev)
{}

static void altr_i2c_remove(struct platform_device *pdev)
{}

/* Match table for of_platform binding */
static const struct of_device_id altr_i2c_of_match[] =;
MODULE_DEVICE_TABLE(of, altr_i2c_of_match);

static struct platform_driver altr_i2c_driver =;

module_platform_driver();

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