Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: stephen.boyd@linaro.org (Stephen Boyd)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/3] usb: chipidea: Hook into mux framework to toggle usb switch
Date: Thu, 13 Jul 2017 15:29:43 -0700	[thread overview]
Message-ID: <149998498328.4532.10720468535933872401@sboyd-linaro> (raw)
In-Reply-To: <2db7bc39-9274-6007-d971-59e2a577d437@axentia.se>

Quoting Peter Rosin (2017-07-11 23:45:24)
> On 2017-07-12 03:02, Stephen Boyd wrote:
> > @@ -102,4 +107,7 @@ Example:
> >               rx-burst-size-dword = <0x10>;
> >               extcon = <0>, <&usb_id>;
> >               phy-clkgate-delay-us = <400>;
> > +             mux-controls = <&usb_switch>;
> > +             mux-control-names = "usb_switch";
> > +             usb-switch-states = <0>, <1>;
> 
> I don't see the need for usb-switch-states? Just assume states 0/1 and
> if someone later needs some other states, make them add a property that
> overrides the defaults. Just document that 0 is host and 1 is device.
> 

Fine by me. Rob H do you agree?

> > diff --git a/drivers/usb/chipidea/host.c b/drivers/usb/chipidea/host.c
> > index 18cb8e46262d..9fd23ecc2da3 100644
> > --- a/drivers/usb/chipidea/host.c
> > +++ b/drivers/usb/chipidea/host.c
> > @@ -25,6 +25,7 @@
> >  #include <linux/usb/hcd.h>
> >  #include <linux/usb/chipidea.h>
> >  #include <linux/regulator/consumer.h>
> > +#include <linux/mux/consumer.h>
> >  
> >  #include "../host/ehci.h"
> >  
> > @@ -123,6 +124,13 @@ static int host_start(struct ci_hdrc *ci)
> >       if (usb_disabled())
> >               return -ENODEV;
> >  
> > +     if (!IS_ERR(ci->platdata->usb_switch.mux)) {
> > +             ret = mux_control_select(ci->platdata->usb_switch.mux,
> > +                                      ci->platdata->usb_switch.host);
> > +             if (ret)
> > +                     return ret;
> > +     }
> > +
> 
> You *must* call mux_control_deselect to clean up if there is a failure
> later in host_start. Is that handled in some non-obvious way?

Good catch. Thanks. I'll add in the unwinding on the error path.

  reply	other threads:[~2017-07-13 22:29 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-12  1:02 [PATCH 0/3] USB Mux support for Chipidea Stephen Boyd
2017-07-12  1:02 ` [PATCH 1/3] usb: misc: Add a driver for TC7USB40MU Stephen Boyd
2017-07-12  1:02 ` [PATCH 2/3] usb: chipidea: Hook into mux framework to toggle usb switch Stephen Boyd
2017-07-12  6:45   ` Peter Rosin
2017-07-13 22:29     ` Stephen Boyd [this message]
2017-07-17 17:22       ` Rob Herring
2017-07-12  1:02 ` [PATCH 3/3] arm64: dts: qcom: Collapse usb support into one node Stephen Boyd
2017-07-12  5:04 ` [PATCH 0/3] USB Mux support for Chipidea Peter Rosin
2017-07-13 22:35   ` Stephen Boyd
2017-07-14 21:27     ` Stephen Boyd
2017-07-15  8:33       ` Peter Rosin
2017-07-17 17:18     ` Rob Herring

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=149998498328.4532.10720468535933872401@sboyd-linaro \
    --to=stephen.boyd@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox