diff options
author | CHLin <CHLIN56@nuvoton.com> | 2019-04-19 17:47:24 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2019-04-27 01:36:52 -0700 |
commit | 7a87d4b5c984cc24937944b4cbcd8cd7f3b4fd0b (patch) | |
tree | 7685d1af5f5113570b0d2a3b5eacdb1d01c202dc /chip/npcx/system.c | |
parent | 0c71c4748699f5f2cb1423ffc07d4c852d04b3fc (diff) | |
download | chrome-ec-7a87d4b5c984cc24937944b4cbcd8cd7f3b4fd0b.tar.gz |
npcx: disable the selection of JTAG0 signals due to strap
It was observed that pressing recovery key combination + the other
keys, some keys on the keyboard become invalid after system reboots.
(see b:129908668 for more detail.)
It is because the hardware strap pin for JTAG0 signals is
unintentionally triggered. This CL reverts the selection of JTAG signals
and set them back to keyboard scan function at system initialization.
The revert applies to all real platforms except npcx_evbs.
BRANCH=none
BUG=b:129908668
TEST=pass "make buildall"
TEST=Press the specific key combination, after the system reboots,
the keyboard function works normally. On npcx EVBs, the JTAG0 is still
functional.
Change-Id: I7ede1ea4609466fea50a97b1f60308e4cdfd4544
Signed-off-by: CHLin <CHLIN56@nuvoton.com>
Reviewed-on: https://chromium-review.googlesource.com/1575887
Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org>
Tested-by: CH Lin <chlin56@nuvoton.com>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Diffstat (limited to 'chip/npcx/system.c')
-rw-r--r-- | chip/npcx/system.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/chip/npcx/system.c b/chip/npcx/system.c index 009dd49017..aa0c6fbb51 100644 --- a/chip/npcx/system.c +++ b/chip/npcx/system.c @@ -16,6 +16,7 @@ #include "hwtimer_chip.h" #include "registers.h" #include "rom_chip.h" +#include "sib_chip.h" #include "system.h" #include "system_chip.h" #include "task.h" @@ -670,6 +671,28 @@ void chip_pre_init(void) CLEAR_BIT(NPCX_DEVALT(ALT_GROUP_5), NPCX_DEVALT5_NJEN0_EN); #endif #endif + +#ifndef CONFIG_ENABLE_JTAG_SELECTION + /* + * (b/129908668) + * This is the workaround to disable the JTAG0 which is enabled + * accidentally by a special key combination. + */ + if (!IS_BIT_SET(NPCX_DEVALT(5), NPCX_DEVALT5_NJEN0_EN)) { + int data; + /* Set DEVALT5.nJEN0_EN to disable JTAG0 */ + SET_BIT(NPCX_DEVALT(5), NPCX_DEVALT5_NJEN0_EN); + /* Enable Core-to-Host Modules Access */ + SET_BIT(NPCX_SIBCTRL, NPCX_SIBCTRL_CSAE); + /* Clear SIOCFD.JEN0_HSL to disable JTAG0 */ + data = sib_read_reg(SIO_OFFSET, 0x2D); + data &= ~0x80; + sib_write_reg(SIO_OFFSET, 0x2D, data); + /* Disable Core-to-Host Modules Access */ + CLEAR_BIT(NPCX_SIBCTRL, NPCX_SIBCTRL_CSAE); + } +#endif + } void system_pre_init(void) |