[ARM] 4476/1: EM7210/SS4000E support
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / arch / arm / mach-iop32x / em7210.c
blobf0362053fdcc3ef3c44b4fd510e8432d0d26fb38
1 /*
2 * arch/arm/mach-iop32x/em7210.c
4 * Board support code for the Lanner EM7210 platforms.
6 * Based on arch/arm/mach-iop32x/iq31244.c file.
8 * Copyright (C) 2007 Arnaud Patard <arnaud.patard@rtp-net.org>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
16 #include <linux/mm.h>
17 #include <linux/init.h>
18 #include <linux/kernel.h>
19 #include <linux/pci.h>
20 #include <linux/pm.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 <linux/io.h>
27 #include <linux/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/arch/time.h>
35 static void __init em7210_timer_init(void)
37 /* http://www.kwaak.net/fotos/fotos-nas/slide_24.html */
38 /* 33.333 MHz crystal. */
39 iop_init_time(200000000);
42 static struct sys_timer em7210_timer = {
43 .init = em7210_timer_init,
44 .offset = iop_gettimeoffset,
49 * EM7210 I/O
51 static struct map_desc em7210_io_desc[] __initdata = {
52 { /* on-board devices */
53 .virtual = IQ31244_UART,
54 .pfn = __phys_to_pfn(IQ31244_UART),
55 .length = 0x00100000,
56 .type = MT_DEVICE,
60 void __init em7210_map_io(void)
62 iop3xx_map_io();
63 iotable_init(em7210_io_desc, ARRAY_SIZE(em7210_io_desc));
68 * EM7210 PCI
70 #define INTA IRQ_IOP32X_XINT0
71 #define INTB IRQ_IOP32X_XINT1
72 #define INTC IRQ_IOP32X_XINT2
73 #define INTD IRQ_IOP32X_XINT3
75 static int __init
76 em7210_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
78 static int pci_irq_table[][4] = {
80 * PCI IDSEL/INTPIN->INTLINE
81 * A B C D
83 {INTB, INTB, INTB, INTB}, /* console / uart */
84 {INTA, INTA, INTA, INTA}, /* 1st 82541 */
85 {INTD, INTD, INTD, INTD}, /* 2nd 82541 */
86 {INTC, INTC, INTC, INTC}, /* GD31244 */
87 {INTD, INTA, INTA, INTA}, /* mini-PCI */
88 {INTD, INTC, INTA, INTA}, /* NEC USB */
91 if (pin < 1 || pin > 4)
92 return -1;
94 return pci_irq_table[slot % 6][pin - 1];
97 static struct hw_pci em7210_pci __initdata = {
98 .swizzle = pci_std_swizzle,
99 .nr_controllers = 1,
100 .setup = iop3xx_pci_setup,
101 .preinit = iop3xx_pci_preinit,
102 .scan = iop3xx_pci_scan_bus,
103 .map_irq = em7210_pci_map_irq,
106 static int __init em7210_pci_init(void)
108 if (machine_is_em7210())
109 pci_common_init(&em7210_pci);
111 return 0;
114 subsys_initcall(em7210_pci_init);
118 * EM7210 Flash
120 static struct physmap_flash_data em7210_flash_data = {
121 .width = 2,
124 static struct resource em7210_flash_resource = {
125 .start = 0xf0000000,
126 .end = 0xf1ffffff,
127 .flags = IORESOURCE_MEM,
130 static struct platform_device em7210_flash_device = {
131 .name = "physmap-flash",
132 .id = 0,
133 .dev = {
134 .platform_data = &em7210_flash_data,
136 .num_resources = 1,
137 .resource = &em7210_flash_resource,
142 * EM7210 UART
143 * The physical address of the serial port is 0xfe800000,
144 * so it can be used for physical and virtual address.
146 static struct plat_serial8250_port em7210_serial_port[] = {
148 .mapbase = IQ31244_UART,
149 .membase = (char *)IQ31244_UART,
150 .irq = IRQ_IOP32X_XINT1,
151 .flags = UPF_SKIP_TEST,
152 .iotype = UPIO_MEM,
153 .regshift = 0,
154 .uartclk = 1843200,
156 { },
159 static struct resource em7210_uart_resource = {
160 .start = IQ31244_UART,
161 .end = IQ31244_UART + 7,
162 .flags = IORESOURCE_MEM,
165 static struct platform_device em7210_serial_device = {
166 .name = "serial8250",
167 .id = PLAT8250_DEV_PLATFORM,
168 .dev = {
169 .platform_data = em7210_serial_port,
171 .num_resources = 1,
172 .resource = &em7210_uart_resource,
175 void em7210_power_off(void)
177 *IOP3XX_GPOE &= 0xfe;
178 *IOP3XX_GPOD |= 0x01;
181 static void __init em7210_init_machine(void)
183 platform_device_register(&em7210_serial_device);
184 platform_device_register(&iop3xx_i2c0_device);
185 platform_device_register(&iop3xx_i2c1_device);
186 platform_device_register(&em7210_flash_device);
187 platform_device_register(&iop3xx_dma_0_channel);
188 platform_device_register(&iop3xx_dma_1_channel);
191 pm_power_off = em7210_power_off;
194 MACHINE_START(EM7210, "Lanner EM7210")
195 .phys_io = IQ31244_UART,
196 .io_pg_offst = ((IQ31244_UART) >> 18) & 0xfffc,
197 .boot_params = 0xa0000100,
198 .map_io = em7210_map_io,
199 .init_irq = iop32x_init_irq,
200 .timer = &em7210_timer,
201 .init_machine = em7210_init_machine,
202 MACHINE_END