aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/uhci-q.c
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2007-02-19 15:51:51 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2007-02-23 18:03:45 -0500
commit28b9325e6ae45ffb5e99fedcafe00f25fcaacf06 (patch)
tree91391a8e2d11acc50adc5b7c631b2695bee9e453 /drivers/usb/host/uhci-q.c
parentd0374f4f9c35cdfbee0ade72d06732613b4e6628 (diff)
UHCI: Add macros for computing DMA values
This patch (as855) adds some convenience macros to uhci-hcd, to help simplify the code for computing hardware DMA pointers. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/host/uhci-q.c')
-rw-r--r--drivers/usb/host/uhci-q.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/drivers/usb/host/uhci-q.c b/drivers/usb/host/uhci-q.c
index 68e66b33e726..a0c6bf6128a3 100644
--- a/drivers/usb/host/uhci-q.c
+++ b/drivers/usb/host/uhci-q.c
@@ -46,8 +46,7 @@ static inline void uhci_clear_next_interrupt(struct uhci_hcd *uhci)
46static void uhci_fsbr_on(struct uhci_hcd *uhci) 46static void uhci_fsbr_on(struct uhci_hcd *uhci)
47{ 47{
48 uhci->fsbr_is_on = 1; 48 uhci->fsbr_is_on = 1;
49 uhci->skel_term_qh->link = cpu_to_le32( 49 uhci->skel_term_qh->link = LINK_TO_QH(uhci->skel_fs_control_qh);
50 uhci->skel_fs_control_qh->dma_handle) | UHCI_PTR_QH;
51} 50}
52 51
53static void uhci_fsbr_off(struct uhci_hcd *uhci) 52static void uhci_fsbr_off(struct uhci_hcd *uhci)
@@ -158,11 +157,11 @@ static inline void uhci_insert_td_in_frame_list(struct uhci_hcd *uhci,
158 157
159 td->link = ltd->link; 158 td->link = ltd->link;
160 wmb(); 159 wmb();
161 ltd->link = cpu_to_le32(td->dma_handle); 160 ltd->link = LINK_TO_TD(td);
162 } else { 161 } else {
163 td->link = uhci->frame[framenum]; 162 td->link = uhci->frame[framenum];
164 wmb(); 163 wmb();
165 uhci->frame[framenum] = cpu_to_le32(td->dma_handle); 164 uhci->frame[framenum] = LINK_TO_TD(td);
166 uhci->frame_cpu[framenum] = td; 165 uhci->frame_cpu[framenum] = td;
167 } 166 }
168} 167}
@@ -184,7 +183,7 @@ static inline void uhci_remove_td_from_frame_list(struct uhci_hcd *uhci,
184 struct uhci_td *ntd; 183 struct uhci_td *ntd;
185 184
186 ntd = list_entry(td->fl_list.next, struct uhci_td, fl_list); 185 ntd = list_entry(td->fl_list.next, struct uhci_td, fl_list);
187 uhci->frame[td->frame] = cpu_to_le32(ntd->dma_handle); 186 uhci->frame[td->frame] = LINK_TO_TD(ntd);
188 uhci->frame_cpu[td->frame] = ntd; 187 uhci->frame_cpu[td->frame] = ntd;
189 } 188 }
190 } else { 189 } else {
@@ -421,7 +420,7 @@ static void uhci_activate_qh(struct uhci_hcd *uhci, struct uhci_qh *qh)
421 struct uhci_td *td = list_entry(urbp->td_list.next, 420 struct uhci_td *td = list_entry(urbp->td_list.next,
422 struct uhci_td, list); 421 struct uhci_td, list);
423 422
424 qh->element = cpu_to_le32(td->dma_handle); 423 qh->element = LINK_TO_TD(td);
425 } 424 }
426 425
427 /* Treat the queue as if it has just advanced */ 426 /* Treat the queue as if it has just advanced */
@@ -443,7 +442,7 @@ static void uhci_activate_qh(struct uhci_hcd *uhci, struct uhci_qh *qh)
443 pqh = list_entry(qh->node.prev, struct uhci_qh, node); 442 pqh = list_entry(qh->node.prev, struct uhci_qh, node);
444 qh->link = pqh->link; 443 qh->link = pqh->link;
445 wmb(); 444 wmb();
446 pqh->link = UHCI_PTR_QH | cpu_to_le32(qh->dma_handle); 445 pqh->link = LINK_TO_QH(qh);
447} 446}
448 447
449/* 448/*
@@ -737,7 +736,7 @@ static int uhci_submit_control(struct uhci_hcd *uhci, struct urb *urb,
737 td = uhci_alloc_td(uhci); 736 td = uhci_alloc_td(uhci);
738 if (!td) 737 if (!td)
739 goto nomem; 738 goto nomem;
740 *plink = cpu_to_le32(td->dma_handle); 739 *plink = LINK_TO_TD(td);
741 740
742 /* Alternate Data0/1 (start with Data1) */ 741 /* Alternate Data0/1 (start with Data1) */
743 destination ^= TD_TOKEN_TOGGLE; 742 destination ^= TD_TOKEN_TOGGLE;
@@ -757,7 +756,7 @@ static int uhci_submit_control(struct uhci_hcd *uhci, struct urb *urb,
757 td = uhci_alloc_td(uhci); 756 td = uhci_alloc_td(uhci);
758 if (!td) 757 if (!td)
759 goto nomem; 758 goto nomem;
760 *plink = cpu_to_le32(td->dma_handle); 759 *plink = LINK_TO_TD(td);
761 760
762 /* 761 /*
763 * It's IN if the pipe is an output pipe or we're not expecting 762 * It's IN if the pipe is an output pipe or we're not expecting
@@ -784,7 +783,7 @@ static int uhci_submit_control(struct uhci_hcd *uhci, struct urb *urb,
784 td = uhci_alloc_td(uhci); 783 td = uhci_alloc_td(uhci);
785 if (!td) 784 if (!td)
786 goto nomem; 785 goto nomem;
787 *plink = cpu_to_le32(td->dma_handle); 786 *plink = LINK_TO_TD(td);
788 787
789 uhci_fill_td(td, 0, USB_PID_OUT | uhci_explen(0), 0); 788 uhci_fill_td(td, 0, USB_PID_OUT | uhci_explen(0), 0);
790 wmb(); 789 wmb();
@@ -860,7 +859,7 @@ static int uhci_submit_common(struct uhci_hcd *uhci, struct urb *urb,
860 td = uhci_alloc_td(uhci); 859 td = uhci_alloc_td(uhci);
861 if (!td) 860 if (!td)
862 goto nomem; 861 goto nomem;
863 *plink = cpu_to_le32(td->dma_handle); 862 *plink = LINK_TO_TD(td);
864 } 863 }
865 uhci_add_td_to_urbp(td, urbp); 864 uhci_add_td_to_urbp(td, urbp);
866 uhci_fill_td(td, status, 865 uhci_fill_td(td, status,
@@ -888,7 +887,7 @@ static int uhci_submit_common(struct uhci_hcd *uhci, struct urb *urb,
888 td = uhci_alloc_td(uhci); 887 td = uhci_alloc_td(uhci);
889 if (!td) 888 if (!td)
890 goto nomem; 889 goto nomem;
891 *plink = cpu_to_le32(td->dma_handle); 890 *plink = LINK_TO_TD(td);
892 891
893 uhci_add_td_to_urbp(td, urbp); 892 uhci_add_td_to_urbp(td, urbp);
894 uhci_fill_td(td, status, 893 uhci_fill_td(td, status,
@@ -914,7 +913,7 @@ static int uhci_submit_common(struct uhci_hcd *uhci, struct urb *urb,
914 td = uhci_alloc_td(uhci); 913 td = uhci_alloc_td(uhci);
915 if (!td) 914 if (!td)
916 goto nomem; 915 goto nomem;
917 *plink = cpu_to_le32(td->dma_handle); 916 *plink = LINK_TO_TD(td);
918 917
919 uhci_fill_td(td, 0, USB_PID_OUT | uhci_explen(0), 0); 918 uhci_fill_td(td, 0, USB_PID_OUT | uhci_explen(0), 0);
920 wmb(); 919 wmb();
@@ -1005,7 +1004,7 @@ static int uhci_fixup_short_transfer(struct uhci_hcd *uhci,
1005 * the queue at the status stage transaction, which is 1004 * the queue at the status stage transaction, which is
1006 * the last TD. */ 1005 * the last TD. */
1007 WARN_ON(list_empty(&urbp->td_list)); 1006 WARN_ON(list_empty(&urbp->td_list));
1008 qh->element = cpu_to_le32(td->dma_handle); 1007 qh->element = LINK_TO_TD(td);
1009 tmp = td->list.prev; 1008 tmp = td->list.prev;
1010 ret = -EINPROGRESS; 1009 ret = -EINPROGRESS;
1011 1010
@@ -1566,8 +1565,7 @@ static int uhci_advance_check(struct uhci_hcd *uhci, struct uhci_qh *qh)
1566 if (time_after(jiffies, qh->advance_jiffies + QH_WAIT_TIMEOUT)) { 1565 if (time_after(jiffies, qh->advance_jiffies + QH_WAIT_TIMEOUT)) {
1567 1566
1568 /* Detect the Intel bug and work around it */ 1567 /* Detect the Intel bug and work around it */
1569 if (qh->post_td && qh_element(qh) == 1568 if (qh->post_td && qh_element(qh) == LINK_TO_TD(qh->post_td)) {
1570 cpu_to_le32(qh->post_td->dma_handle)) {
1571 qh->element = qh->post_td->link; 1569 qh->element = qh->post_td->link;
1572 qh->advance_jiffies = jiffies; 1570 qh->advance_jiffies = jiffies;
1573 ret = 1; 1571 ret = 1;