Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp254327ybt; Thu, 25 Jun 2020 21:29:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx1jwMN5Zgc721T9GZqNKiOP9HeT5Gjpm0G8A2yYT+J6ArQ4+iFUHkAw3eo5L782XnZQS34 X-Received: by 2002:a17:906:8542:: with SMTP id h2mr888222ejy.517.1593145748573; Thu, 25 Jun 2020 21:29:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593145748; cv=none; d=google.com; s=arc-20160816; b=RL1cJ6KAM1k5UO74OJPzS9DdkAMh1CfBqOS0KeiysOS5G5JhAFl9s18lELrIPeosIF VDPKniyKqW6V3e4x6Oj8twyAWE/JH2YVX9j2mTzWNRFlPPX7FaIO6uY6sJBHd+dAyOrE DvZIhLHJhgCtkfTJB6QKMBVrUDyyAsFMRk3VyiI709Q6tJTkHIEQiRmmHKIfigH4/ROd vS2qeh3Nw8YnOLYz6XyBqIyhTVOcQDv5bDyHkh/q2jPlgGByHPDuTLSi2Al73sgI/KyV 0uIZhwCFfoO+0n49QXRPvvkYqGr2F4Ui2MYF1PMOJrOQKQEhLADYqbh0DP3MqOnMxAyH 3KYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=awA+aJfmww2/ao85b7H7RA9mG8f4CnoPqX5UUEk/kak=; b=JdC8crpbuMWs00dXM/SLKvtzAsu11CtEwgkArW8X51Ayb4EfI8cyp1SjjsHy/QrRmL qmZSTniLFkv9s0sgugu2DyYC4oDRVErvNu7Yj0AEzUmmswd4M7azvCmpVflIKCYGItSy Xz65304JEPHNI1+9R2kwVa/L1LP0vQqxqtBdrKw9OMQjZp8RrRnbTfTPK2AnMtqoQchN vgZAbSpeCV7gku8m91lHXwLRsHPR39nB6BIx2hhVGKYWmtu/hVkX2BkYONKX2iLZan74 d1SUi7xf9x3SRvgj0aUcezhdbiROK6GLo74OgxlgCFNuAG1EYOLVAsZ/ZIKn7XAD5YPw Mhyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=hCTUZM6O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q26si4180645ejx.217.2020.06.25.21.28.44; Thu, 25 Jun 2020 21:29:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=hCTUZM6O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726996AbgFZBNQ (ORCPT + 99 others); Thu, 25 Jun 2020 21:13:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726252AbgFZBNO (ORCPT ); Thu, 25 Jun 2020 21:13:14 -0400 Received: from mail-lf1-x142.google.com (mail-lf1-x142.google.com [IPv6:2a00:1450:4864:20::142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78D16C08C5C1 for ; Thu, 25 Jun 2020 18:13:12 -0700 (PDT) Received: by mail-lf1-x142.google.com with SMTP id y13so4241625lfe.9 for ; Thu, 25 Jun 2020 18:13:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=awA+aJfmww2/ao85b7H7RA9mG8f4CnoPqX5UUEk/kak=; b=hCTUZM6Ox/OvQ/JlyZz8Suae/jeQnSvAiK8yyi8MhvucZxipYA1+1KVp9Z4H28F5r/ oFI7lN/vhXdgyScwRCqTZTX5p9QjEcai4GEW009ru/kVfwEVvZby1d1/rbTsC4JvkgIG AAUWxi2snR0VIT41gDC/cSVmrV1LvEpce5IzQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=awA+aJfmww2/ao85b7H7RA9mG8f4CnoPqX5UUEk/kak=; b=H1XQ9O2CoeQP6/C+Pdz8Lrn+0OXt7RRmzQ9xyooOcJoihavj1DEyk3ico72xibUF7c y76v9Nt+ijjj/EakW85+JHAUBQvzteHj4NkGM5sFESypXgUQftQlhY2EjDe/uJ2ToWiO F/i5zelYPCHlNMYSgA1UzrnrNLfMEoBFnB6j4txWsH7jMcaTwwBD1N6TS43FjGEJeZaV AwT71fNcJ8GWVPFOL8OMntlI/H8P3AE7Ge8dL1z9ZrNZ8cX+4kQfBaDBoJ+YkPJFafWg OF71D0kxHrL8vFufYo2IOgei+GPRgWPR24E6uJjsz5xMXTOx/XJA8H7HezDaV28JAUYg 7B+A== X-Gm-Message-State: AOAM530McwV5D2Cg7dv2Rv0UnQQhX9caFfBqnDQYUCwQXGtoVm4yrIxp PZDyYDMipmcpo78mO+4BAqowLEVw9Cgd/zvrlhC20w== X-Received: by 2002:a05:6512:328d:: with SMTP id p13mr383775lfe.139.1593133990435; Thu, 25 Jun 2020 18:13:10 -0700 (PDT) MIME-Version: 1.0 References: <20200612164632.25648-1-nsaenzjulienne@suse.de> <20200612164632.25648-5-nsaenzjulienne@suse.de> <954083bf13bd7c24c31c9673269ea0eedb925f43.camel@suse.de> In-Reply-To: <954083bf13bd7c24c31c9673269ea0eedb925f43.camel@suse.de> From: Simon Glass Date: Thu, 25 Jun 2020 19:12:02 -0600 Message-ID: Subject: Re: [PATCH v4 4/5] dm: pci: Assign controller device node to root bridge To: Nicolas Saenz Julienne Cc: Matthias Brugger , U-Boot Mailing List , Bin Meng , Marek Vasut , lk , Marek Szyprowski , Sylwester Nawrocki , Mark Kettenis Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Nicolas, On Wed, 17 Jun 2020 at 13:15, Nicolas Saenz Julienne wrote: > > On Tue, 2020-06-16 at 17:31 -0600, Simon Glass wrote: > > Hi Nicolas, > > > > On Tue, 16 Jun 2020 at 08:09, Nicolas Saenz Julienne > > wrote: > > > On Tue, 2020-06-16 at 07:43 -0600, Simon Glass wrote: > > > > Hi Nicolas, > > > > > > > > On Fri, 12 Jun 2020 at 10:47, Nicolas Saenz Julienne > > > > wrote: > > > > > There is no distinction in DT between the PCI controller device and the > > > > > root bridge, whereas such distinction exists from dm's perspective. Make > > > > > sure the root bridge ofnode is assigned to the controller's platform > > > > > device node. > > > > > > > > > > This permits setups like this to work correctly: > > > > > > > > > > pcie { > > > > > compatible = "..."; > > > > > ... > > > > > dev { > > > > > reg = <0 0 0 0 0>; > > > > > ... > > > > > }; > > > > > }; > > > > > > > > > > Without this the dev node is assigned to the root bridge and the > > > > > actual device search starts one level lower than expected. > > > > > > > > > > Signed-off-by: Nicolas Saenz Julienne > > > > > --- > > > > > drivers/pci/pci-uclass.c | 15 ++++++++++++++- > > > > > 1 file changed, 14 insertions(+), 1 deletion(-) > > > > > > > > Can you update the tests to handle this case please? > > > > > > I'd be glad to, but I'm not familiar with the test FW in u-booy, coud give > > > me > > > some pointers on where/how to test this? > > > > > > > Yes it is at test/dm/pci.c and the device tree is test.dts > > > > 'make qcheck' to run all tests. To run one test, build for sandbox and > > then something like > > > > u-boot -T -c "ut dm pci_swapcase" > > > > for example. > > > > You can perhaps use an existing PCI controller in test.dts but feel > > free to add one more if you need it for your test. Make sure that you > > don't break other tests. > > Thanks for the info. > > Actually adding the tests made me doubleguess myself, and now I'm pretty sure > that what I shoudl've done in DT is the following: > > &pcie0 { > pci@0 { > #address-cells = <3>; > #size-cells = <2>; > ranges; > > reg = <0 0 0 0 0>; > > usb@1,0 { > reg = <0x10000 0 0 0 0>; > resets = <&reset RASPBERRYPI_FIRMWARE_RESET_ID_USB>; > }; > }; > }; > > > (with "lspci -tv": [0000:00]---00.0-[01]----00.0 VIA Technologies, Inc. VL805 USB 3.0 Host Controller) > > With this the patch above isn't needed, which is great. > > I'll send this to upstream Linux just to get a confirmation this is correct, > although if you have any comments it'll be appreciated. Yes it looks OK to me. U-Boot allows PCI and USB devices to be represented in the device tree. Regards, Simon