Lines Matching refs:p

86 #define ECR_WRITE(p, v) frob_econtrol((p), 0xff, (v))  argument
127 static inline void frob_set_mode(struct parport *p, int mode) in frob_set_mode() argument
129 frob_econtrol(p, ECR_MODE_MASK, mode << 5); in frob_set_mode()
139 static int change_mode(struct parport *p, int m) in change_mode() argument
141 const struct parport_pc_private *priv = p->physport->private_data; in change_mode()
153 oecr = inb(ECONTROL(p)); in change_mode()
161 unsigned long expire = jiffies + p->physport->cad->timeout; in change_mode()
168 if (inb(ECONTROL(p)) & 0x01) in change_mode()
176 while (!(inb(ECONTROL(p)) & 0x01)) { in change_mode()
192 ECR_WRITE(p, oecr); in change_mode()
198 ECR_WRITE(p, oecr); in change_mode()
246 static void parport_pc_save_state(struct parport *p, struct parport_state *s) in parport_pc_save_state() argument
248 const struct parport_pc_private *priv = p->physport->private_data; in parport_pc_save_state()
251 s->u.pc.ecr = inb(ECONTROL(p)); in parport_pc_save_state()
254 static void parport_pc_restore_state(struct parport *p, in parport_pc_restore_state() argument
257 struct parport_pc_private *priv = p->physport->private_data; in parport_pc_restore_state()
259 outb(c, CONTROL(p)); in parport_pc_restore_state()
262 ECR_WRITE(p, s->u.pc.ecr); in parport_pc_restore_state()
1379 static struct superio_struct *find_superio(struct parport *p) in find_superio() argument
1383 if (superios[i].io == p->base) in find_superio()
1388 static int get_superio_dma(struct parport *p) in get_superio_dma() argument
1390 struct superio_struct *s = find_superio(p); in get_superio_dma()
1396 static int get_superio_irq(struct parport *p) in get_superio_irq() argument
1398 struct superio_struct *s = find_superio(p); in get_superio_irq()
1988 static int programmable_dma_support(struct parport *p) in programmable_dma_support() argument
1990 unsigned char oecr = inb(ECONTROL(p)); in programmable_dma_support()
1993 frob_set_mode(p, ECR_CNF); in programmable_dma_support()
1995 dma = inb(CONFIGB(p)) & 0x07; in programmable_dma_support()
2001 ECR_WRITE(p, oecr); in programmable_dma_support()
2005 static int parport_dma_probe(struct parport *p) in parport_dma_probe() argument
2007 const struct parport_pc_private *priv = p->private_data; in parport_dma_probe()
2009 p->dma = programmable_dma_support(p); in parport_dma_probe()
2010 if (p->dma == PARPORT_DMA_NONE) { in parport_dma_probe()
2014 p->dma = get_superio_dma(p); in parport_dma_probe()
2017 return p->dma; in parport_dma_probe()
2035 struct parport *p; in __parport_pc_probe_port() local
2068 p = parport_register_port(base, irq, dma, ops); in __parport_pc_probe_port()
2069 if (!p) in __parport_pc_probe_port()
2072 base_res = request_region(base, 3, p->name); in __parport_pc_probe_port()
2085 priv->port = p; in __parport_pc_probe_port()
2087 p->dev = dev; in __parport_pc_probe_port()
2088 p->base_hi = base_hi; in __parport_pc_probe_port()
2089 p->modes = PARPORT_MODE_PCSPP | PARPORT_MODE_SAFEININT; in __parport_pc_probe_port()
2090 p->private_data = priv; in __parport_pc_probe_port()
2093 ECR_res = request_region(base_hi, 3, p->name); in __parport_pc_probe_port()
2095 parport_ECR_present(p); in __parport_pc_probe_port()
2099 EPP_res = request_region(base+0x3, 5, p->name); in __parport_pc_probe_port()
2101 if (!parport_EPP_supported(p)) in __parport_pc_probe_port()
2102 parport_ECPEPP_supported(p); in __parport_pc_probe_port()
2104 if (!parport_SPP_supported(p)) in __parport_pc_probe_port()
2108 parport_ECPPS2_supported(p); in __parport_pc_probe_port()
2110 parport_PS2_supported(p); in __parport_pc_probe_port()
2112 p->size = (p->modes & PARPORT_MODE_EPP) ? 8 : 3; in __parport_pc_probe_port()
2114 pr_info("%s: PC-style at 0x%lx", p->name, p->base); in __parport_pc_probe_port()
2115 if (p->base_hi && priv->ecr) in __parport_pc_probe_port()
2116 pr_cont(" (0x%lx)", p->base_hi); in __parport_pc_probe_port()
2117 if (p->irq == PARPORT_IRQ_AUTO) { in __parport_pc_probe_port()
2118 p->irq = PARPORT_IRQ_NONE; in __parport_pc_probe_port()
2119 parport_irq_probe(p); in __parport_pc_probe_port()
2120 } else if (p->irq == PARPORT_IRQ_PROBEONLY) { in __parport_pc_probe_port()
2121 p->irq = PARPORT_IRQ_NONE; in __parport_pc_probe_port()
2122 parport_irq_probe(p); in __parport_pc_probe_port()
2123 probedirq = p->irq; in __parport_pc_probe_port()
2124 p->irq = PARPORT_IRQ_NONE; in __parport_pc_probe_port()
2126 if (p->irq != PARPORT_IRQ_NONE) { in __parport_pc_probe_port()
2127 pr_cont(", irq %d", p->irq); in __parport_pc_probe_port()
2130 if (p->dma == PARPORT_DMA_AUTO) { in __parport_pc_probe_port()
2131 p->dma = PARPORT_DMA_NONE; in __parport_pc_probe_port()
2132 parport_dma_probe(p); in __parport_pc_probe_port()
2135 if (p->dma == PARPORT_DMA_AUTO) /* To use DMA, giving the irq in __parport_pc_probe_port()
2137 p->dma = PARPORT_DMA_NONE; in __parport_pc_probe_port()
2140 if (parport_ECP_supported(p) && in __parport_pc_probe_port()
2141 p->dma != PARPORT_DMA_NOFIFO && in __parport_pc_probe_port()
2142 priv->fifo_depth > 0 && p->irq != PARPORT_IRQ_NONE) { in __parport_pc_probe_port()
2143 p->modes |= PARPORT_MODE_ECP | PARPORT_MODE_COMPAT; in __parport_pc_probe_port()
2144 if (p->dma != PARPORT_DMA_NONE) in __parport_pc_probe_port()
2145 p->modes |= PARPORT_MODE_DMA; in __parport_pc_probe_port()
2148 p->dma = PARPORT_DMA_NONE; in __parport_pc_probe_port()
2151 p->modes &= ~mode_mask; in __parport_pc_probe_port()
2154 if ((p->modes & PARPORT_MODE_COMPAT) != 0) in __parport_pc_probe_port()
2155 p->ops->compat_write_data = parport_pc_compat_write_block_pio; in __parport_pc_probe_port()
2157 if ((p->modes & PARPORT_MODE_ECP) != 0) in __parport_pc_probe_port()
2158 p->ops->ecp_write_data = parport_pc_ecp_write_block_pio; in __parport_pc_probe_port()
2160 if ((p->modes & (PARPORT_MODE_ECP | PARPORT_MODE_COMPAT)) != 0) { in __parport_pc_probe_port()
2161 if ((p->modes & PARPORT_MODE_DMA) != 0) in __parport_pc_probe_port()
2162 pr_cont(", dma %d", p->dma); in __parport_pc_probe_port()
2172 if (p->modes & PARPORT_MODE_##x) \ in __parport_pc_probe_port()
2191 pr_info("%s: irq %d detected\n", p->name, probedirq); in __parport_pc_probe_port()
2194 if (ECR_res && (p->modes & PARPORT_MODE_ECP) == 0) { in __parport_pc_probe_port()
2199 if (EPP_res && (p->modes & PARPORT_MODE_EPP) == 0) { in __parport_pc_probe_port()
2203 if (p->irq != PARPORT_IRQ_NONE) { in __parport_pc_probe_port()
2204 if (request_irq(p->irq, parport_irq_handler, in __parport_pc_probe_port()
2205 irqflags, p->name, p)) { in __parport_pc_probe_port()
2207 p->name, p->irq); in __parport_pc_probe_port()
2208 p->irq = PARPORT_IRQ_NONE; in __parport_pc_probe_port()
2209 p->dma = PARPORT_DMA_NONE; in __parport_pc_probe_port()
2214 if (p->dma != PARPORT_DMA_NONE) { in __parport_pc_probe_port()
2215 if (request_dma(p->dma, p->name)) { in __parport_pc_probe_port()
2217 p->name, p->dma); in __parport_pc_probe_port()
2218 p->dma = PARPORT_DMA_NONE; in __parport_pc_probe_port()
2227 p->name); in __parport_pc_probe_port()
2228 free_dma(p->dma); in __parport_pc_probe_port()
2229 p->dma = PARPORT_DMA_NONE; in __parport_pc_probe_port()
2243 ECR_WRITE(p, 0x34); in __parport_pc_probe_port()
2245 parport_pc_write_data(p, 0); in __parport_pc_probe_port()
2246 parport_pc_data_forward(p); in __parport_pc_probe_port()
2254 parport_announce_port(p); in __parport_pc_probe_port()
2256 return p; in __parport_pc_probe_port()
2265 parport_del_port(p); in __parport_pc_probe_port()
2287 void parport_pc_unregister_port(struct parport *p) in parport_pc_unregister_port() argument
2289 struct parport_pc_private *priv = p->private_data; in parport_pc_unregister_port()
2290 struct parport_operations *ops = p->ops; in parport_pc_unregister_port()
2292 parport_remove_port(p); in parport_pc_unregister_port()
2297 if (p->dma != PARPORT_DMA_NONE) in parport_pc_unregister_port()
2298 free_dma(p->dma); in parport_pc_unregister_port()
2300 if (p->irq != PARPORT_IRQ_NONE) in parport_pc_unregister_port()
2301 free_irq(p->irq, p); in parport_pc_unregister_port()
2302 release_region(p->base, 3); in parport_pc_unregister_port()
2303 if (p->size > 3) in parport_pc_unregister_port()
2304 release_region(p->base + 3, p->size - 3); in parport_pc_unregister_port()
2305 if (p->modes & PARPORT_MODE_ECP) in parport_pc_unregister_port()
2306 release_region(p->base_hi, 3); in parport_pc_unregister_port()
2309 dma_free_coherent(p->physport->dev, PAGE_SIZE, in parport_pc_unregister_port()
2313 kfree(p->private_data); in parport_pc_unregister_port()
2314 parport_del_port(p); in parport_pc_unregister_port()