blob: 4ea70e5f7137587e8cbac4e0211f8ee3d370b6f5 [file] [log] [blame]
Shadi Ammouri4640fa62009-02-24 15:26:23 -05001/*
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>
John Hollandd7b222d2010-02-19 23:11:01 +010014#include <linux/ata_platform.h>
Shadi Ammouri4640fa62009-02-24 15:26:23 -050015#include <linux/mtd/partitions.h>
16#include <linux/mv643xx_eth.h>
Nicolas Pitre3ec0d472009-03-02 23:44:41 -050017#include <linux/gpio.h>
Nicolas Pitree96c33d2009-03-03 01:16:07 -050018#include <linux/leds.h>
Shadi Ammouri4640fa62009-02-24 15:26:23 -050019#include <asm/mach-types.h>
20#include <asm/mach/arch.h>
21#include <mach/kirkwood.h>
22#include <plat/mvsdio.h>
Shadi Ammouri4640fa62009-02-24 15:26:23 -050023#include "common.h"
Nicolas Pitre3ec0d472009-03-02 23:44:41 -050024#include "mpp.h"
Shadi Ammouri4640fa62009-02-24 15:26:23 -050025
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
Shadi Ammouri4640fa62009-02-24 15:26:23 -050042static struct mv643xx_eth_platform_data sheevaplug_ge00_data = {
43 .phy_addr = MV643XX_ETH_PHY_ADDR(0),
44};
45
John Hollandd7b222d2010-02-19 23:11:01 +010046static struct mv_sata_platform_data sheeva_esata_sata_data = {
47 .n_ports = 2,
48};
49
Shadi Ammouri4640fa62009-02-24 15:26:23 -050050static struct mvsdio_platform_data sheevaplug_mvsdio_data = {
Nicolas Pitref14081e2009-05-29 22:29:01 -040051 /* unfortunately the CD signal has not been connected */
Shadi Ammouri4640fa62009-02-24 15:26:23 -050052};
53
John Hollandd5b57462010-02-19 23:11:04 +010054static 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
Nicolas Pitree96c33d2009-03-03 01:16:07 -050059static struct gpio_led sheevaplug_led_pins[] = {
60 {
Robin Becker7780c802011-03-12 15:32:45 +000061 .name = "plug:red:misc",
62 .default_trigger = "none",
63 .gpio = 46,
64 .active_low = 1,
65 },
66 {
Nicolas Pitree96c33d2009-03-03 01:16:07 -050067 .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
Nicolas Pitre3ec0d472009-03-02 23:44:41 -050087static unsigned int sheevaplug_mpp_config[] __initdata = {
88 MPP29_GPIO, /* USB Power Enable */
Robin Becker7780c802011-03-12 15:32:45 +000089 MPP46_GPIO, /* LED Red */
Nicolas Pitree96c33d2009-03-03 01:16:07 -050090 MPP49_GPIO, /* LED */
Nicolas Pitre3ec0d472009-03-02 23:44:41 -050091 0
92};
93
John Hollandd5b57462010-02-19 23:11:04 +010094static 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
Shadi Ammouri4640fa62009-02-24 15:26:23 -0500102static void __init sheevaplug_init(void)
103{
104 /*
105 * Basic setup. Needs to be called early.
106 */
107 kirkwood_init();
John Hollandd5b57462010-02-19 23:11:04 +0100108
109 /* setup gpio pin select */
Jon Medhurst (Tixy)d22759ed2011-12-06 09:59:38 +0100110 if (machine_is_esata_sheevaplug())
John Hollandd5b57462010-02-19 23:11:04 +0100111 kirkwood_mpp_conf(sheeva_esata_mpp_config);
112 else
113 kirkwood_mpp_conf(sheevaplug_mpp_config);
Shadi Ammouri4640fa62009-02-24 15:26:23 -0500114
115 kirkwood_uart0_init();
Nicolas Pitrefb7b2d32009-06-01 15:36:36 -0400116 kirkwood_nand_init(ARRAY_AND_SIZE(sheevaplug_nand_parts), 25);
Nicolas Pitre3ec0d472009-03-02 23:44:41 -0500117
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");
Shadi Ammouri4640fa62009-02-24 15:26:23 -0500121 kirkwood_ehci_init();
Nicolas Pitre3ec0d472009-03-02 23:44:41 -0500122
Shadi Ammouri4640fa62009-02-24 15:26:23 -0500123 kirkwood_ge00_init(&sheevaplug_ge00_data);
John Hollandd7b222d2010-02-19 23:11:01 +0100124
125 /* honor lower power consumption for plugs with out eSATA */
Jon Medhurst (Tixy)d22759ed2011-12-06 09:59:38 +0100126 if (machine_is_esata_sheevaplug())
John Hollandd7b222d2010-02-19 23:11:01 +0100127 kirkwood_sata_init(&sheeva_esata_sata_data);
128
John Hollandd5b57462010-02-19 23:11:04 +0100129 /* enable sd wp and sd cd on plugs with esata */
Jon Medhurst (Tixy)d22759ed2011-12-06 09:59:38 +0100130 if (machine_is_esata_sheevaplug())
John Hollandd5b57462010-02-19 23:11:04 +0100131 kirkwood_sdio_init(&sheeva_esata_mvsdio_data);
132 else
133 kirkwood_sdio_init(&sheevaplug_mvsdio_data);
Shadi Ammouri4640fa62009-02-24 15:26:23 -0500134
Nicolas Pitree96c33d2009-03-03 01:16:07 -0500135 platform_device_register(&sheevaplug_leds);
Shadi Ammouri4640fa62009-02-24 15:26:23 -0500136}
137
John Hollandd8ecb342010-02-19 23:10:58 +0100138#ifdef CONFIG_MACH_SHEEVAPLUG
Shadi Ammouri4640fa62009-02-24 15:26:23 -0500139MACHINE_START(SHEEVAPLUG, "Marvell SheevaPlug Reference Board")
140 /* Maintainer: shadi Ammouri <shadi@marvell.com> */
Nicolas Pitre1b7bd282011-07-05 22:38:13 -0400141 .atag_offset = 0x100,
Shadi Ammouri4640fa62009-02-24 15:26:23 -0500142 .init_machine = sheevaplug_init,
143 .map_io = kirkwood_map_io,
Lennert Buytenhek4ee1f6b2010-10-15 16:50:26 +0200144 .init_early = kirkwood_init_early,
Shadi Ammouri4640fa62009-02-24 15:26:23 -0500145 .init_irq = kirkwood_init_irq,
146 .timer = &kirkwood_timer,
Russell Kingcb15dff2011-11-05 10:03:47 +0000147 .restart = kirkwood_restart,
Shadi Ammouri4640fa62009-02-24 15:26:23 -0500148MACHINE_END
John Hollandd8ecb342010-02-19 23:10:58 +0100149#endif
150
151#ifdef CONFIG_MACH_ESATA_SHEEVAPLUG
152MACHINE_START(ESATA_SHEEVAPLUG, "Marvell eSATA SheevaPlug Reference Board")
Nicolas Pitre1b7bd282011-07-05 22:38:13 -0400153 .atag_offset = 0x100,
John Hollandd8ecb342010-02-19 23:10:58 +0100154 .init_machine = sheevaplug_init,
155 .map_io = kirkwood_map_io,
Lennert Buytenhek4ee1f6b2010-10-15 16:50:26 +0200156 .init_early = kirkwood_init_early,
John Hollandd8ecb342010-02-19 23:10:58 +0100157 .init_irq = kirkwood_init_irq,
158 .timer = &kirkwood_timer,
Russell Kingcb15dff2011-11-05 10:03:47 +0000159 .restart = kirkwood_restart,
John Hollandd8ecb342010-02-19 23:10:58 +0100160MACHINE_END
161#endif