From patchwork Thu Mar 21 15:09:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 10863763 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 660A517E0 for ; Thu, 21 Mar 2019 15:10:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4920F2A0C1 for ; Thu, 21 Mar 2019 15:10:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3C4972A263; Thu, 21 Mar 2019 15:10:16 +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 D5A0D2A0C1 for ; Thu, 21 Mar 2019 15:10:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728507AbfCUPKK (ORCPT ); Thu, 21 Mar 2019 11:10:10 -0400 Received: from outils.crapouillou.net ([89.234.176.41]:47414 "EHLO crapouillou.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727881AbfCUPKG (ORCPT ); Thu, 21 Mar 2019 11:10:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1553181003; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=85tuU9E/K2KHBS7SEf/SrKNaXEXPxafH1Mpt0gibGVQ=; b=yZ+b4kZx8SAz1VLYaBW4lGJFs3MxoDcRLwQO0dOPDE2ewj4Q8ol/8okUMREKnKhW+NBuyC ndovKQz2HcS/bkcnrvSi+Lr1aeFNr381z+SlEgy1BpLFcuIYVtjonwgrJhnniiWctrOAiM IkFESqJW2S+b0mqYMP74SYaYBuFzvqk= From: Paul Cercueil To: Bin Liu , Rob Herring , Mark Rutland Cc: linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, od@zcrc.me, Paul Cercueil Subject: [PATCH 3/3] usb: musb: jz4740: obtain USB PHY from devicetree Date: Thu, 21 Mar 2019 16:09:56 +0100 Message-Id: <20190321150956.6629-3-paul@crapouillou.net> In-Reply-To: <20190321150956.6629-1-paul@crapouillou.net> References: <20190321150956.6629-1-paul@crapouillou.net> 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 Fall back to devm_usb_get_phy() if devicetree is not available. Signed-off-by: Paul Cercueil --- 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..e4dbf76548c0 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, "usb-phy", 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)