18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * arch/arch/mach-ixp4xx/vulcan-pci.c 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Vulcan board-level PCI initialization 68c2ecf20Sopenharmony_ci * 78c2ecf20Sopenharmony_ci * Copyright (C) 2010 Marc Zyngier <maz@misterjones.org> 88c2ecf20Sopenharmony_ci * 98c2ecf20Sopenharmony_ci * based on ixdp425-pci.c: 108c2ecf20Sopenharmony_ci * Copyright (C) 2002 Intel Corporation. 118c2ecf20Sopenharmony_ci * Copyright (C) 2003-2004 MontaVista Software, Inc. 128c2ecf20Sopenharmony_ci */ 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ci#include <linux/pci.h> 158c2ecf20Sopenharmony_ci#include <linux/init.h> 168c2ecf20Sopenharmony_ci#include <linux/irq.h> 178c2ecf20Sopenharmony_ci#include <asm/mach/pci.h> 188c2ecf20Sopenharmony_ci#include <asm/mach-types.h> 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci#include "irqs.h" 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ci/* PCI controller GPIO to IRQ pin mappings */ 238c2ecf20Sopenharmony_ci#define INTA 2 248c2ecf20Sopenharmony_ci#define INTB 3 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_civoid __init vulcan_pci_preinit(void) 278c2ecf20Sopenharmony_ci{ 288c2ecf20Sopenharmony_ci#ifndef CONFIG_IXP4XX_INDIRECT_PCI 298c2ecf20Sopenharmony_ci /* 308c2ecf20Sopenharmony_ci * Cardbus bridge wants way more than the SoC can actually offer, 318c2ecf20Sopenharmony_ci * and leaves the whole PCI bus in a mess. Artificially limit it 328c2ecf20Sopenharmony_ci * to 8MB per region. Of course indirect mode doesn't have this 338c2ecf20Sopenharmony_ci * limitation... 348c2ecf20Sopenharmony_ci */ 358c2ecf20Sopenharmony_ci pci_cardbus_mem_size = SZ_8M; 368c2ecf20Sopenharmony_ci pr_info("Vulcan PCI: limiting CardBus memory size to %dMB\n", 378c2ecf20Sopenharmony_ci (int)(pci_cardbus_mem_size >> 20)); 388c2ecf20Sopenharmony_ci#endif 398c2ecf20Sopenharmony_ci irq_set_irq_type(IXP4XX_GPIO_IRQ(INTA), IRQ_TYPE_LEVEL_LOW); 408c2ecf20Sopenharmony_ci irq_set_irq_type(IXP4XX_GPIO_IRQ(INTB), IRQ_TYPE_LEVEL_LOW); 418c2ecf20Sopenharmony_ci ixp4xx_pci_preinit(); 428c2ecf20Sopenharmony_ci} 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_cistatic int __init vulcan_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) 458c2ecf20Sopenharmony_ci{ 468c2ecf20Sopenharmony_ci if (slot == 1) 478c2ecf20Sopenharmony_ci return IXP4XX_GPIO_IRQ(INTA); 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_ci if (slot == 2) 508c2ecf20Sopenharmony_ci return IXP4XX_GPIO_IRQ(INTB); 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_ci return -1; 538c2ecf20Sopenharmony_ci} 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_cistruct hw_pci vulcan_pci __initdata = { 568c2ecf20Sopenharmony_ci .nr_controllers = 1, 578c2ecf20Sopenharmony_ci .ops = &ixp4xx_ops, 588c2ecf20Sopenharmony_ci .preinit = vulcan_pci_preinit, 598c2ecf20Sopenharmony_ci .setup = ixp4xx_setup, 608c2ecf20Sopenharmony_ci .map_irq = vulcan_map_irq, 618c2ecf20Sopenharmony_ci}; 628c2ecf20Sopenharmony_ci 638c2ecf20Sopenharmony_ciint __init vulcan_pci_init(void) 648c2ecf20Sopenharmony_ci{ 658c2ecf20Sopenharmony_ci if (machine_is_arcom_vulcan()) 668c2ecf20Sopenharmony_ci pci_common_init(&vulcan_pci); 678c2ecf20Sopenharmony_ci return 0; 688c2ecf20Sopenharmony_ci} 698c2ecf20Sopenharmony_ci 708c2ecf20Sopenharmony_cisubsys_initcall(vulcan_pci_init); 71