On Mon, Nov 19, 2012 at 08:17:34PM +0100, Sascha Hauer wrote:
> Hi Peter,
> 
> > @@ -139,6 +139,7 @@ struct ci13xxx {
> >     enum ci_role                    role;
> >     bool                            is_otg;
> >     struct work_struct              work;
> > +   struct delayed_work             dwork;
> >     struct workqueue_struct         *wq;
> >  
> >     struct dma_pool                 *qh_pool;
> > @@ -164,6 +165,11 @@ struct ci13xxx {
> >     bool                            global_phy;
> >     struct usb_phy                  *transceiver;
> >     struct usb_hcd                  *hcd;
> > +   /* events handled at ci_role_work */
> > +#define ID         0
> > +#define B_SESS_VALID       1
> > +   unsigned long events;
> > +   struct usb_otg                  otg;
> 
> I looked into implementing ULPI support for the chipidea driver. This
> does not integrate very well with having a struct usb_otg here. Instead
> it should be a pointer.  Look into drivers/usb/otg/ulpi.c. This
> allocates the struct usb_otg itself and we have to feed the pointer into
> struct ci13xxx.

We discussed before that the otg is not related to phy.
The struct usb_otg is better allocated at the otg driver, not phy driver.

But I find the otg APIs .set_host and .set_vbus are defined at ulpi.c,
and operate phy's registers. Besides, I find only otg port can access ulpi
API, correct? If it is, how host only port access ulpi register, eg, i.mx51
host 1.

To integrate ULPI phy, how about this?
- struct usb_otg is created at drivers/usb/chipidea/otg.c
- usb_phy_init needs to move after struct usb_otg is created.
- The struct usb_otg's API can be override by usb_phy_init
- At ulpi.c, do not create struct usb_otg, at ulpi_init, override
otg.set_host, and otg.set_vbus.

> 
> Also I think that using a regulator as a vbus provider is not i.MX
> specific, it's not even chipidea specific. I think this should be a
> driver of its own under drivers/usb/otg/, or maybe part of
> drivers/usb/otg/gpio_vbus.c.

To make it as generic driver(we can't use gpio_vbus.c), more things
need to consider:

- This gpio_vbus_reg.c driver needs to know usb role (host or device)
- For host, it needs to enable regulator at initialization process,
and disable regulator after usb driver unload.
so, the vbus control interfaces between gpio_vbus_reg.c and usb driver
are needed.
        

> 
> Sascha
> 
> -- 
> Pengutronix e.K.                           |                             |
> Industrial Linux Solutions                 | http://www.pengutronix.de/  |
> Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
> 

-- 

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