]> git.ipfire.org Git - people/ms/u-boot.git/blame - drivers/usb/musb/omap3.c
omap3: fix compile warning
[people/ms/u-boot.git] / drivers / usb / musb / omap3.c
CommitLineData
f298e4b6
TR
1/*
2 * Copyright (c) 2009 Wind River Systems, Inc.
3 * Tom Rix <Tom.Rix@windriver.com>
4 *
5 * This is file is based on
6 * repository git.gitorious.org/u-boot-omap3/mainline.git,
7 * branch omap3-dev-usb, file drivers/usb/host/omap3530_usb.c
8 *
9 * This is the unique part of its copyright :
10 *
11 * ------------------------------------------------------------------------
12 *
13 * Copyright (c) 2009 Texas Instruments
14 *
15 * ------------------------------------------------------------------------
16 *
17 * This program is free software; you can redistribute it and/or
18 * modify it under the terms of the GNU General Public License as
19 * published by the Free Software Foundation; either version 2 of
20 * the License, or (at your option) any later version.
21 *
22 * This program is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
26 *
27 * You should have received a copy of the GNU General Public License
28 * along with this program; if not, write to the Free Software
29 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
30 * MA 02111-1307 USA
31 */
32
33#include <twl4030.h>
34#include "omap3.h"
35
36static int platform_needs_initialization = 1;
37
38struct musb_config musb_cfg = {
39 (struct musb_regs *)MENTOR_USB0_BASE,
40 OMAP3_USB_TIMEOUT,
41 0
42};
43
44/*
45 * OMAP3 USB OTG registers.
46 */
47struct omap3_otg_regs {
48 u32 revision;
49 u32 sysconfig;
50 u32 sysstatus;
51 u32 interfsel;
52 u32 simenable;
53 u32 forcestdby;
54};
55
56static struct omap3_otg_regs *otg;
57
58#define OMAP3_OTG_SYSCONFIG_SMART_STANDBY_MODE 0x2000
59#define OMAP3_OTG_SYSCONFIG_NO_STANDBY_MODE 0x1000
60#define OMAP3_OTG_SYSCONFIG_SMART_IDLE_MODE 0x0010
61#define OMAP3_OTG_SYSCONFIG_NO_IDLE_MODE 0x0008
62#define OMAP3_OTG_SYSCONFIG_ENABLEWAKEUP 0x0004
63#define OMAP3_OTG_SYSCONFIG_SOFTRESET 0x0002
64#define OMAP3_OTG_SYSCONFIG_AUTOIDLE 0x0001
65
66#define OMAP3_OTG_SYSSTATUS_RESETDONE 0x0001
67
68#define OMAP3_OTG_INTERFSEL_OMAP 0x0001
69
70#define OMAP3_OTG_FORCESTDBY_STANDBY 0x0001
71
72
73#ifdef DEBUG_MUSB_OMAP3
74static void musb_db_otg_regs(void)
75{
76 u32 l;
77 l = readl(&otg->revision);
78 serial_printf("OTG_REVISION 0x%x\n", l);
79 l = readl(&otg->sysconfig);
80 serial_printf("OTG_SYSCONFIG 0x%x\n", l);
81 l = readl(&otg->sysstatus);
82 serial_printf("OTG_SYSSTATUS 0x%x\n", l);
83 l = readl(&otg->interfsel);
84 serial_printf("OTG_INTERFSEL 0x%x\n", l);
85 l = readl(&otg->forcestdby);
86 serial_printf("OTG_FORCESTDBY 0x%x\n", l);
87}
88#endif
89
90int musb_platform_init(void)
91{
92 int ret = -1;
93
94 if (platform_needs_initialization) {
95 u32 stdby;
96
ae4caf2f
TR
97 /*
98 * OMAP3EVM uses ISP1504 phy and so
99 * twl4030 related init is not required.
100 */
101#ifdef CONFIG_TWL4030_USB
f298e4b6
TR
102 if (twl4030_usb_ulpi_init()) {
103 serial_printf("ERROR: %s Could not initialize PHY\n",
104 __PRETTY_FUNCTION__);
105 goto end;
106 }
ae4caf2f 107#endif
f298e4b6
TR
108 otg = (struct omap3_otg_regs *)OMAP3_OTG_BASE;
109
110 /* Set OTG to always be on */
111 writel(OMAP3_OTG_SYSCONFIG_NO_STANDBY_MODE |
112 OMAP3_OTG_SYSCONFIG_NO_IDLE_MODE, &otg->sysconfig);
113
114 /* Set the interface */
115 writel(OMAP3_OTG_INTERFSEL_OMAP, &otg->interfsel);
116
117 /* Clear force standby */
118 stdby = readl(&otg->forcestdby);
119 stdby &= ~OMAP3_OTG_FORCESTDBY_STANDBY;
120 writel(stdby, &otg->forcestdby);
121
122 platform_needs_initialization = 0;
123 }
124
125 ret = platform_needs_initialization;
b301be05
SP
126
127#ifdef CONFIG_TWL4030_USB
f298e4b6 128end:
b301be05 129#endif
f298e4b6
TR
130 return ret;
131
132}
133
134void musb_platform_deinit(void)
135{
136 /* noop */
137}