Message ID | 1436778605-5576-1-git-send-email-yoshihiro.shimoda.uh@renesas.com (mailing list archive) |
---|---|
State | RFC |
Delegated to: | Geert Uytterhoeven |
Headers | show |
On Mon, Jul 13, 2015 at 06:10:05PM +0900, Yoshihiro Shimoda wrote: > The dma_map_single and dma_unmap_single should set "gadget->dev.parent" > instead of "&gadget->dev" in the first argument because the parent has > a udc controller's device pointer. > Otherwise, iommu functions are not called in ARM environment. > > Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> > --- > This patch is based on the Felipe's usb.git / testing/next branch. > commit id = 298623983e74d935fc241d0eb1d0740cf4c32599 Why send something that has already been accepted into Felipe's tree? -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Greg, On Mon, Jul 13, 2015 at 6:19 PM, Greg KH <gregkh@linuxfoundation.org> wrote: > On Mon, Jul 13, 2015 at 06:10:05PM +0900, Yoshihiro Shimoda wrote: >> The dma_map_single and dma_unmap_single should set "gadget->dev.parent" >> instead of "&gadget->dev" in the first argument because the parent has >> a udc controller's device pointer. >> Otherwise, iommu functions are not called in ARM environment. >> >> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> >> --- >> This patch is based on the Felipe's usb.git / testing/next branch. >> commit id = 298623983e74d935fc241d0eb1d0740cf4c32599 > > Why send something that has already been accepted into Felipe's tree? That commit ID does not refer to Shimoda-san's patch, but to the HEAD of Felipe's testing/next branch. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Geert-san, > Sent: Tuesday, July 14, 2015 1:52 AM > > Hi Greg, > > On Mon, Jul 13, 2015 at 6:19 PM, Greg KH <gregkh@linuxfoundation.org> wrote: > > On Mon, Jul 13, 2015 at 06:10:05PM +0900, Yoshihiro Shimoda wrote: > >> The dma_map_single and dma_unmap_single should set "gadget->dev.parent" > >> instead of "&gadget->dev" in the first argument because the parent has > >> a udc controller's device pointer. > >> Otherwise, iommu functions are not called in ARM environment. > >> > >> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> > >> --- > >> This patch is based on the Felipe's usb.git / testing/next branch. > >> commit id = 298623983e74d935fc241d0eb1d0740cf4c32599 > > > > Why send something that has already been accepted into Felipe's tree? > > That commit ID does not refer to Shimoda-san's patch, but to the HEAD of > Felipe's testing/next branch. Thank you for your comment! I meant that. (I'm sorry for my lack explanation.) Best regards, Yoshihiro Shimoda > Gr{oetje,eeting}s, > > Geert > > -- > Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org > > In personal conversations with technical people, I call myself a hacker. But > when I'm talking to journalists I just say "programmer" or something like that. > -- Linus Torvalds
diff --git a/drivers/usb/gadget/udc/udc-core.c b/drivers/usb/gadget/udc/udc-core.c index d69c355..362ee8a 100644 --- a/drivers/usb/gadget/udc/udc-core.c +++ b/drivers/usb/gadget/udc/udc-core.c @@ -60,13 +60,15 @@ static DEFINE_MUTEX(udc_lock); int usb_gadget_map_request(struct usb_gadget *gadget, struct usb_request *req, int is_in) { + struct device *dev = gadget->dev.parent; + if (req->length == 0) return 0; if (req->num_sgs) { int mapped; - mapped = dma_map_sg(&gadget->dev, req->sg, req->num_sgs, + mapped = dma_map_sg(dev, req->sg, req->num_sgs, is_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE); if (mapped == 0) { dev_err(&gadget->dev, "failed to map SGs\n"); @@ -75,11 +77,11 @@ int usb_gadget_map_request(struct usb_gadget *gadget, req->num_mapped_sgs = mapped; } else { - req->dma = dma_map_single(&gadget->dev, req->buf, req->length, + req->dma = dma_map_single(dev, req->buf, req->length, is_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE); - if (dma_mapping_error(&gadget->dev, req->dma)) { - dev_err(&gadget->dev, "failed to map buffer\n"); + if (dma_mapping_error(dev, req->dma)) { + dev_err(dev, "failed to map buffer\n"); return -EFAULT; } } @@ -95,12 +97,12 @@ void usb_gadget_unmap_request(struct usb_gadget *gadget, return; if (req->num_mapped_sgs) { - dma_unmap_sg(&gadget->dev, req->sg, req->num_mapped_sgs, + dma_unmap_sg(gadget->dev.parent, req->sg, req->num_mapped_sgs, is_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE); req->num_mapped_sgs = 0; } else { - dma_unmap_single(&gadget->dev, req->dma, req->length, + dma_unmap_single(gadget->dev.parent, req->dma, req->length, is_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE); } }
The dma_map_single and dma_unmap_single should set "gadget->dev.parent" instead of "&gadget->dev" in the first argument because the parent has a udc controller's device pointer. Otherwise, iommu functions are not called in ARM environment. Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> --- This patch is based on the Felipe's usb.git / testing/next branch. commit id = 298623983e74d935fc241d0eb1d0740cf4c32599 drivers/usb/gadget/udc/udc-core.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)