From: John Youn <John.Youn-HKixBCOQz3hWk0Htik3J/w@public.gmane.org>
To: "dinguyen-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org"
<dinguyen-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org>,
"linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Cc: "dinh.linux-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org"
<dinh.linux-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
"devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
John Youn <John.Youn-HKixBCOQz3hWk0Htik3J/w@public.gmane.org>
Subject: Re: [PATCH 1/2] usb: dwc2: Add reset control to dwc2
Date: Wed, 6 Apr 2016 23:51:24 -0700 [thread overview]
Message-ID: <5706036C.7080409@synopsys.com> (raw)
In-Reply-To: <1459229483-26167-1-git-send-email-dinguyen-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org>
On 3/28/2016 10:38 PM, dinguyen-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org wrote:
> From: Dinh Nguyen <dinguyen-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org>
>
> Allow for platforms that have a reset controller driver in place to bring
> the USB IP out of reset.
>
> Signed-off-by: Dinh Nguyen <dinguyen-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org>
> Cc: John Youn <johnyoun-HKixBCOQz3hWk0Htik3J/w@public.gmane.org>
> ---
> drivers/usb/dwc2/core.h | 1 +
> drivers/usb/dwc2/platform.c | 15 +++++++++++++++
> 2 files changed, 16 insertions(+)
>
> diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h
> index 3c58d63..f748132 100644
> --- a/drivers/usb/dwc2/core.h
> +++ b/drivers/usb/dwc2/core.h
> @@ -837,6 +837,7 @@ struct dwc2_hsotg {
> void *priv;
> int irq;
> struct clk *clk;
> + struct reset_control *reset;
>
> unsigned int queuing_high_bandwidth:1;
> unsigned int srp_success:1;
> diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c
> index 88629be..b1fa9dd 100644
> --- a/drivers/usb/dwc2/platform.c
> +++ b/drivers/usb/dwc2/platform.c
> @@ -45,6 +45,7 @@
> #include <linux/platform_device.h>
> #include <linux/phy/phy.h>
> #include <linux/platform_data/s3c-hsotg.h>
> +#include <linux/reset.h>
>
> #include <linux/usb/of.h>
>
> @@ -337,6 +338,9 @@ static int dwc2_lowlevel_hw_init(struct dwc2_hsotg *hsotg)
> {
> int i, ret;
>
> + if(hsotg->reset)
> + reset_control_deassert(hsotg->reset);
> +
> /* Set default UTMI width */
> hsotg->phyif = GUSBCFG_PHYIF16;
>
> @@ -434,6 +438,9 @@ static int dwc2_driver_remove(struct platform_device *dev)
> if (hsotg->ll_hw_enabled)
> dwc2_lowlevel_hw_disable(hsotg);
>
> + if (hsotg->reset)
> + reset_control_assert(hsotg->reset);
> +
> return 0;
> }
>
> @@ -529,6 +536,14 @@ static int dwc2_driver_probe(struct platform_device *dev)
> dev_dbg(&dev->dev, "mapped PA %08lx to VA %p\n",
> (unsigned long)res->start, hsotg->regs);
>
> + hsotg->reset = devm_reset_control_get(&dev->dev, "dwc2");
> + if (IS_ERR(hsotg->reset)) {
> + dev_info(&dev->dev, "Could not get reset control!\n");
> + if (PTR_ERR(hsotg->reset) == -EPROBE_DEFER)
> + return -EPROBE_DEFER;
> + hsotg->reset = NULL;
> + }
> +
Hi Dinh,
Can you move into the lowlevel_hw_init()? The probe is a bit bloated
and we have these existing "lowlevel" functions where we consolidate
stuff like this. Same with the assert/deassert if possible.
Regards,
John
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2016-04-07 6:51 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-29 5:31 [PATCH 1/2] usb: dwc2: Add reset control to dwc2 dinguyen-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx
[not found] ` <1459229483-26167-1-git-send-email-dinguyen-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org>
2016-03-29 5:31 ` [PATCH 2/2] ARM: socfpga: dts: add reset control for USB dinguyen-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx
2016-04-07 6:51 ` John Youn [this message]
[not found] ` <5706036C.7080409-HKixBCOQz3hWk0Htik3J/w@public.gmane.org>
2016-04-11 21:40 ` [PATCH 1/2] usb: dwc2: Add reset control to dwc2 Dinh Nguyen
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=5706036C.7080409@synopsys.com \
--to=john.youn-hkixbcoqz3hwk0htik3j/w@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=dinguyen-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org \
--cc=dinh.linux-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
/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.