From: Ryder Lee <ryder.lee@mediatek.com>
To: Bjorn Helgaas <helgaas@kernel.org>
Cc: Honghui Zhang <honghui.zhang@mediatek.com>,
bhelgaas@google.com, robh@kerenl.org, robh+dt@kernel.org,
matthias.bgg@gmail.com, linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org, linux-pci@vger.kernel.org,
linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
yingjoe.chen@mediatek.com, eddie.huang@mediatek.com,
hongkun.cao@mediatek.com, youlin.pei@mediatek.com,
yong.wu@mediatek.com, yt.shen@mediatek.com,
sean.wang@mediatek.com, xinping.qian@mediatek.com
Subject: Re: [PATCH v2 4/5] PCI: mediatek: Add new generation controller support
Date: Sat, 5 Aug 2017 12:52:43 +0800 [thread overview]
Message-ID: <1501908763.8298.11.camel@mtkswgap22> (raw)
In-Reply-To: <20170804131808.GA16580@bhelgaas-glaptop.roam.corp.google.com>
Hi Honghui, Bjorn,
On Fri, 2017-08-04 at 08:18 -0500, Bjorn Helgaas wrote:
> On Fri, Aug 04, 2017 at 04:39:36PM +0800, Honghui Zhang wrote:
> > On Thu, 2017-08-03 at 17:42 -0500, Bjorn Helgaas wrote:
> > > > +
> > > > +static struct mtk_pcie_port *mtk_pcie_find_port(struct mtk_pcie *pcie,
> > > > + struct pci_bus *bus, int devfn)
> > > > +{
> > > > + struct pci_dev *dev;
> > > > + struct pci_bus *pbus;
> > > > + struct mtk_pcie_port *port, *tmp;
> > > > +
> > > > + list_for_each_entry_safe(port, tmp, &pcie->ports, list) {
> > > > + if (bus->number == 0 && port->index == PCI_SLOT(devfn)) {
> > > > + return port;
> > > > + } else if (bus->number != 0) {
> > > > + pbus = bus;
> > > > + do {
> > > > + dev = pbus->self;
> > > > + if (port->index == PCI_SLOT(dev->devfn))
> > > > + return port;
> > > > + pbus = dev->bus;
> > > > + } while (dev->bus->number != 0);
> > > > + }
> > > > + }
> > > > +
> > > > + return NULL;
> > >
> > > You should be able to use sysdata to avoid searching the list.
> > > See drivers/pci/host/pci-aardvark.c, for example.
> > >
> >
> > I could put the mtk_pcie * in sysdata, but still need to searching the
> > list to get the mtk_pcie_port *, how about:
> >
> > list_for_each_entry_safe(port, tmp, &pcie->ports, list) {
> > if (port->index == PCI_SLOT(devfn))
> > return port;
> > }
>
> No. Other drivers don't need to search the list. Please take a look
> at them and see how they solve this problem. I don't think your
> hardware is fundamentally different in a way that means you need to
> search when the others don't.
>
I'm not directly involved in this generation, but I guess the main reason why Honghui need to do that is just because this hardware access configuration space via per-port registers, not just for the guard.
Currently, We had a host bridge with two ports (two subnodes in binding text), thus he tried to tells them apart so that he can get the correct registers.
Some platforms don't need to do that since they just have a single port (no more subnodes), the others might have specific/shared registers to access configuration space. (e.g. Tegra, MTK legacy IP block).
Or, he can split them into two independent nodes, but it will break common probing flow by doing so. (I'd prefer to use subnodes.)
Ryder
next prev parent reply other threads:[~2017-08-05 4:52 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-27 2:58 [PATCH v2 0/5] PCI: MediaTek: Add support for new generation host controller honghui.zhang
2017-07-27 2:58 ` [PATCH v2 1/5] PCI: mediatek: Add a structure to abstract the controller generations honghui.zhang
[not found] ` <948f9bd0881402d13e6913ad425e7dff50f3fcfc.1501122135.git.honghui.zhang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
2017-07-27 3:19 ` Honghui Zhang
2017-07-27 3:28 ` Honghui Zhang
2017-08-03 22:15 ` Bjorn Helgaas
2017-07-27 2:58 ` [PATCH v2 2/5] PCI: mediatek: switch to use platform_get_resource_byname() honghui.zhang
2017-07-27 2:58 ` [PATCH v2 3/5] dt-bindings: PCI: rename and cleanup MediaTek binding text honghui.zhang
2017-08-03 19:10 ` Rob Herring
2017-08-03 22:17 ` Bjorn Helgaas
2017-07-27 2:58 ` [PATCH v2 4/5] PCI: mediatek: Add new generation controller support honghui.zhang
2017-08-03 22:42 ` Bjorn Helgaas
[not found] ` <20170803224206.GN20308-1RhO1Y9PlrlHTL0Zs8A6p5iNqAH0jzoTYJqu5kTmcBRl57MIdRCFDg@public.gmane.org>
2017-08-04 8:39 ` Honghui Zhang
2017-08-04 13:18 ` Bjorn Helgaas
2017-08-05 4:52 ` Ryder Lee [this message]
2017-08-05 6:16 ` Ryder Lee
2017-08-07 3:40 ` Honghui Zhang
2017-08-08 20:16 ` Bjorn Helgaas
2017-08-08 20:19 ` Bjorn Helgaas
2017-08-09 6:49 ` Honghui Zhang
2017-08-09 16:43 ` Paul Burton
2017-07-27 2:58 ` [PATCH v2 5/5] dt-bindings: PCI: add support for new generation controller honghui.zhang
2017-07-27 3:31 ` Honghui Zhang
[not found] ` <06c9b3439431221794fc9f723fef52ff59be7ec6.1501122135.git.honghui.zhang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
2017-07-27 3:38 ` Honghui Zhang
2017-08-03 22:45 ` Bjorn Helgaas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1501908763.8298.11.camel@mtkswgap22 \
--to=ryder.lee@mediatek.com \
--cc=bhelgaas@google.com \
--cc=devicetree@vger.kernel.org \
--cc=eddie.huang@mediatek.com \
--cc=helgaas@kernel.org \
--cc=honghui.zhang@mediatek.com \
--cc=hongkun.cao@mediatek.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-pci@vger.kernel.org \
--cc=matthias.bgg@gmail.com \
--cc=robh+dt@kernel.org \
--cc=robh@kerenl.org \
--cc=sean.wang@mediatek.com \
--cc=xinping.qian@mediatek.com \
--cc=yingjoe.chen@mediatek.com \
--cc=yong.wu@mediatek.com \
--cc=youlin.pei@mediatek.com \
--cc=yt.shen@mediatek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).