ZOOM2 detect the version of the zoom2
PATCH 2/3 ZOOM2 detect the version of the zoom2
Jean-Christophe,
Based on your review I have made the changes you asked for.
Tom
Review static u32 gpmc_serial_TL16CP754C[GPMC_MAX_REG] = { · line 65
Quoted 6 lines
(quoted diff) +2
-0@@ -60,6 +61,46 @@ static u32 gpmc_serial_TL16CP754C[GPMC_MAX_REG] = { 0x1D0904C4, 0 }; +/* Used to track the revision of the board */ +int zoom2_revision = ZOOM2_REVISION_UNKNOWN;
add static and as the beagle provide a function to get the current version
Review static u32 gpmc_serial_TL16CP754C[GPMC_MAX_REG] = { · line 66
Quoted 1 line
(quoted diff) +1
-0+
Tom : Ok added
See
+/* Used to track the revision of the board */
+static ZOOM2_REVISION zoom2_revision = ZOOM2_REVISION_UNKNOWN; +
+/*
+ * Routine: zoom2_get_revision
+ * Description: Return the revision of the Zoom2 this code is running on.
+ */
+ZOOM2_REVISION zoom2_get_revision(void)
+{
+ return zoom2_revision;
+}
-------------------------------------------------------------------
Review static u32 gpmc_serial_TL16CP754C[GPMC_MAX_REG] = { · line 73
Quoted 7 lines
(quoted diff) +7
-0+ printf("Board revision "); + if (ZOOM2_REVISION_PRODUCTION == zoom2_revision) + printf("Production\n"); + else if (ZOOM2_REVISION_BETA == zoom2_revision) + printf("Beta\n"); + else + printf("Unknown\n");
please use switch
Review static u32 gpmc_serial_TL16CP754C[GPMC_MAX_REG] = { · line 74
Quoted 1 line
(quoted diff) +1
-0+}
Tom : Ok done.
See
+ switch (zoom2_revision) {
+ case (ZOOM2_REVISION_PRODUCTION):
+ printf("Production\n");
+ break;
+ case (ZOOM2_REVISION_BETA):
+ printf("Beta\n");
+ break;
+ default:
+ printf("Unknown\n");
+ break;
+ }
+}
-------------------------------------------------------
Review static u32 gpmc_serial_TL16CP754C[GPMC_MAX_REG] = { · line 78
Quoted 4 lines
(quoted diff) +4
-0+#define ZOOM2_REVISION_UNKNOWN 0 +#define ZOOM2_REVISION_ALPHA 1 +#define ZOOM2_REVISION_BETA 2 +#define ZOOM2_REVISION_PRODUCTION 3
please use an emum
Tom : Ok
See
+typedef enum {
+ ZOOM2_REVISION_UNKNOWN = 0,
+ ZOOM2_REVISION_ALPHA,
+ ZOOM2_REVISION_BETA,
+ ZOOM2_REVISION_PRODUCTION
+} ZOOM2_REVISION;
----------------------------------------------------------
Also changed this comment in beagle.c
/*
* Routine: beagle_get_revision
- * Description: Return revision of the BeagleBoard this code is running on.
+ * Description: Return the revision of the BeagleBoard this code is running on.
PATCH 1/3 Fix a typo in the instructions on using omap3's gpio interface.
Using the example for reading a gpio, shows the problem. NULL should be the gpio number.
--- doc/README.omap3 | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
doc/README.omap3 +1 -1
@@ -106,7 +106,7 @@ To clear a bit : To read a bit : if (!omap_request_gpio(N)) { - omap_set_gpio_direction(NULL, 1); + omap_set_gpio_direction(N, 1); val = omap_get_gpio_datain(N); omap_free_gpio(N); }
Signature · 1 line
1.6.0.5
PATCH 2/3 ZOOM2 detect the version of the zoom2 board at runtime.
There are currently 3 versions of the zoom2 board.
The production board, that is currently being released.
The beta board, similar in form to the production board but not released. The alpha board, a set of PCBs with a very limited circulation.
GPIO 94 is used to determine the version of the board. If GPIO 94 is clear, the board is a production board, otherwise it is a beta board.
The alpha board will likely be mistaken for a beta board. An alpha board was unavailible for testing.
This has been tested on the beta and production boards.
--- board/omap3/zoom2/zoom2.c | 62 ++++++++++++++++++++++++++++++++++++++++++-- board/omap3/zoom2/zoom2.h | 9 ++++++ 2 files changed, 68 insertions(+), 3 deletions(-)
board/omap3/zoom2/zoom2.c +59 -3
@@ -33,6 +33,7 @@#include <status_led.h> #endif #include <asm/io.h> +#include <asm/arch/gpio.h> #include <asm/arch/mem.h> #include <asm/arch/mux.h> #include <asm/arch/sys_proto.h>
@@ -60,6 +61,60 @@ static u32 gpmc_serial_TL16CP754C[GPMC_MAX_REG] = {0x1D0904C4 ,0 }; +/* Used to track the revision of the board */ +static ZOOM2_REVISION zoom2_revision =ZOOM2_REVISION_UNKNOWN ; + +/* +* Routine: zoom2_get_revision +* Description: Return the revision of the Zoom2 this code is running on. +*/ +ZOOM2_REVISION zoom2_get_revision (void ) +{ +return zoom2_revision; +} + +/* +* Routine: zoom2_identify +* Description: Detect which version of Zoom2 we are running on. +*/ +void zoom2_identify (void ) +{ +/* +* To check for production board vs beta board, +* check if gpio 94 is clear. +* +* No way yet to check for alpha board identity. +* Alpha boards were produced in very limited quantities +* and they are not commonly used. They are mentioned here +* only for completeness. +*/ +if (!omap_request_gpio (94 )) { +unsigned int val; + +omap_set_gpio_direction (94 ,1 ); + val =omap_get_gpio_datain (94 ); +omap_free_gpio (94 ); + +if (val) + zoom2_revision =ZOOM2_REVISION_BETA ; +else + zoom2_revision =ZOOM2_REVISION_PRODUCTION ; + } + +printf ("Board revision " ); +switch (zoom2_revision) { +case (ZOOM2_REVISION_PRODUCTION ): +printf ("Production\n" ); +break ; +case (ZOOM2_REVISION_BETA ): +printf ("Beta\n" ); +break ; +default : +printf ("Unknown\n" ); +break ; + } +} +/* * Routine: board_init * Description: Early hardware init.
@@ -96,10 +151,11 @@ int board_init (void)* Routine: misc_init_r * Description: Configure zoom board specific configurations */ -int misc_init_r (void ) +int misc_init_r (void ) { -power_init_r (); -dieid_num_r (); +zoom2_identify (); +power_init_r (); +dieid_num_r ();return 0 ; }
board/omap3/zoom2/zoom2.h +9 -0
@@ -32,6 +32,15 @@ const omap3_sysinfo sysinfo = { "NAND", }; +typedef enum { +ZOOM2_REVISION_UNKNOWN =0 , +ZOOM2_REVISION_ALPHA , +ZOOM2_REVISION_BETA , +ZOOM2_REVISION_PRODUCTION +}ZOOM2_REVISION ; + +extern ZOOM2_REVISION zoom2_get_revision (void ); +/* * IEN - Input Enable * IDIS - Input Disable
Signature · 1 line
1.6.0.5
PATCH 3/3 Beagle Convert the board version detection to use the OMAP3 GPIO interface.
There is no new functionality in the change.
This change is a conversion from the using raw register access to using the OMAP3 GPIO API described in doc/README.omap3.
--- board/omap3/beagle/beagle.c | 32 ++++++++++++++++++-------------- 1 files changed, 18 insertions(+), 14 deletions(-)
board/omap3/beagle/beagle.c +18 -14
@@ -33,6 +33,7 @@#include <asm/io.h> #include <asm/arch/mux.h> #include <asm/arch/sys_proto.h> +#include <asm/arch/gpio.h> #include <asm/mach-types.h> #include "beagle.h"
@@ -57,7 +58,7 @@ int board_init(void)/* * Routine: beagle_get_revision -* Description: Return revision of the BeagleBoard this code is running on. +* 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. */
@@ -74,22 +75,25 @@ int beagle_get_revision(void)*/ void beagle_identify (void ) { -gpio_t *gpio6_base = (gpio_t *)OMAP34XX_GPIO6_BASE ; - -/* Configure GPIO 171 as input */ -writel (readl (&gpio6_base->oe) |GPIO11 , &gpio6_base->oe); - -/* Get value of GPIO 171 */ - beagle_revision_c =readl (&gpio6_base->datain) &BOARD_REVISION_MASK ; + 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 ; + }printf ("Board revision " ); -if (beagle_revision_c) { -printf ("Ax/Bx\n" ); - beagle_revision_c =0 ; - }else { +if (beagle_revision_c)printf ("C\n" ); - beagle_revision_c =1 ; - } +else +printf ("Ax/Bx\n" ); }/*
Signature · 1 line
1.6.0.5
PATCH 1/3 Fix a typo in the instructions on using omap3's gpio interface.
Quoted 23 lines · Tom Rix
Using the example for reading a gpio, shows the problem. NULL should be the gpio number.
Signed-off-by Tom Rix <[email protected]>--- doc/README.omap3 | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)doc/README.omap3 +1
-1@@ -106,7 +106,7 @@ To clear a bit : To read a bit : if (!omap_request_gpio(N)) { - omap_set_gpio_direction(NULL, 1); + omap_set_gpio_direction(N, 1); val = omap_get_gpio_datain(N); omap_free_gpio(N); }Signature · 1 line
1.6.0.5
Quoted 32 lines · Tom Rix
There are currently 3 versions of the zoom2 board.
The production board, that is currently being released.
The beta board, similar in form to the production board but not released. The alpha board, a set of PCBs with a very limited circulation.GPIO 94 is used to determine the version of the board. If GPIO 94 is clear, the board is a production board, otherwise it is a beta board.
The alpha board will likely be mistaken for a beta board. An alpha board was unavailible for testing.
This has been tested on the beta and production boards.
Signed-off-by Tom Rix <[email protected]>--- board/omap3/zoom2/zoom2.c | 62 ++++++++++++++++++++++++++++++++++++++++++-- board/omap3/zoom2/zoom2.h | 9 ++++++ 2 files changed, 68 insertions(+), 3 deletions(-)board/omap3/zoom2/zoom2.c +1
-0@@ -33,6 +33,7 @@#include <status_led.h> #endif #include <asm/io.h> +#include <asm/arch/gpio.h> #include <asm/arch/mem.h> #include <asm/arch/mux.h> #include <asm/arch/sys_proto.h>
board/omap3/zoom2/zoom2.c static u32 gpmc_serial_TL16CP754C[GPMC_MAX_REG] = { · line 65
Quoted 5 lines
board/omap3/zoom2/zoom2.c +2
-0@@ -60,6 +61,60 @@ static u32 gpmc_serial_TL16CP754C[GPMC_MAX_REG] = { 0x1D0904C4, 0 }; +/* Used to track the revision of the board */ +static ZOOM2_REVISION zoom2_revision =ZOOM2_REVISION_UNKNOWN ;
no uppercase please
if you are ok I'll remane it before apply
static zoom2_revision revision = ZOOM2_REVISION_UNKNOWN;
Best Regards,
J.
PATCH 1/3 Fix a typo in the instructions on using omap3's gpio interface.
Quoted 5 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 3 lines · Tom Rix
Using the example for reading a gpio, shows the problem. NULL should be the gpio number.
<snip>
Quoted 10 lines
Review
Quoted 4 lines
(quoted diff) +2
-0+/* Used to track the revision of the board */ +static ZOOM2_REVISION zoom2_revision = ZOOM2_REVISION_UNKNOWN;no uppercase please
if you are ok I'll remane it before applystatic
zoom2_revisionrevision =ZOOM2_REVISION_UNKNOWN;
Please do.
Thanks
Tom
Quoted 3 lines
Best Regards,
J.
Jean-Christophe PLAGNIOL-VILLARD
AppliedPATCH 3/3 Beagle Convert the board version detection to use the OMAP3 GPIO interface.
In reply to Tom RixQuoted 7 lines · Tom Rix
There is no new functionality in the change.
This change is a conversion from the using raw register access to using the OMAP3 GPIO API described in doc/README.omap3.
Signed-off-by Tom Rix <[email protected]>---
applied to arm/next
Best Regards,
J.
PATCH v3 2/3 ZOOM2 detect the version of the zoom2 board at runtime.
In reply to Tom RixFrom: Tom Rix <[email protected]>
There are currently 3 versions of the zoom2 board.
The production board, that is currently being released.
The beta board, similar in form to the production board but not released. The alpha board, a set of PCBs with a very limited circulation.
GPIO 94 is used to determine the version of the board. If GPIO 94 is clear, the board is a production board, otherwise it is a beta board.
The alpha board will likely be mistaken for a beta board. An alpha board was unavailible for testing.
This has been tested on the beta and production boards.
--- board/omap3/zoom2/zoom2.c | 62 ++++++++++++++++++++++++++++++++++++++++++-- board/omap3/zoom2/zoom2.h | 9 ++++++ 2 files changed, 68 insertions(+), 3 deletions(-)
board/omap3/zoom2/zoom2.c +59 -3
@@ -33,6 +33,7 @@#include <status_led.h> #endif #include <asm/io.h> +#include <asm/arch/gpio.h> #include <asm/arch/mem.h> #include <asm/arch/mux.h> #include <asm/arch/sys_proto.h>
@@ -60,6 +61,60 @@ static u32 gpmc_serial_TL16CP754C[GPMC_MAX_REG] = { 0x1D0904C4, 0 }; +/* Used to track the revision of the board */ +static zoom2_revision revision =ZOOM2_REVISION_UNKNOWN ; + +/* +* Routine: zoom2_get_revision +* Description: Return the revision of the Zoom2 this code is running on. +*/ +zoom2_revision zoom2_get_revision (void ) +{ +return revision; +} + +/* +* Routine: zoom2_identify +* Description: Detect which version of Zoom2 we are running on. +*/ +void zoom2_identify (void ) +{ +/* +* To check for production board vs beta board, +* check if gpio 94 is clear. +* +* No way yet to check for alpha board identity. +* Alpha boards were produced in very limited quantities +* and they are not commonly used. They are mentioned here +* only for completeness. +*/ +if (!omap_request_gpio (94 )) { +unsigned int val; + +omap_set_gpio_direction (94 ,1 ); + val =omap_get_gpio_datain (94 ); +omap_free_gpio (94 ); + +if (val) + revision =ZOOM2_REVISION_BETA ; +else + revision =ZOOM2_REVISION_PRODUCTION ; + } + +printf ("Board revision " ); +switch (revision) { +case ZOOM2_REVISION_PRODUCTION : +printf ("Production\n" ); +break ; +case ZOOM2_REVISION_BETA : +printf ("Beta\n" ); +break ; +default : +printf ("Unknown\n" ); +break ; + } +} +/* * Routine: board_init * Description: Early hardware init.
@@ -96,10 +151,11 @@ int board_init (void)* Routine: misc_init_r * Description: Configure zoom board specific configurations */ -int misc_init_r (void ) +int misc_init_r (void ) { -power_init_r (); -dieid_num_r (); +zoom2_identify (); +power_init_r (); +dieid_num_r ();return 0 ; }
board/omap3/zoom2/zoom2.h +9 -0
@@ -32,6 +32,15 @@ const omap3_sysinfo sysinfo = { "NAND", }; +typedef enum { +ZOOM2_REVISION_UNKNOWN =0 , +ZOOM2_REVISION_ALPHA , +ZOOM2_REVISION_BETA , +ZOOM2_REVISION_PRODUCTION +}zoom2_revision ; + +zoom2_revision zoom2_get_revision (void ); +/* * IEN - Input Enable * IDIS - Input Disable
Signature · 1 line
1.6.2.4
PATCH v3 2/3 ZOOM2 detect the version of the zoom2 board at runtime.
Quoted 3 lines · Jean-Christophe PLAGNIOL-VILLARD
From: Tom Rix <[email protected]>
<snip>
Quoted 8 lines
This has been tested on the beta and production boards.
Signed-off-by Tom Rix <[email protected]>Signed-off-by Jean-Christophe PLAGNIOL-VILLARD <[email protected]>---
<snip>
board/omap3/zoom2/zoom2.h const omap3_sysinfo sysinfo = { · line 43
Quoted 9 lines
board/omap3/zoom2/zoom2.h +9
-0+typedef enum { +ZOOM2_REVISION_UNKNOWN =0 , +ZOOM2_REVISION_ALPHA , +ZOOM2_REVISION_BETA , +ZOOM2_REVISION_PRODUCTION +}zoom2_revision ; + +zoom2_revision zoom2_get_revision (void ); +
Looks fine.
Thanks!
Tom
Quoted 4 lines
/*
* IEN - Input Enable
* IDIS - Input Disable