From patchwork Tue Aug 21 14:31:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lokesh Vutla X-Patchwork-Id: 960444 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=quarantine dis=none) header.from=ti.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.b="vD7Guyoh"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 41vtl32TCbz9s7X for ; Wed, 22 Aug 2018 00:45:34 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id B2EC0C21E02; Tue, 21 Aug 2018 14:41:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 277C3C21EA8; Tue, 21 Aug 2018 14:35:35 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id D911BC21E31; Tue, 21 Aug 2018 14:34:02 +0000 (UTC) Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) by lists.denx.de (Postfix) with ESMTPS id 98CE5C21E39 for ; Tue, 21 Aug 2018 14:33:56 +0000 (UTC) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id w7LEXtwC128071; Tue, 21 Aug 2018 09:33:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1534862035; bh=KXDmKg4U2DbpNV8E+AycTLgkTKyIZCJf/gIsz3WXSjc=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=vD7GuyohuGbpthSn5wBTBZJxgMoMCi8hLnDo2962bjEnB9RgWDEL36UPsgrXr1XdO MDAMAsjjp1xFdTNTMYCLgMiHBzVO2lhQm/kIus5ErnCdpRWJ20BdAqRLi6gx0u0bLt GsklPHRuUVFfAyAH/Er1eW1HvjRbZ1QFUfZdM7ao= Received: from DLEE107.ent.ti.com (dlee107.ent.ti.com [157.170.170.37]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w7LEXt16011391; Tue, 21 Aug 2018 09:33:55 -0500 Received: from DLEE105.ent.ti.com (157.170.170.35) by DLEE107.ent.ti.com (157.170.170.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Tue, 21 Aug 2018 09:33:54 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE105.ent.ti.com (157.170.170.35) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1466.3 via Frontend Transport; Tue, 21 Aug 2018 09:33:54 -0500 Received: from uda0131933.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w7LEXKhZ016556; Tue, 21 Aug 2018 09:33:52 -0500 From: Lokesh Vutla To: Tom Rini , Date: Tue, 21 Aug 2018 20:01:52 +0530 Message-ID: <20180821143203.29142-15-lokeshvutla@ti.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180821143203.29142-1-lokeshvutla@ti.com> References: <20180821143203.29142-1-lokeshvutla@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Cc: Tero Kristo Subject: [U-Boot] [PATCH 14/25] power domain: Add support for multiple powerdomains per device X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" There are cases where there are more than one power domain attached to the device inorder to get the device functional. So add support for enabling power domain based on the index. Signed-off-by: Lokesh Vutla Reviewed-by: Tom Rini --- drivers/power/domain/power-domain-uclass.c | 11 +++++++++-- include/power-domain.h | 19 +++++++++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/drivers/power/domain/power-domain-uclass.c b/drivers/power/domain/power-domain-uclass.c index 9e9ec4f419..2ea0ff24c7 100644 --- a/drivers/power/domain/power-domain-uclass.c +++ b/drivers/power/domain/power-domain-uclass.c @@ -28,7 +28,8 @@ static int power_domain_of_xlate_default(struct power_domain *power_domain, return 0; } -int power_domain_get(struct udevice *dev, struct power_domain *power_domain) +int power_domain_get_by_index(struct udevice *dev, + struct power_domain *power_domain, int index) { struct ofnode_phandle_args args; int ret; @@ -38,7 +39,8 @@ int power_domain_get(struct udevice *dev, struct power_domain *power_domain) debug("%s(dev=%p, power_domain=%p)\n", __func__, dev, power_domain); ret = dev_read_phandle_with_args(dev, "power-domains", - "#power-domain-cells", 0, 0, &args); + "#power-domain-cells", 0, index, + &args); if (ret) { debug("%s: dev_read_phandle_with_args failed: %d\n", __func__, ret); @@ -73,6 +75,11 @@ int power_domain_get(struct udevice *dev, struct power_domain *power_domain) return 0; } +int power_domain_get(struct udevice *dev, struct power_domain *power_domain) +{ + return power_domain_get_by_index(dev, power_domain, 0); +} + int power_domain_free(struct power_domain *power_domain) { struct power_domain_ops *ops = power_domain_dev_ops(power_domain->dev); diff --git a/include/power-domain.h b/include/power-domain.h index a558fbbdb2..0c6d77e813 100644 --- a/include/power-domain.h +++ b/include/power-domain.h @@ -97,6 +97,25 @@ int power_domain_get(struct udevice *dev, struct power_domain *power_domain) } #endif +/** + * power_domain_get_by_index - Get the indexed power domain for a device. + * + * @dev: The client device. + * @power_domain: A pointer to a power domain struct to initialize. + * @index: Power domain index to be powered on. + * + * @return 0 if OK, or a negative error code. + */ +#if CONFIG_IS_ENABLED(POWER_DOMAIN) +int power_domain_get_by_index(struct udevice *dev, + struct power_domain *power_domain, int index); +#else +int power_domain_get_by_index(struct udevice *dev, + struct power_domain *power_domain, int index) + return -ENOSYS; +} +#endif + /** * power_domain_free - Free a previously requested power domain. *