1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-04-26 22:52:34 +02:00

serprog: Add SPI Mode and CS Mode commands

This commit adds two new commands to the serprog protocol which allow
more fine grained control over the SPI bus. This enables more
applications over serprog like e.g. flashing AVR microcontrollers.
This can be tried with my forks of pico-serprog:

https://github.com/funkeleinhorn/pico-serprog/tree/spimode

and avrdude:

https://github.com/funkeleinhorn/avrgirl/tree/serprog-programmer

I announced this change in flashrom and flashprog IRC channels and got
overall positive feedback in the flashprog channel. The same changes
will be sent to flashprog to prevent diverging specs.

Change-Id: Idb5a9a3710fede322def5191d68b7fba0e135292
Signed-off-by: Funkeleinhorn <git@funkeleinhorn.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/81428
Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Funkeleinhorn 2024-03-23 04:41:55 +01:00 committed by Anastasia Klimchuk
parent 041644a6af
commit 2a5d2920d8

View File

@ -36,6 +36,8 @@ COMMAND Description Parameters Return Value
0x14 Set SPI clock frequency in Hz 32-bit requested frequency ACK + 32-bit set frequency / NAK
0x15 Toggle flash chip pin drivers 8-bit (0 disable, else enable) ACK / NAK
0x16 Set SPI Chip Select 8-bit ACK / NAK
0x17 Set SPI Mode 8-bit ACK / NAK
0x18 Set CS Mode 8-bit ACK / NAK
0x?? unimplemented command - invalid.
@ -93,6 +95,21 @@ Additional information of the above commands:
0x16 (S_SPI_CS):
Set which SPI Chip Select pin to use. This operation is immediate,
meaning it doesn't use the operation buffer.
0x17 (S_SPI_MODE):
Set which SPI Mode to use for 0x13 O_SPIOP commands.
This operation is immediate, meaning it doesn't use the operation buffer.
The current defined modes are:
0x00: SPI Half Duplex (default)
0x01: SPI Full Duplex
0x18 (S_CS_MODE):
Set which CS Mode to use. The CS Mode determines the CS behaviour.
This allows manual control over the CS.
This operation is immediate, meaning it doesn't use the operation buffer.
The current defined modes are:
0x00: CS Auto Mode. The CS gets selected before 0x13 O_SPIOP commands and
deselected afterwards. (default)
0x01: CS Selected. The CS will be selected until another mode is set.
0x02: CS Deselected. The CS will be deselected until another mode is set.
About mandatory commands:
The only truly mandatory commands for any device are 0x00, 0x01, 0x02 and 0x10,
but one can't really do anything with these commands.