summaryrefslogtreecommitdiff
path: root/board/pdeval-stm32f072/board.c
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2015-06-15 16:55:08 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-06-24 00:04:42 +0000
commit5aadcd90d8ecb79d15dae6d5f0b4567a678e8d8c (patch)
tree6b3720be9d091a6beecdaf5a254cbe047a94dada /board/pdeval-stm32f072/board.c
parent43db8410667de672369c794fd9b16e40fcded85c (diff)
downloadchrome-ec-5aadcd90d8ecb79d15dae6d5f0b4567a678e8d8c.tar.gz
Add board for USB PD chip evaluation
Base board configuration to evaluate USB PD interface chip by connecting them a STM32F072 Discovery board. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=chrome-os-partner:41497 TEST=Flash the STM32F072 discovery using the following command: make flash BOARD=pdeval-stm32f072 then connect to the EC console through the USB port. Change-Id: Ie3f5dcd04c077be49fbacc020f7af4f298039e8a Reviewed-on: https://chromium-review.googlesource.com/277713 Tested-by: Alec Berg <alecaberg@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org> Commit-Queue: Alec Berg <alecaberg@chromium.org>
Diffstat (limited to 'board/pdeval-stm32f072/board.c')
-rw-r--r--board/pdeval-stm32f072/board.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/board/pdeval-stm32f072/board.c b/board/pdeval-stm32f072/board.c
new file mode 100644
index 0000000000..e0cdb7d970
--- /dev/null
+++ b/board/pdeval-stm32f072/board.c
@@ -0,0 +1,55 @@
+/* Copyright 2015 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.
+ */
+/* STM32F072-discovery board based USB PD evaluation configuration */
+
+#include "common.h"
+#include "ec_version.h"
+#include "gpio.h"
+#include "hooks.h"
+#include "host_command.h"
+#include "i2c.h"
+#include "registers.h"
+#include "task.h"
+#include "usb.h"
+#include "usb_pd.h"
+#include "util.h"
+
+void button_event(enum gpio_signal signal);
+
+void alert_event(enum gpio_signal signal)
+{
+ /* Exchange status with PD MCU. */
+ host_command_pd_send_status(PD_CHARGE_NO_CHANGE);
+}
+
+#include "gpio_list.h"
+
+const void *const usb_strings[] = {
+ [USB_STR_DESC] = usb_string_desc,
+ [USB_STR_VENDOR] = USB_STRING_DESC("Google Inc."),
+ [USB_STR_PRODUCT] = USB_STRING_DESC("PDeval-stm32f072"),
+ [USB_STR_VERSION] = USB_STRING_DESC(CROS_EC_VERSION32),
+ [USB_STR_CONSOLE_NAME] = USB_STRING_DESC("Shell"),
+};
+
+BUILD_ASSERT(ARRAY_SIZE(usb_strings) == USB_STR_COUNT);
+
+/* Initialize board. */
+static void board_init(void)
+{
+ gpio_enable_interrupt(GPIO_USER_BUTTON);
+ gpio_enable_interrupt(GPIO_PD_MCU_INT);
+}
+DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
+
+void board_reset_pd_mcu(void)
+{
+}
+
+/* I2C ports */
+const struct i2c_port_t i2c_ports[] = {
+ {"tcpc", I2C_PORT_TCPC, 100 /* kHz */, GPIO_I2C0_SCL, GPIO_I2C0_SDA}
+};
+const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);