mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-03-26 17:05:29 +00:00
Merge branch 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux
Pull i2c bugfixes from Wolfram Sang: "Two bugfixes (proper IO mapping and use of mutex) for a driver feature we introduced in this cycle" * 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: i2c: piix4: Request the SMBUS semaphore inside the mutex i2c: piix4: Fix request_region size
This commit is contained in:
commit
aca9fa0c8d
1 changed files with 8 additions and 6 deletions
|
@ -58,7 +58,7 @@
|
||||||
#define SMBSLVDAT (0xC + piix4_smba)
|
#define SMBSLVDAT (0xC + piix4_smba)
|
||||||
|
|
||||||
/* count for request_region */
|
/* count for request_region */
|
||||||
#define SMBIOSIZE 8
|
#define SMBIOSIZE 9
|
||||||
|
|
||||||
/* PCI Address Constants */
|
/* PCI Address Constants */
|
||||||
#define SMBBA 0x090
|
#define SMBBA 0x090
|
||||||
|
@ -592,6 +592,8 @@ static s32 piix4_access_sb800(struct i2c_adapter *adap, u16 addr,
|
||||||
u8 port;
|
u8 port;
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
|
mutex_lock(&piix4_mutex_sb800);
|
||||||
|
|
||||||
/* Request the SMBUS semaphore, avoid conflicts with the IMC */
|
/* Request the SMBUS semaphore, avoid conflicts with the IMC */
|
||||||
smbslvcnt = inb_p(SMBSLVCNT);
|
smbslvcnt = inb_p(SMBSLVCNT);
|
||||||
do {
|
do {
|
||||||
|
@ -605,10 +607,10 @@ static s32 piix4_access_sb800(struct i2c_adapter *adap, u16 addr,
|
||||||
usleep_range(1000, 2000);
|
usleep_range(1000, 2000);
|
||||||
} while (--retries);
|
} while (--retries);
|
||||||
/* SMBus is still owned by the IMC, we give up */
|
/* SMBus is still owned by the IMC, we give up */
|
||||||
if (!retries)
|
if (!retries) {
|
||||||
|
mutex_unlock(&piix4_mutex_sb800);
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
|
}
|
||||||
mutex_lock(&piix4_mutex_sb800);
|
|
||||||
|
|
||||||
outb_p(piix4_port_sel_sb800, SB800_PIIX4_SMB_IDX);
|
outb_p(piix4_port_sel_sb800, SB800_PIIX4_SMB_IDX);
|
||||||
smba_en_lo = inb_p(SB800_PIIX4_SMB_IDX + 1);
|
smba_en_lo = inb_p(SB800_PIIX4_SMB_IDX + 1);
|
||||||
|
@ -623,11 +625,11 @@ static s32 piix4_access_sb800(struct i2c_adapter *adap, u16 addr,
|
||||||
|
|
||||||
outb_p(smba_en_lo, SB800_PIIX4_SMB_IDX + 1);
|
outb_p(smba_en_lo, SB800_PIIX4_SMB_IDX + 1);
|
||||||
|
|
||||||
mutex_unlock(&piix4_mutex_sb800);
|
|
||||||
|
|
||||||
/* Release the semaphore */
|
/* Release the semaphore */
|
||||||
outb_p(smbslvcnt | 0x20, SMBSLVCNT);
|
outb_p(smbslvcnt | 0x20, SMBSLVCNT);
|
||||||
|
|
||||||
|
mutex_unlock(&piix4_mutex_sb800);
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue