2 * arch/arm/mach-kirkwood/nas6210-setup.c
4 * Raidsonic ICYBOX NAS6210 Board Setup
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.
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/gpio_keys.h>
19 #include <linux/input.h>
20 #include <linux/leds.h>
21 #include <asm/mach-types.h>
22 #include <asm/mach/arch.h>
23 #include <mach/kirkwood.h>
27 #define NAS6210_GPIO_POWER_OFF 24
29 static struct mtd_partition nas6210_nand_parts[] = {
36 .offset = MTDPART_OFS_NXTBLK,
40 .offset = MTDPART_OFS_NXTBLK,
44 .offset = MTDPART_OFS_NXTBLK,
45 .size = MTDPART_SIZ_FULL
49 static struct mv643xx_eth_platform_data nas6210_ge00_data = {
50 .phy_addr = MV643XX_ETH_PHY_ADDR(8),
53 static struct mv_sata_platform_data nas6210_sata_data = {
57 static struct gpio_led nas6210_led_pins[] = {
59 .name = "status:green:power",
60 .default_trigger = "default-on",
65 .name = "status:red:power",
66 .default_trigger = "none",
71 .name = "status:red:usb_copy",
72 .default_trigger = "none",
78 static struct gpio_led_platform_data nas6210_led_data = {
79 .leds = nas6210_led_pins,
80 .num_leds = ARRAY_SIZE(nas6210_led_pins),
83 static struct platform_device nas6210_leds = {
87 .platform_data = &nas6210_led_data,
91 static struct gpio_keys_button nas6210_buttons[] = {
106 static struct gpio_keys_platform_data nas6210_button_data = {
107 .buttons = nas6210_buttons,
108 .nbuttons = ARRAY_SIZE(nas6210_buttons),
111 static struct platform_device nas6210_button_device = {
116 .platform_data = &nas6210_button_data,
120 static unsigned int nas6210_mpp_config[] __initdata = {
129 MPP22_GPIO, /* Power LED red */
130 MPP24_GPIO, /* Power off device */
131 MPP25_GPIO, /* Power LED green */
132 MPP27_GPIO, /* USB transfer LED */
133 MPP28_GPIO, /* Reset button */
134 MPP29_GPIO, /* USB Copy button */
138 static void nas6210_power_off(void)
140 gpio_set_value(NAS6210_GPIO_POWER_OFF, 1);
143 static void __init nas6210_init(void)
146 * Basic setup. Needs to be called early.
149 kirkwood_mpp_conf(nas6210_mpp_config);
151 kirkwood_nand_init(ARRAY_AND_SIZE(nas6210_nand_parts), 25);
152 kirkwood_ehci_init();
153 kirkwood_ge00_init(&nas6210_ge00_data);
154 kirkwood_sata_init(&nas6210_sata_data);
155 kirkwood_uart0_init();
156 platform_device_register(&nas6210_leds);
157 platform_device_register(&nas6210_button_device);
158 if (gpio_request(NAS6210_GPIO_POWER_OFF, "power-off") == 0 &&
159 gpio_direction_output(NAS6210_GPIO_POWER_OFF, 0) == 0)
160 pm_power_off = nas6210_power_off;
162 pr_err("nas6210: failed to configure power-off GPIO\n");
165 static int __init nas6210_pci_init(void)
167 if (machine_is_nas6210()) {
170 kirkwood_pcie_id(&dev, &rev);
171 if (dev == MV88F6282_DEV_ID)
172 kirkwood_pcie_init(KW_PCIE1 | KW_PCIE0);
174 kirkwood_pcie_init(KW_PCIE0);
179 subsys_initcall(nas6210_pci_init);
181 MACHINE_START(NAS6210, "RaidSonic ICY BOX IB-NAS6210")
182 /* Maintainer: <gmbnomis at gmail dot com> */
183 .atag_offset = 0x100,
184 .init_machine = nas6210_init,
185 .map_io = kirkwood_map_io,
186 .init_early = kirkwood_init_early,
187 .init_irq = kirkwood_init_irq,
188 .timer = &kirkwood_timer,
189 .restart = kirkwood_restart,