From: Fabio Estevam <festevam@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v5 4/6] mx6cuboxi: Differentiate Cubox-i and Hummingboard
Date: Sat, 25 Apr 2015 18:47:19 -0300 [thread overview]
Message-ID: <1429998441-12359-4-git-send-email-festevam@gmail.com> (raw)
In-Reply-To: <1429998441-12359-1-git-send-email-festevam@gmail.com>
From: Fabio Estevam <fabio.estevam@freescale.com>
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>
---
Changes since v4:
- None
board/solidrun/mx6cuboxi/mx6cuboxi.c | 41 +++++++++++++++++++++++++++++++++++-
1 file changed, 40 insertions(+), 1 deletion(-)
diff --git a/board/solidrun/mx6cuboxi/mx6cuboxi.c b/board/solidrun/mx6cuboxi/mx6cuboxi.c
index 1f240ae..83410b2 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;
}
--
1.9.1
next prev parent reply other threads:[~2015-04-25 21:47 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-25 21:47 [U-Boot] [PATCH v5 1/6] mx6cuboxi: Fix the defconfig name Fabio Estevam
2015-04-25 21:47 ` [U-Boot] [PATCH v5 2/6] mx6cuboxi: Prepare for multi SoC support Fabio Estevam
2015-04-26 0:32 ` Tom Rini
2015-04-27 11:08 ` Stefano Babic
2015-04-25 21:47 ` [U-Boot] [PATCH v5 3/6] mx6cuboxi: Introduce multi-SoC support Fabio Estevam
2015-04-26 0:32 ` Tom Rini
2015-04-27 11:09 ` Stefano Babic
2015-04-25 21:47 ` Fabio Estevam [this message]
2015-04-26 0:32 ` [U-Boot] [PATCH v5 4/6] mx6cuboxi: Differentiate Cubox-i and Hummingboard Tom Rini
2015-04-27 11:09 ` Stefano Babic
2015-04-25 21:47 ` [U-Boot] [PATCH v5 5/6] mx6cuboxi: Use more standard namings for fdt variables Fabio Estevam
2015-04-26 0:31 ` Tom Rini
2015-04-27 11:09 ` Stefano Babic
2015-04-25 21:47 ` [U-Boot] [PATCH v5 6/6] mx6cuboxi: Load the correct 'fdtfile' variable Fabio Estevam
2015-04-25 23:26 ` Vagrant Cascadian
2015-04-26 0:30 ` Tom Rini
2015-04-27 7:51 ` Stefano Babic
2015-04-27 10:11 ` Fabio Estevam
2015-04-27 10:56 ` Stefano Babic
2015-04-27 11:10 ` Stefano Babic
2015-04-26 0:31 ` [U-Boot] [PATCH v5 1/6] mx6cuboxi: Fix the defconfig name Tom Rini
2015-04-27 11:08 ` Stefano Babic
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1429998441-12359-4-git-send-email-festevam@gmail.com \
--to=festevam@gmail.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox