Commit | Line | Data |
---|---|---|
cfca8b53 PZ |
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> | |
b8b19b0d SH |
19 | #include <linux/i2c.h> |
20 | #include <linux/i2c/pcf857x.h> | |
cfca8b53 PZ |
21 | |
22 | #include <asm/mach-types.h> | |
23 | #include <asm/mach/arch.h> | |
24 | #include <asm/mach/time.h> | |
25 | ||
20214fcd | 26 | #include <mach/irqs.h> |
cfca8b53 PZ |
27 | #include <mach/hardware.h> |
28 | #include <mach/common.h> | |
29 | #include <mach/imx-uart.h> | |
b8b19b0d | 30 | #include <mach/irqs.h> |
b8b19b0d | 31 | #include <mach/i2c.h> |
ccfe30a7 | 32 | #include <mach/iomux.h> |
cfca8b53 PZ |
33 | #include "devices.h" |
34 | ||
35 | /* | |
36 | * UARTs platform data | |
37 | */ | |
38 | static int mxc_uart1_pins[] = { | |
39 | PC9_PF_UART1_CTS, | |
40 | PC10_PF_UART1_RTS, | |
41 | PC11_PF_UART1_TXD, | |
42 | PC12_PF_UART1_RXD, | |
43 | }; | |
44 | ||
45 | static int uart1_mxc_init(struct platform_device *pdev) | |
46 | { | |
47 | return mxc_gpio_setup_multiple_pins(mxc_uart1_pins, | |
48 | ARRAY_SIZE(mxc_uart1_pins), "UART1"); | |
49 | } | |
50 | ||
51 | static int uart1_mxc_exit(struct platform_device *pdev) | |
52 | { | |
53 | mxc_gpio_release_multiple_pins(mxc_uart1_pins, | |
54 | ARRAY_SIZE(mxc_uart1_pins)); | |
55 | return 0; | |
56 | } | |
57 | ||
58 | static int mxc_uart2_pins[] = { | |
59 | PB28_PF_UART2_CTS, | |
60 | PB29_PF_UART2_RTS, | |
61 | PB30_PF_UART2_TXD, | |
62 | PB31_PF_UART2_RXD, | |
63 | }; | |
64 | ||
65 | static int uart2_mxc_init(struct platform_device *pdev) | |
66 | { | |
67 | return mxc_gpio_setup_multiple_pins(mxc_uart2_pins, | |
68 | ARRAY_SIZE(mxc_uart2_pins), "UART2"); | |
69 | } | |
70 | ||
71 | static int uart2_mxc_exit(struct platform_device *pdev) | |
72 | { | |
73 | mxc_gpio_release_multiple_pins(mxc_uart2_pins, | |
74 | ARRAY_SIZE(mxc_uart2_pins)); | |
75 | return 0; | |
76 | } | |
77 | ||
78 | static struct imxuart_platform_data uart_pdata[] = { | |
79 | { | |
80 | .init = uart1_mxc_init, | |
81 | .exit = uart1_mxc_exit, | |
82 | .flags = IMXUART_HAVE_RTSCTS, | |
83 | }, { | |
84 | .init = uart2_mxc_init, | |
85 | .exit = uart2_mxc_exit, | |
86 | .flags = IMXUART_HAVE_RTSCTS, | |
87 | }, | |
88 | }; | |
89 | ||
90 | /* | |
91 | * Physmap flash | |
92 | */ | |
93 | ||
94 | static struct physmap_flash_data mx1ads_flash_data = { | |
95 | .width = 4, /* bankwidth in bytes */ | |
96 | }; | |
97 | ||
98 | static struct resource flash_resource = { | |
99 | .start = IMX_CS0_PHYS, | |
100 | .end = IMX_CS0_PHYS + SZ_32M - 1, | |
101 | .flags = IORESOURCE_MEM, | |
102 | }; | |
103 | ||
104 | static struct platform_device flash_device = { | |
105 | .name = "physmap-flash", | |
106 | .id = 0, | |
107 | .resource = &flash_resource, | |
108 | .num_resources = 1, | |
109 | }; | |
110 | ||
b8b19b0d SH |
111 | /* |
112 | * I2C | |
113 | */ | |
114 | ||
b8b19b0d SH |
115 | static int i2c_pins[] = { |
116 | PA15_PF_I2C_SDA, | |
117 | PA16_PF_I2C_SCL, | |
118 | }; | |
119 | ||
120 | static int i2c_init(struct device *dev) | |
121 | { | |
122 | return mxc_gpio_setup_multiple_pins(i2c_pins, | |
123 | ARRAY_SIZE(i2c_pins), "I2C"); | |
124 | } | |
125 | ||
126 | static void i2c_exit(struct device *dev) | |
127 | { | |
128 | mxc_gpio_release_multiple_pins(i2c_pins, | |
129 | ARRAY_SIZE(i2c_pins)); | |
130 | } | |
131 | ||
132 | static struct pcf857x_platform_data pcf857x_data[] = { | |
133 | { | |
134 | .gpio_base = 4 * 32, | |
135 | }, { | |
136 | .gpio_base = 4 * 32 + 16, | |
137 | } | |
138 | }; | |
139 | ||
140 | static struct imxi2c_platform_data mx1ads_i2c_data = { | |
141 | .bitrate = 100000, | |
142 | .init = i2c_init, | |
143 | .exit = i2c_exit, | |
144 | }; | |
145 | ||
146 | static struct i2c_board_info mx1ads_i2c_devices[] = { | |
147 | { | |
148 | I2C_BOARD_INFO("pcf857x", 0x22), | |
149 | .type = "pcf8575", | |
150 | .platform_data = &pcf857x_data[0], | |
151 | }, { | |
152 | I2C_BOARD_INFO("pcf857x", 0x24), | |
153 | .type = "pcf8575", | |
154 | .platform_data = &pcf857x_data[1], | |
155 | }, | |
156 | }; | |
b8b19b0d | 157 | |
cfca8b53 PZ |
158 | /* |
159 | * Board init | |
160 | */ | |
161 | static void __init mx1ads_init(void) | |
162 | { | |
163 | /* UART */ | |
164 | mxc_register_device(&imx_uart1_device, &uart_pdata[0]); | |
165 | mxc_register_device(&imx_uart2_device, &uart_pdata[1]); | |
166 | ||
167 | /* Physmap flash */ | |
168 | mxc_register_device(&flash_device, &mx1ads_flash_data); | |
b8b19b0d SH |
169 | |
170 | /* I2C */ | |
b8b19b0d SH |
171 | i2c_register_board_info(0, mx1ads_i2c_devices, |
172 | ARRAY_SIZE(mx1ads_i2c_devices)); | |
173 | ||
174 | mxc_register_device(&imx_i2c_device, &mx1ads_i2c_data); | |
cfca8b53 PZ |
175 | } |
176 | ||
177 | static void __init mx1ads_timer_init(void) | |
178 | { | |
30c730f8 | 179 | mx1_clocks_init(32000); |
cfca8b53 PZ |
180 | } |
181 | ||
182 | struct sys_timer mx1ads_timer = { | |
183 | .init = mx1ads_timer_init, | |
184 | }; | |
185 | ||
186 | MACHINE_START(MX1ADS, "Freescale MX1ADS") | |
187 | /* Maintainer: Sascha Hauer, Pengutronix */ | |
188 | .phys_io = IMX_IO_PHYS, | |
189 | .io_pg_offst = (IMX_IO_BASE >> 18) & 0xfffc, | |
190 | .boot_params = PHYS_OFFSET + 0x100, | |
191 | .map_io = mxc_map_io, | |
192 | .init_irq = mxc_init_irq, | |
193 | .timer = &mx1ads_timer, | |
194 | .init_machine = mx1ads_init, | |
195 | MACHINE_END | |
196 | ||
197 | MACHINE_START(MXLADS, "Freescale MXLADS") | |
198 | .phys_io = IMX_IO_PHYS, | |
199 | .io_pg_offst = (IMX_IO_BASE >> 18) & 0xfffc, | |
200 | .boot_params = PHYS_OFFSET + 0x100, | |
201 | .map_io = mxc_map_io, | |
202 | .init_irq = mxc_init_irq, | |
203 | .timer = &mx1ads_timer, | |
204 | .init_machine = mx1ads_init, | |
205 | MACHINE_END |