From patchwork Tue Jan 25 19:27:20 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Lindgren X-Patchwork-Id: 506661 X-Patchwork-Delegate: tony@atomide.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p0PJRlEC027592 for ; Tue, 25 Jan 2011 19:27:48 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751680Ab1AYT1p (ORCPT ); Tue, 25 Jan 2011 14:27:45 -0500 Received: from mho-02-ewr.mailhop.org ([204.13.248.72]:30534 "EHLO mho-02-ewr.mailhop.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751460Ab1AYT1p (ORCPT ); Tue, 25 Jan 2011 14:27:45 -0500 Received: from c-24-130-172-179.hsd1.ca.comcast.net ([24.130.172.179] helo=localhost.localdomain) by mho-02-ewr.mailhop.org with esmtpa (Exim 4.72) (envelope-from ) id 1PhoYK-000PVC-3y; Tue, 25 Jan 2011 19:27:44 +0000 Received: from Mutt by mutt-smtp-wrapper.pl 1.2 (www.zdo.com/articles/mutt-smtp-wrapper.shtml) X-Mail-Handler: MailHop Outbound by DynDNS X-Originating-IP: 24.130.172.179 X-Report-Abuse-To: abuse@dyndns.com (see http://www.dyndns.com/services/mailhop/outbound_abuse.html for abuse reporting information) X-MHO-User: U2FsdGVkX191llp94GLGo7a7Q88/Tv/q Date: Tue, 25 Jan 2011 11:27:20 -0800 From: Tony Lindgren To: Russell King - ARM Linux , Paul Walmsley Cc: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH] omap: hwmod: Populate _mpu_rt_va later on in omap_hwmod_late_init Message-ID: <20110125192719.GO13589@atomide.com> References: <20110123171344.GH30094@n2100.arm.linux.org.uk> <20110123174814.GI30094@n2100.arm.linux.org.uk> <20110124201731.GC13589@atomide.com> <20110124202629.GE13589@atomide.com> <20110124215213.GA27044@n2100.arm.linux.org.uk> <20110125022119.GG13589@atomide.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20110125022119.GG13589@atomide.com> User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Tue, 25 Jan 2011 19:27:51 +0000 (UTC) diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index eacdfd3..9e89a58 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c @@ -1467,12 +1467,10 @@ static int __init _register(struct omap_hwmod *oh) return -EEXIST; ms_id = _find_mpu_port_index(oh); - if (!IS_ERR_VALUE(ms_id)) { + if (!IS_ERR_VALUE(ms_id)) oh->_mpu_port_index = ms_id; - oh->_mpu_rt_va = _find_mpu_rt_base(oh, oh->_mpu_port_index); - } else { + else oh->_int_flags |= _HWMOD_NO_MPU_PORT; - } list_add_tail(&oh->node, &omap_hwmod_list); @@ -1621,6 +1619,26 @@ int __init omap_hwmod_init(struct omap_hwmod **ohs) return 0; } +/* + * _populate_mpu_rt_base - populate the virtual address for a hwmod + * + * Must be called only from omap_hwmod_late_init so ioremap works properly. + * Assumes the caller takes care of locking if needed. + * + */ +static int __init _populate_mpu_rt_base(struct omap_hwmod *oh, void *data) +{ + if (oh->_int_flags & _HWMOD_NO_MPU_PORT) + return 0; + + oh->_mpu_rt_va = _find_mpu_rt_base(oh, oh->_mpu_port_index); + if (!oh->_mpu_rt_va) + pr_warning("omap_hwmod: %s found no _mpu_rt_va for %s\n", + __func__, oh->name); + + return 0; +} + /** * omap_hwmod_late_init - do some post-clock framework initialization * @@ -1632,6 +1650,8 @@ static int __init omap_hwmod_late_init(void) { int r; + r = omap_hwmod_for_each(_populate_mpu_rt_base, NULL); + /* XXX check return value */ r = omap_hwmod_for_each(_init_clocks, NULL); WARN(r, "omap_hwmod: omap_hwmod_late_init(): _init_clocks failed\n");