Dear Peter Chen, > - For host, the vbus should always be on. > - For otg, the vbus is off defaultly, the vbus needs to be > turned on/off when usb role switches. > > Signed-off-by: Peter Chen <peter.chen@xxxxxxxxxxxxx> > --- > drivers/usb/chipidea/ci.h | 2 + > drivers/usb/chipidea/ci13xxx_imx.c | 67 > ++++++++++++++++++++++++++---------- 2 files changed, 51 insertions(+), 18 > deletions(-) > > diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h > index d32f932..cd42b59 100644 > --- a/drivers/usb/chipidea/ci.h > +++ b/drivers/usb/chipidea/ci.h > @@ -170,6 +170,8 @@ struct ci13xxx { > #define B_SESS_VALID 1 > unsigned long events; > struct usb_otg otg; > + /* used to control internal vbus regulator */ > + struct regulator *reg_vbus; > }; > > static inline struct ci_role_driver *ci_role(struct ci13xxx *ci) > diff --git a/drivers/usb/chipidea/ci13xxx_imx.c > b/drivers/usb/chipidea/ci13xxx_imx.c index 0f5ca4b..935de97 100644 > --- a/drivers/usb/chipidea/ci13xxx_imx.c > +++ b/drivers/usb/chipidea/ci13xxx_imx.c > @@ -89,14 +89,34 @@ static struct ci13xxx_platform_data > ci13xxx_imx_platdata __devinitdata = { .name = "ci13xxx_imx", > .flags = CI13XXX_REQUIRE_TRANSCEIVER | > CI13XXX_PULLUP_ON_VBUS | > - CI13XXX_DISABLE_STREAMING, > + CI13XXX_DISABLE_STREAMING | > + CI13XXX_REGS_SHARED, Why is this REGS_SHARED change needed? > .capoffset = DEF_CAPOFFSET, > }; > > +static int ci13xxx_otg_set_vbus(struct usb_otg *otg, bool enabled) > +{ > + > + struct ci13xxx *ci = container_of(otg, struct ci13xxx, otg); > + struct regulator *reg_vbus = ci->reg_vbus; > + > + WARN_ON(!reg_vbus); > + > + if (reg_vbus) { if (!reg_vbus) { WARN and return; } if (enabled) ... You'll cut down on the indent and will make it more readable I believe. [...] -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html