i.mx6ull uart dma issue

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

i.mx6ull uart dma issue

Jump to solution
5,974 Views
changbaoma
Contributor IV

i use the kernel pulled from NXP's https://source.codeaurora.org/external/imx/linux-imx branch imx_5.4.24_2.1.0.

Default in that kernel's device tree , uart do not use DMA .

And i need to enable uart dma in my product, so i modify:

arch/arm/boot/dts/imx6ull-myboard.dts

&uart3 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_uart3>;
+dmas = <&sdma 29 4 0>, <&sdma 30 4 0>;
+dma-names = "rx", "tx";
status = "okay";
};

drivers/tty/serial/imx.c

@@ -1315,6 +1315,7 @@ static int imx_uart_dma_init(struct imx_port *sport)
goto err;
}


+printk("imx_uart_dma_init: sport=%p done.\n", sport); // for make sure dma is enable
return 0;
err:
imx_uart_dma_exit(sport);

 

it take 5 seconds to finish:

root@Router:~# echo a > /dev/ttymxc2
[ 3795.288472] imx_uart_dma_init: sport=f416546c done.

 

 


root@Router:~#

 

why hang 5 seconds when uart send?

and tx num increate a lot even only send one data:

2: uart:IMX mmio:0x021EC000 irq:53 tx:28693 rx:28672 DSR|CD

2: uart:IMX mmio:0x021EC000 irq:53 tx:32790 rx:32768 DSR|CD

0 Kudos
Reply
1 Solution
5,920 Views
ceggers
Contributor V

Hi changbaoma,

it looks like initial loading of the SDMA firmware fails. This usually happens when the imx-sdma driver is built into the kernel. Please try building it as a kernel module.

Additionally, your SDMA firmware is outdated. Please git the latest version from here:
https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/imx/sdma

regards
Christian

View solution in original post

0 Kudos
Reply
10 Replies
4,325 Views
tbultel
Contributor II

Hi, using firmware 3.6, on latest 6.0.3 kernel from mainline, on imx6ull, makes me encounter exactly the same issue.

I have sdma as a module, and no firmware loading error.

# echo a > /dev/ttymxc1
[ 192.666219] imx_uart_dma_init...

Hangs during about 30 seconds since I have enabled DMA on uart in device tree

Any clues ?

0 Kudos
Reply
4,250 Views
changbaoma
Contributor IV

Hello, tbultel

On my side after updating SDMA firmware version form 3.3 to 3.5, the uarts work well . You can get latest SDMA firmware form here:
https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/imx/sdma

0 Kudos
Reply
4,242 Views
tbultel
Contributor II

Hi Changbaoma,

I read you are running 'linux-imx" kernel, whereas mine is mainline.

Can you confirm ?

Thanks !

0 Kudos
Reply
4,232 Views
changbaoma
Contributor IV

Firstly, you need to check whether sdma firmware has been loaded by:

root@Router:~# dmesg | grep sdma
[ 0.593860] imx-sdma 20ec000.sdma: Direct firmware load for imx/sdma/sdma-imx6q.bin failed with error -2
[ 0.593899] imx-sdma 20ec000.sdma: Falling back to sysfs fallback for: imx/sdma/sdma-imx6q.bin
[ 14.518171] imx-sdma 20ec000.sdma: loaded firmware 3.5

0 Kudos
Reply
5,953 Views
igorpadykov
NXP Employee
NXP Employee

Hi changbaoma

 

one can test this use case using i.MX6ULL EVK reference board with Demo

images from link:

https://www.nxp.com/design/software/embedded-software/i-mx-software/embedded-linux-for-i-mx-applicat...

 

Best regards
igor

0 Kudos
Reply
5,960 Views
ceggers
Contributor V

Hi changbaoma,

I also use an i.MX6ULL (with latest 5.4-rt kernel). Your device tree setup looks correct for me. Please check the following:

  • Does your UART work normally without DMA?
  • Do you get SDMA related messages in dmesg?
  • Do you use a SDMA firmware image?

Please post the full output of the dmesg command.

Thanks
Christian

 

0 Kudos
Reply
5,944 Views
changbaoma
Contributor IV

Thank you very much, ceggers

  • Does your UART work normally without DMA?

Yes, witout DMA my UART work well.

  • Do you get SDMA related messages in dmesg?

root@Router:~# dmesg | grep dma -i
[ 0.000000] OF: reserved mem: initialized node linux,cma, compatible id shared-dma-pool
[ 0.177471] DMA: preallocated 256 KiB pool for atomic coherent allocations
[ 0.560509] imx-sdma 20ec000.sdma: Direct firmware load for imx/sdma/sdma-imx6q.bin failed with error -2
[ 0.560552] imx-sdma 20ec000.sdma: Falling back to sysfs fallback for: imx/sdma/sdma-imx6q.bin
[ 0.564939] mxs-dma 1804000.dma-apbh: initialized
[ 2.341980] mmc1: SDHCI controller on 2194000.usdhc [2194000.usdhc] using ADMA
[ 11.919465] imx-sdma 20ec000.sdma: loaded firmware 3.3
[ 40.519523] imx_uart_dma_init: sport=f416546c iobase=0 done.

  • Do you use a SDMA firmware image?

root@Router:~# ls /lib/firmware/imx/sdma/
.sdma-imx6q.bin.gen.o.cmd sdma-imx6q.bin.ihex
.sdma-imx7d.bin.gen.o.cmd sdma-imx7d.bin
sdma-imx6q.bin sdma-imx7d.bin.gen.S
sdma-imx6q.bin.gen.S sdma-imx7d.bin.gen.o
sdma-imx6q.bin.gen.o sdma-imx7d.bin.ihex

 

Attachment is my board dmesg info.

0 Kudos
Reply
5,921 Views
ceggers
Contributor V

Hi changbaoma,

it looks like initial loading of the SDMA firmware fails. This usually happens when the imx-sdma driver is built into the kernel. Please try building it as a kernel module.

Additionally, your SDMA firmware is outdated. Please git the latest version from here:
https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/imx/sdma

regards
Christian

0 Kudos
Reply
5,876 Views
changbaoma
Contributor IV

Thank you very much, @ceggers 

You help me a lot. since update SDMA firmware version form 3.3 to 3.5, the uarts work well in DMA mode.

Thank you all the same @igorpadykov 

0 Kudos
Reply
5,908 Views
changbaoma
Contributor IV

Thank you, @ceggers 

I will try your advise and respone back.

 

@igorpadykov  any idea?