• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0-only OR MIT */
2 
3 /*
4  * This file is created based on MT8188 Functional Specification
5  * Chapter number: 5.5
6  */
7 
8 #include <device/mmio.h>
9 #include <gpio.h>
10 #include <soc/infracfg.h>
11 #include <soc/pll_common.h>
12 #include <soc/usb.h>
13 
14 #define TRAP_USB20_P1_USBD1_EN 0x10005600
15 
mt_set_trapping_pin(void)16 static void mt_set_trapping_pin(void)
17 {
18 	/*
19 	 * MT8188 supports port0/port1 download. The hardware needs a trapping pin to
20 	 * select the port to use. When port1 is selected, the phy of port1 will be
21 	 * switched to port0. That is, port1 connector will be the physical line of
22 	 * port0. Since port0 phy isn't initialized in coreboot, switch back to port1
23 	 * phy.
24 	 */
25 	setbits32p(TRAP_USB20_P1_USBD1_EN, BIT(9));
26 }
27 
mtk_usb_prepare(void)28 void mtk_usb_prepare(void)
29 {
30 	mt_pll_set_usb_clock();
31 	mt_set_trapping_pin();
32 }
33