forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-31 f70575805708cabdedea7498aaa3f710fde4d920
kernel/drivers/phy/broadcom/phy-bcm-ns2-usbdrd.c
....@@ -18,6 +18,7 @@
1818 #include <linux/init.h>
1919 #include <linux/interrupt.h>
2020 #include <linux/io.h>
21
+#include <linux/iopoll.h>
2122 #include <linux/irq.h>
2223 #include <linux/mfd/syscon.h>
2324 #include <linux/module.h>
....@@ -87,17 +88,11 @@
8788 static inline int pll_lock_stat(u32 usb_reg, int reg_mask,
8889 struct ns2_phy_driver *driver)
8990 {
90
- int retry = PLL_LOCK_RETRY;
9191 u32 val;
9292
93
- do {
94
- udelay(1);
95
- val = readl(driver->icfgdrd_regs + usb_reg);
96
- if (val & reg_mask)
97
- return 0;
98
- } while (--retry > 0);
99
-
100
- return -EBUSY;
93
+ return readl_poll_timeout_atomic(driver->icfgdrd_regs + usb_reg,
94
+ val, (val & reg_mask), 1,
95
+ PLL_LOCK_RETRY);
10196 }
10297
10398 static int ns2_drd_phy_init(struct phy *phy)
....@@ -279,7 +274,7 @@
279274 return IRQ_HANDLED;
280275 }
281276
282
-static struct phy_ops ops = {
277
+static const struct phy_ops ops = {
283278 .init = ns2_drd_phy_init,
284279 .power_on = ns2_drd_phy_poweron,
285280 .power_off = ns2_drd_phy_poweroff,