Skip to contentSkip to conversation

Pinctrl: imx1: fix wrong pin-name resolving

PATCH RESEND In review Chris Ruehl 4 participants 8 messages Jun 26, 2015 – Jul 17, 2015

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 Pinctrl: imx1: fix wrong pin-name resolving

Bug in function imx1_pinconf_set() cause crash when princtrl debug is enabled and the pin_id becomes larger then the info->pins[] contains data.

imx27-pinctrl 10015000.iomuxc: request pin 134 (MX27_PAD_UART2_TXD) for 1000b000.serial imx27-pinctrl 10015000.iomuxc: request pin 135 (MX27_PAD_UART2_RXD) for 1000b000.serial imx27-pinctrl 10015000.iomuxc: request pin 131 (MX27_PAD_UART2_CTS) for 1000b000.serial imx27-pinctrl 10015000.iomuxc: request pin 132 (MX27_PAD_UART2_RTS) for 1000b000.serial imx27-pinctrl 10015000.iomuxc: enable function uart group uart2-1
imx27-pinctrl 10015000.iomuxc: imx1_pmx_set, pin 0x86, function 0, gpio 0, direction 1, oconf 0, iconfa 0, iconfb 0 imx27-pinctrl 10015000.iomuxc: imx1_pmx_set, pin 0x87, function 0, gpio 0, direction 0, oconf 0, iconfa 0, iconfb 0 imx27-pinctrl 10015000.iomuxc: imx1_pmx_set, pin 0x83, function 0, gpio 0, direction 1, oconf 0, iconfa 0, iconfb 0 imx27-pinctrl 10015000.iomuxc: imx1_pmx_set, pin 0x84, function 0, gpio 0, direction 0, oconf 0, iconfa 0, iconfb 0 imx27-pinctrl 10015000.iomuxc: num_configs=1 PinID=134
imx27-pinctrl 10015000.iomuxc: pinconf set pullup pin MX27_PAD_UART1_RTS
imx27-pinctrl 10015000.iomuxc: num_configs=1 PinID=135
imx27-pinctrl 10015000.iomuxc: pinconf set pullup pin MX27_PAD_RTCK
imx27-pinctrl 10015000.iomuxc: num_configs=1 PinID=131
imx27-pinctrl 10015000.iomuxc: pinconf set pullup pin MX27_PAD_UART1_TXD
imx27-pinctrl 10015000.iomuxc: num_configs=1 PinID=132
imx27-pinctrl 10015000.iomuxc: pinconf set pullup pin MX27_PAD_UART1_RXD
...
imx27-pinctrl 10015000.iomuxc: write: register 0xf4415508 offset 4 value 0x3
imx27-pinctrl 10015000.iomuxc: write: register 0xf4415510 offset 4 value 0x0
imx27-pinctrl 10015000.iomuxc: write: register 0xf4415518 offset 4 value 0x0
imx27-pinctrl 10015000.iomuxc: imx1_pmx_set, pin 0xb5, function 0, gpio 0, direction 1, oconf 0, iconfa 0, iconfb 0 imx27-pinctrl 10015000.iomuxc: num_configs=1 PinID=171

Unable to handle kernel paging request at virtual address 6c61765f
pgd = c0004000
6c61765f] *pgd=00000000
Internal error: Oops: 5 [#1] ARM
Modules linked in:
CPU: 0 PID: 1 Comm: swapper Not tainted 4.1.0-rc4-next-20150522-dirty #8
Hardware name: GTSYS i.MX27GTSIR (Device Tree Support)
task: ce832000 ti: ce848000 task.ti: ce848000
PC is at strnlen+0x28/0x3c
LR is at string.isra.4+0x34/0xcc
pc : [<c01ae188>]    lr : [<c01af9a4>]    psr: 20000093

sp : ce849a88 ip : ce849a98 fp : ce849a94
r10: c05d7e3a r9 : c05d81e4 r8 : 00000000
r7 : 6c61765f r6 : c05d81e4 r5 : ffffffff r4 : c05d7e3a r3 : 6c61765f r2 : 6c61765f r1 : 6c61765e r0 : 6c61765f
Flags: nzCv IRQs off FIQs on Mode SVC_32 ISA ARM Segment kernel

---
 drivers/pinctrl/freescale/pinctrl-imx1-core.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/pinctrl/freescale/pinctrl-imx1-core.c +3 -2
index 5ac59fb..8408bd8 100644
@@ -403,14 +403,16 @@ static int imx1_pinconf_set(struct pinctrl_dev *pctldev,
 			     unsigned num_configs)
 {
 	struct imx1_pinctrl *ipctl = pinctrl_dev_get_drvdata(pctldev);
-	const struct imx1_pinctrl_soc_info *info = ipctl->info;
+	struct pin_desc *desc;
 	int i;
 +	desc = pin_desc_get(pctldev, pin_id);
+
 	for (i = 0; i != num_configs; ++i) {
 		imx1_write_bit(ipctl, pin_id, configs[i] & 0x01, MX1_PUEN);
  		dev_dbg(ipctl->dev, "pinconf set pullup pin %s\n",
-			info->pins[pin_id].name);
+			desc->name);
 	}
  	return 0;
Signature · 6 lines
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#1 lore raw
Quoted 47 lines · Chris Ruehl

Bug in function imx1_pinconf_set() cause crash when princtrl debug is enabled and the pin_id becomes larger then the info->pins[] contains data.

imx27-pinctrl 10015000.iomuxc: request pin 134 (MX27_PAD_UART2_TXD) for 1000b000.serial
imx27-pinctrl 10015000.iomuxc: request pin 135 (MX27_PAD_UART2_RXD) for 1000b000.serial
imx27-pinctrl 10015000.iomuxc: request pin 131 (MX27_PAD_UART2_CTS) for 1000b000.serial
imx27-pinctrl 10015000.iomuxc: request pin 132 (MX27_PAD_UART2_RTS) for 1000b000.serial
imx27-pinctrl 10015000.iomuxc: enable function uart group uart2-1 imx27-pinctrl 10015000.iomuxc: imx1_pmx_set, pin 0x86, function 0, gpio 0, direction 1, oconf 0, iconfa 0, iconfb 0
imx27-pinctrl 10015000.iomuxc: imx1_pmx_set, pin 0x87, function 0, gpio 0, direction 0, oconf 0, iconfa 0, iconfb 0
imx27-pinctrl 10015000.iomuxc: imx1_pmx_set, pin 0x83, function 0, gpio 0, direction 1, oconf 0, iconfa 0, iconfb 0
imx27-pinctrl 10015000.iomuxc: imx1_pmx_set, pin 0x84, function 0, gpio 0, direction 0, oconf 0, iconfa 0, iconfb 0
imx27-pinctrl 10015000.iomuxc: num_configs=1 PinID=134 imx27-pinctrl 10015000.iomuxc: pinconf set pullup pin MX27_PAD_UART1_RTS imx27-pinctrl 10015000.iomuxc: num_configs=1 PinID=135 imx27-pinctrl 10015000.iomuxc: pinconf set pullup pin MX27_PAD_RTCK imx27-pinctrl 10015000.iomuxc: num_configs=1 PinID=131 imx27-pinctrl 10015000.iomuxc: pinconf set pullup pin MX27_PAD_UART1_TXD imx27-pinctrl 10015000.iomuxc: num_configs=1 PinID=132 imx27-pinctrl 10015000.iomuxc: pinconf set pullup pin MX27_PAD_UART1_RXD
...
imx27-pinctrl 10015000.iomuxc: write: register 0xf4415508 offset 4 value 0x3 imx27-pinctrl 10015000.iomuxc: write: register 0xf4415510 offset 4 value 0x0 imx27-pinctrl 10015000.iomuxc: write: register 0xf4415518 offset 4 value 0x0 imx27-pinctrl 10015000.iomuxc: imx1_pmx_set, pin 0xb5, function 0, gpio 0, direction 1, oconf 0, iconfa 0, iconfb 0
imx27-pinctrl 10015000.iomuxc: num_configs=1 PinID=171

Unable to handle kernel paging request at virtual address 6c61765f
pgd = c0004000
6c61765f] *pgd=00000000
Internal error: Oops: 5 [#1] ARM
Modules linked in:
CPU: 0 PID: 1 Comm: swapper Not tainted 4.1.0-rc4-next-20150522-dirty #8
Hardware name: GTSYS i.MX27GTSIR (Device Tree Support)
task: ce832000 ti: ce848000 task.ti: ce848000
PC is at strnlen+0x28/0x3c
LR is at string.isra.4+0x34/0xcc
pc : [<c01ae188>]    lr : [<c01af9a4>]    psr: 20000093
Quoted 8 lines

sp : ce849a88 ip : ce849a98 fp : ce849a94
r10: c05d7e3a r9 : c05d81e4 r8 : 00000000
r7 : 6c61765f r6 : c05d81e4 r5 : ffffffff r4 : c05d7e3a r3 : 6c61765f r2 : 6c61765f r1 : 6c61765e r0 : 6c61765f
Flags: nzCv IRQs off FIQs on Mode SVC_32 ISA ARM Segment kernel

Patch applied. Can't seem so see anyone who's safeguarding this driver recently, putting some people on To:

Yours,
Linus Walleij

#2 lore raw

Hello,

Quoted 56 lines · Linus Walleij
Quoted 54 lines · Chris Ruehl

Bug in function imx1_pinconf_set() cause crash when princtrl debug is enabled and the pin_id becomes larger then the info->pins[] contains data.

imx27-pinctrl 10015000.iomuxc: request pin 134 (MX27_PAD_UART2_TXD) for 1000b000.serial
imx27-pinctrl 10015000.iomuxc: request pin 135 (MX27_PAD_UART2_RXD) for 1000b000.serial
imx27-pinctrl 10015000.iomuxc: request pin 131 (MX27_PAD_UART2_CTS) for 1000b000.serial
imx27-pinctrl 10015000.iomuxc: request pin 132 (MX27_PAD_UART2_RTS) for 1000b000.serial
imx27-pinctrl 10015000.iomuxc: enable function uart group uart2-1 imx27-pinctrl 10015000.iomuxc: imx1_pmx_set, pin 0x86, function 0, gpio 0, direction 1, oconf 0, iconfa 0, iconfb 0
imx27-pinctrl 10015000.iomuxc: imx1_pmx_set, pin 0x87, function 0, gpio 0, direction 0, oconf 0, iconfa 0, iconfb 0
imx27-pinctrl 10015000.iomuxc: imx1_pmx_set, pin 0x83, function 0, gpio 0, direction 1, oconf 0, iconfa 0, iconfb 0
imx27-pinctrl 10015000.iomuxc: imx1_pmx_set, pin 0x84, function 0, gpio 0, direction 0, oconf 0, iconfa 0, iconfb 0
imx27-pinctrl 10015000.iomuxc: num_configs=1 PinID=134 imx27-pinctrl 10015000.iomuxc: pinconf set pullup pin MX27_PAD_UART1_RTS imx27-pinctrl 10015000.iomuxc: num_configs=1 PinID=135 imx27-pinctrl 10015000.iomuxc: pinconf set pullup pin MX27_PAD_RTCK imx27-pinctrl 10015000.iomuxc: num_configs=1 PinID=131 imx27-pinctrl 10015000.iomuxc: pinconf set pullup pin MX27_PAD_UART1_TXD imx27-pinctrl 10015000.iomuxc: num_configs=1 PinID=132 imx27-pinctrl 10015000.iomuxc: pinconf set pullup pin MX27_PAD_UART1_RXD
...
imx27-pinctrl 10015000.iomuxc: write: register 0xf4415508 offset 4 value 0x3 imx27-pinctrl 10015000.iomuxc: write: register 0xf4415510 offset 4 value 0x0 imx27-pinctrl 10015000.iomuxc: write: register 0xf4415518 offset 4 value 0x0 imx27-pinctrl 10015000.iomuxc: imx1_pmx_set, pin 0xb5, function 0, gpio 0, direction 1, oconf 0, iconfa 0, iconfb 0
imx27-pinctrl 10015000.iomuxc: num_configs=1 PinID=171

Unable to handle kernel paging request at virtual address 6c61765f
pgd = c0004000
6c61765f] *pgd=00000000
Internal error: Oops: 5 [#1] ARM
Modules linked in:
CPU: 0 PID: 1 Comm: swapper Not tainted 4.1.0-rc4-next-20150522-dirty #8
Hardware name: GTSYS i.MX27GTSIR (Device Tree Support)
task: ce832000 ti: ce848000 task.ti: ce848000
PC is at strnlen+0x28/0x3c
LR is at string.isra.4+0x34/0xcc
pc : [<c01ae188>]    lr : [<c01af9a4>]    psr: 20000093

sp : ce849a88 ip : ce849a98 fp : ce849a94
r10: c05d7e3a r9 : c05d81e4 r8 : 00000000
r7 : 6c61765f r6 : c05d81e4 r5 : ffffffff r4 : c05d7e3a r3 : 6c61765f r2 : 6c61765f r1 : 6c61765e r0 : 6c61765f
Flags: nzCv IRQs off FIQs on Mode SVC_32 ISA ARM Segment kernel

Quoted 4 lines
Quoted 1 line

Patch applied. Can't seem so see anyone who's safeguarding this driver recently, putting some people on To:

I commented in that thread and the outcome from my POV was that the fix needs a better changelog and it could be optimised to not lookup the pin if debug is off. (I don't know the patch content, as it was stripped in the reply.)

Best regards
Uwe

Signature · 6 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#3 lore raw
Quoted 59 lines · Uwe Kleine-König
Quoted 58 lines · Linus Walleij
Quoted 55 lines · Chris Ruehl

Bug in function imx1_pinconf_set() cause crash when princtrl debug is enabled and the pin_id becomes larger then the info->pins[] contains data.

imx27-pinctrl 10015000.iomuxc: request pin 134 (MX27_PAD_UART2_TXD) for 1000b000.serial
imx27-pinctrl 10015000.iomuxc: request pin 135 (MX27_PAD_UART2_RXD) for 1000b000.serial
imx27-pinctrl 10015000.iomuxc: request pin 131 (MX27_PAD_UART2_CTS) for 1000b000.serial
imx27-pinctrl 10015000.iomuxc: request pin 132 (MX27_PAD_UART2_RTS) for 1000b000.serial
imx27-pinctrl 10015000.iomuxc: enable function uart group uart2-1 imx27-pinctrl 10015000.iomuxc: imx1_pmx_set, pin 0x86, function 0, gpio 0, direction 1, oconf 0, iconfa 0, iconfb 0
imx27-pinctrl 10015000.iomuxc: imx1_pmx_set, pin 0x87, function 0, gpio 0, direction 0, oconf 0, iconfa 0, iconfb 0
imx27-pinctrl 10015000.iomuxc: imx1_pmx_set, pin 0x83, function 0, gpio 0, direction 1, oconf 0, iconfa 0, iconfb 0
imx27-pinctrl 10015000.iomuxc: imx1_pmx_set, pin 0x84, function 0, gpio 0, direction 0, oconf 0, iconfa 0, iconfb 0
imx27-pinctrl 10015000.iomuxc: num_configs=1 PinID=134 imx27-pinctrl 10015000.iomuxc: pinconf set pullup pin MX27_PAD_UART1_RTS imx27-pinctrl 10015000.iomuxc: num_configs=1 PinID=135 imx27-pinctrl 10015000.iomuxc: pinconf set pullup pin MX27_PAD_RTCK imx27-pinctrl 10015000.iomuxc: num_configs=1 PinID=131 imx27-pinctrl 10015000.iomuxc: pinconf set pullup pin MX27_PAD_UART1_TXD imx27-pinctrl 10015000.iomuxc: num_configs=1 PinID=132 imx27-pinctrl 10015000.iomuxc: pinconf set pullup pin MX27_PAD_UART1_RXD
...
imx27-pinctrl 10015000.iomuxc: write: register 0xf4415508 offset 4 value 0x3 imx27-pinctrl 10015000.iomuxc: write: register 0xf4415510 offset 4 value 0x0 imx27-pinctrl 10015000.iomuxc: write: register 0xf4415518 offset 4 value 0x0 imx27-pinctrl 10015000.iomuxc: imx1_pmx_set, pin 0xb5, function 0, gpio 0, direction 1, oconf 0, iconfa 0, iconfb 0
imx27-pinctrl 10015000.iomuxc: num_configs=1 PinID=171

Unable to handle kernel paging request at virtual address 6c61765f
pgd = c0004000
6c61765f] *pgd=00000000
Internal error: Oops: 5 [#1] ARM
Modules linked in:
CPU: 0 PID: 1 Comm: swapper Not tainted 4.1.0-rc4-next-20150522-dirty #8
Hardware name: GTSYS i.MX27GTSIR (Device Tree Support)
task: ce832000 ti: ce848000 task.ti: ce848000
PC is at strnlen+0x28/0x3c
LR is at string.isra.4+0x34/0xcc
pc : [<c01ae188>]    lr : [<c01af9a4>]    psr: 20000093

sp : ce849a88 ip : ce849a98 fp : ce849a94
r10: c05d7e3a r9 : c05d81e4 r8 : 00000000
r7 : 6c61765f r6 : c05d81e4 r5 : ffffffff r4 : c05d7e3a r3 : 6c61765f r2 : 6c61765f r1 : 6c61765e r0 : 6c61765f
Flags: nzCv IRQs off FIQs on Mode SVC_32 ISA ARM Segment kernel

Quoted 7 lines
Quoted 2 lines

Patch applied. Can't seem so see anyone who's safeguarding this driver recently, putting some people on To:

I commented in that thread and the outcome from my POV was that the fix needs a better changelog and it could be optimised to not lookup the pin if debug is off. (I don't know the patch content, as it was stripped in the reply.)

OK Chris will you send a new version of this patch?

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw
Quoted 9 lines
Quoted 8 lines
Quoted 3 lines

Patch applied. Can't seem so see anyone who's safeguarding this driver recently, putting some people on To:

I commented in that thread and the outcome from my POV was that the fix needs a better changelog and it could be optimised to not lookup the pin if debug is off. (I don't know the patch content, as it was stripped in the reply.)

Quoted 5 lines

OK Chris will you send a new version of this patch?

Yours,
Linus Walleij

Hi Uwe

If you don't mind take over the ownership of patching this issue?

I'm very busy at the moment and afraid it takes too long to bring the right comments etc..

Thanks
Chris

Signature · 6 lines
GTSYS Limited RFID Technology
9/F, Unit E, R07, Kwai Shing Industrial Building Phase 2,
42-46 Tai Lin Pai Road, Kwai Chung, N.T., Hong Kong
Tel (852) 9079 9521

Disclaimer: http://www.gtsys.com.hk/email/classified.html
#5 lore raw

PATCH 1/1 Subject: pinctrl: imx1-core: Fix debug output in .pin_config_set callback

imx1_pinconf_set assumes that the array of pins in struct imx1_pinctrl_soc_info can be indexed by pin id to get the pinctrl_pin_desc for a pin. This used to be correct up to commit 607af165c047 which removed some entries from the array and so made it wrong to access the array by pin id.

The result of this bug is a wrong pin name in the output for small pin ids and an oops for the bigger ones.

This patch is the result of a discussion that includes patches by Markus Pargmann and Chris Ruehl.

Fixes 607af165c047 ("pinctrl: i.MX27: Remove nonexistent pad definitions")
Cc stable at vger.kernel.org
---
 drivers/pinctrl/freescale/pinctrl-imx1-core.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/pinctrl/freescale/pinctrl-imx1-core.c +1 -2
index 5fd4437cee15..88a7fac11bd4 100644
@@ -403,14 +403,13 @@ static int imx1_pinconf_set(struct pinctrl_dev *pctldev,
 			     unsigned num_configs)
 {
 	struct imx1_pinctrl *ipctl = pinctrl_dev_get_drvdata(pctldev);
-	const struct imx1_pinctrl_soc_info *info = ipctl->info;
 	int i;
 
 	for (i = 0; i != num_configs; ++i) {
 		imx1_write_bit(ipctl, pin_id, configs[i] & 0x01, MX1_PUEN);
 
 		dev_dbg(ipctl->dev, "pinconf set pullup pin %s\n",
-			info->pins[pin_id].name);
+			pin_desc_get(pctldev, pin_id)->name);
 	}
 
 	return 0;
Signature · 1 line
2.1.4
#6 lore raw

PATCH 1/1 Subject: pinctrl: imx1-core: Fix debug output in .pin_config_set callback

Quoted 9 lines · Uwe Kleine-K?nig

imx1_pinconf_set assumes that the array of pins in struct imx1_pinctrl_soc_info can be indexed by pin id to get the pinctrl_pin_desc for a pin. This used to be correct up to commit 607af165c047 which removed some entries from the array and so made it wrong to access the array by pin id.

The result of this bug is a wrong pin name in the output for small pin ids and an oops for the bigger ones.

Quoted 7 lines

This patch is the result of a discussion that includes patches by Markus Pargmann and Chris Ruehl.

Fixes 607af165c047 ("pinctrl: i.MX27: Remove nonexistent pad definitions")
Cc stable at vger.kernel.org
Quoted 32 lines
---
 drivers/pinctrl/freescale/pinctrl-imx1-core.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/pinctrl/freescale/pinctrl-imx1-core.c +1 -2
index 5fd4437cee15..88a7fac11bd4 100644
@@ -403,14 +403,13 @@ static int imx1_pinconf_set(struct pinctrl_dev *pctldev,
 			     unsigned num_configs)
 {
 	struct imx1_pinctrl *ipctl = pinctrl_dev_get_drvdata(pctldev);
-	const struct imx1_pinctrl_soc_info *info = ipctl->info;
 	int i;
 
 	for (i = 0; i != num_configs; ++i) {
 		imx1_write_bit(ipctl, pin_id, configs[i] & 0x01, MX1_PUEN);
 
 		dev_dbg(ipctl->dev, "pinconf set pullup pin %s\n",
-			info->pins[pin_id].name);
+			pin_desc_get(pctldev, pin_id)->name);
 	}
 
 	return 0;
Signature · 7 lines
2.1.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Signature · 11 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150717/ecd666ac/attachment.sig>
#7 lore raw

PATCH 1/1 Subject: pinctrl: imx1-core: Fix debug output in .pin_config_set callback

In reply to Uwe Kleine-König
Quoted 9 lines · Uwe Kleine-K?nig

imx1_pinconf_set assumes that the array of pins in struct imx1_pinctrl_soc_info can be indexed by pin id to get the pinctrl_pin_desc for a pin. This used to be correct up to commit 607af165c047 which removed some entries from the array and so made it wrong to access the array by pin id.

The result of this bug is a wrong pin name in the output for small pin ids and an oops for the bigger ones.

Quoted 7 lines

This patch is the result of a discussion that includes patches by Markus Pargmann and Chris Ruehl.

Fixes 607af165c047 ("pinctrl: i.MX27: Remove nonexistent pad definitions")
Cc stable at vger.kernel.org

Patch applied for fixes with Markus' review tag.

Yours,
Linus Walleij