summaryrefslogtreecommitdiff
path: root/zephyr
Commit message (Collapse)AuthorAgeFilesLines
...
* zephyr: test: Add convinience debug config for I2CYuval Peress2021-09-171-0/+4
| | | | | | | | | | | | | | | | | Add the configuration log level needed to show I2C traffic. This will make it easier for others to enable when debugging tests. BRANCH=none BUG=none TEST=zmake configure --test zephyr/test/drivers Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I238a2f101777a5651ddde537a0359d9c15377587 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3168033 Tested-by: Yuval Peress <peress@google.com> Auto-Submit: Yuval Peress <peress@google.com> Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Yuval Peress <peress@google.com>
* herobrine: Enable rtc_alarm console commandWai-Hong Tam2021-09-171-0/+1
| | | | | | | | | | | | | | The command is useful to debug. BRANCH=None BUG=b:194710429 TEST=Used the rtc_alarm command to trigger RTC interrupt. Change-Id: Iefcbd2d982494044109994a1fe082041d4de215a Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3166997 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* zephyr: emul: ln9310: Fix minor formatting issues.Yuval Peress2021-09-172-2/+2
| | | | | | | | | | | | | | BRANCH=none BUG=none TEST=zmake configure --test zephyr/test/drivers Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I6b0abd11b9738057e73f0bd7af821ef1b002de25 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3168031 Tested-by: Yuval Peress <peress@google.com> Auto-Submit: Yuval Peress <peress@google.com> Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Jeremy Bettis <jbettis@chromium.org>
* zephyr: herobrine_npcx9: Set TCPC I2C speed to 400 kHzKeith Short2021-09-171-2/+12
| | | | | | | | | | | | | | | | The PS8805 supports 1 MHz operation normally, but only 400 kHz operation during flash updates. The I2C passthru interface used by depthcharge doesn't support changing the I2C frequency or informing the EC that a firmware update is going to start, so the lower frequency must be used. BUG=b:199550987 BRANCH=none TEST=Verify PS8805-A3 firmware updates Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I9be242ce03cc29c74559c6012b5cc83680b7b288 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3166998 Reviewed-by: Wai-Hong Tam <waihong@google.com>
* npcx: correct the image copies indication bits for npcx9Jun Lin2021-09-171-0/+8
| | | | | | | | | | | | | | | | | | | | In npcx5/7, we use two reserved bits in the BSC1 register (offset 0x07 of the MDC register) to indicate what the current image copy is. In npcx9, these two bits are used by the booter. We need to change them to another two empty scratch bits which are not used by the booter. BUG=b:165777478 BRANCH=none TEST=pass "make buildall" TEST=check the related bits changed by "sysump ro" and "sysjump rw" Signed-off-by: Jun Lin <CHLin56@nuvoton.com> Change-Id: I6bcfe6d8752c6fa10022a21956d2e0ceb7f9418e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3153119 Tested-by: CH Lin <chlin56@nuvoton.com> Reviewed-by: caveh jalali <caveh@chromium.org> Auto-Submit: CH Lin <chlin56@nuvoton.com> Commit-Queue: caveh jalali <caveh@chromium.org>
* herobrine: Always enable the 5V railWai-Hong Tam2021-09-162-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Prepare the next hardware revision. It has a PPC chip which requires 5V rail in S5. The 5V rail enable pin should be turned on whenever the EC is powered. Since the existing 5V rail enabling is done inside the qcom power sequence. Trogdor and Herobrine both shares this qcom power sequence. For Trogdor, this CL moves the 5V rail enabling from the qcom power sequence to the board level hook. For Herobrine, this CL updates the GPIO name and modifies the default level to HIGH. The CONFIG of 5V control should be disabled. As no board level hook to modify the 5V rail, the 5V is always on. BRANCH=None BUG=b:199804198 TEST=Booted both Zephyr and EC-OS images on Herobrine. Checked the 5V rail is enabled in S0 and S5. TEST=Booted both Zephyr and EC-OS images on Lazor. Checked the 5V rail is enabled in S0 and disabled in S5. Change-Id: Ifa98ee0c4e970dd89952e94cc6a0e289798e6a57 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3163918 Reviewed-by: Keith Short <keithshort@chromium.org>
* BB Retimer: Add new HPD callback to boardsDiana Z2021-09-161-0/+1
| | | | | | | | | | | | | | | Now that the BB retimer has its own HPD interface, add this interface to every board using the bb_usb_retimer driver. BRANCH=None BUG=b:195773400 TEST=on voxel, pass tast typec.Mode*.manual Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Ia70d139431739e8f2c0577359cb3aaa7fb906d0a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3163930 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* USB MUX: Update mux HPD update interface to use mux_state_tDiana Z2021-09-162-3/+8
| | | | | | | | | | | | | | | | | Since the drivers are now taking a mux_state_t set of flags to update, go ahead and unify the usb_mux API this way as well. It makes the parameters more apparent than the 1/0 inputs, and aligns the stack to use the same parameters. BRANCH=None BUG=b:172222942 TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Ie943dbdf03818d8497c0e328adf2b9794585d96e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3095438 Commit-Queue: Abe Levkoy <alevkoy@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* zephyr: add support for I2C debuggingKeith Short2021-09-153-0/+33
| | | | | | | | | | | | | | | | | | | Add support for CONFIG_I2C_DEBUG and CONFIG_I2C_DEBUG_PASSTHRU options to zephyr. BUG=none BRANCH=none TEST=zmake testall TEST=Add CONFIG_PLATFORM_EC_I2C_DEBUG=y on herobrine, verify "i2ctrace" command is available and functional. TEST=Add CONFIG_PLATFORM_EC_I2C_DEBUG_PASSTHRU=y on herobrine, verify I2C passthru messages shown during TCPC firmware sync. Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: Ic2d9977af4fa707dab4fdaff332fbcc34491c5fe Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3163211 Commit-Queue: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zmake: Show black outputJeremy Bettis2021-09-151-1/+1
| | | | | | | | | | | | | | | | When the CQ fails because of code formatting, it is hard to figure out what to fix. Change run_tests.sh to show the diff. BUG=None TEST=Ran run_tests.sh locally BRANCH=None Signed-off-by: Jeremy Bettis <jbettis@google.com> Change-Id: I05cc976919cad6f6e14e35843451845e0f8038d5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3160501 Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Tested-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: Test SYV682 5V_OC interrupt handlingAbe Levkoy2021-09-154-8/+92
| | | | | | | | | | | | | | | | | Simulate a 5V OC condition and verify that the driver turns VBUS off. Support status interrupt conditions and clear-on-read registers in SYV682x emulator. Increase line coverage of syv682x.c from 37.9% to 52.8%. BUG=b:190519131 TEST=zmake -l DEBUG configure --test zephyr/test/drivers BRANCH=none Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: I9c5b419057cf4ccb1531527a71760533240d1f47 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3059218 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* zephyr: riscv: use __rom_region_size for image sizeJack Rosenthal2021-09-151-1/+1
| | | | | | | | | | | | | | | | _image_rom_size was renamed to __rom_region_size in v2.7. We backported this to our v2.6 branches, so switch the name ahead of time so we're prepared for the v2.7 uprev. BUG=b:198824039 BRANCH=none TEST=compile hayato EC with zephyr v2.7 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: Iae6e7008d729f77cd66ed1a35e93001511d9cea8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3163562 Commit-Queue: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* zephyr: Conform BC1.2 test to device treeAbe Levkoy2021-09-152-10/+5
| | | | | | | | | | | | | | | | Do not override the number of USB-C ports. Enable the port 1 PD task, so that port 1 behaves as expected during the test. BUG=b:197747859 TEST=zmake configure --test zephyr/test/drivers BRANCH=none Cq-Depend: chromium:3159528 Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: I3e170c4fd295de7812b1678185a0cd892faf4203 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3138216 Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: Add test runner in shimmed taskTomasz Michalec2021-09-151-11/+14
| | | | | | | | | | | | | | | | | | | Some functions requires to call task_wait_event in test task context. Because of that there is needed shimmed_tasks entry for TASK_ID_TEST_RUNNER. BUG=none BRANCH=none TEST=make configure --test zephyr/test/drivers Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: I92cd3776a827f9a7f9bb1faee67ed998260e23a8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3159528 Tested-by: Tomasz Michalec <tmichalec@google.com> Tested-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Tomasz Michalec <tmichalec@google.com>
* zephyr: Add default mapping for remote I2C portsKeith Short2021-09-141-2/+6
| | | | | | | | | | | | | | | | | | For TCPC firmware updates, the host first queries the I2C port from the EC and passes this back during I2C passthrough operations. Default to a 1:1 mapping of the remote port to local port, if the devicetree doesn't explicitly set the remote-port property. BUG=b:197153501 BRANCH=none TEST=Boot zephyr with AUX firmware updates enabled in depthcharge, verify the TCPC firmware is updated. Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: Ie45d302044e94c0325b36cc41c528fc0ca858384 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3158974 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Yuval Peress <peress@google.com>
* zephyr: Automatically detect shared I2C portsKeith Short2021-09-144-24/+51
| | | | | | | | | | | | | | | | | | | Delete the "physical-port" node from named-i2c-ports, and automatically detected when multiple children point to the same I2C bus. This ensures that the I2C bus locking always blocks all matching I2C nodes, without the user needing to specify this relationship manually in the devicetree. BUG=none BRANCH=none TEST=Dump out i2c_physical_ports[] on herobrine. Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I3d254684483a95af12e7940446f4cd8743684708 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3154694 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Yuval Peress <peress@google.com>
* zmake: add nanopb zephyr moduleYuval Peress2021-09-141-0/+1
| | | | | | | | | | | | | | | | | | Add the nanopb zephyr module to zmake. This is needed by Chameleon V3. BRANCH=none BUG=none TEST=build brya and check that the module is there Cq-Include-Trybots: luci.chromeos.cq:cq-orchestrator Cq-Depend: chromium:3154336 Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I7eb988c4918059f77759faacc6a0ce6555c8346f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3149344 Tested-by: Yuval Peress <peress@google.com> Auto-Submit: Yuval Peress <peress@google.com> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org>
* zephyr: test: drivers: Use the LN9310 emulatorYuval Peress2021-09-144-0/+63
| | | | | | | | | | | | | | | Test the LN9310 init function for both 2S and 3S battery types. BRANCH=none BUG=b:184856083 TEST=zmake configure --test zephyr/test/drivers Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I6c6804657377cab615f7af6661839b019ab88a8a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3159648 Commit-Queue: Yuval Peress <peress@google.com> Tested-by: Yuval Peress <peress@google.com> Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* zephyr: emul: ln9310Yuval Peress2021-09-147-1/+472
| | | | | | | | | | | | | | | | | | Add an LN9310 emulator. The emulator is mostly a stub right now with some limited functionality to update the battery cell type and chip version number. BRANCH=none BUG=b:184856083 TEST=zmake configure --test zephyr/test/drivers Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I156393f4612bf69e31d4d28d88d74fa4dd1689fc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3156846 Commit-Queue: Yuval Peress <peress@google.com> Tested-by: Yuval Peress <peress@google.com> Reviewed-by: Tomasz Michalec <tmichalec@google.com> Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* zmake: Improve loggingJeremy Bettis2021-09-143-15/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add new flag --log-label to be the inverse of --no-log-label. Set defaults to --log-level=INFO --no-log-label, but if --log-level is set by the user, then default to --log-label. So a bare zmake command will output at INFO with no labels, but zmake -l INFO will include labels. Suppress the job names [/mnt/.../hayato:ro] from the log lines if --no-log-label. Don't remove leading whitespace from logged lines, it messes up the memory usage table. Wait for file descriptors to stop writing output before checking for warnings and errors in the output. Change "Output file '...' created" to be at DEBUG instead of INFO. BUG=None TEST=zmake w/ no flags, -l ERROR, --log-label, --no-log-label BRANCH=None Change-Id: I76567ab49d5d9019c5f25c618fe10816fb2cfd35 Signed-off-by: Jeremy Bettis <jbettis@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3153592 Tested-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jeremy Bettis <jbettis@chromium.org>
* zephyr: riscv: Drop gp register from panic dataJack Rosenthal2021-09-141-1/+0
| | | | | | | | | | | | | | | | | | | | | | | In v2.7, the gp register was removed from the data collected during a fatal error. See this PR for more details: https://github.com/zephyrproject-rtos/zephyr/pull/36235 Since that PR implies gp has no useful value, let's just drop it from the panic data. BUG=b:198824039 BRANCH=none TEST=build with Zephyr main branch for hayato note: still fails at link step due to missing symbol "_image_rom_size" Change-Id: Ia917d50c193fd2e493612a6d2dd6c0c6d92a1e6b Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3160405 Commit-Queue: Keith Short <keithshort@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* system: Add CrOS FWID to version outputRob Barnes2021-09-144-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | EC version does not follow the the AP and OS version. This causes confusion during development. This change augments the EC version output to include the CrOS FWID when available. The CrOS FWID will be missing when the CrOS EC is built outside of cros_sdk. When CrOS FWID is missing 'CROS_FWID_MISSING' will be used. Zephyr/zmake support will be added later, CROS_FWID32 is set to 'CROS_FWID_MISSING' in zephyr builds until then. BUG=b:188073399 TEST=version 21-05-20 16:43:18.627 Chip: Nuvoton NPCX993F A.00160101 21-05-20 16:43:18.631 Board: 1 21-05-20 16:43:18.631 RO: guybrush_v2.0.8770+f47439f75 21-05-20 16:43:18.634 guybrush_13983.0.21_05_20 21-05-20 16:43:18.639 RW_A: * guybrush_v2.0.8770+f47439f75 21-05-20 16:43:18.641 * guybrush_13983.0.21_05_20 21-05-20 16:43:18.644 RW_B: guybrush_v2.0.8770+f47439f75 21-05-20 16:43:18.644 guybrush_13983.0.21_05_20 21-05-20 16:43:18.647 Build: guybrush_v2.0.8770+f47439f75 21-05-20 16:43:18.651 guybrush_13983.0.21_05_20 2021-05-20 21-05-20 16:43:18.657 16:31:19 robbarnes@robbarnes0 ectool version RO version: guybrush_v2.0.8770+f47439f75 RO cros fwid: guybrush_13983.0.21_05_20 RW version: guybrush_v2.0.8770+f47439f75 RW cros fwid: guybrush_13983.0.21_05_20 Firmware copy: RO Build info: guybrush_v2.0.8770+f47439f75 guybrush_13983.0.21_05_20 2021-05-20 16:31:19 robbarnes@robbarnes0 Tool version: 1.1.9999-f47439f @robbarnes0 BRANCH=None Signed-off-by: Rob Barnes <robbarnes@google.com> Change-Id: Ief0a0c6e9d35edc72ac2d4780ee203be41d7305f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2894145 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* zephyr: Cleanup I2C initializationKeith Short2021-09-141-6/+8
| | | | | | | | | | | | | | | | Move the I2C initialization to compile time, saving a modest amount of RAM space BUG=b:199328071 BRANCH=none TEST=zmake testall TEST=boot Zephyr on Herobrine. Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I9d324eedca25666bcce1928b069918a357cf6081 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3158973 Commit-Queue: Yuval Peress <peress@google.com> Reviewed-by: Yuval Peress <peress@google.com>
* zephyr: I2C cleanupKeith Short2021-09-141-10/+7
| | | | | | | | | | | | | | | | | | | Zephyr does not use the GPIO based I2C recovery. Delete i2c_get_line_levels() and I2C_CONFIG_GPIO() as these symbols are no longer referenced. Move a the DT_NODE_EXISTS to the top of the file as the named-i2c-ports node is need throughout this file. BUG=none BRANCH=none TEST=zmake testall Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I62cec339b448b78d1e9ca150227f604f23af32f7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3158972 Commit-Queue: Yuval Peress <peress@google.com> Reviewed-by: Yuval Peress <peress@google.com>
* zephyr: zmake: Bound size of relative paths for resolve_build_dir testsJack Rosenthal2021-09-131-1/+4
| | | | | | | | | | | | | | | | | | | | | In Linux, both filenames and paths are not unbounded in size. The typical constants NAME_MAX and PATH_MAX specify the maximum size (in bytes) of a file name and a file path, respectively. In Linux, these constants are 256 and 4096. The regex which was previously used here assumed file names could be infinitely long. Bound it. Additionally, we need to limit to ASCII word characters, as Unicode characters may sometimes be more than one byte. BUG=b:199769823 BRANCH=none TEST=run unit tests Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I404302ea10ec27acc9c8e6988bb6dd6050deb09a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3158895 Reviewed-by: Raul E Rangel <rrangel@chromium.org>
* zephyr: Remove herobrine_npcx7 buildJack Rosenthal2021-09-139-860/+0
| | | | | | | | | | | | | | Obsolete since the NPCX9 IOB is now widely available. BUG=b:191803008 BRANCH=none TEST=zmake testall Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I3865dcf368d7542abaf5126ccb7548933b4ab25f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3150053 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Wai-Hong Tam <waihong@google.com>
* zephyr: Use NOP to wait for the external reset from H1Wealian Liao2021-09-132-6/+31
| | | | | | | | | | | | | | | | The current initial stage couldn't use the kernel delay function. Use CPU nop instruction to wait for the external reset from H1. BUG=b:182875520 BRANCH=none TEST=Enable CONFIG_BOARD_RESET_AFTER_POWER_ON for evb & toggle GPIO. Check the delay is 2 seconds. Signed-off-by: Wealian Liao <whliao@nuvoton.corp-partner.google.com> Change-Id: If221181358c2a4df758d5bb9b57c3fbba31100aa Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3143633 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* zephyr: shim/system: fix APIs of call BBRAM read and writestabilize-14217.B-mainTim Lin2021-09-133-214/+14
| | | | | | | | | | | | | | | | | | | | The APIs of BBRAM read and write have been renamed and moved to drivers/bbram. The related call routines of shim/system.c need to be fixed. BUG=b:195843756 BRANCH=none TEST=the board of asurada and it8xxx2_evb can boot EC and access bbram successfully after adding this CL. zmake testall --> pass Change-Id: I98e51a278a24eeb4bbc92343fe6fc97e3e758e8a Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3153117 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: emul: update EMUL_DEFINE call sitesYuval Peress2021-09-107-27/+28
| | | | | | | | | | | | | | | | Update the call sites of EMUL_DEFINE to include the data pointer. BRANCH=none BUG=none TEST=zmake testall Cq-Depend: chromium:3154404 Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: Icb1a788a2ffcbdd969c231edb2214447041ed5ca Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3153590 Tested-by: Yuval Peress <peress@google.com> Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Yuval Peress <peress@google.com>
* zephyr: shim: set pwm_led data from device treeFabio Baltieri2021-09-109-18/+91
| | | | | | | | | | | | | | | | Set up the pwm_leds data from the device tree, gets rid of most static map defines and sets CONFIG_LED_PWM_COUNT automatically. BRANCH=none BUG=b:177452529 TEST=build and run on volteer TEST=compared the built up pwm_leds structure with gdb Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com> Change-Id: Ib41faf86ae018f5a1ed8a1c96c4b6ec081e175d9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3154256 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Yuval Peress <peress@google.com>
* zephyr: driver: bbram: Migrate to upstream driverYuval Peress2021-09-1020-316/+56
| | | | | | | | | | | | | | | | | Migrate the BBRAM driver to the upstream version. BRANCH=none BUG=b:195843756 TEST=zmake testall Cq-Depend: chromium:3147080 Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I441e58f94c4874e268aad36df2f036a88187801b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3147230 Tested-by: Yuval Peress <peress@google.com> Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Yuval Peress <peress@google.com>
* zephyr: it8xxx2_evb: enable hibernate mode on it8xxx2_evbTim Lin2021-09-101-2/+8
| | | | | | | | | | | | | | | | | | | | | The GPIO interrupts that can be waked up in hibernate mode include GPIO_LID_OPEN and GPIO_POWER_BUTTON_L. BUG=b:198305804 BRANCH=none TEST=test1: console command: hibernate Wake-up GPIO interrupt: GPIO_LID_OPEN and GPIO_POWER_BUTTON_L test pass! test2: console command: hibernate [seconds] [microseconds] After the specified seconds, the EC will wake-up from sleep mode. Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com> Change-Id: I4069ec13d2681015a66fddf8d52666371da6048a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3146775 Commit-Queue: Keith Short <keithshort@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* zephyr: hayato: enable hibernate mode on hayatoTim Lin2021-09-101-3/+10
| | | | | | | | | | | | | | | | | | | | | | The GPIO interrupts that can be waked up in hibernate mode include GPIO_AC_PRESENT, GPIO_LID_OPEN and GPIO_POWER_BUTTON_L. BUG=b:198305804 BRANCH=none TEST=test1: console command: hibernate Wake-up GPIO interrupt: GPIO_AC_PRESENT, GPIO_LID_OPEN and GPIO_POWER_BUTTON_L test pass! test2: console command: hibernate [seconds] [microseconds] After the specified seconds, the EC will wake-up from sleep mode. Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com> Change-Id: Ibd19f14b3a5e2bf47f8edd9205761333d7b0318f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3146774 Commit-Queue: Keith Short <keithshort@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* zephyr: cros_system: add hibernate mode to IT8xxx2 chipsetTim Lin2021-09-101-2/+69
| | | | | | | | | | | | | | | | | Add hibernate function. EC can be waked-up by a specified seconds or GPIO interrupts from sleep mode. BUG=b:198305804 BRANCH=none TEST=zmake testall Cq-Depend: chromium:3093834 Change-Id: I55fbd18b916f343b198c8ba8e5dce1bd592261f6 Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3109273 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* asurada: move the hibernate routine into separate fileTim Lin2021-09-101-0/+1
| | | | | | | | | | | | | | | | | | Move the hibernate routine from baseboard.c to separate hibernate.c files. BUG=b:198305804 BRANCH=none TEST=make BOARD=asurada -j The interrupt of GPIO_AC_PRESENT can wake up CPU in hibernate mode. Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com> Change-Id: I0aea0b812f535c907ac8963fc1f09206dfef5956 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3146773 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* zephyr: herobrine_npcx9: adjust ~75% stack sizesDenis Brockus2021-09-101-0/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is still more tuning that needs to happen as development continues but this is an initial stab leaving some values the same as they are for NPCX7 when there was doubt. kernel stacks 21-09-09 12:14:06.481 0x200c0e20 PD_INT_C1 (real size 736): unused 496 usage 240 / 736 (32 %) 21-09-09 12:14:06.487 0x200c0d00 PD_INT_C0 (real size 736): unused 496 usage 240 / 736 (32 %) 21-09-09 12:14:06.493 0x200c0be0 PD_C1 (real size 1184): unused 464 usage 720 / 1184 (60 %) 21-09-09 12:14:06.500 0x200c0ac0 PD_C0 (real size 1184): unused 448 usage 736 / 1184 (62 %) 21-09-09 12:14:06.506 0x200c09a0 KEYSCAN (real size 704): unused 184 usage 520 / 704 (73 %) 21-09-09 12:14:06.513 0x200c0880 HOSTCMD (real size 704): unused 112 usage 592 / 704 (84 %) 21-09-09 12:14:06.519 0x200c0760 MOTIONSENSE (real size 816): unused 244 usage 572 / 816 (70 %) 21-09-09 12:14:06.525 0x200c0640 CHIPSET (real size 688): unused 176 usage 512 / 688 (74 %) 21-09-09 12:14:06.532 0x200c0520 CHARGER (real size 752): unused 192 usage 560 / 752 (74 %) 21-09-09 12:14:06.538 0x200c0400 USB_CHG_P1 (real size 544): unused 144 usage 400 / 544 (73 %) 21-09-09 12:14:06.544 0x200c02e0 USB_CHG_P0 (real size 544): unused 120 usage 424 / 544 (77 %) 21-09-09 12:14:06.551 0x200c01c0 HOOKS (real size 672): unused 448 usage 224 / 672 (33 %) 21-09-09 12:14:06.560 0x200c7a60 sysworkq (real size 800): unused 200 usage 600 / 800 (75 %) 21-09-09 12:14:06.564 0x200c67d0 shell_uart (real size 1536): unused 832 usage 704 / 1536 (45 %) 21-09-09 12:14:06.571 0x200c78f0 idle 00 (real size 192): unused 80 usage 112 / 192 (58 %) 21-09-09 12:14:06.577 0x200c79a8 main (real size 1024): unused 448 usage 576 / 1024 (56 %) 21-09-09 12:14:06.583 0x200cc2c8 IRQ 00 (real size 1024): unused 620 usage 404 / 1024 (39 %) BUG=b:199328071 BRANCH=none TEST=ec console command 'kernel stacks' Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: I47a02a3554e066dda87c91a2335f7e89ab0e4100 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3152316 Tested-by: Denis Brockus <dbrockus@chromium.org> Auto-Submit: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
* zephyr:herobrine_npcx9: Enable kernel shell ec commandsDenis Brockus2021-09-101-0/+1
| | | | | | | | | | | | | | BUG=b:199328071 BRANCH=none TEST=ec console command 'kernel' Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: I5ad1686e0a472123180587e2584ad79e29da65dd Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3152315 Tested-by: Denis Brockus <dbrockus@chromium.org> Auto-Submit: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
* zephyr: asurada: Adjust task stack sizesDenis Brockus2021-09-091-9/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Stack sizes should be near 75% usage. kernel stacks 21-09-08 16:07:25.972 0x8010af00 PD_C1 (real size 1024): unused 248 usage 776 / 1024 (75 %) 21-09-08 16:07:25.988 0x8010add8 PD_C0 (real size 1024): unused 272 usage 752 / 1024 (73 %) 21-09-08 16:07:26.000 0x8010acb0 KEYSCAN (real size 928): unused 240 usage 688 / 928 (74 %) 21-09-08 16:07:26.013 0x8010ab88 HOSTCMD (real size 1024): unused 272 usage 752 / 1024 (73 %) 21-09-08 16:07:26.026 0x8010aa60 MOTIONSENSE (real size 928): unused 240 usage 688 / 928 (74 %) 21-09-08 16:07:26.038 0x8010a938 CHIPSET (real size 832): unused 224 usage 608 / 832 (73 %) 21-09-08 16:07:26.051 0x8010a810 CHARGER (real size 960): unused 240 usage 720 / 960 (75 %) 21-09-08 16:07:26.062 0x8010a6e8 USB_CHG_P1 (real size 800): unused 192 usage 608 / 800 (76 %) 21-09-08 16:07:26.075 0x8010a5c0 USB_CHG_P0 (real size 800): unused 272 usage 528 / 800 (66 %) 21-09-08 16:07:26.089 0x8010a498 HOOKS (real size 672): unused 352 usage 320 / 672 (47 %) 21-09-08 16:07:26.100 0x80101a08 sysworkq (real size 1024): unused 288 usage 736 / 1024 (71 %) 21-09-08 16:07:26.112 0x801017c8 shell_uart (real size 1056): unused 244 usage 812 / 1056 (76 %) 21-09-08 16:07:26.125 0x80101888 idle 00 (real size 256): unused 128 usage 128 / 256 (50 %) 21-09-08 16:07:26.137 0x80101948 main (real size 1024): unused 344 usage 680 / 1024 (66 %) 21-09-08 16:07:26.150 0x80109cf0 IRQ 00 (real size 800): unused 296 usage 504 / 800 (63 %) BUG=none BRANCH=none TEST=ec console 'kernal stacks' Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: I69a0767e4694a386dd24c95b162d92aad5cbebc7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3150067 Commit-Queue: Denis Brockus <dbrockus@chromium.org> Tested-by: Denis Brockus <dbrockus@chromium.org> Auto-Submit: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: fix compilation of kx022 driverMichał Barnaś2021-09-093-2/+3
| | | | | | | | | | | | | | | Add EC root directory to include directories list and fix include directive in kx022 driver info file. BRANCH=main BUG=b:194424288 TEST=Compilation for lazor should work correctly. Change-Id: I1312b4cac8695e61936b9635c7a59c2f59907502 Signed-off-by: Michał Barnaś <mb@semihalf.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3129961 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* zephyr: add missing charger KconfigMichał Barnaś2021-09-082-10/+16
| | | | | | | | | | | | | | | Add CHARGER_MIN_BAT_PCT_IMBALANCED_POWER_ON to Kconfig BRANCH=main BUG=b:183544739 TEST=Define added configs to prj.conf file and verify that compilation takes them into account. Change-Id: I7672315a6938102878b5b3b87a9dcf96b0a71d46 Signed-off-by: Michał Barnaś <mb@semihalf.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3141561 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* zephyr: fix batteries FET masksMichał Barnaś2021-09-086-6/+59
| | | | | | | | | | | | | | | Fix masks and values for charge and discharge FETs. Add missing charge FETs properties. BRANCH=main BUG=b:183544739 TEST=Verify if charge and discharge FETs work correctly Change-Id: I6e3abb9d8f03b9f6372e5bfb97a447b33ee4c7a9 Signed-off-by: Michał Barnaś <mb@semihalf.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3141599 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* zephyr: add missing battery KconfigsMichał Barnaś2021-09-084-9/+61
| | | | | | | | | | | | | | | | | | | | | | Add missing Kconfigs for: - PLATFORM_EC_BATTERY_CRITICAL_SHUTDOWN_CUT_OFF - PLATFORM_EC_BATTERY_CHECK_CHARGE_TEMP_LIMITS - PLATFORM_EC_BATTERY_MEASURE_IMBALANCE - PLATFORM_EC_BATTERY_MAX_IMBALANCE_MV Change help text in battery yamls to use Kconfigs instead of legacy CONFIGs BRANCH=main BUG=b:183544739 TEST=Define added configs to prj.conf file and verify that compilation takes them into account. Change-Id: I01716c1515350550c18bbfd4944638034a25c7b5 Signed-off-by: Michał Barnaś <mb@semihalf.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3141598 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* zephyr: hooks: use k_work_reschedule to schedule deferred tasksJack Rosenthal2021-09-082-7/+1
| | | | | | | | | | | | | | | | k_work_reschedule will reschedule a work item if it's already been scheduled. Switching from k_work_schedule to k_work_reschedule fixes us the hooks test snag we saw during the v2.6 uprev. BUG=b:195971523 BRANCH=none TEST=zmake testall Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I66f6bbad1cd39847e68a178165c9c59922abbb7c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3144378 Commit-Queue: Fabio Baltieri <fabiobaltieri@google.com> Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com>
* zephyr: emul: i2c: Add device label for better debugYuval Peress2021-09-078-1/+9
| | | | | | | | | | | | | | | | Improve the debug output by including the device label in the common configs. BRANCH=none BUG=none TEST=zmake configure --test zephyr/test/drivers Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: Ic331e7842efdfae70d3f994a694c7723fdcd9640 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3144313 Reviewed-by: Tomasz Michalec <tm@semihalf.com> Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Jeremy Bettis <jbettis@chromium.org>
* NPCX: RTC: Add CONFIG_CROS_RTC_NPCX=y to prj.confSam Hurst2021-09-073-0/+3
| | | | | | | | | | | | | | | The CONFIG_CROS_RTC_NPCX config defaults to 'n'. Explicitly add CONFIG_CROS_RTC_NPCX=y to herobrine_npcx7, lazor, and trogor devices. BRANCH=none BUG=b:194710429 TEST=none Signed-off-by: Sam Hurst <shurst@google.com> Change-Id: I7a551f5574a645ea5e1495c19ec6ed09c4866ea5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3144534 Reviewed-by: Wai-Hong Tam <waihong@google.com>
* zephyr: Replace DT_ENUM_TOKEN with DT_STRING_TOKENJack Rosenthal2021-09-0717-52/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In Zephyr v2.7, DT_ENUM_TOKEN is deprecated in favor of DT_STRING_TOKEN. Additionally, DT_ENUM_UPPER_TOKEN is deprecated in favor of DT_STRING_UPPER_TOKEN. See the v2.7 release notes for details: https://docs.zephyrproject.org/latest/releases/release-notes-2.7.html Since we backported the DT_STRING_* macros to our v2.6 branch, let's switch to them ahead of time to prepare for the v2.7 uprev. Note: the DT_STRING_* macros are compatible with Zephyr's device tree enums, but also allow non-enum properties to be used in the same fashion. This commit does the bare minimum for compatibility with v2.7, i.e., just swap the macros without dropping enum properties anywhere. We should investigate whether we want to continue using the enum properties or abandon some of them for any string in the future. BUG=b:198824039 BRANCH=none TEST=zmake testall Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I1efd8f99bc7d93504c0ab94510406cd36ad24cd3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3144536 Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: console: Use DT bindings to get shell uart dev on 2.7+Jack Rosenthal2021-09-071-24/+15
| | | | | | | | | | | | | | | | | | | In Zephyr 2.7+, CONFIG_UART_SHELL_ON_DEV_NAME is removed in favor of using the zephyr,shell-uart device chosen by the UART driver. Since we choose zephyr,shell-uart on all of our boards, we are clear to make this change ahead of the v2.7 uprev. Also see https://github.com/zephyrproject-rtos/zephyr/pull/37902. BUG=b:198824039 BRANCH=none TEST=zmake testall TEST=compile posix-ec with v2.7_rc1 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: Ic066ce0617fa900ae7c1c96a2cbece0b698764bc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3142750 Reviewed-by: Keith Short <keithshort@chromium.org>
* herorbrine_npcx9: Use PCF85063A RTC Zephyr driverSam Hurst2021-09-044-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change the RTC driver from the Zephyr MTC driver to the Zephyr PCF85063A driver. BRANCH=none BUG=b:194710429 TEST=ectool rtcset 30000 ectool rtcget Current time: 0x0000753d (30013) ectool rtcsetalarm 10 after ~10 (measured with a timer) printed on ec console: [160.248900 event set 0x0000000002000000] I tested the alarm up to one hour. Signed-off-by: Sam Hurst <shurst@google.com> Change-Id: I6e6f8bb65cb515e0997687ff4beef7620506a57d herorbrine_npcx9: Configure PCF85063A RTC Alert Configure the PCF85063A RTC Alert pin so that it can interrupt the EC on an alarm event. BRANCH=none BUG=b:194710429 TEST=ectool rtcset 30000 ectool rtcget Current time: 0x0000753d (30013) ectool rtcsetalarm 10 after ~10 (measured with a timer) printed on ec console: [160.248900 event set 0x0000000002000000] I tested the alarm up to one hour. Signed-off-by: Sam Hurst <shurst@google.com> Change-Id: I58ac585c2d566d306625dd8034377925eba36293 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3140328 Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: cros_system: export the declarations to header file.Tim Lin2021-09-032-38/+38
| | | | | | | | | | | | | | | Export these declarations that get DT parameters to the header file. BUG=b:198305804 BRANCH=none TEST=none Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com> Change-Id: I6580aa2b6ae69c3727da20840148c6bc66169c0e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3139529 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* gitlab: Set the fpu flags correctlyJeremy Bettis2021-09-031-3/+1
| | | | | | | | | | | | | | | Use the zephyr_cc_option function instead of modifying CMAKE vars. BUG=b:178731498 TEST=zmake testall in docker container BRANCH=None Signed-off-by: Jeremy Bettis <jbettis@google.com> Change-Id: I97e6481e9ba3fb865e7ad49e029dfa50731a7fe6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3140779 Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Tested-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Yuval Peress <peress@chromium.org>