From patchwork Tue Apr 20 08:42:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 1468249 X-Patchwork-Delegate: trini@ti.com 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; dkim=pass (2048-bit key; unprotected) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=PlqUPyTc; 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 4FPcdJ3jZDz9t1r for ; Tue, 20 Apr 2021 18:42:44 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 09335826BA; Tue, 20 Apr 2021 10:42:37 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="PlqUPyTc"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E41C982AFD; Tue, 20 Apr 2021 10:42:33 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) (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 123E7826BA for ; Tue, 20 Apr 2021 10:42:30 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=narmstrong@baylibre.com Received: by mail-wr1-x432.google.com with SMTP id h4so27680417wrt.12 for ; Tue, 20 Apr 2021 01:42:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=C6oUf7PH+EmQ3ijUIbGsEc2XUbOVSlE2ziIFpUqpLcM=; b=PlqUPyTc/J8sj18rMMmI9Dtz+2VXu6Z671byp/j4o18pQtWmWKHq+fLRZ/ebnXWVGJ hndlgM5dvCbli3wilLhNS6etFMjoHx084/3360YFVxfju5D6P+kc/pKSFq2JwXCqy5lR zsEc545tV/F0EjA3+ggxEr9VwSa5nA2+xT7ioq7wmuv6FTwJAUSAi7n8KPG/aezshwUp FV8Fsdss2hQaFzdtRmBCoW0DzrIgBrYkwDZQ0q9RdrqxqkzjCOPYA426YwYdQczUS6PS 3PGPMhhaB6SSHB3Pt8rL62dfN7s3+2a6mniaIS5wd7nPQdnhPFa9tXL9P4K3KQLaFi47 YcAA== 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=C6oUf7PH+EmQ3ijUIbGsEc2XUbOVSlE2ziIFpUqpLcM=; b=Xrc0r6mJgUWmDYtbd2ABo3HfohAny35Pjw0dWse+QzznfL/zLaA3H2oPpksWyof0uG reGPLXzh/2D+jTJccKDCTeslU0Lbo+GoOZGd+DDGmcx0qI6Ue/anINHuWmG4hU2k7yXY SvxkIDyApWI1rt2dVKZLOp1cr9QO5TUg9Ga9Kh9u9TcOovZhHW38U0EIq0YP0aGZIfAK p7nlomUmKTyrTBNRTGG3y1NA3cQRkhilGh2RQfO0QpnMZjwpJdzbh2dtu0x+GGr8HMxe bp1U1hv7vcpLRAnZVyzr1kZpNgdV6hHFWQ7x3HggUU9Dgid5RXx/mVJ2uiiC7uk36VpF KPSw== X-Gm-Message-State: AOAM533bbMGTcuymLXkmpTFBpjhpdxPx5Vx6kfEHNtz46o13lGFKMihN Gc+CuVF4xG3ZNMHgdtlTup4MCg== X-Google-Smtp-Source: ABdhPJxL9v5Lf8k53i16ao7CEVbHyorhwOQ3jwSouBsV+lwzyO01q/JXnfrVhbmMsHeLVKoE0gHYkg== X-Received: by 2002:adf:dc8d:: with SMTP id r13mr19195839wrj.339.1618908149576; Tue, 20 Apr 2021 01:42:29 -0700 (PDT) Received: from bojack.baylibre.local (laubervilliers-658-1-213-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.gmail.com with ESMTPSA id a2sm27440510wrt.82.2021.04.20.01.42.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Apr 2021 01:42:29 -0700 (PDT) From: Neil Armstrong To: sjg@chromium.org Cc: jagan@amarulasolutions.com, u-boot@lists.denx.de, trini@konsulko.com, u-boot-amlogic@groups.io, Neil Armstrong Subject: [PATCH 1/2] test: reset: Extend base reset test to catch error Date: Tue, 20 Apr 2021 10:42:25 +0200 Message-Id: <20210420084226.2996654-2-narmstrong@baylibre.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210420084226.2996654-1-narmstrong@baylibre.com> References: <20210420084226.2996654-1-narmstrong@baylibre.com> 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.4 at phobos.denx.de X-Virus-Status: Clean With this extended test, we get the following failure : => ut dm reset_base Test: dm_test_reset_base: reset.c test/dm/reset.c:52, dm_test_reset_base(): reset_method3.id == reset_method3_1.id: Expected 0x14 (20), got 0x2 (2) Test: dm_test_reset_base: reset.c (flat tree) test/dm/reset.c:52, dm_test_reset_base(): reset_method3.id == reset_method3_1.id: Expected 0x14 (20), got 0x2 (2) Failures: 2 A fix is needed in reset_get_by_index_nodev() when introduced in [1]. [1] ea9dc35aab ("reset: Get the RESET by index without device") Signed-off-by: Neil Armstrong --- arch/sandbox/dts/test.dts | 4 ++-- test/dm/reset.c | 39 ++++++++++++++++++++++++++++++++++----- 2 files changed, 36 insertions(+), 7 deletions(-) diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts index 48240aa26f..4fde923e9a 100644 --- a/arch/sandbox/dts/test.dts +++ b/arch/sandbox/dts/test.dts @@ -997,8 +997,8 @@ reset-ctl-test { compatible = "sandbox,reset-ctl-test"; - resets = <&resetc 100>, <&resetc 2>; - reset-names = "other", "test"; + resets = <&resetc 100>, <&resetc 2>, <&resetc 20>, <&resetc 40>; + reset-names = "other", "test", "test2", "test3"; }; rng { diff --git a/test/dm/reset.c b/test/dm/reset.c index fc8e9250b0..9c00452336 100644 --- a/test/dm/reset.c +++ b/test/dm/reset.c @@ -24,18 +24,47 @@ static int dm_test_reset_base(struct unit_test_state *uts) { struct udevice *dev; - struct reset_ctl reset_method1; - struct reset_ctl reset_method2; + struct reset_ctl reset_method1, reset_method1_1; + struct reset_ctl reset_method2, reset_method2_1; + struct reset_ctl reset_method3, reset_method3_1; + struct reset_ctl reset_method4, reset_method4_1; /* Get the device using the reset device */ ut_assertok(uclass_get_device_by_name(UCLASS_MISC, "reset-ctl-test", &dev)); /* Get the same reset port in 2 different ways and compare */ - ut_assertok(reset_get_by_index(dev, 1, &reset_method1)); + ut_assertok(reset_get_by_index(dev, 0, &reset_method1)); + ut_assertok(reset_get_by_index_nodev(dev_ofnode(dev), 0, + &reset_method1_1)); + ut_assertok(reset_get_by_index(dev, 1, &reset_method2)); ut_assertok(reset_get_by_index_nodev(dev_ofnode(dev), 1, - &reset_method2)); - ut_asserteq(reset_method1.id, reset_method2.id); + &reset_method2_1)); + ut_assertok(reset_get_by_index(dev, 2, &reset_method3)); + ut_assertok(reset_get_by_index_nodev(dev_ofnode(dev), 2, + &reset_method3_1)); + ut_assertok(reset_get_by_index(dev, 3, &reset_method4)); + ut_assertok(reset_get_by_index_nodev(dev_ofnode(dev), 3, + &reset_method4_1)); + + ut_asserteq(reset_method1.id, reset_method1_1.id); + ut_asserteq(reset_method2.id, reset_method2_1.id); + ut_asserteq(reset_method3.id, reset_method3_1.id); + ut_asserteq(reset_method4.id, reset_method4_1.id); + + ut_asserteq(true, reset_method1.id != reset_method2.id); + ut_asserteq(true, reset_method1.id != reset_method3.id); + ut_asserteq(true, reset_method1.id != reset_method4.id); + ut_asserteq(true, reset_method2.id != reset_method3.id); + ut_asserteq(true, reset_method2.id != reset_method4.id); + ut_asserteq(true, reset_method3.id != reset_method4.id); + + ut_asserteq(true, reset_method1_1.id != reset_method2_1.id); + ut_asserteq(true, reset_method1_1.id != reset_method3_1.id); + ut_asserteq(true, reset_method1_1.id != reset_method4_1.id); + ut_asserteq(true, reset_method2_1.id != reset_method3_1.id); + ut_asserteq(true, reset_method2_1.id != reset_method4_1.id); + ut_asserteq(true, reset_method3_1.id != reset_method4_1.id); return 0; } From patchwork Tue Apr 20 08:42:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 1468251 X-Patchwork-Delegate: trini@ti.com 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; dkim=pass (2048-bit key; unprotected) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=zSQrbK9M; 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 4FPcdn3CKXz9t1r for ; Tue, 20 Apr 2021 18:43:09 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C28A282B1C; Tue, 20 Apr 2021 10:42:54 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="zSQrbK9M"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3FF4082AFF; Tue, 20 Apr 2021 10:42:39 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) (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 39C9E82AD8 for ; Tue, 20 Apr 2021 10:42:31 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=narmstrong@baylibre.com Received: by mail-wm1-x32c.google.com with SMTP id w7-20020a1cdf070000b0290125f388fb34so19558041wmg.0 for ; Tue, 20 Apr 2021 01:42:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=IkaK9iisGAwcyQj55uc1H4g47vvqMB926glhDPyhSrw=; b=zSQrbK9MlynIW4rFCUzHzpjWUw0Ar6YBjtfLgwQDGFBrfnCTeAkbS58aYX9HVd986e UGdRKrxeuPLk5OA4s1OD/o/tVTV1F+VPur7IuGfx9NCZvf9gFHlucnpXUhsNTLxsmpFH fsuVqCqiA/+B80pmV1K4SuwsTF/pH+hoU89JccPdUqThH1fu+xdzeNLOeG9jfIvLPkP5 sNLa1faKaMpM2gdZgaHTcm0tL0St74/9IG/6vsWXdjZbw9KZXoMaa2y6vGb2DmWyhaAO n0G/gvD+TfyyAdjRmRqOOpyYVluFQPZmIbe0ZVI1CjuNOCPpZlPXqw1oYufuUGooNA4n usBg== 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=IkaK9iisGAwcyQj55uc1H4g47vvqMB926glhDPyhSrw=; b=nTyTha58SMv6g2sRXtwPNQK81zwzJLu0VLKcuBk2L3lbDjOEfAKVludS0TyGbwj420 70DCouIgXEfjnbDVISjL+BO3/hyOELi8CZsfiackyjM+9XcvAv8vhhstNVgIibDagoMN /KcetExekIuT+AqUQ87OdZ3xEMg9gZY+Tf9dM6tELLpLwSCuEk0UXtyFHFssHP+iWvZL zeRipAs0fAAfLPqSneJ/xW+w2E/WWyJfDmG4WIY1anaq6+4ANV4jKPQcGJ5+yKEAQjbU P2oZXcgqDlsz3LkORVkKpIg1wl+1jnnsLKXTyohqtujyqUGxgbeSt0kia9ZQZQe+xLgJ cxVQ== X-Gm-Message-State: AOAM530WnG5CO3ibYmyIN6Kh1fwcVogYqbLUs6/VNwnJsYcn8QWYjr8v sFrejOqn0BCh21j66BFoOw77ZQ== X-Google-Smtp-Source: ABdhPJyKifj8cIv5ukSPps1uf8mWG1JtIeqNczTxQ2AKIF89SMeWg3NYaVWjHo7jslnaPxIy6rhWNw== X-Received: by 2002:a05:600c:2dc8:: with SMTP id e8mr3218968wmh.10.1618908150704; Tue, 20 Apr 2021 01:42:30 -0700 (PDT) Received: from bojack.baylibre.local (laubervilliers-658-1-213-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.gmail.com with ESMTPSA id a2sm27440510wrt.82.2021.04.20.01.42.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Apr 2021 01:42:30 -0700 (PDT) From: Neil Armstrong To: sjg@chromium.org Cc: jagan@amarulasolutions.com, u-boot@lists.denx.de, trini@konsulko.com, u-boot-amlogic@groups.io, Neil Armstrong , B1oHazard Subject: [PATCH 2/2] reset: fix reset_get_by_index_nodev index handling Date: Tue, 20 Apr 2021 10:42:26 +0200 Message-Id: <20210420084226.2996654-3-narmstrong@baylibre.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210420084226.2996654-1-narmstrong@baylibre.com> References: <20210420084226.2996654-1-narmstrong@baylibre.com> 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.4 at phobos.denx.de X-Virus-Status: Clean This fixes an issue getting resets index 1 and 3+, the spurius "> 0" made it return the index 0 or 1, whatever index was passed. The dm_test_reset_base() did not catch it, but the dm_test_reset_base() extension catches it and this fixes the regression. This also fixes a reggression on Amlogic G12A/G12B SoCs, where HDMI output was disable even when Linux was booting. Fixes: ea9dc35aab ("reset: Get the RESET by index without device") Reported-by: B1oHazard Signed-off-by: Neil Armstrong --- drivers/reset/reset-uclass.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/reset/reset-uclass.c b/drivers/reset/reset-uclass.c index 071c389ca0..ac89eaf098 100644 --- a/drivers/reset/reset-uclass.c +++ b/drivers/reset/reset-uclass.c @@ -95,7 +95,7 @@ int reset_get_by_index_nodev(ofnode node, int index, int ret; ret = ofnode_parse_phandle_with_args(node, "resets", "#reset-cells", 0, - index > 0, &args); + index, &args); return reset_get_by_index_tail(ret, node, &args, "resets", index > 0, reset_ctl);