Lines Matching defs:ndev

495 	struct net_device *ndev;
615 static void rcar_canfd_tx_failure_cleanup(struct net_device *ndev)
620 can_free_echo_skb(ndev, i);
865 static void rcar_canfd_global_error(struct net_device *ndev)
867 struct rcar_canfd_channel *priv = netdev_priv(ndev);
869 struct net_device_stats *stats = &ndev->stats;
876 netdev_dbg(ndev, "Ch0: ECC Error flag\n");
880 netdev_dbg(ndev, "Ch1: ECC Error flag\n");
887 netdev_dbg(ndev, "Tx Message Lost flag\n");
896 netdev_dbg(ndev, "Rx Message Lost flag\n");
907 netdev_dbg(ndev, "global payload overflow interrupt\n");
916 static void rcar_canfd_error(struct net_device *ndev, u32 cerfl,
919 struct rcar_canfd_channel *priv = netdev_priv(ndev);
920 struct net_device_stats *stats = &ndev->stats;
925 netdev_dbg(ndev, "ch erfl %x txerr %u rxerr %u\n", cerfl, txerr, rxerr);
928 skb = alloc_can_err_skb(ndev, &cf);
936 netdev_dbg(ndev, "Bus error\n");
942 netdev_dbg(ndev, "ACK Delimiter Error\n");
947 netdev_dbg(ndev, "Bit Error (dominant)\n");
952 netdev_dbg(ndev, "Bit Error (recessive)\n");
957 netdev_dbg(ndev, "CRC Error\n");
962 netdev_dbg(ndev, "ACK Error\n");
968 netdev_dbg(ndev, "Form Error\n");
973 netdev_dbg(ndev, "Stuff Error\n");
978 netdev_dbg(ndev, "Arbitration lost Error\n");
984 netdev_dbg(ndev, "Bus Lock Error\n");
989 netdev_dbg(ndev, "Error warning interrupt\n");
999 netdev_dbg(ndev, "Error passive interrupt\n");
1009 netdev_dbg(ndev, "Bus-off entry interrupt\n");
1010 rcar_canfd_tx_failure_cleanup(ndev);
1013 can_bus_off(ndev);
1017 netdev_dbg(ndev,
1032 static void rcar_canfd_tx_done(struct net_device *ndev)
1034 struct rcar_canfd_channel *priv = netdev_priv(ndev);
1035 struct net_device_stats *stats = &ndev->stats;
1047 can_get_echo_skb(ndev, sent);
1057 netif_wake_queue(ndev);
1070 can_led_event(ndev, CAN_LED_EVENT_TX);
1076 struct net_device *ndev;
1086 ndev = priv->ndev;
1092 rcar_canfd_global_error(ndev);
1111 static void rcar_canfd_state_change(struct net_device *ndev,
1114 struct rcar_canfd_channel *priv = netdev_priv(ndev);
1115 struct net_device_stats *stats = &ndev->stats;
1127 netdev_dbg(ndev, "state: new %d, old %d: txerr %u, rxerr %u\n",
1129 skb = alloc_can_err_skb(ndev, &cf);
1137 can_change_state(ndev, cf, tx_state, rx_state);
1147 struct net_device *ndev;
1155 ndev = priv->ndev;
1163 rcar_canfd_error(ndev, cerfl, txerr, rxerr);
1168 rcar_canfd_state_change(ndev, txerr, rxerr);
1174 rcar_canfd_tx_done(ndev);
1200 netdev_dbg(priv->ndev, "nrate: brp %u, sjw %u, tseg1 %u, tseg2 %u\n",
1213 netdev_dbg(priv->ndev, "drate: brp %u, sjw %u, tseg1 %u, tseg2 %u\n",
1221 netdev_dbg(priv->ndev,
1227 static int rcar_canfd_start(struct net_device *ndev)
1229 struct rcar_canfd_channel *priv = netdev_priv(ndev);
1234 rcar_canfd_set_bittiming(ndev);
1246 netdev_err(ndev, "channel %u communication state failed\n", ch);
1263 static int rcar_canfd_open(struct net_device *ndev)
1265 struct rcar_canfd_channel *priv = netdev_priv(ndev);
1272 netdev_err(ndev, "failed to enable CAN clock, error %d\n", err);
1276 err = open_candev(ndev);
1278 netdev_err(ndev, "open_candev() failed, error %d\n", err);
1283 err = rcar_canfd_start(ndev);
1286 netif_start_queue(ndev);
1287 can_led_event(ndev, CAN_LED_EVENT_OPEN);
1291 close_candev(ndev);
1298 static void rcar_canfd_stop(struct net_device *ndev)
1300 struct rcar_canfd_channel *priv = netdev_priv(ndev);
1313 netdev_err(ndev, "channel %u reset failed\n", ch);
1326 static int rcar_canfd_close(struct net_device *ndev)
1328 struct rcar_canfd_channel *priv = netdev_priv(ndev);
1331 netif_stop_queue(ndev);
1332 rcar_canfd_stop(ndev);
1335 close_candev(ndev);
1336 can_led_event(ndev, CAN_LED_EVENT_STOP);
1341 struct net_device *ndev)
1343 struct rcar_canfd_channel *priv = netdev_priv(ndev);
1349 if (can_dropped_invalid_skb(ndev, skb))
1395 can_put_echo_skb(skb, ndev, priv->tx_head % RCANFD_FIFO_DEPTH);
1402 netif_stop_queue(ndev);
1416 struct net_device_stats *stats = &priv->ndev->stats;
1429 skb = alloc_canfd_skb(priv->ndev, &cf);
1431 skb = alloc_can_skb(priv->ndev,
1436 skb = alloc_can_skb(priv->ndev, (struct can_frame **)&cf);
1457 netdev_dbg(priv->ndev, "ESI Error\n");
1481 can_led_event(priv->ndev, CAN_LED_EVENT_RX);
1522 static int rcar_canfd_do_set_mode(struct net_device *ndev, enum can_mode mode)
1528 err = rcar_canfd_start(ndev);
1531 netif_wake_queue(ndev);
1563 struct net_device *ndev;
1566 ndev = alloc_candev(sizeof(*priv), RCANFD_FIFO_DEPTH);
1567 if (!ndev) {
1572 priv = netdev_priv(ndev);
1574 ndev->netdev_ops = &rcar_canfd_netdev_ops;
1575 ndev->flags |= IFF_ECHO;
1576 priv->ndev = ndev;
1588 can_set_static_ctrlmode(ndev, CAN_CTRLMODE_FD);
1599 SET_NETDEV_DEV(ndev, &pdev->dev);
1601 netif_napi_add(ndev, &priv->napi, rcar_canfd_rx_poll,
1604 devm_can_led_init(ndev);
1606 err = register_candev(ndev);
1617 free_candev(ndev);
1627 unregister_candev(priv->ndev);
1629 free_candev(priv->ndev);