summaryrefslogtreecommitdiff
path: root/drivers/usb/host/ohci-ep93xx.c
blob: 9654fa2996f8ac5f4e140da3120b43ae990b50b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// SPDX-License-Identifier: GPL-2.0+
/*
 * (C) Copyright 2013
 * Sergey Kostanbaev < sergey.kostanbaev <at> fairwaves.ru >
 */

#include <config.h>
#include <common.h>

#if defined(CONFIG_USB_OHCI_NEW) && defined(CONFIG_SYS_USB_OHCI_CPU_INIT)
#include <asm/io.h>
#include <asm/arch/ep93xx.h>

int usb_cpu_init(void)
{
	struct syscon_regs *syscon = (struct syscon_regs *)SYSCON_BASE;
	unsigned long pwr = readl(&syscon->pwrcnt);
	writel(pwr | SYSCON_PWRCNT_USH_EN, &syscon->pwrcnt);

	return 0;
}

int usb_cpu_stop(void)
{
	struct syscon_regs *syscon = (struct syscon_regs *)SYSCON_BASE;
	unsigned long pwr = readl(&syscon->pwrcnt);
	writel(pwr &  ~SYSCON_PWRCNT_USH_EN, &syscon->pwrcnt);

	return 0;
}

int usb_cpu_init_fail(void)
{
	return usb_cpu_stop();
}

#endif /* defined(CONFIG_USB_OHCI) && defined(CONFIG_SYS_USB_OHCI_CPU_INIT) */