Linux-PHY Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] phy: marvell: comphy: use PHY_MODE_USB_HOST/DEVICE instead of _SS variants
@ 2026-12-05 21:48 Krishna Kurapati
  2026-12-05 22:01 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Krishna Kurapati @ 2026-12-05 21:48 UTC (permalink / raw)
  To: Miquel Raynal, Vinod Koul, Neil Armstrong, Manivannan Sadhasivam
  Cc: linux-phy, linux-kernel, Krishna Kurapati

Both the A3700 and CP110 comphy drivers used PHY_MODE_USB_HOST_SS and
PHY_MODE_USB_DEVICE_SS in their lane configuration tables and dispatch
switches. These _SS (SuperSpeed) variants were used purely as structural
markers meaning 'this comphy lane carries USB3', but the USB3-vs-USB2
distinction is already conveyed through a separate mechanism in each
driver:

  - CP110: the firmware mode field (COMPHY_FW_MODE_USB3H /
    COMPHY_FW_MODE_USB3D) in the same configuration table row tells
    firmware the lane is USB3.
  - A3700: the lane hardware is inherently USB3; USB2 is handled by a
    separate UTMI PHY driver.

The USB controllers on these platforms are XHCI-based (marvell,armada-
3700-xhci / marvell,armada-8k-xhci / generic-xhci). The generic HCD layer
in usb_add_hcd() (drivers/usb/core/hcd.c) first attempts phy_set_mode
(PHY_MODE_USB_HOST_SS), and if that fails it falls back to phy_set_mode
(PHY_MODE_USB_HOST).  After this change the _SS call returns -EINVAL and
the fallback to PHY_MODE_USB_HOST succeeds, so there is no functional
regression.

PHY_MODE_USB_DEVICE_SS was never called by any upstream consumer for
these PHYs: the XHCI host controller only sets host-mode, and there is
no gadget/device-mode caller that uses the comphy _SS variant.

As a prerequisite to removing the eight speed-suffixed enum phy modes:
PHY_MODE_USB_{HOST,DEVICE}_{LS,FS,HS,SS} in favour of communicating link
speed through phy_configure(), remove the dead _SS arms here.

Signed-off-by: Krishna Kurapati <krishna.kurapati@oss.qualcomm.com>
---
I don't have a device to test this change. Hence compile testing with
W=1 now. This is a pre-requisite patch to remove the dead suffix enums.
The effort being put now is to remove the speed suffixed enums and replace
them with phy_configure API to let consumer drivers set usb phy opts along
with phy_set_mode call being done here. If the maintainers decide that
this change is not dead code removal and _SS enum is intended in the code,
although no one sets in the tree currently, then phy_configure can be done
from consumer drivers.
---
 drivers/phy/marvell/phy-mvebu-a3700-comphy.c |  8 ++++----
 drivers/phy/marvell/phy-mvebu-cp110-comphy.c | 16 ++++++++--------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/phy/marvell/phy-mvebu-a3700-comphy.c b/drivers/phy/marvell/phy-mvebu-a3700-comphy.c
index d19f0fa9ba7c..96bbe6acf854 100644
--- a/drivers/phy/marvell/phy-mvebu-a3700-comphy.c
+++ b/drivers/phy/marvell/phy-mvebu-a3700-comphy.c
@@ -244,7 +244,7 @@ struct mvebu_a3700_comphy_conf {
 
 static const struct mvebu_a3700_comphy_conf mvebu_a3700_comphy_modes[] = {
 	/* lane 0 */
-	MVEBU_A3700_COMPHY_CONF_GEN(0, PHY_MODE_USB_HOST_SS),
+	MVEBU_A3700_COMPHY_CONF_GEN(0, PHY_MODE_USB_HOST),
 	MVEBU_A3700_COMPHY_CONF_ETH(0, PHY_INTERFACE_MODE_SGMII),
 	MVEBU_A3700_COMPHY_CONF_ETH(0, PHY_INTERFACE_MODE_1000BASEX),
 	MVEBU_A3700_COMPHY_CONF_ETH(0, PHY_INTERFACE_MODE_2500BASEX),
@@ -255,7 +255,7 @@ static const struct mvebu_a3700_comphy_conf mvebu_a3700_comphy_modes[] = {
 	MVEBU_A3700_COMPHY_CONF_ETH(1, PHY_INTERFACE_MODE_2500BASEX),
 	/* lane 2 */
 	MVEBU_A3700_COMPHY_CONF_GEN(2, PHY_MODE_SATA),
-	MVEBU_A3700_COMPHY_CONF_GEN(2, PHY_MODE_USB_HOST_SS),
+	MVEBU_A3700_COMPHY_CONF_GEN(2, PHY_MODE_USB_HOST),
 };
 
 struct mvebu_a3700_comphy_priv {
@@ -488,7 +488,7 @@ mvebu_a3700_comphy_set_phy_selector(struct mvebu_a3700_comphy_lane *lane)
 			goto error;
 		break;
 
-	case PHY_MODE_USB_HOST_SS:
+	case PHY_MODE_USB_HOST:
 		if (lane->id == 2)
 			set = COMPHY_SELECTOR_USB3_PHY_SEL_BIT;
 		else if (lane->id == 0)
@@ -1165,7 +1165,7 @@ static int mvebu_a3700_comphy_power_on(struct phy *phy)
 	}
 
 	switch (lane->mode) {
-	case PHY_MODE_USB_HOST_SS:
+	case PHY_MODE_USB_HOST:
 		dev_dbg(lane->dev, "set lane %d to USB3 host mode\n", lane->id);
 		return mvebu_a3700_comphy_usb3_power_on(lane);
 	case PHY_MODE_SATA:
diff --git a/drivers/phy/marvell/phy-mvebu-cp110-comphy.c b/drivers/phy/marvell/phy-mvebu-cp110-comphy.c
index 71f9c14fb50d..401644baeac3 100644
--- a/drivers/phy/marvell/phy-mvebu-cp110-comphy.c
+++ b/drivers/phy/marvell/phy-mvebu-cp110-comphy.c
@@ -212,8 +212,8 @@ static const struct mvebu_comphy_conf mvebu_comphy_cp110_modes[] = {
 	ETH_CONF(0, 1, PHY_INTERFACE_MODE_2500BASEX, 0x1, COMPHY_FW_MODE_2500BASEX),
 	GEN_CONF(0, 1, PHY_MODE_SATA, COMPHY_FW_MODE_SATA),
 	/* lane 1 */
-	GEN_CONF(1, 0, PHY_MODE_USB_HOST_SS, COMPHY_FW_MODE_USB3H),
-	GEN_CONF(1, 0, PHY_MODE_USB_DEVICE_SS, COMPHY_FW_MODE_USB3D),
+	GEN_CONF(1, 0, PHY_MODE_USB_HOST, COMPHY_FW_MODE_USB3H),
+	GEN_CONF(1, 0, PHY_MODE_USB_DEVICE, COMPHY_FW_MODE_USB3D),
 	GEN_CONF(1, 0, PHY_MODE_SATA, COMPHY_FW_MODE_SATA),
 	GEN_CONF(1, 0, PHY_MODE_PCIE, COMPHY_FW_MODE_PCIE),
 	ETH_CONF(1, 2, PHY_INTERFACE_MODE_SGMII, 0x1, COMPHY_FW_MODE_SGMII),
@@ -224,7 +224,7 @@ static const struct mvebu_comphy_conf mvebu_comphy_cp110_modes[] = {
 	ETH_CONF(2, 0, PHY_INTERFACE_MODE_RXAUI, 0x1, COMPHY_FW_MODE_RXAUI),
 	ETH_CONF(2, 0, PHY_INTERFACE_MODE_5GBASER, 0x1, COMPHY_FW_MODE_XFI),
 	ETH_CONF(2, 0, PHY_INTERFACE_MODE_10GBASER, 0x1, COMPHY_FW_MODE_XFI),
-	GEN_CONF(2, 0, PHY_MODE_USB_HOST_SS, COMPHY_FW_MODE_USB3H),
+	GEN_CONF(2, 0, PHY_MODE_USB_HOST, COMPHY_FW_MODE_USB3H),
 	GEN_CONF(2, 0, PHY_MODE_SATA, COMPHY_FW_MODE_SATA),
 	GEN_CONF(2, 0, PHY_MODE_PCIE, COMPHY_FW_MODE_PCIE),
 	/* lane 3 */
@@ -232,7 +232,7 @@ static const struct mvebu_comphy_conf mvebu_comphy_cp110_modes[] = {
 	ETH_CONF(3, 1, PHY_INTERFACE_MODE_SGMII, 0x2, COMPHY_FW_MODE_SGMII),
 	ETH_CONF(3, 1, PHY_INTERFACE_MODE_2500BASEX, 0x2, COMPHY_FW_MODE_2500BASEX),
 	ETH_CONF(3, 1, PHY_INTERFACE_MODE_RXAUI, 0x1, COMPHY_FW_MODE_RXAUI),
-	GEN_CONF(3, 1, PHY_MODE_USB_HOST_SS, COMPHY_FW_MODE_USB3H),
+	GEN_CONF(3, 1, PHY_MODE_USB_HOST, COMPHY_FW_MODE_USB3H),
 	GEN_CONF(3, 1, PHY_MODE_SATA, COMPHY_FW_MODE_SATA),
 	/* lane 4 */
 	ETH_CONF(4, 0, PHY_INTERFACE_MODE_SGMII, 0x2, COMPHY_FW_MODE_SGMII),
@@ -240,8 +240,8 @@ static const struct mvebu_comphy_conf mvebu_comphy_cp110_modes[] = {
 	ETH_CONF(4, 0, PHY_INTERFACE_MODE_5GBASER, 0x2, COMPHY_FW_MODE_XFI),
 	ETH_CONF(4, 0, PHY_INTERFACE_MODE_10GBASER, 0x2, COMPHY_FW_MODE_XFI),
 	ETH_CONF(4, 0, PHY_INTERFACE_MODE_RXAUI, 0x2, COMPHY_FW_MODE_RXAUI),
-	GEN_CONF(4, 0, PHY_MODE_USB_DEVICE_SS, COMPHY_FW_MODE_USB3D),
-	GEN_CONF(4, 1, PHY_MODE_USB_HOST_SS, COMPHY_FW_MODE_USB3H),
+	GEN_CONF(4, 0, PHY_MODE_USB_DEVICE, COMPHY_FW_MODE_USB3D),
+	GEN_CONF(4, 1, PHY_MODE_USB_HOST, COMPHY_FW_MODE_USB3H),
 	GEN_CONF(4, 1, PHY_MODE_PCIE, COMPHY_FW_MODE_PCIE),
 	ETH_CONF(4, 1, PHY_INTERFACE_MODE_SGMII, 0x1, COMPHY_FW_MODE_SGMII),
 	ETH_CONF(4, 1, PHY_INTERFACE_MODE_2500BASEX, 0x1, COMPHY_FW_MODE_2500BASEX),
@@ -812,8 +812,8 @@ static int mvebu_comphy_power_on(struct phy *phy)
 		}
 		fw_param = COMPHY_FW_PARAM_ETH(fw_mode, lane->port, fw_speed);
 		break;
-	case PHY_MODE_USB_HOST_SS:
-	case PHY_MODE_USB_DEVICE_SS:
+	case PHY_MODE_USB_HOST:
+	case PHY_MODE_USB_DEVICE:
 		dev_dbg(priv->dev, "set lane %d to USB3 mode\n", lane->id);
 		fw_param = COMPHY_FW_PARAM(fw_mode, lane->port);
 		break;

---
base-commit: 495f98f8dc61da7c5d9ad11ac7d07ee2cd2154cc
change-id: 20261206-marvell-comphy-phy-modify-73f4fb09c75b

Best regards,
--  
Krishna Kurapati <krishna.kurapati@oss.qualcomm.com>


-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-12-05 22:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-05 21:48 [PATCH] phy: marvell: comphy: use PHY_MODE_USB_HOST/DEVICE instead of _SS variants Krishna Kurapati
2026-12-05 22:01 ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox