[PATCH 3/9] phy: broadcom: ns-usb3: Coordinate NSP USB2 and USB3 initialization
From: Florian Fainelli
Date: Wed Oct 21 2026 - 13:30:51 EST
The iProc SDK holds both USB2 and USB3 cores in reset while programming
the USB3 PLL, then releases USB2 before USB3. It also enables the USB2
IDM interface clock. The Northstar Bx initialization used by NSP does
not perform the USB2 setup or retain the SDK settling intervals.
Implement an NSP variant with the coordinated reset sequence and
interface clock enable. Sharing one PHY between the HCDs lets the PHY
core serialize and reference-count initialization, preventing a later
host probe from resetting an already active USB2 controller.
Retain the downstream delays around reset and MDIO operations, and
leave both NSP cores reset if programming fails. Keep existing
Northstar Ax and Bx reset behavior unchanged.
Signed-off-by: Florian Fainelli <florian.fainelli@xxxxxxxxxxxx>
---
drivers/phy/broadcom/phy-bcm-ns-usb3.c | 55 ++++++++++++++++++++++++++
1 file changed, 55 insertions(+)
diff --git a/drivers/phy/broadcom/phy-bcm-ns-usb3.c b/drivers/phy/broadcom/phy-bcm-ns-usb3.c
index b40033144080..b3b5b74ead09 100644
--- a/drivers/phy/broadcom/phy-bcm-ns-usb3.c
+++ b/drivers/phy/broadcom/phy-bcm-ns-usb3.c
@@ -44,12 +44,14 @@ enum bcm_ns_family {
BCM_NS_UNKNOWN,
BCM_NS_AX,
BCM_NS_BX,
+ BCM_NSP,
};
struct bcm_ns_usb3 {
struct device *dev;
enum bcm_ns_family family;
void __iomem *dmp;
+ void __iomem *usb2_dmp;
struct mdio_device *mdiodev;
struct phy *phy;
};
@@ -63,6 +65,10 @@ static const struct of_device_id bcm_ns_usb3_id_table[] = {
.compatible = "brcm,ns-bx-usb3-phy",
.data = (int *)BCM_NS_BX,
},
+ {
+ .compatible = "brcm,nsp-usb3-phy",
+ .data = (void *)BCM_NSP,
+ },
{},
};
MODULE_DEVICE_TABLE(of, bcm_ns_usb3_id_table);
@@ -86,6 +92,9 @@ static int bcm_ns_usb3_write_seq(struct bcm_ns_usb3 *usb3,
err = bcm_ns_usb3_mdio_phy_write(usb3, seq[i].reg, seq[i].value);
if (err)
return err;
+
+ if (usb3->family == BCM_NSP)
+ usleep_range(10000, 20000);
}
return 0;
@@ -121,8 +130,18 @@ static int bcm_ns_usb3_phy_init_ns_bx(struct bcm_ns_usb3 *usb3)
if (err)
return err;
+ if (usb3->usb2_dmp) {
+ writel(0, usb3->usb2_dmp + BCMA_RESET_CTL);
+ readl(usb3->usb2_dmp + BCMA_RESET_CTL);
+ usleep_range(10000, 20000);
+ }
+
/* Deasserting USB3 system reset */
writel(0, usb3->dmp + BCMA_RESET_CTL);
+ if (usb3->family == BCM_NSP) {
+ readl(usb3->dmp + BCMA_RESET_CTL);
+ usleep_range(10000, 20000);
+ }
return bcm_ns_usb3_write_seq(usb3, phy_seq, ARRAY_SIZE(phy_seq));
}
@@ -160,16 +179,35 @@ static int bcm_ns_usb3_phy_init_ns_ax(struct bcm_ns_usb3 *usb3)
static int bcm_ns_usb3_phy_init(struct phy *phy)
{
struct bcm_ns_usb3 *usb3 = phy_get_drvdata(phy);
+ u32 val;
int err;
+ /*
+ * NSP requires both hosts to remain in reset while programming the PLL.
+ * Sharing this PHY between all three HCDs makes the PHY core serialize
+ * and reference-count this sequence, regardless of their probe order.
+ */
+ if (usb3->usb2_dmp) {
+ val = readl(usb3->usb2_dmp + BCMA_IOCTL);
+ writel(val | BCMA_IOCTL_CLK, usb3->usb2_dmp + BCMA_IOCTL);
+ writel(BCMA_RESET_CTL_RESET, usb3->usb2_dmp + BCMA_RESET_CTL);
+ readl(usb3->usb2_dmp + BCMA_RESET_CTL);
+ usleep_range(10000, 20000);
+ }
+
/* Perform USB3 system soft reset */
writel(BCMA_RESET_CTL_RESET, usb3->dmp + BCMA_RESET_CTL);
+ if (usb3->family == BCM_NSP) {
+ readl(usb3->dmp + BCMA_RESET_CTL);
+ usleep_range(10000, 20000);
+ }
switch (usb3->family) {
case BCM_NS_AX:
err = bcm_ns_usb3_phy_init_ns_ax(usb3);
break;
case BCM_NS_BX:
+ case BCM_NSP:
err = bcm_ns_usb3_phy_init_ns_bx(usb3);
break;
default:
@@ -177,6 +215,11 @@ static int bcm_ns_usb3_phy_init(struct phy *phy)
err = -ENOTSUPP;
}
+ if (err && usb3->usb2_dmp) {
+ writel(BCMA_RESET_CTL_RESET, usb3->usb2_dmp + BCMA_RESET_CTL);
+ writel(BCMA_RESET_CTL_RESET, usb3->dmp + BCMA_RESET_CTL);
+ }
+
return err;
}
@@ -225,6 +268,18 @@ static int bcm_ns_usb3_mdio_probe(struct mdio_device *mdiodev)
if (IS_ERR(usb3->dmp))
return PTR_ERR(usb3->dmp);
+ if (usb3->family == BCM_NSP) {
+ syscon_np = of_parse_phandle(dev->of_node, "usb2-dmp-syscon", 0);
+ err = of_address_to_resource(syscon_np, 0, &res);
+ of_node_put(syscon_np);
+ if (err)
+ return err;
+
+ usb3->usb2_dmp = devm_ioremap_resource(dev, &res);
+ if (IS_ERR(usb3->usb2_dmp))
+ return PTR_ERR(usb3->usb2_dmp);
+ }
+
usb3->phy = devm_phy_create(dev, NULL, &ops);
if (IS_ERR(usb3->phy)) {
dev_err(dev, "Failed to create PHY\n");
--
2.53.0