aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-06-11 20:49:09 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-06-11 20:49:09 -0400
commit7c00e8ae041b349992047769af741b67379ce19a (patch)
treee3d504b9523eb6b4109a1873ed804ed03762b26d
parenta2b7ab45b8905b9c1813b0212e82a39d5c081c8a (diff)
parent958da6e3ff446fe558bdf0fd06fb2713539ebeef (diff)
Merge tag 'armsoc-soc' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull ARM SoC platform updates from Olof Johansson: "Here are the main updates for SoC support (besides DT additions) for ARM 32- and 64-bit platforms. The branch also contains defconfig updates to turn on drivers and options as needed on the various platforms. The largest parts of the delta are from cleanups moving platform data and board file setup of TI platforms to ti-sysc bus drivers. There are also some sweeping changes of eeprom and nand setup on Davinci, i.MX and other platforms. Samsung is removing support for Exynos5440, which was an oddball SoC that hasn't been seen much use in designs. Renesas is adding support for new SoCs (R-Car E3, RZ/G1C and RZ/N1D). Linus Walleij is also removing support for ux500 (Sony Ericsson) U8540/9540 SoCs that never made it to significant mass production and products" * tag 'armsoc-soc' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (133 commits) MAINTAINERS: add NXP linux team maillist as i.MX reviewer ARM: stm32: Don't select DMA unconditionally on STM32MP157C arm64: defconfig: Enable PCIe on msm8996 and db820c ARM: pxa3xx: enable external wakeup pins ARM: pxa: stargate2: use device properties for at24 eeprom arm64: defconfig: Enable HISILICON_LPC arm64: defconfig: enable drivers for Poplar support arm64: defconfig: Enable UFS on msm8996 ARM: berlin: switch to SPDX license identifier arm: berlin: remove non-necessary flush_cache_all() ARM: berlin: extend BG2CD Kconfig entry OMAP: CLK: CLKSRC: Add suspend resume hooks ARM: AM43XX: Add functions to save/restore am43xx control registers ASoC: ams_delta: use GPIO lookup table ARM: OMAP1: ams-delta: add GPIO lookup tables bus: ti-sysc: Fix optional clocks array access ARM: OMAP2+: Make sure LOGICRETSTATE bits are not cleared ARM: OMAP2+: prm44xx: Inroduce cpu_pm notifiers for context save/restore ARM: OMAP2+: prm44xx: Introduce context save/restore for am43 PRCM IO ARM: OMAP2+: powerdomain: Introduce cpu_pm notifiers for context save/restore ...
-rw-r--r--Documentation/devicetree/bindings/arm/shmobile.txt2
-rw-r--r--Documentation/devicetree/bindings/bus/ti-sysc.txt6
-rw-r--r--Documentation/devicetree/bindings/power/renesas,rcar-sysc.txt2
-rw-r--r--Documentation/devicetree/bindings/reset/renesas,rst.txt2
-rw-r--r--MAINTAINERS1
-rw-r--r--arch/arm/Kconfig2
-rw-r--r--arch/arm/Kconfig.debug13
-rw-r--r--arch/arm/Makefile2
-rw-r--r--arch/arm/common/Makefile1
-rw-r--r--arch/arm/common/secure_cntvoff.S32
-rw-r--r--arch/arm/configs/bcm2835_defconfig2
-rw-r--r--arch/arm/configs/davinci_all_defconfig4
-rw-r--r--arch/arm/configs/exynos_defconfig1
-rw-r--r--arch/arm/configs/imx_v6_v7_defconfig9
-rw-r--r--arch/arm/configs/multi_v7_defconfig12
-rw-r--r--arch/arm/configs/shmobile_defconfig3
-rw-r--r--arch/arm/include/asm/cputype.h14
-rw-r--r--arch/arm/include/asm/secure_cntvoff.h8
-rw-r--r--arch/arm/include/debug/brcmstb.S21
-rw-r--r--arch/arm/mach-berlin/Kconfig6
-rw-r--r--arch/arm/mach-berlin/berlin.c5
-rw-r--r--arch/arm/mach-berlin/headsmp.S5
-rw-r--r--arch/arm/mach-berlin/platsmp.c6
-rw-r--r--arch/arm/mach-davinci/aemif.c8
-rw-r--r--arch/arm/mach-davinci/board-da830-evm.c1
-rw-r--r--arch/arm/mach-davinci/board-da850-evm.c1
-rw-r--r--arch/arm/mach-davinci/board-dm355-evm.c1
-rw-r--r--arch/arm/mach-davinci/board-dm355-leopard.c1
-rw-r--r--arch/arm/mach-davinci/board-dm365-evm.c1
-rw-r--r--arch/arm/mach-davinci/board-dm644x-evm.c3
-rw-r--r--arch/arm/mach-davinci/board-dm646x-evm.c1
-rw-r--r--arch/arm/mach-davinci/board-mityomapl138.c1
-rw-r--r--arch/arm/mach-davinci/board-neuros-osd2.c3
-rw-r--r--arch/arm/mach-davinci/board-sffsdr.c2
-rw-r--r--arch/arm/mach-davinci/davinci.h1
-rw-r--r--arch/arm/mach-davinci/dm644x.c13
-rw-r--r--arch/arm/mach-exynos/Kconfig12
-rw-r--r--arch/arm/mach-exynos/common.h17
-rw-r--r--arch/arm/mach-exynos/exynos.c37
-rw-r--r--arch/arm/mach-exynos/include/mach/map.h2
-rw-r--r--arch/arm/mach-exynos/platsmp.c27
-rw-r--r--arch/arm/mach-exynos/pm.c4
-rw-r--r--arch/arm/mach-exynos/suspend.c4
-rw-r--r--arch/arm/mach-imx/Kconfig1
-rw-r--r--arch/arm/mach-imx/mach-mx31_3ds.c18
-rw-r--r--arch/arm/mach-imx/mach-mx31lilly.c12
-rw-r--r--arch/arm/mach-imx/mach-mx31lite.c16
-rw-r--r--arch/arm/mach-imx/mach-mx31moboard.c17
-rw-r--r--arch/arm/mach-imx/mach-pca100.c13
-rw-r--r--arch/arm/mach-imx/mach-pcm037.c13
-rw-r--r--arch/arm/mach-imx/mach-pcm037_eet.c5
-rw-r--r--arch/arm/mach-imx/mach-pcm043.c13
-rw-r--r--arch/arm/mach-imx/mach-vpr200.c9
-rw-r--r--arch/arm/mach-omap1/board-ams-delta.c107
-rw-r--r--arch/arm/mach-omap1/board-osk.c10
-rw-r--r--arch/arm/mach-omap2/Makefile1
-rw-r--r--arch/arm/mach-omap2/board-generic.c2
-rw-r--r--arch/arm/mach-omap2/clockdomain.c73
-rw-r--r--arch/arm/mach-omap2/clockdomain.h8
-rw-r--r--arch/arm/mach-omap2/cm33xx.c53
-rw-r--r--arch/arm/mach-omap2/cminst44xx.c43
-rw-r--r--arch/arm/mach-omap2/common.h18
-rw-r--r--arch/arm/mach-omap2/control.c112
-rw-r--r--arch/arm/mach-omap2/control.h61
-rw-r--r--arch/arm/mach-omap2/display.c10
-rw-r--r--arch/arm/mach-omap2/hsmmc.c1
-rw-r--r--arch/arm/mach-omap2/i2c.c1
-rw-r--r--arch/arm/mach-omap2/io.c70
-rw-r--r--arch/arm/mach-omap2/omap-pm-noop.c176
-rw-r--r--arch/arm/mach-omap2/omap-pm.h161
-rw-r--r--arch/arm/mach-omap2/omap_device.c22
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.c21
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.h6
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c1
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_3xxx_data.c4
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_43xx_data.c1
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_44xx_data.c4
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_54xx_data.c3
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_7xx_data.c6
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_81xx_data.c1
-rw-r--r--arch/arm/mach-omap2/pdata-quirks.c15
-rw-r--r--arch/arm/mach-omap2/pm-debug.c5
-rw-r--r--arch/arm/mach-omap2/pm.c21
-rw-r--r--arch/arm/mach-omap2/pm33xx-core.c4
-rw-r--r--arch/arm/mach-omap2/pm44xx.c13
-rw-r--r--arch/arm/mach-omap2/powerdomain.c87
-rw-r--r--arch/arm/mach-omap2/powerdomain.h7
-rw-r--r--arch/arm/mach-omap2/prm33xx.c31
-rw-r--r--arch/arm/mach-omap2/prm44xx.c104
-rw-r--r--arch/arm/mach-omap2/timer.c100
-rw-r--r--arch/arm/mach-pxa/pxa3xx.c4
-rw-r--r--arch/arm/mach-pxa/stargate2.c10
-rw-r--r--arch/arm/mach-s3c24xx/h1940-bluetooth.c2
-rw-r--r--arch/arm/mach-s3c24xx/mach-mini2440.c10
-rw-r--r--arch/arm/mach-shmobile/Kconfig13
-rw-r--r--arch/arm/mach-shmobile/common.h1
-rw-r--r--arch/arm/mach-shmobile/headsmp-apmu.S22
-rw-r--r--arch/arm/mach-shmobile/setup-rcar-gen2.c5
-rw-r--r--arch/arm/mach-sunxi/Kconfig2
-rw-r--r--arch/arm/mach-sunxi/Makefile2
-rw-r--r--arch/arm/mach-sunxi/headsmp.S81
-rw-r--r--arch/arm/mach-sunxi/mc_smp.c239
-rw-r--r--arch/arm/mach-sunxi/sunxi.c20
-rw-r--r--arch/arm/mach-tegra/tegra.c4
-rw-r--r--arch/arm/mach-ux500/Kconfig53
-rw-r--r--arch/arm/mach-ux500/cpu-db8500.c16
-rw-r--r--arch/arm/mach-ux500/db8500-regs.h4
-rw-r--r--arch/arm/mm/cache-b15-rac.c30
-rw-r--r--arch/arm/plat-omap/Kconfig10
-rw-r--r--arch/arm/plat-samsung/adc.c3
-rw-r--r--arch/arm/plat-samsung/include/plat/map-s5p.h4
-rw-r--r--arch/arm64/configs/defconfig43
-rw-r--r--drivers/bus/ti-sysc.c388
-rw-r--r--drivers/media/rc/ir-rx51.c17
-rw-r--r--drivers/mtd/nand/raw/davinci_nand.c6
-rw-r--r--drivers/soc/renesas/Kconfig13
-rw-r--r--drivers/soc/renesas/Makefile2
-rw-r--r--drivers/soc/renesas/r8a77470-sysc.c29
-rw-r--r--drivers/soc/renesas/r8a77990-sysc.c68
-rw-r--r--drivers/soc/renesas/r8a77995-sysc.c3
-rw-r--r--drivers/soc/renesas/rcar-rst.c2
-rw-r--r--drivers/soc/renesas/rcar-sysc.c6
-rw-r--r--drivers/soc/renesas/rcar-sysc.h2
-rw-r--r--drivers/soc/renesas/renesas-soc.c16
-rw-r--r--include/dt-bindings/power/r8a77470-sysc.h22
-rw-r--r--include/dt-bindings/power/r8a77990-sysc.h26
-rw-r--r--include/linux/platform_data/media/ir-rx51.h9
-rw-r--r--include/linux/platform_data/mtd-davinci.h10
-rw-r--r--include/linux/platform_data/spi-imx.h29
-rw-r--r--include/linux/platform_data/ti-sysc.h1
-rw-r--r--sound/soc/omap/ams-delta.c38
131 files changed, 2038 insertions, 1006 deletions
diff --git a/Documentation/devicetree/bindings/arm/shmobile.txt b/Documentation/devicetree/bindings/arm/shmobile.txt
index d3d1df97834f..86ac320323a7 100644
--- a/Documentation/devicetree/bindings/arm/shmobile.txt
+++ b/Documentation/devicetree/bindings/arm/shmobile.txt
@@ -21,6 +21,8 @@ SoCs:
21 compatible = "renesas,r8a7744" 21 compatible = "renesas,r8a7744"
22 - RZ/G1E (R8A77450) 22 - RZ/G1E (R8A77450)
23 compatible = "renesas,r8a7745" 23 compatible = "renesas,r8a7745"
24 - RZ/G1C (R8A77470)
25 compatible = "renesas,r8a77470"
24 - R-Car M1A (R8A77781) 26 - R-Car M1A (R8A77781)
25 compatible = "renesas,r8a7778" 27 compatible = "renesas,r8a7778"
26 - R-Car H1 (R8A77790) 28 - R-Car H1 (R8A77790)
diff --git a/Documentation/devicetree/bindings/bus/ti-sysc.txt b/Documentation/devicetree/bindings/bus/ti-sysc.txt
index 2957a9ae291f..d8ed5b780ed9 100644
--- a/Documentation/devicetree/bindings/bus/ti-sysc.txt
+++ b/Documentation/devicetree/bindings/bus/ti-sysc.txt
@@ -79,7 +79,11 @@ Optional properties:
79 mode as for example omap4 L4_CFG_CLKCTRL 79 mode as for example omap4 L4_CFG_CLKCTRL
80 80
81- clock-names should contain at least "fck", and optionally also "ick" 81- clock-names should contain at least "fck", and optionally also "ick"
82 depending on the SoC and the interconnect target module 82 depending on the SoC and the interconnect target module,
83 some interconnect target modules also need additional
84 optional clocks that can be specified as listed in TRM
85 for the related CLKCTRL register bits 8 to 15 such as
86 "dbclk" or "clk32k" depending on their role
83 87
84- ti,hwmods optional TI interconnect module name to use legacy 88- ti,hwmods optional TI interconnect module name to use legacy
85 hwmod platform data 89 hwmod platform data
diff --git a/Documentation/devicetree/bindings/power/renesas,rcar-sysc.txt b/Documentation/devicetree/bindings/power/renesas,rcar-sysc.txt
index ab399e559257..180ae65be753 100644
--- a/Documentation/devicetree/bindings/power/renesas,rcar-sysc.txt
+++ b/Documentation/devicetree/bindings/power/renesas,rcar-sysc.txt
@@ -9,6 +9,7 @@ Required properties:
9 - compatible: Must contain exactly one of the following: 9 - compatible: Must contain exactly one of the following:
10 - "renesas,r8a7743-sysc" (RZ/G1M) 10 - "renesas,r8a7743-sysc" (RZ/G1M)
11 - "renesas,r8a7745-sysc" (RZ/G1E) 11 - "renesas,r8a7745-sysc" (RZ/G1E)
12 - "renesas,r8a77470-sysc" (RZ/G1C)
12 - "renesas,r8a7779-sysc" (R-Car H1) 13 - "renesas,r8a7779-sysc" (R-Car H1)
13 - "renesas,r8a7790-sysc" (R-Car H2) 14 - "renesas,r8a7790-sysc" (R-Car H2)
14 - "renesas,r8a7791-sysc" (R-Car M2-W) 15 - "renesas,r8a7791-sysc" (R-Car M2-W)
@@ -20,6 +21,7 @@ Required properties:
20 - "renesas,r8a77965-sysc" (R-Car M3-N) 21 - "renesas,r8a77965-sysc" (R-Car M3-N)
21 - "renesas,r8a77970-sysc" (R-Car V3M) 22 - "renesas,r8a77970-sysc" (R-Car V3M)
22 - "renesas,r8a77980-sysc" (R-Car V3H) 23 - "renesas,r8a77980-sysc" (R-Car V3H)
24 - "renesas,r8a77990-sysc" (R-Car E3)
23 - "renesas,r8a77995-sysc" (R-Car D3) 25 - "renesas,r8a77995-sysc" (R-Car D3)
24 - reg: Address start and address range for the device. 26 - reg: Address start and address range for the device.
25 - #power-domain-cells: Must be 1. 27 - #power-domain-cells: Must be 1.
diff --git a/Documentation/devicetree/bindings/reset/renesas,rst.txt b/Documentation/devicetree/bindings/reset/renesas,rst.txt
index 294a0dae106a..67e83b02e10b 100644
--- a/Documentation/devicetree/bindings/reset/renesas,rst.txt
+++ b/Documentation/devicetree/bindings/reset/renesas,rst.txt
@@ -17,6 +17,7 @@ Required properties:
17 Examples with soctypes are: 17 Examples with soctypes are:
18 - "renesas,r8a7743-rst" (RZ/G1M) 18 - "renesas,r8a7743-rst" (RZ/G1M)
19 - "renesas,r8a7745-rst" (RZ/G1E) 19 - "renesas,r8a7745-rst" (RZ/G1E)
20 - "renesas,r8a77470-rst" (RZ/G1C)
20 - "renesas,r8a7778-reset-wdt" (R-Car M1A) 21 - "renesas,r8a7778-reset-wdt" (R-Car M1A)
21 - "renesas,r8a7779-reset-wdt" (R-Car H1) 22 - "renesas,r8a7779-reset-wdt" (R-Car H1)
22 - "renesas,r8a7790-rst" (R-Car H2) 23 - "renesas,r8a7790-rst" (R-Car H2)
@@ -29,6 +30,7 @@ Required properties:
29 - "renesas,r8a77965-rst" (R-Car M3-N) 30 - "renesas,r8a77965-rst" (R-Car M3-N)
30 - "renesas,r8a77970-rst" (R-Car V3M) 31 - "renesas,r8a77970-rst" (R-Car V3M)
31 - "renesas,r8a77980-rst" (R-Car V3H) 32 - "renesas,r8a77980-rst" (R-Car V3H)
33 - "renesas,r8a77990-rst" (R-Car E3)
32 - "renesas,r8a77995-rst" (R-Car D3) 34 - "renesas,r8a77995-rst" (R-Car D3)
33 - reg: Address start and address range for the device. 35 - reg: Address start and address range for the device.
34 36
diff --git a/MAINTAINERS b/MAINTAINERS
index 868be4ab62db..0ee6fe90a52b 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1419,6 +1419,7 @@ M: Shawn Guo <shawnguo@kernel.org>
1419M: Sascha Hauer <s.hauer@pengutronix.de> 1419M: Sascha Hauer <s.hauer@pengutronix.de>
1420R: Pengutronix Kernel Team <kernel@pengutronix.de> 1420R: Pengutronix Kernel Team <kernel@pengutronix.de>
1421R: Fabio Estevam <fabio.estevam@nxp.com> 1421R: Fabio Estevam <fabio.estevam@nxp.com>
1422R: NXP Linux Team <linux-imx@nxp.com>
1422L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 1423L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
1423S: Maintained 1424S: Maintained
1424T: git git://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux.git 1425T: git git://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux.git
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 94d222545920..2a78bdef9a24 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1463,7 +1463,7 @@ config ARM_PSCI
1463config ARCH_NR_GPIO 1463config ARCH_NR_GPIO
1464 int 1464 int
1465 default 2048 if ARCH_SOCFPGA 1465 default 2048 if ARCH_SOCFPGA
1466 default 1024 if ARCH_BRCMSTB || ARCH_SHMOBILE || ARCH_TEGRA || \ 1466 default 1024 if ARCH_BRCMSTB || ARCH_RENESAS || ARCH_TEGRA || \
1467 ARCH_ZYNQ 1467 ARCH_ZYNQ
1468 default 512 if ARCH_EXYNOS || ARCH_KEYSTONE || SOC_OMAP5 || \ 1468 default 512 if ARCH_EXYNOS || ARCH_KEYSTONE || SOC_OMAP5 || \
1469 SOC_DRA7XX || ARCH_S3C24XX || ARCH_S3C64XX || ARCH_S5PV210 1469 SOC_DRA7XX || ARCH_S3C24XX || ARCH_S3C64XX || ARCH_S5PV210
diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index 199ebc1c4538..693f84392f1b 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -942,6 +942,13 @@ choice
942 via SCIF0 on Renesas RZ/G1M (R8A7743), R-Car H2 (R8A7790), 942 via SCIF0 on Renesas RZ/G1M (R8A7743), R-Car H2 (R8A7790),
943 M2-W (R8A7791), V2H (R8A7792), or M2-N (R8A7793). 943 M2-W (R8A7791), V2H (R8A7792), or M2-N (R8A7793).
944 944
945 config DEBUG_RCAR_GEN2_SCIF1
946 bool "Kernel low-level debugging messages via SCIF1 on R8A77470"
947 depends on ARCH_R8A77470
948 help
949 Say Y here if you want kernel low-level debugging support
950 via SCIF1 on Renesas RZ/G1C (R8A77470).
951
945 config DEBUG_RCAR_GEN2_SCIF2 952 config DEBUG_RCAR_GEN2_SCIF2
946 bool "Kernel low-level debugging messages via SCIF2 on R8A7794" 953 bool "Kernel low-level debugging messages via SCIF2 on R8A7794"
947 depends on ARCH_R8A7794 954 depends on ARCH_R8A7794
@@ -1495,6 +1502,7 @@ config DEBUG_LL_INCLUDE
1495 default "debug/renesas-scif.S" if DEBUG_RCAR_GEN1_SCIF0 1502 default "debug/renesas-scif.S" if DEBUG_RCAR_GEN1_SCIF0
1496 default "debug/renesas-scif.S" if DEBUG_RCAR_GEN1_SCIF2 1503 default "debug/renesas-scif.S" if DEBUG_RCAR_GEN1_SCIF2
1497 default "debug/renesas-scif.S" if DEBUG_RCAR_GEN2_SCIF0 1504 default "debug/renesas-scif.S" if DEBUG_RCAR_GEN2_SCIF0
1505 default "debug/renesas-scif.S" if DEBUG_RCAR_GEN2_SCIF1
1498 default "debug/renesas-scif.S" if DEBUG_RCAR_GEN2_SCIF2 1506 default "debug/renesas-scif.S" if DEBUG_RCAR_GEN2_SCIF2
1499 default "debug/renesas-scif.S" if DEBUG_RCAR_GEN2_SCIF4 1507 default "debug/renesas-scif.S" if DEBUG_RCAR_GEN2_SCIF4
1500 default "debug/renesas-scif.S" if DEBUG_RMOBILE_SCIFA0 1508 default "debug/renesas-scif.S" if DEBUG_RMOBILE_SCIFA0
@@ -1617,6 +1625,7 @@ config DEBUG_UART_PHYS
1617 default 0xe6c80000 if DEBUG_RMOBILE_SCIFA4 1625 default 0xe6c80000 if DEBUG_RMOBILE_SCIFA4
1618 default 0xe6e58000 if DEBUG_RCAR_GEN2_SCIF2 1626 default 0xe6e58000 if DEBUG_RCAR_GEN2_SCIF2
1619 default 0xe6e60000 if DEBUG_RCAR_GEN2_SCIF0 1627 default 0xe6e60000 if DEBUG_RCAR_GEN2_SCIF0
1628 default 0xe6e68000 if DEBUG_RCAR_GEN2_SCIF1
1620 default 0xe6ee0000 if DEBUG_RCAR_GEN2_SCIF4 1629 default 0xe6ee0000 if DEBUG_RCAR_GEN2_SCIF4
1621 default 0xe8008000 if DEBUG_R7S72100_SCIF2 1630 default 0xe8008000 if DEBUG_R7S72100_SCIF2
1622 default 0xf0000be0 if ARCH_EBSA110 1631 default 0xf0000be0 if ARCH_EBSA110
@@ -1651,8 +1660,8 @@ config DEBUG_UART_PHYS
1651 DEBUG_NETX_UART || \ 1660 DEBUG_NETX_UART || \
1652 DEBUG_QCOM_UARTDM || DEBUG_R7S72100_SCIF2 || \ 1661 DEBUG_QCOM_UARTDM || DEBUG_R7S72100_SCIF2 || \
1653 DEBUG_RCAR_GEN1_SCIF0 || DEBUG_RCAR_GEN1_SCIF2 || \ 1662 DEBUG_RCAR_GEN1_SCIF0 || DEBUG_RCAR_GEN1_SCIF2 || \
1654 DEBUG_RCAR_GEN2_SCIF0 || DEBUG_RCAR_GEN2_SCIF2 || \ 1663 DEBUG_RCAR_GEN2_SCIF0 || DEBUG_RCAR_GEN2_SCIF1 || \
1655 DEBUG_RCAR_GEN2_SCIF4 || \ 1664 DEBUG_RCAR_GEN2_SCIF2 || DEBUG_RCAR_GEN2_SCIF4 || \
1656 DEBUG_RMOBILE_SCIFA0 || DEBUG_RMOBILE_SCIFA1 || \ 1665 DEBUG_RMOBILE_SCIFA0 || DEBUG_RMOBILE_SCIFA1 || \
1657 DEBUG_RMOBILE_SCIFA4 || DEBUG_S3C24XX_UART || \ 1666 DEBUG_RMOBILE_SCIFA4 || DEBUG_S3C24XX_UART || \
1658 DEBUG_S3C64XX_UART || \ 1667 DEBUG_S3C64XX_UART || \
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 1dc4045e1af6..fc26c3d7b9b6 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -212,7 +212,7 @@ machine-$(CONFIG_ARCH_S3C24XX) += s3c24xx
212machine-$(CONFIG_ARCH_S3C64XX) += s3c64xx 212machine-$(CONFIG_ARCH_S3C64XX) += s3c64xx
213machine-$(CONFIG_ARCH_S5PV210) += s5pv210 213machine-$(CONFIG_ARCH_S5PV210) += s5pv210
214machine-$(CONFIG_ARCH_SA1100) += sa1100 214machine-$(CONFIG_ARCH_SA1100) += sa1100
215machine-$(CONFIG_ARCH_SHMOBILE) += shmobile 215machine-$(CONFIG_ARCH_RENESAS) += shmobile
216machine-$(CONFIG_ARCH_SIRF) += prima2 216machine-$(CONFIG_ARCH_SIRF) += prima2
217machine-$(CONFIG_ARCH_SOCFPGA) += socfpga 217machine-$(CONFIG_ARCH_SOCFPGA) += socfpga
218machine-$(CONFIG_ARCH_STI) += sti 218machine-$(CONFIG_ARCH_STI) += sti
diff --git a/arch/arm/common/Makefile b/arch/arm/common/Makefile
index 70b4a14ed993..1e9f7af8f70f 100644
--- a/arch/arm/common/Makefile
+++ b/arch/arm/common/Makefile
@@ -10,6 +10,7 @@ obj-$(CONFIG_DMABOUNCE) += dmabounce.o
10obj-$(CONFIG_SHARP_LOCOMO) += locomo.o 10obj-$(CONFIG_SHARP_LOCOMO) += locomo.o
11obj-$(CONFIG_SHARP_PARAM) += sharpsl_param.o 11obj-$(CONFIG_SHARP_PARAM) += sharpsl_param.o
12obj-$(CONFIG_SHARP_SCOOP) += scoop.o 12obj-$(CONFIG_SHARP_SCOOP) += scoop.o
13obj-$(CONFIG_SMP) += secure_cntvoff.o
13obj-$(CONFIG_PCI_HOST_ITE8152) += it8152.o 14obj-$(CONFIG_PCI_HOST_ITE8152) += it8152.o
14obj-$(CONFIG_MCPM) += mcpm_head.o mcpm_entry.o mcpm_platsmp.o vlock.o 15obj-$(CONFIG_MCPM) += mcpm_head.o mcpm_entry.o mcpm_platsmp.o vlock.o
15CFLAGS_REMOVE_mcpm_entry.o = -pg 16CFLAGS_REMOVE_mcpm_entry.o = -pg
diff --git a/arch/arm/common/secure_cntvoff.S b/arch/arm/common/secure_cntvoff.S
new file mode 100644
index 000000000000..53fc7bdb6c2e
--- /dev/null
+++ b/arch/arm/common/secure_cntvoff.S
@@ -0,0 +1,32 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Copyright (C) 2014 Renesas Electronics Corporation
4 *
5 * Initialization of CNTVOFF register from secure mode
6 *
7 */
8
9#include <linux/linkage.h>
10#include <asm/assembler.h>
11
12ENTRY(secure_cntvoff_init)
13 .arch armv7-a
14 /*
15 * CNTVOFF has to be initialized either from non-secure Hypervisor
16 * mode or secure Monitor mode with SCR.NS==1. If TrustZone is enabled
17 * then it should be handled by the secure code. The CPU must implement
18 * the virtualization extensions.
19 */
20 cps #MON_MODE
21 mrc p15, 0, r1, c1, c1, 0 /* Get Secure Config */
22 orr r0, r1, #1
23 mcr p15, 0, r0, c1, c1, 0 /* Set Non Secure bit */
24 isb
25 mov r0, #0
26 mcrr p15, 4, r0, r0, c14 /* CNTVOFF = 0 */
27 isb
28 mcr p15, 0, r1, c1, c1, 0 /* Set Secure bit */
29 isb
30 cps #SVC_MODE
31 ret lr
32ENDPROC(secure_cntvoff_init)
diff --git a/arch/arm/configs/bcm2835_defconfig b/arch/arm/configs/bcm2835_defconfig
index 8682b15336b9..e4d188f0a4b4 100644
--- a/arch/arm/configs/bcm2835_defconfig
+++ b/arch/arm/configs/bcm2835_defconfig
@@ -64,6 +64,7 @@ CONFIG_BLK_DEV_SD=y
64CONFIG_SCSI_CONSTANTS=y 64CONFIG_SCSI_CONSTANTS=y
65CONFIG_SCSI_SCAN_ASYNC=y 65CONFIG_SCSI_SCAN_ASYNC=y
66CONFIG_NETDEVICES=y 66CONFIG_NETDEVICES=y
67CONFIG_USB_LAN78XX=y
67CONFIG_USB_USBNET=y 68CONFIG_USB_USBNET=y
68CONFIG_USB_NET_SMSC95XX=y 69CONFIG_USB_NET_SMSC95XX=y
69CONFIG_BRCMFMAC=m 70CONFIG_BRCMFMAC=m
@@ -127,6 +128,7 @@ CONFIG_LEDS_TRIGGER_CAMERA=y
127CONFIG_DMADEVICES=y 128CONFIG_DMADEVICES=y
128CONFIG_DMA_BCM2835=y 129CONFIG_DMA_BCM2835=y
129CONFIG_STAGING=y 130CONFIG_STAGING=y
131CONFIG_BCM2835_VCHIQ=m
130CONFIG_MAILBOX=y 132CONFIG_MAILBOX=y
131CONFIG_BCM2835_MBOX=y 133CONFIG_BCM2835_MBOX=y
132# CONFIG_IOMMU_SUPPORT is not set 134# CONFIG_IOMMU_SUPPORT is not set
diff --git a/arch/arm/configs/davinci_all_defconfig b/arch/arm/configs/davinci_all_defconfig
index c302a04e8cbc..21b2d7791df4 100644
--- a/arch/arm/configs/davinci_all_defconfig
+++ b/arch/arm/configs/davinci_all_defconfig
@@ -56,7 +56,7 @@ CONFIG_IP_PNP_DHCP=y
56CONFIG_NETFILTER=y 56CONFIG_NETFILTER=y
57CONFIG_DEVTMPFS=y 57CONFIG_DEVTMPFS=y
58CONFIG_DEVTMPFS_MOUNT=y 58CONFIG_DEVTMPFS_MOUNT=y
59# CONFIG_FW_LOADER is not set 59CONFIG_FW_LOADER=m
60CONFIG_DMA_CMA=y 60CONFIG_DMA_CMA=y
61CONFIG_DA8XX_MSTPRI=y 61CONFIG_DA8XX_MSTPRI=y
62CONFIG_MTD=m 62CONFIG_MTD=m
@@ -212,6 +212,8 @@ CONFIG_RTC_CLASS=y
212CONFIG_RTC_DRV_OMAP=m 212CONFIG_RTC_DRV_OMAP=m
213CONFIG_DMADEVICES=y 213CONFIG_DMADEVICES=y
214CONFIG_TI_EDMA=y 214CONFIG_TI_EDMA=y
215CONFIG_REMOTEPROC=m
216CONFIG_DA8XX_REMOTEPROC=m
215CONFIG_MEMORY=y 217CONFIG_MEMORY=y
216CONFIG_TI_AEMIF=m 218CONFIG_TI_AEMIF=m
217CONFIG_DA8XX_DDRCTL=y 219CONFIG_DA8XX_DDRCTL=y
diff --git a/arch/arm/configs/exynos_defconfig b/arch/arm/configs/exynos_defconfig
index 629189c62fd1..85b2369d6b20 100644
--- a/arch/arm/configs/exynos_defconfig
+++ b/arch/arm/configs/exynos_defconfig
@@ -208,6 +208,7 @@ CONFIG_DRM_EXYNOS_DSI=y
208CONFIG_DRM_EXYNOS_HDMI=y 208CONFIG_DRM_EXYNOS_HDMI=y
209CONFIG_DRM_PANEL_SIMPLE=y 209CONFIG_DRM_PANEL_SIMPLE=y
210CONFIG_DRM_PANEL_SAMSUNG_LD9040=y 210CONFIG_DRM_PANEL_SAMSUNG_LD9040=y
211CONFIG_DRM_PANEL_SAMSUNG_S6E63J0X03=y
211CONFIG_DRM_PANEL_SAMSUNG_S6E8AA0=y 212CONFIG_DRM_PANEL_SAMSUNG_S6E8AA0=y
212CONFIG_DRM_NXP_PTN3460=y 213CONFIG_DRM_NXP_PTN3460=y
213CONFIG_DRM_PARADE_PS8622=y 214CONFIG_DRM_PARADE_PS8622=y
diff --git a/arch/arm/configs/imx_v6_v7_defconfig b/arch/arm/configs/imx_v6_v7_defconfig
index 3a308437b088..f70507ab91ee 100644
--- a/arch/arm/configs/imx_v6_v7_defconfig
+++ b/arch/arm/configs/imx_v6_v7_defconfig
@@ -38,6 +38,7 @@ CONFIG_SOC_IMX51=y
38CONFIG_SOC_IMX53=y 38CONFIG_SOC_IMX53=y
39CONFIG_SOC_IMX6Q=y 39CONFIG_SOC_IMX6Q=y
40CONFIG_SOC_IMX6SL=y 40CONFIG_SOC_IMX6SL=y
41CONFIG_SOC_IMX6SLL=y
41CONFIG_SOC_IMX6SX=y 42CONFIG_SOC_IMX6SX=y
42CONFIG_SOC_IMX6UL=y 43CONFIG_SOC_IMX6UL=y
43CONFIG_SOC_IMX7D=y 44CONFIG_SOC_IMX7D=y
@@ -153,6 +154,9 @@ CONFIG_USB_RTL8152=m
153CONFIG_USB_USBNET=y 154CONFIG_USB_USBNET=y
154CONFIG_USB_NET_CDC_EEM=m 155CONFIG_USB_NET_CDC_EEM=m
155CONFIG_BRCMFMAC=m 156CONFIG_BRCMFMAC=m
157CONFIG_MWIFIEX=m
158CONFIG_MWIFIEX_SDIO=m
159CONFIG_MWIFIEX_PCIE=m
156CONFIG_WL12XX=m 160CONFIG_WL12XX=m
157CONFIG_WL18XX=m 161CONFIG_WL18XX=m
158CONFIG_WLCORE_SDIO=m 162CONFIG_WLCORE_SDIO=m
@@ -199,6 +203,7 @@ CONFIG_SPI_GPIO=y
199CONFIG_SPI_IMX=y 203CONFIG_SPI_IMX=y
200CONFIG_SPI_FSL_DSPI=y 204CONFIG_SPI_FSL_DSPI=y
201CONFIG_GPIO_SYSFS=y 205CONFIG_GPIO_SYSFS=y
206CONFIG_GPIO_MAX732X=y
202CONFIG_GPIO_MC9S08DZ60=y 207CONFIG_GPIO_MC9S08DZ60=y
203CONFIG_GPIO_PCA953X=y 208CONFIG_GPIO_PCA953X=y
204CONFIG_GPIO_STMPE=y 209CONFIG_GPIO_STMPE=y
@@ -214,11 +219,13 @@ CONFIG_CPU_THERMAL=y
214CONFIG_IMX_THERMAL=y 219CONFIG_IMX_THERMAL=y
215CONFIG_WATCHDOG=y 220CONFIG_WATCHDOG=y
216CONFIG_DA9062_WATCHDOG=y 221CONFIG_DA9062_WATCHDOG=y
222CONFIG_RN5T618_WATCHDOG=y
217CONFIG_IMX2_WDT=y 223CONFIG_IMX2_WDT=y
218CONFIG_MFD_DA9052_I2C=y 224CONFIG_MFD_DA9052_I2C=y
219CONFIG_MFD_DA9062=y 225CONFIG_MFD_DA9062=y
220CONFIG_MFD_MC13XXX_SPI=y 226CONFIG_MFD_MC13XXX_SPI=y
221CONFIG_MFD_MC13XXX_I2C=y 227CONFIG_MFD_MC13XXX_I2C=y
228CONFIG_MFD_RN5T618=y
222CONFIG_MFD_STMPE=y 229CONFIG_MFD_STMPE=y
223CONFIG_REGULATOR=y 230CONFIG_REGULATOR=y
224CONFIG_REGULATOR_FIXED_VOLTAGE=y 231CONFIG_REGULATOR_FIXED_VOLTAGE=y
@@ -229,6 +236,7 @@ CONFIG_REGULATOR_GPIO=y
229CONFIG_REGULATOR_MC13783=y 236CONFIG_REGULATOR_MC13783=y
230CONFIG_REGULATOR_MC13892=y 237CONFIG_REGULATOR_MC13892=y
231CONFIG_REGULATOR_PFUZE100=y 238CONFIG_REGULATOR_PFUZE100=y
239CONFIG_REGULATOR_RN5T618=y
232CONFIG_RC_CORE=y 240CONFIG_RC_CORE=y
233CONFIG_RC_DEVICES=y 241CONFIG_RC_DEVICES=y
234CONFIG_IR_GPIO_CIR=y 242CONFIG_IR_GPIO_CIR=y
@@ -374,6 +382,7 @@ CONFIG_PWM=y
374CONFIG_PWM_FSL_FTM=y 382CONFIG_PWM_FSL_FTM=y
375CONFIG_PWM_IMX=y 383CONFIG_PWM_IMX=y
376CONFIG_NVMEM_IMX_OCOTP=y 384CONFIG_NVMEM_IMX_OCOTP=y
385CONFIG_NVMEM_VF610_OCOTP=y
377CONFIG_TEE=y 386CONFIG_TEE=y
378CONFIG_OPTEE=y 387CONFIG_OPTEE=y
379CONFIG_MUX_MMIO=y 388CONFIG_MUX_MMIO=y
diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig
index e6b3c96d4c09..7e1c543162c3 100644
--- a/arch/arm/configs/multi_v7_defconfig
+++ b/arch/arm/configs/multi_v7_defconfig
@@ -90,6 +90,7 @@ CONFIG_ARCH_R8A73A4=y
90CONFIG_ARCH_R8A7740=y 90CONFIG_ARCH_R8A7740=y
91CONFIG_ARCH_R8A7743=y 91CONFIG_ARCH_R8A7743=y
92CONFIG_ARCH_R8A7745=y 92CONFIG_ARCH_R8A7745=y
93CONFIG_ARCH_R8A77470=y
93CONFIG_ARCH_R8A7778=y 94CONFIG_ARCH_R8A7778=y
94CONFIG_ARCH_R8A7779=y 95CONFIG_ARCH_R8A7779=y
95CONFIG_ARCH_R8A7790=y 96CONFIG_ARCH_R8A7790=y
@@ -187,6 +188,8 @@ CONFIG_B53_MMAP_DRIVER=m
187CONFIG_B53_SRAB_DRIVER=m 188CONFIG_B53_SRAB_DRIVER=m
188CONFIG_CAN_SUN4I=y 189CONFIG_CAN_SUN4I=y
189CONFIG_BT=m 190CONFIG_BT=m
191CONFIG_BT_HCIUART=m
192CONFIG_BT_HCIUART_BCM=y
190CONFIG_BT_MRVL=m 193CONFIG_BT_MRVL=m
191CONFIG_BT_MRVL_SDIO=m 194CONFIG_BT_MRVL_SDIO=m
192CONFIG_CFG80211=m 195CONFIG_CFG80211=m
@@ -280,6 +283,7 @@ CONFIG_FIXED_PHY=y
280CONFIG_ROCKCHIP_PHY=y 283CONFIG_ROCKCHIP_PHY=y
281CONFIG_USB_PEGASUS=y 284CONFIG_USB_PEGASUS=y
282CONFIG_USB_RTL8152=m 285CONFIG_USB_RTL8152=m
286CONFIG_USB_LAN78XX=m
283CONFIG_USB_USBNET=y 287CONFIG_USB_USBNET=y
284CONFIG_USB_NET_SMSC75XX=y 288CONFIG_USB_NET_SMSC75XX=y
285CONFIG_USB_NET_SMSC95XX=y 289CONFIG_USB_NET_SMSC95XX=y
@@ -360,10 +364,12 @@ CONFIG_SERIAL_ST_ASC=y
360CONFIG_SERIAL_ST_ASC_CONSOLE=y 364CONFIG_SERIAL_ST_ASC_CONSOLE=y
361CONFIG_SERIAL_STM32=y 365CONFIG_SERIAL_STM32=y
362CONFIG_SERIAL_STM32_CONSOLE=y 366CONFIG_SERIAL_STM32_CONSOLE=y
367CONFIG_SERIAL_DEV_BUS=y
363CONFIG_HVC_DRIVER=y 368CONFIG_HVC_DRIVER=y
364CONFIG_VIRTIO_CONSOLE=y 369CONFIG_VIRTIO_CONSOLE=y
365CONFIG_I2C_CHARDEV=y 370CONFIG_I2C_CHARDEV=y
366CONFIG_I2C_DAVINCI=y 371CONFIG_I2C_DAVINCI=y
372CONFIG_I2C_MESON=y
367CONFIG_I2C_MUX=y 373CONFIG_I2C_MUX=y
368CONFIG_I2C_ARB_GPIO_CHALLENGE=m 374CONFIG_I2C_ARB_GPIO_CHALLENGE=m
369CONFIG_I2C_MUX_PCA954x=y 375CONFIG_I2C_MUX_PCA954x=y
@@ -385,6 +391,7 @@ CONFIG_I2C_S3C2410=y
385CONFIG_I2C_SH_MOBILE=y 391CONFIG_I2C_SH_MOBILE=y
386CONFIG_I2C_SIRF=y 392CONFIG_I2C_SIRF=y
387CONFIG_I2C_ST=y 393CONFIG_I2C_ST=y
394CONFIG_I2C_STM32F7=y
388CONFIG_I2C_SUN6I_P2WI=y 395CONFIG_I2C_SUN6I_P2WI=y
389CONFIG_I2C_TEGRA=y 396CONFIG_I2C_TEGRA=y
390CONFIG_I2C_UNIPHIER=y 397CONFIG_I2C_UNIPHIER=y
@@ -497,6 +504,7 @@ CONFIG_TEGRA_WATCHDOG=m
497CONFIG_MESON_WATCHDOG=y 504CONFIG_MESON_WATCHDOG=y
498CONFIG_DW_WATCHDOG=y 505CONFIG_DW_WATCHDOG=y
499CONFIG_DIGICOLOR_WATCHDOG=y 506CONFIG_DIGICOLOR_WATCHDOG=y
507CONFIG_RENESAS_WDT=m
500CONFIG_BCM2835_WDT=y 508CONFIG_BCM2835_WDT=y
501CONFIG_BCM47XX_WDT=y 509CONFIG_BCM47XX_WDT=y
502CONFIG_BCM7038_WDT=m 510CONFIG_BCM7038_WDT=m
@@ -638,6 +646,7 @@ CONFIG_DRM_SUN4I=m
638CONFIG_DRM_FSL_DCU=m 646CONFIG_DRM_FSL_DCU=m
639CONFIG_DRM_TEGRA=y 647CONFIG_DRM_TEGRA=y
640CONFIG_DRM_PANEL_SAMSUNG_LD9040=m 648CONFIG_DRM_PANEL_SAMSUNG_LD9040=m
649CONFIG_DRM_PANEL_SAMSUNG_S6E63J0X03=m
641CONFIG_DRM_PANEL_SAMSUNG_S6E8AA0=m 650CONFIG_DRM_PANEL_SAMSUNG_S6E8AA0=m
642CONFIG_DRM_PANEL_SIMPLE=y 651CONFIG_DRM_PANEL_SIMPLE=y
643CONFIG_DRM_SII9234=m 652CONFIG_DRM_SII9234=m
@@ -650,7 +659,6 @@ CONFIG_FB_EFI=y
650CONFIG_FB_WM8505=y 659CONFIG_FB_WM8505=y
651CONFIG_FB_SH_MOBILE_LCDC=y 660CONFIG_FB_SH_MOBILE_LCDC=y
652CONFIG_FB_SIMPLE=y 661CONFIG_FB_SIMPLE=y
653CONFIG_FB_SH_MOBILE_MERAM=y
654CONFIG_BACKLIGHT_LCD_SUPPORT=y 662CONFIG_BACKLIGHT_LCD_SUPPORT=y
655CONFIG_BACKLIGHT_CLASS_DEVICE=y 663CONFIG_BACKLIGHT_CLASS_DEVICE=y
656CONFIG_LCD_PLATFORM=m 664CONFIG_LCD_PLATFORM=m
@@ -947,6 +955,7 @@ CONFIG_PWM_ATMEL=m
947CONFIG_PWM_ATMEL_HLCDC_PWM=m 955CONFIG_PWM_ATMEL_HLCDC_PWM=m
948CONFIG_PWM_ATMEL_TCB=m 956CONFIG_PWM_ATMEL_TCB=m
949CONFIG_PWM_FSL_FTM=m 957CONFIG_PWM_FSL_FTM=m
958CONFIG_PWM_MESON=m
950CONFIG_PWM_RCAR=m 959CONFIG_PWM_RCAR=m
951CONFIG_PWM_RENESAS_TPU=y 960CONFIG_PWM_RENESAS_TPU=y
952CONFIG_PWM_ROCKCHIP=m 961CONFIG_PWM_ROCKCHIP=m
@@ -972,6 +981,7 @@ CONFIG_PHY_QCOM_APQ8064_SATA=m
972CONFIG_PHY_MIPHY28LP=y 981CONFIG_PHY_MIPHY28LP=y
973CONFIG_PHY_RCAR_GEN2=m 982CONFIG_PHY_RCAR_GEN2=m
974CONFIG_PHY_STIH407_USB=y 983CONFIG_PHY_STIH407_USB=y
984CONFIG_PHY_STM32_USBPHYC=y
975CONFIG_PHY_SUN4I_USB=y 985CONFIG_PHY_SUN4I_USB=y
976CONFIG_PHY_SUN9I_USB=y 986CONFIG_PHY_SUN9I_USB=y
977CONFIG_PHY_SAMSUNG_USB2=m 987CONFIG_PHY_SAMSUNG_USB2=m
diff --git a/arch/arm/configs/shmobile_defconfig b/arch/arm/configs/shmobile_defconfig
index a701601fbd76..b49887e86a3d 100644
--- a/arch/arm/configs/shmobile_defconfig
+++ b/arch/arm/configs/shmobile_defconfig
@@ -14,6 +14,7 @@ CONFIG_ARCH_R8A73A4=y
14CONFIG_ARCH_R8A7740=y 14CONFIG_ARCH_R8A7740=y
15CONFIG_ARCH_R8A7743=y 15CONFIG_ARCH_R8A7743=y
16CONFIG_ARCH_R8A7745=y 16CONFIG_ARCH_R8A7745=y
17CONFIG_ARCH_R8A77470=y
17CONFIG_ARCH_R8A7778=y 18CONFIG_ARCH_R8A7778=y
18CONFIG_ARCH_R8A7779=y 19CONFIG_ARCH_R8A7779=y
19CONFIG_ARCH_R8A7790=y 20CONFIG_ARCH_R8A7790=y
@@ -127,6 +128,7 @@ CONFIG_CPU_THERMAL=y
127CONFIG_RCAR_THERMAL=y 128CONFIG_RCAR_THERMAL=y
128CONFIG_WATCHDOG=y 129CONFIG_WATCHDOG=y
129CONFIG_DA9063_WATCHDOG=y 130CONFIG_DA9063_WATCHDOG=y
131CONFIG_RENESAS_WDT=y
130CONFIG_MFD_AS3711=y 132CONFIG_MFD_AS3711=y
131CONFIG_MFD_DA9063=y 133CONFIG_MFD_DA9063=y
132CONFIG_REGULATOR_FIXED_VOLTAGE=y 134CONFIG_REGULATOR_FIXED_VOLTAGE=y
@@ -156,7 +158,6 @@ CONFIG_DRM_DUMB_VGA_DAC=y
156CONFIG_DRM_I2C_ADV7511=y 158CONFIG_DRM_I2C_ADV7511=y
157CONFIG_DRM_I2C_ADV7511_AUDIO=y 159CONFIG_DRM_I2C_ADV7511_AUDIO=y
158CONFIG_FB_SH_MOBILE_LCDC=y 160CONFIG_FB_SH_MOBILE_LCDC=y
159CONFIG_FB_SH_MOBILE_MERAM=y
160# CONFIG_LCD_CLASS_DEVICE is not set 161# CONFIG_LCD_CLASS_DEVICE is not set
161# CONFIG_BACKLIGHT_GENERIC is not set 162# CONFIG_BACKLIGHT_GENERIC is not set
162CONFIG_BACKLIGHT_PWM=y 163CONFIG_BACKLIGHT_PWM=y
diff --git a/arch/arm/include/asm/cputype.h b/arch/arm/include/asm/cputype.h
index 26021980504d..0d289240b6ca 100644
--- a/arch/arm/include/asm/cputype.h
+++ b/arch/arm/include/asm/cputype.h
@@ -2,9 +2,6 @@
2#ifndef __ASM_ARM_CPUTYPE_H 2#ifndef __ASM_ARM_CPUTYPE_H
3#define __ASM_ARM_CPUTYPE_H 3#define __ASM_ARM_CPUTYPE_H
4 4
5#include <linux/stringify.h>
6#include <linux/kernel.h>
7
8#define CPUID_ID 0 5#define CPUID_ID 0
9#define CPUID_CACHETYPE 1 6#define CPUID_CACHETYPE 1
10#define CPUID_TCM 2 7#define CPUID_TCM 2
@@ -62,6 +59,7 @@
62 ((mpidr >> (MPIDR_LEVEL_BITS * level)) & MPIDR_LEVEL_MASK) 59 ((mpidr >> (MPIDR_LEVEL_BITS * level)) & MPIDR_LEVEL_MASK)
63 60
64#define ARM_CPU_IMP_ARM 0x41 61#define ARM_CPU_IMP_ARM 0x41
62#define ARM_CPU_IMP_BRCM 0x42
65#define ARM_CPU_IMP_DEC 0x44 63#define ARM_CPU_IMP_DEC 0x44
66#define ARM_CPU_IMP_INTEL 0x69 64#define ARM_CPU_IMP_INTEL 0x69
67 65
@@ -84,8 +82,9 @@
84#define ARM_CPU_PART_CORTEX_A75 0x4100d0a0 82#define ARM_CPU_PART_CORTEX_A75 0x4100d0a0
85#define ARM_CPU_PART_MASK 0xff00fff0 83#define ARM_CPU_PART_MASK 0xff00fff0
86 84
87/* Broadcom cores */ 85/* Broadcom implemented processors */
88#define ARM_CPU_PART_BRAHMA_B15 0x420000f0 86#define ARM_CPU_PART_BRAHMA_B15 0x420000f0
87#define ARM_CPU_PART_BRAHMA_B53 0x42001000
89 88
90/* DEC implemented cores */ 89/* DEC implemented cores */
91#define ARM_CPU_PART_SA1100 0x4400a110 90#define ARM_CPU_PART_SA1100 0x4400a110
@@ -106,6 +105,11 @@
106/* Qualcomm implemented cores */ 105/* Qualcomm implemented cores */
107#define ARM_CPU_PART_SCORPION 0x510002d0 106#define ARM_CPU_PART_SCORPION 0x510002d0
108 107
108#ifndef __ASSEMBLY__
109
110#include <linux/stringify.h>
111#include <linux/kernel.h>
112
109extern unsigned int processor_id; 113extern unsigned int processor_id;
110 114
111#ifdef CONFIG_CPU_CP15 115#ifdef CONFIG_CPU_CP15
@@ -334,4 +338,6 @@ static inline int __attribute_const__ cpuid_feature_extract_field(u32 features,
334#define cpuid_feature_extract(reg, field) \ 338#define cpuid_feature_extract(reg, field) \
335 cpuid_feature_extract_field(read_cpuid_ext(reg), field) 339 cpuid_feature_extract_field(read_cpuid_ext(reg), field)
336 340
341#endif /* __ASSEMBLY__ */
342
337#endif 343#endif
diff --git a/arch/arm/include/asm/secure_cntvoff.h b/arch/arm/include/asm/secure_cntvoff.h
new file mode 100644
index 000000000000..1f93aee1f630
--- /dev/null
+++ b/arch/arm/include/asm/secure_cntvoff.h
@@ -0,0 +1,8 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2
3#ifndef __ASMARM_ARCH_CNTVOFF_H
4#define __ASMARM_ARCH_CNTVOFF_H
5
6extern void secure_cntvoff_init(void);
7
8#endif
diff --git a/arch/arm/include/debug/brcmstb.S b/arch/arm/include/debug/brcmstb.S
index c826f15d2f80..0f580caa81e5 100644
--- a/arch/arm/include/debug/brcmstb.S
+++ b/arch/arm/include/debug/brcmstb.S
@@ -11,20 +11,25 @@
11 * GNU General Public License for more details. 11 * GNU General Public License for more details.
12 */ 12 */
13#include <linux/serial_reg.h> 13#include <linux/serial_reg.h>
14#include <asm/cputype.h>
14 15
15/* Physical register offset and virtual register offset */ 16/* Physical register offset and virtual register offset */
16#define REG_PHYS_BASE 0xf0000000 17#define REG_PHYS_BASE 0xf0000000
18#define REG_PHYS_BASE_V7 0x08000000
17#define REG_VIRT_BASE 0xfc000000 19#define REG_VIRT_BASE 0xfc000000
18#define REG_PHYS_ADDR(x) ((x) + REG_PHYS_BASE) 20#define REG_PHYS_ADDR(x) ((x) + REG_PHYS_BASE)
21#define REG_PHYS_ADDR_V7(x) ((x) + REG_PHYS_BASE_V7)
19 22
20/* Product id can be read from here */ 23/* Product id can be read from here */
21#define SUN_TOP_CTRL_BASE REG_PHYS_ADDR(0x404000) 24#define SUN_TOP_CTRL_BASE REG_PHYS_ADDR(0x404000)
25#define SUN_TOP_CTRL_BASE_V7 REG_PHYS_ADDR_V7(0x404000)
22 26
23#define UARTA_3390 REG_PHYS_ADDR(0x40a900) 27#define UARTA_3390 REG_PHYS_ADDR(0x40a900)
24#define UARTA_7250 REG_PHYS_ADDR(0x40b400) 28#define UARTA_7250 REG_PHYS_ADDR(0x40b400)
25#define UARTA_7260 REG_PHYS_ADDR(0x40c000) 29#define UARTA_7260 REG_PHYS_ADDR(0x40c000)
26#define UARTA_7268 UARTA_7260 30#define UARTA_7268 UARTA_7260
27#define UARTA_7271 UARTA_7268 31#define UARTA_7271 UARTA_7268
32#define UARTA_7278 REG_PHYS_ADDR_V7(0x40c000)
28#define UARTA_7364 REG_PHYS_ADDR(0x40b000) 33#define UARTA_7364 REG_PHYS_ADDR(0x40b000)
29#define UARTA_7366 UARTA_7364 34#define UARTA_7366 UARTA_7364
30#define UARTA_74371 REG_PHYS_ADDR(0x406b00) 35#define UARTA_74371 REG_PHYS_ADDR(0x406b00)
@@ -55,8 +60,21 @@
55 mov \rv, #0 @ yes; record init is done 60 mov \rv, #0 @ yes; record init is done
56 str \rv, [\tmp] 61 str \rv, [\tmp]
57 62
63 /* Check for V7 memory map if B53 */
64 mrc p15, 0, \rv, c0, c0, 0 @ get Main ID register
65 ldr \rp, =ARM_CPU_PART_MASK
66 and \rv, \rv, \rp
67 ldr \rp, =ARM_CPU_PART_BRAHMA_B53 @ check for B53 CPU
68 cmp \rv, \rp
69 bne 10f
70
71 /* if PERIPHBASE doesn't overlap REG_PHYS_BASE use V7 map */
72 mrc p15, 1, \rv, c15, c3, 0 @ get PERIPHBASE from CBAR
73 ands \rv, \rv, #REG_PHYS_BASE
74 ldreq \rp, =SUN_TOP_CTRL_BASE_V7
75
58 /* Check SUN_TOP_CTRL base */ 76 /* Check SUN_TOP_CTRL base */
59 ldr \rp, =SUN_TOP_CTRL_BASE @ load SUN_TOP_CTRL PA 7710: ldrne \rp, =SUN_TOP_CTRL_BASE @ load SUN_TOP_CTRL PA
60 ldr \rv, [\rp, #0] @ get register contents 78 ldr \rv, [\rp, #0] @ get register contents
61ARM_BE8( rev \rv, \rv ) 79ARM_BE8( rev \rv, \rv )
62 and \rv, \rv, #0xffffff00 @ strip revision bits [7:0] 80 and \rv, \rv, #0xffffff00 @ strip revision bits [7:0]
@@ -72,6 +90,7 @@ ARM_BE8( rev \rv, \rv )
7227: checkuart(\rp, \rv, 0x07437100, 74371) 9027: checkuart(\rp, \rv, 0x07437100, 74371)
7328: checkuart(\rp, \rv, 0x74390000, 7439) 9128: checkuart(\rp, \rv, 0x74390000, 7439)
7429: checkuart(\rp, \rv, 0x74450000, 7445) 9229: checkuart(\rp, \rv, 0x74450000, 7445)
9330: checkuart(\rp, \rv, 0x72780000, 7278)
75 94
76 /* No valid UART found */ 95 /* No valid UART found */
7790: mov \rp, #0 9690: mov \rp, #0
diff --git a/arch/arm/mach-berlin/Kconfig b/arch/arm/mach-berlin/Kconfig
index 63ab1d368625..3d719cf645e3 100644
--- a/arch/arm/mach-berlin/Kconfig
+++ b/arch/arm/mach-berlin/Kconfig
@@ -23,8 +23,12 @@ config MACH_BERLIN_BG2
23 23
24config MACH_BERLIN_BG2CD 24config MACH_BERLIN_BG2CD
25 bool "Marvell Armada 1500-mini (BG2CD)" 25 bool "Marvell Armada 1500-mini (BG2CD)"
26 select ARM_ERRATA_754322
27 select ARM_ERRATA_775420
28 select ARM_GLOBAL_TIMER
26 select CACHE_L2X0 29 select CACHE_L2X0
27 select HAVE_ARM_TWD if SMP 30 select HAVE_ARM_SCU
31 select HAVE_ARM_TWD
28 select PINCTRL_BERLIN_BG2CD 32 select PINCTRL_BERLIN_BG2CD
29 33
30config MACH_BERLIN_BG2Q 34config MACH_BERLIN_BG2Q
diff --git a/arch/arm/mach-berlin/berlin.c b/arch/arm/mach-berlin/berlin.c
index ac181c6797ee..2424ad40190c 100644
--- a/arch/arm/mach-berlin/berlin.c
+++ b/arch/arm/mach-berlin/berlin.c
@@ -1,3 +1,4 @@
1// SPDX-License-Identifier: GPL-2.0
1/* 2/*
2 * Device Tree support for Marvell Berlin SoCs. 3 * Device Tree support for Marvell Berlin SoCs.
3 * 4 *
@@ -5,10 +6,6 @@
5 * 6 *
6 * based on GPL'ed 2.6 kernel sources 7 * based on GPL'ed 2.6 kernel sources
7 * (c) Marvell International Ltd. 8 * (c) Marvell International Ltd.
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */ 9 */
13 10
14#include <linux/init.h> 11#include <linux/init.h>
diff --git a/arch/arm/mach-berlin/headsmp.S b/arch/arm/mach-berlin/headsmp.S
index dc82a3486b05..3057885d9772 100644
--- a/arch/arm/mach-berlin/headsmp.S
+++ b/arch/arm/mach-berlin/headsmp.S
@@ -1,11 +1,8 @@
1/* SPDX-License-Identifier: GPL-2.0 */
1/* 2/*
2 * Copyright (C) 2014 Marvell Technology Group Ltd. 3 * Copyright (C) 2014 Marvell Technology Group Ltd.
3 * 4 *
4 * Antoine Ténart <antoine.tenart@free-electrons.com> 5 * Antoine Ténart <antoine.tenart@free-electrons.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */ 6 */
10 7
11#include <linux/linkage.h> 8#include <linux/linkage.h>
diff --git a/arch/arm/mach-berlin/platsmp.c b/arch/arm/mach-berlin/platsmp.c
index 7586b7aec272..593fc4a69d84 100644
--- a/arch/arm/mach-berlin/platsmp.c
+++ b/arch/arm/mach-berlin/platsmp.c
@@ -1,11 +1,8 @@
1// SPDX-License-Identifier: GPL-2.0
1/* 2/*
2 * Copyright (C) 2014 Marvell Technology Group Ltd. 3 * Copyright (C) 2014 Marvell Technology Group Ltd.
3 * 4 *
4 * Antoine Ténart <antoine.tenart@free-electrons.com> 5 * Antoine Ténart <antoine.tenart@free-electrons.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */ 6 */
10 7
11#include <linux/io.h> 8#include <linux/io.h>
@@ -81,7 +78,6 @@ static void __init berlin_smp_prepare_cpus(unsigned int max_cpus)
81 goto unmap_scu; 78 goto unmap_scu;
82 79
83 scu_enable(scu_base); 80 scu_enable(scu_base);
84 flush_cache_all();
85 81
86 /* 82 /*
87 * Write the first instruction the CPU will execute after being reset 83 * Write the first instruction the CPU will execute after being reset
diff --git a/arch/arm/mach-davinci/aemif.c b/arch/arm/mach-davinci/aemif.c
index ff8b7e76b6e9..e4ab3f3a2a1f 100644
--- a/arch/arm/mach-davinci/aemif.c
+++ b/arch/arm/mach-davinci/aemif.c
@@ -189,7 +189,7 @@ int davinci_aemif_setup(struct platform_device *pdev)
189 * Setup Async configuration register in case we did not boot 189 * Setup Async configuration register in case we did not boot
190 * from NAND and so bootloader did not bother to set it up. 190 * from NAND and so bootloader did not bother to set it up.
191 */ 191 */
192 val = davinci_aemif_readl(base, A1CR_OFFSET + pdev->id * 4); 192 val = davinci_aemif_readl(base, A1CR_OFFSET + pdata->core_chipsel * 4);
193 /* 193 /*
194 * Extended Wait is not valid and Select Strobe mode is not 194 * Extended Wait is not valid and Select Strobe mode is not
195 * used 195 * used
@@ -198,13 +198,13 @@ int davinci_aemif_setup(struct platform_device *pdev)
198 if (pdata->options & NAND_BUSWIDTH_16) 198 if (pdata->options & NAND_BUSWIDTH_16)
199 val |= 0x1; 199 val |= 0x1;
200 200
201 davinci_aemif_writel(base, A1CR_OFFSET + pdev->id * 4, val); 201 davinci_aemif_writel(base, A1CR_OFFSET + pdata->core_chipsel * 4, val);
202 202
203 clkrate = clk_get_rate(clk); 203 clkrate = clk_get_rate(clk);
204 204
205 if (pdata->timing) 205 if (pdata->timing)
206 ret = davinci_aemif_setup_timing(pdata->timing, base, pdev->id, 206 ret = davinci_aemif_setup_timing(pdata->timing, base,
207 clkrate); 207 pdata->core_chipsel, clkrate);
208 208
209 if (ret < 0) 209 if (ret < 0)
210 dev_dbg(&pdev->dev, "NAND timing values setup fail\n"); 210 dev_dbg(&pdev->dev, "NAND timing values setup fail\n");
diff --git a/arch/arm/mach-davinci/board-da830-evm.c b/arch/arm/mach-davinci/board-da830-evm.c
index d1e8ce7b4bd2..14a6fc061744 100644
--- a/arch/arm/mach-davinci/board-da830-evm.c
+++ b/arch/arm/mach-davinci/board-da830-evm.c
@@ -315,6 +315,7 @@ static struct davinci_aemif_timing da830_evm_nandflash_timing = {
315}; 315};
316 316
317static struct davinci_nand_pdata da830_evm_nand_pdata = { 317static struct davinci_nand_pdata da830_evm_nand_pdata = {
318 .core_chipsel = 1,
318 .parts = da830_evm_nand_partitions, 319 .parts = da830_evm_nand_partitions,
319 .nr_parts = ARRAY_SIZE(da830_evm_nand_partitions), 320 .nr_parts = ARRAY_SIZE(da830_evm_nand_partitions),
320 .ecc_mode = NAND_ECC_HW, 321 .ecc_mode = NAND_ECC_HW,
diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index 158ed9a1483f..e22fb40e34bc 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -244,6 +244,7 @@ static struct davinci_aemif_timing da850_evm_nandflash_timing = {
244}; 244};
245 245
246static struct davinci_nand_pdata da850_evm_nandflash_data = { 246static struct davinci_nand_pdata da850_evm_nandflash_data = {
247 .core_chipsel = 1,
247 .parts = da850_evm_nandflash_partition, 248 .parts = da850_evm_nandflash_partition,
248 .nr_parts = ARRAY_SIZE(da850_evm_nandflash_partition), 249 .nr_parts = ARRAY_SIZE(da850_evm_nandflash_partition),
249 .ecc_mode = NAND_ECC_HW, 250 .ecc_mode = NAND_ECC_HW,
diff --git a/arch/arm/mach-davinci/board-dm355-evm.c b/arch/arm/mach-davinci/board-dm355-evm.c
index 23ab9e8bc04c..a3377f959444 100644
--- a/arch/arm/mach-davinci/board-dm355-evm.c
+++ b/arch/arm/mach-davinci/board-dm355-evm.c
@@ -78,6 +78,7 @@ static struct mtd_partition davinci_nand_partitions[] = {
78}; 78};
79 79
80static struct davinci_nand_pdata davinci_nand_data = { 80static struct davinci_nand_pdata davinci_nand_data = {
81 .core_chipsel = 0,
81 .mask_chipsel = BIT(14), 82 .mask_chipsel = BIT(14),
82 .parts = davinci_nand_partitions, 83 .parts = davinci_nand_partitions,
83 .nr_parts = ARRAY_SIZE(davinci_nand_partitions), 84 .nr_parts = ARRAY_SIZE(davinci_nand_partitions),
diff --git a/arch/arm/mach-davinci/board-dm355-leopard.c b/arch/arm/mach-davinci/board-dm355-leopard.c
index 59743bd76793..8249a0bf69f0 100644
--- a/arch/arm/mach-davinci/board-dm355-leopard.c
+++ b/arch/arm/mach-davinci/board-dm355-leopard.c
@@ -72,6 +72,7 @@ static struct mtd_partition davinci_nand_partitions[] = {
72}; 72};
73 73
74static struct davinci_nand_pdata davinci_nand_data = { 74static struct davinci_nand_pdata davinci_nand_data = {
75 .core_chipsel = 0,
75 .mask_chipsel = BIT(14), 76 .mask_chipsel = BIT(14),
76 .parts = davinci_nand_partitions, 77 .parts = davinci_nand_partitions,
77 .nr_parts = ARRAY_SIZE(davinci_nand_partitions), 78 .nr_parts = ARRAY_SIZE(davinci_nand_partitions),
diff --git a/arch/arm/mach-davinci/board-dm365-evm.c b/arch/arm/mach-davinci/board-dm365-evm.c
index 0ac085b58a2b..435f7ec7d9af 100644
--- a/arch/arm/mach-davinci/board-dm365-evm.c
+++ b/arch/arm/mach-davinci/board-dm365-evm.c
@@ -138,6 +138,7 @@ static struct mtd_partition davinci_nand_partitions[] = {
138}; 138};
139 139
140static struct davinci_nand_pdata davinci_nand_data = { 140static struct davinci_nand_pdata davinci_nand_data = {
141 .core_chipsel = 0,
141 .mask_chipsel = BIT(14), 142 .mask_chipsel = BIT(14),
142 .parts = davinci_nand_partitions, 143 .parts = davinci_nand_partitions,
143 .nr_parts = ARRAY_SIZE(davinci_nand_partitions), 144 .nr_parts = ARRAY_SIZE(davinci_nand_partitions),
diff --git a/arch/arm/mach-davinci/board-dm644x-evm.c b/arch/arm/mach-davinci/board-dm644x-evm.c
index 509e64ab1994..48436f74fd71 100644
--- a/arch/arm/mach-davinci/board-dm644x-evm.c
+++ b/arch/arm/mach-davinci/board-dm644x-evm.c
@@ -153,6 +153,7 @@ static struct davinci_aemif_timing davinci_evm_nandflash_timing = {
153}; 153};
154 154
155static struct davinci_nand_pdata davinci_evm_nandflash_data = { 155static struct davinci_nand_pdata davinci_evm_nandflash_data = {
156 .core_chipsel = 0,
156 .parts = davinci_evm_nandflash_partition, 157 .parts = davinci_evm_nandflash_partition,
157 .nr_parts = ARRAY_SIZE(davinci_evm_nandflash_partition), 158 .nr_parts = ARRAY_SIZE(davinci_evm_nandflash_partition),
158 .ecc_mode = NAND_ECC_HW, 159 .ecc_mode = NAND_ECC_HW,
@@ -772,6 +773,8 @@ static __init void davinci_evm_init(void)
772 struct clk *aemif_clk; 773 struct clk *aemif_clk;
773 struct davinci_soc_info *soc_info = &davinci_soc_info; 774 struct davinci_soc_info *soc_info = &davinci_soc_info;
774 775
776 dm644x_init_devices();
777
775 ret = dm644x_gpio_register(); 778 ret = dm644x_gpio_register();
776 if (ret) 779 if (ret)
777 pr_warn("%s: GPIO init failed: %d\n", __func__, ret); 780 pr_warn("%s: GPIO init failed: %d\n", __func__, ret);
diff --git a/arch/arm/mach-davinci/board-dm646x-evm.c b/arch/arm/mach-davinci/board-dm646x-evm.c
index a3c0d1e87647..584064fdabf5 100644
--- a/arch/arm/mach-davinci/board-dm646x-evm.c
+++ b/arch/arm/mach-davinci/board-dm646x-evm.c
@@ -84,6 +84,7 @@ static struct davinci_aemif_timing dm6467tevm_nandflash_timing = {
84}; 84};
85 85
86static struct davinci_nand_pdata davinci_nand_data = { 86static struct davinci_nand_pdata davinci_nand_data = {
87 .core_chipsel = 0,
87 .mask_cle = 0x80000, 88 .mask_cle = 0x80000,
88 .mask_ale = 0x40000, 89 .mask_ale = 0x40000,
89 .parts = davinci_nand_partitions, 90 .parts = davinci_nand_partitions,
diff --git a/arch/arm/mach-davinci/board-mityomapl138.c b/arch/arm/mach-davinci/board-mityomapl138.c
index d1c85484c2e2..37b3e48a21d1 100644
--- a/arch/arm/mach-davinci/board-mityomapl138.c
+++ b/arch/arm/mach-davinci/board-mityomapl138.c
@@ -400,6 +400,7 @@ static struct mtd_partition mityomapl138_nandflash_partition[] = {
400}; 400};
401 401
402static struct davinci_nand_pdata mityomapl138_nandflash_data = { 402static struct davinci_nand_pdata mityomapl138_nandflash_data = {
403 .core_chipsel = 1,
403 .parts = mityomapl138_nandflash_partition, 404 .parts = mityomapl138_nandflash_partition,
404 .nr_parts = ARRAY_SIZE(mityomapl138_nandflash_partition), 405 .nr_parts = ARRAY_SIZE(mityomapl138_nandflash_partition),
405 .ecc_mode = NAND_ECC_HW, 406 .ecc_mode = NAND_ECC_HW,
diff --git a/arch/arm/mach-davinci/board-neuros-osd2.c b/arch/arm/mach-davinci/board-neuros-osd2.c
index f2875770fbff..25ad9b0612be 100644
--- a/arch/arm/mach-davinci/board-neuros-osd2.c
+++ b/arch/arm/mach-davinci/board-neuros-osd2.c
@@ -87,6 +87,7 @@ static struct mtd_partition davinci_ntosd2_nandflash_partition[] = {
87}; 87};
88 88
89static struct davinci_nand_pdata davinci_ntosd2_nandflash_data = { 89static struct davinci_nand_pdata davinci_ntosd2_nandflash_data = {
90 .core_chipsel = 0,
90 .parts = davinci_ntosd2_nandflash_partition, 91 .parts = davinci_ntosd2_nandflash_partition,
91 .nr_parts = ARRAY_SIZE(davinci_ntosd2_nandflash_partition), 92 .nr_parts = ARRAY_SIZE(davinci_ntosd2_nandflash_partition),
92 .ecc_mode = NAND_ECC_HW, 93 .ecc_mode = NAND_ECC_HW,
@@ -174,6 +175,8 @@ static __init void davinci_ntosd2_init(void)
174 struct clk *aemif_clk; 175 struct clk *aemif_clk;
175 struct davinci_soc_info *soc_info = &davinci_soc_info; 176 struct davinci_soc_info *soc_info = &davinci_soc_info;
176 177
178 dm644x_init_devices();
179
177 ret = dm644x_gpio_register(); 180 ret = dm644x_gpio_register();
178 if (ret) 181 if (ret)
179 pr_warn("%s: GPIO init failed: %d\n", __func__, ret); 182 pr_warn("%s: GPIO init failed: %d\n", __func__, ret);
diff --git a/arch/arm/mach-davinci/board-sffsdr.c b/arch/arm/mach-davinci/board-sffsdr.c
index 2922da9d1684..e7c1728b0833 100644
--- a/arch/arm/mach-davinci/board-sffsdr.c
+++ b/arch/arm/mach-davinci/board-sffsdr.c
@@ -134,6 +134,8 @@ static __init void davinci_sffsdr_init(void)
134{ 134{
135 struct davinci_soc_info *soc_info = &davinci_soc_info; 135 struct davinci_soc_info *soc_info = &davinci_soc_info;
136 136
137 dm644x_init_devices();
138
137 platform_add_devices(davinci_sffsdr_devices, 139 platform_add_devices(davinci_sffsdr_devices,
138 ARRAY_SIZE(davinci_sffsdr_devices)); 140 ARRAY_SIZE(davinci_sffsdr_devices));
139 sffsdr_init_i2c(); 141 sffsdr_init_i2c();
diff --git a/arch/arm/mach-davinci/davinci.h b/arch/arm/mach-davinci/davinci.h
index 270cef85750a..376cdd51ce9d 100644
--- a/arch/arm/mach-davinci/davinci.h
+++ b/arch/arm/mach-davinci/davinci.h
@@ -104,6 +104,7 @@ int dm365_gpio_register(void);
104 104
105/* DM644x function declarations */ 105/* DM644x function declarations */
106void dm644x_init(void); 106void dm644x_init(void);
107void dm644x_init_devices(void);
107void dm644x_init_time(void); 108void dm644x_init_time(void);
108void dm644x_init_asp(void); 109void dm644x_init_asp(void);
109int dm644x_init_video(struct vpfe_config *, struct vpbe_config *); 110int dm644x_init_video(struct vpfe_config *, struct vpbe_config *);
diff --git a/arch/arm/mach-davinci/dm644x.c b/arch/arm/mach-davinci/dm644x.c
index b409801649e1..a2e8586c8a6d 100644
--- a/arch/arm/mach-davinci/dm644x.c
+++ b/arch/arm/mach-davinci/dm644x.c
@@ -961,19 +961,14 @@ int __init dm644x_init_video(struct vpfe_config *vpfe_cfg,
961 return 0; 961 return 0;
962} 962}
963 963
964static int __init dm644x_init_devices(void) 964void __init dm644x_init_devices(void)
965{ 965{
966 struct platform_device *edma_pdev; 966 struct platform_device *edma_pdev;
967 int ret = 0; 967 int ret;
968
969 if (!cpu_is_davinci_dm644x())
970 return 0;
971 968
972 edma_pdev = platform_device_register_full(&dm644x_edma_device); 969 edma_pdev = platform_device_register_full(&dm644x_edma_device);
973 if (IS_ERR(edma_pdev)) { 970 if (IS_ERR(edma_pdev))
974 pr_warn("%s: Failed to register eDMA\n", __func__); 971 pr_warn("%s: Failed to register eDMA\n", __func__);
975 return PTR_ERR(edma_pdev);
976 }
977 972
978 platform_device_register(&dm644x_mdio_device); 973 platform_device_register(&dm644x_mdio_device);
979 platform_device_register(&dm644x_emac_device); 974 platform_device_register(&dm644x_emac_device);
@@ -982,6 +977,4 @@ static int __init dm644x_init_devices(void)
982 if (ret) 977 if (ret)
983 pr_warn("%s: watchdog init failed: %d\n", __func__, ret); 978 pr_warn("%s: watchdog init failed: %d\n", __func__, ret);
984 979
985 return ret;
986} 980}
987postcore_initcall(dm644x_init_devices);
diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
index 2ca405816846..b40963cf91c7 100644
--- a/arch/arm/mach-exynos/Kconfig
+++ b/arch/arm/mach-exynos/Kconfig
@@ -8,7 +8,6 @@
8menuconfig ARCH_EXYNOS 8menuconfig ARCH_EXYNOS
9 bool "Samsung EXYNOS" 9 bool "Samsung EXYNOS"
10 depends on ARCH_MULTI_V7 10 depends on ARCH_MULTI_V7
11 select ARCH_HAS_BANDGAP
12 select ARCH_HAS_HOLES_MEMORYMODEL 11 select ARCH_HAS_HOLES_MEMORYMODEL
13 select ARCH_SUPPORTS_BIG_ENDIAN 12 select ARCH_SUPPORTS_BIG_ENDIAN
14 select ARM_AMBA 13 select ARM_AMBA
@@ -108,17 +107,6 @@ config SOC_EXYNOS5420
108 default y 107 default y
109 depends on ARCH_EXYNOS5 108 depends on ARCH_EXYNOS5
110 109
111config SOC_EXYNOS5440
112 bool "SAMSUNG EXYNOS5440"
113 default y
114 depends on ARCH_EXYNOS5
115 select HAVE_ARM_ARCH_TIMER
116 select AUTO_ZRELADDR
117 select PINCTRL_EXYNOS5440
118 select PM_OPP
119 help
120 Enable EXYNOS5440 SoC support
121
122config SOC_EXYNOS5800 110config SOC_EXYNOS5800
123 bool "SAMSUNG EXYNOS5800" 111 bool "SAMSUNG EXYNOS5800"
124 default y 112 default y
diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h
index 098f84a149a3..dcd21bb95e3b 100644
--- a/arch/arm/mach-exynos/common.h
+++ b/arch/arm/mach-exynos/common.h
@@ -21,7 +21,6 @@
21#define EXYNOS5250_SOC_ID 0x43520000 21#define EXYNOS5250_SOC_ID 0x43520000
22#define EXYNOS5410_SOC_ID 0xE5410000 22#define EXYNOS5410_SOC_ID 0xE5410000
23#define EXYNOS5420_SOC_ID 0xE5420000 23#define EXYNOS5420_SOC_ID 0xE5420000
24#define EXYNOS5440_SOC_ID 0xE5440000
25#define EXYNOS5800_SOC_ID 0xE5422000 24#define EXYNOS5800_SOC_ID 0xE5422000
26#define EXYNOS5_SOC_MASK 0xFFFFF000 25#define EXYNOS5_SOC_MASK 0xFFFFF000
27 26
@@ -39,7 +38,6 @@ IS_SAMSUNG_CPU(exynos4412, EXYNOS4412_CPU_ID, EXYNOS4_CPU_MASK)
39IS_SAMSUNG_CPU(exynos5250, EXYNOS5250_SOC_ID, EXYNOS5_SOC_MASK) 38IS_SAMSUNG_CPU(exynos5250, EXYNOS5250_SOC_ID, EXYNOS5_SOC_MASK)
40IS_SAMSUNG_CPU(exynos5410, EXYNOS5410_SOC_ID, EXYNOS5_SOC_MASK) 39IS_SAMSUNG_CPU(exynos5410, EXYNOS5410_SOC_ID, EXYNOS5_SOC_MASK)
41IS_SAMSUNG_CPU(exynos5420, EXYNOS5420_SOC_ID, EXYNOS5_SOC_MASK) 40IS_SAMSUNG_CPU(exynos5420, EXYNOS5420_SOC_ID, EXYNOS5_SOC_MASK)
42IS_SAMSUNG_CPU(exynos5440, EXYNOS5440_SOC_ID, EXYNOS5_SOC_MASK)
43IS_SAMSUNG_CPU(exynos5800, EXYNOS5800_SOC_ID, EXYNOS5_SOC_MASK) 41IS_SAMSUNG_CPU(exynos5800, EXYNOS5800_SOC_ID, EXYNOS5_SOC_MASK)
44 42
45#if defined(CONFIG_SOC_EXYNOS3250) 43#if defined(CONFIG_SOC_EXYNOS3250)
@@ -82,22 +80,12 @@ IS_SAMSUNG_CPU(exynos5800, EXYNOS5800_SOC_ID, EXYNOS5_SOC_MASK)
82# define soc_is_exynos5420() 0 80# define soc_is_exynos5420() 0
83#endif 81#endif
84 82
85#if defined(CONFIG_SOC_EXYNOS5440)
86# define soc_is_exynos5440() is_samsung_exynos5440()
87#else
88# define soc_is_exynos5440() 0
89#endif
90
91#if defined(CONFIG_SOC_EXYNOS5800) 83#if defined(CONFIG_SOC_EXYNOS5800)
92# define soc_is_exynos5800() is_samsung_exynos5800() 84# define soc_is_exynos5800() is_samsung_exynos5800()
93#else 85#else
94# define soc_is_exynos5800() 0 86# define soc_is_exynos5800() 0
95#endif 87#endif
96 88
97#define soc_is_exynos4() (soc_is_exynos4210() || soc_is_exynos4412())
98#define soc_is_exynos5() (soc_is_exynos5250() || soc_is_exynos5410() || \
99 soc_is_exynos5420() || soc_is_exynos5800())
100
101extern u32 cp15_save_diag; 89extern u32 cp15_save_diag;
102extern u32 cp15_save_power; 90extern u32 cp15_save_power;
103 91
@@ -149,6 +137,11 @@ extern void exynos_cpu_restore_register(void);
149extern void exynos_pm_central_suspend(void); 137extern void exynos_pm_central_suspend(void);
150extern int exynos_pm_central_resume(void); 138extern int exynos_pm_central_resume(void);
151extern void exynos_enter_aftr(void); 139extern void exynos_enter_aftr(void);
140#ifdef CONFIG_SMP
141extern void exynos_scu_enable(void);
142#else
143static inline void exynos_scu_enable(void) { }
144#endif
152 145
153extern struct cpuidle_exynos_data cpuidle_coupled_exynos_data; 146extern struct cpuidle_exynos_data cpuidle_coupled_exynos_data;
154 147
diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c
index 8c4f5e342dc1..f4b6c93a7fd0 100644
--- a/arch/arm/mach-exynos/exynos.c
+++ b/arch/arm/mach-exynos/exynos.c
@@ -24,15 +24,6 @@
24 24
25#include "common.h" 25#include "common.h"
26 26
27static struct map_desc exynos4_iodesc[] __initdata = {
28 {
29 .virtual = (unsigned long)S5P_VA_COREPERI_BASE,
30 .pfn = __phys_to_pfn(EXYNOS4_PA_COREPERI),
31 .length = SZ_8K,
32 .type = MT_DEVICE,
33 },
34};
35
36static struct platform_device exynos_cpuidle = { 27static struct platform_device exynos_cpuidle = {
37 .name = "exynos_cpuidle", 28 .name = "exynos_cpuidle",
38#ifdef CONFIG_ARM_EXYNOS_CPUIDLE 29#ifdef CONFIG_ARM_EXYNOS_CPUIDLE
@@ -63,15 +54,6 @@ void __init exynos_sysram_init(void)
63 } 54 }
64} 55}
65 56
66static void __init exynos_init_late(void)
67{
68 if (of_machine_is_compatible("samsung,exynos5440"))
69 /* to be supported later */
70 return;
71
72 exynos_pm_init();
73}
74
75static int __init exynos_fdt_map_chipid(unsigned long node, const char *uname, 57static int __init exynos_fdt_map_chipid(unsigned long node, const char *uname,
76 int depth, void *data) 58 int depth, void *data)
77{ 59{
@@ -79,8 +61,7 @@ static int __init exynos_fdt_map_chipid(unsigned long node, const char *uname,
79 const __be32 *reg; 61 const __be32 *reg;
80 int len; 62 int len;
81 63
82 if (!of_flat_dt_is_compatible(node, "samsung,exynos4210-chipid") && 64 if (!of_flat_dt_is_compatible(node, "samsung,exynos4210-chipid"))
83 !of_flat_dt_is_compatible(node, "samsung,exynos5440-clock"))
84 return 0; 65 return 0;
85 66
86 reg = of_get_flat_dt_prop(node, "reg", &len); 67 reg = of_get_flat_dt_prop(node, "reg", &len);
@@ -95,17 +76,6 @@ static int __init exynos_fdt_map_chipid(unsigned long node, const char *uname,
95 return 1; 76 return 1;
96} 77}
97 78
98/*
99 * exynos_map_io
100 *
101 * register the standard cpu IO areas
102 */
103static void __init exynos_map_io(void)
104{
105 if (soc_is_exynos4())
106 iotable_init(exynos4_iodesc, ARRAY_SIZE(exynos4_iodesc));
107}
108
109static void __init exynos_init_io(void) 79static void __init exynos_init_io(void)
110{ 80{
111 debug_ll_io_init(); 81 debug_ll_io_init();
@@ -114,8 +84,6 @@ static void __init exynos_init_io(void)
114 84
115 /* detect cpu id and rev. */ 85 /* detect cpu id and rev. */
116 s5p_init_cpu(S5P_VA_CHIPID); 86 s5p_init_cpu(S5P_VA_CHIPID);
117
118 exynos_map_io();
119} 87}
120 88
121/* 89/*
@@ -209,7 +177,6 @@ static char const *const exynos_dt_compat[] __initconst = {
209 "samsung,exynos5250", 177 "samsung,exynos5250",
210 "samsung,exynos5260", 178 "samsung,exynos5260",
211 "samsung,exynos5420", 179 "samsung,exynos5420",
212 "samsung,exynos5440",
213 NULL 180 NULL
214}; 181};
215 182
@@ -232,7 +199,7 @@ DT_MACHINE_START(EXYNOS_DT, "SAMSUNG EXYNOS (Flattened Device Tree)")
232 .init_early = exynos_firmware_init, 199 .init_early = exynos_firmware_init,
233 .init_irq = exynos_init_irq, 200 .init_irq = exynos_init_irq,
234 .init_machine = exynos_dt_machine_init, 201 .init_machine = exynos_dt_machine_init,
235 .init_late = exynos_init_late, 202 .init_late = exynos_pm_init,
236 .dt_compat = exynos_dt_compat, 203 .dt_compat = exynos_dt_compat,
237 .dt_fixup = exynos_dt_fixup, 204 .dt_fixup = exynos_dt_fixup,
238MACHINE_END 205MACHINE_END
diff --git a/arch/arm/mach-exynos/include/mach/map.h b/arch/arm/mach-exynos/include/mach/map.h
index 37a5ea5e2602..22ebe3654633 100644
--- a/arch/arm/mach-exynos/include/mach/map.h
+++ b/arch/arm/mach-exynos/include/mach/map.h
@@ -15,6 +15,4 @@
15 15
16#define EXYNOS_PA_CHIPID 0x10000000 16#define EXYNOS_PA_CHIPID 0x10000000
17 17
18#define EXYNOS4_PA_COREPERI 0x10500000
19
20#endif /* __ASM_ARCH_MAP_H */ 18#endif /* __ASM_ARCH_MAP_H */
diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c
index 5156fe70e030..6a1e682371b3 100644
--- a/arch/arm/mach-exynos/platsmp.c
+++ b/arch/arm/mach-exynos/platsmp.c
@@ -163,6 +163,26 @@ int exynos_cluster_power_state(int cluster)
163 S5P_CORE_LOCAL_PWR_EN); 163 S5P_CORE_LOCAL_PWR_EN);
164} 164}
165 165
166/**
167 * exynos_scu_enable : enables SCU for Cortex-A9 based system
168 */
169void exynos_scu_enable(void)
170{
171 struct device_node *np;
172 static void __iomem *scu_base;
173
174 if (!scu_base) {
175 np = of_find_compatible_node(NULL, NULL, "arm,cortex-a9-scu");
176 if (np) {
177 scu_base = of_iomap(np, 0);
178 of_node_put(np);
179 } else {
180 scu_base = ioremap(scu_a9_get_base(), SZ_4K);
181 }
182 }
183 scu_enable(scu_base);
184}
185
166static void __iomem *cpu_boot_reg_base(void) 186static void __iomem *cpu_boot_reg_base(void)
167{ 187{
168 if (soc_is_exynos4210() && samsung_rev() == EXYNOS4210_REV_1_1) 188 if (soc_is_exynos4210() && samsung_rev() == EXYNOS4210_REV_1_1)
@@ -219,11 +239,6 @@ static void write_pen_release(int val)
219 sync_cache_w(&pen_release); 239 sync_cache_w(&pen_release);
220} 240}
221 241
222static void __iomem *scu_base_addr(void)
223{
224 return (void __iomem *)(S5P_VA_SCU);
225}
226
227static DEFINE_SPINLOCK(boot_lock); 242static DEFINE_SPINLOCK(boot_lock);
228 243
229static void exynos_secondary_init(unsigned int cpu) 244static void exynos_secondary_init(unsigned int cpu)
@@ -389,7 +404,7 @@ static void __init exynos_smp_prepare_cpus(unsigned int max_cpus)
389 exynos_set_delayed_reset_assertion(true); 404 exynos_set_delayed_reset_assertion(true);
390 405
391 if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A9) 406 if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A9)
392 scu_enable(scu_base_addr()); 407 exynos_scu_enable();
393 408
394 /* 409 /*
395 * Write the address of secondary startup into the 410 * Write the address of secondary startup into the
diff --git a/arch/arm/mach-exynos/pm.c b/arch/arm/mach-exynos/pm.c
index a822c5073715..48e7fb38613e 100644
--- a/arch/arm/mach-exynos/pm.c
+++ b/arch/arm/mach-exynos/pm.c
@@ -22,8 +22,6 @@
22#include <asm/suspend.h> 22#include <asm/suspend.h>
23#include <asm/cacheflush.h> 23#include <asm/cacheflush.h>
24 24
25#include <mach/map.h>
26
27#include "common.h" 25#include "common.h"
28 26
29static inline void __iomem *exynos_boot_vector_addr(void) 27static inline void __iomem *exynos_boot_vector_addr(void)
@@ -172,7 +170,7 @@ void exynos_enter_aftr(void)
172 cpu_suspend(0, exynos_aftr_finisher); 170 cpu_suspend(0, exynos_aftr_finisher);
173 171
174 if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A9) { 172 if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A9) {
175 scu_enable(S5P_VA_SCU); 173 exynos_scu_enable();
176 if (call_firmware_op(resume) == -ENOSYS) 174 if (call_firmware_op(resume) == -ENOSYS)
177 exynos_cpu_restore_register(); 175 exynos_cpu_restore_register();
178 } 176 }
diff --git a/arch/arm/mach-exynos/suspend.c b/arch/arm/mach-exynos/suspend.c
index c2ed997fedef..d3db306a5a70 100644
--- a/arch/arm/mach-exynos/suspend.c
+++ b/arch/arm/mach-exynos/suspend.c
@@ -30,8 +30,6 @@
30#include <asm/smp_scu.h> 30#include <asm/smp_scu.h>
31#include <asm/suspend.h> 31#include <asm/suspend.h>
32 32
33#include <mach/map.h>
34
35#include <plat/pm-common.h> 33#include <plat/pm-common.h>
36 34
37#include "common.h" 35#include "common.h"
@@ -401,7 +399,7 @@ static void exynos_pm_resume(void)
401 goto early_wakeup; 399 goto early_wakeup;
402 400
403 if (cpuid == ARM_CPU_PART_CORTEX_A9) 401 if (cpuid == ARM_CPU_PART_CORTEX_A9)
404 scu_enable(S5P_VA_SCU); 402 exynos_scu_enable();
405 403
406 if (call_firmware_op(resume) == -ENOSYS 404 if (call_firmware_op(resume) == -ENOSYS
407 && cpuid == ARM_CPU_PART_CORTEX_A9) 405 && cpuid == ARM_CPU_PART_CORTEX_A9)
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index e47fa13f4b0c..6f4232384774 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -501,6 +501,7 @@ config SOC_IMX6SL
501 501
502config SOC_IMX6SLL 502config SOC_IMX6SLL
503 bool "i.MX6 SoloLiteLite support" 503 bool "i.MX6 SoloLiteLite support"
504 select PINCTRL_IMX6SLL
504 select SOC_IMX6 505 select SOC_IMX6
505 506
506 help 507 help
diff --git a/arch/arm/mach-imx/mach-mx31_3ds.c b/arch/arm/mach-imx/mach-mx31_3ds.c
index 68c3f0799d5b..9d87f1dcf7bb 100644
--- a/arch/arm/mach-imx/mach-mx31_3ds.c
+++ b/arch/arm/mach-imx/mach-mx31_3ds.c
@@ -374,26 +374,12 @@ static struct imx_ssi_platform_data mx31_3ds_ssi_pdata = {
374}; 374};
375 375
376/* SPI */ 376/* SPI */
377static int spi0_internal_chipselect[] = {
378 MXC_SPI_CS(0),
379 MXC_SPI_CS(1),
380 MXC_SPI_CS(2),
381};
382
383static const struct spi_imx_master spi0_pdata __initconst = { 377static const struct spi_imx_master spi0_pdata __initconst = {
384 .chipselect = spi0_internal_chipselect, 378 .num_chipselect = 3,
385 .num_chipselect = ARRAY_SIZE(spi0_internal_chipselect),
386};
387
388static int spi1_internal_chipselect[] = {
389 MXC_SPI_CS(0),
390 MXC_SPI_CS(1),
391 MXC_SPI_CS(2),
392}; 379};
393 380
394static const struct spi_imx_master spi1_pdata __initconst = { 381static const struct spi_imx_master spi1_pdata __initconst = {
395 .chipselect = spi1_internal_chipselect, 382 .num_chipselect = 3,
396 .num_chipselect = ARRAY_SIZE(spi1_internal_chipselect),
397}; 383};
398 384
399static struct spi_board_info mx31_3ds_spi_devs[] __initdata = { 385static struct spi_board_info mx31_3ds_spi_devs[] __initdata = {
diff --git a/arch/arm/mach-imx/mach-mx31lilly.c b/arch/arm/mach-imx/mach-mx31lilly.c
index 6fd463642954..8bf52819d4d9 100644
--- a/arch/arm/mach-imx/mach-mx31lilly.c
+++ b/arch/arm/mach-imx/mach-mx31lilly.c
@@ -226,20 +226,12 @@ static void __init lilly1131_usb_init(void)
226 226
227/* SPI */ 227/* SPI */
228 228
229static int spi_internal_chipselect[] = {
230 MXC_SPI_CS(0),
231 MXC_SPI_CS(1),
232 MXC_SPI_CS(2),
233};
234
235static const struct spi_imx_master spi0_pdata __initconst = { 229static const struct spi_imx_master spi0_pdata __initconst = {
236 .chipselect = spi_internal_chipselect, 230 .num_chipselect = 3,
237 .num_chipselect = ARRAY_SIZE(spi_internal_chipselect),
238}; 231};
239 232
240static const struct spi_imx_master spi1_pdata __initconst = { 233static const struct spi_imx_master spi1_pdata __initconst = {
241 .chipselect = spi_internal_chipselect, 234 .num_chipselect = 3,
242 .num_chipselect = ARRAY_SIZE(spi_internal_chipselect),
243}; 235};
244 236
245static struct mc13xxx_platform_data mc13783_pdata __initdata = { 237static struct mc13xxx_platform_data mc13783_pdata __initdata = {
diff --git a/arch/arm/mach-imx/mach-mx31lite.c b/arch/arm/mach-imx/mach-mx31lite.c
index a3250bc7f114..a3cbba6c955b 100644
--- a/arch/arm/mach-imx/mach-mx31lite.c
+++ b/arch/arm/mach-imx/mach-mx31lite.c
@@ -83,15 +83,8 @@ static const struct imxuart_platform_data uart_pdata __initconst = {
83}; 83};
84 84
85/* SPI */ 85/* SPI */
86static int spi0_internal_chipselect[] = {
87 MXC_SPI_CS(0),
88 MXC_SPI_CS(1),
89 MXC_SPI_CS(2),
90};
91
92static const struct spi_imx_master spi0_pdata __initconst = { 86static const struct spi_imx_master spi0_pdata __initconst = {
93 .chipselect = spi0_internal_chipselect, 87 .num_chipselect = 3,
94 .num_chipselect = ARRAY_SIZE(spi0_internal_chipselect),
95}; 88};
96 89
97static const struct mxc_nand_platform_data 90static const struct mxc_nand_platform_data
@@ -133,13 +126,8 @@ static struct platform_device smsc911x_device = {
133 * The MC13783 is the only hard-wired SPI device on the module. 126 * The MC13783 is the only hard-wired SPI device on the module.
134 */ 127 */
135 128
136static int spi1_internal_chipselect[] = {
137 MXC_SPI_CS(0),
138};
139
140static const struct spi_imx_master spi1_pdata __initconst = { 129static const struct spi_imx_master spi1_pdata __initconst = {
141 .chipselect = spi1_internal_chipselect, 130 .num_chipselect = 1,
142 .num_chipselect = ARRAY_SIZE(spi1_internal_chipselect),
143}; 131};
144 132
145static struct mc13xxx_platform_data mc13783_pdata __initdata = { 133static struct mc13xxx_platform_data mc13783_pdata __initdata = {
diff --git a/arch/arm/mach-imx/mach-mx31moboard.c b/arch/arm/mach-imx/mach-mx31moboard.c
index 7716f83aecdd..643a3d749703 100644
--- a/arch/arm/mach-imx/mach-mx31moboard.c
+++ b/arch/arm/mach-imx/mach-mx31moboard.c
@@ -152,14 +152,8 @@ static const struct imxi2c_platform_data moboard_i2c1_data __initconst = {
152 .bitrate = 100000, 152 .bitrate = 100000,
153}; 153};
154 154
155static int moboard_spi1_cs[] = {
156 MXC_SPI_CS(0),
157 MXC_SPI_CS(2),
158};
159
160static const struct spi_imx_master moboard_spi1_pdata __initconst = { 155static const struct spi_imx_master moboard_spi1_pdata __initconst = {
161 .chipselect = moboard_spi1_cs, 156 .num_chipselect = 3,
162 .num_chipselect = ARRAY_SIZE(moboard_spi1_cs),
163}; 157};
164 158
165static struct regulator_consumer_supply sdhc_consumers[] = { 159static struct regulator_consumer_supply sdhc_consumers[] = {
@@ -296,19 +290,14 @@ static struct spi_board_info moboard_spi_board_info[] __initdata = {
296 /* irq number is run-time assigned */ 290 /* irq number is run-time assigned */
297 .max_speed_hz = 300000, 291 .max_speed_hz = 300000,
298 .bus_num = 1, 292 .bus_num = 1,
299 .chip_select = 1, 293 .chip_select = 0,
300 .platform_data = &moboard_pmic, 294 .platform_data = &moboard_pmic,
301 .mode = SPI_CS_HIGH, 295 .mode = SPI_CS_HIGH,
302 }, 296 },
303}; 297};
304 298
305static int moboard_spi2_cs[] = {
306 MXC_SPI_CS(0), MXC_SPI_CS(1),
307};
308
309static const struct spi_imx_master moboard_spi2_pdata __initconst = { 299static const struct spi_imx_master moboard_spi2_pdata __initconst = {
310 .chipselect = moboard_spi2_cs, 300 .num_chipselect = 2,
311 .num_chipselect = ARRAY_SIZE(moboard_spi2_cs),
312}; 301};
313 302
314#define SDHC1_CD IOMUX_TO_GPIO(MX31_PIN_ATA_CS0) 303#define SDHC1_CD IOMUX_TO_GPIO(MX31_PIN_ATA_CS0)
diff --git a/arch/arm/mach-imx/mach-pca100.c b/arch/arm/mach-imx/mach-pca100.c
index ed675863655b..5714e2f1b106 100644
--- a/arch/arm/mach-imx/mach-pca100.c
+++ b/arch/arm/mach-imx/mach-pca100.c
@@ -20,7 +20,7 @@
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <linux/io.h> 21#include <linux/io.h>
22#include <linux/i2c.h> 22#include <linux/i2c.h>
23#include <linux/platform_data/at24.h> 23#include <linux/property.h>
24#include <linux/dma-mapping.h> 24#include <linux/dma-mapping.h>
25#include <linux/spi/spi.h> 25#include <linux/spi/spi.h>
26#include <linux/spi/eeprom.h> 26#include <linux/spi/eeprom.h>
@@ -168,16 +168,15 @@ static const struct imxi2c_platform_data pca100_i2c1_data __initconst = {
168 .bitrate = 100000, 168 .bitrate = 100000,
169}; 169};
170 170
171static struct at24_platform_data board_eeprom = { 171static const struct property_entry board_eeprom_properties[] = {
172 .byte_len = 4096, 172 PROPERTY_ENTRY_U32("pagesize", 32),
173 .page_size = 32, 173 { }
174 .flags = AT24_FLAG_ADDR16,
175}; 174};
176 175
177static struct i2c_board_info pca100_i2c_devices[] = { 176static struct i2c_board_info pca100_i2c_devices[] = {
178 { 177 {
179 I2C_BOARD_INFO("at24", 0x52), /* E0=0, E1=1, E2=0 */ 178 I2C_BOARD_INFO("24c32", 0x52), /* E0=0, E1=1, E2=0 */
180 .platform_data = &board_eeprom, 179 .properties = board_eeprom_properties,
181 }, { 180 }, {
182 I2C_BOARD_INFO("pcf8563", 0x51), 181 I2C_BOARD_INFO("pcf8563", 0x51),
183 }, { 182 }, {
diff --git a/arch/arm/mach-imx/mach-pcm037.c b/arch/arm/mach-imx/mach-pcm037.c
index b787ba6897e4..004737c40fda 100644
--- a/arch/arm/mach-imx/mach-pcm037.c
+++ b/arch/arm/mach-imx/mach-pcm037.c
@@ -23,7 +23,7 @@
23#include <linux/smsc911x.h> 23#include <linux/smsc911x.h>
24#include <linux/interrupt.h> 24#include <linux/interrupt.h>
25#include <linux/i2c.h> 25#include <linux/i2c.h>
26#include <linux/platform_data/at24.h> 26#include <linux/property.h>
27#include <linux/delay.h> 27#include <linux/delay.h>
28#include <linux/spi/spi.h> 28#include <linux/spi/spi.h>
29#include <linux/irq.h> 29#include <linux/irq.h>
@@ -263,16 +263,15 @@ static const struct imxi2c_platform_data pcm037_i2c2_data __initconst = {
263 .bitrate = 20000, 263 .bitrate = 20000,
264}; 264};
265 265
266static struct at24_platform_data board_eeprom = { 266static const struct property_entry board_eeprom_properties[] = {
267 .byte_len = 4096, 267 PROPERTY_ENTRY_U32("pagesize", 32),
268 .page_size = 32, 268 { }
269 .flags = AT24_FLAG_ADDR16,
270}; 269};
271 270
272static struct i2c_board_info pcm037_i2c_devices[] = { 271static struct i2c_board_info pcm037_i2c_devices[] = {
273 { 272 {
274 I2C_BOARD_INFO("at24", 0x52), /* E0=0, E1=1, E2=0 */ 273 I2C_BOARD_INFO("24c32", 0x52), /* E0=0, E1=1, E2=0 */
275 .platform_data = &board_eeprom, 274 .properties = board_eeprom_properties,
276 }, { 275 }, {
277 I2C_BOARD_INFO("pcf8563", 0x51), 276 I2C_BOARD_INFO("pcf8563", 0x51),
278 } 277 }
diff --git a/arch/arm/mach-imx/mach-pcm037_eet.c b/arch/arm/mach-imx/mach-pcm037_eet.c
index 95bd97710494..15bc956d466b 100644
--- a/arch/arm/mach-imx/mach-pcm037_eet.c
+++ b/arch/arm/mach-imx/mach-pcm037_eet.c
@@ -56,11 +56,8 @@ static struct spi_board_info pcm037_spi_dev[] = {
56}; 56};
57 57
58/* Platform Data for MXC CSPI */ 58/* Platform Data for MXC CSPI */
59static int pcm037_spi1_cs[] = { MXC_SPI_CS(0), MXC_SPI_CS(1), };
60
61static const struct spi_imx_master pcm037_spi1_pdata __initconst = { 59static const struct spi_imx_master pcm037_spi1_pdata __initconst = {
62 .chipselect = pcm037_spi1_cs, 60 .num_chipselect = 2,
63 .num_chipselect = ARRAY_SIZE(pcm037_spi1_cs),
64}; 61};
65 62
66/* GPIO-keys input device */ 63/* GPIO-keys input device */
diff --git a/arch/arm/mach-imx/mach-pcm043.c b/arch/arm/mach-imx/mach-pcm043.c
index 78e2bf8dcd96..e595e5368676 100644
--- a/arch/arm/mach-imx/mach-pcm043.c
+++ b/arch/arm/mach-imx/mach-pcm043.c
@@ -24,7 +24,7 @@
24#include <linux/interrupt.h> 24#include <linux/interrupt.h>
25#include <linux/delay.h> 25#include <linux/delay.h>
26#include <linux/i2c.h> 26#include <linux/i2c.h>
27#include <linux/platform_data/at24.h> 27#include <linux/property.h>
28#include <linux/usb/otg.h> 28#include <linux/usb/otg.h>
29#include <linux/usb/ulpi.h> 29#include <linux/usb/ulpi.h>
30 30
@@ -110,16 +110,15 @@ static const struct imxi2c_platform_data pcm043_i2c0_data __initconst = {
110 .bitrate = 50000, 110 .bitrate = 50000,
111}; 111};
112 112
113static struct at24_platform_data board_eeprom = { 113static const struct property_entry board_eeprom_properties[] = {
114 .byte_len = 4096, 114 PROPERTY_ENTRY_U32("pagesize", 32),
115 .page_size = 32, 115 { }
116 .flags = AT24_FLAG_ADDR16,
117}; 116};
118 117
119static struct i2c_board_info pcm043_i2c_devices[] = { 118static struct i2c_board_info pcm043_i2c_devices[] = {
120 { 119 {
121 I2C_BOARD_INFO("at24", 0x52), /* E0=0, E1=1, E2=0 */ 120 I2C_BOARD_INFO("24c32", 0x52), /* E0=0, E1=1, E2=0 */
122 .platform_data = &board_eeprom, 121 .properties = board_eeprom_properties,
123 }, { 122 }, {
124 I2C_BOARD_INFO("pcf8563", 0x51), 123 I2C_BOARD_INFO("pcf8563", 0x51),
125 }, 124 },
diff --git a/arch/arm/mach-imx/mach-vpr200.c b/arch/arm/mach-imx/mach-vpr200.c
index 5ff154c9a086..da3336aaa4c5 100644
--- a/arch/arm/mach-imx/mach-vpr200.c
+++ b/arch/arm/mach-imx/mach-vpr200.c
@@ -29,7 +29,6 @@
29#include <asm/mach/time.h> 29#include <asm/mach/time.h>
30 30
31#include <linux/i2c.h> 31#include <linux/i2c.h>
32#include <linux/platform_data/at24.h>
33#include <linux/mfd/mc13xxx.h> 32#include <linux/mfd/mc13xxx.h>
34 33
35#include "common.h" 34#include "common.h"
@@ -145,15 +144,9 @@ static const struct imxi2c_platform_data vpr200_i2c0_data __initconst = {
145 .bitrate = 50000, 144 .bitrate = 50000,
146}; 145};
147 146
148static struct at24_platform_data vpr200_eeprom = {
149 .byte_len = 2048 / 8,
150 .page_size = 1,
151};
152
153static struct i2c_board_info vpr200_i2c_devices[] = { 147static struct i2c_board_info vpr200_i2c_devices[] = {
154 { 148 {
155 I2C_BOARD_INFO("at24", 0x50), /* E0=0, E1=0, E2=0 */ 149 I2C_BOARD_INFO("24c02", 0x50), /* E0=0, E1=0, E2=0 */
156 .platform_data = &vpr200_eeprom,
157 }, { 150 }, {
158 I2C_BOARD_INFO("mc13892", 0x08), 151 I2C_BOARD_INFO("mc13892", 0x08),
159 .platform_data = &vpr200_pmic, 152 .platform_data = &vpr200_pmic,
diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c
index 52e8e53ca154..80f54cb54276 100644
--- a/arch/arm/mach-omap1/board-ams-delta.c
+++ b/arch/arm/mach-omap1/board-ams-delta.c
@@ -12,6 +12,7 @@
12 * published by the Free Software Foundation. 12 * published by the Free Software Foundation.
13 */ 13 */
14#include <linux/gpio/driver.h> 14#include <linux/gpio/driver.h>
15#include <linux/gpio/machine.h>
15#include <linux/gpio.h> 16#include <linux/gpio.h>
16#include <linux/kernel.h> 17#include <linux/kernel.h>
17#include <linux/init.h> 18#include <linux/init.h>
@@ -202,7 +203,10 @@ static struct resource latch2_resources[] = {
202 }, 203 },
203}; 204};
204 205
206#define LATCH2_LABEL "latch2"
207
205static struct bgpio_pdata latch2_pdata = { 208static struct bgpio_pdata latch2_pdata = {
209 .label = LATCH2_LABEL,
206 .base = AMS_DELTA_LATCH2_GPIO_BASE, 210 .base = AMS_DELTA_LATCH2_GPIO_BASE,
207 .ngpio = AMS_DELTA_LATCH2_NGPIO, 211 .ngpio = AMS_DELTA_LATCH2_NGPIO,
208}; 212};
@@ -217,6 +221,23 @@ static struct platform_device latch2_gpio_device = {
217 }, 221 },
218}; 222};
219 223
224#define LATCH2_PIN_LCD_VBLEN 0
225#define LATCH2_PIN_LCD_NDISP 1
226#define LATCH2_PIN_NAND_NCE 2
227#define LATCH2_PIN_NAND_NRE 3
228#define LATCH2_PIN_NAND_NWP 4
229#define LATCH2_PIN_NAND_NWE 5
230#define LATCH2_PIN_NAND_ALE 6
231#define LATCH2_PIN_NAND_CLE 7
232#define LATCH2_PIN_KEYBRD_PWR 8
233#define LATCH2_PIN_KEYBRD_DATAOUT 9
234#define LATCH2_PIN_SCARD_RSTIN 10
235#define LATCH2_PIN_SCARD_CMDVCC 11
236#define LATCH2_PIN_MODEM_NRESET 12
237#define LATCH2_PIN_MODEM_CODEC 13
238#define LATCH2_PIN_HOOKFLASH1 14
239#define LATCH2_PIN_HOOKFLASH2 15
240
220static const struct gpio latch_gpios[] __initconst = { 241static const struct gpio latch_gpios[] __initconst = {
221 { 242 {
222 .gpio = LATCH1_GPIO_BASE + 6, 243 .gpio = LATCH1_GPIO_BASE + 6,
@@ -239,11 +260,6 @@ static const struct gpio latch_gpios[] __initconst = {
239 .label = "scard_cmdvcc", 260 .label = "scard_cmdvcc",
240 }, 261 },
241 { 262 {
242 .gpio = AMS_DELTA_GPIO_PIN_MODEM_CODEC,
243 .flags = GPIOF_OUT_INIT_LOW,
244 .label = "modem_codec",
245 },
246 {
247 .gpio = AMS_DELTA_LATCH2_GPIO_BASE + 14, 263 .gpio = AMS_DELTA_LATCH2_GPIO_BASE + 14,
248 .flags = GPIOF_OUT_INIT_LOW, 264 .flags = GPIOF_OUT_INIT_LOW,
249 .label = "hookflash1", 265 .label = "hookflash1",
@@ -323,6 +339,22 @@ static struct platform_device ams_delta_nand_device = {
323 .resource = ams_delta_nand_resources, 339 .resource = ams_delta_nand_resources,
324}; 340};
325 341
342#define OMAP_GPIO_LABEL "gpio-0-15"
343
344static struct gpiod_lookup_table ams_delta_nand_gpio_table = {
345 .table = {
346 GPIO_LOOKUP(OMAP_GPIO_LABEL, AMS_DELTA_GPIO_PIN_NAND_RB, "rdy",
347 0),
348 GPIO_LOOKUP(LATCH2_LABEL, LATCH2_PIN_NAND_NCE, "nce", 0),
349 GPIO_LOOKUP(LATCH2_LABEL, LATCH2_PIN_NAND_NRE, "nre", 0),
350 GPIO_LOOKUP(LATCH2_LABEL, LATCH2_PIN_NAND_NWP, "nwp", 0),
351 GPIO_LOOKUP(LATCH2_LABEL, LATCH2_PIN_NAND_NWE, "nwe", 0),
352 GPIO_LOOKUP(LATCH2_LABEL, LATCH2_PIN_NAND_ALE, "ale", 0),
353 GPIO_LOOKUP(LATCH2_LABEL, LATCH2_PIN_NAND_CLE, "cle", 0),
354 { },
355 },
356};
357
326static struct resource ams_delta_kp_resources[] = { 358static struct resource ams_delta_kp_resources[] = {
327 [0] = { 359 [0] = {
328 .start = INT_KEYBOARD, 360 .start = INT_KEYBOARD,
@@ -358,6 +390,14 @@ static struct platform_device ams_delta_lcd_device = {
358 .id = -1, 390 .id = -1,
359}; 391};
360 392
393static struct gpiod_lookup_table ams_delta_lcd_gpio_table = {
394 .table = {
395 GPIO_LOOKUP(LATCH2_LABEL, LATCH2_PIN_LCD_VBLEN, "vblen", 0),
396 GPIO_LOOKUP(LATCH2_LABEL, LATCH2_PIN_LCD_NDISP, "ndisp", 0),
397 { },
398 },
399};
400
361static const struct gpio_led gpio_leds[] __initconst = { 401static const struct gpio_led gpio_leds[] __initconst = {
362 { 402 {
363 .name = "camera", 403 .name = "camera",
@@ -449,11 +489,35 @@ static struct platform_device ams_delta_audio_device = {
449 .id = -1, 489 .id = -1,
450}; 490};
451 491
492static struct gpiod_lookup_table ams_delta_audio_gpio_table = {
493 .table = {
494 GPIO_LOOKUP(OMAP_GPIO_LABEL, AMS_DELTA_GPIO_PIN_HOOK_SWITCH,
495 "hook_switch", 0),
496 GPIO_LOOKUP(LATCH2_LABEL, LATCH2_PIN_MODEM_CODEC,
497 "modem_codec", 0),
498 { },
499 },
500};
501
452static struct platform_device cx20442_codec_device = { 502static struct platform_device cx20442_codec_device = {
453 .name = "cx20442-codec", 503 .name = "cx20442-codec",
454 .id = -1, 504 .id = -1,
455}; 505};
456 506
507static struct gpiod_lookup_table ams_delta_serio_gpio_table = {
508 .table = {
509 GPIO_LOOKUP(OMAP_GPIO_LABEL, AMS_DELTA_GPIO_PIN_KEYBRD_DATA,
510 "data", 0),
511 GPIO_LOOKUP(OMAP_GPIO_LABEL, AMS_DELTA_GPIO_PIN_KEYBRD_CLK,
512 "clock", 0),
513 GPIO_LOOKUP(LATCH2_LABEL, LATCH2_PIN_KEYBRD_PWR,
514 "power", 0),
515 GPIO_LOOKUP(LATCH2_LABEL, LATCH2_PIN_KEYBRD_DATAOUT,
516 "dataout", 0),
517 { },
518 },
519};
520
457static struct platform_device *ams_delta_devices[] __initdata = { 521static struct platform_device *ams_delta_devices[] __initdata = {
458 &latch1_gpio_device, 522 &latch1_gpio_device,
459 &latch2_gpio_device, 523 &latch2_gpio_device,
@@ -468,6 +532,16 @@ static struct platform_device *late_devices[] __initdata = {
468 &cx20442_codec_device, 532 &cx20442_codec_device,
469}; 533};
470 534
535static struct gpiod_lookup_table *ams_delta_gpio_tables[] __initdata = {
536 &ams_delta_audio_gpio_table,
537 &ams_delta_serio_gpio_table,
538};
539
540static struct gpiod_lookup_table *late_gpio_tables[] __initdata = {
541 &ams_delta_lcd_gpio_table,
542 &ams_delta_nand_gpio_table,
543};
544
471static void __init ams_delta_init(void) 545static void __init ams_delta_init(void)
472{ 546{
473 /* mux pins for uarts */ 547 /* mux pins for uarts */
@@ -500,6 +574,20 @@ static void __init ams_delta_init(void)
500 gpio_led_register_device(-1, &leds_pdata); 574 gpio_led_register_device(-1, &leds_pdata);
501 platform_add_devices(ams_delta_devices, ARRAY_SIZE(ams_delta_devices)); 575 platform_add_devices(ams_delta_devices, ARRAY_SIZE(ams_delta_devices));
502 576
577 /*
578 * As soon as devices have been registered, assign their dev_names
579 * to respective GPIO lookup tables before they are added.
580 */
581 ams_delta_audio_gpio_table.dev_id =
582 dev_name(&ams_delta_audio_device.dev);
583 /*
584 * No device name is assigned to GPIO lookup table for serio device
585 * as long as serio driver is not converted to platform device driver.
586 */
587
588 gpiod_add_lookup_tables(ams_delta_gpio_tables,
589 ARRAY_SIZE(ams_delta_gpio_tables));
590
503 ams_delta_init_fiq(); 591 ams_delta_init_fiq();
504 592
505 omap_writew(omap_readw(ARM_RSTCT1) | 0x0004, ARM_RSTCT1); 593 omap_writew(omap_readw(ARM_RSTCT1) | 0x0004, ARM_RSTCT1);
@@ -570,6 +658,15 @@ static int __init late_init(void)
570 658
571 platform_add_devices(late_devices, ARRAY_SIZE(late_devices)); 659 platform_add_devices(late_devices, ARRAY_SIZE(late_devices));
572 660
661 /*
662 * As soon as devices have been registered, assign their dev_names
663 * to respective GPIO lookup tables before they are added.
664 */
665 ams_delta_lcd_gpio_table.dev_id = dev_name(&ams_delta_lcd_device.dev);
666 ams_delta_nand_gpio_table.dev_id = dev_name(&ams_delta_nand_device.dev);
667
668 gpiod_add_lookup_tables(late_gpio_tables, ARRAY_SIZE(late_gpio_tables));
669
573 err = platform_device_register(&modem_nreset_device); 670 err = platform_device_register(&modem_nreset_device);
574 if (err) { 671 if (err) {
575 pr_err("Couldn't register the modem regulator device\n"); 672 pr_err("Couldn't register the modem regulator device\n");
diff --git a/arch/arm/mach-omap1/board-osk.c b/arch/arm/mach-omap1/board-osk.c
index c66372ed29e2..9ffa8d755a59 100644
--- a/arch/arm/mach-omap1/board-osk.c
+++ b/arch/arm/mach-omap1/board-osk.c
@@ -303,22 +303,22 @@ static const struct omap_lcd_config osk_lcd_config __initconst = {
303#ifdef CONFIG_OMAP_OSK_MISTRAL 303#ifdef CONFIG_OMAP_OSK_MISTRAL
304 304
305#include <linux/input.h> 305#include <linux/input.h>
306#include <linux/platform_data/at24.h> 306#include <linux/property.h>
307#include <linux/spi/spi.h> 307#include <linux/spi/spi.h>
308#include <linux/spi/ads7846.h> 308#include <linux/spi/ads7846.h>
309 309
310#include <linux/platform_data/keypad-omap.h> 310#include <linux/platform_data/keypad-omap.h>
311 311
312static struct at24_platform_data at24c04 = { 312static const struct property_entry mistral_at24_properties[] = {
313 .byte_len = SZ_4K / 8, 313 PROPERTY_ENTRY_U32("pagesize", 16),
314 .page_size = 16, 314 { }
315}; 315};
316 316
317static struct i2c_board_info __initdata mistral_i2c_board_info[] = { 317static struct i2c_board_info __initdata mistral_i2c_board_info[] = {
318 { 318 {
319 /* NOTE: powered from LCD supply */ 319 /* NOTE: powered from LCD supply */
320 I2C_BOARD_INFO("24c04", 0x50), 320 I2C_BOARD_INFO("24c04", 0x50),
321 .platform_data = &at24c04, 321 .properties = mistral_at24_properties,
322 }, 322 },
323 /* TODO when driver support is ready: 323 /* TODO when driver support is ready:
324 * - optionally ov9640 camera sensor at 0x30 324 * - optionally ov9640 camera sensor at 0x30
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 0d9ce58bc464..01377c292db4 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -78,7 +78,6 @@ endif
78omap-4-5-pm-common = omap-mpuss-lowpower.o 78omap-4-5-pm-common = omap-mpuss-lowpower.o
79obj-$(CONFIG_ARCH_OMAP4) += $(omap-4-5-pm-common) 79obj-$(CONFIG_ARCH_OMAP4) += $(omap-4-5-pm-common)
80obj-$(CONFIG_SOC_OMAP5) += $(omap-4-5-pm-common) 80obj-$(CONFIG_SOC_OMAP5) += $(omap-4-5-pm-common)
81obj-$(CONFIG_OMAP_PM_NOOP) += omap-pm-noop.o
82 81
83ifeq ($(CONFIG_PM),y) 82ifeq ($(CONFIG_PM),y)
84obj-$(CONFIG_ARCH_OMAP2) += pm24xx.o 83obj-$(CONFIG_ARCH_OMAP2) += pm24xx.o
diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c
index 6c61ecc62905..6b4f4975cf7a 100644
--- a/arch/arm/mach-omap2/board-generic.c
+++ b/arch/arm/mach-omap2/board-generic.c
@@ -31,8 +31,6 @@ static const struct of_device_id omap_dt_match_table[] __initconst = {
31static void __init __maybe_unused omap_generic_init(void) 31static void __init __maybe_unused omap_generic_init(void)
32{ 32{
33 pdata_quirks_init(omap_dt_match_table); 33 pdata_quirks_init(omap_dt_match_table);
34
35 omapdss_init_of();
36 omap_soc_device_init(); 34 omap_soc_device_init();
37} 35}
38 36
diff --git a/arch/arm/mach-omap2/clockdomain.c b/arch/arm/mach-omap2/clockdomain.c
index b79b1ca9aee9..6d44fe05a3fe 100644
--- a/arch/arm/mach-omap2/clockdomain.c
+++ b/arch/arm/mach-omap2/clockdomain.c
@@ -23,6 +23,7 @@
23#include <linux/limits.h> 23#include <linux/limits.h>
24#include <linux/err.h> 24#include <linux/err.h>
25#include <linux/clk-provider.h> 25#include <linux/clk-provider.h>
26#include <linux/cpu_pm.h>
26 27
27#include <linux/io.h> 28#include <linux/io.h>
28 29
@@ -31,6 +32,7 @@
31#include "soc.h" 32#include "soc.h"
32#include "clock.h" 33#include "clock.h"
33#include "clockdomain.h" 34#include "clockdomain.h"
35#include "pm.h"
34 36
35/* clkdm_list contains all registered struct clockdomains */ 37/* clkdm_list contains all registered struct clockdomains */
36static LIST_HEAD(clkdm_list); 38static LIST_HEAD(clkdm_list);
@@ -39,6 +41,8 @@ static LIST_HEAD(clkdm_list);
39static struct clkdm_autodep *autodeps; 41static struct clkdm_autodep *autodeps;
40 42
41static struct clkdm_ops *arch_clkdm; 43static struct clkdm_ops *arch_clkdm;
44void clkdm_save_context(void);
45void clkdm_restore_context(void);
42 46
43/* Private functions */ 47/* Private functions */
44 48
@@ -449,6 +453,22 @@ int clkdm_register_autodeps(struct clkdm_autodep *ia)
449 return 0; 453 return 0;
450} 454}
451 455
456static int cpu_notifier(struct notifier_block *nb, unsigned long cmd, void *v)
457{
458 switch (cmd) {
459 case CPU_CLUSTER_PM_ENTER:
460 if (enable_off_mode)
461 clkdm_save_context();
462 break;
463 case CPU_CLUSTER_PM_EXIT:
464 if (enable_off_mode)
465 clkdm_restore_context();
466 break;
467 }
468
469 return NOTIFY_OK;
470}
471
452/** 472/**
453 * clkdm_complete_init - set up the clockdomain layer 473 * clkdm_complete_init - set up the clockdomain layer
454 * 474 *
@@ -460,6 +480,7 @@ int clkdm_register_autodeps(struct clkdm_autodep *ia)
460int clkdm_complete_init(void) 480int clkdm_complete_init(void)
461{ 481{
462 struct clockdomain *clkdm; 482 struct clockdomain *clkdm;
483 static struct notifier_block nb;
463 484
464 if (list_empty(&clkdm_list)) 485 if (list_empty(&clkdm_list))
465 return -EACCES; 486 return -EACCES;
@@ -474,6 +495,12 @@ int clkdm_complete_init(void)
474 clkdm_clear_all_sleepdeps(clkdm); 495 clkdm_clear_all_sleepdeps(clkdm);
475 } 496 }
476 497
498 /* Only AM43XX can lose clkdm context during rtc-ddr suspend */
499 if (soc_is_am43xx()) {
500 nb.notifier_call = cpu_notifier;
501 cpu_pm_register_notifier(&nb);
502 }
503
477 return 0; 504 return 0;
478} 505}
479 506
@@ -1307,3 +1334,49 @@ int clkdm_hwmod_disable(struct clockdomain *clkdm, struct omap_hwmod *oh)
1307 return 0; 1334 return 0;
1308} 1335}
1309 1336
1337/**
1338 * _clkdm_save_context - save the context for the control of this clkdm
1339 *
1340 * Due to a suspend or hibernation operation, the state of the registers
1341 * controlling this clkdm will be lost, save their context.
1342 */
1343static int _clkdm_save_context(struct clockdomain *clkdm, void *ununsed)
1344{
1345 if (!arch_clkdm || !arch_clkdm->clkdm_save_context)
1346 return -EINVAL;
1347
1348 return arch_clkdm->clkdm_save_context(clkdm);
1349}
1350
1351/**
1352 * _clkdm_restore_context - restore context for control of this clkdm
1353 *
1354 * Restore the register values for this clockdomain.
1355 */
1356static int _clkdm_restore_context(struct clockdomain *clkdm, void *ununsed)
1357{
1358 if (!arch_clkdm || !arch_clkdm->clkdm_restore_context)
1359 return -EINVAL;
1360
1361 return arch_clkdm->clkdm_restore_context(clkdm);
1362}
1363
1364/**
1365 * clkdm_save_context - Saves the context for each registered clkdm
1366 *
1367 * Save the context for each registered clockdomain.
1368 */
1369void clkdm_save_context(void)
1370{
1371 clkdm_for_each(_clkdm_save_context, NULL);
1372}
1373
1374/**
1375 * clkdm_restore_context - Restores the context for each registered clkdm
1376 *
1377 * Restore the context for each registered clockdomain.
1378 */
1379void clkdm_restore_context(void)
1380{
1381 clkdm_for_each(_clkdm_restore_context, NULL);
1382}
diff --git a/arch/arm/mach-omap2/clockdomain.h b/arch/arm/mach-omap2/clockdomain.h
index 24667a5a9dc0..c7d0953e4aa2 100644
--- a/arch/arm/mach-omap2/clockdomain.h
+++ b/arch/arm/mach-omap2/clockdomain.h
@@ -141,6 +141,7 @@ struct clockdomain {
141 int usecount; 141 int usecount;
142 int forcewake_count; 142 int forcewake_count;
143 struct list_head node; 143 struct list_head node;
144 u32 context;
144}; 145};
145 146
146/** 147/**
@@ -159,6 +160,8 @@ struct clockdomain {
159 * @clkdm_deny_idle: Disable hw supervised idle transitions for clock domain 160 * @clkdm_deny_idle: Disable hw supervised idle transitions for clock domain
160 * @clkdm_clk_enable: Put the clkdm in right state for a clock enable 161 * @clkdm_clk_enable: Put the clkdm in right state for a clock enable
161 * @clkdm_clk_disable: Put the clkdm in right state for a clock disable 162 * @clkdm_clk_disable: Put the clkdm in right state for a clock disable
163 * @clkdm_save_context: Save the current clkdm context
164 * @clkdm_restore_context: Restore the clkdm context
162 */ 165 */
163struct clkdm_ops { 166struct clkdm_ops {
164 int (*clkdm_add_wkdep)(struct clockdomain *clkdm1, struct clockdomain *clkdm2); 167 int (*clkdm_add_wkdep)(struct clockdomain *clkdm1, struct clockdomain *clkdm2);
@@ -175,6 +178,8 @@ struct clkdm_ops {
175 void (*clkdm_deny_idle)(struct clockdomain *clkdm); 178 void (*clkdm_deny_idle)(struct clockdomain *clkdm);
176 int (*clkdm_clk_enable)(struct clockdomain *clkdm); 179 int (*clkdm_clk_enable)(struct clockdomain *clkdm);
177 int (*clkdm_clk_disable)(struct clockdomain *clkdm); 180 int (*clkdm_clk_disable)(struct clockdomain *clkdm);
181 int (*clkdm_save_context)(struct clockdomain *clkdm);
182 int (*clkdm_restore_context)(struct clockdomain *clkdm);
178}; 183};
179 184
180int clkdm_register_platform_funcs(struct clkdm_ops *co); 185int clkdm_register_platform_funcs(struct clkdm_ops *co);
@@ -214,6 +219,9 @@ int clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk);
214int clkdm_hwmod_enable(struct clockdomain *clkdm, struct omap_hwmod *oh); 219int clkdm_hwmod_enable(struct clockdomain *clkdm, struct omap_hwmod *oh);
215int clkdm_hwmod_disable(struct clockdomain *clkdm, struct omap_hwmod *oh); 220int clkdm_hwmod_disable(struct clockdomain *clkdm, struct omap_hwmod *oh);
216 221
222void clkdm_save_context(void);
223void clkdm_restore_context(void);
224
217extern void __init omap242x_clockdomains_init(void); 225extern void __init omap242x_clockdomains_init(void);
218extern void __init omap243x_clockdomains_init(void); 226extern void __init omap243x_clockdomains_init(void);
219extern void __init omap3xxx_clockdomains_init(void); 227extern void __init omap3xxx_clockdomains_init(void);
diff --git a/arch/arm/mach-omap2/cm33xx.c b/arch/arm/mach-omap2/cm33xx.c
index 1cc0247a2cb5..084d454f6074 100644
--- a/arch/arm/mach-omap2/cm33xx.c
+++ b/arch/arm/mach-omap2/cm33xx.c
@@ -72,6 +72,17 @@ static inline u32 am33xx_cm_rmw_reg_bits(u32 mask, u32 bits, s16 inst, s16 idx)
72 return v; 72 return v;
73} 73}
74 74
75static inline u32 am33xx_cm_read_reg_bits(u16 inst, s16 idx, u32 mask)
76{
77 u32 v;
78
79 v = am33xx_cm_read_reg(inst, idx);
80 v &= mask;
81 v >>= __ffs(mask);
82
83 return v;
84}
85
75/** 86/**
76 * _clkctrl_idlest - read a CM_*_CLKCTRL register; mask & shift IDLEST bitfield 87 * _clkctrl_idlest - read a CM_*_CLKCTRL register; mask & shift IDLEST bitfield
77 * @inst: CM instance register offset (*_INST macro) 88 * @inst: CM instance register offset (*_INST macro)
@@ -338,6 +349,46 @@ static u32 am33xx_cm_xlate_clkctrl(u8 part, u16 inst, u16 offset)
338 return cm_base.pa + inst + offset; 349 return cm_base.pa + inst + offset;
339} 350}
340 351
352/**
353 * am33xx_clkdm_save_context - Save the clockdomain transition context
354 * @clkdm: The clockdomain pointer whose context needs to be saved
355 *
356 * Save the clockdomain transition context.
357 */
358static int am33xx_clkdm_save_context(struct clockdomain *clkdm)
359{
360 clkdm->context = am33xx_cm_read_reg_bits(clkdm->cm_inst,
361 clkdm->clkdm_offs,
362 AM33XX_CLKTRCTRL_MASK);
363
364 return 0;
365}
366
367/**
368 * am33xx_restore_save_context - Restore the clockdomain transition context
369 * @clkdm: The clockdomain pointer whose context needs to be restored
370 *
371 * Restore the clockdomain transition context.
372 */
373static int am33xx_clkdm_restore_context(struct clockdomain *clkdm)
374{
375 switch (clkdm->context) {
376 case OMAP34XX_CLKSTCTRL_DISABLE_AUTO:
377 am33xx_clkdm_deny_idle(clkdm);
378 break;
379 case OMAP34XX_CLKSTCTRL_FORCE_SLEEP:
380 am33xx_clkdm_sleep(clkdm);
381 break;
382 case OMAP34XX_CLKSTCTRL_FORCE_WAKEUP:
383 am33xx_clkdm_wakeup(clkdm);
384 break;
385 case OMAP34XX_CLKSTCTRL_ENABLE_AUTO:
386 am33xx_clkdm_allow_idle(clkdm);
387 break;
388 }
389 return 0;
390}
391
341struct clkdm_ops am33xx_clkdm_operations = { 392struct clkdm_ops am33xx_clkdm_operations = {
342 .clkdm_sleep = am33xx_clkdm_sleep, 393 .clkdm_sleep = am33xx_clkdm_sleep,
343 .clkdm_wakeup = am33xx_clkdm_wakeup, 394 .clkdm_wakeup = am33xx_clkdm_wakeup,
@@ -345,6 +396,8 @@ struct clkdm_ops am33xx_clkdm_operations = {
345 .clkdm_deny_idle = am33xx_clkdm_deny_idle, 396 .clkdm_deny_idle = am33xx_clkdm_deny_idle,
346 .clkdm_clk_enable = am33xx_clkdm_clk_enable, 397 .clkdm_clk_enable = am33xx_clkdm_clk_enable,
347 .clkdm_clk_disable = am33xx_clkdm_clk_disable, 398 .clkdm_clk_disable = am33xx_clkdm_clk_disable,
399 .clkdm_save_context = am33xx_clkdm_save_context,
400 .clkdm_restore_context = am33xx_clkdm_restore_context,
348}; 401};
349 402
350static const struct cm_ll_data am33xx_cm_ll_data = { 403static const struct cm_ll_data am33xx_cm_ll_data = {
diff --git a/arch/arm/mach-omap2/cminst44xx.c b/arch/arm/mach-omap2/cminst44xx.c
index 7deefee49fc3..c11ac492b626 100644
--- a/arch/arm/mach-omap2/cminst44xx.c
+++ b/arch/arm/mach-omap2/cminst44xx.c
@@ -481,6 +481,47 @@ static u32 omap4_cminst_xlate_clkctrl(u8 part, u16 inst, u16 offset)
481 return _cm_bases[part].pa + inst + offset; 481 return _cm_bases[part].pa + inst + offset;
482} 482}
483 483
484/**
485 * omap4_clkdm_save_context - Save the clockdomain modulemode context
486 * @clkdm: The clockdomain pointer whose context needs to be saved
487 *
488 * Save the clockdomain modulemode context.
489 */
490static int omap4_clkdm_save_context(struct clockdomain *clkdm)
491{
492 clkdm->context = omap4_cminst_read_inst_reg(clkdm->prcm_partition,
493 clkdm->cm_inst,
494 clkdm->clkdm_offs +
495 OMAP4_CM_CLKSTCTRL);
496 clkdm->context &= OMAP4430_MODULEMODE_MASK;
497 return 0;
498}
499
500/**
501 * omap4_clkdm_restore_context - Restore the clockdomain modulemode context
502 * @clkdm: The clockdomain pointer whose context needs to be restored
503 *
504 * Restore the clockdomain modulemode context.
505 */
506static int omap4_clkdm_restore_context(struct clockdomain *clkdm)
507{
508 switch (clkdm->context) {
509 case OMAP34XX_CLKSTCTRL_DISABLE_AUTO:
510 omap4_clkdm_deny_idle(clkdm);
511 break;
512 case OMAP34XX_CLKSTCTRL_FORCE_SLEEP:
513 omap4_clkdm_sleep(clkdm);
514 break;
515 case OMAP34XX_CLKSTCTRL_FORCE_WAKEUP:
516 omap4_clkdm_wakeup(clkdm);
517 break;
518 case OMAP34XX_CLKSTCTRL_ENABLE_AUTO:
519 omap4_clkdm_allow_idle(clkdm);
520 break;
521 }
522 return 0;
523}
524
484struct clkdm_ops omap4_clkdm_operations = { 525struct clkdm_ops omap4_clkdm_operations = {
485 .clkdm_add_wkdep = omap4_clkdm_add_wkup_sleep_dep, 526 .clkdm_add_wkdep = omap4_clkdm_add_wkup_sleep_dep,
486 .clkdm_del_wkdep = omap4_clkdm_del_wkup_sleep_dep, 527 .clkdm_del_wkdep = omap4_clkdm_del_wkup_sleep_dep,
@@ -496,6 +537,8 @@ struct clkdm_ops omap4_clkdm_operations = {
496 .clkdm_deny_idle = omap4_clkdm_deny_idle, 537 .clkdm_deny_idle = omap4_clkdm_deny_idle,
497 .clkdm_clk_enable = omap4_clkdm_clk_enable, 538 .clkdm_clk_enable = omap4_clkdm_clk_enable,
498 .clkdm_clk_disable = omap4_clkdm_clk_disable, 539 .clkdm_clk_disable = omap4_clkdm_clk_disable,
540 .clkdm_save_context = omap4_clkdm_save_context,
541 .clkdm_restore_context = omap4_clkdm_restore_context,
499}; 542};
500 543
501struct clkdm_ops am43xx_clkdm_operations = { 544struct clkdm_ops am43xx_clkdm_operations = {
diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h
index fbe0b78bf489..dff3750e432f 100644
--- a/arch/arm/mach-omap2/common.h
+++ b/arch/arm/mach-omap2/common.h
@@ -44,6 +44,9 @@
44 44
45#define OMAP_INTC_START NR_IRQS 45#define OMAP_INTC_START NR_IRQS
46 46
47extern int (*omap_pm_soc_init)(void);
48int omap_pm_nop_init(void);
49
47#if defined(CONFIG_PM) && defined(CONFIG_ARCH_OMAP2) 50#if defined(CONFIG_PM) && defined(CONFIG_ARCH_OMAP2)
48int omap2_pm_init(void); 51int omap2_pm_init(void);
49#else 52#else
@@ -79,9 +82,12 @@ static inline int omap4_pm_init_early(void)
79 82
80#if defined(CONFIG_PM) && (defined(CONFIG_SOC_AM33XX) || \ 83#if defined(CONFIG_PM) && (defined(CONFIG_SOC_AM33XX) || \
81 defined(CONFIG_SOC_AM43XX)) 84 defined(CONFIG_SOC_AM43XX))
82void amx3_common_pm_init(void); 85int amx3_common_pm_init(void);
83#else 86#else
84static inline void amx3_common_pm_init(void) { } 87static inline int amx3_common_pm_init(void)
88{
89 return 0;
90}
85#endif 91#endif
86 92
87extern void omap2_init_common_infrastructure(void); 93extern void omap2_init_common_infrastructure(void);
@@ -122,14 +128,10 @@ void am43xx_init_early(void);
122void am43xx_init_late(void); 128void am43xx_init_late(void);
123void omap4430_init_early(void); 129void omap4430_init_early(void);
124void omap5_init_early(void); 130void omap5_init_early(void);
125void omap3_init_late(void); /* Do not use this one */ 131void omap3_init_late(void);
126void omap4430_init_late(void); 132void omap4430_init_late(void);
127void omap2420_init_late(void); 133void omap2420_init_late(void);
128void omap2430_init_late(void); 134void omap2430_init_late(void);
129void omap3430_init_late(void);
130void omap35xx_init_late(void);
131void omap3630_init_late(void);
132void am35xx_init_late(void);
133void ti81xx_init_late(void); 135void ti81xx_init_late(void);
134void am33xx_init_late(void); 136void am33xx_init_late(void);
135void omap5_init_late(void); 137void omap5_init_late(void);
@@ -350,7 +352,5 @@ extern int omap_dss_reset(struct omap_hwmod *);
350/* SoC specific clock initializer */ 352/* SoC specific clock initializer */
351int omap_clk_init(void); 353int omap_clk_init(void);
352 354
353int __init omapdss_init_of(void);
354
355#endif /* __ASSEMBLER__ */ 355#endif /* __ASSEMBLER__ */
356#endif /* __ARCH_ARM_MACH_OMAP2PLUS_COMMON_H */ 356#endif /* __ARCH_ARM_MACH_OMAP2PLUS_COMMON_H */
diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c
index 180da403639e..0bbfb20e193f 100644
--- a/arch/arm/mach-omap2/control.c
+++ b/arch/arm/mach-omap2/control.c
@@ -17,6 +17,7 @@
17#include <linux/of_address.h> 17#include <linux/of_address.h>
18#include <linux/regmap.h> 18#include <linux/regmap.h>
19#include <linux/mfd/syscon.h> 19#include <linux/mfd/syscon.h>
20#include <linux/cpu_pm.h>
20 21
21#include "soc.h" 22#include "soc.h"
22#include "iomap.h" 23#include "iomap.h"
@@ -621,6 +622,110 @@ void __init omap3_ctrl_init(void)
621} 622}
622#endif /* CONFIG_ARCH_OMAP3 && CONFIG_PM */ 623#endif /* CONFIG_ARCH_OMAP3 && CONFIG_PM */
623 624
625static unsigned long am43xx_control_reg_offsets[] = {
626 AM33XX_CONTROL_SYSCONFIG_OFFSET,
627 AM33XX_CONTROL_STATUS_OFFSET,
628 AM43XX_CONTROL_MPU_L2_CTRL_OFFSET,
629 AM33XX_CONTROL_CORE_SLDO_CTRL_OFFSET,
630 AM33XX_CONTROL_MPU_SLDO_CTRL_OFFSET,
631 AM33XX_CONTROL_CLK32KDIVRATIO_CTRL_OFFSET,
632 AM33XX_CONTROL_BANDGAP_CTRL_OFFSET,
633 AM33XX_CONTROL_BANDGAP_TRIM_OFFSET,
634 AM33XX_CONTROL_PLL_CLKINPULOW_CTRL_OFFSET,
635 AM33XX_CONTROL_MOSC_CTRL_OFFSET,
636 AM33XX_CONTROL_DEEPSLEEP_CTRL_OFFSET,
637 AM43XX_CONTROL_DISPLAY_PLL_SEL_OFFSET,
638 AM33XX_CONTROL_INIT_PRIORITY_0_OFFSET,
639 AM33XX_CONTROL_INIT_PRIORITY_1_OFFSET,
640 AM33XX_CONTROL_TPTC_CFG_OFFSET,
641 AM33XX_CONTROL_USB_CTRL0_OFFSET,
642 AM33XX_CONTROL_USB_CTRL1_OFFSET,
643 AM43XX_CONTROL_USB_CTRL2_OFFSET,
644 AM43XX_CONTROL_GMII_SEL_OFFSET,
645 AM43XX_CONTROL_MPUSS_CTRL_OFFSET,
646 AM43XX_CONTROL_TIMER_CASCADE_CTRL_OFFSET,
647 AM43XX_CONTROL_PWMSS_CTRL_OFFSET,
648 AM33XX_CONTROL_MREQPRIO_0_OFFSET,
649 AM33XX_CONTROL_MREQPRIO_1_OFFSET,
650 AM33XX_CONTROL_HW_EVENT_SEL_GRP1_OFFSET,
651 AM33XX_CONTROL_HW_EVENT_SEL_GRP2_OFFSET,
652 AM33XX_CONTROL_HW_EVENT_SEL_GRP3_OFFSET,
653 AM33XX_CONTROL_HW_EVENT_SEL_GRP4_OFFSET,
654 AM33XX_CONTROL_SMRT_CTRL_OFFSET,
655 AM33XX_CONTROL_MPUSS_HW_DEBUG_SEL_OFFSET,
656 AM43XX_CONTROL_CQDETECT_STS_OFFSET,
657 AM43XX_CONTROL_CQDETECT_STS2_OFFSET,
658 AM43XX_CONTROL_VTP_CTRL_OFFSET,
659 AM33XX_CONTROL_VREF_CTRL_OFFSET,
660 AM33XX_CONTROL_TPCC_EVT_MUX_0_3_OFFSET,
661 AM33XX_CONTROL_TPCC_EVT_MUX_4_7_OFFSET,
662 AM33XX_CONTROL_TPCC_EVT_MUX_8_11_OFFSET,
663 AM33XX_CONTROL_TPCC_EVT_MUX_12_15_OFFSET,
664 AM33XX_CONTROL_TPCC_EVT_MUX_16_19_OFFSET,
665 AM33XX_CONTROL_TPCC_EVT_MUX_20_23_OFFSET,
666 AM33XX_CONTROL_TPCC_EVT_MUX_24_27_OFFSET,
667 AM33XX_CONTROL_TPCC_EVT_MUX_28_31_OFFSET,
668 AM33XX_CONTROL_TPCC_EVT_MUX_32_35_OFFSET,
669 AM33XX_CONTROL_TPCC_EVT_MUX_36_39_OFFSET,
670 AM33XX_CONTROL_TPCC_EVT_MUX_40_43_OFFSET,
671 AM33XX_CONTROL_TPCC_EVT_MUX_44_47_OFFSET,
672 AM33XX_CONTROL_TPCC_EVT_MUX_48_51_OFFSET,
673 AM33XX_CONTROL_TPCC_EVT_MUX_52_55_OFFSET,
674 AM33XX_CONTROL_TPCC_EVT_MUX_56_59_OFFSET,
675 AM33XX_CONTROL_TPCC_EVT_MUX_60_63_OFFSET,
676 AM33XX_CONTROL_TIMER_EVT_CAPT_OFFSET,
677 AM33XX_CONTROL_ECAP_EVT_CAPT_OFFSET,
678 AM33XX_CONTROL_ADC_EVT_CAPT_OFFSET,
679 AM43XX_CONTROL_ADC1_EVT_CAPT_OFFSET,
680 AM33XX_CONTROL_RESET_ISO_OFFSET,
681};
682
683static u32 am33xx_control_vals[ARRAY_SIZE(am43xx_control_reg_offsets)];
684
685/**
686 * am43xx_control_save_context - Save the wakeup domain registers
687 *
688 * Save the wkup domain registers
689 */
690void am43xx_control_save_context(void)
691{
692 int i;
693
694 for (i = 0; i < ARRAY_SIZE(am43xx_control_reg_offsets); i++)
695 am33xx_control_vals[i] =
696 omap_ctrl_readl(am43xx_control_reg_offsets[i]);
697}
698
699/**
700 * am43xx_control_restore_context - Restore the wakeup domain registers
701 *
702 * Restore the wkup domain registers
703 */
704void am43xx_control_restore_context(void)
705{
706 int i;
707
708 for (i = 0; i < ARRAY_SIZE(am43xx_control_reg_offsets); i++)
709 omap_ctrl_writel(am33xx_control_vals[i],
710 am43xx_control_reg_offsets[i]);
711}
712
713static int cpu_notifier(struct notifier_block *nb, unsigned long cmd, void *v)
714{
715 switch (cmd) {
716 case CPU_CLUSTER_PM_ENTER:
717 if (enable_off_mode)
718 am43xx_control_save_context();
719 break;
720 case CPU_CLUSTER_PM_EXIT:
721 if (enable_off_mode)
722 am43xx_control_restore_context();
723 break;
724 }
725
726 return NOTIFY_OK;
727}
728
624struct control_init_data { 729struct control_init_data {
625 int index; 730 int index;
626 void __iomem *mem; 731 void __iomem *mem;
@@ -699,6 +804,7 @@ int __init omap_control_init(void)
699 const struct omap_prcm_init_data *data; 804 const struct omap_prcm_init_data *data;
700 int ret; 805 int ret;
701 struct regmap *syscon; 806 struct regmap *syscon;
807 static struct notifier_block nb;
702 808
703 for_each_matching_node_and_match(np, omap_scrm_dt_match_table, &match) { 809 for_each_matching_node_and_match(np, omap_scrm_dt_match_table, &match) {
704 data = match->data; 810 data = match->data;
@@ -731,6 +837,12 @@ int __init omap_control_init(void)
731 } 837 }
732 } 838 }
733 839
840 /* Only AM43XX can lose ctrl registers context during rtc-ddr suspend */
841 if (soc_is_am43xx()) {
842 nb.notifier_call = cpu_notifier;
843 cpu_pm_register_notifier(&nb);
844 }
845
734 return 0; 846 return 0;
735} 847}
736 848
diff --git a/arch/arm/mach-omap2/control.h b/arch/arm/mach-omap2/control.h
index ec406bc2c6d4..393b42110511 100644
--- a/arch/arm/mach-omap2/control.h
+++ b/arch/arm/mach-omap2/control.h
@@ -409,6 +409,67 @@
409#define AM33XX_DEV_FEATURE 0x604 409#define AM33XX_DEV_FEATURE 0x604
410#define AM33XX_SGX_MASK BIT(29) 410#define AM33XX_SGX_MASK BIT(29)
411 411
412/* Additional AM33XX/AM43XX CONTROL registers */
413#define AM33XX_CONTROL_SYSCONFIG_OFFSET 0x0010
414#define AM33XX_CONTROL_STATUS_OFFSET 0x0040
415#define AM43XX_CONTROL_MPU_L2_CTRL_OFFSET 0x01e0
416#define AM33XX_CONTROL_CORTEX_VBBLDO_CTRL_OFFSET 0x041c
417#define AM33XX_CONTROL_CORE_SLDO_CTRL_OFFSET 0x0428
418#define AM33XX_CONTROL_MPU_SLDO_CTRL_OFFSET 0x042c
419#define AM33XX_CONTROL_CLK32KDIVRATIO_CTRL_OFFSET 0x0444
420#define AM33XX_CONTROL_BANDGAP_CTRL_OFFSET 0x0448
421#define AM33XX_CONTROL_BANDGAP_TRIM_OFFSET 0x044c
422#define AM33XX_CONTROL_PLL_CLKINPULOW_CTRL_OFFSET 0x0458
423#define AM33XX_CONTROL_MOSC_CTRL_OFFSET 0x0468
424#define AM33XX_CONTROL_RCOSC_CTRL_OFFSET 0x046c
425#define AM33XX_CONTROL_DEEPSLEEP_CTRL_OFFSET 0x0470
426#define AM43XX_CONTROL_DISPLAY_PLL_SEL_OFFSET 0x0534
427#define AM33XX_CONTROL_INIT_PRIORITY_0_OFFSET 0x0608
428#define AM33XX_CONTROL_INIT_PRIORITY_1_OFFSET 0x060c
429#define AM33XX_CONTROL_MMU_CFG_OFFSET 0x0610
430#define AM33XX_CONTROL_TPTC_CFG_OFFSET 0x0614
431#define AM33XX_CONTROL_USB_CTRL0_OFFSET 0x0620
432#define AM33XX_CONTROL_USB_CTRL1_OFFSET 0x0628
433#define AM33XX_CONTROL_USB_WKUP_CTRL_OFFSET 0x0648
434#define AM43XX_CONTROL_USB_CTRL2_OFFSET 0x064c
435#define AM43XX_CONTROL_GMII_SEL_OFFSET 0x0650
436#define AM43XX_CONTROL_MPUSS_CTRL_OFFSET 0x0654
437#define AM43XX_CONTROL_TIMER_CASCADE_CTRL_OFFSET 0x0658
438#define AM43XX_CONTROL_PWMSS_CTRL_OFFSET 0x0664
439#define AM33XX_CONTROL_MREQPRIO_0_OFFSET 0x0670
440#define AM33XX_CONTROL_MREQPRIO_1_OFFSET 0x0674
441#define AM33XX_CONTROL_HW_EVENT_SEL_GRP1_OFFSET 0x0690
442#define AM33XX_CONTROL_HW_EVENT_SEL_GRP2_OFFSET 0x0694
443#define AM33XX_CONTROL_HW_EVENT_SEL_GRP3_OFFSET 0x0698
444#define AM33XX_CONTROL_HW_EVENT_SEL_GRP4_OFFSET 0x069c
445#define AM33XX_CONTROL_SMRT_CTRL_OFFSET 0x06a0
446#define AM33XX_CONTROL_MPUSS_HW_DEBUG_SEL_OFFSET 0x06a4
447#define AM43XX_CONTROL_CQDETECT_STS_OFFSET 0x0e00
448#define AM43XX_CONTROL_CQDETECT_STS2_OFFSET 0x0e08
449#define AM43XX_CONTROL_VTP_CTRL_OFFSET 0x0e0c
450#define AM33XX_CONTROL_VREF_CTRL_OFFSET 0x0e14
451#define AM33XX_CONTROL_TPCC_EVT_MUX_0_3_OFFSET 0x0f90
452#define AM33XX_CONTROL_TPCC_EVT_MUX_4_7_OFFSET 0x0f94
453#define AM33XX_CONTROL_TPCC_EVT_MUX_8_11_OFFSET 0x0f98
454#define AM33XX_CONTROL_TPCC_EVT_MUX_12_15_OFFSET 0x0f9c
455#define AM33XX_CONTROL_TPCC_EVT_MUX_16_19_OFFSET 0x0fa0
456#define AM33XX_CONTROL_TPCC_EVT_MUX_20_23_OFFSET 0x0fa4
457#define AM33XX_CONTROL_TPCC_EVT_MUX_24_27_OFFSET 0x0fa8
458#define AM33XX_CONTROL_TPCC_EVT_MUX_28_31_OFFSET 0x0fac
459#define AM33XX_CONTROL_TPCC_EVT_MUX_32_35_OFFSET 0x0fb0
460#define AM33XX_CONTROL_TPCC_EVT_MUX_36_39_OFFSET 0x0fb4
461#define AM33XX_CONTROL_TPCC_EVT_MUX_40_43_OFFSET 0x0fb8
462#define AM33XX_CONTROL_TPCC_EVT_MUX_44_47_OFFSET 0x0fbc
463#define AM33XX_CONTROL_TPCC_EVT_MUX_48_51_OFFSET 0x0fc0
464#define AM33XX_CONTROL_TPCC_EVT_MUX_52_55_OFFSET 0x0fc4
465#define AM33XX_CONTROL_TPCC_EVT_MUX_56_59_OFFSET 0x0fc8
466#define AM33XX_CONTROL_TPCC_EVT_MUX_60_63_OFFSET 0x0fcc
467#define AM33XX_CONTROL_TIMER_EVT_CAPT_OFFSET 0x0fd0
468#define AM33XX_CONTROL_ECAP_EVT_CAPT_OFFSET 0x0fd4
469#define AM33XX_CONTROL_ADC_EVT_CAPT_OFFSET 0x0fd8
470#define AM43XX_CONTROL_ADC1_EVT_CAPT_OFFSET 0x0fdc
471#define AM33XX_CONTROL_RESET_ISO_OFFSET 0x1000
472
412/* CONTROL OMAP STATUS register to identify OMAP3 features */ 473/* CONTROL OMAP STATUS register to identify OMAP3 features */
413#define OMAP3_CONTROL_OMAP_STATUS 0x044c 474#define OMAP3_CONTROL_OMAP_STATUS 0x044c
414 475
diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
index b3f6eb5d04a2..9500b6e27380 100644
--- a/arch/arm/mach-omap2/display.c
+++ b/arch/arm/mach-omap2/display.c
@@ -32,7 +32,6 @@
32#include <linux/platform_data/omapdss.h> 32#include <linux/platform_data/omapdss.h>
33#include "omap_hwmod.h" 33#include "omap_hwmod.h"
34#include "omap_device.h" 34#include "omap_device.h"
35#include "omap-pm.h"
36#include "common.h" 35#include "common.h"
37 36
38#include "soc.h" 37#include "soc.h"
@@ -126,11 +125,6 @@ static void omap_dsi_disable_pads(int dsi_id, unsigned lane_mask)
126 omap4_dsi_mux_pads(dsi_id, 0); 125 omap4_dsi_mux_pads(dsi_id, 0);
127} 126}
128 127
129static int omap_dss_set_min_bus_tput(struct device *dev, unsigned long tput)
130{
131 return omap_pm_set_min_bus_tput(dev, OCP_INITIATOR_AGENT, tput);
132}
133
134static enum omapdss_version __init omap_display_get_version(void) 128static enum omapdss_version __init omap_display_get_version(void)
135{ 129{
136 if (cpu_is_omap24xx()) 130 if (cpu_is_omap24xx())
@@ -169,7 +163,6 @@ static int __init omapdss_init_fbdev(void)
169 static struct omap_dss_board_info board_data = { 163 static struct omap_dss_board_info board_data = {
170 .dsi_enable_pads = omap_dsi_enable_pads, 164 .dsi_enable_pads = omap_dsi_enable_pads,
171 .dsi_disable_pads = omap_dsi_disable_pads, 165 .dsi_disable_pads = omap_dsi_disable_pads,
172 .set_min_bus_tput = omap_dss_set_min_bus_tput,
173 }; 166 };
174 struct device_node *node; 167 struct device_node *node;
175 int r; 168 int r;
@@ -392,7 +385,7 @@ static struct device_node * __init omapdss_find_dss_of_node(void)
392 return NULL; 385 return NULL;
393} 386}
394 387
395int __init omapdss_init_of(void) 388static int __init omapdss_init_of(void)
396{ 389{
397 int r; 390 int r;
398 struct device_node *node; 391 struct device_node *node;
@@ -422,3 +415,4 @@ int __init omapdss_init_of(void)
422 415
423 return omapdss_init_fbdev(); 416 return omapdss_init_fbdev();
424} 417}
418omap_device_initcall(omapdss_init_of);
diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c
index b064066d431c..0103548b0b15 100644
--- a/arch/arm/mach-omap2/hsmmc.c
+++ b/arch/arm/mach-omap2/hsmmc.c
@@ -18,7 +18,6 @@
18 18
19#include "soc.h" 19#include "soc.h"
20#include "omap_device.h" 20#include "omap_device.h"
21#include "omap-pm.h"
22 21
23#include "hsmmc.h" 22#include "hsmmc.h"
24#include "control.h" 23#include "control.h"
diff --git a/arch/arm/mach-omap2/i2c.c b/arch/arm/mach-omap2/i2c.c
index 91a21c3923b2..37ff25ee3d89 100644
--- a/arch/arm/mach-omap2/i2c.c
+++ b/arch/arm/mach-omap2/i2c.c
@@ -22,7 +22,6 @@
22#include "soc.h" 22#include "soc.h"
23#include "omap_hwmod.h" 23#include "omap_hwmod.h"
24#include "omap_device.h" 24#include "omap_device.h"
25#include "omap-pm.h"
26 25
27#include "prm.h" 26#include "prm.h"
28#include "common.h" 27#include "common.h"
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index cf546dfe3b32..bb8e0bb7ef5d 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -37,7 +37,6 @@
37#include "clock.h" 37#include "clock.h"
38#include "clock2xxx.h" 38#include "clock2xxx.h"
39#include "clock3xxx.h" 39#include "clock3xxx.h"
40#include "omap-pm.h"
41#include "sdrc.h" 40#include "sdrc.h"
42#include "control.h" 41#include "control.h"
43#include "serial.h" 42#include "serial.h"
@@ -421,13 +420,6 @@ static void __init __maybe_unused omap_hwmod_init_postsetup(void)
421 postsetup_state = _HWMOD_STATE_ENABLED; 420 postsetup_state = _HWMOD_STATE_ENABLED;
422#endif 421#endif
423 omap_hwmod_for_each(_set_hwmod_postsetup_state, &postsetup_state); 422 omap_hwmod_for_each(_set_hwmod_postsetup_state, &postsetup_state);
424
425 omap_pm_if_early_init();
426}
427
428static void __init __maybe_unused omap_common_late_init(void)
429{
430 omap2_common_pm_late_init();
431} 423}
432 424
433#ifdef CONFIG_SOC_OMAP2420 425#ifdef CONFIG_SOC_OMAP2420
@@ -450,9 +442,7 @@ void __init omap2420_init_early(void)
450 442
451void __init omap2420_init_late(void) 443void __init omap2420_init_late(void)
452{ 444{
453 omap_common_late_init(); 445 omap_pm_soc_init = omap2_pm_init;
454 omap2_pm_init();
455 omap2_clk_enable_autoidle_all();
456} 446}
457#endif 447#endif
458 448
@@ -476,9 +466,7 @@ void __init omap2430_init_early(void)
476 466
477void __init omap2430_init_late(void) 467void __init omap2430_init_late(void)
478{ 468{
479 omap_common_late_init(); 469 omap_pm_soc_init = omap2_pm_init;
480 omap2_pm_init();
481 omap2_clk_enable_autoidle_all();
482} 470}
483#endif 471#endif
484 472
@@ -529,43 +517,12 @@ void __init am35xx_init_early(void)
529 517
530void __init omap3_init_late(void) 518void __init omap3_init_late(void)
531{ 519{
532 omap_common_late_init(); 520 omap_pm_soc_init = omap3_pm_init;
533 omap3_pm_init();
534 omap2_clk_enable_autoidle_all();
535}
536
537void __init omap3430_init_late(void)
538{
539 omap_common_late_init();
540 omap3_pm_init();
541 omap2_clk_enable_autoidle_all();
542}
543
544void __init omap35xx_init_late(void)
545{
546 omap_common_late_init();
547 omap3_pm_init();
548 omap2_clk_enable_autoidle_all();
549}
550
551void __init omap3630_init_late(void)
552{
553 omap_common_late_init();
554 omap3_pm_init();
555 omap2_clk_enable_autoidle_all();
556}
557
558void __init am35xx_init_late(void)
559{
560 omap_common_late_init();
561 omap3_pm_init();
562 omap2_clk_enable_autoidle_all();
563} 521}
564 522
565void __init ti81xx_init_late(void) 523void __init ti81xx_init_late(void)
566{ 524{
567 omap_common_late_init(); 525 omap_pm_soc_init = omap_pm_nop_init;
568 omap2_clk_enable_autoidle_all();
569} 526}
570#endif 527#endif
571 528
@@ -621,8 +578,7 @@ void __init am33xx_init_early(void)
621 578
622void __init am33xx_init_late(void) 579void __init am33xx_init_late(void)
623{ 580{
624 omap_common_late_init(); 581 omap_pm_soc_init = amx3_common_pm_init;
625 amx3_common_pm_init();
626} 582}
627#endif 583#endif
628 584
@@ -645,9 +601,7 @@ void __init am43xx_init_early(void)
645 601
646void __init am43xx_init_late(void) 602void __init am43xx_init_late(void)
647{ 603{
648 omap_common_late_init(); 604 omap_pm_soc_init = amx3_common_pm_init;
649 omap2_clk_enable_autoidle_all();
650 amx3_common_pm_init();
651} 605}
652#endif 606#endif
653 607
@@ -675,9 +629,7 @@ void __init omap4430_init_early(void)
675 629
676void __init omap4430_init_late(void) 630void __init omap4430_init_late(void)
677{ 631{
678 omap_common_late_init(); 632 omap_pm_soc_init = omap4_pm_init;
679 omap4_pm_init();
680 omap2_clk_enable_autoidle_all();
681} 633}
682#endif 634#endif
683 635
@@ -703,9 +655,7 @@ void __init omap5_init_early(void)
703 655
704void __init omap5_init_late(void) 656void __init omap5_init_late(void)
705{ 657{
706 omap_common_late_init(); 658 omap_pm_soc_init = omap4_pm_init;
707 omap4_pm_init();
708 omap2_clk_enable_autoidle_all();
709} 659}
710#endif 660#endif
711 661
@@ -728,9 +678,7 @@ void __init dra7xx_init_early(void)
728 678
729void __init dra7xx_init_late(void) 679void __init dra7xx_init_late(void)
730{ 680{
731 omap_common_late_init(); 681 omap_pm_soc_init = omap4_pm_init;
732 omap4_pm_init();
733 omap2_clk_enable_autoidle_all();
734} 682}
735#endif 683#endif
736 684
diff --git a/arch/arm/mach-omap2/omap-pm-noop.c b/arch/arm/mach-omap2/omap-pm-noop.c
deleted file mode 100644
index 4ead077ea4e7..000000000000
--- a/arch/arm/mach-omap2/omap-pm-noop.c
+++ /dev/null
@@ -1,176 +0,0 @@
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * omap-pm-noop.c - OMAP power management interface - dummy version
4 *
5 * This code implements the OMAP power management interface to
6 * drivers, CPUIdle, CPUFreq, and DSP Bridge. It is strictly for
7 * debug/demonstration use, as it does nothing but printk() whenever a
8 * function is called (when DEBUG is defined, below)
9 *
10 * Copyright (C) 2008-2009 Texas Instruments, Inc.
11 * Copyright (C) 2008-2009 Nokia Corporation
12 * Paul Walmsley
13 *
14 * Interface developed by (in alphabetical order):
15 * Karthik Dasu, Tony Lindgren, Rajendra Nayak, Sakari Poussa, Veeramanikandan
16 * Raju, Anand Sawant, Igor Stoppa, Paul Walmsley, Richard Woodruff
17 */
18
19#undef DEBUG
20
21#include <linux/init.h>
22#include <linux/cpufreq.h>
23#include <linux/device.h>
24#include <linux/platform_device.h>
25
26#include "omap_device.h"
27#include "omap-pm.h"
28
29static bool off_mode_enabled;
30static int dummy_context_loss_counter;
31
32/*
33 * Device-driver-originated constraints (via board-*.c files)
34 */
35
36int omap_pm_set_max_mpu_wakeup_lat(struct device *dev, long t)
37{
38 if (!dev || t < -1) {
39 WARN(1, "OMAP PM: %s: invalid parameter(s)", __func__);
40 return -EINVAL;
41 }
42
43 if (t == -1)
44 pr_debug("OMAP PM: remove max MPU wakeup latency constraint: dev %s\n",
45 dev_name(dev));
46 else
47 pr_debug("OMAP PM: add max MPU wakeup latency constraint: dev %s, t = %ld usec\n",
48 dev_name(dev), t);
49
50 /*
51 * For current Linux, this needs to map the MPU to a
52 * powerdomain, then go through the list of current max lat
53 * constraints on the MPU and find the smallest. If
54 * the latency constraint has changed, the code should
55 * recompute the state to enter for the next powerdomain
56 * state.
57 *
58 * TI CDP code can call constraint_set here.
59 */
60
61 return 0;
62}
63
64int omap_pm_set_min_bus_tput(struct device *dev, u8 agent_id, unsigned long r)
65{
66 if (!dev || (agent_id != OCP_INITIATOR_AGENT &&
67 agent_id != OCP_TARGET_AGENT)) {
68 WARN(1, "OMAP PM: %s: invalid parameter(s)", __func__);
69 return -EINVAL;
70 }
71
72 if (r == 0)
73 pr_debug("OMAP PM: remove min bus tput constraint: dev %s for agent_id %d\n",
74 dev_name(dev), agent_id);
75 else
76 pr_debug("OMAP PM: add min bus tput constraint: dev %s for agent_id %d: rate %ld KiB\n",
77 dev_name(dev), agent_id, r);
78
79 /*
80 * This code should model the interconnect and compute the
81 * required clock frequency, convert that to a VDD2 OPP ID, then
82 * set the VDD2 OPP appropriately.
83 *
84 * TI CDP code can call constraint_set here on the VDD2 OPP.
85 */
86
87 return 0;
88}
89
90/*
91 * DSP Bridge-specific constraints
92 */
93
94
95/**
96 * omap_pm_enable_off_mode - notify OMAP PM that off-mode is enabled
97 *
98 * Intended for use only by OMAP PM core code to notify this layer
99 * that off mode has been enabled.
100 */
101void omap_pm_enable_off_mode(void)
102{
103 off_mode_enabled = true;
104}
105
106/**
107 * omap_pm_disable_off_mode - notify OMAP PM that off-mode is disabled
108 *
109 * Intended for use only by OMAP PM core code to notify this layer
110 * that off mode has been disabled.
111 */
112void omap_pm_disable_off_mode(void)
113{
114 off_mode_enabled = false;
115}
116
117/*
118 * Device context loss tracking
119 */
120
121#ifdef CONFIG_ARCH_OMAP2PLUS
122
123int omap_pm_get_dev_context_loss_count(struct device *dev)
124{
125 struct platform_device *pdev = to_platform_device(dev);
126 int count;
127
128 if (WARN_ON(!dev))
129 return -ENODEV;
130
131 if (dev->pm_domain == &omap_device_pm_domain) {
132 count = omap_device_get_context_loss_count(pdev);
133 } else {
134 WARN_ONCE(off_mode_enabled, "omap_pm: using dummy context loss counter; device %s should be converted to omap_device",
135 dev_name(dev));
136
137 count = dummy_context_loss_counter;
138
139 if (off_mode_enabled) {
140 count++;
141 /*
142 * Context loss count has to be a non-negative value.
143 * Clear the sign bit to get a value range from 0 to
144 * INT_MAX.
145 */
146 count &= INT_MAX;
147 dummy_context_loss_counter = count;
148 }
149 }
150
151 pr_debug("OMAP PM: context loss count for dev %s = %d\n",
152 dev_name(dev), count);
153
154 return count;
155}
156
157#else
158
159int omap_pm_get_dev_context_loss_count(struct device *dev)
160{
161 return dummy_context_loss_counter;
162}
163
164#endif
165
166/* Should be called before clk framework init */
167int __init omap_pm_if_early_init(void)
168{
169 return 0;
170}
171
172/* Must be called after clock framework is initialized */
173int __init omap_pm_if_init(void)
174{
175 return 0;
176}
diff --git a/arch/arm/mach-omap2/omap-pm.h b/arch/arm/mach-omap2/omap-pm.h
deleted file mode 100644
index 5ba5df47f91b..000000000000
--- a/arch/arm/mach-omap2/omap-pm.h
+++ /dev/null
@@ -1,161 +0,0 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * omap-pm.h - OMAP power management interface
4 *
5 * Copyright (C) 2008-2010 Texas Instruments, Inc.
6 * Copyright (C) 2008-2010 Nokia Corporation
7 * Paul Walmsley
8 *
9 * Interface developed by (in alphabetical order): Karthik Dasu, Jouni
10 * Högander, Tony Lindgren, Rajendra Nayak, Sakari Poussa,
11 * Veeramanikandan Raju, Anand Sawant, Igor Stoppa, Paul Walmsley,
12 * Richard Woodruff
13 */
14
15#ifndef ASM_ARM_ARCH_OMAP_OMAP_PM_H
16#define ASM_ARM_ARCH_OMAP_OMAP_PM_H
17
18#include <linux/device.h>
19#include <linux/cpufreq.h>
20#include <linux/clk.h>
21#include <linux/pm_opp.h>
22
23/*
24 * agent_id values for use with omap_pm_set_min_bus_tput():
25 *
26 * OCP_INITIATOR_AGENT is only valid for devices that can act as
27 * initiators -- it represents the device's L3 interconnect
28 * connection. OCP_TARGET_AGENT represents the device's L4
29 * interconnect connection.
30 */
31#define OCP_TARGET_AGENT 1
32#define OCP_INITIATOR_AGENT 2
33
34/**
35 * omap_pm_if_early_init - OMAP PM init code called before clock fw init
36 * @mpu_opp_table: array ptr to struct omap_opp for MPU
37 * @dsp_opp_table: array ptr to struct omap_opp for DSP
38 * @l3_opp_table : array ptr to struct omap_opp for CORE
39 *
40 * Initialize anything that must be configured before the clock
41 * framework starts. The "_if_" is to avoid name collisions with the
42 * PM idle-loop code.
43 */
44int __init omap_pm_if_early_init(void);
45
46/**
47 * omap_pm_if_init - OMAP PM init code called after clock fw init
48 *
49 * The main initialization code. OPP tables are passed in here. The
50 * "_if_" is to avoid name collisions with the PM idle-loop code.
51 */
52int __init omap_pm_if_init(void);
53
54/*
55 * Device-driver-originated constraints (via board-*.c files, platform_data)
56 */
57
58
59/**
60 * omap_pm_set_max_mpu_wakeup_lat - set the maximum MPU wakeup latency
61 * @dev: struct device * requesting the constraint
62 * @t: maximum MPU wakeup latency in microseconds
63 *
64 * Request that the maximum interrupt latency for the MPU to be no
65 * greater than @t microseconds. "Interrupt latency" in this case is
66 * defined as the elapsed time from the occurrence of a hardware or
67 * timer interrupt to the time when the device driver's interrupt
68 * service routine has been entered by the MPU.
69 *
70 * It is intended that underlying PM code will use this information to
71 * determine what power state to put the MPU powerdomain into, and
72 * possibly the CORE powerdomain as well, since interrupt handling
73 * code currently runs from SDRAM. Advanced PM or board*.c code may
74 * also configure interrupt controller priorities, OCP bus priorities,
75 * CPU speed(s), etc.
76 *
77 * This function will not affect device wakeup latency, e.g., time
78 * elapsed from when a device driver enables a hardware device with
79 * clk_enable(), to when the device is ready for register access or
80 * other use. To control this device wakeup latency, use
81 * omap_pm_set_max_dev_wakeup_lat()
82 *
83 * Multiple calls to omap_pm_set_max_mpu_wakeup_lat() will replace the
84 * previous t value. To remove the latency target for the MPU, call
85 * with t = -1.
86 *
87 * XXX This constraint will be deprecated soon in favor of the more
88 * general omap_pm_set_max_dev_wakeup_lat()
89 *
90 * Returns -EINVAL for an invalid argument, -ERANGE if the constraint
91 * is not satisfiable, or 0 upon success.
92 */
93int omap_pm_set_max_mpu_wakeup_lat(struct device *dev, long t);
94
95
96/**
97 * omap_pm_set_min_bus_tput - set minimum bus throughput needed by device
98 * @dev: struct device * requesting the constraint
99 * @tbus_id: interconnect to operate on (OCP_{INITIATOR,TARGET}_AGENT)
100 * @r: minimum throughput (in KiB/s)
101 *
102 * Request that the minimum data throughput on the OCP interconnect
103 * attached to device @dev interconnect agent @tbus_id be no less
104 * than @r KiB/s.
105 *
106 * It is expected that the OMAP PM or bus code will use this
107 * information to set the interconnect clock to run at the lowest
108 * possible speed that satisfies all current system users. The PM or
109 * bus code will adjust the estimate based on its model of the bus, so
110 * device driver authors should attempt to specify an accurate
111 * quantity for their device use case, and let the PM or bus code
112 * overestimate the numbers as necessary to handle request/response
113 * latency, other competing users on the system, etc. On OMAP2/3, if
114 * a driver requests a minimum L4 interconnect speed constraint, the
115 * code will also need to add an minimum L3 interconnect speed
116 * constraint,
117 *
118 * Multiple calls to omap_pm_set_min_bus_tput() will replace the
119 * previous rate value for this device. To remove the interconnect
120 * throughput restriction for this device, call with r = 0.
121 *
122 * Returns -EINVAL for an invalid argument, -ERANGE if the constraint
123 * is not satisfiable, or 0 upon success.
124 */
125int omap_pm_set_min_bus_tput(struct device *dev, u8 agent_id, unsigned long r);
126
127
128/*
129 * CPUFreq-originated constraint
130 *
131 * In the future, this should be handled by custom OPP clocktype
132 * functions.
133 */
134
135
136/*
137 * Device context loss tracking
138 */
139
140/**
141 * omap_pm_get_dev_context_loss_count - return count of times dev has lost ctx
142 * @dev: struct device *
143 *
144 * This function returns the number of times that the device @dev has
145 * lost its internal context. This generally occurs on a powerdomain
146 * transition to OFF. Drivers use this as an optimization to avoid restoring
147 * context if the device hasn't lost it. To use, drivers should initially
148 * call this in their context save functions and store the result. Early in
149 * the driver's context restore function, the driver should call this function
150 * again, and compare the result to the stored counter. If they differ, the
151 * driver must restore device context. If the number of context losses
152 * exceeds the maximum positive integer, the function will wrap to 0 and
153 * continue counting. Returns the number of context losses for this device,
154 * or negative value upon error.
155 */
156int omap_pm_get_dev_context_loss_count(struct device *dev);
157
158void omap_pm_enable_off_mode(void);
159void omap_pm_disable_off_mode(void);
160
161#endif
diff --git a/arch/arm/mach-omap2/omap_device.c b/arch/arm/mach-omap2/omap_device.c
index 3b829a50d1db..ac219b9e6a4c 100644
--- a/arch/arm/mach-omap2/omap_device.c
+++ b/arch/arm/mach-omap2/omap_device.c
@@ -143,7 +143,7 @@ static int omap_device_build_from_dt(struct platform_device *pdev)
143 struct resource res; 143 struct resource res;
144 const char *oh_name; 144 const char *oh_name;
145 int oh_cnt, i, ret = 0; 145 int oh_cnt, i, ret = 0;
146 bool device_active = false; 146 bool device_active = false, skip_pm_domain = false;
147 147
148 oh_cnt = of_property_count_strings(node, "ti,hwmods"); 148 oh_cnt = of_property_count_strings(node, "ti,hwmods");
149 if (oh_cnt <= 0) { 149 if (oh_cnt <= 0) {
@@ -151,8 +151,15 @@ static int omap_device_build_from_dt(struct platform_device *pdev)
151 return -ENODEV; 151 return -ENODEV;
152 } 152 }
153 153
154 /* SDMA still needs special handling for omap_device_build() */
155 ret = of_property_read_string_index(node, "ti,hwmods", 0, &oh_name);
156 if (!ret && (!strncmp("dma_system", oh_name, 10) ||
157 !strncmp("dma", oh_name, 3)))
158 skip_pm_domain = true;
159
154 /* Use ti-sysc driver instead of omap_device? */ 160 /* Use ti-sysc driver instead of omap_device? */
155 if (!omap_hwmod_parse_module_range(NULL, node, &res)) 161 if (!skip_pm_domain &&
162 !omap_hwmod_parse_module_range(NULL, node, &res))
156 return -ENODEV; 163 return -ENODEV;
157 164
158 hwmods = kzalloc(sizeof(struct omap_hwmod *) * oh_cnt, GFP_KERNEL); 165 hwmods = kzalloc(sizeof(struct omap_hwmod *) * oh_cnt, GFP_KERNEL);
@@ -191,11 +198,12 @@ static int omap_device_build_from_dt(struct platform_device *pdev)
191 r->name = dev_name(&pdev->dev); 198 r->name = dev_name(&pdev->dev);
192 } 199 }
193 200
194 dev_pm_domain_set(&pdev->dev, &omap_device_pm_domain); 201 if (!skip_pm_domain) {
195 202 dev_pm_domain_set(&pdev->dev, &omap_device_pm_domain);
196 if (device_active) { 203 if (device_active) {
197 omap_device_enable(pdev); 204 omap_device_enable(pdev);
198 pm_runtime_set_active(&pdev->dev); 205 pm_runtime_set_active(&pdev->dev);
206 }
199 } 207 }
200 208
201odbfd_exit1: 209odbfd_exit1:
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index e7d23e200ecc..2ceffd85dd3d 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -481,7 +481,7 @@ static int _wait_softreset_complete(struct omap_hwmod *oh)
481 481
482 sysc = oh->class->sysc; 482 sysc = oh->class->sysc;
483 483
484 if (sysc->sysc_flags & SYSS_HAS_RESET_STATUS) 484 if (sysc->sysc_flags & SYSS_HAS_RESET_STATUS && sysc->syss_offs > 0)
485 omap_test_timeout((omap_hwmod_read(oh, sysc->syss_offs) 485 omap_test_timeout((omap_hwmod_read(oh, sysc->syss_offs)
486 & SYSS_RESETDONE_MASK), 486 & SYSS_RESETDONE_MASK),
487 MAX_MODULE_SOFTRESET_WAIT, c); 487 MAX_MODULE_SOFTRESET_WAIT, c);
@@ -3171,19 +3171,19 @@ static int omap_hwmod_init_regbits(struct device *dev,
3171 */ 3171 */
3172int omap_hwmod_init_reg_offs(struct device *dev, 3172int omap_hwmod_init_reg_offs(struct device *dev,
3173 const struct ti_sysc_module_data *data, 3173 const struct ti_sysc_module_data *data,
3174 u32 *rev_offs, u32 *sysc_offs, u32 *syss_offs) 3174 s32 *rev_offs, s32 *sysc_offs, s32 *syss_offs)
3175{ 3175{
3176 *rev_offs = 0; 3176 *rev_offs = -ENODEV;
3177 *sysc_offs = 0; 3177 *sysc_offs = 0;
3178 *syss_offs = 0; 3178 *syss_offs = 0;
3179 3179
3180 if (data->offsets[SYSC_REVISION] > 0) 3180 if (data->offsets[SYSC_REVISION] >= 0)
3181 *rev_offs = data->offsets[SYSC_REVISION]; 3181 *rev_offs = data->offsets[SYSC_REVISION];
3182 3182
3183 if (data->offsets[SYSC_SYSCONFIG] > 0) 3183 if (data->offsets[SYSC_SYSCONFIG] >= 0)
3184 *sysc_offs = data->offsets[SYSC_SYSCONFIG]; 3184 *sysc_offs = data->offsets[SYSC_SYSCONFIG];
3185 3185
3186 if (data->offsets[SYSC_SYSSTATUS] > 0) 3186 if (data->offsets[SYSC_SYSSTATUS] >= 0)
3187 *syss_offs = data->offsets[SYSC_SYSSTATUS]; 3187 *syss_offs = data->offsets[SYSC_SYSSTATUS];
3188 3188
3189 return 0; 3189 return 0;
@@ -3312,8 +3312,8 @@ static int omap_hwmod_check_module(struct device *dev,
3312 struct omap_hwmod *oh, 3312 struct omap_hwmod *oh,
3313 const struct ti_sysc_module_data *data, 3313 const struct ti_sysc_module_data *data,
3314 struct sysc_regbits *sysc_fields, 3314 struct sysc_regbits *sysc_fields,
3315 u32 rev_offs, u32 sysc_offs, 3315 s32 rev_offs, s32 sysc_offs,
3316 u32 syss_offs, u32 sysc_flags, 3316 s32 syss_offs, u32 sysc_flags,
3317 u32 idlemodes) 3317 u32 idlemodes)
3318{ 3318{
3319 if (!oh->class->sysc) 3319 if (!oh->class->sysc)
@@ -3365,7 +3365,7 @@ static int omap_hwmod_check_module(struct device *dev,
3365int omap_hwmod_allocate_module(struct device *dev, struct omap_hwmod *oh, 3365int omap_hwmod_allocate_module(struct device *dev, struct omap_hwmod *oh,
3366 const struct ti_sysc_module_data *data, 3366 const struct ti_sysc_module_data *data,
3367 struct sysc_regbits *sysc_fields, 3367 struct sysc_regbits *sysc_fields,
3368 u32 rev_offs, u32 sysc_offs, u32 syss_offs, 3368 s32 rev_offs, s32 sysc_offs, s32 syss_offs,
3369 u32 sysc_flags, u32 idlemodes) 3369 u32 sysc_flags, u32 idlemodes)
3370{ 3370{
3371 struct omap_hwmod_class_sysconfig *sysc; 3371 struct omap_hwmod_class_sysconfig *sysc;
@@ -3425,7 +3425,8 @@ int omap_hwmod_init_module(struct device *dev,
3425{ 3425{
3426 struct omap_hwmod *oh; 3426 struct omap_hwmod *oh;
3427 struct sysc_regbits *sysc_fields; 3427 struct sysc_regbits *sysc_fields;
3428 u32 rev_offs, sysc_offs, syss_offs, sysc_flags, idlemodes; 3428 s32 rev_offs, sysc_offs, syss_offs;
3429 u32 sysc_flags, idlemodes;
3429 int error; 3430 int error;
3430 3431
3431 if (!dev || !data) 3432 if (!dev || !data)
diff --git a/arch/arm/mach-omap2/omap_hwmod.h b/arch/arm/mach-omap2/omap_hwmod.h
index c7122abbf977..b70cdc21f8a2 100644
--- a/arch/arm/mach-omap2/omap_hwmod.h
+++ b/arch/arm/mach-omap2/omap_hwmod.h
@@ -317,9 +317,9 @@ struct omap_hwmod_ocp_if {
317 * then this field has to be populated with the correct offset structure. 317 * then this field has to be populated with the correct offset structure.
318 */ 318 */
319struct omap_hwmod_class_sysconfig { 319struct omap_hwmod_class_sysconfig {
320 u32 rev_offs; 320 s32 rev_offs;
321 u32 sysc_offs; 321 s32 sysc_offs;
322 u32 syss_offs; 322 s32 syss_offs;
323 u16 sysc_flags; 323 u16 sysc_flags;
324 struct sysc_regbits *sysc_fields; 324 struct sysc_regbits *sysc_fields;
325 u8 srst_udelay; 325 u8 srst_udelay;
diff --git a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
index 5efe91c6e95b..9ded7bf972e7 100644
--- a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
@@ -629,6 +629,7 @@ struct omap_hwmod am33xx_gpmc_hwmod = {
629 629
630/* 'i2c' class */ 630/* 'i2c' class */
631static struct omap_hwmod_class_sysconfig am33xx_i2c_sysc = { 631static struct omap_hwmod_class_sysconfig am33xx_i2c_sysc = {
632 .rev_offs = 0,
632 .sysc_offs = 0x0010, 633 .sysc_offs = 0x0010,
633 .syss_offs = 0x0090, 634 .syss_offs = 0x0090,
634 .sysc_flags = (SYSC_HAS_AUTOIDLE | SYSC_HAS_CLOCKACTIVITY | 635 .sysc_flags = (SYSC_HAS_AUTOIDLE | SYSC_HAS_CLOCKACTIVITY |
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
index 23336b6c7125..d93f9ea4119e 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -885,6 +885,7 @@ static struct omap_hwmod omap3xxx_dma_system_hwmod = {
885 */ 885 */
886 886
887static struct omap_hwmod_class_sysconfig omap3xxx_mcbsp_sysc = { 887static struct omap_hwmod_class_sysconfig omap3xxx_mcbsp_sysc = {
888 .rev_offs = -ENODEV,
888 .sysc_offs = 0x008c, 889 .sysc_offs = 0x008c,
889 .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_ENAWAKEUP | 890 .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_ENAWAKEUP |
890 SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET), 891 SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET),
@@ -990,6 +991,7 @@ static struct omap_hwmod omap3xxx_mcbsp5_hwmod = {
990 991
991/* 'mcbsp sidetone' class */ 992/* 'mcbsp sidetone' class */
992static struct omap_hwmod_class_sysconfig omap3xxx_mcbsp_sidetone_sysc = { 993static struct omap_hwmod_class_sysconfig omap3xxx_mcbsp_sidetone_sysc = {
994 .rev_offs = -ENODEV,
993 .sysc_offs = 0x0010, 995 .sysc_offs = 0x0010,
994 .sysc_flags = SYSC_HAS_AUTOIDLE, 996 .sysc_flags = SYSC_HAS_AUTOIDLE,
995 .sysc_fields = &omap_hwmod_sysc_type1, 997 .sysc_fields = &omap_hwmod_sysc_type1,
@@ -1018,6 +1020,7 @@ static struct omap_hwmod omap3xxx_mcbsp3_sidetone_hwmod = {
1018 1020
1019/* SR common */ 1021/* SR common */
1020static struct omap_hwmod_class_sysconfig omap34xx_sr_sysc = { 1022static struct omap_hwmod_class_sysconfig omap34xx_sr_sysc = {
1023 .rev_offs = -ENODEV,
1021 .sysc_offs = 0x24, 1024 .sysc_offs = 0x24,
1022 .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_NO_CACHE), 1025 .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_NO_CACHE),
1023 .sysc_fields = &omap34xx_sr_sysc_fields, 1026 .sysc_fields = &omap34xx_sr_sysc_fields,
@@ -1030,6 +1033,7 @@ static struct omap_hwmod_class omap34xx_smartreflex_hwmod_class = {
1030}; 1033};
1031 1034
1032static struct omap_hwmod_class_sysconfig omap36xx_sr_sysc = { 1035static struct omap_hwmod_class_sysconfig omap36xx_sr_sysc = {
1036 .rev_offs = -ENODEV,
1033 .sysc_offs = 0x38, 1037 .sysc_offs = 0x38,
1034 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART), 1038 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
1035 .sysc_flags = (SYSC_HAS_SIDLEMODE | SYSC_HAS_ENAWAKEUP | 1039 .sysc_flags = (SYSC_HAS_SIDLEMODE | SYSC_HAS_ENAWAKEUP |
diff --git a/arch/arm/mach-omap2/omap_hwmod_43xx_data.c b/arch/arm/mach-omap2/omap_hwmod_43xx_data.c
index 5f73b730d4fc..aa271ac5ebac 100644
--- a/arch/arm/mach-omap2/omap_hwmod_43xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_43xx_data.c
@@ -378,6 +378,7 @@ static struct omap_hwmod am43xx_usb_otg_ss1_hwmod = {
378}; 378};
379 379
380static struct omap_hwmod_class_sysconfig am43xx_qspi_sysc = { 380static struct omap_hwmod_class_sysconfig am43xx_qspi_sysc = {
381 .rev_offs = 0,
381 .sysc_offs = 0x0010, 382 .sysc_offs = 0x0010,
382 .sysc_flags = SYSC_HAS_SIDLEMODE, 383 .sysc_flags = SYSC_HAS_SIDLEMODE,
383 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART | 384 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index e4f8ae9cd637..234ee0eec815 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -1360,6 +1360,7 @@ static struct omap_hwmod omap44xx_hsi_hwmod = {
1360 */ 1360 */
1361 1361
1362static struct omap_hwmod_class_sysconfig omap44xx_i2c_sysc = { 1362static struct omap_hwmod_class_sysconfig omap44xx_i2c_sysc = {
1363 .rev_offs = 0,
1363 .sysc_offs = 0x0010, 1364 .sysc_offs = 0x0010,
1364 .syss_offs = 0x0090, 1365 .syss_offs = 0x0090,
1365 .sysc_flags = (SYSC_HAS_AUTOIDLE | SYSC_HAS_CLOCKACTIVITY | 1366 .sysc_flags = (SYSC_HAS_AUTOIDLE | SYSC_HAS_CLOCKACTIVITY |
@@ -1634,6 +1635,7 @@ static struct omap_hwmod omap44xx_mailbox_hwmod = {
1634 1635
1635/* The IP is not compliant to type1 / type2 scheme */ 1636/* The IP is not compliant to type1 / type2 scheme */
1636static struct omap_hwmod_class_sysconfig omap44xx_mcasp_sysc = { 1637static struct omap_hwmod_class_sysconfig omap44xx_mcasp_sysc = {
1638 .rev_offs = 0,
1637 .sysc_offs = 0x0004, 1639 .sysc_offs = 0x0004,
1638 .sysc_flags = SYSC_HAS_SIDLEMODE, 1640 .sysc_flags = SYSC_HAS_SIDLEMODE,
1639 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART | 1641 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
@@ -1667,6 +1669,7 @@ static struct omap_hwmod omap44xx_mcasp_hwmod = {
1667 */ 1669 */
1668 1670
1669static struct omap_hwmod_class_sysconfig omap44xx_mcbsp_sysc = { 1671static struct omap_hwmod_class_sysconfig omap44xx_mcbsp_sysc = {
1672 .rev_offs = -ENODEV,
1670 .sysc_offs = 0x008c, 1673 .sysc_offs = 0x008c,
1671 .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_ENAWAKEUP | 1674 .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_ENAWAKEUP |
1672 SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET), 1675 SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET),
@@ -2353,6 +2356,7 @@ static struct omap_hwmod omap44xx_slimbus2_hwmod = {
2353 2356
2354/* The IP is not compliant to type1 / type2 scheme */ 2357/* The IP is not compliant to type1 / type2 scheme */
2355static struct omap_hwmod_class_sysconfig omap44xx_smartreflex_sysc = { 2358static struct omap_hwmod_class_sysconfig omap44xx_smartreflex_sysc = {
2359 .rev_offs = -ENODEV,
2356 .sysc_offs = 0x0038, 2360 .sysc_offs = 0x0038,
2357 .sysc_flags = (SYSC_HAS_ENAWAKEUP | SYSC_HAS_SIDLEMODE), 2361 .sysc_flags = (SYSC_HAS_ENAWAKEUP | SYSC_HAS_SIDLEMODE),
2358 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART | 2362 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
diff --git a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c
index c72cd84b07ec..887a30fa775b 100644
--- a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c
@@ -804,6 +804,7 @@ static struct omap_hwmod omap54xx_gpio8_hwmod = {
804 */ 804 */
805 805
806static struct omap_hwmod_class_sysconfig omap54xx_i2c_sysc = { 806static struct omap_hwmod_class_sysconfig omap54xx_i2c_sysc = {
807 .rev_offs = 0,
807 .sysc_offs = 0x0010, 808 .sysc_offs = 0x0010,
808 .syss_offs = 0x0090, 809 .syss_offs = 0x0090,
809 .sysc_flags = (SYSC_HAS_AUTOIDLE | SYSC_HAS_CLOCKACTIVITY | 810 .sysc_flags = (SYSC_HAS_AUTOIDLE | SYSC_HAS_CLOCKACTIVITY |
@@ -974,6 +975,7 @@ static struct omap_hwmod omap54xx_mailbox_hwmod = {
974 */ 975 */
975 976
976static struct omap_hwmod_class_sysconfig omap54xx_mcbsp_sysc = { 977static struct omap_hwmod_class_sysconfig omap54xx_mcbsp_sysc = {
978 .rev_offs = -ENODEV,
977 .sysc_offs = 0x008c, 979 .sysc_offs = 0x008c,
978 .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_ENAWAKEUP | 980 .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_ENAWAKEUP |
979 SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET), 981 SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET),
@@ -1997,6 +1999,7 @@ static struct omap_hwmod omap54xx_ocp2scp3_hwmod = {
1997 */ 1999 */
1998 2000
1999static struct omap_hwmod_class_sysconfig omap54xx_sata_sysc = { 2001static struct omap_hwmod_class_sysconfig omap54xx_sata_sysc = {
2002 .rev_offs = 0x00fc,
2000 .sysc_offs = 0x0000, 2003 .sysc_offs = 0x0000,
2001 .sysc_flags = (SYSC_HAS_MIDLEMODE | SYSC_HAS_SIDLEMODE), 2004 .sysc_flags = (SYSC_HAS_MIDLEMODE | SYSC_HAS_SIDLEMODE),
2002 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART | 2005 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
diff --git a/arch/arm/mach-omap2/omap_hwmod_7xx_data.c b/arch/arm/mach-omap2/omap_hwmod_7xx_data.c
index 62352d1e6361..a27c2fed298c 100644
--- a/arch/arm/mach-omap2/omap_hwmod_7xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_7xx_data.c
@@ -1070,6 +1070,7 @@ static struct omap_hwmod dra7xx_hdq1w_hwmod = {
1070 */ 1070 */
1071 1071
1072static struct omap_hwmod_class_sysconfig dra7xx_i2c_sysc = { 1072static struct omap_hwmod_class_sysconfig dra7xx_i2c_sysc = {
1073 .rev_offs = 0,
1073 .sysc_offs = 0x0010, 1074 .sysc_offs = 0x0010,
1074 .syss_offs = 0x0090, 1075 .syss_offs = 0x0090,
1075 .sysc_flags = (SYSC_HAS_AUTOIDLE | SYSC_HAS_CLOCKACTIVITY | 1076 .sysc_flags = (SYSC_HAS_AUTOIDLE | SYSC_HAS_CLOCKACTIVITY |
@@ -1440,6 +1441,7 @@ static struct omap_hwmod dra7xx_mcspi4_hwmod = {
1440 * 1441 *
1441 */ 1442 */
1442static struct omap_hwmod_class_sysconfig dra7xx_mcasp_sysc = { 1443static struct omap_hwmod_class_sysconfig dra7xx_mcasp_sysc = {
1444 .rev_offs = 0,
1443 .sysc_offs = 0x0004, 1445 .sysc_offs = 0x0004,
1444 .sysc_flags = SYSC_HAS_SIDLEMODE, 1446 .sysc_flags = SYSC_HAS_SIDLEMODE,
1445 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART), 1447 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
@@ -1898,6 +1900,7 @@ static struct omap_hwmod dra7xx_pciess2_hwmod = {
1898 */ 1900 */
1899 1901
1900static struct omap_hwmod_class_sysconfig dra7xx_qspi_sysc = { 1902static struct omap_hwmod_class_sysconfig dra7xx_qspi_sysc = {
1903 .rev_offs = 0,
1901 .sysc_offs = 0x0010, 1904 .sysc_offs = 0x0010,
1902 .sysc_flags = SYSC_HAS_SIDLEMODE, 1905 .sysc_flags = SYSC_HAS_SIDLEMODE,
1903 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART | 1906 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
@@ -1930,6 +1933,7 @@ static struct omap_hwmod dra7xx_qspi_hwmod = {
1930 * 1933 *
1931 */ 1934 */
1932static struct omap_hwmod_class_sysconfig dra7xx_rtcss_sysc = { 1935static struct omap_hwmod_class_sysconfig dra7xx_rtcss_sysc = {
1936 .rev_offs = 0x0074,
1933 .sysc_offs = 0x0078, 1937 .sysc_offs = 0x0078,
1934 .sysc_flags = SYSC_HAS_SIDLEMODE, 1938 .sysc_flags = SYSC_HAS_SIDLEMODE,
1935 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART | 1939 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
@@ -1965,6 +1969,7 @@ static struct omap_hwmod dra7xx_rtcss_hwmod = {
1965 */ 1969 */
1966 1970
1967static struct omap_hwmod_class_sysconfig dra7xx_sata_sysc = { 1971static struct omap_hwmod_class_sysconfig dra7xx_sata_sysc = {
1972 .rev_offs = 0x00fc,
1968 .sysc_offs = 0x0000, 1973 .sysc_offs = 0x0000,
1969 .sysc_flags = (SYSC_HAS_MIDLEMODE | SYSC_HAS_SIDLEMODE), 1974 .sysc_flags = (SYSC_HAS_MIDLEMODE | SYSC_HAS_SIDLEMODE),
1970 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART | 1975 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
@@ -2003,6 +2008,7 @@ static struct omap_hwmod dra7xx_sata_hwmod = {
2003 2008
2004/* The IP is not compliant to type1 / type2 scheme */ 2009/* The IP is not compliant to type1 / type2 scheme */
2005static struct omap_hwmod_class_sysconfig dra7xx_smartreflex_sysc = { 2010static struct omap_hwmod_class_sysconfig dra7xx_smartreflex_sysc = {
2011 .rev_offs = -ENODEV,
2006 .sysc_offs = 0x0038, 2012 .sysc_offs = 0x0038,
2007 .sysc_flags = (SYSC_HAS_ENAWAKEUP | SYSC_HAS_SIDLEMODE), 2013 .sysc_flags = (SYSC_HAS_ENAWAKEUP | SYSC_HAS_SIDLEMODE),
2008 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART | 2014 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
diff --git a/arch/arm/mach-omap2/omap_hwmod_81xx_data.c b/arch/arm/mach-omap2/omap_hwmod_81xx_data.c
index 686655f884c1..8e44e2728620 100644
--- a/arch/arm/mach-omap2/omap_hwmod_81xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_81xx_data.c
@@ -954,6 +954,7 @@ static struct omap_hwmod_ocp_if dm816x_l4_hs__emac1 = {
954}; 954};
955 955
956static struct omap_hwmod_class_sysconfig dm81xx_sata_sysc = { 956static struct omap_hwmod_class_sysconfig dm81xx_sata_sysc = {
957 .rev_offs = 0x00fc,
957 .sysc_offs = 0x1100, 958 .sysc_offs = 0x1100,
958 .sysc_flags = SYSC_HAS_SIDLEMODE, 959 .sysc_flags = SYSC_HAS_SIDLEMODE,
959 .idlemodes = SIDLE_FORCE, 960 .idlemodes = SIDLE_FORCE,
diff --git a/arch/arm/mach-omap2/pdata-quirks.c b/arch/arm/mach-omap2/pdata-quirks.c
index 6459816c2879..7f02743edbe4 100644
--- a/arch/arm/mach-omap2/pdata-quirks.c
+++ b/arch/arm/mach-omap2/pdata-quirks.c
@@ -26,14 +26,12 @@
26#include <linux/platform_data/iommu-omap.h> 26#include <linux/platform_data/iommu-omap.h>
27#include <linux/platform_data/ti-sysc.h> 27#include <linux/platform_data/ti-sysc.h>
28#include <linux/platform_data/wkup_m3.h> 28#include <linux/platform_data/wkup_m3.h>
29#include <linux/platform_data/media/ir-rx51.h>
30#include <linux/platform_data/asoc-ti-mcbsp.h> 29#include <linux/platform_data/asoc-ti-mcbsp.h>
31 30
32#include "common.h" 31#include "common.h"
33#include "common-board-devices.h" 32#include "common-board-devices.h"
34#include "control.h" 33#include "control.h"
35#include "omap_device.h" 34#include "omap_device.h"
36#include "omap-pm.h"
37#include "omap-secure.h" 35#include "omap-secure.h"
38#include "soc.h" 36#include "soc.h"
39#include "hsmmc.h" 37#include "hsmmc.h"
@@ -514,18 +512,6 @@ void omap_auxdata_legacy_init(struct device *dev)
514 dev->platform_data = &twl_gpio_auxdata; 512 dev->platform_data = &twl_gpio_auxdata;
515} 513}
516 514
517static struct ir_rx51_platform_data __maybe_unused rx51_ir_data = {
518 .set_max_mpu_wakeup_lat = omap_pm_set_max_mpu_wakeup_lat,
519};
520
521static struct platform_device __maybe_unused rx51_ir_device = {
522 .name = "ir_rx51",
523 .id = -1,
524 .dev = {
525 .platform_data = &rx51_ir_data,
526 },
527};
528
529#if IS_ENABLED(CONFIG_SND_OMAP_SOC_MCBSP) 515#if IS_ENABLED(CONFIG_SND_OMAP_SOC_MCBSP)
530static struct omap_mcbsp_platform_data mcbsp_pdata; 516static struct omap_mcbsp_platform_data mcbsp_pdata;
531static void __init omap3_mcbsp_init(void) 517static void __init omap3_mcbsp_init(void)
@@ -569,7 +555,6 @@ static struct of_dev_auxdata omap_auxdata_lookup[] = {
569 "480c9000.smartreflex", &omap_sr_pdata[OMAP_SR_MPU]), 555 "480c9000.smartreflex", &omap_sr_pdata[OMAP_SR_MPU]),
570 OF_DEV_AUXDATA("ti,omap3-hsmmc", 0x4809c000, "4809c000.mmc", &mmc_pdata[0]), 556 OF_DEV_AUXDATA("ti,omap3-hsmmc", 0x4809c000, "4809c000.mmc", &mmc_pdata[0]),
571 OF_DEV_AUXDATA("ti,omap3-hsmmc", 0x480b4000, "480b4000.mmc", &mmc_pdata[1]), 557 OF_DEV_AUXDATA("ti,omap3-hsmmc", 0x480b4000, "480b4000.mmc", &mmc_pdata[1]),
572 OF_DEV_AUXDATA("nokia,n900-ir", 0, "n900-ir", &rx51_ir_data),
573 /* Only on am3517 */ 558 /* Only on am3517 */
574 OF_DEV_AUXDATA("ti,davinci_mdio", 0x5c030000, "davinci_mdio.0", NULL), 559 OF_DEV_AUXDATA("ti,davinci_mdio", 0x5c030000, "davinci_mdio.0", NULL),
575 OF_DEV_AUXDATA("ti,am3517-emac", 0x5c000000, "davinci_emac.0", 560 OF_DEV_AUXDATA("ti,am3517-emac", 0x5c000000, "davinci_emac.0",
diff --git a/arch/arm/mach-omap2/pm-debug.c b/arch/arm/mach-omap2/pm-debug.c
index 5c46ea6756d7..acb698d5780f 100644
--- a/arch/arm/mach-omap2/pm-debug.c
+++ b/arch/arm/mach-omap2/pm-debug.c
@@ -31,7 +31,6 @@
31#include "clock.h" 31#include "clock.h"
32#include "powerdomain.h" 32#include "powerdomain.h"
33#include "clockdomain.h" 33#include "clockdomain.h"
34#include "omap-pm.h"
35 34
36#include "soc.h" 35#include "soc.h"
37#include "cm2xxx_3xxx.h" 36#include "cm2xxx_3xxx.h"
@@ -240,10 +239,6 @@ static int option_set(void *data, u64 val)
240 *option = val; 239 *option = val;
241 240
242 if (option == &enable_off_mode) { 241 if (option == &enable_off_mode) {
243 if (val)
244 omap_pm_enable_off_mode();
245 else
246 omap_pm_disable_off_mode();
247 if (cpu_is_omap34xx()) 242 if (cpu_is_omap34xx())
248 omap3_pm_off_mode_enable(val); 243 omap3_pm_off_mode_enable(val);
249 } 244 }
diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
index 6f68576e5695..ca03af8fe43f 100644
--- a/arch/arm/mach-omap2/pm.c
+++ b/arch/arm/mach-omap2/pm.c
@@ -16,11 +16,11 @@
16#include <linux/pm_opp.h> 16#include <linux/pm_opp.h>
17#include <linux/export.h> 17#include <linux/export.h>
18#include <linux/suspend.h> 18#include <linux/suspend.h>
19#include <linux/clk.h>
19#include <linux/cpu.h> 20#include <linux/cpu.h>
20 21
21#include <asm/system_misc.h> 22#include <asm/system_misc.h>
22 23
23#include "omap-pm.h"
24#include "omap_device.h" 24#include "omap_device.h"
25#include "common.h" 25#include "common.h"
26 26
@@ -230,16 +230,20 @@ static void __init omap4_init_voltages(void)
230 omap2_set_init_voltage("iva", "dpll_iva_m5x2_ck", "iva"); 230 omap2_set_init_voltage("iva", "dpll_iva_m5x2_ck", "iva");
231} 231}
232 232
233static int __init omap2_common_pm_init(void) 233int __maybe_unused omap_pm_nop_init(void)
234{ 234{
235 omap_pm_if_init();
236
237 return 0; 235 return 0;
238} 236}
239omap_postcore_initcall(omap2_common_pm_init); 237
238int (*omap_pm_soc_init)(void);
240 239
241int __init omap2_common_pm_late_init(void) 240int __init omap2_common_pm_late_init(void)
242{ 241{
242 int error;
243
244 if (!omap_pm_soc_init)
245 return 0;
246
243 /* Init the voltage layer */ 247 /* Init the voltage layer */
244 omap3_twl_init(); 248 omap3_twl_init();
245 omap4_twl_init(); 249 omap4_twl_init();
@@ -252,5 +256,12 @@ int __init omap2_common_pm_late_init(void)
252 /* Smartreflex device init */ 256 /* Smartreflex device init */
253 omap_devinit_smartreflex(); 257 omap_devinit_smartreflex();
254 258
259 error = omap_pm_soc_init();
260 if (error)
261 pr_warn("%s: pm soc init failed: %i\n", __func__, error);
262
263 omap2_clk_enable_autoidle_all();
264
255 return 0; 265 return 0;
256} 266}
267omap_late_initcall(omap2_common_pm_late_init);
diff --git a/arch/arm/mach-omap2/pm33xx-core.c b/arch/arm/mach-omap2/pm33xx-core.c
index 93c0b5ba9f09..9b3755a2e2ec 100644
--- a/arch/arm/mach-omap2/pm33xx-core.c
+++ b/arch/arm/mach-omap2/pm33xx-core.c
@@ -173,7 +173,7 @@ static struct am33xx_pm_platform_data *am33xx_pm_get_pdata(void)
173 return NULL; 173 return NULL;
174} 174}
175 175
176void __init amx3_common_pm_init(void) 176int __init amx3_common_pm_init(void)
177{ 177{
178 struct am33xx_pm_platform_data *pdata; 178 struct am33xx_pm_platform_data *pdata;
179 struct platform_device_info devinfo; 179 struct platform_device_info devinfo;
@@ -186,4 +186,6 @@ void __init amx3_common_pm_init(void)
186 devinfo.size_data = sizeof(*pdata); 186 devinfo.size_data = sizeof(*pdata);
187 devinfo.id = -1; 187 devinfo.id = -1;
188 platform_device_register_full(&devinfo); 188 platform_device_register_full(&devinfo);
189
190 return 0;
189} 191}
diff --git a/arch/arm/mach-omap2/pm44xx.c b/arch/arm/mach-omap2/pm44xx.c
index b3870220612e..78e1ace7d17d 100644
--- a/arch/arm/mach-omap2/pm44xx.c
+++ b/arch/arm/mach-omap2/pm44xx.c
@@ -131,6 +131,19 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm, void *unused)
131 return 0; 131 return 0;
132 } 132 }
133 133
134 /*
135 * Bootloader or kexec boot may have LOGICRETSTATE cleared
136 * for some domains. This is the case when kexec booting from
137 * Android kernels that support off mode for example.
138 * Make sure it's set at least for core and per, otherwise
139 * we currently will see lost GPIO interrupts for wlcore and
140 * smsc911x at least if per hits retention during idle.
141 */
142 if (!strncmp(pwrdm->name, "core", 4) ||
143 !strncmp(pwrdm->name, "l4per", 5) ||
144 !strncmp(pwrdm->name, "wkup", 4))
145 pwrdm_set_logic_retst(pwrdm, PWRDM_POWER_RET);
146
134 pwrst = kmalloc(sizeof(struct power_state), GFP_ATOMIC); 147 pwrst = kmalloc(sizeof(struct power_state), GFP_ATOMIC);
135 if (!pwrst) 148 if (!pwrst)
136 return -ENOMEM; 149 return -ENOMEM;
diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c
index 1e6a967cd2d5..1a0f69c0a376 100644
--- a/arch/arm/mach-omap2/powerdomain.c
+++ b/arch/arm/mach-omap2/powerdomain.c
@@ -14,6 +14,7 @@
14 */ 14 */
15#undef DEBUG 15#undef DEBUG
16 16
17#include <linux/cpu_pm.h>
17#include <linux/kernel.h> 18#include <linux/kernel.h>
18#include <linux/types.h> 19#include <linux/types.h>
19#include <linux/list.h> 20#include <linux/list.h>
@@ -39,6 +40,9 @@
39 40
40#define PWRDM_TRACE_STATES_FLAG (1<<31) 41#define PWRDM_TRACE_STATES_FLAG (1<<31)
41 42
43void pwrdms_save_context(void);
44void pwrdms_restore_context(void);
45
42enum { 46enum {
43 PWRDM_STATE_NOW = 0, 47 PWRDM_STATE_NOW = 0,
44 PWRDM_STATE_PREV, 48 PWRDM_STATE_PREV,
@@ -333,6 +337,22 @@ int pwrdm_register_pwrdms(struct powerdomain **ps)
333 return 0; 337 return 0;
334} 338}
335 339
340static int cpu_notifier(struct notifier_block *nb, unsigned long cmd, void *v)
341{
342 switch (cmd) {
343 case CPU_CLUSTER_PM_ENTER:
344 if (enable_off_mode)
345 pwrdms_save_context();
346 break;
347 case CPU_CLUSTER_PM_EXIT:
348 if (enable_off_mode)
349 pwrdms_restore_context();
350 break;
351 }
352
353 return NOTIFY_OK;
354}
355
336/** 356/**
337 * pwrdm_complete_init - set up the powerdomain layer 357 * pwrdm_complete_init - set up the powerdomain layer
338 * 358 *
@@ -347,6 +367,7 @@ int pwrdm_register_pwrdms(struct powerdomain **ps)
347int pwrdm_complete_init(void) 367int pwrdm_complete_init(void)
348{ 368{
349 struct powerdomain *temp_p; 369 struct powerdomain *temp_p;
370 static struct notifier_block nb;
350 371
351 if (list_empty(&pwrdm_list)) 372 if (list_empty(&pwrdm_list))
352 return -EACCES; 373 return -EACCES;
@@ -354,6 +375,12 @@ int pwrdm_complete_init(void)
354 list_for_each_entry(temp_p, &pwrdm_list, node) 375 list_for_each_entry(temp_p, &pwrdm_list, node)
355 pwrdm_set_next_pwrst(temp_p, PWRDM_POWER_ON); 376 pwrdm_set_next_pwrst(temp_p, PWRDM_POWER_ON);
356 377
378 /* Only AM43XX can lose pwrdm context during rtc-ddr suspend */
379 if (soc_is_am43xx()) {
380 nb.notifier_call = cpu_notifier;
381 cpu_pm_register_notifier(&nb);
382 }
383
357 return 0; 384 return 0;
358} 385}
359 386
@@ -1199,3 +1226,63 @@ bool pwrdm_can_ever_lose_context(struct powerdomain *pwrdm)
1199 1226
1200 return 0; 1227 return 0;
1201} 1228}
1229
1230/**
1231 * pwrdm_save_context - save powerdomain registers
1232 *
1233 * Register state is going to be lost due to a suspend or hibernate
1234 * event. Save the powerdomain registers.
1235 */
1236static int pwrdm_save_context(struct powerdomain *pwrdm, void *unused)
1237{
1238 if (arch_pwrdm && arch_pwrdm->pwrdm_save_context)
1239 arch_pwrdm->pwrdm_save_context(pwrdm);
1240 return 0;
1241}
1242
1243/**
1244 * pwrdm_save_context - restore powerdomain registers
1245 *
1246 * Restore powerdomain control registers after a suspend or resume
1247 * event.
1248 */
1249static int pwrdm_restore_context(struct powerdomain *pwrdm, void *unused)
1250{
1251 if (arch_pwrdm && arch_pwrdm->pwrdm_restore_context)
1252 arch_pwrdm->pwrdm_restore_context(pwrdm);
1253 return 0;
1254}
1255
1256static int pwrdm_lost_power(struct powerdomain *pwrdm, void *unused)
1257{
1258 int state;
1259
1260 /*
1261 * Power has been lost across all powerdomains, increment the
1262 * counter.
1263 */
1264
1265 state = pwrdm_read_pwrst(pwrdm);
1266 if (state != PWRDM_POWER_OFF) {
1267 pwrdm->state_counter[state]++;
1268 pwrdm->state_counter[PWRDM_POWER_OFF]++;
1269 }
1270 pwrdm->state = state;
1271
1272 return 0;
1273}
1274
1275void pwrdms_save_context(void)
1276{
1277 pwrdm_for_each(pwrdm_save_context, NULL);
1278}
1279
1280void pwrdms_restore_context(void)
1281{
1282 pwrdm_for_each(pwrdm_restore_context, NULL);
1283}
1284
1285void pwrdms_lost_power(void)
1286{
1287 pwrdm_for_each(pwrdm_lost_power, NULL);
1288}
diff --git a/arch/arm/mach-omap2/powerdomain.h b/arch/arm/mach-omap2/powerdomain.h
index 28a796ce07d7..9a907fb14044 100644
--- a/arch/arm/mach-omap2/powerdomain.h
+++ b/arch/arm/mach-omap2/powerdomain.h
@@ -144,6 +144,7 @@ struct powerdomain {
144 s64 timer; 144 s64 timer;
145 s64 state_timer[PWRDM_MAX_PWRSTS]; 145 s64 state_timer[PWRDM_MAX_PWRSTS];
146#endif 146#endif
147 u32 context;
147}; 148};
148 149
149/** 150/**
@@ -198,6 +199,8 @@ struct pwrdm_ops {
198 int (*pwrdm_set_lowpwrstchange)(struct powerdomain *pwrdm); 199 int (*pwrdm_set_lowpwrstchange)(struct powerdomain *pwrdm);
199 int (*pwrdm_wait_transition)(struct powerdomain *pwrdm); 200 int (*pwrdm_wait_transition)(struct powerdomain *pwrdm);
200 int (*pwrdm_has_voltdm)(void); 201 int (*pwrdm_has_voltdm)(void);
202 void (*pwrdm_save_context)(struct powerdomain *pwrdm);
203 void (*pwrdm_restore_context)(struct powerdomain *pwrdm);
201}; 204};
202 205
203int pwrdm_register_platform_funcs(struct pwrdm_ops *custom_funcs); 206int pwrdm_register_platform_funcs(struct pwrdm_ops *custom_funcs);
@@ -273,4 +276,8 @@ extern struct powerdomain gfx_omap2_pwrdm;
273extern void pwrdm_lock(struct powerdomain *pwrdm); 276extern void pwrdm_lock(struct powerdomain *pwrdm);
274extern void pwrdm_unlock(struct powerdomain *pwrdm); 277extern void pwrdm_unlock(struct powerdomain *pwrdm);
275 278
279extern void pwrdms_save_context(void);
280extern void pwrdms_restore_context(void);
281
282extern void pwrdms_lost_power(void);
276#endif 283#endif
diff --git a/arch/arm/mach-omap2/prm33xx.c b/arch/arm/mach-omap2/prm33xx.c
index ebaf80d72a10..d5141669c28d 100644
--- a/arch/arm/mach-omap2/prm33xx.c
+++ b/arch/arm/mach-omap2/prm33xx.c
@@ -342,6 +342,35 @@ static void am33xx_prm_global_warm_sw_reset(void)
342 AM33XX_PRM_RSTCTRL_OFFSET); 342 AM33XX_PRM_RSTCTRL_OFFSET);
343} 343}
344 344
345static void am33xx_pwrdm_save_context(struct powerdomain *pwrdm)
346{
347 pwrdm->context = am33xx_prm_read_reg(pwrdm->prcm_offs,
348 pwrdm->pwrstctrl_offs);
349 /*
350 * Do not save LOWPOWERSTATECHANGE, writing a 1 indicates a request,
351 * reading back a 1 indicates a request in progress.
352 */
353 pwrdm->context &= ~AM33XX_LOWPOWERSTATECHANGE_MASK;
354}
355
356static void am33xx_pwrdm_restore_context(struct powerdomain *pwrdm)
357{
358 int st, ctrl;
359
360 st = am33xx_prm_read_reg(pwrdm->prcm_offs,
361 pwrdm->pwrstst_offs);
362
363 am33xx_prm_write_reg(pwrdm->context, pwrdm->prcm_offs,
364 pwrdm->pwrstctrl_offs);
365
366 /* Make sure we only wait for a transition if there is one */
367 st &= OMAP_POWERSTATEST_MASK;
368 ctrl = OMAP_POWERSTATEST_MASK & pwrdm->context;
369
370 if (st != ctrl)
371 am33xx_pwrdm_wait_transition(pwrdm);
372}
373
345struct pwrdm_ops am33xx_pwrdm_operations = { 374struct pwrdm_ops am33xx_pwrdm_operations = {
346 .pwrdm_set_next_pwrst = am33xx_pwrdm_set_next_pwrst, 375 .pwrdm_set_next_pwrst = am33xx_pwrdm_set_next_pwrst,
347 .pwrdm_read_next_pwrst = am33xx_pwrdm_read_next_pwrst, 376 .pwrdm_read_next_pwrst = am33xx_pwrdm_read_next_pwrst,
@@ -357,6 +386,8 @@ struct pwrdm_ops am33xx_pwrdm_operations = {
357 .pwrdm_set_mem_retst = am33xx_pwrdm_set_mem_retst, 386 .pwrdm_set_mem_retst = am33xx_pwrdm_set_mem_retst,
358 .pwrdm_wait_transition = am33xx_pwrdm_wait_transition, 387 .pwrdm_wait_transition = am33xx_pwrdm_wait_transition,
359 .pwrdm_has_voltdm = am33xx_check_vcvp, 388 .pwrdm_has_voltdm = am33xx_check_vcvp,
389 .pwrdm_save_context = am33xx_pwrdm_save_context,
390 .pwrdm_restore_context = am33xx_pwrdm_restore_context,
360}; 391};
361 392
362static struct prm_ll_data am33xx_prm_ll_data = { 393static struct prm_ll_data am33xx_prm_ll_data = {
diff --git a/arch/arm/mach-omap2/prm44xx.c b/arch/arm/mach-omap2/prm44xx.c
index acb95936dfe7..7b95729e8359 100644
--- a/arch/arm/mach-omap2/prm44xx.c
+++ b/arch/arm/mach-omap2/prm44xx.c
@@ -12,6 +12,7 @@
12 * published by the Free Software Foundation. 12 * published by the Free Software Foundation.
13 */ 13 */
14 14
15#include <linux/cpu_pm.h>
15#include <linux/kernel.h> 16#include <linux/kernel.h>
16#include <linux/delay.h> 17#include <linux/delay.h>
17#include <linux/errno.h> 18#include <linux/errno.h>
@@ -30,6 +31,7 @@
30#include "prcm44xx.h" 31#include "prcm44xx.h"
31#include "prminst44xx.h" 32#include "prminst44xx.h"
32#include "powerdomain.h" 33#include "powerdomain.h"
34#include "pm.h"
33 35
34/* Static data */ 36/* Static data */
35 37
@@ -57,6 +59,13 @@ static struct omap_prcm_irq_setup omap4_prcm_irq_setup = {
57 .reconfigure_io_chain = &omap44xx_prm_reconfigure_io_chain, 59 .reconfigure_io_chain = &omap44xx_prm_reconfigure_io_chain,
58}; 60};
59 61
62struct omap_prm_irq_context {
63 unsigned long irq_enable;
64 unsigned long pm_ctrl;
65};
66
67static struct omap_prm_irq_context omap_prm_context;
68
60/* 69/*
61 * omap44xx_prm_reset_src_map - map from bits in the PRM_RSTST 70 * omap44xx_prm_reset_src_map - map from bits in the PRM_RSTST
62 * hardware register (which are specific to OMAP44xx SoCs) to reset 71 * hardware register (which are specific to OMAP44xx SoCs) to reset
@@ -667,6 +676,54 @@ static int omap4_check_vcvp(void)
667 return 0; 676 return 0;
668} 677}
669 678
679/**
680 * omap4_pwrdm_save_context - Saves the powerdomain state
681 * @pwrdm: pointer to individual powerdomain
682 *
683 * The function saves the powerdomain state control information.
684 * This is needed in rtc+ddr modes where we lose powerdomain context.
685 */
686static void omap4_pwrdm_save_context(struct powerdomain *pwrdm)
687{
688 pwrdm->context = omap4_prminst_read_inst_reg(pwrdm->prcm_partition,
689 pwrdm->prcm_offs,
690 pwrdm->pwrstctrl_offs);
691
692 /*
693 * Do not save LOWPOWERSTATECHANGE, writing a 1 indicates a request,
694 * reading back a 1 indicates a request in progress.
695 */
696 pwrdm->context &= ~OMAP4430_LOWPOWERSTATECHANGE_MASK;
697}
698
699/**
700 * omap4_pwrdm_restore_context - Restores the powerdomain state
701 * @pwrdm: pointer to individual powerdomain
702 *
703 * The function restores the powerdomain state control information.
704 * This is needed in rtc+ddr modes where we lose powerdomain context.
705 */
706static void omap4_pwrdm_restore_context(struct powerdomain *pwrdm)
707{
708 int st, ctrl;
709
710 st = omap4_prminst_read_inst_reg(pwrdm->prcm_partition,
711 pwrdm->prcm_offs,
712 pwrdm->pwrstctrl_offs);
713
714 omap4_prminst_write_inst_reg(pwrdm->context,
715 pwrdm->prcm_partition,
716 pwrdm->prcm_offs,
717 pwrdm->pwrstctrl_offs);
718
719 /* Make sure we only wait for a transition if there is one */
720 st &= OMAP_POWERSTATEST_MASK;
721 ctrl = OMAP_POWERSTATEST_MASK & pwrdm->context;
722
723 if (st != ctrl)
724 omap4_pwrdm_wait_transition(pwrdm);
725}
726
670struct pwrdm_ops omap4_pwrdm_operations = { 727struct pwrdm_ops omap4_pwrdm_operations = {
671 .pwrdm_set_next_pwrst = omap4_pwrdm_set_next_pwrst, 728 .pwrdm_set_next_pwrst = omap4_pwrdm_set_next_pwrst,
672 .pwrdm_read_next_pwrst = omap4_pwrdm_read_next_pwrst, 729 .pwrdm_read_next_pwrst = omap4_pwrdm_read_next_pwrst,
@@ -685,10 +742,50 @@ struct pwrdm_ops omap4_pwrdm_operations = {
685 .pwrdm_set_mem_retst = omap4_pwrdm_set_mem_retst, 742 .pwrdm_set_mem_retst = omap4_pwrdm_set_mem_retst,
686 .pwrdm_wait_transition = omap4_pwrdm_wait_transition, 743 .pwrdm_wait_transition = omap4_pwrdm_wait_transition,
687 .pwrdm_has_voltdm = omap4_check_vcvp, 744 .pwrdm_has_voltdm = omap4_check_vcvp,
745 .pwrdm_save_context = omap4_pwrdm_save_context,
746 .pwrdm_restore_context = omap4_pwrdm_restore_context,
688}; 747};
689 748
690static int omap44xx_prm_late_init(void); 749static int omap44xx_prm_late_init(void);
691 750
751void prm_save_context(void)
752{
753 omap_prm_context.irq_enable =
754 omap4_prm_read_inst_reg(AM43XX_PRM_OCP_SOCKET_INST,
755 omap4_prcm_irq_setup.mask);
756
757 omap_prm_context.pm_ctrl =
758 omap4_prm_read_inst_reg(AM43XX_PRM_DEVICE_INST,
759 omap4_prcm_irq_setup.pm_ctrl);
760}
761
762void prm_restore_context(void)
763{
764 omap4_prm_write_inst_reg(omap_prm_context.irq_enable,
765 OMAP4430_PRM_OCP_SOCKET_INST,
766 omap4_prcm_irq_setup.mask);
767
768 omap4_prm_write_inst_reg(omap_prm_context.pm_ctrl,
769 AM43XX_PRM_DEVICE_INST,
770 omap4_prcm_irq_setup.pm_ctrl);
771}
772
773static int cpu_notifier(struct notifier_block *nb, unsigned long cmd, void *v)
774{
775 switch (cmd) {
776 case CPU_CLUSTER_PM_ENTER:
777 if (enable_off_mode)
778 prm_save_context();
779 break;
780 case CPU_CLUSTER_PM_EXIT:
781 if (enable_off_mode)
782 prm_restore_context();
783 break;
784 }
785
786 return NOTIFY_OK;
787}
788
692/* 789/*
693 * XXX document 790 * XXX document
694 */ 791 */
@@ -709,6 +806,7 @@ static const struct omap_prcm_init_data *prm_init_data;
709 806
710int __init omap44xx_prm_init(const struct omap_prcm_init_data *data) 807int __init omap44xx_prm_init(const struct omap_prcm_init_data *data)
711{ 808{
809 static struct notifier_block nb;
712 omap_prm_base_init(); 810 omap_prm_base_init();
713 811
714 prm_init_data = data; 812 prm_init_data = data;
@@ -730,6 +828,12 @@ int __init omap44xx_prm_init(const struct omap_prcm_init_data *data)
730 omap4_prcm_irq_setup.mask = AM43XX_PRM_IRQENABLE_MPU_OFFSET; 828 omap4_prcm_irq_setup.mask = AM43XX_PRM_IRQENABLE_MPU_OFFSET;
731 } 829 }
732 830
831 /* Only AM43XX can lose prm context during rtc-ddr suspend */
832 if (soc_is_am43xx()) {
833 nb.notifier_call = cpu_notifier;
834 cpu_pm_register_notifier(&nb);
835 }
836
733 return prm_register(&omap44xx_prm_ll_data); 837 return prm_register(&omap44xx_prm_ll_data);
734} 838}
735 839
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
index 4fb4dc24e5e9..98ed5ac073bc 100644
--- a/arch/arm/mach-omap2/timer.c
+++ b/arch/arm/mach-omap2/timer.c
@@ -50,7 +50,6 @@
50#include "omap_device.h" 50#include "omap_device.h"
51#include <plat/counter-32k.h> 51#include <plat/counter-32k.h>
52#include <clocksource/timer-ti-dm.h> 52#include <clocksource/timer-ti-dm.h>
53#include "omap-pm.h"
54 53
55#include "soc.h" 54#include "soc.h"
56#include "common.h" 55#include "common.h"
@@ -71,6 +70,9 @@ static struct clock_event_device clockevent_gpt;
71/* Clockevent hwmod for am335x and am437x suspend */ 70/* Clockevent hwmod for am335x and am437x suspend */
72static struct omap_hwmod *clockevent_gpt_hwmod; 71static struct omap_hwmod *clockevent_gpt_hwmod;
73 72
73/* Clockesource hwmod for am437x suspend */
74static struct omap_hwmod *clocksource_gpt_hwmod;
75
74#ifdef CONFIG_SOC_HAS_REALTIME_COUNTER 76#ifdef CONFIG_SOC_HAS_REALTIME_COUNTER
75static unsigned long arch_timer_freq; 77static unsigned long arch_timer_freq;
76 78
@@ -168,6 +170,43 @@ static const struct of_device_id omap_timer_match[] __initconst = {
168 { } 170 { }
169}; 171};
170 172
173static int omap_timer_add_disabled_property(struct device_node *np)
174{
175 struct property *prop;
176
177 prop = kzalloc(sizeof(*prop), GFP_KERNEL);
178 if (!prop)
179 return -ENOMEM;
180
181 prop->name = "status";
182 prop->value = "disabled";
183 prop->length = strlen(prop->value);
184
185 return of_add_property(np, prop);
186}
187
188static int omap_timer_update_dt(struct device_node *np)
189{
190 int error = 0;
191
192 if (!of_device_is_compatible(np, "ti,omap-counter32k")) {
193 error = omap_timer_add_disabled_property(np);
194 if (error)
195 return error;
196 }
197
198 /* No parent interconnect target module configured? */
199 if (of_get_property(np, "ti,hwmods", NULL))
200 return error;
201
202 /* Tag parent interconnect target module disabled */
203 error = omap_timer_add_disabled_property(np->parent);
204 if (error)
205 return error;
206
207 return 0;
208}
209
171/** 210/**
172 * omap_get_timer_dt - get a timer using device-tree 211 * omap_get_timer_dt - get a timer using device-tree
173 * @match - device-tree match structure for matching a device type 212 * @match - device-tree match structure for matching a device type
@@ -183,6 +222,7 @@ static struct device_node * __init omap_get_timer_dt(const struct of_device_id *
183 const char *property) 222 const char *property)
184{ 223{
185 struct device_node *np; 224 struct device_node *np;
225 int error;
186 226
187 for_each_matching_node(np, match) { 227 for_each_matching_node(np, match) {
188 if (!of_device_is_available(np)) 228 if (!of_device_is_available(np))
@@ -197,17 +237,9 @@ static struct device_node * __init omap_get_timer_dt(const struct of_device_id *
197 of_get_property(np, "ti,timer-secure", NULL))) 237 of_get_property(np, "ti,timer-secure", NULL)))
198 continue; 238 continue;
199 239
200 if (!of_device_is_compatible(np, "ti,omap-counter32k")) { 240 error = omap_timer_update_dt(np);
201 struct property *prop; 241 WARN(error, "%s: Could not update dt: %i\n", __func__, error);
202 242
203 prop = kzalloc(sizeof(*prop), GFP_KERNEL);
204 if (!prop)
205 return NULL;
206 prop->name = "status";
207 prop->value = "disabled";
208 prop->length = strlen(prop->value);
209 of_add_property(np, prop);
210 }
211 return np; 243 return np;
212 } 244 }
213 245
@@ -266,8 +298,12 @@ static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer,
266 return -ENODEV; 298 return -ENODEV;
267 299
268 of_property_read_string_index(np, "ti,hwmods", 0, &oh_name); 300 of_property_read_string_index(np, "ti,hwmods", 0, &oh_name);
269 if (!oh_name) 301 if (!oh_name) {
270 return -ENODEV; 302 of_property_read_string_index(np->parent, "ti,hwmods", 0,
303 &oh_name);
304 if (!oh_name)
305 return -ENODEV;
306 }
271 307
272 timer->irq = irq_of_parse_and_map(np, 0); 308 timer->irq = irq_of_parse_and_map(np, 0);
273 if (!timer->irq) 309 if (!timer->irq)
@@ -419,9 +455,12 @@ static int __init __maybe_unused omap2_sync32k_clocksource_init(void)
419 if (!np) 455 if (!np)
420 return -ENODEV; 456 return -ENODEV;
421 457
422 of_property_read_string_index(np, "ti,hwmods", 0, &oh_name); 458 of_property_read_string_index(np->parent, "ti,hwmods", 0, &oh_name);
423 if (!oh_name) 459 if (!oh_name) {
424 return -ENODEV; 460 of_property_read_string_index(np, "ti,hwmods", 0, &oh_name);
461 if (!oh_name)
462 return -ENODEV;
463 }
425 464
426 /* 465 /*
427 * First check hwmod data is available for sync32k counter 466 * First check hwmod data is available for sync32k counter
@@ -442,6 +481,26 @@ static int __init __maybe_unused omap2_sync32k_clocksource_init(void)
442 return ret; 481 return ret;
443} 482}
444 483
484static unsigned int omap2_gptimer_clksrc_load;
485
486static void omap2_gptimer_clksrc_suspend(struct clocksource *unused)
487{
488 omap2_gptimer_clksrc_load =
489 __omap_dm_timer_read_counter(&clksrc, OMAP_TIMER_NONPOSTED);
490
491 omap_hwmod_idle(clocksource_gpt_hwmod);
492}
493
494static void omap2_gptimer_clksrc_resume(struct clocksource *unused)
495{
496 omap_hwmod_enable(clocksource_gpt_hwmod);
497
498 __omap_dm_timer_load_start(&clksrc,
499 OMAP_TIMER_CTRL_ST | OMAP_TIMER_CTRL_AR,
500 omap2_gptimer_clksrc_load,
501 OMAP_TIMER_NONPOSTED);
502}
503
445static void __init omap2_gptimer_clocksource_init(int gptimer_id, 504static void __init omap2_gptimer_clocksource_init(int gptimer_id,
446 const char *fck_source, 505 const char *fck_source,
447 const char *property) 506 const char *property)
@@ -454,6 +513,15 @@ static void __init omap2_gptimer_clocksource_init(int gptimer_id,
454 res = omap_dm_timer_init_one(&clksrc, fck_source, property, 513 res = omap_dm_timer_init_one(&clksrc, fck_source, property,
455 &clocksource_gpt.name, 514 &clocksource_gpt.name,
456 OMAP_TIMER_NONPOSTED); 515 OMAP_TIMER_NONPOSTED);
516
517 if (soc_is_am43xx()) {
518 clocksource_gpt.suspend = omap2_gptimer_clksrc_suspend;
519 clocksource_gpt.resume = omap2_gptimer_clksrc_resume;
520
521 clocksource_gpt_hwmod =
522 omap_hwmod_lookup(clocksource_gpt.name);
523 }
524
457 BUG_ON(res); 525 BUG_ON(res);
458 526
459 __omap_dm_timer_load_start(&clksrc, 527 __omap_dm_timer_load_start(&clksrc,
diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c
index 4b8a0df8ea57..8c64f93b669b 100644
--- a/arch/arm/mach-pxa/pxa3xx.c
+++ b/arch/arm/mach-pxa/pxa3xx.c
@@ -446,6 +446,10 @@ static int __init pxa3xx_init(void)
446 446
447 pxa3xx_init_pm(); 447 pxa3xx_init_pm();
448 448
449 enable_irq_wake(IRQ_WAKEUP0);
450 if (cpu_is_pxa320())
451 enable_irq_wake(IRQ_WAKEUP1);
452
449 register_syscore_ops(&pxa_irq_syscore_ops); 453 register_syscore_ops(&pxa_irq_syscore_ops);
450 register_syscore_ops(&pxa3xx_mfp_syscore_ops); 454 register_syscore_ops(&pxa3xx_mfp_syscore_ops);
451 455
diff --git a/arch/arm/mach-pxa/stargate2.c b/arch/arm/mach-pxa/stargate2.c
index df62bb23dbee..bbea5fa9a140 100644
--- a/arch/arm/mach-pxa/stargate2.c
+++ b/arch/arm/mach-pxa/stargate2.c
@@ -27,11 +27,11 @@
27 27
28#include <linux/platform_data/i2c-pxa.h> 28#include <linux/platform_data/i2c-pxa.h>
29#include <linux/platform_data/pcf857x.h> 29#include <linux/platform_data/pcf857x.h>
30#include <linux/platform_data/at24.h>
31#include <linux/smc91x.h> 30#include <linux/smc91x.h>
32#include <linux/gpio/machine.h> 31#include <linux/gpio/machine.h>
33#include <linux/gpio.h> 32#include <linux/gpio.h>
34#include <linux/leds.h> 33#include <linux/leds.h>
34#include <linux/property.h>
35 35
36#include <asm/types.h> 36#include <asm/types.h>
37#include <asm/setup.h> 37#include <asm/setup.h>
@@ -795,9 +795,9 @@ static struct pcf857x_platform_data platform_data_pcf857x = {
795 .context = NULL, 795 .context = NULL,
796}; 796};
797 797
798static struct at24_platform_data pca9500_eeprom_pdata = { 798static const struct property_entry pca9500_eeprom_properties[] = {
799 .byte_len = 256, 799 PROPERTY_ENTRY_U32("pagesize", 4),
800 .page_size = 4, 800 { }
801}; 801};
802 802
803/** 803/**
@@ -935,7 +935,7 @@ static struct i2c_board_info __initdata stargate2_i2c_board_info[] = {
935 }, { 935 }, {
936 .type = "24c02", 936 .type = "24c02",
937 .addr = 0x57, 937 .addr = 0x57,
938 .platform_data = &pca9500_eeprom_pdata, 938 .properties = pca9500_eeprom_properties,
939 }, { 939 }, {
940 .type = "max1238", 940 .type = "max1238",
941 .addr = 0x35, 941 .addr = 0x35,
diff --git a/arch/arm/mach-s3c24xx/h1940-bluetooth.c b/arch/arm/mach-s3c24xx/h1940-bluetooth.c
index 46ad20ea87d1..186b5321658e 100644
--- a/arch/arm/mach-s3c24xx/h1940-bluetooth.c
+++ b/arch/arm/mach-s3c24xx/h1940-bluetooth.c
@@ -1,4 +1,4 @@
1// SPDX-License-Identifier: GPL-1.0 1// SPDX-License-Identifier: GPL-1.0+
2// 2//
3// Copyright (c) Arnaud Patard <arnaud.patard@rtp-net.org> 3// Copyright (c) Arnaud Patard <arnaud.patard@rtp-net.org>
4// 4//
diff --git a/arch/arm/mach-s3c24xx/mach-mini2440.c b/arch/arm/mach-s3c24xx/mach-mini2440.c
index 95753e0bc073..f9fc1f8d2b28 100644
--- a/arch/arm/mach-s3c24xx/mach-mini2440.c
+++ b/arch/arm/mach-s3c24xx/mach-mini2440.c
@@ -20,7 +20,7 @@
20#include <linux/serial_core.h> 20#include <linux/serial_core.h>
21#include <linux/serial_s3c.h> 21#include <linux/serial_s3c.h>
22#include <linux/dm9000.h> 22#include <linux/dm9000.h>
23#include <linux/platform_data/at24.h> 23#include <linux/property.h>
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/gpio_keys.h> 25#include <linux/gpio_keys.h>
26#include <linux/i2c.h> 26#include <linux/i2c.h>
@@ -481,15 +481,15 @@ static struct platform_device mini2440_audio = {
481/* 481/*
482 * I2C devices 482 * I2C devices
483 */ 483 */
484static struct at24_platform_data at24c08 = { 484static const struct property_entry mini2440_at24_properties[] = {
485 .byte_len = SZ_8K / 8, 485 PROPERTY_ENTRY_U32("pagesize", 16),
486 .page_size = 16, 486 { }
487}; 487};
488 488
489static struct i2c_board_info mini2440_i2c_devs[] __initdata = { 489static struct i2c_board_info mini2440_i2c_devs[] __initdata = {
490 { 490 {
491 I2C_BOARD_INFO("24c08", 0x50), 491 I2C_BOARD_INFO("24c08", 0x50),
492 .platform_data = &at24c08, 492 .properties = mini2440_at24_properties,
493 }, 493 },
494}; 494};
495 495
diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
index fe60cd09a5ca..0b67254eabb2 100644
--- a/arch/arm/mach-shmobile/Kconfig
+++ b/arch/arm/mach-shmobile/Kconfig
@@ -74,6 +74,10 @@ config ARCH_R8A7745
74 bool "RZ/G1E (R8A77450)" 74 bool "RZ/G1E (R8A77450)"
75 select ARCH_RCAR_GEN2 75 select ARCH_RCAR_GEN2
76 76
77config ARCH_R8A77470
78 bool "RZ/G1C (R8A77470)"
79 select ARCH_RCAR_GEN2
80
77config ARCH_R8A7778 81config ARCH_R8A7778
78 bool "R-Car M1A (R8A77781)" 82 bool "R-Car M1A (R8A77781)"
79 select ARCH_RCAR_GEN1 83 select ARCH_RCAR_GEN1
@@ -109,6 +113,15 @@ config ARCH_R8A7794
109 bool "R-Car E2 (R8A77940)" 113 bool "R-Car E2 (R8A77940)"
110 select ARCH_RCAR_GEN2 114 select ARCH_RCAR_GEN2
111 115
116config ARCH_R9A06G032
117 bool "RZ/N1D (R9A06G032)"
118 select ARCH_RZN1
119
120config ARCH_RZN1
121 bool "RZ/N1 (R9A06G0xx) Family"
122 select ARM_AMBA
123 select CPU_V7
124
112config ARCH_SH73A0 125config ARCH_SH73A0
113 bool "SH-Mobile AG5 (R8A73A00)" 126 bool "SH-Mobile AG5 (R8A73A00)"
114 select ARCH_RMOBILE 127 select ARCH_RMOBILE
diff --git a/arch/arm/mach-shmobile/common.h b/arch/arm/mach-shmobile/common.h
index 43c1ac696274..2109f123bdfb 100644
--- a/arch/arm/mach-shmobile/common.h
+++ b/arch/arm/mach-shmobile/common.h
@@ -2,7 +2,6 @@
2#ifndef __ARCH_MACH_COMMON_H 2#ifndef __ARCH_MACH_COMMON_H
3#define __ARCH_MACH_COMMON_H 3#define __ARCH_MACH_COMMON_H
4 4
5extern void shmobile_init_cntvoff(void);
6extern void shmobile_init_delay(void); 5extern void shmobile_init_delay(void);
7extern void shmobile_boot_vector(void); 6extern void shmobile_boot_vector(void);
8extern unsigned long shmobile_boot_fn; 7extern unsigned long shmobile_boot_fn;
diff --git a/arch/arm/mach-shmobile/headsmp-apmu.S b/arch/arm/mach-shmobile/headsmp-apmu.S
index 5672b5849401..d49ab194766a 100644
--- a/arch/arm/mach-shmobile/headsmp-apmu.S
+++ b/arch/arm/mach-shmobile/headsmp-apmu.S
@@ -11,29 +11,9 @@
11#include <linux/linkage.h> 11#include <linux/linkage.h>
12#include <asm/assembler.h> 12#include <asm/assembler.h>
13 13
14ENTRY(shmobile_init_cntvoff)
15 /*
16 * CNTVOFF has to be initialized either from non-secure Hypervisor
17 * mode or secure Monitor mode with SCR.NS==1. If TrustZone is enabled
18 * then it should be handled by the secure code
19 */
20 cps #MON_MODE
21 mrc p15, 0, r1, c1, c1, 0 /* Get Secure Config */
22 orr r0, r1, #1
23 mcr p15, 0, r0, c1, c1, 0 /* Set Non Secure bit */
24 instr_sync
25 mov r0, #0
26 mcrr p15, 4, r0, r0, c14 /* CNTVOFF = 0 */
27 instr_sync
28 mcr p15, 0, r1, c1, c1, 0 /* Set Secure bit */
29 instr_sync
30 cps #SVC_MODE
31 ret lr
32ENDPROC(shmobile_init_cntvoff)
33
34#ifdef CONFIG_SMP 14#ifdef CONFIG_SMP
35ENTRY(shmobile_boot_apmu) 15ENTRY(shmobile_boot_apmu)
36 bl shmobile_init_cntvoff 16 bl secure_cntvoff_init
37 b secondary_startup 17 b secondary_startup
38ENDPROC(shmobile_boot_apmu) 18ENDPROC(shmobile_boot_apmu)
39#endif 19#endif
diff --git a/arch/arm/mach-shmobile/setup-rcar-gen2.c b/arch/arm/mach-shmobile/setup-rcar-gen2.c
index 5561dbed7a33..88fdc1801d90 100644
--- a/arch/arm/mach-shmobile/setup-rcar-gen2.c
+++ b/arch/arm/mach-shmobile/setup-rcar-gen2.c
@@ -26,6 +26,7 @@
26#include <linux/of_fdt.h> 26#include <linux/of_fdt.h>
27#include <linux/of_platform.h> 27#include <linux/of_platform.h>
28#include <asm/mach/arch.h> 28#include <asm/mach/arch.h>
29#include <asm/secure_cntvoff.h>
29#include "common.h" 30#include "common.h"
30#include "rcar-gen2.h" 31#include "rcar-gen2.h"
31 32
@@ -70,9 +71,10 @@ void __init rcar_gen2_timer_init(void)
70 void __iomem *base; 71 void __iomem *base;
71 u32 freq; 72 u32 freq;
72 73
73 shmobile_init_cntvoff(); 74 secure_cntvoff_init();
74 75
75 if (of_machine_is_compatible("renesas,r8a7745") || 76 if (of_machine_is_compatible("renesas,r8a7745") ||
77 of_machine_is_compatible("renesas,r8a77470") ||
76 of_machine_is_compatible("renesas,r8a7792") || 78 of_machine_is_compatible("renesas,r8a7792") ||
77 of_machine_is_compatible("renesas,r8a7794")) { 79 of_machine_is_compatible("renesas,r8a7794")) {
78 freq = 260000000 / 8; /* ZS / 8 */ 80 freq = 260000000 / 8; /* ZS / 8 */
@@ -205,6 +207,7 @@ MACHINE_END
205static const char * const rz_g1_boards_compat_dt[] __initconst = { 207static const char * const rz_g1_boards_compat_dt[] __initconst = {
206 "renesas,r8a7743", 208 "renesas,r8a7743",
207 "renesas,r8a7745", 209 "renesas,r8a7745",
210 "renesas,r8a77470",
208 NULL, 211 NULL,
209}; 212};
210 213
diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig
index ce53ceaf4cc5..d9c8ecf88ec6 100644
--- a/arch/arm/mach-sunxi/Kconfig
+++ b/arch/arm/mach-sunxi/Kconfig
@@ -51,7 +51,7 @@ config MACH_SUN9I
51config ARCH_SUNXI_MC_SMP 51config ARCH_SUNXI_MC_SMP
52 bool 52 bool
53 depends on SMP 53 depends on SMP
54 default MACH_SUN9I 54 default MACH_SUN9I || MACH_SUN8I
55 select ARM_CCI400_PORT_CTRL 55 select ARM_CCI400_PORT_CTRL
56 select ARM_CPU_SUSPEND 56 select ARM_CPU_SUSPEND
57 57
diff --git a/arch/arm/mach-sunxi/Makefile b/arch/arm/mach-sunxi/Makefile
index 7de9cc286d53..71429aa85143 100644
--- a/arch/arm/mach-sunxi/Makefile
+++ b/arch/arm/mach-sunxi/Makefile
@@ -1,5 +1,5 @@
1CFLAGS_mc_smp.o += -march=armv7-a 1CFLAGS_mc_smp.o += -march=armv7-a
2 2
3obj-$(CONFIG_ARCH_SUNXI) += sunxi.o 3obj-$(CONFIG_ARCH_SUNXI) += sunxi.o
4obj-$(CONFIG_ARCH_SUNXI_MC_SMP) += mc_smp.o 4obj-$(CONFIG_ARCH_SUNXI_MC_SMP) += mc_smp.o headsmp.o
5obj-$(CONFIG_SMP) += platsmp.o 5obj-$(CONFIG_SMP) += platsmp.o
diff --git a/arch/arm/mach-sunxi/headsmp.S b/arch/arm/mach-sunxi/headsmp.S
new file mode 100644
index 000000000000..32d76be98541
--- /dev/null
+++ b/arch/arm/mach-sunxi/headsmp.S
@@ -0,0 +1,81 @@
1/* SPDX-License-Identifier: GPL-2.0
2 *
3 * Copyright (c) 2018 Chen-Yu Tsai
4 * Copyright (c) 2018 Bootlin
5 *
6 * Chen-Yu Tsai <wens@csie.org>
7 * Mylène Josserand <mylene.josserand@bootlin.com>
8 *
9 * SMP support for sunxi based systems with Cortex A7/A15
10 *
11 */
12
13#include <linux/linkage.h>
14#include <asm/assembler.h>
15#include <asm/cputype.h>
16
17ENTRY(sunxi_mc_smp_cluster_cache_enable)
18 .arch armv7-a
19 /*
20 * Enable cluster-level coherency, in preparation for turning on the MMU.
21 *
22 * Also enable regional clock gating and L2 data latency settings for
23 * Cortex-A15. These settings are from the vendor kernel.
24 */
25 mrc p15, 0, r1, c0, c0, 0
26 movw r2, #(ARM_CPU_PART_MASK & 0xffff)
27 movt r2, #(ARM_CPU_PART_MASK >> 16)
28 and r1, r1, r2
29 movw r2, #(ARM_CPU_PART_CORTEX_A15 & 0xffff)
30 movt r2, #(ARM_CPU_PART_CORTEX_A15 >> 16)
31 cmp r1, r2
32 bne not_a15
33
34 /* The following is Cortex-A15 specific */
35
36 /* ACTLR2: Enable CPU regional clock gates */
37 mrc p15, 1, r1, c15, c0, 4
38 orr r1, r1, #(0x1 << 31)
39 mcr p15, 1, r1, c15, c0, 4
40
41 /* L2ACTLR */
42 mrc p15, 1, r1, c15, c0, 0
43 /* Enable L2, GIC, and Timer regional clock gates */
44 orr r1, r1, #(0x1 << 26)
45 /* Disable clean/evict from being pushed to external */
46 orr r1, r1, #(0x1<<3)
47 mcr p15, 1, r1, c15, c0, 0
48
49 /* L2CTRL: L2 data RAM latency */
50 mrc p15, 1, r1, c9, c0, 2
51 bic r1, r1, #(0x7 << 0)
52 orr r1, r1, #(0x3 << 0)
53 mcr p15, 1, r1, c9, c0, 2
54
55 /* End of Cortex-A15 specific setup */
56 not_a15:
57
58 /* Get value of sunxi_mc_smp_first_comer */
59 adr r1, first
60 ldr r0, [r1]
61 ldr r0, [r1, r0]
62
63 /* Skip cci_enable_port_for_self if not first comer */
64 cmp r0, #0
65 bxeq lr
66 b cci_enable_port_for_self
67
68 .align 2
69 first: .word sunxi_mc_smp_first_comer - .
70ENDPROC(sunxi_mc_smp_cluster_cache_enable)
71
72ENTRY(sunxi_mc_smp_secondary_startup)
73 bl sunxi_mc_smp_cluster_cache_enable
74 bl secure_cntvoff_init
75 b secondary_startup
76ENDPROC(sunxi_mc_smp_secondary_startup)
77
78ENTRY(sunxi_mc_smp_resume)
79 bl sunxi_mc_smp_cluster_cache_enable
80 b cpu_resume
81ENDPROC(sunxi_mc_smp_resume)
diff --git a/arch/arm/mach-sunxi/mc_smp.c b/arch/arm/mach-sunxi/mc_smp.c
index c0246ec54a0a..b4037b603897 100644
--- a/arch/arm/mach-sunxi/mc_smp.c
+++ b/arch/arm/mach-sunxi/mc_smp.c
@@ -55,22 +55,35 @@
55#define CPUCFG_CX_RST_CTRL_L2_RST BIT(8) 55#define CPUCFG_CX_RST_CTRL_L2_RST BIT(8)
56#define CPUCFG_CX_RST_CTRL_CX_RST(n) BIT(4 + (n)) 56#define CPUCFG_CX_RST_CTRL_CX_RST(n) BIT(4 + (n))
57#define CPUCFG_CX_RST_CTRL_CORE_RST(n) BIT(n) 57#define CPUCFG_CX_RST_CTRL_CORE_RST(n) BIT(n)
58#define CPUCFG_CX_RST_CTRL_CORE_RST_ALL (0xf << 0)
58 59
59#define PRCM_CPU_PO_RST_CTRL(c) (0x4 + 0x4 * (c)) 60#define PRCM_CPU_PO_RST_CTRL(c) (0x4 + 0x4 * (c))
60#define PRCM_CPU_PO_RST_CTRL_CORE(n) BIT(n) 61#define PRCM_CPU_PO_RST_CTRL_CORE(n) BIT(n)
61#define PRCM_CPU_PO_RST_CTRL_CORE_ALL 0xf 62#define PRCM_CPU_PO_RST_CTRL_CORE_ALL 0xf
62#define PRCM_PWROFF_GATING_REG(c) (0x100 + 0x4 * (c)) 63#define PRCM_PWROFF_GATING_REG(c) (0x100 + 0x4 * (c))
63#define PRCM_PWROFF_GATING_REG_CLUSTER BIT(4) 64/* The power off register for clusters are different from a80 and a83t */
65#define PRCM_PWROFF_GATING_REG_CLUSTER_SUN8I BIT(0)
66#define PRCM_PWROFF_GATING_REG_CLUSTER_SUN9I BIT(4)
64#define PRCM_PWROFF_GATING_REG_CORE(n) BIT(n) 67#define PRCM_PWROFF_GATING_REG_CORE(n) BIT(n)
65#define PRCM_PWR_SWITCH_REG(c, cpu) (0x140 + 0x10 * (c) + 0x4 * (cpu)) 68#define PRCM_PWR_SWITCH_REG(c, cpu) (0x140 + 0x10 * (c) + 0x4 * (cpu))
66#define PRCM_CPU_SOFT_ENTRY_REG 0x164 69#define PRCM_CPU_SOFT_ENTRY_REG 0x164
67 70
71/* R_CPUCFG registers, specific to sun8i-a83t */
72#define R_CPUCFG_CLUSTER_PO_RST_CTRL(c) (0x30 + (c) * 0x4)
73#define R_CPUCFG_CLUSTER_PO_RST_CTRL_CORE(n) BIT(n)
74#define R_CPUCFG_CPU_SOFT_ENTRY_REG 0x01a4
75
68#define CPU0_SUPPORT_HOTPLUG_MAGIC0 0xFA50392F 76#define CPU0_SUPPORT_HOTPLUG_MAGIC0 0xFA50392F
69#define CPU0_SUPPORT_HOTPLUG_MAGIC1 0x790DCA3A 77#define CPU0_SUPPORT_HOTPLUG_MAGIC1 0x790DCA3A
70 78
71static void __iomem *cpucfg_base; 79static void __iomem *cpucfg_base;
72static void __iomem *prcm_base; 80static void __iomem *prcm_base;
73static void __iomem *sram_b_smp_base; 81static void __iomem *sram_b_smp_base;
82static void __iomem *r_cpucfg_base;
83
84extern void sunxi_mc_smp_secondary_startup(void);
85extern void sunxi_mc_smp_resume(void);
86static bool is_a83t;
74 87
75static bool sunxi_core_is_cortex_a15(unsigned int core, unsigned int cluster) 88static bool sunxi_core_is_cortex_a15(unsigned int core, unsigned int cluster)
76{ 89{
@@ -157,6 +170,16 @@ static int sunxi_cpu_powerup(unsigned int cpu, unsigned int cluster)
157 reg &= ~PRCM_CPU_PO_RST_CTRL_CORE(cpu); 170 reg &= ~PRCM_CPU_PO_RST_CTRL_CORE(cpu);
158 writel(reg, prcm_base + PRCM_CPU_PO_RST_CTRL(cluster)); 171 writel(reg, prcm_base + PRCM_CPU_PO_RST_CTRL(cluster));
159 172
173 if (is_a83t) {
174 /* assert cpu power-on reset */
175 reg = readl(r_cpucfg_base +
176 R_CPUCFG_CLUSTER_PO_RST_CTRL(cluster));
177 reg &= ~(R_CPUCFG_CLUSTER_PO_RST_CTRL_CORE(cpu));
178 writel(reg, r_cpucfg_base +
179 R_CPUCFG_CLUSTER_PO_RST_CTRL(cluster));
180 udelay(10);
181 }
182
160 /* Cortex-A7: hold L1 reset disable signal low */ 183 /* Cortex-A7: hold L1 reset disable signal low */
161 if (!sunxi_core_is_cortex_a15(cpu, cluster)) { 184 if (!sunxi_core_is_cortex_a15(cpu, cluster)) {
162 reg = readl(cpucfg_base + CPUCFG_CX_CTRL_REG0(cluster)); 185 reg = readl(cpucfg_base + CPUCFG_CX_CTRL_REG0(cluster));
@@ -180,17 +203,38 @@ static int sunxi_cpu_powerup(unsigned int cpu, unsigned int cluster)
180 /* open power switch */ 203 /* open power switch */
181 sunxi_cpu_power_switch_set(cpu, cluster, true); 204 sunxi_cpu_power_switch_set(cpu, cluster, true);
182 205
206 /* Handle A83T bit swap */
207 if (is_a83t) {
208 if (cpu == 0)
209 cpu = 4;
210 }
211
183 /* clear processor power gate */ 212 /* clear processor power gate */
184 reg = readl(prcm_base + PRCM_PWROFF_GATING_REG(cluster)); 213 reg = readl(prcm_base + PRCM_PWROFF_GATING_REG(cluster));
185 reg &= ~PRCM_PWROFF_GATING_REG_CORE(cpu); 214 reg &= ~PRCM_PWROFF_GATING_REG_CORE(cpu);
186 writel(reg, prcm_base + PRCM_PWROFF_GATING_REG(cluster)); 215 writel(reg, prcm_base + PRCM_PWROFF_GATING_REG(cluster));
187 udelay(20); 216 udelay(20);
188 217
218 /* Handle A83T bit swap */
219 if (is_a83t) {
220 if (cpu == 4)
221 cpu = 0;
222 }
223
189 /* de-assert processor power-on reset */ 224 /* de-assert processor power-on reset */
190 reg = readl(prcm_base + PRCM_CPU_PO_RST_CTRL(cluster)); 225 reg = readl(prcm_base + PRCM_CPU_PO_RST_CTRL(cluster));
191 reg |= PRCM_CPU_PO_RST_CTRL_CORE(cpu); 226 reg |= PRCM_CPU_PO_RST_CTRL_CORE(cpu);
192 writel(reg, prcm_base + PRCM_CPU_PO_RST_CTRL(cluster)); 227 writel(reg, prcm_base + PRCM_CPU_PO_RST_CTRL(cluster));
193 228
229 if (is_a83t) {
230 reg = readl(r_cpucfg_base +
231 R_CPUCFG_CLUSTER_PO_RST_CTRL(cluster));
232 reg |= R_CPUCFG_CLUSTER_PO_RST_CTRL_CORE(cpu);
233 writel(reg, r_cpucfg_base +
234 R_CPUCFG_CLUSTER_PO_RST_CTRL(cluster));
235 udelay(10);
236 }
237
194 /* de-assert all processor resets */ 238 /* de-assert all processor resets */
195 reg = readl(cpucfg_base + CPUCFG_CX_RST_CTRL(cluster)); 239 reg = readl(cpucfg_base + CPUCFG_CX_RST_CTRL(cluster));
196 reg |= CPUCFG_CX_RST_CTRL_DBG_RST(cpu); 240 reg |= CPUCFG_CX_RST_CTRL_DBG_RST(cpu);
@@ -212,6 +256,14 @@ static int sunxi_cluster_powerup(unsigned int cluster)
212 if (cluster >= SUNXI_NR_CLUSTERS) 256 if (cluster >= SUNXI_NR_CLUSTERS)
213 return -EINVAL; 257 return -EINVAL;
214 258
259 /* For A83T, assert cluster cores resets */
260 if (is_a83t) {
261 reg = readl(cpucfg_base + CPUCFG_CX_RST_CTRL(cluster));
262 reg &= ~CPUCFG_CX_RST_CTRL_CORE_RST_ALL; /* Core Reset */
263 writel(reg, cpucfg_base + CPUCFG_CX_RST_CTRL(cluster));
264 udelay(10);
265 }
266
215 /* assert ACINACTM */ 267 /* assert ACINACTM */
216 reg = readl(cpucfg_base + CPUCFG_CX_CTRL_REG1(cluster)); 268 reg = readl(cpucfg_base + CPUCFG_CX_CTRL_REG1(cluster));
217 reg |= CPUCFG_CX_CTRL_REG1_ACINACTM; 269 reg |= CPUCFG_CX_CTRL_REG1_ACINACTM;
@@ -222,6 +274,16 @@ static int sunxi_cluster_powerup(unsigned int cluster)
222 reg &= ~PRCM_CPU_PO_RST_CTRL_CORE_ALL; 274 reg &= ~PRCM_CPU_PO_RST_CTRL_CORE_ALL;
223 writel(reg, prcm_base + PRCM_CPU_PO_RST_CTRL(cluster)); 275 writel(reg, prcm_base + PRCM_CPU_PO_RST_CTRL(cluster));
224 276
277 /* assert cluster cores resets */
278 if (is_a83t) {
279 reg = readl(r_cpucfg_base +
280 R_CPUCFG_CLUSTER_PO_RST_CTRL(cluster));
281 reg &= ~CPUCFG_CX_RST_CTRL_CORE_RST_ALL;
282 writel(reg, r_cpucfg_base +
283 R_CPUCFG_CLUSTER_PO_RST_CTRL(cluster));
284 udelay(10);
285 }
286
225 /* assert cluster resets */ 287 /* assert cluster resets */
226 reg = readl(cpucfg_base + CPUCFG_CX_RST_CTRL(cluster)); 288 reg = readl(cpucfg_base + CPUCFG_CX_RST_CTRL(cluster));
227 reg &= ~CPUCFG_CX_RST_CTRL_DBG_SOC_RST; 289 reg &= ~CPUCFG_CX_RST_CTRL_DBG_SOC_RST;
@@ -252,7 +314,10 @@ static int sunxi_cluster_powerup(unsigned int cluster)
252 314
253 /* clear cluster power gate */ 315 /* clear cluster power gate */
254 reg = readl(prcm_base + PRCM_PWROFF_GATING_REG(cluster)); 316 reg = readl(prcm_base + PRCM_PWROFF_GATING_REG(cluster));
255 reg &= ~PRCM_PWROFF_GATING_REG_CLUSTER; 317 if (is_a83t)
318 reg &= ~PRCM_PWROFF_GATING_REG_CLUSTER_SUN8I;
319 else
320 reg &= ~PRCM_PWROFF_GATING_REG_CLUSTER_SUN9I;
256 writel(reg, prcm_base + PRCM_PWROFF_GATING_REG(cluster)); 321 writel(reg, prcm_base + PRCM_PWROFF_GATING_REG(cluster));
257 udelay(20); 322 udelay(20);
258 323
@@ -300,74 +365,7 @@ static void sunxi_cluster_cache_disable_without_axi(void)
300} 365}
301 366
302static int sunxi_mc_smp_cpu_table[SUNXI_NR_CLUSTERS][SUNXI_CPUS_PER_CLUSTER]; 367static int sunxi_mc_smp_cpu_table[SUNXI_NR_CLUSTERS][SUNXI_CPUS_PER_CLUSTER];
303static int sunxi_mc_smp_first_comer; 368int sunxi_mc_smp_first_comer;
304
305/*
306 * Enable cluster-level coherency, in preparation for turning on the MMU.
307 *
308 * Also enable regional clock gating and L2 data latency settings for
309 * Cortex-A15. These settings are from the vendor kernel.
310 */
311static void __naked sunxi_mc_smp_cluster_cache_enable(void)
312{
313 asm volatile (
314 "mrc p15, 0, r1, c0, c0, 0\n"
315 "movw r2, #" __stringify(ARM_CPU_PART_MASK & 0xffff) "\n"
316 "movt r2, #" __stringify(ARM_CPU_PART_MASK >> 16) "\n"
317 "and r1, r1, r2\n"
318 "movw r2, #" __stringify(ARM_CPU_PART_CORTEX_A15 & 0xffff) "\n"
319 "movt r2, #" __stringify(ARM_CPU_PART_CORTEX_A15 >> 16) "\n"
320 "cmp r1, r2\n"
321 "bne not_a15\n"
322
323 /* The following is Cortex-A15 specific */
324
325 /* ACTLR2: Enable CPU regional clock gates */
326 "mrc p15, 1, r1, c15, c0, 4\n"
327 "orr r1, r1, #(0x1<<31)\n"
328 "mcr p15, 1, r1, c15, c0, 4\n"
329
330 /* L2ACTLR */
331 "mrc p15, 1, r1, c15, c0, 0\n"
332 /* Enable L2, GIC, and Timer regional clock gates */
333 "orr r1, r1, #(0x1<<26)\n"
334 /* Disable clean/evict from being pushed to external */
335 "orr r1, r1, #(0x1<<3)\n"
336 "mcr p15, 1, r1, c15, c0, 0\n"
337
338 /* L2CTRL: L2 data RAM latency */
339 "mrc p15, 1, r1, c9, c0, 2\n"
340 "bic r1, r1, #(0x7<<0)\n"
341 "orr r1, r1, #(0x3<<0)\n"
342 "mcr p15, 1, r1, c9, c0, 2\n"
343
344 /* End of Cortex-A15 specific setup */
345 "not_a15:\n"
346
347 /* Get value of sunxi_mc_smp_first_comer */
348 "adr r1, first\n"
349 "ldr r0, [r1]\n"
350 "ldr r0, [r1, r0]\n"
351
352 /* Skip cci_enable_port_for_self if not first comer */
353 "cmp r0, #0\n"
354 "bxeq lr\n"
355 "b cci_enable_port_for_self\n"
356
357 ".align 2\n"
358 "first: .word sunxi_mc_smp_first_comer - .\n"
359 );
360}
361
362static void __naked sunxi_mc_smp_secondary_startup(void)
363{
364 asm volatile(
365 "bl sunxi_mc_smp_cluster_cache_enable\n"
366 "b secondary_startup"
367 /* Let compiler know about sunxi_mc_smp_cluster_cache_enable */
368 :: "i" (sunxi_mc_smp_cluster_cache_enable)
369 );
370}
371 369
372static DEFINE_SPINLOCK(boot_lock); 370static DEFINE_SPINLOCK(boot_lock);
373 371
@@ -516,7 +514,10 @@ static int sunxi_cluster_powerdown(unsigned int cluster)
516 /* gate cluster power */ 514 /* gate cluster power */
517 pr_debug("%s: gate cluster power\n", __func__); 515 pr_debug("%s: gate cluster power\n", __func__);
518 reg = readl(prcm_base + PRCM_PWROFF_GATING_REG(cluster)); 516 reg = readl(prcm_base + PRCM_PWROFF_GATING_REG(cluster));
519 reg |= PRCM_PWROFF_GATING_REG_CLUSTER; 517 if (is_a83t)
518 reg |= PRCM_PWROFF_GATING_REG_CLUSTER_SUN8I;
519 else
520 reg |= PRCM_PWROFF_GATING_REG_CLUSTER_SUN9I;
520 writel(reg, prcm_base + PRCM_PWROFF_GATING_REG(cluster)); 521 writel(reg, prcm_base + PRCM_PWROFF_GATING_REG(cluster));
521 udelay(20); 522 udelay(20);
522 523
@@ -598,8 +599,12 @@ out:
598 return !ret; 599 return !ret;
599} 600}
600 601
601static bool sunxi_mc_smp_cpu_can_disable(unsigned int __unused) 602static bool sunxi_mc_smp_cpu_can_disable(unsigned int cpu)
602{ 603{
604 /* CPU0 hotplug not handled for sun8i-a83t */
605 if (is_a83t)
606 if (cpu == 0)
607 return false;
603 return true; 608 return true;
604} 609}
605#endif 610#endif
@@ -637,16 +642,6 @@ static bool __init sunxi_mc_smp_cpu_table_init(void)
637 */ 642 */
638typedef typeof(cpu_reset) phys_reset_t; 643typedef typeof(cpu_reset) phys_reset_t;
639 644
640static void __init __naked sunxi_mc_smp_resume(void)
641{
642 asm volatile(
643 "bl sunxi_mc_smp_cluster_cache_enable\n"
644 "b cpu_resume"
645 /* Let compiler know about sunxi_mc_smp_cluster_cache_enable */
646 :: "i" (sunxi_mc_smp_cluster_cache_enable)
647 );
648}
649
650static int __init nocache_trampoline(unsigned long __unused) 645static int __init nocache_trampoline(unsigned long __unused)
651{ 646{
652 phys_reset_t phys_reset; 647 phys_reset_t phys_reset;
@@ -692,12 +687,14 @@ struct sunxi_mc_smp_nodes {
692 struct device_node *prcm_node; 687 struct device_node *prcm_node;
693 struct device_node *cpucfg_node; 688 struct device_node *cpucfg_node;
694 struct device_node *sram_node; 689 struct device_node *sram_node;
690 struct device_node *r_cpucfg_node;
695}; 691};
696 692
697/* This structure holds SoC-specific bits tied to an enable-method string. */ 693/* This structure holds SoC-specific bits tied to an enable-method string. */
698struct sunxi_mc_smp_data { 694struct sunxi_mc_smp_data {
699 const char *enable_method; 695 const char *enable_method;
700 int (*get_smp_nodes)(struct sunxi_mc_smp_nodes *nodes); 696 int (*get_smp_nodes)(struct sunxi_mc_smp_nodes *nodes);
697 bool is_a83t;
701}; 698};
702 699
703static void __init sunxi_mc_smp_put_nodes(struct sunxi_mc_smp_nodes *nodes) 700static void __init sunxi_mc_smp_put_nodes(struct sunxi_mc_smp_nodes *nodes)
@@ -705,6 +702,7 @@ static void __init sunxi_mc_smp_put_nodes(struct sunxi_mc_smp_nodes *nodes)
705 of_node_put(nodes->prcm_node); 702 of_node_put(nodes->prcm_node);
706 of_node_put(nodes->cpucfg_node); 703 of_node_put(nodes->cpucfg_node);
707 of_node_put(nodes->sram_node); 704 of_node_put(nodes->sram_node);
705 of_node_put(nodes->r_cpucfg_node);
708 memset(nodes, 0, sizeof(*nodes)); 706 memset(nodes, 0, sizeof(*nodes));
709} 707}
710 708
@@ -734,11 +732,42 @@ static int __init sun9i_a80_get_smp_nodes(struct sunxi_mc_smp_nodes *nodes)
734 return 0; 732 return 0;
735} 733}
736 734
735static int __init sun8i_a83t_get_smp_nodes(struct sunxi_mc_smp_nodes *nodes)
736{
737 nodes->prcm_node = of_find_compatible_node(NULL, NULL,
738 "allwinner,sun8i-a83t-r-ccu");
739 if (!nodes->prcm_node) {
740 pr_err("%s: PRCM not available\n", __func__);
741 return -ENODEV;
742 }
743
744 nodes->cpucfg_node = of_find_compatible_node(NULL, NULL,
745 "allwinner,sun8i-a83t-cpucfg");
746 if (!nodes->cpucfg_node) {
747 pr_err("%s: CPUCFG not available\n", __func__);
748 return -ENODEV;
749 }
750
751 nodes->r_cpucfg_node = of_find_compatible_node(NULL, NULL,
752 "allwinner,sun8i-a83t-r-cpucfg");
753 if (!nodes->r_cpucfg_node) {
754 pr_err("%s: RCPUCFG not available\n", __func__);
755 return -ENODEV;
756 }
757
758 return 0;
759}
760
737static const struct sunxi_mc_smp_data sunxi_mc_smp_data[] __initconst = { 761static const struct sunxi_mc_smp_data sunxi_mc_smp_data[] __initconst = {
738 { 762 {
739 .enable_method = "allwinner,sun9i-a80-smp", 763 .enable_method = "allwinner,sun9i-a80-smp",
740 .get_smp_nodes = sun9i_a80_get_smp_nodes, 764 .get_smp_nodes = sun9i_a80_get_smp_nodes,
741 }, 765 },
766 {
767 .enable_method = "allwinner,sun8i-a83t-smp",
768 .get_smp_nodes = sun8i_a83t_get_smp_nodes,
769 .is_a83t = true,
770 },
742}; 771};
743 772
744static int __init sunxi_mc_smp_init(void) 773static int __init sunxi_mc_smp_init(void)
@@ -746,6 +775,7 @@ static int __init sunxi_mc_smp_init(void)
746 struct sunxi_mc_smp_nodes nodes = { 0 }; 775 struct sunxi_mc_smp_nodes nodes = { 0 };
747 struct device_node *node; 776 struct device_node *node;
748 struct resource res; 777 struct resource res;
778 void __iomem *addr;
749 int i, ret; 779 int i, ret;
750 780
751 /* 781 /*
@@ -771,6 +801,8 @@ static int __init sunxi_mc_smp_init(void)
771 break; 801 break;
772 } 802 }
773 803
804 is_a83t = sunxi_mc_smp_data[i].is_a83t;
805
774 of_node_put(node); 806 of_node_put(node);
775 if (ret) 807 if (ret)
776 return -ENODEV; 808 return -ENODEV;
@@ -808,12 +840,23 @@ static int __init sunxi_mc_smp_init(void)
808 goto err_unmap_prcm; 840 goto err_unmap_prcm;
809 } 841 }
810 842
811 sram_b_smp_base = of_io_request_and_map(nodes.sram_node, 0, 843 if (is_a83t) {
812 "sunxi-mc-smp"); 844 r_cpucfg_base = of_io_request_and_map(nodes.r_cpucfg_node,
813 if (IS_ERR(sram_b_smp_base)) { 845 0, "sunxi-mc-smp");
814 ret = PTR_ERR(sram_b_smp_base); 846 if (IS_ERR(r_cpucfg_base)) {
815 pr_err("%s: failed to map secure SRAM\n", __func__); 847 ret = PTR_ERR(r_cpucfg_base);
816 goto err_unmap_release_cpucfg; 848 pr_err("%s: failed to map R-CPUCFG registers\n",
849 __func__);
850 goto err_unmap_release_cpucfg;
851 }
852 } else {
853 sram_b_smp_base = of_io_request_and_map(nodes.sram_node, 0,
854 "sunxi-mc-smp");
855 if (IS_ERR(sram_b_smp_base)) {
856 ret = PTR_ERR(sram_b_smp_base);
857 pr_err("%s: failed to map secure SRAM\n", __func__);
858 goto err_unmap_release_cpucfg;
859 }
817 } 860 }
818 861
819 /* Configure CCI-400 for boot cluster */ 862 /* Configure CCI-400 for boot cluster */
@@ -821,15 +864,18 @@ static int __init sunxi_mc_smp_init(void)
821 if (ret) { 864 if (ret) {
822 pr_err("%s: failed to configure boot cluster: %d\n", 865 pr_err("%s: failed to configure boot cluster: %d\n",
823 __func__, ret); 866 __func__, ret);
824 goto err_unmap_release_secure_sram; 867 goto err_unmap_release_sram_rcpucfg;
825 } 868 }
826 869
827 /* We don't need the device nodes anymore */ 870 /* We don't need the device nodes anymore */
828 sunxi_mc_smp_put_nodes(&nodes); 871 sunxi_mc_smp_put_nodes(&nodes);
829 872
830 /* Set the hardware entry point address */ 873 /* Set the hardware entry point address */
831 writel(__pa_symbol(sunxi_mc_smp_secondary_startup), 874 if (is_a83t)
832 prcm_base + PRCM_CPU_SOFT_ENTRY_REG); 875 addr = r_cpucfg_base + R_CPUCFG_CPU_SOFT_ENTRY_REG;
876 else
877 addr = prcm_base + PRCM_CPU_SOFT_ENTRY_REG;
878 writel(__pa_symbol(sunxi_mc_smp_secondary_startup), addr);
833 879
834 /* Actually enable multi cluster SMP */ 880 /* Actually enable multi cluster SMP */
835 smp_set_ops(&sunxi_mc_smp_smp_ops); 881 smp_set_ops(&sunxi_mc_smp_smp_ops);
@@ -838,9 +884,14 @@ static int __init sunxi_mc_smp_init(void)
838 884
839 return 0; 885 return 0;
840 886
841err_unmap_release_secure_sram: 887err_unmap_release_sram_rcpucfg:
842 iounmap(sram_b_smp_base); 888 if (is_a83t) {
843 of_address_to_resource(nodes.sram_node, 0, &res); 889 iounmap(r_cpucfg_base);
890 of_address_to_resource(nodes.r_cpucfg_node, 0, &res);
891 } else {
892 iounmap(sram_b_smp_base);
893 of_address_to_resource(nodes.sram_node, 0, &res);
894 }
844 release_mem_region(res.start, resource_size(&res)); 895 release_mem_region(res.start, resource_size(&res));
845err_unmap_release_cpucfg: 896err_unmap_release_cpucfg:
846 iounmap(cpucfg_base); 897 iounmap(cpucfg_base);
diff --git a/arch/arm/mach-sunxi/sunxi.c b/arch/arm/mach-sunxi/sunxi.c
index 5e9602ce1573..de4b0e932f22 100644
--- a/arch/arm/mach-sunxi/sunxi.c
+++ b/arch/arm/mach-sunxi/sunxi.c
@@ -16,6 +16,7 @@
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17 17
18#include <asm/mach/arch.h> 18#include <asm/mach/arch.h>
19#include <asm/secure_cntvoff.h>
19 20
20static const char * const sunxi_board_dt_compat[] = { 21static const char * const sunxi_board_dt_compat[] = {
21 "allwinner,sun4i-a10", 22 "allwinner,sun4i-a10",
@@ -62,7 +63,6 @@ MACHINE_END
62static const char * const sun8i_board_dt_compat[] = { 63static const char * const sun8i_board_dt_compat[] = {
63 "allwinner,sun8i-a23", 64 "allwinner,sun8i-a23",
64 "allwinner,sun8i-a33", 65 "allwinner,sun8i-a33",
65 "allwinner,sun8i-a83t",
66 "allwinner,sun8i-h2-plus", 66 "allwinner,sun8i-h2-plus",
67 "allwinner,sun8i-h3", 67 "allwinner,sun8i-h3",
68 "allwinner,sun8i-r40", 68 "allwinner,sun8i-r40",
@@ -75,6 +75,24 @@ DT_MACHINE_START(SUN8I_DT, "Allwinner sun8i Family")
75 .dt_compat = sun8i_board_dt_compat, 75 .dt_compat = sun8i_board_dt_compat,
76MACHINE_END 76MACHINE_END
77 77
78static void __init sun8i_a83t_cntvoff_init(void)
79{
80#ifdef CONFIG_SMP
81 secure_cntvoff_init();
82#endif
83}
84
85static const char * const sun8i_a83t_cntvoff_board_dt_compat[] = {
86 "allwinner,sun8i-a83t",
87 NULL,
88};
89
90DT_MACHINE_START(SUN8I_A83T_CNTVOFF_DT, "Allwinner A83t board")
91 .init_early = sun8i_a83t_cntvoff_init,
92 .init_time = sun6i_timer_init,
93 .dt_compat = sun8i_a83t_cntvoff_board_dt_compat,
94MACHINE_END
95
78static const char * const sun9i_board_dt_compat[] = { 96static const char * const sun9i_board_dt_compat[] = {
79 "allwinner,sun9i-a80", 97 "allwinner,sun9i-a80",
80 NULL, 98 NULL,
diff --git a/arch/arm/mach-tegra/tegra.c b/arch/arm/mach-tegra/tegra.c
index 02e712d2ea30..f9587be48235 100644
--- a/arch/arm/mach-tegra/tegra.c
+++ b/arch/arm/mach-tegra/tegra.c
@@ -97,6 +97,10 @@ static void __init tegra_dt_init_late(void)
97 if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC) && 97 if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC) &&
98 of_machine_is_compatible("compal,paz00")) 98 of_machine_is_compatible("compal,paz00"))
99 tegra_paz00_wifikill_init(); 99 tegra_paz00_wifikill_init();
100
101 if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC) &&
102 of_machine_is_compatible("nvidia,tegra20"))
103 platform_device_register_simple("tegra20-cpufreq", -1, NULL, 0);
100} 104}
101 105
102static const char * const tegra_dt_board_compat[] = { 106static const char * const tegra_dt_board_compat[] = {
diff --git a/arch/arm/mach-ux500/Kconfig b/arch/arm/mach-ux500/Kconfig
index f98332ea2ef2..c1086ebe0050 100644
--- a/arch/arm/mach-ux500/Kconfig
+++ b/arch/arm/mach-ux500/Kconfig
@@ -9,64 +9,33 @@ menuconfig ARCH_U8500
9 select ARM_ERRATA_764369 if SMP 9 select ARM_ERRATA_764369 if SMP
10 select ARM_GIC 10 select ARM_GIC
11 select CACHE_L2X0 11 select CACHE_L2X0
12 select CLKSRC_DBX500_PRCMU
12 select CLKSRC_NOMADIK_MTU 13 select CLKSRC_NOMADIK_MTU
13 select GPIOLIB 14 select GPIOLIB
14 select HAVE_ARM_SCU if SMP 15 select HAVE_ARM_SCU if SMP
15 select HAVE_ARM_TWD if SMP 16 select HAVE_ARM_TWD if SMP
17 select I2C
18 select I2C_NOMADIK
19 select MFD_DB8500_PRCMU
16 select PINCTRL 20 select PINCTRL
21 select PINCTRL_AB8500
22 select PINCTRL_AB8505
17 select PINCTRL_ABX500 23 select PINCTRL_ABX500
24 select PINCTRL_DB8500
18 select PINCTRL_NOMADIK 25 select PINCTRL_NOMADIK
19 select PL310_ERRATA_753970 if CACHE_L2X0 26 select PL310_ERRATA_753970 if CACHE_L2X0
20 help
21 Support for ST-Ericsson's Ux500 architecture
22
23if ARCH_U8500
24
25config UX500_SOC_DB8500
26 bool
27 select MFD_DB8500_PRCMU
28 select PINCTRL_DB8500
29 select PINCTRL_DB8540
30 select PINCTRL_AB8500
31 select PINCTRL_AB8505
32 select PINCTRL_AB9540
33 select PINCTRL_AB8540
34 select REGULATOR
35 select REGULATOR_DB8500_PRCMU
36 select CLKSRC_DBX500_PRCMU
37 select PM_GENERIC_DOMAINS if PM 27 select PM_GENERIC_DOMAINS if PM
38
39config MACH_MOP500
40 bool "U8500 Development platform, MOP500 versions"
41 select I2C
42 select I2C_NOMADIK
43 select REGULATOR 28 select REGULATOR
29 select REGULATOR_DB8500_PRCMU
44 select REGULATOR_FIXED_VOLTAGE 30 select REGULATOR_FIXED_VOLTAGE
45 select SOC_BUS 31 select SOC_BUS
46 select UX500_SOC_DB8500
47 help 32 help
48 Include support for the MOP500 development platform. 33 Support for ST-Ericsson's Ux500 architecture
49
50config MACH_HREFV60
51 bool "U8500 Development platform, HREFv60 version"
52 select MACH_MOP500
53 help
54 Include support for the HREFv60 new development platform.
55 Includes HREFv70, v71 etc.
56 34
57config MACH_SNOWBALL 35if ARCH_U8500
58 bool "U8500 Snowball platform"
59 select MACH_MOP500
60 help
61 Include support for the snowball development platform.
62 36
63config UX500_AUTO_PLATFORM 37config UX500_SOC_DB8500
64 def_bool y 38 def_bool y
65 select MACH_MOP500
66 help
67 At least one platform needs to be selected in order to build
68 a working kernel. If everything else is disabled, this
69 automatically enables MACH_MOP500.
70 39
71config UX500_DEBUG_UART 40config UX500_DEBUG_UART
72 int "Ux500 UART to use for low-level debug" 41 int "Ux500 UART to use for low-level debug"
diff --git a/arch/arm/mach-ux500/cpu-db8500.c b/arch/arm/mach-ux500/cpu-db8500.c
index 36cd23c8be9b..389ecf6faa00 100644
--- a/arch/arm/mach-ux500/cpu-db8500.c
+++ b/arch/arm/mach-ux500/cpu-db8500.c
@@ -111,11 +111,6 @@ static void ux500_restart(enum reboot_mode mode, const char *cmd)
111 prcmu_system_reset(0); 111 prcmu_system_reset(0);
112} 112}
113 113
114static struct of_dev_auxdata u8540_auxdata_lookup[] __initdata = {
115 OF_DEV_AUXDATA("stericsson,db8500-prcmu", 0x80157000, "db8500-prcmu", NULL),
116 {},
117};
118
119static const struct of_device_id u8500_local_bus_nodes[] = { 114static const struct of_device_id u8500_local_bus_nodes[] = {
120 /* only create devices below soc node */ 115 /* only create devices below soc node */
121 { .compatible = "stericsson,db8500", }, 116 { .compatible = "stericsson,db8500", },
@@ -129,20 +124,13 @@ static void __init u8500_init_machine(void)
129 /* Initialize ux500 power domains */ 124 /* Initialize ux500 power domains */
130 ux500_pm_domains_init(); 125 ux500_pm_domains_init();
131 126
132 /* automatically probe child nodes of dbx5x0 devices */ 127 of_platform_populate(NULL, u8500_local_bus_nodes,
133 if (of_machine_is_compatible("st-ericsson,u8540")) 128 NULL, NULL);
134 of_platform_populate(NULL, u8500_local_bus_nodes,
135 u8540_auxdata_lookup, NULL);
136 else
137 of_platform_populate(NULL, u8500_local_bus_nodes,
138 NULL, NULL);
139} 129}
140 130
141static const char * stericsson_dt_platform_compat[] = { 131static const char * stericsson_dt_platform_compat[] = {
142 "st-ericsson,u8500", 132 "st-ericsson,u8500",
143 "st-ericsson,u8540",
144 "st-ericsson,u9500", 133 "st-ericsson,u9500",
145 "st-ericsson,u9540",
146 NULL, 134 NULL,
147}; 135};
148 136
diff --git a/arch/arm/mach-ux500/db8500-regs.h b/arch/arm/mach-ux500/db8500-regs.h
index 27399553c841..3d6e1955119a 100644
--- a/arch/arm/mach-ux500/db8500-regs.h
+++ b/arch/arm/mach-ux500/db8500-regs.h
@@ -41,10 +41,6 @@
41/* ASIC ID is at 0xbf4 offset within this region */ 41/* ASIC ID is at 0xbf4 offset within this region */
42#define U8500_ASIC_ID_BASE 0x9001D000 42#define U8500_ASIC_ID_BASE 0x9001D000
43 43
44#define U9540_BOOT_ROM_BASE 0xFFFE0000
45/* ASIC ID is at 0xbf4 offset within this region */
46#define U9540_ASIC_ID_BASE 0xFFFFD000
47
48#define U8500_PER6_BASE 0xa03c0000 44#define U8500_PER6_BASE 0xa03c0000
49#define U8500_PER7_BASE 0xa03d0000 45#define U8500_PER7_BASE 0xa03d0000
50#define U8500_PER5_BASE 0xa03e0000 46#define U8500_PER5_BASE 0xa03e0000
diff --git a/arch/arm/mm/cache-b15-rac.c b/arch/arm/mm/cache-b15-rac.c
index d9586ba2e63c..c6ed14840c3c 100644
--- a/arch/arm/mm/cache-b15-rac.c
+++ b/arch/arm/mm/cache-b15-rac.c
@@ -33,7 +33,10 @@ extern void v7_flush_kern_cache_all(void);
33#define RAC_CPU_SHIFT (8) 33#define RAC_CPU_SHIFT (8)
34#define RACCFG_MASK (0xff) 34#define RACCFG_MASK (0xff)
35#define RAC_CONFIG1_REG (0x7c) 35#define RAC_CONFIG1_REG (0x7c)
36#define RAC_FLUSH_REG (0x80) 36/* Brahma-B15 is a quad-core only design */
37#define B15_RAC_FLUSH_REG (0x80)
38/* Brahma-B53 is an octo-core design */
39#define B53_RAC_FLUSH_REG (0x84)
37#define FLUSH_RAC (1 << 0) 40#define FLUSH_RAC (1 << 0)
38 41
39/* Bitmask to enable instruction and data prefetching with a 256-bytes stride */ 42/* Bitmask to enable instruction and data prefetching with a 256-bytes stride */
@@ -52,6 +55,7 @@ static void __iomem *b15_rac_base;
52static DEFINE_SPINLOCK(rac_lock); 55static DEFINE_SPINLOCK(rac_lock);
53 56
54static u32 rac_config0_reg; 57static u32 rac_config0_reg;
58static u32 rac_flush_offset;
55 59
56/* Initialization flag to avoid checking for b15_rac_base, and to prevent 60/* Initialization flag to avoid checking for b15_rac_base, and to prevent
57 * multi-platform kernels from crashing here as well. 61 * multi-platform kernels from crashing here as well.
@@ -70,14 +74,14 @@ static inline void __b15_rac_flush(void)
70{ 74{
71 u32 reg; 75 u32 reg;
72 76
73 __raw_writel(FLUSH_RAC, b15_rac_base + RAC_FLUSH_REG); 77 __raw_writel(FLUSH_RAC, b15_rac_base + rac_flush_offset);
74 do { 78 do {
75 /* This dmb() is required to force the Bus Interface Unit 79 /* This dmb() is required to force the Bus Interface Unit
76 * to clean oustanding writes, and forces an idle cycle 80 * to clean oustanding writes, and forces an idle cycle
77 * to be inserted. 81 * to be inserted.
78 */ 82 */
79 dmb(); 83 dmb();
80 reg = __raw_readl(b15_rac_base + RAC_FLUSH_REG); 84 reg = __raw_readl(b15_rac_base + rac_flush_offset);
81 } while (reg & FLUSH_RAC); 85 } while (reg & FLUSH_RAC);
82} 86}
83 87
@@ -287,7 +291,7 @@ static struct syscore_ops b15_rac_syscore_ops = {
287 291
288static int __init b15_rac_init(void) 292static int __init b15_rac_init(void)
289{ 293{
290 struct device_node *dn; 294 struct device_node *dn, *cpu_dn;
291 int ret = 0, cpu; 295 int ret = 0, cpu;
292 u32 reg, en_mask = 0; 296 u32 reg, en_mask = 0;
293 297
@@ -305,6 +309,24 @@ static int __init b15_rac_init(void)
305 goto out; 309 goto out;
306 } 310 }
307 311
312 cpu_dn = of_get_cpu_node(0, NULL);
313 if (!cpu_dn) {
314 ret = -ENODEV;
315 goto out;
316 }
317
318 if (of_device_is_compatible(cpu_dn, "brcm,brahma-b15"))
319 rac_flush_offset = B15_RAC_FLUSH_REG;
320 else if (of_device_is_compatible(cpu_dn, "brcm,brahma-b53"))
321 rac_flush_offset = B53_RAC_FLUSH_REG;
322 else {
323 pr_err("Unsupported CPU\n");
324 of_node_put(cpu_dn);
325 ret = -EINVAL;
326 goto out;
327 }
328 of_node_put(cpu_dn);
329
308 ret = register_reboot_notifier(&b15_rac_reboot_nb); 330 ret = register_reboot_notifier(&b15_rac_reboot_nb);
309 if (ret) { 331 if (ret) {
310 pr_err("failed to register reboot notifier\n"); 332 pr_err("failed to register reboot notifier\n");
diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig
index afc1a1d4f7a5..c0a242cae79a 100644
--- a/arch/arm/plat-omap/Kconfig
+++ b/arch/arm/plat-omap/Kconfig
@@ -115,16 +115,6 @@ config OMAP_SERIAL_WAKE
115 to data on the serial RX line. This allows you to wake the 115 to data on the serial RX line. This allows you to wake the
116 system from serial console. 116 system from serial console.
117 117
118choice
119 prompt "OMAP PM layer selection"
120 depends on ARCH_OMAP
121 default OMAP_PM_NOOP
122
123config OMAP_PM_NOOP
124 bool "No-op/debug PM layer"
125
126endchoice
127
128endmenu 118endmenu
129 119
130endif 120endif
diff --git a/arch/arm/plat-samsung/adc.c b/arch/arm/plat-samsung/adc.c
index 42bac8d5ab5d..2da35735fa38 100644
--- a/arch/arm/plat-samsung/adc.c
+++ b/arch/arm/plat-samsung/adc.c
@@ -413,8 +413,7 @@ static int s3c_adc_remove(struct platform_device *pdev)
413#ifdef CONFIG_PM 413#ifdef CONFIG_PM
414static int s3c_adc_suspend(struct device *dev) 414static int s3c_adc_suspend(struct device *dev)
415{ 415{
416 struct platform_device *pdev = to_platform_device(dev); 416 struct adc_device *adc = dev_get_drvdata(dev);
417 struct adc_device *adc = platform_get_drvdata(pdev);
418 unsigned long flags; 417 unsigned long flags;
419 u32 con; 418 u32 con;
420 419
diff --git a/arch/arm/plat-samsung/include/plat/map-s5p.h b/arch/arm/plat-samsung/include/plat/map-s5p.h
index f5769e93544a..d69a0ca09fb5 100644
--- a/arch/arm/plat-samsung/include/plat/map-s5p.h
+++ b/arch/arm/plat-samsung/include/plat/map-s5p.h
@@ -11,10 +11,6 @@
11 11
12#define S5P_VA_CHIPID S3C_ADDR(0x02000000) 12#define S5P_VA_CHIPID S3C_ADDR(0x02000000)
13 13
14#define S5P_VA_COREPERI_BASE S3C_ADDR(0x02800000)
15#define S5P_VA_COREPERI(x) (S5P_VA_COREPERI_BASE + (x))
16#define S5P_VA_SCU S5P_VA_COREPERI(0x0)
17
18#define VA_VIC(x) (S3C_VA_IRQ + ((x) * 0x10000)) 14#define VA_VIC(x) (S3C_VA_IRQ + ((x) * 0x10000))
19#define VA_VIC0 VA_VIC(0) 15#define VA_VIC0 VA_VIC(0)
20#define VA_VIC1 VA_VIC(1) 16#define VA_VIC1 VA_VIC(1)
diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index 17ea72b1b389..3cfa8ca26738 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -53,6 +53,7 @@ CONFIG_ARCH_R8A7796=y
53CONFIG_ARCH_R8A77965=y 53CONFIG_ARCH_R8A77965=y
54CONFIG_ARCH_R8A77970=y 54CONFIG_ARCH_R8A77970=y
55CONFIG_ARCH_R8A77980=y 55CONFIG_ARCH_R8A77980=y
56CONFIG_ARCH_R8A77990=y
56CONFIG_ARCH_R8A77995=y 57CONFIG_ARCH_R8A77995=y
57CONFIG_ARCH_STRATIX10=y 58CONFIG_ARCH_STRATIX10=y
58CONFIG_ARCH_TEGRA=y 59CONFIG_ARCH_TEGRA=y
@@ -75,6 +76,7 @@ CONFIG_PCI_HISI=y
75CONFIG_PCIE_QCOM=y 76CONFIG_PCIE_QCOM=y
76CONFIG_PCIE_KIRIN=y 77CONFIG_PCIE_KIRIN=y
77CONFIG_PCIE_ARMADA_8K=y 78CONFIG_PCIE_ARMADA_8K=y
79CONFIG_PCIE_HISI_STB=y
78CONFIG_PCI_AARDVARK=y 80CONFIG_PCI_AARDVARK=y
79CONFIG_PCI_TEGRA=y 81CONFIG_PCI_TEGRA=y
80CONFIG_PCIE_RCAR=y 82CONFIG_PCIE_RCAR=y
@@ -158,8 +160,10 @@ CONFIG_BT_HIDP=m
158# CONFIG_BT_LE is not set 160# CONFIG_BT_LE is not set
159CONFIG_BT_LEDS=y 161CONFIG_BT_LEDS=y
160# CONFIG_BT_DEBUGFS is not set 162# CONFIG_BT_DEBUGFS is not set
163CONFIG_BT_HCIBTUSB=m
161CONFIG_BT_HCIUART=m 164CONFIG_BT_HCIUART=m
162CONFIG_BT_HCIUART_LL=y 165CONFIG_BT_HCIUART_LL=y
166CONFIG_BT_HCIUART_BCM=y
163CONFIG_CFG80211=m 167CONFIG_CFG80211=m
164CONFIG_MAC80211=m 168CONFIG_MAC80211=m
165CONFIG_MAC80211_LEDS=y 169CONFIG_MAC80211_LEDS=y
@@ -170,6 +174,9 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
170CONFIG_DEVTMPFS=y 174CONFIG_DEVTMPFS=y
171CONFIG_DEVTMPFS_MOUNT=y 175CONFIG_DEVTMPFS_MOUNT=y
172CONFIG_DMA_CMA=y 176CONFIG_DMA_CMA=y
177CONFIG_CMA_SIZE_MBYTES=32
178CONFIG_HISILICON_LPC=y
179CONFIG_SIMPLE_PM_BUS=y
173CONFIG_MTD=y 180CONFIG_MTD=y
174CONFIG_MTD_BLOCK=y 181CONFIG_MTD_BLOCK=y
175CONFIG_MTD_M25P80=y 182CONFIG_MTD_M25P80=y
@@ -188,6 +195,9 @@ CONFIG_BLK_DEV_SD=y
188CONFIG_SCSI_SAS_ATA=y 195CONFIG_SCSI_SAS_ATA=y
189CONFIG_SCSI_HISI_SAS=y 196CONFIG_SCSI_HISI_SAS=y
190CONFIG_SCSI_HISI_SAS_PCI=y 197CONFIG_SCSI_HISI_SAS_PCI=y
198CONFIG_SCSI_UFSHCD=m
199CONFIG_SCSI_UFSHCD_PLATFORM=m
200CONFIG_SCSI_UFS_QCOM=m
191CONFIG_ATA=y 201CONFIG_ATA=y
192CONFIG_SATA_AHCI=y 202CONFIG_SATA_AHCI=y
193CONFIG_SATA_AHCI_PLATFORM=y 203CONFIG_SATA_AHCI_PLATFORM=y
@@ -207,8 +217,10 @@ CONFIG_VETH=m
207CONFIG_VIRTIO_NET=y 217CONFIG_VIRTIO_NET=y
208CONFIG_AMD_XGBE=y 218CONFIG_AMD_XGBE=y
209CONFIG_NET_XGENE=y 219CONFIG_NET_XGENE=y
220CONFIG_ATL1C=m
210CONFIG_MACB=y 221CONFIG_MACB=y
211CONFIG_THUNDER_NIC_PF=y 222CONFIG_THUNDER_NIC_PF=y
223CONFIG_HIX5HD2_GMAC=y
212CONFIG_HNS_DSAF=y 224CONFIG_HNS_DSAF=y
213CONFIG_HNS_ENET=y 225CONFIG_HNS_ENET=y
214CONFIG_E1000E=y 226CONFIG_E1000E=y
@@ -240,6 +252,7 @@ CONFIG_ROCKCHIP_PHY=y
240CONFIG_USB_PEGASUS=m 252CONFIG_USB_PEGASUS=m
241CONFIG_USB_RTL8150=m 253CONFIG_USB_RTL8150=m
242CONFIG_USB_RTL8152=m 254CONFIG_USB_RTL8152=m
255CONFIG_USB_LAN78XX=m
243CONFIG_USB_USBNET=m 256CONFIG_USB_USBNET=m
244CONFIG_USB_NET_DM9601=m 257CONFIG_USB_NET_DM9601=m
245CONFIG_USB_NET_SR9800=m 258CONFIG_USB_NET_SR9800=m
@@ -247,13 +260,19 @@ CONFIG_USB_NET_SMSC75XX=m
247CONFIG_USB_NET_SMSC95XX=m 260CONFIG_USB_NET_SMSC95XX=m
248CONFIG_USB_NET_PLUSB=m 261CONFIG_USB_NET_PLUSB=m
249CONFIG_USB_NET_MCS7830=m 262CONFIG_USB_NET_MCS7830=m
263CONFIG_ATH10K=m
264CONFIG_ATH10K_PCI=m
250CONFIG_BRCMFMAC=m 265CONFIG_BRCMFMAC=m
266CONFIG_MWIFIEX=m
267CONFIG_MWIFIEX_PCIE=m
251CONFIG_WL18XX=m 268CONFIG_WL18XX=m
252CONFIG_WLCORE_SDIO=m 269CONFIG_WLCORE_SDIO=m
253CONFIG_INPUT_EVDEV=y 270CONFIG_INPUT_EVDEV=y
254CONFIG_KEYBOARD_ADC=m 271CONFIG_KEYBOARD_ADC=m
255CONFIG_KEYBOARD_CROS_EC=y 272CONFIG_KEYBOARD_CROS_EC=y
256CONFIG_KEYBOARD_GPIO=y 273CONFIG_KEYBOARD_GPIO=y
274CONFIG_INPUT_TOUCHSCREEN=y
275CONFIG_TOUCHSCREEN_ATMEL_MXT=m
257CONFIG_INPUT_MISC=y 276CONFIG_INPUT_MISC=y
258CONFIG_INPUT_PM8941_PWRKEY=y 277CONFIG_INPUT_PM8941_PWRKEY=y
259CONFIG_INPUT_HISI_POWERKEY=y 278CONFIG_INPUT_HISI_POWERKEY=y
@@ -287,6 +306,7 @@ CONFIG_SERIAL_MVEBU_UART=y
287CONFIG_SERIAL_DEV_BUS=y 306CONFIG_SERIAL_DEV_BUS=y
288CONFIG_SERIAL_DEV_CTRL_TTYPORT=y 307CONFIG_SERIAL_DEV_CTRL_TTYPORT=y
289CONFIG_VIRTIO_CONSOLE=y 308CONFIG_VIRTIO_CONSOLE=y
309CONFIG_I2C_HID=m
290CONFIG_I2C_CHARDEV=y 310CONFIG_I2C_CHARDEV=y
291CONFIG_I2C_MUX=y 311CONFIG_I2C_MUX=y
292CONFIG_I2C_MUX_PCA954x=y 312CONFIG_I2C_MUX_PCA954x=y
@@ -304,6 +324,7 @@ CONFIG_I2C_UNIPHIER_F=y
304CONFIG_I2C_RCAR=y 324CONFIG_I2C_RCAR=y
305CONFIG_I2C_CROS_EC_TUNNEL=y 325CONFIG_I2C_CROS_EC_TUNNEL=y
306CONFIG_SPI=y 326CONFIG_SPI=y
327CONFIG_SPI_ARMADA_3700=y
307CONFIG_SPI_MESON_SPICC=m 328CONFIG_SPI_MESON_SPICC=m
308CONFIG_SPI_MESON_SPIFC=m 329CONFIG_SPI_MESON_SPIFC=m
309CONFIG_SPI_BCM2835=m 330CONFIG_SPI_BCM2835=m
@@ -321,6 +342,7 @@ CONFIG_PINCTRL_MAX77620=y
321CONFIG_PINCTRL_MSM8916=y 342CONFIG_PINCTRL_MSM8916=y
322CONFIG_PINCTRL_MSM8994=y 343CONFIG_PINCTRL_MSM8994=y
323CONFIG_PINCTRL_MSM8996=y 344CONFIG_PINCTRL_MSM8996=y
345CONFIG_PINCTRL_MT7622=y
324CONFIG_PINCTRL_QDF2XXX=y 346CONFIG_PINCTRL_QDF2XXX=y
325CONFIG_PINCTRL_QCOM_SPMI_PMIC=y 347CONFIG_PINCTRL_QCOM_SPMI_PMIC=y
326CONFIG_GPIO_DWAPB=y 348CONFIG_GPIO_DWAPB=y
@@ -333,6 +355,8 @@ CONFIG_GPIO_XGENE_SB=y
333CONFIG_GPIO_PCA953X=y 355CONFIG_GPIO_PCA953X=y
334CONFIG_GPIO_PCA953X_IRQ=y 356CONFIG_GPIO_PCA953X_IRQ=y
335CONFIG_GPIO_MAX77620=y 357CONFIG_GPIO_MAX77620=y
358CONFIG_POWER_AVS=y
359CONFIG_ROCKCHIP_IODOMAIN=y
336CONFIG_POWER_RESET_MSM=y 360CONFIG_POWER_RESET_MSM=y
337CONFIG_POWER_RESET_XGENE=y 361CONFIG_POWER_RESET_XGENE=y
338CONFIG_POWER_RESET_SYSCON=y 362CONFIG_POWER_RESET_SYSCON=y
@@ -344,6 +368,7 @@ CONFIG_SENSORS_INA2XX=m
344CONFIG_THERMAL_GOV_POWER_ALLOCATOR=y 368CONFIG_THERMAL_GOV_POWER_ALLOCATOR=y
345CONFIG_CPU_THERMAL=y 369CONFIG_CPU_THERMAL=y
346CONFIG_THERMAL_EMULATION=y 370CONFIG_THERMAL_EMULATION=y
371CONFIG_ARMADA_THERMAL=y
347CONFIG_BRCMSTB_THERMAL=m 372CONFIG_BRCMSTB_THERMAL=m
348CONFIG_EXYNOS_THERMAL=y 373CONFIG_EXYNOS_THERMAL=y
349CONFIG_RCAR_GEN3_THERMAL=y 374CONFIG_RCAR_GEN3_THERMAL=y
@@ -362,6 +387,7 @@ CONFIG_MFD_AXP20X_RSB=y
362CONFIG_MFD_CROS_EC=y 387CONFIG_MFD_CROS_EC=y
363CONFIG_MFD_CROS_EC_I2C=y 388CONFIG_MFD_CROS_EC_I2C=y
364CONFIG_MFD_CROS_EC_SPI=y 389CONFIG_MFD_CROS_EC_SPI=y
390CONFIG_MFD_CROS_EC_CHARDEV=m
365CONFIG_MFD_EXYNOS_LPASS=m 391CONFIG_MFD_EXYNOS_LPASS=m
366CONFIG_MFD_HI6421_PMIC=y 392CONFIG_MFD_HI6421_PMIC=y
367CONFIG_MFD_HI655X_PMIC=y 393CONFIG_MFD_HI655X_PMIC=y
@@ -440,7 +466,8 @@ CONFIG_SND_BCM2835_SOC_I2S=m
440CONFIG_SND_SOC_SAMSUNG=y 466CONFIG_SND_SOC_SAMSUNG=y
441CONFIG_SND_SOC_RCAR=m 467CONFIG_SND_SOC_RCAR=m
442CONFIG_SND_SOC_AK4613=m 468CONFIG_SND_SOC_AK4613=m
443CONFIG_SND_SIMPLE_CARD=y 469CONFIG_SND_SIMPLE_CARD=m
470CONFIG_SND_AUDIO_GRAPH_CARD=m
444CONFIG_USB=y 471CONFIG_USB=y
445CONFIG_USB_OTG=y 472CONFIG_USB_OTG=y
446CONFIG_USB_XHCI_HCD=y 473CONFIG_USB_XHCI_HCD=y
@@ -486,6 +513,7 @@ CONFIG_MMC_SPI=y
486CONFIG_MMC_SDHI=y 513CONFIG_MMC_SDHI=y
487CONFIG_MMC_DW=y 514CONFIG_MMC_DW=y
488CONFIG_MMC_DW_EXYNOS=y 515CONFIG_MMC_DW_EXYNOS=y
516CONFIG_MMC_DW_HI3798CV200=y
489CONFIG_MMC_DW_K3=y 517CONFIG_MMC_DW_K3=y
490CONFIG_MMC_DW_ROCKCHIP=y 518CONFIG_MMC_DW_ROCKCHIP=y
491CONFIG_MMC_SUNXI=y 519CONFIG_MMC_SUNXI=y
@@ -515,6 +543,7 @@ CONFIG_RTC_DRV_SUN6I=y
515CONFIG_RTC_DRV_ARMADA38X=y 543CONFIG_RTC_DRV_ARMADA38X=y
516CONFIG_RTC_DRV_TEGRA=y 544CONFIG_RTC_DRV_TEGRA=y
517CONFIG_RTC_DRV_XGENE=y 545CONFIG_RTC_DRV_XGENE=y
546CONFIG_RTC_DRV_CROS_EC=y
518CONFIG_DMADEVICES=y 547CONFIG_DMADEVICES=y
519CONFIG_DMA_BCM2835=m 548CONFIG_DMA_BCM2835=m
520CONFIG_K3_DMA=y 549CONFIG_K3_DMA=y
@@ -557,6 +586,7 @@ CONFIG_TEGRA_IOMMU_SMMU=y
557CONFIG_ARM_SMMU=y 586CONFIG_ARM_SMMU=y
558CONFIG_ARM_SMMU_V3=y 587CONFIG_ARM_SMMU_V3=y
559CONFIG_QCOM_IOMMU=y 588CONFIG_QCOM_IOMMU=y
589CONFIG_RPMSG_QCOM_GLINK_RPM=y
560CONFIG_RPMSG_QCOM_SMD=y 590CONFIG_RPMSG_QCOM_SMD=y
561CONFIG_RASPBERRYPI_POWER=y 591CONFIG_RASPBERRYPI_POWER=y
562CONFIG_QCOM_SMEM=y 592CONFIG_QCOM_SMEM=y
@@ -568,12 +598,18 @@ CONFIG_ARCH_TEGRA_132_SOC=y
568CONFIG_ARCH_TEGRA_210_SOC=y 598CONFIG_ARCH_TEGRA_210_SOC=y
569CONFIG_ARCH_TEGRA_186_SOC=y 599CONFIG_ARCH_TEGRA_186_SOC=y
570CONFIG_ARCH_TEGRA_194_SOC=y 600CONFIG_ARCH_TEGRA_194_SOC=y
601CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND=y
571CONFIG_EXTCON_USB_GPIO=y 602CONFIG_EXTCON_USB_GPIO=y
603CONFIG_EXTCON_USBC_CROS_EC=y
572CONFIG_MEMORY=y 604CONFIG_MEMORY=y
573CONFIG_TEGRA_MC=y 605CONFIG_TEGRA_MC=y
574CONFIG_IIO=y 606CONFIG_IIO=y
575CONFIG_EXYNOS_ADC=y 607CONFIG_EXYNOS_ADC=y
576CONFIG_ROCKCHIP_SARADC=m 608CONFIG_ROCKCHIP_SARADC=m
609CONFIG_IIO_CROS_EC_SENSORS_CORE=m
610CONFIG_IIO_CROS_EC_SENSORS=m
611CONFIG_IIO_CROS_EC_LIGHT_PROX=m
612CONFIG_IIO_CROS_EC_BARO=m
577CONFIG_PWM=y 613CONFIG_PWM=y
578CONFIG_PWM_BCM2835=m 614CONFIG_PWM_BCM2835=m
579CONFIG_PWM_CROS_EC=m 615CONFIG_PWM_CROS_EC=m
@@ -582,21 +618,26 @@ CONFIG_PWM_RCAR=m
582CONFIG_PWM_ROCKCHIP=y 618CONFIG_PWM_ROCKCHIP=y
583CONFIG_PWM_SAMSUNG=y 619CONFIG_PWM_SAMSUNG=y
584CONFIG_PWM_TEGRA=m 620CONFIG_PWM_TEGRA=m
621CONFIG_PHY_HISTB_COMBPHY=y
622CONFIG_PHY_HISI_INNO_USB2=y
585CONFIG_PHY_RCAR_GEN3_USB2=y 623CONFIG_PHY_RCAR_GEN3_USB2=y
586CONFIG_PHY_RCAR_GEN3_USB3=m 624CONFIG_PHY_RCAR_GEN3_USB3=m
587CONFIG_PHY_HI6220_USB=y 625CONFIG_PHY_HI6220_USB=y
588CONFIG_PHY_QCOM_USB_HS=y 626CONFIG_PHY_QCOM_USB_HS=y
589CONFIG_PHY_SUN4I_USB=y 627CONFIG_PHY_SUN4I_USB=y
590CONFIG_PHY_MVEBU_CP110_COMPHY=y 628CONFIG_PHY_MVEBU_CP110_COMPHY=y
629CONFIG_PHY_QCOM_QMP=m
591CONFIG_PHY_ROCKCHIP_INNO_USB2=y 630CONFIG_PHY_ROCKCHIP_INNO_USB2=y
592CONFIG_PHY_ROCKCHIP_EMMC=y 631CONFIG_PHY_ROCKCHIP_EMMC=y
593CONFIG_PHY_ROCKCHIP_PCIE=m 632CONFIG_PHY_ROCKCHIP_PCIE=m
633CONFIG_PHY_ROCKCHIP_TYPEC=y
594CONFIG_PHY_XGENE=y 634CONFIG_PHY_XGENE=y
595CONFIG_PHY_TEGRA_XUSB=y 635CONFIG_PHY_TEGRA_XUSB=y
596CONFIG_QCOM_L2_PMU=y 636CONFIG_QCOM_L2_PMU=y
597CONFIG_QCOM_L3_PMU=y 637CONFIG_QCOM_L3_PMU=y
598CONFIG_MESON_EFUSE=m 638CONFIG_MESON_EFUSE=m
599CONFIG_QCOM_QFPROM=y 639CONFIG_QCOM_QFPROM=y
640CONFIG_ROCKCHIP_EFUSE=y
600CONFIG_UNIPHIER_EFUSE=y 641CONFIG_UNIPHIER_EFUSE=y
601CONFIG_TEE=y 642CONFIG_TEE=y
602CONFIG_OPTEE=y 643CONFIG_OPTEE=y
diff --git a/drivers/bus/ti-sysc.c b/drivers/bus/ti-sysc.c
index 7cd2fd04b212..1cc29629d238 100644
--- a/drivers/bus/ti-sysc.c
+++ b/drivers/bus/ti-sysc.c
@@ -19,6 +19,7 @@
19#include <linux/platform_device.h> 19#include <linux/platform_device.h>
20#include <linux/pm_domain.h> 20#include <linux/pm_domain.h>
21#include <linux/pm_runtime.h> 21#include <linux/pm_runtime.h>
22#include <linux/reset.h>
22#include <linux/of_address.h> 23#include <linux/of_address.h>
23#include <linux/of_platform.h> 24#include <linux/of_platform.h>
24#include <linux/slab.h> 25#include <linux/slab.h>
@@ -32,10 +33,18 @@ static const char * const reg_names[] = { "rev", "sysc", "syss", };
32enum sysc_clocks { 33enum sysc_clocks {
33 SYSC_FCK, 34 SYSC_FCK,
34 SYSC_ICK, 35 SYSC_ICK,
36 SYSC_OPTFCK0,
37 SYSC_OPTFCK1,
38 SYSC_OPTFCK2,
39 SYSC_OPTFCK3,
40 SYSC_OPTFCK4,
41 SYSC_OPTFCK5,
42 SYSC_OPTFCK6,
43 SYSC_OPTFCK7,
35 SYSC_MAX_CLOCKS, 44 SYSC_MAX_CLOCKS,
36}; 45};
37 46
38static const char * const clock_names[] = { "fck", "ick", }; 47static const char * const clock_names[SYSC_ICK + 1] = { "fck", "ick", };
39 48
40#define SYSC_IDLEMODE_MASK 3 49#define SYSC_IDLEMODE_MASK 3
41#define SYSC_CLOCKACTIVITY_MASK 3 50#define SYSC_CLOCKACTIVITY_MASK 3
@@ -48,6 +57,8 @@ static const char * const clock_names[] = { "fck", "ick", };
48 * @module_va: virtual address of the interconnect target module 57 * @module_va: virtual address of the interconnect target module
49 * @offsets: register offsets from module base 58 * @offsets: register offsets from module base
50 * @clocks: clocks used by the interconnect target module 59 * @clocks: clocks used by the interconnect target module
60 * @clock_roles: clock role names for the found clocks
61 * @nr_clocks: number of clocks used by the interconnect target module
51 * @legacy_mode: configured for legacy mode if set 62 * @legacy_mode: configured for legacy mode if set
52 * @cap: interconnect target module capabilities 63 * @cap: interconnect target module capabilities
53 * @cfg: interconnect target module configuration 64 * @cfg: interconnect target module configuration
@@ -61,7 +72,10 @@ struct sysc {
61 u32 module_size; 72 u32 module_size;
62 void __iomem *module_va; 73 void __iomem *module_va;
63 int offsets[SYSC_MAX_REGS]; 74 int offsets[SYSC_MAX_REGS];
64 struct clk *clocks[SYSC_MAX_CLOCKS]; 75 struct clk **clocks;
76 const char **clock_roles;
77 int nr_clocks;
78 struct reset_control *rsts;
65 const char *legacy_mode; 79 const char *legacy_mode;
66 const struct sysc_capabilities *cap; 80 const struct sysc_capabilities *cap;
67 struct sysc_config cfg; 81 struct sysc_config cfg;
@@ -88,6 +102,11 @@ static u32 sysc_read(struct sysc *ddata, int offset)
88 return readl_relaxed(ddata->module_va + offset); 102 return readl_relaxed(ddata->module_va + offset);
89} 103}
90 104
105static bool sysc_opt_clks_needed(struct sysc *ddata)
106{
107 return !!(ddata->cfg.quirks & SYSC_QUIRK_OPT_CLKS_NEEDED);
108}
109
91static u32 sysc_read_revision(struct sysc *ddata) 110static u32 sysc_read_revision(struct sysc *ddata)
92{ 111{
93 int offset = ddata->offsets[SYSC_REVISION]; 112 int offset = ddata->offsets[SYSC_REVISION];
@@ -98,21 +117,28 @@ static u32 sysc_read_revision(struct sysc *ddata)
98 return sysc_read(ddata, offset); 117 return sysc_read(ddata, offset);
99} 118}
100 119
101static int sysc_get_one_clock(struct sysc *ddata, 120static int sysc_get_one_clock(struct sysc *ddata, const char *name)
102 enum sysc_clocks index)
103{ 121{
104 const char *name; 122 int error, i, index = -ENODEV;
105 int error; 123
124 if (!strncmp(clock_names[SYSC_FCK], name, 3))
125 index = SYSC_FCK;
126 else if (!strncmp(clock_names[SYSC_ICK], name, 3))
127 index = SYSC_ICK;
128
129 if (index < 0) {
130 for (i = SYSC_OPTFCK0; i < SYSC_MAX_CLOCKS; i++) {
131 if (!ddata->clocks[i]) {
132 index = i;
133 break;
134 }
135 }
136 }
106 137
107 switch (index) { 138 if (index < 0) {
108 case SYSC_FCK: 139 dev_err(ddata->dev, "clock %s not added\n", name);
109 break; 140 return index;
110 case SYSC_ICK:
111 break;
112 default:
113 return -EINVAL;
114 } 141 }
115 name = clock_names[index];
116 142
117 ddata->clocks[index] = devm_clk_get(ddata->dev, name); 143 ddata->clocks[index] = devm_clk_get(ddata->dev, name);
118 if (IS_ERR(ddata->clocks[index])) { 144 if (IS_ERR(ddata->clocks[index])) {
@@ -138,10 +164,50 @@ static int sysc_get_one_clock(struct sysc *ddata,
138 164
139static int sysc_get_clocks(struct sysc *ddata) 165static int sysc_get_clocks(struct sysc *ddata)
140{ 166{
141 int i, error; 167 struct device_node *np = ddata->dev->of_node;
168 struct property *prop;
169 const char *name;
170 int nr_fck = 0, nr_ick = 0, i, error = 0;
142 171
143 for (i = 0; i < SYSC_MAX_CLOCKS; i++) { 172 ddata->clock_roles = devm_kzalloc(ddata->dev,
144 error = sysc_get_one_clock(ddata, i); 173 sizeof(*ddata->clock_roles) *
174 SYSC_MAX_CLOCKS,
175 GFP_KERNEL);
176 if (!ddata->clock_roles)
177 return -ENOMEM;
178
179 of_property_for_each_string(np, "clock-names", prop, name) {
180 if (!strncmp(clock_names[SYSC_FCK], name, 3))
181 nr_fck++;
182 if (!strncmp(clock_names[SYSC_ICK], name, 3))
183 nr_ick++;
184 ddata->clock_roles[ddata->nr_clocks] = name;
185 ddata->nr_clocks++;
186 }
187
188 if (ddata->nr_clocks < 1)
189 return 0;
190
191 if (ddata->nr_clocks > SYSC_MAX_CLOCKS) {
192 dev_err(ddata->dev, "too many clocks for %pOF\n", np);
193
194 return -EINVAL;
195 }
196
197 if (nr_fck > 1 || nr_ick > 1) {
198 dev_err(ddata->dev, "max one fck and ick for %pOF\n", np);
199
200 return -EINVAL;
201 }
202
203 ddata->clocks = devm_kzalloc(ddata->dev,
204 sizeof(*ddata->clocks) * ddata->nr_clocks,
205 GFP_KERNEL);
206 if (!ddata->clocks)
207 return -ENOMEM;
208
209 for (i = 0; i < ddata->nr_clocks; i++) {
210 error = sysc_get_one_clock(ddata, ddata->clock_roles[i]);
145 if (error && error != -ENOENT) 211 if (error && error != -ENOENT)
146 return error; 212 return error;
147 } 213 }
@@ -150,6 +216,42 @@ static int sysc_get_clocks(struct sysc *ddata)
150} 216}
151 217
152/** 218/**
219 * sysc_init_resets - reset module on init
220 * @ddata: device driver data
221 *
222 * A module can have both OCP softreset control and external rstctrl.
223 * If more complicated rstctrl resets are needed, please handle these
224 * directly from the child device driver and map only the module reset
225 * for the parent interconnect target module device.
226 *
227 * Automatic reset of the module on init can be skipped with the
228 * "ti,no-reset-on-init" device tree property.
229 */
230static int sysc_init_resets(struct sysc *ddata)
231{
232 int error;
233
234 ddata->rsts =
235 devm_reset_control_array_get_optional_exclusive(ddata->dev);
236 if (IS_ERR(ddata->rsts))
237 return PTR_ERR(ddata->rsts);
238
239 if (ddata->cfg.quirks & SYSC_QUIRK_NO_RESET_ON_INIT)
240 goto deassert;
241
242 error = reset_control_assert(ddata->rsts);
243 if (error)
244 return error;
245
246deassert:
247 error = reset_control_deassert(ddata->rsts);
248 if (error)
249 return error;
250
251 return 0;
252}
253
254/**
153 * sysc_parse_and_check_child_range - parses module IO region from ranges 255 * sysc_parse_and_check_child_range - parses module IO region from ranges
154 * @ddata: device driver data 256 * @ddata: device driver data
155 * 257 *
@@ -533,9 +635,13 @@ static int __maybe_unused sysc_runtime_suspend(struct device *dev)
533 goto idled; 635 goto idled;
534 } 636 }
535 637
536 for (i = 0; i < SYSC_MAX_CLOCKS; i++) { 638 for (i = 0; i < ddata->nr_clocks; i++) {
537 if (IS_ERR_OR_NULL(ddata->clocks[i])) 639 if (IS_ERR_OR_NULL(ddata->clocks[i]))
538 continue; 640 continue;
641
642 if (i >= SYSC_OPTFCK0 && !sysc_opt_clks_needed(ddata))
643 break;
644
539 clk_disable(ddata->clocks[i]); 645 clk_disable(ddata->clocks[i]);
540 } 646 }
541 647
@@ -572,9 +678,13 @@ static int __maybe_unused sysc_runtime_resume(struct device *dev)
572 goto awake; 678 goto awake;
573 } 679 }
574 680
575 for (i = 0; i < SYSC_MAX_CLOCKS; i++) { 681 for (i = 0; i < ddata->nr_clocks; i++) {
576 if (IS_ERR_OR_NULL(ddata->clocks[i])) 682 if (IS_ERR_OR_NULL(ddata->clocks[i]))
577 continue; 683 continue;
684
685 if (i >= SYSC_OPTFCK0 && !sysc_opt_clks_needed(ddata))
686 break;
687
578 error = clk_enable(ddata->clocks[i]); 688 error = clk_enable(ddata->clocks[i]);
579 if (error) 689 if (error)
580 return error; 690 return error;
@@ -590,23 +700,103 @@ awake:
590static int sysc_suspend(struct device *dev) 700static int sysc_suspend(struct device *dev)
591{ 701{
592 struct sysc *ddata; 702 struct sysc *ddata;
703 int error;
593 704
594 ddata = dev_get_drvdata(dev); 705 ddata = dev_get_drvdata(dev);
595 706
707 if (ddata->cfg.quirks & (SYSC_QUIRK_RESOURCE_PROVIDER |
708 SYSC_QUIRK_LEGACY_IDLE))
709 return 0;
710
596 if (!ddata->enabled) 711 if (!ddata->enabled)
597 return 0; 712 return 0;
598 713
714 dev_dbg(ddata->dev, "%s %s\n", __func__,
715 ddata->name ? ddata->name : "");
716
717 error = pm_runtime_put_sync_suspend(dev);
718 if (error < 0) {
719 dev_warn(ddata->dev, "%s not idle %i %s\n",
720 __func__, error,
721 ddata->name ? ddata->name : "");
722
723 return 0;
724 }
725
599 ddata->needs_resume = true; 726 ddata->needs_resume = true;
600 727
601 return sysc_runtime_suspend(dev); 728 return 0;
602} 729}
603 730
604static int sysc_resume(struct device *dev) 731static int sysc_resume(struct device *dev)
605{ 732{
606 struct sysc *ddata; 733 struct sysc *ddata;
734 int error;
735
736 ddata = dev_get_drvdata(dev);
737
738 if (ddata->cfg.quirks & (SYSC_QUIRK_RESOURCE_PROVIDER |
739 SYSC_QUIRK_LEGACY_IDLE))
740 return 0;
741
742 if (ddata->needs_resume) {
743 dev_dbg(ddata->dev, "%s %s\n", __func__,
744 ddata->name ? ddata->name : "");
745
746 error = pm_runtime_get_sync(dev);
747 if (error < 0) {
748 dev_err(ddata->dev, "%s error %i %s\n",
749 __func__, error,
750 ddata->name ? ddata->name : "");
751
752 return error;
753 }
754
755 ddata->needs_resume = false;
756 }
757
758 return 0;
759}
760
761static int sysc_noirq_suspend(struct device *dev)
762{
763 struct sysc *ddata;
607 764
608 ddata = dev_get_drvdata(dev); 765 ddata = dev_get_drvdata(dev);
766
767 if (ddata->cfg.quirks & SYSC_QUIRK_LEGACY_IDLE)
768 return 0;
769
770 if (!(ddata->cfg.quirks & SYSC_QUIRK_RESOURCE_PROVIDER))
771 return 0;
772
773 if (!ddata->enabled)
774 return 0;
775
776 dev_dbg(ddata->dev, "%s %s\n", __func__,
777 ddata->name ? ddata->name : "");
778
779 ddata->needs_resume = true;
780
781 return sysc_runtime_suspend(dev);
782}
783
784static int sysc_noirq_resume(struct device *dev)
785{
786 struct sysc *ddata;
787
788 ddata = dev_get_drvdata(dev);
789
790 if (ddata->cfg.quirks & SYSC_QUIRK_LEGACY_IDLE)
791 return 0;
792
793 if (!(ddata->cfg.quirks & SYSC_QUIRK_RESOURCE_PROVIDER))
794 return 0;
795
609 if (ddata->needs_resume) { 796 if (ddata->needs_resume) {
797 dev_dbg(ddata->dev, "%s %s\n", __func__,
798 ddata->name ? ddata->name : "");
799
610 ddata->needs_resume = false; 800 ddata->needs_resume = false;
611 801
612 return sysc_runtime_resume(dev); 802 return sysc_runtime_resume(dev);
@@ -618,6 +808,7 @@ static int sysc_resume(struct device *dev)
618 808
619static const struct dev_pm_ops sysc_pm_ops = { 809static const struct dev_pm_ops sysc_pm_ops = {
620 SET_SYSTEM_SLEEP_PM_OPS(sysc_suspend, sysc_resume) 810 SET_SYSTEM_SLEEP_PM_OPS(sysc_suspend, sysc_resume)
811 SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(sysc_noirq_suspend, sysc_noirq_resume)
621 SET_RUNTIME_PM_OPS(sysc_runtime_suspend, 812 SET_RUNTIME_PM_OPS(sysc_runtime_suspend,
622 sysc_runtime_resume, 813 sysc_runtime_resume,
623 NULL) 814 NULL)
@@ -649,9 +840,29 @@ struct sysc_revision_quirk {
649 } 840 }
650 841
651static const struct sysc_revision_quirk sysc_revision_quirks[] = { 842static const struct sysc_revision_quirk sysc_revision_quirks[] = {
843 /* These need to use noirq_suspend */
844 SYSC_QUIRK("control", 0, 0, 0x10, -1, 0x40000900, 0xffffffff,
845 SYSC_QUIRK_RESOURCE_PROVIDER),
846 SYSC_QUIRK("i2c", 0, 0, 0x10, 0x90, 0x5040000a, 0xffffffff,
847 SYSC_QUIRK_RESOURCE_PROVIDER),
848 SYSC_QUIRK("mcspi", 0, 0, 0x10, -1, 0x40300a0b, 0xffffffff,
849 SYSC_QUIRK_RESOURCE_PROVIDER),
850 SYSC_QUIRK("prcm", 0, 0, -1, -1, 0x40000100, 0xffffffff,
851 SYSC_QUIRK_RESOURCE_PROVIDER),
852 SYSC_QUIRK("ocp2scp", 0, 0, 0x10, 0x14, 0x50060005, 0xffffffff,
853 SYSC_QUIRK_RESOURCE_PROVIDER),
854 SYSC_QUIRK("padconf", 0, 0, 0x10, -1, 0x4fff0800, 0xffffffff,
855 SYSC_QUIRK_RESOURCE_PROVIDER),
856 SYSC_QUIRK("scm", 0, 0, 0x10, -1, 0x40000900, 0xffffffff,
857 SYSC_QUIRK_RESOURCE_PROVIDER),
858 SYSC_QUIRK("scrm", 0, 0, -1, -1, 0x00000010, 0xffffffff,
859 SYSC_QUIRK_RESOURCE_PROVIDER),
860 SYSC_QUIRK("sdma", 0, 0, 0x2c, 0x28, 0x00010900, 0xffffffff,
861 SYSC_QUIRK_RESOURCE_PROVIDER),
862
652 /* These drivers need to be fixed to not use pm_runtime_irq_safe() */ 863 /* These drivers need to be fixed to not use pm_runtime_irq_safe() */
653 SYSC_QUIRK("gpio", 0, 0, 0x10, 0x114, 0x50600801, 0xffffffff, 864 SYSC_QUIRK("gpio", 0, 0, 0x10, 0x114, 0x50600801, 0xffffffff,
654 SYSC_QUIRK_LEGACY_IDLE), 865 SYSC_QUIRK_LEGACY_IDLE | SYSC_QUIRK_OPT_CLKS_IN_RESET),
655 SYSC_QUIRK("mmu", 0, 0, 0x10, 0x14, 0x00000020, 0xffffffff, 866 SYSC_QUIRK("mmu", 0, 0, 0x10, 0x14, 0x00000020, 0xffffffff,
656 SYSC_QUIRK_LEGACY_IDLE), 867 SYSC_QUIRK_LEGACY_IDLE),
657 SYSC_QUIRK("mmu", 0, 0, 0x10, 0x14, 0x00000030, 0xffffffff, 868 SYSC_QUIRK("mmu", 0, 0, 0x10, 0x14, 0x00000030, 0xffffffff,
@@ -664,8 +875,40 @@ static const struct sysc_revision_quirk sysc_revision_quirks[] = {
664 SYSC_QUIRK_LEGACY_IDLE), 875 SYSC_QUIRK_LEGACY_IDLE),
665 SYSC_QUIRK("timer", 0, 0, 0x10, 0x14, 0x00000015, 0xffffffff, 876 SYSC_QUIRK("timer", 0, 0, 0x10, 0x14, 0x00000015, 0xffffffff,
666 SYSC_QUIRK_LEGACY_IDLE), 877 SYSC_QUIRK_LEGACY_IDLE),
878 /* Some timers on omap4 and later */
879 SYSC_QUIRK("timer", 0, 0, 0x10, -1, 0x4fff1301, 0xffffffff,
880 SYSC_QUIRK_LEGACY_IDLE),
667 SYSC_QUIRK("uart", 0, 0x50, 0x54, 0x58, 0x00000052, 0xffffffff, 881 SYSC_QUIRK("uart", 0, 0x50, 0x54, 0x58, 0x00000052, 0xffffffff,
668 SYSC_QUIRK_LEGACY_IDLE), 882 SYSC_QUIRK_LEGACY_IDLE),
883 /* Uarts on omap4 and later */
884 SYSC_QUIRK("uart", 0, 0x50, 0x54, 0x58, 0x50411e03, 0xffffffff,
885 SYSC_QUIRK_LEGACY_IDLE),
886
887 /* These devices don't yet suspend properly without legacy setting */
888 SYSC_QUIRK("sdio", 0, 0, 0x10, -1, 0x40202301, 0xffffffff,
889 SYSC_QUIRK_LEGACY_IDLE),
890 SYSC_QUIRK("wdt", 0, 0, 0x10, 0x14, 0x502a0500, 0xffffffff,
891 SYSC_QUIRK_LEGACY_IDLE),
892 SYSC_QUIRK("wdt", 0, 0, 0x10, 0x14, 0x502a0d00, 0xffffffff,
893 SYSC_QUIRK_LEGACY_IDLE),
894
895#ifdef DEBUG
896 SYSC_QUIRK("aess", 0, 0, 0x10, -1, 0x40000000, 0xffffffff, 0),
897 SYSC_QUIRK("gpu", 0, 0x1fc00, 0x1fc10, -1, 0, 0, 0),
898 SYSC_QUIRK("hdq1w", 0, 0, 0x14, 0x18, 0x00000006, 0xffffffff, 0),
899 SYSC_QUIRK("hsi", 0, 0, 0x10, 0x14, 0x50043101, 0xffffffff, 0),
900 SYSC_QUIRK("iss", 0, 0, 0x10, -1, 0x40000101, 0xffffffff, 0),
901 SYSC_QUIRK("mcasp", 0, 0, 0x4, -1, 0x44306302, 0xffffffff, 0),
902 SYSC_QUIRK("mcbsp", 0, -1, 0x8c, -1, 0, 0, 0),
903 SYSC_QUIRK("mailbox", 0, 0, 0x10, -1, 0x00000400, 0xffffffff, 0),
904 SYSC_QUIRK("slimbus", 0, 0, 0x10, -1, 0x40000902, 0xffffffff, 0),
905 SYSC_QUIRK("slimbus", 0, 0, 0x10, -1, 0x40002903, 0xffffffff, 0),
906 SYSC_QUIRK("spinlock", 0, 0, 0x10, -1, 0x50020000, 0xffffffff, 0),
907 SYSC_QUIRK("usbhstll", 0, 0, 0x10, 0x14, 0x00000004, 0xffffffff, 0),
908 SYSC_QUIRK("usb_host_hs", 0, 0, 0x10, 0x14, 0x50700100, 0xffffffff, 0),
909 SYSC_QUIRK("usb_otg_hs", 0, 0x400, 0x404, 0x408, 0x00000050,
910 0xffffffff, 0),
911#endif
669}; 912};
670 913
671static void sysc_init_revision_quirks(struct sysc *ddata) 914static void sysc_init_revision_quirks(struct sysc *ddata)
@@ -716,6 +959,7 @@ static int sysc_init_module(struct sysc *ddata)
716 959
717 return 0; 960 return 0;
718 } 961 }
962
719 ddata->revision = sysc_read_revision(ddata); 963 ddata->revision = sysc_read_revision(ddata);
720 pm_runtime_put_sync(ddata->dev); 964 pm_runtime_put_sync(ddata->dev);
721 965
@@ -811,29 +1055,58 @@ static int sysc_init_syss_mask(struct sysc *ddata)
811} 1055}
812 1056
813/* 1057/*
814 * Many child device drivers need to have fck available to get the clock 1058 * Many child device drivers need to have fck and opt clocks available
815 * rate for device internal configuration. 1059 * to get the clock rate for device internal configuration etc.
816 */ 1060 */
817static int sysc_child_add_fck(struct sysc *ddata, 1061static int sysc_child_add_named_clock(struct sysc *ddata,
818 struct device *child) 1062 struct device *child,
1063 const char *name)
819{ 1064{
820 struct clk *fck; 1065 struct clk *clk;
821 struct clk_lookup *l; 1066 struct clk_lookup *l;
822 const char *name = clock_names[SYSC_FCK]; 1067 int error = 0;
823 1068
824 if (IS_ERR_OR_NULL(ddata->clocks[SYSC_FCK])) 1069 if (!name)
825 return 0; 1070 return 0;
826 1071
827 fck = clk_get(child, name); 1072 clk = clk_get(child, name);
828 if (!IS_ERR(fck)) { 1073 if (!IS_ERR(clk)) {
829 clk_put(fck); 1074 clk_put(clk);
830 1075
831 return -EEXIST; 1076 return -EEXIST;
832 } 1077 }
833 1078
834 l = clkdev_create(ddata->clocks[SYSC_FCK], name, dev_name(child)); 1079 clk = clk_get(ddata->dev, name);
1080 if (IS_ERR(clk))
1081 return -ENODEV;
1082
1083 l = clkdev_create(clk, name, dev_name(child));
1084 if (!l)
1085 error = -ENOMEM;
1086
1087 clk_put(clk);
1088
1089 return error;
1090}
1091
1092static int sysc_child_add_clocks(struct sysc *ddata,
1093 struct device *child)
1094{
1095 int i, error;
1096
1097 for (i = 0; i < ddata->nr_clocks; i++) {
1098 error = sysc_child_add_named_clock(ddata,
1099 child,
1100 ddata->clock_roles[i]);
1101 if (error && error != -EEXIST) {
1102 dev_err(ddata->dev, "could not add child clock %s: %i\n",
1103 ddata->clock_roles[i], error);
1104
1105 return error;
1106 }
1107 }
835 1108
836 return l ? 0 : -ENODEV; 1109 return 0;
837} 1110}
838 1111
839static struct device_type sysc_device_type = { 1112static struct device_type sysc_device_type = {
@@ -891,18 +1164,33 @@ static int sysc_child_suspend_noirq(struct device *dev)
891 1164
892 ddata = sysc_child_to_parent(dev); 1165 ddata = sysc_child_to_parent(dev);
893 1166
1167 dev_dbg(ddata->dev, "%s %s\n", __func__,
1168 ddata->name ? ddata->name : "");
1169
894 error = pm_generic_suspend_noirq(dev); 1170 error = pm_generic_suspend_noirq(dev);
895 if (error) 1171 if (error) {
1172 dev_err(dev, "%s error at %i: %i\n",
1173 __func__, __LINE__, error);
1174
896 return error; 1175 return error;
1176 }
897 1177
898 if (!pm_runtime_status_suspended(dev)) { 1178 if (!pm_runtime_status_suspended(dev)) {
899 error = pm_generic_runtime_suspend(dev); 1179 error = pm_generic_runtime_suspend(dev);
900 if (error) 1180 if (error) {
1181 dev_err(dev, "%s error at %i: %i\n",
1182 __func__, __LINE__, error);
1183
901 return error; 1184 return error;
1185 }
902 1186
903 error = sysc_runtime_suspend(ddata->dev); 1187 error = sysc_runtime_suspend(ddata->dev);
904 if (error) 1188 if (error) {
1189 dev_err(dev, "%s error at %i: %i\n",
1190 __func__, __LINE__, error);
1191
905 return error; 1192 return error;
1193 }
906 1194
907 ddata->child_needs_resume = true; 1195 ddata->child_needs_resume = true;
908 } 1196 }
@@ -917,6 +1205,9 @@ static int sysc_child_resume_noirq(struct device *dev)
917 1205
918 ddata = sysc_child_to_parent(dev); 1206 ddata = sysc_child_to_parent(dev);
919 1207
1208 dev_dbg(ddata->dev, "%s %s\n", __func__,
1209 ddata->name ? ddata->name : "");
1210
920 if (ddata->child_needs_resume) { 1211 if (ddata->child_needs_resume) {
921 ddata->child_needs_resume = false; 1212 ddata->child_needs_resume = false;
922 1213
@@ -983,10 +1274,9 @@ static int sysc_notifier_call(struct notifier_block *nb,
983 1274
984 switch (event) { 1275 switch (event) {
985 case BUS_NOTIFY_ADD_DEVICE: 1276 case BUS_NOTIFY_ADD_DEVICE:
986 error = sysc_child_add_fck(ddata, dev); 1277 error = sysc_child_add_clocks(ddata, dev);
987 if (error && error != -EEXIST) 1278 if (error)
988 dev_warn(ddata->dev, "could not add %s fck: %i\n", 1279 return error;
989 dev_name(dev), error);
990 sysc_legacy_idle_quirk(ddata, dev); 1280 sysc_legacy_idle_quirk(ddata, dev);
991 break; 1281 break;
992 default: 1282 default:
@@ -1314,6 +1604,11 @@ static void ti_sysc_idle(struct work_struct *work)
1314 pm_runtime_put_sync(ddata->dev); 1604 pm_runtime_put_sync(ddata->dev);
1315} 1605}
1316 1606
1607static const struct of_device_id sysc_match_table[] = {
1608 { .compatible = "simple-bus", },
1609 { /* sentinel */ },
1610};
1611
1317static int sysc_probe(struct platform_device *pdev) 1612static int sysc_probe(struct platform_device *pdev)
1318{ 1613{
1319 struct ti_sysc_platform_data *pdata = dev_get_platdata(&pdev->dev); 1614 struct ti_sysc_platform_data *pdata = dev_get_platdata(&pdev->dev);
@@ -1359,8 +1654,11 @@ static int sysc_probe(struct platform_device *pdev)
1359 if (error) 1654 if (error)
1360 goto unprepare; 1655 goto unprepare;
1361 1656
1362 pm_runtime_enable(ddata->dev); 1657 error = sysc_init_resets(ddata);
1658 if (error)
1659 return error;
1363 1660
1661 pm_runtime_enable(ddata->dev);
1364 error = sysc_init_module(ddata); 1662 error = sysc_init_module(ddata);
1365 if (error) 1663 if (error)
1366 goto unprepare; 1664 goto unprepare;
@@ -1375,8 +1673,8 @@ static int sysc_probe(struct platform_device *pdev)
1375 sysc_show_registers(ddata); 1673 sysc_show_registers(ddata);
1376 1674
1377 ddata->dev->type = &sysc_device_type; 1675 ddata->dev->type = &sysc_device_type;
1378 error = of_platform_populate(ddata->dev->of_node, 1676 error = of_platform_populate(ddata->dev->of_node, sysc_match_table,
1379 NULL, pdata ? pdata->auxdata : NULL, 1677 pdata ? pdata->auxdata : NULL,
1380 ddata->dev); 1678 ddata->dev);
1381 if (error) 1679 if (error)
1382 goto err; 1680 goto err;
@@ -1391,6 +1689,9 @@ static int sysc_probe(struct platform_device *pdev)
1391 pm_runtime_put(&pdev->dev); 1689 pm_runtime_put(&pdev->dev);
1392 } 1690 }
1393 1691
1692 if (!of_get_available_child_count(ddata->dev->of_node))
1693 reset_control_assert(ddata->rsts);
1694
1394 return 0; 1695 return 0;
1395 1696
1396err: 1697err:
@@ -1420,6 +1721,7 @@ static int sysc_remove(struct platform_device *pdev)
1420 1721
1421 pm_runtime_put_sync(&pdev->dev); 1722 pm_runtime_put_sync(&pdev->dev);
1422 pm_runtime_disable(&pdev->dev); 1723 pm_runtime_disable(&pdev->dev);
1724 reset_control_assert(ddata->rsts);
1423 1725
1424unprepare: 1726unprepare:
1425 sysc_unprepare(ddata); 1727 sysc_unprepare(ddata);
diff --git a/drivers/media/rc/ir-rx51.c b/drivers/media/rc/ir-rx51.c
index 49265f02e772..8a93f7468622 100644
--- a/drivers/media/rc/ir-rx51.c
+++ b/drivers/media/rc/ir-rx51.c
@@ -22,7 +22,6 @@
22#include <linux/hrtimer.h> 22#include <linux/hrtimer.h>
23 23
24#include <media/rc-core.h> 24#include <media/rc-core.h>
25#include <linux/platform_data/media/ir-rx51.h>
26 25
27#define WBUF_LEN 256 26#define WBUF_LEN 256
28 27
@@ -31,7 +30,6 @@ struct ir_rx51 {
31 struct pwm_device *pwm; 30 struct pwm_device *pwm;
32 struct hrtimer timer; 31 struct hrtimer timer;
33 struct device *dev; 32 struct device *dev;
34 struct ir_rx51_platform_data *pdata;
35 wait_queue_head_t wqueue; 33 wait_queue_head_t wqueue;
36 34
37 unsigned int freq; /* carrier frequency */ 35 unsigned int freq; /* carrier frequency */
@@ -130,10 +128,9 @@ static int ir_rx51_tx(struct rc_dev *dev, unsigned int *buffer,
130 ir_rx51->wbuf[count] = -1; /* Insert termination mark */ 128 ir_rx51->wbuf[count] = -1; /* Insert termination mark */
131 129
132 /* 130 /*
133 * Adjust latency requirements so the device doesn't go in too 131 * REVISIT: Adjust latency requirements so the device doesn't go in too
134 * deep sleep states 132 * deep sleep states with pm_qos_add_request().
135 */ 133 */
136 ir_rx51->pdata->set_max_mpu_wakeup_lat(ir_rx51->dev, 50);
137 134
138 ir_rx51_on(ir_rx51); 135 ir_rx51_on(ir_rx51);
139 ir_rx51->wbuf_index = 1; 136 ir_rx51->wbuf_index = 1;
@@ -146,8 +143,7 @@ static int ir_rx51_tx(struct rc_dev *dev, unsigned int *buffer,
146 */ 143 */
147 wait_event_interruptible(ir_rx51->wqueue, ir_rx51->wbuf_index < 0); 144 wait_event_interruptible(ir_rx51->wqueue, ir_rx51->wbuf_index < 0);
148 145
149 /* We can sleep again */ 146 /* REVISIT: Remove pm_qos constraint, we can sleep again */
150 ir_rx51->pdata->set_max_mpu_wakeup_lat(ir_rx51->dev, -1);
151 147
152 return count; 148 return count;
153} 149}
@@ -244,13 +240,6 @@ static int ir_rx51_probe(struct platform_device *dev)
244 struct pwm_device *pwm; 240 struct pwm_device *pwm;
245 struct rc_dev *rcdev; 241 struct rc_dev *rcdev;
246 242
247 ir_rx51.pdata = dev->dev.platform_data;
248
249 if (!ir_rx51.pdata) {
250 dev_err(&dev->dev, "Platform Data is missing\n");
251 return -ENXIO;
252 }
253
254 pwm = pwm_get(&dev->dev, NULL); 243 pwm = pwm_get(&dev->dev, NULL);
255 if (IS_ERR(pwm)) { 244 if (IS_ERR(pwm)) {
256 int err = PTR_ERR(pwm); 245 int err = PTR_ERR(pwm);
diff --git a/drivers/mtd/nand/raw/davinci_nand.c b/drivers/mtd/nand/raw/davinci_nand.c
index 7255a0d94374..cd12e5abafde 100644
--- a/drivers/mtd/nand/raw/davinci_nand.c
+++ b/drivers/mtd/nand/raw/davinci_nand.c
@@ -545,7 +545,7 @@ static struct davinci_nand_pdata
545 return ERR_PTR(-ENOMEM); 545 return ERR_PTR(-ENOMEM);
546 if (!of_property_read_u32(pdev->dev.of_node, 546 if (!of_property_read_u32(pdev->dev.of_node,
547 "ti,davinci-chipselect", &prop)) 547 "ti,davinci-chipselect", &prop))
548 pdev->id = prop; 548 pdata->core_chipsel = prop;
549 else 549 else
550 return ERR_PTR(-EINVAL); 550 return ERR_PTR(-EINVAL);
551 551
@@ -627,7 +627,7 @@ static int nand_davinci_probe(struct platform_device *pdev)
627 return -ENODEV; 627 return -ENODEV;
628 628
629 /* which external chipselect will we be managing? */ 629 /* which external chipselect will we be managing? */
630 if (pdev->id < 0 || pdev->id > 3) 630 if (pdata->core_chipsel < 0 || pdata->core_chipsel > 3)
631 return -ENODEV; 631 return -ENODEV;
632 632
633 info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); 633 info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
@@ -683,7 +683,7 @@ static int nand_davinci_probe(struct platform_device *pdev)
683 info->ioaddr = (uint32_t __force) vaddr; 683 info->ioaddr = (uint32_t __force) vaddr;
684 684
685 info->current_cs = info->ioaddr; 685 info->current_cs = info->ioaddr;
686 info->core_chipsel = pdev->id; 686 info->core_chipsel = pdata->core_chipsel;
687 info->mask_chipsel = pdata->mask_chipsel; 687 info->mask_chipsel = pdata->mask_chipsel;
688 688
689 /* use nandboot-capable ALE/CLE masks by default */ 689 /* use nandboot-capable ALE/CLE masks by default */
diff --git a/drivers/soc/renesas/Kconfig b/drivers/soc/renesas/Kconfig
index 3bbe6114a420..1d824cbd462d 100644
--- a/drivers/soc/renesas/Kconfig
+++ b/drivers/soc/renesas/Kconfig
@@ -4,9 +4,11 @@ config SOC_RENESAS
4 select SOC_BUS 4 select SOC_BUS
5 select RST_RCAR if ARCH_RCAR_GEN1 || ARCH_RCAR_GEN2 || \ 5 select RST_RCAR if ARCH_RCAR_GEN1 || ARCH_RCAR_GEN2 || \
6 ARCH_R8A7795 || ARCH_R8A7796 || ARCH_R8A77965 || \ 6 ARCH_R8A7795 || ARCH_R8A7796 || ARCH_R8A77965 || \
7 ARCH_R8A77970 || ARCH_R8A77980 || ARCH_R8A77995 7 ARCH_R8A77970 || ARCH_R8A77980 || ARCH_R8A77990 || \
8 ARCH_R8A77995
8 select SYSC_R8A7743 if ARCH_R8A7743 9 select SYSC_R8A7743 if ARCH_R8A7743
9 select SYSC_R8A7745 if ARCH_R8A7745 10 select SYSC_R8A7745 if ARCH_R8A7745
11 select SYSC_R8A77470 if ARCH_R8A77470
10 select SYSC_R8A7779 if ARCH_R8A7779 12 select SYSC_R8A7779 if ARCH_R8A7779
11 select SYSC_R8A7790 if ARCH_R8A7790 13 select SYSC_R8A7790 if ARCH_R8A7790
12 select SYSC_R8A7791 if ARCH_R8A7791 || ARCH_R8A7793 14 select SYSC_R8A7791 if ARCH_R8A7791 || ARCH_R8A7793
@@ -17,6 +19,7 @@ config SOC_RENESAS
17 select SYSC_R8A77965 if ARCH_R8A77965 19 select SYSC_R8A77965 if ARCH_R8A77965
18 select SYSC_R8A77970 if ARCH_R8A77970 20 select SYSC_R8A77970 if ARCH_R8A77970
19 select SYSC_R8A77980 if ARCH_R8A77980 21 select SYSC_R8A77980 if ARCH_R8A77980
22 select SYSC_R8A77990 if ARCH_R8A77990
20 select SYSC_R8A77995 if ARCH_R8A77995 23 select SYSC_R8A77995 if ARCH_R8A77995
21 24
22if SOC_RENESAS 25if SOC_RENESAS
@@ -30,6 +33,10 @@ config SYSC_R8A7745
30 bool "RZ/G1E System Controller support" if COMPILE_TEST 33 bool "RZ/G1E System Controller support" if COMPILE_TEST
31 select SYSC_RCAR 34 select SYSC_RCAR
32 35
36config SYSC_R8A77470
37 bool "RZ/G1C System Controller support" if COMPILE_TEST
38 select SYSC_RCAR
39
33config SYSC_R8A7779 40config SYSC_R8A7779
34 bool "R-Car H1 System Controller support" if COMPILE_TEST 41 bool "R-Car H1 System Controller support" if COMPILE_TEST
35 select SYSC_RCAR 42 select SYSC_RCAR
@@ -70,6 +77,10 @@ config SYSC_R8A77980
70 bool "R-Car V3H System Controller support" if COMPILE_TEST 77 bool "R-Car V3H System Controller support" if COMPILE_TEST
71 select SYSC_RCAR 78 select SYSC_RCAR
72 79
80config SYSC_R8A77990
81 bool "R-Car E3 System Controller support" if COMPILE_TEST
82 select SYSC_RCAR
83
73config SYSC_R8A77995 84config SYSC_R8A77995
74 bool "R-Car D3 System Controller support" if COMPILE_TEST 85 bool "R-Car D3 System Controller support" if COMPILE_TEST
75 select SYSC_RCAR 86 select SYSC_RCAR
diff --git a/drivers/soc/renesas/Makefile b/drivers/soc/renesas/Makefile
index ccb5ec57a262..7dc0f20d7907 100644
--- a/drivers/soc/renesas/Makefile
+++ b/drivers/soc/renesas/Makefile
@@ -5,6 +5,7 @@ obj-$(CONFIG_SOC_RENESAS) += renesas-soc.o
5# SoC 5# SoC
6obj-$(CONFIG_SYSC_R8A7743) += r8a7743-sysc.o 6obj-$(CONFIG_SYSC_R8A7743) += r8a7743-sysc.o
7obj-$(CONFIG_SYSC_R8A7745) += r8a7745-sysc.o 7obj-$(CONFIG_SYSC_R8A7745) += r8a7745-sysc.o
8obj-$(CONFIG_SYSC_R8A77470) += r8a77470-sysc.o
8obj-$(CONFIG_SYSC_R8A7779) += r8a7779-sysc.o 9obj-$(CONFIG_SYSC_R8A7779) += r8a7779-sysc.o
9obj-$(CONFIG_SYSC_R8A7790) += r8a7790-sysc.o 10obj-$(CONFIG_SYSC_R8A7790) += r8a7790-sysc.o
10obj-$(CONFIG_SYSC_R8A7791) += r8a7791-sysc.o 11obj-$(CONFIG_SYSC_R8A7791) += r8a7791-sysc.o
@@ -15,6 +16,7 @@ obj-$(CONFIG_SYSC_R8A7796) += r8a7796-sysc.o
15obj-$(CONFIG_SYSC_R8A77965) += r8a77965-sysc.o 16obj-$(CONFIG_SYSC_R8A77965) += r8a77965-sysc.o
16obj-$(CONFIG_SYSC_R8A77970) += r8a77970-sysc.o 17obj-$(CONFIG_SYSC_R8A77970) += r8a77970-sysc.o
17obj-$(CONFIG_SYSC_R8A77980) += r8a77980-sysc.o 18obj-$(CONFIG_SYSC_R8A77980) += r8a77980-sysc.o
19obj-$(CONFIG_SYSC_R8A77990) += r8a77990-sysc.o
18obj-$(CONFIG_SYSC_R8A77995) += r8a77995-sysc.o 20obj-$(CONFIG_SYSC_R8A77995) += r8a77995-sysc.o
19 21
20# Family 22# Family
diff --git a/drivers/soc/renesas/r8a77470-sysc.c b/drivers/soc/renesas/r8a77470-sysc.c
new file mode 100644
index 000000000000..cfa015e208ef
--- /dev/null
+++ b/drivers/soc/renesas/r8a77470-sysc.c
@@ -0,0 +1,29 @@
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Renesas RZ/G1C System Controller
4 *
5 * Copyright (C) 2018 Renesas Electronics Corp.
6 */
7
8#include <linux/bug.h>
9#include <linux/kernel.h>
10
11#include <dt-bindings/power/r8a77470-sysc.h>
12
13#include "rcar-sysc.h"
14
15static const struct rcar_sysc_area r8a77470_areas[] __initconst = {
16 { "always-on", 0, 0, R8A77470_PD_ALWAYS_ON, -1, PD_ALWAYS_ON },
17 { "ca7-scu", 0x100, 0, R8A77470_PD_CA7_SCU, R8A77470_PD_ALWAYS_ON,
18 PD_SCU },
19 { "ca7-cpu0", 0x1c0, 0, R8A77470_PD_CA7_CPU0, R8A77470_PD_CA7_SCU,
20 PD_CPU_NOCR },
21 { "ca7-cpu1", 0x1c0, 1, R8A77470_PD_CA7_CPU1, R8A77470_PD_CA7_SCU,
22 PD_CPU_NOCR },
23 { "sgx", 0xc0, 0, R8A77470_PD_SGX, R8A77470_PD_ALWAYS_ON },
24};
25
26const struct rcar_sysc_info r8a77470_sysc_info __initconst = {
27 .areas = r8a77470_areas,
28 .num_areas = ARRAY_SIZE(r8a77470_areas),
29};
diff --git a/drivers/soc/renesas/r8a77990-sysc.c b/drivers/soc/renesas/r8a77990-sysc.c
new file mode 100644
index 000000000000..15579ebc5ed2
--- /dev/null
+++ b/drivers/soc/renesas/r8a77990-sysc.c
@@ -0,0 +1,68 @@
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Renesas R-Car E3 System Controller
4 *
5 * Copyright (C) 2018 Renesas Electronics Corp.
6 */
7
8#include <linux/bug.h>
9#include <linux/kernel.h>
10#include <linux/sys_soc.h>
11
12#include <dt-bindings/power/r8a77990-sysc.h>
13
14#include "rcar-sysc.h"
15
16static struct rcar_sysc_area r8a77990_areas[] __initdata = {
17 { "always-on", 0, 0, R8A77990_PD_ALWAYS_ON, -1, PD_ALWAYS_ON },
18 { "ca53-scu", 0x140, 0, R8A77990_PD_CA53_SCU, R8A77990_PD_ALWAYS_ON,
19 PD_SCU },
20 { "ca53-cpu0", 0x200, 0, R8A77990_PD_CA53_CPU0, R8A77990_PD_CA53_SCU,
21 PD_CPU_NOCR },
22 { "ca53-cpu1", 0x200, 1, R8A77990_PD_CA53_CPU1, R8A77990_PD_CA53_SCU,
23 PD_CPU_NOCR },
24 { "cr7", 0x240, 0, R8A77990_PD_CR7, R8A77990_PD_ALWAYS_ON },
25 { "a3vc", 0x380, 0, R8A77990_PD_A3VC, R8A77990_PD_ALWAYS_ON },
26 { "a2vc1", 0x3c0, 1, R8A77990_PD_A2VC1, R8A77990_PD_A3VC },
27 { "3dg-a", 0x100, 0, R8A77990_PD_3DG_A, R8A77990_PD_ALWAYS_ON },
28 { "3dg-b", 0x100, 1, R8A77990_PD_3DG_B, R8A77990_PD_3DG_A },
29};
30
31static void __init rcar_sysc_fix_parent(struct rcar_sysc_area *areas,
32 unsigned int num_areas, u8 id,
33 int new_parent)
34{
35 unsigned int i;
36
37 for (i = 0; i < num_areas; i++)
38 if (areas[i].isr_bit == id) {
39 areas[i].parent = new_parent;
40 return;
41 }
42}
43
44/* Fixups for R-Car E3 ES1.0 revision */
45static const struct soc_device_attribute r8a77990[] __initconst = {
46 { .soc_id = "r8a77990", .revision = "ES1.0" },
47 { /* sentinel */ }
48};
49
50static int __init r8a77990_sysc_init(void)
51{
52 if (soc_device_match(r8a77990)) {
53 rcar_sysc_fix_parent(r8a77990_areas,
54 ARRAY_SIZE(r8a77990_areas),
55 R8A77990_PD_3DG_A, R8A77990_PD_3DG_B);
56 rcar_sysc_fix_parent(r8a77990_areas,
57 ARRAY_SIZE(r8a77990_areas),
58 R8A77990_PD_3DG_B, R8A77990_PD_ALWAYS_ON);
59 }
60
61 return 0;
62}
63
64const struct rcar_sysc_info r8a77990_sysc_info __initconst = {
65 .init = r8a77990_sysc_init,
66 .areas = r8a77990_areas,
67 .num_areas = ARRAY_SIZE(r8a77990_areas),
68};
diff --git a/drivers/soc/renesas/r8a77995-sysc.c b/drivers/soc/renesas/r8a77995-sysc.c
index f718429cab02..1b2ef415bbe1 100644
--- a/drivers/soc/renesas/r8a77995-sysc.c
+++ b/drivers/soc/renesas/r8a77995-sysc.c
@@ -10,13 +10,12 @@
10 10
11#include <linux/bug.h> 11#include <linux/bug.h>
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/sys_soc.h>
14 13
15#include <dt-bindings/power/r8a77995-sysc.h> 14#include <dt-bindings/power/r8a77995-sysc.h>
16 15
17#include "rcar-sysc.h" 16#include "rcar-sysc.h"
18 17
19static struct rcar_sysc_area r8a77995_areas[] __initdata = { 18static const struct rcar_sysc_area r8a77995_areas[] __initconst = {
20 { "always-on", 0, 0, R8A77995_PD_ALWAYS_ON, -1, PD_ALWAYS_ON }, 19 { "always-on", 0, 0, R8A77995_PD_ALWAYS_ON, -1, PD_ALWAYS_ON },
21 { "ca53-scu", 0x140, 0, R8A77995_PD_CA53_SCU, R8A77995_PD_ALWAYS_ON, 20 { "ca53-scu", 0x140, 0, R8A77995_PD_CA53_SCU, R8A77995_PD_ALWAYS_ON,
22 PD_SCU }, 21 PD_SCU },
diff --git a/drivers/soc/renesas/rcar-rst.c b/drivers/soc/renesas/rcar-rst.c
index 8e9cb7996ab0..d9c1034e70e9 100644
--- a/drivers/soc/renesas/rcar-rst.c
+++ b/drivers/soc/renesas/rcar-rst.c
@@ -44,6 +44,7 @@ static const struct of_device_id rcar_rst_matches[] __initconst = {
44 /* RZ/G is handled like R-Car Gen2 */ 44 /* RZ/G is handled like R-Car Gen2 */
45 { .compatible = "renesas,r8a7743-rst", .data = &rcar_rst_gen2 }, 45 { .compatible = "renesas,r8a7743-rst", .data = &rcar_rst_gen2 },
46 { .compatible = "renesas,r8a7745-rst", .data = &rcar_rst_gen2 }, 46 { .compatible = "renesas,r8a7745-rst", .data = &rcar_rst_gen2 },
47 { .compatible = "renesas,r8a77470-rst", .data = &rcar_rst_gen2 },
47 /* R-Car Gen1 */ 48 /* R-Car Gen1 */
48 { .compatible = "renesas,r8a7778-reset-wdt", .data = &rcar_rst_gen1 }, 49 { .compatible = "renesas,r8a7778-reset-wdt", .data = &rcar_rst_gen1 },
49 { .compatible = "renesas,r8a7779-reset-wdt", .data = &rcar_rst_gen1 }, 50 { .compatible = "renesas,r8a7779-reset-wdt", .data = &rcar_rst_gen1 },
@@ -59,6 +60,7 @@ static const struct of_device_id rcar_rst_matches[] __initconst = {
59 { .compatible = "renesas,r8a77965-rst", .data = &rcar_rst_gen3 }, 60 { .compatible = "renesas,r8a77965-rst", .data = &rcar_rst_gen3 },
60 { .compatible = "renesas,r8a77970-rst", .data = &rcar_rst_gen3 }, 61 { .compatible = "renesas,r8a77970-rst", .data = &rcar_rst_gen3 },
61 { .compatible = "renesas,r8a77980-rst", .data = &rcar_rst_gen3 }, 62 { .compatible = "renesas,r8a77980-rst", .data = &rcar_rst_gen3 },
63 { .compatible = "renesas,r8a77990-rst", .data = &rcar_rst_gen3 },
62 { .compatible = "renesas,r8a77995-rst", .data = &rcar_rst_gen3 }, 64 { .compatible = "renesas,r8a77995-rst", .data = &rcar_rst_gen3 },
63 { /* sentinel */ } 65 { /* sentinel */ }
64}; 66};
diff --git a/drivers/soc/renesas/rcar-sysc.c b/drivers/soc/renesas/rcar-sysc.c
index faf20e719361..95120acc4d80 100644
--- a/drivers/soc/renesas/rcar-sysc.c
+++ b/drivers/soc/renesas/rcar-sysc.c
@@ -261,6 +261,9 @@ static const struct of_device_id rcar_sysc_matches[] __initconst = {
261#ifdef CONFIG_SYSC_R8A7745 261#ifdef CONFIG_SYSC_R8A7745
262 { .compatible = "renesas,r8a7745-sysc", .data = &r8a7745_sysc_info }, 262 { .compatible = "renesas,r8a7745-sysc", .data = &r8a7745_sysc_info },
263#endif 263#endif
264#ifdef CONFIG_SYSC_R8A77470
265 { .compatible = "renesas,r8a77470-sysc", .data = &r8a77470_sysc_info },
266#endif
264#ifdef CONFIG_SYSC_R8A7779 267#ifdef CONFIG_SYSC_R8A7779
265 { .compatible = "renesas,r8a7779-sysc", .data = &r8a7779_sysc_info }, 268 { .compatible = "renesas,r8a7779-sysc", .data = &r8a7779_sysc_info },
266#endif 269#endif
@@ -293,6 +296,9 @@ static const struct of_device_id rcar_sysc_matches[] __initconst = {
293#ifdef CONFIG_SYSC_R8A77980 296#ifdef CONFIG_SYSC_R8A77980
294 { .compatible = "renesas,r8a77980-sysc", .data = &r8a77980_sysc_info }, 297 { .compatible = "renesas,r8a77980-sysc", .data = &r8a77980_sysc_info },
295#endif 298#endif
299#ifdef CONFIG_SYSC_R8A77990
300 { .compatible = "renesas,r8a77990-sysc", .data = &r8a77990_sysc_info },
301#endif
296#ifdef CONFIG_SYSC_R8A77995 302#ifdef CONFIG_SYSC_R8A77995
297 { .compatible = "renesas,r8a77995-sysc", .data = &r8a77995_sysc_info }, 303 { .compatible = "renesas,r8a77995-sysc", .data = &r8a77995_sysc_info },
298#endif 304#endif
diff --git a/drivers/soc/renesas/rcar-sysc.h b/drivers/soc/renesas/rcar-sysc.h
index dcdc9ec8eba7..a22e7cf25e30 100644
--- a/drivers/soc/renesas/rcar-sysc.h
+++ b/drivers/soc/renesas/rcar-sysc.h
@@ -51,6 +51,7 @@ struct rcar_sysc_info {
51 51
52extern const struct rcar_sysc_info r8a7743_sysc_info; 52extern const struct rcar_sysc_info r8a7743_sysc_info;
53extern const struct rcar_sysc_info r8a7745_sysc_info; 53extern const struct rcar_sysc_info r8a7745_sysc_info;
54extern const struct rcar_sysc_info r8a77470_sysc_info;
54extern const struct rcar_sysc_info r8a7779_sysc_info; 55extern const struct rcar_sysc_info r8a7779_sysc_info;
55extern const struct rcar_sysc_info r8a7790_sysc_info; 56extern const struct rcar_sysc_info r8a7790_sysc_info;
56extern const struct rcar_sysc_info r8a7791_sysc_info; 57extern const struct rcar_sysc_info r8a7791_sysc_info;
@@ -61,6 +62,7 @@ extern const struct rcar_sysc_info r8a7796_sysc_info;
61extern const struct rcar_sysc_info r8a77965_sysc_info; 62extern const struct rcar_sysc_info r8a77965_sysc_info;
62extern const struct rcar_sysc_info r8a77970_sysc_info; 63extern const struct rcar_sysc_info r8a77970_sysc_info;
63extern const struct rcar_sysc_info r8a77980_sysc_info; 64extern const struct rcar_sysc_info r8a77980_sysc_info;
65extern const struct rcar_sysc_info r8a77990_sysc_info;
64extern const struct rcar_sysc_info r8a77995_sysc_info; 66extern const struct rcar_sysc_info r8a77995_sysc_info;
65 67
66 68
diff --git a/drivers/soc/renesas/renesas-soc.c b/drivers/soc/renesas/renesas-soc.c
index ea71c413c926..d44d0e687ab8 100644
--- a/drivers/soc/renesas/renesas-soc.c
+++ b/drivers/soc/renesas/renesas-soc.c
@@ -100,6 +100,11 @@ static const struct renesas_soc soc_rz_g1e __initconst __maybe_unused = {
100 .id = 0x4c, 100 .id = 0x4c,
101}; 101};
102 102
103static const struct renesas_soc soc_rz_g1c __initconst __maybe_unused = {
104 .family = &fam_rzg,
105 .id = 0x53,
106};
107
103static const struct renesas_soc soc_rcar_m1a __initconst __maybe_unused = { 108static const struct renesas_soc soc_rcar_m1a __initconst __maybe_unused = {
104 .family = &fam_rcar_gen1, 109 .family = &fam_rcar_gen1,
105}; 110};
@@ -159,6 +164,11 @@ static const struct renesas_soc soc_rcar_v3h __initconst __maybe_unused = {
159 .id = 0x56, 164 .id = 0x56,
160}; 165};
161 166
167static const struct renesas_soc soc_rcar_e3 __initconst __maybe_unused = {
168 .family = &fam_rcar_gen3,
169 .id = 0x57,
170};
171
162static const struct renesas_soc soc_rcar_d3 __initconst __maybe_unused = { 172static const struct renesas_soc soc_rcar_d3 __initconst __maybe_unused = {
163 .family = &fam_rcar_gen3, 173 .family = &fam_rcar_gen3,
164 .id = 0x58, 174 .id = 0x58,
@@ -192,6 +202,9 @@ static const struct of_device_id renesas_socs[] __initconst = {
192#ifdef CONFIG_ARCH_R8A7745 202#ifdef CONFIG_ARCH_R8A7745
193 { .compatible = "renesas,r8a7745", .data = &soc_rz_g1e }, 203 { .compatible = "renesas,r8a7745", .data = &soc_rz_g1e },
194#endif 204#endif
205#ifdef CONFIG_ARCH_R8A77470
206 { .compatible = "renesas,r8a77470", .data = &soc_rz_g1c },
207#endif
195#ifdef CONFIG_ARCH_R8A7778 208#ifdef CONFIG_ARCH_R8A7778
196 { .compatible = "renesas,r8a7778", .data = &soc_rcar_m1a }, 209 { .compatible = "renesas,r8a7778", .data = &soc_rcar_m1a },
197#endif 210#endif
@@ -228,6 +241,9 @@ static const struct of_device_id renesas_socs[] __initconst = {
228#ifdef CONFIG_ARCH_R8A77980 241#ifdef CONFIG_ARCH_R8A77980
229 { .compatible = "renesas,r8a77980", .data = &soc_rcar_v3h }, 242 { .compatible = "renesas,r8a77980", .data = &soc_rcar_v3h },
230#endif 243#endif
244#ifdef CONFIG_ARCH_R8A77990
245 { .compatible = "renesas,r8a77990", .data = &soc_rcar_e3 },
246#endif
231#ifdef CONFIG_ARCH_R8A77995 247#ifdef CONFIG_ARCH_R8A77995
232 { .compatible = "renesas,r8a77995", .data = &soc_rcar_d3 }, 248 { .compatible = "renesas,r8a77995", .data = &soc_rcar_d3 },
233#endif 249#endif
diff --git a/include/dt-bindings/power/r8a77470-sysc.h b/include/dt-bindings/power/r8a77470-sysc.h
new file mode 100644
index 000000000000..8bf4db187c31
--- /dev/null
+++ b/include/dt-bindings/power/r8a77470-sysc.h
@@ -0,0 +1,22 @@
1/* SPDX-License-Identifier: GPL-2.0
2 *
3 * Copyright (C) 2018 Renesas Electronics Corp.
4 */
5#ifndef __DT_BINDINGS_POWER_R8A77470_SYSC_H__
6#define __DT_BINDINGS_POWER_R8A77470_SYSC_H__
7
8/*
9 * These power domain indices match the numbers of the interrupt bits
10 * representing the power areas in the various Interrupt Registers
11 * (e.g. SYSCISR, Interrupt Status Register)
12 */
13
14#define R8A77470_PD_CA7_CPU0 5
15#define R8A77470_PD_CA7_CPU1 6
16#define R8A77470_PD_SGX 20
17#define R8A77470_PD_CA7_SCU 21
18
19/* Always-on power area */
20#define R8A77470_PD_ALWAYS_ON 32
21
22#endif /* __DT_BINDINGS_POWER_R8A77470_SYSC_H__ */
diff --git a/include/dt-bindings/power/r8a77990-sysc.h b/include/dt-bindings/power/r8a77990-sysc.h
new file mode 100644
index 000000000000..944d85beec15
--- /dev/null
+++ b/include/dt-bindings/power/r8a77990-sysc.h
@@ -0,0 +1,26 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Copyright (C) 2018 Renesas Electronics Corp.
4 */
5#ifndef __DT_BINDINGS_POWER_R8A77990_SYSC_H__
6#define __DT_BINDINGS_POWER_R8A77990_SYSC_H__
7
8/*
9 * These power domain indices match the numbers of the interrupt bits
10 * representing the power areas in the various Interrupt Registers
11 * (e.g. SYSCISR, Interrupt Status Register)
12 */
13
14#define R8A77990_PD_CA53_CPU0 5
15#define R8A77990_PD_CA53_CPU1 6
16#define R8A77990_PD_CR7 13
17#define R8A77990_PD_A3VC 14
18#define R8A77990_PD_3DG_A 17
19#define R8A77990_PD_3DG_B 18
20#define R8A77990_PD_CA53_SCU 21
21#define R8A77990_PD_A2VC1 26
22
23/* Always-on power area */
24#define R8A77990_PD_ALWAYS_ON 32
25
26#endif /* __DT_BINDINGS_POWER_R8A77990_SYSC_H__ */
diff --git a/include/linux/platform_data/media/ir-rx51.h b/include/linux/platform_data/media/ir-rx51.h
deleted file mode 100644
index 9d127aa648e7..000000000000
--- a/include/linux/platform_data/media/ir-rx51.h
+++ /dev/null
@@ -1,9 +0,0 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _IR_RX51_H
3#define _IR_RX51_H
4
5struct ir_rx51_platform_data {
6 int(*set_max_mpu_wakeup_lat)(struct device *dev, long t);
7};
8
9#endif
diff --git a/include/linux/platform_data/mtd-davinci.h b/include/linux/platform_data/mtd-davinci.h
index f1a2cf655bdb..1bbfa27cccb4 100644
--- a/include/linux/platform_data/mtd-davinci.h
+++ b/include/linux/platform_data/mtd-davinci.h
@@ -56,6 +56,16 @@ struct davinci_nand_pdata { /* platform_data */
56 uint32_t mask_ale; 56 uint32_t mask_ale;
57 uint32_t mask_cle; 57 uint32_t mask_cle;
58 58
59 /*
60 * 0-indexed chip-select number of the asynchronous
61 * interface to which the NAND device has been connected.
62 *
63 * So, if you have NAND connected to CS3 of DA850, you
64 * will pass '1' here. Since the asynchronous interface
65 * on DA850 starts from CS2.
66 */
67 uint32_t core_chipsel;
68
59 /* for packages using two chipselects */ 69 /* for packages using two chipselects */
60 uint32_t mask_chipsel; 70 uint32_t mask_chipsel;
61 71
diff --git a/include/linux/platform_data/spi-imx.h b/include/linux/platform_data/spi-imx.h
index 6f012fefa1a2..328f670d10bd 100644
--- a/include/linux/platform_data/spi-imx.h
+++ b/include/linux/platform_data/spi-imx.h
@@ -5,24 +5,29 @@
5 5
6/* 6/*
7 * struct spi_imx_master - device.platform_data for SPI controller devices. 7 * struct spi_imx_master - device.platform_data for SPI controller devices.
8 * @chipselect: Array of chipselects for this master. Numbers >= 0 mean gpio 8 * @chipselect: Array of chipselects for this master or NULL. Numbers >= 0
9 * pins, numbers < 0 mean internal CSPI chipselects according 9 * mean GPIO pins, -ENOENT means internal CSPI chipselect
10 * to MXC_SPI_CS(). Normally you want to use gpio based chip 10 * matching the position in the array. E.g., if chipselect[1] =
11 * selects as the CSPI module tries to be intelligent about 11 * -ENOENT then a SPI slave using chip select 1 will use the
12 * when to assert the chipselect: The CSPI module deasserts the 12 * native SS1 line of the CSPI. Omitting the array will use
13 * chipselect once it runs out of input data. The other problem 13 * all native chip selects.
14 * is that it is not possible to mix between high active and low 14
15 * active chipselects on one single bus using the internal 15 * Normally you want to use gpio based chip selects as the CSPI
16 * chipselects. Unfortunately Freescale decided to put some 16 * module tries to be intelligent about when to assert the
17 * chipselect: The CSPI module deasserts the chipselect once it
18 * runs out of input data. The other problem is that it is not
19 * possible to mix between high active and low active chipselects
20 * on one single bus using the internal chipselects.
21 * Unfortunately, on some SoCs, Freescale decided to put some
17 * chipselects on dedicated pins which are not usable as gpios, 22 * chipselects on dedicated pins which are not usable as gpios,
18 * so we have to support the internal chipselects. 23 * so we have to support the internal chipselects.
19 * @num_chipselect: ARRAY_SIZE(chipselect) 24 *
25 * @num_chipselect: If @chipselect is specified, ARRAY_SIZE(chipselect),
26 * otherwise the number of native chip selects.
20 */ 27 */
21struct spi_imx_master { 28struct spi_imx_master {
22 int *chipselect; 29 int *chipselect;
23 int num_chipselect; 30 int num_chipselect;
24}; 31};
25 32
26#define MXC_SPI_CS(no) ((no) - 32)
27
28#endif /* __MACH_SPI_H_*/ 33#endif /* __MACH_SPI_H_*/
diff --git a/include/linux/platform_data/ti-sysc.h b/include/linux/platform_data/ti-sysc.h
index 80ce28d40832..990aad477458 100644
--- a/include/linux/platform_data/ti-sysc.h
+++ b/include/linux/platform_data/ti-sysc.h
@@ -45,6 +45,7 @@ struct sysc_regbits {
45 s8 emufree_shift; 45 s8 emufree_shift;
46}; 46};
47 47
48#define SYSC_QUIRK_RESOURCE_PROVIDER BIT(9)
48#define SYSC_QUIRK_LEGACY_IDLE BIT(8) 49#define SYSC_QUIRK_LEGACY_IDLE BIT(8)
49#define SYSC_QUIRK_RESET_STATUS BIT(7) 50#define SYSC_QUIRK_RESET_STATUS BIT(7)
50#define SYSC_QUIRK_NO_IDLE_ON_INIT BIT(6) 51#define SYSC_QUIRK_NO_IDLE_ON_INIT BIT(6)
diff --git a/sound/soc/omap/ams-delta.c b/sound/soc/omap/ams-delta.c
index 77a30f0f0c96..4dce494dfbd3 100644
--- a/sound/soc/omap/ams-delta.c
+++ b/sound/soc/omap/ams-delta.c
@@ -22,7 +22,7 @@
22 * 22 *
23 */ 23 */
24 24
25#include <linux/gpio.h> 25#include <linux/gpio/consumer.h>
26#include <linux/spinlock.h> 26#include <linux/spinlock.h>
27#include <linux/tty.h> 27#include <linux/tty.h>
28#include <linux/module.h> 28#include <linux/module.h>
@@ -32,7 +32,6 @@
32 32
33#include <asm/mach-types.h> 33#include <asm/mach-types.h>
34 34
35#include <mach/board-ams-delta.h>
36#include <linux/platform_data/asoc-ti-mcbsp.h> 35#include <linux/platform_data/asoc-ti-mcbsp.h>
37 36
38#include "omap-mcbsp.h" 37#include "omap-mcbsp.h"
@@ -213,7 +212,6 @@ static const struct snd_kcontrol_new ams_delta_audio_controls[] = {
213static struct snd_soc_jack ams_delta_hook_switch; 212static struct snd_soc_jack ams_delta_hook_switch;
214static struct snd_soc_jack_gpio ams_delta_hook_switch_gpios[] = { 213static struct snd_soc_jack_gpio ams_delta_hook_switch_gpios[] = {
215 { 214 {
216 .gpio = 4,
217 .name = "hook_switch", 215 .name = "hook_switch",
218 .report = SND_JACK_HEADSET, 216 .report = SND_JACK_HEADSET,
219 .invert = 1, 217 .invert = 1,
@@ -259,6 +257,7 @@ static struct timer_list cx81801_timer;
259static bool cx81801_cmd_pending; 257static bool cx81801_cmd_pending;
260static bool ams_delta_muted; 258static bool ams_delta_muted;
261static DEFINE_SPINLOCK(ams_delta_lock); 259static DEFINE_SPINLOCK(ams_delta_lock);
260static struct gpio_desc *gpiod_modem_codec;
262 261
263static void cx81801_timeout(struct timer_list *unused) 262static void cx81801_timeout(struct timer_list *unused)
264{ 263{
@@ -272,7 +271,7 @@ static void cx81801_timeout(struct timer_list *unused)
272 /* Reconnect the codec DAI back from the modem to the CPU DAI 271 /* Reconnect the codec DAI back from the modem to the CPU DAI
273 * only if digital mute still off */ 272 * only if digital mute still off */
274 if (!muted) 273 if (!muted)
275 ams_delta_latch2_write(AMS_DELTA_LATCH2_MODEM_CODEC, 0); 274 gpiod_set_value(gpiod_modem_codec, 0);
276} 275}
277 276
278/* Line discipline .open() */ 277/* Line discipline .open() */
@@ -381,8 +380,7 @@ static void cx81801_receive(struct tty_struct *tty,
381 /* Apply config pulse by connecting the codec to the modem 380 /* Apply config pulse by connecting the codec to the modem
382 * if not already done */ 381 * if not already done */
383 if (apply) 382 if (apply)
384 ams_delta_latch2_write(AMS_DELTA_LATCH2_MODEM_CODEC, 383 gpiod_set_value(gpiod_modem_codec, 1);
385 AMS_DELTA_LATCH2_MODEM_CODEC);
386 break; 384 break;
387 } 385 }
388} 386}
@@ -432,8 +430,7 @@ static int ams_delta_digital_mute(struct snd_soc_dai *dai, int mute)
432 spin_unlock_bh(&ams_delta_lock); 430 spin_unlock_bh(&ams_delta_lock);
433 431
434 if (apply) 432 if (apply)
435 ams_delta_latch2_write(AMS_DELTA_LATCH2_MODEM_CODEC, 433 gpiod_set_value(gpiod_modem_codec, !!mute);
436 mute ? AMS_DELTA_LATCH2_MODEM_CODEC : 0);
437 return 0; 434 return 0;
438} 435}
439 436
@@ -469,14 +466,6 @@ static int ams_delta_cx20442_init(struct snd_soc_pcm_runtime *rtd)
469 /* Store a pointer to the codec structure for tty ldisc use */ 466 /* Store a pointer to the codec structure for tty ldisc use */
470 cx20442_codec = rtd->codec_dai->component; 467 cx20442_codec = rtd->codec_dai->component;
471 468
472 /* Set up digital mute if not provided by the codec */
473 if (!codec_dai->driver->ops) {
474 codec_dai->driver->ops = &ams_delta_dai_ops;
475 } else {
476 ams_delta_ops.startup = ams_delta_startup;
477 ams_delta_ops.shutdown = ams_delta_shutdown;
478 }
479
480 /* Add hook switch - can be used to control the codec from userspace 469 /* Add hook switch - can be used to control the codec from userspace
481 * even if line discipline fails */ 470 * even if line discipline fails */
482 ret = snd_soc_card_jack_new(card, "hook_switch", SND_JACK_HEADSET, 471 ret = snd_soc_card_jack_new(card, "hook_switch", SND_JACK_HEADSET,
@@ -486,7 +475,7 @@ static int ams_delta_cx20442_init(struct snd_soc_pcm_runtime *rtd)
486 "Failed to allocate resources for hook switch, " 475 "Failed to allocate resources for hook switch, "
487 "will continue without one.\n"); 476 "will continue without one.\n");
488 else { 477 else {
489 ret = snd_soc_jack_add_gpios(&ams_delta_hook_switch, 478 ret = snd_soc_jack_add_gpiods(card->dev, &ams_delta_hook_switch,
490 ARRAY_SIZE(ams_delta_hook_switch_gpios), 479 ARRAY_SIZE(ams_delta_hook_switch_gpios),
491 ams_delta_hook_switch_gpios); 480 ams_delta_hook_switch_gpios);
492 if (ret) 481 if (ret)
@@ -495,6 +484,21 @@ static int ams_delta_cx20442_init(struct snd_soc_pcm_runtime *rtd)
495 "will continue with hook switch inactive.\n"); 484 "will continue with hook switch inactive.\n");
496 } 485 }
497 486
487 gpiod_modem_codec = devm_gpiod_get(card->dev, "modem_codec",
488 GPIOD_OUT_HIGH);
489 if (IS_ERR(gpiod_modem_codec)) {
490 dev_warn(card->dev, "Failed to obtain modem_codec GPIO\n");
491 return 0;
492 }
493
494 /* Set up digital mute if not provided by the codec */
495 if (!codec_dai->driver->ops) {
496 codec_dai->driver->ops = &ams_delta_dai_ops;
497 } else {
498 ams_delta_ops.startup = ams_delta_startup;
499 ams_delta_ops.shutdown = ams_delta_shutdown;
500 }
501
498 /* Register optional line discipline for over the modem control */ 502 /* Register optional line discipline for over the modem control */
499 ret = tty_register_ldisc(N_V253, &cx81801_ops); 503 ret = tty_register_ldisc(N_V253, &cx81801_ops);
500 if (ret) { 504 if (ret) {