Imre Kaloz | 46918bd | 2007-06-02 15:44:08 +0100 | [diff] [blame] | 1 | /* |
| 2 | * arch/arch/mach-ixp4xx/gateway7001-pci.c |
| 3 | * |
| 4 | * PCI setup routines for Gateway 7001 |
| 5 | * |
| 6 | * Copyright (C) 2007 Imre Kaloz <kaloz@openwrt.org> |
| 7 | * |
| 8 | * based on coyote-pci.c: |
| 9 | * Copyright (C) 2002 Jungo Software Technologies. |
| 10 | * Copyright (C) 2003 MontaVista Softwrae, Inc. |
| 11 | * |
| 12 | * Maintainer: Imre Kaloz <kaloz@openwrt.org> |
| 13 | * |
| 14 | * This program is free software; you can redistribute it and/or modify |
| 15 | * it under the terms of the GNU General Public License version 2 as |
| 16 | * published by the Free Software Foundation. |
| 17 | * |
| 18 | */ |
| 19 | |
| 20 | #include <linux/kernel.h> |
| 21 | #include <linux/pci.h> |
| 22 | #include <linux/init.h> |
| 23 | #include <linux/irq.h> |
| 24 | |
| 25 | #include <asm/mach-types.h> |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 26 | #include <mach/hardware.h> |
Imre Kaloz | 46918bd | 2007-06-02 15:44:08 +0100 | [diff] [blame] | 27 | |
| 28 | #include <asm/mach/pci.h> |
| 29 | |
| 30 | void __init gateway7001_pci_preinit(void) |
| 31 | { |
Thomas Gleixner | 6845664a | 2011-03-24 13:25:22 +0100 | [diff] [blame] | 32 | irq_set_irq_type(IRQ_IXP4XX_GPIO10, IRQ_TYPE_LEVEL_LOW); |
| 33 | irq_set_irq_type(IRQ_IXP4XX_GPIO11, IRQ_TYPE_LEVEL_LOW); |
Imre Kaloz | 46918bd | 2007-06-02 15:44:08 +0100 | [diff] [blame] | 34 | |
| 35 | ixp4xx_pci_preinit(); |
| 36 | } |
| 37 | |
Ralf Baechle | d534194 | 2011-06-10 15:30:21 +0100 | [diff] [blame] | 38 | static int __init gateway7001_map_irq(const struct pci_dev *dev, u8 slot, |
| 39 | u8 pin) |
Imre Kaloz | 46918bd | 2007-06-02 15:44:08 +0100 | [diff] [blame] | 40 | { |
| 41 | if (slot == 1) |
| 42 | return IRQ_IXP4XX_GPIO11; |
| 43 | else if (slot == 2) |
| 44 | return IRQ_IXP4XX_GPIO10; |
| 45 | else return -1; |
| 46 | } |
| 47 | |
| 48 | struct hw_pci gateway7001_pci __initdata = { |
| 49 | .nr_controllers = 1, |
Russell King | c23bfc3 | 2012-03-10 12:49:16 +0000 | [diff] [blame] | 50 | .ops = &ixp4xx_ops, |
Imre Kaloz | 46918bd | 2007-06-02 15:44:08 +0100 | [diff] [blame] | 51 | .preinit = gateway7001_pci_preinit, |
Imre Kaloz | 46918bd | 2007-06-02 15:44:08 +0100 | [diff] [blame] | 52 | .setup = ixp4xx_setup, |
Imre Kaloz | 46918bd | 2007-06-02 15:44:08 +0100 | [diff] [blame] | 53 | .map_irq = gateway7001_map_irq, |
| 54 | }; |
| 55 | |
| 56 | int __init gateway7001_pci_init(void) |
| 57 | { |
| 58 | if (machine_is_gateway7001()) |
| 59 | pci_common_init(&gateway7001_pci); |
| 60 | return 0; |
| 61 | } |
| 62 | |
| 63 | subsys_initcall(gateway7001_pci_init); |