aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-04-05 17:19:54 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-04-05 17:19:54 -0400
commitff050ad12c551233e546506409c89eb2f640d9f3 (patch)
tree8ae29fece122a91cbd6160fb2ca34c0ea82c3df9 /arch
parentdfc25e4503aef6b82a1de4a0fbe19aafa8648fbe (diff)
parent9233087dc468f75bdeb7830c694c09dc74be88c4 (diff)
Merge tag 'soc-3.15' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull ARM SoC specific changes from Arnd Bergmann: "Lots of changes specific to one of the SoC families. Some that stick out are: - mach-qcom gains new features, most importantly SMP support for the newer chips (Stephen Boyd, Rohit Vaswani) - mvebu gains support for three new SoCs: Armada 375, 380 and 385 (Thomas Petazzoni and Free-electrons team) - SMP support for Rockchips (Heiko Stübner) - Lots of i.MX changes (Shawn Guo) - Added support for BCM5301x SoC (Hauke Mehrtens) - Multiplatform support for Marvell Kirkwood and Dove (Andrew Lunn and Sebastian Hesselbarth doing the final part of a long journey) - Unify davinci platforms and remove obsolete ones (Sekhar Nori, Arnd Bergmann)" * tag 'soc-3.15' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (126 commits) ARM: sunxi: Select HAVE_ARM_ARCH_TIMER ARM: cache-tauros2: remove ARMv6 code ARM: mvebu: don't select CONFIG_NEON ARM: davinci: fix DT booting with default defconfig ARM: configs: bcm_defconfig: enable bcm590xx regulator support ARM: davinci: remove tnetv107x support MAINTAINERS: Update ARM STi maintainers ARM: restrict BCM_KONA_UART to ARCH_BCM_MOBILE ARM: bcm21664: Add board support. ARM: sunxi: Add the new watchog compatibles to the reboot code ARM: enable ARM_HAS_SG_CHAIN for multiplatform ARM: davinci: remove da8xx_omapl_defconfig ARM: davinci: da8xx: fix multiple watchdog device registration ARM: davinci: add da8xx specific configs to davinci_all_defconfig ARM: davinci: enable da8xx build concurrently with older devices ARM: BCM5301X: workaround suppress fault ARM: BCM5301X: add early debugging support ARM: BCM5301X: initial support for the BCM5301X/BCM470X SoCs with ARM CPU ARM: mach-bcm: Remove GENERIC_TIME ARM: shmobile: APMU: Fix warnings due to improper printk formats ...
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/Kconfig5
-rw-r--r--arch/arm/Kconfig.debug22
-rw-r--r--arch/arm/boot/dts/Makefile9
-rw-r--r--arch/arm/boot/dts/kirkwood-mv88f6281gtw-ge.dts62
-rw-r--r--arch/arm/boot/dts/qcom-msm8960.dtsi6
-rw-r--r--arch/arm/boot/dts/qcom-msm8974.dtsi5
-rw-r--r--arch/arm/boot/dts/rk3066a.dtsi13
-rw-r--r--arch/arm/boot/dts/rk3188.dtsi13
-rw-r--r--arch/arm/boot/dts/rk3xxx.dtsi10
-rw-r--r--arch/arm/configs/bcm_defconfig7
-rw-r--r--arch/arm/configs/da8xx_omapl_defconfig139
-rw-r--r--arch/arm/configs/davinci_all_defconfig23
-rw-r--r--arch/arm/configs/imx_v4_v5_defconfig1
-rw-r--r--arch/arm/configs/imx_v6_v7_defconfig7
-rw-r--r--arch/arm/configs/multi_v7_defconfig2
-rw-r--r--arch/arm/configs/mvebu_defconfig1
-rw-r--r--arch/arm/configs/omap2plus_defconfig1
-rw-r--r--arch/arm/firmware/Kconfig3
-rw-r--r--arch/arm/firmware/trusted_foundations.c20
-rw-r--r--arch/arm/include/asm/firmware.h4
-rw-r--r--arch/arm/include/asm/hardware/cache-feroceon-l2.h (renamed from arch/arm/plat-orion/include/plat/cache-feroceon-l2.h)4
-rw-r--r--arch/arm/include/asm/smp.h9
-rw-r--r--arch/arm/include/asm/trusted_foundations.h13
-rw-r--r--arch/arm/kernel/devtree.c40
-rw-r--r--arch/arm/mach-bcm/Kconfig26
-rw-r--r--arch/arm/mach-bcm/Makefile6
-rw-r--r--arch/arm/mach-bcm/bcm_5301x.c61
-rw-r--r--arch/arm/mach-bcm/board_bcm21664.c78
-rw-r--r--arch/arm/mach-clps711x/board-autcpu12.c2
-rw-r--r--arch/arm/mach-clps711x/board-cdb89712.c2
-rw-r--r--arch/arm/mach-clps711x/board-clep7312.c2
-rw-r--r--arch/arm/mach-clps711x/board-edb7211.c2
-rw-r--r--arch/arm/mach-clps711x/board-p720t.c2
-rw-r--r--arch/arm/mach-clps711x/common.c201
-rw-r--r--arch/arm/mach-clps711x/common.h5
-rw-r--r--arch/arm/mach-clps711x/include/mach/clps711x.h16
-rw-r--r--arch/arm/mach-davinci/Kconfig12
-rw-r--r--arch/arm/mach-davinci/Makefile2
-rw-r--r--arch/arm/mach-davinci/Makefile.boot20
-rw-r--r--arch/arm/mach-davinci/board-tnetv107x-evm.c287
-rw-r--r--arch/arm/mach-davinci/davinci.h2
-rw-r--r--arch/arm/mach-davinci/devices-tnetv107x.c434
-rw-r--r--arch/arm/mach-davinci/devices.c17
-rw-r--r--arch/arm/mach-davinci/dm355.c8
-rw-r--r--arch/arm/mach-davinci/dm365.c8
-rw-r--r--arch/arm/mach-davinci/dm644x.c8
-rw-r--r--arch/arm/mach-davinci/dm646x.c8
-rw-r--r--arch/arm/mach-davinci/include/mach/cputype.h8
-rw-r--r--arch/arm/mach-davinci/include/mach/irqs.h97
-rw-r--r--arch/arm/mach-davinci/include/mach/mux.h269
-rw-r--r--arch/arm/mach-davinci/include/mach/psc.h47
-rw-r--r--arch/arm/mach-davinci/include/mach/serial.h8
-rw-r--r--arch/arm/mach-davinci/include/mach/tnetv107x.h61
-rw-r--r--arch/arm/mach-davinci/include/mach/uncompress.h6
-rw-r--r--arch/arm/mach-davinci/tnetv107x.c766
-rw-r--r--arch/arm/mach-dove/Kconfig12
-rw-r--r--arch/arm/mach-dove/Makefile1
-rw-r--r--arch/arm/mach-imx/Kconfig43
-rw-r--r--arch/arm/mach-imx/Makefile9
-rw-r--r--arch/arm/mach-imx/clk-imx21.c1
-rw-r--r--arch/arm/mach-imx/clk-imx25.c8
-rw-r--r--arch/arm/mach-imx/clk-imx27.c1
-rw-r--r--arch/arm/mach-imx/clk-imx51-imx53.c2
-rw-r--r--arch/arm/mach-imx/clk-imx6q.c7
-rw-r--r--arch/arm/mach-imx/clk-imx6sl.c159
-rw-r--r--arch/arm/mach-imx/clk-vf610.c36
-rw-r--r--arch/arm/mach-imx/common.h17
-rw-r--r--arch/arm/mach-imx/cpuidle-imx6q.c4
-rw-r--r--arch/arm/mach-imx/cpuidle-imx6sl.c57
-rw-r--r--arch/arm/mach-imx/cpuidle.h5
-rw-r--r--arch/arm/mach-imx/devices-imx25.h4
-rw-r--r--arch/arm/mach-imx/devices-imx51.h4
-rw-r--r--arch/arm/mach-imx/devices/Kconfig3
-rw-r--r--arch/arm/mach-imx/devices/Makefile1
-rw-r--r--arch/arm/mach-imx/devices/devices-common.h9
-rw-r--r--arch/arm/mach-imx/devices/platform-mxc_pwm.c69
-rw-r--r--arch/arm/mach-imx/hardware.h4
-rw-r--r--arch/arm/mach-imx/headsmp.S40
-rw-r--r--arch/arm/mach-imx/mach-imx6q.c98
-rw-r--r--arch/arm/mach-imx/mach-imx6sl.c6
-rw-r--r--arch/arm/mach-imx/pm-imx6.c551
-rw-r--r--arch/arm/mach-imx/pm-imx6q.c240
-rw-r--r--arch/arm/mach-imx/suspend-imx6.S361
-rw-r--r--arch/arm/mach-imx/time.c12
-rw-r--r--arch/arm/mach-kirkwood/Kconfig7
-rw-r--r--arch/arm/mach-kirkwood/Makefile4
-rw-r--r--arch/arm/mach-kirkwood/board-dt.c113
-rw-r--r--arch/arm/mach-kirkwood/board-mv88f6281gtw_ge.c50
-rw-r--r--arch/arm/mach-kirkwood/common.c3
-rw-r--r--arch/arm/mach-kirkwood/common.h13
-rw-r--r--arch/arm/mach-kirkwood/include/mach/bridge-regs.h2
-rw-r--r--arch/arm/mach-kirkwood/pm.c9
-rw-r--r--arch/arm/mach-kirkwood/pm.h26
-rw-r--r--arch/arm/mach-msm/common.h2
-rw-r--r--arch/arm/mach-mv78xx0/common.c2
-rw-r--r--arch/arm/mach-mvebu/Kconfig79
-rw-r--r--arch/arm/mach-mvebu/Makefile8
-rw-r--r--arch/arm/mach-mvebu/board-t5325.c41
-rw-r--r--arch/arm/mach-mvebu/board-v7.c (renamed from arch/arm/mach-mvebu/armada-370-xp.c)58
-rw-r--r--arch/arm/mach-mvebu/board.h22
-rw-r--r--arch/arm/mach-mvebu/dove.c (renamed from arch/arm/mach-dove/board-dt.c)20
-rw-r--r--arch/arm/mach-mvebu/kirkwood-pm.c76
-rw-r--r--arch/arm/mach-mvebu/kirkwood-pm.h26
-rw-r--r--arch/arm/mach-mvebu/kirkwood.c199
-rw-r--r--arch/arm/mach-mvebu/kirkwood.h22
-rw-r--r--arch/arm/mach-mvebu/mvebu-soc-id.c1
-rw-r--r--arch/arm/mach-mvebu/system-controller.c14
-rw-r--r--arch/arm/mach-omap2/Kconfig7
-rw-r--r--arch/arm/mach-omap2/Makefile1
-rw-r--r--arch/arm/mach-omap2/board-generic.c3
-rw-r--r--arch/arm/mach-omap2/clkt_dpll.c6
-rw-r--r--arch/arm/mach-omap2/cminst44xx.c18
-rw-r--r--arch/arm/mach-omap2/dpll3xxx.c2
-rw-r--r--arch/arm/mach-omap2/id.c16
-rw-r--r--arch/arm/mach-omap2/io.c1
-rw-r--r--arch/arm/mach-omap2/mux.h3
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_43xx_data.c1
-rw-r--r--arch/arm/mach-omap2/prminst44xx.c3
-rw-r--r--arch/arm/mach-omap2/soc.h3
-rw-r--r--arch/arm/mach-omap2/timer.c3
-rw-r--r--arch/arm/mach-qcom/board.c14
-rw-r--r--arch/arm/mach-qcom/platsmp.c341
-rw-r--r--arch/arm/mach-qcom/scm-boot.h8
-rw-r--r--arch/arm/mach-rockchip/Kconfig1
-rw-r--r--arch/arm/mach-rockchip/Makefile1
-rw-r--r--arch/arm/mach-rockchip/core.h22
-rw-r--r--arch/arm/mach-rockchip/headsmp.S30
-rw-r--r--arch/arm/mach-rockchip/platsmp.c184
-rw-r--r--arch/arm/mach-rockchip/rockchip.c2
-rw-r--r--arch/arm/mach-shmobile/Kconfig3
-rw-r--r--arch/arm/mach-shmobile/Makefile3
-rw-r--r--arch/arm/mach-shmobile/include/mach/pm-rcar.h15
-rw-r--r--arch/arm/mach-shmobile/include/mach/r8a7779.h13
-rw-r--r--arch/arm/mach-shmobile/include/mach/r8a7790.h1
-rw-r--r--arch/arm/mach-shmobile/platsmp-apmu.c3
-rw-r--r--arch/arm/mach-shmobile/pm-r8a7779.c131
-rw-r--r--arch/arm/mach-shmobile/pm-r8a7790.c45
-rw-r--r--arch/arm/mach-shmobile/pm-rcar.c141
-rw-r--r--arch/arm/mach-shmobile/setup-rcar-gen2.c2
-rw-r--r--arch/arm/mach-shmobile/smp-r8a7779.c17
-rw-r--r--arch/arm/mach-shmobile/smp-r8a7790.c17
-rw-r--r--arch/arm/mach-sunxi/Kconfig1
-rw-r--r--arch/arm/mach-sunxi/sunxi.c4
-rw-r--r--arch/arm/mach-tegra/Makefile1
-rw-r--r--arch/arm/mach-tegra/cpuidle-tegra114.c7
-rw-r--r--arch/arm/mach-tegra/platsmp.c2
-rw-r--r--arch/arm/mach-tegra/powergate.c2
-rw-r--r--arch/arm/mach-tegra/tegra2_emc.c347
-rw-r--r--arch/arm/mach-tegra/tegra2_emc.h24
-rw-r--r--arch/arm/mm/Kconfig2
-rw-r--r--arch/arm/mm/cache-feroceon-l2.c45
-rw-r--r--arch/arm/mm/cache-tauros2.c29
152 files changed, 3303 insertions, 3673 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 83912d0251ca..b4935db86f37 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -310,6 +310,7 @@ config ARCH_MULTIPLATFORM
310 bool "Allow multiple platforms to be selected" 310 bool "Allow multiple platforms to be selected"
311 depends on MMU 311 depends on MMU
312 select ARCH_WANT_OPTIONAL_GPIOLIB 312 select ARCH_WANT_OPTIONAL_GPIOLIB
313 select ARM_HAS_SG_CHAIN
313 select ARM_PATCH_PHYS_VIRT 314 select ARM_PATCH_PHYS_VIRT
314 select AUTO_ZRELADDR 315 select AUTO_ZRELADDR
315 select COMMON_CLK 316 select COMMON_CLK
@@ -393,8 +394,6 @@ config ARCH_CLPS711X
393 select CPU_ARM720T 394 select CPU_ARM720T
394 select GENERIC_CLOCKEVENTS 395 select GENERIC_CLOCKEVENTS
395 select MFD_SYSCON 396 select MFD_SYSCON
396 select MULTI_IRQ_HANDLER
397 select SPARSE_IRQ
398 help 397 help
399 Support for Cirrus Logic 711x/721x/731x based boards. 398 Support for Cirrus Logic 711x/721x/731x based boards.
400 399
@@ -909,7 +908,7 @@ config ARCH_MULTI_V5
909 bool "ARMv5 based platforms (ARM926T, XSCALE, PJ1, ...)" 908 bool "ARMv5 based platforms (ARM926T, XSCALE, PJ1, ...)"
910 depends on !ARCH_MULTI_V6_V7 909 depends on !ARCH_MULTI_V6_V7
911 select ARCH_MULTI_V4_V5 910 select ARCH_MULTI_V4_V5
912 select CPU_ARM926T if (!CPU_ARM946E || CPU_ARM1020 || \ 911 select CPU_ARM926T if !(CPU_ARM946E || CPU_ARM1020 || \
913 CPU_ARM1020E || CPU_ARM1022 || CPU_ARM1026 || \ 912 CPU_ARM1020E || CPU_ARM1022 || CPU_ARM1026 || \
914 CPU_XSCALE || CPU_XSC3 || CPU_MOHAWK || CPU_FEROCEON) 913 CPU_XSCALE || CPU_XSC3 || CPU_MOHAWK || CPU_FEROCEON)
915 914
diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index 76ee27829c34..8983919a4421 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -106,9 +106,14 @@ choice
106 depends on ARCH_BCM2835 106 depends on ARCH_BCM2835
107 select DEBUG_UART_PL01X 107 select DEBUG_UART_PL01X
108 108
109 config DEBUG_BCM_5301X
110 bool "Kernel low-level debugging on BCM5301X UART1"
111 depends on ARCH_BCM_5301X
112 select DEBUG_UART_PL01X
113
109 config DEBUG_BCM_KONA_UART 114 config DEBUG_BCM_KONA_UART
110 bool "Kernel low-level debugging messages via BCM KONA UART" 115 bool "Kernel low-level debugging messages via BCM KONA UART"
111 depends on ARCH_BCM 116 depends on ARCH_BCM_MOBILE
112 select DEBUG_UART_8250 117 select DEBUG_UART_8250
113 help 118 help
114 Say Y here if you want kernel low-level debugging support 119 Say Y here if you want kernel low-level debugging support
@@ -171,15 +176,6 @@ choice
171 Say Y here if you want the debug print routines to direct 176 Say Y here if you want the debug print routines to direct
172 their output to UART0 serial port on DaVinci DMx devices. 177 their output to UART0 serial port on DaVinci DMx devices.
173 178
174 config DEBUG_DAVINCI_TNETV107X_UART1
175 bool "Kernel low-level debugging on DaVinci TNETV107x using UART1"
176 depends on ARCH_DAVINCI_TNETV107X
177 select DEBUG_UART_8250
178 help
179 Say Y here if you want the debug print routines to direct
180 their output to UART1 serial port on DaVinci TNETV107X
181 devices.
182
183 config DEBUG_ZYNQ_UART0 179 config DEBUG_ZYNQ_UART0
184 bool "Kernel low-level debugging on Xilinx Zynq using UART0" 180 bool "Kernel low-level debugging on Xilinx Zynq using UART0"
185 depends on ARCH_ZYNQ 181 depends on ARCH_ZYNQ
@@ -1014,7 +1010,6 @@ config DEBUG_UART_PHYS
1014 default 0x02530c00 if DEBUG_KEYSTONE_UART0 1010 default 0x02530c00 if DEBUG_KEYSTONE_UART0
1015 default 0x02531000 if DEBUG_KEYSTONE_UART1 1011 default 0x02531000 if DEBUG_KEYSTONE_UART1
1016 default 0x03010fe0 if ARCH_RPC 1012 default 0x03010fe0 if ARCH_RPC
1017 default 0x08108300 if DEBUG_DAVINCI_TNETV107X_UART1
1018 default 0x10009000 if DEBUG_REALVIEW_STD_PORT || DEBUG_CNS3XXX || \ 1013 default 0x10009000 if DEBUG_REALVIEW_STD_PORT || DEBUG_CNS3XXX || \
1019 DEBUG_VEXPRESS_UART0_CA9 1014 DEBUG_VEXPRESS_UART0_CA9
1020 default 0x1010c000 if DEBUG_REALVIEW_PB1176_PORT 1015 default 0x1010c000 if DEBUG_REALVIEW_PB1176_PORT
@@ -1023,6 +1018,7 @@ config DEBUG_UART_PHYS
1023 default 0x101f1000 if ARCH_VERSATILE 1018 default 0x101f1000 if ARCH_VERSATILE
1024 default 0x101fb000 if DEBUG_NOMADIK_UART 1019 default 0x101fb000 if DEBUG_NOMADIK_UART
1025 default 0x16000000 if ARCH_INTEGRATOR 1020 default 0x16000000 if ARCH_INTEGRATOR
1021 default 0x18000300 if DEBUG_BCM_5301X
1026 default 0x1c090000 if DEBUG_VEXPRESS_UART0_RS1 1022 default 0x1c090000 if DEBUG_VEXPRESS_UART0_RS1
1027 default 0x20060000 if DEBUG_RK29_UART0 1023 default 0x20060000 if DEBUG_RK29_UART0
1028 default 0x20064000 if DEBUG_RK29_UART1 || DEBUG_RK3X_UART2 1024 default 0x20064000 if DEBUG_RK29_UART1 || DEBUG_RK3X_UART2
@@ -1071,6 +1067,7 @@ config DEBUG_UART_VIRT
1071 default 0xf0009000 if DEBUG_CNS3XXX 1067 default 0xf0009000 if DEBUG_CNS3XXX
1072 default 0xf01fb000 if DEBUG_NOMADIK_UART 1068 default 0xf01fb000 if DEBUG_NOMADIK_UART
1073 default 0xf0201000 if DEBUG_BCM2835 1069 default 0xf0201000 if DEBUG_BCM2835
1070 default 0xf1000300 if DEBUG_BCM_5301X
1074 default 0xf11f1000 if ARCH_VERSATILE 1071 default 0xf11f1000 if ARCH_VERSATILE
1075 default 0xf1600000 if ARCH_INTEGRATOR 1072 default 0xf1600000 if ARCH_INTEGRATOR
1076 default 0xf1c28000 if DEBUG_SUNXI_UART0 1073 default 0xf1c28000 if DEBUG_SUNXI_UART0
@@ -1110,7 +1107,6 @@ config DEBUG_UART_VIRT
1110 default 0xfed12000 if ARCH_KIRKWOOD 1107 default 0xfed12000 if ARCH_KIRKWOOD
1111 default 0xfedc0000 if ARCH_EP93XX 1108 default 0xfedc0000 if ARCH_EP93XX
1112 default 0xfee003f8 if FOOTBRIDGE 1109 default 0xfee003f8 if FOOTBRIDGE
1113 default 0xfee08300 if DEBUG_DAVINCI_TNETV107X_UART1
1114 default 0xfee20000 if DEBUG_NSPIRE_CLASSIC_UART || DEBUG_NSPIRE_CX_UART 1110 default 0xfee20000 if DEBUG_NSPIRE_CLASSIC_UART || DEBUG_NSPIRE_CX_UART
1115 default 0xfef36000 if DEBUG_HIGHBANK_UART 1111 default 0xfef36000 if DEBUG_HIGHBANK_UART
1116 default 0xfee82340 if ARCH_IOP13XX 1112 default 0xfee82340 if ARCH_IOP13XX
@@ -1135,7 +1131,7 @@ config DEBUG_UART_8250_WORD
1135 default y if DEBUG_PICOXCELL_UART || DEBUG_SOCFPGA_UART || \ 1131 default y if DEBUG_PICOXCELL_UART || DEBUG_SOCFPGA_UART || \
1136 ARCH_KEYSTONE || \ 1132 ARCH_KEYSTONE || \
1137 DEBUG_DAVINCI_DMx_UART0 || DEBUG_DAVINCI_DA8XX_UART1 || \ 1133 DEBUG_DAVINCI_DMx_UART0 || DEBUG_DAVINCI_DA8XX_UART1 || \
1138 DEBUG_DAVINCI_DA8XX_UART2 || DEBUG_DAVINCI_TNETV107X_UART1 || \ 1134 DEBUG_DAVINCI_DA8XX_UART2 || \
1139 DEBUG_BCM_KONA_UART 1135 DEBUG_BCM_KONA_UART
1140 1136
1141config DEBUG_UART_8250_FLOW_CONTROL 1137config DEBUG_UART_8250_FLOW_CONTROL
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index ec4dd7c3ed37..112813a80b71 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -59,7 +59,7 @@ dtb-$(CONFIG_ARCH_BERLIN) += \
59 berlin2cd-google-chromecast.dtb 59 berlin2cd-google-chromecast.dtb
60dtb-$(CONFIG_ARCH_DAVINCI) += da850-enbw-cmc.dtb \ 60dtb-$(CONFIG_ARCH_DAVINCI) += da850-enbw-cmc.dtb \
61 da850-evm.dtb 61 da850-evm.dtb
62dtb-$(CONFIG_ARCH_DOVE) += dove-cm-a510.dtb \ 62dtb-$(CONFIG_MACH_DOVE) += dove-cm-a510.dtb \
63 dove-cubox.dtb \ 63 dove-cubox.dtb \
64 dove-d2plug.dtb \ 64 dove-d2plug.dtb \
65 dove-d3plug.dtb \ 65 dove-d3plug.dtb \
@@ -86,8 +86,8 @@ dtb-$(CONFIG_ARCH_HIGHBANK) += highbank.dtb \
86 ecx-2000.dtb 86 ecx-2000.dtb
87dtb-$(CONFIG_ARCH_INTEGRATOR) += integratorap.dtb \ 87dtb-$(CONFIG_ARCH_INTEGRATOR) += integratorap.dtb \
88 integratorcp.dtb 88 integratorcp.dtb
89dtb-$(CONFIG_ARCH_LPC32XX) += ea3250.dtb phy3250.dtb 89kirkwood := \
90dtb-$(CONFIG_ARCH_KIRKWOOD) += kirkwood-cloudbox.dtb \ 90 kirkwood-cloudbox.dtb \
91 kirkwood-db-88f6281.dtb \ 91 kirkwood-db-88f6281.dtb \
92 kirkwood-db-88f6282.dtb \ 92 kirkwood-db-88f6282.dtb \
93 kirkwood-dns320.dtb \ 93 kirkwood-dns320.dtb \
@@ -121,6 +121,9 @@ dtb-$(CONFIG_ARCH_KIRKWOOD) += kirkwood-cloudbox.dtb \
121 kirkwood-topkick.dtb \ 121 kirkwood-topkick.dtb \
122 kirkwood-ts219-6281.dtb \ 122 kirkwood-ts219-6281.dtb \
123 kirkwood-ts219-6282.dtb 123 kirkwood-ts219-6282.dtb
124dtb-$(CONFIG_ARCH_KIRKWOOD) += $(kirkwood)
125dtb-$(CONFIG_MACH_KIRKWOOD) += $(kirkwood)
126dtb-$(CONFIG_ARCH_LPC32XX) += ea3250.dtb phy3250.dtb
124dtb-$(CONFIG_ARCH_MARCO) += marco-evb.dtb 127dtb-$(CONFIG_ARCH_MARCO) += marco-evb.dtb
125dtb-$(CONFIG_ARCH_MOXART) += moxart-uc7112lx.dtb 128dtb-$(CONFIG_ARCH_MOXART) += moxart-uc7112lx.dtb
126dtb-$(CONFIG_ARCH_MVEBU) += armada-370-db.dtb \ 129dtb-$(CONFIG_ARCH_MVEBU) += armada-370-db.dtb \
diff --git a/arch/arm/boot/dts/kirkwood-mv88f6281gtw-ge.dts b/arch/arm/boot/dts/kirkwood-mv88f6281gtw-ge.dts
index dc86429756d7..2cb0dc529165 100644
--- a/arch/arm/boot/dts/kirkwood-mv88f6281gtw-ge.dts
+++ b/arch/arm/boot/dts/kirkwood-mv88f6281gtw-ge.dts
@@ -122,4 +122,66 @@
122 gpios = <&gpio1 14 GPIO_ACTIVE_LOW>; 122 gpios = <&gpio1 14 GPIO_ACTIVE_LOW>;
123 }; 123 };
124 }; 124 };
125
126 dsa@0 {
127 compatible = "marvell,dsa";
128 #address-cells = <2>;
129 #size-cells = <0>;
130
131 dsa,ethernet = <&eth0>;
132 dsa,mii-bus = <&ethphy0>;
133
134 switch@0 {
135 #address-cells = <1>;
136 #size-cells = <0>;
137 reg = <0 0>; /* MDIO address 0, switch 0 in tree */
138
139 port@0 {
140 reg = <0>;
141 label = "lan1";
142 };
143
144 port@1 {
145 reg = <1>;
146 label = "lan2";
147 };
148
149 port@2 {
150 reg = <2>;
151 label = "lan3";
152 };
153
154 port@3 {
155 reg = <3>;
156 label = "lan4";
157 };
158
159 port@4 {
160 reg = <4>;
161 label = "wan";
162 };
163
164 port@5 {
165 reg = <5>;
166 label = "cpu";
167 };
168 };
169 };
170};
171
172&mdio {
173 status = "okay";
174
175 ethphy0: ethernet-phy@ff {
176 reg = <0xff>; /* No phy attached */
177 speed = <1000>;
178 duplex = <1>;
179 };
180};
181
182&eth0 {
183 status = "okay";
184 ethernet0-port@0 {
185 phy-handle = <&ethphy0>;
186 };
125}; 187};
diff --git a/arch/arm/boot/dts/qcom-msm8960.dtsi b/arch/arm/boot/dts/qcom-msm8960.dtsi
index ff002826552a..3a9c3caa9aad 100644
--- a/arch/arm/boot/dts/qcom-msm8960.dtsi
+++ b/arch/arm/boot/dts/qcom-msm8960.dtsi
@@ -9,6 +9,12 @@
9 compatible = "qcom,msm8960"; 9 compatible = "qcom,msm8960";
10 interrupt-parent = <&intc>; 10 interrupt-parent = <&intc>;
11 11
12 cpu-pmu {
13 compatible = "qcom,krait-pmu";
14 interrupts = <1 10 0x304>;
15 qcom,no-pc-write;
16 };
17
12 intc: interrupt-controller@2000000 { 18 intc: interrupt-controller@2000000 {
13 compatible = "qcom,msm-qgic2"; 19 compatible = "qcom,msm-qgic2";
14 interrupt-controller; 20 interrupt-controller;
diff --git a/arch/arm/boot/dts/qcom-msm8974.dtsi b/arch/arm/boot/dts/qcom-msm8974.dtsi
index 9e5dadb101eb..1eff4130cde0 100644
--- a/arch/arm/boot/dts/qcom-msm8974.dtsi
+++ b/arch/arm/boot/dts/qcom-msm8974.dtsi
@@ -9,6 +9,11 @@
9 compatible = "qcom,msm8974"; 9 compatible = "qcom,msm8974";
10 interrupt-parent = <&intc>; 10 interrupt-parent = <&intc>;
11 11
12 cpu-pmu {
13 compatible = "qcom,krait-pmu";
14 interrupts = <1 7 0xf04>;
15 };
16
12 soc: soc { 17 soc: soc {
13 #address-cells = <1>; 18 #address-cells = <1>;
14 #size-cells = <1>; 19 #size-cells = <1>;
diff --git a/arch/arm/boot/dts/rk3066a.dtsi b/arch/arm/boot/dts/rk3066a.dtsi
index be5d2b09a363..4d4dfbb59f4b 100644
--- a/arch/arm/boot/dts/rk3066a.dtsi
+++ b/arch/arm/boot/dts/rk3066a.dtsi
@@ -64,6 +64,19 @@
64 clock-names = "timer", "pclk"; 64 clock-names = "timer", "pclk";
65 }; 65 };
66 66
67 sram: sram@10080000 {
68 compatible = "mmio-sram";
69 reg = <0x10080000 0x10000>;
70 #address-cells = <1>;
71 #size-cells = <1>;
72 ranges = <0 0x10080000 0x10000>;
73
74 smp-sram@0 {
75 compatible = "rockchip,rk3066-smp-sram";
76 reg = <0x0 0x50>;
77 };
78 };
79
67 pinctrl@20008000 { 80 pinctrl@20008000 {
68 compatible = "rockchip,rk3066a-pinctrl"; 81 compatible = "rockchip,rk3066a-pinctrl";
69 reg = <0x20008000 0x150>; 82 reg = <0x20008000 0x150>;
diff --git a/arch/arm/boot/dts/rk3188.dtsi b/arch/arm/boot/dts/rk3188.dtsi
index 1a26b03b3649..bb36596ea205 100644
--- a/arch/arm/boot/dts/rk3188.dtsi
+++ b/arch/arm/boot/dts/rk3188.dtsi
@@ -60,6 +60,19 @@
60 interrupts = <GIC_PPI 13 0xf04>; 60 interrupts = <GIC_PPI 13 0xf04>;
61 }; 61 };
62 62
63 sram: sram@10080000 {
64 compatible = "mmio-sram";
65 reg = <0x10080000 0x8000>;
66 #address-cells = <1>;
67 #size-cells = <1>;
68 ranges = <0 0x10080000 0x8000>;
69
70 smp-sram@0 {
71 compatible = "rockchip,rk3066-smp-sram";
72 reg = <0x0 0x50>;
73 };
74 };
75
63 pinctrl@20008000 { 76 pinctrl@20008000 {
64 compatible = "rockchip,rk3188-pinctrl"; 77 compatible = "rockchip,rk3188-pinctrl";
65 reg = <0x20008000 0xa0>, 78 reg = <0x20008000 0xa0>,
diff --git a/arch/arm/boot/dts/rk3xxx.dtsi b/arch/arm/boot/dts/rk3xxx.dtsi
index 0fcbcfd67de2..26e5a968d49d 100644
--- a/arch/arm/boot/dts/rk3xxx.dtsi
+++ b/arch/arm/boot/dts/rk3xxx.dtsi
@@ -26,6 +26,16 @@
26 compatible = "simple-bus"; 26 compatible = "simple-bus";
27 ranges; 27 ranges;
28 28
29 scu@1013c000 {
30 compatible = "arm,cortex-a9-scu";
31 reg = <0x1013c000 0x100>;
32 };
33
34 pmu@20004000 {
35 compatible = "rockchip,rk3066-pmu";
36 reg = <0x20004000 0x100>;
37 };
38
29 gic: interrupt-controller@1013d000 { 39 gic: interrupt-controller@1013d000 {
30 compatible = "arm,cortex-a9-gic"; 40 compatible = "arm,cortex-a9-gic";
31 interrupt-controller; 41 interrupt-controller;
diff --git a/arch/arm/configs/bcm_defconfig b/arch/arm/configs/bcm_defconfig
index 2519d6de0640..01004640ee4d 100644
--- a/arch/arm/configs/bcm_defconfig
+++ b/arch/arm/configs/bcm_defconfig
@@ -79,6 +79,13 @@ CONFIG_HW_RANDOM=y
79CONFIG_I2C=y 79CONFIG_I2C=y
80CONFIG_I2C_CHARDEV=y 80CONFIG_I2C_CHARDEV=y
81# CONFIG_HWMON is not set 81# CONFIG_HWMON is not set
82CONFIG_MFD_BCM590XX=y
83CONFIG_REGULATOR=y
84CONFIG_REGULATOR_FIXED_VOLTAGE=y
85CONFIG_REGULATOR_VIRTUAL_CONSUMER=y
86CONFIG_REGULATOR_USERSPACE_CONSUMER=y
87CONFIG_REGULATOR_BCM590XX=y
88
82CONFIG_VIDEO_OUTPUT_CONTROL=y 89CONFIG_VIDEO_OUTPUT_CONTROL=y
83CONFIG_FB=y 90CONFIG_FB=y
84CONFIG_BACKLIGHT_LCD_SUPPORT=y 91CONFIG_BACKLIGHT_LCD_SUPPORT=y
diff --git a/arch/arm/configs/da8xx_omapl_defconfig b/arch/arm/configs/da8xx_omapl_defconfig
deleted file mode 100644
index 1571bea48bed..000000000000
--- a/arch/arm/configs/da8xx_omapl_defconfig
+++ /dev/null
@@ -1,139 +0,0 @@
1CONFIG_EXPERIMENTAL=y
2# CONFIG_SWAP is not set
3CONFIG_SYSVIPC=y
4CONFIG_POSIX_MQUEUE=y
5CONFIG_IKCONFIG=y
6CONFIG_IKCONFIG_PROC=y
7CONFIG_LOG_BUF_SHIFT=14
8CONFIG_CGROUPS=y
9CONFIG_BLK_DEV_INITRD=y
10CONFIG_EXPERT=y
11CONFIG_MODULES=y
12CONFIG_MODULE_UNLOAD=y
13CONFIG_MODULE_FORCE_UNLOAD=y
14CONFIG_MODVERSIONS=y
15# CONFIG_BLK_DEV_BSG is not set
16# CONFIG_IOSCHED_DEADLINE is not set
17# CONFIG_IOSCHED_CFQ is not set
18CONFIG_ARCH_DAVINCI=y
19CONFIG_ARCH_DAVINCI_DA830=y
20CONFIG_ARCH_DAVINCI_DA850=y
21CONFIG_MACH_DA8XX_DT=y
22CONFIG_MACH_MITYOMAPL138=y
23CONFIG_MACH_OMAPL138_HAWKBOARD=y
24CONFIG_DAVINCI_RESET_CLOCKS=y
25CONFIG_NO_HZ=y
26CONFIG_HIGH_RES_TIMERS=y
27CONFIG_PREEMPT=y
28CONFIG_AEABI=y
29# CONFIG_OABI_COMPAT is not set
30CONFIG_LEDS=y
31CONFIG_USE_OF=y
32CONFIG_ZBOOT_ROM_TEXT=0x0
33CONFIG_ZBOOT_ROM_BSS=0x0
34CONFIG_CPU_FREQ=y
35CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE=y
36CONFIG_CPU_FREQ_GOV_PERFORMANCE=m
37CONFIG_CPU_FREQ_GOV_POWERSAVE=m
38CONFIG_CPU_FREQ_GOV_ONDEMAND=m
39CONFIG_CPU_IDLE=y
40CONFIG_PM_RUNTIME=y
41CONFIG_NET=y
42CONFIG_PACKET=y
43CONFIG_UNIX=y
44CONFIG_INET=y
45CONFIG_IP_PNP=y
46CONFIG_IP_PNP_DHCP=y
47# CONFIG_INET_LRO is not set
48CONFIG_NETFILTER=y
49CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
50CONFIG_DEVTMPFS=y
51CONFIG_DEVTMPFS_MOUNT=y
52# CONFIG_FW_LOADER is not set
53CONFIG_BLK_DEV_LOOP=m
54CONFIG_BLK_DEV_RAM=y
55CONFIG_BLK_DEV_RAM_COUNT=1
56CONFIG_BLK_DEV_RAM_SIZE=32768
57CONFIG_EEPROM_AT24=y
58CONFIG_SCSI=m
59CONFIG_BLK_DEV_SD=m
60CONFIG_NETDEVICES=y
61CONFIG_TUN=m
62CONFIG_LXT_PHY=y
63CONFIG_LSI_ET1011C_PHY=y
64CONFIG_NET_ETHERNET=y
65CONFIG_MII=y
66CONFIG_TI_DAVINCI_EMAC=y
67# CONFIG_NETDEV_1000 is not set
68# CONFIG_NETDEV_10000 is not set
69CONFIG_NETCONSOLE=y
70CONFIG_NETPOLL_TRAP=y
71CONFIG_INPUT_MOUSEDEV=m
72CONFIG_INPUT_EVDEV=m
73CONFIG_INPUT_EVBUG=m
74CONFIG_KEYBOARD_ATKBD=m
75CONFIG_KEYBOARD_GPIO=y
76CONFIG_KEYBOARD_XTKBD=m
77# CONFIG_INPUT_MOUSE is not set
78CONFIG_INPUT_TOUCHSCREEN=y
79CONFIG_SERIO_LIBPS2=y
80# CONFIG_VT_CONSOLE is not set
81CONFIG_SERIAL_8250=y
82CONFIG_SERIAL_8250_CONSOLE=y
83CONFIG_SERIAL_8250_NR_UARTS=3
84CONFIG_SERIAL_OF_PLATFORM=y
85CONFIG_I2C=y
86CONFIG_I2C_CHARDEV=y
87CONFIG_I2C_DAVINCI=y
88CONFIG_PINCTRL_SINGLE=y
89# CONFIG_HWMON is not set
90CONFIG_WATCHDOG=y
91CONFIG_REGULATOR=y
92CONFIG_REGULATOR_DUMMY=y
93CONFIG_REGULATOR_TPS6507X=y
94CONFIG_FB=y
95CONFIG_FB_DA8XX=y
96# CONFIG_VGA_CONSOLE is not set
97CONFIG_FRAMEBUFFER_CONSOLE=y
98CONFIG_LOGO=y
99CONFIG_SOUND=m
100CONFIG_SND=m
101CONFIG_SND_SOC=m
102CONFIG_SND_DAVINCI_SOC=m
103# CONFIG_HID_SUPPORT is not set
104# CONFIG_USB_SUPPORT is not set
105CONFIG_DMADEVICES=y
106CONFIG_TI_EDMA=y
107CONFIG_EXT2_FS=y
108CONFIG_EXT3_FS=y
109CONFIG_XFS_FS=m
110CONFIG_INOTIFY=y
111CONFIG_AUTOFS4_FS=m
112CONFIG_MSDOS_FS=y
113CONFIG_VFAT_FS=y
114CONFIG_TMPFS=y
115CONFIG_CRAMFS=y
116CONFIG_MINIX_FS=m
117CONFIG_NFS_FS=y
118CONFIG_NFS_V3=y
119CONFIG_ROOT_NFS=y
120CONFIG_NFSD=m
121CONFIG_NFSD_V3=y
122CONFIG_SMB_FS=m
123CONFIG_PARTITION_ADVANCED=y
124CONFIG_NLS_CODEPAGE_437=y
125CONFIG_NLS_ASCII=m
126CONFIG_NLS_ISO8859_1=y
127CONFIG_NLS_UTF8=m
128CONFIG_DEBUG_FS=y
129CONFIG_DEBUG_KERNEL=y
130CONFIG_TIMER_STATS=y
131CONFIG_DEBUG_RT_MUTEXES=y
132CONFIG_DEBUG_MUTEXES=y
133# CONFIG_RCU_CPU_STALL_DETECTOR is not set
134CONFIG_DEBUG_USER=y
135CONFIG_DEBUG_ERRORS=y
136# CONFIG_CRYPTO_ANSI_CPRNG is not set
137# CONFIG_CRYPTO_HW is not set
138CONFIG_CRC_CCITT=m
139CONFIG_CRC_T10DIF=m
diff --git a/arch/arm/configs/davinci_all_defconfig b/arch/arm/configs/davinci_all_defconfig
index 932b932c8856..2a282c051cfd 100644
--- a/arch/arm/configs/davinci_all_defconfig
+++ b/arch/arm/configs/davinci_all_defconfig
@@ -20,9 +20,14 @@ CONFIG_ARCH_DAVINCI_DM644x=y
20CONFIG_ARCH_DAVINCI_DM355=y 20CONFIG_ARCH_DAVINCI_DM355=y
21CONFIG_ARCH_DAVINCI_DM646x=y 21CONFIG_ARCH_DAVINCI_DM646x=y
22CONFIG_ARCH_DAVINCI_DM365=y 22CONFIG_ARCH_DAVINCI_DM365=y
23CONFIG_ARCH_DAVINCI_DA830=y
24CONFIG_ARCH_DAVINCI_DA850=y
25CONFIG_MACH_DA8XX_DT=y
23CONFIG_MACH_SFFSDR=y 26CONFIG_MACH_SFFSDR=y
24CONFIG_MACH_NEUROS_OSD2=y 27CONFIG_MACH_NEUROS_OSD2=y
25CONFIG_MACH_DM355_LEOPARD=y 28CONFIG_MACH_DM355_LEOPARD=y
29CONFIG_MACH_MITYOMAPL138=y
30CONFIG_MACH_OMAPL138_HAWKBOARD=y
26CONFIG_DAVINCI_MUX_DEBUG=y 31CONFIG_DAVINCI_MUX_DEBUG=y
27CONFIG_DAVINCI_MUX_WARNINGS=y 32CONFIG_DAVINCI_MUX_WARNINGS=y
28CONFIG_DAVINCI_RESET_CLOCKS=y 33CONFIG_DAVINCI_RESET_CLOCKS=y
@@ -32,8 +37,18 @@ CONFIG_PREEMPT=y
32CONFIG_AEABI=y 37CONFIG_AEABI=y
33# CONFIG_OABI_COMPAT is not set 38# CONFIG_OABI_COMPAT is not set
34CONFIG_LEDS=y 39CONFIG_LEDS=y
40CONFIG_USE_OF=y
35CONFIG_ZBOOT_ROM_TEXT=0x0 41CONFIG_ZBOOT_ROM_TEXT=0x0
36CONFIG_ZBOOT_ROM_BSS=0x0 42CONFIG_ZBOOT_ROM_BSS=0x0
43CONFIG_ARM_APPENDED_DTB=y
44CONFIG_ARM_ATAG_DTB_COMPAT=y
45CONFIG_AUTO_ZRELADDR=y
46CONFIG_CPU_FREQ=y
47CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE=y
48CONFIG_CPU_FREQ_GOV_PERFORMANCE=m
49CONFIG_CPU_FREQ_GOV_POWERSAVE=m
50CONFIG_CPU_FREQ_GOV_ONDEMAND=m
51CONFIG_CPU_IDLE=y
37CONFIG_PM_RUNTIME=y 52CONFIG_PM_RUNTIME=y
38CONFIG_NET=y 53CONFIG_NET=y
39CONFIG_PACKET=y 54CONFIG_PACKET=y
@@ -57,6 +72,7 @@ CONFIG_MTD_CFI_AMDSTD=m
57CONFIG_MTD_PHYSMAP=m 72CONFIG_MTD_PHYSMAP=m
58CONFIG_MTD_NAND=m 73CONFIG_MTD_NAND=m
59CONFIG_MTD_NAND_DAVINCI=m 74CONFIG_MTD_NAND_DAVINCI=m
75CONFIG_PROC_DEVICETREE=y
60CONFIG_BLK_DEV_LOOP=m 76CONFIG_BLK_DEV_LOOP=m
61CONFIG_BLK_DEV_RAM=y 77CONFIG_BLK_DEV_RAM=y
62CONFIG_BLK_DEV_RAM_COUNT=1 78CONFIG_BLK_DEV_RAM_COUNT=1
@@ -71,6 +87,7 @@ CONFIG_TUN=m
71CONFIG_LXT_PHY=y 87CONFIG_LXT_PHY=y
72CONFIG_LSI_ET1011C_PHY=y 88CONFIG_LSI_ET1011C_PHY=y
73CONFIG_NET_ETHERNET=y 89CONFIG_NET_ETHERNET=y
90CONFIG_MII=y
74CONFIG_TI_DAVINCI_EMAC=y 91CONFIG_TI_DAVINCI_EMAC=y
75CONFIG_DM9000=y 92CONFIG_DM9000=y
76# CONFIG_NETDEV_1000 is not set 93# CONFIG_NETDEV_1000 is not set
@@ -97,15 +114,21 @@ CONFIG_SERIAL_8250=y
97CONFIG_SERIAL_8250_CONSOLE=y 114CONFIG_SERIAL_8250_CONSOLE=y
98CONFIG_SERIAL_8250_NR_UARTS=3 115CONFIG_SERIAL_8250_NR_UARTS=3
99# CONFIG_HW_RANDOM is not set 116# CONFIG_HW_RANDOM is not set
117CONFIG_SERIAL_OF_PLATFORM=y
100CONFIG_I2C=y 118CONFIG_I2C=y
101CONFIG_I2C_CHARDEV=y 119CONFIG_I2C_CHARDEV=y
102CONFIG_I2C_DAVINCI=y 120CONFIG_I2C_DAVINCI=y
121CONFIG_PINCTRL_SINGLE=y
103CONFIG_GPIO_PCF857X=y 122CONFIG_GPIO_PCF857X=y
104CONFIG_WATCHDOG=y 123CONFIG_WATCHDOG=y
105CONFIG_DAVINCI_WATCHDOG=m 124CONFIG_DAVINCI_WATCHDOG=m
106CONFIG_MFD_DM355EVM_MSP=y 125CONFIG_MFD_DM355EVM_MSP=y
126CONFIG_TPS6507X=y
107CONFIG_VIDEO_OUTPUT_CONTROL=m 127CONFIG_VIDEO_OUTPUT_CONTROL=m
128CONFIG_REGULATOR=y
129CONFIG_REGULATOR_TPS6507X=y
108CONFIG_FB=y 130CONFIG_FB=y
131CONFIG_FB_DA8XX=y
109CONFIG_FIRMWARE_EDID=y 132CONFIG_FIRMWARE_EDID=y
110# CONFIG_VGA_CONSOLE is not set 133# CONFIG_VGA_CONSOLE is not set
111CONFIG_FRAMEBUFFER_CONSOLE=y 134CONFIG_FRAMEBUFFER_CONSOLE=y
diff --git a/arch/arm/configs/imx_v4_v5_defconfig b/arch/arm/configs/imx_v4_v5_defconfig
index 6309ee52ccfc..f1aeb7d72712 100644
--- a/arch/arm/configs/imx_v4_v5_defconfig
+++ b/arch/arm/configs/imx_v4_v5_defconfig
@@ -154,6 +154,7 @@ CONFIG_USB=y
154CONFIG_USB_EHCI_HCD=y 154CONFIG_USB_EHCI_HCD=y
155CONFIG_USB_EHCI_MXC=y 155CONFIG_USB_EHCI_MXC=y
156CONFIG_MMC=y 156CONFIG_MMC=y
157CONFIG_MMC_UNSAFE_RESUME=y
157CONFIG_MMC_SDHCI=y 158CONFIG_MMC_SDHCI=y
158CONFIG_MMC_SDHCI_PLTFM=y 159CONFIG_MMC_SDHCI_PLTFM=y
159CONFIG_MMC_SDHCI_ESDHC_IMX=y 160CONFIG_MMC_SDHCI_ESDHC_IMX=y
diff --git a/arch/arm/configs/imx_v6_v7_defconfig b/arch/arm/configs/imx_v6_v7_defconfig
index 53e82c2523eb..09e974392fa1 100644
--- a/arch/arm/configs/imx_v6_v7_defconfig
+++ b/arch/arm/configs/imx_v6_v7_defconfig
@@ -39,6 +39,8 @@ CONFIG_SOC_IMX53=y
39CONFIG_SOC_IMX6Q=y 39CONFIG_SOC_IMX6Q=y
40CONFIG_SOC_IMX6SL=y 40CONFIG_SOC_IMX6SL=y
41CONFIG_SOC_VF610=y 41CONFIG_SOC_VF610=y
42CONFIG_PCI=y
43CONFIG_PCI_IMX6=y
42CONFIG_SMP=y 44CONFIG_SMP=y
43CONFIG_VMSPLIT_2G=y 45CONFIG_VMSPLIT_2G=y
44CONFIG_PREEMPT_VOLUNTARY=y 46CONFIG_PREEMPT_VOLUNTARY=y
@@ -165,6 +167,7 @@ CONFIG_REGULATOR=y
165CONFIG_REGULATOR_FIXED_VOLTAGE=y 167CONFIG_REGULATOR_FIXED_VOLTAGE=y
166CONFIG_REGULATOR_ANATOP=y 168CONFIG_REGULATOR_ANATOP=y
167CONFIG_REGULATOR_DA9052=y 169CONFIG_REGULATOR_DA9052=y
170CONFIG_REGULATOR_GPIO=y
168CONFIG_REGULATOR_MC13783=y 171CONFIG_REGULATOR_MC13783=y
169CONFIG_REGULATOR_MC13892=y 172CONFIG_REGULATOR_MC13892=y
170CONFIG_REGULATOR_PFUZE100=y 173CONFIG_REGULATOR_PFUZE100=y
@@ -186,6 +189,7 @@ CONFIG_LCD_L4F00242T03=y
186CONFIG_LCD_PLATFORM=y 189CONFIG_LCD_PLATFORM=y
187CONFIG_BACKLIGHT_CLASS_DEVICE=y 190CONFIG_BACKLIGHT_CLASS_DEVICE=y
188CONFIG_BACKLIGHT_PWM=y 191CONFIG_BACKLIGHT_PWM=y
192CONFIG_BACKLIGHT_GPIO=y
189CONFIG_FRAMEBUFFER_CONSOLE=y 193CONFIG_FRAMEBUFFER_CONSOLE=y
190CONFIG_LOGO=y 194CONFIG_LOGO=y
191CONFIG_SOUND=y 195CONFIG_SOUND=y
@@ -211,6 +215,7 @@ CONFIG_USB_GADGET=y
211CONFIG_USB_ETH=m 215CONFIG_USB_ETH=m
212CONFIG_USB_MASS_STORAGE=m 216CONFIG_USB_MASS_STORAGE=m
213CONFIG_MMC=y 217CONFIG_MMC=y
218CONFIG_MMC_UNSAFE_RESUME=y
214CONFIG_MMC_SDHCI=y 219CONFIG_MMC_SDHCI=y
215CONFIG_MMC_SDHCI_PLTFM=y 220CONFIG_MMC_SDHCI_PLTFM=y
216CONFIG_MMC_SDHCI_ESDHC_IMX=y 221CONFIG_MMC_SDHCI_ESDHC_IMX=y
@@ -225,6 +230,7 @@ CONFIG_LEDS_TRIGGER_BACKLIGHT=y
225CONFIG_LEDS_TRIGGER_GPIO=y 230CONFIG_LEDS_TRIGGER_GPIO=y
226CONFIG_RTC_CLASS=y 231CONFIG_RTC_CLASS=y
227CONFIG_RTC_INTF_DEV_UIE_EMUL=y 232CONFIG_RTC_INTF_DEV_UIE_EMUL=y
233CONFIG_RTC_DRV_PCF8563=y
228CONFIG_RTC_DRV_MC13XXX=y 234CONFIG_RTC_DRV_MC13XXX=y
229CONFIG_RTC_DRV_MXC=y 235CONFIG_RTC_DRV_MXC=y
230CONFIG_RTC_DRV_SNVS=y 236CONFIG_RTC_DRV_SNVS=y
@@ -277,6 +283,7 @@ CONFIG_NLS_ASCII=y
277CONFIG_NLS_ISO8859_1=y 283CONFIG_NLS_ISO8859_1=y
278CONFIG_NLS_ISO8859_15=m 284CONFIG_NLS_ISO8859_15=m
279CONFIG_NLS_UTF8=y 285CONFIG_NLS_UTF8=y
286CONFIG_DEBUG_FS=y
280CONFIG_MAGIC_SYSRQ=y 287CONFIG_MAGIC_SYSRQ=y
281# CONFIG_SCHED_DEBUG is not set 288# CONFIG_SCHED_DEBUG is not set
282CONFIG_PROVE_LOCKING=y 289CONFIG_PROVE_LOCKING=y
diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig
index ee6982976d66..4863cdc3fb95 100644
--- a/arch/arm/configs/multi_v7_defconfig
+++ b/arch/arm/configs/multi_v7_defconfig
@@ -11,6 +11,7 @@ CONFIG_ARCH_MVEBU=y
11CONFIG_MACH_ARMADA_370=y 11CONFIG_MACH_ARMADA_370=y
12CONFIG_MACH_ARMADA_XP=y 12CONFIG_MACH_ARMADA_XP=y
13CONFIG_ARCH_BCM=y 13CONFIG_ARCH_BCM=y
14CONFIG_ARCH_BCM_5301X=y
14CONFIG_ARCH_BCM_MOBILE=y 15CONFIG_ARCH_BCM_MOBILE=y
15CONFIG_ARCH_BERLIN=y 16CONFIG_ARCH_BERLIN=y
16CONFIG_MACH_BERLIN_BG2=y 17CONFIG_MACH_BERLIN_BG2=y
@@ -55,6 +56,7 @@ CONFIG_ARCH_VEXPRESS_CA9X4=y
55CONFIG_ARCH_VIRT=y 56CONFIG_ARCH_VIRT=y
56CONFIG_ARCH_WM8850=y 57CONFIG_ARCH_WM8850=y
57CONFIG_ARCH_ZYNQ=y 58CONFIG_ARCH_ZYNQ=y
59CONFIG_NEON=y
58CONFIG_TRUSTED_FOUNDATIONS=y 60CONFIG_TRUSTED_FOUNDATIONS=y
59CONFIG_PCI=y 61CONFIG_PCI=y
60CONFIG_PCI_MSI=y 62CONFIG_PCI_MSI=y
diff --git a/arch/arm/configs/mvebu_defconfig b/arch/arm/configs/mvebu_defconfig
index 0f4511d2849f..2ffba3d7b5a5 100644
--- a/arch/arm/configs/mvebu_defconfig
+++ b/arch/arm/configs/mvebu_defconfig
@@ -11,6 +11,7 @@ CONFIG_MODULE_UNLOAD=y
11CONFIG_ARCH_MVEBU=y 11CONFIG_ARCH_MVEBU=y
12CONFIG_MACH_ARMADA_370=y 12CONFIG_MACH_ARMADA_370=y
13CONFIG_MACH_ARMADA_XP=y 13CONFIG_MACH_ARMADA_XP=y
14CONFIG_NEON=y
14# CONFIG_CACHE_L2X0 is not set 15# CONFIG_CACHE_L2X0 is not set
15# CONFIG_SWP_EMULATE is not set 16# CONFIG_SWP_EMULATE is not set
16CONFIG_PCI=y 17CONFIG_PCI=y
diff --git a/arch/arm/configs/omap2plus_defconfig b/arch/arm/configs/omap2plus_defconfig
index 3a0b53d225e7..364ba38e40f3 100644
--- a/arch/arm/configs/omap2plus_defconfig
+++ b/arch/arm/configs/omap2plus_defconfig
@@ -28,6 +28,7 @@ CONFIG_ARCH_OMAP3=y
28CONFIG_ARCH_OMAP4=y 28CONFIG_ARCH_OMAP4=y
29CONFIG_SOC_OMAP5=y 29CONFIG_SOC_OMAP5=y
30CONFIG_SOC_AM33XX=y 30CONFIG_SOC_AM33XX=y
31CONFIG_SOC_AM43XX=y
31CONFIG_SOC_DRA7XX=y 32CONFIG_SOC_DRA7XX=y
32CONFIG_ARM_THUMBEE=y 33CONFIG_ARM_THUMBEE=y
33CONFIG_ARM_ERRATA_411920=y 34CONFIG_ARM_ERRATA_411920=y
diff --git a/arch/arm/firmware/Kconfig b/arch/arm/firmware/Kconfig
index bb00ccf00d66..ad396af68e47 100644
--- a/arch/arm/firmware/Kconfig
+++ b/arch/arm/firmware/Kconfig
@@ -11,6 +11,7 @@ menu "Firmware options"
11config TRUSTED_FOUNDATIONS 11config TRUSTED_FOUNDATIONS
12 bool "Trusted Foundations secure monitor support" 12 bool "Trusted Foundations secure monitor support"
13 depends on ARCH_SUPPORTS_TRUSTED_FOUNDATIONS 13 depends on ARCH_SUPPORTS_TRUSTED_FOUNDATIONS
14 default y
14 help 15 help
15 Some devices (including most Tegra-based consumer devices on the 16 Some devices (including most Tegra-based consumer devices on the
16 market) are booted with the Trusted Foundations secure monitor 17 market) are booted with the Trusted Foundations secure monitor
@@ -20,7 +21,7 @@ config TRUSTED_FOUNDATIONS
20 This option allows the kernel to invoke the secure monitor whenever 21 This option allows the kernel to invoke the secure monitor whenever
21 required on devices using Trusted Foundations. See 22 required on devices using Trusted Foundations. See
22 arch/arm/include/asm/trusted_foundations.h or the 23 arch/arm/include/asm/trusted_foundations.h or the
23 tl,trusted-foundations device tree binding documentation for details 24 tlm,trusted-foundations device tree binding documentation for details
24 on how to use it. 25 on how to use it.
25 26
26 Say n if you don't know what this is about. 27 Say n if you don't know what this is about.
diff --git a/arch/arm/firmware/trusted_foundations.c b/arch/arm/firmware/trusted_foundations.c
index ef1e3d8f4af0..3fb1b5a1dce9 100644
--- a/arch/arm/firmware/trusted_foundations.c
+++ b/arch/arm/firmware/trusted_foundations.c
@@ -22,6 +22,15 @@
22 22
23#define TF_SET_CPU_BOOT_ADDR_SMC 0xfffff200 23#define TF_SET_CPU_BOOT_ADDR_SMC 0xfffff200
24 24
25#define TF_CPU_PM 0xfffffffc
26#define TF_CPU_PM_S3 0xffffffe3
27#define TF_CPU_PM_S2 0xffffffe6
28#define TF_CPU_PM_S2_NO_MC_CLK 0xffffffe5
29#define TF_CPU_PM_S1 0xffffffe4
30#define TF_CPU_PM_S1_NOFLUSH_L2 0xffffffe7
31
32static unsigned long cpu_boot_addr;
33
25static void __naked tf_generic_smc(u32 type, u32 arg1, u32 arg2) 34static void __naked tf_generic_smc(u32 type, u32 arg1, u32 arg2)
26{ 35{
27 asm volatile( 36 asm volatile(
@@ -41,13 +50,22 @@ static void __naked tf_generic_smc(u32 type, u32 arg1, u32 arg2)
41 50
42static int tf_set_cpu_boot_addr(int cpu, unsigned long boot_addr) 51static int tf_set_cpu_boot_addr(int cpu, unsigned long boot_addr)
43{ 52{
44 tf_generic_smc(TF_SET_CPU_BOOT_ADDR_SMC, boot_addr, 0); 53 cpu_boot_addr = boot_addr;
54 tf_generic_smc(TF_SET_CPU_BOOT_ADDR_SMC, cpu_boot_addr, 0);
55
56 return 0;
57}
58
59static int tf_prepare_idle(void)
60{
61 tf_generic_smc(TF_CPU_PM, TF_CPU_PM_S1_NOFLUSH_L2, cpu_boot_addr);
45 62
46 return 0; 63 return 0;
47} 64}
48 65
49static const struct firmware_ops trusted_foundations_ops = { 66static const struct firmware_ops trusted_foundations_ops = {
50 .set_cpu_boot_addr = tf_set_cpu_boot_addr, 67 .set_cpu_boot_addr = tf_set_cpu_boot_addr,
68 .prepare_idle = tf_prepare_idle,
51}; 69};
52 70
53void register_trusted_foundations(struct trusted_foundations_platform_data *pd) 71void register_trusted_foundations(struct trusted_foundations_platform_data *pd)
diff --git a/arch/arm/include/asm/firmware.h b/arch/arm/include/asm/firmware.h
index 15631300c238..2c9f10df7568 100644
--- a/arch/arm/include/asm/firmware.h
+++ b/arch/arm/include/asm/firmware.h
@@ -22,6 +22,10 @@
22 */ 22 */
23struct firmware_ops { 23struct firmware_ops {
24 /* 24 /*
25 * Inform the firmware we intend to enter CPU idle mode
26 */
27 int (*prepare_idle)(void);
28 /*
25 * Enters CPU idle mode 29 * Enters CPU idle mode
26 */ 30 */
27 int (*do_idle)(void); 31 int (*do_idle)(void);
diff --git a/arch/arm/plat-orion/include/plat/cache-feroceon-l2.h b/arch/arm/include/asm/hardware/cache-feroceon-l2.h
index 06f982d55697..12e1588dc4f1 100644
--- a/arch/arm/plat-orion/include/plat/cache-feroceon-l2.h
+++ b/arch/arm/include/asm/hardware/cache-feroceon-l2.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * arch/arm/plat-orion/include/plat/cache-feroceon-l2.h 2 * arch/arm/include/asm/hardware/cache-feroceon-l2.h
3 * 3 *
4 * Copyright (C) 2008 Marvell Semiconductor 4 * Copyright (C) 2008 Marvell Semiconductor
5 * 5 *
@@ -9,3 +9,5 @@
9 */ 9 */
10 10
11extern void __init feroceon_l2_init(int l2_wt_override); 11extern void __init feroceon_l2_init(int l2_wt_override);
12extern int __init feroceon_of_init(void);
13
diff --git a/arch/arm/include/asm/smp.h b/arch/arm/include/asm/smp.h
index 4157aec4e307..2ec765c39ab4 100644
--- a/arch/arm/include/asm/smp.h
+++ b/arch/arm/include/asm/smp.h
@@ -115,6 +115,15 @@ struct smp_operations {
115#endif 115#endif
116}; 116};
117 117
118struct of_cpu_method {
119 const char *method;
120 struct smp_operations *ops;
121};
122
123#define CPU_METHOD_OF_DECLARE(name, _method, _ops) \
124 static const struct of_cpu_method __cpu_method_of_table_##name \
125 __used __section(__cpu_method_of_table) \
126 = { .method = _method, .ops = _ops }
118/* 127/*
119 * set platform specific SMP operations 128 * set platform specific SMP operations
120 */ 129 */
diff --git a/arch/arm/include/asm/trusted_foundations.h b/arch/arm/include/asm/trusted_foundations.h
index 3bd36e2c5f2e..b5f7705abcb0 100644
--- a/arch/arm/include/asm/trusted_foundations.h
+++ b/arch/arm/include/asm/trusted_foundations.h
@@ -30,6 +30,8 @@
30#include <linux/printk.h> 30#include <linux/printk.h>
31#include <linux/bug.h> 31#include <linux/bug.h>
32#include <linux/of.h> 32#include <linux/of.h>
33#include <linux/cpu.h>
34#include <linux/smp.h>
33 35
34struct trusted_foundations_platform_data { 36struct trusted_foundations_platform_data {
35 unsigned int version_major; 37 unsigned int version_major;
@@ -47,10 +49,13 @@ static inline void register_trusted_foundations(
47 struct trusted_foundations_platform_data *pd) 49 struct trusted_foundations_platform_data *pd)
48{ 50{
49 /* 51 /*
50 * If we try to register TF, this means the system needs it to continue. 52 * If the system requires TF and we cannot provide it, continue booting
51 * Its absence if thus a fatal error. 53 * but disable features that cannot be provided.
52 */ 54 */
53 panic("No support for Trusted Foundations, stopping...\n"); 55 pr_err("No support for Trusted Foundations, continuing in degraded mode.\n");
56 pr_err("Secondary processors as well as CPU PM will be disabled.\n");
57 setup_max_cpus = 0;
58 cpu_idle_poll_ctrl(true);
54} 59}
55 60
56static inline void of_register_trusted_foundations(void) 61static inline void of_register_trusted_foundations(void)
@@ -59,7 +64,7 @@ static inline void of_register_trusted_foundations(void)
59 * If we find the target should enable TF but does not support it, 64 * If we find the target should enable TF but does not support it,
60 * fail as the system won't be able to do much anyway 65 * fail as the system won't be able to do much anyway
61 */ 66 */
62 if (of_find_compatible_node(NULL, NULL, "tl,trusted-foundations")) 67 if (of_find_compatible_node(NULL, NULL, "tlm,trusted-foundations"))
63 register_trusted_foundations(NULL); 68 register_trusted_foundations(NULL);
64} 69}
65#endif /* CONFIG_TRUSTED_FOUNDATIONS */ 70#endif /* CONFIG_TRUSTED_FOUNDATIONS */
diff --git a/arch/arm/kernel/devtree.c b/arch/arm/kernel/devtree.c
index f751714d52c1..c7419a585ddc 100644
--- a/arch/arm/kernel/devtree.c
+++ b/arch/arm/kernel/devtree.c
@@ -18,6 +18,7 @@
18#include <linux/of_fdt.h> 18#include <linux/of_fdt.h>
19#include <linux/of_irq.h> 19#include <linux/of_irq.h>
20#include <linux/of_platform.h> 20#include <linux/of_platform.h>
21#include <linux/smp.h>
21 22
22#include <asm/cputype.h> 23#include <asm/cputype.h>
23#include <asm/setup.h> 24#include <asm/setup.h>
@@ -63,6 +64,34 @@ void __init arm_dt_memblock_reserve(void)
63 } 64 }
64} 65}
65 66
67#ifdef CONFIG_SMP
68extern struct of_cpu_method __cpu_method_of_table_begin[];
69extern struct of_cpu_method __cpu_method_of_table_end[];
70
71static int __init set_smp_ops_by_method(struct device_node *node)
72{
73 const char *method;
74 struct of_cpu_method *m = __cpu_method_of_table_begin;
75
76 if (of_property_read_string(node, "enable-method", &method))
77 return 0;
78
79 for (; m < __cpu_method_of_table_end; m++)
80 if (!strcmp(m->method, method)) {
81 smp_set_ops(m->ops);
82 return 1;
83 }
84
85 return 0;
86}
87#else
88static inline int set_smp_ops_by_method(struct device_node *node)
89{
90 return 1;
91}
92#endif
93
94
66/* 95/*
67 * arm_dt_init_cpu_maps - Function retrieves cpu nodes from the device tree 96 * arm_dt_init_cpu_maps - Function retrieves cpu nodes from the device tree
68 * and builds the cpu logical map array containing MPIDR values related to 97 * and builds the cpu logical map array containing MPIDR values related to
@@ -79,6 +108,7 @@ void __init arm_dt_init_cpu_maps(void)
79 * read as 0. 108 * read as 0.
80 */ 109 */
81 struct device_node *cpu, *cpus; 110 struct device_node *cpu, *cpus;
111 int found_method = 0;
82 u32 i, j, cpuidx = 1; 112 u32 i, j, cpuidx = 1;
83 u32 mpidr = is_smp() ? read_cpuid_mpidr() & MPIDR_HWID_BITMASK : 0; 113 u32 mpidr = is_smp() ? read_cpuid_mpidr() & MPIDR_HWID_BITMASK : 0;
84 114
@@ -150,8 +180,18 @@ void __init arm_dt_init_cpu_maps(void)
150 } 180 }
151 181
152 tmp_map[i] = hwid; 182 tmp_map[i] = hwid;
183
184 if (!found_method)
185 found_method = set_smp_ops_by_method(cpu);
153 } 186 }
154 187
188 /*
189 * Fallback to an enable-method in the cpus node if nothing found in
190 * a cpu node.
191 */
192 if (!found_method)
193 set_smp_ops_by_method(cpus);
194
155 if (!bootcpu_valid) { 195 if (!bootcpu_valid) {
156 pr_warn("DT missing boot CPU MPIDR[23:0], fall back to default cpu_logical_map\n"); 196 pr_warn("DT missing boot CPU MPIDR[23:0], fall back to default cpu_logical_map\n");
157 return; 197 return;
diff --git a/arch/arm/mach-bcm/Kconfig b/arch/arm/mach-bcm/Kconfig
index 396d05c8b570..49c914cd9c7a 100644
--- a/arch/arm/mach-bcm/Kconfig
+++ b/arch/arm/mach-bcm/Kconfig
@@ -43,6 +43,32 @@ config ARCH_BCM2835
43 This enables support for the Broadcom BCM2835 SoC. This SoC is 43 This enables support for the Broadcom BCM2835 SoC. This SoC is
44 used in the Raspberry Pi and Roku 2 devices. 44 used in the Raspberry Pi and Roku 2 devices.
45 45
46config ARCH_BCM_5301X
47 bool "Broadcom BCM470X / BCM5301X ARM SoC" if ARCH_MULTI_V7
48 depends on MMU
49 select ARM_GIC
50 select CACHE_L2X0
51 select HAVE_ARM_SCU if SMP
52 select HAVE_ARM_TWD if SMP
53 select HAVE_SMP
54 select COMMON_CLK
55 select GENERIC_CLOCKEVENTS
56 select ARM_GLOBAL_TIMER
57 select CLKSRC_ARM_GLOBAL_TIMER_SCHED_CLOCK
58 select MIGHT_HAVE_PCI
59 help
60 Support for Broadcom BCM470X and BCM5301X SoCs with ARM CPU cores.
61
62 This is a network SoC line mostly used in home routers and
63 wifi access points, it's internal name is Northstar.
64 This inclused the following SoC: BCM53010, BCM53011, BCM53012,
65 BCM53014, BCM53015, BCM53016, BCM53017, BCM53018, BCM4707,
66 BCM4708 and BCM4709.
67
68 Do not confuse this with the BCM4760 which is a totally
69 different SoC or with the older BCM47XX and BCM53XX based
70 network SoC using a MIPS CPU, they are supported by arch/mips/bcm47xx
71
46endmenu 72endmenu
47 73
48endif 74endif
diff --git a/arch/arm/mach-bcm/Makefile b/arch/arm/mach-bcm/Makefile
index 0ad293882079..a326b28c4406 100644
--- a/arch/arm/mach-bcm/Makefile
+++ b/arch/arm/mach-bcm/Makefile
@@ -1,5 +1,5 @@
1# 1#
2# Copyright (C) 2012-2013 Broadcom Corporation 2# Copyright (C) 2012-2014 Broadcom Corporation
3# 3#
4# This program is free software; you can redistribute it and/or 4# This program is free software; you can redistribute it and/or
5# modify it under the terms of the GNU General Public License as 5# modify it under the terms of the GNU General Public License as
@@ -10,8 +10,10 @@
10# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11# GNU General Public License for more details. 11# GNU General Public License for more details.
12 12
13obj-$(CONFIG_ARCH_BCM_MOBILE) := board_bcm281xx.o bcm_kona_smc.o bcm_kona_smc_asm.o kona.o 13obj-$(CONFIG_ARCH_BCM_MOBILE) := board_bcm281xx.o board_bcm21664.o \
14 bcm_kona_smc.o bcm_kona_smc_asm.o kona.o
14obj-$(CONFIG_ARCH_BCM2835) += board_bcm2835.o 15obj-$(CONFIG_ARCH_BCM2835) += board_bcm2835.o
15 16
16plus_sec := $(call as-instr,.arch_extension sec,+sec) 17plus_sec := $(call as-instr,.arch_extension sec,+sec)
17AFLAGS_bcm_kona_smc_asm.o :=-Wa,-march=armv7-a$(plus_sec) 18AFLAGS_bcm_kona_smc_asm.o :=-Wa,-march=armv7-a$(plus_sec)
19obj-$(CONFIG_ARCH_BCM_5301X) += bcm_5301x.o
diff --git a/arch/arm/mach-bcm/bcm_5301x.c b/arch/arm/mach-bcm/bcm_5301x.c
new file mode 100644
index 000000000000..edff69761e04
--- /dev/null
+++ b/arch/arm/mach-bcm/bcm_5301x.c
@@ -0,0 +1,61 @@
1/*
2 * Broadcom BCM470X / BCM5301X ARM platform code.
3 *
4 * Copyright 2013 Hauke Mehrtens <hauke@hauke-m.de>
5 *
6 * Licensed under the GNU/GPL. See COPYING for details.
7 */
8#include <linux/of_platform.h>
9#include <asm/hardware/cache-l2x0.h>
10
11#include <asm/mach/arch.h>
12#include <asm/siginfo.h>
13#include <asm/signal.h>
14
15
16static bool first_fault = true;
17
18static int bcm5301x_abort_handler(unsigned long addr, unsigned int fsr,
19 struct pt_regs *regs)
20{
21 if (fsr == 0x1c06 && first_fault) {
22 first_fault = false;
23
24 /*
25 * These faults with code 0x1c06 happens for no good reason,
26 * possibly left over from the CFE boot loader.
27 */
28 pr_warn("External imprecise Data abort at addr=%#lx, fsr=%#x ignored.\n",
29 addr, fsr);
30
31 /* Returning non-zero causes fault display and panic */
32 return 0;
33 }
34
35 /* Others should cause a fault */
36 return 1;
37}
38
39static void __init bcm5301x_init_early(void)
40{
41 /* Install our hook */
42 hook_fault_code(16 + 6, bcm5301x_abort_handler, SIGBUS, BUS_OBJERR,
43 "imprecise external abort");
44}
45
46static void __init bcm5301x_dt_init(void)
47{
48 l2x0_of_init(0, ~0UL);
49 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
50}
51
52static const char __initconst *bcm5301x_dt_compat[] = {
53 "brcm,bcm4708",
54 NULL,
55};
56
57DT_MACHINE_START(BCM5301X, "BCM5301X")
58 .init_early = bcm5301x_init_early,
59 .init_machine = bcm5301x_dt_init,
60 .dt_compat = bcm5301x_dt_compat,
61MACHINE_END
diff --git a/arch/arm/mach-bcm/board_bcm21664.c b/arch/arm/mach-bcm/board_bcm21664.c
new file mode 100644
index 000000000000..acc1573fd005
--- /dev/null
+++ b/arch/arm/mach-bcm/board_bcm21664.c
@@ -0,0 +1,78 @@
1/*
2 * Copyright (C) 2014 Broadcom Corporation
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation version 2.
7 *
8 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 * kind, whether express or implied; without even the implied warranty
10 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */
13
14#include <linux/clocksource.h>
15#include <linux/of_address.h>
16#include <linux/of_platform.h>
17
18#include <asm/mach/arch.h>
19
20#include "bcm_kona_smc.h"
21#include "kona.h"
22
23#define RSTMGR_DT_STRING "brcm,bcm21664-resetmgr"
24
25#define RSTMGR_REG_WR_ACCESS_OFFSET 0
26#define RSTMGR_REG_CHIP_SOFT_RST_OFFSET 4
27
28#define RSTMGR_WR_PASSWORD 0xa5a5
29#define RSTMGR_WR_PASSWORD_SHIFT 8
30#define RSTMGR_WR_ACCESS_ENABLE 1
31
32static void bcm21664_restart(enum reboot_mode mode, const char *cmd)
33{
34 void __iomem *base;
35 struct device_node *resetmgr;
36
37 resetmgr = of_find_compatible_node(NULL, NULL, RSTMGR_DT_STRING);
38 if (!resetmgr) {
39 pr_emerg("Couldn't find " RSTMGR_DT_STRING "\n");
40 return;
41 }
42 base = of_iomap(resetmgr, 0);
43 if (!base) {
44 pr_emerg("Couldn't map " RSTMGR_DT_STRING "\n");
45 return;
46 }
47
48 /*
49 * A soft reset is triggered by writing a 0 to bit 0 of the soft reset
50 * register. To write to that register we must first write the password
51 * and the enable bit in the write access enable register.
52 */
53 writel((RSTMGR_WR_PASSWORD << RSTMGR_WR_PASSWORD_SHIFT) |
54 RSTMGR_WR_ACCESS_ENABLE,
55 base + RSTMGR_REG_WR_ACCESS_OFFSET);
56 writel(0, base + RSTMGR_REG_CHIP_SOFT_RST_OFFSET);
57
58 /* Wait for reset */
59 while (1);
60}
61
62static void __init bcm21664_init(void)
63{
64 of_platform_populate(NULL, of_default_bus_match_table, NULL,
65 &platform_bus);
66 kona_l2_cache_init();
67}
68
69static const char * const bcm21664_dt_compat[] = {
70 "brcm,bcm21664",
71 NULL,
72};
73
74DT_MACHINE_START(BCM21664_DT, "BCM21664 Broadcom Application Processor")
75 .init_machine = bcm21664_init,
76 .restart = bcm21664_restart,
77 .dt_compat = bcm21664_dt_compat,
78MACHINE_END
diff --git a/arch/arm/mach-clps711x/board-autcpu12.c b/arch/arm/mach-clps711x/board-autcpu12.c
index 5f831133178f..d62ca16d5394 100644
--- a/arch/arm/mach-clps711x/board-autcpu12.c
+++ b/arch/arm/mach-clps711x/board-autcpu12.c
@@ -265,14 +265,12 @@ static void __init autcpu12_init_late(void)
265MACHINE_START(AUTCPU12, "autronix autcpu12") 265MACHINE_START(AUTCPU12, "autronix autcpu12")
266 /* Maintainer: Thomas Gleixner */ 266 /* Maintainer: Thomas Gleixner */
267 .atag_offset = 0x20000, 267 .atag_offset = 0x20000,
268 .nr_irqs = CLPS711X_NR_IRQS,
269 .map_io = clps711x_map_io, 268 .map_io = clps711x_map_io,
270 .init_early = clps711x_init_early, 269 .init_early = clps711x_init_early,
271 .init_irq = clps711x_init_irq, 270 .init_irq = clps711x_init_irq,
272 .init_time = clps711x_timer_init, 271 .init_time = clps711x_timer_init,
273 .init_machine = autcpu12_init, 272 .init_machine = autcpu12_init,
274 .init_late = autcpu12_init_late, 273 .init_late = autcpu12_init_late,
275 .handle_irq = clps711x_handle_irq,
276 .restart = clps711x_restart, 274 .restart = clps711x_restart,
277MACHINE_END 275MACHINE_END
278 276
diff --git a/arch/arm/mach-clps711x/board-cdb89712.c b/arch/arm/mach-clps711x/board-cdb89712.c
index a9e38c6bcfb4..e261a47f2aff 100644
--- a/arch/arm/mach-clps711x/board-cdb89712.c
+++ b/arch/arm/mach-clps711x/board-cdb89712.c
@@ -139,12 +139,10 @@ static void __init cdb89712_init(void)
139MACHINE_START(CDB89712, "Cirrus-CDB89712") 139MACHINE_START(CDB89712, "Cirrus-CDB89712")
140 /* Maintainer: Ray Lehtiniemi */ 140 /* Maintainer: Ray Lehtiniemi */
141 .atag_offset = 0x100, 141 .atag_offset = 0x100,
142 .nr_irqs = CLPS711X_NR_IRQS,
143 .map_io = clps711x_map_io, 142 .map_io = clps711x_map_io,
144 .init_early = clps711x_init_early, 143 .init_early = clps711x_init_early,
145 .init_irq = clps711x_init_irq, 144 .init_irq = clps711x_init_irq,
146 .init_time = clps711x_timer_init, 145 .init_time = clps711x_timer_init,
147 .init_machine = cdb89712_init, 146 .init_machine = cdb89712_init,
148 .handle_irq = clps711x_handle_irq,
149 .restart = clps711x_restart, 147 .restart = clps711x_restart,
150MACHINE_END 148MACHINE_END
diff --git a/arch/arm/mach-clps711x/board-clep7312.c b/arch/arm/mach-clps711x/board-clep7312.c
index b4764246d0f8..221b9de32dd6 100644
--- a/arch/arm/mach-clps711x/board-clep7312.c
+++ b/arch/arm/mach-clps711x/board-clep7312.c
@@ -36,12 +36,10 @@ fixup_clep7312(struct tag *tags, char **cmdline, struct meminfo *mi)
36MACHINE_START(CLEP7212, "Cirrus Logic 7212/7312") 36MACHINE_START(CLEP7212, "Cirrus Logic 7212/7312")
37 /* Maintainer: Nobody */ 37 /* Maintainer: Nobody */
38 .atag_offset = 0x0100, 38 .atag_offset = 0x0100,
39 .nr_irqs = CLPS711X_NR_IRQS,
40 .fixup = fixup_clep7312, 39 .fixup = fixup_clep7312,
41 .map_io = clps711x_map_io, 40 .map_io = clps711x_map_io,
42 .init_early = clps711x_init_early, 41 .init_early = clps711x_init_early,
43 .init_irq = clps711x_init_irq, 42 .init_irq = clps711x_init_irq,
44 .init_time = clps711x_timer_init, 43 .init_time = clps711x_timer_init,
45 .handle_irq = clps711x_handle_irq,
46 .restart = clps711x_restart, 44 .restart = clps711x_restart,
47MACHINE_END 45MACHINE_END
diff --git a/arch/arm/mach-clps711x/board-edb7211.c b/arch/arm/mach-clps711x/board-edb7211.c
index fe6184ead896..077609841f14 100644
--- a/arch/arm/mach-clps711x/board-edb7211.c
+++ b/arch/arm/mach-clps711x/board-edb7211.c
@@ -177,7 +177,6 @@ static void __init edb7211_init_late(void)
177MACHINE_START(EDB7211, "CL-EDB7211 (EP7211 eval board)") 177MACHINE_START(EDB7211, "CL-EDB7211 (EP7211 eval board)")
178 /* Maintainer: Jon McClintock */ 178 /* Maintainer: Jon McClintock */
179 .atag_offset = VIDEORAM_SIZE + 0x100, 179 .atag_offset = VIDEORAM_SIZE + 0x100,
180 .nr_irqs = CLPS711X_NR_IRQS,
181 .fixup = fixup_edb7211, 180 .fixup = fixup_edb7211,
182 .reserve = edb7211_reserve, 181 .reserve = edb7211_reserve,
183 .map_io = clps711x_map_io, 182 .map_io = clps711x_map_io,
@@ -186,6 +185,5 @@ MACHINE_START(EDB7211, "CL-EDB7211 (EP7211 eval board)")
186 .init_time = clps711x_timer_init, 185 .init_time = clps711x_timer_init,
187 .init_machine = edb7211_init, 186 .init_machine = edb7211_init,
188 .init_late = edb7211_init_late, 187 .init_late = edb7211_init_late,
189 .handle_irq = clps711x_handle_irq,
190 .restart = clps711x_restart, 188 .restart = clps711x_restart,
191MACHINE_END 189MACHINE_END
diff --git a/arch/arm/mach-clps711x/board-p720t.c b/arch/arm/mach-clps711x/board-p720t.c
index dd81b06f68fe..67b733744ed7 100644
--- a/arch/arm/mach-clps711x/board-p720t.c
+++ b/arch/arm/mach-clps711x/board-p720t.c
@@ -363,7 +363,6 @@ static void __init p720t_init_late(void)
363MACHINE_START(P720T, "ARM-Prospector720T") 363MACHINE_START(P720T, "ARM-Prospector720T")
364 /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */ 364 /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */
365 .atag_offset = 0x100, 365 .atag_offset = 0x100,
366 .nr_irqs = CLPS711X_NR_IRQS,
367 .fixup = fixup_p720t, 366 .fixup = fixup_p720t,
368 .map_io = clps711x_map_io, 367 .map_io = clps711x_map_io,
369 .init_early = clps711x_init_early, 368 .init_early = clps711x_init_early,
@@ -371,6 +370,5 @@ MACHINE_START(P720T, "ARM-Prospector720T")
371 .init_time = clps711x_timer_init, 370 .init_time = clps711x_timer_init,
372 .init_machine = p720t_init, 371 .init_machine = p720t_init,
373 .init_late = p720t_init_late, 372 .init_late = p720t_init_late,
374 .handle_irq = clps711x_handle_irq,
375 .restart = clps711x_restart, 373 .restart = clps711x_restart,
376MACHINE_END 374MACHINE_END
diff --git a/arch/arm/mach-clps711x/common.c b/arch/arm/mach-clps711x/common.c
index a1935911e4f1..aee81fa46ccf 100644
--- a/arch/arm/mach-clps711x/common.c
+++ b/arch/arm/mach-clps711x/common.c
@@ -31,14 +31,14 @@
31#include <linux/clk-provider.h> 31#include <linux/clk-provider.h>
32#include <linux/sched_clock.h> 32#include <linux/sched_clock.h>
33 33
34#include <asm/exception.h>
35#include <asm/mach/irq.h>
36#include <asm/mach/map.h> 34#include <asm/mach/map.h>
37#include <asm/mach/time.h> 35#include <asm/mach/time.h>
38#include <asm/system_misc.h> 36#include <asm/system_misc.h>
39 37
40#include <mach/hardware.h> 38#include <mach/hardware.h>
41 39
40#include "common.h"
41
42static struct clk *clk_pll, *clk_bus, *clk_uart, *clk_timerl, *clk_timerh, 42static struct clk *clk_pll, *clk_bus, *clk_uart, *clk_timerl, *clk_timerh,
43 *clk_tint, *clk_spi; 43 *clk_tint, *clk_spi;
44 44
@@ -59,204 +59,9 @@ void __init clps711x_map_io(void)
59 iotable_init(clps711x_io_desc, ARRAY_SIZE(clps711x_io_desc)); 59 iotable_init(clps711x_io_desc, ARRAY_SIZE(clps711x_io_desc));
60} 60}
61 61
62static void int1_mask(struct irq_data *d)
63{
64 u32 intmr1;
65
66 intmr1 = clps_readl(INTMR1);
67 intmr1 &= ~(1 << d->irq);
68 clps_writel(intmr1, INTMR1);
69}
70
71static void int1_eoi(struct irq_data *d)
72{
73 switch (d->irq) {
74 case IRQ_CSINT: clps_writel(0, COEOI); break;
75 case IRQ_TC1OI: clps_writel(0, TC1EOI); break;
76 case IRQ_TC2OI: clps_writel(0, TC2EOI); break;
77 case IRQ_RTCMI: clps_writel(0, RTCEOI); break;
78 case IRQ_TINT: clps_writel(0, TEOI); break;
79 case IRQ_UMSINT: clps_writel(0, UMSEOI); break;
80 }
81}
82
83static void int1_unmask(struct irq_data *d)
84{
85 u32 intmr1;
86
87 intmr1 = clps_readl(INTMR1);
88 intmr1 |= 1 << d->irq;
89 clps_writel(intmr1, INTMR1);
90}
91
92static struct irq_chip int1_chip = {
93 .name = "Interrupt Vector 1",
94 .irq_eoi = int1_eoi,
95 .irq_mask = int1_mask,
96 .irq_unmask = int1_unmask,
97};
98
99static void int2_mask(struct irq_data *d)
100{
101 u32 intmr2;
102
103 intmr2 = clps_readl(INTMR2);
104 intmr2 &= ~(1 << (d->irq - 16));
105 clps_writel(intmr2, INTMR2);
106}
107
108static void int2_eoi(struct irq_data *d)
109{
110 switch (d->irq) {
111 case IRQ_KBDINT: clps_writel(0, KBDEOI); break;
112 }
113}
114
115static void int2_unmask(struct irq_data *d)
116{
117 u32 intmr2;
118
119 intmr2 = clps_readl(INTMR2);
120 intmr2 |= 1 << (d->irq - 16);
121 clps_writel(intmr2, INTMR2);
122}
123
124static struct irq_chip int2_chip = {
125 .name = "Interrupt Vector 2",
126 .irq_eoi = int2_eoi,
127 .irq_mask = int2_mask,
128 .irq_unmask = int2_unmask,
129};
130
131static void int3_mask(struct irq_data *d)
132{
133 u32 intmr3;
134
135 intmr3 = clps_readl(INTMR3);
136 intmr3 &= ~(1 << (d->irq - 32));
137 clps_writel(intmr3, INTMR3);
138}
139
140static void int3_unmask(struct irq_data *d)
141{
142 u32 intmr3;
143
144 intmr3 = clps_readl(INTMR3);
145 intmr3 |= 1 << (d->irq - 32);
146 clps_writel(intmr3, INTMR3);
147}
148
149static struct irq_chip int3_chip = {
150 .name = "Interrupt Vector 3",
151 .irq_mask = int3_mask,
152 .irq_unmask = int3_unmask,
153};
154
155static struct {
156 int nr;
157 struct irq_chip *chip;
158 irq_flow_handler_t handle;
159} clps711x_irqdescs[] __initdata = {
160 { IRQ_CSINT, &int1_chip, handle_fasteoi_irq, },
161 { IRQ_EINT1, &int1_chip, handle_level_irq, },
162 { IRQ_EINT2, &int1_chip, handle_level_irq, },
163 { IRQ_EINT3, &int1_chip, handle_level_irq, },
164 { IRQ_TC1OI, &int1_chip, handle_fasteoi_irq, },
165 { IRQ_TC2OI, &int1_chip, handle_fasteoi_irq, },
166 { IRQ_RTCMI, &int1_chip, handle_fasteoi_irq, },
167 { IRQ_TINT, &int1_chip, handle_fasteoi_irq, },
168 { IRQ_UTXINT1, &int1_chip, handle_level_irq, },
169 { IRQ_URXINT1, &int1_chip, handle_level_irq, },
170 { IRQ_UMSINT, &int1_chip, handle_fasteoi_irq, },
171 { IRQ_SSEOTI, &int1_chip, handle_level_irq, },
172 { IRQ_KBDINT, &int2_chip, handle_fasteoi_irq, },
173 { IRQ_SS2RX, &int2_chip, handle_level_irq, },
174 { IRQ_SS2TX, &int2_chip, handle_level_irq, },
175 { IRQ_UTXINT2, &int2_chip, handle_level_irq, },
176 { IRQ_URXINT2, &int2_chip, handle_level_irq, },
177};
178
179void __init clps711x_init_irq(void) 62void __init clps711x_init_irq(void)
180{ 63{
181 unsigned int i; 64 clps711x_intc_init(CLPS711X_PHYS_BASE, SZ_16K);
182
183 /* Disable interrupts */
184 clps_writel(0, INTMR1);
185 clps_writel(0, INTMR2);
186 clps_writel(0, INTMR3);
187
188 /* Clear down any pending interrupts */
189 clps_writel(0, BLEOI);
190 clps_writel(0, MCEOI);
191 clps_writel(0, COEOI);
192 clps_writel(0, TC1EOI);
193 clps_writel(0, TC2EOI);
194 clps_writel(0, RTCEOI);
195 clps_writel(0, TEOI);
196 clps_writel(0, UMSEOI);
197 clps_writel(0, KBDEOI);
198 clps_writel(0, SRXEOF);
199 clps_writel(0xffffffff, DAISR);
200
201 for (i = 0; i < ARRAY_SIZE(clps711x_irqdescs); i++) {
202 irq_set_chip_and_handler(clps711x_irqdescs[i].nr,
203 clps711x_irqdescs[i].chip,
204 clps711x_irqdescs[i].handle);
205 set_irq_flags(clps711x_irqdescs[i].nr,
206 IRQF_VALID | IRQF_PROBE);
207 }
208
209 if (IS_ENABLED(CONFIG_FIQ)) {
210 init_FIQ(0);
211 irq_set_chip_and_handler(IRQ_DAIINT, &int3_chip,
212 handle_bad_irq);
213 set_irq_flags(IRQ_DAIINT,
214 IRQF_VALID | IRQF_PROBE | IRQF_NOAUTOEN);
215 }
216}
217
218static inline u32 fls16(u32 x)
219{
220 u32 r = 15;
221
222 if (!(x & 0xff00)) {
223 x <<= 8;
224 r -= 8;
225 }
226 if (!(x & 0xf000)) {
227 x <<= 4;
228 r -= 4;
229 }
230 if (!(x & 0xc000)) {
231 x <<= 2;
232 r -= 2;
233 }
234 if (!(x & 0x8000))
235 r--;
236
237 return r;
238}
239
240asmlinkage void __exception_irq_entry clps711x_handle_irq(struct pt_regs *regs)
241{
242 do {
243 u32 irqstat;
244 void __iomem *base = CLPS711X_VIRT_BASE;
245
246 irqstat = readw_relaxed(base + INTSR1) &
247 readw_relaxed(base + INTMR1);
248 if (irqstat)
249 handle_IRQ(fls16(irqstat), regs);
250
251 irqstat = readw_relaxed(base + INTSR2) &
252 readw_relaxed(base + INTMR2);
253 if (irqstat) {
254 handle_IRQ(fls16(irqstat) + 16, regs);
255 continue;
256 }
257
258 break;
259 } while (1);
260} 65}
261 66
262static u64 notrace clps711x_sched_clock_read(void) 67static u64 notrace clps711x_sched_clock_read(void)
diff --git a/arch/arm/mach-clps711x/common.h b/arch/arm/mach-clps711x/common.h
index 9a6767bfdc47..7489139d5d63 100644
--- a/arch/arm/mach-clps711x/common.h
+++ b/arch/arm/mach-clps711x/common.h
@@ -6,13 +6,14 @@
6 6
7#include <linux/reboot.h> 7#include <linux/reboot.h>
8 8
9#define CLPS711X_NR_IRQS (33)
10#define CLPS711X_NR_GPIO (4 * 8 + 3) 9#define CLPS711X_NR_GPIO (4 * 8 + 3)
11#define CLPS711X_GPIO(prt, bit) ((prt) * 8 + (bit)) 10#define CLPS711X_GPIO(prt, bit) ((prt) * 8 + (bit))
12 11
13extern void clps711x_map_io(void); 12extern void clps711x_map_io(void);
14extern void clps711x_init_irq(void); 13extern void clps711x_init_irq(void);
15extern void clps711x_timer_init(void); 14extern void clps711x_timer_init(void);
16extern void clps711x_handle_irq(struct pt_regs *regs);
17extern void clps711x_restart(enum reboot_mode mode, const char *cmd); 15extern void clps711x_restart(enum reboot_mode mode, const char *cmd);
18extern void clps711x_init_early(void); 16extern void clps711x_init_early(void);
17
18/* drivers/irqchip/irq-clps711x.c */
19void clps711x_intc_init(phys_addr_t, resource_size_t);
diff --git a/arch/arm/mach-clps711x/include/mach/clps711x.h b/arch/arm/mach-clps711x/include/mach/clps711x.h
index 0286f4bf9945..eb052a11aa9d 100644
--- a/arch/arm/mach-clps711x/include/mach/clps711x.h
+++ b/arch/arm/mach-clps711x/include/mach/clps711x.h
@@ -40,8 +40,6 @@
40#define MEMCFG1 (0x0180) 40#define MEMCFG1 (0x0180)
41#define MEMCFG2 (0x01c0) 41#define MEMCFG2 (0x01c0)
42#define DRFPR (0x0200) 42#define DRFPR (0x0200)
43#define INTSR1 (0x0240)
44#define INTMR1 (0x0280)
45#define LCDCON (0x02c0) 43#define LCDCON (0x02c0)
46#define TC1D (0x0300) 44#define TC1D (0x0300)
47#define TC2D (0x0340) 45#define TC2D (0x0340)
@@ -55,28 +53,16 @@
55#define PALLSW (0x0540) 53#define PALLSW (0x0540)
56#define PALMSW (0x0580) 54#define PALMSW (0x0580)
57#define STFCLR (0x05c0) 55#define STFCLR (0x05c0)
58#define BLEOI (0x0600)
59#define MCEOI (0x0640)
60#define TEOI (0x0680)
61#define TC1EOI (0x06c0)
62#define TC2EOI (0x0700)
63#define RTCEOI (0x0740)
64#define UMSEOI (0x0780)
65#define COEOI (0x07c0)
66#define HALT (0x0800) 56#define HALT (0x0800)
67#define STDBY (0x0840) 57#define STDBY (0x0840)
68 58
69#define FBADDR (0x1000) 59#define FBADDR (0x1000)
70#define SYSCON2 (0x1100) 60#define SYSCON2 (0x1100)
71#define SYSFLG2 (0x1140) 61#define SYSFLG2 (0x1140)
72#define INTSR2 (0x1240)
73#define INTMR2 (0x1280)
74#define UARTDR2 (0x1480) 62#define UARTDR2 (0x1480)
75#define UBRLCR2 (0x14c0) 63#define UBRLCR2 (0x14c0)
76#define SS2DR (0x1500) 64#define SS2DR (0x1500)
77#define SRXEOF (0x1600)
78#define SS2POP (0x16c0) 65#define SS2POP (0x16c0)
79#define KBDEOI (0x1700)
80 66
81#define DAIR (0x2000) 67#define DAIR (0x2000)
82#define DAIDR0 (0x2040) 68#define DAIDR0 (0x2040)
@@ -84,8 +70,6 @@
84#define DAIDR2 (0x20c0) 70#define DAIDR2 (0x20c0)
85#define DAISR (0x2100) 71#define DAISR (0x2100)
86#define SYSCON3 (0x2200) 72#define SYSCON3 (0x2200)
87#define INTSR3 (0x2240)
88#define INTMR3 (0x2280)
89#define LEDFLSH (0x22c0) 73#define LEDFLSH (0x22c0)
90#define SDCONF (0x2300) 74#define SDCONF (0x2300)
91#define SDRFPR (0x2340) 75#define SDRFPR (0x2340)
diff --git a/arch/arm/mach-davinci/Kconfig b/arch/arm/mach-davinci/Kconfig
index 626d2b82d0f3..db18ef866593 100644
--- a/arch/arm/mach-davinci/Kconfig
+++ b/arch/arm/mach-davinci/Kconfig
@@ -51,11 +51,6 @@ config ARCH_DAVINCI_DM365
51 select AINTC 51 select AINTC
52 select ARCH_DAVINCI_DMx 52 select ARCH_DAVINCI_DMx
53 53
54config ARCH_DAVINCI_TNETV107X
55 bool "TNETV107X based system"
56 select CPU_V6
57 select CP_INTC
58
59comment "DaVinci Board Type" 54comment "DaVinci Board Type"
60 55
61config MACH_DA8XX_DT 56config MACH_DA8XX_DT
@@ -215,13 +210,6 @@ config DA850_WL12XX
215 AM18x EVM. 210 AM18x EVM.
216 211
217 212
218config MACH_TNETV107X
219 bool "TI TNETV107X Reference Platform"
220 default ARCH_DAVINCI_TNETV107X
221 depends on ARCH_DAVINCI_TNETV107X
222 help
223 Say Y here to select the TI TNETV107X Evaluation Module.
224
225config MACH_MITYOMAPL138 213config MACH_MITYOMAPL138
226 bool "Critical Link MityDSP-L138/MityARM-1808 SoM" 214 bool "Critical Link MityDSP-L138/MityARM-1808 SoM"
227 depends on ARCH_DAVINCI_DA850 215 depends on ARCH_DAVINCI_DA850
diff --git a/arch/arm/mach-davinci/Makefile b/arch/arm/mach-davinci/Makefile
index 63997a1128e6..2204239ed243 100644
--- a/arch/arm/mach-davinci/Makefile
+++ b/arch/arm/mach-davinci/Makefile
@@ -16,7 +16,6 @@ obj-$(CONFIG_ARCH_DAVINCI_DM646x) += dm646x.o devices.o
16obj-$(CONFIG_ARCH_DAVINCI_DM365) += dm365.o devices.o 16obj-$(CONFIG_ARCH_DAVINCI_DM365) += dm365.o devices.o
17obj-$(CONFIG_ARCH_DAVINCI_DA830) += da830.o devices-da8xx.o 17obj-$(CONFIG_ARCH_DAVINCI_DA830) += da830.o devices-da8xx.o
18obj-$(CONFIG_ARCH_DAVINCI_DA850) += da850.o devices-da8xx.o 18obj-$(CONFIG_ARCH_DAVINCI_DA850) += da850.o devices-da8xx.o
19obj-$(CONFIG_ARCH_DAVINCI_TNETV107X) += tnetv107x.o devices-tnetv107x.o
20 19
21obj-$(CONFIG_AINTC) += irq.o 20obj-$(CONFIG_AINTC) += irq.o
22obj-$(CONFIG_CP_INTC) += cp_intc.o 21obj-$(CONFIG_CP_INTC) += cp_intc.o
@@ -32,7 +31,6 @@ obj-$(CONFIG_MACH_DAVINCI_DM6467_EVM) += board-dm646x-evm.o cdce949.o
32obj-$(CONFIG_MACH_DAVINCI_DM365_EVM) += board-dm365-evm.o 31obj-$(CONFIG_MACH_DAVINCI_DM365_EVM) += board-dm365-evm.o
33obj-$(CONFIG_MACH_DAVINCI_DA830_EVM) += board-da830-evm.o 32obj-$(CONFIG_MACH_DAVINCI_DA830_EVM) += board-da830-evm.o
34obj-$(CONFIG_MACH_DAVINCI_DA850_EVM) += board-da850-evm.o 33obj-$(CONFIG_MACH_DAVINCI_DA850_EVM) += board-da850-evm.o
35obj-$(CONFIG_MACH_TNETV107X) += board-tnetv107x-evm.o
36obj-$(CONFIG_MACH_MITYOMAPL138) += board-mityomapl138.o 34obj-$(CONFIG_MACH_MITYOMAPL138) += board-mityomapl138.o
37obj-$(CONFIG_MACH_OMAPL138_HAWKBOARD) += board-omapl138-hawk.o 35obj-$(CONFIG_MACH_OMAPL138_HAWKBOARD) += board-omapl138-hawk.o
38 36
diff --git a/arch/arm/mach-davinci/Makefile.boot b/arch/arm/mach-davinci/Makefile.boot
index 04a6c4e67b14..4b81601754a2 100644
--- a/arch/arm/mach-davinci/Makefile.boot
+++ b/arch/arm/mach-davinci/Makefile.boot
@@ -1,13 +1,7 @@
1ifeq ($(CONFIG_ARCH_DAVINCI_DA8XX),y) 1zreladdr-$(CONFIG_ARCH_DAVINCI_DA8XX) += 0xc0008000
2ifeq ($(CONFIG_ARCH_DAVINCI_DMx),y) 2params_phys-$(CONFIG_ARCH_DAVINCI_DA8XX) := 0xc0000100
3$(error Cannot enable DaVinci and DA8XX platforms concurrently) 3initrd_phys-$(CONFIG_ARCH_DAVINCI_DA8XX) := 0xc0800000
4else 4
5 zreladdr-y += 0xc0008000 5zreladdr-$(CONFIG_ARCH_DAVINCI_DMx) += 0x80008000
6params_phys-y := 0xc0000100 6params_phys-$(CONFIG_ARCH_DAVINCI_DMx) := 0x80000100
7initrd_phys-y := 0xc0800000 7initrd_phys-$(CONFIG_ARCH_DAVINCI_DMx) := 0x80800000
8endif
9else
10 zreladdr-y += 0x80008000
11params_phys-y := 0x80000100
12initrd_phys-y := 0x80800000
13endif
diff --git a/arch/arm/mach-davinci/board-tnetv107x-evm.c b/arch/arm/mach-davinci/board-tnetv107x-evm.c
deleted file mode 100644
index 78ea395d2aca..000000000000
--- a/arch/arm/mach-davinci/board-tnetv107x-evm.c
+++ /dev/null
@@ -1,287 +0,0 @@
1/*
2 * Texas Instruments TNETV107X EVM Board Support
3 *
4 * Copyright (C) 2010 Texas Instruments
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation version 2.
9 *
10 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
11 * kind, whether express or implied; without even the implied warranty
12 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15#include <linux/kernel.h>
16#include <linux/init.h>
17#include <linux/console.h>
18#include <linux/dma-mapping.h>
19#include <linux/interrupt.h>
20#include <linux/gpio.h>
21#include <linux/delay.h>
22#include <linux/platform_device.h>
23#include <linux/ratelimit.h>
24#include <linux/mtd/mtd.h>
25#include <linux/mtd/partitions.h>
26#include <linux/input.h>
27#include <linux/input/matrix_keypad.h>
28#include <linux/spi/spi.h>
29#include <linux/platform_data/edma.h>
30
31#include <asm/mach/arch.h>
32#include <asm/mach-types.h>
33
34#include <mach/irqs.h>
35#include <mach/mux.h>
36#include <mach/cp_intc.h>
37#include <mach/tnetv107x.h>
38
39#define EVM_MMC_WP_GPIO 21
40#define EVM_MMC_CD_GPIO 24
41#define EVM_SPI_CS_GPIO 54
42
43static int initialize_gpio(int gpio, char *desc)
44{
45 int ret;
46
47 ret = gpio_request(gpio, desc);
48 if (ret < 0) {
49 pr_err_ratelimited("cannot open %s gpio\n", desc);
50 return -ENOSYS;
51 }
52 gpio_direction_input(gpio);
53 return gpio;
54}
55
56static int mmc_get_cd(int index)
57{
58 static int gpio;
59
60 if (!gpio)
61 gpio = initialize_gpio(EVM_MMC_CD_GPIO, "mmc card detect");
62
63 if (gpio < 0)
64 return gpio;
65
66 return gpio_get_value(gpio) ? 0 : 1;
67}
68
69static int mmc_get_ro(int index)
70{
71 static int gpio;
72
73 if (!gpio)
74 gpio = initialize_gpio(EVM_MMC_WP_GPIO, "mmc write protect");
75
76 if (gpio < 0)
77 return gpio;
78
79 return gpio_get_value(gpio) ? 1 : 0;
80}
81
82static struct davinci_mmc_config mmc_config = {
83 .get_cd = mmc_get_cd,
84 .get_ro = mmc_get_ro,
85 .wires = 4,
86 .max_freq = 50000000,
87 .caps = MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
88};
89
90static const short sdio1_pins[] __initconst = {
91 TNETV107X_SDIO1_CLK_1, TNETV107X_SDIO1_CMD_1,
92 TNETV107X_SDIO1_DATA0_1, TNETV107X_SDIO1_DATA1_1,
93 TNETV107X_SDIO1_DATA2_1, TNETV107X_SDIO1_DATA3_1,
94 TNETV107X_GPIO21, TNETV107X_GPIO24,
95 -1
96};
97
98static const short uart1_pins[] __initconst = {
99 TNETV107X_UART1_RD, TNETV107X_UART1_TD,
100 -1
101};
102
103static const short ssp_pins[] __initconst = {
104 TNETV107X_SSP0_0, TNETV107X_SSP0_1, TNETV107X_SSP0_2,
105 TNETV107X_SSP1_0, TNETV107X_SSP1_1, TNETV107X_SSP1_2,
106 TNETV107X_SSP1_3, -1
107};
108
109static struct mtd_partition nand_partitions[] = {
110 /* bootloader (U-Boot, etc) in first 12 sectors */
111 {
112 .name = "bootloader",
113 .offset = 0,
114 .size = (12*SZ_128K),
115 .mask_flags = MTD_WRITEABLE, /* force read-only */
116 },
117 /* bootloader params in the next sector */
118 {
119 .name = "params",
120 .offset = MTDPART_OFS_NXTBLK,
121 .size = SZ_128K,
122 .mask_flags = MTD_WRITEABLE, /* force read-only */
123 },
124 /* kernel */
125 {
126 .name = "kernel",
127 .offset = MTDPART_OFS_NXTBLK,
128 .size = SZ_4M,
129 .mask_flags = 0,
130 },
131 /* file system */
132 {
133 .name = "filesystem",
134 .offset = MTDPART_OFS_NXTBLK,
135 .size = MTDPART_SIZ_FULL,
136 .mask_flags = 0,
137 }
138};
139
140static struct davinci_nand_pdata nand_config = {
141 .mask_cle = 0x4000,
142 .mask_ale = 0x2000,
143 .parts = nand_partitions,
144 .nr_parts = ARRAY_SIZE(nand_partitions),
145 .ecc_mode = NAND_ECC_HW,
146 .bbt_options = NAND_BBT_USE_FLASH,
147 .ecc_bits = 1,
148};
149
150static struct davinci_uart_config serial_config __initconst = {
151 .enabled_uarts = BIT(1),
152};
153
154static const uint32_t keymap[] = {
155 KEY(0, 0, KEY_NUMERIC_1),
156 KEY(0, 1, KEY_NUMERIC_2),
157 KEY(0, 2, KEY_NUMERIC_3),
158 KEY(0, 3, KEY_FN_F1),
159 KEY(0, 4, KEY_MENU),
160
161 KEY(1, 0, KEY_NUMERIC_4),
162 KEY(1, 1, KEY_NUMERIC_5),
163 KEY(1, 2, KEY_NUMERIC_6),
164 KEY(1, 3, KEY_UP),
165 KEY(1, 4, KEY_FN_F2),
166
167 KEY(2, 0, KEY_NUMERIC_7),
168 KEY(2, 1, KEY_NUMERIC_8),
169 KEY(2, 2, KEY_NUMERIC_9),
170 KEY(2, 3, KEY_LEFT),
171 KEY(2, 4, KEY_ENTER),
172
173 KEY(3, 0, KEY_NUMERIC_STAR),
174 KEY(3, 1, KEY_NUMERIC_0),
175 KEY(3, 2, KEY_NUMERIC_POUND),
176 KEY(3, 3, KEY_DOWN),
177 KEY(3, 4, KEY_RIGHT),
178
179 KEY(4, 0, KEY_FN_F3),
180 KEY(4, 1, KEY_FN_F4),
181 KEY(4, 2, KEY_MUTE),
182 KEY(4, 3, KEY_HOME),
183 KEY(4, 4, KEY_BACK),
184
185 KEY(5, 0, KEY_VOLUMEDOWN),
186 KEY(5, 1, KEY_VOLUMEUP),
187 KEY(5, 2, KEY_F1),
188 KEY(5, 3, KEY_F2),
189 KEY(5, 4, KEY_F3),
190};
191
192static const struct matrix_keymap_data keymap_data = {
193 .keymap = keymap,
194 .keymap_size = ARRAY_SIZE(keymap),
195};
196
197static struct matrix_keypad_platform_data keypad_config = {
198 .keymap_data = &keymap_data,
199 .num_row_gpios = 6,
200 .num_col_gpios = 5,
201 .debounce_ms = 0, /* minimum */
202 .active_low = 0, /* pull up realization */
203 .no_autorepeat = 0,
204};
205
206static void spi_select_device(int cs)
207{
208 static int gpio;
209
210 if (!gpio) {
211 int ret;
212 ret = gpio_request(EVM_SPI_CS_GPIO, "spi chipsel");
213 if (ret < 0) {
214 pr_err("cannot open spi chipsel gpio\n");
215 gpio = -ENOSYS;
216 return;
217 } else {
218 gpio = EVM_SPI_CS_GPIO;
219 gpio_direction_output(gpio, 0);
220 }
221 }
222
223 if (gpio < 0)
224 return;
225
226 return gpio_set_value(gpio, cs ? 1 : 0);
227}
228
229static struct ti_ssp_spi_data spi_master_data = {
230 .num_cs = 2,
231 .select = spi_select_device,
232 .iosel = SSP_PIN_SEL(0, SSP_CLOCK) | SSP_PIN_SEL(1, SSP_DATA) |
233 SSP_PIN_SEL(2, SSP_CHIPSEL) | SSP_PIN_SEL(3, SSP_IN) |
234 SSP_INPUT_SEL(3),
235};
236
237static struct ti_ssp_data ssp_config = {
238 .out_clock = 250 * 1000,
239 .dev_data = {
240 [1] = {
241 .dev_name = "ti-ssp-spi",
242 .pdata = &spi_master_data,
243 .pdata_size = sizeof(spi_master_data),
244 },
245 },
246};
247
248static struct tnetv107x_device_info evm_device_info __initconst = {
249 .serial_config = &serial_config,
250 .mmc_config[1] = &mmc_config, /* controller 1 */
251 .nand_config[0] = &nand_config, /* chip select 0 */
252 .keypad_config = &keypad_config,
253 .ssp_config = &ssp_config,
254};
255
256static struct spi_board_info spi_info[] __initconst = {
257};
258
259static __init void tnetv107x_evm_board_init(void)
260{
261 davinci_cfg_reg_list(sdio1_pins);
262 davinci_cfg_reg_list(uart1_pins);
263 davinci_cfg_reg_list(ssp_pins);
264
265 tnetv107x_devices_init(&evm_device_info);
266
267 spi_register_board_info(spi_info, ARRAY_SIZE(spi_info));
268}
269
270#ifdef CONFIG_SERIAL_8250_CONSOLE
271static int __init tnetv107x_evm_console_init(void)
272{
273 return add_preferred_console("ttyS", 0, "115200");
274}
275console_initcall(tnetv107x_evm_console_init);
276#endif
277
278MACHINE_START(TNETV107X, "TNETV107X EVM")
279 .atag_offset = 0x100,
280 .map_io = tnetv107x_init,
281 .init_irq = cp_intc_init,
282 .init_time = davinci_timer_init,
283 .init_machine = tnetv107x_evm_board_init,
284 .init_late = davinci_init_late,
285 .dma_zone_size = SZ_128M,
286 .restart = tnetv107x_restart,
287MACHINE_END
diff --git a/arch/arm/mach-davinci/davinci.h b/arch/arm/mach-davinci/davinci.h
index 2eebc4338802..4ffc37accce0 100644
--- a/arch/arm/mach-davinci/davinci.h
+++ b/arch/arm/mach-davinci/davinci.h
@@ -79,6 +79,8 @@ int davinci_gpio_register(struct resource *res, int size, void *pdata);
79#define DM646X_ASYNC_EMIF_CONTROL_BASE 0x20008000 79#define DM646X_ASYNC_EMIF_CONTROL_BASE 0x20008000
80#define DM646X_ASYNC_EMIF_CS2_SPACE_BASE 0x42000000 80#define DM646X_ASYNC_EMIF_CS2_SPACE_BASE 0x42000000
81 81
82int davinci_init_wdt(void);
83
82/* DM355 function declarations */ 84/* DM355 function declarations */
83void dm355_init(void); 85void dm355_init(void);
84void dm355_init_spi0(unsigned chipselect_mask, 86void dm355_init_spi0(unsigned chipselect_mask,
diff --git a/arch/arm/mach-davinci/devices-tnetv107x.c b/arch/arm/mach-davinci/devices-tnetv107x.c
deleted file mode 100644
index 01d8686e553c..000000000000
--- a/arch/arm/mach-davinci/devices-tnetv107x.c
+++ /dev/null
@@ -1,434 +0,0 @@
1/*
2 * Texas Instruments TNETV107X SoC devices
3 *
4 * Copyright (C) 2010 Texas Instruments
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation version 2.
9 *
10 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
11 * kind, whether express or implied; without even the implied warranty
12 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15#include <linux/kernel.h>
16#include <linux/init.h>
17#include <linux/platform_device.h>
18#include <linux/dma-mapping.h>
19#include <linux/clk.h>
20#include <linux/slab.h>
21#include <linux/platform_data/edma.h>
22
23#include <mach/common.h>
24#include <mach/irqs.h>
25#include <mach/tnetv107x.h>
26
27#include "clock.h"
28
29/* Base addresses for on-chip devices */
30#define TNETV107X_TPCC_BASE 0x01c00000
31#define TNETV107X_TPTC0_BASE 0x01c10000
32#define TNETV107X_TPTC1_BASE 0x01c10400
33#define TNETV107X_WDOG_BASE 0x08086700
34#define TNETV107X_TSC_BASE 0x08088500
35#define TNETV107X_SDIO0_BASE 0x08088700
36#define TNETV107X_SDIO1_BASE 0x08088800
37#define TNETV107X_KEYPAD_BASE 0x08088a00
38#define TNETV107X_SSP_BASE 0x08088c00
39#define TNETV107X_ASYNC_EMIF_CNTRL_BASE 0x08200000
40#define TNETV107X_ASYNC_EMIF_DATA_CE0_BASE 0x30000000
41#define TNETV107X_ASYNC_EMIF_DATA_CE1_BASE 0x40000000
42#define TNETV107X_ASYNC_EMIF_DATA_CE2_BASE 0x44000000
43#define TNETV107X_ASYNC_EMIF_DATA_CE3_BASE 0x48000000
44
45/* TNETV107X specific EDMA3 information */
46#define EDMA_TNETV107X_NUM_DMACH 64
47#define EDMA_TNETV107X_NUM_TCC 64
48#define EDMA_TNETV107X_NUM_PARAMENTRY 128
49#define EDMA_TNETV107X_NUM_EVQUE 2
50#define EDMA_TNETV107X_NUM_TC 2
51#define EDMA_TNETV107X_CHMAP_EXIST 0
52#define EDMA_TNETV107X_NUM_REGIONS 4
53#define TNETV107X_DMACH2EVENT_MAP0 0x3C0CE000u
54#define TNETV107X_DMACH2EVENT_MAP1 0x000FFFFFu
55
56#define TNETV107X_DMACH_SDIO0_RX 26
57#define TNETV107X_DMACH_SDIO0_TX 27
58#define TNETV107X_DMACH_SDIO1_RX 28
59#define TNETV107X_DMACH_SDIO1_TX 29
60
61static s8 edma_tc_mapping[][2] = {
62 /* event queue no TC no */
63 { 0, 0 },
64 { 1, 1 },
65 { -1, -1 }
66};
67
68static s8 edma_priority_mapping[][2] = {
69 /* event queue no Prio */
70 { 0, 3 },
71 { 1, 7 },
72 { -1, -1 }
73};
74
75static struct edma_soc_info edma_cc0_info = {
76 .n_channel = EDMA_TNETV107X_NUM_DMACH,
77 .n_region = EDMA_TNETV107X_NUM_REGIONS,
78 .n_slot = EDMA_TNETV107X_NUM_PARAMENTRY,
79 .n_tc = EDMA_TNETV107X_NUM_TC,
80 .n_cc = 1,
81 .queue_tc_mapping = edma_tc_mapping,
82 .queue_priority_mapping = edma_priority_mapping,
83 .default_queue = EVENTQ_1,
84};
85
86static struct edma_soc_info *tnetv107x_edma_info[EDMA_MAX_CC] = {
87 &edma_cc0_info,
88};
89
90static struct resource edma_resources[] = {
91 {
92 .name = "edma_cc0",
93 .start = TNETV107X_TPCC_BASE,
94 .end = TNETV107X_TPCC_BASE + SZ_32K - 1,
95 .flags = IORESOURCE_MEM,
96 },
97 {
98 .name = "edma_tc0",
99 .start = TNETV107X_TPTC0_BASE,
100 .end = TNETV107X_TPTC0_BASE + SZ_1K - 1,
101 .flags = IORESOURCE_MEM,
102 },
103 {
104 .name = "edma_tc1",
105 .start = TNETV107X_TPTC1_BASE,
106 .end = TNETV107X_TPTC1_BASE + SZ_1K - 1,
107 .flags = IORESOURCE_MEM,
108 },
109 {
110 .name = "edma0",
111 .start = IRQ_TNETV107X_TPCC,
112 .flags = IORESOURCE_IRQ,
113 },
114 {
115 .name = "edma0_err",
116 .start = IRQ_TNETV107X_TPCC_ERR,
117 .flags = IORESOURCE_IRQ,
118 },
119};
120
121static struct platform_device edma_device = {
122 .name = "edma",
123 .id = -1,
124 .num_resources = ARRAY_SIZE(edma_resources),
125 .resource = edma_resources,
126 .dev.platform_data = tnetv107x_edma_info,
127};
128
129static struct plat_serial8250_port serial0_platform_data[] = {
130 {
131 .mapbase = TNETV107X_UART0_BASE,
132 .irq = IRQ_TNETV107X_UART0,
133 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST |
134 UPF_FIXED_TYPE | UPF_IOREMAP,
135 .type = PORT_AR7,
136 .iotype = UPIO_MEM32,
137 .regshift = 2,
138 },
139 {
140 .flags = 0,
141 }
142};
143static struct plat_serial8250_port serial1_platform_data[] = {
144 {
145 .mapbase = TNETV107X_UART1_BASE,
146 .irq = IRQ_TNETV107X_UART1,
147 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST |
148 UPF_FIXED_TYPE | UPF_IOREMAP,
149 .type = PORT_AR7,
150 .iotype = UPIO_MEM32,
151 .regshift = 2,
152 },
153 {
154 .flags = 0,
155 }
156};
157static struct plat_serial8250_port serial2_platform_data[] = {
158 {
159 .mapbase = TNETV107X_UART2_BASE,
160 .irq = IRQ_TNETV107X_UART2,
161 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST |
162 UPF_FIXED_TYPE | UPF_IOREMAP,
163 .type = PORT_AR7,
164 .iotype = UPIO_MEM32,
165 .regshift = 2,
166 },
167 {
168 .flags = 0,
169 }
170};
171
172
173struct platform_device tnetv107x_serial_device[] = {
174 {
175 .name = "serial8250",
176 .id = PLAT8250_DEV_PLATFORM,
177 .dev.platform_data = serial0_platform_data,
178 },
179 {
180 .name = "serial8250",
181 .id = PLAT8250_DEV_PLATFORM1,
182 .dev.platform_data = serial1_platform_data,
183 },
184 {
185 .name = "serial8250",
186 .id = PLAT8250_DEV_PLATFORM2,
187 .dev.platform_data = serial2_platform_data,
188 },
189 {
190 }
191};
192
193static struct resource mmc0_resources[] = {
194 { /* Memory mapped registers */
195 .start = TNETV107X_SDIO0_BASE,
196 .end = TNETV107X_SDIO0_BASE + 0x0ff,
197 .flags = IORESOURCE_MEM
198 },
199 { /* MMC interrupt */
200 .start = IRQ_TNETV107X_MMC0,
201 .flags = IORESOURCE_IRQ
202 },
203 { /* SDIO interrupt */
204 .start = IRQ_TNETV107X_SDIO0,
205 .flags = IORESOURCE_IRQ
206 },
207 { /* DMA RX */
208 .start = EDMA_CTLR_CHAN(0, TNETV107X_DMACH_SDIO0_RX),
209 .flags = IORESOURCE_DMA
210 },
211 { /* DMA TX */
212 .start = EDMA_CTLR_CHAN(0, TNETV107X_DMACH_SDIO0_TX),
213 .flags = IORESOURCE_DMA
214 },
215};
216
217static struct resource mmc1_resources[] = {
218 { /* Memory mapped registers */
219 .start = TNETV107X_SDIO1_BASE,
220 .end = TNETV107X_SDIO1_BASE + 0x0ff,
221 .flags = IORESOURCE_MEM
222 },
223 { /* MMC interrupt */
224 .start = IRQ_TNETV107X_MMC1,
225 .flags = IORESOURCE_IRQ
226 },
227 { /* SDIO interrupt */
228 .start = IRQ_TNETV107X_SDIO1,
229 .flags = IORESOURCE_IRQ
230 },
231 { /* DMA RX */
232 .start = EDMA_CTLR_CHAN(0, TNETV107X_DMACH_SDIO1_RX),
233 .flags = IORESOURCE_DMA
234 },
235 { /* DMA TX */
236 .start = EDMA_CTLR_CHAN(0, TNETV107X_DMACH_SDIO1_TX),
237 .flags = IORESOURCE_DMA
238 },
239};
240
241static u64 mmc0_dma_mask = DMA_BIT_MASK(32);
242static u64 mmc1_dma_mask = DMA_BIT_MASK(32);
243
244static struct platform_device mmc_devices[2] = {
245 {
246 .name = "dm6441-mmc",
247 .id = 0,
248 .dev = {
249 .dma_mask = &mmc0_dma_mask,
250 .coherent_dma_mask = DMA_BIT_MASK(32),
251 },
252 .num_resources = ARRAY_SIZE(mmc0_resources),
253 .resource = mmc0_resources
254 },
255 {
256 .name = "dm6441-mmc",
257 .id = 1,
258 .dev = {
259 .dma_mask = &mmc1_dma_mask,
260 .coherent_dma_mask = DMA_BIT_MASK(32),
261 },
262 .num_resources = ARRAY_SIZE(mmc1_resources),
263 .resource = mmc1_resources
264 },
265};
266
267static const u32 emif_windows[] = {
268 TNETV107X_ASYNC_EMIF_DATA_CE0_BASE, TNETV107X_ASYNC_EMIF_DATA_CE1_BASE,
269 TNETV107X_ASYNC_EMIF_DATA_CE2_BASE, TNETV107X_ASYNC_EMIF_DATA_CE3_BASE,
270};
271
272static const u32 emif_window_sizes[] = { SZ_256M, SZ_64M, SZ_64M, SZ_64M };
273
274static struct resource wdt_resources[] = {
275 {
276 .start = TNETV107X_WDOG_BASE,
277 .end = TNETV107X_WDOG_BASE + SZ_4K - 1,
278 .flags = IORESOURCE_MEM,
279 },
280};
281
282struct platform_device tnetv107x_wdt_device = {
283 .name = "tnetv107x_wdt",
284 .id = 0,
285 .num_resources = ARRAY_SIZE(wdt_resources),
286 .resource = wdt_resources,
287};
288
289static int __init nand_init(int chipsel, struct davinci_nand_pdata *data)
290{
291 struct resource res[2];
292 struct platform_device *pdev;
293 u32 range;
294 int ret;
295
296 /* Figure out the resource range from the ale/cle masks */
297 range = max(data->mask_cle, data->mask_ale);
298 range = PAGE_ALIGN(range + 4) - 1;
299
300 if (range >= emif_window_sizes[chipsel])
301 return -EINVAL;
302
303 pdev = kzalloc(sizeof(*pdev), GFP_KERNEL);
304 if (!pdev)
305 return -ENOMEM;
306
307 pdev->name = "davinci_nand";
308 pdev->id = chipsel;
309 pdev->dev.platform_data = data;
310
311 memset(res, 0, sizeof(res));
312
313 res[0].start = emif_windows[chipsel];
314 res[0].end = res[0].start + range;
315 res[0].flags = IORESOURCE_MEM;
316
317 res[1].start = TNETV107X_ASYNC_EMIF_CNTRL_BASE;
318 res[1].end = res[1].start + SZ_4K - 1;
319 res[1].flags = IORESOURCE_MEM;
320
321 ret = platform_device_add_resources(pdev, res, ARRAY_SIZE(res));
322 if (ret < 0) {
323 kfree(pdev);
324 return ret;
325 }
326
327 return platform_device_register(pdev);
328}
329
330static struct resource keypad_resources[] = {
331 {
332 .start = TNETV107X_KEYPAD_BASE,
333 .end = TNETV107X_KEYPAD_BASE + 0xff,
334 .flags = IORESOURCE_MEM,
335 },
336 {
337 .start = IRQ_TNETV107X_KEYPAD,
338 .flags = IORESOURCE_IRQ,
339 .name = "press",
340 },
341 {
342 .start = IRQ_TNETV107X_KEYPAD_FREE,
343 .flags = IORESOURCE_IRQ,
344 .name = "release",
345 },
346};
347
348static struct platform_device keypad_device = {
349 .name = "tnetv107x-keypad",
350 .num_resources = ARRAY_SIZE(keypad_resources),
351 .resource = keypad_resources,
352};
353
354static struct resource tsc_resources[] = {
355 {
356 .start = TNETV107X_TSC_BASE,
357 .end = TNETV107X_TSC_BASE + 0xff,
358 .flags = IORESOURCE_MEM,
359 },
360 {
361 .start = IRQ_TNETV107X_TSC,
362 .flags = IORESOURCE_IRQ,
363 },
364};
365
366static struct platform_device tsc_device = {
367 .name = "tnetv107x-ts",
368 .num_resources = ARRAY_SIZE(tsc_resources),
369 .resource = tsc_resources,
370};
371
372static struct resource ssp_resources[] = {
373 {
374 .start = TNETV107X_SSP_BASE,
375 .end = TNETV107X_SSP_BASE + 0x1ff,
376 .flags = IORESOURCE_MEM,
377 },
378 {
379 .start = IRQ_TNETV107X_SSP,
380 .flags = IORESOURCE_IRQ,
381 },
382};
383
384static struct platform_device ssp_device = {
385 .name = "ti-ssp",
386 .id = -1,
387 .num_resources = ARRAY_SIZE(ssp_resources),
388 .resource = ssp_resources,
389};
390
391void __init tnetv107x_devices_init(struct tnetv107x_device_info *info)
392{
393 int i, error;
394 struct clk *tsc_clk;
395
396 /*
397 * The reset defaults for tnetv107x tsc clock divider is set too high.
398 * This forces the clock down to a range that allows the ADC to
399 * complete sample conversion in time.
400 */
401 tsc_clk = clk_get(NULL, "sys_tsc_clk");
402 if (!IS_ERR(tsc_clk)) {
403 error = clk_set_rate(tsc_clk, 5000000);
404 WARN_ON(error < 0);
405 clk_put(tsc_clk);
406 }
407
408 platform_device_register(&edma_device);
409 platform_device_register(&tnetv107x_wdt_device);
410 platform_device_register(&tsc_device);
411
412 if (info->serial_config)
413 davinci_serial_init(tnetv107x_serial_device);
414
415 for (i = 0; i < 2; i++)
416 if (info->mmc_config[i]) {
417 mmc_devices[i].dev.platform_data = info->mmc_config[i];
418 platform_device_register(&mmc_devices[i]);
419 }
420
421 for (i = 0; i < 4; i++)
422 if (info->nand_config[i])
423 nand_init(i, info->nand_config[i]);
424
425 if (info->keypad_config) {
426 keypad_device.dev.platform_data = info->keypad_config;
427 platform_device_register(&keypad_device);
428 }
429
430 if (info->ssp_config) {
431 ssp_device.dev.platform_data = info->ssp_config;
432 platform_device_register(&ssp_device);
433 }
434}
diff --git a/arch/arm/mach-davinci/devices.c b/arch/arm/mach-davinci/devices.c
index 5cf9a027dcc6..6257aa452568 100644
--- a/arch/arm/mach-davinci/devices.c
+++ b/arch/arm/mach-davinci/devices.c
@@ -313,9 +313,9 @@ void davinci_restart(enum reboot_mode mode, const char *cmd)
313 davinci_watchdog_reset(&davinci_wdt_device); 313 davinci_watchdog_reset(&davinci_wdt_device);
314} 314}
315 315
316static void davinci_init_wdt(void) 316int davinci_init_wdt(void)
317{ 317{
318 platform_device_register(&davinci_wdt_device); 318 return platform_device_register(&davinci_wdt_device);
319} 319}
320 320
321static struct platform_device davinci_gpio_device = { 321static struct platform_device davinci_gpio_device = {
@@ -348,16 +348,3 @@ struct davinci_timer_instance davinci_timer_instance[2] = {
348 }, 348 },
349}; 349};
350 350
351/*-------------------------------------------------------------------------*/
352
353static int __init davinci_init_devices(void)
354{
355 /* please keep these calls, and their implementations above,
356 * in alphabetical order so they're easier to sort through.
357 */
358 davinci_init_wdt();
359
360 return 0;
361}
362arch_initcall(davinci_init_devices);
363
diff --git a/arch/arm/mach-davinci/dm355.c b/arch/arm/mach-davinci/dm355.c
index 4668c0e19767..07381d8cea62 100644
--- a/arch/arm/mach-davinci/dm355.c
+++ b/arch/arm/mach-davinci/dm355.c
@@ -1076,12 +1076,18 @@ int __init dm355_init_video(struct vpfe_config *vpfe_cfg,
1076 1076
1077static int __init dm355_init_devices(void) 1077static int __init dm355_init_devices(void)
1078{ 1078{
1079 int ret = 0;
1080
1079 if (!cpu_is_davinci_dm355()) 1081 if (!cpu_is_davinci_dm355())
1080 return 0; 1082 return 0;
1081 1083
1082 davinci_cfg_reg(DM355_INT_EDMA_CC); 1084 davinci_cfg_reg(DM355_INT_EDMA_CC);
1083 platform_device_register(&dm355_edma_device); 1085 platform_device_register(&dm355_edma_device);
1084 1086
1085 return 0; 1087 ret = davinci_init_wdt();
1088 if (ret)
1089 pr_warn("%s: watchdog init failed: %d\n", __func__, ret);
1090
1091 return ret;
1086} 1092}
1087postcore_initcall(dm355_init_devices); 1093postcore_initcall(dm355_init_devices);
diff --git a/arch/arm/mach-davinci/dm365.c b/arch/arm/mach-davinci/dm365.c
index b44b49e2801a..08a61b938333 100644
--- a/arch/arm/mach-davinci/dm365.c
+++ b/arch/arm/mach-davinci/dm365.c
@@ -1436,6 +1436,8 @@ int __init dm365_init_video(struct vpfe_config *vpfe_cfg,
1436 1436
1437static int __init dm365_init_devices(void) 1437static int __init dm365_init_devices(void)
1438{ 1438{
1439 int ret = 0;
1440
1439 if (!cpu_is_davinci_dm365()) 1441 if (!cpu_is_davinci_dm365())
1440 return 0; 1442 return 0;
1441 1443
@@ -1445,6 +1447,10 @@ static int __init dm365_init_devices(void)
1445 platform_device_register(&dm365_mdio_device); 1447 platform_device_register(&dm365_mdio_device);
1446 platform_device_register(&dm365_emac_device); 1448 platform_device_register(&dm365_emac_device);
1447 1449
1448 return 0; 1450 ret = davinci_init_wdt();
1451 if (ret)
1452 pr_warn("%s: watchdog init failed: %d\n", __func__, ret);
1453
1454 return ret;
1449} 1455}
1450postcore_initcall(dm365_init_devices); 1456postcore_initcall(dm365_init_devices);
diff --git a/arch/arm/mach-davinci/dm644x.c b/arch/arm/mach-davinci/dm644x.c
index 5c3e0be95ef3..5debffba4b24 100644
--- a/arch/arm/mach-davinci/dm644x.c
+++ b/arch/arm/mach-davinci/dm644x.c
@@ -964,6 +964,8 @@ int __init dm644x_init_video(struct vpfe_config *vpfe_cfg,
964 964
965static int __init dm644x_init_devices(void) 965static int __init dm644x_init_devices(void)
966{ 966{
967 int ret = 0;
968
967 if (!cpu_is_davinci_dm644x()) 969 if (!cpu_is_davinci_dm644x())
968 return 0; 970 return 0;
969 971
@@ -972,6 +974,10 @@ static int __init dm644x_init_devices(void)
972 platform_device_register(&dm644x_mdio_device); 974 platform_device_register(&dm644x_mdio_device);
973 platform_device_register(&dm644x_emac_device); 975 platform_device_register(&dm644x_emac_device);
974 976
975 return 0; 977 ret = davinci_init_wdt();
978 if (ret)
979 pr_warn("%s: watchdog init failed: %d\n", __func__, ret);
980
981 return ret;
976} 982}
977postcore_initcall(dm644x_init_devices); 983postcore_initcall(dm644x_init_devices);
diff --git a/arch/arm/mach-davinci/dm646x.c b/arch/arm/mach-davinci/dm646x.c
index 81768dd47096..332d00d24dc2 100644
--- a/arch/arm/mach-davinci/dm646x.c
+++ b/arch/arm/mach-davinci/dm646x.c
@@ -955,12 +955,18 @@ void __init dm646x_init(void)
955 955
956static int __init dm646x_init_devices(void) 956static int __init dm646x_init_devices(void)
957{ 957{
958 int ret = 0;
959
958 if (!cpu_is_davinci_dm646x()) 960 if (!cpu_is_davinci_dm646x())
959 return 0; 961 return 0;
960 962
961 platform_device_register(&dm646x_mdio_device); 963 platform_device_register(&dm646x_mdio_device);
962 platform_device_register(&dm646x_emac_device); 964 platform_device_register(&dm646x_emac_device);
963 965
964 return 0; 966 ret = davinci_init_wdt();
967 if (ret)
968 pr_warn("%s: watchdog init failed: %d\n", __func__, ret);
969
970 return ret;
965} 971}
966postcore_initcall(dm646x_init_devices); 972postcore_initcall(dm646x_init_devices);
diff --git a/arch/arm/mach-davinci/include/mach/cputype.h b/arch/arm/mach-davinci/include/mach/cputype.h
index 957fb87e832e..1fc84e21664d 100644
--- a/arch/arm/mach-davinci/include/mach/cputype.h
+++ b/arch/arm/mach-davinci/include/mach/cputype.h
@@ -33,7 +33,6 @@ struct davinci_id {
33#define DAVINCI_CPU_ID_DM365 0x03650000 33#define DAVINCI_CPU_ID_DM365 0x03650000
34#define DAVINCI_CPU_ID_DA830 0x08300000 34#define DAVINCI_CPU_ID_DA830 0x08300000
35#define DAVINCI_CPU_ID_DA850 0x08500000 35#define DAVINCI_CPU_ID_DA850 0x08500000
36#define DAVINCI_CPU_ID_TNETV107X 0x0b8a0000
37 36
38#define IS_DAVINCI_CPU(type, id) \ 37#define IS_DAVINCI_CPU(type, id) \
39static inline int is_davinci_ ##type(void) \ 38static inline int is_davinci_ ##type(void) \
@@ -47,7 +46,6 @@ IS_DAVINCI_CPU(dm355, DAVINCI_CPU_ID_DM355)
47IS_DAVINCI_CPU(dm365, DAVINCI_CPU_ID_DM365) 46IS_DAVINCI_CPU(dm365, DAVINCI_CPU_ID_DM365)
48IS_DAVINCI_CPU(da830, DAVINCI_CPU_ID_DA830) 47IS_DAVINCI_CPU(da830, DAVINCI_CPU_ID_DA830)
49IS_DAVINCI_CPU(da850, DAVINCI_CPU_ID_DA850) 48IS_DAVINCI_CPU(da850, DAVINCI_CPU_ID_DA850)
50IS_DAVINCI_CPU(tnetv107x, DAVINCI_CPU_ID_TNETV107X)
51 49
52#ifdef CONFIG_ARCH_DAVINCI_DM644x 50#ifdef CONFIG_ARCH_DAVINCI_DM644x
53#define cpu_is_davinci_dm644x() is_davinci_dm644x() 51#define cpu_is_davinci_dm644x() is_davinci_dm644x()
@@ -85,10 +83,4 @@ IS_DAVINCI_CPU(tnetv107x, DAVINCI_CPU_ID_TNETV107X)
85#define cpu_is_davinci_da850() 0 83#define cpu_is_davinci_da850() 0
86#endif 84#endif
87 85
88#ifdef CONFIG_ARCH_DAVINCI_TNETV107X
89#define cpu_is_davinci_tnetv107x() is_davinci_tnetv107x()
90#else
91#define cpu_is_davinci_tnetv107x() 0
92#endif
93
94#endif 86#endif
diff --git a/arch/arm/mach-davinci/include/mach/irqs.h b/arch/arm/mach-davinci/include/mach/irqs.h
index ec76c7775c2e..354af71798dc 100644
--- a/arch/arm/mach-davinci/include/mach/irqs.h
+++ b/arch/arm/mach-davinci/include/mach/irqs.h
@@ -401,103 +401,6 @@
401 401
402#define DA850_N_CP_INTC_IRQ 101 402#define DA850_N_CP_INTC_IRQ 101
403 403
404
405/* TNETV107X specific interrupts */
406#define IRQ_TNETV107X_TDM1_TXDMA 0
407#define IRQ_TNETV107X_EXT_INT_0 1
408#define IRQ_TNETV107X_EXT_INT_1 2
409#define IRQ_TNETV107X_GPIO_INT12 3
410#define IRQ_TNETV107X_GPIO_INT13 4
411#define IRQ_TNETV107X_TIMER_0_TINT12 5
412#define IRQ_TNETV107X_TIMER_1_TINT12 6
413#define IRQ_TNETV107X_UART0 7
414#define IRQ_TNETV107X_TDM1_RXDMA 8
415#define IRQ_TNETV107X_MCDMA_INT0 9
416#define IRQ_TNETV107X_MCDMA_INT1 10
417#define IRQ_TNETV107X_TPCC 11
418#define IRQ_TNETV107X_TPCC_INT0 12
419#define IRQ_TNETV107X_TPCC_INT1 13
420#define IRQ_TNETV107X_TPCC_INT2 14
421#define IRQ_TNETV107X_TPCC_INT3 15
422#define IRQ_TNETV107X_TPTC0 16
423#define IRQ_TNETV107X_TPTC1 17
424#define IRQ_TNETV107X_TIMER_0_TINT34 18
425#define IRQ_TNETV107X_ETHSS 19
426#define IRQ_TNETV107X_TIMER_1_TINT34 20
427#define IRQ_TNETV107X_DSP2ARM_INT0 21
428#define IRQ_TNETV107X_DSP2ARM_INT1 22
429#define IRQ_TNETV107X_ARM_NPMUIRQ 23
430#define IRQ_TNETV107X_USB1 24
431#define IRQ_TNETV107X_VLYNQ 25
432#define IRQ_TNETV107X_UART0_DMATX 26
433#define IRQ_TNETV107X_UART0_DMARX 27
434#define IRQ_TNETV107X_TDM1_TXMCSP 28
435#define IRQ_TNETV107X_SSP 29
436#define IRQ_TNETV107X_MCDMA_INT2 30
437#define IRQ_TNETV107X_MCDMA_INT3 31
438#define IRQ_TNETV107X_TDM_CODECIF_EOT 32
439#define IRQ_TNETV107X_IMCOP_SQR_ARM 33
440#define IRQ_TNETV107X_USB0 34
441#define IRQ_TNETV107X_USB_CDMA 35
442#define IRQ_TNETV107X_LCD 36
443#define IRQ_TNETV107X_KEYPAD 37
444#define IRQ_TNETV107X_KEYPAD_FREE 38
445#define IRQ_TNETV107X_RNG 39
446#define IRQ_TNETV107X_PKA 40
447#define IRQ_TNETV107X_TDM0_TXDMA 41
448#define IRQ_TNETV107X_TDM0_RXDMA 42
449#define IRQ_TNETV107X_TDM0_TXMCSP 43
450#define IRQ_TNETV107X_TDM0_RXMCSP 44
451#define IRQ_TNETV107X_TDM1_RXMCSP 45
452#define IRQ_TNETV107X_SDIO1 46
453#define IRQ_TNETV107X_SDIO0 47
454#define IRQ_TNETV107X_TSC 48
455#define IRQ_TNETV107X_TS 49
456#define IRQ_TNETV107X_UART1 50
457#define IRQ_TNETV107X_MBX_LITE 51
458#define IRQ_TNETV107X_GPIO_INT00 52
459#define IRQ_TNETV107X_GPIO_INT01 53
460#define IRQ_TNETV107X_GPIO_INT02 54
461#define IRQ_TNETV107X_GPIO_INT03 55
462#define IRQ_TNETV107X_UART2 56
463#define IRQ_TNETV107X_UART2_DMATX 57
464#define IRQ_TNETV107X_UART2_DMARX 58
465#define IRQ_TNETV107X_IMCOP_IMX 59
466#define IRQ_TNETV107X_IMCOP_VLCD 60
467#define IRQ_TNETV107X_AES 61
468#define IRQ_TNETV107X_DES 62
469#define IRQ_TNETV107X_SHAMD5 63
470#define IRQ_TNETV107X_TPCC_ERR 68
471#define IRQ_TNETV107X_TPCC_PROT 69
472#define IRQ_TNETV107X_TPTC0_ERR 70
473#define IRQ_TNETV107X_TPTC1_ERR 71
474#define IRQ_TNETV107X_UART0_ERR 72
475#define IRQ_TNETV107X_UART1_ERR 73
476#define IRQ_TNETV107X_AEMIF_ERR 74
477#define IRQ_TNETV107X_DDR_ERR 75
478#define IRQ_TNETV107X_WDTARM_INT0 76
479#define IRQ_TNETV107X_MCDMA_ERR 77
480#define IRQ_TNETV107X_GPIO_ERR 78
481#define IRQ_TNETV107X_MPU_ADDR 79
482#define IRQ_TNETV107X_MPU_PROT 80
483#define IRQ_TNETV107X_IOPU_ADDR 81
484#define IRQ_TNETV107X_IOPU_PROT 82
485#define IRQ_TNETV107X_KEYPAD_ADDR_ERR 83
486#define IRQ_TNETV107X_WDT0_ADDR_ERR 84
487#define IRQ_TNETV107X_WDT1_ADDR_ERR 85
488#define IRQ_TNETV107X_CLKCTL_ADDR_ERR 86
489#define IRQ_TNETV107X_PLL_UNLOCK 87
490#define IRQ_TNETV107X_WDTDSP_INT0 88
491#define IRQ_TNETV107X_SEC_CTRL_VIOLATION 89
492#define IRQ_TNETV107X_KEY_MNG_VIOLATION 90
493#define IRQ_TNETV107X_PBIST_CPU 91
494#define IRQ_TNETV107X_WDTARM 92
495#define IRQ_TNETV107X_PSC 93
496#define IRQ_TNETV107X_MMC0 94
497#define IRQ_TNETV107X_MMC1 95
498
499#define TNETV107X_N_CP_INTC_IRQ 96
500
501/* da850 currently has the most gpio pins (144) */ 404/* da850 currently has the most gpio pins (144) */
502#define DAVINCI_N_GPIO 144 405#define DAVINCI_N_GPIO 144
503/* da850 currently has the most irqs so use DA850_N_CP_INTC_IRQ */ 406/* da850 currently has the most irqs so use DA850_N_CP_INTC_IRQ */
diff --git a/arch/arm/mach-davinci/include/mach/mux.h b/arch/arm/mach-davinci/include/mach/mux.h
index 9e95b8a1edb6..631655e68ae0 100644
--- a/arch/arm/mach-davinci/include/mach/mux.h
+++ b/arch/arm/mach-davinci/include/mach/mux.h
@@ -972,275 +972,6 @@ enum davinci_da850_index {
972 DA850_VPIF_CLKO3, 972 DA850_VPIF_CLKO3,
973}; 973};
974 974
975enum davinci_tnetv107x_index {
976 TNETV107X_ASR_A00,
977 TNETV107X_GPIO32,
978 TNETV107X_ASR_A01,
979 TNETV107X_GPIO33,
980 TNETV107X_ASR_A02,
981 TNETV107X_GPIO34,
982 TNETV107X_ASR_A03,
983 TNETV107X_GPIO35,
984 TNETV107X_ASR_A04,
985 TNETV107X_GPIO36,
986 TNETV107X_ASR_A05,
987 TNETV107X_GPIO37,
988 TNETV107X_ASR_A06,
989 TNETV107X_GPIO38,
990 TNETV107X_ASR_A07,
991 TNETV107X_GPIO39,
992 TNETV107X_ASR_A08,
993 TNETV107X_GPIO40,
994 TNETV107X_ASR_A09,
995 TNETV107X_GPIO41,
996 TNETV107X_ASR_A10,
997 TNETV107X_GPIO42,
998 TNETV107X_ASR_A11,
999 TNETV107X_BOOT_STRP_0,
1000 TNETV107X_ASR_A12,
1001 TNETV107X_BOOT_STRP_1,
1002 TNETV107X_ASR_A13,
1003 TNETV107X_GPIO43,
1004 TNETV107X_ASR_A14,
1005 TNETV107X_GPIO44,
1006 TNETV107X_ASR_A15,
1007 TNETV107X_GPIO45,
1008 TNETV107X_ASR_A16,
1009 TNETV107X_GPIO46,
1010 TNETV107X_ASR_A17,
1011 TNETV107X_GPIO47,
1012 TNETV107X_ASR_A18,
1013 TNETV107X_GPIO48,
1014 TNETV107X_SDIO1_DATA3_0,
1015 TNETV107X_ASR_A19,
1016 TNETV107X_GPIO49,
1017 TNETV107X_SDIO1_DATA2_0,
1018 TNETV107X_ASR_A20,
1019 TNETV107X_GPIO50,
1020 TNETV107X_SDIO1_DATA1_0,
1021 TNETV107X_ASR_A21,
1022 TNETV107X_GPIO51,
1023 TNETV107X_SDIO1_DATA0_0,
1024 TNETV107X_ASR_A22,
1025 TNETV107X_GPIO52,
1026 TNETV107X_SDIO1_CMD_0,
1027 TNETV107X_ASR_A23,
1028 TNETV107X_GPIO53,
1029 TNETV107X_SDIO1_CLK_0,
1030 TNETV107X_ASR_BA_1,
1031 TNETV107X_GPIO54,
1032 TNETV107X_SYS_PLL_CLK,
1033 TNETV107X_ASR_CS0,
1034 TNETV107X_ASR_CS1,
1035 TNETV107X_ASR_CS2,
1036 TNETV107X_TDM_PLL_CLK,
1037 TNETV107X_ASR_CS3,
1038 TNETV107X_ETH_PHY_CLK,
1039 TNETV107X_ASR_D00,
1040 TNETV107X_GPIO55,
1041 TNETV107X_ASR_D01,
1042 TNETV107X_GPIO56,
1043 TNETV107X_ASR_D02,
1044 TNETV107X_GPIO57,
1045 TNETV107X_ASR_D03,
1046 TNETV107X_GPIO58,
1047 TNETV107X_ASR_D04,
1048 TNETV107X_GPIO59_0,
1049 TNETV107X_ASR_D05,
1050 TNETV107X_GPIO60_0,
1051 TNETV107X_ASR_D06,
1052 TNETV107X_GPIO61_0,
1053 TNETV107X_ASR_D07,
1054 TNETV107X_GPIO62_0,
1055 TNETV107X_ASR_D08,
1056 TNETV107X_GPIO63_0,
1057 TNETV107X_ASR_D09,
1058 TNETV107X_GPIO64_0,
1059 TNETV107X_ASR_D10,
1060 TNETV107X_SDIO1_DATA3_1,
1061 TNETV107X_ASR_D11,
1062 TNETV107X_SDIO1_DATA2_1,
1063 TNETV107X_ASR_D12,
1064 TNETV107X_SDIO1_DATA1_1,
1065 TNETV107X_ASR_D13,
1066 TNETV107X_SDIO1_DATA0_1,
1067 TNETV107X_ASR_D14,
1068 TNETV107X_SDIO1_CMD_1,
1069 TNETV107X_ASR_D15,
1070 TNETV107X_SDIO1_CLK_1,
1071 TNETV107X_ASR_OE,
1072 TNETV107X_BOOT_STRP_2,
1073 TNETV107X_ASR_RNW,
1074 TNETV107X_GPIO29_0,
1075 TNETV107X_ASR_WAIT,
1076 TNETV107X_GPIO30_0,
1077 TNETV107X_ASR_WE,
1078 TNETV107X_BOOT_STRP_3,
1079 TNETV107X_ASR_WE_DQM0,
1080 TNETV107X_GPIO31,
1081 TNETV107X_LCD_PD17_0,
1082 TNETV107X_ASR_WE_DQM1,
1083 TNETV107X_ASR_BA0_0,
1084 TNETV107X_VLYNQ_CLK,
1085 TNETV107X_GPIO14,
1086 TNETV107X_LCD_PD19_0,
1087 TNETV107X_VLYNQ_RXD0,
1088 TNETV107X_GPIO15,
1089 TNETV107X_LCD_PD20_0,
1090 TNETV107X_VLYNQ_RXD1,
1091 TNETV107X_GPIO16,
1092 TNETV107X_LCD_PD21_0,
1093 TNETV107X_VLYNQ_TXD0,
1094 TNETV107X_GPIO17,
1095 TNETV107X_LCD_PD22_0,
1096 TNETV107X_VLYNQ_TXD1,
1097 TNETV107X_GPIO18,
1098 TNETV107X_LCD_PD23_0,
1099 TNETV107X_SDIO0_CLK,
1100 TNETV107X_GPIO19,
1101 TNETV107X_SDIO0_CMD,
1102 TNETV107X_GPIO20,
1103 TNETV107X_SDIO0_DATA0,
1104 TNETV107X_GPIO21,
1105 TNETV107X_SDIO0_DATA1,
1106 TNETV107X_GPIO22,
1107 TNETV107X_SDIO0_DATA2,
1108 TNETV107X_GPIO23,
1109 TNETV107X_SDIO0_DATA3,
1110 TNETV107X_GPIO24,
1111 TNETV107X_EMU0,
1112 TNETV107X_EMU1,
1113 TNETV107X_RTCK,
1114 TNETV107X_TRST_N,
1115 TNETV107X_TCK,
1116 TNETV107X_TDI,
1117 TNETV107X_TDO,
1118 TNETV107X_TMS,
1119 TNETV107X_TDM1_CLK,
1120 TNETV107X_TDM1_RX,
1121 TNETV107X_TDM1_TX,
1122 TNETV107X_TDM1_FS,
1123 TNETV107X_KEYPAD_R0,
1124 TNETV107X_KEYPAD_R1,
1125 TNETV107X_KEYPAD_R2,
1126 TNETV107X_KEYPAD_R3,
1127 TNETV107X_KEYPAD_R4,
1128 TNETV107X_KEYPAD_R5,
1129 TNETV107X_KEYPAD_R6,
1130 TNETV107X_GPIO12,
1131 TNETV107X_KEYPAD_R7,
1132 TNETV107X_GPIO10,
1133 TNETV107X_KEYPAD_C0,
1134 TNETV107X_KEYPAD_C1,
1135 TNETV107X_KEYPAD_C2,
1136 TNETV107X_KEYPAD_C3,
1137 TNETV107X_KEYPAD_C4,
1138 TNETV107X_KEYPAD_C5,
1139 TNETV107X_KEYPAD_C6,
1140 TNETV107X_GPIO13,
1141 TNETV107X_TEST_CLK_IN,
1142 TNETV107X_KEYPAD_C7,
1143 TNETV107X_GPIO11,
1144 TNETV107X_SSP0_0,
1145 TNETV107X_SCC_DCLK,
1146 TNETV107X_LCD_PD20_1,
1147 TNETV107X_SSP0_1,
1148 TNETV107X_SCC_CS_N,
1149 TNETV107X_LCD_PD21_1,
1150 TNETV107X_SSP0_2,
1151 TNETV107X_SCC_D,
1152 TNETV107X_LCD_PD22_1,
1153 TNETV107X_SSP0_3,
1154 TNETV107X_SCC_RESETN,
1155 TNETV107X_LCD_PD23_1,
1156 TNETV107X_SSP1_0,
1157 TNETV107X_GPIO25,
1158 TNETV107X_UART2_CTS,
1159 TNETV107X_SSP1_1,
1160 TNETV107X_GPIO26,
1161 TNETV107X_UART2_RD,
1162 TNETV107X_SSP1_2,
1163 TNETV107X_GPIO27,
1164 TNETV107X_UART2_RTS,
1165 TNETV107X_SSP1_3,
1166 TNETV107X_GPIO28,
1167 TNETV107X_UART2_TD,
1168 TNETV107X_UART0_CTS,
1169 TNETV107X_UART0_RD,
1170 TNETV107X_UART0_RTS,
1171 TNETV107X_UART0_TD,
1172 TNETV107X_UART1_RD,
1173 TNETV107X_UART1_TD,
1174 TNETV107X_LCD_AC_NCS,
1175 TNETV107X_LCD_HSYNC_RNW,
1176 TNETV107X_LCD_VSYNC_A0,
1177 TNETV107X_LCD_MCLK,
1178 TNETV107X_LCD_PD16_0,
1179 TNETV107X_LCD_PCLK_E,
1180 TNETV107X_LCD_PD00,
1181 TNETV107X_LCD_PD01,
1182 TNETV107X_LCD_PD02,
1183 TNETV107X_LCD_PD03,
1184 TNETV107X_LCD_PD04,
1185 TNETV107X_LCD_PD05,
1186 TNETV107X_LCD_PD06,
1187 TNETV107X_LCD_PD07,
1188 TNETV107X_LCD_PD08,
1189 TNETV107X_GPIO59_1,
1190 TNETV107X_LCD_PD09,
1191 TNETV107X_GPIO60_1,
1192 TNETV107X_LCD_PD10,
1193 TNETV107X_ASR_BA0_1,
1194 TNETV107X_GPIO61_1,
1195 TNETV107X_LCD_PD11,
1196 TNETV107X_GPIO62_1,
1197 TNETV107X_LCD_PD12,
1198 TNETV107X_GPIO63_1,
1199 TNETV107X_LCD_PD13,
1200 TNETV107X_GPIO64_1,
1201 TNETV107X_LCD_PD14,
1202 TNETV107X_GPIO29_1,
1203 TNETV107X_LCD_PD15,
1204 TNETV107X_GPIO30_1,
1205 TNETV107X_EINT0,
1206 TNETV107X_GPIO08,
1207 TNETV107X_EINT1,
1208 TNETV107X_GPIO09,
1209 TNETV107X_GPIO00,
1210 TNETV107X_LCD_PD20_2,
1211 TNETV107X_TDM_CLK_IN_2,
1212 TNETV107X_GPIO01,
1213 TNETV107X_LCD_PD21_2,
1214 TNETV107X_24M_CLK_OUT_1,
1215 TNETV107X_GPIO02,
1216 TNETV107X_LCD_PD22_2,
1217 TNETV107X_GPIO03,
1218 TNETV107X_LCD_PD23_2,
1219 TNETV107X_GPIO04,
1220 TNETV107X_LCD_PD16_1,
1221 TNETV107X_USB0_RXERR,
1222 TNETV107X_GPIO05,
1223 TNETV107X_LCD_PD17_1,
1224 TNETV107X_TDM_CLK_IN_1,
1225 TNETV107X_GPIO06,
1226 TNETV107X_LCD_PD18,
1227 TNETV107X_24M_CLK_OUT_2,
1228 TNETV107X_GPIO07,
1229 TNETV107X_LCD_PD19_1,
1230 TNETV107X_USB1_RXERR,
1231 TNETV107X_ETH_PLL_CLK,
1232 TNETV107X_MDIO,
1233 TNETV107X_MDC,
1234 TNETV107X_AIC_MUTE_STAT_N,
1235 TNETV107X_TDM0_CLK,
1236 TNETV107X_AIC_HNS_EN_N,
1237 TNETV107X_TDM0_FS,
1238 TNETV107X_AIC_HDS_EN_STAT_N,
1239 TNETV107X_TDM0_TX,
1240 TNETV107X_AIC_HNF_EN_STAT_N,
1241 TNETV107X_TDM0_RX,
1242};
1243
1244#define PINMUX(x) (4 * (x)) 975#define PINMUX(x) (4 * (x))
1245 976
1246#ifdef CONFIG_DAVINCI_MUX 977#ifdef CONFIG_DAVINCI_MUX
diff --git a/arch/arm/mach-davinci/include/mach/psc.h b/arch/arm/mach-davinci/include/mach/psc.h
index 0a22710493fd..99d47cfa301f 100644
--- a/arch/arm/mach-davinci/include/mach/psc.h
+++ b/arch/arm/mach-davinci/include/mach/psc.h
@@ -182,53 +182,6 @@
182#define DA8XX_LPSC1_CR_P3_SS 26 182#define DA8XX_LPSC1_CR_P3_SS 26
183#define DA8XX_LPSC1_L3_CBA_RAM 31 183#define DA8XX_LPSC1_L3_CBA_RAM 31
184 184
185/* TNETV107X LPSC Assignments */
186#define TNETV107X_LPSC_ARM 0
187#define TNETV107X_LPSC_GEM 1
188#define TNETV107X_LPSC_DDR2_PHY 2
189#define TNETV107X_LPSC_TPCC 3
190#define TNETV107X_LPSC_TPTC0 4
191#define TNETV107X_LPSC_TPTC1 5
192#define TNETV107X_LPSC_RAM 6
193#define TNETV107X_LPSC_MBX_LITE 7
194#define TNETV107X_LPSC_LCD 8
195#define TNETV107X_LPSC_ETHSS 9
196#define TNETV107X_LPSC_AEMIF 10
197#define TNETV107X_LPSC_CHIP_CFG 11
198#define TNETV107X_LPSC_TSC 12
199#define TNETV107X_LPSC_ROM 13
200#define TNETV107X_LPSC_UART2 14
201#define TNETV107X_LPSC_PKTSEC 15
202#define TNETV107X_LPSC_SECCTL 16
203#define TNETV107X_LPSC_KEYMGR 17
204#define TNETV107X_LPSC_KEYPAD 18
205#define TNETV107X_LPSC_GPIO 19
206#define TNETV107X_LPSC_MDIO 20
207#define TNETV107X_LPSC_SDIO0 21
208#define TNETV107X_LPSC_UART0 22
209#define TNETV107X_LPSC_UART1 23
210#define TNETV107X_LPSC_TIMER0 24
211#define TNETV107X_LPSC_TIMER1 25
212#define TNETV107X_LPSC_WDT_ARM 26
213#define TNETV107X_LPSC_WDT_DSP 27
214#define TNETV107X_LPSC_SSP 28
215#define TNETV107X_LPSC_TDM0 29
216#define TNETV107X_LPSC_VLYNQ 30
217#define TNETV107X_LPSC_MCDMA 31
218#define TNETV107X_LPSC_USB0 32
219#define TNETV107X_LPSC_TDM1 33
220#define TNETV107X_LPSC_DEBUGSS 34
221#define TNETV107X_LPSC_ETHSS_RGMII 35
222#define TNETV107X_LPSC_SYSTEM 36
223#define TNETV107X_LPSC_IMCOP 37
224#define TNETV107X_LPSC_SPARE 38
225#define TNETV107X_LPSC_SDIO1 39
226#define TNETV107X_LPSC_USB1 40
227#define TNETV107X_LPSC_USBSS 41
228#define TNETV107X_LPSC_DDR2_EMIF1_VRST 42
229#define TNETV107X_LPSC_DDR2_EMIF2_VCTL_RST 43
230#define TNETV107X_LPSC_MAX 44
231
232/* PSC register offsets */ 185/* PSC register offsets */
233#define EPCPR 0x070 186#define EPCPR 0x070
234#define PTCMD 0x120 187#define PTCMD 0x120
diff --git a/arch/arm/mach-davinci/include/mach/serial.h b/arch/arm/mach-davinci/include/mach/serial.h
index ce402cd21fa0..d4b4aa87964f 100644
--- a/arch/arm/mach-davinci/include/mach/serial.h
+++ b/arch/arm/mach-davinci/include/mach/serial.h
@@ -23,14 +23,6 @@
23#define DA8XX_UART1_BASE (IO_PHYS + 0x10c000) 23#define DA8XX_UART1_BASE (IO_PHYS + 0x10c000)
24#define DA8XX_UART2_BASE (IO_PHYS + 0x10d000) 24#define DA8XX_UART2_BASE (IO_PHYS + 0x10d000)
25 25
26#define TNETV107X_UART0_BASE 0x08108100
27#define TNETV107X_UART1_BASE 0x08088400
28#define TNETV107X_UART2_BASE 0x08108300
29
30#define TNETV107X_UART0_VIRT IOMEM(0xfee08100)
31#define TNETV107X_UART1_VIRT IOMEM(0xfed88400)
32#define TNETV107X_UART2_VIRT IOMEM(0xfee08300)
33
34/* DaVinci UART register offsets */ 26/* DaVinci UART register offsets */
35#define UART_DAVINCI_PWREMU 0x0c 27#define UART_DAVINCI_PWREMU 0x0c
36#define UART_DM646X_SCR 0x10 28#define UART_DM646X_SCR 0x10
diff --git a/arch/arm/mach-davinci/include/mach/tnetv107x.h b/arch/arm/mach-davinci/include/mach/tnetv107x.h
deleted file mode 100644
index 494fcf5ccfe1..000000000000
--- a/arch/arm/mach-davinci/include/mach/tnetv107x.h
+++ /dev/null
@@ -1,61 +0,0 @@
1/*
2 * Texas Instruments TNETV107X SoC Specific Defines
3 *
4 * Copyright (C) 2010 Texas Instruments
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation version 2.
9 *
10 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
11 * kind, whether express or implied; without even the implied warranty
12 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15#ifndef __ASM_ARCH_DAVINCI_TNETV107X_H
16#define __ASM_ARCH_DAVINCI_TNETV107X_H
17
18#include <asm/sizes.h>
19
20#define TNETV107X_DDR_BASE 0x80000000
21
22/*
23 * Fixed mapping for early init starts here. If low-level debug is enabled,
24 * this area also gets mapped via io_pg_offset and io_phys by the boot code.
25 * To fit in with the io_pg_offset calculation, the io base address selected
26 * here _must_ be a multiple of 2^20.
27 */
28#define TNETV107X_IO_BASE 0x08000000
29#define TNETV107X_IO_VIRT (IO_VIRT + SZ_1M)
30
31#define TNETV107X_N_GPIO 65
32
33#ifndef __ASSEMBLY__
34
35#include <linux/serial_8250.h>
36#include <linux/input/matrix_keypad.h>
37#include <linux/mfd/ti_ssp.h>
38#include <linux/reboot.h>
39
40#include <linux/platform_data/mmc-davinci.h>
41#include <linux/platform_data/mtd-davinci.h>
42#include <mach/serial.h>
43
44struct tnetv107x_device_info {
45 struct davinci_mmc_config *mmc_config[2]; /* 2 controllers */
46 struct davinci_nand_pdata *nand_config[4]; /* 4 chipsels */
47 struct matrix_keypad_platform_data *keypad_config;
48 struct ti_ssp_data *ssp_config;
49};
50
51extern struct platform_device tnetv107x_wdt_device;
52extern struct platform_device tnetv107x_serial_device[];
53
54extern void tnetv107x_init(void);
55extern void tnetv107x_devices_init(struct tnetv107x_device_info *);
56extern void tnetv107x_irq_init(void);
57void tnetv107x_restart(enum reboot_mode mode, const char *cmd);
58
59#endif
60
61#endif /* __ASM_ARCH_DAVINCI_TNETV107X_H */
diff --git a/arch/arm/mach-davinci/include/mach/uncompress.h b/arch/arm/mach-davinci/include/mach/uncompress.h
index f49c2916aa3a..8fb97b93b6bb 100644
--- a/arch/arm/mach-davinci/include/mach/uncompress.h
+++ b/arch/arm/mach-davinci/include/mach/uncompress.h
@@ -68,9 +68,6 @@ static inline void set_uart_info(u32 phys)
68#define DEBUG_LL_DA8XX(machine, port) \ 68#define DEBUG_LL_DA8XX(machine, port) \
69 _DEBUG_LL_ENTRY(machine, DA8XX_UART##port##_BASE) 69 _DEBUG_LL_ENTRY(machine, DA8XX_UART##port##_BASE)
70 70
71#define DEBUG_LL_TNETV107X(machine, port) \
72 _DEBUG_LL_ENTRY(machine, TNETV107X_UART##port##_BASE)
73
74static inline void __arch_decomp_setup(unsigned long arch_id) 71static inline void __arch_decomp_setup(unsigned long arch_id)
75{ 72{
76 /* 73 /*
@@ -94,9 +91,6 @@ static inline void __arch_decomp_setup(unsigned long arch_id)
94 DEBUG_LL_DA8XX(davinci_da850_evm, 2); 91 DEBUG_LL_DA8XX(davinci_da850_evm, 2);
95 DEBUG_LL_DA8XX(mityomapl138, 1); 92 DEBUG_LL_DA8XX(mityomapl138, 1);
96 DEBUG_LL_DA8XX(omapl138_hawkboard, 2); 93 DEBUG_LL_DA8XX(omapl138_hawkboard, 2);
97
98 /* TNETV107x boards */
99 DEBUG_LL_TNETV107X(tnetv107x, 1);
100 } while (0); 94 } while (0);
101} 95}
102 96
diff --git a/arch/arm/mach-davinci/tnetv107x.c b/arch/arm/mach-davinci/tnetv107x.c
deleted file mode 100644
index f4d7fbb24b3b..000000000000
--- a/arch/arm/mach-davinci/tnetv107x.c
+++ /dev/null
@@ -1,766 +0,0 @@
1/*
2 * Texas Instruments TNETV107X SoC Support
3 *
4 * Copyright (C) 2010 Texas Instruments
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation version 2.
9 *
10 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
11 * kind, whether express or implied; without even the implied warranty
12 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15#include <linux/gpio.h>
16#include <linux/kernel.h>
17#include <linux/init.h>
18#include <linux/clk.h>
19#include <linux/io.h>
20#include <linux/err.h>
21#include <linux/platform_device.h>
22#include <linux/reboot.h>
23
24#include <asm/mach/map.h>
25
26#include <mach/common.h>
27#include <mach/time.h>
28#include <mach/cputype.h>
29#include <mach/psc.h>
30#include <mach/cp_intc.h>
31#include <mach/irqs.h>
32#include <mach/hardware.h>
33#include <mach/tnetv107x.h>
34#include <mach/gpio-davinci.h>
35
36#include "clock.h"
37#include "mux.h"
38
39/* Base addresses for on-chip devices */
40#define TNETV107X_INTC_BASE 0x03000000
41#define TNETV107X_TIMER0_BASE 0x08086500
42#define TNETV107X_TIMER1_BASE 0x08086600
43#define TNETV107X_CHIP_CFG_BASE 0x08087000
44#define TNETV107X_GPIO_BASE 0x08088000
45#define TNETV107X_CLOCK_CONTROL_BASE 0x0808a000
46#define TNETV107X_PSC_BASE 0x0808b000
47
48/* Reference clock frequencies */
49#define OSC_FREQ_ONCHIP (24000 * 1000)
50#define OSC_FREQ_OFFCHIP_SYS (25000 * 1000)
51#define OSC_FREQ_OFFCHIP_ETH (25000 * 1000)
52#define OSC_FREQ_OFFCHIP_TDM (19200 * 1000)
53
54#define N_PLLS 3
55
56/* Clock Control Registers */
57struct clk_ctrl_regs {
58 u32 pll_bypass;
59 u32 _reserved0;
60 u32 gem_lrst;
61 u32 _reserved1;
62 u32 pll_unlock_stat;
63 u32 sys_unlock;
64 u32 eth_unlock;
65 u32 tdm_unlock;
66};
67
68/* SSPLL Registers */
69struct sspll_regs {
70 u32 modes;
71 u32 post_div;
72 u32 pre_div;
73 u32 mult_factor;
74 u32 divider_range;
75 u32 bw_divider;
76 u32 spr_amount;
77 u32 spr_rate_div;
78 u32 diag;
79};
80
81/* Watchdog Timer Registers */
82struct wdt_regs {
83 u32 kick_lock;
84 u32 kick;
85 u32 change_lock;
86 u32 change ;
87 u32 disable_lock;
88 u32 disable;
89 u32 prescale_lock;
90 u32 prescale;
91};
92
93static struct clk_ctrl_regs __iomem *clk_ctrl_regs;
94
95static struct sspll_regs __iomem *sspll_regs[N_PLLS];
96static int sspll_regs_base[N_PLLS] = { 0x40, 0x80, 0xc0 };
97
98/* PLL bypass bit shifts in clk_ctrl_regs->pll_bypass register */
99static u32 bypass_mask[N_PLLS] = { BIT(0), BIT(2), BIT(1) };
100
101/* offchip (external) reference clock frequencies */
102static u32 pll_ext_freq[] = {
103 OSC_FREQ_OFFCHIP_SYS,
104 OSC_FREQ_OFFCHIP_TDM,
105 OSC_FREQ_OFFCHIP_ETH
106};
107
108/* PSC control registers */
109static u32 psc_regs[] = { TNETV107X_PSC_BASE };
110
111/* Host map for interrupt controller */
112static u32 intc_host_map[] = { 0x01010000, 0x01010101, -1 };
113
114static unsigned long clk_sspll_recalc(struct clk *clk);
115
116/* Level 1 - the PLLs */
117#define define_pll_clk(cname, pll, divmask, base) \
118 static struct pll_data pll_##cname##_data = { \
119 .num = pll, \
120 .div_ratio_mask = divmask, \
121 .phys_base = base + \
122 TNETV107X_CLOCK_CONTROL_BASE, \
123 }; \
124 static struct clk pll_##cname##_clk = { \
125 .name = "pll_" #cname "_clk", \
126 .pll_data = &pll_##cname##_data, \
127 .flags = CLK_PLL, \
128 .recalc = clk_sspll_recalc, \
129 }
130
131define_pll_clk(sys, 0, 0x1ff, 0x600);
132define_pll_clk(tdm, 1, 0x0ff, 0x200);
133define_pll_clk(eth, 2, 0x0ff, 0x400);
134
135/* Level 2 - divided outputs from the PLLs */
136#define define_pll_div_clk(pll, cname, div) \
137 static struct clk pll##_##cname##_clk = { \
138 .name = #pll "_" #cname "_clk", \
139 .parent = &pll_##pll##_clk, \
140 .flags = CLK_PLL, \
141 .div_reg = PLLDIV##div, \
142 .set_rate = davinci_set_sysclk_rate, \
143 }
144
145define_pll_div_clk(sys, arm1176, 1);
146define_pll_div_clk(sys, dsp, 2);
147define_pll_div_clk(sys, ddr, 3);
148define_pll_div_clk(sys, full, 4);
149define_pll_div_clk(sys, lcd, 5);
150define_pll_div_clk(sys, vlynq_ref, 6);
151define_pll_div_clk(sys, tsc, 7);
152define_pll_div_clk(sys, half, 8);
153
154define_pll_div_clk(eth, 5mhz, 1);
155define_pll_div_clk(eth, 50mhz, 2);
156define_pll_div_clk(eth, 125mhz, 3);
157define_pll_div_clk(eth, 250mhz, 4);
158define_pll_div_clk(eth, 25mhz, 5);
159
160define_pll_div_clk(tdm, 0, 1);
161define_pll_div_clk(tdm, extra, 2);
162define_pll_div_clk(tdm, 1, 3);
163
164
165/* Level 3 - LPSC gated clocks */
166#define __lpsc_clk(cname, _parent, mod, flg) \
167 static struct clk clk_##cname = { \
168 .name = #cname, \
169 .parent = &_parent, \
170 .lpsc = TNETV107X_LPSC_##mod,\
171 .flags = flg, \
172 }
173
174#define lpsc_clk_enabled(cname, parent, mod) \
175 __lpsc_clk(cname, parent, mod, ALWAYS_ENABLED)
176
177#define lpsc_clk(cname, parent, mod) \
178 __lpsc_clk(cname, parent, mod, 0)
179
180lpsc_clk_enabled(arm, sys_arm1176_clk, ARM);
181lpsc_clk_enabled(gem, sys_dsp_clk, GEM);
182lpsc_clk_enabled(ddr2_phy, sys_ddr_clk, DDR2_PHY);
183lpsc_clk_enabled(tpcc, sys_full_clk, TPCC);
184lpsc_clk_enabled(tptc0, sys_full_clk, TPTC0);
185lpsc_clk_enabled(tptc1, sys_full_clk, TPTC1);
186lpsc_clk_enabled(ram, sys_full_clk, RAM);
187lpsc_clk_enabled(aemif, sys_full_clk, AEMIF);
188lpsc_clk_enabled(chipcfg, sys_half_clk, CHIP_CFG);
189lpsc_clk_enabled(rom, sys_half_clk, ROM);
190lpsc_clk_enabled(secctl, sys_half_clk, SECCTL);
191lpsc_clk_enabled(keymgr, sys_half_clk, KEYMGR);
192lpsc_clk_enabled(gpio, sys_half_clk, GPIO);
193lpsc_clk_enabled(debugss, sys_half_clk, DEBUGSS);
194lpsc_clk_enabled(system, sys_half_clk, SYSTEM);
195lpsc_clk_enabled(ddr2_vrst, sys_ddr_clk, DDR2_EMIF1_VRST);
196lpsc_clk_enabled(ddr2_vctl_rst, sys_ddr_clk, DDR2_EMIF2_VCTL_RST);
197lpsc_clk_enabled(wdt_arm, sys_half_clk, WDT_ARM);
198lpsc_clk_enabled(timer1, sys_half_clk, TIMER1);
199
200lpsc_clk(mbx_lite, sys_arm1176_clk, MBX_LITE);
201lpsc_clk(ethss, eth_125mhz_clk, ETHSS);
202lpsc_clk(tsc, sys_tsc_clk, TSC);
203lpsc_clk(uart0, sys_half_clk, UART0);
204lpsc_clk(uart1, sys_half_clk, UART1);
205lpsc_clk(uart2, sys_half_clk, UART2);
206lpsc_clk(pktsec, sys_half_clk, PKTSEC);
207lpsc_clk(keypad, sys_half_clk, KEYPAD);
208lpsc_clk(mdio, sys_half_clk, MDIO);
209lpsc_clk(sdio0, sys_half_clk, SDIO0);
210lpsc_clk(sdio1, sys_half_clk, SDIO1);
211lpsc_clk(timer0, sys_half_clk, TIMER0);
212lpsc_clk(wdt_dsp, sys_half_clk, WDT_DSP);
213lpsc_clk(ssp, sys_half_clk, SSP);
214lpsc_clk(tdm0, tdm_0_clk, TDM0);
215lpsc_clk(tdm1, tdm_1_clk, TDM1);
216lpsc_clk(vlynq, sys_vlynq_ref_clk, VLYNQ);
217lpsc_clk(mcdma, sys_half_clk, MCDMA);
218lpsc_clk(usbss, sys_half_clk, USBSS);
219lpsc_clk(usb0, clk_usbss, USB0);
220lpsc_clk(usb1, clk_usbss, USB1);
221lpsc_clk(ethss_rgmii, eth_250mhz_clk, ETHSS_RGMII);
222lpsc_clk(imcop, sys_dsp_clk, IMCOP);
223lpsc_clk(spare, sys_half_clk, SPARE);
224
225/* LCD needs a full power down to clear controller state */
226__lpsc_clk(lcd, sys_lcd_clk, LCD, PSC_SWRSTDISABLE);
227
228
229/* Level 4 - leaf clocks for LPSC modules shared across drivers */
230static struct clk clk_rng = { .name = "rng", .parent = &clk_pktsec };
231static struct clk clk_pka = { .name = "pka", .parent = &clk_pktsec };
232
233static struct clk_lookup clks[] = {
234 CLK(NULL, "pll_sys_clk", &pll_sys_clk),
235 CLK(NULL, "pll_eth_clk", &pll_eth_clk),
236 CLK(NULL, "pll_tdm_clk", &pll_tdm_clk),
237 CLK(NULL, "sys_arm1176_clk", &sys_arm1176_clk),
238 CLK(NULL, "sys_dsp_clk", &sys_dsp_clk),
239 CLK(NULL, "sys_ddr_clk", &sys_ddr_clk),
240 CLK(NULL, "sys_full_clk", &sys_full_clk),
241 CLK(NULL, "sys_lcd_clk", &sys_lcd_clk),
242 CLK(NULL, "sys_vlynq_ref_clk", &sys_vlynq_ref_clk),
243 CLK(NULL, "sys_tsc_clk", &sys_tsc_clk),
244 CLK(NULL, "sys_half_clk", &sys_half_clk),
245 CLK(NULL, "eth_5mhz_clk", &eth_5mhz_clk),
246 CLK(NULL, "eth_50mhz_clk", &eth_50mhz_clk),
247 CLK(NULL, "eth_125mhz_clk", &eth_125mhz_clk),
248 CLK(NULL, "eth_250mhz_clk", &eth_250mhz_clk),
249 CLK(NULL, "eth_25mhz_clk", &eth_25mhz_clk),
250 CLK(NULL, "tdm_0_clk", &tdm_0_clk),
251 CLK(NULL, "tdm_extra_clk", &tdm_extra_clk),
252 CLK(NULL, "tdm_1_clk", &tdm_1_clk),
253 CLK(NULL, "clk_arm", &clk_arm),
254 CLK(NULL, "clk_gem", &clk_gem),
255 CLK(NULL, "clk_ddr2_phy", &clk_ddr2_phy),
256 CLK(NULL, "clk_tpcc", &clk_tpcc),
257 CLK(NULL, "clk_tptc0", &clk_tptc0),
258 CLK(NULL, "clk_tptc1", &clk_tptc1),
259 CLK(NULL, "clk_ram", &clk_ram),
260 CLK(NULL, "clk_mbx_lite", &clk_mbx_lite),
261 CLK("tnetv107x-fb.0", NULL, &clk_lcd),
262 CLK(NULL, "clk_ethss", &clk_ethss),
263 CLK(NULL, "aemif", &clk_aemif),
264 CLK(NULL, "clk_chipcfg", &clk_chipcfg),
265 CLK("tnetv107x-ts.0", NULL, &clk_tsc),
266 CLK(NULL, "clk_rom", &clk_rom),
267 CLK("serial8250.2", NULL, &clk_uart2),
268 CLK(NULL, "clk_pktsec", &clk_pktsec),
269 CLK("tnetv107x-rng.0", NULL, &clk_rng),
270 CLK("tnetv107x-pka.0", NULL, &clk_pka),
271 CLK(NULL, "clk_secctl", &clk_secctl),
272 CLK(NULL, "clk_keymgr", &clk_keymgr),
273 CLK("tnetv107x-keypad.0", NULL, &clk_keypad),
274 CLK(NULL, "clk_gpio", &clk_gpio),
275 CLK(NULL, "clk_mdio", &clk_mdio),
276 CLK("dm6441-mmc.0", NULL, &clk_sdio0),
277 CLK("serial8250.0", NULL, &clk_uart0),
278 CLK("serial8250.1", NULL, &clk_uart1),
279 CLK(NULL, "timer0", &clk_timer0),
280 CLK(NULL, "timer1", &clk_timer1),
281 CLK("tnetv107x_wdt.0", NULL, &clk_wdt_arm),
282 CLK(NULL, "clk_wdt_dsp", &clk_wdt_dsp),
283 CLK("ti-ssp", NULL, &clk_ssp),
284 CLK(NULL, "clk_tdm0", &clk_tdm0),
285 CLK(NULL, "clk_vlynq", &clk_vlynq),
286 CLK(NULL, "clk_mcdma", &clk_mcdma),
287 CLK(NULL, "clk_usbss", &clk_usbss),
288 CLK(NULL, "clk_usb0", &clk_usb0),
289 CLK(NULL, "clk_usb1", &clk_usb1),
290 CLK(NULL, "clk_tdm1", &clk_tdm1),
291 CLK(NULL, "clk_debugss", &clk_debugss),
292 CLK(NULL, "clk_ethss_rgmii", &clk_ethss_rgmii),
293 CLK(NULL, "clk_system", &clk_system),
294 CLK(NULL, "clk_imcop", &clk_imcop),
295 CLK(NULL, "clk_spare", &clk_spare),
296 CLK("dm6441-mmc.1", NULL, &clk_sdio1),
297 CLK(NULL, "clk_ddr2_vrst", &clk_ddr2_vrst),
298 CLK(NULL, "clk_ddr2_vctl_rst", &clk_ddr2_vctl_rst),
299 CLK(NULL, NULL, NULL),
300};
301
302static const struct mux_config pins[] = {
303#ifdef CONFIG_DAVINCI_MUX
304 MUX_CFG(TNETV107X, ASR_A00, 0, 0, 0x1f, 0x00, false)
305 MUX_CFG(TNETV107X, GPIO32, 0, 0, 0x1f, 0x04, false)
306 MUX_CFG(TNETV107X, ASR_A01, 0, 5, 0x1f, 0x00, false)
307 MUX_CFG(TNETV107X, GPIO33, 0, 5, 0x1f, 0x04, false)
308 MUX_CFG(TNETV107X, ASR_A02, 0, 10, 0x1f, 0x00, false)
309 MUX_CFG(TNETV107X, GPIO34, 0, 10, 0x1f, 0x04, false)
310 MUX_CFG(TNETV107X, ASR_A03, 0, 15, 0x1f, 0x00, false)
311 MUX_CFG(TNETV107X, GPIO35, 0, 15, 0x1f, 0x04, false)
312 MUX_CFG(TNETV107X, ASR_A04, 0, 20, 0x1f, 0x00, false)
313 MUX_CFG(TNETV107X, GPIO36, 0, 20, 0x1f, 0x04, false)
314 MUX_CFG(TNETV107X, ASR_A05, 0, 25, 0x1f, 0x00, false)
315 MUX_CFG(TNETV107X, GPIO37, 0, 25, 0x1f, 0x04, false)
316 MUX_CFG(TNETV107X, ASR_A06, 1, 0, 0x1f, 0x00, false)
317 MUX_CFG(TNETV107X, GPIO38, 1, 0, 0x1f, 0x04, false)
318 MUX_CFG(TNETV107X, ASR_A07, 1, 5, 0x1f, 0x00, false)
319 MUX_CFG(TNETV107X, GPIO39, 1, 5, 0x1f, 0x04, false)
320 MUX_CFG(TNETV107X, ASR_A08, 1, 10, 0x1f, 0x00, false)
321 MUX_CFG(TNETV107X, GPIO40, 1, 10, 0x1f, 0x04, false)
322 MUX_CFG(TNETV107X, ASR_A09, 1, 15, 0x1f, 0x00, false)
323 MUX_CFG(TNETV107X, GPIO41, 1, 15, 0x1f, 0x04, false)
324 MUX_CFG(TNETV107X, ASR_A10, 1, 20, 0x1f, 0x00, false)
325 MUX_CFG(TNETV107X, GPIO42, 1, 20, 0x1f, 0x04, false)
326 MUX_CFG(TNETV107X, ASR_A11, 1, 25, 0x1f, 0x00, false)
327 MUX_CFG(TNETV107X, BOOT_STRP_0, 1, 25, 0x1f, 0x04, false)
328 MUX_CFG(TNETV107X, ASR_A12, 2, 0, 0x1f, 0x00, false)
329 MUX_CFG(TNETV107X, BOOT_STRP_1, 2, 0, 0x1f, 0x04, false)
330 MUX_CFG(TNETV107X, ASR_A13, 2, 5, 0x1f, 0x00, false)
331 MUX_CFG(TNETV107X, GPIO43, 2, 5, 0x1f, 0x04, false)
332 MUX_CFG(TNETV107X, ASR_A14, 2, 10, 0x1f, 0x00, false)
333 MUX_CFG(TNETV107X, GPIO44, 2, 10, 0x1f, 0x04, false)
334 MUX_CFG(TNETV107X, ASR_A15, 2, 15, 0x1f, 0x00, false)
335 MUX_CFG(TNETV107X, GPIO45, 2, 15, 0x1f, 0x04, false)
336 MUX_CFG(TNETV107X, ASR_A16, 2, 20, 0x1f, 0x00, false)
337 MUX_CFG(TNETV107X, GPIO46, 2, 20, 0x1f, 0x04, false)
338 MUX_CFG(TNETV107X, ASR_A17, 2, 25, 0x1f, 0x00, false)
339 MUX_CFG(TNETV107X, GPIO47, 2, 25, 0x1f, 0x04, false)
340 MUX_CFG(TNETV107X, ASR_A18, 3, 0, 0x1f, 0x00, false)
341 MUX_CFG(TNETV107X, GPIO48, 3, 0, 0x1f, 0x04, false)
342 MUX_CFG(TNETV107X, SDIO1_DATA3_0, 3, 0, 0x1f, 0x1c, false)
343 MUX_CFG(TNETV107X, ASR_A19, 3, 5, 0x1f, 0x00, false)
344 MUX_CFG(TNETV107X, GPIO49, 3, 5, 0x1f, 0x04, false)
345 MUX_CFG(TNETV107X, SDIO1_DATA2_0, 3, 5, 0x1f, 0x1c, false)
346 MUX_CFG(TNETV107X, ASR_A20, 3, 10, 0x1f, 0x00, false)
347 MUX_CFG(TNETV107X, GPIO50, 3, 10, 0x1f, 0x04, false)
348 MUX_CFG(TNETV107X, SDIO1_DATA1_0, 3, 10, 0x1f, 0x1c, false)
349 MUX_CFG(TNETV107X, ASR_A21, 3, 15, 0x1f, 0x00, false)
350 MUX_CFG(TNETV107X, GPIO51, 3, 15, 0x1f, 0x04, false)
351 MUX_CFG(TNETV107X, SDIO1_DATA0_0, 3, 15, 0x1f, 0x1c, false)
352 MUX_CFG(TNETV107X, ASR_A22, 3, 20, 0x1f, 0x00, false)
353 MUX_CFG(TNETV107X, GPIO52, 3, 20, 0x1f, 0x04, false)
354 MUX_CFG(TNETV107X, SDIO1_CMD_0, 3, 20, 0x1f, 0x1c, false)
355 MUX_CFG(TNETV107X, ASR_A23, 3, 25, 0x1f, 0x00, false)
356 MUX_CFG(TNETV107X, GPIO53, 3, 25, 0x1f, 0x04, false)
357 MUX_CFG(TNETV107X, SDIO1_CLK_0, 3, 25, 0x1f, 0x1c, false)
358 MUX_CFG(TNETV107X, ASR_BA_1, 4, 0, 0x1f, 0x00, false)
359 MUX_CFG(TNETV107X, GPIO54, 4, 0, 0x1f, 0x04, false)
360 MUX_CFG(TNETV107X, SYS_PLL_CLK, 4, 0, 0x1f, 0x1c, false)
361 MUX_CFG(TNETV107X, ASR_CS0, 4, 5, 0x1f, 0x00, false)
362 MUX_CFG(TNETV107X, ASR_CS1, 4, 10, 0x1f, 0x00, false)
363 MUX_CFG(TNETV107X, ASR_CS2, 4, 15, 0x1f, 0x00, false)
364 MUX_CFG(TNETV107X, TDM_PLL_CLK, 4, 15, 0x1f, 0x1c, false)
365 MUX_CFG(TNETV107X, ASR_CS3, 4, 20, 0x1f, 0x00, false)
366 MUX_CFG(TNETV107X, ETH_PHY_CLK, 4, 20, 0x1f, 0x0c, false)
367 MUX_CFG(TNETV107X, ASR_D00, 4, 25, 0x1f, 0x00, false)
368 MUX_CFG(TNETV107X, GPIO55, 4, 25, 0x1f, 0x1c, false)
369 MUX_CFG(TNETV107X, ASR_D01, 5, 0, 0x1f, 0x00, false)
370 MUX_CFG(TNETV107X, GPIO56, 5, 0, 0x1f, 0x1c, false)
371 MUX_CFG(TNETV107X, ASR_D02, 5, 5, 0x1f, 0x00, false)
372 MUX_CFG(TNETV107X, GPIO57, 5, 5, 0x1f, 0x1c, false)
373 MUX_CFG(TNETV107X, ASR_D03, 5, 10, 0x1f, 0x00, false)
374 MUX_CFG(TNETV107X, GPIO58, 5, 10, 0x1f, 0x1c, false)
375 MUX_CFG(TNETV107X, ASR_D04, 5, 15, 0x1f, 0x00, false)
376 MUX_CFG(TNETV107X, GPIO59_0, 5, 15, 0x1f, 0x1c, false)
377 MUX_CFG(TNETV107X, ASR_D05, 5, 20, 0x1f, 0x00, false)
378 MUX_CFG(TNETV107X, GPIO60_0, 5, 20, 0x1f, 0x1c, false)
379 MUX_CFG(TNETV107X, ASR_D06, 5, 25, 0x1f, 0x00, false)
380 MUX_CFG(TNETV107X, GPIO61_0, 5, 25, 0x1f, 0x1c, false)
381 MUX_CFG(TNETV107X, ASR_D07, 6, 0, 0x1f, 0x00, false)
382 MUX_CFG(TNETV107X, GPIO62_0, 6, 0, 0x1f, 0x1c, false)
383 MUX_CFG(TNETV107X, ASR_D08, 6, 5, 0x1f, 0x00, false)
384 MUX_CFG(TNETV107X, GPIO63_0, 6, 5, 0x1f, 0x1c, false)
385 MUX_CFG(TNETV107X, ASR_D09, 6, 10, 0x1f, 0x00, false)
386 MUX_CFG(TNETV107X, GPIO64_0, 6, 10, 0x1f, 0x1c, false)
387 MUX_CFG(TNETV107X, ASR_D10, 6, 15, 0x1f, 0x00, false)
388 MUX_CFG(TNETV107X, SDIO1_DATA3_1, 6, 15, 0x1f, 0x1c, false)
389 MUX_CFG(TNETV107X, ASR_D11, 6, 20, 0x1f, 0x00, false)
390 MUX_CFG(TNETV107X, SDIO1_DATA2_1, 6, 20, 0x1f, 0x1c, false)
391 MUX_CFG(TNETV107X, ASR_D12, 6, 25, 0x1f, 0x00, false)
392 MUX_CFG(TNETV107X, SDIO1_DATA1_1, 6, 25, 0x1f, 0x1c, false)
393 MUX_CFG(TNETV107X, ASR_D13, 7, 0, 0x1f, 0x00, false)
394 MUX_CFG(TNETV107X, SDIO1_DATA0_1, 7, 0, 0x1f, 0x1c, false)
395 MUX_CFG(TNETV107X, ASR_D14, 7, 5, 0x1f, 0x00, false)
396 MUX_CFG(TNETV107X, SDIO1_CMD_1, 7, 5, 0x1f, 0x1c, false)
397 MUX_CFG(TNETV107X, ASR_D15, 7, 10, 0x1f, 0x00, false)
398 MUX_CFG(TNETV107X, SDIO1_CLK_1, 7, 10, 0x1f, 0x1c, false)
399 MUX_CFG(TNETV107X, ASR_OE, 7, 15, 0x1f, 0x00, false)
400 MUX_CFG(TNETV107X, BOOT_STRP_2, 7, 15, 0x1f, 0x04, false)
401 MUX_CFG(TNETV107X, ASR_RNW, 7, 20, 0x1f, 0x00, false)
402 MUX_CFG(TNETV107X, GPIO29_0, 7, 20, 0x1f, 0x04, false)
403 MUX_CFG(TNETV107X, ASR_WAIT, 7, 25, 0x1f, 0x00, false)
404 MUX_CFG(TNETV107X, GPIO30_0, 7, 25, 0x1f, 0x04, false)
405 MUX_CFG(TNETV107X, ASR_WE, 8, 0, 0x1f, 0x00, false)
406 MUX_CFG(TNETV107X, BOOT_STRP_3, 8, 0, 0x1f, 0x04, false)
407 MUX_CFG(TNETV107X, ASR_WE_DQM0, 8, 5, 0x1f, 0x00, false)
408 MUX_CFG(TNETV107X, GPIO31, 8, 5, 0x1f, 0x04, false)
409 MUX_CFG(TNETV107X, LCD_PD17_0, 8, 5, 0x1f, 0x1c, false)
410 MUX_CFG(TNETV107X, ASR_WE_DQM1, 8, 10, 0x1f, 0x00, false)
411 MUX_CFG(TNETV107X, ASR_BA0_0, 8, 10, 0x1f, 0x04, false)
412 MUX_CFG(TNETV107X, VLYNQ_CLK, 9, 0, 0x1f, 0x00, false)
413 MUX_CFG(TNETV107X, GPIO14, 9, 0, 0x1f, 0x04, false)
414 MUX_CFG(TNETV107X, LCD_PD19_0, 9, 0, 0x1f, 0x1c, false)
415 MUX_CFG(TNETV107X, VLYNQ_RXD0, 9, 5, 0x1f, 0x00, false)
416 MUX_CFG(TNETV107X, GPIO15, 9, 5, 0x1f, 0x04, false)
417 MUX_CFG(TNETV107X, LCD_PD20_0, 9, 5, 0x1f, 0x1c, false)
418 MUX_CFG(TNETV107X, VLYNQ_RXD1, 9, 10, 0x1f, 0x00, false)
419 MUX_CFG(TNETV107X, GPIO16, 9, 10, 0x1f, 0x04, false)
420 MUX_CFG(TNETV107X, LCD_PD21_0, 9, 10, 0x1f, 0x1c, false)
421 MUX_CFG(TNETV107X, VLYNQ_TXD0, 9, 15, 0x1f, 0x00, false)
422 MUX_CFG(TNETV107X, GPIO17, 9, 15, 0x1f, 0x04, false)
423 MUX_CFG(TNETV107X, LCD_PD22_0, 9, 15, 0x1f, 0x1c, false)
424 MUX_CFG(TNETV107X, VLYNQ_TXD1, 9, 20, 0x1f, 0x00, false)
425 MUX_CFG(TNETV107X, GPIO18, 9, 20, 0x1f, 0x04, false)
426 MUX_CFG(TNETV107X, LCD_PD23_0, 9, 20, 0x1f, 0x1c, false)
427 MUX_CFG(TNETV107X, SDIO0_CLK, 10, 0, 0x1f, 0x00, false)
428 MUX_CFG(TNETV107X, GPIO19, 10, 0, 0x1f, 0x04, false)
429 MUX_CFG(TNETV107X, SDIO0_CMD, 10, 5, 0x1f, 0x00, false)
430 MUX_CFG(TNETV107X, GPIO20, 10, 5, 0x1f, 0x04, false)
431 MUX_CFG(TNETV107X, SDIO0_DATA0, 10, 10, 0x1f, 0x00, false)
432 MUX_CFG(TNETV107X, GPIO21, 10, 10, 0x1f, 0x04, false)
433 MUX_CFG(TNETV107X, SDIO0_DATA1, 10, 15, 0x1f, 0x00, false)
434 MUX_CFG(TNETV107X, GPIO22, 10, 15, 0x1f, 0x04, false)
435 MUX_CFG(TNETV107X, SDIO0_DATA2, 10, 20, 0x1f, 0x00, false)
436 MUX_CFG(TNETV107X, GPIO23, 10, 20, 0x1f, 0x04, false)
437 MUX_CFG(TNETV107X, SDIO0_DATA3, 10, 25, 0x1f, 0x00, false)
438 MUX_CFG(TNETV107X, GPIO24, 10, 25, 0x1f, 0x04, false)
439 MUX_CFG(TNETV107X, EMU0, 11, 0, 0x1f, 0x00, false)
440 MUX_CFG(TNETV107X, EMU1, 11, 5, 0x1f, 0x00, false)
441 MUX_CFG(TNETV107X, RTCK, 12, 0, 0x1f, 0x00, false)
442 MUX_CFG(TNETV107X, TRST_N, 12, 5, 0x1f, 0x00, false)
443 MUX_CFG(TNETV107X, TCK, 12, 10, 0x1f, 0x00, false)
444 MUX_CFG(TNETV107X, TDI, 12, 15, 0x1f, 0x00, false)
445 MUX_CFG(TNETV107X, TDO, 12, 20, 0x1f, 0x00, false)
446 MUX_CFG(TNETV107X, TMS, 12, 25, 0x1f, 0x00, false)
447 MUX_CFG(TNETV107X, TDM1_CLK, 13, 0, 0x1f, 0x00, false)
448 MUX_CFG(TNETV107X, TDM1_RX, 13, 5, 0x1f, 0x00, false)
449 MUX_CFG(TNETV107X, TDM1_TX, 13, 10, 0x1f, 0x00, false)
450 MUX_CFG(TNETV107X, TDM1_FS, 13, 15, 0x1f, 0x00, false)
451 MUX_CFG(TNETV107X, KEYPAD_R0, 14, 0, 0x1f, 0x00, false)
452 MUX_CFG(TNETV107X, KEYPAD_R1, 14, 5, 0x1f, 0x00, false)
453 MUX_CFG(TNETV107X, KEYPAD_R2, 14, 10, 0x1f, 0x00, false)
454 MUX_CFG(TNETV107X, KEYPAD_R3, 14, 15, 0x1f, 0x00, false)
455 MUX_CFG(TNETV107X, KEYPAD_R4, 14, 20, 0x1f, 0x00, false)
456 MUX_CFG(TNETV107X, KEYPAD_R5, 14, 25, 0x1f, 0x00, false)
457 MUX_CFG(TNETV107X, KEYPAD_R6, 15, 0, 0x1f, 0x00, false)
458 MUX_CFG(TNETV107X, GPIO12, 15, 0, 0x1f, 0x04, false)
459 MUX_CFG(TNETV107X, KEYPAD_R7, 15, 5, 0x1f, 0x00, false)
460 MUX_CFG(TNETV107X, GPIO10, 15, 5, 0x1f, 0x04, false)
461 MUX_CFG(TNETV107X, KEYPAD_C0, 15, 10, 0x1f, 0x00, false)
462 MUX_CFG(TNETV107X, KEYPAD_C1, 15, 15, 0x1f, 0x00, false)
463 MUX_CFG(TNETV107X, KEYPAD_C2, 15, 20, 0x1f, 0x00, false)
464 MUX_CFG(TNETV107X, KEYPAD_C3, 15, 25, 0x1f, 0x00, false)
465 MUX_CFG(TNETV107X, KEYPAD_C4, 16, 0, 0x1f, 0x00, false)
466 MUX_CFG(TNETV107X, KEYPAD_C5, 16, 5, 0x1f, 0x00, false)
467 MUX_CFG(TNETV107X, KEYPAD_C6, 16, 10, 0x1f, 0x00, false)
468 MUX_CFG(TNETV107X, GPIO13, 16, 10, 0x1f, 0x04, false)
469 MUX_CFG(TNETV107X, TEST_CLK_IN, 16, 10, 0x1f, 0x0c, false)
470 MUX_CFG(TNETV107X, KEYPAD_C7, 16, 15, 0x1f, 0x00, false)
471 MUX_CFG(TNETV107X, GPIO11, 16, 15, 0x1f, 0x04, false)
472 MUX_CFG(TNETV107X, SSP0_0, 17, 0, 0x1f, 0x00, false)
473 MUX_CFG(TNETV107X, SCC_DCLK, 17, 0, 0x1f, 0x04, false)
474 MUX_CFG(TNETV107X, LCD_PD20_1, 17, 0, 0x1f, 0x0c, false)
475 MUX_CFG(TNETV107X, SSP0_1, 17, 5, 0x1f, 0x00, false)
476 MUX_CFG(TNETV107X, SCC_CS_N, 17, 5, 0x1f, 0x04, false)
477 MUX_CFG(TNETV107X, LCD_PD21_1, 17, 5, 0x1f, 0x0c, false)
478 MUX_CFG(TNETV107X, SSP0_2, 17, 10, 0x1f, 0x00, false)
479 MUX_CFG(TNETV107X, SCC_D, 17, 10, 0x1f, 0x04, false)
480 MUX_CFG(TNETV107X, LCD_PD22_1, 17, 10, 0x1f, 0x0c, false)
481 MUX_CFG(TNETV107X, SSP0_3, 17, 15, 0x1f, 0x00, false)
482 MUX_CFG(TNETV107X, SCC_RESETN, 17, 15, 0x1f, 0x04, false)
483 MUX_CFG(TNETV107X, LCD_PD23_1, 17, 15, 0x1f, 0x0c, false)
484 MUX_CFG(TNETV107X, SSP1_0, 18, 0, 0x1f, 0x00, false)
485 MUX_CFG(TNETV107X, GPIO25, 18, 0, 0x1f, 0x04, false)
486 MUX_CFG(TNETV107X, UART2_CTS, 18, 0, 0x1f, 0x0c, false)
487 MUX_CFG(TNETV107X, SSP1_1, 18, 5, 0x1f, 0x00, false)
488 MUX_CFG(TNETV107X, GPIO26, 18, 5, 0x1f, 0x04, false)
489 MUX_CFG(TNETV107X, UART2_RD, 18, 5, 0x1f, 0x0c, false)
490 MUX_CFG(TNETV107X, SSP1_2, 18, 10, 0x1f, 0x00, false)
491 MUX_CFG(TNETV107X, GPIO27, 18, 10, 0x1f, 0x04, false)
492 MUX_CFG(TNETV107X, UART2_RTS, 18, 10, 0x1f, 0x0c, false)
493 MUX_CFG(TNETV107X, SSP1_3, 18, 15, 0x1f, 0x00, false)
494 MUX_CFG(TNETV107X, GPIO28, 18, 15, 0x1f, 0x04, false)
495 MUX_CFG(TNETV107X, UART2_TD, 18, 15, 0x1f, 0x0c, false)
496 MUX_CFG(TNETV107X, UART0_CTS, 19, 0, 0x1f, 0x00, false)
497 MUX_CFG(TNETV107X, UART0_RD, 19, 5, 0x1f, 0x00, false)
498 MUX_CFG(TNETV107X, UART0_RTS, 19, 10, 0x1f, 0x00, false)
499 MUX_CFG(TNETV107X, UART0_TD, 19, 15, 0x1f, 0x00, false)
500 MUX_CFG(TNETV107X, UART1_RD, 19, 20, 0x1f, 0x00, false)
501 MUX_CFG(TNETV107X, UART1_TD, 19, 25, 0x1f, 0x00, false)
502 MUX_CFG(TNETV107X, LCD_AC_NCS, 20, 0, 0x1f, 0x00, false)
503 MUX_CFG(TNETV107X, LCD_HSYNC_RNW, 20, 5, 0x1f, 0x00, false)
504 MUX_CFG(TNETV107X, LCD_VSYNC_A0, 20, 10, 0x1f, 0x00, false)
505 MUX_CFG(TNETV107X, LCD_MCLK, 20, 15, 0x1f, 0x00, false)
506 MUX_CFG(TNETV107X, LCD_PD16_0, 20, 15, 0x1f, 0x0c, false)
507 MUX_CFG(TNETV107X, LCD_PCLK_E, 20, 20, 0x1f, 0x00, false)
508 MUX_CFG(TNETV107X, LCD_PD00, 20, 25, 0x1f, 0x00, false)
509 MUX_CFG(TNETV107X, LCD_PD01, 21, 0, 0x1f, 0x00, false)
510 MUX_CFG(TNETV107X, LCD_PD02, 21, 5, 0x1f, 0x00, false)
511 MUX_CFG(TNETV107X, LCD_PD03, 21, 10, 0x1f, 0x00, false)
512 MUX_CFG(TNETV107X, LCD_PD04, 21, 15, 0x1f, 0x00, false)
513 MUX_CFG(TNETV107X, LCD_PD05, 21, 20, 0x1f, 0x00, false)
514 MUX_CFG(TNETV107X, LCD_PD06, 21, 25, 0x1f, 0x00, false)
515 MUX_CFG(TNETV107X, LCD_PD07, 22, 0, 0x1f, 0x00, false)
516 MUX_CFG(TNETV107X, LCD_PD08, 22, 5, 0x1f, 0x00, false)
517 MUX_CFG(TNETV107X, GPIO59_1, 22, 5, 0x1f, 0x0c, false)
518 MUX_CFG(TNETV107X, LCD_PD09, 22, 10, 0x1f, 0x00, false)
519 MUX_CFG(TNETV107X, GPIO60_1, 22, 10, 0x1f, 0x0c, false)
520 MUX_CFG(TNETV107X, LCD_PD10, 22, 15, 0x1f, 0x00, false)
521 MUX_CFG(TNETV107X, ASR_BA0_1, 22, 15, 0x1f, 0x04, false)
522 MUX_CFG(TNETV107X, GPIO61_1, 22, 15, 0x1f, 0x0c, false)
523 MUX_CFG(TNETV107X, LCD_PD11, 22, 20, 0x1f, 0x00, false)
524 MUX_CFG(TNETV107X, GPIO62_1, 22, 20, 0x1f, 0x0c, false)
525 MUX_CFG(TNETV107X, LCD_PD12, 22, 25, 0x1f, 0x00, false)
526 MUX_CFG(TNETV107X, GPIO63_1, 22, 25, 0x1f, 0x0c, false)
527 MUX_CFG(TNETV107X, LCD_PD13, 23, 0, 0x1f, 0x00, false)
528 MUX_CFG(TNETV107X, GPIO64_1, 23, 0, 0x1f, 0x0c, false)
529 MUX_CFG(TNETV107X, LCD_PD14, 23, 5, 0x1f, 0x00, false)
530 MUX_CFG(TNETV107X, GPIO29_1, 23, 5, 0x1f, 0x0c, false)
531 MUX_CFG(TNETV107X, LCD_PD15, 23, 10, 0x1f, 0x00, false)
532 MUX_CFG(TNETV107X, GPIO30_1, 23, 10, 0x1f, 0x0c, false)
533 MUX_CFG(TNETV107X, EINT0, 24, 0, 0x1f, 0x00, false)
534 MUX_CFG(TNETV107X, GPIO08, 24, 0, 0x1f, 0x04, false)
535 MUX_CFG(TNETV107X, EINT1, 24, 5, 0x1f, 0x00, false)
536 MUX_CFG(TNETV107X, GPIO09, 24, 5, 0x1f, 0x04, false)
537 MUX_CFG(TNETV107X, GPIO00, 24, 10, 0x1f, 0x00, false)
538 MUX_CFG(TNETV107X, LCD_PD20_2, 24, 10, 0x1f, 0x04, false)
539 MUX_CFG(TNETV107X, TDM_CLK_IN_2, 24, 10, 0x1f, 0x0c, false)
540 MUX_CFG(TNETV107X, GPIO01, 24, 15, 0x1f, 0x00, false)
541 MUX_CFG(TNETV107X, LCD_PD21_2, 24, 15, 0x1f, 0x04, false)
542 MUX_CFG(TNETV107X, 24M_CLK_OUT_1, 24, 15, 0x1f, 0x0c, false)
543 MUX_CFG(TNETV107X, GPIO02, 24, 20, 0x1f, 0x00, false)
544 MUX_CFG(TNETV107X, LCD_PD22_2, 24, 20, 0x1f, 0x04, false)
545 MUX_CFG(TNETV107X, GPIO03, 24, 25, 0x1f, 0x00, false)
546 MUX_CFG(TNETV107X, LCD_PD23_2, 24, 25, 0x1f, 0x04, false)
547 MUX_CFG(TNETV107X, GPIO04, 25, 0, 0x1f, 0x00, false)
548 MUX_CFG(TNETV107X, LCD_PD16_1, 25, 0, 0x1f, 0x04, false)
549 MUX_CFG(TNETV107X, USB0_RXERR, 25, 0, 0x1f, 0x0c, false)
550 MUX_CFG(TNETV107X, GPIO05, 25, 5, 0x1f, 0x00, false)
551 MUX_CFG(TNETV107X, LCD_PD17_1, 25, 5, 0x1f, 0x04, false)
552 MUX_CFG(TNETV107X, TDM_CLK_IN_1, 25, 5, 0x1f, 0x0c, false)
553 MUX_CFG(TNETV107X, GPIO06, 25, 10, 0x1f, 0x00, false)
554 MUX_CFG(TNETV107X, LCD_PD18, 25, 10, 0x1f, 0x04, false)
555 MUX_CFG(TNETV107X, 24M_CLK_OUT_2, 25, 10, 0x1f, 0x0c, false)
556 MUX_CFG(TNETV107X, GPIO07, 25, 15, 0x1f, 0x00, false)
557 MUX_CFG(TNETV107X, LCD_PD19_1, 25, 15, 0x1f, 0x04, false)
558 MUX_CFG(TNETV107X, USB1_RXERR, 25, 15, 0x1f, 0x0c, false)
559 MUX_CFG(TNETV107X, ETH_PLL_CLK, 25, 15, 0x1f, 0x1c, false)
560 MUX_CFG(TNETV107X, MDIO, 26, 0, 0x1f, 0x00, false)
561 MUX_CFG(TNETV107X, MDC, 26, 5, 0x1f, 0x00, false)
562 MUX_CFG(TNETV107X, AIC_MUTE_STAT_N, 26, 10, 0x1f, 0x00, false)
563 MUX_CFG(TNETV107X, TDM0_CLK, 26, 10, 0x1f, 0x04, false)
564 MUX_CFG(TNETV107X, AIC_HNS_EN_N, 26, 15, 0x1f, 0x00, false)
565 MUX_CFG(TNETV107X, TDM0_FS, 26, 15, 0x1f, 0x04, false)
566 MUX_CFG(TNETV107X, AIC_HDS_EN_STAT_N, 26, 20, 0x1f, 0x00, false)
567 MUX_CFG(TNETV107X, TDM0_TX, 26, 20, 0x1f, 0x04, false)
568 MUX_CFG(TNETV107X, AIC_HNF_EN_STAT_N, 26, 25, 0x1f, 0x00, false)
569 MUX_CFG(TNETV107X, TDM0_RX, 26, 25, 0x1f, 0x04, false)
570#endif
571};
572
573/* FIQ are pri 0-1; otherwise 2-7, with 7 lowest priority */
574static u8 irq_prios[TNETV107X_N_CP_INTC_IRQ] = {
575 /* fill in default priority 7 */
576 [0 ... (TNETV107X_N_CP_INTC_IRQ - 1)] = 7,
577 /* now override as needed, e.g. [xxx] = 5 */
578};
579
580/* Contents of JTAG ID register used to identify exact cpu type */
581static struct davinci_id ids[] = {
582 {
583 .variant = 0x0,
584 .part_no = 0xb8a1,
585 .manufacturer = 0x017,
586 .cpu_id = DAVINCI_CPU_ID_TNETV107X,
587 .name = "tnetv107x rev 1.0",
588 },
589 {
590 .variant = 0x1,
591 .part_no = 0xb8a1,
592 .manufacturer = 0x017,
593 .cpu_id = DAVINCI_CPU_ID_TNETV107X,
594 .name = "tnetv107x rev 1.1/1.2",
595 },
596};
597
598static struct davinci_timer_instance timer_instance[2] = {
599 {
600 .base = TNETV107X_TIMER0_BASE,
601 .bottom_irq = IRQ_TNETV107X_TIMER_0_TINT12,
602 .top_irq = IRQ_TNETV107X_TIMER_0_TINT34,
603 },
604 {
605 .base = TNETV107X_TIMER1_BASE,
606 .bottom_irq = IRQ_TNETV107X_TIMER_1_TINT12,
607 .top_irq = IRQ_TNETV107X_TIMER_1_TINT34,
608 },
609};
610
611static struct davinci_timer_info timer_info = {
612 .timers = timer_instance,
613 .clockevent_id = T0_BOT,
614 .clocksource_id = T0_TOP,
615};
616
617/*
618 * TNETV107X platforms do not use the static mappings from Davinci
619 * IO_PHYS/IO_VIRT. This SOC's interesting MMRs are at different addresses,
620 * and changing IO_PHYS would break away from existing Davinci SOCs.
621 *
622 * The primary impact of the current model is that IO_ADDRESS() is not to be
623 * used to map registers on TNETV107X.
624 *
625 * 1. The first chunk is for INTC: This needs to be mapped in via iotable
626 * because ioremap() does not seem to be operational at the time when
627 * irqs are initialized. Without this, consistent dma init bombs.
628 *
629 * 2. The second chunk maps in register areas that need to be populated into
630 * davinci_soc_info. Note that alignment restrictions come into play if
631 * low-level debug is enabled (see note in <mach/tnetv107x.h>).
632 */
633static struct map_desc io_desc[] = {
634 { /* INTC */
635 .virtual = IO_VIRT,
636 .pfn = __phys_to_pfn(TNETV107X_INTC_BASE),
637 .length = SZ_16K,
638 .type = MT_DEVICE
639 },
640 { /* Most of the rest */
641 .virtual = TNETV107X_IO_VIRT,
642 .pfn = __phys_to_pfn(TNETV107X_IO_BASE),
643 .length = IO_SIZE - SZ_1M,
644 .type = MT_DEVICE
645 },
646};
647
648static unsigned long clk_sspll_recalc(struct clk *clk)
649{
650 int pll;
651 unsigned long mult = 0, prediv = 1, postdiv = 1;
652 unsigned long ref = OSC_FREQ_ONCHIP, ret;
653 u32 tmp;
654
655 if (WARN_ON(!clk->pll_data))
656 return clk->rate;
657
658 if (!clk_ctrl_regs) {
659 void __iomem *tmp;
660
661 tmp = ioremap(TNETV107X_CLOCK_CONTROL_BASE, SZ_4K);
662
663 if (WARN(!tmp, "failed ioremap for clock control regs\n"))
664 return clk->parent ? clk->parent->rate : 0;
665
666 for (pll = 0; pll < N_PLLS; pll++)
667 sspll_regs[pll] = tmp + sspll_regs_base[pll];
668
669 clk_ctrl_regs = tmp;
670 }
671
672 pll = clk->pll_data->num;
673
674 tmp = __raw_readl(&clk_ctrl_regs->pll_bypass);
675 if (!(tmp & bypass_mask[pll])) {
676 mult = __raw_readl(&sspll_regs[pll]->mult_factor);
677 prediv = __raw_readl(&sspll_regs[pll]->pre_div) + 1;
678 postdiv = __raw_readl(&sspll_regs[pll]->post_div) + 1;
679 }
680
681 tmp = __raw_readl(clk->pll_data->base + PLLCTL);
682 if (tmp & PLLCTL_CLKMODE)
683 ref = pll_ext_freq[pll];
684
685 clk->pll_data->input_rate = ref;
686
687 tmp = __raw_readl(clk->pll_data->base + PLLCTL);
688 if (!(tmp & PLLCTL_PLLEN))
689 return ref;
690
691 ret = ref;
692 if (mult)
693 ret += ((unsigned long long)ref * mult) / 256;
694
695 ret /= (prediv * postdiv);
696
697 return ret;
698}
699
700static void tnetv107x_watchdog_reset(struct platform_device *pdev)
701{
702 struct wdt_regs __iomem *regs;
703
704 regs = ioremap(pdev->resource[0].start, SZ_4K);
705
706 /* disable watchdog */
707 __raw_writel(0x7777, &regs->disable_lock);
708 __raw_writel(0xcccc, &regs->disable_lock);
709 __raw_writel(0xdddd, &regs->disable_lock);
710 __raw_writel(0, &regs->disable);
711
712 /* program prescale */
713 __raw_writel(0x5a5a, &regs->prescale_lock);
714 __raw_writel(0xa5a5, &regs->prescale_lock);
715 __raw_writel(0, &regs->prescale);
716
717 /* program countdown */
718 __raw_writel(0x6666, &regs->change_lock);
719 __raw_writel(0xbbbb, &regs->change_lock);
720 __raw_writel(1, &regs->change);
721
722 /* enable watchdog */
723 __raw_writel(0x7777, &regs->disable_lock);
724 __raw_writel(0xcccc, &regs->disable_lock);
725 __raw_writel(0xdddd, &regs->disable_lock);
726 __raw_writel(1, &regs->disable);
727
728 /* kick */
729 __raw_writel(0x5555, &regs->kick_lock);
730 __raw_writel(0xaaaa, &regs->kick_lock);
731 __raw_writel(1, &regs->kick);
732}
733
734void tnetv107x_restart(enum reboot_mode mode, const char *cmd)
735{
736 tnetv107x_watchdog_reset(&tnetv107x_wdt_device);
737}
738
739static struct davinci_soc_info tnetv107x_soc_info = {
740 .io_desc = io_desc,
741 .io_desc_num = ARRAY_SIZE(io_desc),
742 .ids = ids,
743 .ids_num = ARRAY_SIZE(ids),
744 .jtag_id_reg = TNETV107X_CHIP_CFG_BASE + 0x018,
745 .cpu_clks = clks,
746 .psc_bases = psc_regs,
747 .psc_bases_num = ARRAY_SIZE(psc_regs),
748 .pinmux_base = TNETV107X_CHIP_CFG_BASE + 0x150,
749 .pinmux_pins = pins,
750 .pinmux_pins_num = ARRAY_SIZE(pins),
751 .intc_type = DAVINCI_INTC_TYPE_CP_INTC,
752 .intc_base = TNETV107X_INTC_BASE,
753 .intc_irq_prios = irq_prios,
754 .intc_irq_num = TNETV107X_N_CP_INTC_IRQ,
755 .intc_host_map = intc_host_map,
756 .gpio_base = TNETV107X_GPIO_BASE,
757 .gpio_type = GPIO_TYPE_TNETV107X,
758 .gpio_num = TNETV107X_N_GPIO,
759 .timer_info = &timer_info,
760 .serial_dev = tnetv107x_serial_device,
761};
762
763void __init tnetv107x_init(void)
764{
765 davinci_common_init(&tnetv107x_soc_info);
766}
diff --git a/arch/arm/mach-dove/Kconfig b/arch/arm/mach-dove/Kconfig
index 0bc7cdf8cf46..d8c439c89ea9 100644
--- a/arch/arm/mach-dove/Kconfig
+++ b/arch/arm/mach-dove/Kconfig
@@ -20,18 +20,6 @@ config MACH_CM_A510
20 Say 'Y' here if you want your kernel to support the 20 Say 'Y' here if you want your kernel to support the
21 CompuLab CM-A510 Board. 21 CompuLab CM-A510 Board.
22 22
23config MACH_DOVE_DT
24 bool "Marvell Dove Flattened Device Tree"
25 select DOVE_CLK
26 select ORION_IRQCHIP
27 select ORION_TIMER
28 select REGULATOR
29 select REGULATOR_FIXED_VOLTAGE
30 select USE_OF
31 help
32 Say 'Y' here if you want your kernel to support the
33 Marvell Dove using flattened device tree.
34
35endmenu 23endmenu
36 24
37endif 25endif
diff --git a/arch/arm/mach-dove/Makefile b/arch/arm/mach-dove/Makefile
index cbc5c0618788..b608a21919fb 100644
--- a/arch/arm/mach-dove/Makefile
+++ b/arch/arm/mach-dove/Makefile
@@ -2,5 +2,4 @@ obj-y += common.o
2obj-$(CONFIG_DOVE_LEGACY) += irq.o mpp.o 2obj-$(CONFIG_DOVE_LEGACY) += irq.o mpp.o
3obj-$(CONFIG_PCI) += pcie.o 3obj-$(CONFIG_PCI) += pcie.o
4obj-$(CONFIG_MACH_DOVE_DB) += dove-db-setup.o 4obj-$(CONFIG_MACH_DOVE_DB) += dove-db-setup.o
5obj-$(CONFIG_MACH_DOVE_DT) += board-dt.o
6obj-$(CONFIG_MACH_CM_A510) += cm-a510.o 5obj-$(CONFIG_MACH_CM_A510) += cm-a510.o
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index 41ffd433f709..5740296dc429 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -1,12 +1,15 @@
1config ARCH_MXC 1config ARCH_MXC
2 bool "Freescale i.MX family" if ARCH_MULTI_V4_V5 || ARCH_MULTI_V6_V7 2 bool "Freescale i.MX family" if ARCH_MULTI_V4_V5 || ARCH_MULTI_V6_V7
3 select ARCH_HAS_CPUFREQ
4 select ARCH_HAS_OPP
3 select ARCH_REQUIRE_GPIOLIB 5 select ARCH_REQUIRE_GPIOLIB
4 select ARM_CPU_SUSPEND if PM 6 select ARM_CPU_SUSPEND if PM
5 select CLKSRC_MMIO 7 select CLKSRC_MMIO
6 select GENERIC_ALLOCATOR
7 select GENERIC_IRQ_CHIP 8 select GENERIC_IRQ_CHIP
8 select PINCTRL 9 select PINCTRL
10 select PM_OPP if PM
9 select SOC_BUS 11 select SOC_BUS
12 select SRAM
10 help 13 help
11 Support for Freescale MXC/iMX-based family of processors 14 Support for Freescale MXC/iMX-based family of processors
12 15
@@ -116,8 +119,8 @@ config SOC_IMX35
116 select ARCH_MXC_IOMUX_V3 119 select ARCH_MXC_IOMUX_V3
117 select HAVE_EPIT 120 select HAVE_EPIT
118 select MXC_AVIC 121 select MXC_AVIC
122 select PINCTRL_IMX35
119 select SMP_ON_UP if SMP 123 select SMP_ON_UP if SMP
120 select PINCTRL
121 124
122config SOC_IMX5 125config SOC_IMX5
123 bool 126 bool
@@ -768,53 +771,43 @@ config SOC_IMX50
768config SOC_IMX53 771config SOC_IMX53
769 bool "i.MX53 support" 772 bool "i.MX53 support"
770 select HAVE_IMX_SRC 773 select HAVE_IMX_SRC
771 select IMX_HAVE_PLATFORM_IMX2_WDT
772 select PINCTRL_IMX53 774 select PINCTRL_IMX53
773 select SOC_IMX5 775 select SOC_IMX5
774 776
775 help 777 help
776 This enables support for Freescale i.MX53 processor. 778 This enables support for Freescale i.MX53 processor.
777 779
778config SOC_IMX6Q 780config SOC_IMX6
779 bool "i.MX6 Quad/DualLite support" 781 bool
780 select ARCH_HAS_CPUFREQ
781 select ARCH_HAS_OPP
782 select ARM_ERRATA_754322 782 select ARM_ERRATA_754322
783 select ARM_ERRATA_764369 if SMP
784 select ARM_ERRATA_775420 783 select ARM_ERRATA_775420
785 select ARM_GIC 784 select ARM_GIC
786 select HAVE_ARM_SCU if SMP
787 select HAVE_ARM_TWD if SMP
788 select HAVE_IMX_ANATOP 785 select HAVE_IMX_ANATOP
789 select HAVE_IMX_GPC 786 select HAVE_IMX_GPC
790 select HAVE_IMX_MMDC 787 select HAVE_IMX_MMDC
791 select HAVE_IMX_SRC 788 select HAVE_IMX_SRC
792 select MFD_SYSCON 789 select MFD_SYSCON
793 select MIGHT_HAVE_PCI
794 select PCI_DOMAINS if PCI
795 select PINCTRL_IMX6Q
796 select PL310_ERRATA_588369 if CACHE_PL310 790 select PL310_ERRATA_588369 if CACHE_PL310
797 select PL310_ERRATA_727915 if CACHE_PL310 791 select PL310_ERRATA_727915 if CACHE_PL310
798 select PL310_ERRATA_769419 if CACHE_PL310 792 select PL310_ERRATA_769419 if CACHE_PL310
799 select PM_OPP if PM 793
794config SOC_IMX6Q
795 bool "i.MX6 Quad/DualLite support"
796 select ARM_ERRATA_764369 if SMP
797 select HAVE_ARM_SCU if SMP
798 select HAVE_ARM_TWD if SMP
799 select MIGHT_HAVE_PCI
800 select PCI_DOMAINS if PCI
801 select PINCTRL_IMX6Q
802 select SOC_IMX6
800 803
801 help 804 help
802 This enables support for Freescale i.MX6 Quad processor. 805 This enables support for Freescale i.MX6 Quad processor.
803 806
804config SOC_IMX6SL 807config SOC_IMX6SL
805 bool "i.MX6 SoloLite support" 808 bool "i.MX6 SoloLite support"
806 select ARM_ERRATA_754322
807 select ARM_ERRATA_775420
808 select ARM_GIC
809 select HAVE_IMX_ANATOP
810 select HAVE_IMX_GPC
811 select HAVE_IMX_MMDC
812 select HAVE_IMX_SRC
813 select MFD_SYSCON
814 select PINCTRL_IMX6SL 809 select PINCTRL_IMX6SL
815 select PL310_ERRATA_588369 if CACHE_PL310 810 select SOC_IMX6
816 select PL310_ERRATA_727915 if CACHE_PL310
817 select PL310_ERRATA_769419 if CACHE_PL310
818 811
819 help 812 help
820 This enables support for Freescale i.MX6 SoloLite processor. 813 This enables support for Freescale i.MX6 SoloLite processor.
diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
index ec419649320f..f4ed83032dd0 100644
--- a/arch/arm/mach-imx/Makefile
+++ b/arch/arm/mach-imx/Makefile
@@ -30,6 +30,7 @@ obj-$(CONFIG_MXC_DEBUG_BOARD) += 3ds_debugboard.o
30ifeq ($(CONFIG_CPU_IDLE),y) 30ifeq ($(CONFIG_CPU_IDLE),y)
31obj-$(CONFIG_SOC_IMX5) += cpuidle-imx5.o 31obj-$(CONFIG_SOC_IMX5) += cpuidle-imx5.o
32obj-$(CONFIG_SOC_IMX6Q) += cpuidle-imx6q.o 32obj-$(CONFIG_SOC_IMX6Q) += cpuidle-imx6q.o
33obj-$(CONFIG_SOC_IMX6SL) += cpuidle-imx6sl.o
33endif 34endif
34 35
35ifdef CONFIG_SND_IMX_SOC 36ifdef CONFIG_SND_IMX_SOC
@@ -101,9 +102,11 @@ obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
101obj-$(CONFIG_SOC_IMX6Q) += clk-imx6q.o mach-imx6q.o 102obj-$(CONFIG_SOC_IMX6Q) += clk-imx6q.o mach-imx6q.o
102obj-$(CONFIG_SOC_IMX6SL) += clk-imx6sl.o mach-imx6sl.o 103obj-$(CONFIG_SOC_IMX6SL) += clk-imx6sl.o mach-imx6sl.o
103 104
104obj-$(CONFIG_SOC_IMX6Q) += pm-imx6q.o headsmp.o 105ifeq ($(CONFIG_SUSPEND),y)
105# i.MX6SL reuses i.MX6Q code 106AFLAGS_suspend-imx6.o :=-Wa,-march=armv7-a
106obj-$(CONFIG_SOC_IMX6SL) += pm-imx6q.o headsmp.o 107obj-$(CONFIG_SOC_IMX6) += suspend-imx6.o
108endif
109obj-$(CONFIG_SOC_IMX6) += pm-imx6.o
107 110
108# i.MX5 based machines 111# i.MX5 based machines
109obj-$(CONFIG_MACH_MX51_BABBAGE) += mach-mx51_babbage.o 112obj-$(CONFIG_MACH_MX51_BABBAGE) += mach-mx51_babbage.o
diff --git a/arch/arm/mach-imx/clk-imx21.c b/arch/arm/mach-imx/clk-imx21.c
index d7ed66091a2a..bdc2e4630a08 100644
--- a/arch/arm/mach-imx/clk-imx21.c
+++ b/arch/arm/mach-imx/clk-imx21.c
@@ -149,7 +149,6 @@ int __init mx21_clocks_init(unsigned long lref, unsigned long href)
149 clk_register_clkdev(clk[per1], "per", "imx-gpt.1"); 149 clk_register_clkdev(clk[per1], "per", "imx-gpt.1");
150 clk_register_clkdev(clk[gpt3_ipg_gate], "ipg", "imx-gpt.2"); 150 clk_register_clkdev(clk[gpt3_ipg_gate], "ipg", "imx-gpt.2");
151 clk_register_clkdev(clk[per1], "per", "imx-gpt.2"); 151 clk_register_clkdev(clk[per1], "per", "imx-gpt.2");
152 clk_register_clkdev(clk[pwm_ipg_gate], "pwm", "mxc_pwm.0");
153 clk_register_clkdev(clk[per2], "per", "imx21-cspi.0"); 152 clk_register_clkdev(clk[per2], "per", "imx21-cspi.0");
154 clk_register_clkdev(clk[cspi1_ipg_gate], "ipg", "imx21-cspi.0"); 153 clk_register_clkdev(clk[cspi1_ipg_gate], "ipg", "imx21-cspi.0");
155 clk_register_clkdev(clk[per2], "per", "imx21-cspi.1"); 154 clk_register_clkdev(clk[per2], "per", "imx21-cspi.1");
diff --git a/arch/arm/mach-imx/clk-imx25.c b/arch/arm/mach-imx/clk-imx25.c
index 69858c78f40d..dc36e6c2f1da 100644
--- a/arch/arm/mach-imx/clk-imx25.c
+++ b/arch/arm/mach-imx/clk-imx25.c
@@ -265,14 +265,6 @@ int __init mx25_clocks_init(void)
265 clk_register_clkdev(clk[cspi1_ipg], NULL, "imx35-cspi.0"); 265 clk_register_clkdev(clk[cspi1_ipg], NULL, "imx35-cspi.0");
266 clk_register_clkdev(clk[cspi2_ipg], NULL, "imx35-cspi.1"); 266 clk_register_clkdev(clk[cspi2_ipg], NULL, "imx35-cspi.1");
267 clk_register_clkdev(clk[cspi3_ipg], NULL, "imx35-cspi.2"); 267 clk_register_clkdev(clk[cspi3_ipg], NULL, "imx35-cspi.2");
268 clk_register_clkdev(clk[pwm1_ipg], "ipg", "mxc_pwm.0");
269 clk_register_clkdev(clk[per10], "per", "mxc_pwm.0");
270 clk_register_clkdev(clk[pwm1_ipg], "ipg", "mxc_pwm.1");
271 clk_register_clkdev(clk[per10], "per", "mxc_pwm.1");
272 clk_register_clkdev(clk[pwm1_ipg], "ipg", "mxc_pwm.2");
273 clk_register_clkdev(clk[per10], "per", "mxc_pwm.2");
274 clk_register_clkdev(clk[pwm1_ipg], "ipg", "mxc_pwm.3");
275 clk_register_clkdev(clk[per10], "per", "mxc_pwm.3");
276 clk_register_clkdev(clk[kpp_ipg], NULL, "imx-keypad"); 268 clk_register_clkdev(clk[kpp_ipg], NULL, "imx-keypad");
277 clk_register_clkdev(clk[tsc_ipg], NULL, "mx25-adc"); 269 clk_register_clkdev(clk[tsc_ipg], NULL, "mx25-adc");
278 clk_register_clkdev(clk[i2c_ipg_per], NULL, "imx21-i2c.0"); 270 clk_register_clkdev(clk[i2c_ipg_per], NULL, "imx21-i2c.0");
diff --git a/arch/arm/mach-imx/clk-imx27.c b/arch/arm/mach-imx/clk-imx27.c
index c6b40f386786..d2da8908b268 100644
--- a/arch/arm/mach-imx/clk-imx27.c
+++ b/arch/arm/mach-imx/clk-imx27.c
@@ -231,7 +231,6 @@ int __init mx27_clocks_init(unsigned long fref)
231 clk_register_clkdev(clk[per1_gate], "per", "imx-gpt.4"); 231 clk_register_clkdev(clk[per1_gate], "per", "imx-gpt.4");
232 clk_register_clkdev(clk[gpt6_ipg_gate], "ipg", "imx-gpt.5"); 232 clk_register_clkdev(clk[gpt6_ipg_gate], "ipg", "imx-gpt.5");
233 clk_register_clkdev(clk[per1_gate], "per", "imx-gpt.5"); 233 clk_register_clkdev(clk[per1_gate], "per", "imx-gpt.5");
234 clk_register_clkdev(clk[pwm_ipg_gate], NULL, "mxc_pwm.0");
235 clk_register_clkdev(clk[per2_gate], "per", "imx21-mmc.0"); 234 clk_register_clkdev(clk[per2_gate], "per", "imx21-mmc.0");
236 clk_register_clkdev(clk[sdhc1_ipg_gate], "ipg", "imx21-mmc.0"); 235 clk_register_clkdev(clk[sdhc1_ipg_gate], "ipg", "imx21-mmc.0");
237 clk_register_clkdev(clk[per2_gate], "per", "imx21-mmc.1"); 236 clk_register_clkdev(clk[per2_gate], "per", "imx21-mmc.1");
diff --git a/arch/arm/mach-imx/clk-imx51-imx53.c b/arch/arm/mach-imx/clk-imx51-imx53.c
index 19fca1fdc6fe..568ef0a4de84 100644
--- a/arch/arm/mach-imx/clk-imx51-imx53.c
+++ b/arch/arm/mach-imx/clk-imx51-imx53.c
@@ -266,8 +266,6 @@ static void __init mx5_clocks_common_init(unsigned long rate_ckil,
266 clk_register_clkdev(clk[IMX5_CLK_ECSPI2_PER_GATE], "per", "imx51-ecspi.1"); 266 clk_register_clkdev(clk[IMX5_CLK_ECSPI2_PER_GATE], "per", "imx51-ecspi.1");
267 clk_register_clkdev(clk[IMX5_CLK_ECSPI2_IPG_GATE], "ipg", "imx51-ecspi.1"); 267 clk_register_clkdev(clk[IMX5_CLK_ECSPI2_IPG_GATE], "ipg", "imx51-ecspi.1");
268 clk_register_clkdev(clk[IMX5_CLK_CSPI_IPG_GATE], NULL, "imx35-cspi.2"); 268 clk_register_clkdev(clk[IMX5_CLK_CSPI_IPG_GATE], NULL, "imx35-cspi.2");
269 clk_register_clkdev(clk[IMX5_CLK_PWM1_IPG_GATE], "pwm", "mxc_pwm.0");
270 clk_register_clkdev(clk[IMX5_CLK_PWM2_IPG_GATE], "pwm", "mxc_pwm.1");
271 clk_register_clkdev(clk[IMX5_CLK_I2C1_GATE], NULL, "imx21-i2c.0"); 269 clk_register_clkdev(clk[IMX5_CLK_I2C1_GATE], NULL, "imx21-i2c.0");
272 clk_register_clkdev(clk[IMX5_CLK_I2C2_GATE], NULL, "imx21-i2c.1"); 270 clk_register_clkdev(clk[IMX5_CLK_I2C2_GATE], NULL, "imx21-i2c.1");
273 clk_register_clkdev(clk[IMX5_CLK_USBOH3_PER_GATE], "per", "mxc-ehci.0"); 271 clk_register_clkdev(clk[IMX5_CLK_USBOH3_PER_GATE], "per", "mxc-ehci.0");
diff --git a/arch/arm/mach-imx/clk-imx6q.c b/arch/arm/mach-imx/clk-imx6q.c
index 4d677f442539..b0e7f9d2c245 100644
--- a/arch/arm/mach-imx/clk-imx6q.c
+++ b/arch/arm/mach-imx/clk-imx6q.c
@@ -437,12 +437,7 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node)
437 437
438 clk_register_clkdev(clk[gpt_ipg], "ipg", "imx-gpt.0"); 438 clk_register_clkdev(clk[gpt_ipg], "ipg", "imx-gpt.0");
439 clk_register_clkdev(clk[gpt_ipg_per], "per", "imx-gpt.0"); 439 clk_register_clkdev(clk[gpt_ipg_per], "per", "imx-gpt.0");
440 clk_register_clkdev(clk[cko1_sel], "cko1_sel", NULL); 440 clk_register_clkdev(clk[enet_ref], "enet_ref", NULL);
441 clk_register_clkdev(clk[ahb], "ahb", NULL);
442 clk_register_clkdev(clk[cko1], "cko1", NULL);
443 clk_register_clkdev(clk[arm], NULL, "cpu0");
444 clk_register_clkdev(clk[pll4_post_div], "pll4_post_div", NULL);
445 clk_register_clkdev(clk[pll4_audio], "pll4_audio", NULL);
446 441
447 if ((imx_get_soc_revision() != IMX_CHIP_REVISION_1_0) || 442 if ((imx_get_soc_revision() != IMX_CHIP_REVISION_1_0) ||
448 cpu_is_imx6dl()) { 443 cpu_is_imx6dl()) {
diff --git a/arch/arm/mach-imx/clk-imx6sl.c b/arch/arm/mach-imx/clk-imx6sl.c
index 4c86f3035205..f7073c0782fb 100644
--- a/arch/arm/mach-imx/clk-imx6sl.c
+++ b/arch/arm/mach-imx/clk-imx6sl.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright 2013 Freescale Semiconductor, Inc. 2 * Copyright 2013-2014 Freescale Semiconductor, Inc.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as 5 * it under the terms of the GNU General Public License version 2 as
@@ -18,27 +18,43 @@
18#include "clk.h" 18#include "clk.h"
19#include "common.h" 19#include "common.h"
20 20
21static const char const *step_sels[] = { "osc", "pll2_pfd2", }; 21#define CCSR 0xc
22static const char const *pll1_sw_sels[] = { "pll1_sys", "step", }; 22#define BM_CCSR_PLL1_SW_CLK_SEL (1 << 2)
23static const char const *ocram_alt_sels[] = { "pll2_pfd2", "pll3_pfd1", }; 23#define CACRR 0x10
24static const char const *ocram_sels[] = { "periph", "ocram_alt_sels", }; 24#define CDHIPR 0x48
25static const char const *pre_periph_sels[] = { "pll2_bus", "pll2_pfd2", "pll2_pfd0", "pll2_198m", }; 25#define BM_CDHIPR_ARM_PODF_BUSY (1 << 16)
26static const char const *periph_clk2_sels[] = { "pll3_usb_otg", "osc", "osc", "dummy", }; 26#define ARM_WAIT_DIV_396M 2
27static const char const *periph2_clk2_sels[] = { "pll3_usb_otg", "pll2_bus", }; 27#define ARM_WAIT_DIV_792M 4
28static const char const *periph_sels[] = { "pre_periph_sel", "periph_clk2_podf", }; 28#define ARM_WAIT_DIV_996M 6
29static const char const *periph2_sels[] = { "pre_periph2_sel", "periph2_clk2_podf", }; 29
30static const char const *csi_lcdif_sels[] = { "mmdc", "pll2_pfd2", "pll3_120m", "pll3_pfd1", }; 30#define PLL_ARM 0x0
31static const char const *usdhc_sels[] = { "pll2_pfd2", "pll2_pfd0", }; 31#define BM_PLL_ARM_DIV_SELECT (0x7f << 0)
32static const char const *ssi_sels[] = { "pll3_pfd2", "pll3_pfd3", "pll4_audio_div", "dummy", }; 32#define BM_PLL_ARM_POWERDOWN (1 << 12)
33static const char const *perclk_sels[] = { "ipg", "osc", }; 33#define BM_PLL_ARM_ENABLE (1 << 13)
34static const char const *epdc_pxp_sels[] = { "mmdc", "pll3_usb_otg", "pll5_video_div", "pll2_pfd0", "pll2_pfd2", "pll3_pfd1", }; 34#define BM_PLL_ARM_LOCK (1 << 31)
35static const char const *gpu2d_ovg_sels[] = { "pll3_pfd1", "pll3_usb_otg", "pll2_bus", "pll2_pfd2", }; 35#define PLL_ARM_DIV_792M 66
36static const char const *gpu2d_sels[] = { "pll2_pfd2", "pll3_usb_otg", "pll3_pfd1", "pll2_bus", }; 36
37static const char const *lcdif_pix_sels[] = { "pll2_bus", "pll3_usb_otg", "pll5_video_div", "pll2_pfd0", "pll3_pfd0", "pll3_pfd1", }; 37static const char *step_sels[] = { "osc", "pll2_pfd2", };
38static const char const *epdc_pix_sels[] = { "pll2_bus", "pll3_usb_otg", "pll5_video_div", "pll2_pfd0", "pll2_pfd1", "pll3_pfd1", }; 38static const char *pll1_sw_sels[] = { "pll1_sys", "step", };
39static const char const *audio_sels[] = { "pll4_audio_div", "pll3_pfd2", "pll3_pfd3", "pll3_usb_otg", }; 39static const char *ocram_alt_sels[] = { "pll2_pfd2", "pll3_pfd1", };
40static const char const *ecspi_sels[] = { "pll3_60m", "osc", }; 40static const char *ocram_sels[] = { "periph", "ocram_alt_sels", };
41static const char const *uart_sels[] = { "pll3_80m", "osc", }; 41static const char *pre_periph_sels[] = { "pll2_bus", "pll2_pfd2", "pll2_pfd0", "pll2_198m", };
42static const char *periph_clk2_sels[] = { "pll3_usb_otg", "osc", "osc", "dummy", };
43static const char *periph2_clk2_sels[] = { "pll3_usb_otg", "pll2_bus", };
44static const char *periph_sels[] = { "pre_periph_sel", "periph_clk2_podf", };
45static const char *periph2_sels[] = { "pre_periph2_sel", "periph2_clk2_podf", };
46static const char *csi_lcdif_sels[] = { "mmdc", "pll2_pfd2", "pll3_120m", "pll3_pfd1", };
47static const char *usdhc_sels[] = { "pll2_pfd2", "pll2_pfd0", };
48static const char *ssi_sels[] = { "pll3_pfd2", "pll3_pfd3", "pll4_audio_div", "dummy", };
49static const char *perclk_sels[] = { "ipg", "osc", };
50static const char *epdc_pxp_sels[] = { "mmdc", "pll3_usb_otg", "pll5_video_div", "pll2_pfd0", "pll2_pfd2", "pll3_pfd1", };
51static const char *gpu2d_ovg_sels[] = { "pll3_pfd1", "pll3_usb_otg", "pll2_bus", "pll2_pfd2", };
52static const char *gpu2d_sels[] = { "pll2_pfd2", "pll3_usb_otg", "pll3_pfd1", "pll2_bus", };
53static const char *lcdif_pix_sels[] = { "pll2_bus", "pll3_usb_otg", "pll5_video_div", "pll2_pfd0", "pll3_pfd0", "pll3_pfd1", };
54static const char *epdc_pix_sels[] = { "pll2_bus", "pll3_usb_otg", "pll5_video_div", "pll2_pfd0", "pll2_pfd1", "pll3_pfd1", };
55static const char *audio_sels[] = { "pll4_audio_div", "pll3_pfd2", "pll3_pfd3", "pll3_usb_otg", };
56static const char *ecspi_sels[] = { "pll3_60m", "osc", };
57static const char *uart_sels[] = { "pll3_80m", "osc", };
42 58
43static struct clk_div_table clk_enet_ref_table[] = { 59static struct clk_div_table clk_enet_ref_table[] = {
44 { .val = 0, .div = 20, }, 60 { .val = 0, .div = 20, },
@@ -65,6 +81,89 @@ static struct clk_div_table video_div_table[] = {
65 81
66static struct clk *clks[IMX6SL_CLK_END]; 82static struct clk *clks[IMX6SL_CLK_END];
67static struct clk_onecell_data clk_data; 83static struct clk_onecell_data clk_data;
84static void __iomem *ccm_base;
85static void __iomem *anatop_base;
86
87static const u32 clks_init_on[] __initconst = {
88 IMX6SL_CLK_IPG, IMX6SL_CLK_ARM, IMX6SL_CLK_MMDC_ROOT,
89};
90
91/*
92 * ERR005311 CCM: After exit from WAIT mode, unwanted interrupt(s) taken
93 * during WAIT mode entry process could cause cache memory
94 * corruption.
95 *
96 * Software workaround:
97 * To prevent this issue from occurring, software should ensure that the
98 * ARM to IPG clock ratio is less than 12:5 (that is < 2.4x), before
99 * entering WAIT mode.
100 *
101 * This function will set the ARM clk to max value within the 12:5 limit.
102 * As IPG clock is fixed at 66MHz(so ARM freq must not exceed 158.4MHz),
103 * ARM freq are one of below setpoints: 396MHz, 792MHz and 996MHz, since
104 * the clk APIs can NOT be called in idle thread(may cause kernel schedule
105 * as there is sleep function in PLL wait function), so here we just slow
106 * down ARM to below freq according to previous freq:
107 *
108 * run mode wait mode
109 * 396MHz -> 132MHz;
110 * 792MHz -> 158.4MHz;
111 * 996MHz -> 142.3MHz;
112 */
113static int imx6sl_get_arm_divider_for_wait(void)
114{
115 if (readl_relaxed(ccm_base + CCSR) & BM_CCSR_PLL1_SW_CLK_SEL) {
116 return ARM_WAIT_DIV_396M;
117 } else {
118 if ((readl_relaxed(anatop_base + PLL_ARM) &
119 BM_PLL_ARM_DIV_SELECT) == PLL_ARM_DIV_792M)
120 return ARM_WAIT_DIV_792M;
121 else
122 return ARM_WAIT_DIV_996M;
123 }
124}
125
126static void imx6sl_enable_pll_arm(bool enable)
127{
128 static u32 saved_pll_arm;
129 u32 val;
130
131 if (enable) {
132 saved_pll_arm = val = readl_relaxed(anatop_base + PLL_ARM);
133 val |= BM_PLL_ARM_ENABLE;
134 val &= ~BM_PLL_ARM_POWERDOWN;
135 writel_relaxed(val, anatop_base + PLL_ARM);
136 while (!(__raw_readl(anatop_base + PLL_ARM) & BM_PLL_ARM_LOCK))
137 ;
138 } else {
139 writel_relaxed(saved_pll_arm, anatop_base + PLL_ARM);
140 }
141}
142
143void imx6sl_set_wait_clk(bool enter)
144{
145 static unsigned long saved_arm_div;
146 int arm_div_for_wait = imx6sl_get_arm_divider_for_wait();
147
148 /*
149 * According to hardware design, arm podf change need
150 * PLL1 clock enabled.
151 */
152 if (arm_div_for_wait == ARM_WAIT_DIV_396M)
153 imx6sl_enable_pll_arm(true);
154
155 if (enter) {
156 saved_arm_div = readl_relaxed(ccm_base + CACRR);
157 writel_relaxed(arm_div_for_wait, ccm_base + CACRR);
158 } else {
159 writel_relaxed(saved_arm_div, ccm_base + CACRR);
160 }
161 while (__raw_readl(ccm_base + CDHIPR) & BM_CDHIPR_ARM_PODF_BUSY)
162 ;
163
164 if (arm_div_for_wait == ARM_WAIT_DIV_396M)
165 imx6sl_enable_pll_arm(false);
166}
68 167
69static void __init imx6sl_clocks_init(struct device_node *ccm_node) 168static void __init imx6sl_clocks_init(struct device_node *ccm_node)
70{ 169{
@@ -72,6 +171,7 @@ static void __init imx6sl_clocks_init(struct device_node *ccm_node)
72 void __iomem *base; 171 void __iomem *base;
73 int irq; 172 int irq;
74 int i; 173 int i;
174 int ret;
75 175
76 clks[IMX6SL_CLK_DUMMY] = imx_clk_fixed("dummy", 0); 176 clks[IMX6SL_CLK_DUMMY] = imx_clk_fixed("dummy", 0);
77 clks[IMX6SL_CLK_CKIL] = imx_obtain_fixed_clock("ckil", 0); 177 clks[IMX6SL_CLK_CKIL] = imx_obtain_fixed_clock("ckil", 0);
@@ -80,6 +180,7 @@ static void __init imx6sl_clocks_init(struct device_node *ccm_node)
80 np = of_find_compatible_node(NULL, NULL, "fsl,imx6sl-anatop"); 180 np = of_find_compatible_node(NULL, NULL, "fsl,imx6sl-anatop");
81 base = of_iomap(np, 0); 181 base = of_iomap(np, 0);
82 WARN_ON(!base); 182 WARN_ON(!base);
183 anatop_base = base;
83 184
84 /* type name parent base div_mask */ 185 /* type name parent base div_mask */
85 clks[IMX6SL_CLK_PLL1_SYS] = imx_clk_pllv3(IMX_PLLV3_SYS, "pll1_sys", "osc", base, 0x7f); 186 clks[IMX6SL_CLK_PLL1_SYS] = imx_clk_pllv3(IMX_PLLV3_SYS, "pll1_sys", "osc", base, 0x7f);
@@ -127,6 +228,7 @@ static void __init imx6sl_clocks_init(struct device_node *ccm_node)
127 np = ccm_node; 228 np = ccm_node;
128 base = of_iomap(np, 0); 229 base = of_iomap(np, 0);
129 WARN_ON(!base); 230 WARN_ON(!base);
231 ccm_base = base;
130 232
131 /* Reuse imx6q pm code */ 233 /* Reuse imx6q pm code */
132 imx6q_pm_set_ccm_base(base); 234 imx6q_pm_set_ccm_base(base);
@@ -258,6 +360,19 @@ static void __init imx6sl_clocks_init(struct device_node *ccm_node)
258 clk_register_clkdev(clks[IMX6SL_CLK_GPT], "ipg", "imx-gpt.0"); 360 clk_register_clkdev(clks[IMX6SL_CLK_GPT], "ipg", "imx-gpt.0");
259 clk_register_clkdev(clks[IMX6SL_CLK_GPT_SERIAL], "per", "imx-gpt.0"); 361 clk_register_clkdev(clks[IMX6SL_CLK_GPT_SERIAL], "per", "imx-gpt.0");
260 362
363 /* Ensure the AHB clk is at 132MHz. */
364 ret = clk_set_rate(clks[IMX6SL_CLK_AHB], 132000000);
365 if (ret)
366 pr_warn("%s: failed to set AHB clock rate %d!\n",
367 __func__, ret);
368
369 /*
370 * Make sure those always on clocks are enabled to maintain the correct
371 * usecount and enabling/disabling of parent PLLs.
372 */
373 for (i = 0; i < ARRAY_SIZE(clks_init_on); i++)
374 clk_prepare_enable(clks[clks_init_on[i]]);
375
261 if (IS_ENABLED(CONFIG_USB_MXS_PHY)) { 376 if (IS_ENABLED(CONFIG_USB_MXS_PHY)) {
262 clk_prepare_enable(clks[IMX6SL_CLK_USBPHY1_GATE]); 377 clk_prepare_enable(clks[IMX6SL_CLK_USBPHY1_GATE]);
263 clk_prepare_enable(clks[IMX6SL_CLK_USBPHY2_GATE]); 378 clk_prepare_enable(clks[IMX6SL_CLK_USBPHY2_GATE]);
diff --git a/arch/arm/mach-imx/clk-vf610.c b/arch/arm/mach-imx/clk-vf610.c
index ecd66d8e20b6..22dc3ee21fd4 100644
--- a/arch/arm/mach-imx/clk-vf610.c
+++ b/arch/arm/mach-imx/clk-vf610.c
@@ -63,25 +63,25 @@ static void __iomem *anatop_base;
63static void __iomem *ccm_base; 63static void __iomem *ccm_base;
64 64
65/* sources for multiplexer clocks, this is used multiple times */ 65/* sources for multiplexer clocks, this is used multiple times */
66static const char const *fast_sels[] = { "firc", "fxosc", }; 66static const char *fast_sels[] = { "firc", "fxosc", };
67static const char const *slow_sels[] = { "sirc_32k", "sxosc", }; 67static const char *slow_sels[] = { "sirc_32k", "sxosc", };
68static const char const *pll1_sels[] = { "pll1_main", "pll1_pfd1", "pll1_pfd2", "pll1_pfd3", "pll1_pfd4", }; 68static const char *pll1_sels[] = { "pll1_main", "pll1_pfd1", "pll1_pfd2", "pll1_pfd3", "pll1_pfd4", };
69static const char const *pll2_sels[] = { "pll2_main", "pll2_pfd1", "pll2_pfd2", "pll2_pfd3", "pll2_pfd4", }; 69static const char *pll2_sels[] = { "pll2_main", "pll2_pfd1", "pll2_pfd2", "pll2_pfd3", "pll2_pfd4", };
70static const char const *sys_sels[] = { "fast_clk_sel", "slow_clk_sel", "pll2_pfd_sel", "pll2_main", "pll1_pfd_sel", "pll3_main", }; 70static const char *sys_sels[] = { "fast_clk_sel", "slow_clk_sel", "pll2_pfd_sel", "pll2_main", "pll1_pfd_sel", "pll3_main", };
71static const char const *ddr_sels[] = { "pll2_pfd2", "sys_sel", }; 71static const char *ddr_sels[] = { "pll2_pfd2", "sys_sel", };
72static const char const *rmii_sels[] = { "enet_ext", "audio_ext", "enet_50m", "enet_25m", }; 72static const char *rmii_sels[] = { "enet_ext", "audio_ext", "enet_50m", "enet_25m", };
73static const char const *enet_ts_sels[] = { "enet_ext", "fxosc", "audio_ext", "usb", "enet_ts", "enet_25m", "enet_50m", }; 73static const char *enet_ts_sels[] = { "enet_ext", "fxosc", "audio_ext", "usb", "enet_ts", "enet_25m", "enet_50m", };
74static const char const *esai_sels[] = { "audio_ext", "mlb", "spdif_rx", "pll4_main_div", }; 74static const char *esai_sels[] = { "audio_ext", "mlb", "spdif_rx", "pll4_main_div", };
75static const char const *sai_sels[] = { "audio_ext", "mlb", "spdif_rx", "pll4_main_div", }; 75static const char *sai_sels[] = { "audio_ext", "mlb", "spdif_rx", "pll4_main_div", };
76static const char const *nfc_sels[] = { "platform_bus", "pll1_pfd1", "pll3_pfd1", "pll3_pfd3", }; 76static const char *nfc_sels[] = { "platform_bus", "pll1_pfd1", "pll3_pfd1", "pll3_pfd3", };
77static const char const *qspi_sels[] = { "pll3_main", "pll3_pfd4", "pll2_pfd4", "pll1_pfd4", }; 77static const char *qspi_sels[] = { "pll3_main", "pll3_pfd4", "pll2_pfd4", "pll1_pfd4", };
78static const char const *esdhc_sels[] = { "pll3_main", "pll3_pfd3", "pll1_pfd3", "platform_bus", }; 78static const char *esdhc_sels[] = { "pll3_main", "pll3_pfd3", "pll1_pfd3", "platform_bus", };
79static const char const *dcu_sels[] = { "pll1_pfd2", "pll3_main", }; 79static const char *dcu_sels[] = { "pll1_pfd2", "pll3_main", };
80static const char const *gpu_sels[] = { "pll2_pfd2", "pll3_pfd2", }; 80static const char *gpu_sels[] = { "pll2_pfd2", "pll3_pfd2", };
81static const char const *vadc_sels[] = { "pll6_main_div", "pll3_main_div", "pll3_main", }; 81static const char *vadc_sels[] = { "pll6_main_div", "pll3_main_div", "pll3_main", };
82/* FTM counter clock source, not module clock */ 82/* FTM counter clock source, not module clock */
83static const char const *ftm_ext_sels[] = {"sirc_128k", "sxosc", "fxosc_half", "audio_ext", }; 83static const char *ftm_ext_sels[] = {"sirc_128k", "sxosc", "fxosc_half", "audio_ext", };
84static const char const *ftm_fix_sels[] = { "sxosc", "ipg_bus", }; 84static const char *ftm_fix_sels[] = { "sxosc", "ipg_bus", };
85 85
86static struct clk_div_table pll4_main_div_table[] = { 86static struct clk_div_table pll4_main_div_table[] = {
87 { .val = 0, .div = 1 }, 87 { .val = 0, .div = 1 },
diff --git a/arch/arm/mach-imx/common.h b/arch/arm/mach-imx/common.h
index baf439dc22d8..b5241ea76706 100644
--- a/arch/arm/mach-imx/common.h
+++ b/arch/arm/mach-imx/common.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright 2004-2013 Freescale Semiconductor, Inc. All Rights Reserved. 2 * Copyright 2004-2014 Freescale Semiconductor, Inc. All Rights Reserved.
3 */ 3 */
4 4
5/* 5/*
@@ -116,7 +116,6 @@ void imx_enable_cpu(int cpu, bool enable);
116void imx_set_cpu_jump(int cpu, void *jump_addr); 116void imx_set_cpu_jump(int cpu, void *jump_addr);
117u32 imx_get_cpu_arg(int cpu); 117u32 imx_get_cpu_arg(int cpu);
118void imx_set_cpu_arg(int cpu, u32 arg); 118void imx_set_cpu_arg(int cpu, u32 arg);
119void v7_cpu_resume(void);
120#ifdef CONFIG_SMP 119#ifdef CONFIG_SMP
121void v7_secondary_startup(void); 120void v7_secondary_startup(void);
122void imx_scu_map_io(void); 121void imx_scu_map_io(void);
@@ -139,13 +138,25 @@ void imx_anatop_init(void);
139void imx_anatop_pre_suspend(void); 138void imx_anatop_pre_suspend(void);
140void imx_anatop_post_resume(void); 139void imx_anatop_post_resume(void);
141int imx6q_set_lpm(enum mxc_cpu_pwr_mode mode); 140int imx6q_set_lpm(enum mxc_cpu_pwr_mode mode);
142void imx6q_set_chicken_bit(void); 141void imx6q_set_int_mem_clk_lpm(void);
142void imx6sl_set_wait_clk(bool enter);
143 143
144void imx_cpu_die(unsigned int cpu); 144void imx_cpu_die(unsigned int cpu);
145int imx_cpu_kill(unsigned int cpu); 145int imx_cpu_kill(unsigned int cpu);
146 146
147#ifdef CONFIG_SUSPEND
148void v7_cpu_resume(void);
149void imx6_suspend(void __iomem *ocram_vbase);
150#else
151static inline void v7_cpu_resume(void) {}
152static inline void imx6_suspend(void __iomem *ocram_vbase) {}
153#endif
154
147void imx6q_pm_init(void); 155void imx6q_pm_init(void);
156void imx6dl_pm_init(void);
157void imx6sl_pm_init(void);
148void imx6q_pm_set_ccm_base(void __iomem *base); 158void imx6q_pm_set_ccm_base(void __iomem *base);
159
149#ifdef CONFIG_PM 160#ifdef CONFIG_PM
150void imx5_pm_init(void); 161void imx5_pm_init(void);
151#else 162#else
diff --git a/arch/arm/mach-imx/cpuidle-imx6q.c b/arch/arm/mach-imx/cpuidle-imx6q.c
index 23ddfb693b2d..6bcae0479049 100644
--- a/arch/arm/mach-imx/cpuidle-imx6q.c
+++ b/arch/arm/mach-imx/cpuidle-imx6q.c
@@ -68,8 +68,8 @@ int __init imx6q_cpuidle_init(void)
68 /* Need to enable SCU standby for entering WAIT modes */ 68 /* Need to enable SCU standby for entering WAIT modes */
69 imx_scu_standby_enable(); 69 imx_scu_standby_enable();
70 70
71 /* Set chicken bit to get a reliable WAIT mode support */ 71 /* Set INT_MEM_CLK_LPM bit to get a reliable WAIT mode support */
72 imx6q_set_chicken_bit(); 72 imx6q_set_int_mem_clk_lpm();
73 73
74 return cpuidle_register(&imx6q_cpuidle_driver, NULL); 74 return cpuidle_register(&imx6q_cpuidle_driver, NULL);
75} 75}
diff --git a/arch/arm/mach-imx/cpuidle-imx6sl.c b/arch/arm/mach-imx/cpuidle-imx6sl.c
new file mode 100644
index 000000000000..d4b6b8171fa9
--- /dev/null
+++ b/arch/arm/mach-imx/cpuidle-imx6sl.c
@@ -0,0 +1,57 @@
1/*
2 * Copyright (C) 2014 Freescale Semiconductor, Inc.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#include <linux/cpuidle.h>
10#include <linux/module.h>
11#include <asm/cpuidle.h>
12#include <asm/proc-fns.h>
13
14#include "common.h"
15#include "cpuidle.h"
16
17static int imx6sl_enter_wait(struct cpuidle_device *dev,
18 struct cpuidle_driver *drv, int index)
19{
20 imx6q_set_lpm(WAIT_UNCLOCKED);
21 /*
22 * Software workaround for ERR005311, see function
23 * description for details.
24 */
25 imx6sl_set_wait_clk(true);
26 cpu_do_idle();
27 imx6sl_set_wait_clk(false);
28 imx6q_set_lpm(WAIT_CLOCKED);
29
30 return index;
31}
32
33static struct cpuidle_driver imx6sl_cpuidle_driver = {
34 .name = "imx6sl_cpuidle",
35 .owner = THIS_MODULE,
36 .states = {
37 /* WFI */
38 ARM_CPUIDLE_WFI_STATE,
39 /* WAIT */
40 {
41 .exit_latency = 50,
42 .target_residency = 75,
43 .flags = CPUIDLE_FLAG_TIME_VALID |
44 CPUIDLE_FLAG_TIMER_STOP,
45 .enter = imx6sl_enter_wait,
46 .name = "WAIT",
47 .desc = "Clock off",
48 },
49 },
50 .state_count = 2,
51 .safe_state_index = 0,
52};
53
54int __init imx6sl_cpuidle_init(void)
55{
56 return cpuidle_register(&imx6sl_cpuidle_driver, NULL);
57}
diff --git a/arch/arm/mach-imx/cpuidle.h b/arch/arm/mach-imx/cpuidle.h
index 786f98ecc145..24e33670417c 100644
--- a/arch/arm/mach-imx/cpuidle.h
+++ b/arch/arm/mach-imx/cpuidle.h
@@ -13,6 +13,7 @@
13#ifdef CONFIG_CPU_IDLE 13#ifdef CONFIG_CPU_IDLE
14extern int imx5_cpuidle_init(void); 14extern int imx5_cpuidle_init(void);
15extern int imx6q_cpuidle_init(void); 15extern int imx6q_cpuidle_init(void);
16extern int imx6sl_cpuidle_init(void);
16#else 17#else
17static inline int imx5_cpuidle_init(void) 18static inline int imx5_cpuidle_init(void)
18{ 19{
@@ -22,4 +23,8 @@ static inline int imx6q_cpuidle_init(void)
22{ 23{
23 return 0; 24 return 0;
24} 25}
26static inline int imx6sl_cpuidle_init(void)
27{
28 return 0;
29}
25#endif 30#endif
diff --git a/arch/arm/mach-imx/devices-imx25.h b/arch/arm/mach-imx/devices-imx25.h
index 769563fdeaa0..61a114cddc39 100644
--- a/arch/arm/mach-imx/devices-imx25.h
+++ b/arch/arm/mach-imx/devices-imx25.h
@@ -83,7 +83,3 @@ extern const struct imx_spi_imx_data imx25_cspi_data[];
83#define imx25_add_spi_imx0(pdata) imx25_add_spi_imx(0, pdata) 83#define imx25_add_spi_imx0(pdata) imx25_add_spi_imx(0, pdata)
84#define imx25_add_spi_imx1(pdata) imx25_add_spi_imx(1, pdata) 84#define imx25_add_spi_imx1(pdata) imx25_add_spi_imx(1, pdata)
85#define imx25_add_spi_imx2(pdata) imx25_add_spi_imx(2, pdata) 85#define imx25_add_spi_imx2(pdata) imx25_add_spi_imx(2, pdata)
86
87extern struct imx_mxc_pwm_data imx25_mxc_pwm_data[];
88#define imx25_add_mxc_pwm(id) \
89 imx_add_mxc_pwm(&imx25_mxc_pwm_data[id])
diff --git a/arch/arm/mach-imx/devices-imx51.h b/arch/arm/mach-imx/devices-imx51.h
index deee5baee88c..26389f35a2b2 100644
--- a/arch/arm/mach-imx/devices-imx51.h
+++ b/arch/arm/mach-imx/devices-imx51.h
@@ -57,10 +57,6 @@ extern const struct imx_imx2_wdt_data imx51_imx2_wdt_data[];
57#define imx51_add_imx2_wdt(id) \ 57#define imx51_add_imx2_wdt(id) \
58 imx_add_imx2_wdt(&imx51_imx2_wdt_data[id]) 58 imx_add_imx2_wdt(&imx51_imx2_wdt_data[id])
59 59
60extern const struct imx_mxc_pwm_data imx51_mxc_pwm_data[];
61#define imx51_add_mxc_pwm(id) \
62 imx_add_mxc_pwm(&imx51_mxc_pwm_data[id])
63
64extern const struct imx_imx_keypad_data imx51_imx_keypad_data; 60extern const struct imx_imx_keypad_data imx51_imx_keypad_data;
65#define imx51_add_imx_keypad(pdata) \ 61#define imx51_add_imx_keypad(pdata) \
66 imx_add_imx_keypad(&imx51_imx_keypad_data, pdata) 62 imx_add_imx_keypad(&imx51_imx_keypad_data, pdata)
diff --git a/arch/arm/mach-imx/devices/Kconfig b/arch/arm/mach-imx/devices/Kconfig
index 68c74fb0373c..2d260a5a307c 100644
--- a/arch/arm/mach-imx/devices/Kconfig
+++ b/arch/arm/mach-imx/devices/Kconfig
@@ -67,9 +67,6 @@ config IMX_HAVE_PLATFORM_MXC_MMC
67config IMX_HAVE_PLATFORM_MXC_NAND 67config IMX_HAVE_PLATFORM_MXC_NAND
68 bool 68 bool
69 69
70config IMX_HAVE_PLATFORM_MXC_PWM
71 bool
72
73config IMX_HAVE_PLATFORM_MXC_RNGA 70config IMX_HAVE_PLATFORM_MXC_RNGA
74 bool 71 bool
75 select ARCH_HAS_RNGA 72 select ARCH_HAS_RNGA
diff --git a/arch/arm/mach-imx/devices/Makefile b/arch/arm/mach-imx/devices/Makefile
index 67416fb1dc69..1cbc14cd80d1 100644
--- a/arch/arm/mach-imx/devices/Makefile
+++ b/arch/arm/mach-imx/devices/Makefile
@@ -23,7 +23,6 @@ obj-$(CONFIG_IMX_HAVE_PLATFORM_MX2_CAMERA) += platform-mx2-camera.o
23obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_EHCI) += platform-mxc-ehci.o 23obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_EHCI) += platform-mxc-ehci.o
24obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_MMC) += platform-mxc-mmc.o 24obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_MMC) += platform-mxc-mmc.o
25obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_NAND) += platform-mxc_nand.o 25obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_NAND) += platform-mxc_nand.o
26obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_PWM) += platform-mxc_pwm.o
27obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_RNGA) += platform-mxc_rnga.o 26obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_RNGA) += platform-mxc_rnga.o
28obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_RTC) += platform-mxc_rtc.o 27obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_RTC) += platform-mxc_rtc.o
29obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_W1) += platform-mxc_w1.o 28obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_W1) += platform-mxc_w1.o
diff --git a/arch/arm/mach-imx/devices/devices-common.h b/arch/arm/mach-imx/devices/devices-common.h
index c13b76b9f6b3..61352a80bb59 100644
--- a/arch/arm/mach-imx/devices/devices-common.h
+++ b/arch/arm/mach-imx/devices/devices-common.h
@@ -290,15 +290,6 @@ struct imx_pata_imx_data {
290struct platform_device *__init imx_add_pata_imx( 290struct platform_device *__init imx_add_pata_imx(
291 const struct imx_pata_imx_data *data); 291 const struct imx_pata_imx_data *data);
292 292
293struct imx_mxc_pwm_data {
294 int id;
295 resource_size_t iobase;
296 resource_size_t iosize;
297 resource_size_t irq;
298};
299struct platform_device *__init imx_add_mxc_pwm(
300 const struct imx_mxc_pwm_data *data);
301
302/* mxc_rtc */ 293/* mxc_rtc */
303struct imx_mxc_rtc_data { 294struct imx_mxc_rtc_data {
304 const char *devid; 295 const char *devid;
diff --git a/arch/arm/mach-imx/devices/platform-mxc_pwm.c b/arch/arm/mach-imx/devices/platform-mxc_pwm.c
deleted file mode 100644
index dcd289777687..000000000000
--- a/arch/arm/mach-imx/devices/platform-mxc_pwm.c
+++ /dev/null
@@ -1,69 +0,0 @@
1/*
2 * Copyright (C) 2009-2010 Pengutronix
3 * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
4 *
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation.
8 */
9#include "../hardware.h"
10#include "devices-common.h"
11
12#define imx_mxc_pwm_data_entry_single(soc, _id, _hwid, _size) \
13 { \
14 .id = _id, \
15 .iobase = soc ## _PWM ## _hwid ## _BASE_ADDR, \
16 .iosize = _size, \
17 .irq = soc ## _INT_PWM ## _hwid, \
18 }
19#define imx_mxc_pwm_data_entry(soc, _id, _hwid, _size) \
20 [_id] = imx_mxc_pwm_data_entry_single(soc, _id, _hwid, _size)
21
22#ifdef CONFIG_SOC_IMX21
23const struct imx_mxc_pwm_data imx21_mxc_pwm_data __initconst =
24 imx_mxc_pwm_data_entry_single(MX21, 0, , SZ_4K);
25#endif /* ifdef CONFIG_SOC_IMX21 */
26
27#ifdef CONFIG_SOC_IMX25
28const struct imx_mxc_pwm_data imx25_mxc_pwm_data[] __initconst = {
29#define imx25_mxc_pwm_data_entry(_id, _hwid) \
30 imx_mxc_pwm_data_entry(MX25, _id, _hwid, SZ_16K)
31 imx25_mxc_pwm_data_entry(0, 1),
32 imx25_mxc_pwm_data_entry(1, 2),
33 imx25_mxc_pwm_data_entry(2, 3),
34 imx25_mxc_pwm_data_entry(3, 4),
35};
36#endif /* ifdef CONFIG_SOC_IMX25 */
37
38#ifdef CONFIG_SOC_IMX27
39const struct imx_mxc_pwm_data imx27_mxc_pwm_data __initconst =
40 imx_mxc_pwm_data_entry_single(MX27, 0, , SZ_4K);
41#endif /* ifdef CONFIG_SOC_IMX27 */
42
43#ifdef CONFIG_SOC_IMX51
44const struct imx_mxc_pwm_data imx51_mxc_pwm_data[] __initconst = {
45#define imx51_mxc_pwm_data_entry(_id, _hwid) \
46 imx_mxc_pwm_data_entry(MX51, _id, _hwid, SZ_16K)
47 imx51_mxc_pwm_data_entry(0, 1),
48 imx51_mxc_pwm_data_entry(1, 2),
49};
50#endif /* ifdef CONFIG_SOC_IMX51 */
51
52struct platform_device *__init imx_add_mxc_pwm(
53 const struct imx_mxc_pwm_data *data)
54{
55 struct resource res[] = {
56 {
57 .start = data->iobase,
58 .end = data->iobase + data->iosize - 1,
59 .flags = IORESOURCE_MEM,
60 }, {
61 .start = data->irq,
62 .end = data->irq,
63 .flags = IORESOURCE_IRQ,
64 },
65 };
66
67 return imx_add_platform_device("mxc_pwm", data->id,
68 res, ARRAY_SIZE(res), NULL, 0);
69}
diff --git a/arch/arm/mach-imx/hardware.h b/arch/arm/mach-imx/hardware.h
index a3b0b04b45c9..abf43bb47eca 100644
--- a/arch/arm/mach-imx/hardware.h
+++ b/arch/arm/mach-imx/hardware.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved. 2 * Copyright 2004-2007, 2014 Freescale Semiconductor, Inc. All Rights Reserved.
3 * Copyright 2008 Juergen Beisert, kernel@pengutronix.de 3 * Copyright 2008 Juergen Beisert, kernel@pengutronix.de
4 * 4 *
5 * This program is free software; you can redistribute it and/or 5 * This program is free software; you can redistribute it and/or
@@ -20,7 +20,9 @@
20#ifndef __ASM_ARCH_MXC_HARDWARE_H__ 20#ifndef __ASM_ARCH_MXC_HARDWARE_H__
21#define __ASM_ARCH_MXC_HARDWARE_H__ 21#define __ASM_ARCH_MXC_HARDWARE_H__
22 22
23#ifndef __ASSEMBLY__
23#include <asm/io.h> 24#include <asm/io.h>
25#endif
24#include <asm/sizes.h> 26#include <asm/sizes.h>
25 27
26#define addr_in_module(addr, mod) \ 28#define addr_in_module(addr, mod) \
diff --git a/arch/arm/mach-imx/headsmp.S b/arch/arm/mach-imx/headsmp.S
index 627f16f0e9d1..de5047c8a6c8 100644
--- a/arch/arm/mach-imx/headsmp.S
+++ b/arch/arm/mach-imx/headsmp.S
@@ -12,12 +12,7 @@
12 12
13#include <linux/linkage.h> 13#include <linux/linkage.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <asm/asm-offsets.h>
16#include <asm/hardware/cache-l2x0.h>
17 15
18 .section ".text.head", "ax"
19
20#ifdef CONFIG_SMP
21diag_reg_offset: 16diag_reg_offset:
22 .word g_diag_reg - . 17 .word g_diag_reg - .
23 18
@@ -34,38 +29,3 @@ ENTRY(v7_secondary_startup)
34 set_diag_reg 29 set_diag_reg
35 b secondary_startup 30 b secondary_startup
36ENDPROC(v7_secondary_startup) 31ENDPROC(v7_secondary_startup)
37#endif
38
39#ifdef CONFIG_ARM_CPU_SUSPEND
40/*
41 * The following code must assume it is running from physical address
42 * where absolute virtual addresses to the data section have to be
43 * turned into relative ones.
44 */
45
46#ifdef CONFIG_CACHE_L2X0
47 .macro pl310_resume
48 adr r0, l2x0_saved_regs_offset
49 ldr r2, [r0]
50 add r2, r2, r0
51 ldr r0, [r2, #L2X0_R_PHY_BASE] @ get physical base of l2x0
52 ldr r1, [r2, #L2X0_R_AUX_CTRL] @ get aux_ctrl value
53 str r1, [r0, #L2X0_AUX_CTRL] @ restore aux_ctrl
54 mov r1, #0x1
55 str r1, [r0, #L2X0_CTRL] @ re-enable L2
56 .endm
57
58l2x0_saved_regs_offset:
59 .word l2x0_saved_regs - .
60
61#else
62 .macro pl310_resume
63 .endm
64#endif
65
66ENTRY(v7_cpu_resume)
67 bl v7_invalidate_l1
68 pl310_resume
69 b cpu_resume
70ENDPROC(v7_cpu_resume)
71#endif
diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c
index 76e5db4fce35..e60456d85c9d 100644
--- a/arch/arm/mach-imx/mach-imx6q.c
+++ b/arch/arm/mach-imx/mach-imx6q.c
@@ -182,16 +182,83 @@ static void __init imx6q_enet_phy_init(void)
182 182
183static void __init imx6q_1588_init(void) 183static void __init imx6q_1588_init(void)
184{ 184{
185 struct device_node *np;
186 struct clk *ptp_clk;
187 struct clk *enet_ref;
185 struct regmap *gpr; 188 struct regmap *gpr;
189 u32 clksel;
186 190
191 np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-fec");
192 if (!np) {
193 pr_warn("%s: failed to find fec node\n", __func__);
194 return;
195 }
196
197 ptp_clk = of_clk_get(np, 2);
198 if (IS_ERR(ptp_clk)) {
199 pr_warn("%s: failed to get ptp clock\n", __func__);
200 goto put_node;
201 }
202
203 enet_ref = clk_get_sys(NULL, "enet_ref");
204 if (IS_ERR(enet_ref)) {
205 pr_warn("%s: failed to get enet clock\n", __func__);
206 goto put_ptp_clk;
207 }
208
209 /*
210 * If enet_ref from ANATOP/CCM is the PTP clock source, we need to
211 * set bit IOMUXC_GPR1[21]. Or the PTP clock must be from pad
212 * (external OSC), and we need to clear the bit.
213 */
214 clksel = ptp_clk == enet_ref ? IMX6Q_GPR1_ENET_CLK_SEL_ANATOP :
215 IMX6Q_GPR1_ENET_CLK_SEL_PAD;
187 gpr = syscon_regmap_lookup_by_compatible("fsl,imx6q-iomuxc-gpr"); 216 gpr = syscon_regmap_lookup_by_compatible("fsl,imx6q-iomuxc-gpr");
188 if (!IS_ERR(gpr)) 217 if (!IS_ERR(gpr))
189 regmap_update_bits(gpr, IOMUXC_GPR1, 218 regmap_update_bits(gpr, IOMUXC_GPR1,
190 IMX6Q_GPR1_ENET_CLK_SEL_MASK, 219 IMX6Q_GPR1_ENET_CLK_SEL_MASK,
191 IMX6Q_GPR1_ENET_CLK_SEL_ANATOP); 220 clksel);
192 else 221 else
193 pr_err("failed to find fsl,imx6q-iomux-gpr regmap\n"); 222 pr_err("failed to find fsl,imx6q-iomux-gpr regmap\n");
194 223
224 clk_put(enet_ref);
225put_ptp_clk:
226 clk_put(ptp_clk);
227put_node:
228 of_node_put(np);
229}
230
231static void __init imx6q_axi_init(void)
232{
233 struct regmap *gpr;
234 unsigned int mask;
235
236 gpr = syscon_regmap_lookup_by_compatible("fsl,imx6q-iomuxc-gpr");
237 if (!IS_ERR(gpr)) {
238 /*
239 * Enable the cacheable attribute of VPU and IPU
240 * AXI transactions.
241 */
242 mask = IMX6Q_GPR4_VPU_WR_CACHE_SEL |
243 IMX6Q_GPR4_VPU_RD_CACHE_SEL |
244 IMX6Q_GPR4_VPU_P_WR_CACHE_VAL |
245 IMX6Q_GPR4_VPU_P_RD_CACHE_VAL_MASK |
246 IMX6Q_GPR4_IPU_WR_CACHE_CTL |
247 IMX6Q_GPR4_IPU_RD_CACHE_CTL;
248 regmap_update_bits(gpr, IOMUXC_GPR4, mask, mask);
249
250 /* Increase IPU read QoS priority */
251 regmap_update_bits(gpr, IOMUXC_GPR6,
252 IMX6Q_GPR6_IPU1_ID00_RD_QOS_MASK |
253 IMX6Q_GPR6_IPU1_ID01_RD_QOS_MASK,
254 (0xf << 16) | (0x7 << 20));
255 regmap_update_bits(gpr, IOMUXC_GPR7,
256 IMX6Q_GPR7_IPU2_ID00_RD_QOS_MASK |
257 IMX6Q_GPR7_IPU2_ID01_RD_QOS_MASK,
258 (0xf << 16) | (0x7 << 20));
259 } else {
260 pr_warn("failed to find fsl,imx6q-iomuxc-gpr regmap\n");
261 }
195} 262}
196 263
197static void __init imx6q_init_machine(void) 264static void __init imx6q_init_machine(void)
@@ -212,15 +279,18 @@ static void __init imx6q_init_machine(void)
212 of_platform_populate(NULL, of_default_bus_match_table, NULL, parent); 279 of_platform_populate(NULL, of_default_bus_match_table, NULL, parent);
213 280
214 imx_anatop_init(); 281 imx_anatop_init();
215 imx6q_pm_init(); 282 cpu_is_imx6q() ? imx6q_pm_init() : imx6dl_pm_init();
216 imx6q_1588_init(); 283 imx6q_1588_init();
284 imx6q_axi_init();
217} 285}
218 286
219#define OCOTP_CFG3 0x440 287#define OCOTP_CFG3 0x440
220#define OCOTP_CFG3_SPEED_SHIFT 16 288#define OCOTP_CFG3_SPEED_SHIFT 16
221#define OCOTP_CFG3_SPEED_1P2GHZ 0x3 289#define OCOTP_CFG3_SPEED_1P2GHZ 0x3
290#define OCOTP_CFG3_SPEED_996MHZ 0x2
291#define OCOTP_CFG3_SPEED_852MHZ 0x1
222 292
223static void __init imx6q_opp_check_1p2ghz(struct device *cpu_dev) 293static void __init imx6q_opp_check_speed_grading(struct device *cpu_dev)
224{ 294{
225 struct device_node *np; 295 struct device_node *np;
226 void __iomem *base; 296 void __iomem *base;
@@ -238,11 +308,29 @@ static void __init imx6q_opp_check_1p2ghz(struct device *cpu_dev)
238 goto put_node; 308 goto put_node;
239 } 309 }
240 310
311 /*
312 * SPEED_GRADING[1:0] defines the max speed of ARM:
313 * 2b'11: 1200000000Hz;
314 * 2b'10: 996000000Hz;
315 * 2b'01: 852000000Hz; -- i.MX6Q Only, exclusive with 996MHz.
316 * 2b'00: 792000000Hz;
317 * We need to set the max speed of ARM according to fuse map.
318 */
241 val = readl_relaxed(base + OCOTP_CFG3); 319 val = readl_relaxed(base + OCOTP_CFG3);
242 val >>= OCOTP_CFG3_SPEED_SHIFT; 320 val >>= OCOTP_CFG3_SPEED_SHIFT;
243 if ((val & 0x3) != OCOTP_CFG3_SPEED_1P2GHZ) 321 val &= 0x3;
322
323 if (val != OCOTP_CFG3_SPEED_1P2GHZ)
244 if (dev_pm_opp_disable(cpu_dev, 1200000000)) 324 if (dev_pm_opp_disable(cpu_dev, 1200000000))
245 pr_warn("failed to disable 1.2 GHz OPP\n"); 325 pr_warn("failed to disable 1.2 GHz OPP\n");
326 if (val < OCOTP_CFG3_SPEED_996MHZ)
327 if (dev_pm_opp_disable(cpu_dev, 996000000))
328 pr_warn("failed to disable 996 MHz OPP\n");
329 if (cpu_is_imx6q()) {
330 if (val != OCOTP_CFG3_SPEED_852MHZ)
331 if (dev_pm_opp_disable(cpu_dev, 852000000))
332 pr_warn("failed to disable 852 MHz OPP\n");
333 }
246 334
247put_node: 335put_node:
248 of_node_put(np); 336 of_node_put(np);
@@ -268,7 +356,7 @@ static void __init imx6q_opp_init(void)
268 goto put_node; 356 goto put_node;
269 } 357 }
270 358
271 imx6q_opp_check_1p2ghz(cpu_dev); 359 imx6q_opp_check_speed_grading(cpu_dev);
272 360
273put_node: 361put_node:
274 of_node_put(np); 362 of_node_put(np);
diff --git a/arch/arm/mach-imx/mach-imx6sl.c b/arch/arm/mach-imx/mach-imx6sl.c
index 0f4fd4c0ab8e..ad323385115c 100644
--- a/arch/arm/mach-imx/mach-imx6sl.c
+++ b/arch/arm/mach-imx/mach-imx6sl.c
@@ -17,6 +17,7 @@
17#include <asm/mach/map.h> 17#include <asm/mach/map.h>
18 18
19#include "common.h" 19#include "common.h"
20#include "cpuidle.h"
20 21
21static void __init imx6sl_fec_init(void) 22static void __init imx6sl_fec_init(void)
22{ 23{
@@ -39,6 +40,8 @@ static void __init imx6sl_init_late(void)
39 /* imx6sl reuses imx6q cpufreq driver */ 40 /* imx6sl reuses imx6q cpufreq driver */
40 if (IS_ENABLED(CONFIG_ARM_IMX6Q_CPUFREQ)) 41 if (IS_ENABLED(CONFIG_ARM_IMX6Q_CPUFREQ))
41 platform_device_register_simple("imx6q-cpufreq", -1, NULL, 0); 42 platform_device_register_simple("imx6q-cpufreq", -1, NULL, 0);
43
44 imx6sl_cpuidle_init();
42} 45}
43 46
44static void __init imx6sl_init_machine(void) 47static void __init imx6sl_init_machine(void)
@@ -55,8 +58,7 @@ static void __init imx6sl_init_machine(void)
55 58
56 imx6sl_fec_init(); 59 imx6sl_fec_init();
57 imx_anatop_init(); 60 imx_anatop_init();
58 /* Reuse imx6q pm code */ 61 imx6sl_pm_init();
59 imx6q_pm_init();
60} 62}
61 63
62static void __init imx6sl_init_irq(void) 64static void __init imx6sl_init_irq(void)
diff --git a/arch/arm/mach-imx/pm-imx6.c b/arch/arm/mach-imx/pm-imx6.c
new file mode 100644
index 000000000000..9392a8f4ef24
--- /dev/null
+++ b/arch/arm/mach-imx/pm-imx6.c
@@ -0,0 +1,551 @@
1/*
2 * Copyright 2011-2014 Freescale Semiconductor, Inc.
3 * Copyright 2011 Linaro Ltd.
4 *
5 * The code contained herein is licensed under the GNU General Public
6 * License. You may obtain a copy of the GNU General Public License
7 * Version 2 or later at the following locations:
8 *
9 * http://www.opensource.org/licenses/gpl-license.html
10 * http://www.gnu.org/copyleft/gpl.html
11 */
12
13#include <linux/delay.h>
14#include <linux/init.h>
15#include <linux/io.h>
16#include <linux/irq.h>
17#include <linux/genalloc.h>
18#include <linux/mfd/syscon.h>
19#include <linux/mfd/syscon/imx6q-iomuxc-gpr.h>
20#include <linux/of.h>
21#include <linux/of_address.h>
22#include <linux/of_platform.h>
23#include <linux/regmap.h>
24#include <linux/suspend.h>
25#include <asm/cacheflush.h>
26#include <asm/fncpy.h>
27#include <asm/proc-fns.h>
28#include <asm/suspend.h>
29#include <asm/tlb.h>
30
31#include "common.h"
32#include "hardware.h"
33
34#define CCR 0x0
35#define BM_CCR_WB_COUNT (0x7 << 16)
36#define BM_CCR_RBC_BYPASS_COUNT (0x3f << 21)
37#define BM_CCR_RBC_EN (0x1 << 27)
38
39#define CLPCR 0x54
40#define BP_CLPCR_LPM 0
41#define BM_CLPCR_LPM (0x3 << 0)
42#define BM_CLPCR_BYPASS_PMIC_READY (0x1 << 2)
43#define BM_CLPCR_ARM_CLK_DIS_ON_LPM (0x1 << 5)
44#define BM_CLPCR_SBYOS (0x1 << 6)
45#define BM_CLPCR_DIS_REF_OSC (0x1 << 7)
46#define BM_CLPCR_VSTBY (0x1 << 8)
47#define BP_CLPCR_STBY_COUNT 9
48#define BM_CLPCR_STBY_COUNT (0x3 << 9)
49#define BM_CLPCR_COSC_PWRDOWN (0x1 << 11)
50#define BM_CLPCR_WB_PER_AT_LPM (0x1 << 16)
51#define BM_CLPCR_WB_CORE_AT_LPM (0x1 << 17)
52#define BM_CLPCR_BYP_MMDC_CH0_LPM_HS (0x1 << 19)
53#define BM_CLPCR_BYP_MMDC_CH1_LPM_HS (0x1 << 21)
54#define BM_CLPCR_MASK_CORE0_WFI (0x1 << 22)
55#define BM_CLPCR_MASK_CORE1_WFI (0x1 << 23)
56#define BM_CLPCR_MASK_CORE2_WFI (0x1 << 24)
57#define BM_CLPCR_MASK_CORE3_WFI (0x1 << 25)
58#define BM_CLPCR_MASK_SCU_IDLE (0x1 << 26)
59#define BM_CLPCR_MASK_L2CC_IDLE (0x1 << 27)
60
61#define CGPR 0x64
62#define BM_CGPR_INT_MEM_CLK_LPM (0x1 << 17)
63
64#define MX6Q_SUSPEND_OCRAM_SIZE 0x1000
65#define MX6_MAX_MMDC_IO_NUM 33
66
67static void __iomem *ccm_base;
68static void __iomem *suspend_ocram_base;
69static void (*imx6_suspend_in_ocram_fn)(void __iomem *ocram_vbase);
70
71/*
72 * suspend ocram space layout:
73 * ======================== high address ======================
74 * .
75 * .
76 * .
77 * ^
78 * ^
79 * ^
80 * imx6_suspend code
81 * PM_INFO structure(imx6_cpu_pm_info)
82 * ======================== low address =======================
83 */
84
85struct imx6_pm_base {
86 phys_addr_t pbase;
87 void __iomem *vbase;
88};
89
90struct imx6_pm_socdata {
91 u32 cpu_type;
92 const char *mmdc_compat;
93 const char *src_compat;
94 const char *iomuxc_compat;
95 const char *gpc_compat;
96 const u32 mmdc_io_num;
97 const u32 *mmdc_io_offset;
98};
99
100static const u32 imx6q_mmdc_io_offset[] __initconst = {
101 0x5ac, 0x5b4, 0x528, 0x520, /* DQM0 ~ DQM3 */
102 0x514, 0x510, 0x5bc, 0x5c4, /* DQM4 ~ DQM7 */
103 0x56c, 0x578, 0x588, 0x594, /* CAS, RAS, SDCLK_0, SDCLK_1 */
104 0x5a8, 0x5b0, 0x524, 0x51c, /* SDQS0 ~ SDQS3 */
105 0x518, 0x50c, 0x5b8, 0x5c0, /* SDQS4 ~ SDQS7 */
106 0x784, 0x788, 0x794, 0x79c, /* GPR_B0DS ~ GPR_B3DS */
107 0x7a0, 0x7a4, 0x7a8, 0x748, /* GPR_B4DS ~ GPR_B7DS */
108 0x59c, 0x5a0, 0x750, 0x774, /* SODT0, SODT1, MODE_CTL, MODE */
109 0x74c, /* GPR_ADDS */
110};
111
112static const u32 imx6dl_mmdc_io_offset[] __initconst = {
113 0x470, 0x474, 0x478, 0x47c, /* DQM0 ~ DQM3 */
114 0x480, 0x484, 0x488, 0x48c, /* DQM4 ~ DQM7 */
115 0x464, 0x490, 0x4ac, 0x4b0, /* CAS, RAS, SDCLK_0, SDCLK_1 */
116 0x4bc, 0x4c0, 0x4c4, 0x4c8, /* DRAM_SDQS0 ~ DRAM_SDQS3 */
117 0x4cc, 0x4d0, 0x4d4, 0x4d8, /* DRAM_SDQS4 ~ DRAM_SDQS7 */
118 0x764, 0x770, 0x778, 0x77c, /* GPR_B0DS ~ GPR_B3DS */
119 0x780, 0x784, 0x78c, 0x748, /* GPR_B4DS ~ GPR_B7DS */
120 0x4b4, 0x4b8, 0x750, 0x760, /* SODT0, SODT1, MODE_CTL, MODE */
121 0x74c, /* GPR_ADDS */
122};
123
124static const u32 imx6sl_mmdc_io_offset[] __initconst = {
125 0x30c, 0x310, 0x314, 0x318, /* DQM0 ~ DQM3 */
126 0x5c4, 0x5cc, 0x5d4, 0x5d8, /* GPR_B0DS ~ GPR_B3DS */
127 0x300, 0x31c, 0x338, 0x5ac, /* CAS, RAS, SDCLK_0, GPR_ADDS */
128 0x33c, 0x340, 0x5b0, 0x5c0, /* SODT0, SODT1, MODE_CTL, MODE */
129 0x330, 0x334, 0x320, /* SDCKE0, SDCKE1, RESET */
130};
131
132static const struct imx6_pm_socdata imx6q_pm_data __initconst = {
133 .cpu_type = MXC_CPU_IMX6Q,
134 .mmdc_compat = "fsl,imx6q-mmdc",
135 .src_compat = "fsl,imx6q-src",
136 .iomuxc_compat = "fsl,imx6q-iomuxc",
137 .gpc_compat = "fsl,imx6q-gpc",
138 .mmdc_io_num = ARRAY_SIZE(imx6q_mmdc_io_offset),
139 .mmdc_io_offset = imx6q_mmdc_io_offset,
140};
141
142static const struct imx6_pm_socdata imx6dl_pm_data __initconst = {
143 .cpu_type = MXC_CPU_IMX6DL,
144 .mmdc_compat = "fsl,imx6q-mmdc",
145 .src_compat = "fsl,imx6q-src",
146 .iomuxc_compat = "fsl,imx6dl-iomuxc",
147 .gpc_compat = "fsl,imx6q-gpc",
148 .mmdc_io_num = ARRAY_SIZE(imx6dl_mmdc_io_offset),
149 .mmdc_io_offset = imx6dl_mmdc_io_offset,
150};
151
152static const struct imx6_pm_socdata imx6sl_pm_data __initconst = {
153 .cpu_type = MXC_CPU_IMX6SL,
154 .mmdc_compat = "fsl,imx6sl-mmdc",
155 .src_compat = "fsl,imx6sl-src",
156 .iomuxc_compat = "fsl,imx6sl-iomuxc",
157 .gpc_compat = "fsl,imx6sl-gpc",
158 .mmdc_io_num = ARRAY_SIZE(imx6sl_mmdc_io_offset),
159 .mmdc_io_offset = imx6sl_mmdc_io_offset,
160};
161
162/*
163 * This structure is for passing necessary data for low level ocram
164 * suspend code(arch/arm/mach-imx/suspend-imx6.S), if this struct
165 * definition is changed, the offset definition in
166 * arch/arm/mach-imx/suspend-imx6.S must be also changed accordingly,
167 * otherwise, the suspend to ocram function will be broken!
168 */
169struct imx6_cpu_pm_info {
170 phys_addr_t pbase; /* The physical address of pm_info. */
171 phys_addr_t resume_addr; /* The physical resume address for asm code */
172 u32 cpu_type;
173 u32 pm_info_size; /* Size of pm_info. */
174 struct imx6_pm_base mmdc_base;
175 struct imx6_pm_base src_base;
176 struct imx6_pm_base iomuxc_base;
177 struct imx6_pm_base ccm_base;
178 struct imx6_pm_base gpc_base;
179 struct imx6_pm_base l2_base;
180 u32 mmdc_io_num; /* Number of MMDC IOs which need saved/restored. */
181 u32 mmdc_io_val[MX6_MAX_MMDC_IO_NUM][2]; /* To save offset and value */
182} __aligned(8);
183
184void imx6q_set_int_mem_clk_lpm(void)
185{
186 u32 val = readl_relaxed(ccm_base + CGPR);
187
188 val |= BM_CGPR_INT_MEM_CLK_LPM;
189 writel_relaxed(val, ccm_base + CGPR);
190}
191
192static void imx6q_enable_rbc(bool enable)
193{
194 u32 val;
195
196 /*
197 * need to mask all interrupts in GPC before
198 * operating RBC configurations
199 */
200 imx_gpc_mask_all();
201
202 /* configure RBC enable bit */
203 val = readl_relaxed(ccm_base + CCR);
204 val &= ~BM_CCR_RBC_EN;
205 val |= enable ? BM_CCR_RBC_EN : 0;
206 writel_relaxed(val, ccm_base + CCR);
207
208 /* configure RBC count */
209 val = readl_relaxed(ccm_base + CCR);
210 val &= ~BM_CCR_RBC_BYPASS_COUNT;
211 val |= enable ? BM_CCR_RBC_BYPASS_COUNT : 0;
212 writel(val, ccm_base + CCR);
213
214 /*
215 * need to delay at least 2 cycles of CKIL(32K)
216 * due to hardware design requirement, which is
217 * ~61us, here we use 65us for safe
218 */
219 udelay(65);
220
221 /* restore GPC interrupt mask settings */
222 imx_gpc_restore_all();
223}
224
225static void imx6q_enable_wb(bool enable)
226{
227 u32 val;
228
229 /* configure well bias enable bit */
230 val = readl_relaxed(ccm_base + CLPCR);
231 val &= ~BM_CLPCR_WB_PER_AT_LPM;
232 val |= enable ? BM_CLPCR_WB_PER_AT_LPM : 0;
233 writel_relaxed(val, ccm_base + CLPCR);
234
235 /* configure well bias count */
236 val = readl_relaxed(ccm_base + CCR);
237 val &= ~BM_CCR_WB_COUNT;
238 val |= enable ? BM_CCR_WB_COUNT : 0;
239 writel_relaxed(val, ccm_base + CCR);
240}
241
242int imx6q_set_lpm(enum mxc_cpu_pwr_mode mode)
243{
244 struct irq_data *iomuxc_irq_data = irq_get_irq_data(32);
245 u32 val = readl_relaxed(ccm_base + CLPCR);
246
247 val &= ~BM_CLPCR_LPM;
248 switch (mode) {
249 case WAIT_CLOCKED:
250 break;
251 case WAIT_UNCLOCKED:
252 val |= 0x1 << BP_CLPCR_LPM;
253 val |= BM_CLPCR_ARM_CLK_DIS_ON_LPM;
254 break;
255 case STOP_POWER_ON:
256 val |= 0x2 << BP_CLPCR_LPM;
257 break;
258 case WAIT_UNCLOCKED_POWER_OFF:
259 val |= 0x1 << BP_CLPCR_LPM;
260 val &= ~BM_CLPCR_VSTBY;
261 val &= ~BM_CLPCR_SBYOS;
262 break;
263 case STOP_POWER_OFF:
264 val |= 0x2 << BP_CLPCR_LPM;
265 val |= 0x3 << BP_CLPCR_STBY_COUNT;
266 val |= BM_CLPCR_VSTBY;
267 val |= BM_CLPCR_SBYOS;
268 if (cpu_is_imx6sl()) {
269 val |= BM_CLPCR_BYPASS_PMIC_READY;
270 val |= BM_CLPCR_BYP_MMDC_CH0_LPM_HS;
271 } else {
272 val |= BM_CLPCR_BYP_MMDC_CH1_LPM_HS;
273 }
274 break;
275 default:
276 return -EINVAL;
277 }
278
279 /*
280 * ERR007265: CCM: When improper low-power sequence is used,
281 * the SoC enters low power mode before the ARM core executes WFI.
282 *
283 * Software workaround:
284 * 1) Software should trigger IRQ #32 (IOMUX) to be always pending
285 * by setting IOMUX_GPR1_GINT.
286 * 2) Software should then unmask IRQ #32 in GPC before setting CCM
287 * Low-Power mode.
288 * 3) Software should mask IRQ #32 right after CCM Low-Power mode
289 * is set (set bits 0-1 of CCM_CLPCR).
290 */
291 imx_gpc_irq_unmask(iomuxc_irq_data);
292 writel_relaxed(val, ccm_base + CLPCR);
293 imx_gpc_irq_mask(iomuxc_irq_data);
294
295 return 0;
296}
297
298static int imx6q_suspend_finish(unsigned long val)
299{
300 if (!imx6_suspend_in_ocram_fn) {
301 cpu_do_idle();
302 } else {
303 /*
304 * call low level suspend function in ocram,
305 * as we need to float DDR IO.
306 */
307 local_flush_tlb_all();
308 imx6_suspend_in_ocram_fn(suspend_ocram_base);
309 }
310
311 return 0;
312}
313
314static int imx6q_pm_enter(suspend_state_t state)
315{
316 switch (state) {
317 case PM_SUSPEND_MEM:
318 imx6q_set_lpm(STOP_POWER_OFF);
319 imx6q_enable_wb(true);
320 /*
321 * For suspend into ocram, asm code already take care of
322 * RBC setting, so we do NOT need to do that here.
323 */
324 if (!imx6_suspend_in_ocram_fn)
325 imx6q_enable_rbc(true);
326 imx_gpc_pre_suspend();
327 imx_anatop_pre_suspend();
328 imx_set_cpu_jump(0, v7_cpu_resume);
329 /* Zzz ... */
330 cpu_suspend(0, imx6q_suspend_finish);
331 if (cpu_is_imx6q() || cpu_is_imx6dl())
332 imx_smp_prepare();
333 imx_anatop_post_resume();
334 imx_gpc_post_resume();
335 imx6q_enable_rbc(false);
336 imx6q_enable_wb(false);
337 imx6q_set_lpm(WAIT_CLOCKED);
338 break;
339 default:
340 return -EINVAL;
341 }
342
343 return 0;
344}
345
346static const struct platform_suspend_ops imx6q_pm_ops = {
347 .enter = imx6q_pm_enter,
348 .valid = suspend_valid_only_mem,
349};
350
351void __init imx6q_pm_set_ccm_base(void __iomem *base)
352{
353 ccm_base = base;
354}
355
356static int __init imx6_pm_get_base(struct imx6_pm_base *base,
357 const char *compat)
358{
359 struct device_node *node;
360 struct resource res;
361 int ret = 0;
362
363 node = of_find_compatible_node(NULL, NULL, compat);
364 if (!node) {
365 ret = -ENODEV;
366 goto out;
367 }
368
369 ret = of_address_to_resource(node, 0, &res);
370 if (ret)
371 goto put_node;
372
373 base->pbase = res.start;
374 base->vbase = ioremap(res.start, resource_size(&res));
375 if (!base->vbase)
376 ret = -ENOMEM;
377
378put_node:
379 of_node_put(node);
380out:
381 return ret;
382}
383
384static int __init imx6q_suspend_init(const struct imx6_pm_socdata *socdata)
385{
386 phys_addr_t ocram_pbase;
387 struct device_node *node;
388 struct platform_device *pdev;
389 struct imx6_cpu_pm_info *pm_info;
390 struct gen_pool *ocram_pool;
391 unsigned long ocram_base;
392 int i, ret = 0;
393 const u32 *mmdc_offset_array;
394
395 suspend_set_ops(&imx6q_pm_ops);
396
397 if (!socdata) {
398 pr_warn("%s: invalid argument!\n", __func__);
399 return -EINVAL;
400 }
401
402 node = of_find_compatible_node(NULL, NULL, "mmio-sram");
403 if (!node) {
404 pr_warn("%s: failed to find ocram node!\n", __func__);
405 return -ENODEV;
406 }
407
408 pdev = of_find_device_by_node(node);
409 if (!pdev) {
410 pr_warn("%s: failed to find ocram device!\n", __func__);
411 ret = -ENODEV;
412 goto put_node;
413 }
414
415 ocram_pool = dev_get_gen_pool(&pdev->dev);
416 if (!ocram_pool) {
417 pr_warn("%s: ocram pool unavailable!\n", __func__);
418 ret = -ENODEV;
419 goto put_node;
420 }
421
422 ocram_base = gen_pool_alloc(ocram_pool, MX6Q_SUSPEND_OCRAM_SIZE);
423 if (!ocram_base) {
424 pr_warn("%s: unable to alloc ocram!\n", __func__);
425 ret = -ENOMEM;
426 goto put_node;
427 }
428
429 ocram_pbase = gen_pool_virt_to_phys(ocram_pool, ocram_base);
430
431 suspend_ocram_base = __arm_ioremap_exec(ocram_pbase,
432 MX6Q_SUSPEND_OCRAM_SIZE, false);
433
434 pm_info = suspend_ocram_base;
435 pm_info->pbase = ocram_pbase;
436 pm_info->resume_addr = virt_to_phys(v7_cpu_resume);
437 pm_info->pm_info_size = sizeof(*pm_info);
438
439 /*
440 * ccm physical address is not used by asm code currently,
441 * so get ccm virtual address directly, as we already have
442 * it from ccm driver.
443 */
444 pm_info->ccm_base.vbase = ccm_base;
445
446 ret = imx6_pm_get_base(&pm_info->mmdc_base, socdata->mmdc_compat);
447 if (ret) {
448 pr_warn("%s: failed to get mmdc base %d!\n", __func__, ret);
449 goto put_node;
450 }
451
452 ret = imx6_pm_get_base(&pm_info->src_base, socdata->src_compat);
453 if (ret) {
454 pr_warn("%s: failed to get src base %d!\n", __func__, ret);
455 goto src_map_failed;
456 }
457
458 ret = imx6_pm_get_base(&pm_info->iomuxc_base, socdata->iomuxc_compat);
459 if (ret) {
460 pr_warn("%s: failed to get iomuxc base %d!\n", __func__, ret);
461 goto iomuxc_map_failed;
462 }
463
464 ret = imx6_pm_get_base(&pm_info->gpc_base, socdata->gpc_compat);
465 if (ret) {
466 pr_warn("%s: failed to get gpc base %d!\n", __func__, ret);
467 goto gpc_map_failed;
468 }
469
470 ret = imx6_pm_get_base(&pm_info->l2_base, "arm,pl310-cache");
471 if (ret) {
472 pr_warn("%s: failed to get pl310-cache base %d!\n",
473 __func__, ret);
474 goto pl310_cache_map_failed;
475 }
476
477 pm_info->cpu_type = socdata->cpu_type;
478 pm_info->mmdc_io_num = socdata->mmdc_io_num;
479 mmdc_offset_array = socdata->mmdc_io_offset;
480
481 for (i = 0; i < pm_info->mmdc_io_num; i++) {
482 pm_info->mmdc_io_val[i][0] =
483 mmdc_offset_array[i];
484 pm_info->mmdc_io_val[i][1] =
485 readl_relaxed(pm_info->iomuxc_base.vbase +
486 mmdc_offset_array[i]);
487 }
488
489 imx6_suspend_in_ocram_fn = fncpy(
490 suspend_ocram_base + sizeof(*pm_info),
491 &imx6_suspend,
492 MX6Q_SUSPEND_OCRAM_SIZE - sizeof(*pm_info));
493
494 goto put_node;
495
496pl310_cache_map_failed:
497 iounmap(&pm_info->gpc_base.vbase);
498gpc_map_failed:
499 iounmap(&pm_info->iomuxc_base.vbase);
500iomuxc_map_failed:
501 iounmap(&pm_info->src_base.vbase);
502src_map_failed:
503 iounmap(&pm_info->mmdc_base.vbase);
504put_node:
505 of_node_put(node);
506
507 return ret;
508}
509
510static void __init imx6_pm_common_init(const struct imx6_pm_socdata
511 *socdata)
512{
513 struct regmap *gpr;
514 int ret;
515
516 WARN_ON(!ccm_base);
517
518 if (IS_ENABLED(CONFIG_SUSPEND)) {
519 ret = imx6q_suspend_init(socdata);
520 if (ret)
521 pr_warn("%s: No DDR LPM support with suspend %d!\n",
522 __func__, ret);
523 }
524
525 /*
526 * This is for SW workaround step #1 of ERR007265, see comments
527 * in imx6q_set_lpm for details of this errata.
528 * Force IOMUXC irq pending, so that the interrupt to GPC can be
529 * used to deassert dsm_request signal when the signal gets
530 * asserted unexpectedly.
531 */
532 gpr = syscon_regmap_lookup_by_compatible("fsl,imx6q-iomuxc-gpr");
533 if (!IS_ERR(gpr))
534 regmap_update_bits(gpr, IOMUXC_GPR1, IMX6Q_GPR1_GINT,
535 IMX6Q_GPR1_GINT);
536}
537
538void __init imx6q_pm_init(void)
539{
540 imx6_pm_common_init(&imx6q_pm_data);
541}
542
543void __init imx6dl_pm_init(void)
544{
545 imx6_pm_common_init(&imx6dl_pm_data);
546}
547
548void __init imx6sl_pm_init(void)
549{
550 imx6_pm_common_init(&imx6sl_pm_data);
551}
diff --git a/arch/arm/mach-imx/pm-imx6q.c b/arch/arm/mach-imx/pm-imx6q.c
deleted file mode 100644
index 29e3fe6a6669..000000000000
--- a/arch/arm/mach-imx/pm-imx6q.c
+++ /dev/null
@@ -1,240 +0,0 @@
1/*
2 * Copyright 2011-2013 Freescale Semiconductor, Inc.
3 * Copyright 2011 Linaro Ltd.
4 *
5 * The code contained herein is licensed under the GNU General Public
6 * License. You may obtain a copy of the GNU General Public License
7 * Version 2 or later at the following locations:
8 *
9 * http://www.opensource.org/licenses/gpl-license.html
10 * http://www.gnu.org/copyleft/gpl.html
11 */
12
13#include <linux/delay.h>
14#include <linux/init.h>
15#include <linux/io.h>
16#include <linux/irq.h>
17#include <linux/mfd/syscon.h>
18#include <linux/mfd/syscon/imx6q-iomuxc-gpr.h>
19#include <linux/of.h>
20#include <linux/of_address.h>
21#include <linux/regmap.h>
22#include <linux/suspend.h>
23#include <asm/cacheflush.h>
24#include <asm/proc-fns.h>
25#include <asm/suspend.h>
26#include <asm/hardware/cache-l2x0.h>
27
28#include "common.h"
29#include "hardware.h"
30
31#define CCR 0x0
32#define BM_CCR_WB_COUNT (0x7 << 16)
33#define BM_CCR_RBC_BYPASS_COUNT (0x3f << 21)
34#define BM_CCR_RBC_EN (0x1 << 27)
35
36#define CLPCR 0x54
37#define BP_CLPCR_LPM 0
38#define BM_CLPCR_LPM (0x3 << 0)
39#define BM_CLPCR_BYPASS_PMIC_READY (0x1 << 2)
40#define BM_CLPCR_ARM_CLK_DIS_ON_LPM (0x1 << 5)
41#define BM_CLPCR_SBYOS (0x1 << 6)
42#define BM_CLPCR_DIS_REF_OSC (0x1 << 7)
43#define BM_CLPCR_VSTBY (0x1 << 8)
44#define BP_CLPCR_STBY_COUNT 9
45#define BM_CLPCR_STBY_COUNT (0x3 << 9)
46#define BM_CLPCR_COSC_PWRDOWN (0x1 << 11)
47#define BM_CLPCR_WB_PER_AT_LPM (0x1 << 16)
48#define BM_CLPCR_WB_CORE_AT_LPM (0x1 << 17)
49#define BM_CLPCR_BYP_MMDC_CH0_LPM_HS (0x1 << 19)
50#define BM_CLPCR_BYP_MMDC_CH1_LPM_HS (0x1 << 21)
51#define BM_CLPCR_MASK_CORE0_WFI (0x1 << 22)
52#define BM_CLPCR_MASK_CORE1_WFI (0x1 << 23)
53#define BM_CLPCR_MASK_CORE2_WFI (0x1 << 24)
54#define BM_CLPCR_MASK_CORE3_WFI (0x1 << 25)
55#define BM_CLPCR_MASK_SCU_IDLE (0x1 << 26)
56#define BM_CLPCR_MASK_L2CC_IDLE (0x1 << 27)
57
58#define CGPR 0x64
59#define BM_CGPR_CHICKEN_BIT (0x1 << 17)
60
61static void __iomem *ccm_base;
62
63void imx6q_set_chicken_bit(void)
64{
65 u32 val = readl_relaxed(ccm_base + CGPR);
66
67 val |= BM_CGPR_CHICKEN_BIT;
68 writel_relaxed(val, ccm_base + CGPR);
69}
70
71static void imx6q_enable_rbc(bool enable)
72{
73 u32 val;
74
75 /*
76 * need to mask all interrupts in GPC before
77 * operating RBC configurations
78 */
79 imx_gpc_mask_all();
80
81 /* configure RBC enable bit */
82 val = readl_relaxed(ccm_base + CCR);
83 val &= ~BM_CCR_RBC_EN;
84 val |= enable ? BM_CCR_RBC_EN : 0;
85 writel_relaxed(val, ccm_base + CCR);
86
87 /* configure RBC count */
88 val = readl_relaxed(ccm_base + CCR);
89 val &= ~BM_CCR_RBC_BYPASS_COUNT;
90 val |= enable ? BM_CCR_RBC_BYPASS_COUNT : 0;
91 writel(val, ccm_base + CCR);
92
93 /*
94 * need to delay at least 2 cycles of CKIL(32K)
95 * due to hardware design requirement, which is
96 * ~61us, here we use 65us for safe
97 */
98 udelay(65);
99
100 /* restore GPC interrupt mask settings */
101 imx_gpc_restore_all();
102}
103
104static void imx6q_enable_wb(bool enable)
105{
106 u32 val;
107
108 /* configure well bias enable bit */
109 val = readl_relaxed(ccm_base + CLPCR);
110 val &= ~BM_CLPCR_WB_PER_AT_LPM;
111 val |= enable ? BM_CLPCR_WB_PER_AT_LPM : 0;
112 writel_relaxed(val, ccm_base + CLPCR);
113
114 /* configure well bias count */
115 val = readl_relaxed(ccm_base + CCR);
116 val &= ~BM_CCR_WB_COUNT;
117 val |= enable ? BM_CCR_WB_COUNT : 0;
118 writel_relaxed(val, ccm_base + CCR);
119}
120
121int imx6q_set_lpm(enum mxc_cpu_pwr_mode mode)
122{
123 struct irq_data *iomuxc_irq_data = irq_get_irq_data(32);
124 u32 val = readl_relaxed(ccm_base + CLPCR);
125
126 val &= ~BM_CLPCR_LPM;
127 switch (mode) {
128 case WAIT_CLOCKED:
129 break;
130 case WAIT_UNCLOCKED:
131 val |= 0x1 << BP_CLPCR_LPM;
132 val |= BM_CLPCR_ARM_CLK_DIS_ON_LPM;
133 break;
134 case STOP_POWER_ON:
135 val |= 0x2 << BP_CLPCR_LPM;
136 break;
137 case WAIT_UNCLOCKED_POWER_OFF:
138 val |= 0x1 << BP_CLPCR_LPM;
139 val &= ~BM_CLPCR_VSTBY;
140 val &= ~BM_CLPCR_SBYOS;
141 break;
142 case STOP_POWER_OFF:
143 val |= 0x2 << BP_CLPCR_LPM;
144 val |= 0x3 << BP_CLPCR_STBY_COUNT;
145 val |= BM_CLPCR_VSTBY;
146 val |= BM_CLPCR_SBYOS;
147 if (cpu_is_imx6sl()) {
148 val |= BM_CLPCR_BYPASS_PMIC_READY;
149 val |= BM_CLPCR_BYP_MMDC_CH0_LPM_HS;
150 } else {
151 val |= BM_CLPCR_BYP_MMDC_CH1_LPM_HS;
152 }
153 break;
154 default:
155 return -EINVAL;
156 }
157
158 /*
159 * ERR007265: CCM: When improper low-power sequence is used,
160 * the SoC enters low power mode before the ARM core executes WFI.
161 *
162 * Software workaround:
163 * 1) Software should trigger IRQ #32 (IOMUX) to be always pending
164 * by setting IOMUX_GPR1_GINT.
165 * 2) Software should then unmask IRQ #32 in GPC before setting CCM
166 * Low-Power mode.
167 * 3) Software should mask IRQ #32 right after CCM Low-Power mode
168 * is set (set bits 0-1 of CCM_CLPCR).
169 */
170 imx_gpc_irq_unmask(iomuxc_irq_data);
171 writel_relaxed(val, ccm_base + CLPCR);
172 imx_gpc_irq_mask(iomuxc_irq_data);
173
174 return 0;
175}
176
177static int imx6q_suspend_finish(unsigned long val)
178{
179 cpu_do_idle();
180 return 0;
181}
182
183static int imx6q_pm_enter(suspend_state_t state)
184{
185 switch (state) {
186 case PM_SUSPEND_MEM:
187 imx6q_set_lpm(STOP_POWER_OFF);
188 imx6q_enable_wb(true);
189 imx6q_enable_rbc(true);
190 imx_gpc_pre_suspend();
191 imx_anatop_pre_suspend();
192 imx_set_cpu_jump(0, v7_cpu_resume);
193 /* Zzz ... */
194 cpu_suspend(0, imx6q_suspend_finish);
195 if (cpu_is_imx6q() || cpu_is_imx6dl())
196 imx_smp_prepare();
197 imx_anatop_post_resume();
198 imx_gpc_post_resume();
199 imx6q_enable_rbc(false);
200 imx6q_enable_wb(false);
201 imx6q_set_lpm(WAIT_CLOCKED);
202 break;
203 default:
204 return -EINVAL;
205 }
206
207 return 0;
208}
209
210static const struct platform_suspend_ops imx6q_pm_ops = {
211 .enter = imx6q_pm_enter,
212 .valid = suspend_valid_only_mem,
213};
214
215void __init imx6q_pm_set_ccm_base(void __iomem *base)
216{
217 ccm_base = base;
218}
219
220void __init imx6q_pm_init(void)
221{
222 struct regmap *gpr;
223
224 WARN_ON(!ccm_base);
225
226 /*
227 * This is for SW workaround step #1 of ERR007265, see comments
228 * in imx6q_set_lpm for details of this errata.
229 * Force IOMUXC irq pending, so that the interrupt to GPC can be
230 * used to deassert dsm_request signal when the signal gets
231 * asserted unexpectedly.
232 */
233 gpr = syscon_regmap_lookup_by_compatible("fsl,imx6q-iomuxc-gpr");
234 if (!IS_ERR(gpr))
235 regmap_update_bits(gpr, IOMUXC_GPR1, IMX6Q_GPR1_GINT,
236 IMX6Q_GPR1_GINT);
237
238
239 suspend_set_ops(&imx6q_pm_ops);
240}
diff --git a/arch/arm/mach-imx/suspend-imx6.S b/arch/arm/mach-imx/suspend-imx6.S
new file mode 100644
index 000000000000..20048ff05739
--- /dev/null
+++ b/arch/arm/mach-imx/suspend-imx6.S
@@ -0,0 +1,361 @@
1/*
2 * Copyright 2014 Freescale Semiconductor, Inc.
3 *
4 * The code contained herein is licensed under the GNU General Public
5 * License. You may obtain a copy of the GNU General Public License
6 * Version 2 or later at the following locations:
7 *
8 * http://www.opensource.org/licenses/gpl-license.html
9 * http://www.gnu.org/copyleft/gpl.html
10 */
11
12#include <linux/linkage.h>
13#include <asm/asm-offsets.h>
14#include <asm/hardware/cache-l2x0.h>
15#include "hardware.h"
16
17/*
18 * ==================== low level suspend ====================
19 *
20 * Better to follow below rules to use ARM registers:
21 * r0: pm_info structure address;
22 * r1 ~ r4: for saving pm_info members;
23 * r5 ~ r10: free registers;
24 * r11: io base address.
25 *
26 * suspend ocram space layout:
27 * ======================== high address ======================
28 * .
29 * .
30 * .
31 * ^
32 * ^
33 * ^
34 * imx6_suspend code
35 * PM_INFO structure(imx6_cpu_pm_info)
36 * ======================== low address =======================
37 */
38
39/*
40 * Below offsets are based on struct imx6_cpu_pm_info
41 * which defined in arch/arm/mach-imx/pm-imx6q.c, this
42 * structure contains necessary pm info for low level
43 * suspend related code.
44 */
45#define PM_INFO_PBASE_OFFSET 0x0
46#define PM_INFO_RESUME_ADDR_OFFSET 0x4
47#define PM_INFO_CPU_TYPE_OFFSET 0x8
48#define PM_INFO_PM_INFO_SIZE_OFFSET 0xC
49#define PM_INFO_MX6Q_MMDC_P_OFFSET 0x10
50#define PM_INFO_MX6Q_MMDC_V_OFFSET 0x14
51#define PM_INFO_MX6Q_SRC_P_OFFSET 0x18
52#define PM_INFO_MX6Q_SRC_V_OFFSET 0x1C
53#define PM_INFO_MX6Q_IOMUXC_P_OFFSET 0x20
54#define PM_INFO_MX6Q_IOMUXC_V_OFFSET 0x24
55#define PM_INFO_MX6Q_CCM_P_OFFSET 0x28
56#define PM_INFO_MX6Q_CCM_V_OFFSET 0x2C
57#define PM_INFO_MX6Q_GPC_P_OFFSET 0x30
58#define PM_INFO_MX6Q_GPC_V_OFFSET 0x34
59#define PM_INFO_MX6Q_L2_P_OFFSET 0x38
60#define PM_INFO_MX6Q_L2_V_OFFSET 0x3C
61#define PM_INFO_MMDC_IO_NUM_OFFSET 0x40
62#define PM_INFO_MMDC_IO_VAL_OFFSET 0x44
63
64#define MX6Q_SRC_GPR1 0x20
65#define MX6Q_SRC_GPR2 0x24
66#define MX6Q_MMDC_MAPSR 0x404
67#define MX6Q_MMDC_MPDGCTRL0 0x83c
68#define MX6Q_GPC_IMR1 0x08
69#define MX6Q_GPC_IMR2 0x0c
70#define MX6Q_GPC_IMR3 0x10
71#define MX6Q_GPC_IMR4 0x14
72#define MX6Q_CCM_CCR 0x0
73
74 .align 3
75
76 .macro sync_l2_cache
77
78 /* sync L2 cache to drain L2's buffers to DRAM. */
79#ifdef CONFIG_CACHE_L2X0
80 ldr r11, [r0, #PM_INFO_MX6Q_L2_V_OFFSET]
81 mov r6, #0x0
82 str r6, [r11, #L2X0_CACHE_SYNC]
831:
84 ldr r6, [r11, #L2X0_CACHE_SYNC]
85 ands r6, r6, #0x1
86 bne 1b
87#endif
88
89 .endm
90
91 .macro resume_mmdc
92
93 /* restore MMDC IO */
94 cmp r5, #0x0
95 ldreq r11, [r0, #PM_INFO_MX6Q_IOMUXC_V_OFFSET]
96 ldrne r11, [r0, #PM_INFO_MX6Q_IOMUXC_P_OFFSET]
97
98 ldr r6, [r0, #PM_INFO_MMDC_IO_NUM_OFFSET]
99 ldr r7, =PM_INFO_MMDC_IO_VAL_OFFSET
100 add r7, r7, r0
1011:
102 ldr r8, [r7], #0x4
103 ldr r9, [r7], #0x4
104 str r9, [r11, r8]
105 subs r6, r6, #0x1
106 bne 1b
107
108 cmp r5, #0x0
109 ldreq r11, [r0, #PM_INFO_MX6Q_MMDC_V_OFFSET]
110 ldrne r11, [r0, #PM_INFO_MX6Q_MMDC_P_OFFSET]
111
112 cmp r3, #MXC_CPU_IMX6SL
113 bne 4f
114
115 /* reset read FIFO, RST_RD_FIFO */
116 ldr r7, =MX6Q_MMDC_MPDGCTRL0
117 ldr r6, [r11, r7]
118 orr r6, r6, #(1 << 31)
119 str r6, [r11, r7]
1202:
121 ldr r6, [r11, r7]
122 ands r6, r6, #(1 << 31)
123 bne 2b
124
125 /* reset FIFO a second time */
126 ldr r6, [r11, r7]
127 orr r6, r6, #(1 << 31)
128 str r6, [r11, r7]
1293:
130 ldr r6, [r11, r7]
131 ands r6, r6, #(1 << 31)
132 bne 3b
1334:
134 /* let DDR out of self-refresh */
135 ldr r7, [r11, #MX6Q_MMDC_MAPSR]
136 bic r7, r7, #(1 << 21)
137 str r7, [r11, #MX6Q_MMDC_MAPSR]
1385:
139 ldr r7, [r11, #MX6Q_MMDC_MAPSR]
140 ands r7, r7, #(1 << 25)
141 bne 5b
142
143 /* enable DDR auto power saving */
144 ldr r7, [r11, #MX6Q_MMDC_MAPSR]
145 bic r7, r7, #0x1
146 str r7, [r11, #MX6Q_MMDC_MAPSR]
147
148 .endm
149
150ENTRY(imx6_suspend)
151 ldr r1, [r0, #PM_INFO_PBASE_OFFSET]
152 ldr r2, [r0, #PM_INFO_RESUME_ADDR_OFFSET]
153 ldr r3, [r0, #PM_INFO_CPU_TYPE_OFFSET]
154 ldr r4, [r0, #PM_INFO_PM_INFO_SIZE_OFFSET]
155
156 /*
157 * counting the resume address in iram
158 * to set it in SRC register.
159 */
160 ldr r6, =imx6_suspend
161 ldr r7, =resume
162 sub r7, r7, r6
163 add r8, r1, r4
164 add r9, r8, r7
165
166 /*
167 * make sure TLB contain the addr we want,
168 * as we will access them after MMDC IO floated.
169 */
170
171 ldr r11, [r0, #PM_INFO_MX6Q_CCM_V_OFFSET]
172 ldr r6, [r11, #0x0]
173 ldr r11, [r0, #PM_INFO_MX6Q_GPC_V_OFFSET]
174 ldr r6, [r11, #0x0]
175
176 /* use r11 to store the IO address */
177 ldr r11, [r0, #PM_INFO_MX6Q_SRC_V_OFFSET]
178 /* store physical resume addr and pm_info address. */
179 str r9, [r11, #MX6Q_SRC_GPR1]
180 str r1, [r11, #MX6Q_SRC_GPR2]
181
182 /* need to sync L2 cache before DSM. */
183 sync_l2_cache
184
185 ldr r11, [r0, #PM_INFO_MX6Q_MMDC_V_OFFSET]
186 /*
187 * put DDR explicitly into self-refresh and
188 * disable automatic power savings.
189 */
190 ldr r7, [r11, #MX6Q_MMDC_MAPSR]
191 orr r7, r7, #0x1
192 str r7, [r11, #MX6Q_MMDC_MAPSR]
193
194 /* make the DDR explicitly enter self-refresh. */
195 ldr r7, [r11, #MX6Q_MMDC_MAPSR]
196 orr r7, r7, #(1 << 21)
197 str r7, [r11, #MX6Q_MMDC_MAPSR]
198
199poll_dvfs_set:
200 ldr r7, [r11, #MX6Q_MMDC_MAPSR]
201 ands r7, r7, #(1 << 25)
202 beq poll_dvfs_set
203
204 ldr r11, [r0, #PM_INFO_MX6Q_IOMUXC_V_OFFSET]
205 ldr r6, =0x0
206 ldr r7, [r0, #PM_INFO_MMDC_IO_NUM_OFFSET]
207 ldr r8, =PM_INFO_MMDC_IO_VAL_OFFSET
208 add r8, r8, r0
209 /* i.MX6SL's last 3 IOs need special setting */
210 cmp r3, #MXC_CPU_IMX6SL
211 subeq r7, r7, #0x3
212set_mmdc_io_lpm:
213 ldr r9, [r8], #0x8
214 str r6, [r11, r9]
215 subs r7, r7, #0x1
216 bne set_mmdc_io_lpm
217
218 cmp r3, #MXC_CPU_IMX6SL
219 bne set_mmdc_io_lpm_done
220 ldr r6, =0x1000
221 ldr r9, [r8], #0x8
222 str r6, [r11, r9]
223 ldr r9, [r8], #0x8
224 str r6, [r11, r9]
225 ldr r6, =0x80000
226 ldr r9, [r8]
227 str r6, [r11, r9]
228set_mmdc_io_lpm_done:
229
230 /*
231 * mask all GPC interrupts before
232 * enabling the RBC counters to
233 * avoid the counter starting too
234 * early if an interupt is already
235 * pending.
236 */
237 ldr r11, [r0, #PM_INFO_MX6Q_GPC_V_OFFSET]
238 ldr r6, [r11, #MX6Q_GPC_IMR1]
239 ldr r7, [r11, #MX6Q_GPC_IMR2]
240 ldr r8, [r11, #MX6Q_GPC_IMR3]
241 ldr r9, [r11, #MX6Q_GPC_IMR4]
242
243 ldr r10, =0xffffffff
244 str r10, [r11, #MX6Q_GPC_IMR1]
245 str r10, [r11, #MX6Q_GPC_IMR2]
246 str r10, [r11, #MX6Q_GPC_IMR3]
247 str r10, [r11, #MX6Q_GPC_IMR4]
248
249 /*
250 * enable the RBC bypass counter here
251 * to hold off the interrupts. RBC counter
252 * = 32 (1ms), Minimum RBC delay should be
253 * 400us for the analog LDOs to power down.
254 */
255 ldr r11, [r0, #PM_INFO_MX6Q_CCM_V_OFFSET]
256 ldr r10, [r11, #MX6Q_CCM_CCR]
257 bic r10, r10, #(0x3f << 21)
258 orr r10, r10, #(0x20 << 21)
259 str r10, [r11, #MX6Q_CCM_CCR]
260
261 /* enable the counter. */
262 ldr r10, [r11, #MX6Q_CCM_CCR]
263 orr r10, r10, #(0x1 << 27)
264 str r10, [r11, #MX6Q_CCM_CCR]
265
266 /* unmask all the GPC interrupts. */
267 ldr r11, [r0, #PM_INFO_MX6Q_GPC_V_OFFSET]
268 str r6, [r11, #MX6Q_GPC_IMR1]
269 str r7, [r11, #MX6Q_GPC_IMR2]
270 str r8, [r11, #MX6Q_GPC_IMR3]
271 str r9, [r11, #MX6Q_GPC_IMR4]
272
273 /*
274 * now delay for a short while (3usec)
275 * ARM is at 1GHz at this point
276 * so a short loop should be enough.
277 * this delay is required to ensure that
278 * the RBC counter can start counting in
279 * case an interrupt is already pending
280 * or in case an interrupt arrives just
281 * as ARM is about to assert DSM_request.
282 */
283 ldr r6, =2000
284rbc_loop:
285 subs r6, r6, #0x1
286 bne rbc_loop
287
288 /* Zzz, enter stop mode */
289 wfi
290 nop
291 nop
292 nop
293 nop
294
295 /*
296 * run to here means there is pending
297 * wakeup source, system should auto
298 * resume, we need to restore MMDC IO first
299 */
300 mov r5, #0x0
301 resume_mmdc
302
303 /* return to suspend finish */
304 mov pc, lr
305
306resume:
307 /* invalidate L1 I-cache first */
308 mov r6, #0x0
309 mcr p15, 0, r6, c7, c5, 0
310 mcr p15, 0, r6, c7, c5, 6
311 /* enable the Icache and branch prediction */
312 mov r6, #0x1800
313 mcr p15, 0, r6, c1, c0, 0
314 isb
315
316 /* get physical resume address from pm_info. */
317 ldr lr, [r0, #PM_INFO_RESUME_ADDR_OFFSET]
318 /* clear core0's entry and parameter */
319 ldr r11, [r0, #PM_INFO_MX6Q_SRC_P_OFFSET]
320 mov r7, #0x0
321 str r7, [r11, #MX6Q_SRC_GPR1]
322 str r7, [r11, #MX6Q_SRC_GPR2]
323
324 ldr r3, [r0, #PM_INFO_CPU_TYPE_OFFSET]
325 mov r5, #0x1
326 resume_mmdc
327
328 mov pc, lr
329ENDPROC(imx6_suspend)
330
331/*
332 * The following code must assume it is running from physical address
333 * where absolute virtual addresses to the data section have to be
334 * turned into relative ones.
335 */
336
337#ifdef CONFIG_CACHE_L2X0
338 .macro pl310_resume
339 adr r0, l2x0_saved_regs_offset
340 ldr r2, [r0]
341 add r2, r2, r0
342 ldr r0, [r2, #L2X0_R_PHY_BASE] @ get physical base of l2x0
343 ldr r1, [r2, #L2X0_R_AUX_CTRL] @ get aux_ctrl value
344 str r1, [r0, #L2X0_AUX_CTRL] @ restore aux_ctrl
345 mov r1, #0x1
346 str r1, [r0, #L2X0_CTRL] @ re-enable L2
347 .endm
348
349l2x0_saved_regs_offset:
350 .word l2x0_saved_regs - .
351
352#else
353 .macro pl310_resume
354 .endm
355#endif
356
357ENTRY(v7_cpu_resume)
358 bl v7_invalidate_l1
359 pl310_resume
360 b cpu_resume
361ENDPROC(v7_cpu_resume)
diff --git a/arch/arm/mach-imx/time.c b/arch/arm/mach-imx/time.c
index 1a3a5f615770..65222ea0df6d 100644
--- a/arch/arm/mach-imx/time.c
+++ b/arch/arm/mach-imx/time.c
@@ -25,6 +25,7 @@
25#include <linux/irq.h> 25#include <linux/irq.h>
26#include <linux/clockchips.h> 26#include <linux/clockchips.h>
27#include <linux/clk.h> 27#include <linux/clk.h>
28#include <linux/delay.h>
28#include <linux/err.h> 29#include <linux/err.h>
29#include <linux/sched_clock.h> 30#include <linux/sched_clock.h>
30 31
@@ -116,11 +117,22 @@ static u64 notrace mxc_read_sched_clock(void)
116 return sched_clock_reg ? __raw_readl(sched_clock_reg) : 0; 117 return sched_clock_reg ? __raw_readl(sched_clock_reg) : 0;
117} 118}
118 119
120static struct delay_timer imx_delay_timer;
121
122static unsigned long imx_read_current_timer(void)
123{
124 return __raw_readl(sched_clock_reg);
125}
126
119static int __init mxc_clocksource_init(struct clk *timer_clk) 127static int __init mxc_clocksource_init(struct clk *timer_clk)
120{ 128{
121 unsigned int c = clk_get_rate(timer_clk); 129 unsigned int c = clk_get_rate(timer_clk);
122 void __iomem *reg = timer_base + (timer_is_v2() ? V2_TCN : MX1_2_TCN); 130 void __iomem *reg = timer_base + (timer_is_v2() ? V2_TCN : MX1_2_TCN);
123 131
132 imx_delay_timer.read_current_timer = &imx_read_current_timer;
133 imx_delay_timer.freq = c;
134 register_current_timer_delay(&imx_delay_timer);
135
124 sched_clock_reg = reg; 136 sched_clock_reg = reg;
125 137
126 sched_clock_register(mxc_read_sched_clock, 32, c); 138 sched_clock_register(mxc_read_sched_clock, 32, c);
diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig
index fe8319ad3158..df4b26340ae4 100644
--- a/arch/arm/mach-kirkwood/Kconfig
+++ b/arch/arm/mach-kirkwood/Kconfig
@@ -106,13 +106,6 @@ config ARCH_KIRKWOOD_DT
106 Say 'Y' here if you want your kernel to support the 106 Say 'Y' here if you want your kernel to support the
107 Marvell Kirkwood using flattened device tree. 107 Marvell Kirkwood using flattened device tree.
108 108
109config MACH_MV88F6281GTW_GE_DT
110 bool "Marvell 88F6281 GTW GE Board (Flattened Device Tree)"
111 depends on ARCH_KIRKWOOD_DT
112 help
113 Say 'Y' here if you want your kernel to support the
114 Marvell 88F6281 GTW GE Board (Flattened Device Tree).
115
116endmenu 109endmenu
117 110
118endif 111endif
diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile
index 144b51102939..3a72c5c6e747 100644
--- a/arch/arm/mach-kirkwood/Makefile
+++ b/arch/arm/mach-kirkwood/Makefile
@@ -1,5 +1,4 @@
1obj-y += common.o pcie.o 1obj-$(CONFIG_KIRKWOOD_LEGACY) += irq.o mpp.o common.o pcie.o
2obj-$(CONFIG_KIRKWOOD_LEGACY) += irq.o mpp.o
3obj-$(CONFIG_PM) += pm.o 2obj-$(CONFIG_PM) += pm.o
4 3
5obj-$(CONFIG_MACH_D2NET_V2) += d2net_v2-setup.o lacie_v2-common.o 4obj-$(CONFIG_MACH_D2NET_V2) += d2net_v2-setup.o lacie_v2-common.o
@@ -13,4 +12,3 @@ obj-$(CONFIG_MACH_TS219) += ts219-setup.o tsx1x-common.o
13obj-$(CONFIG_MACH_TS41X) += ts41x-setup.o tsx1x-common.o 12obj-$(CONFIG_MACH_TS41X) += ts41x-setup.o tsx1x-common.o
14 13
15obj-$(CONFIG_ARCH_KIRKWOOD_DT) += board-dt.o 14obj-$(CONFIG_ARCH_KIRKWOOD_DT) += board-dt.o
16obj-$(CONFIG_MACH_MV88F6281GTW_GE_DT) += board-mv88f6281gtw_ge.o
diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c
index 78188159484d..2801da49e2a3 100644
--- a/arch/arm/mach-kirkwood/board-dt.c
+++ b/arch/arm/mach-kirkwood/board-dt.c
@@ -19,11 +19,84 @@
19#include <linux/of_platform.h> 19#include <linux/of_platform.h>
20#include <linux/dma-mapping.h> 20#include <linux/dma-mapping.h>
21#include <linux/irqchip.h> 21#include <linux/irqchip.h>
22#include <linux/kexec.h> 22#include <asm/hardware/cache-feroceon-l2.h>
23#include <asm/mach/arch.h> 23#include <asm/mach/arch.h>
24#include <asm/mach/map.h>
24#include <mach/bridge-regs.h> 25#include <mach/bridge-regs.h>
25#include <plat/common.h> 26#include <plat/common.h>
26#include "common.h" 27#include <plat/pcie.h>
28#include "pm.h"
29
30static struct map_desc kirkwood_io_desc[] __initdata = {
31 {
32 .virtual = (unsigned long) KIRKWOOD_REGS_VIRT_BASE,
33 .pfn = __phys_to_pfn(KIRKWOOD_REGS_PHYS_BASE),
34 .length = KIRKWOOD_REGS_SIZE,
35 .type = MT_DEVICE,
36 },
37};
38
39static void __init kirkwood_map_io(void)
40{
41 iotable_init(kirkwood_io_desc, ARRAY_SIZE(kirkwood_io_desc));
42}
43
44static struct resource kirkwood_cpufreq_resources[] = {
45 [0] = {
46 .start = CPU_CONTROL_PHYS,
47 .end = CPU_CONTROL_PHYS + 3,
48 .flags = IORESOURCE_MEM,
49 },
50};
51
52static struct platform_device kirkwood_cpufreq_device = {
53 .name = "kirkwood-cpufreq",
54 .id = -1,
55 .num_resources = ARRAY_SIZE(kirkwood_cpufreq_resources),
56 .resource = kirkwood_cpufreq_resources,
57};
58
59static void __init kirkwood_cpufreq_init(void)
60{
61 platform_device_register(&kirkwood_cpufreq_device);
62}
63
64static struct resource kirkwood_cpuidle_resource[] = {
65 {
66 .flags = IORESOURCE_MEM,
67 .start = DDR_OPERATION_BASE,
68 .end = DDR_OPERATION_BASE + 3,
69 },
70};
71
72static struct platform_device kirkwood_cpuidle = {
73 .name = "kirkwood_cpuidle",
74 .id = -1,
75 .resource = kirkwood_cpuidle_resource,
76 .num_resources = 1,
77};
78
79static void __init kirkwood_cpuidle_init(void)
80{
81 platform_device_register(&kirkwood_cpuidle);
82}
83
84/* Temporary here since mach-mvebu has a function we can use */
85static void kirkwood_restart(enum reboot_mode mode, const char *cmd)
86{
87 /*
88 * Enable soft reset to assert RSTOUTn.
89 */
90 writel(SOFT_RESET_OUT_EN, RSTOUTn_MASK);
91
92 /*
93 * Assert soft reset.
94 */
95 writel(SOFT_RESET, SYSTEM_SOFT_RESET);
96
97 while (1)
98 ;
99}
27 100
28#define MV643XX_ETH_MAC_ADDR_LOW 0x0414 101#define MV643XX_ETH_MAC_ADDR_LOW 0x0414
29#define MV643XX_ETH_MAC_ADDR_HIGH 0x0418 102#define MV643XX_ETH_MAC_ADDR_HIGH 0x0418
@@ -104,35 +177,35 @@ eth_fixup_skip:
104 } 177 }
105} 178}
106 179
107static void __init kirkwood_dt_init(void) 180/*
181 * Disable propagation of mbus errors to the CPU local bus, as this
182 * causes mbus errors (which can occur for example for PCI aborts) to
183 * throw CPU aborts, which we're not set up to deal with.
184 */
185static void __init kirkwood_disable_mbus_error_propagation(void)
108{ 186{
109 pr_info("Kirkwood: %s.\n", kirkwood_id()); 187 void __iomem *cpu_config;
110 188
111 /* 189 cpu_config = ioremap(CPU_CONFIG_PHYS, 4);
112 * Disable propagation of mbus errors to the CPU local bus, 190 writel(readl(cpu_config) & ~CPU_CONFIG_ERROR_PROP, cpu_config);
113 * as this causes mbus errors (which can occur for example 191 iounmap(cpu_config);
114 * for PCI aborts) to throw CPU aborts, which we're not set 192}
115 * up to deal with.
116 */
117 writel(readl(CPU_CONFIG) & ~CPU_CONFIG_ERROR_PROP, CPU_CONFIG);
118 193
119 BUG_ON(mvebu_mbus_dt_init()); 194static void __init kirkwood_dt_init(void)
195{
196 kirkwood_disable_mbus_error_propagation();
120 197
121 kirkwood_l2_init(); 198 BUG_ON(mvebu_mbus_dt_init());
122 199
200#ifdef CONFIG_CACHE_FEROCEON_L2
201 feroceon_of_init();
202#endif
123 kirkwood_cpufreq_init(); 203 kirkwood_cpufreq_init();
124 kirkwood_cpuidle_init(); 204 kirkwood_cpuidle_init();
125 205
126 kirkwood_pm_init(); 206 kirkwood_pm_init();
127 kirkwood_dt_eth_fixup(); 207 kirkwood_dt_eth_fixup();
128 208
129#ifdef CONFIG_KEXEC
130 kexec_reinit = kirkwood_enable_pcie;
131#endif
132
133 if (of_machine_is_compatible("marvell,mv88f6281gtw-ge"))
134 mv88f6281gtw_ge_init();
135
136 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 209 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
137} 210}
138 211
diff --git a/arch/arm/mach-kirkwood/board-mv88f6281gtw_ge.c b/arch/arm/mach-kirkwood/board-mv88f6281gtw_ge.c
deleted file mode 100644
index ee5eea678c11..000000000000
--- a/arch/arm/mach-kirkwood/board-mv88f6281gtw_ge.c
+++ /dev/null
@@ -1,50 +0,0 @@
1/*
2 * arch/arm/mach-kirkwood/board-mv88f6281gtw_ge.c
3 *
4 * Marvell 88F6281 GTW GE Board Setup
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/platform_device.h>
14#include <linux/irq.h>
15#include <linux/timer.h>
16#include <linux/mv643xx_eth.h>
17#include <linux/ethtool.h>
18#include <linux/gpio.h>
19#include <net/dsa.h>
20#include <asm/mach-types.h>
21#include <asm/mach/arch.h>
22#include <asm/mach/pci.h>
23#include <mach/kirkwood.h>
24#include "common.h"
25
26static struct mv643xx_eth_platform_data mv88f6281gtw_ge_ge00_data = {
27 .phy_addr = MV643XX_ETH_PHY_NONE,
28 .speed = SPEED_1000,
29 .duplex = DUPLEX_FULL,
30};
31
32static struct dsa_chip_data mv88f6281gtw_ge_switch_chip_data = {
33 .port_names[0] = "lan1",
34 .port_names[1] = "lan2",
35 .port_names[2] = "lan3",
36 .port_names[3] = "lan4",
37 .port_names[4] = "wan",
38 .port_names[5] = "cpu",
39};
40
41static struct dsa_platform_data mv88f6281gtw_ge_switch_plat_data = {
42 .nr_chips = 1,
43 .chip = &mv88f6281gtw_ge_switch_chip_data,
44};
45
46void __init mv88f6281gtw_ge_init(void)
47{
48 kirkwood_ge00_init(&mv88f6281gtw_ge_ge00_data);
49 kirkwood_ge00_switch_init(&mv88f6281gtw_ge_switch_plat_data, NO_IRQ);
50}
diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c
index f3407a5db216..255f33a3903c 100644
--- a/arch/arm/mach-kirkwood/common.c
+++ b/arch/arm/mach-kirkwood/common.c
@@ -25,10 +25,10 @@
25#include <asm/page.h> 25#include <asm/page.h>
26#include <asm/mach/map.h> 26#include <asm/mach/map.h>
27#include <asm/mach/time.h> 27#include <asm/mach/time.h>
28#include <asm/hardware/cache-feroceon-l2.h>
28#include <mach/kirkwood.h> 29#include <mach/kirkwood.h>
29#include <mach/bridge-regs.h> 30#include <mach/bridge-regs.h>
30#include <linux/platform_data/asoc-kirkwood.h> 31#include <linux/platform_data/asoc-kirkwood.h>
31#include <plat/cache-feroceon-l2.h>
32#include <linux/platform_data/mmc-mvsdio.h> 32#include <linux/platform_data/mmc-mvsdio.h>
33#include <linux/platform_data/mtd-orion_nand.h> 33#include <linux/platform_data/mtd-orion_nand.h>
34#include <linux/platform_data/usb-ehci-orion.h> 34#include <linux/platform_data/usb-ehci-orion.h>
@@ -36,6 +36,7 @@
36#include <plat/time.h> 36#include <plat/time.h>
37#include <linux/platform_data/dma-mv_xor.h> 37#include <linux/platform_data/dma-mv_xor.h>
38#include "common.h" 38#include "common.h"
39#include "pm.h"
39 40
40/* These can go away once Kirkwood uses the mvebu-mbus DT binding */ 41/* These can go away once Kirkwood uses the mvebu-mbus DT binding */
41#define KIRKWOOD_MBUS_NAND_TARGET 0x01 42#define KIRKWOOD_MBUS_NAND_TARGET 0x01
diff --git a/arch/arm/mach-kirkwood/common.h b/arch/arm/mach-kirkwood/common.h
index 05fd648df543..832a4e2ab8d7 100644
--- a/arch/arm/mach-kirkwood/common.h
+++ b/arch/arm/mach-kirkwood/common.h
@@ -58,19 +58,6 @@ void kirkwood_cpufreq_init(void);
58void kirkwood_restart(enum reboot_mode, const char *); 58void kirkwood_restart(enum reboot_mode, const char *);
59void kirkwood_clk_init(void); 59void kirkwood_clk_init(void);
60 60
61#ifdef CONFIG_PM
62void kirkwood_pm_init(void);
63#else
64static inline void kirkwood_pm_init(void) {};
65#endif
66
67/* board init functions for boards not fully converted to fdt */
68#ifdef CONFIG_MACH_MV88F6281GTW_GE_DT
69void mv88f6281gtw_ge_init(void);
70#else
71static inline void mv88f6281gtw_ge_init(void) {};
72#endif
73
74/* early init functions not converted to fdt yet */ 61/* early init functions not converted to fdt yet */
75char *kirkwood_id(void); 62char *kirkwood_id(void);
76void kirkwood_l2_init(void); 63void kirkwood_l2_init(void);
diff --git a/arch/arm/mach-kirkwood/include/mach/bridge-regs.h b/arch/arm/mach-kirkwood/include/mach/bridge-regs.h
index 8b9d1c9ff199..6e5077e2ec26 100644
--- a/arch/arm/mach-kirkwood/include/mach/bridge-regs.h
+++ b/arch/arm/mach-kirkwood/include/mach/bridge-regs.h
@@ -14,6 +14,7 @@
14#include <mach/kirkwood.h> 14#include <mach/kirkwood.h>
15 15
16#define CPU_CONFIG (BRIDGE_VIRT_BASE + 0x0100) 16#define CPU_CONFIG (BRIDGE_VIRT_BASE + 0x0100)
17#define CPU_CONFIG_PHYS (BRIDGE_PHYS_BASE + 0x0100)
17#define CPU_CONFIG_ERROR_PROP 0x00000004 18#define CPU_CONFIG_ERROR_PROP 0x00000004
18 19
19#define CPU_CONTROL (BRIDGE_VIRT_BASE + 0x0104) 20#define CPU_CONTROL (BRIDGE_VIRT_BASE + 0x0104)
@@ -79,5 +80,6 @@
79#define CGC_RESERVED (0x6 << 21) 80#define CGC_RESERVED (0x6 << 21)
80 81
81#define MEMORY_PM_CTRL (BRIDGE_VIRT_BASE + 0x118) 82#define MEMORY_PM_CTRL (BRIDGE_VIRT_BASE + 0x118)
83#define MEMORY_PM_CTRL_PHYS (BRIDGE_PHYS_BASE + 0x118)
82 84
83#endif 85#endif
diff --git a/arch/arm/mach-kirkwood/pm.c b/arch/arm/mach-kirkwood/pm.c
index c6ab8d9303a5..8e5e0329d04c 100644
--- a/arch/arm/mach-kirkwood/pm.c
+++ b/arch/arm/mach-kirkwood/pm.c
@@ -21,15 +21,16 @@
21#include "common.h" 21#include "common.h"
22 22
23static void __iomem *ddr_operation_base; 23static void __iomem *ddr_operation_base;
24static void __iomem *memory_pm_ctrl;
24 25
25static void kirkwood_low_power(void) 26static void kirkwood_low_power(void)
26{ 27{
27 u32 mem_pm_ctrl; 28 u32 mem_pm_ctrl;
28 29
29 mem_pm_ctrl = readl(MEMORY_PM_CTRL); 30 mem_pm_ctrl = readl(memory_pm_ctrl);
30 31
31 /* Set peripherals to low-power mode */ 32 /* Set peripherals to low-power mode */
32 writel_relaxed(~0, MEMORY_PM_CTRL); 33 writel_relaxed(~0, memory_pm_ctrl);
33 34
34 /* Set DDR in self-refresh */ 35 /* Set DDR in self-refresh */
35 writel_relaxed(0x7, ddr_operation_base); 36 writel_relaxed(0x7, ddr_operation_base);
@@ -41,7 +42,7 @@ static void kirkwood_low_power(void)
41 */ 42 */
42 cpu_do_idle(); 43 cpu_do_idle();
43 44
44 writel_relaxed(mem_pm_ctrl, MEMORY_PM_CTRL); 45 writel_relaxed(mem_pm_ctrl, memory_pm_ctrl);
45} 46}
46 47
47static int kirkwood_suspend_enter(suspend_state_t state) 48static int kirkwood_suspend_enter(suspend_state_t state)
@@ -69,5 +70,7 @@ static const struct platform_suspend_ops kirkwood_suspend_ops = {
69void __init kirkwood_pm_init(void) 70void __init kirkwood_pm_init(void)
70{ 71{
71 ddr_operation_base = ioremap(DDR_OPERATION_BASE, 4); 72 ddr_operation_base = ioremap(DDR_OPERATION_BASE, 4);
73 memory_pm_ctrl = ioremap(MEMORY_PM_CTRL_PHYS, 4);
74
72 suspend_set_ops(&kirkwood_suspend_ops); 75 suspend_set_ops(&kirkwood_suspend_ops);
73} 76}
diff --git a/arch/arm/mach-kirkwood/pm.h b/arch/arm/mach-kirkwood/pm.h
new file mode 100644
index 000000000000..21e7530f368b
--- /dev/null
+++ b/arch/arm/mach-kirkwood/pm.h
@@ -0,0 +1,26 @@
1/*
2 * Power Management driver for Marvell Kirkwood SoCs
3 *
4 * Copyright (C) 2013 Ezequiel Garcia <ezequiel@free-electrons.com>
5 * Copyright (C) 2010 Simon Guinot <sguinot@lacie.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License,
9 * version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16
17#ifndef __ARCH_KIRKWOOD_PM_H
18#define __ARCH_KIRKWOOD_PM_H
19
20#ifdef CONFIG_PM
21void kirkwood_pm_init(void);
22#else
23static inline void kirkwood_pm_init(void) {};
24#endif
25
26#endif
diff --git a/arch/arm/mach-msm/common.h b/arch/arm/mach-msm/common.h
index 0a4899b7d85c..572479a3c7be 100644
--- a/arch/arm/mach-msm/common.h
+++ b/arch/arm/mach-msm/common.h
@@ -23,8 +23,6 @@ extern void msm_map_qsd8x50_io(void);
23extern void __iomem *__msm_ioremap_caller(phys_addr_t phys_addr, size_t size, 23extern void __iomem *__msm_ioremap_caller(phys_addr_t phys_addr, size_t size,
24 unsigned int mtype, void *caller); 24 unsigned int mtype, void *caller);
25 25
26extern struct smp_operations msm_smp_ops;
27
28struct msm_mmc_platform_data; 26struct msm_mmc_platform_data;
29 27
30extern void msm_add_devices(void); 28extern void msm_add_devices(void);
diff --git a/arch/arm/mach-mv78xx0/common.c b/arch/arm/mach-mv78xx0/common.c
index 75062eff2494..e6ac679bece9 100644
--- a/arch/arm/mach-mv78xx0/common.c
+++ b/arch/arm/mach-mv78xx0/common.c
@@ -15,11 +15,11 @@
15#include <linux/ata_platform.h> 15#include <linux/ata_platform.h>
16#include <linux/clk-provider.h> 16#include <linux/clk-provider.h>
17#include <linux/ethtool.h> 17#include <linux/ethtool.h>
18#include <asm/hardware/cache-feroceon-l2.h>
18#include <asm/mach/map.h> 19#include <asm/mach/map.h>
19#include <asm/mach/time.h> 20#include <asm/mach/time.h>
20#include <mach/mv78xx0.h> 21#include <mach/mv78xx0.h>
21#include <mach/bridge-regs.h> 22#include <mach/bridge-regs.h>
22#include <plat/cache-feroceon-l2.h>
23#include <linux/platform_data/usb-ehci-orion.h> 23#include <linux/platform_data/usb-ehci-orion.h>
24#include <linux/platform_data/mtd-orion_nand.h> 24#include <linux/platform_data/mtd-orion_nand.h>
25#include <plat/time.h> 25#include <plat/time.h>
diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig
index ca004aceaf8e..3f73eecbcfb0 100644
--- a/arch/arm/mach-mvebu/Kconfig
+++ b/arch/arm/mach-mvebu/Kconfig
@@ -1,5 +1,5 @@
1config ARCH_MVEBU 1config ARCH_MVEBU
2 bool "Marvell SOCs with Device Tree support" if ARCH_MULTI_V7 2 bool "Marvell Engineering Business Unit (MVEBU) SoCs" if (ARCH_MULTI_V7 || ARCH_MULTI_V5)
3 select ARCH_SUPPORTS_BIG_ENDIAN 3 select ARCH_SUPPORTS_BIG_ENDIAN
4 select CLKSRC_MMIO 4 select CLKSRC_MMIO
5 select GENERIC_IRQ_CHIP 5 select GENERIC_IRQ_CHIP
@@ -15,32 +15,95 @@ config ARCH_MVEBU
15 15
16if ARCH_MVEBU 16if ARCH_MVEBU
17 17
18menu "Marvell SOC with device tree" 18menu "Marvell EBU SoC variants"
19 19
20config MACH_ARMADA_370_XP 20config MACH_MVEBU_V7
21 bool 21 bool
22 select ARMADA_370_XP_TIMER 22 select ARMADA_370_XP_TIMER
23 select CACHE_L2X0 23 select CACHE_L2X0
24 select CPU_PJ4B
25 24
26config MACH_ARMADA_370 25config MACH_ARMADA_370
27 bool "Marvell Armada 370 boards" 26 bool "Marvell Armada 370 boards" if ARCH_MULTI_V7
28 select ARMADA_370_CLK 27 select ARMADA_370_CLK
29 select MACH_ARMADA_370_XP 28 select CPU_PJ4B
29 select MACH_MVEBU_V7
30 select PINCTRL_ARMADA_370 30 select PINCTRL_ARMADA_370
31 help 31 help
32 Say 'Y' here if you want your kernel to support boards based 32 Say 'Y' here if you want your kernel to support boards based
33 on the Marvell Armada 370 SoC with device tree. 33 on the Marvell Armada 370 SoC with device tree.
34 34
35config MACH_ARMADA_375
36 bool "Marvell Armada 375 boards" if ARCH_MULTI_V7
37 select ARM_ERRATA_720789
38 select ARM_ERRATA_753970
39 select ARM_GIC
40 select ARMADA_375_CLK
41 select CPU_V7
42 select MACH_MVEBU_V7
43 select PINCTRL_ARMADA_375
44 help
45 Say 'Y' here if you want your kernel to support boards based
46 on the Marvell Armada 375 SoC with device tree.
47
48config MACH_ARMADA_38X
49 bool "Marvell Armada 380/385 boards" if ARCH_MULTI_V7
50 select ARM_ERRATA_720789
51 select ARM_ERRATA_753970
52 select ARM_GIC
53 select ARMADA_38X_CLK
54 select CPU_V7
55 select MACH_MVEBU_V7
56 select PINCTRL_ARMADA_38X
57 help
58 Say 'Y' here if you want your kernel to support boards based
59 on the Marvell Armada 380/385 SoC with device tree.
60
35config MACH_ARMADA_XP 61config MACH_ARMADA_XP
36 bool "Marvell Armada XP boards" 62 bool "Marvell Armada XP boards" if ARCH_MULTI_V7
37 select ARMADA_XP_CLK 63 select ARMADA_XP_CLK
38 select MACH_ARMADA_370_XP 64 select CPU_PJ4B
65 select MACH_MVEBU_V7
39 select PINCTRL_ARMADA_XP 66 select PINCTRL_ARMADA_XP
40 help 67 help
41 Say 'Y' here if you want your kernel to support boards based 68 Say 'Y' here if you want your kernel to support boards based
42 on the Marvell Armada XP SoC with device tree. 69 on the Marvell Armada XP SoC with device tree.
43 70
71config MACH_DOVE
72 bool "Marvell Dove boards" if ARCH_MULTI_V7
73 select CACHE_L2X0
74 select CPU_PJ4
75 select DOVE_CLK
76 select ORION_IRQCHIP
77 select ORION_TIMER
78 select PINCTRL_DOVE
79 help
80 Say 'Y' here if you want your kernel to support the
81 Marvell Dove using flattened device tree.
82
83config MACH_KIRKWOOD
84 bool "Marvell Kirkwood boards" if ARCH_MULTI_V5
85 select ARCH_HAS_CPUFREQ
86 select ARCH_REQUIRE_GPIOLIB
87 select CPU_FEROCEON
88 select KIRKWOOD_CLK
89 select OF_IRQ
90 select ORION_IRQCHIP
91 select ORION_TIMER
92 select PCI
93 select PCI_QUIRKS
94 select PINCTRL_KIRKWOOD
95 select USE_OF
96 help
97 Say 'Y' here if you want your kernel to support boards based
98 on the Marvell Kirkwood device tree.
99
100config MACH_T5325
101 bool "HP T5325 thin client"
102 depends on MACH_KIRKWOOD
103 help
104 Say 'Y' here if you want your kernel to support the
105 HP T5325 Thin client
106
44endmenu 107endmenu
45 108
46endif 109endif
diff --git a/arch/arm/mach-mvebu/Makefile b/arch/arm/mach-mvebu/Makefile
index d99846103bbb..a63e43b6b451 100644
--- a/arch/arm/mach-mvebu/Makefile
+++ b/arch/arm/mach-mvebu/Makefile
@@ -3,7 +3,11 @@ ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include \
3 3
4AFLAGS_coherency_ll.o := -Wa,-march=armv7-a 4AFLAGS_coherency_ll.o := -Wa,-march=armv7-a
5 5
6obj-y += coherency.o coherency_ll.o pmsu.o system-controller.o mvebu-soc-id.o 6obj-y += system-controller.o mvebu-soc-id.o
7obj-$(CONFIG_MACH_ARMADA_370_XP) += armada-370-xp.o 7obj-$(CONFIG_MACH_MVEBU_V7) += board-v7.o
8obj-$(CONFIG_MACH_DOVE) += dove.o
9obj-$(CONFIG_ARCH_MVEBU) += coherency.o coherency_ll.o pmsu.o
8obj-$(CONFIG_SMP) += platsmp.o headsmp.o 10obj-$(CONFIG_SMP) += platsmp.o headsmp.o
9obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o 11obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
12obj-$(CONFIG_MACH_KIRKWOOD) += kirkwood.o kirkwood-pm.o
13obj-$(CONFIG_MACH_T5325) += board-t5325.o
diff --git a/arch/arm/mach-mvebu/board-t5325.c b/arch/arm/mach-mvebu/board-t5325.c
new file mode 100644
index 000000000000..65ace6db9f28
--- /dev/null
+++ b/arch/arm/mach-mvebu/board-t5325.c
@@ -0,0 +1,41 @@
1/*
2 * HP T5325 Board Setup
3 *
4 * Copyright (C) 2014
5 *
6 * Andrew Lunn <andrew@lunn.ch>
7 *
8 * This file is licensed under the terms of the GNU General Public
9 * License version 2. This program is licensed "as is" without any
10 * warranty of any kind, whether express or implied.
11 */
12
13#include <linux/kernel.h>
14#include <linux/i2c.h>
15#include <linux/init.h>
16#include <linux/platform_device.h>
17#include <sound/alc5623.h>
18#include "board.h"
19
20static struct platform_device hp_t5325_audio_device = {
21 .name = "t5325-audio",
22 .id = -1,
23};
24
25static struct alc5623_platform_data alc5621_data = {
26 .add_ctrl = 0x3700,
27 .jack_det_ctrl = 0x4810,
28};
29
30static struct i2c_board_info i2c_board_info[] __initdata = {
31 {
32 I2C_BOARD_INFO("alc5621", 0x1a),
33 .platform_data = &alc5621_data,
34 },
35};
36
37void __init t5325_init(void)
38{
39 i2c_register_board_info(0, i2c_board_info, ARRAY_SIZE(i2c_board_info));
40 platform_device_register(&hp_t5325_audio_device);
41}
diff --git a/arch/arm/mach-mvebu/armada-370-xp.c b/arch/arm/mach-mvebu/board-v7.c
index a57cb36d52af..333fca8fdc41 100644
--- a/arch/arm/mach-mvebu/armada-370-xp.c
+++ b/arch/arm/mach-mvebu/board-v7.c
@@ -32,7 +32,28 @@
32#include "coherency.h" 32#include "coherency.h"
33#include "mvebu-soc-id.h" 33#include "mvebu-soc-id.h"
34 34
35static void __init armada_370_xp_timer_and_clk_init(void) 35/*
36 * Early versions of Armada 375 SoC have a bug where the BootROM
37 * leaves an external data abort pending. The kernel is hit by this
38 * data abort as soon as it enters userspace, because it unmasks the
39 * data aborts at this moment. We register a custom abort handler
40 * below to ignore the first data abort to work around this
41 * problem.
42 */
43static int armada_375_external_abort_wa(unsigned long addr, unsigned int fsr,
44 struct pt_regs *regs)
45{
46 static int ignore_first;
47
48 if (!ignore_first && fsr == 0x1406) {
49 ignore_first = 1;
50 return 0;
51 }
52
53 return 1;
54}
55
56static void __init mvebu_timer_and_clk_init(void)
36{ 57{
37 of_clk_init(NULL); 58 of_clk_init(NULL);
38 clocksource_of_init(); 59 clocksource_of_init();
@@ -41,6 +62,10 @@ static void __init armada_370_xp_timer_and_clk_init(void)
41#ifdef CONFIG_CACHE_L2X0 62#ifdef CONFIG_CACHE_L2X0
42 l2x0_of_init(0, ~0UL); 63 l2x0_of_init(0, ~0UL);
43#endif 64#endif
65
66 if (of_machine_is_compatible("marvell,armada375"))
67 hook_fault_code(16 + 6, armada_375_external_abort_wa, SIGBUS, 0,
68 "imprecise external abort");
44} 69}
45 70
46static void __init i2c_quirk(void) 71static void __init i2c_quirk(void)
@@ -71,7 +96,7 @@ static void __init i2c_quirk(void)
71 return; 96 return;
72} 97}
73 98
74static void __init armada_370_xp_dt_init(void) 99static void __init mvebu_dt_init(void)
75{ 100{
76 if (of_machine_is_compatible("plathome,openblocks-ax3-4")) 101 if (of_machine_is_compatible("plathome,openblocks-ax3-4"))
77 i2c_quirk(); 102 i2c_quirk();
@@ -83,10 +108,33 @@ static const char * const armada_370_xp_dt_compat[] = {
83 NULL, 108 NULL,
84}; 109};
85 110
86DT_MACHINE_START(ARMADA_XP_DT, "Marvell Armada 370/XP (Device Tree)") 111DT_MACHINE_START(ARMADA_370_XP_DT, "Marvell Armada 370/XP (Device Tree)")
87 .smp = smp_ops(armada_xp_smp_ops), 112 .smp = smp_ops(armada_xp_smp_ops),
88 .init_machine = armada_370_xp_dt_init, 113 .init_machine = mvebu_dt_init,
89 .init_time = armada_370_xp_timer_and_clk_init, 114 .init_time = mvebu_timer_and_clk_init,
90 .restart = mvebu_restart, 115 .restart = mvebu_restart,
91 .dt_compat = armada_370_xp_dt_compat, 116 .dt_compat = armada_370_xp_dt_compat,
92MACHINE_END 117MACHINE_END
118
119static const char * const armada_375_dt_compat[] = {
120 "marvell,armada375",
121 NULL,
122};
123
124DT_MACHINE_START(ARMADA_375_DT, "Marvell Armada 375 (Device Tree)")
125 .init_time = mvebu_timer_and_clk_init,
126 .restart = mvebu_restart,
127 .dt_compat = armada_375_dt_compat,
128MACHINE_END
129
130static const char * const armada_38x_dt_compat[] = {
131 "marvell,armada380",
132 "marvell,armada385",
133 NULL,
134};
135
136DT_MACHINE_START(ARMADA_38X_DT, "Marvell Armada 380/385 (Device Tree)")
137 .init_time = mvebu_timer_and_clk_init,
138 .restart = mvebu_restart,
139 .dt_compat = armada_38x_dt_compat,
140MACHINE_END
diff --git a/arch/arm/mach-mvebu/board.h b/arch/arm/mach-mvebu/board.h
new file mode 100644
index 000000000000..de7f0a191394
--- /dev/null
+++ b/arch/arm/mach-mvebu/board.h
@@ -0,0 +1,22 @@
1/*
2 * Board functions for Marvell System On Chip
3 *
4 * Copyright (C) 2014
5 *
6 * Andrew Lunn <andrew@lunn.ch>
7 *
8 * This file is licensed under the terms of the GNU General Public
9 * License version 2. This program is licensed "as is" without any
10 * warranty of any kind, whether express or implied.
11 */
12
13#ifndef __ARCH_MVEBU_BOARD_H
14#define __ARCH_MVEBU_BOARD_H
15
16#ifdef CONFIG_MACH_T5325
17void t5325_init(void);
18#else
19static inline void t5325_init(void) {};
20#endif
21
22#endif
diff --git a/arch/arm/mach-dove/board-dt.c b/arch/arm/mach-mvebu/dove.c
index 49fa9abd09da..5e5a43624237 100644
--- a/arch/arm/mach-dove/board-dt.c
+++ b/arch/arm/mach-mvebu/dove.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * arch/arm/mach-dove/board-dt.c 2 * arch/arm/mach-mvebu/dove.c
3 * 3 *
4 * Marvell Dove 88AP510 System On Chip FDT Board 4 * Marvell Dove 88AP510 System On Chip FDT Board
5 * 5 *
@@ -9,17 +9,14 @@
9 */ 9 */
10 10
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/clk-provider.h> 12#include <linux/mbus.h>
13#include <linux/of.h> 13#include <linux/of.h>
14#include <linux/of_platform.h> 14#include <linux/of_platform.h>
15#include <asm/hardware/cache-tauros2.h> 15#include <asm/hardware/cache-tauros2.h>
16#include <asm/mach/arch.h> 16#include <asm/mach/arch.h>
17#include <mach/dove.h>
18#include <mach/pm.h>
19#include <plat/common.h>
20#include "common.h" 17#include "common.h"
21 18
22static void __init dove_dt_init(void) 19static void __init dove_init(void)
23{ 20{
24 pr_info("Dove 88AP510 SoC\n"); 21 pr_info("Dove 88AP510 SoC\n");
25 22
@@ -30,14 +27,13 @@ static void __init dove_dt_init(void)
30 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 27 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
31} 28}
32 29
33static const char * const dove_dt_board_compat[] = { 30static const char * const dove_dt_compat[] = {
34 "marvell,dove", 31 "marvell,dove",
35 NULL 32 NULL
36}; 33};
37 34
38DT_MACHINE_START(DOVE_DT, "Marvell Dove (Flattened Device Tree)") 35DT_MACHINE_START(DOVE_DT, "Marvell Dove")
39 .map_io = dove_map_io, 36 .init_machine = dove_init,
40 .init_machine = dove_dt_init, 37 .restart = mvebu_restart,
41 .restart = dove_restart, 38 .dt_compat = dove_dt_compat,
42 .dt_compat = dove_dt_board_compat,
43MACHINE_END 39MACHINE_END
diff --git a/arch/arm/mach-mvebu/kirkwood-pm.c b/arch/arm/mach-mvebu/kirkwood-pm.c
new file mode 100644
index 000000000000..cbb816f2120c
--- /dev/null
+++ b/arch/arm/mach-mvebu/kirkwood-pm.c
@@ -0,0 +1,76 @@
1/*
2 * Power Management driver for Marvell Kirkwood SoCs
3 *
4 * Copyright (C) 2013 Ezequiel Garcia <ezequiel@free-electrons.com>
5 * Copyright (C) 2010 Simon Guinot <sguinot@lacie.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License,
9 * version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16
17#include <linux/kernel.h>
18#include <linux/suspend.h>
19#include <linux/io.h>
20#include "kirkwood.h"
21
22static void __iomem *ddr_operation_base;
23static void __iomem *memory_pm_ctrl;
24
25static void kirkwood_low_power(void)
26{
27 u32 mem_pm_ctrl;
28
29 mem_pm_ctrl = readl(memory_pm_ctrl);
30
31 /* Set peripherals to low-power mode */
32 writel_relaxed(~0, memory_pm_ctrl);
33
34 /* Set DDR in self-refresh */
35 writel_relaxed(0x7, ddr_operation_base);
36
37 /*
38 * Set CPU in wait-for-interrupt state.
39 * This disables the CPU core clocks,
40 * the array clocks, and also the L2 controller.
41 */
42 cpu_do_idle();
43
44 writel_relaxed(mem_pm_ctrl, memory_pm_ctrl);
45}
46
47static int kirkwood_suspend_enter(suspend_state_t state)
48{
49 switch (state) {
50 case PM_SUSPEND_STANDBY:
51 kirkwood_low_power();
52 break;
53 default:
54 return -EINVAL;
55 }
56 return 0;
57}
58
59static int kirkwood_pm_valid_standby(suspend_state_t state)
60{
61 return state == PM_SUSPEND_STANDBY;
62}
63
64static const struct platform_suspend_ops kirkwood_suspend_ops = {
65 .enter = kirkwood_suspend_enter,
66 .valid = kirkwood_pm_valid_standby,
67};
68
69int __init kirkwood_pm_init(void)
70{
71 ddr_operation_base = ioremap(DDR_OPERATION_BASE, 4);
72 memory_pm_ctrl = ioremap(MEMORY_PM_CTRL_PHYS, 4);
73
74 suspend_set_ops(&kirkwood_suspend_ops);
75 return 0;
76}
diff --git a/arch/arm/mach-mvebu/kirkwood-pm.h b/arch/arm/mach-mvebu/kirkwood-pm.h
new file mode 100644
index 000000000000..21e7530f368b
--- /dev/null
+++ b/arch/arm/mach-mvebu/kirkwood-pm.h
@@ -0,0 +1,26 @@
1/*
2 * Power Management driver for Marvell Kirkwood SoCs
3 *
4 * Copyright (C) 2013 Ezequiel Garcia <ezequiel@free-electrons.com>
5 * Copyright (C) 2010 Simon Guinot <sguinot@lacie.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License,
9 * version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16
17#ifndef __ARCH_KIRKWOOD_PM_H
18#define __ARCH_KIRKWOOD_PM_H
19
20#ifdef CONFIG_PM
21void kirkwood_pm_init(void);
22#else
23static inline void kirkwood_pm_init(void) {};
24#endif
25
26#endif
diff --git a/arch/arm/mach-mvebu/kirkwood.c b/arch/arm/mach-mvebu/kirkwood.c
new file mode 100644
index 000000000000..120207fc36f1
--- /dev/null
+++ b/arch/arm/mach-mvebu/kirkwood.c
@@ -0,0 +1,199 @@
1/*
2 * Copyright 2012 (C), Jason Cooper <jason@lakedaemon.net>
3 *
4 * arch/arm/mach-mvebu/kirkwood.c
5 *
6 * Flattened Device Tree board initialization
7 *
8 * This file is licensed under the terms of the GNU General Public
9 * License version 2. This program is licensed "as is" without any
10 * warranty of any kind, whether express or implied.
11 */
12
13#include <linux/clk.h>
14#include <linux/kernel.h>
15#include <linux/init.h>
16#include <linux/mbus.h>
17#include <linux/of.h>
18#include <linux/of_address.h>
19#include <linux/of_net.h>
20#include <linux/of_platform.h>
21#include <linux/slab.h>
22#include <asm/hardware/cache-feroceon-l2.h>
23#include <asm/mach/arch.h>
24#include <asm/mach/map.h>
25#include "kirkwood.h"
26#include "kirkwood-pm.h"
27#include "common.h"
28#include "board.h"
29
30static struct resource kirkwood_cpufreq_resources[] = {
31 [0] = {
32 .start = CPU_CONTROL_PHYS,
33 .end = CPU_CONTROL_PHYS + 3,
34 .flags = IORESOURCE_MEM,
35 },
36};
37
38static struct platform_device kirkwood_cpufreq_device = {
39 .name = "kirkwood-cpufreq",
40 .id = -1,
41 .num_resources = ARRAY_SIZE(kirkwood_cpufreq_resources),
42 .resource = kirkwood_cpufreq_resources,
43};
44
45static void __init kirkwood_cpufreq_init(void)
46{
47 platform_device_register(&kirkwood_cpufreq_device);
48}
49
50static struct resource kirkwood_cpuidle_resource[] = {
51 {
52 .flags = IORESOURCE_MEM,
53 .start = DDR_OPERATION_BASE,
54 .end = DDR_OPERATION_BASE + 3,
55 },
56};
57
58static struct platform_device kirkwood_cpuidle = {
59 .name = "kirkwood_cpuidle",
60 .id = -1,
61 .resource = kirkwood_cpuidle_resource,
62 .num_resources = 1,
63};
64
65static void __init kirkwood_cpuidle_init(void)
66{
67 platform_device_register(&kirkwood_cpuidle);
68}
69
70#define MV643XX_ETH_MAC_ADDR_LOW 0x0414
71#define MV643XX_ETH_MAC_ADDR_HIGH 0x0418
72
73static void __init kirkwood_dt_eth_fixup(void)
74{
75 struct device_node *np;
76
77 /*
78 * The ethernet interfaces forget the MAC address assigned by u-boot
79 * if the clocks are turned off. Usually, u-boot on kirkwood boards
80 * has no DT support to properly set local-mac-address property.
81 * As a workaround, we get the MAC address from mv643xx_eth registers
82 * and update the port device node if no valid MAC address is set.
83 */
84 for_each_compatible_node(np, NULL, "marvell,kirkwood-eth-port") {
85 struct device_node *pnp = of_get_parent(np);
86 struct clk *clk;
87 struct property *pmac;
88 void __iomem *io;
89 u8 *macaddr;
90 u32 reg;
91
92 if (!pnp)
93 continue;
94
95 /* skip disabled nodes or nodes with valid MAC address*/
96 if (!of_device_is_available(pnp) || of_get_mac_address(np))
97 goto eth_fixup_skip;
98
99 clk = of_clk_get(pnp, 0);
100 if (IS_ERR(clk))
101 goto eth_fixup_skip;
102
103 io = of_iomap(pnp, 0);
104 if (!io)
105 goto eth_fixup_no_map;
106
107 /* ensure port clock is not gated to not hang CPU */
108 clk_prepare_enable(clk);
109
110 /* store MAC address register contents in local-mac-address */
111 pr_err(FW_INFO "%s: local-mac-address is not set\n",
112 np->full_name);
113
114 pmac = kzalloc(sizeof(*pmac) + 6, GFP_KERNEL);
115 if (!pmac)
116 goto eth_fixup_no_mem;
117
118 pmac->value = pmac + 1;
119 pmac->length = 6;
120 pmac->name = kstrdup("local-mac-address", GFP_KERNEL);
121 if (!pmac->name) {
122 kfree(pmac);
123 goto eth_fixup_no_mem;
124 }
125
126 macaddr = pmac->value;
127 reg = readl(io + MV643XX_ETH_MAC_ADDR_HIGH);
128 macaddr[0] = (reg >> 24) & 0xff;
129 macaddr[1] = (reg >> 16) & 0xff;
130 macaddr[2] = (reg >> 8) & 0xff;
131 macaddr[3] = reg & 0xff;
132
133 reg = readl(io + MV643XX_ETH_MAC_ADDR_LOW);
134 macaddr[4] = (reg >> 8) & 0xff;
135 macaddr[5] = reg & 0xff;
136
137 of_update_property(np, pmac);
138
139eth_fixup_no_mem:
140 iounmap(io);
141 clk_disable_unprepare(clk);
142eth_fixup_no_map:
143 clk_put(clk);
144eth_fixup_skip:
145 of_node_put(pnp);
146 }
147}
148
149/*
150 * Disable propagation of mbus errors to the CPU local bus, as this
151 * causes mbus errors (which can occur for example for PCI aborts) to
152 * throw CPU aborts, which we're not set up to deal with.
153 */
154void kirkwood_disable_mbus_error_propagation(void)
155{
156 void __iomem *cpu_config;
157
158 cpu_config = ioremap(CPU_CONFIG_PHYS, 4);
159 writel(readl(cpu_config) & ~CPU_CONFIG_ERROR_PROP, cpu_config);
160}
161
162static struct of_dev_auxdata auxdata[] __initdata = {
163 OF_DEV_AUXDATA("marvell,kirkwood-audio", 0xf10a0000,
164 "mvebu-audio", NULL),
165 { /* sentinel */ }
166};
167
168static void __init kirkwood_dt_init(void)
169{
170 kirkwood_disable_mbus_error_propagation();
171
172 BUG_ON(mvebu_mbus_dt_init());
173
174#ifdef CONFIG_CACHE_FEROCEON_L2
175 feroceon_of_init();
176#endif
177 kirkwood_cpufreq_init();
178 kirkwood_cpuidle_init();
179
180 kirkwood_pm_init();
181 kirkwood_dt_eth_fixup();
182
183 if (of_machine_is_compatible("hp,t5325"))
184 t5325_init();
185
186 of_platform_populate(NULL, of_default_bus_match_table, auxdata, NULL);
187}
188
189static const char * const kirkwood_dt_board_compat[] = {
190 "marvell,kirkwood",
191 NULL
192};
193
194DT_MACHINE_START(KIRKWOOD_DT, "Marvell Kirkwood (Flattened Device Tree)")
195 /* Maintainer: Jason Cooper <jason@lakedaemon.net> */
196 .init_machine = kirkwood_dt_init,
197 .restart = mvebu_restart,
198 .dt_compat = kirkwood_dt_board_compat,
199MACHINE_END
diff --git a/arch/arm/mach-mvebu/kirkwood.h b/arch/arm/mach-mvebu/kirkwood.h
new file mode 100644
index 000000000000..89f3d1f51643
--- /dev/null
+++ b/arch/arm/mach-mvebu/kirkwood.h
@@ -0,0 +1,22 @@
1/*
2 * arch/arm/mach-mvebu/kirkwood.h
3 *
4 * Generic definitions for Marvell Kirkwood SoC flavors:
5 * 88F6180, 88F6192 and 88F6281.
6 *
7 * This file is licensed under the terms of the GNU General Public
8 * License version 2. This program is licensed "as is" without any
9 * warranty of any kind, whether express or implied.
10 */
11
12#define KIRKWOOD_REGS_PHYS_BASE 0xf1000000
13#define DDR_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE + 0x00000)
14#define BRIDGE_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE + 0x20000)
15
16#define DDR_OPERATION_BASE (DDR_PHYS_BASE + 0x1418)
17
18#define CPU_CONFIG_PHYS (BRIDGE_PHYS_BASE + 0x0100)
19#define CPU_CONFIG_ERROR_PROP 0x00000004
20
21#define CPU_CONTROL_PHYS (BRIDGE_PHYS_BASE + 0x0104)
22#define MEMORY_PM_CTRL_PHYS (BRIDGE_PHYS_BASE + 0x0118)
diff --git a/arch/arm/mach-mvebu/mvebu-soc-id.c b/arch/arm/mach-mvebu/mvebu-soc-id.c
index f3b325f6cbd4..f3d4cf53f746 100644
--- a/arch/arm/mach-mvebu/mvebu-soc-id.c
+++ b/arch/arm/mach-mvebu/mvebu-soc-id.c
@@ -38,6 +38,7 @@ static bool is_id_valid;
38static const struct of_device_id mvebu_pcie_of_match_table[] = { 38static const struct of_device_id mvebu_pcie_of_match_table[] = {
39 { .compatible = "marvell,armada-xp-pcie", }, 39 { .compatible = "marvell,armada-xp-pcie", },
40 { .compatible = "marvell,armada-370-pcie", }, 40 { .compatible = "marvell,armada-370-pcie", },
41 { .compatible = "marvell,kirkwood-pcie" },
41 {}, 42 {},
42}; 43};
43 44
diff --git a/arch/arm/mach-mvebu/system-controller.c b/arch/arm/mach-mvebu/system-controller.c
index e6e300afe836..614ba6832ff3 100644
--- a/arch/arm/mach-mvebu/system-controller.c
+++ b/arch/arm/mach-mvebu/system-controller.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * System controller support for Armada 370 and XP platforms. 2 * System controller support for Armada 370, 375 and XP platforms.
3 * 3 *
4 * Copyright (C) 2012 Marvell 4 * Copyright (C) 2012 Marvell
5 * 5 *
@@ -11,7 +11,7 @@
11 * License version 2. This program is licensed "as is" without any 11 * License version 2. This program is licensed "as is" without any
12 * warranty of any kind, whether express or implied. 12 * warranty of any kind, whether express or implied.
13 * 13 *
14 * The Armada 370 and Armada XP SoCs both have a range of 14 * The Armada 370, 375 and Armada XP SoCs have a range of
15 * miscellaneous registers, that do not belong to a particular device, 15 * miscellaneous registers, that do not belong to a particular device,
16 * but rather provide system-level features. This basic 16 * but rather provide system-level features. This basic
17 * system-controller driver provides a device tree binding for those 17 * system-controller driver provides a device tree binding for those
@@ -47,6 +47,13 @@ static const struct mvebu_system_controller armada_370_xp_system_controller = {
47 .system_soft_reset = 0x1, 47 .system_soft_reset = 0x1,
48}; 48};
49 49
50static const struct mvebu_system_controller armada_375_system_controller = {
51 .rstoutn_mask_offset = 0x54,
52 .system_soft_reset_offset = 0x58,
53 .rstoutn_mask_reset_out_en = 0x1,
54 .system_soft_reset = 0x1,
55};
56
50static const struct mvebu_system_controller orion_system_controller = { 57static const struct mvebu_system_controller orion_system_controller = {
51 .rstoutn_mask_offset = 0x108, 58 .rstoutn_mask_offset = 0x108,
52 .system_soft_reset_offset = 0x10c, 59 .system_soft_reset_offset = 0x10c,
@@ -61,6 +68,9 @@ static const struct of_device_id of_system_controller_table[] = {
61 }, { 68 }, {
62 .compatible = "marvell,armada-370-xp-system-controller", 69 .compatible = "marvell,armada-370-xp-system-controller",
63 .data = (void *) &armada_370_xp_system_controller, 70 .data = (void *) &armada_370_xp_system_controller,
71 }, {
72 .compatible = "marvell,armada-375-system-controller",
73 .data = (void *) &armada_375_system_controller,
64 }, 74 },
65 { /* end of list */ }, 75 { /* end of list */ },
66}; 76};
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index 27fc52d418a5..5c22c0899e9c 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -149,12 +149,6 @@ config SOC_TI81XX
149 depends on ARCH_OMAP3 149 depends on ARCH_OMAP3
150 default y 150 default y
151 151
152config OMAP_PACKAGE_ZAF
153 bool
154
155config OMAP_PACKAGE_ZAC
156 bool
157
158config OMAP_PACKAGE_CBC 152config OMAP_PACKAGE_CBC
159 bool 153 bool
160 154
@@ -264,7 +258,6 @@ config MACH_NOKIA_N8X0
264 default y 258 default y
265 select MACH_NOKIA_N810 259 select MACH_NOKIA_N810
266 select MACH_NOKIA_N810_WIMAX 260 select MACH_NOKIA_N810_WIMAX
267 select OMAP_PACKAGE_ZAC
268 261
269config MACH_NOKIA_RX51 262config MACH_NOKIA_RX51
270 bool "Nokia N900 (RX-51) phone" 263 bool "Nokia N900 (RX-51) phone"
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index e6eec6f72fd3..8421f38cf445 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -60,6 +60,7 @@ AFLAGS_sram34xx.o :=-Wa,-march=armv7-a
60obj-$(CONFIG_SOC_OMAP2420) += omap2-restart.o 60obj-$(CONFIG_SOC_OMAP2420) += omap2-restart.o
61obj-$(CONFIG_SOC_OMAP2430) += omap2-restart.o 61obj-$(CONFIG_SOC_OMAP2430) += omap2-restart.o
62obj-$(CONFIG_SOC_AM33XX) += am33xx-restart.o 62obj-$(CONFIG_SOC_AM33XX) += am33xx-restart.o
63obj-$(CONFIG_SOC_AM43XX) += omap4-restart.o
63obj-$(CONFIG_ARCH_OMAP3) += omap3-restart.o 64obj-$(CONFIG_ARCH_OMAP3) += omap3-restart.o
64obj-$(CONFIG_ARCH_OMAP4) += omap4-restart.o 65obj-$(CONFIG_ARCH_OMAP4) += omap4-restart.o
65obj-$(CONFIG_SOC_OMAP5) += omap4-restart.o 66obj-$(CONFIG_SOC_OMAP5) += omap4-restart.o
diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c
index 8e3daa11602b..bc6013fbb773 100644
--- a/arch/arm/mach-omap2/board-generic.c
+++ b/arch/arm/mach-omap2/board-generic.c
@@ -229,8 +229,9 @@ DT_MACHINE_START(AM43_DT, "Generic AM43 (Flattened Device Tree)")
229 .init_late = am43xx_init_late, 229 .init_late = am43xx_init_late,
230 .init_irq = omap_gic_of_init, 230 .init_irq = omap_gic_of_init,
231 .init_machine = omap_generic_init, 231 .init_machine = omap_generic_init,
232 .init_time = omap3_sync32k_timer_init, 232 .init_time = omap3_gptimer_timer_init,
233 .dt_compat = am43_boards_compat, 233 .dt_compat = am43_boards_compat,
234 .restart = omap44xx_restart,
234MACHINE_END 235MACHINE_END
235#endif 236#endif
236 237
diff --git a/arch/arm/mach-omap2/clkt_dpll.c b/arch/arm/mach-omap2/clkt_dpll.c
index 47f9562ca7aa..2649ce445845 100644
--- a/arch/arm/mach-omap2/clkt_dpll.c
+++ b/arch/arm/mach-omap2/clkt_dpll.c
@@ -306,7 +306,7 @@ long omap2_dpll_round_rate(struct clk_hw *hw, unsigned long target_rate,
306 306
307 ref_rate = __clk_get_rate(dd->clk_ref); 307 ref_rate = __clk_get_rate(dd->clk_ref);
308 clk_name = __clk_get_name(hw->clk); 308 clk_name = __clk_get_name(hw->clk);
309 pr_debug("clock: %s: starting DPLL round_rate, target rate %ld\n", 309 pr_debug("clock: %s: starting DPLL round_rate, target rate %lu\n",
310 clk_name, target_rate); 310 clk_name, target_rate);
311 311
312 scaled_rt_rp = target_rate / (ref_rate / DPLL_SCALE_FACTOR); 312 scaled_rt_rp = target_rate / (ref_rate / DPLL_SCALE_FACTOR);
@@ -342,7 +342,7 @@ long omap2_dpll_round_rate(struct clk_hw *hw, unsigned long target_rate,
342 if (r == DPLL_MULT_UNDERFLOW) 342 if (r == DPLL_MULT_UNDERFLOW)
343 continue; 343 continue;
344 344
345 pr_debug("clock: %s: m = %d: n = %d: new_rate = %ld\n", 345 pr_debug("clock: %s: m = %d: n = %d: new_rate = %lu\n",
346 clk_name, m, n, new_rate); 346 clk_name, m, n, new_rate);
347 347
348 if (target_rate == new_rate) { 348 if (target_rate == new_rate) {
@@ -354,7 +354,7 @@ long omap2_dpll_round_rate(struct clk_hw *hw, unsigned long target_rate,
354 } 354 }
355 355
356 if (target_rate != new_rate) { 356 if (target_rate != new_rate) {
357 pr_debug("clock: %s: cannot round to rate %ld\n", 357 pr_debug("clock: %s: cannot round to rate %lu\n",
358 clk_name, target_rate); 358 clk_name, target_rate);
359 return ~0; 359 return ~0;
360 } 360 }
diff --git a/arch/arm/mach-omap2/cminst44xx.c b/arch/arm/mach-omap2/cminst44xx.c
index 731ca134348c..f5c4731b6f06 100644
--- a/arch/arm/mach-omap2/cminst44xx.c
+++ b/arch/arm/mach-omap2/cminst44xx.c
@@ -254,6 +254,11 @@ void omap4_cminst_clkdm_force_wakeup(u8 part, u16 inst, u16 cdoffs)
254 * 254 *
255 */ 255 */
256 256
257void omap4_cminst_clkdm_force_sleep(u8 part, u16 inst, u16 cdoffs)
258{
259 _clktrctrl_write(OMAP34XX_CLKSTCTRL_FORCE_SLEEP, part, inst, cdoffs);
260}
261
257/** 262/**
258 * omap4_cminst_wait_module_ready - wait for a module to be in 'func' state 263 * omap4_cminst_wait_module_ready - wait for a module to be in 'func' state
259 * @part: PRCM partition ID that the CM_CLKCTRL register exists in 264 * @part: PRCM partition ID that the CM_CLKCTRL register exists in
@@ -404,8 +409,17 @@ static int omap4_clkdm_clear_all_wkup_sleep_deps(struct clockdomain *clkdm)
404 409
405static int omap4_clkdm_sleep(struct clockdomain *clkdm) 410static int omap4_clkdm_sleep(struct clockdomain *clkdm)
406{ 411{
407 omap4_cminst_clkdm_enable_hwsup(clkdm->prcm_partition, 412 if (clkdm->flags & CLKDM_CAN_HWSUP)
408 clkdm->cm_inst, clkdm->clkdm_offs); 413 omap4_cminst_clkdm_enable_hwsup(clkdm->prcm_partition,
414 clkdm->cm_inst,
415 clkdm->clkdm_offs);
416 else if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP)
417 omap4_cminst_clkdm_force_sleep(clkdm->prcm_partition,
418 clkdm->cm_inst,
419 clkdm->clkdm_offs);
420 else
421 return -EINVAL;
422
409 return 0; 423 return 0;
410} 424}
411 425
diff --git a/arch/arm/mach-omap2/dpll3xxx.c b/arch/arm/mach-omap2/dpll3xxx.c
index 3c418ea54bbe..fcd8036af910 100644
--- a/arch/arm/mach-omap2/dpll3xxx.c
+++ b/arch/arm/mach-omap2/dpll3xxx.c
@@ -525,7 +525,7 @@ int omap3_noncore_dpll_set_rate(struct clk_hw *hw, unsigned long rate,
525 * stuff is inherited for free 525 * stuff is inherited for free
526 */ 526 */
527 527
528 if (!ret) 528 if (!ret && clk_get_parent(hw->clk) != new_parent)
529 __clk_reparent(hw->clk, new_parent); 529 __clk_reparent(hw->clk, new_parent);
530 530
531 return 0; 531 return 0;
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index 9428c5f9d4f2..157412e4273a 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -465,8 +465,18 @@ void __init omap3xxx_check_revision(void)
465 } 465 }
466 break; 466 break;
467 case 0xb98c: 467 case 0xb98c:
468 omap_revision = AM437X_REV_ES1_0; 468 switch (rev) {
469 cpu_rev = "1.0"; 469 case 0:
470 omap_revision = AM437X_REV_ES1_0;
471 cpu_rev = "1.0";
472 break;
473 case 1:
474 /* FALLTHROUGH */
475 default:
476 omap_revision = AM437X_REV_ES1_1;
477 cpu_rev = "1.1";
478 break;
479 }
470 break; 480 break;
471 case 0xb8f2: 481 case 0xb8f2:
472 switch (rev) { 482 switch (rev) {
@@ -657,6 +667,8 @@ static const char * __init omap_get_family(void)
657 return kasprintf(GFP_KERNEL, "OMAP4"); 667 return kasprintf(GFP_KERNEL, "OMAP4");
658 else if (soc_is_omap54xx()) 668 else if (soc_is_omap54xx())
659 return kasprintf(GFP_KERNEL, "OMAP5"); 669 return kasprintf(GFP_KERNEL, "OMAP5");
670 else if (soc_is_am43xx())
671 return kasprintf(GFP_KERNEL, "AM43xx");
660 else 672 else
661 return kasprintf(GFP_KERNEL, "Unknown"); 673 return kasprintf(GFP_KERNEL, "Unknown");
662} 674}
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index af432b191255..f14f9ac2dca1 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -604,6 +604,7 @@ void __init am43xx_init_early(void)
604 omap_prm_base_init(); 604 omap_prm_base_init();
605 omap_cm_base_init(); 605 omap_cm_base_init();
606 omap3xxx_check_revision(); 606 omap3xxx_check_revision();
607 am33xx_check_features();
607 am43xx_powerdomains_init(); 608 am43xx_powerdomains_init();
608 am43xx_clockdomains_init(); 609 am43xx_clockdomains_init();
609 am43xx_hwmod_init(); 610 am43xx_hwmod_init();
diff --git a/arch/arm/mach-omap2/mux.h b/arch/arm/mach-omap2/mux.h
index a722330d4d53..d121fb6df4e6 100644
--- a/arch/arm/mach-omap2/mux.h
+++ b/arch/arm/mach-omap2/mux.h
@@ -63,9 +63,6 @@
63#define OMAP_PACKAGE_CUS 5 /* 423-pin 0.65 */ 63#define OMAP_PACKAGE_CUS 5 /* 423-pin 0.65 */
64#define OMAP_PACKAGE_CBB 4 /* 515-pin 0.40 0.50 */ 64#define OMAP_PACKAGE_CBB 4 /* 515-pin 0.40 0.50 */
65#define OMAP_PACKAGE_CBC 3 /* 515-pin 0.50 0.65 */ 65#define OMAP_PACKAGE_CBC 3 /* 515-pin 0.50 0.65 */
66#define OMAP_PACKAGE_ZAC 2 /* 24xx 447-pin POP */
67#define OMAP_PACKAGE_ZAF 1 /* 2420 447-pin SIP */
68
69 66
70#define OMAP_MUX_NR_MODES 8 /* Available modes */ 67#define OMAP_MUX_NR_MODES 8 /* Available modes */
71#define OMAP_MUX_NR_SIDES 2 /* Bottom & top */ 68#define OMAP_MUX_NR_SIDES 2 /* Bottom & top */
diff --git a/arch/arm/mach-omap2/omap_hwmod_43xx_data.c b/arch/arm/mach-omap2/omap_hwmod_43xx_data.c
index 9002fca76699..5c2cc8083fdd 100644
--- a/arch/arm/mach-omap2/omap_hwmod_43xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_43xx_data.c
@@ -719,6 +719,7 @@ static struct omap_hwmod_ocp_if *am43xx_hwmod_ocp_ifs[] __initdata = {
719 &am33xx_l4_ls__uart4, 719 &am33xx_l4_ls__uart4,
720 &am33xx_l4_ls__uart5, 720 &am33xx_l4_ls__uart5,
721 &am33xx_l4_ls__uart6, 721 &am33xx_l4_ls__uart6,
722 &am33xx_l4_ls__spinlock,
722 &am33xx_l4_ls__elm, 723 &am33xx_l4_ls__elm,
723 &am33xx_l4_ls__epwmss0, 724 &am33xx_l4_ls__epwmss0,
724 &am33xx_epwmss0__ecap0, 725 &am33xx_epwmss0__ecap0,
diff --git a/arch/arm/mach-omap2/prminst44xx.c b/arch/arm/mach-omap2/prminst44xx.c
index 280f3c58abe5..05fcf6de44ee 100644
--- a/arch/arm/mach-omap2/prminst44xx.c
+++ b/arch/arm/mach-omap2/prminst44xx.c
@@ -25,6 +25,7 @@
25#include "prminst44xx.h" 25#include "prminst44xx.h"
26#include "prm-regbits-44xx.h" 26#include "prm-regbits-44xx.h"
27#include "prcm44xx.h" 27#include "prcm44xx.h"
28#include "prcm43xx.h"
28#include "prcm_mpu44xx.h" 29#include "prcm_mpu44xx.h"
29#include "soc.h" 30#include "soc.h"
30 31
@@ -176,6 +177,8 @@ void omap4_prminst_global_warm_sw_reset(void)
176 dev_inst = OMAP54XX_PRM_DEVICE_INST; 177 dev_inst = OMAP54XX_PRM_DEVICE_INST;
177 else if (soc_is_dra7xx()) 178 else if (soc_is_dra7xx())
178 dev_inst = DRA7XX_PRM_DEVICE_INST; 179 dev_inst = DRA7XX_PRM_DEVICE_INST;
180 else if (soc_is_am43xx())
181 dev_inst = AM43XX_PRM_DEVICE_INST;
179 else 182 else
180 return; 183 return;
181 184
diff --git a/arch/arm/mach-omap2/soc.h b/arch/arm/mach-omap2/soc.h
index 076bd90a6ce0..30abcc8b20e0 100644
--- a/arch/arm/mach-omap2/soc.h
+++ b/arch/arm/mach-omap2/soc.h
@@ -438,7 +438,8 @@ IS_OMAP_TYPE(3430, 0x3430)
438#define AM335X_REV_ES2_1 (AM335X_CLASS | (0x2 << 8)) 438#define AM335X_REV_ES2_1 (AM335X_CLASS | (0x2 << 8))
439 439
440#define AM437X_CLASS 0x43700000 440#define AM437X_CLASS 0x43700000
441#define AM437X_REV_ES1_0 AM437X_CLASS 441#define AM437X_REV_ES1_0 (AM437X_CLASS | (0x10 << 8))
442#define AM437X_REV_ES1_1 (AM437X_CLASS | (0x11 << 8))
442 443
443#define OMAP443X_CLASS 0x44300044 444#define OMAP443X_CLASS 0x44300044
444#define OMAP4430_REV_ES1_0 (OMAP443X_CLASS | (0x10 << 8)) 445#define OMAP4430_REV_ES1_0 (OMAP443X_CLASS | (0x10 << 8))
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
index 74044aaf438b..b62de9f9d05c 100644
--- a/arch/arm/mach-omap2/timer.c
+++ b/arch/arm/mach-omap2/timer.c
@@ -604,7 +604,8 @@ OMAP_SYS_32K_TIMER_INIT(3_secure, 12, "secure_32k_fck", "ti,timer-secure",
604 2, "timer_sys_ck", NULL); 604 2, "timer_sys_ck", NULL);
605#endif /* CONFIG_ARCH_OMAP3 */ 605#endif /* CONFIG_ARCH_OMAP3 */
606 606
607#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_SOC_AM33XX) 607#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_SOC_AM33XX) || \
608 defined(CONFIG_SOC_AM43XX)
608OMAP_SYS_GP_TIMER_INIT(3, 2, "timer_sys_ck", NULL, 609OMAP_SYS_GP_TIMER_INIT(3, 2, "timer_sys_ck", NULL,
609 1, "timer_sys_ck", "ti,timer-alwon"); 610 1, "timer_sys_ck", "ti,timer-alwon");
610#endif 611#endif
diff --git a/arch/arm/mach-qcom/board.c b/arch/arm/mach-qcom/board.c
index 830f69c3a3ce..bae617ef0b31 100644
--- a/arch/arm/mach-qcom/board.c
+++ b/arch/arm/mach-qcom/board.c
@@ -11,30 +11,16 @@
11 */ 11 */
12 12
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/of.h>
15#include <linux/of_platform.h>
16 14
17#include <asm/mach/arch.h> 15#include <asm/mach/arch.h>
18#include <asm/mach/map.h>
19
20extern struct smp_operations qcom_smp_ops;
21 16
22static const char * const qcom_dt_match[] __initconst = { 17static const char * const qcom_dt_match[] __initconst = {
23 "qcom,msm8660-surf", 18 "qcom,msm8660-surf",
24 "qcom,msm8960-cdp", 19 "qcom,msm8960-cdp",
25 NULL
26};
27
28static const char * const apq8074_dt_match[] __initconst = {
29 "qcom,apq8074-dragonboard", 20 "qcom,apq8074-dragonboard",
30 NULL 21 NULL
31}; 22};
32 23
33DT_MACHINE_START(QCOM_DT, "Qualcomm (Flattened Device Tree)") 24DT_MACHINE_START(QCOM_DT, "Qualcomm (Flattened Device Tree)")
34 .smp = smp_ops(qcom_smp_ops),
35 .dt_compat = qcom_dt_match, 25 .dt_compat = qcom_dt_match,
36MACHINE_END 26MACHINE_END
37
38DT_MACHINE_START(APQ_DT, "Qualcomm (Flattened Device Tree)")
39 .dt_compat = apq8074_dt_match,
40MACHINE_END
diff --git a/arch/arm/mach-qcom/platsmp.c b/arch/arm/mach-qcom/platsmp.c
index 9c53ea70550d..d6908569ecaf 100644
--- a/arch/arm/mach-qcom/platsmp.c
+++ b/arch/arm/mach-qcom/platsmp.c
@@ -13,17 +13,36 @@
13#include <linux/errno.h> 13#include <linux/errno.h>
14#include <linux/delay.h> 14#include <linux/delay.h>
15#include <linux/device.h> 15#include <linux/device.h>
16#include <linux/of.h>
17#include <linux/of_address.h>
16#include <linux/smp.h> 18#include <linux/smp.h>
17#include <linux/io.h> 19#include <linux/io.h>
18 20
19#include <asm/cputype.h>
20#include <asm/smp_plat.h> 21#include <asm/smp_plat.h>
21 22
22#include "scm-boot.h" 23#include "scm-boot.h"
23 24
24#define VDD_SC1_ARRAY_CLAMP_GFS_CTL 0x15A0 25#define VDD_SC1_ARRAY_CLAMP_GFS_CTL 0x35a0
25#define SCSS_CPU1CORE_RESET 0xD80 26#define SCSS_CPU1CORE_RESET 0x2d80
26#define SCSS_DBG_STATUS_CORE_PWRDUP 0xE64 27#define SCSS_DBG_STATUS_CORE_PWRDUP 0x2e64
28
29#define APCS_CPU_PWR_CTL 0x04
30#define PLL_CLAMP BIT(8)
31#define CORE_PWRD_UP BIT(7)
32#define COREPOR_RST BIT(5)
33#define CORE_RST BIT(4)
34#define L2DT_SLP BIT(3)
35#define CLAMP BIT(0)
36
37#define APC_PWR_GATE_CTL 0x14
38#define BHS_CNT_SHIFT 24
39#define LDO_PWR_DWN_SHIFT 16
40#define LDO_BYP_SHIFT 8
41#define BHS_SEG_SHIFT 1
42#define BHS_EN BIT(0)
43
44#define APCS_SAW2_VCTL 0x14
45#define APCS_SAW2_2_VCTL 0x1c
27 46
28extern void secondary_startup(void); 47extern void secondary_startup(void);
29 48
@@ -36,12 +55,6 @@ static void __ref qcom_cpu_die(unsigned int cpu)
36} 55}
37#endif 56#endif
38 57
39static inline int get_core_count(void)
40{
41 /* 1 + the PART[1:0] field of MIDR */
42 return ((read_cpuid_id() >> 4) & 3) + 1;
43}
44
45static void qcom_secondary_init(unsigned int cpu) 58static void qcom_secondary_init(unsigned int cpu)
46{ 59{
47 /* 60 /*
@@ -51,33 +64,220 @@ static void qcom_secondary_init(unsigned int cpu)
51 spin_unlock(&boot_lock); 64 spin_unlock(&boot_lock);
52} 65}
53 66
54static void prepare_cold_cpu(unsigned int cpu) 67static int scss_release_secondary(unsigned int cpu)
68{
69 struct device_node *node;
70 void __iomem *base;
71
72 node = of_find_compatible_node(NULL, NULL, "qcom,gcc-msm8660");
73 if (!node) {
74 pr_err("%s: can't find node\n", __func__);
75 return -ENXIO;
76 }
77
78 base = of_iomap(node, 0);
79 of_node_put(node);
80 if (!base)
81 return -ENOMEM;
82
83 writel_relaxed(0, base + VDD_SC1_ARRAY_CLAMP_GFS_CTL);
84 writel_relaxed(0, base + SCSS_CPU1CORE_RESET);
85 writel_relaxed(3, base + SCSS_DBG_STATUS_CORE_PWRDUP);
86 mb();
87 iounmap(base);
88
89 return 0;
90}
91
92static int kpssv1_release_secondary(unsigned int cpu)
55{ 93{
94 int ret = 0;
95 void __iomem *reg, *saw_reg;
96 struct device_node *cpu_node, *acc_node, *saw_node;
97 u32 val;
98
99 cpu_node = of_get_cpu_node(cpu, NULL);
100 if (!cpu_node)
101 return -ENODEV;
102
103 acc_node = of_parse_phandle(cpu_node, "qcom,acc", 0);
104 if (!acc_node) {
105 ret = -ENODEV;
106 goto out_acc;
107 }
108
109 saw_node = of_parse_phandle(cpu_node, "qcom,saw", 0);
110 if (!saw_node) {
111 ret = -ENODEV;
112 goto out_saw;
113 }
114
115 reg = of_iomap(acc_node, 0);
116 if (!reg) {
117 ret = -ENOMEM;
118 goto out_acc_map;
119 }
120
121 saw_reg = of_iomap(saw_node, 0);
122 if (!saw_reg) {
123 ret = -ENOMEM;
124 goto out_saw_map;
125 }
126
127 /* Turn on CPU rail */
128 writel_relaxed(0xA4, saw_reg + APCS_SAW2_VCTL);
129 mb();
130 udelay(512);
131
132 /* Krait bring-up sequence */
133 val = PLL_CLAMP | L2DT_SLP | CLAMP;
134 writel_relaxed(val, reg + APCS_CPU_PWR_CTL);
135 val &= ~L2DT_SLP;
136 writel_relaxed(val, reg + APCS_CPU_PWR_CTL);
137 mb();
138 ndelay(300);
139
140 val |= COREPOR_RST;
141 writel_relaxed(val, reg + APCS_CPU_PWR_CTL);
142 mb();
143 udelay(2);
144
145 val &= ~CLAMP;
146 writel_relaxed(val, reg + APCS_CPU_PWR_CTL);
147 mb();
148 udelay(2);
149
150 val &= ~COREPOR_RST;
151 writel_relaxed(val, reg + APCS_CPU_PWR_CTL);
152 mb();
153 udelay(100);
154
155 val |= CORE_PWRD_UP;
156 writel_relaxed(val, reg + APCS_CPU_PWR_CTL);
157 mb();
158
159 iounmap(saw_reg);
160out_saw_map:
161 iounmap(reg);
162out_acc_map:
163 of_node_put(saw_node);
164out_saw:
165 of_node_put(acc_node);
166out_acc:
167 of_node_put(cpu_node);
168 return ret;
169}
170
171static int kpssv2_release_secondary(unsigned int cpu)
172{
173 void __iomem *reg;
174 struct device_node *cpu_node, *l2_node, *acc_node, *saw_node;
175 void __iomem *l2_saw_base;
176 unsigned reg_val;
56 int ret; 177 int ret;
57 ret = scm_set_boot_addr(virt_to_phys(secondary_startup), 178
58 SCM_FLAG_COLDBOOT_CPU1); 179 cpu_node = of_get_cpu_node(cpu, NULL);
59 if (ret == 0) { 180 if (!cpu_node)
60 void __iomem *sc1_base_ptr; 181 return -ENODEV;
61 sc1_base_ptr = ioremap_nocache(0x00902000, SZ_4K*2); 182
62 if (sc1_base_ptr) { 183 acc_node = of_parse_phandle(cpu_node, "qcom,acc", 0);
63 writel(0, sc1_base_ptr + VDD_SC1_ARRAY_CLAMP_GFS_CTL); 184 if (!acc_node) {
64 writel(0, sc1_base_ptr + SCSS_CPU1CORE_RESET); 185 ret = -ENODEV;
65 writel(3, sc1_base_ptr + SCSS_DBG_STATUS_CORE_PWRDUP); 186 goto out_acc;
66 iounmap(sc1_base_ptr); 187 }
67 } 188
68 } else 189 l2_node = of_parse_phandle(cpu_node, "next-level-cache", 0);
69 printk(KERN_DEBUG "Failed to set secondary core boot " 190 if (!l2_node) {
70 "address\n"); 191 ret = -ENODEV;
192 goto out_l2;
193 }
194
195 saw_node = of_parse_phandle(l2_node, "qcom,saw", 0);
196 if (!saw_node) {
197 ret = -ENODEV;
198 goto out_saw;
199 }
200
201 reg = of_iomap(acc_node, 0);
202 if (!reg) {
203 ret = -ENOMEM;
204 goto out_map;
205 }
206
207 l2_saw_base = of_iomap(saw_node, 0);
208 if (!l2_saw_base) {
209 ret = -ENOMEM;
210 goto out_saw_map;
211 }
212
213 /* Turn on the BHS, turn off LDO Bypass and power down LDO */
214 reg_val = (64 << BHS_CNT_SHIFT) | (0x3f << LDO_PWR_DWN_SHIFT) | BHS_EN;
215 writel_relaxed(reg_val, reg + APC_PWR_GATE_CTL);
216 mb();
217 /* wait for the BHS to settle */
218 udelay(1);
219
220 /* Turn on BHS segments */
221 reg_val |= 0x3f << BHS_SEG_SHIFT;
222 writel_relaxed(reg_val, reg + APC_PWR_GATE_CTL);
223 mb();
224 /* wait for the BHS to settle */
225 udelay(1);
226
227 /* Finally turn on the bypass so that BHS supplies power */
228 reg_val |= 0x3f << LDO_BYP_SHIFT;
229 writel_relaxed(reg_val, reg + APC_PWR_GATE_CTL);
230
231 /* enable max phases */
232 writel_relaxed(0x10003, l2_saw_base + APCS_SAW2_2_VCTL);
233 mb();
234 udelay(50);
235
236 reg_val = COREPOR_RST | CLAMP;
237 writel_relaxed(reg_val, reg + APCS_CPU_PWR_CTL);
238 mb();
239 udelay(2);
240
241 reg_val &= ~CLAMP;
242 writel_relaxed(reg_val, reg + APCS_CPU_PWR_CTL);
243 mb();
244 udelay(2);
245
246 reg_val &= ~COREPOR_RST;
247 writel_relaxed(reg_val, reg + APCS_CPU_PWR_CTL);
248 mb();
249
250 reg_val |= CORE_PWRD_UP;
251 writel_relaxed(reg_val, reg + APCS_CPU_PWR_CTL);
252 mb();
253
254 ret = 0;
255
256 iounmap(l2_saw_base);
257out_saw_map:
258 iounmap(reg);
259out_map:
260 of_node_put(saw_node);
261out_saw:
262 of_node_put(l2_node);
263out_l2:
264 of_node_put(acc_node);
265out_acc:
266 of_node_put(cpu_node);
267
268 return ret;
71} 269}
72 270
73static int qcom_boot_secondary(unsigned int cpu, struct task_struct *idle) 271static DEFINE_PER_CPU(int, cold_boot_done);
272
273static int qcom_boot_secondary(unsigned int cpu, int (*func)(unsigned int))
74{ 274{
75 static int cold_boot_done; 275 int ret = 0;
76 276
77 /* Only need to bring cpu out of reset this way once */ 277 if (!per_cpu(cold_boot_done, cpu)) {
78 if (cold_boot_done == false) { 278 ret = func(cpu);
79 prepare_cold_cpu(cpu); 279 if (!ret)
80 cold_boot_done = true; 280 per_cpu(cold_boot_done, cpu) = true;
81 } 281 }
82 282
83 /* 283 /*
@@ -99,39 +299,80 @@ static int qcom_boot_secondary(unsigned int cpu, struct task_struct *idle)
99 */ 299 */
100 spin_unlock(&boot_lock); 300 spin_unlock(&boot_lock);
101 301
102 return 0; 302 return ret;
103} 303}
104 304
105/* 305static int msm8660_boot_secondary(unsigned int cpu, struct task_struct *idle)
106 * Initialise the CPU possible map early - this describes the CPUs
107 * which may be present or become present in the system. The msm8x60
108 * does not support the ARM SCU, so just set the possible cpu mask to
109 * NR_CPUS.
110 */
111static void __init qcom_smp_init_cpus(void)
112{ 306{
113 unsigned int i, ncores = get_core_count(); 307 return qcom_boot_secondary(cpu, scss_release_secondary);
308}
114 309
115 if (ncores > nr_cpu_ids) { 310static int kpssv1_boot_secondary(unsigned int cpu, struct task_struct *idle)
116 pr_warn("SMP: %u cores greater than maximum (%u), clipping\n", 311{
117 ncores, nr_cpu_ids); 312 return qcom_boot_secondary(cpu, kpssv1_release_secondary);
118 ncores = nr_cpu_ids; 313}
119 }
120 314
121 for (i = 0; i < ncores; i++) 315static int kpssv2_boot_secondary(unsigned int cpu, struct task_struct *idle)
122 set_cpu_possible(i, true); 316{
317 return qcom_boot_secondary(cpu, kpssv2_release_secondary);
123} 318}
124 319
125static void __init qcom_smp_prepare_cpus(unsigned int max_cpus) 320static void __init qcom_smp_prepare_cpus(unsigned int max_cpus)
126{ 321{
322 int cpu, map;
323 unsigned int flags = 0;
324 static const int cold_boot_flags[] = {
325 0,
326 SCM_FLAG_COLDBOOT_CPU1,
327 SCM_FLAG_COLDBOOT_CPU2,
328 SCM_FLAG_COLDBOOT_CPU3,
329 };
330
331 for_each_present_cpu(cpu) {
332 map = cpu_logical_map(cpu);
333 if (WARN_ON(map >= ARRAY_SIZE(cold_boot_flags))) {
334 set_cpu_present(cpu, false);
335 continue;
336 }
337 flags |= cold_boot_flags[map];
338 }
339
340 if (scm_set_boot_addr(virt_to_phys(secondary_startup), flags)) {
341 for_each_present_cpu(cpu) {
342 if (cpu == smp_processor_id())
343 continue;
344 set_cpu_present(cpu, false);
345 }
346 pr_warn("Failed to set CPU boot address, disabling SMP\n");
347 }
127} 348}
128 349
129struct smp_operations qcom_smp_ops __initdata = { 350static struct smp_operations smp_msm8660_ops __initdata = {
130 .smp_init_cpus = qcom_smp_init_cpus, 351 .smp_prepare_cpus = qcom_smp_prepare_cpus,
352 .smp_secondary_init = qcom_secondary_init,
353 .smp_boot_secondary = msm8660_boot_secondary,
354#ifdef CONFIG_HOTPLUG_CPU
355 .cpu_die = qcom_cpu_die,
356#endif
357};
358CPU_METHOD_OF_DECLARE(qcom_smp, "qcom,gcc-msm8660", &smp_msm8660_ops);
359
360static struct smp_operations qcom_smp_kpssv1_ops __initdata = {
361 .smp_prepare_cpus = qcom_smp_prepare_cpus,
362 .smp_secondary_init = qcom_secondary_init,
363 .smp_boot_secondary = kpssv1_boot_secondary,
364#ifdef CONFIG_HOTPLUG_CPU
365 .cpu_die = qcom_cpu_die,
366#endif
367};
368CPU_METHOD_OF_DECLARE(qcom_smp_kpssv1, "qcom,kpss-acc-v1", &qcom_smp_kpssv1_ops);
369
370static struct smp_operations qcom_smp_kpssv2_ops __initdata = {
131 .smp_prepare_cpus = qcom_smp_prepare_cpus, 371 .smp_prepare_cpus = qcom_smp_prepare_cpus,
132 .smp_secondary_init = qcom_secondary_init, 372 .smp_secondary_init = qcom_secondary_init,
133 .smp_boot_secondary = qcom_boot_secondary, 373 .smp_boot_secondary = kpssv2_boot_secondary,
134#ifdef CONFIG_HOTPLUG_CPU 374#ifdef CONFIG_HOTPLUG_CPU
135 .cpu_die = qcom_cpu_die, 375 .cpu_die = qcom_cpu_die,
136#endif 376#endif
137}; 377};
378CPU_METHOD_OF_DECLARE(qcom_smp_kpssv2, "qcom,kpss-acc-v2", &qcom_smp_kpssv2_ops);
diff --git a/arch/arm/mach-qcom/scm-boot.h b/arch/arm/mach-qcom/scm-boot.h
index 7be32ff5d687..6aabb2428176 100644
--- a/arch/arm/mach-qcom/scm-boot.h
+++ b/arch/arm/mach-qcom/scm-boot.h
@@ -13,9 +13,11 @@
13#define __MACH_SCM_BOOT_H 13#define __MACH_SCM_BOOT_H
14 14
15#define SCM_BOOT_ADDR 0x1 15#define SCM_BOOT_ADDR 0x1
16#define SCM_FLAG_COLDBOOT_CPU1 0x1 16#define SCM_FLAG_COLDBOOT_CPU1 0x01
17#define SCM_FLAG_WARMBOOT_CPU1 0x2 17#define SCM_FLAG_COLDBOOT_CPU2 0x08
18#define SCM_FLAG_WARMBOOT_CPU0 0x4 18#define SCM_FLAG_COLDBOOT_CPU3 0x20
19#define SCM_FLAG_WARMBOOT_CPU0 0x04
20#define SCM_FLAG_WARMBOOT_CPU1 0x02
19 21
20int scm_set_boot_addr(phys_addr_t addr, int flags); 22int scm_set_boot_addr(phys_addr_t addr, int flags);
21 23
diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index 6b2f58645a73..1caee6d548b8 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -5,6 +5,7 @@ config ARCH_ROCKCHIP
5 select ARCH_REQUIRE_GPIOLIB 5 select ARCH_REQUIRE_GPIOLIB
6 select ARM_GIC 6 select ARM_GIC
7 select CACHE_L2X0 7 select CACHE_L2X0
8 select HAVE_ARM_SCU if SMP
8 select HAVE_ARM_TWD if SMP 9 select HAVE_ARM_TWD if SMP
9 select DW_APB_TIMER_OF 10 select DW_APB_TIMER_OF
10 select ARM_GLOBAL_TIMER 11 select ARM_GLOBAL_TIMER
diff --git a/arch/arm/mach-rockchip/Makefile b/arch/arm/mach-rockchip/Makefile
index 1547d4fc920a..4377a1436a98 100644
--- a/arch/arm/mach-rockchip/Makefile
+++ b/arch/arm/mach-rockchip/Makefile
@@ -1 +1,2 @@
1obj-$(CONFIG_ARCH_ROCKCHIP) += rockchip.o 1obj-$(CONFIG_ARCH_ROCKCHIP) += rockchip.o
2obj-$(CONFIG_SMP) += headsmp.o platsmp.o
diff --git a/arch/arm/mach-rockchip/core.h b/arch/arm/mach-rockchip/core.h
new file mode 100644
index 000000000000..e2e7c9dbb200
--- /dev/null
+++ b/arch/arm/mach-rockchip/core.h
@@ -0,0 +1,22 @@
1/*
2 * Copyright (c) 2013 MundoReader S.L.
3 * Author: Heiko Stuebner <heiko@sntech.de>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16extern char rockchip_secondary_trampoline;
17extern char rockchip_secondary_trampoline_end;
18
19extern unsigned long rockchip_boot_fn;
20extern void rockchip_secondary_startup(void);
21
22extern struct smp_operations rockchip_smp_ops;
diff --git a/arch/arm/mach-rockchip/headsmp.S b/arch/arm/mach-rockchip/headsmp.S
new file mode 100644
index 000000000000..73206e360e31
--- /dev/null
+++ b/arch/arm/mach-rockchip/headsmp.S
@@ -0,0 +1,30 @@
1/*
2 * Copyright (c) 2013 MundoReader S.L.
3 * Author: Heiko Stuebner <heiko@sntech.de>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15#include <linux/linkage.h>
16#include <linux/init.h>
17
18ENTRY(rockchip_secondary_startup)
19 bl v7_invalidate_l1
20 b secondary_startup
21ENDPROC(rockchip_secondary_startup)
22
23ENTRY(rockchip_secondary_trampoline)
24 ldr pc, 1f
25ENDPROC(rockchip_secondary_trampoline)
26 .globl rockchip_boot_fn
27rockchip_boot_fn:
281: .space 4
29
30ENTRY(rockchip_secondary_trampoline_end)
diff --git a/arch/arm/mach-rockchip/platsmp.c b/arch/arm/mach-rockchip/platsmp.c
new file mode 100644
index 000000000000..dbfa5a26cfff
--- /dev/null
+++ b/arch/arm/mach-rockchip/platsmp.c
@@ -0,0 +1,184 @@
1/*
2 * Copyright (c) 2013 MundoReader S.L.
3 * Author: Heiko Stuebner <heiko@sntech.de>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#include <linux/delay.h>
17#include <linux/init.h>
18#include <linux/smp.h>
19#include <linux/io.h>
20#include <linux/of.h>
21#include <linux/of_address.h>
22
23#include <asm/cacheflush.h>
24#include <asm/smp_scu.h>
25#include <asm/smp_plat.h>
26#include <asm/mach/map.h>
27
28#include "core.h"
29
30static void __iomem *scu_base_addr;
31static void __iomem *sram_base_addr;
32static int ncores;
33
34#define PMU_PWRDN_CON 0x08
35#define PMU_PWRDN_ST 0x0c
36
37#define PMU_PWRDN_SCU 4
38
39static void __iomem *pmu_base_addr;
40
41static inline bool pmu_power_domain_is_on(int pd)
42{
43 return !(readl_relaxed(pmu_base_addr + PMU_PWRDN_ST) & BIT(pd));
44}
45
46static void pmu_set_power_domain(int pd, bool on)
47{
48 u32 val = readl_relaxed(pmu_base_addr + PMU_PWRDN_CON);
49 if (on)
50 val &= ~BIT(pd);
51 else
52 val |= BIT(pd);
53 writel(val, pmu_base_addr + PMU_PWRDN_CON);
54
55 while (pmu_power_domain_is_on(pd) != on) { }
56}
57
58/*
59 * Handling of CPU cores
60 */
61
62static int __cpuinit rockchip_boot_secondary(unsigned int cpu,
63 struct task_struct *idle)
64{
65 if (!sram_base_addr || !pmu_base_addr) {
66 pr_err("%s: sram or pmu missing for cpu boot\n", __func__);
67 return -ENXIO;
68 }
69
70 if (cpu >= ncores) {
71 pr_err("%s: cpu %d outside maximum number of cpus %d\n",
72 __func__, cpu, ncores);
73 return -ENXIO;
74 }
75
76 /* start the core */
77 pmu_set_power_domain(0 + cpu, true);
78
79 return 0;
80}
81
82/**
83 * rockchip_smp_prepare_sram - populate necessary sram block
84 * Starting cores execute the code residing at the start of the on-chip sram
85 * after power-on. Therefore make sure, this sram region is reserved and
86 * big enough. After this check, copy the trampoline code that directs the
87 * core to the real startup code in ram into the sram-region.
88 * @node: mmio-sram device node
89 */
90static int __init rockchip_smp_prepare_sram(struct device_node *node)
91{
92 unsigned int trampoline_sz = &rockchip_secondary_trampoline_end -
93 &rockchip_secondary_trampoline;
94 struct resource res;
95 unsigned int rsize;
96 int ret;
97
98 ret = of_address_to_resource(node, 0, &res);
99 if (ret < 0) {
100 pr_err("%s: could not get address for node %s\n",
101 __func__, node->full_name);
102 return ret;
103 }
104
105 rsize = resource_size(&res);
106 if (rsize < trampoline_sz) {
107 pr_err("%s: reserved block with size 0x%x is to small for trampoline size 0x%x\n",
108 __func__, rsize, trampoline_sz);
109 return -EINVAL;
110 }
111
112 sram_base_addr = of_iomap(node, 0);
113
114 /* set the boot function for the sram code */
115 rockchip_boot_fn = virt_to_phys(rockchip_secondary_startup);
116
117 /* copy the trampoline to sram, that runs during startup of the core */
118 memcpy(sram_base_addr, &rockchip_secondary_trampoline, trampoline_sz);
119 flush_cache_all();
120 outer_clean_range(0, trampoline_sz);
121
122 dsb_sev();
123
124 return 0;
125}
126
127static void __init rockchip_smp_prepare_cpus(unsigned int max_cpus)
128{
129 struct device_node *node;
130 unsigned int i;
131
132 node = of_find_compatible_node(NULL, NULL, "arm,cortex-a9-scu");
133 if (!node) {
134 pr_err("%s: missing scu\n", __func__);
135 return;
136 }
137
138 scu_base_addr = of_iomap(node, 0);
139 if (!scu_base_addr) {
140 pr_err("%s: could not map scu registers\n", __func__);
141 return;
142 }
143
144 node = of_find_compatible_node(NULL, NULL, "rockchip,rk3066-smp-sram");
145 if (!node) {
146 pr_err("%s: could not find sram dt node\n", __func__);
147 return;
148 }
149
150 if (rockchip_smp_prepare_sram(node))
151 return;
152
153 node = of_find_compatible_node(NULL, NULL, "rockchip,rk3066-pmu");
154 if (!node) {
155 pr_err("%s: could not find sram dt node\n", __func__);
156 return;
157 }
158
159 pmu_base_addr = of_iomap(node, 0);
160 if (!pmu_base_addr) {
161 pr_err("%s: could not map pmu registers\n", __func__);
162 return;
163 }
164
165 /* enable the SCU power domain */
166 pmu_set_power_domain(PMU_PWRDN_SCU, true);
167
168 /*
169 * While the number of cpus is gathered from dt, also get the number
170 * of cores from the scu to verify this value when booting the cores.
171 */
172 ncores = scu_get_core_count(scu_base_addr);
173
174 scu_enable(scu_base_addr);
175
176 /* Make sure that all cores except the first are really off */
177 for (i = 1; i < ncores; i++)
178 pmu_set_power_domain(0 + i, false);
179}
180
181struct smp_operations rockchip_smp_ops __initdata = {
182 .smp_prepare_cpus = rockchip_smp_prepare_cpus,
183 .smp_boot_secondary = rockchip_boot_secondary,
184};
diff --git a/arch/arm/mach-rockchip/rockchip.c b/arch/arm/mach-rockchip/rockchip.c
index 82c0b0709712..d211d6fa0d98 100644
--- a/arch/arm/mach-rockchip/rockchip.c
+++ b/arch/arm/mach-rockchip/rockchip.c
@@ -22,6 +22,7 @@
22#include <asm/mach/arch.h> 22#include <asm/mach/arch.h>
23#include <asm/mach/map.h> 23#include <asm/mach/map.h>
24#include <asm/hardware/cache-l2x0.h> 24#include <asm/hardware/cache-l2x0.h>
25#include "core.h"
25 26
26static void __init rockchip_dt_init(void) 27static void __init rockchip_dt_init(void)
27{ 28{
@@ -38,6 +39,7 @@ static const char * const rockchip_board_dt_compat[] = {
38}; 39};
39 40
40DT_MACHINE_START(ROCKCHIP_DT, "Rockchip Cortex-A9 (Device Tree)") 41DT_MACHINE_START(ROCKCHIP_DT, "Rockchip Cortex-A9 (Device Tree)")
42 .smp = smp_ops(rockchip_smp_ops),
41 .init_machine = rockchip_dt_init, 43 .init_machine = rockchip_dt_init,
42 .dt_compat = rockchip_board_dt_compat, 44 .dt_compat = rockchip_board_dt_compat,
43MACHINE_END 45MACHINE_END
diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
index efd53848947d..c0b650b1c846 100644
--- a/arch/arm/mach-shmobile/Kconfig
+++ b/arch/arm/mach-shmobile/Kconfig
@@ -9,6 +9,7 @@ config ARCH_SHMOBILE_MULTI
9 select HAVE_ARM_TWD if SMP 9 select HAVE_ARM_TWD if SMP
10 select ARM_GIC 10 select ARM_GIC
11 select MIGHT_HAVE_PCI 11 select MIGHT_HAVE_PCI
12 select ARCH_DMA_ADDR_T_64BIT if ARM_LPAE
12 select NO_IOPORT 13 select NO_IOPORT
13 select PINCTRL 14 select PINCTRL
14 select ARCH_REQUIRE_GPIOLIB 15 select ARCH_REQUIRE_GPIOLIB
@@ -129,6 +130,7 @@ config ARCH_R8A7790
129 select SH_CLK_CPG 130 select SH_CLK_CPG
130 select RENESAS_IRQC 131 select RENESAS_IRQC
131 select SYS_SUPPORTS_SH_CMT 132 select SYS_SUPPORTS_SH_CMT
133 select ARCH_DMA_ADDR_T_64BIT if ARM_LPAE
132 134
133config ARCH_R8A7791 135config ARCH_R8A7791
134 bool "R-Car M2 (R8A77910)" 136 bool "R-Car M2 (R8A77910)"
@@ -139,6 +141,7 @@ config ARCH_R8A7791
139 select SH_CLK_CPG 141 select SH_CLK_CPG
140 select RENESAS_IRQC 142 select RENESAS_IRQC
141 select SYS_SUPPORTS_SH_CMT 143 select SYS_SUPPORTS_SH_CMT
144 select ARCH_DMA_ADDR_T_64BIT if ARM_LPAE
142 145
143config ARCH_EMEV2 146config ARCH_EMEV2
144 bool "Emma Mobile EV2" 147 bool "Emma Mobile EV2"
diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile
index fe7d4ff706e4..d38a6362e5f8 100644
--- a/arch/arm/mach-shmobile/Makefile
+++ b/arch/arm/mach-shmobile/Makefile
@@ -52,7 +52,8 @@ obj-$(CONFIG_CPU_IDLE) += cpuidle.o
52obj-$(CONFIG_ARCH_SH7372) += pm-sh7372.o sleep-sh7372.o pm-rmobile.o 52obj-$(CONFIG_ARCH_SH7372) += pm-sh7372.o sleep-sh7372.o pm-rmobile.o
53obj-$(CONFIG_ARCH_SH73A0) += pm-sh73a0.o 53obj-$(CONFIG_ARCH_SH73A0) += pm-sh73a0.o
54obj-$(CONFIG_ARCH_R8A7740) += pm-r8a7740.o pm-rmobile.o 54obj-$(CONFIG_ARCH_R8A7740) += pm-r8a7740.o pm-rmobile.o
55obj-$(CONFIG_ARCH_R8A7779) += pm-r8a7779.o 55obj-$(CONFIG_ARCH_R8A7779) += pm-r8a7779.o pm-rcar.o
56obj-$(CONFIG_ARCH_R8A7790) += pm-r8a7790.o pm-rcar.o
56 57
57# Board objects 58# Board objects
58ifdef CONFIG_ARCH_SHMOBILE_MULTI 59ifdef CONFIG_ARCH_SHMOBILE_MULTI
diff --git a/arch/arm/mach-shmobile/include/mach/pm-rcar.h b/arch/arm/mach-shmobile/include/mach/pm-rcar.h
new file mode 100644
index 000000000000..ef3a1ef628f1
--- /dev/null
+++ b/arch/arm/mach-shmobile/include/mach/pm-rcar.h
@@ -0,0 +1,15 @@
1#ifndef PM_RCAR_H
2#define PM_RCAR_H
3
4struct rcar_sysc_ch {
5 unsigned long chan_offs;
6 unsigned int chan_bit;
7 unsigned int isr_bit;
8};
9
10int rcar_sysc_power_down(struct rcar_sysc_ch *sysc_ch);
11int rcar_sysc_power_up(struct rcar_sysc_ch *sysc_ch);
12bool rcar_sysc_power_is_off(struct rcar_sysc_ch *sysc_ch);
13void __iomem *rcar_sysc_init(phys_addr_t base);
14
15#endif /* PM_RCAR_H */
diff --git a/arch/arm/mach-shmobile/include/mach/r8a7779.h b/arch/arm/mach-shmobile/include/mach/r8a7779.h
index b40e13631f6a..88eeceaf1088 100644
--- a/arch/arm/mach-shmobile/include/mach/r8a7779.h
+++ b/arch/arm/mach-shmobile/include/mach/r8a7779.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/sh_clk.h> 4#include <linux/sh_clk.h>
5#include <linux/pm_domain.h> 5#include <linux/pm_domain.h>
6#include <mach/pm-rcar.h>
6 7
7/* HPB-DMA slave IDs */ 8/* HPB-DMA slave IDs */
8enum { 9enum {
@@ -11,18 +12,12 @@ enum {
11 HPBDMA_SLAVE_SDHI0_RX, 12 HPBDMA_SLAVE_SDHI0_RX,
12}; 13};
13 14
14struct r8a7779_pm_ch {
15 unsigned long chan_offs;
16 unsigned int chan_bit;
17 unsigned int isr_bit;
18};
19
20struct r8a7779_pm_domain { 15struct r8a7779_pm_domain {
21 struct generic_pm_domain genpd; 16 struct generic_pm_domain genpd;
22 struct r8a7779_pm_ch ch; 17 struct rcar_sysc_ch ch;
23}; 18};
24 19
25static inline struct r8a7779_pm_ch *to_r8a7779_ch(struct generic_pm_domain *d) 20static inline struct rcar_sysc_ch *to_r8a7779_ch(struct generic_pm_domain *d)
26{ 21{
27 return &container_of(d, struct r8a7779_pm_domain, genpd)->ch; 22 return &container_of(d, struct r8a7779_pm_domain, genpd)->ch;
28} 23}
@@ -41,8 +36,6 @@ extern void r8a7779_clock_init(void);
41extern void r8a7779_pinmux_init(void); 36extern void r8a7779_pinmux_init(void);
42extern void r8a7779_pm_init(void); 37extern void r8a7779_pm_init(void);
43extern void r8a7779_register_twd(void); 38extern void r8a7779_register_twd(void);
44extern int r8a7779_sysc_power_down(struct r8a7779_pm_ch *r8a7779_ch);
45extern int r8a7779_sysc_power_up(struct r8a7779_pm_ch *r8a7779_ch);
46 39
47#ifdef CONFIG_PM 40#ifdef CONFIG_PM
48extern void __init r8a7779_init_pm_domains(void); 41extern void __init r8a7779_init_pm_domains(void);
diff --git a/arch/arm/mach-shmobile/include/mach/r8a7790.h b/arch/arm/mach-shmobile/include/mach/r8a7790.h
index 5fbfa28b40b6..3389f0775def 100644
--- a/arch/arm/mach-shmobile/include/mach/r8a7790.h
+++ b/arch/arm/mach-shmobile/include/mach/r8a7790.h
@@ -7,6 +7,7 @@ void r8a7790_add_standard_devices(void);
7void r8a7790_add_dt_devices(void); 7void r8a7790_add_dt_devices(void);
8void r8a7790_clock_init(void); 8void r8a7790_clock_init(void);
9void r8a7790_pinmux_init(void); 9void r8a7790_pinmux_init(void);
10void r8a7790_pm_init(void);
10void r8a7790_init_early(void); 11void r8a7790_init_early(void);
11extern struct smp_operations r8a7790_smp_ops; 12extern struct smp_operations r8a7790_smp_ops;
12 13
diff --git a/arch/arm/mach-shmobile/platsmp-apmu.c b/arch/arm/mach-shmobile/platsmp-apmu.c
index 1da5a72d9642..8cb641c00fdb 100644
--- a/arch/arm/mach-shmobile/platsmp-apmu.c
+++ b/arch/arm/mach-shmobile/platsmp-apmu.c
@@ -75,8 +75,7 @@ static void apmu_init_cpu(struct resource *res, int cpu, int bit)
75 apmu_cpus[cpu].iomem = ioremap_nocache(res->start, resource_size(res)); 75 apmu_cpus[cpu].iomem = ioremap_nocache(res->start, resource_size(res));
76 apmu_cpus[cpu].bit = bit; 76 apmu_cpus[cpu].bit = bit;
77 77
78 pr_debug("apmu ioremap %d %d 0x%08x 0x%08x\n", cpu, bit, 78 pr_debug("apmu ioremap %d %d %pr\n", cpu, bit, res);
79 res->start, resource_size(res));
80} 79}
81 80
82static struct { 81static struct {
diff --git a/arch/arm/mach-shmobile/pm-r8a7779.c b/arch/arm/mach-shmobile/pm-r8a7779.c
index d50a8e9b94a4..d6fe189b2df6 100644
--- a/arch/arm/mach-shmobile/pm-r8a7779.c
+++ b/arch/arm/mach-shmobile/pm-r8a7779.c
@@ -20,132 +20,22 @@
20#include <linux/console.h> 20#include <linux/console.h>
21#include <asm/io.h> 21#include <asm/io.h>
22#include <mach/common.h> 22#include <mach/common.h>
23#include <mach/pm-rcar.h>
23#include <mach/r8a7779.h> 24#include <mach/r8a7779.h>
24 25
25static void __iomem *r8a7779_sysc_base;
26
27/* SYSC */ 26/* SYSC */
28#define SYSCSR 0x00
29#define SYSCISR 0x04
30#define SYSCISCR 0x08
31#define SYSCIER 0x0c 27#define SYSCIER 0x0c
32#define SYSCIMR 0x10 28#define SYSCIMR 0x10
33#define PWRSR0 0x40
34#define PWRSR1 0x80
35#define PWRSR2 0xc0
36#define PWRSR3 0x100
37#define PWRSR4 0x140
38
39#define PWRSR_OFFS 0x00
40#define PWROFFCR_OFFS 0x04
41#define PWRONCR_OFFS 0x0c
42#define PWRER_OFFS 0x14
43
44#define SYSCSR_RETRIES 100
45#define SYSCSR_DELAY_US 1
46
47#define SYSCISR_RETRIES 1000
48#define SYSCISR_DELAY_US 1
49 29
50#if defined(CONFIG_PM) || defined(CONFIG_SMP) 30#if defined(CONFIG_PM) || defined(CONFIG_SMP)
51 31
52static DEFINE_SPINLOCK(r8a7779_sysc_lock); /* SMP CPUs + I/O devices */
53
54static int r8a7779_sysc_pwr_on_off(struct r8a7779_pm_ch *r8a7779_ch,
55 int sr_bit, int reg_offs)
56{
57 int k;
58
59 for (k = 0; k < SYSCSR_RETRIES; k++) {
60 if (ioread32(r8a7779_sysc_base + SYSCSR) & (1 << sr_bit))
61 break;
62 udelay(SYSCSR_DELAY_US);
63 }
64
65 if (k == SYSCSR_RETRIES)
66 return -EAGAIN;
67
68 iowrite32(1 << r8a7779_ch->chan_bit,
69 r8a7779_sysc_base + r8a7779_ch->chan_offs + reg_offs);
70
71 return 0;
72}
73
74static int r8a7779_sysc_pwr_off(struct r8a7779_pm_ch *r8a7779_ch)
75{
76 return r8a7779_sysc_pwr_on_off(r8a7779_ch, 0, PWROFFCR_OFFS);
77}
78
79static int r8a7779_sysc_pwr_on(struct r8a7779_pm_ch *r8a7779_ch)
80{
81 return r8a7779_sysc_pwr_on_off(r8a7779_ch, 1, PWRONCR_OFFS);
82}
83
84static int r8a7779_sysc_update(struct r8a7779_pm_ch *r8a7779_ch,
85 int (*on_off_fn)(struct r8a7779_pm_ch *))
86{
87 unsigned int isr_mask = 1 << r8a7779_ch->isr_bit;
88 unsigned int chan_mask = 1 << r8a7779_ch->chan_bit;
89 unsigned int status;
90 unsigned long flags;
91 int ret = 0;
92 int k;
93
94 spin_lock_irqsave(&r8a7779_sysc_lock, flags);
95
96 iowrite32(isr_mask, r8a7779_sysc_base + SYSCISCR);
97
98 do {
99 ret = on_off_fn(r8a7779_ch);
100 if (ret)
101 goto out;
102
103 status = ioread32(r8a7779_sysc_base +
104 r8a7779_ch->chan_offs + PWRER_OFFS);
105 } while (status & chan_mask);
106
107 for (k = 0; k < SYSCISR_RETRIES; k++) {
108 if (ioread32(r8a7779_sysc_base + SYSCISR) & isr_mask)
109 break;
110 udelay(SYSCISR_DELAY_US);
111 }
112
113 if (k == SYSCISR_RETRIES)
114 ret = -EIO;
115
116 iowrite32(isr_mask, r8a7779_sysc_base + SYSCISCR);
117
118 out:
119 spin_unlock_irqrestore(&r8a7779_sysc_lock, flags);
120
121 pr_debug("r8a7779 power domain %d: %02x %02x %02x %02x %02x -> %d\n",
122 r8a7779_ch->isr_bit, ioread32(r8a7779_sysc_base + PWRSR0),
123 ioread32(r8a7779_sysc_base + PWRSR1),
124 ioread32(r8a7779_sysc_base + PWRSR2),
125 ioread32(r8a7779_sysc_base + PWRSR3),
126 ioread32(r8a7779_sysc_base + PWRSR4), ret);
127 return ret;
128}
129
130int r8a7779_sysc_power_down(struct r8a7779_pm_ch *r8a7779_ch)
131{
132 return r8a7779_sysc_update(r8a7779_ch, r8a7779_sysc_pwr_off);
133}
134
135int r8a7779_sysc_power_up(struct r8a7779_pm_ch *r8a7779_ch)
136{
137 return r8a7779_sysc_update(r8a7779_ch, r8a7779_sysc_pwr_on);
138}
139
140static void __init r8a7779_sysc_init(void) 32static void __init r8a7779_sysc_init(void)
141{ 33{
142 r8a7779_sysc_base = ioremap_nocache(0xffd85000, PAGE_SIZE); 34 void __iomem *base = rcar_sysc_init(0xffd85000);
143 if (!r8a7779_sysc_base)
144 panic("unable to ioremap r8a7779 SYSC hardware block\n");
145 35
146 /* enable all interrupt sources, but do not use interrupt handler */ 36 /* enable all interrupt sources, but do not use interrupt handler */
147 iowrite32(0x0131000e, r8a7779_sysc_base + SYSCIER); 37 iowrite32(0x0131000e, base + SYSCIER);
148 iowrite32(0, r8a7779_sysc_base + SYSCIMR); 38 iowrite32(0, base + SYSCIMR);
149} 39}
150 40
151#else /* CONFIG_PM || CONFIG_SMP */ 41#else /* CONFIG_PM || CONFIG_SMP */
@@ -158,24 +48,17 @@ static inline void r8a7779_sysc_init(void) {}
158 48
159static int pd_power_down(struct generic_pm_domain *genpd) 49static int pd_power_down(struct generic_pm_domain *genpd)
160{ 50{
161 return r8a7779_sysc_power_down(to_r8a7779_ch(genpd)); 51 return rcar_sysc_power_down(to_r8a7779_ch(genpd));
162} 52}
163 53
164static int pd_power_up(struct generic_pm_domain *genpd) 54static int pd_power_up(struct generic_pm_domain *genpd)
165{ 55{
166 return r8a7779_sysc_power_up(to_r8a7779_ch(genpd)); 56 return rcar_sysc_power_up(to_r8a7779_ch(genpd));
167} 57}
168 58
169static bool pd_is_off(struct generic_pm_domain *genpd) 59static bool pd_is_off(struct generic_pm_domain *genpd)
170{ 60{
171 struct r8a7779_pm_ch *r8a7779_ch = to_r8a7779_ch(genpd); 61 return rcar_sysc_power_is_off(to_r8a7779_ch(genpd));
172 unsigned int st;
173
174 st = ioread32(r8a7779_sysc_base + r8a7779_ch->chan_offs + PWRSR_OFFS);
175 if (st & (1 << r8a7779_ch->chan_bit))
176 return true;
177
178 return false;
179} 62}
180 63
181static bool pd_active_wakeup(struct device *dev) 64static bool pd_active_wakeup(struct device *dev)
diff --git a/arch/arm/mach-shmobile/pm-r8a7790.c b/arch/arm/mach-shmobile/pm-r8a7790.c
new file mode 100644
index 000000000000..fc82839e2c2a
--- /dev/null
+++ b/arch/arm/mach-shmobile/pm-r8a7790.c
@@ -0,0 +1,45 @@
1/*
2 * r8a7790 Power management support
3 *
4 * Copyright (C) 2013 Renesas Electronics Corporation
5 * Copyright (C) 2011 Renesas Solutions Corp.
6 * Copyright (C) 2011 Magnus Damm
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
11 */
12
13#include <linux/kernel.h>
14#include <asm/io.h>
15#include <mach/pm-rcar.h>
16#include <mach/r8a7790.h>
17
18/* SYSC */
19#define SYSCIER 0x0c
20#define SYSCIMR 0x10
21
22#if defined(CONFIG_SMP)
23
24static void __init r8a7790_sysc_init(void)
25{
26 void __iomem *base = rcar_sysc_init(0xe6180000);
27
28 /* enable all interrupt sources, but do not use interrupt handler */
29 iowrite32(0x0131000e, base + SYSCIER);
30 iowrite32(0, base + SYSCIMR);
31}
32
33#else /* CONFIG_SMP */
34
35static inline void r8a7790_sysc_init(void) {}
36
37#endif /* CONFIG_SMP */
38
39void __init r8a7790_pm_init(void)
40{
41 static int once;
42
43 if (!once++)
44 r8a7790_sysc_init();
45}
diff --git a/arch/arm/mach-shmobile/pm-rcar.c b/arch/arm/mach-shmobile/pm-rcar.c
new file mode 100644
index 000000000000..1f465a12d1b1
--- /dev/null
+++ b/arch/arm/mach-shmobile/pm-rcar.c
@@ -0,0 +1,141 @@
1/*
2 * R-Car SYSC Power management support
3 *
4 * Copyright (C) 2014 Magnus Damm
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10
11#include <linux/delay.h>
12#include <linux/err.h>
13#include <linux/mm.h>
14#include <linux/spinlock.h>
15#include <asm/io.h>
16#include <mach/pm-rcar.h>
17
18/* SYSC */
19#define SYSCSR 0x00
20#define SYSCISR 0x04
21#define SYSCISCR 0x08
22
23#define PWRSR_OFFS 0x00
24#define PWROFFCR_OFFS 0x04
25#define PWRONCR_OFFS 0x0c
26#define PWRER_OFFS 0x14
27
28#define SYSCSR_RETRIES 100
29#define SYSCSR_DELAY_US 1
30
31#define SYSCISR_RETRIES 1000
32#define SYSCISR_DELAY_US 1
33
34#if defined(CONFIG_PM) || defined(CONFIG_SMP)
35
36static void __iomem *rcar_sysc_base;
37static DEFINE_SPINLOCK(rcar_sysc_lock); /* SMP CPUs + I/O devices */
38
39static int rcar_sysc_pwr_on_off(struct rcar_sysc_ch *sysc_ch,
40 int sr_bit, int reg_offs)
41{
42 int k;
43
44 for (k = 0; k < SYSCSR_RETRIES; k++) {
45 if (ioread32(rcar_sysc_base + SYSCSR) & (1 << sr_bit))
46 break;
47 udelay(SYSCSR_DELAY_US);
48 }
49
50 if (k == SYSCSR_RETRIES)
51 return -EAGAIN;
52
53 iowrite32(1 << sysc_ch->chan_bit,
54 rcar_sysc_base + sysc_ch->chan_offs + reg_offs);
55
56 return 0;
57}
58
59static int rcar_sysc_pwr_off(struct rcar_sysc_ch *sysc_ch)
60{
61 return rcar_sysc_pwr_on_off(sysc_ch, 0, PWROFFCR_OFFS);
62}
63
64static int rcar_sysc_pwr_on(struct rcar_sysc_ch *sysc_ch)
65{
66 return rcar_sysc_pwr_on_off(sysc_ch, 1, PWRONCR_OFFS);
67}
68
69static int rcar_sysc_update(struct rcar_sysc_ch *sysc_ch,
70 int (*on_off_fn)(struct rcar_sysc_ch *))
71{
72 unsigned int isr_mask = 1 << sysc_ch->isr_bit;
73 unsigned int chan_mask = 1 << sysc_ch->chan_bit;
74 unsigned int status;
75 unsigned long flags;
76 int ret = 0;
77 int k;
78
79 spin_lock_irqsave(&rcar_sysc_lock, flags);
80
81 iowrite32(isr_mask, rcar_sysc_base + SYSCISCR);
82
83 do {
84 ret = on_off_fn(sysc_ch);
85 if (ret)
86 goto out;
87
88 status = ioread32(rcar_sysc_base +
89 sysc_ch->chan_offs + PWRER_OFFS);
90 } while (status & chan_mask);
91
92 for (k = 0; k < SYSCISR_RETRIES; k++) {
93 if (ioread32(rcar_sysc_base + SYSCISR) & isr_mask)
94 break;
95 udelay(SYSCISR_DELAY_US);
96 }
97
98 if (k == SYSCISR_RETRIES)
99 ret = -EIO;
100
101 iowrite32(isr_mask, rcar_sysc_base + SYSCISCR);
102
103 out:
104 spin_unlock_irqrestore(&rcar_sysc_lock, flags);
105
106 pr_debug("sysc power domain %d: %08x -> %d\n",
107 sysc_ch->isr_bit, ioread32(rcar_sysc_base + SYSCISR), ret);
108 return ret;
109}
110
111int rcar_sysc_power_down(struct rcar_sysc_ch *sysc_ch)
112{
113 return rcar_sysc_update(sysc_ch, rcar_sysc_pwr_off);
114}
115
116int rcar_sysc_power_up(struct rcar_sysc_ch *sysc_ch)
117{
118 return rcar_sysc_update(sysc_ch, rcar_sysc_pwr_on);
119}
120
121bool rcar_sysc_power_is_off(struct rcar_sysc_ch *sysc_ch)
122{
123 unsigned int st;
124
125 st = ioread32(rcar_sysc_base + sysc_ch->chan_offs + PWRSR_OFFS);
126 if (st & (1 << sysc_ch->chan_bit))
127 return true;
128
129 return false;
130}
131
132void __iomem *rcar_sysc_init(phys_addr_t base)
133{
134 rcar_sysc_base = ioremap_nocache(base, PAGE_SIZE);
135 if (!rcar_sysc_base)
136 panic("unable to ioremap R-Car SYSC hardware block\n");
137
138 return rcar_sysc_base;
139}
140
141#endif /* CONFIG_PM || CONFIG_SMP */
diff --git a/arch/arm/mach-shmobile/setup-rcar-gen2.c b/arch/arm/mach-shmobile/setup-rcar-gen2.c
index 69ccc6c6fd33..10604480f325 100644
--- a/arch/arm/mach-shmobile/setup-rcar-gen2.c
+++ b/arch/arm/mach-shmobile/setup-rcar-gen2.c
@@ -28,7 +28,7 @@
28 28
29#define MODEMR 0xe6160060 29#define MODEMR 0xe6160060
30 30
31u32 __init rcar_gen2_read_mode_pins(void) 31u32 rcar_gen2_read_mode_pins(void)
32{ 32{
33 void __iomem *modemr = ioremap_nocache(MODEMR, 4); 33 void __iomem *modemr = ioremap_nocache(MODEMR, 4);
34 u32 mode; 34 u32 mode;
diff --git a/arch/arm/mach-shmobile/smp-r8a7779.c b/arch/arm/mach-shmobile/smp-r8a7779.c
index 627c1f0d9478..e7a3201473d0 100644
--- a/arch/arm/mach-shmobile/smp-r8a7779.c
+++ b/arch/arm/mach-shmobile/smp-r8a7779.c
@@ -24,6 +24,7 @@
24#include <linux/io.h> 24#include <linux/io.h>
25#include <linux/delay.h> 25#include <linux/delay.h>
26#include <mach/common.h> 26#include <mach/common.h>
27#include <mach/pm-rcar.h>
27#include <mach/r8a7779.h> 28#include <mach/r8a7779.h>
28#include <asm/cacheflush.h> 29#include <asm/cacheflush.h>
29#include <asm/smp_plat.h> 30#include <asm/smp_plat.h>
@@ -33,25 +34,25 @@
33#define AVECR IOMEM(0xfe700040) 34#define AVECR IOMEM(0xfe700040)
34#define R8A7779_SCU_BASE 0xf0000000 35#define R8A7779_SCU_BASE 0xf0000000
35 36
36static struct r8a7779_pm_ch r8a7779_ch_cpu1 = { 37static struct rcar_sysc_ch r8a7779_ch_cpu1 = {
37 .chan_offs = 0x40, /* PWRSR0 .. PWRER0 */ 38 .chan_offs = 0x40, /* PWRSR0 .. PWRER0 */
38 .chan_bit = 1, /* ARM1 */ 39 .chan_bit = 1, /* ARM1 */
39 .isr_bit = 1, /* ARM1 */ 40 .isr_bit = 1, /* ARM1 */
40}; 41};
41 42
42static struct r8a7779_pm_ch r8a7779_ch_cpu2 = { 43static struct rcar_sysc_ch r8a7779_ch_cpu2 = {
43 .chan_offs = 0x40, /* PWRSR0 .. PWRER0 */ 44 .chan_offs = 0x40, /* PWRSR0 .. PWRER0 */
44 .chan_bit = 2, /* ARM2 */ 45 .chan_bit = 2, /* ARM2 */
45 .isr_bit = 2, /* ARM2 */ 46 .isr_bit = 2, /* ARM2 */
46}; 47};
47 48
48static struct r8a7779_pm_ch r8a7779_ch_cpu3 = { 49static struct rcar_sysc_ch r8a7779_ch_cpu3 = {
49 .chan_offs = 0x40, /* PWRSR0 .. PWRER0 */ 50 .chan_offs = 0x40, /* PWRSR0 .. PWRER0 */
50 .chan_bit = 3, /* ARM3 */ 51 .chan_bit = 3, /* ARM3 */
51 .isr_bit = 3, /* ARM3 */ 52 .isr_bit = 3, /* ARM3 */
52}; 53};
53 54
54static struct r8a7779_pm_ch *r8a7779_ch_cpu[4] = { 55static struct rcar_sysc_ch *r8a7779_ch_cpu[4] = {
55 [1] = &r8a7779_ch_cpu1, 56 [1] = &r8a7779_ch_cpu1,
56 [2] = &r8a7779_ch_cpu2, 57 [2] = &r8a7779_ch_cpu2,
57 [3] = &r8a7779_ch_cpu3, 58 [3] = &r8a7779_ch_cpu3,
@@ -67,7 +68,7 @@ void __init r8a7779_register_twd(void)
67 68
68static int r8a7779_platform_cpu_kill(unsigned int cpu) 69static int r8a7779_platform_cpu_kill(unsigned int cpu)
69{ 70{
70 struct r8a7779_pm_ch *ch = NULL; 71 struct rcar_sysc_ch *ch = NULL;
71 int ret = -EIO; 72 int ret = -EIO;
72 73
73 cpu = cpu_logical_map(cpu); 74 cpu = cpu_logical_map(cpu);
@@ -76,14 +77,14 @@ static int r8a7779_platform_cpu_kill(unsigned int cpu)
76 ch = r8a7779_ch_cpu[cpu]; 77 ch = r8a7779_ch_cpu[cpu];
77 78
78 if (ch) 79 if (ch)
79 ret = r8a7779_sysc_power_down(ch); 80 ret = rcar_sysc_power_down(ch);
80 81
81 return ret ? ret : 1; 82 return ret ? ret : 1;
82} 83}
83 84
84static int r8a7779_boot_secondary(unsigned int cpu, struct task_struct *idle) 85static int r8a7779_boot_secondary(unsigned int cpu, struct task_struct *idle)
85{ 86{
86 struct r8a7779_pm_ch *ch = NULL; 87 struct rcar_sysc_ch *ch = NULL;
87 unsigned int lcpu = cpu_logical_map(cpu); 88 unsigned int lcpu = cpu_logical_map(cpu);
88 int ret; 89 int ret;
89 90
@@ -91,7 +92,7 @@ static int r8a7779_boot_secondary(unsigned int cpu, struct task_struct *idle)
91 ch = r8a7779_ch_cpu[lcpu]; 92 ch = r8a7779_ch_cpu[lcpu];
92 93
93 if (ch) 94 if (ch)
94 ret = r8a7779_sysc_power_up(ch); 95 ret = rcar_sysc_power_up(ch);
95 else 96 else
96 ret = -EIO; 97 ret = -EIO;
97 98
diff --git a/arch/arm/mach-shmobile/smp-r8a7790.c b/arch/arm/mach-shmobile/smp-r8a7790.c
index 015e2753de1f..591052799e8f 100644
--- a/arch/arm/mach-shmobile/smp-r8a7790.c
+++ b/arch/arm/mach-shmobile/smp-r8a7790.c
@@ -19,6 +19,8 @@
19#include <linux/io.h> 19#include <linux/io.h>
20#include <asm/smp_plat.h> 20#include <asm/smp_plat.h>
21#include <mach/common.h> 21#include <mach/common.h>
22#include <mach/pm-rcar.h>
23#include <mach/r8a7790.h>
22 24
23#define RST 0xe6160000 25#define RST 0xe6160000
24#define CA15BAR 0x0020 26#define CA15BAR 0x0020
@@ -27,6 +29,16 @@
27#define CA7RESCNT 0x0044 29#define CA7RESCNT 0x0044
28#define MERAM 0xe8080000 30#define MERAM 0xe8080000
29 31
32static struct rcar_sysc_ch r8a7790_ca15_scu = {
33 .chan_offs = 0x180, /* PWRSR5 .. PWRER5 */
34 .isr_bit = 12, /* CA15-SCU */
35};
36
37static struct rcar_sysc_ch r8a7790_ca7_scu = {
38 .chan_offs = 0x100, /* PWRSR3 .. PWRER3 */
39 .isr_bit = 21, /* CA7-SCU */
40};
41
30static void __init r8a7790_smp_prepare_cpus(unsigned int max_cpus) 42static void __init r8a7790_smp_prepare_cpus(unsigned int max_cpus)
31{ 43{
32 void __iomem *p; 44 void __iomem *p;
@@ -54,6 +66,11 @@ static void __init r8a7790_smp_prepare_cpus(unsigned int max_cpus)
54 writel_relaxed((readl_relaxed(p + CA7RESCNT) & ~0x0f) | 0x5a5a0000, 66 writel_relaxed((readl_relaxed(p + CA7RESCNT) & ~0x0f) | 0x5a5a0000,
55 p + CA7RESCNT); 67 p + CA7RESCNT);
56 iounmap(p); 68 iounmap(p);
69
70 /* turn on power to SCU */
71 r8a7790_pm_init();
72 rcar_sysc_power_up(&r8a7790_ca15_scu);
73 rcar_sysc_power_up(&r8a7790_ca7_scu);
57} 74}
58 75
59struct smp_operations r8a7790_smp_ops __initdata = { 76struct smp_operations r8a7790_smp_ops __initdata = {
diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig
index 9de27cfa688f..b57d7d53b9d3 100644
--- a/arch/arm/mach-sunxi/Kconfig
+++ b/arch/arm/mach-sunxi/Kconfig
@@ -6,6 +6,7 @@ config ARCH_SUNXI
6 select ARM_PSCI 6 select ARM_PSCI
7 select CLKSRC_MMIO 7 select CLKSRC_MMIO
8 select GENERIC_IRQ_CHIP 8 select GENERIC_IRQ_CHIP
9 select HAVE_ARM_ARCH_TIMER
9 select PINCTRL 10 select PINCTRL
10 select PINCTRL_SUNXI 11 select PINCTRL_SUNXI
11 select RESET_CONTROLLER 12 select RESET_CONTROLLER
diff --git a/arch/arm/mach-sunxi/sunxi.c b/arch/arm/mach-sunxi/sunxi.c
index aeea6ceea725..460b5a4962ef 100644
--- a/arch/arm/mach-sunxi/sunxi.c
+++ b/arch/arm/mach-sunxi/sunxi.c
@@ -94,8 +94,8 @@ static void sun6i_restart(enum reboot_mode mode, const char *cmd)
94} 94}
95 95
96static struct of_device_id sunxi_restart_ids[] = { 96static struct of_device_id sunxi_restart_ids[] = {
97 { .compatible = "allwinner,sun4i-wdt" }, 97 { .compatible = "allwinner,sun4i-a10-wdt" },
98 { .compatible = "allwinner,sun6i-wdt" }, 98 { .compatible = "allwinner,sun6i-a31-wdt" },
99 { /*sentinel*/ } 99 { /*sentinel*/ }
100}; 100};
101 101
diff --git a/arch/arm/mach-tegra/Makefile b/arch/arm/mach-tegra/Makefile
index 019bb1758662..6fbfbb77dcd9 100644
--- a/arch/arm/mach-tegra/Makefile
+++ b/arch/arm/mach-tegra/Makefile
@@ -14,7 +14,6 @@ obj-y += sleep.o
14obj-y += tegra.o 14obj-y += tegra.o
15obj-$(CONFIG_CPU_IDLE) += cpuidle.o 15obj-$(CONFIG_CPU_IDLE) += cpuidle.o
16obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += tegra20_speedo.o 16obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += tegra20_speedo.o
17obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += tegra2_emc.o
18obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += sleep-tegra20.o 17obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += sleep-tegra20.o
19obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += pm-tegra20.o 18obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += pm-tegra20.o
20ifeq ($(CONFIG_CPU_IDLE),y) 19ifeq ($(CONFIG_CPU_IDLE),y)
diff --git a/arch/arm/mach-tegra/cpuidle-tegra114.c b/arch/arm/mach-tegra/cpuidle-tegra114.c
index e0b87300243d..b5fb7c110c64 100644
--- a/arch/arm/mach-tegra/cpuidle-tegra114.c
+++ b/arch/arm/mach-tegra/cpuidle-tegra114.c
@@ -19,6 +19,7 @@
19#include <linux/cpuidle.h> 19#include <linux/cpuidle.h>
20#include <linux/cpu_pm.h> 20#include <linux/cpu_pm.h>
21#include <linux/clockchips.h> 21#include <linux/clockchips.h>
22#include <asm/firmware.h>
22 23
23#include <asm/cpuidle.h> 24#include <asm/cpuidle.h>
24#include <asm/suspend.h> 25#include <asm/suspend.h>
@@ -45,7 +46,11 @@ static int tegra114_idle_power_down(struct cpuidle_device *dev,
45 46
46 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &dev->cpu); 47 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &dev->cpu);
47 48
48 cpu_suspend(0, tegra30_sleep_cpu_secondary_finish); 49 call_firmware_op(prepare_idle);
50
51 /* Do suspend by ourselves if the firmware does not implement it */
52 if (call_firmware_op(do_idle) == -ENOSYS)
53 cpu_suspend(0, tegra30_sleep_cpu_secondary_finish);
49 54
50 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &dev->cpu); 55 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &dev->cpu);
51 56
diff --git a/arch/arm/mach-tegra/platsmp.c b/arch/arm/mach-tegra/platsmp.c
index eb72ae709124..929d1046e2b4 100644
--- a/arch/arm/mach-tegra/platsmp.c
+++ b/arch/arm/mach-tegra/platsmp.c
@@ -114,7 +114,7 @@ static int tegra30_boot_secondary(unsigned int cpu, struct task_struct *idle)
114 114
115 /* Wait for the power to come up. */ 115 /* Wait for the power to come up. */
116 timeout = jiffies + msecs_to_jiffies(100); 116 timeout = jiffies + msecs_to_jiffies(100);
117 while (tegra_pmc_cpu_is_powered(cpu)) { 117 while (!tegra_pmc_cpu_is_powered(cpu)) {
118 if (time_after(jiffies, timeout)) 118 if (time_after(jiffies, timeout))
119 return -ETIMEDOUT; 119 return -ETIMEDOUT;
120 udelay(10); 120 udelay(10);
diff --git a/arch/arm/mach-tegra/powergate.c b/arch/arm/mach-tegra/powergate.c
index 3d0c537d9b94..4cefc5cd6bed 100644
--- a/arch/arm/mach-tegra/powergate.c
+++ b/arch/arm/mach-tegra/powergate.c
@@ -484,6 +484,7 @@ int tegra_io_rail_power_on(int id)
484 484
485 return 0; 485 return 0;
486} 486}
487EXPORT_SYMBOL(tegra_io_rail_power_on);
487 488
488int tegra_io_rail_power_off(int id) 489int tegra_io_rail_power_off(int id)
489{ 490{
@@ -511,3 +512,4 @@ int tegra_io_rail_power_off(int id)
511 512
512 return 0; 513 return 0;
513} 514}
515EXPORT_SYMBOL(tegra_io_rail_power_off);
diff --git a/arch/arm/mach-tegra/tegra2_emc.c b/arch/arm/mach-tegra/tegra2_emc.c
deleted file mode 100644
index 3ae4a7f1a2fb..000000000000
--- a/arch/arm/mach-tegra/tegra2_emc.c
+++ /dev/null
@@ -1,347 +0,0 @@
1/*
2 * Copyright (C) 2011 Google, Inc.
3 *
4 * Author:
5 * Colin Cross <ccross@android.com>
6 *
7 * This software is licensed under the terms of the GNU General Public
8 * License version 2, as published by the Free Software Foundation, and
9 * may be copied, distributed, and modified under those terms.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 */
17
18#include <linux/kernel.h>
19#include <linux/device.h>
20#include <linux/clk.h>
21#include <linux/err.h>
22#include <linux/io.h>
23#include <linux/module.h>
24#include <linux/of.h>
25#include <linux/platform_device.h>
26#include <linux/platform_data/tegra_emc.h>
27
28#include "tegra2_emc.h"
29#include "fuse.h"
30
31#ifdef CONFIG_TEGRA_EMC_SCALING_ENABLE
32static bool emc_enable = true;
33#else
34static bool emc_enable;
35#endif
36module_param(emc_enable, bool, 0644);
37
38static struct platform_device *emc_pdev;
39static void __iomem *emc_regbase;
40
41static inline void emc_writel(u32 val, unsigned long addr)
42{
43 writel(val, emc_regbase + addr);
44}
45
46static inline u32 emc_readl(unsigned long addr)
47{
48 return readl(emc_regbase + addr);
49}
50
51static const unsigned long emc_reg_addr[TEGRA_EMC_NUM_REGS] = {
52 0x2c, /* RC */
53 0x30, /* RFC */
54 0x34, /* RAS */
55 0x38, /* RP */
56 0x3c, /* R2W */
57 0x40, /* W2R */
58 0x44, /* R2P */
59 0x48, /* W2P */
60 0x4c, /* RD_RCD */
61 0x50, /* WR_RCD */
62 0x54, /* RRD */
63 0x58, /* REXT */
64 0x5c, /* WDV */
65 0x60, /* QUSE */
66 0x64, /* QRST */
67 0x68, /* QSAFE */
68 0x6c, /* RDV */
69 0x70, /* REFRESH */
70 0x74, /* BURST_REFRESH_NUM */
71 0x78, /* PDEX2WR */
72 0x7c, /* PDEX2RD */
73 0x80, /* PCHG2PDEN */
74 0x84, /* ACT2PDEN */
75 0x88, /* AR2PDEN */
76 0x8c, /* RW2PDEN */
77 0x90, /* TXSR */
78 0x94, /* TCKE */
79 0x98, /* TFAW */
80 0x9c, /* TRPAB */
81 0xa0, /* TCLKSTABLE */
82 0xa4, /* TCLKSTOP */
83 0xa8, /* TREFBW */
84 0xac, /* QUSE_EXTRA */
85 0x114, /* FBIO_CFG6 */
86 0xb0, /* ODT_WRITE */
87 0xb4, /* ODT_READ */
88 0x104, /* FBIO_CFG5 */
89 0x2bc, /* CFG_DIG_DLL */
90 0x2c0, /* DLL_XFORM_DQS */
91 0x2c4, /* DLL_XFORM_QUSE */
92 0x2e0, /* ZCAL_REF_CNT */
93 0x2e4, /* ZCAL_WAIT_CNT */
94 0x2a8, /* AUTO_CAL_INTERVAL */
95 0x2d0, /* CFG_CLKTRIM_0 */
96 0x2d4, /* CFG_CLKTRIM_1 */
97 0x2d8, /* CFG_CLKTRIM_2 */
98};
99
100/* Select the closest EMC rate that is higher than the requested rate */
101long tegra_emc_round_rate(unsigned long rate)
102{
103 struct tegra_emc_pdata *pdata;
104 int i;
105 int best = -1;
106 unsigned long distance = ULONG_MAX;
107
108 if (!emc_pdev)
109 return -EINVAL;
110
111 pdata = emc_pdev->dev.platform_data;
112
113 pr_debug("%s: %lu\n", __func__, rate);
114
115 /*
116 * The EMC clock rate is twice the bus rate, and the bus rate is
117 * measured in kHz
118 */
119 rate = rate / 2 / 1000;
120
121 for (i = 0; i < pdata->num_tables; i++) {
122 if (pdata->tables[i].rate >= rate &&
123 (pdata->tables[i].rate - rate) < distance) {
124 distance = pdata->tables[i].rate - rate;
125 best = i;
126 }
127 }
128
129 if (best < 0)
130 return -EINVAL;
131
132 pr_debug("%s: using %lu\n", __func__, pdata->tables[best].rate);
133
134 return pdata->tables[best].rate * 2 * 1000;
135}
136
137/*
138 * The EMC registers have shadow registers. When the EMC clock is updated
139 * in the clock controller, the shadow registers are copied to the active
140 * registers, allowing glitchless memory bus frequency changes.
141 * This function updates the shadow registers for a new clock frequency,
142 * and relies on the clock lock on the emc clock to avoid races between
143 * multiple frequency changes
144 */
145int tegra_emc_set_rate(unsigned long rate)
146{
147 struct tegra_emc_pdata *pdata;
148 int i;
149 int j;
150
151 if (!emc_pdev)
152 return -EINVAL;
153
154 pdata = emc_pdev->dev.platform_data;
155
156 /*
157 * The EMC clock rate is twice the bus rate, and the bus rate is
158 * measured in kHz
159 */
160 rate = rate / 2 / 1000;
161
162 for (i = 0; i < pdata->num_tables; i++)
163 if (pdata->tables[i].rate == rate)
164 break;
165
166 if (i >= pdata->num_tables)
167 return -EINVAL;
168
169 pr_debug("%s: setting to %lu\n", __func__, rate);
170
171 for (j = 0; j < TEGRA_EMC_NUM_REGS; j++)
172 emc_writel(pdata->tables[i].regs[j], emc_reg_addr[j]);
173
174 emc_readl(pdata->tables[i].regs[TEGRA_EMC_NUM_REGS - 1]);
175
176 return 0;
177}
178
179#ifdef CONFIG_OF
180static struct device_node *tegra_emc_ramcode_devnode(struct device_node *np)
181{
182 struct device_node *iter;
183 u32 reg;
184
185 for_each_child_of_node(np, iter) {
186 if (of_property_read_u32(iter, "nvidia,ram-code", &reg))
187 continue;
188 if (reg == tegra_bct_strapping)
189 return of_node_get(iter);
190 }
191
192 return NULL;
193}
194
195static struct tegra_emc_pdata *tegra_emc_dt_parse_pdata(
196 struct platform_device *pdev)
197{
198 struct device_node *np = pdev->dev.of_node;
199 struct device_node *tnp, *iter;
200 struct tegra_emc_pdata *pdata;
201 int ret, i, num_tables;
202
203 if (!np)
204 return NULL;
205
206 if (of_find_property(np, "nvidia,use-ram-code", NULL)) {
207 tnp = tegra_emc_ramcode_devnode(np);
208 if (!tnp)
209 dev_warn(&pdev->dev,
210 "can't find emc table for ram-code 0x%02x\n",
211 tegra_bct_strapping);
212 } else
213 tnp = of_node_get(np);
214
215 if (!tnp)
216 return NULL;
217
218 num_tables = 0;
219 for_each_child_of_node(tnp, iter)
220 if (of_device_is_compatible(iter, "nvidia,tegra20-emc-table"))
221 num_tables++;
222
223 if (!num_tables) {
224 pdata = NULL;
225 goto out;
226 }
227
228 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
229 pdata->tables = devm_kzalloc(&pdev->dev,
230 sizeof(*pdata->tables) * num_tables,
231 GFP_KERNEL);
232
233 i = 0;
234 for_each_child_of_node(tnp, iter) {
235 u32 prop;
236
237 ret = of_property_read_u32(iter, "clock-frequency", &prop);
238 if (ret) {
239 dev_err(&pdev->dev, "no clock-frequency in %s\n",
240 iter->full_name);
241 continue;
242 }
243 pdata->tables[i].rate = prop;
244
245 ret = of_property_read_u32_array(iter, "nvidia,emc-registers",
246 pdata->tables[i].regs,
247 TEGRA_EMC_NUM_REGS);
248 if (ret) {
249 dev_err(&pdev->dev,
250 "malformed emc-registers property in %s\n",
251 iter->full_name);
252 continue;
253 }
254
255 i++;
256 }
257 pdata->num_tables = i;
258
259out:
260 of_node_put(tnp);
261 return pdata;
262}
263#else
264static struct tegra_emc_pdata *tegra_emc_dt_parse_pdata(
265 struct platform_device *pdev)
266{
267 return NULL;
268}
269#endif
270
271static struct tegra_emc_pdata *tegra_emc_fill_pdata(struct platform_device *pdev)
272{
273 struct clk *c = clk_get_sys(NULL, "emc");
274 struct tegra_emc_pdata *pdata;
275 unsigned long khz;
276 int i;
277
278 WARN_ON(pdev->dev.platform_data);
279 BUG_ON(IS_ERR(c));
280
281 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
282 pdata->tables = devm_kzalloc(&pdev->dev, sizeof(*pdata->tables),
283 GFP_KERNEL);
284
285 pdata->tables[0].rate = clk_get_rate(c) / 2 / 1000;
286
287 for (i = 0; i < TEGRA_EMC_NUM_REGS; i++)
288 pdata->tables[0].regs[i] = emc_readl(emc_reg_addr[i]);
289
290 pdata->num_tables = 1;
291
292 khz = pdata->tables[0].rate;
293 dev_info(&pdev->dev, "no tables provided, using %ld kHz emc, "
294 "%ld kHz mem\n", khz * 2, khz);
295
296 return pdata;
297}
298
299static int tegra_emc_probe(struct platform_device *pdev)
300{
301 struct tegra_emc_pdata *pdata;
302 struct resource *res;
303
304 if (!emc_enable) {
305 dev_err(&pdev->dev, "disabled per module parameter\n");
306 return -ENODEV;
307 }
308
309 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
310 emc_regbase = devm_ioremap_resource(&pdev->dev, res);
311 if (IS_ERR(emc_regbase))
312 return PTR_ERR(emc_regbase);
313
314 pdata = pdev->dev.platform_data;
315
316 if (!pdata)
317 pdata = tegra_emc_dt_parse_pdata(pdev);
318
319 if (!pdata)
320 pdata = tegra_emc_fill_pdata(pdev);
321
322 pdev->dev.platform_data = pdata;
323
324 emc_pdev = pdev;
325
326 return 0;
327}
328
329static struct of_device_id tegra_emc_of_match[] = {
330 { .compatible = "nvidia,tegra20-emc", },
331 { },
332};
333
334static struct platform_driver tegra_emc_driver = {
335 .driver = {
336 .name = "tegra-emc",
337 .owner = THIS_MODULE,
338 .of_match_table = tegra_emc_of_match,
339 },
340 .probe = tegra_emc_probe,
341};
342
343static int __init tegra_emc_init(void)
344{
345 return platform_driver_register(&tegra_emc_driver);
346}
347device_initcall(tegra_emc_init);
diff --git a/arch/arm/mach-tegra/tegra2_emc.h b/arch/arm/mach-tegra/tegra2_emc.h
deleted file mode 100644
index f61409b54cb7..000000000000
--- a/arch/arm/mach-tegra/tegra2_emc.h
+++ /dev/null
@@ -1,24 +0,0 @@
1/*
2 * Copyright (C) 2011 Google, Inc.
3 *
4 * Author:
5 * Colin Cross <ccross@android.com>
6 *
7 * This software is licensed under the terms of the GNU General Public
8 * License version 2, as published by the Free Software Foundation, and
9 * may be copied, distributed, and modified under those terms.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 */
17
18#ifndef __MACH_TEGRA_TEGRA2_EMC_H_
19#define __MACH_TEGRA_TEGRA2_EMC_H
20
21int tegra_emc_set_rate(unsigned long rate);
22long tegra_emc_round_rate(unsigned long rate);
23
24#endif
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
index 241622e2fea3..f5ad9ee70426 100644
--- a/arch/arm/mm/Kconfig
+++ b/arch/arm/mm/Kconfig
@@ -854,7 +854,7 @@ config OUTER_CACHE_SYNC
854 854
855config CACHE_FEROCEON_L2 855config CACHE_FEROCEON_L2
856 bool "Enable the Feroceon L2 cache controller" 856 bool "Enable the Feroceon L2 cache controller"
857 depends on ARCH_KIRKWOOD || ARCH_MV78XX0 857 depends on ARCH_KIRKWOOD || ARCH_MV78XX0 || ARCH_MVEBU
858 default y 858 default y
859 select OUTER_CACHE 859 select OUTER_CACHE
860 help 860 help
diff --git a/arch/arm/mm/cache-feroceon-l2.c b/arch/arm/mm/cache-feroceon-l2.c
index aae891820f8f..dc814a548056 100644
--- a/arch/arm/mm/cache-feroceon-l2.c
+++ b/arch/arm/mm/cache-feroceon-l2.c
@@ -13,10 +13,15 @@
13 */ 13 */
14 14
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/of.h>
17#include <linux/of_address.h>
16#include <linux/highmem.h> 18#include <linux/highmem.h>
19#include <linux/io.h>
17#include <asm/cacheflush.h> 20#include <asm/cacheflush.h>
18#include <asm/cp15.h> 21#include <asm/cp15.h>
19#include <plat/cache-feroceon-l2.h> 22#include <asm/hardware/cache-feroceon-l2.h>
23
24#define L2_WRITETHROUGH_KIRKWOOD BIT(4)
20 25
21/* 26/*
22 * Low-level cache maintenance operations. 27 * Low-level cache maintenance operations.
@@ -352,3 +357,41 @@ void __init feroceon_l2_init(int __l2_wt_override)
352 printk(KERN_INFO "Feroceon L2: Cache support initialised%s.\n", 357 printk(KERN_INFO "Feroceon L2: Cache support initialised%s.\n",
353 l2_wt_override ? ", in WT override mode" : ""); 358 l2_wt_override ? ", in WT override mode" : "");
354} 359}
360#ifdef CONFIG_OF
361static const struct of_device_id feroceon_ids[] __initconst = {
362 { .compatible = "marvell,kirkwood-cache"},
363 { .compatible = "marvell,feroceon-cache"},
364 {}
365};
366
367int __init feroceon_of_init(void)
368{
369 struct device_node *node;
370 void __iomem *base;
371 bool l2_wt_override = false;
372 struct resource res;
373
374#if defined(CONFIG_CACHE_FEROCEON_L2_WRITETHROUGH)
375 l2_wt_override = true;
376#endif
377
378 node = of_find_matching_node(NULL, feroceon_ids);
379 if (node && of_device_is_compatible(node, "marvell,kirkwood-cache")) {
380 if (of_address_to_resource(node, 0, &res))
381 return -ENODEV;
382
383 base = ioremap(res.start, resource_size(&res));
384 if (!base)
385 return -ENOMEM;
386
387 if (l2_wt_override)
388 writel(readl(base) | L2_WRITETHROUGH_KIRKWOOD, base);
389 else
390 writel(readl(base) & ~L2_WRITETHROUGH_KIRKWOOD, base);
391 }
392
393 feroceon_l2_init(l2_wt_override);
394
395 return 0;
396}
397#endif
diff --git a/arch/arm/mm/cache-tauros2.c b/arch/arm/mm/cache-tauros2.c
index 1be0f4e5e6eb..b273739e6359 100644
--- a/arch/arm/mm/cache-tauros2.c
+++ b/arch/arm/mm/cache-tauros2.c
@@ -33,7 +33,7 @@
33 * outer cache operations into the kernel image if the kernel has been 33 * outer cache operations into the kernel image if the kernel has been
34 * configured to support a pre-v7 CPU. 34 * configured to support a pre-v7 CPU.
35 */ 35 */
36#if __LINUX_ARM_ARCH__ < 7 36#ifdef CONFIG_CPU_32v5
37/* 37/*
38 * Low-level cache maintenance operations. 38 * Low-level cache maintenance operations.
39 */ 39 */
@@ -229,33 +229,6 @@ static void __init tauros2_internal_init(unsigned int features)
229 } 229 }
230#endif 230#endif
231 231
232#ifdef CONFIG_CPU_32v6
233 /*
234 * Check whether this CPU lacks support for the v7 hierarchical
235 * cache ops. (PJ4 is in its v6 personality mode if the MMFR3
236 * register indicates no support for the v7 hierarchical cache
237 * ops.)
238 */
239 if (cpuid_scheme() && (read_mmfr3() & 0xf) == 0) {
240 /*
241 * When Tauros2 is used in an ARMv6 system, the L2
242 * enable bit is in the ARMv6 ARM-mandated position
243 * (bit [26] of the System Control Register).
244 */
245 if (!(get_cr() & 0x04000000)) {
246 printk(KERN_INFO "Tauros2: Enabling L2 cache.\n");
247 adjust_cr(0x04000000, 0x04000000);
248 }
249
250 mode = "ARMv6";
251 outer_cache.inv_range = tauros2_inv_range;
252 outer_cache.clean_range = tauros2_clean_range;
253 outer_cache.flush_range = tauros2_flush_range;
254 outer_cache.disable = tauros2_disable;
255 outer_cache.resume = tauros2_resume;
256 }
257#endif
258
259#ifdef CONFIG_CPU_32v7 232#ifdef CONFIG_CPU_32v7
260 /* 233 /*
261 * Check whether this CPU has support for the v7 hierarchical 234 * Check whether this CPU has support for the v7 hierarchical