• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/components/opensource/linux/linux-2.6.36/drivers/char/

Lines Matching refs:board

82 static int sx_init_board(struct sx_board *board);
276 static inline void write_sx_byte(struct sx_board *board, int offset, u8 byte)
278 writeb(byte, board->base + offset);
281 static inline u8 read_sx_byte(struct sx_board *board, int offset)
283 return readb(board->base + offset);
286 static inline void write_sx_word(struct sx_board *board, int offset, u16 word)
288 writew(word, board->base + offset);
291 static inline u16 read_sx_word(struct sx_board *board, int offset)
293 return readw(board->base + offset);
296 static int sx_busy_wait_eq(struct sx_board *board,
304 if ((read_sx_byte(board, offset) & mask) == correctval) {
310 if ((read_sx_byte(board, offset) & mask) == correctval) {
321 static int sx_busy_wait_neq(struct sx_board *board,
329 if ((read_sx_byte(board, offset) & mask) != badval) {
335 if ((read_sx_byte(board, offset) & mask) != badval) {
347 static int sx_reset(struct sx_board *board)
351 if (IS_SX_BOARD(board)) {
353 write_sx_byte(board, SX_CONFIG, 0);
354 write_sx_byte(board, SX_RESET, 1); /* Value doesn't matter */
356 if (!sx_busy_wait_eq(board, SX_RESET_STATUS, 1, 0)) {
361 } else if (IS_EISA_BOARD(board)) {
362 outb(board->irq << 4, board->eisa_base + 0xc02);
363 } else if (IS_SI1_BOARD(board)) {
364 write_sx_byte(board, SI1_ISA_RESET, 0); /*value doesn't matter*/
366 /* Gory details of the SI/ISA board */
367 write_sx_byte(board, SI2_ISA_RESET, SI2_ISA_RESET_SET);
368 write_sx_byte(board, SI2_ISA_IRQ11, SI2_ISA_IRQ11_CLEAR);
369 write_sx_byte(board, SI2_ISA_IRQ12, SI2_ISA_IRQ12_CLEAR);
370 write_sx_byte(board, SI2_ISA_IRQ15, SI2_ISA_IRQ15_CLEAR);
371 write_sx_byte(board, SI2_ISA_INTCLEAR, SI2_ISA_INTCLEAR_CLEAR);
372 write_sx_byte(board, SI2_ISA_IRQSET, SI2_ISA_IRQSET_CLEAR);
387 #define MODU_OFFSET(board,addr,elem) (addr + OFFSETOF (_SXMODULE, elem))
388 #define BRD_OFFSET(board,elem) (OFFSETOF (_SXCARD, elem))
391 write_sx_byte (port->board, CHAN_OFFSET (port, elem), val)
394 read_sx_byte (port->board, CHAN_OFFSET (port, elem))
397 write_sx_word (port->board, CHAN_OFFSET (port, elem), val)
400 read_sx_word (port->board, CHAN_OFFSET (port, elem))
402 #define sx_write_module_byte(board, addr, elem, val) \
403 write_sx_byte (board, MODU_OFFSET (board, addr, elem), val)
405 #define sx_read_module_byte(board, addr, elem) \
406 read_sx_byte (board, MODU_OFFSET (board, addr, elem))
408 #define sx_write_module_word(board, addr, elem, val) \
409 write_sx_word (board, MODU_OFFSET (board, addr, elem), val)
411 #define sx_read_module_word(board, addr, elem) \
412 read_sx_word (board, MODU_OFFSET (board, addr, elem))
414 #define sx_write_board_byte(board, elem, val) \
415 write_sx_byte (board, BRD_OFFSET (board, elem), val)
417 #define sx_read_board_byte(board, elem) \
418 read_sx_byte (board, BRD_OFFSET (board, elem))
420 #define sx_write_board_word(board, elem, val) \
421 write_sx_word (board, BRD_OFFSET (board, elem), val)
423 #define sx_read_board_word(board, elem) \
424 read_sx_word (board, BRD_OFFSET (board, elem))
426 static int sx_start_board(struct sx_board *board)
428 if (IS_SX_BOARD(board)) {
429 write_sx_byte(board, SX_CONFIG, SX_CONF_BUSEN);
430 } else if (IS_EISA_BOARD(board)) {
431 write_sx_byte(board, SI2_EISA_OFF, SI2_EISA_VAL);
432 outb((board->irq << 4) | 4, board->eisa_base + 0xc02);
433 } else if (IS_SI1_BOARD(board)) {
434 write_sx_byte(board, SI1_ISA_RESET_CLEAR, 0);
435 write_sx_byte(board, SI1_ISA_INTCL, 0);
439 write_sx_byte(board, SI2_ISA_RESET, SI2_ISA_RESET_CLEAR);
440 write_sx_byte(board, SI2_ISA_INTCLEAR, SI2_ISA_INTCLEAR_SET);
445 #define SX_IRQ_REG_VAL(board) \
446 ((board->flags & SX_ISA_BOARD) ? (board->irq << 4) : 0)
450 static int sx_start_interrupts(struct sx_board *board)
453 /* Don't call this with board->irq == 0 */
455 if (IS_SX_BOARD(board)) {
456 write_sx_byte(board, SX_CONFIG, SX_IRQ_REG_VAL(board) |
458 } else if (IS_EISA_BOARD(board)) {
459 inb(board->eisa_base + 0xc03);
460 } else if (IS_SI1_BOARD(board)) {
461 write_sx_byte(board, SI1_ISA_INTCL, 0);
462 write_sx_byte(board, SI1_ISA_INTCL_CLEAR, 0);
464 switch (board->irq) {
466 write_sx_byte(board, SI2_ISA_IRQ11, SI2_ISA_IRQ11_SET);
469 write_sx_byte(board, SI2_ISA_IRQ12, SI2_ISA_IRQ12_SET);
472 write_sx_byte(board, SI2_ISA_IRQ15, SI2_ISA_IRQ15_SET);
476 "interrupt %d.\n", board->irq);
479 write_sx_byte(board, SI2_ISA_INTCLEAR, SI2_ISA_INTCLEAR_SET);
489 write_sx_byte(port->board, CHAN_OFFSET(port, hi_hstat), command);
491 return sx_busy_wait_eq(port->board, CHAN_OFFSET(port, hi_hstat), mask,
604 if (port->board->ta_type == MOD_SXDC) {
678 if (port->board->ta_type == MOD_TA) {
688 if (port->board->ta_type == MOD_TA) {
877 memcpy_toio(port->board->base + CHAN_OFFSET(port, hi_txbuf) +
945 "%d at %lx\n", c, read_sx_byte(port->board,
948 memcpy_fromio(rp, port->board->base +
1041 struct sx_board *board = ptr;
1047 board->irq);
1079 free_irq(board->irq, board);
1082 board->irq);
1091 if (board->irq == irq) {
1094 sx_write_board_word(board, cc_int_pending, 0);
1095 if (IS_SX_BOARD(board)) {
1096 write_sx_byte(board, SX_RESET_IRQ, 1);
1097 } else if (IS_EISA_BOARD(board)) {
1098 inb(board->eisa_base + 0xc03);
1099 write_sx_word(board, 8, 0);
1101 write_sx_byte(board, SI2_ISA_INTCLEAR,
1103 write_sx_byte(board, SI2_ISA_INTCLEAR,
1110 if (!(board->flags & SX_BOARD_INITIALIZED))
1113 if (test_and_set_bit(SX_BOARD_INTR_LOCK, &board->locks)) {
1114 printk(KERN_ERR "Recursive interrupt! (%d)\n", board->irq);
1118 for (i = 0; i < board->nports; i++) {
1119 port = &board->ports[i];
1135 clear_bit(SX_BOARD_INTR_LOCK, &board->locks);
1138 board->irq);
1145 struct sx_board *board = (struct sx_board *)data;
1149 sx_interrupt(0, board);
1151 mod_timer(&board->timer, jiffies + sx_poll);
1297 my_hd_io(port->board->base + port->ch_base, sizeof(*port));
1373 #define W0 write_sx_byte(board, i, 0x55)
1374 #define W1 write_sx_byte(board, i, 0xaa)
1375 #define R0 if (read_sx_byte(board, i) != 0x55) return 1
1376 #define R1 if (read_sx_byte(board, i) != 0xaa) return 1
1380 static int do_memtest(struct sx_board *board, int min, int max)
1429 #define W0 write_sx_word(board, i, 0x55aa)
1430 #define W1 write_sx_word(board, i, 0xaa55)
1431 #define R0 if (read_sx_word(board, i) != 0x55aa) return 1
1432 #define R1 if (read_sx_word(board, i) != 0xaa55) return 1
1441 static struct sx_board *board = NULL;
1455 if (!board)
1456 board = &boards[0];
1457 if (board->flags & SX_BOARD_PRESENT) {
1459 board->flags);
1462 board->flags);
1472 sx_dprintk(SX_DEBUG_FIRMWARE, "set board to %ld\n", arg);
1480 board = &boards[arg];
1485 if (IS_SX_BOARD(board))
1487 if (IS_CF_BOARD(board))
1489 if (IS_SI_BOARD(board))
1491 if (IS_SI1_BOARD(board))
1493 if (IS_EISA_BOARD(board))
1498 if (sx_initialized) { /* Already initialized: better not ramtest the board. */
1502 if (IS_SX_BOARD(board)) {
1503 rc = do_memtest(board, 0, 0x7000);
1505 rc = do_memtest(board, 0, 0x7000);
1506 /*if (!rc) rc = do_memtest_w (board, 0, 0x7000); */
1508 rc = do_memtest(board, 0, 0x7ff8);
1509 /* if (!rc) rc = do_memtest_w (board, 0, 0x7ff8); */
1519 if (!sx_reset(board)) {
1523 sx_dprintk(SX_DEBUG_INIT, "reset the board...\n");
1542 memcpy_toio(board->base2 + offset + i, tmp,
1552 sx_nports += sx_init_board(board);
1573 "%d channels, first board: %d ports\n",
1617 read_sx_byte(port->board, CHAN_OFFSET(port, hi_hstat)));
1725 static int sx_init_board(struct sx_board *board)
1735 board->flags |= SX_BOARD_INITIALIZED;
1737 if (read_sx_byte(board, 0))
1739 write_sx_byte(board, 0, 0);
1743 if (!sx_reset(board))
1746 sx_start_board(board);
1748 if (!sx_busy_wait_neq(board, 0, 0xff, 0)) {
1757 my_hd_io(board->base, 0x10);
1760 my_hd_io(board->base + 0x80, 0x30);
1764 read_sx_byte(board, 0), read_sx_byte(board, 1),
1765 read_sx_byte(board, 5), read_sx_byte(board, 4));
1767 if (read_sx_byte(board, 0) == 0xff) {
1769 board->nports = 0;
1775 if (IS_SX_BOARD(board)) {
1776 sx_write_board_word(board, cc_int_count, sx_maxints);
1779 sx_write_board_word(board, cc_int_count,
1784 /* board->ta_type = mod_compat_type (read_sx_byte (board, 0x80 + 0x08)); */
1785 board->ta_type = mod_compat_type(sx_read_module_byte(board, 0x80,
1788 for (addr = 0x80; addr != 0; addr = read_sx_word(board, addr) & 0x7fff){
1789 type = sx_read_module_byte(board, addr, mc_chip);
1791 addr, read_sx_byte(board, addr + 2));
1793 chans += sx_read_module_byte(board, addr, mc_type);
1798 pan_type_s(sx_read_module_byte(board, addr,
1800 pan_type_s(sx_read_module_byte(board, addr,
1805 sx_read_module_byte(board, addr, mc_rev1),
1806 sx_read_module_byte(board, addr, mc_rev2),
1807 sx_read_module_byte(board, addr, mc_mtaasic_rev));
1812 if (mod_compat_type(type) != board->ta_type) {
1819 if ((IS_EISA_BOARD(board) ||
1820 IS_SI_BOARD(board)) &&
1831 if (board->irq > 0) {
1833 if (sx_irqmask & (1 << board->irq)) { /* may we use this irq? */
1834 if (request_irq(board->irq, sx_interrupt,
1836 "sx", board)) {
1838 "irq %d.\n", board->irq);
1839 board->irq = 0;
1842 board->irq = 0;
1843 } else if (board->irq < 0 && sx_irqmask) {
1846 int irqmask = sx_irqmask & (IS_SX_BOARD(board) ?
1852 "sx", board))
1856 board->irq = irqnr;
1858 board->irq = 0;
1860 if (board->irq) {
1863 board->irq);
1864 sx_start_interrupts(board);
1865 board->poll = sx_slowpoll;
1866 board->flags |= SX_IRQ_ALLOCATED;
1868 /* no irq: setup board for polled operation */
1869 board->poll = sx_poll;
1871 board->poll);
1876 setup_timer(&board->timer, sx_pollfunc, (unsigned long)board);
1878 if (board->poll)
1879 mod_timer(&board->timer, jiffies + board->poll);
1881 board->irq = 0;
1884 board->nports = chans;
1885 sx_dprintk(SX_DEBUG_INIT, "returning %d ports.", board->nports);
1903 static int __devinit probe_sx(struct sx_board *board)
1911 if (!IS_CF_BOARD(board)) {
1913 board->base + SX_VPD_ROM);
1916 my_hd_io(board->base + SX_VPD_ROM, 0x40);
1920 *p++ = read_sx_byte(board, SX_VPD_ROM + i * 2);
1936 if (!IS_CF_BOARD(board)) {
1937 printk(KERN_DEBUG "sx: Found an SX board at %lx\n",
1938 board->hw_base);
1956 if (((unsigned long)board->hw_base) & 0x8000) {
1959 "%lx.\n", board->hw_base);
1966 board->nports = -1;
1969 if (!sx_reset(board))
1971 sx_dprintk(SX_DEBUG_INIT, "reset the board...\n");
1985 static int __devinit probe_si(struct sx_board *board)
1991 "%p.\n", board->hw_base, board->base + SI2_ISA_ID_BASE);
1994 my_hd_io(board->base + SI2_ISA_ID_BASE, 0x8);
1996 if (!IS_EISA_BOARD(board)) {
1997 if (IS_SI1_BOARD(board)) {
1999 write_sx_byte(board, SI2_ISA_ID_BASE + 7 - i,i);
2003 if ((read_sx_byte(board, SI2_ISA_ID_BASE + 7 - i) & 7)
2011 /* Now we're pretty much convinced that there is an SI board here,
2013 have an SI1 board when we're probing for an SI2 board.... */
2015 write_sx_byte(board, SI2_ISA_ID_BASE, 0x10);
2016 if (IS_SI1_BOARD(board)) {
2017 /* This should be an SI1 board, which has this
2019 if (read_sx_byte(board, SI2_ISA_ID_BASE) != 0x10) {
2024 /* This should be an SI2 board, which has the bottom
2026 if (read_sx_byte(board, SI2_ISA_ID_BASE) == 0x10) {
2032 /* Now we're pretty much convinced that there is an SI board here,
2034 have an SI1 board when we're probing for an SI2 board.... */
2036 write_sx_byte(board, SI2_ISA_ID_BASE, 0x10);
2037 if (IS_SI1_BOARD(board)) {
2038 /* This should be an SI1 board, which has this
2040 if (read_sx_byte(board, SI2_ISA_ID_BASE) != 0x10) {
2045 /* This should be an SI2 board, which has the bottom
2047 if (read_sx_byte(board, SI2_ISA_ID_BASE) == 0x10) {
2055 printk(KERN_DEBUG "sx: Found an SI board at %lx\n", board->hw_base);
2059 board->nports = -1;
2062 if (!sx_reset(board))
2064 sx_dprintk(SX_DEBUG_INIT, "reset the board...\n");
2130 struct sx_board *board;
2147 board = &boards[i];
2148 board->ports = port;
2156 port->board = board;
2172 board = &boards[i];
2173 board->port_base = portno;
2176 board->nports);
2177 if (board->nports <= 0)
2180 addr = read_sx_word(board, addr) & 0x7fff) {
2181 chans = sx_read_module_byte(board, addr, mc_type);
2191 if (IS_SX_BOARD(board))
2193 board, addr + j * 2,
2206 /* board->flags |= SX_BOARD_INITIALIZED; */
2232 static void __devexit sx_remove_card(struct sx_board *board,
2235 if (board->flags & SX_BOARD_INITIALIZED) {
2236 /* The board should stop messing with us. (actually I mean the
2238 sx_reset(board);
2239 if ((board->irq) && (board->flags & SX_IRQ_ALLOCATED))
2240 free_irq(board->irq, board);
2243 del_timer(&board->timer);
2246 iounmap(board->base2);
2247 pci_release_region(pdev, IS_CF_BOARD(board) ? 3 : 2);
2250 iounmap(board->base);
2251 release_region(board->hw_base, board->hw_len);
2254 board->flags &= ~(SX_BOARD_INITIALIZED | SX_BOARD_PRESENT);
2263 struct sx_board *board;
2274 board = &boards[i];
2275 board->flags |= SX_BOARD_PRESENT;
2284 board->eisa_base = eisa_slot;
2285 board->flags &= ~SX_BOARD_TYPE;
2286 board->flags |= SI_EISA_BOARD;
2288 board->hw_base = ((inb(eisa_slot + 0xc01) << 8) +
2290 board->hw_len = SI2_EISA_WINDOW_LEN;
2291 if (!request_region(board->hw_base, board->hw_len, "sx")) {
2295 board->base2 =
2296 board->base = ioremap_nocache(board->hw_base, SI2_EISA_WINDOW_LEN);
2297 if (!board->base) {
2302 sx_dprintk(SX_DEBUG_PROBE, "IO hw_base address: %lx\n", board->hw_base);
2303 sx_dprintk(SX_DEBUG_PROBE, "base: %p\n", board->base);
2304 board->irq = inb(eisa_slot + 0xc02) >> 4;
2305 sx_dprintk(SX_DEBUG_PROBE, "IRQ: %d\n", board->irq);
2307 if (!probe_si(board))
2310 dev_set_drvdata(dev, board);
2314 iounmap(board->base);
2316 release_region(board->hw_base, board->hw_len);
2318 board->flags &= ~SX_BOARD_PRESENT;
2325 struct sx_board *board = dev_get_drvdata(dev);
2327 sx_remove_card(board, NULL);
2362 static void __devinit fix_sx_pci(struct pci_dev *pdev, struct sx_board *board)
2388 struct sx_board *board;
2398 board = &boards[i];
2399 board->flags |= SX_BOARD_PRESENT;
2406 board->flags &= ~SX_BOARD_TYPE;
2407 board->flags |= (pdev->subsystem_vendor == 0x200) ? SX_PCI_BOARD :
2411 reg = IS_CF_BOARD(board) ? 3 : 2;
2417 board->hw_base = pci_resource_start(pdev, reg);
2418 board->base2 =
2419 board->base = ioremap_nocache(board->hw_base, WINDOW_LEN(board));
2420 if (!board->base) {
2425 /* Most of the stuff on the CF board is offset by 0x18000 .... */
2426 if (IS_CF_BOARD(board))
2427 board->base += 0x18000;
2429 board->irq = pdev->irq;
2431 dev_info(&pdev->dev, "Got a specialix card: %p(%d) %x.\n", board->base,
2432 board->irq, board->flags);
2434 if (!probe_sx(board)) {
2439 fix_sx_pci(pdev, board);
2441 pci_set_drvdata(pdev, board);
2445 iounmap(board->base2);
2449 board->flags &= ~SX_BOARD_PRESENT;
2459 struct sx_board *board = pci_get_drvdata(pdev);
2461 sx_remove_card(board, pdev);
2489 struct sx_board *board;
2511 board = &boards[found];
2512 board->hw_base = sx_probe_addrs[i];
2513 board->hw_len = SX_WINDOW_LEN;
2514 if (!request_region(board->hw_base, board->hw_len, "sx"))
2516 board->base2 =
2517 board->base = ioremap_nocache(board->hw_base, board->hw_len);
2518 if (!board->base)
2520 board->flags &= ~SX_BOARD_TYPE;
2521 board->flags |= SX_ISA_BOARD;
2522 board->irq = sx_irqmask ? -1 : 0;
2524 if (probe_sx(board)) {
2525 board->flags |= SX_BOARD_PRESENT;
2528 iounmap(board->base);
2530 release_region(board->hw_base, board->hw_len);
2535 board = &boards[found];
2536 board->hw_base = si_probe_addrs[i];
2537 board->hw_len = SI2_ISA_WINDOW_LEN;
2538 if (!request_region(board->hw_base, board->hw_len, "sx"))
2540 board->base2 =
2541 board->base = ioremap_nocache(board->hw_base, board->hw_len);
2542 if (!board->base)
2544 board->flags &= ~SX_BOARD_TYPE;
2545 board->flags |= SI_ISA_BOARD;
2546 board->irq = sx_irqmask ? -1 : 0;
2548 if (probe_si(board)) {
2549 board->flags |= SX_BOARD_PRESENT;
2552 iounmap(board->base);
2554 release_region(board->hw_base, board->hw_len);
2558 board = &boards[found];
2559 board->hw_base = si1_probe_addrs[i];
2560 board->hw_len = SI1_ISA_WINDOW_LEN;
2561 if (!request_region(board->hw_base, board->hw_len, "sx"))
2563 board->base2 =
2564 board->base = ioremap_nocache(board->hw_base, board->hw_len);
2565 if (!board->base)
2567 board->flags &= ~SX_BOARD_TYPE;
2568 board->flags |= SI1_ISA_BOARD;
2569 board->irq = sx_irqmask ? -1 : 0;
2571 if (probe_si(board)) {
2572 board->flags |= SX_BOARD_PRESENT;
2575 iounmap(board->base);
2577 release_region(board->hw_base, board->hw_len);