kernel: refresh patches on linux 3.18
[openwrt/openwrt.git] / target / linux / lantiq / patches-3.18 / 0001-MIPS-lantiq-add-pcie-driver.patch
index 2cc081419484f61f04c88ff8c608ae1cfba352f8..e47bfa4d4ef04ae9a13890ca2608a8654fd1d79d 100644 (file)
@@ -174,26 +174,34 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
 +     ifx_pcie_rc_class_early_fixup);
 --- a/arch/mips/pci/fixup-lantiq.c
 +++ b/arch/mips/pci/fixup-lantiq.c
-@@ -11,11 +11,12 @@
+@@ -8,12 +8,18 @@
+ #include <linux/of_irq.h>
+ #include <linux/of_pci.h>
++#include "ifxmips_pci_common.h"
  
  int (*ltq_pci_plat_arch_init)(struct pci_dev *dev) = NULL;
  int (*ltq_pci_plat_dev_init)(struct pci_dev *dev) = NULL;
-+int (*ltq_pci_map_irq)(const struct pci_dev *dev, u8 slot, u8 pin);
  
  int pcibios_plat_dev_init(struct pci_dev *dev)
  {
++#ifdef CONFIG_PCIE_LANTIQ
++      if (pci_find_capability(dev, PCI_CAP_ID_EXP))
++              ifx_pcie_bios_plat_dev_init(dev);
++#endif
++
        if (ltq_pci_plat_arch_init)
--              return ltq_pci_plat_arch_init(dev);
-+              ltq_pci_plat_arch_init(dev);
+               return ltq_pci_plat_arch_init(dev);
  
-       if (ltq_pci_plat_dev_init)
-               return ltq_pci_plat_dev_init(dev);
-@@ -25,5 +26,7 @@ int pcibios_plat_dev_init(struct pci_dev
+@@ -25,5 +31,10 @@ int pcibios_plat_dev_init(struct pci_dev
  
  int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
  {
-+      if (ltq_pci_map_irq)
-+              return ltq_pci_map_irq(dev, slot, pin);
++#ifdef CONFIG_PCIE_LANTIQ
++      if (pci_find_capability(dev, PCI_CAP_ID_EXP))
++              return ifx_pcie_bios_map_irq(dev, slot, pin);
++#endif
++
        return of_irq_parse_and_map_pci(dev, slot, pin);
  }
 --- /dev/null
@@ -249,7 +257,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
 +extern int ifx_pci_bios_plat_dev_init(struct pci_dev *dev);
 +#endif /* COFNIG_IFX_PCI */
 +
-+#ifdef CONFIG_IFX_PCIE
++#ifdef CONFIG_PCIE_LANTIQ
 +extern int ifx_pcie_bios_map_irq(IFX_PCI_CONST struct pci_dev *dev, u8 slot, u8 pin);
 +extern int ifx_pcie_bios_plat_dev_init(struct pci_dev *dev);
 +#endif
@@ -258,7 +266,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
 +
 --- /dev/null
 +++ b/arch/mips/pci/ifxmips_pcie.c
-@@ -0,0 +1,1099 @@
+@@ -0,0 +1,1092 @@
 +/*
 + *  This program is free software; you can redistribute it and/or modify it
 + *  under the terms of the GNU General Public License version 2 as published
@@ -1097,7 +1105,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
 +      int pcie_port = ctrl->port;
 +      u32 reg;
 +
-+      printk("PCIe RC error intr %d\n", irq);
++      pr_debug("PCIe RC error intr %d\n", irq);
 +      reg = IFX_REG_R32(PCIE_IRNCR(pcie_port));
 +      reg &= PCIE_RC_CORE_COMBINED_INT;
 +      IFX_REG_W32(reg, PCIE_IRNCR(pcie_port));
@@ -1306,19 +1314,12 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
 +      return 0;
 +}
 +
-+extern int (*ltq_pci_plat_arch_init)(struct pci_dev *dev);
-+extern int (*ltq_pci_map_irq)(const struct pci_dev *dev, u8 slot, u8 pin);
-+
 +static int __init ifx_pcie_bios_init(void)
 +{
 +    void __iomem *io_map_base;
 +    int pcie_port;
 +    int startup_port;
 +
-+
-+      ltq_pci_map_irq = ifx_pcie_bios_map_irq;
-+      ltq_pci_plat_arch_init = ifx_pcie_bios_plat_dev_init;
-+
 +    /* Enable AHB Master/ Slave */
 +    pcie_ahb_pmu_setup();
 +
@@ -4115,11 +4116,11 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
 +{
 +    u32 tbus_number = bus_number;
 +
-+#ifdef CONFIG_IFX_PCI
++#ifdef CONFIG_PCI_LANTIQ
 +    if (pcibios_host_nr() > 1) {
 +        tbus_number -= pcibios_1st_host_bus_nr();
 +    }
-+#endif /* CONFIG_IFX_PCI */
++#endif /* CONFIG_PCI_LANTIQ */
 +    return tbus_number;
 +}
 +
@@ -4141,14 +4142,14 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
 +    }
 +
 +    if (read) { /* Read hack */
-+    #ifdef CONFIG_IFX_PCI
++    #ifdef CONFIG_PCI_LANTIQ
 +        if (pcibios_host_nr() > 1) {
 +            tvalue = ifx_pcie_bus_enum_read_hack(where, tvalue);
 +        }
-+    #endif /* CONFIG_IFX_PCI */  
++    #endif /* CONFIG_PCI_LANTIQ */
 +    }
 +    else { /* Write hack */
-+    #ifdef CONFIG_IFX_PCI    
++    #ifdef CONFIG_PCI_LANTIQ
 +        if (pcibios_host_nr() > 1) {
 +            tvalue = ifx_pcie_bus_enum_write_hack(where, tvalue);
 +        }
@@ -5457,11 +5458,11 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
 +{
 +    u32 tbus_number = bus_number;
 +
-+#ifdef CONFIG_IFX_PCI
++#ifdef CONFIG_PCI_LANTIQ
 +    if (pcibios_host_nr() > 1) {
 +        tbus_number -= pcibios_1st_host_bus_nr();
 +    }
-+#endif /* CONFIG_IFX_PCI */
++#endif /* CONFIG_PCI_LANTIQ */
 +    return tbus_number;
 +}
 +
@@ -5483,14 +5484,14 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
 +    }
 +
 +    if (read) { /* Read hack */
-+    #ifdef CONFIG_IFX_PCI
++    #ifdef CONFIG_PCI_LANTIQ
 +        if (pcibios_host_nr() > 1) {
 +            tvalue = ifx_pcie_bus_enum_read_hack(where, tvalue);
 +        }
-+    #endif /* CONFIG_IFX_PCI */  
++    #endif /* CONFIG_PCI_LANTIQ */
 +    }
 +    else { /* Write hack */
-+    #ifdef CONFIG_IFX_PCI    
++    #ifdef CONFIG_PCI_LANTIQ
 +        if (pcibios_host_nr() > 1) {
 +            tvalue = ifx_pcie_bus_enum_write_hack(where, tvalue);
 +        }
@@ -5513,7 +5514,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
          (transaction layer end-to-end CRC checking).
 --- a/include/linux/pci.h
 +++ b/include/linux/pci.h
-@@ -1160,6 +1160,8 @@ void pci_walk_bus(struct pci_bus *top, i
+@@ -1156,6 +1156,8 @@ void pci_walk_bus(struct pci_bus *top, i
                  void *userdata);
  int pci_cfg_space_size(struct pci_dev *dev);
  unsigned char pci_bus_max_busnr(struct pci_bus *bus);