Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3507948pxb; Mon, 24 Jan 2022 11:01:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJzG3lUALgWTrYgaf/VupDCIzoA/9tmndAuO8DMc7mmRF6gW27j1+Vnse8Moyw25ibbEF1Cc X-Received: by 2002:a17:902:ce84:b0:14b:4bc6:e73 with SMTP id f4-20020a170902ce8400b0014b4bc60e73mr6192454plg.130.1643050913678; Mon, 24 Jan 2022 11:01:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643050913; cv=none; d=google.com; s=arc-20160816; b=DVP6MWcDDxWzovFD+qLTb6WAfncLAjLPmsHHcHB9FvyyYoxzh7OHy5ks8zPqIe+aXQ CVG0qrpIgF5NrvKGLMcKXo2cxjsXeBMsqiqqIdhBxp47RvP233+lm/s3r5yGJa2ZKfWp UeGUSbVNTFGo3ejobkyvwvzYW4Aeeute2fAIcwCOM2lrvUN8LbPV8bI6ddg6QEwAUy6H J+V/Cp4B4QwaeG0N9WmBaP8MOH1clnrzFBTgYnB1jGy3lg8HDjPh0mUNvGa9fsTKvSoO +r7sgGHIOCkPKpAswCleyjZ5rjw3jf7LMW8pdgfekLOxmiZZFGDJ9QLg0w7dxs+W2mVl sSAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=7qNhfURnWXeunnBDueviVIFFwY/hSkvjITGB3CuQcgk=; b=NNSRbByTsRndXpMikX6UCV3VEa5Sw6D9mQRWsbIBNpWD2zX+3BOWpT+Vdaq4hoCrfV t06OPMIfvt0HcCpzC0uEX3cK7z1ghDSMYbJ38CbuFkHZeTPYQYDuaqZnRERpyBRaDpz9 3QD1ELgPlhPpKRMmwZXN9zMPyX8vz05qQJmBCSbbeA3mVaOL7iMFkbv9QOBE+E2Qrin1 tbdPppSXnu8Eachz3DfGbL8gUOC06gy+FfCo4Jj5pomh6x2aF4P3ZNCCl//XWShNigf/ aM3Di1+JiT0MzfHOoOZ4nQ9dnNApUbapOVm8zQkkB9KOI+HNiy889/ekGGnLidu7/gGk bBRA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u1si14319088pgm.169.2022.01.24.11.01.40; Mon, 24 Jan 2022 11:01:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237101AbiAXKEi (ORCPT + 99 others); Mon, 24 Jan 2022 05:04:38 -0500 Received: from foss.arm.com ([217.140.110.172]:56042 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236992AbiAXKEP (ORCPT ); Mon, 24 Jan 2022 05:04:15 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9FE2FD6E; Mon, 24 Jan 2022 02:04:14 -0800 (PST) Received: from e120937-lin.home (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9CFE13F73B; Mon, 24 Jan 2022 02:04:12 -0800 (PST) From: Cristian Marussi To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: sudeep.holla@arm.com, james.quinlan@broadcom.com, Jonathan.Cameron@Huawei.com, f.fainelli@gmail.com, etienne.carriere@linaro.org, vincent.guittot@linaro.org, souvik.chakravarty@arm.com, peter.hilber@opensynergy.com, igor.skalkin@opensynergy.com, cristian.marussi@arm.com Subject: [PATCH 4/6] firmware: arm_scmi: Add atomic support to clock protocol Date: Mon, 24 Jan 2022 10:03:39 +0000 Message-Id: <20220124100341.41191-5-cristian.marussi@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220124100341.41191-1-cristian.marussi@arm.com> References: <20220124100341.41191-1-cristian.marussi@arm.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Introduce new _atomic variant for SCMI clock protocol operations related to enable disable operations: when an atomic operation is required the xfer poll_completion flag is set for that transaction. Signed-off-by: Cristian Marussi --- drivers/firmware/arm_scmi/clock.c | 22 +++++++++++++++++++--- include/linux/scmi_protocol.h | 4 ++++ 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/drivers/firmware/arm_scmi/clock.c b/drivers/firmware/arm_scmi/clock.c index 35b56c8ba0c0..72f930c0e3e2 100644 --- a/drivers/firmware/arm_scmi/clock.c +++ b/drivers/firmware/arm_scmi/clock.c @@ -273,7 +273,7 @@ static int scmi_clock_rate_set(const struct scmi_protocol_handle *ph, static int scmi_clock_config_set(const struct scmi_protocol_handle *ph, u32 clk_id, - u32 config) + u32 config, bool atomic) { int ret; struct scmi_xfer *t; @@ -284,6 +284,8 @@ scmi_clock_config_set(const struct scmi_protocol_handle *ph, u32 clk_id, if (ret) return ret; + t->hdr.poll_completion = atomic; + cfg = t->tx.buf; cfg->id = cpu_to_le32(clk_id); cfg->attributes = cpu_to_le32(config); @@ -296,12 +298,24 @@ scmi_clock_config_set(const struct scmi_protocol_handle *ph, u32 clk_id, static int scmi_clock_enable(const struct scmi_protocol_handle *ph, u32 clk_id) { - return scmi_clock_config_set(ph, clk_id, CLOCK_ENABLE); + return scmi_clock_config_set(ph, clk_id, CLOCK_ENABLE, false); } static int scmi_clock_disable(const struct scmi_protocol_handle *ph, u32 clk_id) { - return scmi_clock_config_set(ph, clk_id, 0); + return scmi_clock_config_set(ph, clk_id, 0, false); +} + +static int scmi_clock_enable_atomic(const struct scmi_protocol_handle *ph, + u32 clk_id) +{ + return scmi_clock_config_set(ph, clk_id, CLOCK_ENABLE, true); +} + +static int scmi_clock_disable_atomic(const struct scmi_protocol_handle *ph, + u32 clk_id) +{ + return scmi_clock_config_set(ph, clk_id, 0, true); } static int scmi_clock_count_get(const struct scmi_protocol_handle *ph) @@ -330,6 +344,8 @@ static const struct scmi_clk_proto_ops clk_proto_ops = { .rate_set = scmi_clock_rate_set, .enable = scmi_clock_enable, .disable = scmi_clock_disable, + .enable_atomic = scmi_clock_enable_atomic, + .disable_atomic = scmi_clock_disable_atomic, }; static int scmi_clock_protocol_init(const struct scmi_protocol_handle *ph) diff --git a/include/linux/scmi_protocol.h b/include/linux/scmi_protocol.h index fdf6bd83cc59..b87551f41f9f 100644 --- a/include/linux/scmi_protocol.h +++ b/include/linux/scmi_protocol.h @@ -42,6 +42,7 @@ struct scmi_revision_info { struct scmi_clock_info { char name[SCMI_MAX_STR_SIZE]; + unsigned int enable_latency; bool rate_discrete; union { struct { @@ -82,6 +83,9 @@ struct scmi_clk_proto_ops { u64 rate); int (*enable)(const struct scmi_protocol_handle *ph, u32 clk_id); int (*disable)(const struct scmi_protocol_handle *ph, u32 clk_id); + int (*enable_atomic)(const struct scmi_protocol_handle *ph, u32 clk_id); + int (*disable_atomic)(const struct scmi_protocol_handle *ph, + u32 clk_id); }; /** -- 2.17.1