From patchwork Sat Apr 25 19:13:12 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 464592 X-Patchwork-Delegate: sbabic@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id A4E921400B7 for ; Sun, 26 Apr 2015 05:14:36 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="verification failed; unprotected key" header.d=gmail.com header.i=@gmail.com header.b=UlnqYgw4; dkim-adsp=none (unprotected policy); dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 978BD4BF5D; Sat, 25 Apr 2015 21:14:25 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id CmKHuoP1SaUE; Sat, 25 Apr 2015 21:14:25 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8C9EF4BF79; Sat, 25 Apr 2015 21:14:20 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5621A4BF64 for ; Sat, 25 Apr 2015 21:14:11 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id D2Vlw7YmAxgq for ; Sat, 25 Apr 2015 21:14:11 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-qk0-f171.google.com (mail-qk0-f171.google.com [209.85.220.171]) by theia.denx.de (Postfix) with ESMTPS id 528F74BF54 for ; Sat, 25 Apr 2015 21:14:05 +0200 (CEST) Received: by qkx62 with SMTP id 62so46379406qkx.0 for ; Sat, 25 Apr 2015 12:14:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=9GI78B2jW45jJl9sJs54lQPYbXwDDky4rbyZHPqS0io=; b=UlnqYgw4agHvqWRh4R8v423aDQVZmfQ8PzTWWMPh6HENLtDGkRKlqLdnpN7Q6djnjd R9U3bzcp+WqOXoJUYRy4yBPwsFfpOmASfvt4F2ALKLoUl/7UZKvgO6910tIJaBNMDS3v uUqakSVpG3irWuVR+BRbHCbEUdQK5/ufhX1Bc7O2pohGukjySqGyyo5qbKNWjHKqplsn x8C6cTUtCIJCF/v8XVN87T70f721DHJ9dm8eb3HSFnPjoKlRi3gaqAVvjSy+LvZJMOvE sT5OQagTl/5euOwgaM1P4kyg8NwMLYGdxsMl6TLneIfMCwWyakfsvZ9tIxVSxgaTK4C3 aZow== X-Received: by 10.55.22.3 with SMTP id g3mr4950764qkh.54.1429989244801; Sat, 25 Apr 2015 12:14:04 -0700 (PDT) Received: from localhost.localdomain ([187.66.157.195]) by mx.google.com with ESMTPSA id o3sm9862536qga.36.2015.04.25.12.14.01 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 25 Apr 2015 12:14:03 -0700 (PDT) From: Fabio Estevam To: sbabic@denx.de Date: Sat, 25 Apr 2015 16:13:12 -0300 Message-Id: <1429989194-9870-4-git-send-email-festevam@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1429989194-9870-1-git-send-email-festevam@gmail.com> References: <1429989194-9870-1-git-send-email-festevam@gmail.com> Cc: Fabio Estevam , trini@konsulko.com, jon.nettleton@gmail.com, rabeeh@solid-run.com, u-boot@lists.denx.de, vagrant@aikidev.net Subject: [U-Boot] [PATCH v4 4/6] mx6cuboxi: Differentiate Cubox-i and Hummingboard X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" From: Fabio Estevam 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 Signed-off-by: Fabio Estevam --- Changes since v3: - 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; }