<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/usb/chipidea/udc.c, branch linux-5.8.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.8.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.8.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2020-05-06T01:42:35Z</updated>
<entry>
<title>usb: chipidea: udc: add software sg list support</title>
<updated>2020-05-06T01:42:35Z</updated>
<author>
<name>Peter Chen</name>
</author>
<published>2020-02-21T13:40:57Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e48aa1eb443f80fc6953734c805add4fb694b835'/>
<id>urn:sha1:e48aa1eb443f80fc6953734c805add4fb694b835</id>
<content type='text'>
The chipidea controller doesn't support short transfer for sg list,
so we still keep setting IOC per TD, otherwise, there will be no interrupt
for short transfer. Each TD has five entries for data buffer, each data
buffer could be non-countinuous 4KB buffer, so it could handle
up to 5 sg buffers one time. The benefit of this patch is avoiding
OOM for low memory system(eg, 256MB) during large USB transfers, see
below for detail. The non-sg handling has not changed.

ufb: page allocation failure: order:4, mode:0x40cc0(GFP_KERNEL|__GFP_COMP),
nodemask=(null),cpuset=/,mems_allowed=0
CPU: 2 PID: 370 Comm: ufb Not tainted 5.4.3-1.1.0+g54b3750d61fd #1
Hardware name: NXP i.MX8MNano DDR4 EVK board (DT)
Call trace:
 dump_backtrace+0x0/0x140
 show_stack+0x14/0x20
 dump_stack+0xb4/0xf8
 warn_alloc+0xec/0x158
 __alloc_pages_slowpath+0x9cc/0x9f8
 __alloc_pages_nodemask+0x21c/0x280
 alloc_pages_current+0x7c/0xe8
 kmalloc_order+0x1c/0x88
 __kmalloc+0x25c/0x298
 ffs_epfile_io.isra.0+0x20c/0x7d0
 ffs_epfile_read_iter+0xa8/0x188
 new_sync_read+0xe4/0x170
 __vfs_read+0x2c/0x40
 vfs_read+0xc8/0x1a0
 ksys_read+0x68/0xf0
 __arm64_sys_read+0x18/0x20
 el0_svc_common.constprop.0+0x68/0x160
 el0_svc_handler+0x20/0x80
 el0_svc+0x8/0xc
Mem-Info:
active_anon:2856 inactive_anon:5269 isolated_anon:12
 active_file:5238 inactive_file:18803 isolated_file:0
 unevictable:0 dirty:22 writeback:416 unstable:0
 slab_reclaimable:4073 slab_unreclaimable:3408
 mapped:727 shmem:7393 pagetables:37 bounce:0
 free:4104 free_pcp:118 free_cma:0
Node 0 active_anon:11436kB inactive_anon:21076kB active_file:20988kB inactive_file:75216kB unevictable:0kB isolated(ano
Node 0 DMA32 free:16820kB min:1808kB low:2260kB high:2712kB active_anon:11436kB inactive_anon:21076kB active_file:2098B
lowmem_reserve[]: 0 0 0
Node 0 DMA32: 508*4kB (UME) 242*8kB (UME) 730*16kB (UM) 21*32kB (UME) 5*64kB (UME) 2*128kB (M) 0*256kB 0*512kB 0*1024kB
Node 0 hugepages_total=0 hugepages_free=0 hugepages_surp=0 hugepages_size=1048576kB
Node 0 hugepages_total=0 hugepages_free=0 hugepages_surp=0 hugepages_size=32768kB
Node 0 hugepages_total=0 hugepages_free=0 hugepages_surp=0 hugepages_size=2048kB
Node 0 hugepages_total=0 hugepages_free=0 hugepages_surp=0 hugepages_size=64kB
31455 total pagecache pages
0 pages in swap cache
Swap cache stats: add 0, delete 0, find 0/0
Free swap  = 0kB
Total swap = 0kB
65536 pages RAM
0 pages HighMem/MovableOnly
10766 pages reserved
0 pages cma reserved
0 pages hwpoisoned

Reviewed-by: Jun Li &lt;jun.li@nxp.com&gt;
Signed-off-by: Peter Chen &lt;peter.chen@nxp.com&gt;
</content>
</entry>
<entry>
<title>usb: chipidea: introduce CI_HDRC_CONTROLLER_VBUS_EVENT glue layer use</title>
<updated>2020-05-06T01:41:55Z</updated>
<author>
<name>Peter Chen</name>
</author>
<published>2020-01-23T06:00:26Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d755cdb1b9d7e1b645e176b97eb137194bbe8cf9'/>
<id>urn:sha1:d755cdb1b9d7e1b645e176b97eb137194bbe8cf9</id>
<content type='text'>
Some vendors glue layer need to handle some events for vbus, eg,
some i.mx platforms (imx7d, imx8mm, imx8mn, etc) needs vbus event
to handle charger detection, its charger detection is finished at
glue layer code, but not at USB PHY driver.

Signed-off-by: Peter Chen &lt;peter.chen@nxp.com&gt;
</content>
</entry>
<entry>
<title>Merge 5.6-rc7 into usb-next</title>
<updated>2020-03-23T07:04:08Z</updated>
<author>
<name>Greg Kroah-Hartman</name>
</author>
<published>2020-03-23T07:04:08Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d2e971d884e7b7e65162788b8f3b7801cd8bc137'/>
<id>urn:sha1:d2e971d884e7b7e65162788b8f3b7801cd8bc137</id>
<content type='text'>
We need the USB fixes in here as well.

Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: chipidea: udc: fix sleeping function called from invalid context</title>
<updated>2020-03-17T19:24:28Z</updated>
<author>
<name>Peter Chen</name>
</author>
<published>2020-03-16T03:10:34Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=7368760d1bcdabf515c41a502568b489de3da683'/>
<id>urn:sha1:7368760d1bcdabf515c41a502568b489de3da683</id>
<content type='text'>
The code calls pm_runtime_get_sync with irq disabled, it causes below
warning:

BUG: sleeping function called from invalid context at
wer/runtime.c:1075
in_atomic(): 1, irqs_disabled(): 128, non_block: 0, pid:
er/u8:1
CPU: 1 PID: 37 Comm: kworker/u8:1 Not tainted
20200304-00181-gbebfd2a5be98 #1588
Hardware name: NVIDIA Tegra SoC (Flattened Device Tree)
Workqueue: ci_otg ci_otg_work
[&lt;c010e8bd&gt;] (unwind_backtrace) from [&lt;c010a315&gt;]
1/0x14)
[&lt;c010a315&gt;] (show_stack) from [&lt;c0987d29&gt;]
5/0x94)
[&lt;c0987d29&gt;] (dump_stack) from [&lt;c013e77f&gt;]
+0xeb/0x118)
[&lt;c013e77f&gt;] (___might_sleep) from [&lt;c052fa1d&gt;]
esume+0x75/0x78)
[&lt;c052fa1d&gt;] (__pm_runtime_resume) from [&lt;c0627a33&gt;]
0x23/0x74)
[&lt;c0627a33&gt;] (ci_udc_pullup) from [&lt;c062fb93&gt;]
nect+0x2b/0xcc)
[&lt;c062fb93&gt;] (usb_gadget_connect) from [&lt;c062769d&gt;]
_connect+0x59/0x104)
[&lt;c062769d&gt;] (ci_hdrc_gadget_connect) from [&lt;c062778b&gt;]
ssion+0x43/0x48)
[&lt;c062778b&gt;] (ci_udc_vbus_session) from [&lt;c062f997&gt;]
s_connect+0x17/0x9c)
[&lt;c062f997&gt;] (usb_gadget_vbus_connect) from [&lt;c062634d&gt;]
bd/0x128)
[&lt;c062634d&gt;] (ci_otg_work) from [&lt;c0134719&gt;]
rk+0x149/0x404)
[&lt;c0134719&gt;] (process_one_work) from [&lt;c0134acb&gt;]
0xf7/0x3bc)
[&lt;c0134acb&gt;] (worker_thread) from [&lt;c0139433&gt;]
x118)
[&lt;c0139433&gt;] (kthread) from [&lt;c01010bd&gt;]
(ret_from_fork+0x11/0x34)

Tested-by: Dmitry Osipenko &lt;digetx@gmail.com&gt;
Cc: &lt;stable@vger.kernel.org&gt; #v5.5
Fixes: 72dc8df7920f ("usb: chipidea: udc: protect usb interrupt enable")
Reported-by: Dmitry Osipenko &lt;digetx@gmail.com&gt;
Signed-off-by: Peter Chen &lt;peter.chen@nxp.com&gt;
Link: https://lore.kernel.org/r/20200316031034.17847-2-peter.chen@kernel.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: chipidea: udc: using structure ci_hdrc device for runtime PM</title>
<updated>2020-03-16T03:13:47Z</updated>
<author>
<name>Peter Chen</name>
</author>
<published>2020-01-23T02:49:19Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=7fd87c956c0ab5633f20597cb828713f9c03aa5b'/>
<id>urn:sha1:7fd87c956c0ab5633f20597cb828713f9c03aa5b</id>
<content type='text'>
At current code, it doesn't maintain ci-&gt;gadget.dev's runtime PM
status well, eg, during the PM operation, the PM counter for
ci-&gt;gadget.dev doesn't be changed accordingly.

In this commit, we use ci_hdrc device instead of ci-&gt;gadget.dev
for runtime PM APIs at udc driver, in the way, we handle runtime
PM APIs using unify device structure between core and udc driver.

Reviewed-by: Jun Li &lt;jun.li@nxp.com&gt;
Signed-off-by: Peter Chen &lt;peter.chen@nxp.com&gt;
</content>
</entry>
<entry>
<title>usb: chipidea: udc: protect usb interrupt enable</title>
<updated>2019-11-18T08:45:30Z</updated>
<author>
<name>Jun Li</name>
</author>
<published>2019-09-10T06:54:57Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=72dc8df7920fc24eba0f586c56e900a1643ff2b3'/>
<id>urn:sha1:72dc8df7920fc24eba0f586c56e900a1643ff2b3</id>
<content type='text'>
We hit the problem with below sequence:
- ci_udc_vbus_session() update vbus_active flag and ci-&gt;driver
is valid,
- before calling the ci_hdrc_gadget_connect(),
usb_gadget_udc_stop() is called by application remove gadget
driver,
- ci_udc_vbus_session() will contine do ci_hdrc_gadget_connect() as
gadget_ready is 1, so udc interrupt is enabled, but ci-&gt;driver is
NULL.
- USB connection irq generated but ci-&gt;driver is NULL.

As udc irq only should be enabled when gadget driver is binded, so
add spinlock to protect the usb irq enable for vbus session handling.

Signed-off-by: Jun Li &lt;jun.li@nxp.com&gt;
Signed-off-by: Peter Chen &lt;peter.chen@nxp.com&gt;
</content>
</entry>
<entry>
<title>usb: chipidea: udc: add new API ci_hdrc_gadget_connect</title>
<updated>2019-11-18T08:45:30Z</updated>
<author>
<name>Peter Chen</name>
</author>
<published>2019-09-10T02:54:52Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d16ab536aad208421c5ed32cdcb01b5ab6aa1f19'/>
<id>urn:sha1:d16ab536aad208421c5ed32cdcb01b5ab6aa1f19</id>
<content type='text'>
This API is used enable device function, it is called at below
situations:
- VBUS is connected during boots up
- Hot plug occurs during runtime

Signed-off-by: Peter Chen &lt;peter.chen@nxp.com&gt;
Signed-off-by: Jun Li &lt;jun.li@nxp.com&gt;
</content>
</entry>
<entry>
<title>usb: Spelling s/disconnet/disconnect/</title>
<updated>2019-11-04T14:53:01Z</updated>
<author>
<name>Geert Uytterhoeven</name>
</author>
<published>2019-10-24T15:27:47Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=4ff0eccbb5c4487ef065931f5c566d85a5bfb5c9'/>
<id>urn:sha1:4ff0eccbb5c4487ef065931f5c566d85a5bfb5c9</id>
<content type='text'>
Fix misspellings of "disconnect".

Signed-off-by: Geert Uytterhoeven &lt;geert+renesas@glider.be&gt;
Acked-by: Peter Chen &lt;peter.chen@nxp.com&gt;
Link: https://lore.kernel.org/r/20191024152747.30617-1-geert+renesas@glider.be
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>Merge 5.3-rc7 into usb-next</title>
<updated>2019-09-02T17:31:18Z</updated>
<author>
<name>Greg Kroah-Hartman</name>
</author>
<published>2019-09-02T17:31:18Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=7a81146204859c6f8d8daf3ab7a25af17dfecd5f'/>
<id>urn:sha1:7a81146204859c6f8d8daf3ab7a25af17dfecd5f</id>
<content type='text'>
We need the usb fixes in here for testing

Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: chipidea: udc: don't do hardware access if gadget has stopped</title>
<updated>2019-08-21T16:45:49Z</updated>
<author>
<name>Peter Chen</name>
</author>
<published>2019-08-20T02:07:58Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=cbe85c88ce80fb92956a0793518d415864dcead8'/>
<id>urn:sha1:cbe85c88ce80fb92956a0793518d415864dcead8</id>
<content type='text'>
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>
</feed>
