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