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"
124 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,
309 return send_cmd(port->serial->dev, in purge_port()
382 static int read_boot_mem(struct edgeport_serial *serial, in read_boot_mem() argument
389 status = ti_vread_sync(serial->serial->dev, in read_boot_mem()
390 UMPC_MEMORY_READ, serial->TI_I2C_Type, in read_boot_mem()
393 dev_dbg(&serial->serial->dev->dev, "%s - ERROR %x\n", __func__, status); in read_boot_mem()
398 dev_dbg(&serial->serial->dev->dev, "%s - start_address = %x, length = %d\n", in read_boot_mem()
400 usb_serial_debug_data(&serial->serial->dev->dev, __func__, length, buffer); in read_boot_mem()
402 serial->TiReadI2C = 1; in read_boot_mem()
408 static int write_boot_mem(struct edgeport_serial *serial, in write_boot_mem() argument
416 if (!serial->TiReadI2C) { in write_boot_mem()
421 status = read_boot_mem(serial, 0, 1, temp); in write_boot_mem()
428 status = ti_vsend_sync(serial->serial->dev, UMPC_MEMORY_WRITE, in write_boot_mem()
435 …dev_dbg(&serial->serial->dev->dev, "%s - start_sddr = %x, length = %d\n", __func__, start_address,… in write_boot_mem()
436 usb_serial_debug_data(&serial->serial->dev->dev, __func__, length, buffer); in write_boot_mem()
442 static int write_i2c_mem(struct edgeport_serial *serial, in write_i2c_mem() argument
445 struct device *dev = &serial->serial->dev->dev; in write_i2c_mem()
470 status = ti_vsend_sync(serial->serial->dev, UMPC_MEMORY_WRITE, in write_i2c_mem()
503 status = ti_vsend_sync(serial->serial->dev, UMPC_MEMORY_WRITE, in write_i2c_mem()
546 status = read_ram(port->port->serial->dev, port->dma_address, in tx_active()
554 status = read_ram(port->port->serial->dev, in tx_active()
599 static int read_rom(struct edgeport_serial *serial, in read_rom() argument
604 if (serial->product_info.TiMode == TI_MODE_DOWNLOAD) { in read_rom()
605 status = read_download_mem(serial->serial->dev, in read_rom()
608 serial->TI_I2C_Type, in read_rom()
611 status = read_boot_mem(serial, start_address, length, in read_rom()
617 static int write_rom(struct edgeport_serial *serial, int start_address, in write_rom() argument
620 if (serial->product_info.TiMode == TI_MODE_BOOT) in write_rom()
621 return write_boot_mem(serial, start_address, length, in write_rom()
624 if (serial->product_info.TiMode == TI_MODE_DOWNLOAD) in write_rom()
625 return write_i2c_mem(serial, start_address, length, in write_rom()
626 serial->TI_I2C_Type, buffer); in write_rom()
631 static int get_descriptor_addr(struct edgeport_serial *serial, in get_descriptor_addr() argument
640 status = read_rom(serial, in get_descriptor_addr()
675 static int check_i2c_image(struct edgeport_serial *serial) in check_i2c_image() argument
677 struct device *dev = &serial->serial->dev->dev; in check_i2c_image()
695 status = read_rom(serial, 0, 1, buffer); in check_i2c_image()
707 status = read_rom(serial, in check_i2c_image()
728 status = read_rom(serial, start_address + in check_i2c_image()
755 static int get_manuf_info(struct edgeport_serial *serial, __u8 *buffer) in get_manuf_info() argument
761 struct device *dev = &serial->serial->dev->dev; in get_manuf_info()
767 start_address = get_descriptor_addr(serial, I2C_DESC_TYPE_ION, in get_manuf_info()
777 status = read_rom(serial, start_address+sizeof(struct ti_i2c_desc), in get_manuf_info()
866 static int i2c_type_bootmode(struct edgeport_serial *serial) in i2c_type_bootmode() argument
868 struct device *dev = &serial->serial->dev->dev; in i2c_type_bootmode()
877 status = ti_vread_sync(serial->serial->dev, UMPC_MEMORY_READ, in i2c_type_bootmode()
885 serial->TI_I2C_Type = DTK_ADDR_SPACE_I2C_TYPE_II; in i2c_type_bootmode()
890 status = ti_vread_sync(serial->serial->dev, UMPC_MEMORY_READ, in i2c_type_bootmode()
898 serial->TI_I2C_Type = DTK_ADDR_SPACE_I2C_TYPE_III; in i2c_type_bootmode()
903 serial->TI_I2C_Type = DTK_ADDR_SPACE_I2C_TYPE_II; in i2c_type_bootmode()
910 static int bulk_xfer(struct usb_serial *serial, void *buffer, in bulk_xfer() argument
915 status = usb_bulk_msg(serial->dev, in bulk_xfer()
916 usb_sndbulkpipe(serial->dev, in bulk_xfer()
917 serial->port[0]->bulk_out_endpointAddress), in bulk_xfer()
923 static int download_code(struct edgeport_serial *serial, __u8 *image, in download_code() argument
939 status = bulk_xfer(serial->serial, &image[pos], in download_code()
961 static int check_fw_sanity(struct edgeport_serial *serial, in check_fw_sanity() argument
967 struct device *dev = &serial->serial->interface->dev; in check_fw_sanity()
1002 static int download_fw(struct edgeport_serial *serial) in download_fw() argument
1004 struct device *dev = &serial->serial->interface->dev; in download_fw()
1018 if (check_fw_sanity(serial, fw)) { in download_fw()
1026 serial->fw_version = (fw_hdr->major_version << 8) + in download_fw()
1034 serial->product_info.hardware_type = HARDWARE_TYPE_TIUMP; in download_fw()
1037 serial->TI_I2C_Type = DTK_ADDR_SPACE_I2C_TYPE_II; in download_fw()
1039 status = choose_config(serial->serial->dev); in download_fw()
1043 interface = &serial->serial->interface->cur_altsetting->desc; in download_fw()
1056 serial->product_info.TiMode = TI_MODE_DOWNLOAD; in download_fw()
1057 status = do_download_mode(serial, fw); in download_fw()
1060 serial->product_info.TiMode = TI_MODE_CONFIGURING; in download_fw()
1061 status = do_boot_mode(serial, fw); in download_fw()
1069 static int do_download_mode(struct edgeport_serial *serial, in do_download_mode() argument
1072 struct device *dev = &serial->serial->interface->dev; in do_download_mode()
1083 status = check_i2c_image(serial); in do_download_mode()
1097 status = get_manuf_info(serial, (__u8 *)ti_manuf_desc); in do_download_mode()
1118 start_address = get_descriptor_addr(serial, in do_download_mode()
1139 status = read_rom(serial, start_address + in do_download_mode()
1202 status = write_rom(serial, start_address, in do_download_mode()
1217 status = read_rom(serial, in do_download_mode()
1242 status = ti_vsend_sync(serial->serial->dev, in do_download_mode()
1258 serial->fw_version = download_cur_ver; in do_download_mode()
1263 start_address = get_descriptor_addr(serial, in do_download_mode()
1313 status = write_rom(serial, in do_download_mode()
1329 status = read_rom(serial, start_address, in do_download_mode()
1357 status = ti_vsend_sync(serial->serial->dev, in do_download_mode()
1381 static int do_boot_mode(struct edgeport_serial *serial, in do_boot_mode() argument
1384 struct device *dev = &serial->serial->interface->dev; in do_boot_mode()
1392 status = config_boot_dev(serial->serial->dev); in do_boot_mode()
1396 if (le16_to_cpu(serial->serial->dev->descriptor.idVendor) in do_boot_mode()
1399 le16_to_cpu(serial->serial->dev->descriptor.idVendor)); in do_boot_mode()
1400 serial->TI_I2C_Type = DTK_ADDR_SPACE_I2C_TYPE_II; in do_boot_mode()
1408 if (i2c_type_bootmode(serial)) in do_boot_mode()
1412 if (!check_i2c_image(serial)) { in do_boot_mode()
1427 status = get_manuf_info(serial, (__u8 *)ti_manuf_desc); in do_boot_mode()
1484 status = download_code(serial, buffer, buffer_size); in do_boot_mode()
1494 serial->product_info.TiMode = TI_MODE_TRANSITIONING; in do_boot_mode()
1504 serial->product_info.TiMode = TI_MODE_BOOT; in do_boot_mode()
1514 return send_cmd(port->port->serial->dev, in ti_do_config()
1661 dev = &edge_serial->serial->dev->dev; in edge_interrupt_callback()
1674 if (port_number >= edge_serial->serial->num_ports) { in edge_interrupt_callback()
1679 port = edge_serial->serial->port[port_number]; in edge_interrupt_callback()
1854 dev = port->serial->dev; in edge_open()
1932 urb = edge_serial->serial->port[0]->interrupt_in_urb; in edge_open()
1968 usb_kill_urb(port->serial->port[0]->interrupt_in_urb); in edge_open()
1978 struct usb_serial *serial = port->serial; in edge_close() local
1982 edge_serial = usb_get_serial_data(port->serial); in edge_close()
2002 send_cmd(serial->dev, UMPC_CLOSE_PORT, in edge_close()
2009 usb_kill_urb(port->serial->port[0]->interrupt_in_urb); in edge_close()
2362 status = send_cmd(edge_port->port->serial->dev, UMPC_SET_CONFIG, in change_port_settings()
2488 struct edgeport_serial *serial; in edge_heartbeat_work() local
2491 serial = container_of(work, struct edgeport_serial, in edge_heartbeat_work()
2497 if (!rom_desc || !get_descriptor_addr(serial, I2C_DESC_TYPE_ION, in edge_heartbeat_work()
2499 dev_err(&serial->serial->interface->dev, in edge_heartbeat_work()
2504 edge_heartbeat_schedule(serial); in edge_heartbeat_work()
2507 static int edge_calc_num_ports(struct usb_serial *serial, in edge_calc_num_ports() argument
2510 struct device *dev = &serial->interface->dev; in edge_calc_num_ports()
2511 unsigned char num_ports = serial->type->num_ports; in edge_calc_num_ports()
2514 if (serial->interface->cur_altsetting->desc.bNumEndpoints > 1) { in edge_calc_num_ports()
2526 static int edge_startup(struct usb_serial *serial) in edge_startup() argument
2532 /* create our private serial structure */ in edge_startup()
2538 edge_serial->serial = serial; in edge_startup()
2540 usb_set_serial_data(serial, edge_serial); in edge_startup()
2552 edge_serial->serial->dev->descriptor.idProduct); in edge_startup()
2567 static void edge_disconnect(struct usb_serial *serial) in edge_disconnect() argument
2569 struct edgeport_serial *edge_serial = usb_get_serial_data(serial); in edge_disconnect()
2574 static void edge_release(struct usb_serial *serial) in edge_release() argument
2576 struct edgeport_serial *edge_serial = usb_get_serial_data(serial); in edge_release()
2593 edge_port->edge_serial = usb_get_serial_data(port->serial); in edge_port_probe()
2684 static int edge_suspend(struct usb_serial *serial, pm_message_t message) in edge_suspend() argument
2686 struct edgeport_serial *edge_serial = usb_get_serial_data(serial); in edge_suspend()
2693 static int edge_resume(struct usb_serial *serial) in edge_resume() argument
2695 struct edgeport_serial *edge_serial = usb_get_serial_data(serial); in edge_resume()