mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-10 17:41:54 +00:00
mec1322: Add watchdog support
This implements the basic watchdog support. For now, the watchdog doesn't warn us before it expires. This functionality will be added later using a basic timer. BUG=chrome-os-partner:24107 TEST='waitms 700' and the EC stays alive. TEST='waitms 1200' and the EC reboots. BRANCH=None Change-Id: I1cc48978ed09577ae88cc2f7a6087867e5854973 Signed-off-by: Vic (Chun-Ju) Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/177736
This commit is contained in:
committed by
chrome-internal-fetch
parent
7f3ed512db
commit
3f82ac3579
@@ -19,7 +19,6 @@
|
||||
#undef CONFIG_LPC
|
||||
#undef CONFIG_PECI
|
||||
#undef CONFIG_SWITCH
|
||||
#undef CONFIG_WATCHDOG
|
||||
|
||||
#ifndef __ASSEMBLER__
|
||||
|
||||
|
||||
@@ -13,3 +13,4 @@ CFLAGS_CPU+=-march=armv7e-m -mcpu=cortex-m4
|
||||
|
||||
# Required chip modules
|
||||
chip-y=clock.o gpio.o hwtimer.o system.o uart.o jtag.o
|
||||
chip-$(CONFIG_WATCHDOG)+=watchdog.o
|
||||
|
||||
32
chip/mec1322/watchdog.c
Normal file
32
chip/mec1322/watchdog.c
Normal file
@@ -0,0 +1,32 @@
|
||||
/* Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
/* Watchdog driver */
|
||||
|
||||
/*
|
||||
* TODO(crosbug.com/p/24107): Use independent timer for warning before watchdog
|
||||
* timer expires.
|
||||
*/
|
||||
|
||||
#include "hooks.h"
|
||||
#include "registers.h"
|
||||
#include "watchdog.h"
|
||||
|
||||
void watchdog_reload(void)
|
||||
{
|
||||
MEC1322_WDG_KICK = 1;
|
||||
}
|
||||
DECLARE_HOOK(HOOK_TICK, watchdog_reload, HOOK_PRIO_DEFAULT);
|
||||
|
||||
int watchdog_init(void)
|
||||
{
|
||||
/* Set timeout. It takes 1007us to decrement WDG_CNT by 1. */
|
||||
MEC1322_WDG_LOAD = WATCHDOG_PERIOD_MS * 1000 / 1007;
|
||||
|
||||
/* Start watchdog */
|
||||
MEC1322_WDG_CTL |= 1;
|
||||
|
||||
return EC_SUCCESS;
|
||||
}
|
||||
Reference in New Issue
Block a user