From patchwork Tue Jun 5 06:26:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nishanth Menon X-Patchwork-Id: 10447715 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B81CA60467 for ; Tue, 5 Jun 2018 06:33:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A5E43209D8 for ; Tue, 5 Jun 2018 06:33:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9A69527D16; Tue, 5 Jun 2018 06:33:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3DE33209D8 for ; Tue, 5 Jun 2018 06:33:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Ya8tSVMA9La1DvubSJZtcOuxEt1yLCN3DBS4Pwra98E=; b=Gpnyl+ZSnEHrZx 4xe3/+Bqe03kxClZZSdgGzHqNyjyBwcllTqItvJnCoLDk6UQ6ekjtr9Q1P9yHpCWSc9iFjKRRtDhh IuCtoF2pDI4HiFYiiPZr6ZW+gZsv8SJdoJ0IJPZBELr4R+ERuU+LPh/vp8XeLopKyP07B9rl8ZXRy 2STvWp0kkotojAojFGnEt/rqX8oKnU+C4Jiw9VKn9M20Dv5PtRy012jKCfV5dmqpxqhzYpSbqyiUu xY/TSi7/5rpoyeySN+6CZZz4sxNWYimw9VtWDor+cLtPEw4K883jXoFUNFm9sWaYsUncBsrlaMRvn hGFdeoXBUIOP3Ht5Kfrw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fQ5X7-0002us-Pz; Tue, 05 Jun 2018 06:33:29 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fQ5X6-0002oR-3T for linux-arm-kernel@bombadil.infradead.org; Tue, 05 Jun 2018 06:33:28 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:CC:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=nuhgxDwjzT6r6cAVm3FeQccB5wfjbiWBZ7tfXt7CvRw=; b=bXbXiqdbDT1vUh1buTZIU1BXE HSys8vYey1mgL4pwJgQxxDbyyd93bwOtJF38yYBjBFzoR241ZJkn71lzdZ9aBpnPfDOmJqk+/VaEm DgAEdO11N96SaQwRrZWlXcWa96cJsbI+Q15hwr2Ddn3wCsWZsfIIhaJODad78Ib5392bFpCtAwWeu xQbWUknGe3T1gc7E1kyIfwzsGdAqVqGJXbEww6bcBrr+PvirUxmHJIjD/uZZ1vwEXyvLK1eF9+TbB pjvKYiyB2XHP14RD0jOC5rDwZb+2qKWG4oygRi5dSk/5zzYNxq35Q6zZ1+JHE4ggOq5fyUcLUxlJh mS3X1TytQ==; Received: from lelnx194.ext.ti.com ([198.47.27.80]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fQ5Qk-0007IF-3u for linux-arm-kernel@lists.infradead.org; Tue, 05 Jun 2018 06:26:57 +0000 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by lelnx194.ext.ti.com (8.15.1/8.15.1) with ESMTP id w556QeK5002934; Tue, 5 Jun 2018 01:26:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1528180000; bh=nuhgxDwjzT6r6cAVm3FeQccB5wfjbiWBZ7tfXt7CvRw=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=IcwXZT+WxkTgBlCBKyCNA/4Se/ZbB3dgH93oA7KGy/a8keAY9JWhJQHl2UYKm4UIp 8Tn6EGtJdQqL/KLT0CUsTle3kWKT2KQo1mIpCuxbhVvYEBUHNLj4vQLXR8WfFoWFH/ 3kViPZLDtgUzMorpEo2VusjuhyRI+eTRcr2Hlwos= Received: from DFLE100.ent.ti.com (dfle100.ent.ti.com [10.64.6.21]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w556Qewx029107; Tue, 5 Jun 2018 01:26:40 -0500 Received: from DFLE101.ent.ti.com (10.64.6.22) by DFLE100.ent.ti.com (10.64.6.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Tue, 5 Jun 2018 01:26:40 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE101.ent.ti.com (10.64.6.22) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1466.3 via Frontend Transport; Tue, 5 Jun 2018 01:26:40 -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 w556QenZ002091; Tue, 5 Jun 2018 01:26:40 -0500 From: Nishanth Menon To: Rob Herring , Santosh Shilimkar , Tero Kristo , Nishanth Menon Subject: [RFC PATCH 2/3] firmware: ti_sci: Provide host-id as an optional dt parameter Date: Tue, 5 Jun 2018 01:26:39 -0500 Message-ID: <20180605062640.3356-3-nm@ti.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180605062640.3356-1-nm@ti.com> References: <20180605062640.3356-1-nm@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180605_072654_516785_45E1DCA8 X-CRM114-Status: GOOD ( 18.18 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- drivers/firmware/ti_sci.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/drivers/firmware/ti_sci.c b/drivers/firmware/ti_sci.c index b74a533ef35b..6b08ee815b24 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);