[PATCH 2/2] arm64: a37xx: pci: Assert PERST# signal when unloading driver

Stefan Roese
2020-08-20T08:00:52Z

On 20.08.20 09:52, Pali Roh?r wrote:
> On Thursday 20 August 2020 09:48:17 Stefan Roese wrote:
>> On 20.08.20 09:43, Pali Roh?r wrote:
>>> On Thursday 20 August 2020 07:05:58 Stefan Roese wrote:
>>>> On 19.08.20 15:57, Pali Roh?r wrote:
>>>>> This change ensures that PCIe card is put into reset state when U-Boot
>>>>> stops using it.
>>>>>
>>>>> DM_FLAG_OS_PREPARE ensures that U-Boot executes driver's remove callback
>>>>> prior booting Linux kernel.
>>>>>
>>>>> Linux kernel pci-aardvark driver needs to reset PCIe card via PERST# signal
>>>>> prior initializing it. If it does not issue reset then some PCIe cards
>>>>> (specially Compex WiFi cards) are not detected at all.
>>>>>
>>>>> Putting PCIe card into reset state prior booting Linux kernel would ensure
>>>>> that card would be properly reset at time when Linux kernel starts
>>>>> initializing pci-aardvark driver.
>>>>>
>>>>> Signed-off-by: Pali Roh?r <pali@kernel.org>
>>>>> ---
>>>>> drivers/pci/pci-aardvark.c | 27 +++++++++++++++++++++------
>>>>> 1 file changed, 21 insertions(+), 6 deletions(-)
>>>>>
>>>>> diff --git a/drivers/pci/pci-aardvark.c b/drivers/pci/pci-aardvark.c
>>>>> index 5b3f23c184..8996be5309 100644
>>>>> --- a/drivers/pci/pci-aardvark.c
>>>>> +++ b/drivers/pci/pci-aardvark.c
>>>>> @@ -148,6 +148,9 @@ struct pcie_advk {
>>>>> void *base;
>>>>> int first_busno;
>>>>> struct udevice *dev;
>>>>> +#if CONFIG_IS_ENABLED(DM_GPIO)
>>>>> + struct gpio_desc reset_gpio;
>>>>> +#endif
>>>>> };
>>>>
>>>> Adding more #ifdef's is not recommended. Can't you "depend" this driver
>>>> on DM_GPIO in Kconfig instead? Are there any used that don't support
>>>> DM_GPIO right now?
>>>
>>> I'm not sure if this dependency is what people want. CCing Simon.
>>>
>>> In past Simon created commit bcee8d6764f9215f16b393a35581000178633254
>>> where described that want to build SPL without GPIO uclass support.
>>
>> Is this PCI driver ever built into SPL?
>
> SPL is not used for Espressobin and Turris MOX. But I'm not sure for
> other boards. Maybe Simon could provide more information about it.

AFAIK (I did not work on Armada for quite some time), only 32bit
Armada uses SPL. All 64bit Aramda 37xx / 7xxx / 8xxx do not use
SPL.

> Basically I added GPIO handling in aardvark driver as it was used on
> other place.

I understand.

I suggest to "depend" this driver on DM_GPIO and include the GPIO code
without any #ifdef's. And please run a world-build (buildman, Travis...)
to see, if nothing breaks.

Thanks,
Stefan