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