Lines Matching refs:ec
63 ecard_t *ec; member
125 struct expansion_card *ec = req->ec; in ecard_task_reset() local
128 res = ec->slot_no == 8 in ecard_task_reset()
129 ? &ec->resource[ECARD_RES_MEMC] in ecard_task_reset()
130 : ec->easi in ecard_task_reset()
131 ? &ec->resource[ECARD_RES_EASI] in ecard_task_reset()
132 : &ec->resource[ECARD_RES_IOCSYNC]; in ecard_task_reset()
134 ecard_loader_reset(res->start, ec->loader); in ecard_task_reset()
139 struct expansion_card *ec = req->ec; in ecard_task_readbytes() local
144 if (ec->slot_no == 8) { in ecard_task_readbytes()
146 ec->resource[ECARD_RES_MEMC].start; in ecard_task_readbytes()
185 unsigned long base = (ec->easi in ecard_task_readbytes()
186 ? &ec->resource[ECARD_RES_EASI] in ecard_task_readbytes()
187 : &ec->resource[ECARD_RES_IOCSYNC])->start; in ecard_task_readbytes()
190 if (!req->use_loader || !ec->loader) { in ecard_task_readbytes()
204 ec->loader); in ecard_task_readbytes()
318 ecard_readbytes(void *addr, ecard_t *ec, int off, int len, int useld) in ecard_readbytes() argument
323 req.ec = ec; in ecard_readbytes()
332 int ecard_readchunk(struct in_chunk_dir *cd, ecard_t *ec, int id, int num) in ecard_readchunk() argument
338 if (!ec->cid.cd) in ecard_readchunk()
342 ecard_readbytes(&excd, ec, index, 8, useld); in ecard_readchunk()
345 if (!useld && ec->loader) { in ecard_readchunk()
357 if (!ec->loader) { in ecard_readchunk()
358 ec->loader = kmalloc(c_len(&excd), in ecard_readchunk()
360 if (ec->loader) in ecard_readchunk()
361 ecard_readbytes(ec->loader, ec, in ecard_readchunk()
376 ecard_readbytes((unsigned char *)excd.d.string, ec, in ecard_readchunk()
391 static void ecard_def_irq_enable(ecard_t *ec, int irqnr) in ecard_def_irq_enable() argument
401 static void ecard_def_irq_disable(ecard_t *ec, int irqnr) in ecard_def_irq_disable() argument
411 static int ecard_def_irq_pending(ecard_t *ec) in ecard_def_irq_pending() argument
413 return !ec->irqmask || readb(ec->irqaddr) & ec->irqmask; in ecard_def_irq_pending()
416 static void ecard_def_fiq_enable(ecard_t *ec, int fiqnr) in ecard_def_fiq_enable() argument
421 static void ecard_def_fiq_disable(ecard_t *ec, int fiqnr) in ecard_def_fiq_disable() argument
426 static int ecard_def_fiq_pending(ecard_t *ec) in ecard_def_fiq_pending() argument
428 return !ec->fiqmask || readb(ec->fiqaddr) & ec->fiqmask; in ecard_def_fiq_pending()
448 ecard_t *ec = slot_to_ecard(irqnr - 32); in ecard_irq_unmask() local
450 if (ec) { in ecard_irq_unmask()
451 if (!ec->ops) in ecard_irq_unmask()
452 ec->ops = &ecard_default_ops; in ecard_irq_unmask()
454 if (ec->claimed && ec->ops->irqenable) in ecard_irq_unmask()
455 ec->ops->irqenable(ec, irqnr); in ecard_irq_unmask()
464 ecard_t *ec = slot_to_ecard(irqnr - 32); in ecard_irq_mask() local
466 if (ec) { in ecard_irq_mask()
467 if (!ec->ops) in ecard_irq_mask()
468 ec->ops = &ecard_default_ops; in ecard_irq_mask()
470 if (ec->ops && ec->ops->irqdisable) in ecard_irq_mask()
471 ec->ops->irqdisable(ec, irqnr); in ecard_irq_mask()
484 ecard_t *ec = slot_to_ecard(fiqnr); in ecard_enablefiq() local
486 if (ec) { in ecard_enablefiq()
487 if (!ec->ops) in ecard_enablefiq()
488 ec->ops = &ecard_default_ops; in ecard_enablefiq()
490 if (ec->claimed && ec->ops->fiqenable) in ecard_enablefiq()
491 ec->ops->fiqenable(ec, fiqnr); in ecard_enablefiq()
500 ecard_t *ec = slot_to_ecard(fiqnr); in ecard_disablefiq() local
502 if (ec) { in ecard_disablefiq()
503 if (!ec->ops) in ecard_disablefiq()
504 ec->ops = &ecard_default_ops; in ecard_disablefiq()
506 if (ec->ops->fiqdisable) in ecard_disablefiq()
507 ec->ops->fiqdisable(ec, fiqnr); in ecard_disablefiq()
513 ecard_t *ec; in ecard_dump_irq_state() local
517 for (ec = cards; ec; ec = ec->next) { in ecard_dump_irq_state()
518 if (ec->slot_no == 8) in ecard_dump_irq_state()
522 ec->slot_no, ec->claimed ? "" : "not "); in ecard_dump_irq_state()
524 if (ec->ops && ec->ops->irqpending && in ecard_dump_irq_state()
525 ec->ops != &ecard_default_ops) in ecard_dump_irq_state()
527 ec->ops->irqpending(ec) ? "" : "not "); in ecard_dump_irq_state()
530 ec->irqaddr, ec->irqmask, readb(ec->irqaddr)); in ecard_dump_irq_state()
574 ecard_t *ec; in ecard_irq_handler() local
578 for (ec = cards; ec; ec = ec->next) { in ecard_irq_handler()
581 if (!ec->claimed || ec->irq == NO_IRQ || ec->slot_no == 8) in ecard_irq_handler()
584 if (ec->ops && ec->ops->irqpending) in ecard_irq_handler()
585 pending = ec->ops->irqpending(ec); in ecard_irq_handler()
587 pending = ecard_default_ops.irqpending(ec); in ecard_irq_handler()
590 generic_handle_irq(ec->irq); in ecard_irq_handler()
621 ecard_t *ec = slot_to_ecard(slot); in ecard_irqexp_handler() local
623 if (ec->claimed) { in ecard_irqexp_handler()
636 generic_handle_irq(ec->irq); in ecard_irqexp_handler()
649 ecard_t *ec; in ecard_probeirqhw() local
664 for (ec = cards; ec; ec = ec->next) in ecard_probeirqhw()
665 have_expmask |= 1 << ec->slot_no; in ecard_probeirqhw()
681 static unsigned int __ecard_address(ecard_t *ec, card_type_t type, card_speed_t speed) in __ecard_address() argument
684 int slot = ec->slot_no; in __ecard_address()
686 if (ec->slot_no == 8) in __ecard_address()
725 static int ecard_prints(struct seq_file *m, ecard_t *ec) in ecard_prints() argument
727 seq_printf(m, " %d: %s ", ec->slot_no, ec->easi ? "EASI" : " "); in ecard_prints()
729 if (ec->cid.id == 0) { in ecard_prints()
733 ec->cid.manufacturer, ec->cid.product); in ecard_prints()
735 if (!ec->card_desc && ec->cid.cd && in ecard_prints()
736 ecard_readchunk(&incd, ec, 0xf5, 0)) { in ecard_prints()
737 ec->card_desc = kmalloc(strlen(incd.d.string)+1, GFP_KERNEL); in ecard_prints()
739 if (ec->card_desc) in ecard_prints()
740 strcpy((char *)ec->card_desc, incd.d.string); in ecard_prints()
743 seq_printf(m, "%s\n", ec->card_desc ? ec->card_desc : "*unknown*"); in ecard_prints()
745 seq_printf(m, "Simple card %d\n", ec->cid.id); in ecard_prints()
752 ecard_t *ec = cards; in ecard_devices_proc_show() local
754 while (ec) { in ecard_devices_proc_show()
755 ecard_prints(m, ec); in ecard_devices_proc_show()
756 ec = ec->next; in ecard_devices_proc_show()
782 #define ec_set_resource(ec,nr,st,sz) \ argument
784 (ec)->resource[nr].name = dev_name(&ec->dev); \
785 (ec)->resource[nr].start = st; \
786 (ec)->resource[nr].end = (st) + (sz) - 1; \
787 (ec)->resource[nr].flags = IORESOURCE_MEM; \
790 static void __init ecard_free_card(struct expansion_card *ec) in ecard_free_card() argument
795 if (ec->resource[i].flags) in ecard_free_card()
796 release_resource(&ec->resource[i]); in ecard_free_card()
798 kfree(ec); in ecard_free_card()
803 struct expansion_card *ec; in ecard_alloc_card() local
807 ec = kzalloc(sizeof(ecard_t), GFP_KERNEL); in ecard_alloc_card()
808 if (!ec) { in ecard_alloc_card()
809 ec = ERR_PTR(-ENOMEM); in ecard_alloc_card()
813 ec->slot_no = slot; in ecard_alloc_card()
814 ec->easi = type == ECARD_EASI; in ecard_alloc_card()
815 ec->irq = NO_IRQ; in ecard_alloc_card()
816 ec->fiq = NO_IRQ; in ecard_alloc_card()
817 ec->dma = NO_DMA; in ecard_alloc_card()
818 ec->ops = &ecard_default_ops; in ecard_alloc_card()
820 dev_set_name(&ec->dev, "ecard%d", slot); in ecard_alloc_card()
821 ec->dev.parent = NULL; in ecard_alloc_card()
822 ec->dev.bus = &ecard_bus_type; in ecard_alloc_card()
823 ec->dev.dma_mask = &ec->dma_mask; in ecard_alloc_card()
824 ec->dma_mask = (u64)0xffffffff; in ecard_alloc_card()
825 ec->dev.coherent_dma_mask = ec->dma_mask; in ecard_alloc_card()
828 ec_set_resource(ec, ECARD_RES_MEMC, in ecard_alloc_card()
837 ec_set_resource(ec, ECARD_RES_EASI, in ecard_alloc_card()
843 ec_set_resource(ec, ECARD_RES_MEMC, NETSLOT_BASE, NETSLOT_SIZE); in ecard_alloc_card()
848 ec_set_resource(ec, i + ECARD_RES_IOCSLOW, in ecard_alloc_card()
852 if (ec->resource[i].flags && in ecard_alloc_card()
853 request_resource(&iomem_resource, &ec->resource[i])) { in ecard_alloc_card()
854 dev_err(&ec->dev, "resource(s) not available\n"); in ecard_alloc_card()
855 ec->resource[i].end -= ec->resource[i].start; in ecard_alloc_card()
856 ec->resource[i].start = 0; in ecard_alloc_card()
857 ec->resource[i].flags = 0; in ecard_alloc_card()
862 return ec; in ecard_alloc_card()
867 struct expansion_card *ec = ECARD_DEV(dev); in ecard_show_irq() local
868 return sprintf(buf, "%u\n", ec->irq); in ecard_show_irq()
873 struct expansion_card *ec = ECARD_DEV(dev); in ecard_show_dma() local
874 return sprintf(buf, "%u\n", ec->dma); in ecard_show_dma()
879 struct expansion_card *ec = ECARD_DEV(dev); in ecard_show_resources() local
885 ec->resource[i].start, in ecard_show_resources()
886 ec->resource[i].end, in ecard_show_resources()
887 ec->resource[i].flags); in ecard_show_resources()
894 struct expansion_card *ec = ECARD_DEV(dev); in ecard_show_vendor() local
895 return sprintf(buf, "%u\n", ec->cid.manufacturer); in ecard_show_vendor()
900 struct expansion_card *ec = ECARD_DEV(dev); in ecard_show_device() local
901 return sprintf(buf, "%u\n", ec->cid.product); in ecard_show_device()
906 struct expansion_card *ec = ECARD_DEV(dev); in ecard_show_type() local
907 return sprintf(buf, "%s\n", ec->easi ? "EASI" : "IOC"); in ecard_show_type()
921 int ecard_request_resources(struct expansion_card *ec) in ecard_request_resources() argument
926 if (ecard_resource_end(ec, i) && in ecard_request_resources()
927 !request_mem_region(ecard_resource_start(ec, i), in ecard_request_resources()
928 ecard_resource_len(ec, i), in ecard_request_resources()
929 ec->dev.driver->name)) { in ecard_request_resources()
937 if (ecard_resource_end(ec, i)) in ecard_request_resources()
938 release_mem_region(ecard_resource_start(ec, i), in ecard_request_resources()
939 ecard_resource_len(ec, i)); in ecard_request_resources()
945 void ecard_release_resources(struct expansion_card *ec) in ecard_release_resources() argument
950 if (ecard_resource_end(ec, i)) in ecard_release_resources()
951 release_mem_region(ecard_resource_start(ec, i), in ecard_release_resources()
952 ecard_resource_len(ec, i)); in ecard_release_resources()
956 void ecard_setirq(struct expansion_card *ec, const struct expansion_card_ops *ops, void *irq_data) in ecard_setirq() argument
958 ec->irq_data = irq_data; in ecard_setirq()
960 ec->ops = ops; in ecard_setirq()
964 void __iomem *ecardm_iomap(struct expansion_card *ec, unsigned int res, in ecardm_iomap() argument
967 unsigned long start = ecard_resource_start(ec, res); in ecardm_iomap()
968 unsigned long end = ecard_resource_end(ec, res); in ecardm_iomap()
977 return devm_ioremap(&ec->dev, start, end - start); in ecardm_iomap()
991 ecard_t *ec; in ecard_probe() local
995 ec = ecard_alloc_card(type, slot); in ecard_probe()
996 if (IS_ERR(ec)) { in ecard_probe()
997 rc = PTR_ERR(ec); in ecard_probe()
1002 if ((ec->podaddr = __ecard_address(ec, type, ECARD_SYNC)) == 0) in ecard_probe()
1006 ecard_readbytes(&cid, ec, 0, 16, 0); in ecard_probe()
1010 ec->cid.id = cid.r_id; in ecard_probe()
1011 ec->cid.cd = cid.r_cd; in ecard_probe()
1012 ec->cid.is = cid.r_is; in ecard_probe()
1013 ec->cid.w = cid.r_w; in ecard_probe()
1014 ec->cid.manufacturer = ecard_getu16(cid.r_manu); in ecard_probe()
1015 ec->cid.product = ecard_getu16(cid.r_prod); in ecard_probe()
1016 ec->cid.country = cid.r_country; in ecard_probe()
1017 ec->cid.irqmask = cid.r_irqmask; in ecard_probe()
1018 ec->cid.irqoff = ecard_gets24(cid.r_irqoff); in ecard_probe()
1019 ec->cid.fiqmask = cid.r_fiqmask; in ecard_probe()
1020 ec->cid.fiqoff = ecard_gets24(cid.r_fiqoff); in ecard_probe()
1021 ec->fiqaddr = in ecard_probe()
1022 ec->irqaddr = (void __iomem *)ioaddr(ec->podaddr); in ecard_probe()
1024 if (ec->cid.is) { in ecard_probe()
1025 ec->irqmask = ec->cid.irqmask; in ecard_probe()
1026 ec->irqaddr += ec->cid.irqoff; in ecard_probe()
1027 ec->fiqmask = ec->cid.fiqmask; in ecard_probe()
1028 ec->fiqaddr += ec->cid.fiqoff; in ecard_probe()
1030 ec->irqmask = 1; in ecard_probe()
1031 ec->fiqmask = 4; in ecard_probe()
1035 if (blacklist[i].manufacturer == ec->cid.manufacturer && in ecard_probe()
1036 blacklist[i].product == ec->cid.product) { in ecard_probe()
1037 ec->card_desc = blacklist[i].type; in ecard_probe()
1045 ec->irq = 32 + slot; in ecard_probe()
1046 set_irq_chip(ec->irq, &ecard_chip); in ecard_probe()
1047 set_irq_handler(ec->irq, handle_level_irq); in ecard_probe()
1048 set_irq_flags(ec->irq, IRQF_VALID); in ecard_probe()
1053 ec->irq = 11; in ecard_probe()
1058 ec->dma = 2 + slot; in ecard_probe()
1063 *ecp = ec; in ecard_probe()
1064 slot_to_expcard[slot] = ec; in ecard_probe()
1066 device_register(&ec->dev); in ecard_probe()
1071 ecard_free_card(ec); in ecard_probe()
1120 ecard_match_device(const struct ecard_id *ids, struct expansion_card *ec) in ecard_match_device() argument
1125 if (ec->cid.manufacturer == ids[i].manufacturer && in ecard_match_device()
1126 ec->cid.product == ids[i].product) in ecard_match_device()
1134 struct expansion_card *ec = ECARD_DEV(dev); in ecard_drv_probe() local
1139 id = ecard_match_device(drv->id_table, ec); in ecard_drv_probe()
1141 ec->claimed = 1; in ecard_drv_probe()
1142 ret = drv->probe(ec, id); in ecard_drv_probe()
1144 ec->claimed = 0; in ecard_drv_probe()
1150 struct expansion_card *ec = ECARD_DEV(dev); in ecard_drv_remove() local
1153 drv->remove(ec); in ecard_drv_remove()
1154 ec->claimed = 0; in ecard_drv_remove()
1160 ec->ops = &ecard_default_ops; in ecard_drv_remove()
1162 ec->irq_data = NULL; in ecard_drv_remove()
1175 struct expansion_card *ec = ECARD_DEV(dev); in ecard_drv_shutdown() local
1181 drv->shutdown(ec); in ecard_drv_shutdown()
1182 ec->claimed = 0; in ecard_drv_shutdown()
1188 if (ec->loader) { in ecard_drv_shutdown()
1190 req.ec = ec; in ecard_drv_shutdown()
1209 struct expansion_card *ec = ECARD_DEV(_dev); in ecard_match() local
1214 ret = ecard_match_device(drv->id_table, ec) != NULL; in ecard_match()
1216 ret = ec->cid.id == drv->id; in ecard_match()