forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-04 1543e317f1da31b75942316931e8f491a8920811
kernel/drivers/usb/dwc3/ulpi.c
....@@ -1,5 +1,5 @@
11 // SPDX-License-Identifier: GPL-2.0
2
-/**
2
+/*
33 * ulpi.c - DesignWare USB3 Controller's ULPI PHY interface
44 *
55 * Copyright (C) 2015 Intel Corporation
....@@ -24,7 +24,7 @@
2424 static int dwc3_ulpi_busyloop(struct dwc3 *dwc, u8 addr, bool read)
2525 {
2626 unsigned long ns = 5L * DWC3_ULPI_BASE_DELAY;
27
- unsigned int count = 1000;
27
+ unsigned int count = 10000;
2828 u32 reg;
2929
3030 if (addr >= ULPI_EXT_VENDOR_SPECIFIC)
....@@ -32,6 +32,10 @@
3232
3333 if (read)
3434 ns += DWC3_ULPI_BASE_DELAY;
35
+
36
+ reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0));
37
+ if (reg & DWC3_GUSB2PHYCFG_SUSPHY)
38
+ usleep_range(1000, 1200);
3539
3640 while (count--) {
3741 ndelay(ns);
....@@ -50,12 +54,6 @@
5054 u32 reg;
5155 int ret;
5256
53
- reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0));
54
- if (reg & DWC3_GUSB2PHYCFG_SUSPHY) {
55
- reg &= ~DWC3_GUSB2PHYCFG_SUSPHY;
56
- dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg);
57
- }
58
-
5957 reg = DWC3_GUSB2PHYACC_NEWREGREQ | DWC3_ULPI_ADDR(addr);
6058 dwc3_writel(dwc->regs, DWC3_GUSB2PHYACC(0), reg);
6159
....@@ -72,12 +70,6 @@
7270 {
7371 struct dwc3 *dwc = dev_get_drvdata(dev);
7472 u32 reg;
75
-
76
- reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0));
77
- if (reg & DWC3_GUSB2PHYCFG_SUSPHY) {
78
- reg &= ~DWC3_GUSB2PHYCFG_SUSPHY;
79
- dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg);
80
- }
8173
8274 reg = DWC3_GUSB2PHYACC_NEWREGREQ | DWC3_ULPI_ADDR(addr);
8375 reg |= DWC3_GUSB2PHYACC_WRITE | val;