summaryrefslogtreecommitdiff
path: root/board/stm32f446e-eval
diff options
context:
space:
mode:
authorNick Sanders <nsanders@chromium.org>2016-08-02 19:35:44 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-09-01 22:56:22 -0700
commita4bfc663a3cd645b43963bb814269efe864f8d1e (patch)
tree185ab7cc413c4b580ea50845a024838aba577732 /board/stm32f446e-eval
parent54f4612764e07e5e3ccd8a4af04ee83a46454612 (diff)
downloadchrome-ec-a4bfc663a3cd645b43963bb814269efe864f8d1e.tar.gz
sweetberry: add dwc usb support
stm32f446 uses a synopsys designware USB block rather than the typical ST one. This change adds driver support for the new block, including usb console support. BUG=chromium:608039 TEST=usb console works BRANCH=None Change-Id: I0e143758ae0b5285f1c94ea2ec5aee159e22e00c Signed-off-by: Nick Sanders <nsanders@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/365448 Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'board/stm32f446e-eval')
-rw-r--r--board/stm32f446e-eval/board.c36
-rw-r--r--board/stm32f446e-eval/board.h35
2 files changed, 60 insertions, 11 deletions
diff --git a/board/stm32f446e-eval/board.c b/board/stm32f446e-eval/board.c
index e7af5dad6c..749f55c0d4 100644
--- a/board/stm32f446e-eval/board.c
+++ b/board/stm32f446e-eval/board.c
@@ -12,8 +12,36 @@
#include "i2c.h"
#include "registers.h"
#include "stm32-dma.h"
+#include "usb_descriptor.h"
+#include "usb_dwc_hw.h"
+#include "usb_dwc_console.h"
+/******************************************************************************
+ * Define the strings used in our USB descriptors.
+ */
+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("stm32f446-eval"),
+ [USB_STR_SERIALNO] = USB_STRING_DESC("1234-a"),
+ [USB_STR_VERSION] = USB_STRING_DESC(CROS_EC_VERSION32),
+ [USB_STR_CONSOLE_NAME] = USB_STRING_DESC("EC Shell"),
+};
+
+BUILD_ASSERT(ARRAY_SIZE(usb_strings) == USB_STR_COUNT);
+
+struct dwc_usb usb_ctl = {
+ .ep = {
+ &ep0_ctl,
+ &ep_console_ctl,
+ },
+ .speed = USB_SPEED_FS,
+ .phy_type = USB_PHY_ULPI,
+ .dma_en = 1,
+ .irq = STM32_IRQ_OTG_HS,
+};
+
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
{"i2c1", I2C_PORT_0, 100,
@@ -23,9 +51,8 @@ const struct i2c_port_t i2c_ports[] = {
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
-
#define GPIO_SET_HS(bank, number) \
- (STM32_GPIO_OSPEEDR(GPIO_##bank) |= (0x3 << (number * 2)))
+ (STM32_GPIO_OSPEEDR(GPIO_##bank) |= (0x3 << ((number) * 2)))
void board_config_post_gpio_init(void)
{
@@ -63,8 +90,3 @@ void board_config_post_gpio_init(void)
GPIO_SET_HS(C, 7);
}
-static void board_init(void)
-{
-}
-DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
-
diff --git a/board/stm32f446e-eval/board.h b/board/stm32f446e-eval/board.h
index f70ddd5bb5..a346925b13 100644
--- a/board/stm32f446e-eval/board.h
+++ b/board/stm32f446e-eval/board.h
@@ -11,9 +11,6 @@
/* Use external clock */
#define CONFIG_STM32_CLOCK_HSE_HZ 8000000
-/* Optional features */
-#undef CONFIG_WATCHDOG_HELP
-#undef CONFIG_LID_SWITCH
#define CONFIG_BOARD_POST_GPIO_INIT
/* Enable console recasting of GPIO type. */
@@ -32,6 +29,25 @@
#define I2C_PORT_0 0
#define FMPI2C_PORT_3 3
+/* USB Configuration */
+#define CONFIG_USB
+#define CONFIG_USB_PID 0x500f
+#define CONFIG_USB_CONSOLE
+
+#define CONFIG_USB_SELF_POWERED
+
+#define CONFIG_USB_SERIALNO
+#define DEFAULT_SERIALNO "Uninitialized"
+
+/* USB interface indexes (use define rather than enum to expand them) */
+#define USB_IFACE_CONSOLE 0
+#define USB_IFACE_COUNT 1
+
+/* USB endpoint indexes (use define rather than enum to expand them) */
+#define USB_EP_CONTROL 0
+#define USB_EP_CONSOLE 1
+#define USB_EP_COUNT 2
+
/* This is not actually an EC so disable some features. */
#undef CONFIG_WATCHDOG_HELP
#undef CONFIG_LID_SWITCH
@@ -40,6 +56,7 @@
/* Optional features */
#define CONFIG_STM_HWTIMER32
#define CONFIG_DMA_HELP
+#define CONFIG_FLASH
/*
* Allow dangerous commands all the time, since we don't have a write protect
@@ -48,12 +65,22 @@
#define CONFIG_SYSTEM_UNLOCKED
#ifndef __ASSEMBLER__
-#undef CONFIG_FLASH
/* Timer selection */
#define TIM_CLOCK32 5
#include "gpio_signal.h"
+/* USB string indexes */
+enum usb_strings {
+ USB_STR_DESC = 0,
+ USB_STR_VENDOR,
+ USB_STR_PRODUCT,
+ USB_STR_SERIALNO,
+ USB_STR_VERSION,
+ USB_STR_CONSOLE_NAME,
+ USB_STR_COUNT
+};
+
#endif /* !__ASSEMBLER__ */
#endif /* __CROS_EC_BOARD_H */