i2c: Use <linux/io.h> instead of <asm/io.h>
[safe/jmp/linux-2.6] / drivers / i2c / busses / i2c-iop3xx.c
index 4436c89..112c61f 100644 (file)
 #include <linux/slab.h>
 #include <linux/init.h>
 #include <linux/errno.h>
-#include <linux/sched.h>
 #include <linux/platform_device.h>
 #include <linux/i2c.h>
-
-#include <asm/io.h>
+#include <linux/io.h>
 
 #include "i2c-iop3xx.h"
 
@@ -57,12 +55,6 @@ iic_cook_addr(struct i2c_msg *msg)
        if (msg->flags & I2C_M_RD)
                addr |= 1;
 
-       /*
-        * Read or Write?
-        */
-       if (msg->flags & I2C_M_REV_DIR_ADDR)
-               addr ^= 1;
-
        return addr;   
 }
 
@@ -84,7 +76,7 @@ iop3xx_i2c_enable(struct i2c_algo_iop3xx_data *iop3xx_adap)
         * Every time unit enable is asserted, GPOD needs to be cleared
         * on IOP3XX to avoid data corruption on the bus.
         */
-#ifdef CONFIG_PLAT_IOP
+#if defined(CONFIG_ARCH_IOP32X) || defined(CONFIG_ARCH_IOP33X)
        if (iop3xx_adap->id == 0) {
                gpio_line_set(IOP3XX_GPIO_LINE(7), GPIO_LOW);
                gpio_line_set(IOP3XX_GPIO_LINE(6), GPIO_LOW);
@@ -120,7 +112,7 @@ iop3xx_i2c_transaction_cleanup(struct i2c_algo_iop3xx_data *iop3xx_adap)
  * Then it passes the SR flags of interest to BH via adap data
  */
 static irqreturn_t 
-iop3xx_i2c_irq_handler(int this_irq, void *dev_id, struct pt_regs *regs
+iop3xx_i2c_irq_handler(int this_irq, void *dev_id) 
 {
        struct i2c_algo_iop3xx_data *iop3xx_adap = dev_id;
        u32 sr = __raw_readl(iop3xx_adap->ioaddr + SR_OFFSET);
@@ -390,13 +382,6 @@ iop3xx_i2c_master_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs,
        return im;   
 }
 
-static int 
-iop3xx_i2c_algo_control(struct i2c_adapter *adapter, unsigned int cmd,
-                       unsigned long arg)
-{
-       return 0;
-}
-
 static u32 
 iop3xx_i2c_func(struct i2c_adapter *adap)
 {
@@ -405,7 +390,6 @@ iop3xx_i2c_func(struct i2c_adapter *adap)
 
 static const struct i2c_algorithm iop3xx_i2c_algo = {
        .master_xfer    = iop3xx_i2c_master_xfer,
-       .algo_control   = iop3xx_i2c_algo_control,
        .functionality  = iop3xx_i2c_func,
 };
 
@@ -489,15 +473,15 @@ iop3xx_i2c_probe(struct platform_device *pdev)
        }
 
        memcpy(new_adapter->name, pdev->name, strlen(pdev->name));
-       new_adapter->id = I2C_HW_IOP3XX;
        new_adapter->owner = THIS_MODULE;
+       new_adapter->class = I2C_CLASS_HWMON | I2C_CLASS_SPD;
        new_adapter->dev.parent = &pdev->dev;
+       new_adapter->nr = pdev->id;
 
        /*
         * Default values...should these come in from board code?
         */
-       new_adapter->timeout = 100;     
-       new_adapter->retries = 3;
+       new_adapter->timeout = HZ;
        new_adapter->algo = &iop3xx_i2c_algo;
 
        init_waitqueue_head(&adapter_data->waitq);
@@ -509,7 +493,7 @@ iop3xx_i2c_probe(struct platform_device *pdev)
        platform_set_drvdata(pdev, new_adapter);
        new_adapter->algo_data = adapter_data;
 
-       i2c_add_adapter(new_adapter);
+       i2c_add_numbered_adapter(new_adapter);
 
        return 0;
 
@@ -558,3 +542,4 @@ module_exit (i2c_iop3xx_exit);
 MODULE_AUTHOR("D-TACQ Solutions Ltd <www.d-tacq.com>");
 MODULE_DESCRIPTION("IOP3xx iic algorithm and driver");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:IOP3xx-I2C");