]>
Commit | Line | Data |
---|---|---|
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 | ||
d678a59d | 7 | #include <common.h> |
dc39ae95 | 8 | #include <asm/arch/clk.h> |
fefb6c10 SP |
9 | |
10 | int usb_cpu_init(void) | |
11 | { | |
dcd2f1a0 | 12 | #ifdef CONFIG_USB_ATMEL_CLK_SEL_PLLB |
9cf7385c WY |
13 | if (at91_pllb_clk_enable(get_pllb_init())) |
14 | return -1; | |
15 | ||
d9bef0ad | 16 | #ifdef CONFIG_AT91SAM9N12 |
b55b5960 | 17 | at91_usb_clk_init(AT91_PMC_USBS_USB_PLLB | AT91_PMC_USB_DIV_2); |
d9bef0ad | 18 | #endif |
dcd2f1a0 | 19 | #elif defined(CONFIG_USB_ATMEL_CLK_SEL_UPLL) |
b55b5960 WY |
20 | if (at91_upll_clk_enable()) |
21 | return -1; | |
64203c7b | 22 | |
b55b5960 | 23 | at91_usb_clk_init(AT91_PMC_USBS_USB_UPLL | AT91_PMC_USBDIV_10); |
3e0cda07 SP |
24 | #endif |
25 | ||
01c8bf5a | 26 | at91_periph_clk_enable(ATMEL_ID_UHP); |
e5e8bb05 | 27 | |
cd4de1d9 | 28 | at91_system_clk_enable(ATMEL_PMC_UHP); |
158947d2 | 29 | #if defined(CONFIG_AT91SAM9261) || defined(CONFIG_AT91SAM9G10) |
cd4de1d9 | 30 | at91_system_clk_enable(AT91_PMC_HCK0); |
d99a8ff6 | 31 | #endif |
fefb6c10 SP |
32 | |
33 | return 0; | |
34 | } | |
35 | ||
36 | int usb_cpu_stop(void) | |
37 | { | |
01c8bf5a | 38 | at91_periph_clk_disable(ATMEL_ID_UHP); |
e5e8bb05 | 39 | |
cd4de1d9 | 40 | at91_system_clk_disable(ATMEL_PMC_UHP); |
158947d2 | 41 | #if defined(CONFIG_AT91SAM9261) || defined(CONFIG_AT91SAM9G10) |
cd4de1d9 | 42 | at91_system_clk_disable(AT91_PMC_HCK0); |
d99a8ff6 | 43 | #endif |
3e0cda07 | 44 | |
dcd2f1a0 | 45 | #ifdef CONFIG_USB_ATMEL_CLK_SEL_PLLB |
d9bef0ad | 46 | #ifdef CONFIG_AT91SAM9N12 |
b55b5960 | 47 | at91_usb_clk_init(0); |
d9bef0ad | 48 | #endif |
9cf7385c WY |
49 | |
50 | if (at91_pllb_clk_disable()) | |
51 | return -1; | |
52 | ||
dcd2f1a0 | 53 | #elif defined(CONFIG_USB_ATMEL_CLK_SEL_UPLL) |
b55b5960 WY |
54 | if (at91_upll_clk_disable()) |
55 | return -1; | |
3e0cda07 SP |
56 | #endif |
57 | ||
fefb6c10 SP |
58 | return 0; |
59 | } | |
60 | ||
61 | int usb_cpu_init_fail(void) | |
62 | { | |
63 | return usb_cpu_stop(); | |
64 | } |