imx6: update 3.10 patches
[openwrt.git] / target / linux / imx6 / patches-3.10 / 120-ventana-init.ptach
1 Many of the Gateworks Ventana boards use a PLX PEX860X PCIe Switch
2 and utilize its GPIO outputs as PERST# for downstream ports.  This
3 patch configures them appropriately during enumeration.
4
5 Additionally many of the Ventana boards use CKO1 as the clock input for
6 an analog audio codec which is setup here.
7
8 --- a/arch/arm/mach-imx/mach-imx6q.c
9 +++ b/arch/arm/mach-imx/mach-imx6q.c
10 @@ -25,6 +25,7 @@
11  #include <linux/of_irq.h>
12  #include <linux/of_platform.h>
13  #include <linux/opp.h>
14 +#include <linux/pci.h>
15  #include <linux/phy.h>
16  #include <linux/regmap.h>
17  #include <linux/micrel_phy.h>
18 @@ -145,6 +146,42 @@ static void __init imx6q_sabrelite_init(
19         imx6q_sabrelite_cko1_setup();
20  }
21  
22 +/*
23 + * fixup for PEX 8909 bridge to configure GPIO1-7 as output High
24 + * as they are used for slots1-7 PERST#
25 + */
26 +static void mx6_ventana_pciesw_early_fixup(struct pci_dev *dev)
27 +{
28 +       u32 dw;
29 +
30 +       if (!of_machine_is_compatible("gw,ventana"))
31 +               return;
32 +
33 +       if (dev->devfn != 0)
34 +               return;
35 +
36 +       pci_read_config_dword(dev, 0x62c, &dw);
37 +       dw |= 0xaaa8; // GPIO1-7 outputs
38 +       pci_write_config_dword(dev, 0x62c, dw);
39 +
40 +       pci_read_config_dword(dev, 0x644, &dw);
41 +       dw |= 0xfe;   // GPIO1-7 output high
42 +       pci_write_config_dword(dev, 0x644, dw);
43 +
44 +       mdelay(100);
45 +}
46 +DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_PLX, 0x8609,
47 +       mx6_ventana_pciesw_early_fixup);
48 +DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_PLX, 0x8606,
49 +       mx6_ventana_pciesw_early_fixup);
50 +DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_PLX, 0x8604,
51 +       mx6_ventana_pciesw_early_fixup);
52 +
53 +static void __init imx6q_ventana_init(void)
54 +{
55 +       imx6q_sabrelite_cko1_setup();
56 +}
57 +
58  static void __init imx6q_1588_init(void)
59  {
60         struct regmap *gpr;
61 @@ -163,6 +200,9 @@ static void __init imx6q_usb_init(void)
62  
63  static void __init imx6q_init_machine(void)
64  {
65 +       if (of_machine_is_compatible("gw,ventana"))
66 +               imx6q_ventana_init();
67 +
68         if (of_machine_is_compatible("fsl,imx6q-sabrelite"))
69                 imx6q_sabrelite_init();
70