aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorOlof Johansson <olof@lixom.net>2015-02-06 02:58:29 -0500
committerOlof Johansson <olof@lixom.net>2015-02-06 02:58:29 -0500
commitdf1a66812535e04bfd960e15d5be4893853b6730 (patch)
treeb7ac004b02ebfb95c66025af20faab3d3fa90124 /arch/arm
parentee481c84fa0675c94fd4443f6da5be836664d821 (diff)
parentad3fc3e316891cbc4f33116a61c57c4a9b2a2518 (diff)
Merge tag 'at91-soc4' of git://git.kernel.org/pub/scm/linux/kernel/git/nferre/linux-at91 into next/soc
Merge "at91: cleanup/soc for 3.20 #4" from Nicolas Ferre: Fourth cleanup/soc batch for 3.20: - merge all the at91sam9 code and remove the empty SoC-specific files - remove the at91_boot_soc that is now useless in a DT context - move the sram code in PM code as it's now only used there - some file + function name changes after this big cleanup * tag 'at91-soc4' of git://git.kernel.org/pub/scm/linux/kernel/git/nferre/linux-at91: ARM: at91/trivial: unify functions and machine names ARM: at91: remove at91_dt_initialize and machine init_early() ARM: at91: change board files into SoC files ARM: at91: remove at91_boot_soc ARM: at91: move alternative initial mapping to board-dt-sama5.c ARM: at91: merge all SOC_AT91SAM9xxx ARM: at91: at91rm9200: set idle and restart from rm9200_dt_device_init() ARM: at91: board-dt-sama5: add phy_fixup to override NAND_Tree ARM: at91/dt: sam9263: Add missing clocks to lcdc node ARM: at91: sama5d3: dt: correct the sound route ARM: at91/dt: sama5d4: fix the timer reg length Signed-off-by: Olof Johansson <olof@lixom.net>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/boot/dts/at91sam9263.dtsi2
-rw-r--r--arch/arm/boot/dts/sama5d3xmb.dtsi2
-rw-r--r--arch/arm/boot/dts/sama5d4.dtsi2
-rw-r--r--arch/arm/configs/at91_dt_defconfig10
-rw-r--r--arch/arm/mach-at91/Kconfig92
-rw-r--r--arch/arm/mach-at91/Makefile18
-rw-r--r--arch/arm/mach-at91/at91rm9200.c57
-rw-r--r--arch/arm/mach-at91/at91sam9.c (renamed from arch/arm/mach-at91/board-dt-sam9.c)33
-rw-r--r--arch/arm/mach-at91/at91sam9260.c26
-rw-r--r--arch/arm/mach-at91/at91sam9261.c25
-rw-r--r--arch/arm/mach-at91/at91sam9263.c24
-rw-r--r--arch/arm/mach-at91/at91sam9g45.c24
-rw-r--r--arch/arm/mach-at91/at91sam9n12.c20
-rw-r--r--arch/arm/mach-at91/at91sam9rl.c25
-rw-r--r--arch/arm/mach-at91/at91sam9x5.c20
-rw-r--r--arch/arm/mach-at91/board-dt-rm9200.c54
-rw-r--r--arch/arm/mach-at91/board-dt-sama5.c60
-rw-r--r--arch/arm/mach-at91/generic.h19
-rw-r--r--arch/arm/mach-at91/include/mach/cpu.h52
-rw-r--r--arch/arm/mach-at91/pm.c52
-rw-r--r--arch/arm/mach-at91/sama5.c111
-rw-r--r--arch/arm/mach-at91/sama5d3.c29
-rw-r--r--arch/arm/mach-at91/sama5d4.c63
-rw-r--r--arch/arm/mach-at91/setup.c77
-rw-r--r--arch/arm/mach-at91/soc.h77
25 files changed, 268 insertions, 706 deletions
diff --git a/arch/arm/boot/dts/at91sam9263.dtsi b/arch/arm/boot/dts/at91sam9263.dtsi
index 8a210d5033b1..e087a93bea26 100644
--- a/arch/arm/boot/dts/at91sam9263.dtsi
+++ b/arch/arm/boot/dts/at91sam9263.dtsi
@@ -963,6 +963,8 @@
963 interrupts = <26 IRQ_TYPE_LEVEL_HIGH 3>; 963 interrupts = <26 IRQ_TYPE_LEVEL_HIGH 3>;
964 pinctrl-names = "default"; 964 pinctrl-names = "default";
965 pinctrl-0 = <&pinctrl_fb>; 965 pinctrl-0 = <&pinctrl_fb>;
966 clocks = <&lcd_clk>, <&lcd_clk>;
967 clock-names = "lcdc_clk", "hclk";
966 status = "disabled"; 968 status = "disabled";
967 }; 969 };
968 970
diff --git a/arch/arm/boot/dts/sama5d3xmb.dtsi b/arch/arm/boot/dts/sama5d3xmb.dtsi
index 9fdb8a07b145..be2ccc53abb5 100644
--- a/arch/arm/boot/dts/sama5d3xmb.dtsi
+++ b/arch/arm/boot/dts/sama5d3xmb.dtsi
@@ -208,7 +208,7 @@
208 "Headphone Jack", "HPOUTR", 208 "Headphone Jack", "HPOUTR",
209 "IN2L", "Line In Jack", 209 "IN2L", "Line In Jack",
210 "IN2R", "Line In Jack", 210 "IN2R", "Line In Jack",
211 "MICBIAS", "IN1L", 211 "Mic", "MICBIAS",
212 "IN1L", "Mic"; 212 "IN1L", "Mic";
213 213
214 atmel,ssc-controller = <&ssc0>; 214 atmel,ssc-controller = <&ssc0>;
diff --git a/arch/arm/boot/dts/sama5d4.dtsi b/arch/arm/boot/dts/sama5d4.dtsi
index 1b4fe4e19721..2a31d66164ac 100644
--- a/arch/arm/boot/dts/sama5d4.dtsi
+++ b/arch/arm/boot/dts/sama5d4.dtsi
@@ -1018,7 +1018,7 @@
1018 1018
1019 pit: timer@fc068630 { 1019 pit: timer@fc068630 {
1020 compatible = "atmel,at91sam9260-pit"; 1020 compatible = "atmel,at91sam9260-pit";
1021 reg = <0xfc068630 0xf>; 1021 reg = <0xfc068630 0x10>;
1022 interrupts = <3 IRQ_TYPE_LEVEL_HIGH 5>; 1022 interrupts = <3 IRQ_TYPE_LEVEL_HIGH 5>;
1023 clocks = <&h32ck>; 1023 clocks = <&h32ck>;
1024 }; 1024 };
diff --git a/arch/arm/configs/at91_dt_defconfig b/arch/arm/configs/at91_dt_defconfig
index a67375f24b21..f2670f638e97 100644
--- a/arch/arm/configs/at91_dt_defconfig
+++ b/arch/arm/configs/at91_dt_defconfig
@@ -15,15 +15,7 @@ CONFIG_MODULE_UNLOAD=y
15# CONFIG_IOSCHED_CFQ is not set 15# CONFIG_IOSCHED_CFQ is not set
16CONFIG_ARCH_AT91=y 16CONFIG_ARCH_AT91=y
17CONFIG_SOC_AT91RM9200=y 17CONFIG_SOC_AT91RM9200=y
18CONFIG_SOC_AT91SAM9260=y 18CONFIG_SOC_AT91SAM9=y
19CONFIG_SOC_AT91SAM9261=y
20CONFIG_SOC_AT91SAM9263=y
21CONFIG_SOC_AT91SAM9RL=y
22CONFIG_SOC_AT91SAM9G45=y
23CONFIG_SOC_AT91SAM9X5=y
24CONFIG_SOC_AT91SAM9N12=y
25CONFIG_MACH_AT91RM9200_DT=y
26CONFIG_MACH_AT91SAM9_DT=y
27CONFIG_AT91_TIMER_HZ=128 19CONFIG_AT91_TIMER_HZ=128
28CONFIG_AEABI=y 20CONFIG_AEABI=y
29CONFIG_UACCESS_WITH_MEMCPY=y 21CONFIG_UACCESS_WITH_MEMCPY=y
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index c6956b863b9d..c6740e359a44 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -16,15 +16,6 @@ config HAVE_AT91_SMD
16config HAVE_AT91_H32MX 16config HAVE_AT91_H32MX
17 bool 17 bool
18 18
19config SOC_AT91SAM9
20 bool
21 select ATMEL_AIC_IRQ
22 select COMMON_CLK_AT91
23 select CPU_ARM926T
24 select GENERIC_CLOCKEVENTS
25 select MEMORY
26 select ATMEL_SDRAMC
27
28config SOC_SAMA5 19config SOC_SAMA5
29 bool 20 bool
30 select ATMEL_AIC5_IRQ 21 select ATMEL_AIC5_IRQ
@@ -92,67 +83,36 @@ config SOC_AT91RM9200
92 select GENERIC_CLOCKEVENTS 83 select GENERIC_CLOCKEVENTS
93 select HAVE_AT91_USB_CLK 84 select HAVE_AT91_USB_CLK
94 85
95config SOC_AT91SAM9260 86config SOC_AT91SAM9
96 bool "AT91SAM9260, AT91SAM9XE or AT91SAM9G20" 87 bool "AT91SAM9"
97 select SOC_AT91SAM9 88 select ATMEL_AIC_IRQ
98 select HAVE_AT91_USB_CLK 89 select ATMEL_SDRAMC
99 help 90 select COMMON_CLK_AT91
100 Select this if you are using one of Atmel's AT91SAM9260, AT91SAM9XE 91 select CPU_ARM926T
101 or AT91SAM9G20 SoC. 92 select GENERIC_CLOCKEVENTS
102
103config SOC_AT91SAM9261
104 bool "AT91SAM9261 or AT91SAM9G10"
105 select HAVE_FB_ATMEL
106 select SOC_AT91SAM9
107 select HAVE_AT91_USB_CLK
108 help
109 Select this if you are using one of Atmel's AT91SAM9261 or AT91SAM9G10 SoC.
110
111config SOC_AT91SAM9263
112 bool "AT91SAM9263"
113 select HAVE_FB_ATMEL
114 select SOC_AT91SAM9
115 select HAVE_AT91_USB_CLK
116
117config SOC_AT91SAM9RL
118 bool "AT91SAM9RL"
119 select HAVE_FB_ATMEL
120 select SOC_AT91SAM9
121 select HAVE_AT91_UTMI
122
123config SOC_AT91SAM9G45
124 bool "AT91SAM9G45 or AT91SAM9M10 families"
125 select HAVE_FB_ATMEL
126 select SOC_AT91SAM9
127 select HAVE_AT91_UTMI
128 select HAVE_AT91_USB_CLK
129 help
130 Select this if you are using one of Atmel's AT91SAM9G45 family SoC.
131 This support covers AT91SAM9G45, AT91SAM9G46, AT91SAM9M10 and AT91SAM9M11.
132
133config SOC_AT91SAM9X5
134 bool "AT91SAM9x5 family"
135 select HAVE_FB_ATMEL
136 select SOC_AT91SAM9
137 select HAVE_AT91_UTMI
138 select HAVE_AT91_SMD 93 select HAVE_AT91_SMD
139 select HAVE_AT91_USB_CLK 94 select HAVE_AT91_USB_CLK
140 help 95 select HAVE_AT91_UTMI
141 Select this if you are using one of Atmel's AT91SAM9x5 family SoC.
142 This means that your SAM9 name finishes with a '5' (except if it is
143 AT91SAM9G45!).
144 This support covers AT91SAM9G15, AT91SAM9G25, AT91SAM9X25, AT91SAM9G35
145 and AT91SAM9X35.
146
147config SOC_AT91SAM9N12
148 bool "AT91SAM9N12 family"
149 select HAVE_FB_ATMEL 96 select HAVE_FB_ATMEL
150 select SOC_AT91SAM9 97 select MEMORY
151 select HAVE_AT91_USB_CLK
152 help 98 help
153 Select this if you are using Atmel's AT91SAM9N12 SoC. 99 Select this if you are using one of those Atmel SoC:
154 100 AT91SAM9260
155# ---------------------------------------------------------- 101 AT91SAM9261
102 AT91SAM9263
103 AT91SAM9G15
104 AT91SAM9G20
105 AT91SAM9G25
106 AT91SAM9G35
107 AT91SAM9G45
108 AT91SAM9G46
109 AT91SAM9M10
110 AT91SAM9M11
111 AT91SAM9N12
112 AT91SAM9RL
113 AT91SAM9X25
114 AT91SAM9X35
115 AT91SAM9XE
156endif # SOC_SAM_V4_V5 116endif # SOC_SAM_V4_V5
157 117
158comment "AT91 Feature Selections" 118comment "AT91 Feature Selections"
diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile
index 8ef7d9a2e855..827fdbcce1c7 100644
--- a/arch/arm/mach-at91/Makefile
+++ b/arch/arm/mach-at91/Makefile
@@ -8,22 +8,8 @@ obj-$(CONFIG_SOC_AT91SAM9) += sam9_smc.o
8 8
9# CPU-specific support 9# CPU-specific support
10obj-$(CONFIG_SOC_AT91RM9200) += at91rm9200.o at91rm9200_time.o 10obj-$(CONFIG_SOC_AT91RM9200) += at91rm9200.o at91rm9200_time.o
11obj-$(CONFIG_SOC_AT91SAM9260) += at91sam9260.o 11obj-$(CONFIG_SOC_AT91SAM9) += at91sam9.o
12obj-$(CONFIG_SOC_AT91SAM9261) += at91sam9261.o 12obj-$(CONFIG_SOC_SAMA5) += sama5.o
13obj-$(CONFIG_SOC_AT91SAM9263) += at91sam9263.o
14obj-$(CONFIG_SOC_AT91SAM9G45) += at91sam9g45.o
15obj-$(CONFIG_SOC_AT91SAM9N12) += at91sam9n12.o
16obj-$(CONFIG_SOC_AT91SAM9X5) += at91sam9x5.o
17obj-$(CONFIG_SOC_AT91SAM9RL) += at91sam9rl.o
18obj-$(CONFIG_SOC_SAMA5D3) += sama5d3.o
19obj-$(CONFIG_SOC_SAMA5D4) += sama5d4.o
20
21# AT91SAM board with device-tree
22obj-$(CONFIG_SOC_AT91RM9200) += board-dt-rm9200.o
23obj-$(CONFIG_SOC_AT91SAM9) += board-dt-sam9.o
24
25# SAMA5 board with device-tree
26obj-$(CONFIG_SOC_SAMA5) += board-dt-sama5.o
27 13
28# Power Management 14# Power Management
29obj-$(CONFIG_PM) += pm.o 15obj-$(CONFIG_PM) += pm.o
diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-at91/at91rm9200.c
index 3be1963f5c56..8fcfb70f7124 100644
--- a/arch/arm/mach-at91/at91rm9200.c
+++ b/arch/arm/mach-at91/at91rm9200.c
@@ -1,27 +1,33 @@
1/* 1/*
2 * arch/arm/mach-at91/at91rm9200.c 2 * Setup code for AT91RM9200
3 * 3 *
4 * Copyright (C) 2005 SAN People 4 * Copyright (C) 2011 Atmel,
5 * 5 * 2011 Nicolas Ferre <nicolas.ferre@atmel.com>
6 * This program is free software; you can redistribute it and/or modify 6 * 2012 Joachim Eastwood <manabian@gmail.com>
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 * 7 *
8 * Licensed under GPLv2 or later.
11 */ 9 */
12 10
11#include <linux/types.h>
12#include <linux/init.h>
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/clk/at91_pmc.h> 14#include <linux/gpio.h>
15#include <linux/of.h>
16#include <linux/of_irq.h>
17#include <linux/of_platform.h>
18#include <linux/clk-provider.h>
15 19
20#include <asm/setup.h>
21#include <asm/irq.h>
22#include <asm/mach/arch.h>
16#include <asm/mach/map.h> 23#include <asm/mach/map.h>
24#include <asm/mach/irq.h>
17#include <asm/system_misc.h> 25#include <asm/system_misc.h>
26
18#include <mach/at91_st.h> 27#include <mach/at91_st.h>
19#include <mach/hardware.h>
20 28
21#include "soc.h"
22#include "generic.h" 29#include "generic.h"
23 30
24
25static void at91rm9200_restart(enum reboot_mode reboot_mode, const char *cmd) 31static void at91rm9200_restart(enum reboot_mode reboot_mode, const char *cmd)
26{ 32{
27 /* 33 /*
@@ -31,16 +37,31 @@ static void at91rm9200_restart(enum reboot_mode reboot_mode, const char *cmd)
31 at91_st_write(AT91_ST_CR, AT91_ST_WDRST); 37 at91_st_write(AT91_ST_CR, AT91_ST_WDRST);
32} 38}
33 39
34/* -------------------------------------------------------------------- 40static void __init at91rm9200_dt_timer_init(void)
35 * AT91RM9200 processor initialization 41{
36 * -------------------------------------------------------------------- */ 42 of_clk_init(NULL);
43 at91rm9200_timer_init();
44}
37 45
38static void __init at91rm9200_initialize(void) 46static void __init at91rm9200_dt_device_init(void)
39{ 47{
48 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
49
40 arm_pm_idle = at91rm9200_idle; 50 arm_pm_idle = at91rm9200_idle;
41 arm_pm_restart = at91rm9200_restart; 51 arm_pm_restart = at91rm9200_restart;
52 at91rm9200_pm_init();
42} 53}
43 54
44AT91_SOC_START(at91rm9200) 55
45 .init = at91rm9200_initialize, 56
46AT91_SOC_END 57static const char *at91rm9200_dt_board_compat[] __initconst = {
58 "atmel,at91rm9200",
59 NULL
60};
61
62DT_MACHINE_START(at91rm9200_dt, "Atmel AT91RM9200")
63 .init_time = at91rm9200_dt_timer_init,
64 .map_io = at91_map_io,
65 .init_machine = at91rm9200_dt_device_init,
66 .dt_compat = at91rm9200_dt_board_compat,
67MACHINE_END
diff --git a/arch/arm/mach-at91/board-dt-sam9.c b/arch/arm/mach-at91/at91sam9.c
index f5d922e57655..56e3ba73ec40 100644
--- a/arch/arm/mach-at91/board-dt-sam9.c
+++ b/arch/arm/mach-at91/at91sam9.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Setup code for AT91SAM Evaluation Kits with Device Tree support 2 * Setup code for AT91SAM9
3 * 3 *
4 * Copyright (C) 2011 Atmel, 4 * Copyright (C) 2011 Atmel,
5 * 2011 Nicolas Ferre <nicolas.ferre@atmel.com> 5 * 2011 Nicolas Ferre <nicolas.ferre@atmel.com>
@@ -25,12 +25,12 @@
25 25
26#include "generic.h" 26#include "generic.h"
27 27
28static void __init sam9_dt_device_init(void) 28static void __init at91sam9_dt_device_init(void)
29{ 29{
30 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 30 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
31 31
32 arm_pm_idle = at91sam9_idle; 32 arm_pm_idle = at91sam9_idle;
33 at91_sam9260_pm_init(); 33 at91sam9260_pm_init();
34} 34}
35 35
36static const char *at91_dt_board_compat[] __initconst = { 36static const char *at91_dt_board_compat[] __initconst = {
@@ -38,23 +38,22 @@ static const char *at91_dt_board_compat[] __initconst = {
38 NULL 38 NULL
39}; 39};
40 40
41DT_MACHINE_START(at91sam_dt, "Atmel AT91SAM (Device Tree)") 41DT_MACHINE_START(at91sam_dt, "Atmel AT91SAM9")
42 /* Maintainer: Atmel */ 42 /* Maintainer: Atmel */
43 .map_io = at91_map_io, 43 .map_io = at91_map_io,
44 .init_early = at91_dt_initialize, 44 .init_machine = at91sam9_dt_device_init,
45 .init_machine = sam9_dt_device_init,
46 .dt_compat = at91_dt_board_compat, 45 .dt_compat = at91_dt_board_compat,
47MACHINE_END 46MACHINE_END
48 47
49static void __init sam9g45_dt_device_init(void) 48static void __init at91sam9g45_dt_device_init(void)
50{ 49{
51 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 50 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
52 51
53 arm_pm_idle = at91sam9_idle; 52 arm_pm_idle = at91sam9_idle;
54 at91_sam9g45_pm_init(); 53 at91sam9g45_pm_init();
55} 54}
56 55
57static const char *at91_9g45_board_compat[] __initconst = { 56static const char *at91sam9g45_board_compat[] __initconst = {
58 "atmel,at91sam9g45", 57 "atmel,at91sam9g45",
59 NULL 58 NULL
60}; 59};
@@ -62,20 +61,19 @@ static const char *at91_9g45_board_compat[] __initconst = {
62DT_MACHINE_START(at91sam9g45_dt, "Atmel AT91SAM9G45") 61DT_MACHINE_START(at91sam9g45_dt, "Atmel AT91SAM9G45")
63 /* Maintainer: Atmel */ 62 /* Maintainer: Atmel */
64 .map_io = at91_map_io, 63 .map_io = at91_map_io,
65 .init_early = at91_dt_initialize, 64 .init_machine = at91sam9g45_dt_device_init,
66 .init_machine = sam9g45_dt_device_init, 65 .dt_compat = at91sam9g45_board_compat,
67 .dt_compat = at91_9g45_board_compat,
68MACHINE_END 66MACHINE_END
69 67
70static void __init sam9x5_dt_device_init(void) 68static void __init at91sam9x5_dt_device_init(void)
71{ 69{
72 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 70 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
73 71
74 arm_pm_idle = at91sam9_idle; 72 arm_pm_idle = at91sam9_idle;
75 at91_sam9x5_pm_init(); 73 at91sam9x5_pm_init();
76} 74}
77 75
78static const char *at91_9x5_board_compat[] __initconst = { 76static const char *at91sam9x5_board_compat[] __initconst = {
79 "atmel,at91sam9x5", 77 "atmel,at91sam9x5",
80 "atmel,at91sam9n12", 78 "atmel,at91sam9n12",
81 NULL 79 NULL
@@ -84,7 +82,6 @@ static const char *at91_9x5_board_compat[] __initconst = {
84DT_MACHINE_START(at91sam9x5_dt, "Atmel AT91SAM9") 82DT_MACHINE_START(at91sam9x5_dt, "Atmel AT91SAM9")
85 /* Maintainer: Atmel */ 83 /* Maintainer: Atmel */
86 .map_io = at91_map_io, 84 .map_io = at91_map_io,
87 .init_early = at91_dt_initialize, 85 .init_machine = at91sam9x5_dt_device_init,
88 .init_machine = sam9x5_dt_device_init, 86 .dt_compat = at91sam9x5_board_compat,
89 .dt_compat = at91_9x5_board_compat,
90MACHINE_END 87MACHINE_END
diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-at91/at91sam9260.c
deleted file mode 100644
index 37b7ce4c6a3b..000000000000
--- a/arch/arm/mach-at91/at91sam9260.c
+++ /dev/null
@@ -1,26 +0,0 @@
1/*
2 * arch/arm/mach-at91/at91sam9260.c
3 *
4 * Copyright (C) 2006 SAN People
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 */
12
13#include <asm/system_misc.h>
14#include <mach/cpu.h>
15#include <mach/at91_dbgu.h>
16#include <mach/hardware.h>
17
18#include "soc.h"
19#include "generic.h"
20
21/* --------------------------------------------------------------------
22 * AT91SAM9260 processor initialization
23 * -------------------------------------------------------------------- */
24
25AT91_SOC_START(at91sam9260)
26AT91_SOC_END
diff --git a/arch/arm/mach-at91/at91sam9261.c b/arch/arm/mach-at91/at91sam9261.c
deleted file mode 100644
index aebbf76b6038..000000000000
--- a/arch/arm/mach-at91/at91sam9261.c
+++ /dev/null
@@ -1,25 +0,0 @@
1/*
2 * arch/arm/mach-at91/at91sam9261.c
3 *
4 * Copyright (C) 2005 SAN People
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 */
12
13#include <asm/system_misc.h>
14#include <mach/cpu.h>
15#include <mach/hardware.h>
16
17#include "soc.h"
18#include "generic.h"
19
20/* --------------------------------------------------------------------
21 * AT91SAM9261 processor initialization
22 * -------------------------------------------------------------------- */
23
24AT91_SOC_START(at91sam9261)
25AT91_SOC_END
diff --git a/arch/arm/mach-at91/at91sam9263.c b/arch/arm/mach-at91/at91sam9263.c
deleted file mode 100644
index dca29457d9cc..000000000000
--- a/arch/arm/mach-at91/at91sam9263.c
+++ /dev/null
@@ -1,24 +0,0 @@
1/*
2 * arch/arm/mach-at91/at91sam9263.c
3 *
4 * Copyright (C) 2007 Atmel Corporation.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 */
12
13#include <asm/system_misc.h>
14#include <mach/hardware.h>
15
16#include "soc.h"
17#include "generic.h"
18
19/* --------------------------------------------------------------------
20 * AT91SAM9263 processor initialization
21 * -------------------------------------------------------------------- */
22
23AT91_SOC_START(at91sam9263)
24AT91_SOC_END
diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c
deleted file mode 100644
index 4957a9ef748a..000000000000
--- a/arch/arm/mach-at91/at91sam9g45.c
+++ /dev/null
@@ -1,24 +0,0 @@
1/*
2 * Chip-specific setup code for the AT91SAM9G45 family
3 *
4 * Copyright (C) 2009 Atmel Corporation.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 */
12
13#include <asm/system_misc.h>
14#include <mach/hardware.h>
15
16#include "soc.h"
17#include "generic.h"
18
19/* --------------------------------------------------------------------
20 * AT91SAM9G45 processor initialization
21 * -------------------------------------------------------------------- */
22
23AT91_SOC_START(at91sam9g45)
24AT91_SOC_END
diff --git a/arch/arm/mach-at91/at91sam9n12.c b/arch/arm/mach-at91/at91sam9n12.c
deleted file mode 100644
index b5ea69a3eaf6..000000000000
--- a/arch/arm/mach-at91/at91sam9n12.c
+++ /dev/null
@@ -1,20 +0,0 @@
1/*
2 * SoC specific setup code for the AT91SAM9N12
3 *
4 * Copyright (C) 2012 Atmel Corporation.
5 *
6 * Licensed under GPLv2 or later.
7 */
8
9#include <asm/system_misc.h>
10#include <mach/hardware.h>
11
12#include "soc.h"
13#include "generic.h"
14
15/* --------------------------------------------------------------------
16 * AT91SAM9N12 processor initialization
17 * -------------------------------------------------------------------- */
18
19AT91_SOC_START(at91sam9n12)
20AT91_SOC_END
diff --git a/arch/arm/mach-at91/at91sam9rl.c b/arch/arm/mach-at91/at91sam9rl.c
deleted file mode 100644
index 6cb40e4ec20f..000000000000
--- a/arch/arm/mach-at91/at91sam9rl.c
+++ /dev/null
@@ -1,25 +0,0 @@
1/*
2 * arch/arm/mach-at91/at91sam9rl.c
3 *
4 * Copyright (C) 2005 SAN People
5 * Copyright (C) 2007 Atmel Corporation
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file COPYING in the main directory of this archive for
9 * more details.
10 */
11
12#include <asm/system_misc.h>
13#include <mach/cpu.h>
14#include <mach/at91_dbgu.h>
15#include <mach/hardware.h>
16
17#include "soc.h"
18#include "generic.h"
19
20/* --------------------------------------------------------------------
21 * AT91SAM9RL processor initialization
22 * -------------------------------------------------------------------- */
23
24AT91_SOC_START(at91sam9rl)
25AT91_SOC_END
diff --git a/arch/arm/mach-at91/at91sam9x5.c b/arch/arm/mach-at91/at91sam9x5.c
deleted file mode 100644
index 7b60a529db01..000000000000
--- a/arch/arm/mach-at91/at91sam9x5.c
+++ /dev/null
@@ -1,20 +0,0 @@
1/*
2 * Chip-specific setup code for the AT91SAM9x5 family
3 *
4 * Copyright (C) 2010-2012 Atmel Corporation.
5 *
6 * Licensed under GPLv2 or later.
7 */
8
9#include <asm/system_misc.h>
10#include <mach/hardware.h>
11
12#include "soc.h"
13#include "generic.h"
14
15/* --------------------------------------------------------------------
16 * AT91SAM9x5 processor initialization
17 * -------------------------------------------------------------------- */
18
19AT91_SOC_START(at91sam9x5)
20AT91_SOC_END
diff --git a/arch/arm/mach-at91/board-dt-rm9200.c b/arch/arm/mach-at91/board-dt-rm9200.c
deleted file mode 100644
index d47c4433444d..000000000000
--- a/arch/arm/mach-at91/board-dt-rm9200.c
+++ /dev/null
@@ -1,54 +0,0 @@
1/*
2 * Setup code for AT91RM9200 Evaluation Kits with Device Tree support
3 *
4 * Copyright (C) 2011 Atmel,
5 * 2011 Nicolas Ferre <nicolas.ferre@atmel.com>
6 * 2012 Joachim Eastwood <manabian@gmail.com>
7 *
8 * Licensed under GPLv2 or later.
9 */
10
11#include <linux/types.h>
12#include <linux/init.h>
13#include <linux/module.h>
14#include <linux/gpio.h>
15#include <linux/of.h>
16#include <linux/of_irq.h>
17#include <linux/of_platform.h>
18#include <linux/clk-provider.h>
19
20#include <asm/setup.h>
21#include <asm/irq.h>
22#include <asm/mach/arch.h>
23#include <asm/mach/map.h>
24#include <asm/mach/irq.h>
25
26#include "generic.h"
27
28static void __init at91rm9200_dt_timer_init(void)
29{
30 of_clk_init(NULL);
31 at91rm9200_timer_init();
32}
33
34static void __init rm9200_dt_device_init(void)
35{
36 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
37
38 at91_rm9200_pm_init();
39}
40
41
42
43static const char *at91rm9200_dt_board_compat[] __initconst = {
44 "atmel,at91rm9200",
45 NULL
46};
47
48DT_MACHINE_START(at91rm9200_dt, "Atmel AT91RM9200 (Device Tree)")
49 .init_time = at91rm9200_dt_timer_init,
50 .map_io = at91_map_io,
51 .init_early = at91_dt_initialize,
52 .init_machine = rm9200_dt_device_init,
53 .dt_compat = at91rm9200_dt_board_compat,
54MACHINE_END
diff --git a/arch/arm/mach-at91/board-dt-sama5.c b/arch/arm/mach-at91/board-dt-sama5.c
deleted file mode 100644
index 86cffcdef145..000000000000
--- a/arch/arm/mach-at91/board-dt-sama5.c
+++ /dev/null
@@ -1,60 +0,0 @@
1/*
2 * Setup code for SAMA5 Evaluation Kits with Device Tree support
3 *
4 * Copyright (C) 2013 Atmel,
5 * 2013 Ludovic Desroches <ludovic.desroches@atmel.com>
6 *
7 * Licensed under GPLv2 or later.
8 */
9
10#include <linux/types.h>
11#include <linux/init.h>
12#include <linux/module.h>
13#include <linux/gpio.h>
14#include <linux/micrel_phy.h>
15#include <linux/of.h>
16#include <linux/of_irq.h>
17#include <linux/of_platform.h>
18#include <linux/phy.h>
19#include <linux/clk-provider.h>
20
21#include <asm/setup.h>
22#include <asm/irq.h>
23#include <asm/mach/arch.h>
24#include <asm/mach/map.h>
25#include <asm/mach/irq.h>
26
27#include "generic.h"
28
29static void __init sama5_dt_device_init(void)
30{
31 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
32 at91_sam9x5_pm_init();
33}
34
35static const char *sama5_dt_board_compat[] __initconst = {
36 "atmel,sama5",
37 NULL
38};
39
40DT_MACHINE_START(sama5_dt, "Atmel SAMA5 (Device Tree)")
41 /* Maintainer: Atmel */
42 .map_io = at91_map_io,
43 .init_early = at91_dt_initialize,
44 .init_machine = sama5_dt_device_init,
45 .dt_compat = sama5_dt_board_compat,
46MACHINE_END
47
48static const char *sama5_alt_dt_board_compat[] __initconst = {
49 "atmel,sama5d4",
50 NULL
51};
52
53DT_MACHINE_START(sama5_alt_dt, "Atmel SAMA5 (Device Tree)")
54 /* Maintainer: Atmel */
55 .map_io = at91_alt_map_io,
56 .init_early = at91_dt_initialize,
57 .init_machine = sama5_dt_device_init,
58 .dt_compat = sama5_alt_dt_board_compat,
59 .l2c_aux_mask = ~0UL,
60MACHINE_END
diff --git a/arch/arm/mach-at91/generic.h b/arch/arm/mach-at91/generic.h
index a8ee83ef6cd4..a6e726a6e0b5 100644
--- a/arch/arm/mach-at91/generic.h
+++ b/arch/arm/mach-at91/generic.h
@@ -18,9 +18,6 @@
18extern void __init at91_map_io(void); 18extern void __init at91_map_io(void);
19extern void __init at91_alt_map_io(void); 19extern void __init at91_alt_map_io(void);
20 20
21 /* Processors */
22extern void __init at91_dt_initialize(void);
23
24 /* Timer */ 21 /* Timer */
25extern void at91rm9200_timer_init(void); 22extern void at91rm9200_timer_init(void);
26 23
@@ -33,15 +30,15 @@ extern void at91_ioremap_matrix(u32 base_addr);
33 30
34 31
35#ifdef CONFIG_PM 32#ifdef CONFIG_PM
36extern void __init at91_rm9200_pm_init(void); 33extern void __init at91rm9200_pm_init(void);
37extern void __init at91_sam9260_pm_init(void); 34extern void __init at91sam9260_pm_init(void);
38extern void __init at91_sam9g45_pm_init(void); 35extern void __init at91sam9g45_pm_init(void);
39extern void __init at91_sam9x5_pm_init(void); 36extern void __init at91sam9x5_pm_init(void);
40#else 37#else
41void __init at91_rm9200_pm_init(void) { } 38void __init at91rm9200_pm_init(void) { }
42void __init at91_sam9260_pm_init(void) { } 39void __init at91sam9260_pm_init(void) { }
43void __init at91_sam9g45_pm_init(void) { } 40void __init at91sam9g45_pm_init(void) { }
44void __init at91_sam9x5_pm_init(void) { } 41void __init at91sam9x5_pm_init(void) { }
45#endif 42#endif
46 43
47#endif /* _AT91_GENERIC_H */ 44#endif /* _AT91_GENERIC_H */
diff --git a/arch/arm/mach-at91/include/mach/cpu.h b/arch/arm/mach-at91/include/mach/cpu.h
index 61914fb35f5d..ce7c80a44983 100644
--- a/arch/arm/mach-at91/include/mach/cpu.h
+++ b/arch/arm/mach-at91/include/mach/cpu.h
@@ -152,69 +152,45 @@ static inline int at91_soc_is_detected(void)
152#define cpu_is_at91rm9200_pqfp() (0) 152#define cpu_is_at91rm9200_pqfp() (0)
153#endif 153#endif
154 154
155#ifdef CONFIG_SOC_AT91SAM9260 155#ifdef CONFIG_SOC_AT91SAM9
156#define cpu_is_at91sam9xe() (at91_soc_initdata.subtype == AT91_SOC_SAM9XE) 156#define cpu_is_at91sam9xe() (at91_soc_initdata.subtype == AT91_SOC_SAM9XE)
157#define cpu_is_at91sam9260() (at91_soc_initdata.type == AT91_SOC_SAM9260) 157#define cpu_is_at91sam9260() (at91_soc_initdata.type == AT91_SOC_SAM9260)
158#define cpu_is_at91sam9g20() (at91_soc_initdata.type == AT91_SOC_SAM9G20) 158#define cpu_is_at91sam9g20() (at91_soc_initdata.type == AT91_SOC_SAM9G20)
159#else
160#define cpu_is_at91sam9xe() (0)
161#define cpu_is_at91sam9260() (0)
162#define cpu_is_at91sam9g20() (0)
163#endif
164
165#ifdef CONFIG_SOC_AT91SAM9261
166#define cpu_is_at91sam9261() (at91_soc_initdata.type == AT91_SOC_SAM9261) 159#define cpu_is_at91sam9261() (at91_soc_initdata.type == AT91_SOC_SAM9261)
167#define cpu_is_at91sam9g10() (at91_soc_initdata.type == AT91_SOC_SAM9G10) 160#define cpu_is_at91sam9g10() (at91_soc_initdata.type == AT91_SOC_SAM9G10)
168#else
169#define cpu_is_at91sam9261() (0)
170#define cpu_is_at91sam9g10() (0)
171#endif
172
173#ifdef CONFIG_SOC_AT91SAM9263
174#define cpu_is_at91sam9263() (at91_soc_initdata.type == AT91_SOC_SAM9263) 161#define cpu_is_at91sam9263() (at91_soc_initdata.type == AT91_SOC_SAM9263)
175#else
176#define cpu_is_at91sam9263() (0)
177#endif
178
179#ifdef CONFIG_SOC_AT91SAM9RL
180#define cpu_is_at91sam9rl() (at91_soc_initdata.type == AT91_SOC_SAM9RL) 162#define cpu_is_at91sam9rl() (at91_soc_initdata.type == AT91_SOC_SAM9RL)
181#else
182#define cpu_is_at91sam9rl() (0)
183#endif
184
185#ifdef CONFIG_SOC_AT91SAM9G45
186#define cpu_is_at91sam9g45() (at91_soc_initdata.type == AT91_SOC_SAM9G45) 163#define cpu_is_at91sam9g45() (at91_soc_initdata.type == AT91_SOC_SAM9G45)
187#define cpu_is_at91sam9g45es() (at91_soc_initdata.subtype == AT91_SOC_SAM9G45ES) 164#define cpu_is_at91sam9g45es() (at91_soc_initdata.subtype == AT91_SOC_SAM9G45ES)
188#define cpu_is_at91sam9m10() (at91_soc_initdata.subtype == AT91_SOC_SAM9M10) 165#define cpu_is_at91sam9m10() (at91_soc_initdata.subtype == AT91_SOC_SAM9M10)
189#define cpu_is_at91sam9g46() (at91_soc_initdata.subtype == AT91_SOC_SAM9G46) 166#define cpu_is_at91sam9g46() (at91_soc_initdata.subtype == AT91_SOC_SAM9G46)
190#define cpu_is_at91sam9m11() (at91_soc_initdata.subtype == AT91_SOC_SAM9M11) 167#define cpu_is_at91sam9m11() (at91_soc_initdata.subtype == AT91_SOC_SAM9M11)
191#else
192#define cpu_is_at91sam9g45() (0)
193#define cpu_is_at91sam9g45es() (0)
194#define cpu_is_at91sam9m10() (0)
195#define cpu_is_at91sam9g46() (0)
196#define cpu_is_at91sam9m11() (0)
197#endif
198
199#ifdef CONFIG_SOC_AT91SAM9X5
200#define cpu_is_at91sam9x5() (at91_soc_initdata.type == AT91_SOC_SAM9X5) 168#define cpu_is_at91sam9x5() (at91_soc_initdata.type == AT91_SOC_SAM9X5)
201#define cpu_is_at91sam9g15() (at91_soc_initdata.subtype == AT91_SOC_SAM9G15) 169#define cpu_is_at91sam9g15() (at91_soc_initdata.subtype == AT91_SOC_SAM9G15)
202#define cpu_is_at91sam9g35() (at91_soc_initdata.subtype == AT91_SOC_SAM9G35) 170#define cpu_is_at91sam9g35() (at91_soc_initdata.subtype == AT91_SOC_SAM9G35)
203#define cpu_is_at91sam9x35() (at91_soc_initdata.subtype == AT91_SOC_SAM9X35) 171#define cpu_is_at91sam9x35() (at91_soc_initdata.subtype == AT91_SOC_SAM9X35)
204#define cpu_is_at91sam9g25() (at91_soc_initdata.subtype == AT91_SOC_SAM9G25) 172#define cpu_is_at91sam9g25() (at91_soc_initdata.subtype == AT91_SOC_SAM9G25)
205#define cpu_is_at91sam9x25() (at91_soc_initdata.subtype == AT91_SOC_SAM9X25) 173#define cpu_is_at91sam9x25() (at91_soc_initdata.subtype == AT91_SOC_SAM9X25)
174#define cpu_is_at91sam9n12() (at91_soc_initdata.type == AT91_SOC_SAM9N12)
206#else 175#else
176#define cpu_is_at91sam9xe() (0)
177#define cpu_is_at91sam9260() (0)
178#define cpu_is_at91sam9g20() (0)
179#define cpu_is_at91sam9261() (0)
180#define cpu_is_at91sam9g10() (0)
181#define cpu_is_at91sam9263() (0)
182#define cpu_is_at91sam9rl() (0)
183#define cpu_is_at91sam9g45() (0)
184#define cpu_is_at91sam9g45es() (0)
185#define cpu_is_at91sam9m10() (0)
186#define cpu_is_at91sam9g46() (0)
187#define cpu_is_at91sam9m11() (0)
207#define cpu_is_at91sam9x5() (0) 188#define cpu_is_at91sam9x5() (0)
208#define cpu_is_at91sam9g15() (0) 189#define cpu_is_at91sam9g15() (0)
209#define cpu_is_at91sam9g35() (0) 190#define cpu_is_at91sam9g35() (0)
210#define cpu_is_at91sam9x35() (0) 191#define cpu_is_at91sam9x35() (0)
211#define cpu_is_at91sam9g25() (0) 192#define cpu_is_at91sam9g25() (0)
212#define cpu_is_at91sam9x25() (0) 193#define cpu_is_at91sam9x25() (0)
213#endif
214
215#ifdef CONFIG_SOC_AT91SAM9N12
216#define cpu_is_at91sam9n12() (at91_soc_initdata.type == AT91_SOC_SAM9N12)
217#else
218#define cpu_is_at91sam9n12() (0) 194#define cpu_is_at91sam9n12() (0)
219#endif 195#endif
220 196
diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
index 87c1fd8aa1b6..af8d8afc2e12 100644
--- a/arch/arm/mach-at91/pm.c
+++ b/arch/arm/mach-at91/pm.c
@@ -20,6 +20,7 @@
20#include <linux/module.h> 20#include <linux/module.h>
21#include <linux/of.h> 21#include <linux/of.h>
22#include <linux/of_platform.h> 22#include <linux/of_platform.h>
23#include <linux/of_address.h>
23#include <linux/platform_device.h> 24#include <linux/platform_device.h>
24#include <linux/io.h> 25#include <linux/io.h>
25#include <linux/clk/at91_pmc.h> 26#include <linux/clk/at91_pmc.h>
@@ -41,6 +42,7 @@ static struct {
41} at91_pm_data; 42} at91_pm_data;
42 43
43static void (*at91_pm_standby)(void); 44static void (*at91_pm_standby)(void);
45void __iomem *at91_ramc_base[2];
44 46
45static int at91_pm_valid_state(suspend_state_t state) 47static int at91_pm_valid_state(suspend_state_t state)
46{ 48{
@@ -224,6 +226,43 @@ void at91_pm_set_standby(void (*at91_standby)(void))
224 } 226 }
225} 227}
226 228
229static struct of_device_id ramc_ids[] = {
230 { .compatible = "atmel,at91rm9200-sdramc", .data = at91rm9200_standby },
231 { .compatible = "atmel,at91sam9260-sdramc", .data = at91sam9_sdram_standby },
232 { .compatible = "atmel,at91sam9g45-ddramc", .data = at91_ddr_standby },
233 { .compatible = "atmel,sama5d3-ddramc", .data = at91_ddr_standby },
234 { /*sentinel*/ }
235};
236
237static void at91_dt_ramc(void)
238{
239 struct device_node *np;
240 const struct of_device_id *of_id;
241 int idx = 0;
242 const void *standby = NULL;
243
244 for_each_matching_node_and_match(np, ramc_ids, &of_id) {
245 at91_ramc_base[idx] = of_iomap(np, 0);
246 if (!at91_ramc_base[idx])
247 panic(pr_fmt("unable to map ramc[%d] cpu registers\n"), idx);
248
249 if (!standby)
250 standby = of_id->data;
251
252 idx++;
253 }
254
255 if (!idx)
256 panic(pr_fmt("unable to find compatible ram controller node in dtb\n"));
257
258 if (!standby) {
259 pr_warn("ramc no standby function available\n");
260 return;
261 }
262
263 at91_pm_set_standby(standby);
264}
265
227#ifdef CONFIG_AT91_SLOW_CLOCK 266#ifdef CONFIG_AT91_SLOW_CLOCK
228static void __init at91_pm_sram_init(void) 267static void __init at91_pm_sram_init(void)
229{ 268{
@@ -280,8 +319,10 @@ static void __init at91_pm_init(void)
280 suspend_set_ops(&at91_pm_ops); 319 suspend_set_ops(&at91_pm_ops);
281} 320}
282 321
283void __init at91_rm9200_pm_init(void) 322void __init at91rm9200_pm_init(void)
284{ 323{
324 at91_dt_ramc();
325
285 /* 326 /*
286 * AT91RM9200 SDRAM low-power mode cannot be used with self-refresh. 327 * AT91RM9200 SDRAM low-power mode cannot be used with self-refresh.
287 */ 328 */
@@ -293,22 +334,25 @@ void __init at91_rm9200_pm_init(void)
293 at91_pm_init(); 334 at91_pm_init();
294} 335}
295 336
296void __init at91_sam9260_pm_init(void) 337void __init at91sam9260_pm_init(void)
297{ 338{
339 at91_dt_ramc();
298 at91_pm_data.memctrl = AT91_MEMCTRL_SDRAMC; 340 at91_pm_data.memctrl = AT91_MEMCTRL_SDRAMC;
299 at91_pm_data.uhp_udp_mask = AT91SAM926x_PMC_UHP | AT91SAM926x_PMC_UDP; 341 at91_pm_data.uhp_udp_mask = AT91SAM926x_PMC_UHP | AT91SAM926x_PMC_UDP;
300 return at91_pm_init(); 342 return at91_pm_init();
301} 343}
302 344
303void __init at91_sam9g45_pm_init(void) 345void __init at91sam9g45_pm_init(void)
304{ 346{
347 at91_dt_ramc();
305 at91_pm_data.uhp_udp_mask = AT91SAM926x_PMC_UHP; 348 at91_pm_data.uhp_udp_mask = AT91SAM926x_PMC_UHP;
306 at91_pm_data.memctrl = AT91_MEMCTRL_DDRSDR; 349 at91_pm_data.memctrl = AT91_MEMCTRL_DDRSDR;
307 return at91_pm_init(); 350 return at91_pm_init();
308} 351}
309 352
310void __init at91_sam9x5_pm_init(void) 353void __init at91sam9x5_pm_init(void)
311{ 354{
355 at91_dt_ramc();
312 at91_pm_data.uhp_udp_mask = AT91SAM926x_PMC_UHP | AT91SAM926x_PMC_UDP; 356 at91_pm_data.uhp_udp_mask = AT91SAM926x_PMC_UHP | AT91SAM926x_PMC_UDP;
313 at91_pm_data.memctrl = AT91_MEMCTRL_DDRSDR; 357 at91_pm_data.memctrl = AT91_MEMCTRL_DDRSDR;
314 return at91_pm_init(); 358 return at91_pm_init();
diff --git a/arch/arm/mach-at91/sama5.c b/arch/arm/mach-at91/sama5.c
new file mode 100644
index 000000000000..03dcb441f3d2
--- /dev/null
+++ b/arch/arm/mach-at91/sama5.c
@@ -0,0 +1,111 @@
1/*
2 * Setup code for SAMA5
3 *
4 * Copyright (C) 2013 Atmel,
5 * 2013 Ludovic Desroches <ludovic.desroches@atmel.com>
6 *
7 * Licensed under GPLv2 or later.
8 */
9
10#include <linux/types.h>
11#include <linux/init.h>
12#include <linux/module.h>
13#include <linux/gpio.h>
14#include <linux/micrel_phy.h>
15#include <linux/of.h>
16#include <linux/of_irq.h>
17#include <linux/of_platform.h>
18#include <linux/phy.h>
19#include <linux/clk-provider.h>
20#include <linux/phy.h>
21
22#include <mach/hardware.h>
23
24#include <asm/setup.h>
25#include <asm/irq.h>
26#include <asm/mach/arch.h>
27#include <asm/mach/map.h>
28#include <asm/mach/irq.h>
29
30#include "generic.h"
31
32static int ksz8081_phy_fixup(struct phy_device *phy)
33{
34 int value;
35
36 value = phy_read(phy, 0x16);
37 value &= ~0x20;
38 phy_write(phy, 0x16, value);
39
40 return 0;
41}
42
43static void __init sama5_dt_device_init(void)
44{
45 if (of_machine_is_compatible("atmel,sama5d4ek") &&
46 IS_ENABLED(CONFIG_PHYLIB)) {
47 phy_register_fixup_for_id("fc028000.etherne:00",
48 ksz8081_phy_fixup);
49 }
50
51 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
52 at91sam9x5_pm_init();
53}
54
55static const char *sama5_dt_board_compat[] __initconst = {
56 "atmel,sama5",
57 NULL
58};
59
60DT_MACHINE_START(sama5_dt, "Atmel SAMA5")
61 /* Maintainer: Atmel */
62 .map_io = at91_map_io,
63 .init_machine = sama5_dt_device_init,
64 .dt_compat = sama5_dt_board_compat,
65MACHINE_END
66
67static struct map_desc at91_io_desc[] __initdata = {
68 {
69 .virtual = (unsigned long)AT91_ALT_IO_P2V(SAMA5D4_BASE_MPDDRC),
70 .pfn = __phys_to_pfn(SAMA5D4_BASE_MPDDRC),
71 .length = SZ_512,
72 .type = MT_DEVICE,
73 },
74 {
75 .virtual = (unsigned long)AT91_ALT_IO_P2V(SAMA5D4_BASE_PMC),
76 .pfn = __phys_to_pfn(SAMA5D4_BASE_PMC),
77 .length = SZ_512,
78 .type = MT_DEVICE,
79 },
80 { /* On sama5d4, we use USART3 as serial console */
81 .virtual = (unsigned long)AT91_ALT_IO_P2V(SAMA5D4_BASE_USART3),
82 .pfn = __phys_to_pfn(SAMA5D4_BASE_USART3),
83 .length = SZ_256,
84 .type = MT_DEVICE,
85 },
86 { /* A bunch of peripheral with fine grained IO space */
87 .virtual = (unsigned long)AT91_ALT_IO_P2V(SAMA5D4_BASE_SYS2),
88 .pfn = __phys_to_pfn(SAMA5D4_BASE_SYS2),
89 .length = SZ_2K,
90 .type = MT_DEVICE,
91 },
92};
93
94static void __init sama5_alt_map_io(void)
95{
96 at91_alt_map_io();
97 iotable_init(at91_io_desc, ARRAY_SIZE(at91_io_desc));
98}
99
100static const char *sama5_alt_dt_board_compat[] __initconst = {
101 "atmel,sama5d4",
102 NULL
103};
104
105DT_MACHINE_START(sama5_alt_dt, "Atmel SAMA5")
106 /* Maintainer: Atmel */
107 .map_io = sama5_alt_map_io,
108 .init_machine = sama5_dt_device_init,
109 .dt_compat = sama5_alt_dt_board_compat,
110 .l2c_aux_mask = ~0UL,
111MACHINE_END
diff --git a/arch/arm/mach-at91/sama5d3.c b/arch/arm/mach-at91/sama5d3.c
deleted file mode 100644
index b7c64ca7107f..000000000000
--- a/arch/arm/mach-at91/sama5d3.c
+++ /dev/null
@@ -1,29 +0,0 @@
1/*
2 * Chip-specific setup code for the SAMA5D3 family
3 *
4 * Copyright (C) 2013 Atmel,
5 * 2013 Ludovic Desroches <ludovic.desroches@atmel.com>
6 *
7 * Licensed under GPLv2 or later.
8 */
9
10#include <linux/module.h>
11#include <linux/dma-mapping.h>
12#include <linux/clk/at91_pmc.h>
13
14#include <asm/irq.h>
15#include <asm/mach/arch.h>
16#include <asm/mach/map.h>
17#include <mach/sama5d3.h>
18#include <mach/cpu.h>
19
20#include "soc.h"
21#include "generic.h"
22#include "sam9_smc.h"
23
24/* --------------------------------------------------------------------
25 * AT91SAM9x5 processor initialization
26 * -------------------------------------------------------------------- */
27
28AT91_SOC_START(sama5d3)
29AT91_SOC_END
diff --git a/arch/arm/mach-at91/sama5d4.c b/arch/arm/mach-at91/sama5d4.c
deleted file mode 100644
index fa127fb79221..000000000000
--- a/arch/arm/mach-at91/sama5d4.c
+++ /dev/null
@@ -1,63 +0,0 @@
1/*
2 * Chip-specific setup code for the SAMA5D4 family
3 *
4 * Copyright (C) 2013 Atmel Corporation,
5 * Nicolas Ferre <nicolas.ferre@atmel.com>
6 *
7 * Licensed under GPLv2 or later.
8 */
9
10#include <linux/module.h>
11#include <linux/dma-mapping.h>
12#include <linux/clk/at91_pmc.h>
13
14#include <asm/irq.h>
15#include <asm/mach/arch.h>
16#include <asm/mach/map.h>
17#include <mach/sama5d4.h>
18#include <mach/cpu.h>
19#include <mach/hardware.h>
20
21#include "soc.h"
22#include "generic.h"
23#include "sam9_smc.h"
24
25/* --------------------------------------------------------------------
26 * Processor initialization
27 * -------------------------------------------------------------------- */
28static struct map_desc at91_io_desc[] __initdata = {
29 {
30 .virtual = (unsigned long)AT91_ALT_IO_P2V(SAMA5D4_BASE_MPDDRC),
31 .pfn = __phys_to_pfn(SAMA5D4_BASE_MPDDRC),
32 .length = SZ_512,
33 .type = MT_DEVICE,
34 },
35 {
36 .virtual = (unsigned long)AT91_ALT_IO_P2V(SAMA5D4_BASE_PMC),
37 .pfn = __phys_to_pfn(SAMA5D4_BASE_PMC),
38 .length = SZ_512,
39 .type = MT_DEVICE,
40 },
41 { /* On sama5d4, we use USART3 as serial console */
42 .virtual = (unsigned long)AT91_ALT_IO_P2V(SAMA5D4_BASE_USART3),
43 .pfn = __phys_to_pfn(SAMA5D4_BASE_USART3),
44 .length = SZ_256,
45 .type = MT_DEVICE,
46 },
47 { /* A bunch of peripheral with fine grained IO space */
48 .virtual = (unsigned long)AT91_ALT_IO_P2V(SAMA5D4_BASE_SYS2),
49 .pfn = __phys_to_pfn(SAMA5D4_BASE_SYS2),
50 .length = SZ_2K,
51 .type = MT_DEVICE,
52 },
53};
54
55
56static void __init sama5d4_map_io(void)
57{
58 iotable_init(at91_io_desc, ARRAY_SIZE(at91_io_desc));
59}
60
61AT91_SOC_START(sama5d4)
62 .map_io = sama5d4_map_io,
63AT91_SOC_END
diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c
index 4c184285d38f..4e58bc90ed21 100644
--- a/arch/arm/mach-at91/setup.c
+++ b/arch/arm/mach-at91/setup.c
@@ -22,18 +22,12 @@
22#include <mach/cpu.h> 22#include <mach/cpu.h>
23#include <mach/at91_dbgu.h> 23#include <mach/at91_dbgu.h>
24 24
25#include "soc.h"
26#include "generic.h" 25#include "generic.h"
27#include "pm.h" 26#include "pm.h"
28 27
29struct at91_init_soc __initdata at91_boot_soc;
30
31struct at91_socinfo at91_soc_initdata; 28struct at91_socinfo at91_soc_initdata;
32EXPORT_SYMBOL(at91_soc_initdata); 29EXPORT_SYMBOL(at91_soc_initdata);
33 30
34void __iomem *at91_ramc_base[2];
35EXPORT_SYMBOL_GPL(at91_ramc_base);
36
37static struct map_desc at91_io_desc __initdata __maybe_unused = { 31static struct map_desc at91_io_desc __initdata __maybe_unused = {
38 .virtual = (unsigned long)AT91_VA_BASE_SYS, 32 .virtual = (unsigned long)AT91_VA_BASE_SYS,
39 .pfn = __phys_to_pfn(AT91_BASE_SYS), 33 .pfn = __phys_to_pfn(AT91_BASE_SYS),
@@ -60,61 +54,51 @@ static void __init soc_detect(u32 dbgu_base)
60 at91_soc_initdata.type = AT91_SOC_RM9200; 54 at91_soc_initdata.type = AT91_SOC_RM9200;
61 if (at91_soc_initdata.subtype == AT91_SOC_SUBTYPE_UNKNOWN) 55 if (at91_soc_initdata.subtype == AT91_SOC_SUBTYPE_UNKNOWN)
62 at91_soc_initdata.subtype = AT91_SOC_RM9200_BGA; 56 at91_soc_initdata.subtype = AT91_SOC_RM9200_BGA;
63 at91_boot_soc = at91rm9200_soc;
64 break; 57 break;
65 58
66 case ARCH_ID_AT91SAM9260: 59 case ARCH_ID_AT91SAM9260:
67 at91_soc_initdata.type = AT91_SOC_SAM9260; 60 at91_soc_initdata.type = AT91_SOC_SAM9260;
68 at91_soc_initdata.subtype = AT91_SOC_SUBTYPE_NONE; 61 at91_soc_initdata.subtype = AT91_SOC_SUBTYPE_NONE;
69 at91_boot_soc = at91sam9260_soc;
70 break; 62 break;
71 63
72 case ARCH_ID_AT91SAM9261: 64 case ARCH_ID_AT91SAM9261:
73 at91_soc_initdata.type = AT91_SOC_SAM9261; 65 at91_soc_initdata.type = AT91_SOC_SAM9261;
74 at91_soc_initdata.subtype = AT91_SOC_SUBTYPE_NONE; 66 at91_soc_initdata.subtype = AT91_SOC_SUBTYPE_NONE;
75 at91_boot_soc = at91sam9261_soc;
76 break; 67 break;
77 68
78 case ARCH_ID_AT91SAM9263: 69 case ARCH_ID_AT91SAM9263:
79 at91_soc_initdata.type = AT91_SOC_SAM9263; 70 at91_soc_initdata.type = AT91_SOC_SAM9263;
80 at91_soc_initdata.subtype = AT91_SOC_SUBTYPE_NONE; 71 at91_soc_initdata.subtype = AT91_SOC_SUBTYPE_NONE;
81 at91_boot_soc = at91sam9263_soc;
82 break; 72 break;
83 73
84 case ARCH_ID_AT91SAM9G20: 74 case ARCH_ID_AT91SAM9G20:
85 at91_soc_initdata.type = AT91_SOC_SAM9G20; 75 at91_soc_initdata.type = AT91_SOC_SAM9G20;
86 at91_soc_initdata.subtype = AT91_SOC_SUBTYPE_NONE; 76 at91_soc_initdata.subtype = AT91_SOC_SUBTYPE_NONE;
87 at91_boot_soc = at91sam9260_soc;
88 break; 77 break;
89 78
90 case ARCH_ID_AT91SAM9G45: 79 case ARCH_ID_AT91SAM9G45:
91 at91_soc_initdata.type = AT91_SOC_SAM9G45; 80 at91_soc_initdata.type = AT91_SOC_SAM9G45;
92 if (cidr == ARCH_ID_AT91SAM9G45ES) 81 if (cidr == ARCH_ID_AT91SAM9G45ES)
93 at91_soc_initdata.subtype = AT91_SOC_SAM9G45ES; 82 at91_soc_initdata.subtype = AT91_SOC_SAM9G45ES;
94 at91_boot_soc = at91sam9g45_soc;
95 break; 83 break;
96 84
97 case ARCH_ID_AT91SAM9RL64: 85 case ARCH_ID_AT91SAM9RL64:
98 at91_soc_initdata.type = AT91_SOC_SAM9RL; 86 at91_soc_initdata.type = AT91_SOC_SAM9RL;
99 at91_soc_initdata.subtype = AT91_SOC_SUBTYPE_NONE; 87 at91_soc_initdata.subtype = AT91_SOC_SUBTYPE_NONE;
100 at91_boot_soc = at91sam9rl_soc;
101 break; 88 break;
102 89
103 case ARCH_ID_AT91SAM9X5: 90 case ARCH_ID_AT91SAM9X5:
104 at91_soc_initdata.type = AT91_SOC_SAM9X5; 91 at91_soc_initdata.type = AT91_SOC_SAM9X5;
105 at91_boot_soc = at91sam9x5_soc;
106 break; 92 break;
107 93
108 case ARCH_ID_AT91SAM9N12: 94 case ARCH_ID_AT91SAM9N12:
109 at91_soc_initdata.type = AT91_SOC_SAM9N12; 95 at91_soc_initdata.type = AT91_SOC_SAM9N12;
110 at91_boot_soc = at91sam9n12_soc;
111 break; 96 break;
112 97
113 case ARCH_ID_SAMA5: 98 case ARCH_ID_SAMA5:
114 at91_soc_initdata.exid = __raw_readl(AT91_IO_P2V(dbgu_base) + AT91_DBGU_EXID); 99 at91_soc_initdata.exid = __raw_readl(AT91_IO_P2V(dbgu_base) + AT91_DBGU_EXID);
115 if (at91_soc_initdata.exid & ARCH_EXID_SAMA5D3) { 100 if (at91_soc_initdata.exid & ARCH_EXID_SAMA5D3) {
116 at91_soc_initdata.type = AT91_SOC_SAMA5D3; 101 at91_soc_initdata.type = AT91_SOC_SAMA5D3;
117 at91_boot_soc = sama5d3_soc;
118 } 102 }
119 break; 103 break;
120 } 104 }
@@ -123,13 +107,11 @@ static void __init soc_detect(u32 dbgu_base)
123 if ((socid & ~AT91_CIDR_EXT) == ARCH_ID_AT91SAM9G10) { 107 if ((socid & ~AT91_CIDR_EXT) == ARCH_ID_AT91SAM9G10) {
124 at91_soc_initdata.type = AT91_SOC_SAM9G10; 108 at91_soc_initdata.type = AT91_SOC_SAM9G10;
125 at91_soc_initdata.subtype = AT91_SOC_SUBTYPE_NONE; 109 at91_soc_initdata.subtype = AT91_SOC_SUBTYPE_NONE;
126 at91_boot_soc = at91sam9261_soc;
127 } 110 }
128 /* at91sam9xe */ 111 /* at91sam9xe */
129 else if ((cidr & AT91_CIDR_ARCH) == ARCH_FAMILY_AT91SAM9XE) { 112 else if ((cidr & AT91_CIDR_ARCH) == ARCH_FAMILY_AT91SAM9XE) {
130 at91_soc_initdata.type = AT91_SOC_SAM9260; 113 at91_soc_initdata.type = AT91_SOC_SAM9260;
131 at91_soc_initdata.subtype = AT91_SOC_SAM9XE; 114 at91_soc_initdata.subtype = AT91_SOC_SAM9XE;
132 at91_boot_soc = at91sam9260_soc;
133 } 115 }
134 116
135 if (!at91_soc_is_detected()) 117 if (!at91_soc_is_detected())
@@ -209,10 +191,8 @@ static void __init alt_soc_detect(u32 dbgu_base)
209 at91_soc_initdata.exid = __raw_readl(AT91_ALT_IO_P2V(dbgu_base) + AT91_DBGU_EXID); 191 at91_soc_initdata.exid = __raw_readl(AT91_ALT_IO_P2V(dbgu_base) + AT91_DBGU_EXID);
210 if (at91_soc_initdata.exid & ARCH_EXID_SAMA5D3) { 192 if (at91_soc_initdata.exid & ARCH_EXID_SAMA5D3) {
211 at91_soc_initdata.type = AT91_SOC_SAMA5D3; 193 at91_soc_initdata.type = AT91_SOC_SAMA5D3;
212 at91_boot_soc = sama5d3_soc;
213 } else if (at91_soc_initdata.exid & ARCH_EXID_SAMA5D4) { 194 } else if (at91_soc_initdata.exid & ARCH_EXID_SAMA5D4) {
214 at91_soc_initdata.type = AT91_SOC_SAMA5D4; 195 at91_soc_initdata.type = AT91_SOC_SAMA5D4;
215 at91_boot_soc = sama5d4_soc;
216 } 196 }
217 break; 197 break;
218 } 198 }
@@ -318,12 +298,6 @@ void __init at91_map_io(void)
318 if (at91_soc_initdata.subtype != AT91_SOC_SUBTYPE_NONE) 298 if (at91_soc_initdata.subtype != AT91_SOC_SUBTYPE_NONE)
319 pr_info("Detected soc subtype: %s\n", 299 pr_info("Detected soc subtype: %s\n",
320 at91_get_soc_subtype(&at91_soc_initdata)); 300 at91_get_soc_subtype(&at91_soc_initdata));
321
322 if (!at91_soc_is_enabled())
323 panic(pr_fmt("Soc not enabled"));
324
325 if (at91_boot_soc.map_io)
326 at91_boot_soc.map_io();
327} 301}
328 302
329void __init at91_alt_map_io(void) 303void __init at91_alt_map_io(void)
@@ -343,12 +317,6 @@ void __init at91_alt_map_io(void)
343 if (at91_soc_initdata.subtype != AT91_SOC_SUBTYPE_NONE) 317 if (at91_soc_initdata.subtype != AT91_SOC_SUBTYPE_NONE)
344 pr_info("AT91: Detected soc subtype: %s\n", 318 pr_info("AT91: Detected soc subtype: %s\n",
345 at91_get_soc_subtype(&at91_soc_initdata)); 319 at91_get_soc_subtype(&at91_soc_initdata));
346
347 if (!at91_soc_is_enabled())
348 panic("AT91: Soc not enabled");
349
350 if (at91_boot_soc.map_io)
351 at91_boot_soc.map_io();
352} 320}
353 321
354void __iomem *at91_matrix_base; 322void __iomem *at91_matrix_base;
@@ -360,48 +328,3 @@ void __init at91_ioremap_matrix(u32 base_addr)
360 if (!at91_matrix_base) 328 if (!at91_matrix_base)
361 panic(pr_fmt("Impossible to ioremap at91_matrix_base\n")); 329 panic(pr_fmt("Impossible to ioremap at91_matrix_base\n"));
362} 330}
363
364static struct of_device_id ramc_ids[] = {
365 { .compatible = "atmel,at91rm9200-sdramc", .data = at91rm9200_standby },
366 { .compatible = "atmel,at91sam9260-sdramc", .data = at91sam9_sdram_standby },
367 { .compatible = "atmel,at91sam9g45-ddramc", .data = at91_ddr_standby },
368 { .compatible = "atmel,sama5d3-ddramc", .data = at91_ddr_standby },
369 { /*sentinel*/ }
370};
371
372static void at91_dt_ramc(void)
373{
374 struct device_node *np;
375 const struct of_device_id *of_id;
376 int idx = 0;
377 const void *standby = NULL;
378
379 for_each_matching_node_and_match(np, ramc_ids, &of_id) {
380 at91_ramc_base[idx] = of_iomap(np, 0);
381 if (!at91_ramc_base[idx])
382 panic(pr_fmt("unable to map ramc[%d] cpu registers\n"), idx);
383
384 if (!standby)
385 standby = of_id->data;
386
387 idx++;
388 }
389
390 if (!idx)
391 panic(pr_fmt("unable to find compatible ram controller node in dtb\n"));
392
393 if (!standby) {
394 pr_warn("ramc no standby function available\n");
395 return;
396 }
397
398 at91_pm_set_standby(standby);
399}
400
401void __init at91_dt_initialize(void)
402{
403 at91_dt_ramc();
404
405 if (at91_boot_soc.init)
406 at91_boot_soc.init();
407}
diff --git a/arch/arm/mach-at91/soc.h b/arch/arm/mach-at91/soc.h
deleted file mode 100644
index ae6c0b2f1146..000000000000
--- a/arch/arm/mach-at91/soc.h
+++ /dev/null
@@ -1,77 +0,0 @@
1/*
2 * Copyright (C) 2011 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
3 *
4 * Under GPLv2
5 */
6
7struct at91_init_soc {
8 int builtin;
9 void (*map_io)(void);
10 void (*init)(void);
11};
12
13extern struct at91_init_soc at91_boot_soc;
14extern struct at91_init_soc at91rm9200_soc;
15extern struct at91_init_soc at91sam9260_soc;
16extern struct at91_init_soc at91sam9261_soc;
17extern struct at91_init_soc at91sam9263_soc;
18extern struct at91_init_soc at91sam9g45_soc;
19extern struct at91_init_soc at91sam9rl_soc;
20extern struct at91_init_soc at91sam9x5_soc;
21extern struct at91_init_soc at91sam9n12_soc;
22extern struct at91_init_soc sama5d3_soc;
23extern struct at91_init_soc sama5d4_soc;
24
25#define AT91_SOC_START(_name) \
26struct at91_init_soc __initdata _name##_soc \
27 __used \
28 = { \
29 .builtin = 1, \
30
31#define AT91_SOC_END \
32};
33
34static inline int at91_soc_is_enabled(void)
35{
36 return at91_boot_soc.builtin;
37}
38
39#if !defined(CONFIG_SOC_AT91RM9200)
40#define at91rm9200_soc at91_boot_soc
41#endif
42
43#if !defined(CONFIG_SOC_AT91SAM9260)
44#define at91sam9260_soc at91_boot_soc
45#endif
46
47#if !defined(CONFIG_SOC_AT91SAM9261)
48#define at91sam9261_soc at91_boot_soc
49#endif
50
51#if !defined(CONFIG_SOC_AT91SAM9263)
52#define at91sam9263_soc at91_boot_soc
53#endif
54
55#if !defined(CONFIG_SOC_AT91SAM9G45)
56#define at91sam9g45_soc at91_boot_soc
57#endif
58
59#if !defined(CONFIG_SOC_AT91SAM9RL)
60#define at91sam9rl_soc at91_boot_soc
61#endif
62
63#if !defined(CONFIG_SOC_AT91SAM9X5)
64#define at91sam9x5_soc at91_boot_soc
65#endif
66
67#if !defined(CONFIG_SOC_AT91SAM9N12)
68#define at91sam9n12_soc at91_boot_soc
69#endif
70
71#if !defined(CONFIG_SOC_SAMA5D3)
72#define sama5d3_soc at91_boot_soc
73#endif
74
75#if !defined(CONFIG_SOC_SAMA5D4)
76#define sama5d4_soc at91_boot_soc
77#endif