Skip to contentSkip to conversation

phy: spacemit: enable K1 USB 2.0 PHY by default on ARCH_SPACEMIT

PATCH In review Bruno Banelli 3 participants 3 messages Aug 25

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 phy: spacemit: enable K1 USB 2.0 PHY by default on ARCH_SPACEMIT

PHY_SPACEMIT_K1_PCIE has "default ARCH_SPACEMIT", but PHY_SPACEMIT_K1_USB2, twelve lines below it in the same file, does not. Since the symbol is also absent from arch/riscv/configs/defconfig, a plain "make defconfig" build for a SpacemiT K1 board ends up with the USB 2.0 PHY driver disabled.

dwc3-generic-plat needs that PHY, so the result is a kernel with no working USB at all on boards such as the Milk-V Jupiter, where all four USB 3.0 type-A ports hang off the single dwc3 controller.

Give it the same default as its sibling.

---
 drivers/phy/spacemit/Kconfig | 1 +
 1 file changed, 1 insertion(+)
drivers/phy/spacemit/Kconfig +1 -0
index 5fdf18fce..dd74a3faf 100644
@@ -20,6 +20,7 @@ config PHY_SPACEMIT_K1_USB2
 	depends on COMMON_CLK
 	depends on USB_COMMON
 	select GENERIC_PHY
+	default ARCH_SPACEMIT
 	help
 	  Enable this to support K1 USB 2.0 PHY driver. This driver takes care of
 	  enabling and clock setup and will be used by K1 udc/ehci/otg/xhci driver.

base-commit: 66498c75b4f8017f62d720d9b59675bdf3abce91

Signature · 1 line
2.43.0
#1 lore raw
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:

Pre-existing issues:
- [High] Missing select REGMAP_MMIO in PHY_SPACEMIT_K1_USB2 Kconfig entry.
- [Medium] Missing depends on HAS_IOMEM in PHY_SPACEMIT_K1_USB2 Kconfig entry. --

--- Patch [1]: [PATCH] phy: spacemit: enable K1 USB 2.0 PHY by default on ARCH_SPACEMIT --- commit f756c3cf5b8ff136e8d286e16f1e25289aa9e095
Author: Bruno Banelli <[email protected]>

phy: spacemit: enable K1 USB 2.0 PHY by default on ARCH_SPACEMIT

This patch adds a default ARCH_SPACEMIT configuration for the K1 USB 2.0 PHY driver. This matches the PCIe PHY configuration and ensures the USB driver is enabled by default on SpacemiT K1 boards.

drivers/phy/spacemit/Kconfig config PHY_SPACEMIT_K1_USB2 · line 22

Quoted 8 lines
drivers/phy/spacemit/Kconfig +0 -0
index 5fdf18fce4995..dd74a3faf01fd 100644
@@ -20,6 +20,7 @@ config PHY_SPACEMIT_K1_USB2
 	depends on COMMON_CLK
 	depends on USB_COMMON
 	select GENERIC_PHY

[Severity: High]
This is a pre-existing issue, but does this config entry need to select REGMAP_MMIO?

If a randconfig build has PHY_SPACEMIT_K1_USB2 enabled and CONFIG_REGMAP enabled, but CONFIG_REGMAP_MMIO is disabled, would this result in a linkage error? The driver uses devm_regmap_init_mmio() during probe:

drivers/phy/spacemit/phy-k1-usb2.c:spacemit_usb2phy_probe() {
    ...
    sphy->regmap_base = devm_regmap_init_mmio(dev, base, &phy_regmap_config);
    ...
}

[Severity: Medium]
This is also a pre-existing issue, but should this config depend on HAS_IOMEM?

The driver maps I/O memory during probe:

drivers/phy/spacemit/phy-k1-usb2.c:spacemit_usb2phy_probe() {
    ...
    base = devm_platform_ioremap_resource(pdev, 0);
    ...
}

Could this cause build or runtime failures on architectures lacking I/O memory support (such as UML) when COMPILE_TEST is enabled?

Quoted 4 lines
drivers/phy/spacemit/Kconfig +1 -0
+	default ARCH_SPACEMIT
 	help
 	  Enable this to support K1 USB 2.0 PHY driver. This driver takes care of
 	  enabling and clock setup and will be used by K1 udc/ehci/otg/xhci driver.
Signature · 6 lines
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1

-- 
linux-phy mailing list
[email protected]
https://lists.infradead.org/mailman/listinfo/linux-phy
maintainer Reviewed-by on v1 1/1
#2 lore raw
In reply to Bruno Banelli

Hi Bruno,

Quoted 6 lines · Bruno Banelli

PHY_SPACEMIT_K1_PCIE has "default ARCH_SPACEMIT", but PHY_SPACEMIT_K1_USB2, twelve lines below it in the same file, does not. Since the symbol is also absent from arch/riscv/configs/defconfig, a plain "make defconfig" build for a SpacemiT K1 board ends up with the USB 2.0 PHY driver disabled.

Quoted 7 lines

dwc3-generic-plat needs that PHY, so the result is a kernel with no working USB at all on boards such as the Milk-V Jupiter, where all four USB 3.0 type-A ports hang off the single dwc3 controller.

Give it the same default as its sibling.

Looks good to me

Signature · 1 line
Yixun Lan (dlan)