Thomas Gleixner | 1d0ea06 | 2019-05-29 16:57:46 -0700 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0-only |
Eric Miao | 49cbe78 | 2009-01-20 14:15:18 +0800 | [diff] [blame] | 2 | /* |
| 3 | * linux/arch/arm/mach-mmp/aspenite.c |
| 4 | * |
| 5 | * Support for the Marvell PXA168-based Aspenite and Zylonite2 |
| 6 | * Development Platform. |
Eric Miao | 49cbe78 | 2009-01-20 14:15:18 +0800 | [diff] [blame] | 7 | */ |
Russell King | 2f8163b | 2011-07-26 10:53:52 +0100 | [diff] [blame] | 8 | #include <linux/gpio.h> |
Haojian Zhuang | b8f649f | 2013-04-09 18:12:04 +0800 | [diff] [blame] | 9 | #include <linux/gpio-pxa.h> |
Eric Miao | 49cbe78 | 2009-01-20 14:15:18 +0800 | [diff] [blame] | 10 | #include <linux/init.h> |
Eric Miao | 9c291f0 | 2009-02-10 10:35:25 +0800 | [diff] [blame] | 11 | #include <linux/kernel.h> |
Eric Miao | a6b993c | 2009-02-18 16:38:22 +0800 | [diff] [blame] | 12 | #include <linux/platform_device.h> |
| 13 | #include <linux/smc91x.h> |
Haojian Zhuang | ef559de | 2009-09-10 14:37:48 +0800 | [diff] [blame] | 14 | #include <linux/mtd/mtd.h> |
| 15 | #include <linux/mtd/partitions.h> |
Boris Brezillon | d4092d7 | 2017-08-04 17:29:10 +0200 | [diff] [blame] | 16 | #include <linux/mtd/rawnand.h> |
Haojian Zhuang | 0bd8696 | 2010-09-08 09:42:42 -0400 | [diff] [blame] | 17 | #include <linux/interrupt.h> |
Neil Zhang | 7357867 | 2012-05-03 15:55:10 +0800 | [diff] [blame] | 18 | #include <linux/platform_data/mv_usb.h> |
Eric Miao | 49cbe78 | 2009-01-20 14:15:18 +0800 | [diff] [blame] | 19 | |
| 20 | #include <asm/mach-types.h> |
| 21 | #include <asm/mach/arch.h> |
Mark F. Brown | 884646a | 2010-08-25 23:51:55 -0400 | [diff] [blame] | 22 | #include <video/pxa168fb.h> |
Mark F. Brown | 6aafc5f | 2010-09-03 18:28:11 -0400 | [diff] [blame] | 23 | #include <linux/input.h> |
Arnd Bergmann | 293b2da | 2012-08-24 15:16:48 +0200 | [diff] [blame] | 24 | #include <linux/platform_data/keypad-pxa27x.h> |
Eric Miao | 49cbe78 | 2009-01-20 14:15:18 +0800 | [diff] [blame] | 25 | |
Arnd Bergmann | b501fd7 | 2014-04-15 20:38:32 +0200 | [diff] [blame] | 26 | #include "addr-map.h" |
| 27 | #include "mfp-pxa168.h" |
| 28 | #include "pxa168.h" |
Arnd Bergmann | 5d3e11c | 2018-12-10 21:43:02 +0100 | [diff] [blame] | 29 | #include "pxa910.h" |
Arnd Bergmann | b501fd7 | 2014-04-15 20:38:32 +0200 | [diff] [blame] | 30 | #include "irqs.h" |
Eric Miao | 49cbe78 | 2009-01-20 14:15:18 +0800 | [diff] [blame] | 31 | #include "common.h" |
| 32 | |
Eric Miao | 9c291f0 | 2009-02-10 10:35:25 +0800 | [diff] [blame] | 33 | static unsigned long common_pin_config[] __initdata = { |
Eric Miao | a6b993c | 2009-02-18 16:38:22 +0800 | [diff] [blame] | 34 | /* 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 Miao | 9c291f0 | 2009-02-10 10:35:25 +0800 | [diff] [blame] | 63 | /* UART1 */ |
| 64 | GPIO107_UART1_RXD, |
| 65 | GPIO108_UART1_TXD, |
Haojian Zhuang | 07871c1 | 2010-03-19 11:55:14 -0400 | [diff] [blame] | 66 | |
| 67 | /* SSP1 */ |
| 68 | GPIO113_I2S_MCLK, |
| 69 | GPIO114_I2S_FRM, |
| 70 | GPIO115_I2S_BCLK, |
| 71 | GPIO116_I2S_RXD, |
| 72 | GPIO117_I2S_TXD, |
Mark F. Brown | 884646a | 2010-08-25 23:51:55 -0400 | [diff] [blame] | 73 | |
| 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. Brown | 6aafc5f | 2010-09-03 18:28:11 -0400 | [diff] [blame] | 103 | |
| 104 | /* Keypad */ |
| 105 | GPIO109_KP_MKIN1, |
| 106 | GPIO110_KP_MKIN0, |
| 107 | GPIO111_KP_MKOUT7, |
| 108 | GPIO112_KP_MKOUT6, |
| 109 | GPIO121_KP_MKIN4, |
Eric Miao | 9c291f0 | 2009-02-10 10:35:25 +0800 | [diff] [blame] | 110 | }; |
| 111 | |
Haojian Zhuang | b8f649f | 2013-04-09 18:12:04 +0800 | [diff] [blame] | 112 | static struct pxa_gpio_platform_data pxa168_gpio_pdata = { |
| 113 | .irq_base = MMP_GPIO_TO_IRQ(0), |
| 114 | }; |
| 115 | |
Eric Miao | a6b993c | 2009-02-18 16:38:22 +0800 | [diff] [blame] | 116 | static struct smc91x_platdata smc91x_info = { |
| 117 | .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT, |
| 118 | }; |
| 119 | |
| 120 | static struct resource smc91x_resources[] = { |
| 121 | [0] = { |
| 122 | .start = SMC_CS1_PHYS_BASE + 0x300, |
| 123 | .end = SMC_CS1_PHYS_BASE + 0xfffff, |
| 124 | .flags = IORESOURCE_MEM, |
| 125 | }, |
| 126 | [1] = { |
Haojian Zhuang | 4929f5a | 2011-10-10 16:03:51 +0800 | [diff] [blame] | 127 | .start = MMP_GPIO_TO_IRQ(27), |
| 128 | .end = MMP_GPIO_TO_IRQ(27), |
Eric Miao | a6b993c | 2009-02-18 16:38:22 +0800 | [diff] [blame] | 129 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, |
| 130 | } |
| 131 | }; |
| 132 | |
| 133 | static struct platform_device smc91x_device = { |
| 134 | .name = "smc91x", |
| 135 | .id = 0, |
| 136 | .dev = { |
| 137 | .platform_data = &smc91x_info, |
| 138 | }, |
| 139 | .num_resources = ARRAY_SIZE(smc91x_resources), |
| 140 | .resource = smc91x_resources, |
| 141 | }; |
| 142 | |
Haojian Zhuang | ef559de | 2009-09-10 14:37:48 +0800 | [diff] [blame] | 143 | static struct mtd_partition aspenite_nand_partitions[] = { |
| 144 | { |
| 145 | .name = "bootloader", |
| 146 | .offset = 0, |
| 147 | .size = SZ_1M, |
| 148 | .mask_flags = MTD_WRITEABLE, |
| 149 | }, { |
| 150 | .name = "reserved", |
| 151 | .offset = MTDPART_OFS_APPEND, |
| 152 | .size = SZ_128K, |
| 153 | .mask_flags = MTD_WRITEABLE, |
| 154 | }, { |
| 155 | .name = "reserved", |
| 156 | .offset = MTDPART_OFS_APPEND, |
| 157 | .size = SZ_8M, |
| 158 | .mask_flags = MTD_WRITEABLE, |
| 159 | }, { |
| 160 | .name = "kernel", |
| 161 | .offset = MTDPART_OFS_APPEND, |
| 162 | .size = (SZ_2M + SZ_1M), |
| 163 | .mask_flags = 0, |
| 164 | }, { |
| 165 | .name = "filesystem", |
| 166 | .offset = MTDPART_OFS_APPEND, |
Stephen Boyd | 3f8e288 | 2011-07-26 18:45:54 +0100 | [diff] [blame] | 167 | .size = SZ_32M + SZ_16M, |
Haojian Zhuang | ef559de | 2009-09-10 14:37:48 +0800 | [diff] [blame] | 168 | .mask_flags = 0, |
| 169 | } |
| 170 | }; |
| 171 | |
| 172 | static struct pxa3xx_nand_platform_data aspenite_nand_info = { |
Miquel Raynal | 7576594 | 2018-02-19 23:35:54 +0100 | [diff] [blame] | 173 | .parts = aspenite_nand_partitions, |
| 174 | .nr_parts = ARRAY_SIZE(aspenite_nand_partitions), |
Haojian Zhuang | ef559de | 2009-09-10 14:37:48 +0800 | [diff] [blame] | 175 | }; |
| 176 | |
Haojian Zhuang | 07871c1 | 2010-03-19 11:55:14 -0400 | [diff] [blame] | 177 | static struct i2c_board_info aspenite_i2c_info[] __initdata = { |
| 178 | { I2C_BOARD_INFO("wm8753", 0x1b), }, |
| 179 | }; |
| 180 | |
Mark F. Brown | 884646a | 2010-08-25 23:51:55 -0400 | [diff] [blame] | 181 | static struct fb_videomode video_modes[] = { |
| 182 | [0] = { |
| 183 | .pixclock = 30120, |
| 184 | .refresh = 60, |
| 185 | .xres = 800, |
| 186 | .yres = 480, |
| 187 | .hsync_len = 1, |
| 188 | .left_margin = 215, |
| 189 | .right_margin = 40, |
| 190 | .vsync_len = 1, |
| 191 | .upper_margin = 34, |
| 192 | .lower_margin = 10, |
| 193 | .sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT, |
| 194 | }, |
| 195 | }; |
| 196 | |
| 197 | struct pxa168fb_mach_info aspenite_lcd_info = { |
| 198 | .id = "Graphic Frame", |
| 199 | .modes = video_modes, |
| 200 | .num_modes = ARRAY_SIZE(video_modes), |
| 201 | .pix_fmt = PIX_FMT_RGB565, |
| 202 | .io_pin_allocation_mode = PIN_MODE_DUMB_24, |
| 203 | .dumb_mode = DUMB_MODE_RGB888, |
| 204 | .active = 1, |
| 205 | .panel_rbswap = 0, |
| 206 | .invert_pixclock = 0, |
| 207 | }; |
| 208 | |
Chao Xie | 0a085a9 | 2013-05-05 20:24:58 -0700 | [diff] [blame] | 209 | static const unsigned int aspenite_matrix_key_map[] = { |
Mark F. Brown | 6aafc5f | 2010-09-03 18:28:11 -0400 | [diff] [blame] | 210 | KEY(0, 6, KEY_UP), /* SW 4 */ |
| 211 | KEY(0, 7, KEY_DOWN), /* SW 5 */ |
| 212 | KEY(1, 6, KEY_LEFT), /* SW 6 */ |
| 213 | KEY(1, 7, KEY_RIGHT), /* SW 7 */ |
| 214 | KEY(4, 6, KEY_ENTER), /* SW 8 */ |
| 215 | KEY(4, 7, KEY_ESC), /* SW 9 */ |
| 216 | }; |
| 217 | |
Chao Xie | 0a085a9 | 2013-05-05 20:24:58 -0700 | [diff] [blame] | 218 | static struct matrix_keymap_data aspenite_matrix_keymap_data = { |
| 219 | .keymap = aspenite_matrix_key_map, |
| 220 | .keymap_size = ARRAY_SIZE(aspenite_matrix_key_map), |
| 221 | }; |
| 222 | |
Mark F. Brown | 6aafc5f | 2010-09-03 18:28:11 -0400 | [diff] [blame] | 223 | static struct pxa27x_keypad_platform_data aspenite_keypad_info __initdata = { |
| 224 | .matrix_key_rows = 5, |
| 225 | .matrix_key_cols = 8, |
Chao Xie | 0a085a9 | 2013-05-05 20:24:58 -0700 | [diff] [blame] | 226 | .matrix_keymap_data = &aspenite_matrix_keymap_data, |
Mark F. Brown | 6aafc5f | 2010-09-03 18:28:11 -0400 | [diff] [blame] | 227 | .debounce_interval = 30, |
| 228 | }; |
| 229 | |
Arnd Bergmann | 3524080 | 2014-03-12 15:29:22 +0100 | [diff] [blame] | 230 | #if IS_ENABLED(CONFIG_USB_EHCI_MV) |
Neil Zhang | 7357867 | 2012-05-03 15:55:10 +0800 | [diff] [blame] | 231 | static struct mv_usb_platform_data pxa168_sph_pdata = { |
Neil Zhang | 7357867 | 2012-05-03 15:55:10 +0800 | [diff] [blame] | 232 | .mode = MV_USB_MODE_HOST, |
| 233 | .phy_init = pxa_usb_phy_init, |
| 234 | .phy_deinit = pxa_usb_phy_deinit, |
| 235 | .set_vbus = NULL, |
| 236 | }; |
| 237 | #endif |
| 238 | |
Eric Miao | 49cbe78 | 2009-01-20 14:15:18 +0800 | [diff] [blame] | 239 | static void __init common_init(void) |
| 240 | { |
Eric Miao | 9c291f0 | 2009-02-10 10:35:25 +0800 | [diff] [blame] | 241 | mfp_config(ARRAY_AND_SIZE(common_pin_config)); |
| 242 | |
Eric Miao | a6b993c | 2009-02-18 16:38:22 +0800 | [diff] [blame] | 243 | /* on-chip devices */ |
Eric Miao | 9c291f0 | 2009-02-10 10:35:25 +0800 | [diff] [blame] | 244 | pxa168_add_uart(1); |
Haojian Zhuang | 07871c1 | 2010-03-19 11:55:14 -0400 | [diff] [blame] | 245 | pxa168_add_twsi(1, NULL, ARRAY_AND_SIZE(aspenite_i2c_info)); |
| 246 | pxa168_add_ssp(1); |
Haojian Zhuang | ef559de | 2009-09-10 14:37:48 +0800 | [diff] [blame] | 247 | pxa168_add_nand(&aspenite_nand_info); |
Mark F. Brown | 884646a | 2010-08-25 23:51:55 -0400 | [diff] [blame] | 248 | pxa168_add_fb(&aspenite_lcd_info); |
Mark F. Brown | 6aafc5f | 2010-09-03 18:28:11 -0400 | [diff] [blame] | 249 | pxa168_add_keypad(&aspenite_keypad_info); |
Haojian Zhuang | b8f649f | 2013-04-09 18:12:04 +0800 | [diff] [blame] | 250 | platform_device_add_data(&pxa168_device_gpio, &pxa168_gpio_pdata, |
| 251 | sizeof(struct pxa_gpio_platform_data)); |
Haojian Zhuang | 157d264 | 2011-10-17 20:37:52 +0800 | [diff] [blame] | 252 | platform_device_register(&pxa168_device_gpio); |
Eric Miao | a6b993c | 2009-02-18 16:38:22 +0800 | [diff] [blame] | 253 | |
| 254 | /* off-chip devices */ |
| 255 | platform_device_register(&smc91x_device); |
Neil Zhang | 7357867 | 2012-05-03 15:55:10 +0800 | [diff] [blame] | 256 | |
Arnd Bergmann | 5d3e11c | 2018-12-10 21:43:02 +0100 | [diff] [blame] | 257 | #if IS_ENABLED(CONFIG_USB_SUPPORT) |
Lubomir Rintel | e47feed | 2018-11-28 18:53:22 +0100 | [diff] [blame] | 258 | #if IS_ENABLED(CONFIG_PHY_PXA_USB) |
| 259 | platform_device_register(&pxa168_device_usb_phy); |
| 260 | #endif |
| 261 | |
Arnd Bergmann | 3524080 | 2014-03-12 15:29:22 +0100 | [diff] [blame] | 262 | #if IS_ENABLED(CONFIG_USB_EHCI_MV) |
Neil Zhang | 7357867 | 2012-05-03 15:55:10 +0800 | [diff] [blame] | 263 | pxa168_add_usb_host(&pxa168_sph_pdata); |
| 264 | #endif |
Arnd Bergmann | 5d3e11c | 2018-12-10 21:43:02 +0100 | [diff] [blame] | 265 | #endif |
Eric Miao | 49cbe78 | 2009-01-20 14:15:18 +0800 | [diff] [blame] | 266 | } |
| 267 | |
| 268 | MACHINE_START(ASPENITE, "PXA168-based Aspenite Development Platform") |
Eric Miao | 8022887 | 2010-07-15 17:50:13 +0800 | [diff] [blame] | 269 | .map_io = mmp_map_io, |
Rob Herring | 8661fb9 | 2012-01-03 16:50:40 -0600 | [diff] [blame] | 270 | .nr_irqs = MMP_NR_IRQS, |
Eric Miao | 49cbe78 | 2009-01-20 14:15:18 +0800 | [diff] [blame] | 271 | .init_irq = pxa168_init_irq, |
Stephen Warren | 6bb27d7 | 2012-11-08 12:40:59 -0700 | [diff] [blame] | 272 | .init_time = pxa168_timer_init, |
Eric Miao | 49cbe78 | 2009-01-20 14:15:18 +0800 | [diff] [blame] | 273 | .init_machine = common_init, |
Russell King | 9854a38 | 2011-11-05 15:40:09 +0000 | [diff] [blame] | 274 | .restart = pxa168_restart, |
Eric Miao | 49cbe78 | 2009-01-20 14:15:18 +0800 | [diff] [blame] | 275 | MACHINE_END |
| 276 | |
| 277 | MACHINE_START(ZYLONITE2, "PXA168-based Zylonite2 Development Platform") |
Eric Miao | 8022887 | 2010-07-15 17:50:13 +0800 | [diff] [blame] | 278 | .map_io = mmp_map_io, |
Rob Herring | 8661fb9 | 2012-01-03 16:50:40 -0600 | [diff] [blame] | 279 | .nr_irqs = MMP_NR_IRQS, |
Eric Miao | 49cbe78 | 2009-01-20 14:15:18 +0800 | [diff] [blame] | 280 | .init_irq = pxa168_init_irq, |
Stephen Warren | 6bb27d7 | 2012-11-08 12:40:59 -0700 | [diff] [blame] | 281 | .init_time = pxa168_timer_init, |
Eric Miao | 49cbe78 | 2009-01-20 14:15:18 +0800 | [diff] [blame] | 282 | .init_machine = common_init, |
Russell King | 9854a38 | 2011-11-05 15:40:09 +0000 | [diff] [blame] | 283 | .restart = pxa168_restart, |
Eric Miao | 49cbe78 | 2009-01-20 14:15:18 +0800 | [diff] [blame] | 284 | MACHINE_END |