All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Ujfalusi <peter.ujfalusi@ti.com>
To: Tony Lindgren <tony@atomide.com>
Cc: <b-liu@ti.com>, <gregkh@linuxfoundation.org>,
	<linux-usb@vger.kernel.org>, <linux-omap@vger.kernel.org>,
	<balbi@kernel.org>, <linux-kernel@vger.kernel.org>,
	Aaro Koskinen <aaro.koskinen@iki.fi>
Subject: Re: [PATCH 4/4] usb: musb: tusb6010_omap: Convert to DMAengine API
Date: Fri, 5 May 2017 16:37:04 +0300	[thread overview]
Message-ID: <e7a7db55-753f-7b3b-b2e6-290518e7371b@ti.com> (raw)
In-Reply-To: <20170504210529.GB3489@atomide.com>

Tony,

On 2017-05-05 00:05, Tony Lindgren wrote:
> * Tony Lindgren <tony@atomide.com> [170504 12:43]:
>> Hi,
>>
>> * Peter Ujfalusi <peter.ujfalusi@ti.com> [170503 04:00]:
>>> With the port_window support in DMAengine and the sDMA driver we can
>>> convert the driver to DMAengine.
>>
>> Actually looks like this patch still has some issues.. Pinging
>> the n8x0 with for example ping -s1 causes things to stop working.
>
> Sorry it's actually ping -s2048, not -s1. Here's what happens
> on n8x0 with first ping -s2048 with 4/4 applied:
>
> musb-hdrc musb-hdrc.1.auto: Busy rx dma, not using: 00000010
> g_ether gadget: invalid EEM CRC
> g_ether gadget: invalid EEM CRC
> musb-hdrc musb-hdrc.1.auto: ep1 rx dma: 0x86803842 len: 512(512) packet_sz: 512(512)
> musb-hdrc musb-hdrc.1.auto: ep1 rx using 16-bit async dma from 0x02000620 to 0x86803842
> musb-hdrc musb-hdrc.1.auto: ep1 rx dma callback
> musb-hdrc musb-hdrc.1.auto: DMA remaining 448/512
> musb-hdrc musb-hdrc.1.auto: Busy rx dma, not using: 000001c0
> musb-hdrc musb-hdrc.1.auto: Busy rx dma, not using: 00000008
> musb-hdrc musb-hdrc.1.auto: ep1 rx dma: 0x869fdc02 len: 512(512) packet_sz: 512(512)
> musb-hdrc musb-hdrc.1.auto: ep1 rx using 16-bit async dma from 0x02000620 to 0x869fdc02
> musb-hdrc musb-hdrc.1.auto: ep1 rx dma callback
> musb-hdrc musb-hdrc.1.auto: DMA remaining 448/512
> musb-hdrc musb-hdrc.1.auto: Busy rx dma, not using: 000001c0
> musb-hdrc musb-hdrc.1.auto: Busy rx dma, not using: 00000008
> musb-hdrc musb-hdrc.1.auto: ep1 rx dma: 0x869fc642 len: 512(512) packet_sz: 512(512)
> musb-hdrc musb-hdrc.1.auto: ep1 rx using 16-bit async dma from 0x02000620 to 0x869fc642
> musb-hdrc musb-hdrc.1.auto: ep1 rx dma callback
> musb-hdrc musb-hdrc.1.auto: Corrupt rx XFR_SIZE: 0x7ffffec0
> musb-hdrc musb-hdrc.1.auto: DMA remaining 0/512
> musb-hdrc musb-hdrc.1.auto: Busy rx dma, not using: 7ffffec0
> musb-hdrc musb-hdrc.1.auto: Busy rx dma, not using: 00000008
> musb-hdrc musb-hdrc.1.auto: Busy rx dma, not using: 00000010
> musb-hdrc musb-hdrc.1.auto: Busy rx dma, not using: 7ffffcf0
>
> It seems the hardware dmareq line is not triggering anything
> above?
>
> Also with just ping with no size specified, it seems every other
> packet is missed or DMA interrupts are not properly triggering
> as I'm getting these:
>
> g_ether gadget: invalid EEM CRC
>
>> This is when using only with the async gpmc access as the sync
>> gpmc access seems to have a regression not related to this series.
>> I'll try to track down that sync gpmc issue as that most likely
>> hints to something being wrong in the gpmc code in general.
>
> And this sync gpmc issue seems to be timing related. Setting
> DEBUG in tusb6010_omap.c makes it happen easily while without
> it it's much harder to trigger. So probably some kind of issue
> with GPMC sync timings.

Indeed there are some interesting things happening...
As I said, I was testing with g_cdc (CDC Composite (ECM + ACM)) and I 
found it pretty stable with DMAengine. But short story long:

With the series applied and getting rid of the dma_addr & 0x2, plus 
setting the set the quirk_avoids_skb_reserve flag:
g_cdc (ECM + ACM) boots to nfsroot most of the time, ping, scp works
g_ether (ECM) does not boot to nfsroot, ping does not work. However if I 
disable the rx DMA with:

diff --git a/drivers/usb/musb/tusb6010_omap.c 
b/drivers/usb/musb/tusb6010_omap.c
index 8b43c4b99f04..8e0a19b47132 100644
--- a/drivers/usb/musb/tusb6010_omap.c
+++ b/drivers/usb/musb/tusb6010_omap.c
@@ -512,6 +512,12 @@ tusb_omap_dma_allocate(struct dma_controller *c,
  		return NULL;
  	}

+	if (!tx) {
+		dev_err(musb->controller, "Not allowing RX DMA for ep%i %s\n",
+			chdat->epnum);
+		return NULL;
+	}
+
  	for (i = 0; i < MAX_DMAREQ; i++) {
  		struct dma_channel *ch = dma_channel_pool[i];
  		if (ch->status == MUSB_DMA_STATUS_UNKNOWN) {


nfsroot works, ping and scp also - TX is using DMA.

g_ncm (NCM): not booting to nfsroot, no ping, but if I disable the RX 
DMA, then I have NULL pointer dereference :o
Something is wrong for sure.

But to see what I have been comparing to, I have reverted my series and 
added the dma_addr & 2 and the quirk:

g_cdc (ECM + ACM): no nfsroot, no ping
g_ether (ECM): no nfsroot, no ping
g_ncm (NCM): no nfsroot, no ping, disabling RX DMA allow it to boot up, 
but ping kills the USB

None of this is issue I think currently as the DMA is effectively 
disabled for tusb by the dma_addr & 0x2 check, but it is somehow 
bothersome...

I'll try to pin-point out what is going on.

As reference, my configs are:
https://github.com/omap-audio/linux-audio/blob/peter/linux-next-wip/arch/arm/configs/nokia_n810_cdc_defconfig

https://github.com/omap-audio/linux-audio/blob/peter/linux-next-wip/arch/arm/configs/nokia_n810_ether_defconfig

https://github.com/omap-audio/linux-audio/blob/peter/linux-next-wip/arch/arm/configs/nokia_n810_ncm_defconfig

- Péter

WARNING: multiple messages have this Message-ID (diff)
From: Peter Ujfalusi <peter.ujfalusi-l0cyMroinI0@public.gmane.org>
To: Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
Cc: b-liu-l0cyMroinI0@public.gmane.org,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org,
	linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	balbi-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Aaro Koskinen <aaro.koskinen-X3B1VOXEql0@public.gmane.org>
Subject: Re: [PATCH 4/4] usb: musb: tusb6010_omap: Convert to DMAengine API
Date: Fri, 5 May 2017 16:37:04 +0300	[thread overview]
Message-ID: <e7a7db55-753f-7b3b-b2e6-290518e7371b@ti.com> (raw)
In-Reply-To: <20170504210529.GB3489-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>

Tony,

On 2017-05-05 00:05, Tony Lindgren wrote:
> * Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org> [170504 12:43]:
>> Hi,
>>
>> * Peter Ujfalusi <peter.ujfalusi-l0cyMroinI0@public.gmane.org> [170503 04:00]:
>>> With the port_window support in DMAengine and the sDMA driver we can
>>> convert the driver to DMAengine.
>>
>> Actually looks like this patch still has some issues.. Pinging
>> the n8x0 with for example ping -s1 causes things to stop working.
>
> Sorry it's actually ping -s2048, not -s1. Here's what happens
> on n8x0 with first ping -s2048 with 4/4 applied:
>
> musb-hdrc musb-hdrc.1.auto: Busy rx dma, not using: 00000010
> g_ether gadget: invalid EEM CRC
> g_ether gadget: invalid EEM CRC
> musb-hdrc musb-hdrc.1.auto: ep1 rx dma: 0x86803842 len: 512(512) packet_sz: 512(512)
> musb-hdrc musb-hdrc.1.auto: ep1 rx using 16-bit async dma from 0x02000620 to 0x86803842
> musb-hdrc musb-hdrc.1.auto: ep1 rx dma callback
> musb-hdrc musb-hdrc.1.auto: DMA remaining 448/512
> musb-hdrc musb-hdrc.1.auto: Busy rx dma, not using: 000001c0
> musb-hdrc musb-hdrc.1.auto: Busy rx dma, not using: 00000008
> musb-hdrc musb-hdrc.1.auto: ep1 rx dma: 0x869fdc02 len: 512(512) packet_sz: 512(512)
> musb-hdrc musb-hdrc.1.auto: ep1 rx using 16-bit async dma from 0x02000620 to 0x869fdc02
> musb-hdrc musb-hdrc.1.auto: ep1 rx dma callback
> musb-hdrc musb-hdrc.1.auto: DMA remaining 448/512
> musb-hdrc musb-hdrc.1.auto: Busy rx dma, not using: 000001c0
> musb-hdrc musb-hdrc.1.auto: Busy rx dma, not using: 00000008
> musb-hdrc musb-hdrc.1.auto: ep1 rx dma: 0x869fc642 len: 512(512) packet_sz: 512(512)
> musb-hdrc musb-hdrc.1.auto: ep1 rx using 16-bit async dma from 0x02000620 to 0x869fc642
> musb-hdrc musb-hdrc.1.auto: ep1 rx dma callback
> musb-hdrc musb-hdrc.1.auto: Corrupt rx XFR_SIZE: 0x7ffffec0
> musb-hdrc musb-hdrc.1.auto: DMA remaining 0/512
> musb-hdrc musb-hdrc.1.auto: Busy rx dma, not using: 7ffffec0
> musb-hdrc musb-hdrc.1.auto: Busy rx dma, not using: 00000008
> musb-hdrc musb-hdrc.1.auto: Busy rx dma, not using: 00000010
> musb-hdrc musb-hdrc.1.auto: Busy rx dma, not using: 7ffffcf0
>
> It seems the hardware dmareq line is not triggering anything
> above?
>
> Also with just ping with no size specified, it seems every other
> packet is missed or DMA interrupts are not properly triggering
> as I'm getting these:
>
> g_ether gadget: invalid EEM CRC
>
>> This is when using only with the async gpmc access as the sync
>> gpmc access seems to have a regression not related to this series.
>> I'll try to track down that sync gpmc issue as that most likely
>> hints to something being wrong in the gpmc code in general.
>
> And this sync gpmc issue seems to be timing related. Setting
> DEBUG in tusb6010_omap.c makes it happen easily while without
> it it's much harder to trigger. So probably some kind of issue
> with GPMC sync timings.

Indeed there are some interesting things happening...
As I said, I was testing with g_cdc (CDC Composite (ECM + ACM)) and I 
found it pretty stable with DMAengine. But short story long:

With the series applied and getting rid of the dma_addr & 0x2, plus 
setting the set the quirk_avoids_skb_reserve flag:
g_cdc (ECM + ACM) boots to nfsroot most of the time, ping, scp works
g_ether (ECM) does not boot to nfsroot, ping does not work. However if I 
disable the rx DMA with:

diff --git a/drivers/usb/musb/tusb6010_omap.c 
b/drivers/usb/musb/tusb6010_omap.c
index 8b43c4b99f04..8e0a19b47132 100644
--- a/drivers/usb/musb/tusb6010_omap.c
+++ b/drivers/usb/musb/tusb6010_omap.c
@@ -512,6 +512,12 @@ tusb_omap_dma_allocate(struct dma_controller *c,
  		return NULL;
  	}

+	if (!tx) {
+		dev_err(musb->controller, "Not allowing RX DMA for ep%i %s\n",
+			chdat->epnum);
+		return NULL;
+	}
+
  	for (i = 0; i < MAX_DMAREQ; i++) {
  		struct dma_channel *ch = dma_channel_pool[i];
  		if (ch->status == MUSB_DMA_STATUS_UNKNOWN) {


nfsroot works, ping and scp also - TX is using DMA.

g_ncm (NCM): not booting to nfsroot, no ping, but if I disable the RX 
DMA, then I have NULL pointer dereference :o
Something is wrong for sure.

But to see what I have been comparing to, I have reverted my series and 
added the dma_addr & 2 and the quirk:

g_cdc (ECM + ACM): no nfsroot, no ping
g_ether (ECM): no nfsroot, no ping
g_ncm (NCM): no nfsroot, no ping, disabling RX DMA allow it to boot up, 
but ping kills the USB

None of this is issue I think currently as the DMA is effectively 
disabled for tusb by the dma_addr & 0x2 check, but it is somehow 
bothersome...

I'll try to pin-point out what is going on.

As reference, my configs are:
https://github.com/omap-audio/linux-audio/blob/peter/linux-next-wip/arch/arm/configs/nokia_n810_cdc_defconfig

https://github.com/omap-audio/linux-audio/blob/peter/linux-next-wip/arch/arm/configs/nokia_n810_ether_defconfig

https://github.com/omap-audio/linux-audio/blob/peter/linux-next-wip/arch/arm/configs/nokia_n810_ncm_defconfig

- Péter
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2017-05-05 13:38 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-03 10:56 [PATCH 0/4] usb: musb: tusb6010_omap: Convert to DMAengine Peter Ujfalusi
2017-05-03 10:56 ` Peter Ujfalusi
2017-05-03 10:56 ` [PATCH 1/4] usb: musb: tusb6010_omap: Create new struct for DMA data/parameters Peter Ujfalusi
2017-05-03 10:56   ` Peter Ujfalusi
2017-05-03 10:56 ` [PATCH 2/4] usb: musb: tusb6010_omap: Allocate DMA channels upfront Peter Ujfalusi
2017-05-03 10:56   ` Peter Ujfalusi
2017-05-03 10:56 ` [PATCH 3/4] ARM: OMAP2+: DMA: Add slave map entries for 24xx external request lines Peter Ujfalusi
2017-05-03 10:56   ` Peter Ujfalusi
2017-05-03 10:56 ` [PATCH 4/4] usb: musb: tusb6010_omap: Convert to DMAengine API Peter Ujfalusi
2017-05-03 10:56   ` Peter Ujfalusi
2017-05-04 19:40   ` Tony Lindgren
2017-05-04 21:05     ` Tony Lindgren
2017-05-05 13:37       ` Peter Ujfalusi [this message]
2017-05-05 13:37         ` Peter Ujfalusi
2017-05-05 15:17         ` Peter Ujfalusi
2017-05-05 15:17           ` Peter Ujfalusi
2017-05-05 22:55           ` Tony Lindgren
2017-05-08 15:12             ` Peter Ujfalusi
2017-05-08 15:12               ` Peter Ujfalusi
2017-05-08 15:29               ` Tony Lindgren
2017-05-04 14:31 ` [PATCH 0/4] usb: musb: tusb6010_omap: Convert to DMAengine Tony Lindgren
2017-05-05  7:28   ` Peter Ujfalusi
2017-05-05  7:28     ` Peter Ujfalusi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e7a7db55-753f-7b3b-b2e6-290518e7371b@ti.com \
    --to=peter.ujfalusi@ti.com \
    --cc=aaro.koskinen@iki.fi \
    --cc=b-liu@ti.com \
    --cc=balbi@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=tony@atomide.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.