aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/renesas_usbhs/pipe.c
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2011-10-11 01:02:21 -0400
committerFelipe Balbi <balbi@ti.com>2011-10-13 13:41:39 -0400
commit356db7edadb98edbc60abf46b86a1816bfee6278 (patch)
tree24b84889f4ee0df1b72bc2940c6f265e62f3d757 /drivers/usb/renesas_usbhs/pipe.c
parent75587f52c7b0d6c319515138a495a619b552a670 (diff)
usb: gadget: renesas_usbhs: move usbhsp_type() to usbhs_pipe_type()
Pipe type check macro will be used in other files. This patch move local macro to global macro. 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/pipe.c')
-rw-r--r--drivers/usb/renesas_usbhs/pipe.c35
1 files changed, 17 insertions, 18 deletions
diff --git a/drivers/usb/renesas_usbhs/pipe.c b/drivers/usb/renesas_usbhs/pipe.c
index 1f86bededf88..18101332eb8a 100644
--- a/drivers/usb/renesas_usbhs/pipe.c
+++ b/drivers/usb/renesas_usbhs/pipe.c
@@ -29,9 +29,6 @@
29#define usbhsp_flags_has(p, f) ((p)->flags & USBHS_PIPE_FLAGS_##f) 29#define usbhsp_flags_has(p, f) ((p)->flags & USBHS_PIPE_FLAGS_##f)
30#define usbhsp_flags_init(p) do {(p)->flags = 0; } while (0) 30#define usbhsp_flags_init(p) do {(p)->flags = 0; } while (0)
31 31
32#define usbhsp_type(p) ((p)->pipe_type)
33#define usbhsp_type_is(p, t) ((p)->pipe_type == t)
34
35/* 32/*
36 * for debug 33 * for debug
37 */ 34 */
@@ -287,8 +284,8 @@ static int usbhsp_possible_double_buffer(struct usbhs_pipe *pipe)
287 /* 284 /*
288 * only ISO / BULK pipe can use double buffer 285 * only ISO / BULK pipe can use double buffer
289 */ 286 */
290 if (usbhsp_type_is(pipe, USB_ENDPOINT_XFER_BULK) || 287 if (usbhs_pipe_type_is(pipe, USB_ENDPOINT_XFER_BULK) ||
291 usbhsp_type_is(pipe, USB_ENDPOINT_XFER_ISOC)) 288 usbhs_pipe_type_is(pipe, USB_ENDPOINT_XFER_ISOC))
292 return 1; 289 return 1;
293 290
294 return 0; 291 return 0;
@@ -325,20 +322,20 @@ static u16 usbhsp_setup_pipecfg(struct usbhs_pipe *pipe,
325 */ 322 */
326 323
327 /* TYPE */ 324 /* TYPE */
328 type = type_array[usbhsp_type(pipe)]; 325 type = type_array[usbhs_pipe_type(pipe)];
329 326
330 /* BFRE */ 327 /* BFRE */
331 if (usbhsp_type_is(pipe, USB_ENDPOINT_XFER_ISOC) || 328 if (usbhs_pipe_type_is(pipe, USB_ENDPOINT_XFER_ISOC) ||
332 usbhsp_type_is(pipe, USB_ENDPOINT_XFER_BULK)) 329 usbhs_pipe_type_is(pipe, USB_ENDPOINT_XFER_BULK))
333 bfre = 0; /* FIXME */ 330 bfre = 0; /* FIXME */
334 331
335 /* DBLB */ 332 /* DBLB */
336 if (usbhsp_type_is(pipe, USB_ENDPOINT_XFER_ISOC) || 333 if (usbhs_pipe_type_is(pipe, USB_ENDPOINT_XFER_ISOC) ||
337 usbhsp_type_is(pipe, USB_ENDPOINT_XFER_BULK)) 334 usbhs_pipe_type_is(pipe, USB_ENDPOINT_XFER_BULK))
338 dblb = (is_double) ? DBLB : 0; 335 dblb = (is_double) ? DBLB : 0;
339 336
340 /* CNTMD */ 337 /* CNTMD */
341 if (usbhsp_type_is(pipe, USB_ENDPOINT_XFER_BULK)) 338 if (usbhs_pipe_type_is(pipe, USB_ENDPOINT_XFER_BULK))
342 cntmd = 0; /* FIXME */ 339 cntmd = 0; /* FIXME */
343 340
344 /* DIR */ 341 /* DIR */
@@ -353,7 +350,7 @@ static u16 usbhsp_setup_pipecfg(struct usbhs_pipe *pipe,
353 usbhsp_flags_set(pipe, IS_DIR_IN); 350 usbhsp_flags_set(pipe, IS_DIR_IN);
354 351
355 /* SHTNAK */ 352 /* SHTNAK */
356 if (usbhsp_type_is(pipe, USB_ENDPOINT_XFER_BULK) && 353 if (usbhs_pipe_type_is(pipe, USB_ENDPOINT_XFER_BULK) &&
357 !dir) 354 !dir)
358 shtnak = SHTNAK; 355 shtnak = SHTNAK;
359 356
@@ -413,9 +410,9 @@ static u16 usbhsp_setup_pipebuff(struct usbhs_pipe *pipe)
413 * INT : 64 byte 410 * INT : 64 byte
414 * ISOC: 512 byte 411 * ISOC: 512 byte
415 */ 412 */
416 if (usbhsp_type_is(pipe, USB_ENDPOINT_XFER_CONTROL)) 413 if (usbhs_pipe_type_is(pipe, USB_ENDPOINT_XFER_CONTROL))
417 buff_size = 256; 414 buff_size = 256;
418 else if (usbhsp_type_is(pipe, USB_ENDPOINT_XFER_INT)) 415 else if (usbhs_pipe_type_is(pipe, USB_ENDPOINT_XFER_INT))
419 buff_size = 64; 416 buff_size = 64;
420 else 417 else
421 buff_size = 512; 418 buff_size = 512;
@@ -425,7 +422,7 @@ static u16 usbhsp_setup_pipebuff(struct usbhs_pipe *pipe)
425 422
426 /* BUFNMB has been reserved for INT pipe 423 /* BUFNMB has been reserved for INT pipe
427 * see above */ 424 * see above */
428 if (usbhsp_type_is(pipe, USB_ENDPOINT_XFER_INT)) { 425 if (usbhs_pipe_type_is(pipe, USB_ENDPOINT_XFER_INT)) {
429 bufnmb = pipe_num - 2; 426 bufnmb = pipe_num - 2;
430 } else { 427 } else {
431 bufnmb = info->bufnmb_last; 428 bufnmb = info->bufnmb_last;
@@ -502,7 +499,7 @@ static struct usbhs_pipe *usbhsp_get_pipe(struct usbhs_priv *priv, u32 type)
502 */ 499 */
503 pipe = NULL; 500 pipe = NULL;
504 usbhs_for_each_pipe_with_dcp(pos, priv, i) { 501 usbhs_for_each_pipe_with_dcp(pos, priv, i) {
505 if (!usbhsp_type_is(pos, type)) 502 if (!usbhs_pipe_type_is(pos, type))
506 continue; 503 continue;
507 if (usbhsp_flags_has(pos, IS_USED)) 504 if (usbhsp_flags_has(pos, IS_USED))
508 continue; 505 continue;
@@ -551,7 +548,7 @@ void usbhs_pipe_init(struct usbhs_priv *priv,
551 */ 548 */
552 info->bufnmb_last = 4; 549 info->bufnmb_last = 4;
553 usbhs_for_each_pipe_with_dcp(pipe, priv, i) { 550 usbhs_for_each_pipe_with_dcp(pipe, priv, i) {
554 if (usbhsp_type_is(pipe, USB_ENDPOINT_XFER_INT)) 551 if (usbhs_pipe_type_is(pipe, USB_ENDPOINT_XFER_INT))
555 info->bufnmb_last++; 552 info->bufnmb_last++;
556 553
557 usbhsp_flags_init(pipe); 554 usbhsp_flags_init(pipe);
@@ -689,7 +686,9 @@ int usbhs_pipe_probe(struct usbhs_priv *priv)
689 */ 686 */
690 usbhs_for_each_pipe_with_dcp(pipe, priv, i) { 687 usbhs_for_each_pipe_with_dcp(pipe, priv, i) {
691 pipe->priv = priv; 688 pipe->priv = priv;
692 usbhsp_type(pipe) = pipe_type[i] & USB_ENDPOINT_XFERTYPE_MASK; 689
690 usbhs_pipe_type(pipe) =
691 pipe_type[i] & USB_ENDPOINT_XFERTYPE_MASK;
693 692
694 dev_dbg(dev, "pipe %x\t: %s\n", 693 dev_dbg(dev, "pipe %x\t: %s\n",
695 i, usbhsp_pipe_name[pipe_type[i]]); 694 i, usbhsp_pipe_name[pipe_type[i]]);