355355#define MAX_PORTS_PER_BOARD 32 /* Don't change this value */
356356#define MAX_PORTS (MAX_BOARDS * MAX_PORTS_PER_BOARD)
357357
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)
366359
367360enum {
368361 MOXA_BOARD_C218_PCI = 1 ,
369- MOXA_BOARD_C218_ISA ,
370362 MOXA_BOARD_C320_PCI ,
371- MOXA_BOARD_C320_ISA ,
372363 MOXA_BOARD_CP204J ,
373364};
374365
375366static char * moxa_brdname [] =
376367{
377368 "C218 Turbo PCI series" ,
378- "C218 Turbo ISA series" ,
379369 "C320 Turbo PCI series" ,
380- "C320 Turbo ISA series" ,
381370 "CP-204J series" ,
382371};
383372
384- #ifdef CONFIG_PCI
385373static const struct pci_device_id moxa_pcibrds [] = {
386374 { PCI_DEVICE (PCI_VENDOR_ID_MOXA , PCI_DEVICE_ID_MOXA_C218 ),
387375 .driver_data = MOXA_BOARD_C218_PCI },
@@ -392,14 +380,12 @@ static const struct pci_device_id moxa_pcibrds[] = {
392380 { 0 }
393381};
394382MODULE_DEVICE_TABLE (pci , moxa_pcibrds );
395- #endif /* CONFIG_PCI */
396383
397384struct moxa_port ;
398385
399386static struct moxa_board_conf {
400387 int boardType ;
401388 int numPorts ;
402- int busType ;
403389
404390 unsigned int ready ;
405391
@@ -459,9 +445,6 @@ static unsigned int moxaLowWaterChk;
459445static DEFINE_MUTEX (moxa_openlock );
460446static DEFINE_SPINLOCK (moxa_lock );
461447
462- static unsigned long baseaddr [MAX_BOARDS ];
463- static unsigned int type [MAX_BOARDS ];
464- static unsigned int numports [MAX_BOARDS ];
465448static struct tty_port moxa_service_port ;
466449
467450MODULE_AUTHOR ("William Chen" );
@@ -471,13 +454,6 @@ MODULE_FIRMWARE("c218tunx.cod");
471454MODULE_FIRMWARE ("cp204unx.cod" );
472455MODULE_FIRMWARE ("c320tunx.cod" );
473456
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-
481457module_param (ttymajor , int , 0 );
482458
483459/*
@@ -723,7 +699,6 @@ static DEFINE_TIMER(moxaTimer, moxa_poll);
723699static int moxa_check_fw_model (struct moxa_board_conf * brd , u8 model )
724700{
725701 switch (brd -> boardType ) {
726- case MOXA_BOARD_C218_ISA :
727702 case MOXA_BOARD_C218_PCI :
728703 if (model != 1 )
729704 goto err ;
@@ -767,7 +742,6 @@ static int moxa_load_bios(struct moxa_board_conf *brd, const u8 *buf,
767742 msleep (2000 );
768743
769744 switch (brd -> boardType ) {
770- case MOXA_BOARD_C218_ISA :
771745 case MOXA_BOARD_C218_PCI :
772746 tmp = readw (baseAddr + C218_key );
773747 if (tmp != C218_KeyCode )
@@ -831,7 +805,6 @@ static int moxa_real_load_code(struct moxa_board_conf *brd, const void *ptr,
831805
832806 switch (brd -> boardType ) {
833807 case MOXA_BOARD_CP204J :
834- case MOXA_BOARD_C218_ISA :
835808 case MOXA_BOARD_C218_PCI :
836809 key = C218_key ;
837810 loadbuf = C218_LoadBuf ;
@@ -896,15 +869,9 @@ static int moxa_real_load_code(struct moxa_board_conf *brd, const void *ptr,
896869 return - EIO ;
897870
898871 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 );
908875 }
909876 writew (1 , baseAddr + Disable_IRQ );
910877 writew (0 , baseAddr + Magic_no );
@@ -955,7 +922,6 @@ static int moxa_load_code(struct moxa_board_conf *brd, const void *ptr,
955922 return retval ;
956923
957924 switch (brd -> boardType ) {
958- case MOXA_BOARD_C218_ISA :
959925 case MOXA_BOARD_C218_PCI :
960926 case MOXA_BOARD_CP204J :
961927 port = brd -> ports ;
@@ -1139,7 +1105,6 @@ static int moxa_init_board(struct moxa_board_conf *brd, struct device *dev)
11391105 }
11401106
11411107 switch (brd -> boardType ) {
1142- case MOXA_BOARD_C218_ISA :
11431108 case MOXA_BOARD_C218_PCI :
11441109 file = "c218tunx.cod" ;
11451110 break ;
@@ -1225,7 +1190,6 @@ static void moxa_board_deinit(struct moxa_board_conf *brd)
12251190 kfree (brd -> ports );
12261191}
12271192
1228- #ifdef CONFIG_PCI
12291193static int moxa_pci_probe (struct pci_dev * pdev ,
12301194 const struct pci_device_id * ent )
12311195{
@@ -1268,7 +1232,6 @@ static int moxa_pci_probe(struct pci_dev *pdev,
12681232
12691233 board -> boardType = board_type ;
12701234 switch (board_type ) {
1271- case MOXA_BOARD_C218_ISA :
12721235 case MOXA_BOARD_C218_PCI :
12731236 board -> numPorts = 8 ;
12741237 break ;
@@ -1280,7 +1243,6 @@ static int moxa_pci_probe(struct pci_dev *pdev,
12801243 board -> numPorts = 0 ;
12811244 break ;
12821245 }
1283- board -> busType = MOXA_BUS_TYPE_PCI ;
12841246
12851247 retval = moxa_init_board (board , & pdev -> dev );
12861248 if (retval )
@@ -1316,14 +1278,10 @@ static struct pci_driver moxa_pci_driver = {
13161278 .probe = moxa_pci_probe ,
13171279 .remove = moxa_pci_remove
13181280};
1319- #endif /* CONFIG_PCI */
13201281
13211282static int __init moxa_init (void )
13221283{
1323- unsigned int isabrds = 0 ;
13241284 int retval = 0 ;
1325- struct moxa_board_conf * brd = moxa_boards ;
1326- unsigned int i ;
13271285
13281286 tty_port_init (& moxa_service_port );
13291287
@@ -1352,64 +1310,16 @@ static int __init moxa_init(void)
13521310 return -1 ;
13531311 }
13541312
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
13911313 retval = pci_register_driver (& moxa_pci_driver );
1392- if (retval ) {
1314+ if (retval )
13931315 printk (KERN_ERR "Can't register MOXA pci driver!\n" );
1394- if (isabrds )
1395- retval = 0 ;
1396- }
1397- #endif
13981316
13991317 return retval ;
14001318}
14011319
14021320static void __exit moxa_exit (void )
14031321{
1404- unsigned int i ;
1405-
1406- #ifdef CONFIG_PCI
14071322 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 ]);
14131323
14141324 del_timer_sync (& moxaTimer );
14151325
0 commit comments