fix(spi_device): Missed Command Upload
fix(spi_device): Missed Command Upload

This commit fixes one of the issue #11871

Problem:

    SW read incorrect opcode for Page Program.

Analysis
--------

The Page Program (0x02) opcode is adjacent to other commands that
SPI_DEVICE processes. So, the Datapath is fixed when the exact last beat
of the command opcode arrives. It is the second half of the 7th SCK.

The command parser activates Upload module at that time. However, the
top module switches the SRAM mux to the Upload module when the datapath
is latched by inverted SCK, which is right after the 8th posedge of SCK.

The Upload module, however, pushes the CMDFIFO entry (0x02 Page Program)
prior to 8th posedge of SCK to safely update the FIFO content as SCK
may not have 9th posedge if the SPI command is opcode only commands.
Examples are CHIP ERASE (0xC7), SECTOR ERASE, etc.

Resolution
----------

This commit revises the Mux design. Rather than using
`cmd_dp_sel_outclk`, it uses `cmd_dp_sel` (SCK clock) directly for the
SRAM mux. Other signals must be in inverted SCK clock domain to match
the output data phase.

Signed-off-by: Eunchan Kim <cb7bc7ceb22698f298c67faa994fd9ddf3cab298@opentitan.org>

lowRISC/opentitan,lowRISC/opentitan,lowRISC/opentitan,lowRISC/opentitan,lowRISC/opentitan,lowRISC/opentitan