Lines Matching +full:drdy +full:- +full:int +full:- +full:pin

1 // SPDX-License-Identifier: GPL-2.0-only
2 /* Low-level parallel port routines for the Multiface 3 card
14 * -------------------------
16 * The two open-drain interrupt outputs /IRQA and /IRQB are routed to
19 * The CPU data bus of the PIA (D0-D7) is connected to D8-D15 on the Z2
22 * Centronics Pin Connections for the PIA
23 * --------------------------------------
27 * very complete, Centronics type interface. The Pin column gives the pin
28 * numbers of the PIA. The Centronics pin numbers can be found in the section
32 * Pin | PIA | Dir | Centronics Names
33 * -------+-----+-----+---------------------------------------------------------
34 * 19 | CB2 | --> | /STROBE (aka /DRDY)
35 * 10-17 | PBx | <-> | DATA0 - DATA7
36 * 18 | CB1 | <-- | /ACK
37 * 40 | CA1 | <-- | BUSY
38 * 3 | PA1 | <-- | PAPER-OUT (aka POUT)
39 * 4 | PA2 | <-- | SELECTED (aka SEL)
40 * 9 | PA7 | --> | /INIT (aka /RESET or /INPUT-PRIME)
41 * 6 | PA4 | <-- | /ERROR (aka /FAULT)
42 * 7 | PA5 | --> | DIR (aka /SELECT-IN)
43 * 8 | PA6 | --> | /AUTO-FEED-XT
44 * 39 | CA2 | --> | open
45 * 5 | PA3 | <-- | /ACK (same as CB1!)
46 * 2 | PA0 | <-- | BUSY (same as CA1!)
47 * -------+-----+-----+---------------------------------------------------------
75 static volatile int dummy; /* for trigger readds */
77 #define pia(dev) ((struct pia *)(dev->base))
84 dummy = pia(p)->pprb; /* clears irq bit */ in mfc3_write_data()
86 pia(p)->pprb = data; in mfc3_write_data()
92 return pia(p)->pprb; in mfc3_read_data()
126 pia(p)->ppra = (pia(p)->ppra & 0x1f) | control_pc_to_mfc3(control); in mfc3_write_control()
132 return control_mfc3_to_pc(pia(p)->ppra & 0xe0); in mfc3_read_control()
167 status = status_mfc3_to_pc(pia(p)->ppra & 0x1f); in mfc3_read_status()
172 static int use_cnt;
174 static irqreturn_t mfc3_interrupt(int irq, void *dev_id) in mfc3_interrupt()
176 int i; in mfc3_interrupt()
180 if (pia(this_port[i])->crb & 128) { /* Board caused interrupt */ in mfc3_interrupt()
181 dummy = pia(this_port[i])->pprb; /* clear irq bit */ in mfc3_interrupt()
189 pia(p)->crb |= PIA_C1_ENABLE_IRQ; in mfc3_enable_irq()
194 pia(p)->crb &= ~PIA_C1_ENABLE_IRQ; in mfc3_disable_irq()
200 pia(p)->crb &= ~PIA_DDR; /* make data direction register visible */ in mfc3_data_forward()
201 pia(p)->pddrb = 255; /* all pins output */ in mfc3_data_forward()
202 pia(p)->crb |= PIA_DDR; /* make data register visible - default */ in mfc3_data_forward()
208 pia(p)->crb &= ~PIA_DDR; /* make data direction register visible */ in mfc3_data_reverse()
209 pia(p)->pddrb = 0; /* all pins input */ in mfc3_data_reverse()
210 pia(p)->crb |= PIA_DDR; /* make data register visible - default */ in mfc3_data_reverse()
215 s->u.amiga.data = 0; in mfc3_init_state()
216 s->u.amiga.datadir = 255; in mfc3_init_state()
217 s->u.amiga.status = 0; in mfc3_init_state()
218 s->u.amiga.statusdir = 0xe0; in mfc3_init_state()
223 s->u.amiga.data = pia(p)->pprb; in mfc3_save_state()
224 pia(p)->crb &= ~PIA_DDR; in mfc3_save_state()
225 s->u.amiga.datadir = pia(p)->pddrb; in mfc3_save_state()
226 pia(p)->crb |= PIA_DDR; in mfc3_save_state()
227 s->u.amiga.status = pia(p)->ppra; in mfc3_save_state()
228 pia(p)->cra &= ~PIA_DDR; in mfc3_save_state()
229 s->u.amiga.statusdir = pia(p)->pddrb; in mfc3_save_state()
230 pia(p)->cra |= PIA_DDR; in mfc3_save_state()
235 pia(p)->pprb = s->u.amiga.data; in mfc3_restore_state()
236 pia(p)->crb &= ~PIA_DDR; in mfc3_restore_state()
237 pia(p)->pddrb = s->u.amiga.datadir; in mfc3_restore_state()
238 pia(p)->crb |= PIA_DDR; in mfc3_restore_state()
239 pia(p)->ppra = s->u.amiga.status; in mfc3_restore_state()
240 pia(p)->cra &= ~PIA_DDR; in mfc3_restore_state()
241 pia(p)->pddrb = s->u.amiga.statusdir; in mfc3_restore_state()
242 pia(p)->cra |= PIA_DDR; in mfc3_restore_state()
281 /* ----------- Initialisation code --------------------------------- */
283 static int __init parport_mfc3_init(void) in parport_mfc3_init()
286 int pias = 0; in parport_mfc3_init()
291 return -ENODEV; in parport_mfc3_init()
294 unsigned long piabase = z->resource.start+PIABASE; in parport_mfc3_init()
299 pp->crb = 0; in parport_mfc3_init()
300 pp->pddrb = 255; /* all data pins output */ in parport_mfc3_init()
301 pp->crb = PIA_DDR|32|8; in parport_mfc3_init()
302 dummy = pp->pddrb; /* reading clears interrupt */ in parport_mfc3_init()
303 pp->cra = 0; in parport_mfc3_init()
304 pp->pddra = 0xe0; /* /RESET, /DIR ,/AUTO-FEED output */ in parport_mfc3_init()
305 pp->cra = PIA_DDR; in parport_mfc3_init()
306 pp->ppra = 0; /* reset printer */ in parport_mfc3_init()
308 pp->ppra = 128; in parport_mfc3_init()
314 if (p->irq != PARPORT_IRQ_NONE) { in parport_mfc3_init()
316 if (request_irq(IRQ_AMIGA_PORTS, mfc3_interrupt, IRQF_SHARED, p->name, &pp_mfc3_ops)) in parport_mfc3_init()
319 p->dev = &z->dev; in parport_mfc3_init()
322 pr_info("%s: Multiface III port using irq\n", p->name); in parport_mfc3_init()
325 p->private_data = (void *)piabase; in parport_mfc3_init()
338 return pias ? 0 : -ENODEV; in parport_mfc3_init()
343 int i; in parport_mfc3_exit()
349 if (this_port[i]->irq != PARPORT_IRQ_NONE) { in parport_mfc3_exit()
350 if (--use_cnt == 0) in parport_mfc3_exit()
353 release_mem_region(ZTWO_PADDR(this_port[i]->private_data), sizeof(struct pia)); in parport_mfc3_exit()