From patchwork Thu Jun 7 06:13:06 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paul Walmsley X-Patchwork-Id: 163484 Return-Path: X-Original-To: incoming-imx@patchwork.ozlabs.org Delivered-To: patchwork-incoming-imx@bilbo.ozlabs.org Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:4978:20e::2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 43269B6FD1 for ; Thu, 7 Jun 2012 16:25:39 +1000 (EST) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1ScW6S-0001PS-Eq; Thu, 07 Jun 2012 06:21:52 +0000 Received: from utopia.booyaka.com ([72.9.107.138]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1ScW6D-0001MT-33 for linux-arm-kernel@lists.infradead.org; Thu, 07 Jun 2012 06:21:38 +0000 Received: (qmail 23441 invoked by uid 1019); 7 Jun 2012 06:21:35 -0000 MBOX-Line: From nobody Thu Jun 7 00:13:06 2012 Subject: [PATCH 01/11] ARM: OMAP2+: hwmod: add setup_preprogram hook To: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org From: Paul Walmsley Date: Thu, 07 Jun 2012 00:13:06 -0600 Message-ID: <20120607061303.25532.65533.stgit@dusk> In-Reply-To: <20120607060901.25532.68354.stgit@dusk> References: <20120607060901.25532.68354.stgit@dusk> User-Agent: StGit/0.16-37-g27ac3 MIME-Version: 1.0 X-Spam-Note: CRM114 invocation failed X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: =?utf-8?b?UMOpdGVy?= Ujfalusi , =?utf-8?q?Beno=C3=AEt?= Cousson X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org List-Id: linux-imx-kernel.lists.patchwork.ozlabs.org After reset, some IP blocks cannot indicate to the PRCM that they are inactive until they are configured. One example on OMAP4 is the AESS IP block. To fix this cleanly, this patch adds another optional function pointer, setup_preprogram, to the IP block's hwmod data. The function that is pointed to is called by the hwmod code immediately after the IP block is reset. Signed-off-by: Paul Walmsley Cc: Benoît Cousson Cc: Péter Ujfalusi --- arch/arm/mach-omap2/omap_hwmod.c | 21 ++++++++++++++++++++- arch/arm/plat-omap/include/plat/omap_hwmod.h | 9 +++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index bf86f7e..b0d3064 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c @@ -2103,6 +2103,23 @@ static void __init _setup_iclk_autoidle(struct omap_hwmod *oh) } /** + * _setup_preprogram - Pre-program an IP block during the _setup() process + * @oh: struct omap_hwmod * + * + * Some IP blocks (such as AESS) require some additional programming + * after reset before they can enter idle. If a function pointer to + * do so is present in the hwmod data, then call it and pass along the + * return value; otherwise, return 0. + */ +static int __init _setup_preprogram(struct omap_hwmod *oh) +{ + if (!oh->class->setup_preprogram) + return 0; + + return oh->class->setup_preprogram(oh); +} + +/** * _setup_reset - reset an IP block during the setup process * @oh: struct omap_hwmod * * @@ -2224,8 +2241,10 @@ static int __init _setup(struct omap_hwmod *oh, void *data) _setup_iclk_autoidle(oh); - if (!_setup_reset(oh)) + if (!_setup_reset(oh)) { + _setup_preprogram(oh); _setup_postsetup(oh); + } return 0; } diff --git a/arch/arm/plat-omap/include/plat/omap_hwmod.h b/arch/arm/plat-omap/include/plat/omap_hwmod.h index c835b71..fdc4b2a 100644 --- a/arch/arm/plat-omap/include/plat/omap_hwmod.h +++ b/arch/arm/plat-omap/include/plat/omap_hwmod.h @@ -458,6 +458,7 @@ struct omap_hwmod_omap4_prcm { * @rev: revision of the IP class * @pre_shutdown: ptr to fn to be executed immediately prior to device shutdown * @reset: ptr to fn to be executed in place of the standard hwmod reset fn + * @setup_preprogram: ptr to fn to be executed after the reset in _setup() * * Represent the class of a OMAP hardware "modules" (e.g. timer, * smartreflex, gpio, uart...) @@ -474,6 +475,13 @@ struct omap_hwmod_omap4_prcm { * executed in place of the standard hwmod _reset() code in * mach-omap2/omap_hwmod.c. This is needed for IP blocks which have * unusual reset sequences - usually processor IP blocks like the IVA. + * + * @setup_preprogram is called between the calls to _setup_reset() and + * _setup_postsetup(). It is intended to be used for IP blocks that + * require some initial configuration during their first + * initialization. (For example, the AESS IP block on OMAP4+ cannot + * enter idle until its internal autogating bit is set.) Most IP blocks + * will not need this. */ struct omap_hwmod_class { const char *name; @@ -481,6 +489,7 @@ struct omap_hwmod_class { u32 rev; int (*pre_shutdown)(struct omap_hwmod *oh); int (*reset)(struct omap_hwmod *oh); + int (*setup_preprogram)(struct omap_hwmod *oh); }; /**