[ARM] 3819/1: iop3xx: factor out shared i2c code
[linux-2.6] / arch / arm / mach-iop32x / setup.c
1 /*
2  * linux/arch/arm/mach-iop32x/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/major.h>
16 #include <linux/fs.h>
17 #include <linux/platform_device.h>
18 #include <linux/serial.h>
19 #include <linux/tty.h>
20 #include <linux/serial_core.h>
21
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 #include <asm/hardware/iop3xx.h>
33
34 #define IOP321_UART_XTAL 1843200
35
36 #ifdef CONFIG_ARCH_IQ80321
37 #define UARTBASE IQ80321_UART
38 #define IRQ_UART IRQ_IQ80321_UART
39 #endif
40
41 #ifdef CONFIG_ARCH_IQ31244
42 #define UARTBASE IQ31244_UART
43 #define IRQ_UART IRQ_IQ31244_UART
44 #endif
45
46 static struct uart_port iop321_serial_ports[] = {
47         {
48                 .membase        = (char*)(UARTBASE),
49                 .mapbase        = (UARTBASE),
50                 .irq            = IRQ_UART,
51                 .flags          = UPF_SKIP_TEST,
52                 .iotype         = UPIO_MEM,
53                 .regshift       = 0,
54                 .uartclk        = IOP321_UART_XTAL,
55                 .line           = 0,
56                 .type           = PORT_16550A,
57                 .fifosize       = 16
58         }
59 };
60
61 void __init iop32x_init(void)
62 {
63         platform_device_register(&iop3xx_i2c0_device);
64         platform_device_register(&iop3xx_i2c1_device);
65         early_serial_setup(&iop321_serial_ports[0]);
66 }
67
68 #ifdef CONFIG_ARCH_IQ80321
69 extern void iq80321_map_io(void);
70 extern struct sys_timer iop321_timer;
71 extern void iop321_init_time(void);
72 #endif
73
74 #ifdef CONFIG_ARCH_IQ31244
75 extern void iq31244_map_io(void);
76 extern struct sys_timer iop321_timer;
77 extern void iop321_init_time(void);
78 #endif
79
80 #if defined(CONFIG_ARCH_IQ80321)
81 MACHINE_START(IQ80321, "Intel IQ80321")
82         /* Maintainer: Intel Corporation */
83         .phys_io        = IQ80321_UART,
84         .io_pg_offst    = ((IQ80321_UART) >> 18) & 0xfffc,
85         .map_io         = iq80321_map_io,
86         .init_irq       = iop321_init_irq,
87         .timer          = &iop321_timer,
88         .boot_params    = 0xa0000100,
89         .init_machine   = iop32x_init,
90 MACHINE_END
91 #elif defined(CONFIG_ARCH_IQ31244)
92 MACHINE_START(IQ31244, "Intel IQ31244")
93         /* Maintainer: Intel Corp. */
94         .phys_io        = IQ31244_UART,
95         .io_pg_offst    = ((IQ31244_UART) >> 18) & 0xfffc,
96         .map_io         = iq31244_map_io,
97         .init_irq       = iop321_init_irq,
98         .timer          = &iop321_timer,
99         .boot_params    = 0xa0000100,
100         .init_machine   = iop32x_init,
101 MACHINE_END
102 #else
103 #error No machine descriptor defined for this IOP3XX implementation
104 #endif