Prechádzať zdrojové kódy

qcacmn: use my_io_remap to map 13MB for pcie space

This remap is needed temporarily for emulation builds

Change-Id: I6662eeba32dc5847aac730928ed72db77ff1d42c
CRs-Fixed: 1089874
Houston Hoffman 8 rokov pred
rodič
commit
f7bc308404
1 zmenil súbory, kde vykonal 31 pridanie a 0 odobranie
  1. 31 0
      hif/src/pcie/if_pci.c

+ 31 - 0
hif/src/pcie/if_pci.c

@@ -111,6 +111,30 @@ void hif_pci_route_adrastea_interrupt(struct hif_pci_softc *sc)
 }
 #endif
 
+
+#ifdef QCA_WIFI_NAPIER_EMULATION
+void __iomem *napier_emu_ioremap(struct pci_dev *dev,
+		int bar, unsigned long maxlen)
+{
+	resource_size_t start = pci_resource_start(dev, bar);
+	resource_size_t len = 0xD00000;
+	unsigned long flags = pci_resource_flags(dev, bar);
+
+	if (!len || !start)
+		return NULL;
+
+	if ((flags & IORESOURCE_IO) || (flags & IORESOURCE_MEM)) {
+		if (flags & IORESOURCE_CACHEABLE && !(flags & IORESOURCE_IO))
+			return ioremap(start, len);
+		else
+			return ioremap_nocache(start, len);
+	}
+
+	return NULL;
+}
+#endif
+
+
 /**
  * pci_dispatch_ce_irq() - pci_dispatch_ce_irq
  * @scn: scn
@@ -2171,12 +2195,19 @@ int hif_enable_pci(struct hif_pci_softc *sc,
 	pci_set_master(pdev);
 
 	/* Arrange for access to Target SoC registers. */
+#ifdef QCA_WIFI_NAPIER_EMULATION
+	mem = napier_emu_ioremap(pdev, BAR_NUM, 0);
+#else
 	mem = pci_iomap(pdev, BAR_NUM, 0);
+#endif
 	if (!mem) {
 		HIF_ERROR("%s: PCI iomap error", __func__);
 		ret = -EIO;
 		goto err_iomap;
 	}
+
+	pr_err("*****BAR is %p\n", mem);
+
 	sc->mem = mem;
 	sc->pdev = pdev;
 	sc->dev = &pdev->dev;