All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 1/3] usb: dwc2: reset AHB hclk domain before init
@ 2015-08-11  7:56 ` Yunzhi Li
  0 siblings, 0 replies; 12+ messages in thread
From: Yunzhi Li @ 2015-08-11  7:56 UTC (permalink / raw)
  To: jwerner-F7+t8E8rja9g9hUCZPvPmw, dianders-F7+t8E8rja9g9hUCZPvPmw
  Cc: huangtao-TNX95d0MmH7DzftRWevZcw, cf-TNX95d0MmH7DzftRWevZcw,
	hl-TNX95d0MmH7DzftRWevZcw, wulf-TNX95d0MmH7DzftRWevZcw,
	gregory.herrero-ral2JQCrhuEAvxtiuMwx3w,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Yunzhi Li,
	John Youn, Greg Kroah-Hartman, linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

We initiate dwc2 usb controller in BIOS, when kernel driver
start-up we should reset AHB hclk domain to reset all AHB
interface registers to default. Without this the FIFO value
setting might be incorrect because calculating FIFO size need the
power-on value of GRXFSIZ/GNPTXFSIZ/HPTXFSIZ registers.

This patch could avoid warnning massage like in rk3288 platform:
[    2.074764] dwc2 ff580000.usb: 256 invalid for
host_perio_tx_fifo_size. Check HW configuration.

Signed-off-by: Yunzhi Li <lyz-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
---

 drivers/usb/dwc2/platform.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c
index 9093530..ec6bf6b 100644
--- a/drivers/usb/dwc2/platform.c
+++ b/drivers/usb/dwc2/platform.c
@@ -42,6 +42,7 @@
 #include <linux/of_device.h>
 #include <linux/mutex.h>
 #include <linux/platform_device.h>
+#include <linux/reset.h>
 
 #include <linux/usb/of.h>
 
@@ -165,6 +166,7 @@ static int dwc2_driver_probe(struct platform_device *dev)
 	struct resource *res;
 	struct phy *phy;
 	struct usb_phy *uphy;
+	struct reset_control *rst;
 	int retval;
 	int irq;
 
@@ -189,6 +191,16 @@ static int dwc2_driver_probe(struct platform_device *dev)
 
 	hsotg->dev = &dev->dev;
 
+	/* AHB hclk domain reset, set all AHB interface registers to default */
+	rst = devm_reset_control_get_optional(&dev->dev, "ahb");
+	if (IS_ERR(rst)) {
+		dev_dbg(&dev->dev, "Can't get dwc2 AHB reset\n");
+	} else {
+		reset_control_assert(rst);
+		udelay(5);
+		reset_control_deassert(rst);
+	}
+
 	/*
 	 * Use reasonable defaults so platforms don't have to provide these.
 	 */
-- 
2.0.0


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2015-08-18  9:44 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-11  7:56 [PATCH v1 1/3] usb: dwc2: reset AHB hclk domain before init Yunzhi Li
2015-08-11  7:56 ` Yunzhi Li
2015-08-11  7:56 ` [PATCH v1 2/3] Documentation: dt-bindings: add dt binding info for dwc2 reset control Yunzhi Li
     [not found]   ` <1439279787-26674-2-git-send-email-lyz-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2015-08-11 15:20     ` Doug Anderson
2015-08-11 15:20       ` Doug Anderson
2015-08-11  7:56 ` [PATCH v1 3/3] ARM: dts: rockchip: add dwc2 ahb reset property for rk3288 Yunzhi Li
2015-08-14  0:09 ` [PATCH v1 1/3] usb: dwc2: reset AHB hclk domain before init John Youn
     [not found]   ` <2B3535C5ECE8B5419E3ECBE300772909017528DC44-Yu2iAY70zvrYN67daEjeMPufCSb+aD3WLzEdoUbNIic@public.gmane.org>
2015-08-14  3:28     ` Yunzhi Li
2015-08-14  3:28       ` Yunzhi Li
2015-08-14 19:41       ` John Youn
2015-08-14 19:41         ` John Youn
2015-08-18  9:44         ` Yunzhi Li

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.