forked from Minki/linux
12679a2d7e
Pull more ARM updates from Russell King. This got a fair number of conflicts with the <asm/system.h> split, but also with some other sparse-irq and header file include cleanups. They all looked pretty trivial, though. * 'for-linus' of git://git.linaro.org/people/rmk/linux-arm: (59 commits) ARM: fix Kconfig warning for HAVE_BPF_JIT ARM: 7361/1: provide XIP_VIRT_ADDR for no-MMU builds ARM: 7349/1: integrator: convert to sparse irqs ARM: 7259/3: net: JIT compiler for packet filters ARM: 7334/1: add jump label support ARM: 7333/2: jump label: detect %c support for ARM ARM: 7338/1: add support for early console output via semihosting ARM: use set_current_blocked() and block_sigmask() ARM: exec: remove redundant set_fs(USER_DS) ARM: 7332/1: extract out code patch function from kprobes ARM: 7331/1: extract out insn generation code from ftrace ARM: 7330/1: ftrace: use canonical Thumb-2 wide instruction format ARM: 7351/1: ftrace: remove useless memory checks ARM: 7316/1: kexec: EOI active and mask all interrupts in kexec crash path ARM: Versatile Express: add NO_IOPORT ARM: get rid of asm/irq.h in asm/prom.h ARM: 7319/1: Print debug info for SIGBUS in user faults ARM: 7318/1: gic: refactor irq_start assignment ARM: 7317/1: irq: avoid NULL check in for_each_irq_desc loop ARM: 7315/1: perf: add support for the Cortex-A7 PMU ...
125 lines
3.1 KiB
C
125 lines
3.1 KiB
C
/*
|
|
* linux/arch/arm/mach-integrator/pci-integrator.c
|
|
*
|
|
* Copyright (C) 1999 ARM Limited
|
|
* Copyright (C) 2000 Deep Blue Solutions Ltd
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
*
|
|
*
|
|
* PCI functions for Integrator
|
|
*/
|
|
#include <linux/kernel.h>
|
|
#include <linux/pci.h>
|
|
#include <linux/interrupt.h>
|
|
#include <linux/init.h>
|
|
|
|
#include <asm/mach/pci.h>
|
|
#include <asm/mach-types.h>
|
|
|
|
#include <mach/irqs.h>
|
|
|
|
/*
|
|
* A small note about bridges and interrupts. The DECchip 21050 (and
|
|
* later) adheres to the PCI-PCI bridge specification. This says that
|
|
* the interrupts on the other side of a bridge are swizzled in the
|
|
* following manner:
|
|
*
|
|
* Dev Interrupt Interrupt
|
|
* Pin on Pin on
|
|
* Device Connector
|
|
*
|
|
* 4 A A
|
|
* B B
|
|
* C C
|
|
* D D
|
|
*
|
|
* 5 A B
|
|
* B C
|
|
* C D
|
|
* D A
|
|
*
|
|
* 6 A C
|
|
* B D
|
|
* C A
|
|
* D B
|
|
*
|
|
* 7 A D
|
|
* B A
|
|
* C B
|
|
* D C
|
|
*
|
|
* Where A = pin 1, B = pin 2 and so on and pin=0 = default = A.
|
|
* Thus, each swizzle is ((pin-1) + (device#-4)) % 4
|
|
*/
|
|
|
|
/*
|
|
* This routine handles multiple bridges.
|
|
*/
|
|
static u8 __init integrator_swizzle(struct pci_dev *dev, u8 *pinp)
|
|
{
|
|
int pin = *pinp;
|
|
|
|
if (pin == 0)
|
|
pin = 1;
|
|
|
|
while (dev->bus->self) {
|
|
pin = pci_swizzle_interrupt_pin(dev, pin);
|
|
/*
|
|
* move up the chain of bridges, swizzling as we go.
|
|
*/
|
|
dev = dev->bus->self;
|
|
}
|
|
*pinp = pin;
|
|
|
|
return PCI_SLOT(dev->devfn);
|
|
}
|
|
|
|
static int irq_tab[4] __initdata = {
|
|
IRQ_AP_PCIINT0, IRQ_AP_PCIINT1, IRQ_AP_PCIINT2, IRQ_AP_PCIINT3
|
|
};
|
|
|
|
/*
|
|
* map the specified device/slot/pin to an IRQ. This works out such
|
|
* that slot 9 pin 1 is INT0, pin 2 is INT1, and slot 10 pin 1 is INT1.
|
|
*/
|
|
static int __init integrator_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
|
|
{
|
|
int intnr = ((slot - 9) + (pin - 1)) & 3;
|
|
|
|
return irq_tab[intnr];
|
|
}
|
|
|
|
extern void pci_v3_init(void *);
|
|
|
|
static struct hw_pci integrator_pci __initdata = {
|
|
.swizzle = integrator_swizzle,
|
|
.map_irq = integrator_map_irq,
|
|
.setup = pci_v3_setup,
|
|
.nr_controllers = 1,
|
|
.scan = pci_v3_scan_bus,
|
|
.preinit = pci_v3_preinit,
|
|
.postinit = pci_v3_postinit,
|
|
};
|
|
|
|
static int __init integrator_pci_init(void)
|
|
{
|
|
if (machine_is_integrator())
|
|
pci_common_init(&integrator_pci);
|
|
return 0;
|
|
}
|
|
|
|
subsys_initcall(integrator_pci_init);
|