am79c961a.c
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:16k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. /*
  2.  *  linux/drivers/net/am79c961.c
  3.  *
  4.  *  by Russell King <rmk@arm.linux.org.uk> 1995-2001.
  5.  *
  6.  * This program is free software; you can redistribute it and/or modify
  7.  * it under the terms of the GNU General Public License version 2 as
  8.  * published by the Free Software Foundation.
  9.  *
  10.  * Derived from various things including skeleton.c
  11.  *
  12.  * This is a special driver for the am79c961A Lance chip used in the
  13.  * Intel (formally Digital Equipment Corp) EBSA110 platform.  Please
  14.  * note that this can not be built as a module (it doesn't make sense).
  15.  */
  16. #include <linux/kernel.h>
  17. #include <linux/sched.h>
  18. #include <linux/types.h>
  19. #include <linux/fcntl.h>
  20. #include <linux/interrupt.h>
  21. #include <linux/ptrace.h>
  22. #include <linux/ioport.h>
  23. #include <linux/in.h>
  24. #include <linux/slab.h>
  25. #include <linux/string.h>
  26. #include <linux/errno.h>
  27. #include <linux/netdevice.h>
  28. #include <linux/etherdevice.h>
  29. #include <linux/skbuff.h>
  30. #include <linux/delay.h>
  31. #include <linux/init.h>
  32. #include <linux/crc32.h>
  33. #include <asm/system.h>
  34. #include <asm/bitops.h>
  35. #include <asm/irq.h>
  36. #include <asm/io.h>
  37. #include <asm/dma.h>
  38. #define TX_BUFFERS 15
  39. #define RX_BUFFERS 25
  40. #include "am79c961a.h"
  41. static void am79c961_interrupt (int irq, void *dev_id, struct pt_regs *regs);
  42. static unsigned int net_debug = NET_DEBUG;
  43. static const char version[] =
  44. "am79c961 ethernet driver (C) 1995-2001 Russell King v0.04n";
  45. /* --------------------------------------------------------------------------- */
  46. #ifdef __arm__
  47. static void write_rreg(u_long base, u_int reg, u_int val)
  48. {
  49. __asm__("str%?h %1, [%2] @ NET_RAP
  50. str%?h %0, [%2, #-4] @ NET_RDP
  51. " : : "r" (val), "r" (reg), "r" (ISAIO_BASE + 0x0464));
  52. }
  53. static inline unsigned short read_rreg(u_long base_addr, u_int reg)
  54. {
  55. unsigned short v;
  56. __asm__("str%?h %1, [%2] @ NET_RAP
  57. ldr%?h %0, [%2, #-4] @ NET_RDP
  58. " : "=r" (v): "r" (reg), "r" (ISAIO_BASE + 0x0464));
  59. return v;
  60. }
  61. static inline void write_ireg(u_long base, u_int reg, u_int val)
  62. {
  63. __asm__("str%?h %1, [%2] @ NET_RAP
  64. str%?h %0, [%2, #8] @ NET_IDP
  65. " : : "r" (val), "r" (reg), "r" (ISAIO_BASE + 0x0464));
  66. }
  67. #define am_writeword(dev,off,val) __raw_writew(val, ISAMEM_BASE + ((off) << 1))
  68. #define am_readword(dev,off)      __raw_readw(ISAMEM_BASE + ((off) << 1))
  69. static inline void
  70. am_writebuffer(struct net_device *dev, u_int offset, unsigned char *buf, unsigned int length)
  71. {
  72. offset = ISAMEM_BASE + (offset << 1);
  73. length = (length + 1) & ~1;
  74. if ((int)buf & 2) {
  75. __asm__ __volatile__("str%?h %2, [%0], #4"
  76.  : "=&r" (offset) : "0" (offset), "r" (buf[0] | (buf[1] << 8)));
  77. buf += 2;
  78. length -= 2;
  79. }
  80. while (length > 8) {
  81. unsigned int tmp, tmp2;
  82. __asm__ __volatile__("
  83. ldm%?ia %1!, {%2, %3}
  84. str%?h %2, [%0], #4
  85. mov%? %2, %2, lsr #16
  86. str%?h %2, [%0], #4
  87. str%?h %3, [%0], #4
  88. mov%? %3, %3, lsr #16
  89. str%?h %3, [%0], #4
  90. " : "=&r" (offset), "=&r" (buf), "=r" (tmp), "=r" (tmp2)
  91.   : "0" (offset), "1" (buf));
  92. length -= 8;
  93. }
  94. while (length > 0) {
  95. __asm__ __volatile__("str%?h %2, [%0], #4"
  96.  : "=&r" (offset) : "0" (offset), "r" (buf[0] | (buf[1] << 8)));
  97. buf += 2;
  98. length -= 2;
  99. }
  100. }
  101. static inline void
  102. am_readbuffer(struct net_device *dev, u_int offset, unsigned char *buf, unsigned int length)
  103. {
  104. offset = ISAMEM_BASE + (offset << 1);
  105. length = (length + 1) & ~1;
  106. if ((int)buf & 2) {
  107. unsigned int tmp;
  108. __asm__ __volatile__("
  109. ldr%?h %2, [%0], #4
  110. str%?b %2, [%1], #1
  111. mov%? %2, %2, lsr #8
  112. str%?b %2, [%1], #1
  113. " : "=&r" (offset), "=&r" (buf), "=r" (tmp): "0" (offset), "1" (buf));
  114. length -= 2;
  115. }
  116. while (length > 8) {
  117. unsigned int tmp, tmp2, tmp3;
  118. __asm__ __volatile__("
  119. ldr%?h %2, [%0], #4
  120. ldr%?h %3, [%0], #4
  121. orr%? %2, %2, %3, lsl #16
  122. ldr%?h %3, [%0], #4
  123. ldr%?h %4, [%0], #4
  124. orr%? %3, %3, %4, lsl #16
  125. stm%?ia %1!, {%2, %3}
  126. " : "=&r" (offset), "=&r" (buf), "=r" (tmp), "=r" (tmp2), "=r" (tmp3)
  127.   : "0" (offset), "1" (buf));
  128. length -= 8;
  129. }
  130. while (length > 0) {
  131. unsigned int tmp;
  132. __asm__ __volatile__("
  133. ldr%?h %2, [%0], #4
  134. str%?b %2, [%1], #1
  135. mov%? %2, %2, lsr #8
  136. str%?b %2, [%1], #1
  137. " : "=&r" (offset), "=&r" (buf), "=r" (tmp) : "0" (offset), "1" (buf));
  138. length -= 2;
  139. }
  140. }
  141. #else
  142. #error Not compatable
  143. #endif
  144. static int
  145. am79c961_ramtest(struct net_device *dev, unsigned int val)
  146. {
  147. unsigned char *buffer = kmalloc (65536, GFP_KERNEL);
  148. int i, error = 0, errorcount = 0;
  149. if (!buffer)
  150. return 0;
  151. memset (buffer, val, 65536);
  152. am_writebuffer(dev, 0, buffer, 65536);
  153. memset (buffer, val ^ 255, 65536);
  154. am_readbuffer(dev, 0, buffer, 65536);
  155. for (i = 0; i < 65536; i++) {
  156. if (buffer[i] != val && !error) {
  157. printk ("%s: buffer error (%02X %02X) %05X - ", dev->name, val, buffer[i], i);
  158. error = 1;
  159. errorcount ++;
  160. } else if (error && buffer[i] == val) {
  161. printk ("%05Xn", i);
  162. error = 0;
  163. }
  164. }
  165. if (error)
  166. printk ("10000n");
  167. kfree (buffer);
  168. return errorcount;
  169. }
  170. static void
  171. am79c961_init_for_open(struct net_device *dev)
  172. {
  173. struct dev_priv *priv = (struct dev_priv *)dev->priv;
  174. unsigned long flags;
  175. unsigned char *p;
  176. u_int hdr_addr, first_free_addr;
  177. int i;
  178. /*
  179.  * Stop the chip.
  180.  */
  181. spin_lock_irqsave(priv->chip_lock, flags);
  182. write_rreg (dev->base_addr, CSR0, CSR0_BABL|CSR0_CERR|CSR0_MISS|CSR0_MERR|CSR0_TINT|CSR0_RINT|CSR0_STOP);
  183. spin_unlock_irqrestore(priv->chip_lock, flags);
  184. write_ireg (dev->base_addr, 5, 0x00a0); /* Receive address LED */
  185. write_ireg (dev->base_addr, 6, 0x0081); /* Collision LED */
  186. write_ireg (dev->base_addr, 7, 0x0090); /* XMIT LED */
  187. write_ireg (dev->base_addr, 2, 0x0000); /* MODE register selects media */
  188. for (i = LADRL; i <= LADRH; i++)
  189. write_rreg (dev->base_addr, i, 0);
  190. for (i = PADRL, p = dev->dev_addr; i <= PADRH; i++, p += 2)
  191. write_rreg (dev->base_addr, i, p[0] | (p[1] << 8));
  192. i = MODE_PORT_10BT;
  193. if (dev->flags & IFF_PROMISC)
  194. i |= MODE_PROMISC;
  195. write_rreg (dev->base_addr, MODE, i);
  196. write_rreg (dev->base_addr, POLLINT, 0);
  197. write_rreg (dev->base_addr, SIZERXR, -RX_BUFFERS);
  198. write_rreg (dev->base_addr, SIZETXR, -TX_BUFFERS);
  199. first_free_addr = RX_BUFFERS * 8 + TX_BUFFERS * 8 + 16;
  200. hdr_addr = 0;
  201. priv->rxhead = 0;
  202. priv->rxtail = 0;
  203. priv->rxhdr = hdr_addr;
  204. for (i = 0; i < RX_BUFFERS; i++) {
  205. priv->rxbuffer[i] = first_free_addr;
  206. am_writeword (dev, hdr_addr, first_free_addr);
  207. am_writeword (dev, hdr_addr + 2, RMD_OWN);
  208. am_writeword (dev, hdr_addr + 4, (-1600));
  209. am_writeword (dev, hdr_addr + 6, 0);
  210. first_free_addr += 1600;
  211. hdr_addr += 8;
  212. }
  213. priv->txhead = 0;
  214. priv->txtail = 0;
  215. priv->txhdr = hdr_addr;
  216. for (i = 0; i < TX_BUFFERS; i++) {
  217. priv->txbuffer[i] = first_free_addr;
  218. am_writeword (dev, hdr_addr, first_free_addr);
  219. am_writeword (dev, hdr_addr + 2, TMD_STP|TMD_ENP);
  220. am_writeword (dev, hdr_addr + 4, 0xf000);
  221. am_writeword (dev, hdr_addr + 6, 0);
  222. first_free_addr += 1600;
  223. hdr_addr += 8;
  224. }
  225. write_rreg (dev->base_addr, BASERXL, priv->rxhdr);
  226. write_rreg (dev->base_addr, BASERXH, 0);
  227. write_rreg (dev->base_addr, BASETXL, priv->txhdr);
  228. write_rreg (dev->base_addr, BASERXH, 0);
  229. write_rreg (dev->base_addr, CSR0, CSR0_STOP);
  230. write_rreg (dev->base_addr, CSR3, CSR3_IDONM|CSR3_BABLM|CSR3_DXSUFLO);
  231. write_rreg (dev->base_addr, CSR0, CSR0_IENA|CSR0_STRT);
  232. }
  233. /*
  234.  * Open/initialize the board.
  235.  */
  236. static int
  237. am79c961_open(struct net_device *dev)
  238. {
  239. struct dev_priv *priv = (struct dev_priv *)dev->priv;
  240. int ret;
  241. memset (&priv->stats, 0, sizeof (priv->stats));
  242. ret = request_irq(dev->irq, am79c961_interrupt, 0, dev->name, dev);
  243. if (ret)
  244. return ret;
  245. am79c961_init_for_open(dev);
  246. netif_start_queue(dev);
  247. return 0;
  248. }
  249. /*
  250.  * The inverse routine to am79c961_open().
  251.  */
  252. static int
  253. am79c961_close(struct net_device *dev)
  254. {
  255. struct dev_priv *priv = (struct dev_priv *)dev->priv;
  256. unsigned long flags;
  257. netif_stop_queue(dev);
  258. spin_lock_irqsave(priv->chip_lock, flags);
  259. write_rreg (dev->base_addr, CSR0, CSR0_STOP);
  260. write_rreg (dev->base_addr, CSR3, CSR3_MASKALL);
  261. spin_unlock_irqrestore(priv->chip_lock, flags);
  262. free_irq (dev->irq, dev);
  263. return 0;
  264. }
  265. /*
  266.  * Get the current statistics.
  267.  */
  268. static struct net_device_stats *am79c961_getstats (struct net_device *dev)
  269. {
  270. struct dev_priv *priv = (struct dev_priv *)dev->priv;
  271. return &priv->stats;
  272. }
  273. static void am79c961_mc_hash(struct dev_mc_list *dmi, unsigned short *hash)
  274. {
  275. if (dmi->dmi_addrlen == ETH_ALEN && dmi->dmi_addr[0] & 0x01) {
  276. int idx, bit;
  277. u32 crc;
  278. crc = ether_crc_le(ETH_ALEN, dmi->dmi_addr);
  279. idx = crc >> 30;
  280. bit = (crc >> 26) & 15;
  281. hash[idx] |= 1 << bit;
  282. }
  283. }
  284. /*
  285.  * Set or clear promiscuous/multicast mode filter for this adapter.
  286.  */
  287. static void am79c961_setmulticastlist (struct net_device *dev)
  288. {
  289. struct dev_priv *priv = (struct dev_priv *)dev->priv;
  290. unsigned long flags;
  291. unsigned short multi_hash[4], mode;
  292. int i, stopped;
  293. mode = MODE_PORT_10BT;
  294. if (dev->flags & IFF_PROMISC) {
  295. mode |= MODE_PROMISC;
  296. } else if (dev->flags & IFF_ALLMULTI) {
  297. memset(multi_hash, 0xff, sizeof(multi_hash));
  298. } else {
  299. struct dev_mc_list *dmi;
  300. memset(multi_hash, 0x00, sizeof(multi_hash));
  301. for (dmi = dev->mc_list; dmi; dmi = dmi->next)
  302. am79c961_mc_hash(dmi, multi_hash);
  303. }
  304. spin_lock_irqsave(priv->chip_lock, flags);
  305. stopped = read_rreg(dev->base_addr, CSR0) & CSR0_STOP;
  306. if (!stopped) {
  307. /*
  308.  * Put the chip into suspend mode
  309.  */
  310. write_rreg(dev->base_addr, CTRL1, CTRL1_SPND);
  311. /*
  312.  * Spin waiting for chip to report suspend mode
  313.  */
  314. while ((read_rreg(dev->base_addr, CTRL1) & CTRL1_SPND) == 0) {
  315. spin_unlock_irqrestore(priv->chip_lock, flags);
  316. nop();
  317. spin_lock_irqsave(priv->chip_lock, flags);
  318. }
  319. }
  320. /*
  321.  * Update the multicast hash table
  322.  */
  323. for (i = 0; i < sizeof(multi_hash) / sizeof(multi_hash[0]); i++)
  324. write_rreg(dev->base_addr, i + LADRL, multi_hash[i]);
  325. /*
  326.  * Write the mode register
  327.  */
  328. write_rreg(dev->base_addr, MODE, mode);
  329. if (!stopped) {
  330. /*
  331.  * Put the chip back into running mode
  332.  */
  333. write_rreg(dev->base_addr, CTRL1, 0);
  334. }
  335. spin_unlock_irqrestore(priv->chip_lock, flags);
  336. }
  337. static void am79c961_timeout(struct net_device *dev)
  338. {
  339. printk(KERN_WARNING "%s: transmit timed out, network cable problem?n",
  340. dev->name);
  341. /*
  342.  * ought to do some setup of the tx side here
  343.  */
  344. netif_wake_queue(dev);
  345. }
  346. /*
  347.  * Transmit a packet
  348.  */
  349. static int
  350. am79c961_sendpacket(struct sk_buff *skb, struct net_device *dev)
  351. {
  352. struct dev_priv *priv = (struct dev_priv *)dev->priv;
  353. unsigned int length = ETH_ZLEN < skb->len ? skb->len : ETH_ZLEN;
  354. unsigned int hdraddr, bufaddr;
  355. unsigned int head;
  356. unsigned long flags;
  357. head = priv->txhead;
  358. hdraddr = priv->txhdr + (head << 3);
  359. bufaddr = priv->txbuffer[head];
  360. head += 1;
  361. if (head >= TX_BUFFERS)
  362. head = 0;
  363. am_writebuffer (dev, bufaddr, skb->data, length);
  364. am_writeword (dev, hdraddr + 4, -length);
  365. am_writeword (dev, hdraddr + 2, TMD_OWN|TMD_STP|TMD_ENP);
  366. priv->txhead = head;
  367. spin_lock_irqsave(priv->chip_lock, flags);
  368. write_rreg (dev->base_addr, CSR0, CSR0_TDMD|CSR0_IENA);
  369. dev->trans_start = jiffies;
  370. spin_unlock_irqrestore(priv->chip_lock, flags);
  371. /*
  372.  * If the next packet is owned by the ethernet device,
  373.  * then the tx ring is full and we can't add another
  374.  * packet.
  375.  */
  376. if (am_readword(dev, priv->txhdr + (priv->txhead << 3) + 2) & TMD_OWN)
  377. netif_stop_queue(dev);
  378. dev_kfree_skb(skb);
  379. return 0;
  380. }
  381. /*
  382.  * If we have a good packet(s), get it/them out of the buffers.
  383.  */
  384. static void
  385. am79c961_rx(struct net_device *dev, struct dev_priv *priv)
  386. {
  387. do {
  388. struct sk_buff *skb;
  389. u_int hdraddr;
  390. u_int pktaddr;
  391. u_int status;
  392. int len;
  393. hdraddr = priv->rxhdr + (priv->rxtail << 3);
  394. pktaddr = priv->rxbuffer[priv->rxtail];
  395. status = am_readword (dev, hdraddr + 2);
  396. if (status & RMD_OWN) /* do we own it? */
  397. break;
  398. priv->rxtail ++;
  399. if (priv->rxtail >= RX_BUFFERS)
  400. priv->rxtail = 0;
  401. if ((status & (RMD_ERR|RMD_STP|RMD_ENP)) != (RMD_STP|RMD_ENP)) {
  402. am_writeword (dev, hdraddr + 2, RMD_OWN);
  403. priv->stats.rx_errors ++;
  404. if (status & RMD_ERR) {
  405. if (status & RMD_FRAM)
  406. priv->stats.rx_frame_errors ++;
  407. if (status & RMD_CRC)
  408. priv->stats.rx_crc_errors ++;
  409. } else if (status & RMD_STP)
  410. priv->stats.rx_length_errors ++;
  411. continue;
  412. }
  413. len = am_readword(dev, hdraddr + 6);
  414. skb = dev_alloc_skb(len + 2);
  415. if (skb) {
  416. skb->dev = dev;
  417. skb_reserve(skb, 2);
  418. am_readbuffer(dev, pktaddr, skb_put(skb, len), len);
  419. am_writeword(dev, hdraddr + 2, RMD_OWN);
  420. skb->protocol = eth_type_trans(skb, dev);
  421. netif_rx(skb);
  422. dev->last_rx = jiffies;
  423. priv->stats.rx_bytes += len;
  424. priv->stats.rx_packets ++;
  425. } else {
  426. am_writeword (dev, hdraddr + 2, RMD_OWN);
  427. printk (KERN_WARNING "%s: memory squeeze, dropping packet.n", dev->name);
  428. priv->stats.rx_dropped ++;
  429. break;
  430. }
  431. } while (1);
  432. }
  433. /*
  434.  * Update stats for the transmitted packet
  435.  */
  436. static void
  437. am79c961_tx(struct net_device *dev, struct dev_priv *priv)
  438. {
  439. do {
  440. u_int hdraddr;
  441. u_int status;
  442. hdraddr = priv->txhdr + (priv->txtail << 3);
  443. status = am_readword (dev, hdraddr + 2);
  444. if (status & TMD_OWN)
  445. break;
  446. priv->txtail ++;
  447. if (priv->txtail >= TX_BUFFERS)
  448. priv->txtail = 0;
  449. if (status & TMD_ERR) {
  450. u_int status2;
  451. priv->stats.tx_errors ++;
  452. status2 = am_readword (dev, hdraddr + 6);
  453. /*
  454.  * Clear the error byte
  455.  */
  456. am_writeword (dev, hdraddr + 6, 0);
  457. if (status2 & TST_RTRY)
  458. priv->stats.collisions += 16;
  459. if (status2 & TST_LCOL)
  460. priv->stats.tx_window_errors ++;
  461. if (status2 & TST_LCAR)
  462. priv->stats.tx_carrier_errors ++;
  463. if (status2 & TST_UFLO)
  464. priv->stats.tx_fifo_errors ++;
  465. continue;
  466. }
  467. priv->stats.tx_packets ++;
  468. } while (priv->txtail != priv->txhead);
  469. netif_wake_queue(dev);
  470. }
  471. static void
  472. am79c961_interrupt(int irq, void *dev_id, struct pt_regs *regs)
  473. {
  474. struct net_device *dev = (struct net_device *)dev_id;
  475. struct dev_priv *priv = (struct dev_priv *)dev->priv;
  476. u_int status;
  477. status = read_rreg(dev->base_addr, CSR0);
  478. write_rreg(dev->base_addr, CSR0, status & (CSR0_TINT|CSR0_RINT|CSR0_MISS|CSR0_IENA));
  479. if (status & CSR0_RINT)
  480. am79c961_rx(dev, priv);
  481. if (status & CSR0_TINT)
  482. am79c961_tx(dev, priv);
  483. if (status & CSR0_MISS)
  484. priv->stats.rx_dropped ++;
  485. }
  486. /*
  487.  * Initialise the chip.  Note that we always expect
  488.  * to be entered with interrupts enabled.
  489.  */
  490. static int
  491. am79c961_hw_init(struct net_device *dev)
  492. {
  493. struct dev_priv *priv = (struct dev_priv *)dev->priv;
  494. spin_lock_irq(priv->chip_lock);
  495. write_rreg (dev->base_addr, CSR0, CSR0_STOP);
  496. write_rreg (dev->base_addr, CSR3, CSR3_MASKALL);
  497. spin_unlock_irq(priv->chip_lock);
  498. am79c961_ramtest(dev, 0x66);
  499. am79c961_ramtest(dev, 0x99);
  500. return 0;
  501. }
  502. static void __init am79c961_banner(void)
  503. {
  504. static unsigned version_printed;
  505. if (net_debug && version_printed++ == 0)
  506. printk(KERN_INFO "%s", version);
  507. }
  508. static int __init am79c961_init(void)
  509. {
  510. struct net_device *dev;
  511. struct dev_priv *priv;
  512. int i, ret;
  513. dev = init_etherdev(NULL, sizeof(struct dev_priv));
  514. ret = -ENOMEM;
  515. if (!dev)
  516. goto out;
  517. priv = dev->priv;
  518. /*
  519.  * Fixed address and IRQ lines here.
  520.  * The PNP initialisation should have been
  521.  * done by the ether bootp loader.
  522.  */
  523. dev->base_addr = 0x220;
  524. dev->irq = IRQ_EBSA110_ETHERNET;
  525. /*
  526.  * Reset the device.
  527.  */
  528. inb(dev->base_addr + NET_RESET);
  529. udelay(5);
  530. /*
  531.  * Check the manufacturer part of the
  532.  * ether address.
  533.  */
  534.      ret = -ENODEV;
  535. if (inb(dev->base_addr) != 0x08 ||
  536.     inb(dev->base_addr + 2) != 0x00 ||
  537.     inb(dev->base_addr + 4) != 0x2b)
  538.      goto nodev;
  539. if (!request_region(dev->base_addr, 0x18, dev->name))
  540. goto nodev;
  541. am79c961_banner();
  542. printk(KERN_INFO "%s: ether address ", dev->name);
  543. /* Retrive and print the ethernet address. */
  544. for (i = 0; i < 6; i++) {
  545. dev->dev_addr[i] = inb(dev->base_addr + i * 2) & 0xff;
  546. printk (i == 5 ? "%02xn" : "%02x:", dev->dev_addr[i]);
  547. }
  548. if (am79c961_hw_init(dev))
  549. goto release;
  550. dev->open = am79c961_open;
  551. dev->stop = am79c961_close;
  552. dev->hard_start_xmit = am79c961_sendpacket;
  553. dev->get_stats = am79c961_getstats;
  554. dev->set_multicast_list = am79c961_setmulticastlist;
  555. dev->tx_timeout = am79c961_timeout;
  556. return 0;
  557. release:
  558. release_region(dev->base_addr, 0x18);
  559. nodev:
  560. unregister_netdev(dev);
  561. kfree(dev);
  562. out:
  563. return ret;
  564. }
  565. __initcall(am79c961_init);