summaryrefslogtreecommitdiff
path: root/zephyr/projects/trogdor
Commit message (Collapse)AuthorAgeFilesLines
...
* zephyr: lazor: Use correct Nuvoton EC VariantSam Hurst2021-05-113-10/+4
| | | | | | | | | | | | | | Change Zephyr Lazor Nuvoton EC variant from npcx7m7fc to npcx7m6fc. BRANCH=none BUG=b:187337449 TEST=Verified that sysjump from EC_RO to ZEPHER_RW worked. Signed-off-by: Sam Hurst <shurst@google.com> Change-Id: Ib49e5e6e5e45dd8d898ca559a897de7fedc24ced Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2885726 Reviewed-by: Wai-Hong Tam <waihong@google.com>
* mkbp: EC buttons and switches via MKBPBoris Mittelberg2021-05-101-0/+1
| | | | | | | | | | | | | | Allowing EC buttons and switches to be signaled via MKBP protocol, using CONFIG_MKBP_INPUT_DEVICES. Default behaviour is unchanged. BUG=b:170966461 BRANCH=main,firmware-dedede-13606.B,firmware-volteer-13672.B-main TEST=None Signed-off-by: Boris Mittelberg <bmbm@google.com> Cq-Depend: chromium:2824044 Change-Id: Ib96f98ecb3717a8ee8963be69fb7d7eb72e6d132 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2796382
* zephyr: lazor: Include board-specific hibernate codeWai-Hong Tam2021-05-013-2/+7
| | | | | | | | | | | | | | | | Include the board-specific hibernate code in CrOS EC directory. Add and rename the hibernate-related GPIO enums. BRANCH=None BUG=b:183745774 TEST=Built the Zephyr image and tested EC hibernate on Lazor. Verified all wake sources: power button, lid open, ACOK, and EC reset Change-Id: I2f7371e033f45227c0e53290608862e5192434f2 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2861058 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: Add ADC bindings headerKeith Short2021-04-291-0/+1
| | | | | | | | | | | | | | Add the ADC devicetree binding header to the trogdor and volteer devicetrees. BUG=b:186305651 BRANCH=none TEST=zmake testall Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I3eaf51e968ec1468dde701643e85cf333f9b44d8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2855525 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* zephyr: lazor: Fix alt motion sensorsDawid Niedzwiecki2021-04-271-24/+30
| | | | | | | | | | | | | | | | Move the alternative motion sensor to 'motionsense-sensor-alt' node, which is used to create 'motion_sensors_alt' array and 'sensor_alt_id' enum. BUG=b:183990188 BRANCH=none TEST=zmake testall Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com> Change-Id: I9dff17c9efaa97d288a9ed6a18f5f633a85d85b8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2853595 Reviewed-by: Yuval Peress <peress@chromium.org> Commit-Queue: Yuval Peress <peress@chromium.org>
* zephyr: lazor: Add kx022 sensorYuval Peress2021-04-231-3/+33
| | | | | | | | | | | | | | | | Add the kx022 as an alternate sensor for the bma255. The logic for swapping the sensors will come in future CLs associated with b:183990188. BRANCH=none BUG=b:183990188, b:185966444 TEST=zmake testall Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I681624034f63657dfcc0a352b31a0bbed61bd8db Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2846416 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* zephyr: lazor: Add sensors to lazorYuval Peress2021-04-236-3/+197
| | | | | | | | | | | | | | | | | | | Enable the motionsense task in lazor and along with it the GMR tablet mode and lid angle calculations. BRANCH=none BUG=b:185966444 TEST=zmake testall TEST=Flash on lazor and check sensors (done by keith since I don't have a board). Change-Id: Iccd1e6e0d503f759255cf3d9c162922788e915a0 Signed-off-by: Yuval Peress <peress@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2830532 Tested-by: Keith Short <keithshort@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* zephyr: lazor: add board specific lid angle implementationYuval Peress2021-04-222-0/+33
| | | | | | | | | | | | | | | Add implementation for the board specific lid_angle_peripheral_enable function (taken from board/lazor/board.c). BRANCH=none BUG=b:185966444 TEST=zmake testall Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I9067eeb8fb7b156e6fa690b007d777cd5e760d8d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2842711 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* zephyr: lazor: Fix GPIO interrupt tableDawid Niedzwiecki2021-04-161-10/+15
| | | | | | | | | | | | | | | | | | We use GPIO edge falling interrupts for some events. These one were initialized incorrectly with EC GPIO flags instead of Zephyr GPIO flags, thus the interrupts were not triggered. Change GPIO_INT_* to GPIO_INT_EDGE_* for all of them. BUG=b:182398910 BRANCH=none TEST=Build Zephyr EC for Lazor, flash Limozeen board and boot to OS, Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com> Change-Id: Id10aa010071d44f2d714eb9673ec7cad300bdf60 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2825909 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* zephyr: lazor: add the write-protection switch interruptWai-Hong Tam2021-04-161-0/+1
| | | | | | | | | | | | | | | | | | Add the write-protection switch interrupt. The switch state can be updated in time. BRANCH=None BUG=b:182398910 TEST=Changed the write-protection switch in Cr50 console. Checked the interrupts were triggered and showed the messages: [225.050900 SW 0x05] # The WP bitmask is 0x4. [230.853700 SW 0x01] Change-Id: I8bd801ac872b9f7b91895e504069f91921c9592f Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2831051 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
* Zephyr: dts: npcx: reshuffle the default IRQ priority of KBSJun Lin2021-04-161-1/+1
| | | | | | | | | | | | | | | | | Lower the interrupt priority of keyboard scan module to meet the original ECOS's setting. BRANCH=none BUG=b:184881816 TEST=Boot up on Volteer and test keyboard function. Signed-off-by: Jun Lin <CHLin56@nuvoton.com> Change-Id: Ic6b587e505edd8a3eeaeb7996a4e21ab16fdf159 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2822278 Reviewed-by: Wai-Hong Tam <waihong@google.com> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: CH Lin <chlin56@nuvoton.com> Tested-by: CH Lin <chlin56@nuvoton.com>
* zephyr: lazor: Set the hibernate wake-up gpiosMulin Chao2021-04-141-4/+14
| | | | | | | | | | | | | | | | | | | | | | Lazor uses power down RAM & deep sleep as hibernate implementation. This sets the wake-up pins for non-psl hibernate. BUG=b:183745774 BRANCH=none TEST=hibernate & wake-up form 1. lid 2. power button 3. reset pin 4. AC adaptor 5. RTC wake-up by "hibernate 5" Signed-off-by: Mulin Chao <mlchao@nuvoton.com> Signed-off-by: Wealian Liao <whliao@nuvoton.corp-partner.google.com> Change-Id: I2ad0a4f0f3dfd3d0f41e57fc215ad7a01e08aa9e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2821117 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* zephyr: npcx: Add non-psl hibernate implementationMulin Chao2021-04-141-0/+1
| | | | | | | | | | | | | | | | | | | | | | | Implements non-psl hibernate mechanism for cros_system driver. First, we plan a little hibernate function locates in the last 32K ram block in npcx7 series. Then power down the other ram blocks and go to deep sleep mode for better power consumptions. Please notice do not use global or call the other functions in this hibernate utility since we have turned off the other ram blocks. BUG=b:177904393, b:183745774 BRANCH=none TEST=zmake testall TEST=All wake-up GPIOs can wake-up ec from hibernating on npcx7 evb. Signed-off-by: Mulin Chao <mlchao@nuvoton.com> Signed-off-by: Wealian Liao <whliao@nuvoton.corp-partner.google.com> Change-Id: I48f95b0e616ad27f77a6d0ada8251ec438427741 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2821116 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* zephyr: lazor: Enable tasks for USB PD port 1Simon Glass2021-04-131-0/+3
| | | | | | | | | | | | | | | | | | | Enable these tasks so that charging can work on that port. Also drop CONFIG_PLATFORM_EC_USB_PD_USB32_DRD since this is not needed on lazor. BUG=b:183296099 BRANCH=none TEST=Build lazor on zephyr; no obvious changes when run Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I503f49b5e00d6d105dce7dcabf84ffa9f999b7c5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2822397 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Yuval Peress <peress@chromium.org> Reviewed-by: Wai-Hong Tam <waihong@google.com> Commit-Queue: Wai-Hong Tam <waihong@google.com>
* zephyr: lazor: Tweak some USB-C configsSimon Glass2021-04-131-0/+2
| | | | | | | | | | | | | | Some of the choices are incorrect here due to the defaults not lining up with what lazor wants. Fix them. BUG=b:183296099 BRANCH=none TEST=Build lazor on zephyr; no obvious changes when run Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: Id42c6db80276ba110fe12afa70823709b0b42888 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2822392 Reviewed-by: Wai-Hong Tam <waihong@google.com>
* zephyr: trogdor: Add a node for the chargerSimon Glass2021-04-131-0/+6
| | | | | | | | | | | | | | | We did this in volteer but not with trogdor. Add it for consistency and to make things easier when we move away from shimming BUG=b:183296099 BRANCH=none TEST=build zephyr on lazor and boot (no apparent change) Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I661089ead0c0d0ea97d6082cbd7a6e41939aa1ef Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2822389 Reviewed-by: Wai-Hong Tam <waihong@google.com>
* zephyr: lazor: enable verified-boot hashing functionWai-Hong Tam2021-04-131-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Verified-boot (EC software sync) asks the hash of the EC RW to check if it is a correct version. Enable the hashing function. BRANCH=None BUG=b:184981521 TEST=Modified GBB flags in the AP firmware to allow EC software sync. Checked the hash was different and performed update: check_ec_hash: Hexp RW(active): ece8070d7fba2eff80eb8c936ba3dca9b... check_ec_hash: Hmir: ece8070d7fba2eff80eb8c936ba3dca90... check_ec_hash: Heff RW(active): 5270d6de9dbca79be7cb27ef9e5fd0535... check_ec_hash: Heff != Hexp. Schedule update After updated, the hash was correct: check_ec_hash: Hexp RW(active): ece8070d7fba2eff80eb8c936ba3dca9b... check_ec_hash: Hmir: ece8070d7fba2eff80eb8c936ba3dca9b... vboot_hash_image: No valid hash (status=0 size=0). Compute one... check_ec_hash: Heff RW(active): ece8070d7fba2eff80eb8c936ba3dca9b... update_ec: Updated RW(active) successfully Change-Id: I8071579e69a38f8950aa0e70bb4bee4419d11be9 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2821853 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: npcx: Fixed the name of nodes in device-tree filesWealian Liao2021-04-132-4/+4
| | | | | | | | | | | | | | | | | | | | | | CL:2819147 fixed the name of nodes in devoce-tree file following rules: If object is 'phandles', use underscores for object name. If not, such as 'node' or 'property', use hyphens for object name. Modify the related files for build pass. BUG=none BRANCH=none TEST=zmake testall Cq-Depend: chromium:2819147 Signed-off-by: Wealian Liao <whliao@nuvoton.corp-partner.google.com> Change-Id: I70284ecb168234493d04b8b26433ec7009232132 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2817684 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* zephyr: lazor: Add LED supportDawid Niedzwiecki2021-04-123-0/+8
| | | | | | | | | | | | | | | | | | Add GPIOs to control the LED and add board/lazor/led.c to the compiled list. The color of the LED will be changing when the charging is supported. BUG=b:182398910 BRANCH=none TEST=Verfiy the LED color according to the charging state. If the charging is not supported, disable led_set_color function and set the color manually with gpioset GPIO_EC_CHG_LED_Y/B_C1 0/1. Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com> Change-Id: I910c58efa6b3771bacb264398acdcf171071f04a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2817478 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: gpio: Move named GPIO entries to devicetreeYuval Peress2021-04-082-47/+54
| | | | | | | | | | | | | | | | Migrate NAMED_GPIO() to devicetree enums. This allows us to create common boards and share the GPIO mappings in dts files. BRANCH=none BUG=none TEST=zmake testall Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I41c6151569a04628ac6dcc597f05e529327b7b46 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2804495 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com>
* zephyr: i2c mapping using an enumYuval Peress2021-04-082-25/+26
| | | | | | | | | | | | | | | | | | | | Currently, every project will need to provide a custom mapping header for i2c as well as gpios. We'd like to move that overhead to the dts files, which will make the board dts a lot more reusable as well as clean up the bringup of new boards. Add to the i2c_ports enum from the dts named i2c port list. Each enum is only added if a node exists using that enum. This also allowes for verifying that the enum is only used once. BRANCH=none BUG=b:184786824 TEST=build and flashed volteer TEST=zmake testall Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I42cc098a9badac57a3781fa9dfaf32c0ec0c5aca Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2780838
* zephyr: lazor: enable RTC host commandsWai-Hong Tam2021-04-071-0/+1
| | | | | | | | | | | | | | | | The RTC host commands are enabled by another config PLATFORM_EC_HOSTCMD_RTC. Enable it on Lazor. BRANCH=None BUG=b:182398910, b:178230662 TEST=Tested on Lazor. Disabled any network connection. Powered down AP for a while. Booted AP again and checked the time is accurate. Change-Id: Id4c2d32747b5a970ff1354c1597c1356143e36ff Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2808795 Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: lazor: enable watchdogWai-Hong Tam2021-04-061-0/+6
| | | | | | | | | | | | | | | | | | | | | Enable watchdog on Lazor. BUG=b:182398910 BRANCH=None TEST=Modified the `waitms` implementation to disable interrupt during the wait (since Zephyr-EC uses preemptive threads so some other threads can preempt the wait). Called `waitms 2000` which triggered watchdog reset, as watchdog is expired at 1600ms. Called `waitms 1000` which didn't trigger watchdog reset. Change-Id: Ibd8280f5984d1a5fe93cd1b884f5fa9a53edc983 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2803971 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Simon Glass <sjg@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>
* 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: 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>
* zephyr: Update ADC shim for Zephyr 2.5Simon Glass2021-04-021-0/+3
| | | | | | | | | | | | | | | | | 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: Add support for setting charger sense-resistorsSimon Glass2021-04-011-0/+2
| | | | | | | | | | | | | | | | | We need a different value for lazor, so move this to Kconfig. We may at some point move this to device tree. BUG=b:183296099, b:175881762 BRANCH=none TEST=with other CLs, build zephyr for lazor and see that the option is present build config for volteer and make sure it has not changed Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I7b5fa6a03ba24028006f6a1a8516e9244308fe76 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2788833 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: Set up USB-A chargingSimon Glass2021-03-311-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | There is a hidden warning in the current build: zephyr/shim/include/zephyr_gpio_signal.h:14:32: warning: excess elements in array initializer 14 | #define GPIO_SIGNAL(id) DT_CAT(GPIO_, id) ... board/lazor/usbc_config.c:158:2: note: in expansion of macro 'GPIO_EN_USB_A_5V' 158 | GPIO_EN_USB_A_ The root cause is that CONFIG_PLATFORM_EC_USB_A_PORT_COUNT is set to 0. Set it to 1 to match the ECOS board setting. BUG=b:183296099 BRANCH=none TEST=build zephyr for lazor and see the warning is gone Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I8d54d87b28d170ddbdff5c2f0a4bab4ad3a91584 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2789801 Reviewed-by: Yuval Peress <peress@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
* zephyr: lazor: enable SHIJun Lin2021-03-311-0/+3
| | | | | | | | | | | | | BUG=b:182600858 BRANCH=none TEST=AP-EC host commands communication is functional. Signed-off-by: Jun Lin <CHLin56@nuvoton.com> Change-Id: Ic9b75f1bea988a0cc6ef8193490daea475caa34e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2786889 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org> Tested-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: Generate initial coverage for every boardJeremy Bettis2021-03-301-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | Create a new ninja target 'all.libraries' which is everything that zephyr.elf depends on, but doesn't actually link the zephyr.elf binary. This allows creating coverage info for boards that run on SOCs that are too small for real coverage runs. Enabled the HAS_COVERAGE_SUPPORT for all boards, so that the all.libraries target will build with coverage enabled. HAS_COVERAGE_SUPPORT can't be set in prj files, as it is not directly user assignable. This is probably somewhat of a misuse of this flag, but nothing depends on it except for CONFIG_COVERAGE. Tweaked the instructions to exclude some more directories that are not useful code, like tests and generate headers. BUG=b:183007888 TEST=Ran commands in code_coverage.md BRANCH=none Change-Id: I6cf1b889b6b3883f7a76d1ae4957805bfa6d7b96 Signed-off-by: Jeremy Bettis <jbettis@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2786067 Tested-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jeremy Bettis <jbettis@chromium.org>
* zephyr: lazor: enable volume buttons and simulation commandWai-Hong Tam2021-03-302-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Define the volume button GPIOs. Enable the configs of volume buttons and simulation command. BRANCH=None BUG=b:182398910 TEST=Tested on Lazor. Checked the volume buttons working in Chrome. And tested the "button" command": uart:~$ button vup 200 uart:~$ [25.412800 Button 'Volume Up' was pressed] [25.415200 buttons: 2] [25.418200 HC 0x67] [25.448600 HC 0x25] +++(++)[25.612800 Button 'Volume Up' was released] [25.615400 buttons: 0] [25.617700 HC 0x67] [25.634800 HC 0x25] +++(++)button vdown 200 uart:~$ [33.391100 Button 'Volume Down' was pressed] [33.393600 buttons: 4] [33.397100 HC 0x67] [33.591500 Button 'Volume Down' was released] [33.594100 buttons: 0] [33.597400 HC 0x67] Change-Id: I2e1fbe30ed704fa57d49377fea344e0aa52c5741 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2792695 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: lazor: enable memory mapped switchesWai-Hong Tam2021-03-251-1/+1
| | | | | | | | | | | | | | | | | Enable the CONFIG_PLATFORM_EC_SWITCH. BRANCH=None BUG=b:183445211 TEST=Tested on Lazor. The following errors didn't show on depthcharge: error, assuming lid is open error, assuming lid is open error, assuming lid is open ... Change-Id: I8f1b6fc8772bb47cc98d559772ab6029fb6e0742 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2787595 Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: lazor: enable the display backlight based on the lid switchWai-Hong Tam2021-03-252-1/+2
| | | | | | | | | | | | | | | Enable the CONFIG_PLATFORM_EC_BACKLIGHT_LID. BRANCH=None BUG=b:183445211 TEST=Tested on Lazor. Display backligh ON when booting AP. Change-Id: I4a70c418b0250f77d626ad1387ac94e530c3e065 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2787467 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org> Tested-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: lazor: enable RTCWai-Hong Tam2021-03-252-0/+5
| | | | | | | | | | | | | | | | | | | | Enable PLATFORM_EC_RTC and PLATFORM_EC_CONSOLE_CMD_RTC. BRANCH=None BUG=b:182398910 TEST=Tested on Lazor. The RTC counted. Can set it. uart:~$ rtc RTC: 0x605ccb65 (1616694117.00 s) uart:~$ rtc RTC: 0x605ccb93 (1616694163.00 s) uart:~$ rtc set 12345 RTC: 0x00003039 (12345.00 s) Change-Id: Iecd67ea279508aaa28c81b6d28b7aa2e118023b2 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2787084 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: Enable link time optimization for board filesKeith Short2021-03-241-3/+3
| | | | | | | | | | | | | | | | | | | Move the baseboard and board files into the zephyr_ec library to take advantage of the LTO compiler option enabled for the zephyr_ec library. On Volteer, this reduces the image size by 832 bytes. Total LTO saving is just over 10,000 bytes. BUG=none BRANCH=none TEST=zmake testall TEST=boot zephry-ec on Volteer, verify AP boots Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I2f3aa7f6c400a5b5cd1b346fcf52160b834e66a3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2776218 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: lazor: Connect up the USB interruptsSimon Glass2021-03-241-1/+6
| | | | | | | | | | | | | | | Now that all the code is accessible to zephyr, connect up the interrupt handlers so that events are dealt with. BUG=b:183296099 BRANCH=none TEST=build zephyr for lazor Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: Ie4790ae85efb7e63fb472d3081c4288f16b31c1f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2777647 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: lazor: Add initial USC-C config into the buildSimon Glass2021-03-243-2/+57
| | | | | | | | | | | | | | | | | | Add this file into the zephyr build along with the required CONFIG options and device tree additions, so we can make a start on bringing up USB-C and charging functionality. Add all the required GPIOs here as well, so that things will work when we move the code over in the following CLs. BUG=b:183296099 BRANCH=none TEST=build zephyr for lazor Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I8c4f54664d2d18b44ed8992e61e7b2f694f04f93 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2777642 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: lazor: Add supported batteriesSimon Glass2021-03-242-0/+31
| | | | | | | | | | | | | | | Lazor supports five different batteries. Add these to the binding and create a new file to hold the battery information, as we do with GPIOs. BUG=b:183296099 BRANCH=none TEST=build zephyr for lazor Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: Ie8eac2ed08577e28d63a8119c8ced3bf825e165a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2777636 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: lazor: enable keyboard supportWai-Hong Tam2021-03-243-2/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Define the keyboard scanlines and the inverted KSO2 GPIO. Enable the keyboard-related configs. Some warning of "MKBP not cleared" or "MKBP FIFO being full" will be showed as the SHI driver is not ready. The MKBP FIFO won't be dequeued. BRANCH=None BUG=b:183445211 TEST=Tested on Lazor by pressing keys, including KSO2. uart:~$ ksstate on [26.075200 KB debounced : -- -- -- -- -- -- -- -- -- -- -- -- --] [26.079600 KB debouncing: -- -- -- -- -- -- -- -- -- -- -- -- --] Keyboard scan disable mask: 0x00000000 Keyboard scan state printing on uart:~$ [29.269700 KB state: -- 02 -- -- -- -- -- -- -- -- -- -- --] [29.392000 KB state: -- -- -- -- -- -- -- -- -- -- -- -- --] [30.244000 KB state: -- -- 01 -- -- -- -- -- -- -- -- -- --] [30.274000 MKBP not cleared within threshold, toggling.] [30.359600 KB state: -- -- -- -- -- -- -- -- -- -- -- -- --] [31.278800 MKBP not cleared within threshold, toggling.] [31.872900 KB state: -- -- 08 -- -- -- -- -- -- -- -- -- --] [32.005100 KB state: -- -- -- -- -- -- -- -- -- -- -- -- --] [33.060500 KB state: -- -- 04 -- -- -- -- -- -- -- -- -- --] [33.189500 KB state: -- -- -- -- -- -- -- -- -- -- -- -- --] [34.065100 MKBP not cleared within threshold, toggling.] [34.454100 KB state: -- -- 02 -- -- -- -- -- -- -- -- -- --] [34.556600 KB state: -- -- -- -- -- -- -- -- -- -- -- -- --] [35.069300 MKBP not cleared within threshold, toggling.] [37.356900 KB state: -- -- -- -- 08 -- -- -- -- -- -- -- --] [37.452900 KB state: -- -- -- -- -- -- -- -- -- -- -- -- --] [38.361500 MKBP not cleared within threshold, toggling.] [39.365800 MKBP not cleared within threshold, toggling.] Change-Id: I02390e85f9454d5c93cd54d333d2e242e0c54911 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2782368 Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: lazor: enable MKBP protocolWai-Hong Tam2021-03-242-0/+5
| | | | | | | | | | | | | | | | | Enable MKBP protocol. Lazor uses GPIO to interrupt the AP. So far, it just sends an interrupt to AP. Since the SHI driver is not ready, when AP sends the host command to EC, EC won't respond. BRANCH=None BUG=b:183445211 TEST=Built the image correctly. With the following CLs, tested the keyboard working on Lazor. Change-Id: Idc32926d4b187ce6f4a95158a26647ad1cea36e3 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2782367 Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: lazor: define ADC mul and div factorsWai-Hong Tam2021-03-241-0/+14
| | | | | | | | | | | | | | | | | | | | Copy the mul and div factors from board/lazor/board.c. The ADC_PSYS doesn't need the hack to handle the overflow; just set the mul factor to 124000. BUG=b:182398910 BRANCH=None TEST=Tested on Lazor: uart:~$ adc ADC_VBUS = 5060 mV ADC_AMON_BMON = 611 mV ADC_PSYS = 0 mV Change-Id: I3bd4a30eae04c584efaa2ed302b2b65e4fb4ced7 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2779749 Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: lazor: enable PLATFORM_EC_PWM_DISPLIGHTWai-Hong Tam2021-03-241-0/+1
| | | | | | | | | | | | | | | | | | | In Lazor, the display backlight is controlled by the EC chipset. The kernel driver talks to EC over host command. Enable PLATFORM_EC_PWM_DISPLIGHT such that the kernel driver knows the PWM channel for the display backlight. Can't test it yet as the host command interface is not ready. BUG=b:182398910 BRANCH=None TEST=zmake testall Change-Id: I755ccabc7d27ff028a0b5f23df4b345f1bf8ca01 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2779748 Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: lazor: enable PWMWai-Hong Tam2021-03-223-0/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Enable PWM. Lazor uses PWM 3 and 5 for keyboard backlight and display backlight. The display backlight can't be tested yet. The EN pin of the LED driver IC is connected to an AND gate. One of its input is an AP's GPIO. Since the AP power sequence is not ready yet, the IC is disabled. BUG=b:182398910 BRANCH=None TEST=Tested on Lazor: uart:~$ gpioset EN_PP5000_A 1 uart:~$ pwmduty PWM channels: 0: disabled 1: disabled uart:~$ pwmduty 0 50 # The keyboard backlight is on Setting channel 0 to 50 0: 50% uart:~$ pwmduty 0 30 Setting channel 0 to 30 0: 30% uart:~$ pwmduty 0 100 Setting channel 0 to 100 0: 100% uart:~$ pwmduty 0 -1 0: disabled Change-Id: I73dca658b54fd6d4bd7668e85d60dff915faf671 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2776215 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: lazor: enable power sequencingJack Rosenthal2021-03-222-6/+29
| | | | | | | | | | | | | | | | | | | | Enable SC7180 power sequencing code. Currently, depthcharge starts and then times out on some host commands, and the AP issues a reboot. We're going to need the SPI host interface up and going in Zephyr to get any further, so may as well submit this for now. BUG=b:183054226 BRANCH=none TEST=used serial firmware to verify that depthcharge starts, times out on some host commands, and then reboots Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I860088360480946b644fd1bb276a29266c57c614 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2774368 Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Wai-Hong Tam <waihong@google.com>
* zephyr: lazor: enable switchcapJack Rosenthal2021-03-223-1/+19
| | | | | | | | | | | | | | | Enable switchcap and SKU code from board directory, which is a dependency of power sequencing code. BUG=b:183054226 BRANCH=none TEST=observe uart prints from switchcap init and sku init Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I6cd0cff071410d45e1478da04c6422fa346f34c0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2774367 Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Wai-Hong Tam <waihong@google.com>
* zephyr: lazor: enable ADCWai-Hong Tam2021-03-183-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Enable ADC. Lazor uses ADC_0 channel 1, 2, and 3. The channel 1 is scaled down VBUS through a 1/10 voltage divider. The zephyr driver returns the exact voltage, which is VBUS * 1/10. The channel 2 is AMON_BMON voltage which is not enabled until the charger task is setup. The channel 3 is PSYS voltage which is zero. PSYS monitoring is not enabled unless the process is in S0. BUG=b:182398910 BRANCH=None TEST=Tested on Lazor: uart: ~$ adc ADC_VBUS = 500 mV ADC_AMON_BMON = 13 mV ADC_PSYS = 0 mV Change-Id: Ie45da85e24ee4a568da2542192a053d6abdd2cfc Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2774078 Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: lazor: enable I2CWai-Hong Tam2021-03-173-0/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Enable I2C. Lazor uses the I2C buses 0, 1, 2, 3, 5, and 7. Bus 3 is for WLC but no WLC connected. So leave it disabled. BUG=b:182398910 BRANCH=None TEST=Tested on Lazor: uart:~$ i2c scan I2C_0_PORT_0 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- 09 -- 0b -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 5f 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- -- 3 devices found on I2C_0_PORT_0 uart:~$ i2c scan I2C_1_PORT_0 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- 08 09 0a 0b 0c 0d 0e 0f 10: 10 11 12 13 14 15 16 17 -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: 40 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- -- 17 devices found on I2C_1_PORT_0 uart:~$ i2c scan I2C_2_PORT_0 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- 08 09 0a 0b 0c 0d 0e 0f 10: 10 11 12 13 14 15 16 17 -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: 40 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- -- 17 devices found on I2C_2_PORT_0 uart:~$ i2c scan I2C_3_PORT_0 I2C: Device driver I2C_3_PORT_0 not found. uart:~$ i2c scan I2C_5_PORT_0 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 5f 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- -- 1 devices found on I2C_5_PORT_0 uart:~$ i2c scan I2C_7_PORT_0 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- -- 1 devices found on I2C_7_PORT_0 Signed-off-by: Wai-Hong Tam <waihong@google.com> Change-Id: Ia2159bbe040f5308661911cf0dd5236d71b50484 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2765153 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: lazor: enable board version using GPIOJack Rosenthal2021-03-112-1/+7
| | | | | | | | | | | | | | | Lazor uses the Board ID pins to select the board version. Create the appropriate definitions in gpio_map.h and enable. BUG=b:102398910 BRANCH=none TEST=run "version" command, board version is 3 as expected for DVT Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: Ib2730e3fa6be01c1eacb2b986be72cd334b7ec76 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2752343 Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: add AP Kconfig options for Qualcomm SC7180Jack Rosenthal2021-03-111-0/+3
| | | | | | | | | | | | | | Add Kconfig options to enable support for Qualcomm SC7180 CPU. BUG=b:182398910 BRANCH=none TEST=compile for lazor Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: Ie3cf6b316f12af589cba3f2386a9d28d0d9c43ce Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2748279 Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>