imx53 UART SDMA under Linux mainline is broken

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

imx53 UART SDMA under Linux mainline is broken

跳至解决方案
2,709 次查看
rickbronson
Contributor II

Hi,

  In the mainline kernel, UART SDMA is only enabled for imx6.  It seems to work just fine for imx53 in 2.6.35 so there shouldn't be any hardware problem in trying to get it working in mainline.  I enabled it and the tx callback happens at the right frequency and the serial driver stats look correct via "cat /proc/tty/driver/IMX-uart" but oddly no char's appear at the TX pin using an oscilloscope.   I made sure they appear when SDMA is turned off using the same test program.  The script binaries are the same between 2.6.35 and mainline and the firmware is getting loaded okay via dmesg:

imx-sdma 63fb0000.sdma: loaded firmware 1.1
imx-sdma 63fb0000.sdma: initialized

  Anyone have any clues to what's happening or how to go about getting it working?

  Thanks much for any help.

  Rick

标签 (3)
标记 (3)
0 项奖励
回复
1 解答
1,907 次查看
rickbronson
Contributor II

  Found the problem.  Turns out you need to allow permission for the SDMA to write to the peripheral.  The script was erroring since it did not have permission.

It's in these two patches.

http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/diff/?id=6befda9a272b98bfb1dc772efc35...
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=e57e4ab5fc2e4e58447d13493c...

在原帖中查看解决方案

0 项奖励
回复
9 回复数
1,908 次查看
rickbronson
Contributor II

  Found the problem.  Turns out you need to allow permission for the SDMA to write to the peripheral.  The script was erroring since it did not have permission.

It's in these two patches.

http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/diff/?id=6befda9a272b98bfb1dc772efc35...
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=e57e4ab5fc2e4e58447d13493c...

0 项奖励
回复
1,907 次查看
fabio_estevam
NXP Employee
NXP Employee

Rick,

Can you share your patch against drivers/tty/serial/imx.c so that mx53 could make use of SDMA?

It would be nice if you could post this as a formal patch to the linux-arm-kernel and linux-serial lists.

0 项奖励
回复
1,907 次查看
fabio_estevam
NXP Employee
NXP Employee

Excellent, I see these patches in 3.17-rc.

0 项奖励
回复
1,907 次查看
rickbronson
Contributor II

  Found out that the UART TX script is returning BD_RROR inside mxc_sdma_handle_channel_normal().  The script in this case is in ROM and is mcu_2_app.  The context looks the same as 2.6.35: {0x0, 0x20000, 0x0, 0x0, 0x0, 0x0, 0x63f90040, 0x10}.  Is there a way to get more information on why the script is returning an error?

0 项奖励
回复
1,907 次查看
rickbronson
Contributor II

Thanks for the help, really appreciate it.

Here is the test program I'm using http://efn.org/~rick/pub/sertest.c

It is used like this:

1. Tie TX to RX pin (or use TEST register (UART-5_UTS) to force loopback.

2. Run this in one term:

#session 1 - transmit
baud=115200

./sertest -d /dev/ttymxc4 -w -b $baud -m 50 -x 50

3. Run this in another term:

#session 2 - receive
baud=115200
./sertest -d /dev/ttymxc4 -b $baud -v

Kernel version is 3.16.0, we had been using 2.6.35 (with Freescale's changes).

Fabio, your changes above are pretty much what I did to enable it for iMX53 although I removed the dependency of CRTSCTS.

Not sure why that was in there in the first place.  I'll post on linux-arm-kernel if this effort reaches a dead end.  My gut feeling is that

this is a SDMA problem and not a lot of people on linux-arm-kernel are knowledgeable about SDMA.

  Thanks again for the help.

0 项奖励
回复
1,907 次查看
fabio_estevam
NXP Employee
NXP Employee

Rick,

Can you please report this in linux-arm-kernel?

Also, please post there exactly the app you used so that people could reproduce this behavior.

0 项奖励
回复
1,907 次查看
fabio_estevam
NXP Employee
NXP Employee

Rick,

Does the patch below allow you to have DMA working with uart on mx53?

--- a/drivers/tty/serial/imx.c

+++ b/drivers/tty/serial/imx.c

@@ -1325,7 +1325,7 @@ imx_set_termios(struct uart_port *port, struct ktermios *t

                        ucr2 |= UCR2_CTSC;

                        /* Can we enable the DMA support? */

-                       if (is_imx6q_uart(sport) && !uart_console(port)

+                       if (is_imx21_uart(sport) && !uart_console(port)

                                && !sport->dma_is_inited)

                                imx_uart_dma_init(sport);

                } else {

0 项奖励
回复
1,907 次查看
fabio_estevam
NXP Employee
NXP Employee

Actually I meant this:

--- a/drivers/tty/serial/imx.c

+++ b/drivers/tty/serial/imx.c

@@ -1325,8 +1325,8 @@ imx_set_termios(struct uart_port *port, struct ktermios *t

                        ucr2 |= UCR2_CTSC;

                        /* Can we enable the DMA support? */

-                       if (is_imx6q_uart(sport) && !uart_console(port)

-                               && !sport->dma_is_inited)

+                       if ((is_imx6q_uart(sport) || is_imx21_uart(sport))

+                           && !uart_console(port) && !sport->dma_is_inited)

                                imx_uart_dma_init(sport);

                } else {

                        termios->c_cflag &= ~CRTSCTS;

0 项奖励
回复
1,907 次查看
alejandrolozan1
NXP Employee
NXP Employee

Hi Rick,

Which kernel versio are you using?

Have you tried with a different one?

Best Regards,

Alejandro

0 项奖励
回复