RS485 support on iMX8 ?

cancel
Showing results for 
Search instead for 
Did you mean: 

RS485 support on iMX8 ?

815 Views
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)
2 Replies

186 Views
NXP TechSupport
NXP TechSupport

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

186 Views
Contributor I

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