]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blobdiff - ubuntu/xr-usb-serial/xr_usb_serial_hal.c
UBUNTU: SAUCE: xr-usb-serial: interface for switching modes
[mirror_ubuntu-jammy-kernel.git] / ubuntu / xr-usb-serial / xr_usb_serial_hal.c
index 0fcc580002bdbb06387c0e52f1ca015d907707b3..f44970995368071b19faf676ec1bc75f1fc36500 100644 (file)
@@ -479,8 +479,15 @@ int xr_usb_serial_set_line(struct xr_usb_serial *xr_usb_serial, struct usb_cdc_l
            flow      = UART_FLOW_MODE_NONE;
            gpio_mode = UART_GPIO_MODE_SEL_GPIO;
        }
-    xr_usb_serial_set_reg(xr_usb_serial, xr_usb_serial->reg_map.uart_flow_addr, flow);
-    xr_usb_serial_set_reg(xr_usb_serial, xr_usb_serial->reg_map.uart_gpio_mode_addr, gpio_mode);
+       // rs485,rs422 FD/HD mode
+       if (xr_usb_serial->rs485_422_en) {
+               xr_usb_serial_set_reg(xr_usb_serial, xr_usb_serial->reg_map.uart_flow_addr, 0x00);
+               xr_usb_serial_set_reg(xr_usb_serial, xr_usb_serial->reg_map.uart_gpio_mode_addr, 0x0B);
+       } else {
+               //rs232, default mode
+               xr_usb_serial_set_reg(xr_usb_serial, xr_usb_serial->reg_map.uart_flow_addr, flow);
+               xr_usb_serial_set_reg(xr_usb_serial, xr_usb_serial->reg_map.uart_gpio_mode_addr, gpio_mode);
+       }
        return 0;