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

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Loongson-2K/Loongson LS7A I2C controller mode driver
 *
 * Copyright (C) 2013 Loongson Technology Corporation Limited.
 * Copyright (C) 2014-2017 Lemote, Inc.
 * Copyright (C) 2018-2022 Loongson Technology Corporation Limited.
 *
 * Originally written by liushaozong
 * Rewritten for mainline by Binbin Zhou <[email protected]>
 */

#include <linux/bits.h>
#include <linux/completion.h>
#include <linux/device.h>
#include <linux/iopoll.h>
#include <linux/i2c.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/pm_runtime.h>
#include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/units.h>

/* I2C Registers */
#define I2C_LS2X_PRER
#define I2C_LS2X_CTR
#define I2C_LS2X_TXR
#define I2C_LS2X_RXR
#define I2C_LS2X_CR
#define I2C_LS2X_SR

/* Command Control Register Bit */
#define LS2X_CR_START
#define LS2X_CR_STOP
#define LS2X_CR_READ
#define LS2X_CR_WRITE
#define LS2X_CR_ACK
#define LS2X_CR_IACK

/* State Register Bit */
#define LS2X_SR_NOACK
#define LS2X_SR_BUSY
#define LS2X_SR_AL
#define LS2X_SR_TIP
#define LS2X_SR_IF

/* Control Register Bit */
#define LS2X_CTR_EN
#define LS2X_CTR_IEN
#define LS2X_CTR_MST
#define CTR_FREQ_MASK
#define CTR_READY_MASK

/* The PCLK frequency from LPB */
#define LS2X_I2C_PCLK_FREQ

/* The default bus frequency, which is an empirical value */
#define LS2X_I2C_FREQ_STD

struct ls2x_i2c_priv {};

/*
 * Interrupt service routine.
 * This gets called whenever an I2C interrupt occurs.
 */
static irqreturn_t ls2x_i2c_isr(int this_irq, void *dev_id)
{}

/*
 * The ls2x i2c controller supports standard mode and fast mode, so the
 * maximum bus frequency is '400kHz'.
 * The bus frequency is set to the empirical value of '33KHz' by default,
 * but it can also be taken from ACPI or FDT for compatibility with more
 * devices.
 */
static void ls2x_i2c_adjust_bus_speed(struct ls2x_i2c_priv *priv)
{}

static void ls2x_i2c_init(struct ls2x_i2c_priv *priv)
{}

static int ls2x_i2c_xfer_byte(struct ls2x_i2c_priv *priv, u8 txdata, u8 *rxdatap)
{}

static int ls2x_i2c_send_byte(struct ls2x_i2c_priv *priv, u8 txdata)
{}

static int ls2x_i2c_stop(struct ls2x_i2c_priv *priv)
{}

static int ls2x_i2c_start(struct ls2x_i2c_priv *priv, struct i2c_msg *msgs)
{}

static int ls2x_i2c_rx(struct ls2x_i2c_priv *priv, struct i2c_msg *msg)
{}

static int ls2x_i2c_tx(struct ls2x_i2c_priv *priv, struct i2c_msg *msg)
{}

static int ls2x_i2c_xfer_one(struct ls2x_i2c_priv *priv,
			     struct i2c_msg *msg, bool stop)
{}

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

static unsigned int ls2x_i2c_func(struct i2c_adapter *adap)
{}

static const struct i2c_algorithm ls2x_i2c_algo =;

static int ls2x_i2c_probe(struct platform_device *pdev)
{}

static int ls2x_i2c_suspend(struct device *dev)
{}

static int ls2x_i2c_resume(struct device *dev)
{}

static DEFINE_RUNTIME_DEV_PM_OPS(ls2x_i2c_pm_ops,
				 ls2x_i2c_suspend, ls2x_i2c_resume, NULL);

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

static const struct acpi_device_id ls2x_i2c_acpi_match[] =;
MODULE_DEVICE_TABLE(acpi, ls2x_i2c_acpi_match);

static struct platform_driver ls2x_i2c_driver =;
module_platform_driver();

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