blob: 0ebbcb20c6ae2ab3a43177a019c51ec254d16400 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * linux/arch/arm/mach-iop3xx/iop321-setup.c
3 *
4 * Author: Nicolas Pitre <nico@cam.org>
5 * Copyright (C) 2001 MontaVista Software, Inc.
6 * Copyright (C) 2004 Intel Corporation.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 */
13#include <linux/mm.h>
14#include <linux/init.h>
15#include <linux/config.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070016#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>
21#include <linux/serial_core.h>
22
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 IOP321_UART_XTAL 1843200
35
36/*
37 * Standard IO mapping for all IOP321 based systems
38 */
39static struct map_desc iop321_std_desc[] __initdata = {
Deepak Saxena4835e642005-10-28 15:18:57 +010040 { /* mem mapped registers */
41 .virtual = IOP321_VIRT_MEM_BASE,
42 .pfn = __phys_to_pfn(IOP321_PHYS_MEM_BASE),
43 .length = 0x00002000,
44 .type = MT_DEVICE
45 }, { /* PCI IO space */
46 .virtual = IOP321_PCI_LOWER_IO_VA,
47 .pfn = __phys_to_pfn(IOP321_PCI_LOWER_IO_PA),
48 .length = IOP321_PCI_IO_WINDOW_SIZE,
49 .type = MT_DEVICE
50 }
Linus Torvalds1da177e2005-04-16 15:20:36 -070051};
52
53#ifdef CONFIG_ARCH_IQ80321
54#define UARTBASE IQ80321_UART
55#define IRQ_UART IRQ_IQ80321_UART
56#endif
57
58#ifdef CONFIG_ARCH_IQ31244
59#define UARTBASE IQ31244_UART
60#define IRQ_UART IRQ_IQ31244_UART
61#endif
62
63static struct uart_port iop321_serial_ports[] = {
64 {
65 .membase = (char*)(UARTBASE),
66 .mapbase = (UARTBASE),
67 .irq = IRQ_UART,
68 .flags = UPF_SKIP_TEST,
69 .iotype = UPIO_MEM,
70 .regshift = 0,
71 .uartclk = IOP321_UART_XTAL,
72 .line = 0,
73 .type = PORT_16550A,
74 .fifosize = 16
75 }
76};
77
78static struct resource iop32x_i2c_0_resources[] = {
79 [0] = {
80 .start = 0xfffff680,
81 .end = 0xfffff698,
82 .flags = IORESOURCE_MEM,
83 },
84 [1] = {
85 .start = IRQ_IOP321_I2C_0,
86 .end = IRQ_IOP321_I2C_0,
87 .flags = IORESOURCE_IRQ
88 }
89};
90
91static struct resource iop32x_i2c_1_resources[] = {
92 [0] = {
93 .start = 0xfffff6a0,
94 .end = 0xfffff6b8,
95 .flags = IORESOURCE_MEM,
96 },
97 [1] = {
98 .start = IRQ_IOP321_I2C_1,
99 .end = IRQ_IOP321_I2C_1,
100 .flags = IORESOURCE_IRQ
101 }
102};
103
104static struct platform_device iop32x_i2c_0_controller = {
105 .name = "IOP3xx-I2C",
106 .id = 0,
107 .num_resources = 2,
108 .resource = iop32x_i2c_0_resources
109};
110
111static struct platform_device iop32x_i2c_1_controller = {
112 .name = "IOP3xx-I2C",
113 .id = 1,
114 .num_resources = 2,
115 .resource = iop32x_i2c_1_resources
116};
117
118static struct platform_device *iop32x_devices[] __initdata = {
119 &iop32x_i2c_0_controller,
120 &iop32x_i2c_1_controller
121};
122
123void __init iop32x_init(void)
124{
125 if(iop_is_321())
126 {
127 platform_add_devices(iop32x_devices,
128 ARRAY_SIZE(iop32x_devices));
129 }
130}
131
132void __init iop321_map_io(void)
133{
134 iotable_init(iop321_std_desc, ARRAY_SIZE(iop321_std_desc));
135 early_serial_setup(&iop321_serial_ports[0]);
136}
137
138#ifdef CONFIG_ARCH_IQ80321
139extern void iq80321_map_io(void);
140extern struct sys_timer iop321_timer;
141extern void iop321_init_time(void);
142#endif
143
144#ifdef CONFIG_ARCH_IQ31244
145extern void iq31244_map_io(void);
146extern struct sys_timer iop321_timer;
147extern void iop321_init_time(void);
148#endif
149
150#if defined(CONFIG_ARCH_IQ80321)
151MACHINE_START(IQ80321, "Intel IQ80321")
Russell Kinge9dea0c2005-07-03 17:38:58 +0100152 /* Maintainer: Intel Corporation */
Russell Kinge9dea0c2005-07-03 17:38:58 +0100153 .phys_io = IQ80321_UART,
154 .io_pg_offst = ((IQ80321_UART) >> 18) & 0xfffc,
155 .map_io = iq80321_map_io,
156 .init_irq = iop321_init_irq,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700157 .timer = &iop321_timer,
Russell Kinge9dea0c2005-07-03 17:38:58 +0100158 .boot_params = 0xa0000100,
159 .init_machine = iop32x_init,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700160MACHINE_END
161#elif defined(CONFIG_ARCH_IQ31244)
162MACHINE_START(IQ31244, "Intel IQ31244")
Russell Kinge9dea0c2005-07-03 17:38:58 +0100163 /* Maintainer: Intel Corp. */
Russell Kinge9dea0c2005-07-03 17:38:58 +0100164 .phys_io = IQ31244_UART,
165 .io_pg_offst = ((IQ31244_UART) >> 18) & 0xfffc,
166 .map_io = iq31244_map_io,
167 .init_irq = iop321_init_irq,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700168 .timer = &iop321_timer,
Russell Kinge9dea0c2005-07-03 17:38:58 +0100169 .boot_params = 0xa0000100,
170 .init_machine = iop32x_init,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700171MACHINE_END
172#else
173#error No machine descriptor defined for this IOP3XX implementation
174#endif