Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1686965

Re: [PATCH 2/3] usb: chipidea: Hook into mux framework to toggle usb switch

From Stephen Boyd <stephen.boyd@linaro.org>
Newsgroups linux.kernel
Subject Re: [PATCH 2/3] usb: chipidea: Hook into mux framework to toggle usb switch
Date 2017-07-14 00:40 +0200
Message-ID <u2UW5-34i-13@gated-at.bofh.it> (permalink)
References <u2ek9-1kG-3@gated-at.bofh.it> <u2eka-1kG-15@gated-at.bofh.it> <u2UW5-34i-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/3] USB Mux support for Chipidea Stephen Boyd <stephen.boyd@linaro.org> - 2017-07-12 03:10 +0200
  [PATCH 1/3] usb: misc: Add a driver for TC7USB40MU Stephen Boyd <stephen.boyd@linaro.org> - 2017-07-12 03:10 +0200
  [PATCH 2/3] usb: chipidea: Hook into mux framework to toggle usb switch Stephen Boyd <stephen.boyd@linaro.org> - 2017-07-12 03:10 +0200
    Re: [PATCH 2/3] usb: chipidea: Hook into mux framework to toggle usb switch Stephen Boyd <stephen.boyd@linaro.org> - 2017-07-14 00:40 +0200
      Re: [PATCH 2/3] usb: chipidea: Hook into mux framework to toggle usb  switch Rob Herring <robh@kernel.org> - 2017-07-17 19:30 +0200
  Re: [PATCH 0/3] USB Mux support for Chipidea Stephen Boyd <stephen.boyd@linaro.org> - 2017-07-14 00:40 +0200
    Re: [PATCH 0/3] USB Mux support for Chipidea Stephen Boyd <stephen.boyd@linaro.org> - 2017-07-14 23:30 +0200
    Re: [PATCH 0/3] USB Mux support for Chipidea Rob Herring <robh@kernel.org> - 2017-07-17 19:20 +0200

csiph-web