summaryrefslogtreecommitdiff
path: root/board/discovery-stm32f072
diff options
context:
space:
mode:
Diffstat (limited to 'board/discovery-stm32f072')
-rw-r--r--board/discovery-stm32f072/board.c209
-rw-r--r--board/discovery-stm32f072/board.h88
-rw-r--r--board/discovery-stm32f072/build.mk13
-rw-r--r--board/discovery-stm32f072/ec.tasklist11
-rw-r--r--board/discovery-stm32f072/gpio.inc33
-rw-r--r--board/discovery-stm32f072/openocd-flash.cfg19
6 files changed, 0 insertions, 373 deletions
diff --git a/board/discovery-stm32f072/board.c b/board/discovery-stm32f072/board.c
deleted file mode 100644
index c7099f55d1..0000000000
--- a/board/discovery-stm32f072/board.c
+++ /dev/null
@@ -1,209 +0,0 @@
-/* Copyright 2014 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 configuration */
-
-#include "common.h"
-#include "ec_version.h"
-#include "gpio.h"
-#include "hooks.h"
-#include "queue_policies.h"
-#include "registers.h"
-#include "spi.h"
-#include "task.h"
-#include "usart-stm32f0.h"
-#include "usart_tx_dma.h"
-#include "usart_rx_dma.h"
-#include "usb_gpio.h"
-#include "usb_spi.h"
-#include "usb-stream.h"
-#include "util.h"
-
-/******************************************************************************
- * Build GPIO tables and expose a subset of the GPIOs over USB.
- */
-void button_event(enum gpio_signal signal);
-
-#include "gpio_list.h"
-
-static enum gpio_signal const usb_gpio_list[] = {
- GPIO_USER_BUTTON,
- GPIO_LED_U,
- GPIO_LED_D,
- GPIO_LED_L,
- GPIO_LED_R,
-};
-
-/*
- * This instantiates struct usb_gpio_config const usb_gpio, plus several other
- * variables, all named something beginning with usb_gpio_
- */
-USB_GPIO_CONFIG(usb_gpio,
- usb_gpio_list,
- USB_IFACE_GPIO,
- USB_EP_GPIO);
-
-/******************************************************************************
- * Setup USART1 as a loopback device, it just echo's back anything sent to it.
- */
-static struct usart_config const loopback_usart;
-
-static struct queue const loopback_queue =
- QUEUE_DIRECT(64, uint8_t,
- loopback_usart.producer,
- loopback_usart.consumer);
-
-static struct usart_rx_dma const loopback_rx_dma =
- USART_RX_DMA(STM32_DMAC_CH3, 8);
-
-static struct usart_tx_dma const loopback_tx_dma =
- USART_TX_DMA(STM32_DMAC_CH2, 16);
-
-static struct usart_config const loopback_usart =
- USART_CONFIG(usart1_hw,
- loopback_rx_dma.usart_rx,
- loopback_tx_dma.usart_tx,
- 115200,
- 0,
- loopback_queue,
- loopback_queue);
-
-/******************************************************************************
- * Forward USART4 as a simple USB serial interface.
- */
-static struct usart_config const forward_usart;
-struct usb_stream_config const forward_usb;
-
-static struct queue const usart_to_usb = QUEUE_DIRECT(64, uint8_t,
- forward_usart.producer,
- forward_usb.consumer);
-static struct queue const usb_to_usart = QUEUE_DIRECT(64, uint8_t,
- forward_usb.producer,
- forward_usart.consumer);
-
-static struct usart_tx_dma const forward_tx_dma =
- USART_TX_DMA(STM32_DMAC_CH7, 16);
-
-static struct usart_config const forward_usart =
- USART_CONFIG(usart4_hw,
- usart_rx_interrupt,
- forward_tx_dma.usart_tx,
- 115200,
- 0,
- usart_to_usb,
- usb_to_usart);
-
-#define USB_STREAM_RX_SIZE 16
-#define USB_STREAM_TX_SIZE 16
-
-USB_STREAM_CONFIG(forward_usb,
- USB_IFACE_STREAM,
- USB_STR_STREAM_NAME,
- USB_EP_STREAM,
- USB_STREAM_RX_SIZE,
- USB_STREAM_TX_SIZE,
- usb_to_usart,
- usart_to_usb)
-
-/******************************************************************************
- * Handle button presses by cycling the LEDs on the board. Also run a tick
- * handler to cycle them when they are not actively under USB control.
- */
-void button_event(enum gpio_signal signal)
-{
- static int count;
-
- gpio_set_level(GPIO_LED_U, (count & 0x03) == 0);
- gpio_set_level(GPIO_LED_R, (count & 0x03) == 1);
- gpio_set_level(GPIO_LED_D, (count & 0x03) == 2);
- gpio_set_level(GPIO_LED_L, (count & 0x03) == 3);
-
- count++;
-}
-
-void usb_gpio_tick(void)
-{
- if (usb_gpio.state->set_mask || usb_gpio.state->clear_mask)
- return;
-
- button_event(0);
-}
-DECLARE_HOOK(HOOK_TICK, usb_gpio_tick, HOOK_PRIO_DEFAULT);
-
-/******************************************************************************
- * 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("discovery-stm32f072"),
- [USB_STR_VERSION] = USB_STRING_DESC(CROS_EC_VERSION32),
- [USB_STR_STREAM_NAME] = USB_STRING_DESC("Forward"),
- [USB_STR_CONSOLE_NAME] = USB_STRING_DESC("Shell"),
-};
-
-BUILD_ASSERT(ARRAY_SIZE(usb_strings) == USB_STR_COUNT);
-
-
-/******************************************************************************
- * Support SPI bridging over USB, this requires usb_spi_board_enable and
- * usb_spi_board_disable to be defined to enable and disable the SPI bridge.
- */
-
-/* SPI devices */
-const struct spi_device_t spi_devices[] = {
- { CONFIG_SPI_FLASH_PORT, 0, GPIO_SPI_CS},
-};
-const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices);
-
-void usb_spi_board_enable(struct usb_spi_config const *config)
-{
- /* Remap SPI2 to DMA channels 6 and 7 */
- STM32_SYSCFG_CFGR1 |= BIT(24);
-
- /* Configure SPI GPIOs */
- gpio_config_module(MODULE_SPI_FLASH, 1);
-
- /* Set all four SPI pins to high speed */
- STM32_GPIO_OSPEEDR(GPIO_B) |= 0xff000000;
-
- /* Enable clocks to SPI2 module */
- STM32_RCC_APB1ENR |= STM32_RCC_PB1_SPI2;
-
- /* Reset SPI2 */
- STM32_RCC_APB1RSTR |= STM32_RCC_PB1_SPI2;
- STM32_RCC_APB1RSTR &= ~STM32_RCC_PB1_SPI2;
-
- spi_enable(&spi_devices[0], 1);
-}
-
-void usb_spi_board_disable(struct usb_spi_config const *config)
-{
- spi_enable(&spi_devices[0], 0);
-
- /* Disable clocks to SPI2 module */
- STM32_RCC_APB1ENR &= ~STM32_RCC_PB1_SPI2;
-
- /* Release SPI GPIOs */
- gpio_config_module(MODULE_SPI_FLASH, 0);
-}
-
-USB_SPI_CONFIG(usb_spi, USB_IFACE_SPI, USB_EP_SPI, 0);
-
-/******************************************************************************
- * Initialize board.
- */
-static void board_init(void)
-{
- gpio_enable_interrupt(GPIO_USER_BUTTON);
-
- queue_init(&loopback_queue);
- queue_init(&usart_to_usb);
- queue_init(&usb_to_usart);
- usart_init(&loopback_usart);
- usart_init(&forward_usart);
-
- usb_spi_enable(&usb_spi, 1);
-}
-DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
diff --git a/board/discovery-stm32f072/board.h b/board/discovery-stm32f072/board.h
deleted file mode 100644
index d3f51f6691..0000000000
--- a/board/discovery-stm32f072/board.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/* Copyright 2014 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 configuration */
-
-#ifndef __CROS_EC_BOARD_H
-#define __CROS_EC_BOARD_H
-
-/* 48 MHz SYSCLK clock frequency */
-#define CPU_CLOCK 48000000
-
-/* Enable USART1,3,4 and USB streams */
-#define CONFIG_STREAM_USART
-#define CONFIG_STREAM_USART1
-#define CONFIG_STREAM_USART4
-#define CONFIG_STREAM_USB
-#define CONFIG_CMD_USART_INFO
-
-/* the UART console is on USART2 (PA14/PA15) */
-#undef CONFIG_UART_CONSOLE
-#define CONFIG_UART_CONSOLE 2
-
-/* Optional features */
-#define CONFIG_STM_HWTIMER32
-#define CONFIG_HW_CRC
-
-/* USB Configuration */
-#define CONFIG_USB
-#define CONFIG_USB_PID 0x500f
-#define CONFIG_USB_CONSOLE
-
-/* USB interface indexes (use define rather than enum to expand them) */
-#define USB_IFACE_STREAM 0
-#define USB_IFACE_GPIO 1
-#define USB_IFACE_SPI 2
-#define USB_IFACE_CONSOLE 3
-#define USB_IFACE_COUNT 4
-
-/* USB endpoint indexes (use define rather than enum to expand them) */
-#define USB_EP_CONTROL 0
-#define USB_EP_STREAM 1
-#define USB_EP_GPIO 2
-#define USB_EP_SPI 3
-#define USB_EP_CONSOLE 4
-#define USB_EP_COUNT 5
-
-/* Enable control of GPIOs over USB */
-#define CONFIG_USB_GPIO
-
-/* Enable control of SPI over USB */
-#define CONFIG_SPI_CONTROLLER
-#define CONFIG_SPI_FLASH_PORT 0 /* First SPI master port */
-
-
-#define CONFIG_USB_SPI
-
-#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__
-
-/* Timer selection */
-#define TIM_CLOCK32 2
-
-#include "gpio_signal.h"
-
-/* USB string indexes */
-enum usb_strings {
- USB_STR_DESC = 0,
- USB_STR_VENDOR,
- USB_STR_PRODUCT,
- USB_STR_VERSION,
- USB_STR_STREAM_NAME,
- USB_STR_CONSOLE_NAME,
-
- USB_STR_COUNT
-};
-
-#endif /* !__ASSEMBLER__ */
-#endif /* __CROS_EC_BOARD_H */
diff --git a/board/discovery-stm32f072/build.mk b/board/discovery-stm32f072/build.mk
deleted file mode 100644
index c1892335ed..0000000000
--- a/board/discovery-stm32f072/build.mk
+++ /dev/null
@@ -1,13 +0,0 @@
-# -*- makefile -*-
-# Copyright 2014 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 STM32F072RBT6
-CHIP:=stm32
-CHIP_FAMILY:=stm32f0
-CHIP_VARIANT:=stm32f07x
-
-board-y=board.o
diff --git a/board/discovery-stm32f072/ec.tasklist b/board/discovery-stm32f072/ec.tasklist
deleted file mode 100644
index cc4c2ad42d..0000000000
--- a/board/discovery-stm32f072/ec.tasklist
+++ /dev/null
@@ -1,11 +0,0 @@
-/* Copyright 2014 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.
- */
-
-/**
- * See CONFIG_TASK_LIST in config.h for details.
- */
-#define CONFIG_TASK_LIST \
- TASK_ALWAYS(HOOKS, hook_task, NULL, TASK_STACK_SIZE) \
- TASK_ALWAYS(CONSOLE, console_task, NULL, TASK_STACK_SIZE)
diff --git a/board/discovery-stm32f072/gpio.inc b/board/discovery-stm32f072/gpio.inc
deleted file mode 100644
index 65bdd0179b..0000000000
--- a/board/discovery-stm32f072/gpio.inc
+++ /dev/null
@@ -1,33 +0,0 @@
-/* -*- mode:c -*-
- *
- * Copyright 2014 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.
- */
-
-/* Declare symbolic names for all the GPIOs that we care about.
- * Note: Those with interrupt handlers must be declared first. */
-
-GPIO_INT(USER_BUTTON, PIN(A, 0), GPIO_INT_FALLING, button_event)
-
-/* Outputs */
-GPIO(LED_U, PIN(C, 6), GPIO_OUT_LOW)
-GPIO(LED_D, PIN(C, 7), GPIO_OUT_LOW)
-GPIO(LED_L, PIN(C, 8), GPIO_OUT_LOW)
-GPIO(LED_R, PIN(C, 9), GPIO_OUT_LOW)
-
-/* Flash SPI interface */
-GPIO(SPI_WP, PIN(C, 3), GPIO_OUT_HIGH)
-GPIO(SPI_HOLD, PIN(C, 4), GPIO_OUT_HIGH)
-GPIO(SPI_CS, PIN(B, 12), GPIO_OUT_HIGH)
-
-ALTERNATE(PIN_MASK(B, 0xE000), 0, MODULE_SPI_FLASH, 0)
-
-/* Unimplemented signals which we need to emulate for now */
-UNIMPLEMENTED(ENTERING_RW)
-UNIMPLEMENTED(WP_L)
-
-ALTERNATE(PIN_MASK(A, 0x0600), 1, MODULE_USART, 0) /* USART1: PA09/PA10 */
-ALTERNATE(PIN_MASK(A, 0xC000), 1, MODULE_UART, 0) /* USART2: PA14/PA15 */
-ALTERNATE(PIN_MASK(B, 0x0C00), 4, MODULE_USART, 0) /* USART3: PB10/PB11 */
-ALTERNATE(PIN_MASK(C, 0x0C00), 0, MODULE_USART, 0) /* USART4: PC10/PC11 */
diff --git a/board/discovery-stm32f072/openocd-flash.cfg b/board/discovery-stm32f072/openocd-flash.cfg
deleted file mode 100644
index ec32416934..0000000000
--- a/board/discovery-stm32f072/openocd-flash.cfg
+++ /dev/null
@@ -1,19 +0,0 @@
-# Copyright 2014 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.
-
-source [find board/stm32f0discovery.cfg]
-
-# For flashing, force the board into reset on connect, this ensures that
-# code running on the core can't interfere with programming.
-reset_config connect_assert_srst
-
-gdb_port 0
-tcl_port 0
-telnet_port 0
-init
-reset init
-flash write_image erase $BUILD_DIR/ec.bin 0x08000000
-reset halt
-resume
-shutdown