aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-kirkwood
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /arch/arm/mach-kirkwood
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'arch/arm/mach-kirkwood')
-rw-r--r--arch/arm/mach-kirkwood/Kconfig24
-rw-r--r--arch/arm/mach-kirkwood/Makefile12
-rw-r--r--arch/arm/mach-kirkwood/common.c630
-rw-r--r--arch/arm/mach-kirkwood/common.h2
-rw-r--r--arch/arm/mach-kirkwood/d2net_v2-setup.c230
-rw-r--r--arch/arm/mach-kirkwood/db88f6281-bp-setup.c3
-rw-r--r--arch/arm/mach-kirkwood/dockstar-setup.c111
-rw-r--r--arch/arm/mach-kirkwood/guruplug-setup.c3
-rw-r--r--arch/arm/mach-kirkwood/include/mach/bridge-regs.h3
-rw-r--r--arch/arm/mach-kirkwood/include/mach/debug-macro.S11
-rw-r--r--arch/arm/mach-kirkwood/include/mach/gpio.h29
-rw-r--r--arch/arm/mach-kirkwood/include/mach/io.h4
-rw-r--r--arch/arm/mach-kirkwood/include/mach/irqs.h1
-rw-r--r--arch/arm/mach-kirkwood/include/mach/kirkwood.h2
-rw-r--r--arch/arm/mach-kirkwood/include/mach/leds-netxbig.h55
-rw-r--r--arch/arm/mach-kirkwood/include/mach/memory.h2
-rw-r--r--arch/arm/mach-kirkwood/irq.c35
-rw-r--r--arch/arm/mach-kirkwood/lacie_v2-common.c113
-rw-r--r--arch/arm/mach-kirkwood/lacie_v2-common.h16
-rw-r--r--arch/arm/mach-kirkwood/mpp.c63
-rw-r--r--arch/arm/mach-kirkwood/mpp.h6
-rw-r--r--arch/arm/mach-kirkwood/mv88f6281gtw_ge-setup.c3
-rw-r--r--arch/arm/mach-kirkwood/netspace_v2-setup.c162
-rw-r--r--arch/arm/mach-kirkwood/netxbig_v2-setup.c275
-rw-r--r--arch/arm/mach-kirkwood/openrd-setup.c112
-rw-r--r--arch/arm/mach-kirkwood/pcie.c8
-rw-r--r--arch/arm/mach-kirkwood/rd88f6192-nas-setup.c3
-rw-r--r--arch/arm/mach-kirkwood/rd88f6281-setup.c3
-rw-r--r--arch/arm/mach-kirkwood/sheevaplug-setup.c13
-rw-r--r--arch/arm/mach-kirkwood/t5325-setup.c20
-rw-r--r--arch/arm/mach-kirkwood/ts219-setup.c19
-rw-r--r--arch/arm/mach-kirkwood/ts41x-setup.c34
-rw-r--r--arch/arm/mach-kirkwood/tsx1x-common.c2
33 files changed, 1014 insertions, 995 deletions
diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig
index cc25501b57fa..7fc603b46891 100644
--- a/arch/arm/mach-kirkwood/Kconfig
+++ b/arch/arm/mach-kirkwood/Kconfig
@@ -45,18 +45,24 @@ config MACH_GURUPLUG
45 Marvell GuruPlug Reference Board. 45 Marvell GuruPlug Reference Board.
46 46
47config MACH_TS219 47config MACH_TS219
48 bool "QNAP TS-110, TS-119, TS-210, TS-219 and TS-219P Turbo NAS" 48 bool "QNAP TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and TS-219P+ Turbo NAS"
49 help 49 help
50 Say 'Y' here if you want your kernel to support the 50 Say 'Y' here if you want your kernel to support the
51 QNAP TS-110, TS-119, TS-210, TS-219 and TS-219P Turbo NAS 51 QNAP TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and
52 devices. 52 TS-219P+ Turbo NAS devices.
53 53
54config MACH_TS41X 54config MACH_TS41X
55 bool "QNAP TS-410, TS-410U, TS-419P and TS-419U Turbo NAS" 55 bool "QNAP TS-410, TS-410U, TS-419P, TS-419P+ and TS-419U Turbo NAS"
56 help 56 help
57 Say 'Y' here if you want your kernel to support the 57 Say 'Y' here if you want your kernel to support the
58 QNAP TS-410, TS-410U, TS-419P and TS-419U Turbo NAS 58 QNAP TS-410, TS-410U, TS-419P, TS-419P+ and TS-419U Turbo
59 devices. 59 NAS devices.
60
61config MACH_DOCKSTAR
62 bool "Seagate FreeAgent DockStar"
63 help
64 Say 'Y' here if you want your kernel to support the
65 Seagate FreeAgent DockStar.
60 66
61config MACH_OPENRD 67config MACH_OPENRD
62 bool 68 bool
@@ -100,6 +106,12 @@ config MACH_NETSPACE_MAX_V2
100 Say 'Y' here if you want your kernel to support the 106 Say 'Y' here if you want your kernel to support the
101 LaCie Network Space Max v2 NAS. 107 LaCie Network Space Max v2 NAS.
102 108
109config MACH_D2NET_V2
110 bool "LaCie d2 Network v2 NAS Board"
111 help
112 Say 'Y' here if you want your kernel to support the
113 LaCie d2 Network v2 NAS.
114
103config MACH_NET2BIG_V2 115config MACH_NET2BIG_V2
104 bool "LaCie 2Big Network v2 NAS Board" 116 bool "LaCie 2Big Network v2 NAS Board"
105 help 117 help
diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile
index 295d7baa6ae1..5dcaa81a2ec3 100644
--- a/arch/arm/mach-kirkwood/Makefile
+++ b/arch/arm/mach-kirkwood/Makefile
@@ -7,14 +7,16 @@ obj-$(CONFIG_MACH_MV88F6281GTW_GE) += mv88f6281gtw_ge-setup.o
7obj-$(CONFIG_MACH_SHEEVAPLUG) += sheevaplug-setup.o 7obj-$(CONFIG_MACH_SHEEVAPLUG) += sheevaplug-setup.o
8obj-$(CONFIG_MACH_ESATA_SHEEVAPLUG) += sheevaplug-setup.o 8obj-$(CONFIG_MACH_ESATA_SHEEVAPLUG) += sheevaplug-setup.o
9obj-$(CONFIG_MACH_GURUPLUG) += guruplug-setup.o 9obj-$(CONFIG_MACH_GURUPLUG) += guruplug-setup.o
10obj-$(CONFIG_MACH_DOCKSTAR) += dockstar-setup.o
10obj-$(CONFIG_MACH_TS219) += ts219-setup.o tsx1x-common.o 11obj-$(CONFIG_MACH_TS219) += ts219-setup.o tsx1x-common.o
11obj-$(CONFIG_MACH_TS41X) += ts41x-setup.o tsx1x-common.o 12obj-$(CONFIG_MACH_TS41X) += ts41x-setup.o tsx1x-common.o
12obj-$(CONFIG_MACH_OPENRD) += openrd-setup.o 13obj-$(CONFIG_MACH_OPENRD) += openrd-setup.o
13obj-$(CONFIG_MACH_NETSPACE_V2) += netspace_v2-setup.o 14obj-$(CONFIG_MACH_NETSPACE_V2) += netspace_v2-setup.o lacie_v2-common.o
14obj-$(CONFIG_MACH_INETSPACE_V2) += netspace_v2-setup.o 15obj-$(CONFIG_MACH_INETSPACE_V2) += netspace_v2-setup.o lacie_v2-common.o
15obj-$(CONFIG_MACH_NETSPACE_MAX_V2) += netspace_v2-setup.o 16obj-$(CONFIG_MACH_NETSPACE_MAX_V2) += netspace_v2-setup.o lacie_v2-common.o
16obj-$(CONFIG_MACH_NET2BIG_V2) += netxbig_v2-setup.o 17obj-$(CONFIG_MACH_D2NET_V2) += d2net_v2-setup.o lacie_v2-common.o
17obj-$(CONFIG_MACH_NET5BIG_V2) += netxbig_v2-setup.o 18obj-$(CONFIG_MACH_NET2BIG_V2) += netxbig_v2-setup.o lacie_v2-common.o
19obj-$(CONFIG_MACH_NET5BIG_V2) += netxbig_v2-setup.o lacie_v2-common.o
18obj-$(CONFIG_MACH_T5325) += t5325-setup.o 20obj-$(CONFIG_MACH_T5325) += t5325-setup.o
19 21
20obj-$(CONFIG_CPU_IDLE) += cpuidle.o 22obj-$(CONFIG_CPU_IDLE) += cpuidle.o
diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c
index 1c82d4290dad..f3248cfbe51d 100644
--- a/arch/arm/mach-kirkwood/common.c
+++ b/arch/arm/mach-kirkwood/common.c
@@ -13,25 +13,22 @@
13#include <linux/platform_device.h> 13#include <linux/platform_device.h>
14#include <linux/serial_8250.h> 14#include <linux/serial_8250.h>
15#include <linux/mbus.h> 15#include <linux/mbus.h>
16#include <linux/mv643xx_eth.h>
17#include <linux/mv643xx_i2c.h>
18#include <linux/ata_platform.h> 16#include <linux/ata_platform.h>
19#include <linux/mtd/nand.h> 17#include <linux/mtd/nand.h>
20#include <linux/spi/orion_spi.h> 18#include <linux/dma-mapping.h>
21#include <net/dsa.h> 19#include <net/dsa.h>
22#include <asm/page.h> 20#include <asm/page.h>
23#include <asm/timex.h> 21#include <asm/timex.h>
22#include <asm/kexec.h>
24#include <asm/mach/map.h> 23#include <asm/mach/map.h>
25#include <asm/mach/time.h> 24#include <asm/mach/time.h>
26#include <mach/kirkwood.h> 25#include <mach/kirkwood.h>
27#include <mach/bridge-regs.h> 26#include <mach/bridge-regs.h>
28#include <plat/audio.h> 27#include <plat/audio.h>
29#include <plat/cache-feroceon-l2.h> 28#include <plat/cache-feroceon-l2.h>
30#include <plat/ehci-orion.h>
31#include <plat/mvsdio.h> 29#include <plat/mvsdio.h>
32#include <plat/mv_xor.h>
33#include <plat/orion_nand.h> 30#include <plat/orion_nand.h>
34#include <plat/orion_wdt.h> 31#include <plat/common.h>
35#include <plat/time.h> 32#include <plat/time.h>
36#include "common.h" 33#include "common.h"
37 34
@@ -68,210 +65,52 @@ void __init kirkwood_map_io(void)
68 * registered. Some reserved bits must be set to 1. 65 * registered. Some reserved bits must be set to 1.
69 */ 66 */
70unsigned int kirkwood_clk_ctrl = CGC_DUNIT | CGC_RESERVED; 67unsigned int kirkwood_clk_ctrl = CGC_DUNIT | CGC_RESERVED;
71
72
73/*****************************************************************************
74 * EHCI
75 ****************************************************************************/
76static struct orion_ehci_data kirkwood_ehci_data = {
77 .dram = &kirkwood_mbus_dram_info,
78 .phy_version = EHCI_PHY_NA,
79};
80
81static u64 ehci_dmamask = 0xffffffffUL;
82 68
83 69
84/***************************************************************************** 70/*****************************************************************************
85 * EHCI0 71 * EHCI0
86 ****************************************************************************/ 72 ****************************************************************************/
87static struct resource kirkwood_ehci_resources[] = {
88 {
89 .start = USB_PHYS_BASE,
90 .end = USB_PHYS_BASE + 0x0fff,
91 .flags = IORESOURCE_MEM,
92 }, {
93 .start = IRQ_KIRKWOOD_USB,
94 .end = IRQ_KIRKWOOD_USB,
95 .flags = IORESOURCE_IRQ,
96 },
97};
98
99static struct platform_device kirkwood_ehci = {
100 .name = "orion-ehci",
101 .id = 0,
102 .dev = {
103 .dma_mask = &ehci_dmamask,
104 .coherent_dma_mask = 0xffffffff,
105 .platform_data = &kirkwood_ehci_data,
106 },
107 .resource = kirkwood_ehci_resources,
108 .num_resources = ARRAY_SIZE(kirkwood_ehci_resources),
109};
110
111void __init kirkwood_ehci_init(void) 73void __init kirkwood_ehci_init(void)
112{ 74{
113 kirkwood_clk_ctrl |= CGC_USB0; 75 kirkwood_clk_ctrl |= CGC_USB0;
114 platform_device_register(&kirkwood_ehci); 76 orion_ehci_init(&kirkwood_mbus_dram_info,
77 USB_PHYS_BASE, IRQ_KIRKWOOD_USB);
115} 78}
116 79
117 80
118/***************************************************************************** 81/*****************************************************************************
119 * GE00 82 * GE00
120 ****************************************************************************/ 83 ****************************************************************************/
121struct mv643xx_eth_shared_platform_data kirkwood_ge00_shared_data = {
122 .dram = &kirkwood_mbus_dram_info,
123};
124
125static struct resource kirkwood_ge00_shared_resources[] = {
126 {
127 .name = "ge00 base",
128 .start = GE00_PHYS_BASE + 0x2000,
129 .end = GE00_PHYS_BASE + 0x3fff,
130 .flags = IORESOURCE_MEM,
131 }, {
132 .name = "ge00 err irq",
133 .start = IRQ_KIRKWOOD_GE00_ERR,
134 .end = IRQ_KIRKWOOD_GE00_ERR,
135 .flags = IORESOURCE_IRQ,
136 },
137};
138
139static struct platform_device kirkwood_ge00_shared = {
140 .name = MV643XX_ETH_SHARED_NAME,
141 .id = 0,
142 .dev = {
143 .platform_data = &kirkwood_ge00_shared_data,
144 },
145 .num_resources = ARRAY_SIZE(kirkwood_ge00_shared_resources),
146 .resource = kirkwood_ge00_shared_resources,
147};
148
149static struct resource kirkwood_ge00_resources[] = {
150 {
151 .name = "ge00 irq",
152 .start = IRQ_KIRKWOOD_GE00_SUM,
153 .end = IRQ_KIRKWOOD_GE00_SUM,
154 .flags = IORESOURCE_IRQ,
155 },
156};
157
158static struct platform_device kirkwood_ge00 = {
159 .name = MV643XX_ETH_NAME,
160 .id = 0,
161 .num_resources = 1,
162 .resource = kirkwood_ge00_resources,
163 .dev = {
164 .coherent_dma_mask = 0xffffffff,
165 },
166};
167
168void __init kirkwood_ge00_init(struct mv643xx_eth_platform_data *eth_data) 84void __init kirkwood_ge00_init(struct mv643xx_eth_platform_data *eth_data)
169{ 85{
170 kirkwood_clk_ctrl |= CGC_GE0; 86 kirkwood_clk_ctrl |= CGC_GE0;
171 eth_data->shared = &kirkwood_ge00_shared;
172 kirkwood_ge00.dev.platform_data = eth_data;
173 87
174 platform_device_register(&kirkwood_ge00_shared); 88 orion_ge00_init(eth_data, &kirkwood_mbus_dram_info,
175 platform_device_register(&kirkwood_ge00); 89 GE00_PHYS_BASE, IRQ_KIRKWOOD_GE00_SUM,
90 IRQ_KIRKWOOD_GE00_ERR, kirkwood_tclk);
176} 91}
177 92
178 93
179/***************************************************************************** 94/*****************************************************************************
180 * GE01 95 * GE01
181 ****************************************************************************/ 96 ****************************************************************************/
182struct mv643xx_eth_shared_platform_data kirkwood_ge01_shared_data = {
183 .dram = &kirkwood_mbus_dram_info,
184 .shared_smi = &kirkwood_ge00_shared,
185};
186
187static struct resource kirkwood_ge01_shared_resources[] = {
188 {
189 .name = "ge01 base",
190 .start = GE01_PHYS_BASE + 0x2000,
191 .end = GE01_PHYS_BASE + 0x3fff,
192 .flags = IORESOURCE_MEM,
193 }, {
194 .name = "ge01 err irq",
195 .start = IRQ_KIRKWOOD_GE01_ERR,
196 .end = IRQ_KIRKWOOD_GE01_ERR,
197 .flags = IORESOURCE_IRQ,
198 },
199};
200
201static struct platform_device kirkwood_ge01_shared = {
202 .name = MV643XX_ETH_SHARED_NAME,
203 .id = 1,
204 .dev = {
205 .platform_data = &kirkwood_ge01_shared_data,
206 },
207 .num_resources = ARRAY_SIZE(kirkwood_ge01_shared_resources),
208 .resource = kirkwood_ge01_shared_resources,
209};
210
211static struct resource kirkwood_ge01_resources[] = {
212 {
213 .name = "ge01 irq",
214 .start = IRQ_KIRKWOOD_GE01_SUM,
215 .end = IRQ_KIRKWOOD_GE01_SUM,
216 .flags = IORESOURCE_IRQ,
217 },
218};
219
220static struct platform_device kirkwood_ge01 = {
221 .name = MV643XX_ETH_NAME,
222 .id = 1,
223 .num_resources = 1,
224 .resource = kirkwood_ge01_resources,
225 .dev = {
226 .coherent_dma_mask = 0xffffffff,
227 },
228};
229
230void __init kirkwood_ge01_init(struct mv643xx_eth_platform_data *eth_data) 97void __init kirkwood_ge01_init(struct mv643xx_eth_platform_data *eth_data)
231{ 98{
99
232 kirkwood_clk_ctrl |= CGC_GE1; 100 kirkwood_clk_ctrl |= CGC_GE1;
233 eth_data->shared = &kirkwood_ge01_shared;
234 kirkwood_ge01.dev.platform_data = eth_data;
235 101
236 platform_device_register(&kirkwood_ge01_shared); 102 orion_ge01_init(eth_data, &kirkwood_mbus_dram_info,
237 platform_device_register(&kirkwood_ge01); 103 GE01_PHYS_BASE, IRQ_KIRKWOOD_GE01_SUM,
104 IRQ_KIRKWOOD_GE01_ERR, kirkwood_tclk);
238} 105}
239 106
240 107
241/***************************************************************************** 108/*****************************************************************************
242 * Ethernet switch 109 * Ethernet switch
243 ****************************************************************************/ 110 ****************************************************************************/
244static struct resource kirkwood_switch_resources[] = {
245 {
246 .start = 0,
247 .end = 0,
248 .flags = IORESOURCE_IRQ,
249 },
250};
251
252static struct platform_device kirkwood_switch_device = {
253 .name = "dsa",
254 .id = 0,
255 .num_resources = 0,
256 .resource = kirkwood_switch_resources,
257};
258
259void __init kirkwood_ge00_switch_init(struct dsa_platform_data *d, int irq) 111void __init kirkwood_ge00_switch_init(struct dsa_platform_data *d, int irq)
260{ 112{
261 int i; 113 orion_ge00_switch_init(d, irq);
262
263 if (irq != NO_IRQ) {
264 kirkwood_switch_resources[0].start = irq;
265 kirkwood_switch_resources[0].end = irq;
266 kirkwood_switch_device.num_resources = 1;
267 }
268
269 d->netdev = &kirkwood_ge00.dev;
270 for (i = 0; i < d->nr_chips; i++)
271 d->chip[i].mii_bus = &kirkwood_ge00_shared.dev;
272 kirkwood_switch_device.dev.platform_data = d;
273
274 platform_device_register(&kirkwood_switch_device);
275} 114}
276 115
277 116
@@ -324,53 +163,23 @@ void __init kirkwood_nand_init_rnb(struct mtd_partition *parts, int nr_parts,
324/***************************************************************************** 163/*****************************************************************************
325 * SoC RTC 164 * SoC RTC
326 ****************************************************************************/ 165 ****************************************************************************/
327static struct resource kirkwood_rtc_resource = {
328 .start = RTC_PHYS_BASE,
329 .end = RTC_PHYS_BASE + SZ_16 - 1,
330 .flags = IORESOURCE_MEM,
331};
332
333static void __init kirkwood_rtc_init(void) 166static void __init kirkwood_rtc_init(void)
334{ 167{
335 platform_device_register_simple("rtc-mv", -1, &kirkwood_rtc_resource, 1); 168 orion_rtc_init(RTC_PHYS_BASE, IRQ_KIRKWOOD_RTC);
336} 169}
337 170
338 171
339/***************************************************************************** 172/*****************************************************************************
340 * SATA 173 * SATA
341 ****************************************************************************/ 174 ****************************************************************************/
342static struct resource kirkwood_sata_resources[] = {
343 {
344 .name = "sata base",
345 .start = SATA_PHYS_BASE,
346 .end = SATA_PHYS_BASE + 0x5000 - 1,
347 .flags = IORESOURCE_MEM,
348 }, {
349 .name = "sata irq",
350 .start = IRQ_KIRKWOOD_SATA,
351 .end = IRQ_KIRKWOOD_SATA,
352 .flags = IORESOURCE_IRQ,
353 },
354};
355
356static struct platform_device kirkwood_sata = {
357 .name = "sata_mv",
358 .id = 0,
359 .dev = {
360 .coherent_dma_mask = 0xffffffff,
361 },
362 .num_resources = ARRAY_SIZE(kirkwood_sata_resources),
363 .resource = kirkwood_sata_resources,
364};
365
366void __init kirkwood_sata_init(struct mv_sata_platform_data *sata_data) 175void __init kirkwood_sata_init(struct mv_sata_platform_data *sata_data)
367{ 176{
368 kirkwood_clk_ctrl |= CGC_SATA0; 177 kirkwood_clk_ctrl |= CGC_SATA0;
369 if (sata_data->n_ports > 1) 178 if (sata_data->n_ports > 1)
370 kirkwood_clk_ctrl |= CGC_SATA1; 179 kirkwood_clk_ctrl |= CGC_SATA1;
371 sata_data->dram = &kirkwood_mbus_dram_info; 180
372 kirkwood_sata.dev.platform_data = sata_data; 181 orion_sata_init(sata_data, &kirkwood_mbus_dram_info,
373 platform_device_register(&kirkwood_sata); 182 SATA_PHYS_BASE, IRQ_KIRKWOOD_SATA);
374} 183}
375 184
376 185
@@ -390,14 +199,14 @@ static struct resource mvsdio_resources[] = {
390 }, 199 },
391}; 200};
392 201
393static u64 mvsdio_dmamask = 0xffffffffUL; 202static u64 mvsdio_dmamask = DMA_BIT_MASK(32);
394 203
395static struct platform_device kirkwood_sdio = { 204static struct platform_device kirkwood_sdio = {
396 .name = "mvsdio", 205 .name = "mvsdio",
397 .id = -1, 206 .id = -1,
398 .dev = { 207 .dev = {
399 .dma_mask = &mvsdio_dmamask, 208 .dma_mask = &mvsdio_dmamask,
400 .coherent_dma_mask = 0xffffffff, 209 .coherent_dma_mask = DMA_BIT_MASK(32),
401 }, 210 },
402 .num_resources = ARRAY_SIZE(mvsdio_resources), 211 .num_resources = ARRAY_SIZE(mvsdio_resources),
403 .resource = mvsdio_resources, 212 .resource = mvsdio_resources,
@@ -422,442 +231,106 @@ void __init kirkwood_sdio_init(struct mvsdio_platform_data *mvsdio_data)
422/***************************************************************************** 231/*****************************************************************************
423 * SPI 232 * SPI
424 ****************************************************************************/ 233 ****************************************************************************/
425static struct orion_spi_info kirkwood_spi_plat_data = {
426};
427
428static struct resource kirkwood_spi_resources[] = {
429 {
430 .start = SPI_PHYS_BASE,
431 .end = SPI_PHYS_BASE + SZ_512 - 1,
432 .flags = IORESOURCE_MEM,
433 },
434};
435
436static struct platform_device kirkwood_spi = {
437 .name = "orion_spi",
438 .id = 0,
439 .resource = kirkwood_spi_resources,
440 .dev = {
441 .platform_data = &kirkwood_spi_plat_data,
442 },
443 .num_resources = ARRAY_SIZE(kirkwood_spi_resources),
444};
445
446void __init kirkwood_spi_init() 234void __init kirkwood_spi_init()
447{ 235{
448 kirkwood_clk_ctrl |= CGC_RUNIT; 236 kirkwood_clk_ctrl |= CGC_RUNIT;
449 platform_device_register(&kirkwood_spi); 237 orion_spi_init(SPI_PHYS_BASE, kirkwood_tclk);
450} 238}
451 239
452 240
453/***************************************************************************** 241/*****************************************************************************
454 * I2C 242 * I2C
455 ****************************************************************************/ 243 ****************************************************************************/
456static struct mv64xxx_i2c_pdata kirkwood_i2c_pdata = {
457 .freq_m = 8, /* assumes 166 MHz TCLK */
458 .freq_n = 3,
459 .timeout = 1000, /* Default timeout of 1 second */
460};
461
462static struct resource kirkwood_i2c_resources[] = {
463 {
464 .start = I2C_PHYS_BASE,
465 .end = I2C_PHYS_BASE + 0x1f,
466 .flags = IORESOURCE_MEM,
467 }, {
468 .start = IRQ_KIRKWOOD_TWSI,
469 .end = IRQ_KIRKWOOD_TWSI,
470 .flags = IORESOURCE_IRQ,
471 },
472};
473
474static struct platform_device kirkwood_i2c = {
475 .name = MV64XXX_I2C_CTLR_NAME,
476 .id = 0,
477 .num_resources = ARRAY_SIZE(kirkwood_i2c_resources),
478 .resource = kirkwood_i2c_resources,
479 .dev = {
480 .platform_data = &kirkwood_i2c_pdata,
481 },
482};
483
484void __init kirkwood_i2c_init(void) 244void __init kirkwood_i2c_init(void)
485{ 245{
486 platform_device_register(&kirkwood_i2c); 246 orion_i2c_init(I2C_PHYS_BASE, IRQ_KIRKWOOD_TWSI, 8);
487} 247}
488 248
489 249
490/***************************************************************************** 250/*****************************************************************************
491 * UART0 251 * UART0
492 ****************************************************************************/ 252 ****************************************************************************/
493static struct plat_serial8250_port kirkwood_uart0_data[] = {
494 {
495 .mapbase = UART0_PHYS_BASE,
496 .membase = (char *)UART0_VIRT_BASE,
497 .irq = IRQ_KIRKWOOD_UART_0,
498 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
499 .iotype = UPIO_MEM,
500 .regshift = 2,
501 .uartclk = 0,
502 }, {
503 },
504};
505
506static struct resource kirkwood_uart0_resources[] = {
507 {
508 .start = UART0_PHYS_BASE,
509 .end = UART0_PHYS_BASE + 0xff,
510 .flags = IORESOURCE_MEM,
511 }, {
512 .start = IRQ_KIRKWOOD_UART_0,
513 .end = IRQ_KIRKWOOD_UART_0,
514 .flags = IORESOURCE_IRQ,
515 },
516};
517
518static struct platform_device kirkwood_uart0 = {
519 .name = "serial8250",
520 .id = 0,
521 .dev = {
522 .platform_data = kirkwood_uart0_data,
523 },
524 .resource = kirkwood_uart0_resources,
525 .num_resources = ARRAY_SIZE(kirkwood_uart0_resources),
526};
527 253
528void __init kirkwood_uart0_init(void) 254void __init kirkwood_uart0_init(void)
529{ 255{
530 platform_device_register(&kirkwood_uart0); 256 orion_uart0_init(UART0_VIRT_BASE, UART0_PHYS_BASE,
257 IRQ_KIRKWOOD_UART_0, kirkwood_tclk);
531} 258}
532 259
533 260
534/***************************************************************************** 261/*****************************************************************************
535 * UART1 262 * UART1
536 ****************************************************************************/ 263 ****************************************************************************/
537static struct plat_serial8250_port kirkwood_uart1_data[] = {
538 {
539 .mapbase = UART1_PHYS_BASE,
540 .membase = (char *)UART1_VIRT_BASE,
541 .irq = IRQ_KIRKWOOD_UART_1,
542 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
543 .iotype = UPIO_MEM,
544 .regshift = 2,
545 .uartclk = 0,
546 }, {
547 },
548};
549
550static struct resource kirkwood_uart1_resources[] = {
551 {
552 .start = UART1_PHYS_BASE,
553 .end = UART1_PHYS_BASE + 0xff,
554 .flags = IORESOURCE_MEM,
555 }, {
556 .start = IRQ_KIRKWOOD_UART_1,
557 .end = IRQ_KIRKWOOD_UART_1,
558 .flags = IORESOURCE_IRQ,
559 },
560};
561
562static struct platform_device kirkwood_uart1 = {
563 .name = "serial8250",
564 .id = 1,
565 .dev = {
566 .platform_data = kirkwood_uart1_data,
567 },
568 .resource = kirkwood_uart1_resources,
569 .num_resources = ARRAY_SIZE(kirkwood_uart1_resources),
570};
571
572void __init kirkwood_uart1_init(void) 264void __init kirkwood_uart1_init(void)
573{ 265{
574 platform_device_register(&kirkwood_uart1); 266 orion_uart1_init(UART1_VIRT_BASE, UART1_PHYS_BASE,
267 IRQ_KIRKWOOD_UART_1, kirkwood_tclk);
575} 268}
576 269
577
578/***************************************************************************** 270/*****************************************************************************
579 * Cryptographic Engines and Security Accelerator (CESA) 271 * Cryptographic Engines and Security Accelerator (CESA)
580 ****************************************************************************/ 272 ****************************************************************************/
581
582static struct resource kirkwood_crypto_res[] = {
583 {
584 .name = "regs",
585 .start = CRYPTO_PHYS_BASE,
586 .end = CRYPTO_PHYS_BASE + 0xffff,
587 .flags = IORESOURCE_MEM,
588 }, {
589 .name = "sram",
590 .start = KIRKWOOD_SRAM_PHYS_BASE,
591 .end = KIRKWOOD_SRAM_PHYS_BASE + KIRKWOOD_SRAM_SIZE - 1,
592 .flags = IORESOURCE_MEM,
593 }, {
594 .name = "crypto interrupt",
595 .start = IRQ_KIRKWOOD_CRYPTO,
596 .end = IRQ_KIRKWOOD_CRYPTO,
597 .flags = IORESOURCE_IRQ,
598 },
599};
600
601static struct platform_device kirkwood_crypto_device = {
602 .name = "mv_crypto",
603 .id = -1,
604 .num_resources = ARRAY_SIZE(kirkwood_crypto_res),
605 .resource = kirkwood_crypto_res,
606};
607
608void __init kirkwood_crypto_init(void) 273void __init kirkwood_crypto_init(void)
609{ 274{
610 kirkwood_clk_ctrl |= CGC_CRYPTO; 275 kirkwood_clk_ctrl |= CGC_CRYPTO;
611 platform_device_register(&kirkwood_crypto_device); 276 orion_crypto_init(CRYPTO_PHYS_BASE, KIRKWOOD_SRAM_PHYS_BASE,
277 KIRKWOOD_SRAM_SIZE, IRQ_KIRKWOOD_CRYPTO);
612} 278}
613 279
614 280
615/***************************************************************************** 281/*****************************************************************************
616 * XOR
617 ****************************************************************************/
618static struct mv_xor_platform_shared_data kirkwood_xor_shared_data = {
619 .dram = &kirkwood_mbus_dram_info,
620};
621
622static u64 kirkwood_xor_dmamask = DMA_BIT_MASK(32);
623
624
625/*****************************************************************************
626 * XOR0 282 * XOR0
627 ****************************************************************************/ 283 ****************************************************************************/
628static struct resource kirkwood_xor0_shared_resources[] = {
629 {
630 .name = "xor 0 low",
631 .start = XOR0_PHYS_BASE,
632 .end = XOR0_PHYS_BASE + 0xff,
633 .flags = IORESOURCE_MEM,
634 }, {
635 .name = "xor 0 high",
636 .start = XOR0_HIGH_PHYS_BASE,
637 .end = XOR0_HIGH_PHYS_BASE + 0xff,
638 .flags = IORESOURCE_MEM,
639 },
640};
641
642static struct platform_device kirkwood_xor0_shared = {
643 .name = MV_XOR_SHARED_NAME,
644 .id = 0,
645 .dev = {
646 .platform_data = &kirkwood_xor_shared_data,
647 },
648 .num_resources = ARRAY_SIZE(kirkwood_xor0_shared_resources),
649 .resource = kirkwood_xor0_shared_resources,
650};
651
652static struct resource kirkwood_xor00_resources[] = {
653 [0] = {
654 .start = IRQ_KIRKWOOD_XOR_00,
655 .end = IRQ_KIRKWOOD_XOR_00,
656 .flags = IORESOURCE_IRQ,
657 },
658};
659
660static struct mv_xor_platform_data kirkwood_xor00_data = {
661 .shared = &kirkwood_xor0_shared,
662 .hw_id = 0,
663 .pool_size = PAGE_SIZE,
664};
665
666static struct platform_device kirkwood_xor00_channel = {
667 .name = MV_XOR_NAME,
668 .id = 0,
669 .num_resources = ARRAY_SIZE(kirkwood_xor00_resources),
670 .resource = kirkwood_xor00_resources,
671 .dev = {
672 .dma_mask = &kirkwood_xor_dmamask,
673 .coherent_dma_mask = DMA_BIT_MASK(64),
674 .platform_data = &kirkwood_xor00_data,
675 },
676};
677
678static struct resource kirkwood_xor01_resources[] = {
679 [0] = {
680 .start = IRQ_KIRKWOOD_XOR_01,
681 .end = IRQ_KIRKWOOD_XOR_01,
682 .flags = IORESOURCE_IRQ,
683 },
684};
685
686static struct mv_xor_platform_data kirkwood_xor01_data = {
687 .shared = &kirkwood_xor0_shared,
688 .hw_id = 1,
689 .pool_size = PAGE_SIZE,
690};
691
692static struct platform_device kirkwood_xor01_channel = {
693 .name = MV_XOR_NAME,
694 .id = 1,
695 .num_resources = ARRAY_SIZE(kirkwood_xor01_resources),
696 .resource = kirkwood_xor01_resources,
697 .dev = {
698 .dma_mask = &kirkwood_xor_dmamask,
699 .coherent_dma_mask = DMA_BIT_MASK(64),
700 .platform_data = &kirkwood_xor01_data,
701 },
702};
703
704static void __init kirkwood_xor0_init(void) 284static void __init kirkwood_xor0_init(void)
705{ 285{
706 kirkwood_clk_ctrl |= CGC_XOR0; 286 kirkwood_clk_ctrl |= CGC_XOR0;
707 platform_device_register(&kirkwood_xor0_shared);
708 287
709 /* 288 orion_xor0_init(&kirkwood_mbus_dram_info,
710 * two engines can't do memset simultaneously, this limitation 289 XOR0_PHYS_BASE, XOR0_HIGH_PHYS_BASE,
711 * satisfied by removing memset support from one of the engines. 290 IRQ_KIRKWOOD_XOR_00, IRQ_KIRKWOOD_XOR_01);
712 */
713 dma_cap_set(DMA_MEMCPY, kirkwood_xor00_data.cap_mask);
714 dma_cap_set(DMA_XOR, kirkwood_xor00_data.cap_mask);
715 platform_device_register(&kirkwood_xor00_channel);
716
717 dma_cap_set(DMA_MEMCPY, kirkwood_xor01_data.cap_mask);
718 dma_cap_set(DMA_MEMSET, kirkwood_xor01_data.cap_mask);
719 dma_cap_set(DMA_XOR, kirkwood_xor01_data.cap_mask);
720 platform_device_register(&kirkwood_xor01_channel);
721} 291}
722 292
723 293
724/***************************************************************************** 294/*****************************************************************************
725 * XOR1 295 * XOR1
726 ****************************************************************************/ 296 ****************************************************************************/
727static struct resource kirkwood_xor1_shared_resources[] = {
728 {
729 .name = "xor 1 low",
730 .start = XOR1_PHYS_BASE,
731 .end = XOR1_PHYS_BASE + 0xff,
732 .flags = IORESOURCE_MEM,
733 }, {
734 .name = "xor 1 high",
735 .start = XOR1_HIGH_PHYS_BASE,
736 .end = XOR1_HIGH_PHYS_BASE + 0xff,
737 .flags = IORESOURCE_MEM,
738 },
739};
740
741static struct platform_device kirkwood_xor1_shared = {
742 .name = MV_XOR_SHARED_NAME,
743 .id = 1,
744 .dev = {
745 .platform_data = &kirkwood_xor_shared_data,
746 },
747 .num_resources = ARRAY_SIZE(kirkwood_xor1_shared_resources),
748 .resource = kirkwood_xor1_shared_resources,
749};
750
751static struct resource kirkwood_xor10_resources[] = {
752 [0] = {
753 .start = IRQ_KIRKWOOD_XOR_10,
754 .end = IRQ_KIRKWOOD_XOR_10,
755 .flags = IORESOURCE_IRQ,
756 },
757};
758
759static struct mv_xor_platform_data kirkwood_xor10_data = {
760 .shared = &kirkwood_xor1_shared,
761 .hw_id = 0,
762 .pool_size = PAGE_SIZE,
763};
764
765static struct platform_device kirkwood_xor10_channel = {
766 .name = MV_XOR_NAME,
767 .id = 2,
768 .num_resources = ARRAY_SIZE(kirkwood_xor10_resources),
769 .resource = kirkwood_xor10_resources,
770 .dev = {
771 .dma_mask = &kirkwood_xor_dmamask,
772 .coherent_dma_mask = DMA_BIT_MASK(64),
773 .platform_data = &kirkwood_xor10_data,
774 },
775};
776
777static struct resource kirkwood_xor11_resources[] = {
778 [0] = {
779 .start = IRQ_KIRKWOOD_XOR_11,
780 .end = IRQ_KIRKWOOD_XOR_11,
781 .flags = IORESOURCE_IRQ,
782 },
783};
784
785static struct mv_xor_platform_data kirkwood_xor11_data = {
786 .shared = &kirkwood_xor1_shared,
787 .hw_id = 1,
788 .pool_size = PAGE_SIZE,
789};
790
791static struct platform_device kirkwood_xor11_channel = {
792 .name = MV_XOR_NAME,
793 .id = 3,
794 .num_resources = ARRAY_SIZE(kirkwood_xor11_resources),
795 .resource = kirkwood_xor11_resources,
796 .dev = {
797 .dma_mask = &kirkwood_xor_dmamask,
798 .coherent_dma_mask = DMA_BIT_MASK(64),
799 .platform_data = &kirkwood_xor11_data,
800 },
801};
802
803static void __init kirkwood_xor1_init(void) 297static void __init kirkwood_xor1_init(void)
804{ 298{
805 kirkwood_clk_ctrl |= CGC_XOR1; 299 kirkwood_clk_ctrl |= CGC_XOR1;
806 platform_device_register(&kirkwood_xor1_shared);
807 300
808 /* 301 orion_xor1_init(XOR1_PHYS_BASE, XOR1_HIGH_PHYS_BASE,
809 * two engines can't do memset simultaneously, this limitation 302 IRQ_KIRKWOOD_XOR_10, IRQ_KIRKWOOD_XOR_11);
810 * satisfied by removing memset support from one of the engines.
811 */
812 dma_cap_set(DMA_MEMCPY, kirkwood_xor10_data.cap_mask);
813 dma_cap_set(DMA_XOR, kirkwood_xor10_data.cap_mask);
814 platform_device_register(&kirkwood_xor10_channel);
815
816 dma_cap_set(DMA_MEMCPY, kirkwood_xor11_data.cap_mask);
817 dma_cap_set(DMA_MEMSET, kirkwood_xor11_data.cap_mask);
818 dma_cap_set(DMA_XOR, kirkwood_xor11_data.cap_mask);
819 platform_device_register(&kirkwood_xor11_channel);
820} 303}
821 304
822 305
823/***************************************************************************** 306/*****************************************************************************
824 * Watchdog 307 * Watchdog
825 ****************************************************************************/ 308 ****************************************************************************/
826static struct orion_wdt_platform_data kirkwood_wdt_data = {
827 .tclk = 0,
828};
829
830static struct platform_device kirkwood_wdt_device = {
831 .name = "orion_wdt",
832 .id = -1,
833 .dev = {
834 .platform_data = &kirkwood_wdt_data,
835 },
836 .num_resources = 0,
837};
838
839static void __init kirkwood_wdt_init(void) 309static void __init kirkwood_wdt_init(void)
840{ 310{
841 kirkwood_wdt_data.tclk = kirkwood_tclk; 311 orion_wdt_init(kirkwood_tclk);
842 platform_device_register(&kirkwood_wdt_device);
843} 312}
844 313
845 314
846/***************************************************************************** 315/*****************************************************************************
847 * Time handling 316 * Time handling
848 ****************************************************************************/ 317 ****************************************************************************/
318void __init kirkwood_init_early(void)
319{
320 orion_time_set_base(TIMER_VIRT_BASE);
321}
322
849int kirkwood_tclk; 323int kirkwood_tclk;
850 324
851int __init kirkwood_find_tclk(void) 325static int __init kirkwood_find_tclk(void)
852{ 326{
853 u32 dev, rev; 327 u32 dev, rev;
854 328
855 kirkwood_pcie_id(&dev, &rev); 329 kirkwood_pcie_id(&dev, &rev);
856 330
857 if ((dev == MV88F6281_DEV_ID && (rev == MV88F6281_REV_A0 || 331 if (dev == MV88F6281_DEV_ID || dev == MV88F6282_DEV_ID)
858 rev == MV88F6281_REV_A1)) || 332 if (((readl(SAMPLE_AT_RESET) >> 21) & 1) == 0)
859 (dev == MV88F6282_DEV_ID)) 333 return 200000000;
860 return 200000000;
861 334
862 return 166666667; 335 return 166666667;
863} 336}
@@ -865,7 +338,9 @@ int __init kirkwood_find_tclk(void)
865static void __init kirkwood_timer_init(void) 338static void __init kirkwood_timer_init(void)
866{ 339{
867 kirkwood_tclk = kirkwood_find_tclk(); 340 kirkwood_tclk = kirkwood_find_tclk();
868 orion_time_init(IRQ_KIRKWOOD_BRIDGE, kirkwood_tclk); 341
342 orion_time_init(BRIDGE_VIRT_BASE, BRIDGE_INT_TIMER1_CLR,
343 IRQ_KIRKWOOD_BRIDGE, kirkwood_tclk);
869} 344}
870 345
871struct sys_timer kirkwood_timer = { 346struct sys_timer kirkwood_timer = {
@@ -903,10 +378,16 @@ static struct platform_device kirkwood_i2s_device = {
903 }, 378 },
904}; 379};
905 380
381static struct platform_device kirkwood_pcm_device = {
382 .name = "kirkwood-pcm-audio",
383 .id = -1,
384};
385
906void __init kirkwood_audio_init(void) 386void __init kirkwood_audio_init(void)
907{ 387{
908 kirkwood_clk_ctrl |= CGC_AUDIO; 388 kirkwood_clk_ctrl |= CGC_AUDIO;
909 platform_device_register(&kirkwood_i2s_device); 389 platform_device_register(&kirkwood_i2s_device);
390 platform_device_register(&kirkwood_pcm_device);
910} 391}
911 392
912/***************************************************************************** 393/*****************************************************************************
@@ -971,11 +452,6 @@ void __init kirkwood_init(void)
971{ 452{
972 printk(KERN_INFO "Kirkwood: %s, TCLK=%d.\n", 453 printk(KERN_INFO "Kirkwood: %s, TCLK=%d.\n",
973 kirkwood_id(), kirkwood_tclk); 454 kirkwood_id(), kirkwood_tclk);
974 kirkwood_ge00_shared_data.t_clk = kirkwood_tclk;
975 kirkwood_ge01_shared_data.t_clk = kirkwood_tclk;
976 kirkwood_spi_plat_data.tclk = kirkwood_tclk;
977 kirkwood_uart0_data[0].uartclk = kirkwood_tclk;
978 kirkwood_uart1_data[0].uartclk = kirkwood_tclk;
979 kirkwood_i2s_data.tclk = kirkwood_tclk; 455 kirkwood_i2s_data.tclk = kirkwood_tclk;
980 456
981 /* 457 /*
@@ -998,6 +474,10 @@ void __init kirkwood_init(void)
998 kirkwood_xor0_init(); 474 kirkwood_xor0_init();
999 kirkwood_xor1_init(); 475 kirkwood_xor1_init();
1000 kirkwood_crypto_init(); 476 kirkwood_crypto_init();
477
478#ifdef CONFIG_KEXEC
479 kexec_reinit = kirkwood_enable_pcie;
480#endif
1001} 481}
1002 482
1003static int __init kirkwood_clock_gate(void) 483static int __init kirkwood_clock_gate(void)
diff --git a/arch/arm/mach-kirkwood/common.h b/arch/arm/mach-kirkwood/common.h
index 95bb0a73adfb..b9b0f0968a36 100644
--- a/arch/arm/mach-kirkwood/common.h
+++ b/arch/arm/mach-kirkwood/common.h
@@ -27,11 +27,13 @@ struct kirkwood_asoc_platform_data;
27 */ 27 */
28void kirkwood_map_io(void); 28void kirkwood_map_io(void);
29void kirkwood_init(void); 29void kirkwood_init(void);
30void kirkwood_init_early(void);
30void kirkwood_init_irq(void); 31void kirkwood_init_irq(void);
31 32
32extern struct mbus_dram_target_info kirkwood_mbus_dram_info; 33extern struct mbus_dram_target_info kirkwood_mbus_dram_info;
33void kirkwood_setup_cpu_mbus(void); 34void kirkwood_setup_cpu_mbus(void);
34 35
36void kirkwood_enable_pcie(void);
35void kirkwood_pcie_id(u32 *dev, u32 *rev); 37void kirkwood_pcie_id(u32 *dev, u32 *rev);
36 38
37void kirkwood_ehci_init(void); 39void kirkwood_ehci_init(void);
diff --git a/arch/arm/mach-kirkwood/d2net_v2-setup.c b/arch/arm/mach-kirkwood/d2net_v2-setup.c
new file mode 100644
index 000000000000..043cfd5e140b
--- /dev/null
+++ b/arch/arm/mach-kirkwood/d2net_v2-setup.c
@@ -0,0 +1,230 @@
1/*
2 * arch/arm/mach-kirkwood/d2net_v2-setup.c
3 *
4 * LaCie d2 Network Space v2 Board Setup
5 *
6 * Copyright (C) 2010 Simon Guinot <sguinot@lacie.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23#include <linux/kernel.h>
24#include <linux/init.h>
25#include <linux/platform_device.h>
26#include <linux/ata_platform.h>
27#include <linux/mv643xx_eth.h>
28#include <linux/input.h>
29#include <linux/gpio.h>
30#include <linux/gpio_keys.h>
31#include <linux/leds.h>
32#include <asm/mach-types.h>
33#include <asm/mach/arch.h>
34#include <mach/kirkwood.h>
35#include <mach/leds-ns2.h>
36#include "common.h"
37#include "mpp.h"
38#include "lacie_v2-common.h"
39
40/*****************************************************************************
41 * Ethernet
42 ****************************************************************************/
43
44static struct mv643xx_eth_platform_data d2net_v2_ge00_data = {
45 .phy_addr = MV643XX_ETH_PHY_ADDR(8),
46};
47
48/*****************************************************************************
49 * SATA
50 ****************************************************************************/
51
52static struct mv_sata_platform_data d2net_v2_sata_data = {
53 .n_ports = 2,
54};
55
56/*****************************************************************************
57 * GPIO keys
58 ****************************************************************************/
59
60#define D2NET_V2_GPIO_PUSH_BUTTON 34
61#define D2NET_V2_GPIO_POWER_SWITCH_ON 13
62#define D2NET_V2_GPIO_POWER_SWITCH_OFF 15
63
64#define D2NET_V2_SWITCH_POWER_ON 0x1
65#define D2NET_V2_SWITCH_POWER_OFF 0x2
66
67static struct gpio_keys_button d2net_v2_buttons[] = {
68 [0] = {
69 .type = EV_SW,
70 .code = D2NET_V2_SWITCH_POWER_ON,
71 .gpio = D2NET_V2_GPIO_POWER_SWITCH_ON,
72 .desc = "Back power switch (on|auto)",
73 .active_low = 0,
74 },
75 [1] = {
76 .type = EV_SW,
77 .code = D2NET_V2_SWITCH_POWER_OFF,
78 .gpio = D2NET_V2_GPIO_POWER_SWITCH_OFF,
79 .desc = "Back power switch (auto|off)",
80 .active_low = 0,
81 },
82 [2] = {
83 .code = KEY_POWER,
84 .gpio = D2NET_V2_GPIO_PUSH_BUTTON,
85 .desc = "Front Push Button",
86 .active_low = 1,
87 },
88};
89
90static struct gpio_keys_platform_data d2net_v2_button_data = {
91 .buttons = d2net_v2_buttons,
92 .nbuttons = ARRAY_SIZE(d2net_v2_buttons),
93};
94
95static struct platform_device d2net_v2_gpio_buttons = {
96 .name = "gpio-keys",
97 .id = -1,
98 .dev = {
99 .platform_data = &d2net_v2_button_data,
100 },
101};
102
103/*****************************************************************************
104 * GPIO LEDs
105 ****************************************************************************/
106
107#define D2NET_V2_GPIO_RED_LED 12
108
109static struct gpio_led d2net_v2_gpio_led_pins[] = {
110 {
111 .name = "d2net_v2:red:fail",
112 .gpio = D2NET_V2_GPIO_RED_LED,
113 },
114};
115
116static struct gpio_led_platform_data d2net_v2_gpio_leds_data = {
117 .num_leds = ARRAY_SIZE(d2net_v2_gpio_led_pins),
118 .leds = d2net_v2_gpio_led_pins,
119};
120
121static struct platform_device d2net_v2_gpio_leds = {
122 .name = "leds-gpio",
123 .id = -1,
124 .dev = {
125 .platform_data = &d2net_v2_gpio_leds_data,
126 },
127};
128
129/*****************************************************************************
130 * Dual-GPIO CPLD LEDs
131 ****************************************************************************/
132
133#define D2NET_V2_GPIO_BLUE_LED_SLOW 29
134#define D2NET_V2_GPIO_BLUE_LED_CMD 30
135
136static struct ns2_led d2net_v2_led_pins[] = {
137 {
138 .name = "d2net_v2:blue:sata",
139 .cmd = D2NET_V2_GPIO_BLUE_LED_CMD,
140 .slow = D2NET_V2_GPIO_BLUE_LED_SLOW,
141 },
142};
143
144static struct ns2_led_platform_data d2net_v2_leds_data = {
145 .num_leds = ARRAY_SIZE(d2net_v2_led_pins),
146 .leds = d2net_v2_led_pins,
147};
148
149static struct platform_device d2net_v2_leds = {
150 .name = "leds-ns2",
151 .id = -1,
152 .dev = {
153 .platform_data = &d2net_v2_leds_data,
154 },
155};
156
157/*****************************************************************************
158 * General Setup
159 ****************************************************************************/
160
161static unsigned int d2net_v2_mpp_config[] __initdata = {
162 MPP0_SPI_SCn,
163 MPP1_SPI_MOSI,
164 MPP2_SPI_SCK,
165 MPP3_SPI_MISO,
166 MPP6_SYSRST_OUTn,
167 MPP7_GPO, /* Request power-off */
168 MPP8_TW0_SDA,
169 MPP9_TW0_SCK,
170 MPP10_UART0_TXD,
171 MPP11_UART0_RXD,
172 MPP12_GPO, /* Red led */
173 MPP13_GPIO, /* Rear power switch (on|auto) */
174 MPP14_GPIO, /* USB fuse */
175 MPP15_GPIO, /* Rear power switch (auto|off) */
176 MPP16_GPIO, /* SATA 0 power */
177 MPP21_SATA0_ACTn,
178 MPP24_GPIO, /* USB mode select */
179 MPP26_GPIO, /* USB device vbus */
180 MPP28_GPIO, /* USB enable host vbus */
181 MPP29_GPIO, /* Blue led (slow register) */
182 MPP30_GPIO, /* Blue led (command register) */
183 MPP34_GPIO, /* Power button (1 = Released, 0 = Pushed) */
184 MPP35_GPIO, /* Inhibit power-off */
185 0
186};
187
188#define D2NET_V2_GPIO_POWER_OFF 7
189
190static void d2net_v2_power_off(void)
191{
192 gpio_set_value(D2NET_V2_GPIO_POWER_OFF, 1);
193}
194
195static void __init d2net_v2_init(void)
196{
197 /*
198 * Basic setup. Needs to be called early.
199 */
200 kirkwood_init();
201 kirkwood_mpp_conf(d2net_v2_mpp_config);
202
203 lacie_v2_hdd_power_init(1);
204
205 kirkwood_ehci_init();
206 kirkwood_ge00_init(&d2net_v2_ge00_data);
207 kirkwood_sata_init(&d2net_v2_sata_data);
208 kirkwood_uart0_init();
209 lacie_v2_register_flash();
210 lacie_v2_register_i2c_devices();
211
212 platform_device_register(&d2net_v2_leds);
213 platform_device_register(&d2net_v2_gpio_leds);
214 platform_device_register(&d2net_v2_gpio_buttons);
215
216 if (gpio_request(D2NET_V2_GPIO_POWER_OFF, "power-off") == 0 &&
217 gpio_direction_output(D2NET_V2_GPIO_POWER_OFF, 0) == 0)
218 pm_power_off = d2net_v2_power_off;
219 else
220 pr_err("d2net_v2: failed to configure power-off GPIO\n");
221}
222
223MACHINE_START(D2NET_V2, "LaCie d2 Network v2")
224 .boot_params = 0x00000100,
225 .init_machine = d2net_v2_init,
226 .map_io = kirkwood_map_io,
227 .init_early = kirkwood_init_early,
228 .init_irq = kirkwood_init_irq,
229 .timer = &kirkwood_timer,
230MACHINE_END
diff --git a/arch/arm/mach-kirkwood/db88f6281-bp-setup.c b/arch/arm/mach-kirkwood/db88f6281-bp-setup.c
index 16f6691e7c68..bff04e04d679 100644
--- a/arch/arm/mach-kirkwood/db88f6281-bp-setup.c
+++ b/arch/arm/mach-kirkwood/db88f6281-bp-setup.c
@@ -97,11 +97,10 @@ subsys_initcall(db88f6281_pci_init);
97 97
98MACHINE_START(DB88F6281_BP, "Marvell DB-88F6281-BP Development Board") 98MACHINE_START(DB88F6281_BP, "Marvell DB-88F6281-BP Development Board")
99 /* Maintainer: Saeed Bishara <saeed@marvell.com> */ 99 /* Maintainer: Saeed Bishara <saeed@marvell.com> */
100 .phys_io = KIRKWOOD_REGS_PHYS_BASE,
101 .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc,
102 .boot_params = 0x00000100, 100 .boot_params = 0x00000100,
103 .init_machine = db88f6281_init, 101 .init_machine = db88f6281_init,
104 .map_io = kirkwood_map_io, 102 .map_io = kirkwood_map_io,
103 .init_early = kirkwood_init_early,
105 .init_irq = kirkwood_init_irq, 104 .init_irq = kirkwood_init_irq,
106 .timer = &kirkwood_timer, 105 .timer = &kirkwood_timer,
107MACHINE_END 106MACHINE_END
diff --git a/arch/arm/mach-kirkwood/dockstar-setup.c b/arch/arm/mach-kirkwood/dockstar-setup.c
new file mode 100644
index 000000000000..f14dfb8508c5
--- /dev/null
+++ b/arch/arm/mach-kirkwood/dockstar-setup.c
@@ -0,0 +1,111 @@
1/*
2 * arch/arm/mach-kirkwood/dockstar-setup.c
3 *
4 * Seagate FreeAgent DockStar 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 <plat/mvsdio.h>
23#include "common.h"
24#include "mpp.h"
25
26static struct mtd_partition dockstar_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
42static struct mv643xx_eth_platform_data dockstar_ge00_data = {
43 .phy_addr = MV643XX_ETH_PHY_ADDR(0),
44};
45
46static struct gpio_led dockstar_led_pins[] = {
47 {
48 .name = "dockstar:green:health",
49 .default_trigger = "default-on",
50 .gpio = 46,
51 .active_low = 1,
52 },
53 {
54 .name = "dockstar:orange:misc",
55 .default_trigger = "none",
56 .gpio = 47,
57 .active_low = 1,
58 },
59};
60
61static struct gpio_led_platform_data dockstar_led_data = {
62 .leds = dockstar_led_pins,
63 .num_leds = ARRAY_SIZE(dockstar_led_pins),
64};
65
66static struct platform_device dockstar_leds = {
67 .name = "leds-gpio",
68 .id = -1,
69 .dev = {
70 .platform_data = &dockstar_led_data,
71 }
72};
73
74static unsigned int dockstar_mpp_config[] __initdata = {
75 MPP29_GPIO, /* USB Power Enable */
76 MPP46_GPIO, /* LED green */
77 MPP47_GPIO, /* LED orange */
78 0
79};
80
81static void __init dockstar_init(void)
82{
83 /*
84 * Basic setup. Needs to be called early.
85 */
86 kirkwood_init();
87
88 /* setup gpio pin select */
89 kirkwood_mpp_conf(dockstar_mpp_config);
90
91 kirkwood_uart0_init();
92 kirkwood_nand_init(ARRAY_AND_SIZE(dockstar_nand_parts), 25);
93
94 if (gpio_request(29, "USB Power Enable") != 0 ||
95 gpio_direction_output(29, 1) != 0)
96 printk(KERN_ERR "can't set up GPIO 29 (USB Power Enable)\n");
97 kirkwood_ehci_init();
98
99 kirkwood_ge00_init(&dockstar_ge00_data);
100
101 platform_device_register(&dockstar_leds);
102}
103
104MACHINE_START(DOCKSTAR, "Seagate FreeAgent DockStar")
105 .boot_params = 0x00000100,
106 .init_machine = dockstar_init,
107 .map_io = kirkwood_map_io,
108 .init_early = kirkwood_init_early,
109 .init_irq = kirkwood_init_irq,
110 .timer = &kirkwood_timer,
111MACHINE_END
diff --git a/arch/arm/mach-kirkwood/guruplug-setup.c b/arch/arm/mach-kirkwood/guruplug-setup.c
index 54d07c89d4ff..41d1b40696a3 100644
--- a/arch/arm/mach-kirkwood/guruplug-setup.c
+++ b/arch/arm/mach-kirkwood/guruplug-setup.c
@@ -121,11 +121,10 @@ static void __init guruplug_init(void)
121 121
122MACHINE_START(GURUPLUG, "Marvell GuruPlug Reference Board") 122MACHINE_START(GURUPLUG, "Marvell GuruPlug Reference Board")
123 /* Maintainer: Siddarth Gore <gores@marvell.com> */ 123 /* Maintainer: Siddarth Gore <gores@marvell.com> */
124 .phys_io = KIRKWOOD_REGS_PHYS_BASE,
125 .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc,
126 .boot_params = 0x00000100, 124 .boot_params = 0x00000100,
127 .init_machine = guruplug_init, 125 .init_machine = guruplug_init,
128 .map_io = kirkwood_map_io, 126 .map_io = kirkwood_map_io,
127 .init_early = kirkwood_init_early,
129 .init_irq = kirkwood_init_irq, 128 .init_irq = kirkwood_init_irq,
130 .timer = &kirkwood_timer, 129 .timer = &kirkwood_timer,
131MACHINE_END 130MACHINE_END
diff --git a/arch/arm/mach-kirkwood/include/mach/bridge-regs.h b/arch/arm/mach-kirkwood/include/mach/bridge-regs.h
index aff0e1327e38..957bd7997d7e 100644
--- a/arch/arm/mach-kirkwood/include/mach/bridge-regs.h
+++ b/arch/arm/mach-kirkwood/include/mach/bridge-regs.h
@@ -29,9 +29,6 @@
29#define BRIDGE_CAUSE (BRIDGE_VIRT_BASE | 0x0110) 29#define BRIDGE_CAUSE (BRIDGE_VIRT_BASE | 0x0110)
30#define WDT_INT_REQ 0x0008 30#define WDT_INT_REQ 0x0008
31 31
32#define BRIDGE_MASK (BRIDGE_VIRT_BASE | 0x0114)
33#define BRIDGE_INT_TIMER0 0x0002
34#define BRIDGE_INT_TIMER1 0x0004
35#define BRIDGE_INT_TIMER1_CLR (~0x0004) 32#define BRIDGE_INT_TIMER1_CLR (~0x0004)
36 33
37#define IRQ_VIRT_BASE (BRIDGE_VIRT_BASE | 0x0200) 34#define IRQ_VIRT_BASE (BRIDGE_VIRT_BASE | 0x0200)
diff --git a/arch/arm/mach-kirkwood/include/mach/debug-macro.S b/arch/arm/mach-kirkwood/include/mach/debug-macro.S
index d0606774dea7..db06ae437d08 100644
--- a/arch/arm/mach-kirkwood/include/mach/debug-macro.S
+++ b/arch/arm/mach-kirkwood/include/mach/debug-macro.S
@@ -8,12 +8,11 @@
8 8
9#include <mach/bridge-regs.h> 9#include <mach/bridge-regs.h>
10 10
11 .macro addruart, rx, tmp 11 .macro addruart, rp, rv
12 mrc p15, 0, \rx, c1, c0 12 ldr \rp, =KIRKWOOD_REGS_PHYS_BASE
13 tst \rx, #1 @ MMU enabled? 13 ldr \rv, =KIRKWOOD_REGS_VIRT_BASE
14 ldreq \rx, =KIRKWOOD_REGS_PHYS_BASE 14 orr \rp, \rp, #0x00012000
15 ldrne \rx, =KIRKWOOD_REGS_VIRT_BASE 15 orr \rv, \rv, #0x00012000
16 orr \rx, \rx, #0x00012000
17 .endm 16 .endm
18 17
19#define UART_SHIFT 2 18#define UART_SHIFT 2
diff --git a/arch/arm/mach-kirkwood/include/mach/gpio.h b/arch/arm/mach-kirkwood/include/mach/gpio.h
index 81b335eb62ec..84f340b546c0 100644
--- a/arch/arm/mach-kirkwood/include/mach/gpio.h
+++ b/arch/arm/mach-kirkwood/include/mach/gpio.h
@@ -6,33 +6,4 @@
6 * warranty of any kind, whether express or implied. 6 * warranty of any kind, whether express or implied.
7 */ 7 */
8 8
9#ifndef __ASM_ARCH_GPIO_H
10#define __ASM_ARCH_GPIO_H
11
12#include <mach/irqs.h>
13#include <plat/gpio.h> 9#include <plat/gpio.h>
14#include <asm-generic/gpio.h> /* cansleep wrappers */
15
16#define GPIO_MAX 50
17#define GPIO_OFF(pin) (((pin) >> 5) ? 0x0140 : 0x0100)
18#define GPIO_OUT(pin) (DEV_BUS_VIRT_BASE + GPIO_OFF(pin) + 0x00)
19#define GPIO_IO_CONF(pin) (DEV_BUS_VIRT_BASE + GPIO_OFF(pin) + 0x04)
20#define GPIO_BLINK_EN(pin) (DEV_BUS_VIRT_BASE + GPIO_OFF(pin) + 0x08)
21#define GPIO_IN_POL(pin) (DEV_BUS_VIRT_BASE + GPIO_OFF(pin) + 0x0c)
22#define GPIO_DATA_IN(pin) (DEV_BUS_VIRT_BASE + GPIO_OFF(pin) + 0x10)
23#define GPIO_EDGE_CAUSE(pin) (DEV_BUS_VIRT_BASE + GPIO_OFF(pin) + 0x14)
24#define GPIO_EDGE_MASK(pin) (DEV_BUS_VIRT_BASE + GPIO_OFF(pin) + 0x18)
25#define GPIO_LEVEL_MASK(pin) (DEV_BUS_VIRT_BASE + GPIO_OFF(pin) + 0x1c)
26
27static inline int gpio_to_irq(int pin)
28{
29 return pin + IRQ_KIRKWOOD_GPIO_START;
30}
31
32static inline int irq_to_gpio(int irq)
33{
34 return irq - IRQ_KIRKWOOD_GPIO_START;
35}
36
37
38#endif
diff --git a/arch/arm/mach-kirkwood/include/mach/io.h b/arch/arm/mach-kirkwood/include/mach/io.h
index 44e8be04f259..1aaddc364f2e 100644
--- a/arch/arm/mach-kirkwood/include/mach/io.h
+++ b/arch/arm/mach-kirkwood/include/mach/io.h
@@ -42,8 +42,8 @@ __arch_iounmap(void __iomem *addr)
42 __iounmap(addr); 42 __iounmap(addr);
43} 43}
44 44
45#define __arch_ioremap(p, s, m) __arch_ioremap(p, s, m) 45#define __arch_ioremap __arch_ioremap
46#define __arch_iounmap(a) __arch_iounmap(a) 46#define __arch_iounmap __arch_iounmap
47#define __io(a) __io(a) 47#define __io(a) __io(a)
48#define __mem_pci(a) (a) 48#define __mem_pci(a) (a)
49 49
diff --git a/arch/arm/mach-kirkwood/include/mach/irqs.h b/arch/arm/mach-kirkwood/include/mach/irqs.h
index 9da2eb59180b..2bf8161e3b51 100644
--- a/arch/arm/mach-kirkwood/include/mach/irqs.h
+++ b/arch/arm/mach-kirkwood/include/mach/irqs.h
@@ -51,6 +51,7 @@
51#define IRQ_KIRKWOOD_GPIO_HIGH_16_23 41 51#define IRQ_KIRKWOOD_GPIO_HIGH_16_23 41
52#define IRQ_KIRKWOOD_GE00_ERR 46 52#define IRQ_KIRKWOOD_GE00_ERR 46
53#define IRQ_KIRKWOOD_GE01_ERR 47 53#define IRQ_KIRKWOOD_GE01_ERR 47
54#define IRQ_KIRKWOOD_RTC 53
54 55
55/* 56/*
56 * KIRKWOOD General Purpose Pins 57 * KIRKWOOD General Purpose Pins
diff --git a/arch/arm/mach-kirkwood/include/mach/kirkwood.h b/arch/arm/mach-kirkwood/include/mach/kirkwood.h
index 6e924b398919..010bdeb4ac5f 100644
--- a/arch/arm/mach-kirkwood/include/mach/kirkwood.h
+++ b/arch/arm/mach-kirkwood/include/mach/kirkwood.h
@@ -69,6 +69,8 @@
69#define DEV_BUS_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE | 0x10000) 69#define DEV_BUS_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE | 0x10000)
70#define SAMPLE_AT_RESET (DEV_BUS_VIRT_BASE | 0x0030) 70#define SAMPLE_AT_RESET (DEV_BUS_VIRT_BASE | 0x0030)
71#define DEVICE_ID (DEV_BUS_VIRT_BASE | 0x0034) 71#define DEVICE_ID (DEV_BUS_VIRT_BASE | 0x0034)
72#define GPIO_LOW_VIRT_BASE (DEV_BUS_VIRT_BASE | 0x0100)
73#define GPIO_HIGH_VIRT_BASE (DEV_BUS_VIRT_BASE | 0x0140)
72#define RTC_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x0300) 74#define RTC_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x0300)
73#define SPI_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x0600) 75#define SPI_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x0600)
74#define I2C_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x1000) 76#define I2C_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x1000)
diff --git a/arch/arm/mach-kirkwood/include/mach/leds-netxbig.h b/arch/arm/mach-kirkwood/include/mach/leds-netxbig.h
new file mode 100644
index 000000000000..24b536ebdf13
--- /dev/null
+++ b/arch/arm/mach-kirkwood/include/mach/leds-netxbig.h
@@ -0,0 +1,55 @@
1/*
2 * arch/arm/mach-kirkwood/include/mach/leds-netxbig.h
3 *
4 * Platform data structure for netxbig LED driver
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#ifndef __MACH_LEDS_NETXBIG_H
12#define __MACH_LEDS_NETXBIG_H
13
14struct netxbig_gpio_ext {
15 unsigned *addr;
16 int num_addr;
17 unsigned *data;
18 int num_data;
19 unsigned enable;
20};
21
22enum netxbig_led_mode {
23 NETXBIG_LED_OFF,
24 NETXBIG_LED_ON,
25 NETXBIG_LED_SATA,
26 NETXBIG_LED_TIMER1,
27 NETXBIG_LED_TIMER2,
28 NETXBIG_LED_MODE_NUM,
29};
30
31#define NETXBIG_LED_INVALID_MODE NETXBIG_LED_MODE_NUM
32
33struct netxbig_led_timer {
34 unsigned long delay_on;
35 unsigned long delay_off;
36 enum netxbig_led_mode mode;
37};
38
39struct netxbig_led {
40 const char *name;
41 const char *default_trigger;
42 int mode_addr;
43 int *mode_val;
44 int bright_addr;
45};
46
47struct netxbig_led_platform_data {
48 struct netxbig_gpio_ext *gpio_ext;
49 struct netxbig_led_timer *timer;
50 int num_timer;
51 struct netxbig_led *leds;
52 int num_leds;
53};
54
55#endif /* __MACH_LEDS_NETXBIG_H */
diff --git a/arch/arm/mach-kirkwood/include/mach/memory.h b/arch/arm/mach-kirkwood/include/mach/memory.h
index 45431e131465..4600b44e3ad3 100644
--- a/arch/arm/mach-kirkwood/include/mach/memory.h
+++ b/arch/arm/mach-kirkwood/include/mach/memory.h
@@ -5,6 +5,6 @@
5#ifndef __ASM_ARCH_MEMORY_H 5#ifndef __ASM_ARCH_MEMORY_H
6#define __ASM_ARCH_MEMORY_H 6#define __ASM_ARCH_MEMORY_H
7 7
8#define PHYS_OFFSET UL(0x00000000) 8#define PLAT_PHYS_OFFSET UL(0x00000000)
9 9
10#endif 10#endif
diff --git a/arch/arm/mach-kirkwood/irq.c b/arch/arm/mach-kirkwood/irq.c
index 28020abf49e1..05d193a25b25 100644
--- a/arch/arm/mach-kirkwood/irq.c
+++ b/arch/arm/mach-kirkwood/irq.c
@@ -27,32 +27,23 @@ static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
27 27
28void __init kirkwood_init_irq(void) 28void __init kirkwood_init_irq(void)
29{ 29{
30 int i;
31
32 orion_irq_init(0, (void __iomem *)(IRQ_VIRT_BASE + IRQ_MASK_LOW_OFF)); 30 orion_irq_init(0, (void __iomem *)(IRQ_VIRT_BASE + IRQ_MASK_LOW_OFF));
33 orion_irq_init(32, (void __iomem *)(IRQ_VIRT_BASE + IRQ_MASK_HIGH_OFF)); 31 orion_irq_init(32, (void __iomem *)(IRQ_VIRT_BASE + IRQ_MASK_HIGH_OFF));
34 32
35 /* 33 /*
36 * Mask and clear GPIO IRQ interrupts. 34 * Initialize gpiolib for GPIOs 0-49.
37 */ 35 */
38 writel(0, GPIO_LEVEL_MASK(0)); 36 orion_gpio_init(0, 32, GPIO_LOW_VIRT_BASE, 0,
39 writel(0, GPIO_EDGE_MASK(0)); 37 IRQ_KIRKWOOD_GPIO_START);
40 writel(0, GPIO_EDGE_CAUSE(0)); 38 irq_set_chained_handler(IRQ_KIRKWOOD_GPIO_LOW_0_7, gpio_irq_handler);
41 writel(0, GPIO_LEVEL_MASK(32)); 39 irq_set_chained_handler(IRQ_KIRKWOOD_GPIO_LOW_8_15, gpio_irq_handler);
42 writel(0, GPIO_EDGE_MASK(32)); 40 irq_set_chained_handler(IRQ_KIRKWOOD_GPIO_LOW_16_23, gpio_irq_handler);
43 writel(0, GPIO_EDGE_CAUSE(32)); 41 irq_set_chained_handler(IRQ_KIRKWOOD_GPIO_LOW_24_31, gpio_irq_handler);
44 42
45 for (i = IRQ_KIRKWOOD_GPIO_START; i < NR_IRQS; i++) { 43 orion_gpio_init(32, 18, GPIO_HIGH_VIRT_BASE, 0,
46 set_irq_chip(i, &orion_gpio_irq_chip); 44 IRQ_KIRKWOOD_GPIO_START + 32);
47 set_irq_handler(i, handle_level_irq); 45 irq_set_chained_handler(IRQ_KIRKWOOD_GPIO_HIGH_0_7, gpio_irq_handler);
48 irq_desc[i].status |= IRQ_LEVEL; 46 irq_set_chained_handler(IRQ_KIRKWOOD_GPIO_HIGH_8_15, gpio_irq_handler);
49 set_irq_flags(i, IRQF_VALID); 47 irq_set_chained_handler(IRQ_KIRKWOOD_GPIO_HIGH_16_23,
50 } 48 gpio_irq_handler);
51 set_irq_chained_handler(IRQ_KIRKWOOD_GPIO_LOW_0_7, gpio_irq_handler);
52 set_irq_chained_handler(IRQ_KIRKWOOD_GPIO_LOW_8_15, gpio_irq_handler);
53 set_irq_chained_handler(IRQ_KIRKWOOD_GPIO_LOW_16_23, gpio_irq_handler);
54 set_irq_chained_handler(IRQ_KIRKWOOD_GPIO_LOW_24_31, gpio_irq_handler);
55 set_irq_chained_handler(IRQ_KIRKWOOD_GPIO_HIGH_0_7, gpio_irq_handler);
56 set_irq_chained_handler(IRQ_KIRKWOOD_GPIO_HIGH_8_15, gpio_irq_handler);
57 set_irq_chained_handler(IRQ_KIRKWOOD_GPIO_HIGH_16_23, gpio_irq_handler);
58} 49}
diff --git a/arch/arm/mach-kirkwood/lacie_v2-common.c b/arch/arm/mach-kirkwood/lacie_v2-common.c
new file mode 100644
index 000000000000..285edab776e9
--- /dev/null
+++ b/arch/arm/mach-kirkwood/lacie_v2-common.c
@@ -0,0 +1,113 @@
1/*
2 * arch/arm/mach-kirkwood/lacie_v2-common.c
3 *
4 * This file is licensed under the terms of the GNU General Public
5 * License version 2. This program is licensed "as is" without any
6 * warranty of any kind, whether express or implied.
7 */
8
9#include <linux/kernel.h>
10#include <linux/init.h>
11#include <linux/mtd/physmap.h>
12#include <linux/spi/flash.h>
13#include <linux/spi/spi.h>
14#include <linux/i2c.h>
15#include <linux/i2c/at24.h>
16#include <linux/gpio.h>
17#include <asm/mach/time.h>
18#include <mach/kirkwood.h>
19#include <mach/irqs.h>
20#include <plat/time.h>
21#include "common.h"
22
23/*****************************************************************************
24 * 512KB SPI Flash on Boot Device (MACRONIX MX25L4005)
25 ****************************************************************************/
26
27static struct mtd_partition lacie_v2_flash_parts[] = {
28 {
29 .name = "u-boot",
30 .size = MTDPART_SIZ_FULL,
31 .offset = 0,
32 .mask_flags = MTD_WRITEABLE, /* force read-only */
33 },
34};
35
36static const struct flash_platform_data lacie_v2_flash = {
37 .type = "mx25l4005a",
38 .name = "spi_flash",
39 .parts = lacie_v2_flash_parts,
40 .nr_parts = ARRAY_SIZE(lacie_v2_flash_parts),
41};
42
43static struct spi_board_info __initdata lacie_v2_spi_slave_info[] = {
44 {
45 .modalias = "m25p80",
46 .platform_data = &lacie_v2_flash,
47 .irq = -1,
48 .max_speed_hz = 20000000,
49 .bus_num = 0,
50 .chip_select = 0,
51 },
52};
53
54void __init lacie_v2_register_flash(void)
55{
56 spi_register_board_info(lacie_v2_spi_slave_info,
57 ARRAY_SIZE(lacie_v2_spi_slave_info));
58 kirkwood_spi_init();
59}
60
61/*****************************************************************************
62 * I2C devices
63 ****************************************************************************/
64
65static struct at24_platform_data at24c04 = {
66 .byte_len = SZ_4K / 8,
67 .page_size = 16,
68};
69
70/*
71 * i2c addr | chip | description
72 * 0x50 | HT24LC04 | eeprom (512B)
73 */
74
75static struct i2c_board_info __initdata lacie_v2_i2c_info[] = {
76 {
77 I2C_BOARD_INFO("24c04", 0x50),
78 .platform_data = &at24c04,
79 }
80};
81
82void __init lacie_v2_register_i2c_devices(void)
83{
84 kirkwood_i2c_init();
85 i2c_register_board_info(0, lacie_v2_i2c_info,
86 ARRAY_SIZE(lacie_v2_i2c_info));
87}
88
89/*****************************************************************************
90 * Hard Disk power
91 ****************************************************************************/
92
93static int __initdata lacie_v2_gpio_hdd_power[] = { 16, 17, 41, 42, 43 };
94
95void __init lacie_v2_hdd_power_init(int hdd_num)
96{
97 int i;
98 int err;
99
100 /* Power up all hard disks. */
101 for (i = 0; i < hdd_num; i++) {
102 err = gpio_request(lacie_v2_gpio_hdd_power[i], NULL);
103 if (err == 0) {
104 err = gpio_direction_output(
105 lacie_v2_gpio_hdd_power[i], 1);
106 /* Free the HDD power GPIOs. This allow user-space to
107 * configure them via the gpiolib sysfs interface. */
108 gpio_free(lacie_v2_gpio_hdd_power[i]);
109 }
110 if (err)
111 pr_err("Failed to power up HDD%d\n", i + 1);
112 }
113}
diff --git a/arch/arm/mach-kirkwood/lacie_v2-common.h b/arch/arm/mach-kirkwood/lacie_v2-common.h
new file mode 100644
index 000000000000..fc64f578536e
--- /dev/null
+++ b/arch/arm/mach-kirkwood/lacie_v2-common.h
@@ -0,0 +1,16 @@
1/*
2 * arch/arm/mach-kirkwood/lacie_v2-common.h
3 *
4 * This file is licensed under the terms of the GNU General Public
5 * License version 2. This program is licensed "as is" without any
6 * warranty of any kind, whether express or implied.
7 */
8
9#ifndef __ARCH_KIRKWOOD_LACIE_V2_COMMON_H
10#define __ARCH_KIRKWOOD_LACIE_V2_COMMON_H
11
12void lacie_v2_register_flash(void);
13void lacie_v2_register_i2c_devices(void);
14void lacie_v2_hdd_power_init(int hdd_num);
15
16#endif
diff --git a/arch/arm/mach-kirkwood/mpp.c b/arch/arm/mach-kirkwood/mpp.c
index 065187d177c6..b0a7d979a8ed 100644
--- a/arch/arm/mach-kirkwood/mpp.c
+++ b/arch/arm/mach-kirkwood/mpp.c
@@ -14,6 +14,7 @@
14#include <linux/io.h> 14#include <linux/io.h>
15#include <asm/gpio.h> 15#include <asm/gpio.h>
16#include <mach/hardware.h> 16#include <mach/hardware.h>
17#include <plat/mpp.h>
17#include "common.h" 18#include "common.h"
18#include "mpp.h" 19#include "mpp.h"
19 20
@@ -36,66 +37,8 @@ static unsigned int __init kirkwood_variant(void)
36 return 0; 37 return 0;
37} 38}
38 39
39#define MPP_CTRL(i) (DEV_BUS_VIRT_BASE + (i) * 4)
40#define MPP_NR_REGS (1 + MPP_MAX/8)
41
42void __init kirkwood_mpp_conf(unsigned int *mpp_list) 40void __init kirkwood_mpp_conf(unsigned int *mpp_list)
43{ 41{
44 u32 mpp_ctrl[MPP_NR_REGS]; 42 orion_mpp_conf(mpp_list, kirkwood_variant(),
45 unsigned int variant_mask; 43 MPP_MAX, DEV_BUS_VIRT_BASE);
46 int i;
47
48 variant_mask = kirkwood_variant();
49 if (!variant_mask)
50 return;
51
52 /* Initialize gpiolib. */
53 orion_gpio_init();
54
55 printk(KERN_DEBUG "initial MPP regs:");
56 for (i = 0; i < MPP_NR_REGS; i++) {
57 mpp_ctrl[i] = readl(MPP_CTRL(i));
58 printk(" %08x", mpp_ctrl[i]);
59 }
60 printk("\n");
61
62 while (*mpp_list) {
63 unsigned int num = MPP_NUM(*mpp_list);
64 unsigned int sel = MPP_SEL(*mpp_list);
65 int shift, gpio_mode;
66
67 if (num > MPP_MAX) {
68 printk(KERN_ERR "kirkwood_mpp_conf: invalid MPP "
69 "number (%u)\n", num);
70 continue;
71 }
72 if (!(*mpp_list & variant_mask)) {
73 printk(KERN_WARNING
74 "kirkwood_mpp_conf: requested MPP%u config "
75 "unavailable on this hardware\n", num);
76 continue;
77 }
78
79 shift = (num & 7) << 2;
80 mpp_ctrl[num / 8] &= ~(0xf << shift);
81 mpp_ctrl[num / 8] |= sel << shift;
82
83 gpio_mode = 0;
84 if (*mpp_list & MPP_INPUT_MASK)
85 gpio_mode |= GPIO_INPUT_OK;
86 if (*mpp_list & MPP_OUTPUT_MASK)
87 gpio_mode |= GPIO_OUTPUT_OK;
88 if (sel != 0)
89 gpio_mode = 0;
90 orion_gpio_set_valid(num, gpio_mode);
91
92 mpp_list++;
93 }
94
95 printk(KERN_DEBUG " final MPP regs:");
96 for (i = 0; i < MPP_NR_REGS; i++) {
97 writel(mpp_ctrl[i], MPP_CTRL(i));
98 printk(" %08x", mpp_ctrl[i]);
99 }
100 printk("\n");
101} 44}
diff --git a/arch/arm/mach-kirkwood/mpp.h b/arch/arm/mach-kirkwood/mpp.h
index 9b0a94d85c3e..ac787957e2d9 100644
--- a/arch/arm/mach-kirkwood/mpp.h
+++ b/arch/arm/mach-kirkwood/mpp.h
@@ -22,14 +22,8 @@
22 /* available on F6281 */ ((!!(_F6281)) << 17) | \ 22 /* available on F6281 */ ((!!(_F6281)) << 17) | \
23 /* available on F6282 */ ((!!(_F6282)) << 18)) 23 /* available on F6282 */ ((!!(_F6282)) << 18))
24 24
25#define MPP_NUM(x) ((x) & 0xff)
26#define MPP_SEL(x) (((x) >> 8) & 0xf)
27
28 /* num sel i o 6180 6190 6192 6281 6282 */ 25 /* num sel i o 6180 6190 6192 6281 6282 */
29 26
30#define MPP_INPUT_MASK MPP( 0, 0x0, 1, 0, 0, 0, 0, 0, 0 )
31#define MPP_OUTPUT_MASK MPP( 0, 0x0, 0, 1, 0, 0, 0, 0, 0 )
32
33#define MPP_F6180_MASK MPP( 0, 0x0, 0, 0, 1, 0, 0, 0, 0 ) 27#define MPP_F6180_MASK MPP( 0, 0x0, 0, 0, 1, 0, 0, 0, 0 )
34#define MPP_F6190_MASK MPP( 0, 0x0, 0, 0, 0, 1, 0, 0, 0 ) 28#define MPP_F6190_MASK MPP( 0, 0x0, 0, 0, 0, 1, 0, 0, 0 )
35#define MPP_F6192_MASK MPP( 0, 0x0, 0, 0, 0, 0, 1, 0, 0 ) 29#define MPP_F6192_MASK MPP( 0, 0x0, 0, 0, 0, 0, 1, 0, 0 )
diff --git a/arch/arm/mach-kirkwood/mv88f6281gtw_ge-setup.c b/arch/arm/mach-kirkwood/mv88f6281gtw_ge-setup.c
index c6b92b42eb4e..00cca22eca6f 100644
--- a/arch/arm/mach-kirkwood/mv88f6281gtw_ge-setup.c
+++ b/arch/arm/mach-kirkwood/mv88f6281gtw_ge-setup.c
@@ -163,11 +163,10 @@ subsys_initcall(mv88f6281gtw_ge_pci_init);
163 163
164MACHINE_START(MV88F6281GTW_GE, "Marvell 88F6281 GTW GE Board") 164MACHINE_START(MV88F6281GTW_GE, "Marvell 88F6281 GTW GE Board")
165 /* Maintainer: Lennert Buytenhek <buytenh@marvell.com> */ 165 /* Maintainer: Lennert Buytenhek <buytenh@marvell.com> */
166 .phys_io = KIRKWOOD_REGS_PHYS_BASE,
167 .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc,
168 .boot_params = 0x00000100, 166 .boot_params = 0x00000100,
169 .init_machine = mv88f6281gtw_ge_init, 167 .init_machine = mv88f6281gtw_ge_init,
170 .map_io = kirkwood_map_io, 168 .map_io = kirkwood_map_io,
169 .init_early = kirkwood_init_early,
171 .init_irq = kirkwood_init_irq, 170 .init_irq = kirkwood_init_irq,
172 .timer = &kirkwood_timer, 171 .timer = &kirkwood_timer,
173MACHINE_END 172MACHINE_END
diff --git a/arch/arm/mach-kirkwood/netspace_v2-setup.c b/arch/arm/mach-kirkwood/netspace_v2-setup.c
index d26bf324738b..7cdab5776452 100644
--- a/arch/arm/mach-kirkwood/netspace_v2-setup.c
+++ b/arch/arm/mach-kirkwood/netspace_v2-setup.c
@@ -24,56 +24,20 @@
24#include <linux/kernel.h> 24#include <linux/kernel.h>
25#include <linux/init.h> 25#include <linux/init.h>
26#include <linux/platform_device.h> 26#include <linux/platform_device.h>
27#include <linux/mtd/physmap.h>
28#include <linux/spi/flash.h>
29#include <linux/spi/spi.h>
30#include <linux/ata_platform.h> 27#include <linux/ata_platform.h>
31#include <linux/mv643xx_eth.h> 28#include <linux/mv643xx_eth.h>
32#include <linux/i2c.h>
33#include <linux/i2c/at24.h>
34#include <linux/input.h> 29#include <linux/input.h>
35#include <linux/gpio.h> 30#include <linux/gpio.h>
36#include <linux/gpio_keys.h> 31#include <linux/gpio_keys.h>
37#include <linux/leds.h> 32#include <linux/leds.h>
33#include <linux/gpio-fan.h>
38#include <asm/mach-types.h> 34#include <asm/mach-types.h>
39#include <asm/mach/arch.h> 35#include <asm/mach/arch.h>
40#include <asm/mach/time.h>
41#include <mach/kirkwood.h> 36#include <mach/kirkwood.h>
42#include <mach/leds-ns2.h> 37#include <mach/leds-ns2.h>
43#include <plat/time.h>
44#include "common.h" 38#include "common.h"
45#include "mpp.h" 39#include "mpp.h"
46 40#include "lacie_v2-common.h"
47/*****************************************************************************
48 * 512KB SPI Flash on Boot Device (MACRONIX MX25L4005)
49 ****************************************************************************/
50
51static struct mtd_partition netspace_v2_flash_parts[] = {
52 {
53 .name = "u-boot",
54 .size = MTDPART_SIZ_FULL,
55 .offset = 0,
56 .mask_flags = MTD_WRITEABLE, /* force read-only */
57 },
58};
59
60static const struct flash_platform_data netspace_v2_flash = {
61 .type = "mx25l4005a",
62 .name = "spi_flash",
63 .parts = netspace_v2_flash_parts,
64 .nr_parts = ARRAY_SIZE(netspace_v2_flash_parts),
65};
66
67static struct spi_board_info __initdata netspace_v2_spi_slave_info[] = {
68 {
69 .modalias = "m25p80",
70 .platform_data = &netspace_v2_flash,
71 .irq = -1,
72 .max_speed_hz = 20000000,
73 .bus_num = 0,
74 .chip_select = 0,
75 },
76};
77 41
78/***************************************************************************** 42/*****************************************************************************
79 * Ethernet 43 * Ethernet
@@ -84,27 +48,6 @@ static struct mv643xx_eth_platform_data netspace_v2_ge00_data = {
84}; 48};
85 49
86/***************************************************************************** 50/*****************************************************************************
87 * I2C devices
88 ****************************************************************************/
89
90static struct at24_platform_data at24c04 = {
91 .byte_len = SZ_4K / 8,
92 .page_size = 16,
93};
94
95/*
96 * i2c addr | chip | description
97 * 0x50 | HT24LC04 | eeprom (512B)
98 */
99
100static struct i2c_board_info __initdata netspace_v2_i2c_info[] = {
101 {
102 I2C_BOARD_INFO("24c04", 0x50),
103 .platform_data = &at24c04,
104 }
105};
106
107/*****************************************************************************
108 * SATA 51 * SATA
109 ****************************************************************************/ 52 ****************************************************************************/
110 53
@@ -112,35 +55,6 @@ static struct mv_sata_platform_data netspace_v2_sata_data = {
112 .n_ports = 2, 55 .n_ports = 2,
113}; 56};
114 57
115#define NETSPACE_V2_GPIO_SATA0_POWER 16
116#define NETSPACE_V2_GPIO_SATA1_POWER 17
117
118static void __init netspace_v2_sata_power_init(void)
119{
120 int err;
121
122 err = gpio_request(NETSPACE_V2_GPIO_SATA0_POWER, "SATA0 power");
123 if (err == 0) {
124 err = gpio_direction_output(NETSPACE_V2_GPIO_SATA0_POWER, 1);
125 if (err)
126 gpio_free(NETSPACE_V2_GPIO_SATA0_POWER);
127 }
128 if (err)
129 pr_err("netspace_v2: failed to setup SATA0 power\n");
130
131 if (machine_is_netspace_max_v2()) {
132 err = gpio_request(NETSPACE_V2_GPIO_SATA1_POWER, "SATA1 power");
133 if (err == 0) {
134 err = gpio_direction_output(
135 NETSPACE_V2_GPIO_SATA1_POWER, 1);
136 if (err)
137 gpio_free(NETSPACE_V2_GPIO_SATA1_POWER);
138 }
139 if (err)
140 pr_err("netspace_v2: failed to setup SATA1 power\n");
141 }
142}
143
144/***************************************************************************** 58/*****************************************************************************
145 * GPIO keys 59 * GPIO keys
146 ****************************************************************************/ 60 ****************************************************************************/
@@ -224,17 +138,43 @@ static struct platform_device netspace_v2_leds = {
224}; 138};
225 139
226/***************************************************************************** 140/*****************************************************************************
227 * Timer 141 * GPIO fan
228 ****************************************************************************/ 142 ****************************************************************************/
229 143
230static void netspace_v2_timer_init(void) 144/* Designed for fan 40x40x16: ADDA AD0412LB-D50 6000rpm@12v */
231{ 145static struct gpio_fan_speed netspace_max_v2_fan_speed[] = {
232 kirkwood_tclk = 166666667; 146 { 0, 0 },
233 orion_time_init(IRQ_KIRKWOOD_BRIDGE, kirkwood_tclk); 147 { 1500, 15 },
234} 148 { 1700, 14 },
149 { 1800, 13 },
150 { 2100, 12 },
151 { 3100, 11 },
152 { 3300, 10 },
153 { 4300, 9 },
154 { 5500, 8 },
155};
156
157static unsigned netspace_max_v2_fan_ctrl[] = { 22, 7, 33, 23 };
158
159static struct gpio_fan_alarm netspace_max_v2_fan_alarm = {
160 .gpio = 25,
161 .active_low = 1,
162};
235 163
236struct sys_timer netspace_v2_timer = { 164static struct gpio_fan_platform_data netspace_max_v2_fan_data = {
237 .init = netspace_v2_timer_init, 165 .num_ctrl = ARRAY_SIZE(netspace_max_v2_fan_ctrl),
166 .ctrl = netspace_max_v2_fan_ctrl,
167 .alarm = &netspace_max_v2_fan_alarm,
168 .num_speed = ARRAY_SIZE(netspace_max_v2_fan_speed),
169 .speed = netspace_max_v2_fan_speed,
170};
171
172static struct platform_device netspace_max_v2_gpio_fan = {
173 .name = "gpio-fan",
174 .id = -1,
175 .dev = {
176 .platform_data = &netspace_max_v2_fan_data,
177 },
238}; 178};
239 179
240/***************************************************************************** 180/*****************************************************************************
@@ -291,22 +231,23 @@ static void __init netspace_v2_init(void)
291 kirkwood_init(); 231 kirkwood_init();
292 kirkwood_mpp_conf(netspace_v2_mpp_config); 232 kirkwood_mpp_conf(netspace_v2_mpp_config);
293 233
294 netspace_v2_sata_power_init(); 234 if (machine_is_netspace_max_v2())
235 lacie_v2_hdd_power_init(2);
236 else
237 lacie_v2_hdd_power_init(1);
295 238
296 kirkwood_ehci_init(); 239 kirkwood_ehci_init();
297 kirkwood_ge00_init(&netspace_v2_ge00_data); 240 kirkwood_ge00_init(&netspace_v2_ge00_data);
298 kirkwood_sata_init(&netspace_v2_sata_data); 241 kirkwood_sata_init(&netspace_v2_sata_data);
299 kirkwood_uart0_init(); 242 kirkwood_uart0_init();
300 spi_register_board_info(netspace_v2_spi_slave_info, 243 lacie_v2_register_flash();
301 ARRAY_SIZE(netspace_v2_spi_slave_info)); 244 lacie_v2_register_i2c_devices();
302 kirkwood_spi_init();
303 kirkwood_i2c_init();
304 i2c_register_board_info(0, netspace_v2_i2c_info,
305 ARRAY_SIZE(netspace_v2_i2c_info));
306 245
307 platform_device_register(&netspace_v2_leds); 246 platform_device_register(&netspace_v2_leds);
308 platform_device_register(&netspace_v2_gpio_leds); 247 platform_device_register(&netspace_v2_gpio_leds);
309 platform_device_register(&netspace_v2_gpio_buttons); 248 platform_device_register(&netspace_v2_gpio_buttons);
249 if (machine_is_netspace_max_v2())
250 platform_device_register(&netspace_max_v2_gpio_fan);
310 251
311 if (gpio_request(NETSPACE_V2_GPIO_POWER_OFF, "power-off") == 0 && 252 if (gpio_request(NETSPACE_V2_GPIO_POWER_OFF, "power-off") == 0 &&
312 gpio_direction_output(NETSPACE_V2_GPIO_POWER_OFF, 0) == 0) 253 gpio_direction_output(NETSPACE_V2_GPIO_POWER_OFF, 0) == 0)
@@ -317,36 +258,33 @@ static void __init netspace_v2_init(void)
317 258
318#ifdef CONFIG_MACH_NETSPACE_V2 259#ifdef CONFIG_MACH_NETSPACE_V2
319MACHINE_START(NETSPACE_V2, "LaCie Network Space v2") 260MACHINE_START(NETSPACE_V2, "LaCie Network Space v2")
320 .phys_io = KIRKWOOD_REGS_PHYS_BASE,
321 .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc,
322 .boot_params = 0x00000100, 261 .boot_params = 0x00000100,
323 .init_machine = netspace_v2_init, 262 .init_machine = netspace_v2_init,
324 .map_io = kirkwood_map_io, 263 .map_io = kirkwood_map_io,
264 .init_early = kirkwood_init_early,
325 .init_irq = kirkwood_init_irq, 265 .init_irq = kirkwood_init_irq,
326 .timer = &netspace_v2_timer, 266 .timer = &kirkwood_timer,
327MACHINE_END 267MACHINE_END
328#endif 268#endif
329 269
330#ifdef CONFIG_MACH_INETSPACE_V2 270#ifdef CONFIG_MACH_INETSPACE_V2
331MACHINE_START(INETSPACE_V2, "LaCie Internet Space v2") 271MACHINE_START(INETSPACE_V2, "LaCie Internet Space v2")
332 .phys_io = KIRKWOOD_REGS_PHYS_BASE,
333 .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc,
334 .boot_params = 0x00000100, 272 .boot_params = 0x00000100,
335 .init_machine = netspace_v2_init, 273 .init_machine = netspace_v2_init,
336 .map_io = kirkwood_map_io, 274 .map_io = kirkwood_map_io,
275 .init_early = kirkwood_init_early,
337 .init_irq = kirkwood_init_irq, 276 .init_irq = kirkwood_init_irq,
338 .timer = &netspace_v2_timer, 277 .timer = &kirkwood_timer,
339MACHINE_END 278MACHINE_END
340#endif 279#endif
341 280
342#ifdef CONFIG_MACH_NETSPACE_MAX_V2 281#ifdef CONFIG_MACH_NETSPACE_MAX_V2
343MACHINE_START(NETSPACE_MAX_V2, "LaCie Network Space Max v2") 282MACHINE_START(NETSPACE_MAX_V2, "LaCie Network Space Max v2")
344 .phys_io = KIRKWOOD_REGS_PHYS_BASE,
345 .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc,
346 .boot_params = 0x00000100, 283 .boot_params = 0x00000100,
347 .init_machine = netspace_v2_init, 284 .init_machine = netspace_v2_init,
348 .map_io = kirkwood_map_io, 285 .map_io = kirkwood_map_io,
286 .init_early = kirkwood_init_early,
349 .init_irq = kirkwood_init_irq, 287 .init_irq = kirkwood_init_irq,
350 .timer = &netspace_v2_timer, 288 .timer = &kirkwood_timer,
351MACHINE_END 289MACHINE_END
352#endif 290#endif
diff --git a/arch/arm/mach-kirkwood/netxbig_v2-setup.c b/arch/arm/mach-kirkwood/netxbig_v2-setup.c
index 2bd14c5079de..6be627deb0fc 100644
--- a/arch/arm/mach-kirkwood/netxbig_v2-setup.c
+++ b/arch/arm/mach-kirkwood/netxbig_v2-setup.c
@@ -23,55 +23,19 @@
23#include <linux/kernel.h> 23#include <linux/kernel.h>
24#include <linux/init.h> 24#include <linux/init.h>
25#include <linux/platform_device.h> 25#include <linux/platform_device.h>
26#include <linux/mtd/physmap.h>
27#include <linux/spi/flash.h>
28#include <linux/spi/spi.h>
29#include <linux/ata_platform.h> 26#include <linux/ata_platform.h>
30#include <linux/mv643xx_eth.h> 27#include <linux/mv643xx_eth.h>
31#include <linux/i2c.h>
32#include <linux/i2c/at24.h>
33#include <linux/input.h> 28#include <linux/input.h>
34#include <linux/gpio.h> 29#include <linux/gpio.h>
35#include <linux/gpio_keys.h> 30#include <linux/gpio_keys.h>
36#include <linux/leds.h> 31#include <linux/leds.h>
37#include <asm/mach-types.h> 32#include <asm/mach-types.h>
38#include <asm/mach/arch.h> 33#include <asm/mach/arch.h>
39#include <asm/mach/time.h>
40#include <mach/kirkwood.h> 34#include <mach/kirkwood.h>
41#include <plat/time.h> 35#include <mach/leds-netxbig.h>
42#include "common.h" 36#include "common.h"
43#include "mpp.h" 37#include "mpp.h"
44 38#include "lacie_v2-common.h"
45/*****************************************************************************
46 * 512KB SPI Flash on Boot Device (MACRONIX MX25L4005)
47 ****************************************************************************/
48
49static struct mtd_partition netxbig_v2_flash_parts[] = {
50 {
51 .name = "u-boot",
52 .size = MTDPART_SIZ_FULL,
53 .offset = 0,
54 .mask_flags = MTD_WRITEABLE, /* force read-only */
55 },
56};
57
58static const struct flash_platform_data netxbig_v2_flash = {
59 .type = "mx25l4005a",
60 .name = "spi_flash",
61 .parts = netxbig_v2_flash_parts,
62 .nr_parts = ARRAY_SIZE(netxbig_v2_flash_parts),
63};
64
65static struct spi_board_info __initdata netxbig_v2_spi_slave_info[] = {
66 {
67 .modalias = "m25p80",
68 .platform_data = &netxbig_v2_flash,
69 .irq = -1,
70 .max_speed_hz = 20000000,
71 .bus_num = 0,
72 .chip_select = 0,
73 },
74};
75 39
76/***************************************************************************** 40/*****************************************************************************
77 * Ethernet 41 * Ethernet
@@ -86,27 +50,6 @@ static struct mv643xx_eth_platform_data netxbig_v2_ge01_data = {
86}; 50};
87 51
88/***************************************************************************** 52/*****************************************************************************
89 * I2C devices
90 ****************************************************************************/
91
92static struct at24_platform_data at24c04 = {
93 .byte_len = SZ_4K / 8,
94 .page_size = 16,
95};
96
97/*
98 * i2c addr | chip | description
99 * 0x50 | HT24LC04 | eeprom (512B)
100 */
101
102static struct i2c_board_info __initdata netxbig_v2_i2c_info[] = {
103 {
104 I2C_BOARD_INFO("24c04", 0x50),
105 .platform_data = &at24c04,
106 }
107};
108
109/*****************************************************************************
110 * SATA 53 * SATA
111 ****************************************************************************/ 54 ****************************************************************************/
112 55
@@ -114,34 +57,6 @@ static struct mv_sata_platform_data netxbig_v2_sata_data = {
114 .n_ports = 2, 57 .n_ports = 2,
115}; 58};
116 59
117static int __initdata netxbig_v2_gpio_hdd_power[] = { 16, 17, 41, 42, 43 };
118
119static void __init netxbig_v2_sata_power_init(void)
120{
121 int i;
122 int err;
123 int hdd_nb;
124
125 if (machine_is_net2big_v2())
126 hdd_nb = 2;
127 else
128 hdd_nb = 5;
129
130 /* Power up all hard disks. */
131 for (i = 0; i < hdd_nb; i++) {
132 err = gpio_request(netxbig_v2_gpio_hdd_power[i], NULL);
133 if (err == 0) {
134 err = gpio_direction_output(
135 netxbig_v2_gpio_hdd_power[i], 1);
136 /* Free the HDD power GPIOs. This allow user-space to
137 * configure them via the gpiolib sysfs interface. */
138 gpio_free(netxbig_v2_gpio_hdd_power[i]);
139 }
140 if (err)
141 pr_err("netxbig_v2: failed to power up HDD%d\n", i + 1);
142 }
143}
144
145/***************************************************************************** 60/*****************************************************************************
146 * GPIO keys 61 * GPIO keys
147 ****************************************************************************/ 62 ****************************************************************************/
@@ -190,7 +105,7 @@ static struct platform_device netxbig_v2_gpio_buttons = {
190}; 105};
191 106
192/***************************************************************************** 107/*****************************************************************************
193 * GPIO LEDs 108 * GPIO extension LEDs
194 ****************************************************************************/ 109 ****************************************************************************/
195 110
196/* 111/*
@@ -200,19 +115,32 @@ static struct platform_device netxbig_v2_gpio_buttons = {
200 * - address register : bit [0-2] -> GPIO [47-49] 115 * - address register : bit [0-2] -> GPIO [47-49]
201 * - data register : bit [0-2] -> GPIO [44-46] 116 * - data register : bit [0-2] -> GPIO [44-46]
202 * - enable register : GPIO 29 117 * - enable register : GPIO 29
203 * 118 */
119
120static int netxbig_v2_gpio_ext_addr[] = { 47, 48, 49 };
121static int netxbig_v2_gpio_ext_data[] = { 44, 45, 46 };
122
123static struct netxbig_gpio_ext netxbig_v2_gpio_ext = {
124 .addr = netxbig_v2_gpio_ext_addr,
125 .num_addr = ARRAY_SIZE(netxbig_v2_gpio_ext_addr),
126 .data = netxbig_v2_gpio_ext_data,
127 .num_data = ARRAY_SIZE(netxbig_v2_gpio_ext_data),
128 .enable = 29,
129};
130
131/*
204 * Address register selection: 132 * Address register selection:
205 * 133 *
206 * addr | register 134 * addr | register
207 * ---------------------------- 135 * ----------------------------
208 * 0 | front LED 136 * 0 | front LED
209 * 1 | front LED brightness 137 * 1 | front LED brightness
210 * 2 | HDD LED brightness 138 * 2 | SATA LED brightness
211 * 3 | HDD1 LED 139 * 3 | SATA0 LED
212 * 4 | HDD2 LED 140 * 4 | SATA1 LED
213 * 5 | HDD3 LED 141 * 5 | SATA2 LED
214 * 6 | HDD4 LED 142 * 6 | SATA3 LED
215 * 7 | HDD5 LED 143 * 7 | SATA4 LED
216 * 144 *
217 * Data register configuration: 145 * Data register configuration:
218 * 146 *
@@ -233,30 +161,107 @@ static struct platform_device netxbig_v2_gpio_buttons = {
233 * 6 | blink blue on=1 sec and red on=1 sec 161 * 6 | blink blue on=1 sec and red on=1 sec
234 * 7 | blink blue on=0.5 sec and blue off=2.5 sec 162 * 7 | blink blue on=0.5 sec and blue off=2.5 sec
235 * 163 *
236 * data | HDD LED mode 164 * data | SATA LED mode
237 * ------------------------------------------------- 165 * -------------------------------------------------
238 * 0 | fix blue on 166 * 0 | fix off
239 * 1 | SATA activity blink 167 * 1 | SATA activity blink
240 * 2 | fix red on 168 * 2 | fix red on
241 * 3 | blink blue on=1 sec and blue off=1 sec 169 * 3 | blink blue on=1 sec and blue off=1 sec
242 * 4 | blink red on=1 sec and red off=1 sec 170 * 4 | blink red on=1 sec and red off=1 sec
243 * 5 | blink blue on=2.5 sec and red on=0.5 sec 171 * 5 | blink blue on=2.5 sec and red on=0.5 sec
244 * 6 | blink blue on=1 sec and red on=1 sec 172 * 6 | blink blue on=1 sec and red on=1 sec
245 * 7 | blink blue on=0.5 sec and blue off=2.5 sec 173 * 7 | fix blue on
246 */ 174 */
247 175
248/***************************************************************************** 176static int netxbig_v2_red_mled[NETXBIG_LED_MODE_NUM] = {
249 * Timer 177 [NETXBIG_LED_OFF] = 0,
250 ****************************************************************************/ 178 [NETXBIG_LED_ON] = 2,
179 [NETXBIG_LED_SATA] = NETXBIG_LED_INVALID_MODE,
180 [NETXBIG_LED_TIMER1] = 4,
181 [NETXBIG_LED_TIMER2] = NETXBIG_LED_INVALID_MODE,
182};
251 183
252static void netxbig_v2_timer_init(void) 184static int netxbig_v2_blue_pwr_mled[NETXBIG_LED_MODE_NUM] = {
253{ 185 [NETXBIG_LED_OFF] = 0,
254 kirkwood_tclk = 166666667; 186 [NETXBIG_LED_ON] = 1,
255 orion_time_init(IRQ_KIRKWOOD_BRIDGE, kirkwood_tclk); 187 [NETXBIG_LED_SATA] = NETXBIG_LED_INVALID_MODE,
256} 188 [NETXBIG_LED_TIMER1] = 3,
189 [NETXBIG_LED_TIMER2] = 7,
190};
191
192static int netxbig_v2_blue_sata_mled[NETXBIG_LED_MODE_NUM] = {
193 [NETXBIG_LED_OFF] = 0,
194 [NETXBIG_LED_ON] = 7,
195 [NETXBIG_LED_SATA] = 1,
196 [NETXBIG_LED_TIMER1] = 3,
197 [NETXBIG_LED_TIMER2] = NETXBIG_LED_INVALID_MODE,
198};
199
200static struct netxbig_led_timer netxbig_v2_led_timer[] = {
201 [0] = {
202 .delay_on = 500,
203 .delay_off = 500,
204 .mode = NETXBIG_LED_TIMER1,
205 },
206 [1] = {
207 .delay_on = 500,
208 .delay_off = 1000,
209 .mode = NETXBIG_LED_TIMER2,
210 },
211};
212
213#define NETXBIG_LED(_name, maddr, mval, baddr) \
214 { .name = _name, \
215 .mode_addr = maddr, \
216 .mode_val = mval, \
217 .bright_addr = baddr }
218
219static struct netxbig_led net2big_v2_leds_ctrl[] = {
220 NETXBIG_LED("net2big-v2:blue:power", 0, netxbig_v2_blue_pwr_mled, 1),
221 NETXBIG_LED("net2big-v2:red:power", 0, netxbig_v2_red_mled, 1),
222 NETXBIG_LED("net2big-v2:blue:sata0", 3, netxbig_v2_blue_sata_mled, 2),
223 NETXBIG_LED("net2big-v2:red:sata0", 3, netxbig_v2_red_mled, 2),
224 NETXBIG_LED("net2big-v2:blue:sata1", 4, netxbig_v2_blue_sata_mled, 2),
225 NETXBIG_LED("net2big-v2:red:sata1", 4, netxbig_v2_red_mled, 2),
226};
227
228static struct netxbig_led_platform_data net2big_v2_leds_data = {
229 .gpio_ext = &netxbig_v2_gpio_ext,
230 .timer = netxbig_v2_led_timer,
231 .num_timer = ARRAY_SIZE(netxbig_v2_led_timer),
232 .leds = net2big_v2_leds_ctrl,
233 .num_leds = ARRAY_SIZE(net2big_v2_leds_ctrl),
234};
235
236static struct netxbig_led net5big_v2_leds_ctrl[] = {
237 NETXBIG_LED("net5big-v2:blue:power", 0, netxbig_v2_blue_pwr_mled, 1),
238 NETXBIG_LED("net5big-v2:red:power", 0, netxbig_v2_red_mled, 1),
239 NETXBIG_LED("net5big-v2:blue:sata0", 3, netxbig_v2_blue_sata_mled, 2),
240 NETXBIG_LED("net5big-v2:red:sata0", 3, netxbig_v2_red_mled, 2),
241 NETXBIG_LED("net5big-v2:blue:sata1", 4, netxbig_v2_blue_sata_mled, 2),
242 NETXBIG_LED("net5big-v2:red:sata1", 4, netxbig_v2_red_mled, 2),
243 NETXBIG_LED("net5big-v2:blue:sata2", 5, netxbig_v2_blue_sata_mled, 2),
244 NETXBIG_LED("net5big-v2:red:sata2", 5, netxbig_v2_red_mled, 2),
245 NETXBIG_LED("net5big-v2:blue:sata3", 6, netxbig_v2_blue_sata_mled, 2),
246 NETXBIG_LED("net5big-v2:red:sata3", 6, netxbig_v2_red_mled, 2),
247 NETXBIG_LED("net5big-v2:blue:sata4", 7, netxbig_v2_blue_sata_mled, 2),
248 NETXBIG_LED("net5big-v2:red:sata5", 7, netxbig_v2_red_mled, 2),
249};
257 250
258struct sys_timer netxbig_v2_timer = { 251static struct netxbig_led_platform_data net5big_v2_leds_data = {
259 .init = netxbig_v2_timer_init, 252 .gpio_ext = &netxbig_v2_gpio_ext,
253 .timer = netxbig_v2_led_timer,
254 .num_timer = ARRAY_SIZE(netxbig_v2_led_timer),
255 .leds = net5big_v2_leds_ctrl,
256 .num_leds = ARRAY_SIZE(net5big_v2_leds_ctrl),
257};
258
259static struct platform_device netxbig_v2_leds = {
260 .name = "leds-netxbig",
261 .id = -1,
262 .dev = {
263 .platform_data = &net2big_v2_leds_data,
264 },
260}; 265};
261 266
262/***************************************************************************** 267/*****************************************************************************
@@ -284,18 +289,18 @@ static unsigned int net2big_v2_mpp_config[] __initdata = {
284 MPP24_GPIO, /* USB mode select */ 289 MPP24_GPIO, /* USB mode select */
285 MPP26_GPIO, /* USB device vbus */ 290 MPP26_GPIO, /* USB device vbus */
286 MPP28_GPIO, /* USB enable host vbus */ 291 MPP28_GPIO, /* USB enable host vbus */
287 MPP29_GPIO, /* CPLD extension ALE */ 292 MPP29_GPIO, /* GPIO extension ALE */
288 MPP34_GPIO, /* Rear Push button */ 293 MPP34_GPIO, /* Rear Push button */
289 MPP35_GPIO, /* Inhibit switch power-off */ 294 MPP35_GPIO, /* Inhibit switch power-off */
290 MPP36_GPIO, /* SATA HDD1 presence */ 295 MPP36_GPIO, /* SATA HDD1 presence */
291 MPP37_GPIO, /* SATA HDD2 presence */ 296 MPP37_GPIO, /* SATA HDD2 presence */
292 MPP40_GPIO, /* eSATA presence */ 297 MPP40_GPIO, /* eSATA presence */
293 MPP44_GPIO, /* CPLD extension (data 0) */ 298 MPP44_GPIO, /* GPIO extension (data 0) */
294 MPP45_GPIO, /* CPLD extension (data 1) */ 299 MPP45_GPIO, /* GPIO extension (data 1) */
295 MPP46_GPIO, /* CPLD extension (data 2) */ 300 MPP46_GPIO, /* GPIO extension (data 2) */
296 MPP47_GPIO, /* CPLD extension (addr 0) */ 301 MPP47_GPIO, /* GPIO extension (addr 0) */
297 MPP48_GPIO, /* CPLD extension (addr 1) */ 302 MPP48_GPIO, /* GPIO extension (addr 1) */
298 MPP49_GPIO, /* CPLD extension (addr 2) */ 303 MPP49_GPIO, /* GPIO extension (addr 2) */
299 0 304 0
300}; 305};
301 306
@@ -324,7 +329,7 @@ static unsigned int net5big_v2_mpp_config[] __initdata = {
324 MPP26_GE1_RXD2, 329 MPP26_GE1_RXD2,
325 MPP27_GE1_RXD3, 330 MPP27_GE1_RXD3,
326 MPP28_GPIO, /* USB enable host vbus */ 331 MPP28_GPIO, /* USB enable host vbus */
327 MPP29_GPIO, /* CPLD extension ALE */ 332 MPP29_GPIO, /* GPIO extension ALE */
328 MPP30_GE1_RXCTL, 333 MPP30_GE1_RXCTL,
329 MPP31_GE1_RXCLK, 334 MPP31_GE1_RXCLK,
330 MPP32_GE1_TCLKOUT, 335 MPP32_GE1_TCLKOUT,
@@ -339,12 +344,12 @@ static unsigned int net5big_v2_mpp_config[] __initdata = {
339 MPP41_GPIO, /* SATA HDD3 power */ 344 MPP41_GPIO, /* SATA HDD3 power */
340 MPP42_GPIO, /* SATA HDD4 power */ 345 MPP42_GPIO, /* SATA HDD4 power */
341 MPP43_GPIO, /* SATA HDD5 power */ 346 MPP43_GPIO, /* SATA HDD5 power */
342 MPP44_GPIO, /* CPLD extension (data 0) */ 347 MPP44_GPIO, /* GPIO extension (data 0) */
343 MPP45_GPIO, /* CPLD extension (data 1) */ 348 MPP45_GPIO, /* GPIO extension (data 1) */
344 MPP46_GPIO, /* CPLD extension (data 2) */ 349 MPP46_GPIO, /* GPIO extension (data 2) */
345 MPP47_GPIO, /* CPLD extension (addr 0) */ 350 MPP47_GPIO, /* GPIO extension (addr 0) */
346 MPP48_GPIO, /* CPLD extension (addr 1) */ 351 MPP48_GPIO, /* GPIO extension (addr 1) */
347 MPP49_GPIO, /* CPLD extension (addr 2) */ 352 MPP49_GPIO, /* GPIO extension (addr 2) */
348 0 353 0
349}; 354};
350 355
@@ -366,7 +371,10 @@ static void __init netxbig_v2_init(void)
366 else 371 else
367 kirkwood_mpp_conf(net5big_v2_mpp_config); 372 kirkwood_mpp_conf(net5big_v2_mpp_config);
368 373
369 netxbig_v2_sata_power_init(); 374 if (machine_is_net2big_v2())
375 lacie_v2_hdd_power_init(2);
376 else
377 lacie_v2_hdd_power_init(5);
370 378
371 kirkwood_ehci_init(); 379 kirkwood_ehci_init();
372 kirkwood_ge00_init(&netxbig_v2_ge00_data); 380 kirkwood_ge00_init(&netxbig_v2_ge00_data);
@@ -374,13 +382,12 @@ static void __init netxbig_v2_init(void)
374 kirkwood_ge01_init(&netxbig_v2_ge01_data); 382 kirkwood_ge01_init(&netxbig_v2_ge01_data);
375 kirkwood_sata_init(&netxbig_v2_sata_data); 383 kirkwood_sata_init(&netxbig_v2_sata_data);
376 kirkwood_uart0_init(); 384 kirkwood_uart0_init();
377 spi_register_board_info(netxbig_v2_spi_slave_info, 385 lacie_v2_register_flash();
378 ARRAY_SIZE(netxbig_v2_spi_slave_info)); 386 lacie_v2_register_i2c_devices();
379 kirkwood_spi_init();
380 kirkwood_i2c_init();
381 i2c_register_board_info(0, netxbig_v2_i2c_info,
382 ARRAY_SIZE(netxbig_v2_i2c_info));
383 387
388 if (machine_is_net5big_v2())
389 netxbig_v2_leds.dev.platform_data = &net5big_v2_leds_data;
390 platform_device_register(&netxbig_v2_leds);
384 platform_device_register(&netxbig_v2_gpio_buttons); 391 platform_device_register(&netxbig_v2_gpio_buttons);
385 392
386 if (gpio_request(NETXBIG_V2_GPIO_POWER_OFF, "power-off") == 0 && 393 if (gpio_request(NETXBIG_V2_GPIO_POWER_OFF, "power-off") == 0 &&
@@ -392,24 +399,22 @@ static void __init netxbig_v2_init(void)
392 399
393#ifdef CONFIG_MACH_NET2BIG_V2 400#ifdef CONFIG_MACH_NET2BIG_V2
394MACHINE_START(NET2BIG_V2, "LaCie 2Big Network v2") 401MACHINE_START(NET2BIG_V2, "LaCie 2Big Network v2")
395 .phys_io = KIRKWOOD_REGS_PHYS_BASE,
396 .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc,
397 .boot_params = 0x00000100, 402 .boot_params = 0x00000100,
398 .init_machine = netxbig_v2_init, 403 .init_machine = netxbig_v2_init,
399 .map_io = kirkwood_map_io, 404 .map_io = kirkwood_map_io,
405 .init_early = kirkwood_init_early,
400 .init_irq = kirkwood_init_irq, 406 .init_irq = kirkwood_init_irq,
401 .timer = &netxbig_v2_timer, 407 .timer = &kirkwood_timer,
402MACHINE_END 408MACHINE_END
403#endif 409#endif
404 410
405#ifdef CONFIG_MACH_NET5BIG_V2 411#ifdef CONFIG_MACH_NET5BIG_V2
406MACHINE_START(NET5BIG_V2, "LaCie 5Big Network v2") 412MACHINE_START(NET5BIG_V2, "LaCie 5Big Network v2")
407 .phys_io = KIRKWOOD_REGS_PHYS_BASE,
408 .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc,
409 .boot_params = 0x00000100, 413 .boot_params = 0x00000100,
410 .init_machine = netxbig_v2_init, 414 .init_machine = netxbig_v2_init,
411 .map_io = kirkwood_map_io, 415 .map_io = kirkwood_map_io,
416 .init_early = kirkwood_init_early,
412 .init_irq = kirkwood_init_irq, 417 .init_irq = kirkwood_init_irq,
413 .timer = &netxbig_v2_timer, 418 .timer = &kirkwood_timer,
414MACHINE_END 419MACHINE_END
415#endif 420#endif
diff --git a/arch/arm/mach-kirkwood/openrd-setup.c b/arch/arm/mach-kirkwood/openrd-setup.c
index fd06be618815..f69beeff4450 100644
--- a/arch/arm/mach-kirkwood/openrd-setup.c
+++ b/arch/arm/mach-kirkwood/openrd-setup.c
@@ -16,6 +16,7 @@
16#include <linux/ata_platform.h> 16#include <linux/ata_platform.h>
17#include <linux/mv643xx_eth.h> 17#include <linux/mv643xx_eth.h>
18#include <linux/i2c.h> 18#include <linux/i2c.h>
19#include <linux/gpio.h>
19#include <asm/mach-types.h> 20#include <asm/mach-types.h>
20#include <asm/mach/arch.h> 21#include <asm/mach/arch.h>
21#include <mach/kirkwood.h> 22#include <mach/kirkwood.h>
@@ -57,7 +58,22 @@ static struct mvsdio_platform_data openrd_mvsdio_data = {
57}; 58};
58 59
59static unsigned int openrd_mpp_config[] __initdata = { 60static unsigned int openrd_mpp_config[] __initdata = {
61 MPP12_SD_CLK,
62 MPP13_SD_CMD,
63 MPP14_SD_D0,
64 MPP15_SD_D1,
65 MPP16_SD_D2,
66 MPP17_SD_D3,
67 MPP28_GPIO,
60 MPP29_GPIO, 68 MPP29_GPIO,
69 MPP34_GPIO,
70 0
71};
72
73/* Configure MPP for UART1 */
74static unsigned int openrd_uart1_mpp_config[] __initdata = {
75 MPP13_UART1_TXD,
76 MPP14_UART1_RXD,
61 0 77 0
62}; 78};
63 79
@@ -67,6 +83,68 @@ static struct i2c_board_info i2c_board_info[] __initdata = {
67 }, 83 },
68}; 84};
69 85
86static int __initdata uart1;
87
88static int __init sd_uart_selection(char *str)
89{
90 uart1 = -EINVAL;
91
92 /* Default is SD. Change if required, for UART */
93 if (!str)
94 return 0;
95
96 if (!strncmp(str, "232", 3)) {
97 uart1 = 232;
98 } else if (!strncmp(str, "485", 3)) {
99 /* OpenRD-Base doesn't have RS485. Treat is as an
100 * unknown argument & just have default setting -
101 * which is SD */
102 if (machine_is_openrd_base()) {
103 uart1 = -ENODEV;
104 return 1;
105 }
106
107 uart1 = 485;
108 }
109 return 1;
110}
111/* Parse boot_command_line string kw_openrd_init_uart1=232/485 */
112__setup("kw_openrd_init_uart1=", sd_uart_selection);
113
114static int __init uart1_mpp_config(void)
115{
116 kirkwood_mpp_conf(openrd_uart1_mpp_config);
117
118 if (gpio_request(34, "SD_UART1_SEL")) {
119 printk(KERN_ERR "GPIO request failed for SD/UART1 selection"
120 ", gpio: 34\n");
121 return -EIO;
122 }
123
124 if (gpio_request(28, "RS232_RS485_SEL")) {
125 printk(KERN_ERR "GPIO request failed for RS232/RS485 selection"
126 ", gpio# 28\n");
127 gpio_free(34);
128 return -EIO;
129 }
130
131 /* Select UART1
132 * Pin # 34: 0 => UART1, 1 => SD */
133 gpio_direction_output(34, 0);
134
135 /* Select RS232 OR RS485
136 * Pin # 28: 0 => RS232, 1 => RS485 */
137 if (uart1 == 232)
138 gpio_direction_output(28, 0);
139 else
140 gpio_direction_output(28, 1);
141
142 gpio_free(34);
143 gpio_free(28);
144
145 return 0;
146}
147
70static void __init openrd_init(void) 148static void __init openrd_init(void)
71{ 149{
72 /* 150 /*
@@ -90,15 +168,36 @@ static void __init openrd_init(void)
90 kirkwood_ge01_init(&openrd_ge01_data); 168 kirkwood_ge01_init(&openrd_ge01_data);
91 169
92 kirkwood_sata_init(&openrd_sata_data); 170 kirkwood_sata_init(&openrd_sata_data);
93 kirkwood_sdio_init(&openrd_mvsdio_data);
94 171
95 kirkwood_i2c_init(); 172 kirkwood_i2c_init();
96 173
97 if (machine_is_openrd_client()) { 174 if (machine_is_openrd_client() || machine_is_openrd_ultimate()) {
98 i2c_register_board_info(0, i2c_board_info, 175 i2c_register_board_info(0, i2c_board_info,
99 ARRAY_SIZE(i2c_board_info)); 176 ARRAY_SIZE(i2c_board_info));
100 kirkwood_audio_init(); 177 kirkwood_audio_init();
101 } 178 }
179
180 if (uart1 <= 0) {
181 if (uart1 < 0)
182 printk(KERN_ERR "Invalid kernel parameter to select "
183 "UART1. Defaulting to SD. ERROR CODE: %d\n",
184 uart1);
185
186 /* Select SD
187 * Pin # 34: 0 => UART1, 1 => SD */
188 if (gpio_request(34, "SD_UART1_SEL")) {
189 printk(KERN_ERR "GPIO request failed for SD/UART1 "
190 "selection, gpio: 34\n");
191 } else {
192
193 gpio_direction_output(34, 1);
194 gpio_free(34);
195 kirkwood_sdio_init(&openrd_mvsdio_data);
196 }
197 } else {
198 if (!uart1_mpp_config())
199 kirkwood_uart1_init();
200 }
102} 201}
103 202
104static int __init openrd_pci_init(void) 203static int __init openrd_pci_init(void)
@@ -115,11 +214,10 @@ subsys_initcall(openrd_pci_init);
115#ifdef CONFIG_MACH_OPENRD_BASE 214#ifdef CONFIG_MACH_OPENRD_BASE
116MACHINE_START(OPENRD_BASE, "Marvell OpenRD Base Board") 215MACHINE_START(OPENRD_BASE, "Marvell OpenRD Base Board")
117 /* Maintainer: Dhaval Vasa <dhaval.vasa@einfochips.com> */ 216 /* Maintainer: Dhaval Vasa <dhaval.vasa@einfochips.com> */
118 .phys_io = KIRKWOOD_REGS_PHYS_BASE,
119 .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc,
120 .boot_params = 0x00000100, 217 .boot_params = 0x00000100,
121 .init_machine = openrd_init, 218 .init_machine = openrd_init,
122 .map_io = kirkwood_map_io, 219 .map_io = kirkwood_map_io,
220 .init_early = kirkwood_init_early,
123 .init_irq = kirkwood_init_irq, 221 .init_irq = kirkwood_init_irq,
124 .timer = &kirkwood_timer, 222 .timer = &kirkwood_timer,
125MACHINE_END 223MACHINE_END
@@ -128,11 +226,10 @@ MACHINE_END
128#ifdef CONFIG_MACH_OPENRD_CLIENT 226#ifdef CONFIG_MACH_OPENRD_CLIENT
129MACHINE_START(OPENRD_CLIENT, "Marvell OpenRD Client Board") 227MACHINE_START(OPENRD_CLIENT, "Marvell OpenRD Client Board")
130 /* Maintainer: Dhaval Vasa <dhaval.vasa@einfochips.com> */ 228 /* Maintainer: Dhaval Vasa <dhaval.vasa@einfochips.com> */
131 .phys_io = KIRKWOOD_REGS_PHYS_BASE,
132 .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc,
133 .boot_params = 0x00000100, 229 .boot_params = 0x00000100,
134 .init_machine = openrd_init, 230 .init_machine = openrd_init,
135 .map_io = kirkwood_map_io, 231 .map_io = kirkwood_map_io,
232 .init_early = kirkwood_init_early,
136 .init_irq = kirkwood_init_irq, 233 .init_irq = kirkwood_init_irq,
137 .timer = &kirkwood_timer, 234 .timer = &kirkwood_timer,
138MACHINE_END 235MACHINE_END
@@ -141,11 +238,10 @@ MACHINE_END
141#ifdef CONFIG_MACH_OPENRD_ULTIMATE 238#ifdef CONFIG_MACH_OPENRD_ULTIMATE
142MACHINE_START(OPENRD_ULTIMATE, "Marvell OpenRD Ultimate Board") 239MACHINE_START(OPENRD_ULTIMATE, "Marvell OpenRD Ultimate Board")
143 /* Maintainer: Dhaval Vasa <dhaval.vasa@einfochips.com> */ 240 /* Maintainer: Dhaval Vasa <dhaval.vasa@einfochips.com> */
144 .phys_io = KIRKWOOD_REGS_PHYS_BASE,
145 .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc,
146 .boot_params = 0x00000100, 241 .boot_params = 0x00000100,
147 .init_machine = openrd_init, 242 .init_machine = openrd_init,
148 .map_io = kirkwood_map_io, 243 .map_io = kirkwood_map_io,
244 .init_early = kirkwood_init_early,
149 .init_irq = kirkwood_init_irq, 245 .init_irq = kirkwood_init_irq,
150 .timer = &kirkwood_timer, 246 .timer = &kirkwood_timer,
151MACHINE_END 247MACHINE_END
diff --git a/arch/arm/mach-kirkwood/pcie.c b/arch/arm/mach-kirkwood/pcie.c
index 513ad3102d7c..ca294ff6d5be 100644
--- a/arch/arm/mach-kirkwood/pcie.c
+++ b/arch/arm/mach-kirkwood/pcie.c
@@ -18,8 +18,16 @@
18#include <mach/bridge-regs.h> 18#include <mach/bridge-regs.h>
19#include "common.h" 19#include "common.h"
20 20
21void kirkwood_enable_pcie(void)
22{
23 u32 curr = readl(CLOCK_GATING_CTRL);
24 if (!(curr & CGC_PEX0))
25 writel(curr | CGC_PEX0, CLOCK_GATING_CTRL);
26}
27
21void __init kirkwood_pcie_id(u32 *dev, u32 *rev) 28void __init kirkwood_pcie_id(u32 *dev, u32 *rev)
22{ 29{
30 kirkwood_enable_pcie();
23 *dev = orion_pcie_dev_id((void __iomem *)PCIE_VIRT_BASE); 31 *dev = orion_pcie_dev_id((void __iomem *)PCIE_VIRT_BASE);
24 *rev = orion_pcie_rev((void __iomem *)PCIE_VIRT_BASE); 32 *rev = orion_pcie_rev((void __iomem *)PCIE_VIRT_BASE);
25} 33}
diff --git a/arch/arm/mach-kirkwood/rd88f6192-nas-setup.c b/arch/arm/mach-kirkwood/rd88f6192-nas-setup.c
index c34718c2cfe5..75c6601b8d87 100644
--- a/arch/arm/mach-kirkwood/rd88f6192-nas-setup.c
+++ b/arch/arm/mach-kirkwood/rd88f6192-nas-setup.c
@@ -79,11 +79,10 @@ subsys_initcall(rd88f6192_pci_init);
79 79
80MACHINE_START(RD88F6192_NAS, "Marvell RD-88F6192-NAS Development Board") 80MACHINE_START(RD88F6192_NAS, "Marvell RD-88F6192-NAS Development Board")
81 /* Maintainer: Saeed Bishara <saeed@marvell.com> */ 81 /* Maintainer: Saeed Bishara <saeed@marvell.com> */
82 .phys_io = KIRKWOOD_REGS_PHYS_BASE,
83 .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc,
84 .boot_params = 0x00000100, 82 .boot_params = 0x00000100,
85 .init_machine = rd88f6192_init, 83 .init_machine = rd88f6192_init,
86 .map_io = kirkwood_map_io, 84 .map_io = kirkwood_map_io,
85 .init_early = kirkwood_init_early,
87 .init_irq = kirkwood_init_irq, 86 .init_irq = kirkwood_init_irq,
88 .timer = &kirkwood_timer, 87 .timer = &kirkwood_timer,
89MACHINE_END 88MACHINE_END
diff --git a/arch/arm/mach-kirkwood/rd88f6281-setup.c b/arch/arm/mach-kirkwood/rd88f6281-setup.c
index 3d1477135e12..0f75494d5902 100644
--- a/arch/arm/mach-kirkwood/rd88f6281-setup.c
+++ b/arch/arm/mach-kirkwood/rd88f6281-setup.c
@@ -115,11 +115,10 @@ subsys_initcall(rd88f6281_pci_init);
115 115
116MACHINE_START(RD88F6281, "Marvell RD-88F6281 Reference Board") 116MACHINE_START(RD88F6281, "Marvell RD-88F6281 Reference Board")
117 /* Maintainer: Saeed Bishara <saeed@marvell.com> */ 117 /* Maintainer: Saeed Bishara <saeed@marvell.com> */
118 .phys_io = KIRKWOOD_REGS_PHYS_BASE,
119 .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc,
120 .boot_params = 0x00000100, 118 .boot_params = 0x00000100,
121 .init_machine = rd88f6281_init, 119 .init_machine = rd88f6281_init,
122 .map_io = kirkwood_map_io, 120 .map_io = kirkwood_map_io,
121 .init_early = kirkwood_init_early,
123 .init_irq = kirkwood_init_irq, 122 .init_irq = kirkwood_init_irq,
124 .timer = &kirkwood_timer, 123 .timer = &kirkwood_timer,
125MACHINE_END 124MACHINE_END
diff --git a/arch/arm/mach-kirkwood/sheevaplug-setup.c b/arch/arm/mach-kirkwood/sheevaplug-setup.c
index a00879d34d54..17de0bf53c08 100644
--- a/arch/arm/mach-kirkwood/sheevaplug-setup.c
+++ b/arch/arm/mach-kirkwood/sheevaplug-setup.c
@@ -58,6 +58,12 @@ static struct mvsdio_platform_data sheeva_esata_mvsdio_data = {
58 58
59static struct gpio_led sheevaplug_led_pins[] = { 59static struct gpio_led sheevaplug_led_pins[] = {
60 { 60 {
61 .name = "plug:red:misc",
62 .default_trigger = "none",
63 .gpio = 46,
64 .active_low = 1,
65 },
66 {
61 .name = "plug:green:health", 67 .name = "plug:green:health",
62 .default_trigger = "default-on", 68 .default_trigger = "default-on",
63 .gpio = 49, 69 .gpio = 49,
@@ -80,6 +86,7 @@ static struct platform_device sheevaplug_leds = {
80 86
81static unsigned int sheevaplug_mpp_config[] __initdata = { 87static unsigned int sheevaplug_mpp_config[] __initdata = {
82 MPP29_GPIO, /* USB Power Enable */ 88 MPP29_GPIO, /* USB Power Enable */
89 MPP46_GPIO, /* LED Red */
83 MPP49_GPIO, /* LED */ 90 MPP49_GPIO, /* LED */
84 0 91 0
85}; 92};
@@ -131,11 +138,10 @@ static void __init sheevaplug_init(void)
131#ifdef CONFIG_MACH_SHEEVAPLUG 138#ifdef CONFIG_MACH_SHEEVAPLUG
132MACHINE_START(SHEEVAPLUG, "Marvell SheevaPlug Reference Board") 139MACHINE_START(SHEEVAPLUG, "Marvell SheevaPlug Reference Board")
133 /* Maintainer: shadi Ammouri <shadi@marvell.com> */ 140 /* Maintainer: shadi Ammouri <shadi@marvell.com> */
134 .phys_io = KIRKWOOD_REGS_PHYS_BASE,
135 .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc,
136 .boot_params = 0x00000100, 141 .boot_params = 0x00000100,
137 .init_machine = sheevaplug_init, 142 .init_machine = sheevaplug_init,
138 .map_io = kirkwood_map_io, 143 .map_io = kirkwood_map_io,
144 .init_early = kirkwood_init_early,
139 .init_irq = kirkwood_init_irq, 145 .init_irq = kirkwood_init_irq,
140 .timer = &kirkwood_timer, 146 .timer = &kirkwood_timer,
141MACHINE_END 147MACHINE_END
@@ -143,11 +149,10 @@ MACHINE_END
143 149
144#ifdef CONFIG_MACH_ESATA_SHEEVAPLUG 150#ifdef CONFIG_MACH_ESATA_SHEEVAPLUG
145MACHINE_START(ESATA_SHEEVAPLUG, "Marvell eSATA SheevaPlug Reference Board") 151MACHINE_START(ESATA_SHEEVAPLUG, "Marvell eSATA SheevaPlug Reference Board")
146 .phys_io = KIRKWOOD_REGS_PHYS_BASE,
147 .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc,
148 .boot_params = 0x00000100, 152 .boot_params = 0x00000100,
149 .init_machine = sheevaplug_init, 153 .init_machine = sheevaplug_init,
150 .map_io = kirkwood_map_io, 154 .map_io = kirkwood_map_io,
155 .init_early = kirkwood_init_early,
151 .init_irq = kirkwood_init_irq, 156 .init_irq = kirkwood_init_irq,
152 .timer = &kirkwood_timer, 157 .timer = &kirkwood_timer,
153MACHINE_END 158MACHINE_END
diff --git a/arch/arm/mach-kirkwood/t5325-setup.c b/arch/arm/mach-kirkwood/t5325-setup.c
index d01bf89cedbe..e6b9b1b22a35 100644
--- a/arch/arm/mach-kirkwood/t5325-setup.c
+++ b/arch/arm/mach-kirkwood/t5325-setup.c
@@ -23,6 +23,7 @@
23#include <linux/gpio.h> 23#include <linux/gpio.h>
24#include <linux/gpio_keys.h> 24#include <linux/gpio_keys.h>
25#include <linux/input.h> 25#include <linux/input.h>
26#include <sound/alc5623.h>
26#include <asm/mach-types.h> 27#include <asm/mach-types.h>
27#include <asm/mach/arch.h> 28#include <asm/mach/arch.h>
28#include <mach/kirkwood.h> 29#include <mach/kirkwood.h>
@@ -134,6 +135,7 @@ static unsigned int hp_t5325_mpp_config[] __initdata = {
134 MPP33_GE1_TXCTL, 135 MPP33_GE1_TXCTL,
135 MPP39_AU_I2SBCLK, 136 MPP39_AU_I2SBCLK,
136 MPP40_AU_I2SDO, 137 MPP40_AU_I2SDO,
138 MPP43_AU_I2SDI,
137 MPP41_AU_I2SLRCLK, 139 MPP41_AU_I2SLRCLK,
138 MPP42_AU_I2SMCLK, 140 MPP42_AU_I2SMCLK,
139 MPP45_GPIO, /* Power button */ 141 MPP45_GPIO, /* Power button */
@@ -141,6 +143,18 @@ static unsigned int hp_t5325_mpp_config[] __initdata = {
141 0 143 0
142}; 144};
143 145
146static struct alc5623_platform_data alc5621_data = {
147 .add_ctrl = 0x3700,
148 .jack_det_ctrl = 0x4810,
149};
150
151static struct i2c_board_info i2c_board_info[] __initdata = {
152 {
153 I2C_BOARD_INFO("alc5621", 0x1a),
154 .platform_data = &alc5621_data,
155 },
156};
157
144#define HP_T5325_GPIO_POWER_OFF 48 158#define HP_T5325_GPIO_POWER_OFF 48
145 159
146static void hp_t5325_power_off(void) 160static void hp_t5325_power_off(void)
@@ -166,6 +180,9 @@ static void __init hp_t5325_init(void)
166 kirkwood_ehci_init(); 180 kirkwood_ehci_init();
167 platform_device_register(&hp_t5325_button_device); 181 platform_device_register(&hp_t5325_button_device);
168 182
183 i2c_register_board_info(0, i2c_board_info, ARRAY_SIZE(i2c_board_info));
184 kirkwood_audio_init();
185
169 if (gpio_request(HP_T5325_GPIO_POWER_OFF, "power-off") == 0 && 186 if (gpio_request(HP_T5325_GPIO_POWER_OFF, "power-off") == 0 &&
170 gpio_direction_output(HP_T5325_GPIO_POWER_OFF, 0) == 0) 187 gpio_direction_output(HP_T5325_GPIO_POWER_OFF, 0) == 0)
171 pm_power_off = hp_t5325_power_off; 188 pm_power_off = hp_t5325_power_off;
@@ -184,11 +201,10 @@ subsys_initcall(hp_t5325_pci_init);
184 201
185MACHINE_START(T5325, "HP t5325 Thin Client") 202MACHINE_START(T5325, "HP t5325 Thin Client")
186 /* Maintainer: Martin Michlmayr <tbm@cyrius.com> */ 203 /* Maintainer: Martin Michlmayr <tbm@cyrius.com> */
187 .phys_io = KIRKWOOD_REGS_PHYS_BASE,
188 .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc,
189 .boot_params = 0x00000100, 204 .boot_params = 0x00000100,
190 .init_machine = hp_t5325_init, 205 .init_machine = hp_t5325_init,
191 .map_io = kirkwood_map_io, 206 .map_io = kirkwood_map_io,
207 .init_early = kirkwood_init_early,
192 .init_irq = kirkwood_init_irq, 208 .init_irq = kirkwood_init_irq,
193 .timer = &kirkwood_timer, 209 .timer = &kirkwood_timer,
194MACHINE_END 210MACHINE_END
diff --git a/arch/arm/mach-kirkwood/ts219-setup.c b/arch/arm/mach-kirkwood/ts219-setup.c
index a5bd7fde04a9..68f32f2bf552 100644
--- a/arch/arm/mach-kirkwood/ts219-setup.c
+++ b/arch/arm/mach-kirkwood/ts219-setup.c
@@ -80,15 +80,19 @@ static unsigned int qnap_ts219_mpp_config[] __initdata = {
80 MPP11_UART0_RXD, 80 MPP11_UART0_RXD,
81 MPP13_UART1_TXD, /* PIC controller */ 81 MPP13_UART1_TXD, /* PIC controller */
82 MPP14_UART1_RXD, /* PIC controller */ 82 MPP14_UART1_RXD, /* PIC controller */
83 MPP15_GPIO, /* USB Copy button */ 83 MPP15_GPIO, /* USB Copy button (on devices with 88F6281) */
84 MPP16_GPIO, /* Reset button */ 84 MPP16_GPIO, /* Reset button (on devices with 88F6281) */
85 MPP36_GPIO, /* RAM: 0: 256 MB, 1: 512 MB */ 85 MPP36_GPIO, /* RAM: 0: 256 MB, 1: 512 MB */
86 MPP37_GPIO, /* Reset button (on devices with 88F6282) */
87 MPP43_GPIO, /* USB Copy button (on devices with 88F6282) */
86 MPP44_GPIO, /* Board ID: 0: TS-11x, 1: TS-21x */ 88 MPP44_GPIO, /* Board ID: 0: TS-11x, 1: TS-21x */
87 0 89 0
88}; 90};
89 91
90static void __init qnap_ts219_init(void) 92static void __init qnap_ts219_init(void)
91{ 93{
94 u32 dev, rev;
95
92 /* 96 /*
93 * Basic setup. Needs to be called early. 97 * Basic setup. Needs to be called early.
94 */ 98 */
@@ -100,6 +104,14 @@ static void __init qnap_ts219_init(void)
100 qnap_tsx1x_register_flash(); 104 qnap_tsx1x_register_flash();
101 kirkwood_i2c_init(); 105 kirkwood_i2c_init();
102 i2c_register_board_info(0, &qnap_ts219_i2c_rtc, 1); 106 i2c_register_board_info(0, &qnap_ts219_i2c_rtc, 1);
107
108 kirkwood_pcie_id(&dev, &rev);
109 if (dev == MV88F6282_DEV_ID) {
110 qnap_ts219_buttons[0].gpio = 43; /* USB Copy button */
111 qnap_ts219_buttons[1].gpio = 37; /* Reset button */
112 qnap_ts219_ge00_data.phy_addr = MV643XX_ETH_PHY_ADDR(0);
113 }
114
103 kirkwood_ge00_init(&qnap_ts219_ge00_data); 115 kirkwood_ge00_init(&qnap_ts219_ge00_data);
104 kirkwood_sata_init(&qnap_ts219_sata_data); 116 kirkwood_sata_init(&qnap_ts219_sata_data);
105 kirkwood_ehci_init(); 117 kirkwood_ehci_init();
@@ -120,11 +132,10 @@ subsys_initcall(ts219_pci_init);
120 132
121MACHINE_START(TS219, "QNAP TS-119/TS-219") 133MACHINE_START(TS219, "QNAP TS-119/TS-219")
122 /* Maintainer: Martin Michlmayr <tbm@cyrius.com> */ 134 /* Maintainer: Martin Michlmayr <tbm@cyrius.com> */
123 .phys_io = KIRKWOOD_REGS_PHYS_BASE,
124 .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc,
125 .boot_params = 0x00000100, 135 .boot_params = 0x00000100,
126 .init_machine = qnap_ts219_init, 136 .init_machine = qnap_ts219_init,
127 .map_io = kirkwood_map_io, 137 .map_io = kirkwood_map_io,
138 .init_early = kirkwood_init_early,
128 .init_irq = kirkwood_init_irq, 139 .init_irq = kirkwood_init_irq,
129 .timer = &kirkwood_timer, 140 .timer = &kirkwood_timer,
130MACHINE_END 141MACHINE_END
diff --git a/arch/arm/mach-kirkwood/ts41x-setup.c b/arch/arm/mach-kirkwood/ts41x-setup.c
index 2e14afef07a2..d5d009970705 100644
--- a/arch/arm/mach-kirkwood/ts41x-setup.c
+++ b/arch/arm/mach-kirkwood/ts41x-setup.c
@@ -27,6 +27,10 @@
27#include "mpp.h" 27#include "mpp.h"
28#include "tsx1x-common.h" 28#include "tsx1x-common.h"
29 29
30/* for the PCIe reset workaround */
31#include <plat/pcie.h>
32
33
30#define QNAP_TS41X_JUMPER_JP1 45 34#define QNAP_TS41X_JUMPER_JP1 45
31 35
32static struct i2c_board_info __initdata qnap_ts41x_i2c_rtc = { 36static struct i2c_board_info __initdata qnap_ts41x_i2c_rtc = {
@@ -115,6 +119,8 @@ static unsigned int qnap_ts41x_mpp_config[] __initdata = {
115 119
116static void __init qnap_ts41x_init(void) 120static void __init qnap_ts41x_init(void)
117{ 121{
122 u32 dev, rev;
123
118 /* 124 /*
119 * Basic setup. Needs to be called early. 125 * Basic setup. Needs to be called early.
120 */ 126 */
@@ -126,8 +132,15 @@ static void __init qnap_ts41x_init(void)
126 qnap_tsx1x_register_flash(); 132 qnap_tsx1x_register_flash();
127 kirkwood_i2c_init(); 133 kirkwood_i2c_init();
128 i2c_register_board_info(0, &qnap_ts41x_i2c_rtc, 1); 134 i2c_register_board_info(0, &qnap_ts41x_i2c_rtc, 1);
135
136 kirkwood_pcie_id(&dev, &rev);
137 if (dev == MV88F6282_DEV_ID) {
138 qnap_ts41x_ge00_data.phy_addr = MV643XX_ETH_PHY_ADDR(0);
139 qnap_ts41x_ge01_data.phy_addr = MV643XX_ETH_PHY_ADDR(1);
140 }
129 kirkwood_ge00_init(&qnap_ts41x_ge00_data); 141 kirkwood_ge00_init(&qnap_ts41x_ge00_data);
130 kirkwood_ge01_init(&qnap_ts41x_ge01_data); 142 kirkwood_ge01_init(&qnap_ts41x_ge01_data);
143
131 kirkwood_sata_init(&qnap_ts41x_sata_data); 144 kirkwood_sata_init(&qnap_ts41x_sata_data);
132 kirkwood_ehci_init(); 145 kirkwood_ehci_init();
133 platform_device_register(&qnap_ts41x_button_device); 146 platform_device_register(&qnap_ts41x_button_device);
@@ -140,8 +153,22 @@ static void __init qnap_ts41x_init(void)
140 153
141static int __init ts41x_pci_init(void) 154static int __init ts41x_pci_init(void)
142{ 155{
143 if (machine_is_ts41x()) 156 if (machine_is_ts41x()) {
144 kirkwood_pcie_init(KW_PCIE0); 157 u32 dev, rev;
158
159 /*
160 * Without this explicit reset, the PCIe SATA controller
161 * (Marvell 88sx7042/sata_mv) is known to stop working
162 * after a few minutes.
163 */
164 orion_pcie_reset((void __iomem *)PCIE_VIRT_BASE);
165
166 kirkwood_pcie_id(&dev, &rev);
167 if (dev == MV88F6282_DEV_ID)
168 kirkwood_pcie_init(KW_PCIE1 | KW_PCIE0);
169 else
170 kirkwood_pcie_init(KW_PCIE0);
171 }
145 172
146 return 0; 173 return 0;
147} 174}
@@ -149,11 +176,10 @@ subsys_initcall(ts41x_pci_init);
149 176
150MACHINE_START(TS41X, "QNAP TS-41x") 177MACHINE_START(TS41X, "QNAP TS-41x")
151 /* Maintainer: Martin Michlmayr <tbm@cyrius.com> */ 178 /* Maintainer: Martin Michlmayr <tbm@cyrius.com> */
152 .phys_io = KIRKWOOD_REGS_PHYS_BASE,
153 .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc,
154 .boot_params = 0x00000100, 179 .boot_params = 0x00000100,
155 .init_machine = qnap_ts41x_init, 180 .init_machine = qnap_ts41x_init,
156 .map_io = kirkwood_map_io, 181 .map_io = kirkwood_map_io,
182 .init_early = kirkwood_init_early,
157 .init_irq = kirkwood_init_irq, 183 .init_irq = kirkwood_init_irq,
158 .timer = &kirkwood_timer, 184 .timer = &kirkwood_timer,
159MACHINE_END 185MACHINE_END
diff --git a/arch/arm/mach-kirkwood/tsx1x-common.c b/arch/arm/mach-kirkwood/tsx1x-common.c
index f781164e623f..24294b2bc469 100644
--- a/arch/arm/mach-kirkwood/tsx1x-common.c
+++ b/arch/arm/mach-kirkwood/tsx1x-common.c
@@ -15,7 +15,7 @@
15 15
16/**************************************************************************** 16/****************************************************************************
17 * 16 MiB NOR flash. The struct mtd_partition is not in the same order as the 17 * 16 MiB NOR flash. The struct mtd_partition is not in the same order as the
18 * partitions on the device because we want to keep compatability with 18 * partitions on the device because we want to keep compatibility with
19 * the QNAP firmware. 19 * the QNAP firmware.
20 * Layout as used by QNAP: 20 * Layout as used by QNAP:
21 * 0x00000000-0x00080000 : "U-Boot" 21 * 0x00000000-0x00080000 : "U-Boot"