Merge tag 'powerpc-5.9-3' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc...
[linux-2.6-microblaze.git] / drivers / of / address.c
index 590493e..da4f734 100644 (file)
@@ -128,15 +128,29 @@ static unsigned int of_bus_pci_get_flags(const __be32 *addr)
  * PCI bus specific translator
  */
 
+static bool of_node_is_pcie(struct device_node *np)
+{
+       bool is_pcie = of_node_name_eq(np, "pcie");
+
+       if (is_pcie)
+               pr_warn_once("%pOF: Missing device_type\n", np);
+
+       return is_pcie;
+}
+
 static int of_bus_pci_match(struct device_node *np)
 {
        /*
         * "pciex" is PCI Express
         * "vci" is for the /chaos bridge on 1st-gen PCI powermacs
         * "ht" is hypertransport
+        *
+        * If none of the device_type match, and that the node name is
+        * "pcie", accept the device as PCI (with a warning).
         */
        return of_node_is_type(np, "pci") || of_node_is_type(np, "pciex") ||
-               of_node_is_type(np, "vci") || of_node_is_type(np, "ht");
+               of_node_is_type(np, "vci") || of_node_is_type(np, "ht") ||
+               of_node_is_pcie(np);
 }
 
 static void of_bus_pci_count_cells(struct device_node *np,
@@ -985,6 +999,11 @@ int of_dma_get_range(struct device_node *np, u64 *dma_addr, u64 *paddr, u64 *siz
                        /* Don't error out as we'd break some existing DTs */
                        continue;
                }
+               if (range.cpu_addr == OF_BAD_ADDR) {
+                       pr_err("translation of DMA address(%llx) to CPU address failed node(%pOF)\n",
+                              range.bus_addr, node);
+                       continue;
+               }
                dma_offset = range.cpu_addr - range.bus_addr;
 
                /* Take lower and upper limits */