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

// SPDX-License-Identifier: GPL-2.0-or-later
/*
    Copyright (c) 1999  Frodo Looijaard <[email protected]> and
    Philip Edelbrock <[email protected]> and
    Mark D. Studebaker <[email protected]>

*/

/*
    This is the driver for the SMB Host controller on
    Acer Labs Inc. (ALI) M1541 and M1543C South Bridges.

    The M1543C is a South bridge for desktop systems.
    The M1533 is a South bridge for portable systems.
    They are part of the following ALI chipsets:
       "Aladdin Pro 2": Includes the M1621 Slot 1 North bridge
       with AGP and 100MHz CPU Front Side bus
       "Aladdin V": Includes the M1541 Socket 7 North bridge
       with AGP and 100MHz CPU Front Side bus
       "Aladdin IV": Includes the M1541 Socket 7 North bridge
       with host bus up to 83.3 MHz.
    For an overview of these chips see http://www.acerlabs.com

    The M1533/M1543C devices appear as FOUR separate devices
    on the PCI bus. An output of lspci will show something similar
    to the following:

	00:02.0 USB Controller: Acer Laboratories Inc. M5237
	00:03.0 Bridge: Acer Laboratories Inc. M7101
	00:07.0 ISA bridge: Acer Laboratories Inc. M1533
	00:0f.0 IDE interface: Acer Laboratories Inc. M5229

    The SMB controller is part of the 7101 device, which is an
    ACPI-compliant Power Management Unit (PMU).

    The whole 7101 device has to be enabled for the SMB to work.
    You can't just enable the SMB alone.
    The SMB and the ACPI have separate I/O spaces.
    We make sure that the SMB is enabled. We leave the ACPI alone.

    This driver controls the SMB Host only.
    The SMB Target controller on the M15X3 is not enabled.

    This driver does not use interrupts.
*/

/* Note: we assume there can only be one ALI15X3, with one SMBus interface */

#include <linux/module.h>
#include <linux/pci.h>
#include <linux/kernel.h>
#include <linux/stddef.h>
#include <linux/ioport.h>
#include <linux/delay.h>
#include <linux/i2c.h>
#include <linux/acpi.h>
#include <linux/io.h>

/* ALI15X3 SMBus address offsets */
#define SMBHSTSTS
#define SMBHSTCNT
#define SMBHSTSTART
#define SMBHSTCMD
#define SMBHSTADD
#define SMBHSTDAT0
#define SMBHSTDAT1
#define SMBBLKDAT

/* PCI Address Constants */
#define SMBCOM
#define SMBBA
#define SMBATPC
#define SMBHSTCFG
#define SMBSLVC
#define SMBCLK
#define SMBREV

/* Other settings */
#define MAX_TIMEOUT
#define ALI15X3_SMB_IOSIZE

/* this is what the Award 1004 BIOS sets them to on a ASUS P5A MB.
   We don't use these here. If the bases aren't set to some value we
   tell user to upgrade BIOS and we fail.
*/
#define ALI15X3_SMB_DEFAULTBASE

/* ALI15X3 address lock bits */
#define ALI15X3_LOCK

/* ALI15X3 command constants */
#define ALI15X3_ABORT
#define ALI15X3_T_OUT
#define ALI15X3_QUICK
#define ALI15X3_BYTE
#define ALI15X3_BYTE_DATA
#define ALI15X3_WORD_DATA
#define ALI15X3_BLOCK_DATA
#define ALI15X3_BLOCK_CLR

/* ALI15X3 status register bits */
#define ALI15X3_STS_IDLE
#define ALI15X3_STS_BUSY
#define ALI15X3_STS_DONE
#define ALI15X3_STS_DEV
#define ALI15X3_STS_COLL
#define ALI15X3_STS_TERM
#define ALI15X3_STS_ERR


/* If force_addr is set to anything different from 0, we forcibly enable
   the device at the given address. */
static u16 force_addr;
module_param_hw(force_addr, ushort, ioport, 0);
MODULE_PARM_DESC();

static struct pci_driver ali15x3_driver;
static unsigned short ali15x3_smba;

static int ali15x3_setup(struct pci_dev *ALI15X3_dev)
{}

/* Another internally used function */
static int ali15x3_transaction(struct i2c_adapter *adap)
{}

/* Return negative errno on error. */
static s32 ali15x3_access(struct i2c_adapter * adap, u16 addr,
		   unsigned short flags, char read_write, u8 command,
		   int size, union i2c_smbus_data * data)
{}

static u32 ali15x3_func(struct i2c_adapter *adapter)
{}

static const struct i2c_algorithm smbus_algorithm =;

static struct i2c_adapter ali15x3_adapter =;

static const struct pci_device_id ali15x3_ids[] =;

MODULE_DEVICE_TABLE (pci, ali15x3_ids);

static int ali15x3_probe(struct pci_dev *dev, const struct pci_device_id *id)
{}

static void ali15x3_remove(struct pci_dev *dev)
{}

static struct pci_driver ali15x3_driver =;

module_pci_driver();

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