Lennert Buytenhek | c680b77 | 2006-09-18 23:24:52 +0100 | [diff] [blame] | 1 | /* |
| 2 | * arch/arm/mach-iop33x/iq80331.c |
| 3 | * |
| 4 | * Board support code for the Intel IQ80331 platform. |
| 5 | * |
| 6 | * Author: Dave Jiang <dave.jiang@intel.com> |
| 7 | * Copyright (C) 2003 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> |
Russell King | fced80c | 2008-09-06 12:10:45 +0100 | [diff] [blame] | 25 | #include <linux/io.h> |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 26 | #include <mach/hardware.h> |
Lennert Buytenhek | c680b77 | 2006-09-18 23:24:52 +0100 | [diff] [blame] | 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> |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 35 | #include <mach/time.h> |
Lennert Buytenhek | c680b77 | 2006-09-18 23:24:52 +0100 | [diff] [blame] | 36 | |
| 37 | /* |
| 38 | * IQ80331 timer tick configuration. |
| 39 | */ |
| 40 | static void __init iq80331_timer_init(void) |
| 41 | { |
| 42 | /* D-Step parts run at a higher internal bus frequency */ |
| 43 | if (*IOP3XX_ATURID >= 0xa) |
Dan Williams | 3668b45 | 2007-02-13 17:13:34 +0100 | [diff] [blame] | 44 | iop_init_time(333000000); |
Lennert Buytenhek | c680b77 | 2006-09-18 23:24:52 +0100 | [diff] [blame] | 45 | else |
Dan Williams | 3668b45 | 2007-02-13 17:13:34 +0100 | [diff] [blame] | 46 | iop_init_time(266000000); |
Lennert Buytenhek | c680b77 | 2006-09-18 23:24:52 +0100 | [diff] [blame] | 47 | } |
| 48 | |
| 49 | static struct sys_timer iq80331_timer = { |
| 50 | .init = iq80331_timer_init, |
Lennert Buytenhek | c680b77 | 2006-09-18 23:24:52 +0100 | [diff] [blame] | 51 | }; |
| 52 | |
| 53 | |
| 54 | /* |
| 55 | * IQ80331 PCI. |
| 56 | */ |
Dan Williams | d73d801 | 2007-05-15 01:03:36 +0100 | [diff] [blame] | 57 | static int __init |
Lennert Buytenhek | c680b77 | 2006-09-18 23:24:52 +0100 | [diff] [blame] | 58 | iq80331_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) |
| 59 | { |
| 60 | int irq; |
| 61 | |
| 62 | if (slot == 1 && pin == 1) { |
| 63 | /* PCI-X Slot INTA */ |
Lennert Buytenhek | c852ac8 | 2006-09-18 23:26:25 +0100 | [diff] [blame] | 64 | irq = IRQ_IOP33X_XINT1; |
Lennert Buytenhek | c680b77 | 2006-09-18 23:24:52 +0100 | [diff] [blame] | 65 | } else if (slot == 1 && pin == 2) { |
| 66 | /* PCI-X Slot INTB */ |
Lennert Buytenhek | c852ac8 | 2006-09-18 23:26:25 +0100 | [diff] [blame] | 67 | irq = IRQ_IOP33X_XINT2; |
Lennert Buytenhek | c680b77 | 2006-09-18 23:24:52 +0100 | [diff] [blame] | 68 | } else if (slot == 1 && pin == 3) { |
| 69 | /* PCI-X Slot INTC */ |
Lennert Buytenhek | c852ac8 | 2006-09-18 23:26:25 +0100 | [diff] [blame] | 70 | irq = IRQ_IOP33X_XINT3; |
Lennert Buytenhek | c680b77 | 2006-09-18 23:24:52 +0100 | [diff] [blame] | 71 | } else if (slot == 1 && pin == 4) { |
| 72 | /* PCI-X Slot INTD */ |
Lennert Buytenhek | c852ac8 | 2006-09-18 23:26:25 +0100 | [diff] [blame] | 73 | irq = IRQ_IOP33X_XINT0; |
Lennert Buytenhek | c680b77 | 2006-09-18 23:24:52 +0100 | [diff] [blame] | 74 | } else if (slot == 2) { |
| 75 | /* GigE */ |
Lennert Buytenhek | c852ac8 | 2006-09-18 23:26:25 +0100 | [diff] [blame] | 76 | irq = IRQ_IOP33X_XINT2; |
Lennert Buytenhek | c680b77 | 2006-09-18 23:24:52 +0100 | [diff] [blame] | 77 | } else { |
| 78 | printk(KERN_ERR "iq80331_pci_map_irq() called for unknown " |
| 79 | "device PCI:%d:%d:%d\n", dev->bus->number, |
| 80 | PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn)); |
| 81 | irq = -1; |
| 82 | } |
| 83 | |
| 84 | return irq; |
| 85 | } |
| 86 | |
| 87 | static struct hw_pci iq80331_pci __initdata = { |
| 88 | .swizzle = pci_std_swizzle, |
| 89 | .nr_controllers = 1, |
| 90 | .setup = iop3xx_pci_setup, |
Dan Williams | c34002c | 2008-03-26 19:12:38 -0700 | [diff] [blame] | 91 | .preinit = iop3xx_pci_preinit_cond, |
Lennert Buytenhek | c680b77 | 2006-09-18 23:24:52 +0100 | [diff] [blame] | 92 | .scan = iop3xx_pci_scan_bus, |
| 93 | .map_irq = iq80331_pci_map_irq, |
| 94 | }; |
| 95 | |
| 96 | static int __init iq80331_pci_init(void) |
| 97 | { |
Dan Williams | e90ddd8 | 2007-05-02 17:59:44 +0100 | [diff] [blame] | 98 | if ((iop3xx_get_init_atu() == IOP3XX_INIT_ATU_ENABLE) && |
| 99 | machine_is_iq80331()) |
Lennert Buytenhek | c680b77 | 2006-09-18 23:24:52 +0100 | [diff] [blame] | 100 | pci_common_init(&iq80331_pci); |
| 101 | |
| 102 | return 0; |
| 103 | } |
| 104 | |
| 105 | subsys_initcall(iq80331_pci_init); |
| 106 | |
| 107 | |
| 108 | /* |
| 109 | * IQ80331 machine initialisation. |
| 110 | */ |
| 111 | static struct physmap_flash_data iq80331_flash_data = { |
| 112 | .width = 1, |
| 113 | }; |
| 114 | |
| 115 | static struct resource iq80331_flash_resource = { |
| 116 | .start = 0xc0000000, |
| 117 | .end = 0xc07fffff, |
| 118 | .flags = IORESOURCE_MEM, |
| 119 | }; |
| 120 | |
| 121 | static struct platform_device iq80331_flash_device = { |
| 122 | .name = "physmap-flash", |
| 123 | .id = 0, |
| 124 | .dev = { |
| 125 | .platform_data = &iq80331_flash_data, |
| 126 | }, |
| 127 | .num_resources = 1, |
| 128 | .resource = &iq80331_flash_resource, |
| 129 | }; |
| 130 | |
| 131 | static void __init iq80331_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(&iq80331_flash_device); |
Dan Williams | 2492c84 | 2007-01-02 13:52:31 -0700 | [diff] [blame] | 138 | platform_device_register(&iop3xx_dma_0_channel); |
| 139 | platform_device_register(&iop3xx_dma_1_channel); |
| 140 | platform_device_register(&iop3xx_aau_channel); |
Lennert Buytenhek | c680b77 | 2006-09-18 23:24:52 +0100 | [diff] [blame] | 141 | } |
| 142 | |
| 143 | MACHINE_START(IQ80331, "Intel IQ80331") |
| 144 | /* Maintainer: Intel Corp. */ |
| 145 | .phys_io = 0xfefff000, |
| 146 | .io_pg_offst = ((0xfffff000) >> 18) & 0xfffc, |
| 147 | .boot_params = 0x00000100, |
| 148 | .map_io = iop3xx_map_io, |
Lennert Buytenhek | c852ac8 | 2006-09-18 23:26:25 +0100 | [diff] [blame] | 149 | .init_irq = iop33x_init_irq, |
Lennert Buytenhek | c680b77 | 2006-09-18 23:24:52 +0100 | [diff] [blame] | 150 | .timer = &iq80331_timer, |
| 151 | .init_machine = iq80331_init_machine, |
| 152 | MACHINE_END |