summaryrefslogtreecommitdiff
path: root/board/discovery
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2013-08-22 14:10:38 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2013-09-28 03:21:00 +0000
commitf1d0d8b2dbc688730b5712c783550662f55fbffc (patch)
treea189edcc4ea39da45d2c293d4d43c3b697564029 /board/discovery
parent84ba1881208aa0fe56e7775958d95a8fa78f93c4 (diff)
downloadchrome-ec-f1d0d8b2dbc688730b5712c783550662f55fbffc.tar.gz
basic support for STM32L-Discovery board
Support for the basic development board built by STmicro with STM32L152 chip. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BUG=none TEST=See that LEDs can be driven from the console, button can be read. With additional print statement, see that button hook is called. BRANCH=none Change-Id: I494ab525f17e08b57595ee49489ade63b3305f2a Reviewed-on: https://chromium-review.googlesource.com/170920 Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Queue: Jeremy Thorpe <jeremyt@chromium.org> Tested-by: Jeremy Thorpe <jeremyt@chromium.org>
Diffstat (limited to 'board/discovery')
-rw-r--r--board/discovery/board.c43
-rw-r--r--board/discovery/board.h52
-rw-r--r--board/discovery/build.mk13
-rw-r--r--board/discovery/ec.tasklist21
4 files changed, 129 insertions, 0 deletions
diff --git a/board/discovery/board.c b/board/discovery/board.c
new file mode 100644
index 0000000000..f900acf015
--- /dev/null
+++ b/board/discovery/board.c
@@ -0,0 +1,43 @@
+/* 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.
+ */
+/* STM32L-discovery board configuration */
+
+#include "common.h"
+#include "gpio.h"
+#include "hooks.h"
+#include "registers.h"
+#include "task.h"
+#include "util.h"
+
+void button_event(enum gpio_signal signal)
+{
+}
+
+/* GPIO signal list. Must match order from enum gpio_signal. */
+const struct gpio_info gpio_list[] = {
+ /* Inputs with interrupt handlers are first for efficiency */
+ {"USER_BUTTON", GPIO_A, (1<<0), GPIO_INT_BOTH, button_event},
+ /* Outputs */
+ {"LED_BLUE", GPIO_B, (1<<6), GPIO_OUT_LOW, NULL},
+ {"LED_GREEN", GPIO_B, (1<<7), GPIO_OUT_LOW, NULL},
+
+ /* Unimplemented signals which we need to emulate for now */
+ GPIO_SIGNAL_NOT_IMPLEMENTED("ENTERING_RW"),
+ GPIO_SIGNAL_NOT_IMPLEMENTED("WP_L"),
+};
+BUILD_ASSERT(ARRAY_SIZE(gpio_list) == GPIO_COUNT);
+
+/* Initialize board. */
+static void board_init(void)
+{
+ gpio_enable_interrupt(GPIO_USER_BUTTON);
+}
+DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
+
+/* Pins with alternate functions */
+const struct gpio_alt_func gpio_alt_funcs[] = {
+ {GPIO_A, 0x0600, GPIO_ALT_USART, MODULE_UART},
+};
+const int gpio_alt_funcs_count = ARRAY_SIZE(gpio_alt_funcs);
diff --git a/board/discovery/board.h b/board/discovery/board.h
new file mode 100644
index 0000000000..541568dd00
--- /dev/null
+++ b/board/discovery/board.h
@@ -0,0 +1,52 @@
+/* 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.
+ */
+
+/* STM32L-discovery board configuration */
+
+#ifndef __BOARD_H
+#define __BOARD_H
+
+/* Optional features */
+#undef CONFIG_WATCHDOG_HELP
+#undef CONFIG_LID_SWITCH
+
+/*
+ * Allow dangerous commands all the time, since we don't have a write protect
+ * switch.
+ */
+#define CONFIG_SYSTEM_UNLOCKED
+
+#ifndef __ASSEMBLER__
+
+/* Module IDs */
+enum module_id {
+ MODULE_UART,
+ MODULE_CHIPSET,
+};
+
+/* By default, enable all console messages except keyboard */
+#define CC_DEFAULT (CC_ALL & ~CC_MASK(CC_KEYSCAN))
+
+/* Timer selection */
+#define TIM_CLOCK_MSB 3
+#define TIM_CLOCK_LSB 4
+
+/* GPIO signal list */
+enum gpio_signal {
+ /* Inputs with interrupt handlers are first for efficiency */
+ GPIO_USER_BUTTON = 0,
+ /* Outputs */
+ GPIO_LED_BLUE,
+ GPIO_LED_GREEN,
+ /* Unimplemented signals we emulate */
+ GPIO_ENTERING_RW,
+ GPIO_WP_L,
+ /* Number of GPIOs; not an actual GPIO */
+ GPIO_COUNT
+};
+
+#endif /* !__ASSEMBLER__ */
+
+#endif /* __BOARD_H */
diff --git a/board/discovery/build.mk b/board/discovery/build.mk
new file mode 100644
index 0000000000..8de1b957d3
--- /dev/null
+++ b/board/discovery/build.mk
@@ -0,0 +1,13 @@
+# -*- makefile -*-
+# 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.
+#
+# Board specific files build
+
+# the IC is STmicro STM32L151R8H6
+CHIP:=stm32
+CHIP_FAMILY:=stm32l
+CHIP_VARIANT:=stm32l15x
+
+board-y=board.o
diff --git a/board/discovery/ec.tasklist b/board/discovery/ec.tasklist
new file mode 100644
index 0000000000..d3ac489b42
--- /dev/null
+++ b/board/discovery/ec.tasklist
@@ -0,0 +1,21 @@
+/* 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.
+ */
+
+/**
+ * List of enabled tasks in the priority order
+ *
+ * The first one has the lowest priority.
+ *
+ * For each task, use the macro TASK_ALWAYS(n, r, d, s) for base tasks and
+ * TASK_NOTEST(n, r, d, s) for tasks that can be excluded in test binaries,
+ * where :
+ * 'n' in the name of the task
+ * 'r' in the main routine of the task
+ * 'd' in an opaque parameter passed to the routine at startup
+ * 's' is the stack size in bytes; must be a multiple of 8
+ */
+#define CONFIG_TASK_LIST \
+ TASK_ALWAYS(HOOKS, hook_task, NULL, TASK_STACK_SIZE) \
+ TASK_ALWAYS(CONSOLE, console_task, NULL, TASK_STACK_SIZE)