From patchwork Wed Jan 9 15:03:07 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sebastien Guiriec X-Patchwork-Id: 1953161 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 6D578DFB80 for ; Wed, 9 Jan 2013 15:03:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758007Ab3AIPDZ (ORCPT ); Wed, 9 Jan 2013 10:03:25 -0500 Received: from bear.ext.ti.com ([192.94.94.41]:42938 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757995Ab3AIPDX (ORCPT ); Wed, 9 Jan 2013 10:03:23 -0500 Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id r09F3JE3017507; Wed, 9 Jan 2013 09:03:19 -0600 Received: from DLEE74.ent.ti.com (dlee74.ent.ti.com [157.170.170.8]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id r09F3JRW012750; Wed, 9 Jan 2013 09:03:19 -0600 Received: from dlelxv22.itg.ti.com (172.17.1.197) by DLEE74.ent.ti.com (157.170.170.8) with Microsoft SMTP Server id 14.1.323.3; Wed, 9 Jan 2013 09:03:19 -0600 Received: from unb0919150.emea.dhcp.ti.com (unb0919150.emea.dhcp.ti.com [137.167.110.144]) by dlelxv22.itg.ti.com (8.13.8/8.13.8) with ESMTP id r09F3FJH007913; Wed, 9 Jan 2013 09:03:17 -0600 From: Sebastien Guiriec To: Sebastien Guiriec , =?UTF-8?q?Beno=C3=AEt=20Cousson?= , Paul Walmsley , Tony Lindgren , CC: , Peter Ujfalusi , Liam Girdwood , Tero Kristo , Jon Hunter , Felipe Balbi Subject: [PATCH v2 1/5] ARM: OMAP2+: hwmod: add enable_preprogram hook Date: Wed, 9 Jan 2013 16:03:07 +0100 Message-ID: <1357743792-13917-2-git-send-email-s-guiriec@ti.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1357743792-13917-1-git-send-email-s-guiriec@ti.com> References: <1357743792-13917-1-git-send-email-s-guiriec@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 From: Paul Walmsley After setup/enable, some IP blocks need some additional setting to indicate the PRCM that they are inactive until they are configured. Some examples on OMAP4 include the AESS and FSUSB IP blocks. 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 Signed-off-by: Sebastien Guiriec Cc: Benoît Cousson Cc: Péter Ujfalusi Cc: Felipe Balbi --- arch/arm/mach-omap2/omap_hwmod.c | 18 ++++++++++++++++++ arch/arm/mach-omap2/omap_hwmod.h | 2 ++ 2 files changed, 20 insertions(+) diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index 4653efb..f37d22c 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c @@ -2053,6 +2053,23 @@ static int _omap4_get_context_lost(struct omap_hwmod *oh) } /** + * _enable_preprogram - Pre-program an IP block during the _enable() process + * @oh: struct omap_hwmod * + * + * Some IP blocks (such as AESS) require some additional programming + * after enable 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 _enable_preprogram(struct omap_hwmod *oh) +{ + if (!oh->class->enable_preprogram) + return 0; + + return oh->class->enable_preprogram(oh); +} + +/** * _enable - enable an omap_hwmod * @oh: struct omap_hwmod * * @@ -2156,6 +2173,7 @@ static int _enable(struct omap_hwmod *oh) _update_sysc_cache(oh); _enable_sysc(oh); } + r = _enable_preprogram(oh); } else { if (soc_ops.disable_module) soc_ops.disable_module(oh); diff --git a/arch/arm/mach-omap2/omap_hwmod.h b/arch/arm/mach-omap2/omap_hwmod.h index 3ae852a..41066b4 100644 --- a/arch/arm/mach-omap2/omap_hwmod.h +++ b/arch/arm/mach-omap2/omap_hwmod.h @@ -501,6 +501,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 + * @enable_preprogram: ptr to fn to be executed during device enable * * Represent the class of a OMAP hardware "modules" (e.g. timer, * smartreflex, gpio, uart...) @@ -524,6 +525,7 @@ struct omap_hwmod_class { u32 rev; int (*pre_shutdown)(struct omap_hwmod *oh); int (*reset)(struct omap_hwmod *oh); + int (*enable_preprogram)(struct omap_hwmod *oh); }; /**