]> git.ipfire.org Git - thirdparty/u-boot.git/blame - drivers/usb/host/ohci-at91.c
SPDX: Convert all of our single license tags to Linux Kernel style
[thirdparty/u-boot.git] / drivers / usb / host / ohci-at91.c
CommitLineData
83d290c5 1// SPDX-License-Identifier: GPL-2.0+
fefb6c10
SP
2/*
3 * (C) Copyright 2006
567fb852 4 * DENX Software Engineering <mk@denx.de>
fefb6c10
SP
5 */
6
7#include <common.h>
8
6d0f6bcf 9#if defined(CONFIG_USB_OHCI_NEW) && defined(CONFIG_SYS_USB_OHCI_CPU_INIT)
fefb6c10 10
dc39ae95 11#include <asm/arch/clk.h>
fefb6c10
SP
12
13int usb_cpu_init(void)
14{
dcd2f1a0 15#ifdef CONFIG_USB_ATMEL_CLK_SEL_PLLB
9cf7385c
WY
16 if (at91_pllb_clk_enable(get_pllb_init()))
17 return -1;
18
d9bef0ad 19#ifdef CONFIG_AT91SAM9N12
b55b5960 20 at91_usb_clk_init(AT91_PMC_USBS_USB_PLLB | AT91_PMC_USB_DIV_2);
d9bef0ad 21#endif
dcd2f1a0 22#elif defined(CONFIG_USB_ATMEL_CLK_SEL_UPLL)
b55b5960
WY
23 if (at91_upll_clk_enable())
24 return -1;
64203c7b 25
b55b5960 26 at91_usb_clk_init(AT91_PMC_USBS_USB_UPLL | AT91_PMC_USBDIV_10);
3e0cda07
SP
27#endif
28
01c8bf5a 29 at91_periph_clk_enable(ATMEL_ID_UHP);
e5e8bb05 30
cd4de1d9 31 at91_system_clk_enable(ATMEL_PMC_UHP);
158947d2 32#if defined(CONFIG_AT91SAM9261) || defined(CONFIG_AT91SAM9G10)
cd4de1d9 33 at91_system_clk_enable(AT91_PMC_HCK0);
d99a8ff6 34#endif
fefb6c10
SP
35
36 return 0;
37}
38
39int usb_cpu_stop(void)
40{
01c8bf5a 41 at91_periph_clk_disable(ATMEL_ID_UHP);
e5e8bb05 42
cd4de1d9 43 at91_system_clk_disable(ATMEL_PMC_UHP);
158947d2 44#if defined(CONFIG_AT91SAM9261) || defined(CONFIG_AT91SAM9G10)
cd4de1d9 45 at91_system_clk_disable(AT91_PMC_HCK0);
d99a8ff6 46#endif
3e0cda07 47
dcd2f1a0 48#ifdef CONFIG_USB_ATMEL_CLK_SEL_PLLB
d9bef0ad 49#ifdef CONFIG_AT91SAM9N12
b55b5960 50 at91_usb_clk_init(0);
d9bef0ad 51#endif
9cf7385c
WY
52
53 if (at91_pllb_clk_disable())
54 return -1;
55
dcd2f1a0 56#elif defined(CONFIG_USB_ATMEL_CLK_SEL_UPLL)
b55b5960
WY
57 if (at91_upll_clk_disable())
58 return -1;
3e0cda07
SP
59#endif
60
fefb6c10
SP
61 return 0;
62}
63
64int usb_cpu_init_fail(void)
65{
66 return usb_cpu_stop();
67}
68
6d0f6bcf 69#endif /* defined(CONFIG_USB_OHCI) && defined(CONFIG_SYS_USB_OHCI_CPU_INIT) */