All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefano Babic <sbabic@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 4/5] mx6cuboxi: Differentiate Cubox-i and Hummingboard
Date: Thu, 23 Apr 2015 08:16:37 +0200	[thread overview]
Message-ID: <55388E45.6050907@denx.de> (raw)
In-Reply-To: <1429761426-26748-4-git-send-email-festevam@gmail.com>

Hi Fabio,

On 23/04/2015 05:57, Fabio Estevam wrote:
> 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.
> 
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---
>  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;
>  }
>  
> 

Reviewed-by: Stefano Babic <sbabic@denx.de>

Best regards,
Stefano Babic


-- 
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================

  reply	other threads:[~2015-04-23  6:16 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-23  3:57 [U-Boot] [PATCH 1/5] mx6cuboxi: Fix the defconfig name Fabio Estevam
2015-04-23  3:57 ` [U-Boot] [PATCH 2/5] mx6cuboxi: Prepare for multi SoC support Fabio Estevam
2015-04-23  6:14   ` Stefano Babic
2015-04-23  3:57 ` [U-Boot] [PATCH 3/5] mx6cuboxi: Introduce multi-SoC support Fabio Estevam
2015-04-23  6:16   ` Stefano Babic
2015-04-23 19:09   ` Tom Rini
2015-04-23  3:57 ` [U-Boot] [PATCH 4/5] mx6cuboxi: Differentiate Cubox-i and Hummingboard Fabio Estevam
2015-04-23  6:16   ` Stefano Babic [this message]
2015-04-23 14:38   ` Nikolay Dimitrov
2015-04-23 15:17     ` Stefano Babic
2015-04-23  3:57 ` [U-Boot] [PATCH 5/5] mx6cuboxi: Load the correct 'fdt_file' variable Fabio Estevam
2015-04-23  6:13   ` Stefano Babic
2015-04-23 17:18     ` Fabio Estevam
2015-04-23 18:26       ` Stefano Babic
2015-04-23 19:10     ` Tom Rini
2015-04-23 18:47   ` [U-Boot] [U-Boot, " Vagrant Cascadian
2015-04-23  6:14 ` [U-Boot] [PATCH 1/5] mx6cuboxi: Fix the defconfig name 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=55388E45.6050907@denx.de \
    --to=sbabic@denx.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.