summaryrefslogtreecommitdiff
path: root/zephyr/CMakeLists.txt
Commit message (Collapse)AuthorAgeFilesLines
* zephyr: Add the 'pd' commandSimon Glass2021-01-131-0/+3
| | | | | | | | | | | | | | | Add a Kconfig for this command so it can be brought into the build. Enable it by default, as with ECOS. BUG=b:175434113 BRANCH=none TEST=make BOARD=volteer -j30 With a zephyr-chrome CL, build volteer on zephyr Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I616ef739fe5caa76fd864fd38f60a0b9f5c6ef33 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2617375 Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: Enable the power-delivery interrupt taskSimon Glass2021-01-121-5/+3
| | | | | | | | | | | | | | | | | Enable this task so that power-delivery interrupts are serviced correctly. BUG=b:175434113 BRANCH=none TEST=make BOARD=volteer -j30 build volteer on zephyr run and see lots of charge_requests and activity, none of it very useful Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: Ic9af885b9d9635d806f6d1c662abfb695e41fedc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2617205 Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: Enable the power-delivery taskSimon Glass2021-01-121-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | Enable the PD_C0-3 tasks so that the power-delivery logic can run. Drop the PLATFORM_EC_USB_PD_TCPMV2 Kconfig which does not actually exist. We always use TCPMV2 with Zephyr. BUG=b:175434113 BRANCH=none TEST=make BOARD=volteer -j30 build volteer on zephyr run and see lots of charge_requests and activity, none of it very useful: [658 Battery 26% (Display 24.2 %) / ??h:?? to full] [662 charge_request(13200mV, 2584mA)] [666 charge problem: set current, 0x0 -> 0xfffffffb after %.6llds] [673 charge problem: set voltage, 0x0 -> 0xfffffffb after %.6llds] [679 charge problem: set mode, 0x0 -> 0xfffffffb after %.6llds] [707 charge problem: chg params, 0x0 -> 0x1f after %.6llds] Signed-off-by: Simon Glass <sjg@chromium.org> Cq-Depend: chromium:2623427 Change-Id: Icde0f7f4205d85e02cffded351c54047fe220c9d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2617204
* zephyr: copy zephyr-chrome/app directory to platform/ecJack Rosenthal2021-01-121-0/+2
| | | | | | | | | | | | | | | Previous Git history can be found here: https://chromium.googlesource.com/chromiumos/platform/zephyr-chrome/+/cc6e5d19939c03ac091b5e91d1a3b511ba99b68a/app/ BUG=b:177157241 BRANCH=none TEST=zmake testall Cq-Depend: chromium:2623408 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: Ib66a60b5404ed04e330721e96ab91e38ad97d2db Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2622901 Reviewed-by: Yuval Peress <peress@chromium.org>
* zephyr: Add the volteer USB-C port controllersSimon Glass2021-01-121-0/+4
| | | | | | | | | | | | | | | Bring the RT1715 and PS8815 drivers into the build. Move the Kconfig options next to the exusting TUSB422. BUG=b:175434113 BRANCH=none TEST=make BOARD=volteer -j30 build volteer on zephyr Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I64cc7d1960f2c6bfd1335785ea3d0627f60d1f8f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2617042 Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: Allow building Intel Burnside BridgeSimon Glass2021-01-111-0/+8
| | | | | | | | | | | | | | Add support for bringing this driver into Zephyr. BUG=b:175434113 BRANCH=none TEST=make BOARD=volteer -j30 With a zephyr-chrome CL, build volteer on zephyr Signed-off-by: Simon Glass <sjg@chromium.org> Cq-Depend: chromium:2618537 Change-Id: I9f0432e33a0efb35ccf66a5befe2e5e0fdc789a7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2617041
* zephyr: Add Kconfig options for USB PD alt modeSimon Glass2021-01-091-0/+3
| | | | | | | | | | | | | | Allow this feature to be enabled if selected by the board. BUG=b:175434113 BRANCH=none TEST=make BOARD=volteer -j30 With a zephyr-chrome CL, build volteer on zephyr Change-Id: Ie8a3ccc8cf102e3d9313f7b47b39737119a37e2c Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2617040 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: Enable the chgramp taskSimon Glass2021-01-091-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This task is used to ramp up charging from an external source. Add support for this along with required Kconfig options. Add one more stub in system to make it build. This is covered by the existing bug. BUG=b:175434113 BRANCH=none TEST=make BOARD=volteer -j30 build volteer on zephyr So far the output is not interesting (need more drivers): uart:~$ chgramp Chg Ramp: State: 0 Min ICL: 0 Active ICL: 0 Port 0: OC idx:0 OC 0: s-1 oc_det0 icl0 OC 1: s0 oc_det0 icl0 OC 2: s0 oc_det0 icl0 Port 1: OC idx:0 OC 0: s-1 oc_det0 icl0 OC 1: s0 oc_det0 icl0 OC 2: s0 oc_det0 icl0 Signed-off-by: Simon Glass <sjg@chromium.org> Cq-Depend: chromium:2613607 Change-Id: I603ba43d4384b62ed0c1a64b580599b42ae85e81 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2617039 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: Enable the pi3usb9201Simon Glass2021-01-091-0/+2
| | | | | | | | | | | | | | | Enable this driver and USB charging. So far this builds but does not work. BUG=b:175434113 BRANCH=none TEST=make BOARD=volteer -j30 build volteer on zephyr Change-Id: I3dd15d70a720f32d7ed31f26aafe522ff1f560f0 Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2615621 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: Add the USB charger tasksSimon Glass2021-01-091-0/+3
| | | | | | | | | | | | | | | | | | Add these tasks so that we can enable USB charging. For now it is left off since the driver is missing. Move the charger task to the top so that things are in alphabetical order. BUG=b:175434113 BRANCH=none TEST=make BOARD=volteer -j30 build volteer on zephyr Change-Id: Ib1f48438a2b33069624beb2cd9330db475f76333 Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2615620 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: switch to platform/ec printf format implementationJack Rosenthal2021-01-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Prior to this change, the cprints and cprintf shim implementations used Zephyr's printk to do the output formatting. Our EC code has some custom printf specifiers not supported by Zephyr's printk. We've already attempted to send some of our custom specifiers upstream, but upstream does not want them: https://github.com/zephyrproject-rtos/zephyr/pull/28882 The logical thing to do would be to bring in the vfnprintf function from our EC to the Zephyr build, and use that to do the output formatting instead. That's what this CL does. The binary cost of brining in this second printf implementation appears to be minimal (952 bytes on volteer). BUG=b:177065615 BRANCH=none TEST=on posix-ec and volteer, run gettime and observe output no longer contains %.6lld, but instead the correct system time Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I53cd4edf129223c12a2c5e7d0519623a8d07a328 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2618575
* zephyr: add ACPI handlerWealian Liao2020-12-311-0/+2
| | | | | | | | | | | | | | | | | | Add ACPI handler, which will handle the Host data from the ACPI I/O port for X86 AP. For the Zephyr shim, the ACPI handler is invoked by ESPI_PERIPHERAL_HOST_IO event in ESPI_BUS_PERIPHERAL_NOTIFICATION eSPI event. BRANCH=none BUG=b:175217186 TEST=build & boot EC on volteer Cq-Depend: chromium:2603204 Signed-off-by: Wealian Liao <whliao@nuvoton.corp-partner.google.com> Change-Id: Ic73b113bf863d10c2a9531174aba7b85018986f2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2594757 Reviewed-by: Simon Glass <sjg@chromium.org> Commit-Queue: Simon Glass <sjg@chromium.org>
* zephyr: shim the flash accessJunLin2020-12-291-1/+2
| | | | | | | | | | | | | | | | | Implement the flash_physical* APIs by wrapping the cros_flash device driver APIs in zephyr-chrome BRANCH=none BUG=b:174874876 TEST=pass build with related patches. TEST=combine with related patches, use console commands to test all the implemented flash APIs. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: JunLin <CHLin56@nuvoton.com> Cq-Depend: chromium:2601823, chromium:2598212 Change-Id: I72543fe6290e24b74f7c6bf133599e577c529f08 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2600809
* zephyr: Add the beginnings of a shim for flash accessSimon Glass2020-12-291-0/+1
| | | | | | | | | | | | | | Add myriad Kconfig options to make the flash code compile. This does not yet do anything useful, as we need to connect up to the Zephyr flash device (and need support for this in the npcx too). BUG=b:174873770 BRANCH=none TEST=build for volteer Change-Id: Ib4bed4cdd39cdf33a1d27b39aadb89df491941b3 Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2575208
* zephyr: Add basic support for shared memorySimon Glass2020-12-291-1/+2
| | | | | | | | | | | | | | | | | | | | | | | On the EC, shared memory is at the top of RAM, above all linker symbols that are located in RAM. Add a simple shim for this. At present it does enough to compile, but does not actually work. Yuval probably knows what should be done here. Add a Kconfig for the 'shmem' command. BUG=b:174873770 BRANCH=none TEST=build and boot on volteer (nothing useful happens) 20-12-04 15:22:49.267 shmem 20-12-04 15:22:50.011 Size:-537684993 20-12-04 15:22:50.011 Used: 0 20-12-04 15:22:50.011 Max: 0 Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I465c8519476e7c4a4cafba2f06630675f396c252 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2575207 Reviewed-by: Yuval Peress <peress@chromium.org>
* zephyr: Add initial USB-C supportSimon Glass2020-12-241-0/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This includes a variety of things to get volteer to build with some amount of USB-C support. It seems to charge the battery and prevent booting when the battery is too low. Much work remains. In particular: - check the Kconfig help and add missing help - possibly add a TCPM Kconfig option for grouping - BCI1.2 event handler - TCPMv2 event generator BUG=b:175434113, b:176171475 BRANCH=none TEST=build and run on volteer: 20-12-11 17:43:12.344 uart:~$ tcpci_dump 0 20-12-11 17:44:45.493 VENDOR_ID (0x00) = 0x0451 20-12-11 17:44:45.493 PRODUCT_ID (0x02) = 0x0422 20-12-11 17:44:45.493 BCD_DEV (0x04) = 0x0100 20-12-11 17:44:45.504 TC_REV (0x06) = 0x0011 20-12-11 17:44:45.504 PD_REV (0x08) = 0x2011 20-12-11 17:44:45.504 PD_INT_REV (0x0a) = 0x1010 20-12-11 17:44:45.515 ALERT (0x10) = 0x000f 20-12-11 17:44:45.515 ALERT_MASK (0x12) = 0x007f 20-12-11 17:44:45.526 POWER_STATUS_MASK (0x14) = 0x04 20-12-11 17:44:45.526 FAULT_STATUS_MASK (0x15) = 0x7f 20-12-11 17:44:45.526 EXT_STATUS_MASK (0x16) = 0x00 20-12-11 17:44:45.536 ALERT_EXTENDED_MASK (0x17) = 0x00 20-12-11 17:44:45.536 CONFIG_STD_OUTPUT (0x18) = 0x60 20-12-11 17:44:45.536 TCPC_CTRL (0x19) = 0x11 20-12-11 17:44:45.547 ROLE_CTRL (0x1a) = 0x1a 20-12-11 17:44:45.547 FAULT_CTRL (0x1b) = 0x06 20-12-11 17:44:45.558 POWER_CTRL (0x1c) = 0x70 20-12-11 17:44:45.558 CC_STATUS (0x1d) = 0x13 20-12-11 17:44:45.558 POWER_STATUS (0x1e) = 0x8c 20-12-11 17:44:45.569 FAULT_STATUS (0x1f) = 0x00 20-12-11 17:44:45.569 EXT_STATUS (0x20) = 0x00 20-12-11 17:44:45.580 ALERT_EXT (0x21) = 0x00 20-12-11 17:44:45.580 DEV_CAP_1 (0x24) = 0x1e98 20-12-11 17:44:45.580 DEV_CAP_2 (0x26) = 0x00c5 20-12-11 17:44:45.592 STD_INPUT_CAP (0x28) = 0x00 20-12-11 17:44:45.592 STD_OUTPUT_CAP (0x29) = 0x00 20-12-11 17:44:45.592 CONFIG_EXT_1 (0x2a) = 0x00 20-12-11 17:44:45.602 MSG_HDR_INFO (0x2e) = 0x02 20-12-11 17:44:45.602 RX_DETECT (0x2f) = 0x00 20-12-11 17:44:45.613 RX_BYTE_CNT (0x30) = 0x00 20-12-11 17:44:45.613 RX_BUF_FRAME_TYPE (0x31) = 0x00 20-12-11 17:44:45.613 TRANSMIT (0x50) = 0x00 20-12-11 17:44:45.624 VBUS_VOLTAGE (0x70) = 0x0000 20-12-11 17:44:45.624 VBUS_SINK_DISCONNECT_THRESH (0x72) = 0x0000 20-12-11 17:44:45.633 VBUS_STOP_DISCHARGE_THRESH (0x74) = 0x0000 20-12-11 17:44:45.633 VBUS_VOLTAGE_ALARM_HI_CFG (0x76) = 0x0000 20-12-11 17:44:45.633 VBUS_VOLTAGE_ALARM_LO_CFG (0x78) = 0x0000 20-12-11 17:44:49.544 uart:~$ ppc_dump 0 20-12-11 17:45:09.838 FUNC_SET1 [50h] = 0x0b 20-12-11 17:45:09.838 FUNC_SET2 [51h] = 0x18 20-12-11 17:45:09.838 FUNC_SET3 [52h] = 0x6a 20-12-11 17:45:09.838 FUNC_SET4 [53h] = 0xfe 20-12-11 17:45:09.838 FUNC_SET5 [54h] = 0x37 20-12-11 17:45:09.838 FUNC_SET6 [55h] = 0xc1 20-12-11 17:45:09.847 FUNC_SET7 [56h] = 0x70 20-12-11 17:45:09.847 FUNC_SET8 [57h] = 0xbd 20-12-11 17:45:09.847 FUNC_SET9 [58h] = 0x34 20-12-11 17:45:09.847 FUNC_SET10 [59h] = 0x70 20-12-11 17:45:09.847 FUNC_SET11 [5ah] = 0x24 20-12-11 17:45:09.858 FUNC_SET12 [5bh] = 0x70 20-12-11 17:45:09.858 INT_STATUS_REG1 [2fh] = 0x00 20-12-11 17:45:09.858 INT_STATUS_REG2 [30h] = 0x80 20-12-11 17:45:09.858 INT_STATUS_REG3 [31h] = 0x09 20-12-11 17:45:09.858 INT_STATUS_REG4 [32h] = 0x08 20-12-11 17:45:09.862 INT_TRIP_RISE_REG1 [20h] = 0x80 20-12-11 17:45:09.862 INT_TRIP_RISE_REG2 [21h] = 0x00 20-12-11 17:45:09.874 INT_TRIP_RISE_REG3 [22h] = 0x05 20-12-11 17:45:09.874 INT_TRIP_FALL_REG1 [23h] = 0x80 20-12-11 17:45:09.874 INT_TRIP_FALL_REG2 [24h] = 0x00 20-12-11 17:45:09.879 INT_TRIP_FALL_REG3 [25h] = 0x05 20-12-11 17:45:09.879 INT_MASK_RISE_REG1 [26h] = 0xef 20-12-11 17:45:09.879 INT_MASK_RISE_REG2 [27h] = 0xe1 20-12-11 17:45:09.892 INT_MASK_RISE_REG3 [28h] = 0xff 20-12-11 17:45:09.892 INT_MASK_FALL_REG1 [29h] = 0xff 20-12-11 17:45:09.892 INT_MASK_FALL_REG2 [2ah] = 0xef 20-12-11 17:45:09.892 INT_MASK_FALL_REG3 [2bh] = 0x8f ... 20-12-11 18:21:17.576 battery 20-12-11 18:21:17.933 Status: 0x0080 INIT 20-12-11 18:21:17.933 Param flags:00000003 20-12-11 18:21:17.933 Temp: 0x0b64 = %.1d K (%.1d C) 20-12-11 18:21:17.933 V: 0x2aa8 = 10920 mV 20-12-11 18:21:17.933 V-desired: 0x3390 = 13200 mV 20-12-11 18:21:17.944 I: 0x00bd = 189 mA(CHG) 20-12-11 18:21:17.944 I-desired: 0x0a19 = 2585 mA 20-12-11 18:21:17.944 Charging: Allowed 20-12-11 18:21:17.944 Charge: 3 % 20-12-11 18:21:17.948 Manuf: LG 20-12-11 18:21:17.948 Device: AC17A8 20-12-11 18:21:17.953 Chem: LIO 20-12-11 18:21:17.960 Serial: 0xb754 20-12-11 18:21:17.960 V-design: 0x2d1e = 11550 mV 20-12-11 18:21:17.965 Mode: 0x6001 20-12-11 18:21:17.965 Abs charge:3 % 20-12-11 18:21:17.974 Remaining: 139 mAh 20-12-11 18:21:17.974 Cap-full: 5093 mAh (4991 mAh with 98 % compensation) 20-12-11 18:21:17.983 Display: 0.0 % 20-12-11 18:21:17.983 Design: 5360 mAh 20-12-11 18:21:17.993 Time-full: 26h:21 20-12-11 18:21:17.993 Empty: 0h:0 Cq-Depend: chromium:2585918 Change-Id: I0d852169c9cbbc70603944b70f4708111abd5b42 Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2587225 Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: Enable building of the battery fuel gaugeSimon Glass2020-12-241-0/+2
| | | | | | | | | | | | | | Bring in this file needed for monitoring a battery. BUG=b:175248556 BRANCH=none TEST=build and run zephyr on volteer No visible change, except more code is compiled in Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I49a3960c62153ad0ea5c5f8121d0aa0d35e7ffe4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2600228 Reviewed-by: Keith Short <keithshort@chromium.org>
* tcpm: Move tcpm.h into an include directorySimon Glass2020-12-221-1/+2
| | | | | | | | | | | | | | | | | | This header file is used from quite a few files, relying on the EC build system to find includes in the driver/tcpm directory. For Zephyr we don't want to add that as an include. It makes more sense for header files to be in an include directory, so move it and fix up the users. BUG=b:175434113 BRANCH=none TEST=build Zephyr and ECOS on volteer Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I5851914b1a7d3fdc1ba911c0fbe9046afbaf6f5d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2597985 Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: Enable isl9241 for VolteerSimon Glass2020-12-171-0/+2
| | | | | | | | | | | | | | | Add configs and build rules to enable this driver. A few issues are left to clean up later. BUG=b:175248556 BRANCH=none TEST=build for volteer Change-Id: If2c5427d016ae8cddcc25926668011aa11673091 Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2589562 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* Reland "zephyr: Add battery and smart battery options"Keith Short2020-12-141-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* 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: add CBI module to zephyr optionsJett Rink2020-12-041-0/+1
| | | | | | | | | | | | | | 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: 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: shim the port80 moduleJack Rosenthal2020-12-011-0/+1
| | | | | | | | | | | | | | | 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-011-1/+4
| | | | | | | | | | | | | | | | | | 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 in power sequencingJack Rosenthal2020-11-201-0/+8
| | | | | | | | | | | | | 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-201-0/+1
| | | | | | | | | | | | | 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: add shim for extpowerJack Rosenthal2020-11-101-0/+3
| | | | | | | | | | | | | | | | 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: add option to shim power buttonJack Rosenthal2020-11-091-0/+2
| | | | | | | | | | | | 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-091-0/+2
| | | | | | | | | | | | | | | | 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
* Add chip-specific shim along with i2c moduleYuval Peress2020-11-081-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change accomplishes 2 things: 1. It refactors the zephyr/shim directory to structure around chip specific compilation. In this example, we're focusing on npcx7m6fb which is used in volteer but others can be added easily. 2. It shims the common/i2c_master.c by providing an alternate implementation of i2c_xfer_unlocked that calls down to the Zephyr API i2c_write_read instead of the chip specific i2c_xfer_no_retry or chip_i2c_xfer_with_notify. The shim layer is made possible by the addition of zephyr/shim/include/i2c/i2c.h which adds a functions that needs to be implemented per chip (npcx7 family in this case) and allows us to map the current port int which is defined in chip/${CHIP}/registers.h (chip/npcx/registers-npcx7.h in our case). This function (i2c_get_device_for_port) maps the platform/ec port int to a const struct device * which is needed in the Zephyr I2C APIs. BRANCH=none BUG=b:171302975 TEST=clean_build.sh projects/experimental/volteer/ and make BOARD=eve Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I210f4758337bf384d0d6f103eef8b89126887d11 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2504285 Reviewed-by: Simon Glass <sjg@chromium.org> Commit-Queue: Simon Glass <sjg@chromium.org>
* zephyr: shim the lid switchJack Rosenthal2020-11-071-0/+2
| | | | | | | | | | | | | | | Enable an option to compile common/lid_switch.c. BUG=b:172652088 BRANCH=none TEST=On volteer, with zephyr-chrome CL, observe lid{open,close,state} console commands, gpio interrupt works Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: Ica5b8abd1b0e0d9666ded9bd27927562ee36b80c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2523456 Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* zephyr: Allow keyboard_8042 to build with zephyrSimon Glass2020-11-061-0/+2
| | | | | | | | | | | | | | | | | Make a few changes so that this file can build. It does not work yet. 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: If68cc8e4541f513013481bde859fbe2f4681a0bc Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2521358 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: Build queue moduleSimon Glass2020-11-061-1/+1
| | | | | | | | | | | | | | | | | Add this to the build so we can use their features for the keyboard code. BUG=b:167405015 BRANCH=none TEST=zmake configure .../zephyr-chrome/projects/experimental/volteer \ -B /tmp/z/cos zmake build /tmp/z/cos See there are no errors Change-Id: I2d5fddc8cc7b80d3f6d2da7518ffeab989949683 Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2521357 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: Use spaces to line up the source filesSimon Glass2020-11-061-3/+3
| | | | | | | | | | | | | | | | These are easier to read when lined up vertically. Add spaces to achieve this, since Zephyr does not seem to use tabs in CMakeLists.txt files. BUG=b:167405015 BRANCH=none TEST=zmake configure .../zephyr-chrome/projects/experimental/volteer \ -B /tmp/z/cos zmake build /tmp/z/cos See there are no errors Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: Id1e2f9a8609d5f727df35f0ffa9785c537bac7f0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2522130
* zephyr: Sort shimmed modulesSimon Glass2020-11-051-1/+1
| | | | | | | | | | | | | | | | | | Sort these into alpha order to make them easier to find as the list grows. BUG=b:167405015 BRANCH=none TEST=zmake configure .../zephyr-chrome/projects/experimental/volteer \ -B /tmp/z/cos zmake build /tmp/z/cos See there are no errors Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I863f798381dc1f991b5eca9dd080fabf46e9888f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2521356 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* zephyr: add initial gpio shimJett Rink2020-10-211-0/+1
| | | | | | | | | | | | | | | | | Add the gpioget and gpioset commands to zephyr build. This requires a minimum set of platform/ec gpio_ API functions. Add the minimum set of gpio_ functions. More can be added later depending on future uses BRANCH=none BUG=b:169935802 TEST=verify gpioget and gpioset console command work on volteer TEST=verify that posix-ec compiles without any named_gpios in DT Change-Id: Ie6f0b4505aa17c50c01b71fc4ea5b59393f39fce Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2488141 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: shim in base32.cPaul Fagerburg2020-10-141-0/+1
| | | | | | | | | | | | | | | Add base32.c to the shim layer. BUG=b:168032590 BRANCH=none TEST=build the base32 unit test in zephyr-chrome Signed-off-by: Paul Fagerburg <pfagerburg@google.com> Change-Id: If4cd30fcd3ade7c4045432f1f2f1f0a85c13067d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2468631 Tested-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Paul Fagerburg <pfagerburg@chromium.org>
* zephyr: add strtoi shim functionJett Rink2020-10-121-1/+0
| | | | | | | | | | | | | | | | | | | | When I compile volteer, I only need one stdlib style function and it is something we made ourselves. There is a long verion in Zephyr and long and int are the same size for 32-bit MCUs so we just need to forward the implementation. Also remove compilation of our existing platform/ec util file since Zephyr already provides these basic stdlib like functions. BRANCH=none BUG=b:169935794 TEST=Run Zephyr image on Volteer using this function. TEST=Build and run posix-ec target as well Change-Id: Idb4ea4d5e0a6ad3da8ddc5781e16aeb6e666d85f Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2444371 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: detect the module location in a 2.3/2.4 compatible mannerJack Rosenthal2020-10-121-1/+9
| | | | | | | | | | | | | | | | | | | | | | | Most zephyr modules choose to put CMakeLists.txt at the root of the module, but we instead decided to put ours at zephyr/CMakeLists.txt to keep all CMake contained within the zephyr/ directory. So a change in 2.4 came to bite us. ZEPHYR_CURRENT_MODULE_DIR will now be set to the base of the module, not the directory where the CMakeLists.txt is located. Update the code to probe for the 2.3/2.4 difference. BUG=b:170268298 BRANCH=none TEST=compile zephyr for posix-ec on 2.3 and 2.4 (using zmake; build instructions and WIP CL can be found at go/zmake) Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: Ia6da8451bd7d25aafe7cf42066d202ead208fa7c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2454973 Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Yuval Peress <peress@chromium.org>
* zephyr: shim in the timer moduleJack Rosenthal2020-10-011-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | This enables building timer.c in the Zephyr shim. In addition, we provide definitions for the symbols __hw_clock_source_read64 and __hw_clock_event_get defined for Zephyr to provide times to the CrOS EC. The event timer does not make sense for Zephyr code, but we need it defined to prevent link errors (timerinfo uses it). Perhaps the solution to this is to add a new config option (e.g., CONFIG_EVENT_TIMER) which can be used to selectively enable/disable the event timer in the CrOS EC. But punting this work for now and just adding a fake definition. BUG=b:167590251 BRANCH=none TEST=compile for posix-ec, run gettime and timerinfo commands Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I58990a6295625f9c34ec080360470431b46155bd Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2427100 Reviewed-by: Jett Rink <jettrink@chromium.org>
* zephyr: shim in util.cJack Rosenthal2020-10-011-0/+3
| | | | | | | | | | | | | Provides platform/ec utility functions. BUG=b:167590251 BRANCH=none TEST=compile posix-ec Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: Ic6846e93dd5190b0db4d666e55ae185c4cc61392 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2442456 Reviewed-by: Jett Rink <jettrink@chromium.org>
* zephyr: add base files for Zephyr moduleJack Rosenthal2020-10-011-0/+27
This adds the minimum files necessary for platform/ec to be considered a Zephyr module, as well as some of the discussed CMakeLists files from go/zephyr-shim. BUG=b:167590251 BRANCH=none TEST=Append platform/ec dir to ZEPHYR_MODULES, build for posix-ec To replicate: $ export ZEPHYR_TOOLCHAIN_VARIANT=llvm $ export ZEPHYR_BASE=... $ ZEPHYR_CHROME=... $ PLATFORM_EC=... $ cmake -S ${ZEPHYR_CHROME}/projects/experimental/posix-ec \ -B /tmp/zephyr-build \ -D ZEPHYR_MODULES="${ZEPHYR_CHROME};${PLATFORM_EC}" $ ninja -C /tmp/zephyr-build $ /tmp/zephyr-build/zephyr/zephyr.elf Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: Id5eb4e4d3b761a9499e876dfe2178be7f7961e93 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2427089 Reviewed-by: Jett Rink <jettrink@chromium.org>