Lines Matching refs:max3421_hcd
104 /* Bit numbers for max3421_hcd->todo: */
117 struct max3421_hcd {
328 static inline struct max3421_hcd *
331 return (struct max3421_hcd *) hcd->hcd_priv;
335 max3421_to_hcd(struct max3421_hcd *max3421_hcd)
337 return container_of((void *) max3421_hcd, struct usb_hcd, hcd_priv);
343 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd);
352 max3421_hcd->tx->data[0] =
356 transfer.tx_buf = max3421_hcd->tx->data;
357 transfer.rx_buf = max3421_hcd->rx->data;
363 return max3421_hcd->rx->data[1];
370 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd);
378 max3421_hcd->tx->data[0] =
381 max3421_hcd->tx->data[1] = val;
383 transfer.tx_buf = max3421_hcd->tx->data;
394 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd);
402 max3421_hcd->tx->data[0] =
405 transfer[0].tx_buf = max3421_hcd->tx->data;
420 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd);
428 max3421_hcd->tx->data[0] =
432 transfer[0].tx_buf = max3421_hcd->tx->data;
459 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd);
460 u8 mode_lowspeed, mode_hubpre, mode = max3421_hcd->mode;
464 if (max3421_hcd->port_status & USB_PORT_STAT_LOW_SPEED) {
472 if (mode != max3421_hcd->mode) {
473 max3421_hcd->mode = mode;
474 spi_wr8(hcd, MAX3421_REG_MODE, max3421_hcd->mode);
514 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd);
517 max3421_hcd->curr_len = 0;
518 max3421_hcd->hien |= BIT(MAX3421_HI_RCVDAV_BIT);
526 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd);
534 if (max3421_hcd->rev == 0x12) {
538 spi_wr8(hcd, MAX3421_REG_SNDBC, max3421_hcd->curr_len);
553 max3421_hcd->urb_done = -EMSGSIZE;
556 max3421_hcd->curr_len = min((urb->transfer_buffer_length -
559 spi_wr_buf(hcd, MAX3421_REG_SNDFIFO, src, max3421_hcd->curr_len);
560 spi_wr8(hcd, MAX3421_REG_SNDBC, max3421_hcd->curr_len);
571 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd);
572 struct urb *urb = max3421_hcd->curr_urb;
611 max3421_hcd->hien |= BIT(MAX3421_HI_HXFRDN_BIT);
625 * o max3421_hcd->curr_urb MUST BE NULL.
632 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd);
640 spin_lock_irqsave(&max3421_hcd->lock, flags);
643 max3421_hcd->sched_pass < SCHED_PASS_DONE;
644 ++max3421_hcd->sched_pass)
645 list_for_each(pos, &max3421_hcd->ep_list) {
654 if (max3421_hcd->sched_pass !=
661 if (max3421_hcd->sched_pass !=
674 max3421_hcd->curr_urb = urb;
675 max3421_hcd->urb_done = 1;
676 spin_unlock_irqrestore(&max3421_hcd->lock,
688 max3421_hcd->frame_number) == 0)
695 max3421_hcd->frame_number)
707 if (frame_diff(max3421_hcd->frame_number,
720 list_move_tail(pos, &max3421_hcd->ep_list);
726 spin_unlock_irqrestore(&max3421_hcd->lock, flags);
730 urb = max3421_hcd->curr_urb = curr_urb;
749 spin_unlock_irqrestore(&max3421_hcd->lock, flags);
751 max3421_ep->last_active = max3421_hcd->frame_number;
767 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd);
774 spin_lock_irqsave(&max3421_hcd->lock, flags);
775 list_for_each_entry(max3421_ep, &max3421_hcd->ep_list, ep_list) {
782 if (urb == max3421_hcd->curr_urb) {
783 max3421_hcd->urb_done = 1;
784 max3421_hcd->hien &= ~(BIT(MAX3421_HI_HXFRDN_BIT) |
788 spin_unlock_irqrestore(&max3421_hcd->lock,
791 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];
942 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd);
964 if (max3421_hcd->curr_len < max_packet) {
985 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd);
987 urb->actual_length += max3421_hcd->curr_len;
1000 if (max3421_hcd->curr_len == max_packet)
1012 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd);
1013 struct urb *urb = max3421_hcd->curr_urb;
1018 max3421_hcd->hien &= ~(BIT(MAX3421_HI_HXFRDN_BIT) |
1025 ++max3421_hcd->err_stat[result_code];
1056 max3421_hcd->urb_done = urb_done = 0;
1067 max3421_hcd->urb_done = urb_done;
1078 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd);
1089 mode = max3421_hcd->mode;
1114 max3421_hcd->mode = mode;
1115 spi_wr8(hcd, MAX3421_REG_MODE, max3421_hcd->mode);
1117 spin_lock_irqsave(&max3421_hcd->lock, flags);
1118 old_port_status = max3421_hcd->port_status;
1120 max3421_hcd->port_status |= USB_PORT_STAT_CONNECTION;
1122 max3421_hcd->port_status &= ~USB_PORT_STAT_CONNECTION;
1124 max3421_hcd->port_status |= USB_PORT_STAT_LOW_SPEED;
1126 max3421_hcd->port_status &= ~USB_PORT_STAT_LOW_SPEED;
1127 chg = (old_port_status ^ max3421_hcd->port_status);
1128 max3421_hcd->port_status |= chg << 16;
1129 spin_unlock_irqrestore(&max3421_hcd->lock, flags);
1137 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd);
1139 if (max3421_hcd->spi_thread)
1140 wake_up_process(max3421_hcd->spi_thread);
1141 if (!test_and_set_bit(ENABLE_IRQ, &max3421_hcd->todo))
1151 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd);
1159 spin_lock_irqsave(&max3421_hcd->lock, flags);
1160 list_for_each_entry(max3421_ep, &max3421_hcd->ep_list, ep_list) {
1183 spin_unlock_irqrestore(&max3421_hcd->lock, flags);
1192 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd);
1203 hirq &= max3421_hcd->hien;
1212 max3421_hcd->frame_number = ((max3421_hcd->frame_number + 1)
1214 max3421_hcd->sched_pass = SCHED_PASS_PERIODIC;
1230 spin_lock_irqsave(&max3421_hcd->lock, flags);
1232 old_port_status = max3421_hcd->port_status;
1234 if (max3421_hcd->port_status & USB_PORT_STAT_RESET) {
1236 max3421_hcd->port_status &= ~USB_PORT_STAT_RESET;
1237 max3421_hcd->port_status |= USB_PORT_STAT_ENABLE;
1248 chg = (old_port_status ^ max3421_hcd->port_status);
1249 max3421_hcd->port_status |= chg << 16;
1251 spin_unlock_irqrestore(&max3421_hcd->lock, flags);
1265 max3421_hcd->err_stat[i]);
1271 memset(max3421_hcd->err_stat, 0,
1272 sizeof(max3421_hcd->err_stat));
1286 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd);
1310 max3421_hcd->mode = (BIT(MAX3421_MODE_HOST_BIT) |
1314 spi_wr8(hcd, MAX3421_REG_MODE, max3421_hcd->mode);
1317 max3421_hcd->frame_number = USB_MAX_FRAME_NUMBER;
1325 max3421_hcd->hien = (BIT(MAX3421_HI_FRAME_BIT) |
1328 spi_wr8(hcd, MAX3421_REG_HIEN, max3421_hcd->hien);
1338 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd);
1343 status = max3421_hcd->urb_done;
1344 max3421_hcd->urb_done = 0;
1347 urb = max3421_hcd->curr_urb;
1359 max3421_hcd->curr_urb = NULL;
1360 spin_lock_irqsave(&max3421_hcd->lock, flags);
1362 spin_unlock_irqrestore(&max3421_hcd->lock, flags);
1375 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd);
1384 max3421_hcd->rev = spi_rd8(hcd, MAX3421_REG_REVISION);
1385 if (max3421_hcd->rev == 0x12 || max3421_hcd->rev == 0x13)
1387 dev_err(&spi->dev, "bad rev 0x%02x", max3421_hcd->rev);
1391 max3421_hcd->rev, spi->max_speed_hz, spi->bits_per_word,
1401 spi_wr8(hcd, MAX3421_REG_HIEN, max3421_hcd->hien);
1404 if (test_and_clear_bit(ENABLE_IRQ, &max3421_hcd->todo))
1412 if (max3421_hcd->urb_done)
1416 else if (!max3421_hcd->curr_urb)
1419 if (test_and_clear_bit(RESET_HCD, &max3421_hcd->todo))
1422 if (test_and_clear_bit(RESET_PORT, &max3421_hcd->todo)) {
1428 if (test_and_clear_bit(CHECK_UNLINK, &max3421_hcd->todo))
1430 if (test_and_clear_bit(IOPIN_UPDATE, &max3421_hcd->todo)) {
1435 for (i = 0; i < ARRAY_SIZE(max3421_hcd->iopins); ++i) {
1439 (max3421_hcd->iopins[i] & 0x0f));
1441 max3421_hcd->iopins[i] = val;
1454 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd);
1456 max3421_hcd->port_status &= ~(USB_PORT_STAT_ENABLE |
1458 max3421_hcd->port_status |= USB_PORT_STAT_RESET;
1459 set_bit(RESET_PORT, &max3421_hcd->todo);
1460 wake_up_process(max3421_hcd->spi_thread);
1467 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd);
1472 set_bit(RESET_HCD, &max3421_hcd->todo);
1473 wake_up_process(max3421_hcd->spi_thread);
1480 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd);
1482 spin_lock_init(&max3421_hcd->lock);
1483 max3421_hcd->rh_state = MAX3421_RH_RUNNING;
1485 INIT_LIST_HEAD(&max3421_hcd->ep_list);
1502 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd);
1521 spin_lock_irqsave(&max3421_hcd->lock, flags);
1532 max3421_ep->last_active = max3421_hcd->frame_number;
1535 list_add_tail(&max3421_ep->ep_list, &max3421_hcd->ep_list);
1541 max3421_hcd->sched_pass = SCHED_PASS_PERIODIC;
1542 wake_up_process(max3421_hcd->spi_thread);
1546 spin_unlock_irqrestore(&max3421_hcd->lock, flags);
1553 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd);
1557 spin_lock_irqsave(&max3421_hcd->lock, flags);
1565 set_bit(CHECK_UNLINK, &max3421_hcd->todo);
1566 wake_up_process(max3421_hcd->spi_thread);
1568 spin_unlock_irqrestore(&max3421_hcd->lock, flags);
1575 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd);
1578 spin_lock_irqsave(&max3421_hcd->lock, flags);
1590 spin_unlock_irqrestore(&max3421_hcd->lock, flags);
1596 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd);
1597 return max3421_hcd->frame_number;
1607 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd);
1611 spin_lock_irqsave(&max3421_hcd->lock, flags);
1616 if ((max3421_hcd->port_status & PORT_C_MASK) != 0) {
1620 max3421_hcd->port_status);
1622 if (max3421_hcd->rh_state == MAX3421_RH_SUSPENDED)
1626 spin_unlock_irqrestore(&max3421_hcd->lock, flags);
1652 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd);
1663 max3421_hcd->iopins[idx] |= mask;
1665 max3421_hcd->iopins[idx] &= ~mask;
1666 set_bit(IOPIN_UPDATE, &max3421_hcd->todo);
1667 wake_up_process(max3421_hcd->spi_thread);
1675 struct max3421_hcd *max3421_hcd = hcd_to_max3421(hcd);
1682 spin_lock_irqsave(&max3421_hcd->lock, flags);
1697 max3421_hcd->port_status &= ~(1 << value);
1719 ((__le16 *) buf)[0] = cpu_to_le16(max3421_hcd->port_status);
1721 cpu_to_le16(max3421_hcd->port_status >> 16);
1736 if (max3421_hcd->active)
1737 max3421_hcd->port_status |=
1742 max3421_hcd->port_status |= USB_PORT_STAT_POWER;
1750 if ((max3421_hcd->port_status & USB_PORT_STAT_POWER)
1752 max3421_hcd->port_status |= (1 << value);
1764 spin_unlock_irqrestore(&max3421_hcd->lock, flags);
1783 .hcd_priv_size = sizeof(struct max3421_hcd),
1824 struct max3421_hcd *max3421_hcd;
1877 max3421_hcd = hcd_to_max3421(hcd);
1878 INIT_LIST_HEAD(&max3421_hcd->ep_list);
1879 spi_set_drvdata(spi, max3421_hcd);
1881 max3421_hcd->tx = kmalloc(sizeof(*max3421_hcd->tx), GFP_KERNEL);
1882 if (!max3421_hcd->tx)
1884 max3421_hcd->rx = kmalloc(sizeof(*max3421_hcd->rx), GFP_KERNEL);
1885 if (!max3421_hcd->rx)
1888 max3421_hcd->spi_thread = kthread_run(max3421_spi_thread, hcd,
1890 if (max3421_hcd->spi_thread == ERR_PTR(-ENOMEM)) {
1917 kfree(max3421_hcd->tx);
1918 kfree(max3421_hcd->rx);
1919 if (max3421_hcd->spi_thread)
1920 kthread_stop(max3421_hcd->spi_thread);
1929 struct max3421_hcd *max3421_hcd;
1933 max3421_hcd = spi_get_drvdata(spi);
1934 hcd = max3421_to_hcd(max3421_hcd);
1938 spin_lock_irqsave(&max3421_hcd->lock, flags);
1940 kthread_stop(max3421_hcd->spi_thread);
1942 spin_unlock_irqrestore(&max3421_hcd->lock, flags);