From patchwork Tue Jan 8 22:29:15 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: NeilBrown X-Patchwork-Id: 1948561 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 60EFDDF23A for ; Tue, 8 Jan 2013 22:29:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755203Ab3AHW3b (ORCPT ); Tue, 8 Jan 2013 17:29:31 -0500 Received: from cantor2.suse.de ([195.135.220.15]:48748 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755156Ab3AHW3b (ORCPT ); Tue, 8 Jan 2013 17:29:31 -0500 Received: from relay2.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id CAD4EA4EB7 for ; Tue, 8 Jan 2013 23:29:29 +0100 (CET) Date: Wed, 9 Jan 2013 09:29:15 +1100 From: NeilBrown To: linux-omap@vger.kernel.org Subject: Help wanted with USB and OMAP3 off_mode Message-ID: <20130109092915.1c2077b5@notabene.brown> X-Mailer: Claws Mail 3.8.1 (GTK+ 2.24.10; x86_64-suse-linux-gnu) Mime-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Hi, I'm trying to get off_mode working reliably on my gta04 mobile phone. My current stumbling block is USB. The "Option" GSM module is attached via USB (there is a separate transceiver chip attached to port 1 which is placed in OMAP_EHCI_PORT_MODE_PHY). After a suspend/resume cycle with off_mode enabled the GSM module disappears. i.e. 'lsusb' doesn't see it any more and the various ttyHSxx devices don't exist. Without off mode, the modem always appears after resume. I discovered that the registers set by: drivers/mfd/omap-usb-host.c are not maintained across as suspend/resume so I added the following patch (which I can make a formal submission of if it looks right to others), but that didn't help (or didn't help enough). If I echo 1 > /sys/kernel/debug/pm_debug/usbhost_pwrdm/suspend thus keeping just the USBHOST power domain out of off_mode, the GSM module doesn't disappear. So it seems that some context in the usbhost domain is not being save and restored. This is as far as I can get. Can someone suggest where I should look to find out what is not being saved/restored properly, and how to go about saving and restoring? Thanks in advance, NeilBrown diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c index 23cec57..522405e 100644 --- a/drivers/mfd/omap-usb-host.c +++ b/drivers/mfd/omap-usb-host.c @@ -100,6 +100,10 @@ struct usbhs_hcd_omap { void __iomem *uhh_base; + struct { + unsigned hostconfig; + } context; + struct usbhs_omap_platform_data platdata; u32 usbhs_rev; @@ -300,6 +304,10 @@ static int usbhs_runtime_resume(struct device *dev) clk_enable(omap->utmi_p1_fck); clk_enable(omap->utmi_p2_fck); + usbhs_write(omap->uhh_base, + OMAP_UHH_HOSTCONFIG, + omap->context.hostconfig); + spin_unlock_irqrestore(&omap->lock, flags); return 0; @@ -319,6 +327,8 @@ static int usbhs_runtime_suspend(struct device *dev) } spin_lock_irqsave(&omap->lock, flags); + omap->context.hostconfig = usbhs_read(omap->uhh_base, + OMAP_UHH_HOSTCONFIG); if (is_ehci_tll_mode(pdata->port_mode[0])) clk_disable(omap->usbhost_p1_fck);