summaryrefslogtreecommitdiff
path: root/board/cr50
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2015-05-04 14:13:27 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-05-07 23:39:03 +0000
commitd3771ff35928d7c00882e382577841b78c68190d (patch)
treea6735fd7a8020c548a4ab933987b1c40b0200ebc /board/cr50
parent17487510e3e2f91f44692e7d30db8c7d8fcde2bd (diff)
downloadchrome-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/cr50')
-rw-r--r--board/cr50/board.c4
-rw-r--r--board/cr50/board.h3
-rw-r--r--board/cr50/build.mk2
3 files changed, 8 insertions, 1 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