[U-Boot] [PATCH v2 80/80] dm: usb: Add a README for driver model

Simon Glass sjg at chromium.org
Wed Apr 8 03:40:35 CEST 2015


Hi Jim,

On 6 April 2015 at 21:24, Jim Lin <jilin at nvidia.com> wrote:
> There are some typos. Please correct them, thanks.
>
>
> On 03/26/2015 02:23 AM, Simon Glass wrote:
>>
>> Add some documentation describing how USB is implemented with USB. This
>> might make things easier for people to understand.
>>
>> Signed-off-by: Simon Glass <sjg at chromium.org>
>> ---
>>
>> Changes in v2:
>> - Rewrite and expand series to support driver model fully
>>
>>   doc/driver-model/usb-info.txt | 415
>> ++++++++++++++++++++++++++++++++++++++++++
>>   1 file changed, 415 insertions(+)
>>   create mode 100644 doc/driver-model/usb-info.txt
>>
>> diff --git a/doc/driver-model/usb-info.txt b/doc/driver-model/usb-info.txt
>> new file mode 100644
>> index 0000000..3762b6c
>> --- /dev/null
>> +++ b/doc/driver-model/usb-info.txt
>> @@ -0,0 +1,415 @@
>> +How USB works with driver model
>> +===============================
>> +
>> +Introduction
>> +------------
>> +
>> +Driver model USB support makes use of existing features but changes how
>> +drivers are found. This document provides some information intended to
>> help
>> +understand how things work with USB in U-Boot when driver model is
>> enabled.
>> +
>> +
>> +Enabling driver model for USB
>> +-----------------------------
>> +
>> +A new CONFIG_DM_USB option is provided to enable driver model for USB.
>> This
>> +causes the USB uclass to be included, and drops the equivalent code in
>> +usb.c. In particular the usb_init() function is then implemented by the
>> +uclass.
>> +
>> +
>> +Support for ECHI and XCHI
>
> EHCI
> XHCI
>
>
>> +-------------------------
>> +
>> +So far OHCI is not supported. Both EHCI and XHCI drivers should be
>> declared
>> +as drivers in the USB uclass. For example:
>> +
>> +static const struct udevice_id ehci_usb_ids[] = {
>> +       { .compatible = "nvidia,tegra20-ehci", .data = USB_CTLR_T20 },
>> +       { .compatible = "nvidia,tegra30-ehci", .data = USB_CTLR_T30 },
>> +       { .compatible = "nvidia,tegra114-ehci", .data = USB_CTLR_T114 },
>> +       { }
>> +};
>> +
>> +U_BOOT_DRIVER(usb_ehci) = {
>> +       .name   = "ehci_tegra",
>> +       .id     = UCLASS_USB,
>> +       .of_match = ehci_usb_ids,
>> +       .ofdata_to_platdata = ehci_usb_ofdata_to_platdata,
>> +       .probe = tegra_ehci_usb_probe,
>> +       .remove = tegra_ehci_usb_remove,
>> +       .ops    = &ehci_usb_ops,
>> +       .platdata_auto_alloc_size = sizeof(struct usb_platdata),
>> +       .priv_auto_alloc_size = sizeof(struct fdt_usb),
>> +       .flags  = DM_FLAG_ALLOC_PRIV_DMA,
>> +};
>> +
>> +Here ehci_usb_ids is used to list the controllers that the driver
>> supports.
>> +Each has its own data value. Controllers must be in the UCLASS_USB
>> uclass.
>> +
>> +The ofdata_to_platdata() method allows the controller driver to grab any
>> +necessary settings from the device tree.
>> +
>> +The ops here are ehci_usb_ops. All EHCI drivers will use these same ops
>> in
>> +most cases, since they are all ECHI-compatible. For ECHI there are also
>> some
>
> EHCI-compatible
> For EHCI
>>
>> +special operations that can be overriden when calling ehci_register().
>
> overridden
>
>> +This defines a single controller, containing a root hub (which is
>> required).
>> +The hub is emulated by a hub emulator, and the emulated hub has a single
>> +flash stick to emulate on one of its ports.
>> +
>> +When 'usb start' is used, the following 'dm tree' output will be
>> available:
>> +
>> + usb         [ + ]    `-- usb at 1
>> + usb_hub     [ + ]        `-- hub
>> + usb_emul    [ + ]            |-- hub-emul
>> + usb_emul    [ + ]            |   `-- flash-stick
>> + usb_mass_st [ + ]            `-- usb_mass_storage
>> +
>> +
>> +This may look a confusing. Most of it mirrors the device tree, but the
>
> may look confusing
> --nvpublic

Thanks for the corrections, I fixed these.

Applied to u-boot-dm/next.


More information about the U-Boot mailing list