Lines Matching refs:max3421_hcd
123 struct max3421_hcd { struct
334 static inline struct max3421_hcd *
337 return (struct max3421_hcd *) hcd->hcd_priv; in hcd_to_max3421()
341 max3421_to_hcd(struct max3421_hcd *max3421_hcd) in max3421_to_hcd() argument
343 return container_of((void *) max3421_hcd, struct usb_hcd, hcd_priv); in max3421_to_hcd()
349 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in spi_rd8() local
358 max3421_hcd->tx->data[0] = in spi_rd8()
362 transfer.tx_buf = max3421_hcd->tx->data; in spi_rd8()
363 transfer.rx_buf = max3421_hcd->rx->data; in spi_rd8()
369 return max3421_hcd->rx->data[1]; in spi_rd8()
376 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in spi_wr8() local
384 max3421_hcd->tx->data[0] = in spi_wr8()
387 max3421_hcd->tx->data[1] = val; in spi_wr8()
389 transfer.tx_buf = max3421_hcd->tx->data; in spi_wr8()
400 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in spi_rd_buf() local
408 max3421_hcd->tx->data[0] = in spi_rd_buf()
411 transfer[0].tx_buf = max3421_hcd->tx->data; in spi_rd_buf()
426 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in spi_wr_buf() local
434 max3421_hcd->tx->data[0] = in spi_wr_buf()
438 transfer[0].tx_buf = max3421_hcd->tx->data; in spi_wr_buf()
465 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in max3421_set_speed() local
466 u8 mode_lowspeed, mode_hubpre, mode = max3421_hcd->mode; in max3421_set_speed()
470 if (max3421_hcd->port_status & USB_PORT_STAT_LOW_SPEED) { in max3421_set_speed()
478 if (mode != max3421_hcd->mode) { in max3421_set_speed()
479 max3421_hcd->mode = mode; in max3421_set_speed()
480 spi_wr8(hcd, MAX3421_REG_MODE, max3421_hcd->mode); in max3421_set_speed()
520 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in max3421_transfer_in() local
523 max3421_hcd->curr_len = 0; in max3421_transfer_in()
524 max3421_hcd->hien |= BIT(MAX3421_HI_RCVDAV_BIT); in max3421_transfer_in()
532 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in max3421_transfer_out() local
540 if (max3421_hcd->rev == 0x12) { in max3421_transfer_out()
544 spi_wr8(hcd, MAX3421_REG_SNDBC, max3421_hcd->curr_len); in max3421_transfer_out()
559 max3421_hcd->urb_done = -EMSGSIZE; in max3421_transfer_out()
562 max3421_hcd->curr_len = min((urb->transfer_buffer_length - in max3421_transfer_out()
565 spi_wr_buf(hcd, MAX3421_REG_SNDFIFO, src, max3421_hcd->curr_len); in max3421_transfer_out()
566 spi_wr8(hcd, MAX3421_REG_SNDBC, max3421_hcd->curr_len); in max3421_transfer_out()
577 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in max3421_next_transfer() local
578 struct urb *urb = max3421_hcd->curr_urb; in max3421_next_transfer()
617 max3421_hcd->hien |= BIT(MAX3421_HI_HXFRDN_BIT); in max3421_next_transfer()
638 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in max3421_select_and_start_urb() local
646 spin_lock_irqsave(&max3421_hcd->lock, flags); in max3421_select_and_start_urb()
649 max3421_hcd->sched_pass < SCHED_PASS_DONE; in max3421_select_and_start_urb()
650 ++max3421_hcd->sched_pass) in max3421_select_and_start_urb()
651 list_for_each(pos, &max3421_hcd->ep_list) { in max3421_select_and_start_urb()
660 if (max3421_hcd->sched_pass != in max3421_select_and_start_urb()
667 if (max3421_hcd->sched_pass != in max3421_select_and_start_urb()
680 max3421_hcd->curr_urb = urb; in max3421_select_and_start_urb()
681 max3421_hcd->urb_done = 1; in max3421_select_and_start_urb()
682 spin_unlock_irqrestore(&max3421_hcd->lock, in max3421_select_and_start_urb()
694 max3421_hcd->frame_number) == 0) in max3421_select_and_start_urb()
701 max3421_hcd->frame_number) in max3421_select_and_start_urb()
713 if (frame_diff(max3421_hcd->frame_number, in max3421_select_and_start_urb()
726 list_move_tail(pos, &max3421_hcd->ep_list); in max3421_select_and_start_urb()
732 spin_unlock_irqrestore(&max3421_hcd->lock, flags); in max3421_select_and_start_urb()
736 urb = max3421_hcd->curr_urb = curr_urb; in max3421_select_and_start_urb()
755 spin_unlock_irqrestore(&max3421_hcd->lock, flags); in max3421_select_and_start_urb()
757 max3421_ep->last_active = max3421_hcd->frame_number; in max3421_select_and_start_urb()
773 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in max3421_check_unlink() local
780 spin_lock_irqsave(&max3421_hcd->lock, flags); in max3421_check_unlink()
781 list_for_each_entry(max3421_ep, &max3421_hcd->ep_list, ep_list) { in max3421_check_unlink()
789 spin_unlock_irqrestore(&max3421_hcd->lock, in max3421_check_unlink()
792 spin_lock_irqsave(&max3421_hcd->lock, flags); in max3421_check_unlink()
796 spin_unlock_irqrestore(&max3421_hcd->lock, flags); in max3421_check_unlink()
806 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in max3421_slow_retransmit() local
807 struct urb *urb = max3421_hcd->curr_urb; in max3421_slow_retransmit()
812 max3421_hcd->curr_urb = NULL; in max3421_slow_retransmit()
821 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in max3421_recv_data_available() local
822 struct urb *urb = max3421_hcd->curr_urb; in max3421_recv_data_available()
842 max3421_hcd->curr_len = transfer_size; in max3421_recv_data_available()
853 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in max3421_handle_error() local
855 struct urb *urb = max3421_hcd->curr_urb; in max3421_handle_error()
882 max3421_hcd->urb_done = hrsl_to_error[result_code]; in max3421_handle_error()
910 max3421_hcd->urb_done = hrsl_to_error[result_code]; in max3421_handle_error()
919 max3421_hcd->urb_done = hrsl_to_error[result_code]; in max3421_handle_error()
945 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in max3421_transfer_in_done() local
967 if (max3421_hcd->curr_len < max_packet) { in max3421_transfer_in_done()
988 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in max3421_transfer_out_done() local
990 urb->actual_length += max3421_hcd->curr_len; in max3421_transfer_out_done()
1003 if (max3421_hcd->curr_len == max_packet) in max3421_transfer_out_done()
1015 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in max3421_host_transfer_done() local
1016 struct urb *urb = max3421_hcd->curr_urb; in max3421_host_transfer_done()
1021 max3421_hcd->hien &= ~(BIT(MAX3421_HI_HXFRDN_BIT) | in max3421_host_transfer_done()
1028 ++max3421_hcd->err_stat[result_code]; in max3421_host_transfer_done()
1059 max3421_hcd->urb_done = urb_done = 0; in max3421_host_transfer_done()
1070 max3421_hcd->urb_done = urb_done; in max3421_host_transfer_done()
1081 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in max3421_detect_conn() local
1092 mode = max3421_hcd->mode; in max3421_detect_conn()
1117 max3421_hcd->mode = mode; in max3421_detect_conn()
1118 spi_wr8(hcd, MAX3421_REG_MODE, max3421_hcd->mode); in max3421_detect_conn()
1120 spin_lock_irqsave(&max3421_hcd->lock, flags); in max3421_detect_conn()
1121 old_port_status = max3421_hcd->port_status; in max3421_detect_conn()
1123 max3421_hcd->port_status |= USB_PORT_STAT_CONNECTION; in max3421_detect_conn()
1125 max3421_hcd->port_status &= ~USB_PORT_STAT_CONNECTION; in max3421_detect_conn()
1127 max3421_hcd->port_status |= USB_PORT_STAT_LOW_SPEED; in max3421_detect_conn()
1129 max3421_hcd->port_status &= ~USB_PORT_STAT_LOW_SPEED; in max3421_detect_conn()
1130 chg = (old_port_status ^ max3421_hcd->port_status); in max3421_detect_conn()
1131 max3421_hcd->port_status |= chg << 16; in max3421_detect_conn()
1132 spin_unlock_irqrestore(&max3421_hcd->lock, flags); in max3421_detect_conn()
1140 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in max3421_irq_handler() local
1142 if (max3421_hcd->spi_thread && in max3421_irq_handler()
1143 max3421_hcd->spi_thread->state != TASK_RUNNING) in max3421_irq_handler()
1144 wake_up_process(max3421_hcd->spi_thread); in max3421_irq_handler()
1145 if (!test_and_set_bit(ENABLE_IRQ, &max3421_hcd->todo)) in max3421_irq_handler()
1155 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in dump_eps() local
1163 spin_lock_irqsave(&max3421_hcd->lock, flags); in dump_eps()
1164 list_for_each_entry(max3421_ep, &max3421_hcd->ep_list, ep_list) { in dump_eps()
1187 spin_unlock_irqrestore(&max3421_hcd->lock, flags); in dump_eps()
1196 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in max3421_handle_irqs() local
1207 hirq &= max3421_hcd->hien; in max3421_handle_irqs()
1216 max3421_hcd->frame_number = ((max3421_hcd->frame_number + 1) in max3421_handle_irqs()
1218 max3421_hcd->sched_pass = SCHED_PASS_PERIODIC; in max3421_handle_irqs()
1234 spin_lock_irqsave(&max3421_hcd->lock, flags); in max3421_handle_irqs()
1236 old_port_status = max3421_hcd->port_status; in max3421_handle_irqs()
1238 if (max3421_hcd->port_status & USB_PORT_STAT_RESET) { in max3421_handle_irqs()
1240 max3421_hcd->port_status &= ~USB_PORT_STAT_RESET; in max3421_handle_irqs()
1241 max3421_hcd->port_status |= USB_PORT_STAT_ENABLE; in max3421_handle_irqs()
1252 chg = (old_port_status ^ max3421_hcd->port_status); in max3421_handle_irqs()
1253 max3421_hcd->port_status |= chg << 16; in max3421_handle_irqs()
1255 spin_unlock_irqrestore(&max3421_hcd->lock, flags); in max3421_handle_irqs()
1269 max3421_hcd->err_stat[i]); in max3421_handle_irqs()
1275 memset(max3421_hcd->err_stat, 0, in max3421_handle_irqs()
1276 sizeof(max3421_hcd->err_stat)); in max3421_handle_irqs()
1290 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in max3421_reset_hcd() local
1314 max3421_hcd->mode = (BIT(MAX3421_MODE_HOST_BIT) | in max3421_reset_hcd()
1318 spi_wr8(hcd, MAX3421_REG_MODE, max3421_hcd->mode); in max3421_reset_hcd()
1321 max3421_hcd->frame_number = USB_MAX_FRAME_NUMBER; in max3421_reset_hcd()
1329 max3421_hcd->hien = (BIT(MAX3421_HI_FRAME_BIT) | in max3421_reset_hcd()
1332 spi_wr8(hcd, MAX3421_REG_HIEN, max3421_hcd->hien); in max3421_reset_hcd()
1342 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in max3421_urb_done() local
1347 status = max3421_hcd->urb_done; in max3421_urb_done()
1348 max3421_hcd->urb_done = 0; in max3421_urb_done()
1351 urb = max3421_hcd->curr_urb; in max3421_urb_done()
1363 max3421_hcd->curr_urb = NULL; in max3421_urb_done()
1364 spin_lock_irqsave(&max3421_hcd->lock, flags); in max3421_urb_done()
1366 spin_unlock_irqrestore(&max3421_hcd->lock, flags); in max3421_urb_done()
1379 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in max3421_spi_thread() local
1388 max3421_hcd->rev = spi_rd8(hcd, MAX3421_REG_REVISION); in max3421_spi_thread()
1389 if (max3421_hcd->rev == 0x12 || max3421_hcd->rev == 0x13) in max3421_spi_thread()
1391 dev_err(&spi->dev, "bad rev 0x%02x", max3421_hcd->rev); in max3421_spi_thread()
1395 max3421_hcd->rev, spi->max_speed_hz, spi->bits_per_word, in max3421_spi_thread()
1405 spi_wr8(hcd, MAX3421_REG_HIEN, max3421_hcd->hien); in max3421_spi_thread()
1408 if (test_and_clear_bit(ENABLE_IRQ, &max3421_hcd->todo)) in max3421_spi_thread()
1416 if (max3421_hcd->urb_done) in max3421_spi_thread()
1420 else if (!max3421_hcd->curr_urb) in max3421_spi_thread()
1423 if (test_and_clear_bit(RESET_HCD, &max3421_hcd->todo)) in max3421_spi_thread()
1426 if (test_and_clear_bit(RESET_PORT, &max3421_hcd->todo)) { in max3421_spi_thread()
1432 if (test_and_clear_bit(CHECK_UNLINK, &max3421_hcd->todo)) in max3421_spi_thread()
1434 if (test_and_clear_bit(IOPIN_UPDATE, &max3421_hcd->todo)) { in max3421_spi_thread()
1439 for (i = 0; i < ARRAY_SIZE(max3421_hcd->iopins); ++i) { in max3421_spi_thread()
1443 (max3421_hcd->iopins[i] & 0x0f)); in max3421_spi_thread()
1445 max3421_hcd->iopins[i] = val; in max3421_spi_thread()
1458 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in max3421_reset_port() local
1460 max3421_hcd->port_status &= ~(USB_PORT_STAT_ENABLE | in max3421_reset_port()
1462 max3421_hcd->port_status |= USB_PORT_STAT_RESET; in max3421_reset_port()
1463 set_bit(RESET_PORT, &max3421_hcd->todo); in max3421_reset_port()
1464 wake_up_process(max3421_hcd->spi_thread); in max3421_reset_port()
1471 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in max3421_reset() local
1476 set_bit(RESET_HCD, &max3421_hcd->todo); in max3421_reset()
1477 wake_up_process(max3421_hcd->spi_thread); in max3421_reset()
1484 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in max3421_start() local
1486 spin_lock_init(&max3421_hcd->lock); in max3421_start()
1487 max3421_hcd->rh_state = MAX3421_RH_RUNNING; in max3421_start()
1489 INIT_LIST_HEAD(&max3421_hcd->ep_list); in max3421_start()
1506 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in max3421_urb_enqueue() local
1524 spin_lock_irqsave(&max3421_hcd->lock, flags); in max3421_urb_enqueue()
1535 max3421_ep->last_active = max3421_hcd->frame_number; in max3421_urb_enqueue()
1538 list_add_tail(&max3421_ep->ep_list, &max3421_hcd->ep_list); in max3421_urb_enqueue()
1544 max3421_hcd->sched_pass = SCHED_PASS_PERIODIC; in max3421_urb_enqueue()
1545 wake_up_process(max3421_hcd->spi_thread); in max3421_urb_enqueue()
1549 spin_unlock_irqrestore(&max3421_hcd->lock, flags); in max3421_urb_enqueue()
1556 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in max3421_urb_dequeue() local
1560 spin_lock_irqsave(&max3421_hcd->lock, flags); in max3421_urb_dequeue()
1568 set_bit(CHECK_UNLINK, &max3421_hcd->todo); in max3421_urb_dequeue()
1569 wake_up_process(max3421_hcd->spi_thread); in max3421_urb_dequeue()
1571 spin_unlock_irqrestore(&max3421_hcd->lock, flags); in max3421_urb_dequeue()
1578 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in max3421_endpoint_disable() local
1581 spin_lock_irqsave(&max3421_hcd->lock, flags); in max3421_endpoint_disable()
1593 spin_unlock_irqrestore(&max3421_hcd->lock, flags); in max3421_endpoint_disable()
1599 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in max3421_get_frame_number() local
1600 return max3421_hcd->frame_number; in max3421_get_frame_number()
1610 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in max3421_hub_status_data() local
1614 spin_lock_irqsave(&max3421_hcd->lock, flags); in max3421_hub_status_data()
1619 if ((max3421_hcd->port_status & PORT_C_MASK) != 0) { in max3421_hub_status_data()
1623 max3421_hcd->port_status); in max3421_hub_status_data()
1625 if (max3421_hcd->rh_state == MAX3421_RH_SUSPENDED) in max3421_hub_status_data()
1629 spin_unlock_irqrestore(&max3421_hcd->lock, flags); in max3421_hub_status_data()
1655 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in max3421_gpout_set_value() local
1666 max3421_hcd->iopins[idx] |= mask; in max3421_gpout_set_value()
1668 max3421_hcd->iopins[idx] &= ~mask; in max3421_gpout_set_value()
1669 set_bit(IOPIN_UPDATE, &max3421_hcd->todo); in max3421_gpout_set_value()
1670 wake_up_process(max3421_hcd->spi_thread); in max3421_gpout_set_value()
1678 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd); in max3421_hub_control() local
1685 spin_lock_irqsave(&max3421_hcd->lock, flags); in max3421_hub_control()
1700 max3421_hcd->port_status &= ~(1 << value); in max3421_hub_control()
1722 ((__le16 *) buf)[0] = cpu_to_le16(max3421_hcd->port_status); in max3421_hub_control()
1724 cpu_to_le16(max3421_hcd->port_status >> 16); in max3421_hub_control()
1739 if (max3421_hcd->active) in max3421_hub_control()
1740 max3421_hcd->port_status |= in max3421_hub_control()
1745 max3421_hcd->port_status |= USB_PORT_STAT_POWER; in max3421_hub_control()
1753 if ((max3421_hcd->port_status & USB_PORT_STAT_POWER) in max3421_hub_control()
1755 max3421_hcd->port_status |= (1 << value); in max3421_hub_control()
1767 spin_unlock_irqrestore(&max3421_hcd->lock, flags); in max3421_hub_control()
1786 .hcd_priv_size = sizeof(struct max3421_hcd),
1827 struct max3421_hcd *max3421_hcd; in max3421_probe() local
1880 max3421_hcd = hcd_to_max3421(hcd); in max3421_probe()
1881 INIT_LIST_HEAD(&max3421_hcd->ep_list); in max3421_probe()
1882 spi_set_drvdata(spi, max3421_hcd); in max3421_probe()
1884 max3421_hcd->tx = kmalloc(sizeof(*max3421_hcd->tx), GFP_KERNEL); in max3421_probe()
1885 if (!max3421_hcd->tx) in max3421_probe()
1887 max3421_hcd->rx = kmalloc(sizeof(*max3421_hcd->rx), GFP_KERNEL); in max3421_probe()
1888 if (!max3421_hcd->rx) in max3421_probe()
1891 max3421_hcd->spi_thread = kthread_run(max3421_spi_thread, hcd, in max3421_probe()
1893 if (max3421_hcd->spi_thread == ERR_PTR(-ENOMEM)) { in max3421_probe()
1920 kfree(max3421_hcd->tx); in max3421_probe()
1921 kfree(max3421_hcd->rx); in max3421_probe()
1922 if (max3421_hcd->spi_thread) in max3421_probe()
1923 kthread_stop(max3421_hcd->spi_thread); in max3421_probe()
1932 struct max3421_hcd *max3421_hcd; in max3421_remove() local
1936 max3421_hcd = spi_get_drvdata(spi); in max3421_remove()
1937 hcd = max3421_to_hcd(max3421_hcd); in max3421_remove()
1941 spin_lock_irqsave(&max3421_hcd->lock, flags); in max3421_remove()
1943 kthread_stop(max3421_hcd->spi_thread); in max3421_remove()
1945 spin_unlock_irqrestore(&max3421_hcd->lock, flags); in max3421_remove()