From patchwork Wed Jun 9 12:10:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 12310045 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 693AAC48BCF for ; Wed, 9 Jun 2021 12:42:40 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3BD1D61183 for ; Wed, 9 Jun 2021 12:42:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3BD1D61183 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=microchip.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:CC :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=7/SXt/zX0t2re2XXerJ3Wx7ChXHyPJMnBF2Mx55Lexk=; b=ujkxlr6oxNqC6W LALmb+pnHErvALN3wVkVjsVjf2V6cSNtiKGQKZjd0LQ3v71LkjBZxFvlDZKA/4TOYULXKZcT63S8C kDd1chNwfAuEn8GmlUKmT5G6S1pxM0BcFvwfnuPeJ3icG04ZKVaRMmF7UZTfSkHOOXSV+9N1UI/RN LErhb8DjfeKnTVFrL0MMMtlKzH5aPlwcJCl0bkzxjjPClL4T8DQR3ejMHLR8DwZii4IzZ0OpXkZlG ihOmoq4KUKpv69GdxBdne1IQl64A7bp59CpjCmcSptbOHPL/uNRY4lyLQwxRX/rv6ShmPurlk+0qP z1zwy03H91IUtcbG6IEw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lqxVQ-00DkOj-LO; Wed, 09 Jun 2021 12:40:26 +0000 Received: from esa.microchip.iphmx.com ([68.232.154.123]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lqx2i-00DZzW-Kr for linux-arm-kernel@lists.infradead.org; Wed, 09 Jun 2021 12:10:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1623240645; x=1654776645; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=9Xk1ujB2kl+qiFwhxmEUDgjYRlHoyizFUOvEaQMLa0Q=; b=chotkTSY/A+Jt/xaq2/o3vsdmLWicuYhpOyXRakCnYD/IpEY9f12/Hgq 7txvg34iypesogV6YorEJLNdUxYrarK3gCE8im4kHMDdHVQFsvuLCf+Ym /gCvGYMR5J1DHJcRdUyQ0Hwy3fYt6GgQiWoGXilJhuo1ufe/mAVlhxhZX fEIcdQyy8QGlbEeYUj/WFTMILBGS7HC8Uyj2/zUsVG8IXLRp0eHFDej/P V4uaIMwESn9ar+zlQ3HL6L+9Dx1604yapW836grcljHyU3ovDKJUVs52J 1JFjKspBmbXFYCzoIip89dy6tkn2HytQwwa6wCgPzUMeTbPOjZHzIlmQV Q==; IronPort-SDR: 3KzQrg30tx/nO9bPITuPmyiWWqx6Ljl9T7xHt4v9Qgo9Hqwn2eOA1iX/acZsDFbKKUkbD8MRoW DZpuQ4UJCIVKPH7JK4ELc/XhBuS4yiyBdbqFv4c4DVY36sZu4NPlWxyx6m23Uy33zDwWvTg8v1 pdwbtllNctVMs0K1X6EQZvLmi4C7mMkzeZXfUhuAB/KCGOutsgBvVnKvWM9MunReDEZPMhVdOL 2ofz/IFDXqKbZzsZS+R3rb9ypyqOrJvVgdqjF0Ty2LyxKttm1sbF0NdtDRd/ZREmBFzOFM90MA xiE= X-IronPort-AV: E=Sophos;i="5.83,260,1616482800"; d="scan'208";a="120688966" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 09 Jun 2021 05:10:42 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Wed, 9 Jun 2021 05:10:41 -0700 Received: from m18063-ThinkPad-T460p.mchp-main.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Wed, 9 Jun 2021 05:10:33 -0700 From: Claudiu Beznea To: , , , , , CC: , , , Claudiu Beznea Subject: [PATCH] usb: host: ohci-at91: suspend/resume ports after/before OHCI accesses Date: Wed, 9 Jun 2021 15:10:27 +0300 Message-ID: <20210609121027.70951-1-claudiu.beznea@microchip.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210609_051044_818618_BEF90B15 X-CRM114-Status: GOOD ( 10.26 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On SAMA7G5 suspending ports will cut the access to OHCI registers and any subsequent access to them will lead to CPU being blocked trying to access that memory. Same thing happens on resume: if OHCI memory is accessed before resuming ports the CPU will block on that access. The OCHI memory is accessed on suspend/resume though ohci_suspend()/ohci_resume(). Signed-off-by: Claudiu Beznea Acked-by: Alan Stern --- The patch was tested on SAMA7G5, SAMA5D2 and SAM9X60. Thank you, Claudiu Beznea drivers/usb/host/ohci-at91.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index b3a6a497dcb1..7c6202b05ff4 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c @@ -666,8 +666,6 @@ ohci_hcd_at91_drv_suspend(struct device *dev) if (ohci_at91->wakeup) enable_irq_wake(hcd->irq); - ohci_at91_port_suspend(ohci_at91, 1); - ret = ohci_suspend(hcd, ohci_at91->wakeup); if (ret) { if (ohci_at91->wakeup) @@ -687,7 +685,10 @@ ohci_hcd_at91_drv_suspend(struct device *dev) /* flush the writes */ (void) ohci_readl (ohci, &ohci->regs->control); msleep(1); + ohci_at91_port_suspend(ohci_at91, 1); at91_stop_clock(ohci_at91); + } else { + ohci_at91_port_suspend(ohci_at91, 1); } return ret; @@ -699,6 +700,8 @@ ohci_hcd_at91_drv_resume(struct device *dev) struct usb_hcd *hcd = dev_get_drvdata(dev); struct ohci_at91_priv *ohci_at91 = hcd_to_ohci_at91_priv(hcd); + ohci_at91_port_suspend(ohci_at91, 0); + if (ohci_at91->wakeup) disable_irq_wake(hcd->irq); else @@ -706,8 +709,6 @@ ohci_hcd_at91_drv_resume(struct device *dev) ohci_resume(hcd, false); - ohci_at91_port_suspend(ohci_at91, 0); - return 0; }