diff options
author | CHLin <CHLIN56@nuvoton.com> | 2019-07-16 17:12:43 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-07-23 13:49:25 +0000 |
commit | 3fb2394b245c9d98e631443eff70f97758413f3e (patch) | |
tree | 85c0e6d647f460572b23ad7b1dd6428b5a3a4c04 /chip/npcx/registers.h | |
parent | 0ae8c5584d3648c76bd8e8fca0a27ae20d1bb761 (diff) | |
download | chrome-ec-3fb2394b245c9d98e631443eff70f97758413f3e.tar.gz |
npcx7: UART: wait for Tx empty before enabling deep-sleep
In the original firmware (in the uart_buffering.c), it clears the
SLEEP_MASK_UART immediately after it pushes all characters from its Tx
buffer to UART's FIFO without checking the status of transmission. It
may break the transmission because EC goes to deep sleep before UART TX
(FIFO or shift register) becomes empty. This CL fixes it by:
(1) Don't clear SLEEP_MASK_UART immediately when uart_tx_stop is called.
(2) Enable the NXMIP (No Transmit in Progress) interrupt.
(3) Clear SLEEP_MASK_UART in the UART interrupt handler when NXMIP is
set.
This fix only needs to apply to NPCX7 chips which have UART FIFO support.
BRANCH=none
BUG=b:137143640
TEST=No error for "make buildall"
TEST=run 10 iterations of uart_stress_tester on yorp with command:
./util/uart_stress_tester.py /dev/ttyUSB2 -t 360;
make sure no character lost in each iteration as below:
...
INFO | UartSerial| /dev/ttyUSB2 | Detected as EC UART
INFO | UartSerial| EC | Ready to test
INFO | ChargenTest | Ports are ready to test
INFO | ChargenTest | Test starts
INFO | UartSerial| EC | Test thread starts
INFO | UartSerial| EC | Test thread is done
INFO | UartSerial| EC | 0 char lost / 4147200 (0.0 %)
INFO | ChargenTest | PASS: lost 0 character(s) from the test
INFO | ChargenTest | Test is done
Change-Id: I97b1f572e8b9ebdb5102aa3e98ae2963d768b5b3
Signed-off-by: CHLin <CHLIN56@nuvoton.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1703944
Tested-by: CH Lin <chlin56@nuvoton.com>
Reviewed-by: Namyoon Woo <namyoon@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Commit-Queue: CH Lin <chlin56@nuvoton.com>
Diffstat (limited to 'chip/npcx/registers.h')
-rw-r--r-- | chip/npcx/registers.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/chip/npcx/registers.h b/chip/npcx/registers.h index d31800f841..3a63f6ccb7 100644 --- a/chip/npcx/registers.h +++ b/chip/npcx/registers.h @@ -326,7 +326,7 @@ #define NPCX_UFTCTL_TEMPTY_LVL_SEL FIELD(0, 5) #define NPCX_UFTCTL_TEMPTY_LVL_EN 5 #define NPCX_UFTCTL_TEMPTY_EN 6 -#define NPCX_UFTCTL_NXIMPEN 7 +#define NPCX_UFTCTL_NXMIPEN 7 #define NPCX_UFRCTL_RFULL_LVL_SEL FIELD(0, 5) #define NPCX_UFRCTL_RFULL_LVL_EN 5 |