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