public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Igor Grinberg <grinberg@compulab.co.il>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH V4 1/2] ehci-omap: driver for EHCI host on OMAP3
Date: Thu, 22 Dec 2011 11:59:55 +0200	[thread overview]
Message-ID: <4EF2FF9B.90901@compulab.co.il> (raw)
In-Reply-To: <CAAL8m4zRaybG_Ur-32mg4xnec9hAoUGnKXnCDrDmtytrkewkjQ@mail.gmail.com>

On 12/22/11 11:26, Govindraj wrote:
> Hi Igor,
> 
> On Thu, Dec 22, 2011 at 1:44 PM, Igor Grinberg <grinberg@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@emcraft.com> wrote:
>>>> Taken from Beagle code. Tested on mcx board (AM3517-based).
>>>>
>>>> Signed-off-by: Ilya Yanok <yanok@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.

  reply	other threads:[~2011-12-22  9:59 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-12 23:15 [U-Boot] [PATCH V4 0/2] Support for HTKW mcx board Ilya Yanok
2011-12-12 23:15 ` [U-Boot] [PATCH V4 1/2] ehci-omap: driver for EHCI host on OMAP3 Ilya Yanok
2011-12-19 23:17   ` Ilya Yanok
2011-12-22  6:55   ` Govindraj
2011-12-22  8:14     ` Igor Grinberg
2011-12-22  9:26       ` Govindraj
2011-12-22  9:59         ` Igor Grinberg [this message]
2011-12-22 10:49           ` Govindraj
2011-12-22 11:18             ` Igor Grinberg
2011-12-22 11:42               ` Govindraj
2011-12-22 13:24     ` Ilya Yanok
2012-01-15 20:40       ` Remy Bohmer
2012-01-15 22:04         ` Tom Rini
2012-01-16  7:58           ` Govindraj
2012-01-16  9:57             ` Stefano Babic
2012-01-17  6:14               ` Govindraj
2012-01-25 10:32                 ` Stefano Babic
2012-01-25 20:49                   ` Tom Rini
2012-01-27  9:07                     ` Govindraj
2012-01-27  9:12                       ` Stefano Babic
2011-12-12 23:15 ` [U-Boot] [PATCH V4 2/2] mcx: support for HTKW mcx board Ilya Yanok
2011-12-13 18:52   ` Tom Rini
2011-12-13 18:57     ` Ilya Yanok
2011-12-13 19:13     ` Ilya Yanok
2011-12-13 19:30       ` Tom Rini
2011-12-13 19:44         ` Ilya Yanok
2011-12-13 21:47           ` Tom Rini
2011-12-14  0:06             ` Ilya Yanok
2011-12-14  2:48               ` Tom Rini
2011-12-14 16:09                 ` Ilya Yanok
2011-12-13 23:54     ` [U-Boot] [PATCH V5 " Ilya Yanok
2011-12-14 16:05       ` [U-Boot] [PATCH V6 " Ilya Yanok
2011-12-19 22:55         ` Ilya Yanok
2011-12-19 22:56           ` Tom Rini
2011-12-19 23:07             ` Ilya Yanok
2011-12-19 23:12             ` Anatolij Gustschin
2011-12-19 23:16               ` Ilya Yanok
2012-02-05 14:57         ` [U-Boot] [PATCH V7] " Stefano Babic
2012-02-06 12:42           ` Igor Grinberg
2012-02-08  9:30         ` [U-Boot] [PATCH V8] " Stefano Babic
2012-02-08 10:07           ` Igor Grinberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4EF2FF9B.90901@compulab.co.il \
    --to=grinberg@compulab.co.il \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox