ar71xx: adding support for zyxel nbg460n/550n/550nh boards
[openwrt.git] / target / linux / ar71xx / files / arch / mips / pci / pci-ar724x.c
index fd52216..b639806 100644 (file)
@@ -110,8 +110,12 @@ static int ar724x_pci_read_config(struct pci_bus *bus, unsigned int devfn,
         * WAR for BAR issue - We are unable to access the PCI device space
         * if we set the BAR with proper base address
         */
-       if ((where == 0x10) && (size == 4))
-               ar724x_pci_write(ar724x_pci_devcfg_base, where, size, 0xffff);
+       if ((where == 0x10) && (size == 4)) {
+               if (ar71xx_soc == AR71XX_SOC_AR7240)
+                       ar724x_pci_write(ar724x_pci_devcfg_base, where, size, 0xffff);
+               else
+                       ar724x_pci_write(ar724x_pci_devcfg_base, where, size, 0x1000ffff);
+       }
 
        return PCIBIOS_SUCCESSFUL;
 }
@@ -237,17 +241,27 @@ static int __init ar724x_pci_setup(void)
                udelay(100000);
        }
 
-       __raw_writel(AR724X_PCI_APP_LTSSM_ENABLE, base + AR724X_PCI_REG_APP);
+       if (ar71xx_soc == AR71XX_SOC_AR7240)
+               t = AR724X_PCI_APP_LTSSM_ENABLE;
+       else
+               t = 0x1ffc1;
+       __raw_writel(t, base + AR724X_PCI_REG_APP);
        /* flush write */
        (void) __raw_readl(base + AR724X_PCI_REG_APP);
        udelay(1000);
 
-       t = __raw_readl(base + AR724X_PCI_REG_APP);
-       if ((t & AR724X_PCI_APP_LTSSM_ENABLE) == 0x0) {
+       t = __raw_readl(base + AR724X_PCI_REG_RESET);
+       if ((t & AR724X_PCI_RESET_LINK_UP) == 0x0) {
                printk(KERN_WARNING "PCI: no PCIe module found\n");
                return -ENODEV;
        }
 
+       if (ar71xx_soc == AR71XX_SOC_AR7241 || ar71xx_soc == AR71XX_SOC_AR7242) {
+               t = __raw_readl(base + AR724X_PCI_REG_APP);
+               t |= BIT(16);
+               __raw_writel(t, base + AR724X_PCI_REG_APP);
+       }
+
        return 0;
 }
 
This page took 0.022986 seconds and 4 git commands to generate.