Hi, John Youn <johnyoun@xxxxxxxxxxxx> writes: > From: Vahram Aharonyan <vahrama@xxxxxxxxxxxx> > > Add DMA descriptor members to the dwc2_hsotg_ep structure. > > Signed-off-by: Vahram Aharonyan <vahrama@xxxxxxxxxxxx> > Signed-off-by: John Youn <johnyoun@xxxxxxxxxxxx> > --- > drivers/usb/dwc2/core.h | 7 +++++++ > drivers/usb/dwc2/gadget.c | 36 ++++++++++++++++++++++++++++++++++-- > 2 files changed, 41 insertions(+), 2 deletions(-) > > diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h > index 9f5fbcf..9155567 100644 > --- a/drivers/usb/dwc2/core.h > +++ b/drivers/usb/dwc2/core.h > @@ -172,6 +172,9 @@ struct dwc2_hsotg_req; > * @periodic: Set if this is a periodic ep, such as Interrupt > * @isochronous: Set if this is a isochronous ep > * @send_zlp: Set if we need to send a zero-length packet. > + * @desc_list_dma: The DMA address of descriptor chain currently in use. > + * @desc_list: Pointer to descriptor DMA chain head currently in use. > + * @desc_count: Count of entries within the DMA descriptor chain of EP. > * @total_data: The total number of data bytes done. > * @fifo_size: The size of the FIFO (for periodic IN endpoints) > * @fifo_load: The amount of data loaded into the FIFO (periodic IN) > @@ -219,6 +222,10 @@ struct dwc2_hsotg_ep { > #define TARGET_FRAME_INITIAL 0xFFFFFFFF > bool frame_overrun; > > + dma_addr_t desc_list_dma; > + struct dwc2_dma_desc *desc_list; > + u8 desc_count; > + > char name[10]; > }; > > diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c > index 520b98a..47b5ce4 100644 > --- a/drivers/usb/dwc2/gadget.c > +++ b/drivers/usb/dwc2/gadget.c > @@ -3086,6 +3086,21 @@ static int dwc2_hsotg_ep_enable(struct usb_ep *ep, > dev_dbg(hsotg->dev, "%s: read DxEPCTL=0x%08x from 0x%08x\n", > __func__, epctrl, epctrl_reg); > > + /* Allocate DMA descriptor chain for non-ctrl endpoints */ > + if (using_desc_dma(hsotg)) { > + hs_ep->desc_list = dma_alloc_coherent(hsotg->dev, > + MAX_DMA_DESC_NUM_GENERIC * > + sizeof(struct dwc2_dma_desc), > + &hs_ep->desc_list_dma, GFP_KERNEL); > + if (!hs_ep->desc_list) { > + dev_err(hsotg->dev, > + "%s: unable to allocate desc chain fore EP\n", > + __func__); error message is printed for you, please remove -- balbi
Attachment:
signature.asc
Description: PGP signature