blob: fbe27798759d8449c60a1d245db2375d06c352e1 [file] [log] [blame]
Lennert Buytenhekc680b772006-09-18 23:24:52 +01001/*
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>
21#include <linux/slab.h>
22#include <linux/serial_core.h>
23#include <linux/serial_8250.h>
24#include <linux/mtd/physmap.h>
25#include <linux/platform_device.h>
Russell Kingfced80c2008-09-06 12:10:45 +010026#include <linux/io.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010027#include <mach/hardware.h>
Lennert Buytenhekc680b772006-09-18 23:24:52 +010028#include <asm/irq.h>
29#include <asm/mach/arch.h>
30#include <asm/mach/map.h>
31#include <asm/mach/pci.h>
32#include <asm/mach/time.h>
33#include <asm/mach-types.h>
34#include <asm/page.h>
35#include <asm/pgtable.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010036#include <mach/time.h>
Lennert Buytenhekc680b772006-09-18 23:24:52 +010037
38/*
39 * IQ80321 timer tick configuration.
40 */
41static void __init iq80321_timer_init(void)
42{
43 /* 33.333 MHz crystal. */
Dan Williams3668b452007-02-13 17:13:34 +010044 iop_init_time(200000000);
Lennert Buytenhekc680b772006-09-18 23:24:52 +010045}
46
47static struct sys_timer iq80321_timer = {
48 .init = iq80321_timer_init,
Dan Williams3668b452007-02-13 17:13:34 +010049 .offset = iop_gettimeoffset,
Lennert Buytenhekc680b772006-09-18 23:24:52 +010050};
51
52
53/*
54 * IQ80321 I/O.
55 */
56static struct map_desc iq80321_io_desc[] __initdata = {
57 { /* on-board devices */
58 .virtual = IQ80321_UART,
59 .pfn = __phys_to_pfn(IQ80321_UART),
60 .length = 0x00100000,
61 .type = MT_DEVICE,
62 },
63};
64
65void __init iq80321_map_io(void)
66{
67 iop3xx_map_io();
68 iotable_init(iq80321_io_desc, ARRAY_SIZE(iq80321_io_desc));
69}
70
71
72/*
73 * IQ80321 PCI.
74 */
Dan Williamsd73d8012007-05-15 01:03:36 +010075static int __init
Lennert Buytenhekc680b772006-09-18 23:24:52 +010076iq80321_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
77{
78 int irq;
79
80 if ((slot == 2 || slot == 6) && pin == 1) {
81 /* PCI-X Slot INTA */
Lennert Buytenhekc852ac82006-09-18 23:26:25 +010082 irq = IRQ_IOP32X_XINT2;
Lennert Buytenhekc680b772006-09-18 23:24:52 +010083 } else if ((slot == 2 || slot == 6) && pin == 2) {
84 /* PCI-X Slot INTA */
Lennert Buytenhekc852ac82006-09-18 23:26:25 +010085 irq = IRQ_IOP32X_XINT3;
Lennert Buytenhekc680b772006-09-18 23:24:52 +010086 } else if ((slot == 2 || slot == 6) && pin == 3) {
87 /* PCI-X Slot INTA */
Lennert Buytenhekc852ac82006-09-18 23:26:25 +010088 irq = IRQ_IOP32X_XINT0;
Lennert Buytenhekc680b772006-09-18 23:24:52 +010089 } else if ((slot == 2 || slot == 6) && pin == 4) {
90 /* PCI-X Slot INTA */
Lennert Buytenhekc852ac82006-09-18 23:26:25 +010091 irq = IRQ_IOP32X_XINT1;
Lennert Buytenhekc680b772006-09-18 23:24:52 +010092 } else if (slot == 4 || slot == 8) {
93 /* Gig-E */
Lennert Buytenhekc852ac82006-09-18 23:26:25 +010094 irq = IRQ_IOP32X_XINT0;
Lennert Buytenhekc680b772006-09-18 23:24:52 +010095 } else {
96 printk(KERN_ERR "iq80321_pci_map_irq() called for unknown "
97 "device PCI:%d:%d:%d\n", dev->bus->number,
98 PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn));
99 irq = -1;
100 }
101
102 return irq;
103}
104
105static struct hw_pci iq80321_pci __initdata = {
106 .swizzle = pci_std_swizzle,
107 .nr_controllers = 1,
108 .setup = iop3xx_pci_setup,
Dan Williamsc34002c2008-03-26 19:12:38 -0700109 .preinit = iop3xx_pci_preinit_cond,
Lennert Buytenhekc680b772006-09-18 23:24:52 +0100110 .scan = iop3xx_pci_scan_bus,
111 .map_irq = iq80321_pci_map_irq,
112};
113
114static int __init iq80321_pci_init(void)
115{
Dan Williamse90ddd82007-05-02 17:59:44 +0100116 if ((iop3xx_get_init_atu() == IOP3XX_INIT_ATU_ENABLE) &&
117 machine_is_iq80321())
Lennert Buytenhekc680b772006-09-18 23:24:52 +0100118 pci_common_init(&iq80321_pci);
119
120 return 0;
121}
122
123subsys_initcall(iq80321_pci_init);
124
125
126/*
127 * IQ80321 machine initialisation.
128 */
129static struct physmap_flash_data iq80321_flash_data = {
130 .width = 1,
131};
132
133static struct resource iq80321_flash_resource = {
134 .start = 0xf0000000,
135 .end = 0xf07fffff,
136 .flags = IORESOURCE_MEM,
137};
138
139static struct platform_device iq80321_flash_device = {
140 .name = "physmap-flash",
141 .id = 0,
142 .dev = {
143 .platform_data = &iq80321_flash_data,
144 },
145 .num_resources = 1,
146 .resource = &iq80321_flash_resource,
147};
148
149static struct plat_serial8250_port iq80321_serial_port[] = {
150 {
151 .mapbase = IQ80321_UART,
152 .membase = (char *)IQ80321_UART,
Lennert Buytenhekc852ac82006-09-18 23:26:25 +0100153 .irq = IRQ_IOP32X_XINT1,
Lennert Buytenhekc680b772006-09-18 23:24:52 +0100154 .flags = UPF_SKIP_TEST,
155 .iotype = UPIO_MEM,
156 .regshift = 0,
157 .uartclk = 1843200,
158 },
159 { },
160};
161
162static struct resource iq80321_uart_resource = {
163 .start = IQ80321_UART,
164 .end = IQ80321_UART + 7,
165 .flags = IORESOURCE_MEM,
166};
167
168static struct platform_device iq80321_serial_device = {
169 .name = "serial8250",
170 .id = PLAT8250_DEV_PLATFORM,
171 .dev = {
172 .platform_data = iq80321_serial_port,
173 },
174 .num_resources = 1,
175 .resource = &iq80321_uart_resource,
176};
177
178static void __init iq80321_init_machine(void)
179{
180 platform_device_register(&iop3xx_i2c0_device);
181 platform_device_register(&iop3xx_i2c1_device);
182 platform_device_register(&iq80321_flash_device);
183 platform_device_register(&iq80321_serial_device);
Dan Williams2492c842007-01-02 13:52:31 -0700184 platform_device_register(&iop3xx_dma_0_channel);
185 platform_device_register(&iop3xx_dma_1_channel);
186 platform_device_register(&iop3xx_aau_channel);
Lennert Buytenhekc680b772006-09-18 23:24:52 +0100187}
188
189MACHINE_START(IQ80321, "Intel IQ80321")
190 /* Maintainer: Intel Corp. */
191 .phys_io = IQ80321_UART,
192 .io_pg_offst = ((IQ80321_UART) >> 18) & 0xfffc,
193 .boot_params = 0xa0000100,
194 .map_io = iq80321_map_io,
Lennert Buytenhekc852ac82006-09-18 23:26:25 +0100195 .init_irq = iop32x_init_irq,
Lennert Buytenhekc680b772006-09-18 23:24:52 +0100196 .timer = &iq80321_timer,
197 .init_machine = iq80321_init_machine,
198MACHINE_END