AnsweredAssumed Answered

RS485 support on iMX8 ?

Question asked by JIMMY CHEN on Aug 23, 2019
Latest reply on Aug 29, 2019 by Quang Phan

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=03895cf41d1890a219679490428c8bf10b17e2b9

Outcomes