blob: d13355527d979d3386443dc316b2d33890e37365 [file] [log] [blame]
Rex-BC Chen2f9e5b92021-10-13 20:08:26 +08001/* SPDX-License-Identifier: GPL-2.0-only */
2
3/*
4 * This file is created based on MT8186 Functional Specification
5 * Chapter number: 5.5
6 */
7
8#include <device/mmio.h>
9#include <gpio.h>
10#include <soc/gpio.h>
11#include <soc/usb.h>
12
Rex-BC Chen5841bf32022-04-26 15:37:59 +080013#define PERI_USB_WAKEUP_DEC_CON1 0x404
14#define PERI_U3_WAKE_CTRL0 0x420
15
Rex-BC Chen2f9e5b92021-10-13 20:08:26 +080016void mtk_usb_prepare(void)
17{
Rex-BC Chen2f9e5b92021-10-13 20:08:26 +080018 gpio_output(GPIO(USB_DRVVBUS_P1), 1);
Rex-BC Chen5841bf32022-04-26 15:37:59 +080019
20 /* disable IP0 debounce */
21 write32p(PERICFG_BASE + PERI_U3_WAKE_CTRL0, 0);
22 /* disable IP1 debounce */
23 write32p(PERICFG_BASE + PERI_USB_WAKEUP_DEC_CON1, 0);
Rex-BC Chen2f9e5b92021-10-13 20:08:26 +080024}