blob: b9660ba809733180bd48f7da9652dd5ac7cfc381 [file] [log] [blame]
Ajay Kumar Gupta73592732009-12-22 10:56:13 +05301/*
2 * da8xx.h -- TI's DA8xx platform specific usb wrapper definitions.
3 *
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>
28#include <asm/arch/gpio_defs.h>
29#include "musb_core.h"
30
31/* Base address of da8xx usb0 wrapper */
32#define DA8XX_USB_OTG_BASE 0x01E00000
33
34/* Base address of da8xx musb core */
35#define DA8XX_USB_OTG_CORE_BASE (DA8XX_USB_OTG_BASE + 0x400)
36
37/* Timeout for DA8xx usb module */
38#define DA8XX_USB_OTG_TIMEOUT 0x3FFFFFF
39
40/*
41 * DA8xx platform USB wrapper register overlay.
42 */
43struct da8xx_usb_regs {
44 dv_reg revision;
45 dv_reg control;
46 dv_reg status;
47 dv_reg emulation;
48 dv_reg mode;
49 dv_reg autoreq;
50 dv_reg srpfixtime;
51 dv_reg teardown;
52 dv_reg intsrc;
53 dv_reg intsrc_set;
54 dv_reg intsrc_clr;
55 dv_reg intmsk;
56 dv_reg intmsk_set;
57 dv_reg intmsk_clr;
58 dv_reg intsrcmsk;
59 dv_reg eoi;
60 dv_reg intvector;
61 dv_reg grndis_size[4];
62};
63
64#define da8xx_usb_regs ((struct da8xx_usb_regs *)DA8XX_USB_OTG_BASE)
65
66/* DA8XX interrupt bits definitions */
67#define DA8XX_USB_TX_ENDPTS_MASK 0x1f /* ep0 + 4 tx */
68#define DA8XX_USB_RX_ENDPTS_MASK 0x1e /* 4 rx */
69#define DA8XX_USB_TXINT_SHIFT 0
70#define DA8XX_USB_RXINT_SHIFT 8
71
72#define DA8XX_USB_USBINT_MASK 0x01ff0000 /* 8 Mentor, DRVVBUS */
73#define DA8XX_USB_TXINT_MASK \
74 (DA8XX_USB_TX_ENDPTS_MASK << DA8XX_USB_TXINT_SHIFT)
75#define DA8XX_USB_RXINT_MASK \
76 (DA8XX_USB_RX_ENDPTS_MASK << DA8XX_USB_RXINT_SHIFT)
77
78/* DA8xx CFGCHIP2 (USB 2.0 PHY Control) register bits */
79#define CFGCHIP2_PHYCLKGD (1 << 17)
80#define CFGCHIP2_VBUSSENSE (1 << 16)
81#define CFGCHIP2_RESET (1 << 15)
82#define CFGCHIP2_OTGMODE (3 << 13)
83#define CFGCHIP2_NO_OVERRIDE (0 << 13)
84#define CFGCHIP2_FORCE_HOST (1 << 13)
85#define CFGCHIP2_FORCE_DEVICE (2 << 13)
86#define CFGCHIP2_FORCE_HOST_VBUS_LOW (3 << 13)
87#define CFGCHIP2_USB1PHYCLKMUX (1 << 12)
88#define CFGCHIP2_USB2PHYCLKMUX (1 << 11)
89#define CFGCHIP2_PHYPWRDN (1 << 10)
90#define CFGCHIP2_OTGPWRDN (1 << 9)
91#define CFGCHIP2_DATPOL (1 << 8)
92#define CFGCHIP2_USB1SUSPENDM (1 << 7)
93#define CFGCHIP2_PHY_PLLON (1 << 6) /* override PLL suspend */
94#define CFGCHIP2_SESENDEN (1 << 5) /* Vsess_end comparator */
95#define CFGCHIP2_VBDTCTEN (1 << 4) /* Vbus comparator */
96#define CFGCHIP2_REFFREQ (0xf << 0)
97#define CFGCHIP2_REFFREQ_12MHZ (1 << 0)
98#define CFGCHIP2_REFFREQ_24MHZ (2 << 0)
99#define CFGCHIP2_REFFREQ_48MHZ (3 << 0)
100
101#define DA8XX_USB_VBUS_GPIO (1 << 15)
102#endif /* __DA8XX_MUSB_H__ */