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