Add SpacemiT K1 USB3.0 host controller support
Subsystems (5)
v5 cover Add SpacemiT K1 USB3.0 host controller support
The USB 3.0 controller found in the SpacemiT K1 SoC[1] supports both USB3.0 Host and USB2.0 Dual-Role Device (DRD).
This controller is compatible with DesignWare Core USB 3 (DWC3) driver. However, constraints in the snps,dwc3 bindings limit the ability to describe hardware-specific features in a clean and maintainable way. While dwc3-of-simple still serves as a glue layer for many platforms, it requires a split device tree node structure, which is less desirable in newer platforms.
To promote a transition toward a flattened dwc node structure, this series introduces dwc3-generic-plat, building upon prior efforts that exposed the DWC3 core driver [2].
The device tree support for SpacemiT K1 will be submitted separately when the associated PHY driver is ready.
This series is based on 6.16-rc1 and has been tested on BananaPi development boards.
---
Changes in v5:
- drop DTS patch (will submit when PHY driver is ready)
- drop interconnects and update resets property in dt-bindings
- remove unnecessary __maybe_unused attribute and PM guards
- switch to devres APIs for reset and clock management
- Link to v4: https://lore.kernel.org/all/[email protected]/
Changes in v4:
- dt-bindings spacemit,k1-dwc:
- reorder properties
- add properties of phys & phy-names
- add usb hub nodes in example dt
- add support for spacemit,k1-mbus
- dwc3 generic plat driver:
- rename dwc3-common.c to dwc3-generic-plat.c
- use SYSTEM_SLEEP_PM_OPS macros and drop PM guards
- dts:
- reorder dts properties of usb dwc3 node
- move "dr_mode" of dwc3 from dtsi to dts
- Link to v3: https://lore.kernel.org/r/[email protected]
Changes in v3:
- introduce dwc3-common for generic dwc3 hardware
- fix warnings in usb host dt-bindings
- fix errors in dts
- Link to v2: https://lore.kernel.org/r/[email protected]
Changes in v2:
- dt-bindings:
- add missing 'maxItems'
- remove 'status' property in exmaple
- fold dwc3 node into parent
- drop dwc3 glue driver and use snps,dwc3 driver directly
- rename dts nodes and reorder properties to fit coding style
- Link to v1: https://lore.kernel.org/all/[email protected]
---
Ze Huang (2):
dt-bindings: usb: dwc3: add support for SpacemiT K1
usb: dwc3: add generic driver to support flattened
.../devicetree/bindings/usb/spacemit,k1-dwc3.yaml | 107 ++++++++++++ drivers/usb/dwc3/Kconfig | 11 ++ drivers/usb/dwc3/Makefile | 1 + drivers/usb/dwc3/dwc3-generic-plat.c | 182 +++++++++++++++++++++ 4 files changed, 301 insertions(+)
---
base-commit: d9946fe286439c2aeaa7953b8c316efe5b83d515
change-id: 20250705-dwc3_generic-8d02859722c3
Best regards,
Signature · 1 line
Ze Huang <[email protected]>
PATCH v5 1/2 dt-bindings: usb: dwc3: add support for SpacemiT K1
Add support for the USB 3.0 Dual-Role Device (DRD) controller embedded in the SpacemiT K1 SoC. The controller is based on the Synopsys DesignWare Core USB 3 (DWC3) IP, supporting USB3.0 host mode and USB 2.0 DRD mode.
--- .../devicetree/bindings/usb/spacemit,k1-dwc3.yaml | 107 +++++++++++++++++++++ 1 file changed, 107 insertions(+)
Documentation/devicetree/bindings/usb/spacemit,k1-dwc3.yaml new file +107 -0
@@ -0,0 +1,107 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/usb/spacemit,k1-dwc3.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: SpacemiT K1 SuperSpeed DWC3 USB SoC Controller + +maintainers: + - Ze Huang <[email protected]> + +description: | + The SpacemiT K1 embeds a DWC3 USB IP Core which supports Host functions + for USB 3.0 and DRD for USB 2.0. + + Key features: + - USB3.0 SuperSpeed and USB2.0 High/Full/Low-Speed support + - Supports low-power modes (USB2.0 suspend, USB3.0 U1/U2/U3) + - Internal DMA controller and flexible endpoint FIFO sizing + + Communication Interface: + - Use of PIPE3 (125MHz) interface for USB3.0 PHY + - Use of UTMI+ (30/60MHz) interface for USB2.0 PHY + +allOf: + - $ref: snps,dwc3-common.yaml# + +properties: + compatible: + const: spacemit,k1-dwc3 + + reg: + maxItems: 1 + + clocks: + maxItems: 1 + + clock-names: + const: usbdrd30 + + interrupts: + maxItems: 1 + + phys: + items: + - description: phandle to USB2/HS PHY + - description: phandle to USB3/SS PHY + + phy-names: + items: + - const: usb2-phy + - const: usb3-phy + + resets: + items: + - description: USB3.0 AHB reset line + - description: USB3.0 VCC reset line + - description: USB3.0 PHY reset line + + vbus-supply: + description: A phandle to the regulator supplying the VBUS voltage. + +required: + - compatible + - reg + - clocks + - clock-names + - interrupts + - phys + - phy-names + - resets + +unevaluatedProperties: false + +examples: + - | + usb@c0a00000 { + compatible = "spacemit,k1-dwc3"; + reg = <0xc0a00000 0x10000>; + clocks = <&syscon_apmu 16>; + clock-names = "usbdrd30"; + interrupts = <125>; + phys = <&usb2phy>, <&usb3phy>; + phy-names = "usb2-phy", "usb3-phy"; + resets = <&syscon_apmu 8>, + <&syscon_apmu 9>, + <&syscon_apmu 10>; + vbus-supply = <&usb3_vbus>; + #address-cells = <1>; + #size-cells = <0>; + + hub_2_0: hub@1 { + compatible = "usb2109,2817"; + reg = <1>; + vdd-supply = <&usb3_vhub>; + peer-hub = <&hub_3_0>; + reset-gpios = <&gpio 3 28 1>; + }; + + hub_3_0: hub@2 { + compatible = "usb2109,817"; + reg = <2>; + vdd-supply = <&usb3_vhub>; + peer-hub = <&hub_2_0>; + reset-gpios = <&gpio 3 28 1>; + }; + };
Signature · 1 line
2.50.0
Re: [PATCH v5 1/2] dt-bindings: usb: dwc3: add support for SpacemiT K1
Quoted 8 lines · Ze Huang
Add support for the USB 3.0 Dual-Role Device (DRD) controller embedded in the SpacemiT K1 SoC. The controller is based on the Synopsys DesignWare Core USB 3 (DWC3) IP, supporting USB3.0 host mode and USB 2.0 DRD mode.
Reviewed-by Krzysztof Kozlowski <[email protected]>Signed-off-by Ze Huang <[email protected]>---
Hi Krzysztof,
I kept your Reviewed-by tag, as this version only includes minor updates:
- Dropped the interconnects property
- Updated the resets property to match the latest convention from Alex's patch
Let me know if you have any concerns.
Quoted 120 lines
.../devicetree/bindings/usb/spacemit,k1-dwc3.yaml | 107 +++++++++++++++++++++ 1 file changed, 107 insertions(+)Documentation/devicetree/bindings/usb/spacemit,k1-dwc3.yaml new file +107
-0@@ -0,0 +1,107 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/usb/spacemit,k1-dwc3.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: SpacemiT K1 SuperSpeed DWC3 USB SoC Controller + +maintainers: + - Ze Huang <[email protected]> + +description: | + The SpacemiT K1 embeds a DWC3 USB IP Core which supports Host functions + for USB 3.0 and DRD for USB 2.0. + + Key features: + - USB3.0 SuperSpeed and USB2.0 High/Full/Low-Speed support + - Supports low-power modes (USB2.0 suspend, USB3.0 U1/U2/U3) + - Internal DMA controller and flexible endpoint FIFO sizing + + Communication Interface: + - Use of PIPE3 (125MHz) interface for USB3.0 PHY + - Use of UTMI+ (30/60MHz) interface for USB2.0 PHY + +allOf: + - $ref: snps,dwc3-common.yaml# + +properties: + compatible: + const: spacemit,k1-dwc3 + + reg: + maxItems: 1 + + clocks: + maxItems: 1 + + clock-names: + const: usbdrd30 + + interrupts: + maxItems: 1 + + phys: + items: + - description: phandle to USB2/HS PHY + - description: phandle to USB3/SS PHY + + phy-names: + items: + - const: usb2-phy + - const: usb3-phy + + resets: + items: + - description: USB3.0 AHB reset line + - description: USB3.0 VCC reset line + - description: USB3.0 PHY reset line + + vbus-supply: + description: A phandle to the regulator supplying the VBUS voltage. + +required: + - compatible + - reg + - clocks + - clock-names + - interrupts + - phys + - phy-names + - resets + +unevaluatedProperties: false + +examples: + - | + usb@c0a00000 { + compatible = "spacemit,k1-dwc3"; + reg = <0xc0a00000 0x10000>; + clocks = <&syscon_apmu 16>; + clock-names = "usbdrd30"; + interrupts = <125>; + phys = <&usb2phy>, <&usb3phy>; + phy-names = "usb2-phy", "usb3-phy"; + resets = <&syscon_apmu 8>, + <&syscon_apmu 9>, + <&syscon_apmu 10>; + vbus-supply = <&usb3_vbus>; + #address-cells = <1>; + #size-cells = <0>; + + hub_2_0: hub@1 { + compatible = "usb2109,2817"; + reg = <1>; + vdd-supply = <&usb3_vhub>; + peer-hub = <&hub_3_0>; + reset-gpios = <&gpio 3 28 1>; + }; + + hub_3_0: hub@2 { + compatible = "usb2109,817"; + reg = <2>; + vdd-supply = <&usb3_vhub>; + peer-hub = <&hub_2_0>; + reset-gpios = <&gpio 3 28 1>; + }; + };Signature · 2 lines
-- 2.50.0
Re: [PATCH v5 1/2] dt-bindings: usb: dwc3: add support for SpacemiT K1
Quoted 10 lines · Ze Huang
Quoted 8 lines · Ze Huang
Add support for the USB 3.0 Dual-Role Device (DRD) controller embedded in the SpacemiT K1 SoC. The controller is based on the Synopsys DesignWare Core USB 3 (DWC3) IP, supporting USB3.0 host mode and USB 2.0 DRD mode.
Reviewed-by Krzysztof Kozlowski <[email protected]>Signed-off-by Ze Huang <[email protected]>---
Quoted 7 lines
Hi Krzysztof,
I kept your Reviewed-by tag, as this version only includes minor updates:
- Dropped theinterconnectsproperty
- Updated theresetsproperty to match the latest convention from Alex's patchLet me know if you have any concerns.
It's fine, thanks.
Best regards,
Krzysztof
PATCH v5 2/2 usb: dwc3: add generic driver to support flattened
In reply to Ze HuangTo support flattened dwc3 dt model and drop the glue layer, introduce the dwc3-generic driver. This enables direct binding of the DWC3 core driver and offers an alternative to the existing glue driver dwc3-of-simple.
--- drivers/usb/dwc3/Kconfig | 11 +++ drivers/usb/dwc3/Makefile | 1 + drivers/usb/dwc3/dwc3-generic-plat.c | 182 +++++++++++++++++++++++++++++++++++ 3 files changed, 194 insertions(+)
drivers/usb/dwc3/Kconfig +11 -0
@@ -189,4 +189,15 @@ config USB_DWC3_RTK or dual-role mode. Say 'Y' or 'M' if you have such device. +config USB_DWC3_GENERIC_PLAT + tristate "DWC3 Generic Platform Driver" + depends on OF && COMMON_CLK + default USB_DWC3 + help + Support USB3 functionality in simple SoC integrations. + Currently supports SpacemiT DWC USB3. Platforms using + dwc3-of-simple can easily switch to dwc3-generic by flattening + the dwc3 child node in the device tree. + Say 'Y' or 'M' here if your platform integrates DWC3 in a similar way. + endif
drivers/usb/dwc3/Makefile +1 -0
@@ -57,3 +57,4 @@ obj-$(CONFIG_USB_DWC3_IMX8MP) += dwc3-imx8mp.o obj-$(CONFIG_USB_DWC3_XILINX) += dwc3-xilinx.o obj-$(CONFIG_USB_DWC3_OCTEON) += dwc3-octeon.o obj-$(CONFIG_USB_DWC3_RTK) += dwc3-rtk.o +obj-$(CONFIG_USB_DWC3_GENERIC_PLAT) += dwc3-generic-plat.o
drivers/usb/dwc3/dwc3-generic-plat.c new file +182 -0
182 lines not on this page · raw message
Signature · 1 line
2.50.0
kernel test robot
build botRe: [PATCH v5 2/2] usb: dwc3: add generic driver to support flattened
kernel test robot noticed the following build warnings:
Hi Ze,
kernel test robot noticed the following build warnings:
[auto build test WARNING on d9946fe286439c2aeaa7953b8c316efe5b83d515]
url: https://github.com/intel-lab-lkp/linux/commits/Ze-Huang/dt-bindings-usb-dwc3-add-support-for-SpacemiT-K1/20250705-210419 base: d9946fe286439c2aeaa7953b8c316efe5b83d515 patch link: https://lore.kernel.org/r/20250705-dwc3_generic-v5-2-9dbc53ea53d2%40linux.dev patch subject: [PATCH v5 2/2] usb: dwc3: add generic driver to support flattened config: arc-randconfig-001-20250706 (https://download.01.org/0day-ci/archive/20250706/[email protected]/config) compiler: arc-linux-gcc (GCC) 8.5.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250706/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
>> drivers/usb/dwc3/dwc3-generic-plat.c:151:12: warning: 'dwc3_generic_runtime_idle' defined but not used [-Wunused-function]
static int dwc3_generic_runtime_idle(struct device *dev)
^~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/usb/dwc3/dwc3-generic-plat.c:144:12: warning: 'dwc3_generic_runtime_resume' defined but not used [-Wunused-function]
static int dwc3_generic_runtime_resume(struct device *dev)
^~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/usb/dwc3/dwc3-generic-plat.c:137:12: warning: 'dwc3_generic_runtime_suspend' defined but not used [-Wunused-function]
static int dwc3_generic_runtime_suspend(struct device *dev)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/usb/dwc3/dwc3-generic-plat.c:121:12: warning: 'dwc3_generic_resume' defined but not used [-Wunused-function]
static int dwc3_generic_resume(struct device *dev)
^~~~~~~~~~~~~~~~~~~
>> drivers/usb/dwc3/dwc3-generic-plat.c:107:12: warning: 'dwc3_generic_suspend' defined but not used [-Wunused-function] static int dwc3_generic_suspend(struct device *dev)
^~~~~~~~~~~~~~~~~~~~
vim +/dwc3_generic_runtime_idle +151 drivers/usb/dwc3/dwc3-generic-plat.c
106
> 107 static int dwc3_generic_suspend(struct device *dev)
108 {
109 struct dwc3_generic *dwc3 = dev_get_drvdata(dev);
110 int ret;
111
112 ret = dwc3_pm_suspend(&dwc3->dwc);
113 if (ret)
114 return ret;
115
116 clk_bulk_disable_unprepare(dwc3->num_clocks, dwc3->clks);
117
118 return 0;
119 }
120
> 121 static int dwc3_generic_resume(struct device *dev)
122 {
123 struct dwc3_generic *dwc3 = dev_get_drvdata(dev);
124 int ret;
125
126 ret = clk_bulk_prepare_enable(dwc3->num_clocks, dwc3->clks);
127 if (ret)
128 return ret;
129
130 ret = dwc3_pm_resume(&dwc3->dwc);
131 if (ret)
132 return ret;
133
134 return 0;
135 }
136
> 137 static int dwc3_generic_runtime_suspend(struct device *dev)
138 {
139 struct dwc3_generic *dwc3 = dev_get_drvdata(dev);
140
141 return dwc3_runtime_suspend(&dwc3->dwc);
142 }
143
> 144 static int dwc3_generic_runtime_resume(struct device *dev)
145 {
146 struct dwc3_generic *dwc3 = dev_get_drvdata(dev);
147
148 return dwc3_runtime_resume(&dwc3->dwc);
149 }
150
> 151 static int dwc3_generic_runtime_idle(struct device *dev) 152 {
153 struct dwc3_generic *dwc3 = dev_get_drvdata(dev);
154
155 return dwc3_runtime_idle(&dwc3->dwc);
156 }
157
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Thinh Nguyen
maintainerRe: [PATCH v5 2/2] usb: dwc3: add generic driver to support flattened
In reply to Ze HuangQuoted 212 lines · Ze Huang
To support flattened dwc3 dt model and drop the glue layer, introduce the
dwc3-genericdriver. This enables direct binding of the DWC3 core driver and offers an alternative to the existing glue driverdwc3-of-simple.Signed-off-by Ze Huang <[email protected]>--- drivers/usb/dwc3/Kconfig | 11 +++ drivers/usb/dwc3/Makefile | 1 + drivers/usb/dwc3/dwc3-generic-plat.c | 182 +++++++++++++++++++++++++++++++++++ 3 files changed, 194 insertions(+)drivers/usb/dwc3/Kconfig +11
-0@@ -189,4 +189,15 @@ config USB_DWC3_RTK or dual-role mode. Say 'Y' or 'M' if you have such device. +config USB_DWC3_GENERIC_PLAT + tristate "DWC3 Generic Platform Driver" + depends on OF && COMMON_CLK + default USB_DWC3 + help + Support USB3 functionality in simple SoC integrations. + Currently supports SpacemiT DWC USB3. Platforms using + dwc3-of-simple can easily switch to dwc3-generic by flattening + the dwc3 child node in the device tree. + Say 'Y' or 'M' here if your platform integrates DWC3 in a similar way. + endifdrivers/usb/dwc3/Makefile +1
-0@@ -57,3 +57,4 @@ obj-$(CONFIG_USB_DWC3_IMX8MP) += dwc3-imx8mp.o obj-$(CONFIG_USB_DWC3_XILINX) += dwc3-xilinx.o obj-$(CONFIG_USB_DWC3_OCTEON) += dwc3-octeon.o obj-$(CONFIG_USB_DWC3_RTK) += dwc3-rtk.o +obj-$(CONFIG_USB_DWC3_GENERIC_PLAT) += dwc3-generic-plat.odrivers/usb/dwc3/dwc3-generic-plat.c new file +166
-0@@ -0,0 +1,182 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* dwc3-generic-plat.c - DesignWare USB3 generic platform driver +* +* Copyright (C) 2025 Ze Huang <[email protected]> +* +* Inspired by dwc3-qcom.c and dwc3-of-simple.c +*/ + +#include <linux/clk.h> +#include <linux/platform_device.h> +#include <linux/reset.h> +#include "glue.h" + +struct dwc3_generic { +struct device *dev; +struct dwc3 dwc; +struct clk_bulk_data *clks; +int num_clocks; +struct reset_control *resets; +}; + +static void dwc3_generic_reset_control_assert (void *data) +{ +reset_control_assert (data); +} + +static void dwc3_generic_clk_bulk_disable_unprepare (void *data) +{ +struct dwc3_generic *dwc3 = data; + +clk_bulk_disable_unprepare (dwc3->num_clocks, dwc3->clks); +} + +static int dwc3_generic_probe (struct platform_device *pdev) +{ +struct dwc3_probe_data probe_data = {}; +struct device *dev = &pdev->dev; +struct dwc3_generic *dwc3; +struct resource *res; +int ret; + + dwc3 =devm_kzalloc (dev,sizeof (*dwc3),GFP_KERNEL ); +if (!dwc3) +return -ENOMEM ; + + dwc3->dev = dev; + +platform_set_drvdata (pdev, dwc3); + + res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); +if (!res) { +dev_err (&pdev->dev,"missing memory resource\n" ); +return -ENODEV ; + } + + dwc3->resets =devm_reset_control_array_get_optional_exclusive (dev); +if (IS_ERR (dwc3->resets)) +return dev_err_probe (dev,PTR_ERR (dwc3->resets),"failed to get resets\n" ); + + ret =reset_control_assert (dwc3->resets); +if (ret) +return dev_err_probe (dev, ret,"failed to assert resets\n" ); + + ret =devm_add_action_or_reset (dev, dwc3_generic_reset_control_assert, dwc3->resets); +if (ret) +return ret; + +usleep_range (10 ,1000 ); + + ret =reset_control_deassert (dwc3->resets); +if (ret) +return dev_err_probe (dev, ret,"failed to deassert resets\n" ); + + ret =devm_clk_bulk_get_all (dwc3->dev, &dwc3->clks); +if (ret <0 ) +return dev_err_probe (dev, ret,"failed to get clocks\n" ); + + dwc3->num_clocks = ret; + + ret =clk_bulk_prepare_enable (dwc3->num_clocks, dwc3->clks); +if (ret) +return dev_err_probe (dev, ret,"failed to enable clocks\n" ); + + ret =devm_add_action_or_reset (dev, dwc3_generic_clk_bulk_disable_unprepare, dwc3); +if (ret) +return ret; + + dwc3->dwc.dev = dev; + probe_data.dwc = &dwc3->dwc; + probe_data.res = res; + probe_data.ignore_clocks_and_resets = true; + ret =dwc3_core_probe (&probe_data); +if (ret) +return dev_err_probe (dev, ret,"failed to register DWC3 Core\n" ); + +return 0 ; +} + +static void dwc3_generic_remove (struct platform_device *pdev) +{ +struct dwc3_generic *dwc3 =platform_get_drvdata (pdev); + +dwc3_core_remove (&dwc3->dwc); +} + +static int dwc3_generic_suspend (struct device *dev) +{ +struct dwc3_generic *dwc3 =dev_get_drvdata (dev); +int ret; + + ret =dwc3_pm_suspend (&dwc3->dwc); +if (ret) +return ret; + +clk_bulk_disable_unprepare (dwc3->num_clocks, dwc3->clks); + +return 0 ; +} + +static int dwc3_generic_resume (struct device *dev) +{ +struct dwc3_generic *dwc3 =dev_get_drvdata (dev); +int ret; + + ret =clk_bulk_prepare_enable (dwc3->num_clocks, dwc3->clks); +if (ret) +return ret; + + ret =dwc3_pm_resume (&dwc3->dwc); +if (ret) +return ret; + +return 0 ; +} + +static int dwc3_generic_runtime_suspend (struct device *dev) +{ +struct dwc3_generic *dwc3 =dev_get_drvdata (dev); + +return dwc3_runtime_suspend (&dwc3->dwc); +} + +static int dwc3_generic_runtime_resume (struct device *dev) +{ +struct dwc3_generic *dwc3 =dev_get_drvdata (dev); + +return dwc3_runtime_resume (&dwc3->dwc); +} + +static int dwc3_generic_runtime_idle (struct device *dev) +{ +struct dwc3_generic *dwc3 =dev_get_drvdata (dev); + +return dwc3_runtime_idle (&dwc3->dwc); +} + +static const struct dev_pm_ops dwc3_generic_dev_pm_ops = { + SET_SYSTEM_SLEEP_PM_OPS(dwc3_generic_suspend, dwc3_generic_resume) +SET_RUNTIME_PM_OPS (dwc3_generic_runtime_suspend, dwc3_generic_runtime_resume, + dwc3_generic_runtime_idle) +}; + +static const struct of_device_id dwc3_generic_of_match[] = { + { .compatible ="spacemit,k1-dwc3" , }, + {/* sentinel */ }
drivers/usb/dwc3/dwc3-generic-plat.c line 176
Quoted 10 lines
drivers/usb/dwc3/dwc3-generic-plat.c new file +10
-0+}; +MODULE_DEVICE_TABLE (of, dwc3_generic_of_match); + +static struct platform_driver dwc3_generic_driver = { + .probe = dwc3_generic_probe, + .remove = dwc3_generic_remove, + .driver = { + .name ="dwc3-generic-plat" , + .of_match_table = dwc3_generic_of_match, + .pm = &dwc3_generic_dev_pm_ops,
You're still not using the new pm_ptr()/pm_sleep_ptr. The kernel build bot will complain about the maybe unused functions.
BR,
Thinh
Re: [PATCH v5 2/2] usb: dwc3: add generic driver to support flattened
Quoted 12 lines · Thinh Nguyen
Quoted 11 lines · Ze Huang
To support flattened dwc3 dt model and drop the glue layer, introduce the
dwc3-genericdriver. This enables direct binding of the DWC3 core driver and offers an alternative to the existing glue driverdwc3-of-simple.Signed-off-by Ze Huang <[email protected]>--- drivers/usb/dwc3/Kconfig | 11 +++ drivers/usb/dwc3/Makefile | 1 + drivers/usb/dwc3/dwc3-generic-plat.c | 182 +++++++++++++++++++++++++++++++++++ 3 files changed, 194 insertions(+)
[...]
Quoted 14 lines
Quoted 14 lines
drivers/usb/dwc3/dwc3-generic-plat.c new file +14
-0+static const struct dev_pm_ops dwc3_generic_dev_pm_ops = { + SET_SYSTEM_SLEEP_PM_OPS(dwc3_generic_suspend, dwc3_generic_resume) +SET_RUNTIME_PM_OPS (dwc3_generic_runtime_suspend, dwc3_generic_runtime_resume, + dwc3_generic_runtime_idle) +}; + +static const struct of_device_id dwc3_generic_of_match[] = { + { .compatible ="spacemit,k1-dwc3" , }, + {/* sentinel */ } +}; +MODULE_DEVICE_TABLE (of, dwc3_generic_of_match); + +static struct platform_driver dwc3_generic_driver = { + .probe = dwc3_generic_probe,
Quoted 8 lines
drivers/usb/dwc3/dwc3-generic-plat.c line 176
Quoted 5 lines
drivers/usb/dwc3/dwc3-generic-plat.c new file +5
-0+ .remove = dwc3_generic_remove, + .driver = { + .name = "dwc3-generic-plat", + .of_match_table = dwc3_generic_of_match, + .pm = &dwc3_generic_dev_pm_ops,You're still not using the new pm_ptr()/pm_sleep_ptr. The kernel build bot will complain about the maybe unused functions.
Thanks for your patience.
I found they are caused by using SET_RUNTIME_PM_OPS and SET_SYSTEM_SLEEP_PM_OPS macros.
I'll replace them with new RUNTIME_PM_OPS/SYSTEM_SLEEP_PM_OPS and wrap the dwc3_generic_dev_pm_ops with pm_ptr()
Quoted 3 lines
BR,
Thinh