From patchwork Wed Nov 14 10:25:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 997607 X-Patchwork-Delegate: jagannadh.teki@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="CRuYidbp"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 42w0zF4wtjz9s3Z for ; Wed, 14 Nov 2018 21:26:49 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 55E9CC2209E; Wed, 14 Nov 2018 10:26:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_MSPIKE_H2, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 86425C22053; Wed, 14 Nov 2018 10:25:38 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 2E4DAC2205F; Wed, 14 Nov 2018 10:25:32 +0000 (UTC) Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by lists.denx.de (Postfix) with ESMTPS id 02024C2206D for ; Wed, 14 Nov 2018 10:25:29 +0000 (UTC) Received: by mail-wm1-f66.google.com with SMTP id f19-v6so13194531wmb.0 for ; Wed, 14 Nov 2018 02:25:29 -0800 (PST) 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=6U+yv7/TCP7HV4BqFnCuNLmguDxEePQnidbh43jyI3U=; b=CRuYidbppK3CPBMPDD57CPcM0kKljMgnH41GO3XOwQ9Xm0s144XVjSBjNV2nPvPTqt Brv3YOoWVDye6e98peJQeceTZSgxb+9QBqdqXxo9gyfzYM63lLl6qC7LNX8JxLaw9qX5 3HXVJNz0HBYQ3iPVroinUlpVTvLzvNlwzWQo8W+tC4Xt3IHqnY/cGFey7rDeKuuJkqQl C/zQiwHOF0V1EqQM/NqITSkYnM2eX+WvECIOM3PuJQrzeXia0NrbORaciXT/smyBlcKt p9i0uABnTVh1A9cHtF5Pi+CrXZIOrgkqgOb+Amzd2NamPBYOU94vfJ3XMDqphi/iOclx L7aA== 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=6U+yv7/TCP7HV4BqFnCuNLmguDxEePQnidbh43jyI3U=; b=QhqCtZz2aszyIbyEYSkB/PK5BIQnCqroRiMFW3qNtaG7q73GFk4758s2GeLDsFBJ5A 3O4r41EG3OsGd86PRwyOiZrGBDQfv5ijrJNwuvmPKxilBcycIB98y3iwrZYqEflNRhDM E9kGI/dIQ62OUA6l5gK0J2u/1I/S9tFIFtBEqmbO5purYV/GWit57dd7zOxFwSaMS/UW 7hutG/+6iWqgUh4dH/hlVE5gtAktgbJDcWJRBrFcKO7vfCbLIHNCRQVZCoPe+aAEjkJ6 SRmEuGVNMumk5HNUDtBa96cjRFsoBXN8df7eEDt6rkt9+FjCSVhd86ehdp8UV4Q21CCm QFoA== X-Gm-Message-State: AGRZ1gLY/gMZrS78uvR86nypBUGT7c0cizvex1zDpNXtaW8caaEQQ13D vlN/Tm1krMO49ODaJCfGKwTfXA== X-Google-Smtp-Source: AJdET5dnZUIoRC1lGuqS4uoKVpo0zngnnxU3CjkRDWJglPbdEnf0MsL7DFE5SW0S9UQGQwuk02FE7Q== X-Received: by 2002:a1c:5448:: with SMTP id p8mr572724wmi.124.1542191128460; Wed, 14 Nov 2018 02:25:28 -0800 (PST) Received: from bender.baylibre.local ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id v9-v6sm23720908wrm.6.2018.11.14.02.25.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 14 Nov 2018 02:25:27 -0800 (PST) From: Neil Armstrong To: jagan@openedev.com, sjg@chromium.org Date: Wed, 14 Nov 2018 11:25:19 +0100 Message-Id: <20181114102520.25346-3-narmstrong@baylibre.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181114102520.25346-1-narmstrong@baylibre.com> References: <20181114102520.25346-1-narmstrong@baylibre.com> MIME-Version: 1.0 Cc: u-boot@lists.denx.de, linux-amlogic@lists.infradead.org Subject: [U-Boot] [PATCH u-boot v3 2/3] test: regmap: add regmap_read_poll_timeout test X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 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" Add test to regmap_read_poll_timeout() helper to check the timeout works properly but cannot test proper condition matching since read/write calls are not executed in sandbox. Signed-off-by: Neil Armstrong Acked-by: Jagan Teki --- test/dm/regmap.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/test/dm/regmap.c b/test/dm/regmap.c index d4b86b3b03..00d61fe38c 100644 --- a/test/dm/regmap.c +++ b/test/dm/regmap.c @@ -116,3 +116,29 @@ static int dm_test_regmap_rw(struct unit_test_state *uts) } DM_TEST(dm_test_regmap_rw, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); + +/* Read polling test */ +static int dm_test_regmap_poll(struct unit_test_state *uts) +{ + struct udevice *dev; + struct regmap *map; + uint reg; + unsigned long start; + + ut_assertok(uclass_get_device(UCLASS_SYSCON, 0, &dev)); + map = syscon_get_regmap(dev); + ut_assertok_ptr(map); + + start = get_timer(0); + + ut_asserteq(-ETIMEDOUT, + regmap_read_poll_timeout(map, 0, reg, + (reg == 0xcacafafa), + 1, 5 * CONFIG_SYS_HZ)); + + ut_assert(get_timer(start) > (5 * CONFIG_SYS_HZ)); + + return 0; +} + +DM_TEST(dm_test_regmap_poll, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);