diff options
author | Vadim Bendebury <vbendeb@chromium.org> | 2015-05-04 14:13:27 -0700 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-05-07 23:39:03 +0000 |
commit | d3771ff35928d7c00882e382577841b78c68190d (patch) | |
tree | a6735fd7a8020c548a4ab933987b1c40b0200ebc /board | |
parent | 17487510e3e2f91f44692e7d30db8c7d8fcde2bd (diff) | |
download | chrome-ec-d3771ff35928d7c00882e382577841b78c68190d.tar.gz |
cr50: share board directory among board variants
The code in board/cr50 and board/cr50_a1 directories is pretty much
identical apart from a few lines related to USB. Let's consolidate the
both board variants in the same source directory.
The command to build the cr50 board remains the same. The command to
build cr50_a1 becomes
$ make BOARD=cr50 CHIP_VARIANT=cr50_a1 out=build/cr50_a1
This is a small inconvenience to pay to avoid duplicating many patches
in two subdirectories.
BRANCH=none
BUG=none
TEST='make buildall' still succeeds
compared map files for cr50_a1 before and after the change. They
are identical modulo addition of the empty function
send_hid_event() in board.o.
Change-Id: I7584c8f215945b8b33eea4eff50c872a09ef349d
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/269160
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Sheng-liang Song <ssl@chromium.org>
Diffstat (limited to 'board')
-rw-r--r-- | board/cr50/board.c | 4 | ||||
-rw-r--r-- | board/cr50/board.h | 3 | ||||
-rw-r--r-- | board/cr50/build.mk | 2 | ||||
l--------- | board/cr50_a1/Makefile | 1 | ||||
-rw-r--r-- | board/cr50_a1/board.c | 51 | ||||
-rw-r--r-- | board/cr50_a1/board.h | 38 | ||||
-rw-r--r-- | board/cr50_a1/build.mk | 15 | ||||
-rw-r--r-- | board/cr50_a1/dev_key.pem | 27 | ||||
-rw-r--r-- | board/cr50_a1/ec.tasklist | 21 | ||||
-rw-r--r-- | board/cr50_a1/gpio.inc | 65 |
10 files changed, 8 insertions, 219 deletions
diff --git a/board/cr50/board.c b/board/cr50/board.c index 3b7e1613d9..a811ad345f 100644 --- a/board/cr50/board.c +++ b/board/cr50/board.c @@ -26,6 +26,7 @@ static void send_hid_event(void) { +#if !defined(CHIP_VARIANT_CR50_A1) uint64_t rpt = 0; uint8_t *key_ptr = (void *)&rpt + 2; /* Convert SW_N/SW_S/SW_W/SW_E to A,B,C,D keys */ @@ -41,6 +42,7 @@ static void send_hid_event(void) set_keyboard_report(rpt); /* check release in the future */ hook_call_deferred(send_hid_event, 40); +#endif } DECLARE_DEFERRED(send_hid_event); @@ -74,6 +76,7 @@ static void board_init(void) } DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); +#if !defined(CHIP_VARIANT_CR50_A1) const void * const usb_strings[] = { [USB_STR_DESC] = usb_string_desc, [USB_STR_VENDOR] = USB_STRING_DESC("Google Inc."), @@ -82,3 +85,4 @@ const void * const usb_strings[] = { [USB_STR_CONSOLE_NAME] = USB_STRING_DESC("Shell"), }; BUILD_ASSERT(ARRAY_SIZE(usb_strings) == USB_STR_COUNT); +#endif diff --git a/board/cr50/board.h b/board/cr50/board.h index be43d755eb..9552fad650 100644 --- a/board/cr50/board.h +++ b/board/cr50/board.h @@ -15,6 +15,8 @@ #undef CONFIG_HIBERNATE #undef CONFIG_LID_SWITCH +#if !defined(CHIP_VARIANT_CR50_A1) + /* USB configuration */ #define CONFIG_USB #define CONFIG_USB_CONSOLE @@ -22,6 +24,7 @@ #define CONFIG_USB_PID 0x5014 +#endif /* * Allow dangerous commands all the time, since we don't have a write protect * switch. diff --git a/board/cr50/build.mk b/board/cr50/build.mk index 3e34de12f9..247303cb0f 100644 --- a/board/cr50/build.mk +++ b/board/cr50/build.mk @@ -7,7 +7,7 @@ CHIP:=g CHIP_FAMILY:=cr50 -CHIP_VARIANT:=cr50_fpga +CHIP_VARIANT ?= cr50_fpga board-y=board.o diff --git a/board/cr50_a1/Makefile b/board/cr50_a1/Makefile deleted file mode 120000 index 94aaae2c4d..0000000000 --- a/board/cr50_a1/Makefile +++ /dev/null @@ -1 +0,0 @@ -../../Makefile
\ No newline at end of file diff --git a/board/cr50_a1/board.c b/board/cr50_a1/board.c deleted file mode 100644 index 92a6808c11..0000000000 --- a/board/cr50_a1/board.c +++ /dev/null @@ -1,51 +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 "console.h" -#include "gpio.h" -#include "hooks.h" -#include "registers.h" -#include "task.h" -#include "util.h" - -/* - * There's no way to trigger on both rising and falling edges, so force a - * compiler error if we try. The workaround is to use the pinmux to connect - * two GPIOs to the same input and configure each one for a separate edge. - */ -#undef GPIO_INT_BOTH -#define GPIO_INT_BOTH NOT_SUPPORTED_ON_CR50 - -#include "gpio_list.h" - -/* Interrupt handler for button pushes */ -void button_event(enum gpio_signal signal) -{ - int v; - - /* We have two GPIOs on the same input (one rising edge, one falling - * edge), so de-alias them */ - if (signal >= GPIO_SW_N_) - signal -= (GPIO_SW_N_ - GPIO_SW_N); - - v = gpio_get_level(signal); - ccprintf("Button %d = %d\n", signal, v); - gpio_set_level(signal - GPIO_SW_N + GPIO_LED_4, v); -} - -/* Initialize board. */ -static void board_init(void) -{ - gpio_enable_interrupt(GPIO_SW_N); - gpio_enable_interrupt(GPIO_SW_S); - gpio_enable_interrupt(GPIO_SW_W); - gpio_enable_interrupt(GPIO_SW_E); - gpio_enable_interrupt(GPIO_SW_N_); - gpio_enable_interrupt(GPIO_SW_S_); - gpio_enable_interrupt(GPIO_SW_W_); - gpio_enable_interrupt(GPIO_SW_E_); -} -DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); diff --git a/board/cr50_a1/board.h b/board/cr50_a1/board.h deleted file mode 100644 index e03544c8d5..0000000000 --- a/board/cr50_a1/board.h +++ /dev/null @@ -1,38 +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. - */ - -#ifndef __BOARD_H -#define __BOARD_H - -/* Features that we don't want just yet */ -#undef CONFIG_CMD_LID_ANGLE -#undef CONFIG_CMD_POWERINDEBUG -#undef CONFIG_DMA_DEFAULT_HANDLERS -#undef CONFIG_FLASH -#undef CONFIG_FMAP -#undef CONFIG_HIBERNATE -#undef CONFIG_LID_SWITCH - -/* - * Allow dangerous commands all the time, since we don't have a write protect - * switch. - */ -#define CONFIG_SYSTEM_UNLOCKED - -/* Not using software sync, so verify RW signature instead */ -#define CONFIG_RWSIG -#define CONFIG_RSA -#define CONFIG_SHA256 - -#ifndef __ASSEMBLER__ - -#include "gpio_signal.h" - -/* user button interrupt handler */ -void button_event(enum gpio_signal signal); - -#endif /* !__ASSEMBLER__ */ - -#endif /* __BOARD_H */ diff --git a/board/cr50_a1/build.mk b/board/cr50_a1/build.mk deleted file mode 100644 index 9b0a26c13d..0000000000 --- a/board/cr50_a1/build.mk +++ /dev/null @@ -1,15 +0,0 @@ -# -*- makefile -*- -# 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. -# -# Board specific files build - -CHIP:=g -CHIP_FAMILY:=cr50 -CHIP_VARIANT:=cr50_a1 - -board-y=board.o - -# Need to generate a .hex file -all: hex diff --git a/board/cr50_a1/dev_key.pem b/board/cr50_a1/dev_key.pem deleted file mode 100644 index 6f15b80652..0000000000 --- a/board/cr50_a1/dev_key.pem +++ /dev/null @@ -1,27 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIEogIBAAKCAQEAsaHkxeqOorLS8/Ixp43ZnPnJ+ItBIbX4AkmKFLZyLus9NaFX -j2r+qIM0Daxsaq/qvtlnRNrQ313XH/F5e1xrdTcC4VovR8Q4wXh+hEw4Nhcz2U/c -daZMaBJUZlYEHpi2R9UXcflDS68oE5GNJT5EuGfqdpvStTFMU33Bv7cxgf3lQg2c -fhMoNNjTxzzR+ta0lmaQLZ7kh6IOIb0SoTmANvmtANPd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4IY3AQh85K2wQmDjmGXHWfGU13Y+MAKdaJYiKitjV9S -1oU96v4syWtOacOVenDnj0TRuKagoUZ6RXg0PrKAXx2qL3mWL7kvHMvzJGLqAIKf -ae7xAoGAClWOT/hzzUROAVYIYszYUXrVAtCC896m8b8VRG1kL3GL/pOyKoqvVybi -Mx9V1mi/oFcBA2MGDAaJUJEQ7JYih/go3auzEmL3zQHzeLofaldFjOt2kN1ff6UF -HKyS+l/Ub1NVhHkXoVZpo6spKyMG/iPm4qr+rIvkwwfF1e2OADU= ------END RSA PRIVATE KEY----- diff --git a/board/cr50_a1/ec.tasklist b/board/cr50_a1/ec.tasklist deleted file mode 100644 index 8ff4e8234b..0000000000 --- a/board/cr50_a1/ec.tasklist +++ /dev/null @@ -1,21 +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. - */ - -/** - * List of enabled tasks in the priority order - * - * The first one has the lowest priority. - * - * For each task, use the macro TASK_ALWAYS(n, r, d, s) for base tasks and - * TASK_NOTEST(n, r, d, s) for tasks that can be excluded in test binaries, - * where : - * 'n' in the name of the task - * 'r' in the main routine of the task - * 'd' in an opaque parameter passed to the routine at startup - * 's' is the stack size in bytes; must be a multiple of 8 - */ -#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/cr50_a1/gpio.inc b/board/cr50_a1/gpio.inc deleted file mode 100644 index d5cf447cb1..0000000000 --- a/board/cr50_a1/gpio.inc +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- mode:c -*- - * 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. - */ - -/* Inputs with interrupt handlers are first for efficiency */ - -/* User Push buttons */ -GPIO_INT(SW_N, 0, 0, GPIO_INT_RISING, button_event) -GPIO_INT(SW_S, 0, 1, GPIO_INT_RISING, button_event) -GPIO_INT(SW_W, 0, 2, GPIO_INT_RISING, button_event) -GPIO_INT(SW_E, 0, 3, GPIO_INT_RISING, button_event) - -/* We can't trigger on both rising and falling edge, so attach each button - * to two input GPIOs. */ -GPIO_INT(SW_N_, 1, 0, GPIO_INT_FALLING, button_event) -GPIO_INT(SW_S_, 1, 1, GPIO_INT_FALLING, button_event) -GPIO_INT(SW_W_, 1, 2, GPIO_INT_FALLING, button_event) -GPIO_INT(SW_E_, 1, 3, GPIO_INT_FALLING, button_event) - -/* User GPIO LEDs */ -GPIO(LED_2, 0, 4, GPIO_OUT_LOW) -GPIO(LED_3, 0, 5, GPIO_OUT_LOW) -GPIO(LED_4, 0, 6, GPIO_OUT_LOW) -GPIO(LED_5, 0, 7, GPIO_OUT_LOW) -GPIO(LED_6, 0, 8, GPIO_OUT_LOW) -GPIO(LED_7, 0, 9, GPIO_OUT_LOW) - -/* Unimplemented signals which we need to emulate for now */ -UNIMPLEMENTED(ENTERING_RW) - -/* The Cr50 ARM core has no alternate functions, so we repurpose that - * macro to describe the PINMUX setup. The args are - * - * 1. The ARM core GPIO or SoC peripheral function to connect - * 2. The pinmux DIO pad to connect to - * 3. <ignored> - * 4. MODULE_GPIO, to prevent being called by gpio_config_module() - * 5. flags to specify the direction if the GPIO isn't enough - */ - -/* The serial port is one of the SoC peripheral functions */ -ALTERNATE(FUNC(UART0_TX), DIO(A0), 0, MODULE_GPIO, DIO_OUTPUT) -ALTERNATE(FUNC(UART0_RX), DIO(A1), 0, MODULE_GPIO, DIO_INPUT) - -/* Inputs */ -ALTERNATE(SW_N, DIO(M0), 0, MODULE_GPIO, 0) -ALTERNATE(SW_S, DIO(M1), 0, MODULE_GPIO, 0) -ALTERNATE(SW_W, DIO(M2), 0, MODULE_GPIO, 0) -ALTERNATE(SW_E, DIO(M3), 0, MODULE_GPIO, 0) - -/* Aliased Inputs, connected to the same pins */ -ALTERNATE(SW_N_, DIO(M0), 0, MODULE_GPIO, 0) -ALTERNATE(SW_S_, DIO(M1), 0, MODULE_GPIO, 0) -ALTERNATE(SW_W_, DIO(M2), 0, MODULE_GPIO, 0) -ALTERNATE(SW_E_, DIO(M3), 0, MODULE_GPIO, 0) - -/* Outputs - also mark as inputs so we can read back from the driven pin */ -ALTERNATE(LED_2, DIO(A9), 0, MODULE_GPIO, DIO_INPUT) -ALTERNATE(LED_3, DIO(A10), 0, MODULE_GPIO, DIO_INPUT) -ALTERNATE(LED_4, DIO(A11), 0, MODULE_GPIO, DIO_INPUT) -ALTERNATE(LED_5, DIO(A12), 0, MODULE_GPIO, DIO_INPUT) -ALTERNATE(LED_6, DIO(A13), 0, MODULE_GPIO, DIO_INPUT) -ALTERNATE(LED_7, DIO(A14), 0, MODULE_GPIO, DIO_INPUT) |