summaryrefslogtreecommitdiff
path: root/chip
Commit message (Collapse)AuthorAgeFilesLines
* stm32g4: Specify correct ARM core and CPU flagsScott Collyer2020-08-311-1/+2
| | | | | | | | | | | | | | | | The only change required for build.mk is to specify the correct ARM core and machine instruction set. BUG=b:148493929 BRANCH=None TEST=verfied image builds successfully. Signed-off-by: Scott Collyer <scollyer@google.com> Change-Id: I267dfbe54de153c8687f5048fdcccf65ac15678f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2195551 Commit-Queue: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* stm32g4: Add flash support for stm32g4 chip familyScott Collyer2020-08-314-83/+91
| | | | | | | | | | | | | | | | | | | This CL adds support for flashing stm32g4. The L4 family has the same flash module and so that was used as basis for G4 driver. This CL renames the l4 flash driver to capture this commonality. In addition, the flash register definitions in G4 registers file was updated appropriately. Previously, this section matched F4 requirements. BUG=b:148493929 BRANCH=None TEST=verfied usb-ep fw update completes successfully Signed-off-by: Scott Collyer <scollyer@google.com> Change-Id: I6cc818c6329524924534b0566bd9d24145c86c72 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2195547 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org>
* stm32l4: Refactor to use page instead of bank notationScott Collyer2020-08-312-31/+77
| | | | | | | | | | | | | | | | | | The L4 and G4 family share the same flash peripheral block. Therefore, the G4 can share the L4 driver. This CL adds macros which more closely track the TRM description of the flash module, especially w.r.t pages. There is no functional change for the L4 driver. BUG=b:148493929 BRANCH=None TEST=make -j BOARD=stm32l476g-eval is successful Signed-off-by: Scott Collyer <scollyer@google.com> Change-Id: Ie2c16ef2b8fa0e35f5945fb124765039f8ea22c7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2376388 Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Scott Collyer <scollyer@chromium.org>
* stm32g4: Fix build issue with i2c driverScott Collyer2020-08-292-2/+1
| | | | | | | | | | | | | | | This CL fixes 2 minor issues which with the i2c driver file. BUG=b:148493929 BRANCH=None TEST=verfied honeybuns builds correctly. Signed-off-by: Scott Collyer <scollyer@google.com> Change-Id: Ide6aafd4e4296891579fa138ec0d3e54a4ed9c6d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2376828 Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Scott Collyer <scollyer@chromium.org>
* it83xx/system: Don't disable DBGR in system resetDino Li2020-08-272-9/+21
| | | | | | | | | | | | | | | | | | | | | | | Our current implementation will disable DBGR (debug mode) in system reset, but this will break flashing sequence. So we make a change to ensure flashing won't be broken under the above situation. Note: DBGR is only applied to flashing sequence, a HW reset after flashing will disable DBGR and allow normal system reset. We also enable wait flashing sequence in this CL, so EC can check if there’s a DBGR flag during initialization and proceed afterwards. BUG=b:118584434, b:165515400 BRANCH=none TEST=- The soft reset still works after flashing. - EC can be flashed even if it is in continuous reboot loop. Change-Id: I9cea2c4fef74de7afcffb203e02f79cb18a4c5bf Signed-off-by: Dino Li <Dino.Li@ite.com.tw> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1243878 Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Jett Rink <jettrink@chromium.org>
* chip/mt8192_scp: do not handle pending IPI interruptsTzung-Bi Shih2020-08-261-7/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | No need to handle pending IPI interrupts. Reasons: - Interrupts are level trigger in MT8192 SCP. As long as the source interrupts persist, RV33 handles them eventually. - task_trigger_irq() fires an additional GIPC_IN0 IRQ. The former one will clear the interrupt source by writing GIPC_IN_CLR. When the latter one is handling, RV33 crashed due to it cannot find the corresponding interrupt source. BRANCH=none BUG=b:163682416 TEST=1. cat - <<EOF >test.sh echo stop >/sys/class/remoteproc/remoteproc0/state while :; do dmesg -C echo start >/sys/class/remoteproc/remoteproc0/state sleep 1 if dmesg | grep -q 'rpmsg send timeout'; then break fi echo stop >/sys/class/remoteproc/remoteproc0/state done echo stop >/sys/class/remoteproc/remoteproc0/state EOF 2. sh test.sh Signed-off-by: Tzung-Bi Shih <tzungbi@chromium.org> Change-Id: I2cc89a258a4ce218389799bbe1101ffc1375af8a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2373846 Reviewed-by: Ting Shen <phoenixshen@chromium.org>
* chip/mt8192_scp: do not switch INTC_IRQ_EN in runtimeTzung-Bi Shih2020-08-261-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MT8192 SCP's interrupt handling is a long path. +----------+ +----------+ +----------+ | INTC | ---> | GVIC | ---> | RV33 | +----------+ +----------+ +----------+ ^ ^ ^ ^ INTC_IRQ_EN VIC_EN MIMASK mie When turning off INTC_IRQ_EN, it is possible GVIC has already latched the interrupt. As a result, RV33 receives the spurious interrupt. MT8192 SCP has no effective way to clear the unwanted interrupt. Thus, do not switch INTC_IRQ_EN in runtime. Disable all interrupts (via mie) instead. BRANCH=none BUG=b:163682416 TEST=1. cat - <<EOF >test.sh echo stop >/sys/class/remoteproc/remoteproc0/state while :; do dmesg -C echo start >/sys/class/remoteproc/remoteproc0/state sleep 1 if dmesg | grep -q 'rpmsg send timeout'; then break fi echo stop >/sys/class/remoteproc/remoteproc0/state done echo stop >/sys/class/remoteproc/remoteproc0/state EOF 2. sh test.sh Signed-off-by: Tzung-Bi Shih <tzungbi@chromium.org> Change-Id: I494330f8d00744c305be7beb19ca6b7084512a72 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2373845 Reviewed-by: Ting Shen <phoenixshen@chromium.org>
* chip/mt8192_scp: add address location of MIEMASK_G0Tzung-Bi Shih2020-08-261-0/+1
| | | | | | | | | | | BRANCH=none BUG=b:163682416 TEST=make BOARD=asurada_scp Signed-off-by: Tzung-Bi Shih <tzungbi@chromium.org> Change-Id: I38e717a4a88d80a6c22ffd74b38904fa2e38fa73 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2352955 Reviewed-by: Ting Shen <phoenixshen@chromium.org>
* it83xx: fix incorrect reset cause when boot from z-stateTing Shen2020-08-252-3/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | Add the following features to support z-state for Asurada. 1) Call chip_save_reset_flags() before entering board_hibernate_late() to make sure the hibernate flag saved before ec powered off. 2) Handle the second ec reset correctly if CONFIG_BOARD_RESET_AFTER_POWER_ON enabled. BUG=b:163963220 TEST=Check the reset cause under following cases: 1) boot from z-state -> reset-pin power-on hibernate initial-pwr 2) boot from cutoff -> reset-pin power-on initial-pwr 3) `ecrst pulse` in cr50 console -> reset-pin power-on initial-pwr BRANCH=none Signed-off-by: Ting Shen <phoenixshen@google.com> Change-Id: I176075ea2b3f6b2abbfe22e47f3019ee23af57a0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2371751 Tested-by: Ting Shen <phoenixshen@chromium.org> Reviewed-by: Ting Shen <phoenixshen@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org>
* usbc: remove PD_EVENT_SM in favor of task_wakeJett Rink2020-08-211-1/+1
| | | | | | | | | | | | | | | | We have used both methods of waking up the PD tasks to process the next state: PD_EVENT_SM and TASK_EVENT_WAKE. They effectively do the same thing and it is more straightforward to only have one way to wake the task up with the sole purpose of re-evaluating the current state. BRANCH=none BUG=none TEST=No regressions on GRL testing. Signed-off-by: Jett Rink <jettrink@chromium.org> Change-Id: I0fa79b82223e6b97eede4130480156949d79f365 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2363466 Reviewed-by: Edward Hill <ecgh@chromium.org>
* it83xx/spi: change configuration to IS_ENABLED() styletim2020-08-191-69/+67
| | | | | | | | | | | BUG=none BRANCH=none TEST=No error on the command of get EC protocol info. Signed-off-by: tim <tim2.lin@ite.corp-partner.google.com> Change-Id: I08d87bd20e60520c891f1b99d78ff91c1e89b2cb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2359613 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* npcx7: introduce new chip variant npcx7m7fcCHLin2020-08-194-10/+23
| | | | | | | | | | | | | | | | | | | | | | | Add the following changes: 1. add CHIP_VARIANT_NPCX7M7WC in the npcx7 chip configuration files to define what (RAM, flash, features...) are supported in npcx7m7fc. 2. add the chip id and chip revision id of npcx7m7fc BRANCH=none BUG=b:163910671 TEST=pass "make buildall" TEST=with related CLs, change CHIP_VARIANT to npcx7m7fc in board/npcx7_evb/build.mk; flash image and run on the internal testing board of npcx7m7fc; make sure the EC can boot up; check the chip ID and chip revision ID are correct by console command "version". Signed-off-by: CHLin <CHLin56@nuvoton.com> Change-Id: Ibef17148eeba71bbbb63145064a5fa398c0118dc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2355156 Tested-by: CH Lin <chlin56@nuvoton.com> Reviewed-by: caveh jalali <caveh@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: CH Lin <chlin56@nuvoton.com>
* Replace __attribute__((noreturn)) with noreturnTom Hughes2020-08-1711-18/+34
| | | | | | | | | | | | | | | _Noreturn was added in C11 and the convenience macro "noreturn" is specified by stdnoreturn.h: https://en.cppreference.com/w/c/language/_Noreturn. BRANCH=none BUG=none TEST=make buildall -j Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: I30361bb5290cea1c776a7356f7e3a68edf1f8e39 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2324816 Reviewed-by: Ting Shen <phoenixshen@chromium.org>
* Clean up: set embedded flash clock 48MHz as defaultRuibin Chang2020-08-172-0/+2
| | | | | | | | | | | | | | | | For chip it8xxx2 series and it8320dx, we set embedded flash clock 48MHz as default. BUG=none BRANCH=none TEST=build all Signed-off-by: Ruibin Chang <ruibin.chang@ite.com.tw> Change-Id: I100d70fbf80430ae98fa14c557886c4a37d8b93a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2355164 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Ruibin Chang <Ruibin.Chang@ite.com.tw> Tested-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
* task: Change mutex_lock() assertEdward Hill2020-08-152-11/+3
| | | | | | | | | | | | | | | | | | | Instead of asserting that task_start() has not been called, just return without doing any locking. This avoids the need to fix every caller of mutex_lock() to check task_start_called(). BUG=b:164461158 BRANCH=none TEST=Esc+F3+Power enters recovery, does not assert. Signed-off-by: Edward Hill <ecgh@chromium.org> Change-Id: Ic157d7e7041185a67f257f0f5710fd02e45cd77f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2357496 Reviewed-by: Wai-Hong Tam <waihong@google.com> Tested-by: Wai-Hong Tam <waihong@google.com> Commit-Queue: Wai-Hong Tam <waihong@google.com>
* it83xx/spi: enable rx valid length interruptDino Li2020-08-143-0/+50
| | | | | | | | | | | | | | | | | | | | | Enable IT83XX_SPI_RX_VALID_INT which can obtain data length field of host requested. When received data to reach, Rx valid interrupt will be fired then start to parse. Instead of waiting for Rx 256 bytes reach interrupt method, this is effectively saving time to complete once transaction. BUG=b:160662061; b:161509047 BRANCH=none TEST=Boot to kernel with it81202 on asurada. No error on the command of get EC protocol info with 1MHz clock frequency. Change-Id: Ib56e3034d3ee39fa64818b95747eb7e9e5821294 Signed-off-by: tim <tim2.lin@ite.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2076826 Reviewed-by: Ting Shen <phoenixshen@chromium.org> Tested-by: Hung-Te Lin <hungte@chromium.org> Commit-Queue: Hung-Te Lin <hungte@chromium.org>
* it83xx/adc: Enable automatic hardware calibrationDino Li2020-08-142-0/+3
| | | | | | | | | | | | | | We missed it when ADC accuracy initialization, let's fix it. BUG=b:164011390 BRANCH=none TEST=ADC accuracy is in +/- 4LSB. Signed-off-by: Dino Li <Dino.Li@ite.com.tw> Change-Id: Id40adbdc6823fbf3db506681ce4bff6a2f32b843 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2355166 Reviewed-by: Ting Shen <phoenixshen@chromium.org> Tested-by: Parker Lin <parkerlin@google.com>
* COIL: change usage of sanityDaisuke Nojiri2020-08-141-1/+1
| | | | | | | | | | | | | | | | Google is working to change its source code to use more inclusive language. To that end, replace the term "sanity" with inclusive alternatives. BUG=b:163885307 BRANCH=None TEST=make -j buildall TEST=grep -ir sanity Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: I487a50999d506a0337f1d3fbe173f193e5e4098a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2353516 Reviewed-by: Sam Hurst <shurst@google.com>
* npcx: add support for rom resident sectionsKeith Short2020-08-132-2/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | EC images are copied in full from flash to RAM. When the code RAM size is smaller than 1/2 the flash size, the EC image size is limited to the code RAM size, leaving unused flash space. Create a new linker section .init_rom used to store data objects that are single use in the previously unused flash area. Data objects can be used at runtime by copying into RAM using the flash_read() function. This change is tied to the NPCX flash layout, with asserts to ensure builds fail if the CONFIG_CHIP_INIT_ROM_REGION is not supported by the chip. CLs that enable CONFIG_CHIP_INIT_ROM_REGION should not be merged until the predecessor CL:2325764 is available in CPFE images. BUG=b:160330682 BRANCH=none TEST=make buildall TEST=With debug code, use the _init_rom macro and validate the data can be read using flash_read(). TEST=Using hex editor, verify .init_rom section located at 192K boundary and unused bytes are filled with 0xFF. TEST=compare_build.sh passes when run against waddledoo (npcx, cortex-m) Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: Ia0785798fd1938ad6a1c254a070b219027ee82a3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2311268 Reviewed-by: caveh jalali <caveh@chromium.org> Commit-Queue: caveh jalali <caveh@chromium.org>
* stm32g4: Add I2C supportScott Collyer2020-08-132-11/+472
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL adds the i2c driver for stm32g4 chip family. The i2c block for stm32g4 is very similar to that of stm32l4 chip family. The g4 driver is mostly copied from the L4 version of the i2c driver. However, the driver only currently supports master mode. BUG=b:148493929 BRANCH=None TEST=run i2scan on EC console > i2cscan Scanning 0 usbc................. 0x18. 0x19. 0x1a. 0x1b. 0x1c. 0x1d. 0x1e. 0x1f. 0x20. 0x21. 0x22. 0x23. 0x24. 0x25. 0x26. 0x27........................... 0x42.............................. 0x60....................... Scanning 1 usb_mst. 0x08. 0x09. 0x0a. 0x0b. 0x0c. 0x0d. 0x0e. 0x0f. 0x10. 0x11. 0x12. 0x13. 0x14. 0x15. 0x16. 0x17... 0x1a........................... 0x35............ 0x41......... 0x4a. 0x4b...................... 0x61...................... Scanning 2 eeprom......................................... 0x30................................ 0x50....................................... Signed-off-by: Scott Collyer <scollyer@google.com> Change-Id: Id8b7472e579bae17360a0122fe2b12a333139cfa Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2161580 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Commit-Queue: Scott Collyer <scollyer@chromium.org>
* stm32g4: Fix max clock freq and flash wait stateScott Collyer2020-08-131-5/+5
| | | | | | | | | | | | | | | | | | | | | The clock frequency macro added in previous CL was missing the '0'. This CL fixes that error and makes a minor change to how the flash wait state value is configured. Previously, setting of the wait state field was disabling instruction/data cache until it was restored in the next instruction. This results in swd debugger not remaining attached. BUG=b:148493929 BRANCH=None TEST=verified console is working and debugger remains attached after setting wait state to the correct value. Signed-off-by: Scott Collyer <scollyer@google.com> Change-Id: I65e3a22e36de0bbf14926e5687a995b7e5717e7f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2340695 Commit-Queue: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* chip/mt8192_scp: enlarge the stack size of idle taskTzung-Bi Shih2020-08-121-1/+1
| | | | | | | | | | | | | | | | | | | Enlarges the stack size of idle task from 256 to 640. BRANCH=none BUG=b:163459890 TEST=$ r() { echo stop >/sys/class/remoteproc/remoteproc0/state echo start >/sys/class/remoteproc/remoteproc0/state } $ r $ r Signed-off-by: Tzung-Bi Shih <tzungbi@chromium.org> Change-Id: I6d887262f39ff32bdb1b86aba59759917a0a95d1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2351640 Reviewed-by: Ting Shen <phoenixshen@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* chip/mt8192_scp: add missing guard for TASK_HOSTCMDTzung-Bi Shih2020-08-121-0/+2
| | | | | | | | | | | | | BRANCH=none BUG=b:160382789 BUG=b:163459890 TEST=1. remove hostcmd task from ec.tasklist 2. make BOARD=asurada_scp Signed-off-by: Tzung-Bi Shih <tzungbi@chromium.org> Change-Id: Ia92abeccd5fba8862563a200cbdcf4ce461f4106 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2351639 Reviewed-by: Ting Shen <phoenixshen@chromium.org>
* task: Fix mutex_lock() assert (reland)Edward Hill2020-08-122-5/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | mutex_lock() must not be used in interrupt context. Add an assert to catch this. Also assert task_start_called() since task ID is not valid before this. Also remove an old assert since comparing id with TASK_ID_INVALID doesn't make sense. Add check for task_start_called() for NPCX flash_lock, I2C port_mutex, pwr_5v_ctl_mtx, STM32 bkpdata_write_mutex. This was submitted CL:2309057, reverted CL:2323704, submitted CL:2335738, reverted CL:2341706. BUG=b:160975910 BRANCH=none TEST=boot AP, jump to RW Signed-off-by: Edward Hill <ecgh@chromium.org> Change-Id: I0aadf29d073f0d3d798432099bd024a058332412 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2343450 Reviewed-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* Revert "task: Fix mutex_lock() assert (reland)"caveh jalali2020-08-071-9/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 8d46141f4d45c65712a9ca7509b7b60128fa4d89. Reason for revert: getting EC boot loop on volteer: (note that you have to flash EC-RO to get this) 20-08-07 00:22:33.520 --- UART initialized after reboot --- 20-08-07 00:22:33.531 [Image: RO, volteer_1.1.9999-4284ce1 @caveh] 20-08-07 00:22:33.531 [Reset cause: reset-pin] 20-08-07 00:22:33.531 [0.005149 KB boot key mask 0] 20-08-07 00:22:33.543 [0.005438 init buttons] 20-08-07 00:22:33.543 [0.005669 VB Main] 20-08-07 00:22:33.543 [0.005872 VB Ping Cr50] 20-08-07 00:22:33.543 [0.007148 hash start 0x00040000 0x0002f61c] 20-08-07 00:22:33.833 [0.300169 hash done e4ddc3d0ffd015db085389d94faa38d3922e42290b6887baa8de3067ce846c13] 20-08-07 00:22:33.833 [0.300289 VB Verifying hash] 20-08-07 00:22:33.833 ��������������������������������EC\0 \0 �������S��O�8Ӓ.B) h����0g΄l[0.317577 VB Received 0xec00] 20-08-07 00:22:33.850 [0.317899 Jumping to image RW] 20-08-07 00:22:33.850 20-08-07 00:22:33.850 ASSERTION FAILURE '!in_interrupt_context() && task_start_called()' in mutex_lock() at core/cortex-m/task.c:868 20-08-07 00:22:33.861 20-08-07 00:22:33.861 === HANDLER EXCEPTION: 00 ====== xPSR: 0000000a === 20-08-07 00:22:33.861 r0 :00000364 r1 :100b6815 r2 :100b72ab r3 :100956bd 20-08-07 00:22:33.873 r4 :dead6663 r5 :00000364 r6 :200c1c20 r7 :00000001 20-08-07 00:22:33.873 r8 :00001388 r9 :100b4108 r10:100b4158 r11:00000013 20-08-07 00:22:33.884 r12:10095811 sp :200c0320 lr :200c1c20 pc :200c14f8 20-08-07 00:22:33.884 20-08-07 00:22:33.884 cfsr = 0, shcsr = 70000, hfsr = 0, dfsr = 0 20-08-07 00:22:33.884 20-08-07 00:22:33.884 =========== Process Stack Contents =========== 20-08-07 00:22:33.889 00000000: 100cfc00 00002a3d 00002751 00002731 20-08-07 00:22:33.901 00000010: 00002741 00002711 000027e1 00002791 20-08-07 00:22:33.901 00000020: 000027a1 000027b1 00002771 000027c1 20-08-07 00:22:33.901 00000030: 00002721 00002781 00002761 000027d1 20-08-07 00:22:33.906 20-08-07 00:22:33.906 Rebooting... 20-08-07 00:22:33.996 20-08-07 00:22:33.996 20-08-07 00:22:33.996 --- UART initialized after reboot --- Original change's description: > task: Fix mutex_lock() assert (reland) > > mutex_lock() must not be used in interrupt context. Add an assert > to catch this. > > Also assert task_start_called() since task ID is not valid > before this. > > Also remove an old assert since comparing id with TASK_ID_INVALID > doesn't make sense. > > This was first submitted as CL:2309057, then reverted by CL:2323704 > because it broke jump to RW (b/162302011). Fix this by adding check > for task_start_called() to chip/npcx/flash.c and common/i2c_master.c. > > BUG=b:160975910 > BRANCH=none > TEST=boot AP, jump to RW > > Signed-off-by: Edward Hill <ecgh@chromium.org> > Change-Id: I070a265a95d2128643b536814e608509d81adbe3 > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2335738 > Reviewed-by: Raul E Rangel <rrangel@chromium.org> > Reviewed-by: Denis Brockus <dbrockus@chromium.org> Bug: b:160975910 Change-Id: I9e37b1eac7344cddbd756fb45b130d7e0aee661b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2341706 Reviewed-by: caveh jalali <caveh@chromium.org> Commit-Queue: caveh jalali <caveh@chromium.org> Tested-by: caveh jalali <caveh@chromium.org>
* task: Fix mutex_lock() assert (reland)Edward Hill2020-08-061-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | | mutex_lock() must not be used in interrupt context. Add an assert to catch this. Also assert task_start_called() since task ID is not valid before this. Also remove an old assert since comparing id with TASK_ID_INVALID doesn't make sense. This was first submitted as CL:2309057, then reverted by CL:2323704 because it broke jump to RW (b/162302011). Fix this by adding check for task_start_called() to chip/npcx/flash.c and common/i2c_master.c. BUG=b:160975910 BRANCH=none TEST=boot AP, jump to RW Signed-off-by: Edward Hill <ecgh@chromium.org> Change-Id: I070a265a95d2128643b536814e608509d81adbe3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2335738 Reviewed-by: Raul E Rangel <rrangel@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* chip/npcx/lpc: Read HIKMST before HIKMDIRaul E Rangel2020-08-061-1/+9
| | | | | | | | | | | | | | | | | Reading HIKMDI causes the IBF flag to deassert and allows the host to write a new byte into the input buffer. So if we don't capture the status before reading HIKMDI we will race with the host and get an invalid value for HIKMST.A20. BUG=b:162539945, b:157617092, b:159282882 BRANCH=none TEST=Boot ezkinil and make sure keyboard still functions. Signed-off-by: Raul E Rangel <rrangel@chromium.org> Change-Id: Ia8dcd18e3de31b4fa8c1742c7604d5c39e80dc51 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2341090 Commit-Queue: Edward Hill <ecgh@chromium.org> Reviewed-by: Edward Hill <ecgh@chromium.org>
* chip: support dynamic hibernate_wake_pins configTing Shen2020-08-064-0/+20
| | | | | | | | | | | | | | | | Add CONFIG_HIBERNATE_WAKE_PINS_DYNAMIC to let board config their wake pins at runtime. BUG=b:162814191 TEST=make BRANCH=master Signed-off-by: Ting Shen <phoenixshen@google.com> Change-Id: Iae2072ec7239a0daa84222c23733b90153e732f1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2340730 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org>
* ec: change usage of dummySam Hurst2020-08-0547-116/+116
| | | | | | | | | | | | | | | | | | Google is working to change its source code to use more inclusive language. To that end, replace the term "dummy" with inclusive alternatives. BUG=b:162781382 BRANCH=None TEST=make -j buildall `grep -ir dummy *` The only results are in "private/nordic_keyboard/sdk8.0.0" which is not our code. Signed-off-by: Sam Hurst <shurst@google.com> Change-Id: I6a42183d998e4db4bb61625f962867fda10722e2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2335737 Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* it83xx: Add support for interrupt and 1.8v selection of GPJ7Dino Li2020-08-043-2/+7
| | | | | | | | | | | | BUG=b:162805450 BRANCH=none TEST=not yet Signed-off-by: Dino Li <Dino.Li@ite.com.tw> Change-Id: Ie1525b8a0f67a4700649163b536d09bef9a9671a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2335518 Reviewed-by: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org>
* chip/mt8192_scp: don't unset the THRI flag unless we are in the UART ISRTzung-Bi Shih2020-08-021-2/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Interrupt mechanism of MT8192 SCP has 3 tiers: INTC, global VIC, local VIC (in RV33). +------+ +-------------+ +----------------+ | | | | | | UART TX -----| |--GROUP 0 --| | | | UART RX -----| INTC |--GROUP 1 --| Global VIC | | Local VIC | Timer 0 -----| |--GROUP 2 --| | | | Timer n -----| | . | (MIEMS, |-----| (INTC_IRQ_OUT, | . | | . | MICAUSE, | | INTC_IRQ_...) | . | | . | MIXXXX...) | | | GIPC 0 -----| |--GROUP 14--| | | | . +------+ +-------------+ +----------------+ GVIC latches from INTC at a time and notifies LVIC if any group is asserted. For example, suppose UART TX corresponds to group 12 and GIPC 0 corresponds to group 7: (1) GIPC 0 and UART TX are asserted. (2) GVIC notifies LVIC about the interrupt. (3) RV33 finds group 7 and group 12 (from INTC_IRQ_OUT) are asserted. Note that it is a fatal error if RV33 cannot find the corresponding groups in (3). GVIC caches the group 7 and group 12 until RV33 writes to bit 7 and bit 12 of MIEMS. Even though the interrupt source is de-asserted, the GVIC cache won't get updated. The most suggested way to handle interrupt in RV33: batch handle them. However, EC OS doesn't handle multiple interrupts at a time. EC OS handles 1 interrupt, acknowledges by writing 1 bit in MIEMS, and sees if further interrupts from GVIC. UART TX interrupt can be easily cleared by calling cflush() in anywhere. To avoid the interrupt source of UART TX being cleared in other ISR, don't unset the THRI flag unless we are in the UART ISR. BRANCH=none BUG=b:157541273 TEST=call cflush() in any ISR Signed-off-by: Tzung-Bi Shih <tzungbi@chromium.org> Change-Id: I2fab7308edce386ea65d0d45e39805d8cc7f4857 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2331984 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* chip/it83xx, it8xxx2: implement detect cc disconnection interrupt for SRC roleRuibin Chang2020-07-313-22/+26
| | | | | | | | | | | | | | | | | | | | Implement detect cc disconnection interrupt for source. When TCPC detect SNK/audio/debug device plug out (cc lines open), TCPC can interrupt pd task to update cc state. BUG=b:160548079 BRANCH=none TEST=test on board reef_it8320, it81202_pdevb with TCPMv1, TCPMv2. Connect to dongle, adapter and DRP, check 1.Plug in/out interrupt fire correctly. 2.Power role swap can state to SRC_READY and SNK_READY. 3.When partner disconnect, we discharge Vconn within tVconnOFF(35ms). Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw> Change-Id: I58bc8a5a9289df4ea4e8b3efec000d3a9ab1cb5d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2294626 Reviewed-by: Jett Rink <jettrink@chromium.org>
* stm32g4: Set uart frequency and enable clocks for stm32g4Scott Collyer2020-07-311-3/+3
| | | | | | | | | | | | | | | | This CL adds changes to enable clocks and configure the uart speed for stm32g4 chip family. BUG=b:148493929 BRANCH=None TEST=verfied that the GPIO, clocks, and EC console over LPUART Signed-off-by: Scott Collyer <scollyer@google.com> Change-Id: I5600ed64867192fe77fd85fc3dbc0a63f912d738 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2195550 Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Scott Collyer <scollyer@chromium.org>
* stm32g4: Modify channel select to use DMAMUX for stm32g4Scott Collyer2020-07-311-2/+15
| | | | | | | | | | | | | | | | | | The STM32G4 family chips have similar DMA engine as some other STM32 families and therefore most of DMA code can simply be used as is. However, the STM32G4 does have a DMAMUX and so the correct peripheral request must be set. BUG=b:148493929 BRANCH=None TEST=verfied that the GPIO, clocks, and EC console over LPUART Signed-off-by: Scott Collyer <scollyer@google.com> Change-Id: I2694881f97558ea7b904a9b83ee20d9ec813c273 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2195549 Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Scott Collyer <scollyer@chromium.org>
* spi: Use different hooks for SPI enable/disableWai-Hong Tam2020-07-302-0/+17
| | | | | | | | | | | | | | | | | | | If CONFIG_CHIPSET_RESUME_INIT_HOOK is defined, move the SPI enable/disable to different hooks, i.e. * RESUME_INIT instead of RESUME * SUSPEND_COMPLETE instead SUSPEND The SPI interface has to be enable earlier than other hooks to receive a host sleep event. BRANCH=None BUG=b:148149387 TEST=make buildall -j Change-Id: Ic56a7b5ef20fb8258487d1d350fc5f8a55e33049 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2324989 Reviewed-by: Ting Shen <phoenixshen@chromium.org>
* stm: rtc: Prevent locking a mutex in interrupt contextWai-Hong Tam2020-07-301-1/+9
| | | | | | | | | | | | | | | | | In the RTC interrupt, it calls host_set_single_event() directly, that eventually tries to lock a mutex. Trying to lock a mutex in the interrupt context should be forbidden. So move the call to a deferred function. BRANCH=None BUG=b:162434716 TEST=Build the board scarlet, which uses stm and enables RTC host command. Change-Id: I3f5ab85549a801f4f5d72cf5661a65c9f9d28e0c Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2327249 Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
* npcx: rtc: Prevent locking a mutex in interrupt contextWai-Hong Tam2020-07-301-1/+9
| | | | | | | | | | | | | | | | In the RTC interrupt, it calls host_set_single_event() directly, that eventually tries to lock a mutex. Trying to lock a mutex in the interrupt context should be forbidden. So move the call to a deferred function. BRANCH=None BUG=b:162434716 TEST=Running suspend_stress_test doesn't result any EC crash. Change-Id: I80d1f1d8cefa4b8d01e707edff602dfdc860fc35 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2327248 Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
* stm32g4: Add clock enable logic for HW timerScott Collyer2020-07-291-0/+11
| | | | | | | | | | | | | | | | This CL adds clock enable support for stm32g4 family. BUG=b:148493929 BRANCH=None TEST=verfied that via scope that led toggle happens at 1 second window when using one second hook call. Signed-off-by: Scott Collyer <scollyer@google.com> Change-Id: Ie3d353ec40206e93cfac7b8738166ffee6c8442c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2195548 Tested-by: Scott Collyer <scollyer@chromium.org> Commit-Queue: Scott Collyer <scollyer@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* stm32g4: Add gpio supportScott Collyer2020-07-291-0/+66
| | | | | | | | | | | | | | | | | This CL adds stm32g4 chip specific changes. Most of gpio code can be reused as is. This file enables clocks and IRQs for supported GPIO banks. This was based on F4 family as the reference. BUG=b:148493929 BRANCH=None TEST=verfied that the GPIO, clocks, and EC console over LPUART Signed-off-by: Scott Collyer <scollyer@google.com> Change-Id: I47d0b08675b53597b5a0e938d576682e63cc59e0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2195546 Tested-by: Scott Collyer <scollyer@chromium.org> Commit-Queue: Scott Collyer <scollyer@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* stm32g4: Clock module driverScott Collyer2020-07-291-0/+277
| | | | | | | | | | | | | | | | | | | | This CL adds support to configure rcc module for stm32g4. The driver from the F4 family was used as a reference. Support for RTC was not ported as it's not being used for honeybuns. The function wait_for_ready() was moved to the common clock file for the F-family so it would not need to be replicated for G4 as well. BUG=148493929 BRANCH=None TEST=verfied that the GPIO, clocks, and EC console over LPUART Signed-off-by: Scott Collyer <scollyer@google.com> Change-Id: I980c8889965a2e5da401ccd6291079a0bdfa8e4f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2195545 Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Scott Collyer <scollyer@chromium.org>
* stm32g4: Modifications required for system.cScott Collyer2020-07-291-1/+15
| | | | | | | | | | | | | | | | | This CL updates stm32 specific system.c for the stm32g4 chip family. A comment was added to clarify what's required for enabling the backup domain. In addition, debug mode and detection of a warm boot. BUG=b:148493929 BRANCH=None TEST=verfied that the GPIO, clocks, and EC console over LPUART Signed-off-by: Scott Collyer <scollyer@google.com> Change-Id: I8b5063419ae6dc1be165b8bb3754703c1e728ae9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2195544 Tested-by: Scott Collyer <scollyer@chromium.org> Commit-Queue: Scott Collyer <scollyer@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* stm32g4: Add config-chip for stm32g41xbScott Collyer2020-07-292-0/+46
| | | | | | | | | | | | | | | | This CL adds config-chip for stm32g41xb variant of the stm32g4 chip family. BUG=148493929 BRANCH=None TEST=verfied that the GPIO, clocks, and EC console over LPUART Signed-off-by: Scott Collyer <scollyer@google.com> Change-Id: I418179153b631e2d7abb597fbf77374f94c4c501 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2195543 Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Scott Collyer <scollyer@chromium.org>
* stm32g4: Fix issue with APB1 base addressScott Collyer2020-07-291-1/+1
| | | | | | | | | | | | | | | | The initial version of this file had a cut/paste error. Fixing the base address for APB1 bus BUG=148493929 BRANCH=None TEST=make BOARD=quiche is successful Signed-off-by: Scott Collyer <scollyer@google.com> Change-Id: I5c2abc0342bde4a66f166f87971617110c5acfd5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2324403 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org>
* ec: change usage of whitelist/blacklistPaul Fagerburg2020-07-282-12/+12
| | | | | | | | | | | | | | | | | | | Google is working to change its source code to use more inclusive language. To that end, replace the terms "whitelist", "blacklist", and similar with inclusive alternatives. BUG=b:162262297 BRANCH=None TEST=`grep -Eirl "(white|black)[ _\-]*list" .` The only results are in "private/nordic_keyboard/sdk8.0.0" which is not our code. Signed-off-by: Paul Fagerburg <pfagerburg@google.com> Change-Id: Ie5210b98e1096c22d0e9284c101a42820bd3d79d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2321549 Tested-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Paul Fagerburg <pfagerburg@chromium.org>
* Make wait_for_ready available for allDaisuke Nojiri2020-07-285-61/+10
| | | | | | | | | | | | | | | | | | | wait_for_ready is a generic function which loops until bits in a register are set. This patch move it to util.c to make it available for all. There are more places where the function is applicable but this CL keeps the scope under chip/stm32/clock-stm32. There is no functionality change. BUG=none BRANCH=none TEST=buildall Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: I796599344c1d86ab7144d1d6b434ec54cf1cc55d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2317887 Reviewed-by: Scott Collyer <scollyer@chromium.org>
* servo: Adds USB SPI protocol V2 commands and responsesBrian J. Nemec2020-07-243-103/+629
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds the USB SPI protocol V2, this protocol supports larger SPI transfers that are delivered in multiple USB packets. This enables us to perform 2 optimizations on the USB SPI transfer speed for large USB packets: * USB packets can be grouped together reducing the total number of packets exchanged. The host can write multiple data sections sequentially without the device responding with a packet for each one. Going the other direction, the host can continue to poll the device for data until the transmission is complete. * Only a single SPI transaction is required, this eliminates overhead in setting up and getting data from SPI transactions. Benchmark results show a typical 35% improvement in performance on Servo Micro platforms with these changes on operations which involve large SPI transfers reading or writing from the flash. Signed-off-by: Brian Nemec <bnemec@chromium.org> Blocked on upstream changes to flashrom: Depends-On:https://review.coreboot.org/c/flashrom/+/41533 BUG=b:139058552 BRANCH=servo TEST=Tested with Servo Micro with the reading, erase, write, and verify operations with updated copies of flashrom. Change-Id: I04b6cf8449e32cc1b75d3501939958887eb57f5b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2224765 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Brian Nemec <bnemec@chromium.org> Tested-by: Brian Nemec <bnemec@chromium.org>
* stm32g4: Add registers file for stm32g4 chip familyScott Collyer2020-07-232-0/+1275
| | | | | | | | | | | | | | | | This CL adds the registers definition file for stm32g4. It was based off the registers file for the stm32f4 chip family. BUG=b:148493929 BRANCH=None TEST=verfied that the GPIO, clocks, and EC console over LPUART Signed-off-by: Scott Collyer <scollyer@google.com> Change-Id: I4de8e4ed955714d35e75e0c0c5de83a3d8c4c996 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2092492 Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Scott Collyer <scollyer@chromium.org>
* chip/it8320, it81202: Implement fast role swap functionRuibin Chang2020-07-233-0/+23
| | | | | | | | | | | | | | | | | | Implement fast role swap function from initial SNK to new SRC for chip it8320 and it81202. BUG=none BRANCH=none TEST=1.When we detect FRS cc low signal, we can output properly GPIO signal. 2.FRS false-positives test: PD traffic(ex.power nego, data and power swap, soft and hard reset) on the CC line after FRS is enabled. Change-Id: I3a7bc6a684e57fb19e50c41305751b2fca1ffe2d Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1786462 Reviewed-by: Diana Z <dzigterman@chromium.org>
* ec: change usage of "sane" per inclusive languagePaul Fagerburg2020-07-224-4/+4
| | | | | | | | | | | | | | | | Google is working to change its source code to use more inclusive language. To that end, replace the terms "sane", "sanity check", and similar with inclusive/non-stigmatizing alternatives. BUG=b:161832469 BRANCH=None TEST=`make buildall -j` succeeds. `grep -Eir "sane|sanity" .` shows results only in third-party code or documentation. Signed-off-by: Paul Fagerburg <pfagerburg@chromium.org> Change-Id: I29e78ab27f84f17b1ded75cfa10868fa4e5ae88c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2311169 Reviewed-by: Jett Rink <jettrink@chromium.org>
* it83xx/spi: Reset SPI module before sysjumpDino Li2020-07-212-2/+16
| | | | | | | | | | | | | | | | | BUG=b:161327069 BRANCH=none TEST=No complaining bad data from SPI continuously after sysjump. NOTE: We might get one bad data message after sysjump (eg: "sysjump rw" command). Because EC isn't ready to receive data but request from AP might be already started. Change-Id: Ibe83c0b54c234022338a30c35b1b0564f7e5f266 Signed-off-by: Dino Li <Dino.Li@ite.com.tw> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2301323 Tested-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-by: Eric Yilun Lin <yllin@chromium.org>