Merge branch 'master' of git://git.denx.de/u-boot
[platform/kernel/u-boot.git] / drivers / i2c / s3c24x0_i2c.c
index cb45d3c..e0f499d 100644 (file)
 #else
 #include <asm/arch/s3c24x0_cpu.h>
 #endif
+#include <asm/global_data.h>
 #include <asm/io.h>
 #include <i2c.h>
 #include "s3c24x0_i2c.h"
 
-#ifndef CONFIG_SYS_I2C_S3C24X0_SLAVE
-#define SYS_I2C_S3C24X0_SLAVE_ADDR     0
-#else
-#define SYS_I2C_S3C24X0_SLAVE_ADDR     CONFIG_SYS_I2C_S3C24X0_SLAVE
-#endif
-
 DECLARE_GLOBAL_DATA_PTR;
 
 /*
@@ -82,6 +77,8 @@ static void i2c_ch_init(struct s3c24x0_i2c *i2c, int speed, int slaveadd)
        writel(I2C_MODE_MT | I2C_TXRX_ENA, &i2c->iicstat);
 }
 
+#define SYS_I2C_S3C24X0_SLAVE_ADDR     0
+
 static int s3c24x0_i2c_set_bus_speed(struct udevice *dev, unsigned int speed)
 {
        struct s3c24x0_i2c_bus *i2c_bus = dev_get_priv(dev);
@@ -302,7 +299,7 @@ static int s3c24x0_i2c_xfer(struct udevice *dev, struct i2c_msg *msg,
        return ret ? -EREMOTEIO : 0;
 }
 
-static int s3c_i2c_ofdata_to_platdata(struct udevice *dev)
+static int s3c_i2c_of_to_plat(struct udevice *dev)
 {
        const void *blob = gd->fdt_blob;
        struct s3c24x0_i2c_bus *i2c_bus = dev_get_priv(dev);
@@ -318,7 +315,7 @@ static int s3c_i2c_ofdata_to_platdata(struct udevice *dev)
                dev_read_u32_default(dev, "clock-frequency",
                                     I2C_SPEED_STANDARD_RATE);
        i2c_bus->node = node;
-       i2c_bus->bus_num = dev->seq;
+       i2c_bus->bus_num = dev_seq(dev);
 
        exynos_pinmux_config(i2c_bus->id, 0);
 
@@ -342,7 +339,7 @@ U_BOOT_DRIVER(i2c_s3c) = {
        .name   = "i2c_s3c",
        .id     = UCLASS_I2C,
        .of_match = s3c_i2c_ids,
-       .ofdata_to_platdata = s3c_i2c_ofdata_to_platdata,
-       .priv_auto_alloc_size = sizeof(struct s3c24x0_i2c_bus),
+       .of_to_plat = s3c_i2c_of_to_plat,
+       .priv_auto      = sizeof(struct s3c24x0_i2c_bus),
        .ops    = &s3c_i2c_ops,
 };