[U-Boot] [PATCH V4 1/2] ehci-omap: driver for EHCI host on OMAP3

Igor Grinberg grinberg at compulab.co.il
Thu Dec 22 10:59:55 CET 2011


On 12/22/11 11:26, Govindraj wrote:
> Hi Igor,
> 
> On Thu, Dec 22, 2011 at 1:44 PM, Igor Grinberg <grinberg at compulab.co.il> wrote:
>> Hi Govindraj,
>>
>> On 12/22/11 08:55, Govindraj wrote:
>>> Hi IIya Yanok,

[...]

>>> On Tue, Dec 13, 2011 at 4:45 AM, Ilya Yanok <yanok at emcraft.com> wrote:
>>>> Taken from Beagle code. Tested on mcx board (AM3517-based).
>>>>
>>>> Signed-off-by: Ilya Yanok <yanok at emcraft.com>
>>>> ---

[...]

>>>> -/* Reset is needed otherwise the kernel-driver will throw an error. */
>>>> -int ehci_hcd_stop(void)
>>>> -{
>>>> -       pr_debug("Resetting OMAP3 EHCI\n");
>>>> -       gpio_set_value(GPIO_PHY_RESET, 0);
>>>> -       writel(OMAP_UHH_SYSCONFIG_SOFTRESET, OMAP3_UHH_BASE + OMAP_UHH_SYSCONFIG);
>>>> -       /* disable USB clocks */
>>>> -       struct prcm *prcm_base = (struct prcm *)PRCM_BASE;
>>>> -       sr32(&prcm_base->iclken_usbhost, 0, 1, 0);
>>>> -       sr32(&prcm_base->fclken_usbhost, 0, 2, 0);
>>>> -       sr32(&prcm_base->iclken3_core, 2, 1, 0);
>>>> -       sr32(&prcm_base->fclken3_core, 2, 1, 0);
>>>> -       return 0;
>>>> -}
>>>> -
>>>
>>> As said above only uhh reset should be done in ehci-omap and
>>> clock and gpio can be left in baird file itslef
>>> you can just implement ehci_omap_hcd_stop that will reset uhh.
>>
>> Or add SoC specific ehci_clk_disable()
>> and put the clock handling in it.
>>
> 
> probably the right method to do is as we did for panda,
> 
> Add to armv7/omap3/clock.c (soc specific code) to enable usb-host clocks.
> 
> as done in below patch for omap4 socs.
> 
> http://patchwork.ozlabs.org/patch/131365/

Hmmm... I don't like that patch - this is the right method...
but only for panda!
For panda it makes sense to enable the USB related clocks by default
because it has many of its boot important peripherals wired to USB.
That is not the case with majority of OMAP3 (and I bet with many
other OMAP4) boards.
Therefore, I think the USB clocks need to be turned on
only if the board requests them to be turned on and not as a part
of the default clock initialization by the PRCM subsystem
(unless it is configurable in the board config file).

[...]

>>>> -/*
>>>> - * Initialize the OMAP3 EHCI controller and PHY on the BeagleBoard.
>>>> - * Based on "drivers/usb/host/ehci-omap.c" from Linux 2.6.37.
>>>> - * See there for additional Copyrights.
>>>> - */
>>>> -int ehci_hcd_init(void)
>>>> -{
>>>> -       pr_debug("Initializing OMAP3 ECHI\n");
>>>> -
>>>> -       /* Put the PHY in RESET */
>>>> -       gpio_request(GPIO_PHY_RESET, "");
>>>> -       gpio_direction_output(GPIO_PHY_RESET, 0);
>>>> -       gpio_set_value(GPIO_PHY_RESET, 0);
>>>> -
>>>> -       /* Hold the PHY in RESET for enough time till DIR is high */
>>>> -       /* Refer: ISSUE1 */
>>>> -       udelay(10);
>>>> -
>>>> -       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);
>>>> -       pr_debug("USB clocks enabled\n");
>>>> -
>>>
>>> same here also must be left in beagle board file and
>>> implement omap_ehci_hcd_init() which will reset uhh, tll and
>>> configure phy_ulpi mode.
>>
>> SoC specific ehci_clk_enable() should be better then in board code.
>>
> 
> yes probably or
> even better add to clock framework as done for omap4
> (in patch work link shared above)

same comment as above

[...]

>>>> diff --git a/include/configs/omap3_beagle.h b/include/configs/omap3_beagle.h
>>>> index 91af8a0..b4d6443 100644
>>>> --- a/include/configs/omap3_beagle.h
>>>> +++ b/include/configs/omap3_beagle.h
>>>> @@ -129,6 +129,9 @@
>>>>  /* USB EHCI */
>>>>  #define CONFIG_CMD_USB
>>>>  #define CONFIG_USB_EHCI
>>>> +#define CONFIG_USB_EHCI_OMAP
>>>> +/*#define CONFIG_EHCI_DCACHE*/ /* leave it disabled for now */
>>>
>>> Any reason for this?
>>>
>>> Probably we are missing #define CONFIG_EHCI_DCACHE
>>>
>>> Let me know if you intend to clean up it up or I can take up and
>>> re-base my stuff by
>>> moving back the clock and gpio stuff back to beagle board.
>>
>> Please, don't move the clocks handling code back to board file.
>> It should not be there. It should be available to all boards
>> having OMAP3 SoC.
>> I think this also stands for OMAP4 boards unless it is so panda
>> specific, which I think is not the case.
>>
> 
> Sorry for confusion here, Actually it should be handled with soc specific
> clock framework.

Right, and also allow the "usb start/stop" commands do the job.

> 
>>> or can we re-use ehci-omap.c done for panda for beagle?
>>
>> Agreed, but please, understand - the world is not only beagle
>> and panda. You need to let other boards benefit from that code
>> (that is the intension in generalizing stuff, right?) which is not
>> board specific.
>>
> 
> Yes Agree.. :)  intention is to re-use ehci-omap.c across some socs, and boards.
> 
> until IP block doesn't change for a new soc !!



-- 
Regards,
Igor.


More information about the U-Boot mailing list