From patchwork Wed Jun 7 16:10:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 103299 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp2015924qgd; Wed, 7 Jun 2017 09:11:50 -0700 (PDT) X-Received: by 10.84.217.206 with SMTP id d14mr28583560plj.59.1496851910153; Wed, 07 Jun 2017 09:11:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496851910; cv=none; d=google.com; s=arc-20160816; b=c7xqTHkm0FpoSThnTXdX/CeFbAZ886o/e4pUN+zFN8G6HyYXbHv4uWS1kVm71llfO0 S2iBNLlhoSnOigEM0fJEyPzM4Cp2hYeBtP9gZh0Ex9X1bCWMgjw6lNIZWZtCwH7itsEy 43ntWU/i9A7f9XgnLPoxhsxsz+F7vn51oADuFFJLrHqVvoCXozIlYEYtT5VMKEf8hPqb XgEkByIyncppXB2IrAdhAigQKyLUliiaLrcbI78hmGZJ6T9vCHn4LFG5jKq9glFTGYOR a5MFdTs5CFmjEgE71mBOaB9vYlzNn3jGDYQPQUBoQOCyWdqBkFcthMFwvyhaRw0j7EHZ ojWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=tKUWRnDDFwhHWq9K3KabLZagYulLptzI+lxiSO7HNTY=; b=UY+A0dYOYLkzJkt6XeifeFR0oJdmqWSBuqeS742Cv/0K0ZEYdAsWWeo0HdPtwZ09DW F/E3UlVCz2BdVC5c6tE7N5CLb1gLExYIxys2p8rg49qKlUsVV6x1VZYt+7kGycOUs5b7 IGi/xieWpDCllgYlkUIRhS1E+guY//LZZVCX50p6xlwH9j6W+ZGGIgI4cwlzJk1Vlya5 RmFaArppTa45fCoqJNmol4/oCHGh7qnD6LtSrkvpXNbZNcnObjfls7f4JWYm22Od7tN9 hMuW/c3mVwyywLeHC1S4tYUrueifREffSb70EpsuXftYiabn9HTsEGR05BoSSZgTGEDy nO2A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p7si2109988pgn.150.2017.06.07.09.11.49; Wed, 07 Jun 2017 09:11:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751743AbdFGQLR (ORCPT + 25 others); Wed, 7 Jun 2017 12:11:17 -0400 Received: from foss.arm.com ([217.140.101.70]:34848 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751635AbdFGQKl (ORCPT ); Wed, 7 Jun 2017 12:10:41 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 943DE15B2; Wed, 7 Jun 2017 09:10:40 -0700 (PDT) Received: from e107155-lin.cambridge.arm.com (e107155-lin.cambridge.arm.com [10.1.211.34]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 593DA3F578; Wed, 7 Jun 2017 09:10:39 -0700 (PDT) From: Sudeep Holla To: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Cc: Sudeep Holla , Roy Franz , Harb Abdulhamid , Nishanth Menon , Arnd Bergmann Subject: [RFC PATCH 8/8] firmware: arm_scmi: probe and initialise all the supported protocols Date: Wed, 7 Jun 2017 17:10:12 +0100 Message-Id: <1496851812-19623-9-git-send-email-sudeep.holla@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1496851812-19623-1-git-send-email-sudeep.holla@arm.com> References: <1496851812-19623-1-git-send-email-sudeep.holla@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now that we have basic support for all the protocols in the specification, let's probe them individually and initialise them. Signed-off-by: Sudeep Holla --- drivers/firmware/arm_scmi/common.h | 5 +++++ drivers/firmware/arm_scmi/driver.c | 30 +++++++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) -- 2.7.4 diff --git a/drivers/firmware/arm_scmi/common.h b/drivers/firmware/arm_scmi/common.h index 32873a315c76..e2ff799e7dd4 100644 --- a/drivers/firmware/arm_scmi/common.h +++ b/drivers/firmware/arm_scmi/common.h @@ -119,4 +119,9 @@ int scmi_version_get(struct scmi_handle *h, u8 protocol, u32 *version); bool scmi_is_protocol_implemented(struct scmi_handle *h, u8 prot_id); void scmi_setup_protocol_implemented(struct scmi_handle *handle, u8 *prot_imp); +typedef int (*scmi_init_fn_t)(struct scmi_handle *); int scmi_base_protocol_init(struct scmi_handle *h); +int scmi_perf_protocol_init(struct scmi_handle *h); +int scmi_sensors_protocol_init(struct scmi_handle *h); +int scmi_power_protocol_init(struct scmi_handle *h); +int scmi_clock_protocol_init(struct scmi_handle *h); diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c index 7b653c932edc..3300d0cce9e0 100644 --- a/drivers/firmware/arm_scmi/driver.c +++ b/drivers/firmware/arm_scmi/driver.c @@ -684,6 +684,23 @@ static int scmi_xfer_info_init(struct scmi_info *sinfo) return 0; } +static const struct of_device_id scmi_protocol_match[] = { + { + .compatible = "arm,scmi-perf-domains", + .data = scmi_perf_protocol_init, + }, { + .compatible = "arm,scmi-clocks", + .data = scmi_clock_protocol_init, + }, { + .compatible = "arm,scmi-power-domains", + .data = scmi_power_protocol_init, + }, { + .compatible = "arm,scmi-sensors", + .data = scmi_sensors_protocol_init, + }, + {} +}; + static int scmi_probe(struct platform_device *pdev) { int ret = -EINVAL; @@ -694,7 +711,7 @@ static int scmi_probe(struct platform_device *pdev) const struct scmi_desc *desc; struct scmi_info *info = NULL; struct device *dev = &pdev->dev; - struct device_node *shmem, *np = dev->of_node; + struct device_node *child, *shmem, *np = dev->of_node; desc = of_match_device(scmi_of_match, dev)->data; @@ -755,6 +772,17 @@ static int scmi_probe(struct platform_device *pdev) goto out; } + for_each_available_child_of_node(np, child) { + scmi_init_fn_t fn; + const struct of_device_id *match; + + match = of_match_node(scmi_protocol_match, child); + if (!match) + continue; + fn = match->data; + fn(handle); + } + mutex_lock(&scmi_list_mutex); list_add_tail(&info->node, &scmi_list); mutex_unlock(&scmi_list_mutex);