pinctrl: samsung: Handle banks with two configuration registers
authorTomasz Figa <tomasz.figa@gmail.com>
Mon, 18 Mar 2013 21:31:54 +0000 (22:31 +0100)
committerLinus Walleij <linus.walleij@linaro.org>
Tue, 9 Apr 2013 07:43:39 +0000 (09:43 +0200)
This patch adds support for banks that have more than one function
configuration registers, e.g. some of the banks of S3C64xx SoCs.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/pinctrl-samsung.c

index b917ed36fb65e640ab15791a0b7abf7bdc62a30c..8b15c6622b339a3aa3cbe6da0a46d195b61f6e5c 100644 (file)
@@ -303,6 +303,11 @@ static void samsung_pinmux_setup(struct pinctrl_dev *pctldev, unsigned selector,
                type = bank->type;
                mask = (1 << type->fld_width[PINCFG_TYPE_FUNC]) - 1;
                shift = pin_offset * type->fld_width[PINCFG_TYPE_FUNC];
+               if (shift >= 32) {
+                       /* Some banks have two config registers */
+                       shift -= 32;
+                       reg += 4;
+               }
 
                spin_lock_irqsave(&bank->slock, flags);
 
@@ -356,6 +361,11 @@ static int samsung_pinmux_gpio_set_direction(struct pinctrl_dev *pctldev,
 
        mask = (1 << type->fld_width[PINCFG_TYPE_FUNC]) - 1;
        shift = pin_offset * type->fld_width[PINCFG_TYPE_FUNC];
+       if (shift >= 32) {
+               /* Some banks have two config registers */
+               shift -= 32;
+               reg += 4;
+       }
 
        spin_lock_irqsave(&bank->slock, flags);