Commit Graph

9 Commits

Author SHA1 Message Date
Randall Spangler
8e72f58ac4 pit: Clean up timer init code
Power LED PWM now uses the same functions as the hardware timer.

BUG=chrome-os-partner:20414
BRANCH=none
TEST=Suspend system.  Power button LED pulses smoothly still.

Change-Id: Ib5ca6655d815462baaf68600ad14c4c0c680a6af
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/59838
2013-06-26 09:08:23 -07:00
Randall Spangler
8a66ae3182 pit: Fix watchdog help for STM32L
Clean up timer initialization code to be more general, so that we can
use timer 9 for the LSB on STM32L.  Then use timer 4 for the watchdog
helper.

BUG=chrome-os-partner:18781
BRANCH=none
TEST=From EC console:
        timerinfo -> current time still counts up properly
        waitms 2000 -> prints watchdog info before rebooting

Change-Id: Ib0ba496b0eadb93756dcd1841857546910baf2a9
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/59612
Reviewed-by: Simon Glass <sjg@chromium.org>
2013-06-24 14:03:59 -07:00
Randall Spangler
36317d46f7 Move STM32 timer regs struct to registers.h
This is a struct representation of the STM32 timer registers, so
belongs in registers.h instead of the platform-independent hwtimer.h.

Note that there are other problems with the use of this struct.  It
should be volatile, and if it's a win vs. the macros we should replace
ALL macro'd timer register accesses with the struct instead of just
those in hwtimer.c (that is, we shouldn't do things both ways).  I'll
address those in a subsequent CL after testing which way generates the
most compact code.

No functional changes, just moving the struct definition.

BUG=chrome-os-partner:18343
BRANCH=none
TEST=build all platforms

Change-Id: If29d008fb38b9cc847b69eda1ee7c05e67f6e5e7
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/48415
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-04-17 18:47:05 -07:00
Vincent Palatin
dbc861c5f0 add a function to fast forward system timer
When we wake up from a deep sleep mode, the system timer clock might
have been stopped. We need to be able to set using another time source
(e.g. the RTC).

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>

BUG=chrome-os-partner:8866
TEST=make BOARD=snow && make BOARD=link
on Snow, on a software implementing STOP mode, check the system time is
still accurate by comparing it to the wall clock.

Change-Id: Ieddbb423d052c7aceb398470866b25b25a74c0a0
Reviewed-on: https://gerrit.chromium.org/gerrit/29314
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
2012-08-06 18:55:00 -07:00
Simon Glass
9b48067b09 stm32: Use a timer as the watchdog warning
The WWDG is not ideal for this purpose, since if we fail to handle its
interrupt withint 60ms or so, we get a reset. This can be a problem when we
are reporting a panic, since the uart output takes a long time.

Change to using timer 9, which is free, and make it print a watchdog warning
after one second.

BUG=chrome-os-partner:10146
TEST=manual:
build and boot on snow; waitms 1200 and see that a watchdog timeout is
reported correctly.
See that the panic message is displayed in full without a reset happening
before the end.

Change-Id: Ifc3671098e1f3a7ef409b8d1fb919d22eaa90358
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/26172
2012-07-02 22:35:51 -07:00
Randall Spangler
27e8bdb7c0 Maintain timer value across sysjumps and clean up init debug output
This helps us keep track of how long vboot is taking on the EC.

Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=chrome-os-partner:9651
TEST=reboot system and look at debug log.  time shouldn't start over after it jumps to image A.

Change-Id: Iad86e90d42dabf1c67b2c2be80dda1151cf9a288
2012-05-11 13:36:34 -07:00
Randall Spangler
70f3fcaf86 Add hooks module so modules can be notified of system-level events.
This will be used for sleep/wake/sysjump/etc.  For now it's just wired
up to clock frequency changing.

Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=none
TEST=manual: use nopll command, should still work

Change-Id: Iedcea5830bc18eacfd955c29b8f793aba8905dd8
2012-04-19 08:39:41 -07:00
Randall Spangler
e9328ac4f6 Support dynamically changing the system clock
Add nopll command to turn off the PLL, reducing the system clock to 16Mhz.

Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=chrome-os-partner:8798
TEST=manual

boot system
press power button to boot x86
temps   // should print all temperatures
timerinfo
timerinfo
timerinfo  // convince yourself this is counting up at about 1MHz
nopll  // this drops the system clock to 16MHz
temps   // should still print all temperatures
timerinfo
timerinfo
timerinfo  // should still be counting up at about 1MHz

Change-Id: Ie29ceb17af348148bffadf63d60c1b731f4c3f6d
2012-04-09 10:33:35 -07:00
Vincent Palatin
645dad5d3f Split the timer code between OS code and hardware dependant code.
Preparatory work to introduce a second SoC : 2/5

The hwtimer.* files implement the driver for the SoC timer block.
The timer.* files provides the OS level clock/timer functions.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>

BUG=None
TEST=on BDS, check 'waitms' and 'gettime' on the EC console.

Change-Id: Icbc58d9be59ee268e2d5a94f8b20de0cabcdc91d
2012-01-25 22:50:07 +00:00