Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
[deliverable/linux.git] / arch / arm / mach-iop32x / iq80321.c
CommitLineData
c680b77e
LB
1/*
2 * arch/arm/mach-iop32x/iq80321.c
3 *
4 * Board support code for the Intel IQ80321 platform.
5 *
6 * Author: Rory Bolt <rorybolt@pacbell.net>
7 * Copyright (C) 2002 Rory Bolt
8 * Copyright (C) 2004 Intel Corp.
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 */
15
16#include <linux/mm.h>
17#include <linux/init.h>
18#include <linux/kernel.h>
19#include <linux/pci.h>
20#include <linux/string.h>
c680b77e
LB
21#include <linux/serial_core.h>
22#include <linux/serial_8250.h>
23#include <linux/mtd/physmap.h>
24#include <linux/platform_device.h>
fced80c7 25#include <linux/io.h>
a09e64fb 26#include <mach/hardware.h>
c680b77e
LB
27#include <asm/irq.h>
28#include <asm/mach/arch.h>
29#include <asm/mach/map.h>
30#include <asm/mach/pci.h>
31#include <asm/mach/time.h>
32#include <asm/mach-types.h>
33#include <asm/page.h>
34#include <asm/pgtable.h>
a09e64fb 35#include <mach/time.h>
c680b77e
LB
36
37/*
38 * IQ80321 timer tick configuration.
39 */
40static void __init iq80321_timer_init(void)
41{
42 /* 33.333 MHz crystal. */
3668b45d 43 iop_init_time(200000000);
c680b77e
LB
44}
45
c680b77e
LB
46
47/*
48 * IQ80321 I/O.
49 */
50static struct map_desc iq80321_io_desc[] __initdata = {
51 { /* on-board devices */
52 .virtual = IQ80321_UART,
53 .pfn = __phys_to_pfn(IQ80321_UART),
54 .length = 0x00100000,
55 .type = MT_DEVICE,
56 },
57};
58
59void __init iq80321_map_io(void)
60{
61 iop3xx_map_io();
62 iotable_init(iq80321_io_desc, ARRAY_SIZE(iq80321_io_desc));
63}
64
65
66/*
67 * IQ80321 PCI.
68 */
d73d8011 69static int __init
d5341942 70iq80321_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
c680b77e
LB
71{
72 int irq;
73
74 if ((slot == 2 || slot == 6) && pin == 1) {
75 /* PCI-X Slot INTA */
c852ac80 76 irq = IRQ_IOP32X_XINT2;
c680b77e
LB
77 } else if ((slot == 2 || slot == 6) && pin == 2) {
78 /* PCI-X Slot INTA */
c852ac80 79 irq = IRQ_IOP32X_XINT3;
c680b77e
LB
80 } else if ((slot == 2 || slot == 6) && pin == 3) {
81 /* PCI-X Slot INTA */
c852ac80 82 irq = IRQ_IOP32X_XINT0;
c680b77e
LB
83 } else if ((slot == 2 || slot == 6) && pin == 4) {
84 /* PCI-X Slot INTA */
c852ac80 85 irq = IRQ_IOP32X_XINT1;
c680b77e
LB
86 } else if (slot == 4 || slot == 8) {
87 /* Gig-E */
c852ac80 88 irq = IRQ_IOP32X_XINT0;
c680b77e
LB
89 } else {
90 printk(KERN_ERR "iq80321_pci_map_irq() called for unknown "
91 "device PCI:%d:%d:%d\n", dev->bus->number,
92 PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn));
93 irq = -1;
94 }
95
96 return irq;
97}
98
99static struct hw_pci iq80321_pci __initdata = {
c680b77e 100 .nr_controllers = 1,
c23bfc38 101 .ops = &iop3xx_ops,
c680b77e 102 .setup = iop3xx_pci_setup,
c34002c1 103 .preinit = iop3xx_pci_preinit_cond,
c680b77e
LB
104 .map_irq = iq80321_pci_map_irq,
105};
106
107static int __init iq80321_pci_init(void)
108{
e90ddd81
DW
109 if ((iop3xx_get_init_atu() == IOP3XX_INIT_ATU_ENABLE) &&
110 machine_is_iq80321())
c680b77e
LB
111 pci_common_init(&iq80321_pci);
112
113 return 0;
114}
115
116subsys_initcall(iq80321_pci_init);
117
118
119/*
120 * IQ80321 machine initialisation.
121 */
122static struct physmap_flash_data iq80321_flash_data = {
123 .width = 1,
124};
125
126static struct resource iq80321_flash_resource = {
127 .start = 0xf0000000,
128 .end = 0xf07fffff,
129 .flags = IORESOURCE_MEM,
130};
131
132static struct platform_device iq80321_flash_device = {
133 .name = "physmap-flash",
134 .id = 0,
135 .dev = {
136 .platform_data = &iq80321_flash_data,
137 },
138 .num_resources = 1,
139 .resource = &iq80321_flash_resource,
140};
141
142static struct plat_serial8250_port iq80321_serial_port[] = {
143 {
144 .mapbase = IQ80321_UART,
145 .membase = (char *)IQ80321_UART,
c852ac80 146 .irq = IRQ_IOP32X_XINT1,
c680b77e
LB
147 .flags = UPF_SKIP_TEST,
148 .iotype = UPIO_MEM,
149 .regshift = 0,
150 .uartclk = 1843200,
151 },
152 { },
153};
154
155static struct resource iq80321_uart_resource = {
156 .start = IQ80321_UART,
157 .end = IQ80321_UART + 7,
158 .flags = IORESOURCE_MEM,
159};
160
161static struct platform_device iq80321_serial_device = {
162 .name = "serial8250",
163 .id = PLAT8250_DEV_PLATFORM,
164 .dev = {
165 .platform_data = iq80321_serial_port,
166 },
167 .num_resources = 1,
168 .resource = &iq80321_uart_resource,
169};
170
171static void __init iq80321_init_machine(void)
172{
173 platform_device_register(&iop3xx_i2c0_device);
174 platform_device_register(&iop3xx_i2c1_device);
175 platform_device_register(&iq80321_flash_device);
176 platform_device_register(&iq80321_serial_device);
2492c845
DW
177 platform_device_register(&iop3xx_dma_0_channel);
178 platform_device_register(&iop3xx_dma_1_channel);
179 platform_device_register(&iop3xx_aau_channel);
c680b77e
LB
180}
181
182MACHINE_START(IQ80321, "Intel IQ80321")
183 /* Maintainer: Intel Corp. */
1896746d 184 .atag_offset = 0x100,
c680b77e 185 .map_io = iq80321_map_io,
c852ac80 186 .init_irq = iop32x_init_irq,
6bb27d73 187 .init_time = iq80321_timer_init,
c680b77e 188 .init_machine = iq80321_init_machine,
bec92b1e 189 .restart = iop3xx_restart,
c680b77e 190MACHINE_END
This page took 0.496016 seconds and 5 git commands to generate.