A blank space between "host:" and "vbus"

Reply-To: 
In-Reply-To: <1389171985-9282-4-git-send-email-b47...@freescale.com>

On Wed, Jan 08, 2014 at 05:06:18PM +0800, Li Jun wrote:
> Leave vbus on/off hanlded by OTG fsm if in OTG mode, init OTG port number.
                                                     ^and
What does the OTG port number mean? It is always 1?
If there are two OTG port, how about the value of the otg_port?

> 
> Signed-off-by: Li Jun <b47...@freescale.com>
> ---
>  drivers/usb/chipidea/host.c |   13 +++++++++----
>  drivers/usb/chipidea/host.h |    9 +++++++++
>  2 files changed, 18 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/usb/chipidea/host.c b/drivers/usb/chipidea/host.c
> index 526cd77..bba54c3 100644
> --- a/drivers/usb/chipidea/host.c
> +++ b/drivers/usb/chipidea/host.c
> @@ -66,7 +66,7 @@ static int host_start(struct ci_hdrc *ci)
>       ehci->has_hostpc = ci->hw_bank.lpm;
>       ehci->has_tdi_phy_lpm = ci->hw_bank.lpm;
>  
> -     if (ci->platdata->reg_vbus) {
> +     if ((ci->platdata->reg_vbus) && !ci_host_is_otg(ci)) {

The first () is not needed.
Any ways to unify the vbus controller for both OTG and non-OTG cases?

>               ret = regulator_enable(ci->platdata->reg_vbus);
>               if (ret) {
>                       dev_err(ci->dev,
> @@ -79,8 +79,13 @@ static int host_start(struct ci_hdrc *ci)
>       ret = usb_add_hcd(hcd, 0, 0);
>       if (ret)
>               goto disable_reg;
> -     else
> +     else {
>               ci->hcd = hcd;
> +             if (ci_host_is_otg(ci)) {
> +                     ci->transceiver->otg->host = &hcd->self;
> +                     ci->transceiver->otg->host->otg_port = 1;
> +             }
> +     }
>  
>       if (ci->platdata->flags & CI_HDRC_DISABLE_STREAMING)
>               hw_write(ci, OP_USBMODE, USBMODE_CI_SDIS, USBMODE_CI_SDIS);
> @@ -88,7 +93,7 @@ static int host_start(struct ci_hdrc *ci)
>       return ret;
>  
>  disable_reg:
> -     if (ci->platdata->reg_vbus)
> +     if ((ci->platdata->reg_vbus) && !ci_host_is_otg(ci))
>               regulator_disable(ci->platdata->reg_vbus);
>  
>  put_hcd:
> @@ -104,7 +109,7 @@ static void host_stop(struct ci_hdrc *ci)
>       if (hcd) {
>               usb_remove_hcd(hcd);
>               usb_put_hcd(hcd);
> -             if (ci->platdata->reg_vbus)
> +             if ((ci->platdata->reg_vbus) && !ci_host_is_otg(ci))
>                       regulator_disable(ci->platdata->reg_vbus);
>       }
>  }
> diff --git a/drivers/usb/chipidea/host.h b/drivers/usb/chipidea/host.h
> index 5707bf3..f98d084 100644
> --- a/drivers/usb/chipidea/host.h
> +++ b/drivers/usb/chipidea/host.h
> @@ -6,6 +6,15 @@
>  int ci_hdrc_host_init(struct ci_hdrc *ci);
>  void ci_hdrc_host_destroy(struct ci_hdrc *ci);
>  
> +static inline bool ci_host_is_otg(struct ci_hdrc *ci)
> +{
> +#ifdef CONFIG_USB_OTG_FSM

CONFIG_USB_OTG?

> +     return (ci->is_otg) && (ci->platdata->dr_mode == USB_DR_MODE_OTG);

Why ci->platdata->dr_mode == USB_DR_MODE_OTG is needed to judge if a
host port is OTG port?

Besides, if the user chooses dr_mode as non USB_DR_MODE_OTG, and kernel
configuration chooses CONFIG_USB_OTG, the port should responds as host
only port. DT entries can always override kernel configuration.

> +#else
> +     return false;
> +#endif
> +}
> +
>  #else
>  
>  static inline int ci_hdrc_host_init(struct ci_hdrc *ci)
> -- 
> 1.7.8
> 
> 

-- 

Best Regards,
Peter Chen

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to