From patchwork Thu Apr 4 09:47:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 10885331 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 4A4601390 for ; Thu, 4 Apr 2019 09:47:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 32D07289EA for ; Thu, 4 Apr 2019 09:47:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2519C28A22; Thu, 4 Apr 2019 09:47:50 +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 CCC5D289EA for ; Thu, 4 Apr 2019 09:47:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731035AbfDDJrs (ORCPT ); Thu, 4 Apr 2019 05:47:48 -0400 Received: from outils.crapouillou.net ([89.234.176.41]:38502 "EHLO crapouillou.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730481AbfDDJrr (ORCPT ); Thu, 4 Apr 2019 05:47:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1554371265; 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:references; bh=pC7IhBU1DSC3dGwjIZTkxjmjv2SxALVB8x57y+wbglU=; b=PG0J+FYJ6gyXUbUJuQ8IPYFXUSQDC/mXCB6ZVmucUAayf22IFCvub/9l5IkcfPttxKnqF4 Oq+2kZUD9hiqy1vZ2T3cH2d4FdsBJchU++0ZqF2hrzw1bFtr0pqHNm8dx0xJ3SouaxkXEo bg5o1Gx9B5oQoBJ/7FV9y4OH+YWr2Mo= From: Paul Cercueil To: Rob Herring , Mark Rutland , Bin Liu Cc: od@zcrc.me, linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH v2 1/3] dt-bindings: usb: Add usb-phy property to the jz4740-musb node Date: Thu, 4 Apr 2019 11:47:37 +0200 Message-Id: <20190404094739.23503-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 Add a required 'usb-phy' property, to obtain a phandle to the USB PHY from devicetree. Signed-off-by: Paul Cercueil Reviewed-by: Rob Herring --- Notes: v2: Change "usb-phy" DT property to "phys" Documentation/devicetree/bindings/usb/ingenic,jz4740-musb.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Documentation/devicetree/bindings/usb/ingenic,jz4740-musb.txt b/Documentation/devicetree/bindings/usb/ingenic,jz4740-musb.txt index 620355cee63f..16808721f3ff 100644 --- a/Documentation/devicetree/bindings/usb/ingenic,jz4740-musb.txt +++ b/Documentation/devicetree/bindings/usb/ingenic,jz4740-musb.txt @@ -8,9 +8,15 @@ Required properties: - interrupt-names: must be "mc" - clocks: phandle to the "udc" clock - clock-names: must be "udc" +- phys: phandle to the USB PHY Example: +usb_phy: usb-phy@0 { + compatible = "usb-nop-xceiv"; + #phy-cells = <0>; +}; + udc: usb@13040000 { compatible = "ingenic,jz4740-musb"; reg = <0x13040000 0x10000>; @@ -21,4 +27,6 @@ udc: usb@13040000 { clocks = <&cgu JZ4740_CLK_UDC>; clock-names = "udc"; + + phys = <&usb_phy>; }; From patchwork Thu Apr 4 09:47:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 10885335 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 C99571390 for ; Thu, 4 Apr 2019 09:48:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B1432289EA for ; Thu, 4 Apr 2019 09:48:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A5EC128A25; Thu, 4 Apr 2019 09:48:06 +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 52F6B289EA for ; Thu, 4 Apr 2019 09:48:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730729AbfDDJsA (ORCPT ); Thu, 4 Apr 2019 05:48:00 -0400 Received: from outils.crapouillou.net ([89.234.176.41]:38522 "EHLO crapouillou.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730533AbfDDJrs (ORCPT ); Thu, 4 Apr 2019 05:47:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1554371267; 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=Opyb8KhrB2MB98Ju5eXKxdZcdra1hXOw/sp0QdFgVqM=; b=AA/slkH3SVqlR2L/oT6/FE9xNhhu4ISJD8wdmAFpTRmSPx3pP6/ecwaqdCpB47tANuRqvu 2kdPILUL6mffq20u2IqBBTANDvDjAl7CxQhy0XYlkaudeZHXwX0EZG3Qw9u1kqWnfEgN+2 ZYg71cS1nX3SwG051JQnLA57ieXHVKI= From: Paul Cercueil To: Rob Herring , Mark Rutland , Bin Liu Cc: od@zcrc.me, linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH v2 2/3] usb: musb: jz4740: Let the platform probe the PHY Date: Thu, 4 Apr 2019 11:47:38 +0200 Message-Id: <20190404094739.23503-2-paul@crapouillou.net> In-Reply-To: <20190404094739.23503-1-paul@crapouillou.net> References: <20190404094739.23503-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 By registering a generic USB PHY from within the driver, we may shadow the USB PHY registered by the platform, which might be different. Signed-off-by: Paul Cercueil --- Notes: v2: No change drivers/usb/musb/jz4740.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/usb/musb/jz4740.c b/drivers/usb/musb/jz4740.c index a60627bf7be3..ad35e09f90bd 100644 --- a/drivers/usb/musb/jz4740.c +++ b/drivers/usb/musb/jz4740.c @@ -74,7 +74,6 @@ static struct musb_hdrc_platform_data jz4740_musb_platform_data = { static int jz4740_musb_init(struct musb *musb) { - usb_phy_generic_register(); musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); if (IS_ERR(musb->xceiv)) { pr_err("HS UDC: no transceiver configured\n"); @@ -183,7 +182,6 @@ static int jz4740_remove(struct platform_device *pdev) struct jz4740_glue *glue = platform_get_drvdata(pdev); platform_device_unregister(glue->musb); - usb_phy_generic_unregister(pdev); clk_disable_unprepare(glue->clk); return 0; From patchwork Thu Apr 4 09:47:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 10885333 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 5ABCF1390 for ; Thu, 4 Apr 2019 09:47:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3FBE7289EA for ; Thu, 4 Apr 2019 09:47:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 30D2128A22; Thu, 4 Apr 2019 09:47:57 +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 D5863289EA for ; Thu, 4 Apr 2019 09:47:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731185AbfDDJru (ORCPT ); Thu, 4 Apr 2019 05:47:50 -0400 Received: from outils.crapouillou.net ([89.234.176.41]:38534 "EHLO crapouillou.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731037AbfDDJru (ORCPT ); Thu, 4 Apr 2019 05:47:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1554371267; 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=c5gIV1WBt4NfCQy/Dtw/ozvFkXgXPwJC2jGPWx6xhkQ=; b=UMbV94QYqXtWVZ0DWSXLgNyN8EuShmTCzF99N9GFku8a5dKofDc4ti/vSQ2kIHDzd6pp9N eOgQbgIaPETPZAhmZQd36eaNSESpkuNVVAjrdGCTW/jtbJJCJlFLSQrb/swRvfp5fwp1mc n/HEg48dBJgl6ok8Q3PpiIsCcv6hiqg= From: Paul Cercueil To: Rob Herring , Mark Rutland , Bin Liu Cc: od@zcrc.me, linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH v2 3/3] usb: musb: jz4740: obtain USB PHY from devicetree Date: Thu, 4 Apr 2019 11:47:39 +0200 Message-Id: <20190404094739.23503-3-paul@crapouillou.net> In-Reply-To: <20190404094739.23503-1-paul@crapouillou.net> References: <20190404094739.23503-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 --- Notes: v2: Change "usb-phy" DT property to "phys" 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)