ARM: ti: consolidate mmc environment variables
authorSekhar Nori <nsekhar@ti.com>
Thu, 6 Apr 2017 09:22:56 +0000 (14:52 +0530)
committerTom Rini <trini@konsulko.com>
Sun, 9 Apr 2017 01:33:12 +0000 (21:33 -0400)
Introduce include/environment/ti/mmc.h that
consolidates environment variable definitions
for various TI boards that support MMC/SD.

This allows reuse of same environment variables
on non-ARMv7 TI platforms like OMAP-L138 for
example.

While at it, move DFU-related environment variable
includes to only non-SPL builds for AM335x and
AM437x since they are not really used for SPL
today.

Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
include/configs/am335x_evm.h
include/configs/am43xx_evm.h
include/configs/k2g_evm.h
include/configs/ti_armv7_common.h
include/configs/ti_omap4_common.h
include/configs/ti_omap5_common.h
include/environment/ti/mmc.h [new file with mode: 0644]

index 5fbc1e3ff95f2abdabf3447d7061399cf24e7882..fc8a08f5b79971faa04649d55607f59020cc44aa 100644 (file)
@@ -17,7 +17,6 @@
 #define __CONFIG_AM335X_EVM_H
 
 #include <configs/ti_am335x_common.h>
-#include <environment/ti/dfu.h>
 
 #ifndef CONFIG_SPL_BUILD
 # define CONFIG_TIMESTAMP
@@ -96,6 +95,9 @@
 #include <config_distro_bootcmd.h>
 
 #ifndef CONFIG_SPL_BUILD
+#include <environment/ti/dfu.h>
+#include <environment/ti/mmc.h>
+
 #define CONFIG_EXTRA_ENV_SETTINGS \
        DEFAULT_LINUX_BOOT_ENV \
        DEFAULT_MMC_TI_ARGS \
index ec99958fcd5027cb5e8cd06f261bc26ab01bf224..1feb94683435047a3f62f8c0ce4c9bb7d6792078 100644 (file)
@@ -13,7 +13,6 @@
 #define CONFIG_MAX_RAM_BANK_SIZE       (1024 << 21)    /* 2GB */
 #define CONFIG_SYS_TIMERBASE           0x48040000      /* Use Timer2 */
 
-#include <environment/ti/dfu.h>
 #include <asm/arch/omap.h>
 
 /* NS16550 Configuration */
 #define CONFIG_TI_EDMA3
 
 #ifndef CONFIG_SPL_BUILD
+#include <environment/ti/dfu.h>
+#include <environment/ti/mmc.h>
+
 #define CONFIG_EXTRA_ENV_SETTINGS \
        DEFAULT_LINUX_BOOT_ENV \
        DEFAULT_MMC_TI_ARGS \
index 9e5949e3706b5eeab55202311879491703202551..bee1be794bafd7aa441733e1911e9b2f88b55102 100644 (file)
@@ -10,6 +10,7 @@
 #ifndef __CONFIG_K2G_EVM_H
 #define __CONFIG_K2G_EVM_H
 
+#include <environment/ti/mmc.h>
 #include <environment/ti/spi.h>
 
 /* Platform type */
index b2950efd47dbab29de246f476673dccd946a9e96..8f5b6c155bc5bf11acb425d3faf64627c641b361 100644 (file)
        "bootm_size=0x10000000\0" \
        "boot_fdt=try\0"
 
-#define DEFAULT_MMC_TI_ARGS \
-       "mmcdev=0\0" \
-       "mmcrootfstype=ext4 rootwait\0" \
-       "finduuid=part uuid mmc ${bootpart} uuid\0" \
-       "args_mmc=run finduuid;setenv bootargs console=${console} " \
-               "${optargs} " \
-               "root=PARTUUID=${uuid} rw " \
-               "rootfstype=${mmcrootfstype}\0" \
-       "loadbootscript=load mmc ${mmcdev} ${loadaddr} boot.scr\0" \
-       "bootscript=echo Running bootscript from mmc${mmcdev} ...; " \
-               "source ${loadaddr}\0" \
-       "bootenvfile=uEnv.txt\0" \
-       "importbootenv=echo Importing environment from mmc${mmcdev} ...; " \
-               "env import -t ${loadaddr} ${filesize}\0" \
-       "loadbootenv=fatload mmc ${mmcdev} ${loadaddr} ${bootenvfile}\0" \
-       "loadimage=load ${devtype} ${bootpart} ${loadaddr} ${bootdir}/${bootfile}\0" \
-       "loadfdt=load ${devtype} ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}\0" \
-       "envboot=mmc dev ${mmcdev}; " \
-               "if mmc rescan; then " \
-                       "echo SD/MMC found on device ${mmcdev};" \
-                       "if run loadbootscript; then " \
-                               "run bootscript;" \
-                       "else " \
-                               "if run loadbootenv; then " \
-                                       "echo Loaded env from ${bootenvfile};" \
-                                       "run importbootenv;" \
-                               "fi;" \
-                               "if test -n $uenvcmd; then " \
-                                       "echo Running uenvcmd ...;" \
-                                       "run uenvcmd;" \
-                               "fi;" \
-                       "fi;" \
-               "fi;\0" \
-       "mmcloados=run args_mmc; " \
-               "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
-                       "if run loadfdt; then " \
-                               "bootz ${loadaddr} - ${fdtaddr}; " \
-                       "else " \
-                               "if test ${boot_fdt} = try; then " \
-                                       "bootz; " \
-                               "else " \
-                                       "echo WARN: Cannot load the DT; " \
-                               "fi; " \
-                       "fi; " \
-               "else " \
-                       "bootz; " \
-               "fi;\0" \
-       "mmcboot=mmc dev ${mmcdev}; " \
-               "setenv devnum ${mmcdev}; " \
-               "setenv devtype mmc; " \
-               "if mmc rescan; then " \
-                       "echo SD/MMC found on device ${mmcdev};" \
-                       "if run loadimage; then " \
-                               "if test ${boot_fit} -eq 1; then " \
-                                       "run loadfit; " \
-                               "else " \
-                                       "run mmcloados;" \
-                               "fi;" \
-                       "fi;" \
-               "fi;\0" \
-
 #define DEFAULT_FIT_TI_ARGS \
        "boot_fit=0\0" \
        "fit_loadaddr=0x88000000\0" \
index d07cb9ffb4b33146d52bc5d633a3963f10861eff..b85db500b574513752d29f82613fc4de805c5e50 100644 (file)
        "run distro_bootcmd"
 
 #include <config_distro_bootcmd.h>
+#include <environment/ti/mmc.h>
 
 #define CONFIG_EXTRA_ENV_SETTINGS \
        DEFAULT_LINUX_BOOT_ENV \
index 97bd874e6cdd4973ab9231528f686de63b5cf180..d45baabf0b60ef57697516363799c9613d5ff685 100644 (file)
@@ -58,6 +58,8 @@
 #define DFUARGS
 #endif
 
+#include <environment/ti/mmc.h>
+
 #define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
 #define CONFIG_EXTRA_ENV_SETTINGS \
        DEFAULT_LINUX_BOOT_ENV \
diff --git a/include/environment/ti/mmc.h b/include/environment/ti/mmc.h
new file mode 100644 (file)
index 0000000..b987f71
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2017 Texas Instruments Incorporated - http://www.ti.com
+ *
+ * Environment variable definitions for MMC/SD on TI boards.
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#define DEFAULT_MMC_TI_ARGS \
+       "mmcdev=0\0" \
+       "mmcrootfstype=ext4 rootwait\0" \
+       "finduuid=part uuid mmc ${bootpart} uuid\0" \
+       "args_mmc=run finduuid;setenv bootargs console=${console} " \
+               "${optargs} " \
+               "root=PARTUUID=${uuid} rw " \
+               "rootfstype=${mmcrootfstype}\0" \
+       "loadbootscript=load mmc ${mmcdev} ${loadaddr} boot.scr\0" \
+       "bootscript=echo Running bootscript from mmc${mmcdev} ...; " \
+               "source ${loadaddr}\0" \
+       "bootenvfile=uEnv.txt\0" \
+       "importbootenv=echo Importing environment from mmc${mmcdev} ...; " \
+               "env import -t ${loadaddr} ${filesize}\0" \
+       "loadbootenv=fatload mmc ${mmcdev} ${loadaddr} ${bootenvfile}\0" \
+       "loadimage=load ${devtype} ${bootpart} ${loadaddr} ${bootdir}/${bootfile}\0" \
+       "loadfdt=load ${devtype} ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}\0" \
+       "envboot=mmc dev ${mmcdev}; " \
+               "if mmc rescan; then " \
+                       "echo SD/MMC found on device ${mmcdev};" \
+                       "if run loadbootscript; then " \
+                               "run bootscript;" \
+                       "else " \
+                               "if run loadbootenv; then " \
+                                       "echo Loaded env from ${bootenvfile};" \
+                                       "run importbootenv;" \
+                               "fi;" \
+                               "if test -n $uenvcmd; then " \
+                                       "echo Running uenvcmd ...;" \
+                                       "run uenvcmd;" \
+                               "fi;" \
+                       "fi;" \
+               "fi;\0" \
+       "mmcloados=run args_mmc; " \
+               "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
+                       "if run loadfdt; then " \
+                               "bootz ${loadaddr} - ${fdtaddr}; " \
+                       "else " \
+                               "if test ${boot_fdt} = try; then " \
+                                       "bootz; " \
+                               "else " \
+                                       "echo WARN: Cannot load the DT; " \
+                               "fi; " \
+                       "fi; " \
+               "else " \
+                       "bootz; " \
+               "fi;\0" \
+       "mmcboot=mmc dev ${mmcdev}; " \
+               "setenv devnum ${mmcdev}; " \
+               "setenv devtype mmc; " \
+               "if mmc rescan; then " \
+                       "echo SD/MMC found on device ${mmcdev};" \
+                       "if run loadimage; then " \
+                               "if test ${boot_fit} -eq 1; then " \
+                                       "run loadfit; " \
+                               "else " \
+                                       "run mmcloados;" \
+                               "fi;" \
+                       "fi;" \
+               "fi;\0"