From patchwork Fri Sep 28 07:27:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Six X-Patchwork-Id: 976072 X-Patchwork-Delegate: agust@denx.de 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=gdsys.cc Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 42M3SC12Vgz9s3x for ; Fri, 28 Sep 2018 17:38:03 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id D0BAEC21E52; Fri, 28 Sep 2018 07:30:48 +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=SPF_HELO_PASS 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 11E2DC21E77; Fri, 28 Sep 2018 07:28:28 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 2E612C21D83; Fri, 28 Sep 2018 07:28:21 +0000 (UTC) Received: from smtprelay04.ispgateway.de (smtprelay04.ispgateway.de [80.67.31.32]) by lists.denx.de (Postfix) with ESMTPS id DBB1FC21D83 for ; Fri, 28 Sep 2018 07:28:20 +0000 (UTC) Received: from [87.191.40.34] (helo=bob3.testumgebung.local) by smtprelay04.ispgateway.de with esmtpa (Exim 4.90_1) (envelope-from ) id 1g5nCG-0003DS-BS; Fri, 28 Sep 2018 09:28:20 +0200 From: Mario Six To: U-Boot Mailing List , Anatolij Gustschin , Daniel Schwierzeck , Simon Glass , Bin Meng Date: Fri, 28 Sep 2018 09:27:35 +0200 Message-Id: <20180928072740.8092-11-mario.six@gdsys.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180928072740.8092-1-mario.six@gdsys.cc> References: <20180928072740.8092-1-mario.six@gdsys.cc> X-Df-Sender: bWFyaW8uc2l4QGdkc3lzLmNj Subject: [U-Boot] [PATCH v9 11/16] test: regmap: Add test for regmap_{set, get} 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: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Add test for regmap_{set,get} functions. Reviewed-by: Anatolij Gustschin Reviewed-by: Simon Glass Signed-off-by: Mario Six --- v8 -> v9: No changes v7 -> v8: No changes v6 -> v7: No changes v5 -> v6: No changes v4 -> v5: No changes v3 -> v4: No changes v2 -> v3: New in v3 --- test/dm/regmap.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) -- 2.11.0 diff --git a/test/dm/regmap.c b/test/dm/regmap.c index b28d6a6cd11..a8d7e6829ec 100644 --- a/test/dm/regmap.c +++ b/test/dm/regmap.c @@ -116,3 +116,31 @@ 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); + +/* Get/Set test */ +static int dm_test_regmap_getset(struct unit_test_state *uts) +{ + struct udevice *dev; + struct regmap *map; + uint reg; + struct layout { + u32 val0; + u32 val1; + u32 val2; + u32 val3; + }; + + ut_assertok(uclass_get_device(UCLASS_SYSCON, 0, &dev)); + map = syscon_get_regmap(dev); + ut_assertok_ptr(map); + + regmap_set(map, struct layout, val0, 0xcacafafa); + regmap_set(map, struct layout, val3, 0x55aa2211); + + ut_assertok(regmap_get(map, struct layout, val0, ®)); + ut_assertok(regmap_get(map, struct layout, val3, ®)); + + return 0; +} + +DM_TEST(dm_test_regmap_getset, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);