From patchwork Fri Dec 18 13:58:54 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tero Kristo X-Patchwork-Id: 58673 Delivered-To: patch@linaro.org Received: by 10.112.89.199 with SMTP id bq7csp1042117lbb; Fri, 18 Dec 2015 05:58:41 -0800 (PST) X-Received: by 10.66.136.108 with SMTP id pz12mr5303432pab.93.1450447106823; Fri, 18 Dec 2015 05:58:26 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id va5si24205142pac.165.2015.12.18.05.58.26; Fri, 18 Dec 2015 05:58:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-omap-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932616AbbLRN6Y (ORCPT + 3 others); Fri, 18 Dec 2015 08:58:24 -0500 Received: from arroyo.ext.ti.com ([192.94.94.40]:57254 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932474AbbLRN5y (ORCPT ); Fri, 18 Dec 2015 08:57:54 -0500 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id tBIDvSCE015814; Fri, 18 Dec 2015 07:57:28 -0600 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id tBIDvSSC007573; Fri, 18 Dec 2015 07:57:28 -0600 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.3.224.2; Fri, 18 Dec 2015 07:57:28 -0600 Received: from localhost.localdomain (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id tBIDvKUD021403; Fri, 18 Dec 2015 07:57:26 -0600 From: Tero Kristo To: , , , , CC: Subject: [RFC 2/9] ARM: OMAP2+: hwmod: initialize main clocks directly from DT Date: Fri, 18 Dec 2015 15:58:54 +0200 Message-ID: <1450447141-29936-3-git-send-email-t-kristo@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1450447141-29936-1-git-send-email-t-kristo@ti.com> References: <1450447141-29936-1-git-send-email-t-kristo@ti.com> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org This avoids the need to add clock aliases under drivers/clk/ti/clk-xyz.c files. Signed-off-by: Tero Kristo --- arch/arm/mach-omap2/omap_hwmod.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index 48495ad..5fa8965 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c @@ -786,11 +786,20 @@ static int _init_main_clk(struct omap_hwmod *oh) if (!oh->main_clk) return 0; - oh->_clk = clk_get(NULL, oh->main_clk); - if (IS_ERR(oh->_clk)) { - pr_warn("omap_hwmod: %s: cannot clk_get main_clk %s\n", - oh->name, oh->main_clk); - return -EINVAL; + if (of_have_populated_dt()) { + struct of_phandle_args clkspec; + + clkspec.np = of_find_node_by_name(NULL, oh->main_clk); + oh->_clk = of_clk_get_from_provider(&clkspec); + } + + if (!oh->_clk) { + oh->_clk = clk_get(NULL, oh->main_clk); + if (IS_ERR(oh->_clk)) { + pr_warn("omap_hwmod: %s: cannot clk_get main_clk %s\n", + oh->name, oh->main_clk); + return -EINVAL; + } } /* * HACK: This needs a re-visit once clk_prepare() is implemented