18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * arch/arch/mach-ixp4xx/gateway7001-pci.c 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * PCI setup routines for Gateway 7001 68c2ecf20Sopenharmony_ci * 78c2ecf20Sopenharmony_ci * Copyright (C) 2007 Imre Kaloz <kaloz@openwrt.org> 88c2ecf20Sopenharmony_ci * 98c2ecf20Sopenharmony_ci * based on coyote-pci.c: 108c2ecf20Sopenharmony_ci * Copyright (C) 2002 Jungo Software Technologies. 118c2ecf20Sopenharmony_ci * Copyright (C) 2003 MontaVista Softwrae, Inc. 128c2ecf20Sopenharmony_ci * 138c2ecf20Sopenharmony_ci * Maintainer: Imre Kaloz <kaloz@openwrt.org> 148c2ecf20Sopenharmony_ci */ 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ci#include <linux/kernel.h> 178c2ecf20Sopenharmony_ci#include <linux/pci.h> 188c2ecf20Sopenharmony_ci#include <linux/init.h> 198c2ecf20Sopenharmony_ci#include <linux/irq.h> 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_ci#include <asm/mach-types.h> 228c2ecf20Sopenharmony_ci#include <mach/hardware.h> 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ci#include <asm/mach/pci.h> 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ci#include "irqs.h" 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_civoid __init gateway7001_pci_preinit(void) 298c2ecf20Sopenharmony_ci{ 308c2ecf20Sopenharmony_ci irq_set_irq_type(IRQ_IXP4XX_GPIO10, IRQ_TYPE_LEVEL_LOW); 318c2ecf20Sopenharmony_ci irq_set_irq_type(IRQ_IXP4XX_GPIO11, IRQ_TYPE_LEVEL_LOW); 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ci ixp4xx_pci_preinit(); 348c2ecf20Sopenharmony_ci} 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_cistatic int __init gateway7001_map_irq(const struct pci_dev *dev, u8 slot, 378c2ecf20Sopenharmony_ci u8 pin) 388c2ecf20Sopenharmony_ci{ 398c2ecf20Sopenharmony_ci if (slot == 1) 408c2ecf20Sopenharmony_ci return IRQ_IXP4XX_GPIO11; 418c2ecf20Sopenharmony_ci else if (slot == 2) 428c2ecf20Sopenharmony_ci return IRQ_IXP4XX_GPIO10; 438c2ecf20Sopenharmony_ci else return -1; 448c2ecf20Sopenharmony_ci} 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_cistruct hw_pci gateway7001_pci __initdata = { 478c2ecf20Sopenharmony_ci .nr_controllers = 1, 488c2ecf20Sopenharmony_ci .ops = &ixp4xx_ops, 498c2ecf20Sopenharmony_ci .preinit = gateway7001_pci_preinit, 508c2ecf20Sopenharmony_ci .setup = ixp4xx_setup, 518c2ecf20Sopenharmony_ci .map_irq = gateway7001_map_irq, 528c2ecf20Sopenharmony_ci}; 538c2ecf20Sopenharmony_ci 548c2ecf20Sopenharmony_ciint __init gateway7001_pci_init(void) 558c2ecf20Sopenharmony_ci{ 568c2ecf20Sopenharmony_ci if (machine_is_gateway7001()) 578c2ecf20Sopenharmony_ci pci_common_init(&gateway7001_pci); 588c2ecf20Sopenharmony_ci return 0; 598c2ecf20Sopenharmony_ci} 608c2ecf20Sopenharmony_ci 618c2ecf20Sopenharmony_cisubsys_initcall(gateway7001_pci_init); 62