Skip to contentSkip to conversation

pinctrl: imx: Fix select input issue

PATCH In review Ye Li 3 participants 3 messages Jan 4, 2019 – Jan 30, 2019

Subsystems (4)
lore
Share & tools
lore

Ye Li

author
#0 lore raw

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
index 04ea82a..0c9d15c 100644
@@ -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
#1 lore raw

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 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 -2
index 04ea82a..0c9d15c 100644
@@ -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

#2 lore raw
In reply to Ye Li
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_val and mux_mode to u32.

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
=====================================================================