OMAP3: Beagle: Update revision detection
PATCH 1/1 OMAP3: Beagle: Update revision detection
New BeagleBoard revision C4 uses a new ID. Update revision detection.
---
Tested on C1/2 and C4 (prototype).
Patch against v2009.11
Known C4 changes:
- Use OMAP3 720MHz devices.
- Change in the way the USB Host PHY is powered.
(to be added later based on this patch)
board/ti/beagle/beagle.c | 68 ++++++++++++++++++++++++++++++----------------- board/ti/beagle/beagle.h | 9 ++++-- 2 files changed, 51 insertions(+), 26 deletions(-)
board/ti/beagle/beagle.c +44 -24
@@ -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,61 @@ 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, C3, 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 +* GPIO173, GPIO172, GPIO171: 1 0 0 => C3 +* 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_C1 : +printf ("C1/2\n" ); +break ; +case REVISION_C3 : +printf ("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 +157,7 @@ void set_muxconf_regs(void) {MUX_BEAGLE (); -if (beagle_revision_c) { +if (beagle_revision !=REVISION_AXBX ) {MUX_BEAGLE_C (); } }
board/ti/beagle/beagle.h +7 -2
@@ -33,7 +33,12 @@ const omap3_sysinfo sysinfo = {#endif }; -#define BOARD_REVISION_MASK (0x1 << 11) +/* BeagleBoard revisions */ +#define REVISION_AXBX 0x7 +#define REVISION_C1 0x6 +#define REVISION_C3 0x4 +#define REVISION_C4 0x5 +#define REVISION_D 0x0/* * IEN - Input Enable
@@ -264,7 +269,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*/ \
PATCH 1/1 OMAP3: Beagle: Update revision detection
Quoted 11 lines · Dirk Behme
New BeagleBoard revision C4 uses a new ID. Update revision detection.
Signed-off-by Dirk Behme <[email protected]>---
Tested on C1/2 and C4 (prototype).
Patch against v2009.11
Known C4 changes:
Quoted 9 lines
- Use OMAP3 720MHz devices.
- Change in the way the USB Host PHY is powered.(to be added later based on this patch)
board/ti/beagle/beagle.c | 68 ++++++++++++++++++++++++++++++----------------- board/ti/beagle/beagle.h | 9 ++++-- 2 files changed, 51 insertions(+), 26 deletions(-)
Patch looks fine.
I tested this on B7 and C3.
B7 reported ok
C3 reported as C1/C2 which is not.
Is there another way to test C3 vs C1/C2 ?
Tom