From patchwork Tue Oct 17 21:00:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Blumenstingl X-Patchwork-Id: 10012857 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A43C760235 for ; Tue, 17 Oct 2017 21:00:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 924B228A3D for ; Tue, 17 Oct 2017 21:00:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 86ED528A40; Tue, 17 Oct 2017 21:00:58 +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=-4.2 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id ECF7128A3D for ; Tue, 17 Oct 2017 21:00:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:To: Subject:Message-ID:Date:From:References:In-Reply-To:MIME-Version:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=wEDupesQwZK8FuiDyExh2lq/9oV6vRTIQEIf2NmPIN0=; b=H6Ovdcnb9Rm8gEdCHa99MKIoU q0CLUav7cVlm9bllQ41eEgfOdS/s/flfbzOw+KMcR4zMakjOGXlcYlMeTtC5/4Sm3dp7kfl/jBsmW ojoGrHiAmREqeT+Nja8oVBOWXLZGwVKQPKxA9cBtiMZ++LjetDAomsxjb6/JnjjggFJlK+ZdmfHLu x7E9Ewz5gDPobHsMzhD5rqy47omWIfFXtrLt5x2Zd5uFK1n7MO+jFGg0380p2dLEYUzQxwXt4F8NN w+BI8KArWDsCrmUPgTU07HtWfgFv6MvxIVUNw3uZl5QJs2pfFj+3xTvizJoRK9YZSViYY0XqY48gZ S7LRj0c2g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1e4Yyo-00039j-7B; Tue, 17 Oct 2017 21:00:50 +0000 Received: from mail-io0-x243.google.com ([2607:f8b0:4001:c06::243]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1e4Yyj-000280-IS for linux-amlogic@lists.infradead.org; Tue, 17 Oct 2017 21:00:48 +0000 Received: by mail-io0-x243.google.com with SMTP id m81so3741269ioi.13 for ; Tue, 17 Oct 2017 14:00:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=O0oyj8RDuF7QZ838uUWVYE5NbS4PxFrzq3OYuLG74Dk=; b=U3hYtCE/jvsawP4ZrZiKtgpdCrrFN6XQCZMU3YWMJb8JWHorqTTXxCxRptKyJKTIfR Duz/Kef6F1jG/FhuRGTGxzwqjyBHuWpk13vxahPWu7J+gSgtFTxCzpM8fu0SzBhKm5SR 6QYjiKiurj6P+UScOF1505lNJAPX/UXhT4uRL21Y4M3bklxGY9SFgp36FuMo82Tfn96P t0HHRiYSWiIFzKDjP5njYJzQzl49O0UT98NjtAwdsx/Ze+yseeAS7xG14BihBAZyvldP SGK4UnYPjzlJt+TMXPCF8xR14nVEiACfLzWAnxllmN4zUk5c+wfEsREIqe4ZhSZTzbnd ml/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=O0oyj8RDuF7QZ838uUWVYE5NbS4PxFrzq3OYuLG74Dk=; b=KqYTGEDAMm0YKUj+d2I3WYs1cIgEwv+bW4G0CQX0Z7uyc0X5DGGpPEgucOx4WIzhgd xeNR0IFoFALZLzVDWZv3qtk1d6d49ocPnQWnRxCaXBs7cRRIYmALG7tSmXA0t6gkW3Kp qBfOooVw+XVqxd7SvybBhx7VBc6DxqDk5Tque584hJ1A0NxvPAX/immnX6H+ExNkCsrC /HJUwXd/1Cg4p2n77SS9SY63hOURjiUDTWwc3cgFer6qSuT+XGAamPERdiw+65KkRJmA x1+m3C6tVYiO5uHPw68MsoqQrKmBCxYdbKroVmU6tGK/TysfWx80VXz9RopbyElyVsHP o7SA== X-Gm-Message-State: AMCzsaVRVrDCtMXdNu1Mhp7yGnocrWCLcAVdEnY1O+BPgrb2jnHgMIE2 Ka+F+c/Pygtff0sjcBhCzO5CuwvWkQ1quaXqJuk= X-Google-Smtp-Source: ABhQp+T+4izRfrgFENLz1B7u755/oKAn+i03AAvUT6DHEBfL79a9mDjoQGuuzGzfUaVOcjSGtjh25unOBOcVSCL5nNA= X-Received: by 10.107.22.65 with SMTP id 62mr17549028iow.269.1508274023756; Tue, 17 Oct 2017 14:00:23 -0700 (PDT) MIME-Version: 1.0 Received: by 10.2.151.236 with HTTP; Tue, 17 Oct 2017 14:00:03 -0700 (PDT) In-Reply-To: References: <20171008211713.18696-1-martin.blumenstingl@googlemail.com> <20171008211713.18696-2-martin.blumenstingl@googlemail.com> From: Martin Blumenstingl Date: Tue, 17 Oct 2017 23:00:03 +0200 Message-ID: Subject: Re: [RFC usb-next v5 1/3] dt-bindings: usb: add the documentation for USB root-hub To: Arnd Bergmann X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171017_140045_684280_B7BD5EFD X-CRM114-Status: GOOD ( 25.37 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , DTML , felipe.balbi@linux.intel.com, mathias.nyman@intel.com, gregkh , linux-usb@vger.kernel.org, Rob Herring , Chunfeng Yun , "open list:ARM/Amlogic Meson SoC support" Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Hi Arnd, On Fri, Oct 13, 2017 at 9:37 AM, Arnd Bergmann wrote: > On Thu, Oct 12, 2017 at 10:56 PM, Martin Blumenstingl > wrote: >> Hi Arnd, >> >> thank you for reviewing this patch! >> >> On Mon, Oct 9, 2017 at 12:24 PM, Arnd Bergmann wrote: >>> On Sun, Oct 8, 2017 at 11:17 PM, Martin Blumenstingl >>> wrote: >>>> A USB root-hub may have several PHYs which need to be configured before >>>> the root-hub starts working. >>>> This adds the documentation for such a USB root-hub as well as a hint >>>> regarding the child-nodes on XHCI controllers which can include the >>>> roothub. >>>> >>>> Signed-off-by: Martin Blumenstingl >>>> Acked-by: Rob Herring >>> >>> Have you checked that this still works with DT properties on a USB device >>> that is listed in the DT? A common use-case is to provide the MAC address >>> of a soldered-down USB-ethernet that lacks its own eeprom, and it seems >>> you are changing the way the parent devices of that get represented, >>> so the dev->of_node pointer in the USB device might no longer refer >>> to the correct device. >> I haven't tested the described use-case. however, this patch is not >> supposed to change the binding for actual devices. >> USB device numbering starts at 1, while 0 is reserved for the root-hub >> (at least from what I know). before this patch there was no way to >> describe the root-hub via .dts. this however is required for some >> platforms that need to set up a PHY for each port on the root-hub >> (Amlogic Meson GXL platform is one example: there are two ports >> enabled on dwc3's root-hub with 2x USB2 and 1x USB3 PHYs) - so this >> patch uses a similar binding as we already have (to describe the >> devices) to describe the root-hub > > My point is that the DT binding does depend on the hierarchy, there > is no way to find a particular device unless each parent up the > chain is described correctly in DT as well and has a valid of_node > pointer. > > It's possible that this has never worked on XHCI because of the lack > of the root-hub in DT. Either way, we should ensure that it does work > now and you didn't break it, so please at least test it with your patches. > > The patch below should be sufficient to see if any device has an > of_node pointer when you add it to your DT: I slightly modified your patch (see the attached version) and tried it: # lsusb -t /: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/0p, 5000M /: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/2p, 480M |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M |__ Port 3: Dev 3, If 0, Class=Mass Storage, Driver=usb-storage, 480M the roothub (bus 1 port 1 dev 1) and a soldered down hub (child of that root-hub, port 1 dev 2) have an entry in the .dts # dmesg | grep usb [ 0.174097] usbcore: registered new interface driver usbfs [ 0.174147] usbcore: registered new interface driver hub [ 0.174217] usbcore: registered new device driver usb [ 1.354280] usb usb2: We don't know the algorithms for LPM for this host, disabling LPM. [ 1.373297] usbcore: registered new interface driver usb-storage [ 1.512840] usbcore: registered new interface driver dvb_usb_rtl28xxu [ 1.550506] usb 1-1: of_node /soc/usb@c9000000/hub@1 parent /soc/usb@c9000000 ^ this is the soldered down hub [ 1.552579] usbcore: registered new interface driver bcm203x [ 1.712033] usbcore: registered new interface driver usbhid [ 1.716994] usbhid: USB HID core driver [ 1.738827] usb 1-1: new high-speed USB device number 2 using xhci-hcd [ 2.142392] usb 1-1.3: of_node parent /soc/usb@c9000000/hub@1 ^ this is the thumb drive plugged into the hub (not specified in the .dts) [ 2.220399] usb 1-1.3: new high-speed USB device number 3 using xhci-hcd [ 2.326144] usb-storage 1-1.3:1.0: USB Mass Storage device detected [ 2.328352] scsi host0: usb-storage 1-1.3:1.0 so for me it seems to be working fine is there anything else you want me to test? > diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c > index 17681d5638ac..498d0aa0a5c0 100644 > --- a/drivers/usb/core/usb.c > +++ b/drivers/usb/core/usb.c > @@ -647,6 +647,7 @@ struct usb_device *usb_alloc_dev(struct usb_device *parent, > } > dev->dev.of_node = usb_of_get_child_node(parent->dev.of_node, > raw_port); > + dev_info(&dev->dev, "of_node %p parent %p\n", > dev->dev.of_node, parent->dev.of_node); > > /* hub driver sets up TT records */ > } > > > Arnd Regards, Martin diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi index cfbfbfeff85d..7677ce77d122 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi @@ -81,6 +81,11 @@ phy-names = "usb2-phy"; }; }; + + hub@1 { + compatible = "usb1a40,801"; + reg = <1>; + }; }; }; }; diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index 17681d5638ac..893f4e8b0733 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c @@ -647,6 +647,7 @@ struct usb_device *usb_alloc_dev(struct usb_device *parent, } dev->dev.of_node = usb_of_get_child_node(parent->dev.of_node, raw_port); + dev_info(&dev->dev, "of_node %s parent %s\n", of_node_full_name(dev->dev.of_node), of_node_full_name(parent->dev.of_node)); /* hub driver sets up TT records */ }