Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
051efe45
Commit
051efe45
authored
Jul 18, 2003
by
Greg Kroah-Hartman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] I2C: consolidate the i2c delay functions.
parent
943295a9
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
21 additions
and
66 deletions
+21
-66
drivers/i2c/busses/i2c-ali1535.c
drivers/i2c/busses/i2c-ali1535.c
+2
-8
drivers/i2c/busses/i2c-ali15x3.c
drivers/i2c/busses/i2c-ali15x3.c
+2
-9
drivers/i2c/busses/i2c-amd756.c
drivers/i2c/busses/i2c-amd756.c
+3
-11
drivers/i2c/busses/i2c-amd8111.c
drivers/i2c/busses/i2c-amd8111.c
+1
-2
drivers/i2c/busses/i2c-i801.c
drivers/i2c/busses/i2c-i801.c
+3
-11
drivers/i2c/busses/i2c-piix4.c
drivers/i2c/busses/i2c-piix4.c
+1
-9
drivers/i2c/busses/i2c-sis96x.c
drivers/i2c/busses/i2c-sis96x.c
+1
-8
drivers/i2c/busses/i2c-viapro.c
drivers/i2c/busses/i2c-viapro.c
+1
-8
include/linux/i2c.h
include/linux/i2c.h
+7
-0
No files found.
drivers/i2c/busses/i2c-ali1535.c
View file @
051efe45
...
...
@@ -206,12 +206,6 @@ static int ali1535_setup(struct pci_dev *dev)
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
;
...
...
@@ -283,7 +277,7 @@ static int ali1535_transaction(struct i2c_adapter *adap)
/* 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
));
...
...
@@ -357,7 +351,7 @@ static 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
)
...
...
drivers/i2c/busses/i2c-ali15x3.c
View file @
051efe45
...
...
@@ -225,13 +225,6 @@ static int ali15x3_setup(struct pci_dev *ALI15X3_dev)
return
-
ENODEV
;
}
/* 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
)
{
...
...
@@ -304,7 +297,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
));
...
...
@@ -361,7 +354,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
)
{
...
...
drivers/i2c/busses/i2c-amd756.c
View file @
051efe45
...
...
@@ -93,14 +93,6 @@ static unsigned short amd756_ioport = 0;
see E0 for the status bits and enabled in E2
*/
/* 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 +124,7 @@ static int amd756_transaction(struct i2c_adapter *adap)
if
((
temp
=
inw_p
(
SMB_GLOBAL_STATUS
))
&
(
GS_HST_STS
|
GS_SMB_STS
))
{
dev_dbg
(
&
adap
->
dev
,
": 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 +141,7 @@ static int amd756_transaction(struct i2c_adapter *adap)
/* 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 +188,7 @@ static int amd756_transaction(struct i2c_adapter *adap)
abort:
dev_warn
(
&
adap
->
dev
,
": 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
;
}
...
...
drivers/i2c/busses/i2c-amd8111.c
View file @
051efe45
...
...
@@ -275,8 +275,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
);
}
...
...
drivers/i2c/busses/i2c-i801.c
View file @
051efe45
...
...
@@ -103,7 +103,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
);
...
...
@@ -178,13 +177,6 @@ static int i801_setup(struct pci_dev *dev)
return
error_return
;
}
static
void
i801_do_pause
(
unsigned
int
amount
)
{
current
->
state
=
TASK_INTERRUPTIBLE
;
schedule_timeout
(
amount
);
}
static
int
i801_transaction
(
void
)
{
int
temp
;
...
...
@@ -214,7 +206,7 @@ static int i801_transaction(void)
/* We will always wait for a fraction of a second! */
do
{
i
801_do_pause
(
1
);
i
2c_delay
(
1
);
temp
=
inb_p
(
SMBHSTSTS
);
}
while
((
temp
&
0x01
)
&&
(
timeout
++
<
MAX_TIMEOUT
));
...
...
@@ -342,7 +334,7 @@ static int i801_block_transaction(union i2c_smbus_data *data, char read_write,
timeout
=
0
;
do
{
temp
=
inb_p
(
SMBHSTSTS
);
i
801_do_pause
(
1
);
i
2c_delay
(
1
);
}
while
((
!
(
temp
&
0x80
))
&&
(
timeout
++
<
MAX_TIMEOUT
));
...
...
@@ -402,7 +394,7 @@ static int i801_block_transaction(union i2c_smbus_data *data, char read_write,
timeout
=
0
;
do
{
temp
=
inb_p
(
SMBHSTSTS
);
i
801_do_pause
(
1
);
i
2c_delay
(
1
);
}
while
((
!
(
temp
&
0x02
))
&&
(
timeout
++
<
MAX_TIMEOUT
));
...
...
drivers/i2c/busses/i2c-piix4.c
View file @
051efe45
...
...
@@ -99,7 +99,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
);
...
...
@@ -208,13 +207,6 @@ static int piix4_setup(struct pci_dev *PIIX4_dev, const struct pci_device_id *id
return
error_return
;
}
/* Internally used pause function */
static
void
piix4_do_pause
(
unsigned
int
amount
)
{
current
->
state
=
TASK_INTERRUPTIBLE
;
schedule_timeout
(
amount
);
}
/* Another internally used function */
static
int
piix4_transaction
(
void
)
{
...
...
@@ -245,7 +237,7 @@ static 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
));
...
...
drivers/i2c/busses/i2c-sis96x.c
View file @
051efe45
...
...
@@ -99,13 +99,6 @@ static inline void sis96x_write(u8 reg, u8 data)
outb
(
data
,
sis96x_smbus_base
+
reg
)
;
}
/* Internally used pause function */
static
void
sis96x_do_pause
(
unsigned
int
amount
)
{
current
->
state
=
TASK_INTERRUPTIBLE
;
schedule_timeout
(
amount
);
}
/* Execute a SMBus transaction.
int size is from SIS96x_QUICK to SIS96x_BLOCK_DATA
*/
...
...
@@ -147,7 +140,7 @@ static int sis96x_transaction(int size)
/* We will always wait for a fraction of a second! */
do
{
sis96x_do_pause
(
1
);
i2c_delay
(
1
);
temp
=
sis96x_read
(
SMB_STS
);
}
while
(
!
(
temp
&
0x0e
)
&&
(
timeout
++
<
MAX_TIMEOUT
));
...
...
drivers/i2c/busses/i2c-viapro.c
View file @
051efe45
...
...
@@ -103,13 +103,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
)
{
...
...
@@ -143,7 +136,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
));
...
...
include/linux/i2c.h
View file @
051efe45
...
...
@@ -594,4 +594,11 @@ union i2c_smbus_data {
#define i2c_is_isa_adapter(adapptr) \
((adapptr)->algo->id == I2C_ALGO_ISA)
/* Tiny delay function used by the i2c bus drivers */
static
inline
void
i2c_delay
(
signed
long
timeout
)
{
set_current_state
(
TASK_INTERRUPTIBLE
);
schedule_timeout
(
timeout
);
}
#endif
/* _LINUX_I2C_H */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment