blob: d2dee431635a12d68909be0a7f54192ee6c1eb66 [file] [log] [blame]
Lennert Buytenhek9dd0b192008-03-27 14:51:41 -04001/*
2 * arch/arm/mach-orion5x/common.c
3 *
4 * Core functions for Marvell Orion 5x SoCs
5 *
6 * Maintainer: Tzachi Perelstein <tzachi@marvell.com>
7 *
8 * This file is licensed under the terms of the GNU General Public
9 * License version 2. This program is licensed "as is" without any
10 * warranty of any kind, whether express or implied.
11 */
12
13#include <linux/kernel.h>
14#include <linux/init.h>
15#include <linux/platform_device.h>
16#include <linux/serial_8250.h>
17#include <linux/mbus.h>
Lennert Buytenhek9dd0b192008-03-27 14:51:41 -040018#include <linux/mv643xx_i2c.h>
19#include <linux/ata_platform.h>
Lennert Buytenhekdcf1cec2008-09-25 16:23:48 +020020#include <net/dsa.h>
Lennert Buytenhek9dd0b192008-03-27 14:51:41 -040021#include <asm/page.h>
22#include <asm/setup.h>
23#include <asm/timex.h>
24#include <asm/mach/arch.h>
25#include <asm/mach/map.h>
26#include <asm/mach/time.h>
Lennert Buytenhek4ee1f6b2010-10-15 16:50:26 +020027#include <mach/bridge-regs.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010028#include <mach/hardware.h>
29#include <mach/orion5x.h>
Lennert Buytenhek6f088f12008-08-09 13:44:58 +020030#include <plat/ehci-orion.h>
Saeed Bishara1d5a1a62008-06-16 23:25:12 -110031#include <plat/mv_xor.h>
Lennert Buytenhek6f088f12008-08-09 13:44:58 +020032#include <plat/orion_nand.h>
Nicolas Pitre3b937a72009-06-01 13:56:02 -040033#include <plat/orion_wdt.h>
Lennert Buytenhek6f088f12008-08-09 13:44:58 +020034#include <plat/time.h>
Andrew Lunn28a2b452011-05-15 13:32:41 +020035#include <plat/common.h>
Lennert Buytenhek9dd0b192008-03-27 14:51:41 -040036#include "common.h"
37
38/*****************************************************************************
39 * I/O Address Mapping
40 ****************************************************************************/
41static struct map_desc orion5x_io_desc[] __initdata = {
42 {
43 .virtual = ORION5X_REGS_VIRT_BASE,
44 .pfn = __phys_to_pfn(ORION5X_REGS_PHYS_BASE),
45 .length = ORION5X_REGS_SIZE,
Lennert Buytenheke7068ad2008-05-10 16:30:01 +020046 .type = MT_DEVICE,
47 }, {
Lennert Buytenhek9dd0b192008-03-27 14:51:41 -040048 .virtual = ORION5X_PCIE_IO_VIRT_BASE,
49 .pfn = __phys_to_pfn(ORION5X_PCIE_IO_PHYS_BASE),
50 .length = ORION5X_PCIE_IO_SIZE,
Lennert Buytenheke7068ad2008-05-10 16:30:01 +020051 .type = MT_DEVICE,
52 }, {
Lennert Buytenhek9dd0b192008-03-27 14:51:41 -040053 .virtual = ORION5X_PCI_IO_VIRT_BASE,
54 .pfn = __phys_to_pfn(ORION5X_PCI_IO_PHYS_BASE),
55 .length = ORION5X_PCI_IO_SIZE,
Lennert Buytenheke7068ad2008-05-10 16:30:01 +020056 .type = MT_DEVICE,
57 }, {
Lennert Buytenhek9dd0b192008-03-27 14:51:41 -040058 .virtual = ORION5X_PCIE_WA_VIRT_BASE,
59 .pfn = __phys_to_pfn(ORION5X_PCIE_WA_PHYS_BASE),
60 .length = ORION5X_PCIE_WA_SIZE,
Lennert Buytenheke7068ad2008-05-10 16:30:01 +020061 .type = MT_DEVICE,
Lennert Buytenhek9dd0b192008-03-27 14:51:41 -040062 },
63};
64
65void __init orion5x_map_io(void)
66{
67 iotable_init(orion5x_io_desc, ARRAY_SIZE(orion5x_io_desc));
68}
69
Lennert Buytenhek044f6c72008-04-22 05:37:12 +020070
Lennert Buytenhek9dd0b192008-03-27 14:51:41 -040071/*****************************************************************************
Lennert Buytenhek044f6c72008-04-22 05:37:12 +020072 * EHCI
Lennert Buytenhek9dd0b192008-03-27 14:51:41 -040073 ****************************************************************************/
Lennert Buytenhek044f6c72008-04-22 05:37:12 +020074static struct orion_ehci_data orion5x_ehci_data = {
75 .dram = &orion5x_mbus_dram_info,
Ronen Shitritfb6f5522008-09-17 10:08:05 +030076 .phy_version = EHCI_PHY_ORION,
Lennert Buytenhek9dd0b192008-03-27 14:51:41 -040077};
78
Andrew Lunn5c602552011-05-15 13:32:40 +020079static u64 ehci_dmamask = DMA_BIT_MASK(32);
Lennert Buytenhek9dd0b192008-03-27 14:51:41 -040080
Lennert Buytenhek9dd0b192008-03-27 14:51:41 -040081
Lennert Buytenhek044f6c72008-04-22 05:37:12 +020082/*****************************************************************************
83 * EHCI0
84 ****************************************************************************/
Lennert Buytenhek9dd0b192008-03-27 14:51:41 -040085static struct resource orion5x_ehci0_resources[] = {
86 {
87 .start = ORION5X_USB0_PHYS_BASE,
Lennert Buytenhek994cab82008-04-25 16:30:21 -040088 .end = ORION5X_USB0_PHYS_BASE + SZ_4K - 1,
Lennert Buytenhek9dd0b192008-03-27 14:51:41 -040089 .flags = IORESOURCE_MEM,
Lennert Buytenheke7068ad2008-05-10 16:30:01 +020090 }, {
Lennert Buytenhek9dd0b192008-03-27 14:51:41 -040091 .start = IRQ_ORION5X_USB0_CTRL,
92 .end = IRQ_ORION5X_USB0_CTRL,
93 .flags = IORESOURCE_IRQ,
94 },
95};
96
Lennert Buytenhek9dd0b192008-03-27 14:51:41 -040097static struct platform_device orion5x_ehci0 = {
98 .name = "orion-ehci",
99 .id = 0,
100 .dev = {
101 .dma_mask = &ehci_dmamask,
Andrew Lunn5c602552011-05-15 13:32:40 +0200102 .coherent_dma_mask = DMA_BIT_MASK(32),
Lennert Buytenhek9dd0b192008-03-27 14:51:41 -0400103 .platform_data = &orion5x_ehci_data,
104 },
105 .resource = orion5x_ehci0_resources,
106 .num_resources = ARRAY_SIZE(orion5x_ehci0_resources),
107};
108
Lennert Buytenhek044f6c72008-04-22 05:37:12 +0200109void __init orion5x_ehci0_init(void)
110{
111 platform_device_register(&orion5x_ehci0);
112}
113
114
115/*****************************************************************************
116 * EHCI1
117 ****************************************************************************/
118static struct resource orion5x_ehci1_resources[] = {
119 {
120 .start = ORION5X_USB1_PHYS_BASE,
121 .end = ORION5X_USB1_PHYS_BASE + SZ_4K - 1,
122 .flags = IORESOURCE_MEM,
123 }, {
124 .start = IRQ_ORION5X_USB1_CTRL,
125 .end = IRQ_ORION5X_USB1_CTRL,
126 .flags = IORESOURCE_IRQ,
127 },
128};
129
Lennert Buytenhek9dd0b192008-03-27 14:51:41 -0400130static struct platform_device orion5x_ehci1 = {
131 .name = "orion-ehci",
132 .id = 1,
133 .dev = {
134 .dma_mask = &ehci_dmamask,
Andrew Lunn5c602552011-05-15 13:32:40 +0200135 .coherent_dma_mask = DMA_BIT_MASK(32),
Lennert Buytenhek9dd0b192008-03-27 14:51:41 -0400136 .platform_data = &orion5x_ehci_data,
137 },
138 .resource = orion5x_ehci1_resources,
139 .num_resources = ARRAY_SIZE(orion5x_ehci1_resources),
140};
141
Lennert Buytenhek044f6c72008-04-22 05:37:12 +0200142void __init orion5x_ehci1_init(void)
143{
144 platform_device_register(&orion5x_ehci1);
145}
Lennert Buytenhek9dd0b192008-03-27 14:51:41 -0400146
Lennert Buytenhek044f6c72008-04-22 05:37:12 +0200147
148/*****************************************************************************
Andrew Lunn5c602552011-05-15 13:32:40 +0200149 * GE00
Lennert Buytenhek044f6c72008-04-22 05:37:12 +0200150 ****************************************************************************/
Lennert Buytenhek9dd0b192008-03-27 14:51:41 -0400151void __init orion5x_eth_init(struct mv643xx_eth_platform_data *eth_data)
152{
Andrew Lunn7e3819d2011-05-15 13:32:44 +0200153 orion_ge00_init(eth_data, &orion5x_mbus_dram_info,
154 ORION5X_ETH_PHYS_BASE, IRQ_ORION5X_ETH_SUM,
155 IRQ_ORION5X_ETH_ERR, orion5x_tclk);
Lennert Buytenhek9dd0b192008-03-27 14:51:41 -0400156}
157
Lennert Buytenhek9dd0b192008-03-27 14:51:41 -0400158
Lennert Buytenhek044f6c72008-04-22 05:37:12 +0200159/*****************************************************************************
Lennert Buytenhekdcf1cec2008-09-25 16:23:48 +0200160 * Ethernet switch
161 ****************************************************************************/
Lennert Buytenhekdcf1cec2008-09-25 16:23:48 +0200162void __init orion5x_eth_switch_init(struct dsa_platform_data *d, int irq)
163{
Andrew Lunn7e3819d2011-05-15 13:32:44 +0200164 orion_ge00_switch_init(d, irq);
Lennert Buytenhekdcf1cec2008-09-25 16:23:48 +0200165}
166
167
168/*****************************************************************************
Lennert Buytenhek044f6c72008-04-22 05:37:12 +0200169 * I2C
170 ****************************************************************************/
Lennert Buytenhek044f6c72008-04-22 05:37:12 +0200171void __init orion5x_i2c_init(void)
172{
Andrew Lunnaac7ffa2011-05-15 13:32:45 +0200173 orion_i2c_init(I2C_PHYS_BASE, IRQ_ORION5X_I2C, 8);
174
Lennert Buytenhek044f6c72008-04-22 05:37:12 +0200175}
176
177
Lennert Buytenhek9dd0b192008-03-27 14:51:41 -0400178/*****************************************************************************
Lennert Buytenhek044f6c72008-04-22 05:37:12 +0200179 * SATA
Lennert Buytenhek9dd0b192008-03-27 14:51:41 -0400180 ****************************************************************************/
181static struct resource orion5x_sata_resources[] = {
Lennert Buytenhek9dd0b192008-03-27 14:51:41 -0400182 {
Lennert Buytenheke7068ad2008-05-10 16:30:01 +0200183 .name = "sata base",
184 .start = ORION5X_SATA_PHYS_BASE,
185 .end = ORION5X_SATA_PHYS_BASE + 0x5000 - 1,
186 .flags = IORESOURCE_MEM,
187 }, {
188 .name = "sata irq",
189 .start = IRQ_ORION5X_SATA,
190 .end = IRQ_ORION5X_SATA,
191 .flags = IORESOURCE_IRQ,
192 },
Lennert Buytenhek9dd0b192008-03-27 14:51:41 -0400193};
194
195static struct platform_device orion5x_sata = {
Lennert Buytenheke7068ad2008-05-10 16:30:01 +0200196 .name = "sata_mv",
197 .id = 0,
Lennert Buytenhek9dd0b192008-03-27 14:51:41 -0400198 .dev = {
Andrew Lunn5c602552011-05-15 13:32:40 +0200199 .coherent_dma_mask = DMA_BIT_MASK(32),
Lennert Buytenhek9dd0b192008-03-27 14:51:41 -0400200 },
Lennert Buytenheke7068ad2008-05-10 16:30:01 +0200201 .num_resources = ARRAY_SIZE(orion5x_sata_resources),
202 .resource = orion5x_sata_resources,
Lennert Buytenhek9dd0b192008-03-27 14:51:41 -0400203};
204
205void __init orion5x_sata_init(struct mv_sata_platform_data *sata_data)
206{
207 sata_data->dram = &orion5x_mbus_dram_info;
208 orion5x_sata.dev.platform_data = sata_data;
209 platform_device_register(&orion5x_sata);
210}
211
Lennert Buytenhek044f6c72008-04-22 05:37:12 +0200212
213/*****************************************************************************
Lennert Buytenhekd323ade2008-08-29 06:55:06 +0200214 * SPI
215 ****************************************************************************/
Lennert Buytenhekd323ade2008-08-29 06:55:06 +0200216void __init orion5x_spi_init()
217{
Andrew Lunn980f9f62011-05-15 13:32:46 +0200218 orion_spi_init(SPI_PHYS_BASE, orion5x_tclk);
Lennert Buytenhekd323ade2008-08-29 06:55:06 +0200219}
220
221
222/*****************************************************************************
Lennert Buytenhek044f6c72008-04-22 05:37:12 +0200223 * UART0
224 ****************************************************************************/
Lennert Buytenhek044f6c72008-04-22 05:37:12 +0200225void __init orion5x_uart0_init(void)
226{
Andrew Lunn28a2b452011-05-15 13:32:41 +0200227 orion_uart0_init(UART0_VIRT_BASE, UART0_PHYS_BASE,
228 IRQ_ORION5X_UART0, orion5x_tclk);
Lennert Buytenhek044f6c72008-04-22 05:37:12 +0200229}
230
Lennert Buytenhek044f6c72008-04-22 05:37:12 +0200231/*****************************************************************************
232 * UART1
233 ****************************************************************************/
Lennert Buytenhek044f6c72008-04-22 05:37:12 +0200234void __init orion5x_uart1_init(void)
235{
Andrew Lunn28a2b452011-05-15 13:32:41 +0200236 orion_uart1_init(UART1_VIRT_BASE, UART1_PHYS_BASE,
237 IRQ_ORION5X_UART1, orion5x_tclk);
Lennert Buytenhek044f6c72008-04-22 05:37:12 +0200238}
239
Lennert Buytenhek9dd0b192008-03-27 14:51:41 -0400240/*****************************************************************************
Saeed Bishara1d5a1a62008-06-16 23:25:12 -1100241 * XOR engine
242 ****************************************************************************/
Saeed Bisharaf45964e2009-03-02 17:30:36 +0200243struct mv_xor_platform_shared_data orion5x_xor_shared_data = {
244 .dram = &orion5x_mbus_dram_info,
245};
246
Saeed Bishara1d5a1a62008-06-16 23:25:12 -1100247static struct resource orion5x_xor_shared_resources[] = {
248 {
249 .name = "xor low",
250 .start = ORION5X_XOR_PHYS_BASE,
251 .end = ORION5X_XOR_PHYS_BASE + 0xff,
252 .flags = IORESOURCE_MEM,
253 }, {
254 .name = "xor high",
255 .start = ORION5X_XOR_PHYS_BASE + 0x200,
256 .end = ORION5X_XOR_PHYS_BASE + 0x2ff,
257 .flags = IORESOURCE_MEM,
258 },
259};
260
261static struct platform_device orion5x_xor_shared = {
262 .name = MV_XOR_SHARED_NAME,
263 .id = 0,
Saeed Bisharaf45964e2009-03-02 17:30:36 +0200264 .dev = {
265 .platform_data = &orion5x_xor_shared_data,
266 },
Saeed Bishara1d5a1a62008-06-16 23:25:12 -1100267 .num_resources = ARRAY_SIZE(orion5x_xor_shared_resources),
268 .resource = orion5x_xor_shared_resources,
269};
270
Yang Hongyang284901a2009-04-06 19:01:15 -0700271static u64 orion5x_xor_dmamask = DMA_BIT_MASK(32);
Saeed Bishara1d5a1a62008-06-16 23:25:12 -1100272
273static struct resource orion5x_xor0_resources[] = {
274 [0] = {
275 .start = IRQ_ORION5X_XOR0,
276 .end = IRQ_ORION5X_XOR0,
277 .flags = IORESOURCE_IRQ,
278 },
279};
280
281static struct mv_xor_platform_data orion5x_xor0_data = {
282 .shared = &orion5x_xor_shared,
283 .hw_id = 0,
284 .pool_size = PAGE_SIZE,
285};
286
287static struct platform_device orion5x_xor0_channel = {
288 .name = MV_XOR_NAME,
289 .id = 0,
290 .num_resources = ARRAY_SIZE(orion5x_xor0_resources),
291 .resource = orion5x_xor0_resources,
292 .dev = {
293 .dma_mask = &orion5x_xor_dmamask,
Yang Hongyang6a355282009-04-06 19:01:13 -0700294 .coherent_dma_mask = DMA_BIT_MASK(64),
H Hartley Sweetenef4a6772010-01-29 14:56:58 -0800295 .platform_data = &orion5x_xor0_data,
Saeed Bishara1d5a1a62008-06-16 23:25:12 -1100296 },
297};
298
299static struct resource orion5x_xor1_resources[] = {
300 [0] = {
301 .start = IRQ_ORION5X_XOR1,
302 .end = IRQ_ORION5X_XOR1,
303 .flags = IORESOURCE_IRQ,
304 },
305};
306
307static struct mv_xor_platform_data orion5x_xor1_data = {
308 .shared = &orion5x_xor_shared,
309 .hw_id = 1,
310 .pool_size = PAGE_SIZE,
311};
312
313static struct platform_device orion5x_xor1_channel = {
314 .name = MV_XOR_NAME,
315 .id = 1,
316 .num_resources = ARRAY_SIZE(orion5x_xor1_resources),
317 .resource = orion5x_xor1_resources,
318 .dev = {
319 .dma_mask = &orion5x_xor_dmamask,
Yang Hongyang6a355282009-04-06 19:01:13 -0700320 .coherent_dma_mask = DMA_BIT_MASK(64),
H Hartley Sweetenef4a6772010-01-29 14:56:58 -0800321 .platform_data = &orion5x_xor1_data,
Saeed Bishara1d5a1a62008-06-16 23:25:12 -1100322 },
323};
324
325void __init orion5x_xor_init(void)
326{
327 platform_device_register(&orion5x_xor_shared);
328
329 /*
330 * two engines can't do memset simultaneously, this limitation
331 * satisfied by removing memset support from one of the engines.
332 */
333 dma_cap_set(DMA_MEMCPY, orion5x_xor0_data.cap_mask);
334 dma_cap_set(DMA_XOR, orion5x_xor0_data.cap_mask);
335 platform_device_register(&orion5x_xor0_channel);
336
337 dma_cap_set(DMA_MEMCPY, orion5x_xor1_data.cap_mask);
338 dma_cap_set(DMA_MEMSET, orion5x_xor1_data.cap_mask);
339 dma_cap_set(DMA_XOR, orion5x_xor1_data.cap_mask);
340 platform_device_register(&orion5x_xor1_channel);
341}
342
Sebastian Andrzej Siewior3a8f7442009-05-07 22:59:24 +0200343static struct resource orion5x_crypto_res[] = {
344 {
345 .name = "regs",
346 .start = ORION5X_CRYPTO_PHYS_BASE,
347 .end = ORION5X_CRYPTO_PHYS_BASE + 0xffff,
348 .flags = IORESOURCE_MEM,
349 }, {
350 .name = "sram",
351 .start = ORION5X_SRAM_PHYS_BASE,
352 .end = ORION5X_SRAM_PHYS_BASE + SZ_8K - 1,
353 .flags = IORESOURCE_MEM,
354 }, {
355 .name = "crypto interrupt",
356 .start = IRQ_ORION5X_CESA,
357 .end = IRQ_ORION5X_CESA,
358 .flags = IORESOURCE_IRQ,
359 },
360};
361
362static struct platform_device orion5x_crypto_device = {
363 .name = "mv_crypto",
364 .id = -1,
365 .num_resources = ARRAY_SIZE(orion5x_crypto_res),
366 .resource = orion5x_crypto_res,
367};
368
Nicolas Pitre3fade492009-06-11 22:27:20 +0200369static int __init orion5x_crypto_init(void)
Sebastian Andrzej Siewior3a8f7442009-05-07 22:59:24 +0200370{
371 int ret;
372
373 ret = orion5x_setup_sram_win();
374 if (ret)
375 return ret;
376
377 return platform_device_register(&orion5x_crypto_device);
378}
Saeed Bishara1d5a1a62008-06-16 23:25:12 -1100379
380/*****************************************************************************
Thomas Reitmayr9e058d42009-02-24 14:59:22 -0800381 * Watchdog
382 ****************************************************************************/
Nicolas Pitre3b937a72009-06-01 13:56:02 -0400383static struct orion_wdt_platform_data orion5x_wdt_data = {
Thomas Reitmayr9e058d42009-02-24 14:59:22 -0800384 .tclk = 0,
385};
386
387static struct platform_device orion5x_wdt_device = {
Nicolas Pitre3b937a72009-06-01 13:56:02 -0400388 .name = "orion_wdt",
Thomas Reitmayr9e058d42009-02-24 14:59:22 -0800389 .id = -1,
390 .dev = {
391 .platform_data = &orion5x_wdt_data,
392 },
393 .num_resources = 0,
394};
395
396void __init orion5x_wdt_init(void)
397{
398 orion5x_wdt_data.tclk = orion5x_tclk;
399 platform_device_register(&orion5x_wdt_device);
400}
401
402
403/*****************************************************************************
Lennert Buytenhek9dd0b192008-03-27 14:51:41 -0400404 * Time handling
405 ****************************************************************************/
Lennert Buytenhek4ee1f6b2010-10-15 16:50:26 +0200406void __init orion5x_init_early(void)
407{
408 orion_time_set_base(TIMER_VIRT_BASE);
409}
410
Lennert Buytenhekebe35af2008-08-29 05:55:51 +0200411int orion5x_tclk;
412
413int __init orion5x_find_tclk(void)
414{
Lennert Buytenhekd323ade2008-08-29 06:55:06 +0200415 u32 dev, rev;
416
417 orion5x_pcie_id(&dev, &rev);
418 if (dev == MV88F6183_DEV_ID &&
419 (readl(MPP_RESET_SAMPLE) & 0x00000200) == 0)
420 return 133333333;
421
Lennert Buytenhekebe35af2008-08-29 05:55:51 +0200422 return 166666667;
423}
424
Lennert Buytenhek9dd0b192008-03-27 14:51:41 -0400425static void orion5x_timer_init(void)
426{
Lennert Buytenhekebe35af2008-08-29 05:55:51 +0200427 orion5x_tclk = orion5x_find_tclk();
Lennert Buytenhek4ee1f6b2010-10-15 16:50:26 +0200428
429 orion_time_init(ORION5X_BRIDGE_VIRT_BASE, BRIDGE_INT_TIMER1_CLR,
430 IRQ_ORION5X_BRIDGE, orion5x_tclk);
Lennert Buytenhek9dd0b192008-03-27 14:51:41 -0400431}
432
433struct sys_timer orion5x_timer = {
Lennert Buytenheke7068ad2008-05-10 16:30:01 +0200434 .init = orion5x_timer_init,
Lennert Buytenhek9dd0b192008-03-27 14:51:41 -0400435};
436
Lennert Buytenhek044f6c72008-04-22 05:37:12 +0200437
Lennert Buytenhek9dd0b192008-03-27 14:51:41 -0400438/*****************************************************************************
439 * General
440 ****************************************************************************/
Lennert Buytenhek9dd0b192008-03-27 14:51:41 -0400441/*
Lennert Buytenhekb46926b2008-04-25 16:31:32 -0400442 * Identify device ID and rev from PCIe configuration header space '0'.
Lennert Buytenhek9dd0b192008-03-27 14:51:41 -0400443 */
444static void __init orion5x_id(u32 *dev, u32 *rev, char **dev_name)
445{
446 orion5x_pcie_id(dev, rev);
447
448 if (*dev == MV88F5281_DEV_ID) {
449 if (*rev == MV88F5281_REV_D2) {
450 *dev_name = "MV88F5281-D2";
451 } else if (*rev == MV88F5281_REV_D1) {
452 *dev_name = "MV88F5281-D1";
Lennert Buytenhekce72e36e2008-08-09 15:17:27 +0200453 } else if (*rev == MV88F5281_REV_D0) {
454 *dev_name = "MV88F5281-D0";
Lennert Buytenhek9dd0b192008-03-27 14:51:41 -0400455 } else {
456 *dev_name = "MV88F5281-Rev-Unsupported";
457 }
458 } else if (*dev == MV88F5182_DEV_ID) {
459 if (*rev == MV88F5182_REV_A2) {
460 *dev_name = "MV88F5182-A2";
461 } else {
462 *dev_name = "MV88F5182-Rev-Unsupported";
463 }
464 } else if (*dev == MV88F5181_DEV_ID) {
465 if (*rev == MV88F5181_REV_B1) {
466 *dev_name = "MV88F5181-Rev-B1";
Lennert Buytenhekd2b2a6b2008-05-31 08:30:40 +0200467 } else if (*rev == MV88F5181L_REV_A1) {
468 *dev_name = "MV88F5181L-Rev-A1";
Lennert Buytenhek9dd0b192008-03-27 14:51:41 -0400469 } else {
Lennert Buytenhekd2b2a6b2008-05-31 08:30:40 +0200470 *dev_name = "MV88F5181(L)-Rev-Unsupported";
Lennert Buytenhek9dd0b192008-03-27 14:51:41 -0400471 }
Lennert Buytenhekd323ade2008-08-29 06:55:06 +0200472 } else if (*dev == MV88F6183_DEV_ID) {
473 if (*rev == MV88F6183_REV_B0) {
474 *dev_name = "MV88F6183-Rev-B0";
475 } else {
476 *dev_name = "MV88F6183-Rev-Unsupported";
477 }
Lennert Buytenhek9dd0b192008-03-27 14:51:41 -0400478 } else {
479 *dev_name = "Device-Unknown";
480 }
481}
482
483void __init orion5x_init(void)
484{
485 char *dev_name;
486 u32 dev, rev;
487
488 orion5x_id(&dev, &rev, &dev_name);
Lennert Buytenhekebe35af2008-08-29 05:55:51 +0200489 printk(KERN_INFO "Orion ID: %s. TCLK=%d.\n", dev_name, orion5x_tclk);
490
Lennert Buytenhek9dd0b192008-03-27 14:51:41 -0400491 /*
492 * Setup Orion address map
493 */
494 orion5x_setup_cpu_mbus_bridge();
Lennert Buytenhekce72e36e2008-08-09 15:17:27 +0200495
496 /*
497 * Don't issue "Wait for Interrupt" instruction if we are
498 * running on D0 5281 silicon.
499 */
500 if (dev == MV88F5281_DEV_ID && rev == MV88F5281_REV_D0) {
501 printk(KERN_INFO "Orion: Applying 5281 D0 WFI workaround.\n");
502 disable_hlt();
503 }
Thomas Reitmayr9e058d42009-02-24 14:59:22 -0800504
505 /*
Nicolas Pitre3fade492009-06-11 22:27:20 +0200506 * The 5082/5181l/5182/6082/6082l/6183 have crypto
507 * while 5180n/5181/5281 don't have crypto.
508 */
509 if ((dev == MV88F5181_DEV_ID && rev >= MV88F5181L_REV_A0) ||
510 dev == MV88F5182_DEV_ID || dev == MV88F6183_DEV_ID)
511 orion5x_crypto_init();
512
513 /*
Thomas Reitmayr9e058d42009-02-24 14:59:22 -0800514 * Register watchdog driver
515 */
516 orion5x_wdt_init();
Lennert Buytenhek9dd0b192008-03-27 14:51:41 -0400517}
518
519/*
520 * Many orion-based systems have buggy bootloader implementations.
521 * This is a common fixup for bogus memory tags.
522 */
523void __init tag_fixup_mem32(struct machine_desc *mdesc, struct tag *t,
524 char **from, struct meminfo *meminfo)
525{
526 for (; t->hdr.size; t = tag_next(t))
527 if (t->hdr.tag == ATAG_MEM &&
528 (!t->u.mem.size || t->u.mem.size & ~PAGE_MASK ||
529 t->u.mem.start & ~PAGE_MASK)) {
530 printk(KERN_WARNING
531 "Clearing invalid memory bank %dKB@0x%08x\n",
532 t->u.mem.size / 1024, t->u.mem.start);
533 t->hdr.tag = 0;
534 }
535}