Skip to contentSkip to conversation

imx: ventana: misc updates

PATCH New Tim Harvey 6 participants 44 messages May 9, 2015 – May 21, 2015

lore
Share & tools
lore

Tim Harvey

author
#0 lore raw

cover imx: ventana: misc updates

This collection of patches comprises a set of various updates I've been on for Ventana.

In summary:
- enable driver model
- enable gpio command
- enable dm-serial
- enable thermal support
- fixup for GW522x PCI enumeration
- split out common code shared between SPL an U-Boot
- pull down various init code to the SPL for use in Falcon mode
- enable Falcon mode (based on env var)

The enabling of Falcon mode is dependent on a patch I submitted earlier allowing nand env in spl [1].

Currently Falcon mode is configured for NAND boot. I plan on re-working a pending patchset I have that allows dynamic env support (use mmc or nand env depending on boot device) but I still need to re-work that using driver-model so it will come later.

I will send a followup patch with README updates explaining our use of Falcon mode if everything here looks good.

Tim

[1] https://patchwork.ozlabs.org/patch/470191/

Tim Harvey (19):
imx: ventana: set dtype env var to boot media
imx: ventana: display SPL boot device
imx: ventana: config: enable gpio command
imx: ventana: config: enable driver model
imx: ventana: register gpio's with gpio_request
imx: ventana: enable DM_SERIAL
imx: ventana: config: enable Thermal support
imx: ventana: config: use MMC SPL RAW support
imx: ventana: (cosmetic) clean up size defines for improved
readability
imx: ventana: fix pcie reset for GW522x
imx: ventana: default msata/pci mux to pci before PCI enumeration
imx: ventana: split out common functions between SPL and uboot
imx: ventana: move GSC boot watchdog disable function to gsc.c
imx: ventana: detect pmic using i2c probe instead of board model
imx: ventana: use common uart and i2c setup functions in SPL
imx: ventana: add gpio setup to SPL
imx: ventana: add pmic_setup to SPL
imx: ventana: add GSC boot watchdog disable to SPL
imx: ventana: config: enable Falcon mode

 board/gateworks/gw_ventana/Makefile         |   2 +-
 board/gateworks/gw_ventana/common.c         | 827 +++++++++++++++++++++++++
 board/gateworks/gw_ventana/common.h         |  98 +++
 board/gateworks/gw_ventana/gsc.c            |  27 +
 board/gateworks/gw_ventana/gsc.h            |   1 +
 board/gateworks/gw_ventana/gw_ventana.c     | 911 ++--------------------------
 board/gateworks/gw_ventana/gw_ventana_spl.c | 103 ++--
 include/configs/gw_ventana.h                |  67 +-
 8 files changed, 1102 insertions(+), 934 deletions(-)
 create mode 100644 board/gateworks/gw_ventana/common.c
 create mode 100644 board/gateworks/gw_ventana/common.h
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH 1/19 imx: ventana: set dtype env var to boot media

Bootscripts for some distro's such as Android can benefit from knowing what boot media its script was loaded from.

---
 include/configs/gw_ventana.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
include/configs/gw_ventana.h +4 -4
index 684f347..48919e8 100644
@@ -359,7 +359,7 @@
 	"mmc_boot=" \
 		"setenv fsload 'ext2load mmc 0:1'; " \
 		"mmc dev 0 && mmc rescan && " \
-		"run loadscript; " \
+		"setenv dtype mmc; run loadscript; " \
 		"if ${fsload} ${loadaddr} ${bootdir}/${uimage}; then " \
 			"setenv bootargs console=${console},${baudrate} " \
 				"root=/dev/mmcblk0p1 rootfstype=ext4 " \
@@ -373,7 +373,7 @@
 	\
 	"sata_boot=" \
 		"setenv fsload 'ext2load sata 0:1'; sata init && " \
-		"run loadscript; " \
+		"setenv dtype sata; run loadscript; " \
 		"if ${fsload} ${loadaddr} ${bootdir}/${uimage}; then " \
 			"setenv bootargs console=${console},${baudrate} " \
 				"root=/dev/sda1 rootfstype=ext4 " \
@@ -386,7 +386,7 @@
 		"fi\0" \
 	"usb_boot=" \
 		"setenv fsload 'ext2load usb 0:1'; usb start && usb dev 0 && " \
-		"run loadscript; " \
+		"setenv dtype usb; run loadscript; " \
 		"if ${fsload} ${loadaddr} ${bootdir}/${uimage}; then " \
 			"setenv bootargs console=${console},${baudrate} " \
 				"root=/dev/sda1 rootfstype=ext4 " \
@@ -450,7 +450,7 @@
 			"setenv root ubi0:rootfs ubi.mtd=2 " \
 				"rootfstype=ubifs; " \
 		"fi; " \
-		"run loadscript; " \
+		"setenv dtype nand; run loadscript; " \
 		"if ${fsload} ${loadaddr} ${bootdir}/${uimage}; then " \
 			"setenv bootargs console=${console},${baudrate} " \
 				"root=${root} ${video} ${extra}; " \
Signature · 1 line
1.9.1
author
#2 lore raw

PATCH 2/19 imx: ventana: display SPL boot device

In reply to Tim Harvey

Display what device the SPL will fetch uboot.img from

---
 board/gateworks/gw_ventana/gw_ventana_spl.c | 22 ++++++++++++++++++++++
 include/configs/gw_ventana.h                |  1 +
 2 files changed, 23 insertions(+)
board/gateworks/gw_ventana/gw_ventana_spl.c +22 -0
index 289a0b8..8fe0cae 100644
@@ -570,6 +570,28 @@ void board_init_f(ulong dummy)
 	board_init_r(NULL, 0);
 }
 
+/* called from board_init_r after gd setup if CONFIG_SPL_BOARD_INIT defined */
+/* its our chance to print info about boot device */
+void spl_board_init(void)
+{
+	/* determine boot device from SRC_SBMR1 (BOOT_CFG[4:1]) or SRC_GPR9 */
+	u32 boot_device = spl_boot_device();
+
+	switch (boot_device) {
+	case BOOT_DEVICE_MMC1:
+		puts("Booting from MMC\n");
+		break;
+	case BOOT_DEVICE_NAND:
+		puts("Booting from NAND\n");
+		break;
+	case BOOT_DEVICE_SATA:
+		puts("Booting from SATA\n");
+		break;
+	default:
+		puts("Unknown boot device\n");
+	}
+}
+
 void reset_cpu(ulong addr)
 {
 }
include/configs/gw_ventana.h +1 -0
index 48919e8..dfe818e 100644
@@ -8,6 +8,7 @@
 #define __CONFIG_H
 
 /* SPL */
+#define CONFIG_SPL_BOARD_INIT
 #define CONFIG_SPL_NAND_SUPPORT
 #define CONFIG_SPL_MMC_SUPPORT
 #define CONFIG_SPL_FAT_SUPPORT
Signature · 1 line
1.9.1
author
#3 lore raw

PATCH 3/19 imx: ventana: config: enable gpio command

In reply to Tim Harvey
---
 include/configs/gw_ventana.h | 1 +
 1 file changed, 1 insertion(+)
include/configs/gw_ventana.h +1 -0
index dfe818e..db0cf51 100644
@@ -47,6 +47,7 @@
 
 /* GPIO */
 #define CONFIG_MXC_GPIO
+#define CONFIG_CMD_GPIO
 
 /* Serial */
 #define CONFIG_MXC_UART
Signature · 1 line
1.9.1
author
#4 lore raw

PATCH 4/19 imx: ventana: config: enable driver model

In reply to Tim Harvey

Enable U-Boot Driver Model (DM).

---
 include/configs/gw_ventana.h | 7 +++++++
 1 file changed, 7 insertions(+)
include/configs/gw_ventana.h +7 -0
index db0cf51..20bc4dc 100644
@@ -45,6 +45,13 @@
 #define CONFIG_BOARD_EARLY_INIT_F
 #define CONFIG_MISC_INIT_R
 
+/* Driver Model */
+#ifndef CONFIG_SPL_BUILD
+#define CONFIG_DM
+#define CONFIG_DM_GPIO
+#define CONFIG_CMD_DM
+#endif
+
 /* GPIO */
 #define CONFIG_MXC_GPIO
 #define CONFIG_CMD_GPIO
Signature · 1 line
1.9.1
author
#5 lore raw

PATCH 5/19 imx: ventana: register gpio's with gpio_request

In reply to Tim Harvey

Prior to using a gpio a call to gpio_request() should be called to register it with the gpio subsystem.

---
 board/gateworks/gw_ventana/gw_ventana.c | 77 ++++++++++++++++++++++++---------
 1 file changed, 57 insertions(+), 20 deletions(-)
board/gateworks/gw_ventana/gw_ventana.c +57 -20
index 1e54912..8818be4 100644
@@ -268,14 +268,15 @@ static void setup_gpmi_nand(void)
 }
 #endif
 
-static void setup_iomux_enet(void)
+static void setup_iomux_enet(int gpio)
 {
 	SETUP_IOMUX_PADS(enet_pads);
 
 	/* toggle PHY_RST# */
-	gpio_direction_output(GP_PHY_RST, 0);
+	gpio_request(gpio, "phy_rst#");
+	gpio_direction_output(gpio, 0);
 	mdelay(2);
-	gpio_set_value(GP_PHY_RST, 1);
+	gpio_set_value(gpio, 1);
 }
 
 static void setup_iomux_uart(void)
@@ -295,6 +296,7 @@ static iomux_v3_cfg_t const usb_pads[] = {
 int board_ehci_hcd_init(int port)
 {
 	struct ventana_board_info *info = &ventana_info;
+	int gpio;
 
 	SETUP_IOMUX_PADS(usb_pads);
 
@@ -303,18 +305,22 @@ int board_ehci_hcd_init(int port)
 	case '3': /* GW53xx */
 	case '5': /* GW552x */
 		SETUP_IOMUX_PAD(PAD_GPIO_9__GPIO1_IO09 | DIO_PAD_CFG);
-		gpio_direction_output(IMX_GPIO_NR(1, 9), 0);
-		mdelay(2);
-		gpio_set_value(IMX_GPIO_NR(1, 9), 1);
+		gpio = (IMX_GPIO_NR(1, 9));
 		break;
 	case '4': /* GW54xx */
 		SETUP_IOMUX_PAD(PAD_SD1_DAT0__GPIO1_IO16 | DIO_PAD_CFG);
-		gpio_direction_output(IMX_GPIO_NR(1, 16), 0);
-		mdelay(2);
-		gpio_set_value(IMX_GPIO_NR(1, 16), 1);
+		gpio = (IMX_GPIO_NR(1, 16));
 		break;
+	default:
+		return 0;
 	}
 
+	/* request and toggle hub rst */
+	gpio_request(gpio, "usb_hub_rst#");
+	gpio_direction_output(gpio, 0);
+	mdelay(2);
+	gpio_set_value(gpio, 1);
+
 	return 0;
 }
 
@@ -322,6 +328,7 @@ int board_ehci_power(int port, int on)
 {
 	if (port)
 		return 0;
+	gpio_request(GP_USB_OTG_PWR, "usb_otg_pwr");
 	gpio_set_value(GP_USB_OTG_PWR, on);
 	return 0;
 }
@@ -333,6 +340,7 @@ static struct fsl_esdhc_cfg usdhc_cfg = { USDHC3_BASE_ADDR };
 int board_mmc_getcd(struct mmc *mmc)
 {
 	/* Card Detect */
+	gpio_request(GP_SD3_CD, "sd_cd");
 	gpio_direction_input(GP_SD3_CD);
 	return !gpio_get_value(GP_SD3_CD);
 }
@@ -364,6 +372,7 @@ int board_spi_cs_gpio(unsigned bus, unsigned cs)
 
 static void setup_spi(void)
 {
+	gpio_request(IMX_GPIO_NR(3, 19), "spi_cs");
 	gpio_direction_output(IMX_GPIO_NR(3, 19), 1);
 	SETUP_IOMUX_PADS(ecspi1_pads);
 }
@@ -399,7 +408,7 @@ int board_eth_init(bd_t *bis)
 {
 #ifdef CONFIG_FEC_MXC
 	if (board_type != GW551x && board_type != GW552x) {
-		setup_iomux_enet();
+		setup_iomux_enet(GP_PHY_RST);
 		cpu_eth_init(bis);
 	}
 #endif
@@ -449,6 +458,7 @@ static void enable_lvds(struct display_info_t const *dev)
 	writel(reg, &iomux->gpr[2]);
 
 	/* Enable Backlight */
+	gpio_request(IMX_GPIO_NR(1, 18), "bklt_en");
 	SETUP_IOMUX_PAD(PAD_SD1_CMD__GPIO1_IO18 | DIO_PAD_CFG);
 	gpio_direction_output(IMX_GPIO_NR(1, 18), 1);
 }
@@ -588,6 +598,7 @@ static void setup_display(void)
 	writel(reg, &iomux->gpr[3]);
 
 	/* Backlight CABEN on LVDS connector */
+	gpio_request(IMX_GPIO_NR(1, 10), "bklt_gpio");
 	SETUP_IOMUX_PAD(PAD_SD2_CLK__GPIO1_IO10 | DIO_PAD_CFG);
 	gpio_direction_output(IMX_GPIO_NR(1, 10), 0);
 }
@@ -1158,9 +1169,11 @@ static void setup_board_gpio(int board)
 		return;
 
 	/* RS232_EN# */
+	gpio_request(GP_RS232_EN, "rs232_en");
 	gpio_direction_output(GP_RS232_EN, (hwconfig("rs232")) ? 0 : 1);
 
 	/* MSATA Enable */
+	gpio_request(GP_MSATA_SEL, "msata_en");
 	if (is_cpu_type(MXC_CPU_MX6Q) &&
 	    test_bit(EECONFIG_SATA, info->config)) {
 		gpio_direction_output(GP_MSATA_SEL,
@@ -1175,50 +1188,71 @@ static void setup_board_gpio(int board)
 		gpio_cfg[board].pcie_rst = IMX_GPIO_NR(3, 23);
 
 	/* assert PCI_RST# (released by OS when clock is valid) */
+	gpio_request(gpio_cfg[board].pcie_rst, "pci_rst#");
 	gpio_direction_output(gpio_cfg[board].pcie_rst, 0);
 #endif
 
 	/* turn off (active-high) user LED's */
 	for (i = 0; i < ARRAY_SIZE(gpio_cfg[board].leds); i++) {
-		if (gpio_cfg[board].leds[i])
+		if (gpio_cfg[board].leds[i]) {
+			gpio_requestf(gpio_cfg[board].leds[i], "led_user%d", i);
 			gpio_direction_output(gpio_cfg[board].leds[i], 1);
+		}
 	}
 
 	/* Expansion Mezzanine IO */
-	if (gpio_cfg[board].mezz_pwren)
+	if (gpio_cfg[board].mezz_pwren) {
+		gpio_request(gpio_cfg[board].mezz_pwren, "mezz_pwr");
 		gpio_direction_output(gpio_cfg[board].mezz_pwren, 0);
-	if (gpio_cfg[board].mezz_irq)
+	}
+	if (gpio_cfg[board].mezz_irq) {
+		gpio_request(gpio_cfg[board].mezz_irq, "mezz_irq#");
 		gpio_direction_input(gpio_cfg[board].mezz_irq);
+	}
 
 	/* RS485 Transmit Enable */
-	if (gpio_cfg[board].rs485en)
+	if (gpio_cfg[board].rs485en) {
+		gpio_request(gpio_cfg[board].rs485en, "rs485_en");
 		gpio_direction_output(gpio_cfg[board].rs485en, 0);
+	}
 
 	/* GPS_SHDN */
-	if (gpio_cfg[board].gps_shdn)
+	if (gpio_cfg[board].gps_shdn) {
+		gpio_request(gpio_cfg[board].gps_shdn, "gps_shdn");
 		gpio_direction_output(gpio_cfg[board].gps_shdn, 1);
+	}
 
 	/* Analog video codec power enable */
-	if (gpio_cfg[board].vidin_en)
+	if (gpio_cfg[board].vidin_en) {
+		gpio_request(gpio_cfg[board].vidin_en, "anavidin_en");
 		gpio_direction_output(gpio_cfg[board].vidin_en, 1);
+	}
 
 	/* DIOI2C_DIS# */
-	if (gpio_cfg[board].dioi2c_en)
+	if (gpio_cfg[board].dioi2c_en) {
+		gpio_request(gpio_cfg[board].dioi2c_en, "dioi2c_dis#");
 		gpio_direction_output(gpio_cfg[board].dioi2c_en, 0);
+	}
 
 	/* PCICK_SSON: disable spread-spectrum clock */
-	if (gpio_cfg[board].pcie_sson)
+	if (gpio_cfg[board].pcie_sson) {
+		gpio_request(gpio_cfg[board].pcie_sson, "pci_sson");
 		gpio_direction_output(gpio_cfg[board].pcie_sson, 0);
+	}
 
 	/* USBOTG Select (PCISKT or FrontPanel) */
-	if (gpio_cfg[board].usb_sel)
+	if (gpio_cfg[board].usb_sel) {
+		gpio_request(gpio_cfg[board].usb_sel, "usb_pcisel");
 		gpio_direction_output(gpio_cfg[board].usb_sel,
 				      (hwconfig("usb_pcisel")) ? 1 : 0);
+	}
 
 
 	/* PCISKT_WDIS# (Wireless disable GPIO to miniPCIe sockets) */
-	if (gpio_cfg[board].wdis)
+	if (gpio_cfg[board].wdis) {
+		gpio_request(gpio_cfg[board].wdis, "wlan_dis");
 		gpio_direction_output(gpio_cfg[board].wdis, 1);
+	}
 
 	/*
 	 * Configure DIO pinmux/padctl registers
@@ -1248,6 +1282,7 @@ static void setup_board_gpio(int board)
 			}
 			imx_iomux_v3_setup_pad(cfg->gpio_padmux[cputype] |
 					       ctrl);
+			gpio_requestf(cfg->gpio_param, "dio%d", i);
 			gpio_direction_input(cfg->gpio_param);
 		} else if (hwconfig_subarg_cmp("dio2", "mode", "pwm") &&
 			   cfg->pwm_padmux) {
@@ -1274,6 +1309,7 @@ int imx6_pcie_toggle_reset(void)
 {
 	if (board_type < GW_UNKNOWN) {
 		uint pin = gpio_cfg[board_type].pcie_rst;
+		gpio_request(pin, "pci_rst#");
 		gpio_direction_output(pin, 0);
 		mdelay(50);
 		gpio_direction_output(pin, 1);
@@ -1343,6 +1379,7 @@ void get_board_serial(struct tag_serialnr *serialnr)
 int board_early_init_f(void)
 {
 	setup_iomux_uart();
+
 	gpio_direction_output(GP_USB_OTG_PWR, 0); /* OTG power off */
 
 #if defined(CONFIG_VIDEO_IPUV3)
Signature · 1 line
1.9.1
author
#6 lore raw

PATCH 6/19 imx: ventana: enable DM_SERIAL

In reply to Tim Harvey

mxc_serial supports DM so lets use it.

---
 board/gateworks/gw_ventana/gw_ventana.c | 9 +++++++++
 include/configs/gw_ventana.h            | 1 +
 2 files changed, 10 insertions(+)
board/gateworks/gw_ventana/gw_ventana.c +9 -0
index 8818be4..554cd84 100644
@@ -22,6 +22,7 @@
 #include <asm/imx-common/sata.h>
 #include <asm/imx-common/spi.h>
 #include <asm/imx-common/video.h>
+#include <dm/platform_data/serial_mxc.h>
 #include <jffs2/load_kernel.h>
 #include <hwconfig.h>
 #include <i2c.h>
@@ -1820,3 +1821,11 @@ int ft_board_setup(void *blob, bd_t *bd)
 }
 #endif /* defined(CONFIG_OF_FLAT_TREE) && defined(CONFIG_OF_BOARD_SETUP) */
 
+static struct mxc_serial_platdata ventana_mxc_serial_plat = {
+	.reg = (struct mxc_uart *)UART2_BASE,
+};
+
+U_BOOT_DEVICE(ventana_serial) = {
+	.name   = "serial_mxc",
+	.platdata = &ventana_mxc_serial_plat,
+};
include/configs/gw_ventana.h +1 -0
index 20bc4dc..ea1848a 100644
@@ -49,6 +49,7 @@
 #ifndef CONFIG_SPL_BUILD
 #define CONFIG_DM
 #define CONFIG_DM_GPIO
+#define CONFIG_DM_SERIAL
 #define CONFIG_CMD_DM
 #endif
 
Signature · 1 line
1.9.1
author
#7 lore raw

PATCH 7/19 imx: ventana: config: enable Thermal support

In reply to Tim Harvey
---
 include/configs/gw_ventana.h | 4 ++++
 1 file changed, 4 insertions(+)
include/configs/gw_ventana.h +4 -0
index ea1848a..63af20c 100644
@@ -50,6 +50,7 @@
 #define CONFIG_DM
 #define CONFIG_DM_GPIO
 #define CONFIG_DM_SERIAL
+#define CONFIG_DM_THERMAL
 #define CONFIG_CMD_DM
 #endif
 
@@ -57,6 +58,9 @@
 #define CONFIG_MXC_GPIO
 #define CONFIG_CMD_GPIO
 
+/* Thermal */
+#define CONFIG_IMX6_THERMAL
+
 /* Serial */
 #define CONFIG_MXC_UART
 #define CONFIG_MXC_UART_BASE	       UART2_BASE
Signature · 1 line
1.9.1
author
#8 lore raw

PATCH 8/19 imx: ventana: config: use MMC SPL RAW support

In reply to Tim Harvey

Switch to MMC RAW support for SPL. We will place the uboot.img at 69KB.

---
 include/configs/gw_ventana.h | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
include/configs/gw_ventana.h +2 -4
index 63af20c..e18e262 100644
@@ -11,10 +11,8 @@
 #define CONFIG_SPL_BOARD_INIT
 #define CONFIG_SPL_NAND_SUPPORT
 #define CONFIG_SPL_MMC_SUPPORT
-#define CONFIG_SPL_FAT_SUPPORT
-/*
-#define CONFIG_SPL_SATA_SUPPORT
-*/
+/* Location on MMC to read U-Boot from */
+#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR 138 /* 69KB */
 /* Location in NAND to read U-Boot from */
 #define CONFIG_SYS_NAND_U_BOOT_OFFS     (14 * 1024 * 1024)
 
Signature · 1 line
1.9.1
#9 lore raw

PATCH 8/19 imx: ventana: config: use MMC SPL RAW support

Hi Tim,

Quoted 12 lines · Tim Harvey

Switch to MMC RAW support for SPL. We will place the uboot.img at 69KB.

---
 include/configs/gw_ventana.h | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
include/configs/gw_ventana.h +0 -0
index 63af20c..e18e262 100644

include/configs/gw_ventana.h line 15

Quoted 9 lines
include/configs/gw_ventana.h +2 -4
@@ -11,10 +11,8 @@
 #define CONFIG_SPL_BOARD_INIT
 #define CONFIG_SPL_NAND_SUPPORT
 #define CONFIG_SPL_MMC_SUPPORT
-#define CONFIG_SPL_FAT_SUPPORT
-/*
-#define CONFIG_SPL_SATA_SUPPORT
-*/
+/* Location on MMC to read U-Boot from */
+#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR 138 /* 69KB */

No need to define this as it is the default from imx6_spl.h

author
#10 lore raw

PATCH 8/19 imx: ventana: config: use MMC SPL RAW support

Quoted 10 lines · Fabio Estevam

Hi Tim,

Quoted 7 lines · Tim Harvey

Switch to MMC RAW support for SPL. We will place the uboot.img at 69KB.

---
 include/configs/gw_ventana.h | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
Quoted 16 lines
Quoted 5 lines
include/configs/gw_ventana.h +0 -0
index 63af20c..e18e262 100644

include/configs/gw_ventana.h line 15

Quoted 9 lines
include/configs/gw_ventana.h +2 -4
@@ -11,10 +11,8 @@
 #define CONFIG_SPL_BOARD_INIT
 #define CONFIG_SPL_NAND_SUPPORT
 #define CONFIG_SPL_MMC_SUPPORT
-#define CONFIG_SPL_FAT_SUPPORT
-/*
-#define CONFIG_SPL_SATA_SUPPORT
-*/
+/* Location on MMC to read U-Boot from */
+#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR 138 /* 69KB */

No need to define this as it is the default from imx6_spl.h

Fabio,

Thanks for pointing that out - I'll remove it.

Tim

#11 lore raw

PATCH 8/19 imx: ventana: config: use MMC SPL RAW support

Hi Tim,

Quoted 28 lines · Tim Harvey
Quoted 10 lines · Fabio Estevam

Hi Tim,

Quoted 7 lines · Tim Harvey

Switch to MMC RAW support for SPL. We will place the uboot.img at 69KB.

---
 include/configs/gw_ventana.h | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
Quoted 16 lines
Quoted 5 lines
include/configs/gw_ventana.h +0 -0
index 63af20c..e18e262 100644

include/configs/gw_ventana.h line 15

Quoted 9 lines
include/configs/gw_ventana.h +2 -4
@@ -11,10 +11,8 @@
 #define CONFIG_SPL_BOARD_INIT
 #define CONFIG_SPL_NAND_SUPPORT
 #define CONFIG_SPL_MMC_SUPPORT
-#define CONFIG_SPL_FAT_SUPPORT
-/*
-#define CONFIG_SPL_SATA_SUPPORT
-*/
+/* Location on MMC to read U-Boot from */
+#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR 138 /* 69KB */

No need to define this as it is the default from imx6_spl.h

Quoted 4 lines

Fabio,

Thanks for pointing that out - I'll remove it.

Then rework the commit message, pointing to the remove of SPL_FAT and SPL_SATA.

I like that your patchset is fully orthogonal - rewieving is easier and I do not miss your changes - thanks for that !

For that reason, I am applying most of your patches - you do not need to post the whole patchset again. Due to rework in this one, I would like you repost in a new patchset only these ones:

imx: ventana: config: use MMC SPL RAW support (this one)
imx: ventana: (cosmetic) clean up size defines for improved readability
imx: ventana: add pmic_setup to SPL
imx: ventana: config: enable Falcon mode

I am merging the rest of your patches

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
author
#12 lore raw

PATCH 9/19 imx: ventana: (cosmetic) clean up size defines for improved readability

In reply to Tim Harvey

Use the SZ_1M and SZ_1K macros from linuz/sizes.h for improved readability

---
 include/configs/gw_ventana.h | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)
include/configs/gw_ventana.h +12 -10
index e18e262..c61fbb9 100644
@@ -7,6 +7,8 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+#include <linux/sizes.h>
+
 /* SPL */
 #define CONFIG_SPL_BOARD_INIT
 #define CONFIG_SPL_NAND_SUPPORT
@@ -14,7 +16,7 @@
 /* Location on MMC to read U-Boot from */
 #define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR 138 /* 69KB */
 /* Location in NAND to read U-Boot from */
-#define CONFIG_SYS_NAND_U_BOOT_OFFS     (14 * 1024 * 1024)
+#define CONFIG_SYS_NAND_U_BOOT_OFFS     (14 * SZ_1M)
 
 #include "imx6_spl.h"                  /* common IMX6 SPL configuration */
 #include "mx6_common.h"
@@ -37,7 +39,7 @@
 #define CONFIG_SYS_GENERIC_BOARD
 
 /* Size of malloc() pool */
-#define CONFIG_SYS_MALLOC_LEN		(10 * 1024 * 1024)
+#define CONFIG_SYS_MALLOC_LEN		(10 * SZ_1M)
 
 /* Init Functions */
 #define CONFIG_BOARD_EARLY_INIT_F
@@ -309,19 +311,19 @@
 #define CONFIG_ENV_IS_IN_NAND
 #endif
 #if defined(CONFIG_ENV_IS_IN_MMC)
-  #define CONFIG_ENV_OFFSET              (6 * 64 * 1024)
-  #define CONFIG_ENV_SIZE                (8 * 1024)
+  #define CONFIG_ENV_OFFSET              (384 * SZ_1K)
+  #define CONFIG_ENV_SIZE                (8 * SZ_1K)
   #define CONFIG_SYS_MMC_ENV_DEV         0
 #elif defined(CONFIG_ENV_IS_IN_NAND)
-  #define CONFIG_ENV_OFFSET              (16 << 20)
-  #define CONFIG_ENV_SECT_SIZE           (128 << 10)
+  #define CONFIG_ENV_OFFSET              (16 * SZ_1M)
+  #define CONFIG_ENV_SECT_SIZE           (128 * SZ_1K)
   #define CONFIG_ENV_SIZE                CONFIG_ENV_SECT_SIZE
-  #define CONFIG_ENV_OFFSET_REDUND       (CONFIG_ENV_OFFSET + (512 << 10))
+  #define CONFIG_ENV_OFFSET_REDUND       (CONFIG_ENV_OFFSET + (512 * SZ_1K))
   #define CONFIG_ENV_SIZE_REDUND         CONFIG_ENV_SIZE
 #elif defined(CONFIG_ENV_IS_IN_SPI_FLASH)
-  #define CONFIG_ENV_OFFSET              (512 * 1024)
-  #define CONFIG_ENV_SECT_SIZE           (64 * 1024)
-  #define CONFIG_ENV_SIZE                (8 * 1024)
+  #define CONFIG_ENV_OFFSET		(512 * SZ_1K)
+  #define CONFIG_ENV_SECT_SIZE		(64 * SZ_1K)
+  #define CONFIG_ENV_SIZE		(8 * SZ_1K)
   #define CONFIG_ENV_SPI_BUS             CONFIG_SF_DEFAULT_BUS
   #define CONFIG_ENV_SPI_CS              CONFIG_SF_DEFAULT_CS
   #define CONFIG_ENV_SPI_MODE            CONFIG_SF_DEFAULT_MODE
Signature · 1 line
1.9.1
author
#13 lore raw

PATCH 10/19 imx: ventana: fix pcie reset for GW522x

In reply to Tim Harvey

The re-assignment of pcie_rst gpio for GW522x needs to occur earlier, before the PCI subsystem calls the toggle funciton.

---
 board/gateworks/gw_ventana/gw_ventana.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
board/gateworks/gw_ventana/gw_ventana.c +4 -4
index 554cd84..8cfc1f2 100644
@@ -1184,10 +1184,6 @@ static void setup_board_gpio(int board)
 	}
 
 #if !defined(CONFIG_CMD_PCI)
-	/* GW522x Uses GPIO3_IO23 for PCIE_RST# */
-	if (board_type == GW52xx && info->model[4] == '2')
-		gpio_cfg[board].pcie_rst = IMX_GPIO_NR(3, 23);
-
 	/* assert PCI_RST# (released by OS when clock is valid) */
 	gpio_request(gpio_cfg[board].pcie_rst, "pci_rst#");
 	gpio_direction_output(gpio_cfg[board].pcie_rst, 0);
@@ -1435,6 +1431,10 @@ int board_init(void)
 		int count = gpio_cfg[board_type].num_pads;
 
 		imx_iomux_v3_setup_multiple_pads(p, count);
+
+		/* GW522x Uses GPIO3_IO23 for PCIE_RST# */
+		if (board_type == GW52xx && ventana_info.model[4] == '2')
+			gpio_cfg[board_type].pcie_rst = IMX_GPIO_NR(3, 23);
 	}
 
 	return 0;
Signature · 1 line
1.9.1
#14 lore raw

PATCH 10/19 imx: ventana: fix pcie reset for GW522x

Hi Tim,

Quoted 13 lines · Tim Harvey

The re-assignment of pcie_rst gpio for GW522x needs to occur earlier, before the PCI subsystem calls the toggle funciton.

---
 board/gateworks/gw_ventana/gw_ventana.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
board/gateworks/gw_ventana/gw_ventana.c +0 -0
index 554cd84..8cfc1f2 100644

board/gateworks/gw_ventana/gw_ventana.c static void setup_board_gpio(int board) · line 1190

Quoted 7 lines
board/gateworks/gw_ventana/gw_ventana.c +0 -4
@@ -1184,10 +1184,6 @@ static void setup_board_gpio(int board)
 	}
 
 #if !defined(CONFIG_CMD_PCI)
-	/* GW522x Uses GPIO3_IO23 for PCIE_RST# */
-	if (board_type == GW52xx && info->model[4] == '2')
-		gpio_cfg[board].pcie_rst = IMX_GPIO_NR(3, 23);
-

This code runs now without #ifdef protection. Is it desired ?

Quoted 5 lines
board/gateworks/gw_ventana/gw_ventana.c +0 -0
 	/* assert PCI_RST# (released by OS when clock is valid) */
 	gpio_request(gpio_cfg[board].pcie_rst, "pci_rst#");
 	gpio_direction_output(gpio_cfg[board].pcie_rst, 0);

board/gateworks/gw_ventana/gw_ventana.c int board_init(void) · line 1440

Quoted 10 lines
board/gateworks/gw_ventana/gw_ventana.c +4 -0
@@ -1435,6 +1431,10 @@ int board_init(void)
 		int count = gpio_cfg[board_type].num_pads;
 
 		imx_iomux_v3_setup_multiple_pads(p, count);
+
+		/* GW522x Uses GPIO3_IO23 for PCIE_RST# */
+		if (board_type == GW52xx && ventana_info.model[4] == '2')
+			gpio_cfg[board_type].pcie_rst = IMX_GPIO_NR(3, 23);
 	}
 
 	return 0;

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
author
#15 lore raw

PATCH 10/19 imx: ventana: fix pcie reset for GW522x

Quoted 18 lines · Stefano Babic

Hi Tim,

Quoted 15 lines · Tim Harvey

The re-assignment of pcie_rst gpio for GW522x needs to occur earlier, before the PCI subsystem calls the toggle funciton.

---
 board/gateworks/gw_ventana/gw_ventana.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
board/gateworks/gw_ventana/gw_ventana.c +0 -0
index 554cd84..8cfc1f2 100644
@@ -1184,10 +1184,6 @@ static void setup_board_gpio(int board)
      }
 
Quoted 7 lines

board/gateworks/gw_ventana/gw_ventana.c static void setup_board_gpio(int board) · line 1190

Quoted 5 lines
board/gateworks/gw_ventana/gw_ventana.c +0 -4
 #if !defined(CONFIG_CMD_PCI)
-     /* GW522x Uses GPIO3_IO23 for PCIE_RST# */
-     if (board_type == GW52xx && info->model[4] == '2')
-             gpio_cfg[board].pcie_rst = IMX_GPIO_NR(3, 23);
-

This code runs now without #ifdef protection. Is it desired ?

Stefano,

Yes - I did intend to remove the #ifdef protection.

Regards,

Tim

author
#16 lore raw

PATCH 11/19 imx: ventana: default msata/pci mux to pci before PCI enumeration

In reply to Tim Harvey

PCI enumeration occurs early, before we fully configure our GPIO's. Make sure we steer the MSATA/PCI mux to PCI in board_init to ensure PCI is selected before enumeration.

---
 board/gateworks/gw_ventana/gw_ventana.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
board/gateworks/gw_ventana/gw_ventana.c +4 -3
index 8cfc1f2..cf866ca 100644
@@ -1174,13 +1174,10 @@ static void setup_board_gpio(int board)
 	gpio_direction_output(GP_RS232_EN, (hwconfig("rs232")) ? 0 : 1);
 
 	/* MSATA Enable */
-	gpio_request(GP_MSATA_SEL, "msata_en");
 	if (is_cpu_type(MXC_CPU_MX6Q) &&
 	    test_bit(EECONFIG_SATA, info->config)) {
 		gpio_direction_output(GP_MSATA_SEL,
 				      (hwconfig("msata")) ?  1 : 0);
-	} else {
-		gpio_direction_output(GP_MSATA_SEL, 0);
 	}
 
 #if !defined(CONFIG_CMD_PCI)
@@ -1435,6 +1432,10 @@ int board_init(void)
 		/* GW522x Uses GPIO3_IO23 for PCIE_RST# */
 		if (board_type == GW52xx && ventana_info.model[4] == '2')
 			gpio_cfg[board_type].pcie_rst = IMX_GPIO_NR(3, 23);
+
+		/* MSATA Enable - default to PCI */
+		gpio_request(GP_MSATA_SEL, "msata_en");
+		gpio_direction_output(GP_MSATA_SEL, 0);
 	}
 
 	return 0;
Signature · 1 line
1.9.1
author
#17 lore raw

PATCH 12/19 imx: ventana: split out common functions between SPL and uboot

In reply to Tim Harvey

Move shared functions used by both SPL and U-Boot to common.c:
- setup_iomux_uart() and uart pad config
- gpio pad config

In the process also moved the following to common.c in preparation for calling it from the SPL:
- split i2c setup into a shared function
- move pmic init to setup_pmic() function to call directly from power_init_board()
- split gpio setup into early (iomux and default pin config) and late (output configuration based on env)

---
 board/gateworks/gw_ventana/Makefile     |   2 +-
 board/gateworks/gw_ventana/common.c     | 823 ++++++++++++++++++++++++++++++
 board/gateworks/gw_ventana/common.h     |  98 ++++
 board/gateworks/gw_ventana/gw_ventana.c | 874 +-------------------------------
 4 files changed, 933 insertions(+), 864 deletions(-)
 create mode 100644 board/gateworks/gw_ventana/common.c
 create mode 100644 board/gateworks/gw_ventana/common.h
board/gateworks/gw_ventana/Makefile +1 -1
index 33a1788..8fa691a 100644
@@ -6,6 +6,6 @@
 # SPDX-License-Identifier:  GPL-2.0+
 #
 
-obj-y  := gw_ventana.o gsc.o eeprom.o
+obj-y  := gw_ventana.o gsc.o eeprom.o common.o
 obj-$(CONFIG_SPL_BUILD) += gw_ventana_spl.o
 
board/gateworks/gw_ventana/common.c new file +823 -0

823 lines not on this page · raw message

board/gateworks/gw_ventana/common.h new file +98 -0

98 lines not on this page · raw message

board/gateworks/gw_ventana/gw_ventana.c +11 -863

962 lines not on this page · raw message

Signature · 1 line
1.9.1
author
#18 lore raw

PATCH 13/19 imx: ventana: move GSC boot watchdog disable function to gsc.c

In reply to Tim Harvey

Move the code that disables the GSC boot watchdog into gsc.c

---
 board/gateworks/gw_ventana/gsc.c        | 27 +++++++++++++++++++++++++++
 board/gateworks/gw_ventana/gsc.h        |  1 +
 board/gateworks/gw_ventana/gw_ventana.c | 24 ++----------------------
 3 files changed, 30 insertions(+), 22 deletions(-)
board/gateworks/gw_ventana/gsc.c +27 -0
index 718e165..3febd12 100644
@@ -132,6 +132,33 @@ int gsc_info(int verbose)
 	return 0;
 }
 
+/*
+ *  The Gateworks System Controller implements a boot
+ *  watchdog (always enabled) as a workaround for IMX6 boot related
+ *  errata such as:
+ *    ERR005768 - no fix scheduled
+ *    ERR006282 - fixed in silicon r1.2
+ *    ERR007117 - fixed in silicon r1.3
+ *    ERR007220 - fixed in silicon r1.3
+ *    ERR007926 - no fix scheduled
+ *  see http://cache.freescale.com/files/32bit/doc/errata/IMX6DQCE.pdf
+ *
+ * Disable the boot watchdog
+ */
+int gsc_boot_wd_disable(void)
+{
+	u8 reg;
+
+	i2c_set_bus_num(CONFIG_I2C_GSC);
+	if (!gsc_i2c_read(GSC_SC_ADDR, GSC_SC_CTRL1, 1, &reg, 1)) {
+		reg |= (1 << GSC_SC_CTRL1_WDDIS);
+		if (!gsc_i2c_write(GSC_SC_ADDR, GSC_SC_CTRL1, 1, &reg, 1))
+			return 0;
+	}
+	puts("Error: could not disable GSC Watchdog\n");
+	return 1;
+}
+
 #ifdef CONFIG_CMD_GSC
 static int do_gsc_wd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
board/gateworks/gw_ventana/gsc.h +1 -0
index 2d4969e..e0c0ed0 100644
@@ -66,5 +66,6 @@ enum {
 int gsc_i2c_read(uchar chip, uint addr, int alen, uchar *buf, int len);
 int gsc_i2c_write(uchar chip, uint addr, int alen, uchar *buf, int len);
 int gsc_info(int verbose);
+int gsc_boot_wd_disable(void);
 #endif
 
board/gateworks/gw_ventana/gw_ventana.c +2 -22
index 8163d38..8c6f469 100644
@@ -659,7 +659,6 @@ static const struct boot_mode board_boot_modes[] = {
 int misc_init_r(void)
 {
 	struct ventana_board_info *info = &ventana_info;
-	unsigned char reg;
 
 	/* set env vars based on EEPROM data */
 	if (ventana_info.model[0]) {
@@ -740,27 +739,8 @@ int misc_init_r(void)
 	add_board_boot_modes(board_boot_modes);
 #endif
 
-	/*
-	 *  The Gateworks System Controller implements a boot
-	 *  watchdog (always enabled) as a workaround for IMX6 boot related
-	 *  errata such as:
-	 *    ERR005768 - no fix scheduled
-	 *    ERR006282 - fixed in silicon r1.2
-	 *    ERR007117 - fixed in silicon r1.3
-	 *    ERR007220 - fixed in silicon r1.3
-	 *    ERR007926 - no fix scheduled
-	 *  see http://cache.freescale.com/files/32bit/doc/errata/IMX6DQCE.pdf
-	 *
-	 * Disable the boot watchdog and display/clear the timeout flag if set
-	 */
-	i2c_set_bus_num(CONFIG_I2C_GSC);
-	if (!gsc_i2c_read(GSC_SC_ADDR, GSC_SC_CTRL1, 1, &reg, 1)) {
-		reg |= (1 << GSC_SC_CTRL1_WDDIS);
-		if (gsc_i2c_write(GSC_SC_ADDR, GSC_SC_CTRL1, 1, &reg, 1))
-			puts("Error: could not disable GSC Watchdog\n");
-	} else {
-		puts("Error: could not disable GSC Watchdog\n");
-	}
+	/* disable boot watchdog */
+	gsc_boot_wd_disable();
 
 	return 0;
 }
Signature · 1 line
1.9.1
author
#19 lore raw

PATCH 14/19 imx: ventana: detect pmic using i2c probe instead of board model

In reply to Tim Harvey

Avoid requiring board-model and probe pmic by its i2c address. This is in preparation for being able to call pmic_setup() from SPL and not need board type.

---
 board/gateworks/gw_ventana/common.c     | 10 +++++++---
 board/gateworks/gw_ventana/common.h     |  2 +-
 board/gateworks/gw_ventana/gw_ventana.c |  2 +-
 3 files changed, 9 insertions(+), 5 deletions(-)
board/gateworks/gw_ventana/common.c +7 -3
index 45c5b4c..5fa5d6a 100644
@@ -759,13 +759,16 @@ void setup_board_gpio(int board, struct ventana_board_info *info)
 }
 
 /* setup board specific PMIC */
-void setup_pmic(int board)
+void setup_pmic(void)
 {
 	struct pmic *p;
 	u32 reg;
 
+	i2c_set_bus_num(CONFIG_I2C_PMIC);
+
 	/* configure PFUZE100 PMIC */
-	if (board == GW54xx || board == GW54proto) {
+	if (!i2c_probe(CONFIG_POWER_PFUZE100_I2C_ADDR)) {
+		debug("probed PFUZE100 at 0x%x\n", CONFIG_POWER_PFUZE100_I2C_ADDR);
 		power_pfuze100_init(CONFIG_I2C_PMIC);
 		p = pmic_get("PFUZE100");
 		if (p && !pmic_probe(p)) {
@@ -787,7 +790,8 @@ void setup_pmic(int board)
 	}
 
 	/* configure LTC3676 PMIC */
-	else {
+	else if (!i2c_probe(CONFIG_POWER_LTC3676_I2C_ADDR)) {
+		debug("probed LTC3676 at 0x%x\n", CONFIG_POWER_LTC3676_I2C_ADDR);
 		power_ltc3676_init(CONFIG_I2C_PMIC);
 		p = pmic_get("LTC3676_PMIC");
 		if (p && !pmic_probe(p)) {
board/gateworks/gw_ventana/common.h +1 -1
index a303b55..b7c0e96 100644
@@ -89,7 +89,7 @@ void setup_ventana_i2c(void);
 /* configure uart iomux */
 void setup_iomux_uart(void);
 /* conifgure PMIC */
-void setup_pmic(int board);
+void setup_pmic(void);
 /* configure gpio iomux/defaults */
 void setup_iomux_gpio(int board, struct ventana_board_info *);
 /* late setup of GPIO (configuration per baseboard and env) */
board/gateworks/gw_ventana/gw_ventana.c +1 -1
index 8c6f469..22f3b38 100644
@@ -468,7 +468,7 @@ static void setup_display(void)
 /* setup board specific PMIC */
 int power_init_board(void)
 {
-	setup_pmic(board_type);
+	setup_pmic();
 	return 0;
 }
 
Signature · 1 line
1.9.1
author
#20 lore raw

PATCH 15/19 imx: ventana: use common uart and i2c setup functions in SPL

In reply to Tim Harvey

Now that uart and i2c setup functions have been moved to common.c we can use these and remove code duplication.

---
 board/gateworks/gw_ventana/gw_ventana_spl.c | 52 +++--------------------------
 1 file changed, 5 insertions(+), 47 deletions(-)
board/gateworks/gw_ventana/gw_ventana_spl.c +5 -47
index 8fe0cae..82078a0 100644
@@ -6,10 +6,8 @@
  */
 
 #include <common.h>
-#include <i2c.h>
 #include <asm/io.h>
 #include <asm/arch/crm_regs.h>
-#include <asm/arch/iomux.h>
 #include <asm/arch/mx6-ddr.h>
 #include <asm/arch/mx6-pins.h>
 #include <asm/arch/sys_proto.h>
@@ -18,54 +16,14 @@
 #include <asm/imx-common/mxc_i2c.h>
 #include <spl.h>
 
-#include "ventana_eeprom.h"
+#include "gsc.h"
+#include "common.h"
 
 DECLARE_GLOBAL_DATA_PTR;
 
 #define RTT_NOM_120OHM /* use 120ohm Rtt_nom vs 60ohm (lower power) */
-#define I2C_GSC			0
-#define GSC_EEPROM_ADDR		0x51
 #define GSC_EEPROM_DDR_SIZE	0x2B	/* enum (512,1024,2048) MB */
 #define GSC_EEPROM_DDR_WIDTH	0x2D	/* enum (32,64) bit */
-#define I2C_PAD_CTRL  (PAD_CTL_PUS_100K_UP |                    \
-	PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | PAD_CTL_HYS |   \
-	PAD_CTL_ODE | PAD_CTL_SRE_FAST)
-#define PC MUX_PAD_CTRL(I2C_PAD_CTRL)
-#define CONFIG_SYS_I2C_SPEED	100000
-
-/* I2C1: GSC */
-static struct i2c_pads_info mx6q_i2c_pad_info0 = {
-	.scl = {
-		.i2c_mode = MX6Q_PAD_EIM_D21__I2C1_SCL | PC,
-		.gpio_mode = MX6Q_PAD_EIM_D21__GPIO3_IO21 | PC,
-		.gp = IMX_GPIO_NR(3, 21)
-	},
-	.sda = {
-		.i2c_mode = MX6Q_PAD_EIM_D28__I2C1_SDA | PC,
-		.gpio_mode = MX6Q_PAD_EIM_D28__GPIO3_IO28 | PC,
-		.gp = IMX_GPIO_NR(3, 28)
-	}
-};
-static struct i2c_pads_info mx6dl_i2c_pad_info0 = {
-	.scl = {
-		.i2c_mode = MX6DL_PAD_EIM_D21__I2C1_SCL | PC,
-		.gpio_mode = MX6DL_PAD_EIM_D21__GPIO3_IO21 | PC,
-		.gp = IMX_GPIO_NR(3, 21)
-	},
-	.sda = {
-		.i2c_mode = MX6DL_PAD_EIM_D28__I2C1_SDA | PC,
-		.gpio_mode = MX6DL_PAD_EIM_D28__GPIO3_IO28 | PC,
-		.gp = IMX_GPIO_NR(3, 28)
-	}
-};
-
-static void i2c_setup_iomux(void)
-{
-	if (is_cpu_type(MXC_CPU_MX6Q))
-		setup_i2c(0, CONFIG_SYS_I2C_SPEED, 0x7f, &mx6q_i2c_pad_info0);
-	else
-		setup_i2c(0, CONFIG_SYS_I2C_SPEED, 0x7f, &mx6dl_i2c_pad_info0);
-}
 
 /* configure MX6Q/DUAL mmdc DDR io registers */
 struct mx6dq_iomux_ddr_regs mx6dq_ddr_ioregs = {
@@ -540,8 +498,8 @@ void board_init_f(ulong dummy)
 	gpr_init();
 
 	/* iomux and setup of i2c */
-	board_early_init_f();
-	i2c_setup_iomux();
+	setup_iomux_uart();
+	setup_ventana_i2c();
 
 	/* setup GP timer */
 	timer_init();
@@ -550,7 +508,7 @@ void board_init_f(ulong dummy)
 	preloader_console_init();
 
 	/* read/validate EEPROM info to determine board model and SDRAM cfg */
-	board_model = read_eeprom(I2C_GSC, &ventana_info);
+	board_model = read_eeprom(CONFIG_I2C_GSC, &ventana_info);
 
 	/* provide some some default: 32bit 128MB */
 	if (GW_UNKNOWN == board_model) {
Signature · 1 line
1.9.1
author
#21 lore raw

PATCH 16/19 imx: ventana: add gpio setup to SPL

In reply to Tim Harvey

If the SPL is to be used for Falcon mode then we need to make sure it configures basic GPIO (iomux, padconf, and default output levels).

---
 board/gateworks/gw_ventana/gw_ventana_spl.c | 3 +++
 1 file changed, 3 insertions(+)
board/gateworks/gw_ventana/gw_ventana_spl.c +3 -0
index 82078a0..cde04cf 100644
@@ -510,6 +510,9 @@ void board_init_f(ulong dummy)
 	/* read/validate EEPROM info to determine board model and SDRAM cfg */
 	board_model = read_eeprom(CONFIG_I2C_GSC, &ventana_info);
 
+	/* configure model-specific gpio */
+	setup_iomux_gpio(board_model, &ventana_info);
+
 	/* provide some some default: 32bit 128MB */
 	if (GW_UNKNOWN == board_model) {
 		ventana_info.sdram_width = 2;
Signature · 1 line
1.9.1
author
#22 lore raw

PATCH 17/19 imx: ventana: add pmic_setup to SPL

In reply to Tim Harvey

We need to do any PMIC setup in the SPL if we are to bypass U-Boot for falcon mode.

---
 board/gateworks/gw_ventana/gw_ventana_spl.c | 3 +++
 include/configs/gw_ventana.h                | 1 +
 2 files changed, 4 insertions(+)
board/gateworks/gw_ventana/gw_ventana_spl.c +3 -0
index cde04cf..1873d99 100644
@@ -551,6 +551,9 @@ void spl_board_init(void)
 	default:
 		puts("Unknown boot device\n");
 	}
+
+	/* PMIC init */
+	setup_pmic();
 }
 
 void reset_cpu(ulong addr)
include/configs/gw_ventana.h +1 -0
index c61fbb9..ccf01e2 100644
@@ -13,6 +13,7 @@
 #define CONFIG_SPL_BOARD_INIT
 #define CONFIG_SPL_NAND_SUPPORT
 #define CONFIG_SPL_MMC_SUPPORT
+#define CONFIG_SPL_POWER_SUPPORT
 /* Location on MMC to read U-Boot from */
 #define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR 138 /* 69KB */
 /* Location in NAND to read U-Boot from */
Signature · 1 line
1.9.1
author
#23 lore raw

PATCH 18/19 imx: ventana: add GSC boot watchdog disable to SPL

In reply to Tim Harvey

If the SPL is to be used for Falcon mode then we need to make sure the SPL disable the GSC boot watchdog.

---
 board/gateworks/gw_ventana/gw_ventana_spl.c | 3 +++
 1 file changed, 3 insertions(+)
board/gateworks/gw_ventana/gw_ventana_spl.c +3 -0
index 1873d99..0d8ccb6 100644
@@ -527,6 +527,9 @@ void board_init_f(ulong dummy)
 	/* Clear the BSS. */
 	memset(__bss_start, 0, __bss_end - __bss_start);
 
+	/* disable boot watchdog */
+	gsc_boot_wd_disable();
+
 	/* load/boot image from boot device */
 	board_init_r(NULL, 0);
 }
Signature · 1 line
1.9.1
author
#24 lore raw

PATCH 19/19 imx: ventana: config: enable Falcon mode

In reply to Tim Harvey

Falcon mode entails the SPL booting the OS directly instead of U-Boot.

---
 board/gateworks/gw_ventana/gw_ventana_spl.c | 20 ++++++++++++++++++++
 include/configs/gw_ventana.h                | 16 ++++++++++++++++
 2 files changed, 36 insertions(+)
board/gateworks/gw_ventana/gw_ventana_spl.c +20 -0
index 0d8ccb6..73b5176 100644
@@ -14,6 +14,7 @@
 #include <asm/imx-common/boot_mode.h>
 #include <asm/imx-common/iomux-v3.h>
 #include <asm/imx-common/mxc_i2c.h>
+#include <environment.h>
 #include <spl.h>
 
 #include "gsc.h"
@@ -559,6 +560,25 @@ void spl_board_init(void)
 	setup_pmic();
 }
 
+#ifdef CONFIG_SPL_OS_BOOT
+/* return 1 if we wish to boot to uboot vs os (falcon mode) */
+int spl_start_uboot(void)
+{
+	int ret = 1;
+
+	debug("%s\n", __func__);
+#ifdef CONFIG_SPL_ENV_SUPPORT
+	env_init();
+	env_relocate_spec();
+	debug("boot_os=%s\n", getenv("boot_os"));
+	if (getenv_yesno("boot_os") == 1)
+		ret = 0;
+#endif
+	debug("%s booting %s\n", __func__, ret ? "uboot" : "linux");
+	return ret;
+}
+#endif
+
 void reset_cpu(ulong addr)
 {
 }
include/configs/gw_ventana.h +16 -0
index ccf01e2..87cb32f 100644
@@ -19,6 +19,22 @@
 /* Location in NAND to read U-Boot from */
 #define CONFIG_SYS_NAND_U_BOOT_OFFS     (14 * SZ_1M)
 
+/* Falcon Mode */
+#define CONFIG_CMD_SPL
+#define CONFIG_SPL_OS_BOOT
+#define CONFIG_SPL_ENV_SUPPORT
+#define CONFIG_SYS_SPL_ARGS_ADDR	0x18000000
+#define CONFIG_CMD_SPL_WRITE_SIZE	(128 * SZ_1K)
+
+/* Falcon Mode - NAND support: args at 17MB kernel at 18MB */
+#define CONFIG_CMD_SPL_NAND_OFS		(17 * SZ_1M)
+#define CONFIG_SYS_NAND_SPL_KERNEL_OFFS	(18 * SZ_1M)
+
+/* Falcon Mode - MMC support: args at 1MB kernel at 2MB */
+#define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR	0x800	/* 1MB */
+#define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS	(CONFIG_CMD_SPL_WRITE_SIZE / 512)
+#define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR	0x1000	/* 2MB */
+
 #include "imx6_spl.h"                  /* common IMX6 SPL configuration */
 #include "mx6_common.h"
 #define CONFIG_MX6
Signature · 1 line
1.9.1
#25 lore raw

PATCH 19/19 imx: ventana: config: enable Falcon mode

Hi Tim,

Quoted 1 line · Tim Harvey

Falcon mode entails the SPL booting the OS directly instead of U-Boot.

I would like to give this a try, but I am not sure where the dtb should be placed in the SD card.

Or are you combining the dtb and zImage into a single binary?

Do you have a small README that shows how the user should use Falcon mode?

Thanks!

author
#26 lore raw

PATCH 19/19 imx: ventana: config: enable Falcon mode

Quoted 5 lines · Fabio Estevam

Hi Tim,

Quoted 1 line · Tim Harvey

Falcon mode entails the SPL booting the OS directly instead of U-Boot.

Quoted 8 lines

I would like to give this a try, but I am not sure where the dtb should be placed in the SD card.

Or are you combining the dtb and zImage into a single binary?

Do you have a small README that shows how the user should use Falcon mode?

Thanks!

Fabio,

I will be posting a README in the next day or so to document Falcon mode usage on the Gateworks Ventana boards. In general the documentation will be the same for any board using it but I'll provide some detail about where things are stored in flash/mmc and what #defines control that.

As a general rule though, when using Falcon mode for a device-tree kernel the dtb must get loaded and processed via the 'spl export fdt' command which you provide the kernel and dtb address in RAM you've loaded them to because U-Boot will tweak the dtb then allow you to store it back.

This is documented pretty well currently in doc/README.falcon. You have to understand that the steps normally taken by U-Boot will be skipped in Falcon mode as you go straight from SPL to OS. In the general case this means your SPL must do anything that U-Boot typically does for fixups including GPIO configuration (pinmux, padctl, output/direction) for things the kernel may not be supporting (hence my recent patches that move or replicate some of Ventana U-Boot capability in the SPL). For the Linux OS case the SPL must do what the bootm U-Boot command would have done which is to load the dtb, make adjustments (enet macs, mtdparts, memsize, console args, anything in ft_board_setup(), etc) and it does this by using the spl export command which goes through all the steps that bootm does 'except' for jumping to the kernel. Then you take the mem area that spl export left the 'args' typically passed to the kernel and store that to your non-volatile storage so that when the SPL boots in 'OS mode' it loads the kernel, loads the pre-prepared args and jumps.

Note that Falcon mode also requires you have a function in the SPL that decides to boot U-Boot or to skip it and boot the OS directly. In the Gateworks Ventana case I didn't want to make this completely dependent on a GPIO/Button because this bootloader supports about 8 different PCB designs in the Ventana family - some of which do not have buttons or may not have buttons loaded on the board. Instead, I pulled env support into the SPL and use 'boot_os' env var to decide as other boards do (see spl_start_uboot()). I also have the Ventana config build in support for both NAND and MMC so that in general the same SPL/U-Boot can be used on Ventana boards with or without NAND. U-Boot however currently does not support multiple environment backing stores, so only NAND env is defined meaning Falcon mode for Ventana on a nand-less board won't really work right as it will try to read env from NAND. I have a downstream patch that adds multiple env support which reads env from whatever the boot device was, however I have not posted this patch yet and I don't expect it will be accepted because it was desired for me to re-write env support instead which was a large undertaking I don't have time for. Until then, mainline U-Boot only supports Falcon mode on NAND for Ventana (which is the vast majority of the Ventana boards).

Regards,

Tim

#27 lore raw

PATCH 19/19 imx: ventana: config: enable Falcon mode

Hi Tim,

Quoted 43 lines · Tim Harvey

Fabio,

I will be posting a README in the next day or so to document Falcon mode usage on the Gateworks Ventana boards. In general the documentation will be the same for any board using it but I'll provide some detail about where things are stored in flash/mmc and what #defines control that.

As a general rule though, when using Falcon mode for a device-tree kernel the dtb must get loaded and processed via the 'spl export fdt' command which you provide the kernel and dtb address in RAM you've loaded them to because U-Boot will tweak the dtb then allow you to store it back.

This is documented pretty well currently in doc/README.falcon. You have to understand that the steps normally taken by U-Boot will be skipped in Falcon mode as you go straight from SPL to OS. In the general case this means your SPL must do anything that U-Boot typically does for fixups including GPIO configuration (pinmux, padctl, output/direction) for things the kernel may not be supporting (hence my recent patches that move or replicate some of Ventana U-Boot capability in the SPL). For the Linux OS case the SPL must do what the bootm U-Boot command would have done which is to load the dtb, make adjustments (enet macs, mtdparts, memsize, console args, anything in ft_board_setup(), etc) and it does this by using the spl export command which goes through all the steps that bootm does 'except' for jumping to the kernel. Then you take the mem area that spl export left the 'args' typically passed to the kernel and store that to your non-volatile storage so that when the SPL boots in 'OS mode' it loads the kernel, loads the pre-prepared args and jumps.

Note that Falcon mode also requires you have a function in the SPL that decides to boot U-Boot or to skip it and boot the OS directly. In the Gateworks Ventana case I didn't want to make this completely dependent on a GPIO/Button because this bootloader supports about 8 different PCB designs in the Ventana family - some of which do not have buttons or may not have buttons loaded on the board. Instead, I pulled env support into the SPL and use 'boot_os' env var to decide as other boards do (see spl_start_uboot()). I also have the Ventana config build in support for both NAND and MMC so that in general the same SPL/U-Boot can be used on Ventana boards with or without NAND. U-Boot however currently does not support multiple environment backing stores, so only NAND env is defined meaning Falcon mode for Ventana on

Quoted 8 lines

a nand-less board won't really work right as it will try to read env from NAND. I have a downstream patch that adds multiple env support which reads env from whatever the boot device was, however I have not posted this patch yet and I don't expect it will be accepted because it was desired for me to re-write env support instead which was a large undertaking I don't have time for. Until then, mainline U-Boot only supports Falcon mode on NAND for Ventana (which is the vast majority of the Ventana boards).

Thanks for your work on this and for your detailed reply! I will give Falcon mode a try.

Thanks,

Fabio Estevam

#28 lore raw

PATCH 19/19 imx: ventana: config: enable Falcon mode

In reply to Tim Harvey

Hi Tim,

Quoted 8 lines · Tim Harvey

Note that Falcon mode also requires you have a function in the SPL that decides to boot U-Boot or to skip it and boot the OS directly. In the Gateworks Ventana case I didn't want to make this completely dependent on a GPIO/Button because this bootloader supports about 8 different PCB designs in the Ventana family - some of which do not have buttons or may not have buttons loaded on the board. Instead, I pulled env support into the SPL and use 'boot_os' env var to decide as other boards do (see spl_start_uboot()).

Anyway, this can be dangerous. The reason having a GPIO (or any trigger from external, for example a received char from the console) is to switch to U-Boot if the kernel does not work (but the kernel image is not corrupted), mainly go to panic, and the board can be restored into U-Boot.

If you use an environment variable and the environment is put into the NAND (with MMC you can change the card), there is nothing you can do anymore. Board tries to boot until next panic, and then again and again.

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#29 lore raw

PATCH 19/19 imx: ventana: config: enable Falcon mode

Hi Stefano,

Quoted 17 lines · Stefano Babic
Quoted 8 lines · Tim Harvey

Note that Falcon mode also requires you have a function in the SPL that decides to boot U-Boot or to skip it and boot the OS directly. In the Gateworks Ventana case I didn't want to make this completely dependent on a GPIO/Button because this bootloader supports about 8 different PCB designs in the Ventana family - some of which do not have buttons or may not have buttons loaded on the board. Instead, I pulled env support into the SPL and use 'boot_os' env var to decide as other boards do (see spl_start_uboot()).

Anyway, this can be dangerous. The reason having a GPIO (or any trigger from external, for example a received char from the console) is to switch to U-Boot if the kernel does not work (but the kernel image is not corrupted), mainly go to panic, and the board can be restored into U-Boot.

Quoted 3 lines

If you use an environment variable and the environment is put into the NAND (with MMC you can change the card), there is nothing you can do anymore. Board tries to boot until next panic, and then again and again.

Some boards just don't have such a means as a push button or jumper to select the Falcon mode. That's why I introduced this environment variable dependent way to select Falcon mode quite some time ago for a PPC based board.

You are correct. If something goes completely wrong, and the board tries to boot into the OS with a non-working OS installed, then you are doomed. JTAG comes in handy then as I have experienced myself. ;)

But this is usually only while developing this feature and kernel. Once its tested and mature, this really works.

Again, its a trade-off since another, better method to switch between U-Boot- and OS- booting is not available.

Thanks,
Stefan

#30 lore raw

PATCH 19/19 imx: ventana: config: enable Falcon mode

Hi Stefan,

Quoted 4 lines · Stefan Roese
Quoted 3 lines

If you use an environment variable and the environment is put into the NAND (with MMC you can change the card), there is nothing you can do anymore. Board tries to boot until next panic, and then again and again.

Quoted 8 lines

Some boards just don't have such a means as a push button or jumper to select the Falcon mode. That's why I introduced this environment variable dependent way to select Falcon mode quite some time ago for a PPC based board.

You are correct. If something goes completely wrong, and the board tries to boot into the OS with a non-working OS installed, then you are doomed. JTAG comes in handy then as I have experienced myself. ;)

Right

Quoted 3 lines

But this is usually only while developing this feature and kernel. Once its tested and mature, this really works.

Yes, when the product is delivered to the customer, this does not matter. But we should be aware of it, and know that something can go wrong.

Quoted 3 lines

Again, its a trade-off since another, better method to switch between U-Boot- and OS- booting is not available.

Exactly - anyway, patch is applied and I run build again on imx board. Repository will be updated soon.

Best regards,
Stefano

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
author
#31 lore raw

PATCH 19/19 imx: ventana: config: enable Falcon mode

In reply to Stefan Roese
Quoted 36 lines · Stefan Roese

Hi Stefano,

Quoted 19 lines · Stefano Babic
Quoted 8 lines · Tim Harvey

Note that Falcon mode also requires you have a function in the SPL that decides to boot U-Boot or to skip it and boot the OS directly. In the Gateworks Ventana case I didn't want to make this completely dependent on a GPIO/Button because this bootloader supports about 8 different PCB designs in the Ventana family - some of which do not have buttons or may not have buttons loaded on the board. Instead, I pulled env support into the SPL and use 'boot_os' env var to decide as other boards do (see spl_start_uboot()).

Anyway, this can be dangerous. The reason having a GPIO (or any trigger from external, for example a received char from the console) is to switch to U-Boot if the kernel does not work (but the kernel image is not corrupted), mainly go to panic, and the board can be restored into U-Boot.

Quoted 3 lines

If you use an environment variable and the environment is put into the NAND (with MMC you can change the card), there is nothing you can do anymore. Board tries to boot until next panic, and then again and again.

Some boards just don't have such a means as a push button or jumper to select the Falcon mode. That's why I introduced this environment variable dependent way to select Falcon mode quite some time ago for a PPC based board.

You are correct. If something goes completely wrong, and the board tries to boot into the OS with a non-working OS installed, then you are doomed. JTAG comes in handy then as I have experienced myself. ;)

Quoted 9 lines

But this is usually only while developing this feature and kernel. Once its tested and mature, this really works.

Again, its a trade-off since another, better method to switch between U-Boot- and OS- booting is not available.

Thanks,
Stefan

Agreed - this is exactly why I decided (at cost) to use an env variable - not all of our boards have a gpio that makes sense and I am am focusing on flexibility.

Tim

#32 lore raw

cover imx: ventana: misc updates

In reply to Tim Harvey

Hi Tim,

Quoted 50 lines · Tim Harvey

This collection of patches comprises a set of various updates I've been on for Ventana.

In summary:
- enable driver model
- enable gpio command
- enable dm-serial
- enable thermal support
- fixup for GW522x PCI enumeration
- split out common code shared between SPL an U-Boot
- pull down various init code to the SPL for use in Falcon mode
- enable Falcon mode (based on env var)

The enabling of Falcon mode is dependent on a patch I submitted earlier allowing nand env in spl [1].

Currently Falcon mode is configured for NAND boot. I plan on re-working a pending patchset I have that allows dynamic env support (use mmc or nand env depending on boot device) but I still need to re-work that using driver-model so it will come later.

I will send a followup patch with README updates explaining our use of Falcon mode if everything here looks good.

Tim

[1] https://patchwork.ozlabs.org/patch/470191/

Tim Harvey (19):
imx: ventana: set dtype env var to boot media
imx: ventana: display SPL boot device
imx: ventana: config: enable gpio command
imx: ventana: config: enable driver model
imx: ventana: register gpio's with gpio_request
imx: ventana: enable DM_SERIAL
imx: ventana: config: enable Thermal support
imx: ventana: config: use MMC SPL RAW support
imx: ventana: (cosmetic) clean up size defines for improved
readability
imx: ventana: fix pcie reset for GW522x
imx: ventana: default msata/pci mux to pci before PCI enumeration
imx: ventana: split out common functions between SPL and uboot
imx: ventana: move GSC boot watchdog disable function to gsc.c
imx: ventana: detect pmic using i2c probe instead of board model
imx: ventana: use common uart and i2c setup functions in SPL
imx: ventana: add gpio setup to SPL
imx: ventana: add pmic_setup to SPL
imx: ventana: add GSC boot watchdog disable to SPL
imx: ventana: config: enable Falcon mode

Quoted 12 lines
 board/gateworks/gw_ventana/Makefile         |   2 +-
 board/gateworks/gw_ventana/common.c         | 827 +++++++++++++++++++++++++
 board/gateworks/gw_ventana/common.h         |  98 +++
 board/gateworks/gw_ventana/gsc.c            |  27 +
 board/gateworks/gw_ventana/gsc.h            |   1 +
 board/gateworks/gw_ventana/gw_ventana.c     | 911 ++--------------------------
 board/gateworks/gw_ventana/gw_ventana_spl.c | 103 ++--
 include/configs/gw_ventana.h                |  67 +-
 8 files changed, 1102 insertions(+), 934 deletions(-)
 create mode 100644 board/gateworks/gw_ventana/common.c
 create mode 100644 board/gateworks/gw_ventana/common.h

Patches 1-7, 10-16, 18 applied to u-boot-imx, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
author
#33 lore raw

cover imx: ventana: misc updates

Quoted 66 lines · Stefano Babic

Hi Tim,

Quoted 50 lines · Tim Harvey

This collection of patches comprises a set of various updates I've been on for Ventana.

In summary:
- enable driver model
- enable gpio command
- enable dm-serial
- enable thermal support
- fixup for GW522x PCI enumeration
- split out common code shared between SPL an U-Boot
- pull down various init code to the SPL for use in Falcon mode
- enable Falcon mode (based on env var)

The enabling of Falcon mode is dependent on a patch I submitted earlier allowing nand env in spl [1].

Currently Falcon mode is configured for NAND boot. I plan on re-working a pending patchset I have that allows dynamic env support (use mmc or nand env depending on boot device) but I still need to re-work that using driver-model so it will come later.

I will send a followup patch with README updates explaining our use of Falcon mode if everything here looks good.

Tim

[1] https://patchwork.ozlabs.org/patch/470191/

Tim Harvey (19):
imx: ventana: set dtype env var to boot media
imx: ventana: display SPL boot device
imx: ventana: config: enable gpio command
imx: ventana: config: enable driver model
imx: ventana: register gpio's with gpio_request
imx: ventana: enable DM_SERIAL
imx: ventana: config: enable Thermal support
imx: ventana: config: use MMC SPL RAW support
imx: ventana: (cosmetic) clean up size defines for improved
readability
imx: ventana: fix pcie reset for GW522x
imx: ventana: default msata/pci mux to pci before PCI enumeration
imx: ventana: split out common functions between SPL and uboot
imx: ventana: move GSC boot watchdog disable function to gsc.c
imx: ventana: detect pmic using i2c probe instead of board model
imx: ventana: use common uart and i2c setup functions in SPL
imx: ventana: add gpio setup to SPL
imx: ventana: add pmic_setup to SPL
imx: ventana: add GSC boot watchdog disable to SPL
imx: ventana: config: enable Falcon mode

Quoted 12 lines
 board/gateworks/gw_ventana/Makefile         |   2 +-
 board/gateworks/gw_ventana/common.c         | 827 +++++++++++++++++++++++++
 board/gateworks/gw_ventana/common.h         |  98 +++
 board/gateworks/gw_ventana/gsc.c            |  27 +
 board/gateworks/gw_ventana/gsc.h            |   1 +
 board/gateworks/gw_ventana/gw_ventana.c     | 911 ++--------------------------
 board/gateworks/gw_ventana/gw_ventana_spl.c | 103 ++--
 include/configs/gw_ventana.h                |  67 +-
 8 files changed, 1102 insertions(+), 934 deletions(-)
 create mode 100644 board/gateworks/gw_ventana/common.c
 create mode 100644 board/gateworks/gw_ventana/common.h
Quoted 5 lines

Patches 1-7, 10-16, 18 applied to u-boot-imx, thanks !

Best regards,
Stefano Babic

Stefano,

Thanks - I just posted a v2 of patch 8 and a rebased 9 and 17 (assuming that is why you skipped those two).

You were right to hold off on 19 as it will fail to compile until 'env_nand: use nand_spl_load_image for readenv if SPL' [1] is accepted which I sent to Scott as he's the nand maintainer - he's given a thumbs up but may be waiting for additional feedback (or perhaps waiting on my attempted simplification of readenv which I've about lost interest on as its just a simplification and apparently I don't understand the args to nand_read_skip_bad).

Tim

[1] - https://patchwork.ozlabs.org/patch/472491/

#34 lore raw

cover imx: ventana: misc updates

Hi Tim,

Quoted 8 lines · Tim Harvey
Quoted 7 lines
Quoted 1 line

Patches 1-7, 10-16, 18 applied to u-boot-imx, thanks !

Best regards,
Stefano Babic

Quoted 7 lines

Stefano,

Thanks - I just posted a v2 of patch 8 and a rebased 9 and 17 (assuming that is why you skipped those two).

You were right to hold off on 19 as it will fail to compile until 'env_nand: use nand_spl_load_image for readenv if SPL' [1] is accepted

Exactly : it depends on that patch. But patch is ok, and it is the first example for an i.MX6 using Falcon Boot. On my site, it is ready to be applied.

Quoted 7 lines

which I sent to Scott as he's the nand maintainer - he's given a thumbs up but may be waiting for additional feedback (or perhaps waiting on my attempted simplification of readenv which I've about lost interest on as its just a simplification and apparently I don't understand the args to nand_read_skip_bad).

[1] - https://patchwork.ozlabs.org/patch/472491/

Maybe we are confused. [1] is in the common area more as related to MTD, that is Tom's (I put him in CC:).

Best regards,
Stefano

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#35 lore raw

cover imx: ventana: misc updates

Quoted 8 lines · Stefano Babic
Quoted 3 lines · Tim Harvey
Quoted 1 line

Patches 1-7, 10-16, 18 applied to u-boot-imx, thanks !

You were right to hold off on 19 as it will fail to compile until 'env_nand: use nand_spl_load_image for readenv if SPL' [1] is accepted

Exactly : it depends on that patch. But patch is ok, and it is the first example for an i.MX6 using Falcon Boot. On my site, it is ready to be applied.

I would prefer if both went through i.MX tree.

Signature · 3 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
#36 lore raw

cover imx: ventana: misc updates

Quoted 11 lines · Otavio Salvador
Quoted 8 lines · Stefano Babic
Quoted 3 lines · Tim Harvey
Quoted 1 line

Patches 1-7, 10-16, 18 applied to u-boot-imx, thanks !

You were right to hold off on 19 as it will fail to compile until 'env_nand: use nand_spl_load_image for readenv if SPL' [1] is accepted

Exactly : it depends on that patch. But patch is ok, and it is the first example for an i.MX6 using Falcon Boot. On my site, it is ready to be applied.

I would prefer if both went through i.MX tree.

Scott ack'd it, I'm fine with it coming via u-boot-imx.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150521/a16970df/attachment.sig>
#37 lore raw

cover imx: ventana: misc updates

Quoted 7 lines · Tom Rini
Quoted 6 lines · Otavio Salvador
Quoted 5 lines · Stefano Babic
Quoted 3 lines · Tim Harvey
Quoted 1 line

Patches 1-7, 10-16, 18 applied to u-boot-imx, thanks !

You were right to hold off on 19 as it will fail to compile until 'env_nand: use nand_spl_load_image for readenv if SPL' [1] is accepted

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

Exactly : it depends on that patch. But patch is ok, and it is the first example for an i.MX6 using Falcon Boot. On my site, it is ready to be applied.

I would prefer if both went through i.MX tree.

Scott ack'd it, I'm fine with it coming via u-boot-imx.

Thanks. I will apply the Falcon's patch, too.

Best regards,
Stefano

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
author
#38 lore raw

PATCH v2 8/19 imx: ventana: config: use MMC SPL RAW support

In reply to Tim Harvey

Switch to MMC RAW support for SPL. We will place the uboot.img at 69KB.

---
v2: remove unnecessary CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR define

---
 include/configs/gw_ventana.h | 4 ----
 1 file changed, 4 deletions(-)
include/configs/gw_ventana.h +0 -4
index b20b338..dd7188b 100644
@@ -11,10 +11,6 @@
 #define CONFIG_SPL_BOARD_INIT
 #define CONFIG_SPL_NAND_SUPPORT
 #define CONFIG_SPL_MMC_SUPPORT
-#define CONFIG_SPL_FAT_SUPPORT
-/*
-#define CONFIG_SPL_SATA_SUPPORT
-*/
 /* Location in NAND to read U-Boot from */
 #define CONFIG_SYS_NAND_U_BOOT_OFFS     (14 * 1024 * 1024)
 
Signature · 1 line
1.9.1
#39 lore raw

PATCH v2 8/19 imx: ventana: config: use MMC SPL RAW support

Quoted 16 lines · Tim Harvey

Switch to MMC RAW support for SPL. We will place the uboot.img at 69KB.

---
v2: remove unnecessary CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR define

---
 include/configs/gw_ventana.h | 4 ----
 1 file changed, 4 deletions(-)
include/configs/gw_ventana.h +0 -0
index b20b338..dd7188b 100644

include/configs/gw_ventana.h line 16

Quoted 10 lines
include/configs/gw_ventana.h +0 -4
@@ -11,10 +11,6 @@
 #define CONFIG_SPL_BOARD_INIT
 #define CONFIG_SPL_NAND_SUPPORT
 #define CONFIG_SPL_MMC_SUPPORT
-#define CONFIG_SPL_FAT_SUPPORT
-/*
-#define CONFIG_SPL_SATA_SUPPORT
-*/
 /* Location in NAND to read U-Boot from */
 #define CONFIG_SYS_NAND_U_BOOT_OFFS     (14 * 1024 * 1024)
 

Applied to u-boot-imx, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
author
#40 lore raw

PATCH v2 9/19 imx: ventana: (cosmetic) clean up size defines for improved readability

In reply to Tim Harvey

Use the SZ_1M and SZ_1K macros from linuz/sizes.h for improved readability

---
v2: no changes - rebased

---
 include/configs/gw_ventana.h | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)
include/configs/gw_ventana.h +12 -10
index dd7188b..663e9c5 100644
@@ -7,12 +7,14 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+#include <linux/sizes.h>
+
 /* SPL */
 #define CONFIG_SPL_BOARD_INIT
 #define CONFIG_SPL_NAND_SUPPORT
 #define CONFIG_SPL_MMC_SUPPORT
 /* Location in NAND to read U-Boot from */
-#define CONFIG_SYS_NAND_U_BOOT_OFFS     (14 * 1024 * 1024)
+#define CONFIG_SYS_NAND_U_BOOT_OFFS     (14 * SZ_1M)
 
 #include "imx6_spl.h"                  /* common IMX6 SPL configuration */
 #include "mx6_common.h"
@@ -35,7 +37,7 @@
 #define CONFIG_SYS_GENERIC_BOARD
 
 /* Size of malloc() pool */
-#define CONFIG_SYS_MALLOC_LEN		(10 * 1024 * 1024)
+#define CONFIG_SYS_MALLOC_LEN		(10 * SZ_1M)
 
 /* Init Functions */
 #define CONFIG_BOARD_EARLY_INIT_F
@@ -308,19 +310,19 @@
 #define CONFIG_ENV_IS_IN_NAND
 #endif
 #if defined(CONFIG_ENV_IS_IN_MMC)
-  #define CONFIG_ENV_OFFSET              (6 * 64 * 1024)
-  #define CONFIG_ENV_SIZE                (8 * 1024)
+  #define CONFIG_ENV_OFFSET              (384 * SZ_1K)
+  #define CONFIG_ENV_SIZE                (8 * SZ_1K)
   #define CONFIG_SYS_MMC_ENV_DEV         0
 #elif defined(CONFIG_ENV_IS_IN_NAND)
-  #define CONFIG_ENV_OFFSET              (16 << 20)
-  #define CONFIG_ENV_SECT_SIZE           (128 << 10)
+  #define CONFIG_ENV_OFFSET              (16 * SZ_1M)
+  #define CONFIG_ENV_SECT_SIZE           (128 * SZ_1K)
   #define CONFIG_ENV_SIZE                CONFIG_ENV_SECT_SIZE
-  #define CONFIG_ENV_OFFSET_REDUND       (CONFIG_ENV_OFFSET + (512 << 10))
+  #define CONFIG_ENV_OFFSET_REDUND       (CONFIG_ENV_OFFSET + (512 * SZ_1K))
   #define CONFIG_ENV_SIZE_REDUND         CONFIG_ENV_SIZE
 #elif defined(CONFIG_ENV_IS_IN_SPI_FLASH)
-  #define CONFIG_ENV_OFFSET              (512 * 1024)
-  #define CONFIG_ENV_SECT_SIZE           (64 * 1024)
-  #define CONFIG_ENV_SIZE                (8 * 1024)
+  #define CONFIG_ENV_OFFSET		(512 * SZ_1K)
+  #define CONFIG_ENV_SECT_SIZE		(64 * SZ_1K)
+  #define CONFIG_ENV_SIZE		(8 * SZ_1K)
   #define CONFIG_ENV_SPI_BUS             CONFIG_SF_DEFAULT_BUS
   #define CONFIG_ENV_SPI_CS              CONFIG_SF_DEFAULT_CS
   #define CONFIG_ENV_SPI_MODE            CONFIG_SF_DEFAULT_MODE
Signature · 1 line
1.9.1
#41 lore raw

PATCH v2 9/19 imx: ventana: (cosmetic) clean up size defines for improved readability

Quoted 4 lines · Tim Harvey

Use the SZ_1M and SZ_1K macros from linuz/sizes.h for improved readability

---

Applied to u-boot-imx, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
author
#42 lore raw

PATCH v2 17/19 imx: ventana: add pmic_setup to SPL

In reply to Tim Harvey

We need to do any PMIC setup in the SPL if we are to bypass U-Boot for falcon mode.

---
v2: rebased

---
 board/gateworks/gw_ventana/gw_ventana_spl.c | 3 +++
 include/configs/gw_ventana.h                | 1 +
 2 files changed, 4 insertions(+)
board/gateworks/gw_ventana/gw_ventana_spl.c +3 -0
index 79cb594..2bec428 100644
@@ -551,6 +551,9 @@ void spl_board_init(void)
 	default:
 		puts("Unknown boot device\n");
 	}
+
+	/* PMIC init */
+	setup_pmic();
 }
 
 void reset_cpu(ulong addr)
include/configs/gw_ventana.h +1 -0
index 663e9c5..533cbc3 100644
@@ -13,6 +13,7 @@
 #define CONFIG_SPL_BOARD_INIT
 #define CONFIG_SPL_NAND_SUPPORT
 #define CONFIG_SPL_MMC_SUPPORT
+#define CONFIG_SPL_POWER_SUPPORT
 /* Location in NAND to read U-Boot from */
 #define CONFIG_SYS_NAND_U_BOOT_OFFS     (14 * SZ_1M)
 
Signature · 1 line
1.9.1
#43 lore raw

PATCH v2 17/19 imx: ventana: add pmic_setup to SPL

Quoted 7 lines · Tim Harvey

We need to do any PMIC setup in the SPL if we are to bypass U-Boot for falcon mode.

---
v2: rebased
---

Applied to u-boot-imx, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================