From patchwork Mon Jul 16 19:21:24 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: 1201791 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id EB152E0038 for ; Mon, 16 Jul 2012 19:26:39 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Sqqsn-0004Gp-Sj; Mon, 16 Jul 2012 19:23:01 +0000 Received: from mail-yw0-f49.google.com ([209.85.213.49]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1SqqrV-0004E6-A0 for linux-arm-kernel@lists.infradead.org; Mon, 16 Jul 2012 19:21:44 +0000 Received: by yhjj52 with SMTP id j52so2404684yhj.36 for ; Mon, 16 Jul 2012 12:21:40 -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=MqcECReLU5uTu23H9pYWsnePq8B4kAZHS6Tx+e2+UDA=; b=CyrooQ2fUxWe9PlDZoj9MyUk0MN7bf8XU3SNb/j1NHoTZGDX+ON2RgJ8+sbWxZpHL6 rDiwBvecizX2TKvrGWO7HZg8DCyC16/qZxJAhKjiu8PDiwUYKOz1bV3KNqoJRHoAc1Id QFgpTTOqtQTfjuhA92Yt2tWbhW26kxrRptpCNFRBrrAU2C9pBTAyA3UUkmVFPqNmMRc7 McmrTKgJlZYxPrwZ79AgTqWi1VMasGELMjtmWLszYz8h/UrhjWS2QXElsG66CpczExVE Teq+zxPgWvw0Zx+XjtVSGQQTUza1ipbmLXxLRzdDi1O/t3WERVRUPbcU/lg/o7R3zK3U IIkg== Received: by 10.60.8.8 with SMTP id n8mr17583716oea.38.1342466500320; Mon, 16 Jul 2012 12:21:40 -0700 (PDT) Received: from localhost.localdomain (dragon.ti.com. [192.94.94.33]) by mx.google.com with ESMTPS id g3sm10205811oeb.5.2012.07.16.12.21.38 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 16 Jul 2012 12:21:39 -0700 (PDT) From: Omar Ramirez Luna To: Paul Walmsley Subject: [PATCH 2/3] ARM: OMAP: hwmod: revise deassert sequence Date: Mon, 16 Jul 2012 14:21:24 -0500 Message-Id: <1342466485-1050-3-git-send-email-omar.luna@linaro.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1342466485-1050-1-git-send-email-omar.luna@linaro.org> References: <1342466485-1050-1-git-send-email-omar.luna@linaro.org> X-Gm-Message-State: ALoCoQlvz9k508jdVV8HBzvLqF80k3NmLDAvclgwgTFzOZxnkPxKh+mFsCbrcoCW1si9vEZ/aOei 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.213.49 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 , Benoit Cousson , 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 | 33 +++++++++++++++++++++++++++++++++ 1 files changed, 33 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index 091c199..f6f8d99 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,42 @@ 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); + ret = soc_ops.deassert_hardreset(oh, &ohri); + + _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; }