All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v6 0/5] usb: host: dwc2: use driver model for PHY and CLOCK
@ 2020-03-10 10:09 Patrick Delaunay
  2020-03-10 10:09 ` [PATCH v6 1/5] dm: clk: add stub when CONFIG_CLK is deactivated Patrick Delaunay
                   ` (6 more replies)
  0 siblings, 7 replies; 15+ messages in thread
From: Patrick Delaunay @ 2020-03-10 10:09 UTC (permalink / raw)
  To: u-boot


In this serie I update the DWC2 host driver to use the device tree
information and the associated PHY and CLOCK drivers when they are
availables.

V6 is minor update of the first patch of the serie;
I update some clk stub to return success after Simon Goldschmidt
remarks on V5:
http://patchwork.ozlabs.org/project/uboot/list/?series=162791

I test the V4 of this serie on stm32mp157c-ev1 board, with PHY and CLK
support (V5 was a minor update).

The U-CLASS are provided by:
- PHY by USBPHYC driver = ./drivers/phy/phy-stm32-usbphyc.c
- CLOCK by RCC clock driver = drivers/clk/clk_stm32mp1.c
- RESET by RCC reset driver = drivers/reset/stm32-reset.c

And I activate the configuration
+CONFIG_USB_DWC2=y

PS: it is not the default configuration to avoid conflict with gadget
    driver

To solve a binding issue, I also deactivate the gadget support:
by default only one driver is bound to the usbotg_hs node with "snps,dwc2"
compatible, and today it is the device one (the first in the driver list).

I also need to deactivate hnp-srp support with:

&usbotg_hs {
	/* need to disable ONLY for HOST support */
	hnp-srp-disable;
};

WARNING: OTG with device or host support is not correctly handle by DWC2
         driver (see example for dynamic OTG role in DWC3 driver).

The tests executed on the stm32mp157c-ev1 target:

STM32MP> usb start
starting USB...
Bus usb-otg at 49000000: USB DWC2
Bus usbh-ehci at 5800d000: USB EHCI 1.00
scanning bus usb-otg at 49000000 for devices... 2 USB Device(s) found
scanning bus usbh-ehci at 5800d000 for devices... 3 USB Device(s) found
       scanning usb for storage devices... 2 Storage Device(s) found
STM32MP> usb tree
USB device tree:
  1  Hub (480 Mb/s, 0mA)
  |   U-Boot Root Hub
  |
  +-2  Mass Storage (480 Mb/s, 300mA)
       Verbatim STORE N GO 070731C8ACD7EE97

  1  Hub (480 Mb/s, 0mA)
  |  u-boot EHCI Host Controller
  |
  +-2  Hub (480 Mb/s, 2mA)

STM32MP> ls usb 0
<DIR>       4096 .
<DIR>       4096 ..
<DIR>      16384 lost+found
<DIR>       4096 record
         1490212 xipImage
        21058006 vmlinux

STM32MP> load usb 0 0xC0000000 vmlinux
21058006 bytes read in 10851 ms (1.9 MiB/s)


Changes in v6:
- return success in stub for clk_free/clk_enable/clk_disable/
  clk_enable_bulk/clk_disable_bulk

Changes in v5:
- use ERR_PTR in clk_get_parent()
- force bulk->count = 0 in clk_get_bulk to avoid issue
  for next call of clk_enable_bulk / clk_enable_bulk
- update commit message
- inverse logic for -ENOENT test on generic_phy_get_by_index result
- Add some comments

Changes in v4:
- Add stub for all functions using 'struct clk' or 'struct clk_bulk'
  after remarks on v3

Changes in v3:
- Add stub for clk_disable_bulk

Changes in v2:
- update dev_err
- update commit message
- change dev_err to dev_dbg for PHY function call
- treat dwc2_shutdown_phy error
- add clk_disable_bulk in dwc2_usb_remove

Patrick Delaunay (5):
  dm: clk: add stub when CONFIG_CLK is deactivated
  usb: host: dwc2: add phy support
  usb: host: dwc2: add clk support
  usb: host: dwc2: force reset assert
  usb: host: dwc2: add trace to have clean usb start

 drivers/usb/host/dwc2.c | 100 ++++++++++++++++++++++++++++++++++++++-
 include/clk.h           | 102 +++++++++++++++++++++++++++++++++++-----
 2 files changed, 188 insertions(+), 14 deletions(-)

-- 
2.17.1

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

* [PATCH v6 1/5] dm: clk: add stub when CONFIG_CLK is deactivated
  2020-03-10 10:09 [PATCH v6 0/5] usb: host: dwc2: use driver model for PHY and CLOCK Patrick Delaunay
@ 2020-03-10 10:09 ` Patrick Delaunay
  2020-03-10 20:22   ` Simon Goldschmidt
  2020-03-10 10:09 ` [PATCH v6 2/5] usb: host: dwc2: add phy support Patrick Delaunay
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 15+ messages in thread
From: Patrick Delaunay @ 2020-03-10 10:09 UTC (permalink / raw)
  To: u-boot

Add stub for functions clk_...() when CONFIG_CLK is deactivated.

This patch avoids compilation issues for driver using these API
without protection (#if CONFIG_IS_ENABLED(CLK))

For example, before this patch we have undefined reference to
`clk_disable_bulk') for code:
  clk_disable_bulk(&priv->clks);
  clk_release_bulk(&priv->clks);

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
---

Changes in v6:
- return success in stub for clk_free/clk_enable/clk_disable/
  clk_enable_bulk/clk_disable_bulk

Changes in v5:
- use ERR_PTR in clk_get_parent()
- force bulk->count = 0 in clk_get_bulk to avoid issue
  for next call of clk_enable_bulk / clk_enable_bulk
- update commit message

Changes in v4:
- Add stub for all functions using 'struct clk' or 'struct clk_bulk'
  after remarks on v3

Changes in v3:
- Add stub for clk_disable_bulk

Changes in v2: None

 include/clk.h | 102 +++++++++++++++++++++++++++++++++++++++++++-------
 1 file changed, 89 insertions(+), 13 deletions(-)

diff --git a/include/clk.h b/include/clk.h
index 3336301815..60c4b7d075 100644
--- a/include/clk.h
+++ b/include/clk.h
@@ -9,6 +9,7 @@
 #define _CLK_H_
 
 #include <dm/ofnode.h>
+#include <linux/err.h>
 #include <linux/errno.h>
 #include <linux/types.h>
 
@@ -312,6 +313,7 @@ static inline int clk_release_bulk(struct clk_bulk *bulk)
 	return clk_release_all(bulk->clks, bulk->count);
 }
 
+#if CONFIG_IS_ENABLED(CLK)
 /**
  * clk_request - Request a clock by provider-specific ID.
  *
@@ -433,19 +435,6 @@ int clk_disable_bulk(struct clk_bulk *bulk);
  */
 bool clk_is_match(const struct clk *p, const struct clk *q);
 
-int soc_clk_dump(void);
-
-/**
- * clk_valid() - check if clk is valid
- *
- * @clk:	the clock to check
- * @return true if valid, or false
- */
-static inline bool clk_valid(struct clk *clk)
-{
-	return clk && !!clk->dev;
-}
-
 /**
  * clk_get_by_id() - Get the clock by its ID
  *
@@ -465,6 +454,93 @@ int clk_get_by_id(ulong id, struct clk **clkp);
  * @return true on binded, or false on no
  */
 bool clk_dev_binded(struct clk *clk);
+
+#else /* CONFIG_IS_ENABLED(CLK) */
+
+static inline int clk_request(struct udevice *dev, struct clk *clk)
+{
+	return -ENOSYS;
+}
+
+static inline int clk_free(struct clk *clk)
+{
+	return 0;
+}
+
+static inline ulong clk_get_rate(struct clk *clk)
+{
+	return -ENOSYS;
+}
+
+static inline struct clk *clk_get_parent(struct clk *clk)
+{
+	return ERR_PTR(-ENOSYS);
+}
+
+static inline long long clk_get_parent_rate(struct clk *clk)
+{
+	return -ENOSYS;
+}
+
+static inline ulong clk_set_rate(struct clk *clk, ulong rate)
+{
+	return -ENOSYS;
+}
+
+static inline int clk_set_parent(struct clk *clk, struct clk *parent)
+{
+	return -ENOSYS;
+}
+
+static inline int clk_enable(struct clk *clk)
+{
+	return 0;
+}
+
+static inline int clk_enable_bulk(struct clk_bulk *bulk)
+{
+	return 0;
+}
+
+static inline int clk_disable(struct clk *clk)
+{
+	return 0;
+}
+
+static inline int clk_disable_bulk(struct clk_bulk *bulk)
+{
+	return 0;
+}
+
+static inline bool clk_is_match(const struct clk *p, const struct clk *q)
+{
+	return false;
+}
+
+static inline int clk_get_by_id(ulong id, struct clk **clkp)
+{
+	return -ENOSYS;
+}
+
+static inline bool clk_dev_binded(struct clk *clk)
+{
+	return false;
+}
+#endif /* CONFIG_IS_ENABLED(CLK) */
+
+/**
+ * clk_valid() - check if clk is valid
+ *
+ * @clk:	the clock to check
+ * @return true if valid, or false
+ */
+static inline bool clk_valid(struct clk *clk)
+{
+	return clk && !!clk->dev;
+}
+
+int soc_clk_dump(void);
+
 #endif
 
 #define clk_prepare_enable(clk) clk_enable(clk)
-- 
2.17.1

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

* [PATCH v6 2/5] usb: host: dwc2: add phy support
  2020-03-10 10:09 [PATCH v6 0/5] usb: host: dwc2: use driver model for PHY and CLOCK Patrick Delaunay
  2020-03-10 10:09 ` [PATCH v6 1/5] dm: clk: add stub when CONFIG_CLK is deactivated Patrick Delaunay
@ 2020-03-10 10:09 ` Patrick Delaunay
  2020-03-10 10:09 ` [PATCH v6 3/5] usb: host: dwc2: add clk support Patrick Delaunay
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 15+ messages in thread
From: Patrick Delaunay @ 2020-03-10 10:09 UTC (permalink / raw)
  To: u-boot

Use generic phy to initialize the PHY associated to the
DWC2 device and available in the device tree.

This patch don't added dependency because when CONFIG_PHY
is not activated, the generic PHY function are stubbed.

Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
---

Changes in v6: None
Changes in v5:
- inverse logic for -ENOENT test on generic_phy_get_by_index result
- Add some comments

Changes in v4: None
Changes in v3: None
Changes in v2:
- update dev_err
- update commit message
- change dev_err to dev_dbg for PHY function call
- treat dwc2_shutdown_phy error

 drivers/usb/host/dwc2.c | 66 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 66 insertions(+)

diff --git a/drivers/usb/host/dwc2.c b/drivers/usb/host/dwc2.c
index e4efaf1e59..a8e64825b5 100644
--- a/drivers/usb/host/dwc2.c
+++ b/drivers/usb/host/dwc2.c
@@ -8,6 +8,7 @@
 #include <cpu_func.h>
 #include <dm.h>
 #include <errno.h>
+#include <generic-phy.h>
 #include <usb.h>
 #include <malloc.h>
 #include <memalign.h>
@@ -37,6 +38,7 @@ struct dwc2_priv {
 #ifdef CONFIG_DM_REGULATOR
 	struct udevice *vbus_supply;
 #endif
+	struct phy phy;
 #else
 	uint8_t *aligned_buffer;
 	uint8_t *status_buffer;
@@ -1322,13 +1324,71 @@ static int dwc2_usb_ofdata_to_platdata(struct udevice *dev)
 	return 0;
 }
 
+static int dwc2_setup_phy(struct udevice *dev)
+{
+	struct dwc2_priv *priv = dev_get_priv(dev);
+	int ret;
+
+	ret = generic_phy_get_by_index(dev, 0, &priv->phy);
+	if (ret) {
+		if (ret == -ENOENT)
+			return 0; /* no PHY, nothing to do */
+		dev_err(dev, "Failed to get USB PHY: %d.\n", ret);
+		return ret;
+	}
+
+	ret = generic_phy_init(&priv->phy);
+	if (ret) {
+		dev_dbg(dev, "Failed to init USB PHY: %d.\n", ret);
+		return ret;
+	}
+
+	ret = generic_phy_power_on(&priv->phy);
+	if (ret) {
+		dev_dbg(dev, "Failed to power on USB PHY: %d.\n", ret);
+		generic_phy_exit(&priv->phy);
+		return ret;
+	}
+
+	return 0;
+}
+
+static int dwc2_shutdown_phy(struct udevice *dev)
+{
+	struct dwc2_priv *priv = dev_get_priv(dev);
+	int ret;
+
+	/* PHY is not valid when generic_phy_get_by_index() = -ENOENT */
+	if (!generic_phy_valid(&priv->phy))
+		return 0; /* no PHY, nothing to do */
+
+	ret = generic_phy_power_off(&priv->phy);
+	if (ret) {
+		dev_dbg(dev, "Failed to power off USB PHY: %d.\n", ret);
+		return ret;
+	}
+
+	ret = generic_phy_exit(&priv->phy);
+	if (ret) {
+		dev_dbg(dev, "Failed to power off USB PHY: %d.\n", ret);
+		return ret;
+	}
+
+	return 0;
+}
+
 static int dwc2_usb_probe(struct udevice *dev)
 {
 	struct dwc2_priv *priv = dev_get_priv(dev);
 	struct usb_bus_priv *bus_priv = dev_get_uclass_priv(dev);
+	int ret;
 
 	bus_priv->desc_before_addr = true;
 
+	ret = dwc2_setup_phy(dev);
+	if (ret)
+		return ret;
+
 	return dwc2_init_common(dev, priv);
 }
 
@@ -1341,6 +1401,12 @@ static int dwc2_usb_remove(struct udevice *dev)
 	if (ret)
 		return ret;
 
+	ret = dwc2_shutdown_phy(dev);
+	if (ret) {
+		dev_dbg(dev, "Failed to shutdown USB PHY: %d.\n", ret);
+		return ret;
+	}
+
 	dwc2_uninit_common(priv->regs);
 
 	reset_release_bulk(&priv->resets);
-- 
2.17.1

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

* [PATCH v6 3/5] usb: host: dwc2: add clk support
  2020-03-10 10:09 [PATCH v6 0/5] usb: host: dwc2: use driver model for PHY and CLOCK Patrick Delaunay
  2020-03-10 10:09 ` [PATCH v6 1/5] dm: clk: add stub when CONFIG_CLK is deactivated Patrick Delaunay
  2020-03-10 10:09 ` [PATCH v6 2/5] usb: host: dwc2: add phy support Patrick Delaunay
@ 2020-03-10 10:09 ` Patrick Delaunay
  2020-03-10 10:09 ` [PATCH v6 4/5] usb: host: dwc2: force reset assert Patrick Delaunay
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 15+ messages in thread
From: Patrick Delaunay @ 2020-03-10 10:09 UTC (permalink / raw)
  To: u-boot

Add support for clock with driver model.

This patch don't added dependency because when CONFIG_CLK
is not activated the clk function are stubbed.

Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
---

Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 drivers/usb/host/dwc2.c | 30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/dwc2.c b/drivers/usb/host/dwc2.c
index a8e64825b5..b1b79d0a18 100644
--- a/drivers/usb/host/dwc2.c
+++ b/drivers/usb/host/dwc2.c
@@ -5,14 +5,15 @@
  */
 
 #include <common.h>
+#include <clk.h>
 #include <cpu_func.h>
 #include <dm.h>
 #include <errno.h>
 #include <generic-phy.h>
-#include <usb.h>
 #include <malloc.h>
 #include <memalign.h>
 #include <phys2bus.h>
+#include <usb.h>
 #include <usbroothubdes.h>
 #include <wait_bit.h>
 #include <asm/io.h>
@@ -39,6 +40,7 @@ struct dwc2_priv {
 	struct udevice *vbus_supply;
 #endif
 	struct phy phy;
+	struct clk_bulk clks;
 #else
 	uint8_t *aligned_buffer;
 	uint8_t *status_buffer;
@@ -1377,6 +1379,26 @@ static int dwc2_shutdown_phy(struct udevice *dev)
 	return 0;
 }
 
+static int dwc2_clk_init(struct udevice *dev)
+{
+	struct dwc2_priv *priv = dev_get_priv(dev);
+	int ret;
+
+	ret = clk_get_bulk(dev, &priv->clks);
+	if (ret == -ENOSYS || ret == -ENOENT)
+		return 0;
+	if (ret)
+		return ret;
+
+	ret = clk_enable_bulk(&priv->clks);
+	if (ret) {
+		clk_release_bulk(&priv->clks);
+		return ret;
+	}
+
+	return 0;
+}
+
 static int dwc2_usb_probe(struct udevice *dev)
 {
 	struct dwc2_priv *priv = dev_get_priv(dev);
@@ -1385,6 +1407,10 @@ static int dwc2_usb_probe(struct udevice *dev)
 
 	bus_priv->desc_before_addr = true;
 
+	ret = dwc2_clk_init(dev);
+	if (ret)
+		return ret;
+
 	ret = dwc2_setup_phy(dev);
 	if (ret)
 		return ret;
@@ -1410,6 +1436,8 @@ static int dwc2_usb_remove(struct udevice *dev)
 	dwc2_uninit_common(priv->regs);
 
 	reset_release_bulk(&priv->resets);
+	clk_disable_bulk(&priv->clks);
+	clk_release_bulk(&priv->clks);
 
 	return 0;
 }
-- 
2.17.1

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

* [PATCH v6 4/5] usb: host: dwc2: force reset assert
  2020-03-10 10:09 [PATCH v6 0/5] usb: host: dwc2: use driver model for PHY and CLOCK Patrick Delaunay
                   ` (2 preceding siblings ...)
  2020-03-10 10:09 ` [PATCH v6 3/5] usb: host: dwc2: add clk support Patrick Delaunay
@ 2020-03-10 10:09 ` Patrick Delaunay
  2020-03-10 20:18   ` Simon Goldschmidt
  2020-03-10 10:09 ` [PATCH v6 5/5] usb: host: dwc2: add trace to have clean usb start Patrick Delaunay
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 15+ messages in thread
From: Patrick Delaunay @ 2020-03-10 10:09 UTC (permalink / raw)
  To: u-boot

Assert reset before deassert in dwc2_reset;
this patch solve issues when the DWC2 registers are already
initialized with value incompatible with host mode.

Force a hardware reset of the IP reset all the DWC2 registers at
default value, the host driver start with a clean state
(Core Soft reset doen in dwc_otg_core_reset is not enought
 to reset all register).

The error can occurs in U-Boot when DWC2 device gadget driver
force device mode (called by ums or dfu command, before to execute
the usb start command).

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
---

Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2:
- add clk_disable_bulk in dwc2_usb_remove

 drivers/usb/host/dwc2.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/host/dwc2.c b/drivers/usb/host/dwc2.c
index b1b79d0a18..640ae3e730 100644
--- a/drivers/usb/host/dwc2.c
+++ b/drivers/usb/host/dwc2.c
@@ -1151,6 +1151,8 @@ static int dwc2_reset(struct udevice *dev)
 			return ret;
 	}
 
+	/* force reset to clear all IP register */
+	reset_assert_bulk(&priv->resets);
 	ret = reset_deassert_bulk(&priv->resets);
 	if (ret) {
 		reset_release_bulk(&priv->resets);
-- 
2.17.1

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

* [PATCH v6 5/5] usb: host: dwc2: add trace to have clean usb start
  2020-03-10 10:09 [PATCH v6 0/5] usb: host: dwc2: use driver model for PHY and CLOCK Patrick Delaunay
                   ` (3 preceding siblings ...)
  2020-03-10 10:09 ` [PATCH v6 4/5] usb: host: dwc2: force reset assert Patrick Delaunay
@ 2020-03-10 10:09 ` Patrick Delaunay
  2020-03-10 15:20 ` [PATCH v6 0/5] usb: host: dwc2: use driver model for PHY and CLOCK Marek Vasut
  2020-04-24 13:42 ` Patrick DELAUNAY
  6 siblings, 0 replies; 15+ messages in thread
From: Patrick Delaunay @ 2020-03-10 10:09 UTC (permalink / raw)
  To: u-boot

Solve issue for the display of "usb start" command on stm32mp1
because one carriage return is missing in DWC2 probe.

Before the patch:

STM32MP> usb start
starting USB...
Bus usb-otg at 49000000:    Bus usbh-ehci at 5800d000:   USB EHCI 1.00

after the patch:

STM32MP> usb start
starting USB...
Bus usb-otg at 49000000: USB DWC2
Bus usbh-ehci at 5800d000: USB EHCI 1.00

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
---

Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 drivers/usb/host/dwc2.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/host/dwc2.c b/drivers/usb/host/dwc2.c
index 640ae3e730..f25ed2dab0 100644
--- a/drivers/usb/host/dwc2.c
+++ b/drivers/usb/host/dwc2.c
@@ -1219,6 +1219,8 @@ static int dwc2_init_common(struct udevice *dev, struct dwc2_priv *priv)
 	if (readl(&regs->gintsts) & DWC2_GINTSTS_CURMODE_HOST)
 		mdelay(1000);
 
+	printf("USB DWC2\n");
+
 	return 0;
 }
 
-- 
2.17.1

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

* [PATCH v6 0/5] usb: host: dwc2: use driver model for PHY and CLOCK
  2020-03-10 10:09 [PATCH v6 0/5] usb: host: dwc2: use driver model for PHY and CLOCK Patrick Delaunay
                   ` (4 preceding siblings ...)
  2020-03-10 10:09 ` [PATCH v6 5/5] usb: host: dwc2: add trace to have clean usb start Patrick Delaunay
@ 2020-03-10 15:20 ` Marek Vasut
  2020-03-10 17:01   ` Patrick DELAUNAY
  2020-04-24 13:42 ` Patrick DELAUNAY
  6 siblings, 1 reply; 15+ messages in thread
From: Marek Vasut @ 2020-03-10 15:20 UTC (permalink / raw)
  To: u-boot

On 3/10/20 11:09 AM, Patrick Delaunay wrote:
> 
> In this serie I update the DWC2 host driver to use the device tree
> information and the associated PHY and CLOCK drivers when they are
> availables.
> 
> V6 is minor update of the first patch of the serie;
> I update some clk stub to return success after Simon Goldschmidt
> remarks on V5:
> http://patchwork.ozlabs.org/project/uboot/list/?series=162791

Once Simon reviews them, I'll put them in usb/next . btw I'm not CCed on
1/5, would be helpful if you could keep the CC consistent, thanks.

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

* [PATCH v6 0/5] usb: host: dwc2: use driver model for PHY and CLOCK
  2020-03-10 15:20 ` [PATCH v6 0/5] usb: host: dwc2: use driver model for PHY and CLOCK Marek Vasut
@ 2020-03-10 17:01   ` Patrick DELAUNAY
  2020-03-10 18:27     ` Marek Vasut
  0 siblings, 1 reply; 15+ messages in thread
From: Patrick DELAUNAY @ 2020-03-10 17:01 UTC (permalink / raw)
  To: u-boot

Hi Marek,

> From: Marek Vasut <marex@denx.de>
> Sent: mardi 10 mars 2020 16:20
> Subject: Re: [PATCH v6 0/5] usb: host: dwc2: use driver model for PHY and
> CLOCK
> Importance: High
> 
> On 3/10/20 11:09 AM, Patrick Delaunay wrote:
> >
> > In this serie I update the DWC2 host driver to use the device tree
> > information and the associated PHY and CLOCK drivers when they are
> > availables.
> >
> > V6 is minor update of the first patch of the serie; I update some clk
> > stub to return success after Simon Goldschmidt remarks on V5:
> > http://patchwork.ozlabs.org/project/uboot/list/?series=162791
> 
> Once Simon reviews them, I'll put them in usb/next . btw I'm not CCed on 1/5,
> would be helpful if you could keep the CC consistent, thanks

Ok and thanks

I used patman for the serie with default maintainers list + 3 reviewers in Serie-CC 
    Series-cc: simon.k.r.goldschmidt at gmail.com
    Series-cc: b.galvani at gmail.com
    Series-cc: ley.foon.tan at intel.com

But I forgot you. Sorry.

Patrick
.

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

* [PATCH v6 0/5] usb: host: dwc2: use driver model for PHY and CLOCK
  2020-03-10 17:01   ` Patrick DELAUNAY
@ 2020-03-10 18:27     ` Marek Vasut
  2020-03-11 12:30       ` Patrick DELAUNAY
  0 siblings, 1 reply; 15+ messages in thread
From: Marek Vasut @ 2020-03-10 18:27 UTC (permalink / raw)
  To: u-boot

On 3/10/20 6:01 PM, Patrick DELAUNAY wrote:
> Hi Marek,
> 
>> From: Marek Vasut <marex@denx.de>
>> Sent: mardi 10 mars 2020 16:20
>> Subject: Re: [PATCH v6 0/5] usb: host: dwc2: use driver model for PHY and
>> CLOCK
>> Importance: High
>>
>> On 3/10/20 11:09 AM, Patrick Delaunay wrote:
>>>
>>> In this serie I update the DWC2 host driver to use the device tree
>>> information and the associated PHY and CLOCK drivers when they are
>>> availables.
>>>
>>> V6 is minor update of the first patch of the serie; I update some clk
>>> stub to return success after Simon Goldschmidt remarks on V5:
>>> http://patchwork.ozlabs.org/project/uboot/list/?series=162791
>>
>> Once Simon reviews them, I'll put them in usb/next . btw I'm not CCed on 1/5,
>> would be helpful if you could keep the CC consistent, thanks
> 
> Ok and thanks
> 
> I used patman for the serie with default maintainers list + 3 reviewers in Serie-CC 
>     Series-cc: simon.k.r.goldschmidt at gmail.com
>     Series-cc: b.galvani at gmail.com
>     Series-cc: ley.foon.tan at intel.com
> 
> But I forgot you. Sorry.

I'd expect get-maintainer script should tell you to add me, maybe patman
needs fixing.

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

* [PATCH v6 4/5] usb: host: dwc2: force reset assert
  2020-03-10 10:09 ` [PATCH v6 4/5] usb: host: dwc2: force reset assert Patrick Delaunay
@ 2020-03-10 20:18   ` Simon Goldschmidt
  0 siblings, 0 replies; 15+ messages in thread
From: Simon Goldschmidt @ 2020-03-10 20:18 UTC (permalink / raw)
  To: u-boot

Am 10.03.2020 um 11:09 schrieb Patrick Delaunay:
> Assert reset before deassert in dwc2_reset;
> this patch solve issues when the DWC2 registers are already
> initialized with value incompatible with host mode.
> 
> Force a hardware reset of the IP reset all the DWC2 registers at
> default value, the host driver start with a clean state
> (Core Soft reset doen in dwc_otg_core_reset is not enought
>  to reset all register).
> 
> The error can occurs in U-Boot when DWC2 device gadget driver
> force device mode (called by ums or dfu command, before to execute
> the usb start command).
> 
> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

> ---
> 
> Changes in v6: None
> Changes in v5: None
> Changes in v4: None
> Changes in v3: None
> Changes in v2:
> - add clk_disable_bulk in dwc2_usb_remove
> 
>  drivers/usb/host/dwc2.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/usb/host/dwc2.c b/drivers/usb/host/dwc2.c
> index b1b79d0a18..640ae3e730 100644
> --- a/drivers/usb/host/dwc2.c
> +++ b/drivers/usb/host/dwc2.c
> @@ -1151,6 +1151,8 @@ static int dwc2_reset(struct udevice *dev)
>  			return ret;
>  	}
>  
> +	/* force reset to clear all IP register */
> +	reset_assert_bulk(&priv->resets);
>  	ret = reset_deassert_bulk(&priv->resets);
>  	if (ret) {
>  		reset_release_bulk(&priv->resets);
> 

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

* [PATCH v6 1/5] dm: clk: add stub when CONFIG_CLK is deactivated
  2020-03-10 10:09 ` [PATCH v6 1/5] dm: clk: add stub when CONFIG_CLK is deactivated Patrick Delaunay
@ 2020-03-10 20:22   ` Simon Goldschmidt
  0 siblings, 0 replies; 15+ messages in thread
From: Simon Goldschmidt @ 2020-03-10 20:22 UTC (permalink / raw)
  To: u-boot

Am 10.03.2020 um 11:09 schrieb Patrick Delaunay:
> Add stub for functions clk_...() when CONFIG_CLK is deactivated.
> 
> This patch avoids compilation issues for driver using these API
> without protection (#if CONFIG_IS_ENABLED(CLK))
> 
> For example, before this patch we have undefined reference to
> `clk_disable_bulk') for code:
>   clk_disable_bulk(&priv->clks);
>   clk_release_bulk(&priv->clks);
> 
> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

> ---
> 
> Changes in v6:
> - return success in stub for clk_free/clk_enable/clk_disable/
>   clk_enable_bulk/clk_disable_bulk
> 
> Changes in v5:
> - use ERR_PTR in clk_get_parent()
> - force bulk->count = 0 in clk_get_bulk to avoid issue
>   for next call of clk_enable_bulk / clk_enable_bulk
> - update commit message
> 
> Changes in v4:
> - Add stub for all functions using 'struct clk' or 'struct clk_bulk'
>   after remarks on v3
> 
> Changes in v3:
> - Add stub for clk_disable_bulk
> 
> Changes in v2: None
> 
>  include/clk.h | 102 +++++++++++++++++++++++++++++++++++++++++++-------
>  1 file changed, 89 insertions(+), 13 deletions(-)
> 
> diff --git a/include/clk.h b/include/clk.h
> index 3336301815..60c4b7d075 100644
> --- a/include/clk.h
> +++ b/include/clk.h
> @@ -9,6 +9,7 @@
>  #define _CLK_H_
>  
>  #include <dm/ofnode.h>
> +#include <linux/err.h>
>  #include <linux/errno.h>
>  #include <linux/types.h>
>  
> @@ -312,6 +313,7 @@ static inline int clk_release_bulk(struct clk_bulk *bulk)
>  	return clk_release_all(bulk->clks, bulk->count);
>  }
>  
> +#if CONFIG_IS_ENABLED(CLK)
>  /**
>   * clk_request - Request a clock by provider-specific ID.
>   *
> @@ -433,19 +435,6 @@ int clk_disable_bulk(struct clk_bulk *bulk);
>   */
>  bool clk_is_match(const struct clk *p, const struct clk *q);
>  
> -int soc_clk_dump(void);
> -
> -/**
> - * clk_valid() - check if clk is valid
> - *
> - * @clk:	the clock to check
> - * @return true if valid, or false
> - */
> -static inline bool clk_valid(struct clk *clk)
> -{
> -	return clk && !!clk->dev;
> -}
> -
>  /**
>   * clk_get_by_id() - Get the clock by its ID
>   *
> @@ -465,6 +454,93 @@ int clk_get_by_id(ulong id, struct clk **clkp);
>   * @return true on binded, or false on no
>   */
>  bool clk_dev_binded(struct clk *clk);
> +
> +#else /* CONFIG_IS_ENABLED(CLK) */
> +
> +static inline int clk_request(struct udevice *dev, struct clk *clk)
> +{
> +	return -ENOSYS;
> +}
> +
> +static inline int clk_free(struct clk *clk)
> +{
> +	return 0;
> +}
> +
> +static inline ulong clk_get_rate(struct clk *clk)
> +{
> +	return -ENOSYS;
> +}
> +
> +static inline struct clk *clk_get_parent(struct clk *clk)
> +{
> +	return ERR_PTR(-ENOSYS);
> +}
> +
> +static inline long long clk_get_parent_rate(struct clk *clk)
> +{
> +	return -ENOSYS;
> +}
> +
> +static inline ulong clk_set_rate(struct clk *clk, ulong rate)
> +{
> +	return -ENOSYS;
> +}
> +
> +static inline int clk_set_parent(struct clk *clk, struct clk *parent)
> +{
> +	return -ENOSYS;
> +}
> +
> +static inline int clk_enable(struct clk *clk)
> +{
> +	return 0;
> +}
> +
> +static inline int clk_enable_bulk(struct clk_bulk *bulk)
> +{
> +	return 0;
> +}
> +
> +static inline int clk_disable(struct clk *clk)
> +{
> +	return 0;
> +}
> +
> +static inline int clk_disable_bulk(struct clk_bulk *bulk)
> +{
> +	return 0;
> +}
> +
> +static inline bool clk_is_match(const struct clk *p, const struct clk *q)
> +{
> +	return false;
> +}
> +
> +static inline int clk_get_by_id(ulong id, struct clk **clkp)
> +{
> +	return -ENOSYS;
> +}
> +
> +static inline bool clk_dev_binded(struct clk *clk)
> +{
> +	return false;
> +}
> +#endif /* CONFIG_IS_ENABLED(CLK) */
> +
> +/**
> + * clk_valid() - check if clk is valid
> + *
> + * @clk:	the clock to check
> + * @return true if valid, or false
> + */
> +static inline bool clk_valid(struct clk *clk)
> +{
> +	return clk && !!clk->dev;
> +}
> +
> +int soc_clk_dump(void);
> +
>  #endif
>  
>  #define clk_prepare_enable(clk) clk_enable(clk)
> 

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

* [PATCH v6 0/5] usb: host: dwc2: use driver model for PHY and CLOCK
  2020-03-10 18:27     ` Marek Vasut
@ 2020-03-11 12:30       ` Patrick DELAUNAY
  2020-03-11 12:42         ` Marek Vasut
  0 siblings, 1 reply; 15+ messages in thread
From: Patrick DELAUNAY @ 2020-03-11 12:30 UTC (permalink / raw)
  To: u-boot

Hi Marek,

> From: Marek Vasut <marex@denx.de>
> Sent: mardi 10 mars 2020 19:27
> 
> On 3/10/20 6:01 PM, Patrick DELAUNAY wrote:
> > Hi Marek,
> >
> >> From: Marek Vasut <marex@denx.de>
> >> Sent: mardi 10 mars 2020 16:20
> >> Subject: Re: [PATCH v6 0/5] usb: host: dwc2: use driver model for PHY
> >> and CLOCK
> >> Importance: High
> >>
> >> On 3/10/20 11:09 AM, Patrick Delaunay wrote:
> >>>
> >>> In this serie I update the DWC2 host driver to use the device tree
> >>> information and the associated PHY and CLOCK drivers when they are
> >>> availables.
> >>>
> >>> V6 is minor update of the first patch of the serie; I update some
> >>> clk stub to return success after Simon Goldschmidt remarks on V5:
> >>> http://patchwork.ozlabs.org/project/uboot/list/?series=162791
> >>
> >> Once Simon reviews them, I'll put them in usb/next . btw I'm not CCed
> >> on 1/5, would be helpful if you could keep the CC consistent, thanks
> >
> > Ok and thanks
> >
> > I used patman for the serie with default maintainers list + 3 reviewers in Serie-CC
> >     Series-cc: simon.k.r.goldschmidt at gmail.com
> >     Series-cc: b.galvani at gmail.com
> >     Series-cc: ley.foon.tan at intel.com
> >
> > But I forgot you. Sorry.
> 
> I'd expect get-maintainer script should tell you to add me, maybe patman needs
> fixing.

I will try to avoid this issue for my next serie...

FYI: I check and the CC list is build with (series.py::MakeCcFile)

1/ Get maitainer script

It give me for this patch

./scripts/get_maintainer.pl 0001-dm-clk-add-stub-when-CONFIG_CLK-is-deactivated.patch 
Peng Fan <peng.fan@nxp.com> (commit_signer:7/15=47%,authored:2/15=13%)
Lukasz Majewski <lukma@denx.de> (commit_signer:6/15=40%,authored:6/15=40%,added_lines:36/255=14%,removed_lines:1/17=6%)
Jean-Jacques Hiblot <jjhiblot@ti.com> (commit_signer:3/15=20%,authored:3/15=20%,added_lines:53/255=21%,removed_lines:3/17=18%)
Simon Glass <sjg@chromium.org> (commit_signer:3/15=20%)
Lokesh Vutla <lokeshvutla@ti.com> (commit_signer:1/15=7%)
Sekhar Nori <nsekhar@ti.com> (authored:1/15=7%)
Chunfeng Yun <chunfeng.yun@mediatek.com> (authored:1/15=7%,added_lines:40/255=16%)
Patrick Delaunay <patrick.delaunay@st.com> (added_lines:89/255=35%,removed_lines:13/17=76%)
Jagan Teki <jagan@amarulasolutions.com> (added_lines:15/255=6%)
u-boot at lists.denx.de (open list)

PS: same for "./scripts/get_maintainer.pl include/clk.h"

2/ tags (based on aliases of ./doc/git-mailrc)
   "dm" and "clk:"
	=> dm = sjg
	=> clk = unknown tag

   But no tag "usb" => marex

3/ Series-cc

So I don't think it is a not patman issue
and the maintainer list is build patch by patch in the serie...

I perhaps miss something in my configuration for the 'usb' serie.
 
For patman, I use 

$> git config sendemail.to uboot
$> git config sendemail.aliasesfile doc/git-mailrc
....
$> tools/patman/patman -c 5 -t -i

Perhaps I need to use the correct alias = "usb" for USB related topic....
(for all the serie and no more rely on "tags")

$> git config sendemail.to usb

In this case I have :

To: u-boot at lists.denx.de,
	Marek Vasut <marex@denx.de>
Cc: ley.foon.tan at intel.com,
	b.galvani at gmail.com,
	simon.k.r.goldschmidt at gmail.com,
	Patrick Delaunay <patrick.delaunay@st.com>,
	Chunfeng Yun <chunfeng.yun@mediatek.com>,
	Jagan Teki <jagan@amarulasolutions.com>,
	Jean-Jacques Hiblot <jjhiblot@ti.com>,
	Lukasz Majewski <lukma@denx.de>,
	Peng Fan <peng.fan@nxp.com>,
	Sekhar Nori <nsekhar@ti.com>,
	Simon Glass <sjg@chromium.org>,
	U-Boot STM32 <uboot-stm32@st-md-mailman.stormreply.com>
Subject: [PATCH v6 1/5] dm: clk: add stub when CONFIG_CLK is deactivat

Regards

Patrick

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

* [PATCH v6 0/5] usb: host: dwc2: use driver model for PHY and CLOCK
  2020-03-11 12:30       ` Patrick DELAUNAY
@ 2020-03-11 12:42         ` Marek Vasut
  0 siblings, 0 replies; 15+ messages in thread
From: Marek Vasut @ 2020-03-11 12:42 UTC (permalink / raw)
  To: u-boot

On 3/11/20 1:30 PM, Patrick DELAUNAY wrote:
> Hi Marek,

Hi,

>> From: Marek Vasut <marex@denx.de>
>> Sent: mardi 10 mars 2020 19:27
>>
>> On 3/10/20 6:01 PM, Patrick DELAUNAY wrote:
>>> Hi Marek,
>>>
>>>> From: Marek Vasut <marex@denx.de>
>>>> Sent: mardi 10 mars 2020 16:20
>>>> Subject: Re: [PATCH v6 0/5] usb: host: dwc2: use driver model for PHY
>>>> and CLOCK
>>>> Importance: High
>>>>
>>>> On 3/10/20 11:09 AM, Patrick Delaunay wrote:
>>>>>
>>>>> In this serie I update the DWC2 host driver to use the device tree
>>>>> information and the associated PHY and CLOCK drivers when they are
>>>>> availables.
>>>>>
>>>>> V6 is minor update of the first patch of the serie; I update some
>>>>> clk stub to return success after Simon Goldschmidt remarks on V5:
>>>>> http://patchwork.ozlabs.org/project/uboot/list/?series=162791
>>>>
>>>> Once Simon reviews them, I'll put them in usb/next . btw I'm not CCed
>>>> on 1/5, would be helpful if you could keep the CC consistent, thanks
>>>
>>> Ok and thanks
>>>
>>> I used patman for the serie with default maintainers list + 3 reviewers in Serie-CC
>>>     Series-cc: simon.k.r.goldschmidt at gmail.com
>>>     Series-cc: b.galvani at gmail.com
>>>     Series-cc: ley.foon.tan at intel.com
>>>
>>> But I forgot you. Sorry.
>>
>> I'd expect get-maintainer script should tell you to add me, maybe patman needs
>> fixing.
> 
> I will try to avoid this issue for my next serie...
> 
> FYI: I check and the CC list is build with (series.py::MakeCcFile)
> 
> 1/ Get maitainer script
> 
> It give me for this patch
> 
> ./scripts/get_maintainer.pl 0001-dm-clk-add-stub-when-CONFIG_CLK-is-deactivated.patch 

Because it's a clock patch, I see.
[...]

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

* [PATCH v6 0/5] usb: host: dwc2: use driver model for PHY and CLOCK
  2020-03-10 10:09 [PATCH v6 0/5] usb: host: dwc2: use driver model for PHY and CLOCK Patrick Delaunay
                   ` (5 preceding siblings ...)
  2020-03-10 15:20 ` [PATCH v6 0/5] usb: host: dwc2: use driver model for PHY and CLOCK Marek Vasut
@ 2020-04-24 13:42 ` Patrick DELAUNAY
  2020-04-24 13:44   ` Marek Vasut
  6 siblings, 1 reply; 15+ messages in thread
From: Patrick DELAUNAY @ 2020-04-24 13:42 UTC (permalink / raw)
  To: u-boot

Dear Marek,

> From: Patrick DELAUNAY <patrick.delaunay@st.com>
> Sent: mardi 10 mars 2020 11:09
> 
> 
> In this serie I update the DWC2 host driver to use the device tree information and
> the associated PHY and CLOCK drivers when they are availables.
> 
> V6 is minor update of the first patch of the serie; I update some clk stub to return
> success after Simon Goldschmidt remarks on V5:
> http://patchwork.ozlabs.org/project/uboot/list/?series=162791
> 
> I test the V4 of this serie on stm32mp157c-ev1 board, with PHY and CLK support
> (V5 was a minor update).
> 
> The U-CLASS are provided by:
> - PHY by USBPHYC driver = ./drivers/phy/phy-stm32-usbphyc.c
> - CLOCK by RCC clock driver = drivers/clk/clk_stm32mp1.c
> - RESET by RCC reset driver = drivers/reset/stm32-reset.c
> 
> And I activate the configuration
> +CONFIG_USB_DWC2=y
> 
> PS: it is not the default configuration to avoid conflict with gadget
>     driver
> 
> To solve a binding issue, I also deactivate the gadget support:
> by default only one driver is bound to the usbotg_hs node with "snps,dwc2"
> compatible, and today it is the device one (the first in the driver list).
> 
> I also need to deactivate hnp-srp support with:
> 
> &usbotg_hs {
> 	/* need to disable ONLY for HOST support */
> 	hnp-srp-disable;
> };
> 
> WARNING: OTG with device or host support is not correctly handle by DWC2
>          driver (see example for dynamic OTG role in DWC3 driver).
> 
> The tests executed on the stm32mp157c-ev1 target:
> 
> STM32MP> usb start
> starting USB...
> Bus usb-otg at 49000000: USB DWC2
> Bus usbh-ehci at 5800d000: USB EHCI 1.00
> scanning bus usb-otg at 49000000 for devices... 2 USB Device(s) found scanning
> bus usbh-ehci at 5800d000 for devices... 3 USB Device(s) found
>        scanning usb for storage devices... 2 Storage Device(s) found
> STM32MP> usb tree
> USB device tree:
>   1  Hub (480 Mb/s, 0mA)
>   |   U-Boot Root Hub
>   |
>   +-2  Mass Storage (480 Mb/s, 300mA)
>        Verbatim STORE N GO 070731C8ACD7EE97
> 
>   1  Hub (480 Mb/s, 0mA)
>   |  u-boot EHCI Host Controller
>   |
>   +-2  Hub (480 Mb/s, 2mA)
> 
> STM32MP> ls usb 0
> <DIR>       4096 .
> <DIR>       4096 ..
> <DIR>      16384 lost+found
> <DIR>       4096 record
>          1490212 xipImage
>         21058006 vmlinux
> 
> STM32MP> load usb 0 0xC0000000 vmlinux
> 21058006 bytes read in 10851 ms (1.9 MiB/s)
> 
> 
> Changes in v6:
> - return success in stub for clk_free/clk_enable/clk_disable/
>   clk_enable_bulk/clk_disable_bulk
> 
> Changes in v5:
> - use ERR_PTR in clk_get_parent()
> - force bulk->count = 0 in clk_get_bulk to avoid issue
>   for next call of clk_enable_bulk / clk_enable_bulk
> - update commit message
> - inverse logic for -ENOENT test on generic_phy_get_by_index result
> - Add some comments
> 
> Changes in v4:
> - Add stub for all functions using 'struct clk' or 'struct clk_bulk'
>   after remarks on v3
> 
> Changes in v3:
> - Add stub for clk_disable_bulk
> 
> Changes in v2:
> - update dev_err
> - update commit message
> - change dev_err to dev_dbg for PHY function call
> - treat dwc2_shutdown_phy error
> - add clk_disable_bulk in dwc2_usb_remove
> 
> Patrick Delaunay (5):
>   dm: clk: add stub when CONFIG_CLK is deactivated
>   usb: host: dwc2: add phy support
>   usb: host: dwc2: add clk support
>   usb: host: dwc2: force reset assert
>   usb: host: dwc2: add trace to have clean usb start
> 
>  drivers/usb/host/dwc2.c | 100 ++++++++++++++++++++++++++++++++++++++-
>  include/clk.h           | 102 +++++++++++++++++++++++++++++++++++-----
>  2 files changed, 188 insertions(+), 14 deletions(-)
> 
> --
> 2.17.1

Gentle reminder.

It is ok for v2020.07 or I need to rebase the serie ?

Patrick

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

* [PATCH v6 0/5] usb: host: dwc2: use driver model for PHY and CLOCK
  2020-04-24 13:42 ` Patrick DELAUNAY
@ 2020-04-24 13:44   ` Marek Vasut
  0 siblings, 0 replies; 15+ messages in thread
From: Marek Vasut @ 2020-04-24 13:44 UTC (permalink / raw)
  To: u-boot

On 4/24/20 3:42 PM, Patrick DELAUNAY wrote:
> Dear Marek,
> 
>> From: Patrick DELAUNAY <patrick.delaunay@st.com>
>> Sent: mardi 10 mars 2020 11:09
>>
>>
>> In this serie I update the DWC2 host driver to use the device tree information and
>> the associated PHY and CLOCK drivers when they are availables.
>>
>> V6 is minor update of the first patch of the serie; I update some clk stub to return
>> success after Simon Goldschmidt remarks on V5:
>> http://patchwork.ozlabs.org/project/uboot/list/?series=162791
>>
>> I test the V4 of this serie on stm32mp157c-ev1 board, with PHY and CLK support
>> (V5 was a minor update).
>>
>> The U-CLASS are provided by:
>> - PHY by USBPHYC driver = ./drivers/phy/phy-stm32-usbphyc.c
>> - CLOCK by RCC clock driver = drivers/clk/clk_stm32mp1.c
>> - RESET by RCC reset driver = drivers/reset/stm32-reset.c
>>
>> And I activate the configuration
>> +CONFIG_USB_DWC2=y
>>
>> PS: it is not the default configuration to avoid conflict with gadget
>>     driver
>>
>> To solve a binding issue, I also deactivate the gadget support:
>> by default only one driver is bound to the usbotg_hs node with "snps,dwc2"
>> compatible, and today it is the device one (the first in the driver list).
>>
>> I also need to deactivate hnp-srp support with:
>>
>> &usbotg_hs {
>> 	/* need to disable ONLY for HOST support */
>> 	hnp-srp-disable;
>> };
>>
>> WARNING: OTG with device or host support is not correctly handle by DWC2
>>          driver (see example for dynamic OTG role in DWC3 driver).
>>
>> The tests executed on the stm32mp157c-ev1 target:
>>
>> STM32MP> usb start
>> starting USB...
>> Bus usb-otg at 49000000: USB DWC2
>> Bus usbh-ehci at 5800d000: USB EHCI 1.00
>> scanning bus usb-otg at 49000000 for devices... 2 USB Device(s) found scanning
>> bus usbh-ehci at 5800d000 for devices... 3 USB Device(s) found
>>        scanning usb for storage devices... 2 Storage Device(s) found
>> STM32MP> usb tree
>> USB device tree:
>>   1  Hub (480 Mb/s, 0mA)
>>   |   U-Boot Root Hub
>>   |
>>   +-2  Mass Storage (480 Mb/s, 300mA)
>>        Verbatim STORE N GO 070731C8ACD7EE97
>>
>>   1  Hub (480 Mb/s, 0mA)
>>   |  u-boot EHCI Host Controller
>>   |
>>   +-2  Hub (480 Mb/s, 2mA)
>>
>> STM32MP> ls usb 0
>> <DIR>       4096 .
>> <DIR>       4096 ..
>> <DIR>      16384 lost+found
>> <DIR>       4096 record
>>          1490212 xipImage
>>         21058006 vmlinux
>>
>> STM32MP> load usb 0 0xC0000000 vmlinux
>> 21058006 bytes read in 10851 ms (1.9 MiB/s)
>>
>>
>> Changes in v6:
>> - return success in stub for clk_free/clk_enable/clk_disable/
>>   clk_enable_bulk/clk_disable_bulk
>>
>> Changes in v5:
>> - use ERR_PTR in clk_get_parent()
>> - force bulk->count = 0 in clk_get_bulk to avoid issue
>>   for next call of clk_enable_bulk / clk_enable_bulk
>> - update commit message
>> - inverse logic for -ENOENT test on generic_phy_get_by_index result
>> - Add some comments
>>
>> Changes in v4:
>> - Add stub for all functions using 'struct clk' or 'struct clk_bulk'
>>   after remarks on v3
>>
>> Changes in v3:
>> - Add stub for clk_disable_bulk
>>
>> Changes in v2:
>> - update dev_err
>> - update commit message
>> - change dev_err to dev_dbg for PHY function call
>> - treat dwc2_shutdown_phy error
>> - add clk_disable_bulk in dwc2_usb_remove
>>
>> Patrick Delaunay (5):
>>   dm: clk: add stub when CONFIG_CLK is deactivated
>>   usb: host: dwc2: add phy support
>>   usb: host: dwc2: add clk support
>>   usb: host: dwc2: force reset assert
>>   usb: host: dwc2: add trace to have clean usb start
>>
>>  drivers/usb/host/dwc2.c | 100 ++++++++++++++++++++++++++++++++++++++-
>>  include/clk.h           | 102 +++++++++++++++++++++++++++++++++++-----
>>  2 files changed, 188 insertions(+), 14 deletions(-)
>>
>> --
>> 2.17.1
> 
> Gentle reminder.

Rebase and resend please.

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

end of thread, other threads:[~2020-04-24 13:44 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-10 10:09 [PATCH v6 0/5] usb: host: dwc2: use driver model for PHY and CLOCK Patrick Delaunay
2020-03-10 10:09 ` [PATCH v6 1/5] dm: clk: add stub when CONFIG_CLK is deactivated Patrick Delaunay
2020-03-10 20:22   ` Simon Goldschmidt
2020-03-10 10:09 ` [PATCH v6 2/5] usb: host: dwc2: add phy support Patrick Delaunay
2020-03-10 10:09 ` [PATCH v6 3/5] usb: host: dwc2: add clk support Patrick Delaunay
2020-03-10 10:09 ` [PATCH v6 4/5] usb: host: dwc2: force reset assert Patrick Delaunay
2020-03-10 20:18   ` Simon Goldschmidt
2020-03-10 10:09 ` [PATCH v6 5/5] usb: host: dwc2: add trace to have clean usb start Patrick Delaunay
2020-03-10 15:20 ` [PATCH v6 0/5] usb: host: dwc2: use driver model for PHY and CLOCK Marek Vasut
2020-03-10 17:01   ` Patrick DELAUNAY
2020-03-10 18:27     ` Marek Vasut
2020-03-11 12:30       ` Patrick DELAUNAY
2020-03-11 12:42         ` Marek Vasut
2020-04-24 13:42 ` Patrick DELAUNAY
2020-04-24 13:44   ` Marek Vasut

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.