xref: /openbmc/linux/arch/arm/mach-ep93xx/edb93xx.c (revision e8e0929d)
1 /*
2  * arch/arm/mach-ep93xx/edb93xx.c
3  * Cirrus Logic EDB93xx Development Board support.
4  *
5  * EDB93XX, EDB9301, EDB9307A
6  * Copyright (C) 2008-2009 H Hartley Sweeten <hsweeten@visionengravers.com>
7  *
8  * EDB9302
9  * Copyright (C) 2006 George Kashperko <george@chas.com.ua>
10  *
11  * EDB9302A, EDB9315, EDB9315A
12  * Copyright (C) 2006 Lennert Buytenhek <buytenh@wantstofly.org>
13  *
14  * EDB9307
15  * Copyright (C) 2007 Herbert Valerio Riedel <hvr@gnu.org>
16  *
17  * EDB9312
18  * Copyright (C) 2006 Infosys Technologies Limited
19  *                    Toufeeq Hussain <toufeeq_hussain@infosys.com>
20  *
21  * This program is free software; you can redistribute it and/or modify
22  * it under the terms of the GNU General Public License as published by
23  * the Free Software Foundation; either version 2 of the License, or (at
24  * your option) any later version.
25  */
26 
27 #include <linux/kernel.h>
28 #include <linux/init.h>
29 #include <linux/platform_device.h>
30 #include <linux/i2c.h>
31 #include <linux/mtd/physmap.h>
32 
33 #include <mach/hardware.h>
34 
35 #include <asm/mach-types.h>
36 #include <asm/mach/arch.h>
37 
38 
39 static struct physmap_flash_data edb93xx_flash_data;
40 
41 static struct resource edb93xx_flash_resource = {
42 	.flags		= IORESOURCE_MEM,
43 };
44 
45 static struct platform_device edb93xx_flash = {
46 	.name		= "physmap-flash",
47 	.id		= 0,
48 	.dev		= {
49 		.platform_data	= &edb93xx_flash_data,
50 	},
51 	.num_resources	= 1,
52 	.resource	= &edb93xx_flash_resource,
53 };
54 
55 static void __init __edb93xx_register_flash(unsigned int width,
56 			resource_size_t start, resource_size_t size)
57 {
58 	edb93xx_flash_data.width	= width;
59 	edb93xx_flash_resource.start	= start;
60 	edb93xx_flash_resource.end	= start + size - 1;
61 
62 	platform_device_register(&edb93xx_flash);
63 }
64 
65 static void __init edb93xx_register_flash(void)
66 {
67 	if (machine_is_edb9307() || machine_is_edb9312() ||
68 	    machine_is_edb9315()) {
69 		__edb93xx_register_flash(4, EP93XX_CS6_PHYS_BASE, SZ_32M);
70 	} else {
71 		__edb93xx_register_flash(2, EP93XX_CS6_PHYS_BASE, SZ_16M);
72 	}
73 }
74 
75 static struct ep93xx_eth_data edb93xx_eth_data = {
76 	.phy_id		= 1,
77 };
78 
79 static struct i2c_board_info __initdata edb93xxa_i2c_data[] = {
80 	{
81 		I2C_BOARD_INFO("isl1208", 0x6f),
82 	},
83 };
84 
85 static struct i2c_board_info __initdata edb93xx_i2c_data[] = {
86 	{
87 		I2C_BOARD_INFO("ds1337", 0x68),
88 	},
89 };
90 
91 static void __init edb93xx_register_i2c(void)
92 {
93 	if (machine_is_edb9302a() || machine_is_edb9307a() ||
94 	    machine_is_edb9315a()) {
95 		ep93xx_register_i2c(edb93xxa_i2c_data,
96 				ARRAY_SIZE(edb93xxa_i2c_data));
97 	} else if (machine_is_edb9307() || machine_is_edb9312() ||
98 		   machine_is_edb9315()) {
99 		ep93xx_register_i2c(edb93xx_i2c_data,
100 				ARRAY_SIZE(edb93xx_i2c_data));
101 	}
102 }
103 
104 static void __init edb93xx_init_machine(void)
105 {
106 	ep93xx_init_devices();
107 	edb93xx_register_flash();
108 	ep93xx_register_eth(&edb93xx_eth_data, 1);
109 	edb93xx_register_i2c();
110 }
111 
112 
113 #ifdef CONFIG_MACH_EDB9301
114 MACHINE_START(EDB9301, "Cirrus Logic EDB9301 Evaluation Board")
115 	/* Maintainer: H Hartley Sweeten <hsweeten@visionengravers.com> */
116 	.phys_io	= EP93XX_APB_PHYS_BASE,
117 	.io_pg_offst	= ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
118 	.boot_params	= EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
119 	.map_io		= ep93xx_map_io,
120 	.init_irq	= ep93xx_init_irq,
121 	.timer		= &ep93xx_timer,
122 	.init_machine	= edb93xx_init_machine,
123 MACHINE_END
124 #endif
125 
126 #ifdef CONFIG_MACH_EDB9302
127 MACHINE_START(EDB9302, "Cirrus Logic EDB9302 Evaluation Board")
128 	/* Maintainer: George Kashperko <george@chas.com.ua> */
129 	.phys_io	= EP93XX_APB_PHYS_BASE,
130 	.io_pg_offst	= ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
131 	.boot_params	= EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
132 	.map_io		= ep93xx_map_io,
133 	.init_irq	= ep93xx_init_irq,
134 	.timer		= &ep93xx_timer,
135 	.init_machine	= edb93xx_init_machine,
136 MACHINE_END
137 #endif
138 
139 #ifdef CONFIG_MACH_EDB9302A
140 MACHINE_START(EDB9302A, "Cirrus Logic EDB9302A Evaluation Board")
141 	/* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */
142 	.phys_io	= EP93XX_APB_PHYS_BASE,
143 	.io_pg_offst	= ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
144 	.boot_params	= EP93XX_SDCE0_PHYS_BASE + 0x100,
145 	.map_io		= ep93xx_map_io,
146 	.init_irq	= ep93xx_init_irq,
147 	.timer		= &ep93xx_timer,
148 	.init_machine	= edb93xx_init_machine,
149 MACHINE_END
150 #endif
151 
152 #ifdef CONFIG_MACH_EDB9307
153 MACHINE_START(EDB9307, "Cirrus Logic EDB9307 Evaluation Board")
154 	/* Maintainer: Herbert Valerio Riedel <hvr@gnu.org> */
155 	.phys_io	= EP93XX_APB_PHYS_BASE,
156 	.io_pg_offst	= ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
157 	.boot_params	= EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
158 	.map_io		= ep93xx_map_io,
159 	.init_irq	= ep93xx_init_irq,
160 	.timer		= &ep93xx_timer,
161 	.init_machine	= edb93xx_init_machine,
162 MACHINE_END
163 #endif
164 
165 #ifdef CONFIG_MACH_EDB9307A
166 MACHINE_START(EDB9307A, "Cirrus Logic EDB9307A Evaluation Board")
167 	/* Maintainer: H Hartley Sweeten <hsweeten@visionengravers.com> */
168 	.phys_io	= EP93XX_APB_PHYS_BASE,
169 	.io_pg_offst	= ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
170 	.boot_params	= EP93XX_SDCE0_PHYS_BASE + 0x100,
171 	.map_io		= ep93xx_map_io,
172 	.init_irq	= ep93xx_init_irq,
173 	.timer		= &ep93xx_timer,
174 	.init_machine	= edb93xx_init_machine,
175 MACHINE_END
176 #endif
177 
178 #ifdef CONFIG_MACH_EDB9312
179 MACHINE_START(EDB9312, "Cirrus Logic EDB9312 Evaluation Board")
180 	/* Maintainer: Toufeeq Hussain <toufeeq_hussain@infosys.com> */
181 	.phys_io	= EP93XX_APB_PHYS_BASE,
182 	.io_pg_offst	= ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
183 	.boot_params	= EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
184 	.map_io		= ep93xx_map_io,
185 	.init_irq	= ep93xx_init_irq,
186 	.timer		= &ep93xx_timer,
187 	.init_machine	= edb93xx_init_machine,
188 MACHINE_END
189 #endif
190 
191 #ifdef CONFIG_MACH_EDB9315
192 MACHINE_START(EDB9315, "Cirrus Logic EDB9315 Evaluation Board")
193 	/* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */
194 	.phys_io	= EP93XX_APB_PHYS_BASE,
195 	.io_pg_offst	= ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
196 	.boot_params	= EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
197 	.map_io		= ep93xx_map_io,
198 	.init_irq	= ep93xx_init_irq,
199 	.timer		= &ep93xx_timer,
200 	.init_machine	= edb93xx_init_machine,
201 MACHINE_END
202 #endif
203 
204 #ifdef CONFIG_MACH_EDB9315A
205 MACHINE_START(EDB9315A, "Cirrus Logic EDB9315A Evaluation Board")
206 	/* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */
207 	.phys_io	= EP93XX_APB_PHYS_BASE,
208 	.io_pg_offst	= ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
209 	.boot_params	= EP93XX_SDCE0_PHYS_BASE + 0x100,
210 	.map_io		= ep93xx_map_io,
211 	.init_irq	= ep93xx_init_irq,
212 	.timer		= &ep93xx_timer,
213 	.init_machine	= edb93xx_init_machine,
214 MACHINE_END
215 #endif
216