From patchwork Mon Aug 27 10:27:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lokesh Vutla X-Patchwork-Id: 962451 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="bvsDLq6M"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 41zT2C5SNfz9s2P for ; Mon, 27 Aug 2018 20:41:07 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 6B29DC21E52; Mon, 27 Aug 2018 10:36:07 +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 9CB44C21DF8; Mon, 27 Aug 2018 10:31:21 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 7AA6FC21E35; Mon, 27 Aug 2018 10:29:50 +0000 (UTC) Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) by lists.denx.de (Postfix) with ESMTPS id E064AC21E16 for ; Mon, 27 Aug 2018 10:29:45 +0000 (UTC) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id w7RATiBl119869; Mon, 27 Aug 2018 05:29:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1535365784; bh=vuxtOM/HhmDyDVJv/forIELZph/T5VN3hvS/fFsb3wM=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=bvsDLq6MZid1iQhVIwgSwNtznGfLD3Q9g8wfrXSl4+FO85nwCXvdNAxFRp9PxRf0l 14yuCG1O8q8NEObREmcXNlehG1qr0e8/JriQe/4XicnoxZGDqmqzFPdkJj3xXWhFrD 5MTXQYOT+TBvuaVzlo9Zq5MvJQINl17YQquKcmm4= Received: from DFLE103.ent.ti.com (dfle103.ent.ti.com [10.64.6.24]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w7RATihP008866; Mon, 27 Aug 2018 05:29:44 -0500 Received: from DFLE100.ent.ti.com (10.64.6.21) by DFLE103.ent.ti.com (10.64.6.24) 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 05:29:44 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DFLE100.ent.ti.com (10.64.6.21) 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 05:29:44 -0500 Received: from uda0131933.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id w7RATD8x013068; Mon, 27 Aug 2018 05:29:42 -0500 From: Lokesh Vutla To: Tom Rini , Date: Mon, 27 Aug 2018 15:57:44 +0530 Message-ID: <20180827102755.5784-14-lokeshvutla@ti.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180827102755.5784-1-lokeshvutla@ti.com> References: <20180827102755.5784-1-lokeshvutla@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Cc: Tero Kristo Subject: [U-Boot] [PATCH v2 13/24] 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. Reviewed-by: Tom Rini Signed-off-by: Lokesh Vutla --- drivers/power/domain/power-domain-uclass.c | 11 +++++++++-- include/power-domain.h | 21 +++++++++++++++++++++ 2 files changed, 30 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..00996057b0 100644 --- a/include/power-domain.h +++ b/include/power-domain.h @@ -97,6 +97,27 @@ 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 +static inline +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. *