Received: by 2002:a05:6358:51dd:b0:131:369:b2a3 with SMTP id 29csp363217rwl; Wed, 9 Aug 2023 16:06:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH4irB6XCR727hZ/llPnjxLBCkg+mceS832ulMcaXhkxxhmP+yhID0FNSJrAYHtIX6en3/A X-Received: by 2002:a17:902:b214:b0:1bd:9cda:9a37 with SMTP id t20-20020a170902b21400b001bd9cda9a37mr337577plr.26.1691622373373; Wed, 09 Aug 2023 16:06:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691622373; cv=none; d=google.com; s=arc-20160816; b=sMzs9YKvWOF05DodkQSbFV+q6O7vqnRBpiA8OHCYqytY79EBmXdaFW/Y9e5AsmMSu2 A+yLsIabVwo8NXUFGNLl9dzdTCuugrHi9cUdN/7tmyRnnp1/EHZNFCokW72lQ5bzGC+a 9Vz8CEPmTqDclWbibu1S70QikqHy0zjurxiZf47QbHhseTOxe75gwzJZU69S8h5ALyXc 6lkRqnXPEi/T1fz3FilI2byODFYo43Ssp6657rvEKhux8hRedunaSNlLGDSgwTGLN9b7 C8WOeTlS+2Szhg7omq0WW7ELWfmoxVWqAEn26b56bC7+1W7v73NoWcDSNAE09cl3EBOb IXLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=nHhxE/dJDA6clbO9u01O1/s/eHxwxfI5ttey2qrEI7Y=; fh=FkHhmBrmSuTo/e5SV5yAXN89K4MbiAcDrSBWV7SILZ4=; b=fiAmrKDDC/u/T0CFWRmo9jMl1WbZKJ2N+qHj3RqDVtF6i+zwrO0+BQXPraC77JlxFs rZQ4OWRFDsWQ3zGQSF7zIthCMurnZXUNu4uqApnn1uUPMgSmShdjC2A7/dsQtJ2Oeply +QiTo22+Li+anKX/MCVSt/R/kS3FTmCvnypNBwE+LRIcliDP/ifjYGl7R4+5tnjIM1kr LpJManGPxCzVMLngExjJ9++maanTKxw/yc8+x9OJo5zt0LaNI6lViTdvayc5t9p/Fxas SAuPS5DicTUqw8vsBFYal5YnzKWtockAHWSE5v83uP0H9ryZTouJpZtoalNXDCMlFjHM jJqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@libre.computer header.s=google header.b=lOEq3UiL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u1-20020a17090341c100b001b222cd9826si141131ple.349.2023.08.09.16.05.59; Wed, 09 Aug 2023 16:06:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@libre.computer header.s=google header.b=lOEq3UiL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231924AbjHIVdi (ORCPT + 99 others); Wed, 9 Aug 2023 17:33:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231251AbjHIVdh (ORCPT ); Wed, 9 Aug 2023 17:33:37 -0400 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EECEF1BD9 for ; Wed, 9 Aug 2023 14:33:35 -0700 (PDT) Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-4fe2d152f62so334897e87.0 for ; Wed, 09 Aug 2023 14:33:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=libre.computer; s=google; t=1691616814; x=1692221614; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=nHhxE/dJDA6clbO9u01O1/s/eHxwxfI5ttey2qrEI7Y=; b=lOEq3UiLppEvzFQ+XytrfD/OLqlj+o2lGGJ2iLdVlf9NZ4HjVkiVf87RBQMqy//Xdj VOtjEkVw6I5hTl8fjCTdzz4Zr2W9AlHkxzp0OyYs5pukC1ePGvWhlT3An1SQhg63uie4 p23kTFFbUEzmr5al2aWfVctMdFlN9iqmJmyz8Ej2RJWxnjVhK8p9+fZiFOszWmKwFMXQ zuaDyExqGHbzAD87dN9VYVazNOfM53tOex/XTc9VJJ6FpWSmzsR+y2l+cOq0helpBptI FtIpytHR9FuhE1fCxdEXJ4i0lyJjhrTrnYs3qjOBTisR++lA3QbB9VOhT6/6S0A2j+XN IjtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691616814; x=1692221614; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=nHhxE/dJDA6clbO9u01O1/s/eHxwxfI5ttey2qrEI7Y=; b=AlodTl/PUv5M6caAR65g6ARKkJ8aN9zy7wXpOBzIDTr/Sc/Oqo3YFriVasedxOWsfN SLeoC1j/mZP4klx5+r/n+ucA0qX4BSHxbN/gFH8P8sQH0wULr3lUmv2H7a4rg6ODDHN7 oJGduGb0N2TGpi6Lun3Fc7dfld0JzQtud9GSneQ9Jp4IQkwDHlSgrmM5vqJQPyrY90Sp xFO6XN7T/Y2dvFTY4Gx2Y+ioj1r7wPP4qHs0IVdWwI31LDtkI3O1r9eyt4QqDQY5oBjI J9+SPwctNi8hJo4lFVc+Uz+xZ8N/u2DtDFzkGyrauretClVK7S8+HlYQaXTxf25nL8xm fwlw== X-Gm-Message-State: AOJu0YwCAaEf3BbyiwrQYazdVDOM1Sz456ZJXxqD9GYxGzPcyqEYK9IH mIGrU7yWUNeRbY/1BrC9VIbtIw== X-Received: by 2002:a05:6512:3baa:b0:4fb:8f81:4fe8 with SMTP id g42-20020a0565123baa00b004fb8f814fe8mr258735lfv.46.1691616813958; Wed, 09 Aug 2023 14:33:33 -0700 (PDT) Received: from bear.local ([69.165.74.129]) by smtp.gmail.com with ESMTPSA id q2-20020ac25282000000b004f864690901sm2450645lfm.244.2023.08.09.14.33.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Aug 2023 14:33:33 -0700 (PDT) From: Luke Lu To: Neil Armstrong , linux-usb@vger.kernel.org, linux-amlogic@lists.infradead.org Cc: Thinh Nguyen , Greg Kroah-Hartman , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Da Xue , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Luke Lu , stable@vger.kernel.org Subject: [PATCH v2] usb: dwc3: meson-g12a: do post init to fix broken usb after resumption Date: Wed, 9 Aug 2023 21:29:11 +0000 Message-Id: <20230809212911.18903-1-luke.lu@libre.computer> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Device connected to usb otg port of GXL-based boards can not be recognised after resumption, doesn't recover even if disconnect and reconnect the device. dmesg shows it disconnects during resumption. [ 41.492911] usb 1-2: USB disconnect, device number 3 [ 41.499346] usb 1-2: unregistering device [ 41.511939] usb 1-2: unregistering interface 1-2:1.0 Calling usb_post_init() will fix this issue, and it's tested and verified on libretech's aml-s905x-cc board. Cc: stable@vger.kernel.org # v5.8+ Fixes: c99993376f72 ("usb: dwc3: Add Amlogic G12A DWC3 glue") Signed-off-by: Luke Lu --- Note here, the commmit of Fixes tag is the first patch which bring suspend/resume function, so let's use it as the fix tag. As commit 5b0ba0caaf3a: (usb: dwc3: meson-g12a: refactor usb init)" introduced the use_post_init() function, and this patch will explicitly depend on it, so let's set kernel version higher or equal to v5.8. Changes since v1: - add Fixes tag and Cc stable tree --- drivers/usb/dwc3/dwc3-meson-g12a.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/usb/dwc3/dwc3-meson-g12a.c b/drivers/usb/dwc3/dwc3-meson-g12a.c index e99c7489dba0..2c07c038b584 100644 --- a/drivers/usb/dwc3/dwc3-meson-g12a.c +++ b/drivers/usb/dwc3/dwc3-meson-g12a.c @@ -926,6 +926,12 @@ static int __maybe_unused dwc3_meson_g12a_resume(struct device *dev) return ret; } + if (priv->drvdata->usb_post_init) { + ret = priv->drvdata->usb_post_init(priv); + if (ret) + return ret; + } + return 0; } -- 2.40.1