[U-Boot] TI:OMAP: [ PATCH 1/4 ] OMAP3: Beagle: Update revision detection

Khasim Syed Mohammed khasim at beagleboard.org
Wed Jan 6 06:57:46 CET 2010


Sandeep,

On Tue, Jan 5, 2010 at 9:41 PM, Khasim Syed Mohammed
<khasim at beagleboard.org> wrote:
> From 3a540c9746d080d3e45e820081684da4f14d28a2 Mon Sep 17 00:00:00 2001
> From: Dirk Behme <dirk.behme at googlemail.com>
> Date: Tue, 5 Jan 2010 20:04:27 +0530
> Subject: [PATCH] OMAP3: Beagle: Update revision detection
>
> New BeagleBoard revision C4 uses a new ID. Update revision detection.
>
> Signed-off-by: Dirk Behme <dirk.behme at googlemail.com>
> ---
>  board/ti/beagle/beagle.c |   64 ++++++++++++++++++++++++++++-----------------
>  board/ti/beagle/beagle.h |    8 ++++-
>  2 files changed, 46 insertions(+), 26 deletions(-)
>
> diff --git a/board/ti/beagle/beagle.c b/board/ti/beagle/beagle.c
> index 32d501e..17840cf 100644
> --- a/board/ti/beagle/beagle.c
> +++ b/board/ti/beagle/beagle.c
> @@ -38,7 +38,7 @@
>  #include <asm/mach-types.h>
>  #include "beagle.h"
>
> -static int beagle_revision_c;
> +static int beagle_revision;
>
>  /*
>  * Routine: board_init
> @@ -60,41 +60,57 @@ int board_init(void)
>  /*
>  * Routine: beagle_get_revision
>  * Description: Return the revision of the BeagleBoard this code is running on.
> - *              If it is a revision Ax/Bx board, this function returns 0,
> - *              on a revision C board you will get a 1.
>  */
>  int beagle_get_revision(void)
>  {
> -       return beagle_revision_c;
> +       return beagle_revision;
>  }
>
>  /*
>  * Routine: beagle_identify
> - * Description: Detect if we are running on a Beagle revision Ax/Bx or
> - *              Cx. This can be done by GPIO_171. If this is low, we are
> - *              running on a revision C board.
> + * Description: Detect if we are running on a Beagle revision Ax/Bx,
> + *             C1/2/3, C4 or D. This can be done by reading
> + *             the level of GPIO173, GPIO172 and GPIO171. This should
> + *             result in
> + *             GPIO173, GPIO172, GPIO171: 1 1 1 => Ax/Bx
> + *             GPIO173, GPIO172, GPIO171: 1 1 0 => C1/2/3
> + *             GPIO173, GPIO172, GPIO171: 1 0 1 => C4
> + *             GPIO173, GPIO172, GPIO171: 0 0 0 => D
>  */
>  void beagle_identify(void)
>  {
> -       beagle_revision_c = 0;
> -       if (!omap_request_gpio(171)) {
> -               unsigned int val;
> -
> -               omap_set_gpio_direction(171, 1);
> -               val = omap_get_gpio_datain(171);
> -               omap_free_gpio(171);
> -
> -               if (val)
> -                       beagle_revision_c = 0;
> -               else
> -                       beagle_revision_c = 1;
> -       }
> +       omap_request_gpio(171);
> +       omap_request_gpio(172);
> +       omap_request_gpio(173);
> +       omap_set_gpio_direction(171, 1);
> +       omap_set_gpio_direction(172, 1);
> +       omap_set_gpio_direction(173, 1);
> +
> +       beagle_revision = omap_get_gpio_datain(173) << 2 |
> +                         omap_get_gpio_datain(172) << 1 |
> +                         omap_get_gpio_datain(171);
> +       omap_free_gpio(171);
> +       omap_free_gpio(172);
> +       omap_free_gpio(173);
>
>        printf("Board revision ");
> -       if (beagle_revision_c)
> -               printf("C\n");
> -       else
> +
> +       switch (beagle_revision) {
> +       case REVISION_AXBX:
>                printf("Ax/Bx\n");
> +               break;
> +       case REVISION_CX:
> +               printf("C1/C2/C3\n");
> +               break;
> +       case REVISION_C4:
> +               printf("C4\n");
> +               break;
> +       case REVISION_D:
> +               printf("D\n");
> +               break;
> +       default:
> +               printf("unknown 0x%02x\n", beagle_revision);
> +       }
>  }
>
>  /*
> @@ -137,7 +153,7 @@ void set_muxconf_regs(void)
>  {
>        MUX_BEAGLE();
>
> -       if (beagle_revision_c) {
> +       if (beagle_revision != REVISION_AXBX) {
>                MUX_BEAGLE_C();
>        }
>  }
> diff --git a/board/ti/beagle/beagle.h b/board/ti/beagle/beagle.h
> index 7fe6275..b1720c9 100644
> --- a/board/ti/beagle/beagle.h
> +++ b/board/ti/beagle/beagle.h
> @@ -33,7 +33,11 @@ const omap3_sysinfo sysinfo = {
>  #endif
>  };
>
> -#define BOARD_REVISION_MASK    (0x1 << 11)
> +/* BeagleBoard revisions */
> +#define REVISION_AXBX  0x7
> +#define REVISION_CX    0x6
> +#define REVISION_C4    0x5
> +#define REVISION_D     0x0
>
>  /*
>  * IEN  - Input Enable
> @@ -264,7 +268,7 @@ const omap3_sysinfo sysinfo = {
>        MUX_VAL(CP(HDQ_SIO),            (IDIS | PTU | EN  | M4)) /*GPIO_170*/\
>        MUX_VAL(CP(MCSPI1_CLK),         (IEN  | PTU | EN  | M4)) /*GPIO_171*/\
>        MUX_VAL(CP(MCSPI1_SIMO),        (IEN  | PTU | EN  | M4)) /*GPIO_172*/\
> -       MUX_VAL(CP(MCSPI1_SOMI),        (IEN  | PTD | DIS | M0)) /*McSPI1_SOMI*/\
> +       MUX_VAL(CP(MCSPI1_SOMI),        (IEN  | PTU | EN  | M4)) /*GPIO_173*/\
>        MUX_VAL(CP(MCSPI1_CS0),         (IEN  | PTD | EN  | M0)) /*McSPI1_CS0*/\
>        MUX_VAL(CP(MCSPI1_CS1),         (IDIS | PTD | EN  | M0)) /*McSPI1_CS1*/\
>        MUX_VAL(CP(MCSPI1_CS2),         (IDIS | PTD | DIS | M4)) /*GPIO_176*/\
> --
> 1.5.6.3
>
Since there are no comments for this patch, can you please consider
merging this ?

Regards,
Khasim


More information about the U-Boot mailing list