Merge branch 'depends/rmk/memory_h' into next/cleanup2
[linux-2.6-block.git] / arch / arm / mach-kirkwood / sheevaplug-setup.c
CommitLineData
4640fa60
SA
1/*
2 * arch/arm/mach-kirkwood/sheevaplug-setup.c
3 *
4 * Marvell SheevaPlug Reference Board Setup
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/platform_device.h>
d7b222d7 14#include <linux/ata_platform.h>
4640fa60
SA
15#include <linux/mtd/partitions.h>
16#include <linux/mv643xx_eth.h>
3ec0d474 17#include <linux/gpio.h>
e96c33d9 18#include <linux/leds.h>
4640fa60
SA
19#include <asm/mach-types.h>
20#include <asm/mach/arch.h>
21#include <mach/kirkwood.h>
22#include <plat/mvsdio.h>
4640fa60 23#include "common.h"
3ec0d474 24#include "mpp.h"
4640fa60
SA
25
26static struct mtd_partition sheevaplug_nand_parts[] = {
27 {
28 .name = "u-boot",
29 .offset = 0,
30 .size = SZ_1M
31 }, {
32 .name = "uImage",
33 .offset = MTDPART_OFS_NXTBLK,
34 .size = SZ_4M
35 }, {
36 .name = "root",
37 .offset = MTDPART_OFS_NXTBLK,
38 .size = MTDPART_SIZ_FULL
39 },
40};
41
4640fa60
SA
42static struct mv643xx_eth_platform_data sheevaplug_ge00_data = {
43 .phy_addr = MV643XX_ETH_PHY_ADDR(0),
44};
45
d7b222d7
JH
46static struct mv_sata_platform_data sheeva_esata_sata_data = {
47 .n_ports = 2,
48};
49
4640fa60 50static struct mvsdio_platform_data sheevaplug_mvsdio_data = {
f14081e1 51 /* unfortunately the CD signal has not been connected */
4640fa60
SA
52};
53
d5b5746b
JH
54static struct mvsdio_platform_data sheeva_esata_mvsdio_data = {
55 .gpio_write_protect = 44, /* MPP44 used as SD write protect */
56 .gpio_card_detect = 47, /* MPP47 used as SD card detect */
57};
58
e96c33d9 59static struct gpio_led sheevaplug_led_pins[] = {
7780c803
RB
60 {
61 .name = "plug:red:misc",
62 .default_trigger = "none",
63 .gpio = 46,
64 .active_low = 1,
65 },
e96c33d9
NP
66 {
67 .name = "plug:green:health",
68 .default_trigger = "default-on",
69 .gpio = 49,
70 .active_low = 1,
71 },
72};
73
74static struct gpio_led_platform_data sheevaplug_led_data = {
75 .leds = sheevaplug_led_pins,
76 .num_leds = ARRAY_SIZE(sheevaplug_led_pins),
77};
78
79static struct platform_device sheevaplug_leds = {
80 .name = "leds-gpio",
81 .id = -1,
82 .dev = {
83 .platform_data = &sheevaplug_led_data,
84 }
85};
86
3ec0d474
NP
87static unsigned int sheevaplug_mpp_config[] __initdata = {
88 MPP29_GPIO, /* USB Power Enable */
7780c803 89 MPP46_GPIO, /* LED Red */
e96c33d9 90 MPP49_GPIO, /* LED */
3ec0d474
NP
91 0
92};
93
d5b5746b
JH
94static unsigned int sheeva_esata_mpp_config[] __initdata = {
95 MPP29_GPIO, /* USB Power Enable */
96 MPP44_GPIO, /* SD Write Protect */
97 MPP47_GPIO, /* SD Card Detect */
98 MPP49_GPIO, /* LED Green */
99 0
100};
101
4640fa60
SA
102static void __init sheevaplug_init(void)
103{
104 /*
105 * Basic setup. Needs to be called early.
106 */
107 kirkwood_init();
d5b5746b
JH
108
109 /* setup gpio pin select */
110 if (machine_is_sheeva_esata())
111 kirkwood_mpp_conf(sheeva_esata_mpp_config);
112 else
113 kirkwood_mpp_conf(sheevaplug_mpp_config);
4640fa60
SA
114
115 kirkwood_uart0_init();
fb7b2d3f 116 kirkwood_nand_init(ARRAY_AND_SIZE(sheevaplug_nand_parts), 25);
3ec0d474
NP
117
118 if (gpio_request(29, "USB Power Enable") != 0 ||
119 gpio_direction_output(29, 1) != 0)
120 printk(KERN_ERR "can't set up GPIO 29 (USB Power Enable)\n");
4640fa60 121 kirkwood_ehci_init();
3ec0d474 122
4640fa60 123 kirkwood_ge00_init(&sheevaplug_ge00_data);
d7b222d7
JH
124
125 /* honor lower power consumption for plugs with out eSATA */
126 if (machine_is_sheeva_esata())
127 kirkwood_sata_init(&sheeva_esata_sata_data);
128
d5b5746b
JH
129 /* enable sd wp and sd cd on plugs with esata */
130 if (machine_is_sheeva_esata())
131 kirkwood_sdio_init(&sheeva_esata_mvsdio_data);
132 else
133 kirkwood_sdio_init(&sheevaplug_mvsdio_data);
4640fa60 134
e96c33d9 135 platform_device_register(&sheevaplug_leds);
4640fa60
SA
136}
137
d8ecb349 138#ifdef CONFIG_MACH_SHEEVAPLUG
4640fa60
SA
139MACHINE_START(SHEEVAPLUG, "Marvell SheevaPlug Reference Board")
140 /* Maintainer: shadi Ammouri <shadi@marvell.com> */
1b7bd28c 141 .atag_offset = 0x100,
4640fa60
SA
142 .init_machine = sheevaplug_init,
143 .map_io = kirkwood_map_io,
4ee1f6b5 144 .init_early = kirkwood_init_early,
4640fa60
SA
145 .init_irq = kirkwood_init_irq,
146 .timer = &kirkwood_timer,
147MACHINE_END
d8ecb349
JH
148#endif
149
150#ifdef CONFIG_MACH_ESATA_SHEEVAPLUG
151MACHINE_START(ESATA_SHEEVAPLUG, "Marvell eSATA SheevaPlug Reference Board")
1b7bd28c 152 .atag_offset = 0x100,
d8ecb349
JH
153 .init_machine = sheevaplug_init,
154 .map_io = kirkwood_map_io,
4ee1f6b5 155 .init_early = kirkwood_init_early,
d8ecb349
JH
156 .init_irq = kirkwood_init_irq,
157 .timer = &kirkwood_timer,
158MACHINE_END
159#endif