Lines Matching refs:brd
64 #define MOXA_IS_320(brd) ((brd)->boardType == MOXA_BOARD_C320_ISA || \ argument
65 (brd)->boardType == MOXA_BOARD_C320_PCI)
437 static int moxa_check_fw_model(struct moxa_board_conf *brd, u8 model) in moxa_check_fw_model() argument
439 switch (brd->boardType) { in moxa_check_fw_model()
469 static int moxa_load_bios(struct moxa_board_conf *brd, const u8 *buf, in moxa_load_bios() argument
472 void __iomem *baseAddr = brd->basemem; in moxa_load_bios()
483 switch (brd->boardType) { in moxa_load_bios()
514 static int moxa_load_320b(struct moxa_board_conf *brd, const u8 *ptr, in moxa_load_320b() argument
517 void __iomem *baseAddr = brd->basemem; in moxa_load_320b()
533 static int moxa_real_load_code(struct moxa_board_conf *brd, const void *ptr, in moxa_real_load_code() argument
536 void __iomem *baseAddr = brd->basemem; in moxa_real_load_code()
543 keycode = (brd->boardType == MOXA_BOARD_CP204J) ? CP204J_KeyCode : in moxa_real_load_code()
546 switch (brd->boardType) { in moxa_real_load_code()
612 if (MOXA_IS_320(brd)) { in moxa_real_load_code()
613 if (brd->busType == MOXA_BUS_TYPE_PCI) { /* ASIC board */ in moxa_real_load_code()
633 if (MOXA_IS_320(brd)) { in moxa_real_load_code()
637 brd->numPorts = j * 8; in moxa_real_load_code()
648 brd->intNdx = baseAddr + IRQindex; in moxa_real_load_code()
649 brd->intPend = baseAddr + IRQpending; in moxa_real_load_code()
650 brd->intTable = baseAddr + IRQtable; in moxa_real_load_code()
655 static int moxa_load_code(struct moxa_board_conf *brd, const void *ptr, in moxa_load_code() argument
658 void __iomem *ofsAddr, *baseAddr = brd->basemem; in moxa_load_code()
667 retval = moxa_real_load_code(brd, ptr, len); /* may change numPorts */ in moxa_load_code()
671 switch (brd->boardType) { in moxa_load_code()
675 port = brd->ports; in moxa_load_code()
676 for (i = 0; i < brd->numPorts; i++, port++) { in moxa_load_code()
677 port->board = brd; in moxa_load_code()
693 port = brd->ports; in moxa_load_code()
694 for (i = 0; i < brd->numPorts; i++, port++) { in moxa_load_code()
695 port->board = brd; in moxa_load_code()
700 switch (brd->numPorts) { in moxa_load_code()
743 static int moxa_load_fw(struct moxa_board_conf *brd, const struct firmware *fw) in moxa_load_fw() argument
774 if (moxa_check_fw_model(brd, hdr->model)) { in moxa_load_fw()
805 ret = moxa_load_bios(brd, ptr, lens[lenp]); in moxa_load_fw()
814 ret = moxa_load_320b(brd, ptr, lens[lenp]); in moxa_load_fw()
822 ret = moxa_load_code(brd, ptr, lens[lenp]); in moxa_load_fw()
832 static int moxa_init_board(struct moxa_board_conf *brd, struct device *dev) in moxa_init_board() argument
840 brd->ports = kcalloc(MAX_PORTS_PER_BOARD, sizeof(*brd->ports), in moxa_init_board()
842 if (brd->ports == NULL) { in moxa_init_board()
848 for (i = 0, p = brd->ports; i < MAX_PORTS_PER_BOARD; i++, p++) { in moxa_init_board()
855 switch (brd->boardType) { in moxa_init_board()
877 ret = moxa_load_fw(brd, fw); in moxa_init_board()
885 brd->ready = 1; in moxa_init_board()
892 kfree(brd->ports); in moxa_init_board()
897 static void moxa_board_deinit(struct moxa_board_conf *brd) in moxa_board_deinit() argument
903 brd->ready = 0; in moxa_board_deinit()
907 for (a = 0; a < brd->numPorts; a++) in moxa_board_deinit()
908 if (brd->ports[a].port.flags & ASYNC_INITIALIZED) { in moxa_board_deinit()
910 &brd->ports[a].port); in moxa_board_deinit()
918 for (a = 0; a < brd->numPorts; a++) in moxa_board_deinit()
919 if (brd->ports[a].port.flags & ASYNC_INITIALIZED) in moxa_board_deinit()
928 iounmap(brd->basemem); in moxa_board_deinit()
929 brd->basemem = NULL; in moxa_board_deinit()
930 kfree(brd->ports); in moxa_board_deinit()
1010 struct moxa_board_conf *brd = pci_get_drvdata(pdev); in moxa_pci_remove() local
1012 moxa_board_deinit(brd); in moxa_pci_remove()
1029 struct moxa_board_conf *brd = moxa_boards; in moxa_init() local
1066 brd->boardType = type[i]; in moxa_init()
1067 brd->numPorts = type[i] == MOXA_BOARD_C218_ISA ? 8 : in moxa_init()
1069 brd->busType = MOXA_BUS_TYPE_ISA; in moxa_init()
1070 brd->basemem = ioremap_nocache(baseaddr[i], 0x4000); in moxa_init()
1071 if (!brd->basemem) { in moxa_init()
1076 if (moxa_init_board(brd, NULL)) { in moxa_init()
1077 iounmap(brd->basemem); in moxa_init()
1078 brd->basemem = NULL; in moxa_init()
1084 baseaddr[i], brd->numPorts); in moxa_init()
1086 brd++; in moxa_init()
1153 struct moxa_board_conf *brd; in moxa_open() local
1163 brd = &moxa_boards[port / MAX_PORTS_PER_BOARD]; in moxa_open()
1164 if (!brd->ready) { in moxa_open()
1169 if (port % MAX_PORTS_PER_BOARD >= brd->numPorts) { in moxa_open()
1174 ch = &brd->ports[port % MAX_PORTS_PER_BOARD]; in moxa_open()
1425 struct moxa_board_conf *brd; in moxa_poll() local
1431 brd = &moxa_boards[card]; in moxa_poll()
1432 if (!brd->ready) in moxa_poll()
1438 if (readb(brd->intPend) == 0xff) in moxa_poll()
1439 ip = brd->intTable + readb(brd->intNdx); in moxa_poll()
1441 for (port = 0; port < brd->numPorts; port++) in moxa_poll()
1442 moxa_poll_port(&brd->ports[port], !!ip, ip + port); in moxa_poll()
1445 writeb(0, brd->intPend); /* ACK */ in moxa_poll()
1448 struct moxa_port *p = brd->ports; in moxa_poll()
1449 for (port = 0; port < brd->numPorts; port++, p++) in moxa_poll()