Heikki Krogerus | 3a229eb | 2010-05-03 09:13:01 +0300 | [diff] [blame] | 1 | /* |
| 2 | * ulpi.h -- ULPI defines and function prorotypes |
| 3 | * |
| 4 | * Copyright (C) 2010 Nokia Corporation |
| 5 | * |
| 6 | * This software is distributed under the terms of the GNU General |
| 7 | * Public License ("GPL") as published by the Free Software Foundation, |
| 8 | * version 2 of that License. |
| 9 | */ |
| 10 | |
Daniel Mack | 2d57a95 | 2009-10-15 17:09:35 +0300 | [diff] [blame] | 11 | #ifndef __LINUX_USB_ULPI_H |
| 12 | #define __LINUX_USB_ULPI_H |
| 13 | |
Ajay Kumar Gupta | 5128993 | 2010-07-08 14:03:01 +0530 | [diff] [blame] | 14 | #include <linux/usb/otg.h> |
Heikki Krogerus | 3a229eb | 2010-05-03 09:13:01 +0300 | [diff] [blame] | 15 | /*-------------------------------------------------------------------------*/ |
| 16 | |
| 17 | /* |
Igor Grinberg | 13dd0c9 | 2010-07-15 16:00:16 +0300 | [diff] [blame] | 18 | * ULPI Flags |
| 19 | */ |
| 20 | #define ULPI_OTG_ID_PULLUP (1 << 0) |
| 21 | #define ULPI_OTG_DP_PULLDOWN_DIS (1 << 1) |
| 22 | #define ULPI_OTG_DM_PULLDOWN_DIS (1 << 2) |
| 23 | #define ULPI_OTG_DISCHRGVBUS (1 << 3) |
| 24 | #define ULPI_OTG_CHRGVBUS (1 << 4) |
| 25 | #define ULPI_OTG_DRVVBUS (1 << 5) |
| 26 | #define ULPI_OTG_DRVVBUS_EXT (1 << 6) |
| 27 | #define ULPI_OTG_EXTVBUSIND (1 << 7) |
| 28 | |
| 29 | #define ULPI_IC_6PIN_SERIAL (1 << 8) |
| 30 | #define ULPI_IC_3PIN_SERIAL (1 << 9) |
| 31 | #define ULPI_IC_CARKIT (1 << 10) |
| 32 | #define ULPI_IC_CLKSUSPM (1 << 11) |
| 33 | #define ULPI_IC_AUTORESUME (1 << 12) |
| 34 | #define ULPI_IC_EXTVBUS_INDINV (1 << 13) |
| 35 | #define ULPI_IC_IND_PASSTHRU (1 << 14) |
| 36 | #define ULPI_IC_PROTECT_DIS (1 << 15) |
| 37 | |
| 38 | #define ULPI_FC_HS (1 << 16) |
| 39 | #define ULPI_FC_FS (1 << 17) |
| 40 | #define ULPI_FC_LS (1 << 18) |
| 41 | #define ULPI_FC_FS4LS (1 << 19) |
| 42 | #define ULPI_FC_TERMSEL (1 << 20) |
| 43 | #define ULPI_FC_OP_NORM (1 << 21) |
| 44 | #define ULPI_FC_OP_NODRV (1 << 22) |
| 45 | #define ULPI_FC_OP_DIS_NRZI (1 << 23) |
| 46 | #define ULPI_FC_OP_NSYNC_NEOP (1 << 24) |
| 47 | #define ULPI_FC_RST (1 << 25) |
| 48 | #define ULPI_FC_SUSPM (1 << 26) |
| 49 | |
| 50 | /*-------------------------------------------------------------------------*/ |
| 51 | |
| 52 | /* |
Heikki Krogerus | 3a229eb | 2010-05-03 09:13:01 +0300 | [diff] [blame] | 53 | * Macros for Set and Clear |
| 54 | * See ULPI 1.1 specification to find the registers with Set and Clear offsets |
| 55 | */ |
| 56 | #define ULPI_SET(a) (a + 1) |
| 57 | #define ULPI_CLR(a) (a + 2) |
| 58 | |
| 59 | /*-------------------------------------------------------------------------*/ |
| 60 | |
| 61 | /* |
| 62 | * Register Map |
| 63 | */ |
| 64 | #define ULPI_VENDOR_ID_LOW 0x00 |
| 65 | #define ULPI_VENDOR_ID_HIGH 0x01 |
| 66 | #define ULPI_PRODUCT_ID_LOW 0x02 |
| 67 | #define ULPI_PRODUCT_ID_HIGH 0x03 |
| 68 | #define ULPI_FUNC_CTRL 0x04 |
| 69 | #define ULPI_IFC_CTRL 0x07 |
| 70 | #define ULPI_OTG_CTRL 0x0a |
| 71 | #define ULPI_USB_INT_EN_RISE 0x0d |
| 72 | #define ULPI_USB_INT_EN_FALL 0x10 |
| 73 | #define ULPI_USB_INT_STS 0x13 |
| 74 | #define ULPI_USB_INT_LATCH 0x14 |
| 75 | #define ULPI_DEBUG 0x15 |
| 76 | #define ULPI_SCRATCH 0x16 |
| 77 | /* Optional Carkit Registers */ |
| 78 | #define ULPI_CARCIT_CTRL 0x19 |
| 79 | #define ULPI_CARCIT_INT_DELAY 0x1c |
| 80 | #define ULPI_CARCIT_INT_EN 0x1d |
| 81 | #define ULPI_CARCIT_INT_STS 0x20 |
| 82 | #define ULPI_CARCIT_INT_LATCH 0x21 |
| 83 | #define ULPI_CARCIT_PLS_CTRL 0x22 |
| 84 | /* Other Optional Registers */ |
| 85 | #define ULPI_TX_POS_WIDTH 0x25 |
| 86 | #define ULPI_TX_NEG_WIDTH 0x26 |
| 87 | #define ULPI_POLARITY_RECOVERY 0x27 |
| 88 | /* Access Extended Register Set */ |
| 89 | #define ULPI_ACCESS_EXTENDED 0x2f |
| 90 | /* Vendor Specific */ |
| 91 | #define ULPI_VENDOR_SPECIFIC 0x30 |
| 92 | /* Extended Registers */ |
| 93 | #define ULPI_EXT_VENDOR_SPECIFIC 0x80 |
| 94 | |
| 95 | /*-------------------------------------------------------------------------*/ |
| 96 | |
Igor Grinberg | 13dd0c9 | 2010-07-15 16:00:16 +0300 | [diff] [blame] | 97 | /* |
| 98 | * Register Bits |
| 99 | */ |
| 100 | |
Heikki Krogerus | 3a229eb | 2010-05-03 09:13:01 +0300 | [diff] [blame] | 101 | /* Function Control */ |
| 102 | #define ULPI_FUNC_CTRL_XCVRSEL (1 << 0) |
| 103 | #define ULPI_FUNC_CTRL_XCVRSEL_MASK (3 << 0) |
| 104 | #define ULPI_FUNC_CTRL_HIGH_SPEED (0 << 0) |
| 105 | #define ULPI_FUNC_CTRL_FULL_SPEED (1 << 0) |
| 106 | #define ULPI_FUNC_CTRL_LOW_SPEED (2 << 0) |
| 107 | #define ULPI_FUNC_CTRL_FS4LS (3 << 0) |
| 108 | #define ULPI_FUNC_CTRL_TERMSELECT (1 << 2) |
| 109 | #define ULPI_FUNC_CTRL_OPMODE (1 << 3) |
| 110 | #define ULPI_FUNC_CTRL_OPMODE_MASK (3 << 3) |
| 111 | #define ULPI_FUNC_CTRL_OPMODE_NORMAL (0 << 3) |
| 112 | #define ULPI_FUNC_CTRL_OPMODE_NONDRIVING (1 << 3) |
| 113 | #define ULPI_FUNC_CTRL_OPMODE_DISABLE_NRZI (2 << 3) |
| 114 | #define ULPI_FUNC_CTRL_OPMODE_NOSYNC_NOEOP (3 << 3) |
| 115 | #define ULPI_FUNC_CTRL_RESET (1 << 5) |
| 116 | #define ULPI_FUNC_CTRL_SUSPENDM (1 << 6) |
| 117 | |
| 118 | /* Interface Control */ |
| 119 | #define ULPI_IFC_CTRL_6_PIN_SERIAL_MODE (1 << 0) |
| 120 | #define ULPI_IFC_CTRL_3_PIN_SERIAL_MODE (1 << 1) |
| 121 | #define ULPI_IFC_CTRL_CARKITMODE (1 << 2) |
| 122 | #define ULPI_IFC_CTRL_CLOCKSUSPENDM (1 << 3) |
| 123 | #define ULPI_IFC_CTRL_AUTORESUME (1 << 4) |
| 124 | #define ULPI_IFC_CTRL_EXTERNAL_VBUS (1 << 5) |
| 125 | #define ULPI_IFC_CTRL_PASSTHRU (1 << 6) |
| 126 | #define ULPI_IFC_CTRL_PROTECT_IFC_DISABLE (1 << 7) |
| 127 | |
| 128 | /* OTG Control */ |
| 129 | #define ULPI_OTG_CTRL_ID_PULLUP (1 << 0) |
| 130 | #define ULPI_OTG_CTRL_DP_PULLDOWN (1 << 1) |
| 131 | #define ULPI_OTG_CTRL_DM_PULLDOWN (1 << 2) |
| 132 | #define ULPI_OTG_CTRL_DISCHRGVBUS (1 << 3) |
| 133 | #define ULPI_OTG_CTRL_CHRGVBUS (1 << 4) |
| 134 | #define ULPI_OTG_CTRL_DRVVBUS (1 << 5) |
| 135 | #define ULPI_OTG_CTRL_DRVVBUS_EXT (1 << 6) |
| 136 | #define ULPI_OTG_CTRL_EXTVBUSIND (1 << 7) |
| 137 | |
| 138 | /* USB Interrupt Enable Rising, |
| 139 | * USB Interrupt Enable Falling, |
| 140 | * USB Interrupt Status and |
| 141 | * USB Interrupt Latch |
| 142 | */ |
| 143 | #define ULPI_INT_HOST_DISCONNECT (1 << 0) |
| 144 | #define ULPI_INT_VBUS_VALID (1 << 1) |
| 145 | #define ULPI_INT_SESS_VALID (1 << 2) |
| 146 | #define ULPI_INT_SESS_END (1 << 3) |
| 147 | #define ULPI_INT_IDGRD (1 << 4) |
| 148 | |
| 149 | /* Debug */ |
| 150 | #define ULPI_DEBUG_LINESTATE0 (1 << 0) |
| 151 | #define ULPI_DEBUG_LINESTATE1 (1 << 1) |
| 152 | |
| 153 | /* Carkit Control */ |
| 154 | #define ULPI_CARKIT_CTRL_CARKITPWR (1 << 0) |
| 155 | #define ULPI_CARKIT_CTRL_IDGNDDRV (1 << 1) |
| 156 | #define ULPI_CARKIT_CTRL_TXDEN (1 << 2) |
| 157 | #define ULPI_CARKIT_CTRL_RXDEN (1 << 3) |
| 158 | #define ULPI_CARKIT_CTRL_SPKLEFTEN (1 << 4) |
| 159 | #define ULPI_CARKIT_CTRL_SPKRIGHTEN (1 << 5) |
| 160 | #define ULPI_CARKIT_CTRL_MICEN (1 << 6) |
| 161 | |
| 162 | /* Carkit Interrupt Enable */ |
| 163 | #define ULPI_CARKIT_INT_EN_IDFLOAT_RISE (1 << 0) |
| 164 | #define ULPI_CARKIT_INT_EN_IDFLOAT_FALL (1 << 1) |
| 165 | #define ULPI_CARKIT_INT_EN_CARINTDET (1 << 2) |
| 166 | #define ULPI_CARKIT_INT_EN_DP_RISE (1 << 3) |
| 167 | #define ULPI_CARKIT_INT_EN_DP_FALL (1 << 4) |
| 168 | |
| 169 | /* Carkit Interrupt Status and |
| 170 | * Carkit Interrupt Latch |
| 171 | */ |
| 172 | #define ULPI_CARKIT_INT_IDFLOAT (1 << 0) |
| 173 | #define ULPI_CARKIT_INT_CARINTDET (1 << 1) |
| 174 | #define ULPI_CARKIT_INT_DP (1 << 2) |
| 175 | |
| 176 | /* Carkit Pulse Control*/ |
| 177 | #define ULPI_CARKIT_PLS_CTRL_TXPLSEN (1 << 0) |
| 178 | #define ULPI_CARKIT_PLS_CTRL_RXPLSEN (1 << 1) |
| 179 | #define ULPI_CARKIT_PLS_CTRL_SPKRLEFT_BIASEN (1 << 2) |
| 180 | #define ULPI_CARKIT_PLS_CTRL_SPKRRIGHT_BIASEN (1 << 3) |
| 181 | |
| 182 | /*-------------------------------------------------------------------------*/ |
| 183 | |
Daniel Mack | 2d57a95 | 2009-10-15 17:09:35 +0300 | [diff] [blame] | 184 | struct otg_transceiver *otg_ulpi_create(struct otg_io_access_ops *ops, |
| 185 | unsigned int flags); |
| 186 | |
Benoit Goby | ee398ba | 2011-03-09 16:28:54 -0800 | [diff] [blame^] | 187 | #ifdef CONFIG_USB_ULPI_VIEWPORT |
| 188 | /* access ops for controllers with a viewport register */ |
| 189 | extern struct otg_io_access_ops ulpi_viewport_access_ops; |
| 190 | #endif |
| 191 | |
Daniel Mack | 2d57a95 | 2009-10-15 17:09:35 +0300 | [diff] [blame] | 192 | #endif /* __LINUX_USB_ULPI_H */ |