pinctrl: imx: Fix select input issue
Subsystems (4)
PATCH 1/1 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.
--- drivers/pinctrl/nxp/pinctrl-imx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/pinctrl/nxp/pinctrl-imx.c +2 -1
@@ -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 ;
Signature · 1 line
2.7.4
PATCH 1/1 pinctrl: imx: Fix select input issue
Quoted 41 lines
-----Original Message-----
From: Ye Li
Sent: 2019年1月4日 17:08
To: sbabic at denx.de; u-boot at lists.denx.de
Cc: Fabio Estevam <[email protected]>; Peng Fan <[email protected]>; dl-uboot-imx <[email protected]>
Subject: [PATCH] pinctrl: imx: Fix select input issueThe 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_valandmux_modeto u32.Signed-off-by Ye Li <[email protected]>Reviewed-by Fugang Duan <[email protected]>--- drivers/pinctrl/nxp/pinctrl-imx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/pinctrl/nxp/pinctrl-imx.c +2
-2@@ -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
Quoted 9 lines
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_valandmux_modeto u32.Signed-off-by Ye Li <[email protected]>Reviewed-by Fugang Duan <[email protected]>Reviewed-by Peng Fan <[email protected]>
Applied to u-boot-imx, master, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================