1 // SPDX-License-Identifier: GPL-2.0-only
3 * linux/arch/arm/mach-mmp/aspenite.c
5 * Support for the Marvell PXA168-based Aspenite and Zylonite2
6 * Development Platform.
8 #include <linux/gpio.h>
9 #include <linux/gpio-pxa.h>
10 #include <linux/init.h>
11 #include <linux/kernel.h>
12 #include <linux/platform_device.h>
13 #include <linux/smc91x.h>
14 #include <linux/mtd/mtd.h>
15 #include <linux/mtd/partitions.h>
16 #include <linux/mtd/rawnand.h>
17 #include <linux/interrupt.h>
18 #include <linux/platform_data/mv_usb.h>
20 #include <asm/mach-types.h>
21 #include <asm/mach/arch.h>
22 #include <video/pxa168fb.h>
23 #include <linux/input.h>
24 #include <linux/platform_data/keypad-pxa27x.h>
27 #include "mfp-pxa168.h"
33 static unsigned long common_pin_config[] __initdata = {
34 /* Data Flash Interface */
52 /* Static Memory Controller */
61 GPIO27_GPIO, /* Ethernet IRQ */
112 static struct pxa_gpio_platform_data pxa168_gpio_pdata = {
113 .irq_base = MMP_GPIO_TO_IRQ(0),
116 static struct smc91x_platdata smc91x_info = {
117 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
120 static struct resource smc91x_resources[] = {
122 .start = SMC_CS1_PHYS_BASE + 0x300,
123 .end = SMC_CS1_PHYS_BASE + 0xfffff,
124 .flags = IORESOURCE_MEM,
127 .start = MMP_GPIO_TO_IRQ(27),
128 .end = MMP_GPIO_TO_IRQ(27),
129 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
133 static struct platform_device smc91x_device = {
137 .platform_data = &smc91x_info,
139 .num_resources = ARRAY_SIZE(smc91x_resources),
140 .resource = smc91x_resources,
143 static struct mtd_partition aspenite_nand_partitions[] = {
145 .name = "bootloader",
148 .mask_flags = MTD_WRITEABLE,
151 .offset = MTDPART_OFS_APPEND,
153 .mask_flags = MTD_WRITEABLE,
156 .offset = MTDPART_OFS_APPEND,
158 .mask_flags = MTD_WRITEABLE,
161 .offset = MTDPART_OFS_APPEND,
162 .size = (SZ_2M + SZ_1M),
165 .name = "filesystem",
166 .offset = MTDPART_OFS_APPEND,
167 .size = SZ_32M + SZ_16M,
172 static struct pxa3xx_nand_platform_data aspenite_nand_info = {
173 .parts = aspenite_nand_partitions,
174 .nr_parts = ARRAY_SIZE(aspenite_nand_partitions),
177 static struct i2c_board_info aspenite_i2c_info[] __initdata = {
178 { I2C_BOARD_INFO("wm8753", 0x1b), },
181 static struct fb_videomode video_modes[] = {
193 .sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT,
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,
206 .invert_pixclock = 0,
209 static const unsigned int aspenite_matrix_key_map[] = {
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 */
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),
223 static struct pxa27x_keypad_platform_data aspenite_keypad_info __initdata = {
224 .matrix_key_rows = 5,
225 .matrix_key_cols = 8,
226 .matrix_keymap_data = &aspenite_matrix_keymap_data,
227 .debounce_interval = 30,
230 #if IS_ENABLED(CONFIG_USB_EHCI_MV)
231 static struct mv_usb_platform_data pxa168_sph_pdata = {
232 .mode = MV_USB_MODE_HOST,
233 .phy_init = pxa_usb_phy_init,
234 .phy_deinit = pxa_usb_phy_deinit,
239 static void __init common_init(void)
241 mfp_config(ARRAY_AND_SIZE(common_pin_config));
243 /* on-chip devices */
245 pxa168_add_twsi(1, NULL, ARRAY_AND_SIZE(aspenite_i2c_info));
247 pxa168_add_nand(&aspenite_nand_info);
248 pxa168_add_fb(&aspenite_lcd_info);
249 pxa168_add_keypad(&aspenite_keypad_info);
250 platform_device_add_data(&pxa168_device_gpio, &pxa168_gpio_pdata,
251 sizeof(struct pxa_gpio_platform_data));
252 platform_device_register(&pxa168_device_gpio);
254 /* off-chip devices */
255 platform_device_register(&smc91x_device);
257 #if IS_ENABLED(CONFIG_USB_SUPPORT)
258 #if IS_ENABLED(CONFIG_PHY_PXA_USB)
259 platform_device_register(&pxa168_device_usb_phy);
262 #if IS_ENABLED(CONFIG_USB_EHCI_MV)
263 pxa168_add_usb_host(&pxa168_sph_pdata);
268 MACHINE_START(ASPENITE, "PXA168-based Aspenite Development Platform")
269 .map_io = mmp_map_io,
270 .nr_irqs = MMP_NR_IRQS,
271 .init_irq = pxa168_init_irq,
272 .init_time = pxa168_timer_init,
273 .init_machine = common_init,
274 .restart = pxa168_restart,
277 MACHINE_START(ZYLONITE2, "PXA168-based Zylonite2 Development Platform")
278 .map_io = mmp_map_io,
279 .nr_irqs = MMP_NR_IRQS,
280 .init_irq = pxa168_init_irq,
281 .init_time = pxa168_timer_init,
282 .init_machine = common_init,
283 .restart = pxa168_restart,