summaryrefslogtreecommitdiffstats
path: root/drivers/phy
Commit message (Collapse)AuthorAgeFilesLines
* phy: freescale: imx8mq-usb: make i.MX8MP support more explicitAhmad Fatoum2024-02-201-2/+6
| | | | | | | | | | | | | | The driver was originally written for use with the i.MX8MQ's DWC3, but has been extended to also cover the i.MX8MP's DWC3. While we won't change the config symbol name, because that could break existing users, we can and should change the symbol prompt and help text as well as the dependency to reflect that the driver also targets the i.MX8MP. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240219172925.3798024-5-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: use dev_err_probe instead of comparisons against EPROBE_DEFERAhmad Fatoum2024-02-203-20/+6
| | | | | | | | | | | | | | Drivers should not need to compare an error value against EPROBE_DEFER. We have a number of drivers doing that though to decide whether to print an error or not. This error message will be lost if the probe is deferred, so use dev_err_probe to store the error in that case. While at it, we shorten the error messages a bit. dev_err_probe will already print the string 'error' before the error code string. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240219172659.3796647-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: rockchip: rk3588: Use upstream dts filesSascha Hauer2023-12-131-4/+4
| | | | | | | | | We have downstream rk3588 dtsi files containing the PCI controllers and also the SDMMC controller. Use the now existing upstream nodes instead. Link: https://lore.barebox.org/20231205072706.647255-2-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* phy: stm32-usbphyc: fix unbalanced phy exitAhmad Fatoum2023-11-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | On the STM32MP1, shutting down barebox can result in a ERROR: phy1: phy exit failed --> -22 message printed to the console. This is because the regulator is disabled more often than it was enabled, because stm32_usbphyc_pll_disable is called twice: - Once from stm32_usbphyc_remove calling stm32_usbphyc_phy_exit - Once from dwc2_remove calling phy_exit -> stm32_usbphyc_phy_exit The code is taken from Linux and likely causes no issues there, because devices are removed in reverse probe order, which barebox doesn't enforce. Properly solving this would be a larger endeavour, so for now just fix the stm32-usbphyc driver to ignore reference count dropping below zero and only call __stm32_usbphyc_pll_disable once. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20231109121012.1474536-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mfd: syscon: do not include regmap.h from mfd/syscon.hAhmad Fatoum2023-10-232-0/+2
| | | | | | | | | | mfd/syscon.h include regmap.h when a struct regmap forward declaration would've sufficed. Let's forward declare and fix users of the header to directly include linux/regmap.h where needed. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20231020071853.2826528-6-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: Print device nodes with %pOFSascha Hauer2023-07-031-2/+2
| | | | | | | We have the %pOF format specifier for printing device nodes. Use it where appropriate. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* phy: stm32: usb: depend on COMMON_CLKAhmad Fatoum2023-06-131-0/+1
| | | | | | | | | | | The stm32-usbphyc driver registers a clock with the common clock framework, so compile testing without COMMON_CLK understandably fails and can't be expected to work. Fix the allyesconfig build on sandbox by making the COMMON_CLK dependency explicit. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230612130239.1087599-20-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: add MODULE_DEVICE_TABLE markersAhmad Fatoum2023-06-134-0/+4
| | | | | | | | | | | | | | | | Syncing device trees with Linux upstream can lead to breakage, when the device trees are switched to newer bindings, which are not yet supported in barebox. To make it easier to spot such issues, we want to start applying some heuristics to flag possibly problematic DT changes. One step towards being able to do that is to know what nodes barebox actually consumes. Most of the nodes have a compatible entry, which is matched by an array of of_device_id, so let's have MODULE_DEVICE_TABLE point at it for future extraction. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230612125908.1087340-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/stm32mp'Sascha Hauer2023-05-241-26/+295
|\
| * phy: stm32-usphyc: sync with Linux v6.3-rc5Ahmad Fatoum2023-05-021-26/+295
| | | | | | | | | | | | | | | | | | DT binding changed in the meantime and the PHY is now clock provider to the EHCI. Sync the driver to enable use of the EHCI. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230421100642.2867651-3-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | phy: rockchip: naneng-combphy: add rk3588 supportSascha Hauer2023-05-231-0/+278
|/ | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* phy: Add mode setting supportSascha Hauer2023-03-201-0/+15
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: move include files to place where Linux has themSascha Hauer2023-03-206-6/+6
| | | | | | | | | For easier patch merging and comparison with Linux move the usb gadget files to where Linux has them. For now do a plain git mv include/usb include/linux/usb, eventhough there might be some files which are purely barebox specific. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* phy: stm32-usphyc: add mdelay(1) to fix timeout on some machinesMichael Grzeschik2023-01-261-0/+9
| | | | | | | | | | | An mdelay of 1 seems to be necessary on some machines, since the monsel status does not seem to be accurate. On rare occasions just working with the phy after this pll check lead to no functional usb. With this short mdelay this issue was not reported again. Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> Link: https://lore.barebox.org/20230124204434.3502574-1-m.grzeschik@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Rename struct driver_d to driverSascha Hauer2023-01-105-5/+5
| | | | | | | | | | | The '_d' suffix was originally meant to distinguish barebox struct names from Linux struct names. struct driver doesn't exist in Linux, so we can rename it and remove the meaningless suffix. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20221214123512.189688-4-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Rename struct device_d to deviceSascha Hauer2023-01-106-26/+26
| | | | | | | | | | | | | The '_d' suffix was originally introduced in case we want to import Linux struct device as a separate struct into barebox. Over time it became clear that this won't happen, instead barebox struct device_d is basically the same as Linux struct device. Rename the struct name accordingly to make porting Linux code easier. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20221214123512.189688-3-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Rename device_d::device_node to device_d::of_nodeSascha Hauer2023-01-105-21/+21
| | | | | | | | | | | | | | | | | | | | Linux struct device has the member of_node for the device_node pointer. Rename this in barebox accordingly to minimize the necessary changes when porting Linux code. This was done with the semantic patch: @@ struct device_d E; @@ - E.device_node + E.of_node @@ struct device_d *E; @@ - E->device_node + E->of_node Plus some manual adjustments. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20221214123512.189688-2-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* phy: core: drop useless else clauseAhmad Fatoum2022-09-121-2/+0
| | | | | | | | ret is not read below, so we don't need this override. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220905095557.596891-27-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* phy: propagate error in of_phy_get_by_phandleMarco Felsch2022-07-111-1/+1
| | | | | | | | | | Don't return -ENODEV if of_phy_provider_lookup() fails instead propagate the error. So errors like -EPROBE_DEFER are propagated correctly. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Tested-by: Johannes Zink <j.zink@pengutronix.de> # i.MX7 Link: https://lore.barebox.org/20220706142105.2266956-3-m.felsch@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* phy: fix deep probe supportMarco Felsch2022-07-111-4/+5
| | | | | | | | | | | | | Commit 9474a29003 ("phy: Add deep probe support") added the deep probe support but this commit was missing the of_phy_get_by_phandle() isn't calling the internal _of_phy_get() helper. Fix this by moving the of_device_ensure_probed() call into the of_phy_provider_lookup() helper which gets called by both functions. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Tested-by: Johannes Zink <j.zink@pengutronix.de> # i.MX7 Link: https://lore.barebox.org/20220706142105.2266956-2-m.felsch@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/stm32'Sascha Hauer2022-05-191-1/+8
|\
| * phy: stm32-usphyc: Add dummy driver for child nodeOleksij Rempel2022-05-111-1/+8
| | | | | | | | | | | | | | | | To satisfy deep probe mechanism Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Link: https://lore.barebox.org/20220510121242.216065-2-o.rempel@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2022-05-191-15/+4
|\ \
| * | phy: rockchip: align naneng-combphy clocks and resets with bindingMichael Riesch2022-05-111-15/+4
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | There was no device tree binding in mainline Linux when this driver was introduced in barebox. This has changed in the mean time, hence we need to align the clocks and resets in this driver. This step is a prerequisite for replacing the initial rk3568.dtsi in arch/arm/dts with the mainline Linux version. For compatibility, the former is updated accordingly. Signed-off-by: Michael Riesch <michael.riesch@wolfvision.net> Link: https://lore.barebox.org/20220509113618.1602657-2-michael.riesch@wolfvision.net Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / phy: freescale: imx8mq-usb: add support for i.MX8MP PHYLucas Stach2022-04-141-13/+74
|/ | | | | | | | | | | This is a port of the Linux kernel commit 4708ee37826e by Li Jun <jun.li@nxp.com>. The USB3 PHY in the i.MX8MP is very close to the one in the i.MX8MQ and just needs a different setup routine. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Link: https://lore.barebox.org/20220412195241.126535-1-l.stach@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/rockchip'Sascha Hauer2021-12-151-1/+6
|\
| * phy: rockchip-inno-usb2: add support for older rockchip SoC bindingsAhmad Fatoum2021-12-071-1/+6
| | | | | | | | | | | | | | | | | | | | Anything earlier than the rv1108, has no rockchip,usbgrf regmap and instead access the parent device's regmap. Add support for this binding, so the driver is usable on the rk3399. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20211202074236.196396-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | drivers: migrate "GPL-2.0+" license identifiers to SPDX 2.0Roland Hieber2021-11-221-1/+1
| | | | | | | | | | | | | | | | | | "GPL-2.0-or-later" was introduced in SPDX 2.0, and the old identifier "GPL-2.0+" is now deprecated; see <https://spdx.org/licenses>. Signed-off-by: Roland Hieber <rhi@pengutronix.de> Link: https://lore.barebox.org/20211117113851.2022669-3-rhi@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | drivers: migrate "GPL-2.0" license identifiers to SPDX 2.0Roland Hieber2021-11-228-8/+8
|/ | | | | | | | | | "GPL-2.0-only" was introduced in SPDX 2.0, and the old identifier "GPL-2.0" is now considered deprecated; see <https://spdx.org/licenses>. Fixes: 28f4a6a4df76f0f1581d (2021-10-30, "drivers: add missing SPDX-License-Identifier") Signed-off-by: Roland Hieber <rhi@pengutronix.de> Link: https://lore.barebox.org/20211117113851.2022669-2-rhi@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/spdx'Sascha Hauer2021-11-158-15/+8
|\
| * drivers: add missing SPDX-License-IdentifierAhmad Fatoum2021-11-018-15/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds the suitable SPDX-License-Identifier to all files in drivers/ that previously lacked one. To aid manual inspection, following heuristics can be used: * No changes outside of comments/whitespace: git show -U0 HEAD | rg -v '^(@@|diff|index)|[-+]([-+]|//|#|[\s/]\*)' * -or-later come in pairs: git show --inter-hunk-context=19 HEAD | \ perl -0777 -F'/^@/gm' -ne 'for (@F) { @m = /later/g; print if @m & 1 }' Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20211030175632.2276077-4-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | phy: rockchip-inno-usb2: handle disabled child nodes gracefullySascha Hauer2021-10-121-0/+6
| | | | | | | | | | | | | | | | | | | | | | When child nodes of the phy node are disabled then of_platform_device_create() on them returns a NULL pointer. Make sure we skip initialization for these disabled nodes and also skip them when iterating over them in the xlate function. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20211012073352.4071559-5-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | phy: rockchip: Add dummy driver for child nodeSascha Hauer2021-10-121-1/+5
|/ | | | | | | | To satisfy deep probe mechanism. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20211012073352.4071559-2-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/rockchip'Sascha Hauer2021-07-186-0/+1606
|\
| * phy: rockchip: Add naneng-combphy supportSascha Hauer2021-06-283-0/+615
| | | | | | | | | | | | | | | | | | | | This adds driver for the PCIe/USB3.0/SATA phy found on Rockchip RK3568 SoCs. The driver has been taken from the Rockchip downstream Kernel repository. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20210622064711.14058-3-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * phy: Rockchip: Add driver for usb2phySascha Hauer2021-06-285-0/+991
| | | | | | | | | | | | | | | | | | | | | | This adds a driver for the Rockchip usb2phy. The driver has been taken from U-Boot which has the same codebase as the Kernel driver, but is easier to port over. Some features like clk provider support have been added from the kernel then. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20210622064711.14058-2-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | phy: Add deep probe supportSascha Hauer2021-06-251-0/+4
|/ | | | | | | | Add deep probe support to the phy core. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20210625072540.32717-14-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* phy: stm32: sync with upstreamAhmad Fatoum2021-03-171-80/+151
| | | | | | | | | | | | | | | | | | | | | | | | This imports following Linux patches by Amelie Delaunay <amelie.delaunay@foss.st.com>: phy: stm32: manage 1v1 and 1v8 supplies at pll activation/deactivation phy: stm32: replace regulator_bulk* by multiple regulator_* phy: stm32: ensure pll is disabled before phys creation phy: stm32: ensure phy are no more active when removing the driver phy: stm32: rework PLL Lock detection ARM: dts: stm32: add usbphyc vdda1v1 and vdda1v8 supplies on stm32mp151 This makes barebox compatible to the new device tree binding, reduces our differences to the upstream driver and removes the power_on, power_off callbacks which are now integrated into init/exit. The device tree override is necessary, because unlike with Linux, barebox regulator core doesn't descend into child nodes to enable their regulators, but that's a fix for another day. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: include <linux/math64.h> wrapper instead of <asm-generic/div64.h>Ahmad Fatoum2021-02-191-1/+1
| | | | | | | | | | | <asm-generic/div64.h> isn't meant for direct usage as <asm/div64.h> may override this on a per-architecture basis. We don't do that currently, but in the future we might. Include the <linux/math64.h> instead. No functional change. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* phy: stm32-usphyc: release resources to properly support EPROBE_DEFERAhmad Fatoum2020-12-161-2/+7
| | | | | | | | Driver failed to release resources on failed probe so far, leading to deferred probe failing with -EBUSY. Fix this. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: Use driver macroSascha Hauer2020-09-291-5/+1
| | | | | | | We have several macros for a oneline driver registration. Add some missing and use them consistently where possible througout the tree. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/kconfig'Sascha Hauer2020-05-141-1/+1
|\
| * phy: freescale: fix typo in Kconfig defaultAhmad Fatoum2020-04-291-1/+1
| | | | | | | | | | | | | | We don't have a config SOC_IMX8MQ, but have an ARCH_IMX8MQ. Fix this. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | drivers: mark first batch of compilable drivers for COMPILE_TESTAhmad Fatoum2020-05-081-1/+1
|/ | | | | | | | | All of these drivers have a runtime dependency on SoC peripherals, but can nevertheless be compile-tested. Add COMPILE_TEST as an alternate dependency. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* phy: port over Linux stm32 usbphyc driverAhmad Fatoum2020-02-253-0/+448
| | | | | | | | This ports over the Linux v5.6-rc1 state of the driver. It'll be needed for both EHCI and DWC2 usb connectivity on the stm32mp1. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* phy: introduce phy_get_by_indexAhmad Fatoum2020-02-251-0/+14
| | | | | | | | | The upstream (v5.6-rc1) device tree node of the stm32mp157c-dk2's OHCI has a phys property, but not phy-names. We have no API to reference such a phy easily (passing NULL isn't allowed). Add one. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* phy: populate existing ->pwr member with phy-supplyAhmad Fatoum2020-02-251-0/+10
| | | | | | | | | barebox already enables/disables the ->pwr regulator at the correct places, but doesn't assign a value anywhere. Initialize it with the phy-supply regulator like Linux does. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* phy: remove unused init_data parameterAhmad Fatoum2020-02-253-6/+3
| | | | | | | | Linux has since migrated to a new lookup API that lacks the init_data parameter. As it's unused in barebox, follow suit. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* phy: Port i.MX8MQ USB PHY driver from LinuxAndrey Smirnov2019-02-225-0/+138
| | | | | | | Port i.MX8MQ USB PHY driver from Linux. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* phy: core: Assume EPROBE_DEFER in of_phy_provider_lookup()Andrey Smirnov2019-02-221-2/+2
| | | | | | | | | In order to support PHY driver probe deferral change the code to assume EPROBE_DEFER instead of ENODEV when requested PHY is missing from phy_provider_list. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>