From: Sascha Hauer <s.hauer@pengutronix.de> To: Barebox List <barebox@lists.infradead.org> Subject: [PATCH 5/8] usb: dwc3: reset controller before using it Date: Tue, 12 Oct 2021 09:33:49 +0200 [thread overview] Message-ID: <20211012073352.4071559-6-s.hauer@pengutronix.de> (raw) In-Reply-To: <20211012073352.4071559-1-s.hauer@pengutronix.de> Some dwc3 controllers have a reset assigned to them. Request it and reset the device before using it. Linux upstream driver uses an array of resets here, but in barebox we currently do have this functionality, so for now use the first reset only. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> --- drivers/usb/dwc3/core.c | 11 +++++++++++ drivers/usb/dwc3/core.h | 2 ++ 2 files changed, 13 insertions(+) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 04b700d12d..f618435cb6 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -14,6 +14,7 @@ #include <dma.h> #include <driver.h> #include <init.h> +#include <linux/reset.h> #include "gadget.h" #include "core.h" @@ -1125,6 +1126,16 @@ static int dwc3_probe(struct device_d *dev) if (ret) return ret; + dwc->reset = reset_control_get(dev, NULL); + if (IS_ERR(dwc->reset)) { + dev_err(dev, "Failed to get reset control: %pe\n", dwc->reset); + return PTR_ERR(dwc->reset); + } + + reset_control_assert(dwc->reset); + mdelay(1); + reset_control_deassert(dwc->reset); + dwc3_coresoft_reset(dwc); dwc3_cache_hwparams(dwc); diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index f2f7a311d1..94cc594920 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -1003,6 +1003,8 @@ struct dwc3 { struct clk_bulk_data *clks; int num_clks; + struct reset_control *reset; + struct phy *usb2_generic_phy; struct phy *usb3_generic_phy; -- 2.30.2 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2021-10-12 7:35 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-10-12 7:33 [PATCH v2 0/8] RK3568 updates Sascha Hauer 2021-10-12 7:33 ` [PATCH 1/8] phy: rockchip: Add dummy driver for child node Sascha Hauer 2021-10-12 7:33 ` [PATCH 2/8] ARM: Rockchip rk3568 EVB: Enable deep probe Sascha Hauer 2021-10-12 7:33 ` [PATCH 3/8] ARM: Rockchip: rk3568 EVB: use 64bit partition sizes Sascha Hauer 2021-10-12 7:33 ` [PATCH 4/8] phy: rockchip-inno-usb2: handle disabled child nodes gracefully Sascha Hauer 2021-10-12 7:33 ` Sascha Hauer [this message] 2021-10-12 7:33 ` [PATCH 6/8] ARM: rk3568: Detect USB boot Sascha Hauer 2021-10-12 7:33 ` [PATCH 7/8] cdev: Add function to get unallocated start of device Sascha Hauer 2021-10-12 7:52 ` Ahmad Fatoum 2021-10-12 8:31 ` Sascha Hauer 2021-10-12 7:33 ` [PATCH 8/8] ARM: Rockchip: RK3568: implement failsafe barebox update Sascha Hauer
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=20211012073352.4071559-6-s.hauer@pengutronix.de \ --to=s.hauer@pengutronix.de \ --cc=barebox@lists.infradead.org \ --subject='Re: [PATCH 5/8] usb: dwc3: reset controller before using it' \ /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
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox