Lines Matching refs:edge_serial

300 static void  process_rcvd_data(struct edgeport_serial *edge_serial,
302 static void process_rcvd_status(struct edgeport_serial *edge_serial,
321 static void send_more_port_data(struct edgeport_serial *edge_serial,
330 static void get_manufacturing_desc(struct edgeport_serial *edge_serial);
331 static void get_boot_desc(struct edgeport_serial *edge_serial);
332 static void load_application_firmware(struct edgeport_serial *edge_serial);
351 static void update_edgeport_E2PROM(struct edgeport_serial *edge_serial) in update_edgeport_E2PROM() argument
353 struct device *dev = &edge_serial->serial->dev->dev; in update_edgeport_E2PROM()
365 switch (edge_serial->product_info.iDownloadFile) { in update_edgeport_E2PROM()
377 &edge_serial->serial->dev->dev); in update_edgeport_E2PROM()
390 BootCurVer = (edge_serial->boot_descriptor.MajorVersion << 24) + in update_edgeport_E2PROM()
391 (edge_serial->boot_descriptor.MinorVersion << 16) + in update_edgeport_E2PROM()
392 le16_to_cpu(edge_serial->boot_descriptor.BuildNumber); in update_edgeport_E2PROM()
399 edge_serial->boot_descriptor.MajorVersion, in update_edgeport_E2PROM()
400 edge_serial->boot_descriptor.MinorVersion, in update_edgeport_E2PROM()
401 le16_to_cpu(edge_serial->boot_descriptor.BuildNumber)); in update_edgeport_E2PROM()
406 edge_serial->boot_descriptor.MajorVersion, in update_edgeport_E2PROM()
407 edge_serial->boot_descriptor.MinorVersion, in update_edgeport_E2PROM()
408 le16_to_cpu(edge_serial->boot_descriptor.BuildNumber), in update_edgeport_E2PROM()
416 response = rom_write(edge_serial->serial, in update_edgeport_E2PROM()
422 dev_err(&edge_serial->serial->dev->dev, in update_edgeport_E2PROM()
468 static void dump_product_info(struct edgeport_serial *edge_serial, in dump_product_info() argument
471 struct device *dev = &edge_serial->serial->dev->dev; in dump_product_info()
503 static void get_product_info(struct edgeport_serial *edge_serial) in get_product_info() argument
505 struct edgeport_product_info *product_info = &edge_serial->product_info; in get_product_info()
509 …product_info->ProductId = (__u16)(le16_to_cpu(edge_serial->serial->dev->descriptor.idProduct) & ~I… in get_product_info()
510 product_info->NumPorts = edge_serial->manuf_descriptor.NumPorts; in get_product_info()
513 product_info->RomSize = edge_serial->manuf_descriptor.RomSize; in get_product_info()
514 product_info->RamSize = edge_serial->manuf_descriptor.RamSize; in get_product_info()
515 product_info->CpuRev = edge_serial->manuf_descriptor.CpuRev; in get_product_info()
516 product_info->BoardRev = edge_serial->manuf_descriptor.BoardRev; in get_product_info()
519 edge_serial->boot_descriptor.MajorVersion; in get_product_info()
521 edge_serial->boot_descriptor.MinorVersion; in get_product_info()
523 edge_serial->boot_descriptor.BuildNumber; in get_product_info()
526 edge_serial->manuf_descriptor.DescDate, in get_product_info()
527 sizeof(edge_serial->manuf_descriptor.DescDate)); in get_product_info()
530 if (le16_to_cpu(edge_serial->serial->dev->descriptor.idProduct) in get_product_info()
563 dump_product_info(edge_serial, product_info); in get_product_info()
645 struct edgeport_serial *edge_serial = urb->context; in edge_interrupt_callback() local
674 dev = &edge_serial->serial->dev->dev; in edge_interrupt_callback()
683 spin_lock_irqsave(&edge_serial->es_lock, flags); in edge_interrupt_callback()
684 edge_serial->rxBytesAvail += bytes_avail; in edge_interrupt_callback()
688 edge_serial->rxBytesAvail, in edge_interrupt_callback()
689 edge_serial->read_in_progress); in edge_interrupt_callback()
691 if (edge_serial->rxBytesAvail > 0 && in edge_interrupt_callback()
692 !edge_serial->read_in_progress) { in edge_interrupt_callback()
694 edge_serial->read_in_progress = true; in edge_interrupt_callback()
698 result = usb_submit_urb(edge_serial->read_urb, GFP_ATOMIC); in edge_interrupt_callback()
703 edge_serial->read_in_progress = false; in edge_interrupt_callback()
706 spin_unlock_irqrestore(&edge_serial->es_lock, in edge_interrupt_callback()
714 (portNumber < edge_serial->serial->num_ports)) { in edge_interrupt_callback()
717 port = edge_serial->serial->port[portNumber]; in edge_interrupt_callback()
734 send_more_port_data(edge_serial, in edge_interrupt_callback()
759 struct edgeport_serial *edge_serial = urb->context; in edge_bulk_in_callback() local
770 edge_serial->read_in_progress = false; in edge_bulk_in_callback()
776 edge_serial->read_in_progress = false; in edge_bulk_in_callback()
780 dev = &edge_serial->serial->dev->dev; in edge_bulk_in_callback()
785 spin_lock_irqsave(&edge_serial->es_lock, flags); in edge_bulk_in_callback()
788 edge_serial->rxBytesAvail -= raw_data_length; in edge_bulk_in_callback()
791 raw_data_length, edge_serial->rxBytesAvail); in edge_bulk_in_callback()
793 process_rcvd_data(edge_serial, data, urb->actual_length); in edge_bulk_in_callback()
796 if (edge_serial->rxBytesAvail > 0) { in edge_bulk_in_callback()
798 retval = usb_submit_urb(edge_serial->read_urb, GFP_ATOMIC); in edge_bulk_in_callback()
803 edge_serial->read_in_progress = false; in edge_bulk_in_callback()
806 edge_serial->read_in_progress = false; in edge_bulk_in_callback()
809 spin_unlock_irqrestore(&edge_serial->es_lock, flags); in edge_bulk_in_callback()
894 struct edgeport_serial *edge_serial; in edge_open() local
903 edge_serial = usb_get_serial_data(serial); in edge_open()
904 if (edge_serial == NULL) in edge_open()
906 if (edge_serial->interrupt_in_buffer == NULL) { in edge_open()
910 edge_serial->interrupt_in_buffer = in edge_open()
912 edge_serial->interrupt_in_endpoint = in edge_open()
914 edge_serial->interrupt_read_urb = port0->interrupt_in_urb; in edge_open()
915 edge_serial->bulk_in_buffer = port0->bulk_in_buffer; in edge_open()
916 edge_serial->bulk_in_endpoint = in edge_open()
918 edge_serial->read_urb = port0->read_urb; in edge_open()
919 edge_serial->bulk_out_endpoint = in edge_open()
923 usb_fill_int_urb(edge_serial->interrupt_read_urb, in edge_open()
928 edge_serial->interrupt_read_urb->transfer_buffer_length, in edge_open()
929 edge_interrupt_callback, edge_serial, in edge_open()
930 edge_serial->interrupt_read_urb->interval); in edge_open()
933 usb_fill_bulk_urb(edge_serial->read_urb, serial->dev, in edge_open()
937 edge_serial->read_urb->transfer_buffer_length, in edge_open()
938 edge_bulk_in_callback, edge_serial); in edge_open()
939 edge_serial->read_in_progress = false; in edge_open()
944 response = usb_submit_urb(edge_serial->interrupt_read_urb, in edge_open()
1128 struct edgeport_serial *edge_serial; in edge_close() local
1132 edge_serial = usb_get_serial_data(port->serial); in edge_close()
1134 if (edge_serial == NULL || edge_port == NULL) in edge_close()
1142 if (!edge_serial->is_epic || in edge_close()
1143 edge_serial->epic_descriptor.Supports.IOSPChase) { in edge_close()
1156 if (!edge_serial->is_epic || in edge_close()
1157 edge_serial->epic_descriptor.Supports.IOSPClose) { in edge_close()
1285 static void send_more_port_data(struct edgeport_serial *edge_serial, in send_more_port_data() argument
1364 usb_fill_bulk_urb(urb, edge_serial->serial->dev, in send_more_port_data()
1365 usb_sndbulkpipe(edge_serial->serial->dev, in send_more_port_data()
1366 edge_serial->bulk_out_endpoint), in send_more_port_data()
1685 struct edgeport_serial *edge_serial = usb_get_serial_data(port->serial); in edge_break() local
1688 if (!edge_serial->is_epic || in edge_break()
1689 edge_serial->epic_descriptor.Supports.IOSPChase) { in edge_break()
1703 if (!edge_serial->is_epic || in edge_break()
1704 edge_serial->epic_descriptor.Supports.IOSPSetClrBreak) { in edge_break()
1725 static void process_rcvd_data(struct edgeport_serial *edge_serial, in process_rcvd_data() argument
1728 struct device *dev = &edge_serial->serial->dev->dev; in process_rcvd_data()
1744 switch (edge_serial->rxState) { in process_rcvd_data()
1746 edge_serial->rxHeader1 = *buffer; in process_rcvd_data()
1751 edge_serial->rxState = EXPECT_HDR2; in process_rcvd_data()
1756 edge_serial->rxHeader2 = *buffer; in process_rcvd_data()
1761 edge_serial->rxHeader1, edge_serial->rxHeader2); in process_rcvd_data()
1765 if (IS_CMD_STAT_HDR(edge_serial->rxHeader1)) { in process_rcvd_data()
1770 edge_serial->rxPort = in process_rcvd_data()
1771 IOSP_GET_HDR_PORT(edge_serial->rxHeader1); in process_rcvd_data()
1772 edge_serial->rxStatusCode = in process_rcvd_data()
1774 edge_serial->rxHeader1); in process_rcvd_data()
1777 edge_serial->rxStatusCode)) { in process_rcvd_data()
1782 edge_serial->rxStatusParam in process_rcvd_data()
1783 = edge_serial->rxHeader2; in process_rcvd_data()
1784 edge_serial->rxState = EXPECT_HDR3; in process_rcvd_data()
1789 process_rcvd_status(edge_serial, in process_rcvd_data()
1790 edge_serial->rxHeader2, 0); in process_rcvd_data()
1791 edge_serial->rxState = EXPECT_HDR1; in process_rcvd_data()
1795 edge_serial->rxPort = IOSP_GET_HDR_PORT(edge_serial->rxHeader1); in process_rcvd_data()
1796 edge_serial->rxBytesRemaining = IOSP_GET_HDR_DATA_LEN(edge_serial->rxHeader1, in process_rcvd_data()
1797 edge_serial->rxHeader2); in process_rcvd_data()
1799 edge_serial->rxPort, in process_rcvd_data()
1800 edge_serial->rxBytesRemaining); in process_rcvd_data()
1803 edge_serial->rxState = EXPECT_DATA; in process_rcvd_data()
1808 if (bufferLength < edge_serial->rxBytesRemaining) { in process_rcvd_data()
1811 edge_serial->rxState = EXPECT_DATA; in process_rcvd_data()
1814 rxLen = edge_serial->rxBytesRemaining; in process_rcvd_data()
1816 edge_serial->rxState = EXPECT_HDR1; in process_rcvd_data()
1820 edge_serial->rxBytesRemaining -= rxLen; in process_rcvd_data()
1825 port = edge_serial->serial->port[ in process_rcvd_data()
1826 edge_serial->rxPort]; in process_rcvd_data()
1831 edge_serial->rxPort); in process_rcvd_data()
1841 edge_serial->rxHeader3 = *buffer; in process_rcvd_data()
1847 process_rcvd_status(edge_serial, in process_rcvd_data()
1848 edge_serial->rxStatusParam, in process_rcvd_data()
1849 edge_serial->rxHeader3); in process_rcvd_data()
1850 edge_serial->rxState = EXPECT_HDR1; in process_rcvd_data()
1862 static void process_rcvd_status(struct edgeport_serial *edge_serial, in process_rcvd_status() argument
1869 __u8 code = edge_serial->rxStatusCode; in process_rcvd_status()
1872 port = edge_serial->serial->port[edge_serial->rxPort]; in process_rcvd_status()
1875 dev_err(&edge_serial->serial->dev->dev, in process_rcvd_status()
1877 __func__, edge_serial->rxPort); in process_rcvd_status()
1888 __func__, edge_serial->rxPort, byte3); in process_rcvd_status()
1904 __func__, edge_serial->rxPort, byte3); in process_rcvd_status()
1914 __func__, edge_serial->rxPort, byte2, edge_port->txCredits); in process_rcvd_status()
1944 __func__, edge_serial->rxPort, byte2); in process_rcvd_status()
1950 __func__, edge_serial->rxPort, byte2, byte3); in process_rcvd_status()
1963 __func__, edge_serial->rxPort, byte2); in process_rcvd_status()
2243 struct edgeport_serial *edge_serial = in write_cmd_usb() local
2260 usb_fill_bulk_urb(urb, edge_serial->serial->dev, in write_cmd_usb()
2261 usb_sndbulkpipe(edge_serial->serial->dev, in write_cmd_usb()
2262 edge_serial->bulk_out_endpoint), in write_cmd_usb()
2298 struct edgeport_serial *edge_serial = in send_cmd_write_baud_rate() local
2308 if (edge_serial->is_epic && in send_cmd_write_baud_rate()
2309 !edge_serial->epic_descriptor.Supports.IOSPSetBaudRate) { in send_cmd_write_baud_rate()
2392 struct edgeport_serial *edge_serial = in send_cmd_write_uart_register() local
2403 if (edge_serial->is_epic && in send_cmd_write_uart_register()
2404 !edge_serial->epic_descriptor.Supports.IOSPWriteMCR && in send_cmd_write_uart_register()
2410 if (edge_serial->is_epic && in send_cmd_write_uart_register()
2411 !edge_serial->epic_descriptor.Supports.IOSPWriteLCR && in send_cmd_write_uart_register()
2448 struct edgeport_serial *edge_serial = in change_port_settings() local
2533 if (!edge_serial->is_epic || in change_port_settings()
2534 edge_serial->epic_descriptor.Supports.IOSPSetXChar) { in change_port_settings()
2561 if (!edge_serial->is_epic || in change_port_settings()
2562 edge_serial->epic_descriptor.Supports.IOSPSetRxFlow) in change_port_settings()
2564 if (!edge_serial->is_epic || in change_port_settings()
2565 edge_serial->epic_descriptor.Supports.IOSPSetTxFlow) in change_port_settings()
2637 static void get_manufacturing_desc(struct edgeport_serial *edge_serial) in get_manufacturing_desc() argument
2639 struct device *dev = &edge_serial->serial->dev->dev; in get_manufacturing_desc()
2644 response = rom_read(edge_serial->serial, in get_manufacturing_desc()
2648 (__u8 *)(&edge_serial->manuf_descriptor)); in get_manufacturing_desc()
2657 edge_serial->manuf_descriptor.RomSize); in get_manufacturing_desc()
2659 edge_serial->manuf_descriptor.RamSize); in get_manufacturing_desc()
2661 edge_serial->manuf_descriptor.CpuRev); in get_manufacturing_desc()
2663 edge_serial->manuf_descriptor.BoardRev); in get_manufacturing_desc()
2665 edge_serial->manuf_descriptor.NumPorts); in get_manufacturing_desc()
2667 edge_serial->manuf_descriptor.DescDate[0], in get_manufacturing_desc()
2668 edge_serial->manuf_descriptor.DescDate[1], in get_manufacturing_desc()
2669 edge_serial->manuf_descriptor.DescDate[2]+1900); in get_manufacturing_desc()
2671 edge_serial->manuf_descriptor.SerialNumber, in get_manufacturing_desc()
2672 edge_serial->manuf_descriptor.SerNumLength/2); in get_manufacturing_desc()
2675 edge_serial->manuf_descriptor.AssemblyNumber, in get_manufacturing_desc()
2676 edge_serial->manuf_descriptor.AssemblyNumLength/2); in get_manufacturing_desc()
2679 edge_serial->manuf_descriptor.OemAssyNumber, in get_manufacturing_desc()
2680 edge_serial->manuf_descriptor.OemAssyNumLength/2); in get_manufacturing_desc()
2683 edge_serial->manuf_descriptor.UartType); in get_manufacturing_desc()
2685 edge_serial->manuf_descriptor.IonPid); in get_manufacturing_desc()
2687 edge_serial->manuf_descriptor.IonConfig); in get_manufacturing_desc()
2697 static void get_boot_desc(struct edgeport_serial *edge_serial) in get_boot_desc() argument
2699 struct device *dev = &edge_serial->serial->dev->dev; in get_boot_desc()
2704 response = rom_read(edge_serial->serial, in get_boot_desc()
2708 (__u8 *)(&edge_serial->boot_descriptor)); in get_boot_desc()
2716 le16_to_cpu(edge_serial->boot_descriptor.BootCodeLength)); in get_boot_desc()
2718 edge_serial->boot_descriptor.MajorVersion); in get_boot_desc()
2720 edge_serial->boot_descriptor.MinorVersion); in get_boot_desc()
2722 le16_to_cpu(edge_serial->boot_descriptor.BuildNumber)); in get_boot_desc()
2724 le16_to_cpu(edge_serial->boot_descriptor.Capabilities)); in get_boot_desc()
2726 edge_serial->boot_descriptor.UConfig0); in get_boot_desc()
2728 edge_serial->boot_descriptor.UConfig1); in get_boot_desc()
2737 static void load_application_firmware(struct edgeport_serial *edge_serial) in load_application_firmware() argument
2739 struct device *dev = &edge_serial->serial->dev->dev; in load_application_firmware()
2748 switch (edge_serial->product_info.iDownloadFile) { in load_application_firmware()
2768 &edge_serial->serial->dev->dev); in load_application_firmware()
2780 edge_serial->product_info.FirmwareMajorVersion = rec->data[0]; in load_application_firmware()
2781 edge_serial->product_info.FirmwareMinorVersion = rec->data[1]; in load_application_firmware()
2782 edge_serial->product_info.FirmwareBuildNumber = cpu_to_le16(build); in load_application_firmware()
2787 response = sram_write(edge_serial->serial, in load_application_firmware()
2793 dev_err(&edge_serial->serial->dev->dev, in load_application_firmware()
2802 response = usb_control_msg (edge_serial->serial->dev, in load_application_firmware()
2803 usb_sndctrlpipe(edge_serial->serial->dev, 0), in load_application_firmware()
2816 struct edgeport_serial *edge_serial; in edge_startup() local
2831 edge_serial = kzalloc(sizeof(struct edgeport_serial), GFP_KERNEL); in edge_startup()
2832 if (!edge_serial) in edge_startup()
2835 spin_lock_init(&edge_serial->es_lock); in edge_startup()
2836 edge_serial->serial = serial; in edge_startup()
2837 usb_set_serial_data(serial, edge_serial); in edge_startup()
2841 &edge_serial->name[0], MAX_NAME_LEN+1); in edge_startup()
2844 edge_serial->name[i++] = ' '; in edge_startup()
2846 &edge_serial->name[i], MAX_NAME_LEN+2 - i); in edge_startup()
2848 dev_info(&serial->dev->dev, "%s detected\n", edge_serial->name); in edge_startup()
2851 if (get_epic_descriptor(edge_serial) < 0) { in edge_startup()
2853 memcpy(&edge_serial->epic_descriptor.Supports, descriptor, in edge_startup()
2857 get_manufacturing_desc(edge_serial); in edge_startup()
2860 get_boot_desc(edge_serial); in edge_startup()
2862 get_product_info(edge_serial); in edge_startup()
2867 if ((!edge_serial->is_epic) && in edge_startup()
2868 (edge_serial->product_info.NumPorts != serial->num_ports)) { in edge_startup()
2871 edge_serial->product_info.NumPorts, in edge_startup()
2878 if (!edge_serial->is_epic) { in edge_startup()
2880 load_application_firmware(edge_serial); in edge_startup()
2885 update_edgeport_E2PROM(edge_serial); in edge_startup()
2894 edge_serial->product_info.FirmwareMajorVersion, in edge_startup()
2895 edge_serial->product_info.FirmwareMinorVersion, in edge_startup()
2896 le16_to_cpu(edge_serial->product_info.FirmwareBuildNumber)); in edge_startup()
2903 if (edge_serial->is_epic) { in edge_startup()
2921 edge_serial->interrupt_read_urb = in edge_startup()
2923 if (!edge_serial->interrupt_read_urb) { in edge_startup()
2928 edge_serial->interrupt_in_buffer = in edge_startup()
2930 if (!edge_serial->interrupt_in_buffer) { in edge_startup()
2934 edge_serial->interrupt_in_endpoint = in edge_startup()
2939 edge_serial->interrupt_read_urb, in edge_startup()
2943 edge_serial->interrupt_in_buffer, in edge_startup()
2946 edge_serial, in edge_startup()
2958 edge_serial->read_urb = in edge_startup()
2960 if (!edge_serial->read_urb) { in edge_startup()
2965 edge_serial->bulk_in_buffer = in edge_startup()
2967 if (!edge_serial->bulk_in_buffer) { in edge_startup()
2971 edge_serial->bulk_in_endpoint = in edge_startup()
2975 usb_fill_bulk_urb(edge_serial->read_urb, dev, in edge_startup()
2978 edge_serial->bulk_in_buffer, in edge_startup()
2981 edge_serial); in edge_startup()
2989 edge_serial->bulk_out_endpoint = in edge_startup()
3002 usb_free_urb(edge_serial->interrupt_read_urb); in edge_startup()
3003 kfree(edge_serial->interrupt_in_buffer); in edge_startup()
3005 usb_free_urb(edge_serial->read_urb); in edge_startup()
3006 kfree(edge_serial->bulk_in_buffer); in edge_startup()
3008 kfree(edge_serial); in edge_startup()
3015 response = usb_submit_urb(edge_serial->interrupt_read_urb, in edge_startup()
3031 struct edgeport_serial *edge_serial = usb_get_serial_data(serial); in edge_disconnect() local
3033 if (edge_serial->is_epic) { in edge_disconnect()
3034 usb_kill_urb(edge_serial->interrupt_read_urb); in edge_disconnect()
3035 usb_kill_urb(edge_serial->read_urb); in edge_disconnect()
3046 struct edgeport_serial *edge_serial = usb_get_serial_data(serial); in edge_release() local
3048 if (edge_serial->is_epic) { in edge_release()
3049 usb_kill_urb(edge_serial->interrupt_read_urb); in edge_release()
3050 usb_free_urb(edge_serial->interrupt_read_urb); in edge_release()
3051 kfree(edge_serial->interrupt_in_buffer); in edge_release()
3053 usb_kill_urb(edge_serial->read_urb); in edge_release()
3054 usb_free_urb(edge_serial->read_urb); in edge_release()
3055 kfree(edge_serial->bulk_in_buffer); in edge_release()
3058 kfree(edge_serial); in edge_release()