diff options
Diffstat (limited to 'board/stm32f446e-eval')
-rw-r--r-- | board/stm32f446e-eval/board.c | 36 | ||||
-rw-r--r-- | board/stm32f446e-eval/board.h | 35 |
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 */ |