Merge tag 'v2021.01-rc5' into next
[platform/kernel/u-boot.git] / drivers / pinctrl / pinctrl-sti.c
index 735e412..c5baf5d 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@foss.st.com> for STMicroelectronics.
  */
 
 #include <common.h>
@@ -15,6 +14,8 @@
 #include <syscon.h>
 #include <asm/io.h>
 #include <dm/pinctrl.h>
+#include <linux/bug.h>
+#include <linux/libfdt.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -40,7 +41,7 @@ DECLARE_GLOBAL_DATA_PTR;
                /* oe = 1, pu = 1, od = 1 */
 #define BIDIR_PU               (OE | PU | OD)
 
-struct sti_pinctrl_platdata {
+struct sti_pinctrl_plat {
        struct regmap *regmap;
 };
 
@@ -56,13 +57,13 @@ struct sti_pin_desc {
  */
 void sti_alternate_select(struct udevice *dev, struct sti_pin_desc *pin_desc)
 {
-       struct sti_pinctrl_platdata *plat = dev_get_platdata(dev);
+       struct sti_pinctrl_plat *plat = dev_get_plat(dev);
        unsigned long sysconf, *sysconfreg;
        int alt = pin_desc->alt;
        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" */
@@ -90,13 +91,13 @@ void sti_alternate_select(struct udevice *dev, struct sti_pin_desc *pin_desc)
 /* pin configuration */
 void sti_pin_configure(struct udevice *dev, struct sti_pin_desc *pin_desc)
 {
-       struct sti_pinctrl_platdata *plat = dev_get_platdata(dev);
+       struct sti_pinctrl_plat *plat = dev_get_plat(dev);
        int bit;
        int oe = 0, pu = 0, od = 0;
        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
@@ -276,7 +277,7 @@ static int sti_pinctrl_set_state(struct udevice *dev, struct udevice *config)
 
 static int sti_pinctrl_probe(struct udevice *dev)
 {
-       struct sti_pinctrl_platdata *plat = dev_get_platdata(dev);
+       struct sti_pinctrl_plat *plat = dev_get_plat(dev);
        struct udevice *syscon;
        int err;
 
@@ -315,6 +316,6 @@ U_BOOT_DRIVER(pinctrl_sti) = {
        .of_match = sti_pinctrl_ids,
        .ops = &sti_pinctrl_ops,
        .probe = sti_pinctrl_probe,
-       .platdata_auto_alloc_size = sizeof(struct sti_pinctrl_platdata),
+       .plat_auto      = sizeof(struct sti_pinctrl_plat),
        .ops = &sti_pinctrl_ops,
 };