summaryrefslogtreecommitdiff
path: root/drivers/usb/musb/mediatek.c
AgeCommit message (Collapse)AuthorFilesLines
2024-09-11usb: musb: mediatek: Simplify code with dev_err_probe()Lin Ruifeng1-16/+11
The combination of dev_err() and the returned error code could be replaced by dev_err_probe() in driver's probe function. Let's, converting to dev_err_probe() to make code more simple. Signed-off-by: Lin Ruifeng <linruifeng4@huawei.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com> Link: https://lore.kernel.org/r/20240907081351.19879-1-linruifeng4@huawei.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-07-25usb: Explicitly include correct DT includesRob Herring1-0/+1
The DT of_device.h and of_platform.h date back to the separate of_platform_bus_type before it as merged into the regular platform bus. As part of that merge prepping Arm DT support 13 years ago, they "temporarily" include each other. They also include platform_device.h and of.h. As a result, there's a pretty much random mix of those include files used throughout the tree. In order to detangle these headers and replace the implicit includes with struct declarations, users need to explicitly include the correct includes. Acked-by: Herve Codina <herve.codina@bootlin.com> Signed-off-by: Rob Herring <robh@kernel.org> Link: https://lore.kernel.org/r/20230718143027.1064731-1-robh@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-04-05usb: musb: mediatek: Convert to platform remove callback returning voidUwe Kleine-König1-4/+2
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230405141009.3400693-4-u.kleine-koenig@pengutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-02-02usb: musb: mediatek: don't unregister something that wasn't registeredDan Carpenter1-1/+2
This function only calls mtk_otg_switch_init() when the ->port_mode is MUSB_OTG so the clean up code should only call mtk_otg_switch_exit() for that mode. Fixes: 0990366bab3c ("usb: musb: Add support for MediaTek musb controller") Signed-off-by: Dan Carpenter <error27@gmail.com> Link: https://lore.kernel.org/r/Y8/3TqpqiSr0RxFH@kili Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-04-21usb: musb: mediatek: Use clk_bulk API to simplify clock operationsAngeloGioacchino Del Regno1-63/+10
This driver uses three clocks and there's no special handling, they're either enabled or disabled sequentially: migrate to the clk_bulk API to simplify clock handling. This patch brings no functional changes. Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Link: https://lore.kernel.org/r/20220404145558.93340-1-angelogioacchino.delregno@collabora.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-12-17usb: musb: Set the DT node on the child deviceRob Herring1-0/+2
The musb glue drivers just copy the glue resources to the musb child device. Instead, set the musb child device's DT node pointer to the parent device's node so that platform_get_irq_byname() can find the resources in the DT. This removes the need for statically populating the IRQ resources from the DT which has been deprecated for some time. Signed-off-by: Rob Herring <robh@kernel.org> Link: https://lore.kernel.org/r/20211215230756.2009115-3-robh@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-09-14usb: musb: mediatek: Expose role-switch control to userspaceSungbo Eo1-0/+1
The allow_userspace_control flag enables manual role-switch from userspace. Turn this feature on like several other USB DRD controller drivers. Tested-by: Frank Wunderlich <frank-w@public-files.de> Acked-by: Chunfeng Yun <chunfeng.yun@mediatek.com> Signed-off-by: Sungbo Eo <mans0n@gorani.run> Link: https://lore.kernel.org/r/20210830155903.13907-3-mans0n@gorani.run Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-05-10usb: musb: Fix an error messageChristophe JAILLET1-1/+1
'ret' is known to be 0 here. Initialize 'ret' with the expected error code before using it. Fixes: 0990366bab3c ("usb: musb: Add support for MediaTek musb controller") Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Link: https://lore.kernel.org/r/69f514dc7134e3c917cad208e73cc650cb9e2bd6.1620159879.git.christophe.jaillet@wanadoo.fr Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-05-25usb: musb: mediatek: add reset FADDR to zero in reset interrupt handleMacpaul Lin1-0/+6
When receiving reset interrupt, FADDR need to be reset to zero in peripheral mode. Otherwise ep0 cannot do enumeration when re-plugging USB cable. Signed-off-by: Macpaul Lin <macpaul.lin@mediatek.com> Acked-by: Min Guo <min.guo@mediatek.com> Signed-off-by: Bin Liu <b-liu@ti.com> Link: https://lore.kernel.org/r/20200525025049.3400-5-b-liu@ti.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-17usb: musb: remove redundant assignment to variable retColin Ian King1-1/+1
Variable ret is being initialized with a value that is never read, it is assigned a new value later on. The assignment is redundant and can be removed. Addresses-Coverity: ("Unused value") Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Bin Liu <b-liu@ti.com> Link: https://lore.kernel.org/r/20200316211136.2274-2-b-liu@ti.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-04usb: roles: Provide the switch drivers handle to the switch in the APIHeikki Krogerus1-6/+10
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-01-15usb: musb: Add support for MediaTek musb controllerMin Guo1-0/+582
This adds support for MediaTek musb controller in host, peripheral and otg mode. There are some quirk of MediaTek musb controller, such as: -W1C interrupt status registers -Private data toggle registers -No dedicated DMA interrupt line Signed-off-by: Min Guo <min.guo@mediatek.com> Signed-off-by: Yonglong Wu <yonglong.wu@mediatek.com> Signed-off-by: Bin Liu <b-liu@ti.com> Link: https://lore.kernel.org/r/20200115132547.364-24-b-liu@ti.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>