summaryrefslogtreecommitdiff
path: root/zephyr/shim/include
Commit message (Collapse)AuthorAgeFilesLines
* common/i2c: Implement i2cspeed console commandCaveh Jalali2021-09-281-0/+5
| | | | | | | | | | | | | | | | | | This adds the "i2cspeed port [speed]" console command. If only the port number is given, then the current port bus speed is reported. With 2 arguments, the port bus speed is changed. Valid speeds are 100, 400, 1000 and the unit is kHz. BRANCH=none BUG=b:201039003 TEST=with follow-on patches, switched I2C bus speed between 400 kHz and 1 MHz. Change-Id: I7ca6b2c7a8fd9abe8e8ec77e4d1702529b297fe8 Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3181504 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* zephyr: drivers: thermistors are device tree nodesAaron Massey2021-09-241-20/+0
| | | | | | | | | | | | | | | | | | | Thermistor drivers now query the device tree for configuration. Thermistor tests have been updated to be parameterized on all thermistors enabled in the device tree. BRANCH=none BUG=b:184374937 TEST= 1) zmake testall 2) make runhosttests Cq-Depend: chromium:3161332 Signed-off-by: Aaron Massey <aaronmassey@chromium.org> Change-Id: Ic5330cd5c33e79e192428ca857651de9a225856e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3133812 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Tested-by: Aaron Massey <aaronmassey@google.com> Commit-Queue: Aaron Massey <aaronmassey@google.com>
* zephyr: shim: atomic_clear_bits should return a valueDenis Brockus2021-09-211-2/+2
| | | | | | | | | | | | | | | | | | | | | All of the other atomic operations return an atomic_val_t value. This should be so for atomic_clear_bits as well. The standard return value is the field value prior to applying the operation to it. BUG=b:141363146 BRANCH=none TEST=zmake configure -b $PROJ_HAYATO Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: I7a64fddb1174e57ed0e04ef1502310d8494e860d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3173092 Auto-Submit: Denis Brockus <dbrockus@chromium.org> Tested-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: add support for I2C debuggingKeith Short2021-09-151-0/+10
| | | | | | | | | | | | | | | | | | | Add support for CONFIG_I2C_DEBUG and CONFIG_I2C_DEBUG_PASSTHRU options to zephyr. BUG=none BRANCH=none TEST=zmake testall TEST=Add CONFIG_PLATFORM_EC_I2C_DEBUG=y on herobrine, verify "i2ctrace" command is available and functional. TEST=Add CONFIG_PLATFORM_EC_I2C_DEBUG_PASSTHRU=y on herobrine, verify I2C passthru messages shown during TCPC firmware sync. Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: Ic2d9977af4fa707dab4fdaff332fbcc34491c5fe Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3163211 Commit-Queue: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* system: Add CrOS FWID to version outputRob Barnes2021-09-141-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | EC version does not follow the the AP and OS version. This causes confusion during development. This change augments the EC version output to include the CrOS FWID when available. The CrOS FWID will be missing when the CrOS EC is built outside of cros_sdk. When CrOS FWID is missing 'CROS_FWID_MISSING' will be used. Zephyr/zmake support will be added later, CROS_FWID32 is set to 'CROS_FWID_MISSING' in zephyr builds until then. BUG=b:188073399 TEST=version 21-05-20 16:43:18.627 Chip: Nuvoton NPCX993F A.00160101 21-05-20 16:43:18.631 Board: 1 21-05-20 16:43:18.631 RO: guybrush_v2.0.8770+f47439f75 21-05-20 16:43:18.634 guybrush_13983.0.21_05_20 21-05-20 16:43:18.639 RW_A: * guybrush_v2.0.8770+f47439f75 21-05-20 16:43:18.641 * guybrush_13983.0.21_05_20 21-05-20 16:43:18.644 RW_B: guybrush_v2.0.8770+f47439f75 21-05-20 16:43:18.644 guybrush_13983.0.21_05_20 21-05-20 16:43:18.647 Build: guybrush_v2.0.8770+f47439f75 21-05-20 16:43:18.651 guybrush_13983.0.21_05_20 2021-05-20 21-05-20 16:43:18.657 16:31:19 robbarnes@robbarnes0 ectool version RO version: guybrush_v2.0.8770+f47439f75 RO cros fwid: guybrush_13983.0.21_05_20 RW version: guybrush_v2.0.8770+f47439f75 RW cros fwid: guybrush_13983.0.21_05_20 Firmware copy: RO Build info: guybrush_v2.0.8770+f47439f75 guybrush_13983.0.21_05_20 2021-05-20 16:31:19 robbarnes@robbarnes0 Tool version: 1.1.9999-f47439f @robbarnes0 BRANCH=None Signed-off-by: Rob Barnes <robbarnes@google.com> Change-Id: Ief0a0c6e9d35edc72ac2d4780ee203be41d7305f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2894145 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* zephyr: shim: set pwm_led data from device treeFabio Baltieri2021-09-101-2/+2
| | | | | | | | | | | | | | | | Set up the pwm_leds data from the device tree, gets rid of most static map defines and sets CONFIG_LED_PWM_COUNT automatically. BRANCH=none BUG=b:177452529 TEST=build and run on volteer TEST=compared the built up pwm_leds structure with gdb Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com> Change-Id: Ib41faf86ae018f5a1ed8a1c96c4b6ec081e175d9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3154256 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Yuval Peress <peress@google.com>
* zephyr: add missing charger KconfigMichał Barnaś2021-09-081-0/+2
| | | | | | | | | | | | | | | Add CHARGER_MIN_BAT_PCT_IMBALANCED_POWER_ON to Kconfig BRANCH=main BUG=b:183544739 TEST=Define added configs to prj.conf file and verify that compilation takes them into account. Change-Id: I7672315a6938102878b5b3b87a9dcf96b0a71d46 Signed-off-by: Michał Barnaś <mb@semihalf.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3141561 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* zephyr: add missing battery KconfigsMichał Barnaś2021-09-081-0/+19
| | | | | | | | | | | | | | | | | | | | | | Add missing Kconfigs for: - PLATFORM_EC_BATTERY_CRITICAL_SHUTDOWN_CUT_OFF - PLATFORM_EC_BATTERY_CHECK_CHARGE_TEMP_LIMITS - PLATFORM_EC_BATTERY_MEASURE_IMBALANCE - PLATFORM_EC_BATTERY_MAX_IMBALANCE_MV Change help text in battery yamls to use Kconfigs instead of legacy CONFIGs BRANCH=main BUG=b:183544739 TEST=Define added configs to prj.conf file and verify that compilation takes them into account. Change-Id: I01716c1515350550c18bbfd4944638034a25c7b5 Signed-off-by: Michał Barnaś <mb@semihalf.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3141598 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* zephyr: Replace DT_ENUM_TOKEN with DT_STRING_TOKENJack Rosenthal2021-09-075-6/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In Zephyr v2.7, DT_ENUM_TOKEN is deprecated in favor of DT_STRING_TOKEN. Additionally, DT_ENUM_UPPER_TOKEN is deprecated in favor of DT_STRING_UPPER_TOKEN. See the v2.7 release notes for details: https://docs.zephyrproject.org/latest/releases/release-notes-2.7.html Since we backported the DT_STRING_* macros to our v2.6 branch, let's switch to them ahead of time to prepare for the v2.7 uprev. Note: the DT_STRING_* macros are compatible with Zephyr's device tree enums, but also allow non-enum properties to be used in the same fashion. This commit does the bare minimum for compatibility with v2.7, i.e., just swap the macros without dropping enum properties anywhere. We should investigate whether we want to continue using the enum properties or abandon some of them for any string in the future. BUG=b:198824039 BRANCH=none TEST=zmake testall Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I1efd8f99bc7d93504c0ab94510406cd36ad24cd3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3144536 Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: remove duplicated CONFIG_PLATFORM_EC_BATTERY_REVIVE_DISCONNECTMichał Barnaś2021-09-031-5/+0
| | | | | | | | | | | | | | Remove duplicated Kconfig option for EC_BATTERY_REVIVE_DISCONNECT BRANCH=main BUG=none TEST=Verify that this Kconfig option still exists Change-Id: I02d8ef4912cff8c4388b2490c73e06b5bffd151a Signed-off-by: Michał Barnaś <mb@semihalf.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3141597 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* zephyr: add batteries to device treeMichał Barnaś2021-09-031-2/+13
| | | | | | | | | | | | | | | | | | | | | | This commit adds possibility to define board's batteries in device tree. Default battery is defined by adding "default_battery" as node's label. It also adds common batteries definitions that can be used using compatible string. If no 'batteries' node is defined in device tree, custom board's logic must be used and old "named-batteries" should be defined. BRANCH=main BUG=b:183544739 TEST=This commit shouldn't change behaviour of any build. Compiling and flashing CrOS EC and Zephyr should work without problems. Change-Id: I94f0121f45eb061f1358fadbcd7d8006c08b0bea Signed-off-by: Michał Barnaś <mb@semihalf.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3107385 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* zephyr: Add test runner task idTomasz Michalec2021-09-022-0/+11
| | | | | | | | | | | | | | | | | Code calling task_get_current() requires to return from this function valid task ID. To test this code, new TASK_ID_TEST_RUNNER is introduced. Test can set current thread as test runner and guarantee that task_get_current() return valid task ID. BUG=b:184856919 BRANCH=none TEST=none Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: Id5470e5337ab2419aad07f0f22de5f1576e870c3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3110086 Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* zephyr: Add Kconfig options for PS8xxx TCPCKeith Short2021-09-021-0/+9
| | | | | | | | | | | | | | | | | | Add Kconfig options CONFIG_PLATFORM_EC_USB_PD_TCPM_PS8805 and CONFIG_PLATFORM_EC_USB_PD_TCPM_PS8815 to enable/disable the workaround for PS8805/PS8815 firmware reporting the incorrect device ID. BUG=none BRANCH=none TEST=zmake testall TEST=On herobrine, verify that "ectool pdchipinfo 0" reports a device ID 0x02. Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I16367ae5276e974671b034294275104d5831df21 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3140325 Commit-Queue: Wai-Hong Tam <waihong@google.com> Reviewed-by: Wai-Hong Tam <waihong@google.com>
* usbpd: support dynamic PDO selectionEric Yilun Lin2021-09-011-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Support dynamic PDO selection CONFIG_USB_PD_DPS. This config controls the charging voltage and power according to the input power and battery configuration. DPS would continuously evaluate the system load and current charging voltage, and decide a new one by below: 1. If the PDO can fulfill system desired power. 2. If the PDO is efficient for the battery configuration. To detect if the system load cannot be fulfilled by the current PDO, it checks: 1. if the input current closes to the PDO current limit. 2. if the input power closes to the PDO maximum power. To detect if the system load can be fulfilled by a more efficient PDO, it checks: - if the voltage of a new PDO is closer to the battery voltage than the current PDO, and the power is able fulfill the system load. BUG=b:169532537 TEST=1. tested on asurada, the charging voltage is able to switch to different PDOs under different system loads 2. tested that the DPS is able to switch charge port (e.g. C1 12V -> C0 9V) based on the provided PDOs. BRANCH=asurada Change-Id: I7c7706b331dc0d4f8ac68569dc7ed852fc9308e3 Signed-off-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2897064 Tested-by: Eric Yilun Lin <yllin@google.com> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Eric Yilun Lin <yllin@google.com>
* builtin: Add math.hTom Hughes2021-08-311-1/+1
| | | | | | | | | | | | | | | | | | | | Add a "math.h" to "builtin" and rename "math.h" in the "core" directories to "fpu.h". "builtin" is the directory containing headers that mirror those in the standard library and is used for device builds. The host builds exclude the "builtin" directory and use the standard library. Without this change, building host tools such as "ectool" and attempting to include "math.h" would result in incorrectly picking up the "math.h" from the device "core" directory, not the standard library version. BRANCH=none BUG=b:144959033 TEST=make buildall Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: Id6b2df42cb0ff5ec2cfc07aa8f29861da6804bdf Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3130625 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* charge_manager: board specific callback to get vbus voltageSue Chen2021-08-271-0/+3
| | | | | | | | | | | | | | | | Add board_get_vbus_voltage to get vbus voltage by board, for ADC_VBUS maybe is only for one typec port when the DUT supports multiple typec. BUG=b:196001868 BRANCH=none TEST=show correct C1 vbus voltage on tomato Signed-off-by: Sue Chen <sue.chen@quanta.corp-partner.google.com> Change-Id: Ia567ec3bddf4f62a08c9902b4f0721783f2c07ff Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3084403 Reviewed-by: Ting Shen <phoenixshen@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org>
* adc: Allow runtime config of adc_channelsCaveh Jalali2021-08-271-0/+5
| | | | | | | | | | | | | | | This adds the CONFIG_ADC_CHANNELS_RUNTIME_CONFIG config option to allow the adc_channels array to be tweaked at runtime. BRANCH=none BUG=b:183452273,b:181271666 TEST=buildall passes Change-Id: I1241012b6e36c19baa7fe80853a6c6de4affeefa Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3116990 Reviewed-by: Boris Mittelberg <bmbm@google.com> Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: shim: map correct PLATFORM_EC_* to CONFIG_Denis Brockus2021-08-191-6/+6
| | | | | | | | | | | | | | | | Was using the values of invalid PLATFORM_EC_ defines BUG=none BRANCH=none TEST=zmake configure -b $PROJ_HAYATO Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: I86ab2ff1e1018732e0b4bbaaaebe6786c38cc644 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3105486 Tested-by: Denis Brockus <dbrockus@chromium.org> Auto-Submit: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Yuval Peress <peress@chromium.org> Reviewed-by: Yuval Peress <peress@chromium.org>
* zephyr: Disable console help stringsKeith Short2021-08-181-2/+11
| | | | | | | | | | | | | | | | | | Add support for disabling the console command help strings. With CONFIG_SHELL_HELP=n, 2000 bytes saved on Volteer BUG=none BRANCH=none TEST=zmake testall TEST=Verify console on Volteer with and without CONFIG_SHELL_HELP enabled. Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I2186828f28691182f673851ac27d207b4a4a6f44 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3093492 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: reduce code duplication of console shimKeith Short2021-08-181-21/+30
| | | | | | | | | | | | | | | | | | Change the console command shim to pass in a struct, reducing the amount of duplicated code. This change saves 500 bytes on Volteer BUG=none BRANCH=none TEST=zmake testall TEST=verify console on Volteer Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I2da374b9a3b3b78a3e7b66d5c31f4ed2131aef01 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3093491 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: Add support for CONFIG_KEYBOARD_REFRESH_ROW3Wai-Hong Tam2021-08-181-0/+5
| | | | | | | | | | | | | Add Kconfig option for CONFIG_KEYBOARD_REFRESH_ROW3. BRANCH=None BUG=b:196885613 TEST=zmake testall Change-Id: Idd55e5bc3af4aab95aa9577b49eb3d8eb5e90630 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3102286 Reviewed-by: Keith Short <keithshort@chromium.org>
* driver/amd_stt: Add AMD STT driverRob Barnes2021-08-161-0/+5
| | | | | | | | | | | | | | | | | | Add a driver for writing Skin Temperature Tracking (STT) sensor readings to the SB-RMI interface. STT readings are used to maximize the SOc performance while keeping the skin temperature within specification. BUG=b:176994331 TEST=Build and run on guybrush BRANCH=None Change-Id: If655545158e7dc05946bc67686b1b0b40a40a713 Signed-off-by: Rob Barnes <robbarnes@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3078050 Reviewed-by: Bhanu Prakash Maiya <bhanumaiya@google.com> Reviewed-by: Raul E Rangel <rrangel@chromium.org> Commit-Queue: Raul E Rangel <rrangel@chromium.org>
* driver/sb_rmi: Add AMD SB-RMI driverRob Barnes2021-08-161-0/+5
| | | | | | | | | | | | | | | | | | Add Side-Band Remote Management Interface driver. SB-RMI can be used to manage power limits of the SOC. SB-RMI uses a soft mail box for executing transactions. BUG=b:176994331 TEST=Build BRANCH=None Change-Id: Ie185985e4c8d2c2d915b2ae2447709ddc16adda6 Signed-off-by: Rob Barnes <robbarnes@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3078049 Tested-by: Rob Barnes <robcb85@gmail.com> Commit-Queue: Raul E Rangel <rrangel@chromium.org> Reviewed-by: Fanli Zhou <fanliccc@gmail.com> Reviewed-by: Raul E Rangel <rrangel@chromium.org>
* zephyr: shim: add CONFIG_HOSTCMD_DEBUG shimDenis Brockus2021-08-121-0/+11
| | | | | | | | | | | | | | | BUG=b:195948807 BRANCH=none TEST=zmake configure -b $PROJ_HAYATO Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: I6de387725db11ad00356c7cf47cb9c0e2e109652 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3087619 Tested-by: Denis Brockus <dbrockus@chromium.org> Auto-Submit: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: rename kconfig PLATFORM_EC_VBOOTJack Rosenthal2021-08-111-1/+1
| | | | | | | | | | | | | | | | | | | Rename CONFIG_PLATFORM_EC_VBOOT to CONFIG_PLATFORM_EC_VBOOT_EFS2, since this is what is actually toggled by the config. EFS2 is only a small component of verified boot, and we have many boards which don't actually use it (e.g., trogdor family) for verified boot, making the existing name very confusing. BUG=none BRANCH=none TEST=zmake testall Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I68ea5815b4a001c680fc78196bb7a02815799b52 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3088164 Commit-Queue: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* zephyr: cleanup Zephyr v2.5 ifdefsJack Rosenthal2021-08-111-13/+0
| | | | | | | | | | | | | | We no longer support version 2.5. Drop these obsolete ifdefs. BUG=b:195571108 BRANCH=none TEST=zmake testall Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I85985108bcf175a2756a2f8096b0aa9e3c22fce5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3086368 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com>
* zephyr: cros_kb_raw_npcx: Add output high driver config optionWealian Liao2021-08-111-0/+1
| | | | | | | | | | | | | | | This CL adds a Kconfig option 'CROS_KB_RAW_NPCX_KSO_HIGH_DRIVE' for npcx output buffer high driver function. BUG=none BRANCH=none TEST=zmake testall Signed-off-by: Wealian Liao <whliao@nuvoton.corp-partner.google.com> Change-Id: I91f98581f43ca88991345b2e23ab11e5b99353be Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3077763 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* zephyr: hooks: change priority to uint16_tFabio Baltieri2021-08-101-1/+1
| | | | | | | | | | | | | | | | | Priority field goes from 0 to HOOK_PRIO_LAST, so 16 bits are enough. Switching to a 2 bytes field allows struct zephyr_shim_hook_list to pack up in 12 bytes, saves a bit of ram. BRANCH=none BUG=b:195521227 TEST=build and run on volteer Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com> Change-Id: Ia8899d3d47a3c38ed20dfa5121d375a4419567f4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3080573 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* zephyr: shim: reimplement hooks using iterablesFabio Baltieri2021-08-101-24/+8
| | | | | | | | | | | | | | | | | | Reimplement the hooks shim code using Zephyr iterable sections. Keep the existing hook_registry based structure, gets rid of the per-hook init functions and instead initializes all the list nodes from a single init call. BRANCH=none BUG=b:195521227 TEST=build and run on volteer Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com> Change-Id: Ic166d214ee1dcd1431ec484e5014cb297f7fb8c2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3069399 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* zephyr: shim: reimplement mkbp_event using iterablesFabio Baltieri2021-08-101-30/+5
| | | | | | | | | | | | | | | Rewrite the MKBP events shim using iterable sections. BRANCH=none BUG=b:195521227 TEST=build and run on volteer Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com> Change-Id: Ia96fb9ec06b1a86b1be293209db317a361ae4741 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3069398 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* zephyr: shim: reimplement host commands using iterablesFabio Baltieri2021-08-101-35/+6
| | | | | | | | | | | | | | | | | Rewrite the host command shim using Zephyr iterable sections. This allows initializing the HC structure statically and gets rid of the runtime init code entirely. BRANCH=none BUG=b:195521227 TEST=build and run on volteer Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com> Change-Id: I94a55f8eb3e1d58de6a1d93c31b6170a5541a1fc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3010284 Commit-Queue: Keith Short <keithshort@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: add support for CONFIG_HOST_COMMAND_STATUSTim Lin2021-08-051-0/+5
| | | | | | | | | | | | | Add Kconfig option for CONFIG_HOST_COMMAND_STATUS. BUG=b:195342437 BRANCH=none TEST=zmake testall Change-Id: Ia5adab17904cb3982788d642bc7c08b0bef69b6f Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3068489 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* zephyr: Add scratchpad console command enable optionWealian Liao2021-08-021-0/+5
| | | | | | | | | | | | | | | This CL adds scratchpad console command enable options in Kconfig. BUG=none BRANCH=none TEST=zmake testall Signed-off-by: Wealian Liao <whliao@nuvoton.corp-partner.google.com> Change-Id: I5d7e536298f74d93e420b90c72702df80f02fa4c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3067155 Reviewed-by: Yuval Peress <peress@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* zephyr: ite: add CONFIG_PLATFORM_EC_FW_RESET_VECTORDenis Brockus2021-07-281-0/+5
| | | | | | | | | | | | | | | | | | | CONFIG_PLATFORM_EC_FW_RESET_VECTOR is used to control CONFIG_FW_RESET_VECTOR in the existing cros-ec code. This allows a chip specific function to be called to obtain the firmware reset vector. BUG=b:194794622 BRANCH=none TEST=zmake configure -b $PROJ_HAYATO Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: I49000bc557f86f74af0d8429af6939ad340f21d5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3056514 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org> Tested-by: Denis Brockus <dbrockus@chromium.org> Auto-Submit: Denis Brockus <dbrockus@chromium.org>
* zephyr: Fix warning for host command disableWealian Liao2021-07-271-2/+7
| | | | | | | | | | | | | | | | | | | | | | Zephyr enables unused function warning for GCC compiler. It generates warnings for those static host command functions when the host command disable. Add __attribute__((unused)) for the routine in DECLARE_HOST_COMMAND. However, for all the test which use Clang will generate another warning "attribute declaration must precede definition" for host command. Zephyr doesn't enable unused function warning for Clang compiler, so define DECLARE_HOST_COMMAND as empty for Clang. BUG=none BRANCH=none TEST=zmake testall Signed-off-by: Wealian Liao <whliao@nuvoton.corp-partner.google.com> Change-Id: If19bf7f76b742313674885eb8f8f2dce8038fc76 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3033228 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* keyboard: Use __override for keyboard_scan_configDaisuke Nojiri2021-07-231-5/+0
| | | | | | | | | | | | | | | | | Currently keyboard_scan_config is defined by each board using CONFIG_KEYBOARD_BOARD_CONFIG. This patch makes it defined as __override hence removes CONFIG_KEYBOARD_BOARD_CONFIG. BUG=None BRANCH=None TEST=buildall Change-Id: I53a356741ba4d00e829ca59b74ee6dc704188728 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3044403 Tested-by: Gwendal Grignou <gwendal@chromium.org> Commit-Queue: Gwendal Grignou <gwendal@chromium.org> Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
* zephyr: add support for CONFIG_SMBUS_PECDino Li2021-07-231-0/+5
| | | | | | | | | | | | | Add Kconfig option to enable packet error checking of SMBus. BUG=b:189855648 BRANCH=none TEST=zmake testall Signed-off-by: Dino Li <Dino.Li@ite.com.tw> Change-Id: Iec9f318aebed97f28e199054aae558bb8a500d52 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3045034 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* zephyr: add support for CONFIG_HOSTCMD_REGULATORDino Li2021-07-231-0/+5
| | | | | | | | | | | | | Add Kconfig option to enable host command of voltage regulator control. BRANCH=none BUG=b:189855648 TEST=zmake testall Signed-off-by: Dino Li <Dino.Li@ite.com.tw> Change-Id: I3cb8a875f8354f4223d31e2d54319f0fb2690b5b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3045033 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* zephyr: Remove NPCX dependency from shim/src/espi.cYuval Peress2021-07-221-0/+51
| | | | | | | | | | | | | | | | Allow building the zephyr/shim/src/espi.c for other SOCs by adding inline functions to abstract away these concepts. Each SOC should then implement these under the zephyr/shim/chip/<soc> specific directory. BRANCH=none BUG=b:189954415 TEST=zmake testall Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I776bd65326b509ada3b271177ae727a32d4f96da Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3044400 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* cbi: Introduce CONFIG_CBI_GPIOPhilip Chen2021-07-141-0/+5
| | | | | | | | | | | | | | | | | | | For the boards where SKU_ID/BRD_ID comes from the strapping pins on EC, this new config enables AP to ask EC for those hardware configs using the CBI host command `EC_CMD_GET_CROS_BOARD_INFO`. BRANCH=None BUG=b:186264627 TEST=make buildall -j TEST=Enabled CONFIG_CBI_GPIO for lazor and manually verified with `ectool cbi get`. Change-Id: I7ec9097bab96d2076d9d42db2d003460db000113 Signed-off-by: Philip Chen <philipchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3002452 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org>
* zephyr: add support for CONFIG_CMD_S5_TIMEOUTKeith Short2021-07-121-0/+5
| | | | | | | | | | | | | | | Add a Kconfig option to control the CONFIG_CMD_S5_TIMEOUT option. BUG=b:193195946 BRANCH=none TEST=zmake testall TEST=make buildall Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I2f4b8c74a9b710f68d8e07e04d9cb95ca2e39dea Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3015869 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Yuval Peress <peress@chromium.org>
* zephyr: add support for CONFIG_USBC_PPC_SYV682X_SMART_DISCHARGEKeith Short2021-07-121-0/+5
| | | | | | | | | | | | | | | | Add Kconfig option to enable the CONFIG_USBC_PPC_SYV682X_SMART_DISCHARGE option on the SYV682x PPC. BUG=b:193195946 BRANCH=none TEST=zmake testall TEST=make buildall Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I5530951f75e2d4b64756858b9799c7978be44ba3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3015868 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Yuval Peress <peress@chromium.org>
* zephyr: add InvenSense sensorsKeith Short2021-07-121-0/+10
| | | | | | | | | | | | | | | | Add Kconfig options for the InvenSense sensor drivers ICM426xx and ICM42607. This also creates config option for CONFIG_ACCELGYRO_ICM42607 which was missed when the driver was first created (CL:2822268). BUG=b:193195946 BRANCH=none TEST=zmake testall TEST=make buildall Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I422071e749ee2e8ed3ac1997aa886ee78395d37e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3015867 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* syv682x: Fix name for option to disable CC passthroughKeith Short2021-07-101-2/+2
| | | | | | | | | | | | | | | | | | | | | Change the name to disable CC passthrough on the SVY682x PPC from CONFIG_SYV682X_NO_CC to CONFIG_USBC_PPC_SYV682X_NO_CC to match the naming convention of other PPC options. This also corrects a non-fatal error in the firmware-eq CQ about a new ad-hoc EC config option. BUG=b:193195946 BRANCH=none TEST=zmake testall TEST=make buildall Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I66abcdddb7735f210fa25ed7c8b5760d8d626026 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3015866 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Yuval Peress <peress@chromium.org> Commit-Queue: Yuval Peress <peress@chromium.org>
* zephyr: Add CONFIG_PLATFORM_EC_TEMP_SENSOR_FIRST_READ_DELAY_MSKeith Short2021-07-101-0/+6
| | | | | | | | | | | | | | | | Create Kconfig options to set the CONFIG_PLATFORM_EC_TEMP_SENSOR_FIRST_READ_DELAY_MS delay. BUG=b:193195946 BRANCH=none TEST=zmake testall Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I13ab0d35c4b39d472bfb3274744ccd969d3fbfad Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3015865 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Yuval Peress <peress@chromium.org> Commit-Queue: Yuval Peress <peress@chromium.org>
* driver: bmi3xx: Add support for BMI323 sensorBhanu Prakash Maiya2021-07-091-0/+5
| | | | | | | | | | | | | | | | | | | | | BMI323 is one of BMI3XX series accel sensor series. Adding defines, driver from Bosch APIs based initial patches submitted by Bosch team members in crrev/c/2966530. BRANCH=none BUG=b:178398789 TEST=Accel implementation tested on Guybrush EC commands: > accelinfo > acceldata Signed-off-by: Bhanu Prakash Maiya <bhanumaiya@chromium.org> Change-Id: I9fa9d80aa25231261994adb4ef0ac5d71ac2f81a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2984740 Reviewed-by: Diana Z <dzigterman@chromium.org> Auto-Submit: Bhanu Prakash Maiya <bhanumaiya@google.com> Commit-Queue: Bhanu Prakash Maiya <bhanumaiya@google.com> Tested-by: Bhanu Prakash Maiya <bhanumaiya@google.com>
* system: Clean up system_get_board_version()Philip Chen2021-07-091-5/+0
| | | | | | | | | | | | | | | | | | | Refactor system_get_board_version() a bit so that we can remove CONFIG_BOARD_VERSION_CUSTOM and CONFIG_BOARD_VERSION from config.h. BRANCH=None BUG=b:186264627 TEST=make buildall -j TEST=zmake testall Cq-Depend: chromium:3015243 Change-Id: Id5ab809493c297b7d330ea13dcd6934ec00042a6 Signed-off-by: Philip Chen <philipchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3004112 Commit-Queue: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* zephyr: add support for CONSOLE_CMD_MFALLOWKeith Short2021-07-081-0/+5
| | | | | | | | | | | | | | | Add Kconfig option to control the CONSOLE_CMD_MFALLOW cros-ec option. BUG=b:193159000 BRANCH=none TEST=make buildall TEST=zmake testalll Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I0f9296cfc72d52c26e6d012b5aaf68c449df2669 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3016955 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
* zephyr: change host console shim interfaceDawid Niedzwiecki2021-07-021-4/+5
| | | | | | | | | | | | | | | | | | | Allow passing a whole string to the console buffer, which is sent to host. This should speed up printing because a mutex doesn't have to be locked for every char separately. BUG=b:191724484 BRANCH=none TEST=Make sure buffering of console to host works with the 'ectool console' command Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com> Change-Id: I5b081984bfa4f930ad4729b19975b1c2eb4bbd18 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2988193 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr/drivers: npcx: reorganizes the flash driver(3)Tim Lin2021-07-011-1/+0
| | | | | | | | | | | | | | | | | | | | | Move NPCX specific code crec_flash_physical_get_protect(), crec_flash_physical_get_protect_flags(), crec_flash_physical_protect_at_boot(), and crec_flash_physical_protect_now() from shim/flash.c to cros_flash/cros_flash_npcx.c. BUG=b:187192628 BRANCH=none TEST=zmake -lDEBUG configure -b -B zephyr/build_volteer \ zephyr/projects/volteer/volteer/ Cq-Depend: chromium:2994430 Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com> Change-Id: Id6ed382ad4578969838339c9eb874b323390c485 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2891674 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org> Tested-by: Keith Short <keithshort@chromium.org>