aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/renesas_usbhs/common.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/renesas_usbhs/common.h')
-rw-r--r--drivers/usb/renesas_usbhs/common.h60
1 files changed, 56 insertions, 4 deletions
diff --git a/drivers/usb/renesas_usbhs/common.h b/drivers/usb/renesas_usbhs/common.h
index b410463a1212..8729da5c3be6 100644
--- a/drivers/usb/renesas_usbhs/common.h
+++ b/drivers/usb/renesas_usbhs/common.h
@@ -90,6 +90,17 @@ struct usbhs_priv;
90#define PIPE9TRN 0x00BA 90#define PIPE9TRN 0x00BA
91#define PIPEATRE 0x00BC 91#define PIPEATRE 0x00BC
92#define PIPEATRN 0x00BE 92#define PIPEATRN 0x00BE
93#define DEVADD0 0x00D0 /* Device address n configuration */
94#define DEVADD1 0x00D2
95#define DEVADD2 0x00D4
96#define DEVADD3 0x00D6
97#define DEVADD4 0x00D8
98#define DEVADD5 0x00DA
99#define DEVADD6 0x00DC
100#define DEVADD7 0x00DE
101#define DEVADD8 0x00E0
102#define DEVADD9 0x00E2
103#define DEVADDA 0x00E4
93 104
94/* SYSCFG */ 105/* SYSCFG */
95#define SCKE (1 << 10) /* USB Module Clock Enable */ 106#define SCKE (1 << 10) /* USB Module Clock Enable */
@@ -102,6 +113,8 @@ struct usbhs_priv;
102/* DVSTCTR */ 113/* DVSTCTR */
103#define EXTLP (1 << 10) /* Controls the EXTLP pin output state */ 114#define EXTLP (1 << 10) /* Controls the EXTLP pin output state */
104#define PWEN (1 << 9) /* Controls the PWEN pin output state */ 115#define PWEN (1 << 9) /* Controls the PWEN pin output state */
116#define USBRST (1 << 6) /* Bus Reset Output */
117#define UACT (1 << 4) /* USB Bus Enable */
105#define RHST (0x7) /* Reset Handshake */ 118#define RHST (0x7) /* Reset Handshake */
106#define RHST_LOW_SPEED 1 /* Low-speed connection */ 119#define RHST_LOW_SPEED 1 /* Low-speed connection */
107#define RHST_FULL_SPEED 2 /* Full-speed connection */ 120#define RHST_FULL_SPEED 2 /* Full-speed connection */
@@ -159,6 +172,15 @@ struct usbhs_priv;
159#define NODATA_STATUS_STAGE 5 /* Control write NoData status stage */ 172#define NODATA_STATUS_STAGE 5 /* Control write NoData status stage */
160#define SEQUENCE_ERROR 6 /* Control transfer sequence error */ 173#define SEQUENCE_ERROR 6 /* Control transfer sequence error */
161 174
175/* INTSTS1 */
176#define OVRCR (1 << 15) /* OVRCR Interrupt Status */
177#define BCHG (1 << 14) /* USB Bus Change Interrupt Status */
178#define DTCH (1 << 12) /* USB Disconnection Detect Interrupt Status */
179#define ATTCH (1 << 11) /* ATTCH Interrupt Status */
180#define EOFERR (1 << 6) /* EOF Error Detect Interrupt Status */
181#define SIGN (1 << 5) /* Setup Transaction Error Interrupt Status */
182#define SACK (1 << 4) /* Setup Transaction ACK Response Interrupt Status */
183
162/* PIPECFG */ 184/* PIPECFG */
163/* DCPCFG */ 185/* DCPCFG */
164#define TYPE_NONE (0 << 14) /* Transfer Type */ 186#define TYPE_NONE (0 << 14) /* Transfer Type */
@@ -183,9 +205,11 @@ struct usbhs_priv;
183/* PIPEnCTR */ 205/* PIPEnCTR */
184/* DCPCTR */ 206/* DCPCTR */
185#define BSTS (1 << 15) /* Buffer Status */ 207#define BSTS (1 << 15) /* Buffer Status */
208#define SUREQ (1 << 14) /* Sending SETUP Token */
186#define CSSTS (1 << 12) /* CSSTS Status */ 209#define CSSTS (1 << 12) /* CSSTS Status */
187#define SQCLR (1 << 8) /* Toggle Bit Clear */
188#define ACLRM (1 << 9) /* Buffer Auto-Clear Mode */ 210#define ACLRM (1 << 9) /* Buffer Auto-Clear Mode */
211#define SQCLR (1 << 8) /* Toggle Bit Clear */
212#define SQSET (1 << 7) /* Toggle Bit Set */
189#define PBUSY (1 << 5) /* Pipe Busy */ 213#define PBUSY (1 << 5) /* Pipe Busy */
190#define PID_MASK (0x3) /* Response PID */ 214#define PID_MASK (0x3) /* Response PID */
191#define PID_NAK 0 215#define PID_NAK 0
@@ -202,6 +226,14 @@ struct usbhs_priv;
202/* FRMNUM */ 226/* FRMNUM */
203#define FRNM_MASK (0x7FF) 227#define FRNM_MASK (0x7FF)
204 228
229/* DEVADDn */
230#define UPPHUB(x) (((x) & 0xF) << 11) /* HUB Register */
231#define HUBPORT(x) (((x) & 0x7) << 8) /* HUB Port for Target Device */
232#define USBSPD(x) (((x) & 0x3) << 6) /* Device Transfer Rate */
233#define USBSPD_SPEED_LOW 0x1
234#define USBSPD_SPEED_FULL 0x2
235#define USBSPD_SPEED_HIGH 0x3
236
205/* 237/*
206 * struct 238 * struct
207 */ 239 */
@@ -210,8 +242,8 @@ struct usbhs_priv {
210 void __iomem *base; 242 void __iomem *base;
211 unsigned int irq; 243 unsigned int irq;
212 244
213 struct renesas_usbhs_platform_callback *pfunc; 245 struct renesas_usbhs_platform_callback pfunc;
214 struct renesas_usbhs_driver_param *dparam; 246 struct renesas_usbhs_driver_param dparam;
215 247
216 struct delayed_work notify_hotplug_work; 248 struct delayed_work notify_hotplug_work;
217 struct platform_device *pdev; 249 struct platform_device *pdev;
@@ -258,15 +290,35 @@ void usbhs_sys_host_ctrl(struct usbhs_priv *priv, int enable);
258void usbhs_sys_function_ctrl(struct usbhs_priv *priv, int enable); 290void usbhs_sys_function_ctrl(struct usbhs_priv *priv, int enable);
259 291
260/* 292/*
293 * usb request
294 */
295void usbhs_usbreq_get_val(struct usbhs_priv *priv, struct usb_ctrlrequest *req);
296void usbhs_usbreq_set_val(struct usbhs_priv *priv, struct usb_ctrlrequest *req);
297
298/*
299 * bus
300 */
301void usbhs_bus_send_sof_enable(struct usbhs_priv *priv);
302void usbhs_bus_send_reset(struct usbhs_priv *priv);
303int usbhs_bus_get_speed(struct usbhs_priv *priv);
304int usbhs_vbus_ctrl(struct usbhs_priv *priv, int enable);
305
306/*
261 * frame 307 * frame
262 */ 308 */
263int usbhs_frame_get_num(struct usbhs_priv *priv); 309int usbhs_frame_get_num(struct usbhs_priv *priv);
264 310
265/* 311/*
312 * device config
313 */
314int usbhs_set_device_speed(struct usbhs_priv *priv, int devnum, u16 upphub,
315 u16 hubport, u16 speed);
316
317/*
266 * data 318 * data
267 */ 319 */
268struct usbhs_priv *usbhs_pdev_to_priv(struct platform_device *pdev); 320struct usbhs_priv *usbhs_pdev_to_priv(struct platform_device *pdev);
269#define usbhs_get_dparam(priv, param) (priv->dparam->param) 321#define usbhs_get_dparam(priv, param) (priv->dparam.param)
270#define usbhs_priv_to_pdev(priv) (priv->pdev) 322#define usbhs_priv_to_pdev(priv) (priv->pdev)
271#define usbhs_priv_to_dev(priv) (&priv->pdev->dev) 323#define usbhs_priv_to_dev(priv) (&priv->pdev->dev)
272#define usbhs_priv_to_lock(priv) (&priv->lock) 324#define usbhs_priv_to_lock(priv) (&priv->lock)