]> bbs.cooldavid.org Git - net-next-2.6.git/blame - arch/arm/mach-orion5x/common.c
dma-mapping: replace all DMA_64BIT_MASK macro with DMA_BIT_MASK(64)
[net-next-2.6.git] / arch / arm / mach-orion5x / common.c
CommitLineData
585cf175 1/*
9dd0b194 2 * arch/arm/mach-orion5x/common.c
585cf175 3 *
9dd0b194 4 * Core functions for Marvell Orion 5x SoCs
585cf175
TP
5 *
6 * Maintainer: Tzachi Perelstein <tzachi@marvell.com>
7 *
159ffb3a
LB
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
585cf175
TP
10 * warranty of any kind, whether express or implied.
11 */
12
13#include <linux/kernel.h>
14#include <linux/init.h>
ca26f7d3
TP
15#include <linux/platform_device.h>
16#include <linux/serial_8250.h>
83b6d822 17#include <linux/mbus.h>
e07c9d85 18#include <linux/mv643xx_eth.h>
144aa3db 19#include <linux/mv643xx_i2c.h>
15a32632 20#include <linux/ata_platform.h>
d323ade1 21#include <linux/spi/orion_spi.h>
dcf1cece 22#include <net/dsa.h>
585cf175 23#include <asm/page.h>
be73a347 24#include <asm/setup.h>
c67de5b3 25#include <asm/timex.h>
be73a347 26#include <asm/mach/arch.h>
585cf175 27#include <asm/mach/map.h>
2bac1de2 28#include <asm/mach/time.h>
a09e64fb
RK
29#include <mach/hardware.h>
30#include <mach/orion5x.h>
6f088f1d 31#include <plat/ehci-orion.h>
1d5a1a6e 32#include <plat/mv_xor.h>
6f088f1d 33#include <plat/orion_nand.h>
9e058d4f 34#include <plat/orion5x_wdt.h>
6f088f1d 35#include <plat/time.h>
585cf175
TP
36#include "common.h"
37
38/*****************************************************************************
39 * I/O Address Mapping
40 ****************************************************************************/
9dd0b194 41static struct map_desc orion5x_io_desc[] __initdata = {
585cf175 42 {
9dd0b194
LB
43 .virtual = ORION5X_REGS_VIRT_BASE,
44 .pfn = __phys_to_pfn(ORION5X_REGS_PHYS_BASE),
45 .length = ORION5X_REGS_SIZE,
e7068ad3
LB
46 .type = MT_DEVICE,
47 }, {
9dd0b194
LB
48 .virtual = ORION5X_PCIE_IO_VIRT_BASE,
49 .pfn = __phys_to_pfn(ORION5X_PCIE_IO_PHYS_BASE),
50 .length = ORION5X_PCIE_IO_SIZE,
e7068ad3
LB
51 .type = MT_DEVICE,
52 }, {
9dd0b194
LB
53 .virtual = ORION5X_PCI_IO_VIRT_BASE,
54 .pfn = __phys_to_pfn(ORION5X_PCI_IO_PHYS_BASE),
55 .length = ORION5X_PCI_IO_SIZE,
e7068ad3
LB
56 .type = MT_DEVICE,
57 }, {
9dd0b194
LB
58 .virtual = ORION5X_PCIE_WA_VIRT_BASE,
59 .pfn = __phys_to_pfn(ORION5X_PCIE_WA_PHYS_BASE),
60 .length = ORION5X_PCIE_WA_SIZE,
e7068ad3 61 .type = MT_DEVICE,
585cf175
TP
62 },
63};
64
9dd0b194 65void __init orion5x_map_io(void)
585cf175 66{
9dd0b194 67 iotable_init(orion5x_io_desc, ARRAY_SIZE(orion5x_io_desc));
585cf175 68}
c67de5b3 69
044f6c7c 70
ca26f7d3 71/*****************************************************************************
044f6c7c 72 * EHCI
ca26f7d3 73 ****************************************************************************/
044f6c7c
LB
74static struct orion_ehci_data orion5x_ehci_data = {
75 .dram = &orion5x_mbus_dram_info,
fb6f5529 76 .phy_version = EHCI_PHY_ORION,
ca26f7d3
TP
77};
78
044f6c7c 79static u64 ehci_dmamask = 0xffffffffUL;
ca26f7d3 80
ca26f7d3 81
044f6c7c
LB
82/*****************************************************************************
83 * EHCI0
84 ****************************************************************************/
9dd0b194 85static struct resource orion5x_ehci0_resources[] = {
ca26f7d3 86 {
9dd0b194 87 .start = ORION5X_USB0_PHYS_BASE,
994cab84 88 .end = ORION5X_USB0_PHYS_BASE + SZ_4K - 1,
ca26f7d3 89 .flags = IORESOURCE_MEM,
e7068ad3 90 }, {
9dd0b194
LB
91 .start = IRQ_ORION5X_USB0_CTRL,
92 .end = IRQ_ORION5X_USB0_CTRL,
ca26f7d3
TP
93 .flags = IORESOURCE_IRQ,
94 },
95};
96
9dd0b194 97static struct platform_device orion5x_ehci0 = {
ca26f7d3
TP
98 .name = "orion-ehci",
99 .id = 0,
100 .dev = {
101 .dma_mask = &ehci_dmamask,
102 .coherent_dma_mask = 0xffffffff,
9dd0b194 103 .platform_data = &orion5x_ehci_data,
ca26f7d3 104 },
9dd0b194
LB
105 .resource = orion5x_ehci0_resources,
106 .num_resources = ARRAY_SIZE(orion5x_ehci0_resources),
ca26f7d3
TP
107};
108
044f6c7c
LB
109void __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
9dd0b194 130static struct platform_device orion5x_ehci1 = {
ca26f7d3
TP
131 .name = "orion-ehci",
132 .id = 1,
133 .dev = {
134 .dma_mask = &ehci_dmamask,
135 .coherent_dma_mask = 0xffffffff,
9dd0b194 136 .platform_data = &orion5x_ehci_data,
ca26f7d3 137 },
9dd0b194
LB
138 .resource = orion5x_ehci1_resources,
139 .num_resources = ARRAY_SIZE(orion5x_ehci1_resources),
ca26f7d3
TP
140};
141
044f6c7c
LB
142void __init orion5x_ehci1_init(void)
143{
144 platform_device_register(&orion5x_ehci1);
145}
146
147
e07c9d85 148/*****************************************************************************
044f6c7c 149 * GigE
e07c9d85 150 ****************************************************************************/
d236f5a5
LB
151struct mv643xx_eth_shared_platform_data orion5x_eth_shared_data = {
152 .dram = &orion5x_mbus_dram_info,
153};
154
9dd0b194 155static struct resource orion5x_eth_shared_resources[] = {
e07c9d85 156 {
9dd0b194
LB
157 .start = ORION5X_ETH_PHYS_BASE + 0x2000,
158 .end = ORION5X_ETH_PHYS_BASE + 0x3fff,
e07c9d85 159 .flags = IORESOURCE_MEM,
eeff6d86
LB
160 }, {
161 .start = IRQ_ORION5X_ETH_ERR,
162 .end = IRQ_ORION5X_ETH_ERR,
163 .flags = IORESOURCE_IRQ,
e07c9d85
TP
164 },
165};
166
9dd0b194 167static struct platform_device orion5x_eth_shared = {
e07c9d85
TP
168 .name = MV643XX_ETH_SHARED_NAME,
169 .id = 0,
d236f5a5
LB
170 .dev = {
171 .platform_data = &orion5x_eth_shared_data,
172 },
eeff6d86 173 .num_resources = ARRAY_SIZE(orion5x_eth_shared_resources),
9dd0b194 174 .resource = orion5x_eth_shared_resources,
e07c9d85
TP
175};
176
9dd0b194 177static struct resource orion5x_eth_resources[] = {
e07c9d85
TP
178 {
179 .name = "eth irq",
9dd0b194
LB
180 .start = IRQ_ORION5X_ETH_SUM,
181 .end = IRQ_ORION5X_ETH_SUM,
e07c9d85 182 .flags = IORESOURCE_IRQ,
e7068ad3 183 },
e07c9d85
TP
184};
185
9dd0b194 186static struct platform_device orion5x_eth = {
e07c9d85
TP
187 .name = MV643XX_ETH_NAME,
188 .id = 0,
189 .num_resources = 1,
9dd0b194 190 .resource = orion5x_eth_resources,
e07c9d85
TP
191};
192
9dd0b194 193void __init orion5x_eth_init(struct mv643xx_eth_platform_data *eth_data)
e07c9d85 194{
fa3959f4 195 eth_data->shared = &orion5x_eth_shared;
9dd0b194 196 orion5x_eth.dev.platform_data = eth_data;
fa3959f4 197
9dd0b194
LB
198 platform_device_register(&orion5x_eth_shared);
199 platform_device_register(&orion5x_eth);
e07c9d85
TP
200}
201
044f6c7c 202
dcf1cece
LB
203/*****************************************************************************
204 * Ethernet switch
205 ****************************************************************************/
206static struct resource orion5x_switch_resources[] = {
207 {
208 .start = 0,
209 .end = 0,
210 .flags = IORESOURCE_IRQ,
211 },
212};
213
214static struct platform_device orion5x_switch_device = {
215 .name = "dsa",
216 .id = 0,
217 .num_resources = 0,
218 .resource = orion5x_switch_resources,
219};
220
221void __init orion5x_eth_switch_init(struct dsa_platform_data *d, int irq)
222{
e84665c9
LB
223 int i;
224
dcf1cece
LB
225 if (irq != NO_IRQ) {
226 orion5x_switch_resources[0].start = irq;
227 orion5x_switch_resources[0].end = irq;
228 orion5x_switch_device.num_resources = 1;
229 }
230
dcf1cece 231 d->netdev = &orion5x_eth.dev;
e84665c9
LB
232 for (i = 0; i < d->nr_chips; i++)
233 d->chip[i].mii_bus = &orion5x_eth_shared.dev;
dcf1cece
LB
234 orion5x_switch_device.dev.platform_data = d;
235
236 platform_device_register(&orion5x_switch_device);
237}
238
239
144aa3db 240/*****************************************************************************
044f6c7c 241 * I2C
144aa3db 242 ****************************************************************************/
9dd0b194 243static struct mv64xxx_i2c_pdata orion5x_i2c_pdata = {
144aa3db
HVR
244 .freq_m = 8, /* assumes 166 MHz TCLK */
245 .freq_n = 3,
246 .timeout = 1000, /* Default timeout of 1 second */
247};
248
9dd0b194 249static struct resource orion5x_i2c_resources[] = {
144aa3db 250 {
e7068ad3
LB
251 .name = "i2c base",
252 .start = I2C_PHYS_BASE,
044f6c7c 253 .end = I2C_PHYS_BASE + 0x1f,
e7068ad3
LB
254 .flags = IORESOURCE_MEM,
255 }, {
256 .name = "i2c irq",
257 .start = IRQ_ORION5X_I2C,
258 .end = IRQ_ORION5X_I2C,
259 .flags = IORESOURCE_IRQ,
144aa3db
HVR
260 },
261};
262
9dd0b194 263static struct platform_device orion5x_i2c = {
144aa3db
HVR
264 .name = MV64XXX_I2C_CTLR_NAME,
265 .id = 0,
9dd0b194
LB
266 .num_resources = ARRAY_SIZE(orion5x_i2c_resources),
267 .resource = orion5x_i2c_resources,
144aa3db 268 .dev = {
e7068ad3 269 .platform_data = &orion5x_i2c_pdata,
144aa3db
HVR
270 },
271};
272
044f6c7c
LB
273void __init orion5x_i2c_init(void)
274{
275 platform_device_register(&orion5x_i2c);
276}
277
278
f244baa3 279/*****************************************************************************
044f6c7c 280 * SATA
f244baa3 281 ****************************************************************************/
9dd0b194 282static struct resource orion5x_sata_resources[] = {
f244baa3 283 {
e7068ad3
LB
284 .name = "sata base",
285 .start = ORION5X_SATA_PHYS_BASE,
286 .end = ORION5X_SATA_PHYS_BASE + 0x5000 - 1,
287 .flags = IORESOURCE_MEM,
288 }, {
289 .name = "sata irq",
290 .start = IRQ_ORION5X_SATA,
291 .end = IRQ_ORION5X_SATA,
292 .flags = IORESOURCE_IRQ,
293 },
f244baa3
SB
294};
295
9dd0b194 296static struct platform_device orion5x_sata = {
e7068ad3
LB
297 .name = "sata_mv",
298 .id = 0,
f244baa3
SB
299 .dev = {
300 .coherent_dma_mask = 0xffffffff,
301 },
e7068ad3
LB
302 .num_resources = ARRAY_SIZE(orion5x_sata_resources),
303 .resource = orion5x_sata_resources,
f244baa3
SB
304};
305
9dd0b194 306void __init orion5x_sata_init(struct mv_sata_platform_data *sata_data)
f244baa3 307{
9dd0b194
LB
308 sata_data->dram = &orion5x_mbus_dram_info;
309 orion5x_sata.dev.platform_data = sata_data;
310 platform_device_register(&orion5x_sata);
f244baa3
SB
311}
312
044f6c7c 313
d323ade1
LB
314/*****************************************************************************
315 * SPI
316 ****************************************************************************/
317static struct orion_spi_info orion5x_spi_plat_data = {
c0e19363
NP
318 .tclk = 0,
319 .enable_clock_fix = 1,
d323ade1
LB
320};
321
322static struct resource orion5x_spi_resources[] = {
323 {
324 .name = "spi base",
325 .start = SPI_PHYS_BASE,
326 .end = SPI_PHYS_BASE + 0x1f,
327 .flags = IORESOURCE_MEM,
328 },
329};
330
331static struct platform_device orion5x_spi = {
332 .name = "orion_spi",
333 .id = 0,
334 .dev = {
335 .platform_data = &orion5x_spi_plat_data,
336 },
337 .num_resources = ARRAY_SIZE(orion5x_spi_resources),
338 .resource = orion5x_spi_resources,
339};
340
341void __init orion5x_spi_init()
342{
343 platform_device_register(&orion5x_spi);
344}
345
346
2bac1de2 347/*****************************************************************************
044f6c7c
LB
348 * UART0
349 ****************************************************************************/
350static struct plat_serial8250_port orion5x_uart0_data[] = {
351 {
352 .mapbase = UART0_PHYS_BASE,
353 .membase = (char *)UART0_VIRT_BASE,
354 .irq = IRQ_ORION5X_UART0,
355 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
356 .iotype = UPIO_MEM,
357 .regshift = 2,
ebe35aff 358 .uartclk = 0,
044f6c7c
LB
359 }, {
360 },
361};
362
363static struct resource orion5x_uart0_resources[] = {
364 {
365 .start = UART0_PHYS_BASE,
366 .end = UART0_PHYS_BASE + 0xff,
367 .flags = IORESOURCE_MEM,
368 }, {
369 .start = IRQ_ORION5X_UART0,
370 .end = IRQ_ORION5X_UART0,
371 .flags = IORESOURCE_IRQ,
372 },
373};
374
375static struct platform_device orion5x_uart0 = {
376 .name = "serial8250",
377 .id = PLAT8250_DEV_PLATFORM,
378 .dev = {
379 .platform_data = orion5x_uart0_data,
380 },
381 .resource = orion5x_uart0_resources,
382 .num_resources = ARRAY_SIZE(orion5x_uart0_resources),
383};
384
385void __init orion5x_uart0_init(void)
386{
387 platform_device_register(&orion5x_uart0);
388}
389
390
391/*****************************************************************************
392 * UART1
2bac1de2 393 ****************************************************************************/
044f6c7c
LB
394static struct plat_serial8250_port orion5x_uart1_data[] = {
395 {
396 .mapbase = UART1_PHYS_BASE,
397 .membase = (char *)UART1_VIRT_BASE,
398 .irq = IRQ_ORION5X_UART1,
399 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
400 .iotype = UPIO_MEM,
401 .regshift = 2,
ebe35aff 402 .uartclk = 0,
044f6c7c
LB
403 }, {
404 },
405};
406
407static struct resource orion5x_uart1_resources[] = {
408 {
409 .start = UART1_PHYS_BASE,
410 .end = UART1_PHYS_BASE + 0xff,
411 .flags = IORESOURCE_MEM,
412 }, {
413 .start = IRQ_ORION5X_UART1,
414 .end = IRQ_ORION5X_UART1,
415 .flags = IORESOURCE_IRQ,
416 },
417};
418
419static struct platform_device orion5x_uart1 = {
420 .name = "serial8250",
421 .id = PLAT8250_DEV_PLATFORM1,
422 .dev = {
423 .platform_data = orion5x_uart1_data,
424 },
425 .resource = orion5x_uart1_resources,
426 .num_resources = ARRAY_SIZE(orion5x_uart1_resources),
427};
428
429void __init orion5x_uart1_init(void)
430{
431 platform_device_register(&orion5x_uart1);
432}
2bac1de2 433
044f6c7c 434
1d5a1a6e
SB
435/*****************************************************************************
436 * XOR engine
437 ****************************************************************************/
f45964ed
SB
438struct mv_xor_platform_shared_data orion5x_xor_shared_data = {
439 .dram = &orion5x_mbus_dram_info,
440};
441
1d5a1a6e
SB
442static struct resource orion5x_xor_shared_resources[] = {
443 {
444 .name = "xor low",
445 .start = ORION5X_XOR_PHYS_BASE,
446 .end = ORION5X_XOR_PHYS_BASE + 0xff,
447 .flags = IORESOURCE_MEM,
448 }, {
449 .name = "xor high",
450 .start = ORION5X_XOR_PHYS_BASE + 0x200,
451 .end = ORION5X_XOR_PHYS_BASE + 0x2ff,
452 .flags = IORESOURCE_MEM,
453 },
454};
455
456static struct platform_device orion5x_xor_shared = {
457 .name = MV_XOR_SHARED_NAME,
458 .id = 0,
f45964ed
SB
459 .dev = {
460 .platform_data = &orion5x_xor_shared_data,
461 },
1d5a1a6e
SB
462 .num_resources = ARRAY_SIZE(orion5x_xor_shared_resources),
463 .resource = orion5x_xor_shared_resources,
464};
465
466static u64 orion5x_xor_dmamask = DMA_32BIT_MASK;
467
468static struct resource orion5x_xor0_resources[] = {
469 [0] = {
470 .start = IRQ_ORION5X_XOR0,
471 .end = IRQ_ORION5X_XOR0,
472 .flags = IORESOURCE_IRQ,
473 },
474};
475
476static struct mv_xor_platform_data orion5x_xor0_data = {
477 .shared = &orion5x_xor_shared,
478 .hw_id = 0,
479 .pool_size = PAGE_SIZE,
480};
481
482static struct platform_device orion5x_xor0_channel = {
483 .name = MV_XOR_NAME,
484 .id = 0,
485 .num_resources = ARRAY_SIZE(orion5x_xor0_resources),
486 .resource = orion5x_xor0_resources,
487 .dev = {
488 .dma_mask = &orion5x_xor_dmamask,
6a35528a 489 .coherent_dma_mask = DMA_BIT_MASK(64),
1d5a1a6e
SB
490 .platform_data = (void *)&orion5x_xor0_data,
491 },
492};
493
494static struct resource orion5x_xor1_resources[] = {
495 [0] = {
496 .start = IRQ_ORION5X_XOR1,
497 .end = IRQ_ORION5X_XOR1,
498 .flags = IORESOURCE_IRQ,
499 },
500};
501
502static struct mv_xor_platform_data orion5x_xor1_data = {
503 .shared = &orion5x_xor_shared,
504 .hw_id = 1,
505 .pool_size = PAGE_SIZE,
506};
507
508static struct platform_device orion5x_xor1_channel = {
509 .name = MV_XOR_NAME,
510 .id = 1,
511 .num_resources = ARRAY_SIZE(orion5x_xor1_resources),
512 .resource = orion5x_xor1_resources,
513 .dev = {
514 .dma_mask = &orion5x_xor_dmamask,
6a35528a 515 .coherent_dma_mask = DMA_BIT_MASK(64),
1d5a1a6e
SB
516 .platform_data = (void *)&orion5x_xor1_data,
517 },
518};
519
520void __init orion5x_xor_init(void)
521{
522 platform_device_register(&orion5x_xor_shared);
523
524 /*
525 * two engines can't do memset simultaneously, this limitation
526 * satisfied by removing memset support from one of the engines.
527 */
528 dma_cap_set(DMA_MEMCPY, orion5x_xor0_data.cap_mask);
529 dma_cap_set(DMA_XOR, orion5x_xor0_data.cap_mask);
530 platform_device_register(&orion5x_xor0_channel);
531
532 dma_cap_set(DMA_MEMCPY, orion5x_xor1_data.cap_mask);
533 dma_cap_set(DMA_MEMSET, orion5x_xor1_data.cap_mask);
534 dma_cap_set(DMA_XOR, orion5x_xor1_data.cap_mask);
535 platform_device_register(&orion5x_xor1_channel);
536}
537
538
9e058d4f
TR
539/*****************************************************************************
540 * Watchdog
541 ****************************************************************************/
542static struct orion5x_wdt_platform_data orion5x_wdt_data = {
543 .tclk = 0,
544};
545
546static struct platform_device orion5x_wdt_device = {
547 .name = "orion5x_wdt",
548 .id = -1,
549 .dev = {
550 .platform_data = &orion5x_wdt_data,
551 },
552 .num_resources = 0,
553};
554
555void __init orion5x_wdt_init(void)
556{
557 orion5x_wdt_data.tclk = orion5x_tclk;
558 platform_device_register(&orion5x_wdt_device);
559}
560
561
044f6c7c
LB
562/*****************************************************************************
563 * Time handling
564 ****************************************************************************/
ebe35aff
LB
565int orion5x_tclk;
566
567int __init orion5x_find_tclk(void)
568{
d323ade1
LB
569 u32 dev, rev;
570
571 orion5x_pcie_id(&dev, &rev);
572 if (dev == MV88F6183_DEV_ID &&
573 (readl(MPP_RESET_SAMPLE) & 0x00000200) == 0)
574 return 133333333;
575
ebe35aff
LB
576 return 166666667;
577}
578
9dd0b194 579static void orion5x_timer_init(void)
2bac1de2 580{
ebe35aff
LB
581 orion5x_tclk = orion5x_find_tclk();
582 orion_time_init(IRQ_ORION5X_BRIDGE, orion5x_tclk);
2bac1de2
LB
583}
584
9dd0b194 585struct sys_timer orion5x_timer = {
e7068ad3 586 .init = orion5x_timer_init,
2bac1de2
LB
587};
588
044f6c7c 589
c67de5b3
TP
590/*****************************************************************************
591 * General
592 ****************************************************************************/
c67de5b3 593/*
b46926bb 594 * Identify device ID and rev from PCIe configuration header space '0'.
c67de5b3 595 */
9dd0b194 596static void __init orion5x_id(u32 *dev, u32 *rev, char **dev_name)
c67de5b3 597{
9dd0b194 598 orion5x_pcie_id(dev, rev);
c67de5b3
TP
599
600 if (*dev == MV88F5281_DEV_ID) {
601 if (*rev == MV88F5281_REV_D2) {
602 *dev_name = "MV88F5281-D2";
603 } else if (*rev == MV88F5281_REV_D1) {
604 *dev_name = "MV88F5281-D1";
ce72e36e
LB
605 } else if (*rev == MV88F5281_REV_D0) {
606 *dev_name = "MV88F5281-D0";
c67de5b3
TP
607 } else {
608 *dev_name = "MV88F5281-Rev-Unsupported";
609 }
610 } else if (*dev == MV88F5182_DEV_ID) {
611 if (*rev == MV88F5182_REV_A2) {
612 *dev_name = "MV88F5182-A2";
613 } else {
614 *dev_name = "MV88F5182-Rev-Unsupported";
615 }
c9e3de94
HVR
616 } else if (*dev == MV88F5181_DEV_ID) {
617 if (*rev == MV88F5181_REV_B1) {
618 *dev_name = "MV88F5181-Rev-B1";
d2b2a6bb
LB
619 } else if (*rev == MV88F5181L_REV_A1) {
620 *dev_name = "MV88F5181L-Rev-A1";
c9e3de94 621 } else {
d2b2a6bb 622 *dev_name = "MV88F5181(L)-Rev-Unsupported";
c9e3de94 623 }
d323ade1
LB
624 } else if (*dev == MV88F6183_DEV_ID) {
625 if (*rev == MV88F6183_REV_B0) {
626 *dev_name = "MV88F6183-Rev-B0";
627 } else {
628 *dev_name = "MV88F6183-Rev-Unsupported";
629 }
c67de5b3
TP
630 } else {
631 *dev_name = "Device-Unknown";
632 }
633}
634
9dd0b194 635void __init orion5x_init(void)
c67de5b3
TP
636{
637 char *dev_name;
638 u32 dev, rev;
639
9dd0b194 640 orion5x_id(&dev, &rev, &dev_name);
ebe35aff
LB
641 printk(KERN_INFO "Orion ID: %s. TCLK=%d.\n", dev_name, orion5x_tclk);
642
643 orion5x_eth_shared_data.t_clk = orion5x_tclk;
d323ade1 644 orion5x_spi_plat_data.tclk = orion5x_tclk;
ebe35aff
LB
645 orion5x_uart0_data[0].uartclk = orion5x_tclk;
646 orion5x_uart1_data[0].uartclk = orion5x_tclk;
c67de5b3
TP
647
648 /*
649 * Setup Orion address map
650 */
9dd0b194 651 orion5x_setup_cpu_mbus_bridge();
ce72e36e
LB
652
653 /*
654 * Don't issue "Wait for Interrupt" instruction if we are
655 * running on D0 5281 silicon.
656 */
657 if (dev == MV88F5281_DEV_ID && rev == MV88F5281_REV_D0) {
658 printk(KERN_INFO "Orion: Applying 5281 D0 WFI workaround.\n");
659 disable_hlt();
660 }
9e058d4f
TR
661
662 /*
663 * Register watchdog driver
664 */
665 orion5x_wdt_init();
c67de5b3 666}
be73a347
GL
667
668/*
669 * Many orion-based systems have buggy bootloader implementations.
670 * This is a common fixup for bogus memory tags.
671 */
672void __init tag_fixup_mem32(struct machine_desc *mdesc, struct tag *t,
673 char **from, struct meminfo *meminfo)
674{
675 for (; t->hdr.size; t = tag_next(t))
676 if (t->hdr.tag == ATAG_MEM &&
677 (!t->u.mem.size || t->u.mem.size & ~PAGE_MASK ||
678 t->u.mem.start & ~PAGE_MASK)) {
679 printk(KERN_WARNING
680 "Clearing invalid memory bank %dKB@0x%08x\n",
681 t->u.mem.size / 1024, t->u.mem.start);
682 t->hdr.tag = 0;
683 }
684}