[ARM] eSATA SheevaPlug: configure SoC SATA interface
[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
e96c33d9
NP
54static struct gpio_led sheevaplug_led_pins[] = {
55 {
56 .name = "plug:green:health",
57 .default_trigger = "default-on",
58 .gpio = 49,
59 .active_low = 1,
60 },
61};
62
63static struct gpio_led_platform_data sheevaplug_led_data = {
64 .leds = sheevaplug_led_pins,
65 .num_leds = ARRAY_SIZE(sheevaplug_led_pins),
66};
67
68static struct platform_device sheevaplug_leds = {
69 .name = "leds-gpio",
70 .id = -1,
71 .dev = {
72 .platform_data = &sheevaplug_led_data,
73 }
74};
75
3ec0d474
NP
76static unsigned int sheevaplug_mpp_config[] __initdata = {
77 MPP29_GPIO, /* USB Power Enable */
e96c33d9 78 MPP49_GPIO, /* LED */
3ec0d474
NP
79 0
80};
81
4640fa60
SA
82static void __init sheevaplug_init(void)
83{
84 /*
85 * Basic setup. Needs to be called early.
86 */
87 kirkwood_init();
3ec0d474 88 kirkwood_mpp_conf(sheevaplug_mpp_config);
4640fa60
SA
89
90 kirkwood_uart0_init();
fb7b2d3f 91 kirkwood_nand_init(ARRAY_AND_SIZE(sheevaplug_nand_parts), 25);
3ec0d474
NP
92
93 if (gpio_request(29, "USB Power Enable") != 0 ||
94 gpio_direction_output(29, 1) != 0)
95 printk(KERN_ERR "can't set up GPIO 29 (USB Power Enable)\n");
4640fa60 96 kirkwood_ehci_init();
3ec0d474 97
4640fa60 98 kirkwood_ge00_init(&sheevaplug_ge00_data);
d7b222d7
JH
99
100 /* honor lower power consumption for plugs with out eSATA */
101 if (machine_is_sheeva_esata())
102 kirkwood_sata_init(&sheeva_esata_sata_data);
103
4640fa60
SA
104 kirkwood_sdio_init(&sheevaplug_mvsdio_data);
105
e96c33d9 106 platform_device_register(&sheevaplug_leds);
4640fa60
SA
107}
108
d8ecb349 109#ifdef CONFIG_MACH_SHEEVAPLUG
4640fa60
SA
110MACHINE_START(SHEEVAPLUG, "Marvell SheevaPlug Reference Board")
111 /* Maintainer: shadi Ammouri <shadi@marvell.com> */
112 .phys_io = KIRKWOOD_REGS_PHYS_BASE,
113 .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc,
114 .boot_params = 0x00000100,
115 .init_machine = sheevaplug_init,
116 .map_io = kirkwood_map_io,
117 .init_irq = kirkwood_init_irq,
118 .timer = &kirkwood_timer,
119MACHINE_END
d8ecb349
JH
120#endif
121
122#ifdef CONFIG_MACH_ESATA_SHEEVAPLUG
123MACHINE_START(ESATA_SHEEVAPLUG, "Marvell eSATA SheevaPlug Reference Board")
124 .phys_io = KIRKWOOD_REGS_PHYS_BASE,
125 .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc,
126 .boot_params = 0x00000100,
127 .init_machine = sheevaplug_init,
128 .map_io = kirkwood_map_io,
129 .init_irq = kirkwood_init_irq,
130 .timer = &kirkwood_timer,
131MACHINE_END
132#endif