Clear OPROM_NEEDED on EC update before reboot

This patch makes ec_sync_all clear OPROM_NEEDED flag when
ec_sync_phase2 updates EC and requests reboot.

Without this change OPROM_NEEDED flag will stay forever because after
reboot need_wait_screen won't be set (thus line 90 won't be reached).

BUG=b:72387533
BRANCH=none
TEST=Verify firmware screens are displayed on type-c monitor:
developer warning screen, critical update screen, recovery screen.

Change-Id: I9cc072efbf937ac438b55f3812f677612f79eaf9
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/916635
Reviewed-by: Julius Werner <jwerner@chromium.org>
(cherry picked from commit cc441a0ea8b0e1a7a1802070dc6ca606d80c9148)
Reviewed-on: https://chromium-review.googlesource.com/884566
diff --git a/firmware/lib/ec_sync.c b/firmware/lib/ec_sync.c
index 83ad802..afa6f1e 100644
--- a/firmware/lib/ec_sync.c
+++ b/firmware/lib/ec_sync.c
@@ -255,6 +255,9 @@
 		 * TODO: Switch slot and proceed if EC is still in RO. */
 		if (is_rw_ab) {
 			VB2_DEBUG("Rebooting to jump to new EC-RW\n");
+			/* Since we're rebooting, ec_sync_all won't be given a
+			 * chance to clear the flag. Need to clear it here. */
+			vb2_nv_set(ctx, VB2_NV_OPROM_NEEDED, 0);
 			return VBERROR_EC_REBOOT_TO_SWITCH_RW;
 		}
 	}