Skip to content

USB: spacemit-k3: Add Spacemit K3 USB host controller support#323

Open
EncrowThorne19 wants to merge 5 commits into
RVCK-Project:rvck-6.6from
EncrowThorne19:dev-usb3-k3
Open

USB: spacemit-k3: Add Spacemit K3 USB host controller support#323
EncrowThorne19 wants to merge 5 commits into
RVCK-Project:rvck-6.6from
EncrowThorne19:dev-usb3-k3

Conversation

@EncrowThorne19

@EncrowThorne19 EncrowThorne19 commented Jul 4, 2026

Copy link
Copy Markdown

fixed: #322

This series adds USB2.0 / 3.0 host support for the SpacemiT K3 com260 board,
enabling device enumeration on the on-board USB ports.

The K3 PCIe/USB subsystem shares three PIPE3 PHY lanes (PHY2/3/4)
between PCIe and USB3. Bringing up USB3 Port B therefore requires the
dwc3 core to be usable by a separate glue driver, plus a combo PHY
driver that claims the shared lane from PCIe before powering the port.

Patches:

  1. usb: dwc3: core: expose the core as a library so a glue driver
    can drive it instead of binding as a standalone platform device
  2. usb: dwc3: add the generic platform glue on top of that library
  3. phy: spacemit: K1/K3 USB2 PHY driver
  4. phy: spacemit: K3 USB3 combo PHY (lane arbitration, R-cal, PLL
    lock, Type-C orientation mux)
  5. riscv: dts: wire up usb3_portb, its PHYs and the on-board VL817
    hub on com260

Scope: host mode only (xHCI); no gadget/device role and no Type-C
role switching. Using USB3 Port B requires PCIe-A x8 mode disabled.

Tested on com260: all four physical ports enumerate USB2.0 and
USB3.0 devices.

@github-actions

github-actions Bot commented Jul 4, 2026

Copy link
Copy Markdown

开始测试 log: https://github.com/RVCK-Project/rvck/actions/runs/28697925188

参数解析结果
args value
repository RVCK-Project/rvck
head ref pull/323/head
base ref rvck-6.6
LAVA repo RVCK-Project/lavaci
LAVA hardware ['qemu']
LAVA Testcase path lava-testcases/common-test/ltp/ltp.yaml
need run job kunit-test,kernel-build,check-patch,lava-trigger

测试完成

详细结果:
check result
kunit-test success
kernel-build success
check-patch success
lava-trigger-qemu success
lava-trigger-sg2042 skipped
lava-trigger-k1 skipped
lava-trigger-lpi4a skipped

Kunit Test Result

[06:41:26] Testing complete. Ran 482 tests: passed: 465, skipped: 17

Kernel Build Result

Check Patch Result

Total Errors 0
Total Warnings 29

LAVA Check (qemu)

args value
testcase_repo RVCK-Project/lavaci
lava_template lava-job-template/qemu/qemu-ltp.yaml
testcase_path lava-testcases/common-test/ltp/ltp.yaml
kernel_download_url http://10.30.190.110/openEuler-RISC-V/RVCK/OERV-RVCI/RVCK-Project/rvck/323_28697925188_1/Image
initramfs_download_url http://10.30.190.110/openEuler-RISC-V/RVCK/OERV-RVCI/RVCK-Project/rvck/323_28697925188_1/initramfs.img
rootfs_download_url https://fast-mirror.isrc.ac.cn/openeuler-sig-riscv/openEuler-RISC-V/RVCK/openEuler24.03-LTS-SP1/openeuler-rootfs.img.zst
testcase_ref main
testitem_name RVCK-Project_rvck_pull_request_target_323__common-test_qemu

result: Lava check done!

@sterling-teng

Copy link
Copy Markdown
Contributor

请修改SOB栏格式,去除多余空行和不必要的备注,如果需要保留备注,请移动到commit message。

Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8650-QRD
Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
Link: https://lore.kernel.org/r/20250414-dwc3-refactor-v7-3-f015b358722d@oss.qualcomm.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Appended missing GSBUSCFG0_REQINFO macros in core.h to support
hardware specific bus configuration on rvck v6.6.

Signed-off-by: Yongchao Jia <yongchao.jia@spacemit.com>

@EncrowThorne19

Copy link
Copy Markdown
Author

请修改SOB栏格式,去除多余空行和不必要的备注,如果需要保留备注,请移动到commit message。

Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8650-QRD
Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
Link: https://lore.kernel.org/r/20250414-dwc3-refactor-v7-3-f015b358722d@oss.qualcomm.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Appended missing GSBUSCFG0_REQINFO macros in core.h to support
hardware specific bus configuration on rvck v6.6.

Signed-off-by: Yongchao Jia <yongchao.jia@spacemit.com>

好的,我将修改后重新提交,谢谢!

@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown

开始测试 log: https://github.com/RVCK-Project/rvck/actions/runs/28744842838

参数解析结果
args value
repository RVCK-Project/rvck
head ref pull/323/head
base ref rvck-6.6
LAVA repo RVCK-Project/lavaci
LAVA hardware ['qemu']
LAVA Testcase path lava-testcases/common-test/ltp/ltp.yaml
need run job kunit-test,kernel-build,check-patch,lava-trigger

测试完成

详细结果:
check result
kunit-test success
kernel-build success
check-patch success
lava-trigger-qemu success
lava-trigger-sg2042 skipped
lava-trigger-k1 skipped
lava-trigger-lpi4a skipped

Kunit Test Result

[15:03:55] Testing complete. Ran 482 tests: passed: 465, skipped: 17

Kernel Build Result

Check Patch Result

Total Errors 0
Total Warnings 29

LAVA Check (qemu)

args value
testcase_repo RVCK-Project/lavaci
lava_template lava-job-template/qemu/qemu-ltp.yaml
testcase_path lava-testcases/common-test/ltp/ltp.yaml
kernel_download_url http://10.30.190.110/openEuler-RISC-V/RVCK/OERV-RVCI/RVCK-Project/rvck/323_28744842838_1/Image
initramfs_download_url http://10.30.190.110/openEuler-RISC-V/RVCK/OERV-RVCI/RVCK-Project/rvck/323_28744842838_1/initramfs.img
rootfs_download_url https://fast-mirror.isrc.ac.cn/openeuler-sig-riscv/openEuler-RISC-V/RVCK/openEuler24.03-LTS-SP1/openeuler-rootfs.img.zst
testcase_ref main
testitem_name RVCK-Project_rvck_pull_request_target_323__common-test_qemu

result: Lava check done!

@unicornx
unicornx self-requested a review July 6, 2026 05:41

@unicornx unicornx left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1st review:

引入 ”cf5ec910eb0f phy: spacemit: support K1 USB2.0 PHY controller“ 的原因是什么?是因为 ”dabf20af4a44 phy: spacemit: add K3 USB3 combo PHY driver“ 依赖于它,还是什么原因,这个 PR 我理解只是要支持 K3.

另外我有一个疑问,对于 K3 的 USB phy 的支持现在是否有人在往上游提交?是否可以等上游 review 过了进了主线我们再为 rvck 做这个支持?这个期间的维护工作你们怎么考虑的?

Comment thread drivers/usb/dwc3/core.c

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

对于 f28aa85 usb: dwc3: core: Expose core driver as library 这个补丁,看上去不是简单的从上游摘取 613a2e6, 而是在参考上游的同时,基于 rvck-6.6 的全新开发?请在 PR 中详细描述一下修改的思路。这个改动其实和上游差别还是有点大的,以后你们的维护思路是啥?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

您好,此pr提供的是k3 usb3 portb host的控制器驱动,此控制器支持 USB 3.0 与 USB 2.0 Host 模式,所以引用了 ”cf5ec910eb0f phy: spacemit: support K1 USB2.0 PHY controller“ 来支持USB 2.0 Host 模式,这点我没有在commit中描述清楚;

另外对于 K3 的 USB phy 的支持现在上游确实有在做,但是还在 review 阶段,pr提供的usb phy目前是我们自己在维护,经过测试功能是正常的,是否可以等上游合并后再来跟新?

对于 f28aa85 usb: dwc3: core: Expose core driver as library 这个补丁,是参考上游的同时,基于 rvck-6.6 的二次开发,修改的思路我会在commit中详细描述一下。

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果你们会积极维护 usb,又急着在 rvck 中使用,那也可以先合入你们自己的方案,等上游review 完成后再修改也是可以的。

总之是个权衡的过程,如果上游的 review 进展快的话,等一等上游也好,省的反复修改 rvck。

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我看你这个 commit 中相对于上游的 e0b6dc0 引入了一些和 genernic 无关的 platform,譬如 k1, fsl_ls1028 以及 eic7700,这是怎么回事?你可以对比一下 git show 8785c1de632fgit show e0b6dc00c701

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个commit在参考了上游 e0b6dc0 的基础上对齐了目前7.2版本中的功能,因为可能目前有其他厂家也各自添加了适配

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

其实还是同样强调的道理,e0b6dc00c701e600e655417aab1e100b73de821a 这个上游的补丁中没有 k1/fsl/eic 的东西,所以不建议在 backport 时自己加入其他的东西,除非是为了 6.6 特意做的兼容性改动。

如果上游 7.2 中有了 k1/fsl/eic 的改动,请直接 backport 他们对应的补丁会更好,或者干脆不 backport,因为从 rvck 的角度来说,对于 rvck 不支持的产品,严格来说我们的代码中不需要出现他们的东西。不用为了和 7.2 代码对齐而对齐。

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

好的,感谢您的建议

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown

开始测试 log: https://github.com/RVCK-Project/rvck/actions/runs/28921269018

参数解析结果
args value
repository RVCK-Project/rvck
head ref pull/323/head
base ref rvck-6.6
LAVA repo RVCK-Project/lavaci
LAVA hardware ['qemu']
LAVA Testcase path lava-testcases/common-test/ltp/ltp.yaml
need run job kunit-test,kernel-build,check-patch,lava-trigger

测试完成

详细结果:
check result
kunit-test success
kernel-build success
check-patch success
lava-trigger-qemu success
lava-trigger-sg2042 skipped
lava-trigger-k1 skipped
lava-trigger-lpi4a skipped

Kunit Test Result

[06:07:57] Testing complete. Ran 482 tests: passed: 465, skipped: 17

Kernel Build Result

Check Patch Result

Total Errors 0
Total Warnings 23

LAVA Check (qemu)

args value
testcase_repo RVCK-Project/lavaci
lava_template lava-job-template/qemu/qemu-ltp.yaml
testcase_path lava-testcases/common-test/ltp/ltp.yaml
kernel_download_url http://10.30.190.110/openEuler-RISC-V/RVCK/OERV-RVCI/RVCK-Project/rvck/323_28921269018_1/Image
initramfs_download_url http://10.30.190.110/openEuler-RISC-V/RVCK/OERV-RVCI/RVCK-Project/rvck/323_28921269018_1/initramfs.img
rootfs_download_url https://fast-mirror.isrc.ac.cn/openeuler-sig-riscv/openEuler-RISC-V/RVCK/openEuler24.03-LTS-SP1/openeuler-rootfs.img.zst
testcase_ref main
testitem_name RVCK-Project_rvck_pull_request_target_323__common-test_qemu

result: Lava check done!

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown

开始测试 log: https://github.com/RVCK-Project/rvck/actions/runs/28921808576

参数解析结果
args value
repository RVCK-Project/rvck
head ref pull/323/head
base ref rvck-6.6
LAVA repo RVCK-Project/lavaci
LAVA hardware ['qemu']
LAVA Testcase path lava-testcases/common-test/ltp/ltp.yaml
need run job kunit-test,kernel-build,check-patch,lava-trigger

测试完成

详细结果:
check result
kunit-test success
kernel-build success
check-patch success
lava-trigger-qemu success
lava-trigger-sg2042 skipped
lava-trigger-k1 skipped
lava-trigger-lpi4a skipped

Kunit Test Result

[06:19:24] Testing complete. Ran 482 tests: passed: 465, skipped: 17

Kernel Build Result

Check Patch Result

Total Errors 0
Total Warnings 23

LAVA Check (qemu)

args value
testcase_repo RVCK-Project/lavaci
lava_template lava-job-template/qemu/qemu-ltp.yaml
testcase_path lava-testcases/common-test/ltp/ltp.yaml
kernel_download_url http://10.30.190.110/openEuler-RISC-V/RVCK/OERV-RVCI/RVCK-Project/rvck/323_28921808576_1/Image
initramfs_download_url http://10.30.190.110/openEuler-RISC-V/RVCK/OERV-RVCI/RVCK-Project/rvck/323_28921808576_1/initramfs.img
rootfs_download_url https://fast-mirror.isrc.ac.cn/openeuler-sig-riscv/openEuler-RISC-V/RVCK/openEuler24.03-LTS-SP1/openeuler-rootfs.img.zst
testcase_ref main
testitem_name RVCK-Project_rvck_pull_request_target_323__common-test_qemu

result: Lava check done!

@unicornx unicornx left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2nd review:

另外:"usb: dwc3: core: Expose core driver as library" 这个 commit 的 message 中的签名前的下面这段描述应该删掉

Appended missing GSBUSCFG0_REQINFO macros in core.h to support
hardware specific bus configuration on rvck v6.6.

看上去它和前面的描述重复了,而且本身不该在这里添加你的文字。

还有一个疑问是:k1 的 USB 支持有计划后面做吗?怎么先做 K3 了?

其他我暂时没有什么问题了,请下次修改时 rebase 一下,因为 rvck-6.6 分支升级了几个补丁。

Comment thread drivers/phy/spacemit/phy-k1-usb2.c Outdated
#define PHY_K1_HS_HOST_DISC_CLR BIT(0)

#define PHY_K3_HS_HOST_DISC 0x20
#define PHY_K3_HS_HOST_DISC_CLR BIT(8)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PHY_K1_HS_HOST_DISC/PHY_K1_HS_HOST_DISC_CLR/PHY_K3_HS_HOST_DISC/PHY_K3_HS_HOST_DISC_CLR

这四个宏没有用到,原上游补丁中也没有,建议删除。

Comment thread drivers/usb/dwc3/core.h Outdated
unsigned suspended:1;
unsigned susphy_state:1;

u32 gsbuscfg0_reqinfo;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs_full_reinit 和 gsbuscfg0_reqinfo 在哪里用到了?感觉你目前的补丁 apply 后也没有用到啊?

@unicornx unicornx Jul 10, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

另外补充一下,我用 checkpatch 检查了一下你的补丁,排除了一些不必要的告警外,有下面几个问题需要你看一下:

./scripts/checkpatch.pl --strict ../patches/0004-phy-spacemit-add-K3-USB3-combo-PHY-driver.patch
......
CHECK: usleep_range is preferred over udelay; see Documentation/timers/timers-howto.rst
#312: FILE: drivers/phy/spacemit/phy-k3-usb3.c:242:
+	udelay(200);

CHECK: Lines should not end with a '('
#379: FILE: drivers/phy/spacemit/phy-k3-usb3.c:309:
+	regmap_update_bits(

CHECK: Lines should not end with a '('
#547: FILE: drivers/phy/spacemit/phy-k3-usb3.c:477:
+		regmap_update_bits(

......

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

感谢您的审核,上述问题都已修改

@EncrowThorne19

Copy link
Copy Markdown
Author

2nd review:

另外:"usb: dwc3: core: Expose core driver as library" 这个 commit 的 message 中的签名前的下面这段描述应该删掉

Appended missing GSBUSCFG0_REQINFO macros in core.h to support
hardware specific bus configuration on rvck v6.6.

看上去它和前面的描述重复了,而且本身不该在这里添加你的文字。

还有一个疑问是:k1 的 USB 支持有计划后面做吗?怎么先做 K3 了?

其他我暂时没有什么问题了,请下次修改时 rebase 一下,因为 rvck-6.6 分支升级了几个补丁。

已修改,当前k3需求更为急切,所以先做了k3, k1 usb后续也会支持

@github-actions

github-actions Bot commented Jul 13, 2026

Copy link
Copy Markdown

开始测试 log: https://github.com/RVCK-Project/rvck/actions/runs/29219284402

参数解析结果
args value
repository RVCK-Project/rvck
head ref pull/323/head
base ref rvck-6.6
LAVA repo RVCK-Project/lavaci
LAVA hardware ['qemu']
LAVA Testcase path lava-testcases/common-test/ltp/ltp.yaml
need run job kunit-test,kernel-build,check-patch,lava-trigger

测试完成

详细结果:
check result
kunit-test success
kernel-build success
check-patch success
lava-trigger-qemu success
lava-trigger-sg2042 skipped
lava-trigger-k1 skipped
lava-trigger-lpi4a skipped

Kunit Test Result

[02:24:24] Testing complete. Ran 482 tests: passed: 465, skipped: 17

Kernel Build Result

Check Patch Result

Total Errors 0
Total Warnings 23

LAVA Check (qemu)

args value
testcase_repo RVCK-Project/lavaci
lava_template lava-job-template/qemu/qemu-ltp.yaml
testcase_path lava-testcases/common-test/ltp/ltp.yaml
kernel_download_url http://10.30.190.110/openEuler-RISC-V/RVCK/OERV-RVCI/RVCK-Project/rvck/323_29219284402_1/Image
initramfs_download_url http://10.30.190.110/openEuler-RISC-V/RVCK/OERV-RVCI/RVCK-Project/rvck/323_29219284402_1/initramfs.img
rootfs_download_url https://fast-mirror.isrc.ac.cn/openeuler-sig-riscv/openEuler-RISC-V/RVCK/openEuler24.03-LTS-SP1/openeuler-rootfs.img.zst
testcase_ref main
testitem_name RVCK-Project_rvck_pull_request_target_323__common-test_qemu

result: Lava check done!

@github-actions

github-actions Bot commented Jul 13, 2026

Copy link
Copy Markdown

开始测试 log: https://github.com/RVCK-Project/rvck/actions/runs/29219711013

参数解析结果
args value
repository RVCK-Project/rvck
head ref pull/323/head
base ref rvck-6.6
LAVA repo RVCK-Project/lavaci
LAVA hardware ['qemu']
LAVA Testcase path lava-testcases/common-test/ltp/ltp.yaml
need run job kunit-test,kernel-build,check-patch,lava-trigger

测试完成

详细结果:
check result
kunit-test success
kernel-build success
check-patch success
lava-trigger-qemu success
lava-trigger-sg2042 skipped
lava-trigger-k1 skipped
lava-trigger-lpi4a skipped

Kunit Test Result

[02:36:40] Testing complete. Ran 482 tests: passed: 465, skipped: 17

Kernel Build Result

Check Patch Result

Total Errors 0
Total Warnings 23

LAVA Check (qemu)

args value
testcase_repo RVCK-Project/lavaci
lava_template lava-job-template/qemu/qemu-ltp.yaml
testcase_path lava-testcases/common-test/ltp/ltp.yaml
kernel_download_url http://10.30.190.110/openEuler-RISC-V/RVCK/OERV-RVCI/RVCK-Project/rvck/323_29219711013_1/Image
initramfs_download_url http://10.30.190.110/openEuler-RISC-V/RVCK/OERV-RVCI/RVCK-Project/rvck/323_29219711013_1/initramfs.img
rootfs_download_url https://fast-mirror.isrc.ac.cn/openeuler-sig-riscv/openEuler-RISC-V/RVCK/openEuler24.03-LTS-SP1/openeuler-rootfs.img.zst
testcase_ref main
testitem_name RVCK-Project_rvck_pull_request_target_323__common-test_qemu

result: Lava check done!

@unicornx unicornx left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3rd review:

还有两个小的问题请改一下,同时 rebase 一下,因为 rvck-6.6 分支升级了。

其他 LGTM。

我手上没有 K3 的板子,所以只是做了一下编译测试,请 @EncrowThorne19 自行测试确保功能没有问题,谢谢。

Reviewed-by: Chen Wang wangchen20@iscas.ac.cn

Comment thread drivers/phy/Makefile Outdated
xilinx/ \
synopsys/
synopsys/ \
spacemit/

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

添加项目时请遵守按照 alpha beta 字母表排序。

@@ -0,0 +1,3 @@
# SPDX-License-Identifier: GPL-2.0-only
obj-$(CONFIG_PHY_SPACEMIT_K3_USB3) += phy-k3-usb3.o
obj-$(CONFIG_PHY_SPACEMIT_K1_USB2) += phy-k1-usb2.o

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

字母表排序

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

再次感谢您的审核!已修改并重新提交,USB2.0 / 3.0 HOST 功能在 K3 开发板测试正常。

quic-bjorande and others added 5 commits July 14, 2026 17:53
mainline inclusion
from mainline-7.2-rc1
commit 613a2e6 ("usb: dwc3: core: Expose core driver as library")
category: feature
bugzilla: RVCK-Project#322

And the dwc3_properties structure and the
`ignore_clocks_and_resets` flag have been added
to glue.h so that generic glue can use them directly
without further modifications to the header file.

--------------------------------

The DWC3 IP block is handled by three distinct device drivers: XHCI,
DWC3 core and a platform specific (optional) DWC3 glue driver.

This has resulted in, at least in the case of the Qualcomm glue, the
presence of a number of layering violations, where the glue code either
can't handle, or has to work around, the fact that core might not probe
deterministically.

An example of this is that the suspend path should operate slightly
different depending on the device operating in host or peripheral mode,
and the only way to determine the operating state is to peek into the
core's drvdata.

The Qualcomm glue driver is expected to make updates in the qscratch
register region (the "glue" region) during role switch events, but with
the glue and core split using the driver model, there is no reasonable
way to introduce listeners for mode changes.

Split the dwc3 core platform_driver callbacks and their implementation
and export the implementation, to make it possible to deterministically
instantiate the dwc3 core as part of the dwc3 glue drivers and to
allow flattening of the DeviceTree representation.

Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8650-QRD
Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
Link: https://lore.kernel.org/r/20250414-dwc3-refactor-v7-3-f015b358722d@oss.qualcomm.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Yongchao Jia <yongchao.jia@spacemit.com>
mainline inclusion
from mainline-7.2-rc1
commit e0b6dc0 ("usb: dwc3: add generic driver to support flattened")
category: feature
bugzilla: RVCK-Project#322

The compatible string has been updated from "spacemit,k1-dwc3" to
"spacemit,k3-dwc3" to match the actual hardware platform being adapted.

--------------------------------

To 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`.

Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Signed-off-by: Ze Huang <huang.ze@linux.dev>
Link: https://lore.kernel.org/r/20250913-dwc3_generic-v8-2-b50f81f05f95@linux.dev
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Yongchao Jia <yongchao.jia@spacemit.com>
mainline inclusion
from mainline-7.2-rc1
commit fe4bc1a ("phy: spacemit: support K1 USB2.0 PHY controller")
category: feature
bugzilla: RVCK-Project#322

--------------------------------

The SpacemiT K1 SoC includes three USB ports:

- One USB2.0 OTG port
- One USB2.0 host-only port
- One USB3.0 port with an integrated USB2.0 DRD interface

Each of these ports is connected to a USB2.0 PHY responsible for USB2
transmission.

This commit adds support for the SpacemiT K1 USB2.0 PHY, which is
compliant with the USB 2.0 specification and supports both 8-bit 60MHz
and 16-bit 30MHz parallel interfaces.

Signed-off-by: Ze Huang <huang.ze@linux.dev>
Tested-by: Aurelien Jarno <aurelien@aurel32.net>
Tested-by: Junzhong Pan <panjunzhong@linux.spacemit.com>
Link: https://patch.msgid.link/20251017-k1-usb2phy-v6-2-7cf9ea2477a1@linux.dev
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Yongchao Jia <yongchao.jia@spacemit.com>
riscv inclusion
category: feature
bugzilla: RVCK-Project#322

--------------------------------

Add the SpacemiT K3 USB3 combo PHY driver.

On K3 the PCIe/USB subsystem provides three single-lane PIPE3 PHYs
(PHY2/3/4) shared between PCIe Port C/D and USB3 Port B/C/D. Lane
ownership is selected through the APMU PMUA_PCIE_SUBSYS_MGMT register:
the driver acquires the syscon-apmu regmap, disables PCIe-A x8 mode and
switches the requested lane to USB before bringing the PHY up, so USB3
operation is only possible when the conflicting PCIe x8 configuration
is not in use.

Bring-up performs R-calibration trim override (N/P trim) and PLL/PU
lock polling via the HSIO APB spare registers, and exposes the standard
generic-phy init/exit/power and set_speed operations for the xHCI/dwc3
stack. The driver also registers a Type-C orientation switch/mux so the
combo PHY can follow cable orientation on Type-C ports.

Signed-off-by: Yongchao Jia <yongchao.jia@spacemit.com>
riscv inclusion
category: feature
bugzilla: RVCK-Project#322

--------------------------------

Add the K3 USB3 controller and combo PHY nodes to k3.dtsi and enable
them on the com260 board, wiring up the usb3_portb controller, its
USB2/USB3 PHYs and the on-board VL817 hub.

Signed-off-by: Yongchao Jia <yongchao.jia@spacemit.com>
@github-actions

github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown

开始测试 log: https://github.com/RVCK-Project/rvck/actions/runs/29323523681

参数解析结果
args value
repository RVCK-Project/rvck
head ref pull/323/head
base ref rvck-6.6
LAVA repo RVCK-Project/lavaci
LAVA hardware ['qemu']
LAVA Testcase path lava-testcases/common-test/ltp/ltp.yaml
need run job kunit-test,kernel-build,check-patch,lava-trigger

测试完成

详细结果:
check result
kunit-test success
kernel-build success
check-patch success
lava-trigger-qemu success
lava-trigger-sg2042 skipped
lava-trigger-k1 skipped
lava-trigger-lpi4a skipped

Kunit Test Result

[10:00:47] Testing complete. Ran 482 tests: passed: 465, skipped: 17

Kernel Build Result

Check Patch Result

Total Errors 0
Total Warnings 23

LAVA Check (qemu)

args value
testcase_repo RVCK-Project/lavaci
lava_template lava-job-template/qemu/qemu-ltp.yaml
testcase_path lava-testcases/common-test/ltp/ltp.yaml
kernel_download_url http://10.30.190.110/openEuler-RISC-V/RVCK/OERV-RVCI/RVCK-Project/rvck/323_29323523681_1/Image
initramfs_download_url http://10.30.190.110/openEuler-RISC-V/RVCK/OERV-RVCI/RVCK-Project/rvck/323_29323523681_1/initramfs.img
rootfs_download_url https://fast-mirror.isrc.ac.cn/openeuler-sig-riscv/openEuler-RISC-V/RVCK/openEuler24.03-LTS-SP1/openeuler-rootfs.img.zst
testcase_ref main
testitem_name RVCK-Project_rvck_pull_request_target_323__common-test_qemu

result: Lava check done!

xmzzz pushed a commit to xmzzz/kernel-6.6 that referenced this pull request Jul 14, 2026
commit ef7f38d upstream.

Synthetic events currently do not have a function to register perf events.
This leads to calling the tracepoint register functions with a NULL
function pointer which triggers:

 ------------[ cut here ]------------
 WARNING: kernel/tracepoint.c:175 at tracepoint_add_func+0x357/0x370, CPU#2: perf/2272
 Modules linked in: kvm_intel kvm irqbypass
 CPU: 2 UID: 0 PID: 2272 Comm: perf Not tainted 6.18.0-ftest-11964-ge022764176fc-dirty RVCK-Project#323 PREEMPTLAZY
 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.17.0-debian-1.17.0-1 04/01/2014
 RIP: 0010:tracepoint_add_func+0x357/0x370
 Code: 28 9c e8 4c 0b f5 ff eb 0f 4c 89 f7 48 c7 c6 80 4d 28 9c e8 ab 89 f4 ff 31 c0 5b 41 5c 41 5d 41 5e 41 5f 5d c3 cc cc cc cc cc <0f> 0b 49 c7 c6 ea ff ff ff e9 ee fe ff ff 0f 0b e9 f9 fe ff ff 0f
 RSP: 0018:ffffabc0c44d3c40 EFLAGS: 00010246
 RAX: 0000000000000001 RBX: ffff9380aa9e4060 RCX: 0000000000000000
 RDX: 000000000000000a RSI: ffffffff9e1d4a98 RDI: ffff937fcf5fd6c8
 RBP: 0000000000000001 R08: 0000000000000007 R09: ffff937fcf5fc780
 R10: 0000000000000003 R11: ffffffff9c193910 R12: 000000000000000a
 R13: ffffffff9e1e5888 R14: 0000000000000000 R15: ffffabc0c44d3c78
 FS:  00007f6202f5f340(0000) GS:ffff93819f00f000(0000) knlGS:0000000000000000
 CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
 CR2: 000055d3162281a8 CR3: 0000000106a56003 CR4: 0000000000172ef0
 Call Trace:
  <TASK>
  tracepoint_probe_register+0x5d/0x90
  synth_event_reg+0x3c/0x60
  perf_trace_event_init+0x204/0x340
  perf_trace_init+0x85/0xd0
  perf_tp_event_init+0x2e/0x50
  perf_try_init_event+0x6f/0x230
  ? perf_event_alloc+0x4bb/0xdc0
  perf_event_alloc+0x65a/0xdc0
  __se_sys_perf_event_open+0x290/0x9f0
  do_syscall_64+0x93/0x7b0
  ? entry_SYSCALL_64_after_hwframe+0x76/0x7e
  ? trace_hardirqs_off+0x53/0xc0
  entry_SYSCALL_64_after_hwframe+0x76/0x7e

Instead, have the code return -ENODEV, which doesn't warn and has perf
error out with:

 # perf record -e synthetic:futex_wait
Error:
The sys_perf_event_open() syscall returned with 19 (No such device) for event (synthetic:futex_wait).
"dmesg | grep -i perf" may provide additional information.

Ideally perf should support synthetic events, but for now just fix the
warning. The support can come later.

Cc: stable@vger.kernel.org
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://patch.msgid.link/20251216182440.147e4453@gandalf.local.home
Fixes: 4b14793 ("tracing: Add support for 'synthetic' events")
Reported-by: Ian Rogers <irogers@google.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

USB: Support for SpacemiT K3 USB3.0 Host

6 participants