Lines Matching refs:p_dev

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