diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/host/isp1760-hcd.c | 63 | ||||
-rw-r--r-- | drivers/usb/host/isp1760-hcd.h | 12 |
2 files changed, 13 insertions, 62 deletions
diff --git a/drivers/usb/host/isp1760-hcd.c b/drivers/usb/host/isp1760-hcd.c index 6b2bf4684f45..a5f03cdf9ba5 100644 --- a/drivers/usb/host/isp1760-hcd.c +++ b/drivers/usb/host/isp1760-hcd.c | |||
@@ -336,10 +336,6 @@ static void isp1760_init_regs(struct usb_hcd *hcd) | |||
336 | reg_write32(hcd->regs, HC_ATL_PTD_SKIPMAP_REG, NO_TRANSFER_ACTIVE); | 336 | reg_write32(hcd->regs, HC_ATL_PTD_SKIPMAP_REG, NO_TRANSFER_ACTIVE); |
337 | reg_write32(hcd->regs, HC_INT_PTD_SKIPMAP_REG, NO_TRANSFER_ACTIVE); | 337 | reg_write32(hcd->regs, HC_INT_PTD_SKIPMAP_REG, NO_TRANSFER_ACTIVE); |
338 | reg_write32(hcd->regs, HC_ISO_PTD_SKIPMAP_REG, NO_TRANSFER_ACTIVE); | 338 | reg_write32(hcd->regs, HC_ISO_PTD_SKIPMAP_REG, NO_TRANSFER_ACTIVE); |
339 | |||
340 | reg_write32(hcd->regs, HC_ATL_PTD_DONEMAP_REG, ~NO_TRANSFER_ACTIVE); | ||
341 | reg_write32(hcd->regs, HC_INT_PTD_DONEMAP_REG, ~NO_TRANSFER_ACTIVE); | ||
342 | reg_write32(hcd->regs, HC_ISO_PTD_DONEMAP_REG, ~NO_TRANSFER_ACTIVE); | ||
343 | } | 339 | } |
344 | 340 | ||
345 | static int handshake(struct usb_hcd *hcd, u32 reg, | 341 | static int handshake(struct usb_hcd *hcd, u32 reg, |
@@ -516,14 +512,17 @@ static void isp1760_init_maps(struct usb_hcd *hcd) | |||
516 | reg_write32(hcd->regs, HC_ATL_PTD_LASTPTD_REG, 0x80000000); | 512 | reg_write32(hcd->regs, HC_ATL_PTD_LASTPTD_REG, 0x80000000); |
517 | reg_write32(hcd->regs, HC_INT_PTD_LASTPTD_REG, 0x80000000); | 513 | reg_write32(hcd->regs, HC_INT_PTD_LASTPTD_REG, 0x80000000); |
518 | reg_write32(hcd->regs, HC_ISO_PTD_LASTPTD_REG, 0x00000001); | 514 | reg_write32(hcd->regs, HC_ISO_PTD_LASTPTD_REG, 0x00000001); |
515 | |||
516 | reg_write32(hcd->regs, HC_BUFFER_STATUS_REG, | ||
517 | ATL_BUF_FILL | INT_BUF_FILL); | ||
519 | } | 518 | } |
520 | 519 | ||
521 | static void isp1760_enable_interrupts(struct usb_hcd *hcd) | 520 | static void isp1760_enable_interrupts(struct usb_hcd *hcd) |
522 | { | 521 | { |
523 | reg_write32(hcd->regs, HC_ATL_IRQ_MASK_AND_REG, 0); | 522 | reg_write32(hcd->regs, HC_ATL_IRQ_MASK_AND_REG, 0); |
524 | reg_write32(hcd->regs, HC_ATL_IRQ_MASK_OR_REG, 0); | 523 | reg_write32(hcd->regs, HC_ATL_IRQ_MASK_OR_REG, 0xffffffff); |
525 | reg_write32(hcd->regs, HC_INT_IRQ_MASK_AND_REG, 0); | 524 | reg_write32(hcd->regs, HC_INT_IRQ_MASK_AND_REG, 0); |
526 | reg_write32(hcd->regs, HC_INT_IRQ_MASK_OR_REG, 0); | 525 | reg_write32(hcd->regs, HC_INT_IRQ_MASK_OR_REG, 0xffffffff); |
527 | reg_write32(hcd->regs, HC_ISO_IRQ_MASK_AND_REG, 0); | 526 | reg_write32(hcd->regs, HC_ISO_IRQ_MASK_AND_REG, 0); |
528 | reg_write32(hcd->regs, HC_ISO_IRQ_MASK_OR_REG, 0xffffffff); | 527 | reg_write32(hcd->regs, HC_ISO_IRQ_MASK_OR_REG, 0xffffffff); |
529 | /* step 23 passed */ | 528 | /* step 23 passed */ |
@@ -835,9 +834,8 @@ static void enqueue_an_ATL_packet(struct usb_hcd *hcd, struct isp1760_qh *qh, | |||
835 | struct isp1760_qtd *qtd) | 834 | struct isp1760_qtd *qtd) |
836 | { | 835 | { |
837 | struct isp1760_hcd *priv = hcd_to_priv(hcd); | 836 | struct isp1760_hcd *priv = hcd_to_priv(hcd); |
838 | u32 skip_map, or_map; | 837 | u32 skip_map; |
839 | u32 slot; | 838 | u32 slot; |
840 | u32 buffstatus; | ||
841 | 839 | ||
842 | /* | 840 | /* |
843 | * When this function is called from the interrupt handler to enqueue | 841 | * When this function is called from the interrupt handler to enqueue |
@@ -854,10 +852,6 @@ static void enqueue_an_ATL_packet(struct usb_hcd *hcd, struct isp1760_qh *qh, | |||
854 | 852 | ||
855 | enqueue_one_atl_qtd(hcd, qh, slot, qtd); | 853 | enqueue_one_atl_qtd(hcd, qh, slot, qtd); |
856 | 854 | ||
857 | or_map = reg_read32(hcd->regs, HC_ATL_IRQ_MASK_OR_REG); | ||
858 | or_map |= (1 << slot); | ||
859 | reg_write32(hcd->regs, HC_ATL_IRQ_MASK_OR_REG, or_map); | ||
860 | |||
861 | skip_map &= ~(1 << slot); | 855 | skip_map &= ~(1 << slot); |
862 | reg_write32(hcd->regs, HC_ATL_PTD_SKIPMAP_REG, skip_map); | 856 | reg_write32(hcd->regs, HC_ATL_PTD_SKIPMAP_REG, skip_map); |
863 | 857 | ||
@@ -865,18 +859,13 @@ static void enqueue_an_ATL_packet(struct usb_hcd *hcd, struct isp1760_qh *qh, | |||
865 | if (priv->atl_queued == 2) | 859 | if (priv->atl_queued == 2) |
866 | reg_write32(hcd->regs, HC_INTERRUPT_ENABLE, | 860 | reg_write32(hcd->regs, HC_INTERRUPT_ENABLE, |
867 | INTERRUPT_ENABLE_SOT_MASK); | 861 | INTERRUPT_ENABLE_SOT_MASK); |
868 | |||
869 | buffstatus = reg_read32(hcd->regs, HC_BUFFER_STATUS_REG); | ||
870 | buffstatus |= ATL_BUFFER; | ||
871 | reg_write32(hcd->regs, HC_BUFFER_STATUS_REG, buffstatus); | ||
872 | } | 862 | } |
873 | 863 | ||
874 | static void enqueue_an_INT_packet(struct usb_hcd *hcd, struct isp1760_qh *qh, | 864 | static void enqueue_an_INT_packet(struct usb_hcd *hcd, struct isp1760_qh *qh, |
875 | struct isp1760_qtd *qtd) | 865 | struct isp1760_qtd *qtd) |
876 | { | 866 | { |
877 | u32 skip_map, or_map; | 867 | u32 skip_map; |
878 | u32 slot; | 868 | u32 slot; |
879 | u32 buffstatus; | ||
880 | 869 | ||
881 | /* | 870 | /* |
882 | * When this function is called from the interrupt handler to enqueue | 871 | * When this function is called from the interrupt handler to enqueue |
@@ -893,16 +882,8 @@ static void enqueue_an_INT_packet(struct usb_hcd *hcd, struct isp1760_qh *qh, | |||
893 | 882 | ||
894 | enqueue_one_int_qtd(hcd, qh, slot, qtd); | 883 | enqueue_one_int_qtd(hcd, qh, slot, qtd); |
895 | 884 | ||
896 | or_map = reg_read32(hcd->regs, HC_INT_IRQ_MASK_OR_REG); | ||
897 | or_map |= (1 << slot); | ||
898 | reg_write32(hcd->regs, HC_INT_IRQ_MASK_OR_REG, or_map); | ||
899 | |||
900 | skip_map &= ~(1 << slot); | 885 | skip_map &= ~(1 << slot); |
901 | reg_write32(hcd->regs, HC_INT_PTD_SKIPMAP_REG, skip_map); | 886 | reg_write32(hcd->regs, HC_INT_PTD_SKIPMAP_REG, skip_map); |
902 | |||
903 | buffstatus = reg_read32(hcd->regs, HC_BUFFER_STATUS_REG); | ||
904 | buffstatus |= INT_BUFFER; | ||
905 | reg_write32(hcd->regs, HC_BUFFER_STATUS_REG, buffstatus); | ||
906 | } | 887 | } |
907 | 888 | ||
908 | static void isp1760_urb_done(struct usb_hcd *hcd, struct urb *urb) | 889 | static void isp1760_urb_done(struct usb_hcd *hcd, struct urb *urb) |
@@ -994,7 +975,6 @@ static void do_atl_int(struct usb_hcd *hcd) | |||
994 | struct urb *urb; | 975 | struct urb *urb; |
995 | u32 slot; | 976 | u32 slot; |
996 | u32 length; | 977 | u32 length; |
997 | u32 or_map; | ||
998 | u32 status = -EINVAL; | 978 | u32 status = -EINVAL; |
999 | int error; | 979 | int error; |
1000 | struct isp1760_qtd *qtd; | 980 | struct isp1760_qtd *qtd; |
@@ -1005,10 +985,6 @@ static void do_atl_int(struct usb_hcd *hcd) | |||
1005 | done_map = reg_read32(hcd->regs, HC_ATL_PTD_DONEMAP_REG); | 985 | done_map = reg_read32(hcd->regs, HC_ATL_PTD_DONEMAP_REG); |
1006 | skip_map = reg_read32(hcd->regs, HC_ATL_PTD_SKIPMAP_REG); | 986 | skip_map = reg_read32(hcd->regs, HC_ATL_PTD_SKIPMAP_REG); |
1007 | 987 | ||
1008 | or_map = reg_read32(hcd->regs, HC_ATL_IRQ_MASK_OR_REG); | ||
1009 | or_map &= ~done_map; | ||
1010 | reg_write32(hcd->regs, HC_ATL_IRQ_MASK_OR_REG, or_map); | ||
1011 | |||
1012 | while (done_map) { | 988 | while (done_map) { |
1013 | status = 0; | 989 | status = 0; |
1014 | priv->atl_queued--; | 990 | priv->atl_queued--; |
@@ -1048,8 +1024,6 @@ static void do_atl_int(struct usb_hcd *hcd) | |||
1048 | } | 1024 | } |
1049 | 1025 | ||
1050 | if (!nakcount && (ptd.dw3 & DW3_QTD_ACTIVE)) { | 1026 | if (!nakcount && (ptd.dw3 & DW3_QTD_ACTIVE)) { |
1051 | u32 buffstatus; | ||
1052 | |||
1053 | /* | 1027 | /* |
1054 | * NAKs are handled in HW by the chip. Usually if the | 1028 | * NAKs are handled in HW by the chip. Usually if the |
1055 | * device is not able to send data fast enough. | 1029 | * device is not able to send data fast enough. |
@@ -1068,9 +1042,6 @@ static void do_atl_int(struct usb_hcd *hcd) | |||
1068 | * unskipped once it gets written to the HW. | 1042 | * unskipped once it gets written to the HW. |
1069 | */ | 1043 | */ |
1070 | skip_map &= ~(1 << slot); | 1044 | skip_map &= ~(1 << slot); |
1071 | or_map = reg_read32(hcd->regs, HC_ATL_IRQ_MASK_OR_REG); | ||
1072 | or_map |= 1 << slot; | ||
1073 | reg_write32(hcd->regs, HC_ATL_IRQ_MASK_OR_REG, or_map); | ||
1074 | 1045 | ||
1075 | ptd.dw0 |= PTD_VALID; | 1046 | ptd.dw0 |= PTD_VALID; |
1076 | ptd_write(hcd->regs, ATL_PTD_OFFSET, slot, &ptd); | 1047 | ptd_write(hcd->regs, ATL_PTD_OFFSET, slot, &ptd); |
@@ -1079,12 +1050,6 @@ static void do_atl_int(struct usb_hcd *hcd) | |||
1079 | if (priv->atl_queued == 2) | 1050 | if (priv->atl_queued == 2) |
1080 | reg_write32(hcd->regs, HC_INTERRUPT_ENABLE, | 1051 | reg_write32(hcd->regs, HC_INTERRUPT_ENABLE, |
1081 | INTERRUPT_ENABLE_SOT_MASK); | 1052 | INTERRUPT_ENABLE_SOT_MASK); |
1082 | |||
1083 | buffstatus = reg_read32(hcd->regs, | ||
1084 | HC_BUFFER_STATUS_REG); | ||
1085 | buffstatus |= ATL_BUFFER; | ||
1086 | reg_write32(hcd->regs, HC_BUFFER_STATUS_REG, | ||
1087 | buffstatus); | ||
1088 | continue; | 1053 | continue; |
1089 | } | 1054 | } |
1090 | 1055 | ||
@@ -1191,7 +1156,6 @@ static void do_intl_int(struct usb_hcd *hcd) | |||
1191 | struct ptd ptd; | 1156 | struct ptd ptd; |
1192 | struct urb *urb; | 1157 | struct urb *urb; |
1193 | u32 length; | 1158 | u32 length; |
1194 | u32 or_map; | ||
1195 | int error; | 1159 | int error; |
1196 | u32 slot; | 1160 | u32 slot; |
1197 | struct isp1760_qtd *qtd; | 1161 | struct isp1760_qtd *qtd; |
@@ -1200,10 +1164,6 @@ static void do_intl_int(struct usb_hcd *hcd) | |||
1200 | done_map = reg_read32(hcd->regs, HC_INT_PTD_DONEMAP_REG); | 1164 | done_map = reg_read32(hcd->regs, HC_INT_PTD_DONEMAP_REG); |
1201 | skip_map = reg_read32(hcd->regs, HC_INT_PTD_SKIPMAP_REG); | 1165 | skip_map = reg_read32(hcd->regs, HC_INT_PTD_SKIPMAP_REG); |
1202 | 1166 | ||
1203 | or_map = reg_read32(hcd->regs, HC_INT_IRQ_MASK_OR_REG); | ||
1204 | or_map &= ~done_map; | ||
1205 | reg_write32(hcd->regs, HC_INT_IRQ_MASK_OR_REG, or_map); | ||
1206 | |||
1207 | while (done_map) { | 1167 | while (done_map) { |
1208 | slot = __ffs(done_map); | 1168 | slot = __ffs(done_map); |
1209 | done_map &= ~(1 << slot); | 1169 | done_map &= ~(1 << slot); |
@@ -1503,7 +1463,7 @@ static int isp1760_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) | |||
1503 | struct isp1760_hcd *priv = hcd_to_priv(hcd); | 1463 | struct isp1760_hcd *priv = hcd_to_priv(hcd); |
1504 | struct inter_packet_info *ints; | 1464 | struct inter_packet_info *ints; |
1505 | u32 i; | 1465 | u32 i; |
1506 | u32 reg_base, or_reg, skip_reg; | 1466 | u32 reg_base, skip_reg; |
1507 | unsigned long flags; | 1467 | unsigned long flags; |
1508 | struct ptd ptd; | 1468 | struct ptd ptd; |
1509 | packet_enqueue *pe; | 1469 | packet_enqueue *pe; |
@@ -1516,7 +1476,6 @@ static int isp1760_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) | |||
1516 | case PIPE_INTERRUPT: | 1476 | case PIPE_INTERRUPT: |
1517 | ints = priv->int_ints; | 1477 | ints = priv->int_ints; |
1518 | reg_base = INT_PTD_OFFSET; | 1478 | reg_base = INT_PTD_OFFSET; |
1519 | or_reg = HC_INT_IRQ_MASK_OR_REG; | ||
1520 | skip_reg = HC_INT_PTD_SKIPMAP_REG; | 1479 | skip_reg = HC_INT_PTD_SKIPMAP_REG; |
1521 | pe = enqueue_an_INT_packet; | 1480 | pe = enqueue_an_INT_packet; |
1522 | break; | 1481 | break; |
@@ -1524,7 +1483,6 @@ static int isp1760_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) | |||
1524 | default: | 1483 | default: |
1525 | ints = priv->atl_ints; | 1484 | ints = priv->atl_ints; |
1526 | reg_base = ATL_PTD_OFFSET; | 1485 | reg_base = ATL_PTD_OFFSET; |
1527 | or_reg = HC_ATL_IRQ_MASK_OR_REG; | ||
1528 | skip_reg = HC_ATL_PTD_SKIPMAP_REG; | 1486 | skip_reg = HC_ATL_PTD_SKIPMAP_REG; |
1529 | pe = enqueue_an_ATL_packet; | 1487 | pe = enqueue_an_ATL_packet; |
1530 | break; | 1488 | break; |
@@ -1540,7 +1498,6 @@ static int isp1760_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) | |||
1540 | 1498 | ||
1541 | if (ints[i].qtd->urb == urb) { | 1499 | if (ints[i].qtd->urb == urb) { |
1542 | u32 skip_map; | 1500 | u32 skip_map; |
1543 | u32 or_map; | ||
1544 | struct isp1760_qtd *qtd; | 1501 | struct isp1760_qtd *qtd; |
1545 | struct isp1760_qh *qh; | 1502 | struct isp1760_qh *qh; |
1546 | 1503 | ||
@@ -1548,10 +1505,6 @@ static int isp1760_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) | |||
1548 | skip_map |= 1 << i; | 1505 | skip_map |= 1 << i; |
1549 | reg_write32(hcd->regs, skip_reg, skip_map); | 1506 | reg_write32(hcd->regs, skip_reg, skip_map); |
1550 | 1507 | ||
1551 | or_map = reg_read32(hcd->regs, or_reg); | ||
1552 | or_map &= ~(1 << i); | ||
1553 | reg_write32(hcd->regs, or_reg, or_map); | ||
1554 | |||
1555 | ptd_write(hcd->regs, reg_base, i, &ptd); | 1508 | ptd_write(hcd->regs, reg_base, i, &ptd); |
1556 | 1509 | ||
1557 | qtd = ints[i].qtd; | 1510 | qtd = ints[i].qtd; |
diff --git a/drivers/usb/host/isp1760-hcd.h b/drivers/usb/host/isp1760-hcd.h index 870507690607..056e046b0d42 100644 --- a/drivers/usb/host/isp1760-hcd.h +++ b/drivers/usb/host/isp1760-hcd.h | |||
@@ -49,10 +49,9 @@ void deinit_kmem_cache(void); | |||
49 | #define SW_RESET_RESET_ALL (1 << 0) | 49 | #define SW_RESET_RESET_ALL (1 << 0) |
50 | 50 | ||
51 | #define HC_BUFFER_STATUS_REG 0x334 | 51 | #define HC_BUFFER_STATUS_REG 0x334 |
52 | #define ATL_BUFFER 0x1 | 52 | #define ISO_BUF_FILL (1 << 2) |
53 | #define INT_BUFFER 0x2 | 53 | #define INT_BUF_FILL (1 << 1) |
54 | #define ISO_BUFFER 0x4 | 54 | #define ATL_BUF_FILL (1 << 0) |
55 | #define BUFFER_MAP 0x7 | ||
56 | 55 | ||
57 | #define HC_MEMORY_REG 0x33c | 56 | #define HC_MEMORY_REG 0x33c |
58 | #define ISP_BANK(x) ((x) << 16) | 57 | #define ISP_BANK(x) ((x) << 16) |
@@ -68,14 +67,13 @@ void deinit_kmem_cache(void); | |||
68 | #define HC_INTERRUPT_REG 0x310 | 67 | #define HC_INTERRUPT_REG 0x310 |
69 | 68 | ||
70 | #define HC_INTERRUPT_ENABLE 0x314 | 69 | #define HC_INTERRUPT_ENABLE 0x314 |
71 | #define INTERRUPT_ENABLE_MASK (HC_INTL_INT | HC_ATL_INT | HC_EOT_INT) | ||
72 | #define INTERRUPT_ENABLE_SOT_MASK (HC_INTL_INT | HC_SOT_INT | HC_EOT_INT) | ||
73 | |||
74 | #define HC_ISO_INT (1 << 9) | 70 | #define HC_ISO_INT (1 << 9) |
75 | #define HC_ATL_INT (1 << 8) | 71 | #define HC_ATL_INT (1 << 8) |
76 | #define HC_INTL_INT (1 << 7) | 72 | #define HC_INTL_INT (1 << 7) |
77 | #define HC_EOT_INT (1 << 3) | 73 | #define HC_EOT_INT (1 << 3) |
78 | #define HC_SOT_INT (1 << 1) | 74 | #define HC_SOT_INT (1 << 1) |
75 | #define INTERRUPT_ENABLE_MASK (HC_INTL_INT | HC_ATL_INT) | ||
76 | #define INTERRUPT_ENABLE_SOT_MASK (HC_SOT_INT) | ||
79 | 77 | ||
80 | #define HC_ISO_IRQ_MASK_OR_REG 0x318 | 78 | #define HC_ISO_IRQ_MASK_OR_REG 0x318 |
81 | #define HC_INT_IRQ_MASK_OR_REG 0x31C | 79 | #define HC_INT_IRQ_MASK_OR_REG 0x31C |