mirror of
https://github.com/lm-sensors/lm-sensors.git
synced 2026-10-21 11:39:31 +00:00
Added utility function i2c_delay(1), to replace various "do_pause"
(mmh) functions in bus drivers. Backported from the 2.6 work of Greg KH. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@1936 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
1 parent
e49b5486aa
commit
e035136982
11 files changed
+18
-101
No files matched your search
@@ -136,7 +136,6 @@
|
||||
/* -> Read = 1 */
|
||||
#define ALI1535_SMBIO_EN 0x04 /* SMB I/O Space enable */
|
||||
|
||||
static void ali1535_do_pause(unsigned int amount);
|
||||
static int ali1535_transaction(void);
|
||||
|
||||
static unsigned short ali1535_smba = 0;
|
||||
@@ -222,13 +221,6 @@ int ali1535_setup(struct pci_dev *ALI1535_dev)
|
||||
}
|
||||
|
||||
|
||||
/* Internally used pause function */
|
||||
void ali1535_do_pause(unsigned int amount)
|
||||
{
|
||||
current->state = TASK_INTERRUPTIBLE;
|
||||
schedule_timeout(amount);
|
||||
}
|
||||
|
||||
/* Another internally used function */
|
||||
int ali1535_transaction(void)
|
||||
{
|
||||
@@ -315,7 +307,7 @@ int ali1535_transaction(void)
|
||||
/* We will always wait for a fraction of a second! */
|
||||
timeout = 0;
|
||||
do {
|
||||
ali1535_do_pause(1);
|
||||
i2c_delay(1);
|
||||
temp = inb_p(SMBHSTSTS);
|
||||
} while (((temp & ALI1535_STS_BUSY) && !(temp & ALI1535_STS_IDLE))
|
||||
&& (timeout++ < MAX_TIMEOUT));
|
||||
@@ -401,7 +393,7 @@ s32 ali1535_access(struct i2c_adapter * adap, u16 addr,
|
||||
for (timeout = 0;
|
||||
(timeout < MAX_TIMEOUT) && !(temp & ALI1535_STS_IDLE);
|
||||
timeout++) {
|
||||
ali1535_do_pause(1);
|
||||
i2c_delay(1);
|
||||
temp = inb_p(SMBHSTSTS);
|
||||
}
|
||||
if (timeout >= MAX_TIMEOUT) {
|
||||
|
||||
@@ -223,13 +223,6 @@ static int ali15x3_setup(struct pci_dev *ALI15X3_dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Internally used pause function */
|
||||
static void ali15x3_do_pause(unsigned int amount)
|
||||
{
|
||||
current->state = TASK_INTERRUPTIBLE;
|
||||
schedule_timeout(amount);
|
||||
}
|
||||
|
||||
/* Another internally used function */
|
||||
static int ali15x3_transaction(struct i2c_adapter *adap)
|
||||
{
|
||||
@@ -302,7 +295,7 @@ static int ali15x3_transaction(struct i2c_adapter *adap)
|
||||
/* We will always wait for a fraction of a second! */
|
||||
timeout = 0;
|
||||
do {
|
||||
ali15x3_do_pause(1);
|
||||
i2c_delay(1);
|
||||
temp = inb_p(SMBHSTSTS);
|
||||
} while ((!(temp & (ALI15X3_STS_ERR | ALI15X3_STS_DONE)))
|
||||
&& (timeout++ < MAX_TIMEOUT));
|
||||
@@ -359,7 +352,7 @@ static s32 ali15x3_access(struct i2c_adapter * adap, u16 addr,
|
||||
for (timeout = 0;
|
||||
(timeout < MAX_TIMEOUT) && !(temp & ALI15X3_STS_IDLE);
|
||||
timeout++) {
|
||||
ali15x3_do_pause(1);
|
||||
i2c_delay(1);
|
||||
temp = inb_p(SMBHSTSTS);
|
||||
}
|
||||
if (timeout >= MAX_TIMEOUT) {
|
||||
|
||||
@@ -94,13 +94,6 @@ static unsigned short amd756_ioport = 0;
|
||||
|
||||
*/
|
||||
|
||||
/* Internally used pause function */
|
||||
static void amd756_do_pause(unsigned int amount)
|
||||
{
|
||||
current->state = TASK_INTERRUPTIBLE;
|
||||
schedule_timeout(amount);
|
||||
}
|
||||
|
||||
#define GS_ABRT_STS (1 << 0)
|
||||
#define GS_COL_STS (1 << 1)
|
||||
#define GS_PRERR_STS (1 << 2)
|
||||
@@ -132,7 +125,7 @@ static int amd756_transaction(void)
|
||||
if ((temp = inw_p(SMB_GLOBAL_STATUS)) & (GS_HST_STS | GS_SMB_STS)) {
|
||||
pr_debug(DRV_NAME ": SMBus busy (%04x). Waiting... \n", temp);
|
||||
do {
|
||||
amd756_do_pause(1);
|
||||
i2c_delay(1);
|
||||
temp = inw_p(SMB_GLOBAL_STATUS);
|
||||
} while ((temp & (GS_HST_STS | GS_SMB_STS)) &&
|
||||
(timeout++ < MAX_TIMEOUT));
|
||||
@@ -149,7 +142,7 @@ static int amd756_transaction(void)
|
||||
|
||||
/* We will always wait for a fraction of a second! */
|
||||
do {
|
||||
amd756_do_pause(1);
|
||||
i2c_delay(1);
|
||||
temp = inw_p(SMB_GLOBAL_STATUS);
|
||||
} while ((temp & GS_HST_STS) && (timeout++ < MAX_TIMEOUT));
|
||||
|
||||
@@ -196,7 +189,7 @@ static int amd756_transaction(void)
|
||||
abort:
|
||||
printk(KERN_WARNING DRV_NAME ": Sending abort.\n");
|
||||
outw_p(inw(SMB_GLOBAL_ENABLE) | GE_ABORT, SMB_GLOBAL_ENABLE);
|
||||
amd756_do_pause(100);
|
||||
i2c_delay(100);
|
||||
outw_p(GS_CLEAR_STS, SMB_GLOBAL_STATUS);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -281,8 +281,7 @@ s32 amd8111_access(struct i2c_adapter * adap, u16 addr, unsigned short flags,
|
||||
}
|
||||
|
||||
if (~temp[0] & AMD_SMB_STS_DONE) {
|
||||
current->state = TASK_INTERRUPTIBLE;
|
||||
schedule_timeout(HZ/100);
|
||||
i2c_delay(HZ/100);
|
||||
amd_ec_read(smbus, AMD_SMB_STS, temp + 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -110,7 +110,6 @@ MODULE_PARM_DESC(force_addr,
|
||||
"Forcibly enable the I801 at the given address. "
|
||||
"EXTREMELY DANGEROUS!");
|
||||
|
||||
static void i801_do_pause(unsigned int amount);
|
||||
static int i801_transaction(void);
|
||||
static int i801_block_transaction(union i2c_smbus_data *data,
|
||||
char read_write, int command);
|
||||
@@ -186,12 +185,6 @@ END:
|
||||
}
|
||||
|
||||
|
||||
static void i801_do_pause(unsigned int amount)
|
||||
{
|
||||
current->state = TASK_INTERRUPTIBLE;
|
||||
schedule_timeout(amount);
|
||||
}
|
||||
|
||||
static int i801_transaction(void)
|
||||
{
|
||||
int temp;
|
||||
@@ -221,7 +214,7 @@ static int i801_transaction(void)
|
||||
|
||||
/* We will always wait for a fraction of a second! */
|
||||
do {
|
||||
i801_do_pause(1);
|
||||
i2c_delay(1);
|
||||
temp = inb_p(SMBHSTSTS);
|
||||
} while ((temp & 0x01) && (timeout++ < MAX_TIMEOUT));
|
||||
|
||||
@@ -349,7 +342,7 @@ static int i801_block_transaction(union i2c_smbus_data *data, char read_write,
|
||||
timeout = 0;
|
||||
do {
|
||||
temp = inb_p(SMBHSTSTS);
|
||||
i801_do_pause(1);
|
||||
i2c_delay(1);
|
||||
}
|
||||
while ((!(temp & 0x80))
|
||||
&& (timeout++ < MAX_TIMEOUT));
|
||||
@@ -409,7 +402,7 @@ static int i801_block_transaction(union i2c_smbus_data *data, char read_write,
|
||||
timeout = 0;
|
||||
do {
|
||||
temp = inb_p(SMBHSTSTS);
|
||||
i801_do_pause(1);
|
||||
i2c_delay(1);
|
||||
} while ((!(temp & 0x02))
|
||||
&& (timeout++ < MAX_TIMEOUT));
|
||||
|
||||
|
||||
@@ -112,9 +112,6 @@ struct nforce2_smbus {
|
||||
static s32 nforce2_access(struct i2c_adapter *adap, u16 addr,
|
||||
unsigned short flags, char read_write,
|
||||
u8 command, int size, union i2c_smbus_data *data);
|
||||
#if 0
|
||||
static void nforce2_do_pause(unsigned int amount);
|
||||
#endif
|
||||
/*
|
||||
static int nforce2_block_transaction(union i2c_smbus_data *data,
|
||||
char read_write, int i2c_enable);
|
||||
@@ -129,17 +126,6 @@ static struct i2c_algorithm smbus_algorithm = {
|
||||
.functionality = nforce2_func,
|
||||
};
|
||||
|
||||
|
||||
|
||||
#if 0
|
||||
/* Internally used pause function */
|
||||
void nforce2_do_pause(unsigned int amount)
|
||||
{
|
||||
current->state = TASK_INTERRUPTIBLE;
|
||||
schedule_timeout(amount);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Return -1 on error. See smbus.h for more information */
|
||||
s32 nforce2_access(struct i2c_adapter * adap, u16 addr, unsigned short flags,
|
||||
char read_write, u8 command, int size,
|
||||
@@ -250,7 +236,7 @@ s32 nforce2_access(struct i2c_adapter * adap, u16 addr, unsigned short flags,
|
||||
|
||||
#if 0
|
||||
do {
|
||||
nforce2_do_pause(1);
|
||||
i2c_delay(1);
|
||||
temp = inb_p(NVIDIA_SMB_STS);
|
||||
} while (((temp & NVIDIA_SMB_STS_DONE) == 0) && (timeout++ < MAX_TIMEOUT));
|
||||
#endif
|
||||
@@ -259,8 +245,7 @@ s32 nforce2_access(struct i2c_adapter * adap, u16 addr, unsigned short flags,
|
||||
temp = inb_p(NVIDIA_SMB_STS);
|
||||
}
|
||||
if (~temp & NVIDIA_SMB_STS_DONE) {
|
||||
current->state = TASK_INTERRUPTIBLE;
|
||||
schedule_timeout(HZ/100);
|
||||
i2c_delay(HZ/100);
|
||||
temp = inb_p(NVIDIA_SMB_STS);
|
||||
}
|
||||
|
||||
|
||||
@@ -100,7 +100,6 @@ MODULE_PARM_DESC(force_addr,
|
||||
"Forcibly enable the PIIX4 at the given address. "
|
||||
"EXTREMELY DANGEROUS!");
|
||||
|
||||
static void piix4_do_pause(unsigned int amount);
|
||||
static int piix4_transaction(void);
|
||||
|
||||
|
||||
@@ -235,13 +234,6 @@ static int piix4_setup(struct pci_dev *PIIX4_dev, const struct pci_device_id *id
|
||||
}
|
||||
|
||||
|
||||
/* Internally used pause function */
|
||||
void piix4_do_pause(unsigned int amount)
|
||||
{
|
||||
current->state = TASK_INTERRUPTIBLE;
|
||||
schedule_timeout(amount);
|
||||
}
|
||||
|
||||
/* Another internally used function */
|
||||
int piix4_transaction(void)
|
||||
{
|
||||
@@ -280,7 +272,7 @@ int piix4_transaction(void)
|
||||
|
||||
/* We will always wait for a fraction of a second! (See PIIX4 docs errata) */
|
||||
do {
|
||||
piix4_do_pause(1);
|
||||
i2c_delay(1);
|
||||
temp = inb_p(SMBHSTSTS);
|
||||
} while ((temp & 0x01) && (timeout++ < MAX_TIMEOUT));
|
||||
|
||||
|
||||
@@ -131,7 +131,6 @@ MODULE_PARM(force_addr, "i");
|
||||
MODULE_PARM_DESC(force_addr,
|
||||
"Initialize the base address of the i2c controller");
|
||||
|
||||
static void sis5595_do_pause(unsigned int amount);
|
||||
static int sis5595_transaction(void);
|
||||
|
||||
static unsigned short sis5595_base = 0;
|
||||
@@ -228,13 +227,6 @@ int sis5595_setup(struct pci_dev *SIS5595_dev)
|
||||
}
|
||||
|
||||
|
||||
/* Internally used pause function */
|
||||
void sis5595_do_pause(unsigned int amount)
|
||||
{
|
||||
current->state = TASK_INTERRUPTIBLE;
|
||||
schedule_timeout(amount);
|
||||
}
|
||||
|
||||
/* Another internally used function */
|
||||
int sis5595_transaction(void)
|
||||
{
|
||||
@@ -273,7 +265,7 @@ int sis5595_transaction(void)
|
||||
|
||||
/* We will always wait for a fraction of a second! */
|
||||
do {
|
||||
sis5595_do_pause(1);
|
||||
i2c_delay(1);
|
||||
temp = sis5595_read(SMB_STS_LO);
|
||||
} while (!(temp & 0x40) && (timeout++ < MAX_TIMEOUT));
|
||||
|
||||
|
||||
@@ -127,14 +127,6 @@ static inline void sis630_write(u8 reg, u8 data) {
|
||||
outb(data, acpi_base + reg);
|
||||
}
|
||||
|
||||
/* Internally used pause function */
|
||||
static void sis630_do_pause(unsigned int amount)
|
||||
{
|
||||
current->state = TASK_INTERRUPTIBLE;
|
||||
schedule_timeout(amount);
|
||||
}
|
||||
|
||||
|
||||
static int sis630_transaction_start(int size, u8 *oldclock) {
|
||||
int temp;
|
||||
|
||||
@@ -180,7 +172,7 @@ static int sis630_transaction_wait(int size) {
|
||||
|
||||
/* We will always wait for a fraction of a second! */
|
||||
do {
|
||||
sis630_do_pause(1);
|
||||
i2c_delay(1);
|
||||
temp = sis630_read(SMB_STS);
|
||||
/* check if block transmitted */
|
||||
if (size == SIS630_BLOCK_DATA && (temp & 0x10))
|
||||
|
||||
@@ -294,13 +294,6 @@ static int __devinit sis645_hotplug_smbus(void)
|
||||
}
|
||||
#endif /* CONFIG_HOTPLUG */
|
||||
|
||||
/* Internally used pause function */
|
||||
static void sis645_do_pause(unsigned int amount)
|
||||
{
|
||||
current->state = TASK_INTERRUPTIBLE;
|
||||
schedule_timeout(amount);
|
||||
}
|
||||
|
||||
/* Execute a SMBus transaction.
|
||||
int size is from SIS645_QUICK to SIS645_BLOCK_DATA
|
||||
*/
|
||||
@@ -345,7 +338,7 @@ static int sis645_transaction(int size)
|
||||
|
||||
/* We will always wait for a fraction of a second! */
|
||||
do {
|
||||
sis645_do_pause(1);
|
||||
i2c_delay(1);
|
||||
temp = sis645_read(SMB_STS);
|
||||
} while (!(temp & 0x0e) && (timeout++ < MAX_TIMEOUT));
|
||||
|
||||
|
||||
@@ -105,13 +105,6 @@ MODULE_PARM_DESC(force_addr,
|
||||
|
||||
static struct i2c_adapter vt596_adapter;
|
||||
|
||||
/* Internally used pause function */
|
||||
static void vt596_do_pause(unsigned int amount)
|
||||
{
|
||||
current->state = TASK_INTERRUPTIBLE;
|
||||
schedule_timeout(amount);
|
||||
}
|
||||
|
||||
/* Another internally used function */
|
||||
static int vt596_transaction(void)
|
||||
{
|
||||
@@ -145,7 +138,7 @@ static int vt596_transaction(void)
|
||||
/* We will always wait for a fraction of a second!
|
||||
I don't know if VIA needs this, Intel did */
|
||||
do {
|
||||
vt596_do_pause(1);
|
||||
i2c_delay(1);
|
||||
temp = inb_p(SMBHSTSTS);
|
||||
} while ((temp & 0x01) && (timeout++ < MAX_TIMEOUT));
|
||||
|
||||
|
||||
Reference in new issue
Block a user