blob: 96d6f0f3cd215d384348fb18b4add2a66cdc8658 [file] [log] [blame]
Lennert Buytenhekc680b772006-09-18 23:24:52 +01001/*
2 * arch/arm/mach-iop33x/iq80332.c
3 *
4 * Board support code for the Intel IQ80332 platform.
5 *
6 * Author: Dave Jiang <dave.jiang@intel.com>
7 * Copyright (C) 2004 Intel Corp.
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 */
14
15#include <linux/mm.h>
16#include <linux/init.h>
17#include <linux/kernel.h>
18#include <linux/pci.h>
19#include <linux/string.h>
20#include <linux/slab.h>
21#include <linux/serial_core.h>
22#include <linux/serial_8250.h>
23#include <linux/mtd/physmap.h>
24#include <linux/platform_device.h>
25#include <asm/hardware.h>
26#include <asm/io.h>
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>
Dan Williams3668b452007-02-13 17:13:34 +010035#include <asm/arch/time.h>
Lennert Buytenhekc680b772006-09-18 23:24:52 +010036
37/*
38 * IQ80332 timer tick configuration.
39 */
40static void __init iq80332_timer_init(void)
41{
42 /* D-Step parts and the iop333 run at a higher internal bus frequency */
43 if (*IOP3XX_ATURID >= 0xa || *IOP3XX_ATUDID == 0x374)
Dan Williams3668b452007-02-13 17:13:34 +010044 iop_init_time(333000000);
Lennert Buytenhekc680b772006-09-18 23:24:52 +010045 else
Dan Williams3668b452007-02-13 17:13:34 +010046 iop_init_time(266000000);
Lennert Buytenhekc680b772006-09-18 23:24:52 +010047}
48
49static struct sys_timer iq80332_timer = {
50 .init = iq80332_timer_init,
Dan Williams3668b452007-02-13 17:13:34 +010051 .offset = iop_gettimeoffset,
Lennert Buytenhekc680b772006-09-18 23:24:52 +010052};
53
54
55/*
56 * IQ80332 PCI.
57 */
58static inline int __init
59iq80332_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
60{
61 int irq;
62
63 if (slot == 4 && pin == 1) {
64 /* PCI-X Slot INTA */
Lennert Buytenhekc852ac82006-09-18 23:26:25 +010065 irq = IRQ_IOP33X_XINT0;
Lennert Buytenhekc680b772006-09-18 23:24:52 +010066 } else if (slot == 4 && pin == 2) {
67 /* PCI-X Slot INTB */
Lennert Buytenhekc852ac82006-09-18 23:26:25 +010068 irq = IRQ_IOP33X_XINT1;
Lennert Buytenhekc680b772006-09-18 23:24:52 +010069 } else if (slot == 4 && pin == 3) {
70 /* PCI-X Slot INTC */
Lennert Buytenhekc852ac82006-09-18 23:26:25 +010071 irq = IRQ_IOP33X_XINT2;
Lennert Buytenhekc680b772006-09-18 23:24:52 +010072 } else if (slot == 4 && pin == 4) {
73 /* PCI-X Slot INTD */
Lennert Buytenhekc852ac82006-09-18 23:26:25 +010074 irq = IRQ_IOP33X_XINT3;
Lennert Buytenhekc680b772006-09-18 23:24:52 +010075 } else if (slot == 6) {
76 /* GigE */
Lennert Buytenhekc852ac82006-09-18 23:26:25 +010077 irq = IRQ_IOP33X_XINT2;
Lennert Buytenhekc680b772006-09-18 23:24:52 +010078 } else {
79 printk(KERN_ERR "iq80332_pci_map_irq() called for unknown "
80 "device PCI:%d:%d:%d\n", dev->bus->number,
81 PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn));
82 irq = -1;
83 }
84
85 return irq;
86}
87
88static struct hw_pci iq80332_pci __initdata = {
89 .swizzle = pci_std_swizzle,
90 .nr_controllers = 1,
91 .setup = iop3xx_pci_setup,
92 .preinit = iop3xx_pci_preinit,
93 .scan = iop3xx_pci_scan_bus,
94 .map_irq = iq80332_pci_map_irq,
95};
96
97static int __init iq80332_pci_init(void)
98{
99 if (machine_is_iq80332())
100 pci_common_init(&iq80332_pci);
101
102 return 0;
103}
104
105subsys_initcall(iq80332_pci_init);
106
107
108/*
109 * IQ80332 machine initialisation.
110 */
111static struct physmap_flash_data iq80332_flash_data = {
112 .width = 1,
113};
114
115static struct resource iq80332_flash_resource = {
116 .start = 0xc0000000,
117 .end = 0xc07fffff,
118 .flags = IORESOURCE_MEM,
119};
120
121static struct platform_device iq80332_flash_device = {
122 .name = "physmap-flash",
123 .id = 0,
124 .dev = {
125 .platform_data = &iq80332_flash_data,
126 },
127 .num_resources = 1,
128 .resource = &iq80332_flash_resource,
129};
130
131static void __init iq80332_init_machine(void)
132{
133 platform_device_register(&iop3xx_i2c0_device);
134 platform_device_register(&iop3xx_i2c1_device);
135 platform_device_register(&iop33x_uart0_device);
136 platform_device_register(&iop33x_uart1_device);
137 platform_device_register(&iq80332_flash_device);
138}
139
140MACHINE_START(IQ80332, "Intel IQ80332")
141 /* Maintainer: Intel Corp. */
142 .phys_io = 0xfefff000,
143 .io_pg_offst = ((0xfffff000) >> 18) & 0xfffc,
144 .boot_params = 0x00000100,
145 .map_io = iop3xx_map_io,
Lennert Buytenhekc852ac82006-09-18 23:26:25 +0100146 .init_irq = iop33x_init_irq,
Lennert Buytenhekc680b772006-09-18 23:24:52 +0100147 .timer = &iq80332_timer,
148 .init_machine = iq80332_init_machine,
149MACHINE_END