RS485 support on iMX8 ?

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

RS485 support on iMX8 ?

3,455 Views
weikeng-jimmy
Contributor III

i Sir,

We will enable RS-485 function for imx8. I can see tty patch (fsl_lpuart.c) already add support for RD-485.

But lpuart probe not setting rs485 config when "lpuart_is_32(sport)" always is ture. RS485 support on iMX8 ?

// drivers/tty/serial/fsl_lpuart.c

 

static struct lpuart_soc_data imx_data = {

        .iotype = UPIO_MEM32,

        .reg_off = IMX_REG_OFF,

};

 

static const struct of_device_id lpuart_dt_ids[] = {
{ .compatible = "fsl,imx8qm-lpuart", .data = &imx_data, },
{ /* sentinel */ }
};

static bool lpuart_is_32(struct lpuart_port *sport)
{
return sport->port.iotype == UPIO_MEM32 ||
sport->port.iotype == UPIO_MEM32BE;
}

static int lpuart_probe(struct platform_device *pdev)
{
if (!lpuart_is_32(sport))
sport->port.rs485_config = lpuart_config_rs485;

if (!lpuart_is_32(sport) &&
of_property_read_bool(np, "linux,rs485-enabled-at-boot-time")) {
sport->port.rs485.flags |= SER_RS485_ENABLED;
sport->port.rs485.flags |= SER_RS485_RTS_ON_SEND;
writeb(UARTMODEM_TXRTSE, sport->port.membase + UARTMODEM);
}

https://source.codeaurora.org/external/imx/linux-imx/commit/?h=imx_4.14.98_2.0.0_ga&id=03895cf41d189...

Tags (2)
3 Replies

2,306 Views
YCYao
Contributor I

I'm facing the same problem of rs485 support on imx8mm with yocto linux 4.14.98.

Why the imx8 doesn't support rs485?

Where should I patch if I need to enable rs485 ?  Just change the iotype to UPIO_PORT or something else ?

 

Thanks,

Yao

0 Kudos

2,826 Views
igorpadykov
NXP Employee
NXP Employee

Hi JIMMY

you are right, "lpuart_is_32(sport)" is always true in fsl_lpuart.c:
imx_data = {..    .iotype = UPIO_MEM32,
fsl_lpuart.c\serial\tty\drivers - linux-imx - i.MX Linux kernel 
so RS485 not supported on iMX8.

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

2,826 Views
qphan
Contributor II

Hi igor,

I have an IMX8M Mini processor that I would also like to use RS-485 on the linux side.  Base on your answer below, RS485 is currently not supported on the IMX8 family chip on Yocto Linux.  Is it not possible to enable RS-485 support on the linux kernel for IMX8M? I can see in the reference manual of the IMX8M and IMX8M mini that it does supports RS-485.

Thanks,

Quang

0 Kudos