Lines Matching refs:ndev
214 struct net_device *ndev; member
300 netdev_warn(priv->ndev, "WARN: Triple" in ti_hecc_set_btc()
309 netdev_info(priv->ndev, "setting CANBTC=%#x\n", can_btc); in ti_hecc_set_btc()
321 static void ti_hecc_reset(struct net_device *ndev) in ti_hecc_reset() argument
324 struct ti_hecc_priv *priv = netdev_priv(ndev); in ti_hecc_reset()
326 netdev_dbg(ndev, "resetting hecc ...\n"); in ti_hecc_reset()
384 static void ti_hecc_start(struct net_device *ndev) in ti_hecc_start() argument
386 struct ti_hecc_priv *priv = netdev_priv(ndev); in ti_hecc_start()
390 ti_hecc_reset(ndev); in ti_hecc_start()
424 static void ti_hecc_stop(struct net_device *ndev) in ti_hecc_stop() argument
426 struct ti_hecc_priv *priv = netdev_priv(ndev); in ti_hecc_stop()
435 static int ti_hecc_do_set_mode(struct net_device *ndev, enum can_mode mode) in ti_hecc_do_set_mode() argument
441 ti_hecc_start(ndev); in ti_hecc_do_set_mode()
442 netif_wake_queue(ndev); in ti_hecc_do_set_mode()
452 static int ti_hecc_get_berr_counter(const struct net_device *ndev, in ti_hecc_get_berr_counter() argument
455 struct ti_hecc_priv *priv = netdev_priv(ndev); in ti_hecc_get_berr_counter()
485 static netdev_tx_t ti_hecc_xmit(struct sk_buff *skb, struct net_device *ndev) in ti_hecc_xmit() argument
487 struct ti_hecc_priv *priv = netdev_priv(ndev); in ti_hecc_xmit()
492 if (can_dropped_invalid_skb(ndev, skb)) in ti_hecc_xmit()
500 netif_stop_queue(ndev); in ti_hecc_xmit()
501 netdev_err(priv->ndev, in ti_hecc_xmit()
526 can_put_echo_skb(skb, ndev, mbxno); in ti_hecc_xmit()
532 netif_stop_queue(ndev); in ti_hecc_xmit()
546 struct net_device_stats *stats = &priv->ndev->stats; in ti_hecc_rx_pkt()
552 skb = alloc_can_skb(priv->ndev, &cf); in ti_hecc_rx_pkt()
555 netdev_err(priv->ndev, in ti_hecc_rx_pkt()
585 can_led_event(priv->ndev, CAN_LED_EVENT_RX); in ti_hecc_rx_pkt()
615 struct net_device *ndev = napi->dev; in ti_hecc_rx_poll() local
616 struct ti_hecc_priv *priv = netdev_priv(ndev); in ti_hecc_rx_poll()
621 if (!netif_running(ndev)) in ti_hecc_rx_poll()
660 static int ti_hecc_error(struct net_device *ndev, int int_status, in ti_hecc_error() argument
663 struct ti_hecc_priv *priv = netdev_priv(ndev); in ti_hecc_error()
664 struct net_device_stats *stats = &ndev->stats; in ti_hecc_error()
669 skb = alloc_can_err_skb(ndev, &cf); in ti_hecc_error()
672 netdev_err(priv->ndev, in ti_hecc_error()
688 netdev_dbg(priv->ndev, "Error Warning interrupt\n"); in ti_hecc_error()
703 netdev_dbg(priv->ndev, "Error passive interrupt\n"); in ti_hecc_error()
719 can_bus_off(ndev); in ti_hecc_error()
759 struct net_device *ndev = (struct net_device *)dev_id; in ti_hecc_interrupt() local
760 struct ti_hecc_priv *priv = netdev_priv(ndev); in ti_hecc_interrupt()
761 struct net_device_stats *stats = &ndev->stats; in ti_hecc_interrupt()
774 ti_hecc_error(ndev, int_status, err_status); in ti_hecc_interrupt()
790 can_led_event(ndev, CAN_LED_EVENT_TX); in ti_hecc_interrupt()
791 can_get_echo_skb(ndev, mbxno); in ti_hecc_interrupt()
800 netif_wake_queue(ndev); in ti_hecc_interrupt()
823 static int ti_hecc_open(struct net_device *ndev) in ti_hecc_open() argument
825 struct ti_hecc_priv *priv = netdev_priv(ndev); in ti_hecc_open()
828 err = request_irq(ndev->irq, ti_hecc_interrupt, IRQF_SHARED, in ti_hecc_open()
829 ndev->name, ndev); in ti_hecc_open()
831 netdev_err(ndev, "error requesting interrupt\n"); in ti_hecc_open()
838 err = open_candev(ndev); in ti_hecc_open()
840 netdev_err(ndev, "open_candev() failed %d\n", err); in ti_hecc_open()
842 free_irq(ndev->irq, ndev); in ti_hecc_open()
846 can_led_event(ndev, CAN_LED_EVENT_OPEN); in ti_hecc_open()
848 ti_hecc_start(ndev); in ti_hecc_open()
850 netif_start_queue(ndev); in ti_hecc_open()
855 static int ti_hecc_close(struct net_device *ndev) in ti_hecc_close() argument
857 struct ti_hecc_priv *priv = netdev_priv(ndev); in ti_hecc_close()
859 netif_stop_queue(ndev); in ti_hecc_close()
861 ti_hecc_stop(ndev); in ti_hecc_close()
862 free_irq(ndev->irq, ndev); in ti_hecc_close()
863 close_candev(ndev); in ti_hecc_close()
866 can_led_event(ndev, CAN_LED_EVENT_STOP); in ti_hecc_close()
880 struct net_device *ndev = (struct net_device *)0; in ti_hecc_probe() local
915 ndev = alloc_candev(sizeof(struct ti_hecc_priv), HECC_MAX_TX_MBOX); in ti_hecc_probe()
916 if (!ndev) { in ti_hecc_probe()
922 priv = netdev_priv(ndev); in ti_hecc_probe()
923 priv->ndev = ndev; in ti_hecc_probe()
937 ndev->irq = irq->start; in ti_hecc_probe()
938 ndev->flags |= IFF_ECHO; in ti_hecc_probe()
939 platform_set_drvdata(pdev, ndev); in ti_hecc_probe()
940 SET_NETDEV_DEV(ndev, &pdev->dev); in ti_hecc_probe()
941 ndev->netdev_ops = &ti_hecc_netdev_ops; in ti_hecc_probe()
951 netif_napi_add(ndev, &priv->napi, ti_hecc_rx_poll, in ti_hecc_probe()
955 err = register_candev(ndev); in ti_hecc_probe()
961 devm_can_led_init(ndev); in ti_hecc_probe()
964 priv->base, (u32) ndev->irq); in ti_hecc_probe()
971 free_candev(ndev); in ti_hecc_probe()
983 struct net_device *ndev = platform_get_drvdata(pdev); in ti_hecc_remove() local
984 struct ti_hecc_priv *priv = netdev_priv(ndev); in ti_hecc_remove()
986 unregister_candev(ndev); in ti_hecc_remove()
992 free_candev(ndev); in ti_hecc_remove()