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
1 change: 0 additions & 1 deletion src/board/system76/addw2/board.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-only

#include <board/board.h>
#include <board/gctrl.h>
#include <board/gpio.h>
#include <board/kbc.h>
#include <common/debug.h>
Expand Down
1 change: 0 additions & 1 deletion src/board/system76/addw3/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include <board/battery.h>
#include <board/board.h>
#include <board/espi.h>
#include <board/gctrl.h>
#include <board/gpio.h>
#include <common/debug.h>
#include <ec/ec.h>
Expand Down
1 change: 0 additions & 1 deletion src/board/system76/addw4/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include <board/battery.h>
#include <board/board.h>
#include <board/espi.h>
#include <board/gctrl.h>
#include <board/gpio.h>
#include <common/debug.h>
#include <ec/ec.h>
Expand Down
1 change: 0 additions & 1 deletion src/board/system76/bonw14/board.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-only

#include <board/board.h>
#include <board/gctrl.h>
#include <board/gpio.h>
#include <common/debug.h>
#include <ec/ec.h>
Expand Down
2 changes: 0 additions & 2 deletions src/board/system76/common/common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ board-common-y += acpi.c
board-common-y += battery.c
board-common-y += config.c
board-common-$(CONFIG_HAVE_DGPU) += dgpu.c
board-common-y += ecpm.c
board-common-$(CONFIG_BUS_ESPI) += espi.c
board-common-y += fan.c
board-common-y += gctrl.c
board-common-y += kbc.c
board-common-y += kbscan.c
board-common-y += keymap.c
Expand Down
13 changes: 0 additions & 13 deletions src/board/system76/common/ecpm.c

This file was deleted.

1 change: 0 additions & 1 deletion src/board/system76/common/espi.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <common/debug.h>
#include <common/macro.h>
#include <ec/ecpm.h>
#include <ec/gctrl.h>
#include <ec/gpio.h>

#include <8051.h>
Expand Down
10 changes: 0 additions & 10 deletions src/board/system76/common/gctrl.c

This file was deleted.

10 changes: 0 additions & 10 deletions src/board/system76/common/include/board/ecpm.h

This file was deleted.

10 changes: 0 additions & 10 deletions src/board/system76/common/include/board/gctrl.h

This file was deleted.

8 changes: 0 additions & 8 deletions src/board/system76/common/main.c
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
// SPDX-License-Identifier: GPL-3.0-only

#include <8051.h>
#include <stdio.h>

#include <arch/arch.h>
#include <arch/delay.h>
#include <arch/time.h>
#include <board/battery.h>
#include <board/board.h>
#include <board/dgpu.h>
#include <board/ecpm.h>
#include <board/fan.h>
#include <board/gpio.h>
#include <board/gctrl.h>
#include <board/kbc.h>
#include <board/kbled.h>
#include <board/kbscan.h>
Expand Down Expand Up @@ -57,16 +52,13 @@ uint8_t main_cycle = 0;

void init(void) {
// Must happen first
arch_init();
ec_init();
gctrl_init();
gpio_init();

// Can happen in any order
#if CONFIG_HAVE_DGPU
dgpu_init();
#endif
ecpm_init();
kbc_init();
kbled_init();
#ifdef PARALLEL_DEBUG
Expand Down
1 change: 0 additions & 1 deletion src/board/system76/darp7/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include <board/board.h>
#include <board/espi.h>
#include <board/gctrl.h>
#include <board/gpio.h>
#include <common/debug.h>
#include <ec/ec.h>
Expand Down
1 change: 0 additions & 1 deletion src/board/system76/galp5/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include <board/battery.h>
#include <board/board.h>
#include <board/espi.h>
#include <board/gctrl.h>
#include <board/gpio.h>
#include <common/debug.h>
#include <ec/ec.h>
Expand Down
1 change: 0 additions & 1 deletion src/board/system76/gaze15/board.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-only

#include <board/board.h>
#include <board/gctrl.h>
#include <board/gpio.h>
#include <common/debug.h>
#include <ec/ec.h>
Expand Down
1 change: 0 additions & 1 deletion src/board/system76/gaze16-3050/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include <board/battery.h>
#include <board/board.h>
#include <board/espi.h>
#include <board/gctrl.h>
#include <board/gpio.h>
#include <common/debug.h>
#include <ec/ec.h>
Expand Down
1 change: 0 additions & 1 deletion src/board/system76/gaze16-3060/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include <board/battery.h>
#include <board/board.h>
#include <board/espi.h>
#include <board/gctrl.h>
#include <board/gpio.h>
#include <common/debug.h>
#include <ec/ec.h>
Expand Down
1 change: 0 additions & 1 deletion src/board/system76/gaze17-3050/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include <board/battery.h>
#include <board/board.h>
#include <board/espi.h>
#include <board/gctrl.h>
#include <board/gpio.h>
#include <common/debug.h>
#include <ec/ec.h>
Expand Down
1 change: 0 additions & 1 deletion src/board/system76/gaze17-3060/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include <board/battery.h>
#include <board/board.h>
#include <board/espi.h>
#include <board/gctrl.h>
#include <board/gpio.h>
#include <common/debug.h>
#include <ec/ec.h>
Expand Down
1 change: 0 additions & 1 deletion src/board/system76/lemp10/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include <board/board.h>
#include <board/espi.h>
#include <board/gctrl.h>
#include <board/gpio.h>
#include <common/debug.h>
#include <ec/ec.h>
Expand Down
1 change: 0 additions & 1 deletion src/board/system76/oryp6/board.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-only

#include <board/board.h>
#include <board/gctrl.h>
#include <board/gpio.h>
#include <common/debug.h>
#include <ec/ec.h>
Expand Down
1 change: 0 additions & 1 deletion src/board/system76/oryp7/board.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-only

#include <board/board.h>
#include <board/gctrl.h>
#include <board/gpio.h>
#include <common/debug.h>
#include <ec/ec.h>
Expand Down
1 change: 0 additions & 1 deletion src/board/system76/oryp8/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include <board/board.h>
#include <board/espi.h>
#include <board/gctrl.h>
#include <board/gpio.h>
#include <common/debug.h>
#include <ec/ec.h>
Expand Down
45 changes: 34 additions & 11 deletions src/ec/ite/ec.c
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
// SPDX-License-Identifier: GPL-3.0-only

#include <ec/ec.h>
#include <arch/arch.h>
#include <ec/ecpm.h>
#include <ec/gctrl.h>
#include <common/debug.h>
#include <common/macro.h>

void ec_init(void) {
#if CONFIG_EC_ITE_IT8587E
RSTS = (0b10U << 6) | BIT(2);
#else
RSTS = (0b01U << 6) | BIT(2);

// Enable POST codes
SPCTRL1 |= BIT(7) | BIT(6) | BIT(3);
#endif
}

void ec_read_post_codes(void) {
#if CONFIG_EC_ITE_IT5570E || CONFIG_EC_ITE_IT5571E
while (P80H81HS & 1) {
Expand All @@ -27,3 +18,35 @@ void ec_read_post_codes(void) {
}
#endif
}

static void gctrl_init(void) {
// Set I2EC as R/W
SPCTRL1 |= 0x03;
// Set PNPCFG base address
BADRSEL = 0;
}

static void ecpm_init(void) {
// Clock gate EGPC, CIR, and SWUC
CGCTRL2 |= BIT(6) | BIT(5) | BIT(4);
// Clock gate UART, SSPI, and DBGR
CGCTRL3 |= BIT(2) | BIT(1) | BIT(0);
// Clock gate CEC
CGCTRL4 |= BIT(0);
}

void ec_init(void) {
arch_init();

#if CONFIG_EC_ITE_IT8587E
RSTS = (0b10U << 6) | BIT(2);
#else
RSTS = (0b01U << 6) | BIT(2);

// Enable POST codes
SPCTRL1 |= BIT(7) | BIT(6) | BIT(3);
#endif

gctrl_init();
ecpm_init();
}