diff options
author | Fabio Estevam <fabio.estevam@freescale.com> | 2015-04-25 18:47:19 -0300 |
---|---|---|
committer | Stefano Babic <sbabic@denx.de> | 2015-04-27 13:13:57 +0200 |
commit | feb6cc5cb3bfd2c99e7092ac3ba6adc726ca4100 (patch) | |
tree | e8b41f7cc4016d7a59990511bf20ccb75ee1777b | |
parent | 8cb6817e3a38ad8bed52d6daa1815c6853fb82ac (diff) | |
download | u-boot-feb6cc5cb3bfd2c99e7092ac3ba6adc726ca4100.zip u-boot-feb6cc5cb3bfd2c99e7092ac3ba6adc726ca4100.tar.gz u-boot-feb6cc5cb3bfd2c99e7092ac3ba6adc726ca4100.tar.bz2 |
mx6cuboxi: Differentiate Cubox-i and Hummingboard
Introduce is_hummingboard() function that reads GPIOs that can distinguish
between Cubox-i and Hummingboard.
Print the board name accordingly.
Based on a patch from Rabeeh Khoury.
Signed-off-by: Rabeeh Khoury <rabeeh@solid-run.com>
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
-rw-r--r-- | board/solidrun/mx6cuboxi/mx6cuboxi.c | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/board/solidrun/mx6cuboxi/mx6cuboxi.c b/board/solidrun/mx6cuboxi/mx6cuboxi.c index 59f322a..9123255 100644 --- a/board/solidrun/mx6cuboxi/mx6cuboxi.c +++ b/board/solidrun/mx6cuboxi/mx6cuboxi.c @@ -71,6 +71,12 @@ static iomux_v3_cfg_t const usdhc2_pads[] = { IOMUX_PADS(PAD_SD2_DAT3__SD2_DATA3 | MUX_PAD_CTRL(USDHC_PAD_CTRL)), }; +static iomux_v3_cfg_t const hb_cbi_sense[] = { + /* These pins are for sensing if it is a CuBox-i or a HummingBoard */ + IOMUX_PADS(PAD_KEY_ROW1__GPIO4_IO09 | MUX_PAD_CTRL(UART_PAD_CTRL)), + IOMUX_PADS(PAD_EIM_DA4__GPIO3_IO04 | MUX_PAD_CTRL(UART_PAD_CTRL)), +}; + static void setup_iomux_uart(void) { SETUP_IOMUX_PADS(uart1_pads); @@ -167,9 +173,42 @@ int board_init(void) return 0; } +static bool is_hummingboard(void) +{ + int val1, val2; + + SETUP_IOMUX_PADS(hb_cbi_sense); + + gpio_direction_input(IMX_GPIO_NR(4, 9)); + gpio_direction_input(IMX_GPIO_NR(3, 4)); + + val1 = gpio_get_value(IMX_GPIO_NR(4, 9)); + val2 = gpio_get_value(IMX_GPIO_NR(3, 4)); + + /* + * Machine selection - + * Machine val1, val2 + * ------------------------- + * HB rev 3.x x 0 + * CBi 0 1 + * HB 1 1 + */ + + if (val2 == 0) + return true; + else if (val1 == 0) + return false; + else + return true; +} + int checkboard(void) { - puts("Board: MX6 Hummingboard\n"); + if (is_hummingboard()) + puts("Board: MX6 Hummingboard\n"); + else + puts("Board: MX6 Cubox-i\n"); + return 0; } |