imx53 UART SDMA under Linux mainline is broken

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

imx53 UART SDMA under Linux mainline is broken

Jump to solution
1,753 Views
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

Labels (3)
Tags (3)
0 Kudos
1 Solution
951 Views
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...

View solution in original post

0 Kudos
9 Replies
952 Views
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 Kudos
951 Views
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 Kudos
951 Views
fabio_estevam
NXP Employee
NXP Employee

Excellent, I see these patches in 3.17-rc.

0 Kudos
951 Views
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 Kudos
951 Views
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 Kudos
951 Views
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 Kudos
951 Views
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 Kudos
951 Views
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 Kudos
951 Views
alejandrolozan1
NXP Employee
NXP Employee

Hi Rick,

Which kernel versio are you using?

Have you tried with a different one?

Best Regards,

Alejandro

0 Kudos