Commit 7adc14b1 authored by Arvid Brodin's avatar Arvid Brodin Committed by Greg Kroah-Hartman

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: default avatarArvid Brodin <arvid.brodin@enea.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 65f1b525
...@@ -78,8 +78,6 @@ static inline struct isp1760_hcd *hcd_to_priv(struct usb_hcd *hcd) ...@@ -78,8 +78,6 @@ static inline struct isp1760_hcd *hcd_to_priv(struct usb_hcd *hcd)
struct isp1760_qtd { struct isp1760_qtd {
u8 packet_type; u8 packet_type;
u8 toggle;
void *data_buffer; void *data_buffer;
u32 payload_addr; u32 payload_addr;
...@@ -588,6 +586,18 @@ static u32 base_to_chip(u32 base) ...@@ -588,6 +586,18 @@ static u32 base_to_chip(u32 base)
return ((base - 0x400) >> 3); return ((base - 0x400) >> 3);
} }
static int last_qtd_of_urb(struct isp1760_qtd *qtd, struct isp1760_qh *qh)
{
struct urb *urb;
if (list_is_last(&qtd->qtd_list, &qh->qtd_list))
return 1;
urb = qtd->urb;
qtd = list_entry(qtd->qtd_list.next, typeof(*qtd), qtd_list);
return (qtd->urb != urb);
}
static void transform_into_atl(struct isp1760_qh *qh, static void transform_into_atl(struct isp1760_qh *qh,
struct isp1760_qtd *qtd, struct ptd *ptd) struct isp1760_qtd *qtd, struct ptd *ptd)
{ {
...@@ -656,11 +666,13 @@ static void transform_into_atl(struct isp1760_qh *qh, ...@@ -656,11 +666,13 @@ static void transform_into_atl(struct isp1760_qh *qh,
ptd->dw3 |= PTD_NAC_CNT(nak); ptd->dw3 |= PTD_NAC_CNT(nak);
/* DW3 */ /* DW3 */
if (usb_pipecontrol(qtd->urb->pipe)) ptd->dw3 |= qh->toggle;
ptd->dw3 |= PTD_DATA_TOGGLE(qtd->toggle); if (usb_pipecontrol(qtd->urb->pipe)) {
else if (qtd->data_buffer == qtd->urb->setup_packet)
ptd->dw3 |= qh->toggle; ptd->dw3 &= ~PTD_DATA_TOGGLE(1);
else if (last_qtd_of_urb(qtd, qh))
ptd->dw3 |= PTD_DATA_TOGGLE(1);
}
ptd->dw3 |= PTD_ACTIVE; ptd->dw3 |= PTD_ACTIVE;
/* Cerr */ /* Cerr */
...@@ -733,7 +745,6 @@ static int qtd_fill(struct isp1760_qtd *qtd, void *databuffer, size_t len, ...@@ -733,7 +745,6 @@ static int qtd_fill(struct isp1760_qtd *qtd, void *databuffer, size_t len,
qtd->data_buffer = databuffer; qtd->data_buffer = databuffer;
qtd->packet_type = GET_QTD_TOKEN_TYPE(token); qtd->packet_type = GET_QTD_TOKEN_TYPE(token);
qtd->toggle = GET_DATA_TOGGLE(token);
if (len > MAX_PAYLOAD_SIZE) if (len > MAX_PAYLOAD_SIZE)
count = MAX_PAYLOAD_SIZE; count = MAX_PAYLOAD_SIZE;
...@@ -976,18 +987,6 @@ static struct isp1760_qtd *clean_up_qtdlist(struct isp1760_qtd *qtd, ...@@ -976,18 +987,6 @@ static struct isp1760_qtd *clean_up_qtdlist(struct isp1760_qtd *qtd,
return qtd; return qtd;
} }
static int last_qtd_of_urb(struct isp1760_qtd *qtd, struct isp1760_qh *qh)
{
struct urb *urb;
if (list_is_last(&qtd->qtd_list, &qh->qtd_list))
return 1;
urb = qtd->urb;
qtd = list_entry(qtd->qtd_list.next, typeof(*qtd), qtd_list);
return (qtd->urb != urb);
}
static void do_atl_int(struct usb_hcd *hcd) static void do_atl_int(struct usb_hcd *hcd)
{ {
struct isp1760_hcd *priv = hcd_to_priv(hcd); struct isp1760_hcd *priv = hcd_to_priv(hcd);
...@@ -1106,12 +1105,8 @@ static void do_atl_int(struct usb_hcd *hcd) ...@@ -1106,12 +1105,8 @@ static void do_atl_int(struct usb_hcd *hcd)
ptd.dw4, ptd.dw5, ptd.dw6, ptd.dw7); ptd.dw4, ptd.dw5, ptd.dw6, ptd.dw7);
#endif #endif
} else { } else {
if (usb_pipetype(qtd->urb->pipe) == PIPE_BULK) { priv->atl_ints[slot].qh->toggle = ptd.dw3 & (1 << 25);
priv->atl_ints[slot].qh->toggle = priv->atl_ints[slot].qh->ping = ptd.dw3 & (1 << 26);
ptd.dw3 & (1 << 25);
priv->atl_ints[slot].qh->ping =
ptd.dw3 & (1 << 26);
}
} }
length = PTD_XFERRED_LENGTH(ptd.dw3); length = PTD_XFERRED_LENGTH(ptd.dw3);
...@@ -1454,7 +1449,6 @@ static struct list_head *qh_urb_transaction(struct usb_hcd *hcd, ...@@ -1454,7 +1449,6 @@ static struct list_head *qh_urb_transaction(struct usb_hcd *hcd,
token | SETUP_PID); token | SETUP_PID);
/* ... and always at least one more pid */ /* ... and always at least one more pid */
token ^= DATA_TOGGLE;
qtd = isp1760_qtd_alloc(flags); qtd = isp1760_qtd_alloc(flags);
if (!qtd) if (!qtd)
goto cleanup; goto cleanup;
...@@ -1497,10 +1491,6 @@ static struct list_head *qh_urb_transaction(struct usb_hcd *hcd, ...@@ -1497,10 +1491,6 @@ static struct list_head *qh_urb_transaction(struct usb_hcd *hcd,
len -= this_qtd_len; len -= this_qtd_len;
buf += this_qtd_len; buf += this_qtd_len;
/* qh makes control packets use qtd toggle; maybe switch it */
if ((maxpacket & (this_qtd_len + (maxpacket - 1))) == 0)
token ^= DATA_TOGGLE;
if (len <= 0) if (len <= 0)
break; break;
...@@ -1522,8 +1512,6 @@ static struct list_head *qh_urb_transaction(struct usb_hcd *hcd, ...@@ -1522,8 +1512,6 @@ static struct list_head *qh_urb_transaction(struct usb_hcd *hcd,
one_more = 1; one_more = 1;
/* "in" <--> "out" */ /* "in" <--> "out" */
token ^= IN_PID; token ^= IN_PID;
/* force DATA1 */
token |= DATA_TOGGLE;
} else if (usb_pipebulk(urb->pipe) } else if (usb_pipebulk(urb->pipe)
&& (urb->transfer_flags & URB_ZERO_PACKET) && (urb->transfer_flags & URB_ZERO_PACKET)
&& !(urb->transfer_buffer_length % maxpacket)) { && !(urb->transfer_buffer_length % maxpacket)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment