summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Harvey <tharvey@gateworks.com>2016-07-15 07:14:25 -0700
committerStefano Babic <sbabic@denx.de>2016-07-28 13:27:18 +0200
commit5911c0924f403561d8f1f2f437fd9a6efc5ad82a (patch)
tree5a1c3b820152a2d3ccd65a1ae8948950687069cb
parente86b7adfa3cfe8d87ecb67bc0f02789c51293f51 (diff)
imx: ventana: make hwconfig initialize based on board configuration
The hwconfig env var allows user to control hardware specific configuration of board specific features but not all Ventana boards have the same features. We will use the magic default value of "_UNKNOWN_" to signify that the bootloader should create this based on detected board model. Signed-off-by: Tim Harvey <tharvey@gateworks.com>
-rw-r--r--board/gateworks/gw_ventana/gw_ventana.c16
-rw-r--r--include/configs/gw_ventana.h5
2 files changed, 16 insertions, 5 deletions
diff --git a/board/gateworks/gw_ventana/gw_ventana.c b/board/gateworks/gw_ventana/gw_ventana.c
index 930cec8c5a7..588ea85b9da 100644
--- a/board/gateworks/gw_ventana/gw_ventana.c
+++ b/board/gateworks/gw_ventana/gw_ventana.c
@@ -700,13 +700,14 @@ static const struct boot_mode board_boot_modes[] = {
int misc_init_r(void)
{
struct ventana_board_info *info = &ventana_info;
+ char buf[256];
+ int i;
/* set env vars based on EEPROM data */
if (ventana_info.model[0]) {
char str[16], fdt[36];
char *p;
const char *cputype = "";
- int i;
/*
* FDT name will be prefixed with CPU type. Three versions
@@ -769,6 +770,19 @@ int misc_init_r(void)
setenv("mem_mb", str);
}
+ /* Set a non-initialized hwconfig based on board configuration */
+ if (!strcmp(getenv("hwconfig"), "_UNKNOWN_")) {
+ sprintf(buf, "hwconfig=");
+ if (gpio_cfg[board_type].rs232_en)
+ strcat(buf, "rs232;");
+ for (i = 0; i < gpio_cfg[board_type].dio_num; i++) {
+ char buf1[32];
+ sprintf(buf1, "dio%d:mode=gpio;", i);
+ if (strlen(buf) + strlen(buf1) < sizeof(buf))
+ strcat(buf, buf1);
+ }
+ setenv("hwconfig", buf);
+ }
/* setup baseboard specific GPIO based on board and env */
setup_board_gpio(board_type, info);
diff --git a/include/configs/gw_ventana.h b/include/configs/gw_ventana.h
index 343f3c56bc3..1bd13fe6de2 100644
--- a/include/configs/gw_ventana.h
+++ b/include/configs/gw_ventana.h
@@ -271,16 +271,13 @@
/* Environment */
#define CONFIG_IPADDR 192.168.1.1
#define CONFIG_SERVERIP 192.168.1.146
-#define HWCONFIG_DEFAULT \
- "hwconfig=rs232;" \
- "dio0:mode=gpio;dio1:mode=gpio;dio2:mode=gpio;dio3:mode=gpio\0" \
#define CONFIG_EXTRA_ENV_SETTINGS_COMMON \
"pcidisable=1\0" \
"usb_pgood_delay=2000\0" \
"console=ttymxc1\0" \
"bootdevs=usb mmc sata flash\0" \
- HWCONFIG_DEFAULT \
+ "hwconfig=_UNKNOWN_\0" \
"video=\0" \
\
"mtdparts=" MTDPARTS_DEFAULT "\0" \