1/*
2 * arch/arm/mach-kirkwood/goflexhome-setup.c
3 *
4 * Seagate GoFlex Home 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>
14#include <linux/ata_platform.h>
15#include <linux/mtd/partitions.h>
16#include <linux/mv643xx_eth.h>
17#include <linux/gpio.h>
18#include <linux/leds.h>
19#include <asm/mach-types.h>
20#include <asm/mach/arch.h>
21#include <mach/kirkwood.h>
22#include "common.h"
23#include "mpp.h"
24
25static struct mtd_partition goflexhome_nand_parts[] = {
26	{
27		.name = "u-boot",
28		.offset = 0,
29		.size = SZ_1M
30	}, {
31		.name = "uImage",
32		.offset = MTDPART_OFS_NXTBLK,
33		.size = SZ_2M + SZ_4M
34	}, {
35		.name = "root",
36		.offset = MTDPART_OFS_NXTBLK,
37		.size = MTDPART_SIZ_FULL
38	},
39};
40
41static struct mv643xx_eth_platform_data goflexhome_ge00_data = {
42	.phy_addr	= MV643XX_ETH_PHY_ADDR(0),
43};
44
45static struct mv_sata_platform_data goflexhome_sata_data = {
46	.n_ports	= 1,
47};
48
49static struct gpio_led goflexhome_led_pins[] = {
50	{
51		.name			= "status:green:health",
52		.default_trigger	= "default-on",
53		.gpio			= 46,
54		.active_low		= 1,
55	},
56	{
57		.name			= "status:orange:fault",
58		.default_trigger	= "none",
59		.gpio			= 47,
60		.active_low		= 1,
61	},
62	{
63		.name			= "status:white:misc",
64		.default_trigger	= "none",
65		.gpio			= 40,
66		.active_low		= 0,
67	}
68};
69
70static struct gpio_led_platform_data goflexhome_led_data = {
71	.leds		= goflexhome_led_pins,
72	.num_leds	= ARRAY_SIZE(goflexhome_led_pins),
73};
74
75static struct platform_device goflexhome_leds = {
76	.name	= "leds-gpio",
77	.id	= -1,
78	.dev	= {
79		.platform_data	= &goflexhome_led_data,
80	}
81};
82
83static unsigned int goflexhome_mpp_config[] __initdata = {
84	MPP29_GPIO,	/* USB Power Enable */
85	MPP47_GPIO,	/* LED Orange */
86	MPP46_GPIO,	/* LED Green */
87	MPP40_GPIO,	/* LED White */
88	0
89};
90
91static void __init goflexhome_init(void)
92{
93	/*
94	 * Basic setup. Needs to be called early.
95	 */
96	kirkwood_init();
97
98	/* setup gpio pin select */
99	kirkwood_mpp_conf(goflexhome_mpp_config);
100
101	kirkwood_uart0_init();
102	kirkwood_nand_init(ARRAY_AND_SIZE(goflexhome_nand_parts), 40);
103
104	if (gpio_request(29, "USB Power Enable") != 0 ||
105	    gpio_direction_output(29, 1) != 0)
106		printk(KERN_ERR "can't set up GPIO 29 (USB Power Enable)\n");
107	kirkwood_ehci_init();
108	kirkwood_ge00_init(&goflexhome_ge00_data);
109	kirkwood_sata_init(&goflexhome_sata_data);
110
111	platform_device_register(&goflexhome_leds);
112}
113
114MACHINE_START(GOFLEXHOME, "Seagate GoFlex Home")
115	/* Maintainer: Peter Carmichael <peterjncarm@ovi.com> */
116	.atag_offset	= 0x100,
117	.init_machine	= goflexhome_init,
118	.map_io		= kirkwood_map_io,
119	.init_early	= kirkwood_init_early,
120	.init_irq	= kirkwood_init_irq,
121	.timer		= &kirkwood_timer,
122	.restart	= kirkwood_restart,
123MACHINE_END
124