aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/phy
AgeCommit message (Collapse)Author
2022-05-09usb: phy: generic: Get the vbus supplySean Anderson
commit 03e607cbb2931374db1825f371e9c7f28526d3f4 upstream. While support for working with a vbus was added, the regulator was never actually gotten (despite what was documented). Fix this by actually getting the supply from the device tree. Fixes: 7acc9973e3c4 ("usb: phy: generic: add vbus support") Cc: stable <stable@kernel.org> Signed-off-by: Sean Anderson <sean.anderson@seco.com> Link: https://lore.kernel.org/r/20220425171412.1188485-3-sean.anderson@seco.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-09-15usb: phy: tahvo: add IRQ checkSergey Shtylyov
[ Upstream commit 0d45a1373e669880b8beaecc8765f44cb0241e47 ] The driver neglects to check the result of platform_get_irq()'s call and blithely passes the negative error codes to request_threaded_irq() (which takes *unsigned* IRQ #), causing it to fail with -EINVAL, overriding an original error code. Stop calling request_threaded_irq() with the invalid IRQ #s. Fixes: 9ba96ae5074c ("usb: omap1: Tahvo USB transceiver driver") Acked-by: Felipe Balbi <balbi@kernel.org> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru> Link: https://lore.kernel.org/r/8280d6a4-8e9a-7cfe-1aa9-db586dc9afdf@omp.ru Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-09-15usb: phy: twl6030: add IRQ checksSergey Shtylyov
[ Upstream commit 0881e22c06e66af0b64773c91c8868ead3d01aa1 ] The driver neglects to check the result of platform_get_irq()'s calls and blithely passes the negative error codes to request_threaded_irq() (which takes *unsigned* IRQ #), causing them both to fail with -EINVAL, overriding an original error code. Stop calling request_threaded_irq() with the invalid IRQ #s. Fixes: c33fad0c3748 ("usb: otg: Adding twl6030-usb transceiver driver for OMAP4430") Acked-by: Felipe Balbi <balbi@kernel.org> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru> Link: https://lore.kernel.org/r/9507f50b-50f1-6dc4-f57c-3ed4e53a1c25@omp.ru Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-09-15usb: phy: fsl-usb: add IRQ checkSergey Shtylyov
[ Upstream commit ecc2f30dbb25969908115c81ec23650ed982b004 ] The driver neglects to check the result of platform_get_irq()'s call and blithely passes the negative error codes to request_irq() (which takes *unsigned* IRQ #), causing it to fail with -EINVAL, overriding an original error code. Stop calling request_irq() with the invalid IRQ #s. Fixes: 0807c500a1a6 ("USB: add Freescale USB OTG Transceiver driver") Acked-by: Felipe Balbi <balbi@kernel.org> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru> Link: https://lore.kernel.org/r/b0a86089-8b8b-122e-fd6d-73e8c2304964@omp.ru Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-09-25usb: phy: phy-mv-usb: convert to readl_poll_timeout_atomic()Chunfeng Yun
Use readl_poll_timeout_atomic() to simplify code Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com> Link: https://lore.kernel.org/r/1600668815-12135-9-git-send-email-chunfeng.yun@mediatek.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-09-25usb: phy-ulpi-viewport: convert to readl_poll_timeout_atomic()Chunfeng Yun
Use readl_poll_timeout_atomic() to simplify code Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com> Link: https://lore.kernel.org/r/1600668815-12135-8-git-send-email-chunfeng.yun@mediatek.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-09-14usb: phy: phy-ab8500-usb: fix spello of "function"Randy Dunlap
Fix typo/spello of "function". Cc: Felipe Balbi <balbi@kernel.org> Cc: Jiri Kosina <trivial@kernel.org> Signed-off-by: Randy Dunlap <rdunlap@infradead.org> Link: https://lore.kernel.org/r/1be7e71f-6b79-290a-f38e-b51ccaf85e8e@infradead.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-08-25USB: PHY: JZ4770: Fix static checker warning.周琰杰 (Zhou Yanjie)
The commit 2a6c0b82e651 ("USB: PHY: JZ4770: Add support for new Ingenic SoCs.") introduced the initialization function for different chips, but left the relevant code involved in the resetting process in the original function, resulting in uninitialized variable calls. Fixes: 2a6c0b82e651 ("USB: PHY: JZ4770: Add support for new Ingenic SoCs."). Signed-off-by: 周琰杰 (Zhou Yanjie) <zhouyanjie@wanyeetech.com> Link: https://lore.kernel.org/r/20200825081654.18186-2-zhouyanjie@wanyeetech.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-07-29usb: phy: am335x: convert to devm_platform_ioremap_resource_bynameChunfeng Yun
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-2-git-send-email-chunfeng.yun@mediatek.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-07-24USB: PHY: JZ4770: Reformat the code to align it.周琰杰 (Zhou Yanjie)
Reformat the code (add one level of indentation before the values), to align the code in the macro definition section. Tested-by: 周正 (Zhou Zheng) <sernia.zhou@foxmail.com> Co-developed-by: 漆鹏振 (Qi Pengzhen) <aric.pzqi@ingenic.com> Signed-off-by: 漆鹏振 (Qi Pengzhen) <aric.pzqi@ingenic.com> Signed-off-by: 周琰杰 (Zhou Yanjie) <zhouyanjie@wanyeetech.com> Signed-off-by: Felipe Balbi <balbi@kernel.org>
2020-07-24USB: PHY: JZ4770: Add support for new Ingenic SoCs.周琰杰 (Zhou Yanjie)
Add support for probing the phy-jz4770 driver on the JZ4780 SoC, the X1000 SoC and the X1830 SoC from Ingenic. Tested-by: 周正 (Zhou Zheng) <sernia.zhou@foxmail.com> Co-developed-by: 漆鹏振 (Qi Pengzhen) <aric.pzqi@ingenic.com> Signed-off-by: 漆鹏振 (Qi Pengzhen) <aric.pzqi@ingenic.com> Signed-off-by: 周琰杰 (Zhou Yanjie) <zhouyanjie@wanyeetech.com> Signed-off-by: Felipe Balbi <balbi@kernel.org>
2020-07-24USB: PHY: JZ4770: Unify code style and simplify code.周琰杰 (Zhou Yanjie)
1.Modify the macro definition to unify "#define USBPCR_XXXX n" into the "#define USBPCR_XXXX (n << USBPCR_XXXX_LSB)" style, so as to unify the code style in the "jz4770_phy_init()" and simplify the code. 2.Remove unused macro definitions to simplify the code. Tested-by: 周正 (Zhou Zheng) <sernia.zhou@foxmail.com> Suggested-by: Paul Cercueil <paul@crapouillou.net> Signed-off-by: 周琰杰 (Zhou Yanjie) <zhouyanjie@wanyeetech.com> Signed-off-by: Felipe Balbi <balbi@kernel.org>
2020-07-15usb: phy: Replace HTTP links with HTTPS onesAlexander A. Klimov
Rationale: Reduces attack surface on kernel devs opening the links for MITM as HTTPS traffic is much harder to manipulate. Deterministic algorithm: For each file: If not .svg: For each line: If doesn't contain `\bxmlns\b`: For each link, `\bhttp://[^# \t\r\n]*(?:\w|/)`: If neither `\bgnu\.org/license`, nor `\bmozilla\.org/MPL\b`: If both the HTTP and HTTPS versions return 200 OK and serve the same content: Replace HTTP with HTTPS. Signed-off-by: Alexander A. Klimov <grandmaster@al2klimov.de> Link: https://lore.kernel.org/r/20200710191842.32561-1-grandmaster@al2klimov.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-07-10usb: phy: Use fallthrough pseudo-keywordGustavo A. R. Silva
Replace the existing /* fall through */ comments and its variants with the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary fall-through markings when it is the case. [1] https://www.kernel.org/doc/html/latest/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org> Link: https://lore.kernel.org/r/20200707200040.GA4525@embeddedor Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-07-03USB: phy: fsl-usb: remove character device usageGreg Kroah-Hartman
No idea why this driver is using a char device node, statically allocated, with no dynamic allocation or hook up with devtmpfs, along with a reserverd major number, for "special" operations, not all of which ever were implemented. So just rip it out, as no one must be using it because no modern system will ever actually create the /dev/ node it needs. Cc: Felipe Balbi <balbi@kernel.org> Reviewed-by: Ran Wang <ran.wang_1@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Link: https://lore.kernel.org/r/20200702072914.1072878-2-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-07-03USB: phy: fsl-usb: remove sysfs abuseGreg Kroah-Hartman
This file has a HUGE debugging sysfs file that spews out a lot of information all at once, which violates the one-value-per-file rule for sysfs. If this is really needed, it should go into debugfs, but given the age of this driver, I strongly doubt anyone is using it anymore. So just remove the file entirely, it was never documented, so obviously, no one actually needed it :) Cc: Felipe Balbi <balbi@kernel.org> Reviewed-by: Ran Wang <ran.wang_1@nxp.com> Link: https://lore.kernel.org/r/20200702072914.1072878-1-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-07-03usb: phy: phy: Fix-up a whole bunch of formatting issuesLee Jones
Kerneldoc expects arg descriptions to be in the format '@.*: '. If either the '@' or the ':' is omitted then kerneldoc complains that the description is missing. Add the missing ':'s here. Also provide a new description for 'event'. Fixes the following kernel build W=1 warnings: drivers/usb/phy/phy.c:106: warning: Function parameter or member 'work' not described in 'usb_phy_notify_charger_work' drivers/usb/phy/phy.c:172: warning: Function parameter or member 'nb' not described in 'usb_phy_get_charger_type' drivers/usb/phy/phy.c:172: warning: Function parameter or member 'state' not described in 'usb_phy_get_charger_type' drivers/usb/phy/phy.c:172: warning: Function parameter or member 'data' not described in 'usb_phy_get_charger_type' drivers/usb/phy/phy.c:194: warning: Function parameter or member 'usb_phy' not described in 'usb_phy_set_charger_current' drivers/usb/phy/phy.c:194: warning: Function parameter or member 'mA' not described in 'usb_phy_set_charger_current' drivers/usb/phy/phy.c:244: warning: Function parameter or member 'usb_phy' not described in 'usb_phy_get_charger_current' drivers/usb/phy/phy.c:244: warning: Function parameter or member 'min' not described in 'usb_phy_get_charger_current' drivers/usb/phy/phy.c:244: warning: Function parameter or member 'max' not described in 'usb_phy_get_charger_current' drivers/usb/phy/phy.c:281: warning: Function parameter or member 'usb_phy' not described in 'usb_phy_set_charger_state' drivers/usb/phy/phy.c:281: warning: Function parameter or member 'state' not described in 'usb_phy_set_charger_state' drivers/usb/phy/phy.c:427: warning: Function parameter or member 'dev' not described in 'devm_usb_get_phy' drivers/usb/phy/phy.c:427: warning: Function parameter or member 'type' not described in 'devm_usb_get_phy' drivers/usb/phy/phy.c:456: warning: Function parameter or member 'type' not described in 'usb_get_phy' drivers/usb/phy/phy.c:500: warning: Function parameter or member 'dev' not described in 'devm_usb_get_phy_by_node' drivers/usb/phy/phy.c:500: warning: Function parameter or member 'node' not described in 'devm_usb_get_phy_by_node' drivers/usb/phy/phy.c:500: warning: Function parameter or member 'nb' not described in 'devm_usb_get_phy_by_node' drivers/usb/phy/phy.c:558: warning: Function parameter or member 'dev' not described in 'devm_usb_get_phy_by_phandle' drivers/usb/phy/phy.c:558: warning: Function parameter or member 'phandle' not described in 'devm_usb_get_phy_by_phandle' drivers/usb/phy/phy.c:558: warning: Function parameter or member 'index' not described in 'devm_usb_get_phy_by_phandle' drivers/usb/phy/phy.c:590: warning: Function parameter or member 'dev' not described in 'devm_usb_put_phy' drivers/usb/phy/phy.c:590: warning: Function parameter or member 'phy' not described in 'devm_usb_put_phy' drivers/usb/phy/phy.c:627: warning: Function parameter or member 'type' not described in 'usb_add_phy' drivers/usb/phy/phy.c:721: warning: Function parameter or member 'event' not described in 'usb_phy_set_event' Cc: Felipe Balbi <balbi@kernel.org> Signed-off-by: Lee Jones <lee.jones@linaro.org> Link: https://lore.kernel.org/r/20200702144625.2533530-2-lee.jones@linaro.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-06-24usb: phy: tegra: Fix unnecessary check in tegra_usb_phy_probe()Tang Bin
In the function tegra_usb_phy_probe(), if usb_add_phy_dev() failed, the return value will be given to err, and if usb_add_phy_dev() succeed, the return value will be zero. Thus it is unnecessary to repeated check here. Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com> Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com> Signed-off-by: Felipe Balbi <balbi@kernel.org>
2020-05-18Merge 5.7-rc6 into usb-nextGreg Kroah-Hartman
We need the USB fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-05-09usb: phy: twl6030-usb: Fix a resource leak in an error handling path in ↵Christophe JAILLET
'twl6030_usb_probe()' A call to 'regulator_get()' is hidden in 'twl6030_usb_ldo_init()'. A corresponding put must be performed in the error handling path, as already done in the remove function. While at it, also move a 'free_irq()' call in the error handling path in order to be consistent. Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Felipe Balbi <balbi@kernel.org>
2020-04-23USB: phy: Use the correct style for SPDX License IdentifierNishad Kamdar
This patch corrects the SPDX License Identifier style in header files related to Physical Layer USB driver configuration. 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> Link: https://lore.kernel.org/r/20200419123559.GA4505@nishad Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-16usb: phy: jz4770: Add a missing '\n' in a log messageChristophe JAILLET
Message logged by 'dev_xxx()' or 'pr_xxx()' should end with a '\n'. Fixes: 541368b46b82 ("usb: phy: Add driver for the Ingenic JZ4770 USB transceiver") Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Link: https://lore.kernel.org/r/20200411063811.6767-1-christophe.jaillet@wanadoo.fr Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-12usb: phy: Add driver for the Ingenic JZ4770 USB transceiverPaul Cercueil
Add a driver to support the USB PHY found in the JZ4770 SoC from Ingenic. Signed-off-by: Paul Cercueil <paul@crapouillou.net> Link: https://lore.kernel.org/r/20200229161820.17824-2-paul@crapouillou.net Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-04usb: phy: tegra: Include proper GPIO consumer header to fix compile testingKrzysztof Kozlowski
The driver uses only GPIO Descriptor Consumer Interface so include proper header. This fixes compile test failures (e.g. on i386): drivers/usb/phy/phy-tegra-usb.c: In function ‘ulpi_phy_power_on’: drivers/usb/phy/phy-tegra-usb.c:695:2: error: implicit declaration of function ‘gpiod_set_value_cansleep’ [-Werror=implicit-function-declaration] drivers/usb/phy/phy-tegra-usb.c: In function ‘tegra_usb_phy_probe’: drivers/usb/phy/phy-tegra-usb.c:1167:11: error: implicit declaration of function ‘devm_gpiod_get_from_of_node’ [-Werror=implicit-function-declaration] Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Reviewed-by: Dmitry Osipenko <digetx@gmail.com> Link: https://lore.kernel.org/r/1583234960-24909-1-git-send-email-krzk@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-02-10usb: phy: tegra: Add clarifying comments about the shared registersDmitry Osipenko
Tools like Coccinelle may erroneously recommend to use the devm_platform_ioremap_resource() API for the registers mapping because these tools are not aware about the implementation details of the driver. Let's add a clarifying comments to the code, which should help to stop future attempts to break the driver. Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Acked-by: Thierry Reding <treding@nvidia.com> Link: https://lore.kernel.org/r/20200202224259.29187-1-digetx@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-24usb: phy: show USB charger type for userPeter Chen
Current USB charger framework only shows charger state for user, but the user may also need charger type for further use, add support for it. Signed-off-by: Peter Chen <peter.chen@nxp.com> Link: https://lore.kernel.org/r/1579145333-1657-1-git-send-email-peter.chen@nxp.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-23usb: phy: phy-gpio-vbus-usb: Convert to GPIO descriptorsLinus Walleij
Instead of using the legacy GPIO API and keeping track on polarity inversion semantics in the driver, switch to use GPIO descriptors for this driver and change all consumers in the process. This makes it possible to retire platform data completely: the only remaining platform data member was "wakeup" which was intended to make the vbus interrupt wakeup capable, but was not set by any users and thus remained unused. VBUS was not waking any devices up. Leave a comment about it so later developers using the platform can consider setting it to always enabled so plugging in USB wakes up the platform. Cc: Daniel Mack <daniel@zonque.org> Cc: Haojian Zhuang <haojian.zhuang@gmail.com> Acked-by: Robert Jarzmik <robert.jarzmik@free.fr> Acked-by: Felipe Balbi <balbi@kernel.org> Acked-by: Sylwester Nawrocki <snawrocki@kernel.org> Acked-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20200123155013.93249-1-linus.walleij@linaro.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-15usb: phy-generic: Delete unused platform dataLinus Walleij
The last user of the phy generic platform data was deleted in commit 1e041b6f313aaa966612a7e415cfc09c90d6b829 ("usb: dwc3: exynos: Remove dead code"). So get rid of the platform data, which rids us of another consumer of the legacy GPIO API at the same time. Make sure we only inlcude <linux/gpio/consumer.h> which is all we use. Alter the usb_phy_gen_create_phy() function prototype to not pass any platform data as this is just hardcoded to NULL at all locations calling it in the kernel. Move the devm_gpiod_get* calls out of the if (of_node) parenthesis, as these calls are generic and do not depend on device tree, they are used by any hardware description. Cc: Marek Szyprowski <m.szyprowski@samsung.com> Cc: Felipe Balbi <balbi@kernel.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Felipe Balbi <balbi@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-09usb: phy: tegra: Keep CPU interrupts enabledDmitry Osipenko
There is no good reason for disabling of CPU interrupts in order to protect the utmip_pad_count modification. Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Link: https://lore.kernel.org/r/20200106013416.9604-17-digetx@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-09usb: phy: tegra: Move utmip_pad_count checking under lockDmitry Osipenko
It's unlikely that two drivers could manage PHY's state simultaneously in practice, nevertheless the utmip_pad_count checking should be under lock, for consistency. Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Link: https://lore.kernel.org/r/20200106013416.9604-16-digetx@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-09usb: phy: tegra: Disable VBUS regulator on tegra_usb_phy_init failureDmitry Osipenko
VBUS regulator should be turned off in a case of error. Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Link: https://lore.kernel.org/r/20200106013416.9604-15-digetx@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-09usb: phy: tegra: Use device-tree notion of reset-GPIO's active-stateDmitry Osipenko
It is much more intuitive if reset is treated as asserted when GPIO value is set to 1. All NVIDIA Tegra device-trees are properly specifying active state of the reset-GPIO since 2013, let's clean up that part of the code. Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Link: https://lore.kernel.org/r/20200106013416.9604-14-digetx@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-09usb: phy: tegra: Use u32 for hardware register variablesDmitry Osipenko
There is a mix of u32/ULONG usage in the driver's code. Let's switch to u32 uniformly, for consistency. Suggested-by: Thierry Reding <thierry.reding@gmail.com> Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Link: https://lore.kernel.org/r/20200106013416.9604-13-digetx@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-09usb: phy: tegra: Use devm_otg_ulpi_create()Dmitry Osipenko
The resource-managed variant removes the necessity for the driver to care about freeing ULPI resources. Suggested-by: Thierry Reding <thierry.reding@gmail.com> Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Link: https://lore.kernel.org/r/20200106013416.9604-12-digetx@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-09usb: ulpi: Add resource-managed variant of otg_ulpi_create()Dmitry Osipenko
Now drivers (like NVIDIA Tegra USB PHY for example) will be able to benefit from the resource-managed variant, making driver's code a bit cleaner. Suggested-by: Thierry Reding <thierry.reding@gmail.com> Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Link: https://lore.kernel.org/r/20200106013416.9604-11-digetx@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-09usb: phy: tegra: Use generic stub for a missing VBUS regulatorDmitry Osipenko
Regulator core provides dummy regulator if device-tree doesn't define VBUS regulator. Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Link: https://lore.kernel.org/r/20200106013416.9604-10-digetx@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-09usb: phy: tegra: Use relaxed versions of readl/writelDmitry Osipenko
There is nothing to synchronize in regards to memory stores, thus all readl/writel occurrences in the code could be replaced with a relaxed versions, for consistency. Acked-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Link: https://lore.kernel.org/r/20200106013416.9604-9-digetx@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-09usb: phy: tegra: Clean up included headersDmitry Osipenko
Add "spinlock.h", which was included indirectly, and sort includes in alphabet order. Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Link: https://lore.kernel.org/r/20200106013416.9604-8-digetx@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-09usb: phy: tegra: Perform general clean up of the codeDmitry Osipenko
This patch fixes few dozens of legit checkpatch warnings, adds missed handling of potential error-cases and prettifies code where makes sense. All these clean-up changes are quite minor and do not fix any real problems. Acked-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Link: https://lore.kernel.org/r/20200106013416.9604-7-digetx@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-09usb: phy: tegra: Hook up init/shutdown callbacksDmitry Osipenko
Generic PHY provides init/shutdown callbacks which allow USB-host drivers to abstract PHY's hardware management in a common way. This change allows to remove Tegra-specific PHY handling from the ChipIdea driver. Note that ChipIdea's driver shall be changed at the same time because it turns PHY ON without the PHY's initialization and this doesn't work now, resulting in a NULL dereference of phy->freq because it's set during of the PHY's initialization. Acked-by: Peter Chen <peter.chen@nxp.com> Acked-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Link: https://lore.kernel.org/r/20200106013416.9604-6-digetx@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-09usb: phy: tegra: Keep track of power on-off stateDmitry Osipenko
The PHY driver should keep track of the enable state, otherwise enable refcount is screwed if USB driver tries to enable PHY when it is already enabled. This will be the case for ChipIdea and Tegra EHCI drivers once PHY driver will gain support for the init/shutdown callbacks. Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Link: https://lore.kernel.org/r/20200106013416.9604-5-digetx@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-09usb: phy: tegra: Clean up ulpi_phy_power_offDmitry Osipenko
Firstly, the PHY's clock needs to unprepared to keep prepare count balanced. Secondly, downstream code suggests that reset is synchronous and thus it should be asserted before disabling clock. Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Link: https://lore.kernel.org/r/20200106013416.9604-4-digetx@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-30usb: phy: Enable compile testing for some of driversKrzysztof Kozlowski
Some of the USB phy drivers can be compile tested to increase build coverage. Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Link: https://lore.kernel.org/r/20191230172215.17370-2-krzk@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-30usb: phy: ab8500-usb: Keep PHY turned on in UART modeStephan Gerhold
AB8505 supports an "UART carkit mode" which makes UART accessible through the USB connector. Upon detection of the UART cable, this mode has to be manually enabled by: 1. Turning on the PHY in peripheral mode 2. Reconfiguring PHY/pins to route UART signals to USB pins At the moment, we do not handle the UART link statuses at all, which means that UART stops working as soon as phy-ab8500-usb is loaded (since we disable the PHY after initialization). Keeping UART working if the cable is inserted before turning on the device is quite simple: In this case, early boot firmware has already set up the necessary PHY/pin configuration. The presence of the UART cable is reported by a special value in the USB link status register. We can check for that value in ab8505_usb_link_status_update() and set the PHY back to peripheral mode to restore UART. (Note: This will result in some minor garbage since we still temporarily disable the PHY during initialization...) Fully implementing this feature is more complicated: For some reason, AB8505 does not update UART link status after bootup. Regular USB cables work fine, but the link status register does not change its state if an UART cable is inserted/removed. It seems likely that the hardware is not actually capable of detecting UART cables autonomously. In addition to the USB link status register, implementations in the vendor kernel also manually measure the ID resistance to detect additional cable types. For UART cables, the USB link status register might simply reflect the PHY configuration instead of the actual link status. Implementing that functionality requires significant additions, so for now just implement the simple case. This allows using UART when inserting the cable before turning on the device. Signed-off-by: Stephan Gerhold <stephan@gerhold.net> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20191218203450.71037-1-stephan@gerhold.net Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-10-04usb: phy: keystone: use devm_platform_ioremap_resource() to simplify codeYueHaibing
Use devm_platform_ioremap_resource() to simplify the code a bit. This is detected by coccinelle. Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: YueHaibing <yuehaibing@huawei.com> Link: https://lore.kernel.org/r/20190904084558.24484-1-yuehaibing@huawei.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-10-04usb: phy: mxs: use devm_platform_ioremap_resource() to simplify codeYueHaibing
Use devm_platform_ioremap_resource() to simplify the code a bit. This is detected by coccinelle. Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: YueHaibing <yuehaibing@huawei.com> Link: https://lore.kernel.org/r/20190904084827.24108-1-yuehaibing@huawei.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-09-02Merge tag 'usb-for-v5.4' of ↵Greg Kroah-Hartman
git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next Felipe writes: USB: Changes for v5.4 merge window With only 45 non-merge commits, we have a small merge window from the Gadget perspective. The biggest change here is the addition of the Cadence USB3 DRD Driver. All other changes are small, non-critical fixes or smaller new features like the improvement to BESL handling in dwc3. Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com> * tag 'usb-for-v5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb: (45 commits) usb: gadget: net2280: Add workaround for AB chip Errata 11 usb: gadget: net2280: Move all "ll" registers in one structure usb: dwc3: gadget: Workaround Mirosoft's BESL check usb:cdns3 Fix for stuck packets in on-chip OUT buffer. usb: cdns3: Add Cadence USB3 DRD Driver usb: common: Simplify usb_decode_get_set_descriptor function. usb: common: Patch simplify usb_decode_set_clear_feature function. usb: common: Separated decoding functions from dwc3 driver. dt-bindings: add binding for USBSS-DRD controller. usb: gadget: composite: Set recommended BESL values usb: dwc3: gadget: Set BESL config parameter usb: dwc3: Separate field holding multiple properties usb: gadget: Export recommended BESL values usb: phy: phy-fsl-usb: Make structure fsl_otg_initdata constant usb: udc: lpc32xx: silence fall-through warning usb: dwc3: meson-g12a: fix suspend resume regulator unbalanced disables usb: udc: lpc32xx: remove set but not used 3 variables usb: gadget: udc: core: Fix segfault if udc_bind_to_driver() for pending driver fails usb: dwc3: st: Add of_dev_put() in probe function usb: dwc3: st: Add of_node_put() before return in probe function ...
2019-08-28usb: phy: phy-fsl-usb: Make structure fsl_otg_initdata constantNishka Dasgupta
Static structure fsl_otg_initdata, of type fsl_otg_config, is used only once, when the value of its field otg_port is assigned to another variable. As fsl_otg_initdata.otg_port is of type u8, any changes to its copy do not affect the original, and fsl_otg_initdata itself is never modified. Hence make fsl_otg_initdata constant to protect it from unintended modification. Issue found with Coccinelle. Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2019-08-16USB: phy: fsl-usb: convert platform driver to use dev_groupsGreg Kroah-Hartman
Platform drivers now have the option to have the platform core create and remove any needed sysfs attribute files. So take advantage of that and do not register "by hand" any sysfs files. Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com> Link: https://lore.kernel.org/r/20190815125903.GA17065@kroah.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-08-09USB: phy: mv-usb: convert platform driver to use dev_groupsGreg Kroah-Hartman
Platform drivers now have the option to have the platform core create and remove any needed sysfs attribute files. So take advantage of that and do not register "by hand" any sysfs files. Cc: Felipe Balbi <balbi@kernel.org> Link: https://lore.kernel.org/r/20190805193636.25560-3-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>