aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/i2c/busses/i2c-i8013
-rw-r--r--drivers/i2c/busses/i2c-i801.c35
2 files changed, 8 insertions, 30 deletions
diff --git a/Documentation/i2c/busses/i2c-i801 b/Documentation/i2c/busses/i2c-i801
index fd4b2712d570..e46c23458242 100644
--- a/Documentation/i2c/busses/i2c-i801
+++ b/Documentation/i2c/busses/i2c-i801
@@ -21,8 +21,7 @@ Authors:
21Module Parameters 21Module Parameters
22----------------- 22-----------------
23 23
24* force_addr: int 24None.
25 Forcibly enable the ICH at the given address. EXTREMELY DANGEROUS!
26 25
27 26
28Description 27Description
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
index 4396dc91d5f5..0d5374cce9cc 100644
--- a/drivers/i2c/busses/i2c-i801.c
+++ b/drivers/i2c/busses/i2c-i801.c
@@ -92,15 +92,6 @@
92#define I801_START 0x40 92#define I801_START 0x40
93#define I801_PEC_EN 0x80 /* ICH4 only */ 93#define I801_PEC_EN 0x80 /* ICH4 only */
94 94
95/* insmod parameters */
96
97/* If force_addr is set to anything different from 0, we forcibly enable
98 the I801 at the given address. VERY DANGEROUS! */
99static u16 force_addr;
100module_param(force_addr, ushort, 0);
101MODULE_PARM_DESC(force_addr,
102 "Forcibly enable the I801 at the given address. "
103 "EXTREMELY DANGEROUS!");
104 95
105static int i801_transaction(void); 96static int i801_transaction(void);
106static int i801_block_transaction(union i2c_smbus_data *data, char read_write, 97static int i801_block_transaction(union i2c_smbus_data *data, char read_write,
@@ -129,16 +120,12 @@ static int i801_setup(struct pci_dev *dev)
129 isich4 = 0; 120 isich4 = 0;
130 121
131 /* Determine the address of the SMBus areas */ 122 /* Determine the address of the SMBus areas */
132 if (force_addr) { 123 pci_read_config_word(I801_dev, SMBBA, &i801_smba);
133 i801_smba = force_addr & 0xfff0; 124 i801_smba &= 0xfff0;
134 } else { 125 if (!i801_smba) {
135 pci_read_config_word(I801_dev, SMBBA, &i801_smba); 126 dev_err(&dev->dev, "SMBus base address uninitialized, "
136 i801_smba &= 0xfff0; 127 "upgrade BIOS\n");
137 if(i801_smba == 0) { 128 return -ENODEV;
138 dev_err(&dev->dev, "SMB base address uninitialized "
139 "- upgrade BIOS or use force_addr=0xaddr\n");
140 return -ENODEV;
141 }
142 } 129 }
143 130
144 if (!request_region(i801_smba, (isich4 ? 16 : 8), i801_driver.name)) { 131 if (!request_region(i801_smba, (isich4 ? 16 : 8), i801_driver.name)) {
@@ -152,15 +139,7 @@ static int i801_setup(struct pci_dev *dev)
152 temp &= ~SMBHSTCFG_I2C_EN; /* SMBus timing */ 139 temp &= ~SMBHSTCFG_I2C_EN; /* SMBus timing */
153 pci_write_config_byte(I801_dev, SMBHSTCFG, temp); 140 pci_write_config_byte(I801_dev, SMBHSTCFG, temp);
154 141
155 /* If force_addr is set, we program the new address here. Just to make 142 if (!(temp & 1)) {
156 sure, we disable the device first. */
157 if (force_addr) {
158 pci_write_config_byte(I801_dev, SMBHSTCFG, temp & 0xfe);
159 pci_write_config_word(I801_dev, SMBBA, i801_smba);
160 pci_write_config_byte(I801_dev, SMBHSTCFG, temp | 0x01);
161 dev_warn(&dev->dev, "WARNING: I801 SMBus interface set to "
162 "new address %04x!\n", i801_smba);
163 } else if ((temp & 1) == 0) {
164 pci_write_config_byte(I801_dev, SMBHSTCFG, temp | 1); 143 pci_write_config_byte(I801_dev, SMBHSTCFG, temp | 1);
165 dev_warn(&dev->dev, "enabling SMBus device\n"); 144 dev_warn(&dev->dev, "enabling SMBus device\n");
166 } 145 }