summaryrefslogtreecommitdiff
path: root/chip/lm4
diff options
context:
space:
mode:
Diffstat (limited to 'chip/lm4')
-rw-r--r--chip/lm4/build.mk7
-rw-r--r--chip/lm4/ec.lds.S1
-rw-r--r--chip/lm4/lpc.c4
-rw-r--r--chip/lm4/watchdog.c19
4 files changed, 28 insertions, 3 deletions
diff --git a/chip/lm4/build.mk b/chip/lm4/build.mk
index 585528f820..093b052e01 100644
--- a/chip/lm4/build.mk
+++ b/chip/lm4/build.mk
@@ -8,6 +8,7 @@
# CPU specific compilation flags
CFLAGS_CPU=-mcpu=cortex-m4 -mthumb -Os -mno-sched-prolog
-chip-objs=init.o panic.o switch.o task.o timer.o pwm.o i2c.o adc.o jtag.o
-chip-objs+=clock.o gpio.o system.o lpc.o uart.o power_button.o
-chip-objs+=flash.o watchdog.o eeprom.o keyboard_scan.o temp_sensor.o
+chip-y=init.o panic.o switch.o task.o timer.o pwm.o i2c.o adc.o jtag.o
+chip-y+=clock.o gpio.o system.o lpc.o uart.o power_button.o
+chip-y+=flash.o watchdog.o eeprom.o temp_sensor.o
+chip-$(CONFIG_TASK_KEYSCAN)+=keyboard_scan.o
diff --git a/chip/lm4/ec.lds.S b/chip/lm4/ec.lds.S
index 5750967e3d..b64dea8398 100644
--- a/chip/lm4/ec.lds.S
+++ b/chip/lm4/ec.lds.S
@@ -30,6 +30,7 @@ SECTIONS
__irqprio = .;
*(.rodata.irqprio)
__irqprio_end = .;
+ . = ALIGN(4);
__cmds = .;
*(.rodata.cmds)
__cmds_end = .;
diff --git a/chip/lm4/lpc.c b/chip/lm4/lpc.c
index 00fdca02a2..5155befb3e 100644
--- a/chip/lm4/lpc.c
+++ b/chip/lm4/lpc.c
@@ -174,6 +174,7 @@ static void lpc_interrupt(void)
/* Clear the interrupt bits we're handling */
LM4_LPC_LPCIC = mis;
+#ifdef CONFIG_TASK_HOSTCMD
/* Handle host kernel/user command writes */
if (mis & LM4_LPC_INT_MASK(LPC_CH_KERNEL, 4)) {
/* Set the busy bit and clear the status */
@@ -193,11 +194,13 @@ static void lpc_interrupt(void)
* This clears the FRMH bit in the status byte. */
host_command_received(1, LPC_POOL_USER[0]);
}
+#endif
/* Handle port 80 writes (CH0MIS1) */
if (mis & LM4_LPC_INT_MASK(LPC_CH_PORT80, 2))
port_80_write(LPC_POOL_PORT80[0]);
+#ifdef CONFIG_TASK_I8042CMD
/* Handle port 60 command (CH3MIS2) and data (CH3MIS1) */
if (mis & LM4_LPC_INT_MASK(LPC_CH_KEYBOARD, 2)) {
/* Read the data byte and pass to the i8042 handler.
@@ -213,6 +216,7 @@ static void lpc_interrupt(void)
/* Host picks up the data, try to send remaining bytes */
task_send_msg(TASK_ID_I8042CMD, TASK_ID_I8042CMD, 0);
}
+#endif
/* Handle COMx */
if (mis & LM4_LPC_INT_MASK(LPC_CH_COMX, 2)) {
diff --git a/chip/lm4/watchdog.c b/chip/lm4/watchdog.c
index b0aa258bfd..ccc6e63b72 100644
--- a/chip/lm4/watchdog.c
+++ b/chip/lm4/watchdog.c
@@ -11,7 +11,9 @@
#include "common.h"
#include "config.h"
#include "registers.h"
+#include "gpio.h"
#include "task.h"
+#include "timer.h"
#include "uart.h"
#include "util.h"
@@ -135,3 +137,20 @@ int watchdog_init(int period_ms)
return EC_SUCCESS;
}
+
+/* Low priority task to reload the watchdog */
+void watchdog_task(void)
+{
+ while (1) {
+#ifdef BOARD_bds
+ gpio_set_level(GPIO_DEBUG_LED, 1);
+#endif
+ usleep(500000);
+ watchdog_reload();
+#ifdef BOARD_bds
+ gpio_set_level(GPIO_DEBUG_LED, 0);
+#endif
+ usleep(500000);
+ watchdog_reload();
+ }
+}