[U-Boot] [PATCH 2/4 v3] pci: pci_mvebu: Add DM_PCI support and move CONFIG_PCI_MVEBU to defconfig

Stefan Roese sr at denx.de
Fri Feb 1 07:45:08 UTC 2019


Hi Bin,

On 31.01.19 15:41, Bin Meng wrote:
> On Fri, Jan 25, 2019 at 6:53 PM Stefan Roese <sr at denx.de> wrote:
>>
>> This patch adds DM_PCI support to the MVEBU PCIe driver. This is
>> necessary, since all PCI drivers have to be moved to DM (driver model)
>> until the v2019.07 release.
>>
>> To not break git bisect'ablility, this patch also moves CONFIG_PCI_MVEBU
>> from config headers to the defconfig files.
>>
>> Signed-off-by: Stefan Roese <sr at denx.de>
>> Cc: Dirk Eibach <dirk.eibach at gdsys.cc>
>> Cc: Mario Six <mario.six at gdsys.cc>
>> Cc: Chris Packham <chris.packham at alliedtelesis.co.nz>
>> Cc: Phil Sutter <phil at nwl.cc>
>> Cc: Marek BehĂșn <marek.behun at nic.cz>
>> Cc: VlaoMao <vlaomao at gmail.com>
>> ---
>> v3:
>> - Add x530 defconfig / config/foo.h changes
>> - Remove misleading function comment
>> - Use PCI_DEV instead of PCI_SLOT
>> - Introduce mvebu_pcie_ofdata_to_platdata() to remove most functions
>>    from the loop in mvebu_pcie_bind(). This also enables to usage of
>>    a udevice pointer for the newly introduced function pci_get_devfn()
>>
>>
>> v2:
>> - Completely configure the controller based on DT properties. Now
>>    port and lane are read from the DT nodes and also the tgt and
>>    attr values are generated using the DT similar to how this is
>>    done in the Linux driver version. All A38x / XP specific defines
>>    can now be removed from this driver because of this.
>> - Please note that now the board specific dts file needs to enable
>>    the used PCIe ports, as this is also done in Linux.
>>
>>   configs/clearfog_defconfig          |   1 +
>>   configs/controlcenterdc_defconfig   |   3 +
>>   configs/db-88f6820-amc_defconfig    |   1 +
>>   configs/db-88f6820-gp_defconfig     |   1 +
>>   configs/db-mv784mp-gp_defconfig     |   1 +
>>   configs/ds414_defconfig             |   1 +
>>   configs/theadorable_debug_defconfig |   2 +
>>   configs/turris_omnia_defconfig      |   3 +-
>>   configs/x530_defconfig              |   3 +-
>>   drivers/pci/Kconfig                 |   9 +
>>   drivers/pci/pci_mvebu.c             | 470 ++++++++++++++++------------
>>   include/configs/clearfog.h          |   1 -
>>   include/configs/controlcenterdc.h   |   3 -
>>   include/configs/db-88f6820-amc.h    |   1 -
>>   include/configs/db-88f6820-gp.h     |   1 -
>>   include/configs/db-mv784mp-gp.h     |   1 -
>>   include/configs/ds414.h             |   1 -
>>   include/configs/theadorable.h       |   7 -
>>   include/configs/turris_omnia.h      |   1 -
>>   include/configs/x530.h              |   1 -
>>   scripts/config_whitelist.txt        |   1 -
>>   21 files changed, 296 insertions(+), 217 deletions(-)
>>
> 
> [snip]
> 
>> +static int mvebu_get_tgt_attr(ofnode node, int devfn,
>> +                             unsigned long type,
>> +                             unsigned int *tgt,
>> +                             unsigned int *attr)
>> +{
>> +       const int na = 3, ns = 2;
>> +       const __be32 *range;
>> +       int rlen, nranges, rangesz, pna, i;
>> +
>> +       *tgt = -1;
>> +       *attr = -1;
>> +
>> +       range = ofnode_get_property(node, "ranges", &rlen);
>> +       if (!range)
>> +               return -EINVAL;
>> +
>> +       pna = 2; /* hardcoded for now because of lack of of_n_addr_cells() */
> 
> Why? U-Boot has of_n_addr_cells() API.

This function is only available with CONFIG_OF_LIVE:

obj-$(CONFIG_OF_LIVE) += of_access.o of_addr.o

I didn't want to risk breaking any of the existing MVEBU targets by
forcing OF_LIVE here. I could add a comment to remove the hardcoded
value there, once OF_LIVE is enabled for MVEBU per default.

Thanks,
Stefan


More information about the U-Boot mailing list