blob: bb9bc70381ef1b6b9328c9439ec460d0049e77f0 [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
Nicolas Pitree96c33d2009-03-03 01:16:07 -050054static 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
Nicolas Pitre3ec0d472009-03-02 23:44:41 -050076static unsigned int sheevaplug_mpp_config[] __initdata = {
77 MPP29_GPIO, /* USB Power Enable */
Nicolas Pitree96c33d2009-03-03 01:16:07 -050078 MPP49_GPIO, /* LED */
Nicolas Pitre3ec0d472009-03-02 23:44:41 -050079 0
80};
81
Shadi Ammouri4640fa62009-02-24 15:26:23 -050082static void __init sheevaplug_init(void)
83{
84 /*
85 * Basic setup. Needs to be called early.
86 */
87 kirkwood_init();
Nicolas Pitre3ec0d472009-03-02 23:44:41 -050088 kirkwood_mpp_conf(sheevaplug_mpp_config);
Shadi Ammouri4640fa62009-02-24 15:26:23 -050089
90 kirkwood_uart0_init();
Nicolas Pitrefb7b2d32009-06-01 15:36:36 -040091 kirkwood_nand_init(ARRAY_AND_SIZE(sheevaplug_nand_parts), 25);
Nicolas Pitre3ec0d472009-03-02 23:44:41 -050092
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");
Shadi Ammouri4640fa62009-02-24 15:26:23 -050096 kirkwood_ehci_init();
Nicolas Pitre3ec0d472009-03-02 23:44:41 -050097
Shadi Ammouri4640fa62009-02-24 15:26:23 -050098 kirkwood_ge00_init(&sheevaplug_ge00_data);
John Hollandd7b222d2010-02-19 23:11:01 +010099
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
Shadi Ammouri4640fa62009-02-24 15:26:23 -0500104 kirkwood_sdio_init(&sheevaplug_mvsdio_data);
105
Nicolas Pitree96c33d2009-03-03 01:16:07 -0500106 platform_device_register(&sheevaplug_leds);
Shadi Ammouri4640fa62009-02-24 15:26:23 -0500107}
108
John Hollandd8ecb342010-02-19 23:10:58 +0100109#ifdef CONFIG_MACH_SHEEVAPLUG
Shadi Ammouri4640fa62009-02-24 15:26:23 -0500110MACHINE_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
John Hollandd8ecb342010-02-19 23:10:58 +0100120#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