aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-dove/common.c159
-rw-r--r--arch/arm/mach-kirkwood/common.c79
-rw-r--r--arch/arm/mach-loki/common.c78
-rw-r--r--arch/arm/mach-mv78xx0/common.c160
-rw-r--r--arch/arm/mach-orion5x/common.c81
-rw-r--r--arch/arm/plat-orion/Makefile2
-rw-r--r--arch/arm/plat-orion/common.c171
-rw-r--r--arch/arm/plat-orion/include/plat/common.h33
8 files changed, 241 insertions, 522 deletions
diff --git a/arch/arm/mach-dove/common.c b/arch/arm/mach-dove/common.c
index 30c95187978..fffa92e92d6 100644
--- a/arch/arm/mach-dove/common.c
+++ b/arch/arm/mach-dove/common.c
@@ -36,8 +36,11 @@
36#include <plat/mv_xor.h> 36#include <plat/mv_xor.h>
37#include <plat/ehci-orion.h> 37#include <plat/ehci-orion.h>
38#include <plat/time.h> 38#include <plat/time.h>
39#include <plat/common.h>
39#include "common.h" 40#include "common.h"
40 41
42static int get_tclk(void);
43
41/***************************************************************************** 44/*****************************************************************************
42 * I/O Address Mapping 45 * I/O Address Mapping
43 ****************************************************************************/ 46 ****************************************************************************/
@@ -255,173 +258,37 @@ void __init dove_sata_init(struct mv_sata_platform_data *sata_data)
255/***************************************************************************** 258/*****************************************************************************
256 * UART0 259 * UART0
257 ****************************************************************************/ 260 ****************************************************************************/
258static struct plat_serial8250_port dove_uart0_data[] = {
259 {
260 .mapbase = DOVE_UART0_PHYS_BASE,
261 .membase = (char *)DOVE_UART0_VIRT_BASE,
262 .irq = IRQ_DOVE_UART_0,
263 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
264 .iotype = UPIO_MEM,
265 .regshift = 2,
266 .uartclk = 0,
267 }, {
268 },
269};
270
271static struct resource dove_uart0_resources[] = {
272 {
273 .start = DOVE_UART0_PHYS_BASE,
274 .end = DOVE_UART0_PHYS_BASE + SZ_256 - 1,
275 .flags = IORESOURCE_MEM,
276 }, {
277 .start = IRQ_DOVE_UART_0,
278 .end = IRQ_DOVE_UART_0,
279 .flags = IORESOURCE_IRQ,
280 },
281};
282
283static struct platform_device dove_uart0 = {
284 .name = "serial8250",
285 .id = PLAT8250_DEV_PLATFORM,
286 .dev = {
287 .platform_data = dove_uart0_data,
288 },
289 .resource = dove_uart0_resources,
290 .num_resources = ARRAY_SIZE(dove_uart0_resources),
291};
292
293void __init dove_uart0_init(void) 261void __init dove_uart0_init(void)
294{ 262{
295 platform_device_register(&dove_uart0); 263 orion_uart0_init(DOVE_UART0_VIRT_BASE, DOVE_UART0_PHYS_BASE,
264 IRQ_DOVE_UART_0, get_tclk());
296} 265}
297 266
298/***************************************************************************** 267/*****************************************************************************
299 * UART1 268 * UART1
300 ****************************************************************************/ 269 ****************************************************************************/
301static struct plat_serial8250_port dove_uart1_data[] = {
302 {
303 .mapbase = DOVE_UART1_PHYS_BASE,
304 .membase = (char *)DOVE_UART1_VIRT_BASE,
305 .irq = IRQ_DOVE_UART_1,
306 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
307 .iotype = UPIO_MEM,
308 .regshift = 2,
309 .uartclk = 0,
310 }, {
311 },
312};
313
314static struct resource dove_uart1_resources[] = {
315 {
316 .start = DOVE_UART1_PHYS_BASE,
317 .end = DOVE_UART1_PHYS_BASE + SZ_256 - 1,
318 .flags = IORESOURCE_MEM,
319 }, {
320 .start = IRQ_DOVE_UART_1,
321 .end = IRQ_DOVE_UART_1,
322 .flags = IORESOURCE_IRQ,
323 },
324};
325
326static struct platform_device dove_uart1 = {
327 .name = "serial8250",
328 .id = PLAT8250_DEV_PLATFORM1,
329 .dev = {
330 .platform_data = dove_uart1_data,
331 },
332 .resource = dove_uart1_resources,
333 .num_resources = ARRAY_SIZE(dove_uart1_resources),
334};
335
336void __init dove_uart1_init(void) 270void __init dove_uart1_init(void)
337{ 271{
338 platform_device_register(&dove_uart1); 272 orion_uart1_init(DOVE_UART1_VIRT_BASE, DOVE_UART1_PHYS_BASE,
273 IRQ_DOVE_UART_1, get_tclk());
339} 274}
340 275
341/***************************************************************************** 276/*****************************************************************************
342 * UART2 277 * UART2
343 ****************************************************************************/ 278 ****************************************************************************/
344static struct plat_serial8250_port dove_uart2_data[] = {
345 {
346 .mapbase = DOVE_UART2_PHYS_BASE,
347 .membase = (char *)DOVE_UART2_VIRT_BASE,
348 .irq = IRQ_DOVE_UART_2,
349 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
350 .iotype = UPIO_MEM,
351 .regshift = 2,
352 .uartclk = 0,
353 }, {
354 },
355};
356
357static struct resource dove_uart2_resources[] = {
358 {
359 .start = DOVE_UART2_PHYS_BASE,
360 .end = DOVE_UART2_PHYS_BASE + SZ_256 - 1,
361 .flags = IORESOURCE_MEM,
362 }, {
363 .start = IRQ_DOVE_UART_2,
364 .end = IRQ_DOVE_UART_2,
365 .flags = IORESOURCE_IRQ,
366 },
367};
368
369static struct platform_device dove_uart2 = {
370 .name = "serial8250",
371 .id = PLAT8250_DEV_PLATFORM2,
372 .dev = {
373 .platform_data = dove_uart2_data,
374 },
375 .resource = dove_uart2_resources,
376 .num_resources = ARRAY_SIZE(dove_uart2_resources),
377};
378
379void __init dove_uart2_init(void) 279void __init dove_uart2_init(void)
380{ 280{
381 platform_device_register(&dove_uart2); 281 orion_uart2_init(DOVE_UART2_VIRT_BASE, DOVE_UART2_PHYS_BASE,
282 IRQ_DOVE_UART_2, get_tclk());
382} 283}
383 284
384/***************************************************************************** 285/*****************************************************************************
385 * UART3 286 * UART3
386 ****************************************************************************/ 287 ****************************************************************************/
387static struct plat_serial8250_port dove_uart3_data[] = {
388 {
389 .mapbase = DOVE_UART3_PHYS_BASE,
390 .membase = (char *)DOVE_UART3_VIRT_BASE,
391 .irq = IRQ_DOVE_UART_3,
392 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
393 .iotype = UPIO_MEM,
394 .regshift = 2,
395 .uartclk = 0,
396 }, {
397 },
398};
399
400static struct resource dove_uart3_resources[] = {
401 {
402 .start = DOVE_UART3_PHYS_BASE,
403 .end = DOVE_UART3_PHYS_BASE + SZ_256 - 1,
404 .flags = IORESOURCE_MEM,
405 }, {
406 .start = IRQ_DOVE_UART_3,
407 .end = IRQ_DOVE_UART_3,
408 .flags = IORESOURCE_IRQ,
409 },
410};
411
412static struct platform_device dove_uart3 = {
413 .name = "serial8250",
414 .id = 3,
415 .dev = {
416 .platform_data = dove_uart3_data,
417 },
418 .resource = dove_uart3_resources,
419 .num_resources = ARRAY_SIZE(dove_uart3_resources),
420};
421
422void __init dove_uart3_init(void) 288void __init dove_uart3_init(void)
423{ 289{
424 platform_device_register(&dove_uart3); 290 orion_uart3_init(DOVE_UART3_VIRT_BASE, DOVE_UART3_PHYS_BASE,
291 IRQ_DOVE_UART_3, get_tclk());
425} 292}
426 293
427/***************************************************************************** 294/*****************************************************************************
@@ -835,10 +702,6 @@ void __init dove_init(void)
835 dove_setup_cpu_mbus(); 702 dove_setup_cpu_mbus();
836 703
837 dove_ge00_shared_data.t_clk = tclk; 704 dove_ge00_shared_data.t_clk = tclk;
838 dove_uart0_data[0].uartclk = tclk;
839 dove_uart1_data[0].uartclk = tclk;
840 dove_uart2_data[0].uartclk = tclk;
841 dove_uart3_data[0].uartclk = tclk;
842 dove_spi0_data.tclk = tclk; 705 dove_spi0_data.tclk = tclk;
843 dove_spi1_data.tclk = tclk; 706 dove_spi1_data.tclk = tclk;
844 707
diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c
index 4b89eed216e..8cdf9f9f74b 100644
--- a/arch/arm/mach-kirkwood/common.c
+++ b/arch/arm/mach-kirkwood/common.c
@@ -33,6 +33,7 @@
33#include <plat/mv_xor.h> 33#include <plat/mv_xor.h>
34#include <plat/orion_nand.h> 34#include <plat/orion_nand.h>
35#include <plat/orion_wdt.h> 35#include <plat/orion_wdt.h>
36#include <plat/common.h>
36#include <plat/time.h> 37#include <plat/time.h>
37#include "common.h" 38#include "common.h"
38 39
@@ -491,91 +492,23 @@ void __init kirkwood_i2c_init(void)
491/***************************************************************************** 492/*****************************************************************************
492 * UART0 493 * UART0
493 ****************************************************************************/ 494 ****************************************************************************/
494static struct plat_serial8250_port kirkwood_uart0_data[] = {
495 {
496 .mapbase = UART0_PHYS_BASE,
497 .membase = (char *)UART0_VIRT_BASE,
498 .irq = IRQ_KIRKWOOD_UART_0,
499 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
500 .iotype = UPIO_MEM,
501 .regshift = 2,
502 .uartclk = 0,
503 }, {
504 },
505};
506
507static struct resource kirkwood_uart0_resources[] = {
508 {
509 .start = UART0_PHYS_BASE,
510 .end = UART0_PHYS_BASE + 0xff,
511 .flags = IORESOURCE_MEM,
512 }, {
513 .start = IRQ_KIRKWOOD_UART_0,
514 .end = IRQ_KIRKWOOD_UART_0,
515 .flags = IORESOURCE_IRQ,
516 },
517};
518
519static struct platform_device kirkwood_uart0 = {
520 .name = "serial8250",
521 .id = PLAT8250_DEV_PLATFORM,
522 .dev = {
523 .platform_data = kirkwood_uart0_data,
524 },
525 .resource = kirkwood_uart0_resources,
526 .num_resources = ARRAY_SIZE(kirkwood_uart0_resources),
527};
528 495
529void __init kirkwood_uart0_init(void) 496void __init kirkwood_uart0_init(void)
530{ 497{
531 platform_device_register(&kirkwood_uart0); 498 orion_uart0_init(UART0_VIRT_BASE, UART0_PHYS_BASE,
499 IRQ_KIRKWOOD_UART_0, kirkwood_tclk);
532} 500}
533 501
534 502
535/***************************************************************************** 503/*****************************************************************************
536 * UART1 504 * UART1
537 ****************************************************************************/ 505 ****************************************************************************/
538static struct plat_serial8250_port kirkwood_uart1_data[] = {
539 {
540 .mapbase = UART1_PHYS_BASE,
541 .membase = (char *)UART1_VIRT_BASE,
542 .irq = IRQ_KIRKWOOD_UART_1,
543 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
544 .iotype = UPIO_MEM,
545 .regshift = 2,
546 .uartclk = 0,
547 }, {
548 },
549};
550
551static struct resource kirkwood_uart1_resources[] = {
552 {
553 .start = UART1_PHYS_BASE,
554 .end = UART1_PHYS_BASE + 0xff,
555 .flags = IORESOURCE_MEM,
556 }, {
557 .start = IRQ_KIRKWOOD_UART_1,
558 .end = IRQ_KIRKWOOD_UART_1,
559 .flags = IORESOURCE_IRQ,
560 },
561};
562
563static struct platform_device kirkwood_uart1 = {
564 .name = "serial8250",
565 .id = PLAT8250_DEV_PLATFORM1,
566 .dev = {
567 .platform_data = kirkwood_uart1_data,
568 },
569 .resource = kirkwood_uart1_resources,
570 .num_resources = ARRAY_SIZE(kirkwood_uart1_resources),
571};
572
573void __init kirkwood_uart1_init(void) 506void __init kirkwood_uart1_init(void)
574{ 507{
575 platform_device_register(&kirkwood_uart1); 508 orion_uart1_init(UART1_VIRT_BASE, UART1_PHYS_BASE,
509 IRQ_KIRKWOOD_UART_1, kirkwood_tclk);
576} 510}
577 511
578
579/***************************************************************************** 512/*****************************************************************************
580 * Cryptographic Engines and Security Accelerator (CESA) 513 * Cryptographic Engines and Security Accelerator (CESA)
581 ****************************************************************************/ 514 ****************************************************************************/
@@ -987,8 +920,6 @@ void __init kirkwood_init(void)
987 kirkwood_ge00_shared_data.t_clk = kirkwood_tclk; 920 kirkwood_ge00_shared_data.t_clk = kirkwood_tclk;
988 kirkwood_ge01_shared_data.t_clk = kirkwood_tclk; 921 kirkwood_ge01_shared_data.t_clk = kirkwood_tclk;
989 kirkwood_spi_plat_data.tclk = kirkwood_tclk; 922 kirkwood_spi_plat_data.tclk = kirkwood_tclk;
990 kirkwood_uart0_data[0].uartclk = kirkwood_tclk;
991 kirkwood_uart1_data[0].uartclk = kirkwood_tclk;
992 kirkwood_i2s_data.tclk = kirkwood_tclk; 923 kirkwood_i2s_data.tclk = kirkwood_tclk;
993 924
994 /* 925 /*
diff --git a/arch/arm/mach-loki/common.c b/arch/arm/mach-loki/common.c
index 4ff4c62c3c0..c07180492bf 100644
--- a/arch/arm/mach-loki/common.c
+++ b/arch/arm/mach-loki/common.c
@@ -23,6 +23,7 @@
23#include <mach/loki.h> 23#include <mach/loki.h>
24#include <plat/orion_nand.h> 24#include <plat/orion_nand.h>
25#include <plat/time.h> 25#include <plat/time.h>
26#include <plat/common.h>
26#include "common.h" 27#include "common.h"
27 28
28/***************************************************************************** 29/*****************************************************************************
@@ -204,88 +205,19 @@ void __init loki_sas_init(void)
204/***************************************************************************** 205/*****************************************************************************
205 * UART0 206 * UART0
206 ****************************************************************************/ 207 ****************************************************************************/
207static struct plat_serial8250_port loki_uart0_data[] = {
208 {
209 .mapbase = UART0_PHYS_BASE,
210 .membase = (char *)UART0_VIRT_BASE,
211 .irq = IRQ_LOKI_UART0,
212 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
213 .iotype = UPIO_MEM,
214 .regshift = 2,
215 .uartclk = LOKI_TCLK,
216 }, {
217 },
218};
219
220static struct resource loki_uart0_resources[] = {
221 {
222 .start = UART0_PHYS_BASE,
223 .end = UART0_PHYS_BASE + 0xff,
224 .flags = IORESOURCE_MEM,
225 }, {
226 .start = IRQ_LOKI_UART0,
227 .end = IRQ_LOKI_UART0,
228 .flags = IORESOURCE_IRQ,
229 },
230};
231
232static struct platform_device loki_uart0 = {
233 .name = "serial8250",
234 .id = PLAT8250_DEV_PLATFORM,
235 .dev = {
236 .platform_data = loki_uart0_data,
237 },
238 .resource = loki_uart0_resources,
239 .num_resources = ARRAY_SIZE(loki_uart0_resources),
240};
241
242void __init loki_uart0_init(void) 208void __init loki_uart0_init(void)
243{ 209{
244 platform_device_register(&loki_uart0); 210 orion_uart0_init(UART0_VIRT_BASE, UART0_PHYS_BASE,
211 IRQ_LOKI_UART0, LOKI_TCLK);
245} 212}
246 213
247
248/***************************************************************************** 214/*****************************************************************************
249 * UART1 215 * UART1
250 ****************************************************************************/ 216 ****************************************************************************/
251static struct plat_serial8250_port loki_uart1_data[] = {
252 {
253 .mapbase = UART1_PHYS_BASE,
254 .membase = (char *)UART1_VIRT_BASE,
255 .irq = IRQ_LOKI_UART1,
256 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
257 .iotype = UPIO_MEM,
258 .regshift = 2,
259 .uartclk = LOKI_TCLK,
260 }, {
261 },
262};
263
264static struct resource loki_uart1_resources[] = {
265 {
266 .start = UART1_PHYS_BASE,
267 .end = UART1_PHYS_BASE + 0xff,
268 .flags = IORESOURCE_MEM,
269 }, {
270 .start = IRQ_LOKI_UART1,
271 .end = IRQ_LOKI_UART1,
272 .flags = IORESOURCE_IRQ,
273 },
274};
275
276static struct platform_device loki_uart1 = {
277 .name = "serial8250",
278 .id = PLAT8250_DEV_PLATFORM1,
279 .dev = {
280 .platform_data = loki_uart1_data,
281 },
282 .resource = loki_uart1_resources,
283 .num_resources = ARRAY_SIZE(loki_uart1_resources),
284};
285
286void __init loki_uart1_init(void) 217void __init loki_uart1_init(void)
287{ 218{
288 platform_device_register(&loki_uart1); 219 orion_uart1_init(UART1_VIRT_BASE, UART1_PHYS_BASE,
220 IRQ_LOKI_UART1, LOKI_TCLK);
289} 221}
290 222
291 223
diff --git a/arch/arm/mach-mv78xx0/common.c b/arch/arm/mach-mv78xx0/common.c
index c38250d1f07..5b474e4574d 100644
--- a/arch/arm/mach-mv78xx0/common.c
+++ b/arch/arm/mach-mv78xx0/common.c
@@ -25,8 +25,10 @@
25#include <plat/ehci-orion.h> 25#include <plat/ehci-orion.h>
26#include <plat/orion_nand.h> 26#include <plat/orion_nand.h>
27#include <plat/time.h> 27#include <plat/time.h>
28#include <plat/common.h>
28#include "common.h" 29#include "common.h"
29 30
31static int get_tclk(void);
30 32
31/***************************************************************************** 33/*****************************************************************************
32 * Common bits 34 * Common bits
@@ -642,179 +644,41 @@ void __init mv78xx0_sata_init(struct mv_sata_platform_data *sata_data)
642/***************************************************************************** 644/*****************************************************************************
643 * UART0 645 * UART0
644 ****************************************************************************/ 646 ****************************************************************************/
645static struct plat_serial8250_port mv78xx0_uart0_data[] = {
646 {
647 .mapbase = UART0_PHYS_BASE,
648 .membase = (char *)UART0_VIRT_BASE,
649 .irq = IRQ_MV78XX0_UART_0,
650 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
651 .iotype = UPIO_MEM,
652 .regshift = 2,
653 .uartclk = 0,
654 }, {
655 },
656};
657
658static struct resource mv78xx0_uart0_resources[] = {
659 {
660 .start = UART0_PHYS_BASE,
661 .end = UART0_PHYS_BASE + 0xff,
662 .flags = IORESOURCE_MEM,
663 }, {
664 .start = IRQ_MV78XX0_UART_0,
665 .end = IRQ_MV78XX0_UART_0,
666 .flags = IORESOURCE_IRQ,
667 },
668};
669
670static struct platform_device mv78xx0_uart0 = {
671 .name = "serial8250",
672 .id = PLAT8250_DEV_PLATFORM,
673 .dev = {
674 .platform_data = mv78xx0_uart0_data,
675 },
676 .resource = mv78xx0_uart0_resources,
677 .num_resources = ARRAY_SIZE(mv78xx0_uart0_resources),
678};
679
680void __init mv78xx0_uart0_init(void) 647void __init mv78xx0_uart0_init(void)
681{ 648{
682 platform_device_register(&mv78xx0_uart0); 649 orion_uart0_init(UART0_VIRT_BASE, UART0_PHYS_BASE,
650 IRQ_MV78XX0_UART_0, get_tclk());
683} 651}
684 652
685 653
686/***************************************************************************** 654/*****************************************************************************
687 * UART1 655 * UART1
688 ****************************************************************************/ 656 ****************************************************************************/
689static struct plat_serial8250_port mv78xx0_uart1_data[] = {
690 {
691 .mapbase = UART1_PHYS_BASE,
692 .membase = (char *)UART1_VIRT_BASE,
693 .irq = IRQ_MV78XX0_UART_1,
694 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
695 .iotype = UPIO_MEM,
696 .regshift = 2,
697 .uartclk = 0,
698 }, {
699 },
700};
701
702static struct resource mv78xx0_uart1_resources[] = {
703 {
704 .start = UART1_PHYS_BASE,
705 .end = UART1_PHYS_BASE + 0xff,
706 .flags = IORESOURCE_MEM,
707 }, {
708 .start = IRQ_MV78XX0_UART_1,
709 .end = IRQ_MV78XX0_UART_1,
710 .flags = IORESOURCE_IRQ,
711 },
712};
713
714static struct platform_device mv78xx0_uart1 = {
715 .name = "serial8250",
716 .id = PLAT8250_DEV_PLATFORM1,
717 .dev = {
718 .platform_data = mv78xx0_uart1_data,
719 },
720 .resource = mv78xx0_uart1_resources,
721 .num_resources = ARRAY_SIZE(mv78xx0_uart1_resources),
722};
723
724void __init mv78xx0_uart1_init(void) 657void __init mv78xx0_uart1_init(void)
725{ 658{
726 platform_device_register(&mv78xx0_uart1); 659 orion_uart1_init(UART1_VIRT_BASE, UART1_PHYS_BASE,
660 IRQ_MV78XX0_UART_1, get_tclk());
727} 661}
728 662
729 663
730/***************************************************************************** 664/*****************************************************************************
731 * UART2 665 * UART2
732 ****************************************************************************/ 666 ****************************************************************************/
733static struct plat_serial8250_port mv78xx0_uart2_data[] = {
734 {
735 .mapbase = UART2_PHYS_BASE,
736 .membase = (char *)UART2_VIRT_BASE,
737 .irq = IRQ_MV78XX0_UART_2,
738 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
739 .iotype = UPIO_MEM,
740 .regshift = 2,
741 .uartclk = 0,
742 }, {
743 },
744};
745
746static struct resource mv78xx0_uart2_resources[] = {
747 {
748 .start = UART2_PHYS_BASE,
749 .end = UART2_PHYS_BASE + 0xff,
750 .flags = IORESOURCE_MEM,
751 }, {
752 .start = IRQ_MV78XX0_UART_2,
753 .end = IRQ_MV78XX0_UART_2,
754 .flags = IORESOURCE_IRQ,
755 },
756};
757
758static struct platform_device mv78xx0_uart2 = {
759 .name = "serial8250",
760 .id = PLAT8250_DEV_PLATFORM2,
761 .dev = {
762 .platform_data = mv78xx0_uart2_data,
763 },
764 .resource = mv78xx0_uart2_resources,
765 .num_resources = ARRAY_SIZE(mv78xx0_uart2_resources),
766};
767
768void __init mv78xx0_uart2_init(void) 667void __init mv78xx0_uart2_init(void)
769{ 668{
770 platform_device_register(&mv78xx0_uart2); 669 orion_uart2_init(UART2_VIRT_BASE, UART2_PHYS_BASE,
670 IRQ_MV78XX0_UART_2, get_tclk());
771} 671}
772 672
773
774/***************************************************************************** 673/*****************************************************************************
775 * UART3 674 * UART3
776 ****************************************************************************/ 675 ****************************************************************************/
777static struct plat_serial8250_port mv78xx0_uart3_data[] = {
778 {
779 .mapbase = UART3_PHYS_BASE,
780 .membase = (char *)UART3_VIRT_BASE,
781 .irq = IRQ_MV78XX0_UART_3,
782 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
783 .iotype = UPIO_MEM,
784 .regshift = 2,
785 .uartclk = 0,
786 }, {
787 },
788};
789
790static struct resource mv78xx0_uart3_resources[] = {
791 {
792 .start = UART3_PHYS_BASE,
793 .end = UART3_PHYS_BASE + 0xff,
794 .flags = IORESOURCE_MEM,
795 }, {
796 .start = IRQ_MV78XX0_UART_3,
797 .end = IRQ_MV78XX0_UART_3,
798 .flags = IORESOURCE_IRQ,
799 },
800};
801
802static struct platform_device mv78xx0_uart3 = {
803 .name = "serial8250",
804 .id = 3,
805 .dev = {
806 .platform_data = mv78xx0_uart3_data,
807 },
808 .resource = mv78xx0_uart3_resources,
809 .num_resources = ARRAY_SIZE(mv78xx0_uart3_resources),
810};
811
812void __init mv78xx0_uart3_init(void) 676void __init mv78xx0_uart3_init(void)
813{ 677{
814 platform_device_register(&mv78xx0_uart3); 678 orion_uart3_init(UART3_VIRT_BASE, UART3_PHYS_BASE,
679 IRQ_MV78XX0_UART_3, get_tclk());
815} 680}
816 681
817
818/***************************************************************************** 682/*****************************************************************************
819 * Time handling 683 * Time handling
820 ****************************************************************************/ 684 ****************************************************************************/
@@ -900,8 +764,4 @@ void __init mv78xx0_init(void)
900 mv78xx0_ge01_shared_data.t_clk = tclk; 764 mv78xx0_ge01_shared_data.t_clk = tclk;
901 mv78xx0_ge10_shared_data.t_clk = tclk; 765 mv78xx0_ge10_shared_data.t_clk = tclk;
902 mv78xx0_ge11_shared_data.t_clk = tclk; 766 mv78xx0_ge11_shared_data.t_clk = tclk;
903 mv78xx0_uart0_data[0].uartclk = tclk;
904 mv78xx0_uart1_data[0].uartclk = tclk;
905 mv78xx0_uart2_data[0].uartclk = tclk;
906 mv78xx0_uart3_data[0].uartclk = tclk;
907} 767}
diff --git a/arch/arm/mach-orion5x/common.c b/arch/arm/mach-orion5x/common.c
index d281b1984e4..310de50e1bb 100644
--- a/arch/arm/mach-orion5x/common.c
+++ b/arch/arm/mach-orion5x/common.c
@@ -34,6 +34,7 @@
34#include <plat/orion_nand.h> 34#include <plat/orion_nand.h>
35#include <plat/orion_wdt.h> 35#include <plat/orion_wdt.h>
36#include <plat/time.h> 36#include <plat/time.h>
37#include <plat/common.h>
37#include "common.h" 38#include "common.h"
38 39
39/***************************************************************************** 40/*****************************************************************************
@@ -349,91 +350,21 @@ void __init orion5x_spi_init()
349/***************************************************************************** 350/*****************************************************************************
350 * UART0 351 * UART0
351 ****************************************************************************/ 352 ****************************************************************************/
352static struct plat_serial8250_port orion5x_uart0_data[] = {
353 {
354 .mapbase = UART0_PHYS_BASE,
355 .membase = (char *)UART0_VIRT_BASE,
356 .irq = IRQ_ORION5X_UART0,
357 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
358 .iotype = UPIO_MEM,
359 .regshift = 2,
360 .uartclk = 0,
361 }, {
362 },
363};
364
365static struct resource orion5x_uart0_resources[] = {
366 {
367 .start = UART0_PHYS_BASE,
368 .end = UART0_PHYS_BASE + 0xff,
369 .flags = IORESOURCE_MEM,
370 }, {
371 .start = IRQ_ORION5X_UART0,
372 .end = IRQ_ORION5X_UART0,
373 .flags = IORESOURCE_IRQ,
374 },
375};
376
377static struct platform_device orion5x_uart0 = {
378 .name = "serial8250",
379 .id = PLAT8250_DEV_PLATFORM,
380 .dev = {
381 .platform_data = orion5x_uart0_data,
382 },
383 .resource = orion5x_uart0_resources,
384 .num_resources = ARRAY_SIZE(orion5x_uart0_resources),
385};
386
387void __init orion5x_uart0_init(void) 353void __init orion5x_uart0_init(void)
388{ 354{
389 platform_device_register(&orion5x_uart0); 355 orion_uart0_init(UART0_VIRT_BASE, UART0_PHYS_BASE,
356 IRQ_ORION5X_UART0, orion5x_tclk);
390} 357}
391 358
392
393/***************************************************************************** 359/*****************************************************************************
394 * UART1 360 * UART1
395 ****************************************************************************/ 361 ****************************************************************************/
396static struct plat_serial8250_port orion5x_uart1_data[] = {
397 {
398 .mapbase = UART1_PHYS_BASE,
399 .membase = (char *)UART1_VIRT_BASE,
400 .irq = IRQ_ORION5X_UART1,
401 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
402 .iotype = UPIO_MEM,
403 .regshift = 2,
404 .uartclk = 0,
405 }, {
406 },
407};
408
409static struct resource orion5x_uart1_resources[] = {
410 {
411 .start = UART1_PHYS_BASE,
412 .end = UART1_PHYS_BASE + 0xff,
413 .flags = IORESOURCE_MEM,
414 }, {
415 .start = IRQ_ORION5X_UART1,
416 .end = IRQ_ORION5X_UART1,
417 .flags = IORESOURCE_IRQ,
418 },
419};
420
421static struct platform_device orion5x_uart1 = {
422 .name = "serial8250",
423 .id = PLAT8250_DEV_PLATFORM1,
424 .dev = {
425 .platform_data = orion5x_uart1_data,
426 },
427 .resource = orion5x_uart1_resources,
428 .num_resources = ARRAY_SIZE(orion5x_uart1_resources),
429};
430
431void __init orion5x_uart1_init(void) 362void __init orion5x_uart1_init(void)
432{ 363{
433 platform_device_register(&orion5x_uart1); 364 orion_uart1_init(UART1_VIRT_BASE, UART1_PHYS_BASE,
365 IRQ_ORION5X_UART1, orion5x_tclk);
434} 366}
435 367
436
437/***************************************************************************** 368/*****************************************************************************
438 * XOR engine 369 * XOR engine
439 ****************************************************************************/ 370 ****************************************************************************/
@@ -687,8 +618,6 @@ void __init orion5x_init(void)
687 618
688 orion5x_ge00_shared_data.t_clk = orion5x_tclk; 619 orion5x_ge00_shared_data.t_clk = orion5x_tclk;
689 orion5x_spi_plat_data.tclk = orion5x_tclk; 620 orion5x_spi_plat_data.tclk = orion5x_tclk;
690 orion5x_uart0_data[0].uartclk = orion5x_tclk;
691 orion5x_uart1_data[0].uartclk = orion5x_tclk;
692 621
693 /* 622 /*
694 * Setup Orion address map 623 * Setup Orion address map
diff --git a/arch/arm/plat-orion/Makefile b/arch/arm/plat-orion/Makefile
index 56021a72e10..0f048c58b4c 100644
--- a/arch/arm/plat-orion/Makefile
+++ b/arch/arm/plat-orion/Makefile
@@ -2,7 +2,7 @@
2# Makefile for the linux kernel. 2# Makefile for the linux kernel.
3# 3#
4 4
5obj-y := irq.o pcie.o time.o 5obj-y := irq.o pcie.o time.o common.o
6obj-m := 6obj-m :=
7obj-n := 7obj-n :=
8obj- := 8obj- :=
diff --git a/arch/arm/plat-orion/common.c b/arch/arm/plat-orion/common.c
new file mode 100644
index 00000000000..4eac532ae8a
--- /dev/null
+++ b/arch/arm/plat-orion/common.c
@@ -0,0 +1,171 @@
1/*
2 * arch/arm/plat-orion/common.c
3 *
4 * Marvell Orion SoC common setup code used by multiple mach-/common.c
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
16/* Fill in the resources structure and link it into the platform
17 device structure. There is always a memory region, and nearly
18 always an interrupt.*/
19static void fill_resources(struct platform_device *device,
20 struct resource *resources,
21 resource_size_t mapbase,
22 resource_size_t size,
23 unsigned int irq)
24{
25 device->resource = resources;
26 device->num_resources = 1;
27 resources[0].flags = IORESOURCE_MEM;
28 resources[0].start = mapbase;
29 resources[0].end = mapbase + size;
30
31 if (irq != NO_IRQ) {
32 device->num_resources++;
33 resources[1].flags = IORESOURCE_IRQ;
34 resources[1].start = irq;
35 resources[1].end = irq;
36 }
37}
38
39/*****************************************************************************
40 * UART
41 ****************************************************************************/
42static void __init uart_complete(
43 struct platform_device *orion_uart,
44 struct plat_serial8250_port *data,
45 struct resource *resources,
46 unsigned int membase,
47 resource_size_t mapbase,
48 unsigned int irq,
49 unsigned int uartclk)
50{
51 data->mapbase = mapbase;
52 data->membase = (void __iomem *)membase;
53 data->irq = irq;
54 data->uartclk = uartclk;
55 orion_uart->dev.platform_data = data;
56
57 fill_resources(orion_uart, resources, mapbase, 0xff, irq);
58 platform_device_register(orion_uart);
59}
60
61/*****************************************************************************
62 * UART0
63 ****************************************************************************/
64static struct plat_serial8250_port orion_uart0_data[] = {
65 {
66 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
67 .iotype = UPIO_MEM,
68 .regshift = 2,
69 }, {
70 },
71};
72
73static struct resource orion_uart0_resources[2];
74
75static struct platform_device orion_uart0 = {
76 .name = "serial8250",
77 .id = PLAT8250_DEV_PLATFORM,
78};
79
80void __init orion_uart0_init(unsigned int membase,
81 resource_size_t mapbase,
82 unsigned int irq,
83 unsigned int uartclk)
84{
85 uart_complete(&orion_uart0, orion_uart0_data, orion_uart0_resources,
86 membase, mapbase, irq, uartclk);
87}
88
89/*****************************************************************************
90 * UART1
91 ****************************************************************************/
92static struct plat_serial8250_port orion_uart1_data[] = {
93 {
94 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
95 .iotype = UPIO_MEM,
96 .regshift = 2,
97 }, {
98 },
99};
100
101static struct resource orion_uart1_resources[2];
102
103static struct platform_device orion_uart1 = {
104 .name = "serial8250",
105 .id = PLAT8250_DEV_PLATFORM1,
106};
107
108void __init orion_uart1_init(unsigned int membase,
109 resource_size_t mapbase,
110 unsigned int irq,
111 unsigned int uartclk)
112{
113 uart_complete(&orion_uart1, orion_uart1_data, orion_uart1_resources,
114 membase, mapbase, irq, uartclk);
115}
116
117/*****************************************************************************
118 * UART2
119 ****************************************************************************/
120static struct plat_serial8250_port orion_uart2_data[] = {
121 {
122 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
123 .iotype = UPIO_MEM,
124 .regshift = 2,
125 }, {
126 },
127};
128
129static struct resource orion_uart2_resources[2];
130
131static struct platform_device orion_uart2 = {
132 .name = "serial8250",
133 .id = PLAT8250_DEV_PLATFORM2,
134};
135
136void __init orion_uart2_init(unsigned int membase,
137 resource_size_t mapbase,
138 unsigned int irq,
139 unsigned int uartclk)
140{
141 uart_complete(&orion_uart2, orion_uart2_data, orion_uart2_resources,
142 membase, mapbase, irq, uartclk);
143}
144
145/*****************************************************************************
146 * UART3
147 ****************************************************************************/
148static struct plat_serial8250_port orion_uart3_data[] = {
149 {
150 .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
151 .iotype = UPIO_MEM,
152 .regshift = 2,
153 }, {
154 },
155};
156
157static struct resource orion_uart3_resources[2];
158
159static struct platform_device orion_uart3 = {
160 .name = "serial8250",
161 .id = 3,
162};
163
164void __init orion_uart3_init(unsigned int membase,
165 resource_size_t mapbase,
166 unsigned int irq,
167 unsigned int uartclk)
168{
169 uart_complete(&orion_uart3, orion_uart3_data, orion_uart3_resources,
170 membase, mapbase, irq, uartclk);
171}
diff --git a/arch/arm/plat-orion/include/plat/common.h b/arch/arm/plat-orion/include/plat/common.h
new file mode 100644
index 00000000000..92ff9916a1d
--- /dev/null
+++ b/arch/arm/plat-orion/include/plat/common.h
@@ -0,0 +1,33 @@
1/*
2 * arch/arm/plat-orion/include/plat/common.h
3 *
4 * Marvell Orion SoC common setup code used by different mach-/common.c
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 __PLAT_COMMON_H
12
13
14void __init orion_uart0_init(unsigned int membase,
15 resource_size_t mapbase,
16 unsigned int irq,
17 unsigned int uartclk);
18
19void __init orion_uart1_init(unsigned int membase,
20 resource_size_t mapbase,
21 unsigned int irq,
22 unsigned int uartclk);
23
24void __init orion_uart2_init(unsigned int membase,
25 resource_size_t mapbase,
26 unsigned int irq,
27 unsigned int uartclk);
28
29void __init orion_uart3_init(unsigned int membase,
30 resource_size_t mapbase,
31 unsigned int irq,
32 unsigned int uartclk);
33#endif