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 | /* |
| 18 | * Macros for Set and Clear |
| 19 | * See ULPI 1.1 specification to find the registers with Set and Clear offsets |
| 20 | */ |
| 21 | #define ULPI_SET(a) (a + 1) |
| 22 | #define ULPI_CLR(a) (a + 2) |
| 23 | |
| 24 | /*-------------------------------------------------------------------------*/ |
| 25 | |
| 26 | /* |
| 27 | * Register Map |
| 28 | */ |
| 29 | #define ULPI_VENDOR_ID_LOW 0x00 |
| 30 | #define ULPI_VENDOR_ID_HIGH 0x01 |
| 31 | #define ULPI_PRODUCT_ID_LOW 0x02 |
| 32 | #define ULPI_PRODUCT_ID_HIGH 0x03 |
| 33 | #define ULPI_FUNC_CTRL 0x04 |
| 34 | #define ULPI_IFC_CTRL 0x07 |
| 35 | #define ULPI_OTG_CTRL 0x0a |
| 36 | #define ULPI_USB_INT_EN_RISE 0x0d |
| 37 | #define ULPI_USB_INT_EN_FALL 0x10 |
| 38 | #define ULPI_USB_INT_STS 0x13 |
| 39 | #define ULPI_USB_INT_LATCH 0x14 |
| 40 | #define ULPI_DEBUG 0x15 |
| 41 | #define ULPI_SCRATCH 0x16 |
| 42 | /* Optional Carkit Registers */ |
| 43 | #define ULPI_CARCIT_CTRL 0x19 |
| 44 | #define ULPI_CARCIT_INT_DELAY 0x1c |
| 45 | #define ULPI_CARCIT_INT_EN 0x1d |
| 46 | #define ULPI_CARCIT_INT_STS 0x20 |
| 47 | #define ULPI_CARCIT_INT_LATCH 0x21 |
| 48 | #define ULPI_CARCIT_PLS_CTRL 0x22 |
| 49 | /* Other Optional Registers */ |
| 50 | #define ULPI_TX_POS_WIDTH 0x25 |
| 51 | #define ULPI_TX_NEG_WIDTH 0x26 |
| 52 | #define ULPI_POLARITY_RECOVERY 0x27 |
| 53 | /* Access Extended Register Set */ |
| 54 | #define ULPI_ACCESS_EXTENDED 0x2f |
| 55 | /* Vendor Specific */ |
| 56 | #define ULPI_VENDOR_SPECIFIC 0x30 |
| 57 | /* Extended Registers */ |
| 58 | #define ULPI_EXT_VENDOR_SPECIFIC 0x80 |
| 59 | |
| 60 | /*-------------------------------------------------------------------------*/ |
| 61 | |
| 62 | /* Function Control */ |
| 63 | #define ULPI_FUNC_CTRL_XCVRSEL (1 << 0) |
| 64 | #define ULPI_FUNC_CTRL_XCVRSEL_MASK (3 << 0) |
| 65 | #define ULPI_FUNC_CTRL_HIGH_SPEED (0 << 0) |
| 66 | #define ULPI_FUNC_CTRL_FULL_SPEED (1 << 0) |
| 67 | #define ULPI_FUNC_CTRL_LOW_SPEED (2 << 0) |
| 68 | #define ULPI_FUNC_CTRL_FS4LS (3 << 0) |
| 69 | #define ULPI_FUNC_CTRL_TERMSELECT (1 << 2) |
| 70 | #define ULPI_FUNC_CTRL_OPMODE (1 << 3) |
| 71 | #define ULPI_FUNC_CTRL_OPMODE_MASK (3 << 3) |
| 72 | #define ULPI_FUNC_CTRL_OPMODE_NORMAL (0 << 3) |
| 73 | #define ULPI_FUNC_CTRL_OPMODE_NONDRIVING (1 << 3) |
| 74 | #define ULPI_FUNC_CTRL_OPMODE_DISABLE_NRZI (2 << 3) |
| 75 | #define ULPI_FUNC_CTRL_OPMODE_NOSYNC_NOEOP (3 << 3) |
| 76 | #define ULPI_FUNC_CTRL_RESET (1 << 5) |
| 77 | #define ULPI_FUNC_CTRL_SUSPENDM (1 << 6) |
| 78 | |
| 79 | /* Interface Control */ |
| 80 | #define ULPI_IFC_CTRL_6_PIN_SERIAL_MODE (1 << 0) |
| 81 | #define ULPI_IFC_CTRL_3_PIN_SERIAL_MODE (1 << 1) |
| 82 | #define ULPI_IFC_CTRL_CARKITMODE (1 << 2) |
| 83 | #define ULPI_IFC_CTRL_CLOCKSUSPENDM (1 << 3) |
| 84 | #define ULPI_IFC_CTRL_AUTORESUME (1 << 4) |
| 85 | #define ULPI_IFC_CTRL_EXTERNAL_VBUS (1 << 5) |
| 86 | #define ULPI_IFC_CTRL_PASSTHRU (1 << 6) |
| 87 | #define ULPI_IFC_CTRL_PROTECT_IFC_DISABLE (1 << 7) |
| 88 | |
| 89 | /* OTG Control */ |
| 90 | #define ULPI_OTG_CTRL_ID_PULLUP (1 << 0) |
| 91 | #define ULPI_OTG_CTRL_DP_PULLDOWN (1 << 1) |
| 92 | #define ULPI_OTG_CTRL_DM_PULLDOWN (1 << 2) |
| 93 | #define ULPI_OTG_CTRL_DISCHRGVBUS (1 << 3) |
| 94 | #define ULPI_OTG_CTRL_CHRGVBUS (1 << 4) |
| 95 | #define ULPI_OTG_CTRL_DRVVBUS (1 << 5) |
| 96 | #define ULPI_OTG_CTRL_DRVVBUS_EXT (1 << 6) |
| 97 | #define ULPI_OTG_CTRL_EXTVBUSIND (1 << 7) |
| 98 | |
| 99 | /* USB Interrupt Enable Rising, |
| 100 | * USB Interrupt Enable Falling, |
| 101 | * USB Interrupt Status and |
| 102 | * USB Interrupt Latch |
| 103 | */ |
| 104 | #define ULPI_INT_HOST_DISCONNECT (1 << 0) |
| 105 | #define ULPI_INT_VBUS_VALID (1 << 1) |
| 106 | #define ULPI_INT_SESS_VALID (1 << 2) |
| 107 | #define ULPI_INT_SESS_END (1 << 3) |
| 108 | #define ULPI_INT_IDGRD (1 << 4) |
| 109 | |
| 110 | /* Debug */ |
| 111 | #define ULPI_DEBUG_LINESTATE0 (1 << 0) |
| 112 | #define ULPI_DEBUG_LINESTATE1 (1 << 1) |
| 113 | |
| 114 | /* Carkit Control */ |
| 115 | #define ULPI_CARKIT_CTRL_CARKITPWR (1 << 0) |
| 116 | #define ULPI_CARKIT_CTRL_IDGNDDRV (1 << 1) |
| 117 | #define ULPI_CARKIT_CTRL_TXDEN (1 << 2) |
| 118 | #define ULPI_CARKIT_CTRL_RXDEN (1 << 3) |
| 119 | #define ULPI_CARKIT_CTRL_SPKLEFTEN (1 << 4) |
| 120 | #define ULPI_CARKIT_CTRL_SPKRIGHTEN (1 << 5) |
| 121 | #define ULPI_CARKIT_CTRL_MICEN (1 << 6) |
| 122 | |
| 123 | /* Carkit Interrupt Enable */ |
| 124 | #define ULPI_CARKIT_INT_EN_IDFLOAT_RISE (1 << 0) |
| 125 | #define ULPI_CARKIT_INT_EN_IDFLOAT_FALL (1 << 1) |
| 126 | #define ULPI_CARKIT_INT_EN_CARINTDET (1 << 2) |
| 127 | #define ULPI_CARKIT_INT_EN_DP_RISE (1 << 3) |
| 128 | #define ULPI_CARKIT_INT_EN_DP_FALL (1 << 4) |
| 129 | |
| 130 | /* Carkit Interrupt Status and |
| 131 | * Carkit Interrupt Latch |
| 132 | */ |
| 133 | #define ULPI_CARKIT_INT_IDFLOAT (1 << 0) |
| 134 | #define ULPI_CARKIT_INT_CARINTDET (1 << 1) |
| 135 | #define ULPI_CARKIT_INT_DP (1 << 2) |
| 136 | |
| 137 | /* Carkit Pulse Control*/ |
| 138 | #define ULPI_CARKIT_PLS_CTRL_TXPLSEN (1 << 0) |
| 139 | #define ULPI_CARKIT_PLS_CTRL_RXPLSEN (1 << 1) |
| 140 | #define ULPI_CARKIT_PLS_CTRL_SPKRLEFT_BIASEN (1 << 2) |
| 141 | #define ULPI_CARKIT_PLS_CTRL_SPKRRIGHT_BIASEN (1 << 3) |
| 142 | |
| 143 | /*-------------------------------------------------------------------------*/ |
| 144 | |
Daniel Mack | 2d57a95 | 2009-10-15 17:09:35 +0300 | [diff] [blame] | 145 | struct otg_transceiver *otg_ulpi_create(struct otg_io_access_ops *ops, |
| 146 | unsigned int flags); |
| 147 | |
| 148 | #endif /* __LINUX_USB_ULPI_H */ |