Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
MMC U-Boot Custodian Tree
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
U-Boot
Custodians
MMC U-Boot Custodian Tree
Commits
97d638e7
Commit
97d638e7
authored
8 months ago
by
Tom Rini
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' of
https://source.denx.de/u-boot/custodians/u-boot-usb
parents
f92413f6
2fc86384
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
common/usb.c
+30
-7
30 additions, 7 deletions
common/usb.c
drivers/usb/host/xhci-ring.c
+7
-11
7 additions, 11 deletions
drivers/usb/host/xhci-ring.c
with
37 additions
and
18 deletions
common/usb.c
+
30
−
7
View file @
97d638e7
...
...
@@ -214,8 +214,9 @@ int usb_int_msg(struct usb_device *dev, unsigned long pipe,
* clear keyboards LEDs). For data transfers, (storage transfers) we don't
* allow control messages with 0 timeout, by previousely resetting the flag
* asynch_allowed (usb_disable_asynch(1)).
* returns the transferred length if OK or -1 if error. The transferred length
* and the current status are stored in the dev->act_len and dev->status.
* returns the transferred length if OK, otherwise a negative error code. The
* transferred length and the current status are stored in the dev->act_len and
* dev->status.
*/
int
usb_control_msg
(
struct
usb_device
*
dev
,
unsigned
int
pipe
,
unsigned
char
request
,
unsigned
char
requesttype
,
...
...
@@ -257,11 +258,14 @@ int usb_control_msg(struct usb_device *dev, unsigned int pipe,
break
;
mdelay
(
1
);
}
if
(
timeout
==
0
)
return
-
ETIMEDOUT
;
if
(
dev
->
status
)
return
-
1
;
return
dev
->
act_len
;
}
/*-------------------------------------------------------------------
...
...
@@ -562,10 +566,29 @@ int usb_clear_halt(struct usb_device *dev, int pipe)
static
int
usb_get_descriptor
(
struct
usb_device
*
dev
,
unsigned
char
type
,
unsigned
char
index
,
void
*
buf
,
int
size
)
{
return
usb_control_msg
(
dev
,
usb_rcvctrlpipe
(
dev
,
0
),
USB_REQ_GET_DESCRIPTOR
,
USB_DIR_IN
,
(
type
<<
8
)
+
index
,
0
,
buf
,
size
,
USB_CNTL_TIMEOUT
);
int
i
;
int
result
;
if
(
size
<=
0
)
/* No point in asking for no data */
return
-
EINVAL
;
memset
(
buf
,
0
,
size
);
/* Make sure we parse really received data */
for
(
i
=
0
;
i
<
3
;
++
i
)
{
/* retry on length 0 or error; some devices are flakey */
result
=
usb_control_msg
(
dev
,
usb_rcvctrlpipe
(
dev
,
0
),
USB_REQ_GET_DESCRIPTOR
,
USB_DIR_IN
,
(
type
<<
8
)
+
index
,
0
,
buf
,
size
,
USB_CNTL_TIMEOUT
);
if
(
result
<=
0
&&
result
!=
-
ETIMEDOUT
)
continue
;
if
(
result
>
1
&&
((
u8
*
)
buf
)[
1
]
!=
type
)
{
result
=
-
ENODATA
;
continue
;
}
break
;
}
return
result
;
}
/**********************************************************************
...
...
This diff is collapsed.
Click to expand it.
drivers/usb/host/xhci-ring.c
+
7
−
11
View file @
97d638e7
...
...
@@ -530,9 +530,8 @@ static void reset_ep(struct usb_device *udev, int ep_index)
if
(
!
event
)
return
;
BUG_ON
(
TRB_TO_SLOT_ID
(
le32_to_cpu
(
event
->
event_cmd
.
flags
))
!=
udev
->
slot_id
||
GET_COMP_CODE
(
le32_to_cpu
(
event
->
event_cmd
.
status
))
!=
COMP_SUCCESS
);
BUG_ON
(
TRB_TO_SLOT_ID
(
le32_to_cpu
(
event
->
event_cmd
.
flags
))
!=
udev
->
slot_id
||
GET_COMP_CODE
(
le32_to_cpu
(
event
->
event_cmd
.
status
))
!=
COMP_SUCCESS
);
xhci_acknowledge_event
(
ctrl
);
}
...
...
@@ -565,8 +564,7 @@ static void abort_td(struct usb_device *udev, int ep_index)
field
=
le32_to_cpu
(
event
->
trans_event
.
flags
);
BUG_ON
(
TRB_TO_SLOT_ID
(
field
)
!=
udev
->
slot_id
);
BUG_ON
(
TRB_TO_EP_INDEX
(
field
)
!=
ep_index
);
BUG_ON
(
GET_COMP_CODE
(
le32_to_cpu
(
event
->
trans_event
.
transfer_len
!=
COMP_STOP
)));
BUG_ON
(
GET_COMP_CODE
(
le32_to_cpu
(
event
->
trans_event
.
transfer_len
!=
COMP_STOP
)));
xhci_acknowledge_event
(
ctrl
);
event
=
xhci_wait_for_event
(
ctrl
,
TRB_COMPLETION
);
...
...
@@ -580,9 +578,8 @@ static void abort_td(struct usb_device *udev, int ep_index)
comp
=
GET_COMP_CODE
(
le32_to_cpu
(
event
->
event_cmd
.
status
));
BUG_ON
(
type
!=
TRB_COMPLETION
||
TRB_TO_SLOT_ID
(
le32_to_cpu
(
event
->
event_cmd
.
flags
))
!=
udev
->
slot_id
||
(
comp
!=
COMP_SUCCESS
&&
comp
!=
COMP_CTX_STATE
));
TRB_TO_SLOT_ID
(
le32_to_cpu
(
event
->
event_cmd
.
flags
))
!=
udev
->
slot_id
||
(
comp
!=
COMP_SUCCESS
&&
comp
!=
COMP_CTX_STATE
));
xhci_acknowledge_event
(
ctrl
);
addr
=
xhci_trb_virt_to_dma
(
ring
->
enq_seg
,
...
...
@@ -592,9 +589,8 @@ static void abort_td(struct usb_device *udev, int ep_index)
if
(
!
event
)
return
;
BUG_ON
(
TRB_TO_SLOT_ID
(
le32_to_cpu
(
event
->
event_cmd
.
flags
))
!=
udev
->
slot_id
||
GET_COMP_CODE
(
le32_to_cpu
(
event
->
event_cmd
.
status
))
!=
COMP_SUCCESS
);
BUG_ON
(
TRB_TO_SLOT_ID
(
le32_to_cpu
(
event
->
event_cmd
.
flags
))
!=
udev
->
slot_id
||
GET_COMP_CODE
(
le32_to_cpu
(
event
->
event_cmd
.
status
))
!=
COMP_SUCCESS
);
xhci_acknowledge_event
(
ctrl
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment