blob: f6751bf66c98ab266e6898132f320d831602939a [file] [log] [blame]
Thomas Abraham99a33072009-01-04 09:41:13 +05301/*
2 * TI's Davinci platform specific USB wrapper functions.
3 *
4 * Copyright (c) 2008 Texas Instruments
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; either version 2 of
9 * the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
19 * MA 02111-1307 USA
20 *
21 * Author: Thomas Abraham t-abraham@ti.com, Texas Instruments
22 */
23
24#ifndef __DAVINCI_USB_H__
25#define __DAVINCI_USB_H__
26
27#include <asm/arch/hardware.h>
28#include "musb_core.h"
29
30/* Base address of DAVINCI usb0 wrapper */
31#define DAVINCI_USB0_BASE 0x01C64000
32
33/* Base address of DAVINCI musb core */
34#define MENTOR_USB0_BASE (DAVINCI_USB0_BASE+0x400)
35
36/*
37 * Davinci platform USB wrapper register overlay. Note: Only the required
38 * registers are included in this structure. It can be expanded as required.
39 */
40struct davinci_usb_regs {
41 u32 version;
42 u32 ctrlr;
43 u32 reserved[0x20];
44 u32 intclrr;
45 u32 intmskr;
46 u32 intmsksetr;
47};
48
49#define DAVINCI_USB_TX_ENDPTS_MASK 0x1f /* ep0 + 4 tx */
50#define DAVINCI_USB_RX_ENDPTS_MASK 0x1e /* 4 rx */
51#define DAVINCI_USB_USBINT_SHIFT 16
52#define DAVINCI_USB_TXINT_SHIFT 0
53#define DAVINCI_USB_RXINT_SHIFT 8
54#define DAVINCI_INTR_DRVVBUS 0x0100
55
56#define DAVINCI_USB_USBINT_MASK 0x01ff0000 /* 8 Mentor, DRVVBUS */
57#define DAVINCI_USB_TXINT_MASK \
58 (DAVINCI_USB_TX_ENDPTS_MASK << DAVINCI_USB_TXINT_SHIFT)
59#define DAVINCI_USB_RXINT_MASK \
60 (DAVINCI_USB_RX_ENDPTS_MASK << DAVINCI_USB_RXINT_SHIFT)
61#define MGC_BUSCTL_OFFSET(_bEnd, _bOffset) \
62 (0x80 + (8*(_bEnd)) + (_bOffset))
63
64/* Integrated highspeed/otg PHY */
65#define USBPHY_CTL_PADDR (DAVINCI_SYSTEM_MODULE_BASE + 0x34)
66#define USBPHY_PHYCLKGD (1 << 8)
67#define USBPHY_SESNDEN (1 << 7) /* v(sess_end) comparator */
68#define USBPHY_VBDTCTEN (1 << 6) /* v(bus) comparator */
69#define USBPHY_PHYPLLON (1 << 4) /* override pll suspend */
70#define USBPHY_CLKO1SEL (1 << 3)
71#define USBPHY_OSCPDWN (1 << 2)
72#define USBPHY_PHYPDWN (1 << 0)
73
74/* Timeout for Davinci USB module */
75#define DAVINCI_USB_TIMEOUT 0x3FFFFFF
76
77/* IO Expander I2C address and VBUS enable mask */
78#define IOEXP_I2C_ADDR 0x3A
79#define IOEXP_VBUSEN_MASK 1
80
81/* extern functions */
82extern void lpsc_on(unsigned int id);
83extern int i2c_write(uchar chip, uint addr, int alen, uchar *buffer, int len);
84extern int i2c_read(uchar chip, uint addr, int alen, uchar *buffer, int len);
85extern void enable_vbus(void);
86#endif /* __DAVINCI_USB_H__ */