aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHartley Sweeten <hartleys@visionengravers.com>2010-06-10 11:19:08 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2010-06-16 17:56:05 -0400
commit16bcf78f8cac9cc3057c6ce3800490cb6e684ce8 (patch)
tree20f1337b5e0bd6bad2a25e01adf7aa84bf92dcb4
parent6ea4b7418dfd07dc76d20a3c3bf632ee7b59a2c4 (diff)
ARM: 6168/1: ep93xx: move physmap flash registration into core.c
Create a core.c __init function to handle the physmap flash registration for all the ep93xx platforms. Also, modify all the ep93xx platforms to use this new function. This simplifies all the ep93xx platform init code and reduces the size of the kernel when including multiple ep93xx boards. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Acked-by: Ryan Mallon <ryan@bluewatersys.com> Acked-by: Martin Guy <martinwguy@gmail.com> Acked-by: Hubert Feurstein <hubert.feurstein@contec.at> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r--arch/arm/mach-ep93xx/adssphere.c24
-rw-r--r--arch/arm/mach-ep93xx/core.c38
-rw-r--r--arch/arm/mach-ep93xx/edb93xx.c31
-rw-r--r--arch/arm/mach-ep93xx/gesbc9312.c24
-rw-r--r--arch/arm/mach-ep93xx/include/mach/platform.h3
-rw-r--r--arch/arm/mach-ep93xx/micro9.c37
-rw-r--r--arch/arm/mach-ep93xx/simone.c24
-rw-r--r--arch/arm/mach-ep93xx/ts72xx.c27
8 files changed, 59 insertions, 149 deletions
diff --git a/arch/arm/mach-ep93xx/adssphere.c b/arch/arm/mach-ep93xx/adssphere.c
index 3a1a855bfdc..f744f676783 100644
--- a/arch/arm/mach-ep93xx/adssphere.c
+++ b/arch/arm/mach-ep93xx/adssphere.c
@@ -13,7 +13,6 @@
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16#include <linux/mtd/physmap.h>
17 16
18#include <mach/hardware.h> 17#include <mach/hardware.h>
19 18
@@ -21,26 +20,6 @@
21#include <asm/mach/arch.h> 20#include <asm/mach/arch.h>
22 21
23 22
24static struct physmap_flash_data adssphere_flash_data = {
25 .width = 4,
26};
27
28static struct resource adssphere_flash_resource = {
29 .start = EP93XX_CS6_PHYS_BASE,
30 .end = EP93XX_CS6_PHYS_BASE + SZ_32M - 1,
31 .flags = IORESOURCE_MEM,
32};
33
34static struct platform_device adssphere_flash = {
35 .name = "physmap-flash",
36 .id = 0,
37 .dev = {
38 .platform_data = &adssphere_flash_data,
39 },
40 .num_resources = 1,
41 .resource = &adssphere_flash_resource,
42};
43
44static struct ep93xx_eth_data __initdata adssphere_eth_data = { 23static struct ep93xx_eth_data __initdata adssphere_eth_data = {
45 .phy_id = 1, 24 .phy_id = 1,
46}; 25};
@@ -48,8 +27,7 @@ static struct ep93xx_eth_data __initdata adssphere_eth_data = {
48static void __init adssphere_init_machine(void) 27static void __init adssphere_init_machine(void)
49{ 28{
50 ep93xx_init_devices(); 29 ep93xx_init_devices();
51 platform_device_register(&adssphere_flash); 30 ep93xx_register_flash(4, EP93XX_CS6_PHYS_BASE, SZ_32M);
52
53 ep93xx_register_eth(&adssphere_eth_data, 1); 31 ep93xx_register_eth(&adssphere_eth_data, 1);
54} 32}
55 33
diff --git a/arch/arm/mach-ep93xx/core.c b/arch/arm/mach-ep93xx/core.c
index ac6aeeb974d..f4b25bf00b6 100644
--- a/arch/arm/mach-ep93xx/core.c
+++ b/arch/arm/mach-ep93xx/core.c
@@ -29,6 +29,7 @@
29#include <linux/termios.h> 29#include <linux/termios.h>
30#include <linux/amba/bus.h> 30#include <linux/amba/bus.h>
31#include <linux/amba/serial.h> 31#include <linux/amba/serial.h>
32#include <linux/mtd/physmap.h>
32#include <linux/i2c.h> 33#include <linux/i2c.h>
33#include <linux/i2c-gpio.h> 34#include <linux/i2c-gpio.h>
34#include <linux/spi/spi.h> 35#include <linux/spi/spi.h>
@@ -348,6 +349,43 @@ static struct platform_device ep93xx_ohci_device = {
348 349
349 350
350/************************************************************************* 351/*************************************************************************
352 * EP93xx physmap'ed flash
353 *************************************************************************/
354static struct physmap_flash_data ep93xx_flash_data;
355
356static struct resource ep93xx_flash_resource = {
357 .flags = IORESOURCE_MEM,
358};
359
360static struct platform_device ep93xx_flash = {
361 .name = "physmap-flash",
362 .id = 0,
363 .dev = {
364 .platform_data = &ep93xx_flash_data,
365 },
366 .num_resources = 1,
367 .resource = &ep93xx_flash_resource,
368};
369
370/**
371 * ep93xx_register_flash() - Register the external flash device.
372 * @width: bank width in octets
373 * @start: resource start address
374 * @size: resource size
375 */
376void __init ep93xx_register_flash(unsigned int width,
377 resource_size_t start, resource_size_t size)
378{
379 ep93xx_flash_data.width = width;
380
381 ep93xx_flash_resource.start = start;
382 ep93xx_flash_resource.end = start + size - 1;
383
384 platform_device_register(&ep93xx_flash);
385}
386
387
388/*************************************************************************
351 * EP93xx ethernet peripheral handling 389 * EP93xx ethernet peripheral handling
352 *************************************************************************/ 390 *************************************************************************/
353static struct ep93xx_eth_data ep93xx_eth_data; 391static struct ep93xx_eth_data ep93xx_eth_data;
diff --git a/arch/arm/mach-ep93xx/edb93xx.c b/arch/arm/mach-ep93xx/edb93xx.c
index 3884182cd36..c2ce9034ba8 100644
--- a/arch/arm/mach-ep93xx/edb93xx.c
+++ b/arch/arm/mach-ep93xx/edb93xx.c
@@ -27,7 +27,6 @@
27#include <linux/kernel.h> 27#include <linux/kernel.h>
28#include <linux/init.h> 28#include <linux/init.h>
29#include <linux/platform_device.h> 29#include <linux/platform_device.h>
30#include <linux/mtd/physmap.h>
31#include <linux/gpio.h> 30#include <linux/gpio.h>
32#include <linux/i2c.h> 31#include <linux/i2c.h>
33#include <linux/i2c-gpio.h> 32#include <linux/i2c-gpio.h>
@@ -38,39 +37,13 @@
38#include <asm/mach/arch.h> 37#include <asm/mach/arch.h>
39 38
40 39
41static struct physmap_flash_data edb93xx_flash_data;
42
43static struct resource edb93xx_flash_resource = {
44 .flags = IORESOURCE_MEM,
45};
46
47static struct platform_device edb93xx_flash = {
48 .name = "physmap-flash",
49 .id = 0,
50 .dev = {
51 .platform_data = &edb93xx_flash_data,
52 },
53 .num_resources = 1,
54 .resource = &edb93xx_flash_resource,
55};
56
57static void __init __edb93xx_register_flash(unsigned int width,
58 resource_size_t start, resource_size_t size)
59{
60 edb93xx_flash_data.width = width;
61 edb93xx_flash_resource.start = start;
62 edb93xx_flash_resource.end = start + size - 1;
63
64 platform_device_register(&edb93xx_flash);
65}
66
67static void __init edb93xx_register_flash(void) 40static void __init edb93xx_register_flash(void)
68{ 41{
69 if (machine_is_edb9307() || machine_is_edb9312() || 42 if (machine_is_edb9307() || machine_is_edb9312() ||
70 machine_is_edb9315()) { 43 machine_is_edb9315()) {
71 __edb93xx_register_flash(4, EP93XX_CS6_PHYS_BASE, SZ_32M); 44 ep93xx_register_flash(4, EP93XX_CS6_PHYS_BASE, SZ_32M);
72 } else { 45 } else {
73 __edb93xx_register_flash(2, EP93XX_CS6_PHYS_BASE, SZ_16M); 46 ep93xx_register_flash(2, EP93XX_CS6_PHYS_BASE, SZ_16M);
74 } 47 }
75} 48}
76 49
diff --git a/arch/arm/mach-ep93xx/gesbc9312.c b/arch/arm/mach-ep93xx/gesbc9312.c
index a809618e9f0..d97168c0ba3 100644
--- a/arch/arm/mach-ep93xx/gesbc9312.c
+++ b/arch/arm/mach-ep93xx/gesbc9312.c
@@ -13,7 +13,6 @@
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16#include <linux/mtd/physmap.h>
17 16
18#include <mach/hardware.h> 17#include <mach/hardware.h>
19 18
@@ -21,26 +20,6 @@
21#include <asm/mach/arch.h> 20#include <asm/mach/arch.h>
22 21
23 22
24static struct physmap_flash_data gesbc9312_flash_data = {
25 .width = 4,
26};
27
28static struct resource gesbc9312_flash_resource = {
29 .start = EP93XX_CS6_PHYS_BASE,
30 .end = EP93XX_CS6_PHYS_BASE + SZ_8M - 1,
31 .flags = IORESOURCE_MEM,
32};
33
34static struct platform_device gesbc9312_flash = {
35 .name = "physmap-flash",
36 .id = 0,
37 .dev = {
38 .platform_data = &gesbc9312_flash_data,
39 },
40 .num_resources = 1,
41 .resource = &gesbc9312_flash_resource,
42};
43
44static struct ep93xx_eth_data __initdata gesbc9312_eth_data = { 23static struct ep93xx_eth_data __initdata gesbc9312_eth_data = {
45 .phy_id = 1, 24 .phy_id = 1,
46}; 25};
@@ -48,8 +27,7 @@ static struct ep93xx_eth_data __initdata gesbc9312_eth_data = {
48static void __init gesbc9312_init_machine(void) 27static void __init gesbc9312_init_machine(void)
49{ 28{
50 ep93xx_init_devices(); 29 ep93xx_init_devices();
51 platform_device_register(&gesbc9312_flash); 30 ep93xx_register_flash(4, EP93XX_CS6_PHYS_BASE, SZ_8M);
52
53 ep93xx_register_eth(&gesbc9312_eth_data, 0); 31 ep93xx_register_eth(&gesbc9312_eth_data, 0);
54} 32}
55 33
diff --git a/arch/arm/mach-ep93xx/include/mach/platform.h b/arch/arm/mach-ep93xx/include/mach/platform.h
index 9a4413dd44b..a6c09176334 100644
--- a/arch/arm/mach-ep93xx/include/mach/platform.h
+++ b/arch/arm/mach-ep93xx/include/mach/platform.h
@@ -43,6 +43,9 @@ static inline void ep93xx_devcfg_clear_bits(unsigned int bits)
43 43
44unsigned int ep93xx_chip_revision(void); 44unsigned int ep93xx_chip_revision(void);
45 45
46void ep93xx_register_flash(unsigned int width,
47 resource_size_t start, resource_size_t size);
48
46void ep93xx_register_eth(struct ep93xx_eth_data *data, int copy_addr); 49void ep93xx_register_eth(struct ep93xx_eth_data *data, int copy_addr);
47void ep93xx_register_i2c(struct i2c_gpio_platform_data *data, 50void ep93xx_register_i2c(struct i2c_gpio_platform_data *data,
48 struct i2c_board_info *devices, int num); 51 struct i2c_board_info *devices, int num);
diff --git a/arch/arm/mach-ep93xx/micro9.c b/arch/arm/mach-ep93xx/micro9.c
index 1cc911b4efa..2ba776320a8 100644
--- a/arch/arm/mach-ep93xx/micro9.c
+++ b/arch/arm/mach-ep93xx/micro9.c
@@ -14,7 +14,6 @@
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/mtd/physmap.h>
18#include <linux/io.h> 17#include <linux/io.h>
19 18
20#include <mach/hardware.h> 19#include <mach/hardware.h>
@@ -31,31 +30,6 @@
31 * Micro9-Lite uses a separate MTD map driver for flash support 30 * Micro9-Lite uses a separate MTD map driver for flash support
32 * Micro9-Slim has up to 64MB of either 32-bit or 16-bit flash on CS1 31 * Micro9-Slim has up to 64MB of either 32-bit or 16-bit flash on CS1
33 *************************************************************************/ 32 *************************************************************************/
34static struct physmap_flash_data micro9_flash_data;
35
36static struct resource micro9_flash_resource = {
37 .start = EP93XX_CS1_PHYS_BASE,
38 .end = EP93XX_CS1_PHYS_BASE + SZ_64M - 1,
39 .flags = IORESOURCE_MEM,
40};
41
42static struct platform_device micro9_flash = {
43 .name = "physmap-flash",
44 .id = 0,
45 .dev = {
46 .platform_data = &micro9_flash_data,
47 },
48 .num_resources = 1,
49 .resource = &micro9_flash_resource,
50};
51
52static void __init __micro9_register_flash(unsigned int width)
53{
54 micro9_flash_data.width = width;
55
56 platform_device_register(&micro9_flash);
57}
58
59static unsigned int __init micro9_detect_bootwidth(void) 33static unsigned int __init micro9_detect_bootwidth(void)
60{ 34{
61 u32 v; 35 u32 v;
@@ -70,10 +44,17 @@ static unsigned int __init micro9_detect_bootwidth(void)
70 44
71static void __init micro9_register_flash(void) 45static void __init micro9_register_flash(void)
72{ 46{
47 unsigned int width;
48
73 if (machine_is_micro9()) 49 if (machine_is_micro9())
74 __micro9_register_flash(4); 50 width = 4;
75 else if (machine_is_micro9m() || machine_is_micro9s()) 51 else if (machine_is_micro9m() || machine_is_micro9s())
76 __micro9_register_flash(micro9_detect_bootwidth()); 52 width = micro9_detect_bootwidth();
53 else
54 width = 0;
55
56 if (width)
57 ep93xx_register_flash(width, EP93XX_CS1_PHYS_BASE, SZ_64M);
77} 58}
78 59
79 60
diff --git a/arch/arm/mach-ep93xx/simone.c b/arch/arm/mach-ep93xx/simone.c
index 388aec95f60..5dded588413 100644
--- a/arch/arm/mach-ep93xx/simone.c
+++ b/arch/arm/mach-ep93xx/simone.c
@@ -18,7 +18,6 @@
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <linux/mtd/physmap.h>
22#include <linux/gpio.h> 21#include <linux/gpio.h>
23#include <linux/i2c.h> 22#include <linux/i2c.h>
24#include <linux/i2c-gpio.h> 23#include <linux/i2c-gpio.h>
@@ -29,26 +28,6 @@
29#include <asm/mach-types.h> 28#include <asm/mach-types.h>
30#include <asm/mach/arch.h> 29#include <asm/mach/arch.h>
31 30
32static struct physmap_flash_data simone_flash_data = {
33 .width = 2,
34};
35
36static struct resource simone_flash_resource = {
37 .start = EP93XX_CS6_PHYS_BASE,
38 .end = EP93XX_CS6_PHYS_BASE + SZ_8M - 1,
39 .flags = IORESOURCE_MEM,
40};
41
42static struct platform_device simone_flash = {
43 .name = "physmap-flash",
44 .id = 0,
45 .num_resources = 1,
46 .resource = &simone_flash_resource,
47 .dev = {
48 .platform_data = &simone_flash_data,
49 },
50};
51
52static struct ep93xx_eth_data __initdata simone_eth_data = { 31static struct ep93xx_eth_data __initdata simone_eth_data = {
53 .phy_id = 1, 32 .phy_id = 1,
54}; 33};
@@ -77,8 +56,7 @@ static struct i2c_board_info __initdata simone_i2c_board_info[] = {
77static void __init simone_init_machine(void) 56static void __init simone_init_machine(void)
78{ 57{
79 ep93xx_init_devices(); 58 ep93xx_init_devices();
80 59 ep93xx_register_flash(2, EP93XX_CS6_PHYS_BASE, SZ_8M);
81 platform_device_register(&simone_flash);
82 ep93xx_register_eth(&simone_eth_data, 1); 60 ep93xx_register_eth(&simone_eth_data, 1);
83 ep93xx_register_fb(&simone_fb_info); 61 ep93xx_register_fb(&simone_fb_info);
84 ep93xx_register_i2c(&simone_i2c_gpio_data, simone_i2c_board_info, 62 ep93xx_register_i2c(&simone_i2c_gpio_data, simone_i2c_board_info,
diff --git a/arch/arm/mach-ep93xx/ts72xx.c b/arch/arm/mach-ep93xx/ts72xx.c
index ae7319e588c..93aeab8af70 100644
--- a/arch/arm/mach-ep93xx/ts72xx.c
+++ b/arch/arm/mach-ep93xx/ts72xx.c
@@ -17,7 +17,6 @@
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18#include <linux/io.h> 18#include <linux/io.h>
19#include <linux/m48t86.h> 19#include <linux/m48t86.h>
20#include <linux/mtd/physmap.h>
21#include <linux/mtd/nand.h> 20#include <linux/mtd/nand.h>
22#include <linux/mtd/partitions.h> 21#include <linux/mtd/partitions.h>
23 22
@@ -173,31 +172,13 @@ static struct platform_device ts72xx_nand_flash = {
173}; 172};
174 173
175 174
176/*************************************************************************
177 * NOR flash (TS-7200 only)
178 *************************************************************************/
179static struct physmap_flash_data ts72xx_nor_data = {
180 .width = 2,
181};
182
183static struct resource ts72xx_nor_resource = {
184 .start = EP93XX_CS6_PHYS_BASE,
185 .end = EP93XX_CS6_PHYS_BASE + SZ_16M - 1,
186 .flags = IORESOURCE_MEM,
187};
188
189static struct platform_device ts72xx_nor_flash = {
190 .name = "physmap-flash",
191 .id = 0,
192 .dev.platform_data = &ts72xx_nor_data,
193 .resource = &ts72xx_nor_resource,
194 .num_resources = 1,
195};
196
197static void __init ts72xx_register_flash(void) 175static void __init ts72xx_register_flash(void)
198{ 176{
177 /*
178 * TS7200 has NOR flash all other TS72xx board have NAND flash.
179 */
199 if (board_is_ts7200()) { 180 if (board_is_ts7200()) {
200 platform_device_register(&ts72xx_nor_flash); 181 ep93xx_register_flash(2, EP93XX_CS6_PHYS_BASE, SZ_16M);
201 } else { 182 } else {
202 resource_size_t start; 183 resource_size_t start;
203 184