diff mbox series

[2/2] usb: phy: mxs: add DT bindings to hold data line

Message ID 20230614111548.1815146-2-xu.yang_2@nxp.com
State New
Headers show
Series [1/2] dt-bindings: phy: fsl,mxs-usbphy: add fsl,hold-line-without-vbus property | expand

Commit Message

Xu Yang June 14, 2023, 11:15 a.m. UTC
Whether the data line is disconnected when vbus is not present is related
to whether the platform data set MXS_PHY_DISCONNECT_LINE_WITHOUT_VBUS
flag. This will provide a override from dts node if the user want to hold
the data line when vbus is not present.

Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
---
 drivers/usb/phy/phy-mxs-usb.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c
index e1a2b2ea098b..036bb58a3a71 100644
--- a/drivers/usb/phy/phy-mxs-usb.c
+++ b/drivers/usb/phy/phy-mxs-usb.c
@@ -199,7 +199,7 @@  MODULE_DEVICE_TABLE(of, mxs_phy_dt_ids);
 struct mxs_phy {
 	struct usb_phy phy;
 	struct clk *clk;
-	const struct mxs_phy_data *data;
+	struct mxs_phy_data *data;
 	struct regmap *regmap_anatop;
 	int port_id;
 	u32 tx_reg_set;
@@ -774,6 +774,11 @@  static int mxs_phy_probe(struct platform_device *pdev)
 		mxs_phy->tx_reg_set  |= GM_USBPHY_TX_D_CAL(val);
 	}
 
+	mxs_phy->data = (struct mxs_phy_data *)of_device_get_match_data(&pdev->dev);
+
+	if (of_property_present(np, "fsl,hold-line-without-vbus"))
+		mxs_phy->data->flags &= ~MXS_PHY_DISCONNECT_LINE_WITHOUT_VBUS;
+
 	ret = of_alias_get_id(np, "usbphy");
 	if (ret < 0)
 		dev_dbg(&pdev->dev, "failed to get alias id, errno %d\n", ret);
@@ -792,7 +797,6 @@  static int mxs_phy_probe(struct platform_device *pdev)
 	mxs_phy->phy.charger_detect	= mxs_phy_charger_detect;
 
 	mxs_phy->clk = clk;
-	mxs_phy->data = of_device_get_match_data(&pdev->dev);
 
 	platform_set_drvdata(pdev, mxs_phy);