From 15e5a3be76826cefb8e9708bb08b12070042a9f2 Mon Sep 17 00:00:00 2001 From: Shaocheng Wang Date: Tue, 5 Jul 2022 15:41:18 +0800 Subject: soc/mediatek/mt8188: add usb host support Add usb host function support. TEST=read usb data successfully. BUG=b:236331724 Signed-off-by: Shaocheng Wang Change-Id: I3494b687b811466cb6b988164d3c5b6fecc3016a Reviewed-on: https://review.coreboot.org/c/coreboot/+/65754 Reviewed-by: Yidi Lin Reviewed-by: Yu-Ping Wu Tested-by: build bot (Jenkins) --- src/soc/mediatek/mt8188/Makefile.inc | 1 + src/soc/mediatek/mt8188/include/soc/addressmap.h | 2 +- src/soc/mediatek/mt8188/include/soc/usb.h | 29 ++++++++++++++++++++++++ src/soc/mediatek/mt8188/usb.c | 21 +++++++++++++++++ 4 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 src/soc/mediatek/mt8188/include/soc/usb.h create mode 100644 src/soc/mediatek/mt8188/usb.c (limited to 'src/soc/mediatek/mt8188') diff --git a/src/soc/mediatek/mt8188/Makefile.inc b/src/soc/mediatek/mt8188/Makefile.inc index a7458b4c4e..b754c31ecb 100644 --- a/src/soc/mediatek/mt8188/Makefile.inc +++ b/src/soc/mediatek/mt8188/Makefile.inc @@ -19,6 +19,7 @@ romstage-y += ../common/mmu_operations.c ../common/mmu_cmops.c ramstage-y += emi.c ramstage-y += ../common/mmu_operations.c ../common/mmu_cmops.c ramstage-y += soc.c +ramstage-y += ../common/usb.c usb.c CPPFLAGS_common += -Isrc/soc/mediatek/mt8188/include CPPFLAGS_common += -Isrc/soc/mediatek/common/include diff --git a/src/soc/mediatek/mt8188/include/soc/addressmap.h b/src/soc/mediatek/mt8188/include/soc/addressmap.h index 7e3f9c00cf..d54a9c690b 100644 --- a/src/soc/mediatek/mt8188/include/soc/addressmap.h +++ b/src/soc/mediatek/mt8188/include/soc/addressmap.h @@ -69,7 +69,7 @@ enum { I2C4_BASE = IO_PHYS + 0x01E01000, IOCFG_LT_BASE = IO_PHYS + 0x01E10000, IOCFG_LM_BASE = IO_PHYS + 0x01E20000, - SSUSB_SIF_BASE = IO_PHYS + 0x01E40000, + SSUSB_SIF_BASE = IO_PHYS + 0x01E40300, IOCFG_RT_BASE = IO_PHYS + 0x01EA0000, MSDC1_TOP_BASE = IO_PHYS + 0x01EB0000, I2C5_BASE = IO_PHYS + 0x01EC0000, diff --git a/src/soc/mediatek/mt8188/include/soc/usb.h b/src/soc/mediatek/mt8188/include/soc/usb.h new file mode 100644 index 0000000000..d343721390 --- /dev/null +++ b/src/soc/mediatek/mt8188/include/soc/usb.h @@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +/* + * This file is created based on MT8188 Functional Specification + * Chapter number: 5.5 + */ + +#ifndef SOC_MEDIATEK_MT8188_USB_H +#define SOC_MEDIATEK_MT8188_USB_H + +#include + +struct ssusb_sif_port { + struct sif_u2_phy_com u2phy; + u32 reserved0[64 * 5]; + struct sif_u3phyd u3phyd; + u32 reserved1[64]; + struct sif_u3phya u3phya; + struct sif_u3phya_da u3phya_da; + u32 reserved2[64 * 3]; +}; +check_member(ssusb_sif_port, u3phyd, 0x600); +check_member(ssusb_sif_port, u3phya, 0x800); +check_member(ssusb_sif_port, u3phya_da, 0x900); +check_member(ssusb_sif_port, reserved2, 0xa00); + +#define USB_PORT_NUMBER 1 + +#endif diff --git a/src/soc/mediatek/mt8188/usb.c b/src/soc/mediatek/mt8188/usb.c new file mode 100644 index 0000000000..8d1f513758 --- /dev/null +++ b/src/soc/mediatek/mt8188/usb.c @@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +/* + * This file is created based on MT8188 Functional Specification + * Chapter number: 5.5 + */ + +#include +#include +#include +#include +#include +#include + +void mtk_usb_prepare(void) +{ + mt_pll_set_usb_clock(); + + /* usb drvvbus for 5v power */ + gpio_output(GPIO(USB1_DRV_VBUS), 1); +} -- cgit v1.2.3