ARM: ti: consolidate dfu environment variables
authorSekhar Nori <nsekhar@ti.com>
Fri, 25 Nov 2016 08:55:54 +0000 (14:25 +0530)
committerTom Rini <trini@konsulko.com>
Sat, 3 Dec 2016 02:32:37 +0000 (21:32 -0500)
Introduce include/environment/ti/dfu.h that
consolidates environment variable definitions
for various TI boards that support DFU today.

Tested on AM335x EVM, AM437x SK EVM and DRA74x
EVM by using DFU to write to SD card.

Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
include/configs/am335x_evm.h
include/configs/am43xx_evm.h
include/configs/dra7xx_evm.h
include/configs/omap5_uevm.h
include/environment/ti/dfu.h [new file with mode: 0644]

index 8fa8e39..27d26af 100644 (file)
@@ -17,6 +17,7 @@
 #define __CONFIG_AM335X_EVM_H
 
 #include <configs/ti_am335x_common.h>
 #define __CONFIG_AM335X_EVM_H
 
 #include <configs/ti_am335x_common.h>
+#include <environment/ti/dfu.h>
 
 #ifndef CONFIG_SPL_BUILD
 # define CONFIG_TIMESTAMP
 
 #ifndef CONFIG_SPL_BUILD
 # define CONFIG_TIMESTAMP
 
 /* USB Device Firmware Update support */
 #ifndef CONFIG_SPL_BUILD
 
 /* USB Device Firmware Update support */
 #ifndef CONFIG_SPL_BUILD
-#define DFU_ALT_INFO_MMC \
-       "dfu_alt_info_mmc=" \
-       "boot part 0 1;" \
-       "rootfs part 0 2;" \
-       "MLO fat 0 1;" \
-       "MLO.raw raw 0x100 0x100;" \
-       "u-boot.img.raw raw 0x300 0x400;" \
-       "spl-os-args.raw raw 0x80 0x80;" \
-       "spl-os-image.raw raw 0x900 0x2000;" \
-       "spl-os-args fat 0 1;" \
-       "spl-os-image fat 0 1;" \
-       "u-boot.img fat 0 1;" \
-       "uEnv.txt fat 0 1\0"
-#ifdef CONFIG_NAND
-#define DFU_ALT_INFO_NAND \
-       "dfu_alt_info_nand=" \
-       "SPL part 0 1;" \
-       "SPL.backup1 part 0 2;" \
-       "SPL.backup2 part 0 3;" \
-       "SPL.backup3 part 0 4;" \
-       "u-boot part 0 5;" \
-       "u-boot-spl-os part 0 6;" \
-       "kernel part 0 8;" \
-       "rootfs part 0 9\0"
-#else
-#define DFU_ALT_INFO_NAND ""
-#endif
-#define DFU_ALT_INFO_RAM \
-       "dfu_alt_info_ram=" \
-       "kernel ram 0x80200000 0xD80000;" \
-       "fdt ram 0x80F80000 0x80000;" \
-       "ramdisk ram 0x81000000 0x4000000\0"
 #define DFUARGS \
        "dfu_alt_info_emmc=rawemmc raw 0 3751936\0" \
        DFU_ALT_INFO_MMC \
 #define DFUARGS \
        "dfu_alt_info_emmc=rawemmc raw 0 3751936\0" \
        DFU_ALT_INFO_MMC \
index 0a6c06a..6416d55 100644 (file)
@@ -14,6 +14,7 @@
 #define CONFIG_MAX_RAM_BANK_SIZE       (1024 << 21)    /* 2GB */
 #define CONFIG_SYS_TIMERBASE           0x48040000      /* Use Timer2 */
 
 #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 */
 #include <asm/arch/omap.h>
 
 /* NS16550 Configuration */
 
 #ifndef CONFIG_SPL_BUILD
 /* USB Device Firmware Update support */
 
 #ifndef CONFIG_SPL_BUILD
 /* USB Device Firmware Update support */
-
-#define DFU_ALT_INFO_MMC \
-       "dfu_alt_info_mmc=" \
-       "boot part 0 1;" \
-       "rootfs part 0 2;" \
-       "MLO fat 0 1;" \
-       "spl-os-args fat 0 1;" \
-       "spl-os-image fat 0 1;" \
-       "u-boot.img fat 0 1;" \
-       "uEnv.txt fat 0 1\0"
-
-#define DFU_ALT_INFO_EMMC \
-       "dfu_alt_info_emmc=" \
-       "MLO raw 0x100 0x100 mmcpart 0;" \
-       "u-boot.img raw 0x300 0x1000 mmcpart 0\0"
-
-#define DFU_ALT_INFO_RAM \
-       "dfu_alt_info_ram=" \
-       "kernel ram 0x80200000 0x4000000;" \
-       "fdt ram 0x80f80000 0x80000;" \
-       "ramdisk ram 0x81000000 0x4000000\0"
-
-#define DFU_ALT_INFO_QSPI \
-       "dfu_alt_info_qspi=" \
-       "u-boot.bin raw 0x0 0x080000;" \
-       "u-boot.backup raw 0x080000 0x080000;" \
-       "u-boot-spl-os raw 0x100000 0x010000;" \
-       "u-boot-env raw 0x110000 0x010000;" \
-       "u-boot-env.backup raw 0x120000 0x010000;" \
-       "kernel raw 0x130000 0x800000\0"
-
 #define DFUARGS \
        "dfu_bufsiz=0x10000\0" \
        DFU_ALT_INFO_MMC \
        DFU_ALT_INFO_EMMC \
        DFU_ALT_INFO_RAM \
 #define DFUARGS \
        "dfu_bufsiz=0x10000\0" \
        DFU_ALT_INFO_MMC \
        DFU_ALT_INFO_EMMC \
        DFU_ALT_INFO_RAM \
-       DFU_ALT_INFO_QSPI
+       DFU_ALT_INFO_QSPI_XIP
 #else
 #define DFUARGS
 #endif
 #else
 #define DFUARGS
 #endif
index 75a7854..980ab40 100644 (file)
@@ -12,6 +12,8 @@
 #ifndef __CONFIG_DRA7XX_EVM_H
 #define __CONFIG_DRA7XX_EVM_H
 
 #ifndef __CONFIG_DRA7XX_EVM_H
 #define __CONFIG_DRA7XX_EVM_H
 
+#include <environment/ti/dfu.h>
+
 #define CONFIG_DRA7XX
 #define CONFIG_BOARD_EARLY_INIT_F
 
 #define CONFIG_DRA7XX
 #define CONFIG_BOARD_EARLY_INIT_F
 
        "name=ipu2,size=1M,uuid=${uuid_gpt_ipu2};" \
        "name=userdata,size=-,uuid=${uuid_gpt_userdata}"
 
        "name=ipu2,size=1M,uuid=${uuid_gpt_ipu2};" \
        "name=userdata,size=-,uuid=${uuid_gpt_userdata}"
 
-#define DFU_ALT_INFO_MMC \
-       "dfu_alt_info_mmc=" \
-       "boot part 0 1;" \
-       "rootfs part 0 2;" \
-       "MLO fat 0 1;" \
-       "MLO.raw raw 0x100 0x100;" \
-       "u-boot.img.raw raw 0x300 0x400;" \
-       "spl-os-args.raw raw 0x80 0x80;" \
-       "spl-os-image.raw raw 0x900 0x2000;" \
-       "spl-os-args fat 0 1;" \
-       "spl-os-image fat 0 1;" \
-       "u-boot.img fat 0 1;" \
-       "uEnv.txt fat 0 1\0"
-
-#define DFU_ALT_INFO_EMMC \
-       "dfu_alt_info_emmc=" \
-       "rawemmc raw 0 3751936;" \
-       "boot part 1 1;" \
-       "rootfs part 1 2;" \
-       "MLO fat 1 1;" \
-       "MLO.raw raw 0x100 0x100;" \
-       "u-boot.img.raw raw 0x300 0x400;" \
-       "spl-os-args.raw raw 0x80 0x80;" \
-       "spl-os-image.raw raw 0x900 0x2000;" \
-       "spl-os-args fat 1 1;" \
-       "spl-os-image fat 1 1;" \
-       "u-boot.img fat 1 1;" \
-       "uEnv.txt fat 1 1\0"
-
-#define DFU_ALT_INFO_RAM \
-       "dfu_alt_info_ram=" \
-       "kernel ram 0x80200000 0x4000000;" \
-       "fdt ram 0x80f80000 0x80000;" \
-       "ramdisk ram 0x81000000 0x4000000\0"
-
-#define DFU_ALT_INFO_QSPI \
-       "dfu_alt_info_qspi=" \
-       "MLO raw 0x0 0x040000;" \
-       "u-boot.img raw 0x040000 0x0100000;" \
-       "u-boot-spl-os raw 0x140000 0x080000;" \
-       "u-boot-env raw 0x1C0000 0x010000;" \
-       "u-boot-env.backup raw 0x1D0000 0x010000;" \
-       "kernel raw 0x1E0000 0x800000\0"
-
 #define DFUARGS \
        "dfu_bufsiz=0x10000\0" \
        DFU_ALT_INFO_MMC \
 #define DFUARGS \
        "dfu_bufsiz=0x10000\0" \
        DFU_ALT_INFO_MMC \
 #undef CONFIG_CMD_BOOTD
 #ifdef CONFIG_SPL_DFU_SUPPORT
 #define CONFIG_SPL_LOAD_FIT_ADDRESS 0x80200000
 #undef CONFIG_CMD_BOOTD
 #ifdef CONFIG_SPL_DFU_SUPPORT
 #define CONFIG_SPL_LOAD_FIT_ADDRESS 0x80200000
-#define DFU_ALT_INFO_RAM \
-       "dfu_alt_info_ram=" \
-       "kernel ram 0x80200000 0x4000000;" \
-       "fdt ram 0x80f80000 0x80000;" \
-       "ramdisk ram 0x81000000 0x4000000\0"
 #define DFUARGS \
        "dfu_bufsiz=0x10000\0" \
        DFU_ALT_INFO_RAM
 #define DFUARGS \
        "dfu_bufsiz=0x10000\0" \
        DFU_ALT_INFO_RAM
index 22614fb..736d804 100644 (file)
@@ -12,6 +12,8 @@
 #ifndef __CONFIG_OMAP5_EVM_H
 #define __CONFIG_OMAP5_EVM_H
 
 #ifndef __CONFIG_OMAP5_EVM_H
 #define __CONFIG_OMAP5_EVM_H
 
+#include <environment/ti/dfu.h>
+
 #ifndef CONFIG_SPL_BUILD
 /* Define the default GPT table for eMMC */
 #define PARTS_DEFAULT \
 #ifndef CONFIG_SPL_BUILD
 /* Define the default GPT table for eMMC */
 #define PARTS_DEFAULT \
        "name=rootfs,start=2MiB,size=-,uuid=${uuid_gpt_rootfs}"
 #endif
 
        "name=rootfs,start=2MiB,size=-,uuid=${uuid_gpt_rootfs}"
 #endif
 
-#define DFU_ALT_INFO_MMC \
-       "dfu_alt_info_mmc=" \
-       "boot part 0 1;" \
-       "rootfs part 0 2;" \
-       "MLO fat 0 1;" \
-       "MLO.raw raw 0x100 0x100;" \
-       "u-boot.img.raw raw 0x300 0x400;" \
-       "spl-os-args.raw raw 0x80 0x80;" \
-       "spl-os-image.raw raw 0x900 0x2000;" \
-       "spl-os-args fat 0 1;" \
-       "spl-os-image fat 0 1;" \
-       "u-boot.img fat 0 1;" \
-       "uEnv.txt fat 0 1\0"
-
-#define DFU_ALT_INFO_EMMC \
-       "dfu_alt_info_emmc=" \
-       "rawemmc raw 0 3751936;" \
-       "boot part 1 1;" \
-       "rootfs part 1 2;" \
-       "MLO fat 1 1;" \
-       "MLO.raw raw 0x100 0x100;" \
-       "u-boot.img.raw raw 0x300 0x400;" \
-       "spl-os-args.raw raw 0x80 0x80;" \
-       "spl-os-image.raw raw 0x900 0x2000;" \
-       "spl-os-args fat 1 1;" \
-       "spl-os-image fat 1 1;" \
-       "u-boot.img fat 1 1;" \
-       "uEnv.txt fat 1 1\0"
-
-#define DFU_ALT_INFO_RAM \
-       "dfu_alt_info_ram=" \
-       "kernel ram 0x80200000 0x4000000;" \
-       "fdt ram 0x80f80000 0x80000;" \
-       "ramdisk ram 0x81000000 0x4000000\0"
-
 #define DFUARGS \
        "dfu_bufsiz=0x10000\0" \
        DFU_ALT_INFO_MMC \
 #define DFUARGS \
        "dfu_bufsiz=0x10000\0" \
        DFU_ALT_INFO_MMC \
diff --git a/include/environment/ti/dfu.h b/include/environment/ti/dfu.h
new file mode 100644 (file)
index 0000000..caf71a3
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2016 Texas Instruments Incorporated - http://www.ti.com
+ *
+ * Environment variable definitions for DFU on TI boards.
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#define DFU_ALT_INFO_MMC \
+       "dfu_alt_info_mmc=" \
+       "boot part 0 1;" \
+       "rootfs part 0 2;" \
+       "MLO fat 0 1;" \
+       "MLO.raw raw 0x100 0x100;" \
+       "u-boot.img.raw raw 0x300 0x400;" \
+       "spl-os-args.raw raw 0x80 0x80;" \
+       "spl-os-image.raw raw 0x900 0x2000;" \
+       "spl-os-args fat 0 1;" \
+       "spl-os-image fat 0 1;" \
+       "u-boot.img fat 0 1;" \
+       "uEnv.txt fat 0 1\0"
+
+#define DFU_ALT_INFO_EMMC \
+       "dfu_alt_info_emmc=" \
+       "rawemmc raw 0 3751936;" \
+       "boot part 1 1;" \
+       "rootfs part 1 2;" \
+       "MLO fat 1 1;" \
+       "MLO.raw raw 0x100 0x100;" \
+       "u-boot.img.raw raw 0x300 0x1000;" \
+       "spl-os-args.raw raw 0x80 0x80;" \
+       "spl-os-image.raw raw 0x900 0x2000;" \
+       "spl-os-args fat 1 1;" \
+       "spl-os-image fat 1 1;" \
+       "u-boot.img fat 1 1;" \
+       "uEnv.txt fat 1 1\0"
+
+#ifdef CONFIG_NAND
+#define DFU_ALT_INFO_NAND \
+       "dfu_alt_info_nand=" \
+       "SPL part 0 1;" \
+       "SPL.backup1 part 0 2;" \
+       "SPL.backup2 part 0 3;" \
+       "SPL.backup3 part 0 4;" \
+       "u-boot part 0 5;" \
+       "u-boot-spl-os part 0 6;" \
+       "kernel part 0 8;" \
+       "rootfs part 0 9\0"
+#else
+#define DFU_ALT_INFO_NAND ""
+#endif
+
+#define DFU_ALT_INFO_RAM \
+       "dfu_alt_info_ram=" \
+       "kernel ram 0x80200000 0x4000000;" \
+       "fdt ram 0x80f80000 0x80000;" \
+       "ramdisk ram 0x81000000 0x4000000\0"
+
+#define DFU_ALT_INFO_QSPI_XIP \
+       "dfu_alt_info_qspi=" \
+       "u-boot.bin raw 0x0 0x080000;" \
+       "u-boot.backup raw 0x080000 0x080000;" \
+       "u-boot-spl-os raw 0x100000 0x010000;" \
+       "u-boot-env raw 0x110000 0x010000;" \
+       "u-boot-env.backup raw 0x120000 0x010000;" \
+       "kernel raw 0x130000 0x800000\0"
+
+#define DFU_ALT_INFO_QSPI \
+       "dfu_alt_info_qspi=" \
+       "MLO raw 0x0 0x040000;" \
+       "u-boot.img raw 0x040000 0x0100000;" \
+       "u-boot-spl-os raw 0x140000 0x080000;" \
+       "u-boot-env raw 0x1C0000 0x010000;" \
+       "u-boot-env.backup raw 0x1D0000 0x010000;" \
+       "kernel raw 0x1E0000 0x800000\0"