Lines Matching refs:max3421_hcd
117 struct max3421_hcd { struct
328 static inline struct max3421_hcd *
331 return (struct max3421_hcd *) hcd->hcd_priv; in hcd_to_max3421()
335 max3421_to_hcd(struct max3421_hcd *max3421_hcd) in max3421_to_hcd() argument
337 return container_of((void *) max3421_hcd, struct usb_hcd, hcd_priv); in max3421_to_hcd()
343 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in spi_rd8() local
352 max3421_hcd->tx->data[0] = in spi_rd8()
356 transfer.tx_buf = max3421_hcd->tx->data; in spi_rd8()
357 transfer.rx_buf = max3421_hcd->rx->data; in spi_rd8()
363 return max3421_hcd->rx->data[1]; in spi_rd8()
370 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in spi_wr8() local
378 max3421_hcd->tx->data[0] = in spi_wr8()
381 max3421_hcd->tx->data[1] = val; in spi_wr8()
383 transfer.tx_buf = max3421_hcd->tx->data; in spi_wr8()
394 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in spi_rd_buf() local
402 max3421_hcd->tx->data[0] = in spi_rd_buf()
405 transfer[0].tx_buf = max3421_hcd->tx->data; in spi_rd_buf()
420 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in spi_wr_buf() local
428 max3421_hcd->tx->data[0] = in spi_wr_buf()
432 transfer[0].tx_buf = max3421_hcd->tx->data; in spi_wr_buf()
459 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in max3421_set_speed() local
460 u8 mode_lowspeed, mode_hubpre, mode = max3421_hcd->mode; in max3421_set_speed()
464 if (max3421_hcd->port_status & USB_PORT_STAT_LOW_SPEED) { in max3421_set_speed()
472 if (mode != max3421_hcd->mode) { in max3421_set_speed()
473 max3421_hcd->mode = mode; in max3421_set_speed()
474 spi_wr8(hcd, MAX3421_REG_MODE, max3421_hcd->mode); in max3421_set_speed()
514 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in max3421_transfer_in() local
517 max3421_hcd->curr_len = 0; in max3421_transfer_in()
518 max3421_hcd->hien |= BIT(MAX3421_HI_RCVDAV_BIT); in max3421_transfer_in()
526 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in max3421_transfer_out() local
534 if (max3421_hcd->rev == 0x12) { in max3421_transfer_out()
538 spi_wr8(hcd, MAX3421_REG_SNDBC, max3421_hcd->curr_len); in max3421_transfer_out()
553 max3421_hcd->urb_done = -EMSGSIZE; in max3421_transfer_out()
556 max3421_hcd->curr_len = min((urb->transfer_buffer_length - in max3421_transfer_out()
559 spi_wr_buf(hcd, MAX3421_REG_SNDFIFO, src, max3421_hcd->curr_len); in max3421_transfer_out()
560 spi_wr8(hcd, MAX3421_REG_SNDBC, max3421_hcd->curr_len); in max3421_transfer_out()
571 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in max3421_next_transfer() local
572 struct urb *urb = max3421_hcd->curr_urb; in max3421_next_transfer()
611 max3421_hcd->hien |= BIT(MAX3421_HI_HXFRDN_BIT); in max3421_next_transfer()
632 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in max3421_select_and_start_urb() local
640 spin_lock_irqsave(&max3421_hcd->lock, flags); in max3421_select_and_start_urb()
643 max3421_hcd->sched_pass < SCHED_PASS_DONE; in max3421_select_and_start_urb()
644 ++max3421_hcd->sched_pass) in max3421_select_and_start_urb()
645 list_for_each(pos, &max3421_hcd->ep_list) { in max3421_select_and_start_urb()
654 if (max3421_hcd->sched_pass != in max3421_select_and_start_urb()
661 if (max3421_hcd->sched_pass != in max3421_select_and_start_urb()
674 max3421_hcd->curr_urb = urb; in max3421_select_and_start_urb()
675 max3421_hcd->urb_done = 1; in max3421_select_and_start_urb()
676 spin_unlock_irqrestore(&max3421_hcd->lock, in max3421_select_and_start_urb()
688 max3421_hcd->frame_number) == 0) in max3421_select_and_start_urb()
695 max3421_hcd->frame_number) in max3421_select_and_start_urb()
707 if (frame_diff(max3421_hcd->frame_number, in max3421_select_and_start_urb()
720 list_move_tail(pos, &max3421_hcd->ep_list); in max3421_select_and_start_urb()
726 spin_unlock_irqrestore(&max3421_hcd->lock, flags); in max3421_select_and_start_urb()
730 urb = max3421_hcd->curr_urb = curr_urb; in max3421_select_and_start_urb()
749 spin_unlock_irqrestore(&max3421_hcd->lock, flags); in max3421_select_and_start_urb()
751 max3421_ep->last_active = max3421_hcd->frame_number; in max3421_select_and_start_urb()
767 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in max3421_check_unlink() local
774 spin_lock_irqsave(&max3421_hcd->lock, flags); in max3421_check_unlink()
775 list_for_each_entry(max3421_ep, &max3421_hcd->ep_list, ep_list) { in max3421_check_unlink()
783 spin_unlock_irqrestore(&max3421_hcd->lock, in max3421_check_unlink()
786 spin_lock_irqsave(&max3421_hcd->lock, flags); in max3421_check_unlink()
790 spin_unlock_irqrestore(&max3421_hcd->lock, flags); in max3421_check_unlink()
800 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in max3421_slow_retransmit() local
801 struct urb *urb = max3421_hcd->curr_urb; in max3421_slow_retransmit()
806 max3421_hcd->curr_urb = NULL; in max3421_slow_retransmit()
815 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in max3421_recv_data_available() local
816 struct urb *urb = max3421_hcd->curr_urb; in max3421_recv_data_available()
836 max3421_hcd->curr_len = transfer_size; in max3421_recv_data_available()
847 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in max3421_handle_error() local
849 struct urb *urb = max3421_hcd->curr_urb; in max3421_handle_error()
876 max3421_hcd->urb_done = hrsl_to_error[result_code]; in max3421_handle_error()
904 max3421_hcd->urb_done = hrsl_to_error[result_code]; in max3421_handle_error()
913 max3421_hcd->urb_done = hrsl_to_error[result_code]; in max3421_handle_error()
936 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in max3421_transfer_in_done() local
958 if (max3421_hcd->curr_len < max_packet) { in max3421_transfer_in_done()
979 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in max3421_transfer_out_done() local
981 urb->actual_length += max3421_hcd->curr_len; in max3421_transfer_out_done()
994 if (max3421_hcd->curr_len == max_packet) in max3421_transfer_out_done()
1006 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in max3421_host_transfer_done() local
1007 struct urb *urb = max3421_hcd->curr_urb; in max3421_host_transfer_done()
1012 max3421_hcd->hien &= ~(BIT(MAX3421_HI_HXFRDN_BIT) | in max3421_host_transfer_done()
1019 ++max3421_hcd->err_stat[result_code]; in max3421_host_transfer_done()
1050 max3421_hcd->urb_done = urb_done = 0; in max3421_host_transfer_done()
1061 max3421_hcd->urb_done = urb_done; in max3421_host_transfer_done()
1072 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in max3421_detect_conn() local
1083 mode = max3421_hcd->mode; in max3421_detect_conn()
1108 max3421_hcd->mode = mode; in max3421_detect_conn()
1109 spi_wr8(hcd, MAX3421_REG_MODE, max3421_hcd->mode); in max3421_detect_conn()
1111 spin_lock_irqsave(&max3421_hcd->lock, flags); in max3421_detect_conn()
1112 old_port_status = max3421_hcd->port_status; in max3421_detect_conn()
1114 max3421_hcd->port_status |= USB_PORT_STAT_CONNECTION; in max3421_detect_conn()
1116 max3421_hcd->port_status &= ~USB_PORT_STAT_CONNECTION; in max3421_detect_conn()
1118 max3421_hcd->port_status |= USB_PORT_STAT_LOW_SPEED; in max3421_detect_conn()
1120 max3421_hcd->port_status &= ~USB_PORT_STAT_LOW_SPEED; in max3421_detect_conn()
1121 chg = (old_port_status ^ max3421_hcd->port_status); in max3421_detect_conn()
1122 max3421_hcd->port_status |= chg << 16; in max3421_detect_conn()
1123 spin_unlock_irqrestore(&max3421_hcd->lock, flags); in max3421_detect_conn()
1131 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in max3421_irq_handler() local
1133 if (max3421_hcd->spi_thread) in max3421_irq_handler()
1134 wake_up_process(max3421_hcd->spi_thread); in max3421_irq_handler()
1135 if (!test_and_set_bit(ENABLE_IRQ, &max3421_hcd->todo)) in max3421_irq_handler()
1145 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in dump_eps() local
1153 spin_lock_irqsave(&max3421_hcd->lock, flags); in dump_eps()
1154 list_for_each_entry(max3421_ep, &max3421_hcd->ep_list, ep_list) { in dump_eps()
1177 spin_unlock_irqrestore(&max3421_hcd->lock, flags); in dump_eps()
1186 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in max3421_handle_irqs() local
1197 hirq &= max3421_hcd->hien; in max3421_handle_irqs()
1206 max3421_hcd->frame_number = ((max3421_hcd->frame_number + 1) in max3421_handle_irqs()
1208 max3421_hcd->sched_pass = SCHED_PASS_PERIODIC; in max3421_handle_irqs()
1224 spin_lock_irqsave(&max3421_hcd->lock, flags); in max3421_handle_irqs()
1226 old_port_status = max3421_hcd->port_status; in max3421_handle_irqs()
1228 if (max3421_hcd->port_status & USB_PORT_STAT_RESET) { in max3421_handle_irqs()
1230 max3421_hcd->port_status &= ~USB_PORT_STAT_RESET; in max3421_handle_irqs()
1231 max3421_hcd->port_status |= USB_PORT_STAT_ENABLE; in max3421_handle_irqs()
1242 chg = (old_port_status ^ max3421_hcd->port_status); in max3421_handle_irqs()
1243 max3421_hcd->port_status |= chg << 16; in max3421_handle_irqs()
1245 spin_unlock_irqrestore(&max3421_hcd->lock, flags); in max3421_handle_irqs()
1259 max3421_hcd->err_stat[i]); in max3421_handle_irqs()
1265 memset(max3421_hcd->err_stat, 0, in max3421_handle_irqs()
1266 sizeof(max3421_hcd->err_stat)); in max3421_handle_irqs()
1280 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in max3421_reset_hcd() local
1304 max3421_hcd->mode = (BIT(MAX3421_MODE_HOST_BIT) | in max3421_reset_hcd()
1308 spi_wr8(hcd, MAX3421_REG_MODE, max3421_hcd->mode); in max3421_reset_hcd()
1311 max3421_hcd->frame_number = USB_MAX_FRAME_NUMBER; in max3421_reset_hcd()
1319 max3421_hcd->hien = (BIT(MAX3421_HI_FRAME_BIT) | in max3421_reset_hcd()
1322 spi_wr8(hcd, MAX3421_REG_HIEN, max3421_hcd->hien); in max3421_reset_hcd()
1332 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in max3421_urb_done() local
1337 status = max3421_hcd->urb_done; in max3421_urb_done()
1338 max3421_hcd->urb_done = 0; in max3421_urb_done()
1341 urb = max3421_hcd->curr_urb; in max3421_urb_done()
1353 max3421_hcd->curr_urb = NULL; in max3421_urb_done()
1354 spin_lock_irqsave(&max3421_hcd->lock, flags); in max3421_urb_done()
1356 spin_unlock_irqrestore(&max3421_hcd->lock, flags); in max3421_urb_done()
1369 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in max3421_spi_thread() local
1378 max3421_hcd->rev = spi_rd8(hcd, MAX3421_REG_REVISION); in max3421_spi_thread()
1379 if (max3421_hcd->rev == 0x12 || max3421_hcd->rev == 0x13) in max3421_spi_thread()
1381 dev_err(&spi->dev, "bad rev 0x%02x", max3421_hcd->rev); in max3421_spi_thread()
1385 max3421_hcd->rev, spi->max_speed_hz, spi->bits_per_word, in max3421_spi_thread()
1395 spi_wr8(hcd, MAX3421_REG_HIEN, max3421_hcd->hien); in max3421_spi_thread()
1398 if (test_and_clear_bit(ENABLE_IRQ, &max3421_hcd->todo)) in max3421_spi_thread()
1406 if (max3421_hcd->urb_done) in max3421_spi_thread()
1410 else if (!max3421_hcd->curr_urb) in max3421_spi_thread()
1413 if (test_and_clear_bit(RESET_HCD, &max3421_hcd->todo)) in max3421_spi_thread()
1416 if (test_and_clear_bit(RESET_PORT, &max3421_hcd->todo)) { in max3421_spi_thread()
1422 if (test_and_clear_bit(CHECK_UNLINK, &max3421_hcd->todo)) in max3421_spi_thread()
1424 if (test_and_clear_bit(IOPIN_UPDATE, &max3421_hcd->todo)) { in max3421_spi_thread()
1429 for (i = 0; i < ARRAY_SIZE(max3421_hcd->iopins); ++i) { in max3421_spi_thread()
1433 (max3421_hcd->iopins[i] & 0x0f)); in max3421_spi_thread()
1435 max3421_hcd->iopins[i] = val; in max3421_spi_thread()
1448 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in max3421_reset_port() local
1450 max3421_hcd->port_status &= ~(USB_PORT_STAT_ENABLE | in max3421_reset_port()
1452 max3421_hcd->port_status |= USB_PORT_STAT_RESET; in max3421_reset_port()
1453 set_bit(RESET_PORT, &max3421_hcd->todo); in max3421_reset_port()
1454 wake_up_process(max3421_hcd->spi_thread); in max3421_reset_port()
1461 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in max3421_reset() local
1466 set_bit(RESET_HCD, &max3421_hcd->todo); in max3421_reset()
1467 wake_up_process(max3421_hcd->spi_thread); in max3421_reset()
1474 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in max3421_start() local
1476 spin_lock_init(&max3421_hcd->lock); in max3421_start()
1477 max3421_hcd->rh_state = MAX3421_RH_RUNNING; in max3421_start()
1479 INIT_LIST_HEAD(&max3421_hcd->ep_list); in max3421_start()
1496 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in max3421_urb_enqueue() local
1515 spin_lock_irqsave(&max3421_hcd->lock, flags); in max3421_urb_enqueue()
1526 max3421_ep->last_active = max3421_hcd->frame_number; in max3421_urb_enqueue()
1529 list_add_tail(&max3421_ep->ep_list, &max3421_hcd->ep_list); in max3421_urb_enqueue()
1535 max3421_hcd->sched_pass = SCHED_PASS_PERIODIC; in max3421_urb_enqueue()
1536 wake_up_process(max3421_hcd->spi_thread); in max3421_urb_enqueue()
1540 spin_unlock_irqrestore(&max3421_hcd->lock, flags); in max3421_urb_enqueue()
1547 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in max3421_urb_dequeue() local
1551 spin_lock_irqsave(&max3421_hcd->lock, flags); in max3421_urb_dequeue()
1559 set_bit(CHECK_UNLINK, &max3421_hcd->todo); in max3421_urb_dequeue()
1560 wake_up_process(max3421_hcd->spi_thread); in max3421_urb_dequeue()
1562 spin_unlock_irqrestore(&max3421_hcd->lock, flags); in max3421_urb_dequeue()
1569 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in max3421_endpoint_disable() local
1572 spin_lock_irqsave(&max3421_hcd->lock, flags); in max3421_endpoint_disable()
1584 spin_unlock_irqrestore(&max3421_hcd->lock, flags); in max3421_endpoint_disable()
1590 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in max3421_get_frame_number() local
1591 return max3421_hcd->frame_number; in max3421_get_frame_number()
1601 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in max3421_hub_status_data() local
1605 spin_lock_irqsave(&max3421_hcd->lock, flags); in max3421_hub_status_data()
1610 if ((max3421_hcd->port_status & PORT_C_MASK) != 0) { in max3421_hub_status_data()
1614 max3421_hcd->port_status); in max3421_hub_status_data()
1616 if (max3421_hcd->rh_state == MAX3421_RH_SUSPENDED) in max3421_hub_status_data()
1620 spin_unlock_irqrestore(&max3421_hcd->lock, flags); in max3421_hub_status_data()
1646 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in max3421_gpout_set_value() local
1657 max3421_hcd->iopins[idx] |= mask; in max3421_gpout_set_value()
1659 max3421_hcd->iopins[idx] &= ~mask; in max3421_gpout_set_value()
1660 set_bit(IOPIN_UPDATE, &max3421_hcd->todo); in max3421_gpout_set_value()
1661 wake_up_process(max3421_hcd->spi_thread); in max3421_gpout_set_value()
1669 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in max3421_hub_control() local
1676 spin_lock_irqsave(&max3421_hcd->lock, flags); in max3421_hub_control()
1691 max3421_hcd->port_status &= ~(1 << value); in max3421_hub_control()
1713 ((__le16 *) buf)[0] = cpu_to_le16(max3421_hcd->port_status); in max3421_hub_control()
1715 cpu_to_le16(max3421_hcd->port_status >> 16); in max3421_hub_control()
1730 if (max3421_hcd->active) in max3421_hub_control()
1731 max3421_hcd->port_status |= in max3421_hub_control()
1736 max3421_hcd->port_status |= USB_PORT_STAT_POWER; in max3421_hub_control()
1744 if ((max3421_hcd->port_status & USB_PORT_STAT_POWER) in max3421_hub_control()
1746 max3421_hcd->port_status |= (1 << value); in max3421_hub_control()
1758 spin_unlock_irqrestore(&max3421_hcd->lock, flags); in max3421_hub_control()
1777 .hcd_priv_size = sizeof(struct max3421_hcd),
1818 struct max3421_hcd *max3421_hcd; in max3421_probe() local
1871 max3421_hcd = hcd_to_max3421(hcd); in max3421_probe()
1872 INIT_LIST_HEAD(&max3421_hcd->ep_list); in max3421_probe()
1873 spi_set_drvdata(spi, max3421_hcd); in max3421_probe()
1875 max3421_hcd->tx = kmalloc(sizeof(*max3421_hcd->tx), GFP_KERNEL); in max3421_probe()
1876 if (!max3421_hcd->tx) in max3421_probe()
1878 max3421_hcd->rx = kmalloc(sizeof(*max3421_hcd->rx), GFP_KERNEL); in max3421_probe()
1879 if (!max3421_hcd->rx) in max3421_probe()
1882 max3421_hcd->spi_thread = kthread_run(max3421_spi_thread, hcd, in max3421_probe()
1884 if (max3421_hcd->spi_thread == ERR_PTR(-ENOMEM)) { in max3421_probe()
1911 kfree(max3421_hcd->tx); in max3421_probe()
1912 kfree(max3421_hcd->rx); in max3421_probe()
1913 if (max3421_hcd->spi_thread) in max3421_probe()
1914 kthread_stop(max3421_hcd->spi_thread); in max3421_probe()
1923 struct max3421_hcd *max3421_hcd; in max3421_remove() local
1927 max3421_hcd = spi_get_drvdata(spi); in max3421_remove()
1928 hcd = max3421_to_hcd(max3421_hcd); in max3421_remove()
1932 spin_lock_irqsave(&max3421_hcd->lock, flags); in max3421_remove()
1934 kthread_stop(max3421_hcd->spi_thread); in max3421_remove()
1936 spin_unlock_irqrestore(&max3421_hcd->lock, flags); in max3421_remove()