]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - board/gateworks/gw_ventana/gw_ventana.c
Merge branch 'master' of git://git.denx.de/u-boot-imx
[karo-tx-uboot.git] / board / gateworks / gw_ventana / gw_ventana.c
index 5c98eb490866c674e5b8e22329d4c144563c8a4b..df491a8fc8869afc5a531302a315f5fc713c51d2 100644 (file)
@@ -20,6 +20,7 @@
 #include <asm/imx-common/mxc_i2c.h>
 #include <asm/imx-common/boot_mode.h>
 #include <asm/imx-common/sata.h>
+#include <asm/imx-common/spi.h>
 #include <asm/imx-common/video.h>
 #include <jffs2/load_kernel.h>
 #include <hwconfig.h>
@@ -31,6 +32,7 @@
 #include <mmc.h>
 #include <mtd_node.h>
 #include <netdev.h>
+#include <pci.h>
 #include <power/pmic.h>
 #include <power/ltc3676_pmic.h>
 #include <power/pfuze100_pmic.h>
@@ -355,9 +357,14 @@ iomux_v3_cfg_t const ecspi1_pads[] = {
        IOMUX_PADS(PAD_EIM_D16__ECSPI1_SCLK | MUX_PAD_CTRL(SPI_PAD_CTRL)),
 };
 
+int board_spi_cs_gpio(unsigned bus, unsigned cs)
+{
+       return (bus == 0 && cs == 0) ? (IMX_GPIO_NR(3, 19)) : -1;
+}
+
 static void setup_spi(void)
 {
-       gpio_direction_output(CONFIG_SF_DEFAULT_CS, 1);
+       gpio_direction_output(IMX_GPIO_NR(3, 19), 1);
        SETUP_IOMUX_PADS(ecspi1_pads);
 }
 #endif
@@ -1060,7 +1067,7 @@ static void setup_board_gpio(int board)
 #endif
 
        /* turn off (active-high) user LED's */
-       for (i = 0; i < 4; i++) {
+       for (i = 0; i < ARRAY_SIZE(gpio_cfg[board].leds); i++) {
                if (gpio_cfg[board].leds[i])
                        gpio_direction_output(gpio_cfg[board].leds[i], 1);
        }
@@ -1157,6 +1164,35 @@ int imx6_pcie_toggle_reset(void)
        }
        return 0;
 }
+
+/*
+ * Most Ventana boards have a PLX PEX860x PCIe switch onboard and use its
+ * GPIO's as PERST# signals for its downstream ports - configure the GPIO's
+ * properly and assert reset for 100ms.
+ */
+void board_pci_fixup_dev(struct pci_controller *hose, pci_dev_t dev,
+                        unsigned short vendor, unsigned short device,
+                        unsigned short class)
+{
+       u32 dw;
+
+       debug("%s: %02d:%02d.%02d: %04x:%04x\n", __func__,
+             PCI_BUS(dev), PCI_DEV(dev), PCI_FUNC(dev), vendor, device);
+       if (vendor == PCI_VENDOR_ID_PLX &&
+           (device & 0xfff0) == 0x8600 &&
+           PCI_DEV(dev) == 0 && PCI_FUNC(dev) == 0) {
+               debug("configuring PLX 860X downstream PERST#\n");
+               pci_hose_read_config_dword(hose, dev, 0x62c, &dw);
+               dw |= 0xaaa8; /* GPIO1-7 outputs */
+               pci_hose_write_config_dword(hose, dev, 0x62c, dw);
+
+               pci_hose_read_config_dword(hose, dev, 0x644, &dw);
+               dw |= 0xfe;   /* GPIO1-7 output high */
+               pci_hose_write_config_dword(hose, dev, 0x644, dw);
+
+               mdelay(100);
+       }
+}
 #endif /* CONFIG_CMD_PCI */
 
 #ifdef CONFIG_SERIAL_TAG
@@ -1348,6 +1384,7 @@ int misc_init_r(void)
                else if (is_cpu_type(MXC_CPU_MX6DL) ||
                         is_cpu_type(MXC_CPU_MX6SOLO))
                        cputype = "imx6dl";
+               setenv("soctype", cputype);
                if (8 << (ventana_info.nand_flash_size-1) >= 2048)
                        setenv("flash_layout", "large");
                else