From patchwork Tue May 31 16:09:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Etienne Carriere X-Patchwork-Id: 577460 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:330b:0:0:0:0 with SMTP id f11csp1302972mag; Tue, 31 May 2022 09:12:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwBQUgMdDRZMfb31G1XqN0CPNuDOCjCjC+3MGNQhROGkIRbeC8INEADPci1avO21ZGHS68g X-Received: by 2002:a05:6e02:1909:b0:2d1:cadc:6db1 with SMTP id w9-20020a056e02190900b002d1cadc6db1mr19160461ilu.3.1654013564710; Tue, 31 May 2022 09:12:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654013564; cv=none; d=google.com; s=arc-20160816; b=iMAMwQ4GXQSNOViatv0jOOZGeLOX5vijqKzl3JMYnSQAMTVtHCE0EQkW/HZfPAz1YB HNV7FA5nKVT0WsJdTrMGa4wexPKeN01toRM3jfqianmL9jMCFHptLa2hOiqLHaUJ3xSi RxFADU5xPtbx3xv+6J2krHAEf06pLXPljAV2xzQSof+swA/kZRzWATSUWSIFrRwh1da0 JZCOP/ygkjplOcP1471uUV3nkgeLf1IrRr30FT5qkG1wFFv0HzdI3p9VaBZFgjGbUHxv MyQ2GR/ir02NIHw6g31jmUhi1qBYU9v90HZEeo82RbLFc3UaiPrIdWcTz1ZLPsGKnzwL C2ZQ== 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=iwTuXZOz9+UtxN9wMXSzzohZWLxchdnL7bJCNiUXGCk=; b=wkCJlBL8HgDNUT8RdT9hVqNTM2XtNb0E3QiyhZbeldceFpJFsGoxevPNtd9BOP1FWh LY96viJe7GdDmuKraqppqnTWjZpka5DkkQVyymTgvLh0Jr7E7mbtWxysikxVIWDPpOwH E3SfsuXQohbEp6QTkdRlmIyxq/Myajyt995s2QfpYdakjNE6QVtZwbCZ39ZGT9J8EQhz +wvAFePBTR7b5h5z5QiEC69WGjhSWuTd4kLJpP9WSrnpQ3mBmDN8hvpOx7PyZ0aY1j1L LBb/N5XohhF8zCpj9gj9b27BJMeaBy+DygCVxSA/i61agGGm+GWnjXEJXMofr2hrpy7t MbMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wJ5RTTIE; 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 w10-20020a056e02190a00b002d1e16a6dedsi16830045ilu.77.2022.05.31.09.12.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 09:12:44 -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=wJ5RTTIE; 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 3DF0984319; Tue, 31 May 2022 18:10:48 +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="wJ5RTTIE"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 36B9A83F33; Tue, 31 May 2022 18:10:01 +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, T_SCC_BODY_TEXT_LINE 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 5DE4E83D77 for ; Tue, 31 May 2022 18:09:49 +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=etienne.carriere@linaro.org Received: by mail-wr1-x432.google.com with SMTP id s24so12021046wrb.10 for ; Tue, 31 May 2022 09:09:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=iwTuXZOz9+UtxN9wMXSzzohZWLxchdnL7bJCNiUXGCk=; b=wJ5RTTIEpEoEqNqr1s6tn3H3L9B9+eglua5vb0e26tRJHubz4AGcK4gH4M6xnYfz6s FiPx83VluP9qF/fve4f025ZXxN23PLrIP0JhTFva+kx6TGJTMmia8UE2XtMGDYKhf7yy sHW3G0tVqj6cNOA2e7Ah93dGr3a5+tqxW3D/WMbME0hub9/WaFtzDGhPMn5f0ZJ2dx4I IZfrJDAcg3znViKy0uCGQExyrSX0j1L2OrkEWSwYmAaR7m0zrFMmNKKwU/r2rlhlo35X Nn4J0s0NAlynco8w7E2b7SJKd4w2PEu/Oowl9ijqXvhBOeanxiL+6/46aNAk6dYESEmh fizg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=iwTuXZOz9+UtxN9wMXSzzohZWLxchdnL7bJCNiUXGCk=; b=a64gmfOfA02Meipcld7+ETykVyukKdNFmJpfdHtjaPJqBlLM0XjkAPuEbXki5dHxQZ LR6iK/xrvK4+5MtVr1ZsK/NFRQYhL2uZwIWndvB7JLSda1c8AI33l2qKxyPZwTQlP/f9 LzD6dClBp54OUriFExBIPAHlWhTZj2LGk0w8E8sfQWdq6/a2p4yr69E0kCNrSD9GdVdd dQKjHLmmopyRZxcKufKDa5bhQpFDFuZqntHMf8tp02l+L74cqjZj21hP3jchPlQGGlYM EtMO/UPvowyti0yre4NIod+asPYghbUHKQSRl7qTjuRXfSgC/IIzqs7pKQCt+pAHYpxq AerQ== X-Gm-Message-State: AOAM530VPnDeeFLmHDZhTApjuNQPXGjYrRE57bMjvgmcG3adADOP2GQS I386gS4EqvO+fVBJsV3/MheZ6velRcy4ig== X-Received: by 2002:a5d:6d8b:0:b0:20f:e42a:96d0 with SMTP id l11-20020a5d6d8b000000b0020fe42a96d0mr36053483wrs.518.1654013388131; Tue, 31 May 2022 09:09:48 -0700 (PDT) Received: from lmecxl1178.lme.st.com ([2a04:cec0:117a:a94e:9569:2e63:8a35:2cc5]) by smtp.gmail.com with ESMTPSA id r23-20020a05600c321700b0039aa4d054f8sm2884035wmp.5.2022.05.31.09.09.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 09:09:47 -0700 (PDT) From: Etienne Carriere To: u-boot@lists.denx.de Cc: Patrick Delaunay , Patrice Chotard , etienne.carriere@linaro.org Subject: [PATCH v2 11/14] reset: scmi: support SCMI multi-channel Date: Tue, 31 May 2022 18:09:26 +0200 Message-Id: <20220531160929.931150-12-etienne.carriere@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220531160929.931150-1-etienne.carriere@linaro.org> References: <20220531160929.931150-1-etienne.carriere@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.5 at phobos.denx.de X-Virus-Status: Clean Update SCMI reset controller driver to get its assigned SCMI channel during initialization. This change allows SCMI reset domain protocol to use a dedicated channel when defined in the DT. The reference is saved in SCMI reset controller driver private data. Signed-off-by: Etienne Carriere --- Changes since v1: - Define a private struct to hold channel reference rather than using device private data reference as opaque channel reference. --- drivers/reset/reset-scmi.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/drivers/reset/reset-scmi.c b/drivers/reset/reset-scmi.c index 30b26ec9d31..122556162ec 100644 --- a/drivers/reset/reset-scmi.c +++ b/drivers/reset/reset-scmi.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0+ /* - * Copyright (C) 2019-2020 Linaro Limited + * Copyright (C) 2019-2022 Linaro Limited */ #define LOG_CATEGORY UCLASS_RESET @@ -13,8 +13,17 @@ #include #include +/** + * struct scmi_reset_priv - Private data for SCMI reset controller + * @channel: Reference to the SCMI channel to use + */ +struct scmi_reset_priv { + struct scmi_channel *channel; +}; + static int scmi_reset_set_level(struct reset_ctl *rst, bool assert_not_deassert) { + struct scmi_reset_priv *priv = dev_get_priv(rst->dev); struct scmi_rd_reset_in in = { .domain_id = rst->id, .flags = assert_not_deassert ? SCMI_RD_RESET_FLAG_ASSERT : 0, @@ -26,7 +35,7 @@ static int scmi_reset_set_level(struct reset_ctl *rst, bool assert_not_deassert) in, out); int ret; - ret = devm_scmi_process_msg(rst->dev, NULL, &msg); + ret = devm_scmi_process_msg(rst->dev, priv->channel, &msg); if (ret) return ret; @@ -45,6 +54,7 @@ static int scmi_reset_deassert(struct reset_ctl *rst) static int scmi_reset_request(struct reset_ctl *rst) { + struct scmi_reset_priv *priv = dev_get_priv(rst->dev); struct scmi_rd_attr_in in = { .domain_id = rst->id, }; @@ -58,7 +68,7 @@ static int scmi_reset_request(struct reset_ctl *rst) * We don't really care about the attribute, just check * the reset domain exists. */ - ret = devm_scmi_process_msg(rst->dev, NULL, &msg); + ret = devm_scmi_process_msg(rst->dev, priv->channel, &msg); if (ret) return ret; @@ -71,8 +81,17 @@ static const struct reset_ops scmi_reset_domain_ops = { .rst_deassert = scmi_reset_deassert, }; +static int scmi_reset_probe(struct udevice *dev) +{ + struct scmi_reset_priv *priv = dev_get_priv(dev); + + return devm_scmi_of_get_channel(dev, &priv->channel); +} + U_BOOT_DRIVER(scmi_reset_domain) = { .name = "scmi_reset_domain", .id = UCLASS_RESET, .ops = &scmi_reset_domain_ops, + .probe = scmi_reset_probe, + .priv_auto = sizeof(struct scmi_reset_priv *), };