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: 1201751 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 8683C40073 for ; Mon, 16 Jul 2012 19:22:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753969Ab2GPTVr (ORCPT ); Mon, 16 Jul 2012 15:21:47 -0400 Received: from mail-qa0-f53.google.com ([209.85.216.53]:53237 "EHLO mail-qa0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753735Ab2GPTVl (ORCPT ); Mon, 16 Jul 2012 15:21:41 -0400 Received: by qaas11 with SMTP id s11so1813171qaa.19 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=IMsoD2+9YaAGcJCFmCm3QN7D1Tr6ksLOK0BqVLF90TDJ8VMHAXl3nT5c8pv5R+d0G9 f22GR6Pl2s5WFIMQarFzxnbJa02dwtPLFjXaCr/Ff5Nn/AyWhaeP8wymnbJ4DI4KvYIt 9MijOnyKGV3sU978qmOitusgefsJzlYU4C/iAxwI6TQtBLclh30m7YU2ulAZ40p4cbuM Bl/69t0ETfboxyIEtLo/6OnRiCbm1I/UAvyy9GcgudVnJ5i1GDHHNlG9WbZnm177XZTf pygbF0xJeRRRmVa4VCCiL+Tq1TE5ALMBQDf7zDyiYqUViFmt5V0PmwsNMM2GA3wJu5Er 1UrA== 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 Cc: Benoit Cousson , Tony Lindgren , Russell King , Kevin Hilman , Ohad Ben-Cohen , Tomi Valkeinen , linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Omar Ramirez Luna 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: ALoCoQnJYPaml6rF1/qR22RypK9Fo1iFgioHzClbUkf1JE+SgrYvSNlPWYgI41qYhLOuQqi9ai9m Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.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; }