Felix Held has submitted this change. ( https://review.coreboot.org/c/coreboot/+/63858 )
Change subject: soc/mediatek/mt8186: Prevent early USB wakeup
......................................................................
soc/mediatek/mt8186: Prevent early USB wakeup
The MT8186 platform fails to suspend due to premature wakeup by USB.
In MT8186, we use low level latch to keep USB wakeup signal. However,
hardware could latch a wrong signal if it debounces more than one time.
As a result, it would enable wakeup function too early.
To prevent this issue, we do the following modification:
- Delay about 100 us to enable wakeup function in kernel drivers [1].
- To guarantee 100 us is enough, we need to disable the USB debounce by
default in coreboot.
According to section register 0x404 and 0x420 in
"(CODA) MT8169_PERICFG_REG.xls" which is only for MediaTek internal use:
The current default value of debounce register for MT8186 USB IP0 and
IP1 is incorrect. The reason we add in coreboot is that the default
value should be correct when SoC is booting up.
This modification is only for MT8186. The subsequent SoCs will adjust
the wakeup function to correct register value by default.
[1]: 0d8cfeeef3f5 (usb: xhci-mtk: fix random remote wakeup)
TEST=after stress test, not found premature wakeup by USB
BUG=b:228773975
Signed-off-by: Rex-BC Chen <rex-bc.chen(a)mediatek.com>
Change-Id: I296c4491c5959670a39fa8bd6ef987557bbc459f
Reviewed-on: https://review.coreboot.org/c/coreboot/+/63858
Reviewed-by: Yu-Ping Wu <yupingso(a)google.com>
Reviewed-by: Paul Menzel <paulepanter(a)mailbox.org>
Reviewed-by: Hung-Te Lin <hungte(a)chromium.org>
Tested-by: build bot (Jenkins) <no-reply(a)coreboot.org>
---
M src/soc/mediatek/mt8186/include/soc/addressmap.h
M src/soc/mediatek/mt8186/usb.c
2 files changed, 9 insertions(+), 0 deletions(-)
Approvals:
build bot (Jenkins): Verified
Paul Menzel: Looks good to me, but someone else must approve
Hung-Te Lin: Looks good to me, but someone else must approve
Yu-Ping Wu: Looks good to me, approved
Rex-BC Chen: Looks good to me, but someone else must approve
diff --git a/src/soc/mediatek/mt8186/include/soc/addressmap.h b/src/soc/mediatek/mt8186/include/soc/addressmap.h
index 069e31d..0aaeb9b 100644
--- a/src/soc/mediatek/mt8186/include/soc/addressmap.h
+++ b/src/soc/mediatek/mt8186/include/soc/addressmap.h
@@ -21,6 +21,7 @@
IOCFG_BL_BASE = IO_PHYS + 0x00002600,
IOCFG_RB_BASE = IO_PHYS + 0x00002A00,
IOCFG_RT_BASE = IO_PHYS + 0x00002C00,
+ PERICFG_BASE = IO_PHYS + 0x00003000,
GPIO_BASE = IO_PHYS + 0x00005000,
SPM_BASE = IO_PHYS + 0x00006000,
RGU_BASE = IO_PHYS + 0x00007000,
diff --git a/src/soc/mediatek/mt8186/usb.c b/src/soc/mediatek/mt8186/usb.c
index 6d83abb..d133555 100644
--- a/src/soc/mediatek/mt8186/usb.c
+++ b/src/soc/mediatek/mt8186/usb.c
@@ -10,7 +10,15 @@
#include <soc/gpio.h>
#include <soc/usb.h>
+#define PERI_USB_WAKEUP_DEC_CON1 0x404
+#define PERI_U3_WAKE_CTRL0 0x420
+
void mtk_usb_prepare(void)
{
gpio_output(GPIO(USB_DRVVBUS_P1), 1);
+
+ /* disable IP0 debounce */
+ write32p(PERICFG_BASE + PERI_U3_WAKE_CTRL0, 0);
+ /* disable IP1 debounce */
+ write32p(PERICFG_BASE + PERI_USB_WAKEUP_DEC_CON1, 0);
}
--
To view, visit https://review.coreboot.org/c/coreboot/+/63858
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I296c4491c5959670a39fa8bd6ef987557bbc459f
Gerrit-Change-Number: 63858
Gerrit-PatchSet: 12
Gerrit-Owner: Rex-BC Chen <rex-bc.chen(a)mediatek.com>
Gerrit-Reviewer: Felix Held <felix-coreboot(a)felixheld.de>
Gerrit-Reviewer: Hung-Te Lin <hungte(a)chromium.org>
Gerrit-Reviewer: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-Reviewer: Rex-BC Chen <rex-bc.chen(a)mediatek.com>
Gerrit-Reviewer: Yu-Ping Wu <yupingso(a)google.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-MessageType: merged
Attention is currently required from: Martin L Roth, Michał Kopeć, Stefan Reinauer, Michael Niewöhner.
Krystian Hebel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/62497 )
Change subject: payloads/tianocore: Allow custom build parameters for custom builds
......................................................................
Patch Set 10: Code-Review+1
(2 comments)
Commit Message:
https://review.coreboot.org/c/coreboot/+/62497/comment/ac85144a_d23552d1
PS1, Line 7: for custom builds
> I'd just drop that
+1
File payloads/external/tianocore/Kconfig:
https://review.coreboot.org/c/coreboot/+/62497/comment/c4505263_7cf0879e
PS10, Line 192: string "TianoCore custom build parameters"
I would put the word 'additional' somewhere in this line. People may skip reading the full description and repeat common parameters here.
--
To view, visit https://review.coreboot.org/c/coreboot/+/62497
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I025459ae94592103b4be0c68b422100b7c649d34
Gerrit-Change-Number: 62497
Gerrit-PatchSet: 10
Gerrit-Owner: Michał Kopeć <michal.kopec(a)3mdeb.com>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Krystian Hebel <krystian.hebel(a)3mdeb.com>
Gerrit-Reviewer: Martin L Roth <martinroth(a)google.com>
Gerrit-Reviewer: Matt DeVillier <matt.devillier(a)gmail.com>
Gerrit-Reviewer: Stefan Reinauer <stefan.reinauer(a)coreboot.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Michael Niewöhner <foss(a)mniewoehner.de>
Gerrit-CC: Michał Żygowski <michal.zygowski(a)3mdeb.com>
Gerrit-CC: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-Attention: Martin L Roth <martinroth(a)google.com>
Gerrit-Attention: Michał Kopeć <michal.kopec(a)3mdeb.com>
Gerrit-Attention: Stefan Reinauer <stefan.reinauer(a)coreboot.org>
Gerrit-Attention: Michael Niewöhner <foss(a)mniewoehner.de>
Gerrit-Comment-Date: Mon, 02 May 2022 13:58:47 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: Michael Niewöhner <foss(a)mniewoehner.de>
Gerrit-MessageType: comment
Felix Held has submitted this change. ( https://review.coreboot.org/c/coreboot/+/63962 )
Change subject: soc/amd/common/block/psp/psp_gen2: rename cmd_response to buffer
......................................................................
soc/amd/common/block/psp/psp_gen2: rename cmd_response to buffer
The cmd_response field in the pspv2_mbox struct is the buffer used to
pass data to the PSP and back to the x86 side, so rename it to buffer.
This also aligns the code a bit more with the reference code. Also
rename the wr_mbox_cmd_resp function to wr_mbox_buffer_ptr.
Signed-off-by: Felix Held <felix-coreboot(a)felixheld.de>
Change-Id: I22c8971b07b3dedcc2e6e50e93c98d69ec7379e8
Reviewed-on: https://review.coreboot.org/c/coreboot/+/63962
Reviewed-by: Raul Rangel <rrangel(a)chromium.org>
Reviewed-by: Fred Reitberger <reitbergerfred(a)gmail.com>
Tested-by: build bot (Jenkins) <no-reply(a)coreboot.org>
---
M src/soc/amd/common/block/psp/psp_gen2.c
1 file changed, 4 insertions(+), 4 deletions(-)
Approvals:
build bot (Jenkins): Verified
Raul Rangel: Looks good to me, approved
Fred Reitberger: Looks good to me, but someone else must approve
diff --git a/src/soc/amd/common/block/psp/psp_gen2.c b/src/soc/amd/common/block/psp/psp_gen2.c
index 67b9391..6f46d82 100644
--- a/src/soc/amd/common/block/psp/psp_gen2.c
+++ b/src/soc/amd/common/block/psp/psp_gen2.c
@@ -23,7 +23,7 @@
u32 ready:1;
} __packed fields;
};
- u64 cmd_response;
+ u64 buffer;
} __packed;
static uintptr_t soc_get_psp_base_address(void)
@@ -76,9 +76,9 @@
return !!tmp.fields.recovery;
}
-static void wr_mbox_cmd_resp(struct pspv2_mbox *mbox, void *buffer)
+static void wr_mbox_buffer_ptr(struct pspv2_mbox *mbox, void *buffer)
{
- write64(&mbox->cmd_response, (uintptr_t)buffer);
+ write64(&mbox->buffer, (uintptr_t)buffer);
}
static int wait_command(struct pspv2_mbox *mbox, bool wait_for_ready)
@@ -121,7 +121,7 @@
return -PSPSTS_CMD_TIMEOUT;
/* set address of command-response buffer and write command register */
- wr_mbox_cmd_resp(mbox, buffer);
+ wr_mbox_buffer_ptr(mbox, buffer);
wr_mbox_cmd(mbox, command);
/* PSP clears command register when complete. All commands except
--
To view, visit https://review.coreboot.org/c/coreboot/+/63962
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I22c8971b07b3dedcc2e6e50e93c98d69ec7379e8
Gerrit-Change-Number: 63962
Gerrit-PatchSet: 2
Gerrit-Owner: Felix Held <felix-coreboot(a)felixheld.de>
Gerrit-Reviewer: Felix Held <felix-coreboot(a)felixheld.de>
Gerrit-Reviewer: Fred Reitberger <reitbergerfred(a)gmail.com>
Gerrit-Reviewer: Jason Glenesk <jason.glenesk(a)gmail.com>
Gerrit-Reviewer: Marshall Dawson <marshalldawson3rd(a)gmail.com>
Gerrit-Reviewer: Raul Rangel <rrangel(a)chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-MessageType: merged