pci: pci_mvebu: refactor validation of addresses for config access
authorMarek Behún <marek.behun@nic.cz>
Mon, 8 Feb 2021 22:01:40 +0000 (23:01 +0100)
committerStefan Roese <sr@denx.de>
Fri, 26 Feb 2021 09:22:29 +0000 (10:22 +0100)
commit10eb2cc3442aa9a91c98f2fdda2a5b48de9bbc88
treef81a7709dff1ed8fd638d0e7b5be0bec95255b53
parent26f7a76ef9139544ea053a7d806cddda330a57d9
pci: pci_mvebu: refactor validation of addresses for config access

Refactor validation of bdf parameter in mvebu_pcie_read/write_config
functions.

We can simplify the code by putting the validation into separate
function.

Also there are always only two devices visible on local bus:
* on slot configured by function mvebu_pcie_set_local_dev_nr()
  (by default this register is set to 0) there is a
  "Marvell Memory controller", which isn't useful in root complex
  mode,
* on all other slots the real PCIe card connected to the PCIe slot.

We can simplify the code even more by simply allowing access only to
the real PCIe card.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Cc: Stefan Roese <sr@denx.de>
Cc: Phil Sutter <phil@nwl.cc>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Baruch Siach <baruch@tkos.co.il>
Reviewed-by: Stefan Roese <sr@denx.de>
drivers/pci/pci_mvebu.c