From patchwork Tue Aug 28 00:59:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nishanth Menon X-Patchwork-Id: 145233 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp571775ljw; Mon, 27 Aug 2018 17:59:50 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbaNiR1GkHi9jX1zRBxBokyMAD4W4yGY3vw4TpP6UUS5fE4BoCeKQddHjdPp9f5vI+CJ0/Y X-Received: by 2002:a63:e255:: with SMTP id y21-v6mr14197678pgj.160.1535417990330; Mon, 27 Aug 2018 17:59:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535417990; cv=none; d=google.com; s=arc-20160816; b=P7L1TjJ4fBGb4LGBNNBChtQkxN2N8E/3bH34JDE7MPVek6q1k9tUGFL4kGUlWFka71 OzUuPMzRZJo1v6nf1Zq7XqGBt5G4WIYZNX6Cx5+E+tOLqH5Sf0P+K++njf4LvmZ04D6d 2Qk4ZKxBcGc/Rv4LPWj48a1pKF/JFldBnqlI7UFH+quQBl2rV7BlaVGcWFZS9cfzAnHV XlSrg/kMJS/DfqI//JtDYyC2HO075yf+2ZDN2vAkh94vbfBsw/V58ytjWjcEZNMhBkzu 2BxwDPK7+PkFUy23GzIhDk8lMl5LQioeWnUoCa/noKQUhjTXLax0FqaBoiw0YEjheuzC YL7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=IO25pPSBv6KXr/MYJLedbO7tk4i60dfuh04AY61KCNQ=; b=bRJotqnXilWeJpJXEuhG96voWhpoLfEysUE5p1Zee36qwf03ExpBJ2PjCv6yeZvOLM LixXvtYPSVv5AIHGf/gUuSU8ozRVWlPilnQB76ilFsneuLNcbBDcYiorpVn4/xk4W/Sd LtcI7uDg4KlG6F4UNB6S6ipV6Vuac65lf4ePExsPW6cRniqkllMExrcrMBMdahHz2I4z nQN97zWB8gPWSv5fXtLTFAmnafj0PkHWSS9jL4XWDLb4GVZUQNMUpOgCcG7YjHI0DHhQ fWaab/XH1IgI5APdYzrRCmfXlXQcdgjWSxFnoAGzEiY8jLrL6dmuA39PlXb3s/Z/CMAE RYgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=VXwb1qIJ; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q15-v6si699117pgb.510.2018.08.27.17.59.50; Mon, 27 Aug 2018 17:59: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; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=VXwb1qIJ; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727052AbeH1Esq (ORCPT + 32 others); Tue, 28 Aug 2018 00:48:46 -0400 Received: from lelv0143.ext.ti.com ([198.47.23.248]:42376 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725724AbeH1Esp (ORCPT ); Tue, 28 Aug 2018 00:48:45 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id w7S0xPc7057529; Mon, 27 Aug 2018 19:59:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1535417965; bh=IO25pPSBv6KXr/MYJLedbO7tk4i60dfuh04AY61KCNQ=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=VXwb1qIJ204glIdtpCG5d+HtoQqa9Ds8E9YfNqcFKEOrrtyLPYFUe9zNIUKMKlUyr hDXrdetKcDdYCDchql6SWxeNXOiY4639bmabWGC7vdXswygcVNrVphUJBlNh3G3YUu J5DUhWhIt3+ICK6AagA1QJbJMfsVB8lwVRsRFBMY= Received: from DFLE105.ent.ti.com (dfle105.ent.ti.com [10.64.6.26]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w7S0xP0e006143; Mon, 27 Aug 2018 19:59:25 -0500 Received: from DFLE108.ent.ti.com (10.64.6.29) by DFLE105.ent.ti.com (10.64.6.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Mon, 27 Aug 2018 19:59:25 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE108.ent.ti.com (10.64.6.29) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1466.3 via Frontend Transport; Mon, 27 Aug 2018 19:59:25 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w7S0xPMi012834; Mon, 27 Aug 2018 19:59:25 -0500 From: Nishanth Menon To: Santosh Shilimkar , Tero Kristo CC: Rob Herring , , , , Nishanth Menon Subject: [PATCH V3 2/2] firmware: ti_sci: Provide host-id as an optional dt parameter Date: Mon, 27 Aug 2018 19:59:24 -0500 Message-ID: <20180828005924.13092-3-nm@ti.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180828005924.13092-1-nm@ti.com> References: <20180828005924.13092-1-nm@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Texas Instrument's System Control Interface (TISCI) permits the ability for Operating Systems to running in virtual machines to be able to independently communicate with the firmware without the need going through an hypervisor. The "host-id" in effect is the hardware representation of the host (example: VMs locked to a core) as identified to the System Controller. Provide support as an optional parameter implementation and use the compatible data as default if one is not provided by device tree. Signed-off-by: Nishanth Menon --- Changes since V2: * None, just rebase to v4.19-rc1 V2: https://patchwork.kernel.org/patch/10527393/ V1: https://patchwork.kernel.org/patch/10475309/ RFC: https://patchwork.kernel.org/patch/10447715/ drivers/firmware/ti_sci.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) -- 2.15.1 diff --git a/drivers/firmware/ti_sci.c b/drivers/firmware/ti_sci.c index 7fa744793bc5..69ed1464175c 100644 --- a/drivers/firmware/ti_sci.c +++ b/drivers/firmware/ti_sci.c @@ -66,14 +66,14 @@ struct ti_sci_xfers_info { /** * struct ti_sci_desc - Description of SoC integration - * @host_id: Host identifier representing the compute entity + * @default_host_id: Host identifier representing the compute entity * @max_rx_timeout_ms: Timeout for communication with SoC (in Milliseconds) * @max_msgs: Maximum number of messages that can be pending * simultaneously in the system * @max_msg_size: Maximum size of data per message that can be handled. */ struct ti_sci_desc { - u8 host_id; + u8 default_host_id; int max_rx_timeout_ms; int max_msgs; int max_msg_size; @@ -94,6 +94,7 @@ struct ti_sci_desc { * @chan_rx: Receive mailbox channel * @minfo: Message info * @node: list head + * @host_id: Host ID * @users: Number of users of this instance */ struct ti_sci_info { @@ -110,6 +111,7 @@ struct ti_sci_info { struct mbox_chan *chan_rx; struct ti_sci_xfers_info minfo; struct list_head node; + u8 host_id; /* protected by ti_sci_list_mutex */ int users; @@ -370,7 +372,7 @@ static struct ti_sci_xfer *ti_sci_get_one_xfer(struct ti_sci_info *info, hdr->seq = xfer_id; hdr->type = msg_type; - hdr->host = info->desc->host_id; + hdr->host = info->host_id; hdr->flags = msg_flags; return xfer; @@ -1793,7 +1795,7 @@ static int tisci_reboot_handler(struct notifier_block *nb, unsigned long mode, /* Description for K2G */ static const struct ti_sci_desc ti_sci_pmmc_k2g_desc = { - .host_id = 2, + .default_host_id = 2, /* Conservative duration */ .max_rx_timeout_ms = 1000, /* Limited by MBOX_TX_QUEUE_LEN. K2G can handle upto 128 messages! */ @@ -1819,6 +1821,7 @@ static int ti_sci_probe(struct platform_device *pdev) int ret = -EINVAL; int i; int reboot = 0; + u32 h_id; of_id = of_match_device(ti_sci_of_match, dev); if (!of_id) { @@ -1833,6 +1836,19 @@ static int ti_sci_probe(struct platform_device *pdev) info->dev = dev; info->desc = desc; + ret = of_property_read_u32(dev->of_node, "ti,host-id", &h_id); + /* if the property is not present in DT, use a default from desc */ + if (ret < 0) { + info->host_id = info->desc->default_host_id; + } else { + if (!h_id) { + dev_warn(dev, "Host ID 0 is reserved for firmware\n"); + info->host_id = info->desc->default_host_id; + } else { + info->host_id = h_id; + } + } + reboot = of_property_read_bool(dev->of_node, "ti,system-reboot-controller"); INIT_LIST_HEAD(&info->node);