Pull button into test branch
[linux-drm-fsl-dcu.git] / arch / arm / mach-iop13xx / iq81340mc.c
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
21 #include <asm/hardware.h>
22 #include <asm/irq.h>
23 #include <asm/mach/pci.h>
24 #include <asm/mach-types.h>
25 #include <asm/mach/arch.h>
26 #include <asm/arch/pci.h>
27 #include <asm/mach/time.h>
28
29 extern int init_atu; /* Flag to select which ATU(s) to initialize / disable */
30
31 static int __init
32 iq81340mc_pcix_map_irq(struct pci_dev *dev, u8 idsel, u8 pin)
33 {
34         switch (idsel) {
35         case 1:
36                 switch (pin) {
37                 case 1: return ATUX_INTB;
38                 case 2: return ATUX_INTC;
39                 case 3: return ATUX_INTD;
40                 case 4: return ATUX_INTA;
41                 default: return -1;
42                 }
43         case 2:
44                 switch (pin) {
45                 case 1: return ATUX_INTC;
46                 case 2: return ATUX_INTD;
47                 case 3: return ATUX_INTC;
48                 case 4: return ATUX_INTD;
49                 default: return -1;
50                 }
51         default: return -1;
52         }
53 }
54
55 static struct hw_pci iq81340mc_pci __initdata = {
56         .swizzle        = pci_std_swizzle,
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();
77 }
78
79 static void __init iq81340mc_timer_init(void)
80 {
81         iop13xx_init_time(400000000);
82 }
83
84 static struct sys_timer iq81340mc_timer = {
85        .init       = iq81340mc_timer_init,
86        .offset     = iop13xx_gettimeoffset,
87 };
88
89 MACHINE_START(IQ81340MC, "Intel IQ81340MC")
90         /* Maintainer: Dan Williams <dan.j.williams@intel.com> */
91         .phys_io        = PHYS_IO,
92         .io_pg_offst    = IO_PG_OFFSET,
93         .map_io         = iop13xx_map_io,
94         .init_irq       = iop13xx_init_irq,
95         .timer          = &iq81340mc_timer,
96         .boot_params    = BOOT_PARAM_OFFSET,
97         .init_machine   = iq81340mc_init,
98 MACHINE_END