linux/drivers/media/pci/cobalt/cobalt-i2c.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 *  cobalt I2C functions
 *
 *  Derived from cx18-i2c.c
 *
 *  Copyright 2012-2015 Cisco Systems, Inc. and/or its affiliates.
 *  All rights reserved.
 */

#include "cobalt-driver.h"
#include "cobalt-i2c.h"

struct cobalt_i2c_regs {};

/* CTR[7:0] - Control register */

/* I2C Core enable bit */
#define M00018_CTR_BITMAP_EN_MSK

/* I2C Core interrupt enable bit */
#define M00018_CTR_BITMAP_IEN_MSK

/* CR[7:0] - Command register */

/* I2C start condition */
#define M00018_CR_BITMAP_STA_MSK

/* I2C stop condition */
#define M00018_CR_BITMAP_STO_MSK

/* I2C read from slave */
#define M00018_CR_BITMAP_RD_MSK

/* I2C write to slave */
#define M00018_CR_BITMAP_WR_MSK

/* I2C ack */
#define M00018_CR_BITMAP_ACK_MSK

/* I2C Interrupt ack */
#define M00018_CR_BITMAP_IACK_MSK

/* SR[7:0] - Status register */

/* Receive acknowledge from slave */
#define M00018_SR_BITMAP_RXACK_MSK

/* Busy, I2C bus busy (as defined by start / stop bits) */
#define M00018_SR_BITMAP_BUSY_MSK

/* Arbitration lost - core lost arbitration */
#define M00018_SR_BITMAP_AL_MSK

/* Transfer in progress */
#define M00018_SR_BITMAP_TIP_MSK

/* Interrupt flag */
#define M00018_SR_BITMAP_IF_MSK

/* Frequency, in Hz */
#define I2C_FREQUENCY
#define ALT_CPU_FREQ

static struct cobalt_i2c_regs __iomem *
cobalt_i2c_regs(struct cobalt *cobalt, unsigned idx)
{}

/* Do low-level i2c byte transfer.
 * Returns -1 in case of an error or 0 otherwise.
 */
static int cobalt_tx_bytes(struct cobalt_i2c_regs __iomem *regs,
		struct i2c_adapter *adap, bool start, bool stop,
		u8 *data, u16 len)
{}

/* Do low-level i2c byte read.
 * Returns -1 in case of an error or 0 otherwise.
 */
static int cobalt_rx_bytes(struct cobalt_i2c_regs __iomem *regs,
		struct i2c_adapter *adap, bool start, bool stop,
		u8 *data, u16 len)
{}

/* Generate stop condition on i2c bus.
 * The m00018 stop isn't doing the right thing (wrong timing).
 * So instead send a start condition, 8 zeroes and a stop condition.
 */
static int cobalt_stop(struct cobalt_i2c_regs __iomem *regs,
		struct i2c_adapter *adap)
{}

static int cobalt_xfer(struct i2c_adapter *adap,
			struct i2c_msg msgs[], int num)
{}

static u32 cobalt_func(struct i2c_adapter *adap)
{}

/* template for i2c-bit-algo */
static const struct i2c_adapter cobalt_i2c_adap_template =;

static const struct i2c_algorithm cobalt_algo =;

/* init + register i2c algo-bit adapter */
int cobalt_i2c_init(struct cobalt *cobalt)
{}

void cobalt_i2c_exit(struct cobalt *cobalt)
{}