diff options
author | Nicolas Pitre <nico@cam.org> | 2009-06-01 15:36:36 -0400 |
---|---|---|
committer | Nicolas Pitre <nico@cam.org> | 2009-06-08 13:04:58 -0400 |
commit | fb7b2d3f0dda3fbd711c191fd3b9496653e81ac7 (patch) | |
tree | f13cc711bc6e81d6cd39b4f521303d3e9e455901 /arch/arm/mach-kirkwood | |
parent | a88656553d18c324554855fccc730c9644048111 (diff) |
[ARM] Kirkwood: rationalize NAND setup a bit
Common resource and platform device structures are moved to common.c
and only the partition table and chip delay remains a per board
parameter.
Signed-off-by: Nicolas Pitre <nico@marvell.com>
Diffstat (limited to 'arch/arm/mach-kirkwood')
-rw-r--r-- | arch/arm/mach-kirkwood/common.c | 37 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/common.h | 3 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/db88f6281-bp-setup.c | 31 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/rd88f6192-nas-setup.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/rd88f6281-setup.c | 31 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/sheevaplug-setup.c | 30 |
6 files changed, 43 insertions, 91 deletions
diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c index be1ca28fed3f..6e3eb1a6a660 100644 --- a/arch/arm/mach-kirkwood/common.c +++ b/arch/arm/mach-kirkwood/common.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/mv643xx_eth.h> | 16 | #include <linux/mv643xx_eth.h> |
17 | #include <linux/mv643xx_i2c.h> | 17 | #include <linux/mv643xx_i2c.h> |
18 | #include <linux/ata_platform.h> | 18 | #include <linux/ata_platform.h> |
19 | #include <linux/mtd/nand.h> | ||
19 | #include <linux/spi/orion_spi.h> | 20 | #include <linux/spi/orion_spi.h> |
20 | #include <net/dsa.h> | 21 | #include <net/dsa.h> |
21 | #include <asm/page.h> | 22 | #include <asm/page.h> |
@@ -258,6 +259,42 @@ void __init kirkwood_ge00_switch_init(struct dsa_platform_data *d, int irq) | |||
258 | 259 | ||
259 | 260 | ||
260 | /***************************************************************************** | 261 | /***************************************************************************** |
262 | * NAND flash | ||
263 | ****************************************************************************/ | ||
264 | static struct resource kirkwood_nand_resource = { | ||
265 | .flags = IORESOURCE_MEM, | ||
266 | .start = KIRKWOOD_NAND_MEM_PHYS_BASE, | ||
267 | .end = KIRKWOOD_NAND_MEM_PHYS_BASE + | ||
268 | KIRKWOOD_NAND_MEM_SIZE - 1, | ||
269 | }; | ||
270 | |||
271 | static struct orion_nand_data kirkwood_nand_data = { | ||
272 | .cle = 0, | ||
273 | .ale = 1, | ||
274 | .width = 8, | ||
275 | }; | ||
276 | |||
277 | static struct platform_device kirkwood_nand_flash = { | ||
278 | .name = "orion_nand", | ||
279 | .id = -1, | ||
280 | .dev = { | ||
281 | .platform_data = &kirkwood_nand_data, | ||
282 | }, | ||
283 | .resource = &kirkwood_nand_resource, | ||
284 | .num_resources = 1, | ||
285 | }; | ||
286 | |||
287 | void __init kirkwood_nand_init(struct mtd_partition *parts, int nr_parts, | ||
288 | int chip_delay) | ||
289 | { | ||
290 | kirkwood_nand_data.parts = parts; | ||
291 | kirkwood_nand_data.nr_parts = nr_parts; | ||
292 | kirkwood_nand_data.chip_delay = chip_delay; | ||
293 | platform_device_register(&kirkwood_nand_flash); | ||
294 | } | ||
295 | |||
296 | |||
297 | /***************************************************************************** | ||
261 | * SoC RTC | 298 | * SoC RTC |
262 | ****************************************************************************/ | 299 | ****************************************************************************/ |
263 | static struct resource kirkwood_rtc_resource = { | 300 | static struct resource kirkwood_rtc_resource = { |
diff --git a/arch/arm/mach-kirkwood/common.h b/arch/arm/mach-kirkwood/common.h index 6ee88406f381..9de525664bb3 100644 --- a/arch/arm/mach-kirkwood/common.h +++ b/arch/arm/mach-kirkwood/common.h | |||
@@ -15,6 +15,7 @@ struct dsa_platform_data; | |||
15 | struct mv643xx_eth_platform_data; | 15 | struct mv643xx_eth_platform_data; |
16 | struct mv_sata_platform_data; | 16 | struct mv_sata_platform_data; |
17 | struct mvsdio_platform_data; | 17 | struct mvsdio_platform_data; |
18 | struct mtd_partition; | ||
18 | 19 | ||
19 | /* | 20 | /* |
20 | * Basic Kirkwood init functions used early by machine-setup. | 21 | * Basic Kirkwood init functions used early by machine-setup. |
@@ -40,9 +41,11 @@ void kirkwood_spi_init(void); | |||
40 | void kirkwood_i2c_init(void); | 41 | void kirkwood_i2c_init(void); |
41 | void kirkwood_uart0_init(void); | 42 | void kirkwood_uart0_init(void); |
42 | void kirkwood_uart1_init(void); | 43 | void kirkwood_uart1_init(void); |
44 | void kirkwood_nand_init(struct mtd_partition *parts, int nr_parts, int delay); | ||
43 | 45 | ||
44 | extern int kirkwood_tclk; | 46 | extern int kirkwood_tclk; |
45 | extern struct sys_timer kirkwood_timer; | 47 | extern struct sys_timer kirkwood_timer; |
46 | 48 | ||
49 | #define ARRAY_AND_SIZE(x) (x), ARRAY_SIZE(x) | ||
47 | 50 | ||
48 | #endif | 51 | #endif |
diff --git a/arch/arm/mach-kirkwood/db88f6281-bp-setup.c b/arch/arm/mach-kirkwood/db88f6281-bp-setup.c index 5505d5837752..39bdf4bcace9 100644 --- a/arch/arm/mach-kirkwood/db88f6281-bp-setup.c +++ b/arch/arm/mach-kirkwood/db88f6281-bp-setup.c | |||
@@ -11,14 +11,12 @@ | |||
11 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
12 | #include <linux/init.h> | 12 | #include <linux/init.h> |
13 | #include <linux/platform_device.h> | 13 | #include <linux/platform_device.h> |
14 | #include <linux/mtd/nand.h> | ||
15 | #include <linux/mtd/partitions.h> | 14 | #include <linux/mtd/partitions.h> |
16 | #include <linux/ata_platform.h> | 15 | #include <linux/ata_platform.h> |
17 | #include <linux/mv643xx_eth.h> | 16 | #include <linux/mv643xx_eth.h> |
18 | #include <asm/mach-types.h> | 17 | #include <asm/mach-types.h> |
19 | #include <asm/mach/arch.h> | 18 | #include <asm/mach/arch.h> |
20 | #include <mach/kirkwood.h> | 19 | #include <mach/kirkwood.h> |
21 | #include <plat/orion_nand.h> | ||
22 | #include <plat/mvsdio.h> | 20 | #include <plat/mvsdio.h> |
23 | #include "common.h" | 21 | #include "common.h" |
24 | #include "mpp.h" | 22 | #include "mpp.h" |
@@ -39,32 +37,6 @@ static struct mtd_partition db88f6281_nand_parts[] = { | |||
39 | }, | 37 | }, |
40 | }; | 38 | }; |
41 | 39 | ||
42 | static struct resource db88f6281_nand_resource = { | ||
43 | .flags = IORESOURCE_MEM, | ||
44 | .start = KIRKWOOD_NAND_MEM_PHYS_BASE, | ||
45 | .end = KIRKWOOD_NAND_MEM_PHYS_BASE + | ||
46 | KIRKWOOD_NAND_MEM_SIZE - 1, | ||
47 | }; | ||
48 | |||
49 | static struct orion_nand_data db88f6281_nand_data = { | ||
50 | .parts = db88f6281_nand_parts, | ||
51 | .nr_parts = ARRAY_SIZE(db88f6281_nand_parts), | ||
52 | .cle = 0, | ||
53 | .ale = 1, | ||
54 | .width = 8, | ||
55 | .chip_delay = 25, | ||
56 | }; | ||
57 | |||
58 | static struct platform_device db88f6281_nand_flash = { | ||
59 | .name = "orion_nand", | ||
60 | .id = -1, | ||
61 | .dev = { | ||
62 | .platform_data = &db88f6281_nand_data, | ||
63 | }, | ||
64 | .resource = &db88f6281_nand_resource, | ||
65 | .num_resources = 1, | ||
66 | }; | ||
67 | |||
68 | static struct mv643xx_eth_platform_data db88f6281_ge00_data = { | 40 | static struct mv643xx_eth_platform_data db88f6281_ge00_data = { |
69 | .phy_addr = MV643XX_ETH_PHY_ADDR(8), | 41 | .phy_addr = MV643XX_ETH_PHY_ADDR(8), |
70 | }; | 42 | }; |
@@ -92,13 +64,12 @@ static void __init db88f6281_init(void) | |||
92 | kirkwood_init(); | 64 | kirkwood_init(); |
93 | kirkwood_mpp_conf(db88f6281_mpp_config); | 65 | kirkwood_mpp_conf(db88f6281_mpp_config); |
94 | 66 | ||
67 | kirkwood_nand_init(ARRAY_AND_SIZE(db88f6281_nand_parts), 25); | ||
95 | kirkwood_ehci_init(); | 68 | kirkwood_ehci_init(); |
96 | kirkwood_ge00_init(&db88f6281_ge00_data); | 69 | kirkwood_ge00_init(&db88f6281_ge00_data); |
97 | kirkwood_sata_init(&db88f6281_sata_data); | 70 | kirkwood_sata_init(&db88f6281_sata_data); |
98 | kirkwood_uart0_init(); | 71 | kirkwood_uart0_init(); |
99 | kirkwood_sdio_init(&db88f6281_mvsdio_data); | 72 | kirkwood_sdio_init(&db88f6281_mvsdio_data); |
100 | |||
101 | platform_device_register(&db88f6281_nand_flash); | ||
102 | } | 73 | } |
103 | 74 | ||
104 | static int __init db88f6281_pci_init(void) | 75 | static int __init db88f6281_pci_init(void) |
diff --git a/arch/arm/mach-kirkwood/rd88f6192-nas-setup.c b/arch/arm/mach-kirkwood/rd88f6192-nas-setup.c index 2f0e4ef3db0f..8bf4153d0840 100644 --- a/arch/arm/mach-kirkwood/rd88f6192-nas-setup.c +++ b/arch/arm/mach-kirkwood/rd88f6192-nas-setup.c | |||
@@ -11,8 +11,6 @@ | |||
11 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
12 | #include <linux/init.h> | 12 | #include <linux/init.h> |
13 | #include <linux/platform_device.h> | 13 | #include <linux/platform_device.h> |
14 | #include <linux/mtd/nand.h> | ||
15 | #include <linux/mtd/partitions.h> | ||
16 | #include <linux/ata_platform.h> | 14 | #include <linux/ata_platform.h> |
17 | #include <linux/mv643xx_eth.h> | 15 | #include <linux/mv643xx_eth.h> |
18 | #include <linux/spi/flash.h> | 16 | #include <linux/spi/flash.h> |
diff --git a/arch/arm/mach-kirkwood/rd88f6281-setup.c b/arch/arm/mach-kirkwood/rd88f6281-setup.c index 31e996d65fc4..31708ddbc83e 100644 --- a/arch/arm/mach-kirkwood/rd88f6281-setup.c +++ b/arch/arm/mach-kirkwood/rd88f6281-setup.c | |||
@@ -12,7 +12,6 @@ | |||
12 | #include <linux/init.h> | 12 | #include <linux/init.h> |
13 | #include <linux/platform_device.h> | 13 | #include <linux/platform_device.h> |
14 | #include <linux/irq.h> | 14 | #include <linux/irq.h> |
15 | #include <linux/mtd/nand.h> | ||
16 | #include <linux/mtd/partitions.h> | 15 | #include <linux/mtd/partitions.h> |
17 | #include <linux/ata_platform.h> | 16 | #include <linux/ata_platform.h> |
18 | #include <linux/mv643xx_eth.h> | 17 | #include <linux/mv643xx_eth.h> |
@@ -22,7 +21,6 @@ | |||
22 | #include <asm/mach/arch.h> | 21 | #include <asm/mach/arch.h> |
23 | #include <mach/kirkwood.h> | 22 | #include <mach/kirkwood.h> |
24 | #include <plat/mvsdio.h> | 23 | #include <plat/mvsdio.h> |
25 | #include <plat/orion_nand.h> | ||
26 | #include "common.h" | 24 | #include "common.h" |
27 | #include "mpp.h" | 25 | #include "mpp.h" |
28 | 26 | ||
@@ -42,32 +40,6 @@ static struct mtd_partition rd88f6281_nand_parts[] = { | |||
42 | }, | 40 | }, |
43 | }; | 41 | }; |
44 | 42 | ||
45 | static struct resource rd88f6281_nand_resource = { | ||
46 | .flags = IORESOURCE_MEM, | ||
47 | .start = KIRKWOOD_NAND_MEM_PHYS_BASE, | ||
48 | .end = KIRKWOOD_NAND_MEM_PHYS_BASE + | ||
49 | KIRKWOOD_NAND_MEM_SIZE - 1, | ||
50 | }; | ||
51 | |||
52 | static struct orion_nand_data rd88f6281_nand_data = { | ||
53 | .parts = rd88f6281_nand_parts, | ||
54 | .nr_parts = ARRAY_SIZE(rd88f6281_nand_parts), | ||
55 | .cle = 0, | ||
56 | .ale = 1, | ||
57 | .width = 8, | ||
58 | .chip_delay = 25, | ||
59 | }; | ||
60 | |||
61 | static struct platform_device rd88f6281_nand_flash = { | ||
62 | .name = "orion_nand", | ||
63 | .id = -1, | ||
64 | .dev = { | ||
65 | .platform_data = &rd88f6281_nand_data, | ||
66 | }, | ||
67 | .resource = &rd88f6281_nand_resource, | ||
68 | .num_resources = 1, | ||
69 | }; | ||
70 | |||
71 | static struct mv643xx_eth_platform_data rd88f6281_ge00_data = { | 43 | static struct mv643xx_eth_platform_data rd88f6281_ge00_data = { |
72 | .phy_addr = MV643XX_ETH_PHY_NONE, | 44 | .phy_addr = MV643XX_ETH_PHY_NONE, |
73 | .speed = SPEED_1000, | 45 | .speed = SPEED_1000, |
@@ -114,6 +86,7 @@ static void __init rd88f6281_init(void) | |||
114 | kirkwood_init(); | 86 | kirkwood_init(); |
115 | kirkwood_mpp_conf(rd88f6281_mpp_config); | 87 | kirkwood_mpp_conf(rd88f6281_mpp_config); |
116 | 88 | ||
89 | kirkwood_nand_init(ARRAY_AND_SIZE(rd88f6281_nand_parts), 25); | ||
117 | kirkwood_ehci_init(); | 90 | kirkwood_ehci_init(); |
118 | 91 | ||
119 | kirkwood_ge00_init(&rd88f6281_ge00_data); | 92 | kirkwood_ge00_init(&rd88f6281_ge00_data); |
@@ -129,8 +102,6 @@ static void __init rd88f6281_init(void) | |||
129 | kirkwood_sata_init(&rd88f6281_sata_data); | 102 | kirkwood_sata_init(&rd88f6281_sata_data); |
130 | kirkwood_sdio_init(&rd88f6281_mvsdio_data); | 103 | kirkwood_sdio_init(&rd88f6281_mvsdio_data); |
131 | kirkwood_uart0_init(); | 104 | kirkwood_uart0_init(); |
132 | |||
133 | platform_device_register(&rd88f6281_nand_flash); | ||
134 | } | 105 | } |
135 | 106 | ||
136 | static int __init rd88f6281_pci_init(void) | 107 | static int __init rd88f6281_pci_init(void) |
diff --git a/arch/arm/mach-kirkwood/sheevaplug-setup.c b/arch/arm/mach-kirkwood/sheevaplug-setup.c index dcc448c98389..c7319eeac8bb 100644 --- a/arch/arm/mach-kirkwood/sheevaplug-setup.c +++ b/arch/arm/mach-kirkwood/sheevaplug-setup.c | |||
@@ -11,7 +11,6 @@ | |||
11 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
12 | #include <linux/init.h> | 12 | #include <linux/init.h> |
13 | #include <linux/platform_device.h> | 13 | #include <linux/platform_device.h> |
14 | #include <linux/mtd/nand.h> | ||
15 | #include <linux/mtd/partitions.h> | 14 | #include <linux/mtd/partitions.h> |
16 | #include <linux/mv643xx_eth.h> | 15 | #include <linux/mv643xx_eth.h> |
17 | #include <linux/gpio.h> | 16 | #include <linux/gpio.h> |
@@ -20,7 +19,6 @@ | |||
20 | #include <asm/mach/arch.h> | 19 | #include <asm/mach/arch.h> |
21 | #include <mach/kirkwood.h> | 20 | #include <mach/kirkwood.h> |
22 | #include <plat/mvsdio.h> | 21 | #include <plat/mvsdio.h> |
23 | #include <plat/orion_nand.h> | ||
24 | #include "common.h" | 22 | #include "common.h" |
25 | #include "mpp.h" | 23 | #include "mpp.h" |
26 | 24 | ||
@@ -40,32 +38,6 @@ static struct mtd_partition sheevaplug_nand_parts[] = { | |||
40 | }, | 38 | }, |
41 | }; | 39 | }; |
42 | 40 | ||
43 | static struct resource sheevaplug_nand_resource = { | ||
44 | .flags = IORESOURCE_MEM, | ||
45 | .start = KIRKWOOD_NAND_MEM_PHYS_BASE, | ||
46 | .end = KIRKWOOD_NAND_MEM_PHYS_BASE + | ||
47 | KIRKWOOD_NAND_MEM_SIZE - 1, | ||
48 | }; | ||
49 | |||
50 | static struct orion_nand_data sheevaplug_nand_data = { | ||
51 | .parts = sheevaplug_nand_parts, | ||
52 | .nr_parts = ARRAY_SIZE(sheevaplug_nand_parts), | ||
53 | .cle = 0, | ||
54 | .ale = 1, | ||
55 | .width = 8, | ||
56 | .chip_delay = 25, | ||
57 | }; | ||
58 | |||
59 | static struct platform_device sheevaplug_nand_flash = { | ||
60 | .name = "orion_nand", | ||
61 | .id = -1, | ||
62 | .dev = { | ||
63 | .platform_data = &sheevaplug_nand_data, | ||
64 | }, | ||
65 | .resource = &sheevaplug_nand_resource, | ||
66 | .num_resources = 1, | ||
67 | }; | ||
68 | |||
69 | static struct mv643xx_eth_platform_data sheevaplug_ge00_data = { | 41 | static struct mv643xx_eth_platform_data sheevaplug_ge00_data = { |
70 | .phy_addr = MV643XX_ETH_PHY_ADDR(0), | 42 | .phy_addr = MV643XX_ETH_PHY_ADDR(0), |
71 | }; | 43 | }; |
@@ -111,6 +83,7 @@ static void __init sheevaplug_init(void) | |||
111 | kirkwood_mpp_conf(sheevaplug_mpp_config); | 83 | kirkwood_mpp_conf(sheevaplug_mpp_config); |
112 | 84 | ||
113 | kirkwood_uart0_init(); | 85 | kirkwood_uart0_init(); |
86 | kirkwood_nand_init(ARRAY_AND_SIZE(sheevaplug_nand_parts), 25); | ||
114 | 87 | ||
115 | if (gpio_request(29, "USB Power Enable") != 0 || | 88 | if (gpio_request(29, "USB Power Enable") != 0 || |
116 | gpio_direction_output(29, 1) != 0) | 89 | gpio_direction_output(29, 1) != 0) |
@@ -120,7 +93,6 @@ static void __init sheevaplug_init(void) | |||
120 | kirkwood_ge00_init(&sheevaplug_ge00_data); | 93 | kirkwood_ge00_init(&sheevaplug_ge00_data); |
121 | kirkwood_sdio_init(&sheevaplug_mvsdio_data); | 94 | kirkwood_sdio_init(&sheevaplug_mvsdio_data); |
122 | 95 | ||
123 | platform_device_register(&sheevaplug_nand_flash); | ||
124 | platform_device_register(&sheevaplug_leds); | 96 | platform_device_register(&sheevaplug_leds); |
125 | } | 97 | } |
126 | 98 | ||