From patchwork Fri Mar 16 14:44:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 131924 Delivered-To: patch@linaro.org Received: by 10.46.84.17 with SMTP id i17csp842210ljb; Fri, 16 Mar 2018 07:44:38 -0700 (PDT) X-Google-Smtp-Source: AG47ELtCWJw777tMT2iBD+NIWpNof96QiteN8Y57Ta3mctA1sULNYF4z6KSLAP5OA8ygiKHsnBu1 X-Received: by 10.99.67.1 with SMTP id q1mr1659125pga.365.1521211478373; Fri, 16 Mar 2018 07:44:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521211478; cv=none; d=google.com; s=arc-20160816; b=spi5KnaKTdZHta+H6fS0Js4E0f+Z6R2tJ4mKcB2wTuOZ89nX3ntjJ1D4t7WLLaxn7m DQ06Gjb2SzxgFH28GrG55eCP+8NertJOGnH4dd8Z3v2fMTpSpvAuriKLBw0Yre9PHx+A JaAw08/mCrPBNWwdwIvIhzmasoqT89XzE4hMPcVO3AXMX40Qd1uxEYNHOMbHBV6wsRHz u83cw1/CBvYmj+jf2VFfSLOSowrUFKCZGu3sDX9/9tfWpwmE/uHu80vqWoVUhGBFDMDs hmk8hYZync49G8TuMTYJOswsnnzCm85bhbjw9txR3CGBSMt8dzKVmTP/R9MM72rd4Rj8 SSFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:dkim-signature:arc-authentication-results; bh=nR6RMhD+XlBPe+EMyhp4SU9AVerKSiAHCUxk/gHQHuI=; b=lqGmUTKqcjd0opkFGIJxFAoX4g6+XuslNZ58nUj8cWvHr854RMWes/sp3J2otFL85H q6s4n3UPzVE3XEQXS3H8zCe+i/D87Zk8EqFGD2IBTfvmA5Yzc4uOdZwD/ovxBxB662HY SSurgSDAvRFyu/mvlTAeiESkRQWfiLZTsvSIOheQFZASLwckQKEYxmbehBIs3rr/1gwv 9S/OiiPUylFdbPFNVg8cDrg5qmJwtG/wbHKNlPOGclK/jO7gA6GccaVZqbTzHc3QA5jh aWrsfxgJcACxdEMQSC3zYmHBbWC4T0NdHe8m+y2ky8f7hxJpsBGYkyfUeINgW/xCe0b8 bUrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=kGGI+VZP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d31-v6si6404563pld.495.2018.03.16.07.44.37; Fri, 16 Mar 2018 07:44:38 -0700 (PDT) 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; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=kGGI+VZP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753038AbeCPOof (ORCPT + 28 others); Fri, 16 Mar 2018 10:44:35 -0400 Received: from fllnx210.ext.ti.com ([198.47.19.17]:36235 "EHLO fllnx210.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751233AbeCPOod (ORCPT ); Fri, 16 Mar 2018 10:44:33 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by fllnx210.ext.ti.com (8.15.1/8.15.1) with ESMTP id w2GEiVV9020324; Fri, 16 Mar 2018 09:44:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1521211471; bh=6PzSetTyR4r6onmwsQOyEWsRy4t0ZIZiionRplta1CA=; h=From:To:CC:Subject:Date; b=kGGI+VZPBttHS3gCqcFlNSWxV/aibiEsol/pqq+sfw3Vr5nGrBZLJIXNq0MvHdw1d 5G+vcyuHnchbvklHPtkDL0h89GCC0I1tCv9bSDm2mqHk2ikYakwDSeMQgq3LjEF880 VsZL8wWPgkbNM4WA5eQm0RDx02qaY6W9Z4IfhKQU= Received: from DFLE114.ent.ti.com (dfle114.ent.ti.com [10.64.6.35]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w2GEiVWm003352; Fri, 16 Mar 2018 09:44:31 -0500 Received: from DFLE112.ent.ti.com (10.64.6.33) by DFLE114.ent.ti.com (10.64.6.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Fri, 16 Mar 2018 09:44:31 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE112.ent.ti.com (10.64.6.33) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Fri, 16 Mar 2018 09:44:31 -0500 Received: from dlelxv97.itg.ti.com (dlelxv97.itg.ti.com [172.17.2.193]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w2GEiVTH009205; Fri, 16 Mar 2018 09:44:31 -0500 Received: from lta0400828d.ti.com (vboxa0400828d.emea.dhcp.ti.com [172.22.232.51]) by dlelxv97.itg.ti.com (8.14.3/8.13.8) with ESMTP id w2GEiTfJ003720; Fri, 16 Mar 2018 09:44:30 -0500 From: Roger Quadros To: CC: , , Roger Quadros Subject: [PATCH] usb: dwc3: core: Fix broken system suspend/resume on AM437x Date: Fri, 16 Mar 2018 16:44:27 +0200 Message-ID: <1521211467-6872-1-git-send-email-rogerq@ti.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On TI's AM437x, the DWC3 controller looses state after a system suspend/resume. We are re-initializing the controller but we miss restoring the PRTCAP register. This causes USB host to break on AM437x after a system suspend/resume. Fix this by restoring the PRTCAP register on system resume. Signed-off-by: Roger Quadros --- drivers/usb/dwc3/core.c | 2 ++ 1 file changed, 2 insertions(+) -- cheers, -roger Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index e8890c0..5becd7f 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -1374,6 +1374,7 @@ static int dwc3_resume_common(struct dwc3 *dwc, pm_message_t msg) if (ret) return ret; + dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_DEVICE); spin_lock_irqsave(&dwc->lock, flags); dwc3_gadget_resume(dwc); spin_unlock_irqrestore(&dwc->lock, flags); @@ -1384,6 +1385,7 @@ static int dwc3_resume_common(struct dwc3 *dwc, pm_message_t msg) ret = dwc3_core_init(dwc); if (ret) return ret; + dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_HOST); } break; case DWC3_GCTL_PRTCAP_OTG: