From: Mian Yousaf Kaukab Date: Fri, 9 Jan 2015 12:38:44 +0000 (+0100) Subject: usb: dwc2: gadget: don't embed ep0 buffers X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=3f95001db7998c350422708a437694dda07bc04e;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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: Robert Baldyga Acked-by: Paul Zimmerman Signed-off-by: Mian Yousaf Kaukab Reviewed-by: Robert Baldyga Signed-off-by: Felipe Balbi --- diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h index 0d2ee29ac85a..7db83d058da3 100644 --- a/drivers/usb/dwc2/core.h +++ b/drivers/usb/dwc2/core.h @@ -434,6 +434,9 @@ struct dwc2_hw_params { 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 * and periodic schedules @@ -684,8 +687,8 @@ struct dwc2_hsotg { struct usb_request *ep0_reply; struct usb_request *ctrl_req; - u8 ep0_buff[8]; - u8 ctrl_buff[8]; + void *ep0_buff; + void *ctrl_buff; struct usb_gadget gadget; unsigned int enabled:1; diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 45afbf840f03..35d346fcd900 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -3486,6 +3486,22 @@ int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq) s3c_hsotg_hw_cfg(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, dev_name(hsotg->dev), hsotg); if (ret < 0) {