blob: e2f5beece6e813f6f3d32a5b13b603d3bb3d739d [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>
Lennert Buytenhekc680b772006-09-18 23:24:52 +010020#include <linux/serial_core.h>
21#include <linux/serial_8250.h>
22#include <linux/mtd/physmap.h>
23#include <linux/platform_device.h>
Russell Kingfced80c2008-09-06 12:10:45 +010024#include <linux/io.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010025#include <mach/hardware.h>
Lennert Buytenhekc680b772006-09-18 23:24:52 +010026#include <asm/irq.h>
27#include <asm/mach/arch.h>
28#include <asm/mach/map.h>
29#include <asm/mach/pci.h>
30#include <asm/mach/time.h>
31#include <asm/mach-types.h>
32#include <asm/page.h>
33#include <asm/pgtable.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010034#include <mach/time.h>
Lennert Buytenhekc680b772006-09-18 23:24:52 +010035
36/*
37 * IQ80332 timer tick configuration.
38 */
39static void __init iq80332_timer_init(void)
40{
41 /* D-Step parts and the iop333 run at a higher internal bus frequency */
42 if (*IOP3XX_ATURID >= 0xa || *IOP3XX_ATUDID == 0x374)
Dan Williams3668b452007-02-13 17:13:34 +010043 iop_init_time(333000000);
Lennert Buytenhekc680b772006-09-18 23:24:52 +010044 else
Dan Williams3668b452007-02-13 17:13:34 +010045 iop_init_time(266000000);
Lennert Buytenhekc680b772006-09-18 23:24:52 +010046}
47
48static struct sys_timer iq80332_timer = {
49 .init = iq80332_timer_init,
Lennert Buytenhekc680b772006-09-18 23:24:52 +010050};
51
52
53/*
54 * IQ80332 PCI.
55 */
Dan Williamsd73d8012007-05-15 01:03:36 +010056static int __init
Ralf Baechled5341942011-06-10 15:30:21 +010057iq80332_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
Lennert Buytenhekc680b772006-09-18 23:24:52 +010058{
59 int irq;
60
61 if (slot == 4 && pin == 1) {
62 /* PCI-X Slot INTA */
Lennert Buytenhekc852ac82006-09-18 23:26:25 +010063 irq = IRQ_IOP33X_XINT0;
Lennert Buytenhekc680b772006-09-18 23:24:52 +010064 } else if (slot == 4 && pin == 2) {
65 /* PCI-X Slot INTB */
Lennert Buytenhekc852ac82006-09-18 23:26:25 +010066 irq = IRQ_IOP33X_XINT1;
Lennert Buytenhekc680b772006-09-18 23:24:52 +010067 } else if (slot == 4 && pin == 3) {
68 /* PCI-X Slot INTC */
Lennert Buytenhekc852ac82006-09-18 23:26:25 +010069 irq = IRQ_IOP33X_XINT2;
Lennert Buytenhekc680b772006-09-18 23:24:52 +010070 } else if (slot == 4 && pin == 4) {
71 /* PCI-X Slot INTD */
Lennert Buytenhekc852ac82006-09-18 23:26:25 +010072 irq = IRQ_IOP33X_XINT3;
Lennert Buytenhekc680b772006-09-18 23:24:52 +010073 } else if (slot == 6) {
74 /* GigE */
Lennert Buytenhekc852ac82006-09-18 23:26:25 +010075 irq = IRQ_IOP33X_XINT2;
Lennert Buytenhekc680b772006-09-18 23:24:52 +010076 } else {
77 printk(KERN_ERR "iq80332_pci_map_irq() called for unknown "
78 "device PCI:%d:%d:%d\n", dev->bus->number,
79 PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn));
80 irq = -1;
81 }
82
83 return irq;
84}
85
86static struct hw_pci iq80332_pci __initdata = {
Lennert Buytenhekc680b772006-09-18 23:24:52 +010087 .nr_controllers = 1,
Russell Kingc23bfc32012-03-10 12:49:16 +000088 .ops = &iop3xx_ops,
Lennert Buytenhekc680b772006-09-18 23:24:52 +010089 .setup = iop3xx_pci_setup,
Dan Williamsc34002c2008-03-26 19:12:38 -070090 .preinit = iop3xx_pci_preinit_cond,
Lennert Buytenhekc680b772006-09-18 23:24:52 +010091 .map_irq = iq80332_pci_map_irq,
92};
93
94static int __init iq80332_pci_init(void)
95{
Dan Williamse90ddd82007-05-02 17:59:44 +010096 if ((iop3xx_get_init_atu() == IOP3XX_INIT_ATU_ENABLE) &&
97 machine_is_iq80332())
Lennert Buytenhekc680b772006-09-18 23:24:52 +010098 pci_common_init(&iq80332_pci);
99
100 return 0;
101}
102
103subsys_initcall(iq80332_pci_init);
104
105
106/*
107 * IQ80332 machine initialisation.
108 */
109static struct physmap_flash_data iq80332_flash_data = {
110 .width = 1,
111};
112
113static struct resource iq80332_flash_resource = {
114 .start = 0xc0000000,
115 .end = 0xc07fffff,
116 .flags = IORESOURCE_MEM,
117};
118
119static struct platform_device iq80332_flash_device = {
120 .name = "physmap-flash",
121 .id = 0,
122 .dev = {
123 .platform_data = &iq80332_flash_data,
124 },
125 .num_resources = 1,
126 .resource = &iq80332_flash_resource,
127};
128
129static void __init iq80332_init_machine(void)
130{
131 platform_device_register(&iop3xx_i2c0_device);
132 platform_device_register(&iop3xx_i2c1_device);
133 platform_device_register(&iop33x_uart0_device);
134 platform_device_register(&iop33x_uart1_device);
135 platform_device_register(&iq80332_flash_device);
Dan Williams2492c842007-01-02 13:52:31 -0700136 platform_device_register(&iop3xx_dma_0_channel);
137 platform_device_register(&iop3xx_dma_1_channel);
138 platform_device_register(&iop3xx_aau_channel);
Lennert Buytenhekc680b772006-09-18 23:24:52 +0100139}
140
141MACHINE_START(IQ80332, "Intel IQ80332")
142 /* Maintainer: Intel Corp. */
Nicolas Pitree5c76c02011-07-05 22:38:13 -0400143 .atag_offset = 0x100,
Lennert Buytenhekc680b772006-09-18 23:24:52 +0100144 .map_io = iop3xx_map_io,
Lennert Buytenhekc852ac82006-09-18 23:26:25 +0100145 .init_irq = iop33x_init_irq,
Lennert Buytenhekc680b772006-09-18 23:24:52 +0100146 .timer = &iq80332_timer,
147 .init_machine = iq80332_init_machine,
Russell Kingbec92b12011-11-05 11:26:32 +0000148 .restart = iop3xx_restart,
Lennert Buytenhekc680b772006-09-18 23:24:52 +0100149MACHINE_END