Lines Matching +full:reset +full:- +full:n +full:- +full:io
2 * Linux ARCnet driver - COM90xx chipset (memory-mapped buffers)
4 * Written 1994-1999 by Avery Pennarun.
38 #include <linux/io.h>
43 /* Define this to speed up the autoprobe by assuming if only one io port and
49 * it on - I think it should be fine if you only have one ARCnet card
86 static int io; /* use the insmod io= irq= shmem= options */ variable
91 module_param_hw(io, int, ioport, 0);
100 int ports[(0x3f0 - 0x200) / 16 + 1] = { 0 }; in com90xx_probe()
107 if (!io && !irq && !shmem && !*device && com90xx_skip_probe) in com90xx_probe()
110 shmems = kzalloc(((0x100000 - 0xa0000) / 0x800) * sizeof(unsigned long), in com90xx_probe()
114 iomem = kzalloc(((0x100000 - 0xa0000) / 0x800) * sizeof(void __iomem *), in com90xx_probe()
122 pr_info("%s\n", "COM90xx chipset support"); in com90xx_probe()
126 if (io) in com90xx_probe()
127 ports[numports++] = io; in com90xx_probe()
138 * (empty), and reset any others by reading the reset port. in com90xx_probe()
140 numprint = -1; in com90xx_probe()
141 for (port = &ports[0]; port - ports < numports; port++) { in com90xx_probe()
145 arc_cont(D_INIT, "\n"); in com90xx_probe()
154 arc_cont(D_INIT_REASONS, "(request_region)\n"); in com90xx_probe()
158 *port-- = ports[--numports]; in com90xx_probe()
162 arc_cont(D_INIT_REASONS, "(empty)\n"); in com90xx_probe()
167 *port-- = ports[--numports]; in com90xx_probe()
173 arc_cont(D_INIT_REASONS, "\n"); in com90xx_probe()
178 arc_cont(D_INIT, "\n"); in com90xx_probe()
181 arc_cont(D_NORMAL, "S1: No ARCnet cards found.\n"); in com90xx_probe()
186 /* Stage 2: we have now reset any possible ARCnet cards, so we can't in com90xx_probe()
190 numprint = -1; in com90xx_probe()
195 arc_cont(D_INIT, "\n"); in com90xx_probe()
200 arc_cont(D_INIT, "\n"); in com90xx_probe()
204 * 0xD1 byte in the right place, or are read-only. in com90xx_probe()
206 numprint = -1; in com90xx_probe()
213 arc_cont(D_INIT, "\n"); in com90xx_probe()
219 arc_cont(D_INIT_REASONS, "(request_mem_region)\n"); in com90xx_probe()
227 arc_cont(D_INIT_REASONS, "(ioremap)\n"); in com90xx_probe()
234 arc_cont(D_INIT_REASONS, "(%02Xh != %02Xh)\n", in com90xx_probe()
243 * sure no "mirror" shmem areas show up - if they occur in com90xx_probe()
249 arc_cont(D_INIT_REASONS, "(read only)\n"); in com90xx_probe()
253 arc_cont(D_INIT_REASONS, "\n"); in com90xx_probe()
264 *p-- = shmems[--numshmems]; in com90xx_probe()
265 index--; in com90xx_probe()
267 arc_cont(D_INIT, "\n"); in com90xx_probe()
270 arc_cont(D_NORMAL, "S3: No ARCnet cards found.\n"); in com90xx_probe()
280 numprint = -1; in com90xx_probe()
285 arc_cont(D_INIT, "\n"); in com90xx_probe()
290 arc_cont(D_INIT, "\n"); in com90xx_probe()
293 * the RESET flag, and (if no irq is given) generate an autoirq, in com90xx_probe()
299 numprint = -1; in com90xx_probe()
306 arc_cont(D_INIT, "\n"); in com90xx_probe()
316 arc_cont(D_INIT_REASONS, "(status=%Xh)\n", status); in com90xx_probe()
321 *port-- = ports[--numports]; in com90xx_probe()
328 arc_cont(D_INIT_REASONS, " (eternal reset, status=%Xh)\n", in com90xx_probe()
334 *port-- = ports[--numports]; in com90xx_probe()
342 * card has just reset and the NORXflag is on until in com90xx_probe()
352 arc_cont(D_INIT_REASONS, "(airq=%d)\n", airq); in com90xx_probe()
357 *port-- = ports[--numports]; in com90xx_probe()
368 * back its signature byte when the card is reset? in com90xx_probe()
392 arc_cont(D_INIT, "%lXh)\n", *p); in com90xx_probe()
398 numprint = -1; in com90xx_probe()
401 shmems[index] = shmems[--numshmems]; in com90xx_probe()
405 arc_cont(D_INIT_REASONS, "%Xh-", in com90xx_probe()
412 pr_cont("no matching shmem)\n"); in com90xx_probe()
420 *port-- = ports[--numports]; in com90xx_probe()
424 pr_cont("\n"); in com90xx_probe()
439 int res = -1; in check_mirror()
442 return -1; in check_mirror()
471 arc_cont(D_NORMAL, "com90xx: Can't allocate device!\n"); in com90xx_found()
474 return -ENOMEM; in com90xx_found()
479 /* guess the actual size of one "memory mirror" - the number of in com90xx_found()
485 check_mirror(shmem - MIRROR_SIZE, MIRROR_SIZE) == 0 && in com90xx_found()
486 check_mirror(shmem - 2 * MIRROR_SIZE, MIRROR_SIZE) == 1) in com90xx_found()
489 first_mirror = shmem - mirror_size; in com90xx_found()
491 first_mirror -= mirror_size; in com90xx_found()
497 last_mirror -= mirror_size; in com90xx_found()
499 dev->mem_start = first_mirror; in com90xx_found()
500 dev->mem_end = last_mirror + MIRROR_SIZE - 1; in com90xx_found()
505 if (!request_mem_region(dev->mem_start, in com90xx_found()
506 dev->mem_end - dev->mem_start + 1, in com90xx_found()
512 arc_printk(D_NORMAL, dev, "Can't get IRQ %d!\n", airq); in com90xx_found()
515 dev->irq = airq; in com90xx_found()
518 lp->card_name = "COM90xx"; in com90xx_found()
519 lp->hw.command = com90xx_command; in com90xx_found()
520 lp->hw.status = com90xx_status; in com90xx_found()
521 lp->hw.intmask = com90xx_setmask; in com90xx_found()
522 lp->hw.reset = com90xx_reset; in com90xx_found()
523 lp->hw.owner = THIS_MODULE; in com90xx_found()
524 lp->hw.copy_to_card = com90xx_copy_to_card; in com90xx_found()
525 lp->hw.copy_from_card = com90xx_copy_from_card; in com90xx_found()
526 lp->mem_start = ioremap(dev->mem_start, in com90xx_found()
527 dev->mem_end - dev->mem_start + 1); in com90xx_found()
528 if (!lp->mem_start) { in com90xx_found()
529 arc_printk(D_NORMAL, dev, "Can't remap device memory!\n"); in com90xx_found()
534 arcnet_set_addr(dev, arcnet_readb(lp->mem_start, in com90xx_found()
537 dev->base_addr = ioaddr; in com90xx_found()
539 arc_printk(D_NORMAL, dev, "COM90xx station %02Xh found at %03lXh, IRQ %d, ShMem %lXh (%ld*%xh).\n", in com90xx_found()
540 dev->dev_addr[0], in com90xx_found()
541 dev->base_addr, dev->irq, dev->mem_start, in com90xx_found()
542 (dev->mem_end - dev->mem_start + 1) / mirror_size, in com90xx_found()
552 iounmap(lp->mem_start); in com90xx_found()
554 free_irq(dev->irq, dev); in com90xx_found()
556 release_mem_region(dev->mem_start, dev->mem_end - dev->mem_start + 1); in com90xx_found()
559 return -EIO; in com90xx_found()
564 short ioaddr = dev->base_addr; in com90xx_command()
571 short ioaddr = dev->base_addr; in com90xx_status()
578 short ioaddr = dev->base_addr; in com90xx_setmask()
583 /* Do a hardware reset on the card, and set up necessary registers.
593 short ioaddr = dev->base_addr; in com90xx_reset()
595 arc_printk(D_INIT, dev, "Resetting (status=%02Xh)\n", in com90xx_reset()
599 /* reset the card */ in com90xx_reset()
603 /* clear flags & end reset */ in com90xx_reset()
614 if (arcnet_readb(lp->mem_start, COM9026_REG_R_STATUS) != TESTvalue) { in com90xx_reset()
616 arc_printk(D_NORMAL, dev, "reset failed: TESTvalue not present.\n"); in com90xx_reset()
619 /* enable extended (512-byte) packets */ in com90xx_reset()
624 memset_io(lp->mem_start, 0x42, 2048); in com90xx_reset()
634 void __iomem *memaddr = lp->mem_start + bufnum * 512 + offset; in com90xx_copy_to_card()
643 void __iomem *memaddr = lp->mem_start + bufnum * 512 + offset; in com90xx_copy_from_card()
656 return -EIO; in com90xx_init()
671 free_irq(dev->irq, dev); in com90xx_exit()
672 iounmap(lp->mem_start); in com90xx_exit()
673 release_region(dev->base_addr, ARCNET_TOTAL_SIZE); in com90xx_exit()
674 release_mem_region(dev->mem_start, in com90xx_exit()
675 dev->mem_end - dev->mem_start + 1); in com90xx_exit()
690 pr_notice("Disabled\n"); in com90xx_setup()
696 pr_err("Too many arguments\n"); in com90xx_setup()
704 case 1: /* IO address */ in com90xx_setup()
705 io = ints[1]; in com90xx_setup()