aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb/mtu3/mtu3_gadget.c
AgeCommit message (Collapse)AuthorFilesLines
2020-11-06usb: mtu3: fix panic in mtu3_gadget_stop()Macpaul Lin1-0/+1
This patch fixes a possible issue when mtu3_gadget_stop() already assigned NULL to mtu->gadget_driver during mtu_gadget_disconnect(). [<ffffff9008161974>] notifier_call_chain+0xa4/0x128 [<ffffff9008161fd4>] __atomic_notifier_call_chain+0x84/0x138 [<ffffff9008162ec0>] notify_die+0xb0/0x120 [<ffffff900809e340>] die+0x1f8/0x5d0 [<ffffff90080d03b4>] __do_kernel_fault+0x19c/0x280 [<ffffff90080d04dc>] do_bad_area+0x44/0x140 [<ffffff90080d0f9c>] do_translation_fault+0x4c/0x90 [<ffffff9008080a78>] do_mem_abort+0xb8/0x258 [<ffffff90080849d0>] el1_da+0x24/0x3c [<ffffff9009bde01c>] mtu3_gadget_disconnect+0xac/0x128 [<ffffff9009bd576c>] mtu3_irq+0x34c/0xc18 [<ffffff90082ac03c>] __handle_irq_event_percpu+0x2ac/0xcd0 [<ffffff90082acae0>] handle_irq_event_percpu+0x80/0x138 [<ffffff90082acc44>] handle_irq_event+0xac/0x148 [<ffffff90082b71cc>] handle_fasteoi_irq+0x234/0x568 [<ffffff90082a8708>] generic_handle_irq+0x48/0x68 [<ffffff90082a96ac>] __handle_domain_irq+0x264/0x1740 [<ffffff90080819f4>] gic_handle_irq+0x14c/0x250 [<ffffff9008084cec>] el1_irq+0xec/0x194 [<ffffff90085b985c>] dma_pool_alloc+0x6e4/0xae0 [<ffffff9008d7f890>] cmdq_mbox_pool_alloc_impl+0xb0/0x238 [<ffffff9008d80904>] cmdq_pkt_alloc_buf+0x2dc/0x7c0 [<ffffff9008d80f60>] cmdq_pkt_add_cmd_buffer+0x178/0x270 [<ffffff9008d82320>] cmdq_pkt_perf_begin+0x108/0x148 [<ffffff9008d824d8>] cmdq_pkt_create+0x178/0x1f0 [<ffffff9008f96230>] mtk_crtc_config_default_path+0x328/0x7a0 [<ffffff90090246cc>] mtk_drm_idlemgr_kick+0xa6c/0x1460 [<ffffff9008f9bbb4>] mtk_drm_crtc_atomic_begin+0x1a4/0x1a68 [<ffffff9008e8df9c>] drm_atomic_helper_commit_planes+0x154/0x878 [<ffffff9008f2fb70>] mtk_atomic_complete.isra.16+0xe80/0x19c8 [<ffffff9008f30910>] mtk_atomic_commit+0x258/0x898 [<ffffff9008ef142c>] drm_atomic_commit+0xcc/0x108 [<ffffff9008ef7cf0>] drm_mode_atomic_ioctl+0x1c20/0x2580 [<ffffff9008ebc768>] drm_ioctl_kernel+0x118/0x1b0 [<ffffff9008ebcde8>] drm_ioctl+0x5c0/0x920 [<ffffff900863b030>] do_vfs_ioctl+0x188/0x1820 [<ffffff900863c754>] SyS_ioctl+0x8c/0xa0 Fixes: df2069acb005 ("usb: Add MediaTek USB3 DRD driver") Signed-off-by: Macpaul Lin <[email protected]> Acked-by: Chunfeng Yun <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2020-07-29usb: mtu3: simplify mtu3_req_complete()Chunfeng Yun1-10/+7
Use argument req directly instead of mreq->request, they are the same usb request. Signed-off-by: Chunfeng Yun <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2020-07-29usb: mtu3: use MTU3_EP_WEDGE flagChunfeng Yun1-5/+4
Use MTU3_EP_WEDGE flag instead of the member @wedged in mtu3_ep struct, then @wedged can be removed. Signed-off-by: Chunfeng Yun <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2020-07-29usb: mtu3: remove useless member @busy in mtu3_ep structChunfeng Yun1-6/+0
The member @busy in mtu3_ep struct is unnecessary, so remove it. Signed-off-by: Chunfeng Yun <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2020-07-29usb: mtu3: remove repeated error logChunfeng Yun1-7/+1
The caller already print error log. Signed-off-by: Chunfeng Yun <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2020-07-29usb: mtu3: add ->udc_set_speed()Chunfeng Yun1-0/+14
Make use of the method to make sure connect on speeds supported by the gadget driver. Signed-off-by: Chunfeng Yun <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2020-07-29usb: mtu3: remove unnecessary pointer checksChunfeng Yun1-19/+6
The class driver will ensure the parameters are valid pointers before call the hook function of usb_ep_ops, so no need check them again. Signed-off-by: Chunfeng Yun <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-03-26usb: mtu3: add tracepoints to help debugChunfeng Yun1-1/+13
This patch implements a few initial tracepoints for the mtu3 driver. More traces can be added as necessary in order to ease the task of debugging. Signed-off-by: Chunfeng Yun <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-03-26usb: mtu3: supports new QMU formatChunfeng Yun1-2/+4
In order to support U3gen2 ISOC transfer upto 96DPs, extend the data buffer length. Signed-off-by: Chunfeng Yun <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2018-09-10usb: mtu3: disable vbus rise/fall interrupts of ltssmChunfeng Yun1-8/+14
The vbus rise & fall interrupts are used to enable and disable U3 function of device automatically, this cause some issues when class driver is initialized as deactivated, and will skip over software-controlled connect by pullup(), but UDC wants to keep disconnect until usb_gadget_activate() is called which calls pullup() if needed. So we disable vbus rise & fall interrupts and just use pullup() to enable & disable U3 function, and reset mtu3 state when disconnect instead when vbus fall. Signed-off-by: Chunfeng Yun <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2018-05-24usb: mtu3: clear test_mode flag when resetChunfeng Yun1-0/+1
Clear test_mode flag when the gadget is reset by host, otherwise will affect the next test item. Signed-off-by: Chunfeng Yun <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2018-05-15usb: mtu3: remove repeated setting of gadget stateChunfeng Yun1-6/+2
The usb_add_gadget_udc() will set the gadget state as USB_STATE_NOTATTACHED, so we needn't set it again. Signed-off-by: Chunfeng Yun <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2017-11-07USB: mtu3: Remove redundant license textGreg Kroah-Hartman1-10/+0
Now that the SPDX tag is in all USB files, that identifies the license in a specific and legally-defined manner. So the extra GPL text wording can be removed as it is no longer needed at all. This is done on a quest to remove the 700+ different ways that files in the kernel describe the GPL license text. And there's unneeded stuff like the address (sometimes incorrect) for the FSF which is never needed. No copyright headers or other non-license-description text was removed. Acked-by: Chunfeng Yun <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-11-04USB: add SPDX identifiers to all remaining files in drivers/usb/Greg Kroah-Hartman1-0/+1
It's good to have SPDX identifiers in all files to make it easier to audit the kernel tree for correct licenses. Update the drivers/usb/ and include/linux/usb* files with the correct SPDX license identifier based on the license text in the file itself. The SPDX identifier is a legally binding shorthand, which can be used instead of the full boiler plate text. This work is based on a script and data from Thomas Gleixner, Philippe Ombredanne, and Kate Stewart. Cc: Thomas Gleixner <[email protected]> Cc: Kate Stewart <[email protected]> Cc: Philippe Ombredanne <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> Acked-by: Felipe Balbi <[email protected]> Acked-by: Johan Hovold <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-10-19usb: mtu3: add support for usb3.1 IPChunfeng Yun1-1/+2
Support SuperSpeedPlus for usb3.1 device IP Signed-off-by: Chunfeng Yun <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
2017-07-30usb: mtu3: clear u1/u2_enable to 0 in mtu3_gadget_resetChunfeng Yun1-0/+2
when the device is reset by host, the status of u1_enable and u2_enable should also be restored to default value. Signed-off-by: Chunfeng Yun <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-07-30usb: mtu3: handle delayed status of the control transferChunfeng Yun1-0/+2
Add the delayed status handling. This is used by mass storage etc to gain some extra time to setup its internal status before it can proceed further requests, and once the gadget is ready, it will enqueue an empty packet which is used for synchronization. The issue may happen on some FGPA platform with very low cpu frequency. Signed-off-by: Chunfeng Yun <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2016-10-27usb: mtu3: dual-role mode supportChunfeng Yun1-2/+4
support dual-role mode; there are two ways to switch between host and device modes, one is by idpin, another is by debugfs which depends on user input. Signed-off-by: Chunfeng Yun <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2016-10-27usb: mtu3: Super-Speed Peripheral mode supportChunfeng Yun1-13/+32
add super-speed funtion for peripheral mode Signed-off-by: Chunfeng Yun <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2016-10-27usb: Add MediaTek USB3 DRD driverChunfeng Yun1-0/+709
This patch adds support for the MediaTek USB3 controller integrated into MT8173. It currently supports High-Speed Peripheral Only mode. Super-Speed Peripheral, Dual-Role Device and Host Only (xHCI) modes will be added in the next patchs. Signed-off-by: Chunfeng Yun <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>