.. | .. |
---|
43 | 43 | |
---|
44 | 44 | /* Minihydra command IDs */ |
---|
45 | 45 | #define CMD_SET_BUSPARAMS_REQ 16 |
---|
| 46 | +#define CMD_GET_BUSPARAMS_REQ 17 |
---|
| 47 | +#define CMD_GET_BUSPARAMS_RESP 18 |
---|
46 | 48 | #define CMD_GET_CHIP_STATE_REQ 19 |
---|
47 | 49 | #define CMD_CHIP_STATE_EVENT 20 |
---|
48 | 50 | #define CMD_SET_DRIVERMODE_REQ 21 |
---|
.. | .. |
---|
193 | 195 | #define KVASER_USB_HYDRA_BUS_MODE_CANFD_ISO 0x01 |
---|
194 | 196 | #define KVASER_USB_HYDRA_BUS_MODE_NONISO 0x02 |
---|
195 | 197 | struct kvaser_cmd_set_busparams { |
---|
196 | | - __le32 bitrate; |
---|
197 | | - u8 tseg1; |
---|
198 | | - u8 tseg2; |
---|
199 | | - u8 sjw; |
---|
200 | | - u8 nsamples; |
---|
| 198 | + struct kvaser_usb_busparams busparams_nominal; |
---|
201 | 199 | u8 reserved0[4]; |
---|
202 | | - __le32 bitrate_d; |
---|
203 | | - u8 tseg1_d; |
---|
204 | | - u8 tseg2_d; |
---|
205 | | - u8 sjw_d; |
---|
206 | | - u8 nsamples_d; |
---|
| 200 | + struct kvaser_usb_busparams busparams_data; |
---|
207 | 201 | u8 canfd_mode; |
---|
208 | 202 | u8 reserved1[7]; |
---|
| 203 | +} __packed; |
---|
| 204 | + |
---|
| 205 | +/* Busparam type */ |
---|
| 206 | +#define KVASER_USB_HYDRA_BUSPARAM_TYPE_CAN 0x00 |
---|
| 207 | +#define KVASER_USB_HYDRA_BUSPARAM_TYPE_CANFD 0x01 |
---|
| 208 | +struct kvaser_cmd_get_busparams_req { |
---|
| 209 | + u8 type; |
---|
| 210 | + u8 reserved[27]; |
---|
| 211 | +} __packed; |
---|
| 212 | + |
---|
| 213 | +struct kvaser_cmd_get_busparams_res { |
---|
| 214 | + struct kvaser_usb_busparams busparams; |
---|
| 215 | + u8 reserved[20]; |
---|
209 | 216 | } __packed; |
---|
210 | 217 | |
---|
211 | 218 | /* Ctrl modes */ |
---|
.. | .. |
---|
278 | 285 | struct kvaser_cmd_error_event error_event; |
---|
279 | 286 | |
---|
280 | 287 | struct kvaser_cmd_set_busparams set_busparams_req; |
---|
| 288 | + struct kvaser_cmd_get_busparams_req get_busparams_req; |
---|
| 289 | + struct kvaser_cmd_get_busparams_res get_busparams_res; |
---|
281 | 290 | |
---|
282 | 291 | struct kvaser_cmd_chip_state_event chip_state_event; |
---|
283 | 292 | |
---|
.. | .. |
---|
293 | 302 | #define KVASER_USB_HYDRA_CF_FLAG_OVERRUN BIT(1) |
---|
294 | 303 | #define KVASER_USB_HYDRA_CF_FLAG_REMOTE_FRAME BIT(4) |
---|
295 | 304 | #define KVASER_USB_HYDRA_CF_FLAG_EXTENDED_ID BIT(5) |
---|
| 305 | +#define KVASER_USB_HYDRA_CF_FLAG_TX_ACK BIT(6) |
---|
296 | 306 | /* CAN frame flags. Used in ext_rx_can and ext_tx_can */ |
---|
297 | 307 | #define KVASER_USB_HYDRA_CF_FLAG_OSM_NACK BIT(12) |
---|
298 | 308 | #define KVASER_USB_HYDRA_CF_FLAG_ABL BIT(13) |
---|
.. | .. |
---|
358 | 368 | struct kvaser_cmd_ext_tx_ack tx_ack; |
---|
359 | 369 | } __packed; |
---|
360 | 370 | } __packed; |
---|
| 371 | + |
---|
| 372 | +struct kvaser_usb_net_hydra_priv { |
---|
| 373 | + int pending_get_busparams_type; |
---|
| 374 | +}; |
---|
361 | 375 | |
---|
362 | 376 | static const struct can_bittiming_const kvaser_usb_hydra_kcan_bittiming_c = { |
---|
363 | 377 | .name = "kvaser_usb_kcan", |
---|
.. | .. |
---|
504 | 518 | u8 cmd_no, int channel) |
---|
505 | 519 | { |
---|
506 | 520 | struct kvaser_cmd *cmd; |
---|
| 521 | + size_t cmd_len; |
---|
507 | 522 | int err; |
---|
508 | 523 | |
---|
509 | 524 | cmd = kcalloc(1, sizeof(struct kvaser_cmd), GFP_KERNEL); |
---|
.. | .. |
---|
511 | 526 | return -ENOMEM; |
---|
512 | 527 | |
---|
513 | 528 | cmd->header.cmd_no = cmd_no; |
---|
| 529 | + cmd_len = kvaser_usb_hydra_cmd_size(cmd); |
---|
514 | 530 | if (channel < 0) { |
---|
515 | 531 | kvaser_usb_hydra_set_cmd_dest_he |
---|
516 | 532 | (cmd, KVASER_USB_HYDRA_HE_ADDRESS_ILLEGAL); |
---|
.. | .. |
---|
527 | 543 | kvaser_usb_hydra_set_cmd_transid |
---|
528 | 544 | (cmd, kvaser_usb_hydra_get_next_transid(dev)); |
---|
529 | 545 | |
---|
530 | | - err = kvaser_usb_send_cmd(dev, cmd, kvaser_usb_hydra_cmd_size(cmd)); |
---|
| 546 | + err = kvaser_usb_send_cmd(dev, cmd, cmd_len); |
---|
531 | 547 | if (err) |
---|
532 | 548 | goto end; |
---|
533 | 549 | |
---|
.. | .. |
---|
543 | 559 | { |
---|
544 | 560 | struct kvaser_cmd *cmd; |
---|
545 | 561 | struct kvaser_usb *dev = priv->dev; |
---|
| 562 | + size_t cmd_len; |
---|
546 | 563 | int err; |
---|
547 | 564 | |
---|
548 | 565 | cmd = kcalloc(1, sizeof(struct kvaser_cmd), GFP_ATOMIC); |
---|
.. | .. |
---|
550 | 567 | return -ENOMEM; |
---|
551 | 568 | |
---|
552 | 569 | cmd->header.cmd_no = cmd_no; |
---|
| 570 | + cmd_len = kvaser_usb_hydra_cmd_size(cmd); |
---|
553 | 571 | |
---|
554 | 572 | kvaser_usb_hydra_set_cmd_dest_he |
---|
555 | 573 | (cmd, dev->card_data.hydra.channel_to_he[priv->channel]); |
---|
556 | 574 | kvaser_usb_hydra_set_cmd_transid |
---|
557 | 575 | (cmd, kvaser_usb_hydra_get_next_transid(dev)); |
---|
558 | 576 | |
---|
559 | | - err = kvaser_usb_send_cmd_async(priv, cmd, |
---|
560 | | - kvaser_usb_hydra_cmd_size(cmd)); |
---|
| 577 | + err = kvaser_usb_send_cmd_async(priv, cmd, cmd_len); |
---|
561 | 578 | if (err) |
---|
562 | 579 | kfree(cmd); |
---|
563 | 580 | |
---|
.. | .. |
---|
701 | 718 | { |
---|
702 | 719 | struct kvaser_usb_dev_card_data *card_data = &dev->card_data; |
---|
703 | 720 | struct kvaser_cmd *cmd; |
---|
| 721 | + size_t cmd_len; |
---|
704 | 722 | u32 value = 0; |
---|
705 | 723 | u32 mask = 0; |
---|
706 | 724 | u16 cap_cmd_res; |
---|
.. | .. |
---|
712 | 730 | return -ENOMEM; |
---|
713 | 731 | |
---|
714 | 732 | cmd->header.cmd_no = CMD_GET_CAPABILITIES_REQ; |
---|
| 733 | + cmd_len = kvaser_usb_hydra_cmd_size(cmd); |
---|
715 | 734 | cmd->cap_req.cap_cmd = cpu_to_le16(cap_cmd_req); |
---|
716 | 735 | |
---|
717 | 736 | kvaser_usb_hydra_set_cmd_dest_he(cmd, card_data->hydra.sysdbg_he); |
---|
718 | 737 | kvaser_usb_hydra_set_cmd_transid |
---|
719 | 738 | (cmd, kvaser_usb_hydra_get_next_transid(dev)); |
---|
720 | 739 | |
---|
721 | | - err = kvaser_usb_send_cmd(dev, cmd, kvaser_usb_hydra_cmd_size(cmd)); |
---|
| 740 | + err = kvaser_usb_send_cmd(dev, cmd, cmd_len); |
---|
722 | 741 | if (err) |
---|
723 | 742 | goto end; |
---|
724 | 743 | |
---|
.. | .. |
---|
810 | 829 | return; |
---|
811 | 830 | |
---|
812 | 831 | complete(&priv->flush_comp); |
---|
| 832 | +} |
---|
| 833 | + |
---|
| 834 | +static void kvaser_usb_hydra_get_busparams_reply(const struct kvaser_usb *dev, |
---|
| 835 | + const struct kvaser_cmd *cmd) |
---|
| 836 | +{ |
---|
| 837 | + struct kvaser_usb_net_priv *priv; |
---|
| 838 | + struct kvaser_usb_net_hydra_priv *hydra; |
---|
| 839 | + |
---|
| 840 | + priv = kvaser_usb_hydra_net_priv_from_cmd(dev, cmd); |
---|
| 841 | + if (!priv) |
---|
| 842 | + return; |
---|
| 843 | + |
---|
| 844 | + hydra = priv->sub_priv; |
---|
| 845 | + if (!hydra) |
---|
| 846 | + return; |
---|
| 847 | + |
---|
| 848 | + switch (hydra->pending_get_busparams_type) { |
---|
| 849 | + case KVASER_USB_HYDRA_BUSPARAM_TYPE_CAN: |
---|
| 850 | + memcpy(&priv->busparams_nominal, &cmd->get_busparams_res.busparams, |
---|
| 851 | + sizeof(priv->busparams_nominal)); |
---|
| 852 | + break; |
---|
| 853 | + case KVASER_USB_HYDRA_BUSPARAM_TYPE_CANFD: |
---|
| 854 | + memcpy(&priv->busparams_data, &cmd->get_busparams_res.busparams, |
---|
| 855 | + sizeof(priv->busparams_nominal)); |
---|
| 856 | + break; |
---|
| 857 | + default: |
---|
| 858 | + dev_warn(&dev->intf->dev, "Unknown get_busparams_type %d\n", |
---|
| 859 | + hydra->pending_get_busparams_type); |
---|
| 860 | + break; |
---|
| 861 | + } |
---|
| 862 | + hydra->pending_get_busparams_type = -1; |
---|
| 863 | + |
---|
| 864 | + complete(&priv->get_busparams_comp); |
---|
813 | 865 | } |
---|
814 | 866 | |
---|
815 | 867 | static void |
---|
.. | .. |
---|
1099 | 1151 | struct kvaser_usb_net_priv *priv; |
---|
1100 | 1152 | unsigned long irq_flags; |
---|
1101 | 1153 | bool one_shot_fail = false; |
---|
| 1154 | + bool is_err_frame = false; |
---|
1102 | 1155 | u16 transid = kvaser_usb_hydra_get_cmd_transid(cmd); |
---|
1103 | 1156 | |
---|
1104 | 1157 | priv = kvaser_usb_hydra_net_priv_from_cmd(dev, cmd); |
---|
.. | .. |
---|
1117 | 1170 | kvaser_usb_hydra_one_shot_fail(priv, cmd_ext); |
---|
1118 | 1171 | one_shot_fail = true; |
---|
1119 | 1172 | } |
---|
| 1173 | + |
---|
| 1174 | + is_err_frame = flags & KVASER_USB_HYDRA_CF_FLAG_TX_ACK && |
---|
| 1175 | + flags & KVASER_USB_HYDRA_CF_FLAG_ERROR_FRAME; |
---|
1120 | 1176 | } |
---|
1121 | 1177 | |
---|
1122 | 1178 | context = &priv->tx_contexts[transid % dev->max_tx_urbs]; |
---|
1123 | | - if (!one_shot_fail) { |
---|
| 1179 | + if (!one_shot_fail && !is_err_frame) { |
---|
1124 | 1180 | struct net_device_stats *stats = &priv->netdev->stats; |
---|
1125 | 1181 | |
---|
1126 | 1182 | stats->tx_packets++; |
---|
.. | .. |
---|
1292 | 1348 | |
---|
1293 | 1349 | case CMD_CHIP_STATE_EVENT: |
---|
1294 | 1350 | kvaser_usb_hydra_state_event(dev, cmd); |
---|
| 1351 | + break; |
---|
| 1352 | + |
---|
| 1353 | + case CMD_GET_BUSPARAMS_RESP: |
---|
| 1354 | + kvaser_usb_hydra_get_busparams_reply(dev, cmd); |
---|
1295 | 1355 | break; |
---|
1296 | 1356 | |
---|
1297 | 1357 | case CMD_ERROR_EVENT: |
---|
.. | .. |
---|
1494 | 1554 | return err; |
---|
1495 | 1555 | } |
---|
1496 | 1556 | |
---|
1497 | | -static int kvaser_usb_hydra_set_bittiming(struct net_device *netdev) |
---|
| 1557 | +static int kvaser_usb_hydra_get_busparams(struct kvaser_usb_net_priv *priv, |
---|
| 1558 | + int busparams_type) |
---|
| 1559 | +{ |
---|
| 1560 | + struct kvaser_usb *dev = priv->dev; |
---|
| 1561 | + struct kvaser_usb_net_hydra_priv *hydra = priv->sub_priv; |
---|
| 1562 | + struct kvaser_cmd *cmd; |
---|
| 1563 | + size_t cmd_len; |
---|
| 1564 | + int err; |
---|
| 1565 | + |
---|
| 1566 | + if (!hydra) |
---|
| 1567 | + return -EINVAL; |
---|
| 1568 | + |
---|
| 1569 | + cmd = kcalloc(1, sizeof(struct kvaser_cmd), GFP_KERNEL); |
---|
| 1570 | + if (!cmd) |
---|
| 1571 | + return -ENOMEM; |
---|
| 1572 | + |
---|
| 1573 | + cmd->header.cmd_no = CMD_GET_BUSPARAMS_REQ; |
---|
| 1574 | + cmd_len = kvaser_usb_hydra_cmd_size(cmd); |
---|
| 1575 | + kvaser_usb_hydra_set_cmd_dest_he |
---|
| 1576 | + (cmd, dev->card_data.hydra.channel_to_he[priv->channel]); |
---|
| 1577 | + kvaser_usb_hydra_set_cmd_transid |
---|
| 1578 | + (cmd, kvaser_usb_hydra_get_next_transid(dev)); |
---|
| 1579 | + cmd->get_busparams_req.type = busparams_type; |
---|
| 1580 | + hydra->pending_get_busparams_type = busparams_type; |
---|
| 1581 | + |
---|
| 1582 | + reinit_completion(&priv->get_busparams_comp); |
---|
| 1583 | + |
---|
| 1584 | + err = kvaser_usb_send_cmd(dev, cmd, cmd_len); |
---|
| 1585 | + if (err) |
---|
| 1586 | + return err; |
---|
| 1587 | + |
---|
| 1588 | + if (!wait_for_completion_timeout(&priv->get_busparams_comp, |
---|
| 1589 | + msecs_to_jiffies(KVASER_USB_TIMEOUT))) |
---|
| 1590 | + return -ETIMEDOUT; |
---|
| 1591 | + |
---|
| 1592 | + return err; |
---|
| 1593 | +} |
---|
| 1594 | + |
---|
| 1595 | +static int kvaser_usb_hydra_get_nominal_busparams(struct kvaser_usb_net_priv *priv) |
---|
| 1596 | +{ |
---|
| 1597 | + return kvaser_usb_hydra_get_busparams(priv, KVASER_USB_HYDRA_BUSPARAM_TYPE_CAN); |
---|
| 1598 | +} |
---|
| 1599 | + |
---|
| 1600 | +static int kvaser_usb_hydra_get_data_busparams(struct kvaser_usb_net_priv *priv) |
---|
| 1601 | +{ |
---|
| 1602 | + return kvaser_usb_hydra_get_busparams(priv, KVASER_USB_HYDRA_BUSPARAM_TYPE_CANFD); |
---|
| 1603 | +} |
---|
| 1604 | + |
---|
| 1605 | +static int kvaser_usb_hydra_set_bittiming(const struct net_device *netdev, |
---|
| 1606 | + const struct kvaser_usb_busparams *busparams) |
---|
1498 | 1607 | { |
---|
1499 | 1608 | struct kvaser_cmd *cmd; |
---|
1500 | 1609 | struct kvaser_usb_net_priv *priv = netdev_priv(netdev); |
---|
1501 | | - struct can_bittiming *bt = &priv->can.bittiming; |
---|
1502 | 1610 | struct kvaser_usb *dev = priv->dev; |
---|
1503 | | - int tseg1 = bt->prop_seg + bt->phase_seg1; |
---|
1504 | | - int tseg2 = bt->phase_seg2; |
---|
1505 | | - int sjw = bt->sjw; |
---|
| 1611 | + size_t cmd_len; |
---|
1506 | 1612 | int err; |
---|
1507 | 1613 | |
---|
1508 | 1614 | cmd = kcalloc(1, sizeof(struct kvaser_cmd), GFP_KERNEL); |
---|
.. | .. |
---|
1510 | 1616 | return -ENOMEM; |
---|
1511 | 1617 | |
---|
1512 | 1618 | cmd->header.cmd_no = CMD_SET_BUSPARAMS_REQ; |
---|
1513 | | - cmd->set_busparams_req.bitrate = cpu_to_le32(bt->bitrate); |
---|
1514 | | - cmd->set_busparams_req.sjw = (u8)sjw; |
---|
1515 | | - cmd->set_busparams_req.tseg1 = (u8)tseg1; |
---|
1516 | | - cmd->set_busparams_req.tseg2 = (u8)tseg2; |
---|
1517 | | - cmd->set_busparams_req.nsamples = 1; |
---|
| 1619 | + cmd_len = kvaser_usb_hydra_cmd_size(cmd); |
---|
| 1620 | + memcpy(&cmd->set_busparams_req.busparams_nominal, busparams, |
---|
| 1621 | + sizeof(cmd->set_busparams_req.busparams_nominal)); |
---|
1518 | 1622 | |
---|
1519 | 1623 | kvaser_usb_hydra_set_cmd_dest_he |
---|
1520 | 1624 | (cmd, dev->card_data.hydra.channel_to_he[priv->channel]); |
---|
1521 | 1625 | kvaser_usb_hydra_set_cmd_transid |
---|
1522 | 1626 | (cmd, kvaser_usb_hydra_get_next_transid(dev)); |
---|
1523 | 1627 | |
---|
1524 | | - err = kvaser_usb_send_cmd(dev, cmd, kvaser_usb_hydra_cmd_size(cmd)); |
---|
| 1628 | + err = kvaser_usb_send_cmd(dev, cmd, cmd_len); |
---|
1525 | 1629 | |
---|
1526 | 1630 | kfree(cmd); |
---|
1527 | 1631 | |
---|
1528 | 1632 | return err; |
---|
1529 | 1633 | } |
---|
1530 | 1634 | |
---|
1531 | | -static int kvaser_usb_hydra_set_data_bittiming(struct net_device *netdev) |
---|
| 1635 | +static int kvaser_usb_hydra_set_data_bittiming(const struct net_device *netdev, |
---|
| 1636 | + const struct kvaser_usb_busparams *busparams) |
---|
1532 | 1637 | { |
---|
1533 | 1638 | struct kvaser_cmd *cmd; |
---|
1534 | 1639 | struct kvaser_usb_net_priv *priv = netdev_priv(netdev); |
---|
1535 | | - struct can_bittiming *dbt = &priv->can.data_bittiming; |
---|
1536 | 1640 | struct kvaser_usb *dev = priv->dev; |
---|
1537 | | - int tseg1 = dbt->prop_seg + dbt->phase_seg1; |
---|
1538 | | - int tseg2 = dbt->phase_seg2; |
---|
1539 | | - int sjw = dbt->sjw; |
---|
| 1641 | + size_t cmd_len; |
---|
1540 | 1642 | int err; |
---|
1541 | 1643 | |
---|
1542 | 1644 | cmd = kcalloc(1, sizeof(struct kvaser_cmd), GFP_KERNEL); |
---|
.. | .. |
---|
1544 | 1646 | return -ENOMEM; |
---|
1545 | 1647 | |
---|
1546 | 1648 | cmd->header.cmd_no = CMD_SET_BUSPARAMS_FD_REQ; |
---|
1547 | | - cmd->set_busparams_req.bitrate_d = cpu_to_le32(dbt->bitrate); |
---|
1548 | | - cmd->set_busparams_req.sjw_d = (u8)sjw; |
---|
1549 | | - cmd->set_busparams_req.tseg1_d = (u8)tseg1; |
---|
1550 | | - cmd->set_busparams_req.tseg2_d = (u8)tseg2; |
---|
1551 | | - cmd->set_busparams_req.nsamples_d = 1; |
---|
| 1649 | + cmd_len = kvaser_usb_hydra_cmd_size(cmd); |
---|
| 1650 | + memcpy(&cmd->set_busparams_req.busparams_data, busparams, |
---|
| 1651 | + sizeof(cmd->set_busparams_req.busparams_data)); |
---|
1552 | 1652 | |
---|
1553 | 1653 | if (priv->can.ctrlmode & CAN_CTRLMODE_FD) { |
---|
1554 | 1654 | if (priv->can.ctrlmode & CAN_CTRLMODE_FD_NON_ISO) |
---|
.. | .. |
---|
1564 | 1664 | kvaser_usb_hydra_set_cmd_transid |
---|
1565 | 1665 | (cmd, kvaser_usb_hydra_get_next_transid(dev)); |
---|
1566 | 1666 | |
---|
1567 | | - err = kvaser_usb_send_cmd(dev, cmd, kvaser_usb_hydra_cmd_size(cmd)); |
---|
| 1667 | + err = kvaser_usb_send_cmd(dev, cmd, cmd_len); |
---|
1568 | 1668 | |
---|
1569 | 1669 | kfree(cmd); |
---|
1570 | 1670 | |
---|
.. | .. |
---|
1655 | 1755 | return 0; |
---|
1656 | 1756 | } |
---|
1657 | 1757 | |
---|
| 1758 | +static int kvaser_usb_hydra_init_channel(struct kvaser_usb_net_priv *priv) |
---|
| 1759 | +{ |
---|
| 1760 | + struct kvaser_usb_net_hydra_priv *hydra; |
---|
| 1761 | + |
---|
| 1762 | + hydra = devm_kzalloc(&priv->dev->intf->dev, sizeof(*hydra), GFP_KERNEL); |
---|
| 1763 | + if (!hydra) |
---|
| 1764 | + return -ENOMEM; |
---|
| 1765 | + |
---|
| 1766 | + priv->sub_priv = hydra; |
---|
| 1767 | + |
---|
| 1768 | + return 0; |
---|
| 1769 | +} |
---|
| 1770 | + |
---|
1658 | 1771 | static int kvaser_usb_hydra_get_software_info(struct kvaser_usb *dev) |
---|
1659 | 1772 | { |
---|
1660 | 1773 | struct kvaser_cmd cmd; |
---|
.. | .. |
---|
1679 | 1792 | static int kvaser_usb_hydra_get_software_details(struct kvaser_usb *dev) |
---|
1680 | 1793 | { |
---|
1681 | 1794 | struct kvaser_cmd *cmd; |
---|
| 1795 | + size_t cmd_len; |
---|
1682 | 1796 | int err; |
---|
1683 | 1797 | u32 flags; |
---|
1684 | 1798 | struct kvaser_usb_dev_card_data *card_data = &dev->card_data; |
---|
.. | .. |
---|
1688 | 1802 | return -ENOMEM; |
---|
1689 | 1803 | |
---|
1690 | 1804 | cmd->header.cmd_no = CMD_GET_SOFTWARE_DETAILS_REQ; |
---|
| 1805 | + cmd_len = kvaser_usb_hydra_cmd_size(cmd); |
---|
1691 | 1806 | cmd->sw_detail_req.use_ext_cmd = 1; |
---|
1692 | 1807 | kvaser_usb_hydra_set_cmd_dest_he |
---|
1693 | 1808 | (cmd, KVASER_USB_HYDRA_HE_ADDRESS_ILLEGAL); |
---|
.. | .. |
---|
1695 | 1810 | kvaser_usb_hydra_set_cmd_transid |
---|
1696 | 1811 | (cmd, kvaser_usb_hydra_get_next_transid(dev)); |
---|
1697 | 1812 | |
---|
1698 | | - err = kvaser_usb_send_cmd(dev, cmd, kvaser_usb_hydra_cmd_size(cmd)); |
---|
| 1813 | + err = kvaser_usb_send_cmd(dev, cmd, cmd_len); |
---|
1699 | 1814 | if (err) |
---|
1700 | 1815 | goto end; |
---|
1701 | 1816 | |
---|
.. | .. |
---|
1811 | 1926 | { |
---|
1812 | 1927 | struct kvaser_usb *dev = priv->dev; |
---|
1813 | 1928 | struct kvaser_cmd *cmd; |
---|
| 1929 | + size_t cmd_len; |
---|
1814 | 1930 | int err; |
---|
1815 | 1931 | |
---|
1816 | 1932 | if ((priv->can.ctrlmode & |
---|
.. | .. |
---|
1826 | 1942 | return -ENOMEM; |
---|
1827 | 1943 | |
---|
1828 | 1944 | cmd->header.cmd_no = CMD_SET_DRIVERMODE_REQ; |
---|
| 1945 | + cmd_len = kvaser_usb_hydra_cmd_size(cmd); |
---|
1829 | 1946 | kvaser_usb_hydra_set_cmd_dest_he |
---|
1830 | 1947 | (cmd, dev->card_data.hydra.channel_to_he[priv->channel]); |
---|
1831 | 1948 | kvaser_usb_hydra_set_cmd_transid |
---|
.. | .. |
---|
1835 | 1952 | else |
---|
1836 | 1953 | cmd->set_ctrlmode.mode = KVASER_USB_HYDRA_CTRLMODE_NORMAL; |
---|
1837 | 1954 | |
---|
1838 | | - err = kvaser_usb_send_cmd(dev, cmd, kvaser_usb_hydra_cmd_size(cmd)); |
---|
| 1955 | + err = kvaser_usb_send_cmd(dev, cmd, cmd_len); |
---|
1839 | 1956 | kfree(cmd); |
---|
1840 | 1957 | |
---|
1841 | 1958 | return err; |
---|
.. | .. |
---|
1997 | 2114 | const struct kvaser_usb_dev_ops kvaser_usb_hydra_dev_ops = { |
---|
1998 | 2115 | .dev_set_mode = kvaser_usb_hydra_set_mode, |
---|
1999 | 2116 | .dev_set_bittiming = kvaser_usb_hydra_set_bittiming, |
---|
| 2117 | + .dev_get_busparams = kvaser_usb_hydra_get_nominal_busparams, |
---|
2000 | 2118 | .dev_set_data_bittiming = kvaser_usb_hydra_set_data_bittiming, |
---|
| 2119 | + .dev_get_data_busparams = kvaser_usb_hydra_get_data_busparams, |
---|
2001 | 2120 | .dev_get_berr_counter = kvaser_usb_hydra_get_berr_counter, |
---|
2002 | 2121 | .dev_setup_endpoints = kvaser_usb_hydra_setup_endpoints, |
---|
2003 | 2122 | .dev_init_card = kvaser_usb_hydra_init_card, |
---|
| 2123 | + .dev_init_channel = kvaser_usb_hydra_init_channel, |
---|
2004 | 2124 | .dev_get_software_info = kvaser_usb_hydra_get_software_info, |
---|
2005 | 2125 | .dev_get_software_details = kvaser_usb_hydra_get_software_details, |
---|
2006 | 2126 | .dev_get_card_info = kvaser_usb_hydra_get_card_info, |
---|