mm: Support fadvise without CONFIG_MMU
[sfrench/cifs-2.6.git] / arch / arm / mach-imx / mach-mx1ads.c
1 /*
2  * arch/arm/mach-imx/mach-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/i2c.h>
16 #include <linux/i2c/pcf857x.h>
17 #include <linux/init.h>
18 #include <linux/kernel.h>
19 #include <linux/platform_device.h>
20 #include <linux/mtd/physmap.h>
21
22 #include <asm/mach-types.h>
23 #include <asm/mach/arch.h>
24 #include <asm/mach/time.h>
25
26 #include "common.h"
27 #include "devices-imx1.h"
28 #include "hardware.h"
29 #include "iomux-mx1.h"
30
31 static const int mx1ads_pins[] __initconst = {
32         /* UART1 */
33         PC9_PF_UART1_CTS,
34         PC10_PF_UART1_RTS,
35         PC11_PF_UART1_TXD,
36         PC12_PF_UART1_RXD,
37         /* UART2 */
38         PB28_PF_UART2_CTS,
39         PB29_PF_UART2_RTS,
40         PB30_PF_UART2_TXD,
41         PB31_PF_UART2_RXD,
42         /* I2C */
43         PA15_PF_I2C_SDA,
44         PA16_PF_I2C_SCL,
45         /* SPI */
46         PC13_PF_SPI1_SPI_RDY,
47         PC14_PF_SPI1_SCLK,
48         PC15_PF_SPI1_SS,
49         PC16_PF_SPI1_MISO,
50         PC17_PF_SPI1_MOSI,
51 };
52
53 /*
54  * UARTs platform data
55  */
56
57 static const struct imxuart_platform_data uart0_pdata __initconst = {
58         .flags = IMXUART_HAVE_RTSCTS,
59 };
60        
61 static const struct imxuart_platform_data uart1_pdata __initconst = {
62         .flags = IMXUART_HAVE_RTSCTS,
63 };
64
65 /*
66  * Physmap flash
67  */
68
69 static const struct physmap_flash_data mx1ads_flash_data __initconst = {
70         .width          = 4,            /* bankwidth in bytes */
71 };
72
73 static const struct resource flash_resource __initconst = {
74         .start  = MX1_CS0_PHYS,
75         .end    = MX1_CS0_PHYS + SZ_32M - 1,
76         .flags  = IORESOURCE_MEM,
77 };
78
79 /*
80  * I2C
81  */
82 static struct pcf857x_platform_data pcf857x_data[] = {
83         {
84                 .gpio_base = 4 * 32,
85         }, {
86                 .gpio_base = 4 * 32 + 16,
87         }
88 };
89
90 static const struct imxi2c_platform_data mx1ads_i2c_data __initconst = {
91         .bitrate = 100000,
92 };
93
94 static struct i2c_board_info mx1ads_i2c_devices[] = {
95         {
96                 I2C_BOARD_INFO("pcf8575", 0x22),
97                 .platform_data = &pcf857x_data[0],
98         }, {
99                 I2C_BOARD_INFO("pcf8575", 0x24),
100                 .platform_data = &pcf857x_data[1],
101         },
102 };
103
104 /*
105  * Board init
106  */
107 static void __init mx1ads_init(void)
108 {
109         imx1_soc_init();
110
111         mxc_gpio_setup_multiple_pins(mx1ads_pins,
112                 ARRAY_SIZE(mx1ads_pins), "mx1ads");
113
114         /* UART */
115         imx1_add_imx_uart0(&uart0_pdata);
116         imx1_add_imx_uart1(&uart1_pdata);
117
118         /* Physmap flash */
119         platform_device_register_resndata(NULL, "physmap-flash", 0,
120                         &flash_resource, 1,
121                         &mx1ads_flash_data, sizeof(mx1ads_flash_data));
122
123         /* I2C */
124         i2c_register_board_info(0, mx1ads_i2c_devices,
125                                 ARRAY_SIZE(mx1ads_i2c_devices));
126
127         imx1_add_imx_i2c(&mx1ads_i2c_data);
128 }
129
130 static void __init mx1ads_timer_init(void)
131 {
132         mx1_clocks_init(32000);
133 }
134
135 MACHINE_START(MX1ADS, "Freescale MX1ADS")
136         /* Maintainer: Sascha Hauer, Pengutronix */
137         .atag_offset = 0x100,
138         .map_io = mx1_map_io,
139         .init_early = imx1_init_early,
140         .init_irq = mx1_init_irq,
141         .init_time      = mx1ads_timer_init,
142         .init_machine = mx1ads_init,
143         .restart        = mxc_restart,
144 MACHINE_END
145
146 MACHINE_START(MXLADS, "Freescale MXLADS")
147         .atag_offset = 0x100,
148         .map_io = mx1_map_io,
149         .init_early = imx1_init_early,
150         .init_irq = mx1_init_irq,
151         .init_time      = mx1ads_timer_init,
152         .init_machine = mx1ads_init,
153         .restart        = mxc_restart,
154 MACHINE_END