Hi Balbi, 2012/6/15 Felipe Balbi <balbi@xxxxxx>: > Hi Yu Xu, > > On Fri, Jun 15, 2012 at 08:21:45PM +0800, Yu Xu wrote: >> > the whole idea of udc_start() and udc_stop() is that you only power up >> > your controller when you know that you will need it. So on driver probe >> > you shouldn't really enable your clocks or configure anything and >> > instead, should move it all here. This is exactly the place you know >> > your controller will be needed, because you're probing a gadget driver. >> > >> > Other that that, it's all good. >> > >> We enable clock to access the usb controller register to read the address of >> op_regs and uvc_regs, and store to the mv_u3d structure. Then we disable >> clock. This is the only purpose of clock enable/disable in probe, but not intend >> to enable and configure usb controller in probe:) > > I see, that's ok... but if I look at your udc_start: > >> +static int mv_u3d_start(struct usb_gadget *g, >> + struct usb_gadget_driver *driver) >> +{ >> + struct mv_u3d *u3d = container_of(g, struct mv_u3d, gadget); >> + unsigned long flags; >> + >> + if (u3d->driver) >> + return -EBUSY; >> + >> + spin_lock_irqsave(&u3d->lock, flags); >> + >> + /* hook up the driver ... */ >> + driver->driver.bus = NULL; >> + u3d->driver = driver; >> + u3d->gadget.dev.driver = &driver->driver; >> + >> + u3d->ep0_dir = USB_DIR_OUT; >> + >> + spin_unlock_irqrestore(&u3d->lock, flags); >> + >> + u3d->vbus_valid_detect = 1; >> + >> + return 0; >> +} > > you're not configuring your controller here, so it has to be powered up > already, no ? Where you configuring and enabling the controller ? > You're right. In the current code, clock is not gated off if external vbus detection is supported. So I should gate off clock and power off whether there is external vbus detection supported or not. And power on/clock on in udc_start if external vbus detection is not supported. I'll fix it. > -- > balbi Thanks, Yu Xu -- 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