blob: 2d6abe5be14df2a8e41dd8f8c3ee1ec39c0df582 [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>
Linus Torvalds1da177e2005-04-16 15:20:36 -070015#include <linux/major.h>
16#include <linux/fs.h>
Russell Kingd052d1b2005-10-29 19:07:23 +010017#include <linux/platform_device.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070018#include <linux/serial.h>
19#include <linux/tty.h>
Dan Williams2b9ac7c2006-01-05 20:53:02 +000020#include <linux/serial_8250.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070021
22#include <asm/io.h>
23#include <asm/pgtable.h>
24#include <asm/page.h>
25#include <asm/mach/map.h>
26#include <asm/setup.h>
27#include <asm/system.h>
28#include <asm/memory.h>
29#include <asm/hardware.h>
30#include <asm/mach-types.h>
31#include <asm/mach/arch.h>
32
33#define IOP331_UART_XTAL 33334000
34
35/*
36 * Standard IO mapping for all IOP331 based systems
37 */
38static struct map_desc iop331_std_desc[] __initdata = {
Deepak Saxena4835e642005-10-28 15:18:57 +010039 { /* mem mapped registers */
40 .virtual = IOP331_VIRT_MEM_BASE,
41 .pfn = __phys_to_pfn(IOP331_PHYS_MEM_BASE),
42 .length = 0x00002000,
43 .type = MT_DEVICE
44 }, { /* PCI IO space */
45 .virtual = IOP331_PCI_LOWER_IO_VA,
46 .pfn = __phys_to_pfn(IOP331_PCI_LOWER_IO_PA),
47 .length = IOP331_PCI_IO_WINDOW_SIZE,
48 .type = MT_DEVICE
49 }
Linus Torvalds1da177e2005-04-16 15:20:36 -070050};
51
Dan Williams2b9ac7c2006-01-05 20:53:02 +000052static struct resource iop33x_uart0_resources[] = {
53 [0] = {
54 .start = IOP331_UART0_PHYS,
55 .end = IOP331_UART0_PHYS + 0x3f,
56 .flags = IORESOURCE_MEM,
57 },
58 [1] = {
59 .start = IRQ_IOP331_UART0,
60 .end = IRQ_IOP331_UART0,
61 .flags = IORESOURCE_IRQ
Linus Torvalds1da177e2005-04-16 15:20:36 -070062 }
63};
64
Dan Williams2b9ac7c2006-01-05 20:53:02 +000065static struct resource iop33x_uart1_resources[] = {
66 [0] = {
67 .start = IOP331_UART1_PHYS,
68 .end = IOP331_UART1_PHYS + 0x3f,
69 .flags = IORESOURCE_MEM,
70 },
71 [1] = {
72 .start = IRQ_IOP331_UART1,
73 .end = IRQ_IOP331_UART1,
74 .flags = IORESOURCE_IRQ
75 }
76};
77
78static struct plat_serial8250_port iop33x_uart0_data[] = {
79 {
80 .membase = (char*)(IOP331_UART0_VIRT),
81 .mapbase = (IOP331_UART0_PHYS),
82 .irq = IRQ_IOP331_UART0,
83 .uartclk = IOP331_UART_XTAL,
84 .regshift = 2,
85 .iotype = UPIO_MEM,
86 .flags = UPF_SKIP_TEST,
87 },
88 { },
89};
90
91static struct plat_serial8250_port iop33x_uart1_data[] = {
92 {
93 .membase = (char*)(IOP331_UART1_VIRT),
94 .mapbase = (IOP331_UART1_PHYS),
95 .irq = IRQ_IOP331_UART1,
96 .uartclk = IOP331_UART_XTAL,
97 .regshift = 2,
98 .iotype = UPIO_MEM,
99 .flags = UPF_SKIP_TEST,
100 },
101 { },
102};
103
104static struct platform_device iop33x_uart0 = {
105 .name = "serial8250",
106 .id = 0,
107 .dev.platform_data = iop33x_uart0_data,
108 .num_resources = 2,
109 .resource = iop33x_uart0_resources,
110};
111
112static struct platform_device iop33x_uart1 = {
113 .name = "serial8250",
114 .id = 1,
115 .dev.platform_data = iop33x_uart1_data,
116 .num_resources = 2,
117 .resource = iop33x_uart1_resources,
118};
119
Linus Torvalds1da177e2005-04-16 15:20:36 -0700120static struct resource iop33x_i2c_0_resources[] = {
121 [0] = {
122 .start = 0xfffff680,
123 .end = 0xfffff698,
124 .flags = IORESOURCE_MEM,
125 },
126 [1] = {
127 .start = IRQ_IOP331_I2C_0,
128 .end = IRQ_IOP331_I2C_0,
129 .flags = IORESOURCE_IRQ
130 }
131};
132
133static struct resource iop33x_i2c_1_resources[] = {
134 [0] = {
135 .start = 0xfffff6a0,
136 .end = 0xfffff6b8,
137 .flags = IORESOURCE_MEM,
138 },
139 [1] = {
140 .start = IRQ_IOP331_I2C_1,
141 .end = IRQ_IOP331_I2C_1,
142 .flags = IORESOURCE_IRQ
143 }
144};
145
146static struct platform_device iop33x_i2c_0_controller = {
147 .name = "IOP3xx-I2C",
148 .id = 0,
149 .num_resources = 2,
150 .resource = iop33x_i2c_0_resources
151};
152
153static struct platform_device iop33x_i2c_1_controller = {
154 .name = "IOP3xx-I2C",
155 .id = 1,
156 .num_resources = 2,
157 .resource = iop33x_i2c_1_resources
158};
159
160static struct platform_device *iop33x_devices[] __initdata = {
Dan Williams2b9ac7c2006-01-05 20:53:02 +0000161 &iop33x_uart0,
162 &iop33x_uart1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700163 &iop33x_i2c_0_controller,
164 &iop33x_i2c_1_controller
165};
166
167void __init iop33x_init(void)
168{
169 if(iop_is_331())
170 {
171 platform_add_devices(iop33x_devices,
172 ARRAY_SIZE(iop33x_devices));
173 }
174}
175
176void __init iop331_map_io(void)
177{
178 iotable_init(iop331_std_desc, ARRAY_SIZE(iop331_std_desc));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700179}
180
181#ifdef CONFIG_ARCH_IOP331
182extern void iop331_init_irq(void);
183extern struct sys_timer iop331_timer;
184#endif
185
186#ifdef CONFIG_ARCH_IQ80331
187extern void iq80331_map_io(void);
188#endif
189
190#ifdef CONFIG_MACH_IQ80332
191extern void iq80332_map_io(void);
192#endif
193
194#if defined(CONFIG_ARCH_IQ80331)
195MACHINE_START(IQ80331, "Intel IQ80331")
Russell Kinge9dea0c2005-07-03 17:38:58 +0100196 /* Maintainer: Intel Corp. */
Russell Kinge9dea0c2005-07-03 17:38:58 +0100197 .phys_io = 0xfefff000,
198 .io_pg_offst = ((0xfffff000) >> 18) & 0xfffc, // virtual, physical
199 .map_io = iq80331_map_io,
200 .init_irq = iop331_init_irq,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700201 .timer = &iop331_timer,
Russell Kinge9dea0c2005-07-03 17:38:58 +0100202 .boot_params = 0x0100,
203 .init_machine = iop33x_init,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700204MACHINE_END
205
206#elif defined(CONFIG_MACH_IQ80332)
207MACHINE_START(IQ80332, "Intel IQ80332")
Russell Kinge9dea0c2005-07-03 17:38:58 +0100208 /* Maintainer: Intel Corp. */
Russell Kinge9dea0c2005-07-03 17:38:58 +0100209 .phys_io = 0xfefff000,
210 .io_pg_offst = ((0xfffff000) >> 18) & 0xfffc, // virtual, physical
211 .map_io = iq80332_map_io,
212 .init_irq = iop331_init_irq,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700213 .timer = &iop331_timer,
Russell Kinge9dea0c2005-07-03 17:38:58 +0100214 .boot_params = 0x0100,
215 .init_machine = iop33x_init,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700216MACHINE_END
217
218#else
219#error No machine descriptor defined for this IOP3XX implementation
220#endif
221
222