| Eric Miao | 49cbe78 | 2009-01-20 14:15:18 +0800 | [diff] [blame] | 1 | /* | 
|  | 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 King | 2f8163b | 2011-07-26 10:53:52 +0100 | [diff] [blame] | 11 | #include <linux/gpio.h> | 
| Eric Miao | 49cbe78 | 2009-01-20 14:15:18 +0800 | [diff] [blame] | 12 | #include <linux/init.h> | 
| Eric Miao | 9c291f0 | 2009-02-10 10:35:25 +0800 | [diff] [blame] | 13 | #include <linux/kernel.h> | 
| Eric Miao | a6b993c | 2009-02-18 16:38:22 +0800 | [diff] [blame] | 14 | #include <linux/platform_device.h> | 
|  | 15 | #include <linux/smc91x.h> | 
| Haojian Zhuang | ef559de | 2009-09-10 14:37:48 +0800 | [diff] [blame] | 16 | #include <linux/mtd/mtd.h> | 
|  | 17 | #include <linux/mtd/partitions.h> | 
|  | 18 | #include <linux/mtd/nand.h> | 
| Haojian Zhuang | 0bd8696 | 2010-09-08 09:42:42 -0400 | [diff] [blame] | 19 | #include <linux/interrupt.h> | 
| Neil Zhang | 7357867 | 2012-05-03 15:55:10 +0800 | [diff] [blame] | 20 | #include <linux/platform_data/mv_usb.h> | 
| Eric Miao | 49cbe78 | 2009-01-20 14:15:18 +0800 | [diff] [blame] | 21 |  | 
|  | 22 | #include <asm/mach-types.h> | 
|  | 23 | #include <asm/mach/arch.h> | 
|  | 24 | #include <mach/addr-map.h> | 
| Eric Miao | 9c291f0 | 2009-02-10 10:35:25 +0800 | [diff] [blame] | 25 | #include <mach/mfp-pxa168.h> | 
|  | 26 | #include <mach/pxa168.h> | 
| Rob Herring | 8661fb9 | 2012-01-03 16:50:40 -0600 | [diff] [blame] | 27 | #include <mach/irqs.h> | 
| Mark F. Brown | 884646a | 2010-08-25 23:51:55 -0400 | [diff] [blame] | 28 | #include <video/pxa168fb.h> | 
| Mark F. Brown | 6aafc5f | 2010-09-03 18:28:11 -0400 | [diff] [blame] | 29 | #include <linux/input.h> | 
| Arnd Bergmann | 293b2da | 2012-08-24 15:16:48 +0200 | [diff] [blame] | 30 | #include <linux/platform_data/keypad-pxa27x.h> | 
| Eric Miao | 49cbe78 | 2009-01-20 14:15:18 +0800 | [diff] [blame] | 31 |  | 
|  | 32 | #include "common.h" | 
|  | 33 |  | 
| Eric Miao | 9c291f0 | 2009-02-10 10:35:25 +0800 | [diff] [blame] | 34 | static unsigned long common_pin_config[] __initdata = { | 
| Eric Miao | a6b993c | 2009-02-18 16:38:22 +0800 | [diff] [blame] | 35 | /* Data Flash Interface */ | 
|  | 36 | GPIO0_DFI_D15, | 
|  | 37 | GPIO1_DFI_D14, | 
|  | 38 | GPIO2_DFI_D13, | 
|  | 39 | GPIO3_DFI_D12, | 
|  | 40 | GPIO4_DFI_D11, | 
|  | 41 | GPIO5_DFI_D10, | 
|  | 42 | GPIO6_DFI_D9, | 
|  | 43 | GPIO7_DFI_D8, | 
|  | 44 | GPIO8_DFI_D7, | 
|  | 45 | GPIO9_DFI_D6, | 
|  | 46 | GPIO10_DFI_D5, | 
|  | 47 | GPIO11_DFI_D4, | 
|  | 48 | GPIO12_DFI_D3, | 
|  | 49 | GPIO13_DFI_D2, | 
|  | 50 | GPIO14_DFI_D1, | 
|  | 51 | GPIO15_DFI_D0, | 
|  | 52 |  | 
|  | 53 | /* Static Memory Controller */ | 
|  | 54 | GPIO18_SMC_nCS0, | 
|  | 55 | GPIO34_SMC_nCS1, | 
|  | 56 | GPIO23_SMC_nLUA, | 
|  | 57 | GPIO25_SMC_nLLA, | 
|  | 58 | GPIO28_SMC_RDY, | 
|  | 59 | GPIO29_SMC_SCLK, | 
|  | 60 | GPIO35_SMC_BE1, | 
|  | 61 | GPIO36_SMC_BE2, | 
|  | 62 | GPIO27_GPIO,	/* Ethernet IRQ */ | 
|  | 63 |  | 
| Eric Miao | 9c291f0 | 2009-02-10 10:35:25 +0800 | [diff] [blame] | 64 | /* UART1 */ | 
|  | 65 | GPIO107_UART1_RXD, | 
|  | 66 | GPIO108_UART1_TXD, | 
| Haojian Zhuang | 07871c1 | 2010-03-19 11:55:14 -0400 | [diff] [blame] | 67 |  | 
|  | 68 | /* SSP1 */ | 
|  | 69 | GPIO113_I2S_MCLK, | 
|  | 70 | GPIO114_I2S_FRM, | 
|  | 71 | GPIO115_I2S_BCLK, | 
|  | 72 | GPIO116_I2S_RXD, | 
|  | 73 | GPIO117_I2S_TXD, | 
| Mark F. Brown | 884646a | 2010-08-25 23:51:55 -0400 | [diff] [blame] | 74 |  | 
|  | 75 | /* LCD */ | 
|  | 76 | GPIO56_LCD_FCLK_RD, | 
|  | 77 | GPIO57_LCD_LCLK_A0, | 
|  | 78 | GPIO58_LCD_PCLK_WR, | 
|  | 79 | GPIO59_LCD_DENA_BIAS, | 
|  | 80 | GPIO60_LCD_DD0, | 
|  | 81 | GPIO61_LCD_DD1, | 
|  | 82 | GPIO62_LCD_DD2, | 
|  | 83 | GPIO63_LCD_DD3, | 
|  | 84 | GPIO64_LCD_DD4, | 
|  | 85 | GPIO65_LCD_DD5, | 
|  | 86 | GPIO66_LCD_DD6, | 
|  | 87 | GPIO67_LCD_DD7, | 
|  | 88 | GPIO68_LCD_DD8, | 
|  | 89 | GPIO69_LCD_DD9, | 
|  | 90 | GPIO70_LCD_DD10, | 
|  | 91 | GPIO71_LCD_DD11, | 
|  | 92 | GPIO72_LCD_DD12, | 
|  | 93 | GPIO73_LCD_DD13, | 
|  | 94 | GPIO74_LCD_DD14, | 
|  | 95 | GPIO75_LCD_DD15, | 
|  | 96 | GPIO76_LCD_DD16, | 
|  | 97 | GPIO77_LCD_DD17, | 
|  | 98 | GPIO78_LCD_DD18, | 
|  | 99 | GPIO79_LCD_DD19, | 
|  | 100 | GPIO80_LCD_DD20, | 
|  | 101 | GPIO81_LCD_DD21, | 
|  | 102 | GPIO82_LCD_DD22, | 
|  | 103 | GPIO83_LCD_DD23, | 
| Mark F. Brown | 6aafc5f | 2010-09-03 18:28:11 -0400 | [diff] [blame] | 104 |  | 
|  | 105 | /* Keypad */ | 
|  | 106 | GPIO109_KP_MKIN1, | 
|  | 107 | GPIO110_KP_MKIN0, | 
|  | 108 | GPIO111_KP_MKOUT7, | 
|  | 109 | GPIO112_KP_MKOUT6, | 
|  | 110 | GPIO121_KP_MKIN4, | 
| Eric Miao | 9c291f0 | 2009-02-10 10:35:25 +0800 | [diff] [blame] | 111 | }; | 
|  | 112 |  | 
| Eric Miao | a6b993c | 2009-02-18 16:38:22 +0800 | [diff] [blame] | 113 | static struct smc91x_platdata smc91x_info = { | 
|  | 114 | .flags	= SMC91X_USE_16BIT | SMC91X_NOWAIT, | 
|  | 115 | }; | 
|  | 116 |  | 
|  | 117 | static struct resource smc91x_resources[] = { | 
|  | 118 | [0] = { | 
|  | 119 | .start	= SMC_CS1_PHYS_BASE + 0x300, | 
|  | 120 | .end	= SMC_CS1_PHYS_BASE + 0xfffff, | 
|  | 121 | .flags	= IORESOURCE_MEM, | 
|  | 122 | }, | 
|  | 123 | [1] = { | 
| Haojian Zhuang | 4929f5a | 2011-10-10 16:03:51 +0800 | [diff] [blame] | 124 | .start	= MMP_GPIO_TO_IRQ(27), | 
|  | 125 | .end	= MMP_GPIO_TO_IRQ(27), | 
| Eric Miao | a6b993c | 2009-02-18 16:38:22 +0800 | [diff] [blame] | 126 | .flags	= IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, | 
|  | 127 | } | 
|  | 128 | }; | 
|  | 129 |  | 
|  | 130 | static struct platform_device smc91x_device = { | 
|  | 131 | .name		= "smc91x", | 
|  | 132 | .id		= 0, | 
|  | 133 | .dev		= { | 
|  | 134 | .platform_data = &smc91x_info, | 
|  | 135 | }, | 
|  | 136 | .num_resources	= ARRAY_SIZE(smc91x_resources), | 
|  | 137 | .resource	= smc91x_resources, | 
|  | 138 | }; | 
|  | 139 |  | 
| Haojian Zhuang | ef559de | 2009-09-10 14:37:48 +0800 | [diff] [blame] | 140 | static struct mtd_partition aspenite_nand_partitions[] = { | 
|  | 141 | { | 
|  | 142 | .name		= "bootloader", | 
|  | 143 | .offset		= 0, | 
|  | 144 | .size		= SZ_1M, | 
|  | 145 | .mask_flags	= MTD_WRITEABLE, | 
|  | 146 | }, { | 
|  | 147 | .name		= "reserved", | 
|  | 148 | .offset		= MTDPART_OFS_APPEND, | 
|  | 149 | .size		= SZ_128K, | 
|  | 150 | .mask_flags	= MTD_WRITEABLE, | 
|  | 151 | }, { | 
|  | 152 | .name		= "reserved", | 
|  | 153 | .offset		= MTDPART_OFS_APPEND, | 
|  | 154 | .size		= SZ_8M, | 
|  | 155 | .mask_flags	= MTD_WRITEABLE, | 
|  | 156 | }, { | 
|  | 157 | .name		= "kernel", | 
|  | 158 | .offset		= MTDPART_OFS_APPEND, | 
|  | 159 | .size		= (SZ_2M + SZ_1M), | 
|  | 160 | .mask_flags	= 0, | 
|  | 161 | }, { | 
|  | 162 | .name		= "filesystem", | 
|  | 163 | .offset		= MTDPART_OFS_APPEND, | 
| Stephen Boyd | 3f8e288 | 2011-07-26 18:45:54 +0100 | [diff] [blame] | 164 | .size		= SZ_32M + SZ_16M, | 
| Haojian Zhuang | ef559de | 2009-09-10 14:37:48 +0800 | [diff] [blame] | 165 | .mask_flags	= 0, | 
|  | 166 | } | 
|  | 167 | }; | 
|  | 168 |  | 
|  | 169 | static struct pxa3xx_nand_platform_data aspenite_nand_info = { | 
|  | 170 | .enable_arbiter	= 1, | 
| Lei Wen | f3c8cfc | 2011-07-14 20:44:33 -0700 | [diff] [blame] | 171 | .num_cs = 1, | 
|  | 172 | .parts[0]	= aspenite_nand_partitions, | 
|  | 173 | .nr_parts[0]	= ARRAY_SIZE(aspenite_nand_partitions), | 
| Haojian Zhuang | ef559de | 2009-09-10 14:37:48 +0800 | [diff] [blame] | 174 | }; | 
|  | 175 |  | 
| Haojian Zhuang | 07871c1 | 2010-03-19 11:55:14 -0400 | [diff] [blame] | 176 | static struct i2c_board_info aspenite_i2c_info[] __initdata = { | 
|  | 177 | { I2C_BOARD_INFO("wm8753", 0x1b), }, | 
|  | 178 | }; | 
|  | 179 |  | 
| Mark F. Brown | 884646a | 2010-08-25 23:51:55 -0400 | [diff] [blame] | 180 | static struct fb_videomode video_modes[] = { | 
|  | 181 | [0] = { | 
|  | 182 | .pixclock	= 30120, | 
|  | 183 | .refresh	= 60, | 
|  | 184 | .xres		= 800, | 
|  | 185 | .yres		= 480, | 
|  | 186 | .hsync_len	= 1, | 
|  | 187 | .left_margin	= 215, | 
|  | 188 | .right_margin	= 40, | 
|  | 189 | .vsync_len	= 1, | 
|  | 190 | .upper_margin	= 34, | 
|  | 191 | .lower_margin	= 10, | 
|  | 192 | .sync		= FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT, | 
|  | 193 | }, | 
|  | 194 | }; | 
|  | 195 |  | 
|  | 196 | struct pxa168fb_mach_info aspenite_lcd_info = { | 
|  | 197 | .id			= "Graphic Frame", | 
|  | 198 | .modes			= video_modes, | 
|  | 199 | .num_modes		= ARRAY_SIZE(video_modes), | 
|  | 200 | .pix_fmt		= PIX_FMT_RGB565, | 
|  | 201 | .io_pin_allocation_mode = PIN_MODE_DUMB_24, | 
|  | 202 | .dumb_mode		= DUMB_MODE_RGB888, | 
|  | 203 | .active			= 1, | 
|  | 204 | .panel_rbswap		= 0, | 
|  | 205 | .invert_pixclock	= 0, | 
|  | 206 | }; | 
|  | 207 |  | 
| Mark F. Brown | 6aafc5f | 2010-09-03 18:28:11 -0400 | [diff] [blame] | 208 | static unsigned int aspenite_matrix_key_map[] = { | 
|  | 209 | KEY(0, 6, KEY_UP),	/* SW 4 */ | 
|  | 210 | KEY(0, 7, KEY_DOWN),	/* SW 5 */ | 
|  | 211 | KEY(1, 6, KEY_LEFT),	/* SW 6 */ | 
|  | 212 | KEY(1, 7, KEY_RIGHT),	/* SW 7 */ | 
|  | 213 | KEY(4, 6, KEY_ENTER),	/* SW 8 */ | 
|  | 214 | KEY(4, 7, KEY_ESC),	/* SW 9 */ | 
|  | 215 | }; | 
|  | 216 |  | 
|  | 217 | static struct pxa27x_keypad_platform_data aspenite_keypad_info __initdata = { | 
|  | 218 | .matrix_key_rows	= 5, | 
|  | 219 | .matrix_key_cols	= 8, | 
|  | 220 | .matrix_key_map		= aspenite_matrix_key_map, | 
|  | 221 | .matrix_key_map_size	= ARRAY_SIZE(aspenite_matrix_key_map), | 
|  | 222 | .debounce_interval	= 30, | 
|  | 223 | }; | 
|  | 224 |  | 
| Neil Zhang | 7357867 | 2012-05-03 15:55:10 +0800 | [diff] [blame] | 225 | #if defined(CONFIG_USB_EHCI_MV) | 
|  | 226 | static char *pxa168_sph_clock_name[] = { | 
|  | 227 | [0] = "PXA168-USBCLK", | 
|  | 228 | }; | 
|  | 229 |  | 
|  | 230 | static struct mv_usb_platform_data pxa168_sph_pdata = { | 
|  | 231 | .clknum         = 1, | 
|  | 232 | .clkname        = pxa168_sph_clock_name, | 
|  | 233 | .mode           = MV_USB_MODE_HOST, | 
|  | 234 | .phy_init	= pxa_usb_phy_init, | 
|  | 235 | .phy_deinit	= pxa_usb_phy_deinit, | 
|  | 236 | .set_vbus	= NULL, | 
|  | 237 | }; | 
|  | 238 | #endif | 
|  | 239 |  | 
| Eric Miao | 49cbe78 | 2009-01-20 14:15:18 +0800 | [diff] [blame] | 240 | static void __init common_init(void) | 
|  | 241 | { | 
| Eric Miao | 9c291f0 | 2009-02-10 10:35:25 +0800 | [diff] [blame] | 242 | mfp_config(ARRAY_AND_SIZE(common_pin_config)); | 
|  | 243 |  | 
| Eric Miao | a6b993c | 2009-02-18 16:38:22 +0800 | [diff] [blame] | 244 | /* on-chip devices */ | 
| Eric Miao | 9c291f0 | 2009-02-10 10:35:25 +0800 | [diff] [blame] | 245 | pxa168_add_uart(1); | 
| Haojian Zhuang | 07871c1 | 2010-03-19 11:55:14 -0400 | [diff] [blame] | 246 | pxa168_add_twsi(1, NULL, ARRAY_AND_SIZE(aspenite_i2c_info)); | 
|  | 247 | pxa168_add_ssp(1); | 
| Haojian Zhuang | ef559de | 2009-09-10 14:37:48 +0800 | [diff] [blame] | 248 | pxa168_add_nand(&aspenite_nand_info); | 
| Mark F. Brown | 884646a | 2010-08-25 23:51:55 -0400 | [diff] [blame] | 249 | pxa168_add_fb(&aspenite_lcd_info); | 
| Mark F. Brown | 6aafc5f | 2010-09-03 18:28:11 -0400 | [diff] [blame] | 250 | pxa168_add_keypad(&aspenite_keypad_info); | 
| Haojian Zhuang | 157d264 | 2011-10-17 20:37:52 +0800 | [diff] [blame] | 251 | platform_device_register(&pxa168_device_gpio); | 
| Eric Miao | a6b993c | 2009-02-18 16:38:22 +0800 | [diff] [blame] | 252 |  | 
|  | 253 | /* off-chip devices */ | 
|  | 254 | platform_device_register(&smc91x_device); | 
| Neil Zhang | 7357867 | 2012-05-03 15:55:10 +0800 | [diff] [blame] | 255 |  | 
|  | 256 | #if defined(CONFIG_USB_EHCI_MV) | 
|  | 257 | pxa168_add_usb_host(&pxa168_sph_pdata); | 
|  | 258 | #endif | 
| Eric Miao | 49cbe78 | 2009-01-20 14:15:18 +0800 | [diff] [blame] | 259 | } | 
|  | 260 |  | 
|  | 261 | MACHINE_START(ASPENITE, "PXA168-based Aspenite Development Platform") | 
| Eric Miao | 8022887 | 2010-07-15 17:50:13 +0800 | [diff] [blame] | 262 | .map_io		= mmp_map_io, | 
| Rob Herring | 8661fb9 | 2012-01-03 16:50:40 -0600 | [diff] [blame] | 263 | .nr_irqs	= MMP_NR_IRQS, | 
| Eric Miao | 49cbe78 | 2009-01-20 14:15:18 +0800 | [diff] [blame] | 264 | .init_irq       = pxa168_init_irq, | 
|  | 265 | .timer          = &pxa168_timer, | 
|  | 266 | .init_machine   = common_init, | 
| Russell King | 9854a38 | 2011-11-05 15:40:09 +0000 | [diff] [blame] | 267 | .restart	= pxa168_restart, | 
| Eric Miao | 49cbe78 | 2009-01-20 14:15:18 +0800 | [diff] [blame] | 268 | MACHINE_END | 
|  | 269 |  | 
|  | 270 | MACHINE_START(ZYLONITE2, "PXA168-based Zylonite2 Development Platform") | 
| Eric Miao | 8022887 | 2010-07-15 17:50:13 +0800 | [diff] [blame] | 271 | .map_io		= mmp_map_io, | 
| Rob Herring | 8661fb9 | 2012-01-03 16:50:40 -0600 | [diff] [blame] | 272 | .nr_irqs	= MMP_NR_IRQS, | 
| Eric Miao | 49cbe78 | 2009-01-20 14:15:18 +0800 | [diff] [blame] | 273 | .init_irq       = pxa168_init_irq, | 
|  | 274 | .timer          = &pxa168_timer, | 
|  | 275 | .init_machine   = common_init, | 
| Russell King | 9854a38 | 2011-11-05 15:40:09 +0000 | [diff] [blame] | 276 | .restart	= pxa168_restart, | 
| Eric Miao | 49cbe78 | 2009-01-20 14:15:18 +0800 | [diff] [blame] | 277 | MACHINE_END |