]> Git Repo - u-boot.git/blobdiff - drivers/misc/i2c_eeprom.c
dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()
[u-boot.git] / drivers / misc / i2c_eeprom.c
index 45c34d388c8ab90827e7e08f7f80f73da6305cf3..5926c91a2ec9c777e053ee76a0aff25aed233b59 100644 (file)
@@ -93,7 +93,7 @@ static const struct i2c_eeprom_ops i2c_eeprom_std_ops = {
        .size   = i2c_eeprom_std_size,
 };
 
-static int i2c_eeprom_std_ofdata_to_platdata(struct udevice *dev)
+static int i2c_eeprom_std_of_to_plat(struct udevice *dev)
 {
        struct i2c_eeprom *priv = dev_get_priv(dev);
        struct i2c_eeprom_drv_data *data =
@@ -131,8 +131,8 @@ static int i2c_eeprom_std_bind(struct udevice *dev)
                if (!name)
                        continue;
 
-               device_bind_ofnode(dev, DM_GET_DRIVER(i2c_eeprom_partition),
-                                  name, NULL, partition, NULL);
+               device_bind(dev, DM_DRIVER_GET(i2c_eeprom_partition), name,
+                           NULL, partition, NULL);
        }
 
        return 0;
@@ -283,8 +283,8 @@ U_BOOT_DRIVER(i2c_eeprom_std) = {
        .of_match               = i2c_eeprom_std_ids,
        .bind                   = i2c_eeprom_std_bind,
        .probe                  = i2c_eeprom_std_probe,
-       .ofdata_to_platdata     = i2c_eeprom_std_ofdata_to_platdata,
-       .priv_auto_alloc_size   = sizeof(struct i2c_eeprom),
+       .of_to_plat     = i2c_eeprom_std_of_to_plat,
+       .priv_auto      = sizeof(struct i2c_eeprom),
        .ops                    = &i2c_eeprom_std_ops,
 };
 
@@ -298,22 +298,23 @@ static int i2c_eeprom_partition_probe(struct udevice *dev)
        return 0;
 }
 
-static int i2c_eeprom_partition_ofdata_to_platdata(struct udevice *dev)
+static int i2c_eeprom_partition_of_to_plat(struct udevice *dev)
 {
        struct i2c_eeprom_partition *priv = dev_get_priv(dev);
-       u32 offset, size;
+       u32 reg[2];
        int ret;
 
-       ret = dev_read_u32(dev, "offset", &offset);
+       ret = dev_read_u32_array(dev, "reg", reg, 2);
        if (ret)
                return ret;
 
-       ret = dev_read_u32(dev, "size", &size);
-       if (ret)
-               return ret;
+       if (!reg[1])
+               return -EINVAL;
+
+       priv->offset = reg[0];
+       priv->size = reg[1];
 
-       priv->offset = offset;
-       priv->size = size;
+       debug("%s: base %x, size %x\n", __func__, priv->offset, priv->size);
 
        return 0;
 }
@@ -364,8 +365,8 @@ U_BOOT_DRIVER(i2c_eeprom_partition) = {
        .name                   = "i2c_eeprom_partition",
        .id                     = UCLASS_I2C_EEPROM,
        .probe                  = i2c_eeprom_partition_probe,
-       .ofdata_to_platdata     = i2c_eeprom_partition_ofdata_to_platdata,
-       .priv_auto_alloc_size   = sizeof(struct i2c_eeprom_partition),
+       .of_to_plat     = i2c_eeprom_partition_of_to_plat,
+       .priv_auto      = sizeof(struct i2c_eeprom_partition),
        .ops                    = &i2c_eeprom_partition_ops,
 };
 
This page took 0.024536 seconds and 4 git commands to generate.