<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/drivers/usb/musb, branch v3.14.52</title>
<subtitle>Linux kernel for Apalis and Colibri modules</subtitle>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/'/>
<entry>
<title>usb: musb: host: rely on port_mode to call musb_start()</title>
<updated>2015-08-03T16:29:55+00:00</updated>
<author>
<name>Felipe Balbi</name>
<email>balbi@ti.com</email>
</author>
<published>2015-06-02T18:03:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=26cbf8ea380a3e1ed1c22697c476e0576531d7a3'/>
<id>26cbf8ea380a3e1ed1c22697c476e0576531d7a3</id>
<content type='text'>
commit be9d39881fc4fa39a64b6eed6bab5d9ee5125344 upstream.

Currently, we're calling musb_start() twice for DRD ports
in some situations. This has been observed to cause enumeration
issues after suspend/resume cycles with AM335x.

In order to fix the problem, we just have to fix the check
on musb_has_gadget() so that it only returns true if
current mode is Host and ignore the fact that we have or
not a gadget driver loaded.

Fixes: ae44df2e21b5 (usb: musb: call musb_start() only once in OTG mode)
Cc: Sebastian Andrzej Siewior &lt;bigeasy@linutronix.de&gt;
Tested-by: Sekhar Nori &lt;nsekhar@ti.com&gt;
Signed-off-by: Felipe Balbi &lt;balbi@ti.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit be9d39881fc4fa39a64b6eed6bab5d9ee5125344 upstream.

Currently, we're calling musb_start() twice for DRD ports
in some situations. This has been observed to cause enumeration
issues after suspend/resume cycles with AM335x.

In order to fix the problem, we just have to fix the check
on musb_has_gadget() so that it only returns true if
current mode is Host and ignore the fact that we have or
not a gadget driver loaded.

Fixes: ae44df2e21b5 (usb: musb: call musb_start() only once in OTG mode)
Cc: Sebastian Andrzej Siewior &lt;bigeasy@linutronix.de&gt;
Tested-by: Sekhar Nori &lt;nsekhar@ti.com&gt;
Signed-off-by: Felipe Balbi &lt;balbi@ti.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>usb: musb: use new USB_RESUME_TIMEOUT</title>
<updated>2015-05-13T12:16:58+00:00</updated>
<author>
<name>Felipe Balbi</name>
<email>balbi@ti.com</email>
</author>
<published>2015-02-13T20:46:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=0e0fc26cb3ebaf37450eae399c92601d21388f70'/>
<id>0e0fc26cb3ebaf37450eae399c92601d21388f70</id>
<content type='text'>
commit 309be239369609929d5d3833ee043f7c5afc95d1 upstream.

Make sure we're using the new macro, so our
resume signaling will always pass certification.

Based on original work by Bin Liu &lt;Bin Liu &lt;b-liu@ti.com&gt;&gt;

Cc: Bin Liu &lt;b-liu@ti.com&gt;
Signed-off-by: Felipe Balbi &lt;balbi@ti.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;



</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 309be239369609929d5d3833ee043f7c5afc95d1 upstream.

Make sure we're using the new macro, so our
resume signaling will always pass certification.

Based on original work by Bin Liu &lt;Bin Liu &lt;b-liu@ti.com&gt;&gt;

Cc: Bin Liu &lt;b-liu@ti.com&gt;
Signed-off-by: Felipe Balbi &lt;balbi@ti.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;



</pre>
</div>
</content>
</entry>
<entry>
<title>usb: musb: stuff leak of struct usb_hcd</title>
<updated>2015-01-27T16:18:57+00:00</updated>
<author>
<name>Sebastian Andrzej Siewior</name>
<email>bigeasy@linutronix.de</email>
</author>
<published>2014-12-11T17:14:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=97ab28073bcc3299080bbaba025861d053e70f43'/>
<id>97ab28073bcc3299080bbaba025861d053e70f43</id>
<content type='text'>
commit 68693b8ea4e284c46bff919ac62bd9ccdfdbb6ba upstream.

since the split of host+gadget mode in commit 74c2e9360058 ("usb: musb:
factor out hcd initalization") we leak the usb_hcd struct. We call now
musb_host_cleanup() which does basically usb_remove_hcd() and also sets
the hcd variable to NULL. Doing so makes the finall call to
musb_host_free() basically a nop and the usb_hcd remains around for ever
without anowner.
This patch drops that NULL assignment for that reason.

Fixes: 74c2e9360058 ("usb: musb: factor out hcd initalization")
Cc: Daniel Mack &lt;zonque@gmail.com&gt;
Signed-off-by: Sebastian Andrzej Siewior &lt;bigeasy@linutronix.de&gt;
Signed-off-by: Felipe Balbi &lt;balbi@ti.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 68693b8ea4e284c46bff919ac62bd9ccdfdbb6ba upstream.

since the split of host+gadget mode in commit 74c2e9360058 ("usb: musb:
factor out hcd initalization") we leak the usb_hcd struct. We call now
musb_host_cleanup() which does basically usb_remove_hcd() and also sets
the hcd variable to NULL. Doing so makes the finall call to
musb_host_free() basically a nop and the usb_hcd remains around for ever
without anowner.
This patch drops that NULL assignment for that reason.

Fixes: 74c2e9360058 ("usb: musb: factor out hcd initalization")
Cc: Daniel Mack &lt;zonque@gmail.com&gt;
Signed-off-by: Sebastian Andrzej Siewior &lt;bigeasy@linutronix.de&gt;
Signed-off-by: Felipe Balbi &lt;balbi@ti.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>usb: musb: dsps: start OTG timer on resume again</title>
<updated>2014-11-14T17:00:05+00:00</updated>
<author>
<name>Sebastian Andrzej Siewior</name>
<email>bigeasy@linutronix.de</email>
</author>
<published>2014-10-13T10:16:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=b944ad83dbdaa0d02ed9e0a1d5749475f62561a4'/>
<id>b944ad83dbdaa0d02ed9e0a1d5749475f62561a4</id>
<content type='text'>
commit 53185b3a441a6cc9bb3f57e924342d249138dcd6 upstream.

Commit 468bcc2a2ca ("usb: musb: dsps: kill OTG timer on suspend") stopped
the timer in suspend path but forgot the re-enable it in the resume
path. This patch fixes the behaviour.

Fixes 468bcc2a2ca "usb: musb: dsps: kill OTG timer on suspend"
Signed-off-by: Sebastian Andrzej Siewior &lt;bigeasy@linutronix.de&gt;
Signed-off-by: Felipe Balbi &lt;balbi@ti.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 53185b3a441a6cc9bb3f57e924342d249138dcd6 upstream.

Commit 468bcc2a2ca ("usb: musb: dsps: kill OTG timer on suspend") stopped
the timer in suspend path but forgot the re-enable it in the resume
path. This patch fixes the behaviour.

Fixes 468bcc2a2ca "usb: musb: dsps: kill OTG timer on suspend"
Signed-off-by: Sebastian Andrzej Siewior &lt;bigeasy@linutronix.de&gt;
Signed-off-by: Felipe Balbi &lt;balbi@ti.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>usb: musb: cppi41: restart hrtimer only if not yet done</title>
<updated>2014-11-14T17:00:05+00:00</updated>
<author>
<name>Thomas Gleixner</name>
<email>tglx@linutronix.de</email>
</author>
<published>2014-10-02T15:32:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=be7cabe556695e136f983623e22c3c52de25dc1b'/>
<id>be7cabe556695e136f983623e22c3c52de25dc1b</id>
<content type='text'>
commit d2e6d62c9cbbc2da4211f672dbeea08960e29a80 upstream.

commit c58d80f52 ("usb: musb: Ensure that cppi41 timer gets armed on
premature DMA TX irq") fixed hrtimer scheduling bug. There is one left
which does not trigger that often.
The following scenario is still possible:

    lock(&amp;x-&gt;lock);
    hrtimer_start(&amp;x-&gt;t);
    unlock(&amp;x-&gt;lock);

expires:
    t-&gt;function();
                                lock(&amp;x-&gt;lock);
    lock(&amp;x-&gt;lock);             if (!hrtimer_queued(&amp;x-&gt;t))
                                        hrtimer_start(&amp;x-&gt;t);
                                unlock(&amp;x-&gt;lock);

    if (!list_empty(x-&gt;early_tx_list))
           ret = HRTIMER_RESTART;
-&gt;         hrtimer_forward_now(...)
    } else
           ret = HRTIMER_NORESTART;

    unlock(&amp;x-&gt;lock);

and the timer callback returns HRTIMER_RESTART for an armed timer. This
is wrong and we run into the BUG_ON() in __run_hrtimer().
This can happens on SMP or PREEMPT-RT.
The patch fixes the problem by only starting the timer if the timer is
not yet queued.

Reported-by: Torben Hohn &lt;torbenh@linutronix.de&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
[bigeasy: collected information and created a patch + description based
          on it]
Signed-off-by: Sebastian Andrzej Siewior &lt;bigeasy@linutronix.de&gt;
Signed-off-by: Felipe Balbi &lt;balbi@ti.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit d2e6d62c9cbbc2da4211f672dbeea08960e29a80 upstream.

commit c58d80f52 ("usb: musb: Ensure that cppi41 timer gets armed on
premature DMA TX irq") fixed hrtimer scheduling bug. There is one left
which does not trigger that often.
The following scenario is still possible:

    lock(&amp;x-&gt;lock);
    hrtimer_start(&amp;x-&gt;t);
    unlock(&amp;x-&gt;lock);

expires:
    t-&gt;function();
                                lock(&amp;x-&gt;lock);
    lock(&amp;x-&gt;lock);             if (!hrtimer_queued(&amp;x-&gt;t))
                                        hrtimer_start(&amp;x-&gt;t);
                                unlock(&amp;x-&gt;lock);

    if (!list_empty(x-&gt;early_tx_list))
           ret = HRTIMER_RESTART;
-&gt;         hrtimer_forward_now(...)
    } else
           ret = HRTIMER_NORESTART;

    unlock(&amp;x-&gt;lock);

and the timer callback returns HRTIMER_RESTART for an armed timer. This
is wrong and we run into the BUG_ON() in __run_hrtimer().
This can happens on SMP or PREEMPT-RT.
The patch fixes the problem by only starting the timer if the timer is
not yet queued.

Reported-by: Torben Hohn &lt;torbenh@linutronix.de&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
[bigeasy: collected information and created a patch + description based
          on it]
Signed-off-by: Sebastian Andrzej Siewior &lt;bigeasy@linutronix.de&gt;
Signed-off-by: Felipe Balbi &lt;balbi@ti.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>usb: musb: dsps: kill OTG timer on suspend</title>
<updated>2014-10-15T06:36:43+00:00</updated>
<author>
<name>Felipe Balbi</name>
<email>balbi@ti.com</email>
</author>
<published>2014-09-15T14:03:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=914435e6a2648d4f78aba661f9a5d178a011e35a'/>
<id>914435e6a2648d4f78aba661f9a5d178a011e35a</id>
<content type='text'>
commit 468bcc2a2ca071f652009d2d20d97f2437630cae upstream.

if we don't make sure to kill the timer, it could
expire after we have already gated our clocks.

That will trigger a Data Abort exception because
we would try to access register while clock is gated.

Fix that bug.

Fixes 869c597 (usb: musb: dsps: add support for suspend and resume)
Tested-by: Dave Gerlach &lt;d-gerlach@ti.com&gt;
Signed-off-by: Felipe Balbi &lt;balbi@ti.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 468bcc2a2ca071f652009d2d20d97f2437630cae upstream.

if we don't make sure to kill the timer, it could
expire after we have already gated our clocks.

That will trigger a Data Abort exception because
we would try to access register while clock is gated.

Fix that bug.

Fixes 869c597 (usb: musb: dsps: add support for suspend and resume)
Tested-by: Dave Gerlach &lt;d-gerlach@ti.com&gt;
Signed-off-by: Felipe Balbi &lt;balbi@ti.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>usb: musb: Fix panic upon musb_am335x module removal</title>
<updated>2014-07-09T18:18:24+00:00</updated>
<author>
<name>Ezequiel Garcia</name>
<email>ezequiel@vanguardiasur.com.ar</email>
</author>
<published>2014-06-23T18:34:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=6ea07d9b040bd42f4398e413a09d8f5795756886'/>
<id>6ea07d9b040bd42f4398e413a09d8f5795756886</id>
<content type='text'>
commit 7adb5c876e9c0677078a1e1094c6eafd29c30b74 upstream.

At probe time, the musb_am335x driver register its childs by
calling of_platform_populate(), which registers all childs in
the devicetree hierarchy recursively.

On the other side, the driver's remove() function uses of_device_unregister()
to remove each child of musb_am335x's.

However, when musb_dsps is loaded, its devices are attached to the musb_am335x
device as musb_am335x childs. Hence, musb_am335x remove() will attempt to
unregister the devices registered by musb_dsps, which produces a kernel panic.

In other words, the childs in the "struct device" hierarchy are not the same
as the childs in the "devicetree" hierarchy.

Ideally, we should enforce the removal of the devices registered by
musb_am335x *only*, instead of all its child devices. However, because of the
recursive nature of of_platform_populate, this doesn't seem possible.

Therefore, as the only solution at hand, this commit disables musb_am335x
driver removal capability, preventing it from being ever removed. This was
originally suggested by Sebastian Siewior:

https://www.mail-archive.com/linux-omap@vger.kernel.org/msg104946.html

And for reference, here's the panic upon module removal:

musb-hdrc musb-hdrc.0.auto: remove, state 4
usb usb1: USB disconnect, device number 1
musb-hdrc musb-hdrc.0.auto: USB bus 1 deregistered
Unable to handle kernel NULL pointer dereference at virtual address 0000008c
pgd = de11c000
[0000008c] *pgd=9e174831, *pte=00000000, *ppte=00000000
Internal error: Oops: 17 [#1] ARM
Modules linked in: musb_am335x(-) musb_dsps musb_hdrc usbcore usb_common
CPU: 0 PID: 623 Comm: modprobe Not tainted 3.15.0-rc4-00001-g24efd13 #69
task: de1b7500 ti: de122000 task.ti: de122000
PC is at am335x_shutdown+0x10/0x28
LR is at am335x_shutdown+0xc/0x28
pc : [&lt;c0327798&gt;]    lr : [&lt;c0327794&gt;]    psr: a0000013
sp : de123df8  ip : 00000004  fp : 00028f00
r10: 00000000  r9 : de122000  r8 : c000e6c4
r7 : de0e3c10  r6 : de0e3800  r5 : de624010  r4 : de1ec750
r3 : de0e3810  r2 : 00000000  r1 : 00000001  r0 : 00000000
Flags: NzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
Control: 10c5387d  Table: 9e11c019  DAC: 00000015
Process modprobe (pid: 623, stack limit = 0xde122240)
Stack: (0xde123df8 to 0xde124000)
3de0:                                                       de0e3810 bf054488
3e00: bf05444c de624010 60000013 bf043650 000012fc de624010 de0e3810 bf043a20
3e20: de0e3810 bf04b240 c0635b88 c02ca37c c02ca364 c02c8db0 de1b7500 de0e3844
3e40: de0e3810 c02c8e28 c0635b88 de02824c de0e3810 c02c884c de0e3800 de0e3810
3e60: de0e3818 c02c5b20 bf05417c de0e3800 de0e3800 c0635b88 de0f2410 c02ca838
3e80: bf05417c de0e3800 bf055438 c02ca8cc de0e3c10 bf054194 de0e3c10 c02ca37c
3ea0: c02ca364 c02c8db0 de1b7500 de0e3c44 de0e3c10 c02c8e28 c0635b88 de02824c
3ec0: de0e3c10 c02c884c de0e3c10 de0e3c10 de0e3c18 c02c5b20 de0e3c10 de0e3c10
3ee0: 00000000 bf059000 a0000013 c02c5bc0 00000000 bf05900c de0e3c10 c02c5c48
3f00: de0dd0c0 de1ec970 de0f2410 bf05929c de0f2444 bf05902c de0f2410 c02ca37c
3f20: c02ca364 c02c8db0 bf05929c de0f2410 bf05929c c02c94c8 bf05929c 00000000
3f40: 00000800 c02c8ab4 bf0592e0 c007fc40 c00dd820 6273756d 336d615f 00783533
3f60: c064a0ac de1b7500 de122000 de1b7500 c000e590 00000001 c000e6c4 c0060160
3f80: 00028e70 00028e70 00028ea4 00000081 60000010 00028e70 00028e70 00028ea4
3fa0: 00000081 c000e500 00028e70 00028e70 00028ea4 00000800 becb59f8 00027608
3fc0: 00028e70 00028e70 00028ea4 00000081 00000001 00000001 00000000 00028f00
3fe0: b6e6b6f0 becb59d4 000160e8 b6e6b6fc 60000010 00028ea4 00000000 00000000
[&lt;c0327798&gt;] (am335x_shutdown) from [&lt;bf054488&gt;] (dsps_musb_exit+0x3c/0x4c [musb_dsps])
[&lt;bf054488&gt;] (dsps_musb_exit [musb_dsps]) from [&lt;bf043650&gt;] (musb_shutdown+0x80/0x90 [musb_hdrc])
[&lt;bf043650&gt;] (musb_shutdown [musb_hdrc]) from [&lt;bf043a20&gt;] (musb_remove+0x24/0x68 [musb_hdrc])
[&lt;bf043a20&gt;] (musb_remove [musb_hdrc]) from [&lt;c02ca37c&gt;] (platform_drv_remove+0x18/0x1c)
[&lt;c02ca37c&gt;] (platform_drv_remove) from [&lt;c02c8db0&gt;] (__device_release_driver+0x70/0xc8)
[&lt;c02c8db0&gt;] (__device_release_driver) from [&lt;c02c8e28&gt;] (device_release_driver+0x20/0x2c)
[&lt;c02c8e28&gt;] (device_release_driver) from [&lt;c02c884c&gt;] (bus_remove_device+0xdc/0x10c)
[&lt;c02c884c&gt;] (bus_remove_device) from [&lt;c02c5b20&gt;] (device_del+0x104/0x198)
[&lt;c02c5b20&gt;] (device_del) from [&lt;c02ca838&gt;] (platform_device_del+0x14/0x9c)
[&lt;c02ca838&gt;] (platform_device_del) from [&lt;c02ca8cc&gt;] (platform_device_unregister+0xc/0x20)
[&lt;c02ca8cc&gt;] (platform_device_unregister) from [&lt;bf054194&gt;] (dsps_remove+0x18/0x38 [musb_dsps])
[&lt;bf054194&gt;] (dsps_remove [musb_dsps]) from [&lt;c02ca37c&gt;] (platform_drv_remove+0x18/0x1c)
[&lt;c02ca37c&gt;] (platform_drv_remove) from [&lt;c02c8db0&gt;] (__device_release_driver+0x70/0xc8)
[&lt;c02c8db0&gt;] (__device_release_driver) from [&lt;c02c8e28&gt;] (device_release_driver+0x20/0x2c)
[&lt;c02c8e28&gt;] (device_release_driver) from [&lt;c02c884c&gt;] (bus_remove_device+0xdc/0x10c)
[&lt;c02c884c&gt;] (bus_remove_device) from [&lt;c02c5b20&gt;] (device_del+0x104/0x198)
[&lt;c02c5b20&gt;] (device_del) from [&lt;c02c5bc0&gt;] (device_unregister+0xc/0x20)
[&lt;c02c5bc0&gt;] (device_unregister) from [&lt;bf05900c&gt;] (of_remove_populated_child+0xc/0x14 [musb_am335x])
[&lt;bf05900c&gt;] (of_remove_populated_child [musb_am335x]) from [&lt;c02c5c48&gt;] (device_for_each_child+0x44/0x70)
[&lt;c02c5c48&gt;] (device_for_each_child) from [&lt;bf05902c&gt;] (am335x_child_remove+0x18/0x30 [musb_am335x])
[&lt;bf05902c&gt;] (am335x_child_remove [musb_am335x]) from [&lt;c02ca37c&gt;] (platform_drv_remove+0x18/0x1c)
[&lt;c02ca37c&gt;] (platform_drv_remove) from [&lt;c02c8db0&gt;] (__device_release_driver+0x70/0xc8)
[&lt;c02c8db0&gt;] (__device_release_driver) from [&lt;c02c94c8&gt;] (driver_detach+0xb4/0xb8)
[&lt;c02c94c8&gt;] (driver_detach) from [&lt;c02c8ab4&gt;] (bus_remove_driver+0x4c/0xa0)
[&lt;c02c8ab4&gt;] (bus_remove_driver) from [&lt;c007fc40&gt;] (SyS_delete_module+0x128/0x1cc)
[&lt;c007fc40&gt;] (SyS_delete_module) from [&lt;c000e500&gt;] (ret_fast_syscall+0x0/0x48)

Fixes: 97238b35d5bb ("usb: musb: dsps: use proper child nodes")
Acked-by: George Cherian &lt;george.cherian@ti.com&gt;
Signed-off-by: Ezequiel Garcia &lt;ezequiel@vanguardiasur.com.ar&gt;
Signed-off-by: Felipe Balbi &lt;balbi@ti.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 7adb5c876e9c0677078a1e1094c6eafd29c30b74 upstream.

At probe time, the musb_am335x driver register its childs by
calling of_platform_populate(), which registers all childs in
the devicetree hierarchy recursively.

On the other side, the driver's remove() function uses of_device_unregister()
to remove each child of musb_am335x's.

However, when musb_dsps is loaded, its devices are attached to the musb_am335x
device as musb_am335x childs. Hence, musb_am335x remove() will attempt to
unregister the devices registered by musb_dsps, which produces a kernel panic.

In other words, the childs in the "struct device" hierarchy are not the same
as the childs in the "devicetree" hierarchy.

Ideally, we should enforce the removal of the devices registered by
musb_am335x *only*, instead of all its child devices. However, because of the
recursive nature of of_platform_populate, this doesn't seem possible.

Therefore, as the only solution at hand, this commit disables musb_am335x
driver removal capability, preventing it from being ever removed. This was
originally suggested by Sebastian Siewior:

https://www.mail-archive.com/linux-omap@vger.kernel.org/msg104946.html

And for reference, here's the panic upon module removal:

musb-hdrc musb-hdrc.0.auto: remove, state 4
usb usb1: USB disconnect, device number 1
musb-hdrc musb-hdrc.0.auto: USB bus 1 deregistered
Unable to handle kernel NULL pointer dereference at virtual address 0000008c
pgd = de11c000
[0000008c] *pgd=9e174831, *pte=00000000, *ppte=00000000
Internal error: Oops: 17 [#1] ARM
Modules linked in: musb_am335x(-) musb_dsps musb_hdrc usbcore usb_common
CPU: 0 PID: 623 Comm: modprobe Not tainted 3.15.0-rc4-00001-g24efd13 #69
task: de1b7500 ti: de122000 task.ti: de122000
PC is at am335x_shutdown+0x10/0x28
LR is at am335x_shutdown+0xc/0x28
pc : [&lt;c0327798&gt;]    lr : [&lt;c0327794&gt;]    psr: a0000013
sp : de123df8  ip : 00000004  fp : 00028f00
r10: 00000000  r9 : de122000  r8 : c000e6c4
r7 : de0e3c10  r6 : de0e3800  r5 : de624010  r4 : de1ec750
r3 : de0e3810  r2 : 00000000  r1 : 00000001  r0 : 00000000
Flags: NzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
Control: 10c5387d  Table: 9e11c019  DAC: 00000015
Process modprobe (pid: 623, stack limit = 0xde122240)
Stack: (0xde123df8 to 0xde124000)
3de0:                                                       de0e3810 bf054488
3e00: bf05444c de624010 60000013 bf043650 000012fc de624010 de0e3810 bf043a20
3e20: de0e3810 bf04b240 c0635b88 c02ca37c c02ca364 c02c8db0 de1b7500 de0e3844
3e40: de0e3810 c02c8e28 c0635b88 de02824c de0e3810 c02c884c de0e3800 de0e3810
3e60: de0e3818 c02c5b20 bf05417c de0e3800 de0e3800 c0635b88 de0f2410 c02ca838
3e80: bf05417c de0e3800 bf055438 c02ca8cc de0e3c10 bf054194 de0e3c10 c02ca37c
3ea0: c02ca364 c02c8db0 de1b7500 de0e3c44 de0e3c10 c02c8e28 c0635b88 de02824c
3ec0: de0e3c10 c02c884c de0e3c10 de0e3c10 de0e3c18 c02c5b20 de0e3c10 de0e3c10
3ee0: 00000000 bf059000 a0000013 c02c5bc0 00000000 bf05900c de0e3c10 c02c5c48
3f00: de0dd0c0 de1ec970 de0f2410 bf05929c de0f2444 bf05902c de0f2410 c02ca37c
3f20: c02ca364 c02c8db0 bf05929c de0f2410 bf05929c c02c94c8 bf05929c 00000000
3f40: 00000800 c02c8ab4 bf0592e0 c007fc40 c00dd820 6273756d 336d615f 00783533
3f60: c064a0ac de1b7500 de122000 de1b7500 c000e590 00000001 c000e6c4 c0060160
3f80: 00028e70 00028e70 00028ea4 00000081 60000010 00028e70 00028e70 00028ea4
3fa0: 00000081 c000e500 00028e70 00028e70 00028ea4 00000800 becb59f8 00027608
3fc0: 00028e70 00028e70 00028ea4 00000081 00000001 00000001 00000000 00028f00
3fe0: b6e6b6f0 becb59d4 000160e8 b6e6b6fc 60000010 00028ea4 00000000 00000000
[&lt;c0327798&gt;] (am335x_shutdown) from [&lt;bf054488&gt;] (dsps_musb_exit+0x3c/0x4c [musb_dsps])
[&lt;bf054488&gt;] (dsps_musb_exit [musb_dsps]) from [&lt;bf043650&gt;] (musb_shutdown+0x80/0x90 [musb_hdrc])
[&lt;bf043650&gt;] (musb_shutdown [musb_hdrc]) from [&lt;bf043a20&gt;] (musb_remove+0x24/0x68 [musb_hdrc])
[&lt;bf043a20&gt;] (musb_remove [musb_hdrc]) from [&lt;c02ca37c&gt;] (platform_drv_remove+0x18/0x1c)
[&lt;c02ca37c&gt;] (platform_drv_remove) from [&lt;c02c8db0&gt;] (__device_release_driver+0x70/0xc8)
[&lt;c02c8db0&gt;] (__device_release_driver) from [&lt;c02c8e28&gt;] (device_release_driver+0x20/0x2c)
[&lt;c02c8e28&gt;] (device_release_driver) from [&lt;c02c884c&gt;] (bus_remove_device+0xdc/0x10c)
[&lt;c02c884c&gt;] (bus_remove_device) from [&lt;c02c5b20&gt;] (device_del+0x104/0x198)
[&lt;c02c5b20&gt;] (device_del) from [&lt;c02ca838&gt;] (platform_device_del+0x14/0x9c)
[&lt;c02ca838&gt;] (platform_device_del) from [&lt;c02ca8cc&gt;] (platform_device_unregister+0xc/0x20)
[&lt;c02ca8cc&gt;] (platform_device_unregister) from [&lt;bf054194&gt;] (dsps_remove+0x18/0x38 [musb_dsps])
[&lt;bf054194&gt;] (dsps_remove [musb_dsps]) from [&lt;c02ca37c&gt;] (platform_drv_remove+0x18/0x1c)
[&lt;c02ca37c&gt;] (platform_drv_remove) from [&lt;c02c8db0&gt;] (__device_release_driver+0x70/0xc8)
[&lt;c02c8db0&gt;] (__device_release_driver) from [&lt;c02c8e28&gt;] (device_release_driver+0x20/0x2c)
[&lt;c02c8e28&gt;] (device_release_driver) from [&lt;c02c884c&gt;] (bus_remove_device+0xdc/0x10c)
[&lt;c02c884c&gt;] (bus_remove_device) from [&lt;c02c5b20&gt;] (device_del+0x104/0x198)
[&lt;c02c5b20&gt;] (device_del) from [&lt;c02c5bc0&gt;] (device_unregister+0xc/0x20)
[&lt;c02c5bc0&gt;] (device_unregister) from [&lt;bf05900c&gt;] (of_remove_populated_child+0xc/0x14 [musb_am335x])
[&lt;bf05900c&gt;] (of_remove_populated_child [musb_am335x]) from [&lt;c02c5c48&gt;] (device_for_each_child+0x44/0x70)
[&lt;c02c5c48&gt;] (device_for_each_child) from [&lt;bf05902c&gt;] (am335x_child_remove+0x18/0x30 [musb_am335x])
[&lt;bf05902c&gt;] (am335x_child_remove [musb_am335x]) from [&lt;c02ca37c&gt;] (platform_drv_remove+0x18/0x1c)
[&lt;c02ca37c&gt;] (platform_drv_remove) from [&lt;c02c8db0&gt;] (__device_release_driver+0x70/0xc8)
[&lt;c02c8db0&gt;] (__device_release_driver) from [&lt;c02c94c8&gt;] (driver_detach+0xb4/0xb8)
[&lt;c02c94c8&gt;] (driver_detach) from [&lt;c02c8ab4&gt;] (bus_remove_driver+0x4c/0xa0)
[&lt;c02c8ab4&gt;] (bus_remove_driver) from [&lt;c007fc40&gt;] (SyS_delete_module+0x128/0x1cc)
[&lt;c007fc40&gt;] (SyS_delete_module) from [&lt;c000e500&gt;] (ret_fast_syscall+0x0/0x48)

Fixes: 97238b35d5bb ("usb: musb: dsps: use proper child nodes")
Acked-by: George Cherian &lt;george.cherian@ti.com&gt;
Signed-off-by: Ezequiel Garcia &lt;ezequiel@vanguardiasur.com.ar&gt;
Signed-off-by: Felipe Balbi &lt;balbi@ti.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>usb: musb: Ensure that cppi41 timer gets armed on premature DMA TX irq</title>
<updated>2014-07-09T18:18:23+00:00</updated>
<author>
<name>Thomas Gleixner</name>
<email>tglx@linutronix.de</email>
</author>
<published>2014-06-20T21:41:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=a5d6bd2499fb860e7eaa537973fddcc9d8157491'/>
<id>a5d6bd2499fb860e7eaa537973fddcc9d8157491</id>
<content type='text'>
commit c58d80f523ffc15ef4d062fc7aeb03793fe39701 upstream.

Some TI chips raise the DMA complete interrupt before the actual
transfer has been completed. The code tries to busy wait for a few
microseconds and if that fails it arms an hrtimer to recheck. So far
so good, but that has the following issue:

CPU 0					CPU1

start_next_transfer(RQ1);

DMA interrupt
  if (premature_irq(RQ1))
    if (!hrtimer_active(timer))
       hrtimer_start(timer);

hrtimer expires
  timer-&gt;state = CALLBACK_RUNNING;
  timer-&gt;fn()
    cppi41_recheck_tx_req()
      complete_request(RQ1);
      if (requests_pending())
        start_next_transfer(RQ2);

					DMA interrupt
					  if (premature_irq(RQ2))
					    if (!hrtimer_active(timer))
					       hrtimer_start(timer);
  timer-&gt;state = INACTIVE;

The premature interrupt of request2 on CPU1 does not arm the timer and
therefor the request completion never happens because it checks for
!hrtimer_active(). hrtimer_active() evaluates:

  timer-&gt;state != HRTIMER_STATE_INACTIVE

which of course evaluates to true in the above case as timer-&gt;state is
CALLBACK_RUNNING.

That's clearly documented:

 * A timer is active, when it is enqueued into the rbtree or the
 * callback function is running or it's in the state of being migrated
 * to another cpu.

But that's not what the code wants to check. The code wants to check
whether the timer is queued, i.e. whether its armed and waiting for
expiry.

We have a helper function for this: hrtimer_is_queued(). This
evaluates:

  timer-&gt;state &amp; HRTIMER_STATE_QUEUED

So in the above case this evaluates to false and therefor forces the
DMA interrupt on CPU1 to call hrtimer_start().

Use hrtimer_is_queued() instead of hrtimer_active() and evrything is
good.

Reported-by: Torben Hohn &lt;torbenh@linutronix.de&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Signed-off-by: Felipe Balbi &lt;balbi@ti.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit c58d80f523ffc15ef4d062fc7aeb03793fe39701 upstream.

Some TI chips raise the DMA complete interrupt before the actual
transfer has been completed. The code tries to busy wait for a few
microseconds and if that fails it arms an hrtimer to recheck. So far
so good, but that has the following issue:

CPU 0					CPU1

start_next_transfer(RQ1);

DMA interrupt
  if (premature_irq(RQ1))
    if (!hrtimer_active(timer))
       hrtimer_start(timer);

hrtimer expires
  timer-&gt;state = CALLBACK_RUNNING;
  timer-&gt;fn()
    cppi41_recheck_tx_req()
      complete_request(RQ1);
      if (requests_pending())
        start_next_transfer(RQ2);

					DMA interrupt
					  if (premature_irq(RQ2))
					    if (!hrtimer_active(timer))
					       hrtimer_start(timer);
  timer-&gt;state = INACTIVE;

The premature interrupt of request2 on CPU1 does not arm the timer and
therefor the request completion never happens because it checks for
!hrtimer_active(). hrtimer_active() evaluates:

  timer-&gt;state != HRTIMER_STATE_INACTIVE

which of course evaluates to true in the above case as timer-&gt;state is
CALLBACK_RUNNING.

That's clearly documented:

 * A timer is active, when it is enqueued into the rbtree or the
 * callback function is running or it's in the state of being migrated
 * to another cpu.

But that's not what the code wants to check. The code wants to check
whether the timer is queued, i.e. whether its armed and waiting for
expiry.

We have a helper function for this: hrtimer_is_queued(). This
evaluates:

  timer-&gt;state &amp; HRTIMER_STATE_QUEUED

So in the above case this evaluates to false and therefor forces the
DMA interrupt on CPU1 to call hrtimer_start().

Use hrtimer_is_queued() instead of hrtimer_active() and evrything is
good.

Reported-by: Torben Hohn &lt;torbenh@linutronix.de&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Signed-off-by: Felipe Balbi &lt;balbi@ti.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>usb: musb: ux500: don't propagate the OF node</title>
<updated>2014-07-09T18:18:23+00:00</updated>
<author>
<name>Linus Walleij</name>
<email>linus.walleij@linaro.org</email>
</author>
<published>2014-06-10T08:54:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=7795e81c2a934effe205973a31eaacdc8aae40f7'/>
<id>7795e81c2a934effe205973a31eaacdc8aae40f7</id>
<content type='text'>
commit 82363cf2eeafeea6ba88849f5e2febdc8a05943f upstream.

There is a regression in the upcoming v3.16-rc1, that is caused
by a problem that has been around for a while but now finally
hangs the system. The bootcrawl looks like this:

pinctrl-nomadik soc:pinctrl: pin GPIO256_AF28 already
requested by a03e0000.usb_per5; cannot claim for musb-hdrc.0.auto
pinctrl-nomadik soc:pinctrl: pin-256 (musb-hdrc.0.auto) status -22
pinctrl-nomadik soc:pinctrl: could not request pin 256
(GPIO256_AF28) from group usb_a_1  on device pinctrl-nomadik
musb-hdrc musb-hdrc.0.auto: Error applying setting, reverse
things back
HS USB OTG: no transceiver configured
musb-hdrc musb-hdrc.0.auto: musb_init_controller failed
with status -517
platform musb-hdrc.0.auto: Driver musb-hdrc requests
probe deferral
(...)

The ux500 MUSB driver propagates the OF node to the dynamically
created musb-hdrc device, which is incorrect as it makes the OF
core believe there are two devices spun from the very same
DT node, which confuses other parts of the device core, notably
the pin control subsystem, which will try to apply all the pin
control settings also to the HDRC device as it gets
instantiated. (The OMAP2430 for example, does not set the
of_node member.)

Cc: Arnd Bergmann &lt;arnd@arndb.de&gt;
Acked-by: Lee Jones &lt;lee.jones@linaro.org&gt;
Signed-off-by: Linus Walleij &lt;linus.walleij@linaro.org&gt;
Signed-off-by: Felipe Balbi &lt;balbi@ti.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 82363cf2eeafeea6ba88849f5e2febdc8a05943f upstream.

There is a regression in the upcoming v3.16-rc1, that is caused
by a problem that has been around for a while but now finally
hangs the system. The bootcrawl looks like this:

pinctrl-nomadik soc:pinctrl: pin GPIO256_AF28 already
requested by a03e0000.usb_per5; cannot claim for musb-hdrc.0.auto
pinctrl-nomadik soc:pinctrl: pin-256 (musb-hdrc.0.auto) status -22
pinctrl-nomadik soc:pinctrl: could not request pin 256
(GPIO256_AF28) from group usb_a_1  on device pinctrl-nomadik
musb-hdrc musb-hdrc.0.auto: Error applying setting, reverse
things back
HS USB OTG: no transceiver configured
musb-hdrc musb-hdrc.0.auto: musb_init_controller failed
with status -517
platform musb-hdrc.0.auto: Driver musb-hdrc requests
probe deferral
(...)

The ux500 MUSB driver propagates the OF node to the dynamically
created musb-hdrc device, which is incorrect as it makes the OF
core believe there are two devices spun from the very same
DT node, which confuses other parts of the device core, notably
the pin control subsystem, which will try to apply all the pin
control settings also to the HDRC device as it gets
instantiated. (The OMAP2430 for example, does not set the
of_node member.)

Cc: Arnd Bergmann &lt;arnd@arndb.de&gt;
Acked-by: Lee Jones &lt;lee.jones@linaro.org&gt;
Signed-off-by: Linus Walleij &lt;linus.walleij@linaro.org&gt;
Signed-off-by: Felipe Balbi &lt;balbi@ti.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>usb: musb: fix PHY power on/off</title>
<updated>2014-05-06T14:59:33+00:00</updated>
<author>
<name>Felipe Balbi</name>
<email>balbi@ti.com</email>
</author>
<published>2014-03-28T19:31:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=355cd8c7cb2b67811648d6b9dd9bee99a7cf90c9'/>
<id>355cd8c7cb2b67811648d6b9dd9bee99a7cf90c9</id>
<content type='text'>
commit 3063a12be2b07c64e9802708a19489342e64c1a3 upstream.

commi 30a70b0 (usb: musb: fix obex in g_nokia.ko
causing kernel panic) removed phy_power_on()
and phy_power_off() calls from runtime PM callbacks
but it failed to note that the driver depended
on pm_runtime_get_sync() calls to power up the PHY,
thus leaving some platforms without any means to
have a working PHY.

Fix that by enabling the phy during omap2430_musb_init()
and killing it in omap2430_musb_exit().

Fixes: 30a70b0 (usb: musb: fix obex in g_nokia.ko causing kernel panic)
Cc: Pali Rohár &lt;pali.rohar@gmail.com&gt;
Cc: Ivaylo Dimitrov &lt;ivo.g.dimitrov.75@gmail.com&gt;
Reported-by: Michael Scott &lt;hashcode0f@gmail.com&gt;
Tested-by: Michael Scott &lt;hashcode0f@gmail.com&gt;
Tested-by: Stefan Roese &lt;sr@denx.de&gt;
Reported-by: Rabin Vincent &lt;rabin@rab.in&gt;
Signed-off-by: Felipe Balbi &lt;balbi@ti.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 3063a12be2b07c64e9802708a19489342e64c1a3 upstream.

commi 30a70b0 (usb: musb: fix obex in g_nokia.ko
causing kernel panic) removed phy_power_on()
and phy_power_off() calls from runtime PM callbacks
but it failed to note that the driver depended
on pm_runtime_get_sync() calls to power up the PHY,
thus leaving some platforms without any means to
have a working PHY.

Fix that by enabling the phy during omap2430_musb_init()
and killing it in omap2430_musb_exit().

Fixes: 30a70b0 (usb: musb: fix obex in g_nokia.ko causing kernel panic)
Cc: Pali Rohár &lt;pali.rohar@gmail.com&gt;
Cc: Ivaylo Dimitrov &lt;ivo.g.dimitrov.75@gmail.com&gt;
Reported-by: Michael Scott &lt;hashcode0f@gmail.com&gt;
Tested-by: Michael Scott &lt;hashcode0f@gmail.com&gt;
Tested-by: Stefan Roese &lt;sr@denx.de&gt;
Reported-by: Rabin Vincent &lt;rabin@rab.in&gt;
Signed-off-by: Felipe Balbi &lt;balbi@ti.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
</feed>
