aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-iop32x/em7210.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-22 14:22:59 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-22 14:22:59 -0400
commit7578634990fb47cc30083fbd812689aa6deacfc0 (patch)
treef493860658579d9572a19b3a41fcea2de035e49f /arch/arm/mach-iop32x/em7210.c
parentd7f5e3df3574c6e38b99f5fe22f15540b2b9811d (diff)
parent5957a4eb284dd6f522b248b674792416466555b2 (diff)
Merge branch 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm
* 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm: (60 commits) [ARM] 4524/1: S3C: Move register out of include/asm-arm/arch-s3c2410 [ARM] 4523/1: S3C: Remove FIFO_MAX from uncompression headers [ARM] 4522/1: S3C: split include/asm-arm/arch/memory.h [ARM] 4521/2: S3C: Reorganise VA mapping headers [ARM] 4520/1: S3C: Remove old VA values from static map [ARM] 4519/1: S3C: split S3C2400 values out of S3C24XX map.h [ARM] 4518/1: S3C: Rename watchdog configuration options [ARM] 4517/1: S3C: Fix debug macros for ARM926 output [ARM] 4516/1: S3C: Fix uncompressor serial output for ARM926 [ARM] 4515/1: S3C: Move uncompress code to plat-s3c [ARM] 4514/1: S3C: Rename DEBUG_S3C2410_PORT and DEBUG_S3C_UART [ARM] 4513/1: S3C: Rename CONFIG_S3C2410_LOWLEVEL_UART_PORT [ARM] 4512/1: S3C: rename the debug macros for per-cpu updates [ARM] 4511/1: S3C: updated LLSERIAL Kconfig defines for CPU support [ARM] 4510/1: S3C: split debug-macro support into plat-s3c [ARM] 4509/1: S3C: Create initial arch/arm/plat-s3c [ARM] 4508/1: S3C: Move items to include/asm-arm/plat-s3c [ARM] 4461/1: MXC platform and i.MX31ADS core support [ARM] 4507/1: pxa2xx clock_event_device [ARM] 4497/1: Only allow safe cache configurations on ARMv6 and later ...
Diffstat (limited to 'arch/arm/mach-iop32x/em7210.c')
-rw-r--r--arch/arm/mach-iop32x/em7210.c215
1 files changed, 215 insertions, 0 deletions
diff --git a/arch/arm/mach-iop32x/em7210.c b/arch/arm/mach-iop32x/em7210.c
new file mode 100644
index 000000000000..c947152f9a3c
--- /dev/null
+++ b/arch/arm/mach-iop32x/em7210.c
@@ -0,0 +1,215 @@
1/*
2 * arch/arm/mach-iop32x/em7210.c
3 *
4 * Board support code for the Lanner EM7210 platforms.
5 *
6 * Based on arch/arm/mach-iop32x/iq31244.c file.
7 *
8 * Copyright (C) 2007 Arnaud Patard <arnaud.patard@rtp-net.org>
9 *
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.
13 *
14 */
15
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 <linux/i2c.h>
26#include <asm/hardware.h>
27#include <linux/io.h>
28#include <linux/irq.h>
29#include <asm/mach/arch.h>
30#include <asm/mach/map.h>
31#include <asm/mach/pci.h>
32#include <asm/mach/time.h>
33#include <asm/mach-types.h>
34#include <asm/arch/time.h>
35
36static void __init em7210_timer_init(void)
37{
38 /* http://www.kwaak.net/fotos/fotos-nas/slide_24.html */
39 /* 33.333 MHz crystal. */
40 iop_init_time(200000000);
41}
42
43static struct sys_timer em7210_timer = {
44 .init = em7210_timer_init,
45 .offset = iop_gettimeoffset,
46};
47
48/*
49 * EM7210 RTC
50 */
51static struct i2c_board_info __initdata em7210_i2c_devices[] = {
52 {
53 I2C_BOARD_INFO("rtc-rs5c372", 0x32),
54 .type = "rs5c372a",
55 },
56};
57
58/*
59 * EM7210 I/O
60 */
61static struct map_desc em7210_io_desc[] __initdata = {
62 { /* on-board devices */
63 .virtual = IQ31244_UART,
64 .pfn = __phys_to_pfn(IQ31244_UART),
65 .length = 0x00100000,
66 .type = MT_DEVICE,
67 },
68};
69
70void __init em7210_map_io(void)
71{
72 iop3xx_map_io();
73 iotable_init(em7210_io_desc, ARRAY_SIZE(em7210_io_desc));
74}
75
76
77/*
78 * EM7210 PCI
79 */
80#define INTA IRQ_IOP32X_XINT0
81#define INTB IRQ_IOP32X_XINT1
82#define INTC IRQ_IOP32X_XINT2
83#define INTD IRQ_IOP32X_XINT3
84
85static int __init
86em7210_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
87{
88 static int pci_irq_table[][4] = {
89 /*
90 * PCI IDSEL/INTPIN->INTLINE
91 * A B C D
92 */
93 {INTB, INTB, INTB, INTB}, /* console / uart */
94 {INTA, INTA, INTA, INTA}, /* 1st 82541 */
95 {INTD, INTD, INTD, INTD}, /* 2nd 82541 */
96 {INTC, INTC, INTC, INTC}, /* GD31244 */
97 {INTD, INTA, INTA, INTA}, /* mini-PCI */
98 {INTD, INTC, INTA, INTA}, /* NEC USB */
99 };
100
101 if (pin < 1 || pin > 4)
102 return -1;
103
104 return pci_irq_table[slot % 6][pin - 1];
105}
106
107static struct hw_pci em7210_pci __initdata = {
108 .swizzle = pci_std_swizzle,
109 .nr_controllers = 1,
110 .setup = iop3xx_pci_setup,
111 .preinit = iop3xx_pci_preinit,
112 .scan = iop3xx_pci_scan_bus,
113 .map_irq = em7210_pci_map_irq,
114};
115
116static int __init em7210_pci_init(void)
117{
118 if (machine_is_em7210())
119 pci_common_init(&em7210_pci);
120
121 return 0;
122}
123
124subsys_initcall(em7210_pci_init);
125
126
127/*
128 * EM7210 Flash
129 */
130static struct physmap_flash_data em7210_flash_data = {
131 .width = 2,
132};
133
134static struct resource em7210_flash_resource = {
135 .start = 0xf0000000,
136 .end = 0xf1ffffff,
137 .flags = IORESOURCE_MEM,
138};
139
140static struct platform_device em7210_flash_device = {
141 .name = "physmap-flash",
142 .id = 0,
143 .dev = {
144 .platform_data = &em7210_flash_data,
145 },
146 .num_resources = 1,
147 .resource = &em7210_flash_resource,
148};
149
150
151/*
152 * EM7210 UART
153 * The physical address of the serial port is 0xfe800000,
154 * so it can be used for physical and virtual address.
155 */
156static struct plat_serial8250_port em7210_serial_port[] = {
157 {
158 .mapbase = IQ31244_UART,
159 .membase = (char *)IQ31244_UART,
160 .irq = IRQ_IOP32X_XINT1,
161 .flags = UPF_SKIP_TEST,
162 .iotype = UPIO_MEM,
163 .regshift = 0,
164 .uartclk = 1843200,
165 },
166 { },
167};
168
169static struct resource em7210_uart_resource = {
170 .start = IQ31244_UART,
171 .end = IQ31244_UART + 7,
172 .flags = IORESOURCE_MEM,
173};
174
175static struct platform_device em7210_serial_device = {
176 .name = "serial8250",
177 .id = PLAT8250_DEV_PLATFORM,
178 .dev = {
179 .platform_data = em7210_serial_port,
180 },
181 .num_resources = 1,
182 .resource = &em7210_uart_resource,
183};
184
185void em7210_power_off(void)
186{
187 *IOP3XX_GPOE &= 0xfe;
188 *IOP3XX_GPOD |= 0x01;
189}
190
191static void __init em7210_init_machine(void)
192{
193 platform_device_register(&em7210_serial_device);
194 platform_device_register(&iop3xx_i2c0_device);
195 platform_device_register(&iop3xx_i2c1_device);
196 platform_device_register(&em7210_flash_device);
197 platform_device_register(&iop3xx_dma_0_channel);
198 platform_device_register(&iop3xx_dma_1_channel);
199
200 i2c_register_board_info(0, em7210_i2c_devices,
201 ARRAY_SIZE(em7210_i2c_devices));
202
203
204 pm_power_off = em7210_power_off;
205}
206
207MACHINE_START(EM7210, "Lanner EM7210")
208 .phys_io = IQ31244_UART,
209 .io_pg_offst = ((IQ31244_UART) >> 18) & 0xfffc,
210 .boot_params = 0xa0000100,
211 .map_io = em7210_map_io,
212 .init_irq = iop32x_init_irq,
213 .timer = &em7210_timer,
214 .init_machine = em7210_init_machine,
215MACHINE_END