Lines Matching defs:dev

447 	struct net_device *dev;
574 static int atmel_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
575 static void atmel_copy_to_card(struct net_device *dev, u16 dest,
577 static void atmel_copy_to_host(struct net_device *dev, unsigned char *dest,
579 static void atmel_set_gcr(struct net_device *dev, u16 mask);
580 static void atmel_clear_gcr(struct net_device *dev, u16 mask);
609 static void atmel_writeAR(struct net_device *dev, u16 data);
610 static int probe_atmel_card(struct net_device *dev);
611 static int reset_atmel_card(struct net_device *dev);
613 int atmel_open (struct net_device *dev);
635 static inline u8 atmel_read8(struct net_device *dev, u16 offset)
637 return inb(dev->base_addr + offset);
640 static inline void atmel_write8(struct net_device *dev, u16 offset, u8 data)
642 outb(data, dev->base_addr + offset);
645 static inline u16 atmel_read16(struct net_device *dev, u16 offset)
647 return inw(dev->base_addr + offset);
650 static inline void atmel_write16(struct net_device *dev, u16 offset, u16 data)
652 outw(data, dev->base_addr + offset);
657 atmel_writeAR(priv->dev, pos);
658 return atmel_read8(priv->dev, DR);
663 atmel_writeAR(priv->dev, pos);
664 atmel_write8(priv->dev, DR, data);
669 atmel_writeAR(priv->dev, pos);
670 return atmel_read16(priv->dev, DR);
675 atmel_writeAR(priv->dev, pos);
676 atmel_write16(priv->dev, DR, data);
710 priv->dev->stats.tx_packets++;
712 priv->dev->stats.tx_errors++;
713 netif_wake_queue(priv->dev);
798 static netdev_tx_t start_tx(struct sk_buff *skb, struct net_device *dev)
800 struct atmel_private *priv = netdev_priv(dev);
807 dev->stats.tx_errors++;
813 dev->stats.tx_errors++;
830 dev->stats.tx_dropped++;
833 netif_stop_queue(dev);
844 memcpy(&header.addr2, dev->dev_addr, ETH_ALEN);
849 memcpy(&header.addr2, dev->dev_addr, ETH_ALEN);
858 atmel_copy_to_card(dev, buff, (unsigned char *)&header, DATA_FRAME_WS_HEADER_SIZE);
860 atmel_copy_to_card(dev, buff + DATA_FRAME_WS_HEADER_SIZE, skb->data + 12, len - 12);
865 dev->stats.tx_bytes += len;
884 atmel_copy_to_card(priv->dev, buff, (u8 *)header, MGMT_FRAME_BODY_OFFSET);
885 atmel_copy_to_card(priv->dev, buff + MGMT_FRAME_BODY_OFFSET, body, body_len);
900 atmel_copy_to_host(priv->dev, mac4, rx_packet_loc + 24, 6);
909 priv->dev->stats.rx_dropped++;
915 atmel_copy_to_host(priv->dev, skbp + 12, rx_packet_loc + 30, msdu_size);
920 atmel_copy_to_host(priv->dev, (void *)&netcrc, rx_packet_loc + 30 + msdu_size, 4);
922 priv->dev->stats.rx_crc_errors++;
934 skb->protocol = eth_type_trans(skb, priv->dev);
937 priv->dev->stats.rx_bytes += 12 + msdu_size;
938 priv->dev->stats.rx_packets++;
952 atmel_copy_to_host(priv->dev, (void *)&netcrc, packet_loc + i, 4);
954 atmel_writeAR(priv->dev, packet_loc);
956 u8 octet = atmel_read8(priv->dev, DR);
983 atmel_copy_to_host(priv->dev, mac4, rx_packet_loc, ETH_ALEN);
997 atmel_copy_to_host(priv->dev, &priv->rx_buf[12], rx_packet_loc, msdu_size);
1002 atmel_copy_to_host(priv->dev, (void *)&netcrc, rx_packet_loc + msdu_size, 4);
1004 priv->dev->stats.rx_crc_errors++;
1013 atmel_copy_to_host(priv->dev, &priv->rx_buf[12 + priv->frag_len],
1020 atmel_copy_to_host(priv->dev, (void *)&netcrc, rx_packet_loc + msdu_size, 4);
1022 priv->dev->stats.rx_crc_errors++;
1034 priv->dev->stats.rx_dropped++;
1039 skb->protocol = eth_type_trans(skb, priv->dev);
1042 priv->dev->stats.rx_bytes += priv->frag_len + 12;
1043 priv->dev->stats.rx_packets++;
1068 priv->dev->stats.rx_errors++;
1076 priv->dev->stats.rx_errors++;
1081 atmel_copy_to_host(priv->dev, (char *)&header, rx_packet_loc, 24);
1124 atmel_copy_to_host(priv->dev, (unsigned char *)&priv->rx_buf, rx_packet_loc + 24, msdu_size);
1134 priv->dev->stats.rx_crc_errors++;
1156 struct net_device *dev = (struct net_device *) dev_id;
1157 struct atmel_private *priv = netdev_priv(dev);
1183 atmel_clear_gcr(dev, GCR_ENINT); /* disable interrupts */
1188 printk(KERN_ALERT "%s: failed to contact MAC.\n", dev->name);
1196 atmel_set_gcr(dev, GCR_ENINT); /* enable interrupts */
1200 atmel_set_gcr(dev, GCR_ACKINT); /* acknowledge interrupt */
1208 printk(KERN_ALERT "%s: failed to contact MAC.\n", dev->name);
1239 printk(KERN_ALERT "%s: *** FATAL error interrupt ***\n", dev->name);
1255 printk(KERN_INFO "%s: Generic_irq received.\n", dev->name);
1261 static struct iw_statistics *atmel_get_wireless_stats(struct net_device *dev)
1263 struct atmel_private *priv = netdev_priv(dev);
1295 static int atmel_set_mac_address(struct net_device *dev, void *p)
1299 eth_hw_addr_set(dev, addr->sa_data);
1300 return atmel_open(dev);
1305 int atmel_open(struct net_device *dev)
1307 struct atmel_private *priv = netdev_priv(dev);
1332 err = reset_atmel_card(dev);
1346 printk(KERN_ALERT "%s: failed to get regulatory domain: assuming MKK1.\n", dev->name);
1356 atmel_set_gcr(priv->dev, GCR_ENINT); /* enable interrupts */
1360 static int atmel_close(struct net_device *dev)
1362 struct atmel_private *priv = netdev_priv(dev);
1372 wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL);
1378 atmel_write16(dev, GCR, 0x0060);
1379 atmel_write16(dev, GCR, 0x0040);
1499 struct net_device *dev;
1504 dev = alloc_etherdev(sizeof(*priv));
1505 if (!dev)
1508 if (dev_alloc_name(dev, dev->name) < 0) {
1513 priv = netdev_priv(dev);
1514 priv->dev = dev;
1573 dev->netdev_ops = &atmel_netdev_ops;
1574 dev->wireless_handlers = &atmel_handler_def;
1575 dev->irq = irq;
1576 dev->base_addr = port;
1579 dev->min_mtu = 68;
1580 dev->max_mtu = MAX_WIRELESS_BODY - ETH_FCS_LEN;
1582 SET_NETDEV_DEV(dev, sys_dev);
1584 if ((rc = request_irq(dev->irq, service_interrupt, IRQF_SHARED, dev->name, dev))) {
1585 printk(KERN_ERR "%s: register interrupt %d failed, rc %d\n", dev->name, irq, rc);
1589 if (!request_region(dev->base_addr, 32,
1594 if (register_netdev(dev))
1597 if (!probe_atmel_card(dev)) {
1598 unregister_netdev(dev);
1602 netif_carrier_off(dev);
1609 dev->name, DRIVER_MAJOR, DRIVER_MINOR, dev->dev_addr);
1611 return dev;
1614 release_region(dev->base_addr, 32);
1616 free_irq(dev->irq, dev);
1618 free_netdev(dev);
1624 void stop_atmel_card(struct net_device *dev)
1626 struct atmel_private *priv = netdev_priv(dev);
1630 atmel_write16(dev, GCR, 0x0060);
1631 atmel_write16(dev, GCR, 0x0040);
1634 unregister_netdev(dev);
1636 free_irq(dev->irq, dev);
1638 release_region(dev->base_addr, 32);
1639 free_netdev(dev);
1644 static int atmel_set_essid(struct net_device *dev,
1650 struct atmel_private *priv = netdev_priv(dev);
1673 static int atmel_get_essid(struct net_device *dev,
1679 struct atmel_private *priv = netdev_priv(dev);
1695 static int atmel_get_wap(struct net_device *dev,
1701 struct atmel_private *priv = netdev_priv(dev);
1708 static int atmel_set_encode(struct net_device *dev,
1714 struct atmel_private *priv = netdev_priv(dev);
1798 static int atmel_get_encode(struct net_device *dev,
1804 struct atmel_private *priv = netdev_priv(dev);
1831 static int atmel_set_encodeext(struct net_device *dev,
1836 struct atmel_private *priv = netdev_priv(dev);
1891 static int atmel_get_encodeext(struct net_device *dev,
1896 struct atmel_private *priv = netdev_priv(dev);
1934 static int atmel_set_auth(struct net_device *dev,
1938 struct atmel_private *priv = netdev_priv(dev);
1979 static int atmel_get_auth(struct net_device *dev,
1983 struct atmel_private *priv = netdev_priv(dev);
2009 static int atmel_get_name(struct net_device *dev,
2018 static int atmel_set_rate(struct net_device *dev,
2024 struct atmel_private *priv = netdev_priv(dev);
2060 static int atmel_set_mode(struct net_device *dev,
2066 struct atmel_private *priv = netdev_priv(dev);
2075 static int atmel_get_mode(struct net_device *dev,
2081 struct atmel_private *priv = netdev_priv(dev);
2087 static int atmel_get_rate(struct net_device *dev,
2093 struct atmel_private *priv = netdev_priv(dev);
2118 static int atmel_set_power(struct net_device *dev,
2124 struct atmel_private *priv = netdev_priv(dev);
2129 static int atmel_get_power(struct net_device *dev,
2135 struct atmel_private *priv = netdev_priv(dev);
2141 static int atmel_set_retry(struct net_device *dev,
2147 struct atmel_private *priv = netdev_priv(dev);
2165 static int atmel_get_retry(struct net_device *dev,
2171 struct atmel_private *priv = netdev_priv(dev);
2189 static int atmel_set_rts(struct net_device *dev,
2195 struct atmel_private *priv = netdev_priv(dev);
2208 static int atmel_get_rts(struct net_device *dev,
2214 struct atmel_private *priv = netdev_priv(dev);
2223 static int atmel_set_frag(struct net_device *dev,
2229 struct atmel_private *priv = netdev_priv(dev);
2243 static int atmel_get_frag(struct net_device *dev,
2249 struct atmel_private *priv = netdev_priv(dev);
2258 static int atmel_set_freq(struct net_device *dev,
2264 struct atmel_private *priv = netdev_priv(dev);
2289 static int atmel_get_freq(struct net_device *dev,
2295 struct atmel_private *priv = netdev_priv(dev);
2302 static int atmel_set_scan(struct net_device *dev,
2307 struct atmel_private *priv = netdev_priv(dev);
2340 static int atmel_get_scan(struct net_device *dev,
2346 struct atmel_private *priv = netdev_priv(dev);
2412 static int atmel_get_range(struct net_device *dev,
2418 struct atmel_private *priv = netdev_priv(dev);
2487 static int atmel_set_wap(struct net_device *dev,
2493 struct atmel_private *priv = netdev_priv(dev);
2530 static int atmel_config_commit(struct net_device *dev,
2535 return atmel_open(dev);
2619 static int atmel_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
2622 struct atmel_private *priv = netdev_priv(dev);
2679 rc = atmel_open(dev);
2708 netif_start_queue(priv->dev);
2709 netif_carrier_on(priv->dev);
2713 netif_carrier_off(priv->dev);
2714 if (netif_running(priv->dev))
2715 netif_stop_queue(priv->dev);
2847 memcpy(header.addr2, priv->dev->dev_addr, ETH_ALEN);
2894 memcpy(header.addr2, priv->dev->dev_addr, ETH_ALEN);
3157 wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL);
3523 wireless_send_event(priv->dev, SIOCGIWSCAN, &wrqu, NULL);
3539 wireless_send_event(priv->dev, SIOCGIWSCAN, &wrqu, NULL);
3575 atmel_set_gcr(priv->dev, GCR_REMAP);
3578 atmel_clear_gcr(priv->dev, 0x0040);
3579 atmel_write16(priv->dev, BSR, BSS_SRAM);
3586 mr1 = atmel_read16(priv->dev, MR1);
3587 mr3 = atmel_read16(priv->dev, MR3);
3597 printk(KERN_ALERT "%s: MAC failed to boot.\n", priv->dev->name);
3601 if ((priv->host_info_base = atmel_read16(priv->dev, MR2)) == 0xffff) {
3602 printk(KERN_ALERT "%s: card missing.\n", priv->dev->name);
3614 mr1 = atmel_read16(priv->dev, MR1);
3615 mr3 = atmel_read16(priv->dev, MR3);
3626 priv->dev->name);
3632 !(atmel_read16(priv->dev, MR3) & MAC_INIT_OK)) {
3633 printk(KERN_ALERT "%s: MAC failed MR3 self-test.\n", priv->dev->name);
3637 !(atmel_read16(priv->dev, MR1) & MAC_INIT_OK)) {
3638 printk(KERN_ALERT "%s: MAC failed MR1 self-test.\n", priv->dev->name);
3642 atmel_copy_to_host(priv->dev, (unsigned char *)iface,
3664 static int probe_atmel_card(struct net_device *dev)
3667 struct atmel_private *priv = netdev_priv(dev);
3672 atmel_write16(dev, GCR, 0x0060);
3674 atmel_write16(dev, GCR, 0x0040);
3677 if (atmel_read16(dev, MR2) == 0) {
3682 atmel_write16(dev, BSR, BSS_IRAM);
3683 atmel_copy_to_card(dev, 0, mac_reader, sizeof(mac_reader));
3684 atmel_set_gcr(dev, GCR_REMAP);
3685 atmel_clear_gcr(priv->dev, 0x0040);
3686 atmel_write16(dev, BSR, BSS_SRAM);
3688 if (atmel_read16(dev, MR3) & MAC_BOOT_COMPLETE)
3691 printk(KERN_ALERT "%s: MAC failed to boot MAC address reader.\n", dev->name);
3694 atmel_copy_to_host(dev, addr, atmel_read16(dev, MR2), 6);
3695 eth_hw_addr_set(dev, addr);
3699 atmel_write16(dev, GCR, 0x0060);
3700 atmel_write16(dev, GCR, 0x0040);
3703 } else if (atmel_read16(dev, MR4) == 0) {
3706 atmel_write16(dev, BSR, 1);
3707 atmel_copy_to_host(dev, addr, 0xc000, 6);
3708 eth_hw_addr_set(dev, addr);
3709 atmel_write16(dev, BSR, 0x200);
3717 eth_hw_addr_set(dev, addr);
3722 atmel_write16(dev, GCR, 0x0060);
3723 atmel_write16(dev, GCR, 0x0040);
3729 if (dev->dev_addr[0] == 0xFF) {
3733 printk(KERN_ALERT "%s: *** Invalid MAC address. UPGRADE Firmware ****\n", dev->name);
3734 eth_hw_addr_set(dev, default_mac);
3841 static int reset_atmel_card(struct net_device *dev)
3857 struct atmel_private *priv = netdev_priv(dev);
3873 atmel_write16(priv->dev, GCR, 0x0060);
3876 atmel_write16(priv->dev, GCR, 0x0040);
3888 dev->name);
3891 dev->name);
3898 dev->name, priv->firmware_id);
3926 dev->name, priv->firmware_id);
3937 atmel_write16(priv->dev, BSR, BSS_IRAM);
3938 atmel_copy_to_card(priv->dev, 0, fw, len);
3939 atmel_set_gcr(priv->dev, GCR_REMAP);
3942 atmel_set_gcr(priv->dev, GCR_REMAP);
3943 atmel_write16(priv->dev, BSR, BSS_IRAM);
3944 atmel_copy_to_card(priv->dev, 0, fw, 0x6000);
3945 atmel_write16(priv->dev, BSR, 0x2ff);
3946 atmel_copy_to_card(priv->dev, 0x8000, &fw[0x6000], len - 0x6000);
3996 dev->name);
4010 priv->dev->dev_addr, 6);
4028 wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL);
4038 atmel_copy_to_card(priv->dev, atmel_co(priv, CMD_BLOCK_PARAMETERS_OFFSET),
4061 printk(KERN_ALERT "%s: failed to contact MAC.\n", priv->dev->name);
4115 printk(KERN_ALERT "%s: MIB buffer too small.\n", priv->dev->name);
4130 printk(KERN_ALERT "%s: MIB buffer too small.\n", priv->dev->name);
4133 atmel_copy_to_host(priv->dev, data,
4137 static void atmel_writeAR(struct net_device *dev, u16 data)
4140 outw(data, dev->base_addr + AR);
4142 for (i = 0; data != inw(dev->base_addr + AR) && i < 10; i++)
4143 outw(data, dev->base_addr + AR);
4146 static void atmel_copy_to_card(struct net_device *dev, u16 dest,
4150 atmel_writeAR(dev, dest);
4152 atmel_write8(dev, DR, *src);
4158 atmel_write16(dev, DR, lb | (hb << 8));
4161 atmel_write8(dev, DR, *src);
4164 static void atmel_copy_to_host(struct net_device *dev, unsigned char *dest,
4168 atmel_writeAR(dev, src);
4170 *dest = atmel_read8(dev, DR);
4174 u16 hw = atmel_read16(dev, DR);
4179 *dest = atmel_read8(dev, DR);
4182 static void atmel_set_gcr(struct net_device *dev, u16 mask)
4184 outw(inw(dev->base_addr + GCR) | mask, dev->base_addr + GCR);
4187 static void atmel_clear_gcr(struct net_device *dev, u16 mask)
4189 outw(inw(dev->base_addr + GCR) & ~mask, dev->base_addr + GCR);
4218 atmel_writeAR(priv->dev, pos);
4219 atmel_write16(priv->dev, DR, data); /* card is little-endian */
4220 atmel_write16(priv->dev, DR, data >> 16);