[U-Boot] pinctrl: imx: Fix select input issue
diff mbox series

Message ID 1546592890-41115-1-git-send-email-ye.li@nxp.com
State Accepted
Commit 11a1c27eb454ece04ca4e61f0ea1ab4ebaafa5b5
Delegated to: Stefano Babic
Headers show
Series
  • [U-Boot] pinctrl: imx: Fix select input issue
Related show

Commit Message

Ye Li Jan. 4, 2019, 9:08 a.m. UTC
The pinctrl supports to set any bit in input register on iMX6 if
the MSB of input value is 0xff. But the driver uses signed int for
input value, so when executing the codes below, it won't meet.
Because this is arithmetic right shift.

    if (input_val >> 24 == 0xff)

Fix the issue by changing the input_val, config_val and mux_mode to u32.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Fugang Duan <fugang.duan@nxp.com>
---
 drivers/pinctrl/nxp/pinctrl-imx.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Peng Fan Jan. 5, 2019, 9:26 a.m. UTC | #1
Reviewed-by: Peng Fan <peng.fan@nxp.com>

> -----Original Message-----
> From: Ye Li
> Sent: 2019年1月4日 17:08
> To: sbabic@denx.de; u-boot@lists.denx.de
> Cc: Fabio Estevam <fabio.estevam@nxp.com>; Peng Fan
> <peng.fan@nxp.com>; dl-uboot-imx <uboot-imx@nxp.com>
> Subject: [PATCH] pinctrl: imx: Fix select input issue
> 
> The pinctrl supports to set any bit in input register on iMX6 if the MSB of input
> value is 0xff. But the driver uses signed int for input value, so when executing
> the codes below, it won't meet.
> Because this is arithmetic right shift.
> 
>     if (input_val >> 24 == 0xff)
> 
> Fix the issue by changing the input_val, config_val and mux_mode to u32.
> 
> Signed-off-by: Ye Li <ye.li@nxp.com>
> Reviewed-by: Fugang Duan <fugang.duan@nxp.com>
> ---
>  drivers/pinctrl/nxp/pinctrl-imx.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/pinctrl/nxp/pinctrl-imx.c
> b/drivers/pinctrl/nxp/pinctrl-imx.c
> index 04ea82a..0c9d15c 100644
> --- a/drivers/pinctrl/nxp/pinctrl-imx.c
> +++ b/drivers/pinctrl/nxp/pinctrl-imx.c
> @@ -22,7 +22,8 @@ static int imx_pinctrl_set_state(struct udevice *dev,
> struct udevice *config)
>  	const struct fdt_property *prop;
>  	u32 *pin_data;
>  	int npins, size, pin_size;
> -	int mux_reg, conf_reg, input_reg, input_val, mux_mode, config_val;
> +	int mux_reg, conf_reg, input_reg;
> +	u32 input_val, mux_mode, config_val;
>  	u32 mux_shift = info->mux_mask ? ffs(info->mux_mask) - 1 : 0;
>  	int i, j = 0;
> 
> --
> 2.7.4

Patch
diff mbox series

diff --git a/drivers/pinctrl/nxp/pinctrl-imx.c b/drivers/pinctrl/nxp/pinctrl-imx.c
index 04ea82a..0c9d15c 100644
--- a/drivers/pinctrl/nxp/pinctrl-imx.c
+++ b/drivers/pinctrl/nxp/pinctrl-imx.c
@@ -22,7 +22,8 @@  static int imx_pinctrl_set_state(struct udevice *dev, struct udevice *config)
 	const struct fdt_property *prop;
 	u32 *pin_data;
 	int npins, size, pin_size;
-	int mux_reg, conf_reg, input_reg, input_val, mux_mode, config_val;
+	int mux_reg, conf_reg, input_reg;
+	u32 input_val, mux_mode, config_val;
 	u32 mux_shift = info->mux_mask ? ffs(info->mux_mask) - 1 : 0;
 	int i, j = 0;