Skip to contentSkip to conversation

pci: Add pci_get_devfn() to extract devfn from the fdt_pci_addr

PATCH New Stefan Roese 3 participants 14 messages Jan 25, 2019 – Feb 11, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/4 pci: Add pci_get_devfn() to extract devfn from the fdt_pci_addr

This function will be used by the Marvell Armada XP/38x PCIe driver, which is moved to DM right now. So let's extract the functionality from pci_uclass_child_post_bind() to make it available.

---
v3:
- New patch, replaces "[PATCH] core: ofnode: Add ofnode_pci_get_devfn()"

 drivers/pci/pci-uclass.c | 28 +++++++++++++++++++---------
 include/pci.h            | 10 ++++++++++
 2 files changed, 29 insertions(+), 9 deletions(-)
drivers/pci/pci-uclass.c +19 -9
index 2cf55cb743..47f3cc9107 100644
@@ -1007,10 +1007,25 @@ static int pci_uclass_post_probe(struct udevice *bus)
 	return 0;
 }
 
+int pci_get_devfn(struct udevice *dev)
+{
+	struct fdt_pci_addr addr;
+	int ret;
+
+	/* Extract the devfn from fdt_pci_addr */
+	ret = ofnode_read_pci_addr(dev_ofnode(dev), FDT_PCI_SPACE_CONFIG,
+				   "reg", &addr);
+	if (ret) {
+		if (ret != -ENOENT)
+			return -EINVAL;
+	}
+
+	return addr.phys_hi & 0xff00;
+}
+
 static int pci_uclass_child_post_bind(struct udevice *dev)
 {
 	struct pci_child_platdata *pplat;
-	struct fdt_pci_addr addr;
 	int ret;
 
 	if (!dev_of_valid(dev))
@@ -1022,14 +1037,9 @@ static int pci_uclass_child_post_bind(struct udevice *dev)
 	ofnode_read_pci_vendev(dev_ofnode(dev), &pplat->vendor, &pplat->device);
 
 	/* Extract the devfn from fdt_pci_addr */
-	ret = ofnode_read_pci_addr(dev_ofnode(dev), FDT_PCI_SPACE_CONFIG, "reg",
-				   &addr);
-	if (ret) {
-		if (ret != -ENOENT)
-			return -EINVAL;
-	} else {
-		pplat->devfn = addr.phys_hi & 0xff00;
-	}
+	pplat->devfn = pci_get_devfn(dev);
+	if (ret < 0)
+		return ret;
 
 	return 0;
 }
include/pci.h +10 -0
index 785d7d28b7..041f8e3747 100644
@@ -1560,6 +1560,16 @@ struct dm_pci_emul_ops {
 int sandbox_pci_get_emul(struct udevice *bus, pci_dev_t find_devfn,
 			 struct udevice **containerp, struct udevice **emulp);
 
+/**
+ * pci_get_devfn() - Extract the devfn from fdt_pci_addr of the device
+ *
+ * Get devfn from fdt_pci_addr of the specifified device
+ *
+ * @dev:	PCI device
+ * @return devfn in bits 15...8 if found, -ENODEV if not found
+ */
+int pci_get_devfn(struct udevice *dev);
+
 #endif /* CONFIG_DM_PCI */
 
 /**
Signature · 1 line
2.20.1
#1 lore raw

PATCH v3 2/4 pci: pci_mvebu: Add DM_PCI support and move CONFIG_PCI_MVEBU to defconfig

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.

Cc Dirk Eibach <[email protected]>
Cc Mario Six <[email protected]>
Cc Chris Packham <[email protected]>
Cc Phil Sutter <[email protected]>
Cc Marek Behún <[email protected]>
Cc VlaoMao <[email protected]>

---
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(-)
configs/clearfog_defconfig +1 -0
index e1c5a1fa13..0f69ff606d 100644
@@ -56,6 +56,7 @@ CONFIG_PHY_GIGE=y
 CONFIG_MVNETA=y
 CONFIG_MII=y
 CONFIG_PCI=y
+CONFIG_PCI_MVEBU=y
 CONFIG_SCSI=y
 CONFIG_DEBUG_UART_SHIFT=2
 CONFIG_SYS_NS16550=y
configs/controlcenterdc_defconfig +3 -0
index 0c762ad77c..f22a3ab819 100644
@@ -58,6 +58,9 @@ CONFIG_PHY_MARVELL=y
 CONFIG_PHY_GIGE=y
 CONFIG_MVNETA=y
 CONFIG_MII=y
+CONFIG_PCI=y
+CONFIG_DM_PCI_COMPAT=y
+CONFIG_PCI_MVEBU=y
 CONFIG_SCSI=y
 CONFIG_DEBUG_UART_SHIFT=2
 CONFIG_SYS_NS16550=y
configs/db-88f6820-amc_defconfig +1 -0
index 9068a58406..03bf2bcafc 100644
@@ -60,6 +60,7 @@ CONFIG_PHY_GIGE=y
 CONFIG_MVNETA=y
 CONFIG_MII=y
 CONFIG_PCI=y
+CONFIG_PCI_MVEBU=y
 CONFIG_DEBUG_UART_SHIFT=2
 CONFIG_SYS_NS16550=y
 CONFIG_KIRKWOOD_SPI=y
configs/db-88f6820-gp_defconfig +1 -0
index 413010c4ef..b36b7c3b2c 100644
@@ -56,6 +56,7 @@ CONFIG_PHY_GIGE=y
 CONFIG_MVNETA=y
 CONFIG_MII=y
 CONFIG_PCI=y
+CONFIG_PCI_MVEBU=y
 CONFIG_SCSI=y
 CONFIG_DEBUG_UART_SHIFT=2
 CONFIG_SYS_NS16550=y
configs/db-mv784mp-gp_defconfig +1 -0
index 3f140986b6..b6c61c3a48 100644
@@ -55,6 +55,7 @@ CONFIG_PHY_GIGE=y
 CONFIG_MVNETA=y
 CONFIG_MII=y
 CONFIG_PCI=y
+CONFIG_PCI_MVEBU=y
 CONFIG_DEBUG_UART_SHIFT=2
 CONFIG_SYS_NS16550=y
 CONFIG_KIRKWOOD_SPI=y
configs/ds414_defconfig +1 -0
index 5325bd9968..32f37440c3 100644
@@ -52,6 +52,7 @@ CONFIG_PHY_GIGE=y
 CONFIG_MVNETA=y
 CONFIG_MII=y
 CONFIG_PCI=y
+CONFIG_PCI_MVEBU=y
 CONFIG_DEBUG_UART_SHIFT=2
 CONFIG_SYS_NS16550=y
 CONFIG_KIRKWOOD_SPI=y
configs/theadorable_debug_defconfig +2 -0
index 9e99618998..ac6dfd6844 100644
@@ -62,6 +62,8 @@ CONFIG_PHY_GIGE=y
 CONFIG_MVNETA=y
 CONFIG_MII=y
 CONFIG_PCI=y
+CONFIG_DM_PCI_COMPAT=y
+CONFIG_PCI_MVEBU=y
 CONFIG_DEBUG_UART_SHIFT=2
 CONFIG_SYS_NS16550=y
 CONFIG_KIRKWOOD_SPI=y
configs/turris_omnia_defconfig +2 -1
index 4a1e23c86c..5cafe2ee34 100644
@@ -37,7 +37,6 @@ CONFIG_DEFAULT_DEVICE_TREE="armada-385-turris-omnia"
 CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_SPL_OF_TRANSLATE=y
 CONFIG_SCSI_AHCI=y
-CONFIG_MISC=y
 CONFIG_ATSHA204A=y
 CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_MV=y
@@ -45,6 +44,8 @@ CONFIG_PHY_MARVELL=y
 CONFIG_PHY_GIGE=y
 CONFIG_MVNETA=y
 CONFIG_MII=y
+CONFIG_PCI=y
+CONFIG_PCI_MVEBU=y
 CONFIG_DEBUG_UART_SHIFT=2
 CONFIG_SYS_NS16550=y
 CONFIG_KIRKWOOD_SPI=y
configs/x530_defconfig +2 -1
index 22482f8d39..25b9e885d8 100644
@@ -46,7 +46,6 @@ CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_MVTWSI=y
 CONFIG_I2C_MUX=y
 CONFIG_I2C_MUX_PCA954x=y
-CONFIG_MISC=y
 # CONFIG_MMC is not set
 CONFIG_NAND=y
 CONFIG_NAND_PXA3XX=y
@@ -57,6 +56,8 @@ CONFIG_SPI_FLASH_STMICRO=y
 CONFIG_SPI_FLASH_SST=y
 CONFIG_MTD_UBI=y
 CONFIG_PCI=y
+CONFIG_DM_PCI_COMPAT=y
+CONFIG_PCI_MVEBU=y
 CONFIG_DM_RTC=y
 CONFIG_RTC_DS1307=y
 CONFIG_DEBUG_UART_SHIFT=2
drivers/pci/Kconfig +9 -0
index f59803dbd6..1521885bde 100644
@@ -112,4 +112,13 @@ config PCIE_INTEL_FPGA
 	  Say Y here if you want to enable PCIe controller support on Intel
 	  FPGA, example Stratix 10.
 
+config PCI_MVEBU
+	bool "Enable Armada XP/38x PCIe driver"
+	depends on ARCH_MVEBU
+	select DM_PCI
+	select MISC
+	help
+	  Say Y here if you want to enable PCIe controller support on
+	  Armada XP/38x SoCs.
+
 endif
drivers/pci/pci_mvebu.c +273 -197

566 lines not on this page · raw message

include/configs/clearfog.h +0 -1
index 77ab6caf52..f9510826d7 100644
@@ -55,7 +55,6 @@
 
 /* PCIe support */
 #ifndef CONFIG_SPL_BUILD
-#define CONFIG_PCI_MVEBU
 #define CONFIG_PCI_SCAN_SHOW
 #endif
 
include/configs/controlcenterdc.h +0 -3
index b38cab1164..06c93c3e66 100644
@@ -63,9 +63,6 @@
 
 /* PCIe support */
 #ifndef CONFIG_SPL_BUILD
-#define CONFIG_PCI
-#define CONFIG_PCI_MVEBU
-#define CONFIG_PCI_PNP
 #define CONFIG_PCI_SCAN_SHOW
 #endif
 
include/configs/db-88f6820-amc.h +0 -1
index e68246cc0f..626a406cff 100644
@@ -34,7 +34,6 @@
 
 /* PCIe support */
 #ifndef CONFIG_SPL_BUILD
-#define CONFIG_PCI_MVEBU
 #define CONFIG_PCI_SCAN_SHOW
 #endif
 
include/configs/db-88f6820-gp.h +0 -1
index 3900cbed2d..1f328e97c5 100644
@@ -59,7 +59,6 @@
 
 /* PCIe support */
 #ifndef CONFIG_SPL_BUILD
-#define CONFIG_PCI_MVEBU
 #define CONFIG_PCI_SCAN_SHOW
 #endif
 
include/configs/db-mv784mp-gp.h +0 -1
index 8ad007cc49..6cba326927 100644
@@ -46,7 +46,6 @@
 
 /* PCIe support */
 #ifndef CONFIG_SPL_BUILD
-#define CONFIG_PCI_MVEBU
 #define CONFIG_PCI_SCAN_SHOW
 #endif
 
include/configs/ds414.h +0 -1
index b9b708ad41..4ba050553a 100644
@@ -41,7 +41,6 @@
 
 /* PCIe support */
 #ifndef CONFIG_SPL_BUILD
-#define CONFIG_PCI_MVEBU
 #define CONFIG_PCI_SCAN_SHOW
 #endif
 
include/configs/theadorable.h +0 -7
index de31681f8c..6837d55507 100644
@@ -62,13 +62,6 @@
 #define CONFIG_SYS_SATA_MAX_DEVICE	1
 #define CONFIG_LBA48
 
-/* PCIe support */
-#ifdef CONFIG_CMD_PCI
-#ifndef CONFIG_SPL_BUILD
-#define CONFIG_PCI_MVEBU
-#endif
-#endif
-
 /* Enable LCD and reserve 512KB from top of memory*/
 #define CONFIG_SYS_MEM_TOP_HIDE		0x80000
 
include/configs/turris_omnia.h +0 -1
index 598674c96e..710b8991a4 100644
@@ -66,7 +66,6 @@
 
 /* PCIe support */
 #ifndef CONFIG_SPL_BUILD
-#define CONFIG_PCI_MVEBU
 #define CONFIG_PCI_SCAN_SHOW
 #endif
 
include/configs/x530.h +0 -1
index a1ef301d35..a83d49ba35 100644
@@ -75,7 +75,6 @@
 
 /* PCIe support */
 #ifndef CONFIG_SPL_BUILD
-#define CONFIG_PCI_MVEBU
 #define CONFIG_PCI_SCAN_SHOW
 #endif
 
scripts/config_whitelist.txt +0 -1
index e6ac098e27..8ed6005e08 100644
@@ -1446,7 +1446,6 @@ CONFIG_PCI_MEM_BUS
 CONFIG_PCI_MEM_PHYS
 CONFIG_PCI_MEM_SIZE
 CONFIG_PCI_MSC01
-CONFIG_PCI_MVEBU
 CONFIG_PCI_NOSCAN
 CONFIG_PCI_OHCI
 CONFIG_PCI_OHCI_DEVNO
Signature · 1 line
2.20.1
#2 lore raw

PATCH v3 2/4 pci: pci_mvebu: Add DM_PCI support and move CONFIG_PCI_MVEBU to defconfig

Hi Stefan,

Quoted 57 lines · Stefan Roese

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.

Cc Dirk Eibach <[email protected]>
Cc Mario Six <[email protected]>
Cc Chris Packham <[email protected]>
Cc Phil Sutter <[email protected]>
Cc Marek Behún <[email protected]>
Cc VlaoMao <[email protected]>

---
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]

Quoted 7 lines
drivers/pci/pci_mvebu.c +7 -0
+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;

drivers/pci/pci_mvebu.c static void mvebu_pcie_setup_wins(struct mvebu_pcie *pcie) · line 372

Quoted 10 lines
drivers/pci/pci_mvebu.c +10 -0
+       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.

Quoted 21 lines
drivers/pci/pci_mvebu.c +20 -0
+       rangesz = pna + na + ns;
+       nranges = rlen / sizeof(__be32) / rangesz;
+
+       for (i = 0; i < nranges; i++, range += rangesz) {
+               u32 flags = of_read_number(range, 1);
+               u32 slot = of_read_number(range + 1, 1);
+               u64 cpuaddr = of_read_number(range + na, pna);
+               unsigned long rtype;
+
+               if (DT_FLAGS_TO_TYPE(flags) == DT_TYPE_IO)
+                       rtype = IORESOURCE_IO;
+               else if (DT_FLAGS_TO_TYPE(flags) == DT_TYPE_MEM32)
+                       rtype = IORESOURCE_MEM;
+               else
                        continue;
+
+               /*
+                * The Linux code used PCI_SLOT() here, which expects devfn
+                * in bits 7..0. PCI_DEV() in U-Boot is similar to PCI_SLOT(),
+                * only expects devfn in 15..8, where its saved in this driver.
+                */

drivers/pci/pci_mvebu.c static void mvebu_pcie_setup_wins(struct mvebu_pcie *pcie) · line 403

Quoted 10 lines
drivers/pci/pci_mvebu.c +9 -0
+               if (slot == PCI_DEV(devfn) && type == rtype) {
+                       *tgt = DT_CPUADDR_TO_TARGET(cpuaddr);
+                       *attr = DT_CPUADDR_TO_ATTR(cpuaddr);
+                       return 0;
                }
+       }
+
+       return -ENOENT;
+}
+

[snip]

Regards,
Bin

#3 lore raw

PATCH v3 2/4 pci: pci_mvebu: Add DM_PCI support and move CONFIG_PCI_MVEBU to defconfig

Hi Bin,

Quoted 72 lines · Bin Meng
Quoted 57 lines · Stefan Roese

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.

Cc Dirk Eibach <[email protected]>
Cc Mario Six <[email protected]>
Cc Chris Packham <[email protected]>
Cc Phil Sutter <[email protected]>
Cc Marek Behún <[email protected]>
Cc VlaoMao <[email protected]>

---
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]

Quoted 11 lines
drivers/pci/pci_mvebu.c +11 -0
+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;
Quoted 8 lines

drivers/pci/pci_mvebu.c static void mvebu_pcie_setup_wins(struct mvebu_pcie *pcie) · line 372

Quoted 6 lines
drivers/pci/pci_mvebu.c +6 -0
+
+       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

#4 lore raw

PATCH v3 2/4 pci: pci_mvebu: Add DM_PCI support and move CONFIG_PCI_MVEBU to defconfig

In reply to Bin Meng

Hi Stefan,

Quoted 75 lines · Bin Meng

Hi Stefan,

Quoted 57 lines · Stefan Roese

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.

Cc Dirk Eibach <[email protected]>
Cc Mario Six <[email protected]>
Cc Chris Packham <[email protected]>
Cc Phil Sutter <[email protected]>
Cc Marek Behún <[email protected]>
Cc VlaoMao <[email protected]>

---
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]

Quoted 11 lines
drivers/pci/pci_mvebu.c +11 -0
+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;
Quoted 8 lines

drivers/pci/pci_mvebu.c static void mvebu_pcie_setup_wins(struct mvebu_pcie *pcie) · line 372

Quoted 6 lines
drivers/pci/pci_mvebu.c +6 -0
+
+       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.

Is this comment addressed?

Regards,
Bin

#5 lore raw

PATCH v3 2/4 pci: pci_mvebu: Add DM_PCI support and move CONFIG_PCI_MVEBU to defconfig

Hi Bin,

Quoted 87 lines · Bin Meng

Hi Stefan,

Quoted 75 lines · Bin Meng

Hi Stefan,

Quoted 57 lines · Stefan Roese

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.

Cc Dirk Eibach <[email protected]>
Cc Mario Six <[email protected]>
Cc Chris Packham <[email protected]>
Cc Phil Sutter <[email protected]>
Cc Marek Behún <[email protected]>
Cc VlaoMao <[email protected]>

---
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]

Quoted 11 lines
drivers/pci/pci_mvebu.c +11 -0
+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;
Quoted 8 lines

drivers/pci/pci_mvebu.c static void mvebu_pcie_setup_wins(struct mvebu_pcie *pcie) · line 372

Quoted 6 lines
drivers/pci/pci_mvebu.c +6 -0
+
+       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.

Quoted 1 line

Is this comment addressed?

I did send an answer ~ one week ago:

https://www.mail-archive.com/u-boot at lists.denx.de/msg314633.html

I'll send a patch to add the comment shortly.

Thanks,
Stefan

#6 lore raw

PATCH v3 2/4 pci: pci_mvebu: Add DM_PCI support and move CONFIG_PCI_MVEBU to defconfig

In reply to Stefan Roese
Quoted 7 lines · Stefan Roese

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.

Quoted 7 lines
Cc Dirk Eibach <[email protected]>
Cc Mario Six <[email protected]>
Cc Chris Packham <[email protected]>
Cc Phil Sutter <[email protected]>
Cc Marek Behún <[email protected]>
Cc VlaoMao <[email protected]>

Applied to u-boot-marvell/master

Thanks,
Stefan

#7 lore raw

PATCH v3 3/4 arm: mvebu: armada-xp/37x.dtsi: Sync PCIe DT nodes with Linux v4.20

In reply to Stefan Roese

This patch sync's the PCIe DT nodes with the recent Linux v4.20 version. This change makes it easier to reference specific PCIe nodes in the board dts files to e.g. enable a PCIe port as this is now necessary with the new DM PCI driver for these platforms.

Cc Dirk Eibach <[email protected]>
Cc Mario Six <[email protected]>
Cc Chris Packham <[email protected]>
Cc Phil Sutter <[email protected]>
Cc Marek Behún <[email protected]>
Cc VlaoMao <[email protected]>
Cc Tom Rini <[email protected]>

---
v3:
- No change

v2:
- New file

 arch/arm/dts/armada-375.dtsi        |  8 +++++---
 arch/arm/dts/armada-xp-mv78230.dtsi | 17 +++++++++------
 arch/arm/dts/armada-xp-mv78260.dtsi | 29 +++++++++++++++++---------
 arch/arm/dts/armada-xp-mv78460.dtsi | 32 +++++++++++++++++++----------
 4 files changed, 56 insertions(+), 30 deletions(-)
arch/arm/dts/armada-375.dtsi +5 -3
index 249c41c757..62a548a55f 100644
@@ -582,7 +582,7 @@
 			};
 		};
 
-		pcie-controller {
+		pciec: pcie at 82000000 {
 			compatible = "marvell,armada-370-pcie";
 			status = "disabled";
 			device_type = "pci";
@@ -601,7 +601,7 @@
 				0x82000000 0x2 0       MBUS_ID(0x04, 0xd8) 0 1 0 /* Port 1 MEM */
 				0x81000000 0x2 0       MBUS_ID(0x04, 0xd0) 0 1 0 /* Port 1 IO  */>;
 
-			pcie at 1,0 {
+			pcie0: pcie at 1,0 {
 				device_type = "pci";
 				assigned-addresses = <0x82000800 0 0x40000 0 0x2000>;
 				reg = <0x0800 0 0 0 0>;
@@ -610,6 +610,7 @@
 				#interrupt-cells = <1>;
 				ranges = <0x82000000 0 0 0x82000000 0x1 0 1 0
 					  0x81000000 0 0 0x81000000 0x1 0 1 0>;
+				bus-range = <0x00 0xff>;
 				interrupt-map-mask = <0 0 0 0>;
 				interrupt-map = <0 0 0 0 &gic GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>;
 				marvell,pcie-port = <0>;
@@ -618,7 +619,7 @@
 				status = "disabled";
 			};
 
-			pcie at 2,0 {
+			pcie1: pcie at 2,0 {
 				device_type = "pci";
 				assigned-addresses = <0x82000800 0 0x44000 0 0x2000>;
 				reg = <0x1000 0 0 0 0>;
@@ -627,6 +628,7 @@
 				#interrupt-cells = <1>;
 				ranges = <0x82000000 0 0 0x82000000 0x2 0 1 0
 					  0x81000000 0 0 0x81000000 0x2 0 1 0>;
+				bus-range = <0x00 0xff>;
 				interrupt-map-mask = <0 0 0 0>;
 				interrupt-map = <0 0 0 0 &gic GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>;
 				marvell,pcie-port = <0>;
arch/arm/dts/armada-xp-mv78230.dtsi +11 -6
index 6e6d0f04bf..f6bab9fb20 100644
@@ -86,7 +86,7 @@
 		 * configured as x4 or quad x1 lanes. One unit is
 		 * x1 only.
 		 */
-		pcie-controller {
+		pciec: pcie at 82000000 {
 			compatible = "marvell,armada-xp-pcie";
 			status = "disabled";
 			device_type = "pci";
@@ -114,7 +114,7 @@
 				0x82000000 0x5 0       MBUS_ID(0x08, 0xe8) 0 1 0 /* Port 1.0 MEM */
 				0x81000000 0x5 0       MBUS_ID(0x08, 0xe0) 0 1 0 /* Port 1.0 IO  */>;
 
-			pcie at 1,0 {
+			pcie1: pcie at 1,0 {
 				device_type = "pci";
 				assigned-addresses = <0x82000800 0 0x40000 0 0x2000>;
 				reg = <0x0800 0 0 0 0>;
@@ -123,6 +123,7 @@
 				#interrupt-cells = <1>;
 				ranges = <0x82000000 0 0 0x82000000 0x1 0 1 0
 					  0x81000000 0 0 0x81000000 0x1 0 1 0>;
+				bus-range = <0x00 0xff>;
 				interrupt-map-mask = <0 0 0 0>;
 				interrupt-map = <0 0 0 0 &mpic 58>;
 				marvell,pcie-port = <0>;
@@ -131,7 +132,7 @@
 				status = "disabled";
 			};
 
-			pcie at 2,0 {
+			pcie2: pcie at 2,0 {
 				device_type = "pci";
 				assigned-addresses = <0x82000800 0 0x44000 0 0x2000>;
 				reg = <0x1000 0 0 0 0>;
@@ -140,6 +141,7 @@
 				#interrupt-cells = <1>;
 				ranges = <0x82000000 0 0 0x82000000 0x2 0 1 0
 					  0x81000000 0 0 0x81000000 0x2 0 1 0>;
+				bus-range = <0x00 0xff>;
 				interrupt-map-mask = <0 0 0 0>;
 				interrupt-map = <0 0 0 0 &mpic 59>;
 				marvell,pcie-port = <0>;
@@ -148,7 +150,7 @@
 				status = "disabled";
 			};
 
-			pcie at 3,0 {
+			pcie3: pcie at 3,0 {
 				device_type = "pci";
 				assigned-addresses = <0x82000800 0 0x48000 0 0x2000>;
 				reg = <0x1800 0 0 0 0>;
@@ -157,6 +159,7 @@
 				#interrupt-cells = <1>;
 				ranges = <0x82000000 0 0 0x82000000 0x3 0 1 0
 					  0x81000000 0 0 0x81000000 0x3 0 1 0>;
+				bus-range = <0x00 0xff>;
 				interrupt-map-mask = <0 0 0 0>;
 				interrupt-map = <0 0 0 0 &mpic 60>;
 				marvell,pcie-port = <0>;
@@ -165,7 +168,7 @@
 				status = "disabled";
 			};
 
-			pcie at 4,0 {
+			pcie4: pcie at 4,0 {
 				device_type = "pci";
 				assigned-addresses = <0x82000800 0 0x4c000 0 0x2000>;
 				reg = <0x2000 0 0 0 0>;
@@ -174,6 +177,7 @@
 				#interrupt-cells = <1>;
 				ranges = <0x82000000 0 0 0x82000000 0x4 0 1 0
 					  0x81000000 0 0 0x81000000 0x4 0 1 0>;
+				bus-range = <0x00 0xff>;
 				interrupt-map-mask = <0 0 0 0>;
 				interrupt-map = <0 0 0 0 &mpic 61>;
 				marvell,pcie-port = <0>;
@@ -182,7 +186,7 @@
 				status = "disabled";
 			};
 
-			pcie at 5,0 {
+			pcie5: pcie at 5,0 {
 				device_type = "pci";
 				assigned-addresses = <0x82000800 0 0x80000 0 0x2000>;
 				reg = <0x2800 0 0 0 0>;
@@ -191,6 +195,7 @@
 				#interrupt-cells = <1>;
 				ranges = <0x82000000 0 0 0x82000000 0x5 0 1 0
 					  0x81000000 0 0 0x81000000 0x5 0 1 0>;
+				bus-range = <0x00 0xff>;
 				interrupt-map-mask = <0 0 0 0>;
 				interrupt-map = <0 0 0 0 &mpic 62>;
 				marvell,pcie-port = <1>;
arch/arm/dts/armada-xp-mv78260.dtsi +19 -10
index c5fdc99f0d..d39231f69d 100644
@@ -87,7 +87,7 @@
 		 * configured as x4 or quad x1 lanes. One unit is
 		 * x4 only.
 		 */
-		pcie-controller {
+		pciec: pcie at 82000000 {
 			compatible = "marvell,armada-xp-pcie";
 			status = "disabled";
 			device_type = "pci";
@@ -129,7 +129,7 @@
 				0x82000000 0x9 0     MBUS_ID(0x04, 0xf8) 0 1 0 /* Port 2.0 MEM */
 				0x81000000 0x9 0     MBUS_ID(0x04, 0xf0) 0 1 0 /* Port 2.0 IO  */>;
 
-			pcie at 1,0 {
+			pcie1: pcie at 1,0 {
 				device_type = "pci";
 				assigned-addresses = <0x82000800 0 0x40000 0 0x2000>;
 				reg = <0x0800 0 0 0 0>;
@@ -138,6 +138,7 @@
 				#interrupt-cells = <1>;
 				ranges = <0x82000000 0 0 0x82000000 0x1 0 1 0
 					  0x81000000 0 0 0x81000000 0x1 0 1 0>;
+				bus-range = <0x00 0xff>;
 				interrupt-map-mask = <0 0 0 0>;
 				interrupt-map = <0 0 0 0 &mpic 58>;
 				marvell,pcie-port = <0>;
@@ -146,7 +147,7 @@
 				status = "disabled";
 			};
 
-			pcie at 2,0 {
+			pcie2: pcie at 2,0 {
 				device_type = "pci";
 				assigned-addresses = <0x82000800 0 0x44000 0 0x2000>;
 				reg = <0x1000 0 0 0 0>;
@@ -155,6 +156,7 @@
 				#interrupt-cells = <1>;
 				ranges = <0x82000000 0 0 0x82000000 0x2 0 1 0
 					  0x81000000 0 0 0x81000000 0x2 0 1 0>;
+				bus-range = <0x00 0xff>;
 				interrupt-map-mask = <0 0 0 0>;
 				interrupt-map = <0 0 0 0 &mpic 59>;
 				marvell,pcie-port = <0>;
@@ -163,7 +165,7 @@
 				status = "disabled";
 			};
 
-			pcie at 3,0 {
+			pcie3: pcie at 3,0 {
 				device_type = "pci";
 				assigned-addresses = <0x82000800 0 0x48000 0 0x2000>;
 				reg = <0x1800 0 0 0 0>;
@@ -172,6 +174,7 @@
 				#interrupt-cells = <1>;
 				ranges = <0x82000000 0 0 0x82000000 0x3 0 1 0
 					  0x81000000 0 0 0x81000000 0x3 0 1 0>;
+				bus-range = <0x00 0xff>;
 				interrupt-map-mask = <0 0 0 0>;
 				interrupt-map = <0 0 0 0 &mpic 60>;
 				marvell,pcie-port = <0>;
@@ -180,7 +183,7 @@
 				status = "disabled";
 			};
 
-			pcie at 4,0 {
+			pcie4: pcie at 4,0 {
 				device_type = "pci";
 				assigned-addresses = <0x82000800 0 0x4c000 0 0x2000>;
 				reg = <0x2000 0 0 0 0>;
@@ -189,6 +192,7 @@
 				#interrupt-cells = <1>;
 				ranges = <0x82000000 0 0 0x82000000 0x4 0 1 0
 					  0x81000000 0 0 0x81000000 0x4 0 1 0>;
+				bus-range = <0x00 0xff>;
 				interrupt-map-mask = <0 0 0 0>;
 				interrupt-map = <0 0 0 0 &mpic 61>;
 				marvell,pcie-port = <0>;
@@ -197,7 +201,7 @@
 				status = "disabled";
 			};
 
-			pcie at 5,0 {
+			pcie5: pcie at 5,0 {
 				device_type = "pci";
 				assigned-addresses = <0x82000800 0 0x80000 0 0x2000>;
 				reg = <0x2800 0 0 0 0>;
@@ -206,6 +210,7 @@
 				#interrupt-cells = <1>;
 				ranges = <0x82000000 0 0 0x82000000 0x5 0 1 0
 					  0x81000000 0 0 0x81000000 0x5 0 1 0>;
+				bus-range = <0x00 0xff>;
 				interrupt-map-mask = <0 0 0 0>;
 				interrupt-map = <0 0 0 0 &mpic 62>;
 				marvell,pcie-port = <1>;
@@ -214,7 +219,7 @@
 				status = "disabled";
 			};
 
-			pcie at 6,0 {
+			pcie6: pcie at 6,0 {
 				device_type = "pci";
 				assigned-addresses = <0x82000800 0 0x84000 0 0x2000>;
 				reg = <0x3000 0 0 0 0>;
@@ -223,6 +228,7 @@
 				#interrupt-cells = <1>;
 				ranges = <0x82000000 0 0 0x82000000 0x6 0 1 0
 					  0x81000000 0 0 0x81000000 0x6 0 1 0>;
+				bus-range = <0x00 0xff>;
 				interrupt-map-mask = <0 0 0 0>;
 				interrupt-map = <0 0 0 0 &mpic 63>;
 				marvell,pcie-port = <1>;
@@ -231,7 +237,7 @@
 				status = "disabled";
 			};
 
-			pcie at 7,0 {
+			pcie7: pcie at 7,0 {
 				device_type = "pci";
 				assigned-addresses = <0x82000800 0 0x88000 0 0x2000>;
 				reg = <0x3800 0 0 0 0>;
@@ -240,6 +246,7 @@
 				#interrupt-cells = <1>;
 				ranges = <0x82000000 0 0 0x82000000 0x7 0 1 0
 					  0x81000000 0 0 0x81000000 0x7 0 1 0>;
+				bus-range = <0x00 0xff>;
 				interrupt-map-mask = <0 0 0 0>;
 				interrupt-map = <0 0 0 0 &mpic 64>;
 				marvell,pcie-port = <1>;
@@ -248,7 +255,7 @@
 				status = "disabled";
 			};
 
-			pcie at 8,0 {
+			pcie8: pcie at 8,0 {
 				device_type = "pci";
 				assigned-addresses = <0x82000800 0 0x8c000 0 0x2000>;
 				reg = <0x4000 0 0 0 0>;
@@ -257,6 +264,7 @@
 				#interrupt-cells = <1>;
 				ranges = <0x82000000 0 0 0x82000000 0x8 0 1 0
 					  0x81000000 0 0 0x81000000 0x8 0 1 0>;
+				bus-range = <0x00 0xff>;
 				interrupt-map-mask = <0 0 0 0>;
 				interrupt-map = <0 0 0 0 &mpic 65>;
 				marvell,pcie-port = <1>;
@@ -265,7 +273,7 @@
 				status = "disabled";
 			};
 
-			pcie at 9,0 {
+			pcie9: pcie at 9,0 {
 				device_type = "pci";
 				assigned-addresses = <0x82000800 0 0x42000 0 0x2000>;
 				reg = <0x4800 0 0 0 0>;
@@ -274,6 +282,7 @@
 				#interrupt-cells = <1>;
 				ranges = <0x82000000 0 0 0x82000000 0x9 0 1 0
 					  0x81000000 0 0 0x81000000 0x9 0 1 0>;
+				bus-range = <0x00 0xff>;
 				interrupt-map-mask = <0 0 0 0>;
 				interrupt-map = <0 0 0 0 &mpic 99>;
 				marvell,pcie-port = <2>;
arch/arm/dts/armada-xp-mv78460.dtsi +21 -11
index 0e24f1a385..c642565d1b 100644
@@ -104,7 +104,7 @@
 		 * configured as x4 or quad x1 lanes. Two units are
 		 * x4/x1.
 		 */
-		pcie-controller {
+		pciec: pcie at 82000000 {
 			compatible = "marvell,armada-xp-pcie";
 			status = "disabled";
 			device_type = "pci";
@@ -150,7 +150,7 @@
 				0x82000000 0xa 0     MBUS_ID(0x08, 0xf8) 0 1 0 /* Port 3.0 MEM */
 				0x81000000 0xa 0     MBUS_ID(0x08, 0xf0) 0 1 0 /* Port 3.0 IO  */>;
 
-			pcie at 1,0 {
+			pcie1: pcie at 1,0 {
 				device_type = "pci";
 				assigned-addresses = <0x82000800 0 0x40000 0 0x2000>;
 				reg = <0x0800 0 0 0 0>;
@@ -159,6 +159,7 @@
 				#interrupt-cells = <1>;
 				ranges = <0x82000000 0 0 0x82000000 0x1 0 1 0
 					  0x81000000 0 0 0x81000000 0x1 0 1 0>;
+				bus-range = <0x00 0xff>;
 				interrupt-map-mask = <0 0 0 0>;
 				interrupt-map = <0 0 0 0 &mpic 58>;
 				marvell,pcie-port = <0>;
@@ -167,7 +168,7 @@
 				status = "disabled";
 			};
 
-			pcie at 2,0 {
+			pcie2: pcie at 2,0 {
 				device_type = "pci";
 				assigned-addresses = <0x82001000 0 0x44000 0 0x2000>;
 				reg = <0x1000 0 0 0 0>;
@@ -176,6 +177,7 @@
 				#interrupt-cells = <1>;
 				ranges = <0x82000000 0 0 0x82000000 0x2 0 1 0
 					  0x81000000 0 0 0x81000000 0x2 0 1 0>;
+				bus-range = <0x00 0xff>;
 				interrupt-map-mask = <0 0 0 0>;
 				interrupt-map = <0 0 0 0 &mpic 59>;
 				marvell,pcie-port = <0>;
@@ -184,7 +186,7 @@
 				status = "disabled";
 			};
 
-			pcie at 3,0 {
+			pcie3: pcie at 3,0 {
 				device_type = "pci";
 				assigned-addresses = <0x82001800 0 0x48000 0 0x2000>;
 				reg = <0x1800 0 0 0 0>;
@@ -193,6 +195,7 @@
 				#interrupt-cells = <1>;
 				ranges = <0x82000000 0 0 0x82000000 0x3 0 1 0
 					  0x81000000 0 0 0x81000000 0x3 0 1 0>;
+				bus-range = <0x00 0xff>;
 				interrupt-map-mask = <0 0 0 0>;
 				interrupt-map = <0 0 0 0 &mpic 60>;
 				marvell,pcie-port = <0>;
@@ -201,7 +204,7 @@
 				status = "disabled";
 			};
 
-			pcie at 4,0 {
+			pcie4: pcie at 4,0 {
 				device_type = "pci";
 				assigned-addresses = <0x82002000 0 0x4c000 0 0x2000>;
 				reg = <0x2000 0 0 0 0>;
@@ -210,6 +213,7 @@
 				#interrupt-cells = <1>;
 				ranges = <0x82000000 0 0 0x82000000 0x4 0 1 0
 					  0x81000000 0 0 0x81000000 0x4 0 1 0>;
+				bus-range = <0x00 0xff>;
 				interrupt-map-mask = <0 0 0 0>;
 				interrupt-map = <0 0 0 0 &mpic 61>;
 				marvell,pcie-port = <0>;
@@ -218,7 +222,7 @@
 				status = "disabled";
 			};
 
-			pcie at 5,0 {
+			pcie5: pcie at 5,0 {
 				device_type = "pci";
 				assigned-addresses = <0x82002800 0 0x80000 0 0x2000>;
 				reg = <0x2800 0 0 0 0>;
@@ -227,6 +231,7 @@
 				#interrupt-cells = <1>;
 				ranges = <0x82000000 0 0 0x82000000 0x5 0 1 0
 					  0x81000000 0 0 0x81000000 0x5 0 1 0>;
+				bus-range = <0x00 0xff>;
 				interrupt-map-mask = <0 0 0 0>;
 				interrupt-map = <0 0 0 0 &mpic 62>;
 				marvell,pcie-port = <1>;
@@ -235,7 +240,7 @@
 				status = "disabled";
 			};
 
-			pcie at 6,0 {
+			pcie6: pcie at 6,0 {
 				device_type = "pci";
 				assigned-addresses = <0x82003000 0 0x84000 0 0x2000>;
 				reg = <0x3000 0 0 0 0>;
@@ -244,6 +249,7 @@
 				#interrupt-cells = <1>;
 				ranges = <0x82000000 0 0 0x82000000 0x6 0 1 0
 					  0x81000000 0 0 0x81000000 0x6 0 1 0>;
+				bus-range = <0x00 0xff>;
 				interrupt-map-mask = <0 0 0 0>;
 				interrupt-map = <0 0 0 0 &mpic 63>;
 				marvell,pcie-port = <1>;
@@ -252,7 +258,7 @@
 				status = "disabled";
 			};
 
-			pcie at 7,0 {
+			pcie7: pcie at 7,0 {
 				device_type = "pci";
 				assigned-addresses = <0x82003800 0 0x88000 0 0x2000>;
 				reg = <0x3800 0 0 0 0>;
@@ -261,6 +267,7 @@
 				#interrupt-cells = <1>;
 				ranges = <0x82000000 0 0 0x82000000 0x7 0 1 0
 					  0x81000000 0 0 0x81000000 0x7 0 1 0>;
+				bus-range = <0x00 0xff>;
 				interrupt-map-mask = <0 0 0 0>;
 				interrupt-map = <0 0 0 0 &mpic 64>;
 				marvell,pcie-port = <1>;
@@ -269,7 +276,7 @@
 				status = "disabled";
 			};
 
-			pcie at 8,0 {
+			pcie8: pcie at 8,0 {
 				device_type = "pci";
 				assigned-addresses = <0x82004000 0 0x8c000 0 0x2000>;
 				reg = <0x4000 0 0 0 0>;
@@ -278,6 +285,7 @@
 				#interrupt-cells = <1>;
 				ranges = <0x82000000 0 0 0x82000000 0x8 0 1 0
 					  0x81000000 0 0 0x81000000 0x8 0 1 0>;
+				bus-range = <0x00 0xff>;
 				interrupt-map-mask = <0 0 0 0>;
 				interrupt-map = <0 0 0 0 &mpic 65>;
 				marvell,pcie-port = <1>;
@@ -286,7 +294,7 @@
 				status = "disabled";
 			};
 
-			pcie at 9,0 {
+			pcie9: pcie at 9,0 {
 				device_type = "pci";
 				assigned-addresses = <0x82004800 0 0x42000 0 0x2000>;
 				reg = <0x4800 0 0 0 0>;
@@ -295,6 +303,7 @@
 				#interrupt-cells = <1>;
 				ranges = <0x82000000 0 0 0x82000000 0x9 0 1 0
 					  0x81000000 0 0 0x81000000 0x9 0 1 0>;
+				bus-range = <0x00 0xff>;
 				interrupt-map-mask = <0 0 0 0>;
 				interrupt-map = <0 0 0 0 &mpic 99>;
 				marvell,pcie-port = <2>;
@@ -303,7 +312,7 @@
 				status = "disabled";
 			};
 
-			pcie at 10,0 {
+			pcie10: pcie at a,0 {
 				device_type = "pci";
 				assigned-addresses = <0x82005000 0 0x82000 0 0x2000>;
 				reg = <0x5000 0 0 0 0>;
@@ -312,6 +321,7 @@
 				#interrupt-cells = <1>;
 				ranges = <0x82000000 0 0 0x82000000 0xa 0 1 0
 					  0x81000000 0 0 0x81000000 0xa 0 1 0>;
+				bus-range = <0x00 0xff>;
 				interrupt-map-mask = <0 0 0 0>;
 				interrupt-map = <0 0 0 0 &mpic 103>;
 				marvell,pcie-port = <3>;
Signature · 1 line
2.20.1
#8 lore raw

PATCH v3 3/4 arm: mvebu: armada-xp/37x.dtsi: Sync PCIe DT nodes with Linux v4.20

Quoted 5 lines · Stefan Roese

This patch sync's the PCIe DT nodes with the recent Linux v4.20 version. This change makes it easier to reference specific PCIe nodes in the board dts files to e.g. enable a PCIe port as this is now necessary with the new DM PCI driver for these platforms.

Quoted 8 lines
Cc Dirk Eibach <[email protected]>
Cc Mario Six <[email protected]>
Cc Chris Packham <[email protected]>
Cc Phil Sutter <[email protected]>
Cc Marek Behún <[email protected]>
Cc VlaoMao <[email protected]>
Cc Tom Rini <[email protected]>

Applied to u-boot-marvell/master

Thanks,
Stefan

#9 lore raw

PATCH v3 4/4 arm: mvebu: armada-xp-theadorable.dts: Enable PCIe DT nodes

In reply to Stefan Roese

Now that the PCIe driver supports DM and DT parsing, enable the PCIe DT nodes that are used by this board.

Cc Dirk Eibach <[email protected]>
Cc Mario Six <[email protected]>
Cc Chris Packham <[email protected]>
Cc Phil Sutter <[email protected]>
Cc Marek Behún <[email protected]>
Cc VlaoMao <[email protected]>

---
v3:
- No change

v2:
- New file

 arch/arm/dts/armada-xp-theadorable.dts | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
arch/arm/dts/armada-xp-theadorable.dts +14 -0
index 965c38426c..9b66ec678d 100644
@@ -162,3 +162,17 @@
 		};
 	};
 };
+
+&pciec {
+	status = "okay";
+
+	pcie at 1,0 {
+		/* Port 0, Lane 0 */
+		status = "okay";
+	};
+
+	pcie at 9,0 {
+		/* Port 2, Lane 0 */
+		status = "okay";
+	};
+};
Signature · 1 line
2.20.1
#10 lore raw

PATCH v3 4/4 arm: mvebu: armada-xp-theadorable.dts: Enable PCIe DT nodes

Quoted 10 lines · Stefan Roese

Now that the PCIe driver supports DM and DT parsing, enable the PCIe DT nodes that are used by this board.

Cc Dirk Eibach <[email protected]>
Cc Mario Six <[email protected]>
Cc Chris Packham <[email protected]>
Cc Phil Sutter <[email protected]>
Cc Marek Behún <[email protected]>
Cc VlaoMao <[email protected]>

Applied to u-boot-marvell/master

Thanks,
Stefan

#11 lore raw

PATCH v3 1/4 pci: Add pci_get_devfn() to extract devfn from the fdt_pci_addr

In reply to Stefan Roese
Quoted 8 lines · Stefan Roese

This function will be used by the Marvell Armada XP/38x PCIe driver, which is moved to DM right now. So let's extract the functionality from pci_uclass_child_post_bind() to make it available.

Quoted 7 lines

---
v3:
- New patch, replaces "[PATCH] core: ofnode: Add ofnode_pci_get_devfn()"

 drivers/pci/pci-uclass.c | 28 +++++++++++++++++++---------
 include/pci.h            | 10 ++++++++++
 2 files changed, 29 insertions(+), 9 deletions(-)
#12 lore raw

PATCH v3 1/4 pci: Add pci_get_devfn() to extract devfn from the fdt_pci_addr

Quoted 13 lines · Simon Glass
Quoted 12 lines · Stefan Roese

This function will be used by the Marvell Armada XP/38x PCIe driver, which is moved to DM right now. So let's extract the functionality from pci_uclass_child_post_bind() to make it available.

---
v3:
- New patch, replaces "[PATCH] core: ofnode: Add ofnode_pci_get_devfn()"

Quoted 5 lines
Quoted 3 lines
  drivers/pci/pci-uclass.c | 28 +++++++++++++++++++---------
  include/pci.h            | 10 ++++++++++
  2 files changed, 29 insertions(+), 9 deletions(-)

Applied to u-boot-marvell/master

Thanks,
Stefan

#13 lore raw

PATCH v3 1/4 pci: Add pci_get_devfn() to extract devfn from the fdt_pci_addr

In reply to Stefan Roese
Quoted 8 lines · Stefan Roese

This function will be used by the Marvell Armada XP/38x PCIe driver, which is moved to DM right now. So let's extract the functionality from pci_uclass_child_post_bind() to make it available.

Quoted 8 lines

---
v3:
- New patch, replaces "[PATCH] core: ofnode: Add ofnode_pci_get_devfn()"

 drivers/pci/pci-uclass.c | 28 +++++++++++++++++++---------
 include/pci.h            | 10 ++++++++++
 2 files changed, 29 insertions(+), 9 deletions(-)