Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp3492846pxb; Wed, 14 Apr 2021 06:48:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJybtdBP09Jzof1fLarBT/mdOpPGRWlub0SLu40erFknhwfCzZB4TzMwGLjAyMileWSaYsQ9 X-Received: by 2002:a17:906:a51:: with SMTP id x17mr37889168ejf.25.1618408106960; Wed, 14 Apr 2021 06:48:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618408106; cv=none; d=google.com; s=arc-20160816; b=H5wEcwuDrhqrlZkFbDsrsF/OeFR7ny4AdTEjzMRJrxdqXhWPBAdOWtmZbH2guyDWvN 00JNguDIt5iycDRb2+PR5jJrvmrSSqC8gcJMVEOgqc20uwVE6kv5rTlKXXW/xWc2OTk+ 8Zho9jv9xOB/r0IA90WJd/9ynVmk96hTgi+yFg98XC3VZcLvB0H6c2BK8ayS+OXizo9x ema6cKyJQHBDlNWPRoWF3qdMnRG/UlJJnl+QEeOO7BUPcYWc5+VPZlrwlA369LqHT4I/ r9iwxbBiAIoe6JLTxUHmnWrRz8h+x6TR8JqVs1T3TQT/MoXaaH2fwff5bTsCvi3Os1mr XfzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=HjnvqReebsqlN7NttL5UC/whl93B3kkz+fuVB2IuUQQ=; b=GHb37JfYvFcXfKbLTPc2FyeqqGwV99PImZbFQMTKKl8rw0Tiqkpgh6eEyz6/7pjr3z jrZAgR7+65muxEWVWx4vo9oMF/ej1QTbX/4/qt0Q4kyva0GQcsmJgAQ54hhL8afv3Il3 itX3u+r4Z54Hfwno/eOuNQ8UW2vrOIdbW9K/l8INvLVkdvHraM8dloq67P5CST1e/MA1 eucSW7IQFnIaftlRsQ3r958Gm72jaSklrJyo5GkeTa41IZiQT9LxjJ7iuGp6zz2f1rAM BA8IHhou8JaqR5reW6HGzYOptGM7yD++esMlWVPxuT4dMBkCDfYo4U9AhnXbYp+IzOP6 nUbA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a7si12678778edq.454.2021.04.14.06.48.03; Wed, 14 Apr 2021 06:48:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348322AbhDNGEh (ORCPT + 99 others); Wed, 14 Apr 2021 02:04:37 -0400 Received: from alexa-out.qualcomm.com ([129.46.98.28]:13775 "EHLO alexa-out.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349122AbhDNGEX (ORCPT ); Wed, 14 Apr 2021 02:04:23 -0400 Received: from ironmsg-lv-alpha.qualcomm.com ([10.47.202.13]) by alexa-out.qualcomm.com with ESMTP; 13 Apr 2021 23:04:02 -0700 X-QCInternal: smtphost Received: from ironmsg01-blr.qualcomm.com ([10.86.208.130]) by ironmsg-lv-alpha.qualcomm.com with ESMTP/TLS/AES256-SHA; 13 Apr 2021 23:03:59 -0700 X-QCInternal: smtphost Received: from c-sanm-linux.qualcomm.com ([10.206.25.31]) by ironmsg01-blr.qualcomm.com with ESMTP; 14 Apr 2021 11:33:33 +0530 Received: by c-sanm-linux.qualcomm.com (Postfix, from userid 2343233) id 71C2037A5; Wed, 14 Apr 2021 11:33:32 +0530 (IST) From: Sandeep Maheswaram To: Greg Kroah-Hartman , Felipe Balbi , Stephen Boyd , Doug Anderson , Matthias Kaehlcke Cc: linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Manu Gautam , Sandeep Maheswaram Subject: [PATCH v2] usb: dwc3: core: Add shutdown callback for dwc3 Date: Wed, 14 Apr 2021 11:33:29 +0530 Message-Id: <1618380209-20114-1-git-send-email-sanm@codeaurora.org> X-Mailer: git-send-email 2.7.4 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch adds a shutdown callback to USB DWC core driver to ensure that it is properly shutdown in reboot/shutdown path. This is required where SMMU address translation is enabled like on SC7180 SoC and few others. If the hardware is still accessing memory after SMMU translation is disabled as part of SMMU shutdown callback in system reboot or shutdown path, then IOVAs(I/O virtual address) which it was using will go on the bus as the physical addresses which might result in unknown crashes (NoC/interconnect errors). Signed-off-by: Sandeep Maheswaram --- Changes in v2: - As per Stephen's comment, calling dwc3_remove in dwc3_shutdown. drivers/usb/dwc3/core.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 05e2e54c..2022d90 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -1658,6 +1658,11 @@ static int dwc3_remove(struct platform_device *pdev) return 0; } +static void dwc3_shutdown(struct platform_device *pdev) +{ + dwc3_remove(pdev); +} + #ifdef CONFIG_PM static int dwc3_core_init_for_resume(struct dwc3 *dwc) { @@ -1975,6 +1980,7 @@ MODULE_DEVICE_TABLE(acpi, dwc3_acpi_match); static struct platform_driver dwc3_driver = { .probe = dwc3_probe, .remove = dwc3_remove, + .shutdown = dwc3_shutdown, .driver = { .name = "dwc3", .of_match_table = of_match_ptr(of_dwc3_match), -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation