mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 0/5] i.MX USB PHY fixes
@ 2019-05-20 18:23 Andrey Smirnov
  2019-05-20 18:23 ` [PATCH 1/5] usb: imx-usb-phy: Import register definitions from Linux driver Andrey Smirnov
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Andrey Smirnov @ 2019-05-20 18:23 UTC (permalink / raw)
  To: barebox; +Cc: Andrey Smirnov

Everyone:

This is a small series of patches I made while investigating USB issue
on RDU2 board. First three patches are just optional improvements. The
actual fix is in "usb: imx-usb-phy: Disable charger detect during
initialization" and "ARM: i.MX: Drop unused usb-imx6.c" removes some
abandoned code. Hopefully each patch is self-explanatory.

Feedback is welcome!

Thanks,
Andrey Smirnov

Andrey Smirnov (5):
  usb: imx-usb-phy: Import register definitions from Linux driver
  usb: imx-usb-phy: Wrap lines to silence checkpatch
  usb: imx-usb-phy: Use stmp_reset_block() to reset PHY
  usb: imx-usb-phy: Disable charger detect during initialization
  ARM: i.MX: Drop unused usb-imx6.c

 arch/arm/mach-imx/Makefile    |   2 +-
 arch/arm/mach-imx/usb-imx6.c  | 111 ----------------------------------
 drivers/usb/imx/imx-usb-phy.c |  87 ++++++++++++++++++--------
 3 files changed, 62 insertions(+), 138 deletions(-)
 delete mode 100644 arch/arm/mach-imx/usb-imx6.c

-- 
2.21.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 1/5] usb: imx-usb-phy: Import register definitions from Linux driver
  2019-05-20 18:23 [PATCH 0/5] i.MX USB PHY fixes Andrey Smirnov
@ 2019-05-20 18:23 ` Andrey Smirnov
  2019-05-20 18:23 ` [PATCH 2/5] usb: imx-usb-phy: Wrap lines to silence checkpatch Andrey Smirnov
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Andrey Smirnov @ 2019-05-20 18:23 UTC (permalink / raw)
  To: barebox; +Cc: Andrey Smirnov

Import register definitions from Linux driver to simplify
comparing/sharing code a bit. No functional change intended.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
 drivers/usb/imx/imx-usb-phy.c | 35 ++++++++++++++++++-----------------
 1 file changed, 18 insertions(+), 17 deletions(-)

diff --git a/drivers/usb/imx/imx-usb-phy.c b/drivers/usb/imx/imx-usb-phy.c
index 274153bd5..df7e192d3 100644
--- a/drivers/usb/imx/imx-usb-phy.c
+++ b/drivers/usb/imx/imx-usb-phy.c
@@ -24,16 +24,17 @@
 #include <linux/clk.h>
 #include <linux/err.h>
 
-#define SET				0x4
-#define CLR				0x8
-
-#define USBPHY_CTRL			0x30
+#define HW_USBPHY_PWD				0x00
+#define HW_USBPHY_TX				0x10
+#define HW_USBPHY_CTRL				0x30
+#define HW_USBPHY_CTRL_SET			0x34
+#define HW_USBPHY_CTRL_CLR			0x38
 
 #define USBPHY_CTRL_SFTRST		(1 << 31)
 #define USBPHY_CTRL_CLKGATE		(1 << 30)
-#define USBPHY_CTRL_ENUTMILEVEL3	(1 << 15)
-#define USBPHY_CTRL_ENUTMILEVEL2	(1 << 14)
-#define USBPHY_CTRL_ENHOSTDISCONDETECT	(1 << 1)
+#define BM_USBPHY_CTRL_ENUTMILEVEL3		BIT(15)
+#define BM_USBPHY_CTRL_ENUTMILEVEL2		BIT(14)
+#define BM_USBPHY_CTRL_ENHOSTDISCONDETECT	BIT(1)
 
 struct imx_usbphy {
 	struct usb_phy usb_phy;
@@ -50,20 +51,20 @@ static int imx_usbphy_phy_init(struct phy *phy)
 	clk_enable(imxphy->clk);
 
 	/* reset usbphy */
-	writel(USBPHY_CTRL_SFTRST, imxphy->base + USBPHY_CTRL + SET);
+	writel(USBPHY_CTRL_SFTRST, imxphy->base + HW_USBPHY_CTRL_SET);
 
 	udelay(10);
 
 	/* clr reset and clkgate */
 	writel(USBPHY_CTRL_SFTRST | USBPHY_CTRL_CLKGATE,
-			imxphy->base + USBPHY_CTRL + CLR);
+			imxphy->base + HW_USBPHY_CTRL_CLR);
 
-	/* clr all pwd bits => power up phy */
-	writel(0xffffffff, imxphy->base + CLR);
+	/* Power up the PHY */
+	writel(0, imxphy->base + HW_USBPHY_PWD);
 
 	/* set utmilvl2/3 */
-	writel(USBPHY_CTRL_ENUTMILEVEL3 | USBPHY_CTRL_ENUTMILEVEL2,
-	       imxphy->base + USBPHY_CTRL + SET);
+	writel(BM_USBPHY_CTRL_ENUTMILEVEL3 | BM_USBPHY_CTRL_ENUTMILEVEL2,
+	       imxphy->base + HW_USBPHY_CTRL_SET);
 
 	return 0;
 }
@@ -74,8 +75,8 @@ static int imx_usbphy_notify_connect(struct usb_phy *phy,
 	struct imx_usbphy *imxphy = container_of(phy, struct imx_usbphy, usb_phy);
 
 	if (speed == USB_SPEED_HIGH) {
-		writel(USBPHY_CTRL_ENHOSTDISCONDETECT,
-		       imxphy->base + USBPHY_CTRL + SET);
+		writel(BM_USBPHY_CTRL_ENHOSTDISCONDETECT,
+		       imxphy->base + HW_USBPHY_CTRL_SET);
 	}
 
 	return 0;
@@ -86,8 +87,8 @@ static int imx_usbphy_notify_disconnect(struct usb_phy *phy,
 {
 	struct imx_usbphy *imxphy = container_of(phy, struct imx_usbphy, usb_phy);
 
-	writel(USBPHY_CTRL_ENHOSTDISCONDETECT,
-	       imxphy->base + USBPHY_CTRL + CLR);
+	writel(BM_USBPHY_CTRL_ENHOSTDISCONDETECT,
+	       imxphy->base + HW_USBPHY_CTRL_CLR);
 
 	return 0;
 }
-- 
2.21.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 2/5] usb: imx-usb-phy: Wrap lines to silence checkpatch
  2019-05-20 18:23 [PATCH 0/5] i.MX USB PHY fixes Andrey Smirnov
  2019-05-20 18:23 ` [PATCH 1/5] usb: imx-usb-phy: Import register definitions from Linux driver Andrey Smirnov
@ 2019-05-20 18:23 ` Andrey Smirnov
  2019-05-20 18:24 ` [PATCH 3/5] usb: imx-usb-phy: Use stmp_reset_block() to reset PHY Andrey Smirnov
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Andrey Smirnov @ 2019-05-20 18:23 UTC (permalink / raw)
  To: barebox; +Cc: Andrey Smirnov

Those two line are the only thing that checkpatch is complaining
about. Wrap them to slince it. No functional change intended.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
 drivers/usb/imx/imx-usb-phy.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/imx/imx-usb-phy.c b/drivers/usb/imx/imx-usb-phy.c
index df7e192d3..01bf04b67 100644
--- a/drivers/usb/imx/imx-usb-phy.c
+++ b/drivers/usb/imx/imx-usb-phy.c
@@ -72,7 +72,8 @@ static int imx_usbphy_phy_init(struct phy *phy)
 static int imx_usbphy_notify_connect(struct usb_phy *phy,
 				     enum usb_device_speed speed)
 {
-	struct imx_usbphy *imxphy = container_of(phy, struct imx_usbphy, usb_phy);
+	struct imx_usbphy *imxphy = container_of(phy, struct imx_usbphy,
+						 usb_phy);
 
 	if (speed == USB_SPEED_HIGH) {
 		writel(BM_USBPHY_CTRL_ENHOSTDISCONDETECT,
@@ -85,7 +86,8 @@ static int imx_usbphy_notify_connect(struct usb_phy *phy,
 static int imx_usbphy_notify_disconnect(struct usb_phy *phy,
 					enum usb_device_speed speed)
 {
-	struct imx_usbphy *imxphy = container_of(phy, struct imx_usbphy, usb_phy);
+	struct imx_usbphy *imxphy = container_of(phy, struct imx_usbphy,
+						 usb_phy);
 
 	writel(BM_USBPHY_CTRL_ENHOSTDISCONDETECT,
 	       imxphy->base + HW_USBPHY_CTRL_CLR);
-- 
2.21.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 3/5] usb: imx-usb-phy: Use stmp_reset_block() to reset PHY
  2019-05-20 18:23 [PATCH 0/5] i.MX USB PHY fixes Andrey Smirnov
  2019-05-20 18:23 ` [PATCH 1/5] usb: imx-usb-phy: Import register definitions from Linux driver Andrey Smirnov
  2019-05-20 18:23 ` [PATCH 2/5] usb: imx-usb-phy: Wrap lines to silence checkpatch Andrey Smirnov
@ 2019-05-20 18:24 ` Andrey Smirnov
  2019-05-20 18:24 ` [PATCH 4/5] usb: imx-usb-phy: Disable charger detect during initialization Andrey Smirnov
  2019-05-20 18:24 ` [PATCH 5/5] ARM: i.MX: Drop unused usb-imx6.c Andrey Smirnov
  4 siblings, 0 replies; 9+ messages in thread
From: Andrey Smirnov @ 2019-05-20 18:24 UTC (permalink / raw)
  To: barebox; +Cc: Andrey Smirnov

Upstream kernel driver uses stmp_reset_block() to reset the PHY, so
convert the code to do so as well to save some code and sync both
drivers.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
 drivers/usb/imx/imx-usb-phy.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/drivers/usb/imx/imx-usb-phy.c b/drivers/usb/imx/imx-usb-phy.c
index 01bf04b67..306f84374 100644
--- a/drivers/usb/imx/imx-usb-phy.c
+++ b/drivers/usb/imx/imx-usb-phy.c
@@ -23,6 +23,7 @@
 #include <linux/phy/phy.h>
 #include <linux/clk.h>
 #include <linux/err.h>
+#include <stmp-device.h>
 
 #define HW_USBPHY_PWD				0x00
 #define HW_USBPHY_TX				0x10
@@ -30,8 +31,6 @@
 #define HW_USBPHY_CTRL_SET			0x34
 #define HW_USBPHY_CTRL_CLR			0x38
 
-#define USBPHY_CTRL_SFTRST		(1 << 31)
-#define USBPHY_CTRL_CLKGATE		(1 << 30)
 #define BM_USBPHY_CTRL_ENUTMILEVEL3		BIT(15)
 #define BM_USBPHY_CTRL_ENUTMILEVEL2		BIT(14)
 #define BM_USBPHY_CTRL_ENHOSTDISCONDETECT	BIT(1)
@@ -47,17 +46,13 @@ struct imx_usbphy {
 static int imx_usbphy_phy_init(struct phy *phy)
 {
 	struct imx_usbphy *imxphy = phy_get_drvdata(phy);
+	int ret;
 
 	clk_enable(imxphy->clk);
 
-	/* reset usbphy */
-	writel(USBPHY_CTRL_SFTRST, imxphy->base + HW_USBPHY_CTRL_SET);
-
-	udelay(10);
-
-	/* clr reset and clkgate */
-	writel(USBPHY_CTRL_SFTRST | USBPHY_CTRL_CLKGATE,
-			imxphy->base + HW_USBPHY_CTRL_CLR);
+	ret = stmp_reset_block(imxphy->base + HW_USBPHY_CTRL, false);
+	if (ret)
+		return ret;
 
 	/* Power up the PHY */
 	writel(0, imxphy->base + HW_USBPHY_PWD);
-- 
2.21.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 4/5] usb: imx-usb-phy: Disable charger detect during initialization
  2019-05-20 18:23 [PATCH 0/5] i.MX USB PHY fixes Andrey Smirnov
                   ` (2 preceding siblings ...)
  2019-05-20 18:24 ` [PATCH 3/5] usb: imx-usb-phy: Use stmp_reset_block() to reset PHY Andrey Smirnov
@ 2019-05-20 18:24 ` Andrey Smirnov
  2019-05-20 18:24 ` [PATCH 5/5] ARM: i.MX: Drop unused usb-imx6.c Andrey Smirnov
  4 siblings, 0 replies; 9+ messages in thread
From: Andrey Smirnov @ 2019-05-20 18:24 UTC (permalink / raw)
  To: barebox; +Cc: Andrey Smirnov

I can't find any erratas this is in refernce to, but apparently
external changer detector needs to be disabled to prevent poor USB
data signal quality. The problem manifest itself as a intermittent USB
transfer corruption that happens to some device under and only under
specific circumstances.

In my case the failure was observed with Transcent SD/micro-SD card
reader (05e3:0745 Genesys Logic, Inc. Logilink CR0012) when connected
directly to front panel USB of ZII RDU2 board (the problem would go
away if device was conntecte via a hub/USB-analyzer/male-female
type A extender cable).

Note that this fix is present in Linux kernel as well as some
abandoned Barebox code removed in the next patch.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
 drivers/usb/imx/imx-usb-phy.c | 37 +++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/drivers/usb/imx/imx-usb-phy.c b/drivers/usb/imx/imx-usb-phy.c
index 306f84374..d4562285c 100644
--- a/drivers/usb/imx/imx-usb-phy.c
+++ b/drivers/usb/imx/imx-usb-phy.c
@@ -24,6 +24,7 @@
 #include <linux/clk.h>
 #include <linux/err.h>
 #include <stmp-device.h>
+#include <mfd/syscon.h>
 
 #define HW_USBPHY_PWD				0x00
 #define HW_USBPHY_TX				0x10
@@ -35,12 +36,19 @@
 #define BM_USBPHY_CTRL_ENUTMILEVEL2		BIT(14)
 #define BM_USBPHY_CTRL_ENHOSTDISCONDETECT	BIT(1)
 
+#define ANADIG_USB1_CHRG_DETECT_SET		0x1b4
+#define ANADIG_USB2_CHRG_DETECT_SET		0x214
+#define ANADIG_USB1_CHRG_DETECT_EN_B		BIT(20)
+#define ANADIG_USB1_CHRG_DETECT_CHK_CHRG_B	BIT(19)
+
 struct imx_usbphy {
 	struct usb_phy usb_phy;
 	struct phy *phy;
 	void __iomem *base;
+	void __iomem *anatop;
 	struct clk *clk;
 	struct phy_provider *provider;
+	int port_id;
 };
 
 static int imx_usbphy_phy_init(struct phy *phy)
@@ -61,6 +69,19 @@ static int imx_usbphy_phy_init(struct phy *phy)
 	writel(BM_USBPHY_CTRL_ENUTMILEVEL3 | BM_USBPHY_CTRL_ENUTMILEVEL2,
 	       imxphy->base + HW_USBPHY_CTRL_SET);
 
+	if (imxphy->anatop) {
+		unsigned int reg = imxphy->port_id ?
+			ANADIG_USB1_CHRG_DETECT_SET :
+			ANADIG_USB2_CHRG_DETECT_SET;
+		/*
+		 * The external charger detector needs to be disabled,
+		 * or the signal at DP will be poor
+		 */
+		writel(ANADIG_USB1_CHRG_DETECT_EN_B |
+		       ANADIG_USB1_CHRG_DETECT_CHK_CHRG_B,
+		       imxphy->anatop + reg);
+	}
+
 	return 0;
 }
 
@@ -113,11 +134,27 @@ static const struct phy_ops imx_phy_ops = {
 static int imx_usbphy_probe(struct device_d *dev)
 {
 	struct resource *iores;
+	struct device_node *np = dev->device_node;
 	int ret;
 	struct imx_usbphy *imxphy;
 
 	imxphy = xzalloc(sizeof(*imxphy));
 
+	ret = of_alias_get_id(np, "usbphy");
+	if (ret < 0) {
+		dev_dbg(dev, "failed to get alias id, errno %d\n", ret);
+		goto err_free;
+	}
+	imxphy->port_id = ret;
+
+	if (of_get_property(np, "fsl,anatop", NULL)) {
+		imxphy->anatop =
+			syscon_base_lookup_by_phandle(np, "fsl,anatop");
+		ret = PTR_ERR_OR_ZERO(imxphy->anatop);
+		if (ret)
+			goto err_free;
+	}
+
 	iores = dev_request_mem_resource(dev, 0);
 	if (IS_ERR(iores)) {
 		ret = PTR_ERR(iores);
-- 
2.21.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 5/5] ARM: i.MX: Drop unused usb-imx6.c
  2019-05-20 18:23 [PATCH 0/5] i.MX USB PHY fixes Andrey Smirnov
                   ` (3 preceding siblings ...)
  2019-05-20 18:24 ` [PATCH 4/5] usb: imx-usb-phy: Disable charger detect during initialization Andrey Smirnov
@ 2019-05-20 18:24 ` Andrey Smirnov
  2019-05-21  9:37   ` Sascha Hauer
  4 siblings, 1 reply; 9+ messages in thread
From: Andrey Smirnov @ 2019-05-20 18:24 UTC (permalink / raw)
  To: barebox; +Cc: Andrey Smirnov

Looks like usb-imx6.c was abandoned and there are no references to
either of the functions difined there. Drop it.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
 arch/arm/mach-imx/Makefile   |   2 +-
 arch/arm/mach-imx/usb-imx6.c | 111 -----------------------------------
 2 files changed, 1 insertion(+), 112 deletions(-)
 delete mode 100644 arch/arm/mach-imx/usb-imx6.c

diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
index b86025cc3..b16de2866 100644
--- a/arch/arm/mach-imx/Makefile
+++ b/arch/arm/mach-imx/Makefile
@@ -10,7 +10,7 @@ obj-$(CONFIG_ARCH_IMX51) += imx51.o imx5.o
 pbl-$(CONFIG_ARCH_IMX51) += imx51.o imx5.o
 obj-$(CONFIG_ARCH_IMX53) += imx53.o imx5.o esdctl-v4.o
 pbl-$(CONFIG_ARCH_IMX53) += imx53.o imx5.o esdctl-v4.o
-obj-$(CONFIG_ARCH_IMX6) += imx6.o usb-imx6.o
+obj-$(CONFIG_ARCH_IMX6) += imx6.o
 CFLAGS_imx6.o := -march=armv7-a
 lwl-$(CONFIG_ARCH_IMX6) += imx6-mmdc.o
 obj-$(CONFIG_ARCH_IMX7) += imx7.o
diff --git a/arch/arm/mach-imx/usb-imx6.c b/arch/arm/mach-imx/usb-imx6.c
deleted file mode 100644
index 4236bcb77..000000000
--- a/arch/arm/mach-imx/usb-imx6.c
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright (C) 2012 Steffen Trumtrar, Pengutronix
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation.
- *
- */
-
-#include <common.h>
-#include <io.h>
-#include <mach/imx6-regs.h>
-#include <mach/usb.h>
-
-#define SET				0x4
-#define CLR				0x8
-
-#define USBPHY_CTRL			0x30
-#define USB_OTG_CTRL			0x800
-#define USB_UH1_CTRL			0x804
-#define USB_UH2_CTRL			0x808
-#define USB_UH3_CTRL			0x80c
-
-#define USB_UH1_USBCMD			0x340
-
-#define USB_CMD_RUNSTOP			(1 <<  0)
-
-#define USB_OVER_CUR_DIS		(1 <<  7)
-#define USBPHY_CTRL_SFTRST		(1 << 31)
-#define USBPHY_CTRL_CLKGATE		(1 << 30)
-#define USBPHY_CTRL_ENUTMILEVEL3	(1 << 15)
-#define USBPHY_CTRL_ENUTMILEVEL2	(1 << 14)
-
-#define USBPHY1_PLL_480_CTRL_EN		(1 << 13)
-#define USBPHY1_PLL_480_CTRL_POWER	(1 << 12)
-#define USBPHY1_PLL_480_CTRL_EN_USB_CLK	(1 <<  6)
-#define USBPHY1_PLL_480_CTRL_BYPASS	(1 << 16)
-
-int imx6_usb_phy2_disable_oc(void)
-{
-	int val;
-
-	/* disable over current detection */
-	val = readl(MX6_USBOH3_USB_BASE_ADDR + USB_UH1_CTRL);
-	val |= USB_OVER_CUR_DIS;
-	writel(val, MX6_USBOH3_USB_BASE_ADDR + USB_UH1_CTRL);
-	val = readl(MX6_USBOH3_USB_BASE_ADDR + USB_UH2_CTRL);
-	val |= USB_OVER_CUR_DIS;
-	writel(val, MX6_USBOH3_USB_BASE_ADDR + USB_UH2_CTRL);
-	val = readl(MX6_USBOH3_USB_BASE_ADDR + USB_UH3_CTRL);
-	val |= USB_OVER_CUR_DIS;
-	writel(val, MX6_USBOH3_USB_BASE_ADDR + USB_UH3_CTRL);
-
-	return 0;
-}
-
-int imx6_usb_phy2_enable(void)
-{
-	int val;
-
-	/* disable external charger detector or DP will be poor */
-	writel(0x00180000, MX6_ANATOP_BASE_ADDR + 0x1b0);
-	writel(0x00180000, MX6_ANATOP_BASE_ADDR + 0x210);
-
-	/* enable usb pll */
-	writel(USBPHY1_PLL_480_CTRL_EN |
-	       USBPHY1_PLL_480_CTRL_POWER |
-	       USBPHY1_PLL_480_CTRL_EN_USB_CLK, MX6_ANATOP_BASE_ADDR + 0x24);
-
-	/* turn OFF clk bypass */
-	/* at least on imx6 v1.0 this essential for usb to work */
-	/* FIXME: test on v1.1. Datasheet declares bit as reserved */
-	writel(USBPHY1_PLL_480_CTRL_BYPASS, MX6_ANATOP_BASE_ADDR + 0x28);
-
-	/* stop then reset */
-	val = readl(MX6_USBOH3_USB_BASE_ADDR + USB_UH1_USBCMD);
-	val &= ~USB_CMD_RUNSTOP;
-	writel(val, MX6_USBOH3_USB_BASE_ADDR + USB_UH1_USBCMD);
-	while (readl(MX6_USBOH3_USB_BASE_ADDR + USB_UH1_USBCMD) & USB_CMD_RUNSTOP);
-
-	val = readl(MX6_USBOH3_USB_BASE_ADDR + USB_UH1_USBCMD);
-	val |= USB_CMD_RESET;
-	writel(val, MX6_USBOH3_USB_BASE_ADDR + USB_UH1_USBCMD);
-	while (readl(MX6_USBOH3_USB_BASE_ADDR + USB_UH1_USBCMD) & USB_CMD_RESET);
-
-	/* reset usbphy */
-	writel(USBPHY_CTRL_SFTRST, MX6_USBPHY2_BASE_ADDR + USBPHY_CTRL + SET);
-	udelay(10);
-	/* clr reset and clkgate */
-	writel(USBPHY_CTRL_SFTRST | USBPHY_CTRL_CLKGATE, MX6_USBPHY2_BASE_ADDR + USBPHY_CTRL + CLR);
-
-	/* clr all pwd bits => power up phy */
-	writel(0xffffffff, MX6_USBPHY2_BASE_ADDR + CLR);
-
-	/* set utmilvl2/3 */
-	val = readl(MX6_USBPHY2_BASE_ADDR + USBPHY_CTRL);
-	val |= USBPHY_CTRL_ENUTMILEVEL3 | USBPHY_CTRL_ENUTMILEVEL2;
-	writel(val, MX6_USBPHY2_BASE_ADDR + USBPHY_CTRL + SET);
-
-	return 0;
-}
-- 
2.21.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH 5/5] ARM: i.MX: Drop unused usb-imx6.c
  2019-05-20 18:24 ` [PATCH 5/5] ARM: i.MX: Drop unused usb-imx6.c Andrey Smirnov
@ 2019-05-21  9:37   ` Sascha Hauer
  2019-05-21  9:50     ` Sascha Hauer
  0 siblings, 1 reply; 9+ messages in thread
From: Sascha Hauer @ 2019-05-21  9:37 UTC (permalink / raw)
  To: Andrey Smirnov; +Cc: barebox

On Mon, May 20, 2019 at 11:24:02AM -0700, Andrey Smirnov wrote:
> Looks like usb-imx6.c was abandoned and there are no references to
> either of the functions difined there. Drop it.
> 
> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
> ---
>  arch/arm/mach-imx/Makefile   |   2 +-
>  arch/arm/mach-imx/usb-imx6.c | 111 -----------------------------------
>  2 files changed, 1 insertion(+), 112 deletions(-)
>  delete mode 100644 arch/arm/mach-imx/usb-imx6.c
> 
> diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
> index b86025cc3..b16de2866 100644
> --- a/arch/arm/mach-imx/Makefile
> +++ b/arch/arm/mach-imx/Makefile
> @@ -10,7 +10,7 @@ obj-$(CONFIG_ARCH_IMX51) += imx51.o imx5.o
>  pbl-$(CONFIG_ARCH_IMX51) += imx51.o imx5.o
>  obj-$(CONFIG_ARCH_IMX53) += imx53.o imx5.o esdctl-v4.o
>  pbl-$(CONFIG_ARCH_IMX53) += imx53.o imx5.o esdctl-v4.o
> -obj-$(CONFIG_ARCH_IMX6) += imx6.o usb-imx6.o
> +obj-$(CONFIG_ARCH_IMX6) += imx6.o
>  CFLAGS_imx6.o := -march=armv7-a
>  lwl-$(CONFIG_ARCH_IMX6) += imx6-mmdc.o
>  obj-$(CONFIG_ARCH_IMX7) += imx7.o
> diff --git a/arch/arm/mach-imx/usb-imx6.c b/arch/arm/mach-imx/usb-imx6.c
> deleted file mode 100644
> index 4236bcb77..000000000
> --- a/arch/arm/mach-imx/usb-imx6.c
> +++ /dev/null
> @@ -1,111 +0,0 @@
> -
> -int imx6_usb_phy2_disable_oc(void)
> -{

You leave the function prototypes in
arch/arm/mach-imx/include/mach/usb.h. Could you remove them aswell?

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH 5/5] ARM: i.MX: Drop unused usb-imx6.c
  2019-05-21  9:37   ` Sascha Hauer
@ 2019-05-21  9:50     ` Sascha Hauer
  2019-05-22  2:01       ` Andrey Smirnov
  0 siblings, 1 reply; 9+ messages in thread
From: Sascha Hauer @ 2019-05-21  9:50 UTC (permalink / raw)
  To: Andrey Smirnov; +Cc: barebox

On Tue, May 21, 2019 at 11:37:16AM +0200, Sascha Hauer wrote:
> On Mon, May 20, 2019 at 11:24:02AM -0700, Andrey Smirnov wrote:
> > Looks like usb-imx6.c was abandoned and there are no references to
> > either of the functions difined there. Drop it.
> > 
> > Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
> > ---
> >  arch/arm/mach-imx/Makefile   |   2 +-
> >  arch/arm/mach-imx/usb-imx6.c | 111 -----------------------------------
> >  2 files changed, 1 insertion(+), 112 deletions(-)
> >  delete mode 100644 arch/arm/mach-imx/usb-imx6.c
> > 
> > diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
> > index b86025cc3..b16de2866 100644
> > --- a/arch/arm/mach-imx/Makefile
> > +++ b/arch/arm/mach-imx/Makefile
> > @@ -10,7 +10,7 @@ obj-$(CONFIG_ARCH_IMX51) += imx51.o imx5.o
> >  pbl-$(CONFIG_ARCH_IMX51) += imx51.o imx5.o
> >  obj-$(CONFIG_ARCH_IMX53) += imx53.o imx5.o esdctl-v4.o
> >  pbl-$(CONFIG_ARCH_IMX53) += imx53.o imx5.o esdctl-v4.o
> > -obj-$(CONFIG_ARCH_IMX6) += imx6.o usb-imx6.o
> > +obj-$(CONFIG_ARCH_IMX6) += imx6.o
> >  CFLAGS_imx6.o := -march=armv7-a
> >  lwl-$(CONFIG_ARCH_IMX6) += imx6-mmdc.o
> >  obj-$(CONFIG_ARCH_IMX7) += imx7.o
> > diff --git a/arch/arm/mach-imx/usb-imx6.c b/arch/arm/mach-imx/usb-imx6.c
> > deleted file mode 100644
> > index 4236bcb77..000000000
> > --- a/arch/arm/mach-imx/usb-imx6.c
> > +++ /dev/null
> > @@ -1,111 +0,0 @@
> > -
> > -int imx6_usb_phy2_disable_oc(void)
> > -{
> 
> You leave the function prototypes in
> arch/arm/mach-imx/include/mach/usb.h. Could you remove them aswell?

Don't mind, I fixed this up while applying

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH 5/5] ARM: i.MX: Drop unused usb-imx6.c
  2019-05-21  9:50     ` Sascha Hauer
@ 2019-05-22  2:01       ` Andrey Smirnov
  0 siblings, 0 replies; 9+ messages in thread
From: Andrey Smirnov @ 2019-05-22  2:01 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: Barebox List

On Tue, May 21, 2019 at 2:50 AM Sascha Hauer <s.hauer@pengutronix.de> wrote:
>
> On Tue, May 21, 2019 at 11:37:16AM +0200, Sascha Hauer wrote:
> > On Mon, May 20, 2019 at 11:24:02AM -0700, Andrey Smirnov wrote:
> > > Looks like usb-imx6.c was abandoned and there are no references to
> > > either of the functions difined there. Drop it.
> > >
> > > Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
> > > ---
> > >  arch/arm/mach-imx/Makefile   |   2 +-
> > >  arch/arm/mach-imx/usb-imx6.c | 111 -----------------------------------
> > >  2 files changed, 1 insertion(+), 112 deletions(-)
> > >  delete mode 100644 arch/arm/mach-imx/usb-imx6.c
> > >
> > > diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
> > > index b86025cc3..b16de2866 100644
> > > --- a/arch/arm/mach-imx/Makefile
> > > +++ b/arch/arm/mach-imx/Makefile
> > > @@ -10,7 +10,7 @@ obj-$(CONFIG_ARCH_IMX51) += imx51.o imx5.o
> > >  pbl-$(CONFIG_ARCH_IMX51) += imx51.o imx5.o
> > >  obj-$(CONFIG_ARCH_IMX53) += imx53.o imx5.o esdctl-v4.o
> > >  pbl-$(CONFIG_ARCH_IMX53) += imx53.o imx5.o esdctl-v4.o
> > > -obj-$(CONFIG_ARCH_IMX6) += imx6.o usb-imx6.o
> > > +obj-$(CONFIG_ARCH_IMX6) += imx6.o
> > >  CFLAGS_imx6.o := -march=armv7-a
> > >  lwl-$(CONFIG_ARCH_IMX6) += imx6-mmdc.o
> > >  obj-$(CONFIG_ARCH_IMX7) += imx7.o
> > > diff --git a/arch/arm/mach-imx/usb-imx6.c b/arch/arm/mach-imx/usb-imx6.c
> > > deleted file mode 100644
> > > index 4236bcb77..000000000
> > > --- a/arch/arm/mach-imx/usb-imx6.c
> > > +++ /dev/null
> > > @@ -1,111 +0,0 @@
> > > -
> > > -int imx6_usb_phy2_disable_oc(void)
> > > -{
> >
> > You leave the function prototypes in
> > arch/arm/mach-imx/include/mach/usb.h. Could you remove them aswell?
>
> Don't mind, I fixed this up while applying
>

I knew I was forgetting something! Thanks for fixing that!

Thanks,
Andrey Smirnov

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2019-05-22  2:02 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-20 18:23 [PATCH 0/5] i.MX USB PHY fixes Andrey Smirnov
2019-05-20 18:23 ` [PATCH 1/5] usb: imx-usb-phy: Import register definitions from Linux driver Andrey Smirnov
2019-05-20 18:23 ` [PATCH 2/5] usb: imx-usb-phy: Wrap lines to silence checkpatch Andrey Smirnov
2019-05-20 18:24 ` [PATCH 3/5] usb: imx-usb-phy: Use stmp_reset_block() to reset PHY Andrey Smirnov
2019-05-20 18:24 ` [PATCH 4/5] usb: imx-usb-phy: Disable charger detect during initialization Andrey Smirnov
2019-05-20 18:24 ` [PATCH 5/5] ARM: i.MX: Drop unused usb-imx6.c Andrey Smirnov
2019-05-21  9:37   ` Sascha Hauer
2019-05-21  9:50     ` Sascha Hauer
2019-05-22  2:01       ` Andrey Smirnov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox