From patchwork Mon Jul 29 09:12:41 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajendra Nayak X-Patchwork-Id: 2834862 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4EB46C0319 for ; Mon, 29 Jul 2013 09:13:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 54716200E1 for ; Mon, 29 Jul 2013 09:13:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1A08A20126 for ; Mon, 29 Jul 2013 09:13:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752071Ab3G2JNU (ORCPT ); Mon, 29 Jul 2013 05:13:20 -0400 Received: from devils.ext.ti.com ([198.47.26.153]:47732 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752067Ab3G2JNT (ORCPT ); Mon, 29 Jul 2013 05:13:19 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id r6T9Cvbs030707; Mon, 29 Jul 2013 04:12:57 -0500 Received: from DLEE70.ent.ti.com (dlee70.ent.ti.com [157.170.170.113]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id r6T9Cvs4014176; Mon, 29 Jul 2013 04:12:57 -0500 Received: from dlelxv22.itg.ti.com (172.17.1.197) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.2.342.3; Mon, 29 Jul 2013 04:12:57 -0500 Received: from ula0131687.itg.ti.com (ula0131687-172024145046.apr.dhcp.ti.com [172.24.145.46]) by dlelxv22.itg.ti.com (8.13.8/8.13.8) with ESMTP id r6T9CqZN024245; Mon, 29 Jul 2013 04:12:55 -0500 From: Rajendra Nayak To: , CC: , , Rajendra Nayak Subject: [RFC 1/2] ARM: OMAP2+: hwmod: Split _init() into _init_early() and _init_late() Date: Mon, 29 Jul 2013 14:42:41 +0530 Message-ID: <1375089162-30664-2-git-send-email-rnayak@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1375089162-30664-1-git-send-email-rnayak@ti.com> References: <1375089162-30664-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=-8.4 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 Split the _init() function into something that can be done early and the rest which can be done late (during drivers inits). This is done in preperation to remove the hwmod dependency to do all clock inits (which inturn need clockdomain and other frameworks to be in place) and module resets quite early in boot, and instead do these on demand when the drivers initialize. Signed-off-by: Rajendra Nayak --- arch/arm/mach-omap2/omap_hwmod.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index 7341eff..e49159c 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c @@ -2415,16 +2415,21 @@ static void __init _init_mpu_rt_base(struct omap_hwmod *oh, void *data) * upon success or if the hwmod isn't registered, or -EINVAL upon * failure. */ -static int __init _init(struct omap_hwmod *oh, void *data) +static int __init _init_early(struct omap_hwmod *oh, void *data) { - int r; - if (oh->_state != _HWMOD_STATE_REGISTERED) return 0; if (oh->class->sysc) _init_mpu_rt_base(oh, NULL); + return 0; +} + +static int __init _init_late(struct omap_hwmod *oh, void *data) +{ + int r; + r = _init_clocks(oh, NULL); if (r < 0) { WARN(1, "omap_hwmod: %s: couldn't init clocks\n", oh->name); @@ -3284,7 +3289,8 @@ int __init omap_hwmod_setup_one(const char *oh_name) _ensure_mpu_hwmod_is_setup(oh); - _init(oh, NULL); + _init_early(oh, NULL); + _init_late(oh, NULL); _setup(oh, NULL); return 0; @@ -3302,7 +3308,8 @@ static int __init omap_hwmod_setup_all(void) { _ensure_mpu_hwmod_is_setup(NULL); - omap_hwmod_for_each(_init, NULL); + omap_hwmod_for_each(_init_early, NULL); + omap_hwmod_for_each(_init_late, NULL); omap_hwmod_for_each(_setup, NULL); return 0;