Lines Matching refs:p_dev
155 static int pcmcia_access_config(struct pcmcia_device *p_dev, in pcmcia_access_config() argument
166 s = p_dev->socket; in pcmcia_access_config()
169 c = p_dev->function_config; in pcmcia_access_config()
172 dev_dbg(&p_dev->dev, "Configuration isn't locked\n"); in pcmcia_access_config()
177 addr = (p_dev->config_base + where) >> 1; in pcmcia_access_config()
193 int pcmcia_read_config_byte(struct pcmcia_device *p_dev, off_t where, u8 *val) in pcmcia_read_config_byte() argument
195 return pcmcia_access_config(p_dev, where, val, pcmcia_read_cis_mem); in pcmcia_read_config_byte()
206 int pcmcia_write_config_byte(struct pcmcia_device *p_dev, off_t where, u8 val) in pcmcia_write_config_byte() argument
208 return pcmcia_access_config(p_dev, where, &val, pcmcia_write_cis_mem); in pcmcia_write_config_byte()
223 int pcmcia_map_mem_page(struct pcmcia_device *p_dev, struct resource *res, in pcmcia_map_mem_page() argument
226 struct pcmcia_socket *s = p_dev->socket; in pcmcia_map_mem_page()
238 dev_warn(&p_dev->dev, "failed to set_mem_map\n"); in pcmcia_map_mem_page()
253 int pcmcia_fixup_iowidth(struct pcmcia_device *p_dev) in pcmcia_fixup_iowidth() argument
255 struct pcmcia_socket *s = p_dev->socket; in pcmcia_fixup_iowidth()
262 dev_dbg(&p_dev->dev, "fixup iowidth to 8bit\n"); in pcmcia_fixup_iowidth()
265 !(p_dev->function_config->state & CONFIG_LOCKED)) { in pcmcia_fixup_iowidth()
266 dev_dbg(&p_dev->dev, "No card? Config not locked?\n"); in pcmcia_fixup_iowidth()
303 int pcmcia_fixup_vpp(struct pcmcia_device *p_dev, unsigned char new_vpp) in pcmcia_fixup_vpp() argument
305 struct pcmcia_socket *s = p_dev->socket; in pcmcia_fixup_vpp()
310 dev_dbg(&p_dev->dev, "fixup Vpp to %d\n", new_vpp); in pcmcia_fixup_vpp()
313 !(p_dev->function_config->state & CONFIG_LOCKED)) { in pcmcia_fixup_vpp()
314 dev_dbg(&p_dev->dev, "No card? Config not locked?\n"); in pcmcia_fixup_vpp()
321 dev_warn(&p_dev->dev, "Unable to set VPP\n"); in pcmcia_fixup_vpp()
325 p_dev->vpp = new_vpp; in pcmcia_fixup_vpp()
346 int pcmcia_release_configuration(struct pcmcia_device *p_dev) in pcmcia_release_configuration() argument
349 struct pcmcia_socket *s = p_dev->socket; in pcmcia_release_configuration()
354 c = p_dev->function_config; in pcmcia_release_configuration()
355 if (p_dev->_locked) { in pcmcia_release_configuration()
356 p_dev->_locked = 0; in pcmcia_release_configuration()
393 static void pcmcia_release_io(struct pcmcia_device *p_dev) in pcmcia_release_io() argument
395 struct pcmcia_socket *s = p_dev->socket; in pcmcia_release_io()
399 if (!p_dev->_io) in pcmcia_release_io()
402 c = p_dev->function_config; in pcmcia_release_io()
409 p_dev->_io = 0; in pcmcia_release_io()
425 int pcmcia_release_window(struct pcmcia_device *p_dev, struct resource *res) in pcmcia_release_window() argument
427 struct pcmcia_socket *s = p_dev->socket; in pcmcia_release_window()
431 dev_dbg(&p_dev->dev, "releasing window %pR\n", res); in pcmcia_release_window()
440 if (!(p_dev->_win & CLIENT_WIN_REQ(w))) { in pcmcia_release_window()
441 dev_dbg(&p_dev->dev, "not releasing unknown window\n"); in pcmcia_release_window()
460 p_dev->_win &= ~CLIENT_WIN_REQ(w); in pcmcia_release_window()
477 int pcmcia_enable_device(struct pcmcia_device *p_dev) in pcmcia_enable_device() argument
481 struct pcmcia_socket *s = p_dev->socket; in pcmcia_enable_device()
487 unsigned int flags = p_dev->config_flags; in pcmcia_enable_device()
493 c = p_dev->function_config; in pcmcia_enable_device()
496 dev_dbg(&p_dev->dev, "Configuration is locked\n"); in pcmcia_enable_device()
501 s->socket.Vpp = p_dev->vpp; in pcmcia_enable_device()
504 dev_warn(&p_dev->dev, "Unable to set socket state\n"); in pcmcia_enable_device()
509 if (p_dev->_io || flags & CONF_ENABLE_IRQ) in pcmcia_enable_device()
518 if (!(p_dev->config_regs & PRESENT_STATUS)) in pcmcia_enable_device()
519 dev_warn(&p_dev->dev, "speaker requested, but " in pcmcia_enable_device()
527 p_dev->config_regs |= PRESENT_EXT_STATUS; in pcmcia_enable_device()
533 dev_dbg(&p_dev->dev, in pcmcia_enable_device()
535 p_dev->vpp, flags, p_dev->config_base, p_dev->config_regs, in pcmcia_enable_device()
536 p_dev->config_index); in pcmcia_enable_device()
539 base = p_dev->config_base; in pcmcia_enable_device()
540 if (p_dev->config_regs & PRESENT_COPY) { in pcmcia_enable_device()
542 dev_dbg(&p_dev->dev, "clearing CISREG_SCR\n"); in pcmcia_enable_device()
545 if (p_dev->config_regs & PRESENT_PIN_REPLACE) { in pcmcia_enable_device()
547 dev_dbg(&p_dev->dev, "clearing CISREG_PRR\n"); in pcmcia_enable_device()
550 if (p_dev->config_regs & PRESENT_OPTION) { in pcmcia_enable_device()
552 option = p_dev->config_index & COR_CONFIG_MASK; in pcmcia_enable_device()
554 option = p_dev->config_index & COR_MFC_CONFIG_MASK; in pcmcia_enable_device()
556 if (p_dev->config_regs & PRESENT_IOBASE_0) in pcmcia_enable_device()
565 if (p_dev->config_regs & PRESENT_STATUS) in pcmcia_enable_device()
568 if (p_dev->config_regs & PRESENT_EXT_STATUS) in pcmcia_enable_device()
572 if (p_dev->config_regs & PRESENT_IOBASE_0) { in pcmcia_enable_device()
578 if (p_dev->config_regs & PRESENT_IOSIZE) { in pcmcia_enable_device()
606 p_dev->_locked = 1; in pcmcia_enable_device()
623 int pcmcia_request_io(struct pcmcia_device *p_dev) in pcmcia_request_io() argument
625 struct pcmcia_socket *s = p_dev->socket; in pcmcia_request_io()
626 config_t *c = p_dev->function_config; in pcmcia_request_io()
630 dev_dbg(&p_dev->dev, "pcmcia_request_io: %pR , %pR", in pcmcia_request_io()
634 dev_dbg(&p_dev->dev, "pcmcia_request_io: No card present\n"); in pcmcia_request_io()
639 dev_dbg(&p_dev->dev, "Configuration is locked\n"); in pcmcia_request_io()
643 dev_dbg(&p_dev->dev, "IO already configured\n"); in pcmcia_request_io()
647 ret = alloc_io_space(s, &c->io[0], p_dev->io_lines); in pcmcia_request_io()
652 ret = alloc_io_space(s, &c->io[1], p_dev->io_lines); in pcmcia_request_io()
667 p_dev->_io = 1; in pcmcia_request_io()
669 dev_dbg(&p_dev->dev, "pcmcia_request_io succeeded: %pR , %pR", in pcmcia_request_io()
690 int __must_check pcmcia_request_irq(struct pcmcia_device *p_dev, in pcmcia_request_irq() argument
695 if (!p_dev->irq) in pcmcia_request_irq()
698 ret = request_irq(p_dev->irq, handler, IRQF_SHARED, in pcmcia_request_irq()
699 p_dev->devname, p_dev->priv); in pcmcia_request_irq()
701 p_dev->_irq = 1; in pcmcia_request_irq()
725 static int pcmcia_setup_isa_irq(struct pcmcia_device *p_dev, int type) in pcmcia_setup_isa_irq() argument
727 struct pcmcia_socket *s = p_dev->socket; in pcmcia_setup_isa_irq()
749 ret = request_irq(irq, test_action, type, p_dev->devname, in pcmcia_setup_isa_irq()
750 p_dev); in pcmcia_setup_isa_irq()
752 free_irq(irq, p_dev); in pcmcia_setup_isa_irq()
753 p_dev->irq = s->pcmcia_irq = irq; in pcmcia_setup_isa_irq()
770 static int pcmcia_setup_isa_irq(struct pcmcia_device *p_dev, int type) in pcmcia_setup_isa_irq() argument
790 int pcmcia_setup_irq(struct pcmcia_device *p_dev) in pcmcia_setup_irq() argument
792 struct pcmcia_socket *s = p_dev->socket; in pcmcia_setup_irq()
794 if (p_dev->irq) in pcmcia_setup_irq()
799 p_dev->irq = s->pcmcia_irq; in pcmcia_setup_irq()
804 if (!pcmcia_setup_isa_irq(p_dev, 0)) in pcmcia_setup_irq()
808 if (!pcmcia_setup_isa_irq(p_dev, IRQF_SHARED)) in pcmcia_setup_irq()
813 p_dev->irq = s->pcmcia_irq = s->pci_irq; in pcmcia_setup_irq()
833 int pcmcia_request_window(struct pcmcia_device *p_dev, struct resource *res, in pcmcia_request_window() argument
836 struct pcmcia_socket *s = p_dev->socket; in pcmcia_request_window()
841 dev_dbg(&p_dev->dev, "request_window %pR %d\n", res, speed); in pcmcia_request_window()
844 dev_dbg(&p_dev->dev, "No card present\n"); in pcmcia_request_window()
853 dev_dbg(&p_dev->dev, "invalid map size\n"); in pcmcia_request_window()
858 dev_dbg(&p_dev->dev, "invalid base address\n"); in pcmcia_request_window()
870 dev_dbg(&p_dev->dev, "all windows are used already\n"); in pcmcia_request_window()
881 dev_dbg(&p_dev->dev, "allocating mem region failed\n"); in pcmcia_request_window()
886 p_dev->_win |= CLIENT_WIN_REQ(w); in pcmcia_request_window()
895 dev_dbg(&p_dev->dev, "failed to set memory mapping\n"); in pcmcia_request_window()
915 dev_dbg(&p_dev->dev, "request_window results in %pR\n", res); in pcmcia_request_window()
936 void pcmcia_disable_device(struct pcmcia_device *p_dev) in pcmcia_disable_device() argument
940 dev_dbg(&p_dev->dev, "disabling device\n"); in pcmcia_disable_device()
943 struct resource *res = p_dev->resource[MAX_IO_WIN + i]; in pcmcia_disable_device()
945 pcmcia_release_window(p_dev, res); in pcmcia_disable_device()
948 pcmcia_release_configuration(p_dev); in pcmcia_disable_device()
949 pcmcia_release_io(p_dev); in pcmcia_disable_device()
950 if (p_dev->_irq) { in pcmcia_disable_device()
951 free_irq(p_dev->irq, p_dev->priv); in pcmcia_disable_device()
952 p_dev->_irq = 0; in pcmcia_disable_device()