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