From patchwork Tue Apr 30 14:59:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Liu X-Patchwork-Id: 10923767 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 143681395 for ; Tue, 30 Apr 2019 14:59:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 04EA9287A2 for ; Tue, 30 Apr 2019 14:59:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ED61F288C4; Tue, 30 Apr 2019 14:59:56 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 9A2FE287A2 for ; Tue, 30 Apr 2019 14:59:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726048AbfD3O7z (ORCPT ); Tue, 30 Apr 2019 10:59:55 -0400 Received: from lelv0142.ext.ti.com ([198.47.23.249]:41828 "EHLO lelv0142.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726101AbfD3O7o (ORCPT ); Tue, 30 Apr 2019 10:59:44 -0400 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id x3UExhWk115324; Tue, 30 Apr 2019 09:59:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1556636383; bh=M9IWSWNDfU9K9d0C52pfEAYmcgedKKykkW6GxE/IWks=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=fQMWieZgrAUEd5L2Cz2J/ISmUyI6xSd85j/88LK1l2F50pUyycC/U6LRtqxfW3SHU uaBKInhck1ykVD9Q9nz3pAhAi3cWV9BbuIIWZj47vBeM2eZCNvNNJDmF2ocLG5B+Y+ wDvKFKrC4RpiBAYEkVr8Ij/JRl0gP6hYfUwZK1Fs= Received: from DLEE102.ent.ti.com (dlee102.ent.ti.com [157.170.170.32]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x3UExhq8045789 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 30 Apr 2019 09:59:43 -0500 Received: from DLEE115.ent.ti.com (157.170.170.26) by DLEE102.ent.ti.com (157.170.170.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Tue, 30 Apr 2019 09:59:42 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DLEE115.ent.ti.com (157.170.170.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Tue, 30 Apr 2019 09:59:42 -0500 Received: from uda0271908.am.dhcp.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id x3UExgrG071248; Tue, 30 Apr 2019 09:59:42 -0500 From: Bin Liu To: Greg Kroah-Hartman CC: , Bin Liu Subject: [PATCH 6/7] usb: musb: jz4740: obtain USB PHY from devicetree Date: Tue, 30 Apr 2019 09:59:40 -0500 Message-ID: <20190430145942.1128-7-b-liu@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190430145942.1128-1-b-liu@ti.com> References: <20190430145942.1128-1-b-liu@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 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 From: Paul Cercueil Fall back to devm_usb_get_phy() if devicetree is not available. Signed-off-by: Paul Cercueil Signed-off-by: Bin Liu --- drivers/usb/musb/jz4740.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/drivers/usb/musb/jz4740.c b/drivers/usb/musb/jz4740.c index ad35e09f90bd..5261f8dfedec 100644 --- a/drivers/usb/musb/jz4740.c +++ b/drivers/usb/musb/jz4740.c @@ -74,9 +74,14 @@ static struct musb_hdrc_platform_data jz4740_musb_platform_data = { static int jz4740_musb_init(struct musb *musb) { - musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); + struct device *dev = musb->controller->parent; + + if (dev->of_node) + musb->xceiv = devm_usb_get_phy_by_phandle(dev, "phys", 0); + else + musb->xceiv = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2); if (IS_ERR(musb->xceiv)) { - pr_err("HS UDC: no transceiver configured\n"); + dev_err(dev, "No transceiver configured\n"); return PTR_ERR(musb->xceiv); } @@ -90,13 +95,6 @@ static int jz4740_musb_init(struct musb *musb) return 0; } -static int jz4740_musb_exit(struct musb *musb) -{ - usb_put_phy(musb->xceiv); - - return 0; -} - /* * DMA has not been confirmed to work with CONFIG_USB_INVENTRA_DMA, * so let's not set up the dma function pointers yet. @@ -105,7 +103,6 @@ static const struct musb_platform_ops jz4740_musb_ops = { .quirks = MUSB_DMA_INVENTRA | MUSB_INDEXED_EP, .fifo_mode = 2, .init = jz4740_musb_init, - .exit = jz4740_musb_exit, }; static int jz4740_probe(struct platform_device *pdev)