source: branches/backfire/target/linux/lantiq/patches-2.6.32/350-dm9000-polling.patch @ 27546

Last change on this file since 27546 was 27546, checked in by blogic, 5 years ago

add new lantiq target

File size: 3.2 KB
  • drivers/net/dm9000.c

    a b  
    1919 *      Sascha Hauer <s.hauer@pengutronix.de> 
    2020 */ 
    2121 
     22#define DEBUG 
    2223#include <linux/module.h> 
    2324#include <linux/ioport.h> 
    2425#include <linux/netdevice.h> 
    typedef struct board_info { 
    121122        struct delayed_work phy_poll; 
    122123        struct net_device  *ndev; 
    123124 
     125        struct delayed_work irq_poll;   /* for use in irq polling mode */ 
     126 
    124127        spinlock_t      lock; 
    125128 
    126129        struct mii_if_info mii; 
    static void dm9000_timeout(struct net_de 
    790793        unsigned long flags; 
    791794 
    792795        /* Save previous register address */ 
    793         reg_save = readb(db->io_addr); 
    794796        spin_lock_irqsave(&db->lock, flags); 
     797        reg_save = readb(db->io_addr); 
    795798 
    796799        netif_stop_queue(dev); 
    797800        dm9000_reset(db); 
    798801        dm9000_init_dm9000(dev); 
     802        dm9000_reset(db); 
     803        dm9000_init_dm9000(dev); 
    799804        /* We can accept TX packets again */ 
    800805        dev->trans_start = jiffies; 
    801806        netif_wake_queue(dev); 
    dm9000_start_xmit(struct sk_buff *skb, s 
    867872        /* free this SKB */ 
    868873        dev_kfree_skb(skb); 
    869874 
     875        /* directly poll afterwards */ 
     876        if (dev->irq == -1) { 
     877                cancel_delayed_work(&db->irq_poll); 
     878                schedule_delayed_work(&db->irq_poll, 1); 
     879        } 
     880 
    870881        return NETDEV_TX_OK; 
    871882} 
    872883 
    static void dm9000_poll_controller(struc 
    10731084} 
    10741085#endif 
    10751086 
     1087static void dm9000_poll_irq(struct work_struct *w) 
     1088{ 
     1089        struct delayed_work *dw = to_delayed_work(w); 
     1090        board_info_t *db = container_of(dw, board_info_t, irq_poll); 
     1091        struct net_device *ndev = db->ndev; 
     1092 
     1093        dm9000_interrupt(0, ndev); 
     1094 
     1095        if (netif_running(ndev)) 
     1096                schedule_delayed_work(&db->irq_poll, HZ /100); 
     1097} 
     1098 
    10761099/* 
    10771100 *  Open the interface. 
    10781101 *  The interface is opened whenever "ifconfig" actives it. 
    dm9000_open(struct net_device *dev) 
    10861109        if (netif_msg_ifup(db)) 
    10871110                dev_dbg(db->dev, "enabling %s\n", dev->name); 
    10881111 
    1089         /* If there is no IRQ type specified, default to something that 
    1090          * may work, and tell the user that this is a problem */ 
     1112        if (dev->irq != -1) { 
     1113                /* If there is no IRQ type specified, default to something that 
     1114                 * may work, and tell the user that this is a problem */ 
    10911115 
    1092         if (irqflags == IRQF_TRIGGER_NONE) 
    1093                 dev_warn(db->dev, "WARNING: no IRQ resource flags set.\n"); 
     1116                if (irqflags == IRQF_TRIGGER_NONE) 
     1117                        dev_warn(db->dev, "WARNING: no IRQ resource flags set.\n"); 
    10941118 
    1095         irqflags |= IRQF_SHARED; 
     1119                irqflags |= IRQF_SHARED; 
    10961120 
    1097         if (request_irq(dev->irq, &dm9000_interrupt, irqflags, dev->name, dev)) 
    1098                 return -EAGAIN; 
     1121                if (request_irq(dev->irq, dm9000_interrupt, irqflags, dev->name, dev)) 
     1122                        return -EAGAIN; 
     1123        } 
    10991124 
    11001125        /* Initialize DM9000 board */ 
    11011126        dm9000_reset(db); 
    11021127        dm9000_init_dm9000(dev); 
     1128        /* workaround: init a second time */ 
     1129        dm9000_reset(db); 
     1130        dm9000_init_dm9000(dev); 
    11031131 
    11041132        /* Init driver variable */ 
    11051133        db->dbug_cnt = 0; 
    11061134 
    11071135        mii_check_media(&db->mii, netif_msg_link(db), 1); 
    11081136        netif_start_queue(dev); 
    1109          
     1137 
     1138        if (dev->irq == -1) 
     1139                schedule_delayed_work(&db->irq_poll, HZ / 100); 
     1140 
    11101141        dm9000_schedule_poll(db); 
    11111142 
    11121143        return 0; 
    dm9000_probe(struct platform_device *pde 
    13031334        mutex_init(&db->addr_lock); 
    13041335 
    13051336        INIT_DELAYED_WORK(&db->phy_poll, dm9000_poll_work); 
     1337        INIT_DELAYED_WORK(&db->irq_poll, dm9000_poll_irq); 
    13061338 
    13071339        db->addr_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 
    13081340        db->data_res = platform_get_resource(pdev, IORESOURCE_MEM, 1); 
Note: See TracBrowser for help on using the repository browser.