]> git.sur5r.net Git - u-boot/blobdiff - drivers/pinctrl/pinctrl-sti.c
pinctrl: do not set_state for device without valid ofnode
[u-boot] / drivers / pinctrl / pinctrl-sti.c
index 40341b4eeb756e0ce7725484c0f867d1cfdbfe13..f0cd845fea5468f0d04abc20b2ae09532070075c 100644 (file)
@@ -1,10 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Pinctrl driver for STMicroelectronics STi SoCs
  *
- *  Copyright (c) 2017
- *  Patrice Chotard <patrice.chotard@st.com>
- *
- * SPDX-License-Identifier:    GPL-2.0
+ * Copyright (C) 2017, STMicroelectronics - All Rights Reserved
+ * Author(s): Patrice Chotard, <patrice.chotard@st.com> for STMicroelectronics.
  */
 
 #include <common.h>
@@ -62,7 +61,7 @@ void sti_alternate_select(struct udevice *dev, struct sti_pin_desc *pin_desc)
        int bank = pin_desc->bank;
        int pin = pin_desc->pin;
 
-       sysconfreg = (unsigned long *)plat->regmap->base;
+       sysconfreg = (unsigned long *)plat->regmap->ranges[0].start;
 
        switch (bank) {
        case 0 ... 5:           /* in "SBC Bank" */
@@ -96,7 +95,7 @@ void sti_pin_configure(struct udevice *dev, struct sti_pin_desc *pin_desc)
        unsigned long *sysconfreg;
        int bank = pin_desc->bank;
 
-       sysconfreg = (unsigned long *)plat->regmap->base + 40;
+       sysconfreg = (unsigned long *)plat->regmap->ranges[0].start + 40;
 
        /*
         * NOTE: The PIO configuration for the PIO pins in the
@@ -142,7 +141,7 @@ void sti_pin_configure(struct udevice *dev, struct sti_pin_desc *pin_desc)
                break;
 
        default:
-               error("%s invalid direction value: 0x%x\n",
+               pr_err("%s invalid direction value: 0x%x\n",
                      __func__, pin_desc->dir);
                BUG();
                break;
@@ -237,14 +236,14 @@ static int sti_pinctrl_set_state(struct udevice *dev, struct udevice *config)
                                                     prop_name, "#gpio-cells",
                                                     0, 0, &args);
                if (ret < 0) {
-                       error("Can't get the gpio bank phandle: %d\n", ret);
+                       pr_err("Can't get the gpio bank phandle: %d\n", ret);
                        return ret;
                }
 
                bank_name = fdt_getprop(blob, args.node, "st,bank-name",
                                        &count);
                if (count < 0) {
-                       error("Can't find bank-name property %d\n", count);
+                       pr_err("Can't find bank-name property %d\n", count);
                        return -EINVAL;
                }
 
@@ -254,12 +253,12 @@ static int sti_pinctrl_set_state(struct udevice *dev, struct udevice *config)
                                                   prop_name, cells,
                                                   ARRAY_SIZE(cells));
                if (count < 0) {
-                       error("Bad pin configuration array %d\n", count);
+                       pr_err("Bad pin configuration array %d\n", count);
                        return -EINVAL;
                }
 
                if (count > MAX_STI_PINCONF_ENTRIES) {
-                       error("Unsupported pinconf array count %d\n", count);
+                       pr_err("Unsupported pinconf array count %d\n", count);
                        return -EINVAL;
                }
 
@@ -284,13 +283,13 @@ static int sti_pinctrl_probe(struct udevice *dev)
        err = uclass_get_device_by_phandle(UCLASS_SYSCON, dev,
                                           "st,syscfg", &syscon);
        if (err) {
-               error("unable to find syscon device\n");
+               pr_err("unable to find syscon device\n");
                return err;
        }
 
        plat->regmap = syscon_get_regmap(syscon);
        if (!plat->regmap) {
-               error("unable to find regmap\n");
+               pr_err("unable to find regmap\n");
                return -ENODEV;
        }