nuc: Enable JTAG directly by NPCX_ENABLE_JTAG definition

Enable JTAG functionality by SW without pulling down strap-pin nJEN0 or nJEN1
during ec POWERON or VCCRST reset occurs.
Please notice it will change pinmux to JTAG directly.

Modified drivers:
1. gpio.c: Remove JTAG0/1 alternative groups and bits from gpio_alt_table
2. jtag.c: Enable JTAG functionality

BUG=chrome-os-partner:34346
TEST=make buildall -j; test nuvoton IC specific drivers

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
Change-Id: I5a664adedeea1c75df37662dc1f3206e90163eeb
Reviewed-on: https://chromium-review.googlesource.com/306470
Reviewed-by: Shawn N <shawnn@chromium.org>
This commit is contained in:
Mulin Chao
2015-10-16 11:41:30 +08:00
committed by chrome-bot
parent 34a745efe8
commit 9e070fd92b
2 changed files with 13 additions and 13 deletions

View File

@@ -265,19 +265,6 @@ const struct gpio_alt_map gpio_alt_table[] = {
{ NPCX_GPIO(4, 0), NPCX_ALT(3, TA1_TACH1_SL1)},/* TA1_TACH1 */
{ NPCX_GPIO(A, 4), NPCX_ALT(3, TB1_TACH2_SL1)},/* TB1_TACH2 */
#endif
/* JTAG Module */
#if NPCX_JTAG_MODULE2
{ NPCX_GPIO(D, 5), NPCX_ALT(5, NJEN1_EN) }, /* TCLK */
{ NPCX_GPIO(E, 2), NPCX_ALT(5, NJEN1_EN) }, /* TDI */
{ NPCX_GPIO(D, 4), NPCX_ALT(5, NJEN1_EN) }, /* TDO */
{ NPCX_GPIO(E, 5), NPCX_ALT(5, NJEN1_EN) }, /* TMS */
#else
{ NPCX_GPIO(2, 1), NPCX_ALT(5, NJEN0_EN) }, /* TCLK */
{ NPCX_GPIO(1, 7), NPCX_ALT(5, NJEN0_EN) }, /* TDI */
{ NPCX_GPIO(1, 6), NPCX_ALT(5, NJEN0_EN) }, /* TDO */
{ NPCX_GPIO(2, 0), NPCX_ALT(5, NJEN0_EN) }, /* TMS */
#endif
/* 01 for PWRGD_OUT*/
};
/*****************************************************************************/

View File

@@ -15,4 +15,17 @@ void jtag_pre_init(void)
NPCX_DBGCTRL = 0x04;
/* Enable automatic freeze mode */
CLEAR_BIT(NPCX_DBGFRZEN3, NPCX_DBGFRZEN3_GLBL_FRZ_DIS);
/*
* Enable JTAG functionality by SW without pulling down strap-pin
* nJEN0 or nJEN1 during ec POWERON or VCCRST reset occurs.
* Please notice it will change pinmux to JTAG directly.
*/
#ifdef NPCX_ENABLE_JTAG
#if NPCX_JTAG_MODULE2
CLEAR_BIT(NPCX_DEVALT(ALT_GROUP_5), NPCX_DEVALT5_NJEN1_EN);
#else
CLEAR_BIT(NPCX_DEVALT(ALT_GROUP_5), NPCX_DEVALT5_NJEN0_EN);
#endif
#endif
}