dm: gpio: power: Convert pm8916 drivers to livetree
authorSimon Glass <sjg@chromium.org>
Fri, 19 May 2017 02:10:01 +0000 (20:10 -0600)
committerSimon Glass <sjg@chromium.org>
Thu, 1 Jun 2017 13:03:17 +0000 (07:03 -0600)
This PMIC driver (power and GPIO) is used by the sandbox SPMI tests.
Update the drivers to support a live device tree so that the tests pass.

Signed-off-by: Simon Glass <sjg@chromium.org>
drivers/gpio/pm8916_gpio.c
drivers/power/pmic/pm8916.c

index 8dea69f281b2cac9022840c3a66ff00c16688bbf..9ec2a24b3e9059ef8fbddd2b4b936228b249b15a 100644 (file)
@@ -173,7 +173,7 @@ static int pm8916_gpio_probe(struct udevice *dev)
        struct pm8916_gpio_bank *priv = dev_get_priv(dev);
        int reg;
 
-       priv->pid = devfdt_get_addr(dev);
+       priv->pid = dev_read_addr(dev);
        if (priv->pid == FDT_ADDR_T_NONE)
                return -EINVAL;
 
@@ -193,10 +193,8 @@ static int pm8916_gpio_ofdata_to_platdata(struct udevice *dev)
 {
        struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev);
 
-       uc_priv->gpio_count = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
-                                            "gpio-count", 0);
-       uc_priv->bank_name = fdt_getprop(gd->fdt_blob, dev_of_offset(dev),
-                                        "gpio-bank-name", NULL);
+       uc_priv->gpio_count = dev_read_u32_default(dev, "gpio-count", 0);
+       uc_priv->bank_name = dev_read_string(dev, "gpio-bank-name");
        if (uc_priv->bank_name == NULL)
                uc_priv->bank_name = "pm8916";
 
index 3632ee2d1e245b849828fed681dedc2608f66474..a048bbe7ce1dfb53bd22ffd0b9910dcc02a42add 100644 (file)
@@ -70,7 +70,7 @@ static int pm8916_probe(struct udevice *dev)
 {
        struct pm8916_priv *priv = dev_get_priv(dev);
 
-       priv->usid = devfdt_get_addr(dev);
+       priv->usid = dev_read_addr(dev);
 
        if (priv->usid == FDT_ADDR_T_NONE)
                return -EINVAL;