[SCSI] ibmvscsi: convert kmalloc + memset to kcalloc
[wrt350n-kernel.git] / arch / arm / mach-iop3xx / iop321-setup.c
blob0ebbcb20c6ae2ab3a43177a019c51ec254d16400
1 /*
2 * linux/arch/arm/mach-iop3xx/iop321-setup.c
4 * Author: Nicolas Pitre <nico@cam.org>
5 * Copyright (C) 2001 MontaVista Software, Inc.
6 * Copyright (C) 2004 Intel Corporation.
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.
13 #include <linux/mm.h>
14 #include <linux/init.h>
15 #include <linux/config.h>
16 #include <linux/major.h>
17 #include <linux/fs.h>
18 #include <linux/platform_device.h>
19 #include <linux/serial.h>
20 #include <linux/tty.h>
21 #include <linux/serial_core.h>
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>
34 #define IOP321_UART_XTAL 1843200
37 * Standard IO mapping for all IOP321 based systems
39 static struct map_desc iop321_std_desc[] __initdata = {
40 { /* 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
53 #ifdef CONFIG_ARCH_IQ80321
54 #define UARTBASE IQ80321_UART
55 #define IRQ_UART IRQ_IQ80321_UART
56 #endif
58 #ifdef CONFIG_ARCH_IQ31244
59 #define UARTBASE IQ31244_UART
60 #define IRQ_UART IRQ_IQ31244_UART
61 #endif
63 static struct uart_port iop321_serial_ports[] = {
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
78 static struct resource iop32x_i2c_0_resources[] = {
79 [0] = {
80 .start = 0xfffff680,
81 .end = 0xfffff698,
82 .flags = IORESOURCE_MEM,
84 [1] = {
85 .start = IRQ_IOP321_I2C_0,
86 .end = IRQ_IOP321_I2C_0,
87 .flags = IORESOURCE_IRQ
91 static struct resource iop32x_i2c_1_resources[] = {
92 [0] = {
93 .start = 0xfffff6a0,
94 .end = 0xfffff6b8,
95 .flags = IORESOURCE_MEM,
97 [1] = {
98 .start = IRQ_IOP321_I2C_1,
99 .end = IRQ_IOP321_I2C_1,
100 .flags = IORESOURCE_IRQ
104 static struct platform_device iop32x_i2c_0_controller = {
105 .name = "IOP3xx-I2C",
106 .id = 0,
107 .num_resources = 2,
108 .resource = iop32x_i2c_0_resources
111 static struct platform_device iop32x_i2c_1_controller = {
112 .name = "IOP3xx-I2C",
113 .id = 1,
114 .num_resources = 2,
115 .resource = iop32x_i2c_1_resources
118 static struct platform_device *iop32x_devices[] __initdata = {
119 &iop32x_i2c_0_controller,
120 &iop32x_i2c_1_controller
123 void __init iop32x_init(void)
125 if(iop_is_321())
127 platform_add_devices(iop32x_devices,
128 ARRAY_SIZE(iop32x_devices));
132 void __init iop321_map_io(void)
134 iotable_init(iop321_std_desc, ARRAY_SIZE(iop321_std_desc));
135 early_serial_setup(&iop321_serial_ports[0]);
138 #ifdef CONFIG_ARCH_IQ80321
139 extern void iq80321_map_io(void);
140 extern struct sys_timer iop321_timer;
141 extern void iop321_init_time(void);
142 #endif
144 #ifdef CONFIG_ARCH_IQ31244
145 extern void iq31244_map_io(void);
146 extern struct sys_timer iop321_timer;
147 extern void iop321_init_time(void);
148 #endif
150 #if defined(CONFIG_ARCH_IQ80321)
151 MACHINE_START(IQ80321, "Intel IQ80321")
152 /* Maintainer: Intel Corporation */
153 .phys_io = IQ80321_UART,
154 .io_pg_offst = ((IQ80321_UART) >> 18) & 0xfffc,
155 .map_io = iq80321_map_io,
156 .init_irq = iop321_init_irq,
157 .timer = &iop321_timer,
158 .boot_params = 0xa0000100,
159 .init_machine = iop32x_init,
160 MACHINE_END
161 #elif defined(CONFIG_ARCH_IQ31244)
162 MACHINE_START(IQ31244, "Intel IQ31244")
163 /* Maintainer: Intel Corp. */
164 .phys_io = IQ31244_UART,
165 .io_pg_offst = ((IQ31244_UART) >> 18) & 0xfffc,
166 .map_io = iq31244_map_io,
167 .init_irq = iop321_init_irq,
168 .timer = &iop321_timer,
169 .boot_params = 0xa0000100,
170 .init_machine = iop32x_init,
171 MACHINE_END
172 #else
173 #error No machine descriptor defined for this IOP3XX implementation
174 #endif