public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Stephen Warren <swarren@nvidia.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 10/14] tegra: usb: Add support for USB peripheral
Date: Fri, 02 Dec 2011 13:40:19 -0700	[thread overview]
Message-ID: <4ED937B3.2010206@nvidia.com> (raw)
In-Reply-To: <CAPnjgZ0zzJq2Ej846Mo-rZfyVM0yT4Fq3hpZVw4CdeeJR_VYhQ@mail.gmail.com>

On 12/02/2011 10:00 AM, Simon Glass wrote:
> On Fri, Dec 2, 2011 at 8:10 AM, Stephen Warren <swarren@nvidia.com> wrote:
>> On 12/01/2011 06:51 PM, Simon Glass wrote:
>>> On Mon, Nov 28, 2011 at 11:21 AM, Stephen Warren <swarren@nvidia.com> wrote:
>>>> On 11/23/2011 08:54 PM, Simon Glass wrote:
>>>>> This adds basic support for the Tegra2 USB controller. Board files should
>>>>> call board_usb_init() to set things up.
...
>>>>> +       config->enabled = fdtdec_get_is_enabled(blob, node);
>>>>> +       config->periph_id = fdtdec_get_int(blob, node, "periph-id", -1);
>>>>
>>>> periph-id is a U-Boot specific concept, not HW description. The DT
>>>> shouldn't contain that value.
>>>
>>> It is actually the bit position of the peripheral in the clock
>>> registers, so arguably a hardware description. U-Boot uses this to
>>> efficiently manage peripheral clocks, reset, pinmux, etc.
>>>
>>> How does the kernel figure out the clock register (etc.) to use with a
>>> particular peripheral? Also bear in mind that the intent with U-Boot
>>> is to be a lot more lightweight with these things.
>>
>> The DT binding has to be identical though; U-Boot implementation details
>> aren't supposed to affect the content of the DT.
>>
>> Clock bindings are an area of active development. I haven't been
>> following the progress, but I imagine that the clock controller will
>> define a node per clock, and the devices that consume the clock will
>> refer to that node using a phandle. It's then up to the clock controller
>> driver to extract whatever information it needs from the clock node and
>> map that to an internal periph-id. It's plausible that a legitimate part
>> of the clock binding itself is such a periph-id field, but that should
>> be defined by the clock controller binding, not the peripheral binding.
> 
> OK, well this is an example of where I would like to run with what we
> have, and adjust it later when things are finalized in the kernel.
> 
> I'm not sure about your analysis here actually. The peripherals have a
> selectable source clock and their own divider from that clock, plus
> they have bits for enabling their internal clock and reset. The
> registers for all of these can sort-of be indexed through the
> peripheral ID. I think with this model you would need to have a
> separate clock node for every peripheral, with the peripheral node
> pointing back to that. Perhaps that is what you mean. It means that
> every peripheral has its own node and then a clock node. It probably
> won't be too slow to decode.

re: the last-but-one sentence: Yes, I think that's how it'll work.

>>>>> +int board_usb_init(const void *blob)
>>>>> +{
>>>>> +#ifdef CONFIG_OF_CONTROL
>>>>> +       struct fdt_usb config;
>>>>> +       int clk_done = 0;
>>>>> +       int node, upto = 0;
>>>>> +       unsigned osc_freq = clock_get_rate(CLOCK_ID_OSC);
>>>>> +
>>>>> +       do {
>>>>> +               node = fdtdec_next_alias(blob, "usb",
>>>>> +                                        COMPAT_NVIDIA_TEGRA20_USB, &upto);
>>>>
>>>> Why only initialize USB controllers with aliases? Surely this should
>>>> enumerate all nodes with a specific compatible flag?
>>>
>>> The aliases are (I thought) the official way that device trees specify
>>> device ordering. No we do not enumerate things in U-Boot - there is no
>>> device model as such. We can do this on Tegra, but still need to know
>>> the order to use (i.e. which is port 0).
>>
>> I don't believe the kernel uses the alias for anything at all right now.
>> Instead, it enumerates all nodes that match a certain compatible flag,
>> and instantiates a device for each one it has a driver for. I believe
>> this mode of operation is pretty implicit in DT itself; it's something
>> U-Boot should do too.
> 
> It does this at present with USB. But we want to enumerate the ports
> and know which is port 0, which is port 1, etc. How does the kernel do
> that?

I don't think it cares; it just hosts a number of USB ports, and
peripherals show up on those USB ports. The numbering of the ports is
entirely arbitrary AFAIK.

-- 
nvpublic

  reply	other threads:[~2011-12-02 20:40 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-24  3:54 [U-Boot] [PATCH 01/14] fdt: Tidy up a few fdtdec problems Simon Glass
2011-11-24  3:54 ` [U-Boot] [PATCH 02/14] fdt: Add functions to access phandles, arrays and bools Simon Glass
2011-11-28 18:41   ` Stephen Warren
2011-11-29  5:12     ` David Gibson
2011-12-02  1:01     ` Simon Glass
2011-12-02 15:55       ` Stephen Warren
2011-12-02 16:38         ` Simon Glass
2011-12-02  3:33     ` Jerry Van Baren
2011-12-02  4:58       ` Simon Glass
2011-12-02 17:22         ` Jerry Van Baren
2011-12-02 18:12           ` Simon Glass
2011-11-24  3:54 ` [U-Boot] [PATCH 03/14] arm: fdt: Ensure that an embedded fdt is word-aligned Simon Glass
2011-11-24  3:54 ` [U-Boot] [PATCH 04/14] arm: fdt: Add skeleton device tree file Simon Glass
2011-11-24  3:54 ` [U-Boot] [PATCH 05/14] tegra: fdt: Add Tegra2x " Simon Glass
2011-11-28 18:56   ` Stephen Warren
2011-12-02  1:24     ` Simon Glass
2011-12-02 15:58       ` Stephen Warren
2011-12-02 16:47         ` Simon Glass
2011-11-24  3:54 ` [U-Boot] [PATCH 06/14] tegra: fdt: Add device tree file for Tegra2 Seaboard Simon Glass
2011-11-24  3:54 ` [U-Boot] [PATCH 07/14] tegra: fdt: Add initial device tree definitions for USB ports Simon Glass
2011-11-24  3:54 ` [U-Boot] [PATCH 08/14] tegra: usb: Add USB definitions for Tegra2 Seaboard Simon Glass
2011-11-24  3:54 ` [U-Boot] [PATCH 09/14] tegra: usb: Add support for data alignment and txfifo threshold Simon Glass
2011-11-28 19:05   ` Stephen Warren
2011-12-02  1:42     ` Simon Glass
2011-11-24  3:54 ` [U-Boot] [PATCH 10/14] tegra: usb: Add support for USB peripheral Simon Glass
2011-11-28 19:21   ` Stephen Warren
2011-12-02  1:51     ` Simon Glass
2011-12-02 16:10       ` Stephen Warren
2011-12-02 17:00         ` Simon Glass
2011-12-02 20:40           ` Stephen Warren [this message]
2011-12-02 23:07             ` Simon Glass
2011-12-03  0:59     ` Simon Glass
2011-12-05 21:33       ` Stephen Warren
2011-12-05 21:46         ` Simon Glass
2011-12-05 22:15           ` Stephen Warren
2011-12-05 23:35             ` Simon Glass
2011-12-06  0:17               ` Stephen Warren
2011-12-06  1:14                 ` Simon Glass
2011-12-06 20:42                   ` Stephen Warren
2011-12-06 21:23                     ` Simon Glass
2011-12-07 23:46                       ` Stephen Warren
2011-12-08 21:24                         ` Simon Glass
2011-12-12 18:18                           ` Stephen Warren
2011-12-12 18:42                             ` Simon Glass
2011-11-24  3:54 ` [U-Boot] [PATCH 11/14] tegra: usb: Add USB support to nvidia boards Simon Glass
2011-11-24  3:54 ` [U-Boot] [PATCH 12/14] tegra: usb: Add common USB defines for tegra2 boards Simon Glass
2011-11-24  3:54 ` [U-Boot] [PATCH 13/14] tegra: usb: Enable USB on Seaboard Simon Glass
2011-11-24  3:54 ` [U-Boot] [PATCH 14/14] tegra: fdt: Enable FDT support for Seaboard Simon Glass
2011-11-28 18:33 ` [U-Boot] [PATCH 01/14] fdt: Tidy up a few fdtdec problems Stephen Warren
2011-11-29  1:10   ` David Gibson
2011-12-01 20:59   ` Simon Glass

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=4ED937B3.2010206@nvidia.com \
    --to=swarren@nvidia.com \
    --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