summaryrefslogtreecommitdiffstats
path: root/src/drivers/net/myson.c
blob: 84a5505964b42fd55ad3766a0c14e61e20f56a99 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
/*
 * Copyright (C) 2012 Michael Brown <mbrown@fensystems.co.uk>.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301, USA.
 *
 * You can also choose to distribute this program under the terms of
 * the Unmodified Binary Distribution Licence (as given in the file
 * COPYING.UBDL), provided that you have satisfied its requirements.
 */

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );

#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <byteswap.h>
#include <ipxe/netdevice.h>
#include <ipxe/ethernet.h>
#include <ipxe/if_ether.h>
#include <ipxe/iobuf.h>
#include <ipxe/malloc.h>
#include <ipxe/pci.h>
#include <ipxe/mii.h>
#include "myson.h"

/** @file
 *
 * Myson Technology network card driver
 *
 */

/******************************************************************************
 *
 * Device reset
 *
 ******************************************************************************
 */

/**
 * Reset controller chip
 *
 * @v myson		Myson device
 * @ret rc		Return status code
 */
static int myson_soft_reset ( struct myson_nic *myson ) {
	uint32_t bcr;
	unsigned int i;

	/* Initiate reset */
	bcr = readl ( myson->regs + MYSON_BCR );
	writel ( ( bcr | MYSON_BCR_SWR ), myson->regs + MYSON_BCR );

	/* Wait for reset to complete */
	for ( i = 0 ; i < MYSON_RESET_MAX_WAIT_MS ; i++ ) {

		/* If reset is not complete, delay 1ms and retry */
		if ( readl ( myson->regs + MYSON_BCR ) & MYSON_BCR_SWR ) {
			mdelay ( 1 );
			continue;
		}

		/* Apply a sensible default bus configuration */
		bcr = readl ( myson->regs + MYSON_BCR );
		bcr &= ~MYSON_BCR_PBL_MASK;
		bcr |= ( MYSON_BCR_RLE | MYSON_BCR_RME | MYSON_BCR_WIE |
			 MYSON_BCR_PBL_DEFAULT );
		writel ( bcr, myson->regs + MYSON_BCR );
		DBGC ( myson, "MYSON %p using configuration %08x\n",
		       myson, bcr );

		return 0;
	}

	DBGC ( myson, "MYSON %p timed out waiting for reset\n", myson );
	return -ETIMEDOUT;
}

/**
 * Reload configuration from EEPROM
 *
 * @v myson		Myson device
 * @ret rc		Return status code
 */
static int myson_reload_config ( struct myson_nic *myson ) {
	unsigned int i;

	/* Initiate reload */
	writel ( MYSON_ROM_AUTOLD, myson->regs + MYSON_ROM_MII );

	/* Wait for reload to complete */
	for ( i = 0 ; i < MYSON_AUTOLD_MAX_WAIT_MS ; i++ ) {

		/* If reload is not complete, delay 1ms and retry */
		if ( readl ( myson->regs + MYSON_ROM_MII ) & MYSON_ROM_AUTOLD ){
			mdelay ( 1 );
			continue;
		}

		return 0;
	}

	DBGC ( myson, "MYSON %p timed out waiting for configuration "
	       "reload\n", myson );
	return -ETIMEDOUT;
}

/**
 * Reset hardware
 *
 * @v myson		Myson device
 * @ret rc		Return status code
 */
static int myson_reset ( struct myson_nic *myson ) {
	int rc;

	/* Disable all interrupts */
	writel ( 0, myson->regs + MYSON_IMR );

	/* Perform soft reset */
	if ( ( rc = myson_soft_reset ( myson ) ) != 0 )
		return rc;

	/* Reload configuration from EEPROM */
	if ( ( rc = myson_reload_config ( myson ) ) != 0 )
		return rc;

	return 0;
}

/******************************************************************************
 *
 * Network device interface
 *
 ******************************************************************************
 */

/**
 * Create descriptor ring
 *
 * @v myson		Myson device
 * @v ring		Descriptor ring
 * @ret rc		Return status code
 */
static int myson_create_ring ( struct myson_nic *myson,
			       struct myson_ring *ring ) {
	size_t len = ( ring->count * sizeof ( ring->desc[0] ) );
	struct myson_descriptor *desc;
	struct myson_descriptor *next;
	physaddr_t address;
	unsigned int i;
	int rc;

	/* Allocate descriptor ring */
	ring->desc = malloc_dma ( len, MYSON_RING_ALIGN );
	if ( ! ring->desc ) {
		rc = -ENOMEM;
		goto err_alloc;
	}
	address = virt_to_bus ( ring->desc );

	/* Check address is usable by card */
	if ( ! myson_address_ok ( address + len ) ) {
		DBGC ( myson, "MYSON %p cannot support 64-bit ring address\n",
		       myson );
		rc = -ENOTSUP;
		goto err_64bit;
	}

	/* Initialise descriptor ring */
	memset ( ring->desc, 0, len );
	for ( i = 0 ; i < ring->count ; i++ ) {
		desc = &ring->desc[i];
		next = &ring->desc[ ( i + 1 ) % ring->count ];
		desc->next = cpu_to_le32 ( virt_to_bus ( next ) );
	}

	/* Program ring address */
	writel ( address, myson->regs + ring->reg );
	DBGC ( myson, "MYSON %p ring %02x is at [%08llx,%08llx)\n",
	       myson, ring->reg, ( ( unsigned long long ) address ),
	       ( ( unsigned long long ) address + len ) );

	return 0;

 err_64bit:
	free_dma ( ring->desc, len );
	ring->desc = NULL;
 err_alloc:
	return rc;
}

/**
 * Destroy descriptor ring
 *
 * @v myson		Myson device
 * @v ring		Descriptor ring
 */
static void myson_destroy_ring ( struct myson_nic *myson,
				 struct myson_ring *ring ) {
	size_t len = ( ring->count * sizeof ( ring->desc[0] ) );

	/* Clear ring address */
	writel ( 0, myson->regs + ring->reg );

	/* Free descriptor ring */
	free_dma ( ring->desc, len );
	ring->desc = NULL;
	ring->prod = 0;
	ring->cons = 0;
}

/**
 * Refill receive descriptor ring
 *
 * @v netdev		Network device
 */
static void myson_refill_rx ( struct net_device *netdev ) {
	struct myson_nic *myson = netdev->priv;
	struct myson_descriptor *rx;
	struct io_buffer *iobuf;
	unsigned int rx_idx;
	physaddr_t address;

	while ( ( myson->rx.prod - myson->rx.cons ) < MYSON_NUM_RX_DESC ) {

		/* Allocate I/O buffer */
		iobuf = alloc_iob ( MYSON_RX_MAX_LEN );
		if ( ! iobuf ) {
			/* Wait for next refill */
			return;
		}

		/* Check address is usable by card */
		address = virt_to_bus ( iobuf->data );
		if ( ! myson_address_ok ( address ) ) {
			DBGC ( myson, "MYSON %p cannot support 64-bit RX "
			       "buffer address\n", myson );
			netdev_rx_err ( netdev, iobuf, -ENOTSUP );
			return;
		}

		/* Get next receive descriptor */
		rx_idx = ( myson->rx.prod++ % MYSON_NUM_RX_DESC );
		rx = &myson->rx.desc[rx_idx];

		/* Populate receive descriptor */
		rx->address = cpu_to_le32 ( address );
		rx->control =
			cpu_to_le32 ( MYSON_RX_CTRL_RBS ( MYSON_RX_MAX_LEN ) );
		wmb();
		rx->status = cpu_to_le32 ( MYSON_RX_STAT_OWN );
		wmb();

		/* Record I/O buffer */
		assert ( myson->rx_iobuf[rx_idx] == NULL );
		myson->rx_iobuf[rx_idx] = iobuf;

		/* Notify card that there are descriptors available */
		writel ( 0, myson->regs + MYSON_RXPDR );

		DBGC2 ( myson, "MYSON %p RX %d is [%llx,%llx)\n", myson,
			rx_idx, ( ( unsigned long long ) address ),
			( ( unsigned long long ) address + MYSON_RX_MAX_LEN ) );
	}
}

/**
 * Open network device
 *
 * @v netdev		Network device
 * @ret rc		Return status code
 */
static int myson_open ( struct net_device *netdev ) {
	struct myson_nic *myson = netdev->priv;
	union myson_physical_address mac;
	int rc;

	/* Set MAC address */
	memset ( &mac, 0, sizeof ( mac ) );
	memcpy ( mac.raw, netdev->ll_addr, ETH_ALEN );
	writel ( le32_to_cpu ( mac.reg.low ), myson->regs + MYSON_PAR0 );
	writel ( le32_to_cpu ( mac.reg.high ), myson->regs + MYSON_PAR4 );

	/* Create transmit descriptor ring */
	if ( ( rc = myson_create_ring ( myson, &myson->tx ) ) != 0 )
		goto err_create_tx;

	/* Create receive descriptor ring */
	if ( ( rc = myson_create_ring ( myson, &myson->rx ) ) != 0 )
		goto err_create_rx;

	/* Configure transmitter and receiver */
	writel ( ( MYSON_TCR_TE | MYSON_RCR_PROM | MYSON_RCR_AB | MYSON_RCR_AM |
		   MYSON_RCR_ARP | MYSON_RCR_ALP | MYSON_RCR_RE ),
		 myson->regs + MYSON_TCR_RCR );

	/* Fill receive ring */
	myson_refill_rx ( netdev );

	return 0;

	myson_destroy_ring ( myson, &myson->rx );
 err_create_rx:
	myson_destroy_ring ( myson, &myson->tx );
 err_create_tx:
	return rc;
}

/**
 * Wait for transmit and receive to become idle
 *
 * @v myson		Myson device
 * @ret rc		Return status code
 */
static int myson_wait_idle ( struct myson_nic *myson ) {
	uint32_t tcr_rcr;
	unsigned int i;

	/* Wait for both transmit and receive to be idle */
	for ( i = 0 ; i < MYSON_IDLE_MAX_WAIT_MS ; i++ ) {

		/* If either process is running, delay 1ms and retry */
		tcr_rcr = readl ( myson->regs + MYSON_TCR_RCR );
		if ( tcr_rcr & ( MYSON_TCR_TXS | MYSON_RCR_RXS ) ) {
			mdelay ( 1 );
			continue;
		}

		return 0;
	}

	DBGC ( myson, "MYSON %p timed out waiting for idle state (status "
	       "%08x)\n", myson, tcr_rcr );
	return -ETIMEDOUT;
}

/**
 * Close network device
 *
 * @v netdev		Network device
 */
static void myson_close ( struct net_device *netdev ) {
	struct myson_nic *myson = netdev->priv;
	unsigned int i;

	/* Disable receiver and transmitter */
	writel ( 0, myson->regs + MYSON_TCR_RCR );

	/* Allow time for receiver and transmitter to become idle */
	myson_wait_idle ( myson );

	/* Destroy receive descriptor ring */
	myson_destroy_ring ( myson, &myson->rx );

	/* Discard any unused receive buffers */
	for ( i = 0 ; i < MYSON_NUM_RX_DESC ; i++ ) {
		if ( myson->rx_iobuf[i] )
			free_iob ( myson->rx_iobuf[i] );
		myson->rx_iobuf[i] = NULL;
	}

	/* Destroy transmit descriptor ring */
	myson_destroy_ring ( myson, &myson->tx );
}

/**
 * Transmit packet
 *
 * @v netdev		Network device
 * @v iobuf		I/O buffer
 * @ret rc		Return status code
 */
static int myson_transmit ( struct net_device *netdev,
			    struct io_buffer *iobuf ) {
	struct myson_nic *myson = netdev->priv;
	struct myson_descriptor *tx;
	unsigned int tx_idx;
	physaddr_t address;

	/* Check address is usable by card */
	address = virt_to_bus ( iobuf->data );
	if ( ! myson_address_ok ( address ) ) {
		DBGC ( myson, "MYSON %p cannot support 64-bit TX buffer "
		       "address\n", myson );
		return -ENOTSUP;
	}

	/* Get next transmit descriptor */
	if ( ( myson->tx.prod - myson->tx.cons ) >= MYSON_NUM_TX_DESC ) {
		DBGC ( myson, "MYSON %p out of transmit descriptors\n",
		       myson );
		return -ENOBUFS;
	}
	tx_idx = ( myson->tx.prod++ % MYSON_NUM_TX_DESC );
	tx = &myson->tx.desc[tx_idx];

	/* Populate transmit descriptor */
	tx->address = cpu_to_le32 ( address );
	tx->control = cpu_to_le32 ( MYSON_TX_CTRL_IC | MYSON_TX_CTRL_LD |
				    MYSON_TX_CTRL_FD | MYSON_TX_CTRL_CRC |
				    MYSON_TX_CTRL_PAD | MYSON_TX_CTRL_RTLC |
				    MYSON_TX_CTRL_PKTS ( iob_len ( iobuf ) ) |
				    MYSON_TX_CTRL_TBS ( iob_len ( iobuf ) ) );
	wmb();
	tx->status = cpu_to_le32 ( MYSON_TX_STAT_OWN );
	wmb();

	/* Notify card that there are packets ready to transmit */
	writel ( 0, myson->regs + MYSON_TXPDR );

	DBGC2 ( myson, "MYSON %p TX %d is [%llx,%llx)\n", myson, tx_idx,
		( ( unsigned long long ) address ),
		( ( unsigned long long ) address + iob_len ( iobuf ) ) );

	return 0;
}

/**
 * Poll for completed packets
 *
 * @v netdev		Network device
 */
static void myson_poll_tx ( struct net_device *netdev ) {
	struct myson_nic *myson = netdev->priv;
	struct myson_descriptor *tx;
	unsigned int tx_idx;

	/* Check for completed packets */
	while ( myson->tx.cons != myson->tx.prod ) {

		/* Get next transmit descriptor */
		tx_idx = ( myson->tx.cons % MYSON_NUM_TX_DESC );
		tx = &myson->tx.desc[tx_idx];

		/* Stop if descriptor is still in use */
		if ( tx->status & cpu_to_le32 ( MYSON_TX_STAT_OWN ) )
			return;

		/* Complete TX descriptor */
		if ( tx->status & cpu_to_le32 ( MYSON_TX_STAT_ABORT |
						MYSON_TX_STAT_CSL ) ) {
			DBGC ( myson, "MYSON %p TX %d completion error "
			       "(%08x)\n", myson, tx_idx,
			       le32_to_cpu ( tx->status ) );
			netdev_tx_complete_next_err ( netdev, -EIO );
		} else {
			DBGC2 ( myson, "MYSON %p TX %d complete\n",
				myson, tx_idx );
			netdev_tx_complete_next ( netdev );
		}
		myson->tx.cons++;
	}
}

/**
 * Poll for received packets
 *
 * @v netdev		Network device
 */
static void myson_poll_rx ( struct net_device *netdev ) {
	struct myson_nic *myson = netdev->priv;
	struct myson_descriptor *rx;
	struct io_buffer *iobuf;
	unsigned int rx_idx;
	size_t len;

	/* Check for received packets */
	while ( myson->rx.cons != myson->rx.prod ) {

		/* Get next receive descriptor */
		rx_idx = ( myson->rx.cons % MYSON_NUM_RX_DESC );
		rx = &myson->rx.desc[rx_idx];

		/* Stop if descriptor is still in use */
		if ( rx->status & MYSON_RX_STAT_OWN )
			return;

		/* Populate I/O buffer */
		iobuf = myson->rx_iobuf[rx_idx];
		myson->rx_iobuf[rx_idx] = NULL;
		len = MYSON_RX_STAT_FLNG ( le32_to_cpu ( rx->status ) );
		iob_put ( iobuf, len - 4 /* strip CRC */ );

		/* Hand off to network stack */
		if ( rx->status & cpu_to_le32 ( MYSON_RX_STAT_ES ) ) {
			DBGC ( myson, "MYSON %p RX %d error (length %zd, "
			       "status %08x)\n", myson, rx_idx, len,
			       le32_to_cpu ( rx->status ) );
			netdev_rx_err ( netdev, iobuf, -EIO );
		} else {
			DBGC2 ( myson, "MYSON %p RX %d complete (length "
				"%zd)\n", myson, rx_idx, len );
			netdev_rx ( netdev, iobuf );
		}
		myson->rx.cons++;
	}
}

/**
 * Poll for completed and received packets
 *
 * @v netdev		Network device
 */
static void myson_poll ( struct net_device *netdev ) {
	struct myson_nic *myson = netdev->priv;
	uint32_t isr;
	unsigned int i;

	/* Polling the ISR seems to really upset this card; it ends up
	 * getting no useful PCI transfers done and, for some reason,
	 * flooding the network with invalid packets.  Work around
	 * this by introducing deliberate delays between ISR reads.
	 */
	for ( i = 0 ; i < MYSON_ISR_IODELAY_COUNT ; i++ )
		iodelay();

	/* Check for and acknowledge interrupts */
	isr = readl ( myson->regs + MYSON_ISR );
	if ( ! isr )
		return;
	writel ( isr, myson->regs + MYSON_ISR );

	/* Poll for TX completions, if applicable */
	if ( isr & MYSON_IRQ_TI )
		myson_poll_tx ( netdev );

	/* Poll for RX completionsm, if applicable */
	if ( isr & MYSON_IRQ_RI )
		myson_poll_rx ( netdev );

	/* Refill RX ring */
	myson_refill_rx ( netdev );
}

/**
 * Enable or disable interrupts
 *
 * @v netdev		Network device
 * @v enable		Interrupts should be enabled
 */
static void myson_irq ( struct net_device *netdev, int enable ) {
	struct myson_nic *myson = netdev->priv;
	uint32_t imr;

	imr = ( enable ? ( MYSON_IRQ_TI | MYSON_IRQ_RI ) : 0 );
	writel ( imr, myson->regs + MYSON_IMR );
}

/** Myson network device operations */
static struct net_device_operations myson_operations = {
	.open		= myson_open,
	.close		= myson_close,
	.transmit	= myson_transmit,
	.poll		= myson_poll,
	.irq		= myson_irq,
};

/******************************************************************************
 *
 * PCI interface
 *
 ******************************************************************************
 */

/**
 * Probe PCI device
 *
 * @v pci		PCI device
 * @ret rc		Return status code
 */
static int myson_probe ( struct pci_device *pci ) {
	struct net_device *netdev;
	struct myson_nic *myson;
	union myson_physical_address mac;
	int rc;

	/* Allocate and initialise net device */
	netdev = alloc_etherdev ( sizeof ( *myson ) );
	if ( ! netdev ) {
		rc = -ENOMEM;
		goto err_alloc;
	}
	netdev_init ( netdev, &myson_operations );
	myson = netdev->priv;
	pci_set_drvdata ( pci, netdev );
	netdev->dev = &pci->dev;
	memset ( myson, 0, sizeof ( *myson ) );
	myson_init_ring ( &myson->tx, MYSON_NUM_TX_DESC, MYSON_TXLBA );
	myson_init_ring ( &myson->rx, MYSON_NUM_RX_DESC, MYSON_RXLBA );

	/* Fix up PCI device */
	adjust_pci_device ( pci );

	/* Map registers */
	myson->regs = ioremap ( pci->membase, MYSON_BAR_SIZE );
	if ( ! myson->regs ) {
		rc = -ENODEV;
		goto err_ioremap;
	}

	/* Reset the NIC */
	if ( ( rc = myson_reset ( myson ) ) != 0 )
		goto err_reset;

	/* Read MAC address */
	mac.reg.low = cpu_to_le32 ( readl ( myson->regs + MYSON_PAR0 ) );
	mac.reg.high = cpu_to_le32 ( readl ( myson->regs + MYSON_PAR4 ) );
	memcpy ( netdev->hw_addr, mac.raw, ETH_ALEN );

	/* Register network device */
	if ( ( rc = register_netdev ( netdev ) ) != 0 )
		goto err_register_netdev;

	/* Mark as link up; we don't yet handle link state */
	netdev_link_up ( netdev );

	return 0;

	unregister_netdev ( netdev );
 err_register_netdev:
	myson_reset ( myson );
 err_reset:
	iounmap ( myson->regs );
 err_ioremap:
	netdev_nullify ( netdev );
	netdev_put ( netdev );
 err_alloc:
	return rc;
}

/**
 * Remove PCI device
 *
 * @v pci		PCI device
 */
static void myson_remove ( struct pci_device *pci ) {
	struct net_device *netdev = pci_get_drvdata ( pci );
	struct myson_nic *myson = netdev->priv;

	/* Unregister network device */
	unregister_netdev ( netdev );

	/* Reset card */
	myson_reset ( myson );

	/* Free network device */
	iounmap ( myson->regs );
	netdev_nullify ( netdev );
	netdev_put ( netdev );
}

/** Myson PCI device IDs */
static struct pci_device_id myson_nics[] = {
        PCI_ROM ( 0x1516, 0x0800, "mtd800", "MTD-8xx", 0 ),
        PCI_ROM ( 0x1516, 0x0803, "mtd803", "Surecom EP-320X-S", 0 ),
        PCI_ROM ( 0x1516, 0x0891, "mtd891", "MTD-8xx", 0 ),
};

/** Myson PCI driver */
struct pci_driver myson_driver __pci_driver = {
	.ids = myson_nics,
	.id_count = ( sizeof ( myson_nics ) / sizeof ( myson_nics[0] ) ),
	.probe = myson_probe,
	.remove = myson_remove,
};