Haojian Zhuang | 2f7e8fa | 2009-12-04 09:41:28 -0500 | [diff] [blame] | 1 | /* |
| 2 | * linux/arch/arm/mach-mmp/flint.c |
| 3 | * |
| 4 | * Support for the Marvell Flint Development Platform. |
| 5 | * |
| 6 | * Copyright (C) 2009 Marvell International Ltd. |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License version 2 as |
| 10 | * publishhed by the Free Software Foundation. |
| 11 | */ |
| 12 | |
| 13 | #include <linux/init.h> |
| 14 | #include <linux/kernel.h> |
| 15 | #include <linux/platform_device.h> |
| 16 | #include <linux/smc91x.h> |
| 17 | #include <linux/io.h> |
| 18 | #include <linux/gpio.h> |
Haojian Zhuang | b8f649f | 2013-04-09 18:12:04 +0800 | [diff] [blame] | 19 | #include <linux/gpio-pxa.h> |
Haojian Zhuang | 0bd8696 | 2010-09-08 09:42:42 -0400 | [diff] [blame] | 20 | #include <linux/interrupt.h> |
Haojian Zhuang | 2f7e8fa | 2009-12-04 09:41:28 -0500 | [diff] [blame] | 21 | |
| 22 | #include <asm/mach-types.h> |
| 23 | #include <asm/mach/arch.h> |
Arnd Bergmann | b501fd7 | 2014-04-15 20:38:32 +0200 | [diff] [blame^] | 24 | #include "addr-map.h" |
| 25 | #include "mfp-mmp2.h" |
| 26 | #include "mmp2.h" |
| 27 | #include "irqs.h" |
Haojian Zhuang | 2f7e8fa | 2009-12-04 09:41:28 -0500 | [diff] [blame] | 28 | |
| 29 | #include "common.h" |
| 30 | |
Rob Herring | 8661fb9 | 2012-01-03 16:50:40 -0600 | [diff] [blame] | 31 | #define FLINT_NR_IRQS (MMP_NR_IRQS + 48) |
Haojian Zhuang | 0bd8696 | 2010-09-08 09:42:42 -0400 | [diff] [blame] | 32 | |
Haojian Zhuang | 2f7e8fa | 2009-12-04 09:41:28 -0500 | [diff] [blame] | 33 | static unsigned long flint_pin_config[] __initdata = { |
| 34 | /* UART1 */ |
| 35 | GPIO45_UART1_RXD, |
| 36 | GPIO46_UART1_TXD, |
| 37 | |
| 38 | /* UART2 */ |
| 39 | GPIO47_UART2_RXD, |
| 40 | GPIO48_UART2_TXD, |
| 41 | |
| 42 | /* SMC */ |
| 43 | GPIO151_SMC_SCLK, |
| 44 | GPIO145_SMC_nCS0, |
| 45 | GPIO146_SMC_nCS1, |
| 46 | GPIO152_SMC_BE0, |
| 47 | GPIO153_SMC_BE1, |
| 48 | GPIO154_SMC_IRQ, |
| 49 | GPIO113_SMC_RDY, |
| 50 | |
| 51 | /*Ethernet*/ |
Eric Miao | a8fb0b5 | 2010-12-18 21:57:07 +0800 | [diff] [blame] | 52 | GPIO155_GPIO, |
Haojian Zhuang | 2f7e8fa | 2009-12-04 09:41:28 -0500 | [diff] [blame] | 53 | |
| 54 | /* DFI */ |
| 55 | GPIO168_DFI_D0, |
| 56 | GPIO167_DFI_D1, |
| 57 | GPIO166_DFI_D2, |
| 58 | GPIO165_DFI_D3, |
| 59 | GPIO107_DFI_D4, |
| 60 | GPIO106_DFI_D5, |
| 61 | GPIO105_DFI_D6, |
| 62 | GPIO104_DFI_D7, |
| 63 | GPIO111_DFI_D8, |
| 64 | GPIO164_DFI_D9, |
| 65 | GPIO163_DFI_D10, |
| 66 | GPIO162_DFI_D11, |
| 67 | GPIO161_DFI_D12, |
| 68 | GPIO110_DFI_D13, |
| 69 | GPIO109_DFI_D14, |
| 70 | GPIO108_DFI_D15, |
| 71 | GPIO143_ND_nCS0, |
| 72 | GPIO144_ND_nCS1, |
| 73 | GPIO147_ND_nWE, |
| 74 | GPIO148_ND_nRE, |
| 75 | GPIO150_ND_ALE, |
| 76 | GPIO149_ND_CLE, |
| 77 | GPIO112_ND_RDY0, |
| 78 | GPIO160_ND_RDY1, |
| 79 | }; |
| 80 | |
Haojian Zhuang | b8f649f | 2013-04-09 18:12:04 +0800 | [diff] [blame] | 81 | static struct pxa_gpio_platform_data mmp2_gpio_pdata = { |
| 82 | .irq_base = MMP_GPIO_TO_IRQ(0), |
| 83 | }; |
| 84 | |
Haojian Zhuang | 2f7e8fa | 2009-12-04 09:41:28 -0500 | [diff] [blame] | 85 | static struct smc91x_platdata flint_smc91x_info = { |
| 86 | .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT, |
| 87 | }; |
| 88 | |
| 89 | static struct resource smc91x_resources[] = { |
| 90 | [0] = { |
| 91 | .start = SMC_CS1_PHYS_BASE + 0x300, |
| 92 | .end = SMC_CS1_PHYS_BASE + 0xfffff, |
| 93 | .flags = IORESOURCE_MEM, |
| 94 | }, |
| 95 | [1] = { |
Haojian Zhuang | 4929f5a | 2011-10-10 16:03:51 +0800 | [diff] [blame] | 96 | .start = MMP_GPIO_TO_IRQ(155), |
| 97 | .end = MMP_GPIO_TO_IRQ(155), |
Haojian Zhuang | 2f7e8fa | 2009-12-04 09:41:28 -0500 | [diff] [blame] | 98 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, |
| 99 | } |
| 100 | }; |
| 101 | |
| 102 | static struct platform_device smc91x_device = { |
| 103 | .name = "smc91x", |
| 104 | .id = 0, |
| 105 | .dev = { |
| 106 | .platform_data = &flint_smc91x_info, |
| 107 | }, |
| 108 | .num_resources = ARRAY_SIZE(smc91x_resources), |
| 109 | .resource = smc91x_resources, |
| 110 | }; |
| 111 | |
| 112 | static void __init flint_init(void) |
| 113 | { |
| 114 | mfp_config(ARRAY_AND_SIZE(flint_pin_config)); |
| 115 | |
| 116 | /* on-chip devices */ |
| 117 | mmp2_add_uart(1); |
| 118 | mmp2_add_uart(2); |
Haojian Zhuang | b8f649f | 2013-04-09 18:12:04 +0800 | [diff] [blame] | 119 | platform_device_add_data(&mmp2_device_gpio, &mmp2_gpio_pdata, |
| 120 | sizeof(struct pxa_gpio_platform_data)); |
Haojian Zhuang | 157d264 | 2011-10-17 20:37:52 +0800 | [diff] [blame] | 121 | platform_device_register(&mmp2_device_gpio); |
Haojian Zhuang | 2f7e8fa | 2009-12-04 09:41:28 -0500 | [diff] [blame] | 122 | |
| 123 | /* off-chip devices */ |
| 124 | platform_device_register(&smc91x_device); |
| 125 | } |
| 126 | |
| 127 | MACHINE_START(FLINT, "Flint Development Platform") |
Eric Miao | 8022887 | 2010-07-15 17:50:13 +0800 | [diff] [blame] | 128 | .map_io = mmp_map_io, |
Haojian Zhuang | 0bd8696 | 2010-09-08 09:42:42 -0400 | [diff] [blame] | 129 | .nr_irqs = FLINT_NR_IRQS, |
Haojian Zhuang | 2f7e8fa | 2009-12-04 09:41:28 -0500 | [diff] [blame] | 130 | .init_irq = mmp2_init_irq, |
Stephen Warren | 6bb27d7 | 2012-11-08 12:40:59 -0700 | [diff] [blame] | 131 | .init_time = mmp2_timer_init, |
Haojian Zhuang | 2f7e8fa | 2009-12-04 09:41:28 -0500 | [diff] [blame] | 132 | .init_machine = flint_init, |
Russell King | 9854a38 | 2011-11-05 15:40:09 +0000 | [diff] [blame] | 133 | .restart = mmp_restart, |
Haojian Zhuang | 2f7e8fa | 2009-12-04 09:41:28 -0500 | [diff] [blame] | 134 | MACHINE_END |