aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/usb/ulpi.h
blob: 82b1507f47351d8afe754b32a7d1e1bcac60abb7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
/*
 * ulpi.h -- ULPI defines and function prorotypes
 *
 * Copyright (C) 2010 Nokia Corporation
 *
 * This software is distributed under the terms of the GNU General
 * Public License ("GPL") as published by the Free Software Foundation,
 * version 2 of that License.
 */

#ifndef __LINUX_USB_ULPI_H
#define __LINUX_USB_ULPI_H

#include <linux/usb/otg.h>
/*-------------------------------------------------------------------------*/

/*
 * ULPI Flags
 */
#define ULPI_OTG_ID_PULLUP		(1 << 0)
#define ULPI_OTG_DP_PULLDOWN_DIS	(1 << 1)
#define ULPI_OTG_DM_PULLDOWN_DIS	(1 << 2)
#define ULPI_OTG_DISCHRGVBUS		(1 << 3)
#define ULPI_OTG_CHRGVBUS		(1 << 4)
#define ULPI_OTG_DRVVBUS		(1 << 5)
#define ULPI_OTG_DRVVBUS_EXT		(1 << 6)
#define ULPI_OTG_EXTVBUSIND		(1 << 7)

#define ULPI_IC_6PIN_SERIAL		(1 << 8)
#define ULPI_IC_3PIN_SERIAL		(1 << 9)
#define ULPI_IC_CARKIT			(1 << 10)
#define ULPI_IC_CLKSUSPM		(1 << 11)
#define ULPI_IC_AUTORESUME		(1 << 12)
#define ULPI_IC_EXTVBUS_INDINV		(1 << 13)
#define ULPI_IC_IND_PASSTHRU		(1 << 14)
#define ULPI_IC_PROTECT_DIS		(1 << 15)

#define ULPI_FC_HS			(1 << 16)
#define ULPI_FC_FS			(1 << 17)
#define ULPI_FC_LS			(1 << 18)
#define ULPI_FC_FS4LS			(1 << 19)
#define ULPI_FC_TERMSEL			(1 << 20)
#define ULPI_FC_OP_NORM			(1 << 21)
#define ULPI_FC_OP_NODRV		(1 << 22)
#define ULPI_FC_OP_DIS_NRZI		(1 << 23)
#define ULPI_FC_OP_NSYNC_NEOP		(1 << 24)
#define ULPI_FC_RST			(1 << 25)
#define ULPI_FC_SUSPM			(1 << 26)

/*-------------------------------------------------------------------------*/

/*
 * Macros for Set and Clear
 * See ULPI 1.1 specification to find the registers with Set and Clear offsets
 */
#define ULPI_SET(a)				(a + 1)
#define ULPI_CLR(a)				(a + 2)

/*-------------------------------------------------------------------------*/

/*
 * Register Map
 */
#define ULPI_VENDOR_ID_LOW			0x00
#define ULPI_VENDOR_ID_HIGH			0x01
#define ULPI_PRODUCT_ID_LOW			0x02
#define ULPI_PRODUCT_ID_HIGH			0x03
#define ULPI_FUNC_CTRL				0x04
#define ULPI_IFC_CTRL				0x07
#define ULPI_OTG_CTRL				0x0a
#define ULPI_USB_INT_EN_RISE			0x0d
#define ULPI_USB_INT_EN_FALL			0x10
#define ULPI_USB_INT_STS			0x13
#define ULPI_USB_INT_LATCH			0x14
#define ULPI_DEBUG				0x15
#define ULPI_SCRATCH				0x16
/* Optional Carkit Registers */
#define ULPI_CARCIT_CTRL			0x19
#define ULPI_CARCIT_INT_DELAY			0x1c
#define ULPI_CARCIT_INT_EN			0x1d
#define ULPI_CARCIT_INT_STS			0x20
#define ULPI_CARCIT_INT_LATCH			0x21
#define ULPI_CARCIT_PLS_CTRL			0x22
/* Other Optional Registers */
#define ULPI_TX_POS_WIDTH			0x25
#define ULPI_TX_NEG_WIDTH			0x26
#define ULPI_POLARITY_RECOVERY			0x27
/* Access Extended Register Set */
#define ULPI_ACCESS_EXTENDED			0x2f
/* Vendor Specific */
#define ULPI_VENDOR_SPECIFIC			0x30
/* Extended Registers */
#define ULPI_EXT_VENDOR_SPECIFIC		0x80

/*-------------------------------------------------------------------------*/

/*
 * Register Bits
 */

/* Function Control */
#define ULPI_FUNC_CTRL_XCVRSEL			(1 << 0)
#define  ULPI_FUNC_CTRL_XCVRSEL_MASK		(3 << 0)
#define  ULPI_FUNC_CTRL_HIGH_SPEED		(0 << 0)
#define  ULPI_FUNC_CTRL_FULL_SPEED		(1 << 0)
#define  ULPI_FUNC_CTRL_LOW_SPEED		(2 << 0)
#define  ULPI_FUNC_CTRL_FS4LS			(3 << 0)
#define ULPI_FUNC_CTRL_TERMSELECT		(1 << 2)
#define ULPI_FUNC_CTRL_OPMODE			(1 << 3)
#define  ULPI_FUNC_CTRL_OPMODE_MASK		(3 << 3)
#define  ULPI_FUNC_CTRL_OPMODE_NORMAL		(0 << 3)
#define  ULPI_FUNC_CTRL_OPMODE_NONDRIVING	(1 << 3)
#define  ULPI_FUNC_CTRL_OPMODE_DISABLE_NRZI	(2 << 3)
#define  ULPI_FUNC_CTRL_OPMODE_NOSYNC_NOEOP	(3 << 3)
#define ULPI_FUNC_CTRL_RESET			(1 << 5)
#define ULPI_FUNC_CTRL_SUSPENDM			(1 << 6)

/* Interface Control */
#define ULPI_IFC_CTRL_6_PIN_SERIAL_MODE		(1 << 0)
#define ULPI_IFC_CTRL_3_PIN_SERIAL_MODE		(1 << 1)
#define ULPI_IFC_CTRL_CARKITMODE		(1 << 2)
#define ULPI_IFC_CTRL_CLOCKSUSPENDM		(1 << 3)
#define ULPI_IFC_CTRL_AUTORESUME		(1 << 4)
#define ULPI_IFC_CTRL_EXTERNAL_VBUS		(1 << 5)
#define ULPI_IFC_CTRL_PASSTHRU			(1 << 6)
#define ULPI_IFC_CTRL_PROTECT_IFC_DISABLE	(1 << 7)

/* OTG Control */
#define ULPI_OTG_CTRL_ID_PULLUP			(1 << 0)
#define ULPI_OTG_CTRL_DP_PULLDOWN		(1 << 1)
#define ULPI_OTG_CTRL_DM_PULLDOWN		(1 << 2)
#define ULPI_OTG_CTRL_DISCHRGVBUS		(1 << 3)
#define ULPI_OTG_CTRL_CHRGVBUS			(1 << 4)
#define ULPI_OTG_CTRL_DRVVBUS			(1 << 5)
#define ULPI_OTG_CTRL_DRVVBUS_EXT		(1 << 6)
#define ULPI_OTG_CTRL_EXTVBUSIND		(1 << 7)

/* USB Interrupt Enable Rising,
 * USB Interrupt Enable Falling,
 * USB Interrupt Status and
 * USB Interrupt Latch
 */
#define ULPI_INT_HOST_DISCONNECT		(1 << 0)
#define ULPI_INT_VBUS_VALID			(1 << 1)
#define ULPI_INT_SESS_VALID			(1 << 2)
#define ULPI_INT_SESS_END			(1 << 3)
#define ULPI_INT_IDGRD				(1 << 4)

/* Debug */
#define ULPI_DEBUG_LINESTATE0			(1 << 0)
#define ULPI_DEBUG_LINESTATE1			(1 << 1)

/* Carkit Control */
#define ULPI_CARKIT_CTRL_CARKITPWR		(1 << 0)
#define ULPI_CARKIT_CTRL_IDGNDDRV		(1 << 1)
#define ULPI_CARKIT_CTRL_TXDEN			(1 << 2)
#define ULPI_CARKIT_CTRL_RXDEN			(1 << 3)
#define ULPI_CARKIT_CTRL_SPKLEFTEN		(1 << 4)
#define ULPI_CARKIT_CTRL_SPKRIGHTEN		(1 << 5)
#define ULPI_CARKIT_CTRL_MICEN			(1 << 6)

/* Carkit Interrupt Enable */
#define ULPI_CARKIT_INT_EN_IDFLOAT_RISE		(1 << 0)
#define ULPI_CARKIT_INT_EN_IDFLOAT_FALL		(1 << 1)
#define ULPI_CARKIT_INT_EN_CARINTDET		(1 << 2)
#define ULPI_CARKIT_INT_EN_DP_RISE		(1 << 3)
#define ULPI_CARKIT_INT_EN_DP_FALL		(1 << 4)

/* Carkit Interrupt Status and
 * Carkit Interrupt Latch
 */
#define ULPI_CARKIT_INT_IDFLOAT			(1 << 0)
#define ULPI_CARKIT_INT_CARINTDET		(1 << 1)
#define ULPI_CARKIT_INT_DP			(1 << 2)

/* Carkit Pulse Control*/
#define ULPI_CARKIT_PLS_CTRL_TXPLSEN		(1 << 0)
#define ULPI_CARKIT_PLS_CTRL_RXPLSEN		(1 << 1)
#define ULPI_CARKIT_PLS_CTRL_SPKRLEFT_BIASEN	(1 << 2)
#define ULPI_CARKIT_PLS_CTRL_SPKRRIGHT_BIASEN	(1 << 3)

/*-------------------------------------------------------------------------*/

struct otg_transceiver *otg_ulpi_create(struct otg_io_access_ops *ops,
					unsigned int flags);

#endif /* __LINUX_USB_ULPI_H */