From patchwork Tue Feb 4 13:29:33 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 24102 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f70.google.com (mail-qa0-f70.google.com [209.85.216.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0642120445 for ; Tue, 4 Feb 2014 13:30:13 +0000 (UTC) Received: by mail-qa0-f70.google.com with SMTP id ii20sf20209193qab.1 for ; Tue, 04 Feb 2014 05:30:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe:content-type; bh=Zw0Jpf7NAWNBBl9TJ06hI5z+YH/zHcM79zOIbZTvc9o=; b=YSf5tCE1Fezg7Z541C8Tuj0U0wUbejgX6xUrTvdGVhphvjz85bkxcLxMvyesYmBSSc MJswjpCkcrHs40E8xeAxcTR9eDTMw5+wj0gW4GiHeGHCVM0O0pyiZiKkQqxB0ljE0P+3 NN0NSCI4SvTkX8XDqxHYIEwOTCqZL9BSQu2oddwoccSVwa0gSvAZs1iGCan2RmQlKmM1 NS8bq5Xzb49ikpIa2jxuzr4HyfBV5/MMkBz+OBq4kqAHt8LfuhYuIZvoCGq71gsk/F5r TT0y43YSGKUnPJdoYfdpI3//MdZvZmWCkq9K8kh/qxRNRWbDnd5/jLTZ/41oI1l73XYr b02A== X-Gm-Message-State: ALoCoQn30zWswQn9+0VNcHm2ULXg+gsBfdQhixOfzg3i66RMLUhXnu2XcfbsM5u0Wjryz5rtFbsA X-Received: by 10.224.163.71 with SMTP id z7mr15961127qax.5.1391520613218; Tue, 04 Feb 2014 05:30:13 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.98.69 with SMTP id n63ls2266569qge.96.gmail; Tue, 04 Feb 2014 05:30:13 -0800 (PST) X-Received: by 10.220.182.137 with SMTP id cc9mr53654vcb.62.1391520613143; Tue, 04 Feb 2014 05:30:13 -0800 (PST) Received: from mail-vb0-f50.google.com (mail-vb0-f50.google.com [209.85.212.50]) by mx.google.com with ESMTPS id sq4si8144886vdc.2.2014.02.04.05.30.13 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 04 Feb 2014 05:30:13 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.50 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.50; Received: by mail-vb0-f50.google.com with SMTP id w8so5699029vbj.37 for ; Tue, 04 Feb 2014 05:30:13 -0800 (PST) X-Received: by 10.52.118.102 with SMTP id kl6mr43939vdb.73.1391520613065; Tue, 04 Feb 2014 05:30:13 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.174.196 with SMTP id u4csp234263vcz; Tue, 4 Feb 2014 05:30:12 -0800 (PST) X-Received: by 10.68.171.99 with SMTP id at3mr43842818pbc.109.1391520611874; Tue, 04 Feb 2014 05:30:11 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id xk2si24699097pab.13.2014.02.04.05.30.10; Tue, 04 Feb 2014 05:30:10 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754724AbaBDN34 (ORCPT + 27 others); Tue, 4 Feb 2014 08:29:56 -0500 Received: from arroyo.ext.ti.com ([192.94.94.40]:49900 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754525AbaBDN3h (ORCPT ); Tue, 4 Feb 2014 08:29:37 -0500 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id s14DTasn000831; Tue, 4 Feb 2014 07:29:36 -0600 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id s14DTaqF029514; Tue, 4 Feb 2014 07:29:36 -0600 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.2.342.3; Tue, 4 Feb 2014 07:29:35 -0600 Received: from localhost.localdomain (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id s14DTXVn031812; Tue, 4 Feb 2014 07:29:34 -0600 From: Roger Quadros To: , CC: , , , Subject: [PATCH 2/2] usb: musb: core: Fix remote-wakeup resume Date: Tue, 4 Feb 2014 15:29:33 +0200 Message-ID: <1391520573-26343-1-git-send-email-rogerq@ti.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1391520349-26192-1-git-send-email-rogerq@ti.com> References: <1391520349-26192-1-git-send-email-rogerq@ti.com> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: rogerq@ti.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.50 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , During resume don't touch SUSPENDM/RESUME bits of POWER register while restoring controller context. These bits might be changed by the controller during resume operation and so will be different than what they were during suspend. e.g. SUSPENDM bit is set by software during USB global suspend but automatically cleared by the controller during remote wakeup or during resume. Setting this bit back while restoring context causes undesired behaviour. i.e. Babble interrupt is generated and USB is broken. Signed-off-by: Roger Quadros --- drivers/usb/musb/musb_core.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index fc192ad..a501542 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -2157,11 +2157,19 @@ static void musb_restore_context(struct musb *musb) void __iomem *musb_base = musb->mregs; void __iomem *ep_target_regs; void __iomem *epio; + u8 power; musb_writew(musb_base, MUSB_FRAME, musb->context.frame); musb_writeb(musb_base, MUSB_TESTMODE, musb->context.testmode); musb_write_ulpi_buscontrol(musb->mregs, musb->context.busctl); - musb_writeb(musb_base, MUSB_POWER, musb->context.power); + + /* Don't affect SUSPENDM/RESUME bits in POWER reg */ + power = musb_readb(musb_base, MUSB_POWER); + power &= MUSB_POWER_SUSPENDM | MUSB_POWER_RESUME; + musb->context.power &= ~(MUSB_POWER_SUSPENDM | MUSB_POWER_RESUME); + power |= musb->context.power; + musb_writeb(musb_base, MUSB_POWER, power); + musb_writew(musb_base, MUSB_INTRTXE, musb->intrtxe); musb_writew(musb_base, MUSB_INTRRXE, musb->intrrxe); musb_writeb(musb_base, MUSB_INTRUSBE, musb->context.intrusbe);