15 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
17 #include <linux/module.h>
18 #include <linux/kernel.h>
19 #include <linux/types.h>
20 #include <linux/fcntl.h>
24 #include <linux/sched.h>
25 #include <linux/string.h>
28 #include <linux/errno.h>
29 #include <linux/pci.h>
31 #include <linux/netdevice.h>
34 #include <linux/mii.h>
35 #include <linux/ethtool.h>
37 #include <linux/random.h>
39 #include <linux/if_vlan.h>
40 #include <linux/bitops.h>
45 #include <asm/byteorder.h>
46 #include <asm/uaccess.h>
50 #include <asm/idprom.h>
54 #ifdef CONFIG_PPC_PMAC
55 #include <asm/pci-bridge.h>
57 #include <asm/machdep.h>
67 #define DEFAULT_MSG (NETIF_MSG_DRV | \
71 #define ADVERTISE_MASK (SUPPORTED_10baseT_Half | SUPPORTED_10baseT_Full | \
72 SUPPORTED_100baseT_Half | SUPPORTED_100baseT_Full | \
73 SUPPORTED_1000baseT_Half | SUPPORTED_1000baseT_Full | \
74 SUPPORTED_Pause | SUPPORTED_Autoneg)
76 #define DRV_NAME "sungem"
77 #define DRV_VERSION "1.0"
87 #define GEM_MODULE_NAME "gem"
119 static u16 __phy_read(
struct gem *
gp,
int phy_addr,
int reg)
145 static inline int _phy_read(
struct net_device *
dev,
int mii_id,
int reg)
147 struct gem *gp = netdev_priv(dev);
148 return __phy_read(gp, mii_id, reg);
156 static void __phy_write(
struct gem *gp,
int phy_addr,
int reg,
u16 val)
178 static inline void _phy_write(
struct net_device *
dev,
int mii_id,
int reg,
int val)
180 struct gem *gp = netdev_priv(dev);
181 __phy_write(gp, mii_id, reg, val & 0xffff);
189 static inline void gem_enable_ints(
struct gem *gp)
195 static inline void gem_disable_ints(
struct gem *gp)
202 static void gem_get_cell(
struct gem *gp)
206 #ifdef CONFIG_PPC_PMAC
209 pmac_call_feature(PMAC_FTR_GMAC_ENABLE, gp->of_node, 0, 1);
216 static void gem_put_cell(
struct gem *gp)
220 #ifdef CONFIG_PPC_PMAC
223 pmac_call_feature(PMAC_FTR_GMAC_ENABLE, gp->of_node, 0, 0);
229 static inline void gem_netif_stop(
struct gem *gp)
232 napi_disable(&gp->
napi);
233 netif_tx_disable(gp->
dev);
236 static inline void gem_netif_start(
struct gem *gp)
242 netif_wake_queue(gp->
dev);
243 napi_enable(&gp->
napi);
246 static void gem_schedule_reset(
struct gem *gp)
252 static void gem_handle_mif_event(
struct gem *gp,
u32 reg_val,
u32 changed_bits)
265 gp->
dev->name, pcs_istat);
268 netdev_err(dev,
"PCS irq but no link status change???\n");
287 netdev_info(dev,
"PCS AutoNEG complete, RemoteFault\n");
289 netdev_info(dev,
"PCS AutoNEG complete\n");
292 if (pcs_miistat & PCS_MIISTAT_LS) {
293 netdev_info(dev,
"PCS link is now up\n");
296 netdev_info(dev,
"PCS link is now down\n");
308 static int gem_txmac_interrupt(
struct net_device *dev,
struct gem *gp,
u32 gem_status)
314 gp->
dev->name, txmac_stat);
320 !(txmac_stat & ~MAC_TXSTAT_DTE))
324 netdev_err(dev,
"TX MAC xmit underrun\n");
325 dev->
stats.tx_fifo_errors++;
329 netdev_err(dev,
"TX MAC max packet size error\n");
330 dev->
stats.tx_errors++;
337 dev->
stats.collisions += 0x10000;
340 dev->
stats.tx_aborted_errors += 0x10000;
341 dev->
stats.collisions += 0x10000;
345 dev->
stats.tx_aborted_errors += 0x10000;
346 dev->
stats.collisions += 0x10000;
361 static int gem_rxmac_reset(
struct gem *gp)
370 for (limit = 0; limit < 5000; limit++) {
376 netdev_err(dev,
"RX MAC will not reset, resetting whole chip\n");
382 for (limit = 0; limit < 5000; limit++) {
388 netdev_err(dev,
"RX MAC will not disable, resetting whole chip\n");
394 for (limit = 0; limit < 5000; limit++) {
400 netdev_err(dev,
"RX DMA will not disable, resetting whole chip\n");
409 for (limit = 0; limit < 5000; limit++) {
415 netdev_err(dev,
"RX reset command will not execute, resetting whole chip\n");
424 netdev_err(dev,
"Parts of RX ring empty, resetting whole chip\n");
461 static int gem_rxmac_interrupt(
struct net_device *dev,
struct gem *gp,
u32 gem_status)
468 gp->
dev->name, rxmac_stat);
473 netdev_err(dev,
"RX MAC fifo overflow smac[%08x]\n", smac);
474 dev->
stats.rx_over_errors++;
475 dev->
stats.rx_fifo_errors++;
477 ret = gem_rxmac_reset(gp);
481 dev->
stats.rx_frame_errors += 0x10000;
484 dev->
stats.rx_crc_errors += 0x10000;
487 dev->
stats.rx_length_errors += 0x10000;
495 static int gem_mac_interrupt(
struct net_device *dev,
struct gem *gp,
u32 gem_status)
501 gp->
dev->name, mac_cstat);
516 static int gem_mif_interrupt(
struct net_device *dev,
struct gem *gp,
u32 gem_status)
524 gem_handle_mif_event(gp, reg_val, changed_bits);
529 static int gem_pci_interrupt(
struct net_device *dev,
struct gem *gp,
u32 gem_status)
535 netdev_err(dev,
"PCI error [%04x]", pci_estat);
538 pr_cont(
" <No ACK64# during ABS64 cycle>");
540 pr_cont(
" <Delayed transaction timeout>");
546 netdev_err(dev,
"PCI error\n");
557 netdev_err(dev,
"Read PCI cfg space status [%04x]\n",
560 netdev_err(dev,
"PCI parity error detected\n");
562 netdev_err(dev,
"PCI target abort\n");
564 netdev_err(dev,
"PCI master acks target abort\n");
566 netdev_err(dev,
"PCI master abort\n");
568 netdev_err(dev,
"PCI system error SERR#\n");
570 netdev_err(dev,
"PCI parity error\n");
573 pci_cfg_stat &= (PCI_STATUS_PARITY |
574 PCI_STATUS_SIG_TARGET_ABORT |
575 PCI_STATUS_REC_TARGET_ABORT |
576 PCI_STATUS_REC_MASTER_ABORT |
577 PCI_STATUS_SIG_SYSTEM_ERROR |
579 pci_write_config_word(gp->
pdev,
592 static int gem_abnormal_irq(
struct net_device *dev,
struct gem *gp,
u32 gem_status)
599 dev->
stats.rx_dropped++;
607 dev->
stats.rx_errors++;
613 if (gem_pcs_interrupt(dev, gp, gem_status))
618 if (gem_txmac_interrupt(dev, gp, gem_status))
623 if (gem_rxmac_interrupt(dev, gp, gem_status))
628 if (gem_mac_interrupt(dev, gp, gem_status))
633 if (gem_mif_interrupt(dev, gp, gem_status))
638 if (gem_pci_interrupt(dev, gp, gem_status))
651 while (entry != limit) {
660 gp->
dev->name, entry);
662 if (skb_shinfo(skb)->nr_frags) {
663 int last = entry + skb_shinfo(skb)->nr_frags;
681 for (frag = 0; frag <= skb_shinfo(skb)->nr_frags; frag++) {
691 dev->
stats.tx_packets++;
703 if (
unlikely(netif_queue_stopped(dev) &&
708 if (netif_queue_stopped(dev) &&
710 netif_wake_queue(dev);
711 __netif_tx_unlock(txq);
715 static __inline__ void gem_post_rxds(
struct gem *gp,
int limit)
719 cluster_start = curr = (gp->
rx_new & ~(4 - 1));
723 while (curr != limit) {
731 cluster_start =
NEXT_RX(cluster_start);
732 if (cluster_start == curr)
745 #define ALIGNED_RX_SKB_ADDR(addr) \
746 ((((unsigned long)(addr) + (64UL - 1UL)) & ~(64UL - 1UL)) - (unsigned long)(addr))
750 struct sk_buff *skb = alloc_skb(size + 64, gfp_flags);
754 skb_reserve(skb, offset);
759 static int gem_rx(
struct gem *gp,
int work_to_do)
762 int entry, drops, work_done = 0;
783 if (work_done >= RX_RING_SIZE || work_done >= work_to_do)
806 dev->
stats.rx_errors++;
808 dev->
stats.rx_length_errors++;
810 dev->
stats.rx_crc_errors++;
814 dev->
stats.rx_dropped++;
823 if (new_skb ==
NULL) {
827 pci_unmap_page(gp->
pdev, dma_addr,
842 struct sk_buff *copy_skb = netdev_alloc_skb(dev, len + 2);
844 if (copy_skb ==
NULL) {
849 skb_reserve(copy_skb, 2);
852 skb_copy_from_linear_data(skb, copy_skb->
data, len);
860 skb->
csum = csum_unfold(csum);
866 dev->
stats.rx_packets++;
873 gem_post_rxds(gp, entry);
878 netdev_info(gp->
dev,
"Memory squeeze, deferring packet\n");
902 reset = gem_abnormal_irq(dev, gp, gp->
status);
903 __netif_tx_unlock(txq);
905 gem_schedule_reset(gp);
912 gem_tx(dev, gp, gp->
status);
919 work_done += gem_rx(gp, budget - work_done);
921 if (work_done >= budget)
936 struct gem *gp = netdev_priv(dev);
938 if (napi_schedule_prep(&gp->
napi)) {
942 napi_enable(&gp->
napi);
947 gp->
dev->name, gem_status);
950 gem_disable_ints(gp);
961 #ifdef CONFIG_NET_POLL_CONTROLLER
962 static void gem_poll_controller(
struct net_device *dev)
964 struct gem *gp = netdev_priv(dev);
967 gem_interrupt(gp->
pdev->irq, dev);
972 static void gem_tx_timeout(
struct net_device *dev)
974 struct gem *gp = netdev_priv(dev);
976 netdev_err(dev,
"transmit timed out, resetting\n");
978 netdev_err(dev,
"TX_STATE[%08x:%08x:%08x]\n",
982 netdev_err(dev,
"RX_STATE[%08x:%08x:%08x]\n",
987 gem_schedule_reset(gp);
1002 struct gem *gp = netdev_priv(dev);
1008 const u64 csum_start_off = skb_checksum_start_offset(skb);
1012 (csum_start_off << 15) |
1013 (csum_stuff_off << 21));
1018 if (!netif_queue_stopped(dev)) {
1019 netif_stop_queue(dev);
1020 netdev_err(dev,
"BUG! Tx Ring full when queue awake!\n");
1028 if (skb_shinfo(skb)->nr_frags == 0) {
1034 mapping = pci_map_page(gp->
pdev,
1039 if (gem_intme(entry))
1053 if (gem_intme(entry))
1059 first_len = skb_headlen(skb);
1065 for (frag = 0; frag < skb_shinfo(skb)->nr_frags; frag++) {
1071 len = skb_frag_size(this_frag);
1072 mapping = skb_frag_dma_map(&gp->
pdev->dev, this_frag,
1075 if (frag == skb_shinfo(skb)->nr_frags - 1)
1083 if (gem_intme(entry))
1097 netif_stop_queue(dev);
1106 netif_wake_queue(dev);
1117 static void gem_pcs_reset(
struct gem *gp)
1134 netdev_warn(gp->
dev,
"PCS reset bit would not clear\n");
1137 static void gem_pcs_reinit_adv(
struct gem *gp)
1180 #define STOP_TRIES 32
1182 static void gem_reset(
struct gem *gp)
1204 netdev_err(gp->
dev,
"SW reset is ghetto\n");
1207 gem_pcs_reinit_adv(gp);
1210 static void gem_start_dma(
struct gem *gp)
1227 gem_enable_ints(gp);
1234 static void gem_stop_dma(
struct gem *gp)
1255 static void gem_begin_auto_negotiation(
struct gem *gp,
struct ethtool_cmd *ep)
1268 features = gp->
phy_mii.def->features;
1273 if (gp->
phy_mii.advertising != 0)
1274 advertise &= gp->
phy_mii.advertising;
1288 speed = ethtool_cmd_speed(ep);
1313 if (!netif_device_present(gp->
dev)) {
1340 static int gem_set_link_modes(
struct gem *gp)
1343 int full_duplex, speed,
pause;
1366 speed, (full_duplex ?
"full" :
"half"));
1387 }
else if (full_duplex) {
1434 __netif_tx_unlock(txq);
1438 netdev_info(gp->
dev,
1439 "Pause is enabled (rxfifo: %d off: %d on: %d)\n",
1444 netdev_info(gp->
dev,
"Pause is disabled\n");
1451 static int gem_mdio_link_not_up(
struct gem *gp)
1456 "Autoneg failed again, keeping forced mode\n");
1467 if (gp->
phy_mii.def->magic_aneg)
1486 "switching to forced 10bt\n");
1495 static void gem_link_timer(
unsigned long data)
1497 struct gem *gp = (
struct gem *) data;
1499 int restart_aneg = 0;
1509 if (!(val & PCS_MIISTAT_LS))
1512 if ((val & PCS_MIISTAT_LS) != 0) {
1518 (
void)gem_set_link_modes(gp);
1534 "Got link after fallback, retrying autoneg once...\n");
1539 if (gem_set_link_modes(gp))
1550 gem_schedule_reset(gp);
1555 restart_aneg = gem_mdio_link_not_up(gp);
1561 gem_begin_auto_negotiation(gp,
NULL);
1568 static void gem_clean_rings(
struct gem *gp)
1582 pci_unmap_page(gp->
pdev, dma_addr,
1601 for (frag = 0; frag <= skb_shinfo(skb)->nr_frags; frag++) {
1602 int ent = i & (TX_RING_SIZE - 1);
1604 txd = &gb->
txd[ent];
1606 pci_unmap_page(gp->
pdev, dma_addr,
1610 if (frag != skb_shinfo(skb)->nr_frags)
1618 static void gem_init_rings(
struct gem *gp)
1627 gem_clean_rings(gp);
1645 dma_addr = pci_map_page(gp->
pdev,
1667 static void gem_init_phy(
struct gem *gp)
1683 for (i = 0; i < 3; i++) {
1684 #ifdef CONFIG_PPC_PMAC
1685 pmac_call_feature(PMAC_FTR_GMAC_PHY_RESET, gp->of_node, 0, 0);
1696 netdev_warn(gp->
dev,
"GMAC PHY not responding !\n");
1727 gem_pcs_reinit_adv(gp);
1738 netdev_info(gp->
dev,
"Found %s PHY\n",
1741 gem_begin_auto_negotiation(gp,
NULL);
1744 static void gem_init_dma(
struct gem *gp)
1781 static u32 gem_setup_multicast(
struct gem *gp)
1788 for (i=0; i<16; i++)
1799 memset(hash_table, 0,
sizeof(hash_table));
1803 hash_table[crc >> 4] |= 1 << (15 - (crc & 0xf));
1805 for (i=0; i<16; i++)
1813 static void gem_init_mac(
struct gem *gp)
1815 unsigned char *
e = &gp->
dev->dev_addr[0];
1895 static void gem_init_pause_thresholds(
struct gem *gp)
1907 int max_frame = (gp->
rx_buf_sz + 4 + 64) & ~63;
1908 int off = (gp->
rx_fifo_sz - (max_frame * 2));
1909 int on = off - max_frame;
1922 #if !defined(CONFIG_SPARC64) && !defined(CONFIG_ALPHA)
1939 static int gem_check_invariants(
struct gem *gp)
1981 pr_err(
"RIO GEM lacks MII phy, mif_cfg[%08x]\n",
2004 if (p && !
strcmp(p,
"serdes"))
2014 for (i = 0; i < 32; i++) {
2021 pr_err(
"RIO MII phy will not respond\n");
2036 pr_err(
"GEM has bogus fifo sizes tx(%d) rx(%d)\n",
2044 pr_err(
"RIO GEM has bogus fifo sizes tx(%d) rx(%d)\n",
2055 static void gem_reinit_chip(
struct gem *gp)
2061 gem_disable_ints(gp);
2067 gem_init_pause_thresholds(gp);
2075 static void gem_stop_phy(
struct gem *gp,
int wol)
2092 unsigned char *e = &gp->
dev->dev_addr[0];
2142 static int gem_do_start(
struct net_device *dev)
2144 struct gem *gp = netdev_priv(dev);
2153 netdev_err(dev,
"Failed to enable chip on PCI bus !\n");
2164 gem_reinit_chip(gp);
2170 netdev_err(dev,
"failed to request irq !\n");
2173 gem_clean_rings(gp);
2184 gem_netif_start(gp);
2195 static void gem_do_stop(
struct net_device *dev,
int wol)
2197 struct gem *gp = netdev_priv(dev);
2207 gem_disable_ints(gp);
2231 gem_clean_rings(gp);
2237 gem_stop_phy(gp, wol);
2259 if (!netif_device_present(gp->
dev) ||
2260 !netif_running(gp->
dev) ||
2273 gem_reinit_chip(gp);
2275 gem_set_link_modes(gp);
2278 gem_netif_start(gp);
2287 gem_begin_auto_negotiation(gp,
NULL);
2299 if (netif_device_present(dev))
2300 return gem_do_start(dev);
2306 if (netif_device_present(dev))
2307 gem_do_stop(dev, 0);
2315 struct net_device *dev = pci_get_drvdata(pdev);
2316 struct gem *gp = netdev_priv(dev);
2326 if (!netif_running(dev)) {
2331 netdev_info(dev,
"suspending, WakeOnLan %s\n",
2333 "enabled" :
"disabled");
2350 static int gem_resume(
struct pci_dev *pdev)
2352 struct net_device *dev = pci_get_drvdata(pdev);
2353 struct gem *gp = netdev_priv(dev);
2361 if (!netif_running(dev)) {
2387 struct gem *gp = netdev_priv(dev);
2396 if (!netif_device_present(dev) || !netif_running(dev))
2413 dev->
stats.collisions +=
2421 static int gem_set_mac_address(
struct net_device *dev,
void *
addr)
2424 struct gem *gp = netdev_priv(dev);
2425 unsigned char *e = &dev->
dev_addr[0];
2427 if (!is_valid_ether_addr(macaddr->
sa_data))
2433 if (!netif_running(dev) || !netif_device_present(dev))
2447 static void gem_set_multicast(
struct net_device *dev)
2449 struct gem *gp = netdev_priv(dev);
2453 if (!netif_running(dev) || !netif_device_present(dev))
2461 rxcfg_new = gem_setup_multicast(gp);
2481 #define GEM_MIN_MTU 68
2483 #define GEM_MAX_MTU 1500
2485 #define GEM_MAX_MTU 9000
2488 static int gem_change_mtu(
struct net_device *dev,
int new_mtu)
2490 struct gem *gp = netdev_priv(dev);
2492 if (new_mtu < GEM_MIN_MTU || new_mtu >
GEM_MAX_MTU)
2498 if (!netif_running(dev) || !netif_device_present(dev))
2506 gem_reinit_chip(gp);
2508 gem_set_link_modes(gp);
2509 gem_netif_start(gp);
2516 struct gem *gp = netdev_priv(dev);
2525 struct gem *gp = netdev_priv(dev);
2542 ethtool_cmd_speed_set(cmd, gp->
phy_mii.speed);
2558 ethtool_cmd_speed_set(cmd, 0);
2584 struct gem *gp = netdev_priv(dev);
2585 u32 speed = ethtool_cmd_speed(cmd);
2605 if (netif_device_present(gp->
dev)) {
2607 gem_begin_auto_negotiation(gp, cmd);
2613 static int gem_nway_reset(
struct net_device *dev)
2615 struct gem *gp = netdev_priv(dev);
2621 if (netif_device_present(gp->
dev)) {
2623 gem_begin_auto_negotiation(gp,
NULL);
2631 struct gem *gp = netdev_priv(dev);
2637 struct gem *gp = netdev_priv(dev);
2645 #define WOL_SUPPORTED_MASK (WAKE_MAGIC)
2649 struct gem *gp = netdev_priv(dev);
2663 struct gem *gp = netdev_priv(dev);
2671 static const struct ethtool_ops gem_ethtool_ops = {
2672 .get_drvinfo = gem_get_drvinfo,
2674 .get_settings = gem_get_settings,
2675 .set_settings = gem_set_settings,
2676 .nway_reset = gem_nway_reset,
2677 .get_msglevel = gem_get_msglevel,
2678 .set_msglevel = gem_set_msglevel,
2679 .get_wol = gem_get_wol,
2680 .set_wol = gem_set_wol,
2683 static int gem_ioctl(
struct net_device *dev,
struct ifreq *ifr,
int cmd)
2685 struct gem *gp = netdev_priv(dev);
2714 #if (!defined(CONFIG_SPARC) && !defined(CONFIG_PPC_PMAC))
2716 static int find_eth_addr_in_vpd(
void __iomem *rom_base,
int len,
unsigned char *dev_addr)
2720 for (this_offset = 0x20; this_offset < len; this_offset++) {
2721 void __iomem *p = rom_base + this_offset;
2724 if (
readb(p + 0) != 0x90 ||
2725 readb(p + 1) != 0x00 ||
2726 readb(p + 2) != 0x09 ||
2727 readb(p + 3) != 0x4e ||
2728 readb(p + 4) != 0x41 ||
2729 readb(p + 5) != 0x06)
2735 for (i = 0; i < 6; i++)
2736 dev_addr[i] =
readb(p + i);
2742 static void get_gem_mac_nonobp(
struct pci_dev *pdev,
unsigned char *dev_addr)
2750 found =
readb(p) == 0x55 &&
2751 readb(p + 1) == 0xaa &&
2752 find_eth_addr_in_vpd(p, (64 * 1024), dev_addr);
2766 static int __devinit gem_get_device_address(
struct gem *gp)
2768 #if defined(CONFIG_SPARC) || defined(CONFIG_PPC_PMAC)
2770 const unsigned char *
addr;
2778 pr_err(
"%s: can't get mac-address\n", dev->
name);
2784 get_gem_mac_nonobp(gp->
pdev, gp->
dev->dev_addr);
2789 static void gem_remove_one(
struct pci_dev *pdev)
2791 struct net_device *dev = pci_get_drvdata(pdev);
2794 struct gem *gp = netdev_priv(dev);
2810 pci_set_drvdata(pdev,
NULL);
2815 .ndo_open = gem_open,
2816 .ndo_stop = gem_close,
2817 .ndo_start_xmit = gem_start_xmit,
2818 .ndo_get_stats = gem_get_stats,
2819 .ndo_set_rx_mode = gem_set_multicast,
2820 .ndo_do_ioctl = gem_ioctl,
2821 .ndo_tx_timeout = gem_tx_timeout,
2822 .ndo_change_mtu = gem_change_mtu,
2824 .ndo_set_mac_address = gem_set_mac_address,
2825 #ifdef CONFIG_NET_POLL_CONTROLLER
2826 .ndo_poll_controller = gem_poll_controller,
2833 unsigned long gemreg_base, gemreg_len;
2836 int err, pci_using_dac;
2848 pr_err(
"Cannot enable MMIO operation, aborting\n");
2869 pr_err(
"No usable DMA configuration, aborting\n");
2870 goto err_disable_device;
2879 pr_err(
"Cannot find proper PCI device base address, aborting\n");
2881 goto err_disable_device;
2884 dev = alloc_etherdev(
sizeof(*gp));
2887 goto err_disable_device;
2891 gp = netdev_priv(dev);
2895 pr_err(
"Cannot obtain PCI resources, aborting\n");
2896 goto err_out_free_netdev;
2916 pr_err(
"Cannot map device registers, aborting\n");
2918 goto err_out_free_res;
2924 #if defined(CONFIG_PPC_PMAC) || defined(CONFIG_SPARC)
2925 gp->of_node = pci_device_to_OF_node(pdev);
2940 gp->
phy_mii.mdio_read = _phy_read;
2941 gp->
phy_mii.mdio_write = _phy_write;
2942 #ifdef CONFIG_PPC_PMAC
2943 gp->
phy_mii.platform_data = gp->of_node;
2949 if (gem_check_invariants(gp)) {
2951 goto err_out_iounmap;
2961 pr_err(
"Cannot allocate init block, aborting\n");
2963 goto err_out_iounmap;
2966 err = gem_get_device_address(gp);
2968 goto err_out_free_consistent;
2977 pci_set_drvdata(pdev, dev);
2987 pr_err(
"Cannot register net device, aborting\n");
2989 goto err_out_free_consistent;
2999 netdev_info(dev,
"Sun GEM (PCI) 10/100/1000BaseT Ethernet %pM\n",
3003 err_out_free_consistent:
3004 gem_remove_one(pdev);
3012 err_out_free_netdev:
3023 .id_table = gem_pci_tbl,
3024 .probe = gem_init_one,
3025 .remove = gem_remove_one,
3027 .suspend = gem_suspend,
3028 .resume = gem_resume,
3032 static int __init gem_init(
void)
3034 return pci_register_driver(&gem_driver);
3037 static void __exit gem_cleanup(
void)