aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-spear3xx
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@st.com>2012-03-22 14:47:43 -0400
committerArnd Bergmann <arnd@arndb.de>2012-04-22 16:41:35 -0400
commitc5fa4fdcdbe5f52c3e36892cc81f9378339b00ce (patch)
tree1dbdf4cb9a33637210f69c692aecb57d09c2dfb1 /arch/arm/mach-spear3xx
parent5fb00f965eeac548015bcd45414cccbe53b13d3f (diff)
ARM: SPEAr3xx: Add device-tree support to SPEAr3xx architecture
This patch adds a generic target for SPEAr3xx machines that can be configured via the device-tree. Currently the following devices are supported via the devicetree: - VIC interrupts - PL011 UART - PL061 GPIO - PL110 CLCD - SP805 WDT - Synopsys DW I2C - Synopsys DW ethernet - ST FSMC-NAND - ST SPEAR-SMI - ST SPEAR-KEYBOARD - ST SPEAR-RTC - ARASAN SDHCI-SPEAR - SPEAR-EHCI - SPEAR-OHCI Other peripheral devices will follow in later patches. This also removes IO_ADDRESS macro and creates 16 MB static mappings instead of 4K for individual peripherals. This is done to have efficient TLB lookup for any I/O windows that are located closely together. ioremap() on this range will return this mapping only instead of creating another. Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
Diffstat (limited to 'arch/arm/mach-spear3xx')
-rw-r--r--arch/arm/mach-spear3xx/Kconfig34
-rw-r--r--arch/arm/mach-spear3xx/Makefile13
-rw-r--r--arch/arm/mach-spear3xx/Makefile.boot4
-rw-r--r--arch/arm/mach-spear3xx/clock.c103
-rw-r--r--arch/arm/mach-spear3xx/include/mach/generic.h29
-rw-r--r--arch/arm/mach-spear3xx/include/mach/hardware.h3
-rw-r--r--arch/arm/mach-spear3xx/include/mach/spear.h9
-rw-r--r--arch/arm/mach-spear3xx/spear300.c97
-rw-r--r--arch/arm/mach-spear3xx/spear300_evb.c75
-rw-r--r--arch/arm/mach-spear3xx/spear310.c126
-rw-r--r--arch/arm/mach-spear3xx/spear310_evb.c81
-rw-r--r--arch/arm/mach-spear3xx/spear320.c127
-rw-r--r--arch/arm/mach-spear3xx/spear320_evb.c79
-rw-r--r--arch/arm/mach-spear3xx/spear3xx.c127
14 files changed, 428 insertions, 479 deletions
diff --git a/arch/arm/mach-spear3xx/Kconfig b/arch/arm/mach-spear3xx/Kconfig
index 2cee6b0de371..d9fe11cb6f16 100644
--- a/arch/arm/mach-spear3xx/Kconfig
+++ b/arch/arm/mach-spear3xx/Kconfig
@@ -5,39 +5,19 @@
5if ARCH_SPEAR3XX 5if ARCH_SPEAR3XX
6 6
7menu "SPEAr3xx Implementations" 7menu "SPEAr3xx Implementations"
8config BOARD_SPEAR300_EVB
9 bool "SPEAr300 Evaluation Board"
10 select MACH_SPEAR300
11 help
12 Supports ST SPEAr300 Evaluation Board
13
14config BOARD_SPEAR310_EVB
15 bool "SPEAr310 Evaluation Board"
16 select MACH_SPEAR310
17 help
18 Supports ST SPEAr310 Evaluation Board
19
20config BOARD_SPEAR320_EVB
21 bool "SPEAr320 Evaluation Board"
22 select MACH_SPEAR320
23 help
24 Supports ST SPEAr320 Evaluation Board
25
26endmenu
27
28config MACH_SPEAR300 8config MACH_SPEAR300
29 bool "SPEAr300" 9 bool "SPEAr300 Machine support with Device Tree"
30 help 10 help
31 Supports ST SPEAr300 Machine 11 Supports ST SPEAr300 machine configured via the device-tree
32 12
33config MACH_SPEAR310 13config MACH_SPEAR310
34 bool "SPEAr310" 14 bool "SPEAr310 Machine support with Device Tree"
35 help 15 help
36 Supports ST SPEAr310 Machine 16 Supports ST SPEAr310 machine configured via the device-tree
37 17
38config MACH_SPEAR320 18config MACH_SPEAR320
39 bool "SPEAr320" 19 bool "SPEAr320 Machine support with Device Tree"
40 help 20 help
41 Supports ST SPEAr320 Machine 21 Supports ST SPEAr320 machine configured via the device-tree
42 22endmenu
43endif #ARCH_SPEAR3XX 23endif #ARCH_SPEAR3XX
diff --git a/arch/arm/mach-spear3xx/Makefile b/arch/arm/mach-spear3xx/Makefile
index b24862489704..17b5d83cf2d5 100644
--- a/arch/arm/mach-spear3xx/Makefile
+++ b/arch/arm/mach-spear3xx/Makefile
@@ -3,24 +3,13 @@
3# 3#
4 4
5# common files 5# common files
6obj-y += spear3xx.o clock.o 6obj-$(CONFIG_ARCH_SPEAR3XX) += spear3xx.o clock.o
7 7
8# spear300 specific files 8# spear300 specific files
9obj-$(CONFIG_MACH_SPEAR300) += spear300.o 9obj-$(CONFIG_MACH_SPEAR300) += spear300.o
10 10
11# spear300 boards files
12obj-$(CONFIG_BOARD_SPEAR300_EVB) += spear300_evb.o
13
14
15# spear310 specific files 11# spear310 specific files
16obj-$(CONFIG_MACH_SPEAR310) += spear310.o 12obj-$(CONFIG_MACH_SPEAR310) += spear310.o
17 13
18# spear310 boards files
19obj-$(CONFIG_BOARD_SPEAR310_EVB) += spear310_evb.o
20
21
22# spear320 specific files 14# spear320 specific files
23obj-$(CONFIG_MACH_SPEAR320) += spear320.o 15obj-$(CONFIG_MACH_SPEAR320) += spear320.o
24
25# spear320 boards files
26obj-$(CONFIG_BOARD_SPEAR320_EVB) += spear320_evb.o
diff --git a/arch/arm/mach-spear3xx/Makefile.boot b/arch/arm/mach-spear3xx/Makefile.boot
index 4674a4c221db..d93e2177e6ec 100644
--- a/arch/arm/mach-spear3xx/Makefile.boot
+++ b/arch/arm/mach-spear3xx/Makefile.boot
@@ -1,3 +1,7 @@
1zreladdr-y += 0x00008000 1zreladdr-y += 0x00008000
2params_phys-y := 0x00000100 2params_phys-y := 0x00000100
3initrd_phys-y := 0x00800000 3initrd_phys-y := 0x00800000
4
5dtb-$(CONFIG_MACH_SPEAR300) += spear300-evb.dtb
6dtb-$(CONFIG_MACH_SPEAR310) += spear310-evb.dtb
7dtb-$(CONFIG_MACH_SPEAR320) += spear320-evb.dtb
diff --git a/arch/arm/mach-spear3xx/clock.c b/arch/arm/mach-spear3xx/clock.c
index 47d4535b6f59..9293c144b24a 100644
--- a/arch/arm/mach-spear3xx/clock.c
+++ b/arch/arm/mach-spear3xx/clock.c
@@ -15,6 +15,7 @@
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/io.h> 16#include <linux/io.h>
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/of_platform.h>
18#include <asm/mach-types.h> 19#include <asm/mach-types.h>
19#include <plat/clock.h> 20#include <plat/clock.h>
20#include <mach/misc_regs.h> 21#include <mach/misc_regs.h>
@@ -673,11 +674,11 @@ static struct clk_lookup spear_clk_lookups[] = {
673 CLKDEV_INIT(NULL, "osc_32k_clk", &osc_32k_clk), 674 CLKDEV_INIT(NULL, "osc_32k_clk", &osc_32k_clk),
674 CLKDEV_INIT(NULL, "osc_24m_clk", &osc_24m_clk), 675 CLKDEV_INIT(NULL, "osc_24m_clk", &osc_24m_clk),
675 /* clock derived from 32 KHz osc clk */ 676 /* clock derived from 32 KHz osc clk */
676 CLKDEV_INIT("rtc-spear", NULL, &rtc_clk), 677 CLKDEV_INIT("fc900000.rtc", NULL, &rtc_clk),
677 /* clock derived from 24 MHz osc clk */ 678 /* clock derived from 24 MHz osc clk */
678 CLKDEV_INIT(NULL, "pll1_clk", &pll1_clk), 679 CLKDEV_INIT(NULL, "pll1_clk", &pll1_clk),
679 CLKDEV_INIT(NULL, "pll3_48m_clk", &pll3_48m_clk), 680 CLKDEV_INIT(NULL, "pll3_48m_clk", &pll3_48m_clk),
680 CLKDEV_INIT("wdt", NULL, &wdt_clk), 681 CLKDEV_INIT("fc880000.wdt", NULL, &wdt_clk),
681 /* clock derived from pll1 clk */ 682 /* clock derived from pll1 clk */
682 CLKDEV_INIT(NULL, "cpu_clk", &cpu_clk), 683 CLKDEV_INIT(NULL, "cpu_clk", &cpu_clk),
683 CLKDEV_INIT(NULL, "ahb_clk", &ahb_clk), 684 CLKDEV_INIT(NULL, "ahb_clk", &ahb_clk),
@@ -686,7 +687,7 @@ static struct clk_lookup spear_clk_lookups[] = {
686 CLKDEV_INIT(NULL, "gpt0_synth_clk", &gpt0_synth_clk), 687 CLKDEV_INIT(NULL, "gpt0_synth_clk", &gpt0_synth_clk),
687 CLKDEV_INIT(NULL, "gpt1_synth_clk", &gpt1_synth_clk), 688 CLKDEV_INIT(NULL, "gpt1_synth_clk", &gpt1_synth_clk),
688 CLKDEV_INIT(NULL, "gpt2_synth_clk", &gpt2_synth_clk), 689 CLKDEV_INIT(NULL, "gpt2_synth_clk", &gpt2_synth_clk),
689 CLKDEV_INIT("uart", NULL, &uart_clk), 690 CLKDEV_INIT("d0000000.serial", NULL, &uart_clk),
690 CLKDEV_INIT("firda", NULL, &firda_clk), 691 CLKDEV_INIT("firda", NULL, &firda_clk),
691 CLKDEV_INIT("gpt0", NULL, &gpt0_clk), 692 CLKDEV_INIT("gpt0", NULL, &gpt0_clk),
692 CLKDEV_INIT("gpt1", NULL, &gpt1_clk), 693 CLKDEV_INIT("gpt1", NULL, &gpt1_clk),
@@ -699,81 +700,95 @@ static struct clk_lookup spear_clk_lookups[] = {
699 CLKDEV_INIT(NULL, "usbh.1_clk", &usbh1_clk), 700 CLKDEV_INIT(NULL, "usbh.1_clk", &usbh1_clk),
700 /* clock derived from ahb clk */ 701 /* clock derived from ahb clk */
701 CLKDEV_INIT(NULL, "apb_clk", &apb_clk), 702 CLKDEV_INIT(NULL, "apb_clk", &apb_clk),
702 CLKDEV_INIT("i2c_designware.0", NULL, &i2c_clk), 703 CLKDEV_INIT("d0180000.i2c", NULL, &i2c_clk),
703 CLKDEV_INIT("dma", NULL, &dma_clk), 704 CLKDEV_INIT("dma", NULL, &dma_clk),
704 CLKDEV_INIT("jpeg", NULL, &jpeg_clk), 705 CLKDEV_INIT("jpeg", NULL, &jpeg_clk),
705 CLKDEV_INIT("gmac", NULL, &gmac_clk), 706 CLKDEV_INIT("e0800000.eth", NULL, &gmac_clk),
706 CLKDEV_INIT("smi", NULL, &smi_clk), 707 CLKDEV_INIT("fc000000.flash", NULL, &smi_clk),
707 CLKDEV_INIT("c3", NULL, &c3_clk), 708 CLKDEV_INIT("c3", NULL, &c3_clk),
708 /* clock derived from apb clk */ 709 /* clock derived from apb clk */
709 CLKDEV_INIT("adc", NULL, &adc_clk), 710 CLKDEV_INIT("adc", NULL, &adc_clk),
710 CLKDEV_INIT("ssp-pl022.0", NULL, &ssp0_clk), 711 CLKDEV_INIT("d0100000.spi", NULL, &ssp0_clk),
711 CLKDEV_INIT("gpio", NULL, &gpio_clk), 712 CLKDEV_INIT("fc980000.gpio", NULL, &gpio_clk),
712}; 713};
713 714
714/* array of all spear 300 clock lookups */ 715/* array of all spear 300 clock lookups */
715#ifdef CONFIG_MACH_SPEAR300 716#ifdef CONFIG_MACH_SPEAR300
716static struct clk_lookup spear300_clk_lookups[] = { 717static struct clk_lookup spear300_clk_lookups[] = {
717 CLKDEV_INIT("clcd", NULL, &clcd_clk), 718 CLKDEV_INIT("60000000.clcd", NULL, &clcd_clk),
718 CLKDEV_INIT("fsmc", NULL, &fsmc_clk), 719 CLKDEV_INIT("94000000.flash", NULL, &fsmc_clk),
719 CLKDEV_INIT("gpio1", NULL, &gpio1_clk), 720 CLKDEV_INIT("a9000000.gpio", NULL, &gpio1_clk),
720 CLKDEV_INIT("keyboard", NULL, &kbd_clk), 721 CLKDEV_INIT("a0000000.kbd", NULL, &kbd_clk),
721 CLKDEV_INIT("sdhci", NULL, &sdhci_clk), 722 CLKDEV_INIT("70000000.sdhci", NULL, &sdhci_clk),
722}; 723};
724
725void __init spear300_clk_init(void)
726{
727 int i;
728
729 for (i = 0; i < ARRAY_SIZE(spear_clk_lookups); i++)
730 clk_register(&spear_clk_lookups[i]);
731
732 for (i = 0; i < ARRAY_SIZE(spear300_clk_lookups); i++)
733 clk_register(&spear300_clk_lookups[i]);
734
735 clk_init();
736}
723#endif 737#endif
724 738
725/* array of all spear 310 clock lookups */ 739/* array of all spear 310 clock lookups */
726#ifdef CONFIG_MACH_SPEAR310 740#ifdef CONFIG_MACH_SPEAR310
727static struct clk_lookup spear310_clk_lookups[] = { 741static struct clk_lookup spear310_clk_lookups[] = {
728 CLKDEV_INIT("fsmc", NULL, &fsmc_clk), 742 CLKDEV_INIT("44000000.flash", NULL, &fsmc_clk),
729 CLKDEV_INIT(NULL, "emi", &emi_clk), 743 CLKDEV_INIT(NULL, "emi", &emi_clk),
730 CLKDEV_INIT("uart1", NULL, &uart1_clk), 744 CLKDEV_INIT("b2000000.serial", NULL, &uart1_clk),
731 CLKDEV_INIT("uart2", NULL, &uart2_clk), 745 CLKDEV_INIT("b2080000.serial", NULL, &uart2_clk),
732 CLKDEV_INIT("uart3", NULL, &uart3_clk), 746 CLKDEV_INIT("b2100000.serial", NULL, &uart3_clk),
733 CLKDEV_INIT("uart4", NULL, &uart4_clk), 747 CLKDEV_INIT("b2180000.serial", NULL, &uart4_clk),
734 CLKDEV_INIT("uart5", NULL, &uart5_clk), 748 CLKDEV_INIT("b2200000.serial", NULL, &uart5_clk),
735}; 749};
750
751void __init spear310_clk_init(void)
752{
753 int i;
754
755 for (i = 0; i < ARRAY_SIZE(spear_clk_lookups); i++)
756 clk_register(&spear_clk_lookups[i]);
757
758 for (i = 0; i < ARRAY_SIZE(spear310_clk_lookups); i++)
759 clk_register(&spear310_clk_lookups[i]);
760
761 clk_init();
762}
736#endif 763#endif
737 764
738/* array of all spear 320 clock lookups */ 765/* array of all spear 320 clock lookups */
739#ifdef CONFIG_MACH_SPEAR320 766#ifdef CONFIG_MACH_SPEAR320
740static struct clk_lookup spear320_clk_lookups[] = { 767static struct clk_lookup spear320_clk_lookups[] = {
741 CLKDEV_INIT("clcd", NULL, &clcd_clk), 768 CLKDEV_INIT("90000000.clcd", NULL, &clcd_clk),
742 CLKDEV_INIT("fsmc", NULL, &fsmc_clk), 769 CLKDEV_INIT("4c000000.flash", NULL, &fsmc_clk),
743 CLKDEV_INIT("i2c_designware.1", NULL, &i2c1_clk), 770 CLKDEV_INIT("a7000000.i2c", NULL, &i2c1_clk),
744 CLKDEV_INIT(NULL, "emi", &emi_clk), 771 CLKDEV_INIT(NULL, "emi", &emi_clk),
745 CLKDEV_INIT("pwm", NULL, &pwm_clk), 772 CLKDEV_INIT("pwm", NULL, &pwm_clk),
746 CLKDEV_INIT("sdhci", NULL, &sdhci_clk), 773 CLKDEV_INIT("70000000.sdhci", NULL, &sdhci_clk),
747 CLKDEV_INIT("c_can_platform.0", NULL, &can0_clk), 774 CLKDEV_INIT("c_can_platform.0", NULL, &can0_clk),
748 CLKDEV_INIT("c_can_platform.1", NULL, &can1_clk), 775 CLKDEV_INIT("c_can_platform.1", NULL, &can1_clk),
749 CLKDEV_INIT("ssp-pl022.1", NULL, &ssp1_clk), 776 CLKDEV_INIT("a5000000.spi", NULL, &ssp1_clk),
750 CLKDEV_INIT("ssp-pl022.2", NULL, &ssp2_clk), 777 CLKDEV_INIT("a6000000.spi", NULL, &ssp2_clk),
751 CLKDEV_INIT("uart1", NULL, &uart1_clk), 778 CLKDEV_INIT("a3000000.serial", NULL, &uart1_clk),
752 CLKDEV_INIT("uart2", NULL, &uart2_clk), 779 CLKDEV_INIT("a4000000.serial", NULL, &uart2_clk),
753}; 780};
754#endif
755 781
756void __init spear3xx_clk_init(void) 782void __init spear320_clk_init(void)
757{ 783{
758 int i, cnt; 784 int i;
759 struct clk_lookup *lookups;
760
761 if (machine_is_spear300()) {
762 cnt = ARRAY_SIZE(spear300_clk_lookups);
763 lookups = spear300_clk_lookups;
764 } else if (machine_is_spear310()) {
765 cnt = ARRAY_SIZE(spear310_clk_lookups);
766 lookups = spear310_clk_lookups;
767 } else {
768 cnt = ARRAY_SIZE(spear320_clk_lookups);
769 lookups = spear320_clk_lookups;
770 }
771 785
772 for (i = 0; i < ARRAY_SIZE(spear_clk_lookups); i++) 786 for (i = 0; i < ARRAY_SIZE(spear_clk_lookups); i++)
773 clk_register(&spear_clk_lookups[i]); 787 clk_register(&spear_clk_lookups[i]);
774 788
775 for (i = 0; i < cnt; i++) 789 for (i = 0; i < ARRAY_SIZE(spear320_clk_lookups); i++)
776 clk_register(&lookups[i]); 790 clk_register(&spear320_clk_lookups[i]);
777 791
778 clk_init(); 792 clk_init();
779} 793}
794#endif
diff --git a/arch/arm/mach-spear3xx/include/mach/generic.h b/arch/arm/mach-spear3xx/include/mach/generic.h
index 14276e5a98d2..84ee2bbf1338 100644
--- a/arch/arm/mach-spear3xx/include/mach/generic.h
+++ b/arch/arm/mach-spear3xx/include/mach/generic.h
@@ -31,16 +31,13 @@
31#define SPEAR_GPT0_CHAN1_IRQ SPEAR3XX_IRQ_CPU_GPT1_2 31#define SPEAR_GPT0_CHAN1_IRQ SPEAR3XX_IRQ_CPU_GPT1_2
32 32
33/* Add spear3xx family device structure declarations here */ 33/* Add spear3xx family device structure declarations here */
34extern struct amba_device spear3xx_gpio_device;
35extern struct amba_device spear3xx_uart_device;
36extern struct sys_timer spear3xx_timer; 34extern struct sys_timer spear3xx_timer;
35extern struct pl022_ssp_controller pl022_plat_data;
37 36
38/* Add spear3xx family function declarations here */ 37/* Add spear3xx family function declarations here */
39void __init spear3xx_clk_init(void);
40void __init spear_setup_timer(void); 38void __init spear_setup_timer(void);
41void __init spear3xx_map_io(void); 39void __init spear3xx_map_io(void);
42void __init spear3xx_init_irq(void); 40void __init spear3xx_dt_init_irq(void);
43void __init spear3xx_init(void);
44 41
45void spear_restart(char, const char *); 42void spear_restart(char, const char *);
46 43
@@ -99,9 +96,6 @@ extern struct pmx_dev spear3xx_pmx_plgpio_45_46_49_50;
99 96
100/* spear300 declarations */ 97/* spear300 declarations */
101#ifdef CONFIG_MACH_SPEAR300 98#ifdef CONFIG_MACH_SPEAR300
102/* Add spear300 machine device structure declarations here */
103extern struct amba_device spear300_gpio1_device;
104
105/* pad mux modes */ 99/* pad mux modes */
106extern struct pmx_mode spear300_nand_mode; 100extern struct pmx_mode spear300_nand_mode;
107extern struct pmx_mode spear300_nor_mode; 101extern struct pmx_mode spear300_nor_mode;
@@ -133,16 +127,13 @@ extern struct pmx_dev spear300_pmx_telecom_sdhci_4bit;
133extern struct pmx_dev spear300_pmx_telecom_sdhci_8bit; 127extern struct pmx_dev spear300_pmx_telecom_sdhci_8bit;
134extern struct pmx_dev spear300_pmx_gpio1; 128extern struct pmx_dev spear300_pmx_gpio1;
135 129
136/* Add spear300 machine function declarations here */ 130/* Add spear300 machine declarations here */
137void __init spear300_init(struct pmx_mode *pmx_mode, struct pmx_dev **pmx_devs, 131void __init spear300_clk_init(void);
138 u8 pmx_dev_count);
139 132
140#endif /* CONFIG_MACH_SPEAR300 */ 133#endif /* CONFIG_MACH_SPEAR300 */
141 134
142/* spear310 declarations */ 135/* spear310 declarations */
143#ifdef CONFIG_MACH_SPEAR310 136#ifdef CONFIG_MACH_SPEAR310
144/* Add spear310 machine device structure declarations here */
145
146/* pad mux devices */ 137/* pad mux devices */
147extern struct pmx_dev spear310_pmx_emi_cs_0_1_4_5; 138extern struct pmx_dev spear310_pmx_emi_cs_0_1_4_5;
148extern struct pmx_dev spear310_pmx_emi_cs_2_3; 139extern struct pmx_dev spear310_pmx_emi_cs_2_3;
@@ -153,16 +144,13 @@ extern struct pmx_dev spear310_pmx_fsmc;
153extern struct pmx_dev spear310_pmx_rs485_0_1; 144extern struct pmx_dev spear310_pmx_rs485_0_1;
154extern struct pmx_dev spear310_pmx_tdm0; 145extern struct pmx_dev spear310_pmx_tdm0;
155 146
156/* Add spear310 machine function declarations here */ 147/* Add spear310 machine declarations here */
157void __init spear310_init(struct pmx_mode *pmx_mode, struct pmx_dev **pmx_devs, 148void __init spear310_clk_init(void);
158 u8 pmx_dev_count);
159 149
160#endif /* CONFIG_MACH_SPEAR310 */ 150#endif /* CONFIG_MACH_SPEAR310 */
161 151
162/* spear320 declarations */ 152/* spear320 declarations */
163#ifdef CONFIG_MACH_SPEAR320 153#ifdef CONFIG_MACH_SPEAR320
164/* Add spear320 machine device structure declarations here */
165
166/* pad mux modes */ 154/* pad mux modes */
167extern struct pmx_mode spear320_auto_net_smii_mode; 155extern struct pmx_mode spear320_auto_net_smii_mode;
168extern struct pmx_mode spear320_auto_net_mii_mode; 156extern struct pmx_mode spear320_auto_net_mii_mode;
@@ -193,9 +181,8 @@ extern struct pmx_dev spear320_pmx_smii0;
193extern struct pmx_dev spear320_pmx_smii1; 181extern struct pmx_dev spear320_pmx_smii1;
194extern struct pmx_dev spear320_pmx_i2c1; 182extern struct pmx_dev spear320_pmx_i2c1;
195 183
196/* Add spear320 machine function declarations here */ 184/* Add spear320 machine declarations here */
197void __init spear320_init(struct pmx_mode *pmx_mode, struct pmx_dev **pmx_devs, 185void __init spear320_clk_init(void);
198 u8 pmx_dev_count);
199 186
200#endif /* CONFIG_MACH_SPEAR320 */ 187#endif /* CONFIG_MACH_SPEAR320 */
201 188
diff --git a/arch/arm/mach-spear3xx/include/mach/hardware.h b/arch/arm/mach-spear3xx/include/mach/hardware.h
index 4660c0d8ec0d..defa374f5bee 100644
--- a/arch/arm/mach-spear3xx/include/mach/hardware.h
+++ b/arch/arm/mach-spear3xx/include/mach/hardware.h
@@ -17,7 +17,4 @@
17#include <plat/hardware.h> 17#include <plat/hardware.h>
18#include <mach/spear.h> 18#include <mach/spear.h>
19 19
20/* Vitual to physical translation of statically mapped space */
21#define IO_ADDRESS(x) (x | 0xF0000000)
22
23#endif /* __MACH_HARDWARE_H */ 20#endif /* __MACH_HARDWARE_H */
diff --git a/arch/arm/mach-spear3xx/include/mach/spear.h b/arch/arm/mach-spear3xx/include/mach/spear.h
index 63fd98356919..8e3900aa0d45 100644
--- a/arch/arm/mach-spear3xx/include/mach/spear.h
+++ b/arch/arm/mach-spear3xx/include/mach/spear.h
@@ -25,8 +25,9 @@
25 25
26/* ICM1 - Low speed connection */ 26/* ICM1 - Low speed connection */
27#define SPEAR3XX_ICM1_2_BASE UL(0xD0000000) 27#define SPEAR3XX_ICM1_2_BASE UL(0xD0000000)
28#define VA_SPEAR3XX_ICM1_2_BASE UL(0xFD000000)
28#define SPEAR3XX_ICM1_UART_BASE UL(0xD0000000) 29#define SPEAR3XX_ICM1_UART_BASE UL(0xD0000000)
29#define VA_SPEAR3XX_ICM1_UART_BASE IO_ADDRESS(SPEAR3XX_ICM1_UART_BASE) 30#define VA_SPEAR3XX_ICM1_UART_BASE (VA_SPEAR3XX_ICM1_2_BASE | SPEAR3XX_ICM1_UART_BASE)
30#define SPEAR3XX_ICM1_ADC_BASE UL(0xD0080000) 31#define SPEAR3XX_ICM1_ADC_BASE UL(0xD0080000)
31#define SPEAR3XX_ICM1_SSP_BASE UL(0xD0100000) 32#define SPEAR3XX_ICM1_SSP_BASE UL(0xD0100000)
32#define SPEAR3XX_ICM1_I2C_BASE UL(0xD0180000) 33#define SPEAR3XX_ICM1_I2C_BASE UL(0xD0180000)
@@ -53,11 +54,11 @@
53#define SPEAR3XX_ICM3_ML1_2_BASE UL(0xF0000000) 54#define SPEAR3XX_ICM3_ML1_2_BASE UL(0xF0000000)
54#define SPEAR3XX_ML1_TMR_BASE UL(0xF0000000) 55#define SPEAR3XX_ML1_TMR_BASE UL(0xF0000000)
55#define SPEAR3XX_ML1_VIC_BASE UL(0xF1100000) 56#define SPEAR3XX_ML1_VIC_BASE UL(0xF1100000)
56#define VA_SPEAR3XX_ML1_VIC_BASE IO_ADDRESS(SPEAR3XX_ML1_VIC_BASE)
57 57
58/* ICM3 - Basic Subsystem */ 58/* ICM3 - Basic Subsystem */
59#define SPEAR3XX_ICM3_SMEM_BASE UL(0xF8000000) 59#define SPEAR3XX_ICM3_SMEM_BASE UL(0xF8000000)
60#define SPEAR3XX_ICM3_SMI_CTRL_BASE UL(0xFC000000) 60#define SPEAR3XX_ICM3_SMI_CTRL_BASE UL(0xFC000000)
61#define VA_SPEAR3XX_ICM3_SMI_CTRL_BASE UL(0xFC000000)
61#define SPEAR3XX_ICM3_DMA_BASE UL(0xFC400000) 62#define SPEAR3XX_ICM3_DMA_BASE UL(0xFC400000)
62#define SPEAR3XX_ICM3_SDRAM_CTRL_BASE UL(0xFC600000) 63#define SPEAR3XX_ICM3_SDRAM_CTRL_BASE UL(0xFC600000)
63#define SPEAR3XX_ICM3_TMR0_BASE UL(0xFC800000) 64#define SPEAR3XX_ICM3_TMR0_BASE UL(0xFC800000)
@@ -65,9 +66,9 @@
65#define SPEAR3XX_ICM3_RTC_BASE UL(0xFC900000) 66#define SPEAR3XX_ICM3_RTC_BASE UL(0xFC900000)
66#define SPEAR3XX_ICM3_GPIO_BASE UL(0xFC980000) 67#define SPEAR3XX_ICM3_GPIO_BASE UL(0xFC980000)
67#define SPEAR3XX_ICM3_SYS_CTRL_BASE UL(0xFCA00000) 68#define SPEAR3XX_ICM3_SYS_CTRL_BASE UL(0xFCA00000)
68#define VA_SPEAR3XX_ICM3_SYS_CTRL_BASE IO_ADDRESS(SPEAR3XX_ICM3_SYS_CTRL_BASE) 69#define VA_SPEAR3XX_ICM3_SYS_CTRL_BASE (VA_SPEAR3XX_ICM3_SMI_CTRL_BASE | SPEAR3XX_ICM3_SYS_CTRL_BASE)
69#define SPEAR3XX_ICM3_MISC_REG_BASE UL(0xFCA80000) 70#define SPEAR3XX_ICM3_MISC_REG_BASE UL(0xFCA80000)
70#define VA_SPEAR3XX_ICM3_MISC_REG_BASE IO_ADDRESS(SPEAR3XX_ICM3_MISC_REG_BASE) 71#define VA_SPEAR3XX_ICM3_MISC_REG_BASE (VA_SPEAR3XX_ICM3_SMI_CTRL_BASE | SPEAR3XX_ICM3_MISC_REG_BASE)
71#define SPEAR3XX_ICM3_TMR1_BASE UL(0xFCB00000) 72#define SPEAR3XX_ICM3_TMR1_BASE UL(0xFCB00000)
72 73
73/* Debug uart for linux, will be used for debug and uncompress messages */ 74/* Debug uart for linux, will be used for debug and uncompress messages */
diff --git a/arch/arm/mach-spear3xx/spear300.c b/arch/arm/mach-spear3xx/spear300.c
index adee72bb68ec..c876c6a2caad 100644
--- a/arch/arm/mach-spear3xx/spear300.c
+++ b/arch/arm/mach-spear3xx/spear300.c
@@ -3,8 +3,8 @@
3 * 3 *
4 * SPEAr300 machine source file 4 * SPEAr300 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,10 +13,9 @@
13 13
14#define pr_fmt(fmt) "SPEAr300: " fmt 14#define pr_fmt(fmt) "SPEAr300: " fmt
15 15
16#include <linux/types.h> 16#include <linux/of_platform.h>
17#include <linux/amba/pl061.h> 17#include <asm/hardware/vic.h>
18#include <linux/ptrace.h> 18#include <asm/mach/arch.h>
19#include <asm/irq.h>
20#include <plat/shirq.h> 19#include <plat/shirq.h>
21#include <mach/generic.h> 20#include <mach/generic.h>
22#include <mach/hardware.h> 21#include <mach/hardware.h>
@@ -425,24 +424,35 @@ static struct spear_shirq shirq_ras1 = {
425 }, 424 },
426}; 425};
427 426
428/* Add spear300 specific devices here */ 427/* padmux devices to enable */
429/* arm gpio1 device registration */ 428static struct pmx_dev *spear300_evb_pmx_devs[] = {
430static struct pl061_platform_data gpio1_plat_data = { 429 /* spear3xx specific devices */
431 .gpio_base = 8, 430 &spear3xx_pmx_i2c,
432 .irq_base = SPEAR300_GPIO1_INT_BASE, 431 &spear3xx_pmx_ssp_cs,
432 &spear3xx_pmx_ssp,
433 &spear3xx_pmx_mii,
434 &spear3xx_pmx_uart0,
435
436 /* spear300 specific devices */
437 &spear300_pmx_fsmc_2_chips,
438 &spear300_pmx_clcd,
439 &spear300_pmx_telecom_sdhci_4bit,
440 &spear300_pmx_gpio1,
433}; 441};
434 442
435AMBA_APB_DEVICE(spear300_gpio1, "gpio1", 0, SPEAR300_GPIO_BASE, 443/* Add SPEAr300 auxdata to pass platform data */
436 {SPEAR300_VIRQ_GPIO1}, &gpio1_plat_data); 444static struct of_dev_auxdata spear300_auxdata_lookup[] __initdata = {
445 OF_DEV_AUXDATA("arm,pl022", SPEAR3XX_ICM1_SSP_BASE, NULL,
446 &pl022_plat_data),
447 {}
448};
437 449
438/* spear300 routines */ 450static void __init spear300_dt_init(void)
439void __init spear300_init(struct pmx_mode *pmx_mode, struct pmx_dev **pmx_devs,
440 u8 pmx_dev_count)
441{ 451{
442 int ret = 0; 452 int ret = -EINVAL;
443 453
444 /* call spear3xx family common init function */ 454 of_platform_populate(NULL, of_default_bus_match_table,
445 spear3xx_init(); 455 spear300_auxdata_lookup, NULL);
446 456
447 /* shared irq registration */ 457 /* shared irq registration */
448 shirq_ras1.regs.base = ioremap(SPEAR300_TELECOM_BASE, SZ_4K); 458 shirq_ras1.regs.base = ioremap(SPEAR300_TELECOM_BASE, SZ_4K);
@@ -452,18 +462,45 @@ void __init spear300_init(struct pmx_mode *pmx_mode, struct pmx_dev **pmx_devs,
452 pr_err("Error registering Shared IRQ\n"); 462 pr_err("Error registering Shared IRQ\n");
453 } 463 }
454 464
455 /* pmx initialization */ 465 if (of_machine_is_compatible("st,spear300-evb")) {
456 pmx_driver.mode = pmx_mode; 466 /* pmx initialization */
457 pmx_driver.devs = pmx_devs; 467 pmx_driver.mode = &spear300_photo_frame_mode;
458 pmx_driver.devs_count = pmx_dev_count; 468 pmx_driver.devs = spear300_evb_pmx_devs;
469 pmx_driver.devs_count = ARRAY_SIZE(spear300_evb_pmx_devs);
470
471 pmx_driver.base = ioremap(SPEAR300_SOC_CONFIG_BASE, SZ_4K);
472 if (pmx_driver.base) {
473 ret = pmx_register(&pmx_driver);
474 if (ret)
475 pr_err("padmux: registration failed. err no: %d\n",
476 ret);
477 /* Free Mapping, device selection already done */
478 iounmap(pmx_driver.base);
479 }
459 480
460 pmx_driver.base = ioremap(SPEAR300_SOC_CONFIG_BASE, SZ_4K);
461 if (pmx_driver.base) {
462 ret = pmx_register(&pmx_driver);
463 if (ret) 481 if (ret)
464 pr_err("padmux: registration failed. err no: %d\n", 482 pr_err("Initialization Failed");
465 ret);
466 /* Free Mapping, device selection already done */
467 iounmap(pmx_driver.base);
468 } 483 }
469} 484}
485
486static const char * const spear300_dt_board_compat[] = {
487 "st,spear300",
488 "st,spear300-evb",
489 NULL,
490};
491
492static void __init spear300_map_io(void)
493{
494 spear3xx_map_io();
495 spear300_clk_init();
496}
497
498DT_MACHINE_START(SPEAR300_DT, "ST SPEAr300 SoC with Flattened Device Tree")
499 .map_io = spear300_map_io,
500 .init_irq = spear3xx_dt_init_irq,
501 .handle_irq = vic_handle_irq,
502 .timer = &spear3xx_timer,
503 .init_machine = spear300_dt_init,
504 .restart = spear_restart,
505 .dt_compat = spear300_dt_board_compat,
506MACHINE_END
diff --git a/arch/arm/mach-spear3xx/spear300_evb.c b/arch/arm/mach-spear3xx/spear300_evb.c
deleted file mode 100644
index 3462ab9d6122..000000000000
--- a/arch/arm/mach-spear3xx/spear300_evb.c
+++ /dev/null
@@ -1,75 +0,0 @@
1/*
2 * arch/arm/mach-spear3xx/spear300_evb.c
3 *
4 * SPEAr300 evaluation board source file
5 *
6 * Copyright (C) 2009 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com>
8 *
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
11 * warranty of any kind, whether express or implied.
12 */
13
14#include <asm/hardware/vic.h>
15#include <asm/mach/arch.h>
16#include <asm/mach-types.h>
17#include <mach/generic.h>
18#include <mach/hardware.h>
19
20/* padmux devices to enable */
21static struct pmx_dev *pmx_devs[] = {
22 /* spear3xx specific devices */
23 &spear3xx_pmx_i2c,
24 &spear3xx_pmx_ssp_cs,
25 &spear3xx_pmx_ssp,
26 &spear3xx_pmx_mii,
27 &spear3xx_pmx_uart0,
28
29 /* spear300 specific devices */
30 &spear300_pmx_fsmc_2_chips,
31 &spear300_pmx_clcd,
32 &spear300_pmx_telecom_sdhci_4bit,
33 &spear300_pmx_gpio1,
34};
35
36static struct amba_device *amba_devs[] __initdata = {
37 /* spear3xx specific devices */
38 &spear3xx_gpio_device,
39 &spear3xx_uart_device,
40
41 /* spear300 specific devices */
42 &spear300_gpio1_device,
43};
44
45static struct platform_device *plat_devs[] __initdata = {
46 /* spear3xx specific devices */
47
48 /* spear300 specific devices */
49};
50
51static void __init spear300_evb_init(void)
52{
53 unsigned int i;
54
55 /* call spear300 machine init function */
56 spear300_init(&spear300_photo_frame_mode, pmx_devs,
57 ARRAY_SIZE(pmx_devs));
58
59 /* Add Platform Devices */
60 platform_add_devices(plat_devs, ARRAY_SIZE(plat_devs));
61
62 /* Add Amba Devices */
63 for (i = 0; i < ARRAY_SIZE(amba_devs); i++)
64 amba_device_register(amba_devs[i], &iomem_resource);
65}
66
67MACHINE_START(SPEAR300, "ST-SPEAR300-EVB")
68 .atag_offset = 0x100,
69 .map_io = spear3xx_map_io,
70 .init_irq = spear3xx_init_irq,
71 .handle_irq = vic_handle_irq,
72 .timer = &spear3xx_timer,
73 .init_machine = spear300_evb_init,
74 .restart = spear_restart,
75MACHINE_END
diff --git a/arch/arm/mach-spear3xx/spear310.c b/arch/arm/mach-spear3xx/spear310.c
index b7c28764df92..641fd4cf6bc7 100644
--- a/arch/arm/mach-spear3xx/spear310.c
+++ b/arch/arm/mach-spear3xx/spear310.c
@@ -3,8 +3,8 @@
3 * 3 *
4 * SPEAr310 machine source file 4 * SPEAr310 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,11 @@
13 13
14#define pr_fmt(fmt) "SPEAr310: " fmt 14#define pr_fmt(fmt) "SPEAr310: " fmt
15 15
16#include <linux/ptrace.h> 16#include <linux/amba/pl08x.h>
17#include <asm/irq.h> 17#include <linux/amba/serial.h>
18#include <linux/of_platform.h>
19#include <asm/hardware/vic.h>
20#include <asm/mach/arch.h>
18#include <plat/shirq.h> 21#include <plat/shirq.h>
19#include <mach/generic.h> 22#include <mach/generic.h>
20#include <mach/hardware.h> 23#include <mach/hardware.h>
@@ -257,17 +260,79 @@ static struct spear_shirq shirq_intrcomm_ras = {
257 }, 260 },
258}; 261};
259 262
260/* Add spear310 specific devices here */ 263/* padmux devices to enable */
264static struct pmx_dev *spear310_evb_pmx_devs[] = {
265 /* spear3xx specific devices */
266 &spear3xx_pmx_i2c,
267 &spear3xx_pmx_ssp,
268 &spear3xx_pmx_gpio_pin0,
269 &spear3xx_pmx_gpio_pin1,
270 &spear3xx_pmx_gpio_pin2,
271 &spear3xx_pmx_gpio_pin3,
272 &spear3xx_pmx_gpio_pin4,
273 &spear3xx_pmx_gpio_pin5,
274 &spear3xx_pmx_uart0,
275
276 /* spear310 specific devices */
277 &spear310_pmx_emi_cs_0_1_4_5,
278 &spear310_pmx_emi_cs_2_3,
279 &spear310_pmx_uart1,
280 &spear310_pmx_uart2,
281 &spear310_pmx_uart3_4_5,
282 &spear310_pmx_fsmc,
283 &spear310_pmx_rs485_0_1,
284 &spear310_pmx_tdm0,
285};
286
287/* uart devices plat data */
288static struct amba_pl011_data spear310_uart_data[] = {
289 {
290 .dma_filter = pl08x_filter_id,
291 .dma_tx_param = "uart1_tx",
292 .dma_rx_param = "uart1_rx",
293 }, {
294 .dma_filter = pl08x_filter_id,
295 .dma_tx_param = "uart2_tx",
296 .dma_rx_param = "uart2_rx",
297 }, {
298 .dma_filter = pl08x_filter_id,
299 .dma_tx_param = "uart3_tx",
300 .dma_rx_param = "uart3_rx",
301 }, {
302 .dma_filter = pl08x_filter_id,
303 .dma_tx_param = "uart4_tx",
304 .dma_rx_param = "uart4_rx",
305 }, {
306 .dma_filter = pl08x_filter_id,
307 .dma_tx_param = "uart5_tx",
308 .dma_rx_param = "uart5_rx",
309 },
310};
261 311
262/* spear310 routines */ 312/* Add SPEAr310 auxdata to pass platform data */
263void __init spear310_init(struct pmx_mode *pmx_mode, struct pmx_dev **pmx_devs, 313static struct of_dev_auxdata spear310_auxdata_lookup[] __initdata = {
264 u8 pmx_dev_count) 314 OF_DEV_AUXDATA("arm,pl022", SPEAR3XX_ICM1_SSP_BASE, NULL,
315 &pl022_plat_data),
316 OF_DEV_AUXDATA("arm,pl011", SPEAR310_UART1_BASE, NULL,
317 &spear310_uart_data[0]),
318 OF_DEV_AUXDATA("arm,pl011", SPEAR310_UART2_BASE, NULL,
319 &spear310_uart_data[1]),
320 OF_DEV_AUXDATA("arm,pl011", SPEAR310_UART3_BASE, NULL,
321 &spear310_uart_data[2]),
322 OF_DEV_AUXDATA("arm,pl011", SPEAR310_UART4_BASE, NULL,
323 &spear310_uart_data[3]),
324 OF_DEV_AUXDATA("arm,pl011", SPEAR310_UART5_BASE, NULL,
325 &spear310_uart_data[4]),
326 {}
327};
328
329static void __init spear310_dt_init(void)
265{ 330{
266 void __iomem *base; 331 void __iomem *base;
267 int ret = 0; 332 int ret = 0;
268 333
269 /* call spear3xx family common init function */ 334 of_platform_populate(NULL, of_default_bus_match_table,
270 spear3xx_init(); 335 spear310_auxdata_lookup, NULL);
271 336
272 /* shared irq registration */ 337 /* shared irq registration */
273 base = ioremap(SPEAR310_SOC_CONFIG_BASE, SZ_4K); 338 base = ioremap(SPEAR310_SOC_CONFIG_BASE, SZ_4K);
@@ -297,13 +362,38 @@ void __init spear310_init(struct pmx_mode *pmx_mode, struct pmx_dev **pmx_devs,
297 pr_err("Error registering Shared IRQ 4\n"); 362 pr_err("Error registering Shared IRQ 4\n");
298 } 363 }
299 364
300 /* pmx initialization */ 365 if (of_machine_is_compatible("st,spear310-evb")) {
301 pmx_driver.base = base; 366 /* pmx initialization */
302 pmx_driver.mode = pmx_mode; 367 pmx_driver.base = base;
303 pmx_driver.devs = pmx_devs; 368 pmx_driver.mode = NULL;
304 pmx_driver.devs_count = pmx_dev_count; 369 pmx_driver.devs = spear310_evb_pmx_devs;
370 pmx_driver.devs_count = ARRAY_SIZE(spear310_evb_pmx_devs);
305 371
306 ret = pmx_register(&pmx_driver); 372 ret = pmx_register(&pmx_driver);
307 if (ret) 373 if (ret)
308 pr_err("padmux: registration failed. err no: %d\n", ret); 374 pr_err("padmux: registration failed. err no: %d\n",
375 ret);
376 }
309} 377}
378
379static const char * const spear310_dt_board_compat[] = {
380 "st,spear310",
381 "st,spear310-evb",
382 NULL,
383};
384
385static void __init spear310_map_io(void)
386{
387 spear3xx_map_io();
388 spear310_clk_init();
389}
390
391DT_MACHINE_START(SPEAR310_DT, "ST SPEAr310 SoC with Flattened Device Tree")
392 .map_io = spear310_map_io,
393 .init_irq = spear3xx_dt_init_irq,
394 .handle_irq = vic_handle_irq,
395 .timer = &spear3xx_timer,
396 .init_machine = spear310_dt_init,
397 .restart = spear_restart,
398 .dt_compat = spear310_dt_board_compat,
399MACHINE_END
diff --git a/arch/arm/mach-spear3xx/spear310_evb.c b/arch/arm/mach-spear3xx/spear310_evb.c
deleted file mode 100644
index f92c4993f65a..000000000000
--- a/arch/arm/mach-spear3xx/spear310_evb.c
+++ /dev/null
@@ -1,81 +0,0 @@
1/*
2 * arch/arm/mach-spear3xx/spear310_evb.c
3 *
4 * SPEAr310 evaluation board source file
5 *
6 * Copyright (C) 2009 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com>
8 *
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
11 * warranty of any kind, whether express or implied.
12 */
13
14#include <asm/hardware/vic.h>
15#include <asm/mach/arch.h>
16#include <asm/mach-types.h>
17#include <mach/generic.h>
18#include <mach/hardware.h>
19
20/* padmux devices to enable */
21static struct pmx_dev *pmx_devs[] = {
22 /* spear3xx specific devices */
23 &spear3xx_pmx_i2c,
24 &spear3xx_pmx_ssp,
25 &spear3xx_pmx_gpio_pin0,
26 &spear3xx_pmx_gpio_pin1,
27 &spear3xx_pmx_gpio_pin2,
28 &spear3xx_pmx_gpio_pin3,
29 &spear3xx_pmx_gpio_pin4,
30 &spear3xx_pmx_gpio_pin5,
31 &spear3xx_pmx_uart0,
32
33 /* spear310 specific devices */
34 &spear310_pmx_emi_cs_0_1_4_5,
35 &spear310_pmx_emi_cs_2_3,
36 &spear310_pmx_uart1,
37 &spear310_pmx_uart2,
38 &spear310_pmx_uart3_4_5,
39 &spear310_pmx_fsmc,
40 &spear310_pmx_rs485_0_1,
41 &spear310_pmx_tdm0,
42};
43
44static struct amba_device *amba_devs[] __initdata = {
45 /* spear3xx specific devices */
46 &spear3xx_gpio_device,
47 &spear3xx_uart_device,
48
49 /* spear310 specific devices */
50};
51
52static struct platform_device *plat_devs[] __initdata = {
53 /* spear3xx specific devices */
54
55 /* spear310 specific devices */
56};
57
58static void __init spear310_evb_init(void)
59{
60 unsigned int i;
61
62 /* call spear310 machine init function */
63 spear310_init(NULL, pmx_devs, ARRAY_SIZE(pmx_devs));
64
65 /* Add Platform Devices */
66 platform_add_devices(plat_devs, ARRAY_SIZE(plat_devs));
67
68 /* Add Amba Devices */
69 for (i = 0; i < ARRAY_SIZE(amba_devs); i++)
70 amba_device_register(amba_devs[i], &iomem_resource);
71}
72
73MACHINE_START(SPEAR310, "ST-SPEAR310-EVB")
74 .atag_offset = 0x100,
75 .map_io = spear3xx_map_io,
76 .init_irq = spear3xx_init_irq,
77 .handle_irq = vic_handle_irq,
78 .timer = &spear3xx_timer,
79 .init_machine = spear310_evb_init,
80 .restart = spear_restart,
81MACHINE_END
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 */
518static 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
538static 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
556static 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 */
516void __init spear320_init(struct pmx_mode *pmx_mode, struct pmx_dev **pmx_devs, 569static 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
583static 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
627static const char * const spear320_dt_board_compat[] = {
628 "st,spear320",
629 "st,spear320-evb",
630 NULL,
631};
632
633static void __init spear320_map_io(void)
634{
635 spear3xx_map_io();
636 spear320_clk_init();
637}
638
639DT_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,
647MACHINE_END
diff --git a/arch/arm/mach-spear3xx/spear320_evb.c b/arch/arm/mach-spear3xx/spear320_evb.c
deleted file mode 100644
index 105334ab7021..000000000000
--- a/arch/arm/mach-spear3xx/spear320_evb.c
+++ /dev/null
@@ -1,79 +0,0 @@
1/*
2 * arch/arm/mach-spear3xx/spear320_evb.c
3 *
4 * SPEAr320 evaluation board source file
5 *
6 * Copyright (C) 2009 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com>
8 *
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
11 * warranty of any kind, whether express or implied.
12 */
13
14#include <asm/hardware/vic.h>
15#include <asm/mach/arch.h>
16#include <asm/mach-types.h>
17#include <mach/generic.h>
18#include <mach/hardware.h>
19
20/* padmux devices to enable */
21static struct pmx_dev *pmx_devs[] = {
22 /* spear3xx specific devices */
23 &spear3xx_pmx_i2c,
24 &spear3xx_pmx_ssp,
25 &spear3xx_pmx_mii,
26 &spear3xx_pmx_uart0,
27
28 /* spear320 specific devices */
29 &spear320_pmx_fsmc,
30 &spear320_pmx_sdhci,
31 &spear320_pmx_i2s,
32 &spear320_pmx_uart1,
33 &spear320_pmx_uart2,
34 &spear320_pmx_can,
35 &spear320_pmx_pwm0,
36 &spear320_pmx_pwm1,
37 &spear320_pmx_pwm2,
38 &spear320_pmx_mii1,
39};
40
41static struct amba_device *amba_devs[] __initdata = {
42 /* spear3xx specific devices */
43 &spear3xx_gpio_device,
44 &spear3xx_uart_device,
45
46 /* spear320 specific devices */
47};
48
49static struct platform_device *plat_devs[] __initdata = {
50 /* spear3xx specific devices */
51
52 /* spear320 specific devices */
53};
54
55static void __init spear320_evb_init(void)
56{
57 unsigned int i;
58
59 /* call spear320 machine init function */
60 spear320_init(&spear320_auto_net_mii_mode, pmx_devs,
61 ARRAY_SIZE(pmx_devs));
62
63 /* Add Platform Devices */
64 platform_add_devices(plat_devs, ARRAY_SIZE(plat_devs));
65
66 /* Add Amba Devices */
67 for (i = 0; i < ARRAY_SIZE(amba_devs); i++)
68 amba_device_register(amba_devs[i], &iomem_resource);
69}
70
71MACHINE_START(SPEAR320, "ST-SPEAR320-EVB")
72 .atag_offset = 0x100,
73 .map_io = spear3xx_map_io,
74 .init_irq = spear3xx_init_irq,
75 .handle_irq = vic_handle_irq,
76 .timer = &spear3xx_timer,
77 .init_machine = spear320_evb_init,
78 .restart = spear_restart,
79MACHINE_END
diff --git a/arch/arm/mach-spear3xx/spear3xx.c b/arch/arm/mach-spear3xx/spear3xx.c
index a236925e13b3..a94d8c12ed99 100644
--- a/arch/arm/mach-spear3xx/spear3xx.c
+++ b/arch/arm/mach-spear3xx/spear3xx.c
@@ -3,8 +3,8 @@
3 * 3 *
4 * SPEAr3XX machines common source file 4 * SPEAr3XX machines common 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,76 +13,14 @@
13 13
14#define pr_fmt(fmt) "SPEAr3xx: " fmt 14#define pr_fmt(fmt) "SPEAr3xx: " fmt
15 15
16#include <linux/types.h> 16#include <linux/amba/pl022.h>
17#include <linux/amba/pl061.h> 17#include <linux/amba/pl08x.h>
18#include <linux/ptrace.h> 18#include <linux/of_irq.h>
19#include <linux/io.h> 19#include <linux/io.h>
20#include <asm/hardware/vic.h> 20#include <asm/hardware/vic.h>
21#include <asm/irq.h>
22#include <asm/mach/arch.h>
23#include <mach/generic.h> 21#include <mach/generic.h>
24#include <mach/hardware.h> 22#include <mach/hardware.h>
25 23
26/* Add spear3xx machines common devices here */
27/* gpio device registration */
28static struct pl061_platform_data gpio_plat_data = {
29 .gpio_base = 0,
30 .irq_base = SPEAR3XX_GPIO_INT_BASE,
31};
32
33AMBA_APB_DEVICE(spear3xx_gpio, "gpio", 0, SPEAR3XX_ICM3_GPIO_BASE,
34 {SPEAR3XX_IRQ_BASIC_GPIO}, &gpio_plat_data);
35
36/* uart device registration */
37AMBA_APB_DEVICE(spear3xx_uart, "uart", 0, SPEAR3XX_ICM1_UART_BASE,
38 {SPEAR3XX_IRQ_UART}, NULL);
39
40/* Do spear3xx familiy common initialization part here */
41void __init spear3xx_init(void)
42{
43 /* nothing to do for now */
44}
45
46/* This will initialize vic */
47void __init spear3xx_init_irq(void)
48{
49 vic_init((void __iomem *)VA_SPEAR3XX_ML1_VIC_BASE, 0, ~0, 0);
50}
51
52/* Following will create static virtual/physical mappings */
53struct map_desc spear3xx_io_desc[] __initdata = {
54 {
55 .virtual = VA_SPEAR3XX_ICM1_UART_BASE,
56 .pfn = __phys_to_pfn(SPEAR3XX_ICM1_UART_BASE),
57 .length = SZ_4K,
58 .type = MT_DEVICE
59 }, {
60 .virtual = VA_SPEAR3XX_ML1_VIC_BASE,
61 .pfn = __phys_to_pfn(SPEAR3XX_ML1_VIC_BASE),
62 .length = SZ_4K,
63 .type = MT_DEVICE
64 }, {
65 .virtual = VA_SPEAR3XX_ICM3_SYS_CTRL_BASE,
66 .pfn = __phys_to_pfn(SPEAR3XX_ICM3_SYS_CTRL_BASE),
67 .length = SZ_4K,
68 .type = MT_DEVICE
69 }, {
70 .virtual = VA_SPEAR3XX_ICM3_MISC_REG_BASE,
71 .pfn = __phys_to_pfn(SPEAR3XX_ICM3_MISC_REG_BASE),
72 .length = SZ_4K,
73 .type = MT_DEVICE
74 },
75};
76
77/* This will create static memory mapping for selected devices */
78void __init spear3xx_map_io(void)
79{
80 iotable_init(spear3xx_io_desc, ARRAY_SIZE(spear3xx_io_desc));
81
82 /* This will initialize clock framework */
83 spear3xx_clk_init();
84}
85
86/* pad multiplexing support */ 24/* pad multiplexing support */
87/* devices */ 25/* devices */
88static struct pmx_dev_mode pmx_firda_modes[] = { 26static struct pmx_dev_mode pmx_firda_modes[] = {
@@ -508,6 +446,51 @@ struct pmx_dev spear3xx_pmx_plgpio_45_46_49_50 = {
508}; 446};
509#endif /* CONFIG_MACH_SPEAR310 || CONFIG_MACH_SPEAR320 */ 447#endif /* CONFIG_MACH_SPEAR310 || CONFIG_MACH_SPEAR320 */
510 448
449/* ssp device registration */
450struct pl022_ssp_controller pl022_plat_data = {
451 .bus_id = 0,
452 .enable_dma = 1,
453 .dma_filter = pl08x_filter_id,
454 .dma_tx_param = "ssp0_tx",
455 .dma_rx_param = "ssp0_rx",
456 /*
457 * This is number of spi devices that can be connected to spi. There are
458 * two type of chipselects on which slave devices can work. One is chip
459 * select provided by spi masters other is controlled through external
460 * gpio's. We can't use chipselect provided from spi master (because as
461 * soon as FIFO becomes empty, CS is disabled and transfer ends). So
462 * this number now depends on number of gpios available for spi. each
463 * slave on each master requires a separate gpio pin.
464 */
465 .num_chipselect = 2,
466};
467
468/*
469 * Following will create 16MB static virtual/physical mappings
470 * PHYSICAL VIRTUAL
471 * 0xD0000000 0xFD000000
472 * 0xFC000000 0xFC000000
473 */
474struct map_desc spear3xx_io_desc[] __initdata = {
475 {
476 .virtual = VA_SPEAR3XX_ICM1_2_BASE,
477 .pfn = __phys_to_pfn(SPEAR3XX_ICM1_2_BASE),
478 .length = SZ_16M,
479 .type = MT_DEVICE
480 }, {
481 .virtual = VA_SPEAR3XX_ICM3_SMI_CTRL_BASE,
482 .pfn = __phys_to_pfn(SPEAR3XX_ICM3_SMI_CTRL_BASE),
483 .length = SZ_16M,
484 .type = MT_DEVICE
485 },
486};
487
488/* This will create static memory mapping for selected devices */
489void __init spear3xx_map_io(void)
490{
491 iotable_init(spear3xx_io_desc, ARRAY_SIZE(spear3xx_io_desc));
492}
493
511static void __init spear3xx_timer_init(void) 494static void __init spear3xx_timer_init(void)
512{ 495{
513 char pclk_name[] = "pll3_48m_clk"; 496 char pclk_name[] = "pll3_48m_clk";
@@ -538,3 +521,13 @@ static void __init spear3xx_timer_init(void)
538struct sys_timer spear3xx_timer = { 521struct sys_timer spear3xx_timer = {
539 .init = spear3xx_timer_init, 522 .init = spear3xx_timer_init,
540}; 523};
524
525static const struct of_device_id vic_of_match[] __initconst = {
526 { .compatible = "arm,pl190-vic", .data = vic_of_init, },
527 { /* Sentinel */ }
528};
529
530void __init spear3xx_dt_init_irq(void)
531{
532 of_irq_init(vic_of_match);
533}