Merge commit 'gcl/merge' into merge
[linux-2.6] / arch / arm / mach-mx1 / mx1ads.c
1 /*
2  * arch/arm/mach-imx/mx1ads.c
3  *
4  * Initially based on:
5  *      linux-2.6.7-imx/arch/arm/mach-imx/scb9328.c
6  *      Copyright (c) 2004 Sascha Hauer <sascha@saschahauer.de>
7  *
8  * 2004 (c) MontaVista Software, Inc.
9  *
10  * This file is licensed under the terms of the GNU General Public
11  * License version 2. This program is licensed "as is" without any
12  * warranty of any kind, whether express or implied.
13  */
14
15 #include <linux/kernel.h>
16 #include <linux/init.h>
17 #include <linux/platform_device.h>
18 #include <linux/mtd/physmap.h>
19
20 #include <asm/mach-types.h>
21 #include <asm/mach/arch.h>
22 #include <asm/mach/time.h>
23
24 #include <mach/irqs.h>
25 #include <mach/hardware.h>
26 #include <mach/common.h>
27 #include <mach/imx-uart.h>
28 #include <mach/iomux-mx1-mx2.h>
29 #include "devices.h"
30
31 /*
32  * UARTs platform data
33  */
34 static int mxc_uart1_pins[] = {
35         PC9_PF_UART1_CTS,
36         PC10_PF_UART1_RTS,
37         PC11_PF_UART1_TXD,
38         PC12_PF_UART1_RXD,
39 };
40
41 static int uart1_mxc_init(struct platform_device *pdev)
42 {
43         return mxc_gpio_setup_multiple_pins(mxc_uart1_pins,
44                         ARRAY_SIZE(mxc_uart1_pins), "UART1");
45 }
46
47 static int uart1_mxc_exit(struct platform_device *pdev)
48 {
49         mxc_gpio_release_multiple_pins(mxc_uart1_pins,
50                         ARRAY_SIZE(mxc_uart1_pins));
51         return 0;
52 }
53
54 static int mxc_uart2_pins[] = {
55         PB28_PF_UART2_CTS,
56         PB29_PF_UART2_RTS,
57         PB30_PF_UART2_TXD,
58         PB31_PF_UART2_RXD,
59 };
60
61 static int uart2_mxc_init(struct platform_device *pdev)
62 {
63         return mxc_gpio_setup_multiple_pins(mxc_uart2_pins,
64                         ARRAY_SIZE(mxc_uart2_pins), "UART2");
65 }
66
67 static int uart2_mxc_exit(struct platform_device *pdev)
68 {
69         mxc_gpio_release_multiple_pins(mxc_uart2_pins,
70                         ARRAY_SIZE(mxc_uart2_pins));
71         return 0;
72 }
73
74 static struct imxuart_platform_data uart_pdata[] = {
75         {
76                 .init = uart1_mxc_init,
77                 .exit = uart1_mxc_exit,
78                 .flags = IMXUART_HAVE_RTSCTS,
79         }, {
80                 .init = uart2_mxc_init,
81                 .exit = uart2_mxc_exit,
82                 .flags = IMXUART_HAVE_RTSCTS,
83         },
84 };
85
86 /*
87  * Physmap flash
88  */
89
90 static struct physmap_flash_data mx1ads_flash_data = {
91         .width          = 4,            /* bankwidth in bytes */
92 };
93
94 static struct resource flash_resource = {
95         .start  = IMX_CS0_PHYS,
96         .end    = IMX_CS0_PHYS + SZ_32M - 1,
97         .flags  = IORESOURCE_MEM,
98 };
99
100 static struct platform_device flash_device = {
101         .name   = "physmap-flash",
102         .id     = 0,
103         .resource = &flash_resource,
104         .num_resources = 1,
105 };
106
107 /*
108  * Board init
109  */
110 static void __init mx1ads_init(void)
111 {
112         /* UART */
113         mxc_register_device(&imx_uart1_device, &uart_pdata[0]);
114         mxc_register_device(&imx_uart2_device, &uart_pdata[1]);
115
116         /* Physmap flash */
117         mxc_register_device(&flash_device, &mx1ads_flash_data);
118 }
119
120 static void __init mx1ads_timer_init(void)
121 {
122         mxc_clocks_init(32000);
123         mxc_timer_init("gpt_clk");
124 }
125
126 struct sys_timer mx1ads_timer = {
127         .init   = mx1ads_timer_init,
128 };
129
130 MACHINE_START(MX1ADS, "Freescale MX1ADS")
131         /* Maintainer: Sascha Hauer, Pengutronix */
132         .phys_io        = IMX_IO_PHYS,
133         .io_pg_offst    = (IMX_IO_BASE >> 18) & 0xfffc,
134         .boot_params    = PHYS_OFFSET + 0x100,
135         .map_io         = mxc_map_io,
136         .init_irq       = mxc_init_irq,
137         .timer          = &mx1ads_timer,
138         .init_machine   = mx1ads_init,
139 MACHINE_END
140
141 MACHINE_START(MXLADS, "Freescale MXLADS")
142         .phys_io        = IMX_IO_PHYS,
143         .io_pg_offst    = (IMX_IO_BASE >> 18) & 0xfffc,
144         .boot_params    = PHYS_OFFSET + 0x100,
145         .map_io         = mxc_map_io,
146         .init_irq       = mxc_init_irq,
147         .timer          = &mx1ads_timer,
148         .init_machine   = mx1ads_init,
149 MACHINE_END