Skip to content
Snippets Groups Projects
Commit 282685e0 authored by Stephen Warren's avatar Stephen Warren Committed by Marek Vasut
Browse files

usb: dwc2: remove control_data_toggle[]


The control data toggle resets to DATA1 at the start of the data phase
of every setup transaction. We don't need a global variable to store
the value; we can just store it on the stack.

Signed-off-by: default avatarStephen Warren <swarren@wwwdotorg.org>
parent ee837554
No related branches found
No related tags found
No related merge requests found
...@@ -27,7 +27,6 @@ DEFINE_ALIGN_BUFFER(uint8_t, status_buffer, DWC2_STATUS_BUF_SIZE, 8); ...@@ -27,7 +27,6 @@ DEFINE_ALIGN_BUFFER(uint8_t, status_buffer, DWC2_STATUS_BUF_SIZE, 8);
#define MAX_DEVICE 16 #define MAX_DEVICE 16
#define MAX_ENDPOINT 16 #define MAX_ENDPOINT 16
static int bulk_data_toggle[MAX_DEVICE][MAX_ENDPOINT]; static int bulk_data_toggle[MAX_DEVICE][MAX_ENDPOINT];
static int control_data_toggle[MAX_DEVICE][MAX_ENDPOINT];
static int root_hub_devnum; static int root_hub_devnum;
...@@ -853,7 +852,6 @@ int submit_control_msg(struct usb_device *dev, unsigned long pipe, void *buffer, ...@@ -853,7 +852,6 @@ int submit_control_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
int len, struct devrequest *setup) int len, struct devrequest *setup)
{ {
int devnum = usb_pipedevice(pipe); int devnum = usb_pipedevice(pipe);
int ep = usb_pipeendpoint(pipe);
int pid, ret, act_len; int pid, ret, act_len;
/* For CONTROL endpoint pid should start with DATA1 */ /* For CONTROL endpoint pid should start with DATA1 */
int status_direction; int status_direction;
...@@ -870,9 +868,9 @@ int submit_control_msg(struct usb_device *dev, unsigned long pipe, void *buffer, ...@@ -870,9 +868,9 @@ int submit_control_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
return ret; return ret;
if (buffer) { if (buffer) {
control_data_toggle[devnum][ep] = DWC2_HC_PID_DATA1; pid = DWC2_HC_PID_DATA1;
ret = chunk_msg(dev, pipe, &control_data_toggle[devnum][ep], ret = chunk_msg(dev, pipe, &pid, usb_pipein(pipe), buffer,
usb_pipein(pipe), buffer, len); len);
if (ret) if (ret)
return ret; return ret;
act_len = dev->act_len; act_len = dev->act_len;
...@@ -933,10 +931,8 @@ int usb_lowlevel_init(int index, enum usb_init_type init, void **controller) ...@@ -933,10 +931,8 @@ int usb_lowlevel_init(int index, enum usb_init_type init, void **controller)
DWC2_HPRT0_PRTRST); DWC2_HPRT0_PRTRST);
for (i = 0; i < MAX_DEVICE; i++) { for (i = 0; i < MAX_DEVICE; i++) {
for (j = 0; j < MAX_ENDPOINT; j++) { for (j = 0; j < MAX_ENDPOINT; j++)
control_data_toggle[i][j] = DWC2_HC_PID_DATA1;
bulk_data_toggle[i][j] = DWC2_HC_PID_DATA0; bulk_data_toggle[i][j] = DWC2_HC_PID_DATA0;
}
} }
return 0; return 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment