diff options
author | David Vrabel <david.vrabel@csr.com> | 2009-04-08 13:36:28 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-04-17 13:50:27 -0400 |
commit | 3444b26afa145148951112534f298bdc554ec789 (patch) | |
tree | b2c8d9b13d04869ffdad1e46a9ebbf819e7ed7b4 /drivers/block | |
parent | d45e230bf03850f17394a760dfa003d986a67729 (diff) |
USB: add reset endpoint operations
Wireless USB endpoint state has a sequence number and a current
window and not just a single toggle bit. So allow HCDs to provide a
endpoint_reset method and call this or clear the software toggles as
required (after a clear halt, set configuration etc.).
usb_settoggle() and friends are then HCD internal and are moved into
core/hcd.h and all device drivers call usb_reset_endpoint() instead.
If the device endpoint state has been reset (with a clear halt) but
the host endpoint state has not then subsequent data transfers will
not complete. The device will only work again after it is reset or
disconnected.
Signed-off-by: David Vrabel <david.vrabel@csr.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/ub.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/drivers/block/ub.c b/drivers/block/ub.c index 69b7f8e77596..689cd27ac890 100644 --- a/drivers/block/ub.c +++ b/drivers/block/ub.c | |||
@@ -1025,6 +1025,7 @@ static void ub_scsi_urb_compl(struct ub_dev *sc, struct ub_scsi_cmd *cmd) | |||
1025 | { | 1025 | { |
1026 | struct urb *urb = &sc->work_urb; | 1026 | struct urb *urb = &sc->work_urb; |
1027 | struct bulk_cs_wrap *bcs; | 1027 | struct bulk_cs_wrap *bcs; |
1028 | int endp; | ||
1028 | int len; | 1029 | int len; |
1029 | int rc; | 1030 | int rc; |
1030 | 1031 | ||
@@ -1033,6 +1034,10 @@ static void ub_scsi_urb_compl(struct ub_dev *sc, struct ub_scsi_cmd *cmd) | |||
1033 | return; | 1034 | return; |
1034 | } | 1035 | } |
1035 | 1036 | ||
1037 | endp = usb_pipeendpoint(sc->last_pipe); | ||
1038 | if (usb_pipein(sc->last_pipe)) | ||
1039 | endp |= USB_DIR_IN; | ||
1040 | |||
1036 | if (cmd->state == UB_CMDST_CLEAR) { | 1041 | if (cmd->state == UB_CMDST_CLEAR) { |
1037 | if (urb->status == -EPIPE) { | 1042 | if (urb->status == -EPIPE) { |
1038 | /* | 1043 | /* |
@@ -1048,9 +1053,7 @@ static void ub_scsi_urb_compl(struct ub_dev *sc, struct ub_scsi_cmd *cmd) | |||
1048 | * We ignore the result for the halt clear. | 1053 | * We ignore the result for the halt clear. |
1049 | */ | 1054 | */ |
1050 | 1055 | ||
1051 | /* reset the endpoint toggle */ | 1056 | usb_reset_endpoint(sc->dev, endp); |
1052 | usb_settoggle(sc->dev, usb_pipeendpoint(sc->last_pipe), | ||
1053 | usb_pipeout(sc->last_pipe), 0); | ||
1054 | 1057 | ||
1055 | ub_state_sense(sc, cmd); | 1058 | ub_state_sense(sc, cmd); |
1056 | 1059 | ||
@@ -1065,9 +1068,7 @@ static void ub_scsi_urb_compl(struct ub_dev *sc, struct ub_scsi_cmd *cmd) | |||
1065 | * We ignore the result for the halt clear. | 1068 | * We ignore the result for the halt clear. |
1066 | */ | 1069 | */ |
1067 | 1070 | ||
1068 | /* reset the endpoint toggle */ | 1071 | usb_reset_endpoint(sc->dev, endp); |
1069 | usb_settoggle(sc->dev, usb_pipeendpoint(sc->last_pipe), | ||
1070 | usb_pipeout(sc->last_pipe), 0); | ||
1071 | 1072 | ||
1072 | ub_state_stat(sc, cmd); | 1073 | ub_state_stat(sc, cmd); |
1073 | 1074 | ||
@@ -1082,9 +1083,7 @@ static void ub_scsi_urb_compl(struct ub_dev *sc, struct ub_scsi_cmd *cmd) | |||
1082 | * We ignore the result for the halt clear. | 1083 | * We ignore the result for the halt clear. |
1083 | */ | 1084 | */ |
1084 | 1085 | ||
1085 | /* reset the endpoint toggle */ | 1086 | usb_reset_endpoint(sc->dev, endp); |
1086 | usb_settoggle(sc->dev, usb_pipeendpoint(sc->last_pipe), | ||
1087 | usb_pipeout(sc->last_pipe), 0); | ||
1088 | 1087 | ||
1089 | ub_state_stat_counted(sc, cmd); | 1088 | ub_state_stat_counted(sc, cmd); |
1090 | 1089 | ||
@@ -2119,8 +2118,7 @@ static int ub_probe_clear_stall(struct ub_dev *sc, int stalled_pipe) | |||
2119 | del_timer_sync(&timer); | 2118 | del_timer_sync(&timer); |
2120 | usb_kill_urb(&sc->work_urb); | 2119 | usb_kill_urb(&sc->work_urb); |
2121 | 2120 | ||
2122 | /* reset the endpoint toggle */ | 2121 | usb_reset_endpoint(sc->dev, endp); |
2123 | usb_settoggle(sc->dev, endp, usb_pipeout(sc->last_pipe), 0); | ||
2124 | 2122 | ||
2125 | return 0; | 2123 | return 0; |
2126 | } | 2124 | } |