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>
19 #include <linux/interrupt.h>
20 
21 #include <asm/mach-types.h>
22 #include <asm/mach/arch.h>
23 #include <mach/addr-map.h>
24 #include <mach/mfp-mmp2.h>
25 #include <mach/mmp2.h>
26 
27 #include "common.h"
28 
29 #define FLINT_NR_IRQS	(IRQ_BOARD_START + 48)
30 
31 static unsigned long flint_pin_config[] __initdata = {
32 	/* UART1 */
33 	GPIO45_UART1_RXD,
34 	GPIO46_UART1_TXD,
35 
36 	/* UART2 */
37 	GPIO47_UART2_RXD,
38 	GPIO48_UART2_TXD,
39 
40 	/* SMC */
41 	GPIO151_SMC_SCLK,
42 	GPIO145_SMC_nCS0,
43 	GPIO146_SMC_nCS1,
44 	GPIO152_SMC_BE0,
45 	GPIO153_SMC_BE1,
46 	GPIO154_SMC_IRQ,
47 	GPIO113_SMC_RDY,
48 
49 	/*Ethernet*/
50 	GPIO155_GPIO,
51 
52 	/* DFI */
53 	GPIO168_DFI_D0,
54 	GPIO167_DFI_D1,
55 	GPIO166_DFI_D2,
56 	GPIO165_DFI_D3,
57 	GPIO107_DFI_D4,
58 	GPIO106_DFI_D5,
59 	GPIO105_DFI_D6,
60 	GPIO104_DFI_D7,
61 	GPIO111_DFI_D8,
62 	GPIO164_DFI_D9,
63 	GPIO163_DFI_D10,
64 	GPIO162_DFI_D11,
65 	GPIO161_DFI_D12,
66 	GPIO110_DFI_D13,
67 	GPIO109_DFI_D14,
68 	GPIO108_DFI_D15,
69 	GPIO143_ND_nCS0,
70 	GPIO144_ND_nCS1,
71 	GPIO147_ND_nWE,
72 	GPIO148_ND_nRE,
73 	GPIO150_ND_ALE,
74 	GPIO149_ND_CLE,
75 	GPIO112_ND_RDY0,
76 	GPIO160_ND_RDY1,
77 };
78 
79 static struct smc91x_platdata flint_smc91x_info = {
80 	.flags  = SMC91X_USE_16BIT | SMC91X_NOWAIT,
81 };
82 
83 static struct resource smc91x_resources[] = {
84 	[0] = {
85 		.start  = SMC_CS1_PHYS_BASE + 0x300,
86 		.end    = SMC_CS1_PHYS_BASE + 0xfffff,
87 		.flags  = IORESOURCE_MEM,
88 	},
89 	[1] = {
90 		.start  = gpio_to_irq(155),
91 		.end    = gpio_to_irq(155),
92 		.flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
93 	}
94 };
95 
96 static struct platform_device smc91x_device = {
97 	.name           = "smc91x",
98 	.id             = 0,
99 	.dev            = {
100 		.platform_data = &flint_smc91x_info,
101 	},
102 	.num_resources  = ARRAY_SIZE(smc91x_resources),
103 	.resource       = smc91x_resources,
104 };
105 
flint_init(void)106 static void __init flint_init(void)
107 {
108 	mfp_config(ARRAY_AND_SIZE(flint_pin_config));
109 
110 	/* on-chip devices */
111 	mmp2_add_uart(1);
112 	mmp2_add_uart(2);
113 
114 	/* off-chip devices */
115 	platform_device_register(&smc91x_device);
116 }
117 
118 MACHINE_START(FLINT, "Flint Development Platform")
119 	.map_io		= mmp_map_io,
120 	.nr_irqs	= FLINT_NR_IRQS,
121 	.init_irq       = mmp2_init_irq,
122 	.timer          = &mmp2_timer,
123 	.init_machine   = flint_init,
124 MACHINE_END
125