Clean up jtag module

No functional changes

BUG=chrome-os-partner:15579
BRANCH=none
TEST=boot system; use gdb to connect to EC

Change-Id: I2817d04e4de102e4201506cfe51cdf0bd939fcdb
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/36802
Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Randall Spangler
2012-10-29 13:24:58 -07:00
committed by Gerrit
parent f76cb374f8
commit e82b68bcb9
4 changed files with 12 additions and 15 deletions

View File

@@ -6,20 +6,21 @@
#include "jtag.h"
#include "registers.h"
int jtag_pre_init(void)
void jtag_pre_init(void)
{
/* Enable clocks to GPIO block C */
LM4_SYSTEM_RCGCGPIO |= 0x0004;
/* Ensure PC0:3 are set to JTAG function. They should be set this way
/*
* Ensure PC0:3 are set to JTAG function. They should be set this way
* on a cold boot, but on a warm reboot a previous misbehaving image
* could have set them differently. */
* could have set them differently.
*/
if (((LM4_GPIO_PCTL(LM4_GPIO_C) & 0x0000ffff) == 0x00001111) &&
((LM4_GPIO_AFSEL(LM4_GPIO_C) & 0x0f) == 0x0f) &&
((LM4_GPIO_DEN(LM4_GPIO_C) & 0x0f) == 0x0f) &&
((LM4_GPIO_PUR(LM4_GPIO_C) & 0x0f) == 0x0f))
return EC_SUCCESS; /* Already properly configured */
return; /* Already properly configured */
/* Unlock commit register for JTAG pins */
LM4_GPIO_LOCK(LM4_GPIO_C) = LM4_GPIO_LOCK_UNLOCK;
@@ -35,6 +36,4 @@ int jtag_pre_init(void)
/* Re-lock commit register */
LM4_GPIO_CR(LM4_GPIO_C) &= ~0x0f;
LM4_GPIO_LOCK(LM4_GPIO_C) = 0;
return EC_SUCCESS;
}

View File

@@ -7,10 +7,8 @@
#include "jtag.h"
#include "registers.h"
int jtag_pre_init(void)
void jtag_pre_init(void)
{
/* stop TIM1-4 and watchdogs when the JTAG stops the CPU */
STM32_DBGMCU_CR |= 0x00003f00;
return EC_SUCCESS;
}

View File

@@ -7,10 +7,8 @@
#include "jtag.h"
#include "registers.h"
int jtag_pre_init(void)
void jtag_pre_init(void)
{
/* stop TIM2-4 and watchdogs when the JTAG stops the CPU */
STM32_DBGMCU_APB1FZ |= 0x00001807;
return EC_SUCCESS;
}

View File

@@ -10,7 +10,9 @@
#include "common.h"
/* Pre-initializes the module. */
int jtag_pre_init(void);
/**
* Pre-initialize the JTAG module.
*/
void jtag_pre_init(void);
#endif /* __CROS_EC_JTAG_H */