From: Mauri Sandberg <maukka@ext.kapsi.fi>
To: "Pali Rohár" <pali@kernel.org>, "Arnd Bergmann" <arnd@arndb.de>
Cc: maukka@ext.kapsi.fi, SoC Team <soc@kernel.org>,
Linux ARM <linux-arm-kernel@lists.infradead.org>,
DTML <devicetree@vger.kernel.org>,
Olof Johansson <olof@lixom.net>, Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Andrew Lunn <andrew@lunn.ch>,
Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Subject: Re: [RFC RFT PATCH v1 0/1] ARM: orion5x: convert D-Link DNS-323 to the Device Tree
Date: Mon, 9 May 2022 13:48:53 +0300 [thread overview]
Message-ID: <87b47ff7-d92e-8d0c-5c8f-53a74f881e35@ext.kapsi.fi> (raw)
In-Reply-To: <20220508154126.3wubyyunpuxetswm@pali>
On 8.5.2022 18.41, Pali Rohár wrote:
> On Sunday 08 May 2022 17:22:37 Pali Rohár wrote:
>> On Sunday 08 May 2022 17:02:17 Arnd Bergmann wrote:
>>> On Sun, May 8, 2022 at 4:06 PM Mauri Sandberg <maukka@ext.kapsi.fi> wrote:
>>>> On 28.4.2022 23.56, Arnd Bergmann wrote:
>>>>> On Thu, Apr 28, 2022 at 10:01 PM Mauri Sandberg <maukka@ext.kapsi.fi> wrote:
>>>>>> On 27.4.2022 21.10, Arnd Bergmann wrote:
>>>>>>> On Wed, Apr 27, 2022 at 6:21 PM Mauri Sandberg <maukka@ext.kapsi.fi> wrote:
>>>>>>>> - sata_mv fails to initialise with -22 (-EINVAL)
>>>>>>>
>>>>>>> No idea, I'd try inserting a printk in every code path that can return -EINVAL
>>>>>>> from there
>>>>>>>
>>>>
>>>> With debugging the reason for -EINVAL remains a bit mystery.
>>>> - sata_mv calls ata_host_activate() [1]
>>>> - later on, in request_threaded_irq(), there are sanity checks [2]
>>>> - that fail with irq_settings_can_request() returning 0 [3]
>>>>
>>>> I cannot really put my finger on why the irq cannot be requested in DT
>>>> approach.
>>>
>>> Are you sure the marvell,orion-intc driver is successfully probed
>>> at this point? If not, the interrupt won't be there.
>>>
>>> I see that the "sata_mv" driver can be used either as a platform
>>> driver for the orion5x on-chip controller, or as a PCI driver for
>>> an add-on chip connected to the external bus. It sounds like
>>> your system has both. Do you know which one fails?
>>>
>>> The PCI driver cannot work unless the PCI host works correctly,
>>> and that in turn requires a correct devicetree description for it.
>>>
>>>>>> Is there a way to describe the PCIe bus in the
>>>>>> device tree? The initalisation of that bus is done for rev A1 only.
>>>>>
>>>>> I'm not too familiar with the platform, but my interpretation is that the
>>>>> DT support here is incomplete:
>>>>>
>>>>> The DT based PCI probe using drivers/pci/controller/pci-mvebu.c
>>>>> is not hooked up in orion5x.dtsi, and the traditional pci code does
>>>>> not work with DT.
>>>>
>>>> Can the existing pci code still be used to init the PCI bus and describe
>>>> the rest in the DT or is it a futile attempt?
>>
>> Hello! Orion uses arch/arm/mach-orion5x/pci.c driver for both PCI and
>> PCIe buses. This is not device tree driver.
>
> Correction, Orion PCIe driver is arch/arm/plat-orion/pcie.c and it calls
> common functions from mach-orion5x/pci.c driver.
>
>>>>> I see that orion5x has two separate blocks -- a PCIe host that is
>>>>> similar to the kirkwood one, and a legacy PCI host that needs
>>>>> a completely separate driver.
>>>>>
>>>>> Which of the two do you actually need here?
>>>>>
>>>>
>>>> I really cannot say which one is it. How can I tell? The functions given
>>>> in struct hw_pci find their way to drivers/pci/probe.c eventually and
>>>> use pci_scan_root_bus_bridge(). Nothing seems to utilising mvebu or
>>>> kirkwood explicitly at least.
>>>>
>>>> Here's the output from lspci if the ids reveal anything.
>>>>
>>>> # lspci -v -k
>>>> 00:00.0 Class 0580: 11ab:5181
>>>> 01:00.0 Class 0580: 11ab:5181
>>>> 00:01.0 Class 0100: 11ab:7042 sata_mv
>>>
>>> The first two seem to be the host bridges, but unfortunately they
>>> seem both have the same device ID, despite being very different
>>> devices. The first one (00:00.0) should be the PCIe driver, the
>>> second one (01.00.0) the legacy PCI one. In this case, the 11ab:7042
>>> device is a PCIe device, and it's on the bus (00) of the first host
>>> bridge. I think this should work with drivers/pci/controller/pci-mvebu.c
>>> if you add the bits for probing.
>>
>> Last time when I looked on Orion PCIe controller registers, I though
>> that they are same as in Kirkwood PCIe controller registers. And
>> Kirkwood is already supported by pci-mvebu.c driver.
>>
>> About PCI host bridge, I do not know.
>>
>> Beware that PCI Class Id and all PCI registers which are different for
>> Type 0 and Type 1 are _broken_ on all PCIe Root Ports form all 32-bit
>> Marvell SoCs. Those registers on Marvell SoCs have different meaning as
>> what is defined in PCI and PCIe specs. So it means that lspci _may_
>> display bogus information about PCIe Root Port. pci-mvebu.c uses Root
>> Port emulator which fills correct data to make kernel and lspci happy.
>>
>> If you are going to extend pci-mvebu.c to support also Orion PCIe
>> controller, I could try to help with it. But I do not have any Orion
>> hardware, so just basic help...
>>
>> Links to Orion documentations, including PCIe errata is available in
>> kernel documentation. So this could help to understand some details:
>> https://www.kernel.org/doc/html/latest/arm/marvell.html
>>
>> Anyway, could you please provide 'lspci -nn -vv' and 'lspci -nn -t -v'
>> outputs from Orion?
>>
>>> Thomas Petazzoni originally wrote the new driver, and I think he was
>>> planning at one point to use it for orion5x. I don't know if there were
>>> any major problems preventing this at the time, or if it just needs to
>>> get hooked up in the dtsi file.
>>>
>>> Arnd
>
> There is Orion-specific errata that config space via CF8/CFC registers
> is broken. Workaround documented in errata documented (linked from above
> documentation) does not work when DMA is used and instead other
> undocumented workaround is needed (implemented in arch/arm) which maps
> config space to memory (and therefore avoids usage of broken CF8/CFC
> memory mapped registers).
So basically I should look at arch/arm/plat-orion/pcie.c for the
configuration part, add new compatible to pci-mvebu.c for orion5x
and alter the probing function accoringly for the same. Did I get
it correctly?
If so, sounds simple when said out lout but I might need some more
pointers to get started. Like with configuration people generally
mean setting BARs and WINs? Or is there more to it? :) If you
could lay out the basic steps that are needed I would really
appreciate it.
next prev parent reply other threads:[~2022-05-09 10:50 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-27 16:21 [RFC RFT PATCH v1 0/1] ARM: orion5x: convert D-Link DNS-323 to the Device Tree Mauri Sandberg
2022-04-27 16:21 ` [RFC RFT PATCH v1 1/1] " Mauri Sandberg
2022-04-27 18:12 ` Arnd Bergmann
2022-04-28 20:06 ` Mauri Sandberg
2022-04-28 20:47 ` Arnd Bergmann
2022-04-28 7:13 ` Krzysztof Kozlowski
2022-04-28 20:09 ` Mauri Sandberg
2022-04-27 18:10 ` [RFC RFT PATCH v1 0/1] " Arnd Bergmann
2022-04-28 0:18 ` Andrew Lunn
2022-04-28 20:25 ` Mauri Sandberg
2022-04-28 23:26 ` Andrew Lunn
2022-05-03 8:20 ` Mauri Sandberg
2022-04-28 20:01 ` Mauri Sandberg
2022-04-28 20:56 ` Arnd Bergmann
2022-05-08 14:06 ` Mauri Sandberg
2022-05-08 15:02 ` Arnd Bergmann
[not found] ` <20220508152237.3hw657gcba2fvheq@pali>
2022-05-08 19:34 ` Mauri Sandberg
[not found] ` <20220508201044.qyh75mb4x64uuhfc@pali>
2022-05-09 10:52 ` Mauri Sandberg
[not found] ` <20220508154126.3wubyyunpuxetswm@pali>
2022-05-09 7:21 ` Arnd Bergmann
2022-05-09 10:48 ` Mauri Sandberg [this message]
2022-04-28 0:29 ` Andrew Lunn
2022-09-22 20:24 ` [PATCH v2 0/3] ARM: orion5x: add D-Link DNS323 based on device treee Mauri Sandberg
2022-09-22 20:24 ` [PATCH v2 1/3] dt-bindings: arm: add DT binding for D-Link DNS-323 Mauri Sandberg
2022-09-22 20:36 ` Andrew Lunn
2022-09-23 9:18 ` Krzysztof Kozlowski
2022-09-22 20:24 ` [PATCH v2 2/3] ARM: dts: orion5x: Add D-Link DNS-323 Device Tree Mauri Sandberg
2022-09-22 20:45 ` Andrew Lunn
2022-09-22 21:14 ` Pali Rohár
2022-09-22 21:32 ` Andrew Lunn
2022-09-23 9:19 ` Krzysztof Kozlowski
2022-09-27 11:26 ` kernel test robot
2022-09-27 22:56 ` kernel test robot
2022-09-22 20:24 ` [PATCH v2 3/3] ARM: orion5x: Add D-Link DNS-323 based on " Mauri Sandberg
2022-09-22 21:10 ` Andrew Lunn
2022-09-23 9:03 ` maukka
2022-09-23 12:12 ` Andrew Lunn
2022-09-23 18:02 ` Pali Rohár
2022-09-26 11:56 ` maukka
2022-09-26 12:23 ` Pali Rohár
2022-09-28 13:32 ` [EXT] " Elad Nachman
2022-09-30 15:40 ` Pali Rohár
2022-09-22 21:39 ` Arnd Bergmann
2022-09-23 9:13 ` maukka
2022-09-23 9:24 ` Arnd Bergmann
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=87b47ff7-d92e-8d0c-5c8f-53a74f881e35@ext.kapsi.fi \
--to=maukka@ext.kapsi.fi \
--cc=andrew@lunn.ch \
--cc=arnd@arndb.de \
--cc=devicetree@vger.kernel.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=olof@lixom.net \
--cc=pali@kernel.org \
--cc=robh+dt@kernel.org \
--cc=sebastian.hesselbarth@gmail.com \
--cc=soc@kernel.org \
--cc=thomas.petazzoni@bootlin.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).