All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* mxs auart timeout waiting for transmission with hw flow control
@ 2013-09-30 16:07 Hector Palacios
  2013-09-30 16:20 ` Uwe Kleine-König
  0 siblings, 1 reply; 4+ messages in thread
From: Hector Palacios @ 2013-09-30 16:07 UTC (permalink / raw
  To: Uwe Kleine-König, linux-serial; +Cc: Huang Shijie, shawn.guo@linaro.org

Hi Uwe,

I saw your patch at http://www.spinics.net/lists/stable/msg12952.html and I believe 
I'm having a similar issue when not using the port as console.

With hardware flow control enabled transmission fails at low baudrates (9600,38400). 
Apparently the transmitter closes the port before the data has been really shifted out 
(or even transferred by the DMA). While the console functions check the status of 
AUART_STAT_BUSY, the standard functions don't, and the AUART is busy when shutdown is 
called at low baudrates.

I also see the function uart_wait_until_sent() of serial_core.c getting out with 
timeout expired. At 9600 baud, this function waits 2 or 4 jiffies. Increasing (a lot) 
the timeout of this function solves the problem. I monitored the time it takes for TX 
to be empty and it resulted in sometimes around 200 jiffies (@9600).

The issue can be reproduced using two iMX28 devices (transmitting between two ports on 
the same platform usually works fine), configuring a low baudrate (9600) and hardware 
flow enabled, and sending a file of 40K, for example. The last ~200 bytes or so are 
typically not sent over the line.

Best regards,
--
Hector Palacios

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: mxs auart timeout waiting for transmission with hw flow control
  2013-09-30 16:07 mxs auart timeout waiting for transmission with hw flow control Hector Palacios
@ 2013-09-30 16:20 ` Uwe Kleine-König
  2013-09-30 16:41   ` Hector Palacios
  0 siblings, 1 reply; 4+ messages in thread
From: Uwe Kleine-König @ 2013-09-30 16:20 UTC (permalink / raw
  To: Hector Palacios; +Cc: linux-serial, Huang Shijie, shawn.guo@linaro.org

Hi Hector,

On Mon, Sep 30, 2013 at 06:07:19PM +0200, Hector Palacios wrote:
> I saw your patch at
> http://www.spinics.net/lists/stable/msg12952.html and I believe I'm
> having a similar issue when not using the port as console.
> 
> With hardware flow control enabled transmission fails at low
> baudrates (9600,38400). Apparently the transmitter closes the port
Which kernel are you using? I think there were some other fixes
concering flow control some time ago.

> before the data has been really shifted out (or even transferred by
> the DMA). While the console functions check the status of
> AUART_STAT_BUSY, the standard functions don't, and the AUART is busy
> when shutdown is called at low baudrates.
> 
> I also see the function uart_wait_until_sent() of serial_core.c
> getting out with timeout expired. At 9600 baud, this function waits
> 2 or 4 jiffies. Increasing (a lot) the timeout of this function
> solves the problem. I monitored the time it takes for TX to be empty
> and it resulted in sometimes around 200 jiffies (@9600).
Again with flow control and another imx28 on the opposite side? Does it
work without flow control? Is CTS busy for some time? In that case a
simple timeout isn't appropriate. Using console and flow control on the
same port might be hairy, not sure though.
 
> The issue can be reproduced using two iMX28 devices (transmitting
> between two ports on the same platform usually works fine),
> configuring a low baudrate (9600) and hardware flow enabled, and
> sending a file of 40K, for example. The last ~200 bytes or so are
> typically not sent over the line.
I currently don't have the time and machines to test, but maybe the
freescale guys (added Fabio to Cc, too) might want to test it.

Best regards from Freiburg
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: mxs auart timeout waiting for transmission with hw flow control
  2013-09-30 16:20 ` Uwe Kleine-König
@ 2013-09-30 16:41   ` Hector Palacios
  2013-10-01 15:37     ` Hector Palacios
  0 siblings, 1 reply; 4+ messages in thread
From: Hector Palacios @ 2013-09-30 16:41 UTC (permalink / raw
  To: Uwe Kleine-König
  Cc: linux-serial@vger.kernel.org, Huang Shijie, shawn.guo@linaro.org,
	fabio.estevam@freescale.com, Marek Vasut

Hi Uwe,

On 09/30/2013 06:20 PM, Uwe Kleine-König wrote:
> Hi Hector,
>
> On Mon, Sep 30, 2013 at 06:07:19PM +0200, Hector Palacios wrote:
>> I saw your patch at
>> http://www.spinics.net/lists/stable/msg12952.html and I believe I'm
>> having a similar issue when not using the port as console.
>>
>> With hardware flow control enabled transmission fails at low
>> baudrates (9600,38400). Apparently the transmitter closes the port
> Which kernel are you using? I think there were some other fixes
> concering flow control some time ago.

v3.10. The driver is pretty close to current status.

>> before the data has been really shifted out (or even transferred by
>> the DMA). While the console functions check the status of
>> AUART_STAT_BUSY, the standard functions don't, and the AUART is busy
>> when shutdown is called at low baudrates.
>>
>> I also see the function uart_wait_until_sent() of serial_core.c
>> getting out with timeout expired. At 9600 baud, this function waits
>> 2 or 4 jiffies. Increasing (a lot) the timeout of this function
>> solves the problem. I monitored the time it takes for TX to be empty
>> and it resulted in sometimes around 200 jiffies (@9600).
> Again with flow control and another imx28 on the opposite side? Does it
> work without flow control? Is CTS busy for some time? In that case a
> simple timeout isn't appropriate. Using console and flow control on the
> same port might be hairy, not sure though.

Yes, two imx28 devices with hw flow control enabled. Without flow control it works.
CTS is not busy. At these low baudrates the CPU is fast enough to process the received 
data in time.
I'm not using the AUART as console but as a standard port.

>> The issue can be reproduced using two iMX28 devices (transmitting
>> between two ports on the same platform usually works fine),
>> configuring a low baudrate (9600) and hardware flow enabled, and
>> sending a file of 40K, for example. The last ~200 bytes or so are
>> typically not sent over the line.
> I currently don't have the time and machines to test, but maybe the
> freescale guys (added Fabio to Cc, too) might want to test it.
>
> Best regards from Freiburg

I wish I could drop by Freiburg one of these days! Love the city (and the beer).

Best regards,
--
Hector Palacios
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: mxs auart timeout waiting for transmission with hw flow control
  2013-09-30 16:41   ` Hector Palacios
@ 2013-10-01 15:37     ` Hector Palacios
  0 siblings, 0 replies; 4+ messages in thread
From: Hector Palacios @ 2013-10-01 15:37 UTC (permalink / raw
  To: Uwe Kleine-König
  Cc: linux-serial@vger.kernel.org, Huang Shijie, shawn.guo@linaro.org,
	fabio.estevam@freescale.com, Marek Vasut

Hello,

On 09/30/2013 06:41 PM, Hector Palacios wrote:
> Hi Uwe,
>
> On 09/30/2013 06:20 PM, Uwe Kleine-König wrote:
>> Hi Hector,
>>
>> On Mon, Sep 30, 2013 at 06:07:19PM +0200, Hector Palacios wrote:
>>> I saw your patch at
>>> http://www.spinics.net/lists/stable/msg12952.html and I believe I'm
>>> having a similar issue when not using the port as console.
>>>
>>> With hardware flow control enabled transmission fails at low
>>> baudrates (9600,38400). Apparently the transmitter closes the port
>> Which kernel are you using? I think there were some other fixes
>> concering flow control some time ago.
>
> v3.10. The driver is pretty close to current status.
>
>>> before the data has been really shifted out (or even transferred by
>>> the DMA). While the console functions check the status of
>>> AUART_STAT_BUSY, the standard functions don't, and the AUART is busy
>>> when shutdown is called at low baudrates.
>>>
>>> I also see the function uart_wait_until_sent() of serial_core.c
>>> getting out with timeout expired. At 9600 baud, this function waits
>>> 2 or 4 jiffies. Increasing (a lot) the timeout of this function
>>> solves the problem. I monitored the time it takes for TX to be empty
>>> and it resulted in sometimes around 200 jiffies (@9600).

The problem is that the shutdown callback does not wait for the DMA buffer to flush.
I will submit a patch that fixes it.

>> Again with flow control and another imx28 on the opposite side? Does it
>> work without flow control? Is CTS busy for some time? In that case a
>> simple timeout isn't appropriate. Using console and flow control on the
>> same port might be hairy, not sure though.
>
> Yes, two imx28 devices with hw flow control enabled. Without flow control it works.

The reason why it works without hardware flow control is that in this driver the DMA 
is only activated when hardware flow control is enabled.

By the way, where did the spinlocks go in this driver?
Ocasionally I saw unhandled NULL pointer exception in uart_write_wakeup(). Maybe my 
patch will make it even hardware to hit, but still...

Best regards,
--
Hector Palacios
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-10-01 15:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-30 16:07 mxs auart timeout waiting for transmission with hw flow control Hector Palacios
2013-09-30 16:20 ` Uwe Kleine-König
2013-09-30 16:41   ` Hector Palacios
2013-10-01 15:37     ` Hector Palacios

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.