All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jean-Jacques Hiblot <jjhiblot@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 8/8] dwc3-generic: Add select_dr_mode operation
Date: Tue, 25 Sep 2018 11:03:23 +0200	[thread overview]
Message-ID: <1537866203-7717-9-git-send-email-jjhiblot@ti.com> (raw)
In-Reply-To: <1537866203-7717-1-git-send-email-jjhiblot@ti.com>

The select_dr_mode operation is executed when the glue driver is probed.
The role of this optional function is to configure the operating mode
of the controller at the glue level.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>

---

Changes in v3: None
Changes in v2: None

 drivers/usb/dwc3/dwc3-generic.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/drivers/usb/dwc3/dwc3-generic.c b/drivers/usb/dwc3/dwc3-generic.c
index 2c27dbc..169188c 100644
--- a/drivers/usb/dwc3/dwc3-generic.c
+++ b/drivers/usb/dwc3/dwc3-generic.c
@@ -8,6 +8,7 @@
  */
 
 #include <common.h>
+#include <asm-generic/io.h>
 #include <dm.h>
 #include <dm/device-internal.h>
 #include <dm/lists.h>
@@ -111,6 +112,12 @@ U_BOOT_DRIVER(dwc3_generic_peripheral) = {
 struct dwc3_glue_data {
 	struct clk_bulk		clks;
 	struct reset_ctl_bulk	resets;
+	fdt_addr_t regs;
+};
+
+struct dwc3_glue_ops {
+	void (*select_dr_mode)(struct udevice *dev, int index,
+			       enum usb_dr_mode mode);
 };
 
 static int dwc3_glue_bind(struct udevice *parent)
@@ -206,9 +213,14 @@ static int dwc3_glue_clk_init(struct udevice *dev,
 
 static int dwc3_glue_probe(struct udevice *dev)
 {
+	struct dwc3_glue_ops *ops = (struct dwc3_glue_ops *)dev_get_driver_data(dev);
 	struct dwc3_glue_data *glue = dev_get_platdata(dev);
+	struct udevice *child = NULL;
+	int index = 0;
 	int ret;
 
+	glue->regs = dev_read_addr(dev);
+
 	ret = dwc3_glue_clk_init(dev, glue);
 	if (ret)
 		return ret;
@@ -217,6 +229,20 @@ static int dwc3_glue_probe(struct udevice *dev)
 	if (ret)
 		return ret;
 
+	ret = device_find_first_child(dev, &child);
+	if (ret)
+		return ret;
+
+	while (child) {
+		enum usb_dr_mode dr_mode;
+
+		dr_mode = usb_get_dr_mode(dev_of_offset(child));
+		device_find_next_child(&child);
+		if (ops && ops->select_dr_mode)
+			ops->select_dr_mode(dev, index, dr_mode);
+		index++;
+	}
+
 	return 0;
 }
 
-- 
2.7.4

  parent reply	other threads:[~2018-09-25  9:03 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-25  9:03 [U-Boot] [PATCH v3 0/8] Improvements for the dwc3_generic driver Jean-Jacques Hiblot
2018-09-25  9:03 ` [U-Boot] [PATCH v3 1/8] usb: gadget: Do not call board_usb_xxx() directly in USB gadget drivers Jean-Jacques Hiblot
2018-09-25  9:03 ` [U-Boot] [PATCH v3 2/8] usb: introduce a separate config option for DM USB device Jean-Jacques Hiblot
2018-09-25  9:03 ` [U-Boot] [PATCH v3 3/8] usb: udc: implement DM versions of usb_gadget_initialize()/_release()/_handle_interrupt() Jean-Jacques Hiblot
2018-09-25  9:03 ` [U-Boot] [PATCH v3 4/8] dwc3_generic: do not probe the USB device driver when it's bound Jean-Jacques Hiblot
2018-09-25  9:03 ` [U-Boot] [PATCH v3 5/8] dwc3: move phy operation to core.c Jean-Jacques Hiblot
2018-09-25  9:03 ` [U-Boot] [PATCH v3 6/8] configs: evb-rk3328: Enable CONFIG_USB_DWC3 Jean-Jacques Hiblot
2018-09-25  9:03 ` [U-Boot] [PATCH v3 7/8] dwc3-generic: Handle the PHYs, the clocks and the reset lines Jean-Jacques Hiblot
2018-09-25  9:03 ` Jean-Jacques Hiblot [this message]
2018-09-25 11:28 ` [U-Boot] [PATCH v3 0/8] Improvements for the dwc3_generic driver Lukasz Majewski
2018-10-01 12:51   ` Lukasz Majewski
2018-10-01 13:26     ` Philipp Tomsich
2018-10-08  2:07       ` Kever Yang
2018-10-22 10:45         ` Jean-Jacques Hiblot
2018-10-09 14:29 ` Loic Devulder
2018-10-22 15:55   ` Jean-Jacques Hiblot
2018-10-22 16:16     ` Lukasz Majewski
2018-10-22 16:24       ` Jean-Jacques Hiblot
2018-10-26 10:25         ` Jean-Jacques Hiblot
2018-10-28 20:50           ` Lukasz Majewski
2018-11-01  9:27             ` Michal Simek
2018-11-01 15:56               ` Lukasz Majewski
2018-11-01 16:06                 ` Tom Rini
2018-11-01 16:55                   ` Lukasz Majewski
2018-11-16 14:49                     ` Jean-Jacques Hiblot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1537866203-7717-9-git-send-email-jjhiblot@ti.com \
    --to=jjhiblot@ti.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.