Lines Matching full:serial

3  * F81532/F81534 USB to Serial Ports Bridge
5 * F81532 => 2 Serial Ports
6 * F81534 => 4 Serial Ports
13 * for all serial port TX and 1 endpoint bulk-in for all serial port read in
16 * Write URB is fixed with 512bytes, per serial port used 128Bytes.
19 * Read URB is 512Bytes max, per serial port used 128Bytes.
28 #include <linux/usb/serial.h>
33 /* Serial Port register Address */
193 static int f81534_logic_to_phy_port(struct usb_serial *serial, in f81534_logic_to_phy_port() argument
197 usb_get_serial_data(port->serial); in f81534_logic_to_phy_port()
214 static int f81534_set_register(struct usb_serial *serial, u16 reg, u8 data) in f81534_set_register() argument
216 struct usb_interface *interface = serial->interface; in f81534_set_register()
217 struct usb_device *dev = serial->dev; in f81534_set_register()
253 static int f81534_get_register(struct usb_serial *serial, u16 reg, u8 *data) in f81534_get_register() argument
255 struct usb_interface *interface = serial->interface; in f81534_get_register()
256 struct usb_device *dev = serial->dev; in f81534_get_register()
296 static int f81534_set_mask_register(struct usb_serial *serial, u16 reg, in f81534_set_mask_register() argument
302 status = f81534_get_register(serial, reg, &tmp); in f81534_set_mask_register()
309 return f81534_set_register(serial, reg, tmp); in f81534_set_mask_register()
312 static int f81534_set_phy_port_register(struct usb_serial *serial, int phy, in f81534_set_phy_port_register() argument
315 return f81534_set_register(serial, reg + F81534_UART_OFFSET * phy, in f81534_set_phy_port_register()
319 static int f81534_get_phy_port_register(struct usb_serial *serial, int phy, in f81534_get_phy_port_register() argument
322 return f81534_get_register(serial, reg + F81534_UART_OFFSET * phy, in f81534_get_phy_port_register()
331 return f81534_set_register(port->serial, in f81534_set_port_register()
340 return f81534_get_register(port->serial, in f81534_get_port_register()
348 static int f81534_wait_for_spi_idle(struct usb_serial *serial) in f81534_wait_for_spi_idle() argument
355 status = f81534_get_register(serial, F81534_BUS_REG_STATUS, in f81534_wait_for_spi_idle()
369 dev_err(&serial->interface->dev, in f81534_wait_for_spi_idle()
375 return f81534_set_register(serial, F81534_BUS_REG_STATUS, in f81534_wait_for_spi_idle()
379 static int f81534_get_spi_register(struct usb_serial *serial, u16 reg, in f81534_get_spi_register() argument
384 status = f81534_get_register(serial, reg, data); in f81534_get_spi_register()
388 return f81534_wait_for_spi_idle(serial); in f81534_get_spi_register()
391 static int f81534_set_spi_register(struct usb_serial *serial, u16 reg, u8 data) in f81534_set_spi_register() argument
395 status = f81534_set_register(serial, reg, data); in f81534_set_spi_register()
399 return f81534_wait_for_spi_idle(serial); in f81534_set_spi_register()
402 static int f81534_read_flash(struct usb_serial *serial, u32 address, in f81534_read_flash() argument
413 status = f81534_set_spi_register(serial, F81534_BUS_REG_START, in f81534_read_flash()
418 status = f81534_set_spi_register(serial, F81534_BUS_REG_START, in f81534_read_flash()
423 status = f81534_set_spi_register(serial, F81534_BUS_REG_START, in f81534_read_flash()
428 status = f81534_set_spi_register(serial, F81534_BUS_REG_START, in f81534_read_flash()
449 status = f81534_set_spi_register(serial, reg_tmp, in f81534_read_flash()
454 status = f81534_get_spi_register(serial, in f81534_read_flash()
482 * index 2: serial TX out length in f81534_prepare_write_buffer()
484 * index 4~127: serial out data block in f81534_prepare_write_buffer()
733 static int f81534_find_config_idx(struct usb_serial *serial, u8 *index) in f81534_find_config_idx() argument
738 status = f81534_read_flash(serial, F81534_CUSTOM_ADDRESS_START, 1, in f81534_find_config_idx()
741 dev_err(&serial->interface->dev, "%s: read failed: %d\n", in f81534_find_config_idx()
756 * The F81532/534 will not report serial port to USB serial subsystem when
762 static bool f81534_check_port_hw_disabled(struct usb_serial *serial, int phy) in f81534_check_port_hw_disabled() argument
772 status = f81534_get_phy_port_register(serial, phy, in f81534_check_port_hw_disabled()
780 status = f81534_set_phy_port_register(serial, phy, in f81534_check_port_hw_disabled()
786 status = f81534_get_phy_port_register(serial, phy, in f81534_check_port_hw_disabled()
791 status = f81534_set_phy_port_register(serial, phy, in f81534_check_port_hw_disabled()
796 status = f81534_set_phy_port_register(serial, phy, in f81534_check_port_hw_disabled()
803 status = f81534_get_phy_port_register(serial, phy, in f81534_check_port_hw_disabled()
808 status = f81534_set_phy_port_register(serial, phy, in f81534_check_port_hw_disabled()
837 static int f81534_calc_num_ports(struct usb_serial *serial, in f81534_calc_num_ports() argument
841 struct device *dev = &serial->interface->dev; in f81534_calc_num_ports()
855 serial_priv = devm_kzalloc(&serial->interface->dev, in f81534_calc_num_ports()
860 usb_set_serial_data(serial, serial_priv); in f81534_calc_num_ports()
864 status = f81534_find_config_idx(serial, &serial_priv->setting_idx); in f81534_calc_num_ports()
866 dev_err(&serial->interface->dev, "%s: find idx failed: %d\n", in f81534_calc_num_ports()
876 status = f81534_read_flash(serial, in f81534_calc_num_ports()
882 dev_err(&serial->interface->dev, in f81534_calc_num_ports()
888 dev_dbg(&serial->interface->dev, in f81534_calc_num_ports()
893 status = f81534_read_flash(serial, in f81534_calc_num_ports()
898 dev_err(&serial->interface->dev, in f81534_calc_num_ports()
904 dev_dbg(&serial->interface->dev, "%s: read default config\n", in f81534_calc_num_ports()
910 if (f81534_check_port_hw_disabled(serial, i)) in f81534_calc_num_ports()
920 dev_warn(&serial->interface->dev, in f81534_calc_num_ports()
931 dev_dbg(&serial->interface->dev, in f81534_calc_num_ports()
997 static int f81534_submit_read_urb(struct usb_serial *serial, gfp_t flags) in f81534_submit_read_urb() argument
999 return usb_serial_generic_submit_read_urbs(serial->port[0], flags); in f81534_submit_read_urb()
1069 usb_get_serial_data(port->serial); in f81534_open()
1093 status = f81534_submit_read_urb(port->serial, GFP_KERNEL); in f81534_open()
1110 usb_get_serial_data(port->serial); in f81534_close()
1111 struct usb_serial_port *port0 = port->serial->port[0]; in f81534_close()
1161 * index 2: serial in size (data+lsr, must be even) in f81534_process_per_serial_block()
1164 * index 4~127: serial in data block (data+lsr, must be even) in f81534_process_per_serial_block()
1239 struct usb_serial *serial; in f81534_process_read_urb() local
1251 serial = port->serial; in f81534_process_read_urb()
1253 serial_priv = usb_get_serial_data(serial); in f81534_process_read_urb()
1265 port = serial->port[tty_port_num]; in f81534_process_read_urb()
1315 struct usb_serial *serial; in f81534_set_port_output_pin() local
1322 serial = port->serial; in f81534_set_port_output_pin()
1323 serial_priv = usb_get_serial_data(serial); in f81534_set_port_output_pin()
1342 status = f81534_set_mask_register(serial, in f81534_set_port_output_pin()
1360 serial_priv = usb_get_serial_data(port->serial); in f81534_port_probe()
1376 ret = f81534_logic_to_phy_port(port->serial, port); in f81534_port_probe()
1496 static int f81534_resume(struct usb_serial *serial) in f81534_resume() argument
1499 usb_get_serial_data(serial); in f81534_resume()
1512 status = f81534_submit_read_urb(serial, GFP_NOIO); in f81534_resume()
1521 for (i = 0; i < serial->num_ports; i++) { in f81534_resume()
1522 port = serial->port[i]; in f81534_resume()