diff mbox series

power: reset: qcom-pon: reg write mask depends on pon generation

Message ID 20200428070437.14016-1-kejia.hu@codethink.co.uk (mailing list archive)
State Accepted
Commit fc5be29f9b2cd9fc7243bf3c26ed042f2868fa8b
Headers show
Series power: reset: qcom-pon: reg write mask depends on pon generation | expand

Commit Message

Kejia Hu April 28, 2020, 7:04 a.m. UTC
Instead of hardcode the mask, it should be depends
on which generation of pon it was.

Signed-off-by: Kejia Hu <kejia.hu@codethink.co.uk>
---
 drivers/power/reset/qcom-pon.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Sebastian Reichel April 28, 2020, 7:18 p.m. UTC | #1
Hi,

On Tue, Apr 28, 2020 at 08:04:37AM +0100, Kejia Hu wrote:
> Instead of hardcode the mask, it should be depends
> on which generation of pon it was.
> 
> Signed-off-by: Kejia Hu <kejia.hu@codethink.co.uk>
> ---

Thanks, queued.

-- Sebastian

>  drivers/power/reset/qcom-pon.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/power/reset/qcom-pon.c b/drivers/power/reset/qcom-pon.c
> index 22a743a0bf28..4a688741a88a 100644
> --- a/drivers/power/reset/qcom-pon.c
> +++ b/drivers/power/reset/qcom-pon.c
> @@ -34,7 +34,8 @@ static int pm8916_reboot_mode_write(struct reboot_mode_driver *reboot,
>  
>  	ret = regmap_update_bits(pon->regmap,
>  				 pon->baseaddr + PON_SOFT_RB_SPARE,
> -				 0xfc, magic << pon->reason_shift);
> +				 GENMASK(7, pon->reason_shift),
> +				 magic << pon->reason_shift);
>  	if (ret < 0)
>  		dev_err(pon->dev, "update reboot mode bits failed\n");
>  
> -- 
> 2.11.0
>
diff mbox series

Patch

diff --git a/drivers/power/reset/qcom-pon.c b/drivers/power/reset/qcom-pon.c
index 22a743a0bf28..4a688741a88a 100644
--- a/drivers/power/reset/qcom-pon.c
+++ b/drivers/power/reset/qcom-pon.c
@@ -34,7 +34,8 @@  static int pm8916_reboot_mode_write(struct reboot_mode_driver *reboot,
 
 	ret = regmap_update_bits(pon->regmap,
 				 pon->baseaddr + PON_SOFT_RB_SPARE,
-				 0xfc, magic << pon->reason_shift);
+				 GENMASK(7, pon->reason_shift),
+				 magic << pon->reason_shift);
 	if (ret < 0)
 		dev_err(pon->dev, "update reboot mode bits failed\n");