Commit 3f95001d authored by Mian Yousaf Kaukab's avatar Mian Yousaf Kaukab Committed by Felipe Balbi

usb: dwc2: gadget: don't embed ep0 buffers

When using DMA, data of the previous setup packet can be read back
from cache because ep0 and ctrl buffers are embedded in struct s3c_hsotg.
Allocate buffers instead of embedding them.
Tested-by: default avatarRobert Baldyga <r.baldyga@samsung.com>
Acked-by: default avatarPaul Zimmerman <paulz@synopsys.com>
Signed-off-by: default avatarMian Yousaf Kaukab <yousaf.kaukab@intel.com>
Reviewed-by: default avatarRobert Baldyga <r.baldyga@samsung.com>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent b787d755
...@@ -434,6 +434,9 @@ struct dwc2_hw_params { ...@@ -434,6 +434,9 @@ struct dwc2_hw_params {
u32 snpsid; u32 snpsid;
}; };
/* Size of control and EP0 buffers */
#define DWC2_CTRL_BUFF_SIZE 8
/** /**
* struct dwc2_hsotg - Holds the state of the driver, including the non-periodic * struct dwc2_hsotg - Holds the state of the driver, including the non-periodic
* and periodic schedules * and periodic schedules
...@@ -684,8 +687,8 @@ struct dwc2_hsotg { ...@@ -684,8 +687,8 @@ struct dwc2_hsotg {
struct usb_request *ep0_reply; struct usb_request *ep0_reply;
struct usb_request *ctrl_req; struct usb_request *ctrl_req;
u8 ep0_buff[8]; void *ep0_buff;
u8 ctrl_buff[8]; void *ctrl_buff;
struct usb_gadget gadget; struct usb_gadget gadget;
unsigned int enabled:1; unsigned int enabled:1;
......
...@@ -3486,6 +3486,22 @@ int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq) ...@@ -3486,6 +3486,22 @@ int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq)
s3c_hsotg_hw_cfg(hsotg); s3c_hsotg_hw_cfg(hsotg);
s3c_hsotg_init(hsotg); s3c_hsotg_init(hsotg);
hsotg->ctrl_buff = devm_kzalloc(hsotg->dev,
DWC2_CTRL_BUFF_SIZE, GFP_KERNEL);
if (!hsotg->ctrl_buff) {
dev_err(dev, "failed to allocate ctrl request buff\n");
ret = -ENOMEM;
goto err_supplies;
}
hsotg->ep0_buff = devm_kzalloc(hsotg->dev,
DWC2_CTRL_BUFF_SIZE, GFP_KERNEL);
if (!hsotg->ep0_buff) {
dev_err(dev, "failed to allocate ctrl reply buff\n");
ret = -ENOMEM;
goto err_supplies;
}
ret = devm_request_irq(hsotg->dev, irq, s3c_hsotg_irq, IRQF_SHARED, ret = devm_request_irq(hsotg->dev, irq, s3c_hsotg_irq, IRQF_SHARED,
dev_name(hsotg->dev), hsotg); dev_name(hsotg->dev), hsotg);
if (ret < 0) { if (ret < 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment