Message ID | 1328276312-30153-4-git-send-email-govindraj.raja@ti.com |
---|---|
State | Accepted, archived |
Commit | 95f87910422020fbbdc3dbbdd3e00f84c53b0b26 |
Headers | show |
On 02/03/12 15:38, Govindraj.R wrote: > From: "Govindraj.R" <govindraj.raja@ti.com> > > Adding ehci clock enabling mechanism part of clock framework. > When essential clocks are enabled during init phase usb host > clocks can also be enabled from clock framework. > > Signed-off-by: Govindraj.R <govindraj.raja@ti.com> Acked-by: Igor Grinberg <grinberg@compulab.co.il> > --- > arch/arm/cpu/armv7/omap3/board.c | 4 ++++ > arch/arm/cpu/armv7/omap3/clock.c | 20 ++++++++++++++++++++ > arch/arm/cpu/armv7/omap4/clocks.c | 5 +++++ > arch/arm/include/asm/arch-omap3/sys_proto.h | 1 + > 4 files changed, 30 insertions(+), 0 deletions(-) > > diff --git a/arch/arm/cpu/armv7/omap3/board.c b/arch/arm/cpu/armv7/omap3/board.c > index 871aa37..054e9c4 100644 > --- a/arch/arm/cpu/armv7/omap3/board.c > +++ b/arch/arm/cpu/armv7/omap3/board.c > @@ -228,6 +228,10 @@ void s_init(void) > > per_clocks_enable(); > > +#ifdef CONFIG_USB_EHCI_OMAP > + ehci_clocks_enable(); > +#endif Just a question (not blocking): I would really like to see this being a part of "usb start" call some day... Can't this be called from omap_ehci_hcd_init()? > + > #ifdef CONFIG_SPL_BUILD > preloader_console_init(); > > diff --git a/arch/arm/cpu/armv7/omap3/clock.c b/arch/arm/cpu/armv7/omap3/clock.c > index e0d65c7..567817e 100644 > --- a/arch/arm/cpu/armv7/omap3/clock.c > +++ b/arch/arm/cpu/armv7/omap3/clock.c > @@ -626,6 +626,26 @@ void prcm_init(void) > sdelay(5000); > } > > +/* > + * Enable usb ehci uhh, tll clocks > + */ > +void ehci_clocks_enable(void) > +{ > + struct prcm *prcm_base = (struct prcm *)PRCM_BASE; > + > + /* Enable USBHOST_L3_ICLK (USBHOST_MICLK) */ > + sr32(&prcm_base->iclken_usbhost, 0, 1, 1); > + /* > + * Enable USBHOST_48M_FCLK (USBHOST_FCLK1) > + * and USBHOST_120M_FCLK (USBHOST_FCLK2) > + */ > + sr32(&prcm_base->fclken_usbhost, 0, 2, 3); > + /* Enable USBTTL_ICLK */ > + sr32(&prcm_base->iclken3_core, 2, 1, 1); > + /* Enable USBTTL_FCLK */ > + sr32(&prcm_base->fclken3_core, 2, 1, 1); > +} > + > /****************************************************************************** > * peripheral_enable() - Enable the clks & power for perifs (GPT2, UART1,...) > *****************************************************************************/ > diff --git a/arch/arm/cpu/armv7/omap4/clocks.c b/arch/arm/cpu/armv7/omap4/clocks.c > index 0886f92..12e283a 100644 > --- a/arch/arm/cpu/armv7/omap4/clocks.c > +++ b/arch/arm/cpu/armv7/omap4/clocks.c > @@ -342,6 +342,9 @@ void enable_basic_clocks(void) > &prcm->cm_l4per_gpio4_clkctrl, > &prcm->cm_l4per_gpio5_clkctrl, > &prcm->cm_l4per_gpio6_clkctrl, > + &prcm->cm_l3init_usbphy_clkctrl, > + &prcm->cm_clksel_usb_60mhz, > + &prcm->cm_l3init_hsusbtll_clkctrl, > 0 > }; > > @@ -352,6 +355,8 @@ void enable_basic_clocks(void) > &prcm->cm_l4per_gptimer2_clkctrl, > &prcm->cm_wkup_wdtimer2_clkctrl, > &prcm->cm_l4per_uart3_clkctrl, > + &prcm->cm_l3init_fsusb_clkctrl, > + &prcm->cm_l3init_hsusbhost_clkctrl, > 0 > }; > > diff --git a/arch/arm/include/asm/arch-omap3/sys_proto.h b/arch/arm/include/asm/arch-omap3/sys_proto.h > index e5031d5..2a89e56 100644 > --- a/arch/arm/include/asm/arch-omap3/sys_proto.h > +++ b/arch/arm/include/asm/arch-omap3/sys_proto.h > @@ -34,6 +34,7 @@ struct emu_hal_params { > > void prcm_init(void); > void per_clocks_enable(void); > +void ehci_clocks_enable(void); > > void memif_init(void); > void sdrc_init(void);
On Mon, Feb 6, 2012 at 5:12 PM, Igor Grinberg <grinberg@compulab.co.il> wrote: > On 02/03/12 15:38, Govindraj.R wrote: >> From: "Govindraj.R" <govindraj.raja@ti.com> >> >> Adding ehci clock enabling mechanism part of clock framework. >> When essential clocks are enabled during init phase usb host >> clocks can also be enabled from clock framework. >> >> Signed-off-by: Govindraj.R <govindraj.raja@ti.com> > > Acked-by: Igor Grinberg <grinberg@compulab.co.il> > >> --- >> arch/arm/cpu/armv7/omap3/board.c | 4 ++++ >> arch/arm/cpu/armv7/omap3/clock.c | 20 ++++++++++++++++++++ >> arch/arm/cpu/armv7/omap4/clocks.c | 5 +++++ >> arch/arm/include/asm/arch-omap3/sys_proto.h | 1 + >> 4 files changed, 30 insertions(+), 0 deletions(-) >> >> diff --git a/arch/arm/cpu/armv7/omap3/board.c b/arch/arm/cpu/armv7/omap3/board.c >> index 871aa37..054e9c4 100644 >> --- a/arch/arm/cpu/armv7/omap3/board.c >> +++ b/arch/arm/cpu/armv7/omap3/board.c >> @@ -228,6 +228,10 @@ void s_init(void) >> >> per_clocks_enable(); >> >> +#ifdef CONFIG_USB_EHCI_OMAP >> + ehci_clocks_enable(); >> +#endif > > Just a question (not blocking): > I would really like to see this being a part of "usb start" call some day... > Can't this be called from omap_ehci_hcd_init()? But its better to have it part of clock framework. on omap4 I have added this part of enabling essential clocks done part of clock framework. "arch/arm/cpu/armv7/omap[4/5]/clocks.c" => "arch/arm/cpu/armv7/omap-common/clocks-common.c" but on omap3 we don't seem to use clocks common. so I have just used this function. on omap4/5 clocks.c makes things simpler for us. (re-use the same rather to complicate with our funcs) -- Thanks, Govindraj.R
On 02/06/12 13:57, Govindraj wrote: > On Mon, Feb 6, 2012 at 5:12 PM, Igor Grinberg <grinberg@compulab.co.il> wrote: >> On 02/03/12 15:38, Govindraj.R wrote: >>> From: "Govindraj.R" <govindraj.raja@ti.com> >>> >>> Adding ehci clock enabling mechanism part of clock framework. >>> When essential clocks are enabled during init phase usb host >>> clocks can also be enabled from clock framework. >>> >>> Signed-off-by: Govindraj.R <govindraj.raja@ti.com> >> >> Acked-by: Igor Grinberg <grinberg@compulab.co.il> >> >>> --- >>> arch/arm/cpu/armv7/omap3/board.c | 4 ++++ >>> arch/arm/cpu/armv7/omap3/clock.c | 20 ++++++++++++++++++++ >>> arch/arm/cpu/armv7/omap4/clocks.c | 5 +++++ >>> arch/arm/include/asm/arch-omap3/sys_proto.h | 1 + >>> 4 files changed, 30 insertions(+), 0 deletions(-) >>> >>> diff --git a/arch/arm/cpu/armv7/omap3/board.c b/arch/arm/cpu/armv7/omap3/board.c >>> index 871aa37..054e9c4 100644 >>> --- a/arch/arm/cpu/armv7/omap3/board.c >>> +++ b/arch/arm/cpu/armv7/omap3/board.c >>> @@ -228,6 +228,10 @@ void s_init(void) >>> >>> per_clocks_enable(); >>> >>> +#ifdef CONFIG_USB_EHCI_OMAP >>> + ehci_clocks_enable(); >>> +#endif >> >> Just a question (not blocking): >> I would really like to see this being a part of "usb start" call some day... >> Can't this be called from omap_ehci_hcd_init()? > > But its better to have it part of clock framework. > > on omap4 I have added this part of enabling essential > clocks done part of clock framework. > > "arch/arm/cpu/armv7/omap[4/5]/clocks.c" => > "arch/arm/cpu/armv7/omap-common/clocks-common.c" > > but on omap3 we don't seem to use clocks common. > so I have just used this function. > > on omap4/5 clocks.c makes things simpler for us. > (re-use the same rather to complicate with our funcs) Yes, I understand, it is indeed simpler. I'm trying also to see this from the final product POV, where things like power consumption and supermarket principle (pay only for what you buy) can meter. Again, this is fine (I already acked the patch), just wanted to know how difficult would it be to get it fine tuned for "usb start/stop". Thanks
diff --git a/arch/arm/cpu/armv7/omap3/board.c b/arch/arm/cpu/armv7/omap3/board.c index 871aa37..054e9c4 100644 --- a/arch/arm/cpu/armv7/omap3/board.c +++ b/arch/arm/cpu/armv7/omap3/board.c @@ -228,6 +228,10 @@ void s_init(void) per_clocks_enable(); +#ifdef CONFIG_USB_EHCI_OMAP + ehci_clocks_enable(); +#endif + #ifdef CONFIG_SPL_BUILD preloader_console_init(); diff --git a/arch/arm/cpu/armv7/omap3/clock.c b/arch/arm/cpu/armv7/omap3/clock.c index e0d65c7..567817e 100644 --- a/arch/arm/cpu/armv7/omap3/clock.c +++ b/arch/arm/cpu/armv7/omap3/clock.c @@ -626,6 +626,26 @@ void prcm_init(void) sdelay(5000); } +/* + * Enable usb ehci uhh, tll clocks + */ +void ehci_clocks_enable(void) +{ + struct prcm *prcm_base = (struct prcm *)PRCM_BASE; + + /* Enable USBHOST_L3_ICLK (USBHOST_MICLK) */ + sr32(&prcm_base->iclken_usbhost, 0, 1, 1); + /* + * Enable USBHOST_48M_FCLK (USBHOST_FCLK1) + * and USBHOST_120M_FCLK (USBHOST_FCLK2) + */ + sr32(&prcm_base->fclken_usbhost, 0, 2, 3); + /* Enable USBTTL_ICLK */ + sr32(&prcm_base->iclken3_core, 2, 1, 1); + /* Enable USBTTL_FCLK */ + sr32(&prcm_base->fclken3_core, 2, 1, 1); +} + /****************************************************************************** * peripheral_enable() - Enable the clks & power for perifs (GPT2, UART1,...) *****************************************************************************/ diff --git a/arch/arm/cpu/armv7/omap4/clocks.c b/arch/arm/cpu/armv7/omap4/clocks.c index 0886f92..12e283a 100644 --- a/arch/arm/cpu/armv7/omap4/clocks.c +++ b/arch/arm/cpu/armv7/omap4/clocks.c @@ -342,6 +342,9 @@ void enable_basic_clocks(void) &prcm->cm_l4per_gpio4_clkctrl, &prcm->cm_l4per_gpio5_clkctrl, &prcm->cm_l4per_gpio6_clkctrl, + &prcm->cm_l3init_usbphy_clkctrl, + &prcm->cm_clksel_usb_60mhz, + &prcm->cm_l3init_hsusbtll_clkctrl, 0 }; @@ -352,6 +355,8 @@ void enable_basic_clocks(void) &prcm->cm_l4per_gptimer2_clkctrl, &prcm->cm_wkup_wdtimer2_clkctrl, &prcm->cm_l4per_uart3_clkctrl, + &prcm->cm_l3init_fsusb_clkctrl, + &prcm->cm_l3init_hsusbhost_clkctrl, 0 }; diff --git a/arch/arm/include/asm/arch-omap3/sys_proto.h b/arch/arm/include/asm/arch-omap3/sys_proto.h index e5031d5..2a89e56 100644 --- a/arch/arm/include/asm/arch-omap3/sys_proto.h +++ b/arch/arm/include/asm/arch-omap3/sys_proto.h @@ -34,6 +34,7 @@ struct emu_hal_params { void prcm_init(void); void per_clocks_enable(void); +void ehci_clocks_enable(void); void memif_init(void); void sdrc_init(void);