diff mbox

[U-Boot,V2] OMAP3SOM BOARD: Auto detect Logic PD Models

Message ID 1455767389-17173-1-git-send-email-aford173@gmail.com
State Accepted
Commit 26ef7a27dade2c4cdf16579c8dc1375e0635face
Delegated to: Tom Rini
Headers show

Commit Message

Adam Ford Feb. 18, 2016, 3:49 a.m. UTC
Logic PD makes four different system on modules.  This patch will auto
detect the board type and identify the corresponding device tree image.

V2:
Added 'default:' case to switch statement
Since board_late_init() is defined as int, we now return 0

Signed-off-by: Derald Woods <woods.technical@gmail.com>
Signed-off-by: Adam Ford <aford173@gmail.com>
---
 board/logicpd/omap3som/omap3logic.c | 24 ++++++++++++++++++++++++
 include/configs/omap3_logic.h       |  2 +-
 2 files changed, 25 insertions(+), 1 deletion(-)

Comments

Adam Ford Feb. 24, 2016, 1:08 p.m. UTC | #1
Tom,

Just a gentle nudge to see if I've addressed all your previous
concerns.  There is a default case and a return code since the
function is defined as int.

adam

On Wed, Feb 17, 2016 at 9:49 PM, Adam Ford <aford173@gmail.com> wrote:
> Logic PD makes four different system on modules.  This patch will auto
> detect the board type and identify the corresponding device tree image.
>
> V2:
> Added 'default:' case to switch statement
> Since board_late_init() is defined as int, we now return 0
>
> Signed-off-by: Derald Woods <woods.technical@gmail.com>
> Signed-off-by: Adam Ford <aford173@gmail.com>
> ---
>  board/logicpd/omap3som/omap3logic.c | 24 ++++++++++++++++++++++++
>  include/configs/omap3_logic.h       |  2 +-
>  2 files changed, 25 insertions(+), 1 deletion(-)
>
> diff --git a/board/logicpd/omap3som/omap3logic.c b/board/logicpd/omap3som/omap3logic.c
> index b5c44f9..668f684 100644
> --- a/board/logicpd/omap3som/omap3logic.c
> +++ b/board/logicpd/omap3som/omap3logic.c
> @@ -228,6 +228,30 @@ int board_init(void)
>         return 0;
>  }
>
> +#ifdef CONFIG_BOARD_LATE_INIT
> +int board_late_init(void)
> +{
> +       switch (gd->bd->bi_arch_number) {
> +       case MACH_TYPE_DM3730_TORPEDO:
> +               setenv("fdtimage", "logicpd-torpedo-37xx-devkit.dtb");
> +               break;
> +       case MACH_TYPE_DM3730_SOM_LV:
> +               setenv("fdtimage", "logicpd-som-lv-37xx-devkit.dtb");
> +               break;
> +       case MACH_TYPE_OMAP3_TORPEDO:
> +               setenv("fdtimage", "logicpd-torpedo-35xx-devkit.dtb");
> +               break;
> +       case MACH_TYPE_OMAP3530_LV_SOM:
> +               setenv("fdtimage", "logicpd-som-lv-35xx-devkit.dtb");
> +               break;
> +       default:
> +               /* unknown machine type */
> +               break;
> +       }
> +       return 0;
> +}
> +#endif
> +
>  #if defined(CONFIG_GENERIC_MMC) && !defined(CONFIG_SPL_BUILD)
>  int board_mmc_init(bd_t *bis)
>  {
> diff --git a/include/configs/omap3_logic.h b/include/configs/omap3_logic.h
> index fba2a12..0fc9d1c 100644
> --- a/include/configs/omap3_logic.h
> +++ b/include/configs/omap3_logic.h
> @@ -40,7 +40,7 @@
>
>  #define CONFIG_DISPLAY_CPUINFO
>  #define CONFIG_DISPLAY_BOARDINFO
> -
> +#define CONFIG_BOARD_LATE_INIT
>  #define CONFIG_MISC_INIT_R             /* misc_init_r dumps the die id */
>  #define CONFIG_CMDLINE_TAG             /* enable passing of ATAGs */
>  #define CONFIG_SETUP_MEMORY_TAGS
> --
> 1.9.1
>
Tom Rini Feb. 25, 2016, 3:24 p.m. UTC | #2
On Wed, Feb 17, 2016 at 09:49:49PM -0600, Adam Ford wrote:

> Logic PD makes four different system on modules.  This patch will auto
> detect the board type and identify the corresponding device tree image.
> 
> V2:
> Added 'default:' case to switch statement
> Since board_late_init() is defined as int, we now return 0
> 
> Signed-off-by: Derald Woods <woods.technical@gmail.com>
> Signed-off-by: Adam Ford <aford173@gmail.com>

Applied to u-boot/master, thanks!
diff mbox

Patch

diff --git a/board/logicpd/omap3som/omap3logic.c b/board/logicpd/omap3som/omap3logic.c
index b5c44f9..668f684 100644
--- a/board/logicpd/omap3som/omap3logic.c
+++ b/board/logicpd/omap3som/omap3logic.c
@@ -228,6 +228,30 @@  int board_init(void)
 	return 0;
 }
 
+#ifdef CONFIG_BOARD_LATE_INIT
+int board_late_init(void)
+{
+	switch (gd->bd->bi_arch_number) {
+	case MACH_TYPE_DM3730_TORPEDO:
+		setenv("fdtimage", "logicpd-torpedo-37xx-devkit.dtb");
+		break;
+	case MACH_TYPE_DM3730_SOM_LV:
+		setenv("fdtimage", "logicpd-som-lv-37xx-devkit.dtb");
+		break;
+	case MACH_TYPE_OMAP3_TORPEDO:
+		setenv("fdtimage", "logicpd-torpedo-35xx-devkit.dtb");
+		break;
+	case MACH_TYPE_OMAP3530_LV_SOM:
+		setenv("fdtimage", "logicpd-som-lv-35xx-devkit.dtb");
+		break;
+	default:
+		/* unknown machine type */
+		break;
+	}
+	return 0;
+}
+#endif
+
 #if defined(CONFIG_GENERIC_MMC) && !defined(CONFIG_SPL_BUILD)
 int board_mmc_init(bd_t *bis)
 {
diff --git a/include/configs/omap3_logic.h b/include/configs/omap3_logic.h
index fba2a12..0fc9d1c 100644
--- a/include/configs/omap3_logic.h
+++ b/include/configs/omap3_logic.h
@@ -40,7 +40,7 @@ 
 
 #define CONFIG_DISPLAY_CPUINFO
 #define CONFIG_DISPLAY_BOARDINFO
-
+#define CONFIG_BOARD_LATE_INIT
 #define CONFIG_MISC_INIT_R		/* misc_init_r dumps the die id */
 #define CONFIG_CMDLINE_TAG		/* enable passing of ATAGs */
 #define CONFIG_SETUP_MEMORY_TAGS