Lines Matching refs:sock
71 static int db1300_card_inserted(struct db1x_pcmcia_sock *sock) in db1300_card_inserted() argument
77 static int db1200_card_inserted(struct db1x_pcmcia_sock *sock) in db1200_card_inserted() argument
82 return sigstat & 1 << (8 + 2 * sock->nr); in db1200_card_inserted()
86 static int db1000_card_inserted(struct db1x_pcmcia_sock *sock) in db1000_card_inserted() argument
88 return !gpio_get_value(sock->insert_gpio); in db1000_card_inserted()
91 static int db1x_card_inserted(struct db1x_pcmcia_sock *sock) in db1x_card_inserted() argument
93 switch (sock->board_type) { in db1x_card_inserted()
95 return db1200_card_inserted(sock); in db1x_card_inserted()
97 return db1300_card_inserted(sock); in db1x_card_inserted()
99 return db1000_card_inserted(sock); in db1x_card_inserted()
107 static inline void set_stschg(struct db1x_pcmcia_sock *sock, int en) in set_stschg() argument
109 if (sock->stschg_irq != -1) { in set_stschg()
111 enable_irq(sock->stschg_irq); in set_stschg()
113 disable_irq(sock->stschg_irq); in set_stschg()
119 struct db1x_pcmcia_sock *sock = data; in db1000_pcmcia_cdirq() local
121 pcmcia_parse_events(&sock->socket, SS_DETECT); in db1000_pcmcia_cdirq()
128 struct db1x_pcmcia_sock *sock = data; in db1000_pcmcia_stschgirq() local
130 pcmcia_parse_events(&sock->socket, SS_STSCHG); in db1000_pcmcia_stschgirq()
148 struct db1x_pcmcia_sock *sock = data; in db1200_pcmcia_cdirq_fn() local
152 if (irq == sock->insert_irq) in db1200_pcmcia_cdirq_fn()
153 enable_irq(sock->eject_irq); in db1200_pcmcia_cdirq_fn()
155 enable_irq(sock->insert_irq); in db1200_pcmcia_cdirq_fn()
157 pcmcia_parse_events(&sock->socket, SS_DETECT); in db1200_pcmcia_cdirq_fn()
162 static int db1x_pcmcia_setup_irqs(struct db1x_pcmcia_sock *sock) in db1x_pcmcia_setup_irqs() argument
166 if (sock->stschg_irq != -1) { in db1x_pcmcia_setup_irqs()
167 ret = request_irq(sock->stschg_irq, db1000_pcmcia_stschgirq, in db1x_pcmcia_setup_irqs()
168 0, "pcmcia_stschg", sock); in db1x_pcmcia_setup_irqs()
179 if ((sock->board_type == BOARD_TYPE_DB1200) || in db1x_pcmcia_setup_irqs()
180 (sock->board_type == BOARD_TYPE_DB1300)) { in db1x_pcmcia_setup_irqs()
181 ret = request_threaded_irq(sock->insert_irq, db1200_pcmcia_cdirq, in db1x_pcmcia_setup_irqs()
182 db1200_pcmcia_cdirq_fn, 0, "pcmcia_insert", sock); in db1x_pcmcia_setup_irqs()
186 ret = request_threaded_irq(sock->eject_irq, db1200_pcmcia_cdirq, in db1x_pcmcia_setup_irqs()
187 db1200_pcmcia_cdirq_fn, 0, "pcmcia_eject", sock); in db1x_pcmcia_setup_irqs()
189 free_irq(sock->insert_irq, sock); in db1x_pcmcia_setup_irqs()
194 if (db1x_card_inserted(sock)) in db1x_pcmcia_setup_irqs()
195 enable_irq(sock->eject_irq); in db1x_pcmcia_setup_irqs()
197 enable_irq(sock->insert_irq); in db1x_pcmcia_setup_irqs()
202 irq_set_irq_type(sock->insert_irq, IRQ_TYPE_EDGE_BOTH); in db1x_pcmcia_setup_irqs()
203 ret = request_irq(sock->insert_irq, db1000_pcmcia_cdirq, in db1x_pcmcia_setup_irqs()
204 0, "pcmcia_carddetect", sock); in db1x_pcmcia_setup_irqs()
213 if (sock->stschg_irq != -1) in db1x_pcmcia_setup_irqs()
214 free_irq(sock->stschg_irq, sock); in db1x_pcmcia_setup_irqs()
219 static void db1x_pcmcia_free_irqs(struct db1x_pcmcia_sock *sock) in db1x_pcmcia_free_irqs() argument
221 if (sock->stschg_irq != -1) in db1x_pcmcia_free_irqs()
222 free_irq(sock->stschg_irq, sock); in db1x_pcmcia_free_irqs()
224 free_irq(sock->insert_irq, sock); in db1x_pcmcia_free_irqs()
225 if (sock->eject_irq != -1) in db1x_pcmcia_free_irqs()
226 free_irq(sock->eject_irq, sock); in db1x_pcmcia_free_irqs()
245 struct db1x_pcmcia_sock *sock = to_db1x_socket(skt); in db1x_pcmcia_configure() local
251 cr_clr = (0xf << (sock->nr * 8)); /* clear voltage settings */ in db1x_pcmcia_configure()
266 sock->nr, state->Vcc); in db1x_pcmcia_configure()
281 sock->nr, state->Vpp); in db1x_pcmcia_configure()
288 sock->nr, state->Vcc, state->Vpp); in db1x_pcmcia_configure()
294 if (sock->board_type != BOARD_TYPE_DB1300) in db1x_pcmcia_configure()
295 cr_set |= ((v << 2) | p) << (sock->nr * 8); in db1x_pcmcia_configure()
297 changed = state->flags ^ sock->old_flags; in db1x_pcmcia_configure()
301 set_stschg(sock, 0); in db1x_pcmcia_configure()
303 cr_clr |= (1 << (7 + (sock->nr * 8))); in db1x_pcmcia_configure()
304 cr_clr |= (1 << (4 + (sock->nr * 8))); in db1x_pcmcia_configure()
307 cr_set |= 1 << (7 + (sock->nr * 8)); in db1x_pcmcia_configure()
308 cr_set |= 1 << (4 + (sock->nr * 8)); in db1x_pcmcia_configure()
315 sock->old_flags = state->flags; in db1x_pcmcia_configure()
320 set_stschg(sock, 1); in db1x_pcmcia_configure()
341 struct db1x_pcmcia_sock *sock = to_db1x_socket(skt); in db1x_pcmcia_get_status() local
345 status = db1x_card_inserted(sock) ? SS_DETECT : 0; in db1x_pcmcia_get_status()
351 if (sock->board_type == BOARD_TYPE_PB1100) in db1x_pcmcia_get_status()
355 switch (GET_VS(sr, sock->nr)) { in db1x_pcmcia_get_status()
367 status |= GET_VCC(cr, sock->nr) ? SS_POWERON : 0; in db1x_pcmcia_get_status()
370 if ((sock->board_type == BOARD_TYPE_DB1300) && (status & SS_DETECT)) in db1x_pcmcia_get_status()
374 status |= (GET_RESET(cr, sock->nr)) ? SS_READY : SS_RESET; in db1x_pcmcia_get_status()
394 struct db1x_pcmcia_sock *sock = to_db1x_socket(skt); in au1x00_pcmcia_set_io_map() local
396 map->start = (u32)sock->virt_io; in au1x00_pcmcia_set_io_map()
405 struct db1x_pcmcia_sock *sock = to_db1x_socket(skt); in au1x00_pcmcia_set_mem_map() local
408 map->static_start = sock->phys_attr + map->card_start; in au1x00_pcmcia_set_mem_map()
410 map->static_start = sock->phys_mem + map->card_start; in au1x00_pcmcia_set_mem_map()
426 struct db1x_pcmcia_sock *sock; in db1x_pcmcia_socket_probe() local
430 sock = kzalloc(sizeof(struct db1x_pcmcia_sock), GFP_KERNEL); in db1x_pcmcia_socket_probe()
431 if (!sock) in db1x_pcmcia_socket_probe()
434 sock->nr = pdev->id; in db1x_pcmcia_socket_probe()
441 sock->board_type = BOARD_TYPE_PB1100; in db1x_pcmcia_socket_probe()
444 sock->board_type = BOARD_TYPE_DEFAULT; in db1x_pcmcia_socket_probe()
447 sock->board_type = BOARD_TYPE_DB1200; in db1x_pcmcia_socket_probe()
450 sock->board_type = BOARD_TYPE_DB1300; in db1x_pcmcia_socket_probe()
470 sock->card_irq = r ? r->start : 0; in db1x_pcmcia_socket_probe()
476 sock->insert_irq = r ? r->start : -1; in db1x_pcmcia_socket_probe()
477 if (sock->board_type == BOARD_TYPE_DEFAULT) { in db1x_pcmcia_socket_probe()
478 sock->insert_gpio = r ? r->start : -1; in db1x_pcmcia_socket_probe()
479 sock->insert_irq = r ? gpio_to_irq(r->start) : -1; in db1x_pcmcia_socket_probe()
484 sock->stschg_irq = r ? r->start : -1; in db1x_pcmcia_socket_probe()
488 sock->eject_irq = r ? r->start : -1; in db1x_pcmcia_socket_probe()
496 sock->nr); in db1x_pcmcia_socket_probe()
499 sock->phys_attr = r->start; in db1x_pcmcia_socket_probe()
505 sock->nr); in db1x_pcmcia_socket_probe()
508 sock->phys_mem = r->start; in db1x_pcmcia_socket_probe()
514 sock->nr); in db1x_pcmcia_socket_probe()
517 sock->phys_io = r->start; in db1x_pcmcia_socket_probe()
527 sock->virt_io = (void *)(ioremap(sock->phys_io, IO_MAP_SIZE) - in db1x_pcmcia_socket_probe()
530 if (!sock->virt_io) { in db1x_pcmcia_socket_probe()
532 sock->nr); in db1x_pcmcia_socket_probe()
537 sock->socket.ops = &db1x_pcmcia_operations; in db1x_pcmcia_socket_probe()
538 sock->socket.owner = THIS_MODULE; in db1x_pcmcia_socket_probe()
539 sock->socket.pci_irq = sock->card_irq; in db1x_pcmcia_socket_probe()
540 sock->socket.features = SS_CAP_STATIC_MAP | SS_CAP_PCCARD; in db1x_pcmcia_socket_probe()
541 sock->socket.map_size = MEM_MAP_SIZE; in db1x_pcmcia_socket_probe()
542 sock->socket.io_offset = (unsigned long)sock->virt_io; in db1x_pcmcia_socket_probe()
543 sock->socket.dev.parent = &pdev->dev; in db1x_pcmcia_socket_probe()
544 sock->socket.resource_ops = &pccard_static_ops; in db1x_pcmcia_socket_probe()
546 platform_set_drvdata(pdev, sock); in db1x_pcmcia_socket_probe()
548 ret = db1x_pcmcia_setup_irqs(sock); in db1x_pcmcia_socket_probe()
551 sock->nr); in db1x_pcmcia_socket_probe()
555 set_stschg(sock, 0); in db1x_pcmcia_socket_probe()
557 ret = pcmcia_register_socket(&sock->socket); in db1x_pcmcia_socket_probe()
559 printk(KERN_ERR "pcmcia%d failed to register\n", sock->nr); in db1x_pcmcia_socket_probe()
565 "%d %d %d\n", sock->nr, sock->phys_io, sock->virt_io, in db1x_pcmcia_socket_probe()
566 sock->phys_attr, sock->phys_mem, sock->card_irq, in db1x_pcmcia_socket_probe()
567 sock->insert_irq, sock->stschg_irq, sock->eject_irq); in db1x_pcmcia_socket_probe()
572 db1x_pcmcia_free_irqs(sock); in db1x_pcmcia_socket_probe()
574 iounmap((void *)(sock->virt_io + (u32)mips_io_port_base)); in db1x_pcmcia_socket_probe()
576 kfree(sock); in db1x_pcmcia_socket_probe()
582 struct db1x_pcmcia_sock *sock = platform_get_drvdata(pdev); in db1x_pcmcia_socket_remove() local
584 db1x_pcmcia_free_irqs(sock); in db1x_pcmcia_socket_remove()
585 pcmcia_unregister_socket(&sock->socket); in db1x_pcmcia_socket_remove()
586 iounmap((void *)(sock->virt_io + (u32)mips_io_port_base)); in db1x_pcmcia_socket_remove()
587 kfree(sock); in db1x_pcmcia_socket_remove()