aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/renesas_usbhs
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2011-10-11 01:06:57 -0400
committerFelipe Balbi <balbi@ti.com>2011-10-13 13:41:50 -0400
commit89c1d2e7b5993db33805b42e3675289920812f6f (patch)
treeeb7813e3a1910c12f9dcf9d74aa3bbe452f53df3 /drivers/usb/renesas_usbhs
parenteb05191f6a9aba8344a0d5f28642b5ecf44d49a4 (diff)
usb: gadget: renesas_usbhs: add INTSTS1 interrupt support
mod_host use INTSTS1 interrupt Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/renesas_usbhs')
-rw-r--r--drivers/usb/renesas_usbhs/common.h9
-rw-r--r--drivers/usb/renesas_usbhs/mod.c38
-rw-r--r--drivers/usb/renesas_usbhs/mod.h34
3 files changed, 75 insertions, 6 deletions
diff --git a/drivers/usb/renesas_usbhs/common.h b/drivers/usb/renesas_usbhs/common.h
index 0e867a33a46..dc9490d1f42 100644
--- a/drivers/usb/renesas_usbhs/common.h
+++ b/drivers/usb/renesas_usbhs/common.h
@@ -172,6 +172,15 @@ struct usbhs_priv;
172#define NODATA_STATUS_STAGE 5 /* Control write NoData status stage */ 172#define NODATA_STATUS_STAGE 5 /* Control write NoData status stage */
173#define SEQUENCE_ERROR 6 /* Control transfer sequence error */ 173#define SEQUENCE_ERROR 6 /* Control transfer sequence error */
174 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
175/* PIPECFG */ 184/* PIPECFG */
176/* DCPCFG */ 185/* DCPCFG */
177#define TYPE_NONE (0 << 14) /* Transfer Type */ 186#define TYPE_NONE (0 << 14) /* Transfer Type */
diff --git a/drivers/usb/renesas_usbhs/mod.c b/drivers/usb/renesas_usbhs/mod.c
index 0340fb945f5..993c2ca4f0c 100644
--- a/drivers/usb/renesas_usbhs/mod.c
+++ b/drivers/usb/renesas_usbhs/mod.c
@@ -254,6 +254,8 @@ static irqreturn_t usbhs_interrupt(int irq, void *data)
254 * see also 254 * see also
255 * usbhs_irq_setting_update 255 * usbhs_irq_setting_update
256 */ 256 */
257
258 /* INTSTS0 */
257 if (irq_state.intsts0 & VBINT) 259 if (irq_state.intsts0 & VBINT)
258 usbhs_mod_info_call(priv, irq_vbus, priv, &irq_state); 260 usbhs_mod_info_call(priv, irq_vbus, priv, &irq_state);
259 261
@@ -269,12 +271,26 @@ static irqreturn_t usbhs_interrupt(int irq, void *data)
269 if (irq_state.intsts0 & BRDY) 271 if (irq_state.intsts0 & BRDY)
270 usbhs_mod_call(priv, irq_ready, priv, &irq_state); 272 usbhs_mod_call(priv, irq_ready, priv, &irq_state);
271 273
274 /* INTSTS1 */
275 if (irq_state.intsts1 & ATTCH)
276 usbhs_mod_call(priv, irq_attch, priv, &irq_state);
277
278 if (irq_state.intsts1 & DTCH)
279 usbhs_mod_call(priv, irq_dtch, priv, &irq_state);
280
281 if (irq_state.intsts1 & SIGN)
282 usbhs_mod_call(priv, irq_sign, priv, &irq_state);
283
284 if (irq_state.intsts1 & SACK)
285 usbhs_mod_call(priv, irq_sack, priv, &irq_state);
286
272 return IRQ_HANDLED; 287 return IRQ_HANDLED;
273} 288}
274 289
275void usbhs_irq_callback_update(struct usbhs_priv *priv, struct usbhs_mod *mod) 290void usbhs_irq_callback_update(struct usbhs_priv *priv, struct usbhs_mod *mod)
276{ 291{
277 u16 intenb0 = 0; 292 u16 intenb0 = 0;
293 u16 intenb1 = 0;
278 struct usbhs_mod_info *info = usbhs_priv_to_modinfo(priv); 294 struct usbhs_mod_info *info = usbhs_priv_to_modinfo(priv);
279 295
280 /* 296 /*
@@ -286,6 +302,7 @@ void usbhs_irq_callback_update(struct usbhs_priv *priv, struct usbhs_mod *mod)
286 * - update INTSTS0 302 * - update INTSTS0
287 */ 303 */
288 usbhs_write(priv, INTENB0, 0); 304 usbhs_write(priv, INTENB0, 0);
305 usbhs_write(priv, INTENB1, 0);
289 306
290 usbhs_write(priv, BEMPENB, 0); 307 usbhs_write(priv, BEMPENB, 0);
291 usbhs_write(priv, BRDYENB, 0); 308 usbhs_write(priv, BRDYENB, 0);
@@ -303,6 +320,9 @@ void usbhs_irq_callback_update(struct usbhs_priv *priv, struct usbhs_mod *mod)
303 intenb0 |= VBSE; 320 intenb0 |= VBSE;
304 321
305 if (mod) { 322 if (mod) {
323 /*
324 * INTSTS0
325 */
306 if (mod->irq_ctrl_stage) 326 if (mod->irq_ctrl_stage)
307 intenb0 |= CTRE; 327 intenb0 |= CTRE;
308 328
@@ -315,8 +335,26 @@ void usbhs_irq_callback_update(struct usbhs_priv *priv, struct usbhs_mod *mod)
315 usbhs_write(priv, BRDYENB, mod->irq_brdysts); 335 usbhs_write(priv, BRDYENB, mod->irq_brdysts);
316 intenb0 |= BRDYE; 336 intenb0 |= BRDYE;
317 } 337 }
338
339 /*
340 * INTSTS1
341 */
342 if (mod->irq_attch)
343 intenb1 |= ATTCHE;
344
345 if (mod->irq_attch)
346 intenb1 |= DTCHE;
347
348 if (mod->irq_sign)
349 intenb1 |= SIGNE;
350
351 if (mod->irq_sack)
352 intenb1 |= SACKE;
318 } 353 }
319 354
320 if (intenb0) 355 if (intenb0)
321 usbhs_write(priv, INTENB0, intenb0); 356 usbhs_write(priv, INTENB0, intenb0);
357
358 if (intenb1)
359 usbhs_write(priv, INTENB1, intenb1);
322} 360}
diff --git a/drivers/usb/renesas_usbhs/mod.h b/drivers/usb/renesas_usbhs/mod.h
index 0e2c5b69582..df4b61dab31 100644
--- a/drivers/usb/renesas_usbhs/mod.h
+++ b/drivers/usb/renesas_usbhs/mod.h
@@ -41,26 +41,48 @@ struct usbhs_mod {
41 int (*start)(struct usbhs_priv *priv); 41 int (*start)(struct usbhs_priv *priv);
42 int (*stop)(struct usbhs_priv *priv); 42 int (*stop)(struct usbhs_priv *priv);
43 43
44 /* INTSTS0 :: DVST (DVSQ) */ 44 /*
45 * INTSTS0
46 */
47
48 /* DVST (DVSQ) */
45 int (*irq_dev_state)(struct usbhs_priv *priv, 49 int (*irq_dev_state)(struct usbhs_priv *priv,
46 struct usbhs_irq_state *irq_state); 50 struct usbhs_irq_state *irq_state);
47 51
48 /* INTSTS0 :: CTRT (CTSQ) */ 52 /* CTRT (CTSQ) */
49 int (*irq_ctrl_stage)(struct usbhs_priv *priv, 53 int (*irq_ctrl_stage)(struct usbhs_priv *priv,
50 struct usbhs_irq_state *irq_state); 54 struct usbhs_irq_state *irq_state);
51 55
52 /* INTSTS0 :: BEMP */ 56 /* BEMP / BEMPSTS */
53 /* BEMPSTS */
54 int (*irq_empty)(struct usbhs_priv *priv, 57 int (*irq_empty)(struct usbhs_priv *priv,
55 struct usbhs_irq_state *irq_state); 58 struct usbhs_irq_state *irq_state);
56 u16 irq_bempsts; 59 u16 irq_bempsts;
57 60
58 /* INTSTS0 :: BRDY */ 61 /* BRDY / BRDYSTS */
59 /* BRDYSTS */
60 int (*irq_ready)(struct usbhs_priv *priv, 62 int (*irq_ready)(struct usbhs_priv *priv,
61 struct usbhs_irq_state *irq_state); 63 struct usbhs_irq_state *irq_state);
62 u16 irq_brdysts; 64 u16 irq_brdysts;
63 65
66 /*
67 * INTSTS1
68 */
69
70 /* ATTCHE */
71 int (*irq_attch)(struct usbhs_priv *priv,
72 struct usbhs_irq_state *irq_state);
73
74 /* DTCHE */
75 int (*irq_dtch)(struct usbhs_priv *priv,
76 struct usbhs_irq_state *irq_state);
77
78 /* SIGN */
79 int (*irq_sign)(struct usbhs_priv *priv,
80 struct usbhs_irq_state *irq_state);
81
82 /* SACK */
83 int (*irq_sack)(struct usbhs_priv *priv,
84 struct usbhs_irq_state *irq_state);
85
64 struct usbhs_priv *priv; 86 struct usbhs_priv *priv;
65}; 87};
66 88