stm32g4: ucpd: Fix tx hard reset and msg discard handling
stm32g4: ucpd: Fix tx hard reset and msg discard handling

This CL fixes the ucpd hard reset transmit path. There was code
missing to set the ucpd event to send a hard reset. In addition, there
was a code bug where wrong bit in tx_request was being cleared.

This CL also adds message discard handling as required in the prl_tx
state machine. There is now an event set when a message is received so
the transmit state machine can discard a tx message that is being
requested to be sent, or was discarded by the ucpd peripheral.

This CL also adds ucpd state logging function which can be display via
the existing command 'ucpd info'.

BUG=b:181179550
BRANCH=None
TEST=manual
Connected to host machine (kohaku) and verified hard reset is sent
after ec console command 'pd 0 hard' with TotalPhase

For discard message fixes, used kohaku with custom FW to send a SVDM
command, immediately following by get sink cap message. I then added
variable delay in tcpmv2 svdm response path to force collisions in usb
rev2.0 mode. By varying this delay, I was able to test various
collision paths to ensure messages were being discarded when
expected. In addition, I looked at console logs when running VDMU.e16
compliance test.

> ucpd info
        cc1      = Rp
        cc2      = Rp
        Rp       = Rp_3.0
        cc1_v    = 2
        cc2_v    = 1
        rx_en    = 1
        pol      = 0
ucpd: tx_state = TX_IDLE, tx_req = 00, timeout_us = -1

         UCDP Task Log
[0]: ACT_TCPM    WAIT_CRC   00      00000020     026252441       1000
[1]: WAIT_CRC    TX_IDLE    00      00000100     026252963       -1
[2]: TX_IDLE     ACT_TCPM   01      00000002     026306381       -1
[3]: ACT_TCPM    WAIT_CRC   00      00000020     026307170       1000
[4]: WAIT_CRC    TX_IDLE    00      00000100     026307691       -1

Signed-off-by: Scott Collyer <7d40b3eb9e17bf55d972074a5e77a7ea4159f9dd@google.com>
Change-Id: I9f351c762069ee17684b6918bc3cca973439156a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2787240
Tested-by: Scott Collyer <7d40b3eb9e17bf55d972074a5e77a7ea4159f9dd@chromium.org>
Reviewed-by: Diana Z <cb2016afc7183e5356c690dc63b4ba817470501a@chromium.org>
Commit-Queue: Scott Collyer <7d40b3eb9e17bf55d972074a5e77a7ea4159f9dd@chromium.org>

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