wlan-ap-Telecominfraproject/feeds/qca-wifi-7/ipq53xx/patches-6.1/0309-drivers-usb-dwc3-Add-support-to-multiplexed-phy.patch
John Crispin 68cf54d9f7 qca-wifi-7: update to ath12.5.5
Signed-off-by: John Crispin <john@phrozen.org>
2025-02-27 12:45:52 +01:00

115 lines
3.1 KiB
Diff

From 2786a888620c8193dfed903bcc118c0dcbadf25b Mon Sep 17 00:00:00 2001
From: Timple Raj M <quic_timple@quicinc.com>
Date: Thu, 15 Jun 2023 22:15:46 +0530
Subject: [PATCH] drivers: usb: dwc3: Add support to multiplexed phy
Change-Id: Ib37af9a3cdeda35581291ec2133753a732be2571
Signed-off-by: Timple Raj M <quic_timple@quicinc.com>
---
drivers/usb/dwc3/dwc3-qcom.c | 54 +++++++++++++++++++++++++++++++++++-
1 file changed, 53 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
index 959fc925ca7c..7ba76e97c440 100644
--- a/drivers/usb/dwc3/dwc3-qcom.c
+++ b/drivers/usb/dwc3/dwc3-qcom.c
@@ -22,6 +22,8 @@
#include <linux/iopoll.h>
#include <linux/usb/hcd.h>
#include <linux/usb.h>
+#include <linux/regmap.h>
+#include <linux/mfd/syscon.h>
#include "core.h"
/* USB QSCRATCH Hardware registers */
@@ -89,6 +91,9 @@ struct dwc3_qcom {
enum usb_dr_mode mode;
bool is_suspended;
bool pm_suspended;
+ bool phy_mux;
+ struct regmap *phy_mux_map;
+ u32 phy_mux_reg;
struct icc_path *icc_path_ddr;
struct icc_path *icc_path_apps;
};
@@ -785,6 +790,39 @@ dwc3_qcom_create_urs_usb_platdev(struct device *dev)
return acpi_create_platform_device(adev, NULL);
}
+static int dwc3_qcom_phy_sel(struct dwc3_qcom *qcom)
+{
+ struct of_phandle_args args;
+ int ret;
+
+ ret = of_parse_phandle_with_fixed_args(qcom->dev->of_node,
+ "qcom,phy-mux-regs", 1, 0, &args);
+ if (ret) {
+ dev_err(qcom->dev, "failed to parse qcom,phy-mux-regs\n");
+ return ret;
+ }
+
+ qcom->phy_mux_map = syscon_node_to_regmap(args.np);
+ of_node_put(args.np);
+ if (IS_ERR(qcom->phy_mux_map)) {
+ pr_err("phy mux regs map failed:%ld\n",
+ PTR_ERR(qcom->phy_mux_map));
+ return PTR_ERR(qcom->phy_mux_map);
+ }
+
+ qcom->phy_mux_reg = args.args[0];
+ /*usb phy mux sel*/
+ ret = regmap_write(qcom->phy_mux_map, qcom->phy_mux_reg, 0x1);
+ if (ret) {
+ dev_err(qcom->dev,
+ "Not able to configure phy mux selection:%d\n", ret);
+ return ret;
+ }
+
+ return 0;
+}
+
+
static int dwc3_qcom_probe(struct platform_device *pdev)
{
struct device_node *np = pdev->dev.of_node;
@@ -810,6 +848,11 @@ static int dwc3_qcom_probe(struct platform_device *pdev)
}
}
+ qcom->phy_mux = device_property_read_bool(dev,
+ "qcom,multiplexed-phy");
+ if (qcom->phy_mux)
+ dwc3_qcom_phy_sel(qcom);
+
qcom->resets = devm_reset_control_array_get_optional_exclusive(dev);
if (IS_ERR(qcom->resets)) {
ret = PTR_ERR(qcom->resets);
@@ -942,7 +985,7 @@ static int dwc3_qcom_remove(struct platform_device *pdev)
{
struct dwc3_qcom *qcom = platform_get_drvdata(pdev);
struct device *dev = &pdev->dev;
- int i;
+ int i, ret;
device_remove_software_node(&qcom->dwc3->dev);
of_platform_depopulate(dev);
@@ -956,6 +999,15 @@ static int dwc3_qcom_remove(struct platform_device *pdev)
dwc3_qcom_interconnect_exit(qcom);
reset_control_assert(qcom->resets);
+ if (qcom->phy_mux) {
+ /*usb phy mux deselection*/
+ ret = regmap_write(qcom->phy_mux_map, qcom->phy_mux_reg,
+ 0x0);
+ if (ret)
+ dev_err(qcom->dev,
+ "Not able to configure phy mux selection:%d\n", ret);
+ }
+
pm_runtime_allow(dev);
pm_runtime_disable(dev);
--
2.34.1