From patchwork Mon Feb 18 05:15:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lokesh Vutla X-Patchwork-Id: 1043787 Return-Path: X-Original-To: incoming-dt@patchwork.ozlabs.org Delivered-To: patchwork-incoming-dt@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=devicetree-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.b="g9d2Yiy8"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 442sXJ1lsLz9s3x for ; Mon, 18 Feb 2019 16:16:00 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725861AbfBRFP5 (ORCPT ); Mon, 18 Feb 2019 00:15:57 -0500 Received: from fllv0015.ext.ti.com ([198.47.19.141]:48014 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725766AbfBRFP4 (ORCPT ); Mon, 18 Feb 2019 00:15:56 -0500 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id x1I5Fk2H083659; Sun, 17 Feb 2019 23:15:46 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1550466946; bh=UlWnmsL1w1hS1UaqWrm66gIFeCg2lQPInjIbsAzZDcU=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=g9d2Yiy8HeYySJzDwz97fva0q350kf2vpfx3EUnWGdIi70ofKYN3qPHbrLP7lkXW+ 3SV4UcSXA1AXtFOAw1ESl86FcHnGTN7G1O4N6waOEtvAYJLrsGVbr34X6e8nBTaxof DKkJA+vSAGC+htkUr6TLUx685TckyO/ZHcStStJk= Received: from DLEE108.ent.ti.com (dlee108.ent.ti.com [157.170.170.38]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x1I5FkgO052355 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Sun, 17 Feb 2019 23:15:46 -0600 Received: from DLEE107.ent.ti.com (157.170.170.37) by DLEE108.ent.ti.com (157.170.170.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10; Sun, 17 Feb 2019 23:15:45 -0600 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE107.ent.ti.com (157.170.170.37) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1591.10 via Frontend Transport; Sun, 17 Feb 2019 23:15:45 -0600 Received: from uda0131933.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id x1I5FbKi029067; Sun, 17 Feb 2019 23:15:43 -0600 From: Lokesh Vutla To: Nishanth Menon , Tero Kristo , Santosh Shilimkar , Rob Herring CC: Linux ARM Mailing List , Device Tree Mailing List , Sekhar Nori , Lokesh Vutla Subject: [PATCH 2/4] soc: ti: ti_sci_pm_domains: Add support for exclusive access Date: Mon, 18 Feb 2019 10:45:15 +0530 Message-ID: <20190218051517.9218-3-lokeshvutla@ti.com> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20190218051517.9218-1-lokeshvutla@ti.com> References: <20190218051517.9218-1-lokeshvutla@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org TISCI protocol supports for enabling the device with exclusive permissions. Certain remoteproc devices or some shared devices across VM doesn't wants to request devices with this flag set. So add support for getting this information from DT. With this power-domain-cells are increased 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 --- .../bindings/soc/ti/sci-pm-domain.txt | 7 ++++-- drivers/soc/ti/ti_sci_pm_domains.c | 22 +++++++++++++++++-- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/Documentation/devicetree/bindings/soc/ti/sci-pm-domain.txt b/Documentation/devicetree/bindings/soc/ti/sci-pm-domain.txt index f7b00a7c0f68..5fdda7475023 100644 --- a/Documentation/devicetree/bindings/soc/ti/sci-pm-domain.txt +++ b/Documentation/devicetree/bindings/soc/ti/sci-pm-domain.txt @@ -19,8 +19,11 @@ child of the pmmc node. Required Properties: -------------------- - compatible: should be "ti,sci-pm-domain" -- #power-domain-cells: Must be 1 so that an id can be provided in each - device node. +- #power-domain-cells: Can be one of the following: + 1: Containing the device id of each node + 2: First entry should be device id + Second entry should be 1 or 0. Use 1 for enabling + the device with exclusive permissions set else 0. Example (K2G): ------------- diff --git a/drivers/soc/ti/ti_sci_pm_domains.c b/drivers/soc/ti/ti_sci_pm_domains.c index de31b9389e2e..4dae42651212 100644 --- a/drivers/soc/ti/ti_sci_pm_domains.c +++ b/drivers/soc/ti/ti_sci_pm_domains.c @@ -24,6 +24,8 @@ #include #include +#define PD_REQUEST_EXCLUSIVE BIT(0) + /** * struct ti_sci_genpd_dev_data: holds data needed for every device attached * to this genpd @@ -32,6 +34,7 @@ */ struct ti_sci_genpd_dev_data { int idx; + u8 exclusive; }; /** @@ -63,6 +66,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 & PD_REQUEST_EXCLUSIVE; +} + /** * ti_sci_dev_to_sci_handle(): get pointer to ti_sci_handle * @dev: pointer to device associated with this genpd @@ -87,7 +98,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 +132,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 +150,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 = PD_REQUEST_EXCLUSIVE; + if (pd_args.args_count == 2) + sci_dev_data->exclusive = pd_args.args[1]; genpd_data = dev_gpd_data(dev); genpd_data->data = sci_dev_data;