summaryrefslogtreecommitdiff
path: root/zephyr
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* zephyr: Shim the DECLARE_HOST_COMMANDWealian Liao2021-01-193-7/+95
| | | | | | | | | | | | | | | | | | | | Shim the DECLARE_HOST_COMMAND so that host commands can be declared and found. BUG=b:177065174, b:172678200 BRANCH=none TEST=build & boot EC for Volteer 0x0d & 0xa4 don't have error message. 21-01-11 16:42:09.226 [1.528500 HC 0x0d] 21-01-11 16:42:09.227 [1.532100 HC 0xa4] Signed-off-by: Wealian Liao <whliao@nuvoton.corp-partner.google.com> Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: Ief3b5768715dcc164bcb25ae0d1c8de749514f92 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2620729 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org> Tested-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: Enable all the USB-C host commandsSimon Glass2021-01-161-1/+2
| | | | | | | | | | | | | | | | | | | A single Kconfig is actually supposed to control two sets of host commands. The files have similar names but different commands. This was missed in the initial commit. Add the other file. BUG=b:175434113 BRANCH=none TEST=make BOARD=volteer -j30 With a zephyr-chrome CL, build volteer on zephyr Change-Id: I3044a5b0e8516d97108ae11bea4910bffe215e06 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2633825 Commit-Queue: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: Update Kconfig names for timer commandsSimon Glass2021-01-162-9/+9
| | | | | | | | | | | | | | | At present the timer options use a different naming convention from other console commands. Update them so they are consistent. BUG=b:176449230 BRANCH=none TEST=ninja -C /tmp/z/vol/build-ro menuconfig Check that each command looks correct Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I01c7c6b4aa3683c451265211a5e27749cf431364 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2633652 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: drop zephyr-chrome moduleJack Rosenthal2021-01-165-10/+5
| | | | | | | | | | | | | | | Remove zephyr-chrome module from zmake and enable the last directory in our CMakeLists.txt (drivers). BUG=b:177003034 BRANCH=none TEST=zmake testall Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I551f59e6ce118d2939111126151984b65ce08c91 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2633655 Commit-Queue: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
* volteer: Move USB-A charging info to usbc_configSimon Glass2021-01-161-0/+1
| | | | | | | | | | | | | | | | | | | Move this information into a file that can be built by Zephyr, so that it can enable USB-A charging. Note: This is not related to USB-C. Should we create a charger.c file in board/volteer? BUG=b:175434113 BRANCH=none TEST=make BOARD=volteer -j30 With a zephyr-chrome CL, build volteer on zephyr Type 'usbchargemode 0 on' on volteer and see it start charging the phone Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I6658ebba1e473cafed2c8ae05e4013207f26ef3d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2631098 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: Add options for USB4 Power DeliverySimon Glass2021-01-163-0/+32
| | | | | | | | | | | | | | | | Allow enabling USB4 Power Delivery features as well as Thunderbolt 3 compatibility mode, which is available with USB4. 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: I19dfeaa5dfadcddbdb27e67ff40a70b92c594cf1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2631096 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>