From patchwork Thu Dec 6 18:42:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 10716649 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 E329D109C for ; Thu, 6 Dec 2018 18:47:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D4BBA2ECBF for ; Thu, 6 Dec 2018 18:47:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C8C4C2EE64; Thu, 6 Dec 2018 18:47:28 +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.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham 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 885902EE79 for ; Thu, 6 Dec 2018 18:47:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725946AbeLFSr0 (ORCPT ); Thu, 6 Dec 2018 13:47:26 -0500 Received: from mo4-p00-ob.smtp.rzone.de ([81.169.146.163]:22027 "EHLO mo4-p00-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725929AbeLFSrZ (ORCPT ); Thu, 6 Dec 2018 13:47:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1544122043; s=strato-dkim-0002; d=gerhold.net; h=Message-Id:Date:Subject:Cc:To:From:X-RZG-CLASS-ID:X-RZG-AUTH:From: Subject:Sender; bh=Q/HM4r+fd1/AKeSuKSkz1JPy9vJutUXBjHOP4Qs509g=; b=r82FY2HTraHEKkAUhpPftkuj3l+mD4m5U9RzMGrLvx8YcP2RdChQ3Ps2ltVjDWX15N 2iJXcAk7Zga3ayY1uulfG2P/0sOyUNvGAnRv+CxwipB1kwrYtCmPw9FtwFbdcVp5L8yW zf6orb35U7RhiA0SBkP2st5dKh4HD2i/5PD4HEdkSmEe/EpLJ0+pPdsVjMIcZJoTZyzq Mtp8F78kBticf0y33s8ugMyc+pQi6OXtsrYzFNR6Zkaai1XZhOQjBFew+iruCWFLVBGm +v+DMgNk6V6gm1a5+l09Ui/RfVLVDrLrYkghcs70l3lejGxzxVELZrbZyYvLSmP1jkhS ibIA== X-RZG-AUTH: ":P3gBZUipdd93FF5ZZvYFPugejmSTVR2nRPhVOQfIcYT8imZYJV7ts/2rrKG5CsycZg==" X-RZG-CLASS-ID: mo00 Received: from localhost.localdomain by smtp.strato.de (RZmta 44.6 AUTH) with ESMTPSA id Y04d7euB6IiDgOi (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Thu, 6 Dec 2018 19:44:13 +0100 (CET) From: Stephan Gerhold To: Felipe Balbi Cc: Hans de Goede , Greg Kroah-Hartman , linux-usb@vger.kernel.org, Stephan Gerhold Subject: [PATCH] Revert "usb: dwc3: pci: Use devm functions to get the phy GPIOs" Date: Thu, 6 Dec 2018 19:42:28 +0100 Message-Id: <20181206184228.17666-1-stephan@gerhold.net> X-Mailer: git-send-email 2.19.2 MIME-Version: 1.0 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 Commit 211f658b7b40 ("usb: dwc3: pci: Use devm functions to get the phy GPIOs") changed the code to claim the PHY GPIOs permanently for Intel Baytrail devices. This causes issues when the actual PHY driver attempts to claim the same GPIO descriptors. For example, tusb1210 now fails to probe with: tusb1210: probe of dwc3.0.auto.ulpi failed with error -16 (EBUSY) dwc3-pci needs to turn on the PHY once before dwc3 is loaded, but usually the PHY driver will then hold the GPIOs to turn off the PHY when requested (e.g. during suspend). To fix the problem, this reverts the commit to restore the old behavior to put the GPIOs immediately after usage. Link: https://www.spinics.net/lists/linux-usb/msg174681.html Cc: stable@vger.kernel.org Signed-off-by: Stephan Gerhold Acked-by: Hans de Goede --- drivers/usb/dwc3/dwc3-pci.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c index 842795856bf4..fdc6e4e403e8 100644 --- a/drivers/usb/dwc3/dwc3-pci.c +++ b/drivers/usb/dwc3/dwc3-pci.c @@ -170,20 +170,20 @@ static int dwc3_pci_quirks(struct dwc3_pci *dwc) * put the gpio descriptors again here because the phy driver * might want to grab them, too. */ - gpio = devm_gpiod_get_optional(&pdev->dev, "cs", - GPIOD_OUT_LOW); + gpio = gpiod_get_optional(&pdev->dev, "cs", GPIOD_OUT_LOW); if (IS_ERR(gpio)) return PTR_ERR(gpio); gpiod_set_value_cansleep(gpio, 1); + gpiod_put(gpio); - gpio = devm_gpiod_get_optional(&pdev->dev, "reset", - GPIOD_OUT_LOW); + gpio = gpiod_get_optional(&pdev->dev, "reset", GPIOD_OUT_LOW); if (IS_ERR(gpio)) return PTR_ERR(gpio); if (gpio) { gpiod_set_value_cansleep(gpio, 1); + gpiod_put(gpio); usleep_range(10000, 11000); } }