18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * arch/arm/mach-ixp4xx/ixdpg425-pci.c
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * PCI setup routines for Intel IXDPG425 Platform
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * Copyright (C) 2004 MontaVista Softwrae, Inc.
88c2ecf20Sopenharmony_ci *
98c2ecf20Sopenharmony_ci * Maintainer: Deepak Saxena <dsaxena@plexity.net>
108c2ecf20Sopenharmony_ci */
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#include <linux/kernel.h>
138c2ecf20Sopenharmony_ci#include <linux/pci.h>
148c2ecf20Sopenharmony_ci#include <linux/init.h>
158c2ecf20Sopenharmony_ci#include <linux/irq.h>
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci#include <asm/mach-types.h>
188c2ecf20Sopenharmony_ci#include <mach/hardware.h>
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci#include <asm/mach/pci.h>
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci#include "irqs.h"
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_civoid __init ixdpg425_pci_preinit(void)
258c2ecf20Sopenharmony_ci{
268c2ecf20Sopenharmony_ci	irq_set_irq_type(IRQ_IXP4XX_GPIO6, IRQ_TYPE_LEVEL_LOW);
278c2ecf20Sopenharmony_ci	irq_set_irq_type(IRQ_IXP4XX_GPIO7, IRQ_TYPE_LEVEL_LOW);
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci	ixp4xx_pci_preinit();
308c2ecf20Sopenharmony_ci}
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_cistatic int __init ixdpg425_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
338c2ecf20Sopenharmony_ci{
348c2ecf20Sopenharmony_ci	if (slot == 12 || slot == 13)
358c2ecf20Sopenharmony_ci		return IRQ_IXP4XX_GPIO7;
368c2ecf20Sopenharmony_ci	else if (slot == 14)
378c2ecf20Sopenharmony_ci		return IRQ_IXP4XX_GPIO6;
388c2ecf20Sopenharmony_ci	else return -1;
398c2ecf20Sopenharmony_ci}
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_cistruct hw_pci ixdpg425_pci __initdata = {
428c2ecf20Sopenharmony_ci	.nr_controllers = 1,
438c2ecf20Sopenharmony_ci	.ops		= &ixp4xx_ops,
448c2ecf20Sopenharmony_ci	.preinit =        ixdpg425_pci_preinit,
458c2ecf20Sopenharmony_ci	.setup =          ixp4xx_setup,
468c2ecf20Sopenharmony_ci	.map_irq =        ixdpg425_map_irq,
478c2ecf20Sopenharmony_ci};
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ciint __init ixdpg425_pci_init(void)
508c2ecf20Sopenharmony_ci{
518c2ecf20Sopenharmony_ci	if (machine_is_ixdpg425())
528c2ecf20Sopenharmony_ci		pci_common_init(&ixdpg425_pci);
538c2ecf20Sopenharmony_ci	return 0;
548c2ecf20Sopenharmony_ci}
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_cisubsys_initcall(ixdpg425_pci_init);
57