public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 0/5] Add wait_for_bit()
@ 2015-12-15  0:09 Mateusz Kulikowski
  2015-12-15  0:09 ` [U-Boot] [PATCH 1/5] lib: Add wait_for_bit Mateusz Kulikowski
                   ` (5 more replies)
  0 siblings, 6 replies; 13+ messages in thread
From: Mateusz Kulikowski @ 2015-12-15  0:09 UTC (permalink / raw)
  To: u-boot


This series add generic function to poll register waiting for
one or more bits to change.

Very similar function was used in several drivers:
- dwc2
- ohci-lp32xx
- ehci-mx6
- zynq_gem

First patch adds function, following patches update drivers and
board config files / defconfigs.

This series was compile-tested with buildman for ~50 boards
(most or even all boards affected by change)

Code was also run-tested on ehci-msm driver (not yet in mainline)

There is single difference in behavior: ohci-lp32xx driver will
not print "Timeout..." message with debug disabled.
I think it's not a big issue as this driver seems unused, but
if it's an issue - please drop that patch.


Mateusz Kulikowski (5):
  lib: Add wait_for_bit
  usb: dwc2: Use shared wait_for_bit
  usb: ohci-lpc32xx: Use shared wait_for_bit
  usb: ehci-mx6: Use shared wait_for_bit
  net: zynq_gem: Use shared wait_for_bit

 drivers/net/Kconfig                   |  1 +
 drivers/net/zynq_gem.c                | 35 ++--------------------------
 drivers/usb/host/dwc2.c               | 43 +++++++++++++---------------------
 drivers/usb/host/ehci-mx6.c           | 37 +++++++----------------------
 drivers/usb/host/ohci-lpc32xx.c       | 36 ++++++++--------------------
 include/configs/aristainetos-common.h |  1 +
 include/configs/cgtqmx6eval.h         |  1 +
 include/configs/embestmx6boards.h     |  1 +
 include/configs/gw_ventana.h          |  1 +
 include/configs/hikey.h               |  1 +
 include/configs/mx6cuboxi.h           |  1 +
 include/configs/mx6qarm2.h            |  1 +
 include/configs/mx6qsabreauto.h       |  1 +
 include/configs/mx6sabresd.h          |  1 +
 include/configs/mx6slevk.h            |  1 +
 include/configs/mx6sxsabresd.h        |  1 +
 include/configs/mx6ul_14x14_evk.h     |  1 +
 include/configs/nitrogen6x.h          |  1 +
 include/configs/novena.h              |  1 +
 include/configs/ot1200.h              |  1 +
 include/configs/platinum.h            |  1 +
 include/configs/rpi-common.h          |  1 +
 include/configs/socfpga_common.h      |  1 +
 include/configs/tbs2910.h             |  1 +
 include/configs/titanium.h            |  1 +
 include/configs/tqma6.h               |  1 +
 include/configs/wandboard.h           |  1 +
 include/configs/warp.h                |  1 +
 include/wait_bit.h                    | 34 +++++++++++++++++++++++++++
 lib/Kconfig                           |  4 ++++
 lib/Makefile                          |  1 +
 lib/wait_bit.c                        | 44 +++++++++++++++++++++++++++++++++++
 32 files changed, 144 insertions(+), 114 deletions(-)
 create mode 100644 include/wait_bit.h
 create mode 100644 lib/wait_bit.c

-- 
2.5.0

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

* [U-Boot] [PATCH 1/5] lib: Add wait_for_bit
  2015-12-15  0:09 [U-Boot] [PATCH 0/5] Add wait_for_bit() Mateusz Kulikowski
@ 2015-12-15  0:09 ` Mateusz Kulikowski
  2015-12-15  0:20   ` Marek Vasut
  2015-12-15  0:09 ` [U-Boot] [PATCH 2/5] usb: dwc2: Use shared wait_for_bit Mateusz Kulikowski
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 13+ messages in thread
From: Mateusz Kulikowski @ 2015-12-15  0:09 UTC (permalink / raw)
  To: u-boot

Add function to poll register waiting for specific bit(s).
Similar functions are implemented in few drivers - they are almost
identical and can be generalized.
Signed-off-by: Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
---

 include/wait_bit.h | 34 ++++++++++++++++++++++++++++++++++
 lib/Kconfig        |  4 ++++
 lib/Makefile       |  1 +
 lib/wait_bit.c     | 44 ++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 83 insertions(+)
 create mode 100644 include/wait_bit.h
 create mode 100644 lib/wait_bit.c

diff --git a/include/wait_bit.h b/include/wait_bit.h
new file mode 100644
index 0000000..7dbfa1a
--- /dev/null
+++ b/include/wait_bit.h
@@ -0,0 +1,34 @@
+/*
+ * Wait for bit with timeout and ctrlc
+ *
+ * (C) Copyright 2015 Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef __WAIT_BIT_H
+#define __WAIT_BIT_H
+
+/**
+ * wait_for_bit()	waits for bit set/cleared in register
+ *
+ * Function polls register waiting for specific bit(s) change
+ * (either 0->1 or 1->0). It can fail under two conditions:
+ * - Timeout
+ * - User interaction (CTRL-C)
+ * Function succeeds only if all bits of masked register are set/cleared
+ * (depending on set option).
+ *
+ * @param prefix	Prefix added to timeout messagge (message visible only
+ *			with debug enabled)
+ * @param reg		Register that will be read (using readl())
+ * @param mask		Bit(s) of register that must be active
+ * @param set		Selects wait condition (bit set or clear)
+ * @param timeout	Timeout (in miliseconds)
+ * @param breakable	Enables CTRL-C interruption
+ * @return		0 on success, -ETIMEDOUT or -EINTR on failure
+ */
+int wait_for_bit(const char *prefix, u32 *reg, const u32 mask, bool set,
+		 unsigned int timeout, bool breakable);
+
+#endif
diff --git a/lib/Kconfig b/lib/Kconfig
index 9d580e4..5977fc6 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -137,6 +137,10 @@ config ERRNO_STR
 	  - if errno is null or positive number - a pointer to "Success" message
 	  - if errno is negative - a pointer to errno related message
 
+config LIB_WAIT_BIT
+	bool
+	default n
+
 source lib/efi/Kconfig
 
 endmenu
diff --git a/lib/Makefile b/lib/Makefile
index 1f1ff6f..437f937 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -81,6 +81,7 @@ obj-y += time.o
 obj-$(CONFIG_TRACE) += trace.o
 obj-$(CONFIG_LIB_UUID) += uuid.o
 obj-$(CONFIG_LIB_RAND) += rand.o
+obj-$(CONFIG_LIB_WAIT_BIT) += wait_bit.o
 
 ifdef CONFIG_SPL_BUILD
 # SPL U-Boot may use full-printf, tiny-printf or none at all
diff --git a/lib/wait_bit.c b/lib/wait_bit.c
new file mode 100644
index 0000000..3c78eac
--- /dev/null
+++ b/lib/wait_bit.c
@@ -0,0 +1,44 @@
+/*
+ * Wait for bit interruptible by timeout or ctrlc
+ *
+ * (C) Copyright 2015 Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+#include <console.h>
+#include <asm/io.h>
+#include <asm/errno.h>
+
+int wait_for_bit(const char *prefix, u32 *reg, const u32 mask, bool set,
+		 unsigned int timeout, bool breakable)
+{
+	u32 val;
+	unsigned long start = get_timer(0);
+
+	while (1) {
+		val = readl(reg);
+
+		if (!set)
+			val = ~val;
+
+		if ((val & mask) == mask)
+			return 0;
+
+		if (get_timer(start) > timeout)
+			break;
+
+		if (breakable && ctrlc()) {
+			puts("Abort\n");
+			return -EINTR;
+		}
+
+		udelay(1);
+	}
+
+	debug("%s: Timeout (reg=%p mask=%08x wait_set=%i)\n", prefix, reg, mask,
+	      set);
+
+	return -ETIMEDOUT;
+}
-- 
2.5.0

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

* [U-Boot] [PATCH 2/5] usb: dwc2: Use shared wait_for_bit
  2015-12-15  0:09 [U-Boot] [PATCH 0/5] Add wait_for_bit() Mateusz Kulikowski
  2015-12-15  0:09 ` [U-Boot] [PATCH 1/5] lib: Add wait_for_bit Mateusz Kulikowski
@ 2015-12-15  0:09 ` Mateusz Kulikowski
  2015-12-15  0:21   ` Marek Vasut
  2015-12-15  0:09 ` [U-Boot] [PATCH 3/5] usb: ohci-lpc32xx: " Mateusz Kulikowski
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 13+ messages in thread
From: Mateusz Kulikowski @ 2015-12-15  0:09 UTC (permalink / raw)
  To: u-boot

Use existing library function to poll bit(s).
Update configs using dwc2.

Signed-off-by: Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
---

 drivers/usb/host/dwc2.c          | 43 +++++++++++++++-------------------------
 include/configs/hikey.h          |  1 +
 include/configs/rpi-common.h     |  1 +
 include/configs/socfpga_common.h |  1 +
 4 files changed, 19 insertions(+), 27 deletions(-)

diff --git a/drivers/usb/host/dwc2.c b/drivers/usb/host/dwc2.c
index 541c0f9..d1c9c45 100644
--- a/drivers/usb/host/dwc2.c
+++ b/drivers/usb/host/dwc2.c
@@ -13,6 +13,7 @@
 #include <memalign.h>
 #include <phys2bus.h>
 #include <usbroothubdes.h>
+#include <wait_bit.h>
 #include <asm/io.h>
 
 #include "dwc2.h"
@@ -52,27 +53,10 @@ static struct dwc2_priv local;
 /*
  * DWC2 IP interface
  */
-static int wait_for_bit(void *reg, const uint32_t mask, bool set)
-{
-	unsigned int timeout = 1000000;
-	uint32_t val;
-
-	while (--timeout) {
-		val = readl(reg);
-		if (!set)
-			val = ~val;
-
-		if ((val & mask) == mask)
-			return 0;
-
-		udelay(1);
-	}
-
-	debug("%s: Timeout (reg=%p mask=%08x wait_set=%i)\n",
-	      __func__, reg, mask, set);
 
-	return -ETIMEDOUT;
-}
+#ifndef CONFIG_LIB_WAIT_BIT
+#error CONFIG_LIB_WAIT_BIT is required for dwc2 driver
+#endif
 
 /*
  * Initializes the FSLSPClkSel field of the HCFG register
@@ -117,7 +101,8 @@ static void dwc_otg_flush_tx_fifo(struct dwc2_core_regs *regs, const int num)
 
 	writel(DWC2_GRSTCTL_TXFFLSH | (num << DWC2_GRSTCTL_TXFNUM_OFFSET),
 	       &regs->grstctl);
-	ret = wait_for_bit(&regs->grstctl, DWC2_GRSTCTL_TXFFLSH, 0);
+	ret = wait_for_bit(__func__, &regs->grstctl, DWC2_GRSTCTL_TXFFLSH,
+			   false, 1000, false);
 	if (ret)
 		printf("%s: Timeout!\n", __func__);
 
@@ -135,7 +120,8 @@ static void dwc_otg_flush_rx_fifo(struct dwc2_core_regs *regs)
 	int ret;
 
 	writel(DWC2_GRSTCTL_RXFFLSH, &regs->grstctl);
-	ret = wait_for_bit(&regs->grstctl, DWC2_GRSTCTL_RXFFLSH, 0);
+	ret = wait_for_bit(__func__, &regs->grstctl, DWC2_GRSTCTL_RXFFLSH,
+			   false, 1000, false);
 	if (ret)
 		printf("%s: Timeout!\n", __func__);
 
@@ -152,13 +138,15 @@ static void dwc_otg_core_reset(struct dwc2_core_regs *regs)
 	int ret;
 
 	/* Wait for AHB master IDLE state. */
-	ret = wait_for_bit(&regs->grstctl, DWC2_GRSTCTL_AHBIDLE, 1);
+	ret = wait_for_bit(__func__, &regs->grstctl, DWC2_GRSTCTL_AHBIDLE,
+			   true, 1000, false);
 	if (ret)
 		printf("%s: Timeout!\n", __func__);
 
 	/* Core Soft Reset */
 	writel(DWC2_GRSTCTL_CSFTRST, &regs->grstctl);
-	ret = wait_for_bit(&regs->grstctl, DWC2_GRSTCTL_CSFTRST, 0);
+	ret = wait_for_bit(__func__, &regs->grstctl, DWC2_GRSTCTL_CSFTRST,
+			   false, 1000, false);
 	if (ret)
 		printf("%s: Timeout!\n", __func__);
 
@@ -243,8 +231,8 @@ static void dwc_otg_core_host_init(struct dwc2_core_regs *regs)
 		clrsetbits_le32(&regs->hc_regs[i].hcchar,
 				DWC2_HCCHAR_EPDIR,
 				DWC2_HCCHAR_CHEN | DWC2_HCCHAR_CHDIS);
-		ret = wait_for_bit(&regs->hc_regs[i].hcchar,
-				   DWC2_HCCHAR_CHEN, 0);
+		ret = wait_for_bit(__func__, &regs->hc_regs[i].hcchar,
+				   DWC2_HCCHAR_CHEN, false, 1000, false);
 		if (ret)
 			printf("%s: Timeout!\n", __func__);
 	}
@@ -737,7 +725,8 @@ int wait_for_chhltd(struct dwc2_core_regs *regs, uint32_t *sub, int *toggle,
 	int ret;
 	uint32_t hcint, hctsiz;
 
-	ret = wait_for_bit(&hc_regs->hcint, DWC2_HCINT_CHHLTD, true);
+	ret = wait_for_bit(__func__, &hc_regs->hcint, DWC2_HCINT_CHHLTD, true,
+			   1000, false);
 	if (ret)
 		return ret;
 
diff --git a/include/configs/hikey.h b/include/configs/hikey.h
index 796861e..4e3bfec 100644
--- a/include/configs/hikey.h
+++ b/include/configs/hikey.h
@@ -66,6 +66,7 @@
 
 #define CONFIG_CMD_USB
 #ifdef CONFIG_CMD_USB
+#define CONFIG_LIB_WAIT_BIT
 #define CONFIG_USB_DWC2
 #define CONFIG_USB_DWC2_REG_ADDR 0xF72C0000
 /*#define CONFIG_DWC2_DFLT_SPEED_FULL*/
diff --git a/include/configs/rpi-common.h b/include/configs/rpi-common.h
index 1b83eb3..70d6123 100644
--- a/include/configs/rpi-common.h
+++ b/include/configs/rpi-common.h
@@ -78,6 +78,7 @@
 
 #define CONFIG_CMD_USB
 #ifdef CONFIG_CMD_USB
+#define CONFIG_LIB_WAIT_BIT
 #define CONFIG_USB_DWC2
 #ifdef CONFIG_BCM2836
 #define CONFIG_USB_DWC2_REG_ADDR 0x3f980000
diff --git a/include/configs/socfpga_common.h b/include/configs/socfpga_common.h
index b3f65b6..47062cd 100644
--- a/include/configs/socfpga_common.h
+++ b/include/configs/socfpga_common.h
@@ -227,6 +227,7 @@ unsigned int cm_get_qspi_controller_clk_hz(void);
  * USB
  */
 #ifdef CONFIG_CMD_USB
+#define CONFIG_LIB_WAIT_BIT
 #define CONFIG_USB_DWC2
 #define CONFIG_USB_STORAGE
 /*
-- 
2.5.0

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

* [U-Boot] [PATCH 3/5] usb: ohci-lpc32xx: Use shared wait_for_bit
  2015-12-15  0:09 [U-Boot] [PATCH 0/5] Add wait_for_bit() Mateusz Kulikowski
  2015-12-15  0:09 ` [U-Boot] [PATCH 1/5] lib: Add wait_for_bit Mateusz Kulikowski
  2015-12-15  0:09 ` [U-Boot] [PATCH 2/5] usb: dwc2: Use shared wait_for_bit Mateusz Kulikowski
@ 2015-12-15  0:09 ` Mateusz Kulikowski
  2015-12-15 18:49   ` LEMIEUX, SYLVAIN
  2015-12-15  0:09 ` [U-Boot] [PATCH 4/5] usb: ehci-mx6: " Mateusz Kulikowski
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 13+ messages in thread
From: Mateusz Kulikowski @ 2015-12-15  0:09 UTC (permalink / raw)
  To: u-boot

Use existing library function to poll bit(s).
No config files are updated, as there is no board using this driver.

Signed-off-by: Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
---

 drivers/usb/host/ohci-lpc32xx.c | 36 ++++++++++--------------------------
 1 file changed, 10 insertions(+), 26 deletions(-)

diff --git a/drivers/usb/host/ohci-lpc32xx.c b/drivers/usb/host/ohci-lpc32xx.c
index 48d338e..1101f6f 100644
--- a/drivers/usb/host/ohci-lpc32xx.c
+++ b/drivers/usb/host/ohci-lpc32xx.c
@@ -10,6 +10,7 @@
 
 #include <common.h>
 #include <errno.h>
+#include <wait_bit.h>
 #include <asm/io.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/clk.h>
@@ -80,29 +81,9 @@ struct otg_regs {
 static struct otg_regs *otg = (struct otg_regs *)USB_BASE;
 static struct clk_pm_regs *clk_pwr = (struct clk_pm_regs *)CLK_PM_BASE;
 
-static int wait_for_bit(void *reg, const u32 mask, bool set)
-{
-	u32 val;
-	unsigned long start = get_timer(0);
-
-	while (1) {
-		val = readl(reg);
-		if (!set)
-			val = ~val;
-
-		if ((val & mask) == mask)
-			return 0;
-
-		if (get_timer(start) > CONFIG_SYS_HZ)
-			break;
-
-		udelay(1);
-	}
-
-	error("Timeout (reg=%p mask=%08x wait_set=%i)\n", reg, mask, set);
-
-	return -ETIMEDOUT;
-}
+#ifndef CONFIG_LIB_WAIT_BIT
+#error CONFIG_LIB_WAIT_BIT is required for ohci-lpc32xx driver
+#endif
 
 static int isp1301_set_value(int reg, u8 value)
 {
@@ -158,7 +139,8 @@ static int usbpll_setup(void)
 	setbits_le32(&clk_pwr->usb_ctrl, CLK_USBCTRL_POSTDIV_2POW(0x01));
 	setbits_le32(&clk_pwr->usb_ctrl, CLK_USBCTRL_PLL_PWRUP);
 
-	ret = wait_for_bit(&clk_pwr->usb_ctrl, CLK_USBCTRL_PLL_STS, 1);
+	ret = wait_for_bit(__func__, &clk_pwr->usb_ctrl, CLK_USBCTRL_PLL_STS,
+			   true, CONFIG_SYS_HZ, false);
 	if (ret)
 		return ret;
 
@@ -183,7 +165,8 @@ int usb_cpu_init(void)
 
 	/* enable I2C clock */
 	writel(OTG_CLK_I2C_EN, &otg->otg_clk_ctrl);
-	ret = wait_for_bit(&otg->otg_clk_sts, OTG_CLK_I2C_EN, 1);
+	ret = wait_for_bit(__func__, &otg->otg_clk_sts, OTG_CLK_I2C_EN, true,
+			   CONFIG_SYS_HZ, false);
 	if (ret)
 		return ret;
 
@@ -203,7 +186,8 @@ int usb_cpu_init(void)
 			 OTG_CLK_I2C_EN | OTG_CLK_HOST_EN;
 	writel(mask, &otg->otg_clk_ctrl);
 
-	ret = wait_for_bit(&otg->otg_clk_sts, mask, 1);
+	ret = wait_for_bit(__func__, &otg->otg_clk_sts, mask, true,
+			   CONFIG_SYS_HZ, false);
 	if (ret)
 		return ret;
 
-- 
2.5.0

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

* [U-Boot] [PATCH 4/5] usb: ehci-mx6: Use shared wait_for_bit
  2015-12-15  0:09 [U-Boot] [PATCH 0/5] Add wait_for_bit() Mateusz Kulikowski
                   ` (2 preceding siblings ...)
  2015-12-15  0:09 ` [U-Boot] [PATCH 3/5] usb: ohci-lpc32xx: " Mateusz Kulikowski
@ 2015-12-15  0:09 ` Mateusz Kulikowski
  2015-12-15  0:09 ` [U-Boot] [PATCH 5/5] net: zynq_gem: " Mateusz Kulikowski
  2015-12-15 18:42 ` [U-Boot] [PATCH 0/5] Add wait_for_bit() LEMIEUX, SYLVAIN
  5 siblings, 0 replies; 13+ messages in thread
From: Mateusz Kulikowski @ 2015-12-15  0:09 UTC (permalink / raw)
  To: u-boot

Use existing library function to poll bit(s).
Update configs using ehci-mx6.

Signed-off-by: Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
---

 drivers/usb/host/ehci-mx6.c           | 37 +++++++++--------------------------
 include/configs/aristainetos-common.h |  1 +
 include/configs/cgtqmx6eval.h         |  1 +
 include/configs/embestmx6boards.h     |  1 +
 include/configs/gw_ventana.h          |  1 +
 include/configs/mx6cuboxi.h           |  1 +
 include/configs/mx6qarm2.h            |  1 +
 include/configs/mx6qsabreauto.h       |  1 +
 include/configs/mx6sabresd.h          |  1 +
 include/configs/mx6slevk.h            |  1 +
 include/configs/mx6sxsabresd.h        |  1 +
 include/configs/mx6ul_14x14_evk.h     |  1 +
 include/configs/nitrogen6x.h          |  1 +
 include/configs/novena.h              |  1 +
 include/configs/ot1200.h              |  1 +
 include/configs/platinum.h            |  1 +
 include/configs/tbs2910.h             |  1 +
 include/configs/titanium.h            |  1 +
 include/configs/tqma6.h               |  1 +
 include/configs/wandboard.h           |  1 +
 include/configs/warp.h                |  1 +
 21 files changed, 29 insertions(+), 28 deletions(-)

diff --git a/drivers/usb/host/ehci-mx6.c b/drivers/usb/host/ehci-mx6.c
index 2666351..ed269be 100644
--- a/drivers/usb/host/ehci-mx6.c
+++ b/drivers/usb/host/ehci-mx6.c
@@ -8,6 +8,7 @@
 #include <common.h>
 #include <usb.h>
 #include <errno.h>
+#include <wait_bit.h>
 #include <linux/compiler.h>
 #include <usb/ehci-fsl.h>
 #include <asm/io.h>
@@ -57,6 +58,11 @@
 #define UCMD_RESET		(1 << 1) /* controller reset */
 
 #if defined(CONFIG_MX6)
+
+#ifndef CONFIG_LIB_WAIT_BIT
+#error CONFIG_LIB_WAIT_BIT is required for ehci-mx6 driver
+#endif
+
 static const unsigned phy_bases[] = {
 	USB_PHY0_BASE_ADDR,
 	USB_PHY1_BASE_ADDR,
@@ -117,32 +123,6 @@ static void usb_power_config(int index)
 		     pll_480_ctrl_set);
 }
 
-static int wait_for_bit(u32 *reg, const u32 mask, bool set)
-{
-	u32 val;
-	const unsigned int timeout = 10000;
-	unsigned long start = get_timer(0);
-
-	while(1) {
-		val = readl(reg);
-		if (!set)
-			val = ~val;
-
-		if ((val & mask) == mask)
-			return 0;
-
-		if (get_timer(start) > timeout)
-			break;
-
-		udelay(1);
-	}
-
-	debug("%s: Timeout (reg=%p mask=%08x wait_set=%i)\n",
-			__func__, reg, mask, set);
-
-	return -ETIMEDOUT;
-}
-
 /* Return 0 : host node, <>0 : device mode */
 static int usb_phy_enable(int index, struct usb_ehci *ehci)
 {
@@ -160,12 +140,13 @@ static int usb_phy_enable(int index, struct usb_ehci *ehci)
 
 	/* Stop then Reset */
 	clrbits_le32(usb_cmd, UCMD_RUN_STOP);
-	ret = wait_for_bit(usb_cmd, UCMD_RUN_STOP, 0);
+	ret = wait_for_bit(__func__, usb_cmd, UCMD_RUN_STOP, false, 10000,
+			   false);
 	if (ret)
 		return ret;
 
 	setbits_le32(usb_cmd, UCMD_RESET);
-	ret = wait_for_bit(usb_cmd, UCMD_RESET, 0);
+	ret = wait_for_bit(__func__, usb_cmd, UCMD_RESET, false, 10000, false);
 	if (ret)
 		return ret;
 
diff --git a/include/configs/aristainetos-common.h b/include/configs/aristainetos-common.h
index 0b97ccc..c97c352 100644
--- a/include/configs/aristainetos-common.h
+++ b/include/configs/aristainetos-common.h
@@ -218,6 +218,7 @@
 /* USB Configs */
 #define CONFIG_CMD_USB
 #define CONFIG_USB_EHCI
+#define CONFIG_LIB_WAIT_BIT
 #define CONFIG_USB_EHCI_MX6
 #define CONFIG_USB_STORAGE
 #define CONFIG_USB_MAX_CONTROLLER_COUNT 2
diff --git a/include/configs/cgtqmx6eval.h b/include/configs/cgtqmx6eval.h
index 487c011..380e1c8 100644
--- a/include/configs/cgtqmx6eval.h
+++ b/include/configs/cgtqmx6eval.h
@@ -75,6 +75,7 @@
 #define CONFIG_CMD_USB
 #define CONFIG_CMD_FAT
 #define CONFIG_USB_EHCI
+#define CONFIG_LIB_WAIT_BIT
 #define CONFIG_USB_EHCI_MX6
 #define CONFIG_USB_STORAGE
 #define CONFIG_EHCI_HCD_INIT_AFTER_RESET
diff --git a/include/configs/embestmx6boards.h b/include/configs/embestmx6boards.h
index 90cd959..feaa78e 100644
--- a/include/configs/embestmx6boards.h
+++ b/include/configs/embestmx6boards.h
@@ -41,6 +41,7 @@
 /* USB Configs */
 #define CONFIG_CMD_USB
 #define CONFIG_USB_EHCI
+#define CONFIG_LIB_WAIT_BIT
 #define CONFIG_USB_EHCI_MX6
 #define CONFIG_USB_STORAGE
 #define CONFIG_USB_HOST_ETHER
diff --git a/include/configs/gw_ventana.h b/include/configs/gw_ventana.h
index b7b9c78..b672aab 100644
--- a/include/configs/gw_ventana.h
+++ b/include/configs/gw_ventana.h
@@ -178,6 +178,7 @@
 /* USB Configs */
 #define CONFIG_CMD_USB
 #define CONFIG_USB_EHCI
+#define CONFIG_LIB_WAIT_BIT
 #define CONFIG_USB_EHCI_MX6
 #define CONFIG_USB_STORAGE
 #define CONFIG_USB_HOST_ETHER
diff --git a/include/configs/mx6cuboxi.h b/include/configs/mx6cuboxi.h
index 4feb121..8363b27 100644
--- a/include/configs/mx6cuboxi.h
+++ b/include/configs/mx6cuboxi.h
@@ -58,6 +58,7 @@
 /* USB */
 #define CONFIG_CMD_USB
 #define CONFIG_USB_EHCI
+#define CONFIG_LIB_WAIT_BIT
 #define CONFIG_USB_EHCI_MX6
 #define CONFIG_USB_STORAGE
 #define CONFIG_EHCI_HCD_INIT_AFTER_RESET
diff --git a/include/configs/mx6qarm2.h b/include/configs/mx6qarm2.h
index 86a0316..588eb76 100644
--- a/include/configs/mx6qarm2.h
+++ b/include/configs/mx6qarm2.h
@@ -135,6 +135,7 @@
 #define CONFIG_CMD_USB
 #ifdef CONFIG_CMD_USB
 #define CONFIG_USB_EHCI
+#define CONFIG_LIB_WAIT_BIT
 #define CONFIG_USB_EHCI_MX6
 #define CONFIG_USB_STORAGE
 #define CONFIG_EHCI_HCD_INIT_AFTER_RESET
diff --git a/include/configs/mx6qsabreauto.h b/include/configs/mx6qsabreauto.h
index 1c99805..641a5bc 100644
--- a/include/configs/mx6qsabreauto.h
+++ b/include/configs/mx6qsabreauto.h
@@ -18,6 +18,7 @@
 /* USB Configs */
 #define CONFIG_CMD_USB
 #define CONFIG_USB_EHCI
+#define CONFIG_LIB_WAIT_BIT
 #define CONFIG_USB_EHCI_MX6
 #define CONFIG_USB_STORAGE
 #define CONFIG_USB_HOST_ETHER
diff --git a/include/configs/mx6sabresd.h b/include/configs/mx6sabresd.h
index bfc4f61..66b9405 100644
--- a/include/configs/mx6sabresd.h
+++ b/include/configs/mx6sabresd.h
@@ -58,6 +58,7 @@
 #define CONFIG_CMD_USB
 #ifdef CONFIG_CMD_USB
 #define CONFIG_USB_EHCI
+#define CONFIG_LIB_WAIT_BIT
 #define CONFIG_USB_EHCI_MX6
 #define CONFIG_USB_STORAGE
 #define CONFIG_EHCI_HCD_INIT_AFTER_RESET
diff --git a/include/configs/mx6slevk.h b/include/configs/mx6slevk.h
index 6937924..23938ac 100644
--- a/include/configs/mx6slevk.h
+++ b/include/configs/mx6slevk.h
@@ -182,6 +182,7 @@
 #define CONFIG_CMD_USB
 #ifdef CONFIG_CMD_USB
 #define CONFIG_USB_EHCI
+#define CONFIG_LIB_WAIT_BIT
 #define CONFIG_USB_EHCI_MX6
 #define CONFIG_USB_STORAGE
 #define CONFIG_EHCI_HCD_INIT_AFTER_RESET
diff --git a/include/configs/mx6sxsabresd.h b/include/configs/mx6sxsabresd.h
index 0aec296..8f967d5 100644
--- a/include/configs/mx6sxsabresd.h
+++ b/include/configs/mx6sxsabresd.h
@@ -158,6 +158,7 @@
 #define CONFIG_CMD_USB
 #ifdef CONFIG_CMD_USB
 #define CONFIG_USB_EHCI
+#define CONFIG_LIB_WAIT_BIT
 #define CONFIG_USB_EHCI_MX6
 #define CONFIG_USB_STORAGE
 #define CONFIG_EHCI_HCD_INIT_AFTER_RESET
diff --git a/include/configs/mx6ul_14x14_evk.h b/include/configs/mx6ul_14x14_evk.h
index 2712b27..1afefd4 100644
--- a/include/configs/mx6ul_14x14_evk.h
+++ b/include/configs/mx6ul_14x14_evk.h
@@ -211,6 +211,7 @@
 #define CONFIG_CMD_USB
 #ifdef CONFIG_CMD_USB
 #define CONFIG_USB_EHCI
+#define CONFIG_LIB_WAIT_BIT
 #define CONFIG_USB_EHCI_MX6
 #define CONFIG_USB_STORAGE
 #define CONFIG_EHCI_HCD_INIT_AFTER_RESET
diff --git a/include/configs/nitrogen6x.h b/include/configs/nitrogen6x.h
index 3416ce3..0d72e0b 100644
--- a/include/configs/nitrogen6x.h
+++ b/include/configs/nitrogen6x.h
@@ -84,6 +84,7 @@
 /* USB Configs */
 #define CONFIG_CMD_USB
 #define CONFIG_USB_EHCI
+#define CONFIG_LIB_WAIT_BIT
 #define CONFIG_USB_EHCI_MX6
 #define CONFIG_USB_STORAGE
 #define CONFIG_USB_HOST_ETHER
diff --git a/include/configs/novena.h b/include/configs/novena.h
index 4b4f2d7..3371ced 100644
--- a/include/configs/novena.h
+++ b/include/configs/novena.h
@@ -153,6 +153,7 @@
 /* USB Configs */
 #ifdef CONFIG_CMD_USB
 #define CONFIG_USB_EHCI
+#define CONFIG_LIB_WAIT_BIT
 #define CONFIG_USB_EHCI_MX6
 #define CONFIG_USB_STORAGE
 #define CONFIG_USB_KEYBOARD
diff --git a/include/configs/ot1200.h b/include/configs/ot1200.h
index 879ad58..5b5ec9f 100644
--- a/include/configs/ot1200.h
+++ b/include/configs/ot1200.h
@@ -61,6 +61,7 @@
 #define CONFIG_CMD_USB
 #define CONFIG_USB_STORAGE
 #define CONFIG_USB_EHCI
+#define CONFIG_LIB_WAIT_BIT
 #define CONFIG_USB_EHCI_MX6
 #define CONFIG_MXC_USB_PORTSC   (PORT_PTS_UTMI | PORT_PTS_PTW)
 #define CONFIG_USB_MAX_CONTROLLER_COUNT 2
diff --git a/include/configs/platinum.h b/include/configs/platinum.h
index bb7e845..94ab45d 100644
--- a/include/configs/platinum.h
+++ b/include/configs/platinum.h
@@ -63,6 +63,7 @@
 
 /* USB config */
 #define CONFIG_USB_EHCI
+#define CONFIG_LIB_WAIT_BIT
 #define CONFIG_USB_EHCI_MX6
 #define CONFIG_USB_STORAGE
 #define CONFIG_MXC_USB_PORT			1
diff --git a/include/configs/tbs2910.h b/include/configs/tbs2910.h
index 17b0213..f3b2f60 100644
--- a/include/configs/tbs2910.h
+++ b/include/configs/tbs2910.h
@@ -122,6 +122,7 @@
 #define CONFIG_CMD_USB
 #ifdef CONFIG_CMD_USB
 #define CONFIG_USB_EHCI
+#define CONFIG_LIB_WAIT_BIT
 #define CONFIG_USB_EHCI_MX6
 #define CONFIG_USB_MAX_CONTROLLER_COUNT 2
 #define CONFIG_EHCI_HCD_INIT_AFTER_RESET
diff --git a/include/configs/titanium.h b/include/configs/titanium.h
index acfa84a..1d4b143 100644
--- a/include/configs/titanium.h
+++ b/include/configs/titanium.h
@@ -57,6 +57,7 @@
 /* USB Configs */
 #define CONFIG_CMD_USB
 #define CONFIG_USB_EHCI
+#define CONFIG_LIB_WAIT_BIT
 #define CONFIG_USB_EHCI_MX6
 #define CONFIG_USB_STORAGE
 #define CONFIG_MXC_USB_PORT	1
diff --git a/include/configs/tqma6.h b/include/configs/tqma6.h
index 31d7757..7ac6032 100644
--- a/include/configs/tqma6.h
+++ b/include/configs/tqma6.h
@@ -93,6 +93,7 @@
 /* USB Configs */
 #define CONFIG_CMD_USB
 #define CONFIG_USB_EHCI
+#define CONFIG_LIB_WAIT_BIT
 #define CONFIG_USB_EHCI_MX6
 #define CONFIG_USB_STORAGE
 #define CONFIG_USB_HOST_ETHER
diff --git a/include/configs/wandboard.h b/include/configs/wandboard.h
index 4c8e9e9..8ecf8df 100644
--- a/include/configs/wandboard.h
+++ b/include/configs/wandboard.h
@@ -50,6 +50,7 @@
 /* USB Configs */
 #define CONFIG_CMD_USB
 #define CONFIG_USB_EHCI
+#define CONFIG_LIB_WAIT_BIT
 #define CONFIG_USB_EHCI_MX6
 #define CONFIG_USB_STORAGE
 #define CONFIG_USB_MAX_CONTROLLER_COUNT	2
diff --git a/include/configs/warp.h b/include/configs/warp.h
index 3e9a5a3..e2ebc86 100644
--- a/include/configs/warp.h
+++ b/include/configs/warp.h
@@ -66,6 +66,7 @@
 #define CONFIG_CMD_USB
 #ifdef CONFIG_CMD_USB
 #define CONFIG_USB_EHCI
+#define CONFIG_LIB_WAIT_BIT
 #define CONFIG_USB_EHCI_MX6
 #define CONFIG_USB_STORAGE
 #define CONFIG_EHCI_HCD_INIT_AFTER_RESET
-- 
2.5.0

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

* [U-Boot] [PATCH 5/5] net: zynq_gem: Use shared wait_for_bit
  2015-12-15  0:09 [U-Boot] [PATCH 0/5] Add wait_for_bit() Mateusz Kulikowski
                   ` (3 preceding siblings ...)
  2015-12-15  0:09 ` [U-Boot] [PATCH 4/5] usb: ehci-mx6: " Mateusz Kulikowski
@ 2015-12-15  0:09 ` Mateusz Kulikowski
  2015-12-15 18:42 ` [U-Boot] [PATCH 0/5] Add wait_for_bit() LEMIEUX, SYLVAIN
  5 siblings, 0 replies; 13+ messages in thread
From: Mateusz Kulikowski @ 2015-12-15  0:09 UTC (permalink / raw)
  To: u-boot

Use existing library function to poll bit(s).
Signed-off-by: Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
---

 drivers/net/Kconfig    |  1 +
 drivers/net/zynq_gem.c | 35 ++---------------------------------
 2 files changed, 3 insertions(+), 33 deletions(-)

diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 6905cc0..890e6c1 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -103,6 +103,7 @@ config PCH_GBE
 
 config ZYNQ_GEM
 	depends on DM_ETH && (ARCH_ZYNQ || ARCH_ZYNQMP)
+	select LIB_WAIT_BIT
 	bool "Xilinx Ethernet GEM"
 	help
 	  This MAC is presetn in Xilinx Zynq and ZynqMP SoCs.
diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c
index 0a41281..430c2a4 100644
--- a/drivers/net/zynq_gem.c
+++ b/drivers/net/zynq_gem.c
@@ -19,6 +19,7 @@
 #include <asm/io.h>
 #include <phy.h>
 #include <miiphy.h>
+#include <wait_bit.h>
 #include <watchdog.h>
 #include <asm/system.h>
 #include <asm/arch/hardware.h>
@@ -452,38 +453,6 @@ static int zynq_gem_init(struct udevice *dev)
 	return 0;
 }
 
-static int wait_for_bit(const char *func, u32 *reg, const u32 mask,
-			bool set, unsigned int timeout)
-{
-	u32 val;
-	unsigned long start = get_timer(0);
-
-	while (1) {
-		val = readl(reg);
-
-		if (!set)
-			val = ~val;
-
-		if ((val & mask) == mask)
-			return 0;
-
-		if (get_timer(start) > timeout)
-			break;
-
-		if (ctrlc()) {
-			puts("Abort\n");
-			return -EINTR;
-		}
-
-		udelay(1);
-	}
-
-	debug("%s: Timeout (reg=%p mask=%08x wait_set=%i)\n",
-	      func, reg, mask, set);
-
-	return -ETIMEDOUT;
-}
-
 static int zynq_gem_send(struct udevice *dev, void *ptr, int len)
 {
 	u32 addr, size;
@@ -525,7 +494,7 @@ static int zynq_gem_send(struct udevice *dev, void *ptr, int len)
 		printf("TX buffers exhausted in mid frame\n");
 
 	return wait_for_bit(__func__, &regs->txsr, ZYNQ_GEM_TSR_DONE,
-			    true, 20000);
+			    true, 20000, true);
 }
 
 /* Do not check frame_recd flag in rx_status register 0x20 - just poll BD */
-- 
2.5.0

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

* [U-Boot] [PATCH 1/5] lib: Add wait_for_bit
  2015-12-15  0:09 ` [U-Boot] [PATCH 1/5] lib: Add wait_for_bit Mateusz Kulikowski
@ 2015-12-15  0:20   ` Marek Vasut
  0 siblings, 0 replies; 13+ messages in thread
From: Marek Vasut @ 2015-12-15  0:20 UTC (permalink / raw)
  To: u-boot

On Tuesday, December 15, 2015 at 01:09:23 AM, Mateusz Kulikowski wrote:
> Add function to poll register waiting for specific bit(s).
> Similar functions are implemented in few drivers - they are almost
> identical and can be generalized.
> Signed-off-by: Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
> ---

Excellent !

>  include/wait_bit.h | 34 ++++++++++++++++++++++++++++++++++
>  lib/Kconfig        |  4 ++++
>  lib/Makefile       |  1 +
>  lib/wait_bit.c     | 44 ++++++++++++++++++++++++++++++++++++++++++++
>  4 files changed, 83 insertions(+)
>  create mode 100644 include/wait_bit.h
>  create mode 100644 lib/wait_bit.c

[...]

> +int wait_for_bit(const char *prefix,

const u32 *

> u32 *reg, const u32 mask,

const bool, const unsigned int , const bool ;-)

> bool set,
> +		 unsigned int timeout, bool breakable)

> +{
> +	u32 val;
> +	unsigned long start = get_timer(0);
> +
> +	while (1) {
> +		val = readl(reg);
> +
> +		if (!set)
> +			val = ~val;
> +
> +		if ((val & mask) == mask)
> +			return 0;
> +
> +		if (get_timer(start) > timeout)
> +			break;
> +
> +		if (breakable && ctrlc()) {
> +			puts("Abort\n");
> +			return -EINTR;
> +		}
> +
> +		udelay(1);
> +	}
> +
> +	debug("%s: Timeout (reg=%p mask=%08x wait_set=%i)\n", prefix, reg, mask,
> +	      set);
> +
> +	return -ETIMEDOUT;
> +}

Best regards,
Marek Vasut

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

* [U-Boot] [PATCH 2/5] usb: dwc2: Use shared wait_for_bit
  2015-12-15  0:09 ` [U-Boot] [PATCH 2/5] usb: dwc2: Use shared wait_for_bit Mateusz Kulikowski
@ 2015-12-15  0:21   ` Marek Vasut
  2015-12-15 21:22     ` Mateusz Kulikowski
  0 siblings, 1 reply; 13+ messages in thread
From: Marek Vasut @ 2015-12-15  0:21 UTC (permalink / raw)
  To: u-boot

On Tuesday, December 15, 2015 at 01:09:24 AM, Mateusz Kulikowski wrote:
> Use existing library function to poll bit(s).
> Update configs using dwc2.
> 
> Signed-off-by: Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
> ---

[...]

> diff --git a/include/configs/hikey.h b/include/configs/hikey.h
> index 796861e..4e3bfec 100644
> --- a/include/configs/hikey.h
> +++ b/include/configs/hikey.h
> @@ -66,6 +66,7 @@
> 
>  #define CONFIG_CMD_USB
>  #ifdef CONFIG_CMD_USB
> +#define CONFIG_LIB_WAIT_BIT

Just enable this stuff by default (ie. dont introduce new config option,
just use obj-y in lib/Makefile). The compiler will throw the function away
if it's not used.

>  #define CONFIG_USB_DWC2
>  #define CONFIG_USB_DWC2_REG_ADDR 0xF72C0000
>  /*#define CONFIG_DWC2_DFLT_SPEED_FULL*/

[...]

Best regards,
Marek Vasut

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

* [U-Boot] [PATCH 0/5] Add wait_for_bit()
  2015-12-15  0:09 [U-Boot] [PATCH 0/5] Add wait_for_bit() Mateusz Kulikowski
                   ` (4 preceding siblings ...)
  2015-12-15  0:09 ` [U-Boot] [PATCH 5/5] net: zynq_gem: " Mateusz Kulikowski
@ 2015-12-15 18:42 ` LEMIEUX, SYLVAIN
  5 siblings, 0 replies; 13+ messages in thread
From: LEMIEUX, SYLVAIN @ 2015-12-15 18:42 UTC (permalink / raw)
  To: u-boot


> From: U-Boot [mailto:u-boot-bounces at lists.denx.de] On Behalf Of Mateusz Kulikowski
> Sent: 14-Dec-15 7:09 PM
> To: u-boot at lists.denx.de; Marek Vasut; Joe Hershberger
> Subject: [U-Boot] [PATCH 0/5] Add wait_for_bit()
>
>
> This series add generic function to poll register waiting for
> one or more bits to change.
>
> Very similar function was used in several drivers:
> - dwc2
> - ohci-lp32xx
> - ehci-mx6
> - zynq_gem
>
> First patch adds function, following patches update drivers and
> board config files / defconfigs.
>
> This series was compile-tested with buildman for ~50 boards
> (most or even all boards affected by change)
>
> Code was also run-tested on ehci-msm driver (not yet in mainline)
>
> There is single difference in behavior: ohci-lp32xx driver will
> not print "Timeout..." message with debug disabled.
> I think it's not a big issue as this driver seems unused, but
> if it's an issue - please drop that patch.

This is not an issue; the lpc32xx driver is used in our custom board based on u-boot 2015.10.

>
>
...
>
> --
> 2.5.0
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de


________________________________

This e-mail contains privileged and confidential information intended for the use of the addressees named above. If you are not the intended recipient of this e-mail, you are hereby notified that you must not disseminate, copy or take any action in respect of any information contained in it. If you have received this e-mail in error, please notify the sender immediately by e-mail and immediately destroy this e-mail and its attachments.

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

* [U-Boot] [PATCH 3/5] usb: ohci-lpc32xx: Use shared wait_for_bit
  2015-12-15  0:09 ` [U-Boot] [PATCH 3/5] usb: ohci-lpc32xx: " Mateusz Kulikowski
@ 2015-12-15 18:49   ` LEMIEUX, SYLVAIN
  2015-12-15 21:20     ` Mateusz Kulikowski
  0 siblings, 1 reply; 13+ messages in thread
From: LEMIEUX, SYLVAIN @ 2015-12-15 18:49 UTC (permalink / raw)
  To: u-boot


> From: U-Boot [mailto:u-boot-bounces at lists.denx.de] On Behalf Of Mateusz Kulikowski
> Sent: 14-Dec-15 7:09 PM
> To: u-boot at lists.denx.de; Marek Vasut; Joe Hershberger
> Subject: [U-Boot] [PATCH 3/5] usb: ohci-lpc32xx: Use shared wait_for_bit
>
> Use existing library function to poll bit(s).
> No config files are updated, as there is no board using this driver.

I tested the change using our custom lpc32xx board.

>
> Signed-off-by: Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
> ---
>
>  drivers/usb/host/ohci-lpc32xx.c | 36 ++++++++++--------------------------
>  1 file changed, 10 insertions(+), 26 deletions(-)
>

...
Tested-by: Sylvain Lemieux <slemieux@tycoint.com>

________________________________

This e-mail contains privileged and confidential information intended for the use of the addressees named above. If you are not the intended recipient of this e-mail, you are hereby notified that you must not disseminate, copy or take any action in respect of any information contained in it. If you have received this e-mail in error, please notify the sender immediately by e-mail and immediately destroy this e-mail and its attachments.

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

* [U-Boot] [PATCH 3/5] usb: ohci-lpc32xx: Use shared wait_for_bit
  2015-12-15 18:49   ` LEMIEUX, SYLVAIN
@ 2015-12-15 21:20     ` Mateusz Kulikowski
  0 siblings, 0 replies; 13+ messages in thread
From: Mateusz Kulikowski @ 2015-12-15 21:20 UTC (permalink / raw)
  To: u-boot

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 15.12.2015 19:49, LEMIEUX, SYLVAIN wrote:
> 
>> From: U-Boot [mailto:u-boot-bounces at lists.denx.de] On Behalf Of Mateusz Kulikowski
>> Sent: 14-Dec-15 7:09 PM
>> To: u-boot at lists.denx.de; Marek Vasut; Joe Hershberger
>> Subject: [U-Boot] [PATCH 3/5] usb: ohci-lpc32xx: Use shared wait_for_bit
>>
>> Use existing library function to poll bit(s).
>> No config files are updated, as there is no board using this driver.
> 
> I tested the change using our custom lpc32xx board.

Thanks!

> 
>>
>> Signed-off-by: Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
>> ---
>>
>>  drivers/usb/host/ohci-lpc32xx.c | 36 ++++++++++--------------------------
>>  1 file changed, 10 insertions(+), 26 deletions(-)
>>
> 
> ...
> Tested-by: Sylvain Lemieux <slemieux@tycoint.com>
> 
> ________________________________
> 
> This e-mail contains privileged and confidential information intended for the use of the addressees named above. If you are not the intended recipient of this e-mail, you are hereby notified that you must not disseminate, copy or take any action in respect of any information contained in it. If you have received this e-mail in error, please notify the sender immediately by e-mail and immediately destroy this e-mail and its attachments.
> 

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBCAAGBQJWcIP+AAoJELvtohmVtQzB6A0H/2bB0WFXSiaxoM1z52wRZQNM
gqHEZs0Dj299h/wtwzOTUnnKxV1G2PA2WX6+SwiF9tf1JlNBlGJ6OwN6UJS0FIeA
2adqDzq7GJ0H9MrBjrMJJz1wASfG/2ryn+yFUjTBEwIb8Kjo1MBh3IiJv/HpHMif
1mLSLsvc3ukMKiJln/sXBZJEXIUT5uzP9OUt2ZPi2Yz7ujvD1Axhyntfx3xVpHZq
tG6PIPB0cuT8mwxSBjZGOC+z9ppcCKuEEpLU5isXdTYVPkneOq7UaX+Ryebr2x2R
so59vc1iXaBQoapglTi7asS8BEXPciBjSEzjodlgzlNVO+KVPCqItbaTq+GvTbo=
=Znto
-----END PGP SIGNATURE-----

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

* [U-Boot] [PATCH 2/5] usb: dwc2: Use shared wait_for_bit
  2015-12-15  0:21   ` Marek Vasut
@ 2015-12-15 21:22     ` Mateusz Kulikowski
  2015-12-15 22:43       ` Marek Vasut
  0 siblings, 1 reply; 13+ messages in thread
From: Mateusz Kulikowski @ 2015-12-15 21:22 UTC (permalink / raw)
  To: u-boot

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 15.12.2015 01:21, Marek Vasut wrote:
> On Tuesday, December 15, 2015 at 01:09:24 AM, Mateusz Kulikowski wrote:
[...]
> 
> Just enable this stuff by default (ie. dont introduce new config option,
> just use obj-y in lib/Makefile). The compiler will throw the function away
> if it's not used.
I had some concerns about that in the morning but now everything is clear, 
will do it that way (and learned something today).


Thanks for the review,
Mateusz

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBCAAGBQJWcISEAAoJELvtohmVtQzBWOYIAIbDorhGaxDNpGAgMNqqJqka
wwA5Lkv0DLy+CbQeA+MYvmy1gfPTNlJ/AimmKz1HwSkqVthoFq3nHQwvR6hhkbEF
fJE6+jkebW8+5dXffNd6DA4ok40EP3uAipG2YEMjJ9hSvgZP0GPz4JhSVMcX4GRF
WGUuuNAJNXLrd3hglm4l4N+ltMhLH9G+7/qcVFnpIJeQs4jxWAezoIq0hSdfYE0F
9WHRWqgBS+ZyfcHQaKwqo2RL8jDKaKicgE00JpXtd5txwql8MrbSegBnkKq/BdeE
6haxAgbgsqRWnOhKfEQerTmzfewiJ4AFwixb1MyvvsWfUFPtQr14DtQlRZwYBLo=
=nWpX
-----END PGP SIGNATURE-----

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

* [U-Boot] [PATCH 2/5] usb: dwc2: Use shared wait_for_bit
  2015-12-15 21:22     ` Mateusz Kulikowski
@ 2015-12-15 22:43       ` Marek Vasut
  0 siblings, 0 replies; 13+ messages in thread
From: Marek Vasut @ 2015-12-15 22:43 UTC (permalink / raw)
  To: u-boot

On Tuesday, December 15, 2015 at 10:22:22 PM, Mateusz Kulikowski wrote:
> On 15.12.2015 01:21, Marek Vasut wrote:
> > On Tuesday, December 15, 2015 at 01:09:24 AM, Mateusz Kulikowski wrote:
> [...]
> 
> > Just enable this stuff by default (ie. dont introduce new config option,
> > just use obj-y in lib/Makefile). The compiler will throw the function
> > away if it's not used.
> 
> I had some concerns about that in the morning but now everything is clear,
> will do it that way (and learned something today).

Good , thanks!

Best regards,
Marek Vasut

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

end of thread, other threads:[~2015-12-15 22:43 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-15  0:09 [U-Boot] [PATCH 0/5] Add wait_for_bit() Mateusz Kulikowski
2015-12-15  0:09 ` [U-Boot] [PATCH 1/5] lib: Add wait_for_bit Mateusz Kulikowski
2015-12-15  0:20   ` Marek Vasut
2015-12-15  0:09 ` [U-Boot] [PATCH 2/5] usb: dwc2: Use shared wait_for_bit Mateusz Kulikowski
2015-12-15  0:21   ` Marek Vasut
2015-12-15 21:22     ` Mateusz Kulikowski
2015-12-15 22:43       ` Marek Vasut
2015-12-15  0:09 ` [U-Boot] [PATCH 3/5] usb: ohci-lpc32xx: " Mateusz Kulikowski
2015-12-15 18:49   ` LEMIEUX, SYLVAIN
2015-12-15 21:20     ` Mateusz Kulikowski
2015-12-15  0:09 ` [U-Boot] [PATCH 4/5] usb: ehci-mx6: " Mateusz Kulikowski
2015-12-15  0:09 ` [U-Boot] [PATCH 5/5] net: zynq_gem: " Mateusz Kulikowski
2015-12-15 18:42 ` [U-Boot] [PATCH 0/5] Add wait_for_bit() LEMIEUX, SYLVAIN

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