Commit 9a8804a85e37d774419ee6452a90cc6e57d925f3
Committed by
Stefano Babic
1 parent
c0c5341e73
Exists in
v2017.01-smarct4x
and in
34 other branches
wandboard: Add board revision detection support
There are two revisions of wandboard: version B1 and C1. Add the revision detection support, so that the correct dtb file can be automatically loaded. Based on the patch from Richard Hu <hakahu@gmail.com>. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Reviewed-by: Stefano Babic <sbabic@denx.de> Tested-By: Vagrant Cascadian <vagrant@aikidev.net>
Showing 2 changed files with 31 additions and 3 deletions Side-by-side Diff
board/wandboard/wandboard.c
... | ... | @@ -50,6 +50,7 @@ |
50 | 50 | #define USDHC1_CD_GPIO IMX_GPIO_NR(1, 2) |
51 | 51 | #define USDHC3_CD_GPIO IMX_GPIO_NR(3, 9) |
52 | 52 | #define ETH_PHY_RESET IMX_GPIO_NR(3, 29) |
53 | +#define REV_DETECTION IMX_GPIO_NR(2, 28) | |
53 | 54 | |
54 | 55 | int dram_init(void) |
55 | 56 | { |
... | ... | @@ -105,6 +106,10 @@ |
105 | 106 | IOMUX_PADS(PAD_EIM_D29__GPIO3_IO29 | MUX_PAD_CTRL(NO_PAD_CTRL)), |
106 | 107 | }; |
107 | 108 | |
109 | +static iomux_v3_cfg_t const rev_detection_pad[] = { | |
110 | + IOMUX_PADS(PAD_EIM_EB0__GPIO2_IO28 | MUX_PAD_CTRL(NO_PAD_CTRL)), | |
111 | +}; | |
112 | + | |
108 | 113 | static void setup_iomux_uart(void) |
109 | 114 | { |
110 | 115 | SETUP_IOMUX_PADS(uart1_pads); |
... | ... | @@ -393,6 +398,17 @@ |
393 | 398 | }; |
394 | 399 | #endif |
395 | 400 | |
401 | +static bool is_revc1(void) | |
402 | +{ | |
403 | + SETUP_IOMUX_PADS(rev_detection_pad); | |
404 | + gpio_direction_input(REV_DETECTION); | |
405 | + | |
406 | + if (gpio_get_value(REV_DETECTION)) | |
407 | + return true; | |
408 | + else | |
409 | + return false; | |
410 | +} | |
411 | + | |
396 | 412 | int board_late_init(void) |
397 | 413 | { |
398 | 414 | #ifdef CONFIG_CMD_BMODE |
... | ... | @@ -404,6 +420,11 @@ |
404 | 420 | setenv("board_rev", "MX6Q"); |
405 | 421 | else |
406 | 422 | setenv("board_rev", "MX6DL"); |
423 | + | |
424 | + if (is_revc1()) | |
425 | + setenv("board_name", "C1"); | |
426 | + else | |
427 | + setenv("board_name", "B1"); | |
407 | 428 | #endif |
408 | 429 | return 0; |
409 | 430 | } |
... | ... | @@ -424,7 +445,10 @@ |
424 | 445 | |
425 | 446 | int checkboard(void) |
426 | 447 | { |
427 | - puts("Board: Wandboard\n"); | |
448 | + if (is_revc1()) | |
449 | + puts("Board: Wandboard rev C1\n"); | |
450 | + else | |
451 | + puts("Board: Wandboard rev B1\n"); | |
428 | 452 | |
429 | 453 | return 0; |
430 | 454 | } |
include/configs/wandboard.h
... | ... | @@ -194,10 +194,14 @@ |
194 | 194 | "bootz; " \ |
195 | 195 | "fi;\0" \ |
196 | 196 | "findfdt="\ |
197 | - "if test $board_rev = MX6Q ; then " \ | |
197 | + "if test $board_name = C1 && test $board_rev = MX6Q ; then " \ | |
198 | 198 | "setenv fdtfile imx6q-wandboard.dtb; fi; " \ |
199 | - "if test $board_rev = MX6DL ; then " \ | |
199 | + "if test $board_name = C1 && test $board_rev = MX6DL ; then " \ | |
200 | 200 | "setenv fdtfile imx6dl-wandboard.dtb; fi; " \ |
201 | + "if test $board_name = B1 && test $board_rev = MX6Q ; then " \ | |
202 | + "setenv fdtfile imx6q-wandboard-revb1.dtb; fi; " \ | |
203 | + "if test $board_name = B1 && test $board_rev = MX6DL ; then " \ | |
204 | + "setenv fdtfile imx6dl-wandboard-revb1.dtb; fi; " \ | |
201 | 205 | "if test $fdtfile = undefined; then " \ |
202 | 206 | "echo WARNING: Could not determine dtb to use; fi; \0" \ |
203 | 207 |