Chunfeng Yun
4502a2fb42
usb: mtu3: fix the wrong HS mult value
...
commit 44e4439d8f upstream.
usb_endpoint_maxp() returns actual max packet size, @mult will
always be zero, fix it by using usb_endpoint_maxp_mult() instead
to get mult.
Fixes: 4d79e042ed ("usb: mtu3: add support for usb3.1 IP")
Cc: stable@vger.kernel.org
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com >
Link: https://lore.kernel.org/r/1628836253-7432-3-git-send-email-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-09-12 09:00:59 +02:00
Chunfeng Yun
fbcb43dfd1
usb: mtu3: use @mult for HS isoc or intr
...
commit fd7cb394ec upstream.
For HS isoc or intr, should use @mult but not @burst
to save mult value.
Fixes: 4d79e042ed ("usb: mtu3: add support for usb3.1 IP")
Cc: stable@vger.kernel.org
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com >
Link: https://lore.kernel.org/r/1628836253-7432-2-git-send-email-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-09-12 09:00:59 +02:00
Chunfeng Yun
ad1289a6ff
usb: mtu3: restore HS function when set SS/SSP
...
commit e88f285140 upstream.
Due to HS function is disabled when set as FS, need restore
it when set as SS/SSP.
Fixes: dc4c1aa7ea ("usb: mtu3: add ->udc_set_speed()")
Cc: stable@vger.kernel.org
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com >
Link: https://lore.kernel.org/r/1628836253-7432-1-git-send-email-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-09-12 09:00:59 +02:00
Chunfeng Yun
cd59ea91ea
usb: mtu3: use clock bulk to get clocks
...
Use clock bulk helpers to get/enable/disable clocks, meanwhile
make sys_ck optional, then will be easier to handle clocks.
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com >
Link: https://lore.kernel.org/r/1623139069-8173-24-git-send-email-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-06-15 15:46:45 +02:00
Chunfeng Yun
bfce43c43e
usb: mtu3: rebuild role switch get/set hooks
...
Use common helper ssusb_set_mode() to do role switch instead
of manual switch helper;
Remove unnecessary local variable when get role status
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com >
Link: https://lore.kernel.org/r/1623139069-8173-14-git-send-email-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-06-15 15:43:57 +02:00
Chunfeng Yun
13862176a3
usb: mtu3: use force mode for dual role switch
...
Force IDDIG status for all three ways of dual role switch, this
is needed when use Type-C to switch mode.
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com >
Link: https://lore.kernel.org/r/1623139069-8173-13-git-send-email-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-06-15 15:43:50 +02:00
Chunfeng Yun
6c7b949762
usb: mtu3: add helper to get pointer of ssusb_mtk struct
...
Add a helper to get pointer of ssusb_mtk struct from the pointer
of otg_switch_mtk struct.
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com >
Link: https://lore.kernel.org/r/1623139069-8173-12-git-send-email-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-06-15 15:43:43 +02:00
Chunfeng Yun
18cfd7b85c
usb: mtu3: rebuild role switch flow of extcon
...
This is a preparation patch to plan to use the same work to
handle role switch for all three supported ways.
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com >
Link: https://lore.kernel.org/r/1623139069-8173-11-git-send-email-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-06-15 15:43:36 +02:00
Chunfeng Yun
a04c9f2d5d
usb: mtu3: use enum usb_role instead of private defined ones
...
Now we mainly use usb-role-switch to set dual role mode, and all
three ways supported use the same function to switch mode, use
usb_role enum will make code clear
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com >
Link: https://lore.kernel.org/r/1623139069-8173-10-git-send-email-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-06-15 15:43:11 +02:00
Chunfeng Yun
ae634f9321
usb: mtu3: drop support vbus detection
...
Until now it's never used on any platform, and will not used
later.
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com >
Link: https://lore.kernel.org/r/1623139069-8173-9-git-send-email-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-06-15 15:43:00 +02:00
Chunfeng Yun
3abf562723
usb: mtu3: remove wakelock
...
Prefer to use /sys/power/wake_lock instead.
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com >
Link: https://lore.kernel.org/r/1623139069-8173-8-git-send-email-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-06-15 15:42:48 +02:00
Chunfeng Yun
960d3557d2
usb: mtu3: power down port when power down device IP
...
When power down device IP, we can also power down device port,
then power on the port again when power on device ip, it's helpful
to make device ip enter ip sleep mode.
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com >
Link: https://lore.kernel.org/r/1623139069-8173-7-git-send-email-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-06-15 15:42:37 +02:00
Chunfeng Yun
b057da6d54
usb: mtu3: power down device IP by default
...
Power down device IP by default until @udc_start is called.
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com >
Link: https://lore.kernel.org/r/1623139069-8173-6-git-send-email-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-06-15 15:42:20 +02:00
Chunfeng Yun
51c236d5e1
usb: mtu3: skip getting extcon when use manual drd switch
...
When use manual drd switch, extcon is not used in fact, so no
need get it even it exists, just skip it like using role switch.
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com >
Link: https://lore.kernel.org/r/1622182260-23767-5-git-send-email-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-06-03 13:53:04 +02:00
Chunfeng Yun
f3ec606efc
usb: mtu3: use dev_err_probe to print error log about extcon
...
Print an error log when the error number is not -EPROBE_DEFER
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com >
Link: https://lore.kernel.org/r/1622182260-23767-4-git-send-email-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-06-03 13:53:04 +02:00
Chunfeng Yun
10e93e0814
usb: mtu3: dump a status register of IPPC
...
Add a SSUSB_IP_PW_STS1 register to show ip sleep status
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com >
Link: https://lore.kernel.org/r/1622182260-23767-3-git-send-email-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-06-03 13:53:04 +02:00
Chunfeng Yun
2c09bdaa58
usb: mtu3: remove repeated setting of speed
...
mtu3_gadget_start() will set speed, no need set it again in
mtu3_gadget_set_speed(), just save the desired speed.
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com >
Link: https://lore.kernel.org/r/1622182260-23767-2-git-send-email-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-06-03 13:53:04 +02:00
Chunfeng Yun
32ab701df6
usb: mtu3: remove mtu3_ep0_setup() declaration in mtu3.h
...
It's defined and only used in the same file, so remove its declaration
in mtu3.h, and make it static
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com >
Link: https://lore.kernel.org/r/1622182260-23767-1-git-send-email-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-06-03 13:53:04 +02:00
Chunfeng Yun
24327c478b
usb: mtu3: drop CONFIG_OF
...
The driver can match only the devices created by the OF core
via the DT table, so the table should be always used.
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com >
Link: https://lore.kernel.org/r/1616482975-17841-12-git-send-email-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-03-26 14:47:19 +01:00
Chunfeng Yun
a099d36884
usb: mtu3: add support ip-sleep wakeup for MT8192
...
Add add support ip-sleep wakeup for MT8192, it's a specific
revision, not following IPM rule.
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com >
Link: https://lore.kernel.org/r/1616482975-17841-11-git-send-email-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-03-26 14:46:39 +01:00
Chunfeng Yun
b1a344589e
usb: mtu3: support ip-sleep wakeup for MT8183
...
Add support ip-sleep wakeup for MT8183, it's similar to MT8173,
and it's also a specific one, but not following IPM rule.
Due to the index 2 already used by many DTS, it's better to keep
it unchanged for backward compatibility, treat specific ones without
following IPM rule as revision 1.x, meanwhile reserve 3~10 for later
revision that follows the IPM rule.
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com >
Link: https://lore.kernel.org/r/1616482975-17841-10-git-send-email-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-03-26 14:46:14 +01:00
Colin Ian King
18106234c0
usb: mtu3: Fix spelling mistake "disabed" -> "disabled"
...
The variable u3_ports_disabed contains a spelling mistake,
rename it to u3_ports_disabled.
Reviewed-by: Chunfeng Yun <chunfeng.yun@mediatek.com >
Signed-off-by: Colin Ian King <colin.king@canonical.com >
Link: https://lore.kernel.org/r/20210311092529.4898-1-colin.king@canonical.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-03-18 09:02:27 +01:00
Dan Carpenter
3f6f6343a2
usb: mtu3: fix memory corruption in mtu3_debugfs_regset()
...
This code is using the wrong sizeof() so it does not allocate enough
memory. It allocates 32 bytes but 72 are required. That will lead to
memory corruption.
Fixes: ae07809255 ("usb: mtu3: add debugfs interface files")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com >
Link: https://lore.kernel.org/r/X8ikqc4Mo2/0G72j@mwanda
Cc: stable <stable@vger.kernel.org >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-12-07 15:26:18 +01:00
Dan Carpenter
e3541d5de5
usb: mtu3: mtu3_debug: remove an unused struct member
...
The "nregs" member is not used. The code uses the "regset.nregs"
struct member instead.
Acked-by: Chunfeng Yun <chunfeng.yun@mediatek.com >
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com >
Link: https://lore.kernel.org/r/X8ikv1QA3Do50D+R@mwanda
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-12-04 16:49:06 +01:00
Macpaul Lin
20914919ad
usb: mtu3: fix panic in mtu3_gadget_stop()
...
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: df2069acb0 ("usb: Add MediaTek USB3 DRD driver")
Signed-off-by: Macpaul Lin <macpaul.lin@mediatek.com >
Acked-by: Chunfeng Yun <chunfeng.yun@mediatek.com >
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/1604642069-20961-1-git-send-email-macpaul.lin@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-11-06 12:06:57 +01:00
YueHaibing
5963296b82
usb: mtu3: Remove unsused inline function is_first_entry
...
It is never used, so can be removed.
Signed-off-by: YueHaibing <yuehaibing@huawei.com >
Link: https://lore.kernel.org/r/20200731082008.33016-1-yuehaibing@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-08-18 12:11:55 +02:00
Chunfeng Yun
ab4dc051d7
usb: mtu3: simplify mtu3_req_complete()
...
Use argument req directly instead of mreq->request, they
are the same usb request.
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com >
Link: https://lore.kernel.org/r/1595834101-13094-11-git-send-email-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-07-29 16:53:59 +02:00
Chunfeng Yun
f1e51e99ed
usb: mtu3: clear dual mode of u3port when disable device
...
If not clear u3port's dual mode when disable device, the IP
will fail to enter sleep mode when suspend.
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com >
Link: https://lore.kernel.org/r/1595834101-13094-10-git-send-email-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-07-29 16:53:58 +02:00
Chunfeng Yun
54402373c4
usb: mtu3: use MTU3_EP_WEDGE flag
...
Use MTU3_EP_WEDGE flag instead of the member @wedged in mtu3_ep
struct, then @wedged can be removed.
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com >
Link: https://lore.kernel.org/r/1595834101-13094-9-git-send-email-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-07-29 16:53:58 +02:00
Chunfeng Yun
bf77804b1c
usb: mtu3: remove useless member @busy in mtu3_ep struct
...
The member @busy in mtu3_ep struct is unnecessary, so remove it.
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com >
Link: https://lore.kernel.org/r/1595834101-13094-8-git-send-email-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-07-29 16:53:58 +02:00
Chunfeng Yun
ba428976a8
usb: mtu3: remove repeated error log
...
The caller already print error log.
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com >
Link: https://lore.kernel.org/r/1595834101-13094-7-git-send-email-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-07-29 16:53:58 +02:00
Chunfeng Yun
dc4c1aa7ea
usb: mtu3: add ->udc_set_speed()
...
Make use of the method to make sure connect on speeds
supported by the gadget driver.
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com >
Link: https://lore.kernel.org/r/1595834101-13094-6-git-send-email-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-07-29 16:53:58 +02:00
Chunfeng Yun
1258450ef3
usb: mtu3: introduce a funtion to check maximum speed
...
The max_speed got from DTS may be not supported by the
hardware, so need check it, and assign a proper default
value. And make it clear by introducing a funtion.
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com >
Link: https://lore.kernel.org/r/1595834101-13094-5-git-send-email-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-07-29 16:53:58 +02:00
Chunfeng Yun
b7d5c3cabc
usb: mtu3: clear interrupts status when disable interrupts
...
When disable interrupts, will also want to clear their status,
ensure it by calling mtu3_intr_status_clear() in
mtu3_intr_disable().
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com >
Link: https://lore.kernel.org/r/1595834101-13094-4-git-send-email-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-07-29 16:53:58 +02:00
Chunfeng Yun
f55df11e31
usb: mtu3: reinitialize CSR registers
...
The CSR registers will be reset as default value if the
ports are disabled, so reinitialize them when the ports
are enabled again.
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com >
Link: https://lore.kernel.org/r/1595834101-13094-3-git-send-email-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-07-29 16:53:57 +02:00
Chunfeng Yun
c0a8d952cf
usb: mtu3: fix macro for maximum number of packets
...
The bits field for maximum number of packets is 8 bits.
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com >
Link: https://lore.kernel.org/r/1595834101-13094-2-git-send-email-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-07-29 16:53:57 +02:00
Chunfeng Yun
fde9156ad5
usb: mtu3: remove unnecessary pointer checks
...
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 <chunfeng.yun@mediatek.com >
Link: https://lore.kernel.org/r/1595834101-13094-1-git-send-email-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-07-29 16:53:57 +02:00
Chunfeng Yun
5ad91812ea
usb: mtu3: convert to devm_platform_ioremap_resource_byname
...
Use devm_platform_ioremap_resource_byname() to simplify code
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com >
Link: https://lore.kernel.org/r/1595404275-8449-1-git-send-email-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-07-29 16:49:37 +02:00
Lee Jones
56976249bd
usb: mtu3: mtu3_trace: Supply missing mtu3_debug.h include file
...
If the header file containing a function's prototype isn't included by
the sourcefile containing the associated function, the build system
complains of missing prototypes.
Fixes the following W=1 kernel build warning(s):
drivers/usb/mtu3/mtu3_trace.c:13:6: warning: no previous prototype for ‘mtu3_dbg_trace’ [-Wmissing-prototypes]
13 | void mtu3_dbg_trace(struct device *dev, const char *fmt, ...)
| ^~~~~~~~~~~~~~
Cc: Chunfeng Yun <chunfeng.yun@mediatek.com >
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-mediatek@lists.infradead.org
Signed-off-by: Lee Jones <lee.jones@linaro.org >
Link: https://lore.kernel.org/r/20200715093209.3165641-5-lee.jones@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-07-15 17:25:57 +02:00
Lee Jones
680b512726
usb: mtu3: mtu3_trace: Function headers are not suitable for kerneldoc
...
Kerneldoc headers should only be used to document functions and data
structures.
Cc: Chunfeng Yun <chunfeng.yun@mediatek.com >
Cc: linux-mediatek@lists.infradead.org
Signed-off-by: Lee Jones <lee.jones@linaro.org >
Link: https://lore.kernel.org/r/20200715093209.3165641-4-lee.jones@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-07-15 17:25:57 +02:00
Lee Jones
16eb9c0aae
usb: mtu3: mtu3_debug: Add forward declaration of 'struct ssusb_mtk'
...
Without it, the build system complains that it was declared inside
the parameter list.
Fixes the following W=1 kernel build warning(s):
In file included from drivers/usb/mtu3/mtu3_trace.c:11:
drivers/usb/mtu3/mtu3_debug.h:29:36: warning: ‘struct ssusb_mtk’ declared inside parameter list will not be visible outside of this definition or declaration
29 | void ssusb_dev_debugfs_init(struct ssusb_mtk *ssusb);
| ^~~~~~~~~
drivers/usb/mtu3/mtu3_debug.h:30:35: warning: ‘struct ssusb_mtk’ declared inside parameter list will not be visible outside of this definition or declaration
30 | void ssusb_dr_debugfs_init(struct ssusb_mtk *ssusb);
| ^~~~~~~~~
drivers/usb/mtu3/mtu3_debug.h:31:39: warning: ‘struct ssusb_mtk’ declared inside parameter list will not be visible outside of this definition or declaration
31 | void ssusb_debugfs_create_root(struct ssusb_mtk *ssusb);
| ^~~~~~~~~
drivers/usb/mtu3/mtu3_debug.h:32:39: warning: ‘struct ssusb_mtk’ declared inside parameter list will not be visible outside of this definition or declaration
32 | void ssusb_debugfs_remove_root(struct ssusb_mtk *ssusb);
| ^~~~~~~~~
Cc: Chunfeng Yun <chunfeng.yun@mediatek.com >
Cc: linux-mediatek@lists.infradead.org
Signed-off-by: Lee Jones <lee.jones@linaro.org >
Link: https://lore.kernel.org/r/20200703174148.2749969-2-lee.jones@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-07-09 16:46:57 +02:00
Lee Jones
8709e36729
usb: mtu3: mtu3_core: Demote obvious misuse of kerneldoc to standard comment block
...
No attempt has been made to document the function.
Fixes the following W=1 kernel build warning(s):
drivers/usb/mtu3/mtu3_core.c:805: warning: Function parameter or member 'mtu' not described in 'mtu3_set_dma_mask'
Cc: Chunfeng Yun <chunfeng.yun@mediatek.com >
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-mediatek@lists.infradead.org
Signed-off-by: Lee Jones <lee.jones@linaro.org >
Link: https://lore.kernel.org/r/20200702144625.2533530-26-lee.jones@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-07-03 10:18:40 +02:00
Greg Kroah-Hartman
62fb45d317
USB: ch9: add "USB_" prefix in front of TEST defines
...
For some reason, the TEST_ defines in the usb/ch9.h files did not have
the USB_ prefix on it, making it a bit confusing when reading the file,
as well as not the nicest thing to do in a uapi file.
So fix that up and add the USB_ prefix on to them, and fix up all
in-kernel usages. This included deleting the duplicate copy in the
net2272.h file.
Cc: Felipe Balbi <balbi@kernel.org >
Cc: Michal Simek <michal.simek@xilinx.com >
Cc: Mathias Nyman <mathias.nyman@intel.com >
Cc: Pawel Laszczak <pawell@cadence.com >
Cc: YueHaibing <yuehaibing@huawei.com >
Cc: Nathan Chancellor <natechancellor@gmail.com >
Cc: Jason Yan <yanaijie@huawei.com >
Cc: Jia-Ju Bai <baijiaju1990@gmail.com >
Cc: Stephen Boyd <swboyd@chromium.org >
Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr >
Cc: Arnd Bergmann <arnd@arndb.de >
Cc: Jules Irenge <jbi.octave@gmail.com >
Cc: Alan Stern <stern@rowland.harvard.edu >
Cc: Thinh Nguyen <Thinh.Nguyen@synopsys.com >
Cc: Rob Gill <rrobgill@protonmail.com >
Cc: Macpaul Lin <macpaul.lin@mediatek.com >
Acked-by: Minas Harutyunyan <hminas@synopsys.com >
Acked-by: Bin Liu <b-liu@ti.com >
Acked-by: Chunfeng Yun <chunfeng.yun@mediatek.com >
Acked-by: Peter Chen <peter.chen@nxp.com >
Link: https://lore.kernel.org/r/20200618144206.2655890-1-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-06-24 15:01:24 +02:00
Greg Kroah-Hartman
48a789079a
Merge 5.7-rc6 into usb-next
...
We need the USB fixes in here as well.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-05-18 07:55:55 +02:00
Rikard Falkeborn
6045dd7e59
usb: mtu3: constify struct debugfs_reg32
...
mtu3_prb_regs is never changed and can therefore be made const.
This allows the compiler to put it in the text section instead of the
data section.
Before:
text data bss dec hex filename
19966 7120 0 27086 69ce drivers/usb/mtu3/mtu3_debugfs.o
After:
text data bss dec hex filename
20142 6992 0 27134 69fe drivers/usb/mtu3/mtu3_debugfs.o
Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com >
Signed-off-by: Felipe Balbi <balbi@kernel.org >
2020-05-14 12:42:53 +03:00
Nishad Kamdar
4d49d352b6
USB: mtu3: Use the correct style for SPDX License Identifier
...
This patch corrects the SPDX License Identifier style in
header files related to MediaTek USB3 Dual Role controller.
For C header files Documentation/process/license-rules.rst
mandates C-like comments (opposed to C source files where
C++ style should be used).
Changes made by using a script provided by Joe Perches here:
https://lkml.org/lkml/2019/2/7/46 .
Suggested-by: Joe Perches <joe@perches.com >
Signed-off-by: Nishad Kamdar <nishadkamdar@gmail.com >
Reviewed-by: Chunfeng Yun <chunfeng.yun@mediatek.com >
Link: https://lore.kernel.org/r/20200404103728.GA6011@nishad
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-04-16 14:32:48 +02:00
Heikki Krogerus
bce3052f0c
usb: roles: Provide the switch drivers handle to the switch in the API
...
The USB role callback functions had a parameter pointing to
the parent device (struct device) of the switch. The
assumption was that the switch parent is always the
controller. Firstly, that may not be true in every case, and
secondly, it prevents us from supporting devices that supply
multiple muxes.
Changing the first parameter of usb_role_switch_set_t and
usb_role_switch_get_t from struct device to struct
usb_role_switch.
Cc: Peter Chen <Peter.Chen@nxp.com >
Cc: Felipe Balbi <balbi@kernel.org >
Cc: Chunfeng Yun <chunfeng.yun@mediatek.com >
Cc: Bin Liu <b-liu@ti.com >
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com >
Link: https://lore.kernel.org/r/20200302135353.56659-6-heikki.krogerus@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-03-04 11:12:50 +01:00
Greg Kroah-Hartman
16c8373ecf
Merge 5.4-rc6 into usb-next
...
We need the USB fixes in here to build on top of.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2019-11-04 06:41:09 +01:00
Ben Dooks (Codethink)
b26a4052cf
usb: mtu3: fix missing include of mtu3_dr.h
...
The declarations of ssusb_gadget_{init,exit} are
in the mtu3_dr.h file but the code does that implements
them does not include this. Add the include to fix the
following sparse warnigns:
drivers/usb/mtu3/mtu3_core.c:825:5: warning: symbol 'ssusb_gadget_init' was not declared. Should it be static?
drivers/usb/mtu3/mtu3_core.c:925:6: warning: symbol 'ssusb_gadget_exit' was not declared. Should it be static?
Acked-by: Chunfeng Yun <chunfeng.yun@mediatek.com >
Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk >
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com >
2019-10-27 08:58:44 +02:00
Chunfeng Yun
b1a71c9047
usb: mtu3: fix race condition about delayed_status
...
usb_composite_setup_continue() may be called before composite_setup()
return USB_GADGET_DELAYED_STATUS, then the controller driver will
delay status stage after composite_setup() finish, but the class driver
don't ask the controller to continue delayed status anymore, this will
cause control transfer timeout.
happens when use mass storage (also enabled other class driver):
cpu1: cpu2
handle_setup(SET_CONFIG) //gadget driver
unlock (g->lock)
gadget_driver->setup()
composite_setup()
lock(cdev->lock)
set_config()
fsg_set_alt() // maybe some times due to many class are enabled
raise FSG_STATE_CONFIG_CHANGE
return USB_GADGET_DELAYED_STATUS
handle_exception()
usb_composite_setup_continue()
unlock(cdev->lock)
lock(cdev->lock)
ep0_queue()
lock (g->lock)
//no delayed status, nothing todo
unlock (g->lock)
unlock(cdev->lock)
return USB_GADGET_DELAYED_STATUS // composite_setup
lock (g->lock)
get USB_GADGET_DELAYED_STATUS //handle_setup [1]
Try to fix the race condition as following:
After the driver gets USB_GADGET_DELAYED_STATUS at [1], if we find
there is a usb_request in ep0 request list, it means composite already
asked us to continue delayed status by usb_composite_setup_continue(),
so we skip request about delayed_status by composite_setup() and still
do status stage.
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com >
Link: https://lore.kernel.org/r/1570611900-7112-2-git-send-email-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2019-10-10 12:34:06 +02:00