From patchwork Tue Oct 2 11:57:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yoshihiro Shimoda X-Patchwork-Id: 10623503 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 65A00175A for ; Tue, 2 Oct 2018 11:59:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5B0ED2793B for ; Tue, 2 Oct 2018 11:59:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4EA0F2871E; Tue, 2 Oct 2018 11:59:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B8A6A2793B for ; Tue, 2 Oct 2018 11:59:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727608AbeJBSmn (ORCPT ); Tue, 2 Oct 2018 14:42:43 -0400 Received: from relmlor3.renesas.com ([210.160.252.173]:14154 "EHLO relmlie2.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727510AbeJBSmn (ORCPT ); Tue, 2 Oct 2018 14:42:43 -0400 Received: from unknown (HELO relmlir2.idc.renesas.com) ([10.200.68.152]) by relmlie2.idc.renesas.com with ESMTP; 02 Oct 2018 20:59:42 +0900 Received: from relmlii2.idc.renesas.com (relmlii2.idc.renesas.com [10.200.68.66]) by relmlir2.idc.renesas.com (Postfix) with ESMTP id 0AD1390B3D; Tue, 2 Oct 2018 20:59:42 +0900 (JST) X-IronPort-AV: E=Sophos;i="5.54,331,1534777200"; d="scan'208";a="294079048" Received: from mail-ty1jpn01lp0181.outbound.protection.outlook.com (HELO JPN01-TY1-obe.outbound.protection.outlook.com) ([23.103.139.181]) by relmlii2.idc.renesas.com with ESMTP/TLS/AES256-SHA256; 02 Oct 2018 20:59:41 +0900 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesasgroup.onmicrosoft.com; s=selector1-renesas-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=H8bzd60gzQ6Rd+bF2C9DNNWSFS62zEI/xbnBmVxZUjc=; b=GRjMeodXSkgoO+mUHBL7vx5NouqzAvSC4K7Zp69WjL8f4HosKuWDptxlgbqjnfyuVIrzCZWjjc9MEQDfUXa07xYvOCuMpAgwdnRvwxp6aglz7R7JvhJiFvzAnB2jGZ/Z0VD2vrH6n7YHJpnp/7y6DWBFNBHEV50DQsEp83dXJsc= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=<>; Received: from localhost.localdomain (211.11.155.144) by TYAPR01MB2302.jpnprd01.prod.outlook.com (2603:1096:404:3::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1185.23; Tue, 2 Oct 2018 11:59:40 +0000 From: Yoshihiro Shimoda To: balbi@kernel.org Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, linux-renesas-soc@vger.kernel.org, stable@vger.kernel.org, Yoshihiro Shimoda Subject: [PATCH] usb: gadget: udc: renesas_usb3: Fix b-device mode for "workaround" Date: Tue, 2 Oct 2018 20:57:44 +0900 Message-Id: <1538481464-24766-1-git-send-email-yoshihiro.shimoda.uh@renesas.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: OSBPR01CA0017.jpnprd01.prod.outlook.com (2603:1096:603::29) To TYAPR01MB2302.jpnprd01.prod.outlook.com (2603:1096:404:3::22) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 92bed5d6-fcb4-4190-2e93-08d6285e8892 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989299)(4534165)(4627221)(201703031133081)(8559020)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020);SRVR:TYAPR01MB2302; X-Microsoft-Exchange-Diagnostics: 1;TYAPR01MB2302;3:U66BXrmBMSS6GQ03H/oUPhKq9cJ2DMx31LNwu54C9clJaiN1GwGptvhtu/JEs7aY5ZD9KkezgvhGOitiMG/hAsW/bWEpXC7rZUyzsh8U7MH8p61t/DKMbqbaGtDGxpRkbD5p/QOOdZgvqLb2fJGKI2T15tYJGyJaKdGHPt9LNjKT6bKwkf2uUlYKQG1TzqWErTxo5PJjbbKdloukJ9cKo3gBLhSLAnnnhlvwQuxUzCVVWRTw6bCpfq4lWtUCUHN3;25:2WednD9W0kmaujpCB7/iJMcBgUiYZK159RVc72ADgVKReG0//6IrPrqZM31W6roRtyncxWAFKn3NY1HuXgAP1RqTW798Bu6A9uF5uMV63GF2xT0VdwOGjf7cGxYFjbZvx/x28JaiEsUnYSLR+14JXzjFPEaKKCyqqHJAyubd3hO6vfrSnMYmzlLspxTkNDFch62W52X5UEE8pcMdkWEqh2kJM/0xrzBJYMMeo2781jT/p3QnNArZY4c85tW+9nzYdeAupeXtvR2L8ef0ubJZltQKhyHq8KeBbNBf7qiNA6Vadki61T0893NK19D4cPhbIq5XXOlt4KfJZ9IqCjj01w==;31:J4ghJfhyOSCrjiekv+TA7v0+toeGnboVgT97blyG87TOsuvcPTxspBERdNI317nq7aF5/tt5++aNjSnaun8NqV0D7Zr6flpdLkUVmvh7NY31B8gq31KlyOXrnTbteVxnuIkiJgVBp8tDlQs61olALIv6udpYTVGqXjmcva/IhrNoC7pw3MAWZHHczwROZs+mpA8zT4c1B3heJSxtM6n8CGDF6+T+PVmLk0xC6lgXVC8= X-MS-TrafficTypeDiagnostic: TYAPR01MB2302: X-Microsoft-Exchange-Diagnostics: 1;TYAPR01MB2302;20:XIlTTHwYZFMoeSE133euQ0pGaPyrBdoVnMAWg+BLC8uFbFZCcpPh9DqCCOVvqjnMa4sNhlWyczPGSaIfFacwKy8iIsQLp31EMLobLokGM1xRt2VA6dCU6jPza12xFaYOjYYh71zXVL15M31JIVjgluaqlN90COsMwfLkSaAtNRCqRdafmLp5fKVRgnXDN6r40cYuDn9QCQeqP/n919THVt58Ck/OgGtuQ+NqQakSALVmJkVlJQi0Erm8BY7gmYT1d11/hUx2fSpsJ8kL6pD4hMidmxO0YBGjOGArGYT+Eql0rhzwcF/uIc9ls4xS3dtM7oGX/vo/8Z5Vvw/vMTYB9B0+gvpruKomb2nd6AAdSqrlWX7lSw3wZH3XKbCsWTqsrVzuDTCyuFWkmvCF+wYdLG8q6kZ0Ol+xhqWpBeaTzPneF6APwtNPz2EFNP+ftRF1+rq9KX8/YVSHPDmf/mXwlP67teHt+Tbs2ArOmwTfHO0vfNAq6iI+/KlutoCidHkM;4:TV+3F59Eq3YzrDnvJdPmfgYVRMYZEaGycti2uGBXMvCNd7PGDFzBwGl8wI4vkjq7rCw/SWV7hfaV+7c8LwuhJQkFdJ5cQ5X8pKAe5GwIhqkVFwjUq74MakJoUIE/jk9lgp6uCj4jdRQ+oeuP4lK2DbrpNiT9ddPVW2tiE4s68b+UpH2ZIFvx63fU+R60NLHoVzk6w7Q2wrSgqWbUHwJwAuV3h/H0juqgEgUC8jgdTksPW0g9wNhP7DSdChDLQHOUnfXqCnYQa+SkGOZscYxCzASxbtAGMIC6jap+unfgE3zurWnBJbsmA+Bakoh7jplj X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(9452136761055); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(93006095)(3002001)(3231355)(944501410)(52105095)(10201501046)(6055026)(149066)(150057)(6041310)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061750153)(20161123564045)(20161123558120)(20161123560045)(201708071742011)(7699051);SRVR:TYAPR01MB2302;BCL:0;PCL:0;RULEID:;SRVR:TYAPR01MB2302; X-Forefront-PRVS: 0813C68E65 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6069001)(376002)(346002)(39860400002)(396003)(366004)(136003)(189003)(199004)(3846002)(81156014)(956004)(476003)(81166006)(386003)(8676002)(498600001)(486006)(26005)(16586007)(16526019)(1857600001)(69590400006)(106356001)(97736004)(42882007)(2616005)(6486002)(2351001)(6916009)(105586002)(316002)(6506007)(107886003)(68736007)(2361001)(25786009)(36756003)(66066001)(53936002)(5660300001)(14444005)(305945005)(48376002)(8936002)(50226002)(7736002)(51416003)(2906002)(6512007)(78352004)(47776003)(6116002)(52116002)(50466002)(4326008)(3720700003);DIR:OUT;SFP:1102;SCL:1;SRVR:TYAPR01MB2302;H:localhost.localdomain;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:0;A:0; Received-SPF: None (protection.outlook.com: localhost.localdomain does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: 1;TYAPR01MB2302;23:XGnxewLzLjB1HIa6cF7uWJxkgjoX2WSXRMgZqwL4eFPAFW7fAjQuZlZ7GfpZOpuFIV5arwGvERUjSqOHyg2YcvQroPwXz15hQfzZDRB+tz8jOhaIwQglv+0xQHtx5u2mhaRQ5rHCOm3NPjb/C4lrU59ChWM5HhgSYzJs+SoyQzpB6mDDaexRZcqEwzhWqgNILPrp1v43XUZXEOuJltbwgsW0zP8/OrtgxXP5FKMO7SsmP6EC0BTOpoDr8uqAmRvwNI4S4TNHxmG3KioXEO868UnfYYHKsQOXd3Z3CMNzwYksDkHsKuSLRv6tFKj5YO/XAduM+joPArwpxc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xWjjb1RtFoyUqYgt0mjKU0A7l00F1Cxq1Rj82Q4RBFygOVpssbsPXeIuZAit3Wf09YQQF8ECEE3Ca+ZBznfEn0CQu0xut1gDpsPLcmOy SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;TYAPR01MB2302;20:YfMpSgX3nEYRxQYywFvsyxycl9HpTOvokeHfJzZubfVeOb2NbW0jAmbcvVNtoz2nWdJfSnHPodd5ssPS9jluCuk9RDPd8Yyv0lVwV47vPRGLZj4voxsmbGWlT6gVS45Z4upESHI7geWamL7apSh2Si2cIE2CwhPaBP2nJfw2JNI= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Oct 2018 11:59:40.1021 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 92bed5d6-fcb4-4190-2e93-08d6285e8892 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYAPR01MB2302 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If the "workaround_for_vbus" is true, the driver will not call usb_disconnect(). So, since the controller keeps some registers' value, the driver doesn't re-enumarate suitable speed after the b-device mode is disabled. To fix the issue, this patch adds usb_disconnect() calling in renesas_usb3_b_device_write() if workaround_for_vbus is true. Fixes: 43ba968b00ea ("usb: gadget: udc: renesas_usb3: add debugfs to set the b-device mode") Cc: # v4.14+ Signed-off-by: Yoshihiro Shimoda Reviewed-by: Simon Horman --- drivers/usb/gadget/udc/renesas_usb3.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/usb/gadget/udc/renesas_usb3.c b/drivers/usb/gadget/udc/renesas_usb3.c index e1656f3..67d8a50 100644 --- a/drivers/usb/gadget/udc/renesas_usb3.c +++ b/drivers/usb/gadget/udc/renesas_usb3.c @@ -2437,6 +2437,9 @@ static ssize_t renesas_usb3_b_device_write(struct file *file, else usb3->forced_b_device = false; + if (usb3->workaround_for_vbus) + usb3_disconnect(usb3); + /* Let this driver call usb3_connect() anyway */ usb3_check_id(usb3);