forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-11 04dd17822334871b23ea2862f7798fb0e0007777
kernel/drivers/phy/lantiq/phy-lantiq-rcu-usb2.c
....@@ -1,12 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Lantiq XWAY SoC RCU module based USB 1.1/2.0 PHY driver
34 *
45 * Copyright (C) 2016 Martin Blumenstingl <martin.blumenstingl@googlemail.com>
56 * Copyright (C) 2017 Hauke Mehrtens <hauke@hauke-m.de>
6
- *
7
- * This program is free software; you can redistribute it and/or modify
8
- * it under the terms of the GNU General Public License version 2 as
9
- * published by the Free Software Foundation.
107 */
118
129 #include <linux/clk.h>
....@@ -127,8 +124,16 @@
127124 reset_control_deassert(priv->phy_reset);
128125
129126 ret = clk_prepare_enable(priv->phy_gate_clk);
130
- if (ret)
127
+ if (ret) {
131128 dev_err(dev, "failed to enable PHY gate\n");
129
+ return ret;
130
+ }
131
+
132
+ /*
133
+ * at least the xrx200 usb2 phy requires some extra time to be
134
+ * operational after enabling the clock
135
+ */
136
+ usleep_range(100, 200);
132137
133138 return ret;
134139 }
....@@ -144,7 +149,7 @@
144149 return 0;
145150 }
146151
147
-static struct phy_ops ltq_rcu_usb2_phy_ops = {
152
+static const struct phy_ops ltq_rcu_usb2_phy_ops = {
148153 .init = ltq_rcu_usb2_phy_init,
149154 .power_on = ltq_rcu_usb2_phy_power_on,
150155 .power_off = ltq_rcu_usb2_phy_power_off,
....@@ -195,10 +200,8 @@
195200 }
196201
197202 priv->phy_reset = devm_reset_control_get_optional(dev, "phy");
198
- if (IS_ERR(priv->phy_reset))
199
- return PTR_ERR(priv->phy_reset);
200203
201
- return 0;
204
+ return PTR_ERR_OR_ZERO(priv->phy_reset);
202205 }
203206
204207 static int ltq_rcu_usb2_phy_probe(struct platform_device *pdev)