flash_fp_mcu: Wait for FPMCU to disable sector write protect
flash_fp_mcu: Wait for FPMCU to disable sector write protect

To disable ro_now protection FPMCU must be booted with HW write protect
disabled. Actually running 'flash_fp_mcu --read' doesn't cause
'stm32mon' to disable sector write protect and as a result first FPMCU
boot with HW WP disabled takes place after power cycling FPMCU.

Disabling sector write protection takes some time due to flash internal
structures update. During that time we can't reset or power cycle FPMCU
otherwise we will corrupt internal flash state which will brick FPMCU.
This situation can occur if DUT is rebooted immediately after
flash_fp_mcu finishes, so give some time to remove sector write
protection.

The issue can be reproduced with the following script:
	do_ssh() {
		sshpass -ptest0000 ssh root@<IP> "$*"
	}

	do_ssh ectool --name=cros_fp version
	dut-control fw_wp_state:force_on
	do_ssh ectool --name=cros_fp flashprotect enable
	sleep 2
	do_ssh ectool --name=cros_fp reboot_ec
	sleep 2
	do_ssh ectool --name=cros_fp flashprotect
	dut-control fw_wp_state:force_off
	do_ssh 'flash_fp_mcu --noservices \
	    --noremove_flash_read_protect --read; reboot'
	sleep 2
	do_ssh ectool --name=cros_fp version

BUG=b:233276135
BRANCH=none
TEST=Run 'tast run <IP> firmware.FpRDP1' on zork, hatch, nami,
     nocturne, strongbad

Signed-off-by: Patryk Duda <6aed17a362577cf10cb5675888c1635d522769c1@semihalf.com>
Change-Id: I86a4d1ce7833bc4aeefd9f963febf1a2d3a7c809
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3785338
Reviewed-by: Josie Nordrum <15709ebcc9b54f095b12491b186117e19e6ed974@google.com>
Reviewed-by: Bobby Casey <a3c107f0b4efaee07148ab0813ba992bba562a69@google.com>
Tested-by: Patryk Duda <213d388d1c6ea6afd34b87da9fc4415c3231b04c@google.com>
Commit-Queue: Patryk Duda <213d388d1c6ea6afd34b87da9fc4415c3231b04c@google.com>

coreboot/chrome-ec,coreboot/chrome-ec,coreboot/chrome-ec,coreboot/chrome-ec,coreboot/chrome-ec,coreboot/chrome-ec