diff mbox series

[v4,06/14] dm: doc: update of-plat with the support for driver aliases

Message ID 20200625041017.26204-7-walter.lozano@collabora.com
State Accepted
Delegated to: Simon Glass
Headers show
Series improve OF_PLATDATA support | expand

Commit Message

Walter Lozano June 25, 2020, 4:10 a.m. UTC
Update the documentation with the support for driver aliases using
U_BOOT_DRIVER_ALIAS.

Signed-off-by: Walter Lozano <walter.lozano@collabora.com>
---

 doc/driver-model/of-plat.rst | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

Comments

Simon Glass June 26, 2020, 1:43 a.m. UTC | #1
On Wed, 24 Jun 2020 at 22:11, Walter Lozano <walter.lozano@collabora.com> wrote:
>
> Update the documentation with the support for driver aliases using
> U_BOOT_DRIVER_ALIAS.
>
> Signed-off-by: Walter Lozano <walter.lozano@collabora.com>
> ---
>
>  doc/driver-model/of-plat.rst | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)

Reviewed-by: Simon Glass <sjg@chromium.org>
Simon Glass July 6, 2020, 1:31 a.m. UTC | #2
On Wed, 24 Jun 2020 at 22:11, Walter Lozano <walter.lozano@collabora.com> wrote:
>
> Update the documentation with the support for driver aliases using
> U_BOOT_DRIVER_ALIAS.
>
> Signed-off-by: Walter Lozano <walter.lozano@collabora.com>
> ---
>
>  doc/driver-model/of-plat.rst | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm/next, thanks!
diff mbox series

Patch

diff --git a/doc/driver-model/of-plat.rst b/doc/driver-model/of-plat.rst
index 034a68bb4e..376d4409a5 100644
--- a/doc/driver-model/of-plat.rst
+++ b/doc/driver-model/of-plat.rst
@@ -183,6 +183,17 @@  via U_BOOT_DRIVER(). This effectively means that a U_BOOT_DRIVER() with a
 it to a valid name for C) is needed, so a dedicated driver is required for
 each 'compatible' string.
 
+In order to make this a bit more flexible U_BOOT_DRIVER_ALIAS macro can be
+used to declare an alias for a driver name, typically a 'compatible' string.
+This macro produces no code, but it is by dtoc tool.
+
+During the build process dtoc parses both U_BOOT_DRIVER and U_BOOT_DRIVER_ALIAS
+to build a list of valid driver names and driver aliases. If the 'compatible'
+string used for a device does not not match a valid driver name, it will be
+checked against the list of driver aliases in order to get the right driver
+name to use. If in this step there is no match found a warning is issued to
+avoid run-time failures.
+
 Where a node has multiple compatible strings, a #define is used to make them
 equivalent, e.g.:
 
@@ -269,7 +280,7 @@  For example:
     };
 
     U_BOOT_DRIVER(mmc_drv) = {
-            .name           = "vendor_mmc",  /* matches compatible string */
+            .name           = "mmc_drv",
             .id             = UCLASS_MMC,
             .of_match       = mmc_ids,
             .ofdata_to_platdata = mmc_ofdata_to_platdata,
@@ -278,6 +289,7 @@  For example:
             .platdata_auto_alloc_size = sizeof(struct mmc_platdata),
     };
 
+    U_BOOT_DRIVER_ALIAS(mmc_drv, vendor_mmc) /* matches compatible string */
 
 Note that struct mmc_platdata is defined in the C file, not in a header. This
 is to avoid needing to include dt-structs.h in a header file. The idea is to