diff options
author | Anton Staaf <robotboy@chromium.org> | 2014-12-02 10:42:22 -0800 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-12-08 21:51:59 +0000 |
commit | 9e1f4ed7015ac8543169fe41b74f1939a8b86f3b (patch) | |
tree | 96e0dbba21fffbb74f8c1b2420c58541501f5b0f /board/discovery-stm32f072 | |
parent | 731a2e74872159ecfa910c3174e9d3ae50ff2dae (diff) | |
download | chrome-ec-9e1f4ed7015ac8543169fe41b74f1939a8b86f3b.tar.gz |
USB-SPI: Switch from task to deferred function
The task based approach made sense when it looked like
there would be a case closed debugging task to handle
multiple bridges (SPI/I2C/USART...). I'm not convinced
anymore that that task will be needed, so this
simplification seems good.
Signed-off-by: Anton Staaf <robotboy@chromium.org>
BRANCH=None
BUG=None
TEST=make buildall -j
Change-Id: Ic431c287c28d10252246fe9f507d9c5fcc64a077
Reviewed-on: https://chromium-review.googlesource.com/232733
Tested-by: Anton Staaf <robotboy@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Anton Staaf <robotboy@chromium.org>
Diffstat (limited to 'board/discovery-stm32f072')
-rw-r--r-- | board/discovery-stm32f072/board.c | 4 | ||||
-rw-r--r-- | board/discovery-stm32f072/build.mk | 2 | ||||
-rw-r--r-- | board/discovery-stm32f072/ec.tasklist | 1 | ||||
-rw-r--r-- | board/discovery-stm32f072/spi.c | 29 |
4 files changed, 5 insertions, 31 deletions
diff --git a/board/discovery-stm32f072/board.c b/board/discovery-stm32f072/board.c index 99e0af0b1d..c6a9b3c8a3 100644 --- a/board/discovery-stm32f072/board.c +++ b/board/discovery-stm32f072/board.c @@ -87,9 +87,13 @@ void usb_spi_board_disable(struct usb_spi_config const *config) gpio_config_module(MODULE_SPI_MASTER, 0); } +USB_SPI_CONFIG(usb_spi, USB_IFACE_SPI, USB_EP_SPI); + /* Initialize board. */ static void board_init(void) { gpio_enable_interrupt(GPIO_USER_BUTTON); + + usb_spi_enable(&usb_spi, 1); } DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); diff --git a/board/discovery-stm32f072/build.mk b/board/discovery-stm32f072/build.mk index 7a40d5fc10..d8a22a6ad5 100644 --- a/board/discovery-stm32f072/build.mk +++ b/board/discovery-stm32f072/build.mk @@ -10,4 +10,4 @@ CHIP:=stm32 CHIP_FAMILY:=stm32f0 CHIP_VARIANT:=stm32f07x -board-y=board.o echo.o spi.o +board-y=board.o echo.o diff --git a/board/discovery-stm32f072/ec.tasklist b/board/discovery-stm32f072/ec.tasklist index 73f7aa6835..6a623f151c 100644 --- a/board/discovery-stm32f072/ec.tasklist +++ b/board/discovery-stm32f072/ec.tasklist @@ -19,5 +19,4 @@ #define CONFIG_TASK_LIST \ TASK_ALWAYS(HOOKS, hook_task, NULL, TASK_STACK_SIZE) \ TASK_ALWAYS(CONSOLE, console_task, NULL, TASK_STACK_SIZE) \ - TASK_ALWAYS(USB_SPI, usb_spi_task, NULL, TASK_STACK_SIZE) \ TASK_ALWAYS(ECHO, echo_task, NULL, TASK_STACK_SIZE) diff --git a/board/discovery-stm32f072/spi.c b/board/discovery-stm32f072/spi.c deleted file mode 100644 index b768bb42bc..0000000000 --- a/board/discovery-stm32f072/spi.c +++ /dev/null @@ -1,29 +0,0 @@ -/* Copyright (c) 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. - */ -#include "common.h" -#include "gpio.h" -#include "registers.h" -#include "spi.h" -#include "task.h" -#include "usb_spi.h" - -void usb_spi_ready(struct usb_spi_config const *config) -{ - task_wake(TASK_ID_USB_SPI); -} - -USB_SPI_CONFIG(usb_spi, USB_IFACE_SPI, USB_EP_SPI, usb_spi_ready) - -void usb_spi_task(void) -{ - usb_spi_enable(&usb_spi. 1); - - while (1) { - task_wait_event(-1); - - while (usb_spi_service_request(&usb_spi)) - ; - } -} |