blob: eb79bf8b9079b4ebe23195e6802c09ee951cf2ab [file] [log] [blame]
Ajay Kumar Gupta0882f3e2009-12-22 10:56:13 +05301/*
Sughosh Ganu282e2af2012-08-09 10:45:20 +00002 * da8xx-usb.h -- TI's DA8xx platform specific usb wrapper definitions.
Ajay Kumar Gupta0882f3e2009-12-22 10:56:13 +05303 *
4 * Author: Ajay Kumar Gupta <ajay.gupta@ti.com>
5 *
6 * Based on drivers/usb/musb/davinci.h
7 *
8 * Copyright (C) 2009 Texas Instruments Incorporated
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 */
24#ifndef __DA8XX_MUSB_H__
25#define __DA8XX_MUSB_H__
26
27#include <asm/arch/hardware.h>
Laurence Withers377ffe22011-07-18 09:25:58 -040028#include <asm/arch/gpio.h>
Ajay Kumar Gupta0882f3e2009-12-22 10:56:13 +053029
30/* Base address of da8xx usb0 wrapper */
31#define DA8XX_USB_OTG_BASE 0x01E00000
32
33/* Base address of da8xx musb core */
34#define DA8XX_USB_OTG_CORE_BASE (DA8XX_USB_OTG_BASE + 0x400)
35
36/* Timeout for DA8xx usb module */
37#define DA8XX_USB_OTG_TIMEOUT 0x3FFFFFF
38
39/*
40 * DA8xx platform USB wrapper register overlay.
41 */
42struct da8xx_usb_regs {
43 dv_reg revision;
44 dv_reg control;
45 dv_reg status;
46 dv_reg emulation;
47 dv_reg mode;
48 dv_reg autoreq;
49 dv_reg srpfixtime;
50 dv_reg teardown;
51 dv_reg intsrc;
52 dv_reg intsrc_set;
53 dv_reg intsrc_clr;
54 dv_reg intmsk;
55 dv_reg intmsk_set;
56 dv_reg intmsk_clr;
57 dv_reg intsrcmsk;
58 dv_reg eoi;
59 dv_reg intvector;
60 dv_reg grndis_size[4];
61};
62
63#define da8xx_usb_regs ((struct da8xx_usb_regs *)DA8XX_USB_OTG_BASE)
64
65/* DA8XX interrupt bits definitions */
66#define DA8XX_USB_TX_ENDPTS_MASK 0x1f /* ep0 + 4 tx */
67#define DA8XX_USB_RX_ENDPTS_MASK 0x1e /* 4 rx */
68#define DA8XX_USB_TXINT_SHIFT 0
69#define DA8XX_USB_RXINT_SHIFT 8
70
71#define DA8XX_USB_USBINT_MASK 0x01ff0000 /* 8 Mentor, DRVVBUS */
72#define DA8XX_USB_TXINT_MASK \
73 (DA8XX_USB_TX_ENDPTS_MASK << DA8XX_USB_TXINT_SHIFT)
74#define DA8XX_USB_RXINT_MASK \
75 (DA8XX_USB_RX_ENDPTS_MASK << DA8XX_USB_RXINT_SHIFT)
76
77/* DA8xx CFGCHIP2 (USB 2.0 PHY Control) register bits */
78#define CFGCHIP2_PHYCLKGD (1 << 17)
79#define CFGCHIP2_VBUSSENSE (1 << 16)
80#define CFGCHIP2_RESET (1 << 15)
81#define CFGCHIP2_OTGMODE (3 << 13)
82#define CFGCHIP2_NO_OVERRIDE (0 << 13)
83#define CFGCHIP2_FORCE_HOST (1 << 13)
84#define CFGCHIP2_FORCE_DEVICE (2 << 13)
85#define CFGCHIP2_FORCE_HOST_VBUS_LOW (3 << 13)
86#define CFGCHIP2_USB1PHYCLKMUX (1 << 12)
87#define CFGCHIP2_USB2PHYCLKMUX (1 << 11)
88#define CFGCHIP2_PHYPWRDN (1 << 10)
89#define CFGCHIP2_OTGPWRDN (1 << 9)
90#define CFGCHIP2_DATPOL (1 << 8)
91#define CFGCHIP2_USB1SUSPENDM (1 << 7)
92#define CFGCHIP2_PHY_PLLON (1 << 6) /* override PLL suspend */
93#define CFGCHIP2_SESENDEN (1 << 5) /* Vsess_end comparator */
94#define CFGCHIP2_VBDTCTEN (1 << 4) /* Vbus comparator */
95#define CFGCHIP2_REFFREQ (0xf << 0)
96#define CFGCHIP2_REFFREQ_12MHZ (1 << 0)
97#define CFGCHIP2_REFFREQ_24MHZ (2 << 0)
98#define CFGCHIP2_REFFREQ_48MHZ (3 << 0)
99
100#define DA8XX_USB_VBUS_GPIO (1 << 15)
Sughosh Ganu282e2af2012-08-09 10:45:20 +0000101
102int usb_phy_on(void);
103void usb_phy_off(void);
104
Ajay Kumar Gupta0882f3e2009-12-22 10:56:13 +0530105#endif /* __DA8XX_MUSB_H__ */