Lines Matching refs:serial
26 #include <linux/serial.h>
33 #include <linux/usb/serial.h>
124 struct usb_serial *serial;
230 static int do_download_mode(struct edgeport_serial *serial,
232 static int do_boot_mode(struct edgeport_serial *serial,
311 return send_cmd(port->serial->dev,
384 static int read_boot_mem(struct edgeport_serial *serial,
391 status = ti_vread_sync(serial->serial->dev,
392 UMPC_MEMORY_READ, serial->TI_I2C_Type,
395 dev_dbg(&serial->serial->dev->dev, "%s - ERROR %x\n", __func__, status);
400 dev_dbg(&serial->serial->dev->dev, "%s - start_address = %x, length = %d\n",
402 usb_serial_debug_data(&serial->serial->dev->dev, __func__, length, buffer);
404 serial->TiReadI2C = 1;
410 static int write_boot_mem(struct edgeport_serial *serial,
418 if (!serial->TiReadI2C) {
423 status = read_boot_mem(serial, 0, 1, temp);
430 status = ti_vsend_sync(serial->serial->dev, UMPC_MEMORY_WRITE,
437 dev_dbg(&serial->serial->dev->dev, "%s - start_sddr = %x, length = %d\n", __func__, start_address, length);
438 usb_serial_debug_data(&serial->serial->dev->dev, __func__, length, buffer);
444 static int write_i2c_mem(struct edgeport_serial *serial,
447 struct device *dev = &serial->serial->dev->dev;
472 status = ti_vsend_sync(serial->serial->dev, UMPC_MEMORY_WRITE,
505 status = ti_vsend_sync(serial->serial->dev, UMPC_MEMORY_WRITE,
548 status = read_ram(port->port->serial->dev, port->dma_address,
556 status = read_ram(port->port->serial->dev,
601 static int read_rom(struct edgeport_serial *serial,
606 if (serial->product_info.TiMode == TI_MODE_DOWNLOAD) {
607 status = read_download_mem(serial->serial->dev,
610 serial->TI_I2C_Type,
613 status = read_boot_mem(serial, start_address, length,
619 static int write_rom(struct edgeport_serial *serial, int start_address,
622 if (serial->product_info.TiMode == TI_MODE_BOOT)
623 return write_boot_mem(serial, start_address, length,
626 if (serial->product_info.TiMode == TI_MODE_DOWNLOAD)
627 return write_i2c_mem(serial, start_address, length,
628 serial->TI_I2C_Type, buffer);
633 static int get_descriptor_addr(struct edgeport_serial *serial,
642 status = read_rom(serial,
677 static int check_i2c_image(struct edgeport_serial *serial)
679 struct device *dev = &serial->serial->dev->dev;
697 status = read_rom(serial, 0, 1, buffer);
709 status = read_rom(serial,
730 status = read_rom(serial, start_address +
757 static int get_manuf_info(struct edgeport_serial *serial, __u8 *buffer)
763 struct device *dev = &serial->serial->dev->dev;
769 start_address = get_descriptor_addr(serial, I2C_DESC_TYPE_ION,
779 status = read_rom(serial, start_address+sizeof(struct ti_i2c_desc),
868 static int i2c_type_bootmode(struct edgeport_serial *serial)
870 struct device *dev = &serial->serial->dev->dev;
879 status = ti_vread_sync(serial->serial->dev, UMPC_MEMORY_READ,
887 serial->TI_I2C_Type = DTK_ADDR_SPACE_I2C_TYPE_II;
892 status = ti_vread_sync(serial->serial->dev, UMPC_MEMORY_READ,
900 serial->TI_I2C_Type = DTK_ADDR_SPACE_I2C_TYPE_III;
905 serial->TI_I2C_Type = DTK_ADDR_SPACE_I2C_TYPE_II;
912 static int bulk_xfer(struct usb_serial *serial, void *buffer,
917 status = usb_bulk_msg(serial->dev,
918 usb_sndbulkpipe(serial->dev,
919 serial->port[0]->bulk_out_endpointAddress),
925 static int download_code(struct edgeport_serial *serial, __u8 *image,
941 status = bulk_xfer(serial->serial, &image[pos],
963 static int check_fw_sanity(struct edgeport_serial *serial,
969 struct device *dev = &serial->serial->interface->dev;
1004 static int download_fw(struct edgeport_serial *serial)
1006 struct device *dev = &serial->serial->interface->dev;
1020 if (check_fw_sanity(serial, fw)) {
1028 serial->fw_version = (fw_hdr->major_version << 8) +
1036 serial->product_info.hardware_type = HARDWARE_TYPE_TIUMP;
1039 serial->TI_I2C_Type = DTK_ADDR_SPACE_I2C_TYPE_II;
1041 status = choose_config(serial->serial->dev);
1045 interface = &serial->serial->interface->cur_altsetting->desc;
1058 serial->product_info.TiMode = TI_MODE_DOWNLOAD;
1059 status = do_download_mode(serial, fw);
1062 serial->product_info.TiMode = TI_MODE_CONFIGURING;
1063 status = do_boot_mode(serial, fw);
1071 static int do_download_mode(struct edgeport_serial *serial,
1074 struct device *dev = &serial->serial->interface->dev;
1085 status = check_i2c_image(serial);
1099 status = get_manuf_info(serial, (__u8 *)ti_manuf_desc);
1120 start_address = get_descriptor_addr(serial,
1141 status = read_rom(serial, start_address +
1204 status = write_rom(serial, start_address,
1219 status = read_rom(serial,
1244 status = ti_vsend_sync(serial->serial->dev,
1260 serial->fw_version = download_cur_ver;
1265 start_address = get_descriptor_addr(serial,
1315 status = write_rom(serial,
1331 status = read_rom(serial, start_address,
1359 status = ti_vsend_sync(serial->serial->dev,
1383 static int do_boot_mode(struct edgeport_serial *serial,
1386 struct device *dev = &serial->serial->interface->dev;
1394 status = config_boot_dev(serial->serial->dev);
1398 if (le16_to_cpu(serial->serial->dev->descriptor.idVendor)
1401 le16_to_cpu(serial->serial->dev->descriptor.idVendor));
1402 serial->TI_I2C_Type = DTK_ADDR_SPACE_I2C_TYPE_II;
1410 if (i2c_type_bootmode(serial))
1414 if (!check_i2c_image(serial)) {
1429 status = get_manuf_info(serial, (__u8 *)ti_manuf_desc);
1486 status = download_code(serial, buffer, buffer_size);
1496 serial->product_info.TiMode = TI_MODE_TRANSITIONING;
1506 serial->product_info.TiMode = TI_MODE_BOOT;
1516 return send_cmd(port->port->serial->dev,
1663 dev = &edge_serial->serial->dev->dev;
1676 if (port_number >= edge_serial->serial->num_ports) {
1681 port = edge_serial->serial->port[port_number];
1856 dev = port->serial->dev;
1934 urb = edge_serial->serial->port[0]->interrupt_in_urb;
1970 usb_kill_urb(port->serial->port[0]->interrupt_in_urb);
1980 struct usb_serial *serial = port->serial;
1984 edge_serial = usb_get_serial_data(port->serial);
2004 send_cmd(serial->dev, UMPC_CLOSE_PORT,
2011 usb_kill_urb(port->serial->port[0]->interrupt_in_urb);
2364 status = send_cmd(edge_port->port->serial->dev, UMPC_SET_CONFIG,
2490 struct edgeport_serial *serial;
2493 serial = container_of(work, struct edgeport_serial,
2499 if (!rom_desc || !get_descriptor_addr(serial, I2C_DESC_TYPE_ION,
2501 dev_err(&serial->serial->interface->dev,
2506 edge_heartbeat_schedule(serial);
2509 static int edge_calc_num_ports(struct usb_serial *serial,
2512 struct device *dev = &serial->interface->dev;
2513 unsigned char num_ports = serial->type->num_ports;
2516 if (serial->interface->cur_altsetting->desc.bNumEndpoints > 1) {
2528 static int edge_startup(struct usb_serial *serial)
2534 /* create our private serial structure */
2540 edge_serial->serial = serial;
2542 usb_set_serial_data(serial, edge_serial);
2554 edge_serial->serial->dev->descriptor.idProduct);
2569 static void edge_disconnect(struct usb_serial *serial)
2571 struct edgeport_serial *edge_serial = usb_get_serial_data(serial);
2576 static void edge_release(struct usb_serial *serial)
2578 struct edgeport_serial *edge_serial = usb_get_serial_data(serial);
2595 edge_port->edge_serial = usb_get_serial_data(port->serial);
2686 static int edge_suspend(struct usb_serial *serial, pm_message_t message)
2688 struct edgeport_serial *edge_serial = usb_get_serial_data(serial);
2695 static int edge_resume(struct usb_serial *serial)
2697 struct edgeport_serial *edge_serial = usb_get_serial_data(serial);