Lines Matching refs:port

2  * IEEE 1284.3 Parallel port daisy chain and multiplexor code
12 * 31-01-1999: Make port-cloning transparent.
41 struct parport *port;
50 static int mux_present(struct parport *port);
51 static int num_mux_ports(struct parport *port);
52 static int select_port(struct parport *port);
53 static int assign_addrs(struct parport *port);
56 static void add_dev(int devnum, struct parport *port, int daisy)
61 newdev->port = port;
90 /* Discover the IEEE1284.3 topology on a port -- muxes and daisy chains.
92 int parport_daisy_init(struct parport *port)
105 /* If mux present on normal port, need to create new
106 * parports for each extra port. */
107 if (port->muxport < 0 && mux_present(port) &&
109 ((num_ports = num_mux_ports(port)) == 2 || num_ports == 4)) {
110 /* Leave original as port zero. */
111 port->muxport = 0;
113 "%s: 1st (default) port of %d-way multiplexor\n",
114 port->name, num_ports);
116 /* Clone the port. */
117 struct parport *extra = clone_parport(port, i);
127 "%s: %d%s port of %d-way multiplexor on %s\n",
129 port->name);
131 /* Analyse that port too. We won't recurse
132 forever because of the 'port->muxport < 0'
138 if (port->muxport >= 0)
139 select_port(port);
141 parport_daisy_deselect_all(port);
142 detected += assign_addrs(port);
145 add_dev(numdevs++, port, -1);
160 parport_daisy_fini(port);
161 parport_write_control(port, PARPORT_CONTROL_SELECT);
163 parport_write_control(port,
174 /* Forget about devices on a physical port. */
175 void parport_daisy_fini(struct parport *port)
183 if (dev->port != port) {
205 * that it locates a device by its number rather than by the port
216 struct parport *port;
230 port = parport_get_port(p->port);
233 dev = parport_register_device(port, name, NULL, NULL, NULL, 0, NULL);
234 parport_put_port(port);
244 selected = port->daisy;
271 static int cpp_daisy(struct parport *port, int cmd)
275 parport_data_forward(port);
276 parport_write_data(port, 0xaa); udelay(2);
277 parport_write_data(port, 0x55); udelay(2);
278 parport_write_data(port, 0x00); udelay(2);
279 parport_write_data(port, 0xff); udelay(2);
280 s = parport_read_status(port) & (PARPORT_STATUS_BUSY
289 port->name, s);
293 parport_write_data(port, 0x87); udelay(2);
294 s = parport_read_status(port) & (PARPORT_STATUS_BUSY
300 port->name, s);
304 parport_write_data(port, 0x78); udelay(2);
305 parport_write_data(port, cmd); udelay(2);
306 parport_frob_control(port,
310 s = parport_read_status(port);
311 parport_frob_control(port, PARPORT_CONTROL_STROBE, 0);
313 parport_write_data(port, 0xff); udelay(2);
319 static int cpp_mux(struct parport *port, int cmd)
324 parport_data_forward(port);
325 parport_write_data(port, 0xaa); udelay(2);
326 parport_write_data(port, 0x55); udelay(2);
327 parport_write_data(port, 0xf0); udelay(2);
328 parport_write_data(port, 0x0f); udelay(2);
329 parport_write_data(port, 0x52); udelay(2);
330 parport_write_data(port, 0xad); udelay(2);
331 parport_write_data(port, cmd); udelay(2);
333 s = parport_read_status(port);
336 port->name, cmd, s);
348 void parport_daisy_deselect_all(struct parport *port)
350 cpp_daisy(port, 0x30);
353 int parport_daisy_select(struct parport *port, int daisy, int mode)
361 return !(cpp_daisy(port, 0x20 + daisy) &
368 return !(cpp_daisy(port, 0xd0 + daisy) &
379 return !(cpp_daisy(port, 0xe0 + daisy) &
384 static int mux_present(struct parport *port)
386 return cpp_mux(port, 0x51) == 3;
389 static int num_mux_ports(struct parport *port)
391 return cpp_mux(port, 0x58);
394 static int select_port(struct parport *port)
396 int muxport = port->muxport;
397 return cpp_mux(port, 0x60 + muxport) == muxport;
400 static int assign_addrs(struct parport *port)
408 parport_data_forward(port);
409 parport_write_data(port, 0xaa); udelay(2);
410 parport_write_data(port, 0x55); udelay(2);
411 parport_write_data(port, 0x00); udelay(2);
412 parport_write_data(port, 0xff); udelay(2);
413 s = parport_read_status(port) & (PARPORT_STATUS_BUSY
422 port->name, s);
426 parport_write_data(port, 0x87); udelay(2);
427 s = parport_read_status(port) & (PARPORT_STATUS_BUSY
433 port->name, s);
437 parport_write_data(port, 0x78); udelay(2);
438 s = parport_read_status(port);
445 parport_write_data(port, daisy);
447 parport_frob_control(port,
451 parport_frob_control(port, PARPORT_CONTROL_STROBE, 0);
454 add_dev(numdevs++, port, daisy);
465 s = parport_read_status(port);
468 parport_write_data(port, 0xff); udelay(2);
470 DPRINTK(KERN_DEBUG "%s: Found %d daisy-chained devices\n", port->name,