355
355
#define MAX_PORTS_PER_BOARD 32 /* Don't change this value */
356
356
#define MAX_PORTS (MAX_BOARDS * MAX_PORTS_PER_BOARD)
357
357
358
- #define MOXA_IS_320 (brd ) ((brd)->boardType == MOXA_BOARD_C320_ISA || \
359
- (brd)->boardType == MOXA_BOARD_C320_PCI)
360
-
361
- /*
362
- * Define the Moxa PCI vendor and device IDs.
363
- */
364
- #define MOXA_BUS_TYPE_ISA 0
365
- #define MOXA_BUS_TYPE_PCI 1
358
+ #define MOXA_IS_320 (brd ) ((brd)->boardType == MOXA_BOARD_C320_PCI)
366
359
367
360
enum {
368
361
MOXA_BOARD_C218_PCI = 1 ,
369
- MOXA_BOARD_C218_ISA ,
370
362
MOXA_BOARD_C320_PCI ,
371
- MOXA_BOARD_C320_ISA ,
372
363
MOXA_BOARD_CP204J ,
373
364
};
374
365
375
366
static char * moxa_brdname [] =
376
367
{
377
368
"C218 Turbo PCI series" ,
378
- "C218 Turbo ISA series" ,
379
369
"C320 Turbo PCI series" ,
380
- "C320 Turbo ISA series" ,
381
370
"CP-204J series" ,
382
371
};
383
372
384
- #ifdef CONFIG_PCI
385
373
static const struct pci_device_id moxa_pcibrds [] = {
386
374
{ PCI_DEVICE (PCI_VENDOR_ID_MOXA , PCI_DEVICE_ID_MOXA_C218 ),
387
375
.driver_data = MOXA_BOARD_C218_PCI },
@@ -392,14 +380,12 @@ static const struct pci_device_id moxa_pcibrds[] = {
392
380
{ 0 }
393
381
};
394
382
MODULE_DEVICE_TABLE (pci , moxa_pcibrds );
395
- #endif /* CONFIG_PCI */
396
383
397
384
struct moxa_port ;
398
385
399
386
static struct moxa_board_conf {
400
387
int boardType ;
401
388
int numPorts ;
402
- int busType ;
403
389
404
390
unsigned int ready ;
405
391
@@ -459,9 +445,6 @@ static unsigned int moxaLowWaterChk;
459
445
static DEFINE_MUTEX (moxa_openlock );
460
446
static DEFINE_SPINLOCK (moxa_lock );
461
447
462
- static unsigned long baseaddr [MAX_BOARDS ];
463
- static unsigned int type [MAX_BOARDS ];
464
- static unsigned int numports [MAX_BOARDS ];
465
448
static struct tty_port moxa_service_port ;
466
449
467
450
MODULE_AUTHOR ("William Chen" );
@@ -471,13 +454,6 @@ MODULE_FIRMWARE("c218tunx.cod");
471
454
MODULE_FIRMWARE ("cp204unx.cod" );
472
455
MODULE_FIRMWARE ("c320tunx.cod" );
473
456
474
- module_param_array (type , uint , NULL , 0 );
475
- MODULE_PARM_DESC (type , "card type: C218=2, C320=4" );
476
- module_param_hw_array (baseaddr , ulong , ioport , NULL , 0 );
477
- MODULE_PARM_DESC (baseaddr , "base address" );
478
- module_param_array (numports , uint , NULL , 0 );
479
- MODULE_PARM_DESC (numports , "numports (ignored for C218)" );
480
-
481
457
module_param (ttymajor , int , 0 );
482
458
483
459
/*
@@ -723,7 +699,6 @@ static DEFINE_TIMER(moxaTimer, moxa_poll);
723
699
static int moxa_check_fw_model (struct moxa_board_conf * brd , u8 model )
724
700
{
725
701
switch (brd -> boardType ) {
726
- case MOXA_BOARD_C218_ISA :
727
702
case MOXA_BOARD_C218_PCI :
728
703
if (model != 1 )
729
704
goto err ;
@@ -767,7 +742,6 @@ static int moxa_load_bios(struct moxa_board_conf *brd, const u8 *buf,
767
742
msleep (2000 );
768
743
769
744
switch (brd -> boardType ) {
770
- case MOXA_BOARD_C218_ISA :
771
745
case MOXA_BOARD_C218_PCI :
772
746
tmp = readw (baseAddr + C218_key );
773
747
if (tmp != C218_KeyCode )
@@ -831,7 +805,6 @@ static int moxa_real_load_code(struct moxa_board_conf *brd, const void *ptr,
831
805
832
806
switch (brd -> boardType ) {
833
807
case MOXA_BOARD_CP204J :
834
- case MOXA_BOARD_C218_ISA :
835
808
case MOXA_BOARD_C218_PCI :
836
809
key = C218_key ;
837
810
loadbuf = C218_LoadBuf ;
@@ -896,15 +869,9 @@ static int moxa_real_load_code(struct moxa_board_conf *brd, const void *ptr,
896
869
return - EIO ;
897
870
898
871
if (MOXA_IS_320 (brd )) {
899
- if (brd -> busType == MOXA_BUS_TYPE_PCI ) { /* ASIC board */
900
- writew (0x3800 , baseAddr + TMS320_PORT1 );
901
- writew (0x3900 , baseAddr + TMS320_PORT2 );
902
- writew (28499 , baseAddr + TMS320_CLOCK );
903
- } else {
904
- writew (0x3200 , baseAddr + TMS320_PORT1 );
905
- writew (0x3400 , baseAddr + TMS320_PORT2 );
906
- writew (19999 , baseAddr + TMS320_CLOCK );
907
- }
872
+ writew (0x3800 , baseAddr + TMS320_PORT1 );
873
+ writew (0x3900 , baseAddr + TMS320_PORT2 );
874
+ writew (28499 , baseAddr + TMS320_CLOCK );
908
875
}
909
876
writew (1 , baseAddr + Disable_IRQ );
910
877
writew (0 , baseAddr + Magic_no );
@@ -955,7 +922,6 @@ static int moxa_load_code(struct moxa_board_conf *brd, const void *ptr,
955
922
return retval ;
956
923
957
924
switch (brd -> boardType ) {
958
- case MOXA_BOARD_C218_ISA :
959
925
case MOXA_BOARD_C218_PCI :
960
926
case MOXA_BOARD_CP204J :
961
927
port = brd -> ports ;
@@ -1139,7 +1105,6 @@ static int moxa_init_board(struct moxa_board_conf *brd, struct device *dev)
1139
1105
}
1140
1106
1141
1107
switch (brd -> boardType ) {
1142
- case MOXA_BOARD_C218_ISA :
1143
1108
case MOXA_BOARD_C218_PCI :
1144
1109
file = "c218tunx.cod" ;
1145
1110
break ;
@@ -1225,7 +1190,6 @@ static void moxa_board_deinit(struct moxa_board_conf *brd)
1225
1190
kfree (brd -> ports );
1226
1191
}
1227
1192
1228
- #ifdef CONFIG_PCI
1229
1193
static int moxa_pci_probe (struct pci_dev * pdev ,
1230
1194
const struct pci_device_id * ent )
1231
1195
{
@@ -1268,7 +1232,6 @@ static int moxa_pci_probe(struct pci_dev *pdev,
1268
1232
1269
1233
board -> boardType = board_type ;
1270
1234
switch (board_type ) {
1271
- case MOXA_BOARD_C218_ISA :
1272
1235
case MOXA_BOARD_C218_PCI :
1273
1236
board -> numPorts = 8 ;
1274
1237
break ;
@@ -1280,7 +1243,6 @@ static int moxa_pci_probe(struct pci_dev *pdev,
1280
1243
board -> numPorts = 0 ;
1281
1244
break ;
1282
1245
}
1283
- board -> busType = MOXA_BUS_TYPE_PCI ;
1284
1246
1285
1247
retval = moxa_init_board (board , & pdev -> dev );
1286
1248
if (retval )
@@ -1316,14 +1278,10 @@ static struct pci_driver moxa_pci_driver = {
1316
1278
.probe = moxa_pci_probe ,
1317
1279
.remove = moxa_pci_remove
1318
1280
};
1319
- #endif /* CONFIG_PCI */
1320
1281
1321
1282
static int __init moxa_init (void )
1322
1283
{
1323
- unsigned int isabrds = 0 ;
1324
1284
int retval = 0 ;
1325
- struct moxa_board_conf * brd = moxa_boards ;
1326
- unsigned int i ;
1327
1285
1328
1286
tty_port_init (& moxa_service_port );
1329
1287
@@ -1352,64 +1310,16 @@ static int __init moxa_init(void)
1352
1310
return -1 ;
1353
1311
}
1354
1312
1355
- /* Find the boards defined from module args. */
1356
-
1357
- for (i = 0 ; i < MAX_BOARDS ; i ++ ) {
1358
- if (!baseaddr [i ])
1359
- break ;
1360
- if (type [i ] == MOXA_BOARD_C218_ISA ||
1361
- type [i ] == MOXA_BOARD_C320_ISA ) {
1362
- pr_debug ("Moxa board %2d: %s board(baseAddr=%lx)\n" ,
1363
- isabrds + 1 , moxa_brdname [type [i ] - 1 ],
1364
- baseaddr [i ]);
1365
- brd -> boardType = type [i ];
1366
- brd -> numPorts = type [i ] == MOXA_BOARD_C218_ISA ? 8 :
1367
- numports [i ];
1368
- brd -> busType = MOXA_BUS_TYPE_ISA ;
1369
- brd -> basemem = ioremap (baseaddr [i ], 0x4000 );
1370
- if (!brd -> basemem ) {
1371
- printk (KERN_ERR "MOXA: can't remap %lx\n" ,
1372
- baseaddr [i ]);
1373
- continue ;
1374
- }
1375
- if (moxa_init_board (brd , NULL )) {
1376
- iounmap (brd -> basemem );
1377
- brd -> basemem = NULL ;
1378
- continue ;
1379
- }
1380
-
1381
- printk (KERN_INFO "MOXA isa board found at 0x%.8lx and "
1382
- "ready (%u ports, firmware loaded)\n" ,
1383
- baseaddr [i ], brd -> numPorts );
1384
-
1385
- brd ++ ;
1386
- isabrds ++ ;
1387
- }
1388
- }
1389
-
1390
- #ifdef CONFIG_PCI
1391
1313
retval = pci_register_driver (& moxa_pci_driver );
1392
- if (retval ) {
1314
+ if (retval )
1393
1315
printk (KERN_ERR "Can't register MOXA pci driver!\n" );
1394
- if (isabrds )
1395
- retval = 0 ;
1396
- }
1397
- #endif
1398
1316
1399
1317
return retval ;
1400
1318
}
1401
1319
1402
1320
static void __exit moxa_exit (void )
1403
1321
{
1404
- unsigned int i ;
1405
-
1406
- #ifdef CONFIG_PCI
1407
1322
pci_unregister_driver (& moxa_pci_driver );
1408
- #endif
1409
-
1410
- for (i = 0 ; i < MAX_BOARDS ; i ++ ) /* ISA boards */
1411
- if (moxa_boards [i ].ready )
1412
- moxa_board_deinit (& moxa_boards [i ]);
1413
1323
1414
1324
del_timer_sync (& moxaTimer );
1415
1325
0 commit comments