On Thu, Oct 16, 2014 at 09:41:27AM -0700, Kever Yang wrote: > Hi Felipe, > > Thank for comment. > > On 10/16/2014 06:23 AM, Felipe Balbi wrote: > >Hi, > > > >On Wed, Oct 15, 2014 at 10:46:17PM -0700, Kever Yang wrote: > >>This patch move clock init out of gadget into platform, > >>make both hcd and gadget can use the clock > >> > >>Signed-off-by: Kever Yang <kever.yang@xxxxxxxxxxxxxx> > >>--- > >> > >> drivers/usb/dwc2/gadget.c | 16 ++-------------- > >> drivers/usb/dwc2/hcd.c | 3 +++ > >> drivers/usb/dwc2/platform.c | 30 ++++++++++++++++++------------ > >> 3 files changed, 23 insertions(+), 26 deletions(-) > >> > >>diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c > >>index fa49c72..fddd923 100644 > >>--- a/drivers/usb/dwc2/hcd.c > >>+++ b/drivers/usb/dwc2/hcd.c > >>@@ -46,6 +46,7 @@ > >> #include <linux/delay.h> > >> #include <linux/io.h> > >> #include <linux/slab.h> > >>+#include <linux/clk.h> > >> #include <linux/usb.h> > >> #include <linux/usb/hcd.h> > >>@@ -2266,6 +2267,7 @@ static int _dwc2_hcd_start(struct usb_hcd *hcd) > >> spin_lock_irqsave(&hsotg->lock, flags); > >> hcd->state = HC_STATE_RUNNING; > >>+ clk_enable(hsotg->clk); > >with this you're moving clk_enable() from gadget to HCD. You might want > >to leave this completely to the glue; at least for now. > No, I moving devm_clk_get/clk_prerare_enable/clk_disable_unprepare > to platform, but not effect clk_enable/disable in the gadget. > > I send this patch for comments if we can do it in this way. > If not, how should we manage clock in hcd and gadget? As a first cut, I'd say only platform glue manages it. You can, anyway, "hide" clk_enable()/disable() under ->runtime_resume()/->runtime_suspend() and linux driver model will guarantee that will be called in the correct order. E.g.: ->runtime_resume(parent); for_each_child(parent) ->runtime_resume(child); conversely on suspend: for_each_child(parent) ->runtime_suspend(child); ->runtime_suspend(parent); -- balbi
Attachment:
signature.asc
Description: Digital signature