imx6: refresh patches
[openwrt/openwrt.git] / target / linux / imx6 / patches-3.14 / 208-ventana-plx-allow-override-gpio-output-mask.patch
1 This patch allows passing in the gpio output mask used for GPIO0-7 on the
2 PLX PCIe bridge. These GPIO's are used for PERST# on the downstream ports.
3
4 Allowing the kernel to override the default configuration allows for keeping
5 specific devices held in reset. One important use of this is to allow
6 temporarily disabling devices that may request too many resources such as
7 an unprogrammed i210 device.
8
9 --- a/arch/arm/mach-imx/mach-imx6q.c
10 +++ b/arch/arm/mach-imx/mach-imx6q.c
11 @@ -84,6 +84,7 @@ static int ksz9031rn_phy_fixup(struct ph
12 * fixup for PLX PEX8909 bridge to configure GPIO1-7 as output High
13 * as they are used for slots1-7 PERST#
14 */
15 +unsigned int ventana_plx_gpio = 0xfe;
16 static void ventana_pciesw_early_fixup(struct pci_dev *dev)
17 {
18 u32 dw;
19 @@ -95,19 +96,25 @@ static void ventana_pciesw_early_fixup(s
20 return;
21
22 pci_read_config_dword(dev, 0x62c, &dw);
23 + dev_info(&dev->dev, "de-asserting downstream PERST# 0x%04x\n",
24 + ventana_plx_gpio);
25 dw |= 0xaaa8; // GPIO1-7 outputs
26 pci_write_config_dword(dev, 0x62c, dw);
27 -
28 - pci_read_config_dword(dev, 0x644, &dw);
29 - dw |= 0xfe; // GPIO1-7 output high
30 - pci_write_config_dword(dev, 0x644, dw);
31 -
32 + pci_write_config_dword(dev, 0x644, ventana_plx_gpio);
33 msleep(100);
34 }
35 DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_PLX, 0x8609, ventana_pciesw_early_fixup);
36 DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_PLX, 0x8606, ventana_pciesw_early_fixup);
37 DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_PLX, 0x8604, ventana_pciesw_early_fixup);
38
39 +static int __init setup_ventana_plx_gpio(char *str)
40 +{
41 + get_option(&str, &ventana_plx_gpio);
42 +
43 + return 0;
44 +}
45 +early_param("plx_gpio", setup_ventana_plx_gpio);
46 +
47 static int ar8031_phy_fixup(struct phy_device *dev)
48 {
49 u16 val;
50 @@ -328,7 +335,7 @@ static void __init imx6q_init_irq(void)
51 irqchip_init();
52 }
53
54 -static const char *imx6q_dt_compat[] __initconst = {
55 +static const char *imx6q_dt_compat[] __initdata = {
56 "fsl,imx6dl",
57 "fsl,imx6q",
58 NULL,