summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* CBI: Add rework_id fieldstabilize-rust-13795.B-mainThejaswani Puta thejaswani.putta@intel.com2021-02-166-20/+123
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This field will be used to describe all the reworks performed on a board which includes the mandatory, optional and feature reworks. Also modified existing command handlers under ectool and cbi-util tool to support 64 bit length data. Includes build fix for targets where long int is not 64 bits. BUG: b:170385859 BUILD TEST: make BOARD=<BOARD_NAME> -j; make runfuzztests make runhosttests setup_board, cros_workon & emerge-<32-bit target> ec-utils TEST: ./cbi-util create --file ~/cbi_image --board_version 1 --oem_id 2 --sku_id 255 --dram_part_num "01654329efghac" --model_id 15 --rework_id 123456789123456712 --size 256 CBI image is created successfully TEST: ./cbi-util show --file ~/cbi_image CBI image: /home/thejaswani/cbi_image TOTAL_SIZE: 47 Data Field: name: value (hex, tag, size) BOARD_VERSION: 1 (0x1, 0, 1) OEM_ID: 2 (0x2, 1, 1) SKU_ID: 255 (0xff, 2, 1) MODEL_ID: 15 (0xf, 5, 1) REWORK_ID: 123456789123456712 (0x1b69b4bacd05ec8, 9, 8) DRAM_PART_NUM: 01654329efghac (3, 15) Data validated successfully TEST: hexdump -C ~/cbi_image 00000000 43 42 49 1e 00 00 2f 00 00 01 01 01 01 02 02 01 |CBI.../.........| 00000010 ff 05 01 0f 09 08 c8 5e d0 ac 4b 9b b6 01 03 0f |.......^..K.....| 00000020 30 31 36 35 34 33 32 39 65 66 67 68 61 63 00 ff |01654329efghac..| 00000030 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................| * 00000100 TEST: localhost ~ # ectool cbi set 9 98765432 8 localhost ~ # ectool cbi get 9 As uint: 98765432 (0x5e30a78) As binary: 78 0a e3 05 00 00 00 00 localhost ~ # ectool cbi set 9 123456789123456712 8 localhost ~ # ectool cbi get 9 As uint: 123456789123456712 (0x1b69b4bacd05ec8) As binary: c8 5e d0 ac 4b 9b b6 01 localhost ~ # ectool cbi set 9 1234 2 localhost ~ # ectool cbi get 9 As uint: 1234 (0x4d2) As binary: d2 04 TEST: > cbi(from EC Console) 2021-01-19 20:59:56 [80.979692 CBI Reading board info] 2021-01-19 20:59:56 CBI_VERSION: 0x0000 2021-01-19 20:59:56 TOTAL_SIZE: 54 2021-01-19 20:59:56 BOARD_VERSION: 1 (0x1) 2021-01-19 20:59:56 OEM_ID: (Error 1) 2021-01-19 20:59:56 MODEL_ID: (Error 1) 2021-01-19 20:59:56 SKU_ID: 655361 (0xa0001) 2021-01-19 20:59:56 FW_CONFIG: 199683 (0x30c03) 2021-01-19 20:59:56 PCB_SUPPLIER: (Error 1) 2021-01-19 20:59:56 SSFC: (Error 1) 2021-01-19 20:59:56 REWORK_ID: 1234 (0x4d2) 2021-01-19 20:59:56 43 42 49 8c 00 00 36 00 00 01 01 02 04 01 00 0a |CBI...6.........| 2021-01-19 20:59:56 00 06 04 03 0c 03 00 03 19 4d 54 35 33 45 35 31 |.........MT53E51| 2021-01-19 20:59:56 32 4d 36 34 44 34 4e 57 2d 30 34 36 20 57 54 3a |2M64D4NW-046 WT:| 2021-01-19 20:59:56 45 00 09 02 d2 04 ff ff ff ff ff 7f ff ff ff ff |E...............| 2021-01-19 20:59:56 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................| 2021-01-19 20:59:56 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................| 2021-01-19 20:59:56 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................| 2021-01-19 20:59:56 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................| 2020-01-19 20:59:56 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................| 2021-01-19 20:59:56 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................| 2021-01-19 20:59:56 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................| 2021-01-19 20:59:56 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................| 2021-01-19 20:59:56 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................| 2021-01-19 20:59:56 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................| 2021-01-19 20:59:56 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................| 2021-01-19 20:59:56 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................| Signed-off-by: Thejaswani Puta <thejaswani.putta@intel.com> Change-Id: I073a119d43c94cd266503a0fc972a62134b3385f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2693746 Tested-by: Thejaswani Putta <thejaswani.putta@intel.corp-partner.google.com> Commit-Queue: Thejaswani Putta <thejaswani.putta@intel.corp-partner.google.com> Reviewed-by: Peter Marheine <pmarheine@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* brya: Enable chipset supportCaveh Jalali2021-02-163-0/+22
| | | | | | | | | | | | | This enables support for the Alder Lake chipset using the SLG4BD44540 power sequencer. BRANCH=none BUG=b:173575131 TEST=buildall passes Change-Id: I6718bf5500286cee0616024b27939198bcba3b5b Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2686980
* common: motion: fix races at shutdownGwendal Grignou2021-02-131-7/+10
| | | | | | | | | | | | | | | | | | | Do not use collection_rate blindly after a function may have slept: the HOOK task could have run suspend() or suspend() call and set it to 0. Fixes 104f5257 ("motion: Control on which task sensor setting functions are running on") [CL:2553347] BUG=b:176918310, b:170703322 BRANCH=kukui TEST=unit test. Change-Id: I9ef13ceca195db4b48866f1e53f9408fb2bbf595 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2616137 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org>
* board: Set Accelerometer range to 4gGwendal Grignou2021-02-1322-27/+27
| | | | | | | | | | | | | | | | | For accelerometer presented to Android, set default range to 4g. Required by Android CDD - Section 7.3.1 - Paragraph C.1.4. mems_setup can correct it, but it is cleaner if the default setting is right. BUG=b:144004449 BRANCH=none TEST=compile Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Change-Id: I781eafc003823e2595d46d7170f717aaee08dc6d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2657956 Reviewed-by: Alexandru M Stan <amstan@chromium.org>
* zephyr: volteer: Enable the MPUSimon Glass2021-02-131-0/+1
| | | | | | | | | | | | | | | Enable the Memory-Protection Unit on Volteer. Currently this does not do anything useful. BUG=b:180039888 BRANCH=none TEST=build zephyr volteer Build ECOS for volteer Change-Id: I57168b143c08add878d8ccf9313cc7096795339e Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2691572 Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: Add support for CONFIG_MPUSimon Glass2021-02-137-0/+156
| | | | | | | | | | | | | | | | | | Add this option so that the Memory-Protection Unit (MPU) can be enabled. The implementation is still to be worked out. Note that CONFIG_PLATFORM_EC_EXTERNAL_STORAGE is not defined, as it should be. That work is ongoing elsewhere. BUG=b:180039888 BRANCH=none TEST=build zephyr volteer Build ECOS for volteer Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: Ie26e8ba4b3f0b8024930e42fbbb03f0f2a26f3da Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2691566 Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: volteer: Enable floating pointSimon Glass2021-02-131-0/+1
| | | | | | | | | | | | | | | | | Enable this option so that floating-point arithmetic can be used. BUG=b:180023514 BRANCH=none TEST=with zephyr SDK, build zephyr volteer with CONFIG_NEWLIB_LIBC and see no warnings Build for volteer Run 'zmake testall' in the chroot (did not run zmake testall with zephyr SDK as it is not supported!) Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: Ic68f39f1725b328f925c8120dc73c7149ec890fc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2691415 Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: Add support for CONFIG_FPUSimon Glass2021-02-133-0/+69
| | | | | | | | | | | | | | | | | | | | Allow this to be enabled for Zephyr. Since we are using the minimal C library we need to define our own version of a few functions. Add these for Cortex-M4, taken from the existing ECOS code. It happens that Zephyr uses CONFIG_FPU, the same as ECOS, so there is nothing needed in config_chip.h for this case. If CONFIG_FPU is enabled on a new platform, some work will be needed to make it build. BUG=b:180023514 BRANCH=none TEST=build zephyr volteer with CONFIG_NEWLIB_LIBC and see no warnings Build for volteer Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I91187560b7e699b7f77ccfa5990617606f7fd6fa Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2691414 Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: Fix the CONFIG_CPU_PROCHOT_ACTIVE_LOW optionKeith Short2021-02-131-1/+2
| | | | | | | | | | | | | | | | | | | The KConfig option CONFIG_PLATFORM_EC_POWERSEQ_CPU_PROCHOT_ACTIVE_LOW was not enabling the correct platform/ec option CONFIG_CPU_PROCHOT_ACTIVE_LOW. This greatly speeds up booting the kernel on Zephyr builds as the EC was previously always asserting PROCHOT to the AP. BUG=b:177604307 BRANCH=none TEST=Run zephyr-ec on Volteer Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: Ib0d5b6e05d480806239447885be15f1041f0df2c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2693755 Reviewed-by: Simon Glass <sjg@chromium.org> Commit-Queue: Simon Glass <sjg@chromium.org>
* brya: Enable battery supportCaveh Jalali2021-02-123-0/+110
| | | | | | | | | | | | | | | | | | This enables support for batteries on brya. Batteries are expected to be of the "smart" variety with a fuel gauge. The battery presence detect handling is taken from volteer as the designs are similar. BRANCH=none BUG=b:173575131 TEST=buildall passes Change-Id: Id008ae32564f2aa69d3406dd0d8b31d0d3cf21c0 Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2686977 Reviewed-by: Boris Mittelberg <bmbm@google.com> Reviewed-by: Keith Short <keithshort@chromium.org>
* brya: Enable EXTPOWER_GPIOCaveh Jalali2021-02-123-14/+4
| | | | | | | | | | | | | | | This configures the external power GPIO - an indication of AC power presence. BRANCH=none BUG=b:173575131 TEST=buildall passes Change-Id: I1b23f66632514b69dee10ad1bc10c05c4f672104 Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2686976 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Boris Mittelberg <bmbm@google.com>
* volteer: Add version number of productli feng2021-02-122-2/+4
| | | | | | | | | | | | | | | Per PD Rev3.0 Spec, VDM Product VDO has a field bcdDevice, it's version number relevant to the release version of the product. BUG=b:157163664 BRANCH=none TEST=make buildall Signed-off-by: li feng <li1.feng@intel.com> Change-Id: Ie735b64c9d4a1dec2f3402b2c521c107a9769ee0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2420469 Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* nucleo-dartmonkey: Remove stm32f_rtc testTom Hughes2021-02-121-1/+0
| | | | | | | | | | | | | | The stm32f_rtc test is specific to the STM32F series, but dartmonkey is a STM32H series chip. BRANCH=none BUG=b:170432597 TEST=make buildall Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: Ie74d0f232eacc57a8d3028572f1a69a5b2c534d9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2693748 Reviewed-by: Craig Hesling <hesling@chromium.org>
* nucleo: remove rsa unittestTom Hughes2021-02-122-2/+0
| | | | | | | | | | | | | | See https://crrev.com/c/2464231. BRANCH=none BUG=b:169256204 TEST=make buildall -j Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: Id720005029850508081752ec7b2d322743036162 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2693747 Commit-Queue: Craig Hesling <hesling@chromium.org> Reviewed-by: Craig Hesling <hesling@chromium.org>
* Avoid passing char values to ctype functionsSimon Glass2021-02-123-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With Zephyr's newlib we get a warning when trying to do this, since it includes the following note in: /opt/zephyr-sdk/arm-zephyr-eabi/arm-zephyr-eabi/include/ctype.h "These macros are intentionally written in a manner that will trigger a gcc -Wall warning if the user mistakenly passes a 'char' instead of an int containing an 'unsigned char'." Presumably this is so characters above ASCII 127 are handled correctly, even if these are seldom used. Update the few affected call sites to ensure the value is cast to an unsigned char so that it will not fall afoul of the newlib warning. Note that the ECOS version of the ctype functions does not make use of an array, so does not suffer from failure if negative values are passed. Still, it is harmless to fix it. BUG=b:180023514 BRANCH=none TEST=build zephyr volteer with CONFIG_NEWLIB_LIBC and see no warnings Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: Ieae2fab8c20b75baa46d01dd8cdb393c6bb5c2c2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2691413 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: volteer: fix incorrect RW memory offsetYuval Peress2021-02-121-5/+4
| | | | | | | | | | | | | | | | | The CONFIG_CROS_EC_RW_MEM_OFF is not the offset in flash, but instead the offset in RAM which should be identical to RO. See chip/npcx/config_flash_layout.h BRANCH=none BUG=b:167392037 TEST=build/flash volteer Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I2ac9148eea30241f07afdac88556b721ebf643a8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2693686 Commit-Queue: Keith Short <keithshort@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
* zmake: Add ro/rw elf to output/Yuval Peress2021-02-121-0/+2
| | | | | | | | | | | | | | | | | The elf files are very handy for debugging and should be included in the build's output/ directory to make it easier to find. BRANCH=none BUG=none TEST=zmake configure -b zephyr/projects/volteer see that build/zephyr/projects/volteer/output contains both zephyr.ro.elf and zephyr.rw.elf Change-Id: Id7c13c4e7f5cf2b5b0e8b08d2df161695e485740 Signed-off-by: Yuval Peress <peress@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2686984 Commit-Queue: Keith Short <keithshort@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
* USB PD: Report operating power in sink capabilitiesDiana Z2021-02-121-1/+3
| | | | | | | | | | | | | | | | | | | Currently, the vSafe5V sink capability response reports desiring a flat 500mA for every board. This is out of sync with the battery and variable capabilities, which report requiring our defined operating power or maximum current. Change the 500mA to the operating power divided over 5 volts, or the maximum current (whichever is smaller). BRANCH=None BUG=b:179423663 TEST=on voxel, confirm sink capabilities report wanting 3.0A for vSafe5V and confirm drawcia will offer 3.0A when voxel charges Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I22866d28a0571634a7a112f4f306ed89b70c9b02 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2691417 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* zephyr: enable CONFIG_EXTERNAL_STORAGEYuval Peress2021-02-121-1/+1
| | | | | | | | | | | | | | | Enables the CONFIG_EXTERNAL_STORAGE features now that all the underlying requirements have been met. BRANCH=none BUG=b:167392037 TEST=zmake testall TEST=build volteer, flash, see it boot Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: Id4e59a60ac7df963e836640d6519eaba24198467 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2693528 Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: add npcx-specific system functions for external storage.Yuval Peress2021-02-123-0/+201
| | | | | | | | | | | | | | | | In order to sysjump we first need to copy the RW image from flash. rom_chip.h adds a macro to call ROM function download_from_flash (while system_external_storage.c contains all the npcx specific code needed to perform the sysjump). BRANCH=none BUG=b:167392037 TEST=zmake testall Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I762954a71e87036b63513ae8b400605ed507fcf6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2693527 Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: add stub implementation of clock_turboYuval Peress2021-02-123-0/+22
| | | | | | | | | | | | | | | | Some functionality (sysjump in particular) makes use of altering the clock rate. This should eventually live in Zephyr proper, but for now stubbing it will get things working, just a bit slower. BRANCH=none BUG=b:167392037, b:180112248 TEST=zmake testall TEST=build volteer, flash, see that it runs. Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I91ff57c7e0f5cda60556087e6c46ba1d08f8b4a6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2693526 Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: Add locking to shimmed flash.cYuval Peress2021-02-121-3/+72
| | | | | | | | | | | | | | | | | Add a mutex to the shimmed version of flash.c (see chip/npcx/flash.c for reference). While I haven't run into this as a direct issue yet, this could very possibly be where we were running into the boot hang prior. BRANCH=none BUG=b:180112248, b:179900857, b:167392037 TEST=zmake testall TEST=build volteer, flash, see that it boots. Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I8013eba02545f96406399b8f4966e92bed1e9e9a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2686983 Reviewed-by: Simon Glass <sjg@chromium.org>
* servo_updater: print available versionRuben Rodriguez Buchillon2021-02-121-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | This change introduces -p/--print to servo_updater. Rather than performing an update, it will print for the chosen board/channel what firmware is available. See TEST below for output. BRANCH=None BUG=b:179310743 TEST=servo_updater -b servo_micro -c alpha -p board: servo_micro channel: alpha firmware: servo_micro_v2.4.35-f1113c92b // showing py2 compatibility TEST=python2 /usr/lib64/python2.7/site-packages/servo_updater.py -b \ servo_micro --print -c alpha board: servo_micro channel: alpha firmware: servo_micro_v2.4.0-dc38d9bbb Change-Id: I9899e1cacc0496a46a41e94cc9355438a5abe491 Signed-off-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2674381 Reviewed-by: Brian Nemec <bnemec@chromium.org>
* servo_updater: firmware channel retrieval as a library serviceRuben Rodriguez Buchillon2021-02-121-1/+19
| | | | | | | | | | | | | | | | | | | | | This change introduces the ability of using servo_updater as a library to check whether a firmware string (e.g. the one currently read out from the servo device) belongs to a known channel. If so, the channel will be returned. If not, None is returned to indicate this is an unknown firmware string. This can then be used to warn the user to update, or inform them what channel they are currently running. BRANCH=None BUG=b:179310743 // This is performed with the CL that uses this: chromium:2661015 TEST=sudo servod -b soraka dut-control servo_micro_firmware_channel servo_micro_firmware_channel:stable Change-Id: I49e920c7c7977b7c05828f8464af973f538f7aeb Signed-off-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2661021 Reviewed-by: Brian Nemec <bnemec@chromium.org>
* servo_updater: consolidate common code-pathRuben Rodriguez Buchillon2021-02-121-31/+41
| | | | | | | | | | | | | | | | | | | | | Commonly the users of servo_updater (as a script, or a file) care about the firmware version string in addition to knowing what the filename is, and the configuration is. These are used to print informational messages, or check whether an update is needed among other things. This change consolidates that logic by making sure that the version string is always extracted when possible. BRANCH=None BUG=b:179310743 TEST=sudo servod -b soraka // observe logs print the servo firmware version information TEST=sudo servo_updater --board servo_micro // observe no errors Change-Id: Id7cb8f53e5fc3e1f557d74445d49fcafbda851ad Signed-off-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2661020 Reviewed-by: Brian Nemec <bnemec@chromium.org>
* servo_updater: introduce channelsRuben Rodriguez Buchillon2021-02-121-3/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change introduces the ability to pull an update from a specific channel (i.e. a specific file). See the bug for details on this project, but basically the `servo-firmware` package now bundles multiple firmware in the system, all of which are tagged to belong to a 'channel'. The name of those files is then [board_name].[channel].bin. The updater then now supports the notion of requesting a specific channel to update, if the default (stable) is not desired. Like the previous CL it also leverages choices for argparse to ensure no unknown channels are requested. BRANCH=None BUG=b:179310743 TEST=servo_updater --help | grep channel -c {alpha,dev,prev,stable}, --channel {alpha,dev,prev,stable} TEST=sudo servo_updater --board servo_micro -c alpha Current servo_micro version is servo_micro_v2.4.35-f1113c92b Available servo_micro version is servo_micro_v2.4.35-f1113c92b No version update needed Cq-Depend: chromium:2674405 Change-Id: I88c301cc4ff0ac246cbfda6498c27a1fd23f722f Signed-off-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2661019 Reviewed-by: Brian Nemec <bnemec@chromium.org>
* bloonchipper: Refactor GPIOs to keep RO minimalTom Hughes2021-02-129-130/+200
| | | | | | | | | | | | | | | | | | | | | | | We want the amount of code and number of things defined in RO to be as minimal as possible since RO is frozen forever. By keeping RO minimal, we can reduce surface area for attacks and also confusion when GPIOs are removed or renamed. The fingerprint-related code only runs in RW, so move all fingerprint-related GPIOs and associated code into separate files that are only included in RW. BRANCH=none BUG=b:178746753 TEST=On dragonclaw v0.2 with servo micro and jtrace, verify sensor ID shows on console TEST=On dragonair, test fingerprint enroll and unlock TEST=On morphius, test fingerprint enroll and unlock Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: Ia6791666b57ed9be81230d8a5f77d874f56da5a4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2673909 Reviewed-by: Craig Hesling <hesling@chromium.org>
* flash_fp_mcu: Minor spacing fixCraig Hesling2021-02-121-1/+1
| | | | | | | | | | | BRANCH=none BUG=none TEST=none Signed-off-by: Craig Hesling <hesling@chromium.org> Change-Id: Iece845abd9897abd1e341a8dbae6b0fe2aa85a29 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2686924 Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* zephyr: add CONFIG_USB_BCD_DEVKeith Short2021-02-122-0/+14
| | | | | | | | | | | | | | Add a KConfig option to specify the USB device ID. BUG=b:157163664 BRANCH=none TEST=make buildall TEST=zmake testall Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I32677fb2c9a4f1e0d7b4220b7306022248ded630 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2691574 Reviewed-by: Simon Glass <sjg@chromium.org>
* PCHG: Get SOC proactively when device is detectedDaisuke Nojiri2021-02-123-5/+42
| | | | | | | | | | | | | | | | | This patch makes PCHG send CHG_CTRL_CHARGING_INFO_CMD when a stylus is detected. This will allow the EC to report 'full' to the host even if charging doesn't start (because the stylus is already charged). BUG=b:179390065,b:173235954 BRANCH=trogdor TEST=CoachZ. Re-attach charged stylus and verify PCHG_STATE_FULL is reported. Change-Id: Id8578e2d3d21294fb08a21933f12ecee7f2bd062 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2691729 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* guybrush: Enable S0ix for amd_x86Rob Barnes2021-02-122-0/+223
| | | | | | | | | | | | | | | | | Enable S0ix for amd_x86. This closely follows the intel_x86.c implementation. b/179294969 tracks merging intel_x86.c and amd_x86.c BUG=b:175234270 BRANCH=None TEST=Build for Guybrush Boot Zork, enter and leave suspend. Note, Zork does not support S0ix Change-Id: I874d2e9019fcc162c7ebfb6091b179ba482a4e47 Signed-off-by: Rob Barnes <robbarnes@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2673905 Reviewed-by: Diana Z <dzigterman@chromium.org>
* pchg: Notify host of full chargeDaisuke Nojiri2021-02-124-1/+12
| | | | | | | | | | | | | | | | | | | Currently, full charge status is implied by capacity = 100 and PCHG_STATE_DETECTED (i.e. state='not charging'). If the charger stops charging before 100% (for battery health control), this condition doesn't work. This patch makes PCHG send PCHG_STATE_FULL explicitly when it sees the soc goes above the threshold in PCHG_STATE_DETECTED. BUG=b:179390065,b:173235954 BRANCH=trogdor TEST=CoachZ. Charge till 96% and verify PCHG0/state becomes 'Full'. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: I634f96992cdc7ef44b5e43544603cc5cc9b3a62d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2691366 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* flash_ec: look for npcx_monitor.bin relative to EC imageCaveh Jalali2021-02-121-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Given a local EC build, npcx_monitor.bin can be found at a well known location relative to ec.bin (chip/npcx/spiflashfw). So, add that to the search path. flash_ec was failing to find npcx_monitor.bin when only using the --image flag for a local build: util/flash_ec --image build/${BOARD}/ec.bin as it was looking for npcx_monitor.bin in the same directory as ec.bin. The layout in /build/${BOARD}/firmware/... has ec.bin and npcx_monitor.bin in the same directory, but a local build in the EC tree uses build/${BOARD}/chip/npcx/spiflashfw/npcx_monitor.bin. Also, adding the ${BOARD} environment variable as the default board type when --board is not specified. This matches the behavior of the makefiles. In this case, we can invoke flash_ec without arguments. BRANCH=none BUG=b:132350402 TEST=used flash_ec to update the EC on brya Change-Id: I669f52cc4fe480ae23914d9fcbe67aadd18ed6c3 Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2689597 Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org> Commit-Queue: Paul Fagerburg <pfagerburg@chromium.org>
* dartmonkey: Use SPI_SEL to configure fingerprint sensor SPITom Hughes2021-02-125-8/+28
| | | | | | | | | | | | BRANCH=none BUG=b:177908650 TEST=Fingerprint sensor works on Icetower v0.1 TEST=Fingerprint sensor works on nocturne Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: Ie9a7acb9bf4de1295fd245eb55e12ff8e7d2524a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2645691 Reviewed-by: Craig Hesling <hesling@chromium.org>
* docs/fingerprint: Update power numbers for dragonclaw/bloonchipperTom Hughes2021-02-121-19/+26
| | | | | | | | | | | BRANCH=none BUG=b:179789305 TEST=view in gitiles Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: I2bfe78a25bc148fb2a9242a83b3fad5f97c89ed8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2688118 Reviewed-by: Craig Hesling <hesling@chromium.org>
* docs/fingerprint: Update power numbers for icetower/dartmonkeyTom Hughes2021-02-121-11/+17
| | | | | | | | | | | BRANCH=none BUG=b:179789305 TEST=view in gitiles Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: Id5bdb84ef94c2585ee3f3036a85b6ce5f0c5662d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2688117 Reviewed-by: Craig Hesling <hesling@chromium.org>
* TCPMv2: Exit modes on AP resetli feng2021-02-121-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | In AP driven mode entry, in the cases of AP reset, kernel panic, etc, EC will exit modes to ensure next time AP boot up, it can enter same Alt modes. BUG=b:168746787 BRANCH=None TEST=On Voxel, EC binary has AP mode entry enabled, OS has AP mode switch enabled. Boot up system with TBT dock, "ectool usbpdmuxinfo" shows DP=1; "reboot" from AP console, after reboot, get DP=1; hot plug TBT dock, get DP=1; browse as guest, get TBT=1, and enumerated in sysfs. "reboot" from AP console again, after reboot, get DP=1. TEST=On Voxel, EC binary has EC driven mode entry, OS is same as above. Boot up system with TBT dock, get TBT=1; "reboot" from AP console, get TBT=1 after reset and enumerated. Signed-off-by: li feng <li1.feng@intel.com> Change-Id: I127c23ec58f55d7672babf1762ac5fb17e24cc7e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2689671 Commit-Queue: Abe Levkoy <alevkoy@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Ayushee Shah <ayushee.shah@intel.com>
* zephyr: volteer: add node labels to named-adcDawid Niedzwiecki2021-02-121-4/+4
| | | | | | | | | | | | | | | | Add node labels to named-adc's children. It can be used to reference a certain ADC channel directly. BUG=b:174851465 BRANCH=none TEST=build Zephyr for Volteer Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com> Change-Id: Iffbcf8544fce27f688e65b032be41c13a128d33b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2690351 Tested-by: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Commit-Queue: Simon Glass <sjg@chromium.org>
* zephyr: Use string.h instead of EC definitionsSimon Glass2021-02-121-4/+6
| | | | | | | | | | | | | | | | | The EC does not have a string.h header but instead puts these functions in the util.h header. For zephyr it is better that we use the C library, so update these. Leave along those which are specific to ECOS. BUG=b:180023514 BRANCH=none TEST=build zephyr for volteer Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I03421e41a098501c3eb0f651c0960beab8e7428a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2691412 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* flash_fp_mcu: Add initial support for strongbadCraig Hesling2021-02-111-1/+36
| | | | | | | | | | | | | | | | | | Caveats * Need to fix modalias for strongbad * Need to fix driver binding so that the gpios are not reset * Need to fix external nrst pull BRANCH=none BUG=b:145245345, b:172966748, b:179533783, b:179530529, b:179839337 TEST=emerge-strongbad chromeos-base/ec-utils-test cros deploy dut1 chromeos-base/ec-utils-test ./flash_fp_mcu custom-strongbad-evt-image.bin Change-Id: I33d8fee21a2afbf8f5c399e6cb47c2095d833f57 Signed-off-by: Craig Hesling <hesling@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2654737 Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* flash_fp_mcu: Add check for drivers that change nrst and boot0Craig Hesling2021-02-111-1/+15
| | | | | | | | | | | | | | This helps identifying driver/device-tree configs that are tampering with the nrst and boot0 pin states. BRANCH=none BUG=b:179530529 TEST=Deploy to coachz with driver that reset nrst and boot0 pins Signed-off-by: Craig Hesling <hesling@chromium.org> Change-Id: Ia5d603f8ce49022e48b7b1d623c3b2da6926a6ee Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2686579 Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* flash_fp_mcu: Refactor to use gpio functionCraig Hesling2021-02-111-20/+41
| | | | | | | | | | | | | | This makes the script a bit more readable and allows for implementing more generic gpio handling. BRANCH=none BUG=b:145245345 TEST=Test on hatch Signed-off-by: Craig Hesling <hesling@chromium.org> Change-Id: I80e3b9c7e322d53bb3eecfcb9da47cacc3de919c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2658367 Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* EC_CMD_USB_PD_CONTROL: Always populate cable speedAbe Levkoy2021-02-111-13/+2
| | | | | | | | | | | | | | | | | | | | For command version 3, always populate the TBT cable speed and generation, even if the mux isn't currently configured for TBT. For TBT and USB4 mux states, this is not a change from the existing code. For safe mode, populate the cable speed much earlier in time, reducing the chance for a stale EC_CMD_USB_PD_CONTROL command response to conflict with a more recent EC_CMD_USB_PD_MUX_INFO command response. BUG=b:173725284 TEST=make buildall TEST=Report Gen3 speed with Gen3 cable prior to Enter_USB BRANCH=firmware-volteer-13672.B-main Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: Ic38c62b8dfaf74932437e42daa30f79db3adc1ca Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2687720 Tested-by: Ayushee Shah <ayushee.shah@intel.com> Reviewed-by: Diana Z <dzigterman@chromium.org>
* dartmonkey: Adjust sleep pin based on board typeTom Hughes2021-02-112-2/+12
| | | | | | | | | | | | | | | | | | | | | | Development boards (i.e., icetower v0.1) use a different pin for the sleep signal than production designs. Configure the appropriate GPIO depending on the board being used. BRANCH=none BUG=b:179946521, b:175115925 TEST=With icetower v0.1 and servo micro connected: $ dut-control fpmcu_slp_s0:on ==> Observe debug logging that we took !running path in ap_deferred TEST=On nocturne: $ powerd_dbus_suspend ==> Observe debug logging in /var/log/cros_fp.log after running powerd_dbus_suspend that shows we took the !running path in ap_deferred. Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: If83c616abdd95a63e40a4bb05be14dc9b1230abb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2689101 Reviewed-by: Craig Hesling <hesling@chromium.org>
* TCPMv2: Update exit mode sequenceAyushee Shah2021-02-115-4/+32
| | | | | | | | | | | | | | | | | | On exit mode request - Instead to entering safe mode -> USB mode, this CL updates the sequence to - 1. Set Mux, retimer to disconnect 2. Send exit mode to cable/port-partner 3. Set mux and retimer to USB mode BUG=b:173459141 BRANCH=None TEST=Able to re-enter into alternate mode with AP driver approach Change-Id: I6f8f2d4523736100057de4425b3df64b90858e70 Signed-off-by: Ayushee Shah <ayushee.shah@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2643523 Reviewed-by: Divya S Sasidharan <divya.s.sasidharan@intel.com> Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* zephyr: clean up CONFIG_ZEPHYR thingJack Rosenthal2021-02-114-18/+8
| | | | | | | | | | | | | | | | Move CONFIG_ZEPHYR from Kconfig to CMakeLists.txt since it really makes no sense in Kconfig (should always be set to y). This allows us to pluck it out of config_chip.h as well. BUG=none BRANCH=none TEST=zmake testall Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: Iafb20c4b373e2c344e7c856d454080b7f008f1d9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2690987 Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: move CHROMIUM_EC definition to CMakeListsJack Rosenthal2021-02-112-1/+5
| | | | | | | | | | | | | | | | | | Move the definition of CHROMIUM_EC from config_chip.h to CMakeLists.txt, which allows ec_commands.h to be included without config.h. This clears up an occasional build hiccup we would hit when shimming new modules. BUG=b:180008545 BRANCH=none TEST=zmake buildall Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: Id1ee8a9ab65a19e083158d3b9e6cc9f2fc377de4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2690986 Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: implement console read/snapshot host commandsJack Rosenthal2021-02-117-0/+147
| | | | | | | | | | | | | | | | | | | | | Implement an optional console output buffer, and wire it up to the associated host commands. We don't use the EC's uart buffering module for this, as it implements a UART buffer which also is used for transmit buffering (we don't do that, and instead immediately send to printk). We don't use Zephyr's ring buffer structure for this as we need to track multiple heads due to the semantics of snapshots. BUG=b:178033156 BRANCH=none TEST="ectool console" on volteer Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: Ib1d39e32e8bad5b23b98034c33f56534a8c89fcb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2685412 Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: enable console channelsJack Rosenthal2021-02-112-58/+20
| | | | | | | | | | | | | | | | Delete our shim implementations of cprintf, cprints, cputs, and cflush, and bring in console_output.c and uart_printf.c instead. This requires implementing a few more uart_* functions BUG=b:178033156,b:179408111 BRANCH=none TEST=manually test the "chan" console command on volteer Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: Id0ac950af8521068b942c38bc95a193cd0695b90 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2686258 Reviewed-by: Simon Glass <sjg@chromium.org>
* common: uart: split off printf and like functions into separate moduleJack Rosenthal2021-02-114-90/+107
| | | | | | | | | | | | | | | | | | This separates the high-level uart output functions like uart_printf and uart_putc from the uart buffering module, allowing the buffering to be implemented separately from the output functions. The contract between this module and the uart_buffering layer is to implement uart_tx_char_raw and uart_tx_start. BUG=b:178033156 BRANCH=none TEST=buildall Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I5fb62ca2be1fea04654eaadd7a3806ac0c586929 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2685411 Reviewed-by: Simon Glass <sjg@chromium.org>