From patchwork Wed Aug 22 05:42:30 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Ramirez Luna X-Patchwork-Id: 1359231 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 1409F3FC71 for ; Wed, 22 Aug 2012 05:45:55 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1T43ih-0003UO-CI; Wed, 22 Aug 2012 05:43:11 +0000 Received: from mail-ob0-f177.google.com ([209.85.214.177]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1T43iH-0003Q0-Jn for linux-arm-kernel@lists.infradead.org; Wed, 22 Aug 2012 05:42:49 +0000 Received: by obbta17 with SMTP id ta17so908160obb.36 for ; Tue, 21 Aug 2012 22:42:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=3Tzs70pEBEqQTpxoUOmMwY6bKSTb2XDmSFM2KCCbDjc=; b=KmV+nOFSMl+0/jyon3/wDyWhb89HEr/cf68fbTDqwgn6mfiXOge8ORKSLA9ydnc2kk R3yFkyGq8sc6+5sTk4pY9T1KUF+HN3P2T2lJ3HYmaxRwH9ZwyfkDhcPHI8Ahdevf8Lni fo+MQy6QLy1KoxFwmtLSeoXylTPeJsoh15YrMG6nJF7k75n44ZfUl11+xTmocV9v22tm olDOLBlzhWsp2lIC5e63gHU3b/3HiDFnD/2uHUGOgchAkeGyvBdRtQUQ/d7kO/rdBSSh YObI1AvZaeVTW6vd4JCq8GkywsNROqCo0wAcJqa2lpy7IO4EABOxuPYR38p5n35vNT5V MKKA== Received: by 10.60.3.106 with SMTP id b10mr14624561oeb.119.1345614165040; Tue, 21 Aug 2012 22:42:45 -0700 (PDT) Received: from uda0273944.am.dhcp.ti.com (dragon.ti.com. [192.94.94.33]) by mx.google.com with ESMTPS id a9sm3168240obp.14.2012.08.21.22.42.43 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 21 Aug 2012 22:42:44 -0700 (PDT) From: Omar Ramirez Luna To: Benoit Cousson , Paul Walmsley Subject: [PATCH 2/2] ARM: OMAP: hwmod: revise deassert sequence Date: Wed, 22 Aug 2012 00:42:30 -0500 Message-Id: <1345614150-25723-3-git-send-email-omar.luna@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1345614150-25723-1-git-send-email-omar.luna@linaro.org> References: <1345614150-25723-1-git-send-email-omar.luna@linaro.org> X-Gm-Message-State: ALoCoQmnZ0A+ctmIQshK2OcxvcbYCM3ZU58wmSawqt2UI0M6y33eUiX8apax/zRRYGlLpi6u51sM X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.214.177 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Kevin Hilman , Ohad Ben-Cohen , Russell King , Tony Lindgren , linux-kernel@vger.kernel.org, Tomi Valkeinen , Omar Ramirez Luna , linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org For a reset sequence to complete cleanly, a module needs its associated clocks to be enabled, otherwise the timeout check in prcm code can print a false failure (failed to hardreset) that occurs because the clocks aren't powered ON and the status bit checked can't transition without them. Signed-off-by: Omar Ramirez Luna --- arch/arm/mach-omap2/omap_hwmod.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index eaedc33..b65e021 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c @@ -1509,6 +1509,7 @@ static int _deassert_hardreset(struct omap_hwmod *oh, const char *name) { struct omap_hwmod_rst_info ohri; int ret = -EINVAL; + int hwsup = 0; if (!oh) return -EINVAL; @@ -1520,10 +1521,46 @@ static int _deassert_hardreset(struct omap_hwmod *oh, const char *name) if (IS_ERR_VALUE(ret)) return ret; + if (oh->clkdm) { + /* + * A clockdomain must be in SW_SUP otherwise reset + * might not be completed. The clockdomain can be set + * in HW_AUTO only when the module become ready. + */ + hwsup = clkdm_in_hwsup(oh->clkdm); + ret = clkdm_hwmod_enable(oh->clkdm, oh); + if (ret) { + WARN(1, "omap_hwmod: %s: could not enable clockdomain %s: %d\n", + oh->name, oh->clkdm->name, ret); + return ret; + } + } + + _enable_clocks(oh); + if (soc_ops.enable_module) + soc_ops.enable_module(oh); + ret = soc_ops.deassert_hardreset(oh, &ohri); + + if (soc_ops.disable_module) + soc_ops.disable_module(oh); + _disable_clocks(oh); + if (ret == -EBUSY) pr_warning("omap_hwmod: %s: failed to hardreset\n", oh->name); + if (!ret) { + /* + * Set the clockdomain to HW_AUTO, assuming that the + * previous state was HW_AUTO. + */ + if (oh->clkdm && hwsup) + clkdm_allow_idle(oh->clkdm); + } else { + if (oh->clkdm) + clkdm_hwmod_disable(oh->clkdm, oh); + } + return ret; }