<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/drivers/usb/chipidea, branch v4.9.203</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v4.9.203</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v4.9.203'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2019-11-25T08:52:39Z</updated>
<entry>
<title>usb: chipidea: Fix otg event handler</title>
<updated>2019-11-25T08:52:39Z</updated>
<author>
<name>Loic Poulain</name>
<email>loic.poulain@linaro.org</email>
</author>
<published>2018-09-04T15:18:58Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=51194214cb6cff43b0604cb969d2ee10c2c2419b'/>
<id>urn:sha1:51194214cb6cff43b0604cb969d2ee10c2c2419b</id>
<content type='text'>
[ Upstream commit 59739131e0ca06db7560f9073fff2fb83f6bc2a5 ]

At OTG work running time, it's possible that several events need to be
addressed (e.g. ID and VBUS events). The current implementation handles
only one event at a time which leads to ignoring the other one. Fix it.

Signed-off-by: Loic Poulain &lt;loic.poulain@linaro.org&gt;
Signed-off-by: Peter Chen &lt;peter.chen@nxp.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>usb: chipidea: imx: enable OTG overcurrent in case USB subsystem is already started</title>
<updated>2019-11-25T08:52:37Z</updated>
<author>
<name>Nicolas Adell</name>
<email>nicolas.adell@actia.fr</email>
</author>
<published>2018-08-27T13:59:56Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=7cd6a13e203251caef4759eca16a7542510624a1'/>
<id>urn:sha1:7cd6a13e203251caef4759eca16a7542510624a1</id>
<content type='text'>
[ Upstream commit 1dedbdf2bbb1ede8d96f35f9845ecae179dc1988 ]

When initializing the USB subsystem before starting the kernel,
OTG overcurrent detection is disabled. In case the OTG polarity of
overcurrent is low active, the overcurrent detection is never enabled
again and events cannot be reported as expected. Because imx usb
overcurrent polarity is low active by default, only detection needs
to be enable in usbmisc init function.

Signed-off-by: Nicolas Adell &lt;nicolas.adell@actia.fr&gt;
Signed-off-by: Peter Chen &lt;peter.chen@nxp.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>usb: chipidea: udc: don't do hardware access if gadget has stopped</title>
<updated>2019-09-06T08:19:48Z</updated>
<author>
<name>Peter Chen</name>
<email>peter.chen@nxp.com</email>
</author>
<published>2019-08-20T02:07:58Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=169710b075a914071860d8c235e45d81b390c429'/>
<id>urn:sha1:169710b075a914071860d8c235e45d81b390c429</id>
<content type='text'>
commit cbe85c88ce80fb92956a0793518d415864dcead8 upstream.

After _gadget_stop_activity is executed, we can consider the hardware
operation for gadget has finished, and the udc can be stopped and enter
low power mode. So, any later hardware operations (from usb_ep_ops APIs
or usb_gadget_ops APIs) should be considered invalid, any deinitializatons
has been covered at _gadget_stop_activity.

I meet this problem when I plug out usb cable from PC using mass_storage
gadget, my callstack like: vbus interrupt-&gt;.vbus_session-&gt;
composite_disconnect -&gt;pm_runtime_put_sync(&amp;_gadget-&gt;dev),
the composite_disconnect will call fsg_disable, but fsg_disable calls
usb_ep_disable using async way, there are register accesses for
usb_ep_disable. So sometimes, I get system hang due to visit register
without clock, sometimes not.

The Linux Kernel USB maintainer Alan Stern suggests this kinds of solution.
See: http://marc.info/?l=linux-usb&amp;m=138541769810983&amp;w=2.

Cc: &lt;stable@vger.kernel.org&gt; #v4.9+
Signed-off-by: Peter Chen &lt;peter.chen@nxp.com&gt;
Link: https://lore.kernel.org/r/20190820020503.27080-2-peter.chen@nxp.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>usb: chipidea: udc: workaround for endpoint conflict issue</title>
<updated>2019-07-10T07:55:28Z</updated>
<author>
<name>Peter Chen</name>
<email>peter.chen@nxp.com</email>
</author>
<published>2019-06-17T01:49:07Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=74d7687f851c9642fc968e55667250dd464c56cf'/>
<id>urn:sha1:74d7687f851c9642fc968e55667250dd464c56cf</id>
<content type='text'>
commit c19dffc0a9511a7d7493ec21019aefd97e9a111b upstream.

An endpoint conflict occurs when the USB is working in device mode
during an isochronous communication. When the endpointA IN direction
is an isochronous IN endpoint, and the host sends an IN token to
endpointA on another device, then the OUT transaction may be missed
regardless the OUT endpoint number. Generally, this occurs when the
device is connected to the host through a hub and other devices are
connected to the same hub.

The affected OUT endpoint can be either control, bulk, isochronous, or
an interrupt endpoint. After the OUT endpoint is primed, if an IN token
to the same endpoint number on another device is received, then the OUT
endpoint may be unprimed (cannot be detected by software), which causes
this endpoint to no longer respond to the host OUT token, and thus, no
corresponding interrupt occurs.

There is no good workaround for this issue, the only thing the software
could do is numbering isochronous IN from the highest endpoint since we
have observed most of device number endpoint from the lowest.

Cc: &lt;stable@vger.kernel.org&gt; #v3.14+
Cc: Fabio Estevam &lt;festevam@gmail.com&gt;
Cc: Greg KH &lt;gregkh@linuxfoundation.org&gt;
Cc: Sergei Shtylyov &lt;sergei.shtylyov@cogentembedded.com&gt;
Cc: Jun Li &lt;jun.li@nxp.com&gt;
Signed-off-by: Peter Chen &lt;peter.chen@nxp.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>usb: chipidea: Grab the (legacy) USB PHY by phandle first</title>
<updated>2019-04-05T20:29:08Z</updated>
<author>
<name>Paul Kocialkowski</name>
<email>paul.kocialkowski@bootlin.com</email>
</author>
<published>2019-02-27T06:51:36Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=e45d08f0da03ebcb93e532af99f4956abc34ee72'/>
<id>urn:sha1:e45d08f0da03ebcb93e532af99f4956abc34ee72</id>
<content type='text'>
[ Upstream commit 68ef236274793066b9ba3154b16c0acc1c891e5c ]

According to the chipidea driver bindings, the USB PHY is specified via
the "phys" phandle node. However, this only takes effect for USB PHYs
that use the common PHY framework. For legacy USB PHYs, a simple lookup
based on the USB PHY type is done instead.

This does not play out well when more than one USB PHY is registered,
since the first registered PHY matching the type will always be
returned regardless of what the driver was bound to.

Fix this by looking up the PHY based on the "phys" phandle node.
Although generic PHYs are rather matched by their "phys-name" and not
the "phys" phandle directly, there is no helper for similar lookup on
legacy PHYs and it's probably not worth the effort to add it.

When no legacy USB PHY is found by phandle, fallback to grabbing any
registered USB2 PHY. This ensures backward compatibility if some users
were actually relying on this mechanism.

Signed-off-by: Paul Kocialkowski &lt;paul.kocialkowski@bootlin.com&gt;
Signed-off-by: Peter Chen &lt;peter.chen@nxp.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>usb: chipidea: Prevent unbalanced IRQ disable</title>
<updated>2018-11-13T19:16:53Z</updated>
<author>
<name>Loic Poulain</name>
<email>loic.poulain@linaro.org</email>
</author>
<published>2018-09-04T15:18:57Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=ae893bc61c0f55f49b4b9cdf9edb89197e5c84b8'/>
<id>urn:sha1:ae893bc61c0f55f49b4b9cdf9edb89197e5c84b8</id>
<content type='text'>
[ Upstream commit 8b97d73c4d72a2abf58f8e49062a7ee1e5f1334e ]

The ChipIdea IRQ is disabled before scheduling the otg work and
re-enabled on otg work completion. However if the job is already
scheduled we have to undo the effect of disable_irq int order to
balance the IRQ disable-depth value.

Fixes: be6b0c1bd0be ("usb: chipidea: using one inline function to cover queue work operations")
Signed-off-by: Loic Poulain &lt;loic.poulain@linaro.org&gt;
Signed-off-by: Peter Chen &lt;peter.chen@nxp.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: chipidea: properly handle host or gadget initialization failure</title>
<updated>2018-04-13T17:47:59Z</updated>
<author>
<name>Jisheng Zhang</name>
<email>jszhang@marvell.com</email>
</author>
<published>2017-04-26T08:59:34Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=d84a1c8e3228cf43d2dea63e480a0dd230a663dd'/>
<id>urn:sha1:d84a1c8e3228cf43d2dea63e480a0dd230a663dd</id>
<content type='text'>
[ Upstream commit c4a0bbbdb7f6e3c37fa6deb3ef28c5ed99da6175 ]

If ci_hdrc_host_init() or ci_hdrc_gadget_init() returns error and the
error != -ENXIO, as Peter pointed out, "it stands for initialization
for host or gadget has failed", so we'd better return failure rather
continue.

And before destroying the otg, i.e ci_hdrc_otg_destroy(ci), we should
also check ci-&gt;roles[CI_ROLE_GADGET].

Signed-off-by: Jisheng Zhang &lt;jszhang@marvell.com&gt;
Signed-off-by: Peter Chen &lt;peter.chen@nxp.com&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@microsoft.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: chipidea: vbus event may exist before starting gadget</title>
<updated>2017-10-08T08:26:07Z</updated>
<author>
<name>Peter Chen</name>
<email>peter.chen@nxp.com</email>
</author>
<published>2016-10-19T07:32:58Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=3f22900466a1e51df3da33c4ca338aa3d0632274'/>
<id>urn:sha1:3f22900466a1e51df3da33c4ca338aa3d0632274</id>
<content type='text'>
[ Upstream commit c3b674a04b8ab62a1d35e86714d466af0a0ecc18 ]

At some situations, the vbus may already be there before starting
gadget. So we need to check vbus event after switching to gadget in
order to handle missing vbus event. The typical use cases are plugging
vbus cable before driver load or the vbus has already been there
after stopping host but before starting gadget.

Signed-off-by: Peter Chen &lt;peter.chen@nxp.com&gt;
Tested-by: Stephen Boyd &lt;stephen.boyd@linaro.org&gt;
Reported-by: Stephen Boyd &lt;stephen.boyd@linaro.org&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@verizon.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: chipidea: debug: check before accessing ci_role</title>
<updated>2017-06-14T13:05:59Z</updated>
<author>
<name>Michael Thalmeier</name>
<email>michael.thalmeier@hale.at</email>
</author>
<published>2017-05-18T14:14:14Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=5404b0c0ea852c8982a3f7ff2c4a86a80e25e840'/>
<id>urn:sha1:5404b0c0ea852c8982a3f7ff2c4a86a80e25e840</id>
<content type='text'>
commit 0340ff83cd4475261e7474033a381bc125b45244 upstream.

ci_role BUGs when the role is &gt;= CI_ROLE_END.

Signed-off-by: Michael Thalmeier &lt;michael.thalmeier@hale.at&gt;
Signed-off-by: Peter Chen &lt;peter.chen@nxp.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>usb: chipidea: udc: fix NULL pointer dereference if udc_start failed</title>
<updated>2017-06-14T13:05:58Z</updated>
<author>
<name>Jisheng Zhang</name>
<email>jszhang@marvell.com</email>
</author>
<published>2017-04-24T12:35:51Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=59db536f5812707e8e035b2c68590b449c7a0cec'/>
<id>urn:sha1:59db536f5812707e8e035b2c68590b449c7a0cec</id>
<content type='text'>
commit aa1f058d7d9244423b8c5a75b9484b1115df7f02 upstream.

Fix below NULL pointer dereference. we set ci-&gt;roles[CI_ROLE_GADGET]
too early in ci_hdrc_gadget_init(), if udc_start() fails due to some
reason, the ci-&gt;roles[CI_ROLE_GADGET] check in  ci_hdrc_gadget_destroy
can't protect us.

We fix this issue by only setting ci-&gt;roles[CI_ROLE_GADGET] if
udc_start() succeed.

[    1.398550] Unable to handle kernel NULL pointer dereference at
virtual address 00000000
...
[    1.448600] PC is at dma_pool_free+0xb8/0xf0
[    1.453012] LR is at dma_pool_free+0x28/0xf0
[    2.113369] [&lt;ffffff80081817d8&gt;] dma_pool_free+0xb8/0xf0
[    2.118857] [&lt;ffffff800841209c&gt;] destroy_eps+0x4c/0x68
[    2.124165] [&lt;ffffff8008413770&gt;] ci_hdrc_gadget_destroy+0x28/0x50
[    2.130461] [&lt;ffffff800840fa30&gt;] ci_hdrc_probe+0x588/0x7e8
[    2.136129] [&lt;ffffff8008380fb8&gt;] platform_drv_probe+0x50/0xb8
[    2.142066] [&lt;ffffff800837f494&gt;] driver_probe_device+0x1fc/0x2a8
[    2.148270] [&lt;ffffff800837f68c&gt;] __device_attach_driver+0x9c/0xf8
[    2.154563] [&lt;ffffff800837d570&gt;] bus_for_each_drv+0x58/0x98
[    2.160317] [&lt;ffffff800837f174&gt;] __device_attach+0xc4/0x138
[    2.166072] [&lt;ffffff800837f738&gt;] device_initial_probe+0x10/0x18
[    2.172185] [&lt;ffffff800837e58c&gt;] bus_probe_device+0x94/0xa0
[    2.177940] [&lt;ffffff800837c560&gt;] device_add+0x3f0/0x560
[    2.183337] [&lt;ffffff8008380d20&gt;] platform_device_add+0x180/0x240
[    2.189541] [&lt;ffffff800840f0e8&gt;] ci_hdrc_add_device+0x440/0x4f8
[    2.195654] [&lt;ffffff8008414194&gt;] ci_hdrc_usb2_probe+0x13c/0x2d8
[    2.201769] [&lt;ffffff8008380fb8&gt;] platform_drv_probe+0x50/0xb8
[    2.207705] [&lt;ffffff800837f494&gt;] driver_probe_device+0x1fc/0x2a8
[    2.213910] [&lt;ffffff800837f5ec&gt;] __driver_attach+0xac/0xb0
[    2.219575] [&lt;ffffff800837d4b0&gt;] bus_for_each_dev+0x60/0xa0
[    2.225329] [&lt;ffffff800837ec80&gt;] driver_attach+0x20/0x28
[    2.230816] [&lt;ffffff800837e880&gt;] bus_add_driver+0x1d0/0x238
[    2.236571] [&lt;ffffff800837fdb0&gt;] driver_register+0x60/0xf8
[    2.242237] [&lt;ffffff8008380ef4&gt;] __platform_driver_register+0x44/0x50
[    2.248891] [&lt;ffffff80086fd440&gt;] ci_hdrc_usb2_driver_init+0x18/0x20
[    2.255365] [&lt;ffffff8008082950&gt;] do_one_initcall+0x38/0x128
[    2.261121] [&lt;ffffff80086e0d00&gt;] kernel_init_freeable+0x1ac/0x250
[    2.267414] [&lt;ffffff800852f0b8&gt;] kernel_init+0x10/0x100
[    2.272810] [&lt;ffffff8008082680&gt;] ret_from_fork+0x10/0x50

Fixes: 3f124d233e97 ("usb: chipidea: add role init and destroy APIs")
Signed-off-by: Jisheng Zhang &lt;jszhang@marvell.com&gt;
Signed-off-by: Peter Chen &lt;peter.chen@nxp.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
</feed>
