* [PATCH v5 0/2] Add support for SA8255P in the phy-qcom-snps-femto-v2 phy driver
@ 2026-11-20 13:56 ` Mattijs Korpershoek
0 siblings, 0 replies; 10+ messages in thread
From: Mattijs Korpershoek @ 2026-11-20 13:56 UTC (permalink / raw)
To: Vinod Koul, Neil Armstrong, Manivannan Sadhasivam, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Mattijs Korpershoek,
Philipp Zabel
Cc: linux-arm-msm, linux-phy, devicetree, linux-kernel,
Krzysztof Kozlowski, Manivannan Sadhasivam, Sriram Dash
The Qualcomm automotive SA8255p SoC abstracts resources such as resets,
clocks and regulators in firmware. The SCMI firmware exposes multiple
protocols to control such resources which are identified by protocol_id.
For this USB phy, 2 SCMI protocols are exposed by the firmware:
* power domain management protocol (protocol_id=0x11)
* performance domain management protocol (protocol_id=0x13)
The power domain has 2 indices: 'core' and 'transfer'.
* core controls the regulators, the clocks and the reset
* transfer only controls the clocks
For example, to power on/off the PHY, we should use the 'core' domain.
To disable data transfer and keeping power enabled, we should use the
'transfer' domain.
Note: the performance domain (0x13) exposes opaques values (0xa to 0x11)
for which we don't have any information. Since it is not mandatory
for the PHY to be functional, we have omitted it from the bindings and
the driver.
Patch 1 adds the binding for sa8255p. Similarly to what has been done
for I2C [1], this is a separate binding.
Patch 2 adds the driver change, which is based on a public vendor
patch from qualcomm [2].
I did the following changes on top of that:
* Use devm_add_action_or_reset() for dev_pm_domain_detach_list() instead
of implementing a driver .remove()
* Changed power domain names to drop 'usb_' prefix
* Fixed various error handling paths
* Added suspend/resume support
This has been tested on next-20261026 with a Ride4 SA8775P board that
has SCMI firmware (which is compatible).
[1] https://lore.kernel.org/all/20260617-enable-i2c-on-sa8255p-v7-1-ad736dbeab57@oss.qualcomm.com/
[2] https://git.codelinaro.org/clo/le/meta-qti-auto-kernel/-/blob/LY.AU.0.1.0.r1-16800-gen4meta.0/recipes-kernel/linux/files/usb/0014-PENDING-phy-qcom-snps-femto-v2-Add-support-for-SA825.patch
---
Changes in v5:
- Rebased on phy/next (non trivial conflicts due to IPQ9650 changes)
- Moved fw_managed to phy_config_data
- I have kept Mani's R-b on this since the patch still has similar
changes to v4.
- Link to v4: https://patch.msgid.link/20261027-phy-qcom-snps-femto-v2-8255-v4-0-874023825a63@kernel.org
Changes in v4:
- Don't control regulator, clk and reset in SCMI path (Mani)
- Rename helper functions to qcom_snps_pds_{enable,disable}_all and
qcom_snps_pd_{enable,disable}_transfer (Mani)
- Add some more helper functions to keep probe() cleaner.
- Dropped Neil's R-b due to the above driver changes
- Link to v3: https://lore.kernel.org/r/20261002-phy-qcom-snps-femto-v2-8255-v3-0-342542bd9bc6@kernel.org
Changes in v3:
- Applied R-b from Krzysztof and Neil
- Link to v2: https://patch.msgid.link/20260831-phy-qcom-snps-femto-v2-8255-v2-0-dc6197ffde1b@kernel.org
Changes in v2:
- Move 'core' as first domain, before 'transfer' (Krzysztof)
- Reworded binding commit message to be more precise about the various
domains ('core', 'transfer' and 'perf') (Krzysztof)
- Link to v1: https://patch.msgid.link/20260730-phy-qcom-snps-femto-v2-8255-v1-0-8b8bf5105a68@kernel.org
To: Vinod Koul <vkoul@kernel.org>
To: Neil Armstrong <neil.armstrong@linaro.org>
To: Manivannan Sadhasivam <mani@kernel.org>
To: Rob Herring <robh@kernel.org>
To: Krzysztof Kozlowski <krzk+dt@kernel.org>
To: Conor Dooley <conor+dt@kernel.org>
To: Mattijs Korpershoek <mkorpershoek@kernel.org>
To: Philipp Zabel <p.zabel@pengutronix.de>
Cc: linux-arm-msm@vger.kernel.org
Cc: linux-phy@lists.infradead.org
Cc: devicetree@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
Mattijs Korpershoek (1):
dt-bindings: phy: Add sa8255p high-speed USB PHY
Sriram Dash (1):
phy: qcom-snps-femto-v2: Add support for SA8255P
.../bindings/phy/qcom,sa8255p-usb-hs-phy.yaml | 52 ++++
drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c | 261 +++++++++++++++++----
2 files changed, 270 insertions(+), 43 deletions(-)
---
base-commit: 6bdfbe223ed4735073c299a6645ebd3faac3f51f
base-tree: git://git.kernel.org/pub/scm/linux/kernel/git/phy/linux-phy.git next
change-id: 20260729-phy-qcom-snps-femto-v2-8255-90ffe7674001
Best regards,
--
Mattijs Korpershoek <mkorpershoek@kernel.org>
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v5 0/2] Add support for SA8255P in the phy-qcom-snps-femto-v2 phy driver
@ 2026-11-20 13:56 ` Mattijs Korpershoek
0 siblings, 0 replies; 10+ messages in thread
From: Mattijs Korpershoek @ 2026-11-20 13:56 UTC (permalink / raw)
To: Vinod Koul, Neil Armstrong, Manivannan Sadhasivam, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Mattijs Korpershoek,
Philipp Zabel
Cc: linux-arm-msm, linux-phy, devicetree, linux-kernel,
Krzysztof Kozlowski, Manivannan Sadhasivam, Sriram Dash
The Qualcomm automotive SA8255p SoC abstracts resources such as resets,
clocks and regulators in firmware. The SCMI firmware exposes multiple
protocols to control such resources which are identified by protocol_id.
For this USB phy, 2 SCMI protocols are exposed by the firmware:
* power domain management protocol (protocol_id=0x11)
* performance domain management protocol (protocol_id=0x13)
The power domain has 2 indices: 'core' and 'transfer'.
* core controls the regulators, the clocks and the reset
* transfer only controls the clocks
For example, to power on/off the PHY, we should use the 'core' domain.
To disable data transfer and keeping power enabled, we should use the
'transfer' domain.
Note: the performance domain (0x13) exposes opaques values (0xa to 0x11)
for which we don't have any information. Since it is not mandatory
for the PHY to be functional, we have omitted it from the bindings and
the driver.
Patch 1 adds the binding for sa8255p. Similarly to what has been done
for I2C [1], this is a separate binding.
Patch 2 adds the driver change, which is based on a public vendor
patch from qualcomm [2].
I did the following changes on top of that:
* Use devm_add_action_or_reset() for dev_pm_domain_detach_list() instead
of implementing a driver .remove()
* Changed power domain names to drop 'usb_' prefix
* Fixed various error handling paths
* Added suspend/resume support
This has been tested on next-20261026 with a Ride4 SA8775P board that
has SCMI firmware (which is compatible).
[1] https://lore.kernel.org/all/20260617-enable-i2c-on-sa8255p-v7-1-ad736dbeab57@oss.qualcomm.com/
[2] https://git.codelinaro.org/clo/le/meta-qti-auto-kernel/-/blob/LY.AU.0.1.0.r1-16800-gen4meta.0/recipes-kernel/linux/files/usb/0014-PENDING-phy-qcom-snps-femto-v2-Add-support-for-SA825.patch
---
Changes in v5:
- Rebased on phy/next (non trivial conflicts due to IPQ9650 changes)
- Moved fw_managed to phy_config_data
- I have kept Mani's R-b on this since the patch still has similar
changes to v4.
- Link to v4: https://patch.msgid.link/20261027-phy-qcom-snps-femto-v2-8255-v4-0-874023825a63@kernel.org
Changes in v4:
- Don't control regulator, clk and reset in SCMI path (Mani)
- Rename helper functions to qcom_snps_pds_{enable,disable}_all and
qcom_snps_pd_{enable,disable}_transfer (Mani)
- Add some more helper functions to keep probe() cleaner.
- Dropped Neil's R-b due to the above driver changes
- Link to v3: https://lore.kernel.org/r/20261002-phy-qcom-snps-femto-v2-8255-v3-0-342542bd9bc6@kernel.org
Changes in v3:
- Applied R-b from Krzysztof and Neil
- Link to v2: https://patch.msgid.link/20260831-phy-qcom-snps-femto-v2-8255-v2-0-dc6197ffde1b@kernel.org
Changes in v2:
- Move 'core' as first domain, before 'transfer' (Krzysztof)
- Reworded binding commit message to be more precise about the various
domains ('core', 'transfer' and 'perf') (Krzysztof)
- Link to v1: https://patch.msgid.link/20260730-phy-qcom-snps-femto-v2-8255-v1-0-8b8bf5105a68@kernel.org
To: Vinod Koul <vkoul@kernel.org>
To: Neil Armstrong <neil.armstrong@linaro.org>
To: Manivannan Sadhasivam <mani@kernel.org>
To: Rob Herring <robh@kernel.org>
To: Krzysztof Kozlowski <krzk+dt@kernel.org>
To: Conor Dooley <conor+dt@kernel.org>
To: Mattijs Korpershoek <mkorpershoek@kernel.org>
To: Philipp Zabel <p.zabel@pengutronix.de>
Cc: linux-arm-msm@vger.kernel.org
Cc: linux-phy@lists.infradead.org
Cc: devicetree@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
Mattijs Korpershoek (1):
dt-bindings: phy: Add sa8255p high-speed USB PHY
Sriram Dash (1):
phy: qcom-snps-femto-v2: Add support for SA8255P
.../bindings/phy/qcom,sa8255p-usb-hs-phy.yaml | 52 ++++
drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c | 261 +++++++++++++++++----
2 files changed, 270 insertions(+), 43 deletions(-)
---
base-commit: 6bdfbe223ed4735073c299a6645ebd3faac3f51f
base-tree: git://git.kernel.org/pub/scm/linux/kernel/git/phy/linux-phy.git next
change-id: 20260729-phy-qcom-snps-femto-v2-8255-90ffe7674001
Best regards,
--
Mattijs Korpershoek <mkorpershoek@kernel.org>
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v5 1/2] dt-bindings: phy: Add sa8255p high-speed USB PHY
2026-11-20 13:56 ` Mattijs Korpershoek
@ 2026-11-20 13:56 ` Mattijs Korpershoek
-1 siblings, 0 replies; 10+ messages in thread
From: Mattijs Korpershoek @ 2026-11-20 13:56 UTC (permalink / raw)
To: Vinod Koul, Neil Armstrong, Manivannan Sadhasivam, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Mattijs Korpershoek,
Philipp Zabel
Cc: linux-arm-msm, linux-phy, devicetree, linux-kernel,
Krzysztof Kozlowski, Manivannan Sadhasivam
SA8255p platform abstracts resources such as resets, clocks and
regulators in firmware. The SCMI firmware exposes multiple protocols to
control such resources which are identified by protocol_id.
For this USB phy, 2 SCMI protocols are exposed by the firmware:
* power domain management protocol (protocol_id=0x11)
* performance domain management protocol (protocol_id=0x13)
The power domain has 2 indices: 'core' and 'transfer'.
* core controls the regulators, the clocks and the reset
* transfer only controls the clocks
For example, to power on/off the PHY, we should use the 'core' domain.
To disable data transfer and keeping power enabled, we should use the
'transfer' domain.
Add a new binding for the Qualcomm SA8255p Synopsys Femto High-Speed
USB PHY V2 found in SA8255P.
Note: the performance domain (0x13) exposes opaques values (0xa to 0x11)
for which we don't have any information. Since it is not mandatory
for the PHY to be functional, we have ommited it from the bindings.
We can document it (and make them part of the dt ABI) once we have more
information.
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Signed-off-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
---
.../bindings/phy/qcom,sa8255p-usb-hs-phy.yaml | 52 ++++++++++++++++++++++
1 file changed, 52 insertions(+)
diff --git a/Documentation/devicetree/bindings/phy/qcom,sa8255p-usb-hs-phy.yaml b/Documentation/devicetree/bindings/phy/qcom,sa8255p-usb-hs-phy.yaml
new file mode 100644
index 000000000000..fff474a8345d
--- /dev/null
+++ b/Documentation/devicetree/bindings/phy/qcom,sa8255p-usb-hs-phy.yaml
@@ -0,0 +1,52 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/phy/qcom,sa8255p-usb-hs-phy.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm SA8255p Synopsys Femto High-Speed USB PHY V2
+
+maintainers:
+ - Mattijs Korpershoek <mkorpershoek@kernel.org>
+
+properties:
+ compatible:
+ const: qcom,sa8255p-usb-hs-phy
+
+ reg:
+ maxItems: 1
+
+ "#phy-cells":
+ const: 0
+
+ power-domains:
+ maxItems: 2
+
+ power-domain-names:
+ items:
+ - const: core
+ - const: transfer
+
+required:
+ - compatible
+ - reg
+ - "#phy-cells"
+ - power-domains
+ - power-domain-names
+
+additionalProperties: false
+
+examples:
+ - |
+ soc {
+ #address-cells = <2>;
+ #size-cells = <2>;
+
+ phy@88e4000 {
+ compatible = "qcom,sa8255p-usb-hs-phy";
+ reg = <0x0 0x088e4000 0x0 0x120>;
+ #phy-cells = <0>;
+ power-domains = <&scmi12_pd 1>, <&scmi12_pd 0>;
+ power-domain-names = "core", "transfer";
+ };
+ };
--
2.56.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v5 1/2] dt-bindings: phy: Add sa8255p high-speed USB PHY
@ 2026-11-20 13:56 ` Mattijs Korpershoek
0 siblings, 0 replies; 10+ messages in thread
From: Mattijs Korpershoek @ 2026-11-20 13:56 UTC (permalink / raw)
To: Vinod Koul, Neil Armstrong, Manivannan Sadhasivam, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Mattijs Korpershoek,
Philipp Zabel
Cc: linux-arm-msm, linux-phy, devicetree, linux-kernel,
Krzysztof Kozlowski, Manivannan Sadhasivam
SA8255p platform abstracts resources such as resets, clocks and
regulators in firmware. The SCMI firmware exposes multiple protocols to
control such resources which are identified by protocol_id.
For this USB phy, 2 SCMI protocols are exposed by the firmware:
* power domain management protocol (protocol_id=0x11)
* performance domain management protocol (protocol_id=0x13)
The power domain has 2 indices: 'core' and 'transfer'.
* core controls the regulators, the clocks and the reset
* transfer only controls the clocks
For example, to power on/off the PHY, we should use the 'core' domain.
To disable data transfer and keeping power enabled, we should use the
'transfer' domain.
Add a new binding for the Qualcomm SA8255p Synopsys Femto High-Speed
USB PHY V2 found in SA8255P.
Note: the performance domain (0x13) exposes opaques values (0xa to 0x11)
for which we don't have any information. Since it is not mandatory
for the PHY to be functional, we have ommited it from the bindings.
We can document it (and make them part of the dt ABI) once we have more
information.
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Signed-off-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
---
.../bindings/phy/qcom,sa8255p-usb-hs-phy.yaml | 52 ++++++++++++++++++++++
1 file changed, 52 insertions(+)
diff --git a/Documentation/devicetree/bindings/phy/qcom,sa8255p-usb-hs-phy.yaml b/Documentation/devicetree/bindings/phy/qcom,sa8255p-usb-hs-phy.yaml
new file mode 100644
index 000000000000..fff474a8345d
--- /dev/null
+++ b/Documentation/devicetree/bindings/phy/qcom,sa8255p-usb-hs-phy.yaml
@@ -0,0 +1,52 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/phy/qcom,sa8255p-usb-hs-phy.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm SA8255p Synopsys Femto High-Speed USB PHY V2
+
+maintainers:
+ - Mattijs Korpershoek <mkorpershoek@kernel.org>
+
+properties:
+ compatible:
+ const: qcom,sa8255p-usb-hs-phy
+
+ reg:
+ maxItems: 1
+
+ "#phy-cells":
+ const: 0
+
+ power-domains:
+ maxItems: 2
+
+ power-domain-names:
+ items:
+ - const: core
+ - const: transfer
+
+required:
+ - compatible
+ - reg
+ - "#phy-cells"
+ - power-domains
+ - power-domain-names
+
+additionalProperties: false
+
+examples:
+ - |
+ soc {
+ #address-cells = <2>;
+ #size-cells = <2>;
+
+ phy@88e4000 {
+ compatible = "qcom,sa8255p-usb-hs-phy";
+ reg = <0x0 0x088e4000 0x0 0x120>;
+ #phy-cells = <0>;
+ power-domains = <&scmi12_pd 1>, <&scmi12_pd 0>;
+ power-domain-names = "core", "transfer";
+ };
+ };
--
2.56.0
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v5 2/2] phy: qcom-snps-femto-v2: Add support for SA8255P
2026-11-20 13:56 ` Mattijs Korpershoek
@ 2026-11-20 13:56 ` Mattijs Korpershoek
-1 siblings, 0 replies; 10+ messages in thread
From: Mattijs Korpershoek @ 2026-11-20 13:56 UTC (permalink / raw)
To: Vinod Koul, Neil Armstrong, Manivannan Sadhasivam, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Mattijs Korpershoek,
Philipp Zabel
Cc: linux-arm-msm, linux-phy, devicetree, linux-kernel, Sriram Dash,
Manivannan Sadhasivam
From: Sriram Dash <quic_sriramd@quicinc.com>
SA8255p platform abstracts resources such as resets, clocks and
regulators in firmware. The SCMI firmware exposes multiple protocols to
control such resources which are identified by protocol_id.
For this USB phy, 2 SCMI protocols are exposed by the firmware:
* power domain management protocol (protocol_id=0x11)
* performance domain management protocol (protocol_id=0x13)
The power domain has 2 indices: 'core' and 'transfer'.
* core controls the regulators, the clocks and the reset
* transfer only controls the clocks
For example, to power on/off the PHY, we should use the 'core' domain.
To disable data transfer and keeping power enabled, we should use the
'transfer' domain.
Add support for the SCMI firmware-managed variant in the driver.
Note: the performance domain (0x13) exposes opaques values (0xa to 0x11)
for which we don't have any information. Since it is not mandatory
for the PHY to be functional, we have ommited it from the driver.
Signed-off-by: Sriram Dash <quic_sriramd@quicinc.com>
Co-developed-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
Signed-off-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
---
drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c | 261 +++++++++++++++++++++-----
1 file changed, 218 insertions(+), 43 deletions(-)
diff --git a/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c b/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c
index 0dae8369671a..0ec34bc5c26e 100644
--- a/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c
+++ b/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c
@@ -13,6 +13,7 @@
#include <linux/of.h>
#include <linux/phy/phy.h>
#include <linux/platform_device.h>
+#include <linux/pm_domain.h>
#include <linux/regmap.h>
#include <linux/regulator/consumer.h>
#include <linux/reset.h>
@@ -130,6 +131,7 @@ struct phy_config_data {
const struct phy_reg_config *post_tuning;
const u32 num_pre_tuning;
const u32 num_post_tuning;
+ bool fw_managed;
};
#define NUM_HSPHY_TUNING_PARAMS (9)
@@ -149,6 +151,7 @@ struct phy_config_data {
* @phy_initialized: if PHY has been initialized correctly
* @mode: contains the current mode the PHY is in
* @update_seq_cfg: tuning parameters for phy init
+ * @pd_list: list of power domains associated with the device
*/
struct qcom_snps_hsphy {
struct device *dev;
@@ -164,8 +167,82 @@ struct qcom_snps_hsphy {
bool phy_initialized;
enum phy_mode mode;
struct phy_override_seq update_seq_cfg[NUM_HSPHY_TUNING_PARAMS];
+
+ struct dev_pm_domain_list *pd_list;
};
+static void qcom_snps_domain_detach(void *data)
+{
+ struct qcom_snps_hsphy *hsphy = data;
+
+ dev_pm_domain_detach_list(hsphy->pd_list);
+}
+
+static int qcom_snps_domain_attach(struct qcom_snps_hsphy *hsphy)
+{
+ struct dev_pm_domain_attach_data pd_data = {
+ .pd_flags = PD_FLAG_NO_DEV_LINK,
+ .pd_names = (const char*[]) { "core", "transfer" },
+ .num_pd_names = 2,
+ };
+ struct device *dev = hsphy->dev;
+ int ret;
+
+ ret = dev_pm_domain_attach_list(dev, &pd_data, &hsphy->pd_list);
+ if (ret < 0)
+ return dev_err_probe(dev, ret, "domain attach failed\n");
+
+ return 0;
+}
+
+static bool qcom_snps_is_fw_managed(struct qcom_snps_hsphy *hsphy)
+{
+ return hsphy->pd_list != NULL;
+}
+
+static int qcom_snps_pds_enable_all(struct qcom_snps_hsphy *hsphy)
+{
+ int ret;
+
+ if (!qcom_snps_is_fw_managed(hsphy))
+ return 0;
+
+ ret = pm_runtime_resume_and_get(hsphy->pd_list->pd_devs[0]);
+ if (ret)
+ return ret;
+
+ ret = pm_runtime_resume_and_get(hsphy->pd_list->pd_devs[1]);
+ if (ret)
+ pm_runtime_put_sync(hsphy->pd_list->pd_devs[0]);
+
+ return ret;
+}
+
+static void qcom_snps_pds_disable_all(struct qcom_snps_hsphy *hsphy)
+{
+ if (!qcom_snps_is_fw_managed(hsphy))
+ return;
+
+ pm_runtime_put_sync(hsphy->pd_list->pd_devs[1]);
+ pm_runtime_put_sync(hsphy->pd_list->pd_devs[0]);
+}
+
+static int qcom_snps_pd_enable_transfer(struct qcom_snps_hsphy *hsphy)
+{
+ if (!qcom_snps_is_fw_managed(hsphy))
+ return 0;
+
+ return pm_runtime_resume_and_get(hsphy->pd_list->pd_devs[1]);
+}
+
+static void qcom_snps_pd_disable_transfer(struct qcom_snps_hsphy *hsphy)
+{
+ if (!qcom_snps_is_fw_managed(hsphy))
+ return;
+
+ pm_runtime_put_sync(hsphy->pd_list->pd_devs[1]);
+}
+
static int qcom_snps_hsphy_clk_init(struct qcom_snps_hsphy *hsphy)
{
struct device *dev = hsphy->dev;
@@ -224,6 +301,8 @@ static int qcom_snps_hsphy_suspend(struct qcom_snps_hsphy *hsphy)
USB2_AUTO_RESUME, 0);
}
+ qcom_snps_pd_disable_transfer(hsphy);
+
return 0;
}
@@ -231,7 +310,7 @@ static int qcom_snps_hsphy_resume(struct qcom_snps_hsphy *hsphy)
{
dev_dbg(&hsphy->phy->dev, "Resume QCOM SNPS PHY, mode\n");
- return 0;
+ return qcom_snps_pd_enable_transfer(hsphy);
}
static int __maybe_unused qcom_snps_hsphy_runtime_suspend(struct device *dev)
@@ -469,18 +548,45 @@ static const struct phy_reg_config hs_6nm_phy_post_tuning[] = {
{ USB2_PHY_USB_PHY_CFG0, UTMI_PHY_CMN_CTRL_OVERRIDE_EN, 0 },
};
-static int qcom_snps_hsphy_init(struct phy *phy)
+static int qcom_snps_hsphy_configure(struct qcom_snps_hsphy *hsphy)
{
- struct qcom_snps_hsphy *hsphy = phy_get_drvdata(phy);
const struct phy_config_data *data;
- int ret, i;
-
- dev_vdbg(&phy->dev, "%s(): Initializing SNPS HS phy\n", __func__);
+ int i;
data = of_device_get_match_data(hsphy->dev);
if (!data)
return -ENODEV;
+ for (i = 0; i < data->num_pre_tuning; i++)
+ qcom_snps_hsphy_write_mask(hsphy->base,
+ data->pre_tuning[i].offset,
+ data->pre_tuning[i].mask,
+ data->pre_tuning[i].val);
+
+ for (i = 0; i < ARRAY_SIZE(hsphy->update_seq_cfg); i++) {
+ if (hsphy->update_seq_cfg[i].need_update)
+ qcom_snps_hsphy_write_mask(hsphy->base,
+ hsphy->update_seq_cfg[i].offset,
+ hsphy->update_seq_cfg[i].mask,
+ hsphy->update_seq_cfg[i].value);
+ }
+
+ for (i = 0; i < data->num_post_tuning; i++)
+ qcom_snps_hsphy_write_mask(hsphy->base,
+ data->post_tuning[i].offset,
+ data->post_tuning[i].mask,
+ data->post_tuning[i].val);
+
+ return 0;
+}
+
+static int qcom_snps_hsphy_init(struct phy *phy)
+{
+ struct qcom_snps_hsphy *hsphy = phy_get_drvdata(phy);
+ int ret;
+
+ dev_vdbg(&phy->dev, "%s(): Initializing SNPS HS phy\n", __func__);
+
ret = regulator_bulk_enable(ARRAY_SIZE(hsphy->vregs), hsphy->vregs);
if (ret)
return ret;
@@ -505,30 +611,18 @@ static int qcom_snps_hsphy_init(struct phy *phy)
goto disable_clks;
}
- for (i = 0; i < data->num_pre_tuning; i++)
- qcom_snps_hsphy_write_mask(hsphy->base,
- data->pre_tuning[i].offset,
- data->pre_tuning[i].mask,
- data->pre_tuning[i].val);
-
- for (i = 0; i < ARRAY_SIZE(hsphy->update_seq_cfg); i++) {
- if (hsphy->update_seq_cfg[i].need_update)
- qcom_snps_hsphy_write_mask(hsphy->base,
- hsphy->update_seq_cfg[i].offset,
- hsphy->update_seq_cfg[i].mask,
- hsphy->update_seq_cfg[i].value);
+ ret = qcom_snps_hsphy_configure(hsphy);
+ if (ret) {
+ dev_err(&phy->dev, "failed to configure phy, %d\n", ret);
+ goto assert_reset;
}
- for (i = 0; i < data->num_post_tuning; i++)
- qcom_snps_hsphy_write_mask(hsphy->base,
- data->post_tuning[i].offset,
- data->post_tuning[i].mask,
- data->post_tuning[i].val);
-
hsphy->phy_initialized = true;
return 0;
+assert_reset:
+ reset_control_assert(hsphy->phy_reset);
disable_clks:
clk_bulk_disable_unprepare(hsphy->num_clks, hsphy->clks);
poweroff_phy:
@@ -556,6 +650,46 @@ static const struct phy_ops qcom_snps_hsphy_gen_ops = {
.owner = THIS_MODULE,
};
+static int qcom_snps_hsphy_fw_managed_init(struct phy *phy)
+{
+ struct qcom_snps_hsphy *hsphy = phy_get_drvdata(phy);
+ int ret;
+
+ ret = qcom_snps_pds_enable_all(hsphy);
+ if (ret) {
+ dev_err(&phy->dev, "failed to enable pds, %d\n", ret);
+ return ret;
+ }
+
+ ret = qcom_snps_hsphy_configure(hsphy);
+ if (ret) {
+ dev_err(&phy->dev, "failed to configure phy, %d\n", ret);
+ qcom_snps_pds_disable_all(hsphy);
+ return ret;
+ }
+
+ hsphy->phy_initialized = true;
+
+ return 0;
+}
+
+static int qcom_snps_hsphy_fw_managed_exit(struct phy *phy)
+{
+ struct qcom_snps_hsphy *hsphy = phy_get_drvdata(phy);
+
+ qcom_snps_pds_disable_all(hsphy);
+ hsphy->phy_initialized = false;
+
+ return 0;
+}
+
+static const struct phy_ops qcom_snps_hsphy_fw_managed_ops = {
+ .init = qcom_snps_hsphy_fw_managed_init,
+ .exit = qcom_snps_hsphy_fw_managed_exit,
+ .set_mode = qcom_snps_hsphy_set_mode,
+ .owner = THIS_MODULE,
+};
+
static const struct phy_config_data hs_5nm_phy = {
.pre_tuning = hs_5nm_phy_pre_tuning,
.num_pre_tuning = ARRAY_SIZE(hs_5nm_phy_pre_tuning),
@@ -563,6 +697,14 @@ static const struct phy_config_data hs_5nm_phy = {
.num_post_tuning = ARRAY_SIZE(hs_5nm_phy_post_tuning),
};
+static const struct phy_config_data hs_5nm_fw_managed_phy = {
+ .pre_tuning = hs_5nm_phy_pre_tuning,
+ .num_pre_tuning = ARRAY_SIZE(hs_5nm_phy_pre_tuning),
+ .post_tuning = hs_5nm_phy_post_tuning,
+ .num_post_tuning = ARRAY_SIZE(hs_5nm_phy_post_tuning),
+ .fw_managed = true,
+};
+
static const struct phy_config_data hs_6nm_phy = {
.pre_tuning = hs_6nm_phy_pre_tuning,
.num_pre_tuning = ARRAY_SIZE(hs_6nm_phy_pre_tuning),
@@ -592,6 +734,10 @@ static const struct of_device_id qcom_snps_hsphy_of_match_table[] = {
.compatible = "qcom,ipq9650-usb-hs-phy",
.data = &hs_6nm_phy,
},
+ {
+ .compatible = "qcom,sa8255p-usb-hs-phy",
+ .data = &hs_5nm_fw_managed_phy,
+ },
{
.compatible = "qcom,usb-snps-hs-7nm-phy",
.data = &hs_7nm_phy,
@@ -661,14 +807,42 @@ static void qcom_snps_hsphy_read_override_param_seq(struct device *dev)
}
}
+static int qcom_snps_hsphy_init_resources(struct qcom_snps_hsphy *hsphy)
+{
+ struct device *dev = hsphy->dev;
+ int ret, i, num;
+
+ ret = qcom_snps_hsphy_clk_init(hsphy);
+ if (ret)
+ return dev_err_probe(dev, ret, "failed to initialize clocks\n");
+
+ hsphy->phy_reset = devm_reset_control_get_exclusive(dev, NULL);
+ if (IS_ERR(hsphy->phy_reset)) {
+ dev_err(dev, "failed to get phy core reset\n");
+ return PTR_ERR(hsphy->phy_reset);
+ }
+
+ num = ARRAY_SIZE(hsphy->vregs);
+ for (i = 0; i < num; i++)
+ hsphy->vregs[i].supply = qcom_snps_hsphy_vreg_names[i];
+
+ ret = devm_regulator_bulk_get(dev, num, hsphy->vregs);
+ if (ret)
+ return dev_err_probe(dev, ret,
+ "failed to get regulator supplies\n");
+
+ return 0;
+}
+
static int qcom_snps_hsphy_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct qcom_snps_hsphy *hsphy;
+ const struct phy_config_data *data;
struct phy_provider *phy_provider;
+ const struct phy_ops *phy_ops;
struct phy *generic_phy;
- int ret, i;
- int num;
+ int ret;
hsphy = devm_kzalloc(dev, sizeof(*hsphy), GFP_KERNEL);
if (!hsphy)
@@ -680,24 +854,25 @@ static int qcom_snps_hsphy_probe(struct platform_device *pdev)
if (IS_ERR(hsphy->base))
return PTR_ERR(hsphy->base);
- ret = qcom_snps_hsphy_clk_init(hsphy);
- if (ret)
- return dev_err_probe(dev, ret, "failed to initialize clocks\n");
-
- hsphy->phy_reset = devm_reset_control_get_exclusive(&pdev->dev, NULL);
- if (IS_ERR(hsphy->phy_reset)) {
- dev_err(dev, "failed to get phy core reset\n");
- return PTR_ERR(hsphy->phy_reset);
- }
+ data = of_device_get_match_data(dev);
+ if (!data)
+ return -ENODEV;
- num = ARRAY_SIZE(hsphy->vregs);
- for (i = 0; i < num; i++)
- hsphy->vregs[i].supply = qcom_snps_hsphy_vreg_names[i];
+ if (data->fw_managed) {
+ phy_ops = &qcom_snps_hsphy_fw_managed_ops;
+ ret = qcom_snps_domain_attach(hsphy);
+ if (ret)
+ return ret;
- ret = devm_regulator_bulk_get(dev, num, hsphy->vregs);
- if (ret)
- return dev_err_probe(dev, ret,
- "failed to get regulator supplies\n");
+ ret = devm_add_action_or_reset(dev, qcom_snps_domain_detach, hsphy);
+ if (ret)
+ return ret;
+ } else {
+ phy_ops = &qcom_snps_hsphy_gen_ops;
+ ret = qcom_snps_hsphy_init_resources(hsphy);
+ if (ret)
+ return ret;
+ }
/*
* Enable runtime PM before creating the PHY, phy_create() only enables
@@ -717,7 +892,7 @@ static int qcom_snps_hsphy_probe(struct platform_device *pdev)
*/
pm_runtime_forbid(dev);
- generic_phy = devm_phy_create(dev, NULL, &qcom_snps_hsphy_gen_ops);
+ generic_phy = devm_phy_create(dev, NULL, phy_ops);
if (IS_ERR(generic_phy)) {
ret = PTR_ERR(generic_phy);
dev_err(dev, "failed to create phy, %d\n", ret);
--
2.56.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v5 2/2] phy: qcom-snps-femto-v2: Add support for SA8255P
@ 2026-11-20 13:56 ` Mattijs Korpershoek
0 siblings, 0 replies; 10+ messages in thread
From: Mattijs Korpershoek @ 2026-11-20 13:56 UTC (permalink / raw)
To: Vinod Koul, Neil Armstrong, Manivannan Sadhasivam, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Mattijs Korpershoek,
Philipp Zabel
Cc: linux-arm-msm, linux-phy, devicetree, linux-kernel, Sriram Dash,
Manivannan Sadhasivam
From: Sriram Dash <quic_sriramd@quicinc.com>
SA8255p platform abstracts resources such as resets, clocks and
regulators in firmware. The SCMI firmware exposes multiple protocols to
control such resources which are identified by protocol_id.
For this USB phy, 2 SCMI protocols are exposed by the firmware:
* power domain management protocol (protocol_id=0x11)
* performance domain management protocol (protocol_id=0x13)
The power domain has 2 indices: 'core' and 'transfer'.
* core controls the regulators, the clocks and the reset
* transfer only controls the clocks
For example, to power on/off the PHY, we should use the 'core' domain.
To disable data transfer and keeping power enabled, we should use the
'transfer' domain.
Add support for the SCMI firmware-managed variant in the driver.
Note: the performance domain (0x13) exposes opaques values (0xa to 0x11)
for which we don't have any information. Since it is not mandatory
for the PHY to be functional, we have ommited it from the driver.
Signed-off-by: Sriram Dash <quic_sriramd@quicinc.com>
Co-developed-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
Signed-off-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
---
drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c | 261 +++++++++++++++++++++-----
1 file changed, 218 insertions(+), 43 deletions(-)
diff --git a/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c b/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c
index 0dae8369671a..0ec34bc5c26e 100644
--- a/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c
+++ b/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c
@@ -13,6 +13,7 @@
#include <linux/of.h>
#include <linux/phy/phy.h>
#include <linux/platform_device.h>
+#include <linux/pm_domain.h>
#include <linux/regmap.h>
#include <linux/regulator/consumer.h>
#include <linux/reset.h>
@@ -130,6 +131,7 @@ struct phy_config_data {
const struct phy_reg_config *post_tuning;
const u32 num_pre_tuning;
const u32 num_post_tuning;
+ bool fw_managed;
};
#define NUM_HSPHY_TUNING_PARAMS (9)
@@ -149,6 +151,7 @@ struct phy_config_data {
* @phy_initialized: if PHY has been initialized correctly
* @mode: contains the current mode the PHY is in
* @update_seq_cfg: tuning parameters for phy init
+ * @pd_list: list of power domains associated with the device
*/
struct qcom_snps_hsphy {
struct device *dev;
@@ -164,8 +167,82 @@ struct qcom_snps_hsphy {
bool phy_initialized;
enum phy_mode mode;
struct phy_override_seq update_seq_cfg[NUM_HSPHY_TUNING_PARAMS];
+
+ struct dev_pm_domain_list *pd_list;
};
+static void qcom_snps_domain_detach(void *data)
+{
+ struct qcom_snps_hsphy *hsphy = data;
+
+ dev_pm_domain_detach_list(hsphy->pd_list);
+}
+
+static int qcom_snps_domain_attach(struct qcom_snps_hsphy *hsphy)
+{
+ struct dev_pm_domain_attach_data pd_data = {
+ .pd_flags = PD_FLAG_NO_DEV_LINK,
+ .pd_names = (const char*[]) { "core", "transfer" },
+ .num_pd_names = 2,
+ };
+ struct device *dev = hsphy->dev;
+ int ret;
+
+ ret = dev_pm_domain_attach_list(dev, &pd_data, &hsphy->pd_list);
+ if (ret < 0)
+ return dev_err_probe(dev, ret, "domain attach failed\n");
+
+ return 0;
+}
+
+static bool qcom_snps_is_fw_managed(struct qcom_snps_hsphy *hsphy)
+{
+ return hsphy->pd_list != NULL;
+}
+
+static int qcom_snps_pds_enable_all(struct qcom_snps_hsphy *hsphy)
+{
+ int ret;
+
+ if (!qcom_snps_is_fw_managed(hsphy))
+ return 0;
+
+ ret = pm_runtime_resume_and_get(hsphy->pd_list->pd_devs[0]);
+ if (ret)
+ return ret;
+
+ ret = pm_runtime_resume_and_get(hsphy->pd_list->pd_devs[1]);
+ if (ret)
+ pm_runtime_put_sync(hsphy->pd_list->pd_devs[0]);
+
+ return ret;
+}
+
+static void qcom_snps_pds_disable_all(struct qcom_snps_hsphy *hsphy)
+{
+ if (!qcom_snps_is_fw_managed(hsphy))
+ return;
+
+ pm_runtime_put_sync(hsphy->pd_list->pd_devs[1]);
+ pm_runtime_put_sync(hsphy->pd_list->pd_devs[0]);
+}
+
+static int qcom_snps_pd_enable_transfer(struct qcom_snps_hsphy *hsphy)
+{
+ if (!qcom_snps_is_fw_managed(hsphy))
+ return 0;
+
+ return pm_runtime_resume_and_get(hsphy->pd_list->pd_devs[1]);
+}
+
+static void qcom_snps_pd_disable_transfer(struct qcom_snps_hsphy *hsphy)
+{
+ if (!qcom_snps_is_fw_managed(hsphy))
+ return;
+
+ pm_runtime_put_sync(hsphy->pd_list->pd_devs[1]);
+}
+
static int qcom_snps_hsphy_clk_init(struct qcom_snps_hsphy *hsphy)
{
struct device *dev = hsphy->dev;
@@ -224,6 +301,8 @@ static int qcom_snps_hsphy_suspend(struct qcom_snps_hsphy *hsphy)
USB2_AUTO_RESUME, 0);
}
+ qcom_snps_pd_disable_transfer(hsphy);
+
return 0;
}
@@ -231,7 +310,7 @@ static int qcom_snps_hsphy_resume(struct qcom_snps_hsphy *hsphy)
{
dev_dbg(&hsphy->phy->dev, "Resume QCOM SNPS PHY, mode\n");
- return 0;
+ return qcom_snps_pd_enable_transfer(hsphy);
}
static int __maybe_unused qcom_snps_hsphy_runtime_suspend(struct device *dev)
@@ -469,18 +548,45 @@ static const struct phy_reg_config hs_6nm_phy_post_tuning[] = {
{ USB2_PHY_USB_PHY_CFG0, UTMI_PHY_CMN_CTRL_OVERRIDE_EN, 0 },
};
-static int qcom_snps_hsphy_init(struct phy *phy)
+static int qcom_snps_hsphy_configure(struct qcom_snps_hsphy *hsphy)
{
- struct qcom_snps_hsphy *hsphy = phy_get_drvdata(phy);
const struct phy_config_data *data;
- int ret, i;
-
- dev_vdbg(&phy->dev, "%s(): Initializing SNPS HS phy\n", __func__);
+ int i;
data = of_device_get_match_data(hsphy->dev);
if (!data)
return -ENODEV;
+ for (i = 0; i < data->num_pre_tuning; i++)
+ qcom_snps_hsphy_write_mask(hsphy->base,
+ data->pre_tuning[i].offset,
+ data->pre_tuning[i].mask,
+ data->pre_tuning[i].val);
+
+ for (i = 0; i < ARRAY_SIZE(hsphy->update_seq_cfg); i++) {
+ if (hsphy->update_seq_cfg[i].need_update)
+ qcom_snps_hsphy_write_mask(hsphy->base,
+ hsphy->update_seq_cfg[i].offset,
+ hsphy->update_seq_cfg[i].mask,
+ hsphy->update_seq_cfg[i].value);
+ }
+
+ for (i = 0; i < data->num_post_tuning; i++)
+ qcom_snps_hsphy_write_mask(hsphy->base,
+ data->post_tuning[i].offset,
+ data->post_tuning[i].mask,
+ data->post_tuning[i].val);
+
+ return 0;
+}
+
+static int qcom_snps_hsphy_init(struct phy *phy)
+{
+ struct qcom_snps_hsphy *hsphy = phy_get_drvdata(phy);
+ int ret;
+
+ dev_vdbg(&phy->dev, "%s(): Initializing SNPS HS phy\n", __func__);
+
ret = regulator_bulk_enable(ARRAY_SIZE(hsphy->vregs), hsphy->vregs);
if (ret)
return ret;
@@ -505,30 +611,18 @@ static int qcom_snps_hsphy_init(struct phy *phy)
goto disable_clks;
}
- for (i = 0; i < data->num_pre_tuning; i++)
- qcom_snps_hsphy_write_mask(hsphy->base,
- data->pre_tuning[i].offset,
- data->pre_tuning[i].mask,
- data->pre_tuning[i].val);
-
- for (i = 0; i < ARRAY_SIZE(hsphy->update_seq_cfg); i++) {
- if (hsphy->update_seq_cfg[i].need_update)
- qcom_snps_hsphy_write_mask(hsphy->base,
- hsphy->update_seq_cfg[i].offset,
- hsphy->update_seq_cfg[i].mask,
- hsphy->update_seq_cfg[i].value);
+ ret = qcom_snps_hsphy_configure(hsphy);
+ if (ret) {
+ dev_err(&phy->dev, "failed to configure phy, %d\n", ret);
+ goto assert_reset;
}
- for (i = 0; i < data->num_post_tuning; i++)
- qcom_snps_hsphy_write_mask(hsphy->base,
- data->post_tuning[i].offset,
- data->post_tuning[i].mask,
- data->post_tuning[i].val);
-
hsphy->phy_initialized = true;
return 0;
+assert_reset:
+ reset_control_assert(hsphy->phy_reset);
disable_clks:
clk_bulk_disable_unprepare(hsphy->num_clks, hsphy->clks);
poweroff_phy:
@@ -556,6 +650,46 @@ static const struct phy_ops qcom_snps_hsphy_gen_ops = {
.owner = THIS_MODULE,
};
+static int qcom_snps_hsphy_fw_managed_init(struct phy *phy)
+{
+ struct qcom_snps_hsphy *hsphy = phy_get_drvdata(phy);
+ int ret;
+
+ ret = qcom_snps_pds_enable_all(hsphy);
+ if (ret) {
+ dev_err(&phy->dev, "failed to enable pds, %d\n", ret);
+ return ret;
+ }
+
+ ret = qcom_snps_hsphy_configure(hsphy);
+ if (ret) {
+ dev_err(&phy->dev, "failed to configure phy, %d\n", ret);
+ qcom_snps_pds_disable_all(hsphy);
+ return ret;
+ }
+
+ hsphy->phy_initialized = true;
+
+ return 0;
+}
+
+static int qcom_snps_hsphy_fw_managed_exit(struct phy *phy)
+{
+ struct qcom_snps_hsphy *hsphy = phy_get_drvdata(phy);
+
+ qcom_snps_pds_disable_all(hsphy);
+ hsphy->phy_initialized = false;
+
+ return 0;
+}
+
+static const struct phy_ops qcom_snps_hsphy_fw_managed_ops = {
+ .init = qcom_snps_hsphy_fw_managed_init,
+ .exit = qcom_snps_hsphy_fw_managed_exit,
+ .set_mode = qcom_snps_hsphy_set_mode,
+ .owner = THIS_MODULE,
+};
+
static const struct phy_config_data hs_5nm_phy = {
.pre_tuning = hs_5nm_phy_pre_tuning,
.num_pre_tuning = ARRAY_SIZE(hs_5nm_phy_pre_tuning),
@@ -563,6 +697,14 @@ static const struct phy_config_data hs_5nm_phy = {
.num_post_tuning = ARRAY_SIZE(hs_5nm_phy_post_tuning),
};
+static const struct phy_config_data hs_5nm_fw_managed_phy = {
+ .pre_tuning = hs_5nm_phy_pre_tuning,
+ .num_pre_tuning = ARRAY_SIZE(hs_5nm_phy_pre_tuning),
+ .post_tuning = hs_5nm_phy_post_tuning,
+ .num_post_tuning = ARRAY_SIZE(hs_5nm_phy_post_tuning),
+ .fw_managed = true,
+};
+
static const struct phy_config_data hs_6nm_phy = {
.pre_tuning = hs_6nm_phy_pre_tuning,
.num_pre_tuning = ARRAY_SIZE(hs_6nm_phy_pre_tuning),
@@ -592,6 +734,10 @@ static const struct of_device_id qcom_snps_hsphy_of_match_table[] = {
.compatible = "qcom,ipq9650-usb-hs-phy",
.data = &hs_6nm_phy,
},
+ {
+ .compatible = "qcom,sa8255p-usb-hs-phy",
+ .data = &hs_5nm_fw_managed_phy,
+ },
{
.compatible = "qcom,usb-snps-hs-7nm-phy",
.data = &hs_7nm_phy,
@@ -661,14 +807,42 @@ static void qcom_snps_hsphy_read_override_param_seq(struct device *dev)
}
}
+static int qcom_snps_hsphy_init_resources(struct qcom_snps_hsphy *hsphy)
+{
+ struct device *dev = hsphy->dev;
+ int ret, i, num;
+
+ ret = qcom_snps_hsphy_clk_init(hsphy);
+ if (ret)
+ return dev_err_probe(dev, ret, "failed to initialize clocks\n");
+
+ hsphy->phy_reset = devm_reset_control_get_exclusive(dev, NULL);
+ if (IS_ERR(hsphy->phy_reset)) {
+ dev_err(dev, "failed to get phy core reset\n");
+ return PTR_ERR(hsphy->phy_reset);
+ }
+
+ num = ARRAY_SIZE(hsphy->vregs);
+ for (i = 0; i < num; i++)
+ hsphy->vregs[i].supply = qcom_snps_hsphy_vreg_names[i];
+
+ ret = devm_regulator_bulk_get(dev, num, hsphy->vregs);
+ if (ret)
+ return dev_err_probe(dev, ret,
+ "failed to get regulator supplies\n");
+
+ return 0;
+}
+
static int qcom_snps_hsphy_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct qcom_snps_hsphy *hsphy;
+ const struct phy_config_data *data;
struct phy_provider *phy_provider;
+ const struct phy_ops *phy_ops;
struct phy *generic_phy;
- int ret, i;
- int num;
+ int ret;
hsphy = devm_kzalloc(dev, sizeof(*hsphy), GFP_KERNEL);
if (!hsphy)
@@ -680,24 +854,25 @@ static int qcom_snps_hsphy_probe(struct platform_device *pdev)
if (IS_ERR(hsphy->base))
return PTR_ERR(hsphy->base);
- ret = qcom_snps_hsphy_clk_init(hsphy);
- if (ret)
- return dev_err_probe(dev, ret, "failed to initialize clocks\n");
-
- hsphy->phy_reset = devm_reset_control_get_exclusive(&pdev->dev, NULL);
- if (IS_ERR(hsphy->phy_reset)) {
- dev_err(dev, "failed to get phy core reset\n");
- return PTR_ERR(hsphy->phy_reset);
- }
+ data = of_device_get_match_data(dev);
+ if (!data)
+ return -ENODEV;
- num = ARRAY_SIZE(hsphy->vregs);
- for (i = 0; i < num; i++)
- hsphy->vregs[i].supply = qcom_snps_hsphy_vreg_names[i];
+ if (data->fw_managed) {
+ phy_ops = &qcom_snps_hsphy_fw_managed_ops;
+ ret = qcom_snps_domain_attach(hsphy);
+ if (ret)
+ return ret;
- ret = devm_regulator_bulk_get(dev, num, hsphy->vregs);
- if (ret)
- return dev_err_probe(dev, ret,
- "failed to get regulator supplies\n");
+ ret = devm_add_action_or_reset(dev, qcom_snps_domain_detach, hsphy);
+ if (ret)
+ return ret;
+ } else {
+ phy_ops = &qcom_snps_hsphy_gen_ops;
+ ret = qcom_snps_hsphy_init_resources(hsphy);
+ if (ret)
+ return ret;
+ }
/*
* Enable runtime PM before creating the PHY, phy_create() only enables
@@ -717,7 +892,7 @@ static int qcom_snps_hsphy_probe(struct platform_device *pdev)
*/
pm_runtime_forbid(dev);
- generic_phy = devm_phy_create(dev, NULL, &qcom_snps_hsphy_gen_ops);
+ generic_phy = devm_phy_create(dev, NULL, phy_ops);
if (IS_ERR(generic_phy)) {
ret = PTR_ERR(generic_phy);
dev_err(dev, "failed to create phy, %d\n", ret);
--
2.56.0
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v5 2/2] phy: qcom-snps-femto-v2: Add support for SA8255P
2026-11-20 13:56 ` Mattijs Korpershoek
@ 2026-11-20 14:11 ` sashiko-bot
-1 siblings, 0 replies; 10+ messages in thread
From: sashiko-bot @ 2026-11-20 14:11 UTC (permalink / raw)
To: Mattijs Korpershoek
Cc: linux-phy, devicetree, robh, conor+dt, vkoul, neil.armstrong,
olteanv
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] phy: qcom-snps-femto-v2: use devm_pm_domain_attach_list() and
check ret == 0
--
commit 40323ed83ee6f03c36d2767d1e91cd08ccff373b
Author: Sriram Dash <quic_sriramd@quicinc.com>
phy: qcom-snps-femto-v2: Add support for SA8255P
This commit adds support for the SA8255P USB HS PHY variant, whose power,
clock, and reset resources are managed by SCMI firmware through "core" and
"transfer" power domains.
> diff --git a/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c b/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c
> index 0dae8369671ab..0ec34bc5c26ec 100644
> --- a/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c
> +++ b/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c
[ ... ]
> @@ -164,8 +167,82 @@ struct qcom_snps_hsphy {
> bool phy_initialized;
> enum phy_mode mode;
> struct phy_override_seq update_seq_cfg[NUM_HSPHY_TUNING_PARAMS];
> +
> + struct dev_pm_domain_list *pd_list;
> };
>
> +static void qcom_snps_domain_detach(void *data)
> +{
> + struct qcom_snps_hsphy *hsphy = data;
> +
> + dev_pm_domain_detach_list(hsphy->pd_list);
> +}
> +
> +static int qcom_snps_domain_attach(struct qcom_snps_hsphy *hsphy)
> +{
> + struct dev_pm_domain_attach_data pd_data = {
> + .pd_flags = PD_FLAG_NO_DEV_LINK,
> + .pd_names = (const char*[]) { "core", "transfer" },
> + .num_pd_names = 2,
> + };
> + struct device *dev = hsphy->dev;
> + int ret;
> +
> + ret = dev_pm_domain_attach_list(dev, &pd_data, &hsphy->pd_list);
> + if (ret < 0)
> + return dev_err_probe(dev, ret, "domain attach failed\n");
> +
> + return 0;
> +}
> +
> +static bool qcom_snps_is_fw_managed(struct qcom_snps_hsphy *hsphy)
> +{
> + return hsphy->pd_list != NULL;
> +}
> +
> +static int qcom_snps_pds_enable_all(struct qcom_snps_hsphy *hsphy)
> +{
> + int ret;
> +
> + if (!qcom_snps_is_fw_managed(hsphy))
> + return 0;
[Severity: Low]
Can qcom_snps_domain_attach() succeed with hsphy->pd_list left NULL when
dev_pm_domain_attach_list() returns 0 (for example, when CONFIG_PM is
disabled)?
If that happens, qcom_snps_pds_enable_all() returns 0 without enabling the
power domains, and qcom_snps_hsphy_fw_managed_init() proceeds to
qcom_snps_hsphy_configure() and writes PHY registers while clocks, resets,
and power domains are off. Also, qcom_snps_domain_attach() and
qcom_snps_domain_detach() with devm_add_action_or_reset() in
qcom_snps_hsphy_probe() duplicate devm_pm_domain_attach_list(); calling
devm_pm_domain_attach_list() directly and returning -ENODEV when ret == 0
would avoid both issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261120-phy-qcom-snps-femto-v2-8255-v5-0-86a9880ee5a5@kernel.org?part=2
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v5 2/2] phy: qcom-snps-femto-v2: Add support for SA8255P
@ 2026-11-20 14:11 ` sashiko-bot
0 siblings, 0 replies; 10+ messages in thread
From: sashiko-bot @ 2026-11-20 14:11 UTC (permalink / raw)
To: Mattijs Korpershoek
Cc: linux-phy, devicetree, robh, conor+dt, vkoul, neil.armstrong,
olteanv
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] phy: qcom-snps-femto-v2: use devm_pm_domain_attach_list() and
check ret == 0
--
commit 40323ed83ee6f03c36d2767d1e91cd08ccff373b
Author: Sriram Dash <quic_sriramd@quicinc.com>
phy: qcom-snps-femto-v2: Add support for SA8255P
This commit adds support for the SA8255P USB HS PHY variant, whose power,
clock, and reset resources are managed by SCMI firmware through "core" and
"transfer" power domains.
> diff --git a/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c b/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c
> index 0dae8369671ab..0ec34bc5c26ec 100644
> --- a/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c
> +++ b/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c
[ ... ]
> @@ -164,8 +167,82 @@ struct qcom_snps_hsphy {
> bool phy_initialized;
> enum phy_mode mode;
> struct phy_override_seq update_seq_cfg[NUM_HSPHY_TUNING_PARAMS];
> +
> + struct dev_pm_domain_list *pd_list;
> };
>
> +static void qcom_snps_domain_detach(void *data)
> +{
> + struct qcom_snps_hsphy *hsphy = data;
> +
> + dev_pm_domain_detach_list(hsphy->pd_list);
> +}
> +
> +static int qcom_snps_domain_attach(struct qcom_snps_hsphy *hsphy)
> +{
> + struct dev_pm_domain_attach_data pd_data = {
> + .pd_flags = PD_FLAG_NO_DEV_LINK,
> + .pd_names = (const char*[]) { "core", "transfer" },
> + .num_pd_names = 2,
> + };
> + struct device *dev = hsphy->dev;
> + int ret;
> +
> + ret = dev_pm_domain_attach_list(dev, &pd_data, &hsphy->pd_list);
> + if (ret < 0)
> + return dev_err_probe(dev, ret, "domain attach failed\n");
> +
> + return 0;
> +}
> +
> +static bool qcom_snps_is_fw_managed(struct qcom_snps_hsphy *hsphy)
> +{
> + return hsphy->pd_list != NULL;
> +}
> +
> +static int qcom_snps_pds_enable_all(struct qcom_snps_hsphy *hsphy)
> +{
> + int ret;
> +
> + if (!qcom_snps_is_fw_managed(hsphy))
> + return 0;
[Severity: Low]
Can qcom_snps_domain_attach() succeed with hsphy->pd_list left NULL when
dev_pm_domain_attach_list() returns 0 (for example, when CONFIG_PM is
disabled)?
If that happens, qcom_snps_pds_enable_all() returns 0 without enabling the
power domains, and qcom_snps_hsphy_fw_managed_init() proceeds to
qcom_snps_hsphy_configure() and writes PHY registers while clocks, resets,
and power domains are off. Also, qcom_snps_domain_attach() and
qcom_snps_domain_detach() with devm_add_action_or_reset() in
qcom_snps_hsphy_probe() duplicate devm_pm_domain_attach_list(); calling
devm_pm_domain_attach_list() directly and returning -ENODEV when ret == 0
would avoid both issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261120-phy-qcom-snps-femto-v2-8255-v5-0-86a9880ee5a5@kernel.org?part=2
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v5 2/2] phy: qcom-snps-femto-v2: Add support for SA8255P
2026-11-20 14:11 ` sashiko-bot
@ 2026-11-20 14:57 ` Mattijs Korpershoek
-1 siblings, 0 replies; 10+ messages in thread
From: Mattijs Korpershoek @ 2026-11-20 14:57 UTC (permalink / raw)
To: sashiko-reviews
Cc: linux-phy, devicetree, robh, conor+dt, vkoul, neil.armstrong,
olteanv
On Fri, Nov 20, 2026 at 14:11, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential
> issue to consider:
> - [Low] phy: qcom-snps-femto-v2: use devm_pm_domain_attach_list() and
> check ret == 0
> --
>
> commit 40323ed83ee6f03c36d2767d1e91cd08ccff373b
> Author: Sriram Dash <quic_sriramd@quicinc.com>
>
> phy: qcom-snps-femto-v2: Add support for SA8255P
>
> This commit adds support for the SA8255P USB HS PHY variant, whose power,
> clock, and reset resources are managed by SCMI firmware through "core" and
> "transfer" power domains.
>
>> diff --git a/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c b/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c
>> index 0dae8369671ab..0ec34bc5c26ec 100644
>> --- a/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c
>> +++ b/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c
> [ ... ]
>> @@ -164,8 +167,82 @@ struct qcom_snps_hsphy {
>> bool phy_initialized;
>> enum phy_mode mode;
>> struct phy_override_seq update_seq_cfg[NUM_HSPHY_TUNING_PARAMS];
>> +
>> + struct dev_pm_domain_list *pd_list;
>> };
>>
>> +static void qcom_snps_domain_detach(void *data)
>> +{
>> + struct qcom_snps_hsphy *hsphy = data;
>> +
>> + dev_pm_domain_detach_list(hsphy->pd_list);
>> +}
>> +
>> +static int qcom_snps_domain_attach(struct qcom_snps_hsphy *hsphy)
>> +{
>> + struct dev_pm_domain_attach_data pd_data = {
>> + .pd_flags = PD_FLAG_NO_DEV_LINK,
>> + .pd_names = (const char*[]) { "core", "transfer" },
>> + .num_pd_names = 2,
>> + };
>> + struct device *dev = hsphy->dev;
>> + int ret;
>> +
>> + ret = dev_pm_domain_attach_list(dev, &pd_data, &hsphy->pd_list);
>> + if (ret < 0)
>> + return dev_err_probe(dev, ret, "domain attach failed\n");
>> +
>> + return 0;
>> +}
>> +
>> +static bool qcom_snps_is_fw_managed(struct qcom_snps_hsphy *hsphy)
>> +{
>> + return hsphy->pd_list != NULL;
>> +}
>> +
>> +static int qcom_snps_pds_enable_all(struct qcom_snps_hsphy *hsphy)
>> +{
>> + int ret;
>> +
>> + if (!qcom_snps_is_fw_managed(hsphy))
>> + return 0;
>
> [Severity: Low]
> Can qcom_snps_domain_attach() succeed with hsphy->pd_list left NULL when
> dev_pm_domain_attach_list() returns 0 (for example, when CONFIG_PM is
> disabled)?
>
> If that happens, qcom_snps_pds_enable_all() returns 0 without enabling the
> power domains, and qcom_snps_hsphy_fw_managed_init() proceeds to
> qcom_snps_hsphy_configure() and writes PHY registers while clocks, resets,
> and power domains are off. Also, qcom_snps_domain_attach() and
> qcom_snps_domain_detach() with devm_add_action_or_reset() in
> qcom_snps_hsphy_probe() duplicate devm_pm_domain_attach_list(); calling
> devm_pm_domain_attach_list() directly and returning -ENODEV when ret == 0
> would avoid both issues.
While I agree this can indeed happen, having a kernel on an SCMI-enabled
board such as SA8255P does not make a lot of sense. I think that other
things will break as well. If it's not strictly necessary I'd like to
avoid resending a v6 just to fix this.
Vinod, can you please let me know if I should respin to address this?
>
> --
> Sashiko AI review · https://sashiko.dev/#/patchset/20261120-phy-qcom-snps-femto-v2-8255-v5-0-86a9880ee5a5@kernel.org?part=2
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v5 2/2] phy: qcom-snps-femto-v2: Add support for SA8255P
@ 2026-11-20 14:57 ` Mattijs Korpershoek
0 siblings, 0 replies; 10+ messages in thread
From: Mattijs Korpershoek @ 2026-11-20 14:57 UTC (permalink / raw)
To: sashiko-reviews
Cc: linux-phy, devicetree, robh, conor+dt, vkoul, neil.armstrong,
olteanv
On Fri, Nov 20, 2026 at 14:11, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential
> issue to consider:
> - [Low] phy: qcom-snps-femto-v2: use devm_pm_domain_attach_list() and
> check ret == 0
> --
>
> commit 40323ed83ee6f03c36d2767d1e91cd08ccff373b
> Author: Sriram Dash <quic_sriramd@quicinc.com>
>
> phy: qcom-snps-femto-v2: Add support for SA8255P
>
> This commit adds support for the SA8255P USB HS PHY variant, whose power,
> clock, and reset resources are managed by SCMI firmware through "core" and
> "transfer" power domains.
>
>> diff --git a/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c b/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c
>> index 0dae8369671ab..0ec34bc5c26ec 100644
>> --- a/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c
>> +++ b/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c
> [ ... ]
>> @@ -164,8 +167,82 @@ struct qcom_snps_hsphy {
>> bool phy_initialized;
>> enum phy_mode mode;
>> struct phy_override_seq update_seq_cfg[NUM_HSPHY_TUNING_PARAMS];
>> +
>> + struct dev_pm_domain_list *pd_list;
>> };
>>
>> +static void qcom_snps_domain_detach(void *data)
>> +{
>> + struct qcom_snps_hsphy *hsphy = data;
>> +
>> + dev_pm_domain_detach_list(hsphy->pd_list);
>> +}
>> +
>> +static int qcom_snps_domain_attach(struct qcom_snps_hsphy *hsphy)
>> +{
>> + struct dev_pm_domain_attach_data pd_data = {
>> + .pd_flags = PD_FLAG_NO_DEV_LINK,
>> + .pd_names = (const char*[]) { "core", "transfer" },
>> + .num_pd_names = 2,
>> + };
>> + struct device *dev = hsphy->dev;
>> + int ret;
>> +
>> + ret = dev_pm_domain_attach_list(dev, &pd_data, &hsphy->pd_list);
>> + if (ret < 0)
>> + return dev_err_probe(dev, ret, "domain attach failed\n");
>> +
>> + return 0;
>> +}
>> +
>> +static bool qcom_snps_is_fw_managed(struct qcom_snps_hsphy *hsphy)
>> +{
>> + return hsphy->pd_list != NULL;
>> +}
>> +
>> +static int qcom_snps_pds_enable_all(struct qcom_snps_hsphy *hsphy)
>> +{
>> + int ret;
>> +
>> + if (!qcom_snps_is_fw_managed(hsphy))
>> + return 0;
>
> [Severity: Low]
> Can qcom_snps_domain_attach() succeed with hsphy->pd_list left NULL when
> dev_pm_domain_attach_list() returns 0 (for example, when CONFIG_PM is
> disabled)?
>
> If that happens, qcom_snps_pds_enable_all() returns 0 without enabling the
> power domains, and qcom_snps_hsphy_fw_managed_init() proceeds to
> qcom_snps_hsphy_configure() and writes PHY registers while clocks, resets,
> and power domains are off. Also, qcom_snps_domain_attach() and
> qcom_snps_domain_detach() with devm_add_action_or_reset() in
> qcom_snps_hsphy_probe() duplicate devm_pm_domain_attach_list(); calling
> devm_pm_domain_attach_list() directly and returning -ENODEV when ret == 0
> would avoid both issues.
While I agree this can indeed happen, having a kernel on an SCMI-enabled
board such as SA8255P does not make a lot of sense. I think that other
things will break as well. If it's not strictly necessary I'd like to
avoid resending a v6 just to fix this.
Vinod, can you please let me know if I should respin to address this?
>
> --
> Sashiko AI review · https://sashiko.dev/#/patchset/20261120-phy-qcom-snps-femto-v2-8255-v5-0-86a9880ee5a5@kernel.org?part=2
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2026-11-20 14:57 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-20 13:56 [PATCH v5 0/2] Add support for SA8255P in the phy-qcom-snps-femto-v2 phy driver Mattijs Korpershoek
2026-11-20 13:56 ` Mattijs Korpershoek
2026-11-20 13:56 ` [PATCH v5 1/2] dt-bindings: phy: Add sa8255p high-speed USB PHY Mattijs Korpershoek
2026-11-20 13:56 ` Mattijs Korpershoek
2026-11-20 13:56 ` [PATCH v5 2/2] phy: qcom-snps-femto-v2: Add support for SA8255P Mattijs Korpershoek
2026-11-20 13:56 ` Mattijs Korpershoek
2026-11-20 14:11 ` sashiko-bot
2026-11-20 14:11 ` sashiko-bot
2026-11-20 14:57 ` Mattijs Korpershoek
2026-11-20 14:57 ` Mattijs Korpershoek
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.