linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / drivers / i2c / busses / i2c-iop3xx.c
index 48c5693..1414851 100644 (file)
  * - Make it work with IXP46x chips
  * - Cleanup function names, coding style, etc
  *
- * - writing to slave address causes latchup on iop331.
- *     fix: driver refuses to address self.
- *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation, version 2.
  */
 
+#include <linux/config.h>
 #include <linux/interrupt.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
@@ -75,6 +73,12 @@ iop3xx_i2c_reset(struct i2c_algo_iop3xx_data *iop3xx_adap)
        __raw_writel(0, iop3xx_adap->ioaddr + CR_OFFSET);
 } 
 
+static void 
+iop3xx_i2c_set_slave_addr(struct i2c_algo_iop3xx_data *iop3xx_adap)
+{
+       __raw_writel(MYSAR, iop3xx_adap->ioaddr + SAR_OFFSET);
+}
+
 static void 
 iop3xx_i2c_enable(struct i2c_algo_iop3xx_data *iop3xx_adap)
 {
@@ -245,13 +249,6 @@ iop3xx_i2c_send_target_addr(struct i2c_algo_iop3xx_data *iop3xx_adap,
        int status;
        int rc;
 
-       /* avoid writing to my slave address (hangs on 80331),
-        * forbidden in Intel developer manual
-        */
-       if (msg->addr == MYSAR) {
-               return -EBUSY;
-       }
-
        __raw_writel(iic_cook_addr(msg), iop3xx_adap->ioaddr + DBR_OFFSET);
        
        cr &= ~(IOP3XX_ICR_MSTOP | IOP3XX_ICR_NACK);
@@ -437,7 +434,7 @@ static int
 iop3xx_i2c_probe(struct platform_device *pdev)
 {
        struct resource *res;
-       int ret, irq;
+       int ret;
        struct i2c_adapter *new_adapter;
        struct i2c_algo_iop3xx_data *adapter_data;
 
@@ -473,12 +470,7 @@ iop3xx_i2c_probe(struct platform_device *pdev)
                goto release_region;
        }
 
-       irq = platform_get_irq(pdev, 0);
-       if (irq < 0) {
-               ret = -ENXIO;
-               goto unmap;
-       }
-       ret = request_irq(irq, iop3xx_i2c_irq_handler, 0,
+       ret = request_irq(platform_get_irq(pdev, 0), iop3xx_i2c_irq_handler, 0,
                                pdev->name, adapter_data);
 
        if (ret) {
@@ -502,6 +494,7 @@ iop3xx_i2c_probe(struct platform_device *pdev)
        spin_lock_init(&adapter_data->lock);
 
        iop3xx_i2c_reset(adapter_data);
+       iop3xx_i2c_set_slave_addr(adapter_data);
        iop3xx_i2c_enable(adapter_data);
 
        platform_set_drvdata(pdev, new_adapter);