blob: f0ccb83f7acf7588c751fd78d3f743c8b6a36e00 [file] [log] [blame]
Sughosh Ganu282e2af2012-08-09 10:45:20 +00001/*
2 * Copyright (C) 2012 Sughosh Ganu <urwithsughosh@gmail.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#include <common.h>
16
17#include <asm/arch/da8xx-usb.h>
18
19int usb_cpu_init(void)
20{
21 /* enable psc for usb2.0 */
22 lpsc_on(DAVINCI_LPSC_USB20);
23
24 /* enable psc for usb1.0 */
25 lpsc_on(DAVINCI_LPSC_USB11);
26
27 /* start the on-chip usb phy and its pll */
28 if (usb_phy_on())
29 return 0;
30
31 return 1;
32}
33
34int usb_cpu_stop(void)
35{
36 usb_phy_off();
37
38 /* turn off the usb clock and assert the module reset */
39 lpsc_disable(DAVINCI_LPSC_USB11);
40 lpsc_disable(DAVINCI_LPSC_USB20);
41
42 return 0;
43}
44
45int usb_cpu_init_fail(void)
46{
47 return usb_cpu_stop();
48}