From patchwork Thu Jun 25 14:55:50 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Hilman X-Patchwork-Id: 32403 X-Patchwork-Delegate: khilman@deeprootsystems.com Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n5PEtukb021800 for ; Thu, 25 Jun 2009 14:55:56 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752128AbZFYOzv (ORCPT ); Thu, 25 Jun 2009 10:55:51 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752606AbZFYOzu (ORCPT ); Thu, 25 Jun 2009 10:55:50 -0400 Received: from wf-out-1314.google.com ([209.85.200.174]:23417 "EHLO wf-out-1314.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752128AbZFYOzu (ORCPT ); Thu, 25 Jun 2009 10:55:50 -0400 Received: by wf-out-1314.google.com with SMTP id 26so546051wfd.4 for ; Thu, 25 Jun 2009 07:55:53 -0700 (PDT) Received: by 10.142.52.2 with SMTP id z2mr693761wfz.270.1245941753408; Thu, 25 Jun 2009 07:55:53 -0700 (PDT) Received: from localhost ([216.254.16.51]) by mx.google.com with ESMTPS id 9sm4935916wfc.36.2009.06.25.07.55.52 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 25 Jun 2009 07:55:52 -0700 (PDT) From: Kevin Hilman To: linux-omap@vger.kernel.org Subject: [PATCH -pm v5] OMAP3: PM: reset USB OTG module on boot Date: Thu, 25 Jun 2009 07:55:50 -0700 Message-Id: <1245941750-10831-1-git-send-email-khilman@deeprootsystems.com> X-Mailer: git-send-email 1.6.3.2 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Rather than simply setting force-idle mode on boot, do a reset of the OTG module. This really ensures that any bootloader/bootstrap code that leaves it active will not prevent future retention. After reset, OTG module will be in force-idle, force-standby mode. Problem reported by Mike Chan Tested-by: Mike Chan Signed-off-by: Kevin Hilman --- I decided to drop clock stuff from this patch as the current code is not doing it either. This simply replaces the force-idle with a soft reset, and uses ioremap instead of omap_write(). This will only be a temporary patch in the pm branch until omap_hwmod is integrated and is doing the full module reset. arch/arm/mach-omap2/usb-musb.c | 22 ++++++++++++++++++---- 1 files changed, 18 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-omap2/usb-musb.c b/arch/arm/mach-omap2/usb-musb.c index d85296d..3efa19c 100644 --- a/arch/arm/mach-omap2/usb-musb.c +++ b/arch/arm/mach-omap2/usb-musb.c @@ -26,18 +26,32 @@ #include +#include + #include #include #include #include -#define OTG_SYSCONFIG (OMAP34XX_HSUSB_OTG_BASE + 0x404) +#define OTG_SYSCONFIG 0x404 +#define OTG_SYSC_SOFTRESET BIT(1) static void __init usb_musb_pm_init(void) { - /* Ensure force-idle mode for OTG controller */ - if (cpu_is_omap34xx()) - omap_writel(0, OTG_SYSCONFIG); + void __iomem *otg_base; + + if (!cpu_is_omap34xx()) + return; + + otg_base = ioremap(OMAP34XX_HSUSB_OTG_BASE, SZ_4K); + if (WARN_ON(!otg_base)) + return; + + /* Reset OTG controller. After reset, it will be in + * force-idle, force-standby mode. */ + __raw_writel(OTG_SYSC_SOFTRESET, otg_base + OTG_SYSCONFIG); + + iounmap(otg_base); } #ifdef CONFIG_USB_MUSB_SOC