blob: 63585485123e50ae208e5ea9426efe0e50780296 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * linux/arch/arm/mach-iop3xx/iop331-setup.c
3 *
4 * Author: Dave Jiang (dave.jiang@intel.com)
5 * Copyright (C) 2004 Intel Corporation.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 */
12#include <linux/mm.h>
13#include <linux/init.h>
14#include <linux/config.h>
15#include <linux/init.h>
16#include <linux/major.h>
17#include <linux/fs.h>
Russell Kingd052d1b2005-10-29 19:07:23 +010018#include <linux/platform_device.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070019#include <linux/serial.h>
20#include <linux/tty.h>
Dan Williams2b9ac7c2006-01-05 20:53:02 +000021#include <linux/serial_8250.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070022
23#include <asm/io.h>
24#include <asm/pgtable.h>
25#include <asm/page.h>
26#include <asm/mach/map.h>
27#include <asm/setup.h>
28#include <asm/system.h>
29#include <asm/memory.h>
30#include <asm/hardware.h>
31#include <asm/mach-types.h>
32#include <asm/mach/arch.h>
33
34#define IOP331_UART_XTAL 33334000
35
36/*
37 * Standard IO mapping for all IOP331 based systems
38 */
39static struct map_desc iop331_std_desc[] __initdata = {
Deepak Saxena4835e642005-10-28 15:18:57 +010040 { /* mem mapped registers */
41 .virtual = IOP331_VIRT_MEM_BASE,
42 .pfn = __phys_to_pfn(IOP331_PHYS_MEM_BASE),
43 .length = 0x00002000,
44 .type = MT_DEVICE
45 }, { /* PCI IO space */
46 .virtual = IOP331_PCI_LOWER_IO_VA,
47 .pfn = __phys_to_pfn(IOP331_PCI_LOWER_IO_PA),
48 .length = IOP331_PCI_IO_WINDOW_SIZE,
49 .type = MT_DEVICE
50 }
Linus Torvalds1da177e2005-04-16 15:20:36 -070051};
52
Dan Williams2b9ac7c2006-01-05 20:53:02 +000053static struct resource iop33x_uart0_resources[] = {
54 [0] = {
55 .start = IOP331_UART0_PHYS,
56 .end = IOP331_UART0_PHYS + 0x3f,
57 .flags = IORESOURCE_MEM,
58 },
59 [1] = {
60 .start = IRQ_IOP331_UART0,
61 .end = IRQ_IOP331_UART0,
62 .flags = IORESOURCE_IRQ
Linus Torvalds1da177e2005-04-16 15:20:36 -070063 }
64};
65
Dan Williams2b9ac7c2006-01-05 20:53:02 +000066static struct resource iop33x_uart1_resources[] = {
67 [0] = {
68 .start = IOP331_UART1_PHYS,
69 .end = IOP331_UART1_PHYS + 0x3f,
70 .flags = IORESOURCE_MEM,
71 },
72 [1] = {
73 .start = IRQ_IOP331_UART1,
74 .end = IRQ_IOP331_UART1,
75 .flags = IORESOURCE_IRQ
76 }
77};
78
79static struct plat_serial8250_port iop33x_uart0_data[] = {
80 {
81 .membase = (char*)(IOP331_UART0_VIRT),
82 .mapbase = (IOP331_UART0_PHYS),
83 .irq = IRQ_IOP331_UART0,
84 .uartclk = IOP331_UART_XTAL,
85 .regshift = 2,
86 .iotype = UPIO_MEM,
87 .flags = UPF_SKIP_TEST,
88 },
89 { },
90};
91
92static struct plat_serial8250_port iop33x_uart1_data[] = {
93 {
94 .membase = (char*)(IOP331_UART1_VIRT),
95 .mapbase = (IOP331_UART1_PHYS),
96 .irq = IRQ_IOP331_UART1,
97 .uartclk = IOP331_UART_XTAL,
98 .regshift = 2,
99 .iotype = UPIO_MEM,
100 .flags = UPF_SKIP_TEST,
101 },
102 { },
103};
104
105static struct platform_device iop33x_uart0 = {
106 .name = "serial8250",
107 .id = 0,
108 .dev.platform_data = iop33x_uart0_data,
109 .num_resources = 2,
110 .resource = iop33x_uart0_resources,
111};
112
113static struct platform_device iop33x_uart1 = {
114 .name = "serial8250",
115 .id = 1,
116 .dev.platform_data = iop33x_uart1_data,
117 .num_resources = 2,
118 .resource = iop33x_uart1_resources,
119};
120
Linus Torvalds1da177e2005-04-16 15:20:36 -0700121static struct resource iop33x_i2c_0_resources[] = {
122 [0] = {
123 .start = 0xfffff680,
124 .end = 0xfffff698,
125 .flags = IORESOURCE_MEM,
126 },
127 [1] = {
128 .start = IRQ_IOP331_I2C_0,
129 .end = IRQ_IOP331_I2C_0,
130 .flags = IORESOURCE_IRQ
131 }
132};
133
134static struct resource iop33x_i2c_1_resources[] = {
135 [0] = {
136 .start = 0xfffff6a0,
137 .end = 0xfffff6b8,
138 .flags = IORESOURCE_MEM,
139 },
140 [1] = {
141 .start = IRQ_IOP331_I2C_1,
142 .end = IRQ_IOP331_I2C_1,
143 .flags = IORESOURCE_IRQ
144 }
145};
146
147static struct platform_device iop33x_i2c_0_controller = {
148 .name = "IOP3xx-I2C",
149 .id = 0,
150 .num_resources = 2,
151 .resource = iop33x_i2c_0_resources
152};
153
154static struct platform_device iop33x_i2c_1_controller = {
155 .name = "IOP3xx-I2C",
156 .id = 1,
157 .num_resources = 2,
158 .resource = iop33x_i2c_1_resources
159};
160
161static struct platform_device *iop33x_devices[] __initdata = {
Dan Williams2b9ac7c2006-01-05 20:53:02 +0000162 &iop33x_uart0,
163 &iop33x_uart1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700164 &iop33x_i2c_0_controller,
165 &iop33x_i2c_1_controller
166};
167
168void __init iop33x_init(void)
169{
170 if(iop_is_331())
171 {
172 platform_add_devices(iop33x_devices,
173 ARRAY_SIZE(iop33x_devices));
174 }
175}
176
177void __init iop331_map_io(void)
178{
179 iotable_init(iop331_std_desc, ARRAY_SIZE(iop331_std_desc));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700180}
181
182#ifdef CONFIG_ARCH_IOP331
183extern void iop331_init_irq(void);
184extern struct sys_timer iop331_timer;
185#endif
186
187#ifdef CONFIG_ARCH_IQ80331
188extern void iq80331_map_io(void);
189#endif
190
191#ifdef CONFIG_MACH_IQ80332
192extern void iq80332_map_io(void);
193#endif
194
195#if defined(CONFIG_ARCH_IQ80331)
196MACHINE_START(IQ80331, "Intel IQ80331")
Russell Kinge9dea0c2005-07-03 17:38:58 +0100197 /* Maintainer: Intel Corp. */
Russell Kinge9dea0c2005-07-03 17:38:58 +0100198 .phys_io = 0xfefff000,
199 .io_pg_offst = ((0xfffff000) >> 18) & 0xfffc, // virtual, physical
200 .map_io = iq80331_map_io,
201 .init_irq = iop331_init_irq,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700202 .timer = &iop331_timer,
Russell Kinge9dea0c2005-07-03 17:38:58 +0100203 .boot_params = 0x0100,
204 .init_machine = iop33x_init,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700205MACHINE_END
206
207#elif defined(CONFIG_MACH_IQ80332)
208MACHINE_START(IQ80332, "Intel IQ80332")
Russell Kinge9dea0c2005-07-03 17:38:58 +0100209 /* Maintainer: Intel Corp. */
Russell Kinge9dea0c2005-07-03 17:38:58 +0100210 .phys_io = 0xfefff000,
211 .io_pg_offst = ((0xfffff000) >> 18) & 0xfffc, // virtual, physical
212 .map_io = iq80332_map_io,
213 .init_irq = iop331_init_irq,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700214 .timer = &iop331_timer,
Russell Kinge9dea0c2005-07-03 17:38:58 +0100215 .boot_params = 0x0100,
216 .init_machine = iop33x_init,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700217MACHINE_END
218
219#else
220#error No machine descriptor defined for this IOP3XX implementation
221#endif
222
223