kernel: refresh patches
[openwrt/openwrt.git] / target / linux / ramips / patches-3.14 / 0032-PCI-MIPS-adds-mt7620a-pcie-driver.patch
index 5f0945d488daa39ed7c22b32912090328f1f7306..ca835dafb37be1934d486029cebc05c15bb38565 100644 (file)
@@ -6,28 +6,24 @@ Subject: [PATCH 32/57] PCI: MIPS: adds mt7620a pcie driver
 Signed-off-by: John Crispin <blogic@openwrt.org>
 ---
  arch/mips/pci/Makefile      |    1 +
- arch/mips/pci/pci-mt7620a.c |  363 +++++++++++++++++++++++++++++++++++++++++++
+ arch/mips/pci/pci-mt7620.c  |  363 +++++++++++++++++++++++++++++++++++++++++++
  arch/mips/ralink/Kconfig    |    1 +
  3 files changed, 365 insertions(+)
- create mode 100644 arch/mips/pci/pci-mt7620a.c
+ create mode 100644 arch/mips/pci/pci-mt7620.c
 
-Index: linux-3.14.18/arch/mips/pci/Makefile
-===================================================================
---- linux-3.14.18.orig/arch/mips/pci/Makefile  2014-11-07 11:21:04.465149498 +0100
-+++ linux-3.14.18/arch/mips/pci/Makefile       2014-11-07 11:21:04.477149928 +0100
-@@ -42,6 +42,7 @@
+--- a/arch/mips/pci/Makefile
++++ b/arch/mips/pci/Makefile
+@@ -42,6 +42,7 @@ obj-$(CONFIG_SNI_RM)         += fixup-sni.o ops
  obj-$(CONFIG_LANTIQ)          += fixup-lantiq.o
  obj-$(CONFIG_PCI_LANTIQ)      += pci-lantiq.o ops-lantiq.o
  obj-$(CONFIG_SOC_MT7621)      += pci-mt7621.o
-+obj-$(CONFIG_SOC_MT7620)      += pci-mt7620a.o
++obj-$(CONFIG_SOC_MT7620)      += pci-mt7620.o
  obj-$(CONFIG_SOC_RT2880)      += pci-rt2880.o
  obj-$(CONFIG_SOC_RT3883)      += pci-rt3883.o
  obj-$(CONFIG_TANBAC_TB0219)   += fixup-tb0219.o
-Index: linux-3.14.18/arch/mips/pci/pci-mt7620a.c
-===================================================================
---- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ linux-3.14.18/arch/mips/pci/pci-mt7620a.c  2014-11-07 11:26:15.884263666 +0100
-@@ -0,0 +1,412 @@
+--- /dev/null
++++ b/arch/mips/pci/pci-mt7620.c
+@@ -0,0 +1,396 @@
 +/*
 + *  Ralink MT7620A SoC PCI support
 + *
@@ -228,19 +224,8 @@ Index: linux-3.14.18/arch/mips/pci/pci-mt7620a.c
 +      .write  = pci_config_write,
 +};
 +
-+static struct resource mt7620_res_pci_mem1 = {
-+      .name   = "pci memory",
-+      .start  = RALINK_PCI_MM_MAP_BASE,
-+      .end    = (u32) ((RALINK_PCI_MM_MAP_BASE + (unsigned char *)0x0fffffff)),
-+      .flags  = IORESOURCE_MEM,
-+};
-+static struct resource mt7620_res_pci_io1 = {
-+      .name   = "pci io",
-+      .start  = RALINK_PCI_IO_MAP_BASE,
-+      .end    = (u32) ((RALINK_PCI_IO_MAP_BASE + (unsigned char *)0x0ffff)),
-+      .flags  = IORESOURCE_IO,
-+};
-+
++static struct resource mt7620_res_pci_mem1;
++static struct resource mt7620_res_pci_io1;
 +struct pci_controller mt7620_controller = {
 +      .pci_ops        = &mt7620_pci_ops,
 +      .mem_resource   = &mt7620_res_pci_mem1,
@@ -258,11 +243,12 @@ Index: linux-3.14.18/arch/mips/pci/pci-mt7620a.c
 +      /* PCIE: Elastic buffer control */
 +      pcie_phy(0x68, 0xB4);
 +
++      pcie_m32(0, BIT(1), RALINK_PCI_PCICFG_ADDR);
++
 +      reset_control_assert(rstpcie0);
 +
 +      rt_sysc_m32(RALINK_PCIE0_CLK_EN, 0, RALINK_CLKCFG1);
 +      rt_sysc_m32(BIT(19), BIT(31), PPLL_DRV);
-+      rt_sysc_m32(0x3 << 16, 0, RALINK_GPIOMODE);
 +
 +      reset_control_deassert(rstpcie0);
 +      rt_sysc_m32(0, RALINK_PCIE0_CLK_EN, RALINK_CLKCFG1);
@@ -277,13 +263,6 @@ Index: linux-3.14.18/arch/mips/pci/pci-mt7620a.c
 +      }
 +      rt_sysc_m32(BIT(18) | BIT(17), BIT(19) | BIT(31), PPLL_DRV);
 +
-+      mdelay(100);
-+      reset_control_assert(rstpcie0);
-+      rt_sysc_m32(0x30, 2 << 4, RALINK_SYSCFG1);
-+
-+      rt_sysc_m32(~0x7fffffff, 0x80000000, RALINK_PCIE_CLK_GEN);
-+      rt_sysc_m32(~0x80ffffff, 0xa << 24, RALINK_PCIE_CLK_GEN1);
-+
 +      return 0;
 +}
 +
@@ -332,7 +311,7 @@ Index: linux-3.14.18/arch/mips/pci/pci-mt7620a.c
 +      ioport_resource.end = ~0;
 +
 +      /* bring up the pci core */
-+      switch (mt762x_soc) {
++      switch (ralink_soc) {
 +      case MT762X_SOC_MT7620A:
 +              if (mt7620_pci_hw_init(pdev))
 +                      return -1;
@@ -357,7 +336,7 @@ Index: linux-3.14.18/arch/mips/pci/pci-mt7620a.c
 +      if ((pcie_r32(RALINK_PCI0_STATUS) & 0x1) == 0) {
 +              reset_control_assert(rstpcie0);
 +              rt_sysc_m32(RALINK_PCIE0_CLK_EN, 0, RALINK_CLKCFG1);
-+              if (mt762x_soc == MT762X_SOC_MT7620A)
++              if (ralink_soc == MT762X_SOC_MT7620A)
 +                      rt_sysc_m32(LC_CKDRVPD_, PDRV_SW_SET, PPLL_DRV);
 +              dev_err(&pdev->dev, "PCIE0 no card, disable it(RST&CLK)\n");
 +              return -1;
@@ -400,6 +379,7 @@ Index: linux-3.14.18/arch/mips/pci/pci-mt7620a.c
 +              dev_err(&dev->dev, "no irq found - bus=0x%x, slot = 0x%x\n", dev->bus->number, slot);
 +              return 0;
 +      }
++      dev_err(&dev->dev, "card - bus=0x%x, slot = 0x%x irq=%d\n", dev->bus->number, slot, irq);
 +
 +      pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, 0x14);  //configure cache line size 0x14
 +      pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0xFF);  //configure latency timer 0x10
@@ -440,11 +420,9 @@ Index: linux-3.14.18/arch/mips/pci/pci-mt7620a.c
 +}
 +
 +arch_initcall(mt7620_pci_init);
-Index: linux-3.14.18/arch/mips/ralink/Kconfig
-===================================================================
---- linux-3.14.18.orig/arch/mips/ralink/Kconfig        2014-11-07 11:21:04.465149498 +0100
-+++ linux-3.14.18/arch/mips/ralink/Kconfig     2014-11-07 11:21:04.477149928 +0100
-@@ -39,6 +39,7 @@
+--- a/arch/mips/ralink/Kconfig
++++ b/arch/mips/ralink/Kconfig
+@@ -39,6 +39,7 @@ choice
                bool "MT7620/8"
                select USB_ARCH_HAS_OHCI
                select USB_ARCH_HAS_EHCI
@@ -452,11 +430,9 @@ Index: linux-3.14.18/arch/mips/ralink/Kconfig
  
        config SOC_MT7621
                bool "MT7621"
-Index: linux-3.14.18/arch/mips/include/asm/mach-ralink/mt7620.h
-===================================================================
---- linux-3.14.18.orig/arch/mips/include/asm/mach-ralink/mt7620.h      2014-11-07 11:21:04.453149067 +0100
-+++ linux-3.14.18/arch/mips/include/asm/mach-ralink/mt7620.h   2014-11-07 11:21:04.477149928 +0100
-@@ -19,6 +19,7 @@
+--- a/arch/mips/include/asm/mach-ralink/mt7620.h
++++ b/arch/mips/include/asm/mach-ralink/mt7620.h
+@@ -19,6 +19,7 @@ enum mt762x_soc_type {
        MT762X_SOC_MT7620N,
        MT762X_SOC_MT7628AN,
  };