Should at91sam9g25 UART work with DMA?

This forum is for users of Microchip MPUs and who are interested in using Linux OS.

Moderator: nferre

klugja
Posts: 3
Joined: Mon Nov 26, 2018 6:29 pm

Should at91sam9g25 UART work with DMA?

Mon Jan 28, 2019 8:49 pm

When I add atmel,use-dma-rx and atmel,use-dma-tx to our UART section of device tree, the kernel hangs when trying to read from the serial device. We are using CONFIG_PREEMPT. Without DMA, the UART works fine. I do not see any errors in dmesg output during discovery either way.

Our device tree with use-dma-rx/use-dma-tx removed:

uart0: serial@f8040000 {
status = "okay";
/delete-property/ atmel,use-dma-rx;
/delete-property/ atmel,use-dma-tx;
};


This inherits from at91sam9x5.dtsi

Reverse compile:

uart0 {

uart0-0 {
atmel,pins = <0x02 0x08 0x03 0x00 0x02 0x09 0x03 0x01>;
linux,phandle = <0x29>;
phandle = <0x29>;
};
};

...

serial@f8040000 {
compatible = "atmel,at91sam9260-usart";
reg = <0xf8040000 0x200>;
interrupts = <0x0f 0x04 0x05>;
pinctrl-names = "default";
pinctrl-0 = <0x29>;
clocks = <0x2a>;
clock-names = "usart";
status = "okay";
};
blue_z
Location: USA
Posts: 1848
Joined: Thu Apr 19, 2007 10:15 pm

Re: Should at91sam9g25 UART work with DMA?

Tue Jan 29, 2019 10:33 pm

klugja wrote: When I add atmel,use-dma-rx and atmel,use-dma-tx to our UART section of device tree, the kernel hangs when trying to read from the serial device.
The "kernel hangs"?
The entire system is non-responsive?
Or just your process is hung?


klugja wrote: Our device tree with use-dma-rx/use-dma-tx removed:

uart0: serial@f8040000 {
status = "okay";
/delete-property/ atmel,use-dma-rx;
/delete-property/ atmel,use-dma-tx;
};


This inherits from at91sam9x5.dtsi

Reverse compile:

uart0 {

uart0-0 {
atmel,pins = <0x02 0x08 0x03 0x00 0x02 0x09 0x03 0x01>;
linux,phandle = <0x29>;
phandle = <0x29>;
};
};

...

serial@f8040000 {
compatible = "atmel,at91sam9260-usart";
reg = <0xf8040000 0x200>;
interrupts = <0x0f 0x04 0x05>;
pinctrl-names = "default";
pinctrl-0 = <0x29>;
clocks = <0x2a>;
clock-names = "usart";
status = "okay";
};
These unformatted snippets from unknown sources and ambiguous context are not as helpful as necessary.


What is the output of the shell command

Code: Select all

ls -l /proc/device-tree/ahb/apb/serial@f8040000 
executed from your board's console?

Regards
klugja
Posts: 3
Joined: Mon Nov 26, 2018 6:29 pm

Re: Should at91sam9g25 UART work with DMA?

Wed Jan 30, 2019 2:20 am

When I try to cat the serial port the debug port becomes unresponsive if DMA is turned on. Then after the watchdog expires the system reboots. Without DMA, the port dumps the data I expect.


Without DMA:

# ls -l /proc/device-tree/ahb/apb/serial@f8040000
-r--r--r-- 1 root root 6 Jan 26 01:40 clock-names
-r--r--r-- 1 root root 4 Jan 26 01:40 clocks
-r--r--r-- 1 root root 24 Jan 26 01:40 compatible
-r--r--r-- 1 root root 12 Jan 26 01:40 interrupts
-r--r--r-- 1 root root 7 Jan 26 01:40 name
-r--r--r-- 1 root root 4 Jan 26 01:40 pinctrl-0
-r--r--r-- 1 root root 8 Jan 26 01:40 pinctrl-names
-r--r--r-- 1 root root 8 Jan 26 01:40 reg
-r--r--r-- 1 root root 5 Jan 26 01:40 status


With DMA (and watchdog reboot):

# ls -l /proc/device-tree/ahb/apb/serial@f8040000
-r--r--r-- 1 root root 0 Jan 26 02:09 atmel,use-dma-rx
-r--r--r-- 1 root root 0 Jan 26 02:09 atmel,use-dma-tx
-r--r--r-- 1 root root 6 Jan 26 02:09 clock-names
-r--r--r-- 1 root root 4 Jan 26 02:09 clocks
-r--r--r-- 1 root root 24 Jan 26 02:09 compatible
-r--r--r-- 1 root root 12 Jan 26 02:09 interrupts
-r--r--r-- 1 root root 7 Jan 26 02:09 name
-r--r--r-- 1 root root 4 Jan 26 02:09 pinctrl-0
-r--r--r-- 1 root root 8 Jan 26 02:09 pinctrl-names
-r--r--r-- 1 root root 8 Jan 26 02:09 reg
-r--r--r-- 1 root root 5 Jan 26 02:09 status
blue_z
Location: USA
Posts: 1848
Joined: Thu Apr 19, 2007 10:15 pm

Re: Should at91sam9g25 UART work with DMA?

Wed Jan 30, 2019 10:03 pm

klugja wrote: With DMA (and watchdog reboot):

# ls -l /proc/device-tree/ahb/apb/serial@f8040000
-r--r--r-- 1 root root 0 Jan 26 02:09 atmel,use-dma-rx
-r--r--r-- 1 root root 0 Jan 26 02:09 atmel,use-dma-tx
-r--r--r-- 1 root root 6 Jan 26 02:09 clock-names
-r--r--r-- 1 root root 4 Jan 26 02:09 clocks
-r--r--r-- 1 root root 24 Jan 26 02:09 compatible
-r--r--r-- 1 root root 12 Jan 26 02:09 interrupts
-r--r--r-- 1 root root 7 Jan 26 02:09 name
-r--r--r-- 1 root root 4 Jan 26 02:09 pinctrl-0
-r--r--r-- 1 root root 8 Jan 26 02:09 pinctrl-names
-r--r--r-- 1 root root 8 Jan 26 02:09 reg
-r--r--r-- 1 root root 5 Jan 26 02:09 status
Looks like you're missing the Device Tree attributes that specify the DMA channels assigned to the UART peripheral.

You need to add something like the following to the uart0 node in your .dts file:

Code: Select all

				dmas = <&dma0 1 AT91_DMA_CFG_PER_ID(11)>,
				       <&dma0 1 (AT91_DMA_CFG_PER_ID(12) | AT91_DMA_CFG_FIFOCFG_ASAP)>;
				dma-names = "tx", "rx";


Regards

Return to “LINUX”

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 2 guests