4ac15ca05b1f623ddcbedbee8b386b103acaf53d
[openwrt.git] / target / linux / imx6 / patches-3.12 / 0009-imx-add-PCI-fixup-for-PEX860X-on-Gateworks-board.patch
1 From 079441036b20d9f3d23d1e96f0681b99349de05a 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] 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 @@ -26,6 +26,7 @@
19  #include <linux/of_irq.h>
20  #include <linux/of_platform.h>
21  #include <linux/opp.h>
22 +#include <linux/pci.h>
23  #include <linux/phy.h>
24  #include <linux/reboot.h>
25  #include <linux/regmap.h>
26 @@ -134,6 +135,34 @@ static int ksz9031rn_phy_fixup(struct ph
27         return 0;
28  }
29  
30 +/*
31 + * fixup for PLX PEX8909 bridge to configure GPIO1-7 as output High
32 + * as they are used for slots1-7 PERST#
33 + */
34 +static void ventana_pciesw_early_fixup(struct pci_dev *dev)
35 +{
36 +       u32 dw;
37 +
38 +       if (!of_machine_is_compatible("gw,ventana"))
39 +               return;
40 +
41 +       if (dev->devfn != 0)
42 +               return;
43 +
44 +       pci_read_config_dword(dev, 0x62c, &dw);
45 +       dw |= 0xaaa8; // GPIO1-7 outputs
46 +       pci_write_config_dword(dev, 0x62c, dw);
47 +
48 +       pci_read_config_dword(dev, 0x644, &dw);
49 +       dw |= 0xfe;   // GPIO1-7 output high
50 +       pci_write_config_dword(dev, 0x644, dw);
51 +
52 +       msleep(100);
53 +}
54 +DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_PLX, 0x8609, ventana_pciesw_early_fixup);
55 +DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_PLX, 0x8606, ventana_pciesw_early_fixup);
56 +DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_PLX, 0x8604, ventana_pciesw_early_fixup);
57 +
58  static int ar8031_phy_fixup(struct phy_device *dev)
59  {
60         u16 val;