blob: 17cb76060125ef0be126d5cc7f8d8c843e390f38 [file] [log] [blame]
Eric Miao49cbe782009-01-20 14:15:18 +08001/*
2 * linux/arch/arm/mach-mmp/aspenite.c
3 *
4 * Support for the Marvell PXA168-based Aspenite and Zylonite2
5 * Development Platform.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * publishhed by the Free Software Foundation.
10 */
Russell King2f8163b2011-07-26 10:53:52 +010011#include <linux/gpio.h>
Eric Miao49cbe782009-01-20 14:15:18 +080012#include <linux/init.h>
Eric Miao9c291f02009-02-10 10:35:25 +080013#include <linux/kernel.h>
Eric Miaoa6b993c2009-02-18 16:38:22 +080014#include <linux/platform_device.h>
15#include <linux/smc91x.h>
Haojian Zhuangef559de2009-09-10 14:37:48 +080016#include <linux/mtd/mtd.h>
17#include <linux/mtd/partitions.h>
18#include <linux/mtd/nand.h>
Haojian Zhuang0bd86962010-09-08 09:42:42 -040019#include <linux/interrupt.h>
Linus Walleijf55be1b2011-09-28 09:11:30 +010020#include <linux/gpio.h>
Eric Miao49cbe782009-01-20 14:15:18 +080021
22#include <asm/mach-types.h>
23#include <asm/mach/arch.h>
24#include <mach/addr-map.h>
Eric Miao9c291f02009-02-10 10:35:25 +080025#include <mach/mfp-pxa168.h>
26#include <mach/pxa168.h>
Mark F. Brown884646a2010-08-25 23:51:55 -040027#include <video/pxa168fb.h>
Mark F. Brown6aafc5f2010-09-03 18:28:11 -040028#include <linux/input.h>
29#include <plat/pxa27x_keypad.h>
Eric Miao49cbe782009-01-20 14:15:18 +080030
31#include "common.h"
32
Eric Miao9c291f02009-02-10 10:35:25 +080033static unsigned long common_pin_config[] __initdata = {
Eric Miaoa6b993c2009-02-18 16:38:22 +080034 /* Data Flash Interface */
35 GPIO0_DFI_D15,
36 GPIO1_DFI_D14,
37 GPIO2_DFI_D13,
38 GPIO3_DFI_D12,
39 GPIO4_DFI_D11,
40 GPIO5_DFI_D10,
41 GPIO6_DFI_D9,
42 GPIO7_DFI_D8,
43 GPIO8_DFI_D7,
44 GPIO9_DFI_D6,
45 GPIO10_DFI_D5,
46 GPIO11_DFI_D4,
47 GPIO12_DFI_D3,
48 GPIO13_DFI_D2,
49 GPIO14_DFI_D1,
50 GPIO15_DFI_D0,
51
52 /* Static Memory Controller */
53 GPIO18_SMC_nCS0,
54 GPIO34_SMC_nCS1,
55 GPIO23_SMC_nLUA,
56 GPIO25_SMC_nLLA,
57 GPIO28_SMC_RDY,
58 GPIO29_SMC_SCLK,
59 GPIO35_SMC_BE1,
60 GPIO36_SMC_BE2,
61 GPIO27_GPIO, /* Ethernet IRQ */
62
Eric Miao9c291f02009-02-10 10:35:25 +080063 /* UART1 */
64 GPIO107_UART1_RXD,
65 GPIO108_UART1_TXD,
Haojian Zhuang07871c12010-03-19 11:55:14 -040066
67 /* SSP1 */
68 GPIO113_I2S_MCLK,
69 GPIO114_I2S_FRM,
70 GPIO115_I2S_BCLK,
71 GPIO116_I2S_RXD,
72 GPIO117_I2S_TXD,
Mark F. Brown884646a2010-08-25 23:51:55 -040073
74 /* LCD */
75 GPIO56_LCD_FCLK_RD,
76 GPIO57_LCD_LCLK_A0,
77 GPIO58_LCD_PCLK_WR,
78 GPIO59_LCD_DENA_BIAS,
79 GPIO60_LCD_DD0,
80 GPIO61_LCD_DD1,
81 GPIO62_LCD_DD2,
82 GPIO63_LCD_DD3,
83 GPIO64_LCD_DD4,
84 GPIO65_LCD_DD5,
85 GPIO66_LCD_DD6,
86 GPIO67_LCD_DD7,
87 GPIO68_LCD_DD8,
88 GPIO69_LCD_DD9,
89 GPIO70_LCD_DD10,
90 GPIO71_LCD_DD11,
91 GPIO72_LCD_DD12,
92 GPIO73_LCD_DD13,
93 GPIO74_LCD_DD14,
94 GPIO75_LCD_DD15,
95 GPIO76_LCD_DD16,
96 GPIO77_LCD_DD17,
97 GPIO78_LCD_DD18,
98 GPIO79_LCD_DD19,
99 GPIO80_LCD_DD20,
100 GPIO81_LCD_DD21,
101 GPIO82_LCD_DD22,
102 GPIO83_LCD_DD23,
Mark F. Brown6aafc5f2010-09-03 18:28:11 -0400103
104 /* Keypad */
105 GPIO109_KP_MKIN1,
106 GPIO110_KP_MKIN0,
107 GPIO111_KP_MKOUT7,
108 GPIO112_KP_MKOUT6,
109 GPIO121_KP_MKIN4,
Eric Miao9c291f02009-02-10 10:35:25 +0800110};
111
Eric Miaoa6b993c2009-02-18 16:38:22 +0800112static struct smc91x_platdata smc91x_info = {
113 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
114};
115
116static struct resource smc91x_resources[] = {
117 [0] = {
118 .start = SMC_CS1_PHYS_BASE + 0x300,
119 .end = SMC_CS1_PHYS_BASE + 0xfffff,
120 .flags = IORESOURCE_MEM,
121 },
122 [1] = {
Haojian Zhuang4929f5a2011-10-10 16:03:51 +0800123 .start = MMP_GPIO_TO_IRQ(27),
124 .end = MMP_GPIO_TO_IRQ(27),
Eric Miaoa6b993c2009-02-18 16:38:22 +0800125 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
126 }
127};
128
129static struct platform_device smc91x_device = {
130 .name = "smc91x",
131 .id = 0,
132 .dev = {
133 .platform_data = &smc91x_info,
134 },
135 .num_resources = ARRAY_SIZE(smc91x_resources),
136 .resource = smc91x_resources,
137};
138
Haojian Zhuangef559de2009-09-10 14:37:48 +0800139static struct mtd_partition aspenite_nand_partitions[] = {
140 {
141 .name = "bootloader",
142 .offset = 0,
143 .size = SZ_1M,
144 .mask_flags = MTD_WRITEABLE,
145 }, {
146 .name = "reserved",
147 .offset = MTDPART_OFS_APPEND,
148 .size = SZ_128K,
149 .mask_flags = MTD_WRITEABLE,
150 }, {
151 .name = "reserved",
152 .offset = MTDPART_OFS_APPEND,
153 .size = SZ_8M,
154 .mask_flags = MTD_WRITEABLE,
155 }, {
156 .name = "kernel",
157 .offset = MTDPART_OFS_APPEND,
158 .size = (SZ_2M + SZ_1M),
159 .mask_flags = 0,
160 }, {
161 .name = "filesystem",
162 .offset = MTDPART_OFS_APPEND,
Stephen Boyd3f8e2882011-07-26 18:45:54 +0100163 .size = SZ_32M + SZ_16M,
Haojian Zhuangef559de2009-09-10 14:37:48 +0800164 .mask_flags = 0,
165 }
166};
167
168static struct pxa3xx_nand_platform_data aspenite_nand_info = {
169 .enable_arbiter = 1,
Lei Wenf3c8cfc2011-07-14 20:44:33 -0700170 .num_cs = 1,
171 .parts[0] = aspenite_nand_partitions,
172 .nr_parts[0] = ARRAY_SIZE(aspenite_nand_partitions),
Haojian Zhuangef559de2009-09-10 14:37:48 +0800173};
174
Haojian Zhuang07871c12010-03-19 11:55:14 -0400175static struct i2c_board_info aspenite_i2c_info[] __initdata = {
176 { I2C_BOARD_INFO("wm8753", 0x1b), },
177};
178
Mark F. Brown884646a2010-08-25 23:51:55 -0400179static struct fb_videomode video_modes[] = {
180 [0] = {
181 .pixclock = 30120,
182 .refresh = 60,
183 .xres = 800,
184 .yres = 480,
185 .hsync_len = 1,
186 .left_margin = 215,
187 .right_margin = 40,
188 .vsync_len = 1,
189 .upper_margin = 34,
190 .lower_margin = 10,
191 .sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT,
192 },
193};
194
195struct pxa168fb_mach_info aspenite_lcd_info = {
196 .id = "Graphic Frame",
197 .modes = video_modes,
198 .num_modes = ARRAY_SIZE(video_modes),
199 .pix_fmt = PIX_FMT_RGB565,
200 .io_pin_allocation_mode = PIN_MODE_DUMB_24,
201 .dumb_mode = DUMB_MODE_RGB888,
202 .active = 1,
203 .panel_rbswap = 0,
204 .invert_pixclock = 0,
205};
206
Mark F. Brown6aafc5f2010-09-03 18:28:11 -0400207static unsigned int aspenite_matrix_key_map[] = {
208 KEY(0, 6, KEY_UP), /* SW 4 */
209 KEY(0, 7, KEY_DOWN), /* SW 5 */
210 KEY(1, 6, KEY_LEFT), /* SW 6 */
211 KEY(1, 7, KEY_RIGHT), /* SW 7 */
212 KEY(4, 6, KEY_ENTER), /* SW 8 */
213 KEY(4, 7, KEY_ESC), /* SW 9 */
214};
215
216static struct pxa27x_keypad_platform_data aspenite_keypad_info __initdata = {
217 .matrix_key_rows = 5,
218 .matrix_key_cols = 8,
219 .matrix_key_map = aspenite_matrix_key_map,
220 .matrix_key_map_size = ARRAY_SIZE(aspenite_matrix_key_map),
221 .debounce_interval = 30,
222};
223
Eric Miao49cbe782009-01-20 14:15:18 +0800224static void __init common_init(void)
225{
Eric Miao9c291f02009-02-10 10:35:25 +0800226 mfp_config(ARRAY_AND_SIZE(common_pin_config));
227
Eric Miaoa6b993c2009-02-18 16:38:22 +0800228 /* on-chip devices */
Eric Miao9c291f02009-02-10 10:35:25 +0800229 pxa168_add_uart(1);
Haojian Zhuang07871c12010-03-19 11:55:14 -0400230 pxa168_add_twsi(1, NULL, ARRAY_AND_SIZE(aspenite_i2c_info));
231 pxa168_add_ssp(1);
Haojian Zhuangef559de2009-09-10 14:37:48 +0800232 pxa168_add_nand(&aspenite_nand_info);
Mark F. Brown884646a2010-08-25 23:51:55 -0400233 pxa168_add_fb(&aspenite_lcd_info);
Mark F. Brown6aafc5f2010-09-03 18:28:11 -0400234 pxa168_add_keypad(&aspenite_keypad_info);
Haojian Zhuang157d2642011-10-17 20:37:52 +0800235 platform_device_register(&pxa168_device_gpio);
Eric Miaoa6b993c2009-02-18 16:38:22 +0800236
237 /* off-chip devices */
238 platform_device_register(&smc91x_device);
Eric Miao49cbe782009-01-20 14:15:18 +0800239}
240
241MACHINE_START(ASPENITE, "PXA168-based Aspenite Development Platform")
Eric Miao80228872010-07-15 17:50:13 +0800242 .map_io = mmp_map_io,
Haojian Zhuang0bd86962010-09-08 09:42:42 -0400243 .nr_irqs = IRQ_BOARD_START,
Eric Miao49cbe782009-01-20 14:15:18 +0800244 .init_irq = pxa168_init_irq,
245 .timer = &pxa168_timer,
246 .init_machine = common_init,
Russell King9854a382011-11-05 15:40:09 +0000247 .restart = pxa168_restart,
Eric Miao49cbe782009-01-20 14:15:18 +0800248MACHINE_END
249
250MACHINE_START(ZYLONITE2, "PXA168-based Zylonite2 Development Platform")
Eric Miao80228872010-07-15 17:50:13 +0800251 .map_io = mmp_map_io,
Haojian Zhuang0bd86962010-09-08 09:42:42 -0400252 .nr_irqs = IRQ_BOARD_START,
Eric Miao49cbe782009-01-20 14:15:18 +0800253 .init_irq = pxa168_init_irq,
254 .timer = &pxa168_timer,
255 .init_machine = common_init,
Russell King9854a382011-11-05 15:40:09 +0000256 .restart = pxa168_restart,
Eric Miao49cbe782009-01-20 14:15:18 +0800257MACHINE_END