]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - arch/arm/mach-kirkwood/common.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6
[linux-2.6-omap-h63xx.git] / arch / arm / mach-kirkwood / common.c
1 /*
2  * arch/arm/mach-kirkwood/common.c
3  *
4  * Core functions for Marvell Kirkwood SoCs
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/serial_8250.h>
15 #include <linux/mbus.h>
16 #include <linux/mv643xx_eth.h>
17 #include <linux/ata_platform.h>
18 #include <linux/spi/orion_spi.h>
19 #include <net/dsa.h>
20 #include <asm/page.h>
21 #include <asm/timex.h>
22 #include <asm/mach/map.h>
23 #include <asm/mach/time.h>
24 #include <mach/kirkwood.h>
25 #include <plat/cache-feroceon-l2.h>
26 #include <plat/ehci-orion.h>
27 #include <plat/mv_xor.h>
28 #include <plat/orion_nand.h>
29 #include <plat/time.h>
30 #include "common.h"
31
32 /*****************************************************************************
33  * I/O Address Mapping
34  ****************************************************************************/
35 static struct map_desc kirkwood_io_desc[] __initdata = {
36         {
37                 .virtual        = KIRKWOOD_PCIE_IO_VIRT_BASE,
38                 .pfn            = __phys_to_pfn(KIRKWOOD_PCIE_IO_PHYS_BASE),
39                 .length         = KIRKWOOD_PCIE_IO_SIZE,
40                 .type           = MT_DEVICE,
41         }, {
42                 .virtual        = KIRKWOOD_REGS_VIRT_BASE,
43                 .pfn            = __phys_to_pfn(KIRKWOOD_REGS_PHYS_BASE),
44                 .length         = KIRKWOOD_REGS_SIZE,
45                 .type           = MT_DEVICE,
46         },
47 };
48
49 void __init kirkwood_map_io(void)
50 {
51         iotable_init(kirkwood_io_desc, ARRAY_SIZE(kirkwood_io_desc));
52 }
53
54
55 /*****************************************************************************
56  * EHCI
57  ****************************************************************************/
58 static struct orion_ehci_data kirkwood_ehci_data = {
59         .dram           = &kirkwood_mbus_dram_info,
60         .phy_version    = EHCI_PHY_NA,
61 };
62
63 static u64 ehci_dmamask = 0xffffffffUL;
64
65
66 /*****************************************************************************
67  * EHCI0
68  ****************************************************************************/
69 static struct resource kirkwood_ehci_resources[] = {
70         {
71                 .start  = USB_PHYS_BASE,
72                 .end    = USB_PHYS_BASE + 0x0fff,
73                 .flags  = IORESOURCE_MEM,
74         }, {
75                 .start  = IRQ_KIRKWOOD_USB,
76                 .end    = IRQ_KIRKWOOD_USB,
77                 .flags  = IORESOURCE_IRQ,
78         },
79 };
80
81 static struct platform_device kirkwood_ehci = {
82         .name           = "orion-ehci",
83         .id             = 0,
84         .dev            = {
85                 .dma_mask               = &ehci_dmamask,
86                 .coherent_dma_mask      = 0xffffffff,
87                 .platform_data          = &kirkwood_ehci_data,
88         },
89         .resource       = kirkwood_ehci_resources,
90         .num_resources  = ARRAY_SIZE(kirkwood_ehci_resources),
91 };
92
93 void __init kirkwood_ehci_init(void)
94 {
95         platform_device_register(&kirkwood_ehci);
96 }
97
98
99 /*****************************************************************************
100  * GE00
101  ****************************************************************************/
102 struct mv643xx_eth_shared_platform_data kirkwood_ge00_shared_data = {
103         .dram           = &kirkwood_mbus_dram_info,
104 };
105
106 static struct resource kirkwood_ge00_shared_resources[] = {
107         {
108                 .name   = "ge00 base",
109                 .start  = GE00_PHYS_BASE + 0x2000,
110                 .end    = GE00_PHYS_BASE + 0x3fff,
111                 .flags  = IORESOURCE_MEM,
112         }, {
113                 .name   = "ge00 err irq",
114                 .start  = IRQ_KIRKWOOD_GE00_ERR,
115                 .end    = IRQ_KIRKWOOD_GE00_ERR,
116                 .flags  = IORESOURCE_IRQ,
117         },
118 };
119
120 static struct platform_device kirkwood_ge00_shared = {
121         .name           = MV643XX_ETH_SHARED_NAME,
122         .id             = 0,
123         .dev            = {
124                 .platform_data  = &kirkwood_ge00_shared_data,
125         },
126         .num_resources  = ARRAY_SIZE(kirkwood_ge00_shared_resources),
127         .resource       = kirkwood_ge00_shared_resources,
128 };
129
130 static struct resource kirkwood_ge00_resources[] = {
131         {
132                 .name   = "ge00 irq",
133                 .start  = IRQ_KIRKWOOD_GE00_SUM,
134                 .end    = IRQ_KIRKWOOD_GE00_SUM,
135                 .flags  = IORESOURCE_IRQ,
136         },
137 };
138
139 static struct platform_device kirkwood_ge00 = {
140         .name           = MV643XX_ETH_NAME,
141         .id             = 0,
142         .num_resources  = 1,
143         .resource       = kirkwood_ge00_resources,
144 };
145
146 void __init kirkwood_ge00_init(struct mv643xx_eth_platform_data *eth_data)
147 {
148         eth_data->shared = &kirkwood_ge00_shared;
149         kirkwood_ge00.dev.platform_data = eth_data;
150
151         platform_device_register(&kirkwood_ge00_shared);
152         platform_device_register(&kirkwood_ge00);
153 }
154
155
156 /*****************************************************************************
157  * GE01
158  ****************************************************************************/
159 struct mv643xx_eth_shared_platform_data kirkwood_ge01_shared_data = {
160         .dram           = &kirkwood_mbus_dram_info,
161         .shared_smi     = &kirkwood_ge00_shared,
162 };
163
164 static struct resource kirkwood_ge01_shared_resources[] = {
165         {
166                 .name   = "ge01 base",
167                 .start  = GE01_PHYS_BASE + 0x2000,
168                 .end    = GE01_PHYS_BASE + 0x3fff,
169                 .flags  = IORESOURCE_MEM,
170         }, {
171                 .name   = "ge01 err irq",
172                 .start  = IRQ_KIRKWOOD_GE01_ERR,
173                 .end    = IRQ_KIRKWOOD_GE01_ERR,
174                 .flags  = IORESOURCE_IRQ,
175         },
176 };
177
178 static struct platform_device kirkwood_ge01_shared = {
179         .name           = MV643XX_ETH_SHARED_NAME,
180         .id             = 1,
181         .dev            = {
182                 .platform_data  = &kirkwood_ge01_shared_data,
183         },
184         .num_resources  = ARRAY_SIZE(kirkwood_ge01_shared_resources),
185         .resource       = kirkwood_ge01_shared_resources,
186 };
187
188 static struct resource kirkwood_ge01_resources[] = {
189         {
190                 .name   = "ge01 irq",
191                 .start  = IRQ_KIRKWOOD_GE01_SUM,
192                 .end    = IRQ_KIRKWOOD_GE01_SUM,
193                 .flags  = IORESOURCE_IRQ,
194         },
195 };
196
197 static struct platform_device kirkwood_ge01 = {
198         .name           = MV643XX_ETH_NAME,
199         .id             = 1,
200         .num_resources  = 1,
201         .resource       = kirkwood_ge01_resources,
202 };
203
204 void __init kirkwood_ge01_init(struct mv643xx_eth_platform_data *eth_data)
205 {
206         eth_data->shared = &kirkwood_ge01_shared;
207         kirkwood_ge01.dev.platform_data = eth_data;
208
209         platform_device_register(&kirkwood_ge01_shared);
210         platform_device_register(&kirkwood_ge01);
211 }
212
213
214 /*****************************************************************************
215  * Ethernet switch
216  ****************************************************************************/
217 static struct resource kirkwood_switch_resources[] = {
218         {
219                 .start  = 0,
220                 .end    = 0,
221                 .flags  = IORESOURCE_IRQ,
222         },
223 };
224
225 static struct platform_device kirkwood_switch_device = {
226         .name           = "dsa",
227         .id             = 0,
228         .num_resources  = 0,
229         .resource       = kirkwood_switch_resources,
230 };
231
232 void __init kirkwood_ge00_switch_init(struct dsa_platform_data *d, int irq)
233 {
234         int i;
235
236         if (irq != NO_IRQ) {
237                 kirkwood_switch_resources[0].start = irq;
238                 kirkwood_switch_resources[0].end = irq;
239                 kirkwood_switch_device.num_resources = 1;
240         }
241
242         d->netdev = &kirkwood_ge00.dev;
243         for (i = 0; i < d->nr_chips; i++)
244                 d->chip[i].mii_bus = &kirkwood_ge00_shared.dev;
245         kirkwood_switch_device.dev.platform_data = d;
246
247         platform_device_register(&kirkwood_switch_device);
248 }
249
250
251 /*****************************************************************************
252  * SoC RTC
253  ****************************************************************************/
254 static struct resource kirkwood_rtc_resource = {
255         .start  = RTC_PHYS_BASE,
256         .end    = RTC_PHYS_BASE + SZ_16 - 1,
257         .flags  = IORESOURCE_MEM,
258 };
259
260 void __init kirkwood_rtc_init(void)
261 {
262         platform_device_register_simple("rtc-mv", -1, &kirkwood_rtc_resource, 1);
263 }
264
265
266 /*****************************************************************************
267  * SATA
268  ****************************************************************************/
269 static struct resource kirkwood_sata_resources[] = {
270         {
271                 .name   = "sata base",
272                 .start  = SATA_PHYS_BASE,
273                 .end    = SATA_PHYS_BASE + 0x5000 - 1,
274                 .flags  = IORESOURCE_MEM,
275         }, {
276                 .name   = "sata irq",
277                 .start  = IRQ_KIRKWOOD_SATA,
278                 .end    = IRQ_KIRKWOOD_SATA,
279                 .flags  = IORESOURCE_IRQ,
280         },
281 };
282
283 static struct platform_device kirkwood_sata = {
284         .name           = "sata_mv",
285         .id             = 0,
286         .dev            = {
287                 .coherent_dma_mask      = 0xffffffff,
288         },
289         .num_resources  = ARRAY_SIZE(kirkwood_sata_resources),
290         .resource       = kirkwood_sata_resources,
291 };
292
293 void __init kirkwood_sata_init(struct mv_sata_platform_data *sata_data)
294 {
295         sata_data->dram = &kirkwood_mbus_dram_info;
296         kirkwood_sata.dev.platform_data = sata_data;
297         platform_device_register(&kirkwood_sata);
298 }
299
300
301 /*****************************************************************************
302  * SPI
303  ****************************************************************************/
304 static struct orion_spi_info kirkwood_spi_plat_data = {
305 };
306
307 static struct resource kirkwood_spi_resources[] = {
308         {
309                 .start  = SPI_PHYS_BASE,
310                 .end    = SPI_PHYS_BASE + SZ_512 - 1,
311                 .flags  = IORESOURCE_MEM,
312         },
313 };
314
315 static struct platform_device kirkwood_spi = {
316         .name           = "orion_spi",
317         .id             = 0,
318         .resource       = kirkwood_spi_resources,
319         .dev            = {
320                 .platform_data  = &kirkwood_spi_plat_data,
321         },
322         .num_resources  = ARRAY_SIZE(kirkwood_spi_resources),
323 };
324
325 void __init kirkwood_spi_init()
326 {
327         platform_device_register(&kirkwood_spi);
328 }
329
330
331 /*****************************************************************************
332  * UART0
333  ****************************************************************************/
334 static struct plat_serial8250_port kirkwood_uart0_data[] = {
335         {
336                 .mapbase        = UART0_PHYS_BASE,
337                 .membase        = (char *)UART0_VIRT_BASE,
338                 .irq            = IRQ_KIRKWOOD_UART_0,
339                 .flags          = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
340                 .iotype         = UPIO_MEM,
341                 .regshift       = 2,
342                 .uartclk        = 0,
343         }, {
344         },
345 };
346
347 static struct resource kirkwood_uart0_resources[] = {
348         {
349                 .start          = UART0_PHYS_BASE,
350                 .end            = UART0_PHYS_BASE + 0xff,
351                 .flags          = IORESOURCE_MEM,
352         }, {
353                 .start          = IRQ_KIRKWOOD_UART_0,
354                 .end            = IRQ_KIRKWOOD_UART_0,
355                 .flags          = IORESOURCE_IRQ,
356         },
357 };
358
359 static struct platform_device kirkwood_uart0 = {
360         .name                   = "serial8250",
361         .id                     = 0,
362         .dev                    = {
363                 .platform_data  = kirkwood_uart0_data,
364         },
365         .resource               = kirkwood_uart0_resources,
366         .num_resources          = ARRAY_SIZE(kirkwood_uart0_resources),
367 };
368
369 void __init kirkwood_uart0_init(void)
370 {
371         platform_device_register(&kirkwood_uart0);
372 }
373
374
375 /*****************************************************************************
376  * UART1
377  ****************************************************************************/
378 static struct plat_serial8250_port kirkwood_uart1_data[] = {
379         {
380                 .mapbase        = UART1_PHYS_BASE,
381                 .membase        = (char *)UART1_VIRT_BASE,
382                 .irq            = IRQ_KIRKWOOD_UART_1,
383                 .flags          = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
384                 .iotype         = UPIO_MEM,
385                 .regshift       = 2,
386                 .uartclk        = 0,
387         }, {
388         },
389 };
390
391 static struct resource kirkwood_uart1_resources[] = {
392         {
393                 .start          = UART1_PHYS_BASE,
394                 .end            = UART1_PHYS_BASE + 0xff,
395                 .flags          = IORESOURCE_MEM,
396         }, {
397                 .start          = IRQ_KIRKWOOD_UART_1,
398                 .end            = IRQ_KIRKWOOD_UART_1,
399                 .flags          = IORESOURCE_IRQ,
400         },
401 };
402
403 static struct platform_device kirkwood_uart1 = {
404         .name                   = "serial8250",
405         .id                     = 1,
406         .dev                    = {
407                 .platform_data  = kirkwood_uart1_data,
408         },
409         .resource               = kirkwood_uart1_resources,
410         .num_resources          = ARRAY_SIZE(kirkwood_uart1_resources),
411 };
412
413 void __init kirkwood_uart1_init(void)
414 {
415         platform_device_register(&kirkwood_uart1);
416 }
417
418
419 /*****************************************************************************
420  * XOR
421  ****************************************************************************/
422 static struct mv_xor_platform_shared_data kirkwood_xor_shared_data = {
423         .dram           = &kirkwood_mbus_dram_info,
424 };
425
426 static u64 kirkwood_xor_dmamask = DMA_32BIT_MASK;
427
428
429 /*****************************************************************************
430  * XOR0
431  ****************************************************************************/
432 static struct resource kirkwood_xor0_shared_resources[] = {
433         {
434                 .name   = "xor 0 low",
435                 .start  = XOR0_PHYS_BASE,
436                 .end    = XOR0_PHYS_BASE + 0xff,
437                 .flags  = IORESOURCE_MEM,
438         }, {
439                 .name   = "xor 0 high",
440                 .start  = XOR0_HIGH_PHYS_BASE,
441                 .end    = XOR0_HIGH_PHYS_BASE + 0xff,
442                 .flags  = IORESOURCE_MEM,
443         },
444 };
445
446 static struct platform_device kirkwood_xor0_shared = {
447         .name           = MV_XOR_SHARED_NAME,
448         .id             = 0,
449         .dev            = {
450                 .platform_data = &kirkwood_xor_shared_data,
451         },
452         .num_resources  = ARRAY_SIZE(kirkwood_xor0_shared_resources),
453         .resource       = kirkwood_xor0_shared_resources,
454 };
455
456 static struct resource kirkwood_xor00_resources[] = {
457         [0] = {
458                 .start  = IRQ_KIRKWOOD_XOR_00,
459                 .end    = IRQ_KIRKWOOD_XOR_00,
460                 .flags  = IORESOURCE_IRQ,
461         },
462 };
463
464 static struct mv_xor_platform_data kirkwood_xor00_data = {
465         .shared         = &kirkwood_xor0_shared,
466         .hw_id          = 0,
467         .pool_size      = PAGE_SIZE,
468 };
469
470 static struct platform_device kirkwood_xor00_channel = {
471         .name           = MV_XOR_NAME,
472         .id             = 0,
473         .num_resources  = ARRAY_SIZE(kirkwood_xor00_resources),
474         .resource       = kirkwood_xor00_resources,
475         .dev            = {
476                 .dma_mask               = &kirkwood_xor_dmamask,
477                 .coherent_dma_mask      = DMA_64BIT_MASK,
478                 .platform_data          = (void *)&kirkwood_xor00_data,
479         },
480 };
481
482 static struct resource kirkwood_xor01_resources[] = {
483         [0] = {
484                 .start  = IRQ_KIRKWOOD_XOR_01,
485                 .end    = IRQ_KIRKWOOD_XOR_01,
486                 .flags  = IORESOURCE_IRQ,
487         },
488 };
489
490 static struct mv_xor_platform_data kirkwood_xor01_data = {
491         .shared         = &kirkwood_xor0_shared,
492         .hw_id          = 1,
493         .pool_size      = PAGE_SIZE,
494 };
495
496 static struct platform_device kirkwood_xor01_channel = {
497         .name           = MV_XOR_NAME,
498         .id             = 1,
499         .num_resources  = ARRAY_SIZE(kirkwood_xor01_resources),
500         .resource       = kirkwood_xor01_resources,
501         .dev            = {
502                 .dma_mask               = &kirkwood_xor_dmamask,
503                 .coherent_dma_mask      = DMA_64BIT_MASK,
504                 .platform_data          = (void *)&kirkwood_xor01_data,
505         },
506 };
507
508 void __init kirkwood_xor0_init(void)
509 {
510         platform_device_register(&kirkwood_xor0_shared);
511
512         /*
513          * two engines can't do memset simultaneously, this limitation
514          * satisfied by removing memset support from one of the engines.
515          */
516         dma_cap_set(DMA_MEMCPY, kirkwood_xor00_data.cap_mask);
517         dma_cap_set(DMA_XOR, kirkwood_xor00_data.cap_mask);
518         platform_device_register(&kirkwood_xor00_channel);
519
520         dma_cap_set(DMA_MEMCPY, kirkwood_xor01_data.cap_mask);
521         dma_cap_set(DMA_MEMSET, kirkwood_xor01_data.cap_mask);
522         dma_cap_set(DMA_XOR, kirkwood_xor01_data.cap_mask);
523         platform_device_register(&kirkwood_xor01_channel);
524 }
525
526
527 /*****************************************************************************
528  * XOR1
529  ****************************************************************************/
530 static struct resource kirkwood_xor1_shared_resources[] = {
531         {
532                 .name   = "xor 1 low",
533                 .start  = XOR1_PHYS_BASE,
534                 .end    = XOR1_PHYS_BASE + 0xff,
535                 .flags  = IORESOURCE_MEM,
536         }, {
537                 .name   = "xor 1 high",
538                 .start  = XOR1_HIGH_PHYS_BASE,
539                 .end    = XOR1_HIGH_PHYS_BASE + 0xff,
540                 .flags  = IORESOURCE_MEM,
541         },
542 };
543
544 static struct platform_device kirkwood_xor1_shared = {
545         .name           = MV_XOR_SHARED_NAME,
546         .id             = 1,
547         .dev            = {
548                 .platform_data = &kirkwood_xor_shared_data,
549         },
550         .num_resources  = ARRAY_SIZE(kirkwood_xor1_shared_resources),
551         .resource       = kirkwood_xor1_shared_resources,
552 };
553
554 static struct resource kirkwood_xor10_resources[] = {
555         [0] = {
556                 .start  = IRQ_KIRKWOOD_XOR_10,
557                 .end    = IRQ_KIRKWOOD_XOR_10,
558                 .flags  = IORESOURCE_IRQ,
559         },
560 };
561
562 static struct mv_xor_platform_data kirkwood_xor10_data = {
563         .shared         = &kirkwood_xor1_shared,
564         .hw_id          = 0,
565         .pool_size      = PAGE_SIZE,
566 };
567
568 static struct platform_device kirkwood_xor10_channel = {
569         .name           = MV_XOR_NAME,
570         .id             = 2,
571         .num_resources  = ARRAY_SIZE(kirkwood_xor10_resources),
572         .resource       = kirkwood_xor10_resources,
573         .dev            = {
574                 .dma_mask               = &kirkwood_xor_dmamask,
575                 .coherent_dma_mask      = DMA_64BIT_MASK,
576                 .platform_data          = (void *)&kirkwood_xor10_data,
577         },
578 };
579
580 static struct resource kirkwood_xor11_resources[] = {
581         [0] = {
582                 .start  = IRQ_KIRKWOOD_XOR_11,
583                 .end    = IRQ_KIRKWOOD_XOR_11,
584                 .flags  = IORESOURCE_IRQ,
585         },
586 };
587
588 static struct mv_xor_platform_data kirkwood_xor11_data = {
589         .shared         = &kirkwood_xor1_shared,
590         .hw_id          = 1,
591         .pool_size      = PAGE_SIZE,
592 };
593
594 static struct platform_device kirkwood_xor11_channel = {
595         .name           = MV_XOR_NAME,
596         .id             = 3,
597         .num_resources  = ARRAY_SIZE(kirkwood_xor11_resources),
598         .resource       = kirkwood_xor11_resources,
599         .dev            = {
600                 .dma_mask               = &kirkwood_xor_dmamask,
601                 .coherent_dma_mask      = DMA_64BIT_MASK,
602                 .platform_data          = (void *)&kirkwood_xor11_data,
603         },
604 };
605
606 void __init kirkwood_xor1_init(void)
607 {
608         platform_device_register(&kirkwood_xor1_shared);
609
610         /*
611          * two engines can't do memset simultaneously, this limitation
612          * satisfied by removing memset support from one of the engines.
613          */
614         dma_cap_set(DMA_MEMCPY, kirkwood_xor10_data.cap_mask);
615         dma_cap_set(DMA_XOR, kirkwood_xor10_data.cap_mask);
616         platform_device_register(&kirkwood_xor10_channel);
617
618         dma_cap_set(DMA_MEMCPY, kirkwood_xor11_data.cap_mask);
619         dma_cap_set(DMA_MEMSET, kirkwood_xor11_data.cap_mask);
620         dma_cap_set(DMA_XOR, kirkwood_xor11_data.cap_mask);
621         platform_device_register(&kirkwood_xor11_channel);
622 }
623
624
625 /*****************************************************************************
626  * Time handling
627  ****************************************************************************/
628 int kirkwood_tclk;
629
630 int __init kirkwood_find_tclk(void)
631 {
632         u32 dev, rev;
633
634         kirkwood_pcie_id(&dev, &rev);
635         if (dev == MV88F6281_DEV_ID && rev == MV88F6281_REV_A0)
636                 return 200000000;
637
638         return 166666667;
639 }
640
641 static void kirkwood_timer_init(void)
642 {
643         kirkwood_tclk = kirkwood_find_tclk();
644         orion_time_init(IRQ_KIRKWOOD_BRIDGE, kirkwood_tclk);
645 }
646
647 struct sys_timer kirkwood_timer = {
648         .init = kirkwood_timer_init,
649 };
650
651
652 /*****************************************************************************
653  * General
654  ****************************************************************************/
655 /*
656  * Identify device ID and revision.
657  */
658 static char * __init kirkwood_id(void)
659 {
660         u32 dev, rev;
661
662         kirkwood_pcie_id(&dev, &rev);
663
664         if (dev == MV88F6281_DEV_ID) {
665                 if (rev == MV88F6281_REV_Z0)
666                         return "MV88F6281-Z0";
667                 else if (rev == MV88F6281_REV_A0)
668                         return "MV88F6281-A0";
669                 else
670                         return "MV88F6281-Rev-Unsupported";
671         } else if (dev == MV88F6192_DEV_ID) {
672                 if (rev == MV88F6192_REV_Z0)
673                         return "MV88F6192-Z0";
674                 else if (rev == MV88F6192_REV_A0)
675                         return "MV88F6192-A0";
676                 else
677                         return "MV88F6192-Rev-Unsupported";
678         } else if (dev == MV88F6180_DEV_ID) {
679                 if (rev == MV88F6180_REV_A0)
680                         return "MV88F6180-Rev-A0";
681                 else
682                         return "MV88F6180-Rev-Unsupported";
683         } else {
684                 return "Device-Unknown";
685         }
686 }
687
688 static void __init kirkwood_l2_init(void)
689 {
690 #ifdef CONFIG_CACHE_FEROCEON_L2_WRITETHROUGH
691         writel(readl(L2_CONFIG_REG) | L2_WRITETHROUGH, L2_CONFIG_REG);
692         feroceon_l2_init(1);
693 #else
694         writel(readl(L2_CONFIG_REG) & ~L2_WRITETHROUGH, L2_CONFIG_REG);
695         feroceon_l2_init(0);
696 #endif
697 }
698
699 void __init kirkwood_init(void)
700 {
701         printk(KERN_INFO "Kirkwood: %s, TCLK=%d.\n",
702                 kirkwood_id(), kirkwood_tclk);
703         kirkwood_ge00_shared_data.t_clk = kirkwood_tclk;
704         kirkwood_ge01_shared_data.t_clk = kirkwood_tclk;
705         kirkwood_spi_plat_data.tclk = kirkwood_tclk;
706         kirkwood_uart0_data[0].uartclk = kirkwood_tclk;
707         kirkwood_uart1_data[0].uartclk = kirkwood_tclk;
708
709         kirkwood_setup_cpu_mbus();
710
711 #ifdef CONFIG_CACHE_FEROCEON_L2
712         kirkwood_l2_init();
713 #endif
714 }