i2c-piix4.c (02e0c5d5c2e00374b6808a42f8eea4ea9baaa216) i2c-piix4.c (54aaa1ca1022d95d854315743241bb6bf59f531f)
1/*
2 piix4.c - Part of lm_sensors, Linux kernel modules for hardware
3 monitoring
4 Copyright (c) 1998 - 2002 Frodo Looijaard <frodol@dds.nl> and
5 Philip Edelbrock <phil@netroedge.com>
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by

--- 88 unchanged lines hidden (view full) ---

97/* If force_addr is set to anything different from 0, we forcibly enable
98 the PIIX4 at the given address. VERY DANGEROUS! */
99static int force_addr;
100module_param (force_addr, int, 0);
101MODULE_PARM_DESC(force_addr,
102 "Forcibly enable the PIIX4 at the given address. "
103 "EXTREMELY DANGEROUS!");
104
1/*
2 piix4.c - Part of lm_sensors, Linux kernel modules for hardware
3 monitoring
4 Copyright (c) 1998 - 2002 Frodo Looijaard <frodol@dds.nl> and
5 Philip Edelbrock <phil@netroedge.com>
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by

--- 88 unchanged lines hidden (view full) ---

97/* If force_addr is set to anything different from 0, we forcibly enable
98 the PIIX4 at the given address. VERY DANGEROUS! */
99static int force_addr;
100module_param (force_addr, int, 0);
101MODULE_PARM_DESC(force_addr,
102 "Forcibly enable the PIIX4 at the given address. "
103 "EXTREMELY DANGEROUS!");
104
105/* If fix_hstcfg is set to anything different from 0, we reset one of the
106 registers to be a valid value. */
107static int fix_hstcfg;
108module_param (fix_hstcfg, int, 0);
109MODULE_PARM_DESC(fix_hstcfg,
110 "Fix config register. Needed on some boards (Force CPCI735).");
111
112static int piix4_transaction(void);
113
114static unsigned short piix4_smba;
115static struct pci_driver piix4_driver;
116static struct i2c_adapter piix4_adapter;
117
118static struct dmi_system_id __devinitdata piix4_dmi_table[] = {
119 {

--- 41 unchanged lines hidden (view full) ---

161 if (!request_region(piix4_smba, SMBIOSIZE, piix4_driver.name)) {
162 dev_err(&PIIX4_dev->dev, "SMB region 0x%x already in use!\n",
163 piix4_smba);
164 return -ENODEV;
165 }
166
167 pci_read_config_byte(PIIX4_dev, SMBHSTCFG, &temp);
168
105static int piix4_transaction(void);
106
107static unsigned short piix4_smba;
108static struct pci_driver piix4_driver;
109static struct i2c_adapter piix4_adapter;
110
111static struct dmi_system_id __devinitdata piix4_dmi_table[] = {
112 {

--- 41 unchanged lines hidden (view full) ---

154 if (!request_region(piix4_smba, SMBIOSIZE, piix4_driver.name)) {
155 dev_err(&PIIX4_dev->dev, "SMB region 0x%x already in use!\n",
156 piix4_smba);
157 return -ENODEV;
158 }
159
160 pci_read_config_byte(PIIX4_dev, SMBHSTCFG, &temp);
161
169 /* Some BIOS will set up the chipset incorrectly and leave a register
170 in an undefined state (causing I2C to act very strangely). */
171 if (temp & 0x02) {
172 if (fix_hstcfg) {
173 dev_info(&PIIX4_dev->dev, "Working around buggy BIOS "
174 "(I2C)\n");
175 temp &= 0xfd;
176 pci_write_config_byte(PIIX4_dev, SMBHSTCFG, temp);
177 } else {
178 dev_info(&PIIX4_dev->dev, "Unusual config register "
179 "value\n");
180 dev_info(&PIIX4_dev->dev, "Try using fix_hstcfg=1 if "
181 "you experience problems\n");
182 }
183 }
184
185 /* If force_addr is set, we program the new address here. Just to make
186 sure, we disable the PIIX4 first. */
187 if (force_addr) {
188 pci_write_config_byte(PIIX4_dev, SMBHSTCFG, temp & 0xfe);
189 pci_write_config_word(PIIX4_dev, SMBBA, piix4_smba);
190 pci_write_config_byte(PIIX4_dev, SMBHSTCFG, temp | 0x01);
191 dev_info(&PIIX4_dev->dev, "WARNING: SMBus interface set to "
192 "new address %04x!\n", piix4_smba);

--- 16 unchanged lines hidden (view full) ---

209 dev_err(&PIIX4_dev->dev,
210 "Host SMBus controller not enabled!\n");
211 release_region(piix4_smba, SMBIOSIZE);
212 piix4_smba = 0;
213 return -ENODEV;
214 }
215 }
216
162 /* If force_addr is set, we program the new address here. Just to make
163 sure, we disable the PIIX4 first. */
164 if (force_addr) {
165 pci_write_config_byte(PIIX4_dev, SMBHSTCFG, temp & 0xfe);
166 pci_write_config_word(PIIX4_dev, SMBBA, piix4_smba);
167 pci_write_config_byte(PIIX4_dev, SMBHSTCFG, temp | 0x01);
168 dev_info(&PIIX4_dev->dev, "WARNING: SMBus interface set to "
169 "new address %04x!\n", piix4_smba);

--- 16 unchanged lines hidden (view full) ---

186 dev_err(&PIIX4_dev->dev,
187 "Host SMBus controller not enabled!\n");
188 release_region(piix4_smba, SMBIOSIZE);
189 piix4_smba = 0;
190 return -ENODEV;
191 }
192 }
193
217 if ((temp & 0x0E) == 8)
194 if (((temp & 0x0E) == 8) || ((temp & 0x0E) == 2))
218 dev_dbg(&PIIX4_dev->dev, "Using Interrupt 9 for SMBus.\n");
219 else if ((temp & 0x0E) == 0)
220 dev_dbg(&PIIX4_dev->dev, "Using Interrupt SMI# for SMBus.\n");
221 else
222 dev_err(&PIIX4_dev->dev, "Illegal Interrupt configuration "
223 "(or code out of date)!\n");
224
225 pci_read_config_byte(PIIX4_dev, SMBREV, &temp);

--- 270 unchanged lines hidden ---
195 dev_dbg(&PIIX4_dev->dev, "Using Interrupt 9 for SMBus.\n");
196 else if ((temp & 0x0E) == 0)
197 dev_dbg(&PIIX4_dev->dev, "Using Interrupt SMI# for SMBus.\n");
198 else
199 dev_err(&PIIX4_dev->dev, "Illegal Interrupt configuration "
200 "(or code out of date)!\n");
201
202 pci_read_config_byte(PIIX4_dev, SMBREV, &temp);

--- 270 unchanged lines hidden ---