コード例 #1
0
ファイル: sh_eth.c プロジェクト: andi34/Dhollmen_Kernel
/* network device open function */
static int sh_eth_open(struct net_device *ndev)
{
	int ret = 0;
	struct sh_eth_private *mdp = netdev_priv(ndev);

	pm_runtime_get_sync(&mdp->pdev->dev);

	ret = request_irq(ndev->irq, sh_eth_interrupt,
#if defined(CONFIG_CPU_SUBTYPE_SH7763) || \
	defined(CONFIG_CPU_SUBTYPE_SH7764) || \
	defined(CONFIG_CPU_SUBTYPE_SH7757)
				IRQF_SHARED,
#else
				0,
#endif
				ndev->name, ndev);
	if (ret) {
		dev_err(&ndev->dev, "Can not assign IRQ number\n");
		return ret;
	}

	/* Descriptor set */
	ret = sh_eth_ring_init(ndev);
	if (ret)
		goto out_free_irq;

	/* device init */
	ret = sh_eth_dev_init(ndev);
	if (ret)
		goto out_free_irq;

	/* PHY control start*/
	ret = sh_eth_phy_start(ndev);
	if (ret)
		goto out_free_irq;

	/* Set the timer to check for link beat. */
	init_timer(&mdp->timer);
	mdp->timer.expires = (jiffies + (24 * HZ)) / 10;/* 2.4 sec. */
	setup_timer(&mdp->timer, sh_eth_timer, (unsigned long)ndev);

	return ret;

out_free_irq:
	free_irq(ndev->irq, ndev);
	pm_runtime_put_sync(&mdp->pdev->dev);
	return ret;
}
コード例 #2
0
ファイル: sh_eth.c プロジェクト: artm1248/linux
/* Timeout function */
static void sh_eth_tx_timeout(struct net_device *ndev)
{
    struct sh_eth_private *mdp = netdev_priv(ndev);
    u32 ioaddr = ndev->base_addr;
    struct sh_eth_rxdesc *rxdesc;
    int i;

    netif_stop_queue(ndev);

    /* worning message out. */
    printk(KERN_WARNING "%s: transmit timed out, status %8.8x,"
           " resetting...\n", ndev->name, (int)ctrl_inl(ioaddr + EESR));

    /* tx_errors count up */
    mdp->stats.tx_errors++;

    /* timer off */
    del_timer_sync(&mdp->timer);

    /* Free all the skbuffs in the Rx queue. */
    for (i = 0; i < RX_RING_SIZE; i++) {
        rxdesc = &mdp->rx_ring[i];
        rxdesc->status = 0;
        rxdesc->addr = 0xBADF00D0;
        if (mdp->rx_skbuff[i])
            dev_kfree_skb(mdp->rx_skbuff[i]);
        mdp->rx_skbuff[i] = NULL;
    }
    for (i = 0; i < TX_RING_SIZE; i++) {
        if (mdp->tx_skbuff[i])
            dev_kfree_skb(mdp->tx_skbuff[i]);
        mdp->tx_skbuff[i] = NULL;
    }

    /* device init */
    sh_eth_dev_init(ndev);

    /* timer on */
    mdp->timer.expires = (jiffies + (24 * HZ)) / 10;/* 2.4 sec. */
    add_timer(&mdp->timer);
}
コード例 #3
0
ファイル: sh_eth.c プロジェクト: E-LLP/n900
/* network device open function */
static int sh_eth_open(struct net_device *ndev)
{
	int ret = 0;
	struct sh_eth_private *mdp = netdev_priv(ndev);

	ret = request_irq(ndev->irq, &sh_eth_interrupt, 0, ndev->name, ndev);
	if (ret) {
		printk(KERN_ERR "Can not assign IRQ number to %s\n", CARDNAME);
		return ret;
	}

	/* Descriptor set */
	ret = sh_eth_ring_init(ndev);
	if (ret)
		goto out_free_irq;

	/* device init */
	ret = sh_eth_dev_init(ndev);
	if (ret)
		goto out_free_irq;

	/* PHY control start*/
	ret = sh_eth_phy_start(ndev);
	if (ret)
		goto out_free_irq;

	/* Set the timer to check for link beat. */
	init_timer(&mdp->timer);
	mdp->timer.expires = (jiffies + (24 * HZ)) / 10;/* 2.4 sec. */
	setup_timer(&mdp->timer, sh_eth_timer, (unsigned long)ndev);

	return ret;

out_free_irq:
	free_irq(ndev->irq, ndev);
	return ret;
}