* [U-Boot] [PATCH] arm: omap4: panda: Add reading of the board revision
@ 2013-06-12 17:54 Dan Murphy
2013-06-13 12:42 ` Dan Murphy
2013-06-13 12:47 ` Tom Rini
0 siblings, 2 replies; 3+ messages in thread
From: Dan Murphy @ 2013-06-12 17:54 UTC (permalink / raw)
To: u-boot
Detect if we are running on a panda revision A1-A6,
or an ES panda board. This can be done by reading
the level of GPIOs and checking the processor revisions.
This should result in:
Panda 4430:
GPIO171, GPIO101, GPIO182: 0 1 1 => A1-A5
GPIO171, GPIO101, GPIO182: 1 0 1 => A6
Panda ES:
GPIO2, GPIO3, GPIO171, GPIO48, GPIO182: 0 0 0 1 1 => B1/B2
GPIO2, GPIO3, GPIO171, GPIO48, GPIO182: 0 0 1 1 1 => B3
Set the board name appropriately for the board revision that
is detected.
Update the findfdt macro to load the a4 device tree binary.
Signed-off-by: Dan Murphy <dmurphy@ti.com>
---
board/ti/panda/panda.c | 71 +++++++++++++++++++++++++++++++++++++---
include/configs/omap4_common.h | 2 +
2 files changed, 68 insertions(+), 5 deletions(-)
diff --git a/board/ti/panda/panda.c b/board/ti/panda/panda.c
index 2bbe392..65a6e14 100644
--- a/board/ti/panda/panda.c
+++ b/board/ti/panda/panda.c
@@ -37,6 +37,11 @@
#endif
#define PANDA_ULPI_PHY_TYPE_GPIO 182
+#define PANDA_BOARD_ID_1_GPIO 101
+#define PANDA_ES_BOARD_ID_1_GPIO 48
+#define PANDA_BOARD_ID_2_GPIO 171
+#define PANDA_ES_BOARD_ID_3_GPIO 3
+#define PANDA_ES_BOARD_ID_4_GPIO 2
DECLARE_GLOBAL_DATA_PTR;
@@ -66,6 +71,66 @@ int board_eth_init(bd_t *bis)
return 0;
}
+/*
+* Routine: get_board_revision
+* Description: Detect if we are running on a panda revision A1-A6,
+* or an ES panda board. This can be done by reading
+* the level of GPIOs and checking the processor revisions.
+* This should result in:
+* Panda 4430:
+* GPIO171, GPIO101, GPIO182: 0 1 1 => A1-A5
+* GPIO171, GPIO101, GPIO182: 1 0 1 => A6
+* Panda ES:
+* GPIO2, GPIO3, GPIO171, GPIO48, GPIO182: 0 0 0 1 1 => B1/B2
+* GPIO2, GPIO3, GPIO171, GPIO48, GPIO182: 0 0 1 1 1 => B3
+*/
+int get_board_revision(void)
+{
+ int board_id0, board_id1, board_id2;
+ int board_id3, board_id4;
+ int board_id;
+
+ int processor_rev = omap_revision();
+
+ /* Setup the mux for the common board ID pins */
+ writew((IEN | M3), CONTROL_PADCONF_CORE + UNIPRO_TX0); /* gpio 171 */
+ writew((IEN | M3), CONTROL_PADCONF_CORE + FREF_CLK2_OUT); /* gpio 182 */
+
+ board_id0 = gpio_get_value(PANDA_ULPI_PHY_TYPE_GPIO);
+ board_id2 = gpio_get_value(PANDA_BOARD_ID_2_GPIO);
+
+ if (processor_rev >= OMAP4460_ES1_0 &&
+ processor_rev <= OMAP4460_ES1_1) {
+ /* Setup the mux for the ES specific board ID pins */
+ writew((IEN | M3), CONTROL_PADCONF_CORE + GPMC_A24); /* gpio 101 */
+ writew((IEN | M3), CONTROL_PADCONF_CORE + UNIPRO_RY0); /* gpio 2 */
+ writew((IEN | M3), CONTROL_PADCONF_CORE + UNIPRO_RX1); /* gpio 3 */
+
+ board_id1 = gpio_get_value(PANDA_ES_BOARD_ID_1_GPIO);
+ board_id3 = gpio_get_value(PANDA_ES_BOARD_ID_3_GPIO);
+ board_id4 = gpio_get_value(PANDA_ES_BOARD_ID_4_GPIO);
+
+#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
+ setenv("board_name", strcat(CONFIG_SYS_BOARD, "-es"));
+#endif
+ board_id = ((board_id4 << 4) | (board_id3 << 3) | (board_id2 << 2) |
+ (board_id1 << 1) | (board_id0));
+ } else {
+ /* Setup the mux for the Ax specific board ID pins */
+ writew((IEN | M3), CONTROL_PADCONF_CORE + FREF_CLK2_OUT); /* gpio 101 */
+
+ board_id1 = gpio_get_value(PANDA_BOARD_ID_1_GPIO);
+ board_id = ((board_id2 << 2) | (board_id1 << 1) | (board_id0));
+
+#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
+ if ((board_id >= 0x3) && (processor_rev == OMAP4430_ES2_3))
+ setenv("board_name", strcat(CONFIG_SYS_BOARD, "-a4"));
+#endif
+ }
+
+ return board_id;
+}
+
/**
* @brief misc_init_r - Configure Panda board specific configurations
* such as power configurations, ethernet initialization as phase2 of
@@ -82,11 +147,7 @@ int misc_init_r(void)
if (omap_revision() == OMAP4430_ES1_0)
return 0;
-#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
- if (omap_revision() >= OMAP4460_ES1_0 ||
- omap_revision() <= OMAP4460_ES1_1)
- setenv("board_name", strcat(CONFIG_SYS_BOARD, "-es"));
-#endif
+ get_board_revision();
gpio_direction_input(PANDA_ULPI_PHY_TYPE_GPIO);
phy_type = gpio_get_value(PANDA_ULPI_PHY_TYPE_GPIO);
diff --git a/include/configs/omap4_common.h b/include/configs/omap4_common.h
index d6448b0..cf41d9c 100644
--- a/include/configs/omap4_common.h
+++ b/include/configs/omap4_common.h
@@ -181,6 +181,8 @@
"setenv fdtfile omap4-sdp.dtb; fi; " \
"if test $board_name = panda; then " \
"setenv fdtfile omap4-panda.dtb; fi;" \
+ "if test $board_name = panda-a4; then " \
+ "setenv fdtfile omap4-panda-a4.dtb; fi;" \
"if test $board_name = panda-es; then " \
"setenv fdtfile omap4-panda-es.dtb; fi; \0" \
"loadfdt=load mmc ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}\0" \
--
1.7.5.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [U-Boot] [PATCH] arm: omap4: panda: Add reading of the board revision
2013-06-12 17:54 [U-Boot] [PATCH] arm: omap4: panda: Add reading of the board revision Dan Murphy
@ 2013-06-13 12:42 ` Dan Murphy
2013-06-13 12:47 ` Tom Rini
1 sibling, 0 replies; 3+ messages in thread
From: Dan Murphy @ 2013-06-13 12:42 UTC (permalink / raw)
To: u-boot
On 06/12/2013 12:54 PM, Dan Murphy wrote:
> Detect if we are running on a panda revision A1-A6,
> or an ES panda board. This can be done by reading
> the level of GPIOs and checking the processor revisions.
> This should result in:
> Panda 4430:
> GPIO171, GPIO101, GPIO182: 0 1 1 => A1-A5
> GPIO171, GPIO101, GPIO182: 1 0 1 => A6
> Panda ES:
> GPIO2, GPIO3, GPIO171, GPIO48, GPIO182: 0 0 0 1 1 => B1/B2
> GPIO2, GPIO3, GPIO171, GPIO48, GPIO182: 0 0 1 1 1 => B3
>
> Set the board name appropriately for the board revision that
> is detected.
>
> Update the findfdt macro to load the a4 device tree binary.
>
> Signed-off-by: Dan Murphy <dmurphy@ti.com>
> ---
> board/ti/panda/panda.c | 71 +++++++++++++++++++++++++++++++++++++---
> include/configs/omap4_common.h | 2 +
> 2 files changed, 68 insertions(+), 5 deletions(-)
>
> diff --git a/board/ti/panda/panda.c b/board/ti/panda/panda.c
> index 2bbe392..65a6e14 100644
> --- a/board/ti/panda/panda.c
> +++ b/board/ti/panda/panda.c
> @@ -37,6 +37,11 @@
> #endif
>
> #define PANDA_ULPI_PHY_TYPE_GPIO 182
> +#define PANDA_BOARD_ID_1_GPIO 101
> +#define PANDA_ES_BOARD_ID_1_GPIO 48
> +#define PANDA_BOARD_ID_2_GPIO 171
> +#define PANDA_ES_BOARD_ID_3_GPIO 3
> +#define PANDA_ES_BOARD_ID_4_GPIO 2
>
> DECLARE_GLOBAL_DATA_PTR;
>
> @@ -66,6 +71,66 @@ int board_eth_init(bd_t *bis)
> return 0;
> }
>
> +/*
> +* Routine: get_board_revision
> +* Description: Detect if we are running on a panda revision A1-A6,
> +* or an ES panda board. This can be done by reading
> +* the level of GPIOs and checking the processor revisions.
> +* This should result in:
> +* Panda 4430:
> +* GPIO171, GPIO101, GPIO182: 0 1 1 => A1-A5
> +* GPIO171, GPIO101, GPIO182: 1 0 1 => A6
> +* Panda ES:
> +* GPIO2, GPIO3, GPIO171, GPIO48, GPIO182: 0 0 0 1 1 => B1/B2
> +* GPIO2, GPIO3, GPIO171, GPIO48, GPIO182: 0 0 1 1 1 => B3
> +*/
> +int get_board_revision(void)
> +{
> + int board_id0, board_id1, board_id2;
> + int board_id3, board_id4;
> + int board_id;
> +
> + int processor_rev = omap_revision();
> +
> + /* Setup the mux for the common board ID pins */
> + writew((IEN | M3), CONTROL_PADCONF_CORE + UNIPRO_TX0); /* gpio 171 */
> + writew((IEN | M3), CONTROL_PADCONF_CORE + FREF_CLK2_OUT); /* gpio 182 */
> +
> + board_id0 = gpio_get_value(PANDA_ULPI_PHY_TYPE_GPIO);
> + board_id2 = gpio_get_value(PANDA_BOARD_ID_2_GPIO);
> +
> + if (processor_rev >= OMAP4460_ES1_0 &&
> + processor_rev <= OMAP4460_ES1_1) {
> + /* Setup the mux for the ES specific board ID pins */
> + writew((IEN | M3), CONTROL_PADCONF_CORE + GPMC_A24); /* gpio 101 */
> + writew((IEN | M3), CONTROL_PADCONF_CORE + UNIPRO_RY0); /* gpio 2 */
> + writew((IEN | M3), CONTROL_PADCONF_CORE + UNIPRO_RX1); /* gpio 3 */
> +
> + board_id1 = gpio_get_value(PANDA_ES_BOARD_ID_1_GPIO);
> + board_id3 = gpio_get_value(PANDA_ES_BOARD_ID_3_GPIO);
> + board_id4 = gpio_get_value(PANDA_ES_BOARD_ID_4_GPIO);
> +
> +#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
> + setenv("board_name", strcat(CONFIG_SYS_BOARD, "-es"));
> +#endif
> + board_id = ((board_id4 << 4) | (board_id3 << 3) | (board_id2 << 2) |
> + (board_id1 << 1) | (board_id0));
> + } else {
> + /* Setup the mux for the Ax specific board ID pins */
> + writew((IEN | M3), CONTROL_PADCONF_CORE + FREF_CLK2_OUT); /* gpio 101 */
> +
> + board_id1 = gpio_get_value(PANDA_BOARD_ID_1_GPIO);
> + board_id = ((board_id2 << 2) | (board_id1 << 1) | (board_id0));
> +
> +#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
> + if ((board_id >= 0x3) && (processor_rev == OMAP4430_ES2_3))
> + setenv("board_name", strcat(CONFIG_SYS_BOARD, "-a4"));
> +#endif
> + }
> +
> + return board_id;
> +}
> +
> /**
> * @brief misc_init_r - Configure Panda board specific configurations
> * such as power configurations, ethernet initialization as phase2 of
> @@ -82,11 +147,7 @@ int misc_init_r(void)
> if (omap_revision() == OMAP4430_ES1_0)
> return 0;
>
> -#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
> - if (omap_revision() >= OMAP4460_ES1_0 ||
> - omap_revision() <= OMAP4460_ES1_1)
> - setenv("board_name", strcat(CONFIG_SYS_BOARD, "-es"));
> -#endif
> + get_board_revision();
>
> gpio_direction_input(PANDA_ULPI_PHY_TYPE_GPIO);
> phy_type = gpio_get_value(PANDA_ULPI_PHY_TYPE_GPIO);
> diff --git a/include/configs/omap4_common.h b/include/configs/omap4_common.h
> index d6448b0..cf41d9c 100644
> --- a/include/configs/omap4_common.h
> +++ b/include/configs/omap4_common.h
> @@ -181,6 +181,8 @@
> "setenv fdtfile omap4-sdp.dtb; fi; " \
> "if test $board_name = panda; then " \
> "setenv fdtfile omap4-panda.dtb; fi;" \
> + "if test $board_name = panda-a4; then " \
> + "setenv fdtfile omap4-panda-a4.dtb; fi;" \
> "if test $board_name = panda-es; then " \
> "setenv fdtfile omap4-panda-es.dtb; fi; \0" \
> "loadfdt=load mmc ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}\0" \
Tested on A3, A6 and ES B2.
Dan
--
------------------
Dan Murphy
^ permalink raw reply [flat|nested] 3+ messages in thread
* [U-Boot] [PATCH] arm: omap4: panda: Add reading of the board revision
2013-06-12 17:54 [U-Boot] [PATCH] arm: omap4: panda: Add reading of the board revision Dan Murphy
2013-06-13 12:42 ` Dan Murphy
@ 2013-06-13 12:47 ` Tom Rini
1 sibling, 0 replies; 3+ messages in thread
From: Tom Rini @ 2013-06-13 12:47 UTC (permalink / raw)
To: u-boot
On Wed, Jun 12, 2013 at 12:54:27PM -0500, Dan Murphy wrote:
> Detect if we are running on a panda revision A1-A6,
> or an ES panda board. This can be done by reading
> the level of GPIOs and checking the processor revisions.
> This should result in:
> Panda 4430:
> GPIO171, GPIO101, GPIO182: 0 1 1 => A1-A5
> GPIO171, GPIO101, GPIO182: 1 0 1 => A6
> Panda ES:
> GPIO2, GPIO3, GPIO171, GPIO48, GPIO182: 0 0 0 1 1 => B1/B2
> GPIO2, GPIO3, GPIO171, GPIO48, GPIO182: 0 0 1 1 1 => B3
>
> Set the board name appropriately for the board revision that
> is detected.
>
> Update the findfdt macro to load the a4 device tree binary.
>
> Signed-off-by: Dan Murphy <dmurphy@ti.com>
Running checkpatch.pl:
total: 0 errors, 7 warnings, 1 checks, 97 lines checked
Please fix, thanks.
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130613/49804ecb/attachment.pgp>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-06-13 12:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-12 17:54 [U-Boot] [PATCH] arm: omap4: panda: Add reading of the board revision Dan Murphy
2013-06-13 12:42 ` Dan Murphy
2013-06-13 12:47 ` Tom Rini
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.