From patchwork Wed Sep 6 02:40:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 720401 Delivered-To: patch@linaro.org Received: by 2002:adf:d08b:0:b0:31d:da82:a3b4 with SMTP id y11csp2461753wrh; Tue, 5 Sep 2023 19:42:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFg5setiNBYyU5hL4MDUWMev5Doc6k++NeUqzW7JvGZZY8mbY4ALBpxp9UqJzfbbQuWqTC7 X-Received: by 2002:a5d:504b:0:b0:319:7428:9ca0 with SMTP id h11-20020a5d504b000000b0031974289ca0mr163682wrt.61.1693968128458; Tue, 05 Sep 2023 19:42:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693968128; cv=none; d=google.com; s=arc-20160816; b=juYMf6TOwA+PR6oO/NdEQbOuHzwyxbZcmkL0r/inmszAVO+3Mv+Iy7i+0cAtgebv/r S07TbluIEoznvXMx5MXpJdLTLHi1a7qWuAludXlrWuwOp/meK5Bxka//YFVMQMIVbcCR v04RBbFzn3p4v7nwjSF3VmCMdSyZ9Gi7112BjizU87H3ctgfYPcH7lJYlOoPkGeV+Rsb wXDMNz3P5TDNRlkqTeRoX4GIpepifwcVMSgTDK8EqUFBg/8G5UfGmMTYHLIAwkjltIq6 qPAcNPBxGF7BAwZX5+ZlAOrNO3Vt8bpaQG/4eU18IrMru7F563NB2gjeb2Mjeu6Pvpsz YM5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Qbtfx7u6KwcO2aMHhHr2Q6+3/YafCKFjaH7opDRFSf0=; fh=Yz321xYbZlOZFLAVVWewQ+h9487s8fAdGcGeu++kLX8=; b=TvuYDG9i7oA+TXmHLfkPyrhdAZgcKGKSAb86RrShUMiaOFPjaC/3VRqjU2yiboWBXx iIG9iv0brGryw7zdVwPR/JZpwsm1zgxMLm4tlEstisiYyH3PIbE3DAYLuXwiM8UkDacO d/akiPEi3iPtcZDzPW2omTx2nGjCxphD9ml5LIHqeX/iSp8Fx2SxZL/sU1hf6oskaE85 Dny0BY/grtdILyKC6c4Yw1s0gD4PIe13AqGG3HoQbUedlRG44xleg8BxA8+bs4B90Rwd boj6uhgfJZI7gBWz0ydOU10ZVtrLnuZON6WGiWZc/casiJLafQkCCalE/aY1g9ieC55h kuHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="YQg/F1jV"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id r2-20020adff102000000b003176b4934basi6379387wro.842.2023.09.05.19.42.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Sep 2023 19:42:08 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="YQg/F1jV"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 495878698F; Wed, 6 Sep 2023 04:41:16 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org 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=linaro.org header.i=@linaro.org header.b="YQg/F1jV"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E28DD865A8; Wed, 6 Sep 2023 04:41:14 +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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) (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 97213866DC for ; Wed, 6 Sep 2023 04:41:11 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=takahiro.akashi@linaro.org Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-68a32506e90so700526b3a.1 for ; Tue, 05 Sep 2023 19:41:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693968070; x=1694572870; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Qbtfx7u6KwcO2aMHhHr2Q6+3/YafCKFjaH7opDRFSf0=; b=YQg/F1jV9aobNwpMa0DApqSO4exusX6/Z8hmLX6hUmQdgLWyFTLaEQU2b+c9rgJCoh UaYD4vzc2DhPdJ8/QUAwQ6W/O69VhWsrTY1hoSmgSUPs2Hhqwxm3gGfGxrUloqY13ldk p8zR7TzVb+EIOKTKev+zZQLG6oGaK0jb1R/df53ykH0GL2lxO7qX4Tg+ZoLPVLbjbMmf PaZOiE/KZK+wVRHadD51n8NyUCl9mG2Fgjw5QEjakQ6vAZjkinbNMOm2cg4nZU3h24S5 gAcfuUh030hZXu7Fww26KXR2XcZIH85v/HSh2QeYDBPAYPwOKe0uogzvI8jHFSrqF/xQ JzzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693968070; x=1694572870; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Qbtfx7u6KwcO2aMHhHr2Q6+3/YafCKFjaH7opDRFSf0=; b=Y1jdr0USUi/4aIJd3OUbgHSVc/ImbV1VMqrBMoMq1pEZAfWuQd7jf+YogMrBcEG6hV SFoYFQv4lo2BtJCAfHqB80cTPDRyX/oN0OSbgRTHB0rItUcSnAXbFgtRM1cgfBeHk2cn ws7N28qs+py/XmK64GY/d/c7YmolA7z4SDiwxIPp0fPhBnGdH4dDXoHAZVzH3foZejJt +AZr/FOodlIrzU0DE3jl7kkz0erH9QJtvnaTenVEZNbhv6b9FZHKvnk+s7qpJunsketv gl/an+xWOI9D8r9ti8wON1ZXKB5fgYPXoD51XI09FqMlskBP7kZwdBnV9iaECkByjBoY mP8g== X-Gm-Message-State: AOJu0Yw99DYk2gyzmj9IoZRYRgT76RUVQdj0XXMvs2cc0zz0MfEGdhyq UC70AP3IeAciNRHxVVXOt4rER/cOzZFt47Vq2sPJeA== X-Received: by 2002:a05:6a00:f0e:b0:68b:c562:da46 with SMTP id cr14-20020a056a000f0e00b0068bc562da46mr16015519pfb.1.1693968069848; Tue, 05 Sep 2023 19:41:09 -0700 (PDT) Received: from octopus.. ([2400:4050:c3e1:100:8294:a07d:b7e9:4033]) by smtp.gmail.com with ESMTPSA id c5-20020a6566c5000000b0056428865aadsm9145378pgw.82.2023.09.05.19.41.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Sep 2023 19:41:09 -0700 (PDT) From: AKASHI Takahiro To: u-boot@lists.denx.de Cc: etienne.carriere@st.com, michal.simek@amd.com, sjg@chromium.org, linus.walleij@linaro.org, Oleksii_Moisieiev@epam.com, AKASHI Takahiro Subject: [RFC 6/6] test: dm: add SCMI pinctrl test Date: Wed, 6 Sep 2023 11:40:11 +0900 Message-Id: <20230906024011.17488-7-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230906024011.17488-1-takahiro.akashi@linaro.org> References: <20230906024011.17488-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean In this test, SCMI-based pinmux feature is exercised. Signed-off-by: AKASHI Takahiro --- test/dm/scmi.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/test/dm/scmi.c b/test/dm/scmi.c index 423b6ef70b29..ca5a2e9c781e 100644 --- a/test/dm/scmi.c +++ b/test/dm/scmi.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -395,3 +396,64 @@ static int dm_test_scmi_voltage_domains(struct unit_test_state *uts) return release_sandbox_scmi_test_devices(uts, dev); } DM_TEST(dm_test_scmi_voltage_domains, UT_TESTF_SCAN_FDT); + +/* + * This part is derived from test/dm/pinmux.c, So + * + * Copyright (C) 2020 Sean Anderson + */ + +static char buf[64]; +#define test_muxing(selector, expected) do { \ + ut_assertok(pinctrl_get_pin_muxing(dev, selector, buf, sizeof(buf))); \ + ut_asserteq_str(expected, (char *)&buf); \ +} while (0) + +#define test_name(selector, expected) do { \ + ut_assertok(pinctrl_get_pin_name(dev, selector, buf, sizeof(buf))); \ + ut_asserteq_str(expected, (char *)&buf); \ +} while (0) + +static int dm_test_scmi_pinmux(struct unit_test_state *uts) +{ + struct udevice *dev; + + ut_assertok(uclass_get_device_by_name(UCLASS_PINCTRL, "protocol@19", + &dev)); + ut_assertok(pinctrl_select_state(dev, "default")); + test_muxing(0, ""); + test_muxing(1, ""); + test_muxing(2, "I2S."); + test_muxing(3, "I2S."); + test_muxing(4, "I2S."); + test_muxing(5, "GPIO bias-pull-up."); + test_muxing(6, "GPIO drive-open-drain output-mode output-value."); + test_muxing(7, "GPIO bias-pull-down input-mode."); + test_muxing(8, "GPIO bias-disable."); + + ut_assertok(pinctrl_select_state(dev, "alternate")); + test_muxing(0, "I2C drive-open-drain."); + test_muxing(1, "I2C drive-open-drain."); + test_muxing(2, "SPI."); + test_muxing(3, "SPI."); + test_muxing(4, "SPI."); + test_muxing(5, "CS bias-pull-up."); + test_muxing(6, "CS drive-open-drain output-mode output-value."); + test_muxing(7, "GPIO bias-pull-down input-mode."); + test_muxing(8, "GPIO bias-disable."); + + ut_assertok(pinctrl_select_state(dev, "0")); + test_muxing(0, "I2C drive-open-drain."); + test_muxing(1, "I2C drive-open-drain."); + test_muxing(2, "I2S."); + test_muxing(3, "I2S."); + test_muxing(4, "I2S."); + test_muxing(5, "GPIO bias-pull-up."); + test_muxing(6, "GPIO drive-open-drain output-mode output-value."); + test_muxing(7, "GPIO bias-pull-down input-mode."); + test_muxing(8, "GPIO bias-disable."); + + return 0; +} + +DM_TEST(dm_test_scmi_pinmux, UT_TESTF_SCAN_FDT);