Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8BBCFC4743C for ; Mon, 21 Jun 2021 20:08:45 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 573A06134F for ; Mon, 21 Jun 2021 20:08:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 573A06134F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A3988828EB; Mon, 21 Jun 2021 22:08:41 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="A9JdRPYX"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D1ED0828EB; Mon, 21 Jun 2021 20:39:32 +0200 (CEST) Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id E72AB828EB for ; Mon, 21 Jun 2021 20:39:28 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jbx6244@gmail.com Received: by mail-ej1-x633.google.com with SMTP id nd37so30481878ejc.3 for ; Mon, 21 Jun 2021 11:39:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=No/nBC4YC5PxI4+jt10oA/9uuNY4y2TKfsgY4jLk3q8=; b=A9JdRPYX7pAdjwtfjhUZHCiK1mNFpIcUEKjJgSZqjgyHjJ3XVBs5ByYMuVG5RSDLZj dx5C36hQjy1khvg9cieksb9lUCUvVIxzF4HxyNLr6/y7jN1W+pWK7qnPpMKJRrbGimcA fFfPxn9bWh6tAjWENJ0owfK2xHhuSCC2NxJjMNth1Dt6kN/FUhKnLHAENJ7QIDAKgqYo jlLwKYuswqxLECyeAUGD5B2MWSwWQo2vprvhEe0O82VSnbfEEefnCdvTzCt8XflHqTV2 zBPOjh6+AJS77UbWfS0K61FKDLRo79FsVHInqZjYM3VMMjAh5dCmMNxS5OM6KaoV+FWa 7n1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=No/nBC4YC5PxI4+jt10oA/9uuNY4y2TKfsgY4jLk3q8=; b=Frk3g3+1o8rdMFkCHh/aDxefISRjlOWYo15g8aypTgoEmnuRxjC6w4cj9KhgxxNwbX ONDzupHnoGnj71KhR18ml2iKACMCvSZKoU49GsYaxzxCav4DWoF310cNKmosAL1Gj8DJ 67ku8M2ZTiUsVbdz1TuI/PBpCdtr8j34iS0LYHZXdWgd5abeBIBsyd8xfQATMe6/ZrH+ AMy/6KtGi8F6phPIWjpcwHd6vmFTZj5XuNY0a3s+8bLggYIvMBxYGKnUGVNN3JFU5rnH mo/C4ZpUWXPuMG0n5tbGCwYajy8+8MpSLD3fgHT32SVb4KF1Hzy5KupUtRMM7kgV1bpX mBJw== X-Gm-Message-State: AOAM530T6K+DLt6EAVJ9KJVA0fjnOLZWCrVIehqvRRAOwj8goulzZYe5 y0/3ecSJaycDBzwaJvJBTQOAaf5aLKheQQ== X-Google-Smtp-Source: ABdhPJxmR74iAlcaBuc1OwbeAbAkzuKjug6ZS+/EKZGLyv0+inyqy+JCkNBBn/zr02nW8g3UwULjRg== X-Received: by 2002:a17:906:6817:: with SMTP id k23mr1632211ejr.300.1624300768527; Mon, 21 Jun 2021 11:39:28 -0700 (PDT) Received: from [192.168.2.2] (81-204-249-205.fixed.kpn.net. [81.204.249.205]) by smtp.gmail.com with ESMTPSA id i21sm2370833ejo.9.2021.06.21.11.39.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 21 Jun 2021 11:39:28 -0700 (PDT) Subject: Re: [PATCH v2 17/33] dtoc: Process driver aliases along with drivers To: Simon Glass , U-Boot Mailing List , Heiko Stuebner , Kever Yang , philipp.tomsich@vrull.eu References: <20210203130121.2478810-1-sjg@chromium.org> <20210203130121.2478810-18-sjg@chromium.org> From: Johan Jonker Message-ID: <63e6830f-f8f3-217c-c230-9ffdd6ac7200@gmail.com> Date: Mon, 21 Jun 2021 20:39:26 +0200 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210203130121.2478810-18-sjg@chromium.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Mon, 21 Jun 2021 22:08:40 +0200 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.103.2 at phobos.denx.de X-Virus-Status: Clean Hi Simon, Heiko, With introduction of rockchip-nand-controller.c in Linux and recently rockchip_nfc.c in U-boot it offers a renewed opportunity to add support for MK808 with a rk3066 + NAND to boot from. rk3066 shares /arch/arm/dts/rk3xxx.dtsi with rk3188. The only 'usable' boot loader now is closed source with proprietary FTL. As a spinoff to that discussion I've tried to compile for rk3188-radxarock as an example due to the lack of rk3066 support in next and enabling the new rockchip_nfc.c driver. I'm not familiar with Python/U-boot. Do you have an idea what this error below is about? Kind regards, Johan === python --version Python 2.7.13 === From rock_defconfig: CONFIG_SPL_OF_PLATDATA=y === git clone -b next https://source.denx.de/u-boot/custodians/u-boot-rockchip.git u-boot-next-20210619 make rock_defconfig make CROSS_COMPILE=/usr/bin/arm-linux-gnueabi- menuconfig [ ] Support for NAND controller on Rockchip SoCs (NEW) Add to rock.h: #define CONFIG_SYS_MAX_NAND_DEVICE 1 make CROSS_COMPILE=/usr/bin/arm-linux-gnueabi- all === mkdir -p spl/dts/ FDTGREP spl/dts/dt-spl.dtb COPY spl/u-boot-spl.dtb CC spl/./lib/asm-offsets.s CC spl/./arch/arm/lib/asm-offsets.s DTOC spl/dts/dt-plat.c Traceback (most recent call last): File "./tools/dtoc/dtoc", line 112, in options.phase, instantiate=options.instantiate) File "~/Downloads/u-boot-next-20210619/tools/dtoc/../dtoc/dtb_platdata.py", line 1180, in run_steps scan.scan_drivers() File "~/Downloads/u-boot-next-20210619/tools/dtoc/../dtoc/src_scan.py", line 649, in scan_drivers self.scan_driver(pathname) File "~/Downloads/u-boot-next-20210619/tools/dtoc/../dtoc/src_scan.py", line 608, in scan_driver self._parse_driver(fname, buff) File "~/Downloads/u-boot-next-20210619/tools/dtoc/../dtoc/src_scan.py", line 558, in _parse_driver self._driver_aliases[m_alias[2]] = m_alias[1] TypeError: '_sre.SRE_Match' object is not subscriptable scripts/Makefile.spl:352: recipe for target 'spl/dts/dt-plat.c' failed make[1]: *** [spl/dts/dt-plat.c] Error 1 Makefile:1977: recipe for target 'spl/u-boot-spl' failed make: *** [spl/u-boot-spl] Error 2 === Changed: self._driver_aliases[m_alias[2]] = m_alias[1] To: self._driver_aliases[m_alias.group(2)] = m_alias.group(1) Is that a correct python change of mine? === After that it compiles normal with only this warning. DTOC spl/dts/dt-plat.c WARNING: the driver rockchip_rk3188_grf was not found in the driver list WARNING: the driver rockchip_rk3188_pmu was not found in the driver list WARNING: the driver rockchip_rk3188_uart was not found in the driver list DTOC include/generated/dt-structs-gen.h WARNING: the driver rockchip_rk3188_grf was not found in the driver list WARNING: the driver rockchip_rk3188_pmu was not found in the driver list WARNING: the driver rockchip_rk3188_uart was not found in the driver list DTOC include/generated/dt-decl.h WARNING: the driver rockchip_rk3188_grf was not found in the driver list WARNING: the driver rockchip_rk3188_pmu was not found in the driver list WARNING: the driver rockchip_rk3188_uart was not found in the driver list On 2/3/21 2:01 PM, Simon Glass wrote: > Instead of using a separate step for this processing, handle it while > scanning its associated driver. This allows us to drop the code coverage > exception in this case. > > Note that only files containing drivers are scanned by dtoc, so aliases > declared in a file that doesn't hold a driver will not be noticed. It > would be confusing to put them anywhere other than in the driver that they > relate to, but update the documentation to say this explicitly, just in > case. > > Signed-off-by: Simon Glass > Signed-off-by: Simon Glass > --- > > (no changes since v1) > > doc/driver-model/of-plat.rst | 3 ++- > tools/dtoc/src_scan.py | 16 +++++----------- > tools/dtoc/test/dtoc_test_scan_drivers.cxx | 4 ++++ > 3 files changed, 11 insertions(+), 12 deletions(-) > > diff --git a/doc/driver-model/of-plat.rst b/doc/driver-model/of-plat.rst > index 4ef2fe699a4..a5a6e46e3ec 100644 > --- a/doc/driver-model/of-plat.rst > +++ b/doc/driver-model/of-plat.rst > @@ -183,7 +183,8 @@ each 'compatible' string. > > In order to make this a bit more flexible DM_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. > +This macro produces no code, but it is by dtoc tool. It must be located in the > +same file as its associated driver, ideally just after it. > > The parent_idx is the index of the parent driver_info structure within its > linker list (instantiated by the U_BOOT_DRVINFO() macro). This is used to support > diff --git a/tools/dtoc/src_scan.py b/tools/dtoc/src_scan.py > index 206b2b37583..9d161a2cbc7 100644 > --- a/tools/dtoc/src_scan.py > +++ b/tools/dtoc/src_scan.py > @@ -387,6 +387,7 @@ class Scanner: > in the file > _of_match - updated with each compatible string found in the file > _compat_to_driver - Maps compatible string to Driver > + _driver_aliases - Maps alias names to driver name > > Args: > fname (str): Filename being parsed (used for warnings) > @@ -438,6 +439,7 @@ class Scanner: > > re_phase = re.compile('^\s*DM_PHASE\((.*)\).*$') > re_hdr = re.compile('^\s*DM_HEADER\((.*)\).*$') > + re_alias = re.compile(r'DM_DRIVER_ALIAS\(\s*(\w+)\s*,\s*(\w+)\s*\)') > > # Matches the struct name for priv, plat > re_priv = self._get_re_for_member('priv_auto') > @@ -522,8 +524,11 @@ class Scanner: > driver = Driver(driver_name, fname) > else: > ids_m = re_ids.search(line) > + m_alias = re_alias.match(line) > if ids_m: > ids_name = ids_m.group(1) > + elif m_alias: > + self._driver_aliases[m_alias[2]] = m_alias[1] > > # Make the updates based on what we found > self._drivers.update(drivers) > @@ -557,17 +562,6 @@ class Scanner: > if 'UCLASS_DRIVER' in buff: > self._parse_uclass_driver(fname, buff) > > - # The following re will search for driver aliases declared as > - # DM_DRIVER_ALIAS(alias, driver_name) > - driver_aliases = re.findall( > - r'DM_DRIVER_ALIAS\(\s*(\w+)\s*,\s*(\w+)\s*\)', > - buff) > - > - for alias in driver_aliases: # pragma: no cover > - if len(alias) != 2: > - continue > - self._driver_aliases[alias[1]] = alias[0] > - > def scan_header(self, fname): > """Scan a header file to build a list of struct definitions > > diff --git a/tools/dtoc/test/dtoc_test_scan_drivers.cxx b/tools/dtoc/test/dtoc_test_scan_drivers.cxx > index f448767670e..f370b8951d0 100644 > --- a/tools/dtoc/test/dtoc_test_scan_drivers.cxx > +++ b/tools/dtoc/test/dtoc_test_scan_drivers.cxx > @@ -1 +1,5 @@ > +/* Aliases must be in driver files */ > +U_BOOT_DRIVER(sandbox_gpio) { > +}; > + > DM_DRIVER_ALIAS(sandbox_gpio, sandbox_gpio_alias2) >