util/stm32mon: Move read unprotect before reading values
util/stm32mon: Move read unprotect before reading values

The 3 read_* functions attempt to read from areas that are protected
by RDP on the STM32F412. This results in many read failures before
we get to the unprotect function. These are not needed before attempting
the unprotect, so move them to after the unprotect sequence.

The unwanted sequence looks like the following, every time:

Waiting for the monitor startup ...Done.
ChipID 0x441 : STM32F412
|  0%NACK
Failed to get command READMEM ACK
NACK
Failed to get command READMEM ACK
NACK
Failed to get command READMEM ACK
NACK
Failed to get command READMEM ACK
Cannot read 21 bytes from address 0x1FFF7A0FUnable to read flash size register (0x1FFF7A22).
/  0%NACK
Failed to get command READMEM ACK
NACK
Failed to get command READMEM ACK
NACK
Failed to get command READMEM ACK
NACK
Failed to get command READMEM ACK
Cannot read 13 bytes from address 0x1FFF7A0FUnable to read unique device ID register (0x1FFF7A10). Ignoring non-critical failure.
Bootloader v3.1, commands : GETCMD GETVER GETID READMEM GO WRITEMEM EXTERASE WP WU RP RU
Unprotecting flash read...

Now, the output looks like:

Waiting for the monitor startup ...Done.
ChipID 0x441 : STM32F412
Bootloader v3.1, commands : GETCMD GETVER GETID READMEM GO WRITEMEM EXTERASE WP WU RP RU
Unprotecting flash read...
Timeout
Timeout
Timeout
Flash read unprotected.
Waiting for the monitor startup ...Done.
|  0%Flash size: 1024 KB
/  0%Unique Device ID: 0x383939313138511900038016
Flash write unprotected.
Waiting for the monitor startup ...Done.
Erasing...
Timeout
Timeout
Timeout
Flash erased.
Writing 1047992 bytes at 0x08000000
   1047992 bytes written.
Done.

BRANCH=none
BUG=b:143374692
TEST=make proj-bloonchipper -j
     ./test/run_device_tests.py --flasher=servo_micro --tests\
         flash_write_protect
     # This sets RDP
     ./util/flash_ec --board=bloonchipper
TEST=# Tried flash_fp_mcu on dratini(F412/SPI) and bard(H732/SPI).

Signed-off-by: Craig Hesling <383db090fd8ef907a606ac8a9eccd2962bc489cf@chromium.org>
Change-Id: I9b9ba2ecd3797cb1a98d7bcd7b226cdbc7872217
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3054465
Reviewed-by: Aseda Aboagye <12c9b286316a940fd31c24070da5ab64cdd4d0e7@chromium.org>

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