Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 1 | // include/asm-arm/mach-omap/usb.h |
| 2 | |
| 3 | #ifndef __ASM_ARCH_OMAP_USB_H |
| 4 | #define __ASM_ARCH_OMAP_USB_H |
| 5 | |
Maulik Mankad | 884b836 | 2010-02-17 14:09:30 -0800 | [diff] [blame] | 6 | #include <linux/usb/musb.h> |
Tony Lindgren | ce491cf | 2009-10-20 09:40:47 -0700 | [diff] [blame] | 7 | #include <plat/board.h> |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 8 | |
Anand Gadiyar | 83720a8 | 2009-11-22 10:11:00 -0800 | [diff] [blame] | 9 | #define OMAP3_HS_USB_PORTS 3 |
| 10 | enum ehci_hcd_omap_mode { |
| 11 | EHCI_HCD_OMAP_MODE_UNKNOWN, |
| 12 | EHCI_HCD_OMAP_MODE_PHY, |
| 13 | EHCI_HCD_OMAP_MODE_TLL, |
| 14 | }; |
| 15 | |
Anand Gadiyar | 95344fc | 2010-05-10 21:56:10 +0530 | [diff] [blame] | 16 | enum ohci_omap3_port_mode { |
| 17 | OMAP_OHCI_PORT_MODE_UNUSED, |
| 18 | OMAP_OHCI_PORT_MODE_PHY_6PIN_DATSE0, |
| 19 | OMAP_OHCI_PORT_MODE_PHY_6PIN_DPDM, |
| 20 | OMAP_OHCI_PORT_MODE_PHY_3PIN_DATSE0, |
| 21 | OMAP_OHCI_PORT_MODE_PHY_4PIN_DPDM, |
| 22 | OMAP_OHCI_PORT_MODE_TLL_6PIN_DATSE0, |
| 23 | OMAP_OHCI_PORT_MODE_TLL_6PIN_DPDM, |
| 24 | OMAP_OHCI_PORT_MODE_TLL_3PIN_DATSE0, |
| 25 | OMAP_OHCI_PORT_MODE_TLL_4PIN_DPDM, |
| 26 | OMAP_OHCI_PORT_MODE_TLL_2PIN_DATSE0, |
| 27 | OMAP_OHCI_PORT_MODE_TLL_2PIN_DPDM, |
| 28 | }; |
| 29 | |
Anand Gadiyar | 83720a8 | 2009-11-22 10:11:00 -0800 | [diff] [blame] | 30 | struct ehci_hcd_omap_platform_data { |
| 31 | enum ehci_hcd_omap_mode port_mode[OMAP3_HS_USB_PORTS]; |
| 32 | unsigned phy_reset:1; |
| 33 | |
| 34 | /* have to be valid if phy_reset is true and portx is in phy mode */ |
| 35 | int reset_gpio_port[OMAP3_HS_USB_PORTS]; |
| 36 | }; |
| 37 | |
Anand Gadiyar | 95344fc | 2010-05-10 21:56:10 +0530 | [diff] [blame] | 38 | struct ohci_hcd_omap_platform_data { |
| 39 | enum ohci_omap3_port_mode port_mode[OMAP3_HS_USB_PORTS]; |
| 40 | |
| 41 | /* Set this to true for ES2.x silicon */ |
| 42 | unsigned es2_compatibility:1; |
| 43 | }; |
| 44 | |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 45 | /*-------------------------------------------------------------------------*/ |
| 46 | |
| 47 | #define OMAP1_OTG_BASE 0xfffb0400 |
| 48 | #define OMAP1_UDC_BASE 0xfffb4000 |
| 49 | #define OMAP1_OHCI_BASE 0xfffba000 |
| 50 | |
| 51 | #define OMAP2_OHCI_BASE 0x4805e000 |
| 52 | #define OMAP2_UDC_BASE 0x4805e200 |
| 53 | #define OMAP2_OTG_BASE 0x4805e300 |
| 54 | |
| 55 | #ifdef CONFIG_ARCH_OMAP1 |
| 56 | |
| 57 | #define OTG_BASE OMAP1_OTG_BASE |
| 58 | #define UDC_BASE OMAP1_UDC_BASE |
| 59 | #define OMAP_OHCI_BASE OMAP1_OHCI_BASE |
| 60 | |
| 61 | #else |
| 62 | |
| 63 | #define OTG_BASE OMAP2_OTG_BASE |
| 64 | #define UDC_BASE OMAP2_UDC_BASE |
| 65 | #define OMAP_OHCI_BASE OMAP2_OHCI_BASE |
| 66 | |
Maulik Mankad | 884b836 | 2010-02-17 14:09:30 -0800 | [diff] [blame] | 67 | struct omap_musb_board_data { |
| 68 | u8 interface_type; |
| 69 | u8 mode; |
Ajay Kumar Gupta | 1e75345 | 2010-03-25 13:14:23 +0200 | [diff] [blame] | 70 | u16 power; |
Ajay Kumar Gupta | 58815fa | 2010-03-25 13:25:27 +0200 | [diff] [blame] | 71 | unsigned extvbus:1; |
Maulik Mankad | 884b836 | 2010-02-17 14:09:30 -0800 | [diff] [blame] | 72 | }; |
| 73 | |
| 74 | enum musb_interface {MUSB_INTERFACE_ULPI, MUSB_INTERFACE_UTMI}; |
| 75 | |
| 76 | extern void usb_musb_init(struct omap_musb_board_data *board_data); |
Felipe Balbi | 18cb7ac | 2009-03-23 18:34:06 -0700 | [diff] [blame] | 77 | |
Felipe Balbi | 6f69a18 | 2010-03-04 09:45:53 +0200 | [diff] [blame] | 78 | extern void usb_ehci_init(const struct ehci_hcd_omap_platform_data *pdata); |
Anand Gadiyar | 83720a8 | 2009-11-22 10:11:00 -0800 | [diff] [blame] | 79 | |
Anand Gadiyar | 95344fc | 2010-05-10 21:56:10 +0530 | [diff] [blame] | 80 | extern void usb_ohci_init(const struct ohci_hcd_omap_platform_data *pdata); |
| 81 | |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 82 | #endif |
| 83 | |
Tony Lindgren | b5e8905 | 2010-07-05 16:31:29 +0300 | [diff] [blame^] | 84 | void omap_otg_init(struct omap_usb_config *config); |
Felipe Balbi | b0b5aa3 | 2009-03-23 18:07:49 -0700 | [diff] [blame] | 85 | void omap_usb_init(struct omap_usb_config *pdata); |
Tony Lindgren | b5e8905 | 2010-07-05 16:31:29 +0300 | [diff] [blame^] | 86 | void omap2_usbfs_init(struct omap_usb_config *pdata); |
| 87 | #else |
| 88 | static inline omap2_usbfs_init(struct omap_usb_config *pdata) |
| 89 | { |
| 90 | } |
| 91 | #endif |
Felipe Balbi | b0b5aa3 | 2009-03-23 18:07:49 -0700 | [diff] [blame] | 92 | |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 93 | /*-------------------------------------------------------------------------*/ |
| 94 | |
| 95 | /* |
| 96 | * OTG and transceiver registers, for OMAPs starting with ARM926 |
| 97 | */ |
| 98 | #define OTG_REV (OTG_BASE + 0x00) |
| 99 | #define OTG_SYSCON_1 (OTG_BASE + 0x04) |
| 100 | # define USB2_TRX_MODE(w) (((w)>>24)&0x07) |
| 101 | # define USB1_TRX_MODE(w) (((w)>>20)&0x07) |
| 102 | # define USB0_TRX_MODE(w) (((w)>>16)&0x07) |
| 103 | # define OTG_IDLE_EN (1 << 15) |
| 104 | # define HST_IDLE_EN (1 << 14) |
| 105 | # define DEV_IDLE_EN (1 << 13) |
| 106 | # define OTG_RESET_DONE (1 << 2) |
| 107 | # define OTG_SOFT_RESET (1 << 1) |
| 108 | #define OTG_SYSCON_2 (OTG_BASE + 0x08) |
| 109 | # define OTG_EN (1 << 31) |
| 110 | # define USBX_SYNCHRO (1 << 30) |
| 111 | # define OTG_MST16 (1 << 29) |
| 112 | # define SRP_GPDATA (1 << 28) |
| 113 | # define SRP_GPDVBUS (1 << 27) |
| 114 | # define SRP_GPUVBUS(w) (((w)>>24)&0x07) |
| 115 | # define A_WAIT_VRISE(w) (((w)>>20)&0x07) |
| 116 | # define B_ASE_BRST(w) (((w)>>16)&0x07) |
| 117 | # define SRP_DPW (1 << 14) |
| 118 | # define SRP_DATA (1 << 13) |
| 119 | # define SRP_VBUS (1 << 12) |
| 120 | # define OTG_PADEN (1 << 10) |
| 121 | # define HMC_PADEN (1 << 9) |
| 122 | # define UHOST_EN (1 << 8) |
| 123 | # define HMC_TLLSPEED (1 << 7) |
| 124 | # define HMC_TLLATTACH (1 << 6) |
| 125 | # define OTG_HMC(w) (((w)>>0)&0x3f) |
| 126 | #define OTG_CTRL (OTG_BASE + 0x0c) |
| 127 | # define OTG_USB2_EN (1 << 29) |
| 128 | # define OTG_USB2_DP (1 << 28) |
| 129 | # define OTG_USB2_DM (1 << 27) |
| 130 | # define OTG_USB1_EN (1 << 26) |
| 131 | # define OTG_USB1_DP (1 << 25) |
| 132 | # define OTG_USB1_DM (1 << 24) |
| 133 | # define OTG_USB0_EN (1 << 23) |
| 134 | # define OTG_USB0_DP (1 << 22) |
| 135 | # define OTG_USB0_DM (1 << 21) |
| 136 | # define OTG_ASESSVLD (1 << 20) |
| 137 | # define OTG_BSESSEND (1 << 19) |
| 138 | # define OTG_BSESSVLD (1 << 18) |
| 139 | # define OTG_VBUSVLD (1 << 17) |
| 140 | # define OTG_ID (1 << 16) |
| 141 | # define OTG_DRIVER_SEL (1 << 15) |
| 142 | # define OTG_A_SETB_HNPEN (1 << 12) |
| 143 | # define OTG_A_BUSREQ (1 << 11) |
| 144 | # define OTG_B_HNPEN (1 << 9) |
| 145 | # define OTG_B_BUSREQ (1 << 8) |
| 146 | # define OTG_BUSDROP (1 << 7) |
| 147 | # define OTG_PULLDOWN (1 << 5) |
| 148 | # define OTG_PULLUP (1 << 4) |
| 149 | # define OTG_DRV_VBUS (1 << 3) |
| 150 | # define OTG_PD_VBUS (1 << 2) |
| 151 | # define OTG_PU_VBUS (1 << 1) |
| 152 | # define OTG_PU_ID (1 << 0) |
| 153 | #define OTG_IRQ_EN (OTG_BASE + 0x10) /* 16-bit */ |
| 154 | # define DRIVER_SWITCH (1 << 15) |
| 155 | # define A_VBUS_ERR (1 << 13) |
| 156 | # define A_REQ_TMROUT (1 << 12) |
| 157 | # define A_SRP_DETECT (1 << 11) |
| 158 | # define B_HNP_FAIL (1 << 10) |
| 159 | # define B_SRP_TMROUT (1 << 9) |
| 160 | # define B_SRP_DONE (1 << 8) |
| 161 | # define B_SRP_STARTED (1 << 7) |
| 162 | # define OPRT_CHG (1 << 0) |
| 163 | #define OTG_IRQ_SRC (OTG_BASE + 0x14) /* 16-bit */ |
| 164 | // same bits as in IRQ_EN |
| 165 | #define OTG_OUTCTRL (OTG_BASE + 0x18) /* 16-bit */ |
| 166 | # define OTGVPD (1 << 14) |
| 167 | # define OTGVPU (1 << 13) |
| 168 | # define OTGPUID (1 << 12) |
| 169 | # define USB2VDR (1 << 10) |
| 170 | # define USB2PDEN (1 << 9) |
| 171 | # define USB2PUEN (1 << 8) |
| 172 | # define USB1VDR (1 << 6) |
| 173 | # define USB1PDEN (1 << 5) |
| 174 | # define USB1PUEN (1 << 4) |
| 175 | # define USB0VDR (1 << 2) |
| 176 | # define USB0PDEN (1 << 1) |
| 177 | # define USB0PUEN (1 << 0) |
| 178 | #define OTG_TEST (OTG_BASE + 0x20) /* 16-bit */ |
| 179 | #define OTG_VENDOR_CODE (OTG_BASE + 0xfc) /* 16-bit */ |
| 180 | |
| 181 | /*-------------------------------------------------------------------------*/ |
| 182 | |
| 183 | /* OMAP1 */ |
| 184 | #define USB_TRANSCEIVER_CTRL (0xfffe1000 + 0x0064) |
| 185 | # define CONF_USB2_UNI_R (1 << 8) |
| 186 | # define CONF_USB1_UNI_R (1 << 7) |
| 187 | # define CONF_USB_PORT0_R(x) (((x)>>4)&0x7) |
| 188 | # define CONF_USB0_ISOLATE_R (1 << 3) |
| 189 | # define CONF_USB_PWRDN_DM_R (1 << 2) |
| 190 | # define CONF_USB_PWRDN_DP_R (1 << 1) |
| 191 | |
| 192 | /* OMAP2 */ |
| 193 | # define USB_UNIDIR 0x0 |
| 194 | # define USB_UNIDIR_TLL 0x1 |
| 195 | # define USB_BIDIR 0x2 |
| 196 | # define USB_BIDIR_TLL 0x3 |
| 197 | # define USBTXWRMODEI(port, x) ((x) << (22 - (port * 2))) |
| 198 | # define USBT2TLL5PI (1 << 17) |
| 199 | # define USB0PUENACTLOI (1 << 16) |
| 200 | # define USBSTANDBYCTRL (1 << 15) |
| 201 | |
| 202 | #endif /* __ASM_ARCH_OMAP_USB_H */ |