Dan Williams | 285f5fa | 2006-12-07 02:59:39 +0100 | [diff] [blame] | 1 | /* |
| 2 | * iq81340mc board support |
| 3 | * Copyright (c) 2005-2006, Intel Corporation. |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify it |
| 6 | * under the terms and conditions of the GNU General Public License, |
| 7 | * version 2, as published by the Free Software Foundation. |
| 8 | * |
| 9 | * This program is distributed in the hope it will be useful, but WITHOUT |
| 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
| 12 | * more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License along with |
| 15 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple |
| 16 | * Place - Suite 330, Boston, MA 02111-1307 USA. |
| 17 | * |
| 18 | */ |
| 19 | #include <linux/pci.h> |
| 20 | |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 21 | #include <mach/hardware.h> |
Dan Williams | 285f5fa | 2006-12-07 02:59:39 +0100 | [diff] [blame] | 22 | #include <asm/irq.h> |
| 23 | #include <asm/mach/pci.h> |
| 24 | #include <asm/mach-types.h> |
| 25 | #include <asm/mach/arch.h> |
Arnd Bergmann | c11fc34 | 2015-01-30 10:45:33 +0100 | [diff] [blame] | 26 | #include "pci.h" |
Dan Williams | 285f5fa | 2006-12-07 02:59:39 +0100 | [diff] [blame] | 27 | #include <asm/mach/time.h> |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 28 | #include <mach/time.h> |
Dan Williams | 285f5fa | 2006-12-07 02:59:39 +0100 | [diff] [blame] | 29 | |
| 30 | extern int init_atu; /* Flag to select which ATU(s) to initialize / disable */ |
| 31 | |
| 32 | static int __init |
Ralf Baechle | d534194 | 2011-06-10 15:30:21 +0100 | [diff] [blame] | 33 | iq81340mc_pcix_map_irq(const struct pci_dev *dev, u8 idsel, u8 pin) |
Dan Williams | 285f5fa | 2006-12-07 02:59:39 +0100 | [diff] [blame] | 34 | { |
| 35 | switch (idsel) { |
| 36 | case 1: |
| 37 | switch (pin) { |
| 38 | case 1: return ATUX_INTB; |
| 39 | case 2: return ATUX_INTC; |
| 40 | case 3: return ATUX_INTD; |
| 41 | case 4: return ATUX_INTA; |
| 42 | default: return -1; |
| 43 | } |
| 44 | case 2: |
| 45 | switch (pin) { |
| 46 | case 1: return ATUX_INTC; |
| 47 | case 2: return ATUX_INTD; |
| 48 | case 3: return ATUX_INTC; |
| 49 | case 4: return ATUX_INTD; |
| 50 | default: return -1; |
| 51 | } |
| 52 | default: return -1; |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | static struct hw_pci iq81340mc_pci __initdata = { |
Dan Williams | 285f5fa | 2006-12-07 02:59:39 +0100 | [diff] [blame] | 57 | .nr_controllers = 0, |
| 58 | .setup = iop13xx_pci_setup, |
| 59 | .map_irq = iq81340mc_pcix_map_irq, |
| 60 | .scan = iop13xx_scan_bus, |
| 61 | .preinit = iop13xx_pci_init, |
| 62 | }; |
| 63 | |
| 64 | static int __init iq81340mc_pci_init(void) |
| 65 | { |
| 66 | iop13xx_atu_select(&iq81340mc_pci); |
| 67 | pci_common_init(&iq81340mc_pci); |
| 68 | iop13xx_map_pci_memory(); |
| 69 | |
| 70 | return 0; |
| 71 | } |
| 72 | |
| 73 | static void __init iq81340mc_init(void) |
| 74 | { |
| 75 | iop13xx_platform_init(); |
| 76 | iq81340mc_pci_init(); |
Dan Williams | d2dd8b1 | 2007-05-02 17:47:47 +0100 | [diff] [blame] | 77 | iop13xx_add_tpmi_devices(); |
Dan Williams | 285f5fa | 2006-12-07 02:59:39 +0100 | [diff] [blame] | 78 | } |
| 79 | |
| 80 | static void __init iq81340mc_timer_init(void) |
| 81 | { |
Dan Williams | 84c981f | 2007-04-29 09:32:51 +0100 | [diff] [blame] | 82 | unsigned long bus_freq = iop13xx_core_freq() / iop13xx_xsi_bus_ratio(); |
Harvey Harrison | 8e86f42 | 2008-03-04 15:08:02 -0800 | [diff] [blame] | 83 | printk(KERN_DEBUG "%s: bus frequency: %lu\n", __func__, bus_freq); |
Dan Williams | 84c981f | 2007-04-29 09:32:51 +0100 | [diff] [blame] | 84 | iop_init_time(bus_freq); |
Dan Williams | 285f5fa | 2006-12-07 02:59:39 +0100 | [diff] [blame] | 85 | } |
| 86 | |
Dan Williams | 285f5fa | 2006-12-07 02:59:39 +0100 | [diff] [blame] | 87 | MACHINE_START(IQ81340MC, "Intel IQ81340MC") |
| 88 | /* Maintainer: Dan Williams <dan.j.williams@intel.com> */ |
Nicolas Pitre | d304c54 | 2011-07-05 22:38:12 -0400 | [diff] [blame] | 89 | .atag_offset = 0x100, |
Rob Herring | 1dfe34a | 2012-02-29 10:56:15 -0600 | [diff] [blame] | 90 | .init_early = iop13xx_init_early, |
Dan Williams | 285f5fa | 2006-12-07 02:59:39 +0100 | [diff] [blame] | 91 | .map_io = iop13xx_map_io, |
| 92 | .init_irq = iop13xx_init_irq, |
Stephen Warren | 6bb27d7 | 2012-11-08 12:40:59 -0700 | [diff] [blame] | 93 | .init_time = iq81340mc_timer_init, |
Dan Williams | 285f5fa | 2006-12-07 02:59:39 +0100 | [diff] [blame] | 94 | .init_machine = iq81340mc_init, |
Russell King | 00aa78e | 2011-11-06 10:49:50 +0000 | [diff] [blame] | 95 | .restart = iop13xx_restart, |
Thomas Gleixner | 37ebbcf | 2014-05-07 15:44:04 +0000 | [diff] [blame] | 96 | .nr_irqs = NR_IOP13XX_IRQS, |
Dan Williams | 285f5fa | 2006-12-07 02:59:39 +0100 | [diff] [blame] | 97 | MACHINE_END |