Commit 2511765d authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://kernel.bkbits.net/gregkh/linux/pci-2.5

into home.transmeta.com:/home/torvalds/v2.5/linux
parents d0b8a5c0 7cd612a0
...@@ -42,6 +42,26 @@ config I2C_ALGOBIT ...@@ -42,6 +42,26 @@ config I2C_ALGOBIT
<file:Documentation/modules.txt>. <file:Documentation/modules.txt>.
The module will be called i2c-algo-bit. The module will be called i2c-algo-bit.
config I2C_PROSAVAGE
tristate "S3/VIA (Pro)Savage"
depends on I2C_ALGOBIT && PCI && EXPERIMENTAL
help
If you say yes to this option, support will be included for the
I2C bus and DDC bus of the S3VIA embedded Savage4 and ProSavage8
graphics processors.
chipsets supported:
S3/VIA KM266/VT8375 aka ProSavage8
S3/VIA KM133/VT8365 aka Savage4
This can also be built as a module which can be inserted and removed
while the kernel is running. If you want to compile it as a module,
say M here and read <file:Documentation/modules.txt>.
The module will be called i2c-prosavage.
You will also need the latest user-space utilties: you can find them
in the lm_sensors package, which you can download at
http://www.lm-sensors.nu
config I2C_PHILIPSPAR config I2C_PHILIPSPAR
tristate "Philips style parallel port adapter" tristate "Philips style parallel port adapter"
depends on I2C_ALGOBIT && PARPORT depends on I2C_ALGOBIT && PARPORT
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
obj-$(CONFIG_I2C) += i2c-core.o obj-$(CONFIG_I2C) += i2c-core.o
obj-$(CONFIG_I2C_CHARDEV) += i2c-dev.o obj-$(CONFIG_I2C_CHARDEV) += i2c-dev.o
obj-$(CONFIG_I2C_ALGOBIT) += i2c-algo-bit.o obj-$(CONFIG_I2C_ALGOBIT) += i2c-algo-bit.o
obj-$(CONFIG_I2C_PROSAVAGE) += i2c-prosavage.o
obj-$(CONFIG_I2C_PHILIPSPAR) += i2c-philips-par.o obj-$(CONFIG_I2C_PHILIPSPAR) += i2c-philips-par.o
obj-$(CONFIG_I2C_ELV) += i2c-elv.o obj-$(CONFIG_I2C_ELV) += i2c-elv.o
obj-$(CONFIG_I2C_VELLEMAN) += i2c-velleman.o obj-$(CONFIG_I2C_VELLEMAN) += i2c-velleman.o
......
...@@ -4,6 +4,22 @@ ...@@ -4,6 +4,22 @@
menu "I2C Hardware Sensors Mainboard support" menu "I2C Hardware Sensors Mainboard support"
config I2C_ALI1535
tristate " ALI 1535"
depends on I2C && PCI && EXPERIMENTAL
help
If you say yes to this option, support will be included for the SMB
Host controller on Acer Labs Inc. (ALI) M1535 South Bridges. The SMB
controller is part of the 7101 device, which is an ACPI-compliant
Power Management Unit (PMU).
This can also be built as a module. If so, the module will be
called i2c-ali1535.
You will also need the latest user-space utilties: you can find them
in the lm_sensors package, which you can download at
http://www.lm-sensors.nu
config I2C_ALI15X3 config I2C_ALI15X3
tristate " ALI 15x3" tristate " ALI 15x3"
depends on I2C && PCI && EXPERIMENTAL depends on I2C && PCI && EXPERIMENTAL
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
# Makefile for the kernel hardware sensors bus drivers. # Makefile for the kernel hardware sensors bus drivers.
# #
obj-$(CONFIG_I2C_ALI1535) += i2c-ali1535.o
obj-$(CONFIG_I2C_ALI15X3) += i2c-ali15x3.o obj-$(CONFIG_I2C_ALI15X3) += i2c-ali15x3.o
obj-$(CONFIG_I2C_AMD756) += i2c-amd756.o obj-$(CONFIG_I2C_AMD756) += i2c-amd756.o
obj-$(CONFIG_I2C_AMD8111) += i2c-amd8111.o obj-$(CONFIG_I2C_AMD8111) += i2c-amd8111.o
......
/*
i2c-ali1535.c - Part of lm_sensors, Linux kernel modules for hardware
monitoring
Copyright (c) 2000 Frodo Looijaard <frodol@dds.nl>,
Philip Edelbrock <phil@netroedge.com>,
Mark D. Studebaker <mdsxyz123@yahoo.com>,
Dan Eaton <dan.eaton@rocketlogix.com> and
Stephen Rousset<stephen.rousset@rocketlogix.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
This is the driver for the SMB Host controller on
Acer Labs Inc. (ALI) M1535 South Bridge.
The M1535 is a South bridge for portable systems.
It is very similar to the M15x3 South bridges also produced
by Acer Labs Inc. Some of the registers within the part
have moved and some have been redefined slightly. Additionally,
the sequencing of the SMBus transactions has been modified
to be more consistent with the sequencing recommended by
the manufacturer and observed through testing. These
changes are reflected in this driver and can be identified
by comparing this driver to the i2c-ali15x3 driver.
For an overview of these chips see http://www.acerlabs.com
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.
This driver does not use interrupts.
*/
/* Note: we assume there can only be one ALI1535, with one SMBus interface */
/* #define DEBUG 1 */
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/kernel.h>
#include <linux/stddef.h>
#include <linux/sched.h>
#include <linux/ioport.h>
#include <linux/i2c.h>
#include <linux/init.h>
#include <asm/io.h>
#include <asm/semaphore.h>
/* ALI1535 SMBus address offsets */
#define SMBHSTSTS (0 + ali1535_smba)
#define SMBHSTTYP (1 + ali1535_smba)
#define SMBHSTPORT (2 + ali1535_smba)
#define SMBHSTCMD (7 + ali1535_smba)
#define SMBHSTADD (3 + ali1535_smba)
#define SMBHSTDAT0 (4 + ali1535_smba)
#define SMBHSTDAT1 (5 + ali1535_smba)
#define SMBBLKDAT (6 + ali1535_smba)
/* PCI Address Constants */
#define SMBCOM 0x004
#define SMBREV 0x008
#define SMBCFG 0x0D1
#define SMBBA 0x0E2
#define SMBHSTCFG 0x0F0
#define SMBCLK 0x0F2
/* Other settings */
#define MAX_TIMEOUT 500 /* times 1/100 sec */
#define ALI1535_SMB_IOSIZE 32
#define ALI1535_SMB_DEFAULTBASE 0x8040
/* ALI1535 address lock bits */
#define ALI1535_LOCK 0x06 /* dwe */
/* ALI1535 command constants */
#define ALI1535_QUICK 0x00
#define ALI1535_BYTE 0x10
#define ALI1535_BYTE_DATA 0x20
#define ALI1535_WORD_DATA 0x30
#define ALI1535_BLOCK_DATA 0x40
#define ALI1535_I2C_READ 0x60
#define ALI1535_DEV10B_EN 0x80 /* Enable 10-bit addressing in */
/* I2C read */
#define ALI1535_T_OUT 0x08 /* Time-out Command (write) */
#define ALI1535_A_HIGH_BIT9 0x08 /* Bit 9 of 10-bit address in */
/* Alert-Response-Address */
/* (read) */
#define ALI1535_KILL 0x04 /* Kill Command (write) */
#define ALI1535_A_HIGH_BIT8 0x04 /* Bit 8 of 10-bit address in */
/* Alert-Response-Address */
/* (read) */
#define ALI1535_D_HI_MASK 0x03 /* Mask for isolating bits 9-8 */
/* of 10-bit address in I2C */
/* Read Command */
/* ALI1535 status register bits */
#define ALI1535_STS_IDLE 0x04
#define ALI1535_STS_BUSY 0x08 /* host busy */
#define ALI1535_STS_DONE 0x10 /* transaction complete */
#define ALI1535_STS_DEV 0x20 /* device error */
#define ALI1535_STS_BUSERR 0x40 /* bus error */
#define ALI1535_STS_FAIL 0x80 /* failed bus transaction */
#define ALI1535_STS_ERR 0xE0 /* all the bad error bits */
#define ALI1535_BLOCK_CLR 0x04 /* reset block data index */
/* ALI1535 device address register bits */
#define ALI1535_RD_ADDR 0x01 /* Read/Write Bit in Device */
/* Address field */
/* -> Write = 0 */
/* -> Read = 1 */
#define ALI1535_SMBIO_EN 0x04 /* SMB I/O Space enable */
static unsigned short ali1535_smba;
DECLARE_MUTEX(i2c_ali1535_sem);
/* Detect whether a ALI1535 can be found, and initialize it, where necessary.
Note the differences between kernels with the old PCI BIOS interface and
newer kernels with the real PCI interface. In compat.h some things are
defined to make the transition easier. */
static int ali1535_setup(struct pci_dev *dev)
{
int retval = -ENODEV;
unsigned char temp;
/* Check the following things:
- SMB I/O address is initialized
- Device is enabled
- We can use the addresses
*/
/* Determine the address of the SMBus area */
pci_read_config_word(dev, SMBBA, &ali1535_smba);
ali1535_smba &= (0xffff & ~(ALI1535_SMB_IOSIZE - 1));
if (ali1535_smba == 0) {
dev_warn(&dev->dev,
"ALI1535_smb region uninitialized - upgrade BIOS?\n");
goto exit;
}
if (!request_region(ali1535_smba, ALI1535_SMB_IOSIZE, "ali1535-smb")) {
dev_err(&dev->dev, "ALI1535_smb region 0x%x already in use!\n",
ali1535_smba);
goto exit;
}
/* check if whole device is enabled */
pci_read_config_byte(dev, SMBCFG, &temp);
if ((temp & ALI1535_SMBIO_EN) == 0) {
dev_err(&dev->dev, "SMB device not enabled - upgrade BIOS?\n");
goto exit_free;
}
/* Is SMB Host controller enabled? */
pci_read_config_byte(dev, SMBHSTCFG, &temp);
if ((temp & 1) == 0) {
dev_err(&dev->dev, "SMBus controller not enabled - upgrade BIOS?\n");
goto exit_free;
}
/* set SMB clock to 74KHz as recommended in data sheet */
pci_write_config_byte(dev, SMBCLK, 0x20);
/*
The interrupt routing for SMB is set up in register 0x77 in the
1533 ISA Bridge device, NOT in the 7101 device.
Don't bother with finding the 1533 device and reading the register.
if ((....... & 0x0F) == 1)
dev_dbg(&dev->dev, "ALI1535 using Interrupt 9 for SMBus.\n");
*/
pci_read_config_byte(dev, SMBREV, &temp);
dev_dbg(&dev->dev, "SMBREV = 0x%X\n", temp);
dev_dbg(&dev->dev, "ALI1535_smba = 0x%X\n", ali1535_smba);
retval = 0;
exit:
return retval;
exit_free:
release_region(ali1535_smba, ALI1535_SMB_IOSIZE);
return retval;
}
static void ali1535_do_pause(unsigned int amount)
{
current->state = TASK_INTERRUPTIBLE;
schedule_timeout(amount);
}
static int ali1535_transaction(struct i2c_adapter *adap)
{
int temp;
int result = 0;
int timeout = 0;
dev_dbg(&adap->dev, "Transaction (pre): STS=%02x, TYP=%02x, "
"CMD=%02x, ADD=%02x, DAT0=%02x, DAT1=%02x\n",
inb_p(SMBHSTSTS), inb_p(SMBHSTTYP), inb_p(SMBHSTCMD),
inb_p(SMBHSTADD), inb_p(SMBHSTDAT0), inb_p(SMBHSTDAT1));
/* get status */
temp = inb_p(SMBHSTSTS);
/* Make sure the SMBus host is ready to start transmitting */
/* Check the busy bit first */
if (temp & ALI1535_STS_BUSY) {
/* If the host controller is still busy, it may have timed out
* in the previous transaction, resulting in a "SMBus Timeout"
* printk. I've tried the following to reset a stuck busy bit.
* 1. Reset the controller with an KILL command. (this
* doesn't seem to clear the controller if an external
* device is hung)
* 2. Reset the controller and the other SMBus devices with a
* T_OUT command. (this clears the host busy bit if an
* external device is hung, but it comes back upon a new
* access to a device)
* 3. Disable and reenable the controller in SMBHSTCFG. Worst
* case, nothing seems to work except power reset.
*/
/* Try resetting entire SMB bus, including other devices - This
* may not work either - it clears the BUSY bit but then the
* BUSY bit may come back on when you try and use the chip
* again. If that's the case you are stuck.
*/
dev_info(&adap->dev,
"Resetting entire SMB Bus to clear busy condition (%02x)\n",
temp);
outb_p(ALI1535_T_OUT, SMBHSTTYP);
temp = inb_p(SMBHSTSTS);
}
/* now check the error bits and the busy bit */
if (temp & (ALI1535_STS_ERR | ALI1535_STS_BUSY)) {
/* do a clear-on-write */
outb_p(0xFF, SMBHSTSTS);
if ((temp = inb_p(SMBHSTSTS)) &
(ALI1535_STS_ERR | ALI1535_STS_BUSY)) {
/* This is probably going to be correctable only by a
* power reset as one of the bits now appears to be
* stuck */
/* This may be a bus or device with electrical problems. */
dev_err(&adap->dev,
"SMBus reset failed! (0x%02x) - controller or "
"device on bus is probably hung\n", temp);
return -1;
}
} else {
/* check and clear done bit */
if (temp & ALI1535_STS_DONE) {
outb_p(temp, SMBHSTSTS);
}
}
/* start the transaction by writing anything to the start register */
outb_p(0xFF, SMBHSTPORT);
/* We will always wait for a fraction of a second! */
timeout = 0;
do {
ali1535_do_pause(1);
temp = inb_p(SMBHSTSTS);
} while (((temp & ALI1535_STS_BUSY) && !(temp & ALI1535_STS_IDLE))
&& (timeout++ < MAX_TIMEOUT));
/* If the SMBus is still busy, we give up */
if (timeout >= MAX_TIMEOUT) {
result = -1;
dev_err(&adap->dev, "SMBus Timeout!\n");
}
if (temp & ALI1535_STS_FAIL) {
result = -1;
dev_dbg(&adap->dev, "Error: Failed bus transaction\n");
}
/* Unfortunately the ALI SMB controller maps "no response" and "bus
* collision" into a single bit. No reponse is the usual case so don't
* do a printk. This means that bus collisions go unreported.
*/
if (temp & ALI1535_STS_BUSERR) {
result = -1;
dev_dbg(&adap->dev,
"Error: no response or bus collision ADD=%02x\n",
inb_p(SMBHSTADD));
}
/* haven't ever seen this */
if (temp & ALI1535_STS_DEV) {
result = -1;
dev_err(&adap->dev, "Error: device error\n");
}
/* check to see if the "command complete" indication is set */
if (!(temp & ALI1535_STS_DONE)) {
result = -1;
dev_err(&adap->dev, "Error: command never completed\n");
}
dev_dbg(&adap->dev, "Transaction (post): STS=%02x, TYP=%02x, "
"CMD=%02x, ADD=%02x, DAT0=%02x, DAT1=%02x\n",
inb_p(SMBHSTSTS), inb_p(SMBHSTTYP), inb_p(SMBHSTCMD),
inb_p(SMBHSTADD), inb_p(SMBHSTDAT0), inb_p(SMBHSTDAT1));
/* take consequent actions for error conditions */
if (!(temp & ALI1535_STS_DONE)) {
/* issue "kill" to reset host controller */
outb_p(ALI1535_KILL,SMBHSTTYP);
outb_p(0xFF,SMBHSTSTS);
} else if (temp & ALI1535_STS_ERR) {
/* issue "timeout" to reset all devices on bus */
outb_p(ALI1535_T_OUT,SMBHSTTYP);
outb_p(0xFF,SMBHSTSTS);
}
return result;
}
/* Return -1 on error. */
static s32 ali1535_access(struct i2c_adapter *adap, u16 addr,
unsigned short flags, char read_write, u8 command,
int size, union i2c_smbus_data *data)
{
int i, len;
int temp;
int timeout;
s32 result = 0;
down(&i2c_ali1535_sem);
/* make sure SMBus is idle */
temp = inb_p(SMBHSTSTS);
for (timeout = 0;
(timeout < MAX_TIMEOUT) && !(temp & ALI1535_STS_IDLE);
timeout++) {
ali1535_do_pause(1);
temp = inb_p(SMBHSTSTS);
}
if (timeout >= MAX_TIMEOUT)
dev_warn(&adap->dev, "Idle wait Timeout! STS=0x%02x\n", temp);
/* clear status register (clear-on-write) */
outb_p(0xFF, SMBHSTSTS);
switch (size) {
case I2C_SMBUS_PROC_CALL:
dev_err(&adap->dev, "I2C_SMBUS_PROC_CALL not supported!\n");
result = -1;
goto EXIT;
case I2C_SMBUS_QUICK:
outb_p(((addr & 0x7f) << 1) | (read_write & 0x01),
SMBHSTADD);
size = ALI1535_QUICK;
outb_p(size, SMBHSTTYP); /* output command */
break;
case I2C_SMBUS_BYTE:
outb_p(((addr & 0x7f) << 1) | (read_write & 0x01),
SMBHSTADD);
size = ALI1535_BYTE;
outb_p(size, SMBHSTTYP); /* output command */
if (read_write == I2C_SMBUS_WRITE)
outb_p(command, SMBHSTCMD);
break;
case I2C_SMBUS_BYTE_DATA:
outb_p(((addr & 0x7f) << 1) | (read_write & 0x01),
SMBHSTADD);
size = ALI1535_BYTE_DATA;
outb_p(size, SMBHSTTYP); /* output command */
outb_p(command, SMBHSTCMD);
if (read_write == I2C_SMBUS_WRITE)
outb_p(data->byte, SMBHSTDAT0);
break;
case I2C_SMBUS_WORD_DATA:
outb_p(((addr & 0x7f) << 1) | (read_write & 0x01),
SMBHSTADD);
size = ALI1535_WORD_DATA;
outb_p(size, SMBHSTTYP); /* output command */
outb_p(command, SMBHSTCMD);
if (read_write == I2C_SMBUS_WRITE) {
outb_p(data->word & 0xff, SMBHSTDAT0);
outb_p((data->word & 0xff00) >> 8, SMBHSTDAT1);
}
break;
case I2C_SMBUS_BLOCK_DATA:
outb_p(((addr & 0x7f) << 1) | (read_write & 0x01),
SMBHSTADD);
size = ALI1535_BLOCK_DATA;
outb_p(size, SMBHSTTYP); /* output command */
outb_p(command, SMBHSTCMD);
if (read_write == I2C_SMBUS_WRITE) {
len = data->block[0];
if (len < 0) {
len = 0;
data->block[0] = len;
}
if (len > 32) {
len = 32;
data->block[0] = len;
}
outb_p(len, SMBHSTDAT0);
/* Reset SMBBLKDAT */
outb_p(inb_p(SMBHSTTYP) | ALI1535_BLOCK_CLR, SMBHSTTYP);
for (i = 1; i <= len; i++)
outb_p(data->block[i], SMBBLKDAT);
}
break;
}
if (ali1535_transaction(adap)) {
/* Error in transaction */
result = -1;
goto EXIT;
}
if ((read_write == I2C_SMBUS_WRITE) || (size == ALI1535_QUICK)) {
result = 0;
goto EXIT;
}
switch (size) {
case ALI1535_BYTE: /* Result put in SMBHSTDAT0 */
data->byte = inb_p(SMBHSTDAT0);
break;
case ALI1535_BYTE_DATA:
data->byte = inb_p(SMBHSTDAT0);
break;
case ALI1535_WORD_DATA:
data->word = inb_p(SMBHSTDAT0) + (inb_p(SMBHSTDAT1) << 8);
break;
case ALI1535_BLOCK_DATA:
len = inb_p(SMBHSTDAT0);
if (len > 32)
len = 32;
data->block[0] = len;
/* Reset SMBBLKDAT */
outb_p(inb_p(SMBHSTTYP) | ALI1535_BLOCK_CLR, SMBHSTTYP);
for (i = 1; i <= data->block[0]; i++) {
data->block[i] = inb_p(SMBBLKDAT);
dev_dbg(&adap->dev, "Blk: len=%d, i=%d, data=%02x\n",
len, i, data->block[i]);
}
break;
}
EXIT:
up(&i2c_ali1535_sem);
return result;
}
u32 ali1535_func(struct i2c_adapter *adapter)
{
return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE |
I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA |
I2C_FUNC_SMBUS_BLOCK_DATA;
}
static struct i2c_algorithm smbus_algorithm = {
.name = "Non-i2c SMBus adapter",
.id = I2C_ALGO_SMBUS,
.smbus_xfer = ali1535_access,
.functionality = ali1535_func,
};
static struct i2c_adapter ali1535_adapter = {
.owner = THIS_MODULE,
.id = I2C_ALGO_SMBUS | I2C_HW_SMBUS_ALI1535,
.algo = &smbus_algorithm,
.dev = {
.name = "unset",
}
};
static struct pci_device_id ali1535_ids[] __devinitdata = {
{
.vendor = PCI_VENDOR_ID_AL,
.device = PCI_DEVICE_ID_AL_M7101,
.subvendor = PCI_ANY_ID,
.subdevice = PCI_ANY_ID,
},
{ },
};
static int __devinit ali1535_probe(struct pci_dev *dev, const struct pci_device_id *id)
{
if (ali1535_setup(dev)) {
dev_warn(&dev->dev,
"ALI1535 not detected, module not inserted.\n");
return -ENODEV;
}
/* set up the driverfs linkage to our parent device */
ali1535_adapter.dev.parent = &dev->dev;
snprintf(ali1535_adapter.dev.name, DEVICE_NAME_SIZE,
"SMBus ALI1535 adapter at %04x", ali1535_smba);
return i2c_add_adapter(&ali1535_adapter);
}
static void __devexit ali1535_remove(struct pci_dev *dev)
{
i2c_del_adapter(&ali1535_adapter);
}
static struct pci_driver ali1535_driver = {
.name = "ali1535_smbus",
.id_table = ali1535_ids,
.probe = ali1535_probe,
.remove = __devexit_p(ali1535_remove),
};
static int __init i2c_ali1535_init(void)
{
printk(KERN_INFO "i2c-ali1535 version %s (%s)\n", I2C_VERSION, I2C_DATE);
return pci_module_init(&ali1535_driver);
}
static void __exit i2c_ali1535_exit(void)
{
pci_unregister_driver(&ali1535_driver);
release_region(ali1535_smba, ALI1535_SMB_IOSIZE);
}
MODULE_AUTHOR("Frodo Looijaard <frodol@dds.nl>, "
"Philip Edelbrock <phil@netroedge.com>, "
"Mark D. Studebaker <mdsxyz123@yahoo.com> "
"and Dan Eaton <dan.eaton@rocketlogix.com>");
MODULE_DESCRIPTION("ALI1535 SMBus driver");
MODULE_LICENSE("GPL");
module_init(i2c_ali1535_init);
module_exit(i2c_ali1535_exit);
/*
* kernel/busses/i2c-prosavage.c
*
* i2c bus driver for S3/VIA 8365/8375 graphics processor.
* Copyright (c) 2003 Henk Vergonet <henk@god.dyndns.org>
* Based on code written by:
* Frodo Looijaard <frodol@dds.nl>,
* Philip Edelbrock <phil@netroedge.com>,
* Ralph Metzler <rjkm@thp.uni-koeln.de>, and
* Mark D. Studebaker <mdsxyz123@yahoo.com>
* Simon Vogl
* and others
*
* Please read the lm_sensors documentation for details on use.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
/* 18-05-2003 HVE - created
* 14-06-2003 HVE - adapted for lm_sensors2
* 17-06-2003 HVE - linux 2.5.xx compatible
* 18-06-2003 HVE - codingstyle
* 21-06-2003 HVE - compatibility lm_sensors2 and linux 2.5.xx
* codingstyle, mmio enabled
*
* This driver interfaces to the I2C bus of the VIA north bridge embedded
* ProSavage4/8 devices. Usefull for gaining access to the TV Encoder chips.
*
* Graphics cores:
* S3/VIA KM266/VT8375 aka ProSavage8
* S3/VIA KM133/VT8365 aka Savage4
*
* Two serial busses are implemented:
* SERIAL1 - I2C serial communications interface
* SERIAL2 - DDC2 monitor communications interface
*
* Tested on a FX41 mainboard, see http://www.shuttle.com
*
*
* TODO:
* - integration with prosavage framebuffer device
* (Additional documentation needed :(
*/
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/pci.h>
#include <linux/i2c.h>
#include <linux/i2c-algo-bit.h>
#include <asm/io.h>
/*
* driver configuration
*/
#define DRIVER_ID "i2c-prosavage"
#define DRIVER_VERSION "20030621"
/* lm_sensors2 / kernel 2.5.xx compatibility */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
#define ADAPTER_NAME(x) (x).name
#else
#define ADAPTER_NAME(x) (x).dev.name
#endif /* LINUX_VERSION_CODE */
#define MAX_BUSSES 2
struct s_i2c_bus {
u8 *mmvga;
int i2c_reg;
int adap_ok;
struct i2c_adapter adap;
struct i2c_algo_bit_data algo;
};
struct s_i2c_chip {
u8 *mmio;
struct s_i2c_bus i2c_bus[MAX_BUSSES];
};
/*
* i2c configuration
*/
#ifndef I2C_HW_B_S3VIA
#define I2C_HW_B_S3VIA 0x18 /* S3VIA ProSavage adapter */
#endif
/* delays */
#define CYCLE_DELAY 10
#define TIMEOUT (HZ / 2)
/*
* S3/VIA 8365/8375 registers
*/
#ifndef PCI_VENDOR_ID_S3
#define PCI_VENDOR_ID_S3 0x5333
#endif
#ifndef PCI_DEVICE_ID_S3_SAVAGE4
#define PCI_DEVICE_ID_S3_SAVAGE4 0x8a25
#endif
#ifndef PCI_DEVICE_ID_S3_PROSAVAGE8
#define PCI_DEVICE_ID_S3_PROSAVAGE8 0x8d04
#endif
#define VGA_CR_IX 0x3d4
#define VGA_CR_DATA 0x3d5
#define CR_SERIAL1 0xa0 /* I2C serial communications interface */
#define MM_SERIAL1 0xff20
#define CR_SERIAL2 0xb1 /* DDC2 monitor communications interface */
/* based on vt8365 documentation */
#define I2C_ENAB 0x10
#define I2C_SCL_OUT 0x01
#define I2C_SDA_OUT 0x02
#define I2C_SCL_IN 0x04
#define I2C_SDA_IN 0x08
#define SET_CR_IX(p, val) *((p)->mmvga + VGA_CR_IX) = (u8)(val)
#define SET_CR_DATA(p, val) *((p)->mmvga + VGA_CR_DATA) = (u8)(val)
#define GET_CR_DATA(p) *((p)->mmvga + VGA_CR_DATA)
/*
* Serial bus line handling
*
* serial communications register as parameter in private data
*
* TODO: locks with other code sections accessing video registers?
*/
static void bit_s3via_setscl(void *bus, int val)
{
struct s_i2c_bus *p = (struct s_i2c_bus *)bus;
unsigned int r;
SET_CR_IX(p, p->i2c_reg);
r = GET_CR_DATA(p);
r |= I2C_ENAB;
if (val) {
r |= I2C_SCL_OUT;
} else {
r &= ~I2C_SCL_OUT;
}
SET_CR_DATA(p, r);
}
static void bit_s3via_setsda(void *bus, int val)
{
struct s_i2c_bus *p = (struct s_i2c_bus *)bus;
unsigned int r;
SET_CR_IX(p, p->i2c_reg);
r = GET_CR_DATA(p);
r |= I2C_ENAB;
if (val) {
r |= I2C_SDA_OUT;
} else {
r &= ~I2C_SDA_OUT;
}
SET_CR_DATA(p, r);
}
static int bit_s3via_getscl(void *bus)
{
struct s_i2c_bus *p = (struct s_i2c_bus *)bus;
SET_CR_IX(p, p->i2c_reg);
return (0 != (GET_CR_DATA(p) & I2C_SCL_IN));
}
static int bit_s3via_getsda(void *bus)
{
struct s_i2c_bus *p = (struct s_i2c_bus *)bus;
SET_CR_IX(p, p->i2c_reg);
return (0 != (GET_CR_DATA(p) & I2C_SDA_IN));
}
/*
* adapter initialisation
*/
static int i2c_register_bus(struct s_i2c_bus *p, u8 *mmvga, u32 i2c_reg)
{
int ret;
p->adap.owner = THIS_MODULE;
p->adap.id = I2C_HW_B_S3VIA;
p->adap.algo_data = &p->algo;
p->algo.setsda = bit_s3via_setsda;
p->algo.setscl = bit_s3via_setscl;
p->algo.getsda = bit_s3via_getsda;
p->algo.getscl = bit_s3via_getscl;
p->algo.udelay = CYCLE_DELAY;
p->algo.mdelay = CYCLE_DELAY;
p->algo.timeout = TIMEOUT;
p->algo.data = p;
p->mmvga = mmvga;
p->i2c_reg = i2c_reg;
ret = i2c_bit_add_bus(&p->adap);
if (ret) {
return ret;
}
p->adap_ok = 1;
return 0;
}
/*
* Cleanup stuff
*/
static void __devexit prosavage_remove(struct pci_dev *dev)
{
struct s_i2c_chip *chip;
int i, ret;
chip = (struct s_i2c_chip *)pci_get_drvdata(dev);
if (!chip) {
return;
}
for (i = MAX_BUSSES - 1; i >= 0; i--) {
if (chip->i2c_bus[i].adap_ok == 0)
continue;
ret = i2c_bit_del_bus(&chip->i2c_bus[i].adap);
if (ret) {
printk(DRIVER_ID ": %s not removed\n",
ADAPTER_NAME(chip->i2c_bus[i].adap));
}
}
if (chip->mmio) {
iounmap(chip->mmio);
}
kfree(chip);
}
/*
* Detect chip and initialize it
*/
static int __devinit prosavage_probe(struct pci_dev *dev, const struct pci_device_id *id)
{
int ret;
unsigned long base, len;
struct s_i2c_chip *chip;
struct s_i2c_bus *bus;
pci_set_drvdata(dev, kmalloc(sizeof(struct s_i2c_chip), GFP_KERNEL));
chip = (struct s_i2c_chip *)pci_get_drvdata(dev);
if (chip == NULL) {
return -ENOMEM;
}
memset(chip, 0, sizeof(struct s_i2c_chip));
base = dev->resource[0].start & PCI_BASE_ADDRESS_MEM_MASK;
len = dev->resource[0].end - base + 1;
chip->mmio = ioremap_nocache(base, len);
if (chip->mmio == NULL) {
printk (DRIVER_ID ": ioremap failed\n");
prosavage_remove(dev);
return -ENODEV;
}
/*
* Chip initialisation
*/
/* Unlock Extended IO Space ??? */
/*
* i2c bus registration
*/
bus = &chip->i2c_bus[0];
snprintf(ADAPTER_NAME(bus->adap), sizeof(ADAPTER_NAME(bus->adap)),
"ProSavage I2C bus at %02x:%02x.%x",
dev->bus->number, PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn));
ret = i2c_register_bus(bus, chip->mmio + 0x8000, CR_SERIAL1);
if (ret) {
goto err_adap;
}
/*
* ddc bus registration
*/
bus = &chip->i2c_bus[1];
snprintf(ADAPTER_NAME(bus->adap), sizeof(ADAPTER_NAME(bus->adap)),
"ProSavage DDC bus at %02x:%02x.%x",
dev->bus->number, PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn));
ret = i2c_register_bus(bus, chip->mmio + 0x8000, CR_SERIAL2);
if (ret) {
goto err_adap;
}
return 0;
err_adap:
printk (DRIVER_ID ": %s failed\n", ADAPTER_NAME(bus->adap));
prosavage_remove(dev);
return ret;
}
/*
* Data for PCI driver interface
*/
static struct pci_device_id prosavage_pci_tbl[] __devinitdata = {
{
.vendor = PCI_VENDOR_ID_S3,
.device = PCI_DEVICE_ID_S3_SAVAGE4,
.subvendor = PCI_ANY_ID,
.subdevice = PCI_ANY_ID,
},{
.vendor = PCI_VENDOR_ID_S3,
.device = PCI_DEVICE_ID_S3_PROSAVAGE8,
.subvendor = PCI_ANY_ID,
.subdevice = PCI_ANY_ID,
},{ 0, }
};
static struct pci_driver prosavage_driver = {
.name = "prosavage-smbus",
.id_table = prosavage_pci_tbl,
.probe = prosavage_probe,
.remove = __devexit_p(prosavage_remove),
};
static int __init i2c_prosavage_init(void)
{
printk(DRIVER_ID " version %s (%s)\n", I2C_VERSION, DRIVER_VERSION);
return pci_module_init(&prosavage_driver);
}
static void __exit i2c_prosavage_exit(void)
{
pci_unregister_driver(&prosavage_driver);
}
MODULE_DEVICE_TABLE(pci, prosavage_pci_tbl);
MODULE_AUTHOR("Henk Vergonet");
MODULE_DESCRIPTION("ProSavage VIA 8365/8375 smbus driver");
MODULE_LICENSE("GPL");
module_init (i2c_prosavage_init);
module_exit (i2c_prosavage_exit);
...@@ -473,7 +473,7 @@ int ide_event(event_t event, int priority, ...@@ -473,7 +473,7 @@ int ide_event(event_t event, int priority,
static struct pcmcia_driver ide_cs_driver = { static struct pcmcia_driver ide_cs_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.drv = { .drv = {
.name = "ide_cs", .name = "ide-cs",
}, },
.attach = ide_attach, .attach = ide_attach,
.detach = ide_detach, .detach = ide_detach,
......
...@@ -175,6 +175,27 @@ static int ti_override(struct yenta_socket *socket) ...@@ -175,6 +175,27 @@ static int ti_override(struct yenta_socket *socket)
new = reg & ~I365_INTR_ENA; new = reg & ~I365_INTR_ENA;
if (new != reg) if (new != reg)
exca_writeb(socket, I365_INTCTL, new); exca_writeb(socket, I365_INTCTL, new);
/*
* If ISA interrupts don't work, then fall back to routing card
* interrupts to the PCI interrupt of the socket.
*/
if (!socket->socket.irq_mask) {
int irqmux, devctl;
printk (KERN_INFO "ti113x: Routing card interrupts to PCI\n");
devctl = config_readb(socket, TI113X_DEVICE_CONTROL);
devctl &= ~TI113X_DCR_IMODE_MASK;
irqmux = config_readl(socket, TI122X_IRQMUX);
irqmux = (irqmux & ~0x0f) | 0x02; /* route INTA */
irqmux = (irqmux & ~0xf0) | 0x20; /* route INTB */
config_writel(socket, TI122X_IRQMUX, irqmux);
config_writeb(socket, TI113X_DEVICE_CONTROL, devctl);
}
socket->socket.ss_entry->init = ti_init; socket->socket.ss_entry->init = ti_init;
return 0; return 0;
} }
...@@ -241,6 +262,17 @@ static int ti1250_override(struct yenta_socket *socket) ...@@ -241,6 +262,17 @@ static int ti1250_override(struct yenta_socket *socket)
return 0; return 0;
} }
static int ti12xx_override(struct yenta_socket *socket)
{
/* make sure that memory burst is active */
ti_sysctl(socket) = config_readl(socket, TI113X_SYSTEM_CONTROL);
ti_sysctl(socket) |= TI122X_SCR_MRBURSTUP;
config_writel(socket, TI113X_SYSTEM_CONTROL, ti_sysctl(socket));
return ti113x_override(socket);
}
#endif /* CONFIG_CARDBUS */ #endif /* CONFIG_CARDBUS */
#endif /* _LINUX_TI113X_H */ #endif /* _LINUX_TI113X_H */
......
...@@ -807,23 +807,30 @@ struct cardbus_override_struct { ...@@ -807,23 +807,30 @@ struct cardbus_override_struct {
unsigned short device; unsigned short device;
int (*override) (struct yenta_socket *socket); int (*override) (struct yenta_socket *socket);
} cardbus_override[] = { } cardbus_override[] = {
{ PD(TI,1130), &ti113x_override },
{ PD(TI,1031), &ti_override }, { PD(TI,1031), &ti_override },
{ PD(TI,1131), &ti113x_override },
{ PD(TI,1250), &ti1250_override }, /* TBD: Check if these TI variants can use more
{ PD(TI,1220), &ti_override }, * advanced overrides instead */
{ PD(TI,1221), &ti_override },
{ PD(TI,1210), &ti_override }, { PD(TI,1210), &ti_override },
{ PD(TI,1450), &ti_override },
{ PD(TI,1225), &ti_override },
{ PD(TI,1251A), &ti_override },
{ PD(TI,1211), &ti_override }, { PD(TI,1211), &ti_override },
{ PD(TI,1251A), &ti_override },
{ PD(TI,1251B), &ti_override }, { PD(TI,1251B), &ti_override },
{ PD(TI,1410), ti1250_override },
{ PD(TI,1420), &ti_override }, { PD(TI,1420), &ti_override },
{ PD(TI,1450), &ti_override },
{ PD(TI,4410), &ti_override }, { PD(TI,4410), &ti_override },
{ PD(TI,4451), &ti_override }, { PD(TI,4451), &ti_override },
{ PD(TI,1130), &ti113x_override },
{ PD(TI,1131), &ti113x_override },
{ PD(TI,1220), &ti12xx_override },
{ PD(TI,1221), &ti12xx_override },
{ PD(TI,1225), &ti12xx_override },
{ PD(TI,1520), &ti12xx_override },
{ PD(TI,1250), &ti1250_override },
{ PD(TI,1410), &ti1250_override },
{ PD(RICOH,RL5C465), &ricoh_override }, { PD(RICOH,RL5C465), &ricoh_override },
{ PD(RICOH,RL5C466), &ricoh_override }, { PD(RICOH,RL5C466), &ricoh_override },
{ PD(RICOH,RL5C475), &ricoh_override }, { PD(RICOH,RL5C475), &ricoh_override },
......
...@@ -122,13 +122,13 @@ struct uart_8250_port { ...@@ -122,13 +122,13 @@ struct uart_8250_port {
struct uart_port port; struct uart_port port;
struct timer_list timer; /* "no irq" timer */ struct timer_list timer; /* "no irq" timer */
struct list_head list; /* ports on this IRQ */ struct list_head list; /* ports on this IRQ */
unsigned short rev;
unsigned char acr; unsigned char acr;
unsigned char ier; unsigned char ier;
unsigned char rev;
unsigned char lcr; unsigned char lcr;
unsigned char mcr_mask; /* mask of user bits */ unsigned char mcr_mask; /* mask of user bits */
unsigned char mcr_force; /* mask of forced bits */ unsigned char mcr_force; /* mask of forced bits */
unsigned int lsr_break_flag; unsigned char lsr_break_flag;
/* /*
* We provide a per-port pm hook. * We provide a per-port pm hook.
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
A driver for PCMCIA serial devices A driver for PCMCIA serial devices
serial_cs.c 1.123 2000/08/24 18:46:38 serial_cs.c 1.134 2002/05/04 05:48:53
The contents of this file are subject to the Mozilla Public The contents of this file are subject to the Mozilla Public
License Version 1.1 (the "License"); you may not use this file License Version 1.1 (the "License"); you may not use this file
...@@ -43,7 +43,6 @@ ...@@ -43,7 +43,6 @@
#include <linux/serial.h> #include <linux/serial.h>
#include <linux/serial_core.h> #include <linux/serial_core.h>
#include <linux/major.h> #include <linux/major.h>
#include <linux/workqueue.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/system.h> #include <asm/system.h>
...@@ -59,7 +58,7 @@ ...@@ -59,7 +58,7 @@
static int pc_debug = PCMCIA_DEBUG; static int pc_debug = PCMCIA_DEBUG;
MODULE_PARM(pc_debug, "i"); MODULE_PARM(pc_debug, "i");
#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
static char *version = "serial_cs.c 1.123 2000/08/24 18:46:38 (David Hinds)"; static char *version = "serial_cs.c 1.134 2002/05/04 05:48:53 (David Hinds)";
#else #else
#define DEBUG(n, args...) #define DEBUG(n, args...)
#endif #endif
...@@ -74,10 +73,13 @@ static int irq_list[4] = { -1 }; ...@@ -74,10 +73,13 @@ static int irq_list[4] = { -1 };
/* Enable the speaker? */ /* Enable the speaker? */
static int do_sound = 1; static int do_sound = 1;
/* Skip strict UART tests? */
static int buggy_uart;
MODULE_PARM(irq_mask, "i"); MODULE_PARM(irq_mask, "i");
MODULE_PARM(irq_list, "1-4i"); MODULE_PARM(irq_list, "1-4i");
MODULE_PARM(do_sound, "i"); MODULE_PARM(do_sound, "i");
MODULE_PARM(buggy_uart, "i");
/*====================================================================*/ /*====================================================================*/
...@@ -100,7 +102,7 @@ static struct multi_id multi_id[] = { ...@@ -100,7 +102,7 @@ static struct multi_id multi_id[] = {
}; };
#define MULTI_COUNT (sizeof(multi_id)/sizeof(struct multi_id)) #define MULTI_COUNT (sizeof(multi_id)/sizeof(struct multi_id))
typedef struct serial_info { struct serial_info {
dev_link_t link; dev_link_t link;
int ndev; int ndev;
int multi; int multi;
...@@ -108,8 +110,7 @@ typedef struct serial_info { ...@@ -108,8 +110,7 @@ typedef struct serial_info {
int manfid; int manfid;
dev_node_t node[4]; dev_node_t node[4];
int line[4]; int line[4];
struct work_struct remove; };
} serial_info_t;
static void serial_config(dev_link_t * link); static void serial_config(dev_link_t * link);
static int serial_event(event_t event, int priority, static int serial_event(event_t event, int priority,
...@@ -124,20 +125,19 @@ static dev_link_t *dev_list = NULL; ...@@ -124,20 +125,19 @@ static dev_link_t *dev_list = NULL;
/*====================================================================== /*======================================================================
After a card is removed, do_serial_release() will unregister After a card is removed, serial_remove() will unregister
the serial device(s), and release the PCMCIA configuration. the serial device(s), and release the PCMCIA configuration.
======================================================================*/ ======================================================================*/
/* static void serial_remove(dev_link_t *link)
* This always runs in process context.
*/
static void do_serial_release(void *arg)
{ {
struct serial_info *info = arg; struct serial_info *info = link->priv;
int i; int i, ret;
DEBUG(0, "serial_release(0x%p)\n", &info->link); link->state &= ~DEV_PRESENT;
DEBUG(0, "serial_release(0x%p)\n", link);
/* /*
* Recheck to see if the device is still configured. * Recheck to see if the device is still configured.
...@@ -158,25 +158,6 @@ static void do_serial_release(void *arg) ...@@ -158,25 +158,6 @@ static void do_serial_release(void *arg)
} }
} }
/*
* This may be called from IRQ context.
*/
static void serial_remove(dev_link_t *link)
{
struct serial_info *info = link->priv;
link->state &= ~DEV_PRESENT;
/*
* FIXME: Since the card has probably been removed,
* we should call into the serial layer and hang up
* the ports on the card immediately.
*/
if (link->state & DEV_CONFIG)
schedule_work(&info->remove);
}
/*====================================================================== /*======================================================================
serial_attach() creates an "instance" of the driver, allocating serial_attach() creates an "instance" of the driver, allocating
...@@ -187,7 +168,7 @@ static void serial_remove(dev_link_t *link) ...@@ -187,7 +168,7 @@ static void serial_remove(dev_link_t *link)
static dev_link_t *serial_attach(void) static dev_link_t *serial_attach(void)
{ {
serial_info_t *info; struct serial_info *info;
client_reg_t client_reg; client_reg_t client_reg;
dev_link_t *link; dev_link_t *link;
int i, ret; int i, ret;
...@@ -202,8 +183,6 @@ static dev_link_t *serial_attach(void) ...@@ -202,8 +183,6 @@ static dev_link_t *serial_attach(void)
link = &info->link; link = &info->link;
link->priv = info; link->priv = info;
INIT_WORK(&info->remove, do_serial_release, info);
link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
link->io.NumPorts1 = 8; link->io.NumPorts1 = 8;
link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; link->irq.Attributes = IRQ_TYPE_EXCLUSIVE;
...@@ -214,7 +193,6 @@ static dev_link_t *serial_attach(void) ...@@ -214,7 +193,6 @@ static dev_link_t *serial_attach(void)
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
link->irq.IRQInfo2 |= 1 << irq_list[i]; link->irq.IRQInfo2 |= 1 << irq_list[i];
link->conf.Attributes = CONF_ENABLE_IRQ; link->conf.Attributes = CONF_ENABLE_IRQ;
link->conf.Vcc = 50;
if (do_sound) { if (do_sound) {
link->conf.Attributes |= CONF_ENABLE_SPKR; link->conf.Attributes |= CONF_ENABLE_SPKR;
link->conf.Status = CCSR_AUDIO_ENA; link->conf.Status = CCSR_AUDIO_ENA;
...@@ -254,7 +232,7 @@ static dev_link_t *serial_attach(void) ...@@ -254,7 +232,7 @@ static dev_link_t *serial_attach(void)
static void serial_detach(dev_link_t * link) static void serial_detach(dev_link_t * link)
{ {
serial_info_t *info = link->priv; struct serial_info *info = link->priv;
dev_link_t **linkp; dev_link_t **linkp;
int ret; int ret;
...@@ -275,7 +253,7 @@ static void serial_detach(dev_link_t * link) ...@@ -275,7 +253,7 @@ static void serial_detach(dev_link_t * link)
/* /*
* Ensure that the ports have been released. * Ensure that the ports have been released.
*/ */
do_serial_release(info); serial_remove(link);
if (link->handle) { if (link->handle) {
ret = CardServices(DeregisterClient, link->handle); ret = CardServices(DeregisterClient, link->handle);
...@@ -290,7 +268,7 @@ static void serial_detach(dev_link_t * link) ...@@ -290,7 +268,7 @@ static void serial_detach(dev_link_t * link)
/*====================================================================*/ /*====================================================================*/
static int setup_serial(serial_info_t * info, ioaddr_t port, int irq) static int setup_serial(struct serial_info * info, ioaddr_t port, int irq)
{ {
struct serial_struct serial; struct serial_struct serial;
int line; int line;
...@@ -299,11 +277,13 @@ static int setup_serial(serial_info_t * info, ioaddr_t port, int irq) ...@@ -299,11 +277,13 @@ static int setup_serial(serial_info_t * info, ioaddr_t port, int irq)
serial.port = port; serial.port = port;
serial.irq = irq; serial.irq = irq;
serial.flags = UPF_SKIP_TEST | UPF_SHARE_IRQ; serial.flags = UPF_SKIP_TEST | UPF_SHARE_IRQ;
if (buggy_uart)
serial.flags |= UPF_BUGGY_UART;
line = register_serial(&serial); line = register_serial(&serial);
if (line < 0) { if (line < 0) {
printk(KERN_NOTICE "serial_cs: register_serial() at 0x%04lx," printk(KERN_NOTICE "serial_cs: register_serial() at 0x%04lx,"
" irq %d failed\n", (u_long) serial.port, serial.irq); " irq %d failed\n", (u_long) serial.port, serial.irq);
return -1; return -EINVAL;
} }
info->line[info->ndev] = line; info->line[info->ndev] = line;
...@@ -341,7 +321,7 @@ static int simple_config(dev_link_t * link) ...@@ -341,7 +321,7 @@ static int simple_config(dev_link_t * link)
{ {
static ioaddr_t base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; static ioaddr_t base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 };
client_handle_t handle = link->handle; client_handle_t handle = link->handle;
serial_info_t *info = link->priv; struct serial_info *info = link->priv;
tuple_t tuple; tuple_t tuple;
u_char buf[256]; u_char buf[256];
cisparse_t parse; cisparse_t parse;
...@@ -445,13 +425,21 @@ static int simple_config(dev_link_t * link) ...@@ -445,13 +425,21 @@ static int simple_config(dev_link_t * link)
static int multi_config(dev_link_t * link) static int multi_config(dev_link_t * link)
{ {
client_handle_t handle = link->handle; client_handle_t handle = link->handle;
serial_info_t *info = link->priv; struct serial_info *info = link->priv;
tuple_t tuple; tuple_t tuple;
u_char buf[256]; u_char buf[256];
cisparse_t parse; cisparse_t parse;
cistpl_cftable_entry_t *cf = &parse.cftable_entry; cistpl_cftable_entry_t *cf = &parse.cftable_entry;
config_info_t config;
int i, base2 = 0; int i, base2 = 0;
i = CardServices(GetConfigurationInfo, handle, &config);
if (i != CS_SUCCESS) {
cs_error(handle, GetConfiguration, i);
return -1;
}
link->conf.Vcc = config.Vcc;
tuple.TupleData = (cisdata_t *) buf; tuple.TupleData = (cisdata_t *) buf;
tuple.TupleOffset = 0; tuple.TupleOffset = 0;
tuple.TupleDataMax = 255; tuple.TupleDataMax = 255;
...@@ -524,6 +512,19 @@ static int multi_config(dev_link_t * link) ...@@ -524,6 +512,19 @@ static int multi_config(dev_link_t * link)
return -1; return -1;
} }
/* The Oxford Semiconductor OXCF950 cards are in fact single-port:
8 registers are for the UART, the others are extra registers */
if (info->manfid == MANFID_OXSEMI) {
if (cf->index == 1 || cf->index == 3) {
setup_serial(info, base2, link->irq.AssignedIRQ);
outb(12, link->io.BasePort1 + 1);
} else {
setup_serial(info, link->io.BasePort1, link->irq.AssignedIRQ);
outb(12, base2 + 1);
}
return 0;
}
setup_serial(info, link->io.BasePort1, link->irq.AssignedIRQ); setup_serial(info, link->io.BasePort1, link->irq.AssignedIRQ);
/* The Nokia cards are not really multiport cards */ /* The Nokia cards are not really multiport cards */
if (info->manfid == MANFID_NOKIA) if (info->manfid == MANFID_NOKIA)
...@@ -548,7 +549,7 @@ while ((last_ret=CardServices(last_fn=(fn), args))!=0) goto cs_failed ...@@ -548,7 +549,7 @@ while ((last_ret=CardServices(last_fn=(fn), args))!=0) goto cs_failed
void serial_config(dev_link_t * link) void serial_config(dev_link_t * link)
{ {
client_handle_t handle = link->handle; client_handle_t handle = link->handle;
serial_info_t *info = link->priv; struct serial_info *info = link->priv;
tuple_t tuple; tuple_t tuple;
u_short buf[128]; u_short buf[128];
cisparse_t parse; cisparse_t parse;
...@@ -631,7 +632,8 @@ void serial_config(dev_link_t * link) ...@@ -631,7 +632,8 @@ void serial_config(dev_link_t * link)
cs_failed: cs_failed:
cs_error(link->handle, last_fn, last_ret); cs_error(link->handle, last_fn, last_ret);
failed: failed:
do_serial_release(info); serial_remove(link);
link->state &= ~DEV_CONFIG_PENDING;
} }
/*====================================================================== /*======================================================================
...@@ -647,7 +649,7 @@ static int ...@@ -647,7 +649,7 @@ static int
serial_event(event_t event, int priority, event_callback_args_t * args) serial_event(event_t event, int priority, event_callback_args_t * args)
{ {
dev_link_t *link = args->client_data; dev_link_t *link = args->client_data;
serial_info_t *info = link->priv; struct serial_info *info = link->priv;
DEBUG(1, "serial_event(0x%06x)\n", event); DEBUG(1, "serial_event(0x%06x)\n", event);
......
...@@ -80,14 +80,14 @@ config SERIAL_8250_CS ...@@ -80,14 +80,14 @@ config SERIAL_8250_CS
config SERIAL_8250_ACPI config SERIAL_8250_ACPI
bool "8250/16550 device discovery via ACPI namespace" bool "8250/16550 device discovery via ACPI namespace"
default y if IA64 default y if IA64
depends on ACPI_BUS depends on ACPI_BUS && SERIAL_8250
---help--- ---help---
If you wish to enable serial port discovery via the ACPI If you wish to enable serial port discovery via the ACPI
namespace, say Y here. If unsure, say N. namespace, say Y here. If unsure, say N.
config SERIAL_8250_HCDP config SERIAL_8250_HCDP
bool "8250/16550 device discovery support via EFI HCDP table" bool "8250/16550 device discovery support via EFI HCDP table"
depends on IA64 depends on IA64 && SERIAL_8250
---help--- ---help---
If you wish to make the serial console port described by the EFI If you wish to make the serial console port described by the EFI
HCDP table available for use as serial console or general HCDP table available for use as serial console or general
......
...@@ -668,7 +668,6 @@ ...@@ -668,7 +668,6 @@
#define PCI_DEVICE_ID_TI_1220 0xac17 #define PCI_DEVICE_ID_TI_1220 0xac17
#define PCI_DEVICE_ID_TI_1221 0xac19 #define PCI_DEVICE_ID_TI_1221 0xac19
#define PCI_DEVICE_ID_TI_1210 0xac1a #define PCI_DEVICE_ID_TI_1210 0xac1a
#define PCI_DEVICE_ID_TI_1410 0xac50
#define PCI_DEVICE_ID_TI_1450 0xac1b #define PCI_DEVICE_ID_TI_1450 0xac1b
#define PCI_DEVICE_ID_TI_1225 0xac1c #define PCI_DEVICE_ID_TI_1225 0xac1c
#define PCI_DEVICE_ID_TI_1251A 0xac1d #define PCI_DEVICE_ID_TI_1251A 0xac1d
...@@ -676,7 +675,9 @@ ...@@ -676,7 +675,9 @@
#define PCI_DEVICE_ID_TI_1251B 0xac1f #define PCI_DEVICE_ID_TI_1251B 0xac1f
#define PCI_DEVICE_ID_TI_4410 0xac41 #define PCI_DEVICE_ID_TI_4410 0xac41
#define PCI_DEVICE_ID_TI_4451 0xac42 #define PCI_DEVICE_ID_TI_4451 0xac42
#define PCI_DEVICE_ID_TI_1410 0xac50
#define PCI_DEVICE_ID_TI_1420 0xac51 #define PCI_DEVICE_ID_TI_1420 0xac51
#define PCI_DEVICE_ID_TI_1520 0xac55
#define PCI_VENDOR_ID_SONY 0x104d #define PCI_VENDOR_ID_SONY 0x104d
#define PCI_DEVICE_ID_SONY_CXD3222 0x8039 #define PCI_DEVICE_ID_SONY_CXD3222 0x8039
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment