2 * TI's Davinci platform specific USB wrapper functions.
4 * Copyright (c) 2008 Texas Instruments
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.
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.
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,
21 * Author: Thomas Abraham t-abraham@ti.com, Texas Instruments
24 #ifndef __DAVINCI_USB_H__
25 #define __DAVINCI_USB_H__
27 #include <asm/arch/hardware.h>
28 #include "musb_core.h"
30 /* Base address of DAVINCI usb0 wrapper */
31 #define DAVINCI_USB0_BASE 0x01C64000
33 /* Base address of DAVINCI musb core */
34 #define MENTOR_USB0_BASE (DAVINCI_USB0_BASE+0x400)
37 * Davinci platform USB wrapper register overlay. Note: Only the required
38 * registers are included in this structure. It can be expanded as required.
40 struct davinci_usb_regs {
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
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))
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)
74 /* Timeout for Davinci USB module */
75 #define DAVINCI_USB_TIMEOUT 0x3FFFFFF
77 /* IO Expander I2C address and VBUS enable mask */
78 #define IOEXP_I2C_ADDR 0x3A
79 #define IOEXP_VBUSEN_MASK 1
81 /* extern functions */
82 extern void lpsc_on(unsigned int id);
83 extern int i2c_write(uchar chip, uint addr, int alen, uchar *buffer, int len);
84 extern int i2c_read(uchar chip, uint addr, int alen, uchar *buffer, int len);
85 extern void enable_vbus(void);
86 #endif /* __DAVINCI_USB_H__ */