[meta-freescale] imx.c RXTL

Nikolay Dimitrov picmaster at mail.bg
Wed Apr 29 10:15:53 PDT 2015


Hi Fabio, Will,

On 04/29/2015 06:29 PM, Fabio Estevam wrote:
> Hi Will,
>
> On Wed, Apr 29, 2015 at 10:24 AM, Fabio Estevam <festevam at gmail.com>
> wrote:
>> Hi Will,
>>
>> On Wed, Apr 29, 2015 at 9:08 AM, Frazer, Will
>> <will.frazer at eurotech.com> wrote:
>>
>>> In tests I can see that with the value set as 1, under intensive
>>> serial use, CPU use goes towards about 20% (solo core). With the
>>> value set to 14 it’s closer to 2%.
>>
>> I think your proposal makes sense.
>>
>> Should we also change TXTL?
>
> I tested your proposal and it seems we need some logic to adjust the
> RXTL value.
>
> For console operation we need it to be RXTL, otherwise we miss
> echoing the chars.

It's normal to have this behavior when RXTL is 1, this essentially
generates 1 interrupt per character. In order to reduce interrupt load,
it's not enough to just increase the RXTL to a higher value, for reasons
observed by Fabio.

If one wants to use RXFIFO > 1 character, the solution is called "Aging
Timer" (it was available even back in the 16550 days). It's
functionality is to assert an interrupt when:
- there's at least 1 character in RXFIFO
- no characters have been received for several character periods (I
think for imx6 it's 8)

Both interrupts (RRDY & AgingTimeout) together handle all situations in
appropriate manner. Let's look at the code
(http://git.freescale.com/git/cgit.cgi/imx/linux-2.6-imx.git/tree/drivers/tty/serial/imx.c?h=imx_3.14.28_1.0.0_ga):


static irqreturn_t imx_int(int irq, void *dev_id)
{
...
	sts = readl(sport->port.membase + USR1);

	if ((sts & USR1_RRDY || sts & USR1_AGTIM) &&
		!sport->dma_is_enabled) {
		if (sts & USR1_AGTIM)
			writel(USR1_AGTIM, sport->port.membase + USR1);
		imx_rxint(irq, dev_id);
	}
...
}


It seems to me that AGTIM is not handled if DMA is enabled.
Unfortunately these 2 features are not connected at all, imho.

It's also good to note that the RXTL level is different for the system
console and other serial ports:


...
#define RXTL 1 /* For console port */
#define RXTL_UART 16 /* For uart */

static int imx_setup_ufcr(struct imx_port *sport, unsigned int mode)
{
...
	if (uart_console(&sport->port))
		rx_fifo_trig = RXTL;
	else
		rx_fifo_trig = RXTL_UART;
...
}


What can you do to solve this? You can try disabling the dma and test
how it works for you, or you can fix the driver logic to use the AgingTimer.

Regards,
Nikolay


More information about the meta-freescale mailing list