From patchwork Thu Dec 12 11:38:27 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajendra Nayak X-Patchwork-Id: 3331501 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E31A69F37A for ; Thu, 12 Dec 2013 11:39:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D07BB207DD for ; Thu, 12 Dec 2013 11:39:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 38D3A2041D for ; Thu, 12 Dec 2013 11:39:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751686Ab3LLLjM (ORCPT ); Thu, 12 Dec 2013 06:39:12 -0500 Received: from devils.ext.ti.com ([198.47.26.153]:59549 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751606Ab3LLLjJ (ORCPT ); Thu, 12 Dec 2013 06:39:09 -0500 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id rBCBcffJ018218; Thu, 12 Dec 2013 05:38:41 -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 rBCBcfWS009036; Thu, 12 Dec 2013 05:38:41 -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.2.342.3; Thu, 12 Dec 2013 05:38:41 -0600 Received: from ula0131687.apr.dhcp.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id rBCBcYM5024981; Thu, 12 Dec 2013 05:38:38 -0600 From: Rajendra Nayak To: , , , CC: , , , , Rajendra Nayak Subject: [PATCH v2 1/3] ARM: OMAP2+: Add support to parse 'main_clk' info from DT Date: Thu, 12 Dec 2013 17:08:27 +0530 Message-ID: <1386848309-14076-2-git-send-email-rnayak@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1386848309-14076-1-git-send-email-rnayak@ti.com> References: <1386848309-14076-1-git-send-email-rnayak@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 X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP With clocks for OMAP moving to DT, its now possible to pass the 'main_clk' data for each device from DT instead of having it in hwmod. Signed-off-by: Rajendra Nayak --- arch/arm/mach-omap2/omap_hwmod.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index dfa878b..f22bbbb 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c @@ -730,14 +730,18 @@ static int _del_initiator_dep(struct omap_hwmod *oh, struct omap_hwmod *init_oh) * functional clock pointer) if a main_clk is present. Returns 0 on * success or -EINVAL on error. */ -static int _init_main_clk(struct omap_hwmod *oh) +static int _init_main_clk(struct omap_hwmod *oh, struct device_node *np) { int ret = 0; - if (!oh->main_clk) + if (!oh->main_clk && !of_get_property(np, "clocks", NULL)) return 0; - oh->_clk = clk_get(NULL, oh->main_clk); + if (oh->main_clk) + oh->_clk = clk_get(NULL, oh->main_clk); + else + oh->_clk = of_clk_get_by_name(np, "fck"); + if (IS_ERR(oh->_clk)) { pr_warning("omap_hwmod: %s: cannot clk_get main_clk %s\n", oh->name, oh->main_clk); @@ -1565,19 +1569,26 @@ static int _init_clkdm(struct omap_hwmod *oh) * Resolves all clock names embedded in the hwmod. Returns 0 on * success, or a negative error code on failure. */ -static int _init_clocks(struct omap_hwmod *oh, void *data) +static int _init_clocks(struct omap_hwmod *oh, void *data, + int index, struct device_node *np) { int ret = 0; if (oh->_state != _HWMOD_STATE_REGISTERED) return 0; + if (index) { + pr_warn("omap_hwmod: %s unable to parse clock data from %s\n", + oh->name, np->name); + np = NULL; + } + pr_debug("omap_hwmod: %s: looking up clocks\n", oh->name); if (soc_ops.init_clkdm) ret |= soc_ops.init_clkdm(oh); - ret |= _init_main_clk(oh); + ret |= _init_main_clk(oh, np); ret |= _init_interface_clks(oh); ret |= _init_opt_clks(oh); @@ -2500,7 +2511,7 @@ static int __init _init(struct omap_hwmod *oh, void *data) } } - r = _init_clocks(oh, NULL); + r = _init_clocks(oh, NULL, index, np); if (r < 0) { WARN(1, "omap_hwmod: %s: couldn't init clocks\n", oh->name); return -EINVAL;