From: Jim Lin <jilin@nvidia.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 80/80] dm: usb: Add a README for driver model
Date: Tue, 7 Apr 2015 11:24:30 +0800 [thread overview]
Message-ID: <55234DEE.1010307@nvidia.com> (raw)
In-Reply-To: <1427307788-7496-81-git-send-email-sjg@chromium.org>
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@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
next prev parent reply other threads:[~2015-04-07 3:24 UTC|newest]
Thread overview: 178+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-25 18:21 [U-Boot] [PATCH v2 0/80] dm: Add USB support Simon Glass
2015-03-25 18:21 ` [U-Boot] [PATCH v2 01/80] linker_lists: Add a function to access a linker list entry Simon Glass
2015-04-07 18:39 ` Simon Glass
2015-03-25 18:21 ` [U-Boot] [PATCH v2 02/80] sandbox: Fix comment for os_open() Simon Glass
2015-04-07 18:39 ` Simon Glass
2015-03-25 18:21 ` [U-Boot] [PATCH v2 03/80] dm: test: bus: Use a local variable to simplify code Simon Glass
2015-04-07 18:39 ` Simon Glass
2015-03-25 18:21 ` [U-Boot] [PATCH v2 04/80] dm: exynos: snow: Move the keyboard to I2C Simon Glass
2015-04-07 18:39 ` Simon Glass
2015-03-25 18:21 ` [U-Boot] [PATCH v2 05/80] dm: core: Support allocating driver-private data for DMA Simon Glass
2015-04-07 18:39 ` Simon Glass
2015-03-25 18:21 ` [U-Boot] [PATCH v2 06/80] dm: core: Convert driver_bind() to use const Simon Glass
2015-04-07 18:39 ` Simon Glass
2015-03-25 18:21 ` [U-Boot] [PATCH v2 07/80] dm: core: Rename driver data function to dev_get_driver_data() Simon Glass
2015-04-07 18:40 ` Simon Glass
2015-03-25 18:21 ` [U-Boot] [PATCH v2 08/80] dm: core: Mark device as active before calling uclass probe() methods Simon Glass
2015-04-07 18:40 ` Simon Glass
2015-03-25 18:21 ` [U-Boot] [PATCH v2 09/80] dm: core: Add device children and sibling functions Simon Glass
2015-04-07 18:40 ` Simon Glass
2015-03-25 18:21 ` [U-Boot] [PATCH v2 10/80] dm: gpio: Add an implementation for gpio_get_number() Simon Glass
2015-04-07 18:40 ` Simon Glass
2015-03-25 18:21 ` [U-Boot] [PATCH v2 11/80] dm: usb: Add a uclass for USB controllers Simon Glass
2015-04-07 18:40 ` Simon Glass
2015-03-25 18:22 ` [U-Boot] [PATCH v2 12/80] dm: usb: Adjust usb command to prepare for driver model Simon Glass
2015-04-07 18:40 ` Simon Glass
2015-03-25 18:22 ` [U-Boot] [PATCH v2 13/80] dm: usb: Adjust usb_alloc_new_device() to return an error Simon Glass
2015-04-07 18:40 ` Simon Glass
2015-03-25 18:22 ` [U-Boot] [PATCH v2 14/80] dm: usb: Convert 'usb' command to support driver model Simon Glass
2015-04-07 18:40 ` Simon Glass
2015-03-25 18:22 ` [U-Boot] [PATCH v2 15/80] dm: usb: Drop the legacy USB init sequence Simon Glass
2015-03-26 18:22 ` Marek Vasut
2015-04-07 18:41 ` Simon Glass
2015-03-25 18:22 ` [U-Boot] [PATCH v2 16/80] dm: usb: Refactor port resets Simon Glass
2015-04-07 18:41 ` Simon Glass
2015-03-25 18:22 ` [U-Boot] [PATCH v2 17/80] dm: usb: Move descriptor setup code into its own function Simon Glass
2015-04-07 18:41 ` Simon Glass
2015-03-25 18:22 ` [U-Boot] [PATCH v2 18/80] dm: usb: Split out more code from usb_new_device() Simon Glass
2015-04-07 18:41 ` Simon Glass
2015-03-25 18:22 ` [U-Boot] [PATCH v2 19/80] dm: usb: Complete the splitting up of usb_new_device() Simon Glass
2015-04-07 18:41 ` Simon Glass
2015-03-25 18:22 ` [U-Boot] [PATCH v2 20/80] dm: usb: Convert core usb.c file to support driver model Simon Glass
2015-04-07 18:41 ` Simon Glass
2015-03-25 18:22 ` [U-Boot] [PATCH v2 21/80] dm: usb: Split hub detection into its own function Simon Glass
2015-04-07 18:41 ` Simon Glass
2015-03-25 18:22 ` [U-Boot] [PATCH v2 22/80] dm: usb: Add driver model support for hubs Simon Glass
2015-04-07 18:41 ` Simon Glass
2015-03-25 18:22 ` [U-Boot] [PATCH v2 23/80] dm: usb: Move USB storage definitions to usb_defs.h Simon Glass
2015-04-07 18:42 ` Simon Glass
2015-03-25 18:22 ` [U-Boot] [PATCH v2 24/80] dm: usb: Fix type problems in usb_stor_get_info() Simon Glass
2015-04-07 18:42 ` Simon Glass
2015-03-25 18:22 ` [U-Boot] [PATCH v2 25/80] dm: usb: Simply device finding code in usb_storage Simon Glass
2015-04-07 18:42 ` Simon Glass
2015-03-25 18:22 ` [U-Boot] [PATCH v2 26/80] dm: usb: Adjust usb_storage to work with sandbox Simon Glass
2015-04-07 18:42 ` Simon Glass
2015-03-25 18:22 ` [U-Boot] [PATCH v2 27/80] dm: usb: Move storage device scanning into its own function Simon Glass
2015-04-07 18:43 ` Simon Glass
2015-03-25 18:22 ` [U-Boot] [PATCH v2 28/80] dm: usb: Convert usb_storage to driver model Simon Glass
2015-04-07 18:43 ` Simon Glass
2015-03-25 18:22 ` [U-Boot] [PATCH v2 29/80] dm: usb: Move all the EHCI weak functions together and declare them Simon Glass
2015-04-07 18:43 ` Simon Glass
2015-03-25 18:22 ` [U-Boot] [PATCH v2 30/80] dm: usb: Pass EHCI controller pointer to ehci_get_port_speed() Simon Glass
2015-04-07 18:43 ` Simon Glass
2015-03-25 18:22 ` [U-Boot] [PATCH v2 31/80] dm: usb: Allow ECHI to hold private data for the controller Simon Glass
2015-04-07 18:43 ` Simon Glass
2015-03-25 18:22 ` [U-Boot] [PATCH v2 32/80] dm: usb: tegra: Store the controller type explicitly Simon Glass
2015-04-07 18:43 ` Simon Glass
2015-03-25 18:22 ` [U-Boot] [PATCH v2 33/80] dm: usb: Pass EHCI controller pointer to ehci_powerup_fixup() Simon Glass
2015-04-07 18:43 ` Simon Glass
2015-03-25 18:22 ` [U-Boot] [PATCH v2 34/80] dm: usb: tegra: Drop use of global controller variable Simon Glass
2015-04-07 18:44 ` Simon Glass
2015-03-25 18:22 ` [U-Boot] [PATCH v2 35/80] dm: usb: Pass EHCI controller pointer to ehci_set_usbmode() Simon Glass
2015-04-07 18:44 ` Simon Glass
2015-03-25 18:22 ` [U-Boot] [PATCH v2 36/80] dm: usb: Pass EHCI controller pointer to ehci_get_portsc_register() Simon Glass
2015-04-07 18:44 ` Simon Glass
2015-03-25 18:22 ` [U-Boot] [PATCH v2 37/80] dm: usb: ehci: Use a function to find the controller from struct udevice Simon Glass
2015-04-07 18:44 ` Simon Glass
2015-03-25 18:22 ` [U-Boot] [PATCH v2 38/80] dm: usb: Refactor EHCI init Simon Glass
2015-04-07 18:44 ` Simon Glass
2015-03-25 18:22 ` [U-Boot] [PATCH v2 39/80] dm: usb: Drop the EHCI weak functions Simon Glass
2015-04-07 18:44 ` Simon Glass
2015-03-25 18:22 ` [U-Boot] [PATCH v2 40/80] dm: usb: Change ehci_reset() to use a pointer Simon Glass
2015-04-07 18:44 ` Simon Glass
2015-03-25 18:22 ` [U-Boot] [PATCH v2 41/80] dm: usb: Add driver model support to EHCI Simon Glass
2015-04-07 18:44 ` Simon Glass
2015-03-25 18:22 ` [U-Boot] [PATCH v2 42/80] dm: usb: Allow USB drivers to be declared and auto-probed Simon Glass
2015-04-07 18:45 ` Simon Glass
2015-03-25 18:22 ` [U-Boot] [PATCH v2 43/80] dm: usb: Bind generic USB devices when there is no driver Simon Glass
2015-04-07 18:45 ` Simon Glass
2015-03-25 18:22 ` [U-Boot] [PATCH v2 44/80] dm: usb: Allow setting up a USB controller as a device/gadget Simon Glass
2015-04-07 18:45 ` Simon Glass
2015-03-25 18:22 ` [U-Boot] [PATCH v2 45/80] dm: usb: Split out the keyboard probe into its own function Simon Glass
2015-04-07 18:45 ` Simon Glass
2015-03-25 18:22 ` [U-Boot] [PATCH v2 46/80] dm: usb: Support driver model with USB keyboards Simon Glass
2015-04-07 18:45 ` Simon Glass
2015-03-25 18:22 ` [U-Boot] [PATCH v2 47/80] dm: usb: tegra: Add vbus GPIOs for nyan Simon Glass
2015-04-07 19:09 ` Simon Glass
2015-03-25 18:22 ` [U-Boot] [PATCH v2 48/80] dm: usb: Move struct usb_string to a common place Simon Glass
2015-04-07 19:09 ` Simon Glass
2015-03-25 18:22 ` [U-Boot] [PATCH v2 49/80] dm: usb: sandbox: Add a uclass for USB device emulation Simon Glass
2015-04-07 19:09 ` Simon Glass
2015-03-25 18:22 ` [U-Boot] [PATCH v2 50/80] dm: usb: sandbox: Reset emulation devices in usb stop() Simon Glass
2015-04-07 19:10 ` Simon Glass
2015-03-25 18:22 ` [U-Boot] [PATCH v2 51/80] dm: usb: sandbox: Add an emulator for USB flash devices Simon Glass
2015-04-07 19:10 ` Simon Glass
2015-03-25 18:22 ` [U-Boot] [PATCH v2 52/80] dm: usb: sandbox: Add an emulator for USB hub emulation Simon Glass
2015-04-07 19:10 ` Simon Glass
2015-03-25 18:22 ` [U-Boot] [PATCH v2 53/80] dm: usb: sandbox: Add a driver for sandbox Simon Glass
2015-04-07 19:10 ` Simon Glass
2015-03-25 18:22 ` [U-Boot] [PATCH v2 54/80] dm: usb: dts: sandbox: Add some sample USB devices to sandbox Simon Glass
2015-04-07 19:10 ` Simon Glass
2015-03-25 18:22 ` [U-Boot] [PATCH v2 55/80] dm: usb: Add support for USB ethernet devices with driver model Simon Glass
2015-04-07 19:10 ` Simon Glass
2015-03-25 18:22 ` [U-Boot] [PATCH v2 56/80] dm: usb: exynos: Add driver model support to exynos EHCI Simon Glass
2015-04-07 19:10 ` Simon Glass
2015-03-25 18:22 ` [U-Boot] [PATCH v2 57/80] dm: usb: tegra: Remove the port_addr_clear_csc variable Simon Glass
2015-03-26 3:38 ` Jim Lin
2015-03-26 9:01 ` Jim Lin
2015-04-07 19:10 ` Simon Glass
2015-03-25 18:22 ` [U-Boot] [PATCH v2 58/80] dm: usb: tegra: Tidy up error handling and a static function Simon Glass
2015-04-07 19:10 ` Simon Glass
2015-03-25 18:22 ` [U-Boot] [PATCH v2 59/80] dm: usb: tegra: Move most of init/uninit into a function Simon Glass
2015-04-07 19:10 ` Simon Glass
2015-03-25 18:22 ` [U-Boot] [PATCH v2 60/80] dm: usb: tegra: Add driver model support to tegra EHCI Simon Glass
2015-04-07 19:10 ` Simon Glass
2015-03-25 18:22 ` [U-Boot] [PATCH v2 61/80] dm: usb: xhci: Use a function to get xhci_ctrl Simon Glass
2015-04-07 19:11 ` Simon Glass
2015-03-25 18:22 ` [U-Boot] [PATCH v2 62/80] dm: usb: xhci: Use explicit parameters for xhci_alloc_virt_device() Simon Glass
2015-04-07 19:11 ` Simon Glass
2015-03-25 18:22 ` [U-Boot] [PATCH v2 63/80] dm: usb: xhci: Use explicit parameters for xhci_setup_addressable_virt_dev() Simon Glass
2015-04-07 19:11 ` Simon Glass
2015-03-25 18:22 ` [U-Boot] [PATCH v2 64/80] dm: usb: xhci: Factor out common init/uninit Simon Glass
2015-04-07 19:11 ` Simon Glass
2015-03-25 18:22 ` [U-Boot] [PATCH v2 65/80] dm: usb: Support driver model in XHCI Simon Glass
2015-04-07 19:11 ` Simon Glass
2015-03-25 18:22 ` [U-Boot] [PATCH v2 66/80] dm: usb: Rename the XHCI HCD to U-Boot Simon Glass
2015-04-07 19:11 ` Simon Glass
2015-03-25 18:22 ` [U-Boot] [PATCH v2 67/80] dm: usb: exynos: Adjust XHCI driver to support driver model Simon Glass
2015-04-07 19:11 ` Simon Glass
2015-03-25 18:22 ` [U-Boot] [PATCH v2 68/80] dm: usb: exynos: Use driver model for USB Simon Glass
2015-04-07 19:11 ` Simon Glass
2015-03-25 18:22 ` [U-Boot] [PATCH v2 69/80] dm: usb: exynos: Enable both USB ports on snow Simon Glass
2015-04-07 19:11 ` Simon Glass
2015-03-25 18:22 ` [U-Boot] [PATCH v2 70/80] dm: usb: exynos: Enable both EHCI and XHCI " Simon Glass
2015-04-07 19:11 ` Simon Glass
2015-03-25 18:22 ` [U-Boot] [PATCH v2 71/80] dm: usb: tegra: Move to driver model for USB Simon Glass
2015-04-07 19:11 ` Simon Glass
2015-03-25 18:23 ` [U-Boot] [PATCH v2 72/80] dm: usb: Add a generic descriptor struct Simon Glass
2015-04-07 19:11 ` Simon Glass
2015-03-25 18:23 ` [U-Boot] [PATCH v2 73/80] dm: usb: Tidy up pipe value decoding Simon Glass
2015-04-07 19:12 ` Simon Glass
2015-03-25 18:23 ` [U-Boot] [PATCH v2 74/80] dm: usb: sandbox: Enable USB Simon Glass
2015-04-07 19:12 ` Simon Glass
2015-03-25 18:23 ` [U-Boot] [PATCH v2 75/80] dm: test: Correct printf() output nit in 'dm uclass' Simon Glass
2015-04-07 19:12 ` Simon Glass
2015-03-25 18:23 ` [U-Boot] [PATCH v2 76/80] dm: test: Allow 'dm test' to select a particular test to run Simon Glass
2015-04-07 19:12 ` Simon Glass
2015-03-25 18:23 ` [U-Boot] [PATCH v2 77/80] dm: usb: Add tests for the USB uclass Simon Glass
2015-04-07 19:12 ` Simon Glass
2015-04-21 5:24 ` Joe Hershberger
2015-04-21 13:14 ` Simon Glass
2015-04-21 16:05 ` Joe Hershberger
2015-04-21 16:19 ` Simon Glass
2015-04-21 16:57 ` Joe Hershberger
2015-04-21 17:00 ` Simon Glass
2015-04-21 20:10 ` Joe Hershberger
2015-04-21 20:14 ` Simon Glass
2015-03-25 18:23 ` [U-Boot] [PATCH v2 78/80] dm: usb: tegra: Drop legacy USB code Simon Glass
2015-06-11 20:19 ` Simon Glass
2015-03-25 18:23 ` [U-Boot] [PATCH v2 79/80] dm: usb: exynos: " Simon Glass
2015-05-06 21:44 ` Simon Glass
2015-03-25 18:23 ` [U-Boot] [PATCH v2 80/80] dm: usb: Add a README for driver model Simon Glass
2015-04-07 3:24 ` Jim Lin [this message]
2015-04-08 1:40 ` Simon Glass
2015-03-26 19:40 ` [U-Boot] [PATCH v2 0/80] dm: Add USB support Marek Vasut
2015-04-05 23:38 ` Simon Glass
2015-04-06 13:13 ` Marek Vasut
2015-04-06 22:38 ` Simon Glass
2015-04-07 13:52 ` Marek Vasut
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=55234DEE.1010307@nvidia.com \
--to=jilin@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