hammer: Only define required options for RO and RW

RO does not need touchpad/keyboard driver or I2C passthru, RW does
not need RW verification, let's shrink both images by only including
required config options.

BRANCH=none
BUG=b:35582031
TEST=Build and flash hammer: still functional.
   build/hammer/RO/ec.RO.flat shrank by 10144 bytes: (45868 to 35724)
   build/hammer/RW/ec.RW.flat shrank by 2764 bytes: (45332 to 42568)

Change-Id: Iff0feb4e8446cc9f2e32103cd383fddae3234fec
Reviewed-on: https://chromium-review.googlesource.com/479492
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
This commit is contained in:
Nicolas Boichat
2017-04-17 08:02:38 +08:00
committed by chrome-bot
parent 896409ef79
commit be294d4efb
4 changed files with 35 additions and 14 deletions

View File

@@ -45,6 +45,7 @@ BUILD_ASSERT(ARRAY_SIZE(usb_strings) == USB_STR_COUNT);
* usb_i2c_board_disable to be defined to enable and disable the I2C bridge.
*/
#ifdef SECTION_IS_RW
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
{"master", I2C_PORT_MASTER, 400,
@@ -60,6 +61,7 @@ BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
int usb_i2c_board_enable(void) { return EC_SUCCESS; }
void usb_i2c_board_disable(void) {}
#endif
/******************************************************************************
* Initialize board.

View File

@@ -80,9 +80,6 @@
#define CONFIG_USB_PID 0x5022
#define CONFIG_STREAM_USB
#define CONFIG_USB_UPDATE
#define CONFIG_USB_HID
#define CONFIG_USB_HID_KEYBOARD
#define CONFIG_USB_HID_TOUCHPAD
#undef CONFIG_USB_MAXPOWER_MA
#define CONFIG_USB_MAXPOWER_MA 100
@@ -99,18 +96,26 @@
/* USB interface indexes (use define rather than enum to expand them) */
#define USB_IFACE_UPDATE 0
#ifdef SECTION_IS_RW
#define USB_IFACE_HID_KEYBOARD 1
#define USB_IFACE_HID_TOUCHPAD 2
#define USB_IFACE_I2C 3
#define USB_IFACE_COUNT 4
#else
#define USB_IFACE_COUNT 1
#endif
/* USB endpoint indexes (use define rather than enum to expand them) */
#define USB_EP_CONTROL 0
#define USB_EP_UPDATE 1
#ifdef SECTION_IS_RW
#define USB_EP_HID_KEYBOARD 2
#define USB_EP_HID_TOUCHPAD 3
#define USB_EP_I2C 4
#define USB_EP_COUNT 5
#else
#define USB_EP_COUNT 2
#endif
/* Optional features */
#define CONFIG_BOARD_PRE_INIT
@@ -119,6 +124,11 @@
/* No lid switch */
#undef CONFIG_LID_SWITCH
#ifdef SECTION_IS_RW
#define CONFIG_USB_HID
#define CONFIG_USB_HID_KEYBOARD
#define CONFIG_USB_HID_TOUCHPAD
/* Keyboard output port list */
#define CONFIG_KEYBOARD_DEBUG
#define KB_OUT_PORT_LIST GPIO_A, GPIO_B, GPIO_C, GPIO_F
@@ -132,13 +142,21 @@
/* Enable PWM */
#define CONFIG_PWM
/* Enable elan trackpad driver */
#define CONFIG_TOUCHPAD_ELAN
#define CONFIG_TOUCHPAD_I2C_PORT 0
#define CONFIG_TOUCHPAD_I2C_ADDR (0x15 << 1)
#else /* SECTION_IS_RO */
/* Sign and switch to RW partition on boot. */
#define CONFIG_RWSIG
#define CONFIG_RWSIG_TYPE_RWSIG
#define CONFIG_RSA
#define CONFIG_SHA256
#define CONFIG_RSA_KEY_SIZE 3072
#define CONFIG_RSA_EXPONENT_3
#endif
#define CONFIG_RWSIG_TYPE_RWSIG
/*
* Add rollback protection, and independent RW region protection.
@@ -146,11 +164,6 @@
#define CONFIG_ROLLBACK
#define CONFIG_FLASH_PROTECT_RW
/* Enable elan trackpad driver */
#define CONFIG_TOUCHPAD_ELAN
#define CONFIG_TOUCHPAD_I2C_PORT 0
#define CONFIG_TOUCHPAD_I2C_ADDR (0x15 << 1)
#ifndef __ASSEMBLER__
/* Timer selection */
@@ -172,11 +185,13 @@ enum usb_strings {
USB_STR_COUNT
};
#ifdef SECTION_IS_RW
enum pwm_channel {
PWM_CH_KBLIGHT = 0,
/* Number of PWM channels */
PWM_CH_COUNT
};
#endif
#endif /* !__ASSEMBLER__ */
#endif /* __CROS_EC_BOARD_H */

View File

@@ -17,8 +17,8 @@
* 's' is the stack size in bytes; must be a multiple of 8
*/
#define CONFIG_TASK_LIST \
TASK_ALWAYS(RWSIG, rwsig_task, NULL, 1024) \
TASK_ALWAYS(HOOKS, hook_task, NULL, LARGER_TASK_STACK_SIZE) \
TASK_ALWAYS(TOUCHPAD, elan_tp_task, NULL, TASK_STACK_SIZE) \
TASK_ALWAYS(CONSOLE, console_task, NULL, LARGER_TASK_STACK_SIZE) \
TASK_NOTEST(KEYSCAN, keyboard_scan_task, NULL, TASK_STACK_SIZE)
TASK_ALWAYS_RO(RWSIG, rwsig_task, NULL, 1024) \
TASK_ALWAYS (HOOKS, hook_task, NULL, LARGER_TASK_STACK_SIZE) \
TASK_ALWAYS_RW(TOUCHPAD, elan_tp_task, NULL, TASK_STACK_SIZE) \
TASK_ALWAYS (CONSOLE, console_task, NULL, LARGER_TASK_STACK_SIZE) \
TASK_NOTEST_RW(KEYSCAN, keyboard_scan_task, NULL, TASK_STACK_SIZE)

View File

@@ -8,6 +8,10 @@
#ifndef __CROS_EC_TOUCHPAD_ELAN_H
#define __CROS_EC_TOUCHPAD_ELAN_H
#ifdef CONFIG_TOUCHPAD_ELAN
void elan_tp_interrupt(enum gpio_signal signal);
#else
static inline void elan_tp_interrupt(enum gpio_signal signal) { }
#endif /* !CONFIG_TOUCHPAD_ELAN */
#endif