diff options
Diffstat (limited to 'arch/arm/mach-spear3xx/spear320.c')
-rw-r--r-- | arch/arm/mach-spear3xx/spear320.c | 127 |
1 files changed, 109 insertions, 18 deletions
diff --git a/arch/arm/mach-spear3xx/spear320.c b/arch/arm/mach-spear3xx/spear320.c index 7bd39c0032bd..9c571d0f20c3 100644 --- a/arch/arm/mach-spear3xx/spear320.c +++ b/arch/arm/mach-spear3xx/spear320.c | |||
@@ -3,8 +3,8 @@ | |||
3 | * | 3 | * |
4 | * SPEAr320 machine source file | 4 | * SPEAr320 machine source file |
5 | * | 5 | * |
6 | * Copyright (C) 2009 ST Microelectronics | 6 | * Copyright (C) 2009-2012 ST Microelectronics |
7 | * Viresh Kumar<viresh.kumar@st.com> | 7 | * Viresh Kumar <viresh.kumar@st.com> |
8 | * | 8 | * |
9 | * This file is licensed under the terms of the GNU General Public | 9 | * This file is licensed under the terms of the GNU General Public |
10 | * License version 2. This program is licensed "as is" without any | 10 | * License version 2. This program is licensed "as is" without any |
@@ -13,8 +13,12 @@ | |||
13 | 13 | ||
14 | #define pr_fmt(fmt) "SPEAr320: " fmt | 14 | #define pr_fmt(fmt) "SPEAr320: " fmt |
15 | 15 | ||
16 | #include <linux/ptrace.h> | 16 | #include <linux/amba/pl022.h> |
17 | #include <asm/irq.h> | 17 | #include <linux/amba/pl08x.h> |
18 | #include <linux/amba/serial.h> | ||
19 | #include <linux/of_platform.h> | ||
20 | #include <asm/hardware/vic.h> | ||
21 | #include <asm/mach/arch.h> | ||
18 | #include <plat/shirq.h> | 22 | #include <plat/shirq.h> |
19 | #include <mach/generic.h> | 23 | #include <mach/generic.h> |
20 | #include <mach/hardware.h> | 24 | #include <mach/hardware.h> |
@@ -510,17 +514,79 @@ static struct spear_shirq shirq_intrcomm_ras = { | |||
510 | }, | 514 | }, |
511 | }; | 515 | }; |
512 | 516 | ||
513 | /* Add spear320 specific devices here */ | 517 | /* padmux devices to enable */ |
518 | static struct pmx_dev *spear320_evb_pmx_devs[] = { | ||
519 | /* spear3xx specific devices */ | ||
520 | &spear3xx_pmx_i2c, | ||
521 | &spear3xx_pmx_ssp, | ||
522 | &spear3xx_pmx_mii, | ||
523 | &spear3xx_pmx_uart0, | ||
524 | |||
525 | /* spear320 specific devices */ | ||
526 | &spear320_pmx_fsmc, | ||
527 | &spear320_pmx_sdhci, | ||
528 | &spear320_pmx_i2s, | ||
529 | &spear320_pmx_uart1, | ||
530 | &spear320_pmx_uart2, | ||
531 | &spear320_pmx_can, | ||
532 | &spear320_pmx_pwm0, | ||
533 | &spear320_pmx_pwm1, | ||
534 | &spear320_pmx_pwm2, | ||
535 | &spear320_pmx_mii1, | ||
536 | }; | ||
537 | |||
538 | static struct pl022_ssp_controller spear320_ssp_data[] = { | ||
539 | { | ||
540 | .bus_id = 1, | ||
541 | .enable_dma = 1, | ||
542 | .dma_filter = pl08x_filter_id, | ||
543 | .dma_tx_param = "ssp1_tx", | ||
544 | .dma_rx_param = "ssp1_rx", | ||
545 | .num_chipselect = 2, | ||
546 | }, { | ||
547 | .bus_id = 2, | ||
548 | .enable_dma = 1, | ||
549 | .dma_filter = pl08x_filter_id, | ||
550 | .dma_tx_param = "ssp2_tx", | ||
551 | .dma_rx_param = "ssp2_rx", | ||
552 | .num_chipselect = 2, | ||
553 | } | ||
554 | }; | ||
555 | |||
556 | static struct amba_pl011_data spear320_uart_data[] = { | ||
557 | { | ||
558 | .dma_filter = pl08x_filter_id, | ||
559 | .dma_tx_param = "uart1_tx", | ||
560 | .dma_rx_param = "uart1_rx", | ||
561 | }, { | ||
562 | .dma_filter = pl08x_filter_id, | ||
563 | .dma_tx_param = "uart2_tx", | ||
564 | .dma_rx_param = "uart2_rx", | ||
565 | }, | ||
566 | }; | ||
514 | 567 | ||
515 | /* spear320 routines */ | 568 | /* Add SPEAr310 auxdata to pass platform data */ |
516 | void __init spear320_init(struct pmx_mode *pmx_mode, struct pmx_dev **pmx_devs, | 569 | static struct of_dev_auxdata spear320_auxdata_lookup[] __initdata = { |
517 | u8 pmx_dev_count) | 570 | OF_DEV_AUXDATA("arm,pl022", SPEAR3XX_ICM1_SSP_BASE, NULL, |
571 | &pl022_plat_data), | ||
572 | OF_DEV_AUXDATA("arm,pl022", SPEAR320_SSP0_BASE, NULL, | ||
573 | &spear320_ssp_data[0]), | ||
574 | OF_DEV_AUXDATA("arm,pl022", SPEAR320_SSP1_BASE, NULL, | ||
575 | &spear320_ssp_data[1]), | ||
576 | OF_DEV_AUXDATA("arm,pl011", SPEAR320_UART1_BASE, NULL, | ||
577 | &spear320_uart_data[0]), | ||
578 | OF_DEV_AUXDATA("arm,pl011", SPEAR320_UART2_BASE, NULL, | ||
579 | &spear320_uart_data[1]), | ||
580 | {} | ||
581 | }; | ||
582 | |||
583 | static void __init spear320_dt_init(void) | ||
518 | { | 584 | { |
519 | void __iomem *base; | 585 | void __iomem *base; |
520 | int ret = 0; | 586 | int ret = 0; |
521 | 587 | ||
522 | /* call spear3xx family common init function */ | 588 | of_platform_populate(NULL, of_default_bus_match_table, |
523 | spear3xx_init(); | 589 | spear320_auxdata_lookup, NULL); |
524 | 590 | ||
525 | /* shared irq registration */ | 591 | /* shared irq registration */ |
526 | base = ioremap(SPEAR320_SOC_CONFIG_BASE, SZ_4K); | 592 | base = ioremap(SPEAR320_SOC_CONFIG_BASE, SZ_4K); |
@@ -544,13 +610,38 @@ void __init spear320_init(struct pmx_mode *pmx_mode, struct pmx_dev **pmx_devs, | |||
544 | pr_err("Error registering Shared IRQ 4\n"); | 610 | pr_err("Error registering Shared IRQ 4\n"); |
545 | } | 611 | } |
546 | 612 | ||
547 | /* pmx initialization */ | 613 | if (of_machine_is_compatible("st,spear320-evb")) { |
548 | pmx_driver.base = base; | 614 | /* pmx initialization */ |
549 | pmx_driver.mode = pmx_mode; | 615 | pmx_driver.base = base; |
550 | pmx_driver.devs = pmx_devs; | 616 | pmx_driver.mode = &spear320_auto_net_mii_mode; |
551 | pmx_driver.devs_count = pmx_dev_count; | 617 | pmx_driver.devs = spear320_evb_pmx_devs; |
618 | pmx_driver.devs_count = ARRAY_SIZE(spear320_evb_pmx_devs); | ||
552 | 619 | ||
553 | ret = pmx_register(&pmx_driver); | 620 | ret = pmx_register(&pmx_driver); |
554 | if (ret) | 621 | if (ret) |
555 | pr_err("padmux: registration failed. err no: %d\n", ret); | 622 | pr_err("padmux: registration failed. err no: %d\n", |
623 | ret); | ||
624 | } | ||
556 | } | 625 | } |
626 | |||
627 | static const char * const spear320_dt_board_compat[] = { | ||
628 | "st,spear320", | ||
629 | "st,spear320-evb", | ||
630 | NULL, | ||
631 | }; | ||
632 | |||
633 | static void __init spear320_map_io(void) | ||
634 | { | ||
635 | spear3xx_map_io(); | ||
636 | spear320_clk_init(); | ||
637 | } | ||
638 | |||
639 | DT_MACHINE_START(SPEAR320_DT, "ST SPEAr320 SoC with Flattened Device Tree") | ||
640 | .map_io = spear320_map_io, | ||
641 | .init_irq = spear3xx_dt_init_irq, | ||
642 | .handle_irq = vic_handle_irq, | ||
643 | .timer = &spear3xx_timer, | ||
644 | .init_machine = spear320_dt_init, | ||
645 | .restart = spear_restart, | ||
646 | .dt_compat = spear320_dt_board_compat, | ||
647 | MACHINE_END | ||