imx6q,16c554 and device tree

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

imx6q,16c554 and device tree

2,327 Views
fangxu
Contributor I

I use 16c554 on imx6q,and I have a problem.

In linux 3.0.35,I add 16c554 information to board-mx6q_sabresd.c below. and it worked ok.

---------------------------

static struct plat_serial8250_port imx6_st16c554[] = {

    {    //st16c554_uart0

    .membase    =    NULL,

    .mapbase    =    0x0c004000,

    .irq        =    gpio_to_irq(IMX_GPIO_NR(2,14)),

    .uartclk    =    18432000,

    .regshift    =    0,

    .iotype        =    UPIO_MEM,

    .flags        =    UPF_IOREMAP,

    },

    {    //st16c554_uart1

    .membase    =    NULL,

    .mapbase    =    0x0c004010,

    .irq        =    gpio_to_irq(IMX_GPIO_NR(1,17)),

    .uartclk    =    18432000,

    .regshift    =    0,

    .iotype        =    UPIO_MEM,

    .flags        =    UPF_IOREMAP,

    },

    {    //st16c554_uart2

    .membase    =    NULL,

    .mapbase    =    0x0c004020,

    .irq        =    gpio_to_irq(IMX_GPIO_NR(2,11)),

    .uartclk    =    18432000,

    .regshift    =    0,

    .iotype        =    UPIO_MEM,

    .flags        =    UPF_IOREMAP,

    },

    {    //st16c554_uart3

    .membase    =    NULL,

    .mapbase    =    0x0c004030,

    .irq        =    gpio_to_irq(IMX_GPIO_NR(2,9)),

    .uartclk    =    18432000,

    .regshift    =    0,

    .iotype        =    UPIO_MEM,

    .flags        =    UPF_IOREMAP,

    },

    {},

};

static struct platform_device imx6_device_st16c554 = {

    .name        =    "ST16C554",

    .id        =    0,

    .dev        ={

        .platform_data    =    &imx6_st16c554,

    },

};

-------------------------------------

when I use linux 3.10.17,how I add the information above into device tree(imx6qdl-sabreauto.dtsi).

0 Kudos
5 Replies

966 Views
mahendrakumar_a
Contributor II

We have a similar kind of board, where we have to interact with EXAR_ST16C2550 from imx6dl. 

Do you have the weim settings for your chip?

0 Kudos

966 Views
fabio_estevam
NXP Employee
NXP Employee

You can find an example on how another 8250 serial port is connected to the weim port:

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/arm/boot/dts/imx27-eukrea-...

Then you could add 16c554 into the list of supported compatible strings at:

drivers/tty/serial/of_serial.c

Hope this helps.

966 Views
fangxu
Contributor I

thank you for help

0 Kudos

966 Views
fangxu
Contributor I

the problem had done,but i did not use device tree.I used drivers/tty/serial/8250/8250_exar_st16c554.c

------------------------------

#include <linux/module.h>

#include <linux/init.h>

#include <linux/serial_8250.h>

#define CS1_BASE        0x0c000000    //64M+32M+32M+0  

#define CARD1_BASE        CS1_BASE + 0x00004000

#define CARD2_BASE        CS1_BASE + 0x00005000

#define CARD3_BASE        CS1_BASE + 0x00006000

#define CARD4_BASE        CS1_BASE + 0x00007000

#define CARD5_BASE        CS1_BASE + 0x00008000

#define    PHY_ST16C554_UART0    CARD1_BASE

#define    PHY_ST16C554_UART1    CARD1_BASE + 0x10

#define    PHY_ST16C554_UART2    CARD1_BASE + 0x20

#define    PHY_ST16C554_UART3    CARD1_BASE + 0x30

#define PORT(_base,_irq)                \

    {                        \

        .membase    = NULL,            \

        .mapbase    = _base,        \

        .irq        = _irq,            \

        .uartclk    = 1843200,        \

        .regshift    = 0,            \

        .iotype        = UPIO_MEM,        \

        .flags        = (UPF_BOOT_AUTOCONF |UPF_IOREMAP),        \

    }

static struct plat_serial8250_port exar_data[] = {

    PORT(PHY_ST16C554_UART0, 302),

    PORT(PHY_ST16C554_UART1, 273),

    PORT(PHY_ST16C554_UART2, 297),

    PORT(PHY_ST16C554_UART3, 299),

    { },

};

static struct platform_device exar_device = {

    .name            = "ST16C554",

    .id            = PLAT8250_DEV_EXAR_ST16C554,

    .dev            = {

        .platform_data    = exar_data,

    },

};

static int __init exar_init(void)

{

    return platform_device_register(&exar_device);

}

module_init(exar_init);

MODULE_AUTHOR("Paul B Schroeder");

MODULE_DESCRIPTION("8250 serial probe module for Exar cards");

MODULE_LICENSE("GPL");

---------------------------------------

and I inited the interrupts and bus time in 8250_core.c

0 Kudos

966 Views
alejandrolozan1
NXP Employee
NXP Employee

Hi,

I have checked if we have something similar that can help, but I did not find anything.

The problem here is that even though tehera re strict conventions, there is no rigid rule about what and how to use the device tree. Any routine in the kernel may loop up any parameter in the device tree.

It is your choice what to use and how to use it.

I recommend you to take a look at : Device Tree Usage - FDTWiki

Please notice that the most important part it is the .compatible property becuase it is the connections to the kernel driver.

Best Regards,

Alejandro