From patchwork Thu Jun 25 04:10:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Walter Lozano X-Patchwork-Id: 1316721 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=collabora.com Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49smmj0K4Vz9sRW for ; Thu, 25 Jun 2020 14:11:48 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id CE035820EB; Thu, 25 Jun 2020 06:11:29 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=collabora.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id A5AAD820FC; Thu, 25 Jun 2020 06:11:08 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, UNPARSEABLE_RELAY,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id A3609820BB for ; Thu, 25 Jun 2020 06:11:00 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=walter.lozano@collabora.com Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: wlozano) with ESMTPSA id 3DE1D2A4393 From: Walter Lozano To: u-boot@lists.denx.de, Simon Glass Cc: Walter Lozano , Bin Meng , Lukasz Majewski , Peng Fan Subject: [PATCH v4 06/14] dm: doc: update of-plat with the support for driver aliases Date: Thu, 25 Jun 2020 01:10:09 -0300 Message-Id: <20200625041017.26204-7-walter.lozano@collabora.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200625041017.26204-1-walter.lozano@collabora.com> References: <20200625041017.26204-1-walter.lozano@collabora.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.2 at phobos.denx.de X-Virus-Status: Clean Update the documentation with the support for driver aliases using U_BOOT_DRIVER_ALIAS. Signed-off-by: Walter Lozano Reviewed-by: Simon Glass Reviewed-by: Simon Glass --- doc/driver-model/of-plat.rst | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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