Hi,

> Add support for RS485 tranceiver with transmit/receive switch hooked
> to the DTR GPIO.
          ^
now it's RTS, but it could be whatever (ditto with subject).

This should probably be "serial: ar933x_uart: add rs485 support" and taken
through upstream to get more eyes on this.

> This is how RS485 is implemented on the Teltonika

Which doesn't mean, that it's upstream material.

> + static inline void ar933x_uart_putc(struct ar933x_uart_port *up, int ch)
> + {
> +     unsigned int rdata;
> ++    struct serial_rs485 rs485conf = up->port.rs485;
> + 
> +     rdata = ch & AR933X_UART_DATA_TX_RX_MASK;
> +     rdata |= AR933X_UART_DATA_TX_CSR;
> +-    ar933x_uart_write(up, AR933X_UART_DATA_REG, rdata);

        if (unlikely(rs485conf.flags & SER_RS485_ENABLED)) {
                ar933x_rs485_putc(up, rdata);
                return;
        }

        ar933x_uart_write(up, AR933X_UART_DATA_REG, rdata);
}

> ++            struct gpio_desc *rts_gpio = mctrl_gpio_to_gpiod(up->gpios, 
> UART_GPIO_RTS);

No need for this, just use mctrl_gpio_set and you probably dont want to do
this each time for every byte.

> ++            if (!IS_ERR_OR_NULL(rts_gpio))
> ++                    gpiod_set_value(rts_gpio, !!(rs485conf.flags & 
> SER_RS485_RTS_ON_SEND));

This should be probably handled in ar933x_uart_set_mctrl and with 
mctrl_gpio_set.

-- ynezz

_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to