[PATCH RESEND V2] usb: musb: am35xx: drop spurious unplugging a device

2012-10-15 Thread Stefano Babic
On AM3517, tx and rx interrupt are detected together with
the disconnect event. This generates a kernel panic in musb_interrupt,
because rx / tx are handled after disconnect.
This issue was seen on a Technexion's TAM3517 SOM. Unplugging a device,
tx / rx interrupts together with disconnect are detected. This brings
to kernel panic like this:

[   68.526153] Unable to handle kernel NULL pointer dereference at virtual 
address 0011
[   68.534698] pgd = c0004000
[   68.537536] [0011] *pgd=
[   68.541351] Internal error: Oops: 17 [#1] ARM
[   68.545928] Modules linked in:
[   68.549163] CPU: 0Not tainted  (3.6.0-rc5-00020-g9e05905 #178)
[   68.555694] PC is at rxstate+0x8/0xdc
[   68.559539] LR is at musb_interrupt+0x98/0x858
[   68.564239] pc : []lr : []psr: 4193
[   68.564239] sp : ce83fb40  ip : d0906410  fp : 
[   68.576293] r10:   r9 : cf3b0e40  r8 : 0002
[   68.581817] r7 : 0019  r6 : 0001  r5 : 0001  r4 : 00d4
[   68.588684] r3 :   r2 :   r1 : ffcc  r0 : cf23c108
[   68.595550] Flags: nZcv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment ke

Note: this behavior is not seen with a USB hub, while it is
easy to reproduce connecting a USB-pen directly to the USB-A of
the board.

Drop tx / rx interrupts if disconnect is detected.

Signed-off-by: Stefano Babic 
CC: Felipe Balbi 
Cc: sta...@vger.kernel.org # 3.5 3.6
Tested-by: Dmitry Lifshitz 
Tested-by: Igor Grinberg 
---

Changes:
- correct commit message
- add tested-by from previous posting
- sent also to stable as suggested (Igor Grinberg)
- resend due to missing CC tag in commit message for stable

 drivers/usb/musb/am35x.c |6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/usb/musb/am35x.c b/drivers/usb/musb/am35x.c
index b9b165b..b5c813a 100644
--- a/drivers/usb/musb/am35x.c
+++ b/drivers/usb/musb/am35x.c
@@ -312,6 +312,12 @@ static irqreturn_t am35x_musb_interrupt(int irq, void *hci)
ret = IRQ_HANDLED;
}
 
+   /* Drop spurious RX and TX if device is disconnected */
+   if (musb->int_usb & MUSB_INTR_DISCONNECT) {
+   musb->int_tx = 0;
+   musb->int_rx = 0;
+   }
+
if (musb->int_tx || musb->int_rx || musb->int_usb)
ret |= musb_interrupt(musb);
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH V2] usb: musb: am35xx: drop spurious unplugging a device

2012-10-09 Thread Stefano Babic
On AM3517, tx and rx interrupt are detected together with
the disconnect event. This generates a kernel panic in musb_interrupt,
because rx / tx are handled after disconnect.
This issue was seen on a Technexion's TAM3517 SOM. Unplugging a device,
tx / rx interrupts together with disconnect are detected. This brings
to kernel panic like this:

[   68.526153] Unable to handle kernel NULL pointer dereference at virtual 
address 0011
[   68.534698] pgd = c0004000
[   68.537536] [0011] *pgd=
[   68.541351] Internal error: Oops: 17 [#1] ARM
[   68.545928] Modules linked in:
[   68.549163] CPU: 0Not tainted  (3.6.0-rc5-00020-g9e05905 #178)
[   68.555694] PC is at rxstate+0x8/0xdc
[   68.559539] LR is at musb_interrupt+0x98/0x858
[   68.564239] pc : []lr : []psr: 4193
[   68.564239] sp : ce83fb40  ip : d0906410  fp : 
[   68.576293] r10:   r9 : cf3b0e40  r8 : 0002
[   68.581817] r7 : 0019  r6 : 0001  r5 : 0001  r4 : 00d4
[   68.588684] r3 :   r2 :   r1 : ffcc  r0 : cf23c108
[   68.595550] Flags: nZcv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment ke

Note: this behavior is not seen with a USB hub, while it is
easy to reproduce connecting a USB-pen directly to the USB-A of
the board.

Drop tx / rx interrupts if disconnect is detected.

Signed-off-by: Stefano Babic 
CC: Felipe Balbi 
Tested-by: Dmitry Lifshitz 
Tested-by: Igor Grinberg 
---

Changes:
- correct commit message
- add tested-by from previous posting
- sent also to stable as suggested (Igor Grinberg)

 drivers/usb/musb/am35x.c |6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/usb/musb/am35x.c b/drivers/usb/musb/am35x.c
index b9b165b..b5c813a 100644
--- a/drivers/usb/musb/am35x.c
+++ b/drivers/usb/musb/am35x.c
@@ -312,6 +312,12 @@ static irqreturn_t am35x_musb_interrupt(int irq, void *hci)
ret = IRQ_HANDLED;
}
 
+   /* Drop spurious RX and TX if device is disconnected */
+   if (musb->int_usb & MUSB_INTR_DISCONNECT) {
+   musb->int_tx = 0;
+   musb->int_rx = 0;
+   }
+
if (musb->int_tx || musb->int_rx || musb->int_usb)
ret |= musb_interrupt(musb);
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] usb: musb: am35xx: drop spurious unplugging a device

2012-10-09 Thread Stefano Babic
On 09/10/2012 13:59, Igor Grinberg wrote:
> On 10/04/12 14:34, Stefano Babic wrote:
>> On AM3517, tx and rx interrupt are detected together with
>> the disconnect event. This generates a kernel panic in musb_interrupt,
>> because rx / tx are handled after disconnect.
>> This issue was seen with Technexion's TAM3517 SOM. Unplugging a device,
>> tx / rx interrupts togetehr with disconnect are detected. This brings
>> to kernel panic like this:
>>
>> [   68.526153] Unable to handle kernel NULL pointer dereference at virtual 
>> address 0011
>> [   68.534698] pgd = c0004000
>> [   68.537536] [0011] *pgd=
>> [   68.541351] Internal error: Oops: 17 [#1] ARM
>> [   68.545928] Modules linked in:
>> [   68.549163] CPU: 0Not tainted  (3.6.0-rc5-00020-g9e05905 #178)
>> [   68.555694] PC is at rxstate+0x8/0xdc
>> [   68.559539] LR is at musb_interrupt+0x98/0x858
>> [   68.564239] pc : []lr : []psr: 4193
>> [   68.564239] sp : ce83fb40  ip : d0906410  fp : 
>> [   68.576293] r10:   r9 : cf3b0e40  r8 : 0002
>> [   68.581817] r7 : 0019  r6 : 0001  r5 : 0001  r4 : 00d4
>> [   68.588684] r3 :   r2 :   r1 : ffcc  r0 : cf23c108
>> [   68.595550] Flags: nZcv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment 
>> ke
>>
>> Note: this behavior is not seen with a USB hub, while it is
>> easy to reproduce connectict a USB-poen directly to the USB-A of
>> the board.
>>
>> Drop tx / rx interrupts if disconnect is detected.
>>
>> Signed-off-by: Stefano Babic 
>> CC: Felipe Balbi 
> 
> Tested-by: Dmitry Lifshitz 
> Tested-by: Igor Grinberg 
> 

Hi Igor,

> This patch fixes a real bug and probably has been present for some
> time already, so I think:
> Cc: sta...@vger.kernel.org
> would be appropriate here.

Ok - I should also fix some spelling error in the comit message, and
then I resend to this ML with CC stable.

Thanks for testing,
Stefano Babic


-- 
=
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de
=
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] usb: musb: am35xx: drop spurious unplugging a device

2012-10-04 Thread Stefano Babic
On AM3517, tx and rx interrupt are detected together with
the disconnect event. This generates a kernel panic in musb_interrupt,
because rx / tx are handled after disconnect.
This issue was seen with Technexion's TAM3517 SOM. Unplugging a device,
tx / rx interrupts togetehr with disconnect are detected. This brings
to kernel panic like this:

[   68.526153] Unable to handle kernel NULL pointer dereference at virtual 
address 0011
[   68.534698] pgd = c0004000
[   68.537536] [0011] *pgd=
[   68.541351] Internal error: Oops: 17 [#1] ARM
[   68.545928] Modules linked in:
[   68.549163] CPU: 0Not tainted  (3.6.0-rc5-00020-g9e05905 #178)
[   68.555694] PC is at rxstate+0x8/0xdc
[   68.559539] LR is at musb_interrupt+0x98/0x858
[   68.564239] pc : []lr : []psr: 4193
[   68.564239] sp : ce83fb40  ip : d0906410  fp : 
[   68.576293] r10:   r9 : cf3b0e40  r8 : 0002
[   68.581817] r7 : 0019  r6 : 0001  r5 : 0001  r4 : 00d4
[   68.588684] r3 :   r2 :   r1 : ffcc  r0 : cf23c108
[   68.595550] Flags: nZcv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment ke

Note: this behavior is not seen with a USB hub, while it is
easy to reproduce connectict a USB-poen directly to the USB-A of
the board.

Drop tx / rx interrupts if disconnect is detected.

Signed-off-by: Stefano Babic 
CC: Felipe Balbi 
---

 drivers/usb/musb/am35x.c |6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/usb/musb/am35x.c b/drivers/usb/musb/am35x.c
index b9b165b..b5c813a 100644
--- a/drivers/usb/musb/am35x.c
+++ b/drivers/usb/musb/am35x.c
@@ -312,6 +312,12 @@ static irqreturn_t am35x_musb_interrupt(int irq, void *hci)
ret = IRQ_HANDLED;
}
 
+   /* Drop spurious RX and TX if device is disconnected */
+   if (musb->int_usb & MUSB_INTR_DISCONNECT) {
+   musb->int_tx = 0;
+   musb->int_rx = 0;
+   }
+
if (musb->int_tx || musb->int_rx || musb->int_usb)
ret |= musb_interrupt(musb);
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html