From patchwork Wed Dec 23 15:11:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1420177 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=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=gG1/EYgO; dkim-atps=neutral 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 4D1Gs06XxFz9sTX for ; Thu, 24 Dec 2020 02:12:04 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id AC4CE827D6; Wed, 23 Dec 2020 16:11:52 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="gG1/EYgO"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 228E98273E; Wed, 23 Dec 2020 16:11:46 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd29.google.com (mail-io1-xd29.google.com [IPv6:2607:f8b0:4864:20::d29]) (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 5C3488273E for ; Wed, 23 Dec 2020 16:11:43 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd29.google.com with SMTP id p187so15375589iod.4 for ; Wed, 23 Dec 2020 07:11:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=MarHk2dbyaJD2cADgU2by+bxGLXOagPXcVzR9xBJ9kw=; b=gG1/EYgO353dZTe5QjYLgc+A5Lm7SKag12PxjCptWk1OV24hkI1qITVq0AExyfNocL s441WQxegOOUJdRh1PjKHVRGEUnFG3oX8Hppb+Zee9mu47CososUb2pKY8KAUANzys39 F0kt+CkCaeZadIGg82mHyy8VaLYFSoyQJLI7c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MarHk2dbyaJD2cADgU2by+bxGLXOagPXcVzR9xBJ9kw=; b=nyTRzGzGXth3eYsLI6y5YhI4pneV61mDJzd+1gEh3Zzi3tprwm9UDI36ncf1pFSM8a 0nKJLUeFpu+j/OptOOnTxTUdeTgsSVvrXy9WtuTk1bjhTsjHSQFfAvCfbH4Ka1Rn9qPj TcZWMtkxVTns12/VbEWaqdVeEUSqupu3jEHYTmlwftapsFQSSRJ/9sGgQ1xjzXi85okz vU1YsiWXx/b/thizpcxNfrGRf8UOBpz2CJiP/6chLWGqR1aiAdducVUmj2dQN+8MNoEB SL3LiEgxRa0zqSF7/yxfA1jdIXYTGalMKntv2wt+8Dk4T21bUyeh0iD73JO+n54qswEH 2j0Q== X-Gm-Message-State: AOAM531hvRmtLm4M5CK3PAilB9J3miDIFv5hm8hw6BopJbMgQwGyoLlv ieWLEZY2uSTzqbMNkRor8hcMuDBkJ3L1siPu X-Google-Smtp-Source: ABdhPJzPLGjDKLaejg9uYGf+lKECVQc8OuO9Qlqebsg1gaHMnyfJhLy725wFQZj0JgS7+zab9J4Hrg== X-Received: by 2002:a6b:d01a:: with SMTP id x26mr21963721ioa.11.1608736302089; Wed, 23 Dec 2020 07:11:42 -0800 (PST) Received: from localhost.localdomain (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id c15sm16935667ils.87.2020.12.23.07.11.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Dec 2020 07:11:41 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass Subject: [PATCH v2 01/21] pinctrl: Drop post_bind() method when not needed Date: Wed, 23 Dec 2020 08:11:13 -0700 Message-Id: <20201223151133.2205985-2-sjg@chromium.org> X-Mailer: git-send-email 2.29.2.729.g45daf8777d-goog In-Reply-To: <20201223151133.2205985-1-sjg@chromium.org> References: <20201223151133.2205985-1-sjg@chromium.org> MIME-Version: 1.0 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.102.3 at phobos.denx.de X-Virus-Status: Clean This is not used with of-platdata, so remove it in that case. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- (no changes since v1) drivers/pinctrl/pinctrl-uclass.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/pinctrl/pinctrl-uclass.c b/drivers/pinctrl/pinctrl-uclass.c index aba88104747..4e474cbff73 100644 --- a/drivers/pinctrl/pinctrl-uclass.c +++ b/drivers/pinctrl/pinctrl-uclass.c @@ -305,7 +305,7 @@ int pinctrl_select_state(struct udevice *dev, const char *statename) * Some device which is logical like mmc.blk, do not have * a valid ofnode. */ - if (!ofnode_valid(dev->node)) + if (!dev_has_of_node(dev)) return 0; /* * Try full-implemented pinctrl first. @@ -416,7 +416,9 @@ static int __maybe_unused pinctrl_post_bind(struct udevice *dev) UCLASS_DRIVER(pinctrl) = { .id = UCLASS_PINCTRL, +#if !CONFIG_IS_ENABLED(OF_PLATDATA) .post_bind = pinctrl_post_bind, +#endif .flags = DM_UC_FLAG_SEQ_ALIAS, .name = "pinctrl", }; From patchwork Wed Dec 23 15:11:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1420178 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=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=oSDhh4Py; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (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 4D1GsB4njgz9sTX for ; Thu, 24 Dec 2020 02:12:14 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 95A0382B02; Wed, 23 Dec 2020 16:11:55 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="oSDhh4Py"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CC337827D6; Wed, 23 Dec 2020 16:11:47 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x12d.google.com (mail-il1-x12d.google.com [IPv6:2607:f8b0:4864:20::12d]) (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 61A678274B for ; Wed, 23 Dec 2020 16:11:44 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x12d.google.com with SMTP id 2so15298658ilg.9 for ; Wed, 23 Dec 2020 07:11:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KP8uAtRJLpKL975eiyAFcPW1oBORlFt2AnPM5ipsriE=; b=oSDhh4PysrRsnfC0MzqZ8y4/k54Tl5hpT6I4AqCtvciCfPOFLEgpq+9dBGu1lK0VIE lXxFQyhbKi63nM+8YdSk0vHWpRkfS129iqjJn+Y7qpru0lM6IagzZU2XYub0CNSDU67z LHH4x++MECV9rjbW1v60f6GdZQfMSPKBrqAEU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KP8uAtRJLpKL975eiyAFcPW1oBORlFt2AnPM5ipsriE=; b=acjrxruxFUxAoklykwLypNU0XNLQPv3Rp2xzE9PC/G6qYt4ZNyOUGnO8BOyrsCSdBm QqD4U4WABXvydo2hiwFx06yxQ20Yv56ZKor9fsXpJXPg2KjCXPFhYpzDTPN1QT2sB2xQ zUZ+JzxZEa86VHw+w7vCoeisRfVXc6njqU1aWEI1nrQXuRHX9asa/D53WjtlH6pc57OK xqQQ3jkWdrR3p5ewe21EhIYhgFkOlCU/5Cc3l6VPtbj4fEth1b5NAlSrOBCUy8MHwP/M rE7rYHcNMTta1SMqMOoel8dltnNVuxpszcNZxas9w2uawXqF5yEP4PfOLNZ1gM6uWOPT kFig== X-Gm-Message-State: AOAM5323zEJbS8RLkwP9EPWsOLKjWTkXHZBkYgzKTU5FL1vdw1rfbDDp w2f7qNKS1+Auqy7Dcmw6DyNUuxjZ2+wypZIJ X-Google-Smtp-Source: ABdhPJzb3JiQPfpbMhSKoWRTCcZvT5ohPaNeZ5bYseyZcTpzyNrHj8SSSudQ6h6jroJqzSltk7dsCw== X-Received: by 2002:a92:cd8c:: with SMTP id r12mr25448727ilb.221.1608736302934; Wed, 23 Dec 2020 07:11:42 -0800 (PST) Received: from localhost.localdomain (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id c15sm16935667ils.87.2020.12.23.07.11.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Dec 2020 07:11:42 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass Subject: [PATCH v2 02/21] sysreset: Use a shorter error with SPL Date: Wed, 23 Dec 2020 08:11:14 -0700 Message-Id: <20201223151133.2205985-3-sjg@chromium.org> X-Mailer: git-send-email 2.29.2.729.g45daf8777d-goog In-Reply-To: <20201223151133.2205985-1-sjg@chromium.org> References: <20201223151133.2205985-1-sjg@chromium.org> MIME-Version: 1.0 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.102.3 at phobos.denx.de X-Virus-Status: Clean Use a minimal error message to save space. Sort the header files while we are here. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- (no changes since v1) drivers/sysreset/sysreset-uclass.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/sysreset/sysreset-uclass.c b/drivers/sysreset/sysreset-uclass.c index 3f5414ed1f8..e69fb2255b6 100644 --- a/drivers/sysreset/sysreset-uclass.c +++ b/drivers/sysreset/sysreset-uclass.c @@ -9,12 +9,13 @@ #include #include #include -#include -#include -#include #include #include +#include +#include #include +#include +#include #include #include #include @@ -101,7 +102,10 @@ void sysreset_walk_halt(enum sysreset_t type) mdelay(100); /* Still no reset? Give up */ - log_err("System reset not supported on this platform\n"); + if (spl_phase() <= PHASE_SPL) + log_err("no sysreset\n"); + else + log_err("System reset not supported on this platform\n"); hang(); } From patchwork Wed Dec 23 15:11:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1420179 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=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=bC3+3Jal; dkim-atps=neutral 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 4D1GsP3G7Sz9sTX for ; Thu, 24 Dec 2020 02:12:25 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id CB85982B1B; Wed, 23 Dec 2020 16:11:58 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="bC3+3Jal"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DB2A18273C; Wed, 23 Dec 2020 16:11:48 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x12e.google.com (mail-il1-x12e.google.com [IPv6:2607:f8b0:4864:20::12e]) (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 6BFCE8273C for ; Wed, 23 Dec 2020 16:11:45 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x12e.google.com with SMTP id q5so15282972ilc.10 for ; Wed, 23 Dec 2020 07:11:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=B6wPcZjn8eeJv5f+u0/Iu6ua/gnz8bclbobtRG4jAnQ=; b=bC3+3JaliuGzVNxGEYKtphj9CHfB+hmjwFosbNMcPeK6NaTYpwgfpI3C/OXOkV/B4p gsbQJDxOkoqHGNZAJVS+nXDvuNpbull4f/jhoGGKJj1qxP0B82u1igUh+Qc2KkaPW2O0 UssLzoIKxK4giG14oqL+OMNM+qIM/KdO5U6Gw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=B6wPcZjn8eeJv5f+u0/Iu6ua/gnz8bclbobtRG4jAnQ=; b=Okjbbd7uwbD3vhfsWY+H7QnbfWhuda0GZPscBnPqH5yT4M0egR9lNDrdjIhOtBCBQi O37p2T9tndfICHrFlNyqRdUUZv6YKHiPX9hAaA3KWW0FRDWzT4KnwY955LHpS3L7M+BA 4Ac4oA/KLWOmkXu0BJD3fDfkIzFmxlkrmvwk+MHrHH3Lgb+j/ONWUS+gOFeH+pOf5pvu mVSniPmCdwzT089yTxJ8b8gxaEEhhvQMzEwwB7iaDktFojXul/AGbcGC/uqzlRmhJHvo LRC4+M4+OXE9W1Z0lR3xX630EcKz7jnyhVMaZ1GINWVFGCkEXHAmhpKCOe+BMGdpsRT+ k+ug== X-Gm-Message-State: AOAM531JHRt4hj4fkX3tRSg2KqZwwOR8DP52EPyZIhS/PgnoprW4f2zC 5yuPJtH+zIPutrztCE0SNsW8ZQGywBwCPGQw X-Google-Smtp-Source: ABdhPJwd2vcY1qU5zfTNDNnwKpanzmQbMWaEjowCymNwvDUZKS4bejTOEUGr2xbCa6E9lv8I6X5q0g== X-Received: by 2002:a05:6e02:8aa:: with SMTP id a10mr13999515ilt.157.1608736303955; Wed, 23 Dec 2020 07:11:43 -0800 (PST) Received: from localhost.localdomain (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id c15sm16935667ils.87.2020.12.23.07.11.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Dec 2020 07:11:43 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Alexey Brodkin , Alison Wang , Angelo Dureghello , Macpaul Lin , Marek Vasut , Nobuhiro Iwamatsu , Scott McNutt , Thomas Chou Subject: [PATCH v2 03/21] arc: m68k: nds32: nios2: sh: xtensa: Add empty spl.h header Date: Wed, 23 Dec 2020 08:11:15 -0700 Message-Id: <20201223081127.v2.3.I1f8b524b5dd4e31c9b1a05424a24894ce9bdcd8c@changeid> X-Mailer: git-send-email 2.29.2.729.g45daf8777d-goog In-Reply-To: <20201223151133.2205985-1-sjg@chromium.org> References: <20201223151133.2205985-1-sjg@chromium.org> MIME-Version: 1.0 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.102.3 at phobos.denx.de X-Virus-Status: Clean At present it is not possible to include spl.h in on these architectures since the asm/spl.h file is not present. We want to be able to use the spl_phase() function, so add empty headers to make things build. Signed-off-by: Simon Glass --- (no changes since v1) arch/arc/include/asm/spl.h | 0 arch/m68k/include/asm/spl.h | 0 arch/nds32/include/asm/spl.h | 0 arch/nios2/include/asm/spl.h | 0 arch/sh/include/asm/spl.h | 0 arch/xtensa/include/asm/spl.h | 0 6 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 arch/arc/include/asm/spl.h create mode 100644 arch/m68k/include/asm/spl.h create mode 100644 arch/nds32/include/asm/spl.h create mode 100644 arch/nios2/include/asm/spl.h create mode 100644 arch/sh/include/asm/spl.h create mode 100644 arch/xtensa/include/asm/spl.h diff --git a/arch/arc/include/asm/spl.h b/arch/arc/include/asm/spl.h new file mode 100644 index 00000000000..e69de29bb2d diff --git a/arch/m68k/include/asm/spl.h b/arch/m68k/include/asm/spl.h new file mode 100644 index 00000000000..e69de29bb2d diff --git a/arch/nds32/include/asm/spl.h b/arch/nds32/include/asm/spl.h new file mode 100644 index 00000000000..e69de29bb2d diff --git a/arch/nios2/include/asm/spl.h b/arch/nios2/include/asm/spl.h new file mode 100644 index 00000000000..e69de29bb2d diff --git a/arch/sh/include/asm/spl.h b/arch/sh/include/asm/spl.h new file mode 100644 index 00000000000..e69de29bb2d diff --git a/arch/xtensa/include/asm/spl.h b/arch/xtensa/include/asm/spl.h new file mode 100644 index 00000000000..e69de29bb2d From patchwork Wed Dec 23 15:11:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1420180 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=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=gJO70B60; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (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 4D1Gsc1Bm4z9sVt for ; Thu, 24 Dec 2020 02:12:36 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id BF1A882A64; Wed, 23 Dec 2020 16:12:07 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="gJO70B60"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8BEAF827EA; Wed, 23 Dec 2020 16:11:49 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd2f.google.com (mail-io1-xd2f.google.com [IPv6:2607:f8b0:4864:20::d2f]) (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 556828276B for ; Wed, 23 Dec 2020 16:11:46 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd2f.google.com with SMTP id 81so15317377ioc.13 for ; Wed, 23 Dec 2020 07:11:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hI0yG9YWhG1TdHaXZdWb9qb3xvz44h1vhYOVI8EyINY=; b=gJO70B60uXCIpMgNmgixcQbYLJIUMwMpZkPhCpsX/tS+tmIdfb1soN6B1W8Chf+mwI FPizRGK3BbDcxvFoXH7KqmR6j06ZIHl7YbMLxD+OMG4e4Eft6Ep0jGquu7tGRkFVa+F4 xuUY5sfblGZYn1qdeVRvkCOhRUyh3S6G6ZoSM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hI0yG9YWhG1TdHaXZdWb9qb3xvz44h1vhYOVI8EyINY=; b=gzVlMNZBI061+lYENxIXYGKqU26pKCqn6tdHLFwdHDg9IDv0qsA9bTDnxso0cGDyAR YRDfrv838VJnWBJNYraRzU8fvdoH7vs4VVqnL71dzp3oodJ9tck6Po8kfoqmn7lC2vz0 pcX1DZRxVmRd+TQtvqknzxhWTTR5R/1XWv43XoDuNsfXncc10YEqrYBKiRCvmbLY7bqi hWccC0gu7wKaWdkppYfh0lBOPR1z5h6twnne153P3KPvXrndm/E+J89/XLz0eM9ZSXyV iOzCQ4wDzmQkSs7jc1+zba9aAY3cZX0lQuxslTKrBDMcCFYp9CnKOWTsVYRMguIS1TSw zcLw== X-Gm-Message-State: AOAM530tXSxv0GGUCCOd9bBXMtTsaIUidUzxEbjhWC2ZvOr5S5Uv0EQa ofrTvwiU7sLVgCtGt4INBo4Yg2Dv+6dSckiQ X-Google-Smtp-Source: ABdhPJzvVT3LSO1tqRKxmD5n++G6iCC3XQ2+1br6HrWZWYQ6QVCSUWa4RY3+z9hHXPHVKObR+zHFhw== X-Received: by 2002:a5e:8e41:: with SMTP id r1mr22162765ioo.173.1608736304960; Wed, 23 Dec 2020 07:11:44 -0800 (PST) Received: from localhost.localdomain (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id c15sm16935667ils.87.2020.12.23.07.11.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Dec 2020 07:11:44 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass Subject: [PATCH v2 04/21] timer: Use a shorter error in TPL Date: Wed, 23 Dec 2020 08:11:16 -0700 Message-Id: <20201223151133.2205985-4-sjg@chromium.org> X-Mailer: git-send-email 2.29.2.729.g45daf8777d-goog In-Reply-To: <20201223151133.2205985-1-sjg@chromium.org> References: <20201223151133.2205985-1-sjg@chromium.org> MIME-Version: 1.0 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.102.3 at phobos.denx.de X-Virus-Status: Clean This error should not happen in normal use. Reduce the length of it to save space in the image. Add an empty spl.h file to sh since it appears to lack this. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- (no changes since v1) lib/time.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/time.c b/lib/time.c index 88bc50405ff..cc6944ec345 100644 --- a/lib/time.c +++ b/lib/time.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -96,8 +97,13 @@ uint64_t notrace get_ticks(void) } ret = timer_get_count(gd->timer, &count); - if (ret) - panic("Could not read count from timer (err %d)\n", ret); + if (ret) { + if (spl_phase() > PHASE_TPL) + panic("Could not read count from timer (err %d)\n", + ret); + else + panic("no timer (err %d)\n", ret); + } return count; } From patchwork Wed Dec 23 15:11:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1420181 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=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=KkW4hwI3; dkim-atps=neutral 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 4D1Gss3sBfz9sTX for ; Thu, 24 Dec 2020 02:12:49 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A758182B29; Wed, 23 Dec 2020 16:12:09 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="KkW4hwI3"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4A561827D6; Wed, 23 Dec 2020 16:11:51 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd32.google.com (mail-io1-xd32.google.com [IPv6:2607:f8b0:4864:20::d32]) (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 43E77827CB for ; Wed, 23 Dec 2020 16:11:47 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd32.google.com with SMTP id p187so15375777iod.4 for ; Wed, 23 Dec 2020 07:11:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ygZOQPyukUSY8tDPCD5Dw24Nf0pvlJhvtv2UcWunAXI=; b=KkW4hwI3Q/Bl4bafS+YbPWTeTT9VkiUvcX1mTyCYnwP5hDsOXYfFdikEIc1UzunCyF q9G290fp6+W+HVJ8a8ZYXTddo5A7heXr1KX1rHTJtgR+ggFTzd2waHQr8DDaPx3ofQuc cLlva2ilMx4gaoyAVrkaAeVwbeLtZeRWflHWc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ygZOQPyukUSY8tDPCD5Dw24Nf0pvlJhvtv2UcWunAXI=; b=QZ9h0T7cWdR+IyRtn7HAHxLVUVi7p3+Hr2rYypSsAk3/WNliZ7637r7yZUfaPi+KRQ YhGM9CTZav4q41ZLvayjZBjCRImb4dkxcwQwsD/m8ks+WQ+78/ZN98QVmuGLIoWdhrPQ R7iJfcn2mH+zqFc3dT7Nn/sSBaWli6Md9eJGaKQX0AMH9Xqp7Qj8jBx+7ePW7bIwYITa G6E81AOWOHG7qLvPk9HhW6bbVLaLNo1hoFCy9Fj7cyM/5tGh4pLEwOGhDEYJcPeLXwQx aDTXpQy7XN7Hjdwep00CuZzhbzdEDRcPTMfL4b5RiM+Q8VkBmpSWcIVmKXbapbqElYp/ QExw== X-Gm-Message-State: AOAM532Dg3YvMs0eb7xlZeX/eYoEP/U0Uj9Ih7+0fLz6XGTCsxZYh5ho dMg3dDtLFJg4CfEJgN24IGyTjnPVQDhczEjv X-Google-Smtp-Source: ABdhPJzBtBhddQBK/1uNyYpyLDo5FEIX3GTpeoc5FBytLpoHL8PjptKLiLMSUuHT8EWlvHKAZBmsRA== X-Received: by 2002:a6b:dc0f:: with SMTP id s15mr22058946ioc.180.1608736305859; Wed, 23 Dec 2020 07:11:45 -0800 (PST) Received: from localhost.localdomain (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id c15sm16935667ils.87.2020.12.23.07.11.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Dec 2020 07:11:45 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass Subject: [PATCH v2 05/21] test: Use a simple variable to record removed device Date: Wed, 23 Dec 2020 08:11:17 -0700 Message-Id: <20201223081127.v2.5.Ie77678001e31237a1631268cf4af5f132d383e04@changeid> X-Mailer: git-send-email 2.29.2.729.g45daf8777d-goog In-Reply-To: <20201223151133.2205985-1-sjg@chromium.org> References: <20201223151133.2205985-1-sjg@chromium.org> MIME-Version: 1.0 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.102.3 at phobos.denx.de X-Virus-Status: Clean At present the entire test state is effective passed into a test driver just to record which device was removed. This is unnecessary and makes it harder to track what is going on. Use a simple boolean instead. Also drop the unused 'removed' member while we are here. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- (no changes since v1) include/dm/test.h | 2 -- test/dm/bus.c | 14 ++++++-------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/include/dm/test.h b/include/dm/test.h index b2adce730ad..cbe1b57d95f 100644 --- a/include/dm/test.h +++ b/include/dm/test.h @@ -134,14 +134,12 @@ extern struct unit_test_state global_dm_test_state; * @testdev: Test device * @force_fail_alloc: Force all memory allocs to fail * @skip_post_probe: Skip uclass post-probe processing - * @removed: Used to keep track of a device that was removed */ struct dm_test_state { struct udevice *root; struct udevice *testdev; int force_fail_alloc; int skip_post_probe; - struct udevice *removed; }; /* Declare a new driver model test */ diff --git a/test/dm/bus.c b/test/dm/bus.c index 60ddb1d6b14..b95c106f5f0 100644 --- a/test/dm/bus.c +++ b/test/dm/bus.c @@ -30,7 +30,8 @@ enum { FLAG_CHILD_REMOVED = -7, }; -static struct dm_test_state *test_state; +/* Records the last testbus device that was removed */ +static struct udevice *testbus_removed; static int testbus_drv_probe(struct udevice *dev) { @@ -78,11 +79,9 @@ static int testbus_child_post_probe_uclass(struct udevice *dev) static int testbus_child_post_remove(struct udevice *dev) { struct dm_test_parent_data *parent_data = dev_get_parent_priv(dev); - struct dm_test_state *dms = test_state; parent_data->flag += FLAG_CHILD_REMOVED; - if (dms) - dms->removed = dev; + testbus_removed = dev; return 0; } @@ -335,11 +334,10 @@ DM_TEST(dm_test_bus_parent_data_uclass, static int dm_test_bus_parent_ops(struct unit_test_state *uts) { struct dm_test_parent_data *parent_data; - struct dm_test_state *dms = uts->priv; struct udevice *bus, *dev; struct uclass *uc; - test_state = dms; + testbus_removed = NULL; ut_assertok(uclass_get_device(UCLASS_TEST_BUS, 0, &bus)); ut_assertok(uclass_get(UCLASS_TEST_FDT, &uc)); @@ -362,9 +360,9 @@ static int dm_test_bus_parent_ops(struct unit_test_state *uts) ut_asserteq(FLAG_CHILD_PROBED, parent_data->flag); ut_assertok(device_remove(dev, DM_REMOVE_NORMAL)); ut_asserteq_ptr(NULL, dev_get_parent_priv(dev)); - ut_asserteq_ptr(dms->removed, dev); + ut_asserteq_ptr(testbus_removed, dev); } - test_state = NULL; + testbus_removed = NULL; return 0; } From patchwork Wed Dec 23 15:11:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1420195 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=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=VK7xm3JO; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (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 4D1Gx31ZtWz9sTX for ; Thu, 24 Dec 2020 02:15:35 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5A1C482B5F; Wed, 23 Dec 2020 16:12:59 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="VK7xm3JO"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0AC3382A38; Wed, 23 Dec 2020 16:11:54 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x12b.google.com (mail-il1-x12b.google.com [IPv6:2607:f8b0:4864:20::12b]) (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 78B76827B3 for ; Wed, 23 Dec 2020 16:11:48 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x12b.google.com with SMTP id v3so15330946ilo.5 for ; Wed, 23 Dec 2020 07:11:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XsET537SbHvY47BAiP8HCLLgmbfAT+F/niuGQ2PtDS4=; b=VK7xm3JOgbe4xArQTdr6rtSvU/RCuPGL8fajvlPNj/5VIu3BOpDgviRIBDiQSZLXEw aStjE4l9Y040kF7mOE8k0mei3BEiDp2c57cQNV1wCzgAV5tYx+dxr4zlmxQHVBqFPoEL 5hfcDDjIYKtU0zyAukkMK7/S8n1DewARWwJzc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XsET537SbHvY47BAiP8HCLLgmbfAT+F/niuGQ2PtDS4=; b=NC1ZR3Vi8YnjIoUr0NjisSV61LkHYEWa0SLajDfbzG4PMfarEItvu52QHq7N9tC0EY +vJQq9Bs4a5wqjfTblPz/MWnDrhQXqy3Csq38kzKm3VSNByrz3L+SeLz4ec3vYIwmUeg IWo5/rjf7SnZjKYleJhRWqmQdHOLiD90vPoIjwv5fYAeyWR5xU3ioq79XqIPXOz3CTq+ 3ZMlxdV06HvUuHlyyn33mBNN/SCqfmyAyIdyM5xwSRlevJJH+M7e+bstyV4CeByJSP8P HZrV5MTAisASovIfDl+pg3h1+5tP7PNdjr5HvE+O/MBaBwvUQDATQeKsmUgiuXF9rtMc T4Gg== X-Gm-Message-State: AOAM532sbhrC+N06g/8QpNUPYfhIFzNUqdNK9AabLORMBO2vceS4PBeG zq8qUddLDkiuNw+nwGEBybNJgQQBr4Hu90ck X-Google-Smtp-Source: ABdhPJxebhtfGMVB1cYMvTGzFhlN4P1fP93mYTshGc8OIQpmzdXB0kk47lEMW2OL+POGcPCrxbYbNw== X-Received: by 2002:a05:6e02:10c8:: with SMTP id s8mr1144879ilj.13.1608736306758; Wed, 23 Dec 2020 07:11:46 -0800 (PST) Received: from localhost.localdomain (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id c15sm16935667ils.87.2020.12.23.07.11.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Dec 2020 07:11:46 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass Subject: [PATCH v2 06/21] test: Move some test drivers into their own file Date: Wed, 23 Dec 2020 08:11:18 -0700 Message-Id: <20201223081127.v2.6.I95538b3d1db1d579dd1b0f0b16de1ac934ef7a68@changeid> X-Mailer: git-send-email 2.29.2.729.g45daf8777d-goog In-Reply-To: <20201223151133.2205985-1-sjg@chromium.org> References: <20201223151133.2205985-1-sjg@chromium.org> MIME-Version: 1.0 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.102.3 at phobos.denx.de X-Virus-Status: Clean At present several test drivers are part of the test file itself. Some of these are useful for of-platdata tests. Separate them out so we can use them for other things also. A few adjustments are needed so this driver can build for sandbox_spl as well. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- (no changes since v1) drivers/misc/Kconfig | 9 ++ drivers/misc/Makefile | 1 + drivers/misc/test_drv.c | 230 ++++++++++++++++++++++++++++++++++++++++ include/dm/test.h | 18 ++++ include/test/test.h | 9 ++ test/dm/bus.c | 105 +----------------- test/dm/test-fdt.c | 120 --------------------- 7 files changed, 271 insertions(+), 221 deletions(-) create mode 100644 drivers/misc/test_drv.c diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index 29432ae7eb4..7d2a2997797 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig @@ -343,6 +343,15 @@ config TEGRA186_BPMP can make requests to the BPMP. This driver is similar to an MFD driver in the Linux kernel. +config TEST_DRV + bool "Enable support for test drivers" + default y if SANDBOX + help + This enables drivers and uclasses that provides a way of testing the + operations of memory allocation and driver/uclass methods in driver + model. This should only be enabled for testing as it is not useful for + anything else. + config TWL4030_LED bool "Enable TWL4030 LED controller" help diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile index 947bd3a647f..d7372037045 100644 --- a/drivers/misc/Makefile +++ b/drivers/misc/Makefile @@ -67,6 +67,7 @@ obj-$(CONFIG_STM32_RCC) += stm32_rcc.o obj-$(CONFIG_SYS_DPAA_QBMAN) += fsl_portals.o obj-$(CONFIG_TEGRA186_BPMP) += tegra186_bpmp.o obj-$(CONFIG_TEGRA_CAR) += tegra_car.o +obj-$(CONFIG_TEST_DRV) += test_drv.o obj-$(CONFIG_TWL4030_LED) += twl4030_led.o obj-$(CONFIG_VEXPRESS_CONFIG) += vexpress_config.o obj-$(CONFIG_WINBOND_W83627) += winbond_w83627.o diff --git a/drivers/misc/test_drv.c b/drivers/misc/test_drv.c new file mode 100644 index 00000000000..a163312b108 --- /dev/null +++ b/drivers/misc/test_drv.c @@ -0,0 +1,230 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (c) 2014 Google, Inc + */ + +#include +#include +#include + +/* Records the last testbus device that was removed */ +static struct udevice *testbus_removed; + +struct udevice *testbus_get_clear_removed(void) +{ + struct udevice *removed = testbus_removed; + + testbus_removed = NULL; + + return removed; +} + +static int testbus_drv_probe(struct udevice *dev) +{ + if (!CONFIG_IS_ENABLED(OF_PLATDATA)) { + int ret; + + ret = dm_scan_fdt_dev(dev); + if (ret) + return ret; + } + + return 0; +} + +static int testbus_child_post_bind(struct udevice *dev) +{ + struct dm_test_parent_plat *plat; + + plat = dev_get_parent_plat(dev); + plat->bind_flag = 1; + plat->uclass_bind_flag = 2; + + return 0; +} + +static int testbus_child_pre_probe(struct udevice *dev) +{ + struct dm_test_parent_data *parent_data = dev_get_parent_priv(dev); + + parent_data->flag += TEST_FLAG_CHILD_PROBED; + + return 0; +} + +static int testbus_child_pre_probe_uclass(struct udevice *dev) +{ + struct dm_test_priv *priv = dev_get_priv(dev); + + priv->uclass_flag++; + + return 0; +} + +static int testbus_child_post_probe_uclass(struct udevice *dev) +{ + struct dm_test_priv *priv = dev_get_priv(dev); + + priv->uclass_postp++; + + return 0; +} + +static int testbus_child_post_remove(struct udevice *dev) +{ + struct dm_test_parent_data *parent_data = dev_get_parent_priv(dev); + + parent_data->flag += TEST_FLAG_CHILD_REMOVED; + testbus_removed = dev; + + return 0; +} + +static const struct udevice_id testbus_ids[] = { + { + .compatible = "denx,u-boot-test-bus", + .data = DM_TEST_TYPE_FIRST }, + { } +}; + +U_BOOT_DRIVER(testbus_drv) = { + .name = "testbus_drv", + .of_match = testbus_ids, + .id = UCLASS_TEST_BUS, + .probe = testbus_drv_probe, + .child_post_bind = testbus_child_post_bind, + .priv_auto = sizeof(struct dm_test_priv), + .plat_auto = sizeof(struct dm_test_pdata), + .per_child_auto = sizeof(struct dm_test_parent_data), + .per_child_plat_auto = sizeof(struct dm_test_parent_plat), + .child_pre_probe = testbus_child_pre_probe, + .child_post_remove = testbus_child_post_remove, +}; + +UCLASS_DRIVER(testbus) = { + .name = "testbus", + .id = UCLASS_TEST_BUS, + .flags = DM_UC_FLAG_SEQ_ALIAS, + .child_pre_probe = testbus_child_pre_probe_uclass, + .child_post_probe = testbus_child_post_probe_uclass, +}; + +static int testfdt_drv_ping(struct udevice *dev, int pingval, int *pingret) +{ + const struct dm_test_pdata *pdata = dev_get_plat(dev); + struct dm_test_priv *priv = dev_get_priv(dev); + + *pingret = pingval + pdata->ping_add; + priv->ping_total += *pingret; + + return 0; +} + +static const struct test_ops test_ops = { + .ping = testfdt_drv_ping, +}; + +static int testfdt_of_to_plat(struct udevice *dev) +{ + struct dm_test_pdata *pdata = dev_get_plat(dev); + + pdata->ping_add = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev), + "ping-add", -1); + pdata->base = fdtdec_get_addr(gd->fdt_blob, dev_of_offset(dev), + "ping-expect"); + + return 0; +} + +static int testfdt_drv_probe(struct udevice *dev) +{ + struct dm_test_priv *priv = dev_get_priv(dev); + + priv->ping_total += DM_TEST_START_TOTAL; + + /* + * If this device is on a bus, the uclass_flag will be set before + * calling this function. In the meantime the uclass_postp is + * initlized to a value -1. These are used respectively by + * dm_test_bus_child_pre_probe_uclass() and + * dm_test_bus_child_post_probe_uclass(). + */ + priv->uclass_total += priv->uclass_flag; + priv->uclass_postp = -1; + + return 0; +} + +static const struct udevice_id testfdt_ids[] = { + { + .compatible = "denx,u-boot-fdt-test", + .data = DM_TEST_TYPE_FIRST }, + { + .compatible = "google,another-fdt-test", + .data = DM_TEST_TYPE_SECOND }, + { } +}; + +U_BOOT_DRIVER(testfdt_drv) = { + .name = "testfdt_drv", + .of_match = testfdt_ids, + .id = UCLASS_TEST_FDT, + .of_to_plat = testfdt_of_to_plat, + .probe = testfdt_drv_probe, + .ops = &test_ops, + .priv_auto = sizeof(struct dm_test_priv), + .plat_auto = sizeof(struct dm_test_pdata), +}; + +static const struct udevice_id testfdt1_ids[] = { + { + .compatible = "denx,u-boot-fdt-test1", + .data = DM_TEST_TYPE_FIRST }, + { } +}; + +U_BOOT_DRIVER(testfdt1_drv) = { + .name = "testfdt1_drv", + .of_match = testfdt1_ids, + .id = UCLASS_TEST_FDT, + .of_to_plat = testfdt_of_to_plat, + .probe = testfdt_drv_probe, + .ops = &test_ops, + .priv_auto = sizeof(struct dm_test_priv), + .plat_auto = sizeof(struct dm_test_pdata), + .flags = DM_FLAG_PRE_RELOC, +}; + +/* From here is the testfdt uclass code */ +int testfdt_ping(struct udevice *dev, int pingval, int *pingret) +{ + const struct test_ops *ops = device_get_ops(dev); + + if (!ops->ping) + return -ENOSYS; + + return ops->ping(dev, pingval, pingret); +} + +UCLASS_DRIVER(testfdt) = { + .name = "testfdt", + .id = UCLASS_TEST_FDT, + .flags = DM_UC_FLAG_SEQ_ALIAS, +}; + +static const struct udevice_id testfdtm_ids[] = { + { .compatible = "denx,u-boot-fdtm-test" }, + { } +}; + +U_BOOT_DRIVER(testfdtm_drv) = { + .name = "testfdtm_drv", + .of_match = testfdtm_ids, + .id = UCLASS_TEST_FDT_MANUAL, +}; + +UCLASS_DRIVER(testfdtm) = { + .name = "testfdtm", + .id = UCLASS_TEST_FDT_MANUAL, + .flags = DM_UC_FLAG_SEQ_ALIAS | DM_UC_FLAG_NO_AUTO_SEQ, +}; diff --git a/include/dm/test.h b/include/dm/test.h index cbe1b57d95f..6ac6672cd6f 100644 --- a/include/dm/test.h +++ b/include/dm/test.h @@ -167,6 +167,24 @@ struct sandbox_sdl_plat { int font_size; }; +/** + * struct dm_test_parent_plat - Used to track state in bus tests + * + * @count: + * @bind_flag: Indicates that the child post-bind method was called + * @uclass_bind_flag: Also indicates that the child post-bind method was called + */ +struct dm_test_parent_plat { + int count; + int bind_flag; + int uclass_bind_flag; +}; + +enum { + TEST_FLAG_CHILD_PROBED = 10, + TEST_FLAG_CHILD_REMOVED = -7, +}; + /* Declare ping methods for the drivers */ int test_ping(struct udevice *dev, int pingval, int *pingret); int testfdt_ping(struct udevice *dev, int pingval, int *pingret); diff --git a/include/test/test.h b/include/test/test.h index 03e29290bf4..3fdaa2b5e51 100644 --- a/include/test/test.h +++ b/include/test/test.h @@ -94,6 +94,15 @@ enum { TEST_DEVRES_SIZE3 = 37, }; +/** + * testbus_get_clear_removed() - Test function to obtain removed device + * + * This is used in testbus to find out which device was removed. Calling this + * function returns a pointer to the device and then clears it back to NULL, so + * that a future test can check it. + */ +struct udevice *testbus_get_clear_removed(void); + /** * dm_test_main() - Run driver model tests * diff --git a/test/dm/bus.c b/test/dm/bus.c index b95c106f5f0..785ccfc25d1 100644 --- a/test/dm/bus.c +++ b/test/dm/bus.c @@ -19,102 +19,6 @@ DECLARE_GLOBAL_DATA_PTR; -struct dm_test_parent_plat { - int count; - int bind_flag; - int uclass_bind_flag; -}; - -enum { - FLAG_CHILD_PROBED = 10, - FLAG_CHILD_REMOVED = -7, -}; - -/* Records the last testbus device that was removed */ -static struct udevice *testbus_removed; - -static int testbus_drv_probe(struct udevice *dev) -{ - return dm_scan_fdt_dev(dev); -} - -static int testbus_child_post_bind(struct udevice *dev) -{ - struct dm_test_parent_plat *plat; - - plat = dev_get_parent_plat(dev); - plat->bind_flag = 1; - plat->uclass_bind_flag = 2; - - return 0; -} - -static int testbus_child_pre_probe(struct udevice *dev) -{ - struct dm_test_parent_data *parent_data = dev_get_parent_priv(dev); - - parent_data->flag += FLAG_CHILD_PROBED; - - return 0; -} - -static int testbus_child_pre_probe_uclass(struct udevice *dev) -{ - struct dm_test_priv *priv = dev_get_priv(dev); - - priv->uclass_flag++; - - return 0; -} - -static int testbus_child_post_probe_uclass(struct udevice *dev) -{ - struct dm_test_priv *priv = dev_get_priv(dev); - - priv->uclass_postp++; - - return 0; -} - -static int testbus_child_post_remove(struct udevice *dev) -{ - struct dm_test_parent_data *parent_data = dev_get_parent_priv(dev); - - parent_data->flag += FLAG_CHILD_REMOVED; - testbus_removed = dev; - - return 0; -} - -static const struct udevice_id testbus_ids[] = { - { - .compatible = "denx,u-boot-test-bus", - .data = DM_TEST_TYPE_FIRST }, - { } -}; - -U_BOOT_DRIVER(testbus_drv) = { - .name = "testbus_drv", - .of_match = testbus_ids, - .id = UCLASS_TEST_BUS, - .probe = testbus_drv_probe, - .child_post_bind = testbus_child_post_bind, - .priv_auto = sizeof(struct dm_test_priv), - .plat_auto = sizeof(struct dm_test_pdata), - .per_child_auto = sizeof(struct dm_test_parent_data), - .per_child_plat_auto = sizeof(struct dm_test_parent_plat), - .child_pre_probe = testbus_child_pre_probe, - .child_post_remove = testbus_child_post_remove, -}; - -UCLASS_DRIVER(testbus) = { - .name = "testbus", - .id = UCLASS_TEST_BUS, - .flags = DM_UC_FLAG_SEQ_ALIAS, - .child_pre_probe = testbus_child_pre_probe_uclass, - .child_post_probe = testbus_child_post_probe_uclass, -}; - /* Test that we can probe for children */ static int dm_test_bus_children(struct unit_test_state *uts) { @@ -337,7 +241,7 @@ static int dm_test_bus_parent_ops(struct unit_test_state *uts) struct udevice *bus, *dev; struct uclass *uc; - testbus_removed = NULL; + testbus_get_clear_removed(); ut_assertok(uclass_get_device(UCLASS_TEST_BUS, 0, &bus)); ut_assertok(uclass_get(UCLASS_TEST_FDT, &uc)); @@ -349,7 +253,7 @@ static int dm_test_bus_parent_ops(struct unit_test_state *uts) ut_assertok(device_probe(dev)); parent_data = dev_get_parent_priv(dev); - ut_asserteq(FLAG_CHILD_PROBED, parent_data->flag); + ut_asserteq(TEST_FLAG_CHILD_PROBED, parent_data->flag); } uclass_foreach_dev(dev, uc) { @@ -357,12 +261,11 @@ static int dm_test_bus_parent_ops(struct unit_test_state *uts) if (dev->parent != bus) continue; parent_data = dev_get_parent_priv(dev); - ut_asserteq(FLAG_CHILD_PROBED, parent_data->flag); + ut_asserteq(TEST_FLAG_CHILD_PROBED, parent_data->flag); ut_assertok(device_remove(dev, DM_REMOVE_NORMAL)); ut_asserteq_ptr(NULL, dev_get_parent_priv(dev)); - ut_asserteq_ptr(testbus_removed, dev); + ut_asserteq_ptr(testbus_get_clear_removed(), dev); } - testbus_removed = NULL; return 0; } diff --git a/test/dm/test-fdt.c b/test/dm/test-fdt.c index 9e8c2906e84..633256821c2 100644 --- a/test/dm/test-fdt.c +++ b/test/dm/test-fdt.c @@ -23,126 +23,6 @@ DECLARE_GLOBAL_DATA_PTR; -static int testfdt_drv_ping(struct udevice *dev, int pingval, int *pingret) -{ - const struct dm_test_pdata *pdata = dev_get_plat(dev); - struct dm_test_priv *priv = dev_get_priv(dev); - - *pingret = pingval + pdata->ping_add; - priv->ping_total += *pingret; - - return 0; -} - -static const struct test_ops test_ops = { - .ping = testfdt_drv_ping, -}; - -static int testfdt_of_to_plat(struct udevice *dev) -{ - struct dm_test_pdata *pdata = dev_get_plat(dev); - - pdata->ping_add = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev), - "ping-add", -1); - pdata->base = fdtdec_get_addr(gd->fdt_blob, dev_of_offset(dev), - "ping-expect"); - - return 0; -} - -static int testfdt_drv_probe(struct udevice *dev) -{ - struct dm_test_priv *priv = dev_get_priv(dev); - - priv->ping_total += DM_TEST_START_TOTAL; - - /* - * If this device is on a bus, the uclass_flag will be set before - * calling this function. In the meantime the uclass_postp is - * initlized to a value -1. These are used respectively by - * dm_test_bus_child_pre_probe_uclass() and - * dm_test_bus_child_post_probe_uclass(). - */ - priv->uclass_total += priv->uclass_flag; - priv->uclass_postp = -1; - - return 0; -} - -static const struct udevice_id testfdt_ids[] = { - { - .compatible = "denx,u-boot-fdt-test", - .data = DM_TEST_TYPE_FIRST }, - { - .compatible = "google,another-fdt-test", - .data = DM_TEST_TYPE_SECOND }, - { } -}; - -U_BOOT_DRIVER(testfdt_drv) = { - .name = "testfdt_drv", - .of_match = testfdt_ids, - .id = UCLASS_TEST_FDT, - .of_to_plat = testfdt_of_to_plat, - .probe = testfdt_drv_probe, - .ops = &test_ops, - .priv_auto = sizeof(struct dm_test_priv), - .plat_auto = sizeof(struct dm_test_pdata), -}; - -static const struct udevice_id testfdt1_ids[] = { - { - .compatible = "denx,u-boot-fdt-test1", - .data = DM_TEST_TYPE_FIRST }, - { } -}; - -U_BOOT_DRIVER(testfdt1_drv) = { - .name = "testfdt1_drv", - .of_match = testfdt1_ids, - .id = UCLASS_TEST_FDT, - .of_to_plat = testfdt_of_to_plat, - .probe = testfdt_drv_probe, - .ops = &test_ops, - .priv_auto = sizeof(struct dm_test_priv), - .plat_auto = sizeof(struct dm_test_pdata), - .flags = DM_FLAG_PRE_RELOC, -}; - -/* From here is the testfdt uclass code */ -int testfdt_ping(struct udevice *dev, int pingval, int *pingret) -{ - const struct test_ops *ops = device_get_ops(dev); - - if (!ops->ping) - return -ENOSYS; - - return ops->ping(dev, pingval, pingret); -} - -UCLASS_DRIVER(testfdt) = { - .name = "testfdt", - .id = UCLASS_TEST_FDT, - .flags = DM_UC_FLAG_SEQ_ALIAS, -}; - -static const struct udevice_id testfdtm_ids[] = { - { .compatible = "denx,u-boot-fdtm-test" }, - { } -}; - -U_BOOT_DRIVER(testfdtm_drv) = { - .name = "testfdtm_drv", - .of_match = testfdtm_ids, - .id = UCLASS_TEST_FDT_MANUAL, -}; - -UCLASS_DRIVER(testfdtm) = { - .name = "testfdtm", - .id = UCLASS_TEST_FDT_MANUAL, - .flags = DM_UC_FLAG_SEQ_ALIAS | DM_UC_FLAG_NO_AUTO_SEQ, -}; - struct dm_testprobe_pdata { int probe_err; }; From patchwork Wed Dec 23 15:11:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1420184 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=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=kXAWC//A; dkim-atps=neutral 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 4D1Gtf4CsJz9sVt for ; Thu, 24 Dec 2020 02:13:30 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E7B7082AD9; Wed, 23 Dec 2020 16:12:29 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="kXAWC//A"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6F95182B10; Wed, 23 Dec 2020 16:11:58 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd2a.google.com (mail-io1-xd2a.google.com [IPv6:2607:f8b0:4864:20::d2a]) (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 43FF1827D9 for ; Wed, 23 Dec 2020 16:11:49 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd2a.google.com with SMTP id m23so15411940ioy.2 for ; Wed, 23 Dec 2020 07:11:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=IwSYx4L7Hvi9MbRaMV1OpDEMDthfFdcCcUdlQWvklng=; b=kXAWC//Aaha5HQNyJc/nNxhstimffsAs4s93kN1fqJGUrdZ4oRB5fUepdxPWD45Tb7 T8xIbFhmsMbmGuDGVtwCAuIe64pqkD15m6s7zYnQioWUCxLLqos+ZG+21iHBuJ24gPzV IXfcF/jIracHyqgOchXkGlVssiJUN5RMEFz1c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=IwSYx4L7Hvi9MbRaMV1OpDEMDthfFdcCcUdlQWvklng=; b=kuBsOgRp0iCAN36aQ45O32oYgqaEJFqSuAplrTkXd5PLPvKVEfcbtJzSWc/12Vx84U 3UpKzfMo6vr0jhbwHZaPKwl9WsdOhhT0/h3ez4UtLOT4wAwPFx9Lfuj0UnZoNE2VwoqN SzlYCaSF4Nqcumbhq+4UMEGSjnzXYPREmMPBEovY3JTGY1HyLBj2Kf7ADVp2CYdP5nMO PJ7XXbkjlzJT89OxBOtx7BckF9A1TnAV3qnWyj80D+EV8pqfiU8SgxHa2zl0DsWBlfrL LbwvjELcY6xF1kc+xHekooMVIUNU7zt8SbkAno9imvBg8ZTxOs72XzQRXAvCERoOgI51 wrSA== X-Gm-Message-State: AOAM530MxyDydUKxOCWs/D5/YJfMFOxh1peOvBhZzf1iPRY0DQYGE5jx SkYPqPTacgYz17shhqQaOn+YZRn4SvMWdq28 X-Google-Smtp-Source: ABdhPJw3OONKyoTge5vGZMWOP8NTNWO3TQRqivprQt/lCXWCfuIiemmdvXgMsbnME/aoe0khD15CAg== X-Received: by 2002:a6b:f202:: with SMTP id q2mr21960984ioh.87.1608736307768; Wed, 23 Dec 2020 07:11:47 -0800 (PST) Received: from localhost.localdomain (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id c15sm16935667ils.87.2020.12.23.07.11.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Dec 2020 07:11:47 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass Subject: [PATCH v2 07/21] dtoc: Fix a few pylint warnings in dtb_platdata Date: Wed, 23 Dec 2020 08:11:19 -0700 Message-Id: <20201223151133.2205985-5-sjg@chromium.org> X-Mailer: git-send-email 2.29.2.729.g45daf8777d-goog In-Reply-To: <20201223151133.2205985-1-sjg@chromium.org> References: <20201223151133.2205985-1-sjg@chromium.org> MIME-Version: 1.0 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.102.3 at phobos.denx.de X-Virus-Status: Clean These have crept in again. Update the file to fix all but these ones: dtb_platdata.py:143:0: R0902: Too many instance attributes (10/7) (too-many-instance-attributes) dtb_platdata.py:713:0: R0913: Too many arguments (6/5) (too-many-arguments) Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- (no changes since v1) tools/dtoc/dtb_platdata.py | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/tools/dtoc/dtb_platdata.py b/tools/dtoc/dtb_platdata.py index 82671138a9a..cc3e58a1cd6 100644 --- a/tools/dtoc/dtb_platdata.py +++ b/tools/dtoc/dtb_platdata.py @@ -112,18 +112,19 @@ def get_value(ftype, value): str: String representation of the value """ if ftype == fdt.Type.INT: - return '%#x' % fdt_util.fdt32_to_cpu(value) + val = '%#x' % fdt_util.fdt32_to_cpu(value) elif ftype == fdt.Type.BYTE: char = value[0] - return '%#x' % (ord(char) if isinstance(char, str) else char) + val = '%#x' % (ord(char) if isinstance(char, str) else char) elif ftype == fdt.Type.STRING: # Handle evil ACPI backslashes by adding another backslash before them. # So "\\_SB.GPO0" in the device tree effectively stays like that in C - return '"%s"' % value.replace('\\', '\\\\') + val = '"%s"' % value.replace('\\', '\\\\') elif ftype == fdt.Type.BOOL: - return 'true' + val = 'true' else: # ftype == fdt.Type.INT64: - return '%#x' % value + val = '%#x' % value + return val def get_compat_name(node): """Get the node's list of compatible string as a C identifiers @@ -131,7 +132,7 @@ def get_compat_name(node): Args: node (fdt.Node): Node object to check Return: - List of C identifiers for all the compatible strings + list of str: List of C identifiers for all the compatible strings """ compat = node.props['compatible'].value if not isinstance(compat, list): @@ -139,7 +140,7 @@ def get_compat_name(node): return [conv_name_to_c(c) for c in compat] -class DtbPlatdata(object): +class DtbPlatdata(): """Provide a means to convert device tree binary data to platform data The output of this process is C structures which can be used in space- @@ -183,7 +184,7 @@ class DtbPlatdata(object): and a lookup in driver_aliases printing a warning in case of failure. Args: - node: Node object to check + node (Node): Node object to check Return: Tuple: Driver name associated with the first compatible string @@ -330,7 +331,7 @@ class DtbPlatdata(object): # The following re will search for driver names declared as # U_BOOT_DRIVER(driver_name) - drivers = re.findall('U_BOOT_DRIVER\((.*)\)', buff) + drivers = re.findall(r'U_BOOT_DRIVER\((.*)\)', buff) for driver in drivers: self._drivers.append(driver) @@ -338,7 +339,7 @@ class DtbPlatdata(object): # The following re will search for driver aliases declared as # U_BOOT_DRIVER_ALIAS(alias, driver_name) driver_aliases = re.findall( - 'U_BOOT_DRIVER_ALIAS\(\s*(\w+)\s*,\s*(\w+)\s*\)', + r'U_BOOT_DRIVER_ALIAS\(\s*(\w+)\s*,\s*(\w+)\s*\)', buff) for alias in driver_aliases: # pragma: no cover @@ -383,8 +384,8 @@ class DtbPlatdata(object): This adds each node to self._valid_nodes. Args: - root: Root node for scan - valid_nodes: List of Node objects to add to + root (Node): Root node for scan + valid_nodes (list of Node): List of Node objects to add to """ for node in root.subnodes: if 'compatible' in node.props: @@ -484,7 +485,7 @@ class DtbPlatdata(object): updated to match that width. Returns: - dict containing structures: + dict of dict: dict containing structures: key (str): Node name, as a C identifier value: dict containing structure fields: key (str): Field name @@ -559,7 +560,7 @@ class DtbPlatdata(object): doc/driver-model/of-plat.rst for more information. Args: - structs: dict containing structures: + structs (dict): dict containing structures: key (str): Node name, as a C identifier value: dict containing structure fields: key (str): Field name @@ -720,7 +721,7 @@ def run_steps(args, dtb_file, include_disabled, output, warning_disabled=False, output (str): Name of output file warning_disabled (bool): True to avoid showing warnings about missing drivers - _drivers_additional (list): List of additional drivers to use during + drivers_additional (list): List of additional drivers to use during scanning Raises: ValueError: if args has no command, or an unknown command From patchwork Wed Dec 23 15:11:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1420183 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=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=YcMve0lV; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (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 4D1GtN3JKYz9sTX for ; Thu, 24 Dec 2020 02:13:16 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 588CB82B19; Wed, 23 Dec 2020 16:12:27 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="YcMve0lV"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8FC8A82A38; Wed, 23 Dec 2020 16:11:56 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x12a.google.com (mail-il1-x12a.google.com [IPv6:2607:f8b0:4864:20::12a]) (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 62D828273C for ; Wed, 23 Dec 2020 16:11:50 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x12a.google.com with SMTP id u12so15327414ilv.3 for ; Wed, 23 Dec 2020 07:11:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=JZSlzpLjbgI9LDAZS32N6ZnZL2AcLq+B2tqN54Kdm8g=; b=YcMve0lVljSflP0tucH9l/jRmAbHsNNW5TJxlSFzKs8D2Uwh4Z8cPPZYYMAOi1Tkgv VHxuXUxs01XQsrBOYizztOAcl2sUuFmiB+R7JVpGuBXLDh8h9R9EKKu1L+uR3+an8Jd6 XVXhwu8ySh09Q+7jSC+iqsZeJZheFXQja9CgM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JZSlzpLjbgI9LDAZS32N6ZnZL2AcLq+B2tqN54Kdm8g=; b=oFdZKdeUTTjL+69X04WYmfdfW0ZA4TljL4079vC/yNDQPaLAv19Pm7F2PpLWz6N4qw BfTDNDd26jiZOaYJRtb6od3I6gynNIgMyL6XQkgWZUHJAAopunAKYzueiX85bCSY8sVw KcYPPn4PaWCzpnxR0X/fg03R3thL+oOaaXylSwN+NouNCL13L5YdTwJ+wgbpvazSfraa UOlACmvkrRFOgdyA0Bke1+bwutK5XVQftyFIq4LnVAVx7N0NF4jH0KBeirtYeE/OCecP xSb6Coxljr022hqHtQWycbs/VTjCPQES5qnzIshNJcEAqcT7KtPEzi1kuAsXhhig3GfY NQJA== X-Gm-Message-State: AOAM5328xPz0RAS9gFD3CqxgRIH4TVfUD0Nza1YhoHBy94omZ+wrRzKn tqpbR3Zrj4mua36q5JkNdVI0G3o2WDyQcDFo X-Google-Smtp-Source: ABdhPJwa1vBLfGf/3DBI8iTLA7ad8Jk9BXQCWrpsne7po32LxxQsNO9uRPEY0itJoD9Ais+4c0gZZg== X-Received: by 2002:a92:c991:: with SMTP id y17mr26266089iln.116.1608736308814; Wed, 23 Dec 2020 07:11:48 -0800 (PST) Received: from localhost.localdomain (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id c15sm16935667ils.87.2020.12.23.07.11.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Dec 2020 07:11:48 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass Subject: [PATCH v2 08/21] dtoc: Make _output_list a top-level function Date: Wed, 23 Dec 2020 08:11:20 -0700 Message-Id: <20201223081127.v2.8.I33b9d008c3fdcad6caeb18cad70810bf79a5c856@changeid> X-Mailer: git-send-email 2.29.2.729.g45daf8777d-goog In-Reply-To: <20201223151133.2205985-1-sjg@chromium.org> References: <20201223151133.2205985-1-sjg@chromium.org> MIME-Version: 1.0 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.102.3 at phobos.denx.de X-Virus-Status: Clean It is annoying to have this function inside its parent since it makes the parent longer and hard to read. Move it to the top level. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- (no changes since v1) tools/dtoc/dtb_platdata.py | 80 +++++++++++++++++++------------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/tools/dtoc/dtb_platdata.py b/tools/dtoc/dtb_platdata.py index cc3e58a1cd6..372f756037e 100644 --- a/tools/dtoc/dtb_platdata.py +++ b/tools/dtoc/dtb_platdata.py @@ -592,51 +592,51 @@ class DtbPlatdata(): self.out(';\n') self.out('};\n') + def _output_list(self, node, prop): + """Output the C code for a devicetree property that holds a list + + Args: + node (fdt.Node): Node to output + prop (fdt.Prop): Prop to output + """ + self.buf('{') + vals = [] + # For phandles, output a reference to the platform data + # of the target node. + info = self.get_phandle_argc(prop, node.name) + if info: + # Process the list as pairs of (phandle, id) + pos = 0 + for args in info.args: + phandle_cell = prop.value[pos] + phandle = fdt_util.fdt32_to_cpu(phandle_cell) + target_node = self._fdt.phandle_to_node[phandle] + arg_values = [] + for i in range(args): + arg_values.append( + str(fdt_util.fdt32_to_cpu(prop.value[pos + 1 + i]))) + pos += 1 + args + vals.append('\t{%d, {%s}}' % (target_node.idx, + ', '.join(arg_values))) + for val in vals: + self.buf('\n\t\t%s,' % val) + else: + for val in prop.value: + vals.append(get_value(prop.type, val)) + + # Put 8 values per line to avoid very long lines. + for i in range(0, len(vals), 8): + if i: + self.buf(',\n\t\t') + self.buf(', '.join(vals[i:i + 8])) + self.buf('}') + def output_node(self, node): """Output the C code for a node Args: node (fdt.Node): node to output """ - def _output_list(node, prop): - """Output the C code for a devicetree property that holds a list - - Args: - node (fdt.Node): Node to output - prop (fdt.Prop): Prop to output - """ - self.buf('{') - vals = [] - # For phandles, output a reference to the platform data - # of the target node. - info = self.get_phandle_argc(prop, node.name) - if info: - # Process the list as pairs of (phandle, id) - pos = 0 - for args in info.args: - phandle_cell = prop.value[pos] - phandle = fdt_util.fdt32_to_cpu(phandle_cell) - target_node = self._fdt.phandle_to_node[phandle] - arg_values = [] - for i in range(args): - arg_values.append( - str(fdt_util.fdt32_to_cpu(prop.value[pos + 1 + i]))) - pos += 1 + args - vals.append('\t{%d, {%s}}' % (target_node.idx, - ', '.join(arg_values))) - for val in vals: - self.buf('\n\t\t%s,' % val) - else: - for val in prop.value: - vals.append(get_value(prop.type, val)) - - # Put 8 values per line to avoid very long lines. - for i in range(0, len(vals), 8): - if i: - self.buf(',\n\t\t') - self.buf(', '.join(vals[i:i + 8])) - self.buf('}') - struct_name, _ = self.get_normalized_compat_name(node) var_name = conv_name_to_c(node.name) self.buf('/* Node %s index %d */\n' % (node.path, node.idx)) @@ -651,7 +651,7 @@ class DtbPlatdata(): # Special handling for lists if isinstance(prop.value, list): - _output_list(node, prop) + self._output_list(node, prop) else: self.buf(get_value(prop.type, prop.value)) self.buf(',\n') From patchwork Wed Dec 23 15:11:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1420182 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=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=BxRuqkiz; dkim-atps=neutral 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 4D1Gt74h0nz9sTX for ; Thu, 24 Dec 2020 02:13:03 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id BF181827D6; Wed, 23 Dec 2020 16:12:24 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="BxRuqkiz"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id F41AF82AE2; Wed, 23 Dec 2020 16:11:54 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd36.google.com (mail-io1-xd36.google.com [IPv6:2607:f8b0:4864:20::d36]) (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 328F3827DB for ; Wed, 23 Dec 2020 16:11:51 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd36.google.com with SMTP id n4so15341370iow.12 for ; Wed, 23 Dec 2020 07:11:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=zcpC630B4yWbn0lkvhIu3GYpoouAagYxzd+UWHRHRoU=; b=BxRuqkizjSIJRIab1Vjseek2yc5LwPVxIHP873IKjjnquOxXT8ATxEh93o2tL9GLYs j8yKa0BnYKuVNGqqVYU9zJhLv4npCU0/x1zzhhGfXaWD5XwIQzWb1Xo04KG4Ve9iruJE rXiOx5ulEH1BsHoZH2MjDr3MlT/8V2STtXTT4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zcpC630B4yWbn0lkvhIu3GYpoouAagYxzd+UWHRHRoU=; b=gxIlP4uA/1sp36Jrl5STGFzyvdXHXBDFR4+H6IVLoVmohq4ZHV5s29PPxPg+4f0Kih K9LFVeI2778N2K7UC75Z9WDfRufH5S1rYzf04DSajPhD17twU/ERuXrO8/cf71l4VXJD vjowrz4kfHdu5Ge6Pp9x/r+cmkucPElNlta0W9NI13FVijJlaAY3j5pgSyh36SPFvfGF dqrtrum3kZ4G/x+6JjfJ9Uk9nbgiJ95xJdyFNxM+fHB+VSxw+E1yYjHBposU5DNEbAVh yShE1KBwWmLvW7oWuRes9QTUmWGUN0D7lk4JGap7Zsbvn0/AHZNIIMuI8t9+eO0Qx5RT qWmQ== X-Gm-Message-State: AOAM533vKW5X7VQYKFskFyH819qRu+Mdo6bOxKsxmtiU3Egn4IxRtB7y 7iHxmQaoFkaFDMf9iilfzOOCArAc9Qr6gWpO X-Google-Smtp-Source: ABdhPJy+j2cLU1VTyU8S3smuNbhafeK3DIIb8OTZ5zhHTmqkaV5z2WJD5plguRRVm0CHWdE/zC7cfQ== X-Received: by 2002:a6b:d20d:: with SMTP id q13mr22021485iob.71.1608736309759; Wed, 23 Dec 2020 07:11:49 -0800 (PST) Received: from localhost.localdomain (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id c15sm16935667ils.87.2020.12.23.07.11.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Dec 2020 07:11:49 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass Subject: [PATCH v2 09/21] dtoc: Output the device in a separate function Date: Wed, 23 Dec 2020 08:11:21 -0700 Message-Id: <20201223081127.v2.9.I67c22b2d5a7917f9b2c74229dd4112c402248796@changeid> X-Mailer: git-send-email 2.29.2.729.g45daf8777d-goog In-Reply-To: <20201223151133.2205985-1-sjg@chromium.org> References: <20201223151133.2205985-1-sjg@chromium.org> MIME-Version: 1.0 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.102.3 at phobos.denx.de X-Virus-Status: Clean Reduce the length of output_node() by moving the device-output functionality into a separate function. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- (no changes since v1) tools/dtoc/dtb_platdata.py | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/tools/dtoc/dtb_platdata.py b/tools/dtoc/dtb_platdata.py index 372f756037e..2d701ac24da 100644 --- a/tools/dtoc/dtb_platdata.py +++ b/tools/dtoc/dtb_platdata.py @@ -631,6 +631,27 @@ class DtbPlatdata(): self.buf(', '.join(vals[i:i + 8])) self.buf('}') + def _declare_device(self, var_name, struct_name, node_parent): + """Add a device declaration to the output + + This declares a U_BOOT_DEVICE() for the device being processed + + Args: + var_name (str): C name for the node + struct_name (str): Name for the dt struct associated with the node + node_parent (Node): Parent of the node (or None if none) + """ + self.buf('U_BOOT_DEVICE(%s) = {\n' % var_name) + self.buf('\t.name\t\t= "%s",\n' % struct_name) + self.buf('\t.plat\t= &%s%s,\n' % (VAL_PREFIX, var_name)) + self.buf('\t.plat_size\t= sizeof(%s%s),\n' % (VAL_PREFIX, var_name)) + idx = -1 + if node_parent and node_parent in self._valid_nodes: + idx = node_parent.idx + self.buf('\t.parent_idx\t= %d,\n' % idx) + self.buf('};\n') + self.buf('\n') + def output_node(self, node): """Output the C code for a node @@ -657,17 +678,7 @@ class DtbPlatdata(): self.buf(',\n') self.buf('};\n') - # Add a device declaration - self.buf('U_BOOT_DEVICE(%s) = {\n' % var_name) - self.buf('\t.name\t\t= "%s",\n' % struct_name) - self.buf('\t.plat\t= &%s%s,\n' % (VAL_PREFIX, var_name)) - self.buf('\t.plat_size\t= sizeof(%s%s),\n' % (VAL_PREFIX, var_name)) - idx = -1 - if node.parent and node.parent in self._valid_nodes: - idx = node.parent.idx - self.buf('\t.parent_idx\t= %d,\n' % idx) - self.buf('};\n') - self.buf('\n') + self._declare_device(var_name, struct_name, node.parent) self.out(''.join(self.get_buf())) From patchwork Wed Dec 23 15:11:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1420185 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=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=U74VV/LL; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (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 4D1Gtt5TkBz9sTX for ; Thu, 24 Dec 2020 02:13:42 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 956D782B28; Wed, 23 Dec 2020 16:12:32 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="U74VV/LL"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 76ACD82A38; Wed, 23 Dec 2020 16:12:00 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd31.google.com (mail-io1-xd31.google.com [IPv6:2607:f8b0:4864:20::d31]) (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 236B08276B for ; Wed, 23 Dec 2020 16:11:52 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd31.google.com with SMTP id z5so15333004iob.11 for ; Wed, 23 Dec 2020 07:11:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QlLE6zAEjTKB4QhSKEge3e2YBvoSNWtAcM1BgXi9sUU=; b=U74VV/LLEz6074od9K40GgGn8MO1u6EhjXY8VfqmcfPJyWyehilzkcIg8594bXjQK1 UZQNBKTFNgTZfwqzy8E9MiCagobi7bkspkr6XV/z8mXxvqeuFgbitD7WfcqaNPaBHOTQ G4SMv0uQ5zzKb9rzEfMmsThYQyZYZknTSRcVQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QlLE6zAEjTKB4QhSKEge3e2YBvoSNWtAcM1BgXi9sUU=; b=Qt+A+f8LTGN3vzdsFKHJ2F1adrUwCbwpQZ9JX+NlnClfbok3+GIWh5dq6vyUrSulUL NhRJVZtfiVz6Xa3Ho9/tVoOd/oAqe6Zx2/YwGlFFjZg5/MRah49aFodNBCsjwrRK/itL GJPYRDvfnIzOMZuDqbTdSsfebwe/oKPMqgoOpQtAfjUVemQ1TsacgGrlcA5VJXRuFtDp 7XdUS+OINVpkvehRVOw/rDu+P8UmpDKtoHjh5PBaO6lrTPQxxcI3/vAtthSNuIsBhlte occHA8pol+NfLyeWt53jYrR78IfXxSLixSiOEWwIAzUvagfyqEgdA/KFrm+rvXrywKtg qFtA== X-Gm-Message-State: AOAM531/SINQhSIbSUdo4BJ+Qa3fnZsU3wh4BpW3PRreFOEUij+Dh/aI INntSJwx5+vcILh3W+qJlw0yowdVagSuAe55 X-Google-Smtp-Source: ABdhPJyeg1SuQsVruxDJB2HjWWvMIz9GHhRqCDjUEuhsw1fi88xmT5UCA0Ed6THALj8AYTS92VbImg== X-Received: by 2002:a6b:db01:: with SMTP id t1mr22233717ioc.10.1608736310717; Wed, 23 Dec 2020 07:11:50 -0800 (PST) Received: from localhost.localdomain (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id c15sm16935667ils.87.2020.12.23.07.11.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Dec 2020 07:11:50 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass Subject: [PATCH v2 10/21] dtoc: Output the struct values in a separate function Date: Wed, 23 Dec 2020 08:11:22 -0700 Message-Id: <20201223081127.v2.10.I67c22b2d5a7917f9b2c74229dd4112c402248796@changeid> X-Mailer: git-send-email 2.29.2.729.g45daf8777d-goog In-Reply-To: <20201223151133.2205985-1-sjg@chromium.org> References: <20201223151133.2205985-1-sjg@chromium.org> MIME-Version: 1.0 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.102.3 at phobos.denx.de X-Virus-Status: Clean Reduce the length of output_node() futher by moving the struct-output functionality into a two separate functions. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- (no changes since v1) tools/dtoc/dtb_platdata.py | 50 ++++++++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 16 deletions(-) diff --git a/tools/dtoc/dtb_platdata.py b/tools/dtoc/dtb_platdata.py index 2d701ac24da..1d89f77a00b 100644 --- a/tools/dtoc/dtb_platdata.py +++ b/tools/dtoc/dtb_platdata.py @@ -652,6 +652,39 @@ class DtbPlatdata(): self.buf('};\n') self.buf('\n') + def _output_prop(self, node, prop): + """Output a line containing the value of a struct member + + Args: + node (Node): Node being output + prop (Prop): Prop object to output + """ + if prop.name in PROP_IGNORE_LIST or prop.name[0] == '#': + return + member_name = conv_name_to_c(prop.name) + self.buf('\t%s= ' % tab_to(3, '.' + member_name)) + + # Special handling for lists + if isinstance(prop.value, list): + self._output_list(node, prop) + else: + self.buf(get_value(prop.type, prop.value)) + self.buf(',\n') + + def _output_values(self, var_name, struct_name, node): + """Output the definition of a device's struct values + + Args: + var_name (str): C name for the node + struct_name (str): Name for the dt struct associated with the node + node (Node): Node being output + """ + self.buf('static struct %s%s %s%s = {\n' % + (STRUCT_PREFIX, struct_name, VAL_PREFIX, var_name)) + for pname in sorted(node.props): + self._output_prop(node, node.props[pname]) + self.buf('};\n') + def output_node(self, node): """Output the C code for a node @@ -661,23 +694,8 @@ class DtbPlatdata(): struct_name, _ = self.get_normalized_compat_name(node) var_name = conv_name_to_c(node.name) self.buf('/* Node %s index %d */\n' % (node.path, node.idx)) - self.buf('static struct %s%s %s%s = {\n' % - (STRUCT_PREFIX, struct_name, VAL_PREFIX, var_name)) - for pname in sorted(node.props): - prop = node.props[pname] - if pname in PROP_IGNORE_LIST or pname[0] == '#': - continue - member_name = conv_name_to_c(prop.name) - self.buf('\t%s= ' % tab_to(3, '.' + member_name)) - - # Special handling for lists - if isinstance(prop.value, list): - self._output_list(node, prop) - else: - self.buf(get_value(prop.type, prop.value)) - self.buf(',\n') - self.buf('};\n') + self._output_values(var_name, struct_name, node) self._declare_device(var_name, struct_name, node.parent) self.out(''.join(self.get_buf())) From patchwork Wed Dec 23 15:11:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1420186 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=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=BUUTw5xR; dkim-atps=neutral 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 4D1Gv62QJHz9sTX for ; Thu, 24 Dec 2020 02:13:54 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0B98782B33; Wed, 23 Dec 2020 16:12:35 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="BUUTw5xR"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4FCCC82B1F; Wed, 23 Dec 2020 16:11:59 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x12c.google.com (mail-il1-x12c.google.com [IPv6:2607:f8b0:4864:20::12c]) (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 1CF77827E2 for ; Wed, 23 Dec 2020 16:11:53 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x12c.google.com with SMTP id t9so15324613ilf.2 for ; Wed, 23 Dec 2020 07:11:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=iHyybJuU6CvWfdsThXgyW2ttfFA7rTSD3EXPrV77s3g=; b=BUUTw5xRCYuRG/nFsr+tcEjcy9lS0EVLRqilGx7cG5AZ3eMP+ftAQQRCtjrt0YVT1S S7L7UqRLHWJSi2V9lv36Nlbibn93i5tbA4PHsmxtj0OTGPxvJY7tBt6vAT8ktQz9968B 5mq9WVep2tyoVaNPVq57afG6q+dqgy7b5H5Y8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=iHyybJuU6CvWfdsThXgyW2ttfFA7rTSD3EXPrV77s3g=; b=dhaPSSlUajSpgZipCiY7ZlSVYnYA19ox5KxA8pieTOPTbGBU5nFBNkKTFlaZEeeifW CMxBsP6xJPrXf6OBv6gUM/ZoM3Ip4iUY3w8lmMMzVsvy6ngfC1FxZY4bBErhYw2r6AOi pMAIqlQq5RlPVsS52hlqS0TuV0mQocTfPh0hwSipfaUWvEIq4mqlN6sf/TC4F4Uh8s4s MmoAxP/uTlm8M3pmYulX8zQqUxMRKgWl1p7nfexDR4l3QucBS/0FlWBAT6HaVS7bmV9R Cyo1LWnHdmG5+Z6WIxaQK25id/KFYAPSke77r09ad9jlHzkV2lDs09YO/iN4Sf2O92Lx q+fQ== X-Gm-Message-State: AOAM531ZkSKnKX61hzEWQwMAT9xZ/Imgll6HOwwGRPuRaD1eIO+BjSQv GWosGbocQLhED1PUsHmJnAShb4/550Bkszgb X-Google-Smtp-Source: ABdhPJw+/zsVQAGvdiJdlDX27BoGbCz8vF1pTxS3NDqdUn+Pp4miqNud994aNrPIpGBMKfKaZJ4uTQ== X-Received: by 2002:a92:d8d1:: with SMTP id l17mr25209168ilo.99.1608736311678; Wed, 23 Dec 2020 07:11:51 -0800 (PST) Received: from localhost.localdomain (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id c15sm16935667ils.87.2020.12.23.07.11.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Dec 2020 07:11:51 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass Subject: [PATCH v2 11/21] dtoc: Convert _drivers to a dict Date: Wed, 23 Dec 2020 08:11:23 -0700 Message-Id: <20201223081127.v2.11.I84458c569770c44cb3ceb351b6e7d7d31c808b0a@changeid> X-Mailer: git-send-email 2.29.2.729.g45daf8777d-goog In-Reply-To: <20201223151133.2205985-1-sjg@chromium.org> References: <20201223151133.2205985-1-sjg@chromium.org> MIME-Version: 1.0 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.102.3 at phobos.denx.de X-Virus-Status: Clean At present this member holds a simple list of driver names. Update it to be a dict of DriverInfo, with the name being the key. This will allow more information to be added about each driver, in future patches. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- Changes in v2: - Rename DriverInfo to Driver - Add a test for the new code and a comment for Driver tools/dtoc/dtb_platdata.py | 26 ++++++++++++++++++++++---- tools/dtoc/test_dtoc.py | 10 ++++++++++ 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/tools/dtoc/dtb_platdata.py b/tools/dtoc/dtb_platdata.py index 1d89f77a00b..5b1bb7e5fd9 100644 --- a/tools/dtoc/dtb_platdata.py +++ b/tools/dtoc/dtb_platdata.py @@ -64,6 +64,22 @@ PhandleInfo = collections.namedtuple('PhandleInfo', ['max_args', 'args']) PhandleLink = collections.namedtuple('PhandleLink', ['var_node', 'dev_name']) +class Driver: + """Information about a driver in U-Boot + + Attributes: + name: Name of driver. For U_BOOT_DRIVER(x) this is 'x' + """ + def __init__(self, name): + self.name = name + + def __eq__(self, other): + return self.name == other.name + + def __repr__(self): + return "Driver(name='%s')" % self.name + + def conv_name_to_c(name): """Convert a device-tree name to a C identifier @@ -156,7 +172,9 @@ class DtbPlatdata(): _outfile: The current output file (sys.stdout or a real file) _warning_disabled: true to disable warnings about driver names not found _lines: Stashed list of output lines for outputting in the future - _drivers: List of valid driver names found in drivers/ + _drivers: Dict of valid driver names found in drivers/ + key: Driver name + value: Driver for that driver _driver_aliases: Dict that holds aliases for driver names key: Driver alias declared with U_BOOT_DRIVER_ALIAS(driver_alias, driver_name) @@ -172,7 +190,7 @@ class DtbPlatdata(): self._outfile = None self._warning_disabled = warning_disabled self._lines = [] - self._drivers = [] + self._drivers = {} self._driver_aliases = {} self._drivers_additional = drivers_additional or [] @@ -196,7 +214,7 @@ class DtbPlatdata(): compat_list_c = get_compat_name(node) for compat_c in compat_list_c: - if not compat_c in self._drivers: + if not compat_c in self._drivers.keys(): compat_c = self._driver_aliases.get(compat_c) if not compat_c: continue @@ -334,7 +352,7 @@ class DtbPlatdata(): drivers = re.findall(r'U_BOOT_DRIVER\((.*)\)', buff) for driver in drivers: - self._drivers.append(driver) + self._drivers[driver] = Driver(driver) # The following re will search for driver aliases declared as # U_BOOT_DRIVER_ALIAS(alias, driver_name) diff --git a/tools/dtoc/test_dtoc.py b/tools/dtoc/test_dtoc.py index 49ab75b85da..c76942c9e2d 100755 --- a/tools/dtoc/test_dtoc.py +++ b/tools/dtoc/test_dtoc.py @@ -906,3 +906,13 @@ U_BOOT_DEVICE(spl_test2) = { with test_util.capture_sys_output() as (stdout, stderr): dtb_platdata.run_steps(['struct'], dtb_file, False, output, True, [driver_fn]) + + def testDriver(self): + """Test the Driver class""" + drv1 = dtb_platdata.Driver('fred') + drv2 = dtb_platdata.Driver('mary') + drv3 = dtb_platdata.Driver('fred') + self.assertEqual("Driver(name='fred')", str(drv1)) + self.assertEqual(drv1, drv3) + self.assertNotEqual(drv1, drv2) + self.assertNotEqual(drv2, drv3) From patchwork Wed Dec 23 15:11:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1420190 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=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=ERUUc0Bm; dkim-atps=neutral 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 4D1Gvy2lLzz9sTX for ; Thu, 24 Dec 2020 02:14:38 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id ABE8D82B43; Wed, 23 Dec 2020 16:12:48 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="ERUUc0Bm"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3FD5C82B20; Wed, 23 Dec 2020 16:12:10 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x130.google.com (mail-il1-x130.google.com [IPv6:2607:f8b0:4864:20::130]) (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 5767A82A3B for ; Wed, 23 Dec 2020 16:11:54 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x130.google.com with SMTP id 2so15299096ilg.9 for ; Wed, 23 Dec 2020 07:11:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nkz9uPhYg8+CUVY7a0qL71qQCgSzbiZ/7MOJRyCVgyE=; b=ERUUc0BmL0Q3n9OLQLL9yWYkoY5iwUaVXKD+BH62XeuYzox0ziJMrUL5lgUanP8pBg msSPPXchFe9mk1AbMH2EB/VSh7Iu1ZyvTHW3GFOQjEfmDY/4nNZ0UfVK6f4W6FJRNWvX M4F/iEyIUSw7fK895Tdws7VDQvIgf6+BvQI7M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nkz9uPhYg8+CUVY7a0qL71qQCgSzbiZ/7MOJRyCVgyE=; b=UqUFk4LjMWuAORp08vY5hqK7LD2P4Ikx/y+sAkdbakeAwmkRsH+Ht76Z8MEw6gBzku Ffsmva8RWIbDMdkH7W/m2k0lfRineJd47CQnkQfeqAc5+1L7uJNjKTiZZ95OqbhzkGY8 8BdkpixanufUoFJolfOuxXXRAl6698MYNTiqUHCCnq6zfzf0Ah8EhsdIqNxh2Z1uyjxq X3WNebvdcoQFWnG3dgOkHTZkC03gTO/RkTGwTjbpcnTreURIenb6YSGMkBqHn4uxWfq9 HCQxGv0jurHKghgBU4nVwfC4iT1H1jD+Fa8v40x3gc/JlDbQHyDnWB6nf+rdrJ8rjzg0 EncQ== X-Gm-Message-State: AOAM533YrbIMKTun04JrgbAkX7SoBCcw7GYGoovCaoxI7k6GgL7QMdKR Pgq9dS3bqCoxzZ1kcYG4Zo0X0yV4ywrqwErA X-Google-Smtp-Source: ABdhPJyrIAooREFQA/iyQT0gOAgMBIqu2U7dPAHG081nwvRc125r0pWNNFfzvwh19pB0yIKpRumWPg== X-Received: by 2002:a05:6e02:20cc:: with SMTP id 12mr26784861ilq.91.1608736312689; Wed, 23 Dec 2020 07:11:52 -0800 (PST) Received: from localhost.localdomain (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id c15sm16935667ils.87.2020.12.23.07.11.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Dec 2020 07:11:52 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass Subject: [PATCH v2 12/21] dtoc: Scan drivers for available information Date: Wed, 23 Dec 2020 08:11:24 -0700 Message-Id: <20201223081127.v2.12.I1670e4e1d7dc726b21763ed8ac47644111930441@changeid> X-Mailer: git-send-email 2.29.2.729.g45daf8777d-goog In-Reply-To: <20201223151133.2205985-1-sjg@chromium.org> References: <20201223151133.2205985-1-sjg@chromium.org> MIME-Version: 1.0 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.102.3 at phobos.denx.de X-Virus-Status: Clean At present we simply record the name of a driver parsed from its implementation file. We also need to get the uclass and a few other things so we can instantiate devices at build time. Add support for collecting this information. This requires parsing each driver file. Signed-off-by: Simon Glass --- (no changes since v1) tools/dtoc/dtb_platdata.py | 171 ++++++++++++++++++++++++++++++++++--- tools/dtoc/test_dtoc.py | 101 +++++++++++++++++++++- 2 files changed, 258 insertions(+), 14 deletions(-) diff --git a/tools/dtoc/dtb_platdata.py b/tools/dtoc/dtb_platdata.py index 5b1bb7e5fd9..51c4d1cae00 100644 --- a/tools/dtoc/dtb_platdata.py +++ b/tools/dtoc/dtb_platdata.py @@ -69,15 +69,26 @@ class Driver: Attributes: name: Name of driver. For U_BOOT_DRIVER(x) this is 'x' + uclass_id: Name of uclass (e.g. 'UCLASS_I2C') + compat: Driver data for each compatible string: + key: Compatible string, e.g. 'rockchip,rk3288-grf' + value: Driver data, e,g, 'ROCKCHIP_SYSCON_GRF', or None """ - def __init__(self, name): + def __init__(self, name, uclass_id, compat): self.name = name + self.uclass_id = uclass_id + self.compat = compat + self.priv_size = 0 def __eq__(self, other): - return self.name == other.name + return (self.name == other.name and + self.uclass_id == other.uclass_id and + self.compat == other.compat and + self.priv_size == other.priv_size) def __repr__(self): - return "Driver(name='%s')" % self.name + return ("Driver(name='%s', uclass_id='%s', compat=%s, priv_size=%s)" % + (self.name, self.uclass_id, self.compat, self.priv_size)) def conv_name_to_c(name): @@ -180,6 +191,12 @@ class DtbPlatdata(): U_BOOT_DRIVER_ALIAS(driver_alias, driver_name) value: Driver name declared with U_BOOT_DRIVER(driver_name) _drivers_additional: List of additional drivers to use during scanning + _of_match: Dict holding information about compatible strings + key: Name of struct udevice_id variable + value: Dict of compatible info in that variable: + key: Compatible string, e.g. 'rockchip,rk3288-grf' + value: Driver data, e,g, 'ROCKCHIP_SYSCON_GRF', or None + _compat_to_driver: Maps compatible strings to Driver """ def __init__(self, dtb_fname, include_disabled, warning_disabled, drivers_additional=None): @@ -193,6 +210,8 @@ class DtbPlatdata(): self._drivers = {} self._driver_aliases = {} self._drivers_additional = drivers_additional or [] + self._of_match = {} + self._compat_to_driver = {} def get_normalized_compat_name(self, node): """Get a node's normalized compat name @@ -331,10 +350,144 @@ class DtbPlatdata(): return PhandleInfo(max_args, args) return None + def _parse_driver(self, fname, buff): + """Parse a C file to extract driver information contained within + + This parses U_BOOT_DRIVER() structs to obtain various pieces of useful + information. + + It updates the following members: + _drivers - updated with new Driver records for each driver found + in the file + _of_match - updated with each compatible string found in the file + _compat_to_driver - Maps compatible string to Driver + + Args: + fname (str): Filename being parsed (used for warnings) + buff (str): Contents of file + + Raises: + ValueError: Compatible variable is mentioned in .of_match in + U_BOOT_DRIVER() but not found in the file + """ + # Dict holding information about compatible strings collected in this + # function so far + # key: Name of struct udevice_id variable + # value: Dict of compatible info in that variable: + # key: Compatible string, e.g. 'rockchip,rk3288-grf' + # value: Driver data, e,g, 'ROCKCHIP_SYSCON_GRF', or None + of_match = {} + + # Dict holding driver information collected in this function so far + # key: Driver name (C name as in U_BOOT_DRIVER(xxx)) + # value: Driver + drivers = {} + + # Collect the driver name (None means not found yet) + driver_name = None + re_driver = re.compile(r'U_BOOT_DRIVER\((.*)\)') + + # Collect the uclass ID, e.g. 'UCLASS_SPI' + uclass_id = None + re_id = re.compile(r'\s*\.id\s*=\s*(UCLASS_[A-Z0-9_]+)') + + # Collect the compatible string, e.g. 'rockchip,rk3288-grf' + compat = None + re_compat = re.compile(r'{\s*.compatible\s*=\s*"(.*)"\s*' + r'(,\s*.data\s*=\s*(.*))?\s*},') + + # This is a dict of compatible strings that were found: + # key: Compatible string, e.g. 'rockchip,rk3288-grf' + # value: Driver data, e,g, 'ROCKCHIP_SYSCON_GRF', or None + compat_dict = {} + + # Holds the var nane of the udevice_id list, e.g. + # 'rk3288_syscon_ids_noc' in + # static const struct udevice_id rk3288_syscon_ids_noc[] = { + ids_name = None + re_ids = re.compile(r'struct udevice_id (.*)\[\]\s*=') + + # Matches the references to the udevice_id list + re_of_match = re.compile(r'\.of_match\s*=\s*([a-z0-9_]+),') + + # Matches the header/size information for priv + re_priv = re.compile(r'^\s*DM_PRIV\((.*)\)$') + prefix = '' + for line in buff.splitlines(): + # Handle line continuation + if prefix: + line = prefix + line + prefix = '' + if line.endswith('\\'): + prefix = line[:-1] + continue + + driver_match = re_driver.search(line) + + # If we have seen U_BOOT_DRIVER()... + if driver_name: + id_m = re_id.search(line) + id_of_match = re_of_match.search(line) + if id_m: + uclass_id = id_m.group(1) + elif id_of_match: + compat = id_of_match.group(1) + elif '};' in line: + if uclass_id and compat: + if compat not in of_match: + raise ValueError( + "%s: Unknown compatible var '%s' (found: %s)" % + (fname, compat, ','.join(of_match.keys()))) + driver = Driver(driver_name, uclass_id, + of_match[compat]) + drivers[driver_name] = driver + + # This needs to be deterministic, since a driver may + # have multiple compatible strings pointing to it. + # We record the one earliest in the alphabet so it + # will produce the same result on all machines. + for compat_id in of_match[compat]: + old = self._compat_to_driver.get(compat_id) + if not old or driver.name < old.name: + self._compat_to_driver[compat_id] = driver + else: + # The driver does not have a uclass or compat string. + # The first is required but the second is not, so just + # ignore this. + pass + driver_name = None + uclass_id = None + ids_name = None + compat = None + compat_dict = {} + + elif ids_name: + compat_m = re_compat.search(line) + if compat_m: + compat_dict[compat_m.group(1)] = compat_m.group(3) + elif '};' in line: + of_match[ids_name] = compat_dict + ids_name = None + elif driver_match: + driver_name = driver_match.group(1) + else: + ids_m = re_ids.search(line) + if ids_m: + ids_name = ids_m.group(1) + + # Make the updates based on what we found + self._drivers.update(drivers) + self._of_match.update(of_match) + def scan_driver(self, fname): """Scan a driver file to build a list of driver names and aliases - This procedure will populate self._drivers and self._driver_aliases + It updates the following members: + _drivers - updated with new Driver records for each driver found + 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: Driver filename to scan @@ -347,12 +500,10 @@ class DtbPlatdata(): print("Skipping file '%s' due to unicode error" % fname) return - # The following re will search for driver names declared as - # U_BOOT_DRIVER(driver_name) - drivers = re.findall(r'U_BOOT_DRIVER\((.*)\)', buff) - - for driver in drivers: - self._drivers[driver] = Driver(driver) + # If this file has any U_BOOT_DRIVER() declarations, process it to + # obtain driver information + if 'U_BOOT_DRIVER' in buff: + self._parse_driver(fname, buff) # The following re will search for driver aliases declared as # U_BOOT_DRIVER_ALIAS(alias, driver_name) diff --git a/tools/dtoc/test_dtoc.py b/tools/dtoc/test_dtoc.py index c76942c9e2d..89192797781 100755 --- a/tools/dtoc/test_dtoc.py +++ b/tools/dtoc/test_dtoc.py @@ -18,6 +18,7 @@ import unittest from dtoc import dtb_platdata from dtb_platdata import conv_name_to_c +from dtb_platdata import Driver from dtb_platdata import get_compat_name from dtb_platdata import get_value from dtb_platdata import tab_to @@ -71,6 +72,17 @@ def get_dtb_file(dts_fname, capture_stderr=False): capture_stderr=capture_stderr) +class FakeNode: + """Fake Node object for testing""" + def __init__(self): + pass + +class FakeProp: + """Fake Prop object for testing""" + def __init__(self): + pass + + class TestDtoc(unittest.TestCase): """Tests for dtoc""" @classmethod @@ -909,10 +921,91 @@ U_BOOT_DEVICE(spl_test2) = { def testDriver(self): """Test the Driver class""" - drv1 = dtb_platdata.Driver('fred') - drv2 = dtb_platdata.Driver('mary') - drv3 = dtb_platdata.Driver('fred') - self.assertEqual("Driver(name='fred')", str(drv1)) + i2c = 'I2C_UCLASS' + compat = {'rockchip,rk3288-grf': 'ROCKCHIP_SYSCON_GRF', + 'rockchip,rk3288-srf': None} + drv1 = dtb_platdata.Driver('fred', i2c, compat) + drv2 = dtb_platdata.Driver('mary', i2c, {}) + drv3 = dtb_platdata.Driver('fred', i2c, compat) + self.assertEqual( + "Driver(name='fred', uclass_id='I2C_UCLASS', " + "compat={'rockchip,rk3288-grf': 'ROCKCHIP_SYSCON_GRF', " + "'rockchip,rk3288-srf': None}, priv_size=0)", str(drv1)) self.assertEqual(drv1, drv3) self.assertNotEqual(drv1, drv2) self.assertNotEqual(drv2, drv3) + + def testScan(self): + """Test scanning of a driver""" + fname = os.path.join(our_path, '..', '..', 'drivers/i2c/tegra_i2c.c') + buff = tools.ReadFile(fname, False) + dpd = dtb_platdata.DtbPlatdata(None, False, False) + dpd._parse_driver(fname, buff) + self.assertIn('i2c_tegra', dpd._drivers) + drv = dpd._drivers['i2c_tegra'] + self.assertEqual('i2c_tegra', drv.name) + self.assertEqual('UCLASS_I2C', drv.uclass_id) + self.assertEqual( + {'nvidia,tegra114-i2c': 'TYPE_114 ', + 'nvidia,tegra20-i2c': 'TYPE_STD ', + 'nvidia,tegra20-i2c-dvc': 'TYPE_DVC '}, drv.compat) + self.assertEqual(0, drv.priv_size) + self.assertEqual(1, len(dpd._drivers)) + + def testNormalizedName(self): + """Test operation of get_normalized_compat_name()""" + prop = FakeNode() + prop.name = 'compatible' + prop.value = 'rockchip,rk3288-grf' + node = FakeProp() + node.props = {'compatible': prop} + dpd = dtb_platdata.DtbPlatdata(None, False, False) + with test_util.capture_sys_output() as (stdout, stderr): + name, aliases = dpd.get_normalized_compat_name(node) + self.assertEqual('rockchip_rk3288_grf', name) + self.assertEqual([], aliases) + self.assertEqual( + 'WARNING: the driver rockchip_rk3288_grf was not found in the driver list', + stdout.getvalue().strip()) + + i2c = 'I2C_UCLASS' + compat = {'rockchip,rk3288-grf': 'ROCKCHIP_SYSCON_GRF', + 'rockchip,rk3288-srf': None} + drv = dtb_platdata.Driver('fred', i2c, compat) + dpd._drivers['rockchip_rk3288_grf'] = drv + + dpd._driver_aliases['rockchip_rk3288_srf'] = 'rockchip_rk3288_grf' + + with test_util.capture_sys_output() as (stdout, stderr): + name, aliases = dpd.get_normalized_compat_name(node) + self.assertEqual('', stdout.getvalue().strip()) + self.assertEqual('rockchip_rk3288_grf', name) + self.assertEqual([], aliases) + + prop.value = 'rockchip,rk3288-srf' + with test_util.capture_sys_output() as (stdout, stderr): + name, aliases = dpd.get_normalized_compat_name(node) + self.assertEqual('', stdout.getvalue().strip()) + self.assertEqual('rockchip_rk3288_grf', name) + self.assertEqual(['rockchip_rk3288_srf'], aliases) + + def testScanErrors(self): + """Test detection of scanning errors""" + buff = ''' +static const struct udevice_id tegra_i2c_ids2[] = { + { .compatible = "nvidia,tegra114-i2c", .data = TYPE_114 }, + { } +}; + +U_BOOT_DRIVER(i2c_tegra) = { + .name = "i2c_tegra", + .id = UCLASS_I2C, + .of_match = tegra_i2c_ids, +}; +''' + dpd = dtb_platdata.DtbPlatdata(None, False, False) + with self.assertRaises(ValueError) as e: + dpd._parse_driver('file.c', buff) + self.assertIn( + "file.c: Unknown compatible var 'tegra_i2c_ids' (found: tegra_i2c_ids2)", + str(e.exception)) From patchwork Wed Dec 23 15:11:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1420187 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=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=EQ5rDogu; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (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 4D1GvJ3SkLz9sTX for ; Thu, 24 Dec 2020 02:14:04 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 69329827DE; Wed, 23 Dec 2020 16:12:42 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="EQ5rDogu"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EEC9982A38; Wed, 23 Dec 2020 16:12:06 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x12b.google.com (mail-il1-x12b.google.com [IPv6:2607:f8b0:4864:20::12b]) (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 1BD9382A64 for ; Wed, 23 Dec 2020 16:11:55 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x12b.google.com with SMTP id g1so15324088ilk.7 for ; Wed, 23 Dec 2020 07:11:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=RE/OElOg3ggBrM4OeBB6dxFDR7K3EJxhQLta9I0Z0fE=; b=EQ5rDogujBaFDTkHSQAb4FZg38suNzHkD4rx9qoQlvoceRuQM52bzLQy/QJxdSNxgk WuOORC6IzlvQebyhcegIrkxQE1GO1wJq+wFc7NcL6nRu4Sk56SqFdvLnvKW3MazkcFpj kYOFqLlDEMLbpnWRCbYcPUsMvwJ3zHv+qrQPI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=RE/OElOg3ggBrM4OeBB6dxFDR7K3EJxhQLta9I0Z0fE=; b=T878Tle9frrI8uQla5qUpqtfZgWiKCs+jQZwH83L+8qNKnI1b5tnMCJuKuDWeIaXIh vlJDdpFhS01hwox28dYo43YYFXNrhGujUNqX9nJDqW6CV3eWc0/sXg6E/goCBXtbYsJO bqyir4kRNjGA7DE2JVqTMmHptzJPRzOFPdMCDAF7qmPvUisp3SdyV7S05dnsyn/8hdBy 45OWPIf6nmnsUNclPOtuyqIemXpgr5BvWEEOIrgeIQRZc4SzapOaIupSF/yLQFe6I22U M+VaA7LwMZhu1//E29PyTV+TOPrSLYji3fRloEui/9gDZsJcP/r3SftKGrgodVB5ReAl bArw== X-Gm-Message-State: AOAM532zpus9v6KP9F/XKvcau/XekYCqo0bcW2J2+CVwrC2iAIGzG+QU 62lUwsJyeQOc8Qj6GPOKd8uXeEPpRlx93ZcT X-Google-Smtp-Source: ABdhPJyO1qgQthXo491qBiQn95uu1GtCL/cC/6lCPtvDuHRtpp7k/Lnxdh6tfEWed8M7n5Bxg7rMXw== X-Received: by 2002:a92:bb84:: with SMTP id x4mr25774514ilk.298.1608736313715; Wed, 23 Dec 2020 07:11:53 -0800 (PST) Received: from localhost.localdomain (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id c15sm16935667ils.87.2020.12.23.07.11.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Dec 2020 07:11:53 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass Subject: [PATCH v2 13/21] dtoc: Allow use of the of_match_ptr() macro Date: Wed, 23 Dec 2020 08:11:25 -0700 Message-Id: <20201223151133.2205985-6-sjg@chromium.org> X-Mailer: git-send-email 2.29.2.729.g45daf8777d-goog In-Reply-To: <20201223151133.2205985-1-sjg@chromium.org> References: <20201223151133.2205985-1-sjg@chromium.org> MIME-Version: 1.0 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.102.3 at phobos.denx.de X-Virus-Status: Clean Update the regex for the of_match member to allow of_match_ptr() so it matches both: .of_match = apl_hostbridge_ids, and .of_match = of_match_ptr(apl_hostbridge_ids), Without this, dtoc emits warnings and cannot find the drivers. Signed-off-by: Simon Glass --- (no changes since v1) tools/dtoc/dtb_platdata.py | 5 +++-- tools/dtoc/test_dtoc.py | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/tools/dtoc/dtb_platdata.py b/tools/dtoc/dtb_platdata.py index 51c4d1cae00..9c2bd18f5a4 100644 --- a/tools/dtoc/dtb_platdata.py +++ b/tools/dtoc/dtb_platdata.py @@ -408,7 +408,8 @@ class DtbPlatdata(): re_ids = re.compile(r'struct udevice_id (.*)\[\]\s*=') # Matches the references to the udevice_id list - re_of_match = re.compile(r'\.of_match\s*=\s*([a-z0-9_]+),') + re_of_match = re.compile( + r'\.of_match\s*=\s*(of_match_ptr\()?([a-z0-9_]+)(\))?,') # Matches the header/size information for priv re_priv = re.compile(r'^\s*DM_PRIV\((.*)\)$') @@ -431,7 +432,7 @@ class DtbPlatdata(): if id_m: uclass_id = id_m.group(1) elif id_of_match: - compat = id_of_match.group(1) + compat = id_of_match.group(2) elif '};' in line: if uclass_id and compat: if compat not in of_match: diff --git a/tools/dtoc/test_dtoc.py b/tools/dtoc/test_dtoc.py index 89192797781..1fd981f51e1 100755 --- a/tools/dtoc/test_dtoc.py +++ b/tools/dtoc/test_dtoc.py @@ -1009,3 +1009,23 @@ U_BOOT_DRIVER(i2c_tegra) = { self.assertIn( "file.c: Unknown compatible var 'tegra_i2c_ids' (found: tegra_i2c_ids2)", str(e.exception)) + + def testOfmatch(self): + """Test detection of of_match_ptr() member""" + buff = ''' +static const struct udevice_id tegra_i2c_ids[] = { + { .compatible = "nvidia,tegra114-i2c", .data = TYPE_114 }, + { } +}; + +U_BOOT_DRIVER(i2c_tegra) = { + .name = "i2c_tegra", + .id = UCLASS_I2C, + .of_match = of_match_ptr(tegra_i2c_ids), +}; +''' + dpd = dtb_platdata.DtbPlatdata(None, False, False) + dpd._parse_driver('file.c', buff) + self.assertIn('i2c_tegra', dpd._drivers) + drv = dpd._drivers['i2c_tegra'] + self.assertEqual('i2c_tegra', drv.name) From patchwork Wed Dec 23 15:11:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1420188 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=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=E1j5wneG; dkim-atps=neutral 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 4D1GvW6zYsz9sTX for ; Thu, 24 Dec 2020 02:14:15 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6071282B3D; Wed, 23 Dec 2020 16:12:44 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="E1j5wneG"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E898682B24; Wed, 23 Dec 2020 16:12:08 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x12e.google.com (mail-il1-x12e.google.com [IPv6:2607:f8b0:4864:20::12e]) (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 07E6E82B0F for ; Wed, 23 Dec 2020 16:11:56 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x12e.google.com with SMTP id g1so15324118ilk.7 for ; Wed, 23 Dec 2020 07:11:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LJ4pv+EHGnKfQ70MAIbovAFKwv9MKMTcY8DMBVWFC44=; b=E1j5wneGqVNx68kt+9vmZ1Rh4jhiv12oQtWiKZ2ByvpxWE7ibshXqB/oZ6bomKsFQJ WXrQbRla1eHAwudzIMj92sG0gy63gYNcO8xvxUGnwr1hjCQ1X0SOQ1lBNi/wAMJ6BXq/ 1bm2CS48/gUoE08tqB/iBM+OsQ8pAeYYVxsR0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LJ4pv+EHGnKfQ70MAIbovAFKwv9MKMTcY8DMBVWFC44=; b=gHghQ8AycrdaTrftK6UG/aXnPF6oyW+0uLPvofRS/EMR7uI2QcO1eWTm2A6usB5B5z yATbUu8cPV8Fn6V91U5hxpd7OQboYumlXk/rLHAP4pm8bjgnn5lWoNBIqPxt/D2MK98/ rzvV0nsqQnNV1hMNi3Do7yYp/N/kMX0FoEyhL3D0YD6T8tBJrQu56gthCqOuAdvOHJHW wyq7RQXujOM3vRYWQ/eMiMXbl0Vug5Gx2psHRjN0MncvLtAoO8Yrcz+gWvDymCxZP+ug n/lx/IMiw1hyxpMKdnkJ9J1bl9pfHMDHI3QGnf6sXTq0UBg7+/6ouvLht039vwt+l7qP EUrw== X-Gm-Message-State: AOAM533cnKixZrR07/hah/Ys9UScoMo4uFLRIxfn9aH5IYCiQr3qdCfH xUjCUQ0ogEIEq4au9SK0bd1KjeS+JQ8UrsMO X-Google-Smtp-Source: ABdhPJyYznRWvk4qYUgKP8BuK+plxbaFgVgl7QDqB9MRmGFTj2Bg7mWPvSzVUehiBKUkwkhW3JNFEA== X-Received: by 2002:a92:48d2:: with SMTP id j79mr25536215ilg.201.1608736314664; Wed, 23 Dec 2020 07:11:54 -0800 (PST) Received: from localhost.localdomain (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id c15sm16935667ils.87.2020.12.23.07.11.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Dec 2020 07:11:54 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Bin Meng Subject: [PATCH v2 14/21] x86: apl: Use const for driver operations Date: Wed, 23 Dec 2020 08:11:26 -0700 Message-Id: <20201223151133.2205985-7-sjg@chromium.org> X-Mailer: git-send-email 2.29.2.729.g45daf8777d-goog In-Reply-To: <20201223151133.2205985-1-sjg@chromium.org> References: <20201223151133.2205985-1-sjg@chromium.org> MIME-Version: 1.0 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.102.3 at phobos.denx.de X-Virus-Status: Clean Update these declarations to const to ensure that the data ends up in the rodata section. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- (no changes since v1) arch/x86/cpu/apollolake/pmc.c | 2 +- arch/x86/cpu/intel_common/p2sb.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/cpu/apollolake/pmc.c b/arch/x86/cpu/apollolake/pmc.c index 290b2cb3e71..c40065ab8cf 100644 --- a/arch/x86/cpu/apollolake/pmc.c +++ b/arch/x86/cpu/apollolake/pmc.c @@ -205,7 +205,7 @@ static int apl_pmc_probe(struct udevice *dev) return 0; } -static struct acpi_pmc_ops apl_pmc_ops = { +static const struct acpi_pmc_ops apl_pmc_ops = { .init = apl_pmc_fill_power_state, .prev_sleep_state = apl_prev_sleep_state, .disable_tco = apl_disable_tco, diff --git a/arch/x86/cpu/intel_common/p2sb.c b/arch/x86/cpu/intel_common/p2sb.c index e6edab0b056..3765eeeab0d 100644 --- a/arch/x86/cpu/intel_common/p2sb.c +++ b/arch/x86/cpu/intel_common/p2sb.c @@ -180,7 +180,7 @@ static int p2sb_child_post_bind(struct udevice *dev) return 0; } -struct p2sb_ops p2sb_ops = { +static const struct p2sb_ops p2sb_ops = { .set_hide = intel_p2sb_set_hide, }; From patchwork Wed Dec 23 15:11:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1420189 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=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=nYK4GXJ5; dkim-atps=neutral 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 4D1Gvl0zkXz9sTX for ; Thu, 24 Dec 2020 02:14:27 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9414882B3A; Wed, 23 Dec 2020 16:12:46 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="nYK4GXJ5"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2814282B23; Wed, 23 Dec 2020 16:12:09 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x134.google.com (mail-il1-x134.google.com [IPv6:2607:f8b0:4864:20::134]) (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 E64CF82AD9 for ; Wed, 23 Dec 2020 16:11:56 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x134.google.com with SMTP id 2so15299205ilg.9 for ; Wed, 23 Dec 2020 07:11:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rQTutOmQxstlBcZ/eHEUD1/YTlZa+levESqRS+crZdg=; b=nYK4GXJ5SokyB8AfhBckasYhOc7I/sajRJiYslTxZRD/C+IQFMhlIRtNzBIT05quB5 MtYifzL6rXOqZxY9suVroBUYG9m7+KsT9Ss0s7DHbYGMEkOL9st9qSeI2JdSKrFNJQDK CAh9NO41GQL6N9e9SBbOPX7lOiHipHG6tzhWE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rQTutOmQxstlBcZ/eHEUD1/YTlZa+levESqRS+crZdg=; b=de2MUOdp4tt8z2U8N1KmpTe1eZKEolr0SB3RXu0rtqopb+4tUtFwwuHI70r+JUfsg9 FIAtrMwf8mnSDZPW9oJ8NpoKWC2pm8rNgk7/HtD6/9K/j7a84SQA9jgSQb0tEHY8IDGe udz51JWHdjQe4tfVcDIw+iJeA/8iKfARw6kQ/Diw0NV5e5/nKn0JTazVtwHtkJviBJuh i9gquNmT5q9TeEFW0sfmb/1uRGJpsovvEE2BhLqPYqiJy85ZRrbDYlJPzuqUPT2dGUOq T9AuYKBB5L8AuWWnBmI08e8E3fmqlvLuPSj2we5iPCJh+vkU01mhoFB1yqEJRbt++nTj sDhA== X-Gm-Message-State: AOAM530jCM2qi81M9ylVdcQCp5S/dGQF1XAxjZ8RSvV6z4zbw7Nyzb5/ vLy11Aq/eg2r/emHpfSQ9yi1lX1hk943weaF X-Google-Smtp-Source: ABdhPJxfNtgjVKgIgEQVyZKR2FIAYtL0BZElidvxLkGGJi4YbyVo7dyjZkR8MZsr4gOP7GLlZVGMSg== X-Received: by 2002:a92:d3c6:: with SMTP id c6mr25390283ilh.7.1608736315568; Wed, 23 Dec 2020 07:11:55 -0800 (PST) Received: from localhost.localdomain (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id c15sm16935667ils.87.2020.12.23.07.11.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Dec 2020 07:11:55 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Bin Meng Subject: [PATCH v2 15/21] x86: Move call64 into its own section Date: Wed, 23 Dec 2020 08:11:27 -0700 Message-Id: <20201223151133.2205985-8-sjg@chromium.org> X-Mailer: git-send-email 2.29.2.729.g45daf8777d-goog In-Reply-To: <20201223151133.2205985-1-sjg@chromium.org> References: <20201223151133.2205985-1-sjg@chromium.org> MIME-Version: 1.0 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.102.3 at phobos.denx.de X-Virus-Status: Clean When this code is not used (e.g. by TPL) we want it to be excluded from the image. Put it in its own section so that this happens. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- (no changes since v1) arch/x86/cpu/i386/call64.S | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/cpu/i386/call64.S b/arch/x86/cpu/i386/call64.S index 275063c4af8..0ffc1006bbf 100644 --- a/arch/x86/cpu/i386/call64.S +++ b/arch/x86/cpu/i386/call64.S @@ -11,6 +11,7 @@ #include .code32 +.section .text_call64 .globl cpu_call64 cpu_call64: /* From patchwork Wed Dec 23 15:11:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1420192 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=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=FC0CxkXl; dkim-atps=neutral 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 4D1GwN28jnz9sTX for ; Thu, 24 Dec 2020 02:15:00 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D587982B52; Wed, 23 Dec 2020 16:12:52 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="FC0CxkXl"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DE818827EA; Wed, 23 Dec 2020 16:12:11 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd31.google.com (mail-io1-xd31.google.com [IPv6:2607:f8b0:4864:20::d31]) (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 E0E0282B1A for ; Wed, 23 Dec 2020 16:11:57 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd31.google.com with SMTP id d9so15349860iob.6 for ; Wed, 23 Dec 2020 07:11:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/DNJOZsE30A6FoO5C73Z/+216f4BXm7nrztLM/rjNTY=; b=FC0CxkXlolwoLjPN03rzc9EkaJkv9F2OnSHv8KNIa7xmvU1DCownfMlxrw7tmXD/1R YVUxJIP3/dXr9uuDltpzCKPFmDah7H3P1jz2P3ZR9kgBCm0bZH7/uOSiYv5TatYErV70 P7RZV3dbXA/eTtSOKq33LKmpVsYGwm3BIhNdA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/DNJOZsE30A6FoO5C73Z/+216f4BXm7nrztLM/rjNTY=; b=hMqGqT+k0USps5Ho21x/r1BSajaJEhokTrQ3ZCB0CioqEUbZStKa/JFkLCBSsd3IaK I7fF00ySBteXXXeCcL/oBwFz/z5aWTw1Yuas0sB9CbD8a6DJU6dBTOjY1hoWKm9kCs6z cK5hVHWOB7heRUTe/MZFDw5HvXwURats1HsJ+su+7muyS6s1W3oVu+HCGl642V4tn/oV SgiNCA8HpWwi9f9ui0Z5EaMAbHCcR+uDJ8RKlPPruTDq3UKN8VuGvH3du5SE6c4tSweO DorqJzdQuQl7xKe0FTTLazKOc8IzkHIZOcQK/3btwT3RS6GD9Ze/aic9M2PanR1LVghG RGdg== X-Gm-Message-State: AOAM533OJ5Ci/pgcJL0uvKOnXyoGbyE4EXJEqpHS0RIis2jPWxjusMXx /WqrqQeMI0pMFJXb6bfSK6xgKvxk4WdXK6nH X-Google-Smtp-Source: ABdhPJwvaR1/E1kd1Gf2q2V9ABaHaKM+OVcFfIKWK6Ot5Dq04EXKAoki5d6BN0nmtk1CAQJGtEKvDQ== X-Received: by 2002:a6b:6b18:: with SMTP id g24mr22004443ioc.189.1608736316533; Wed, 23 Dec 2020 07:11:56 -0800 (PST) Received: from localhost.localdomain (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id c15sm16935667ils.87.2020.12.23.07.11.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Dec 2020 07:11:55 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Bin Meng Subject: [PATCH v2 16/21] x86: coral: Move fsp-m settings to a subnode Date: Wed, 23 Dec 2020 08:11:28 -0700 Message-Id: <20201223151133.2205985-9-sjg@chromium.org> X-Mailer: git-send-email 2.29.2.729.g45daf8777d-goog In-Reply-To: <20201223151133.2205985-1-sjg@chromium.org> References: <20201223151133.2205985-1-sjg@chromium.org> MIME-Version: 1.0 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.102.3 at phobos.denx.de X-Virus-Status: Clean At present these settings are in the node for host-bridge and so are visible in TPL as well as SPL. But they are only used for SPL. Move them to a subnode so that TPL does not included them. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- (no changes since v1) arch/x86/cpu/apollolake/fsp_m.c | 5 ++++- arch/x86/dts/chromebook_coral.dts | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/arch/x86/cpu/apollolake/fsp_m.c b/arch/x86/cpu/apollolake/fsp_m.c index cef937573b0..c6be707e4ea 100644 --- a/arch/x86/cpu/apollolake/fsp_m.c +++ b/arch/x86/cpu/apollolake/fsp_m.c @@ -32,7 +32,10 @@ int fspm_update_config(struct udevice *dev, struct fspm_upd *upd) node = dev_ofnode(dev); if (!ofnode_valid(node)) - return log_msg_ret("fsp-m settings", -ENOENT); + return log_msg_ret("node", -ENOENT); + node = ofnode_find_subnode(node, "fsp-m"); + if (!ofnode_valid(node)) + return log_msg_ret("fspm", -ENOENT); ret = fsp_m_update_config_from_dtb(node, cfg); if (ret) diff --git a/arch/x86/dts/chromebook_coral.dts b/arch/x86/dts/chromebook_coral.dts index d66e128ae62..3c8fdf23809 100644 --- a/arch/x86/dts/chromebook_coral.dts +++ b/arch/x86/dts/chromebook_coral.dts @@ -174,6 +174,9 @@ */ fsp_s: fsp-s { }; + fsp_m: fsp-m { + u-boot,dm-spl; + }; nhlt { intel,dmic-channels = <4>; @@ -650,7 +653,9 @@ PAD_CFG_NF(LPC_CLKRUNB, UP_20K, DEEP, NF1) /* LPC_CLKRUN_N */ PAD_CFG_NF(LPC_FRAMEB, NATIVE, DEEP, NF1) /* LPC_FRAME_N */ >; +}; +&fsp_m { fspm,package = ; fspm,profile = ; fspm,memory-down = ; From patchwork Wed Dec 23 15:11:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1420191 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=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=aR4x22f+; dkim-atps=neutral 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 4D1GwJ4QDhz9sTX for ; Thu, 24 Dec 2020 02:14:56 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 22EA782B4B; Wed, 23 Dec 2020 16:12:51 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="aR4x22f+"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2CB9A82AD9; Wed, 23 Dec 2020 16:12:11 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x131.google.com (mail-il1-x131.google.com [IPv6:2607:f8b0:4864:20::131]) (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 ACD98827C5 for ; Wed, 23 Dec 2020 16:11:58 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x131.google.com with SMTP id v3so15331478ilo.5 for ; Wed, 23 Dec 2020 07:11:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XGBD0A9Vw+OEhMVX3qwHcbN9sHIujRcPo+GfNwUlOYg=; b=aR4x22f+mRJmR6BqsUlA3Kd6o7btZNhwHf3bXlpJojWuw7S0D1vkZlYk7Ubk6EB+AM VluDw44FMdqpPjTRja0Zzn/dlJ2gvS6JmFg5pCtCXM1P5MvwdQAO9pf8vXRb5+lgBlub oFNoidqpy5SaVoHI+6BwH+VC9043OY70B/kmk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XGBD0A9Vw+OEhMVX3qwHcbN9sHIujRcPo+GfNwUlOYg=; b=cBVoVngChzN8XnJExpMrD3SCf3luCPlgosEsTblS/TynBhDYK8M28hQQk5b6S9/ubS 9u0j3pD6PpOoWZ9iTb9hBk8U3tbU2KW+c36+LX1QooAzaacoOLAIYoMCRi0hwVumNiqs EVSRAYJZQQEN9epV8jYCODwlJ7aBUbpwIodzsBRPNNmkvwn/TuED8HitGLXPXJpn/u7F DJya3XZ8HrZ2pDry+/8Jg44VhfvX7hQOmUKPvMoVR83rLAp9SOOz9wKGD8+Y25q1i/FY 4NLUukYqsQrkScIGsm7ReHYiU2+uVMv5jgAJn3HOE2Z6sMDGuh7yvpjWw3ADSWOu4nPc MUsg== X-Gm-Message-State: AOAM533nj1Gr77RXsOmKjJ8YiMzRkjg51fnxn/bm6fvR3yL/8GKpK1A9 5OnMjRC5xJ3Dn57+LjQ1r9XC/Aw6XLKHy1oo X-Google-Smtp-Source: ABdhPJy3+gZhU0pwbTC7SBFJpdjkCnLwxxNDnjB4CFaE9sjFXy5u/6JEApWCmJP7kT1ioL27Ea+uCw== X-Received: by 2002:a05:6e02:f0f:: with SMTP id x15mr25376208ilj.12.1608736317350; Wed, 23 Dec 2020 07:11:57 -0800 (PST) Received: from localhost.localdomain (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id c15sm16935667ils.87.2020.12.23.07.11.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Dec 2020 07:11:56 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Bin Meng Subject: [PATCH v2 17/21] x86: apl: Update hostbridge to remove unwanted TPL code Date: Wed, 23 Dec 2020 08:11:29 -0700 Message-Id: <20201223151133.2205985-10-sjg@chromium.org> X-Mailer: git-send-email 2.29.2.729.g45daf8777d-goog In-Reply-To: <20201223151133.2205985-1-sjg@chromium.org> References: <20201223151133.2205985-1-sjg@chromium.org> MIME-Version: 1.0 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.102.3 at phobos.denx.de X-Virus-Status: Clean At present several strings from this file appear in the TPL binary. Add preprocessor checks to drop them. This reduces the TPL binary size by about 128 bytes. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- (no changes since v1) arch/x86/cpu/apollolake/hostbridge.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/arch/x86/cpu/apollolake/hostbridge.c b/arch/x86/cpu/apollolake/hostbridge.c index e4674f3788a..9ec2309d086 100644 --- a/arch/x86/cpu/apollolake/hostbridge.c +++ b/arch/x86/cpu/apollolake/hostbridge.c @@ -60,6 +60,7 @@ struct apl_hostbridge_plat { pci_dev_t bdf; }; +#if CONFIG_IS_ENABLED(GENERATE_ACPI_TABLE) static const struct nhlt_format_config dmic_1ch_formats[] = { /* 48 KHz 16-bits per sample. */ { @@ -155,6 +156,7 @@ static const struct nhlt_endp_descriptor dmic_4ch_descriptors[] = { .num_formats = ARRAY_SIZE(dmic_4ch_formats), }, }; +#endif static int apl_hostbridge_early_init_pinctrl(struct udevice *dev) { @@ -283,7 +285,7 @@ static int apl_acpi_hb_get_name(const struct udevice *dev, char *out_name) return acpi_copy_name(out_name, "RHUB"); } -#ifdef CONFIG_GENERATE_ACPI_TABLE +#if CONFIG_IS_ENABLED(GENERATE_ACPI_TABLE) static int apl_acpi_hb_write_tables(const struct udevice *dev, struct acpi_ctx *ctx) { @@ -322,7 +324,6 @@ static int apl_acpi_hb_write_tables(const struct udevice *dev, return 0; } -#endif static int apl_acpi_setup_nhlt(const struct udevice *dev, struct acpi_ctx *ctx) { @@ -347,6 +348,7 @@ static int apl_acpi_setup_nhlt(const struct udevice *dev, struct acpi_ctx *ctx) return log_msg_ret("channels", -EINVAL); } +#endif static int apl_hostbridge_remove(struct udevice *dev) { @@ -385,21 +387,23 @@ ulong sa_get_tseg_base(struct udevice *dev) struct acpi_ops apl_hostbridge_acpi_ops = { .get_name = apl_acpi_hb_get_name, -#ifdef CONFIG_GENERATE_ACPI_TABLE +#if CONFIG_IS_ENABLED(GENERATE_ACPI_TABLE) .write_tables = apl_acpi_hb_write_tables, -#endif .setup_nhlt = apl_acpi_setup_nhlt, +#endif }; +#if !CONFIG_IS_ENABLED(OF_PLATDATA) static const struct udevice_id apl_hostbridge_ids[] = { { .compatible = "intel,apl-hostbridge" }, { } }; +#endif U_BOOT_DRIVER(intel_apl_hostbridge) = { .name = "intel_apl_hostbridge", .id = UCLASS_NORTHBRIDGE, - .of_match = apl_hostbridge_ids, + .of_match = of_match_ptr(apl_hostbridge_ids), .of_to_plat = apl_hostbridge_of_to_plat, .probe = apl_hostbridge_probe, .remove = apl_hostbridge_remove, From patchwork Wed Dec 23 15:11:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1420196 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=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=cQm3irqO; dkim-atps=neutral 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 4D1GxH0Dj9z9sTX for ; Thu, 24 Dec 2020 02:15:46 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5557082B65; Wed, 23 Dec 2020 16:13:04 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="cQm3irqO"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 18AC082AD9; Wed, 23 Dec 2020 16:12:14 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x133.google.com (mail-il1-x133.google.com [IPv6:2607:f8b0:4864:20::133]) (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 C42BB82B1E for ; Wed, 23 Dec 2020 16:11:59 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x133.google.com with SMTP id k8so15319810ilr.4 for ; Wed, 23 Dec 2020 07:11:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=tNDJ7LKPk3MyrqAOmEsw0jmpSLsJ8PmT0hFcQHs8OcQ=; b=cQm3irqO4UwG55tyDMODnHqV9l5z0KFPsAveq+CCbLw7YPBDhg+xrDDkEip7GHAG/J HUERZ5Ck9CwrM93Y2vqFs0Ht0Q6UElZPYymI56+EE5kvL0i6yi3cSz36e4nSvgkgATtA RUjqCh/M8+tInEL8op3b1/YenPAh+D/FSaFXE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tNDJ7LKPk3MyrqAOmEsw0jmpSLsJ8PmT0hFcQHs8OcQ=; b=B0CedQJC8SLje24frwh6+8/mxN23MFaBBaD1GwjOgLiUdI8rg+rT4KFkXPAD3sJj4D X8YGInYu/l6U+jgZM4T78y6QRq3nUvW7eGYFJpdpSvTxIsP2K2KdO1lfPckKm0pJyBFn 6xgWP862TZZmA8VPGZSJgCWSvueTezOhyfosHj+FzP5BC0+W5zMr1RAnSGirfPUdx89N eYdMRB//ZsFuoz2UAHuHF0kAYNpnFk+k3ELKTlWehRoEeuwBzwcOXrO+FAv1SPoz+//y MYOnmLWGG4WBXsR4TdsayKjszBanTuaDWPJg6bRia6EU8H2A6oFpB/1RYJIuG5V5sNnn 0HVg== X-Gm-Message-State: AOAM533SJ72+gn2gI64HVbNxo/g1qwwZLJzGbjz6x+a8btHXKRVreBPX 4PgHuHOla6jiSDZr+o7Kap9mQ25cEXrCMWtk X-Google-Smtp-Source: ABdhPJzO3euF0wN2cEN4uDa2casRR/BLHZoWWRC1YHiuaEfyrunmT9X9SltQK90amO/sUybhUjRskw== X-Received: by 2002:a92:4409:: with SMTP id r9mr26289870ila.148.1608736318183; Wed, 23 Dec 2020 07:11:58 -0800 (PST) Received: from localhost.localdomain (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id c15sm16935667ils.87.2020.12.23.07.11.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Dec 2020 07:11:57 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Bin Meng Subject: [PATCH v2 18/21] x86: apl: Reduce size for TPL Date: Wed, 23 Dec 2020 08:11:30 -0700 Message-Id: <20201223151133.2205985-11-sjg@chromium.org> X-Mailer: git-send-email 2.29.2.729.g45daf8777d-goog In-Reply-To: <20201223151133.2205985-1-sjg@chromium.org> References: <20201223151133.2205985-1-sjg@chromium.org> MIME-Version: 1.0 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.102.3 at phobos.denx.de X-Virus-Status: Clean Update various drivers to use of_match_ptr() and to avoid including debug strings in TPL. Omit the WiFi driver entirely, since it is not used in TPL. This reduces the TPL binary size by about 608 bytes. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- (no changes since v1) arch/x86/cpu/apollolake/lpc.c | 13 ++++++++----- arch/x86/cpu/apollolake/pch.c | 4 +++- arch/x86/cpu/apollolake/pmc.c | 4 +++- arch/x86/cpu/apollolake/uart.c | 4 +++- arch/x86/cpu/intel_common/Makefile | 2 +- arch/x86/cpu/intel_common/itss.c | 4 +++- arch/x86/cpu/intel_common/p2sb.c | 4 +++- arch/x86/cpu/turbo.c | 5 +++++ board/google/chromebook_coral/coral.c | 4 +++- drivers/gpio/intel_gpio.c | 4 +++- drivers/pinctrl/intel/pinctrl_apl.c | 4 +++- drivers/power/acpi_pmc/acpi-pmc-uclass.c | 4 +++- drivers/timer/tsc_timer.c | 4 +++- 13 files changed, 44 insertions(+), 16 deletions(-) diff --git a/arch/x86/cpu/apollolake/lpc.c b/arch/x86/cpu/apollolake/lpc.c index d8e05f6a8f4..e085890d638 100644 --- a/arch/x86/cpu/apollolake/lpc.c +++ b/arch/x86/cpu/apollolake/lpc.c @@ -81,10 +81,11 @@ int lpc_open_pmio_window(uint base, uint size) lgir_reg_num = find_unused_pmio_window(); if (lgir_reg_num < 0) { - log_err("LPC: Cannot open IO window: %lx size %lx\n", - bridge_base, size - bridged_size); - log_err("No more IO windows\n"); - + if (spl_phase() > PHASE_TPL) { + log_err("LPC: Cannot open IO window: %lx size %lx\n", + bridge_base, size - bridged_size); + log_err("No more IO windows\n"); + } return -ENOSPC; } lgir_reg_offset = LPC_GENERIC_IO_RANGE(lgir_reg_num); @@ -127,15 +128,17 @@ struct acpi_ops apl_lpc_acpi_ops = { .inject_dsdt = southbridge_inject_dsdt, }; +#if !CONFIG_IS_ENABLED(OF_PLATDATA) static const struct udevice_id apl_lpc_ids[] = { { .compatible = "intel,apl-lpc" }, { } }; +#endif /* All pads are LPC already configured by the hostbridge, so no probing here */ U_BOOT_DRIVER(intel_apl_lpc) = { .name = "intel_apl_lpc", .id = UCLASS_LPC, - .of_match = apl_lpc_ids, + .of_match = of_match_ptr(apl_lpc_ids), ACPI_OPS_PTR(&apl_lpc_acpi_ops) }; diff --git a/arch/x86/cpu/apollolake/pch.c b/arch/x86/cpu/apollolake/pch.c index d9832ff2496..39d6ad5ed49 100644 --- a/arch/x86/cpu/apollolake/pch.c +++ b/arch/x86/cpu/apollolake/pch.c @@ -23,14 +23,16 @@ static const struct pch_ops apl_pch_ops = { .set_spi_protect = apl_set_spi_protect, }; +#if !CONFIG_IS_ENABLED(OF_PLATDATA) static const struct udevice_id apl_pch_ids[] = { { .compatible = "intel,apl-pch" }, { } }; +#endif U_BOOT_DRIVER(intel_apl_pch) = { .name = "intel_apl_pch", .id = UCLASS_PCH, - .of_match = apl_pch_ids, + .of_match = of_match_ptr(apl_pch_ids), .ops = &apl_pch_ops, }; diff --git a/arch/x86/cpu/apollolake/pmc.c b/arch/x86/cpu/apollolake/pmc.c index c40065ab8cf..e033baf1205 100644 --- a/arch/x86/cpu/apollolake/pmc.c +++ b/arch/x86/cpu/apollolake/pmc.c @@ -212,15 +212,17 @@ static const struct acpi_pmc_ops apl_pmc_ops = { .global_reset_set_enable = apl_global_reset_set_enable, }; +#if !CONFIG_IS_ENABLED(OF_PLATDATA) static const struct udevice_id apl_pmc_ids[] = { { .compatible = "intel,apl-pmc" }, { } }; +#endif U_BOOT_DRIVER(intel_apl_pmc) = { .name = "intel_apl_pmc", .id = UCLASS_ACPI_PMC, - .of_match = apl_pmc_ids, + .of_match = of_match_ptr(apl_pmc_ids), .of_to_plat = apl_pmc_ofdata_to_uc_plat, .probe = apl_pmc_probe, .ops = &apl_pmc_ops, diff --git a/arch/x86/cpu/apollolake/uart.c b/arch/x86/cpu/apollolake/uart.c index e523d85b1b4..69e5899235b 100644 --- a/arch/x86/cpu/apollolake/uart.c +++ b/arch/x86/cpu/apollolake/uart.c @@ -118,15 +118,17 @@ static int apl_ns16550_of_to_plat(struct udevice *dev) return 0; } +#if !CONFIG_IS_ENABLED(OF_PLATDATA) static const struct udevice_id apl_ns16550_serial_ids[] = { { .compatible = "intel,apl-ns16550" }, { }, }; +#endif U_BOOT_DRIVER(intel_apl_ns16550) = { .name = "intel_apl_ns16550", .id = UCLASS_SERIAL, - .of_match = apl_ns16550_serial_ids, + .of_match = of_match_ptr(apl_ns16550_serial_ids), .plat_auto = sizeof(struct ns16550_plat), .priv_auto = sizeof(struct ns16550), .ops = &ns16550_serial_ops, diff --git a/arch/x86/cpu/intel_common/Makefile b/arch/x86/cpu/intel_common/Makefile index 4a5cf17e41d..8b9a810f66d 100644 --- a/arch/x86/cpu/intel_common/Makefile +++ b/arch/x86/cpu/intel_common/Makefile @@ -26,7 +26,7 @@ obj-y += cpu.o obj-y += fast_spi.o obj-y += lpc.o obj-y += lpss.o -obj-$(CONFIG_INTEL_GENERIC_WIFI) += generic_wifi.o +obj-$(CONFIG_$(SPL_)INTEL_GENERIC_WIFI) += generic_wifi.o ifndef CONFIG_TARGET_EFI_APP obj-$(CONFIG_$(SPL_TPL_)X86_32BIT_INIT) += microcode.o ifndef CONFIG_$(SPL_)X86_64 diff --git a/arch/x86/cpu/intel_common/itss.c b/arch/x86/cpu/intel_common/itss.c index e71ea029e51..6515d1f471f 100644 --- a/arch/x86/cpu/intel_common/itss.c +++ b/arch/x86/cpu/intel_common/itss.c @@ -230,15 +230,17 @@ static const struct irq_ops itss_ops = { #endif }; +#if !CONFIG_IS_ENABLED(OF_PLATDATA) static const struct udevice_id itss_ids[] = { { .compatible = "intel,itss", .data = X86_IRQT_ITSS }, { } }; +#endif U_BOOT_DRIVER(intel_itss) = { .name = "intel_itss", .id = UCLASS_IRQ, - .of_match = itss_ids, + .of_match = of_match_ptr(itss_ids), .ops = &itss_ops, .bind = itss_bind, .of_to_plat = itss_of_to_plat, diff --git a/arch/x86/cpu/intel_common/p2sb.c b/arch/x86/cpu/intel_common/p2sb.c index 3765eeeab0d..cb901f265e2 100644 --- a/arch/x86/cpu/intel_common/p2sb.c +++ b/arch/x86/cpu/intel_common/p2sb.c @@ -184,15 +184,17 @@ static const struct p2sb_ops p2sb_ops = { .set_hide = intel_p2sb_set_hide, }; +#if !CONFIG_IS_ENABLED(OF_PLATDATA) static const struct udevice_id p2sb_ids[] = { { .compatible = "intel,p2sb" }, { } }; +#endif U_BOOT_DRIVER(intel_p2sb) = { .name = "intel_p2sb", .id = UCLASS_P2SB, - .of_match = p2sb_ids, + .of_match = of_match_ptr(p2sb_ids), .probe = p2sb_probe, .remove = p2sb_remove, .ops = &p2sb_ops, diff --git a/arch/x86/cpu/turbo.c b/arch/x86/cpu/turbo.c index f8d85d5a339..4a73cb240da 100644 --- a/arch/x86/cpu/turbo.c +++ b/arch/x86/cpu/turbo.c @@ -35,12 +35,15 @@ static inline void set_global_turbo_state(int state) } #endif +/* gcc 7.3 does not wwant to drop strings, so use #ifdef */ +#ifndef CONFIG_TPL_BUILD static const char *const turbo_state_desc[] = { [TURBO_UNKNOWN] = "unknown", [TURBO_UNAVAILABLE] = "unavailable", [TURBO_DISABLED] = "available but hidden", [TURBO_ENABLED] = "available and visible" }; +#endif /* * Determine the current state of Turbo and cache it for later. @@ -76,7 +79,9 @@ int turbo_get_state(void) } set_global_turbo_state(turbo_state); +#ifndef CONFIG_TPL_BUILD debug("Turbo is %s\n", turbo_state_desc[turbo_state]); +#endif return turbo_state; } diff --git a/board/google/chromebook_coral/coral.c b/board/google/chromebook_coral/coral.c index b8b923c139e..34b2c2ac5d5 100644 --- a/board/google/chromebook_coral/coral.c +++ b/board/google/chromebook_coral/coral.c @@ -143,14 +143,16 @@ struct acpi_ops coral_acpi_ops = { .inject_dsdt = chromeos_acpi_gpio_generate, }; +#if !CONFIG_IS_ENABLED(OF_PLATDATA) static const struct udevice_id coral_ids[] = { { .compatible = "google,coral" }, { } }; +#endif U_BOOT_DRIVER(coral_drv) = { .name = "coral", .id = UCLASS_SYSINFO, - .of_match = coral_ids, + .of_match = of_match_ptr(coral_ids), ACPI_OPS_PTR(&coral_acpi_ops) }; diff --git a/drivers/gpio/intel_gpio.c b/drivers/gpio/intel_gpio.c index 41540d8ebc6..eda95485c93 100644 --- a/drivers/gpio/intel_gpio.c +++ b/drivers/gpio/intel_gpio.c @@ -188,15 +188,17 @@ static const struct dm_gpio_ops gpio_intel_ops = { #endif }; +#if !CONFIG_IS_ENABLED(OF_PLATDATA) static const struct udevice_id intel_intel_gpio_ids[] = { { .compatible = "intel,gpio" }, { } }; +#endif U_BOOT_DRIVER(intel_gpio) = { .name = "intel_gpio", .id = UCLASS_GPIO, - .of_match = intel_intel_gpio_ids, + .of_match = of_match_ptr(intel_intel_gpio_ids), .ops = &gpio_intel_ops, .of_to_plat = intel_gpio_of_to_plat, .probe = intel_gpio_probe, diff --git a/drivers/pinctrl/intel/pinctrl_apl.c b/drivers/pinctrl/intel/pinctrl_apl.c index 2bb654c8a18..b512a85f3e6 100644 --- a/drivers/pinctrl/intel/pinctrl_apl.c +++ b/drivers/pinctrl/intel/pinctrl_apl.c @@ -167,15 +167,17 @@ static int apl_pinctrl_of_to_plat(struct udevice *dev) return intel_pinctrl_of_to_plat(dev, comm, 2); } +#if !CONFIG_IS_ENABLED(OF_PLATDATA) static const struct udevice_id apl_gpio_ids[] = { { .compatible = "intel,apl-pinctrl"}, { } }; +#endif U_BOOT_DRIVER(intel_apl_pinctrl) = { .name = "intel_apl_pinctrl", .id = UCLASS_PINCTRL, - .of_match = apl_gpio_ids, + .of_match = of_match_ptr(apl_gpio_ids), .probe = intel_pinctrl_probe, .ops = &intel_pinctrl_ops, #if !CONFIG_IS_ENABLED(OF_PLATDATA) diff --git a/drivers/power/acpi_pmc/acpi-pmc-uclass.c b/drivers/power/acpi_pmc/acpi-pmc-uclass.c index 32a2836f0bf..34446a34e60 100644 --- a/drivers/power/acpi_pmc/acpi-pmc-uclass.c +++ b/drivers/power/acpi_pmc/acpi-pmc-uclass.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #ifdef CONFIG_X86 #include @@ -60,7 +61,8 @@ int pmc_gpe_init(struct udevice *dev) * are different and if they aren't, use the reset values. */ if (dw[0] == dw[1] || dw[1] == dw[2]) { - log_info("PMC: Using default GPE route"); + if (spl_phase() > PHASE_TPL) + log_info("PMC: Using default GPE route"); gpio_cfg = readl(upriv->gpe_cfg); for (i = 0; i < upriv->gpe0_count; i++) dw[i] = gpio_cfg >> gpe0_shift(upriv, i); diff --git a/drivers/timer/tsc_timer.c b/drivers/timer/tsc_timer.c index e3677704b33..706d52b830a 100644 --- a/drivers/timer/tsc_timer.c +++ b/drivers/timer/tsc_timer.c @@ -477,15 +477,17 @@ static const struct timer_ops tsc_timer_ops = { .get_count = tsc_timer_get_count, }; +#if !CONFIG_IS_ENABLED(OF_PLATDATA) static const struct udevice_id tsc_timer_ids[] = { { .compatible = "x86,tsc-timer", }, { } }; +#endif U_BOOT_DRIVER(x86_tsc_timer) = { .name = "x86_tsc_timer", .id = UCLASS_TIMER, - .of_match = tsc_timer_ids, + .of_match = of_match_ptr(tsc_timer_ids), .probe = tsc_timer_probe, .ops = &tsc_timer_ops, }; From patchwork Wed Dec 23 15:11:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1420193 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=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=L473Pvpj; dkim-atps=neutral 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 4D1Gwc0FN6z9sTX for ; Thu, 24 Dec 2020 02:15:11 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3A32682B4A; Wed, 23 Dec 2020 16:12:54 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="L473Pvpj"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 94451827EA; Wed, 23 Dec 2020 16:12:12 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x12e.google.com (mail-il1-x12e.google.com [IPv6:2607:f8b0:4864:20::12e]) (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 942DE82A36 for ; Wed, 23 Dec 2020 16:12:00 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x12e.google.com with SMTP id g1so15324336ilk.7 for ; Wed, 23 Dec 2020 07:12:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=AQHBECC7Lq65bPfHXOC21szweQ4O7SkqROut5a05C2k=; b=L473PvpjWE+wtnRlA0jI9Dpvsh7j5V/43BR9hHdB/0FL7gTaNRJMGWYdaYK31X9nRw X+RydvcQewnPYlxA+lRScITJcDnoJ9LG63CGhC1tjBNKMTFb0okbICk/Ycn1vwFmDfhM uz4E/vQAnGDBIcoDshWoauIcV9BwV5ZNvlNMI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=AQHBECC7Lq65bPfHXOC21szweQ4O7SkqROut5a05C2k=; b=mEeqXQ7dvImGZ4nRG0dgJzgufdsNj6nINs0lYUFIMNdpYlR4vMF06RmIgX1yKoizkI eD6IWm+zv+PZo0AbdXkB97TlqDZmysmgGri047Dx/18QLoYtjN/DKKJN3DgDIF0IxzYm HgYEad5XAdBbGp7Kzyik0Iak8v8kQglzEjyDjEgiajLzvnuvtSYoy0NeWFYeA61+4Ofj efRIWwB4GUdYSgGI1dH6jua0y622bTd/7j5wSyj+iC8rMINHYWAzTV9OAM7xegiZcfXP pV5L9Yabc+iAcvChzTGlNLTovV8lLxkB5H8LPlHXx7fHlx4+Om3XmWfTSgODvZdokKdL ntVw== X-Gm-Message-State: AOAM530fDcOhvr1vYd0G7xr0DElh2wsV1FNcPxX2yz0rYHVPdGbkxx4e 8q3i8SZEK+BW4QAXwqNeRv3BdVw2tLNnq7kT X-Google-Smtp-Source: ABdhPJyeE2HjicLXpDfE4kkiKOsgvAZRGojHNVpM7/SXTnW3E/G0Jkp7S/rrK5zyLK6qVCVnV9XlMg== X-Received: by 2002:a92:ca46:: with SMTP id q6mr25892755ilo.278.1608736319305; Wed, 23 Dec 2020 07:11:59 -0800 (PST) Received: from localhost.localdomain (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id c15sm16935667ils.87.2020.12.23.07.11.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Dec 2020 07:11:58 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Bin Meng Subject: [PATCH v2 19/21] x86: pinctrl: Drop unlikely error messages from TPL Date: Wed, 23 Dec 2020 08:11:31 -0700 Message-Id: <20201223151133.2205985-12-sjg@chromium.org> X-Mailer: git-send-email 2.29.2.729.g45daf8777d-goog In-Reply-To: <20201223151133.2205985-1-sjg@chromium.org> References: <20201223151133.2205985-1-sjg@chromium.org> MIME-Version: 1.0 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.102.3 at phobos.denx.de X-Virus-Status: Clean These errors are only really for development purposes. Drop them to reduce the size of TPL. The error numbers are still reported. This reduces the TPL binary size on coral by about 160 bytes. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- (no changes since v1) drivers/pinctrl/intel/pinctrl.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/pinctrl/intel/pinctrl.c b/drivers/pinctrl/intel/pinctrl.c index 9f96505dd5a..987a56b715e 100644 --- a/drivers/pinctrl/intel/pinctrl.c +++ b/drivers/pinctrl/intel/pinctrl.c @@ -274,7 +274,9 @@ static int pinctrl_configure_itss(struct udevice *dev, irq = pcr_read32(dev, PAD_CFG1_OFFSET(pad_cfg_offset)); irq &= PAD_CFG1_IRQ_MASK; if (!irq) { - log_err("GPIO %u doesn't support APIC routing\n", cfg->pad); + if (spl_phase() > PHASE_TPL) + log_err("GPIO %u doesn't support APIC routing\n", + cfg->pad); return -EPROTONOSUPPORT; } @@ -314,7 +316,8 @@ static int pinctrl_pad_reset_config_override(const struct pad_community *comm, return config_value; } } - log_err("Logical-to-Chipset mapping not found\n"); + if (spl_phase() > PHASE_TPL) + log_err("Logical-to-Chipset mapping not found\n"); return -ENOENT; } @@ -620,7 +623,9 @@ int intel_pinctrl_of_to_plat(struct udevice *dev, struct intel_pinctrl_priv *priv = dev_get_priv(dev); if (!comm) { - log_err("Cannot find community for pid %d\n", pplat->pid); + if (spl_phase() > PHASE_TPL) + log_err("Cannot find community for pid %d\n", + pplat->pid); return -EDOM; } priv->comm = comm; From patchwork Wed Dec 23 15:11:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1420197 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=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=O/xEAVDb; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (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 4D1GxV0pvJz9sTX for ; Thu, 24 Dec 2020 02:15:58 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id EBD4C82B6C; Wed, 23 Dec 2020 16:13:07 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="O/xEAVDb"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CF47182B27; Wed, 23 Dec 2020 16:12:14 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd2c.google.com (mail-io1-xd2c.google.com [IPv6:2607:f8b0:4864:20::d2c]) (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 ABE0282B19 for ; Wed, 23 Dec 2020 16:12:01 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd2c.google.com with SMTP id m23so15412430ioy.2 for ; Wed, 23 Dec 2020 07:12:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ake5NYKprgVirpsnkd8thd2nDrC5dYQ4hn2xK0OpbMo=; b=O/xEAVDbqOhlmDxK3gf+RvCMZOFdHmeAAlLem6L/ImH44nMnRXswYYPOXJuGNteZst 5KbyJXwl97hDDDDCxvBkWEC7XcXhCapr4bzqDeM7EpDepRNbfvI2xJk00F3CH0zOgLgL LXygXe+NDqAxtB7r+vywjmhfq20tzq5XtAEjk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ake5NYKprgVirpsnkd8thd2nDrC5dYQ4hn2xK0OpbMo=; b=BCiQOKdPROl7ATxr5iM65UKHmB0HiDCx3KDVOzcRZPBwZVPsTS46fNRr3N0xU1LRcT PmkHnKzjWX6m07x3oKs0XVq+zhGTUb43yvzrfgRA4qOO7dWfvG/9HGTcS+OVTi7Jwm62 L6g/eo2Sgbnfl1SA9dJoCAcA1i5m2iHeoU6QkdMcirzAeHcS19yBSAZoWnHHLZIoJp5C 8mVB4aoznFN3q4KMl3XydGVWU3DKtQSot9yUUaRfY1yhsalmJYN6Z528YRSQsZf5Labt XfTPoTmIavck34cSUFPBzNYv5ZfQroUr3nkgpGdCpouotIJvMob7ui+KWE4qfexq3dvK d9RQ== X-Gm-Message-State: AOAM531vDl+brgLwEbZiw47P23wboXX8xxS4Bas0tVdpTR2IUCry8Ymy gf9or3gU65W6HaDgGZ5xRPR+f9KpJAoAURzx X-Google-Smtp-Source: ABdhPJyF06e5anEBG3C4Xk/HUD2yYbss/WF+dDMo0ETEWTDDqQxpcW7xANtdicgXrP3S5VfD1TGJXA== X-Received: by 2002:a5e:a815:: with SMTP id c21mr21914694ioa.141.1608736320155; Wed, 23 Dec 2020 07:12:00 -0800 (PST) Received: from localhost.localdomain (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id c15sm16935667ils.87.2020.12.23.07.11.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Dec 2020 07:11:59 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Bin Meng Subject: [PATCH v2 20/21] x86: tpl: Remove unwanted devicetree string Date: Wed, 23 Dec 2020 08:11:32 -0700 Message-Id: <20201223151133.2205985-13-sjg@chromium.org> X-Mailer: git-send-email 2.29.2.729.g45daf8777d-goog In-Reply-To: <20201223151133.2205985-1-sjg@chromium.org> References: <20201223151133.2205985-1-sjg@chromium.org> MIME-Version: 1.0 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.102.3 at phobos.denx.de X-Virus-Status: Clean Update this driver to use of_match_ptr(). This reduces the TPL binary size by about 32 bytes. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- (no changes since v1) arch/x86/lib/tpl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/x86/lib/tpl.c b/arch/x86/lib/tpl.c index 15b0212d190..04ff32277fd 100644 --- a/arch/x86/lib/tpl.c +++ b/arch/x86/lib/tpl.c @@ -133,14 +133,16 @@ void spl_board_init(void) * for devices, so the TPL BARs continue to be used. Once U-Boot starts it does * the auto allocation (after relocation). */ +#if !CONFIG_IS_ENABLED(OF_PLATDATA) static const struct udevice_id tpl_fake_pci_ids[] = { { .compatible = "pci-x86" }, { } }; +#endif U_BOOT_DRIVER(pci_x86) = { .name = "pci_x86", .id = UCLASS_SIMPLE_BUS, - .of_match = tpl_fake_pci_ids, + .of_match = of_match_ptr(tpl_fake_pci_ids), }; #endif From patchwork Wed Dec 23 15:11:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1420194 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=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=ElWneyiv; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (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 4D1Gwq4G6cz9sTX for ; Thu, 24 Dec 2020 02:15:23 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1484782B58; Wed, 23 Dec 2020 16:12:57 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="ElWneyiv"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 957BB82B1E; Wed, 23 Dec 2020 16:12:14 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd34.google.com (mail-io1-xd34.google.com [IPv6:2607:f8b0:4864:20::d34]) (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 9960082B21 for ; Wed, 23 Dec 2020 16:12:02 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd34.google.com with SMTP id 81so15318062ioc.13 for ; Wed, 23 Dec 2020 07:12:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GiX5BS4Hca1qFRj8hF3xsD8ZYhh8qNwUmX+/eV4Cfg4=; b=ElWneyivWXm7+Gj8Mf/vbJswDMDGejyiocdR1kf7mnk7/dwJf5rqy/pwK+nagjtwgl 97OUCLfbTuEj7J/yzIQ/D1y5f9R7IoKkOWGycLUhNYNSdkPxczFTpqtt49Oui4sJfOs3 OkO2Dkp/lxC22mDaGVJVVKRo0wzVjGKPRG8gM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GiX5BS4Hca1qFRj8hF3xsD8ZYhh8qNwUmX+/eV4Cfg4=; b=e2FhhskwgqzvUmVn0cgTUJJ88ENv27L5ffXpCU3ILhfxrkDobEKLO8p64xB+Gc/0Aq 1YIITnHk+xZ8JmscAXnnhDgFPCK3U0X3Luyu2S6/i3VhH8Jzm++ppfgNe9JV8a6xBE8c bdRQcJxoaCvEdRFmuah5DCRxHV9K9Fy6yxbpnpSLcohniIGQUss1KLayEGaLs60+2Q1u Qw6OukGGTOFzKBasz+MioBja3LB7G/Hsd9XsH1tVHvt3zfgTnSQLvsoD/ej4EVJYDZrq V4wiVn+WUb7fTvl23ADqOMCF8pB6siPzP5NaSiK90WvjlbiJFZoRakilunRK4EpOS76O 6xPw== X-Gm-Message-State: AOAM530VHdnFxP5mehk9kopfLs3wh7jm+P++RJdV+Hyls9Lbly55MGLM Yw1oZbbBfs6V/H2IGnwfB3CBZYpHnIMUGi6D X-Google-Smtp-Source: ABdhPJwlZDrYRL50bdlS+gwZ5duxenf3G2lmXX3ygNiDlCdnOLTnFqxpjaFuxvTjnqGPST26vwk2vw== X-Received: by 2002:a5e:990c:: with SMTP id t12mr22309769ioj.33.1608736321070; Wed, 23 Dec 2020 07:12:01 -0800 (PST) Received: from localhost.localdomain (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id c15sm16935667ils.87.2020.12.23.07.12.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Dec 2020 07:12:00 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Bin Meng Subject: [PATCH v2 21/21] x86: Fix header guard in asm/pmu.h Date: Wed, 23 Dec 2020 08:11:33 -0700 Message-Id: <20201223151133.2205985-14-sjg@chromium.org> X-Mailer: git-send-email 2.29.2.729.g45daf8777d-goog In-Reply-To: <20201223151133.2205985-1-sjg@chromium.org> References: <20201223151133.2205985-1-sjg@chromium.org> MIME-Version: 1.0 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.102.3 at phobos.denx.de X-Virus-Status: Clean This has the wrong name. Fix it. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- (no changes since v1) arch/x86/include/asm/pmu.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/x86/include/asm/pmu.h b/arch/x86/include/asm/pmu.h index b76bdf64a30..818e80881ec 100644 --- a/arch/x86/include/asm/pmu.h +++ b/arch/x86/include/asm/pmu.h @@ -2,9 +2,9 @@ /* * Copyright (c) 2017 Intel Corporation */ -#ifndef _X86_ASM_PMU_IPC_H_ -#define _X86_ASM_PMU_IPC_H_ +#ifndef _X86_ASM_PMU_H_ +#define _X86_ASM_PMU_H_ int pmu_turn_power(unsigned int lss, bool on); -#endif /* _X86_ASM_PMU_IPC_H_ */ +#endif /* _X86_ASM_PMU_H_ */