summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorMoritz Fischer <moritz.fischer@ettus.com>2016-11-03 08:53:52 -0600
committerSimon Glass <sjg@chromium.org>2016-12-02 21:04:48 -0700
commita2558e8729831e0bcef634ea2440e60425ef0ff6 (patch)
treea653a4011ade2643c20658abaa19ec933605bf73 /cmd
parentae6acf9fe2c83370159724855b7fdbb350ae99b9 (diff)
downloadu-boot-a2558e8729831e0bcef634ea2440e60425ef0ff6.tar.gz
cmd: crosec: Move cros_ec_decode_region helper to cmd/cros_ec.c
The cros_ec_decode_region() function is only used in combination with the crosec cmds. Move the function to the correct place. Signed-off-by: Moritz Fischer <moritz.fischer@ettus.com> Cc: Simon Glass <sjg@chromium.org> Cc: Masahiro Yamada <yamada.masahiro@socionext.com> Cc: u-boot@lists.denx.de Acked-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/cros_ec.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/cmd/cros_ec.c b/cmd/cros_ec.c
index abf11f07b2..9d42f870dc 100644
--- a/cmd/cros_ec.c
+++ b/cmd/cros_ec.c
@@ -20,6 +20,29 @@ static const char * const ec_current_image_name[] = {"unknown", "RO", "RW"};
DECLARE_GLOBAL_DATA_PTR;
/**
+ * Decode a flash region parameter
+ *
+ * @param argc Number of params remaining
+ * @param argv List of remaining parameters
+ * @return flash region (EC_FLASH_REGION_...) or -1 on error
+ */
+static int cros_ec_decode_region(int argc, char * const argv[])
+{
+ if (argc > 0) {
+ if (0 == strcmp(*argv, "rw"))
+ return EC_FLASH_REGION_RW;
+ else if (0 == strcmp(*argv, "ro"))
+ return EC_FLASH_REGION_RO;
+
+ debug("%s: Invalid region '%s'\n", __func__, *argv);
+ } else {
+ debug("%s: Missing region parameter\n", __func__);
+ }
+
+ return -1;
+}
+
+/**
* Perform a flash read or write command
*
* @param dev CROS-EC device to read/write