diff options
author | Arvid Brodin <arvid.brodin@enea.com> | 2011-02-26 16:08:47 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-02-28 22:23:39 -0500 |
commit | 7adc14b14b43b6ca9f2f00ac7a4780577dbe883b (patch) | |
tree | d878823dd8c7c72d1f934612d90f4512f11d7a38 | |
parent | 65f1b5255ce0e657e4d8de92098837d36831320a (diff) |
usb/isp1760: Handle toggle bit in queue heads only
Remove redundant "toggle" member from struct isp1760_qtd, and store toggle
status in struct isp1760_qh only.
Signed-off-by: Arvid Brodin <arvid.brodin@enea.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/usb/host/isp1760-hcd.c | 54 |
1 files changed, 21 insertions, 33 deletions
diff --git a/drivers/usb/host/isp1760-hcd.c b/drivers/usb/host/isp1760-hcd.c index fd718ff6afab..d2b674ace0be 100644 --- a/drivers/usb/host/isp1760-hcd.c +++ b/drivers/usb/host/isp1760-hcd.c | |||
@@ -78,8 +78,6 @@ static inline struct isp1760_hcd *hcd_to_priv(struct usb_hcd *hcd) | |||
78 | 78 | ||
79 | struct isp1760_qtd { | 79 | struct isp1760_qtd { |
80 | u8 packet_type; | 80 | u8 packet_type; |
81 | u8 toggle; | ||
82 | |||
83 | void *data_buffer; | 81 | void *data_buffer; |
84 | u32 payload_addr; | 82 | u32 payload_addr; |
85 | 83 | ||
@@ -588,6 +586,18 @@ static u32 base_to_chip(u32 base) | |||
588 | return ((base - 0x400) >> 3); | 586 | return ((base - 0x400) >> 3); |
589 | } | 587 | } |
590 | 588 | ||
589 | static int last_qtd_of_urb(struct isp1760_qtd *qtd, struct isp1760_qh *qh) | ||
590 | { | ||
591 | struct urb *urb; | ||
592 | |||
593 | if (list_is_last(&qtd->qtd_list, &qh->qtd_list)) | ||
594 | return 1; | ||
595 | |||
596 | urb = qtd->urb; | ||
597 | qtd = list_entry(qtd->qtd_list.next, typeof(*qtd), qtd_list); | ||
598 | return (qtd->urb != urb); | ||
599 | } | ||
600 | |||
591 | static void transform_into_atl(struct isp1760_qh *qh, | 601 | static void transform_into_atl(struct isp1760_qh *qh, |
592 | struct isp1760_qtd *qtd, struct ptd *ptd) | 602 | struct isp1760_qtd *qtd, struct ptd *ptd) |
593 | { | 603 | { |
@@ -656,11 +666,13 @@ static void transform_into_atl(struct isp1760_qh *qh, | |||
656 | ptd->dw3 |= PTD_NAC_CNT(nak); | 666 | ptd->dw3 |= PTD_NAC_CNT(nak); |
657 | 667 | ||
658 | /* DW3 */ | 668 | /* DW3 */ |
659 | if (usb_pipecontrol(qtd->urb->pipe)) | 669 | ptd->dw3 |= qh->toggle; |
660 | ptd->dw3 |= PTD_DATA_TOGGLE(qtd->toggle); | 670 | if (usb_pipecontrol(qtd->urb->pipe)) { |
661 | else | 671 | if (qtd->data_buffer == qtd->urb->setup_packet) |
662 | ptd->dw3 |= qh->toggle; | 672 | ptd->dw3 &= ~PTD_DATA_TOGGLE(1); |
663 | 673 | else if (last_qtd_of_urb(qtd, qh)) | |
674 | ptd->dw3 |= PTD_DATA_TOGGLE(1); | ||
675 | } | ||
664 | 676 | ||
665 | ptd->dw3 |= PTD_ACTIVE; | 677 | ptd->dw3 |= PTD_ACTIVE; |
666 | /* Cerr */ | 678 | /* Cerr */ |
@@ -733,7 +745,6 @@ static int qtd_fill(struct isp1760_qtd *qtd, void *databuffer, size_t len, | |||
733 | 745 | ||
734 | qtd->data_buffer = databuffer; | 746 | qtd->data_buffer = databuffer; |
735 | qtd->packet_type = GET_QTD_TOKEN_TYPE(token); | 747 | qtd->packet_type = GET_QTD_TOKEN_TYPE(token); |
736 | qtd->toggle = GET_DATA_TOGGLE(token); | ||
737 | 748 | ||
738 | if (len > MAX_PAYLOAD_SIZE) | 749 | if (len > MAX_PAYLOAD_SIZE) |
739 | count = MAX_PAYLOAD_SIZE; | 750 | count = MAX_PAYLOAD_SIZE; |
@@ -976,18 +987,6 @@ static struct isp1760_qtd *clean_up_qtdlist(struct isp1760_qtd *qtd, | |||
976 | return qtd; | 987 | return qtd; |
977 | } | 988 | } |
978 | 989 | ||
979 | static int last_qtd_of_urb(struct isp1760_qtd *qtd, struct isp1760_qh *qh) | ||
980 | { | ||
981 | struct urb *urb; | ||
982 | |||
983 | if (list_is_last(&qtd->qtd_list, &qh->qtd_list)) | ||
984 | return 1; | ||
985 | |||
986 | urb = qtd->urb; | ||
987 | qtd = list_entry(qtd->qtd_list.next, typeof(*qtd), qtd_list); | ||
988 | return (qtd->urb != urb); | ||
989 | } | ||
990 | |||
991 | static void do_atl_int(struct usb_hcd *hcd) | 990 | static void do_atl_int(struct usb_hcd *hcd) |
992 | { | 991 | { |
993 | struct isp1760_hcd *priv = hcd_to_priv(hcd); | 992 | struct isp1760_hcd *priv = hcd_to_priv(hcd); |
@@ -1106,12 +1105,8 @@ static void do_atl_int(struct usb_hcd *hcd) | |||
1106 | ptd.dw4, ptd.dw5, ptd.dw6, ptd.dw7); | 1105 | ptd.dw4, ptd.dw5, ptd.dw6, ptd.dw7); |
1107 | #endif | 1106 | #endif |
1108 | } else { | 1107 | } else { |
1109 | if (usb_pipetype(qtd->urb->pipe) == PIPE_BULK) { | 1108 | priv->atl_ints[slot].qh->toggle = ptd.dw3 & (1 << 25); |
1110 | priv->atl_ints[slot].qh->toggle = | 1109 | priv->atl_ints[slot].qh->ping = ptd.dw3 & (1 << 26); |
1111 | ptd.dw3 & (1 << 25); | ||
1112 | priv->atl_ints[slot].qh->ping = | ||
1113 | ptd.dw3 & (1 << 26); | ||
1114 | } | ||
1115 | } | 1110 | } |
1116 | 1111 | ||
1117 | length = PTD_XFERRED_LENGTH(ptd.dw3); | 1112 | length = PTD_XFERRED_LENGTH(ptd.dw3); |
@@ -1454,7 +1449,6 @@ static struct list_head *qh_urb_transaction(struct usb_hcd *hcd, | |||
1454 | token | SETUP_PID); | 1449 | token | SETUP_PID); |
1455 | 1450 | ||
1456 | /* ... and always at least one more pid */ | 1451 | /* ... and always at least one more pid */ |
1457 | token ^= DATA_TOGGLE; | ||
1458 | qtd = isp1760_qtd_alloc(flags); | 1452 | qtd = isp1760_qtd_alloc(flags); |
1459 | if (!qtd) | 1453 | if (!qtd) |
1460 | goto cleanup; | 1454 | goto cleanup; |
@@ -1497,10 +1491,6 @@ static struct list_head *qh_urb_transaction(struct usb_hcd *hcd, | |||
1497 | len -= this_qtd_len; | 1491 | len -= this_qtd_len; |
1498 | buf += this_qtd_len; | 1492 | buf += this_qtd_len; |
1499 | 1493 | ||
1500 | /* qh makes control packets use qtd toggle; maybe switch it */ | ||
1501 | if ((maxpacket & (this_qtd_len + (maxpacket - 1))) == 0) | ||
1502 | token ^= DATA_TOGGLE; | ||
1503 | |||
1504 | if (len <= 0) | 1494 | if (len <= 0) |
1505 | break; | 1495 | break; |
1506 | 1496 | ||
@@ -1522,8 +1512,6 @@ static struct list_head *qh_urb_transaction(struct usb_hcd *hcd, | |||
1522 | one_more = 1; | 1512 | one_more = 1; |
1523 | /* "in" <--> "out" */ | 1513 | /* "in" <--> "out" */ |
1524 | token ^= IN_PID; | 1514 | token ^= IN_PID; |
1525 | /* force DATA1 */ | ||
1526 | token |= DATA_TOGGLE; | ||
1527 | } else if (usb_pipebulk(urb->pipe) | 1515 | } else if (usb_pipebulk(urb->pipe) |
1528 | && (urb->transfer_flags & URB_ZERO_PACKET) | 1516 | && (urb->transfer_flags & URB_ZERO_PACKET) |
1529 | && !(urb->transfer_buffer_length % maxpacket)) { | 1517 | && !(urb->transfer_buffer_length % maxpacket)) { |