Automatically select the right FPGA firmware for 1.8/3.3V

With the -G2 variant we can automatically select the right voltage. Do
this instead of just giving up. For the original em100 this will produce
an error, with a 2s delay.

Success (new unit):

will emulate 'W25Q128FW'
MCU version: 3.03
FPGA version: 2.10 (3.3V)
Serial number: DP142535
SPI flash database: 4.3.01
EM100Pro currently stopped
EM100Pro hold pin currently low

Stopped EM100Pro
Sending flash chip configuration
Voltage set to 1.8
Chip set to W25Q128FW
Hold pin state set to low
Sent 2097152 bytes of 16777216
...

Failure (old unit):

will emulate 'GD25Q32B'
MCU version: 2.27
FPGA version: 0.85 (1.8V)
Serial number: DP142073
SPI flash database: 4.3.01
EM100Pro currently running
EM100Pro hold pin currently low

Stopped EM100Pro
Sending flash chip configuration
Invalid voltage response: 0x12 (expected 0x21)
Error: The current FPGA firmware (1.8V) does not support GigaDevice GD25Q32B (3.3V)
Failed configuring chip type.

Change-Id: I55596b9857c1f340d532acf5d261800a654068c6
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1395949
Reviewed-by: Raul E Rangel <rrangel@chromium.org>
1 file changed