pinctrl: rockchip: Special treatment for RK3288 gpio0 pins' pull
authorDavid Wu <david.wu@rock-chips.com>
Tue, 16 Apr 2019 13:57:28 +0000 (21:57 +0800)
committerKever Yang <kever.yang@rock-chips.com>
Wed, 8 May 2019 09:34:12 +0000 (17:34 +0800)
RK3288 pmu_gpio0 pull setting have no higher 16 writing corresponding
bits, need to read before write the register.

Signed-off-by: David Wu <david.wu@rock-chips.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
drivers/pinctrl/rockchip/pinctrl-rk3288.c

index 9192aa39496c3c908882e4acf5c933ea8ebc7a29..24af3597ecef78e67583bc44ebd76b502734d5e1 100644 (file)
@@ -116,8 +116,15 @@ static int rk3288_set_pull(struct rockchip_pin_bank *bank,
                return ret;
        }
 
-       /* enable the write to the equivalent lower bits */
-       data = ((1 << ROCKCHIP_PULL_BITS_PER_PIN) - 1) << (bit + 16);
+       /* bank0 is special, there are no higher 16 bit writing bits */
+       if (bank->bank_num == 0) {
+               regmap_read(regmap, reg, &data);
+               data &= ~(((1 << ROCKCHIP_PULL_BITS_PER_PIN) - 1) << bit);
+       } else {
+               /* enable the write to the equivalent lower bits */
+               data = ((1 << ROCKCHIP_PULL_BITS_PER_PIN) - 1) << (bit + 16);
+       }
+
        data |= (ret << bit);
        ret = regmap_write(regmap, reg, data);