summaryrefslogtreecommitdiff
path: root/include/system.h
Commit message (Collapse)AuthorAgeFilesLines
* fix ChromiumOS authors and whitespace warningsMary Ruthven2022-09-131-1/+1
| | | | | | | | | | | BUG=none TEST=none Change-Id: I61b0b0106a43f723ec3bc805eb190aef00bbd05b Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3894391 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org>
* gpio: add gpio flags to disable sleepMary Ruthven2022-04-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add GPIO_SLEEP_DIS_LOW and GPIO_SLEEP_DIS_HIGH to disable sleep when a gpio with one of those flags is asserted. GPIO_SLEEP_DIS_LOW disables sleep when the signal is set to 0. GPIO_SLEEP_DIS_HIGH disables sleep when the signal is set to 1. This will disable all forms of sleep. The flags can be used for ccd signals to ensure cr50 doesn't enter sleep while c2d2 or servo micro are relying on a ccd signal to flash the device. These flags should not be add to signals used during normal cr50 operation. They disable regular sleep regular sleep so using them will significantly increase cr50 power consumption. This change adds GPIO_SLEEP_DIS_HIGH to AP_FLASH_SELECT. I'll add more signals in followup CLs. This change also replaces SLEEP_MASK_CHARGING with SLEEP_MASK_GPIO. Nothing was using SLEEP_MASK_CHARGING. BUG=b:229974371 TEST=Toggle AP_FLASH_SELECT while the AP is off. Verify cr50 doesn't enter deep sleep and the gpiocfg and sleepmask output looks ok. > gpioset AP_FLASH_SELECT 1 > gpiocfg GPIO0_GPIO1: read 0 drive 0 GPIO0_GPIO2: read 1 drive 1 GPIO1_GPIO0: read 0 INT_RISING GPIO1_GPIO1: read 0 INT_HIGH GPIO1_GPIO4: read 0 INT_FALLING GPIO1_GPIO5: read 0 drive 1 GPIO1_GPIO7: read 0 INT_RISING GPIO1_GPIO8: read 0 INT_FALLING gpio sleepmask: 00001000 > sleepmask sleep mask: 00000008 > gpioset AP_FLASH_SELECT 0 > gpiocfg GPIO0_GPIO1: read 0 drive 0 GPIO0_GPIO2: read 0 drive 0 GPIO1_GPIO0: read 0 INT_RISING GPIO1_GPIO1: read 0 INT_HIGH GPIO1_GPIO4: read 0 INT_FALLING GPIO1_GPIO5: read 0 drive 1 GPIO1_GPIO7: read 0 INT_RISING GPIO1_GPIO8: read 0 INT_FALLING gpio sleepmask: 00000000 > sleepmask sleep mask: 00000000 > Change-Id: I1de35455c5a6702635fb714b14d6791f8e5eb2ed Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3605881 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* Revert "pd: Store PD active state in battery-backed memory"Mary Ruthven2021-11-181-3/+0
| | | | | | | | | | | | This reverts commit 23bc38414ade30fb3e72ae8beefb657b47ca8288. BUG=b:200823466 TEST=make buildall -j Change-Id: I0de4fae0dfb6256ce5684f03a3236b18186c9c70 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3285748 Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org>
* Revert "hostcmd: Remove EC_CMD_VBNV_CONTEXT handler for most boards"Mary Ruthven2021-11-181-0/+4
| | | | | | | | | | | | This reverts commit 6ba124a81bd6d5af1edae5f30add22e81b8b7de7. BUG=b:200823466 TEST=make buildall -j Change-Id: I4038924250569e3bb8b491ded4eef1a61f98a4bb Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3273470 Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org>
* Revert "system: Add support for emulated sysrq"Mary Ruthven2021-11-181-8/+0
| | | | | | | | | | | | This reverts commit 871bf8da2cf5fa9bcfe8771b96af4b55c2503616. BUG=b:200823466 TEST=make buildall -j Change-Id: I126176dcf85d4850213308f77eefb554454f50d0 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3273469 Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org>
* Revert "system: Fixups in emulated sysrq code"Mary Ruthven2021-11-181-0/+9
| | | | | | | | | | | | This reverts commit e3f5e6bf6ad2d1e2c283a75cf08e17155633e0a5. BUG=b:200823466 TEST=make buildall -j Change-Id: I60dbc01a5345a28fe759975f62a8d9216dcef7fe Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3273468 Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org>
* Revert "stm32/usb: Add support for board-specific serial number"Mary Ruthven2021-11-181-6/+0
| | | | | | | | | | | | This reverts commit d132e5ecbd93fa598fc495ec90718ea853962ef7. BUG=b:200823466 TEST=make buildall -j Change-Id: I08b13fd9b4707476c8955555a0bd423e420aea28 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3273462 Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org>
* Revert "Add system_can_boot_ap API"Mary Ruthven2021-11-181-8/+0
| | | | | | | | | | | | This reverts commit cdaca7c97eaefe93ab3a0148a954b2f139f5caad. BUG=b:200823466 TEST=make buildall -j Change-Id: I860b04167c3ab7335de63f561d31cf073cb5e897 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3273461 Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org>
* Revert "vboot_ec:Read try slot from BBRAM"Mary Ruthven2021-11-181-1/+0
| | | | | | | | | | | | This reverts commit 031dccad78b9d4df6b970bc36ef2f9d469239708. BUG=b:200823466 TEST=make buildall -j Change-Id: Ic8ca54bdb863a169955b0e0ef950ecc0ab92f50e Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3273460 Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org>
* Revert "chip/stm32/pwm: Prevent sleeping while PWM output is active"Mary Ruthven2021-11-181-1/+0
| | | | | | | | | | | | This reverts commit e3336f4c8d4fb59137d35f87f4a42d22848aabcd. BUG=b:200823466 TEST=make buildall -j Change-Id: Ibb1a069c4459855aebc9a3b8865245ff4720eebf Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3273459 Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org>
* Revert "Add OTP support"Mary Ruthven2021-11-181-6/+1
| | | | | | | | | | | | This reverts commit 1b25735b732e7766aceb3f060e4ca205aba6d358. BUG=b:200823466 TEST=make buildall -j Change-Id: I2e29902d7026c63f23871af0141a3ee7d319852d Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3273456 Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org>
* Revert "coral: Add host command to fetch SKU ID"Mary Ruthven2021-11-181-8/+0
| | | | | | | | | | | | | | This reverts commit f747f70816ca825a4ff4f9c6234f97e93611dbaa. Nothing uses CONFIG_HOSTCMD_SKUID. Remove support. BUG=b:200823466 TEST=make buildall -j Change-Id: Iea545047659ab265025878c50986b74d1b3654b1 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3273455 Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org>
* Revert "Treat SYSTEM_IMAGE_RW_B also as RW copy"Mary Ruthven2021-11-181-7/+0
| | | | | | | | | | | | This reverts commit 5da63f4ea2c93e6b059d8c50ff01dbe53a13dec2. BUG=b:200823466 TEST=make buildall -j Change-Id: Id035f3e4a107c00407c16cc878bd88da63f9de7f Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3273451 Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org>
* Revert "EFS: Add support for early firmware selection"Mary Ruthven2021-11-181-15/+0
| | | | | | | | | | | | This reverts commit 4dcee1c545c31d288b23221d8e07bc452214ce7b. BUG=b:200823466 TEST=make buildall -j Change-Id: I5226e749decc26e1af05172353327a368610def3 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3273449 Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org>
* Revert "EFS: Switch active slot when current slot is invalid"Mary Ruthven2021-11-181-28/+9
| | | | | | | | | | | | This reverts commit 729a4ba2bdc20675e24ed9e7d0a98d19934d72f8. BUG=b:200823466 TEST=make buildall -j Change-Id: I850e674c9bc347520effd97611878ea3e3153a56 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3273448 Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org>
* Revert "system: Add wait-ext option to ec reboot command"Mary Ruthven2021-11-181-12/+0
| | | | | | | | | | | | This reverts commit 071142fe688c05ef1ffd54057409995f12504c1d. BUG=b:200823466 TEST=make buildall -j Change-Id: Ic264ef02dfad13dafc437b6063d4d3dddf4d2b5c Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3273442 Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org>
* Revert "system: Allow hibernate to clear AP_OFF flag"Mary Ruthven2021-11-181-2/+1
| | | | | | | | | | | | This reverts commit 23149261dc4a9429a1c98aa829e02d4a3ec5103a. BUG=b:200823466 TEST=make buildall -j Change-Id: Ie27d454c485e9f2341bac9320b3ad629b96efe50 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3273440 Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org>
* Revert "npcx: Add BBRM idx for a 3rd PD port."Mary Ruthven2021-11-181-1/+0
| | | | | | | | | | | | This reverts commit 3dfcaaaf0bbb8298d656e8280ac83b6a4c421a92. BUG=b:200823466 TEST=make buildall -j Change-Id: I10b63d5aecf80cabc84b8d18147eb4300404b0fd Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3273427 Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org>
* Revert "system: Enable/Disable low power idle in run time"Mary Ruthven2021-11-181-24/+0
| | | | | | | | | | | | This reverts commit 0de5b8ed695a420728ec7b606b218284b0241006. BUG=b:200823466 TEST=make buildall -j Change-Id: I2e7db1159403f56f9373dd51382921048be76560 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3273422 Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org>
* Revert "stm32: low power idle for STM32H7"Mary Ruthven2021-11-181-1/+0
| | | | | | | | | | | | This reverts commit 13a0b3437eb59a168c4f9c4d1ebc3d217ced3ba5. BUG=b:200823466 TEST=make buildall -j Change-Id: Idba1e1afcb5ba9c5242f9492abbec58599c52a81 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3273418 Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org>
* Revert "npcx: adc: only enable ADC during conversion for power consumption."Mary Ruthven2021-11-181-1/+0
| | | | | | | | | | | | This reverts commit ab38c2f25602f51994d56b22d5ded7c7bfa0beba. BUG=b:200823466 TEST=make buildall -j Change-Id: I6c86e265fd19ba1bb1aa4c6ba64d843d1ad88b9a Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3273416 Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org>
* Revert "kukui/emmc: Disable eMMC emulation when not needed"Mary Ruthven2021-11-181-1/+0
| | | | | | | | | | | | This reverts commit cac3f7c60f5a62ae3c696b02581e750c7dedb2fe. BUG=b:200823466 TEST=make buildall -j Change-Id: I4c974099a09a2d4436bf125e3add428f47e423e0 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3273412 Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org>
* system: remove support for ap-watchdog resetMary Ruthven2021-11-181-4/+0
| | | | | | | | | | | | | | | | | This removes support for remembering if reset was due to AP watchdog triggering. It was originally added in 51a6070f845ed670c5a198a7045af3d3bb3bbdd4. RESET_FLAG_AP_WATCHDOG was renamed to EC_RESET_FLAG_AP_WATCHDOG and moved to ec_commands.h. This removes the flag. BUG=b:200823466 TEST=make buildall -j Change-Id: If6340bc7df0a2e06f85bd8ff11dd058e5547e784 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3273408 Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org>
* Revert "ec: cleanup: Add CONFIG_RTC"Mary Ruthven2021-11-181-4/+3
| | | | | | | | | | | | This reverts commit 528ff711f6f22c7899d2c29dae3e1ff2d331bef2. BUG=b:200823466 TEST=make buildall -j Change-Id: I19d4860ab8d5a0d8ed87fac202972056866295f7 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3273397 Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org>
* Revert "common: chip_save_reset_flags takes uint32_t"Mary Ruthven2021-11-181-1/+1
| | | | | | | | | | | | This reverts commit cd45a75e8c0dea45b94dc530fde7c86cc698fd2d. BUG=b:200823466 TEST=make buildall -j Change-Id: I8c1941fdf43741111a0d144109f2bef98ec73362 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3273381 Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org>
* Revert "common: board_[read/write]_serial weak reference cleanup"Mary Ruthven2021-11-181-3/+2
| | | | | | | | | | | | This reverts commit 9e9c24307deb302ed969b268e97cebfa4061c79c. BUG=b:200823466 TEST=make buildall -j Change-Id: I434218b51404a831ce88c97c76e0e6d3a6d02bf2 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3273377 Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org>
* Revert "common/system: refactor some confusing ifdefs"Mary Ruthven2021-11-181-0/+5
| | | | | | | | | | | | This reverts commit 3e1c72ea23fe3c37f5a4e4e8bceea38c0322ba31. BUG=b:200823466 TEST=make buildall -j Change-Id: I172b5fd55529754d913f4d18258beccac0bade58 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3273364 Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org>
* Revert "version: Make ver_get_num_commits work for on-flash images"Mary Ruthven2021-11-181-8/+0
| | | | | | | | | | | | This reverts commit 91d4fec4606e2145d522274c786d46d12721cf9a. BUG=b:200823466 TEST=make buildall -j Change-Id: I3859dd2069397eaeb8c6ae361c7663b32b53e01f Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3273359 Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org>
* Revert "system.c: reset statics for testing"Mary Ruthven2021-11-181-7/+0
| | | | | | | | | | | | This reverts commit 0038f1e0dfd6738d71e07de60a0240e449d3f787. BUG=b:200823466 TEST=make buildall -j Change-Id: Ic55769f733450c72d76533142ace06831c998b4c Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3273193 Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org>
* coil: rename sleepmasksMary Ruthven2021-01-061-3/+4
| | | | | | | | | | BUG=b:175244613 TEST=make buildall -j Change-Id: I693fa068dc9bbf4babb1a63e35d4536f5eba1e88 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2613460 Reviewed-by: Namyoon Woo <namyoon@chromium.org>
* ap_ro: add handling of the corrupted hashVadim Bendebury2020-06-051-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch closes the AP RO verification loop on the Cr50 side. If the check is triggered, the valid AP hash is found, and the RO contents is found to not match the hash, the Cr50 will - assert the EC reset; - set a flag to prevent the code from deasserting EC reset; - start a periodic hook to reassert EC reset in case the user hits power+refresh. This will prevent the Chrome OS device from booting. A new CLI command is being added to display the verification state. In developer images the new command would allow to clear the failure state, when running prod images the only way out of the failure state would be the powercycle. BUG=b:153764696 TEST=verified that erasing or programming AP RO hash when board ID is set is impossible. Verified proper shutdown in case AP RO has is present and the AP RO space is corrupted and recovery using the new cli command when running a dev image. Verified that 'ecrst off' properly reports the override. Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Change-Id: I1029114126a9a79f80385af7bc8d5467738e04ca Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2218676 Reviewed-by: Mary Ruthven <mruthven@chromium.org>
* make DIOB3 interruptible and wakable for EC-EFS2Namyoon Woo2020-02-081-0/+1
| | | | | | | | | | | | | | | | | | | | | If the board supports EC-CR50 communication, Cr50 enables both rising/falling-edge triggered interrupt on DIOB3 pin and makes it wakable as well.Cr50 connects GPIO_AP_FLASH_SELECT to DIOB4. If the board does not support EC-CR50 communication, Cr50 connects GPIO_AP_FLASH_SELECT to DIOB3. If EC puts high on DIOB3 to activate EC-CR50 communication, CR50 enables UART_EC RX and TX. BUG=chromium:1035706 BRANCH=cr50 TEST=none Change-Id: I1221a1a19219274622ab710568ce7c66ab2f1da7 Signed-off-by: Namyoon Woo <namyoon@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1989581 Reviewed-by: Mary Ruthven <mruthven@chromium.org>
* system.c: reset statics for testingCaveh Jalali2019-10-311-0/+7
| | | | | | | | | | | | | | | | | | | | this adds a function to reset the state information generated by system_common_pre_init() for testing scenarios that need to call it multiple times. on the EC, main memory (.data + .bss) is reinitialized across sysjumps, so this happens automatically, but we can't really do that from unit tests. so, add a function to reset the relevant static variables to emulate main memory getting reinitialized. BRANCH=none BUG=b:142031466 TEST=make buildall passes Change-Id: I1f65902c21ab6fc17c32388795cfef19c84d8cc8 Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1855644 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* common: Comment typo correctionCraig Hesling2019-10-151-1/+1
| | | | | | | | | | | | | | Corrects the spelling of "functions". This is more text than the actual diff. BRANCH=none TEST=none BUG=none Change-Id: Id911bf020d8db9b1d6ad7bfb62d431c5114a64d8 Signed-off-by: Craig Hesling <hesling@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1854659 Reviewed-by: Jett Rink <jettrink@chromium.org>
* version: Make ver_get_num_commits work for on-flash imagesDaisuke Nojiri2019-09-211-0/+8
| | | | | | | | | | | | | | | | | | | | | | EFS needs to check whether a RW version on flash is equal to or newer for rollback protection before jumping to a RW copy. Currently, ver_get_numcommits works only for the running image. This makes it work for images on flash as well. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=chromium:998135 BRANCH=none TEST=Boot Nami. Verify version numbers are read from RAM and flash. Change-Id: I94475e40f89dc4c3173d83cb1d9d4ad38d6fab79 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1450816 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
* include: Move RESET_FLAG_* into ec_commands.h as EC_RESET_FLAG_*You-Cheng Syu2019-08-261-24/+2
| | | | | | | | | | | | | | | | | | | | | | | RESET_FLAGS_* are used when setting/reading the field ec_reset_flags of struct ec_response_uptime_info, which is defined in ec_commands.h. So it might be better to put those macros there. To be consistent with the other macros in the file, add "EC_" prefixes to them. BUG=b:109900671,b:118654976 BRANCH=none TEST=make buildall -j Cq-Depend: chrome-internal:1054910, chrome-internal:1054911, chrome-internal:1045539 Change-Id: If72ec25f1b34d8d46b74479fb4cd09252102aafa Signed-off-by: You-Cheng Syu <youcheng@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1520574 Tested-by: Yu-Ping Wu <yupingso@chromium.org> Commit-Ready: Yu-Ping Wu <yupingso@chromium.org> Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org> Reviewed-by: Yilun Lin <yllin@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* common/system: refactor some confusing ifdefsJack Rosenthal2019-07-311-5/+0
| | | | | | | | | | | | | | | | | I had a hard time reading this section, so figured I may as well rewrite it to use IS_ENABLED while I was here. Gave CONFIG_{RO,RW}_HEAD_ROOM a default value of zero here, which makes the math work out for boards without it anyway. BUG=none BRANCH=none TEST=buildall Change-Id: I87dc2d73838c350088916b57aa51d5f368c5592f Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1727570 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* LICENSE: remove unnecessary (c) after CopyrightTom Hughes2019-06-191-1/+1
| | | | | | | | | | | | | | | | Ran the following command: git grep -l 'Copyright (c)' | \ xargs sed -i 's/Copyright (c)/Copyright/g' BRANCH=none BUG=none TEST=make buildall -j Change-Id: I6cc4a0f7e8b30d5b5f97d53c031c299f3e164ca7 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1663262 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* common: board_[read/write]_serial weak reference cleanupDenis Brockus2019-06-031-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | board_read_serial and board_write_serial were prototyped as weak and this made all instances, that included that prototype, weak as well. In order to not lose information from the prototype, default and override functions, I changed to use the override weak marker symbols. These functions defaulted for specific configurations as different functionality and used an #ifdef tree to do this. I made these a single definition for each function and used IS_ENABLED instead of the #ifdef tree. I also added a definition for the case that the configuration would not have produced a function. BUG=none BRANCH=none TEST=make buildall -j Change-Id: Ie41c53f3a17d665358e46eefd3ded3066ee80a7d Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1631583 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jett Rink <jettrink@chromium.org>
* common: chip_save_reset_flags takes uint32_tJack Rosenthal2019-05-171-1/+1
| | | | | | | | | | | | | | | The getters and setters for the reset flags should take and return the same type. `uint32_t' seems the more appropraiate type than `int', so change the setter to take `uint32_t'. BUG=none BRANCH=none TEST=make buildall -j Change-Id: I50928a114858dd51034a048520efa849f5182bd0 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1615648 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* common: replace 1 << digits, with BIT(digits)Gwendal Grignou2019-03-261-44/+44
| | | | | | | | | | | | | | | | Requested for linux integration, use BIT instead of 1 << First step replace bit operation with operand containing only digits. Fix an error in motion_lid try to set bit 31 of a signed integer. BUG=None BRANCH=None TEST=compile Change-Id: Ie843611f2f68e241f0f40d4067f7ade726951d29 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1518659 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* common: Include compile_time_macros.h when neededGwendal Grignou2019-03-261-0/+1
| | | | | | | | | | | | | Include compile_time_macros.h to files that will use BIT macro. BUG=None BRANCH=None TEST=unit tests. Change-Id: I9d44f4b588620f6770f8d522d422f5dd0d237903 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1525156 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* ec: cleanup: Add CONFIG_RTCJack Rosenthal2019-03-011-3/+4
| | | | | | | | | | | | | | | | | | This allows the chipset task to print RTC information, without requiring CONFIG_CMD_RTC to be enabled. BUG=chromium:649851 BRANCH=none TEST=Built and flashed on grunt (careena), confirmed RTC state printed when the power state was changed, but without RTC command present Change-Id: I6b11c4d2822117c57febdacf299a865710ed1edd Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1490672 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-by: Raul E Rangel <rrangel@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* system: Remember if reset was due to AP watchdog triggeringNicolas Boichat2018-10-291-0/+5
| | | | | | | | | | | | | | | | | On MT8183, when EC detects a watchdog reset, EC needs to reboot itself in preparation for the next boot. This means that AP loses the reset cause (as AP system reset is toggled), and, therefore, we need to save the reset reason in the EC. BRANCH=none BUG=b:109900671 TEST=apshutdown, powerb, see that reset reason is: reset-pin TEST=Use test-wd from bug. Reset reason: reset-pin ap-watchdog Change-Id: I2e30306db5727a22de930f00dc30de40b9695bef Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1295890 Reviewed-by: Jett Rink <jettrink@chromium.org>
* kukui/emmc: Disable eMMC emulation when not neededNicolas Boichat2018-08-231-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | When AP is off, or after it has booted, disable eMMC emulation, to save power. We also add a new sleepmask bit SLEEP_MASK_EMMC to make sure the EC does not deep sleep when emulating eMMC (timing is very critical). We only try to emulate for 5 seconds after boot, after which we shut down the SPI controller. 5 seconds is enough for multiple boot attempts by the AP. BRANCH=none BUG=b:110907438 TEST=Power up kukui, apshutdown, powerb, repeatedly, see that AP always boots up properly. TEST=EC power consumption in S5/G3 drops from ~6mW to 0.6mW. Change-Id: I32cc11418faa695ccf340784acbe7fa99bf74d8c Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1181009 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Yilun Lin <yllin@chromium.org>
* test: host_command_fuzz: fuzzing testNicolas Boichat2018-08-161-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | Writing fuzzing tests is a little tricky, as clang takes over the main function. Instead, we start the test main function in a thread, and have LLVMFuzzerTestOneInput prepare the host command buffer, and wake the TEST_RUNNER task. To make fuzzing faster, we only send somehow correctly formed requests, with a valid checksum and length (this can be disabled with an option). We also make sure that the emulator does not hibernate, reboot or jump to a different image when fuzzing is enabled. BRANCH=none BUG=chromium:854975 TEST=make buildfuzztests -j ASAN_OPTIONS="log_path=stderr" \ build/host/host_command_fuzz/host_command_fuzz.exe -timeout=5 Change-Id: I27b25e44c405f118dfc1296247479245e15e54b4 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1107523 Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Jonathan Metzman <metzman@chromium.org>
* npcx: adc: only enable ADC during conversion for power consumption.Mulin Chao2018-06-281-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | For better power consumption in npcx series ec, this CL only turns on ADC module before starting conversion and turns it off after the conversion is done. If ec enters deep sleep when ADC conversion is ongoing, the conveting process is suspended until next time ec wakes up from the deep sleep. Considering the frequency of ADC's source clock is up to 15MHz, it's more efficient to forbid ec enter deep sleep when the conversion is proceeding. (Each conversion time of ADC channel is ~200us based on this condition.) Forbidding ec enter deep sleep should have no harm. BRANCH=none BUG=b:110170824 TEST=No build errors for npcx7 series. The current of AVCC is reduced from 0.4mA to ~0.01mA on yorp if this patch is applied. Change-Id: Ie9226e942eeefaadbca7c17e45f0b9ee9a2364e9 Signed-off-by: Mulin Chao <mlchao@nuvoton.com> Reviewed-on: https://chromium-review.googlesource.com/1090603 Commit-Ready: Jett Rink <jettrink@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* stm32: low power idle for STM32H7Vincent Palatin2018-06-151-0/+1
| | | | | | | | | | | | | | | | | | | | | Enter STOP mode when possible. Use LPTIM1 clocked on the 32-Khz LSI as a time keeper / wake-up event during STOP mode. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=poppy BUG=b:75105319 TEST=On ZerbleBarn, use on-board INAs to measure idle power consumption, w/o CONFIG_LOW_POWER_IDLE pp3300_h7_ma:14.0 with CONFIG_LOW_POWER_IDLE pp3300_h7_ma:1.84 Change-Id: I1b72a8f6964c7bc6174c07458f307dda57fe71f3 Reviewed-on: https://chromium-review.googlesource.com/1096767 Commit-Ready: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* system: Enable/Disable low power idle in run timePhilip Chen2018-05-301-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | We have enable_sleep()/disable_sleep() to enable/disable EC deep sleep mode in runtime. Here we introduce similar interfaces to enable/disable EC idle (sleep) mode. BUG=b:78792296 BRANCH=scarlet TEST=Confirm idle mode is enabled/disabled when enable_idle() and disable_idle() are called. Change-Id: I2484f08a066523441064968da99c47de9342ecf0 Signed-off-by: Philip Chen <philipchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/1072370 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Philip Chen <philipchen@chromium.org> Commit-Queue: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org> (cherry picked from commit c6b6626cdccef04b0ff203aaed0d84dbdcecf8b7) Reviewed-on: https://chromium-review.googlesource.com/1076708 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
* npcx: Add BBRM idx for a 3rd PD port.Aseda Aboagye2018-04-251-0/+1
| | | | | | | | | | | | | | | | | | | Currently, there's only one board with 3 PD ports and it uses NPCX. Therefore, this commit just adds the index to NPCX which will be used to save the fact that there was an explicit contract in place. BUG=b:72838807 BRANCH=None TEST=make -j buildall CQ-DEPEND=CL:905390 Change-Id: Ic960f14a52f2a740adbe08bc340c45edfefbbf26 Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/905922 Commit-Ready: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>