18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * parport.h: platform-specific PC-style parport initialisation
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (C) 1999, 2000  Tim Waugh <tim@cyberelk.demon.co.uk>
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * This file should only be included by drivers/parport/parport_pc.c.
88c2ecf20Sopenharmony_ci */
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#ifndef _ASM_POWERPC_PARPORT_H
118c2ecf20Sopenharmony_ci#define _ASM_POWERPC_PARPORT_H
128c2ecf20Sopenharmony_ci#ifdef __KERNEL__
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci#include <asm/prom.h>
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_cistatic int parport_pc_find_nonpci_ports (int autoirq, int autodma)
178c2ecf20Sopenharmony_ci{
188c2ecf20Sopenharmony_ci	struct device_node *np;
198c2ecf20Sopenharmony_ci	const u32 *prop;
208c2ecf20Sopenharmony_ci	u32 io1, io2;
218c2ecf20Sopenharmony_ci	int propsize;
228c2ecf20Sopenharmony_ci	int count = 0;
238c2ecf20Sopenharmony_ci	int virq;
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci	for_each_compatible_node(np, "parallel", "pnpPNP,400") {
268c2ecf20Sopenharmony_ci		prop = of_get_property(np, "reg", &propsize);
278c2ecf20Sopenharmony_ci		if (!prop || propsize > 6*sizeof(u32))
288c2ecf20Sopenharmony_ci			continue;
298c2ecf20Sopenharmony_ci		io1 = prop[1]; io2 = prop[2];
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci		virq = irq_of_parse_and_map(np, 0);
328c2ecf20Sopenharmony_ci		if (!virq)
338c2ecf20Sopenharmony_ci			continue;
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci		if (parport_pc_probe_port(io1, io2, virq, autodma, NULL, 0)
368c2ecf20Sopenharmony_ci				!= NULL)
378c2ecf20Sopenharmony_ci			count++;
388c2ecf20Sopenharmony_ci	}
398c2ecf20Sopenharmony_ci	return count;
408c2ecf20Sopenharmony_ci}
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ci#endif /* __KERNEL__ */
438c2ecf20Sopenharmony_ci#endif /* !(_ASM_POWERPC_PARPORT_H) */
44