aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-kirkwood
diff options
context:
space:
mode:
authorSimon Baatz <gmbnomis@gmail.com>2012-04-30 17:55:17 -0400
committerJason Cooper <jason@lakedaemon.net>2012-05-14 23:18:49 -0400
commitf5520363532690f56e12126029864d9383d5203f (patch)
tree244f770e3354367f573b5583a41c6a7a8a2ac52e /arch/arm/mach-kirkwood
parentc06cd9bfcad4960023bac1f052da748824e24961 (diff)
ARM: kirkwood: Add support for RaidSonic IB-NAS6210/6220 using devicetree
Add support for the IB-NAS6210 and IB-NAS 6220. Describe as much as currently possible in the devicetree files, including the NAND partitions. Use the partition scheme of the original firmware by default. Create a board-ib62x0.c for everything else. Signed-off-by: Simon Baatz <gmbnomis@gmail.com> Signed-off-by: Jason Cooper <jason@lakedaemon.net>
Diffstat (limited to 'arch/arm/mach-kirkwood')
-rw-r--r--arch/arm/mach-kirkwood/Kconfig8
-rw-r--r--arch/arm/mach-kirkwood/Makefile1
-rw-r--r--arch/arm/mach-kirkwood/Makefile.boot1
-rw-r--r--arch/arm/mach-kirkwood/board-dt.c4
-rw-r--r--arch/arm/mach-kirkwood/board-ib62x0.c143
-rw-r--r--arch/arm/mach-kirkwood/common.h6
6 files changed, 163 insertions, 0 deletions
diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig
index bbea3f6f6d36..199764fe0fb0 100644
--- a/arch/arm/mach-kirkwood/Kconfig
+++ b/arch/arm/mach-kirkwood/Kconfig
@@ -72,6 +72,14 @@ config MACH_DLINK_KIRKWOOD_DT
72 Kirkwood-based D-Link NASes such as DNS-320 & DNS-325, 72 Kirkwood-based D-Link NASes such as DNS-320 & DNS-325,
73 using Flattened Device Tree. 73 using Flattened Device Tree.
74 74
75config MACH_IB62X0_DT
76 bool "RaidSonic IB-NAS6210, IB-NAS6220 (Flattened Device Tree)"
77 select ARCH_KIRKWOOD_DT
78 help
79 Say 'Y' here if you want your kernel to support the
80 RaidSonic IB-NAS6210 & IB-NAS6220 devices, using
81 Flattened Device Tree.
82
75config MACH_TS219 83config MACH_TS219
76 bool "QNAP TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and TS-219P+ Turbo NAS" 84 bool "QNAP TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and TS-219P+ Turbo NAS"
77 help 85 help
diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile
index 82a3d13e5dc2..d2b05907b10e 100644
--- a/arch/arm/mach-kirkwood/Makefile
+++ b/arch/arm/mach-kirkwood/Makefile
@@ -24,3 +24,4 @@ obj-$(CONFIG_ARCH_KIRKWOOD_DT) += board-dt.o
24obj-$(CONFIG_MACH_DREAMPLUG_DT) += board-dreamplug.o 24obj-$(CONFIG_MACH_DREAMPLUG_DT) += board-dreamplug.o
25obj-$(CONFIG_MACH_ICONNECT_DT) += board-iconnect.o 25obj-$(CONFIG_MACH_ICONNECT_DT) += board-iconnect.o
26obj-$(CONFIG_MACH_DLINK_KIRKWOOD_DT) += board-dnskw.o 26obj-$(CONFIG_MACH_DLINK_KIRKWOOD_DT) += board-dnskw.o
27obj-$(CONFIG_MACH_IB62X0_DT) += board-ib62x0.o
diff --git a/arch/arm/mach-kirkwood/Makefile.boot b/arch/arm/mach-kirkwood/Makefile.boot
index a827ca164065..02edbdf5b065 100644
--- a/arch/arm/mach-kirkwood/Makefile.boot
+++ b/arch/arm/mach-kirkwood/Makefile.boot
@@ -6,3 +6,4 @@ dtb-$(CONFIG_MACH_DREAMPLUG_DT) += kirkwood-dreamplug.dtb
6dtb-$(CONFIG_MACH_DLINK_KIRKWOOD_DT) += kirkwood-dns320.dtb 6dtb-$(CONFIG_MACH_DLINK_KIRKWOOD_DT) += kirkwood-dns320.dtb
7dtb-$(CONFIG_MACH_DLINK_KIRKWOOD_DT) += kirkwood-dns325.dtb 7dtb-$(CONFIG_MACH_DLINK_KIRKWOOD_DT) += kirkwood-dns325.dtb
8dtb-$(CONFIG_MACH_ICONNECT_DT) += kirkwood-iconnect.dtb 8dtb-$(CONFIG_MACH_ICONNECT_DT) += kirkwood-iconnect.dtb
9dtb-$(CONFIG_MACH_IB62X0_DT) += kirkwood-ib62x0.dtb
diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c
index 7e82a8e93795..10d1969b9e3a 100644
--- a/arch/arm/mach-kirkwood/board-dt.c
+++ b/arch/arm/mach-kirkwood/board-dt.c
@@ -62,6 +62,9 @@ static void __init kirkwood_dt_init(void)
62 if (of_machine_is_compatible("iom,iconnect")) 62 if (of_machine_is_compatible("iom,iconnect"))
63 iconnect_init(); 63 iconnect_init();
64 64
65 if (of_machine_is_compatible("raidsonic,ib-nas62x0"))
66 ib62x0_init();
67
65 of_platform_populate(NULL, kirkwood_dt_match_table, NULL, NULL); 68 of_platform_populate(NULL, kirkwood_dt_match_table, NULL, NULL);
66} 69}
67 70
@@ -70,6 +73,7 @@ static const char *kirkwood_dt_board_compat[] = {
70 "dlink,dns-320", 73 "dlink,dns-320",
71 "dlink,dns-325", 74 "dlink,dns-325",
72 "iom,iconnect", 75 "iom,iconnect",
76 "raidsonic,ib-nas62x0",
73 NULL 77 NULL
74}; 78};
75 79
diff --git a/arch/arm/mach-kirkwood/board-ib62x0.c b/arch/arm/mach-kirkwood/board-ib62x0.c
new file mode 100644
index 000000000000..eddf1df8891f
--- /dev/null
+++ b/arch/arm/mach-kirkwood/board-ib62x0.c
@@ -0,0 +1,143 @@
1/*
2 * Copyright 2012 (C), Simon Baatz <gmbnomis@gmail.com>
3 *
4 * arch/arm/mach-kirkwood/board-ib62x0.c
5 *
6 * RaidSonic ICY BOX IB-NAS6210 & IB-NAS6220 init for drivers not
7 * converted to flattened device tree yet.
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#include <linux/kernel.h>
15#include <linux/init.h>
16#include <linux/platform_device.h>
17#include <linux/mtd/partitions.h>
18#include <linux/ata_platform.h>
19#include <linux/mv643xx_eth.h>
20#include <linux/gpio.h>
21#include <linux/gpio_keys.h>
22#include <linux/input.h>
23#include <linux/leds.h>
24#include <asm/mach-types.h>
25#include <asm/mach/arch.h>
26#include <mach/kirkwood.h>
27#include "common.h"
28#include "mpp.h"
29
30#define IB62X0_GPIO_POWER_OFF 24
31
32static struct mv643xx_eth_platform_data ib62x0_ge00_data = {
33 .phy_addr = MV643XX_ETH_PHY_ADDR(8),
34};
35
36static struct mv_sata_platform_data ib62x0_sata_data = {
37 .n_ports = 2,
38};
39
40static unsigned int ib62x0_mpp_config[] __initdata = {
41 MPP0_NF_IO2,
42 MPP1_NF_IO3,
43 MPP2_NF_IO4,
44 MPP3_NF_IO5,
45 MPP4_NF_IO6,
46 MPP5_NF_IO7,
47 MPP18_NF_IO0,
48 MPP19_NF_IO1,
49 MPP22_GPIO, /* OS LED red */
50 MPP24_GPIO, /* Power off device */
51 MPP25_GPIO, /* OS LED green */
52 MPP27_GPIO, /* USB transfer LED */
53 MPP28_GPIO, /* Reset button */
54 MPP29_GPIO, /* USB Copy button */
55 0
56};
57
58static struct gpio_led ib62x0_led_pins[] = {
59 {
60 .name = "ib62x0:green:os",
61 .default_trigger = "default-on",
62 .gpio = 25,
63 .active_low = 0,
64 },
65 {
66 .name = "ib62x0:red:os",
67 .default_trigger = "none",
68 .gpio = 22,
69 .active_low = 0,
70 },
71 {
72 .name = "ib62x0:red:usb_copy",
73 .default_trigger = "none",
74 .gpio = 27,
75 .active_low = 0,
76 },
77};
78
79static struct gpio_led_platform_data ib62x0_led_data = {
80 .leds = ib62x0_led_pins,
81 .num_leds = ARRAY_SIZE(ib62x0_led_pins),
82};
83
84static struct platform_device ib62x0_led_device = {
85 .name = "leds-gpio",
86 .id = -1,
87 .dev = {
88 .platform_data = &ib62x0_led_data,
89 }
90};
91
92static struct gpio_keys_button ib62x0_button_pins[] = {
93 {
94 .code = KEY_COPY,
95 .gpio = 29,
96 .desc = "USB Copy",
97 .active_low = 1,
98 },
99 {
100 .code = KEY_RESTART,
101 .gpio = 28,
102 .desc = "Reset",
103 .active_low = 1,
104 },
105};
106
107static struct gpio_keys_platform_data ib62x0_button_data = {
108 .buttons = ib62x0_button_pins,
109 .nbuttons = ARRAY_SIZE(ib62x0_button_pins),
110};
111
112static struct platform_device ib62x0_button_device = {
113 .name = "gpio-keys",
114 .id = -1,
115 .num_resources = 0,
116 .dev = {
117 .platform_data = &ib62x0_button_data,
118 }
119};
120
121static void ib62x0_power_off(void)
122{
123 gpio_set_value(IB62X0_GPIO_POWER_OFF, 1);
124}
125
126void __init ib62x0_init(void)
127{
128 /*
129 * Basic setup. Needs to be called early.
130 */
131 kirkwood_mpp_conf(ib62x0_mpp_config);
132
133 kirkwood_ehci_init();
134 kirkwood_ge00_init(&ib62x0_ge00_data);
135 kirkwood_sata_init(&ib62x0_sata_data);
136 platform_device_register(&ib62x0_led_device);
137 platform_device_register(&ib62x0_button_device);
138 if (gpio_request(IB62X0_GPIO_POWER_OFF, "ib62x0:power:off") == 0 &&
139 gpio_direction_output(IB62X0_GPIO_POWER_OFF, 0) == 0)
140 pm_power_off = ib62x0_power_off;
141 else
142 pr_err("board-ib62x0: failed to configure power-off GPIO\n");
143}
diff --git a/arch/arm/mach-kirkwood/common.h b/arch/arm/mach-kirkwood/common.h
index 5f0365c74b06..a34c41a5172e 100644
--- a/arch/arm/mach-kirkwood/common.h
+++ b/arch/arm/mach-kirkwood/common.h
@@ -70,6 +70,12 @@ void iconnect_init(void);
70static inline void iconnect_init(void) {}; 70static inline void iconnect_init(void) {};
71#endif 71#endif
72 72
73#ifdef CONFIG_MACH_IB62X0_DT
74void ib62x0_init(void);
75#else
76static inline void ib62x0_init(void) {};
77#endif
78
73/* early init functions not converted to fdt yet */ 79/* early init functions not converted to fdt yet */
74char *kirkwood_id(void); 80char *kirkwood_id(void);
75void kirkwood_l2_init(void); 81void kirkwood_l2_init(void);