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.

How to use UART1 and UART2

Hi everybody,

I am using dm6446. I am tring to use UART1 and UART2. I found out that some codes are modifyed to use UART1 and UART2 and I am searching information to use UART1 and UART2.

How can I use UART1 and UART2? Plz give me information?

Thank you and BR.

  • Additionally, I know that UART1 is shared whit ATA. Is it possible to use simultaneous UART1 with ATA?

  • I modified source codes such as the following.

    ////////////////////////////////////// mux_cfg.c //////////////////////////////////////

    struct pin_config __initdata_or_module davinci_dm644x_pins[] = {
    /*
     *  description  mux  mode   mode  mux  dbg
     *    reg  offset mask  mode
     */
    MUX_CFG("HDIREN",   0,   16,    1,   1,  1)
    MUX_CFG("ATAEN",   0,   17,    1,   1,  1)

    MUX_CFG("MSTK",    1,   9,     1,   0,  0)

    MUX_CFG("I2C",    1,   7,     1,   1,  0)

    MUX_CFG("MCBSP",   1,   10,    1,   1,  0)

    MUX_CFG("PWM0",    1,   4,     1,   1,  0)

    MUX_CFG("PWM1",    1,   5,     1,   1,  0)

    MUX_CFG("PWM2",    1,   6,     1,   1,  0)

    MUX_CFG("VLINQEN",   0,   15,    1,   1,  0)
    MUX_CFG("VLINQWD",   0,   12,    3,   3,  0)

    MUX_CFG("EMACEN",   0,   31,    1,   1,  1)

    MUX_CFG("GPIO3V",   0,   31,    1,   0,  1)

    MUX_CFG("GPIO0",   0,   24,    1,   0,  1)
    MUX_CFG("GPIO3",   0,   25,    1,   0,  0)
    MUX_CFG("GPIO43_44",   1,   7,     1,   0,  0)
    MUX_CFG("GPIO46_47",   0,   22,    1,   0,  1)

    MUX_CFG("RGB666",   0,   22,    1,   1,  1)

    MUX_CFG("LOEEN",   0,   24,    1,   1,  1)
    MUX_CFG("LFLDEN",   0,   25,    1,   1,  0)

    MUX_CFG("UART1",   1,    1,    1,   1,     0) //_test
    MUX_CFG("UART2",   1,    2,    1,   1,     0) //_test

    };

    ////////////////////////////////////// board_evm.c //////////////////////////////////////

    static struct plat_serial8250_port serial_platform_data[] = {
     {
      .membase = (char *)IO_ADDRESS(DAVINCI_UART0_BASE),
      .mapbase = (unsigned long)DAVINCI_UART0_BASE,
      .irq  = IRQ_UARTINT0,
      .flags  = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
      .iotype  = UPIO_MEM,
      .regshift = 2,
      .uartclk = 27000000,
     },
    //_test:start
     {
      .membase = (char *)IO_ADDRESS(DAVINCI_UART1_BASE),
      .mapbase = (unsigned long)DAVINCI_UART1_BASE,
      .irq  = IRQ_UARTINT1,
      .flags  = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
      .iotype  = UPIO_MEM,
      .regshift = 2,
      .uartclk = 27000000,
     },
     {
      .membase = (char *)IO_ADDRESS(DAVINCI_UART2_BASE),
      .mapbase = (unsigned long)DAVINCI_UART2_BASE,
      .irq  = IRQ_UARTINT2,
      .flags  = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
      .iotype  = UPIO_MEM,
      .regshift = 2,
      .uartclk = 27000000,
     },
    //_test:end
    #if 0
     {
      .flags  = 0
     },
    #endif
    };

    static void __init davinci_psc_init(void)
    {
     davinci_psc_config(DAVINCI_GPSC_ARMDOMAIN, DAVINCI_LPSC_VPSSMSTR, 1);
     davinci_psc_config(DAVINCI_GPSC_ARMDOMAIN, DAVINCI_LPSC_VPSSSLV, 1);
      davinci_psc_config(DAVINCI_GPSC_ARMDOMAIN, DAVINCI_LPSC_TPCC, 1);
     davinci_psc_config(DAVINCI_GPSC_ARMDOMAIN, DAVINCI_LPSC_TPTC0, 1);
     davinci_psc_config(DAVINCI_GPSC_ARMDOMAIN, DAVINCI_LPSC_TPTC1, 1);
     davinci_psc_config(DAVINCI_GPSC_ARMDOMAIN, DAVINCI_LPSC_GPIO, 1);
    #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
     davinci_psc_config(DAVINCI_GPSC_ARMDOMAIN, DAVINCI_LPSC_USB, 1);
    #endif

     /* Turn on WatchDog timer LPSC.  Needed for RESET to work */
     davinci_psc_config(DAVINCI_GPSC_ARMDOMAIN, DAVINCI_LPSC_TIMER2, 1);

     davinci_psc_config(DAVINCI_GPSC_ARMDOMAIN, DAVINCI_LPSC_UART1, 1); //_test
     davinci_psc_config(DAVINCI_GPSC_ARMDOMAIN, DAVINCI_LPSC_UART2, 1); //_test
    }

    ////////////////////////////////////// clock.c //////////////////////////////////////

    static struct clk davinci_dm644x_clks[] = {
     {
      .name = "ARMCLK",
      .rate = &armrate,
      .lpsc = -1,
      .flags = ALWAYS_ENABLED,
     },
     {
      .name = "UART0",
      .rate = &fixedrate,
      .lpsc = DAVINCI_LPSC_UART0,
     },
    //_test:start
     {
      .name = "UART1",
      .rate = &fixedrate,
      .lpsc = DAVINCI_LPSC_UART1,
     },
     {
      .name = "UART2",
      .rate = &fixedrate,
      .lpsc = DAVINCI_LPSC_UART2,
     },
    //_test:end

     {
      .name = "EMACCLK",
      .rate = &commonrate,
      .lpsc = DAVINCI_LPSC_EMAC_WRAPPER,
     },

     

    The following is boot logs.

    Serial: 8250/16550 driver $Revision: 1.90 $ 2 ports, IRQ sharing disabled
    serial8250.0: ttyS0 at MMIO map 0x1c20000 mem 0xfec20000 (irq = 40) is a 16550A
    serial8250.0: ttyS1 at MMIO map 0x1c20400 mem 0xfec20400 (irq = 41) is a 16550A
    serial8250 serial8250.0: unable to register port at index 2 (IO0 MEM1c20800 IRQ42): -28
    serial8250 serial8250.0: unable to register port at index 3 (IO0 MEM0 IRQ-1069947136): -28
    serial8250 serial8250.0: unable to register port at index 4 (IOc03ae4c0 MEMc039e584 IRQ1): -22

     

    I can see ttyS1 information. And tred test such as 'cat /dev/ttyS1'. It is possible to access, but  no signal. Would you give me some hint to solve this problem?