1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * (C) Copyright 2013
4  * Sergey Kostanbaev < sergey.kostanbaev <at> fairwaves.ru >
5  */
6 
7 #include <config.h>
8 #include <common.h>
9 
10 #if defined(CONFIG_USB_OHCI_NEW) && defined(CONFIG_SYS_USB_OHCI_CPU_INIT)
11 #include <asm/io.h>
12 #include <asm/arch/ep93xx.h>
13 
usb_cpu_init(void)14 int usb_cpu_init(void)
15 {
16 	struct syscon_regs *syscon = (struct syscon_regs *)SYSCON_BASE;
17 	unsigned long pwr = readl(&syscon->pwrcnt);
18 	writel(pwr | SYSCON_PWRCNT_USH_EN, &syscon->pwrcnt);
19 
20 	return 0;
21 }
22 
usb_cpu_stop(void)23 int usb_cpu_stop(void)
24 {
25 	struct syscon_regs *syscon = (struct syscon_regs *)SYSCON_BASE;
26 	unsigned long pwr = readl(&syscon->pwrcnt);
27 	writel(pwr &  ~SYSCON_PWRCNT_USH_EN, &syscon->pwrcnt);
28 
29 	return 0;
30 }
31 
usb_cpu_init_fail(void)32 int usb_cpu_init_fail(void)
33 {
34 	return usb_cpu_stop();
35 }
36 
37 #endif /* defined(CONFIG_USB_OHCI) && defined(CONFIG_SYS_USB_OHCI_CPU_INIT) */
38