aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-orion5x
diff options
context:
space:
mode:
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>2014-04-22 17:26:40 -0400
committerJason Cooper <jason@lakedaemon.net>2014-04-26 15:45:25 -0400
commitfbf04d814d0a57b0eead41efd70b3fbe903201d9 (patch)
tree5d9f29a3592580dd967b84e932b58425e7900ef6 /arch/arm/mach-orion5x
parent94b0bd366e36379c994bdaa84f18355702212eb4 (diff)
ARM: orion5x: convert Maxtor Shared Storage II to the Device Tree
This commit converts the Maxtor Shared Storage II Orion5x platform to the Device Tree. The only remaining things not converted are PCI and the special power off method. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Acked-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> Link: https://lkml.kernel.org/r/1398202002-28530-37-git-send-email-thomas.petazzoni@free-electrons.com Cc: Sylver Bruneau <sylver.bruneau@googlemail.com> Signed-off-by: Jason Cooper <jason@lakedaemon.net>
Diffstat (limited to 'arch/arm/mach-orion5x')
-rw-r--r--arch/arm/mach-orion5x/Kconfig5
-rw-r--r--arch/arm/mach-orion5x/Makefile2
-rw-r--r--arch/arm/mach-orion5x/board-dt.c3
-rw-r--r--arch/arm/mach-orion5x/board-mss2.c90
-rw-r--r--arch/arm/mach-orion5x/common.h6
-rw-r--r--arch/arm/mach-orion5x/mss2-setup.c274
6 files changed, 103 insertions, 277 deletions
diff --git a/arch/arm/mach-orion5x/Kconfig b/arch/arm/mach-orion5x/Kconfig
index 3c4ad83c782a..2412efb6cdd9 100644
--- a/arch/arm/mach-orion5x/Kconfig
+++ b/arch/arm/mach-orion5x/Kconfig
@@ -129,8 +129,9 @@ config MACH_NET2BIG
129 Say 'Y' here if you want your kernel to support the 129 Say 'Y' here if you want your kernel to support the
130 LaCie 2Big Network NAS. 130 LaCie 2Big Network NAS.
131 131
132config MACH_MSS2 132config MACH_MSS2_DT
133 bool "Maxtor Shared Storage II" 133 bool "Maxtor Shared Storage II (Flattened Device Tree)"
134 select ARCH_ORION5X_DT
134 help 135 help
135 Say 'Y' here if you want your kernel to support the 136 Say 'Y' here if you want your kernel to support the
136 Maxtor Shared Storage II platform. 137 Maxtor Shared Storage II platform.
diff --git a/arch/arm/mach-orion5x/Makefile b/arch/arm/mach-orion5x/Makefile
index 787dcee96806..a40b5c9a58c4 100644
--- a/arch/arm/mach-orion5x/Makefile
+++ b/arch/arm/mach-orion5x/Makefile
@@ -13,7 +13,6 @@ obj-$(CONFIG_MACH_WRT350N_V2) += wrt350n-v2-setup.o
13obj-$(CONFIG_MACH_TS78XX) += ts78xx-setup.o 13obj-$(CONFIG_MACH_TS78XX) += ts78xx-setup.o
14obj-$(CONFIG_MACH_MV2120) += mv2120-setup.o 14obj-$(CONFIG_MACH_MV2120) += mv2120-setup.o
15obj-$(CONFIG_MACH_NET2BIG) += net2big-setup.o 15obj-$(CONFIG_MACH_NET2BIG) += net2big-setup.o
16obj-$(CONFIG_MACH_MSS2) += mss2-setup.o
17obj-$(CONFIG_MACH_WNR854T) += wnr854t-setup.o 16obj-$(CONFIG_MACH_WNR854T) += wnr854t-setup.o
18obj-$(CONFIG_MACH_RD88F5181L_GE) += rd88f5181l-ge-setup.o 17obj-$(CONFIG_MACH_RD88F5181L_GE) += rd88f5181l-ge-setup.o
19obj-$(CONFIG_MACH_RD88F5181L_FXO) += rd88f5181l-fxo-setup.o 18obj-$(CONFIG_MACH_RD88F5181L_FXO) += rd88f5181l-fxo-setup.o
@@ -22,4 +21,5 @@ obj-$(CONFIG_MACH_LINKSTATION_LSCHL) += ls-chl-setup.o
22 21
23obj-$(CONFIG_ARCH_ORION5X_DT) += board-dt.o 22obj-$(CONFIG_ARCH_ORION5X_DT) += board-dt.o
24obj-$(CONFIG_MACH_D2NET_DT) += board-d2net.o 23obj-$(CONFIG_MACH_D2NET_DT) += board-d2net.o
24obj-$(CONFIG_MACH_MSS2_DT) += board-mss2.o
25obj-$(CONFIG_MACH_RD88F5182_DT) += board-rd88f5182.o 25obj-$(CONFIG_MACH_RD88F5182_DT) += board-rd88f5182.o
diff --git a/arch/arm/mach-orion5x/board-dt.c b/arch/arm/mach-orion5x/board-dt.c
index 78d2e528f982..35d418faf8f1 100644
--- a/arch/arm/mach-orion5x/board-dt.c
+++ b/arch/arm/mach-orion5x/board-dt.c
@@ -61,6 +61,9 @@ static void __init orion5x_dt_init(void)
61 cpu_idle_poll_ctrl(true); 61 cpu_idle_poll_ctrl(true);
62 } 62 }
63 63
64 if (of_machine_is_compatible("maxtor,shared-storage-2"))
65 mss2_init();
66
64 of_platform_populate(NULL, of_default_bus_match_table, 67 of_platform_populate(NULL, of_default_bus_match_table,
65 orion5x_auxdata_lookup, NULL); 68 orion5x_auxdata_lookup, NULL);
66} 69}
diff --git a/arch/arm/mach-orion5x/board-mss2.c b/arch/arm/mach-orion5x/board-mss2.c
new file mode 100644
index 000000000000..66f9c3ba86cc
--- /dev/null
+++ b/arch/arm/mach-orion5x/board-mss2.c
@@ -0,0 +1,90 @@
1/*
2 * Maxtor Shared Storage II Board Setup
3 *
4 * Maintainer: Sylver Bruneau <sylver.bruneau@googlemail.com>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#include <linux/kernel.h>
13#include <linux/init.h>
14#include <linux/platform_device.h>
15#include <linux/pci.h>
16#include <linux/irq.h>
17#include <asm/mach-types.h>
18#include <asm/mach/arch.h>
19#include <asm/mach/pci.h>
20#include <mach/orion5x.h>
21#include <mach/bridge-regs.h>
22#include "common.h"
23
24/*****************************************************************************
25 * Maxtor Shared Storage II Info
26 ****************************************************************************/
27
28/****************************************************************************
29 * PCI setup
30 ****************************************************************************/
31static int __init mss2_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
32{
33 int irq;
34
35 /*
36 * Check for devices with hard-wired IRQs.
37 */
38 irq = orion5x_pci_map_irq(dev, slot, pin);
39 if (irq != -1)
40 return irq;
41
42 return -1;
43}
44
45static struct hw_pci mss2_pci __initdata = {
46 .nr_controllers = 2,
47 .setup = orion5x_pci_sys_setup,
48 .scan = orion5x_pci_sys_scan_bus,
49 .map_irq = mss2_pci_map_irq,
50};
51
52static int __init mss2_pci_init(void)
53{
54 if (machine_is_mss2())
55 pci_common_init(&mss2_pci);
56
57 return 0;
58}
59subsys_initcall(mss2_pci_init);
60
61/*****************************************************************************
62 * MSS2 power off method
63 ****************************************************************************/
64/*
65 * On the Maxtor Shared Storage II, the shutdown process is the following :
66 * - Userland modifies U-boot env to tell U-boot to go idle at next boot
67 * - The board reboots
68 * - U-boot starts and go into an idle mode until the user press "power"
69 */
70static void mss2_power_off(void)
71{
72 u32 reg;
73
74 /*
75 * Enable and issue soft reset
76 */
77 reg = readl(RSTOUTn_MASK);
78 reg |= 1 << 2;
79 writel(reg, RSTOUTn_MASK);
80
81 reg = readl(CPU_SOFT_RESET);
82 reg |= 1;
83 writel(reg, CPU_SOFT_RESET);
84}
85
86void __init mss2_init(void)
87{
88 /* register mss2 specific power-off method */
89 pm_power_off = mss2_power_off;
90}
diff --git a/arch/arm/mach-orion5x/common.h b/arch/arm/mach-orion5x/common.h
index 7d64a17a3943..db7e056493a0 100644
--- a/arch/arm/mach-orion5x/common.h
+++ b/arch/arm/mach-orion5x/common.h
@@ -68,6 +68,12 @@ struct meminfo;
68struct tag; 68struct tag;
69extern void __init tag_fixup_mem32(struct tag *, char **, struct meminfo *); 69extern void __init tag_fixup_mem32(struct tag *, char **, struct meminfo *);
70 70
71#ifdef CONFIG_MACH_MSS2_DT
72extern void mss2_init(void);
73#else
74static inline void mss2_init(void) {}
75#endif
76
71/***************************************************************************** 77/*****************************************************************************
72 * Helpers to access Orion registers 78 * Helpers to access Orion registers
73 ****************************************************************************/ 79 ****************************************************************************/
diff --git a/arch/arm/mach-orion5x/mss2-setup.c b/arch/arm/mach-orion5x/mss2-setup.c
deleted file mode 100644
index e105130ba51c..000000000000
--- a/arch/arm/mach-orion5x/mss2-setup.c
+++ /dev/null
@@ -1,274 +0,0 @@
1/*
2 * Maxtor Shared Storage II Board Setup
3 *
4 * Maintainer: Sylver Bruneau <sylver.bruneau@googlemail.com>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#include <linux/kernel.h>
13#include <linux/init.h>
14#include <linux/platform_device.h>
15#include <linux/pci.h>
16#include <linux/irq.h>
17#include <linux/mtd/physmap.h>
18#include <linux/mv643xx_eth.h>
19#include <linux/leds.h>
20#include <linux/gpio_keys.h>
21#include <linux/input.h>
22#include <linux/i2c.h>
23#include <linux/ata_platform.h>
24#include <linux/gpio.h>
25#include <asm/mach-types.h>
26#include <asm/mach/arch.h>
27#include <asm/mach/pci.h>
28#include <mach/orion5x.h>
29#include <mach/bridge-regs.h>
30#include "common.h"
31#include "mpp.h"
32
33#define MSS2_NOR_BOOT_BASE 0xff800000
34#define MSS2_NOR_BOOT_SIZE SZ_256K
35
36/*****************************************************************************
37 * Maxtor Shared Storage II Info
38 ****************************************************************************/
39
40/*
41 * Maxtor Shared Storage II hardware :
42 * - Marvell 88F5182-A2 C500
43 * - Marvell 88E1111 Gigabit Ethernet PHY
44 * - RTC M41T81 (@0x68) on I2C bus
45 * - 256KB NOR flash
46 * - 64MB of RAM
47 */
48
49/*****************************************************************************
50 * 256KB NOR Flash on BOOT Device
51 ****************************************************************************/
52
53static struct physmap_flash_data mss2_nor_flash_data = {
54 .width = 1,
55};
56
57static struct resource mss2_nor_flash_resource = {
58 .flags = IORESOURCE_MEM,
59 .start = MSS2_NOR_BOOT_BASE,
60 .end = MSS2_NOR_BOOT_BASE + MSS2_NOR_BOOT_SIZE - 1,
61};
62
63static struct platform_device mss2_nor_flash = {
64 .name = "physmap-flash",
65 .id = 0,
66 .dev = {
67 .platform_data = &mss2_nor_flash_data,
68 },
69 .resource = &mss2_nor_flash_resource,
70 .num_resources = 1,
71};
72
73/****************************************************************************
74 * PCI setup
75 ****************************************************************************/
76static int __init mss2_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
77{
78 int irq;
79
80 /*
81 * Check for devices with hard-wired IRQs.
82 */
83 irq = orion5x_pci_map_irq(dev, slot, pin);
84 if (irq != -1)
85 return irq;
86
87 return -1;
88}
89
90static struct hw_pci mss2_pci __initdata = {
91 .nr_controllers = 2,
92 .setup = orion5x_pci_sys_setup,
93 .scan = orion5x_pci_sys_scan_bus,
94 .map_irq = mss2_pci_map_irq,
95};
96
97static int __init mss2_pci_init(void)
98{
99 if (machine_is_mss2())
100 pci_common_init(&mss2_pci);
101
102 return 0;
103}
104subsys_initcall(mss2_pci_init);
105
106
107/*****************************************************************************
108 * Ethernet
109 ****************************************************************************/
110
111static struct mv643xx_eth_platform_data mss2_eth_data = {
112 .phy_addr = MV643XX_ETH_PHY_ADDR(8),
113};
114
115/*****************************************************************************
116 * SATA
117 ****************************************************************************/
118
119static struct mv_sata_platform_data mss2_sata_data = {
120 .n_ports = 2,
121};
122
123/*****************************************************************************
124 * GPIO buttons
125 ****************************************************************************/
126
127#define MSS2_GPIO_KEY_RESET 12
128#define MSS2_GPIO_KEY_POWER 11
129
130static struct gpio_keys_button mss2_buttons[] = {
131 {
132 .code = KEY_POWER,
133 .gpio = MSS2_GPIO_KEY_POWER,
134 .desc = "Power",
135 .active_low = 1,
136 }, {
137 .code = KEY_RESTART,
138 .gpio = MSS2_GPIO_KEY_RESET,
139 .desc = "Reset",
140 .active_low = 1,
141 },
142};
143
144static struct gpio_keys_platform_data mss2_button_data = {
145 .buttons = mss2_buttons,
146 .nbuttons = ARRAY_SIZE(mss2_buttons),
147};
148
149static struct platform_device mss2_button_device = {
150 .name = "gpio-keys",
151 .id = -1,
152 .dev = {
153 .platform_data = &mss2_button_data,
154 },
155};
156
157/*****************************************************************************
158 * RTC m41t81 on I2C bus
159 ****************************************************************************/
160
161#define MSS2_GPIO_RTC_IRQ 3
162
163static struct i2c_board_info __initdata mss2_i2c_rtc = {
164 I2C_BOARD_INFO("m41t81", 0x68),
165};
166
167/*****************************************************************************
168 * MSS2 power off method
169 ****************************************************************************/
170/*
171 * On the Maxtor Shared Storage II, the shutdown process is the following :
172 * - Userland modifies U-boot env to tell U-boot to go idle at next boot
173 * - The board reboots
174 * - U-boot starts and go into an idle mode until the user press "power"
175 */
176static void mss2_power_off(void)
177{
178 u32 reg;
179
180 /*
181 * Enable and issue soft reset
182 */
183 reg = readl(RSTOUTn_MASK);
184 reg |= 1 << 2;
185 writel(reg, RSTOUTn_MASK);
186
187 reg = readl(CPU_SOFT_RESET);
188 reg |= 1;
189 writel(reg, CPU_SOFT_RESET);
190}
191
192/****************************************************************************
193 * General Setup
194 ****************************************************************************/
195static unsigned int mss2_mpp_modes[] __initdata = {
196 MPP0_GPIO, /* Power LED */
197 MPP1_GPIO, /* Error LED */
198 MPP2_UNUSED,
199 MPP3_GPIO, /* RTC interrupt */
200 MPP4_GPIO, /* HDD ind. (Single/Dual)*/
201 MPP5_GPIO, /* HD0 5V control */
202 MPP6_GPIO, /* HD0 12V control */
203 MPP7_GPIO, /* HD1 5V control */
204 MPP8_GPIO, /* HD1 12V control */
205 MPP9_UNUSED,
206 MPP10_GPIO, /* Fan control */
207 MPP11_GPIO, /* Power button */
208 MPP12_GPIO, /* Reset button */
209 MPP13_UNUSED,
210 MPP14_SATA_LED, /* SATA 0 active */
211 MPP15_SATA_LED, /* SATA 1 active */
212 MPP16_UNUSED,
213 MPP17_UNUSED,
214 MPP18_UNUSED,
215 MPP19_UNUSED,
216 0,
217};
218
219static void __init mss2_init(void)
220{
221 /* Setup basic Orion functions. Need to be called early. */
222 orion5x_init();
223
224 orion5x_mpp_conf(mss2_mpp_modes);
225
226 /*
227 * MPP[20] Unused
228 * MPP[21] PCI clock
229 * MPP[22] USB 0 over current
230 * MPP[23] USB 1 over current
231 */
232
233 /*
234 * Configure peripherals.
235 */
236 orion5x_ehci0_init();
237 orion5x_ehci1_init();
238 orion5x_eth_init(&mss2_eth_data);
239 orion5x_i2c_init();
240 orion5x_sata_init(&mss2_sata_data);
241 orion5x_uart0_init();
242 orion5x_xor_init();
243
244 mvebu_mbus_add_window_by_id(ORION_MBUS_DEVBUS_BOOT_TARGET,
245 ORION_MBUS_DEVBUS_BOOT_ATTR,
246 MSS2_NOR_BOOT_BASE,
247 MSS2_NOR_BOOT_SIZE);
248 platform_device_register(&mss2_nor_flash);
249
250 platform_device_register(&mss2_button_device);
251
252 if (gpio_request(MSS2_GPIO_RTC_IRQ, "rtc") == 0) {
253 if (gpio_direction_input(MSS2_GPIO_RTC_IRQ) == 0)
254 mss2_i2c_rtc.irq = gpio_to_irq(MSS2_GPIO_RTC_IRQ);
255 else
256 gpio_free(MSS2_GPIO_RTC_IRQ);
257 }
258 i2c_register_board_info(0, &mss2_i2c_rtc, 1);
259
260 /* register mss2 specific power-off method */
261 pm_power_off = mss2_power_off;
262}
263
264MACHINE_START(MSS2, "Maxtor Shared Storage II")
265 /* Maintainer: Sylver Bruneau <sylver.bruneau@googlemail.com> */
266 .atag_offset = 0x100,
267 .init_machine = mss2_init,
268 .map_io = orion5x_map_io,
269 .init_early = orion5x_init_early,
270 .init_irq = orion5x_init_irq,
271 .init_time = orion5x_timer_init,
272 .fixup = tag_fixup_mem32,
273 .restart = orion5x_restart,
274MACHINE_END