summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* gitlab: Add lazor buildstabilize-13895.B-mainSimon Glass2021-04-051-7/+14
| | | | | | | | | | | | | | We currently have only volteer building on gitlab. Since trogdor is under active development, add a build for that as well. BUG=b:178731498 BRANCH=none TEST=pass at https://gitlab.com/zephyr-ec/ec/-/pipelines/281073991 Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I0526a83596825e8859ea74fad555c37bddf2fcc2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2803996 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* gitlab: Update build name for zephyrSimon Glass2021-04-051-1/+2
| | | | | | | | | | | | | | The directory has changed. Update this in the gitlab file so that builds can succeed. BUG=b:178731498 BRANCH=none TEST=pass at https://gitlab.com/zephyr-ec/ec/-/pipelines/281069048 Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: If4924a221f33b3ad17c97a20ead1c35fc760291d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2803995 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: Disable LTO for zephyr toolchainKeith Short2021-04-051-1/+8
| | | | | | | | | | | | | | | | | | | | | If both CONFIG_LTO and CONFIG_FPU are enabled, the Zephyr toolchain generates linker errors. Disable LTO to unblock non-chroot builds and Gitlab builds. BUG=b:184302085 BRANCH=none TEST=Build zephyr EC for volteer with coreboot toolchain, verify LTO is enabled TEST=Build zephyr EC for volteer with zephyr toolchain, verify LTO is disabled Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: Ib8e99df0b96c3a1579bdcb1f98b023bf13f0be8f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2801251 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Commit-Queue: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org>
* zephyr: firmware_builder bundle functionalityKevin Shelton2021-04-051-10/+106
| | | | | | | | | | | | | | | | | | | | | | Ports bundle functionality (excluding LCOV info bundling) from platform/ec/firmware_builder.py. BUG=b:176926834 BRANCH=None TEST=./firmware_builder.py --metrics=/tmp/metrics build, ./firmware_builder.py --metrics=/tmp/metrics bundle, ./firmware_builder.py --output-dir=/tmp/testbundle --metrics=/tmp/metrics --metadata=/tmp/testmetadata bundle, ./firmware_builder.py --metrics=/tmp/metrics --code-coverage bundle, bundle with code-coverage option raises an exception as expected, build included some errors that are unrelated to this change, e.g.: "Zmake/ERROR: Including boilerplate (Zephyr base): Signed-off-by: Kevin Shelton <kmshelton@chromium.org> Change-Id: I3b7a5a0d2ec8415320bdf289b1d64210feeb39c3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2797541 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* PCHG: Support firmware updateDaisuke Nojiri2021-04-057-57/+671
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds EC_CMD_PCHG_UPDATE, which allows the host to update firmware of ctn730 via I2C. An updater (e.g. ectool) is expected to issue EC_PCHG_UPDATE_CMD_OPEN, multiple EC_PCHG_UPDATE_CMD_WRITEs, then EC_PCHG_UPDATE_CLOSE. Each sub-command completion is notified to the host via EC_MKBP_EVENT_PCHG. An updater is supposed to wait for the previous sub-command to complete before proceeding to the next. Example: localhost ~ # ectool pchg 0 State: DOWNLOAD (6) FW Version: 0x104 localhost ~ # ectool pchg 0 update 0x207000 0x105 /path/to/image.bin Update file /path/to/image.bin (85632 bytes) is opened. Writing firmware (port=0 ver=0x105 addr=0x207000 bsize=128): ********************************************************************** FW update session closed (CRC32=0x7bd5c66f). localhost ~ # ectool pchg 0 reset Reset port 0 complete localhost ~ # ectool pchg 0 State: ENABLED (2) FW Version: 0x105 BUG=b:182600604, b:173235954 BRANCH=trogdor TEST=ectool pchg 0 update 0x201200 0x105 /tmp/user_ee_X0.1_V1.5.bin TEST=ectool pchg 0 reset Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: I9c62f1714dd69428ab5870c443cb4eb77881a6c6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2757099
* crc: Don't use crc_hw.h for host toolsDaisuke Nojiri2021-04-051-2/+2
| | | | | | | | | | | | | | | | | Currently, crc_hw.h is included when CONFIG_HW_CRC is defined. This breaks host tools which call crc32 APIs because they run on an AP (which has no 'hw_crc'). This patch avoids using crc_hw.h for host tools. BUG=none BRANCH=none TEST=buildall Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: I50f496275f4d8969950bf51e3de5cff9697e3b29 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2800717 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* mchp: Add i2c_chip.h and board_i2c_p2c() in chipmartin yan2021-04-052-0/+39
| | | | | | | | | | | | | | | | Add board_i2c_p2c() which returns default I2C controller for i2c but this function can be overridden by board BRANCH=none BUG=none TEST=Build sklrvp_mchp172x. Signed-off-by: martin yan <martin.yan@microchip.corp-partner.google.com> Change-Id: I88740517f11c6afcfc1edb37a59bbf04f336f655 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2800091 Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
* mchp: Move general flash definitions into chipmartin yan2021-04-051-0/+16
| | | | | | | | | | | | | | | | | | | | | Move general flash definitions: CONFIG_SPI_FLASH_PORT CONFIG_SPI_FLASH into config_chip.h Redefine CONFIG_FLASH_SIZE_BYTES per MEC1727 with integrated SPI flash BRANCH=none BUG=none TEST=Build MEC170x/MEC152x boards and sklrvp_mchp172x. Signed-off-by: martin yan <martin.yan@microchip.corp-partner.google.com> Change-Id: I2dc9af69b0794ec2e3ec11c45be9ff74aa19f561 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2799977 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Ravin Kumar <ravin.kumar@microchip.com> Tested-by: Ravin Kumar <ravin.kumar@microchip.com> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
* Lindar: Lindar's lightbar support in S0ix/S3reno.wang2021-04-034-2/+480
| | | | | | | | | | | | | | | | | | | | | | | | | 1. Lid is closed, lightbar keep off 2. Lid is opened, its behavior follow below. AC+Battery < 20%, lightbar solid 2 amber led on. AC+Battery < 40%, lightbar solid 4 amber led on. AC+Battery < 60%, lightbar solid 6 amber led on. AC+Battery < 80%, lightbar solid 8 amber led on. AC+Battery < 97%, lightbar solid 10 amber led on. AC+Battery >= 97%, lightbar solid 10 green led on. Battery only >= 15%, lightbar keep off. Battery low < 15%, lightbar blink amber color, 1s on, 5s off. 3. Some SKU un-support lightbar, and shouldn't run lightbar task. 4. Lightbar is powered by PP3300_A, and shouldn't run it in S4/S5/G3. 5. Add debounce time for lightbar state change. BUG=b:174133147 BRANCH=volteer TEST=make buildall, test lightbar behavior in S0ix/S3. Signed-off-by: reno.wang <reno.wang@lcfc.corp-partner.google.com> Change-Id: Ibbdc17627f7b2d1b2abbbad23b6c06024455e66b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2739008 Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: lazor: Enable the last two charger optionsSimon Glass2021-04-031-0/+2
| | | | | | | | | | | | | | | Enable these options to hopefully reach parity with ECOS in this area. BUG=b:183296099 BRANCH=none TEST=build for lazor (no test yet) Change-Id: I04539d7eb258cf71ff462f210a4070c506565b1f Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2789806 Reviewed-by: Yuval Peress <peress@chromium.org> Reviewed-by: Wai-Hong Tam <waihong@google.com> Reviewed-by: Keith Short <keithshort@chromium.org>
* lazor: Move GPIO_CCD_MODE_ODL to the shared fileSimon Glass2021-04-032-7/+6
| | | | | | | | | | | | | | | | | | Move this init to the shared usbc_config file so that Zephyr can use it. BUG=b:183296099 BRANCH=none TEST=build for lazor Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I65b0f835b5005b783b752fe33085002f9689f9cc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2789805 Reviewed-by: Yuval Peress <peress@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Wai-Hong Tam <waihong@google.com>
* zephyr: lazor: Add support for the ccd_mode_odl interruptSimon Glass2021-04-031-1/+4
| | | | | | | | | | | | | | | | | | This is used on lazor so add it to the map. BUG=b:183296099 BRANCH=none TEST=with another CL, build for lazor and check that the init compile compiles Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I981b36b738b7429416a3dcadc5c9d79fad4e6749 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2789804 Reviewed-by: Yuval Peress <peress@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Wai-Hong Tam <waihong@google.com>
* zephyr: Add support for SuperSpeed mux only with DFPSimon Glass2021-04-032-0/+12
| | | | | | | | | | | | | | | | | | Add support for CONFIG_USBC_SS_MUX_DFP_ONLY which is used on lazor. BUG=b:183296099 BRANCH=none TEST=build for lazor and check the various options in in /tmp/z/trog/build-ro/zephyr/.config Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I5894efbca0c5105d7954c4719e87843dee049a1b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2789803 Reviewed-by: Yuval Peress <peress@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Wai-Hong Tam <waihong@google.com>
* zephyr: Support the amonbmon commandSimon Glass2021-04-032-0/+13
| | | | | | | | | | | | | | | | Add support for this debugging command in Zephyr. BUG=b:183296099 BRANCH=none TEST=build for lazor and check the various options in in /tmp/z/trog/build-ro/zephyr/.config Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I0849eaf2652e74751ffe938fa6696362bfa34d75 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2789802 Reviewed-by: Yuval Peress <peress@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Wai-Hong Tam <waihong@google.com>
* zephyr: lazor: Add various charger featuresSimon Glass2021-04-031-3/+18
| | | | | | | | | | | | | | | | | Enable various charger features to bring this board closer to parity with the ECOS build. ADC is needed also to support PCON. BUG=b:183296099 BRANCH=none TEST=build for lazor and check the various options in in /tmp/z/trog/build-ro/zephyr/.config Change-Id: I013f6033a5f115ab75cd9aadd2ef6f03008594e5 Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2788841 Reviewed-by: Yuval Peress <peress@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Wai-Hong Tam <waihong@google.com>
* fpsensor: Support building firmware that works for both sensorsYicheng Li2021-04-0221-257/+727
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a refactoring to allow building FPMCU firmware that works for one FPC sensor and one ELAN sensor. 1. When both drivers implement our common functions, e.g. fp_sensor_init(), rename them to fp_sensor_init_fpc() and fp_sensor_init_elan(). 2. There are a few functions implemented not in FPC driver but in FPC private library, e.g. fp_sensor_finger_status(). I kept this as-is for FPC but renamed the one in ELAN driver to fp_sensor_finger_status_elan() 3. If building for ELAN, need to hardcode elan=1 in hatch_fp/board.c because the sensor type GPIO always says FPC. BRANCH=none BUG=b:175158241 TEST=make run-fpsensor; make run-fpsensor_status; make run-fpsensor_crypto TEST=make -j BOARD=dartmonkey TEST=add CONFIG_FP_SENSOR_ELAN515 to board/hatch_fp/board.h; make -j BOARD=bloonchipper Firmware binary fully works on Dragonair (FPC) and Voema (ELAN) TEST=run device tests with http://crrev/c/2750547 and http://crrev/i/3654297 on Dragonclaw, all pass Change-Id: I789090dbdfe35ac6aefd6a629fa4c7bde89dc437 Signed-off-by: Yicheng Li <yichengli@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2727971 Reviewed-by: Tom Hughes <tomhughes@chromium.org> Commit-Queue: Tom Hughes <tomhughes@chromium.org>
* zephyr: Add support for PSYSSimon Glass2021-04-022-0/+31
| | | | | | | | | | | | | | | | Add support for reading the system-power value and enabling the 'psys' command. This feature is provided by some chargers, using the ADC on the EC. BUG=b:183296099 BRANCH=none TEST=with other CLs, build zephyr for lazor and see that the option is present Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I3acbb53f47e00a07b1de4d96bac05e65f13ce628 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2788840 Reviewed-by: Wai-Hong Tam <waihong@google.com>
* zephyr: Update ADC shim for Zephyr 2.5Simon Glass2021-04-026-4/+28
| | | | | | | | | | | | | | | | | This seems to have changed with the new version. We now need to use an enum since we cannot get the label except as a string. Update it. BUG=b:175881324 BRANCH=none TEST=build Zephyr with lazor and some other CLs and see that the ADC enum is now available and there are not build errors Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: Iefa1a3582ec7d20a41b1e26a8210fdf7c8b7e1ef Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2788839 Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: Update the temperature-sensor shimSimon Glass2021-04-0210-37/+79
| | | | | | | | | | | | | | | | | | | | | | At present this shim relies partially on a hard-coded mapping, in the temp_sensors.c file. Also it uses the node IDs as enum values, which makes it difficult to actually use the enums in the code. With the ADC shim we need to be able to support using ADC enums in the code, such as ADC_PSYS. This will force a change of naming in enum adc_channel, which temperature sensors refer to. Update the shim to use an enum for the temp-sensor ID and another for the function to call to read the temperature. BUG=b:175881324 BRANCH=none TEST=build Zephyr for lazor and volteer Change-Id: I08bd45568be525650b8527830053ee541d6240cf Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2801172 Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: zmake: add FMAP entries using binmanJack Rosenthal2021-04-021-5/+24
| | | | | | | | | | | | | | | | | Add expected FMAP structure (see bug) using binman. You need crrev.com/c/2803414 to get the section types in FMAP. (Does not need to be in CQ Dep though, as code works fine without it, you just miss the WP_RO, EC_RO, and EC_RW entries). BUG=b:184146709 BRANCH=none TEST=dump_fmap -H zephyr.bin Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I5c6bbc71732a4f2c16c963c5fbf3a5efd5ca7727 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2802838 Reviewed-by: Simon Glass <sjg@chromium.org>
* sasuke : set nc pin to pull-downYongBeum.Ha2021-04-021-19/+19
| | | | | | | | | | | | | Set NC pin to pull-down to reduce power consumption BUG=b:178356507 BRANCH=None TEST=make -j BOARD=sasuke Signed-off-by: YongBeum.Ha <ybha@samsung.corp-partner.google.com> Change-Id: I3725751abfe28302322a4fe3e0143b8b3a70fdcd Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2801179 Reviewed-by: Diana Z <dzigterman@chromium.org>
* zephyr: zmake: Support sequential buildsSimon Glass2021-04-022-45/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | At present with 'zmake build' everything happens in parallel. This is nice because it saves time. However if there is a build error, or some warnings, these typically appear twice, since both the RO and RW builds are (mostly?) compiling the same code. It is not useful to show the same message twice. As a partial solution, use -j1 to make the RO and RW builds happen one after the other, stopping if the first one fails. This flag can be used in an IDE to provide friendlier output. Admittedly this results in a slower build, but the difference is only material when Kconfig or device tree have changed and everything is being rebuilt. Most of the time an incremental build only takes a second, so this option is quite handy. BUG=b:177096315 BRANCH=none TEST=manually test by running zmake build / configure FEATURE=test sudo -E emerge zephyr-build-tools Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: Ie66cf894a87b05a7648a77767e37e94636771c6a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2789798 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: zmake: Allow warnings to break the buildSimon Glass2021-04-023-9/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | Now that we are showing warnings by default (and not requiring -l DEBUG) they are more likely to receive action. But for the commit queue it seems useful to fail the build if there are any warnings, just in case people are not very observant in their local builds. Add a -w flag for this. It works by checking for any output in the ERROR log, which is safer now that we have cleaned up the error output to just include actual errors. Put the check in a separate function since it will be called from a different place in a future CL. BUG=b:177096315 BRANCH=none TEST=manually test by running zmake build / configure FEATURE=test sudo -E emerge zephyr-build-tools Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I4c0ec53d2836ce0ba67b3c8bcf39b53fa1af2945 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2789797 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Yuval Peress <peress@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* honeybuns: Set lane control gpio when MST is in resetScott Collyer2021-04-023-1/+54
| | | | | | | | | | | | | | | | | | | | | | | | GPIO_MST_HUB_LANE_SWITCH is used by the EC to signal to the MST hub if the host will be providing 2 or 4 lanes of DP. Some MST hubs will only read this signal coming out of reset. This CL adds a method to set MST_HUB_LANE_SWITCH which includes putting the MST hub in reset. BUG=b:175434634 BRANCH=None TEST=modified the mf preference in CBI and verified that MST_HUB_LANE_SWITCH follows the expected level based on pin config in the DP Configure message: Pin Config C -> 0* MST_HUB_LANE_SWITCH Pin Config D -> 1* MST_HUB_LANE_SWITCH Signed-off-by: Scott Collyer <scollyer@google.com> Change-Id: I096988567b1e53cf49833359ce053da199f406db Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2682789 Commit-Queue: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org>
* honeybuns: usbc default Rp and baseboard hook init timingScott Collyer2021-04-022-1/+7
| | | | | | | | | | | | | | | | | | This CL changes the hook init timing for baseboard_init which needs to be run prior to any usbc/usb-pd initialization. In addition the config option CONFIG_USB_PD_PULLUP is changed from RP_1A5 to RP_3A0 to match what is advertised in the SRC CAP message. BUG=None BRANCH=None TEST=Verfied TD.4.9.2 USB Type C Current Advertisement Test passes Signed-off-by: Scott Collyer <scollyer@google.com> Change-Id: I226e983733850f1b21c25175826e762295609069 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2519800 Commit-Queue: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org>
* quiche: Add board_set method for ps8822 mux for rx dp eqScott Collyer2021-04-021-0/+17
| | | | | | | | | | | | | | | | | This CL adds a method to change Rx DP gain from 12 to 20 dB. This value was requested by the MST vendor. BUG=b:178656398 BRANCH=None TEST=verifed register setting when DP mode is active on quiche Signed-off-by: Scott Collyer <scollyer@google.com> Change-Id: I6355da1ad88c3e1f29f07ca036adbf8fc9b908ca Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2686919 Commit-Queue: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org>
* usb_mux: ps8822: Add support to adjust rx DP EQ settingScott Collyer2021-04-022-10/+67
| | | | | | | | | | | | | | | | | | | | | | This CL modifies the PS8822 usb_mux driver to support multiple pages (there is a page 0, 1, and 2 for this chip). The usb_mux driver only needs access to page 0, but page 1 access is needed for DP EQ settings. In addition this CL adds a new driver function to allow setting of the DP Rx equalization gain value. BUG=b:178656398 BRANCH=None TEST=tested on quiche and verified the register is programmed when DP mode is active. Signed-off-by: Scott Collyer <scollyer@google.com> Change-Id: I65cb2fc2c982b01537eb60c0b9da30f4363419aa Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2686918 Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Scott Collyer <scollyer@chromium.org>
* zephyr: shim: SHI: fix bugJun Lin2021-04-021-2/+2
| | | | | | | | | | | | | | | | | This is the follow-up CL to fix the bug addressed in the comment of the CL:2786888 BUG=b:182600858 BRANCH=none TEST=pass zmake build Signed-off-by: Jun Lin <CHLin56@nuvoton.com> Change-Id: Id1923f3dc0ac357cbcac876a5e68f304024867ba Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2799336 Tested-by: CH Lin <chlin56@nuvoton.com> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* zephyr: driver: SHI: remove SHI version controlJun Lin2021-04-023-13/+0
| | | | | | | | | | | | | | | | | | | | | In NPCX7mnFA, the old SHI module and the new SHI module co-exist in this chip. We need to set DEVALTF.bit7 to enable the new version of the SHI module. In the latter npcx7 variants and npcx9 chips, only the new SHI module is supported. Because NPCX7mnFA chip variants are not included in the zephyr repo. We can remove the version control setttng. BUG=b:182600858 BRANCH=none TEST=Test host command "version" and "Hello" on npcx7_evb and the host emulator. Signed-off-by: Jun Lin <CHLin56@nuvoton.com> Change-Id: I43b2fb5294f39e2bf04a0794c9d54e87c8e0ce33 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2799335 Tested-by: CH Lin <chlin56@nuvoton.com> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* zephyr: driver: SHI: rename non-inclusive language wordJun Lin2021-04-021-3/+3
| | | | | | | | | | | | | | | | Use inclusive language wording for SPI interface in the comment. BUG=b:182600858 BRANCH=none TEST=none Signed-off-by: Jun Lin <CHLin56@nuvoton.com> Change-Id: Ib58ead6b58464e0a08777c674fcf95f45850e968 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2799334 Tested-by: CH Lin <chlin56@nuvoton.com> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* zephyr: driver: SHI: remove unnecessary "default n" in KconfigJun Lin2021-04-021-2/+0
| | | | | | | | | | | | | | | | | | Remove unnecessary "default n" in the Kconfig because the default value of a boolean type config is always n. BUG=b:182600858 BRANCH=none TEST=pass zmake build Signed-off-by: Jun Lin <CHLin56@nuvoton.com> Change-Id: I54cc4a3dbf1615c595e26d874eef3b0d73c3a82e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2799333 Tested-by: CH Lin <chlin56@nuvoton.com> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* zephyr: New test of ec appJeremy Bettis2021-04-028-2/+181
| | | | | | | | | | | | | | | | | | | | | | | Change zephy/app/ec/main.c:main to instead be named ec_app_main, so that it can be called from tests, and created a trivial stub main to call it. Fix up the CMake files for this change. Add a new ec_app test which calls the ec_app_main() and verifies that hooks of HOOK_INIT type are called. The CONFIG_PLATFORM_EC_HOOKS is the only config currently enabled in tests, so that is the only thing tested for now. BUG=b:184273560 TEST=zmake configure --test zephyr/test/ec_app BRANCH=none Change-Id: I84ca9b36d3f387629ff5bd83463429d762cc2301 Signed-off-by: Jeremy Bettis <jbettis@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2799914 Tested-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* zephyr: Add zmake command coverage.Jeremy Bettis2021-04-024-47/+181
| | | | | | | | | | | | | | | | | | | Added a new zmake sub-command `coverage`, which builds all projects with coverage, runs unit tests, and creates a html coverage report. BUG=b:183007888 TEST=sudo emerge zephyr-build-tools && \ zmake coverage build/ztest-coverage BRANCH=none Change-Id: Idb6af59c223ece00d3eb09982778cb1b500d8db4 Signed-off-by: Jeremy Bettis <jbettis@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2794925 Tested-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Yuval Peress <peress@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* keeby/lalala: Initial commitAseda Aboagye2021-04-0214-8/+1520
| | | | | | | | | | | | | | | | This is the initial commit for lalala, a NPCX797FC variant of keeby. BUG=b:184191507 BRANCH=None TEST=`make -j BOARD=lalala` Signed-off-by: Aseda Aboagye <aaboagye@google.com> Change-Id: I0420cf7252cba5571fe82d0d88d4dccc5d866782 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2798524 Tested-by: Aseda Aboagye <aaboagye@chromium.org> Auto-Submit: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Diana Z <dzigterman@chromium.org>
* alderlake: Remove resolved TODOCaveh Jalali2021-04-021-4/+1
| | | | | | | | | | | | | | This removes a TODO for b/179524867. We have determined that no special handling needs to be performed in chipset_handle_espi_reset_assert. BRANCH=none BUG=b:179524867 TEST=buildall passes Signed-off-by: Caveh Jalali <caveh@chromium.org> Change-Id: I6d40b6119e3bef613e5ba2d9adfa986b79be9078 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2798982 Reviewed-by: Furquan Shaikh <furquan@chromium.org>
* zephyr: drivers: system: fix SYS_INITYuval Peress2021-04-021-1/+4
| | | | | | | | | | | | | | | | | As per https://docs.zephyrproject.org/latest/reference/drivers/index.html#initialization-levels "symbolic expressions are not permitted" Change replaces the symbolic expressions to a constant one along with a verification step to ensure that the correct ordering takes place. BRANCH=none BUG=none TEST=zmake testall Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I6556abe9bcfd03aa259436d2ec37dd8ffca06b06 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2801099 Reviewed-by: Simon Glass <sjg@chromium.org>
* sasuke: remove CONFIG_SYSTEM_UNLOCKED, enable CONFIG_USB_PD_COMM_LOCKEDYongBeum.Ha2021-04-021-6/+1
| | | | | | | | | | | | | | | Remove the CONFIG_SYSTEM_UNLOCKED option configurations and enable CONFIG_USB_PD_COMM_LOCKED for final firmware. BRANCH=none BUG=b:183305545 TEST=flash on sasuke and PD communication did not negotiate (when WP was asserted)in RO but did RW. Signed-off-by: YongBeum.Ha <ybha@samsung.corp-partner.google.com> Change-Id: Ia1fea35c6dd7ff126d273a8c86b453cfad7ae8b0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2801174 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* zephyr: Move ADC-shim code into zephyr/shimSimon Glass2021-04-022-18/+30
| | | | | | | | | | | | | | | Most of the shim code is in zephyr/ rather than in the ECOS code. Move the ADC one as well, to keep it consistent. BUG=b:175881324 BRANCH=none TEST=build Zephyr with lazor and some other CLs and see that the ADC enum is now available and there are not build errors Change-Id: Ib1b31c1b885e3ca5b184f4f708776357ac87cbbf Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2801171 Reviewed-by: Wai-Hong Tam <waihong@google.com>
* bq25720: Add Vmin Active Protection registerCaveh Jalali2021-04-012-0/+6
| | | | | | | | | | | | | | | | This adds the definition for the bq25720 (not present on bq25710) Vmin Active Protection Register (0x37). We don't actually use this register at this point - it's only added to the register dump list. BRANCH=none BUG=b:173575131 TEST=buildall passes Change-Id: If46c4a3169c0b5411179a67ad2c0532d1ddd50a4 Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2780839 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
* dedede/raa489000: Enable ASGATE when sourcingAseda Aboagye2021-04-0110-1/+50
| | | | | | | | | | | | | | | | | | | | With the previous change to disable the ASGATE from the charger side, this actually ended up breaking sourcing VBUS. This commit enables the ASGATE when we are attempting to source VBUS. BUG=b:183220414 BRANCH=dedede TEST=Build and flash madoo, plug in a Type-C sink, verify that VBUS is sourced. TEST=Verify that DUT can PR_Swap with peripheral. Signed-off-by: Aseda Aboagye <aaboagye@google.com> Change-Id: I1938f2b827e57a04ef72e2ad35ad6ff29ce18712 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2795073 Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org>
* Reland "dedede/raa489000: Disable ASGATE from READY state"Aseda Aboagye2021-04-0110-25/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a reland of f7fbc629f0655229cc7ffdadfb18c9e13118e3d2 Original change's description: > dedede/raa489000: Disable ASGATE from READY state > > On the boards which use the RAA489000, we keep the ADC enabled while > giving VBUS control to the charger side. This can cause a situation > where VBUS is not quite zero volts when a charger is removed. This > commit uses the charger side registers to control the ASGATE when > selecting our active charge port. This is done in addition to the > existing implementation which uses the TCPCI registers to control > ASGATE. When we place the parts into low power mode, we move the VBUS > control from the TCPC side of the IC to the charger side. It should > be safe to issue both commands as if the TCPC side has control, the IC > ignores the setting from the charger side registers. > > BUG=b:183220414 > BRANCH=dedede > TEST=Build and flash madoo, plug in charger to port, unplug, verify > that VBUS falls to < 200mV and decays from there. > > Signed-off-by: Aseda Aboagye <aaboagye@google.com> > Change-Id: I8e8c8cc32575d18c9d3d1210ed3c5cf69ad5ca4b > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2793058 > Tested-by: Aseda Aboagye <aaboagye@chromium.org> > Reviewed-by: Diana Z <dzigterman@chromium.org> > Commit-Queue: Aseda Aboagye <aaboagye@chromium.org> Bug: b:183220414 Change-Id: I36db53f3e13ba848308cd7e0c94a1b5a3551c600 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2797549 Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org>
* zmake: Refactor _logging_map to use a classSimon Glass2021-04-011-16/+45
| | | | | | | | | | | | | | | | | | | At present this uses a tuple but it would probably be better to use a named tuple so the fields are named. But we also want to be able to track the output (in a future CL), so change it to a class. Use a log_line() method to avoid anything needing access to its internals. Also put brackets after the log_output() function so it is easier to see that it is a function. BUG=b:177096315 BRANCH=none TEST=FEATURE=test sudo -E emerge zephyr-build-tools Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: Icca863ee706b368109d24782a994a0a009316650 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2796848 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: hooks: set a thread name for the hooks workqueueFabio Baltieri2021-04-011-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | This is currently using the generic workqueue name ("workqueue"), setting an explicit name so it's easier to identify. uart:~$ kernel stacks ... 0x200c0180 CHG_RAMP (real size 608): unused 200 usage 408 / 608 (67 %) 0x200c0018 HOOKS (real size 672): unused 200 usage 472 / 672 (70 %) 0x200c6230 ec_hooks (real size 704): unused 184 usage 520 / 704 (73 %) 0x200c7870 shell_uart (real size 960): unused 256 usage 704 / 960 (73 %) 0x200c7b90 idle 00 (real size 128): unused 56 usage 72 / 128 (56 %) ... BUG=none BRANCH=none TEST=kernel stacks Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com> Change-Id: I2889e00efb7f3d64990c9575ea34663381584580 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2799683 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: config: trim down task stacks for NPCX7Fabio Baltieri2021-04-012-0/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reset the various task stack sizes based on the current build setup. This aims to keep the stack watermarks to ~75% based on the numbers observed after booting and running few EC commands. Current output: PD_INT_C1 (real size 736): unused 192 usage 544 / 736 (73 %) PD_INT_C0 (real size 736): unused 264 usage 472 / 736 (64 %) PD_C1 (real size 1184): unused 272 usage 912 / 1184 (77 %) PD_C0 (real size 1184): unused 520 usage 664 / 1184 (56 %) KEYSCAN (real size 640): unused 176 usage 464 / 640 (72 %) POWERBTN (real size 672): unused 176 usage 496 / 672 (73 %) KEYPROTO (real size 640): unused 208 usage 432 / 640 (67 %) HOSTCMD (real size 672): unused 216 usage 456 / 672 (67 %) MOTIONSENSE (real size 800): unused 216 usage 584 / 800 (73 %) CHIPSET (real size 1056): unused 280 usage 776 / 1056 (73 %) CHARGER (real size 704): unused 184 usage 520 / 704 (73 %) USB_CHG_P1 (real size 544): unused 152 usage 392 / 544 (72 %) USB_CHG_P0 (real size 544): unused 152 usage 392 / 544 (72 %) CHG_RAMP (real size 608): unused 144 usage 464 / 608 (76 %) HOOKS (real size 672): unused 200 usage 472 / 672 (70 %) workqueue (real size 704): unused 200 usage 504 / 704 (71 %) shell_uart (real size 960): unused 256 usage 704 / 960 (73 %) idle 00 (real size 128): unused 56 usage 72 / 128 (56 %) IRQ 00 (real size 1024): unused 384 usage 640 / 1024 (62 %) Total footprint before: SRAM: 58560 B 62 KB 92.24% and after: SRAM: 48640 B 62 KB 76.61% The settings are in a Kconfig block and override the default ones, this allows extending and changing the defaults depending on the architecture, board or any other combination. The same method is already widely used in Zephyr (such as for boards and shields). BUG=b:183748844 BRANCH=none TEST=kernel stacks on the EC shell Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com> Change-Id: I31d901218993bb0d7a67169fd2f57033f00e5ccc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2799680 Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: hooks: make deferred queue stack size configurableFabio Baltieri2021-04-012-4/+9
| | | | | | | | | | | | | | | | | The Zephyr implementation of EC hooks is currently using a hardcoded stack size of 1024 bytes. Make it configurable so that we can tweak it on the board configs. BUG=none BRANCH=none TEST=kernel stacks on the EC shell Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com> Change-Id: I705f18b3a17ca9da62421ae563bbc6a2f8cefbc5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2799681 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: config: change stack configs from hex to intFabio Baltieri2021-04-011-24/+24
| | | | | | | | | | | | | | | | | | | | | | | Configuration entries for stack sizes in Zephyr (SYSTEM_WORKQUEUE_STACK_SIZE, ISR_STACK_SIZE etc...) are all as integer, and the tooling around it (the "kernel stacks" shell command) works in integers too. Also using "hex" Kconfig entries implies the "0x" prefix, making it easy to inadvertently typing a decimal number and have it transparently converted to hexadecimal. Converting the EC Zephyr Kconfig entries to int to make this coherent and avoid potential mistakes. BUG=none BRANCH=none TEST=build and check SRAM footprint, no change Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com> Change-Id: I8f55a0741f1d09945f0b097355d9413184d8f262 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2799679 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
* Trogdor: Change the flash size to 512KBWai-Hong Tam2021-04-011-1/+1
| | | | | | | | | | | | | Rev-2 uses another EC SKU, which has 512KB flash instead. BRANCH=None BUG=b:184071830 TEST=Built the image and checked it bootable on rev-2. Change-Id: I51c6c280e9c58e371ef0288afe4736508a950edd Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2798976 Reviewed-by: Alexandru M Stan <amstan@chromium.org>
* Reland "iteflash: speed up data write"Ting Shen2021-04-011-1/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a reland of 3430629ed4e993594d83e9ea22f984f2cf5fce76 Original change's description: > iteflash: speed up data write > > In Cherry/Asurada, around 60% of the flash is not used. Skip writing > empty contents makes flash_ec runs 2x faster. > > BUG=none > TEST=Run `time util/flash_ec --board=cherry --image build/cherry/ec.bin` > Before this patch: 5min 54s > After: 2min 33s > And make sure the content is good. > BRANCH=none > > Signed-off-by: Ting Shen <phoenixshen@google.com> > Change-Id: I6aa5c3c00e2494b87a139f7a09aad9734e68c98d > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2785510 > Reviewed-by: Dino Li <dino.li@ite.corp-partner.google.com> > Reviewed-by: Eric Yilun Lin <yllin@chromium.org> > Commit-Queue: Ting Shen <phoenixshen@chromium.org> > Tested-by: Ting Shen <phoenixshen@chromium.org> Bug: none Change-Id: Icce2ffc404d0e83fa710a5fd1c201e7fbbf10101 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2796376 Tested-by: Ting Shen <phoenixshen@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org>
* asurada: support USM in S0Eric Yilun Lin2021-04-012-1/+15
| | | | | | | | | | | | | | Enable USM to cancel the charging noise. BUG=b:175168848 TEST=EN_5V_USM=1 in S0, =0 in S3. BRANCH=asurada Change-Id: I7cdfafee8b826c8cb165e3aa3d487afdf6625ff9 Signed-off-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2793850 Reviewed-by: Ting Shen <phoenixshen@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org>
* zephyr: Add support for overriding the charger profileSimon Glass2021-04-012-0/+18
| | | | | | | | | | | | | | | | | | | Add support for CONFIG_CHARGER_PROFILE_OVERRIDE so that this feature can be enabled for lazor. BUG=b:183296099 BRANCH=none TEST=with other CLs, build zephyr for lazor and see that the option is present Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I7f3f6e6448209614489ac0b3f607404c43dd9a43 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2788835 Reviewed-by: Yuval Peress <peress@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Wai-Hong Tam <waihong@google.com> Reviewed-by: Denis Brockus <dbrockus@chromium.org>