From patchwork Wed Apr 10 05:37:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lokesh Vutla X-Patchwork-Id: 10893169 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 28B1F1669 for ; Wed, 10 Apr 2019 05:38:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0DE292890F for ; Wed, 10 Apr 2019 05:38:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 01A2F289E5; Wed, 10 Apr 2019 05:38:33 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham 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 87E5A2890F for ; Wed, 10 Apr 2019 05:38:33 +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=fasAAcwxMvJ6JBXESX5VWlpZq/A5UB1wSapgLdCj7Ck=; b=mBYVNxKs1vDgfe 3LQ8O08wmp5f/O1cU3x+vn8R8y30oaIUo6u+BpFXc4timTItkFDOuEf7hd49r/uLlRAr7K4FMc3t5 l/yqaCX2phMuAeeII98VtSMrCry5LamzGe+Zwl73DY+dkLq0KhpbJ5Mep38TRJTGz3tFxl6zzYSBw 65R2uvnaUCDxvP8ojZDKZZAg4xePdFsrfeE/XTsmaORcLPjvRnF/7bjzjzH0j+Ohp8tJPCwsxbPWF 4BLT9YvIg3ufze4bP6tx0mqQsZh6g7o/V6ETsJGwfC/SlTgDwRm+kgclci3OfIq4TWeixlpbowhuL VcStcjph4Wi42Wc6tsPA==; 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 1hE5wN-0002m1-KL; Wed, 10 Apr 2019 05:38:31 +0000 Received: from lelv0143.ext.ti.com ([198.47.23.248]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hE5vu-0002AU-Oy for linux-arm-kernel@lists.infradead.org; Wed, 10 Apr 2019 05:38:06 +0000 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id x3A5c1wt067017; Wed, 10 Apr 2019 00:38:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1554874681; bh=oqD8mY/Ph/L1shghrlc1tagdDiG3j4oWCQ8n+jZbrt8=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=dAOfyvNbXbeh0S0+a46YnUc+U202j6t7zaTa60u9iEecmVcmefD3szaZ/8hqxyEo6 Z1tCsQZoFCJPS7Wa4yG8JOmloq/qeswK1FBqCwA5vYiJtMUaxDZq5lr/CBHtuRdjQF WEX8VJkYPmxE4/3b30M6TuQ7caSRnxpTRRHUe1tQ= Received: from DLEE105.ent.ti.com (dlee105.ent.ti.com [157.170.170.35]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x3A5c1Gw015230 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 10 Apr 2019 00:38:01 -0500 Received: from DLEE106.ent.ti.com (157.170.170.36) by DLEE105.ent.ti.com (157.170.170.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Wed, 10 Apr 2019 00:38:00 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DLEE106.ent.ti.com (157.170.170.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Wed, 10 Apr 2019 00:38:00 -0500 Received: from uda0131933.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id x3A5boIM116462; Wed, 10 Apr 2019 00:37:58 -0500 From: Lokesh Vutla To: Nishanth Menon , Tero Kristo , Santosh Shilimkar , Rob Herring Subject: [PATCH v3 3/5] soc: ti: ti_sci_pm_domains: Add support for exclusive and shared access Date: Wed, 10 Apr 2019 11:07:26 +0530 Message-ID: <20190410053728.17374-4-lokeshvutla@ti.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190410053728.17374-1-lokeshvutla@ti.com> References: <20190410053728.17374-1-lokeshvutla@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-20190409_223803_138769_8A5C3C05 X-CRM114-Status: GOOD ( 18.80 ) 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: Lokesh Vutla , Device Tree Mailing List , Sekhar Nori , Linux ARM Mailing List 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 TISCI protocol supports for enabling the device either with exclusive permissions for the requesting host or with sharing across the hosts. There are certain devices which are exclusive to Linux context and there are certain devices that are shared across different host contexts. So add support for getting this information from DT by increasing the power-domain cells to 2. For keeping the DT backward compatibility intact, defaulting the device permissions to set the exclusive flag set. In this case the power-domain-cells is 1. Signed-off-by: Lokesh Vutla --- drivers/soc/ti/ti_sci_pm_domains.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/drivers/soc/ti/ti_sci_pm_domains.c b/drivers/soc/ti/ti_sci_pm_domains.c index de31b9389e2e..d017e3dc232c 100644 --- a/drivers/soc/ti/ti_sci_pm_domains.c +++ b/drivers/soc/ti/ti_sci_pm_domains.c @@ -23,15 +23,19 @@ #include #include #include +#include /** * struct ti_sci_genpd_dev_data: holds data needed for every device attached * to this genpd * @idx: index of the device that identifies it with the system * control processor. + * @exclusive: Permissions for exclusive request or shared request of the + * device. */ struct ti_sci_genpd_dev_data { int idx; + u8 exclusive; }; /** @@ -63,6 +67,14 @@ static int ti_sci_dev_id(struct device *dev) return sci_dev_data->idx; } +static u8 is_ti_sci_dev_exclusive(struct device *dev) +{ + struct generic_pm_domain_data *genpd_data = dev_gpd_data(dev); + struct ti_sci_genpd_dev_data *sci_dev_data = genpd_data->data; + + return sci_dev_data->exclusive; +} + /** * ti_sci_dev_to_sci_handle(): get pointer to ti_sci_handle * @dev: pointer to device associated with this genpd @@ -87,7 +99,10 @@ static int ti_sci_dev_start(struct device *dev) const struct ti_sci_handle *ti_sci = ti_sci_dev_to_sci_handle(dev); int idx = ti_sci_dev_id(dev); - return ti_sci->ops.dev_ops.get_device(ti_sci, idx); + if (is_ti_sci_dev_exclusive(dev)) + return ti_sci->ops.dev_ops.get_device_exclusive(ti_sci, idx); + else + return ti_sci->ops.dev_ops.get_device(ti_sci, idx); } /** @@ -118,7 +133,7 @@ static int ti_sci_pd_attach_dev(struct generic_pm_domain *domain, if (ret < 0) return ret; - if (pd_args.args_count != 1) + if (pd_args.args_count != 1 && pd_args.args_count != 2) return -EINVAL; idx = pd_args.args[0]; @@ -136,6 +151,10 @@ static int ti_sci_pd_attach_dev(struct generic_pm_domain *domain, return -ENOMEM; sci_dev_data->idx = idx; + /* Enable the exclusive permissions by default */ + sci_dev_data->exclusive = TI_SCI_PD_EXCLUSIVE; + if (pd_args.args_count == 2) + sci_dev_data->exclusive = pd_args.args[1] & 0x1; genpd_data = dev_gpd_data(dev); genpd_data->data = sci_dev_data;