This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM335x: Adding DMA support for UART in linux3.12(SDK7.0)

Hi All,

I followed this - http://processors.wiki.ti.com/index.php/Sitara_Linux_SDK_UART_-_Switching_to_8250_Driver to add DMA support to UART. I'm able to build the image and boot the board. I've enabled UARTs - 1, 2, 3, 5 in my dts file. I needed DMA support to only UART5, so in am33xx.dtsi, I've

uart5: serial@481aa000 {
                        compatible = "ti,omap3-uart";
                        ti,hwmods = "uart6";
                        clocks = <&dpll_per_m2_div4_ck>;
                        clock-names = "fck";
                        clock-frequency = <48000000>;
                        reg = <0x481aa000 0x2000>;
                        interrupts = <46>;
                        status = "disabled";
                        dmas = <&edma 26>, <&edma 27>;
                        dma-names = "tx", "rx";
                }; 

The problem is I got  "/dev/ttyS0", "/dev/ttyS1, "/dev/ttyS2', "/dev/ttyS3". It should have been "/dev/ttyS1, "/dev/ttyS2', "/dev/ttyS3" and "/dev/ttyS5".

In make menuconfig, I changed (4) to (6) and got  "/dev/ttyS0", "/dev/ttyS1, "/dev/ttyS2', "/dev/ttyS3", "/dev/ttyS4', "/dev/ttyS5",

Device drivers  ---> character devices  ---> serial drivers --->

(4) Maximum number of 8250/16550 serial ports                                                                    
(4) Number of 8250/16550 serial ports to register at runtime

I want to know what is the change required to get only device nodes enabled in dts file  ----  "/dev/ttyS1, "/dev/ttyS2', "/dev/ttyS3" and "/dev/ttyS5".

Regards,

Gangadhar

  

  • Hi Gangadhar,

    I will forward this to the SW team.

  • Hi Gangadhar,

    do you have "Support for OMAP internal UART (8250 based driver)" option in kernel 3.12 menuconfig? Do not see it in mine, when trying to make steps from the link.

    Thanks,
    Georgi
  • Hi Georgi,
    I took "drivers/tty/serial/8250/8250_omap.c" from 3.14 kernel. Modified "drivers/tty/serial/8250/Kconfig" and "drivers/tty/serial/8250/Makefile". This gives "Support for OMAP internal UART (8250 based driver)" option. When I got build errors, I compared files in 3.12 and 3.14 kernel and made relevant changes,

    Added "drivers/tty/serial/8250/8250_omap.c"
    # modified: arch/arm/boot/dts/am33xx.dtsi
    # modified: arch/arm/configs/nafta_defconfig
    # modified: drivers/tty/serial/8250/8250.h
    # modified: drivers/tty/serial/8250/8250_core.c
    # modified: drivers/tty/serial/8250/Kconfig
    # modified: drivers/tty/serial/8250/Makefile
    # modified: include/linux/serial_8250.h
    # modified: include/linux/serial_core.h
    # modified: include/uapi/linux/serial_reg.h

    Regards,
    Gangadhar
  • Hi Gangadhar,

    Looks like the solution is in drivers/tty/serial/8250/8250_core.c driver source.

    It initializes number of ttySs equal to number of CONFIG_SERIAL_8250_RUNTIME_UARTS from kernel configuration;
    If given uart is not enabled in dtb, then (you can see it in sysfs) its address and irq is 0.

    The first way is to modify type of CONFIG_SERIAL_8250_RUNTIME_UARTS as string to be able to set in menuconfig an array of port numbers ([1 2 3 5]).
    In this case you must modify drivers/tty/serial/8250/8250_core.c so that in place
    static unsigned int nr_uarts = CONFIG_SERIAL_8250_RUNTIME_UARTS
    first you read set of CONFIG_SERIAL_8250_RUNTIME_UARTS uart numbers and then
    when you initialize ports you use only this numbers.

    The second way is to modify drivers/tty/serial/8250/8250_core.c so that in init function
    static void __init serial8250_isa_init_ports(void)
    you will have a check if i-th serial8250_port is enabled in dtb.


    BR,
    Georgi
  • Hi Georgi,
    Thanks for your info. I'm able to have only the required UART nodes. But now I've run into one more issue. If UART DMA is enabled in kernel configuration, it takes too much time(say 30 seconds) to complete transfer. But if I don't use DMA, it returns immediately.

    If anyone has solution for this, please let me know.

    Regards,
    Gangadhar

  • Hi Gangadhar,

    can you, please, open a new thread for this issue?

    Thanks,
    Georgi