diff mbox series

[U-Boot,v3,06/10] pinctrl: rockchip: Special treatment for RK3288 gpio0 pins' drive strength

Message ID 20190416135634.27041-1-david.wu@rock-chips.com
State Accepted
Commit 956362c84b0422ea99da947feca2878193c26ade
Delegated to: Kever Yang
Headers show
Series pinctrl: Split the common mux/drive/pull/schmitt func into per Soc | expand

Commit Message

David Wu April 16, 2019, 1:56 p.m. UTC
RK3288 pmu_gpio0 drive strength 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>
---

Change in v3:
- Add some comment

 drivers/pinctrl/rockchip/pinctrl-rk3288.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

Comments

Kever Yang May 7, 2019, 3:43 a.m. UTC | #1
On 04/16/2019 09:56 PM, David Wu wrote:
> RK3288 pmu_gpio0 drive strength 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>

Reviewed-by: Kever Yang <kever.yang@rock-chips.com>

Thanks,
- Kever
> ---
>
> Change in v3:
> - Add some comment
>
>  drivers/pinctrl/rockchip/pinctrl-rk3288.c | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pinctrl/rockchip/pinctrl-rk3288.c b/drivers/pinctrl/rockchip/pinctrl-rk3288.c
> index 6ae9f1c76e..d1b9aeb3d9 100644
> --- a/drivers/pinctrl/rockchip/pinctrl-rk3288.c
> +++ b/drivers/pinctrl/rockchip/pinctrl-rk3288.c
> @@ -143,8 +143,15 @@ static int rk3288_set_drive(struct rockchip_pin_bank *bank,
>  		return ret;
>  	}
>  
> -	/* enable the write to the equivalent lower bits */
> -	data = ((1 << ROCKCHIP_DRV_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_DRV_BITS_PER_PIN) - 1) << bit);
> +	} else {
> +		/* enable the write to the equivalent lower bits */
> +		data = ((1 << ROCKCHIP_DRV_BITS_PER_PIN) - 1) << (bit + 16);
> +	}
> +
>  	data |= (ret << bit);
>  	ret = regmap_write(regmap, reg, data);
>  	return ret;
Kever Yang May 9, 2019, 1:25 a.m. UTC | #2
On 05/07/2019 11:43 AM, Kever Yang wrote:
>
> On 04/16/2019 09:56 PM, David Wu wrote:
>> RK3288 pmu_gpio0 drive strength 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>
> Reviewed-by: Kever Yang <kever.yang@rock-chips.com>

Applied to u-boot-rockchip, thanks!

>
> Thanks,
> - Kever
>> ---
>>
>> Change in v3:
>> - Add some comment
>>
>>  drivers/pinctrl/rockchip/pinctrl-rk3288.c | 11 +++++++++--
>>  1 file changed, 9 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/pinctrl/rockchip/pinctrl-rk3288.c b/drivers/pinctrl/rockchip/pinctrl-rk3288.c
>> index 6ae9f1c76e..d1b9aeb3d9 100644
>> --- a/drivers/pinctrl/rockchip/pinctrl-rk3288.c
>> +++ b/drivers/pinctrl/rockchip/pinctrl-rk3288.c
>> @@ -143,8 +143,15 @@ static int rk3288_set_drive(struct rockchip_pin_bank *bank,
>>  		return ret;
>>  	}
>>  
>> -	/* enable the write to the equivalent lower bits */
>> -	data = ((1 << ROCKCHIP_DRV_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_DRV_BITS_PER_PIN) - 1) << bit);
>> +	} else {
>> +		/* enable the write to the equivalent lower bits */
>> +		data = ((1 << ROCKCHIP_DRV_BITS_PER_PIN) - 1) << (bit + 16);
>> +	}
>> +
>>  	data |= (ret << bit);
>>  	ret = regmap_write(regmap, reg, data);
>>  	return ret;
>
>
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> https://lists.denx.de/listinfo/u-boot
diff mbox series

Patch

diff --git a/drivers/pinctrl/rockchip/pinctrl-rk3288.c b/drivers/pinctrl/rockchip/pinctrl-rk3288.c
index 6ae9f1c76e..d1b9aeb3d9 100644
--- a/drivers/pinctrl/rockchip/pinctrl-rk3288.c
+++ b/drivers/pinctrl/rockchip/pinctrl-rk3288.c
@@ -143,8 +143,15 @@  static int rk3288_set_drive(struct rockchip_pin_bank *bank,
 		return ret;
 	}
 
-	/* enable the write to the equivalent lower bits */
-	data = ((1 << ROCKCHIP_DRV_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_DRV_BITS_PER_PIN) - 1) << bit);
+	} else {
+		/* enable the write to the equivalent lower bits */
+		data = ((1 << ROCKCHIP_DRV_BITS_PER_PIN) - 1) << (bit + 16);
+	}
+
 	data |= (ret << bit);
 	ret = regmap_write(regmap, reg, data);
 	return ret;