* [PATCH 0/3] usb: gadget: udc: renesas_usb3: fixes for v4.13-rc1
@ 2017-07-18 12:26 Yoshihiro Shimoda
2017-07-18 12:26 ` [PATCH 1/3] usb: gadget: udc: renesas_usb3: fix free size in renesas_usb3_dma_free_prd() Yoshihiro Shimoda
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Yoshihiro Shimoda @ 2017-07-18 12:26 UTC (permalink / raw
To: balbi; +Cc: gregkh, linux-usb, linux-renesas-soc, Yoshihiro Shimoda
This patch is based on the latest Felipe's usb.git / testing/fixes branch
(The commit id = 4a71fcb8ac5f94c07bf47a43b13258a52e4fe3ad).
Yoshihiro Shimoda (3):
usb: gadget: udc: renesas_usb3: fix free size in
renesas_usb3_dma_free_prd()
usb: gadget: udc: renesas_usb3: fix zlp transfer by the dmac
usb: gadget: udc: renesas_usb3: protect usb3_ep->started in
usb3_start_pipen()
drivers/usb/gadget/udc/renesas_usb3.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
--
1.9.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/3] usb: gadget: udc: renesas_usb3: fix free size in renesas_usb3_dma_free_prd()
2017-07-18 12:26 [PATCH 0/3] usb: gadget: udc: renesas_usb3: fixes for v4.13-rc1 Yoshihiro Shimoda
@ 2017-07-18 12:26 ` Yoshihiro Shimoda
2017-07-18 13:10 ` Geert Uytterhoeven
2017-07-18 12:26 ` [PATCH 2/3] usb: gadget: udc: renesas_usb3: fix zlp transfer by the dmac Yoshihiro Shimoda
2017-07-18 12:26 ` [PATCH 3/3] usb: gadget: udc: renesas_usb3: protect usb3_ep->started in usb3_start_pipen() Yoshihiro Shimoda
2 siblings, 1 reply; 6+ messages in thread
From: Yoshihiro Shimoda @ 2017-07-18 12:26 UTC (permalink / raw
To: balbi; +Cc: gregkh, linux-usb, linux-renesas-soc, Yoshihiro Shimoda
The commit 2d4aa21a73ba ("usb: gadget: udc: renesas_usb3: add support
for dedicated DMAC") has a bug in the renesas_usb3_dma_free_prd().
The size of dma_free_coherent() should be the same with dma_alloc_coherent()
Otherwise, this code causes a WARNING by mm/page_alloc.c when
renesas_usb3_dma_free_prd() is called. So, this patch fixes it.
Fixes: 2d4aa21a73ba ("usb: gadget: udc: renesas_usb3: add support for dedicated DMAC")
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
drivers/usb/gadget/udc/renesas_usb3.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/gadget/udc/renesas_usb3.c b/drivers/usb/gadget/udc/renesas_usb3.c
index d827832..923ad5a 100644
--- a/drivers/usb/gadget/udc/renesas_usb3.c
+++ b/drivers/usb/gadget/udc/renesas_usb3.c
@@ -1369,7 +1369,7 @@ static int renesas_usb3_dma_free_prd(struct renesas_usb3 *usb3,
usb3_for_each_dma(usb3, dma, i) {
if (dma->prd) {
- dma_free_coherent(dev, USB3_DMA_MAX_XFER_SIZE,
+ dma_free_coherent(dev, USB3_DMA_PRD_SIZE,
dma->prd, dma->prd_dma);
dma->prd = NULL;
}
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/3] usb: gadget: udc: renesas_usb3: fix zlp transfer by the dmac
2017-07-18 12:26 [PATCH 0/3] usb: gadget: udc: renesas_usb3: fixes for v4.13-rc1 Yoshihiro Shimoda
2017-07-18 12:26 ` [PATCH 1/3] usb: gadget: udc: renesas_usb3: fix free size in renesas_usb3_dma_free_prd() Yoshihiro Shimoda
@ 2017-07-18 12:26 ` Yoshihiro Shimoda
2017-07-18 12:26 ` [PATCH 3/3] usb: gadget: udc: renesas_usb3: protect usb3_ep->started in usb3_start_pipen() Yoshihiro Shimoda
2 siblings, 0 replies; 6+ messages in thread
From: Yoshihiro Shimoda @ 2017-07-18 12:26 UTC (permalink / raw
To: balbi; +Cc: gregkh, linux-usb, linux-renesas-soc, Yoshihiro Shimoda
The dedicated dmac can transfer a zero-length-packet (zlp) if some bits
of the USB_COM_CON register. However, the commit 2d4aa21a73ba ("usb:
gadget: udc: renesas_usb3: add support for dedicated DMAC") didn't set
the bits to 1. So, this patch fixes it.
Fixes: 2d4aa21a73b ("usb: gadget: udc: renesas_usb3: add support for dedicated DMAC)
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
drivers/usb/gadget/udc/renesas_usb3.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/usb/gadget/udc/renesas_usb3.c b/drivers/usb/gadget/udc/renesas_usb3.c
index 923ad5a..1cc5f0d 100644
--- a/drivers/usb/gadget/udc/renesas_usb3.c
+++ b/drivers/usb/gadget/udc/renesas_usb3.c
@@ -89,6 +89,9 @@
/* USB_COM_CON */
#define USB_COM_CON_CONF BIT(24)
+#define USB_COM_CON_PN_WDATAIF_NL BIT(23)
+#define USB_COM_CON_PN_RDATAIF_NL BIT(22)
+#define USB_COM_CON_PN_LSTTR_PP BIT(21)
#define USB_COM_CON_SPD_MODE BIT(17)
#define USB_COM_CON_EP0_EN BIT(16)
#define USB_COM_CON_DEV_ADDR_SHIFT 8
@@ -686,6 +689,9 @@ static void renesas_usb3_init_controller(struct renesas_usb3 *usb3)
{
usb3_init_axi_bridge(usb3);
usb3_init_epc_registers(usb3);
+ usb3_set_bit(usb3, USB_COM_CON_PN_WDATAIF_NL |
+ USB_COM_CON_PN_RDATAIF_NL | USB_COM_CON_PN_LSTTR_PP,
+ USB3_USB_COM_CON);
usb3_write(usb3, USB_OTG_IDMON, USB3_USB_OTG_INT_STA);
usb3_write(usb3, USB_OTG_IDMON, USB3_USB_OTG_INT_ENA);
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/3] usb: gadget: udc: renesas_usb3: protect usb3_ep->started in usb3_start_pipen()
2017-07-18 12:26 [PATCH 0/3] usb: gadget: udc: renesas_usb3: fixes for v4.13-rc1 Yoshihiro Shimoda
2017-07-18 12:26 ` [PATCH 1/3] usb: gadget: udc: renesas_usb3: fix free size in renesas_usb3_dma_free_prd() Yoshihiro Shimoda
2017-07-18 12:26 ` [PATCH 2/3] usb: gadget: udc: renesas_usb3: fix zlp transfer by the dmac Yoshihiro Shimoda
@ 2017-07-18 12:26 ` Yoshihiro Shimoda
2017-07-18 13:12 ` Geert Uytterhoeven
2 siblings, 1 reply; 6+ messages in thread
From: Yoshihiro Shimoda @ 2017-07-18 12:26 UTC (permalink / raw
To: balbi; +Cc: gregkh, linux-usb, linux-renesas-soc, Yoshihiro Shimoda
This patch fixes an issue that unexpected behavior happens when
both the interrupt handler and renesas_usb3_ep_enable() are called.
In this case, since usb3_start_pipen() checked the usb3_ep->started,
but the flags was not protected. So, this patch protects the flag
by usb3->lock. Since renesas_usb3_ep_enable() for EP0 will be not called,
this patch doesn't take care of usb3_start_pipe0().
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
drivers/usb/gadget/udc/renesas_usb3.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/gadget/udc/renesas_usb3.c b/drivers/usb/gadget/udc/renesas_usb3.c
index 1cc5f0d..62dc9c7 100644
--- a/drivers/usb/gadget/udc/renesas_usb3.c
+++ b/drivers/usb/gadget/udc/renesas_usb3.c
@@ -1415,12 +1415,12 @@ static void usb3_start_pipen(struct renesas_usb3_ep *usb3_ep,
int ret = -EAGAIN;
u32 enable_bits = 0;
+ spin_lock_irqsave(&usb3->lock, flags);
if (usb3_ep->halt || usb3_ep->started)
- return;
+ goto out;
if (usb3_req != usb3_req_first)
- return;
+ goto out;
- spin_lock_irqsave(&usb3->lock, flags);
if (usb3_pn_change(usb3, usb3_ep->num) < 0)
goto out;
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/3] usb: gadget: udc: renesas_usb3: fix free size in renesas_usb3_dma_free_prd()
2017-07-18 12:26 ` [PATCH 1/3] usb: gadget: udc: renesas_usb3: fix free size in renesas_usb3_dma_free_prd() Yoshihiro Shimoda
@ 2017-07-18 13:10 ` Geert Uytterhoeven
0 siblings, 0 replies; 6+ messages in thread
From: Geert Uytterhoeven @ 2017-07-18 13:10 UTC (permalink / raw
To: Yoshihiro Shimoda; +Cc: Felipe Balbi, Greg KH, USB list, Linux-Renesas
Hi Shimoda-san,
On Tue, Jul 18, 2017 at 2:26 PM, Yoshihiro Shimoda
<yoshihiro.shimoda.uh@renesas.com> wrote:
> The commit 2d4aa21a73ba ("usb: gadget: udc: renesas_usb3: add support
> for dedicated DMAC") has a bug in the renesas_usb3_dma_free_prd().
> The size of dma_free_coherent() should be the same with dma_alloc_coherent()
> Otherwise, this code causes a WARNING by mm/page_alloc.c when
> renesas_usb3_dma_free_prd() is called. So, this patch fixes it.
>
> Fixes: 2d4aa21a73ba ("usb: gadget: udc: renesas_usb3: add support for dedicated DMAC")
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 3/3] usb: gadget: udc: renesas_usb3: protect usb3_ep->started in usb3_start_pipen()
2017-07-18 12:26 ` [PATCH 3/3] usb: gadget: udc: renesas_usb3: protect usb3_ep->started in usb3_start_pipen() Yoshihiro Shimoda
@ 2017-07-18 13:12 ` Geert Uytterhoeven
0 siblings, 0 replies; 6+ messages in thread
From: Geert Uytterhoeven @ 2017-07-18 13:12 UTC (permalink / raw
To: Yoshihiro Shimoda; +Cc: Felipe Balbi, Greg KH, USB list, Linux-Renesas
On Tue, Jul 18, 2017 at 2:26 PM, Yoshihiro Shimoda
<yoshihiro.shimoda.uh@renesas.com> wrote:
> This patch fixes an issue that unexpected behavior happens when
> both the interrupt handler and renesas_usb3_ep_enable() are called.
> In this case, since usb3_start_pipen() checked the usb3_ep->started,
> but the flags was not protected. So, this patch protects the flag
> by usb3->lock. Since renesas_usb3_ep_enable() for EP0 will be not called,
> this patch doesn't take care of usb3_start_pipe0().
>
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
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
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-07-18 13:12 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-18 12:26 [PATCH 0/3] usb: gadget: udc: renesas_usb3: fixes for v4.13-rc1 Yoshihiro Shimoda
2017-07-18 12:26 ` [PATCH 1/3] usb: gadget: udc: renesas_usb3: fix free size in renesas_usb3_dma_free_prd() Yoshihiro Shimoda
2017-07-18 13:10 ` Geert Uytterhoeven
2017-07-18 12:26 ` [PATCH 2/3] usb: gadget: udc: renesas_usb3: fix zlp transfer by the dmac Yoshihiro Shimoda
2017-07-18 12:26 ` [PATCH 3/3] usb: gadget: udc: renesas_usb3: protect usb3_ep->started in usb3_start_pipen() Yoshihiro Shimoda
2017-07-18 13:12 ` Geert Uytterhoeven
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.