Skip to content

Commit 90afad8

Browse files
committed
Move GCTRL,ECPM init from common to SoC code
GCTRL and ECPM are ITE system blocks. Move them out of common code. Signed-off-by: Tim Crawford <tcrawford@system76.com>
1 parent c693a46 commit 90afad8

8 files changed

Lines changed: 20 additions & 50 deletions

File tree

src/app/main/Makefile.mk

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@ app-y += acpi.c
44
app-y += battery.c
55
app-y += config.c
66
app-$(CONFIG_HAVE_DGPU) += dgpu.c
7-
app-y += ecpm.c
87
app-$(CONFIG_BUS_ESPI) += espi.c
98
app-y += fan.c
10-
app-y += gctrl.c
119
app-y += kbc.c
1210
app-y += kbscan.c
1311
app-y += keymap.c

src/app/main/ecpm.c

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/app/main/espi.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#include <common/debug.h>
88
#include <common/macro.h>
99
#include <ec/ecpm.h>
10-
#include <ec/gctrl.h>
1110
#include <ec/gpio.h>
1211

1312
#include <8051.h>

src/app/main/gctrl.c

Lines changed: 0 additions & 10 deletions
This file was deleted.

src/app/main/include/app/ecpm.h

Lines changed: 0 additions & 10 deletions
This file was deleted.

src/app/main/include/app/gctrl.h

Lines changed: 0 additions & 10 deletions
This file was deleted.

src/app/main/main.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
#include <app/battery.h>
44
#include <app/board.h>
55
#include <app/dgpu.h>
6-
#include <app/ecpm.h>
76
#include <app/fan.h>
8-
#include <app/gctrl.h>
97
#include <app/kbc.h>
108
#include <app/kbled.h>
119
#include <app/kbscan.h>
@@ -56,14 +54,12 @@ uint8_t main_cycle = 0;
5654
void init(void) {
5755
// Must happen first
5856
ec_init();
59-
gctrl_init();
6057
gpio_init();
6158

6259
// Can happen in any order
6360
#if CONFIG_HAVE_DGPU
6461
dgpu_init();
6562
#endif
66-
ecpm_init();
6763
kbc_init();
6864
kbled_init();
6965
#ifdef PARALLEL_DEBUG

src/ec/ite/ec.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
#include <ec/ec.h>
44
#include <arch/arch.h>
5+
#include <ec/ecpm.h>
56
#include <ec/gctrl.h>
67
#include <common/debug.h>
78
#include <common/macro.h>
@@ -18,6 +19,22 @@ void ec_read_post_codes(void) {
1819
#endif
1920
}
2021

22+
static void gctrl_init(void) {
23+
// Set I2EC as R/W
24+
SPCTRL1 |= 0x03;
25+
// Set PNPCFG base address
26+
BADRSEL = 0;
27+
}
28+
29+
static void ecpm_init(void) {
30+
// Clock gate EGPC, CIR, and SWUC
31+
CGCTRL2 |= BIT(6) | BIT(5) | BIT(4);
32+
// Clock gate UART, SSPI, and DBGR
33+
CGCTRL3 |= BIT(2) | BIT(1) | BIT(0);
34+
// Clock gate CEC
35+
CGCTRL4 |= BIT(0);
36+
}
37+
2138
void ec_init(void) {
2239
arch_init();
2340

@@ -29,4 +46,7 @@ void ec_init(void) {
2946
// Enable POST codes
3047
SPCTRL1 |= BIT(7) | BIT(6) | BIT(3);
3148
#endif
49+
50+
gctrl_init();
51+
ecpm_init();
3252
}

0 commit comments

Comments
 (0)