summaryrefslogtreecommitdiff
path: root/zephyr/program/nissa/nereid/src/usbc.c
Commit message (Collapse)AuthorAgeFilesLines
* charger: Move charger_state_v2.h into charge_state.hSimon Glass2023-05-111-1/+1
| | | | | | | | | | | | | | | | | | | | We don't have a v1 anymore, so the name makes no sense. Move it into the existing file. Include charge_state.h instead of v2, doing this in the same change to avoid build errors. This makes no functional change. BUG=b:218332694 TEST=make buildall Change-Id: Ic3e3adc45e4d002c2cd5ba8aa65e24686e01d628 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4516191 Reviewed-by: Tim Van Patten <timvp@google.com> Commit-Queue: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org> Reviewed-by: Yuval Peress <peress@google.com>
* zephyr: Eliminate pointer from SYS_INIT functionsKeith Short2023-04-171-1/+1
| | | | | | | | | | | | | | | | | | | | The upstream change https://github.com/zephyrproject-rtos/zephyr/pull/51217 modified the function signature for the SYS_INIT call, eliminating the unused device pointer. Run the Zephyr provided script ./zephyr/scripts/utils/migrate_sys_init.py to update all callers. BUG=b:278595739 BRANCH=none TEST=zmake build -a Cq-Depend: chromium:4422804 Change-Id: I881bc536cef43a7c3ac4bc5eb3ce1893237bbd1f Signed-off-by: Keith Short <keithshort@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4437049 Reviewed-by: Tristan Honscheid <honscheid@google.com>
* nissa: process shared BC1.2 interrupts alongside other PD interruptsPeter Marheine2023-03-161-57/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | BC1.2 runs at a low priority and can cause the same kinds of priority inversion as the charger can. On devices using PS8745 in particular, we've found that BC1.2 interrupts can block timely processing of TCPC interrupts which results in the TCPM violating the TRANSMIT register requirements in TCPCI specification section 4.4.15 where the TCPM "shall clear the resulting alert from a prior TRANSMIT write before writing to the TRANSMIT register again" with some particular communication patterns, causing an I2CInterfaceError on the PS8745 that is never cleared (which causes the affected port to stop responding completely). Running BC1.2 interrupts synchronously and polling the shared IRQ GPIO to retrigger PD interrupts ensures that PD interrupts will always be handled at a higher priority than regular PD communication, preventing this problematic delayed interrupt processing. BUG=b:269064073 TEST=The USB-C1 interrupt on Yaviks no longer gets stuck asserted when connected to an HP U28 or M27 monitor; charging still works as expected on Craask for both ports. BRANCH=nissa Change-Id: I2d573fcbe3b471b9f93a98fc3b401141c26daf7d Signed-off-by: Peter Marheine <pmarheine@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4335462 Reviewed-by: Kangheui Won <khwon@chromium.org>
* nissa: disable PLATFORM_EC_TCPC_INTERRUPTPeter Marheine2023-02-151-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Because nissa shares a physical IRQ pin between BC1.2 and TCPC on type-C ports, using the shim interrupt handler can cause TCPC interrupts to be lost in some situations: 1. BC1.2 asserts IRQ 2. Type-C ISR runs, checks alerts and goes back to sleep (because no TCPC interrupts are pending). 3. TCPC asserts IRQ (which remains asserted because BC1.2 still has a pending interrupt). 4. BC1.2 task clears BC1.2 interrupt. 5. IRQ is stuck asserted because the TCPC interrupt task will only wake up on the next active IRQ edge. Port is broken. This change restores the custom shared IRQ handling for Nissa that adds polling to ensure IRQs cannot become permanently stuck. BUG=b:254148652,b:269212593 TEST=Sinking, sourcing and USB still work on Yaviks port C1 BRANCH=nissa Change-Id: Ie45ec82c68ce7ebc8693ea2ebab9a141e96edbab Signed-off-by: Peter Marheine <pmarheine@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4252437 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: zhi cheng yuan <jasonyuan@chromium.org>
* zephyr: move usbc interrupt handler to shimJason Yuan2023-02-091-1/+0
| | | | | | | | | | | | | | | | | | | TCPC interrupt no longer uses gpio-int. Instead the shim tcpc completely handles its own interrupt. An optional config is added to allow projects to use the legacy tcpc interrupt. The program intelrvp is excluded from this CL. BUG=b:254148652 TEST=twister, usbc charging on villager, lazor, and xivu BRANCH=none Change-Id: Ieeb4fb61ca6cf8f44df212a6cf520d265cff5147 Signed-off-by: Jason Yuan <jasonyuan@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4108942 Commit-Queue: zhi cheng yuan <jasonyuan@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Tested-by: Diana Z <dzigterman@chromium.org>
* nissa: Decouple sub-board dependencyAndrew McRae2022-12-151-1/+0
| | | | | | | | | | | | | | | | Decouple the sub-board processing from common nissa code so that variants do not need to include the fw_config for sub-boards, nor the sub-board support functions. BUG=none TEST=twister -T zephyr/test; zmake build --all BRANCH=none Change-Id: I4382b94c0493b30103d22c1c28d8bf46142136e9 Signed-off-by: Andrew McRae <amcrae@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4104646 Reviewed-by: Peter Marheine <pmarheine@chromium.org>
* nissa: use device tree for USB-C configAdam Mills2022-11-251-24/+0
| | | | | | | | | | | | | | | | | Enable support for USB-C configuration on Nissa boards through the device tree rather than in code. BUG=b:213963699 TEST=zmake build -a; Flashed Nereid and Craask devices and verified USB-C ports working. BRANCH=main LOW_COVERAGE_REASON=Nissa specific changes. Change-Id: I2d840da5db5291066f206d9bf3d28dc0bca98307 Signed-off-by: Adam Mills <adamjmills@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4054313 Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Reviewed-by: Peter Marheine <pmarheine@chromium.org>
* zephyr/program: Sort header filesJeremy Bettis2022-11-211-7/+7
| | | | | | | | | | | | | | | | | | | | Sort all headers in zephyr/test with the clang-format rules used by the zephyr project. BRANCH=None BUG=b:247100970 TEST=zmake build -a TEST=./twister --clobber -v -i TEST=make -j$(nproc) buildall_only runtests TEST=zmake compare-builds Signed-off-by: Jeremy Bettis <jbettis@google.com> Change-Id: Ibd81df9a27fc0c934b4134106d6f09487439c245 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4039149 Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Aaron Massey <aaronmassey@google.com> Tested-by: Jeremy Bettis <jbettis@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
* zephyr: rename projects folder to programKeith Short2022-11-041-0/+393
Renme the projects folder to program for consistency with the name scheme used by the boxster configuration. BUG=b:254097139 BRANCH=none TEST=zmake compare-builds -a TEST=twister Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: Ib56a57f1e5942e6dd0460e3be81722896eed72af Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3968444 Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Jeremy Bettis <jbettis@chromium.org>