2 * arch/arm/mach-iop32x/iq31244.c
4 * Board support code for the Intel EP80219 and IQ31244 platforms.
6 * Author: Rory Bolt <rorybolt@pacbell.net>
7 * Copyright (C) 2002 Rory Bolt
8 * Copyright 2003 (c) MontaVista, Software, Inc.
9 * Copyright (C) 2004 Intel Corp.
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the
13 * Free Software Foundation; either version 2 of the License, or (at your
14 * option) any later version.
18 #include <linux/init.h>
19 #include <linux/delay.h>
20 #include <linux/kernel.h>
21 #include <linux/pci.h>
23 #include <linux/string.h>
24 #include <linux/slab.h>
25 #include <linux/serial_core.h>
26 #include <linux/serial_8250.h>
27 #include <linux/mtd/physmap.h>
28 #include <linux/platform_device.h>
29 #include <asm/hardware.h>
32 #include <asm/mach/arch.h>
33 #include <asm/mach/map.h>
34 #include <asm/mach/pci.h>
35 #include <asm/mach/time.h>
36 #include <asm/mach-types.h>
38 #include <asm/pgtable.h>
39 #include <asm/arch/time.h>
42 * The EP80219 and IQ31244 use the same machine ID. To find out
43 * which of the two we're running on, we look at the processor ID.
45 static int is_80219(void)
47 extern int processor_id;
48 return !!((processor_id & 0xffffffe0) == 0x69052e20);
53 * EP80219/IQ31244 timer tick configuration.
55 static void __init iq31244_timer_init(void)
58 /* 33.333 MHz crystal. */
59 iop_init_time(200000000);
61 /* 33.000 MHz crystal. */
62 iop_init_time(198000000);
66 static struct sys_timer iq31244_timer = {
67 .init = iq31244_timer_init,
68 .offset = iop_gettimeoffset,
75 static struct map_desc iq31244_io_desc[] __initdata = {
76 { /* on-board devices */
77 .virtual = IQ31244_UART,
78 .pfn = __phys_to_pfn(IQ31244_UART),
84 void __init iq31244_map_io(void)
87 iotable_init(iq31244_io_desc, ARRAY_SIZE(iq31244_io_desc));
92 * EP80219/IQ31244 PCI.
94 static inline int __init
95 ep80219_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
101 irq = IRQ_IOP32X_XINT1;
102 } else if (slot == 1) {
104 irq = IRQ_IOP32X_XINT0;
105 } else if (slot == 2) {
107 irq = IRQ_IOP32X_XINT3;
108 } else if (slot == 3) {
110 irq = IRQ_IOP32X_XINT2;
112 printk(KERN_ERR "ep80219_pci_map_irq() called for unknown "
113 "device PCI:%d:%d:%d\n", dev->bus->number,
114 PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn));
121 static struct hw_pci ep80219_pci __initdata = {
122 .swizzle = pci_std_swizzle,
124 .setup = iop3xx_pci_setup,
125 .preinit = iop3xx_pci_preinit,
126 .scan = iop3xx_pci_scan_bus,
127 .map_irq = ep80219_pci_map_irq,
130 static inline int __init
131 iq31244_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
137 irq = IRQ_IOP32X_XINT1;
138 } else if (slot == 1) {
140 irq = IRQ_IOP32X_XINT2;
141 } else if (slot == 2) {
143 irq = IRQ_IOP32X_XINT3;
144 } else if (slot == 3) {
146 irq = IRQ_IOP32X_XINT0;
148 printk(KERN_ERR "iq31244_pci_map_irq called for unknown "
149 "device PCI:%d:%d:%d\n", dev->bus->number,
150 PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn));
157 static struct hw_pci iq31244_pci __initdata = {
158 .swizzle = pci_std_swizzle,
160 .setup = iop3xx_pci_setup,
161 .preinit = iop3xx_pci_preinit,
162 .scan = iop3xx_pci_scan_bus,
163 .map_irq = iq31244_pci_map_irq,
166 static int __init iq31244_pci_init(void)
168 if (machine_is_iq31244()) {
170 pci_common_init(&ep80219_pci);
172 pci_common_init(&iq31244_pci);
179 subsys_initcall(iq31244_pci_init);
183 * IQ31244 machine initialisation.
185 static struct physmap_flash_data iq31244_flash_data = {
189 static struct resource iq31244_flash_resource = {
192 .flags = IORESOURCE_MEM,
195 static struct platform_device iq31244_flash_device = {
196 .name = "physmap-flash",
199 .platform_data = &iq31244_flash_data,
202 .resource = &iq31244_flash_resource,
205 static struct plat_serial8250_port iq31244_serial_port[] = {
207 .mapbase = IQ31244_UART,
208 .membase = (char *)IQ31244_UART,
209 .irq = IRQ_IOP32X_XINT1,
210 .flags = UPF_SKIP_TEST,
218 static struct resource iq31244_uart_resource = {
219 .start = IQ31244_UART,
220 .end = IQ31244_UART + 7,
221 .flags = IORESOURCE_MEM,
224 static struct platform_device iq31244_serial_device = {
225 .name = "serial8250",
226 .id = PLAT8250_DEV_PLATFORM,
228 .platform_data = iq31244_serial_port,
231 .resource = &iq31244_uart_resource,
235 * This function will send a SHUTDOWN_COMPLETE message to the PIC
236 * controller over I2C. We are not using the i2c subsystem since
237 * we are going to power off and it may be removed
239 void ep80219_power_off(void)
242 * Send the Address byte w/ the start condition
244 *IOP3XX_IDBR1 = 0x60;
249 * Send the START_MSG byte w/ no start or stop condition
251 *IOP3XX_IDBR1 = 0x0F;
256 * Send the SHUTDOWN_COMPLETE Message ID byte w/ no start or
259 *IOP3XX_IDBR1 = 0x03;
264 * Send an ignored byte w/ stop condition
266 *IOP3XX_IDBR1 = 0x00;
273 static void __init iq31244_init_machine(void)
275 platform_device_register(&iop3xx_i2c0_device);
276 platform_device_register(&iop3xx_i2c1_device);
277 platform_device_register(&iq31244_flash_device);
278 platform_device_register(&iq31244_serial_device);
281 pm_power_off = ep80219_power_off;
284 MACHINE_START(IQ31244, "Intel IQ31244")
285 /* Maintainer: Intel Corp. */
286 .phys_io = IQ31244_UART,
287 .io_pg_offst = ((IQ31244_UART) >> 18) & 0xfffc,
288 .boot_params = 0xa0000100,
289 .map_io = iq31244_map_io,
290 .init_irq = iop32x_init_irq,
291 .timer = &iq31244_timer,
292 .init_machine = iq31244_init_machine,