Lines Matching full:serial
3 * Edgeport USB Serial Converter driver
26 #include <linux/serial.h>
33 #include <linux/usb/serial.h>
40 #define DRIVER_DESC "Edgeport USB Serial Driver"
122 struct usb_serial *serial; member
228 static int do_download_mode(struct edgeport_serial *serial,
230 static int do_boot_mode(struct edgeport_serial *serial,
293 return ti_vread_sync(port->serial->dev, command, value, in read_port_cmd()
301 return ti_vsend_sync(port->serial->dev, command, value, in send_port_cmd()
381 static int read_boot_mem(struct edgeport_serial *serial, in read_boot_mem() argument
388 status = ti_vread_sync(serial->serial->dev, in read_boot_mem()
389 UMPC_MEMORY_READ, serial->TI_I2C_Type, in read_boot_mem()
392 dev_dbg(&serial->serial->dev->dev, "%s - ERROR %x\n", __func__, status); in read_boot_mem()
397 dev_dbg(&serial->serial->dev->dev, "%s - start_address = %x, length = %d\n", in read_boot_mem()
399 usb_serial_debug_data(&serial->serial->dev->dev, __func__, length, buffer); in read_boot_mem()
401 serial->TiReadI2C = 1; in read_boot_mem()
407 static int write_boot_mem(struct edgeport_serial *serial, in write_boot_mem() argument
415 if (!serial->TiReadI2C) { in write_boot_mem()
420 status = read_boot_mem(serial, 0, 1, temp); in write_boot_mem()
427 status = ti_vsend_sync(serial->serial->dev, UMPC_MEMORY_WRITE, in write_boot_mem()
434 …dev_dbg(&serial->serial->dev->dev, "%s - start_sddr = %x, length = %d\n", __func__, start_address,… in write_boot_mem()
435 usb_serial_debug_data(&serial->serial->dev->dev, __func__, length, buffer); in write_boot_mem()
441 static int write_i2c_mem(struct edgeport_serial *serial, in write_i2c_mem() argument
444 struct device *dev = &serial->serial->dev->dev; in write_i2c_mem()
469 status = ti_vsend_sync(serial->serial->dev, UMPC_MEMORY_WRITE, in write_i2c_mem()
502 status = ti_vsend_sync(serial->serial->dev, UMPC_MEMORY_WRITE, in write_i2c_mem()
545 status = read_ram(port->port->serial->dev, port->dma_address, in tx_active()
553 status = read_ram(port->port->serial->dev, in tx_active()
598 static int read_rom(struct edgeport_serial *serial, in read_rom() argument
603 if (serial->product_info.TiMode == TI_MODE_DOWNLOAD) { in read_rom()
604 status = read_download_mem(serial->serial->dev, in read_rom()
607 serial->TI_I2C_Type, in read_rom()
610 status = read_boot_mem(serial, start_address, length, in read_rom()
616 static int write_rom(struct edgeport_serial *serial, int start_address, in write_rom() argument
619 if (serial->product_info.TiMode == TI_MODE_BOOT) in write_rom()
620 return write_boot_mem(serial, start_address, length, in write_rom()
623 if (serial->product_info.TiMode == TI_MODE_DOWNLOAD) in write_rom()
624 return write_i2c_mem(serial, start_address, length, in write_rom()
625 serial->TI_I2C_Type, buffer); in write_rom()
630 static int get_descriptor_addr(struct edgeport_serial *serial, in get_descriptor_addr() argument
639 status = read_rom(serial, in get_descriptor_addr()
674 static int check_i2c_image(struct edgeport_serial *serial) in check_i2c_image() argument
676 struct device *dev = &serial->serial->dev->dev; in check_i2c_image()
694 status = read_rom(serial, 0, 1, buffer); in check_i2c_image()
706 status = read_rom(serial, in check_i2c_image()
727 status = read_rom(serial, start_address + in check_i2c_image()
754 static int get_manuf_info(struct edgeport_serial *serial, u8 *buffer) in get_manuf_info() argument
760 struct device *dev = &serial->serial->dev->dev; in get_manuf_info()
766 start_address = get_descriptor_addr(serial, I2C_DESC_TYPE_ION, in get_manuf_info()
776 status = read_rom(serial, start_address+sizeof(struct ti_i2c_desc), in get_manuf_info()
865 static int i2c_type_bootmode(struct edgeport_serial *serial) in i2c_type_bootmode() argument
867 struct device *dev = &serial->serial->dev->dev; in i2c_type_bootmode()
876 status = ti_vread_sync(serial->serial->dev, UMPC_MEMORY_READ, in i2c_type_bootmode()
884 serial->TI_I2C_Type = DTK_ADDR_SPACE_I2C_TYPE_II; in i2c_type_bootmode()
889 status = ti_vread_sync(serial->serial->dev, UMPC_MEMORY_READ, in i2c_type_bootmode()
897 serial->TI_I2C_Type = DTK_ADDR_SPACE_I2C_TYPE_III; in i2c_type_bootmode()
902 serial->TI_I2C_Type = DTK_ADDR_SPACE_I2C_TYPE_II; in i2c_type_bootmode()
909 static int bulk_xfer(struct usb_serial *serial, void *buffer, in bulk_xfer() argument
914 status = usb_bulk_msg(serial->dev, in bulk_xfer()
915 usb_sndbulkpipe(serial->dev, in bulk_xfer()
916 serial->port[0]->bulk_out_endpointAddress), in bulk_xfer()
922 static int download_code(struct edgeport_serial *serial, u8 *image, in download_code() argument
938 status = bulk_xfer(serial->serial, &image[pos], in download_code()
960 static int check_fw_sanity(struct edgeport_serial *serial, in check_fw_sanity() argument
966 struct device *dev = &serial->serial->interface->dev; in check_fw_sanity()
1001 static int download_fw(struct edgeport_serial *serial) in download_fw() argument
1003 struct device *dev = &serial->serial->interface->dev; in download_fw()
1017 if (check_fw_sanity(serial, fw)) { in download_fw()
1025 serial->fw_version = (fw_hdr->major_version << 8) + in download_fw()
1033 serial->product_info.hardware_type = HARDWARE_TYPE_TIUMP; in download_fw()
1036 serial->TI_I2C_Type = DTK_ADDR_SPACE_I2C_TYPE_II; in download_fw()
1038 status = choose_config(serial->serial->dev); in download_fw()
1042 interface = &serial->serial->interface->cur_altsetting->desc; in download_fw()
1055 serial->product_info.TiMode = TI_MODE_DOWNLOAD; in download_fw()
1056 status = do_download_mode(serial, fw); in download_fw()
1059 serial->product_info.TiMode = TI_MODE_CONFIGURING; in download_fw()
1060 status = do_boot_mode(serial, fw); in download_fw()
1068 static int do_download_mode(struct edgeport_serial *serial, in do_download_mode() argument
1071 struct device *dev = &serial->serial->interface->dev; in do_download_mode()
1082 status = check_i2c_image(serial); in do_download_mode()
1096 status = get_manuf_info(serial, (u8 *)ti_manuf_desc); in do_download_mode()
1117 start_address = get_descriptor_addr(serial, in do_download_mode()
1138 status = read_rom(serial, start_address + in do_download_mode()
1201 status = write_rom(serial, start_address, in do_download_mode()
1216 status = read_rom(serial, in do_download_mode()
1241 status = ti_vsend_sync(serial->serial->dev, in do_download_mode()
1257 serial->fw_version = download_cur_ver; in do_download_mode()
1262 start_address = get_descriptor_addr(serial, in do_download_mode()
1312 status = write_rom(serial, in do_download_mode()
1328 status = read_rom(serial, start_address, in do_download_mode()
1356 status = ti_vsend_sync(serial->serial->dev, in do_download_mode()
1380 static int do_boot_mode(struct edgeport_serial *serial, in do_boot_mode() argument
1383 struct device *dev = &serial->serial->interface->dev; in do_boot_mode()
1391 status = config_boot_dev(serial->serial->dev); in do_boot_mode()
1395 if (le16_to_cpu(serial->serial->dev->descriptor.idVendor) in do_boot_mode()
1398 le16_to_cpu(serial->serial->dev->descriptor.idVendor)); in do_boot_mode()
1399 serial->TI_I2C_Type = DTK_ADDR_SPACE_I2C_TYPE_II; in do_boot_mode()
1407 if (i2c_type_bootmode(serial)) in do_boot_mode()
1411 if (!check_i2c_image(serial)) { in do_boot_mode()
1426 status = get_manuf_info(serial, (u8 *)ti_manuf_desc); in do_boot_mode()
1483 status = download_code(serial, buffer, buffer_size); in do_boot_mode()
1493 serial->product_info.TiMode = TI_MODE_TRANSITIONING; in do_boot_mode()
1503 serial->product_info.TiMode = TI_MODE_BOOT; in do_boot_mode()
1657 dev = &edge_serial->serial->dev->dev; in edge_interrupt_callback()
1670 if (port_number >= edge_serial->serial->num_ports) { in edge_interrupt_callback()
1675 port = edge_serial->serial->port[port_number]; in edge_interrupt_callback()
1847 dev = port->serial->dev; in edge_open()
1921 urb = edge_serial->serial->port[0]->interrupt_in_urb; in edge_open()
1957 usb_kill_urb(port->serial->port[0]->interrupt_in_urb); in edge_open()
1969 edge_serial = usb_get_serial_data(port->serial); in edge_close()
1994 usb_kill_urb(port->serial->port[0]->interrupt_in_urb); in edge_close()
2455 struct edgeport_serial *serial; in edge_heartbeat_work() local
2458 serial = container_of(work, struct edgeport_serial, in edge_heartbeat_work()
2464 if (!rom_desc || !get_descriptor_addr(serial, I2C_DESC_TYPE_ION, in edge_heartbeat_work()
2466 dev_err(&serial->serial->interface->dev, in edge_heartbeat_work()
2471 edge_heartbeat_schedule(serial); in edge_heartbeat_work()
2474 static int edge_calc_num_ports(struct usb_serial *serial, in edge_calc_num_ports() argument
2477 struct device *dev = &serial->interface->dev; in edge_calc_num_ports()
2478 unsigned char num_ports = serial->type->num_ports; in edge_calc_num_ports()
2481 if (serial->interface->cur_altsetting->desc.bNumEndpoints > 1) { in edge_calc_num_ports()
2493 static int edge_startup(struct usb_serial *serial) in edge_startup() argument
2499 /* create our private serial structure */ in edge_startup()
2505 edge_serial->serial = serial; in edge_startup()
2507 usb_set_serial_data(serial, edge_serial); in edge_startup()
2519 edge_serial->serial->dev->descriptor.idProduct); in edge_startup()
2534 static void edge_disconnect(struct usb_serial *serial) in edge_disconnect() argument
2536 struct edgeport_serial *edge_serial = usb_get_serial_data(serial); in edge_disconnect()
2541 static void edge_release(struct usb_serial *serial) in edge_release() argument
2543 struct edgeport_serial *edge_serial = usb_get_serial_data(serial); in edge_release()
2560 edge_port->edge_serial = usb_get_serial_data(port->serial); in edge_port_probe()
2652 static int edge_suspend(struct usb_serial *serial, pm_message_t message) in edge_suspend() argument
2654 struct edgeport_serial *edge_serial = usb_get_serial_data(serial); in edge_suspend()
2661 static int edge_resume(struct usb_serial *serial) in edge_resume() argument
2663 struct edgeport_serial *edge_serial = usb_get_serial_data(serial); in edge_resume()