Re: [PATCHv6 12/19] usb: otg: twl6030: Start using struct usb_otg

From: ABRAHAM, KISHON VIJAY
Date: Tue Nov 08 2011 - 09:58:34 EST


Hi Heikki,

On Fri, Oct 28, 2011 at 6:05 PM, Heikki Krogerus
<heikki.krogerus@xxxxxxxxxxxxxxx> wrote:
> Use struct usb_otg members with OTG specific functions instead
> of usb_phy members.
>
> Signed-off-by: Heikki Krogerus <heikki.krogerus@xxxxxxxxxxxxxxx>
> Tested-by: Kishon Vijay Abraham I <kishon@xxxxxx>
> Cc: Hema HK <hemahk@xxxxxx>
> ---
>  drivers/usb/otg/twl6030-usb.c |  103 ++++++++++++++++++++++------------------
>  1 files changed, 57 insertions(+), 46 deletions(-)
>
> diff --git a/drivers/usb/otg/twl6030-usb.c b/drivers/usb/otg/twl6030-usb.c
> index 2f5c299..6de03fd 100644
> --- a/drivers/usb/otg/twl6030-usb.c
> +++ b/drivers/usb/otg/twl6030-usb.c
> @@ -87,7 +87,7 @@
>  #define        VBUS_DET                        BIT(2)
>
>  struct twl6030_usb {
> -       struct usb_phy  otg;
> +       struct usb_phy          xceiv;

here _usb_phy_ is a member of transceiver (by transceiver I mean
twl6030_usb). This makes _usb_phy_ getting created when you create
your transceiver object. By this we are actually tying our usb_phy to
our transceiver. But in hardware, phy and twl6030 are separate
entities.

>        struct device           *dev;
>
>        /* for vbus reporting with irqs disabled */
> @@ -107,7 +107,7 @@ struct twl6030_usb {
>        unsigned long           features;
>  };
>
> -#define xceiv_to_twl(x)                container_of((x), struct twl6030_usb, otg)
> +#define xceiv_to_twl(x)                container_of((x), struct twl6030_usb, xceiv)
>
>  /*-------------------------------------------------------------------------*/
>
> @@ -178,9 +178,9 @@ static int twl6030_phy_suspend(struct usb_phy *x, int suspend)
>        return 0;
>  }
>
> -static int twl6030_start_srp(struct usb_phy *x)
> +static int twl6030_start_srp(struct usb_otg *otg)
>  {
> -       struct twl6030_usb *twl = xceiv_to_twl(x);
> +       struct twl6030_usb *twl = xceiv_to_twl(otg->xceiv);
>
>        twl6030_writeb(twl, TWL_MODULE_USB, 0x24, USB_VBUS_CTRL_SET);
>        twl6030_writeb(twl, TWL_MODULE_USB, 0x84, USB_VBUS_CTRL_SET);

Here if you see, start_srp is a otg function and it operates on
twl6030. Maybe thats why I think, separating usb_phy from twl6030_usb
should be the first step than separating otg from twl6030_usb.

Thanks
Kishon
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/