meta-aspeed: add CONFIG_USE_BOOTCOMMAND snippet

Add a config snippet that sets CONFIG_BOOTCOMMAND to the correct address
on 128MiB flashes.

This requires a refresh of the u-boot sdk patch we've been carrying such
that CONFIG_BOOTCOMMAND is set conditionally if not set previously.

(From meta-aspeed rev: 4c8b1d729b5b21c93685cd1b1bdde05afa81f9e8)

Change-Id: I7dece4bcee6d68a0367fcf4eafb78f0db3e4e4f8
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/meta-aspeed/recipes-bsp/u-boot/files/0001-arm-evb-ast2600-put-environment-back-at-512KiB.patch b/meta-aspeed/recipes-bsp/u-boot/files/0001-arm-evb-ast2600-put-environment-back-at-512KiB.patch
index aa56af7..e010f26 100644
--- a/meta-aspeed/recipes-bsp/u-boot/files/0001-arm-evb-ast2600-put-environment-back-at-512KiB.patch
+++ b/meta-aspeed/recipes-bsp/u-boot/files/0001-arm-evb-ast2600-put-environment-back-at-512KiB.patch
@@ -1,36 +1,31 @@
-From c89683eaf94f1f9ac899963c518d10f8abfaf00b Mon Sep 17 00:00:00 2001
+From 2add5b8d1216be2e446a3d707767c2a5ec6be9f4 Mon Sep 17 00:00:00 2001
 From: Brad Bishop <bradleyb@fuzziesquirrel.com>
 Date: Thu, 5 Sep 2019 20:39:57 -0400
-Subject: [PATCH v3 u-boot aspeed-dev-v2019.04] arm: evb-ast2600: put
- environment back at 512KiB
+Subject: [PATCH u-boot aspeed-dev-v2019.04] arm: evb-ast2600: put environment
+ back at 512KiB
 
 Prior to 473f430b90 the environment was at 512KiB, and compatible with
 OpenBMC.  Restore OpenBMC compatibility by moving the environment back
 to 512KiB.
 
-Upstream-Status: Pending
-Upstream-Status: https://github.com/AspeedTech-BMC/u-boot/pull/1
 Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
 ---
-v3:
-  -apply bootm address parameter change globally in aspeed-common.h
-v2:
-  -adjusted bootcmd fit address to match new image location
----
- include/configs/aspeed-common.h | 2 +-
+ include/configs/aspeed-common.h | 4 +++-
  include/configs/evb_ast2600.h   | 2 +-
- 2 files changed, 2 insertions(+), 2 deletions(-)
+ 2 files changed, 4 insertions(+), 2 deletions(-)
 
 diff --git a/include/configs/aspeed-common.h b/include/configs/aspeed-common.h
-index 7a730d17ad..7b8b2a118d 100644
+index 7a730d17ad..d1eb4688e6 100644
 --- a/include/configs/aspeed-common.h
 +++ b/include/configs/aspeed-common.h
-@@ -52,7 +52,7 @@
+@@ -52,7 +52,9 @@
  /*
   * Miscellaneous configurable options
   */
 -#define CONFIG_BOOTCOMMAND		"bootm 200a0000"
++#ifndef CONFIG_BOOTCOMMAND
 +#define CONFIG_BOOTCOMMAND		"bootm 20080000"
++#endif
  #define CONFIG_ENV_OVERWRITE
  
  #define CONFIG_SYS_BOOTM_LEN 		(0x800000 * 2)
diff --git a/meta-aspeed/recipes-bsp/u-boot/u-boot-aspeed-sdk/flash-131072/bootcmd.cfg b/meta-aspeed/recipes-bsp/u-boot/u-boot-aspeed-sdk/flash-131072/bootcmd.cfg
new file mode 100644
index 0000000..6862aae
--- /dev/null
+++ b/meta-aspeed/recipes-bsp/u-boot/u-boot-aspeed-sdk/flash-131072/bootcmd.cfg
@@ -0,0 +1,2 @@
+CONFIG_USE_BOOTCOMMAND=y
+CONFIG_BOOTCOMMAND="bootm 20100000"
diff --git a/meta-aspeed/recipes-bsp/u-boot/u-boot-common-aspeed-sdk_2019.04.inc b/meta-aspeed/recipes-bsp/u-boot/u-boot-common-aspeed-sdk_2019.04.inc
index 83341e4..31dc5f2 100644
--- a/meta-aspeed/recipes-bsp/u-boot/u-boot-common-aspeed-sdk_2019.04.inc
+++ b/meta-aspeed/recipes-bsp/u-boot/u-boot-common-aspeed-sdk_2019.04.inc
@@ -14,6 +14,11 @@
 SRC_URI = "git://github.com/AspeedTech-BMC/u-boot;branch=${UBRANCH};protocol=https"
 SRC_URI += "file://0001-arm-evb-ast2600-put-environment-back-at-512KiB.patch"
 
+# There are different BOOTCOMMANDS for differently sized raw flash modules.
+ASPEED_IMAGE_SIZE_KB ?= "32768"
+MACHINEOVERRIDES .= ":flash-${ASPEED_IMAGE_SIZE_KB}"
+SRC_URI_append_flash-131072 = " file://bootcmd.cfg"
+
 S = "${WORKDIR}/git"
 
 PV = "v2019.04+git${SRCPV}"