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 | * |
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 6 | * SPDX-License-Identifier: GPL-2.0+ |
Thomas Abraham | 99a3307 | 2009-01-04 09:41:13 +0530 | [diff] [blame] | 7 | * |
| 8 | * Author: Thomas Abraham t-abraham@ti.com, Texas Instruments |
| 9 | */ |
| 10 | |
| 11 | #ifndef __DAVINCI_USB_H__ |
| 12 | #define __DAVINCI_USB_H__ |
| 13 | |
| 14 | #include <asm/arch/hardware.h> |
| 15 | #include "musb_core.h" |
| 16 | |
| 17 | /* Base address of DAVINCI usb0 wrapper */ |
| 18 | #define DAVINCI_USB0_BASE 0x01C64000 |
| 19 | |
| 20 | /* Base address of DAVINCI musb core */ |
| 21 | #define MENTOR_USB0_BASE (DAVINCI_USB0_BASE+0x400) |
| 22 | |
| 23 | /* |
| 24 | * Davinci platform USB wrapper register overlay. Note: Only the required |
| 25 | * registers are included in this structure. It can be expanded as required. |
| 26 | */ |
| 27 | struct davinci_usb_regs { |
| 28 | u32 version; |
| 29 | u32 ctrlr; |
| 30 | u32 reserved[0x20]; |
| 31 | u32 intclrr; |
| 32 | u32 intmskr; |
| 33 | u32 intmsksetr; |
| 34 | }; |
| 35 | |
| 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 |
| 42 | |
| 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)) |
| 50 | |
| 51 | /* Integrated highspeed/otg PHY */ |
| 52 | #define USBPHY_CTL_PADDR (DAVINCI_SYSTEM_MODULE_BASE + 0x34) |
Prathap Srinivas | e53a0f6 | 2010-01-11 15:36:46 +0530 | [diff] [blame] | 53 | #define USBPHY_PHY24MHZ (1 << 13) |
Thomas Abraham | 99a3307 | 2009-01-04 09:41:13 +0530 | [diff] [blame] | 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) |
| 61 | |
| 62 | /* Timeout for Davinci USB module */ |
| 63 | #define DAVINCI_USB_TIMEOUT 0x3FFFFFF |
| 64 | |
| 65 | /* IO Expander I2C address and VBUS enable mask */ |
| 66 | #define IOEXP_I2C_ADDR 0x3A |
| 67 | #define IOEXP_VBUSEN_MASK 1 |
| 68 | |
| 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__ */ |