Lines Matching +full:modem +full:- +full:init

1 // SPDX-License-Identifier: (GPL-2.0+ OR BSD-2-Clause)
6 * Copyright (c) 2005-2007 Matthieu Castet <castet.matthieu@free.fr>
7 * Copyright (c) 2005-2007 Stanislaw Gruszka <stf_xl@wp.pl>
41 dev_dbg(&(usb_dev)->dev, \
42 "[ueagle-atm dbg] %s: " format, \
49 dev_dbg(&(usb_dev)->dev, \
50 "[ueagle-atm vdbg] " format, ##args); \
60 dev_err(&(usb_dev)->dev , "[UEAGLE-ATM] " format , ##args)
63 dev_warn(&(usb_dev)->dev , "[Ueagle-atm] " format, ##args)
66 dev_info(&(usb_dev)->dev , "[ueagle-atm] " format, ##args)
241 (!((x)->driver_info & PSTFIRM))
243 ((x)->driver_info & 0xf)
246 ((x)->annex & ANNEXB)
248 #define INS_TO_USBDEV(ins) (ins->usb_dev)
255 (GET_STATUS(sc->stats.phy.state) == 2) : \
256 (sc->stats.phy.state == 7))
265 #define FW_DIR "ueagle-atm/"
279 #define FPGA930_FIRMWARE FW_DIR "930-fpga.bin"
528 [0 ... (NB_MODEM - 1)] = FASTEST_ISO_INTF};
549 int _r = wait_event_interruptible_timeout(sc->sync_q, \
552 _r = -ENODEV; \
558 if (sc->usbatm->atm_dev) \
559 sc->usbatm->atm_dev->type = val; \
564 if (sc->usbatm->atm_dev) \
565 atm_dev_signal_change(sc->usbatm->atm_dev, val); \
574 * uea_send_modem_cmd - Send a command for pre-firmware devices.
579 int ret = -ENOMEM; in uea_send_modem_cmd()
596 return (ret == size) ? 0 : -EIO; in uea_send_modem_cmd()
614 pfw = fw_entry->data; in uea_upload_pre_firmware()
615 size = fw_entry->size; in uea_upload_pre_firmware()
621 size -= 4; in uea_upload_pre_firmware()
632 uea_err(usb, "modem reset failed with error %d\n", ret); in uea_upload_pre_firmware()
640 size -= len + 3; in uea_upload_pre_firmware()
657 * Tell the modem we finish : de-assert reset in uea_upload_pre_firmware()
662 uea_err(usb, "modem de-assert failed with error %d\n", ret); in uea_upload_pre_firmware()
676 * uea_load_firmware - Load usb firmware for pre-firmware devices.
684 uea_info(usb, "pre-firmware device, uploading firmware\n"); in uea_load_firmware()
704 ret = request_firmware_nowait(THIS_MODULE, 1, fw_name, &usb->dev, in uea_load_firmware()
716 /* modem management : dsp firmware, send/read CMV, monitoring statistic
777 unsigned int sum = p->code - dsp; in check_dsp_e4()
782 if (strcmp("STRATIPHY ANEXA", p->string_header) != 0 && in check_dsp_e4()
783 strcmp("STRATIPHY ANEXB", p->string_header) != 0) in check_dsp_e4()
788 u8 blockno = p->page_number_to_block_index[i]; in check_dsp_e4()
798 blockidx = &p->page_header[blockno++]; in check_dsp_e4()
799 if ((u8 *)(blockidx + 1) - dsp >= len) in check_dsp_e4()
802 if (le16_to_cpu(blockidx->PageNumber) != i) in check_dsp_e4()
805 l = E4_PAGE_BYTES(blockidx->PageSize); in check_dsp_e4()
807 l += le32_to_cpu(blockidx->PageOffset); in check_dsp_e4()
812 } while (blockidx->NotLastBlock); in check_dsp_e4()
823 int ret = -ENOMEM; in uea_idma_write()
833 ret = usb_bulk_msg(sc->usb_dev, in uea_idma_write()
834 usb_sndbulkpipe(sc->usb_dev, UEA_IDMA_PIPE), in uea_idma_write()
843 return -EIO; in uea_idma_write()
871 ret = request_firmware(&sc->dsp_firm, dsp_name, &sc->usb_dev->dev); in request_dsp()
880 ret = check_dsp_e4(sc->dsp_firm->data, sc->dsp_firm->size); in request_dsp()
882 ret = check_dsp_e1(sc->dsp_firm->data, sc->dsp_firm->size); in request_dsp()
887 release_firmware(sc->dsp_firm); in request_dsp()
888 sc->dsp_firm = NULL; in request_dsp()
889 return -EILSEQ; in request_dsp()
901 u16 pageno = sc->pageno; in uea_load_page_e1()
902 u16 ovl = sc->ovl; in uea_load_page_e1()
913 release_firmware(sc->dsp_firm); in uea_load_page_e1()
914 sc->dsp_firm = NULL; in uea_load_page_e1()
917 if (sc->dsp_firm == NULL && request_dsp(sc) < 0) in uea_load_page_e1()
920 p = sc->dsp_firm->data; in uea_load_page_e1()
933 p = sc->dsp_firm->data + pageoffset; in uea_load_page_e1()
953 bi.wLast = cpu_to_le16((i == blockcount - 1) ? 1 : 0); in uea_load_page_e1()
979 struct l1_code *p = (struct l1_code *) sc->dsp_firm->data; in __uea_load_page_e4()
980 u8 blockno = p->page_number_to_block_index[pageno]; in __uea_load_page_e4()
991 blockidx = &p->page_header[blockno]; in __uea_load_page_e4()
992 blocksize = E4_PAGE_BYTES(blockidx->PageSize); in __uea_load_page_e4()
993 blockoffset = sc->dsp_firm->data + le32_to_cpu( in __uea_load_page_e4()
994 blockidx->PageOffset); in __uea_load_page_e4()
997 bi.dwAddress = cpu_to_be32(le32_to_cpu(blockidx->PageAddress)); in __uea_load_page_e4()
1003 le32_to_cpu(blockidx->PageAddress)); in __uea_load_page_e4()
1014 } while (blockidx->NotLastBlock); in __uea_load_page_e4()
1026 u8 pageno = sc->pageno; in uea_load_page_e4()
1035 release_firmware(sc->dsp_firm); in uea_load_page_e4()
1036 sc->dsp_firm = NULL; in uea_load_page_e4()
1039 if (sc->dsp_firm == NULL && request_dsp(sc) < 0) in uea_load_page_e4()
1042 p = (struct l1_code *) sc->dsp_firm->data; in uea_load_page_e4()
1043 if (pageno >= le16_to_cpu(p->page_header[0].PageNumber)) { in uea_load_page_e4()
1055 "sending Main DSP page %u\n", p->page_header[0].PageNumber); in uea_load_page_e4()
1057 for (i = 0; i < le16_to_cpu(p->page_header[0].PageNumber); i++) { in uea_load_page_e4()
1058 if (E4_IS_BOOT_PAGE(p->page_header[i].PageSize)) in uea_load_page_e4()
1068 bi.dwSize = cpu_to_be32(E4_PAGE_BYTES(p->page_header[0].PageSize)); in uea_load_page_e4()
1069 bi.dwAddress = cpu_to_be32(le32_to_cpu(p->page_header[0].PageAddress)); in uea_load_page_e4()
1078 BUG_ON(sc->cmv_ack); in wake_up_cmv_ack()
1079 sc->cmv_ack = 1; in wake_up_cmv_ack()
1080 wake_up(&sc->sync_q); in wake_up_cmv_ack()
1085 int ret = uea_wait(sc, sc->cmv_ack , ACK_TIMEOUT); in wait_cmv_ack()
1087 sc->cmv_ack = 0; in wait_cmv_ack()
1095 return (ret == 0) ? -ETIMEDOUT : 0; in wait_cmv_ack()
1104 int ret = -ENOMEM; in uea_request()
1112 ret = usb_control_msg(sc->usb_dev, usb_sndctrlpipe(sc->usb_dev, 0), in uea_request()
1127 return -EIO; in uea_request()
1140 uea_vdbg(INS_TO_USBDEV(sc), "Function : %d-%d, Address : %c%c%c%c, " in uea_cmv_e1()
1149 sc->cmv_dsc.e1.function = function | 0x2; in uea_cmv_e1()
1150 sc->cmv_dsc.e1.idx++; in uea_cmv_e1()
1151 sc->cmv_dsc.e1.address = address; in uea_cmv_e1()
1152 sc->cmv_dsc.e1.offset = offset; in uea_cmv_e1()
1157 cmv.wIndex = cpu_to_le16(sc->cmv_dsc.e1.idx); in uea_cmv_e1()
1180 uea_vdbg(INS_TO_USBDEV(sc), "Function : %d-%d, Group : 0x%04x, " in uea_cmv_e4()
1186 sc->cmv_dsc.e4.function = function | (0x1 << 4); in uea_cmv_e4()
1187 sc->cmv_dsc.e4.offset = offset; in uea_cmv_e4()
1188 sc->cmv_dsc.e4.address = address; in uea_cmv_e4()
1189 sc->cmv_dsc.e4.group = group; in uea_cmv_e4()
1215 *data = sc->data; in uea_read_cmv_e1()
1230 *data = sc->data; in uea_read_cmv_e4()
1231 /* size is in 16-bit word quantities */ in uea_read_cmv_e4()
1233 *(data + 1) = sc->data1; in uea_read_cmv_e4()
1268 /* in bulk mode the modem have problem with high rate in uea_set_bulk_timeout()
1271 * ADI930 don't support it (-EPIPE error). in uea_set_bulk_timeout()
1275 altsetting[sc->modem_index] > 0 || in uea_set_bulk_timeout()
1276 sc->stats.phy.dsrate == dsrate) in uea_set_bulk_timeout()
1288 * Monitor the modem and update the stat
1290 * return < 0 if an error occurs (-EAGAIN reboot needed)
1298 data = sc->stats.phy.state; in uea_stat_e1()
1300 ret = uea_read_cmv_e1(sc, E1_SA_STAT, 0, &sc->stats.phy.state); in uea_stat_e1()
1304 switch (GET_STATUS(sc->stats.phy.state)) { in uea_stat_e1()
1307 "modem not yet synchronized\n"); in uea_stat_e1()
1311 uea_dbg(INS_TO_USBDEV(sc), "modem initializing\n"); in uea_stat_e1()
1315 uea_vdbg(INS_TO_USBDEV(sc), "modem operational\n"); in uea_stat_e1()
1319 uea_info(INS_TO_USBDEV(sc), "modem synchronization failed" in uea_stat_e1()
1321 return -EAGAIN; in uea_stat_e1()
1325 "modem in test mode - not supported\n"); in uea_stat_e1()
1326 return -EAGAIN; in uea_stat_e1()
1328 case 7: /* fast-retain ... */ in uea_stat_e1()
1329 uea_info(INS_TO_USBDEV(sc), "modem in fast-retain mode\n"); in uea_stat_e1()
1332 uea_err(INS_TO_USBDEV(sc), "modem invalid SW mode %d\n", in uea_stat_e1()
1333 GET_STATUS(sc->stats.phy.state)); in uea_stat_e1()
1334 return -EAGAIN; in uea_stat_e1()
1339 uea_info(INS_TO_USBDEV(sc), "modem operational\n"); in uea_stat_e1()
1344 release_firmware(sc->dsp_firm); in uea_stat_e1()
1345 sc->dsp_firm = NULL; in uea_stat_e1()
1348 /* always update it as atm layer could not be init when we switch to in uea_stat_e1()
1354 wake_up(&sc->sync_q); in uea_stat_e1()
1356 ret = uea_read_cmv_e1(sc, E1_SA_DIAG, 2, &sc->stats.phy.flags); in uea_stat_e1()
1359 sc->stats.phy.mflags |= sc->stats.phy.flags; in uea_stat_e1()
1364 if (sc->stats.phy.flags) { in uea_stat_e1()
1366 sc->stats.phy.flags); in uea_stat_e1()
1375 sc->stats.phy.dsrate = (data >> 16) * 32; in uea_stat_e1()
1376 sc->stats.phy.usrate = (data & 0xffff) * 32; in uea_stat_e1()
1377 UPDATE_ATM_STAT(link_rate, sc->stats.phy.dsrate * 1000 / 424); in uea_stat_e1()
1382 sc->stats.phy.dsattenuation = (data & 0xff) / 2; in uea_stat_e1()
1387 sc->stats.phy.usattenuation = (data & 0xff) / 2; in uea_stat_e1()
1389 ret = uea_read_cmv_e1(sc, E1_SA_DIAG, 25, &sc->stats.phy.dsmargin); in uea_stat_e1()
1393 ret = uea_read_cmv_e1(sc, E1_SA_DIAG, 49, &sc->stats.phy.usmargin); in uea_stat_e1()
1397 ret = uea_read_cmv_e1(sc, E1_SA_DIAG, 51, &sc->stats.phy.rxflow); in uea_stat_e1()
1401 ret = uea_read_cmv_e1(sc, E1_SA_DIAG, 52, &sc->stats.phy.txflow); in uea_stat_e1()
1405 ret = uea_read_cmv_e1(sc, E1_SA_DIAG, 54, &sc->stats.phy.dsunc); in uea_stat_e1()
1409 /* only for atu-c */ in uea_stat_e1()
1410 ret = uea_read_cmv_e1(sc, E1_SA_DIAG, 58, &sc->stats.phy.usunc); in uea_stat_e1()
1414 ret = uea_read_cmv_e1(sc, E1_SA_DIAG, 53, &sc->stats.phy.dscorr); in uea_stat_e1()
1418 /* only for atu-c */ in uea_stat_e1()
1419 ret = uea_read_cmv_e1(sc, E1_SA_DIAG, 57, &sc->stats.phy.uscorr); in uea_stat_e1()
1423 ret = uea_read_cmv_e1(sc, E1_SA_INFO, 8, &sc->stats.phy.vidco); in uea_stat_e1()
1427 ret = uea_read_cmv_e1(sc, E1_SA_INFO, 13, &sc->stats.phy.vidcpe); in uea_stat_e1()
1441 data = sc->stats.phy.state; in uea_stat_e4()
1444 ret = uea_read_cmv_e4(sc, 1, E4_SA_STAT, 0, 0, &sc->stats.phy.state); in uea_stat_e4()
1448 switch (sc->stats.phy.state) { in uea_stat_e4()
1453 uea_dbg(INS_TO_USBDEV(sc), "modem not yet " in uea_stat_e4()
1460 uea_dbg(INS_TO_USBDEV(sc), "modem initializing\n"); in uea_stat_e4()
1463 uea_info(INS_TO_USBDEV(sc), "modem synchronization " in uea_stat_e4()
1465 return -EAGAIN; in uea_stat_e4()
1470 sc->stats.phy.state); in uea_stat_e4()
1476 uea_info(INS_TO_USBDEV(sc), "modem operational\n"); in uea_stat_e4()
1481 release_firmware(sc->dsp_firm); in uea_stat_e4()
1482 sc->dsp_firm = NULL; in uea_stat_e4()
1485 /* always update it as atm layer could not be init when we switch to in uea_stat_e4()
1491 wake_up(&sc->sync_q); in uea_stat_e4()
1495 * we should find the equivalent of eagle3- CMV in uea_stat_e4()
1498 ret = uea_read_cmv_e4(sc, 1, E4_SA_DIAG, 0, 0, &sc->stats.phy.flags); in uea_stat_e4()
1501 sc->stats.phy.mflags |= sc->stats.phy.flags; in uea_stat_e4()
1506 if (sc->stats.phy.flags) { in uea_stat_e4()
1508 sc->stats.phy.flags); in uea_stat_e4()
1509 if (sc->stats.phy.flags & 1) /* delineation LOSS */ in uea_stat_e4()
1510 return -EAGAIN; in uea_stat_e4()
1511 if (sc->stats.phy.flags & 0x4000) /* Reset Flag */ in uea_stat_e4()
1512 return -EAGAIN; in uea_stat_e4()
1521 sc->stats.phy.usrate = data / 1000; in uea_stat_e4()
1528 sc->stats.phy.dsrate = data / 1000; in uea_stat_e4()
1529 UPDATE_ATM_STAT(link_rate, sc->stats.phy.dsrate * 1000 / 424); in uea_stat_e4()
1534 sc->stats.phy.dsattenuation = data / 10; in uea_stat_e4()
1539 sc->stats.phy.usattenuation = data / 10; in uea_stat_e4()
1544 sc->stats.phy.dsmargin = data / 2; in uea_stat_e4()
1549 sc->stats.phy.usmargin = data / 10; in uea_stat_e4()
1560 /* set proper name corresponding modem version and line type */ in cmvs_file_name()
1561 if (cmv_file[sc->modem_index] == NULL) { in cmvs_file_name()
1572 file = cmv_file[sc->modem_index]; in cmvs_file_name()
1589 ret = request_firmware(fw, cmv_name, &sc->usb_dev->dev); in request_cmvs_old()
1597 data = (u8 *) (*fw)->data; in request_cmvs_old()
1598 size = (*fw)->size; in request_cmvs_old()
1611 return -EILSEQ; in request_cmvs_old()
1623 ret = request_firmware(fw, cmv_name, &sc->usb_dev->dev); in request_cmvs()
1638 size = (*fw)->size; in request_cmvs()
1639 data = (u8 *) (*fw)->data; in request_cmvs()
1653 size -= 4; in request_cmvs()
1659 size -= 4; in request_cmvs()
1672 return -EILSEQ; in request_cmvs()
1682 /* Enter in R-IDLE (cmv) until instructed otherwise */ in uea_send_cmvs_e1()
1688 ret = uea_read_cmv_e1(sc, E1_SA_INFO, 10, &sc->stats.phy.firmid); in uea_send_cmvs_e1()
1691 uea_info(INS_TO_USBDEV(sc), "ATU-R firmware version : %x\n", in uea_send_cmvs_e1()
1692 sc->stats.phy.firmid); in uea_send_cmvs_e1()
1731 /* Enter in R-ACT-REQ */ in uea_send_cmvs_e1()
1733 uea_vdbg(INS_TO_USBDEV(sc), "Entering in R-ACT-REQ state\n"); in uea_send_cmvs_e1()
1734 uea_info(INS_TO_USBDEV(sc), "modem started, waiting " in uea_send_cmvs_e1()
1748 /* Enter in R-IDLE (cmv) until instructed otherwise */ in uea_send_cmvs_e4()
1755 ret = uea_read_cmv_e4(sc, 2, E4_SA_INFO, 55, 0, &sc->stats.phy.firmid); in uea_send_cmvs_e4()
1758 uea_info(INS_TO_USBDEV(sc), "ATU-R firmware version : %x\n", in uea_send_cmvs_e4()
1759 sc->stats.phy.firmid); in uea_send_cmvs_e4()
1786 /* Enter in R-ACT-REQ */ in uea_send_cmvs_e4()
1788 uea_vdbg(INS_TO_USBDEV(sc), "Entering in R-ACT-REQ state\n"); in uea_send_cmvs_e4()
1789 uea_info(INS_TO_USBDEV(sc), "modem started, waiting " in uea_send_cmvs_e4()
1796 /* Start boot post firmware modem:
1797 * - send reset commands through usb control pipe
1798 * - start workqueue for DSP loading
1799 * - send CMV options to modem
1804 u16 zero = 0; /* ;-) */ in uea_start_reset()
1811 sc->booting = 1; in uea_start_reset()
1816 sc->cmv_ack = 0; in uea_start_reset()
1820 memset(&sc->stats, 0, sizeof(struct uea_stats)); in uea_start_reset()
1822 /* tell the modem that we want to boot in IDMA mode */ in uea_start_reset()
1849 sc->cmv_dsc.e4.function = E4_MAKEFUNCTION(E4_ADSLDIRECTIVE, in uea_start_reset()
1852 sc->cmv_dsc.e1.function = E1_MAKEFUNCTION(E1_ADSLDIRECTIVE, in uea_start_reset()
1856 sc->booting = 0; in uea_start_reset()
1859 sc->pageno = 0; in uea_start_reset()
1860 sc->ovl = 0; in uea_start_reset()
1861 schedule_work(&sc->task); in uea_start_reset()
1863 /* wait for modem ready CMV */ in uea_start_reset()
1870 ret = sc->send_cmvs(sc); in uea_start_reset()
1874 sc->reset = 0; in uea_start_reset()
1880 * In case of an error wait 1s before rebooting the modem
1881 * if the modem don't request reboot (-EAGAIN).
1882 * Monitor the modem every 1s.
1888 int ret = -EAGAIN; in uea_kthread()
1893 if (ret < 0 || sc->reset) in uea_kthread()
1896 ret = sc->stat(sc); in uea_kthread()
1897 if (ret != -EAGAIN) in uea_kthread()
1916 ret = request_firmware(&fw_entry, fw_name, &sc->usb_dev->dev); in load_XILINX_firmware()
1923 pfw = fw_entry->data; in load_XILINX_firmware()
1924 size = fw_entry->size; in load_XILINX_firmware()
1928 ret = -EILSEQ; in load_XILINX_firmware()
1932 ln = min(size - u, 64); in load_XILINX_firmware()
1949 /* Tell the modem we finish : de-assert reset */ in load_XILINX_firmware()
1951 ret = uea_send_modem_cmd(sc->usb_dev, 0xe, 1, &value); in load_XILINX_firmware()
1953 uea_err(sc->usb_dev, "elsa de-assert failed with error" in load_XILINX_firmware()
1963 /* The modem send us an ack. First with check if it right */
1966 struct cmv_dsc_e1 *dsc = &sc->cmv_dsc.e1; in uea_dispatch_cmv_e1()
1967 struct cmv_e1 *cmv = &intr->u.e1.s2.cmv; in uea_dispatch_cmv_e1()
1970 if (le16_to_cpu(cmv->wPreamble) != E1_PREAMBLE) in uea_dispatch_cmv_e1()
1973 if (cmv->bDirection != E1_MODEMTOHOST) in uea_dispatch_cmv_e1()
1979 if (cmv->bFunction != dsc->function) { in uea_dispatch_cmv_e1()
1981 && cmv->bFunction == E1_MAKEFUNCTION(2, 2)) { in uea_dispatch_cmv_e1()
1982 cmv->wIndex = cpu_to_le16(dsc->idx); in uea_dispatch_cmv_e1()
1983 put_unaligned_le32(dsc->address, in uea_dispatch_cmv_e1()
1984 &cmv->dwSymbolicAddress); in uea_dispatch_cmv_e1()
1985 cmv->wOffsetAddress = cpu_to_le16(dsc->offset); in uea_dispatch_cmv_e1()
1990 if (cmv->bFunction == E1_MAKEFUNCTION(E1_ADSLDIRECTIVE, in uea_dispatch_cmv_e1()
1998 if (le16_to_cpu(cmv->wIndex) != dsc->idx || in uea_dispatch_cmv_e1()
1999 get_unaligned_le32(&cmv->dwSymbolicAddress) != dsc->address || in uea_dispatch_cmv_e1()
2000 le16_to_cpu(cmv->wOffsetAddress) != dsc->offset) in uea_dispatch_cmv_e1()
2003 sc->data = get_unaligned_le32(&cmv->dwData); in uea_dispatch_cmv_e1()
2004 sc->data = sc->data << 16 | sc->data >> 16; in uea_dispatch_cmv_e1()
2013 E1_FUNCTION_TYPE(cmv->bFunction), in uea_dispatch_cmv_e1()
2014 E1_FUNCTION_SUBTYPE(cmv->bFunction)); in uea_dispatch_cmv_e1()
2021 le16_to_cpu(cmv->wPreamble), cmv->bDirection); in uea_dispatch_cmv_e1()
2025 /* The modem send us an ack. First with check if it right */
2028 struct cmv_dsc_e4 *dsc = &sc->cmv_dsc.e4; in uea_dispatch_cmv_e4()
2029 struct cmv_e4 *cmv = &intr->u.e4.s2.cmv; in uea_dispatch_cmv_e4()
2033 be16_to_cpu(cmv->wGroup), be16_to_cpu(cmv->wFunction), in uea_dispatch_cmv_e4()
2034 be16_to_cpu(cmv->wOffset), be16_to_cpu(cmv->wAddress), in uea_dispatch_cmv_e4()
2035 be32_to_cpu(cmv->dwData[0]), be32_to_cpu(cmv->dwData[1])); in uea_dispatch_cmv_e4()
2037 if (be16_to_cpu(cmv->wFunction) != dsc->function) in uea_dispatch_cmv_e4()
2040 if (be16_to_cpu(cmv->wFunction) == E4_MAKEFUNCTION(E4_ADSLDIRECTIVE, in uea_dispatch_cmv_e4()
2048 if (be16_to_cpu(cmv->wOffset) != dsc->offset || in uea_dispatch_cmv_e4()
2049 be16_to_cpu(cmv->wGroup) != dsc->group || in uea_dispatch_cmv_e4()
2050 be16_to_cpu(cmv->wAddress) != dsc->address) in uea_dispatch_cmv_e4()
2053 sc->data = be32_to_cpu(cmv->dwData[0]); in uea_dispatch_cmv_e4()
2054 sc->data1 = be32_to_cpu(cmv->dwData[1]); in uea_dispatch_cmv_e4()
2062 E4_FUNCTION_TYPE(cmv->wFunction), in uea_dispatch_cmv_e4()
2063 E4_FUNCTION_SUBTYPE(cmv->wFunction)); in uea_dispatch_cmv_e4()
2071 sc->pageno = intr->e1_bSwapPageNo; in uea_schedule_load_page_e1()
2072 sc->ovl = intr->e1_bOvl >> 4 | intr->e1_bOvl << 4; in uea_schedule_load_page_e1()
2073 schedule_work(&sc->task); in uea_schedule_load_page_e1()
2079 sc->pageno = intr->e4_bSwapPageNo; in uea_schedule_load_page_e4()
2080 schedule_work(&sc->task); in uea_schedule_load_page_e4()
2088 struct uea_softc *sc = urb->context; in uea_intr()
2089 struct intr_pkt *intr = urb->transfer_buffer; in uea_intr()
2090 int status = urb->status; in uea_intr()
2100 /* device-to-host interrupt */ in uea_intr()
2101 if (intr->bType != 0x08 || sc->booting) { in uea_intr()
2106 switch (le16_to_cpu(intr->wInterrupt)) { in uea_intr()
2108 sc->schedule_load_page(sc, intr); in uea_intr()
2112 sc->dispatch_cmv(sc, intr); in uea_intr()
2117 le16_to_cpu(intr->wInterrupt)); in uea_intr()
2121 usb_submit_urb(sc->urb_int, GFP_ATOMIC); in uea_intr()
2125 * Start the modem : init the data and start kernel thread
2130 int ret = -ENOMEM; in uea_boot()
2137 sc->dispatch_cmv = uea_dispatch_cmv_e4; in uea_boot()
2138 sc->schedule_load_page = uea_schedule_load_page_e4; in uea_boot()
2139 sc->stat = uea_stat_e4; in uea_boot()
2140 sc->send_cmvs = uea_send_cmvs_e4; in uea_boot()
2141 INIT_WORK(&sc->task, uea_load_page_e4); in uea_boot()
2144 sc->dispatch_cmv = uea_dispatch_cmv_e1; in uea_boot()
2145 sc->schedule_load_page = uea_schedule_load_page_e1; in uea_boot()
2146 sc->stat = uea_stat_e1; in uea_boot()
2147 sc->send_cmvs = uea_send_cmvs_e1; in uea_boot()
2148 INIT_WORK(&sc->task, uea_load_page_e1); in uea_boot()
2151 init_waitqueue_head(&sc->sync_q); in uea_boot()
2156 if (intf->cur_altsetting->desc.bNumEndpoints < 1) { in uea_boot()
2157 ret = -ENODEV; in uea_boot()
2165 sc->urb_int = usb_alloc_urb(0, GFP_KERNEL); in uea_boot()
2166 if (!sc->urb_int) in uea_boot()
2169 usb_fill_int_urb(sc->urb_int, sc->usb_dev, in uea_boot()
2170 usb_rcvintpipe(sc->usb_dev, UEA_INTR_PIPE), in uea_boot()
2172 intf->cur_altsetting->endpoint[0].desc.bInterval); in uea_boot()
2174 ret = usb_submit_urb(sc->urb_int, GFP_KERNEL); in uea_boot()
2184 sc->kthread = kthread_create(uea_kthread, sc, "ueagle-atm"); in uea_boot()
2185 if (IS_ERR(sc->kthread)) { in uea_boot()
2187 ret = PTR_ERR(sc->kthread); in uea_boot()
2195 usb_kill_urb(sc->urb_int); in uea_boot()
2197 usb_free_urb(sc->urb_int); in uea_boot()
2198 sc->urb_int = NULL; in uea_boot()
2206 * Stop the modem : kill kernel thread and free data
2212 ret = kthread_stop(sc->kthread); in uea_stop()
2217 usb_kill_urb(sc->urb_int); in uea_stop()
2218 kfree(sc->urb_int->transfer_buffer); in uea_stop()
2219 usb_free_urb(sc->urb_int); in uea_stop()
2222 flush_work(&sc->task); in uea_stop()
2224 release_firmware(sc->dsp_firm); in uea_stop()
2242 return usbatm->driver_data; in dev_to_uea()
2248 int ret = -ENODEV; in stat_status_show()
2255 ret = snprintf(buf, 10, "%08x\n", sc->stats.phy.state); in stat_status_show()
2264 int ret = -ENODEV; in stat_status_store()
2271 sc->reset = 1; in stat_status_store()
2283 int ret = -ENODEV; in stat_human_status_show()
2293 switch (sc->stats.phy.state) { in stat_human_status_show()
2317 modem_state = GET_STATUS(sc->stats.phy.state); in stat_human_status_show()
2321 ret = sprintf(buf, "Modem is booting\n"); in stat_human_status_show()
2324 ret = sprintf(buf, "Modem is initializing\n"); in stat_human_status_show()
2327 ret = sprintf(buf, "Modem is operational\n"); in stat_human_status_show()
2330 ret = sprintf(buf, "Modem synchronization failed\n"); in stat_human_status_show()
2333 ret = sprintf(buf, "Modem state is unknown\n"); in stat_human_status_show()
2346 int ret = -ENODEV; in stat_delin_show()
2356 if (sc->stats.phy.flags & 0x4000) in stat_delin_show()
2358 else if (sc->stats.phy.flags & 0x0001) in stat_delin_show()
2361 if (sc->stats.phy.flags & 0x0C00) in stat_delin_show()
2363 else if (sc->stats.phy.flags & 0x0030) in stat_delin_show()
2380 int ret = -ENODEV; \
2387 ret = snprintf(buf, 10, "%08x\n", sc->stats.phy.name); \
2389 sc->stats.phy.name = 0; \
2420 (sc->usb_dev, sc->usb_dev->descriptor.iSerialNumber, mac_str, in uea_getesi()
2434 struct uea_softc *sc = usbatm->driver_data; in uea_atm_open()
2436 return uea_getesi(sc, atm_dev->esi); in uea_atm_open()
2441 struct uea_softc *sc = usbatm->driver_data; in uea_heavy()
2443 wait_event_interruptible(sc->sync_q, IS_OPERATIONAL(sc)); in uea_heavy()
2457 return -ENODEV; in claim_interface()
2495 int ret, ifnum = intf->altsetting->desc.bInterfaceNumber; in uea_bind()
2502 return -ENODEV; in uea_bind()
2504 usbatm->flags = (sync_wait[modem_index] ? 0 : UDSL_SKIP_HEAVY_INIT); in uea_bind()
2521 return -ENOMEM; in uea_bind()
2523 sc->usb_dev = usb; in uea_bind()
2524 usbatm->driver_data = sc; in uea_bind()
2525 sc->usbatm = usbatm; in uea_bind()
2526 sc->modem_index = (modem_index < NB_MODEM) ? modem_index++ : 0; in uea_bind()
2527 sc->driver_info = id->driver_info; in uea_bind()
2530 if (annex[sc->modem_index] == 1) in uea_bind()
2531 sc->annex = ANNEXA; in uea_bind()
2532 else if (annex[sc->modem_index] == 2) in uea_bind()
2533 sc->annex = ANNEXB; in uea_bind()
2535 else if (sc->driver_info & AUTO_ANNEX_A) in uea_bind()
2536 sc->annex = ANNEXA; in uea_bind()
2537 else if (sc->driver_info & AUTO_ANNEX_B) in uea_bind()
2538 sc->annex = ANNEXB; in uea_bind()
2540 sc->annex = (le16_to_cpu in uea_bind()
2541 (sc->usb_dev->descriptor.bcdDevice) & 0x80) ? ANNEXB : ANNEXA; in uea_bind()
2543 alt = altsetting[sc->modem_index]; in uea_bind()
2550 usbatm->flags |= UDSL_USE_ISOC | UDSL_IGNORE_EILSEQ; in uea_bind()
2570 struct uea_softc *sc = usbatm->driver_data; in uea_unbind()
2577 .driver_name = "ueagle-atm",
2594 le16_to_cpu(usb->descriptor.idVendor), in uea_probe()
2595 le16_to_cpu(usb->descriptor.idProduct), in uea_probe()
2596 le16_to_cpu(usb->descriptor.bcdDevice), in uea_probe()
2607 struct uea_softc *sc = usbatm->driver_data; in uea_probe()
2612 /* Only start the worker thread when all init is done */ in uea_probe()
2613 wake_up_process(sc->kthread); in uea_probe()
2622 int ifnum = intf->altsetting->desc.bInterfaceNumber; in uea_disconnect()
2626 * Pre-firmware device has one interface in uea_disconnect()
2628 if (usb->config->desc.bNumInterfaces != 1 && ifnum == 0) { in uea_disconnect()
2717 .name = "ueagle-atm",
2729 MODULE_DESCRIPTION("ADI 930/Eagle USB ADSL Modem driver");