imx6: add initial 3.13 support
[openwrt.git] / target / linux / imx6 / patches-3.13 / 0004-imx-add-PCI-fixup-for-PEX860X-on-Gateworks-board.patch
1 From 4bb1d09fe48f51efac2f51b9280796e2d00a6c4a Mon Sep 17 00:00:00 2001
2 From: Tim Harvey <tharvey@gateworks.com>
3 Date: Tue, 22 Oct 2013 21:51:28 -0700
4 Subject: [PATCH] ARM: imx: add PCI fixup for PEX860X on Gateworks board
5
6 The PEX860X has GPIO's which are used for PCI Reset lines on the
7 Gateworks Ventana boards.  The GPIO's need to be set as output
8 level high so as to allow the PCIe devices to come out of reset.
9
10 Signed-off-by: Tim Harvey <tharvey@gateworks.com>
11 Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
12 ---
13  arch/arm/mach-imx/mach-imx6q.c | 30 ++++++++++++++++++++++++++++++
14  1 file changed, 30 insertions(+)
15
16 --- a/arch/arm/mach-imx/mach-imx6q.c
17 +++ b/arch/arm/mach-imx/mach-imx6q.c
18 @@ -13,6 +13,7 @@
19  #include <linux/clk.h>
20  #include <linux/clkdev.h>
21  #include <linux/cpu.h>
22 +#include <linux/delay.h>
23  #include <linux/export.h>
24  #include <linux/init.h>
25  #include <linux/io.h>
26 @@ -23,6 +24,7 @@
27  #include <linux/of_irq.h>
28  #include <linux/of_platform.h>
29  #include <linux/pm_opp.h>
30 +#include <linux/pci.h>
31  #include <linux/phy.h>
32  #include <linux/reboot.h>
33  #include <linux/regmap.h>
34 @@ -78,6 +80,34 @@ static int ksz9031rn_phy_fixup(struct ph
35         return 0;
36  }
37  
38 +/*
39 + * fixup for PLX PEX8909 bridge to configure GPIO1-7 as output High
40 + * as they are used for slots1-7 PERST#
41 + */
42 +static void ventana_pciesw_early_fixup(struct pci_dev *dev)
43 +{
44 +       u32 dw;
45 +
46 +       if (!of_machine_is_compatible("gw,ventana"))
47 +               return;
48 +
49 +       if (dev->devfn != 0)
50 +               return;
51 +
52 +       pci_read_config_dword(dev, 0x62c, &dw);
53 +       dw |= 0xaaa8; // GPIO1-7 outputs
54 +       pci_write_config_dword(dev, 0x62c, dw);
55 +
56 +       pci_read_config_dword(dev, 0x644, &dw);
57 +       dw |= 0xfe;   // GPIO1-7 output high
58 +       pci_write_config_dword(dev, 0x644, dw);
59 +
60 +       msleep(100);
61 +}
62 +DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_PLX, 0x8609, ventana_pciesw_early_fixup);
63 +DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_PLX, 0x8606, ventana_pciesw_early_fixup);
64 +DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_PLX, 0x8604, ventana_pciesw_early_fixup);
65 +
66  static int ar8031_phy_fixup(struct phy_device *dev)
67  {
68         u16 val;