aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c
diff options
context:
space:
mode:
authorJean Delvare <jdelvare@suse.de>2014-11-12 04:25:37 -0500
committerWolfram Sang <wsa@the-dreams.de>2014-11-12 10:26:41 -0500
commitaeb8a3d16ae0faceeae77adde2d3f9f2b199f4d9 (patch)
tree7ab95cb3f0ca822ebf8f95b3a2c0b54b24ae1310 /drivers/i2c
parentae9447171748180d4e946839c5eed6123f07f943 (diff)
i2c: i801: Check if interrupts are disabled
There is a control bit in the PCI configuration space which disables interrupts. If this bit is set, the driver should not try to make use of interrupts, it won't receive any. Signed-off-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/busses/i2c-i801.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
index a6f3bc38fbe5..3f1f30313cd7 100644
--- a/drivers/i2c/busses/i2c-i801.c
+++ b/drivers/i2c/busses/i2c-i801.c
@@ -109,12 +109,16 @@
109 109
110/* PCI Address Constants */ 110/* PCI Address Constants */
111#define SMBBAR 4 111#define SMBBAR 4
112#define SMBPCICTL 0x004
112#define SMBPCISTS 0x006 113#define SMBPCISTS 0x006
113#define SMBHSTCFG 0x040 114#define SMBHSTCFG 0x040
114 115
115/* Host status bits for SMBPCISTS */ 116/* Host status bits for SMBPCISTS */
116#define SMBPCISTS_INTS 0x08 117#define SMBPCISTS_INTS 0x08
117 118
119/* Control bits for SMBPCICTL */
120#define SMBPCICTL_INTDIS 0x0400
121
118/* Host configuration bits for SMBHSTCFG */ 122/* Host configuration bits for SMBHSTCFG */
119#define SMBHSTCFG_HST_EN 1 123#define SMBHSTCFG_HST_EN 1
120#define SMBHSTCFG_SMB_SMI_EN 2 124#define SMBHSTCFG_SMB_SMI_EN 2
@@ -1232,6 +1236,22 @@ static int i801_probe(struct pci_dev *dev, const struct pci_device_id *id)
1232 priv->adapter.timeout = HZ / 5; 1236 priv->adapter.timeout = HZ / 5;
1233 1237
1234 if (priv->features & FEATURE_IRQ) { 1238 if (priv->features & FEATURE_IRQ) {
1239 u16 pcictl, pcists;
1240
1241 /* Complain if an interrupt is already pending */
1242 pci_read_config_word(priv->pci_dev, SMBPCISTS, &pcists);
1243 if (pcists & SMBPCISTS_INTS)
1244 dev_warn(&dev->dev, "An interrupt is pending!\n");
1245
1246 /* Check if interrupts have been disabled */
1247 pci_read_config_word(priv->pci_dev, SMBPCICTL, &pcictl);
1248 if (pcictl & SMBPCICTL_INTDIS) {
1249 dev_info(&dev->dev, "Interrupts are disabled\n");
1250 priv->features &= ~FEATURE_IRQ;
1251 }
1252 }
1253
1254 if (priv->features & FEATURE_IRQ) {
1235 init_waitqueue_head(&priv->waitq); 1255 init_waitqueue_head(&priv->waitq);
1236 1256
1237 err = request_irq(dev->irq, i801_isr, IRQF_SHARED, 1257 err = request_irq(dev->irq, i801_isr, IRQF_SHARED,