Lines Matching refs:ec

58 	ecard_t		*ec;  member
70 void (*init)(ecard_t *ec);
77 static void atomwide_3p_quirk(ecard_t *ec);
121 struct expansion_card *ec = req->ec; in ecard_task_reset() local
124 res = ec->slot_no == 8 in ecard_task_reset()
125 ? &ec->resource[ECARD_RES_MEMC] in ecard_task_reset()
126 : ec->easi in ecard_task_reset()
127 ? &ec->resource[ECARD_RES_EASI] in ecard_task_reset()
128 : &ec->resource[ECARD_RES_IOCSYNC]; in ecard_task_reset()
130 ecard_loader_reset(res->start, ec->loader); in ecard_task_reset()
135 struct expansion_card *ec = req->ec; in ecard_task_readbytes() local
140 if (ec->slot_no == 8) { in ecard_task_readbytes()
142 ec->resource[ECARD_RES_MEMC].start; in ecard_task_readbytes()
181 unsigned long base = (ec->easi in ecard_task_readbytes()
182 ? &ec->resource[ECARD_RES_EASI] in ecard_task_readbytes()
183 : &ec->resource[ECARD_RES_IOCSYNC])->start; in ecard_task_readbytes()
186 if (!req->use_loader || !ec->loader) { in ecard_task_readbytes()
200 ec->loader); in ecard_task_readbytes()
312 ecard_readbytes(void *addr, ecard_t *ec, int off, int len, int useld) in ecard_readbytes() argument
317 req.ec = ec; in ecard_readbytes()
326 int ecard_readchunk(struct in_chunk_dir *cd, ecard_t *ec, int id, int num) in ecard_readchunk() argument
332 if (!ec->cid.cd) in ecard_readchunk()
336 ecard_readbytes(&excd, ec, index, 8, useld); in ecard_readchunk()
339 if (!useld && ec->loader) { in ecard_readchunk()
351 if (!ec->loader) { in ecard_readchunk()
352 ec->loader = kmalloc(c_len(&excd), in ecard_readchunk()
354 if (ec->loader) in ecard_readchunk()
355 ecard_readbytes(ec->loader, ec, in ecard_readchunk()
370 ecard_readbytes((unsigned char *)excd.d.string, ec, in ecard_readchunk()
385 static void ecard_def_irq_enable(ecard_t *ec, int irqnr) in ecard_def_irq_enable() argument
389 static void ecard_def_irq_disable(ecard_t *ec, int irqnr) in ecard_def_irq_disable() argument
393 static int ecard_def_irq_pending(ecard_t *ec) in ecard_def_irq_pending() argument
395 return !ec->irqmask || readb(ec->irqaddr) & ec->irqmask; in ecard_def_irq_pending()
398 static void ecard_def_fiq_enable(ecard_t *ec, int fiqnr) in ecard_def_fiq_enable() argument
403 static void ecard_def_fiq_disable(ecard_t *ec, int fiqnr) in ecard_def_fiq_disable() argument
408 static int ecard_def_fiq_pending(ecard_t *ec) in ecard_def_fiq_pending() argument
410 return !ec->fiqmask || readb(ec->fiqaddr) & ec->fiqmask; in ecard_def_fiq_pending()
430 ecard_t *ec = irq_data_get_irq_chip_data(d); in ecard_irq_unmask() local
432 if (ec) { in ecard_irq_unmask()
433 if (!ec->ops) in ecard_irq_unmask()
434 ec->ops = &ecard_default_ops; in ecard_irq_unmask()
436 if (ec->claimed && ec->ops->irqenable) in ecard_irq_unmask()
437 ec->ops->irqenable(ec, d->irq); in ecard_irq_unmask()
446 ecard_t *ec = irq_data_get_irq_chip_data(d); in ecard_irq_mask() local
448 if (ec) { in ecard_irq_mask()
449 if (!ec->ops) in ecard_irq_mask()
450 ec->ops = &ecard_default_ops; in ecard_irq_mask()
452 if (ec->ops && ec->ops->irqdisable) in ecard_irq_mask()
453 ec->ops->irqdisable(ec, d->irq); in ecard_irq_mask()
466 ecard_t *ec = slot_to_ecard(fiqnr); in ecard_enablefiq() local
468 if (ec) { in ecard_enablefiq()
469 if (!ec->ops) in ecard_enablefiq()
470 ec->ops = &ecard_default_ops; in ecard_enablefiq()
472 if (ec->claimed && ec->ops->fiqenable) in ecard_enablefiq()
473 ec->ops->fiqenable(ec, fiqnr); in ecard_enablefiq()
482 ecard_t *ec = slot_to_ecard(fiqnr); in ecard_disablefiq() local
484 if (ec) { in ecard_disablefiq()
485 if (!ec->ops) in ecard_disablefiq()
486 ec->ops = &ecard_default_ops; in ecard_disablefiq()
488 if (ec->ops->fiqdisable) in ecard_disablefiq()
489 ec->ops->fiqdisable(ec, fiqnr); in ecard_disablefiq()
495 ecard_t *ec; in ecard_dump_irq_state() local
499 for (ec = cards; ec; ec = ec->next) { in ecard_dump_irq_state()
502 if (ec->slot_no == 8) in ecard_dump_irq_state()
505 claimed = ec->claimed ? "" : "not "; in ecard_dump_irq_state()
507 if (ec->ops && ec->ops->irqpending && in ecard_dump_irq_state()
508 ec->ops != &ecard_default_ops) in ecard_dump_irq_state()
510 ec->slot_no, claimed, in ecard_dump_irq_state()
511 ec->ops->irqpending(ec) ? "" : "not "); in ecard_dump_irq_state()
514 ec->slot_no, claimed, in ecard_dump_irq_state()
515 ec->irqaddr, ec->irqmask, readb(ec->irqaddr)); in ecard_dump_irq_state()
558 ecard_t *ec; in ecard_irq_handler() local
562 for (ec = cards; ec; ec = ec->next) { in ecard_irq_handler()
565 if (!ec->claimed || !ec->irq || ec->slot_no == 8) in ecard_irq_handler()
568 if (ec->ops && ec->ops->irqpending) in ecard_irq_handler()
569 pending = ec->ops->irqpending(ec); in ecard_irq_handler()
571 pending = ecard_default_ops.irqpending(ec); in ecard_irq_handler()
574 generic_handle_irq(ec->irq); in ecard_irq_handler()
584 static void __iomem *__ecard_address(ecard_t *ec, card_type_t type, card_speed_t speed) in __ecard_address() argument
587 int slot = ec->slot_no; in __ecard_address()
589 if (ec->slot_no == 8) in __ecard_address()
625 static int ecard_prints(struct seq_file *m, ecard_t *ec) in ecard_prints() argument
627 seq_printf(m, " %d: %s ", ec->slot_no, ec->easi ? "EASI" : " "); in ecard_prints()
629 if (ec->cid.id == 0) { in ecard_prints()
633 ec->cid.manufacturer, ec->cid.product); in ecard_prints()
635 if (!ec->card_desc && ec->cid.cd && in ecard_prints()
636 ecard_readchunk(&incd, ec, 0xf5, 0)) { in ecard_prints()
637 ec->card_desc = kmalloc(strlen(incd.d.string)+1, GFP_KERNEL); in ecard_prints()
639 if (ec->card_desc) in ecard_prints()
640 strcpy((char *)ec->card_desc, incd.d.string); in ecard_prints()
643 seq_printf(m, "%s\n", ec->card_desc ? ec->card_desc : "*unknown*"); in ecard_prints()
645 seq_printf(m, "Simple card %d\n", ec->cid.id); in ecard_prints()
652 ecard_t *ec = cards; in ecard_devices_proc_show() local
654 while (ec) { in ecard_devices_proc_show()
655 ecard_prints(m, ec); in ecard_devices_proc_show()
656 ec = ec->next; in ecard_devices_proc_show()
670 #define ec_set_resource(ec,nr,st,sz) \ argument
672 (ec)->resource[nr].name = dev_name(&ec->dev); \
673 (ec)->resource[nr].start = st; \
674 (ec)->resource[nr].end = (st) + (sz) - 1; \
675 (ec)->resource[nr].flags = IORESOURCE_MEM; \
678 static void __init ecard_free_card(struct expansion_card *ec) in ecard_free_card() argument
683 if (ec->resource[i].flags) in ecard_free_card()
684 release_resource(&ec->resource[i]); in ecard_free_card()
686 kfree(ec); in ecard_free_card()
691 struct expansion_card *ec; in ecard_alloc_card() local
695 ec = kzalloc(sizeof(ecard_t), GFP_KERNEL); in ecard_alloc_card()
696 if (!ec) { in ecard_alloc_card()
697 ec = ERR_PTR(-ENOMEM); in ecard_alloc_card()
701 ec->slot_no = slot; in ecard_alloc_card()
702 ec->easi = type == ECARD_EASI; in ecard_alloc_card()
703 ec->irq = 0; in ecard_alloc_card()
704 ec->fiq = 0; in ecard_alloc_card()
705 ec->dma = NO_DMA; in ecard_alloc_card()
706 ec->ops = &ecard_default_ops; in ecard_alloc_card()
708 dev_set_name(&ec->dev, "ecard%d", slot); in ecard_alloc_card()
709 ec->dev.parent = NULL; in ecard_alloc_card()
710 ec->dev.bus = &ecard_bus_type; in ecard_alloc_card()
711 ec->dev.dma_mask = &ec->dma_mask; in ecard_alloc_card()
712 ec->dma_mask = (u64)0xffffffff; in ecard_alloc_card()
713 ec->dev.coherent_dma_mask = ec->dma_mask; in ecard_alloc_card()
716 ec_set_resource(ec, ECARD_RES_MEMC, in ecard_alloc_card()
725 ec_set_resource(ec, ECARD_RES_EASI, in ecard_alloc_card()
731 ec_set_resource(ec, ECARD_RES_MEMC, NETSLOT_BASE, NETSLOT_SIZE); in ecard_alloc_card()
736 ec_set_resource(ec, i + ECARD_RES_IOCSLOW, in ecard_alloc_card()
740 if (ec->resource[i].flags && in ecard_alloc_card()
741 request_resource(&iomem_resource, &ec->resource[i])) { in ecard_alloc_card()
742 dev_err(&ec->dev, "resource(s) not available\n"); in ecard_alloc_card()
743 ec->resource[i].end -= ec->resource[i].start; in ecard_alloc_card()
744 ec->resource[i].start = 0; in ecard_alloc_card()
745 ec->resource[i].flags = 0; in ecard_alloc_card()
750 return ec; in ecard_alloc_card()
755 struct expansion_card *ec = ECARD_DEV(dev); in irq_show() local
756 return sprintf(buf, "%u\n", ec->irq); in irq_show()
762 struct expansion_card *ec = ECARD_DEV(dev); in dma_show() local
763 return sprintf(buf, "%u\n", ec->dma); in dma_show()
769 struct expansion_card *ec = ECARD_DEV(dev); in resource_show() local
775 ec->resource[i].start, in resource_show()
776 ec->resource[i].end, in resource_show()
777 ec->resource[i].flags); in resource_show()
785 struct expansion_card *ec = ECARD_DEV(dev); in vendor_show() local
786 return sprintf(buf, "%u\n", ec->cid.manufacturer); in vendor_show()
792 struct expansion_card *ec = ECARD_DEV(dev); in device_show() local
793 return sprintf(buf, "%u\n", ec->cid.product); in device_show()
799 struct expansion_card *ec = ECARD_DEV(dev); in type_show() local
800 return sprintf(buf, "%s\n", ec->easi ? "EASI" : "IOC"); in type_show()
815 int ecard_request_resources(struct expansion_card *ec) in ecard_request_resources() argument
820 if (ecard_resource_end(ec, i) && in ecard_request_resources()
821 !request_mem_region(ecard_resource_start(ec, i), in ecard_request_resources()
822 ecard_resource_len(ec, i), in ecard_request_resources()
823 ec->dev.driver->name)) { in ecard_request_resources()
831 if (ecard_resource_end(ec, i)) in ecard_request_resources()
832 release_mem_region(ecard_resource_start(ec, i), in ecard_request_resources()
833 ecard_resource_len(ec, i)); in ecard_request_resources()
839 void ecard_release_resources(struct expansion_card *ec) in ecard_release_resources() argument
844 if (ecard_resource_end(ec, i)) in ecard_release_resources()
845 release_mem_region(ecard_resource_start(ec, i), in ecard_release_resources()
846 ecard_resource_len(ec, i)); in ecard_release_resources()
850 void ecard_setirq(struct expansion_card *ec, const struct expansion_card_ops *ops, void *irq_data) in ecard_setirq() argument
852 ec->irq_data = irq_data; in ecard_setirq()
854 ec->ops = ops; in ecard_setirq()
858 void __iomem *ecardm_iomap(struct expansion_card *ec, unsigned int res, in ecardm_iomap() argument
861 unsigned long start = ecard_resource_start(ec, res); in ecardm_iomap()
862 unsigned long end = ecard_resource_end(ec, res); in ecardm_iomap()
871 return devm_ioremap(&ec->dev, start, end - start); in ecardm_iomap()
875 static void atomwide_3p_quirk(ecard_t *ec) in atomwide_3p_quirk() argument
877 void __iomem *addr = __ecard_address(ec, ECARD_IOC, ECARD_SYNC); in atomwide_3p_quirk()
894 ecard_t *ec; in ecard_probe() local
899 ec = ecard_alloc_card(type, slot); in ecard_probe()
900 if (IS_ERR(ec)) { in ecard_probe()
901 rc = PTR_ERR(ec); in ecard_probe()
906 if ((addr = __ecard_address(ec, type, ECARD_SYNC)) == NULL) in ecard_probe()
910 ecard_readbytes(&cid, ec, 0, 16, 0); in ecard_probe()
914 ec->cid.id = cid.r_id; in ecard_probe()
915 ec->cid.cd = cid.r_cd; in ecard_probe()
916 ec->cid.is = cid.r_is; in ecard_probe()
917 ec->cid.w = cid.r_w; in ecard_probe()
918 ec->cid.manufacturer = ecard_getu16(cid.r_manu); in ecard_probe()
919 ec->cid.product = ecard_getu16(cid.r_prod); in ecard_probe()
920 ec->cid.country = cid.r_country; in ecard_probe()
921 ec->cid.irqmask = cid.r_irqmask; in ecard_probe()
922 ec->cid.irqoff = ecard_gets24(cid.r_irqoff); in ecard_probe()
923 ec->cid.fiqmask = cid.r_fiqmask; in ecard_probe()
924 ec->cid.fiqoff = ecard_gets24(cid.r_fiqoff); in ecard_probe()
925 ec->fiqaddr = in ecard_probe()
926 ec->irqaddr = addr; in ecard_probe()
928 if (ec->cid.is) { in ecard_probe()
929 ec->irqmask = ec->cid.irqmask; in ecard_probe()
930 ec->irqaddr += ec->cid.irqoff; in ecard_probe()
931 ec->fiqmask = ec->cid.fiqmask; in ecard_probe()
932 ec->fiqaddr += ec->cid.fiqoff; in ecard_probe()
934 ec->irqmask = 1; in ecard_probe()
935 ec->fiqmask = 4; in ecard_probe()
939 if (quirklist[i].manufacturer == ec->cid.manufacturer && in ecard_probe()
940 quirklist[i].product == ec->cid.product) { in ecard_probe()
942 ec->card_desc = quirklist[i].type; in ecard_probe()
944 quirklist[i].init(ec); in ecard_probe()
948 ec->irq = irq; in ecard_probe()
954 irq_set_chip_and_handler(ec->irq, &ecard_chip, in ecard_probe()
956 irq_set_chip_data(ec->irq, ec); in ecard_probe()
957 irq_clear_status_flags(ec->irq, IRQ_NOREQUEST); in ecard_probe()
963 ec->dma = 2 + slot; in ecard_probe()
968 *ecp = ec; in ecard_probe()
969 slot_to_expcard[slot] = ec; in ecard_probe()
971 rc = device_register(&ec->dev); in ecard_probe()
978 ecard_free_card(ec); in ecard_probe()
1027 ecard_match_device(const struct ecard_id *ids, struct expansion_card *ec) in ecard_match_device() argument
1032 if (ec->cid.manufacturer == ids[i].manufacturer && in ecard_match_device()
1033 ec->cid.product == ids[i].product) in ecard_match_device()
1041 struct expansion_card *ec = ECARD_DEV(dev); in ecard_drv_probe() local
1046 id = ecard_match_device(drv->id_table, ec); in ecard_drv_probe()
1048 ec->claimed = 1; in ecard_drv_probe()
1049 ret = drv->probe(ec, id); in ecard_drv_probe()
1051 ec->claimed = 0; in ecard_drv_probe()
1057 struct expansion_card *ec = ECARD_DEV(dev); in ecard_drv_remove() local
1060 drv->remove(ec); in ecard_drv_remove()
1061 ec->claimed = 0; in ecard_drv_remove()
1067 ec->ops = &ecard_default_ops; in ecard_drv_remove()
1069 ec->irq_data = NULL; in ecard_drv_remove()
1080 struct expansion_card *ec = ECARD_DEV(dev); in ecard_drv_shutdown() local
1086 drv->shutdown(ec); in ecard_drv_shutdown()
1087 ec->claimed = 0; in ecard_drv_shutdown()
1093 if (ec->loader) { in ecard_drv_shutdown()
1095 req.ec = ec; in ecard_drv_shutdown()
1114 struct expansion_card *ec = ECARD_DEV(_dev); in ecard_match() local
1119 ret = ecard_match_device(drv->id_table, ec) != NULL; in ecard_match()
1121 ret = ec->cid.id == drv->id; in ecard_match()