Rex-BC Chen | 2f9e5b9 | 2021-10-13 20:08:26 +0800 | [diff] [blame] | 1 | /* 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 Chen | 5841bf3 | 2022-04-26 15:37:59 +0800 | [diff] [blame] | 13 | #define PERI_USB_WAKEUP_DEC_CON1 0x404 |
| 14 | #define PERI_U3_WAKE_CTRL0 0x420 |
| 15 | |
Rex-BC Chen | 2f9e5b9 | 2021-10-13 20:08:26 +0800 | [diff] [blame] | 16 | void mtk_usb_prepare(void) |
| 17 | { |
Rex-BC Chen | 2f9e5b9 | 2021-10-13 20:08:26 +0800 | [diff] [blame] | 18 | gpio_output(GPIO(USB_DRVVBUS_P1), 1); |
Rex-BC Chen | 5841bf3 | 2022-04-26 15:37:59 +0800 | [diff] [blame] | 19 | |
| 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 Chen | 2f9e5b9 | 2021-10-13 20:08:26 +0800 | [diff] [blame] | 24 | } |