public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Stephen Warren <swarren@wwwdotorg.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 3/3] tegra20: add USB ULPI init code
Date: Mon, 20 Aug 2012 12:27:04 -0600	[thread overview]
Message-ID: <50328178.9010608@wwwdotorg.org> (raw)
In-Reply-To: <1345466486.12175.32.camel@selen>

On 08/20/2012 06:41 AM, Lucas Stach wrote:
> Hello Igor,
> 
> thanks for your review. Comments inline.
> 
> Am Montag, den 20.08.2012, 15:07 +0300 schrieb Igor Grinberg:
>> Hi Lucas,
>>
>> On 08/19/12 19:08, Lucas Stach wrote:
>>> This adds the required code to set up a ULPI USB port. It is
>>> mostly a port of the Linux ULPI setup code with some tweaks
>>> added for more correctness, discovered along the way of
>>> debugging this.

>>>  	if (config->utmi) {
>>> +		if (init_utmi_usb_controller(config, usbctlr, timing)) {
>>> +			debug("tegrausb: Cannot init port\n");
>>
>> This also looks like an error...
>> So why debug()?
>>
>>> +			return -1;
>>> +		}
>>> +
>>>  		/* Disable ICUSB FS/LS transceiver */
>>>  		clrbits_le32(&usbctlr->icusb_ctrl, IC_ENB1);
>>>  
>>> @@ -345,6 +434,24 @@ static int add_port(struct fdt_usb *config, const u32 timing[])
>>>  		clrbits_le32(&usbctlr->port_sc1, STS);
>>>  		power_up_port(usbctlr);
>>>  	}
>>> +
>>> +	if (config->ulpi) {
>>> +#ifdef CONFIG_USB_ULPI
>>> +		/* set up 24MHz ULPI reference clock on pllp_out4 */
>>> +		clock_enable(PERIPH_ID_DEV2_OUT);
>>> +		clock_set_pllout(CLOCK_ID_PERIPH, PLL_OUT4, 24000000);
>>
>> Wouldn't it be clearer if:
>> 1) you put the above inside the init_ulpi_usb_controller() function
>> 2) Provide a !CONFIG_USB_ULPI implementation of the same function
>>    technically having only the code under #else below inside.
>>
> Actually I'm not really sure what to do about this. Although I've not
> seen any Tegra boards with a other ULPI reference freq used, maybe we
> should just move the clock setup into board code or add a device tree
> entry to tell the ref frequency.
> 
> Stephen, Tom, any ideas?

Moving all the initialization into init_utmi_usb_controller() and
init_ulpi_usb_controller() sounds reasonable to me.

I imagine that the reference frequency is somewhat driven by the
requirements of USB itself and/or the ULPI interface. I think it's fine
to just hard-code that in the USB driver for now; we can easily enhance
the driver to make it configurable from either DT or U-Boot config file
in the future if we need.

  reply	other threads:[~2012-08-20 18:27 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-19 16:08 [U-Boot] [PATCH 0/3] Tegra 2 USB ULPI series Lucas Stach
2012-08-19 16:08 ` [U-Boot] [PATCH 1/3] tegra20: complete periph_id enum Lucas Stach
2012-08-20 18:12   ` Stephen Warren
2012-08-21 19:04   ` Simon Glass
2012-08-19 16:08 ` [U-Boot] [PATCH 2/3] tegra20: add clock_set_pllout function Lucas Stach
2012-08-20 18:19   ` Stephen Warren
2012-08-19 16:08 ` [U-Boot] [PATCH 3/3] tegra20: add USB ULPI init code Lucas Stach
2012-08-20 12:07   ` Igor Grinberg
2012-08-20 12:41     ` Lucas Stach
2012-08-20 18:27       ` Stephen Warren [this message]
2012-08-21  7:59         ` Igor Grinberg
2012-08-21  7:54       ` Igor Grinberg
2012-08-20 18:25   ` Stephen Warren
2012-08-20 12:27 ` [U-Boot] [PATCH 0/3] Tegra 2 USB ULPI series Igor Grinberg
2012-08-20 12:43   ` Lucas Stach
2012-08-20 18:09 ` Stephen Warren
2012-08-20 19:59   ` Lucas Stach
2012-08-22 16:06     ` Stephen Warren

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=50328178.9010608@wwwdotorg.org \
    --to=swarren@wwwdotorg.org \
    --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