Merge branch 'next'
[u-boot/qq2440-u-boot.git] / drivers / usb / musb / davinci.h
blob9efefe81df1620d3d36d5cf6c4e04466809fabfb
1 /*
2 * TI's Davinci platform specific USB wrapper functions.
4 * Copyright (c) 2008 Texas Instruments
6 * SPDX-License-Identifier: GPL-2.0+
8 * Author: Thomas Abraham t-abraham@ti.com, Texas Instruments
9 */
11 #ifndef __DAVINCI_USB_H__
12 #define __DAVINCI_USB_H__
14 #include <asm/arch/hardware.h>
15 #include "musb_core.h"
17 /* Base address of DAVINCI usb0 wrapper */
18 #define DAVINCI_USB0_BASE 0x01C64000
20 /* Base address of DAVINCI musb core */
21 #define MENTOR_USB0_BASE (DAVINCI_USB0_BASE+0x400)
24 * Davinci platform USB wrapper register overlay. Note: Only the required
25 * registers are included in this structure. It can be expanded as required.
27 struct davinci_usb_regs {
28 u32 version;
29 u32 ctrlr;
30 u32 reserved[0x20];
31 u32 intclrr;
32 u32 intmskr;
33 u32 intmsksetr;
36 #define DAVINCI_USB_TX_ENDPTS_MASK 0x1f /* ep0 + 4 tx */
37 #define DAVINCI_USB_RX_ENDPTS_MASK 0x1e /* 4 rx */
38 #define DAVINCI_USB_USBINT_SHIFT 16
39 #define DAVINCI_USB_TXINT_SHIFT 0
40 #define DAVINCI_USB_RXINT_SHIFT 8
41 #define DAVINCI_INTR_DRVVBUS 0x0100
43 #define DAVINCI_USB_USBINT_MASK 0x01ff0000 /* 8 Mentor, DRVVBUS */
44 #define DAVINCI_USB_TXINT_MASK \
45 (DAVINCI_USB_TX_ENDPTS_MASK << DAVINCI_USB_TXINT_SHIFT)
46 #define DAVINCI_USB_RXINT_MASK \
47 (DAVINCI_USB_RX_ENDPTS_MASK << DAVINCI_USB_RXINT_SHIFT)
48 #define MGC_BUSCTL_OFFSET(_bEnd, _bOffset) \
49 (0x80 + (8*(_bEnd)) + (_bOffset))
51 /* Integrated highspeed/otg PHY */
52 #define USBPHY_CTL_PADDR (DAVINCI_SYSTEM_MODULE_BASE + 0x34)
53 #define USBPHY_PHY24MHZ (1 << 13)
54 #define USBPHY_PHYCLKGD (1 << 8)
55 #define USBPHY_SESNDEN (1 << 7) /* v(sess_end) comparator */
56 #define USBPHY_VBDTCTEN (1 << 6) /* v(bus) comparator */
57 #define USBPHY_PHYPLLON (1 << 4) /* override pll suspend */
58 #define USBPHY_CLKO1SEL (1 << 3)
59 #define USBPHY_OSCPDWN (1 << 2)
60 #define USBPHY_PHYPDWN (1 << 0)
62 /* Timeout for Davinci USB module */
63 #define DAVINCI_USB_TIMEOUT 0x3FFFFFF
65 /* IO Expander I2C address and VBUS enable mask */
66 #define IOEXP_I2C_ADDR 0x3A
67 #define IOEXP_VBUSEN_MASK 1
69 /* extern functions */
70 extern void lpsc_on(unsigned int id);
71 extern int i2c_write(uchar chip, uint addr, int alen, uchar *buffer, int len);
72 extern int i2c_read(uchar chip, uint addr, int alen, uchar *buffer, int len);
73 extern void enable_vbus(void);
74 #endif /* __DAVINCI_USB_H__ */