Lines Matching refs:edge_serial
270 static void process_rcvd_data(struct edgeport_serial *edge_serial,
272 static void process_rcvd_status(struct edgeport_serial *edge_serial,
289 static void send_more_port_data(struct edgeport_serial *edge_serial,
308 static void update_edgeport_E2PROM(struct edgeport_serial *edge_serial) in update_edgeport_E2PROM() argument
310 struct device *dev = &edge_serial->serial->dev->dev; in update_edgeport_E2PROM()
322 switch (edge_serial->product_info.iDownloadFile) { in update_edgeport_E2PROM()
334 &edge_serial->serial->dev->dev); in update_edgeport_E2PROM()
347 BootCurVer = (edge_serial->boot_descriptor.MajorVersion << 24) + in update_edgeport_E2PROM()
348 (edge_serial->boot_descriptor.MinorVersion << 16) + in update_edgeport_E2PROM()
349 le16_to_cpu(edge_serial->boot_descriptor.BuildNumber); in update_edgeport_E2PROM()
356 edge_serial->boot_descriptor.MajorVersion, in update_edgeport_E2PROM()
357 edge_serial->boot_descriptor.MinorVersion, in update_edgeport_E2PROM()
358 le16_to_cpu(edge_serial->boot_descriptor.BuildNumber)); in update_edgeport_E2PROM()
363 edge_serial->boot_descriptor.MajorVersion, in update_edgeport_E2PROM()
364 edge_serial->boot_descriptor.MinorVersion, in update_edgeport_E2PROM()
365 le16_to_cpu(edge_serial->boot_descriptor.BuildNumber), in update_edgeport_E2PROM()
373 response = rom_write(edge_serial->serial, in update_edgeport_E2PROM()
379 dev_err(&edge_serial->serial->dev->dev, in update_edgeport_E2PROM()
392 static void dump_product_info(struct edgeport_serial *edge_serial, in dump_product_info() argument
395 struct device *dev = &edge_serial->serial->dev->dev; in dump_product_info()
427 static void get_product_info(struct edgeport_serial *edge_serial) in get_product_info() argument
429 struct edgeport_product_info *product_info = &edge_serial->product_info; in get_product_info()
433 …product_info->ProductId = (__u16)(le16_to_cpu(edge_serial->serial->dev->descriptor.idProduct) & ~I… in get_product_info()
434 product_info->NumPorts = edge_serial->manuf_descriptor.NumPorts; in get_product_info()
437 product_info->RomSize = edge_serial->manuf_descriptor.RomSize; in get_product_info()
438 product_info->RamSize = edge_serial->manuf_descriptor.RamSize; in get_product_info()
439 product_info->CpuRev = edge_serial->manuf_descriptor.CpuRev; in get_product_info()
440 product_info->BoardRev = edge_serial->manuf_descriptor.BoardRev; in get_product_info()
443 edge_serial->boot_descriptor.MajorVersion; in get_product_info()
445 edge_serial->boot_descriptor.MinorVersion; in get_product_info()
447 edge_serial->boot_descriptor.BuildNumber; in get_product_info()
450 edge_serial->manuf_descriptor.DescDate, in get_product_info()
451 sizeof(edge_serial->manuf_descriptor.DescDate)); in get_product_info()
454 if (le16_to_cpu(edge_serial->serial->dev->descriptor.idProduct) in get_product_info()
487 dump_product_info(edge_serial, product_info); in get_product_info()
569 struct edgeport_serial *edge_serial = urb->context; in edge_interrupt_callback() local
598 dev = &edge_serial->serial->dev->dev; in edge_interrupt_callback()
607 spin_lock_irqsave(&edge_serial->es_lock, flags); in edge_interrupt_callback()
608 edge_serial->rxBytesAvail += bytes_avail; in edge_interrupt_callback()
612 edge_serial->rxBytesAvail, in edge_interrupt_callback()
613 edge_serial->read_in_progress); in edge_interrupt_callback()
615 if (edge_serial->rxBytesAvail > 0 && in edge_interrupt_callback()
616 !edge_serial->read_in_progress) { in edge_interrupt_callback()
618 edge_serial->read_in_progress = true; in edge_interrupt_callback()
622 result = usb_submit_urb(edge_serial->read_urb, GFP_ATOMIC); in edge_interrupt_callback()
627 edge_serial->read_in_progress = false; in edge_interrupt_callback()
630 spin_unlock_irqrestore(&edge_serial->es_lock, in edge_interrupt_callback()
638 (portNumber < edge_serial->serial->num_ports)) { in edge_interrupt_callback()
641 port = edge_serial->serial->port[portNumber]; in edge_interrupt_callback()
658 send_more_port_data(edge_serial, in edge_interrupt_callback()
683 struct edgeport_serial *edge_serial = urb->context; in edge_bulk_in_callback() local
694 edge_serial->read_in_progress = false; in edge_bulk_in_callback()
700 edge_serial->read_in_progress = false; in edge_bulk_in_callback()
704 dev = &edge_serial->serial->dev->dev; in edge_bulk_in_callback()
709 spin_lock_irqsave(&edge_serial->es_lock, flags); in edge_bulk_in_callback()
712 edge_serial->rxBytesAvail -= raw_data_length; in edge_bulk_in_callback()
715 raw_data_length, edge_serial->rxBytesAvail); in edge_bulk_in_callback()
717 process_rcvd_data(edge_serial, data, urb->actual_length); in edge_bulk_in_callback()
720 if (edge_serial->rxBytesAvail > 0) { in edge_bulk_in_callback()
722 retval = usb_submit_urb(edge_serial->read_urb, GFP_ATOMIC); in edge_bulk_in_callback()
727 edge_serial->read_in_progress = false; in edge_bulk_in_callback()
730 edge_serial->read_in_progress = false; in edge_bulk_in_callback()
733 spin_unlock_irqrestore(&edge_serial->es_lock, flags); in edge_bulk_in_callback()
818 struct edgeport_serial *edge_serial; in edge_open() local
827 edge_serial = usb_get_serial_data(serial); in edge_open()
828 if (edge_serial == NULL) in edge_open()
830 if (edge_serial->interrupt_in_buffer == NULL) { in edge_open()
834 edge_serial->interrupt_in_buffer = in edge_open()
836 edge_serial->interrupt_in_endpoint = in edge_open()
838 edge_serial->interrupt_read_urb = port0->interrupt_in_urb; in edge_open()
839 edge_serial->bulk_in_buffer = port0->bulk_in_buffer; in edge_open()
840 edge_serial->bulk_in_endpoint = in edge_open()
842 edge_serial->read_urb = port0->read_urb; in edge_open()
843 edge_serial->bulk_out_endpoint = in edge_open()
847 usb_fill_int_urb(edge_serial->interrupt_read_urb, in edge_open()
852 edge_serial->interrupt_read_urb->transfer_buffer_length, in edge_open()
853 edge_interrupt_callback, edge_serial, in edge_open()
854 edge_serial->interrupt_read_urb->interval); in edge_open()
857 usb_fill_bulk_urb(edge_serial->read_urb, serial->dev, in edge_open()
861 edge_serial->read_urb->transfer_buffer_length, in edge_open()
862 edge_bulk_in_callback, edge_serial); in edge_open()
863 edge_serial->read_in_progress = false; in edge_open()
868 response = usb_submit_urb(edge_serial->interrupt_read_urb, in edge_open()
1052 struct edgeport_serial *edge_serial; in edge_close() local
1056 edge_serial = usb_get_serial_data(port->serial); in edge_close()
1058 if (edge_serial == NULL || edge_port == NULL) in edge_close()
1066 if (!edge_serial->is_epic || in edge_close()
1067 edge_serial->epic_descriptor.Supports.IOSPChase) { in edge_close()
1080 if (!edge_serial->is_epic || in edge_close()
1081 edge_serial->epic_descriptor.Supports.IOSPClose) { in edge_close()
1209 static void send_more_port_data(struct edgeport_serial *edge_serial, in send_more_port_data() argument
1288 usb_fill_bulk_urb(urb, edge_serial->serial->dev, in send_more_port_data()
1289 usb_sndbulkpipe(edge_serial->serial->dev, in send_more_port_data()
1290 edge_serial->bulk_out_endpoint), in send_more_port_data()
1567 struct edgeport_serial *edge_serial = usb_get_serial_data(port->serial); in edge_break() local
1570 if (!edge_serial->is_epic || in edge_break()
1571 edge_serial->epic_descriptor.Supports.IOSPChase) { in edge_break()
1585 if (!edge_serial->is_epic || in edge_break()
1586 edge_serial->epic_descriptor.Supports.IOSPSetClrBreak) { in edge_break()
1609 static void process_rcvd_data(struct edgeport_serial *edge_serial, in process_rcvd_data() argument
1612 struct usb_serial *serial = edge_serial->serial; in process_rcvd_data()
1629 switch (edge_serial->rxState) { in process_rcvd_data()
1631 edge_serial->rxHeader1 = *buffer; in process_rcvd_data()
1636 edge_serial->rxState = EXPECT_HDR2; in process_rcvd_data()
1641 edge_serial->rxHeader2 = *buffer; in process_rcvd_data()
1646 edge_serial->rxHeader1, edge_serial->rxHeader2); in process_rcvd_data()
1650 if (IS_CMD_STAT_HDR(edge_serial->rxHeader1)) { in process_rcvd_data()
1655 edge_serial->rxPort = in process_rcvd_data()
1656 IOSP_GET_HDR_PORT(edge_serial->rxHeader1); in process_rcvd_data()
1657 edge_serial->rxStatusCode = in process_rcvd_data()
1659 edge_serial->rxHeader1); in process_rcvd_data()
1662 edge_serial->rxStatusCode)) { in process_rcvd_data()
1667 edge_serial->rxStatusParam in process_rcvd_data()
1668 = edge_serial->rxHeader2; in process_rcvd_data()
1669 edge_serial->rxState = EXPECT_HDR3; in process_rcvd_data()
1674 process_rcvd_status(edge_serial, in process_rcvd_data()
1675 edge_serial->rxHeader2, 0); in process_rcvd_data()
1676 edge_serial->rxState = EXPECT_HDR1; in process_rcvd_data()
1680 edge_serial->rxPort = IOSP_GET_HDR_PORT(edge_serial->rxHeader1); in process_rcvd_data()
1681 edge_serial->rxBytesRemaining = IOSP_GET_HDR_DATA_LEN(edge_serial->rxHeader1, in process_rcvd_data()
1682 edge_serial->rxHeader2); in process_rcvd_data()
1684 edge_serial->rxPort, in process_rcvd_data()
1685 edge_serial->rxBytesRemaining); in process_rcvd_data()
1688 edge_serial->rxState = EXPECT_DATA; in process_rcvd_data()
1693 if (bufferLength < edge_serial->rxBytesRemaining) { in process_rcvd_data()
1696 edge_serial->rxState = EXPECT_DATA; in process_rcvd_data()
1699 rxLen = edge_serial->rxBytesRemaining; in process_rcvd_data()
1701 edge_serial->rxState = EXPECT_HDR1; in process_rcvd_data()
1705 edge_serial->rxBytesRemaining -= rxLen; in process_rcvd_data()
1709 if (rxLen && edge_serial->rxPort < serial->num_ports) { in process_rcvd_data()
1710 port = serial->port[edge_serial->rxPort]; in process_rcvd_data()
1715 edge_serial->rxPort); in process_rcvd_data()
1725 edge_serial->rxHeader3 = *buffer; in process_rcvd_data()
1731 process_rcvd_status(edge_serial, in process_rcvd_data()
1732 edge_serial->rxStatusParam, in process_rcvd_data()
1733 edge_serial->rxHeader3); in process_rcvd_data()
1734 edge_serial->rxState = EXPECT_HDR1; in process_rcvd_data()
1746 static void process_rcvd_status(struct edgeport_serial *edge_serial, in process_rcvd_status() argument
1753 __u8 code = edge_serial->rxStatusCode; in process_rcvd_status()
1756 if (edge_serial->rxPort >= edge_serial->serial->num_ports) in process_rcvd_status()
1758 port = edge_serial->serial->port[edge_serial->rxPort]; in process_rcvd_status()
1761 dev_err(&edge_serial->serial->dev->dev, in process_rcvd_status()
1763 __func__, edge_serial->rxPort); in process_rcvd_status()
1774 __func__, edge_serial->rxPort, byte3); in process_rcvd_status()
1790 __func__, edge_serial->rxPort, byte3); in process_rcvd_status()
1800 __func__, edge_serial->rxPort, byte2, edge_port->txCredits); in process_rcvd_status()
1830 __func__, edge_serial->rxPort, byte2); in process_rcvd_status()
1836 __func__, edge_serial->rxPort, byte2, byte3); in process_rcvd_status()
1849 __func__, edge_serial->rxPort, byte2); in process_rcvd_status()
2129 struct edgeport_serial *edge_serial = in write_cmd_usb() local
2146 usb_fill_bulk_urb(urb, edge_serial->serial->dev, in write_cmd_usb()
2147 usb_sndbulkpipe(edge_serial->serial->dev, in write_cmd_usb()
2148 edge_serial->bulk_out_endpoint), in write_cmd_usb()
2184 struct edgeport_serial *edge_serial = in send_cmd_write_baud_rate() local
2194 if (edge_serial->is_epic && in send_cmd_write_baud_rate()
2195 !edge_serial->epic_descriptor.Supports.IOSPSetBaudRate) { in send_cmd_write_baud_rate()
2278 struct edgeport_serial *edge_serial = in send_cmd_write_uart_register() local
2289 if (edge_serial->is_epic && in send_cmd_write_uart_register()
2290 !edge_serial->epic_descriptor.Supports.IOSPWriteMCR && in send_cmd_write_uart_register()
2296 if (edge_serial->is_epic && in send_cmd_write_uart_register()
2297 !edge_serial->epic_descriptor.Supports.IOSPWriteLCR && in send_cmd_write_uart_register()
2334 struct edgeport_serial *edge_serial = in change_port_settings() local
2419 if (!edge_serial->is_epic || in change_port_settings()
2420 edge_serial->epic_descriptor.Supports.IOSPSetXChar) { in change_port_settings()
2447 if (!edge_serial->is_epic || in change_port_settings()
2448 edge_serial->epic_descriptor.Supports.IOSPSetRxFlow) in change_port_settings()
2450 if (!edge_serial->is_epic || in change_port_settings()
2451 edge_serial->epic_descriptor.Supports.IOSPSetTxFlow) in change_port_settings()
2523 static void get_manufacturing_desc(struct edgeport_serial *edge_serial) in get_manufacturing_desc() argument
2525 struct device *dev = &edge_serial->serial->dev->dev; in get_manufacturing_desc()
2530 response = rom_read(edge_serial->serial, in get_manufacturing_desc()
2534 (__u8 *)(&edge_serial->manuf_descriptor)); in get_manufacturing_desc()
2543 edge_serial->manuf_descriptor.RomSize); in get_manufacturing_desc()
2545 edge_serial->manuf_descriptor.RamSize); in get_manufacturing_desc()
2547 edge_serial->manuf_descriptor.CpuRev); in get_manufacturing_desc()
2549 edge_serial->manuf_descriptor.BoardRev); in get_manufacturing_desc()
2551 edge_serial->manuf_descriptor.NumPorts); in get_manufacturing_desc()
2553 edge_serial->manuf_descriptor.DescDate[0], in get_manufacturing_desc()
2554 edge_serial->manuf_descriptor.DescDate[1], in get_manufacturing_desc()
2555 edge_serial->manuf_descriptor.DescDate[2]+1900); in get_manufacturing_desc()
2557 edge_serial->manuf_descriptor.SerialNumber, in get_manufacturing_desc()
2558 edge_serial->manuf_descriptor.SerNumLength/2); in get_manufacturing_desc()
2561 edge_serial->manuf_descriptor.AssemblyNumber, in get_manufacturing_desc()
2562 edge_serial->manuf_descriptor.AssemblyNumLength/2); in get_manufacturing_desc()
2565 edge_serial->manuf_descriptor.OemAssyNumber, in get_manufacturing_desc()
2566 edge_serial->manuf_descriptor.OemAssyNumLength/2); in get_manufacturing_desc()
2569 edge_serial->manuf_descriptor.UartType); in get_manufacturing_desc()
2571 edge_serial->manuf_descriptor.IonPid); in get_manufacturing_desc()
2573 edge_serial->manuf_descriptor.IonConfig); in get_manufacturing_desc()
2583 static void get_boot_desc(struct edgeport_serial *edge_serial) in get_boot_desc() argument
2585 struct device *dev = &edge_serial->serial->dev->dev; in get_boot_desc()
2590 response = rom_read(edge_serial->serial, in get_boot_desc()
2594 (__u8 *)(&edge_serial->boot_descriptor)); in get_boot_desc()
2602 le16_to_cpu(edge_serial->boot_descriptor.BootCodeLength)); in get_boot_desc()
2604 edge_serial->boot_descriptor.MajorVersion); in get_boot_desc()
2606 edge_serial->boot_descriptor.MinorVersion); in get_boot_desc()
2608 le16_to_cpu(edge_serial->boot_descriptor.BuildNumber)); in get_boot_desc()
2610 le16_to_cpu(edge_serial->boot_descriptor.Capabilities)); in get_boot_desc()
2612 edge_serial->boot_descriptor.UConfig0); in get_boot_desc()
2614 edge_serial->boot_descriptor.UConfig1); in get_boot_desc()
2623 static void load_application_firmware(struct edgeport_serial *edge_serial) in load_application_firmware() argument
2625 struct device *dev = &edge_serial->serial->dev->dev; in load_application_firmware()
2634 switch (edge_serial->product_info.iDownloadFile) { in load_application_firmware()
2654 &edge_serial->serial->dev->dev); in load_application_firmware()
2666 edge_serial->product_info.FirmwareMajorVersion = rec->data[0]; in load_application_firmware()
2667 edge_serial->product_info.FirmwareMinorVersion = rec->data[1]; in load_application_firmware()
2668 edge_serial->product_info.FirmwareBuildNumber = cpu_to_le16(build); in load_application_firmware()
2673 response = sram_write(edge_serial->serial, in load_application_firmware()
2679 dev_err(&edge_serial->serial->dev->dev, in load_application_firmware()
2688 response = usb_control_msg (edge_serial->serial->dev, in load_application_firmware()
2689 usb_sndctrlpipe(edge_serial->serial->dev, 0), in load_application_firmware()
2702 struct edgeport_serial *edge_serial; in edge_startup() local
2717 edge_serial = kzalloc(sizeof(struct edgeport_serial), GFP_KERNEL); in edge_startup()
2718 if (!edge_serial) in edge_startup()
2721 spin_lock_init(&edge_serial->es_lock); in edge_startup()
2722 edge_serial->serial = serial; in edge_startup()
2723 usb_set_serial_data(serial, edge_serial); in edge_startup()
2727 &edge_serial->name[0], MAX_NAME_LEN+1); in edge_startup()
2730 edge_serial->name[i++] = ' '; in edge_startup()
2732 &edge_serial->name[i], MAX_NAME_LEN+2 - i); in edge_startup()
2734 dev_info(&serial->dev->dev, "%s detected\n", edge_serial->name); in edge_startup()
2737 if (get_epic_descriptor(edge_serial) < 0) { in edge_startup()
2739 memcpy(&edge_serial->epic_descriptor.Supports, descriptor, in edge_startup()
2743 get_manufacturing_desc(edge_serial); in edge_startup()
2746 get_boot_desc(edge_serial); in edge_startup()
2748 get_product_info(edge_serial); in edge_startup()
2753 if ((!edge_serial->is_epic) && in edge_startup()
2754 (edge_serial->product_info.NumPorts != serial->num_ports)) { in edge_startup()
2757 edge_serial->product_info.NumPorts, in edge_startup()
2764 if (!edge_serial->is_epic) { in edge_startup()
2766 load_application_firmware(edge_serial); in edge_startup()
2771 update_edgeport_E2PROM(edge_serial); in edge_startup()
2780 edge_serial->product_info.FirmwareMajorVersion, in edge_startup()
2781 edge_serial->product_info.FirmwareMinorVersion, in edge_startup()
2782 le16_to_cpu(edge_serial->product_info.FirmwareBuildNumber)); in edge_startup()
2789 if (edge_serial->is_epic) { in edge_startup()
2809 edge_serial->interrupt_read_urb = in edge_startup()
2811 if (!edge_serial->interrupt_read_urb) { in edge_startup()
2816 edge_serial->interrupt_in_buffer = in edge_startup()
2818 if (!edge_serial->interrupt_in_buffer) { in edge_startup()
2822 edge_serial->interrupt_in_endpoint = in edge_startup()
2827 edge_serial->interrupt_read_urb, in edge_startup()
2831 edge_serial->interrupt_in_buffer, in edge_startup()
2834 edge_serial, in edge_startup()
2846 edge_serial->read_urb = in edge_startup()
2848 if (!edge_serial->read_urb) { in edge_startup()
2853 edge_serial->bulk_in_buffer = in edge_startup()
2855 if (!edge_serial->bulk_in_buffer) { in edge_startup()
2859 edge_serial->bulk_in_endpoint = in edge_startup()
2863 usb_fill_bulk_urb(edge_serial->read_urb, dev, in edge_startup()
2866 edge_serial->bulk_in_buffer, in edge_startup()
2869 edge_serial); in edge_startup()
2877 edge_serial->bulk_out_endpoint = in edge_startup()
2895 response = usb_submit_urb(edge_serial->interrupt_read_urb, in edge_startup()
2907 usb_free_urb(edge_serial->interrupt_read_urb); in edge_startup()
2908 kfree(edge_serial->interrupt_in_buffer); in edge_startup()
2910 usb_free_urb(edge_serial->read_urb); in edge_startup()
2911 kfree(edge_serial->bulk_in_buffer); in edge_startup()
2913 kfree(edge_serial); in edge_startup()
2925 struct edgeport_serial *edge_serial = usb_get_serial_data(serial); in edge_disconnect() local
2927 if (edge_serial->is_epic) { in edge_disconnect()
2928 usb_kill_urb(edge_serial->interrupt_read_urb); in edge_disconnect()
2929 usb_kill_urb(edge_serial->read_urb); in edge_disconnect()
2940 struct edgeport_serial *edge_serial = usb_get_serial_data(serial); in edge_release() local
2942 if (edge_serial->is_epic) { in edge_release()
2943 usb_kill_urb(edge_serial->interrupt_read_urb); in edge_release()
2944 usb_free_urb(edge_serial->interrupt_read_urb); in edge_release()
2945 kfree(edge_serial->interrupt_in_buffer); in edge_release()
2947 usb_kill_urb(edge_serial->read_urb); in edge_release()
2948 usb_free_urb(edge_serial->read_urb); in edge_release()
2949 kfree(edge_serial->bulk_in_buffer); in edge_release()
2952 kfree(edge_serial); in edge_release()