xref: /openbmc/linux/arch/powerpc/include/asm/parport.h (revision fb960bd2)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * parport.h: platform-specific PC-style parport initialisation
4  *
5  * Copyright (C) 1999, 2000  Tim Waugh <tim@cyberelk.demon.co.uk>
6  *
7  * This file should only be included by drivers/parport/parport_pc.c.
8  */
9 
10 #ifndef _ASM_POWERPC_PARPORT_H
11 #define _ASM_POWERPC_PARPORT_H
12 #ifdef __KERNEL__
13 
14 #include <asm/prom.h>
15 
16 static int parport_pc_find_nonpci_ports (int autoirq, int autodma)
17 {
18 	struct device_node *np;
19 	const u32 *prop;
20 	u32 io1, io2;
21 	int propsize;
22 	int count = 0;
23 	int virq;
24 
25 	for_each_compatible_node(np, "parallel", "pnpPNP,400") {
26 		prop = of_get_property(np, "reg", &propsize);
27 		if (!prop || propsize > 6*sizeof(u32))
28 			continue;
29 		io1 = prop[1]; io2 = prop[2];
30 
31 		virq = irq_of_parse_and_map(np, 0);
32 		if (!virq)
33 			continue;
34 
35 		if (parport_pc_probe_port(io1, io2, virq, autodma, NULL, 0)
36 				!= NULL)
37 			count++;
38 	}
39 	return count;
40 }
41 
42 #endif /* __KERNEL__ */
43 #endif /* !(_ASM_POWERPC_PARPORT_H) */
44