summaryrefslogtreecommitdiff
path: root/zephyr
Commit message (Collapse)AuthorAgeFilesLines
* Reland "zephyr: Add battery and smart battery options"Keith Short2020-12-144-0/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a reland of ac4f512e60af42efe693e6955c110a7908090e56 Original change's description: > zephyr: Add battery and smart battery options > > Shim in battery and smart battery support. > > BUG=b:175248556 > BRANCH=none > TEST=boot on volteer, run 'battery' command. > TEST=run 'ninja menuconfig' and check KConfig help text. > 20-12-10 20:08:12.778 battery > 20-12-10 20:08:13.509 Status: 0x02c0 DCHG INIT RC > 20-12-10 20:08:13.529 Param flags:00000003 > 20-12-10 20:08:13.541 Temp: 0x0b63 = %.1d K (%.1d C) > 20-12-10 20:08:13.541 V: 0x2a1e = 10782 mV > 20-12-10 20:08:13.541 V-desired: 0x3390 = 13200 mV > 20-12-10 20:08:13.541 I: 0x0000 = 0 mA > 20-12-10 20:08:13.550 I-desired: 0x0a19 = 2585 mA > 20-12-10 20:08:13.550 Charging: Allowed > 20-12-10 20:08:13.550 Charge: 0 % > 20-12-10 20:08:13.550 Manuf: LG > 20-12-10 20:08:13.555 Device: AC17A8 > 20-12-10 20:08:13.573 Chem: LIO > 20-12-10 20:08:13.573 Serial: 0xb754 > 20-12-10 20:08:13.573 V-design: 0x2d1e = 11550 mV > 20-12-10 20:08:13.573 Mode: 0x6001 > 20-12-10 20:08:13.573 Abs charge:0 % > 20-12-10 20:08:13.573 Remaining: 0 mAh > 20-12-10 20:08:13.577 Cap-full: 4932 mAh (4833 mAh with 98 % compensation) > 20-12-10 20:08:13.585 Design: 5360 mAh > 20-12-10 20:08:13.594 Time-full: 0h:0 > 20-12-10 20:08:13.594 Empty: 0h:0 > > Change-Id: Ie782e75ee4027ab2a5c6a0ae7f4ad81e9c360711 > Signed-off-by: Simon Glass <sjg@chromium.org> > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2575199 Bug: b:175248556 TEST=make buildall, which fails with: /opt/coreboot-sdk/lib/gcc/nds32le-elf/8.3.0/../../../../nds32le-elf/bin/ld: __flash_dma_size < IT83XX_ILM_BLOCK_SIZE BRANCH=none Change-Id: I318fb13ba91485cd7d876b2294f20d748f47e0fd Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2585931 Tested-by: Simon Glass <sjg@chromium.org> Auto-Submit: Simon Glass <sjg@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
* task_set_event: remove the wait argumentDawid Niedzwiecki2020-12-142-8/+7
| | | | | | | | | | | | | | | | | | | | There is an option in the task_set_event function which force the calling task to wait for an event. However, the option is never used thus remove it. This also will help in the Zephyr migration process. BUG=b:172360521 BRANCH=none TEST=make buildall Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com> Change-Id: Ic152fd3d6862d487bcc0024c48d136556c0b81bc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2521599 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
* Revert "zephyr: Add battery and smart battery options"Eric Yilun Lin2020-12-143-73/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit ac4f512e60af42efe693e6955c110a7908090e56. Reason for revert: This CL stops chipset_task forever, revert this to boot AP. Original change's description: > zephyr: Add battery and smart battery options > > Shim in battery and smart battery support. > > BUG=b:175248556 > BRANCH=none > TEST=boot on volteer, run 'battery' command. > TEST=run 'ninja menuconfig' and check KConfig help text. > 20-12-10 20:08:12.778 battery > 20-12-10 20:08:13.509 Status: 0x02c0 DCHG INIT RC > 20-12-10 20:08:13.529 Param flags:00000003 > 20-12-10 20:08:13.541 Temp: 0x0b63 = %.1d K (%.1d C) > 20-12-10 20:08:13.541 V: 0x2a1e = 10782 mV > 20-12-10 20:08:13.541 V-desired: 0x3390 = 13200 mV > 20-12-10 20:08:13.541 I: 0x0000 = 0 mA > 20-12-10 20:08:13.550 I-desired: 0x0a19 = 2585 mA > 20-12-10 20:08:13.550 Charging: Allowed > 20-12-10 20:08:13.550 Charge: 0 % > 20-12-10 20:08:13.550 Manuf: LG > 20-12-10 20:08:13.555 Device: AC17A8 > 20-12-10 20:08:13.573 Chem: LIO > 20-12-10 20:08:13.573 Serial: 0xb754 > 20-12-10 20:08:13.573 V-design: 0x2d1e = 11550 mV > 20-12-10 20:08:13.573 Mode: 0x6001 > 20-12-10 20:08:13.573 Abs charge:0 % > 20-12-10 20:08:13.573 Remaining: 0 mAh > 20-12-10 20:08:13.577 Cap-full: 4932 mAh (4833 mAh with 98 % compensation) > 20-12-10 20:08:13.585 Design: 5360 mAh > 20-12-10 20:08:13.594 Time-full: 0h:0 > 20-12-10 20:08:13.594 Empty: 0h:0 > > Change-Id: Ie782e75ee4027ab2a5c6a0ae7f4ad81e9c360711 > Signed-off-by: Simon Glass <sjg@chromium.org> > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2575199 Bug: b:175248556 Change-Id: I66086d8fee46d5fd02d26938468a7d76dab71c6e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2589140 Reviewed-by: Eric Yilun Lin <yllin@chromium.org> Commit-Queue: Eric Yilun Lin <yllin@chromium.org> Tested-by: Eric Yilun Lin <yllin@chromium.org>
* zephyr: Update the I2C tableSimon Glass2020-12-111-7/+2
| | | | | | | | | | | | | | | | | | | | | | | | Something has happened since this code was written and now it doesn't work. The current code checks the status of each of the named-i2c-ports nodes, which always seems to return 0, then ends up searching for a device called "". Obviously this code did work and should work, but I'm uploading this just because it makes the battery command work for me: On the other hand, I don't think we need to check the status. After all, we are searching for a device by its node label and if the node is disabled it will not have a device anyway. BUG=b:175248556 BRANCH=none TEST=verify with debugging that the i2c_devices[] array is now inited correctly Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I709421be86027e0e6166a7658fe59ba68783cbe7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2586614 Reviewed-by: Yuval Peress <peress@chromium.org>
* zephyr: Add battery and smart battery optionsKeith Short2020-12-113-0/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Shim in battery and smart battery support. BUG=b:175248556 BRANCH=none TEST=boot on volteer, run 'battery' command. TEST=run 'ninja menuconfig' and check KConfig help text. 20-12-10 20:08:12.778 battery 20-12-10 20:08:13.509 Status: 0x02c0 DCHG INIT RC 20-12-10 20:08:13.529 Param flags:00000003 20-12-10 20:08:13.541 Temp: 0x0b63 = %.1d K (%.1d C) 20-12-10 20:08:13.541 V: 0x2a1e = 10782 mV 20-12-10 20:08:13.541 V-desired: 0x3390 = 13200 mV 20-12-10 20:08:13.541 I: 0x0000 = 0 mA 20-12-10 20:08:13.550 I-desired: 0x0a19 = 2585 mA 20-12-10 20:08:13.550 Charging: Allowed 20-12-10 20:08:13.550 Charge: 0 % 20-12-10 20:08:13.550 Manuf: LG 20-12-10 20:08:13.555 Device: AC17A8 20-12-10 20:08:13.573 Chem: LIO 20-12-10 20:08:13.573 Serial: 0xb754 20-12-10 20:08:13.573 V-design: 0x2d1e = 11550 mV 20-12-10 20:08:13.573 Mode: 0x6001 20-12-10 20:08:13.573 Abs charge:0 % 20-12-10 20:08:13.573 Remaining: 0 mAh 20-12-10 20:08:13.577 Cap-full: 4932 mAh (4833 mAh with 98 % compensation) 20-12-10 20:08:13.585 Design: 5360 mAh 20-12-10 20:08:13.594 Time-full: 0h:0 20-12-10 20:08:13.594 Empty: 0h:0 Change-Id: Ie782e75ee4027ab2a5c6a0ae7f4ad81e9c360711 Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2575199
* zephyr: Fix 'edefines' typoSimon Glass2020-12-111-1/+1
| | | | | | | | | | | | | | Fix a typo that crept into the Kconfig. BRANCH=none BUG=none TEST=build for volteer Change-Id: I57634da26ca94aba3b80d5f4c10d75b250a9ea2c Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2585064 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: Sort file list by config optionKeith Short2020-12-101-10/+17
| | | | | | | | | | | | | | Sort the cmake file list by the config option name. BRANCH=none BUG=none TEST=build and boot on volteer Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I0c66524b990bcc24ac3d19b260daf7ff070861cb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2582279 Commit-Queue: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org>
* zephyr: remove dependency on chip specific code for npcxYuval Peress2020-12-108-83/+50
| | | | | | | | | | | | | BRANCH=none BUG=b:175249000 TEST=zmake testall Cq-Depend: chromium:2583272 Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: Ie50e56df60e060c3741013912ab46d807fc5e417 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2582819 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: enable CONFIG_HOSTCMD_ESPIJack Rosenthal2020-12-092-0/+24
| | | | | | | | | | | | | | | | | | This enables CONFIG_HOSTCMD_ESPI when we have ESPI and host commands enabled (the case with volteer). There were two functions stubbed out that we will leave to Nuvoton to implement. BUG=b:175217186,b:172678200 BRANCH=none TEST=boot volteer Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I9b6a8c7c60d1a1018292a207a61c583fd171e546 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2582445 Commit-Queue: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: fix build for keyboard shimYuval Peress2020-12-056-14/+121
| | | | | | | | | | | | | | | | | | | | | See platform/ec/common/build.mk for reference. The use of keyboard_scan.c should only be allowed when HAS_TASK_KEYSCAN is defined. As such, we should always set HAS_TASK_KEYSCAN to 1 if CONFIG_PLATFORM_EC_KEYBOARD is defined. Further, CROS_EC_TASK_LIST was defined per project and it doesn't need to be, we can instead define it once for all boards depending on which tasks are set to 1 in shimmed_tasks.h Note that shimmed_tasks.h can still be used in tests. BRANCH=none BUG=none TEST=zmake testall Cq-Depend: chromium:2566421 Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: Id0ed49dd49e3c4eb2ac23184cf943c91dcd261eb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2567560
* zephyr: Sort the options a bitSimon Glass2020-12-053-112/+121
| | | | | | | | | | | | | | | | | | | We have quite a few options already and plan to add more. Sort them to make it easier to see what is there. The I2C enum isn't really connected with the basic CONFIG munging done in config_chip.h so move it to i2c.h instead. Fix the 'keybaord' typo while we are here. BRANCH=none BUG=none TEST=build and boot on volteer Change-Id: Id03fe44ff859736f1e2f86231ca1e8d9dc4c50af Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2575198 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: add CBI module to zephyr optionsJett Rink2020-12-043-0/+40
| | | | | | | | | | | | | | Shim in CBI module and necessary dependencies. BRANCH=none BUG=b:168032342,b:168032589 TEST=type `cbi` on volteer Signed-off-by: Jett Rink <jettrink@chromium.org> Change-Id: Ic08f472f8d52cd4521b78f819ea22e337cccc6f4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2572736 Reviewed-by: Simon Glass <sjg@chromium.org> Commit-Queue: Simon Glass <sjg@chromium.org>
* zephyr: Add is-test flag to zmake.yaml files under test/Yuval Peress2020-12-045-0/+5
| | | | | | | | | | | | | | | | This change will make the firmware builder auto-detect new tests. BRANCH=none BUG=none TEST=Ran zephyr's firmware_builder.py Cq-Depend: chromium:2551964 Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I70ba1b32b67e2cb4e3676d228b299294028597a9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2552848 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr/test/i2c: update to i2c_controller.c nameJett Rink2020-12-031-1/+1
| | | | | | | | | | | | | | After COIL rename, we need to update the CMakeLists.txt for the i2c test BRANCH=none BUG=b:174572350 TEST=builds and passes test Signed-off-by: Jett Rink <jettrink@chromium.org> Change-Id: I33b712876c11dc77e7835c2505749d449e11ffa6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2572398 Commit-Queue: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: shim in common/chipset.cJack Rosenthal2020-12-021-0/+2
| | | | | | | | | | | | | | This gives us the "apreset" and "apshutdown" console commands. BUG=b:171312361 BRANCH=none TEST=try "apreset" and "apshutdown" commands on volteer Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: Ib71afa66cfb5d0044c4cf98839b263ee2e2da338 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2567343 Commit-Queue: Yuval Peress <peress@chromium.org> Reviewed-by: Yuval Peress <peress@chromium.org>
* zephyr: un-break our build from COIL renamesJack Rosenthal2020-12-011-1/+1
| | | | | | | | | | | | | | | CL:2558905 broke our build as it renamed this file. Update the name here too. BUG=b:174572350 BRANCH=none TEST=build for volteer Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I96c0922a988df05b8935b169781b809bd4425b7d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2567586 Commit-Queue: Diana Z <dzigterman@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org>
* zephyr: fix espi shimYuval Peress2020-12-011-2/+2
| | | | | | | | | | | | | | | We were casting the int to a pointer. Needed '&'. BRANCH=none BUG=none TEST=zmake testall (but it still fails on missing cros_kb_raw.h Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I9d61fb27826c581214d5557364a97e6ea9d215e8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2567583 Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: shim the port80 moduleJack Rosenthal2020-12-012-0/+8
| | | | | | | | | | | | | | | Shim in the port80 module. BUG=b:172471337 BRANCH=none TEST=boot volteer, watch the port80 writes test port80 command Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I35e3254bb95fec92e4b69ca65f1d8eebbc6d14f1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2567033 Commit-Queue: Yuval Peress <peress@chromium.org> Reviewed-by: Yuval Peress <peress@chromium.org>
* zephyr: shim the keyboard scanSimon Glass2020-12-016-1/+141
| | | | | | | | | | | | | | | | | | It shims the keyboard_scan task by introducing another keyboard_raw.c which calls down to the zephyr-chrome cros_kb_raw driver. BRANCH=none BUG=b:167405015 TEST=Build pass by zmake configure -B ./build projects/experimental/volteer. TEST=Check all the keys on volteer platform by "ksstate". Change-Id: Ic87f67c28779f7feafa350020a07ba87e3600ecd Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Wealian Liao <whliao@nuvoton.corp-partner.google.com> Signed-off-by: Mulin Chao <MLChao@nuvoton.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2523839 Commit-Queue: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: shim system_jumped_late & system_enter_hibernateWealian Liao2020-12-011-0/+32
| | | | | | | | | | | | | | | | shim the system_jumped_late() and system_enter_hibernate() that needed by keyboard scan. BRANCH=none BUG=b:167405015 TEST=compile with keyboard scan Signed-off-by: Wealian Liao <whliao@nuvoton.corp-partner.google.com> Change-Id: I4f79dd3b0313f4ed19550b1896ed0e439407caf6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2552321 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: shim in power sequencingJack Rosenthal2020-11-204-0/+119
| | | | | | | | | | | | | Enable shimming of power sequencing code. BUG=b:171312361 BRANCH=none TEST=With zephyr-chrome CL... https://screenshot.googleplex.com/4m6N6vd2Nx5FpiD.png Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I8fb96019c8c636010d2cd136c0116df41fc9f148 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2548308
* zephyr: shim some basic eSPI functionalityJack Rosenthal2020-11-206-0/+257
| | | | | | | | | | | | | Add some basic functionality to get and set virtual wires. BUG=b:171815541 BRANCH=none TEST=volteer power sequencing to S0 (requires follow-up CLs) Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I07655fd3a768aca962112a98d6f1f593633eb605 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2548307 Reviewed-by: Jett Rink <jettrink@chromium.org>
* zephyr: stub system_hibernateJack Rosenthal2020-11-201-0/+8
| | | | | | | | | | | | | Needed by power sequencing. Doing nothing will work fine for now. BUG=b:173787365 BRANCH=none TEST=compile with power sequencing Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: Ia4e48d92ebbee7a788e4515f6583095349aea0f3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2548306 Reviewed-by: Jett Rink <jettrink@chromium.org>
* zephyr: implement gpio_reset and gpio_set_flagsJack Rosenthal2020-11-201-8/+46
| | | | | | | | | | | | | | | These are required by power sequencing. Also, handle conversion of more bits while I'm here. BUG=b:171312361,b:173789980 BRANCH=none TEST=compile with power sequencing code for volteer Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I3064e6851c64a7f43612524000289ac7d7f04766 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2548305 Reviewed-by: Jett Rink <jettrink@chromium.org>
* zephyr: add i2c_ports enumYuval Peress2020-11-206-0/+137
| | | | | | | | | | | | | | | | | | | This change adds an i2c_ports enum based on the devicetree phandle list 'named-i2c-ports'. Modeled after named-gpios. Currently, this is only enabled for ztests as it conflicts with the definitions in config_chip-npcx7.h. But once that dependency is removed, this enum will become publicly available. BUG=b:171302975 BRANCH=none TEST=../zephyr-chrome/firmware_builder.py test Cq-Depend: chromium:2546328 Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I8e763da0c867fed383eb333092f191079fb792ea Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2546997 Reviewed-by: Jett Rink <jettrink@chromium.org>
* zephyr: implement system_jumped_to_this_imageJack Rosenthal2020-11-191-0/+5
| | | | | | | | | | | | | | | | Required by power sequencing. Should always be false for now as sysjump is not implemented. BUG=b:171312361 BRANCH=none TEST=compiles with power sequencing Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I1dc6e553211734307ce5a28ed3b5b9feeff002a5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2548304 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Yuval Peress <peress@chromium.org> Commit-Queue: Jett Rink <jettrink@chromium.org>
* zephyr: rename gpio_signal.h so that we have deterministic includesJack Rosenthal2020-11-191-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Per go/zephyr-shim-how-to, the headers under zephyr/shim/include/ need to be distinct names from those under include/, as the C compiler has no defined ordering to searching the include paths. (i.e., there is no such thing as a "header override"). Make include/gpio_shim.h include zephyr_gpio_shim.h instead, and rename the zephyr header accordingly. Without this, occasionally you can get this: In file included from include/gpio_signal.h:26, from include/espi.h:11, from zephyr/shim/src/espi.c:14: include/gpio.wrap:36:2: error: #error "Your architecture must ... 36 | #error "Your architecture must define GPIO_PIN and it did not." | ^~~~~ include/gpio.wrap:40:2: error: #error "Your architecture must ... 40 | #error "Your architecture must define GPIO_PIN_MASK and it did not." | ^~~~~ include/gpio.wrap:246:10: fatal error: gpio.inc: No such file or directory 246 | #include "gpio.inc" | ^~~~~~~~~~ compilation terminated. BUG=b:173031377 BRANCH=none TEST=compile for volteer and posix-ec Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I0eb23c41ee5c2be4f0405d3fadb71d6422d0ff40 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2548303 Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Jett Rink <jettrink@chromium.org>
* zephyr: add IOEX_ constants to gpio_signal.hJack Rosenthal2020-11-191-1/+18
| | | | | | | | | | | | | | | Multiple headers and platform/ec files need some of the IOEX_* constants defined, even if we don't support IO expanders (yet). Add this as a stopgap. BUG=b:171312361 BRANCH=none TEST=compile for volteer Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I78fa80047683eff9dca318a1656c21448a76579f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2548301 Reviewed-by: Yuval Peress <peress@chromium.org>
* zephyr: gpio: declare interrupt handlers in gpio.cJack Rosenthal2020-11-191-1/+10
| | | | | | | | | | | | | | | | To prevent a mess of includes inside of gpio_map.h (and to help cut back on people forgetting to include headers, since gpio_map.h is used quite universally), have gpio.c declare all the interrupt handlers before using them. BUG=b:169935802 BRANCH=none TEST=compile with powerseq CLs Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: Iaead04b29ea68eb0b77f3a3b9c65938b629d2ab9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2548300 Reviewed-by: Yuval Peress <peress@chromium.org>
* zephyr: Include i2c_map.h for I2C enabled boardsYuval Peress2020-11-171-0/+5
| | | | | | | | | | | BRANCH=none BUG=b:171302975 TEST=zmake build for volteer and zmake test for ec and i2c Change-Id: Ic5be445ac7cc2216114379f7fad59de03251c1de Signed-off-by: Yuval Peress <peress@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2541622 Reviewed-by: Jett Rink <jettrink@chromium.org>
* zephyr/tests: add zmake file for crc testJett Rink2020-11-161-0/+9
| | | | | | | | | | | | | | The zmake file allows us to use the zmake program to easily build this test BRANCH=none BUG=none TEST=use `zmake configure -b -B /tmp/build zephyr/test/crc` Signed-off-by: Jett Rink <jettrink@chromium.org> Change-Id: If1928c8c6705b4e8905e2f84eee896158a7510e2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2540732 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* Zephyr: Migrate i2c implementation to chip family specific fileYuval Peress2020-11-162-1/+2
| | | | | | | | | | | | | | This change simply moves the i2c.c shim to i2c-npcx7.c. BRANCH=none BUG=none TEST=builds with zmake for volteer Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: Ic410787dcf2693dda71681f739c0b74cd47770da Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2532964 Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org> Commit-Queue: Paul Fagerburg <pfagerburg@chromium.org>
* zephyr: fix issue with set_event hanging before tasks startJett Rink2020-11-132-6/+44
| | | | | | | | | | | | | | Initialize the kernel objects before application code as a chance to run. This ensures that any event that is set before tasks start will get delivered (and won't crash the kernel). BRANCH=none BUG=none TEST=included unit test Signed-off-by: Jett Rink <jettrink@chromium.org> Change-Id: I84ecfddbe706e7e1860f310571851ee8dedd07d9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2535984
* zephyr: forward cros_crc8 to zephyrs crc8 implJett Rink2020-11-135-0/+71
| | | | | | | | | | | | | | | Shim in support for crc8 used in CBI, I2C, and other applications within platform/ec BRANCH=none BUG=b:168032589 TEST=add unit test for platform/ec and zephyr based CRC8 approaches and verify they both pass. Signed-off-by: Jett Rink <jettrink@chromium.org> Change-Id: I9b6112cb83dab81a44a1ac020d4efb1b7bb1df5f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2532692 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr/test/base32: change test to depend on lessJett Rink2020-11-122-2/+16
| | | | | | | | | | | | | | | As we add more shim code and configs, we don't want to remove the functionality in all of the tests. Convert this test to only include the files it needs to link to perform the shim test. BRANCH=none BUG=b:172512307 TEST=base32 test builds and passes Signed-off-by: Jett Rink <jettrink@chromium.org> Change-Id: I4a7232c98397600d578e18b67935924b088f377b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2532687 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr/test/hooks: change test to depend on lessJett Rink2020-11-122-6/+18
| | | | | | | | | | | | | | | As we add more shim code and configs, we don't want to remove the functionality in all of the tests. Convert this hooks test to only include the two files it needs to link to perform the shim test. BRANCH=none BUG=b:172512307 TEST=hooks test builds and passes Signed-off-by: Jett Rink <jettrink@chromium.org> Change-Id: I0613670fe3cc056e33035ccc5ad1418e5e3d6db0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2532686 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* Revert "zephyr: forward cros_crc8 to zephyrs crc8 impl"Jett Rink2020-11-115-71/+0
| | | | | | | | | | | | | | | Something slipped through CQ coverage. Need to figure out, but in the mean time, revert the 3 CLs that seemed to have caused the issue. BRANCH=none BUG=chromium:1147953 TEST=none This reverts commit 22ee9a346718a9a07955fd81b0d03c4dde5b2ec8. Change-Id: I5617e39204a7c05001363d5780fa2f52e3e1ea05 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2533355
* zephyr: bounds check remaining gpio shim functionsJett Rink2020-11-111-0/+6
| | | | | | | | | | | | | | | I missed a few bound checks in the gpio shim. Add a bound check to all remaining gpio shim functions that need it. BRANCH=none BUG=b:172512307 TEST=volteer, posix-ec, and test/app/ec all build without warnings Signed-off-by: Jett Rink <jettrink@chromium.org> Change-Id: Id915532b83e1621c86253fe86137034751a4da6d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2532683 Commit-Queue: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: add strtoull function for 64-bit inputJett Rink2020-11-111-0/+50
| | | | | | | | | | | | | | | We do need a true 64-bit input function for common platform/ec code, and zephyr doesn't have this. Add the support to the shim BRANCH=none BUG=b:172592963,b:172512307 TEST=build EC and volteer and posix_ec Signed-off-by: Jett Rink <jettrink@chromium.org> Change-Id: I81f69fdbe03916f3a54091ce6c077db32ed3a73c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2532679 Commit-Queue: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr/kconfig: put KB protocol because KB optionJett Rink2020-11-111-0/+4
| | | | | | | | | | | | | | The PLATFORM_EC_KEYBOARD_PROTOCOL_8042 should be guarded by the PLATFORM_EC_KEYBOARD option. BRANCH=none BUG=b:172512307 TEST=build posix-ec with CL stack Signed-off-by: Jett Rink <jettrink@chromium.org> Change-Id: Idd070454a11ed65cab763ff7788dec4b907f610d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2530152 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr/gpio: add bound checks to all gpio functionsJett Rink2020-11-111-0/+12
| | | | | | | | | | | | | | | The static check for zephyr will generate warnings if we do not bounds check the incoming gpio_signal enum. We should bounds check anyway. BRANCH=none BUG=b:172512307 TEST=build posix-ec with CL stack Signed-off-by: Jett Rink <jettrink@chromium.org> Change-Id: I1b2014c02e02d7271eeabd3cc041b3c452b1c43f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2530151 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr/util: reorder header filesJett Rink2020-11-111-3/+6
| | | | | | | | | | | | | | | When compiling posix-ec, there are issues with strncasecmp. If we include the correct zephyr headers and hide the EC's version of stdlib, we can make everything work BRANCH=none BUG=b:172512307 TEST=build posix-ec with CL stack Signed-off-by: Jett Rink <jettrink@chromium.org> Change-Id: Ia4d412a45e15b91b36b94ca58ecc9cbe41b2b082 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2530150 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: forward cros_crc8 to zephyrs crc8 implJett Rink2020-11-115-0/+71
| | | | | | | | | | | | | | | Shim in support for crc8 used in CBI, I2C, and other applications within platform/ec BRANCH=none BUG=b:168032589 TEST=add unit test for platform/ec and zephyr based CRC8 approaches and verify they both pass. Change-Id: Ib609f98596c4edc6e6f0d01b6242e62a1f95ad72 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2527811 Reviewed-by: Yuval Peress <peress@chromium.org>
* zephyr: add shim for extpowerJack Rosenthal2020-11-102-0/+12
| | | | | | | | | | | | | | | | This brings over the extpower_common.c and extpower_gpio.c files to the Zephyr build. This is needed as a dependency of power sequencing. BUG=b:172720290 BRANCH=none TEST=on volteer, observe "hostevents" command output to see AC_PRESENT event set when charger connected. (requires the zephyr-chrome CL as well) Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I28ad442180762d542cc6031ab1f33284b08a4572 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2527703 Reviewed-by: Jett Rink <jettrink@chromium.org>
* zephyr: Redefine assert safelySimon Glass2020-11-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | At present a build error is produced when building keyboard_scan.c due to a redefinition of this symbol. Undef it first. BUG=b:167405015 BRANCH=none TEST=make BOARD=volteer zmake configure .../zephyr-chrome/projects/experimental/volteer \ -B /tmp/z/cos zmake build /tmp/z/cos see there are no errors Change-Id: I9b13d1737d6ce6f7ab35b0d6457c2db49cea8dbc Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2523838 Reviewed-by: Yuval Peress <peress@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Jett Rink <jettrink@chromium.org> Tested-by: Jett Rink <jettrink@chromium.org>
* zephyr: correct shimmed task prioritiesJett Rink2020-11-091-2/+3
| | | | | | | | | | | | | | | | | Add build assert to ensure that deferred task is lower than all of the other shimmed tasks. Also make priority of tasks from 0 to COUNT - 1 instead of 1 to COUNT BRANCH=none BUG=none TEST=volteer still builds Signed-off-by: Jett Rink <jettrink@chromium.org> Change-Id: Iabe9f1117850975ec9bf3df1dcfc690b4725a7e0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2523389 Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* cleanup: follow header include styleJett Rink2020-11-094-8/+11
| | | | | | | | | | | | | | | | | In order to align with go/zephyr-shim-how-to, update all of the platform/ec header files to use "quotes" and only use <brackets> for zephyr header files. Also include an empty line between the two. BRANCH=none BUG=none TEST=all zephyr tests build and pass; build volteer Signed-off-by: Jett Rink <jettrink@chromium.org> Change-Id: I27c275c24aa4f8eb40e100b07517b60f548f06cf Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2521594 Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Tested-by: Simon Glass <sjg@chromium.org>
* zephyr: move from SYS_INIT to mainJett Rink2020-11-094-14/+19
| | | | | | | | | | | | | | | | | | We are going to need to perform initialization in Zephyr's main before we start the EC tasks or call the INIT hooks. If we rely on SYS_INIT, all of that happens before main is called. BRANCH=none BUG=none TEST=pass tasks unit tests and run on volteer Cq-Depend: chromium:2523462 Signed-off-by: Jett Rink <jettrink@chromium.org> Change-Id: Icd035695b86fc9690cea88887902be61d9b37a18 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2523380 Tested-by: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: add option to shim power buttonJack Rosenthal2020-11-092-0/+10
| | | | | | | | | | | | Add an option to shim the power button module. BUG=b:172471187 BRANCH=none TEST=volteer: press power button, observe UART output Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I7dbc705b19bfc312e2707080f22e411ebd7e2c1b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2523382
* zephyr: add stub host events implementationJack Rosenthal2020-11-092-0/+8
| | | | | | | | | | | | | | | | Include host_command.c and host_event_commands.c so that we get some basic definitions to get things compiling. Since we don't have CONFIG_HOSTCMD_ESPI enabled yet, this is really just pulling in stub definitions. BUG=b:172678200 BRANCH=none TEST=compiles for volteer Cq-Depend: chromium:2523466 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: Ic293f80d30ecf9534ff935b73aa4ca42614a77be Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2523381