]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/i2c/busses/i2c-i801.c
i2c-i801: Remove verbose debugging messages
[linux-2.6-omap-h63xx.git] / drivers / i2c / busses / i2c-i801.c
index aa9157913b9addd98182a0b5f16cd92cd0b80ea3..965905fb5d56220992d4f97a7e248916fe1e1b2f 100644 (file)
@@ -40,7 +40,9 @@
   82801G   (ICH7)       0x27da     32     hard     yes     yes     yes
   82801H   (ICH8)       0x283e     32     hard     yes     yes     yes
   82801I   (ICH9)       0x2930     32     hard     yes     yes     yes
-  Tolapai               0x5032     32     hard     yes     ?       ?
+  Tolapai               0x5032     32     hard     yes     yes     yes
+  ICH10                 0x3a30     32     hard     yes     yes     yes
+  ICH10                 0x3a60     32     hard     yes     yes     yes
 
   Features supported by this driver:
   Software PEC                     no
@@ -136,11 +138,6 @@ static int i801_transaction(int xact)
        int result = 0;
        int timeout = 0;
 
-       dev_dbg(&I801_dev->dev, "Transaction (pre): CNT=%02x, CMD=%02x, "
-               "ADD=%02x, DAT0=%02x, DAT1=%02x\n", inb_p(SMBHSTCNT),
-               inb_p(SMBHSTCMD), inb_p(SMBHSTADD), inb_p(SMBHSTDAT0),
-               inb_p(SMBHSTDAT1));
-
        /* Make sure the SMBus host is ready to start transmitting */
        /* 0x1f = Failed, Bus_Err, Dev_Err, Intr, Host_Busy */
        if ((temp = (0x1f & inb_p(SMBHSTSTS))) != 0x00) {
@@ -149,7 +146,7 @@ static int i801_transaction(int xact)
                outb_p(temp, SMBHSTSTS);
                if ((temp = (0x1f & inb_p(SMBHSTSTS))) != 0x00) {
                        dev_dbg(&I801_dev->dev, "Failed! (%02x)\n", temp);
-                       return -1;
+                       return -EBUSY;
                } else {
                        dev_dbg(&I801_dev->dev, "Successful!\n");
                }
@@ -168,7 +165,7 @@ static int i801_transaction(int xact)
        /* If the SMBus is still busy, we give up */
        if (timeout >= MAX_TIMEOUT) {
                dev_dbg(&I801_dev->dev, "SMBus Timeout!\n");
-               result = -1;
+               result = -ETIMEDOUT;
                /* try to stop the current command */
                dev_dbg(&I801_dev->dev, "Terminating the current operation\n");
                outb_p(inb_p(SMBHSTCNT) | SMBHSTCNT_KILL, SMBHSTCNT);
@@ -177,19 +174,19 @@ static int i801_transaction(int xact)
        }
 
        if (temp & SMBHSTSTS_FAILED) {
-               result = -1;
+               result = -EIO;
                dev_dbg(&I801_dev->dev, "Error: Failed bus transaction\n");
        }
 
        if (temp & SMBHSTSTS_BUS_ERR) {
-               result = -1;
+               result = -EIO;
                dev_err(&I801_dev->dev, "Bus collision! SMBus may be locked "
                        "until next hard reset. (sorry!)\n");
                /* Clock stops and slave is stuck in mid-transmission */
        }
 
        if (temp & SMBHSTSTS_DEV_ERR) {
-               result = -1;
+               result = -ENXIO;
                dev_dbg(&I801_dev->dev, "Error: no response!\n");
        }
 
@@ -200,10 +197,6 @@ static int i801_transaction(int xact)
                dev_dbg(&I801_dev->dev, "Failed reset at end of transaction "
                        "(%02x)\n", temp);
        }
-       dev_dbg(&I801_dev->dev, "Transaction (post): CNT=%02x, CMD=%02x, "
-               "ADD=%02x, DAT0=%02x, DAT1=%02x\n", inb_p(SMBHSTCNT),
-               inb_p(SMBHSTCMD), inb_p(SMBHSTADD), inb_p(SMBHSTDAT0),
-               inb_p(SMBHSTDAT1));
        return result;
 }
 
@@ -229,6 +222,7 @@ static int i801_block_transaction_by_block(union i2c_smbus_data *data,
                                           char read_write, int hwpec)
 {
        int i, len;
+       int status;
 
        inb_p(SMBHSTCNT); /* reset the data buffer index */
 
@@ -240,14 +234,15 @@ static int i801_block_transaction_by_block(union i2c_smbus_data *data,
                        outb_p(data->block[i+1], SMBBLKDAT);
        }
 
-       if (i801_transaction(I801_BLOCK_DATA | ENABLE_INT9 |
-                            I801_PEC_EN * hwpec))
-               return -1;
+       status = i801_transaction(I801_BLOCK_DATA | ENABLE_INT9 |
+                                 I801_PEC_EN * hwpec);
+       if (status)
+               return status;
 
        if (read_write == I2C_SMBUS_READ) {
                len = inb_p(SMBHSTDAT0);
                if (len < 1 || len > I2C_SMBUS_BLOCK_MAX)
-                       return -1;
+                       return -EPROTO;
 
                data->block[0] = len;
                for (i = 0; i < len; i++)
@@ -289,11 +284,6 @@ static int i801_block_transaction_byte_by_byte(union i2c_smbus_data *data,
                }
                outb_p(smbcmd | ENABLE_INT9, SMBHSTCNT);
 
-               dev_dbg(&I801_dev->dev, "Block (pre %d): CNT=%02x, CMD=%02x, "
-                       "ADD=%02x, DAT0=%02x, DAT1=%02x, BLKDAT=%02x\n", i,
-                       inb_p(SMBHSTCNT), inb_p(SMBHSTCMD), inb_p(SMBHSTADD),
-                       inb_p(SMBHSTDAT0), inb_p(SMBHSTDAT1), inb_p(SMBBLKDAT));
-
                /* Make sure the SMBus host is ready to start transmitting */
                temp = inb_p(SMBHSTSTS);
                if (i == 1) {
@@ -312,11 +302,11 @@ static int i801_block_transaction_byte_by_byte(union i2c_smbus_data *data,
                        if (((temp = inb_p(SMBHSTSTS)) & errmask) != 0x00) {
                                dev_err(&I801_dev->dev,
                                        "Reset failed! (%02x)\n", temp);
-                               return -1;
+                               return -EBUSY;
                        }
                        if (i != 1)
                                /* if die in middle of block transaction, fail */
-                               return -1;
+                               return -EIO;
                }
 
                if (i == 1)
@@ -340,19 +330,19 @@ static int i801_block_transaction_byte_by_byte(union i2c_smbus_data *data,
                        msleep(1);
                        outb_p(inb_p(SMBHSTCNT) & (~SMBHSTCNT_KILL),
                                SMBHSTCNT);
-                       result = -1;
+                       result = -ETIMEDOUT;
                        dev_dbg(&I801_dev->dev, "SMBus Timeout!\n");
                }
 
                if (temp & SMBHSTSTS_FAILED) {
-                       result = -1;
+                       result = -EIO;
                        dev_dbg(&I801_dev->dev,
                                "Error: Failed bus transaction\n");
                } else if (temp & SMBHSTSTS_BUS_ERR) {
-                       result = -1;
+                       result = -EIO;
                        dev_err(&I801_dev->dev, "Bus collision!\n");
                } else if (temp & SMBHSTSTS_DEV_ERR) {
-                       result = -1;
+                       result = -ENXIO;
                        dev_dbg(&I801_dev->dev, "Error: no response!\n");
                }
 
@@ -360,7 +350,7 @@ static int i801_block_transaction_byte_by_byte(union i2c_smbus_data *data,
                 && command != I2C_SMBUS_I2C_BLOCK_DATA) {
                        len = inb_p(SMBHSTDAT0);
                        if (len < 1 || len > I2C_SMBUS_BLOCK_MAX)
-                               return -1;
+                               return -EPROTO;
                        data->block[0] = len;
                }
 
@@ -377,10 +367,6 @@ static int i801_block_transaction_byte_by_byte(union i2c_smbus_data *data,
                                "Bad status (%02x) at end of transaction\n",
                                temp);
                }
-               dev_dbg(&I801_dev->dev, "Block (post %d): CNT=%02x, CMD=%02x, "
-                       "ADD=%02x, DAT0=%02x, DAT1=%02x, BLKDAT=%02x\n", i,
-                       inb_p(SMBHSTCNT), inb_p(SMBHSTCMD), inb_p(SMBHSTADD),
-                       inb_p(SMBHSTDAT0), inb_p(SMBHSTDAT1), inb_p(SMBBLKDAT));
 
                if (result < 0)
                        return result;
@@ -392,7 +378,7 @@ static int i801_set_block_buffer_mode(void)
 {
        outb_p(inb_p(SMBAUXCTL) | SMBAUXCTL_E32B, SMBAUXCTL);
        if ((inb_p(SMBAUXCTL) & SMBAUXCTL_E32B) == 0)
-               return -1;
+               return -EIO;
        return 0;
 }
 
@@ -412,7 +398,7 @@ static int i801_block_transaction(union i2c_smbus_data *data, char read_write,
                } else if (!(i801_features & FEATURE_I2C_BLOCK_READ)) {
                        dev_err(&I801_dev->dev,
                                "I2C block read is unsupported!\n");
-                       return -1;
+                       return -EOPNOTSUPP;
                }
        }
 
@@ -447,7 +433,7 @@ static int i801_block_transaction(union i2c_smbus_data *data, char read_write,
        return result;
 }
 
-/* Return -1 on error. */
+/* Return negative errno on error. */
 static s32 i801_access(struct i2c_adapter * adap, u16 addr,
                       unsigned short flags, char read_write, u8 command,
                       int size, union i2c_smbus_data * data)
@@ -509,10 +495,9 @@ static s32 i801_access(struct i2c_adapter * adap, u16 addr,
                        outb_p(command, SMBHSTCMD);
                block = 1;
                break;
-       case I2C_SMBUS_PROC_CALL:
        default:
                dev_err(&I801_dev->dev, "Unsupported transaction %d\n", size);
-               return -1;
+               return -EOPNOTSUPP;
        }
 
        if (hwpec)      /* enable/disable hardware PEC */
@@ -535,7 +520,7 @@ static s32 i801_access(struct i2c_adapter * adap, u16 addr,
        if(block)
                return ret;
        if(ret)
-               return -1;
+               return ret;
        if ((read_write == I2C_SMBUS_WRITE) || (xact == I801_QUICK))
                return 0;
 
@@ -570,7 +555,7 @@ static const struct i2c_algorithm smbus_algorithm = {
 static struct i2c_adapter i801_adapter = {
        .owner          = THIS_MODULE,
        .id             = I2C_HW_SMBUS_I801,
-       .class          = I2C_CLASS_HWMON,
+       .class          = I2C_CLASS_HWMON | I2C_CLASS_SPD,
        .algo           = &smbus_algorithm,
 };
 
@@ -588,6 +573,8 @@ static struct pci_device_id i801_ids[] = {
        { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_5) },
        { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH9_6) },
        { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_TOLAPAI_1) },
+       { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH10_4) },
+       { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH10_5) },
        { 0, }
 };
 
@@ -608,10 +595,12 @@ static int __devinit i801_probe(struct pci_dev *dev, const struct pci_device_id
        case PCI_DEVICE_ID_INTEL_ESB2_17:
        case PCI_DEVICE_ID_INTEL_ICH8_5:
        case PCI_DEVICE_ID_INTEL_ICH9_6:
+       case PCI_DEVICE_ID_INTEL_TOLAPAI_1:
+       case PCI_DEVICE_ID_INTEL_ICH10_4:
+       case PCI_DEVICE_ID_INTEL_ICH10_5:
                i801_features |= FEATURE_I2C_BLOCK_READ;
                /* fall through */
        case PCI_DEVICE_ID_INTEL_82801DB_3:
-       case PCI_DEVICE_ID_INTEL_TOLAPAI_1:
                i801_features |= FEATURE_SMBUS_PEC;
                i801_features |= FEATURE_BLOCK_BUFFER;
                break;