18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * arch/arm/mach-ixp4xx/coyote-pci.c 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * PCI setup routines for ADI Engineering Coyote platform 68c2ecf20Sopenharmony_ci * 78c2ecf20Sopenharmony_ci * Copyright (C) 2002 Jungo Software Technologies. 88c2ecf20Sopenharmony_ci * Copyright (C) 2003 MontaVista Softwrae, Inc. 98c2ecf20Sopenharmony_ci * 108c2ecf20Sopenharmony_ci * Maintainer: Deepak Saxena <dsaxena@mvista.com> 118c2ecf20Sopenharmony_ci */ 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci#include <linux/kernel.h> 148c2ecf20Sopenharmony_ci#include <linux/pci.h> 158c2ecf20Sopenharmony_ci#include <linux/init.h> 168c2ecf20Sopenharmony_ci#include <linux/irq.h> 178c2ecf20Sopenharmony_ci#include <asm/mach-types.h> 188c2ecf20Sopenharmony_ci#include <mach/hardware.h> 198c2ecf20Sopenharmony_ci#include <asm/irq.h> 208c2ecf20Sopenharmony_ci#include <asm/mach/pci.h> 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ci#include "irqs.h" 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ci#define SLOT0_DEVID 14 258c2ecf20Sopenharmony_ci#define SLOT1_DEVID 15 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci/* PCI controller GPIO to IRQ pin mappings */ 288c2ecf20Sopenharmony_ci#define SLOT0_INTA 6 298c2ecf20Sopenharmony_ci#define SLOT1_INTA 11 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_civoid __init coyote_pci_preinit(void) 328c2ecf20Sopenharmony_ci{ 338c2ecf20Sopenharmony_ci irq_set_irq_type(IXP4XX_GPIO_IRQ(SLOT0_INTA), IRQ_TYPE_LEVEL_LOW); 348c2ecf20Sopenharmony_ci irq_set_irq_type(IXP4XX_GPIO_IRQ(SLOT1_INTA), IRQ_TYPE_LEVEL_LOW); 358c2ecf20Sopenharmony_ci ixp4xx_pci_preinit(); 368c2ecf20Sopenharmony_ci} 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_cistatic int __init coyote_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) 398c2ecf20Sopenharmony_ci{ 408c2ecf20Sopenharmony_ci if (slot == SLOT0_DEVID) 418c2ecf20Sopenharmony_ci return IXP4XX_GPIO_IRQ(SLOT0_INTA); 428c2ecf20Sopenharmony_ci else if (slot == SLOT1_DEVID) 438c2ecf20Sopenharmony_ci return IXP4XX_GPIO_IRQ(SLOT1_INTA); 448c2ecf20Sopenharmony_ci else return -1; 458c2ecf20Sopenharmony_ci} 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_cistruct hw_pci coyote_pci __initdata = { 488c2ecf20Sopenharmony_ci .nr_controllers = 1, 498c2ecf20Sopenharmony_ci .ops = &ixp4xx_ops, 508c2ecf20Sopenharmony_ci .preinit = coyote_pci_preinit, 518c2ecf20Sopenharmony_ci .setup = ixp4xx_setup, 528c2ecf20Sopenharmony_ci .map_irq = coyote_map_irq, 538c2ecf20Sopenharmony_ci}; 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_ciint __init coyote_pci_init(void) 568c2ecf20Sopenharmony_ci{ 578c2ecf20Sopenharmony_ci if (machine_is_adi_coyote()) 588c2ecf20Sopenharmony_ci pci_common_init(&coyote_pci); 598c2ecf20Sopenharmony_ci return 0; 608c2ecf20Sopenharmony_ci} 618c2ecf20Sopenharmony_ci 628c2ecf20Sopenharmony_cisubsys_initcall(coyote_pci_init); 63