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 <shaocheng.wang@mediatek.corp-partner.google.com>
Change-Id: I3494b687b811466cb6b988164d3c5b6fecc3016a
Reviewed-on: https://review.coreboot.org/c/coreboot/+/65754
Reviewed-by: Yidi Lin <yidilin@chromium.org>
Reviewed-by: Yu-Ping Wu <yupingso@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Shaocheng Wang 2022-07-05 15:41:18 +08:00 committed by Felix Held
parent 29f1866e95
commit 15e5a3be76
4 changed files with 52 additions and 1 deletions

View File

@ -19,6 +19,7 @@ romstage-y += ../common/mmu_operations.c ../common/mmu_cmops.c
ramstage-y += emi.c ramstage-y += emi.c
ramstage-y += ../common/mmu_operations.c ../common/mmu_cmops.c ramstage-y += ../common/mmu_operations.c ../common/mmu_cmops.c
ramstage-y += soc.c ramstage-y += soc.c
ramstage-y += ../common/usb.c usb.c
CPPFLAGS_common += -Isrc/soc/mediatek/mt8188/include CPPFLAGS_common += -Isrc/soc/mediatek/mt8188/include
CPPFLAGS_common += -Isrc/soc/mediatek/common/include CPPFLAGS_common += -Isrc/soc/mediatek/common/include

View File

@ -69,7 +69,7 @@ enum {
I2C4_BASE = IO_PHYS + 0x01E01000, I2C4_BASE = IO_PHYS + 0x01E01000,
IOCFG_LT_BASE = IO_PHYS + 0x01E10000, IOCFG_LT_BASE = IO_PHYS + 0x01E10000,
IOCFG_LM_BASE = IO_PHYS + 0x01E20000, IOCFG_LM_BASE = IO_PHYS + 0x01E20000,
SSUSB_SIF_BASE = IO_PHYS + 0x01E40000, SSUSB_SIF_BASE = IO_PHYS + 0x01E40300,
IOCFG_RT_BASE = IO_PHYS + 0x01EA0000, IOCFG_RT_BASE = IO_PHYS + 0x01EA0000,
MSDC1_TOP_BASE = IO_PHYS + 0x01EB0000, MSDC1_TOP_BASE = IO_PHYS + 0x01EB0000,
I2C5_BASE = IO_PHYS + 0x01EC0000, I2C5_BASE = IO_PHYS + 0x01EC0000,

View File

@ -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 <soc/usb_common.h>
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

View File

@ -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 <device/mmio.h>
#include <gpio.h>
#include <soc/gpio.h>
#include <soc/infracfg.h>
#include <soc/pll_common.h>
#include <soc/usb.h>
void mtk_usb_prepare(void)
{
mt_pll_set_usb_clock();
/* usb drvvbus for 5v power */
gpio_output(GPIO(USB1_DRV_VBUS), 1);
}