summaryrefslogtreecommitdiff
path: root/zephyr
Commit message (Collapse)AuthorAgeFilesLines
* Revert "zmake: Trim short version on full hashes"Jack Rosenthal2021-09-214-104/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 695b3c909c4846493eacd324e9c26933847372d1. Reason for revert: Broke CQ See https://ci.chromium.org/ui/p/chromeos/builders/postsubmit/trogdor-zephyr-postsubmit/314 Original change's description: > zmake: Trim short version on full hashes > > The ec_version.h contains both a long build string and also a 31 char > string. Change the short string to omit the commit count, and only > include full hashes, i.e. hayato_v2.6-ec:5bd1aa,os:ade7b4 not > hayato_v2.6.73670-ec:5bd1aa,os: > > Change test to be a real version string with hashes of the right length. > > BUG=None > BRANCH=None > TEST=./zephyr/zmake/run_tests.sh > > Change-Id: I18d73345036933594b8c74187796c3727f868629 > Signed-off-by: Jeremy Bettis <jbettis@google.com> > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3160464 > Tested-by: Jeremy Bettis <jbettis@chromium.org> > Auto-Submit: Jeremy Bettis <jbettis@chromium.org> > Commit-Queue: Jack Rosenthal <jrosenth@chromium.org> > Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Bug: None Change-Id: Ib4282f761c514c0ca2da6249d38ccc9cba852f6d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3172040 Auto-Submit: Jack Rosenthal <jrosenth@chromium.org> Tested-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
* zephyr: Explicitly enable the I2C controllerKeith Short2021-09-205-0/+132
| | | | | | | | | | | | | | | | | Explicitly enable the I2C controller node that is used on each board using the Nuvoton NPCX7 or NPCX9 chipset. This is a no-op at the moment, but prepares for an upstream change that will disable the I2C controller nodes by default. BUG=b:200292035 BRANCH=none TEST=zmake testall Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I158ae44090a719ef20930350d89efd7903e6e531 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3169389 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zmake: Trim short version on full hashesJeremy Bettis2021-09-204-41/+104
| | | | | | | | | | | | | | | | | | | | | The ec_version.h contains both a long build string and also a 31 char string. Change the short string to omit the commit count, and only include full hashes, i.e. hayato_v2.6-ec:5bd1aa,os:ade7b4 not hayato_v2.6.73670-ec:5bd1aa,os: Change test to be a real version string with hashes of the right length. BUG=None BRANCH=None TEST=./zephyr/zmake/run_tests.sh Change-Id: I18d73345036933594b8c74187796c3727f868629 Signed-off-by: Jeremy Bettis <jbettis@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3160464 Tested-by: Jeremy Bettis <jbettis@chromium.org> Auto-Submit: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* usbpd: implement new api to access PD discovery dataDeepti Deshatty2021-09-201-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | API pd_get_am_discovery() sets the lock (task access bit) to keep track of EC tasks accessing the pd port discovery data. If any of the task access bits are set,EC host task typec discovery handler will return EC_RES_BUSY to host, indicating discovery data is modified while copying port discovery data to the host. Hence the lock/task access bit should be set only when the port discovery data is modified by any tasks. Setting of lock/task access is removed from pd_get_am_discovery() and implemented new api pd_get_am_discovery_and_notify_access() for this. pd_get_am_discovery() proto type is changed to return 'constant pointer' which forces developers to use pd_get_am_discovery_and_notify_access() when they intend to access and modify discovery data. summary of changes implemented. - Remove setting of task access bit from pd_get_am_discovery(). - modify pd_get_am_discovery() prototype to return constant pointer. - implement new api pd_get_am_discovery_and_notify_access() - Replace calls to pd_get_am_discovery() with new api wherever discovery data is accessed and modified. BRANCH=none BUG=b:197466819 b:190390784 TEST=Verified 50 cold boot cycling with TBT device attached. Device detected in every cycle. Signed-off-by: Deepti Deshatty <deepti.deshatty@intel.corp-partner.google.com> Change-Id: I5b6f1f2b91d92ddbe58f3bf994f684abee948c02 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3139858 Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Commit-Queue: Abe Levkoy <alevkoy@chromium.org>
* zephyr: Restructure GPIO interrupt table to save RAMKeith Short2021-09-181-12/+38
| | | | | | | | | | | | | | | | | | Restructure the GPIO interrupt table to separate the constant data from the data that needs to be updated at runtime. On Herobrine, this saves 180 byts flash and 240 bytes RAM. BUG=b:199328071 BRANCH=none TEST=zmake testall TEST=Boot zephyr on herobrine Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I096aec5b00fd7dc661db326a278ab44a0a1286da Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3169563 Commit-Queue: Yuval Peress <peress@google.com> Reviewed-by: Yuval Peress <peress@google.com>
* zephyr: guybrush: Bringup power sequencingJack Rosenthal2021-09-178-7/+184
| | | | | | | | | | | | | | | | | Bringup power sequencing for AMD and enable for guybrush. Note that at the moment we had to copy-paste the power signals and related funcitons, the code was a bit too far from shimming without extensive editing. We can try and merge together later. BUG=b:195137794 BRANCH=none TEST=power sequence to S0, nothing useful on ap console (yet!) Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I9a577e24d80fe0ff992af4b847e14695b82f871d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3169568 Reviewed-by: Diana Z <dzigterman@chromium.org>
* zephyr: guybrush: Enable shell candyJack Rosenthal2021-09-171-0/+6
| | | | | | | | | | | | | Enable help, tab complete, and history for much tasty. BUG=b:195137794 BRANCH=none TEST=use the features Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: Ia27b9a1b0338d5ada6db5ba3c1893cea398ca78c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3169567 Reviewed-by: Diana Z <dzigterman@chromium.org>
* zephyr: guybrush: Enable ESPI driverJack Rosenthal2021-09-172-0/+2
| | | | | | | | | | | | | | | Got it to compile with just one extra gpio. Not sure if it actually works yet. BUG=b:195137794 BRANCH=none TEST=compiles Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I8103ba697206ce5350c2d353dbd3e05cec76eb40 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3169566 Reviewed-by: Diana Z <dzigterman@chromium.org>
* zephyr: kconfig: Add options for AMD power sequencingJack Rosenthal2021-09-172-7/+8
| | | | | | | | | | | | | | Add config options for AMD power sequencing and wire up to guybrush. Note this doesn't toggle any more code to compile yet. BUG=b:195137794 BRANCH=none TEST=compile for guybrush Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: Ifd17c6eec05335079bd52955c37f37407501e270 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3169565 Reviewed-by: Diana Z <dzigterman@chromium.org>
* zephyr: guybrush: Bringup power buttonJack Rosenthal2021-09-173-4/+7
| | | | | | | | | | | | | | | Enable power button interrupt and module. Don't have the x86 state machine going yet. BUG=b:195137794 BRANCH=none TEST=push the button, see the prints Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I5996a65fe40afd58027452e5b44a60becbbdfa0d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3169199 Reviewed-by: Diana Z <dzigterman@chromium.org>
* zephyr: guybrush: Enable extpower gpio detectionJack Rosenthal2021-09-172-3/+7
| | | | | | | | | | | | | | | | Bring up GPIOs for ACOK, and wire the interrupts. Note we needed to set certain Kconfigs to n due to incorrectly specified defaults. BUG=b:195137794 BRANCH=none TEST=compiles Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I64f935895a74a5df2dbcd1122623788f91ef89fa Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3169198 Reviewed-by: Diana Z <dzigterman@chromium.org>
* zephyr: guybrush: Populate GPIOsJack Rosenthal2021-09-173-5/+313
| | | | | | | | | | | | | | | | | Initial population converted from gpio.inc. IOEX gpios not handled yet. Added lid switch support as a first (useful) gpio. BUG=b:195137794 BRANCH=none TEST=observe uart prints with lid open/close Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: Ie4ac37d11ca01594b390b999516e93462b1e4691 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3169197 Reviewed-by: Diana Z <dzigterman@chromium.org>
* zephyr: Initial port for GuybrushJack Rosenthal2021-09-1710-0/+319
| | | | | | | | | | | BUG=b:195137794 BRANCH=none TEST=uart works Change-Id: Ib7e177cfd501f78afb6edf943f078466dca455a6 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3168392 Reviewed-by: Diana Z <dzigterman@chromium.org>
* zephyr: minor reorganization of GPIO shimKeith Short2021-09-171-18/+19
| | | | | | | | | | | | | | Move a comment and a function to make the next CL cleaner. BUG=none BRANCH=none TEST=none Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I83185db995b083f839709eb564353a66364e87d0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3169562 Commit-Queue: Yuval Peress <peress@google.com> Reviewed-by: Yuval Peress <peress@google.com>
* zephyr: brya: delete duplicate GPIO interrupt definitionKeith Short2021-09-171-3/+1
| | | | | | | | | | | | BUG=none BRANCH=none TEST=zmake configure -b zephyr/projects/brya/brya Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: If780dd6dfc92e0dabbe7c1aff19d2c0fe945c6d6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3169561 Commit-Queue: Yuval Peress <peress@google.com> Reviewed-by: Yuval Peress <peress@google.com>
* zephyr: test: Add tests for lis2dw12 driverYuval Peress2021-09-174-0/+115
| | | | | | | | | | | | | | | | Add a single test for the lis2dw12 driver that checks the who-am-i register. BRANCH=none BUG=b:200046770 TEST=zmake configure --test zephyr/test/drivers Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I8dba62f941d74cca025645b81512b4e0c9e04908 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3168035 Tested-by: Yuval Peress <peress@google.com> Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Yuval Peress <peress@google.com>
* zephyr: emul: lis2dw12: Add stubs for LIS2DW12 emulatorYuval Peress2021-09-178-0/+146
| | | | | | | | | | | | | BRANCH=none BUG=b:200046770 TEST=zmake configure --test zephyr/test/drivers Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: If425d9760b8db9024478fb9a664ffa71e7c25eb7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3168034 Tested-by: Yuval Peress <peress@google.com> Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Yuval Peress <peress@google.com>
* 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>