PCI: dwc: endpoint: Add multiple PFs support for dbi2
authorYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Wed, 18 Oct 2023 08:56:21 +0000 (17:56 +0900)
committerKrzysztof Wilczyński <kwilczynski@kernel.org>
Fri, 20 Oct 2023 12:12:50 +0000 (12:12 +0000)
commit7873b49b41b92edb3395bff9a528eaf89da5e41c
treeeb1410cf212bcee7ba0697f7c3a57c3871c70607
parent1a9745476caea2374e0c6ab8285c192158e52d2d
PCI: dwc: endpoint: Add multiple PFs support for dbi2

The commit 24ede430fa49 ("PCI: designware-ep: Add multiple PFs support
for DWC") added .func_conf_select() to get the configuration space of
different PFs and assumed that the offsets between dbi and dbi2 would
be the same.

However, Renesas R-Car Gen4 PCIe controllers have different offsets of
function 1: dbi (+0x1000) and dbi2 (+0x800). To get the offset for dbi2,
add .get_dbi2_offset() and dw_pcie_ep_get_dbi2_offset().

Note:
 - .func_conf_select() should be renamed later.
 - dw_pcie_ep_get_dbi2_offset() will call .func_conf_select()
   if .get_dbi2_offset() doesn't exist for backward compatibility.
 - dw_pcie_writeX_{dbi/dbi2} APIs accepted the func_no argument,
   so that these offset calculations are contained in the API
   definitions itself as it should.

Link: https://lore.kernel.org/linux-pci/20231018085631.1121289-6-yoshihiro.shimoda.uh@renesas.com
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
drivers/pci/controller/dwc/pcie-designware-ep.c
drivers/pci/controller/dwc/pcie-designware.h