Skip to contentSkip to conversation

VIM3: mmc_get_env_dev correct non emmc boot sources

PATCH In review Artem Lapkin 3 participants 3 messages May 27, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 VIM3: mmc_get_env_dev correct non emmc boot sources

need return -1 if boot source is not EMMC or SD ( for example it will be useful if we have multy env sources configuration and device was booted from SPI flash and env need read from SPI not from mmc )

---
 board/amlogic/vim3/vim3.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
board/amlogic/vim3/vim3.c +8 -2
index 6cd5f2e1..71aaa0d8 100644
@@ -19,9 +19,15 @@
 
 int mmc_get_env_dev(void)
 {
-	if (meson_get_boot_device() == BOOT_DEVICE_EMMC)
+	switch (meson_get_boot_device()) {
+	case BOOT_DEVICE_EMMC:
 		return 2;
-	return 1;
+	case BOOT_DEVICE_SD:
+		return 1;
+	default:
+		/* boot device is not EMMC|SD */
+		return -1;
+	}
 }
 
 /*
Signature · 1 line
2.25.1
#1 lore raw
Quoted 22 lines · Artem Lapkin

need return -1 if boot source is not EMMC or SD ( for example it will be useful if we have multy env sources configuration and device was booted from SPI flash and env need read from SPI not from mmc )

---
 board/amlogic/vim3/vim3.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
board/amlogic/vim3/vim3.c +2 -1
index 6cd5f2e1..71aaa0d8 100644
@@ -19,9 +19,15 @@
 
 int mmc_get_env_dev(void)
 {
-	if (meson_get_boot_device() == BOOT_DEVICE_EMMC)
+	switch (meson_get_boot_device()) {
+	case BOOT_DEVICE_EMMC:
 		return 2;

board/amlogic/vim3/vim3.c line 33

Quoted 10 lines
board/amlogic/vim3/vim3.c +6 -1
-	return 1;
+	case BOOT_DEVICE_SD:
+		return 1;
+	default:
+		/* boot device is not EMMC|SD */
+		return -1;
+	}
 }
 
 /*

Looks fine, I'll let other comment on it and apply it if it's ok for everyone,

Neil

Reviewed-by on v1 1/1
#2 lore raw
In reply to Artem Lapkin
Quoted 5 lines · Artem Lapkin

need return -1 if boot source is not EMMC or SD ( for example it will be useful if we have multy env sources configuration and device was booted from SPI flash and env need read from SPI not from mmc )

Best Regards,
Jaehoon Chung

Quoted 27 lines
---
 board/amlogic/vim3/vim3.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
board/amlogic/vim3/vim3.c +8 -2
index 6cd5f2e1..71aaa0d8 100644
@@ -19,9 +19,15 @@
 
 int mmc_get_env_dev(void)
 {
-	if (meson_get_boot_device() == BOOT_DEVICE_EMMC)
+	switch (meson_get_boot_device()) {
+	case BOOT_DEVICE_EMMC:
 		return 2;
-	return 1;
+	case BOOT_DEVICE_SD:
+		return 1;
+	default:
+		/* boot device is not EMMC|SD */
+		return -1;
+	}
 }
 
 /*