Thomas Abraham | 99a3307 | 2009-01-04 09:41:13 +0530 | [diff] [blame] | 1 | /* |
| 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 | */ |
| 40 | struct 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) |
Prathap Srinivas | e53a0f6 | 2010-01-11 15:36:46 +0530 | [diff] [blame] | 66 | #define USBPHY_PHY24MHZ (1 << 13) |
Thomas Abraham | 99a3307 | 2009-01-04 09:41:13 +0530 | [diff] [blame] | 67 | #define USBPHY_PHYCLKGD (1 << 8) |
| 68 | #define USBPHY_SESNDEN (1 << 7) /* v(sess_end) comparator */ |
| 69 | #define USBPHY_VBDTCTEN (1 << 6) /* v(bus) comparator */ |
| 70 | #define USBPHY_PHYPLLON (1 << 4) /* override pll suspend */ |
| 71 | #define USBPHY_CLKO1SEL (1 << 3) |
| 72 | #define USBPHY_OSCPDWN (1 << 2) |
| 73 | #define USBPHY_PHYPDWN (1 << 0) |
| 74 | |
| 75 | /* Timeout for Davinci USB module */ |
| 76 | #define DAVINCI_USB_TIMEOUT 0x3FFFFFF |
| 77 | |
| 78 | /* IO Expander I2C address and VBUS enable mask */ |
| 79 | #define IOEXP_I2C_ADDR 0x3A |
| 80 | #define IOEXP_VBUSEN_MASK 1 |
| 81 | |
| 82 | /* extern functions */ |
| 83 | extern void lpsc_on(unsigned int id); |
| 84 | extern int i2c_write(uchar chip, uint addr, int alen, uchar *buffer, int len); |
| 85 | extern int i2c_read(uchar chip, uint addr, int alen, uchar *buffer, int len); |
| 86 | extern void enable_vbus(void); |
| 87 | #endif /* __DAVINCI_USB_H__ */ |