summaryrefslogtreecommitdiff
path: root/zephyr
Commit message (Collapse)AuthorAgeFilesLines
* zephyr: Fix kconfig license headerYuval Peress2021-01-291-3/+3
| | | | | | | | | | | | BRANCH=none BUG=none TEST=none Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I5c817a9bcd7f89b2533f49c82368981434eefd9e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2656915 Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: increase task stacks size for few threads close to the limitFabio Baltieri2021-01-281-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Spotted few threads close to the stack size limit: PD_INT_C0, POWERBTN, HOSTCMD and CHIPSET: uart:~$ kernel stacks 0x200c0b20 PD_INT_C1 (real size 512): unused 224 usage 288 / 512 (56 %) 0x200c0a38 PD_INT_C0 (real size 512): unused 0 usage 512 / 512 (100 %) <-- 0x200c0950 PD_C1 (real size 1024): unused 360 usage 664 / 1024 (64 %) 0x200c0868 PD_C0 (real size 1024): unused 376 usage 648 / 1024 (63 %) 0x200c0780 KEYSCAN (real size 512): unused 88 usage 424 / 512 (82 %) 0x200c0698 POWERBTN (real size 512): unused 0 usage 512 / 512 (100 %) <-- 0x200c05b0 KEYPROTO (real size 512): unused 248 usage 264 / 512 (51 %) 0x200c04c8 HOSTCMD (real size 512): unused 0 usage 512 / 512 (100 %) <-- 0x200c03e0 CHIPSET (real size 512): unused 0 usage 512 / 512 (100 %) <-- 0x200c02f8 CHARGER (real size 1024): unused 504 usage 520 / 1024 (50 %) 0x200c0210 USB_CHG_P1 (real size 1024): unused 608 usage 416 / 1024 (40 %) 0x200c0128 USB_CHG_P0 (real size 1024): unused 608 usage 416 / 1024 (40 %) 0x200c0040 CHG_RAMP (real size 512): unused 80 usage 432 / 512 (84 %) 0x200c19a8 workqueue (real size 1024): unused 536 usage 488 / 1024 (47 %) 0x200c18d8 shell_uart (real size 2048): unused 1072 usage 976 / 2048 (47 %) 0x200c1820 logging (real size 768): unused 544 usage 224 / 768 (29 %) 0x200c2ef8 idle 00 (real size 320): unused 256 usage 64 / 320 (20 %) 0x200c8c90 IRQ 00 (real size 2048): unused 1584 usage 464 / 2048 (22 %) Bringing them up to 1024 bytes, new stacks: 0x200c0a38 PD_INT_C0 (real size 1024): unused 480 usage 544 / 1024 (53 %) 0x200c0698 POWERBTN (real size 1024): unused 488 usage 536 / 1024 (52 %) 0x200c03e0 CHIPSET (real size 1024): unused 512 usage 512 / 1024 (50 %) 0x200c02f8 CHARGER (real size 1024): unused 488 usage 536 / 1024 (52 %) BUG=none BRANCH=none TEST=ran kernel stacks again, nothing at the limit Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com> Change-Id: I8f57ddba0891fec11119814f3a40c4c544a0b092 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2657635 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: volteer: add forgotten power sequencing interruptJack Rosenthal2021-01-281-0/+1
| | | | | | | | | | | | | | | | | Doesn't appear to fix things, but clears an error message. > gpio_shim: No interrupt defined for GPIO PG_EC_DSW_PWROK BUG=none BRANCH=none TEST=message goes away Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: Ic4d2c06376c75b4c4e03eb70824685ca47f00bb5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2657438 Commit-Queue: Keith Short <keithshort@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
* Volteer: Add support for FRS to C1Eric Herrmann2021-01-282-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | Add support to C1, assign the gpio to put the PPC in FRS mode and add the config options. Volteer boards need the SYV682B rework to support FRS, but this will not break existing boards. FRS will be enabled but fail, and enter ErrorRecovery, enter Unattached.SNK, or successfully FRS depending on the situation. Volteer HW can supply 3A per port, so changes to reserve the FRS current aren't needed to enable it on Volteer. BUG=b:148144711 TEST=Check that FRS is functional. FRS devices should not re-enumerate after adapter power is removed. Test with the SYV682B and using both the PS8815 and RT1715 TCPCs. BRANCH=none Change-Id: I7a599f1c350529d910a331f1ebc78ab41ff44a24 Signed-off-by: Eric Herrmann <eherrmann@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2057495 Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* zephyr: Volteer: Enable some battery configsDawid Niedzwiecki2021-01-281-0/+3
| | | | | | | | | | | | | | | | | | | | There are 3 battery configs present for Volteer board in ECOS based firmware: -CONFIG_PLATFORM_EC_BATTERY_CUT_OFF -CONFIG_PLATFORM_EC_BATTERY_HW_PRESENT_CUSTOM -CONFIG_PLATFORM_EC_BATTERY_REVIVE_DISCONNECT so enable them also on Zephyr. BUG=b:175248556 BRANCH=none TEST=Build Volteer with the configs enabled Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com> Change-Id: I0022881c61eb3c9c3550f3a9a7e05f9077b55a2e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2648681 Commit-Queue: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: Add missing battery configDawid Niedzwiecki2021-01-282-0/+40
| | | | | | | | | | | | | | | | | | | There are 3 battery configs missing for Zephyr: -CONFIG_PLATFORM_EC_BATTERY_CUT_OFF -CONFIG_PLATFORM_EC_BATTERY_HW_PRESENT_CUSTOM -CONFIG_PLATFORM_EC_BATTERY_REVIVE_DISCONNECT Add them to the Kconfig.battery. BUG=b:177604307 BRANCH=none TEST=Build Zephyr with the configs enabled Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com> Change-Id: I4e3c834470b9f4977b3f779b4246868feaea4bd7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2645092 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Commit-Queue: Simon Glass <sjg@chromium.org>
* zephyr: add an option for enabling bringup and plumb to zmake flagJack Rosenthal2021-01-274-1/+31
| | | | | | | | | | | | | | | | | | Add a Kconfig option for enabling the CONFIG_BRINGUP platform/ec option: CONFIG_PLATFORM_EC_BRINGUP, and make a command line flag in "zmake configure" for toggling this on: --bringup. BUG=none BRANCH=none TEST=zmake configure -B ~/volteer-build -b --bringup zephyr/projects/volteer flash on volteer observe bringup functions (siglog, power on delay, etc) Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: Ib915abba7c5777aa1d9391b55b1f912e53a5fdf5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2631353 Commit-Queue: Yuval Peress <peress@chromium.org> Reviewed-by: Yuval Peress <peress@chromium.org>
* zephyr: Volteer: Enable some charger configsDawid Niedzwiecki2021-01-271-0/+4
| | | | | | | | | | | | | | | | | | | | There are 4 charger configs present for Volteer board in ECOS based firmware: -CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON -CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON_WITH_AC -CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON_WITH_BATT -CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON so enable them also on Zephyr. BUG=b:175881762 BRANCH=none TEST=Build Volteer with the configs enabled Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com> Change-Id: Iba02e347176367ad7c69fd4d81dac0665ef1a8fb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2652745 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* zephyr: Add missing charger configsDawid Niedzwiecki2021-01-272-0/+77
| | | | | | | | | | | | | | | | | | | There are 3 battery configs missing for Zephyr: -CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON -CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON_WITH_AC -CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON_WITH_BATT -CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON Add them to the Kconfig.usbc BUG=b:177604307 BRANCH=none TEST=Build Volteer board with the configs enabled Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com> Change-Id: I0700138a74f9879caf1c6f259377a376bde45364 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2648487 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* zephyr: npcx: Add drivers for battery-backed RAMYuval Peress2021-01-278-5/+252
| | | | | | | | | | | | | | | | | This change introduces a new driver for the battery backed RAM on the npcx chipset. The API includes the ability to check various status fields as well as reading/writing to the memory. To add this to the devicetree we must use both the `memory` and `status` register names. BRANCH=none BUG=b:174481378 TEST=zmake testall Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I576c3c30d970b2878aee712f6dda3579d0960e76 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2649462
* zephyr: Add support for panic outputJack Rosenthal2021-01-266-6/+155
| | | | | | | | | | | | | | | Add basic panic implementation for Zephyr. Not using any fancy shared or always-on memory for now ... need to resolve how that will be handled later. BUG=b:178011288 BRANCH=none TEST=run various crash commands on volteer, observe output Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: Ia1ce386f738283a2a2b9b60ef7e0bf97f8317837 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2645687
* zephyr: minimal uart_* implementationsJack Rosenthal2021-01-261-0/+24
| | | | | | | | | | | | | | | | Added minimum required uart_* functions for panic to work, using printk as backend. Probably should switch filling-out enough to support uart_buffering.c in the future, requiring switching to Zephyr's UART drivers instead of printk(). BUG=b:178033156,b:178011288 BRANCH=none TEST=compile with panic_output.c Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I2879cd05cd858d13241e6fc1a7f818b6649e4bd6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2649497 Reviewed-by: Keith Short <keithshort@chromium.org>
* volteer: enable MKBP event for ZephyrHyungwoo Yang2021-01-262-0/+5
| | | | | | | | | | | | | | Enable MKBP event for Zephyr on Volteer. BUG=b:173507858 BRANCH=none TEST=make buildall -j8 build volteer on zephyr Signed-off-by: Hyungwoo Yang <hyungwoo.yang@intel.corp-partner.google.com> Change-Id: I0c663f5a0bde8dece09c48a012de8f1903dd82d5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2639856 Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: add MKBP supportHyungwoo Yang2021-01-266-8/+163
| | | | | | | | | | | | | | Add MKBP support to zephyr. BUG=b:173507858 BRANCH=none TEST=make buildall -j8 build volteer on zephyr Signed-off-by: Hyungwoo Yang <hyungwoo.yang@intel.corp-partner.google.com> Change-Id: I9b7d979241b0df5dc0fa5d9741f05dc9875189ab Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2639854 Reviewed-by: Keith Short <keithshort@chromium.org>
* zmake: remove prefer-zephyr-sdk from project configJack Rosenthal2021-01-262-22/+0
| | | | | | | | | | | | | | | No projects set this anymore. BUG=b:178363068 BRANCH=none TEST=zmake testall Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: Ib28017048695a5dbabaead83de49c85363fde665 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2647537 Reviewed-by: Patrick Georgi <pgeorgi@chromium.org> Commit-Queue: Patrick Georgi <pgeorgi@chromium.org> Tested-by: Patrick Georgi <pgeorgi@chromium.org>
* zephyr: kohaku/volteer: unset prefer-zephyr-sdkJack Rosenthal2021-01-262-34/+2
| | | | | | | | | | | | | | | coreboot-sdk is working now, this hack can go away. BUG=b:178363068 BRANCH=none TEST=compile without -t coreboot-sdk, run on device Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: Ifc5b05557ecf623e709bfd2b464648bd24197e1c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2647536 Reviewed-by: Patrick Georgi <pgeorgi@chromium.org> Commit-Queue: Patrick Georgi <pgeorgi@chromium.org> Tested-by: Patrick Georgi <pgeorgi@chromium.org>
* zephyr: Use Chrome EC's libgcc implementation over the compiler'sPatrick Georgi2021-01-263-0/+21
| | | | | | | | | | | | | | | | | | | | | gcc's libgcc is built with a compile time notion of what an architecture's ABI will look like. If that happens to be wrong, you're out of luck. Instead, use our own implementation which, while written in assembly (and as such not as flexible as it could be) is processed with the right set of flags. BUG=b:178363068 BRANCH=none TEST=zephyr boots on kohaku when built with coreboot-sdk. Signed-off-by: Patrick Georgi <pgeorgi@google.com> Change-Id: I6d27bb48478081b6c2ff8927734492282e55e898 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2648666 Tested-by: Patrick Georgi <pgeorgi@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Patrick Georgi <pgeorgi@chromium.org>
* zephyr: volteer: move CONFIG_SHIMMED_TASKSJack Rosenthal2021-01-252-2/+1
| | | | | | | | | | | | | | This was in the board config, which is for hardware configuration. Project configuration needs to go in prj.conf. BUG=none BRANCH=none TEST=compile Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I3c91ca93722b9bc112218ef911bd076e386a762c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2647534 Reviewed-by: Patrick Georgi <pgeorgi@chromium.org>
* zephyr: provide a header for cpu.hJack Rosenthal2021-01-251-0/+14
| | | | | | | | | | | | | | Provide a minimal header for cpu.h, which is used by both panic_output.c and system.c. BUG=b:174481378,b:178011288 BRANCH=none TEST=compiles with panic_output.c Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I16ca7350d58bc392d87a6f0bbf9d6080e607998d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2647951 Reviewed-by: Yuval Peress <peress@chromium.org>
* zephyr: test: update unit tests for zmakePaul Fagerburg2021-01-2515-131/+27
| | | | | | | | | | | | | | | | | Many of the options in CMakeLists.txt and prj.conf are no longer necessary with zmake and Kconfig handling them automatically now. BUG=b:178220157 BRANCH=none TEST=`zmake testall` Signed-off-by: Paul Fagerburg <pfagerburg@google.com> Change-Id: I845f42c4b51214f28ab7771734232fec763c04f4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2645696 Commit-Queue: Paul Fagerburg <pfagerburg@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org> Tested-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: test: provide Kconfig defaults for testsPaul Fagerburg2021-01-252-0/+16
| | | | | | | | | | | | | | | | | | When we're building a unit test, provide defaults for many of the hardware options that don't need to be included in a unit test, or have to be there for the linker's sake but aren't actually used. BUG=b:178220157 BRANCH=none TEST=`zmake testall` Signed-off-by: Paul Fagerburg <pfagerburg@google.com> Change-Id: Iaab2a3a3a8175e7e08099467947cf183b707cef6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2645695 Commit-Queue: Paul Fagerburg <pfagerburg@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org> Tested-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: volteer: redefine the flash node with the correct unitFabio Baltieri2021-01-231-8/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes the build warning: Zmake/ERROR: warning: unit address and first address in 'reg' (0x10070000) don't match for /flash@10090000 Caused by the flash memory node having a different unit and mem start, introduced in 50cfda251. Does not change anything in practice but it triggers a warning in the device tree compile phase. Looking at the code, it seems like we could potentially just suppress the check and warning entirely [1], but that is normally a good warning to catch dts misconfigurations, and the fix is easy enough as redefining the whole node and deleting the old one. [1] https://github.com/zephyrproject-rtos/zephyr/blob/a8d3c8e142e2a4a8ec9fb52bf0aa42ee2c7fd7cc/scripts/dts/gen_defines.py#L53-L55 BUG=none BRANCH=none TEST=warning is gone, did a full readelf -a diff of the two binaries, they match TEST=zmake testall Change-Id: Iab64c0219933c83f6b52789fc00b525864c543f8 Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2645126 Reviewed-by: Simon Glass <sjg@chromium.org> Commit-Queue: Simon Glass <sjg@chromium.org>
* zephyr: volteer: make compiling with features disabled easierJack Rosenthal2021-01-232-38/+57
| | | | | | | | | | | | | | | | | | | Many of the board configuration files depend on certain Kconfig features, but this dependency was not reflected in the CMakeLists.txt or the interrupts we enable. This allows compiling with USB-C, CBI, charging, battery, or power sequencing disabled, which is useful as a debugging technique to see if one feature is interfering with another. BUG=none BRANCH=none TEST=compile with CBI, USB-C, and battery disabled, clean compile and things work Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I687805d9649badb15d1f2d099f41521f8da10197 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2645082
* zephyr: Add support for EC_CMD_GET_PROTOCOL_INFO in eSPISimon Glass2021-01-231-0/+18
| | | | | | | | | | | | | | | With ECOS this is defined in the lpc driver. Do the same for Zephyr, but put it in the shim, since the driver itself is on the Zephyr side. BUG=b:177604307 BRANCH=none TEST=build volteer for zephyr (see that the new code is included) make BOARD=volteer -j8 Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I7e3487a450fa3408aa9acc0e5b31b3af7080c8cd Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2645077 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* test: port accel_cal to ZtestPaul Fagerburg2021-01-224-0/+64
| | | | | | | | | | | | | | | BUG=b:172240633 BRANCH=none TEST=build for both EC and Ztest: `TEST_LIST_HOST=accel_cal make runhosttests` `zmake configure --test -B build/accel_cal zephyr/test/accel_cal` Signed-off-by: Paul Fagerburg <pfagerburg@google.com> Change-Id: Ie787403b36d775d4185cafad8ca134561a97794b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2645198 Tested-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Paul Fagerburg <pfagerburg@chromium.org>
* volteer: Add a license header to prj.confSimon Glass2021-01-221-0/+4
| | | | | | | | | | | | | | | | | This file does not currently have a license header. There is no technical reason why it cannot and the upload check requires it. So add one. BUG=b:178099673 BRANCH=none TEST=build volteer for zephyr make BOARD=volteer -j8 Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: Ia77b3b1fcca83857a09413515e3912f59b14ad92 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2643620 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: Add support for CONFIG_POWER_BUTTON/X86Simon Glass2021-01-221-0/+10
| | | | | | | | | | | | | | | | These options do not seem to be needed for correct operation since there are no #ifdefs that use them. Still, we should add them for completeness and in case something changes. BUG=b:177604307 BRANCH=none TEST=build volteer for zephyr make BOARD=volteer -j8 Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I9afe5af942a6001b3dc7b90fa6f53222e122d7f3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2643618 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: Add support for CMD_AP_RESET_LOGSimon Glass2021-01-224-0/+38
| | | | | | | | | | | | | | | | Add the options for this along with the the host command that presses it into service. BUG=b:178104134 BRANCH=none TEST=build for zephyr See that host command 121 is processed without error now: 21-01-21 12:14:50.829 [7.981900 HC 0x121] Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I63b8586a6e2065cbfba8de81d3690cd2f7082c9a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2643617 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: Add support for CHIPSET_RESET_HOOKSimon Glass2021-01-223-0/+43
| | | | | | | | | | | | | | | | | Add the options for this and call the hook when enabled. We could avoid the #ifdef by always having espi_reset_handler(). I'm not sure if there is a better way. BUG=b:178104134 BRANCH=none TEST=build for zephyr not sure how to test this feature? Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I68d15bb112bc708af6f65befd08f05cb6bc209e0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2642891 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: volteer: Configure charge VBUS measurementAbe Levkoy2021-01-221-1/+1
| | | | | | | | | | | | | | | | | | The ISL9241 can measure VBUS. Define CONFIG_PLATFORM_EC_USB_PD_VBUS_MEASURE_CHARGER instead of CONFIG_PLATFORM_EC_USB_PD_VBUS_MEASURE_NOT_PRESENT. BUG=b:178102402 TEST=zmake build BRANCH=none Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: Id10145cece71ca64c8a3b70167dcadf2d1fe4435 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2645075 Tested-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: add bmi260, bma2x2,and tcs3400 supportHyungwoo Yang2021-01-224-1/+56
| | | | | | | | | | | | | | Add BMI260, BMA2x2, and TCS3400 support to zephyr. BUG=b:173508071,b:173508128,b:173507878 BRANCH=none TEST=make buildall -j8 build volteer on zephyr Signed-off-by: Hyungwoo Yang <hyungwoo.yang@intel.corp-partner.google.com> Change-Id: Ibc22ed08b4f6db6cf70e3a62c3d16ef750e69de2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2639733 Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: add motion sense supportHyungwoo Yang2021-01-228-1/+219
| | | | | | | | | | | | | | | | | | | Add support for motion sense in zephyr. This change adds basic functions for motion sense task to do meaningful work. sensor_map.h included by board.h will be used to get board specific sensor configuration. BUG=b:173507858 BRANCH=none TEST=make buildall -j8 build volteer on zephyr Signed-off-by: Hyungwoo Yang <hyungwoo.yang@intel.corp-partner.google.com> Change-Id: I906316d2e97428cf46b9a15071666c8e3b039b18 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2638909 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org> Tested-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: Add support for BOARD_RESET_AFTER_POWER_ONSimon Glass2021-01-222-0/+14
| | | | | | | | | | | | | | Add the options for this. The implementation is TBD. BUG=b:178101173 BRANCH=none TEST=build for zephyr no other action since the feature is not fully implemented Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I628e71d3f048b8069e178800ae4cb2690c35ba9a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2642890 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* volteer: Move x86 power info into a separate fileSimon Glass2021-01-223-42/+6
| | | | | | | | | | | | | | | Move this out of the baseboard file into a new power.c file so that Zephyr can use it, instead of duplicating the same code separately. BUG=b:173787365 BRANCH=none TEST=make BOARD=volteer build zephyr on volteer Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: If67909ecbf2a44e7f09dbfe401f8f08739f55252 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2631099 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: Add support for CPU throttlingSimon Glass2021-01-223-0/+56
| | | | | | | | | | | | | | Add the required Kconfig options to allow this code to be built for Zephyr. Update the mutex since Zephyr needs this to be inited. BUG=b:173787365 BRANCH=none TEST=make BOARD=volteer build zephyr on volteer Change-Id: Ib25808faf82b3f1b2f426ad5f09acb37f1b79d65 Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2631100
* zephyr: volteer: enable S0ixJack Rosenthal2021-01-221-0/+1
| | | | | | | | | | | | | Enable S0ix Kconfig option. BUG=b:177949550 BRANCH=none TEST=power sequence volteer Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I9d301f8808a1859d25efb80ca9ef2ac3bd0c37eb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2643599 Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: enable power sequencing for kohakuJack Rosenthal2021-01-222-1/+53
| | | | | | | | | | | | | | | | | | | | | | | | | This adds gpio definitions and enables power sequencing for kohaku. Right now power sequencing makes it to S0 and we start getting some port 80 writes, but we fail at some point after then with some host command errors. They look to be similar to some of the issues volteer is having. See log here if interested: https://paste.googleplex.com/6055863094607872 So submitting this as good incremental progress, even if we can't get AP fully booted yet. BUG=b:177609422 BRANCH=none TEST=on kohaku, make it to S0 with host command errors (see above) Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I9dbdd9837a2c4864b341b45626e4a1d5da101d8d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2633822 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: power: add shim option for S0ixJack Rosenthal2021-01-223-0/+27
| | | | | | | | | | | | | Add a shim option for enabling S0ix and host sleep tracking. BUG=b:177609422 BRANCH=none TEST=power sequence kohaku Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I2a41ec509339879c6a372bdc7d2d6d2e2bb651ae Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2633821 Reviewed-by: Simon Glass <sjg@chromium.org>
* config: Provide default VCONN Swap delayAbe Levkoy2021-01-221-1/+0
| | | | | | | | | | | | | | | | | Almost every relevant board copy-pastes 5000 us. Make that the default and get rid of the redundant definitions. This is the approximate result of this command: find . -type f -name *.h | xargs sed -i -E \ '/#define CONFIG_USBC_VCONN_SWAP_DELAY_US[[:space:]]+5000[[:space:]]/d' BUG=b:144165680 TEST=make buildall BRANCH=none Change-Id: Ife86f9752971abcd7ab5ad5a5e607eb2ccbde2ba Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2628132 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* config: Make VCONN Swap delay a documented optionAbe Levkoy2021-01-221-1/+1
| | | | | | | | | | | | | | | | | | | | | Replace PD_VCONN_SWAP_DELAY with CONFIG_USBC_VCONN_SWAP_DELAY_US. This is the approximate result of the following command, run from platform/ec: find . -type f -\( -name '*.c' -o -name '*.h' -\) | \ xargs sed -iE 's/PD_VCONN_SWAP_DELAY/CONFIG_USBC_VCONN_SWAP_DELAY/g' Fix some latent formatting errors in usb_pd_protocol.c, because they were preventing pre-upload hooks from passing. BUG=b:144165680 TEST=make buildall BRANCH=none Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: Icaf3b309c08fdcd162e960cf5dc88185016b5d2d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2628131 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
* reland: zephyr: Update hooks shim to match ECOSSimon Glass2021-01-212-7/+16
| | | | | | | | | | | | | | | | | | | | | | At present the hooks declaration in Zephyr doesn't use const but does use static. This makes it incompatible with ECOS, even if it might be more strictly correct. Update the hook to fix this so that we can build the missing USB code. Typically Zephyr would put const data in the rodata section but that is write-protected with native_posix. So force it into .data instead. BUG=b:175434113 BRANCH=none TEST=make BOARD=volteer build zephyr on volteer Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2611895 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I470c9a6b2f905be9f512b0d555f33f0998412975 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2617377
* common:test: refactor test_util.h to accommodate ZephyrYuval Peress2021-01-211-34/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change refactors test functionality in test_util.h to better accomomdate zTests. This is done by: * Removing the shim version of test_util.h. This was causing a conflict that made it harder to tell what's being used. This involved migrating some needed code over: - Defining different TASK_PARAMS. - Defining test_pass for Zephyr tests. * Creating a macro (DECLARE_EC_TEST) that will automatically handle creating the individual test functions for both platform and Zephyr tests. * Creating a macro (TEST_MAIN) that will automatically handle creating the main test entry function. This use to be test_main(void) for Zephyr and run_test(int, char**) for platform/ec. To do this we'll be removing the int, char** arguments from platform/ec. This may result in some tests having to be refactored, but overall should improve the test codebase as tests should remain deterministic (i.e. not depend on any outside arguments/parameters). * Creating some common ztest_ function/macros that will allow writing platform/ec tests in a zephyr like style. see test/base32.c for an example. * Update the type of __shared_mem_buf to match Zephyr. This was causing an issue now with the full test_util.h in zephyr/test/system/. BRANCH=none BUG=b:168032590 TEST=make runhosttests TEST=zmake configure --test -B build/host/base32 zephyr/test/base32 Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I72173a3e94c7df09a2966e7ffeb9f5668d030f29 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2634401 Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org>
* volteer: i2c: rename i2c-keys node to named-i2c-portsFabio Baltieri2021-01-215-8/+8
| | | | | | | | | | | | | | Rename the node definition and instance to named-i2c-ports. This matches the node name and other references in the code. BUG=none TEST=zmake testall BRANCH=none Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com> Change-Id: I426cc29073d1725c208e151d0deeb9d5214bf7ac Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2638253 Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: gpio: use nodelabel named gpiosFabio Baltieri2021-01-202-2/+13
| | | | | | | | | | | | | | | | Defines a NAMED_GPIO_NODELABEL macro to get a named-gpio enum value from a named-gpio phandle and use it to redefine the jhl8040r pins from the i2c node rather than pointing at the named-gpio node directly. BUG=b:176505554 TEST=build and check generated files BRANCH=none Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com> Change-Id: I9f92e1ad0b98bc3fc142dd90625aaaa9b79f114e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2637645 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* volteer: jhl8040r: define and bind reset and ls-en gpiosFabio Baltieri2021-01-202-4/+17
| | | | | | | | | | | | | | | | | | Add a reset and ls-en gpios property to the jhl8040r binding, and instantiate them to the corresponding pins currently used in gpio_map.h. Named pin has to get an explicit label and #gpio-cells to keep the devicetree compiler happy. BUG=b:176505554 TEST=build and check generated files BRANCH=none Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com> Change-Id: I06c7a9576fc33c2fb804f93170c6f64b58e7201b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2637644 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
* dts: binding: add an explicit binding for named-gpiosFabio Baltieri2021-01-203-2/+22
| | | | | | | | | | | | | | | | | | Currently the name-gpios node uses the gpio-keys binding. That is a standard binding used in Zephyr for GPIO keys, as in physical button. This copies the binding over to a dedicated "named-gpios" one, and adds a #gpio-cells property so that we can refer to its nodes from a phandle property of a different node. BUG=none TEST=build and check generated files BRANCH=none Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com> Change-Id: Iadd3465b23b89cfe08c96c4d03479f1e5f8e3c59 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2637643 Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: Add support for vstoreSimon Glass2021-01-203-0/+34
| | | | | | | | | | | | | | | | | | | This is needed for the AP firmware to store a hash during boot. Add it to the build. BUG=b:177686660 BRANCH=none TEST=make BOARD=volteer -j30 boot volteer and see that command 4b is handled without error: [1.540100 HC 0x4b] [1.540800 HC 0x49] Change-Id: Idb4a5b602995adb3911906f5b09d0bccf8cf8d46 Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2633653 Tested-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: get the retimer i2c address from the device treeFabio Baltieri2021-01-191-2/+2
| | | | | | | | | | | | | | | | Remove the hardcoded one, read it from the device tree instead. This is using an explicit label, ideally we would enumerate based on the "compatible" property, but there's a bit more work to do for that. BUG=b:176505554 TEST=build and checked the preprocessor output manually BRANCH=none Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com> Change-Id: I20d14adb252b08f88d5335c5614f341a81488b52 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2627281 Reviewed-by: Keith Short <keithshort@chromium.org>
* volteer: dts: define and instantiate the retimer device on the i2c mix busFabio Baltieri2021-01-192-0/+21
| | | | | | | | | | | | | | | | | | Define a device tree binding for the JHL8040R retimer and instantiate it on the i2c3_0 (USB_1_MIX) bus. Adding a label so that it can be retrieved directly with a DT_NODELABEL directly until the driver is ported to enumerate based on the compatible property. BUG=b:176505554 TEST=build and checked zephyr.dts manually BRANCH=none Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com> Change-Id: I29a627774534965e9cc122c03f07ac7ce72dcd04 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2633992 Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: Increase volteer image sizeKeith Short2021-01-193-9/+15
| | | | | | | | | | | | | | | | | | | | | | Change the Volteer part number to the NPCX797FC for Zephyr builds. [226/231] Linking C executable zephyr/zephyr_prebuilt.elf Memory region Used Size Region Size %age Used FLASH: 172844 B 256 KB 65.93% SRAM: 35104 B 64 KB 53.56% IDT_LIST: 504 B 2 KB 24.61% [231/231] Linking C executable zephyr/zephyr.elf BUG=none BRANCH=none TEST=make buildall, zmake testall TEST=Verify ELF file locates rom_start to 0x10070000 and boot zephyr on Volteer Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I8e81c9e939b890112dd2530bfc20df36077848c8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2638355 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>