Skip to content

Commit 9c19d95

Browse files
committed
peci: Actually clear ESUCTRL0 before starting
Bits 1 and 2 of the register are write-cleared. Signed-off-by: Tim Crawford <tcrawford@system76.com>
1 parent 4ad25b6 commit 9c19d95

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/board/system76/common/peci.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ void peci_init(void) {}
6363
bool peci_get_temp(int16_t *const data) {
6464
//TODO: Wait for completion?
6565
// Clear upstream status
66-
ESUCTRL0 = ESUCTRL0;
66+
ESUCTRL0 = ESUCTRL0_CH_DISABLED | ESUCTRL0_DONE;
6767
// Clear OOB status
6868
ESOCTRL0 = ESOCTRL0;
6969

@@ -114,7 +114,7 @@ bool peci_get_temp(int16_t *const data) {
114114
return false;
115115
}
116116
}
117-
// Clear upstream done status
117+
// Clear upstream done status and disable initiating upstream transactions
118118
ESUCTRL0 = ESUCTRL0_DONE;
119119

120120
// Wait for response
@@ -156,7 +156,7 @@ bool peci_get_temp(int16_t *const data) {
156156
int16_t peci_wr_pkg_config(uint8_t index, uint16_t param, uint32_t data) {
157157
//TODO: Wait for completion?
158158
// Clear upstream status
159-
ESUCTRL0 = ESUCTRL0;
159+
ESUCTRL0 = ESUCTRL0_CH_DISABLED | ESUCTRL0_DONE;
160160
// Clear OOB status
161161
ESOCTRL0 = ESOCTRL0;
162162

@@ -221,7 +221,7 @@ int16_t peci_wr_pkg_config(uint8_t index, uint16_t param, uint32_t data) {
221221
return false;
222222
}
223223
}
224-
// Clear upstream done status
224+
// Clear upstream done status and disable initiating upstream transactions
225225
ESUCTRL0 = ESUCTRL0_DONE;
226226

227227
// Wait for response

src/ec/ite/include/ec/espi.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ volatile uint8_t __xdata __at(0x31A3) ESGCTRL3;
114114
volatile uint8_t __xdata __at(0x31B0) ESUCTRL0;
115115
#define ESUCTRL0_ENABLE BIT(7)
116116
#define ESUCTRL0_GO BIT(6)
117+
#define ESUCTRL0_CH_DISABLED BIT(2)
117118
#define ESUCTRL0_DONE BIT(1)
118119
#define ESUCTRL0_BUSY BIT(0)
119120

0 commit comments

Comments
 (0)