Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 90 additions & 0 deletions .github/workflows/fork-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Fork build (tulip, hosted runner)

# Self-contained tulip EC build for forks without the Framework
# self-hosted build server. Mirrors .github/workflows/zephyr-build.yml
# (matrix entry: name tulip, ver 3.2.0, zephyr_ref fwk-main,
# cmsis_ref cros/chromeos-main) but assembles the checkout and
# toolchain on a hosted ubuntu runner instead of the pre-provisioned
# ChromiumOS chroot, following docs/zephyr/out_of_chroot.md.

on:
push:
branches:
- test-*
workflow_dispatch:

jobs:
build-tulip:
runs-on: ubuntu-latest
env:
ZEPHYR_SDK_VERSION: 0.16.8
TULIP_VER: "3.2.0"
steps:
- name: Checkout EC (this ref)
uses: actions/checkout@v4
with:
path: modules/ec

- name: Checkout Framework zephyr (fwk-main)
uses: actions/checkout@v4
with:
repository: FrameworkComputer/zephyr
ref: fwk-main
path: deps/zephyr
fetch-depth: 1

- name: Checkout CMSIS (cros chromeos-main)
run: |
git clone --depth 1 -b chromeos-main \
https://chromium.googlesource.com/chromiumos/third_party/zephyr/cmsis \
"$GITHUB_WORKSPACE/modules/cmsis"

- name: Install system packages
run: |
sudo apt-get update
sudo apt-get install -y cmake ninja-build device-tree-compiler \
flex bison swig python3-dev

- name: Install zmake and python deps
run: |
python3 -m pip install --user "$GITHUB_WORKSPACE/modules/ec/zephyr/zmake"
python3 -m pip install --user pyelftools pyyaml packaging pykwalify colorama pylibfdt
echo "$HOME/.local/bin" >> "$GITHUB_PATH"

- name: Install binman (u-boot tools)
run: |
git clone --depth 1 https://github.com/u-boot/u-boot.git "$GITHUB_WORKSPACE/deps/u-boot"
echo "TOOL_PATH_binman=$GITHUB_WORKSPACE/deps/u-boot/tools/binman/binman" >> "$GITHUB_ENV"

- name: Install Zephyr SDK (arm toolchain + host tools)
run: |
cd "$GITHUB_WORKSPACE/deps"
wget -q "https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v${ZEPHYR_SDK_VERSION}/zephyr-sdk-${ZEPHYR_SDK_VERSION}_linux-x86_64_minimal.tar.xz"
tar xf "zephyr-sdk-${ZEPHYR_SDK_VERSION}_linux-x86_64_minimal.tar.xz"
cd "zephyr-sdk-${ZEPHYR_SDK_VERSION}"
./setup.sh -t arm-zephyr-eabi -h -c
echo "ZEPHYR_SDK_INSTALL_DIR=$GITHUB_WORKSPACE/deps/zephyr-sdk-${ZEPHYR_SDK_VERSION}" >> "$GITHUB_ENV"

- name: Build tulip (versioned)
working-directory: modules/ec
run: |
zmake -D \
--zephyr-base "$GITHUB_WORKSPACE/deps/zephyr" \
--modules-dir "$GITHUB_WORKSPACE/modules" \
build -t zephyr -v "$TULIP_VER" tulip

- name: File sha256
run: sha256sum modules/ec/build/zephyr/tulip/output/ec.bin

- name: Check version embedded in binary
run: |
strings modules/ec/build/zephyr/tulip/output/ec.bin | grep tulip | tee bin-strings.txt
grep "$(echo "$GITHUB_SHA" | cut -c1-7)" bin-strings.txt

- name: Generate artifact version
run: echo "VERSIONINFO=$(date -u +'%Y-%m-%d-%H-%M-%S')_$GITHUB_SHA" >> "$GITHUB_ENV"

- uses: actions/upload-artifact@v4
with:
name: tulip.${{ env.VERSIONINFO }}
path: modules/ec/build/zephyr/tulip/output
120 changes: 0 additions & 120 deletions .github/workflows/zephyr-build.yml

This file was deleted.

18 changes: 18 additions & 0 deletions zephyr/program/framework/src/cypd_ccg8.c
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,9 @@ static void epr_flow_pending_deferred(void)
pd_port_states[port_idx].epr_retry_count = 0;
pd_port_states[port_idx].epr_support = 0;
pd_epr_in_progress &= EPR_PROCESS_MASK;
/* the transition ended, release the transition throttle */
update_pmf_events(BIT(PD_PROGRESS_ENTER_EPR_MODE), 0);
update_pmf_events(BIT(PD_PROGRESS_EXIT_EPR_MODE), 0);
if (charge_port != -1) {
int controller = PORT_TO_CONTROLLER(charge_port);
int port = PORT_TO_CONTROLLER_PORT(charge_port);
Expand Down Expand Up @@ -580,6 +583,8 @@ static void buck_ready_for_epr(void)

/* Retry mechanism */
if (++epr_buck_ctx.retry_count > 4) {
int charge_port = get_active_charge_pd_port();

if (is_enter_epr) {
CPRINTS("3Level-Buck enter epr failed, reverting to SPR mode");
board_set_buck_mode(LEVEL_BUCK_SPR);
Expand All @@ -589,6 +594,16 @@ static void buck_ready_for_epr(void)
}
epr_buck_ctx.retry_count = 0;
epr_buck_ctx.phase = BUCK_PHASE_IDLE;
/* the transition ended, restore the standing contract state */
pd_epr_in_progress &= EPR_PROCESS_MASK;
update_pmf_events(BIT(PD_PROGRESS_ENTER_EPR_MODE), 0);
update_pmf_events(BIT(PD_PROGRESS_EXIT_EPR_MODE), 0);
if (charge_port != -1) {
int controller = PORT_TO_CONTROLLER(charge_port);
int port = PORT_TO_CONTROLLER_PORT(charge_port);

cypd_update_port_state(controller, port);
}
return;
}

Expand Down Expand Up @@ -761,6 +776,9 @@ void cypd_update_epr_state(int controller, int port, int response_len)
#endif
/* EPR fail, do not retry */
pd_port_states[port_idx].epr_active = 0xff;
/* the transition ended, release the transition throttle */
update_pmf_events(BIT(PD_PROGRESS_ENTER_EPR_MODE), 0);
update_pmf_events(BIT(PD_PROGRESS_EXIT_EPR_MODE), 0);
}
}

Expand Down
5 changes: 5 additions & 0 deletions zephyr/program/framework/src/cypress_pd_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -2054,6 +2054,11 @@ void cypd_port_int(int controller, int port)
case CCG_RESPONSE_PORT_CONNECT:
CPRINTS("CYPD_RESPONSE_PORT_CONNECT %d", port_idx);
record_ucsi_connector_change_event(controller, port);
#ifdef CONFIG_PD_CCG8_EPR
/* the EPR fail latch applies to the failed connection only */
if (pd_port_states[port_idx].epr_active == 0xff)
pd_port_states[port_idx].epr_active = 0;
#endif
cypd_update_port_state(controller, port);
cypd_evaluate_port_profile(controller, port, data2[0]);
break;
Expand Down
Loading