aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-06-02 19:14:07 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-06-02 19:14:07 -0400
commit0a58471541cc823ef8056d23945c39fec154481c (patch)
tree04a8499be0659ac16f82f3b0d0d8d2c2ccafe4dd /arch/arm
parentff933a0817f95efbeb97bec5ca609a13f8aed686 (diff)
parent08d38bebb4dcd6414944f8277ea5ea30010664fe (diff)
Merge tag 'cleanup-for-3.16' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc into next
Pull ARM SoC cleanups from Olof Johansson: "Cleanups for 3.16. Among these are: - a bunch of misc cleanups for Broadcom platforms, mostly housekeeping - enabling Common Clock Framework on the older s3c24xx Samsung chipsets - cleanup of the Versatile Express system controller code, moving it to syscon - power management cleanups for OMAP platforms plus a handful of other cleanups across the place" * tag 'cleanup-for-3.16' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (87 commits) ARM: kconfig: allow PCI support to be selected with ARCH_MULTIPLATFORM clk: samsung: fix build error ARM: vexpress: refine dependencies for new code clk: samsung: clk-s3c2410-dlck: do not use PNAME macro as it declares __initdata cpufreq: exynos: Fix the compile error ARM: S3C24XX: move debug-macro.S into the common space ARM: S3C24XX: use generic DEBUG_UART_PHY/_VIRT in debug macro ARM: S3C24XX: trim down debug uart handling ARM: compressed/head.S: remove s3c24xx special case ARM: EXYNOS: Remove unnecessary inclusion of cpu.h ARM: EXYNOS: Migrate Exynos specific macros from plat to mach ARM: EXYNOS: Remove exynos_subsys registration ARM: EXYNOS: Remove duplicate lines in Makefile ARM: EXYNOS: use v7_exit_coherency_flush macro for cache disabling ARM: OMAP4: PRCM: remove references to cm-regbits-44xx.h from PRCM core files ARM: OMAP3/4: PRM: add support of late_init call to prm_ll_ops ARM: OMAP3/OMAP4: PRM: add prm_features flags and add IO wakeup under it ARM: OMAP3/4: PRM: provide io chain reconfig function through irq setup ARM: OMAP2+: PRM: remove unnecessary cpu_is_XXX calls from prm_init / exit ARM: OMAP2+: PRCM: cleanup some header includes ...
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/Kconfig1
-rw-r--r--arch/arm/Kconfig.debug54
-rw-r--r--arch/arm/boot/compressed/head.S5
-rw-r--r--arch/arm/boot/dts/atlas6.dtsi1
-rw-r--r--arch/arm/boot/dts/prima2.dtsi1
-rw-r--r--arch/arm/boot/dts/s3c2416-smdk2416.dts13
-rw-r--r--arch/arm/boot/dts/s3c2416.dtsi42
-rw-r--r--arch/arm/boot/dts/vexpress-v2m-rs1.dtsi76
-rw-r--r--arch/arm/boot/dts/vexpress-v2m.dtsi76
-rw-r--r--arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts5
-rw-r--r--arch/arm/configs/realview-smp_defconfig2
-rw-r--r--arch/arm/configs/realview_defconfig2
-rw-r--r--arch/arm/configs/versatile_defconfig3
-rw-r--r--arch/arm/include/debug/s3c24xx.S46
-rw-r--r--arch/arm/mach-bcm/Kconfig49
-rw-r--r--arch/arm/mach-bcm/Makefile21
-rw-r--r--arch/arm/mach-bcm/bcm_kona_smc.c136
-rw-r--r--arch/arm/mach-bcm/bcm_kona_smc.h52
-rw-r--r--arch/arm/mach-bcm/bcm_kona_smc_asm.S41
-rw-r--r--arch/arm/mach-bcm/board_bcm21664.c5
-rw-r--r--arch/arm/mach-bcm/board_bcm281xx.c2
-rw-r--r--arch/arm/mach-bcm/kona_l2_cache.c (renamed from arch/arm/mach-bcm/kona.c)16
-rw-r--r--arch/arm/mach-bcm/kona_l2_cache.h (renamed from arch/arm/mach-bcm/kona.h)6
-rw-r--r--arch/arm/mach-cns3xxx/Kconfig1
-rw-r--r--arch/arm/mach-exynos/Makefile7
-rw-r--r--arch/arm/mach-exynos/common.h72
-rw-r--r--arch/arm/mach-exynos/cpuidle.c1
-rw-r--r--arch/arm/mach-exynos/exynos.c13
-rw-r--r--arch/arm/mach-exynos/firmware.c3
-rw-r--r--arch/arm/mach-exynos/hotplug.c65
-rw-r--r--arch/arm/mach-exynos/platsmp.c2
-rw-r--r--arch/arm/mach-exynos/pm.c1
-rw-r--r--arch/arm/mach-exynos/pmu.c2
-rw-r--r--arch/arm/mach-imx/Kconfig1
-rw-r--r--arch/arm/mach-mvebu/Kconfig7
-rw-r--r--arch/arm/mach-omap2/board-flash.c4
-rw-r--r--arch/arm/mach-omap2/clkt2xxx_dpllcore.c2
-rw-r--r--arch/arm/mach-omap2/clkt2xxx_osc.c8
-rw-r--r--arch/arm/mach-omap2/clkt2xxx_sys.c2
-rw-r--r--arch/arm/mach-omap2/clockdomain.h3
-rw-r--r--arch/arm/mach-omap2/cm2xxx.c15
-rw-r--r--arch/arm/mach-omap2/cm2xxx_3xxx.h4
-rw-r--r--arch/arm/mach-omap2/cm33xx.c4
-rw-r--r--arch/arm/mach-omap2/cm33xx.h3
-rw-r--r--arch/arm/mach-omap2/cm3xxx.c25
-rw-r--r--arch/arm/mach-omap2/cm3xxx.h5
-rw-r--r--arch/arm/mach-omap2/cm44xx.c11
-rw-r--r--arch/arm/mach-omap2/cm_common.c2
-rw-r--r--arch/arm/mach-omap2/cminst44xx.c14
-rw-r--r--arch/arm/mach-omap2/control.c20
-rw-r--r--arch/arm/mach-omap2/dma.c4
-rw-r--r--arch/arm/mach-omap2/gpmc.c8
-rw-r--r--arch/arm/mach-omap2/id.c2
-rw-r--r--arch/arm/mach-omap2/irq.c4
-rw-r--r--arch/arm/mach-omap2/mux.c8
-rw-r--r--arch/arm/mach-omap2/omap-hotplug.c4
-rw-r--r--arch/arm/mach-omap2/omap-mpuss-lowpower.c18
-rw-r--r--arch/arm/mach-omap2/omap-smp.c6
-rw-r--r--arch/arm/mach-omap2/omap-wakeupgen.c42
-rw-r--r--arch/arm/mach-omap2/omap4-common.c18
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.c10
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c1
-rw-r--r--arch/arm/mach-omap2/omap_phy_internal.c6
-rw-r--r--arch/arm/mach-omap2/powerdomain-common.c1
-rw-r--r--arch/arm/mach-omap2/powerdomain.c1
-rw-r--r--arch/arm/mach-omap2/powerdomain.h3
-rw-r--r--arch/arm/mach-omap2/prcm-common.h24
-rw-r--r--arch/arm/mach-omap2/prcm_mpu44xx.c4
-rw-r--r--arch/arm/mach-omap2/prcm_mpu44xx.h1
-rw-r--r--arch/arm/mach-omap2/prm.h10
-rw-r--r--arch/arm/mach-omap2/prm2xxx.c13
-rw-r--r--arch/arm/mach-omap2/prm2xxx.h2
-rw-r--r--arch/arm/mach-omap2/prm2xxx_3xxx.c1
-rw-r--r--arch/arm/mach-omap2/prm2xxx_3xxx.h4
-rw-r--r--arch/arm/mach-omap2/prm33xx.c5
-rw-r--r--arch/arm/mach-omap2/prm3xxx.c22
-rw-r--r--arch/arm/mach-omap2/prm3xxx.h2
-rw-r--r--arch/arm/mach-omap2/prm44xx.c24
-rw-r--r--arch/arm/mach-omap2/prm_common.c17
-rw-r--r--arch/arm/mach-omap2/prminst44xx.c4
-rw-r--r--arch/arm/mach-omap2/sdrc.h8
-rw-r--r--arch/arm/mach-omap2/sdrc2xxx.c4
-rw-r--r--arch/arm/mach-omap2/sr_device.c2
-rw-r--r--arch/arm/mach-omap2/sram.c16
-rw-r--r--arch/arm/mach-omap2/timer.c8
-rw-r--r--arch/arm/mach-omap2/vc.c4
-rw-r--r--arch/arm/mach-omap2/wd_timer.c8
-rw-r--r--arch/arm/mach-prima2/rstc.c34
-rw-r--r--arch/arm/mach-qcom/Kconfig2
-rw-r--r--arch/arm/mach-realview/core.c15
-rw-r--r--arch/arm/mach-realview/core.h1
-rw-r--r--arch/arm/mach-realview/realview_eb.c1
-rw-r--r--arch/arm/mach-realview/realview_pb1176.c1
-rw-r--r--arch/arm/mach-realview/realview_pb11mp.c1
-rw-r--r--arch/arm/mach-realview/realview_pba8.c1
-rw-r--r--arch/arm/mach-realview/realview_pbx.c1
-rw-r--r--arch/arm/mach-s3c24xx/Kconfig91
-rw-r--r--arch/arm/mach-s3c24xx/Makefile13
-rw-r--r--arch/arm/mach-s3c24xx/clock-dclk.c195
-rw-r--r--arch/arm/mach-s3c24xx/clock-s3c2410.c284
-rw-r--r--arch/arm/mach-s3c24xx/clock-s3c2412.c760
-rw-r--r--arch/arm/mach-s3c24xx/clock-s3c2416.c171
-rw-r--r--arch/arm/mach-s3c24xx/clock-s3c2440.c217
-rw-r--r--arch/arm/mach-s3c24xx/clock-s3c2443.c212
-rw-r--r--arch/arm/mach-s3c24xx/clock-s3c244x.c141
-rw-r--r--arch/arm/mach-s3c24xx/common-s3c2443.c675
-rw-r--r--arch/arm/mach-s3c24xx/common.c85
-rw-r--r--arch/arm/mach-s3c24xx/common.h21
-rw-r--r--arch/arm/mach-s3c24xx/cpufreq-utils.c4
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/debug-macro.S101
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/regs-clock.h18
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/regs-gpio.h3
-rw-r--r--arch/arm/mach-s3c24xx/mach-amlm5900.c9
-rw-r--r--arch/arm/mach-s3c24xx/mach-anubis.c34
-rw-r--r--arch/arm/mach-s3c24xx/mach-at2440evb.c10
-rw-r--r--arch/arm/mach-s3c24xx/mach-bast.c34
-rw-r--r--arch/arm/mach-s3c24xx/mach-gta02.c8
-rw-r--r--arch/arm/mach-s3c24xx/mach-h1940.c10
-rw-r--r--arch/arm/mach-s3c24xx/mach-jive.c9
-rw-r--r--arch/arm/mach-s3c24xx/mach-mini2440.c10
-rw-r--r--arch/arm/mach-s3c24xx/mach-n30.c12
-rw-r--r--arch/arm/mach-s3c24xx/mach-nexcoder.c10
-rw-r--r--arch/arm/mach-s3c24xx/mach-osiris.c34
-rw-r--r--arch/arm/mach-s3c24xx/mach-otom.c10
-rw-r--r--arch/arm/mach-s3c24xx/mach-qt2410.c9
-rw-r--r--arch/arm/mach-s3c24xx/mach-rx1950.c21
-rw-r--r--arch/arm/mach-s3c24xx/mach-rx3715.c10
-rw-r--r--arch/arm/mach-s3c24xx/mach-s3c2416-dt.c38
-rw-r--r--arch/arm/mach-s3c24xx/mach-smdk2410.c9
-rw-r--r--arch/arm/mach-s3c24xx/mach-smdk2413.c9
-rw-r--r--arch/arm/mach-s3c24xx/mach-smdk2416.c9
-rw-r--r--arch/arm/mach-s3c24xx/mach-smdk2440.c10
-rw-r--r--arch/arm/mach-s3c24xx/mach-smdk2443.c9
-rw-r--r--arch/arm/mach-s3c24xx/mach-tct_hammer.c9
-rw-r--r--arch/arm/mach-s3c24xx/mach-vr1000.c34
-rw-r--r--arch/arm/mach-s3c24xx/mach-vstms.c9
-rw-r--r--arch/arm/mach-s3c24xx/pm.c17
-rw-r--r--arch/arm/mach-s3c24xx/s3c2410.c56
-rw-r--r--arch/arm/mach-s3c24xx/s3c2412.c43
-rw-r--r--arch/arm/mach-s3c24xx/s3c2442.c111
-rw-r--r--arch/arm/mach-s3c24xx/s3c244x.c59
-rw-r--r--arch/arm/mach-shmobile/Kconfig5
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7740.c13
-rw-r--r--arch/arm/mach-shmobile/setup-sh7372.c6
-rw-r--r--arch/arm/mach-tegra/Kconfig1
-rw-r--r--arch/arm/mach-versatile/core.c16
-rw-r--r--arch/arm/mach-vexpress/Kconfig2
-rw-r--r--arch/arm/mach-vexpress/core.h3
-rw-r--r--arch/arm/mach-vexpress/ct-ca9x4.c10
-rw-r--r--arch/arm/mach-vexpress/platsmp.c187
-rw-r--r--arch/arm/mach-vexpress/v2m.c82
-rw-r--r--arch/arm/plat-omap/counter_32k.c6
-rw-r--r--arch/arm/plat-omap/debug-leds.c14
-rw-r--r--arch/arm/plat-omap/dmtimer.c8
-rw-r--r--arch/arm/plat-omap/include/plat/dmtimer.h16
-rw-r--r--arch/arm/plat-samsung/include/plat/cpu-freq-core.h1
-rw-r--r--arch/arm/plat-samsung/include/plat/cpu.h61
-rw-r--r--arch/arm/plat-versatile/Kconfig6
-rw-r--r--arch/arm/plat-versatile/Makefile1
-rw-r--r--arch/arm/plat-versatile/leds.c103
160 files changed, 1211 insertions, 4301 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index db3c5414223e..860bea828ac4 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -314,6 +314,7 @@ config ARCH_MULTIPLATFORM
314 select CLKSRC_OF 314 select CLKSRC_OF
315 select COMMON_CLK 315 select COMMON_CLK
316 select GENERIC_CLOCKEVENTS 316 select GENERIC_CLOCKEVENTS
317 select MIGHT_HAVE_PCI
317 select MULTI_IRQ_HANDLER 318 select MULTI_IRQ_HANDLER
318 select SPARSE_IRQ 319 select SPARSE_IRQ
319 select USE_OF 320 select USE_OF
diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index eab8ecbe69c1..4678870f8ee8 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -625,6 +625,7 @@ choice
625 config DEBUG_S3C_UART0 625 config DEBUG_S3C_UART0
626 depends on PLAT_SAMSUNG 626 depends on PLAT_SAMSUNG
627 select DEBUG_EXYNOS_UART if ARCH_EXYNOS 627 select DEBUG_EXYNOS_UART if ARCH_EXYNOS
628 select DEBUG_S3C24XX_UART if ARCH_S3C24XX
628 bool "Use S3C UART 0 for low-level debug" 629 bool "Use S3C UART 0 for low-level debug"
629 help 630 help
630 Say Y here if you want the debug print routines to direct 631 Say Y here if you want the debug print routines to direct
@@ -637,6 +638,7 @@ choice
637 config DEBUG_S3C_UART1 638 config DEBUG_S3C_UART1
638 depends on PLAT_SAMSUNG 639 depends on PLAT_SAMSUNG
639 select DEBUG_EXYNOS_UART if ARCH_EXYNOS 640 select DEBUG_EXYNOS_UART if ARCH_EXYNOS
641 select DEBUG_S3C24XX_UART if ARCH_S3C24XX
640 bool "Use S3C UART 1 for low-level debug" 642 bool "Use S3C UART 1 for low-level debug"
641 help 643 help
642 Say Y here if you want the debug print routines to direct 644 Say Y here if you want the debug print routines to direct
@@ -649,6 +651,7 @@ choice
649 config DEBUG_S3C_UART2 651 config DEBUG_S3C_UART2
650 depends on PLAT_SAMSUNG 652 depends on PLAT_SAMSUNG
651 select DEBUG_EXYNOS_UART if ARCH_EXYNOS 653 select DEBUG_EXYNOS_UART if ARCH_EXYNOS
654 select DEBUG_S3C24XX_UART if ARCH_S3C24XX
652 bool "Use S3C UART 2 for low-level debug" 655 bool "Use S3C UART 2 for low-level debug"
653 help 656 help
654 Say Y here if you want the debug print routines to direct 657 Say Y here if you want the debug print routines to direct
@@ -670,6 +673,33 @@ choice
670 The uncompressor code port configuration is now handled 673 The uncompressor code port configuration is now handled
671 by CONFIG_S3C_LOWLEVEL_UART_PORT. 674 by CONFIG_S3C_LOWLEVEL_UART_PORT.
672 675
676 config DEBUG_S3C2410_UART0
677 depends on ARCH_S3C24XX
678 select DEBUG_S3C2410_UART
679 bool "Use S3C2410/S3C2412 UART 0 for low-level debug"
680 help
681 Say Y here if you want the debug print routines to direct
682 their output to UART 0. The port must have been initialised
683 by the boot-loader before use.
684
685 config DEBUG_S3C2410_UART1
686 depends on ARCH_S3C24XX
687 select DEBUG_S3C2410_UART
688 bool "Use S3C2410/S3C2412 UART 1 for low-level debug"
689 help
690 Say Y here if you want the debug print routines to direct
691 their output to UART 1. The port must have been initialised
692 by the boot-loader before use.
693
694 config DEBUG_S3C2410_UART2
695 depends on ARCH_S3C24XX
696 select DEBUG_S3C2410_UART
697 bool "Use S3C2410/S3C2412 UART 2 for low-level debug"
698 help
699 Say Y here if you want the debug print routines to direct
700 their output to UART 2. The port must have been initialised
701 by the boot-loader before use.
702
673 config DEBUG_SOCFPGA_UART 703 config DEBUG_SOCFPGA_UART
674 depends on ARCH_SOCFPGA 704 depends on ARCH_SOCFPGA
675 bool "Use SOCFPGA UART for low-level debug" 705 bool "Use SOCFPGA UART for low-level debug"
@@ -921,6 +951,13 @@ endchoice
921config DEBUG_EXYNOS_UART 951config DEBUG_EXYNOS_UART
922 bool 952 bool
923 953
954config DEBUG_S3C2410_UART
955 bool
956 select DEBUG_S3C24XX_UART
957
958config DEBUG_S3C24XX_UART
959 bool
960
924config DEBUG_OMAP2PLUS_UART 961config DEBUG_OMAP2PLUS_UART
925 bool 962 bool
926 depends on ARCH_OMAP2PLUS 963 depends on ARCH_OMAP2PLUS
@@ -973,6 +1010,7 @@ config DEBUG_LL_INCLUDE
973 DEBUG_IMX6SL_UART 1010 DEBUG_IMX6SL_UART
974 default "debug/msm.S" if DEBUG_MSM_UART 1011 default "debug/msm.S" if DEBUG_MSM_UART
975 default "debug/omap2plus.S" if DEBUG_OMAP2PLUS_UART 1012 default "debug/omap2plus.S" if DEBUG_OMAP2PLUS_UART
1013 default "debug/s3c24xx.S" if DEBUG_S3C24XX_UART
976 default "debug/sirf.S" if DEBUG_SIRFPRIMA2_UART1 || DEBUG_SIRFMARCO_UART1 1014 default "debug/sirf.S" if DEBUG_SIRFPRIMA2_UART1 || DEBUG_SIRFMARCO_UART1
977 default "debug/sti.S" if DEBUG_STI_UART 1015 default "debug/sti.S" if DEBUG_STI_UART
978 default "debug/tegra.S" if DEBUG_TEGRA_UART 1016 default "debug/tegra.S" if DEBUG_TEGRA_UART
@@ -1029,6 +1067,12 @@ config DEBUG_UART_PHYS
1029 default 0x40090000 if ARCH_LPC32XX 1067 default 0x40090000 if ARCH_LPC32XX
1030 default 0x40100000 if DEBUG_PXA_UART1 1068 default 0x40100000 if DEBUG_PXA_UART1
1031 default 0x42000000 if ARCH_GEMINI 1069 default 0x42000000 if ARCH_GEMINI
1070 default 0x50000000 if DEBUG_S3C24XX_UART && (DEBUG_S3C_UART0 || \
1071 DEBUG_S3C2410_UART0)
1072 default 0x50004000 if DEBUG_S3C24XX_UART && (DEBUG_S3C_UART1 || \
1073 DEBUG_S3C2410_UART1)
1074 default 0x50008000 if DEBUG_S3C24XX_UART && (DEBUG_S3C_UART2 || \
1075 DEBUG_S3C2410_UART2)
1032 default 0x7c0003f8 if FOOTBRIDGE 1076 default 0x7c0003f8 if FOOTBRIDGE
1033 default 0x80070000 if DEBUG_IMX23_UART 1077 default 0x80070000 if DEBUG_IMX23_UART
1034 default 0x80074000 if DEBUG_IMX28_UART 1078 default 0x80074000 if DEBUG_IMX28_UART
@@ -1058,7 +1102,7 @@ config DEBUG_UART_PHYS
1058 default 0xfffff700 if ARCH_IOP33X 1102 default 0xfffff700 if ARCH_IOP33X
1059 depends on DEBUG_LL_UART_8250 || DEBUG_LL_UART_PL01X || \ 1103 depends on DEBUG_LL_UART_8250 || DEBUG_LL_UART_PL01X || \
1060 DEBUG_LL_UART_EFM32 || \ 1104 DEBUG_LL_UART_EFM32 || \
1061 DEBUG_UART_8250 || DEBUG_UART_PL01X 1105 DEBUG_UART_8250 || DEBUG_UART_PL01X || DEBUG_S3C24XX_UART
1062 1106
1063config DEBUG_UART_VIRT 1107config DEBUG_UART_VIRT
1064 hex "Virtual base address of debug UART" 1108 hex "Virtual base address of debug UART"
@@ -1075,6 +1119,12 @@ config DEBUG_UART_VIRT
1075 default 0xf2100000 if DEBUG_PXA_UART1 1119 default 0xf2100000 if DEBUG_PXA_UART1
1076 default 0xf4090000 if ARCH_LPC32XX 1120 default 0xf4090000 if ARCH_LPC32XX
1077 default 0xf4200000 if ARCH_GEMINI 1121 default 0xf4200000 if ARCH_GEMINI
1122 default 0xf7000000 if DEBUG_S3C24XX_UART && (DEBUG_S3C_UART0 || \
1123 DEBUG_S3C2410_UART0)
1124 default 0xf7004000 if DEBUG_S3C24XX_UART && (DEBUG_S3C_UART1 || \
1125 DEBUG_S3C2410_UART1)
1126 default 0xf7008000 if DEBUG_S3C24XX_UART && (DEBUG_S3C_UART2 || \
1127 DEBUG_S3C2410_UART2)
1078 default 0xf7fc9000 if DEBUG_BERLIN_UART 1128 default 0xf7fc9000 if DEBUG_BERLIN_UART
1079 default 0xf8009000 if DEBUG_VEXPRESS_UART0_CA9 1129 default 0xf8009000 if DEBUG_VEXPRESS_UART0_CA9
1080 default 0xf8090000 if DEBUG_VEXPRESS_UART0_RS1 1130 default 0xf8090000 if DEBUG_VEXPRESS_UART0_RS1
@@ -1116,7 +1166,7 @@ config DEBUG_UART_VIRT
1116 default 0xff003000 if DEBUG_U300_UART 1166 default 0xff003000 if DEBUG_U300_UART
1117 default DEBUG_UART_PHYS if !MMU 1167 default DEBUG_UART_PHYS if !MMU
1118 depends on DEBUG_LL_UART_8250 || DEBUG_LL_UART_PL01X || \ 1168 depends on DEBUG_LL_UART_8250 || DEBUG_LL_UART_PL01X || \
1119 DEBUG_UART_8250 || DEBUG_UART_PL01X 1169 DEBUG_UART_8250 || DEBUG_UART_PL01X || DEBUG_S3C24XX_UART
1120 1170
1121config DEBUG_UART_8250_SHIFT 1171config DEBUG_UART_8250_SHIFT
1122 int "Register offset shift for the 8250 debug UART" 1172 int "Register offset shift for the 8250 debug UART"
diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
index 066b03480b63..3a8b32df6b31 100644
--- a/arch/arm/boot/compressed/head.S
+++ b/arch/arm/boot/compressed/head.S
@@ -60,11 +60,6 @@
60 add \rb, \rb, #0x00010000 @ Ser1 60 add \rb, \rb, #0x00010000 @ Ser1
61#endif 61#endif
62 .endm 62 .endm
63#elif defined(CONFIG_ARCH_S3C24XX)
64 .macro loadsp, rb, tmp
65 mov \rb, #0x50000000
66 add \rb, \rb, #0x4000 * CONFIG_S3C_LOWLEVEL_UART_PORT
67 .endm
68#else 63#else
69 .macro loadsp, rb, tmp 64 .macro loadsp, rb, tmp
70 addruart \rb, \tmp 65 addruart \rb, \tmp
diff --git a/arch/arm/boot/dts/atlas6.dtsi b/arch/arm/boot/dts/atlas6.dtsi
index 9d72674049d6..317bc590a4d0 100644
--- a/arch/arm/boot/dts/atlas6.dtsi
+++ b/arch/arm/boot/dts/atlas6.dtsi
@@ -195,6 +195,7 @@
195 compatible = "sirf,prima2-tick"; 195 compatible = "sirf,prima2-tick";
196 reg = <0xb0020000 0x1000>; 196 reg = <0xb0020000 0x1000>;
197 interrupts = <0>; 197 interrupts = <0>;
198 clocks = <&clks 11>;
198 }; 199 };
199 200
200 nand@b0030000 { 201 nand@b0030000 {
diff --git a/arch/arm/boot/dts/prima2.dtsi b/arch/arm/boot/dts/prima2.dtsi
index 1e82571d6823..7e7d8843abaf 100644
--- a/arch/arm/boot/dts/prima2.dtsi
+++ b/arch/arm/boot/dts/prima2.dtsi
@@ -201,6 +201,7 @@
201 compatible = "sirf,prima2-tick"; 201 compatible = "sirf,prima2-tick";
202 reg = <0xb0020000 0x1000>; 202 reg = <0xb0020000 0x1000>;
203 interrupts = <0>; 203 interrupts = <0>;
204 clocks = <&clks 11>;
204 }; 205 };
205 206
206 nand@b0030000 { 207 nand@b0030000 {
diff --git a/arch/arm/boot/dts/s3c2416-smdk2416.dts b/arch/arm/boot/dts/s3c2416-smdk2416.dts
index 59594cf15998..ea92fd69529a 100644
--- a/arch/arm/boot/dts/s3c2416-smdk2416.dts
+++ b/arch/arm/boot/dts/s3c2416-smdk2416.dts
@@ -19,6 +19,19 @@
19 reg = <0x30000000 0x4000000>; 19 reg = <0x30000000 0x4000000>;
20 }; 20 };
21 21
22 clocks {
23 compatible = "simple-bus";
24 #address-cells = <1>;
25 #size-cells = <1>;
26
27 xti: xti {
28 compatible = "fixed-clock";
29 clock-frequency = <12000000>;
30 clock-output-names = "xti";
31 #clock-cells = <0>;
32 };
33 };
34
22 serial@50000000 { 35 serial@50000000 {
23 status = "okay"; 36 status = "okay";
24 pinctrl-names = "default"; 37 pinctrl-names = "default";
diff --git a/arch/arm/boot/dts/s3c2416.dtsi b/arch/arm/boot/dts/s3c2416.dtsi
index e6555bdd81b8..955e4a4f8c31 100644
--- a/arch/arm/boot/dts/s3c2416.dtsi
+++ b/arch/arm/boot/dts/s3c2416.dtsi
@@ -8,6 +8,7 @@
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10 10
11#include <dt-bindings/clock/s3c2443.h>
11#include "s3c24xx.dtsi" 12#include "s3c24xx.dtsi"
12#include "s3c2416-pinctrl.dtsi" 13#include "s3c2416-pinctrl.dtsi"
13 14
@@ -28,26 +29,53 @@
28 compatible = "samsung,s3c2416-irq"; 29 compatible = "samsung,s3c2416-irq";
29 }; 30 };
30 31
32 clocks: clock-controller@0x4c000000 {
33 compatible = "samsung,s3c2416-clock";
34 reg = <0x4c000000 0x40>;
35 #clock-cells = <1>;
36 };
37
31 pinctrl@56000000 { 38 pinctrl@56000000 {
32 compatible = "samsung,s3c2416-pinctrl"; 39 compatible = "samsung,s3c2416-pinctrl";
33 }; 40 };
34 41
42 timer@51000000 {
43 clocks = <&clocks PCLK_PWM>;
44 clock-names = "timers";
45 };
46
35 serial@50000000 { 47 serial@50000000 {
36 compatible = "samsung,s3c2440-uart"; 48 compatible = "samsung,s3c2440-uart";
49 clock-names = "uart", "clk_uart_baud2",
50 "clk_uart_baud3";
51 clocks = <&clocks PCLK_UART0>, <&clocks PCLK_UART0>,
52 <&clocks SCLK_UART>;
37 }; 53 };
38 54
39 serial@50004000 { 55 serial@50004000 {
40 compatible = "samsung,s3c2440-uart"; 56 compatible = "samsung,s3c2440-uart";
57 clock-names = "uart", "clk_uart_baud2",
58 "clk_uart_baud3";
59 clocks = <&clocks PCLK_UART1>, <&clocks PCLK_UART1>,
60 <&clocks SCLK_UART>;
41 }; 61 };
42 62
43 serial@50008000 { 63 serial@50008000 {
44 compatible = "samsung,s3c2440-uart"; 64 compatible = "samsung,s3c2440-uart";
65 clock-names = "uart", "clk_uart_baud2",
66 "clk_uart_baud3";
67 clocks = <&clocks PCLK_UART2>, <&clocks PCLK_UART2>,
68 <&clocks SCLK_UART>;
45 }; 69 };
46 70
47 serial@5000C000 { 71 serial@5000C000 {
48 compatible = "samsung,s3c2440-uart"; 72 compatible = "samsung,s3c2440-uart";
49 reg = <0x5000C000 0x4000>; 73 reg = <0x5000C000 0x4000>;
50 interrupts = <1 18 24 4>, <1 18 25 4>; 74 interrupts = <1 18 24 4>, <1 18 25 4>;
75 clock-names = "uart", "clk_uart_baud2",
76 "clk_uart_baud3";
77 clocks = <&clocks PCLK_UART3>, <&clocks PCLK_UART3>,
78 <&clocks SCLK_UART>;
51 status = "disabled"; 79 status = "disabled";
52 }; 80 };
53 81
@@ -55,6 +83,10 @@
55 compatible = "samsung,s3c6410-sdhci"; 83 compatible = "samsung,s3c6410-sdhci";
56 reg = <0x4AC00000 0x100>; 84 reg = <0x4AC00000 0x100>;
57 interrupts = <0 0 21 3>; 85 interrupts = <0 0 21 3>;
86 clock-names = "hsmmc", "mmc_busclk.0",
87 "mmc_busclk.2";
88 clocks = <&clocks HCLK_HSMMC0>, <&clocks HCLK_HSMMC0>,
89 <&clocks MUX_HSMMC0>;
58 status = "disabled"; 90 status = "disabled";
59 }; 91 };
60 92
@@ -62,18 +94,28 @@
62 compatible = "samsung,s3c6410-sdhci"; 94 compatible = "samsung,s3c6410-sdhci";
63 reg = <0x4A800000 0x100>; 95 reg = <0x4A800000 0x100>;
64 interrupts = <0 0 20 3>; 96 interrupts = <0 0 20 3>;
97 clock-names = "hsmmc", "mmc_busclk.0",
98 "mmc_busclk.2";
99 clocks = <&clocks HCLK_HSMMC1>, <&clocks HCLK_HSMMC1>,
100 <&clocks MUX_HSMMC1>;
65 status = "disabled"; 101 status = "disabled";
66 }; 102 };
67 103
68 watchdog@53000000 { 104 watchdog@53000000 {
69 interrupts = <1 9 27 3>; 105 interrupts = <1 9 27 3>;
106 clocks = <&clocks PCLK_WDT>;
107 clock-names = "watchdog";
70 }; 108 };
71 109
72 rtc@57000000 { 110 rtc@57000000 {
73 compatible = "samsung,s3c2416-rtc"; 111 compatible = "samsung,s3c2416-rtc";
112 clocks = <&clocks PCLK_RTC>;
113 clock-names = "rtc";
74 }; 114 };
75 115
76 i2c@54000000 { 116 i2c@54000000 {
77 compatible = "samsung,s3c2440-i2c"; 117 compatible = "samsung,s3c2440-i2c";
118 clocks = <&clocks PCLK_I2C0>;
119 clock-names = "i2c";
78 }; 120 };
79}; 121};
diff --git a/arch/arm/boot/dts/vexpress-v2m-rs1.dtsi b/arch/arm/boot/dts/vexpress-v2m-rs1.dtsi
index ac870fb3fa0d..756c986995a3 100644
--- a/arch/arm/boot/dts/vexpress-v2m-rs1.dtsi
+++ b/arch/arm/boot/dts/vexpress-v2m-rs1.dtsi
@@ -74,8 +74,24 @@
74 v2m_sysreg: sysreg@010000 { 74 v2m_sysreg: sysreg@010000 {
75 compatible = "arm,vexpress-sysreg"; 75 compatible = "arm,vexpress-sysreg";
76 reg = <0x010000 0x1000>; 76 reg = <0x010000 0x1000>;
77 gpio-controller; 77
78 #gpio-cells = <2>; 78 v2m_led_gpios: sys_led@08 {
79 compatible = "arm,vexpress-sysreg,sys_led";
80 gpio-controller;
81 #gpio-cells = <2>;
82 };
83
84 v2m_mmc_gpios: sys_mci@48 {
85 compatible = "arm,vexpress-sysreg,sys_mci";
86 gpio-controller;
87 #gpio-cells = <2>;
88 };
89
90 v2m_flash_gpios: sys_flash@4c {
91 compatible = "arm,vexpress-sysreg,sys_flash";
92 gpio-controller;
93 #gpio-cells = <2>;
94 };
79 }; 95 };
80 96
81 v2m_sysctl: sysctl@020000 { 97 v2m_sysctl: sysctl@020000 {
@@ -113,8 +129,8 @@
113 compatible = "arm,pl180", "arm,primecell"; 129 compatible = "arm,pl180", "arm,primecell";
114 reg = <0x050000 0x1000>; 130 reg = <0x050000 0x1000>;
115 interrupts = <9 10>; 131 interrupts = <9 10>;
116 cd-gpios = <&v2m_sysreg 0 0>; 132 cd-gpios = <&v2m_mmc_gpios 0 0>;
117 wp-gpios = <&v2m_sysreg 1 0>; 133 wp-gpios = <&v2m_mmc_gpios 1 0>;
118 max-frequency = <12000000>; 134 max-frequency = <12000000>;
119 vmmc-supply = <&v2m_fixed_3v3>; 135 vmmc-supply = <&v2m_fixed_3v3>;
120 clocks = <&v2m_clk24mhz>, <&smbclk>; 136 clocks = <&v2m_clk24mhz>, <&smbclk>;
@@ -265,6 +281,58 @@
265 clock-output-names = "v2m:refclk32khz"; 281 clock-output-names = "v2m:refclk32khz";
266 }; 282 };
267 283
284 leds {
285 compatible = "gpio-leds";
286
287 user@1 {
288 label = "v2m:green:user1";
289 gpios = <&v2m_led_gpios 0 0>;
290 linux,default-trigger = "heartbeat";
291 };
292
293 user@2 {
294 label = "v2m:green:user2";
295 gpios = <&v2m_led_gpios 1 0>;
296 linux,default-trigger = "mmc0";
297 };
298
299 user@3 {
300 label = "v2m:green:user3";
301 gpios = <&v2m_led_gpios 2 0>;
302 linux,default-trigger = "cpu0";
303 };
304
305 user@4 {
306 label = "v2m:green:user4";
307 gpios = <&v2m_led_gpios 3 0>;
308 linux,default-trigger = "cpu1";
309 };
310
311 user@5 {
312 label = "v2m:green:user5";
313 gpios = <&v2m_led_gpios 4 0>;
314 linux,default-trigger = "cpu2";
315 };
316
317 user@6 {
318 label = "v2m:green:user6";
319 gpios = <&v2m_led_gpios 5 0>;
320 linux,default-trigger = "cpu3";
321 };
322
323 user@7 {
324 label = "v2m:green:user7";
325 gpios = <&v2m_led_gpios 6 0>;
326 linux,default-trigger = "cpu4";
327 };
328
329 user@8 {
330 label = "v2m:green:user8";
331 gpios = <&v2m_led_gpios 7 0>;
332 linux,default-trigger = "cpu5";
333 };
334 };
335
268 mcc { 336 mcc {
269 compatible = "arm,vexpress,config-bus"; 337 compatible = "arm,vexpress,config-bus";
270 arm,vexpress,config-bridge = <&v2m_sysreg>; 338 arm,vexpress,config-bridge = <&v2m_sysreg>;
diff --git a/arch/arm/boot/dts/vexpress-v2m.dtsi b/arch/arm/boot/dts/vexpress-v2m.dtsi
index f1420368355b..ba856d604fb7 100644
--- a/arch/arm/boot/dts/vexpress-v2m.dtsi
+++ b/arch/arm/boot/dts/vexpress-v2m.dtsi
@@ -73,8 +73,24 @@
73 v2m_sysreg: sysreg@00000 { 73 v2m_sysreg: sysreg@00000 {
74 compatible = "arm,vexpress-sysreg"; 74 compatible = "arm,vexpress-sysreg";
75 reg = <0x00000 0x1000>; 75 reg = <0x00000 0x1000>;
76 gpio-controller; 76
77 #gpio-cells = <2>; 77 v2m_led_gpios: sys_led@08 {
78 compatible = "arm,vexpress-sysreg,sys_led";
79 gpio-controller;
80 #gpio-cells = <2>;
81 };
82
83 v2m_mmc_gpios: sys_mci@48 {
84 compatible = "arm,vexpress-sysreg,sys_mci";
85 gpio-controller;
86 #gpio-cells = <2>;
87 };
88
89 v2m_flash_gpios: sys_flash@4c {
90 compatible = "arm,vexpress-sysreg,sys_flash";
91 gpio-controller;
92 #gpio-cells = <2>;
93 };
78 }; 94 };
79 95
80 v2m_sysctl: sysctl@01000 { 96 v2m_sysctl: sysctl@01000 {
@@ -112,8 +128,8 @@
112 compatible = "arm,pl180", "arm,primecell"; 128 compatible = "arm,pl180", "arm,primecell";
113 reg = <0x05000 0x1000>; 129 reg = <0x05000 0x1000>;
114 interrupts = <9 10>; 130 interrupts = <9 10>;
115 cd-gpios = <&v2m_sysreg 0 0>; 131 cd-gpios = <&v2m_mmc_gpios 0 0>;
116 wp-gpios = <&v2m_sysreg 1 0>; 132 wp-gpios = <&v2m_mmc_gpios 1 0>;
117 max-frequency = <12000000>; 133 max-frequency = <12000000>;
118 vmmc-supply = <&v2m_fixed_3v3>; 134 vmmc-supply = <&v2m_fixed_3v3>;
119 clocks = <&v2m_clk24mhz>, <&smbclk>; 135 clocks = <&v2m_clk24mhz>, <&smbclk>;
@@ -264,6 +280,58 @@
264 clock-output-names = "v2m:refclk32khz"; 280 clock-output-names = "v2m:refclk32khz";
265 }; 281 };
266 282
283 leds {
284 compatible = "gpio-leds";
285
286 user@1 {
287 label = "v2m:green:user1";
288 gpios = <&v2m_led_gpios 0 0>;
289 linux,default-trigger = "heartbeat";
290 };
291
292 user@2 {
293 label = "v2m:green:user2";
294 gpios = <&v2m_led_gpios 1 0>;
295 linux,default-trigger = "mmc0";
296 };
297
298 user@3 {
299 label = "v2m:green:user3";
300 gpios = <&v2m_led_gpios 2 0>;
301 linux,default-trigger = "cpu0";
302 };
303
304 user@4 {
305 label = "v2m:green:user4";
306 gpios = <&v2m_led_gpios 3 0>;
307 linux,default-trigger = "cpu1";
308 };
309
310 user@5 {
311 label = "v2m:green:user5";
312 gpios = <&v2m_led_gpios 4 0>;
313 linux,default-trigger = "cpu2";
314 };
315
316 user@6 {
317 label = "v2m:green:user6";
318 gpios = <&v2m_led_gpios 5 0>;
319 linux,default-trigger = "cpu3";
320 };
321
322 user@7 {
323 label = "v2m:green:user7";
324 gpios = <&v2m_led_gpios 6 0>;
325 linux,default-trigger = "cpu4";
326 };
327
328 user@8 {
329 label = "v2m:green:user8";
330 gpios = <&v2m_led_gpios 7 0>;
331 linux,default-trigger = "cpu5";
332 };
333 };
334
267 mcc { 335 mcc {
268 compatible = "arm,vexpress,config-bus"; 336 compatible = "arm,vexpress,config-bus";
269 arm,vexpress,config-bridge = <&v2m_sysreg>; 337 arm,vexpress,config-bridge = <&v2m_sysreg>;
diff --git a/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts b/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts
index 15f98cbcb75a..a25c262326dc 100644
--- a/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts
+++ b/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts
@@ -312,6 +312,7 @@
312 arm,vexpress-sysreg,func = <12 0>; 312 arm,vexpress-sysreg,func = <12 0>;
313 label = "A15 Pcore"; 313 label = "A15 Pcore";
314 }; 314 };
315
315 power@1 { 316 power@1 {
316 /* Total power for the three A7 cores */ 317 /* Total power for the three A7 cores */
317 compatible = "arm,vexpress-power"; 318 compatible = "arm,vexpress-power";
@@ -322,14 +323,14 @@
322 energy@0 { 323 energy@0 {
323 /* Total energy for the two A15 cores */ 324 /* Total energy for the two A15 cores */
324 compatible = "arm,vexpress-energy"; 325 compatible = "arm,vexpress-energy";
325 arm,vexpress-sysreg,func = <13 0>; 326 arm,vexpress-sysreg,func = <13 0>, <13 1>;
326 label = "A15 Jcore"; 327 label = "A15 Jcore";
327 }; 328 };
328 329
329 energy@2 { 330 energy@2 {
330 /* Total energy for the three A7 cores */ 331 /* Total energy for the three A7 cores */
331 compatible = "arm,vexpress-energy"; 332 compatible = "arm,vexpress-energy";
332 arm,vexpress-sysreg,func = <13 2>; 333 arm,vexpress-sysreg,func = <13 2>, <13 3>;
333 label = "A7 Jcore"; 334 label = "A7 Jcore";
334 }; 335 };
335 }; 336 };
diff --git a/arch/arm/configs/realview-smp_defconfig b/arch/arm/configs/realview-smp_defconfig
index abe61bf379d2..1da5d9e48224 100644
--- a/arch/arm/configs/realview-smp_defconfig
+++ b/arch/arm/configs/realview-smp_defconfig
@@ -76,8 +76,10 @@ CONFIG_MMC=y
76CONFIG_MMC_ARMMMCI=y 76CONFIG_MMC_ARMMMCI=y
77CONFIG_NEW_LEDS=y 77CONFIG_NEW_LEDS=y
78CONFIG_LEDS_CLASS=y 78CONFIG_LEDS_CLASS=y
79CONFIG_LEDS_VERSATILE=y
79CONFIG_LEDS_TRIGGERS=y 80CONFIG_LEDS_TRIGGERS=y
80CONFIG_LEDS_TRIGGER_HEARTBEAT=y 81CONFIG_LEDS_TRIGGER_HEARTBEAT=y
82CONFIG_LEDS_TRIGGER_CPU=y
81CONFIG_RTC_CLASS=y 83CONFIG_RTC_CLASS=y
82CONFIG_RTC_DRV_DS1307=y 84CONFIG_RTC_DRV_DS1307=y
83CONFIG_RTC_DRV_PL031=y 85CONFIG_RTC_DRV_PL031=y
diff --git a/arch/arm/configs/realview_defconfig b/arch/arm/configs/realview_defconfig
index 7079cbe898a8..d02e9d911bb7 100644
--- a/arch/arm/configs/realview_defconfig
+++ b/arch/arm/configs/realview_defconfig
@@ -75,8 +75,10 @@ CONFIG_MMC=y
75CONFIG_MMC_ARMMMCI=y 75CONFIG_MMC_ARMMMCI=y
76CONFIG_NEW_LEDS=y 76CONFIG_NEW_LEDS=y
77CONFIG_LEDS_CLASS=y 77CONFIG_LEDS_CLASS=y
78CONFIG_LEDS_VERSATILE=y
78CONFIG_LEDS_TRIGGERS=y 79CONFIG_LEDS_TRIGGERS=y
79CONFIG_LEDS_TRIGGER_HEARTBEAT=y 80CONFIG_LEDS_TRIGGER_HEARTBEAT=y
81CONFIG_LEDS_TRIGGER_CPU=y
80CONFIG_RTC_CLASS=y 82CONFIG_RTC_CLASS=y
81CONFIG_RTC_DRV_DS1307=y 83CONFIG_RTC_DRV_DS1307=y
82CONFIG_RTC_DRV_PL031=y 84CONFIG_RTC_DRV_PL031=y
diff --git a/arch/arm/configs/versatile_defconfig b/arch/arm/configs/versatile_defconfig
index 073541a50e23..d52b4ffe2012 100644
--- a/arch/arm/configs/versatile_defconfig
+++ b/arch/arm/configs/versatile_defconfig
@@ -61,6 +61,9 @@ CONFIG_SND_ARMAACI=m
61CONFIG_MMC=y 61CONFIG_MMC=y
62CONFIG_MMC_ARMMMCI=m 62CONFIG_MMC_ARMMMCI=m
63CONFIG_NEW_LEDS=y 63CONFIG_NEW_LEDS=y
64CONFIG_LEDS_CLASS=y
65CONFIG_LEDS_VERSATILE=y
66CONFIG_LEDS_TRIGGERS=y
64CONFIG_LEDS_TRIGGER_HEARTBEAT=y 67CONFIG_LEDS_TRIGGER_HEARTBEAT=y
65CONFIG_LEDS_TRIGGER_CPU=y 68CONFIG_LEDS_TRIGGER_CPU=y
66CONFIG_EXT2_FS=y 69CONFIG_EXT2_FS=y
diff --git a/arch/arm/include/debug/s3c24xx.S b/arch/arm/include/debug/s3c24xx.S
new file mode 100644
index 000000000000..b1f54dc4888c
--- /dev/null
+++ b/arch/arm/include/debug/s3c24xx.S
@@ -0,0 +1,46 @@
1/* arch/arm/mach-s3c2410/include/mach/debug-macro.S
2 *
3 * Debugging macro include header
4 *
5 * Copyright (C) 1994-1999 Russell King
6 * Copyright (C) 2005 Simtec Electronics
7 *
8 * Moved from linux/arch/arm/kernel/debug.S by Ben Dooks
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#include <linux/serial_s3c.h>
16
17#define S3C2410_UART1_OFF (0x4000)
18
19 .macro addruart, rp, rv, tmp
20 ldr \rp, = CONFIG_DEBUG_UART_PHYS
21 ldr \rv, = CONFIG_DEBUG_UART_VIRT
22 .endm
23
24 .macro fifo_full_s3c2410 rd, rx
25 ldr \rd, [\rx, # S3C2410_UFSTAT]
26 tst \rd, #S3C2410_UFSTAT_TXFULL
27 .endm
28
29 .macro fifo_level_s3c2410 rd, rx
30 ldr \rd, [\rx, # S3C2410_UFSTAT]
31 and \rd, \rd, #S3C2410_UFSTAT_TXMASK
32 .endm
33
34/* Select the correct implementation depending on the configuration. The
35 * S3C2440 will get selected by default, as these are the most widely
36 * used variants of these
37*/
38
39#if defined(CONFIG_DEBUG_S3C2410_UART)
40#define fifo_full fifo_full_s3c2410
41#define fifo_level fifo_level_s3c2410
42#endif
43
44/* include the reset of the code which will do the work */
45
46#include <debug/samsung.S>
diff --git a/arch/arm/mach-bcm/Kconfig b/arch/arm/mach-bcm/Kconfig
index 49c914cd9c7a..2113d92c668a 100644
--- a/arch/arm/mach-bcm/Kconfig
+++ b/arch/arm/mach-bcm/Kconfig
@@ -10,22 +10,51 @@ if ARCH_BCM
10menu "Broadcom SoC Selection" 10menu "Broadcom SoC Selection"
11 11
12config ARCH_BCM_MOBILE 12config ARCH_BCM_MOBILE
13 bool "Broadcom Mobile SoC" if ARCH_MULTI_V7 13 bool "Broadcom Mobile SoC Support" if ARCH_MULTI_V7
14 depends on MMU
15 select ARCH_REQUIRE_GPIOLIB 14 select ARCH_REQUIRE_GPIOLIB
16 select ARM_ERRATA_754322 15 select ARM_ERRATA_754322
17 select ARM_ERRATA_764369 if SMP 16 select ARM_ERRATA_764369 if SMP
18 select ARM_GIC 17 select ARM_GIC
19 select GPIO_BCM_KONA 18 select GPIO_BCM_KONA
20 select TICK_ONESHOT 19 select TICK_ONESHOT
21 select CACHE_L2X0
22 select HAVE_ARM_ARCH_TIMER 20 select HAVE_ARM_ARCH_TIMER
23 select PINCTRL 21 select PINCTRL
24 help 22 help
25 This enables support for systems based on Broadcom mobile SoCs. 23 This enables support for systems based on Broadcom mobile SoCs.
26 It currently supports the 'BCM281XX' family, which includes 24
27 BCM11130, BCM11140, BCM11351, BCM28145 and 25if ARCH_BCM_MOBILE
28 BCM28155 variants. 26
27menu "Broadcom Mobile SoC Selection"
28
29config ARCH_BCM_281XX
30 bool "Broadcom BCM281XX SoC family"
31 default y
32 help
33 Enable support for the the BCM281XX family, which includes
34 BCM11130, BCM11140, BCM11351, BCM28145 and BCM28155
35 variants.
36
37config ARCH_BCM_21664
38 bool "Broadcom BCM21664 SoC family"
39 default y
40 help
41 Enable support for the the BCM21664 family, which includes
42 BCM21663 and BCM21664 variants.
43
44config ARCH_BCM_MOBILE_L2_CACHE
45 bool "Broadcom mobile SoC level 2 cache support"
46 depends on (ARCH_BCM_281XX || ARCH_BCM_21664)
47 default y
48 select CACHE_L2X0
49 select ARCH_BCM_MOBILE_SMC
50
51config ARCH_BCM_MOBILE_SMC
52 bool
53 depends on ARCH_BCM_281XX || ARCH_BCM_21664
54
55endmenu
56
57endif
29 58
30config ARCH_BCM2835 59config ARCH_BCM2835
31 bool "Broadcom BCM2835 family" if ARCH_MULTI_V6 60 bool "Broadcom BCM2835 family" if ARCH_MULTI_V6
@@ -33,10 +62,7 @@ config ARCH_BCM2835
33 select ARM_AMBA 62 select ARM_AMBA
34 select ARM_ERRATA_411920 63 select ARM_ERRATA_411920
35 select ARM_TIMER_SP804 64 select ARM_TIMER_SP804
36 select CLKDEV_LOOKUP
37 select CLKSRC_OF 65 select CLKSRC_OF
38 select CPU_V6
39 select GENERIC_CLOCKEVENTS
40 select PINCTRL 66 select PINCTRL
41 select PINCTRL_BCM2835 67 select PINCTRL_BCM2835
42 help 68 help
@@ -45,17 +71,12 @@ config ARCH_BCM2835
45 71
46config ARCH_BCM_5301X 72config ARCH_BCM_5301X
47 bool "Broadcom BCM470X / BCM5301X ARM SoC" if ARCH_MULTI_V7 73 bool "Broadcom BCM470X / BCM5301X ARM SoC" if ARCH_MULTI_V7
48 depends on MMU
49 select ARM_GIC 74 select ARM_GIC
50 select CACHE_L2X0 75 select CACHE_L2X0
51 select HAVE_ARM_SCU if SMP 76 select HAVE_ARM_SCU if SMP
52 select HAVE_ARM_TWD if SMP 77 select HAVE_ARM_TWD if SMP
53 select HAVE_SMP
54 select COMMON_CLK
55 select GENERIC_CLOCKEVENTS
56 select ARM_GLOBAL_TIMER 78 select ARM_GLOBAL_TIMER
57 select CLKSRC_ARM_GLOBAL_TIMER_SCHED_CLOCK 79 select CLKSRC_ARM_GLOBAL_TIMER_SCHED_CLOCK
58 select MIGHT_HAVE_PCI
59 help 80 help
60 Support for Broadcom BCM470X and BCM5301X SoCs with ARM CPU cores. 81 Support for Broadcom BCM470X and BCM5301X SoCs with ARM CPU cores.
61 82
diff --git a/arch/arm/mach-bcm/Makefile b/arch/arm/mach-bcm/Makefile
index a326b28c4406..731292114975 100644
--- a/arch/arm/mach-bcm/Makefile
+++ b/arch/arm/mach-bcm/Makefile
@@ -10,10 +10,23 @@
10# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11# GNU General Public License for more details. 11# GNU General Public License for more details.
12 12
13obj-$(CONFIG_ARCH_BCM_MOBILE) := board_bcm281xx.o board_bcm21664.o \ 13# BCM281XX
14 bcm_kona_smc.o bcm_kona_smc_asm.o kona.o 14obj-$(CONFIG_ARCH_BCM_281XX) += board_bcm281xx.o
15
16# BCM21664
17obj-$(CONFIG_ARCH_BCM_21664) += board_bcm21664.o
18
19# BCM281XX and BCM21664 L2 cache control
20obj-$(CONFIG_ARCH_BCM_MOBILE_L2_CACHE) += kona_l2_cache.o
21
22# Support for secure monitor traps
23obj-$(CONFIG_ARCH_BCM_MOBILE_SMC) += bcm_kona_smc.o
24ifeq ($(call as-instr,.arch_extension sec,as_has_sec),as_has_sec)
25CFLAGS_bcm_kona_smc.o += -Wa,-march=armv7-a+sec -DREQUIRES_SEC
26endif
27
28# BCM2835
15obj-$(CONFIG_ARCH_BCM2835) += board_bcm2835.o 29obj-$(CONFIG_ARCH_BCM2835) += board_bcm2835.o
16 30
17plus_sec := $(call as-instr,.arch_extension sec,+sec) 31# BCM5301X
18AFLAGS_bcm_kona_smc_asm.o :=-Wa,-march=armv7-a$(plus_sec)
19obj-$(CONFIG_ARCH_BCM_5301X) += bcm_5301x.o 32obj-$(CONFIG_ARCH_BCM_5301X) += bcm_5301x.o
diff --git a/arch/arm/mach-bcm/bcm_kona_smc.c b/arch/arm/mach-bcm/bcm_kona_smc.c
index 5e31e918f325..a55a7ecf146a 100644
--- a/arch/arm/mach-bcm/bcm_kona_smc.c
+++ b/arch/arm/mach-bcm/bcm_kona_smc.c
@@ -21,11 +21,8 @@
21 21
22#include "bcm_kona_smc.h" 22#include "bcm_kona_smc.h"
23 23
24struct secure_bridge_data { 24static u32 bcm_smc_buffer_phys; /* physical address */
25 void __iomem *bounce; /* virtual address */ 25static void __iomem *bcm_smc_buffer; /* virtual address */
26 u32 __iomem buffer_addr; /* physical address */
27 int initialized;
28} bridge_data;
29 26
30struct bcm_kona_smc_data { 27struct bcm_kona_smc_data {
31 unsigned service_id; 28 unsigned service_id;
@@ -33,6 +30,7 @@ struct bcm_kona_smc_data {
33 unsigned arg1; 30 unsigned arg1;
34 unsigned arg2; 31 unsigned arg2;
35 unsigned arg3; 32 unsigned arg3;
33 unsigned result;
36}; 34};
37 35
38static const struct of_device_id bcm_kona_smc_ids[] __initconst = { 36static const struct of_device_id bcm_kona_smc_ids[] __initconst = {
@@ -41,59 +39,125 @@ static const struct of_device_id bcm_kona_smc_ids[] __initconst = {
41 {}, 39 {},
42}; 40};
43 41
44/* Map in the bounce area */ 42/* Map in the args buffer area */
45int __init bcm_kona_smc_init(void) 43int __init bcm_kona_smc_init(void)
46{ 44{
47 struct device_node *node; 45 struct device_node *node;
46 const __be32 *prop_val;
47 u64 prop_size = 0;
48 unsigned long buffer_size;
49 u32 buffer_phys;
48 50
49 /* Read buffer addr and size from the device tree node */ 51 /* Read buffer addr and size from the device tree node */
50 node = of_find_matching_node(NULL, bcm_kona_smc_ids); 52 node = of_find_matching_node(NULL, bcm_kona_smc_ids);
51 if (!node) 53 if (!node)
52 return -ENODEV; 54 return -ENODEV;
53 55
54 /* Don't care about size or flags of the DT node */ 56 prop_val = of_get_address(node, 0, &prop_size, NULL);
55 bridge_data.buffer_addr = 57 if (!prop_val)
56 be32_to_cpu(*of_get_address(node, 0, NULL, NULL)); 58 return -EINVAL;
57 BUG_ON(!bridge_data.buffer_addr);
58 59
59 bridge_data.bounce = of_iomap(node, 0); 60 /* We assume space for four 32-bit arguments */
60 BUG_ON(!bridge_data.bounce); 61 if (prop_size < 4 * sizeof(u32) || prop_size > (u64)ULONG_MAX)
62 return -EINVAL;
63 buffer_size = (unsigned long)prop_size;
61 64
62 bridge_data.initialized = 1; 65 buffer_phys = be32_to_cpup(prop_val);
66 if (!buffer_phys)
67 return -EINVAL;
68
69 bcm_smc_buffer = ioremap(buffer_phys, buffer_size);
70 if (!bcm_smc_buffer)
71 return -ENOMEM;
72 bcm_smc_buffer_phys = buffer_phys;
63 73
64 pr_info("Kona Secure API initialized\n"); 74 pr_info("Kona Secure API initialized\n");
65 75
66 return 0; 76 return 0;
67} 77}
68 78
79/*
80 * int bcm_kona_do_smc(u32 service_id, u32 buffer_addr)
81 *
82 * Only core 0 can run the secure monitor code. If an "smc" request
83 * is initiated on a different core it must be redirected to core 0
84 * for execution. We rely on the caller to handle this.
85 *
86 * Each "smc" request supplies a service id and the address of a
87 * buffer containing parameters related to the service to be
88 * performed. A flags value defines the behavior of the level 2
89 * cache and interrupt handling while the secure monitor executes.
90 *
91 * Parameters to the "smc" request are passed in r4-r6 as follows:
92 * r4 service id
93 * r5 flags (SEC_ROM_*)
94 * r6 physical address of buffer with other parameters
95 *
96 * Execution of an "smc" request produces two distinct results.
97 *
98 * First, the secure monitor call itself (regardless of the specific
99 * service request) can succeed, or can produce an error. When an
100 * "smc" request completes this value is found in r12; it should
101 * always be SEC_EXIT_NORMAL.
102 *
103 * In addition, the particular service performed produces a result.
104 * The values that should be expected depend on the service. We
105 * therefore return this value to the caller, so it can handle the
106 * request result appropriately. This result value is found in r0
107 * when the "smc" request completes.
108 */
109static int bcm_kona_do_smc(u32 service_id, u32 buffer_phys)
110{
111 register u32 ip asm("ip"); /* Also called r12 */
112 register u32 r0 asm("r0");
113 register u32 r4 asm("r4");
114 register u32 r5 asm("r5");
115 register u32 r6 asm("r6");
116
117 r4 = service_id;
118 r5 = 0x3; /* Keep IRQ and FIQ off in SM */
119 r6 = buffer_phys;
120
121 asm volatile (
122 /* Make sure we got the registers we want */
123 __asmeq("%0", "ip")
124 __asmeq("%1", "r0")
125 __asmeq("%2", "r4")
126 __asmeq("%3", "r5")
127 __asmeq("%4", "r6")
128#ifdef REQUIRES_SEC
129 ".arch_extension sec\n"
130#endif
131 " smc #0\n"
132 : "=r" (ip), "=r" (r0)
133 : "r" (r4), "r" (r5), "r" (r6)
134 : "r1", "r2", "r3", "r7", "lr");
135
136 BUG_ON(ip != SEC_EXIT_NORMAL);
137
138 return r0;
139}
140
69/* __bcm_kona_smc() should only run on CPU 0, with pre-emption disabled */ 141/* __bcm_kona_smc() should only run on CPU 0, with pre-emption disabled */
70static void __bcm_kona_smc(void *info) 142static void __bcm_kona_smc(void *info)
71{ 143{
72 struct bcm_kona_smc_data *data = info; 144 struct bcm_kona_smc_data *data = info;
73 u32 *args = bridge_data.bounce; 145 u32 *args = bcm_smc_buffer;
74 int rc = 0;
75 146
76 /* Must run on CPU 0 */
77 BUG_ON(smp_processor_id() != 0); 147 BUG_ON(smp_processor_id() != 0);
148 BUG_ON(!args);
78 149
79 /* Check map in the bounce area */ 150 /* Copy the four 32 bit argument values into the bounce area */
80 BUG_ON(!bridge_data.initialized); 151 writel_relaxed(data->arg0, args++);
81 152 writel_relaxed(data->arg1, args++);
82 /* Copy one 32 bit word into the bounce area */ 153 writel_relaxed(data->arg2, args++);
83 args[0] = data->arg0; 154 writel(data->arg3, args);
84 args[1] = data->arg1;
85 args[2] = data->arg2;
86 args[3] = data->arg3;
87 155
88 /* Flush caches for input data passed to Secure Monitor */ 156 /* Flush caches for input data passed to Secure Monitor */
89 if (data->service_id != SSAPI_BRCM_START_VC_CORE) 157 flush_cache_all();
90 flush_cache_all();
91
92 /* Trap into Secure Monitor */
93 rc = bcm_kona_smc_asm(data->service_id, bridge_data.buffer_addr);
94 158
95 if (rc != SEC_ROM_RET_OK) 159 /* Trap into Secure Monitor and record the request result */
96 pr_err("Secure Monitor call failed (0x%x)!\n", rc); 160 data->result = bcm_kona_do_smc(data->service_id, bcm_smc_buffer_phys);
97} 161}
98 162
99unsigned bcm_kona_smc(unsigned service_id, unsigned arg0, unsigned arg1, 163unsigned bcm_kona_smc(unsigned service_id, unsigned arg0, unsigned arg1,
@@ -106,17 +170,13 @@ unsigned bcm_kona_smc(unsigned service_id, unsigned arg0, unsigned arg1,
106 data.arg1 = arg1; 170 data.arg1 = arg1;
107 data.arg2 = arg2; 171 data.arg2 = arg2;
108 data.arg3 = arg3; 172 data.arg3 = arg3;
173 data.result = 0;
109 174
110 /* 175 /*
111 * Due to a limitation of the secure monitor, we must use the SMP 176 * Due to a limitation of the secure monitor, we must use the SMP
112 * infrastructure to forward all secure monitor calls to Core 0. 177 * infrastructure to forward all secure monitor calls to Core 0.
113 */ 178 */
114 if (get_cpu() != 0) 179 smp_call_function_single(0, __bcm_kona_smc, &data, 1);
115 smp_call_function_single(0, __bcm_kona_smc, (void *)&data, 1);
116 else
117 __bcm_kona_smc(&data);
118 180
119 put_cpu(); 181 return data.result;
120
121 return 0;
122} 182}
diff --git a/arch/arm/mach-bcm/bcm_kona_smc.h b/arch/arm/mach-bcm/bcm_kona_smc.h
index d098a7e76744..2e29ec67e414 100644
--- a/arch/arm/mach-bcm/bcm_kona_smc.h
+++ b/arch/arm/mach-bcm/bcm_kona_smc.h
@@ -15,55 +15,12 @@
15#define BCM_KONA_SMC_H 15#define BCM_KONA_SMC_H
16 16
17#include <linux/types.h> 17#include <linux/types.h>
18#define FLAGS (SEC_ROM_ICACHE_ENABLE_MASK | SEC_ROM_DCACHE_ENABLE_MASK | \
19 SEC_ROM_IRQ_ENABLE_MASK | SEC_ROM_FIQ_ENABLE_MASK)
20 18
21/*! 19/* Broadcom Secure Service API service IDs, return codes, and exit codes */
22 * Definitions for IRQ & FIQ Mask for ARM 20#define SSAPI_ENABLE_L2_CACHE 0x01000002
23 */
24
25#define FIQ_IRQ_MASK 0xC0
26#define FIQ_MASK 0x40
27#define IRQ_MASK 0x80
28
29/*!
30 * Secure Mode FLAGs
31 */
32
33/* When set, enables ICache within the secure mode */
34#define SEC_ROM_ICACHE_ENABLE_MASK 0x00000001
35
36/* When set, enables DCache within the secure mode */
37#define SEC_ROM_DCACHE_ENABLE_MASK 0x00000002
38
39/* When set, enables IRQ within the secure mode */
40#define SEC_ROM_IRQ_ENABLE_MASK 0x00000004
41
42/* When set, enables FIQ within the secure mode */
43#define SEC_ROM_FIQ_ENABLE_MASK 0x00000008
44
45/* When set, enables Unified L2 cache within the secure mode */
46#define SEC_ROM_UL2_CACHE_ENABLE_MASK 0x00000010
47
48/* Broadcom Secure Service API Service IDs */
49#define SSAPI_DORMANT_ENTRY_SERV 0x01000000
50#define SSAPI_PUBLIC_OTP_SERV 0x01000001
51#define SSAPI_ENABLE_L2_CACHE 0x01000002
52#define SSAPI_DISABLE_L2_CACHE 0x01000003
53#define SSAPI_WRITE_SCU_STATUS 0x01000004
54#define SSAPI_WRITE_PWR_GATE 0x01000005
55
56/* Broadcom Secure Service API Return Codes */
57#define SEC_ROM_RET_OK 0x00000001 21#define SEC_ROM_RET_OK 0x00000001
58#define SEC_ROM_RET_FAIL 0x00000009
59
60#define SSAPI_RET_FROM_INT_SERV 0x4
61#define SEC_EXIT_NORMAL 0x1 22#define SEC_EXIT_NORMAL 0x1
62 23
63#define SSAPI_ROW_AES 0x0E000006
64#define SSAPI_BRCM_START_VC_CORE 0x0E000008
65
66#ifndef __ASSEMBLY__
67extern int __init bcm_kona_smc_init(void); 24extern int __init bcm_kona_smc_init(void);
68 25
69extern unsigned bcm_kona_smc(unsigned service_id, 26extern unsigned bcm_kona_smc(unsigned service_id,
@@ -72,9 +29,4 @@ extern unsigned bcm_kona_smc(unsigned service_id,
72 unsigned arg2, 29 unsigned arg2,
73 unsigned arg3); 30 unsigned arg3);
74 31
75extern int bcm_kona_smc_asm(u32 service_id,
76 u32 buffer_addr);
77
78#endif /* __ASSEMBLY__ */
79
80#endif /* BCM_KONA_SMC_H */ 32#endif /* BCM_KONA_SMC_H */
diff --git a/arch/arm/mach-bcm/bcm_kona_smc_asm.S b/arch/arm/mach-bcm/bcm_kona_smc_asm.S
deleted file mode 100644
index a1608480d60d..000000000000
--- a/arch/arm/mach-bcm/bcm_kona_smc_asm.S
+++ /dev/null
@@ -1,41 +0,0 @@
1/*
2 * Copyright (C) 2013 Broadcom Corporation
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation version 2.
7 *
8 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 * kind, whether express or implied; without even the implied warranty
10 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */
13
14#include <linux/linkage.h>
15#include "bcm_kona_smc.h"
16
17/*
18 * int bcm_kona_smc_asm(u32 service_id, u32 buffer_addr)
19 */
20
21ENTRY(bcm_kona_smc_asm)
22 stmfd sp!, {r4-r12, lr}
23 mov r4, r0 @ service_id
24 mov r5, #3 @ Keep IRQ and FIQ off in SM
25 /*
26 * Since interrupts are disabled in the open mode, we must keep
27 * interrupts disabled in secure mode by setting R5=0x3. If interrupts
28 * are enabled in open mode, we can set R5=0x0 to allow interrupts in
29 * secure mode. If we did this, the secure monitor would return back
30 * control to the open mode to handle the interrupt prior to completing
31 * the secure service. If this happened, R12 would not be
32 * SEC_EXIT_NORMAL and we would need to call SMC again after resetting
33 * R5 (it gets clobbered by the secure monitor) and setting R4 to
34 * SSAPI_RET_FROM_INT_SERV to indicate that we want the secure monitor
35 * to finish up the previous uncompleted secure service.
36 */
37 mov r6, r1 @ buffer_addr
38 smc #0
39 /* Check r12 for SEC_EXIT_NORMAL here if interrupts are enabled */
40 ldmfd sp!, {r4-r12, pc}
41ENDPROC(bcm_kona_smc_asm)
diff --git a/arch/arm/mach-bcm/board_bcm21664.c b/arch/arm/mach-bcm/board_bcm21664.c
index acc1573fd005..f0521cc0640d 100644
--- a/arch/arm/mach-bcm/board_bcm21664.c
+++ b/arch/arm/mach-bcm/board_bcm21664.c
@@ -11,14 +11,13 @@
11 * GNU General Public License for more details. 11 * GNU General Public License for more details.
12 */ 12 */
13 13
14#include <linux/clocksource.h>
15#include <linux/of_address.h> 14#include <linux/of_address.h>
16#include <linux/of_platform.h> 15#include <linux/of_platform.h>
16#include <linux/io.h>
17 17
18#include <asm/mach/arch.h> 18#include <asm/mach/arch.h>
19 19
20#include "bcm_kona_smc.h" 20#include "kona_l2_cache.h"
21#include "kona.h"
22 21
23#define RSTMGR_DT_STRING "brcm,bcm21664-resetmgr" 22#define RSTMGR_DT_STRING "brcm,bcm21664-resetmgr"
24 23
diff --git a/arch/arm/mach-bcm/board_bcm281xx.c b/arch/arm/mach-bcm/board_bcm281xx.c
index 6be54c10f8cb..1ac59fc0cb15 100644
--- a/arch/arm/mach-bcm/board_bcm281xx.c
+++ b/arch/arm/mach-bcm/board_bcm281xx.c
@@ -17,7 +17,7 @@
17 17
18#include <asm/mach/arch.h> 18#include <asm/mach/arch.h>
19 19
20#include "kona.h" 20#include "kona_l2_cache.h"
21 21
22#define SECWDOG_OFFSET 0x00000000 22#define SECWDOG_OFFSET 0x00000000
23#define SECWDOG_RESERVED_MASK 0xe2000000 23#define SECWDOG_RESERVED_MASK 0xe2000000
diff --git a/arch/arm/mach-bcm/kona.c b/arch/arm/mach-bcm/kona_l2_cache.c
index 768bc2837bf5..b31970377c20 100644
--- a/arch/arm/mach-bcm/kona.c
+++ b/arch/arm/mach-bcm/kona_l2_cache.c
@@ -11,19 +11,18 @@
11 * GNU General Public License for more details. 11 * GNU General Public License for more details.
12 */ 12 */
13 13
14#include <linux/of_platform.h> 14
15#include <linux/init.h>
16#include <linux/printk.h>
15#include <asm/hardware/cache-l2x0.h> 17#include <asm/hardware/cache-l2x0.h>
16 18
17#include "bcm_kona_smc.h" 19#include "bcm_kona_smc.h"
18#include "kona.h"
19 20
20void __init kona_l2_cache_init(void) 21void __init kona_l2_cache_init(void)
21{ 22{
23 unsigned int result;
22 int ret; 24 int ret;
23 25
24 if (!IS_ENABLED(CONFIG_CACHE_L2X0))
25 return;
26
27 ret = bcm_kona_smc_init(); 26 ret = bcm_kona_smc_init();
28 if (ret) { 27 if (ret) {
29 pr_info("Secure API not available (%d). Skipping L2 init.\n", 28 pr_info("Secure API not available (%d). Skipping L2 init.\n",
@@ -31,7 +30,12 @@ void __init kona_l2_cache_init(void)
31 return; 30 return;
32 } 31 }
33 32
34 bcm_kona_smc(SSAPI_ENABLE_L2_CACHE, 0, 0, 0, 0); 33 result = bcm_kona_smc(SSAPI_ENABLE_L2_CACHE, 0, 0, 0, 0);
34 if (result != SEC_ROM_RET_OK) {
35 pr_err("Secure Monitor call failed (%u)! Skipping L2 init.\n",
36 result);
37 return;
38 }
35 39
36 /* 40 /*
37 * The aux_val and aux_mask have no effect since L2 cache is already 41 * The aux_val and aux_mask have no effect since L2 cache is already
diff --git a/arch/arm/mach-bcm/kona.h b/arch/arm/mach-bcm/kona_l2_cache.h
index 3a7a017c29cd..46f84a95ab1c 100644
--- a/arch/arm/mach-bcm/kona.h
+++ b/arch/arm/mach-bcm/kona_l2_cache.h
@@ -11,4 +11,8 @@
11 * GNU General Public License for more details. 11 * GNU General Public License for more details.
12 */ 12 */
13 13
14void __init kona_l2_cache_init(void); 14#ifdef CONFIG_ARCH_BCM_MOBILE_L2_CACHE
15void kona_l2_cache_init(void);
16#else
17#define kona_l2_cache_init() ((void)0)
18#endif
diff --git a/arch/arm/mach-cns3xxx/Kconfig b/arch/arm/mach-cns3xxx/Kconfig
index dce8decd5d46..66838f42037f 100644
--- a/arch/arm/mach-cns3xxx/Kconfig
+++ b/arch/arm/mach-cns3xxx/Kconfig
@@ -1,7 +1,6 @@
1config ARCH_CNS3XXX 1config ARCH_CNS3XXX
2 bool "Cavium Networks CNS3XXX family" if ARCH_MULTI_V6 2 bool "Cavium Networks CNS3XXX family" if ARCH_MULTI_V6
3 select ARM_GIC 3 select ARM_GIC
4 select MIGHT_HAVE_PCI
5 select PCI_DOMAINS if PCI 4 select PCI_DOMAINS if PCI
6 help 5 help
7 Support for Cavium Networks CNS3XXX platform. 6 Support for Cavium Networks CNS3XXX platform.
diff --git a/arch/arm/mach-exynos/Makefile b/arch/arm/mach-exynos/Makefile
index a656dbe3b78c..f6dcc256db56 100644
--- a/arch/arm/mach-exynos/Makefile
+++ b/arch/arm/mach-exynos/Makefile
@@ -12,20 +12,15 @@ obj- :=
12 12
13# Core 13# Core
14 14
15obj-$(CONFIG_ARCH_EXYNOS) += exynos.o 15obj-$(CONFIG_ARCH_EXYNOS) += exynos.o pmu.o exynos-smc.o firmware.o
16 16
17obj-$(CONFIG_PM_SLEEP) += pm.o sleep.o 17obj-$(CONFIG_PM_SLEEP) += pm.o sleep.o
18obj-$(CONFIG_PM_GENERIC_DOMAINS) += pm_domains.o 18obj-$(CONFIG_PM_GENERIC_DOMAINS) += pm_domains.o
19obj-$(CONFIG_CPU_IDLE) += cpuidle.o 19obj-$(CONFIG_CPU_IDLE) += cpuidle.o
20 20
21obj-$(CONFIG_ARCH_EXYNOS) += pmu.o
22
23obj-$(CONFIG_SMP) += platsmp.o headsmp.o 21obj-$(CONFIG_SMP) += platsmp.o headsmp.o
24 22
25obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o 23obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
26 24
27obj-$(CONFIG_ARCH_EXYNOS) += exynos-smc.o
28obj-$(CONFIG_ARCH_EXYNOS) += firmware.o
29
30plus_sec := $(call as-instr,.arch_extension sec,+sec) 25plus_sec := $(call as-instr,.arch_extension sec,+sec)
31AFLAGS_exynos-smc.o :=-Wa,-march=armv7-a$(plus_sec) 26AFLAGS_exynos-smc.o :=-Wa,-march=armv7-a$(plus_sec)
diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h
index 9ef3f83efaff..c1a2f2207af0 100644
--- a/arch/arm/mach-exynos/common.h
+++ b/arch/arm/mach-exynos/common.h
@@ -15,6 +15,75 @@
15#include <linux/reboot.h> 15#include <linux/reboot.h>
16#include <linux/of.h> 16#include <linux/of.h>
17 17
18#define EXYNOS4210_CPU_ID 0x43210000
19#define EXYNOS4212_CPU_ID 0x43220000
20#define EXYNOS4412_CPU_ID 0xE4412200
21#define EXYNOS4_CPU_MASK 0xFFFE0000
22
23#define EXYNOS5250_SOC_ID 0x43520000
24#define EXYNOS5420_SOC_ID 0xE5420000
25#define EXYNOS5440_SOC_ID 0xE5440000
26#define EXYNOS5_SOC_MASK 0xFFFFF000
27
28extern unsigned long samsung_cpu_id;
29
30#define IS_SAMSUNG_CPU(name, id, mask) \
31static inline int is_samsung_##name(void) \
32{ \
33 return ((samsung_cpu_id & mask) == (id & mask)); \
34}
35
36IS_SAMSUNG_CPU(exynos4210, EXYNOS4210_CPU_ID, EXYNOS4_CPU_MASK)
37IS_SAMSUNG_CPU(exynos4212, EXYNOS4212_CPU_ID, EXYNOS4_CPU_MASK)
38IS_SAMSUNG_CPU(exynos4412, EXYNOS4412_CPU_ID, EXYNOS4_CPU_MASK)
39IS_SAMSUNG_CPU(exynos5250, EXYNOS5250_SOC_ID, EXYNOS5_SOC_MASK)
40IS_SAMSUNG_CPU(exynos5420, EXYNOS5420_SOC_ID, EXYNOS5_SOC_MASK)
41IS_SAMSUNG_CPU(exynos5440, EXYNOS5440_SOC_ID, EXYNOS5_SOC_MASK)
42
43#if defined(CONFIG_CPU_EXYNOS4210)
44# define soc_is_exynos4210() is_samsung_exynos4210()
45#else
46# define soc_is_exynos4210() 0
47#endif
48
49#if defined(CONFIG_SOC_EXYNOS4212)
50# define soc_is_exynos4212() is_samsung_exynos4212()
51#else
52# define soc_is_exynos4212() 0
53#endif
54
55#if defined(CONFIG_SOC_EXYNOS4412)
56# define soc_is_exynos4412() is_samsung_exynos4412()
57#else
58# define soc_is_exynos4412() 0
59#endif
60
61#define EXYNOS4210_REV_0 (0x0)
62#define EXYNOS4210_REV_1_0 (0x10)
63#define EXYNOS4210_REV_1_1 (0x11)
64
65#if defined(CONFIG_SOC_EXYNOS5250)
66# define soc_is_exynos5250() is_samsung_exynos5250()
67#else
68# define soc_is_exynos5250() 0
69#endif
70
71#if defined(CONFIG_SOC_EXYNOS5420)
72# define soc_is_exynos5420() is_samsung_exynos5420()
73#else
74# define soc_is_exynos5420() 0
75#endif
76
77#if defined(CONFIG_SOC_EXYNOS5440)
78# define soc_is_exynos5440() is_samsung_exynos5440()
79#else
80# define soc_is_exynos5440() 0
81#endif
82
83#define soc_is_exynos4() (soc_is_exynos4210() || soc_is_exynos4212() || \
84 soc_is_exynos4412())
85#define soc_is_exynos5() (soc_is_exynos5250() || soc_is_exynos5420())
86
18void mct_init(void __iomem *base, int irq_g0, int irq_l0, int irq_l1); 87void mct_init(void __iomem *base, int irq_g0, int irq_l0, int irq_l1);
19 88
20struct map_desc; 89struct map_desc;
@@ -63,4 +132,7 @@ struct exynos_pmu_conf {
63 132
64extern void exynos_sys_powerdown_conf(enum sys_powerdown mode); 133extern void exynos_sys_powerdown_conf(enum sys_powerdown mode);
65 134
135extern void s5p_init_cpu(void __iomem *cpuid_addr);
136extern unsigned int samsung_rev(void);
137
66#endif /* __ARCH_ARM_MACH_EXYNOS_COMMON_H */ 138#endif /* __ARCH_ARM_MACH_EXYNOS_COMMON_H */
diff --git a/arch/arm/mach-exynos/cpuidle.c b/arch/arm/mach-exynos/cpuidle.c
index c57cae0e8779..3dd385ebf195 100644
--- a/arch/arm/mach-exynos/cpuidle.c
+++ b/arch/arm/mach-exynos/cpuidle.c
@@ -24,7 +24,6 @@
24#include <asm/unified.h> 24#include <asm/unified.h>
25#include <asm/cpuidle.h> 25#include <asm/cpuidle.h>
26 26
27#include <plat/cpu.h>
28#include <plat/pm.h> 27#include <plat/pm.h>
29 28
30#include <mach/map.h> 29#include <mach/map.h>
diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c
index b32a907d021d..59aab756702e 100644
--- a/arch/arm/mach-exynos/exynos.c
+++ b/arch/arm/mach-exynos/exynos.c
@@ -26,8 +26,6 @@
26#include <asm/mach/map.h> 26#include <asm/mach/map.h>
27#include <asm/memory.h> 27#include <asm/memory.h>
28 28
29#include <plat/cpu.h>
30
31#include "common.h" 29#include "common.h"
32#include "mfc.h" 30#include "mfc.h"
33#include "regs-pmu.h" 31#include "regs-pmu.h"
@@ -308,17 +306,6 @@ void __init exynos_init_io(void)
308 exynos_map_io(); 306 exynos_map_io();
309} 307}
310 308
311struct bus_type exynos_subsys = {
312 .name = "exynos-core",
313 .dev_name = "exynos-core",
314};
315
316static int __init exynos_core_init(void)
317{
318 return subsys_system_register(&exynos_subsys, NULL);
319}
320core_initcall(exynos_core_init);
321
322static int __init exynos4_l2x0_cache_init(void) 309static int __init exynos4_l2x0_cache_init(void)
323{ 310{
324 int ret; 311 int ret;
diff --git a/arch/arm/mach-exynos/firmware.c b/arch/arm/mach-exynos/firmware.c
index aa01c4222b40..f6cb510aee85 100644
--- a/arch/arm/mach-exynos/firmware.c
+++ b/arch/arm/mach-exynos/firmware.c
@@ -18,8 +18,7 @@
18 18
19#include <mach/map.h> 19#include <mach/map.h>
20 20
21#include <plat/cpu.h> 21#include "common.h"
22
23#include "smc.h" 22#include "smc.h"
24 23
25static int exynos_do_idle(void) 24static int exynos_do_idle(void)
diff --git a/arch/arm/mach-exynos/hotplug.c b/arch/arm/mach-exynos/hotplug.c
index 5eead530c6f8..3cab3f506689 100644
--- a/arch/arm/mach-exynos/hotplug.c
+++ b/arch/arm/mach-exynos/hotplug.c
@@ -19,61 +19,9 @@
19#include <asm/cp15.h> 19#include <asm/cp15.h>
20#include <asm/smp_plat.h> 20#include <asm/smp_plat.h>
21 21
22#include <plat/cpu.h>
23
24#include "common.h" 22#include "common.h"
25#include "regs-pmu.h" 23#include "regs-pmu.h"
26 24
27static inline void cpu_enter_lowpower_a9(void)
28{
29 unsigned int v;
30
31 asm volatile(
32 " mcr p15, 0, %1, c7, c5, 0\n"
33 " mcr p15, 0, %1, c7, c10, 4\n"
34 /*
35 * Turn off coherency
36 */
37 " mrc p15, 0, %0, c1, c0, 1\n"
38 " bic %0, %0, %3\n"
39 " mcr p15, 0, %0, c1, c0, 1\n"
40 " mrc p15, 0, %0, c1, c0, 0\n"
41 " bic %0, %0, %2\n"
42 " mcr p15, 0, %0, c1, c0, 0\n"
43 : "=&r" (v)
44 : "r" (0), "Ir" (CR_C), "Ir" (0x40)
45 : "cc");
46}
47
48static inline void cpu_enter_lowpower_a15(void)
49{
50 unsigned int v;
51
52 asm volatile(
53 " mrc p15, 0, %0, c1, c0, 0\n"
54 " bic %0, %0, %1\n"
55 " mcr p15, 0, %0, c1, c0, 0\n"
56 : "=&r" (v)
57 : "Ir" (CR_C)
58 : "cc");
59
60 flush_cache_louis();
61
62 asm volatile(
63 /*
64 * Turn off coherency
65 */
66 " mrc p15, 0, %0, c1, c0, 1\n"
67 " bic %0, %0, %1\n"
68 " mcr p15, 0, %0, c1, c0, 1\n"
69 : "=&r" (v)
70 : "Ir" (0x40)
71 : "cc");
72
73 isb();
74 dsb();
75}
76
77static inline void cpu_leave_lowpower(void) 25static inline void cpu_leave_lowpower(void)
78{ 26{
79 unsigned int v; 27 unsigned int v;
@@ -132,19 +80,8 @@ static inline void platform_do_lowpower(unsigned int cpu, int *spurious)
132void __ref exynos_cpu_die(unsigned int cpu) 80void __ref exynos_cpu_die(unsigned int cpu)
133{ 81{
134 int spurious = 0; 82 int spurious = 0;
135 int primary_part = 0;
136 83
137 /* 84 v7_exit_coherency_flush(louis);
138 * we're ready for shutdown now, so do it.
139 * Exynos4 is A9 based while Exynos5 is A15; check the CPU part
140 * number by reading the Main ID register and then perform the
141 * appropriate sequence for entering low power.
142 */
143 asm("mrc p15, 0, %0, c0, c0, 0" : "=r"(primary_part) : : "cc");
144 if ((primary_part & 0xfff0) == 0xc0f0)
145 cpu_enter_lowpower_a15();
146 else
147 cpu_enter_lowpower_a9();
148 85
149 platform_do_lowpower(cpu, &spurious); 86 platform_do_lowpower(cpu, &spurious);
150 87
diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c
index 03e5e9f94705..c28cdb1c82cd 100644
--- a/arch/arm/mach-exynos/platsmp.c
+++ b/arch/arm/mach-exynos/platsmp.c
@@ -26,8 +26,6 @@
26#include <asm/smp_scu.h> 26#include <asm/smp_scu.h>
27#include <asm/firmware.h> 27#include <asm/firmware.h>
28 28
29#include <plat/cpu.h>
30
31#include "common.h" 29#include "common.h"
32#include "regs-pmu.h" 30#include "regs-pmu.h"
33 31
diff --git a/arch/arm/mach-exynos/pm.c b/arch/arm/mach-exynos/pm.c
index 15af0ceb0a66..ca672e24b5cd 100644
--- a/arch/arm/mach-exynos/pm.c
+++ b/arch/arm/mach-exynos/pm.c
@@ -26,7 +26,6 @@
26#include <asm/smp_scu.h> 26#include <asm/smp_scu.h>
27#include <asm/suspend.h> 27#include <asm/suspend.h>
28 28
29#include <plat/cpu.h>
30#include <plat/pm-common.h> 29#include <plat/pm-common.h>
31#include <plat/pll.h> 30#include <plat/pll.h>
32#include <plat/regs-srom.h> 31#include <plat/regs-srom.h>
diff --git a/arch/arm/mach-exynos/pmu.c b/arch/arm/mach-exynos/pmu.c
index 05c7ce15322a..fb0deda3b3a4 100644
--- a/arch/arm/mach-exynos/pmu.c
+++ b/arch/arm/mach-exynos/pmu.c
@@ -13,8 +13,6 @@
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/bug.h> 14#include <linux/bug.h>
15 15
16#include <plat/cpu.h>
17
18#include "common.h" 16#include "common.h"
19#include "regs-pmu.h" 17#include "regs-pmu.h"
20 18
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index 5740296dc429..50bb546b893a 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -796,7 +796,6 @@ config SOC_IMX6Q
796 select ARM_ERRATA_764369 if SMP 796 select ARM_ERRATA_764369 if SMP
797 select HAVE_ARM_SCU if SMP 797 select HAVE_ARM_SCU if SMP
798 select HAVE_ARM_TWD if SMP 798 select HAVE_ARM_TWD if SMP
799 select MIGHT_HAVE_PCI
800 select PCI_DOMAINS if PCI 799 select PCI_DOMAINS if PCI
801 select PINCTRL_IMX6Q 800 select PINCTRL_IMX6Q
802 select SOC_IMX6 801 select SOC_IMX6
diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig
index 3f73eecbcfb0..2052a90d9981 100644
--- a/arch/arm/mach-mvebu/Kconfig
+++ b/arch/arm/mach-mvebu/Kconfig
@@ -3,15 +3,12 @@ config ARCH_MVEBU
3 select ARCH_SUPPORTS_BIG_ENDIAN 3 select ARCH_SUPPORTS_BIG_ENDIAN
4 select CLKSRC_MMIO 4 select CLKSRC_MMIO
5 select GENERIC_IRQ_CHIP 5 select GENERIC_IRQ_CHIP
6 select IRQ_DOMAIN
7 select PINCTRL 6 select PINCTRL
8 select PLAT_ORION 7 select PLAT_ORION
9 select MVEBU_MBUS 8 select MVEBU_MBUS
10 select ZONE_DMA if ARM_LPAE 9 select ZONE_DMA if ARM_LPAE
11 select ARCH_REQUIRE_GPIOLIB 10 select ARCH_REQUIRE_GPIOLIB
12 select MIGHT_HAVE_PCI
13 select PCI_QUIRKS if PCI 11 select PCI_QUIRKS if PCI
14 select OF_ADDRESS_PCI
15 12
16if ARCH_MVEBU 13if ARCH_MVEBU
17 14
@@ -38,7 +35,6 @@ config MACH_ARMADA_375
38 select ARM_ERRATA_753970 35 select ARM_ERRATA_753970
39 select ARM_GIC 36 select ARM_GIC
40 select ARMADA_375_CLK 37 select ARMADA_375_CLK
41 select CPU_V7
42 select MACH_MVEBU_V7 38 select MACH_MVEBU_V7
43 select PINCTRL_ARMADA_375 39 select PINCTRL_ARMADA_375
44 help 40 help
@@ -51,7 +47,6 @@ config MACH_ARMADA_38X
51 select ARM_ERRATA_753970 47 select ARM_ERRATA_753970
52 select ARM_GIC 48 select ARM_GIC
53 select ARMADA_38X_CLK 49 select ARMADA_38X_CLK
54 select CPU_V7
55 select MACH_MVEBU_V7 50 select MACH_MVEBU_V7
56 select PINCTRL_ARMADA_38X 51 select PINCTRL_ARMADA_38X
57 help 52 help
@@ -86,13 +81,11 @@ config MACH_KIRKWOOD
86 select ARCH_REQUIRE_GPIOLIB 81 select ARCH_REQUIRE_GPIOLIB
87 select CPU_FEROCEON 82 select CPU_FEROCEON
88 select KIRKWOOD_CLK 83 select KIRKWOOD_CLK
89 select OF_IRQ
90 select ORION_IRQCHIP 84 select ORION_IRQCHIP
91 select ORION_TIMER 85 select ORION_TIMER
92 select PCI 86 select PCI
93 select PCI_QUIRKS 87 select PCI_QUIRKS
94 select PINCTRL_KIRKWOOD 88 select PINCTRL_KIRKWOOD
95 select USE_OF
96 help 89 help
97 Say 'Y' here if you want your kernel to support boards based 90 Say 'Y' here if you want your kernel to support boards based
98 on the Marvell Kirkwood device tree. 91 on the Marvell Kirkwood device tree.
diff --git a/arch/arm/mach-omap2/board-flash.c b/arch/arm/mach-omap2/board-flash.c
index b6885e42c0a0..e87f2a83d6bf 100644
--- a/arch/arm/mach-omap2/board-flash.c
+++ b/arch/arm/mach-omap2/board-flash.c
@@ -160,13 +160,13 @@ static u8 get_gpmc0_type(void)
160 if (!fpga_map_addr) 160 if (!fpga_map_addr)
161 return -ENOMEM; 161 return -ENOMEM;
162 162
163 if (!(__raw_readw(fpga_map_addr + REG_FPGA_REV))) 163 if (!(readw_relaxed(fpga_map_addr + REG_FPGA_REV)))
164 /* we dont have an DEBUG FPGA??? */ 164 /* we dont have an DEBUG FPGA??? */
165 /* Depend on #defines!! default to strata boot return param */ 165 /* Depend on #defines!! default to strata boot return param */
166 goto unmap; 166 goto unmap;
167 167
168 /* S8-DIP-OFF = 1, S8-DIP-ON = 0 */ 168 /* S8-DIP-OFF = 1, S8-DIP-ON = 0 */
169 cs = __raw_readw(fpga_map_addr + REG_FPGA_DIP_SWITCH_INPUT2) & 0xf; 169 cs = readw_relaxed(fpga_map_addr + REG_FPGA_DIP_SWITCH_INPUT2) & 0xf;
170 170
171 /* ES2.0 SDP's onwards 4 dip switches are provided for CS */ 171 /* ES2.0 SDP's onwards 4 dip switches are provided for CS */
172 if (omap_rev() >= OMAP3430_REV_ES1_0) 172 if (omap_rev() >= OMAP3430_REV_ES1_0)
diff --git a/arch/arm/mach-omap2/clkt2xxx_dpllcore.c b/arch/arm/mach-omap2/clkt2xxx_dpllcore.c
index 3ff32543493c..59cf310bc1e9 100644
--- a/arch/arm/mach-omap2/clkt2xxx_dpllcore.c
+++ b/arch/arm/mach-omap2/clkt2xxx_dpllcore.c
@@ -138,7 +138,7 @@ int omap2_reprogram_dpllcore(struct clk_hw *hw, unsigned long rate,
138 if (!dd) 138 if (!dd)
139 return -EINVAL; 139 return -EINVAL;
140 140
141 tmpset.cm_clksel1_pll = __raw_readl(dd->mult_div1_reg); 141 tmpset.cm_clksel1_pll = readl_relaxed(dd->mult_div1_reg);
142 tmpset.cm_clksel1_pll &= ~(dd->mult_mask | 142 tmpset.cm_clksel1_pll &= ~(dd->mult_mask |
143 dd->div1_mask); 143 dd->div1_mask);
144 div = ((curr_prcm_set->xtal_speed / 1000000) - 1); 144 div = ((curr_prcm_set->xtal_speed / 1000000) - 1);
diff --git a/arch/arm/mach-omap2/clkt2xxx_osc.c b/arch/arm/mach-omap2/clkt2xxx_osc.c
index 19f54d433490..0717dff1bc04 100644
--- a/arch/arm/mach-omap2/clkt2xxx_osc.c
+++ b/arch/arm/mach-omap2/clkt2xxx_osc.c
@@ -39,9 +39,9 @@ int omap2_enable_osc_ck(struct clk_hw *clk)
39{ 39{
40 u32 pcc; 40 u32 pcc;
41 41
42 pcc = __raw_readl(prcm_clksrc_ctrl); 42 pcc = readl_relaxed(prcm_clksrc_ctrl);
43 43
44 __raw_writel(pcc & ~OMAP_AUTOEXTCLKMODE_MASK, prcm_clksrc_ctrl); 44 writel_relaxed(pcc & ~OMAP_AUTOEXTCLKMODE_MASK, prcm_clksrc_ctrl);
45 45
46 return 0; 46 return 0;
47} 47}
@@ -57,9 +57,9 @@ void omap2_disable_osc_ck(struct clk_hw *clk)
57{ 57{
58 u32 pcc; 58 u32 pcc;
59 59
60 pcc = __raw_readl(prcm_clksrc_ctrl); 60 pcc = readl_relaxed(prcm_clksrc_ctrl);
61 61
62 __raw_writel(pcc | OMAP_AUTOEXTCLKMODE_MASK, prcm_clksrc_ctrl); 62 writel_relaxed(pcc | OMAP_AUTOEXTCLKMODE_MASK, prcm_clksrc_ctrl);
63} 63}
64 64
65unsigned long omap2_osc_clk_recalc(struct clk_hw *clk, 65unsigned long omap2_osc_clk_recalc(struct clk_hw *clk,
diff --git a/arch/arm/mach-omap2/clkt2xxx_sys.c b/arch/arm/mach-omap2/clkt2xxx_sys.c
index f467d072cd02..58dd3a9b726c 100644
--- a/arch/arm/mach-omap2/clkt2xxx_sys.c
+++ b/arch/arm/mach-omap2/clkt2xxx_sys.c
@@ -33,7 +33,7 @@ u32 omap2xxx_get_sysclkdiv(void)
33{ 33{
34 u32 div; 34 u32 div;
35 35
36 div = __raw_readl(prcm_clksrc_ctrl); 36 div = readl_relaxed(prcm_clksrc_ctrl);
37 div &= OMAP_SYSCLKDIV_MASK; 37 div &= OMAP_SYSCLKDIV_MASK;
38 div >>= OMAP_SYSCLKDIV_SHIFT; 38 div >>= OMAP_SYSCLKDIV_SHIFT;
39 39
diff --git a/arch/arm/mach-omap2/clockdomain.h b/arch/arm/mach-omap2/clockdomain.h
index f17f00697cc0..82c37b1becc4 100644
--- a/arch/arm/mach-omap2/clockdomain.h
+++ b/arch/arm/mach-omap2/clockdomain.h
@@ -18,7 +18,6 @@
18 18
19#include "powerdomain.h" 19#include "powerdomain.h"
20#include "clock.h" 20#include "clock.h"
21#include "omap_hwmod.h"
22 21
23/* 22/*
24 * Clockdomain flags 23 * Clockdomain flags
@@ -98,6 +97,8 @@ struct clkdm_dep {
98/* Possible flags for struct clockdomain._flags */ 97/* Possible flags for struct clockdomain._flags */
99#define _CLKDM_FLAG_HWSUP_ENABLED BIT(0) 98#define _CLKDM_FLAG_HWSUP_ENABLED BIT(0)
100 99
100struct omap_hwmod;
101
101/** 102/**
102 * struct clockdomain - OMAP clockdomain 103 * struct clockdomain - OMAP clockdomain
103 * @name: clockdomain name 104 * @name: clockdomain name
diff --git a/arch/arm/mach-omap2/cm2xxx.c b/arch/arm/mach-omap2/cm2xxx.c
index ce25abbcffae..8be6ea50c092 100644
--- a/arch/arm/mach-omap2/cm2xxx.c
+++ b/arch/arm/mach-omap2/cm2xxx.c
@@ -18,9 +18,6 @@
18#include <linux/err.h> 18#include <linux/err.h>
19#include <linux/io.h> 19#include <linux/io.h>
20 20
21#include "soc.h"
22#include "iomap.h"
23#include "common.h"
24#include "prm2xxx.h" 21#include "prm2xxx.h"
25#include "cm.h" 22#include "cm.h"
26#include "cm2xxx.h" 23#include "cm2xxx.h"
@@ -390,7 +387,7 @@ void omap2xxx_cm_set_mod_dividers(u32 mpu, u32 dsp, u32 gfx, u32 core, u32 mdm)
390 tmp = omap2_cm_read_mod_reg(CORE_MOD, CM_CLKSEL1) & 387 tmp = omap2_cm_read_mod_reg(CORE_MOD, CM_CLKSEL1) &
391 OMAP24XX_CLKSEL_DSS2_MASK; 388 OMAP24XX_CLKSEL_DSS2_MASK;
392 omap2_cm_write_mod_reg(core | tmp, CORE_MOD, CM_CLKSEL1); 389 omap2_cm_write_mod_reg(core | tmp, CORE_MOD, CM_CLKSEL1);
393 if (cpu_is_omap2430()) 390 if (mdm)
394 omap2_cm_write_mod_reg(mdm, OMAP2430_MDM_MOD, CM_CLKSEL); 391 omap2_cm_write_mod_reg(mdm, OMAP2430_MDM_MOD, CM_CLKSEL);
395} 392}
396 393
@@ -405,19 +402,11 @@ static struct cm_ll_data omap2xxx_cm_ll_data = {
405 402
406int __init omap2xxx_cm_init(void) 403int __init omap2xxx_cm_init(void)
407{ 404{
408 if (!cpu_is_omap24xx())
409 return 0;
410
411 return cm_register(&omap2xxx_cm_ll_data); 405 return cm_register(&omap2xxx_cm_ll_data);
412} 406}
413 407
414static void __exit omap2xxx_cm_exit(void) 408static void __exit omap2xxx_cm_exit(void)
415{ 409{
416 if (!cpu_is_omap24xx()) 410 cm_unregister(&omap2xxx_cm_ll_data);
417 return;
418
419 /* Should never happen */
420 WARN(cm_unregister(&omap2xxx_cm_ll_data),
421 "%s: cm_ll_data function pointer mismatch\n", __func__);
422} 411}
423__exitcall(omap2xxx_cm_exit); 412__exitcall(omap2xxx_cm_exit);
diff --git a/arch/arm/mach-omap2/cm2xxx_3xxx.h b/arch/arm/mach-omap2/cm2xxx_3xxx.h
index bfbd16fe9151..72928a3ce2aa 100644
--- a/arch/arm/mach-omap2/cm2xxx_3xxx.h
+++ b/arch/arm/mach-omap2/cm2xxx_3xxx.h
@@ -52,12 +52,12 @@
52 52
53static inline u32 omap2_cm_read_mod_reg(s16 module, u16 idx) 53static inline u32 omap2_cm_read_mod_reg(s16 module, u16 idx)
54{ 54{
55 return __raw_readl(cm_base + module + idx); 55 return readl_relaxed(cm_base + module + idx);
56} 56}
57 57
58static inline void omap2_cm_write_mod_reg(u32 val, s16 module, u16 idx) 58static inline void omap2_cm_write_mod_reg(u32 val, s16 module, u16 idx)
59{ 59{
60 __raw_writel(val, cm_base + module + idx); 60 writel_relaxed(val, cm_base + module + idx);
61} 61}
62 62
63/* Read-modify-write a register in a CM module. Caller must lock */ 63/* Read-modify-write a register in a CM module. Caller must lock */
diff --git a/arch/arm/mach-omap2/cm33xx.c b/arch/arm/mach-omap2/cm33xx.c
index 40a22e5649ae..b3f99e93def0 100644
--- a/arch/arm/mach-omap2/cm33xx.c
+++ b/arch/arm/mach-omap2/cm33xx.c
@@ -50,13 +50,13 @@
50/* Read a register in a CM instance */ 50/* Read a register in a CM instance */
51static inline u32 am33xx_cm_read_reg(u16 inst, u16 idx) 51static inline u32 am33xx_cm_read_reg(u16 inst, u16 idx)
52{ 52{
53 return __raw_readl(cm_base + inst + idx); 53 return readl_relaxed(cm_base + inst + idx);
54} 54}
55 55
56/* Write into a register in a CM */ 56/* Write into a register in a CM */
57static inline void am33xx_cm_write_reg(u32 val, u16 inst, u16 idx) 57static inline void am33xx_cm_write_reg(u32 val, u16 inst, u16 idx)
58{ 58{
59 __raw_writel(val, cm_base + inst + idx); 59 writel_relaxed(val, cm_base + inst + idx);
60} 60}
61 61
62/* Read-modify-write a register in CM */ 62/* Read-modify-write a register in CM */
diff --git a/arch/arm/mach-omap2/cm33xx.h b/arch/arm/mach-omap2/cm33xx.h
index cfb8891b0c0e..15a778ce7707 100644
--- a/arch/arm/mach-omap2/cm33xx.h
+++ b/arch/arm/mach-omap2/cm33xx.h
@@ -17,11 +17,8 @@
17#ifndef __ARCH_ARM_MACH_OMAP2_CM_33XX_H 17#ifndef __ARCH_ARM_MACH_OMAP2_CM_33XX_H
18#define __ARCH_ARM_MACH_OMAP2_CM_33XX_H 18#define __ARCH_ARM_MACH_OMAP2_CM_33XX_H
19 19
20#include "common.h"
21
22#include "cm.h" 20#include "cm.h"
23#include "cm-regbits-33xx.h" 21#include "cm-regbits-33xx.h"
24#include "iomap.h"
25 22
26/* CM base address */ 23/* CM base address */
27#define AM33XX_CM_BASE 0x44e00000 24#define AM33XX_CM_BASE 0x44e00000
diff --git a/arch/arm/mach-omap2/cm3xxx.c b/arch/arm/mach-omap2/cm3xxx.c
index f6f028867bfe..129a4e7f6ef5 100644
--- a/arch/arm/mach-omap2/cm3xxx.c
+++ b/arch/arm/mach-omap2/cm3xxx.c
@@ -18,9 +18,6 @@
18#include <linux/err.h> 18#include <linux/err.h>
19#include <linux/io.h> 19#include <linux/io.h>
20 20
21#include "soc.h"
22#include "iomap.h"
23#include "common.h"
24#include "prm2xxx_3xxx.h" 21#include "prm2xxx_3xxx.h"
25#include "cm.h" 22#include "cm.h"
26#include "cm3xxx.h" 23#include "cm3xxx.h"
@@ -388,7 +385,8 @@ void omap3_cm_save_context(void)
388 omap2_cm_read_mod_reg(OMAP3430_IVA2_MOD, CM_CLKSEL1); 385 omap2_cm_read_mod_reg(OMAP3430_IVA2_MOD, CM_CLKSEL1);
389 cm_context.iva2_cm_clksel2 = 386 cm_context.iva2_cm_clksel2 =
390 omap2_cm_read_mod_reg(OMAP3430_IVA2_MOD, CM_CLKSEL2); 387 omap2_cm_read_mod_reg(OMAP3430_IVA2_MOD, CM_CLKSEL2);
391 cm_context.cm_sysconfig = __raw_readl(OMAP3430_CM_SYSCONFIG); 388 cm_context.cm_sysconfig =
389 omap2_cm_read_mod_reg(OCP_MOD, OMAP3430_CM_SYSCONFIG);
392 cm_context.sgx_cm_clksel = 390 cm_context.sgx_cm_clksel =
393 omap2_cm_read_mod_reg(OMAP3430ES2_SGX_MOD, CM_CLKSEL); 391 omap2_cm_read_mod_reg(OMAP3430ES2_SGX_MOD, CM_CLKSEL);
394 cm_context.dss_cm_clksel = 392 cm_context.dss_cm_clksel =
@@ -418,7 +416,8 @@ void omap3_cm_save_context(void)
418 omap2_cm_read_mod_reg(PLL_MOD, OMAP3430ES2_CM_CLKSEL5); 416 omap2_cm_read_mod_reg(PLL_MOD, OMAP3430ES2_CM_CLKSEL5);
419 cm_context.pll_cm_clken2 = 417 cm_context.pll_cm_clken2 =
420 omap2_cm_read_mod_reg(PLL_MOD, OMAP3430ES2_CM_CLKEN2); 418 omap2_cm_read_mod_reg(PLL_MOD, OMAP3430ES2_CM_CLKEN2);
421 cm_context.cm_polctrl = __raw_readl(OMAP3430_CM_POLCTRL); 419 cm_context.cm_polctrl =
420 omap2_cm_read_mod_reg(OCP_MOD, OMAP3430_CM_POLCTRL);
422 cm_context.iva2_cm_fclken = 421 cm_context.iva2_cm_fclken =
423 omap2_cm_read_mod_reg(OMAP3430_IVA2_MOD, CM_FCLKEN); 422 omap2_cm_read_mod_reg(OMAP3430_IVA2_MOD, CM_FCLKEN);
424 cm_context.iva2_cm_clken_pll = 423 cm_context.iva2_cm_clken_pll =
@@ -519,7 +518,8 @@ void omap3_cm_restore_context(void)
519 CM_CLKSEL1); 518 CM_CLKSEL1);
520 omap2_cm_write_mod_reg(cm_context.iva2_cm_clksel2, OMAP3430_IVA2_MOD, 519 omap2_cm_write_mod_reg(cm_context.iva2_cm_clksel2, OMAP3430_IVA2_MOD,
521 CM_CLKSEL2); 520 CM_CLKSEL2);
522 __raw_writel(cm_context.cm_sysconfig, OMAP3430_CM_SYSCONFIG); 521 omap2_cm_write_mod_reg(cm_context.cm_sysconfig, OCP_MOD,
522 OMAP3430_CM_SYSCONFIG);
523 omap2_cm_write_mod_reg(cm_context.sgx_cm_clksel, OMAP3430ES2_SGX_MOD, 523 omap2_cm_write_mod_reg(cm_context.sgx_cm_clksel, OMAP3430ES2_SGX_MOD,
524 CM_CLKSEL); 524 CM_CLKSEL);
525 omap2_cm_write_mod_reg(cm_context.dss_cm_clksel, OMAP3430_DSS_MOD, 525 omap2_cm_write_mod_reg(cm_context.dss_cm_clksel, OMAP3430_DSS_MOD,
@@ -547,7 +547,8 @@ void omap3_cm_restore_context(void)
547 OMAP3430ES2_CM_CLKSEL5); 547 OMAP3430ES2_CM_CLKSEL5);
548 omap2_cm_write_mod_reg(cm_context.pll_cm_clken2, PLL_MOD, 548 omap2_cm_write_mod_reg(cm_context.pll_cm_clken2, PLL_MOD,
549 OMAP3430ES2_CM_CLKEN2); 549 OMAP3430ES2_CM_CLKEN2);
550 __raw_writel(cm_context.cm_polctrl, OMAP3430_CM_POLCTRL); 550 omap2_cm_write_mod_reg(cm_context.cm_polctrl, OCP_MOD,
551 OMAP3430_CM_POLCTRL);
551 omap2_cm_write_mod_reg(cm_context.iva2_cm_fclken, OMAP3430_IVA2_MOD, 552 omap2_cm_write_mod_reg(cm_context.iva2_cm_fclken, OMAP3430_IVA2_MOD,
552 CM_FCLKEN); 553 CM_FCLKEN);
553 omap2_cm_write_mod_reg(cm_context.iva2_cm_clken_pll, OMAP3430_IVA2_MOD, 554 omap2_cm_write_mod_reg(cm_context.iva2_cm_clken_pll, OMAP3430_IVA2_MOD,
@@ -669,19 +670,11 @@ static struct cm_ll_data omap3xxx_cm_ll_data = {
669 670
670int __init omap3xxx_cm_init(void) 671int __init omap3xxx_cm_init(void)
671{ 672{
672 if (!cpu_is_omap34xx())
673 return 0;
674
675 return cm_register(&omap3xxx_cm_ll_data); 673 return cm_register(&omap3xxx_cm_ll_data);
676} 674}
677 675
678static void __exit omap3xxx_cm_exit(void) 676static void __exit omap3xxx_cm_exit(void)
679{ 677{
680 if (!cpu_is_omap34xx()) 678 cm_unregister(&omap3xxx_cm_ll_data);
681 return;
682
683 /* Should never happen */
684 WARN(cm_unregister(&omap3xxx_cm_ll_data),
685 "%s: cm_ll_data function pointer mismatch\n", __func__);
686} 679}
687__exitcall(omap3xxx_cm_exit); 680__exitcall(omap3xxx_cm_exit);
diff --git a/arch/arm/mach-omap2/cm3xxx.h b/arch/arm/mach-omap2/cm3xxx.h
index 8224c91b4d7a..7a16b5598127 100644
--- a/arch/arm/mach-omap2/cm3xxx.h
+++ b/arch/arm/mach-omap2/cm3xxx.h
@@ -29,9 +29,8 @@
29 * These registers appear once per CM module. 29 * These registers appear once per CM module.
30 */ 30 */
31 31
32#define OMAP3430_CM_REVISION OMAP34XX_CM_REGADDR(OCP_MOD, 0x0000) 32#define OMAP3430_CM_SYSCONFIG 0x0010
33#define OMAP3430_CM_SYSCONFIG OMAP34XX_CM_REGADDR(OCP_MOD, 0x0010) 33#define OMAP3430_CM_POLCTRL 0x009c
34#define OMAP3430_CM_POLCTRL OMAP34XX_CM_REGADDR(OCP_MOD, 0x009c)
35 34
36#define OMAP3_CM_CLKOUT_CTRL_OFFSET 0x0070 35#define OMAP3_CM_CLKOUT_CTRL_OFFSET 0x0070
37#define OMAP3430_CM_CLKOUT_CTRL OMAP_CM_REGADDR(OMAP3430_CCR_MOD, 0x0070) 36#define OMAP3430_CM_CLKOUT_CTRL OMAP_CM_REGADDR(OMAP3430_CCR_MOD, 0x0070)
diff --git a/arch/arm/mach-omap2/cm44xx.c b/arch/arm/mach-omap2/cm44xx.c
index 535d66e2822c..fe5cc7bae489 100644
--- a/arch/arm/mach-omap2/cm44xx.c
+++ b/arch/arm/mach-omap2/cm44xx.c
@@ -18,35 +18,32 @@
18#include <linux/err.h> 18#include <linux/err.h>
19#include <linux/io.h> 19#include <linux/io.h>
20 20
21#include "iomap.h"
22#include "common.h"
23#include "cm.h" 21#include "cm.h"
24#include "cm1_44xx.h" 22#include "cm1_44xx.h"
25#include "cm2_44xx.h" 23#include "cm2_44xx.h"
26#include "cm-regbits-44xx.h"
27 24
28/* CM1 hardware module low-level functions */ 25/* CM1 hardware module low-level functions */
29 26
30/* Read a register in CM1 */ 27/* Read a register in CM1 */
31u32 omap4_cm1_read_inst_reg(s16 inst, u16 reg) 28u32 omap4_cm1_read_inst_reg(s16 inst, u16 reg)
32{ 29{
33 return __raw_readl(OMAP44XX_CM1_REGADDR(inst, reg)); 30 return readl_relaxed(cm_base + inst + reg);
34} 31}
35 32
36/* Write into a register in CM1 */ 33/* Write into a register in CM1 */
37void omap4_cm1_write_inst_reg(u32 val, s16 inst, u16 reg) 34void omap4_cm1_write_inst_reg(u32 val, s16 inst, u16 reg)
38{ 35{
39 __raw_writel(val, OMAP44XX_CM1_REGADDR(inst, reg)); 36 writel_relaxed(val, cm_base + inst + reg);
40} 37}
41 38
42/* Read a register in CM2 */ 39/* Read a register in CM2 */
43u32 omap4_cm2_read_inst_reg(s16 inst, u16 reg) 40u32 omap4_cm2_read_inst_reg(s16 inst, u16 reg)
44{ 41{
45 return __raw_readl(OMAP44XX_CM2_REGADDR(inst, reg)); 42 return readl_relaxed(cm2_base + inst + reg);
46} 43}
47 44
48/* Write into a register in CM2 */ 45/* Write into a register in CM2 */
49void omap4_cm2_write_inst_reg(u32 val, s16 inst, u16 reg) 46void omap4_cm2_write_inst_reg(u32 val, s16 inst, u16 reg)
50{ 47{
51 __raw_writel(val, OMAP44XX_CM2_REGADDR(inst, reg)); 48 writel_relaxed(val, cm2_base + inst + reg);
52} 49}
diff --git a/arch/arm/mach-omap2/cm_common.c b/arch/arm/mach-omap2/cm_common.c
index 40b3b5a84458..8f6c4710877e 100644
--- a/arch/arm/mach-omap2/cm_common.c
+++ b/arch/arm/mach-omap2/cm_common.c
@@ -14,11 +14,11 @@
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/errno.h> 16#include <linux/errno.h>
17#include <linux/bug.h>
17 18
18#include "cm2xxx.h" 19#include "cm2xxx.h"
19#include "cm3xxx.h" 20#include "cm3xxx.h"
20#include "cm44xx.h" 21#include "cm44xx.h"
21#include "common.h"
22 22
23/* 23/*
24 * cm_ll_data: function pointers to SoC-specific implementations of 24 * cm_ll_data: function pointers to SoC-specific implementations of
diff --git a/arch/arm/mach-omap2/cminst44xx.c b/arch/arm/mach-omap2/cminst44xx.c
index f5c4731b6f06..12aca56942c0 100644
--- a/arch/arm/mach-omap2/cminst44xx.c
+++ b/arch/arm/mach-omap2/cminst44xx.c
@@ -21,8 +21,6 @@
21#include <linux/err.h> 21#include <linux/err.h>
22#include <linux/io.h> 22#include <linux/io.h>
23 23
24#include "iomap.h"
25#include "common.h"
26#include "clockdomain.h" 24#include "clockdomain.h"
27#include "cm.h" 25#include "cm.h"
28#include "cm1_44xx.h" 26#include "cm1_44xx.h"
@@ -30,12 +28,18 @@
30#include "cm44xx.h" 28#include "cm44xx.h"
31#include "cminst44xx.h" 29#include "cminst44xx.h"
32#include "cm-regbits-34xx.h" 30#include "cm-regbits-34xx.h"
33#include "cm-regbits-44xx.h"
34#include "prcm44xx.h" 31#include "prcm44xx.h"
35#include "prm44xx.h" 32#include "prm44xx.h"
36#include "prcm_mpu44xx.h" 33#include "prcm_mpu44xx.h"
37#include "prcm-common.h" 34#include "prcm-common.h"
38 35
36#define OMAP4430_IDLEST_SHIFT 16
37#define OMAP4430_IDLEST_MASK (0x3 << 16)
38#define OMAP4430_CLKTRCTRL_SHIFT 0
39#define OMAP4430_CLKTRCTRL_MASK (0x3 << 0)
40#define OMAP4430_MODULEMODE_SHIFT 0
41#define OMAP4430_MODULEMODE_MASK (0x3 << 0)
42
39/* 43/*
40 * CLKCTRL_IDLEST_*: possible values for the CM_*_CLKCTRL.IDLEST bitfield: 44 * CLKCTRL_IDLEST_*: possible values for the CM_*_CLKCTRL.IDLEST bitfield:
41 * 45 *
@@ -116,7 +120,7 @@ u32 omap4_cminst_read_inst_reg(u8 part, u16 inst, u16 idx)
116 BUG_ON(part >= OMAP4_MAX_PRCM_PARTITIONS || 120 BUG_ON(part >= OMAP4_MAX_PRCM_PARTITIONS ||
117 part == OMAP4430_INVALID_PRCM_PARTITION || 121 part == OMAP4430_INVALID_PRCM_PARTITION ||
118 !_cm_bases[part]); 122 !_cm_bases[part]);
119 return __raw_readl(_cm_bases[part] + inst + idx); 123 return readl_relaxed(_cm_bases[part] + inst + idx);
120} 124}
121 125
122/* Write into a register in a CM instance */ 126/* Write into a register in a CM instance */
@@ -125,7 +129,7 @@ void omap4_cminst_write_inst_reg(u32 val, u8 part, u16 inst, u16 idx)
125 BUG_ON(part >= OMAP4_MAX_PRCM_PARTITIONS || 129 BUG_ON(part >= OMAP4_MAX_PRCM_PARTITIONS ||
126 part == OMAP4430_INVALID_PRCM_PARTITION || 130 part == OMAP4430_INVALID_PRCM_PARTITION ||
127 !_cm_bases[part]); 131 !_cm_bases[part]);
128 __raw_writel(val, _cm_bases[part] + inst + idx); 132 writel_relaxed(val, _cm_bases[part] + inst + idx);
129} 133}
130 134
131/* Read-modify-write a register in CM1. Caller must lock */ 135/* Read-modify-write a register in CM1. Caller must lock */
diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c
index 44bb4d544dcf..751f3549bf6f 100644
--- a/arch/arm/mach-omap2/control.c
+++ b/arch/arm/mach-omap2/control.c
@@ -151,32 +151,32 @@ void __iomem *omap_ctrl_base_get(void)
151 151
152u8 omap_ctrl_readb(u16 offset) 152u8 omap_ctrl_readb(u16 offset)
153{ 153{
154 return __raw_readb(OMAP_CTRL_REGADDR(offset)); 154 return readb_relaxed(OMAP_CTRL_REGADDR(offset));
155} 155}
156 156
157u16 omap_ctrl_readw(u16 offset) 157u16 omap_ctrl_readw(u16 offset)
158{ 158{
159 return __raw_readw(OMAP_CTRL_REGADDR(offset)); 159 return readw_relaxed(OMAP_CTRL_REGADDR(offset));
160} 160}
161 161
162u32 omap_ctrl_readl(u16 offset) 162u32 omap_ctrl_readl(u16 offset)
163{ 163{
164 return __raw_readl(OMAP_CTRL_REGADDR(offset)); 164 return readl_relaxed(OMAP_CTRL_REGADDR(offset));
165} 165}
166 166
167void omap_ctrl_writeb(u8 val, u16 offset) 167void omap_ctrl_writeb(u8 val, u16 offset)
168{ 168{
169 __raw_writeb(val, OMAP_CTRL_REGADDR(offset)); 169 writeb_relaxed(val, OMAP_CTRL_REGADDR(offset));
170} 170}
171 171
172void omap_ctrl_writew(u16 val, u16 offset) 172void omap_ctrl_writew(u16 val, u16 offset)
173{ 173{
174 __raw_writew(val, OMAP_CTRL_REGADDR(offset)); 174 writew_relaxed(val, OMAP_CTRL_REGADDR(offset));
175} 175}
176 176
177void omap_ctrl_writel(u32 val, u16 offset) 177void omap_ctrl_writel(u32 val, u16 offset)
178{ 178{
179 __raw_writel(val, OMAP_CTRL_REGADDR(offset)); 179 writel_relaxed(val, OMAP_CTRL_REGADDR(offset));
180} 180}
181 181
182/* 182/*
@@ -188,12 +188,12 @@ void omap_ctrl_writel(u32 val, u16 offset)
188 188
189u32 omap4_ctrl_pad_readl(u16 offset) 189u32 omap4_ctrl_pad_readl(u16 offset)
190{ 190{
191 return __raw_readl(OMAP4_CTRL_PAD_REGADDR(offset)); 191 return readl_relaxed(OMAP4_CTRL_PAD_REGADDR(offset));
192} 192}
193 193
194void omap4_ctrl_pad_writel(u32 val, u16 offset) 194void omap4_ctrl_pad_writel(u32 val, u16 offset)
195{ 195{
196 __raw_writel(val, OMAP4_CTRL_PAD_REGADDR(offset)); 196 writel_relaxed(val, OMAP4_CTRL_PAD_REGADDR(offset));
197} 197}
198 198
199#ifdef CONFIG_ARCH_OMAP3 199#ifdef CONFIG_ARCH_OMAP3
@@ -222,7 +222,7 @@ void omap3_ctrl_write_boot_mode(u8 bootmode)
222 * 222 *
223 * XXX This should use some omap_ctrl_writel()-type function 223 * XXX This should use some omap_ctrl_writel()-type function
224 */ 224 */
225 __raw_writel(l, OMAP2_L4_IO_ADDRESS(OMAP343X_SCRATCHPAD + 4)); 225 writel_relaxed(l, OMAP2_L4_IO_ADDRESS(OMAP343X_SCRATCHPAD + 4));
226} 226}
227 227
228#endif 228#endif
@@ -285,7 +285,7 @@ void omap3_clear_scratchpad_contents(void)
285 if (omap2_prm_read_mod_reg(OMAP3430_GR_MOD, OMAP3_PRM_RSTST_OFFSET) & 285 if (omap2_prm_read_mod_reg(OMAP3430_GR_MOD, OMAP3_PRM_RSTST_OFFSET) &
286 OMAP3430_GLOBAL_COLD_RST_MASK) { 286 OMAP3430_GLOBAL_COLD_RST_MASK) {
287 for ( ; offset <= max_offset; offset += 0x4) 287 for ( ; offset <= max_offset; offset += 0x4)
288 __raw_writel(0x0, (v_addr + offset)); 288 writel_relaxed(0x0, (v_addr + offset));
289 omap2_prm_set_mod_reg_bits(OMAP3430_GLOBAL_COLD_RST_MASK, 289 omap2_prm_set_mod_reg_bits(OMAP3430_GLOBAL_COLD_RST_MASK,
290 OMAP3430_GR_MOD, 290 OMAP3430_GR_MOD,
291 OMAP3_PRM_RSTST_OFFSET); 291 OMAP3_PRM_RSTST_OFFSET);
diff --git a/arch/arm/mach-omap2/dma.c b/arch/arm/mach-omap2/dma.c
index 5689c88d986d..a6d2cf1f8d02 100644
--- a/arch/arm/mach-omap2/dma.c
+++ b/arch/arm/mach-omap2/dma.c
@@ -91,7 +91,7 @@ static inline void dma_write(u32 val, int reg, int lch)
91 addr += reg_map[reg].offset; 91 addr += reg_map[reg].offset;
92 addr += reg_map[reg].stride * lch; 92 addr += reg_map[reg].stride * lch;
93 93
94 __raw_writel(val, addr); 94 writel_relaxed(val, addr);
95} 95}
96 96
97static inline u32 dma_read(int reg, int lch) 97static inline u32 dma_read(int reg, int lch)
@@ -101,7 +101,7 @@ static inline u32 dma_read(int reg, int lch)
101 addr += reg_map[reg].offset; 101 addr += reg_map[reg].offset;
102 addr += reg_map[reg].stride * lch; 102 addr += reg_map[reg].stride * lch;
103 103
104 return __raw_readl(addr); 104 return readl_relaxed(addr);
105} 105}
106 106
107static void omap2_clear_dma(int lch) 107static void omap2_clear_dma(int lch)
diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
index 9fe8c949305c..852b19a367f0 100644
--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
@@ -170,12 +170,12 @@ static irqreturn_t gpmc_handle_irq(int irq, void *dev);
170 170
171static void gpmc_write_reg(int idx, u32 val) 171static void gpmc_write_reg(int idx, u32 val)
172{ 172{
173 __raw_writel(val, gpmc_base + idx); 173 writel_relaxed(val, gpmc_base + idx);
174} 174}
175 175
176static u32 gpmc_read_reg(int idx) 176static u32 gpmc_read_reg(int idx)
177{ 177{
178 return __raw_readl(gpmc_base + idx); 178 return readl_relaxed(gpmc_base + idx);
179} 179}
180 180
181void gpmc_cs_write_reg(int cs, int idx, u32 val) 181void gpmc_cs_write_reg(int cs, int idx, u32 val)
@@ -183,7 +183,7 @@ void gpmc_cs_write_reg(int cs, int idx, u32 val)
183 void __iomem *reg_addr; 183 void __iomem *reg_addr;
184 184
185 reg_addr = gpmc_base + GPMC_CS0_OFFSET + (cs * GPMC_CS_SIZE) + idx; 185 reg_addr = gpmc_base + GPMC_CS0_OFFSET + (cs * GPMC_CS_SIZE) + idx;
186 __raw_writel(val, reg_addr); 186 writel_relaxed(val, reg_addr);
187} 187}
188 188
189static u32 gpmc_cs_read_reg(int cs, int idx) 189static u32 gpmc_cs_read_reg(int cs, int idx)
@@ -191,7 +191,7 @@ static u32 gpmc_cs_read_reg(int cs, int idx)
191 void __iomem *reg_addr; 191 void __iomem *reg_addr;
192 192
193 reg_addr = gpmc_base + GPMC_CS0_OFFSET + (cs * GPMC_CS_SIZE) + idx; 193 reg_addr = gpmc_base + GPMC_CS0_OFFSET + (cs * GPMC_CS_SIZE) + idx;
194 return __raw_readl(reg_addr); 194 return readl_relaxed(reg_addr);
195} 195}
196 196
197/* TODO: Add support for gpmc_fck to clock framework and use it */ 197/* TODO: Add support for gpmc_fck to clock framework and use it */
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index 157412e4273a..f61f1bf68df4 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -94,7 +94,7 @@ EXPORT_SYMBOL(omap_type);
94#define OMAP_TAP_DIE_ID_44XX_2 0x020c 94#define OMAP_TAP_DIE_ID_44XX_2 0x020c
95#define OMAP_TAP_DIE_ID_44XX_3 0x0210 95#define OMAP_TAP_DIE_ID_44XX_3 0x0210
96 96
97#define read_tap_reg(reg) __raw_readl(tap_base + (reg)) 97#define read_tap_reg(reg) readl_relaxed(tap_base + (reg))
98 98
99struct omap_id { 99struct omap_id {
100 u16 hawkeye; /* Silicon type (Hawkeye id) */ 100 u16 hawkeye; /* Silicon type (Hawkeye id) */
diff --git a/arch/arm/mach-omap2/irq.c b/arch/arm/mach-omap2/irq.c
index 6037a9a01ed5..35b8590c322e 100644
--- a/arch/arm/mach-omap2/irq.c
+++ b/arch/arm/mach-omap2/irq.c
@@ -83,12 +83,12 @@ struct omap3_intc_regs {
83 83
84static void intc_bank_write_reg(u32 val, struct omap_irq_bank *bank, u16 reg) 84static void intc_bank_write_reg(u32 val, struct omap_irq_bank *bank, u16 reg)
85{ 85{
86 __raw_writel(val, bank->base_reg + reg); 86 writel_relaxed(val, bank->base_reg + reg);
87} 87}
88 88
89static u32 intc_bank_read_reg(struct omap_irq_bank *bank, u16 reg) 89static u32 intc_bank_read_reg(struct omap_irq_bank *bank, u16 reg)
90{ 90{
91 return __raw_readl(bank->base_reg + reg); 91 return readl_relaxed(bank->base_reg + reg);
92} 92}
93 93
94/* XXX: FIQ and additional INTC support (only MPU at the moment) */ 94/* XXX: FIQ and additional INTC support (only MPU at the moment) */
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c
index 48094b58c88f..fd88edeb027f 100644
--- a/arch/arm/mach-omap2/mux.c
+++ b/arch/arm/mach-omap2/mux.c
@@ -70,18 +70,18 @@ struct omap_mux_partition *omap_mux_get(const char *name)
70u16 omap_mux_read(struct omap_mux_partition *partition, u16 reg) 70u16 omap_mux_read(struct omap_mux_partition *partition, u16 reg)
71{ 71{
72 if (partition->flags & OMAP_MUX_REG_8BIT) 72 if (partition->flags & OMAP_MUX_REG_8BIT)
73 return __raw_readb(partition->base + reg); 73 return readb_relaxed(partition->base + reg);
74 else 74 else
75 return __raw_readw(partition->base + reg); 75 return readw_relaxed(partition->base + reg);
76} 76}
77 77
78void omap_mux_write(struct omap_mux_partition *partition, u16 val, 78void omap_mux_write(struct omap_mux_partition *partition, u16 val,
79 u16 reg) 79 u16 reg)
80{ 80{
81 if (partition->flags & OMAP_MUX_REG_8BIT) 81 if (partition->flags & OMAP_MUX_REG_8BIT)
82 __raw_writeb(val, partition->base + reg); 82 writeb_relaxed(val, partition->base + reg);
83 else 83 else
84 __raw_writew(val, partition->base + reg); 84 writew_relaxed(val, partition->base + reg);
85} 85}
86 86
87void omap_mux_write_array(struct omap_mux_partition *partition, 87void omap_mux_write_array(struct omap_mux_partition *partition,
diff --git a/arch/arm/mach-omap2/omap-hotplug.c b/arch/arm/mach-omap2/omap-hotplug.c
index 458f72f9dc8f..971791fe9a3f 100644
--- a/arch/arm/mach-omap2/omap-hotplug.c
+++ b/arch/arm/mach-omap2/omap-hotplug.c
@@ -39,7 +39,7 @@ void __ref omap4_cpu_die(unsigned int cpu)
39 if (omap_modify_auxcoreboot0(0x0, 0x200) != 0x0) 39 if (omap_modify_auxcoreboot0(0x0, 0x200) != 0x0)
40 pr_err("Secure clear status failed\n"); 40 pr_err("Secure clear status failed\n");
41 } else { 41 } else {
42 __raw_writel(0, base + OMAP_AUX_CORE_BOOT_0); 42 writel_relaxed(0, base + OMAP_AUX_CORE_BOOT_0);
43 } 43 }
44 44
45 45
@@ -53,7 +53,7 @@ void __ref omap4_cpu_die(unsigned int cpu)
53 boot_cpu = omap_read_auxcoreboot0(); 53 boot_cpu = omap_read_auxcoreboot0();
54 else 54 else
55 boot_cpu = 55 boot_cpu =
56 __raw_readl(base + OMAP_AUX_CORE_BOOT_0) >> 5; 56 readl_relaxed(base + OMAP_AUX_CORE_BOOT_0) >> 5;
57 57
58 if (boot_cpu == smp_processor_id()) { 58 if (boot_cpu == smp_processor_id()) {
59 /* 59 /*
diff --git a/arch/arm/mach-omap2/omap-mpuss-lowpower.c b/arch/arm/mach-omap2/omap-mpuss-lowpower.c
index 667915d236f3..eb76e47091ad 100644
--- a/arch/arm/mach-omap2/omap-mpuss-lowpower.c
+++ b/arch/arm/mach-omap2/omap-mpuss-lowpower.c
@@ -116,7 +116,7 @@ static inline void set_cpu_wakeup_addr(unsigned int cpu_id, u32 addr)
116{ 116{
117 struct omap4_cpu_pm_info *pm_info = &per_cpu(omap4_pm_info, cpu_id); 117 struct omap4_cpu_pm_info *pm_info = &per_cpu(omap4_pm_info, cpu_id);
118 118
119 __raw_writel(addr, pm_info->wkup_sar_addr); 119 writel_relaxed(addr, pm_info->wkup_sar_addr);
120} 120}
121 121
122/* 122/*
@@ -141,7 +141,7 @@ static void scu_pwrst_prepare(unsigned int cpu_id, unsigned int cpu_state)
141 break; 141 break;
142 } 142 }
143 143
144 __raw_writel(scu_pwr_st, pm_info->scu_sar_addr); 144 writel_relaxed(scu_pwr_st, pm_info->scu_sar_addr);
145} 145}
146 146
147/* Helper functions for MPUSS OSWR */ 147/* Helper functions for MPUSS OSWR */
@@ -179,7 +179,7 @@ static void l2x0_pwrst_prepare(unsigned int cpu_id, unsigned int save_state)
179{ 179{
180 struct omap4_cpu_pm_info *pm_info = &per_cpu(omap4_pm_info, cpu_id); 180 struct omap4_cpu_pm_info *pm_info = &per_cpu(omap4_pm_info, cpu_id);
181 181
182 __raw_writel(save_state, pm_info->l2x0_sar_addr); 182 writel_relaxed(save_state, pm_info->l2x0_sar_addr);
183} 183}
184 184
185/* 185/*
@@ -192,10 +192,10 @@ static void save_l2x0_context(void)
192 u32 val; 192 u32 val;
193 void __iomem *l2x0_base = omap4_get_l2cache_base(); 193 void __iomem *l2x0_base = omap4_get_l2cache_base();
194 if (l2x0_base) { 194 if (l2x0_base) {
195 val = __raw_readl(l2x0_base + L2X0_AUX_CTRL); 195 val = readl_relaxed(l2x0_base + L2X0_AUX_CTRL);
196 __raw_writel(val, sar_base + L2X0_AUXCTRL_OFFSET); 196 writel_relaxed(val, sar_base + L2X0_AUXCTRL_OFFSET);
197 val = __raw_readl(l2x0_base + L2X0_PREFETCH_CTRL); 197 val = readl_relaxed(l2x0_base + L2X0_PREFETCH_CTRL);
198 __raw_writel(val, sar_base + L2X0_PREFETCH_CTRL_OFFSET); 198 writel_relaxed(val, sar_base + L2X0_PREFETCH_CTRL_OFFSET);
199 } 199 }
200} 200}
201#else 201#else
@@ -386,9 +386,9 @@ int __init omap4_mpuss_init(void)
386 386
387 /* Save device type on scratchpad for low level code to use */ 387 /* Save device type on scratchpad for low level code to use */
388 if (omap_type() != OMAP2_DEVICE_TYPE_GP) 388 if (omap_type() != OMAP2_DEVICE_TYPE_GP)
389 __raw_writel(1, sar_base + OMAP_TYPE_OFFSET); 389 writel_relaxed(1, sar_base + OMAP_TYPE_OFFSET);
390 else 390 else
391 __raw_writel(0, sar_base + OMAP_TYPE_OFFSET); 391 writel_relaxed(0, sar_base + OMAP_TYPE_OFFSET);
392 392
393 save_l2x0_context(); 393 save_l2x0_context();
394 394
diff --git a/arch/arm/mach-omap2/omap-smp.c b/arch/arm/mach-omap2/omap-smp.c
index 17550aa39d0f..256e84ef0f67 100644
--- a/arch/arm/mach-omap2/omap-smp.c
+++ b/arch/arm/mach-omap2/omap-smp.c
@@ -99,7 +99,7 @@ static int omap4_boot_secondary(unsigned int cpu, struct task_struct *idle)
99 if (omap_secure_apis_support()) 99 if (omap_secure_apis_support())
100 omap_modify_auxcoreboot0(0x200, 0xfffffdff); 100 omap_modify_auxcoreboot0(0x200, 0xfffffdff);
101 else 101 else
102 __raw_writel(0x20, base + OMAP_AUX_CORE_BOOT_0); 102 writel_relaxed(0x20, base + OMAP_AUX_CORE_BOOT_0);
103 103
104 if (!cpu1_clkdm && !cpu1_pwrdm) { 104 if (!cpu1_clkdm && !cpu1_pwrdm) {
105 cpu1_clkdm = clkdm_lookup("mpu1_clkdm"); 105 cpu1_clkdm = clkdm_lookup("mpu1_clkdm");
@@ -227,8 +227,8 @@ static void __init omap4_smp_prepare_cpus(unsigned int max_cpus)
227 if (omap_secure_apis_support()) 227 if (omap_secure_apis_support())
228 omap_auxcoreboot_addr(virt_to_phys(startup_addr)); 228 omap_auxcoreboot_addr(virt_to_phys(startup_addr));
229 else 229 else
230 __raw_writel(virt_to_phys(omap5_secondary_startup), 230 writel_relaxed(virt_to_phys(omap5_secondary_startup),
231 base + OMAP_AUX_CORE_BOOT_1); 231 base + OMAP_AUX_CORE_BOOT_1);
232 232
233} 233}
234 234
diff --git a/arch/arm/mach-omap2/omap-wakeupgen.c b/arch/arm/mach-omap2/omap-wakeupgen.c
index 693fe486e917..37843a7d3639 100644
--- a/arch/arm/mach-omap2/omap-wakeupgen.c
+++ b/arch/arm/mach-omap2/omap-wakeupgen.c
@@ -60,19 +60,19 @@ static unsigned int omap_secure_apis;
60 */ 60 */
61static inline u32 wakeupgen_readl(u8 idx, u32 cpu) 61static inline u32 wakeupgen_readl(u8 idx, u32 cpu)
62{ 62{
63 return __raw_readl(wakeupgen_base + OMAP_WKG_ENB_A_0 + 63 return readl_relaxed(wakeupgen_base + OMAP_WKG_ENB_A_0 +
64 (cpu * CPU_ENA_OFFSET) + (idx * 4)); 64 (cpu * CPU_ENA_OFFSET) + (idx * 4));
65} 65}
66 66
67static inline void wakeupgen_writel(u32 val, u8 idx, u32 cpu) 67static inline void wakeupgen_writel(u32 val, u8 idx, u32 cpu)
68{ 68{
69 __raw_writel(val, wakeupgen_base + OMAP_WKG_ENB_A_0 + 69 writel_relaxed(val, wakeupgen_base + OMAP_WKG_ENB_A_0 +
70 (cpu * CPU_ENA_OFFSET) + (idx * 4)); 70 (cpu * CPU_ENA_OFFSET) + (idx * 4));
71} 71}
72 72
73static inline void sar_writel(u32 val, u32 offset, u8 idx) 73static inline void sar_writel(u32 val, u32 offset, u8 idx)
74{ 74{
75 __raw_writel(val, sar_base + offset + (idx * 4)); 75 writel_relaxed(val, sar_base + offset + (idx * 4));
76} 76}
77 77
78static inline int _wakeupgen_get_irq_info(u32 irq, u32 *bit_posn, u8 *reg_index) 78static inline int _wakeupgen_get_irq_info(u32 irq, u32 *bit_posn, u8 *reg_index)
@@ -231,21 +231,21 @@ static inline void omap4_irq_save_context(void)
231 } 231 }
232 232
233 /* Save AuxBoot* registers */ 233 /* Save AuxBoot* registers */
234 val = __raw_readl(wakeupgen_base + OMAP_AUX_CORE_BOOT_0); 234 val = readl_relaxed(wakeupgen_base + OMAP_AUX_CORE_BOOT_0);
235 __raw_writel(val, sar_base + AUXCOREBOOT0_OFFSET); 235 writel_relaxed(val, sar_base + AUXCOREBOOT0_OFFSET);
236 val = __raw_readl(wakeupgen_base + OMAP_AUX_CORE_BOOT_1); 236 val = readl_relaxed(wakeupgen_base + OMAP_AUX_CORE_BOOT_1);
237 __raw_writel(val, sar_base + AUXCOREBOOT1_OFFSET); 237 writel_relaxed(val, sar_base + AUXCOREBOOT1_OFFSET);
238 238
239 /* Save SyncReq generation logic */ 239 /* Save SyncReq generation logic */
240 val = __raw_readl(wakeupgen_base + OMAP_PTMSYNCREQ_MASK); 240 val = readl_relaxed(wakeupgen_base + OMAP_PTMSYNCREQ_MASK);
241 __raw_writel(val, sar_base + PTMSYNCREQ_MASK_OFFSET); 241 writel_relaxed(val, sar_base + PTMSYNCREQ_MASK_OFFSET);
242 val = __raw_readl(wakeupgen_base + OMAP_PTMSYNCREQ_EN); 242 val = readl_relaxed(wakeupgen_base + OMAP_PTMSYNCREQ_EN);
243 __raw_writel(val, sar_base + PTMSYNCREQ_EN_OFFSET); 243 writel_relaxed(val, sar_base + PTMSYNCREQ_EN_OFFSET);
244 244
245 /* Set the Backup Bit Mask status */ 245 /* Set the Backup Bit Mask status */
246 val = __raw_readl(sar_base + SAR_BACKUP_STATUS_OFFSET); 246 val = readl_relaxed(sar_base + SAR_BACKUP_STATUS_OFFSET);
247 val |= SAR_BACKUP_STATUS_WAKEUPGEN; 247 val |= SAR_BACKUP_STATUS_WAKEUPGEN;
248 __raw_writel(val, sar_base + SAR_BACKUP_STATUS_OFFSET); 248 writel_relaxed(val, sar_base + SAR_BACKUP_STATUS_OFFSET);
249 249
250} 250}
251 251
@@ -264,15 +264,15 @@ static inline void omap5_irq_save_context(void)
264 } 264 }
265 265
266 /* Save AuxBoot* registers */ 266 /* Save AuxBoot* registers */
267 val = __raw_readl(wakeupgen_base + OMAP_AUX_CORE_BOOT_0); 267 val = readl_relaxed(wakeupgen_base + OMAP_AUX_CORE_BOOT_0);
268 __raw_writel(val, sar_base + OMAP5_AUXCOREBOOT0_OFFSET); 268 writel_relaxed(val, sar_base + OMAP5_AUXCOREBOOT0_OFFSET);
269 val = __raw_readl(wakeupgen_base + OMAP_AUX_CORE_BOOT_0); 269 val = readl_relaxed(wakeupgen_base + OMAP_AUX_CORE_BOOT_0);
270 __raw_writel(val, sar_base + OMAP5_AUXCOREBOOT1_OFFSET); 270 writel_relaxed(val, sar_base + OMAP5_AUXCOREBOOT1_OFFSET);
271 271
272 /* Set the Backup Bit Mask status */ 272 /* Set the Backup Bit Mask status */
273 val = __raw_readl(sar_base + OMAP5_SAR_BACKUP_STATUS_OFFSET); 273 val = readl_relaxed(sar_base + OMAP5_SAR_BACKUP_STATUS_OFFSET);
274 val |= SAR_BACKUP_STATUS_WAKEUPGEN; 274 val |= SAR_BACKUP_STATUS_WAKEUPGEN;
275 __raw_writel(val, sar_base + OMAP5_SAR_BACKUP_STATUS_OFFSET); 275 writel_relaxed(val, sar_base + OMAP5_SAR_BACKUP_STATUS_OFFSET);
276 276
277} 277}
278 278
@@ -306,9 +306,9 @@ static void irq_sar_clear(void)
306 if (soc_is_omap54xx()) 306 if (soc_is_omap54xx())
307 offset = OMAP5_SAR_BACKUP_STATUS_OFFSET; 307 offset = OMAP5_SAR_BACKUP_STATUS_OFFSET;
308 308
309 val = __raw_readl(sar_base + offset); 309 val = readl_relaxed(sar_base + offset);
310 val &= ~SAR_BACKUP_STATUS_WAKEUPGEN; 310 val &= ~SAR_BACKUP_STATUS_WAKEUPGEN;
311 __raw_writel(val, sar_base + offset); 311 writel_relaxed(val, sar_base + offset);
312} 312}
313 313
314/* 314/*
diff --git a/arch/arm/mach-omap2/omap4-common.c b/arch/arm/mach-omap2/omap4-common.c
index 95e171a055f3..99b0154493a4 100644
--- a/arch/arm/mach-omap2/omap4-common.c
+++ b/arch/arm/mach-omap2/omap4-common.c
@@ -125,25 +125,25 @@ void __init gic_init_irq(void)
125void gic_dist_disable(void) 125void gic_dist_disable(void)
126{ 126{
127 if (gic_dist_base_addr) 127 if (gic_dist_base_addr)
128 __raw_writel(0x0, gic_dist_base_addr + GIC_DIST_CTRL); 128 writel_relaxed(0x0, gic_dist_base_addr + GIC_DIST_CTRL);
129} 129}
130 130
131void gic_dist_enable(void) 131void gic_dist_enable(void)
132{ 132{
133 if (gic_dist_base_addr) 133 if (gic_dist_base_addr)
134 __raw_writel(0x1, gic_dist_base_addr + GIC_DIST_CTRL); 134 writel_relaxed(0x1, gic_dist_base_addr + GIC_DIST_CTRL);
135} 135}
136 136
137bool gic_dist_disabled(void) 137bool gic_dist_disabled(void)
138{ 138{
139 return !(__raw_readl(gic_dist_base_addr + GIC_DIST_CTRL) & 0x1); 139 return !(readl_relaxed(gic_dist_base_addr + GIC_DIST_CTRL) & 0x1);
140} 140}
141 141
142void gic_timer_retrigger(void) 142void gic_timer_retrigger(void)
143{ 143{
144 u32 twd_int = __raw_readl(twd_base + TWD_TIMER_INTSTAT); 144 u32 twd_int = readl_relaxed(twd_base + TWD_TIMER_INTSTAT);
145 u32 gic_int = __raw_readl(gic_dist_base_addr + GIC_DIST_PENDING_SET); 145 u32 gic_int = readl_relaxed(gic_dist_base_addr + GIC_DIST_PENDING_SET);
146 u32 twd_ctrl = __raw_readl(twd_base + TWD_TIMER_CONTROL); 146 u32 twd_ctrl = readl_relaxed(twd_base + TWD_TIMER_CONTROL);
147 147
148 if (twd_int && !(gic_int & BIT(IRQ_LOCALTIMER))) { 148 if (twd_int && !(gic_int & BIT(IRQ_LOCALTIMER))) {
149 /* 149 /*
@@ -151,11 +151,11 @@ void gic_timer_retrigger(void)
151 * disabled. Ack the pending interrupt, and retrigger it. 151 * disabled. Ack the pending interrupt, and retrigger it.
152 */ 152 */
153 pr_warn("%s: lost localtimer interrupt\n", __func__); 153 pr_warn("%s: lost localtimer interrupt\n", __func__);
154 __raw_writel(1, twd_base + TWD_TIMER_INTSTAT); 154 writel_relaxed(1, twd_base + TWD_TIMER_INTSTAT);
155 if (!(twd_ctrl & TWD_TIMER_CONTROL_PERIODIC)) { 155 if (!(twd_ctrl & TWD_TIMER_CONTROL_PERIODIC)) {
156 __raw_writel(1, twd_base + TWD_TIMER_COUNTER); 156 writel_relaxed(1, twd_base + TWD_TIMER_COUNTER);
157 twd_ctrl |= TWD_TIMER_CONTROL_ENABLE; 157 twd_ctrl |= TWD_TIMER_CONTROL_ENABLE;
158 __raw_writel(twd_ctrl, twd_base + TWD_TIMER_CONTROL); 158 writel_relaxed(twd_ctrl, twd_base + TWD_TIMER_CONTROL);
159 } 159 }
160 } 160 }
161} 161}
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 66c60fe1104c..f7bb435bb543 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -72,7 +72,7 @@
72 * | (../mach-omap2/omap_hwmod*) | 72 * | (../mach-omap2/omap_hwmod*) |
73 * +-------------------------------+ 73 * +-------------------------------+
74 * | OMAP clock/PRCM/register fns | 74 * | OMAP clock/PRCM/register fns |
75 * | (__raw_{read,write}l, clk*) | 75 * | ({read,write}l_relaxed, clk*) |
76 * +-------------------------------+ 76 * +-------------------------------+
77 * 77 *
78 * Device drivers should not contain any OMAP-specific code or data in 78 * Device drivers should not contain any OMAP-specific code or data in
@@ -3230,17 +3230,17 @@ static int _am33xx_is_hardreset_asserted(struct omap_hwmod *oh,
3230u32 omap_hwmod_read(struct omap_hwmod *oh, u16 reg_offs) 3230u32 omap_hwmod_read(struct omap_hwmod *oh, u16 reg_offs)
3231{ 3231{
3232 if (oh->flags & HWMOD_16BIT_REG) 3232 if (oh->flags & HWMOD_16BIT_REG)
3233 return __raw_readw(oh->_mpu_rt_va + reg_offs); 3233 return readw_relaxed(oh->_mpu_rt_va + reg_offs);
3234 else 3234 else
3235 return __raw_readl(oh->_mpu_rt_va + reg_offs); 3235 return readl_relaxed(oh->_mpu_rt_va + reg_offs);
3236} 3236}
3237 3237
3238void omap_hwmod_write(u32 v, struct omap_hwmod *oh, u16 reg_offs) 3238void omap_hwmod_write(u32 v, struct omap_hwmod *oh, u16 reg_offs)
3239{ 3239{
3240 if (oh->flags & HWMOD_16BIT_REG) 3240 if (oh->flags & HWMOD_16BIT_REG)
3241 __raw_writew(v, oh->_mpu_rt_va + reg_offs); 3241 writew_relaxed(v, oh->_mpu_rt_va + reg_offs);
3242 else 3242 else
3243 __raw_writel(v, oh->_mpu_rt_va + reg_offs); 3243 writel_relaxed(v, oh->_mpu_rt_va + reg_offs);
3244} 3244}
3245 3245
3246/** 3246/**
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 0f178623e7da..a579b89ce9b7 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
@@ -24,6 +24,7 @@
24#include "prm33xx.h" 24#include "prm33xx.h"
25#include "omap_hwmod_33xx_43xx_common_data.h" 25#include "omap_hwmod_33xx_43xx_common_data.h"
26#include "prcm43xx.h" 26#include "prcm43xx.h"
27#include "common.h"
27 28
28#define CLKCTRL(oh, clkctrl) ((oh).prcm.omap4.clkctrl_offs = (clkctrl)) 29#define CLKCTRL(oh, clkctrl) ((oh).prcm.omap4.clkctrl_offs = (clkctrl))
29#define RSTCTRL(oh, rstctrl) ((oh).prcm.omap4.rstctrl_offs = (rstctrl)) 30#define RSTCTRL(oh, rstctrl) ((oh).prcm.omap4.rstctrl_offs = (rstctrl))
diff --git a/arch/arm/mach-omap2/omap_phy_internal.c b/arch/arm/mach-omap2/omap_phy_internal.c
index eb8a25de67ed..50640b38f0bf 100644
--- a/arch/arm/mach-omap2/omap_phy_internal.c
+++ b/arch/arm/mach-omap2/omap_phy_internal.c
@@ -57,7 +57,7 @@ static int __init omap4430_phy_power_down(void)
57 } 57 }
58 58
59 /* Power down the phy */ 59 /* Power down the phy */
60 __raw_writel(PHY_PD, ctrl_base + CONTROL_DEV_CONF); 60 writel_relaxed(PHY_PD, ctrl_base + CONTROL_DEV_CONF);
61 61
62 iounmap(ctrl_base); 62 iounmap(ctrl_base);
63 63
@@ -162,7 +162,7 @@ void ti81xx_musb_phy_power(u8 on)
162 return; 162 return;
163 } 163 }
164 164
165 usbphycfg = __raw_readl(scm_base + USBCTRL0); 165 usbphycfg = readl_relaxed(scm_base + USBCTRL0);
166 166
167 if (on) { 167 if (on) {
168 if (cpu_is_ti816x()) { 168 if (cpu_is_ti816x()) {
@@ -181,7 +181,7 @@ void ti81xx_musb_phy_power(u8 on)
181 usbphycfg |= USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN; 181 usbphycfg |= USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN;
182 182
183 } 183 }
184 __raw_writel(usbphycfg, scm_base + USBCTRL0); 184 writel_relaxed(usbphycfg, scm_base + USBCTRL0);
185 185
186 iounmap(scm_base); 186 iounmap(scm_base);
187} 187}
diff --git a/arch/arm/mach-omap2/powerdomain-common.c b/arch/arm/mach-omap2/powerdomain-common.c
index c0aeabfcf009..c40e5f009826 100644
--- a/arch/arm/mach-omap2/powerdomain-common.c
+++ b/arch/arm/mach-omap2/powerdomain-common.c
@@ -17,7 +17,6 @@
17#include "pm.h" 17#include "pm.h"
18#include "cm.h" 18#include "cm.h"
19#include "cm-regbits-34xx.h" 19#include "cm-regbits-34xx.h"
20#include "cm-regbits-44xx.h"
21#include "prm-regbits-34xx.h" 20#include "prm-regbits-34xx.h"
22#include "prm-regbits-44xx.h" 21#include "prm-regbits-44xx.h"
23 22
diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c
index 93a2a6e4260f..faebd5f076af 100644
--- a/arch/arm/mach-omap2/powerdomain.c
+++ b/arch/arm/mach-omap2/powerdomain.c
@@ -32,6 +32,7 @@
32 32
33#include "powerdomain.h" 33#include "powerdomain.h"
34#include "clockdomain.h" 34#include "clockdomain.h"
35#include "voltage.h"
35 36
36#include "soc.h" 37#include "soc.h"
37#include "pm.h" 38#include "pm.h"
diff --git a/arch/arm/mach-omap2/powerdomain.h b/arch/arm/mach-omap2/powerdomain.h
index da5a59ae77b6..f4727117f6cc 100644
--- a/arch/arm/mach-omap2/powerdomain.h
+++ b/arch/arm/mach-omap2/powerdomain.h
@@ -21,8 +21,6 @@
21#include <linux/list.h> 21#include <linux/list.h>
22#include <linux/spinlock.h> 22#include <linux/spinlock.h>
23 23
24#include "voltage.h"
25
26/* Powerdomain basic power states */ 24/* Powerdomain basic power states */
27#define PWRDM_POWER_OFF 0x0 25#define PWRDM_POWER_OFF 0x0
28#define PWRDM_POWER_RET 0x1 26#define PWRDM_POWER_RET 0x1
@@ -75,6 +73,7 @@
75 73
76struct clockdomain; 74struct clockdomain;
77struct powerdomain; 75struct powerdomain;
76struct voltagedomain;
78 77
79/** 78/**
80 * struct powerdomain - OMAP powerdomain 79 * struct powerdomain - OMAP powerdomain
diff --git a/arch/arm/mach-omap2/prcm-common.h b/arch/arm/mach-omap2/prcm-common.h
index 0e841fd9498a..a8e4b582c527 100644
--- a/arch/arm/mach-omap2/prcm-common.h
+++ b/arch/arm/mach-omap2/prcm-common.h
@@ -428,6 +428,28 @@
428#define MAX_IOPAD_LATCH_TIME 100 428#define MAX_IOPAD_LATCH_TIME 100
429# ifndef __ASSEMBLER__ 429# ifndef __ASSEMBLER__
430 430
431#include <linux/delay.h>
432
433/**
434 * omap_test_timeout - busy-loop, testing a condition
435 * @cond: condition to test until it evaluates to true
436 * @timeout: maximum number of microseconds in the timeout
437 * @index: loop index (integer)
438 *
439 * Loop waiting for @cond to become true or until at least @timeout
440 * microseconds have passed. To use, define some integer @index in the
441 * calling code. After running, if @index == @timeout, then the loop has
442 * timed out.
443 */
444#define omap_test_timeout(cond, timeout, index) \
445({ \
446 for (index = 0; index < timeout; index++) { \
447 if (cond) \
448 break; \
449 udelay(1); \
450 } \
451})
452
431/** 453/**
432 * struct omap_prcm_irq - describes a PRCM interrupt bit 454 * struct omap_prcm_irq - describes a PRCM interrupt bit
433 * @name: a short name describing the interrupt type, e.g. "wkup" or "io" 455 * @name: a short name describing the interrupt type, e.g. "wkup" or "io"
@@ -458,6 +480,7 @@ struct omap_prcm_irq {
458 * @ocp_barrier: fn ptr to force buffered PRM writes to complete 480 * @ocp_barrier: fn ptr to force buffered PRM writes to complete
459 * @save_and_clear_irqen: fn ptr to save and clear IRQENABLE regs 481 * @save_and_clear_irqen: fn ptr to save and clear IRQENABLE regs
460 * @restore_irqen: fn ptr to save and clear IRQENABLE regs 482 * @restore_irqen: fn ptr to save and clear IRQENABLE regs
483 * @reconfigure_io_chain: fn ptr to reconfigure IO chain
461 * @saved_mask: IRQENABLE regs are saved here during suspend 484 * @saved_mask: IRQENABLE regs are saved here during suspend
462 * @priority_mask: 1 bit per IRQ, set to 1 if omap_prcm_irq.priority = true 485 * @priority_mask: 1 bit per IRQ, set to 1 if omap_prcm_irq.priority = true
463 * @base_irq: base dynamic IRQ number, returned from irq_alloc_descs() in init 486 * @base_irq: base dynamic IRQ number, returned from irq_alloc_descs() in init
@@ -479,6 +502,7 @@ struct omap_prcm_irq_setup {
479 void (*ocp_barrier)(void); 502 void (*ocp_barrier)(void);
480 void (*save_and_clear_irqen)(u32 *saved_mask); 503 void (*save_and_clear_irqen)(u32 *saved_mask);
481 void (*restore_irqen)(u32 *saved_mask); 504 void (*restore_irqen)(u32 *saved_mask);
505 void (*reconfigure_io_chain)(void);
482 u32 *saved_mask; 506 u32 *saved_mask;
483 u32 *priority_mask; 507 u32 *priority_mask;
484 int base_irq; 508 int base_irq;
diff --git a/arch/arm/mach-omap2/prcm_mpu44xx.c b/arch/arm/mach-omap2/prcm_mpu44xx.c
index c30e44a7fab0..cdbee6326d29 100644
--- a/arch/arm/mach-omap2/prcm_mpu44xx.c
+++ b/arch/arm/mach-omap2/prcm_mpu44xx.c
@@ -30,12 +30,12 @@ void __iomem *prcm_mpu_base;
30 30
31u32 omap4_prcm_mpu_read_inst_reg(s16 inst, u16 reg) 31u32 omap4_prcm_mpu_read_inst_reg(s16 inst, u16 reg)
32{ 32{
33 return __raw_readl(OMAP44XX_PRCM_MPU_REGADDR(inst, reg)); 33 return readl_relaxed(OMAP44XX_PRCM_MPU_REGADDR(inst, reg));
34} 34}
35 35
36void omap4_prcm_mpu_write_inst_reg(u32 val, s16 inst, u16 reg) 36void omap4_prcm_mpu_write_inst_reg(u32 val, s16 inst, u16 reg)
37{ 37{
38 __raw_writel(val, OMAP44XX_PRCM_MPU_REGADDR(inst, reg)); 38 writel_relaxed(val, OMAP44XX_PRCM_MPU_REGADDR(inst, reg));
39} 39}
40 40
41u32 omap4_prcm_mpu_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst, s16 reg) 41u32 omap4_prcm_mpu_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst, s16 reg)
diff --git a/arch/arm/mach-omap2/prcm_mpu44xx.h b/arch/arm/mach-omap2/prcm_mpu44xx.h
index 059bd4f49035..ac9cb4550239 100644
--- a/arch/arm/mach-omap2/prcm_mpu44xx.h
+++ b/arch/arm/mach-omap2/prcm_mpu44xx.h
@@ -26,7 +26,6 @@
26#define __ARCH_ARM_MACH_OMAP2_PRCM_MPU44XX_H 26#define __ARCH_ARM_MACH_OMAP2_PRCM_MPU44XX_H
27 27
28#include "prcm_mpu_44xx_54xx.h" 28#include "prcm_mpu_44xx_54xx.h"
29#include "common.h"
30 29
31#define OMAP4430_PRCM_MPU_BASE 0x48243000 30#define OMAP4430_PRCM_MPU_BASE 0x48243000
32 31
diff --git a/arch/arm/mach-omap2/prm.h b/arch/arm/mach-omap2/prm.h
index 623db40fdbbd..48480d557b61 100644
--- a/arch/arm/mach-omap2/prm.h
+++ b/arch/arm/mach-omap2/prm.h
@@ -17,10 +17,18 @@
17 17
18# ifndef __ASSEMBLER__ 18# ifndef __ASSEMBLER__
19extern void __iomem *prm_base; 19extern void __iomem *prm_base;
20extern u16 prm_features;
20extern void omap2_set_globals_prm(void __iomem *prm); 21extern void omap2_set_globals_prm(void __iomem *prm);
21int of_prcm_init(void); 22int of_prcm_init(void);
22# endif 23# endif
23 24
25/*
26 * prm_features flag values
27 *
28 * PRM_HAS_IO_WAKEUP: has IO wakeup capability
29 * PRM_HAS_VOLTAGE: has voltage domains
30 */
31#define PRM_HAS_IO_WAKEUP (1 << 0)
24 32
25/* 33/*
26 * MAX_MODULE_SOFTRESET_WAIT: Maximum microseconds to wait for OMAP 34 * MAX_MODULE_SOFTRESET_WAIT: Maximum microseconds to wait for OMAP
@@ -118,6 +126,7 @@ struct prm_reset_src_map {
118 * @read_reset_sources: ptr to the SoC PRM-specific get_reset_source impl 126 * @read_reset_sources: ptr to the SoC PRM-specific get_reset_source impl
119 * @was_any_context_lost_old: ptr to the SoC PRM context loss test fn 127 * @was_any_context_lost_old: ptr to the SoC PRM context loss test fn
120 * @clear_context_loss_flags_old: ptr to the SoC PRM context loss flag clear fn 128 * @clear_context_loss_flags_old: ptr to the SoC PRM context loss flag clear fn
129 * @late_init: ptr to the late init function
121 * 130 *
122 * XXX @was_any_context_lost_old and @clear_context_loss_flags_old are 131 * XXX @was_any_context_lost_old and @clear_context_loss_flags_old are
123 * deprecated. 132 * deprecated.
@@ -126,6 +135,7 @@ struct prm_ll_data {
126 u32 (*read_reset_sources)(void); 135 u32 (*read_reset_sources)(void);
127 bool (*was_any_context_lost_old)(u8 part, s16 inst, u16 idx); 136 bool (*was_any_context_lost_old)(u8 part, s16 inst, u16 idx);
128 void (*clear_context_loss_flags_old)(u8 part, s16 inst, u16 idx); 137 void (*clear_context_loss_flags_old)(u8 part, s16 inst, u16 idx);
138 int (*late_init)(void);
129}; 139};
130 140
131extern int prm_register(struct prm_ll_data *pld); 141extern int prm_register(struct prm_ll_data *pld);
diff --git a/arch/arm/mach-omap2/prm2xxx.c b/arch/arm/mach-omap2/prm2xxx.c
index 418de9c3b319..a3a3cca2bcc4 100644
--- a/arch/arm/mach-omap2/prm2xxx.c
+++ b/arch/arm/mach-omap2/prm2xxx.c
@@ -18,9 +18,6 @@
18#include <linux/io.h> 18#include <linux/io.h>
19#include <linux/irq.h> 19#include <linux/irq.h>
20 20
21#include "soc.h"
22#include "common.h"
23#include "vp.h"
24#include "powerdomain.h" 21#include "powerdomain.h"
25#include "clockdomain.h" 22#include "clockdomain.h"
26#include "prm2xxx.h" 23#include "prm2xxx.h"
@@ -201,19 +198,11 @@ static struct prm_ll_data omap2xxx_prm_ll_data = {
201 198
202int __init omap2xxx_prm_init(void) 199int __init omap2xxx_prm_init(void)
203{ 200{
204 if (!cpu_is_omap24xx())
205 return 0;
206
207 return prm_register(&omap2xxx_prm_ll_data); 201 return prm_register(&omap2xxx_prm_ll_data);
208} 202}
209 203
210static void __exit omap2xxx_prm_exit(void) 204static void __exit omap2xxx_prm_exit(void)
211{ 205{
212 if (!cpu_is_omap24xx()) 206 prm_unregister(&omap2xxx_prm_ll_data);
213 return;
214
215 /* Should never happen */
216 WARN(prm_unregister(&omap2xxx_prm_ll_data),
217 "%s: prm_ll_data function pointer mismatch\n", __func__);
218} 207}
219__exitcall(omap2xxx_prm_exit); 208__exitcall(omap2xxx_prm_exit);
diff --git a/arch/arm/mach-omap2/prm2xxx.h b/arch/arm/mach-omap2/prm2xxx.h
index 3194dd87e0e4..d2cb6365716f 100644
--- a/arch/arm/mach-omap2/prm2xxx.h
+++ b/arch/arm/mach-omap2/prm2xxx.h
@@ -27,7 +27,7 @@
27 27
28/* 28/*
29 * OMAP2-specific global PRM registers 29 * OMAP2-specific global PRM registers
30 * Use __raw_{read,write}l() with these registers. 30 * Use {read,write}l_relaxed() with these registers.
31 * 31 *
32 * With a few exceptions, these are the register names beginning with 32 * With a few exceptions, these are the register names beginning with
33 * PRCM_* on 24xx. (The exceptions are the IRQSTATUS and IRQENABLE 33 * PRCM_* on 24xx. (The exceptions are the IRQSTATUS and IRQENABLE
diff --git a/arch/arm/mach-omap2/prm2xxx_3xxx.c b/arch/arm/mach-omap2/prm2xxx_3xxx.c
index 947f6adfed0c..c13b4e293ffa 100644
--- a/arch/arm/mach-omap2/prm2xxx_3xxx.c
+++ b/arch/arm/mach-omap2/prm2xxx_3xxx.c
@@ -16,7 +16,6 @@
16#include <linux/err.h> 16#include <linux/err.h>
17#include <linux/io.h> 17#include <linux/io.h>
18 18
19#include "common.h"
20#include "powerdomain.h" 19#include "powerdomain.h"
21#include "prm2xxx_3xxx.h" 20#include "prm2xxx_3xxx.h"
22#include "prm-regbits-24xx.h" 21#include "prm-regbits-24xx.h"
diff --git a/arch/arm/mach-omap2/prm2xxx_3xxx.h b/arch/arm/mach-omap2/prm2xxx_3xxx.h
index 9624b40836d4..1a3a96392b97 100644
--- a/arch/arm/mach-omap2/prm2xxx_3xxx.h
+++ b/arch/arm/mach-omap2/prm2xxx_3xxx.h
@@ -55,12 +55,12 @@
55/* Power/reset management domain register get/set */ 55/* Power/reset management domain register get/set */
56static inline u32 omap2_prm_read_mod_reg(s16 module, u16 idx) 56static inline u32 omap2_prm_read_mod_reg(s16 module, u16 idx)
57{ 57{
58 return __raw_readl(prm_base + module + idx); 58 return readl_relaxed(prm_base + module + idx);
59} 59}
60 60
61static inline void omap2_prm_write_mod_reg(u32 val, s16 module, u16 idx) 61static inline void omap2_prm_write_mod_reg(u32 val, s16 module, u16 idx)
62{ 62{
63 __raw_writel(val, prm_base + module + idx); 63 writel_relaxed(val, prm_base + module + idx);
64} 64}
65 65
66/* Read-modify-write a register in a PRM module. Caller must lock */ 66/* Read-modify-write a register in a PRM module. Caller must lock */
diff --git a/arch/arm/mach-omap2/prm33xx.c b/arch/arm/mach-omap2/prm33xx.c
index 720440737744..62709cd2f9c5 100644
--- a/arch/arm/mach-omap2/prm33xx.c
+++ b/arch/arm/mach-omap2/prm33xx.c
@@ -19,7 +19,6 @@
19#include <linux/err.h> 19#include <linux/err.h>
20#include <linux/io.h> 20#include <linux/io.h>
21 21
22#include "common.h"
23#include "powerdomain.h" 22#include "powerdomain.h"
24#include "prm33xx.h" 23#include "prm33xx.h"
25#include "prm-regbits-33xx.h" 24#include "prm-regbits-33xx.h"
@@ -27,13 +26,13 @@
27/* Read a register in a PRM instance */ 26/* Read a register in a PRM instance */
28u32 am33xx_prm_read_reg(s16 inst, u16 idx) 27u32 am33xx_prm_read_reg(s16 inst, u16 idx)
29{ 28{
30 return __raw_readl(prm_base + inst + idx); 29 return readl_relaxed(prm_base + inst + idx);
31} 30}
32 31
33/* Write into a register in a PRM instance */ 32/* Write into a register in a PRM instance */
34void am33xx_prm_write_reg(u32 val, s16 inst, u16 idx) 33void am33xx_prm_write_reg(u32 val, s16 inst, u16 idx)
35{ 34{
36 __raw_writel(val, prm_base + inst + idx); 35 writel_relaxed(val, prm_base + inst + idx);
37} 36}
38 37
39/* Read-modify-write a register in PRM. Caller must lock */ 38/* Read-modify-write a register in PRM. Caller must lock */
diff --git a/arch/arm/mach-omap2/prm3xxx.c b/arch/arm/mach-omap2/prm3xxx.c
index 7721990d2006..4bd7a2dca8af 100644
--- a/arch/arm/mach-omap2/prm3xxx.c
+++ b/arch/arm/mach-omap2/prm3xxx.c
@@ -43,6 +43,7 @@ static struct omap_prcm_irq_setup omap3_prcm_irq_setup = {
43 .ocp_barrier = &omap3xxx_prm_ocp_barrier, 43 .ocp_barrier = &omap3xxx_prm_ocp_barrier,
44 .save_and_clear_irqen = &omap3xxx_prm_save_and_clear_irqen, 44 .save_and_clear_irqen = &omap3xxx_prm_save_and_clear_irqen,
45 .restore_irqen = &omap3xxx_prm_restore_irqen, 45 .restore_irqen = &omap3xxx_prm_restore_irqen,
46 .reconfigure_io_chain = &omap3xxx_prm_reconfigure_io_chain,
46}; 47};
47 48
48/* 49/*
@@ -246,7 +247,7 @@ void omap3xxx_prm_reconfigure_io_chain(void)
246 */ 247 */
247static void __init omap3xxx_prm_enable_io_wakeup(void) 248static void __init omap3xxx_prm_enable_io_wakeup(void)
248{ 249{
249 if (omap3_has_io_wakeup()) 250 if (prm_features & PRM_HAS_IO_WAKEUP)
250 omap2_prm_set_mod_reg_bits(OMAP3430_EN_IO_MASK, WKUP_MOD, 251 omap2_prm_set_mod_reg_bits(OMAP3430_EN_IO_MASK, WKUP_MOD,
251 PM_WKEN); 252 PM_WKEN);
252} 253}
@@ -400,23 +401,26 @@ struct pwrdm_ops omap3_pwrdm_operations = {
400 * 401 *
401 */ 402 */
402 403
404static int omap3xxx_prm_late_init(void);
405
403static struct prm_ll_data omap3xxx_prm_ll_data = { 406static struct prm_ll_data omap3xxx_prm_ll_data = {
404 .read_reset_sources = &omap3xxx_prm_read_reset_sources, 407 .read_reset_sources = &omap3xxx_prm_read_reset_sources,
408 .late_init = &omap3xxx_prm_late_init,
405}; 409};
406 410
407int __init omap3xxx_prm_init(void) 411int __init omap3xxx_prm_init(void)
408{ 412{
409 if (!cpu_is_omap34xx()) 413 if (omap3_has_io_wakeup())
410 return 0; 414 prm_features |= PRM_HAS_IO_WAKEUP;
411 415
412 return prm_register(&omap3xxx_prm_ll_data); 416 return prm_register(&omap3xxx_prm_ll_data);
413} 417}
414 418
415static int __init omap3xxx_prm_late_init(void) 419static int omap3xxx_prm_late_init(void)
416{ 420{
417 int ret; 421 int ret;
418 422
419 if (!cpu_is_omap34xx()) 423 if (!(prm_features & PRM_HAS_IO_WAKEUP))
420 return 0; 424 return 0;
421 425
422 omap3xxx_prm_enable_io_wakeup(); 426 omap3xxx_prm_enable_io_wakeup();
@@ -427,15 +431,9 @@ static int __init omap3xxx_prm_late_init(void)
427 431
428 return ret; 432 return ret;
429} 433}
430omap_subsys_initcall(omap3xxx_prm_late_init);
431 434
432static void __exit omap3xxx_prm_exit(void) 435static void __exit omap3xxx_prm_exit(void)
433{ 436{
434 if (!cpu_is_omap34xx()) 437 prm_unregister(&omap3xxx_prm_ll_data);
435 return;
436
437 /* Should never happen */
438 WARN(prm_unregister(&omap3xxx_prm_ll_data),
439 "%s: prm_ll_data function pointer mismatch\n", __func__);
440} 438}
441__exitcall(omap3xxx_prm_exit); 439__exitcall(omap3xxx_prm_exit);
diff --git a/arch/arm/mach-omap2/prm3xxx.h b/arch/arm/mach-omap2/prm3xxx.h
index f8eb83323b1a..1dacfc5b1959 100644
--- a/arch/arm/mach-omap2/prm3xxx.h
+++ b/arch/arm/mach-omap2/prm3xxx.h
@@ -26,7 +26,7 @@
26 26
27/* 27/*
28 * OMAP3-specific global PRM registers 28 * OMAP3-specific global PRM registers
29 * Use __raw_{read,write}l() with these registers. 29 * Use {read,write}l_relaxed() with these registers.
30 * 30 *
31 * With a few exceptions, these are the register names beginning with 31 * With a few exceptions, these are the register names beginning with
32 * PRM_* on 34xx. (The exceptions are the IRQSTATUS and IRQENABLE 32 * PRM_* on 34xx. (The exceptions are the IRQSTATUS and IRQENABLE
diff --git a/arch/arm/mach-omap2/prm44xx.c b/arch/arm/mach-omap2/prm44xx.c
index 03a603476cfc..a7f6ea27180a 100644
--- a/arch/arm/mach-omap2/prm44xx.c
+++ b/arch/arm/mach-omap2/prm44xx.c
@@ -47,6 +47,7 @@ static struct omap_prcm_irq_setup omap4_prcm_irq_setup = {
47 .ocp_barrier = &omap44xx_prm_ocp_barrier, 47 .ocp_barrier = &omap44xx_prm_ocp_barrier,
48 .save_and_clear_irqen = &omap44xx_prm_save_and_clear_irqen, 48 .save_and_clear_irqen = &omap44xx_prm_save_and_clear_irqen,
49 .restore_irqen = &omap44xx_prm_restore_irqen, 49 .restore_irqen = &omap44xx_prm_restore_irqen,
50 .reconfigure_io_chain = &omap44xx_prm_reconfigure_io_chain,
50}; 51};
51 52
52/* 53/*
@@ -81,13 +82,13 @@ static struct prm_reset_src_map omap44xx_prm_reset_src_map[] = {
81/* Read a register in a CM/PRM instance in the PRM module */ 82/* Read a register in a CM/PRM instance in the PRM module */
82u32 omap4_prm_read_inst_reg(s16 inst, u16 reg) 83u32 omap4_prm_read_inst_reg(s16 inst, u16 reg)
83{ 84{
84 return __raw_readl(prm_base + inst + reg); 85 return readl_relaxed(prm_base + inst + reg);
85} 86}
86 87
87/* Write into a register in a CM/PRM instance in the PRM module */ 88/* Write into a register in a CM/PRM instance in the PRM module */
88void omap4_prm_write_inst_reg(u32 val, s16 inst, u16 reg) 89void omap4_prm_write_inst_reg(u32 val, s16 inst, u16 reg)
89{ 90{
90 __raw_writel(val, prm_base + inst + reg); 91 writel_relaxed(val, prm_base + inst + reg);
91} 92}
92 93
93/* Read-modify-write a register in a PRM module. Caller must lock */ 94/* Read-modify-write a register in a PRM module. Caller must lock */
@@ -649,6 +650,8 @@ struct pwrdm_ops omap4_pwrdm_operations = {
649 .pwrdm_has_voltdm = omap4_check_vcvp, 650 .pwrdm_has_voltdm = omap4_check_vcvp,
650}; 651};
651 652
653static int omap44xx_prm_late_init(void);
654
652/* 655/*
653 * XXX document 656 * XXX document
654 */ 657 */
@@ -656,34 +659,29 @@ static struct prm_ll_data omap44xx_prm_ll_data = {
656 .read_reset_sources = &omap44xx_prm_read_reset_sources, 659 .read_reset_sources = &omap44xx_prm_read_reset_sources,
657 .was_any_context_lost_old = &omap44xx_prm_was_any_context_lost_old, 660 .was_any_context_lost_old = &omap44xx_prm_was_any_context_lost_old,
658 .clear_context_loss_flags_old = &omap44xx_prm_clear_context_loss_flags_old, 661 .clear_context_loss_flags_old = &omap44xx_prm_clear_context_loss_flags_old,
662 .late_init = &omap44xx_prm_late_init,
659}; 663};
660 664
661int __init omap44xx_prm_init(void) 665int __init omap44xx_prm_init(void)
662{ 666{
663 if (!cpu_is_omap44xx() && !soc_is_omap54xx() && !soc_is_dra7xx()) 667 if (cpu_is_omap44xx())
664 return 0; 668 prm_features |= PRM_HAS_IO_WAKEUP;
665 669
666 return prm_register(&omap44xx_prm_ll_data); 670 return prm_register(&omap44xx_prm_ll_data);
667} 671}
668 672
669static int __init omap44xx_prm_late_init(void) 673static int omap44xx_prm_late_init(void)
670{ 674{
671 if (!cpu_is_omap44xx()) 675 if (!(prm_features & PRM_HAS_IO_WAKEUP))
672 return 0; 676 return 0;
673 677
674 omap44xx_prm_enable_io_wakeup(); 678 omap44xx_prm_enable_io_wakeup();
675 679
676 return omap_prcm_register_chain_handler(&omap4_prcm_irq_setup); 680 return omap_prcm_register_chain_handler(&omap4_prcm_irq_setup);
677} 681}
678omap_subsys_initcall(omap44xx_prm_late_init);
679 682
680static void __exit omap44xx_prm_exit(void) 683static void __exit omap44xx_prm_exit(void)
681{ 684{
682 if (!cpu_is_omap44xx()) 685 prm_unregister(&omap44xx_prm_ll_data);
683 return;
684
685 /* Should never happen */
686 WARN(prm_unregister(&omap44xx_prm_ll_data),
687 "%s: prm_ll_data function pointer mismatch\n", __func__);
688} 686}
689__exitcall(omap44xx_prm_exit); 687__exitcall(omap44xx_prm_exit);
diff --git a/arch/arm/mach-omap2/prm_common.c b/arch/arm/mach-omap2/prm_common.c
index b4c4ab9c8044..25e8b8232115 100644
--- a/arch/arm/mach-omap2/prm_common.c
+++ b/arch/arm/mach-omap2/prm_common.c
@@ -62,6 +62,8 @@ static struct omap_prcm_irq_setup *prcm_irq_setup;
62/* prm_base: base virtual address of the PRM IP block */ 62/* prm_base: base virtual address of the PRM IP block */
63void __iomem *prm_base; 63void __iomem *prm_base;
64 64
65u16 prm_features;
66
65/* 67/*
66 * prm_ll_data: function pointers to SoC-specific implementations of 68 * prm_ll_data: function pointers to SoC-specific implementations of
67 * common PRM functions 69 * common PRM functions
@@ -330,12 +332,7 @@ int omap_prcm_register_chain_handler(struct omap_prcm_irq_setup *irq_setup)
330 332
331 if (of_have_populated_dt()) { 333 if (of_have_populated_dt()) {
332 int irq = omap_prcm_event_to_irq("io"); 334 int irq = omap_prcm_event_to_irq("io");
333 if (cpu_is_omap34xx()) 335 omap_pcs_legacy_init(irq, irq_setup->reconfigure_io_chain);
334 omap_pcs_legacy_init(irq,
335 omap3xxx_prm_reconfigure_io_chain);
336 else
337 omap_pcs_legacy_init(irq,
338 omap44xx_prm_reconfigure_io_chain);
339 } 336 }
340 337
341 return 0; 338 return 0;
@@ -530,3 +527,11 @@ int __init of_prcm_init(void)
530 527
531 return 0; 528 return 0;
532} 529}
530
531static int __init prm_late_init(void)
532{
533 if (prm_ll_data->late_init)
534 return prm_ll_data->late_init();
535 return 0;
536}
537subsys_initcall(prm_late_init);
diff --git a/arch/arm/mach-omap2/prminst44xx.c b/arch/arm/mach-omap2/prminst44xx.c
index 05fcf6de44ee..69f0dd08629c 100644
--- a/arch/arm/mach-omap2/prminst44xx.c
+++ b/arch/arm/mach-omap2/prminst44xx.c
@@ -49,7 +49,7 @@ u32 omap4_prminst_read_inst_reg(u8 part, s16 inst, u16 idx)
49 BUG_ON(part >= OMAP4_MAX_PRCM_PARTITIONS || 49 BUG_ON(part >= OMAP4_MAX_PRCM_PARTITIONS ||
50 part == OMAP4430_INVALID_PRCM_PARTITION || 50 part == OMAP4430_INVALID_PRCM_PARTITION ||
51 !_prm_bases[part]); 51 !_prm_bases[part]);
52 return __raw_readl(_prm_bases[part] + inst + idx); 52 return readl_relaxed(_prm_bases[part] + inst + idx);
53} 53}
54 54
55/* Write into a register in a PRM instance */ 55/* Write into a register in a PRM instance */
@@ -58,7 +58,7 @@ void omap4_prminst_write_inst_reg(u32 val, u8 part, s16 inst, u16 idx)
58 BUG_ON(part >= OMAP4_MAX_PRCM_PARTITIONS || 58 BUG_ON(part >= OMAP4_MAX_PRCM_PARTITIONS ||
59 part == OMAP4430_INVALID_PRCM_PARTITION || 59 part == OMAP4430_INVALID_PRCM_PARTITION ||
60 !_prm_bases[part]); 60 !_prm_bases[part]);
61 __raw_writel(val, _prm_bases[part] + inst + idx); 61 writel_relaxed(val, _prm_bases[part] + inst + idx);
62} 62}
63 63
64/* Read-modify-write a register in PRM. Caller must lock */ 64/* Read-modify-write a register in PRM. Caller must lock */
diff --git a/arch/arm/mach-omap2/sdrc.h b/arch/arm/mach-omap2/sdrc.h
index 446aa13511fd..645a2a46b213 100644
--- a/arch/arm/mach-omap2/sdrc.h
+++ b/arch/arm/mach-omap2/sdrc.h
@@ -31,24 +31,24 @@ extern void __iomem *omap2_sms_base;
31 31
32static inline void sdrc_write_reg(u32 val, u16 reg) 32static inline void sdrc_write_reg(u32 val, u16 reg)
33{ 33{
34 __raw_writel(val, OMAP_SDRC_REGADDR(reg)); 34 writel_relaxed(val, OMAP_SDRC_REGADDR(reg));
35} 35}
36 36
37static inline u32 sdrc_read_reg(u16 reg) 37static inline u32 sdrc_read_reg(u16 reg)
38{ 38{
39 return __raw_readl(OMAP_SDRC_REGADDR(reg)); 39 return readl_relaxed(OMAP_SDRC_REGADDR(reg));
40} 40}
41 41
42/* SMS global register get/set */ 42/* SMS global register get/set */
43 43
44static inline void sms_write_reg(u32 val, u16 reg) 44static inline void sms_write_reg(u32 val, u16 reg)
45{ 45{
46 __raw_writel(val, OMAP_SMS_REGADDR(reg)); 46 writel_relaxed(val, OMAP_SMS_REGADDR(reg));
47} 47}
48 48
49static inline u32 sms_read_reg(u16 reg) 49static inline u32 sms_read_reg(u16 reg)
50{ 50{
51 return __raw_readl(OMAP_SMS_REGADDR(reg)); 51 return readl_relaxed(OMAP_SMS_REGADDR(reg));
52} 52}
53 53
54extern void omap2_set_globals_sdrc(void __iomem *sdrc, void __iomem *sms); 54extern void omap2_set_globals_sdrc(void __iomem *sdrc, void __iomem *sms);
diff --git a/arch/arm/mach-omap2/sdrc2xxx.c b/arch/arm/mach-omap2/sdrc2xxx.c
index 907291714643..ae3f1553158d 100644
--- a/arch/arm/mach-omap2/sdrc2xxx.c
+++ b/arch/arm/mach-omap2/sdrc2xxx.c
@@ -103,9 +103,9 @@ u32 omap2xxx_sdrc_reprogram(u32 level, u32 force)
103 * prm2xxx.c function 103 * prm2xxx.c function
104 */ 104 */
105 if (cpu_is_omap2420()) 105 if (cpu_is_omap2420())
106 __raw_writel(0xffff, OMAP2420_PRCM_VOLTSETUP); 106 writel_relaxed(0xffff, OMAP2420_PRCM_VOLTSETUP);
107 else 107 else
108 __raw_writel(0xffff, OMAP2430_PRCM_VOLTSETUP); 108 writel_relaxed(0xffff, OMAP2430_PRCM_VOLTSETUP);
109 omap2_sram_reprogram_sdrc(level, dll_ctrl, m_type); 109 omap2_sram_reprogram_sdrc(level, dll_ctrl, m_type);
110 curr_perf_level = level; 110 curr_perf_level = level;
111 local_irq_restore(flags); 111 local_irq_restore(flags);
diff --git a/arch/arm/mach-omap2/sr_device.c b/arch/arm/mach-omap2/sr_device.c
index d7bc33f15344..1b91ef0c182a 100644
--- a/arch/arm/mach-omap2/sr_device.c
+++ b/arch/arm/mach-omap2/sr_device.c
@@ -57,7 +57,7 @@ static void __init sr_set_nvalues(struct omap_volt_data *volt_data,
57 57
58 /* 58 /*
59 * In OMAP4 the efuse registers are 24 bit aligned. 59 * In OMAP4 the efuse registers are 24 bit aligned.
60 * A __raw_readl will fail for non-32 bit aligned address 60 * A readl_relaxed will fail for non-32 bit aligned address
61 * and hence the 8-bit read and shift. 61 * and hence the 8-bit read and shift.
62 */ 62 */
63 if (cpu_is_omap44xx()) { 63 if (cpu_is_omap44xx()) {
diff --git a/arch/arm/mach-omap2/sram.c b/arch/arm/mach-omap2/sram.c
index 4bd096836235..ddf1818af228 100644
--- a/arch/arm/mach-omap2/sram.c
+++ b/arch/arm/mach-omap2/sram.c
@@ -70,16 +70,16 @@ static int is_sram_locked(void)
70 if (OMAP2_DEVICE_TYPE_GP == omap_type()) { 70 if (OMAP2_DEVICE_TYPE_GP == omap_type()) {
71 /* RAMFW: R/W access to all initiators for all qualifier sets */ 71 /* RAMFW: R/W access to all initiators for all qualifier sets */
72 if (cpu_is_omap242x()) { 72 if (cpu_is_omap242x()) {
73 __raw_writel(0xFF, OMAP24XX_VA_REQINFOPERM0); /* all q-vects */ 73 writel_relaxed(0xFF, OMAP24XX_VA_REQINFOPERM0); /* all q-vects */
74 __raw_writel(0xCFDE, OMAP24XX_VA_READPERM0); /* all i-read */ 74 writel_relaxed(0xCFDE, OMAP24XX_VA_READPERM0); /* all i-read */
75 __raw_writel(0xCFDE, OMAP24XX_VA_WRITEPERM0); /* all i-write */ 75 writel_relaxed(0xCFDE, OMAP24XX_VA_WRITEPERM0); /* all i-write */
76 } 76 }
77 if (cpu_is_omap34xx()) { 77 if (cpu_is_omap34xx()) {
78 __raw_writel(0xFFFF, OMAP34XX_VA_REQINFOPERM0); /* all q-vects */ 78 writel_relaxed(0xFFFF, OMAP34XX_VA_REQINFOPERM0); /* all q-vects */
79 __raw_writel(0xFFFF, OMAP34XX_VA_READPERM0); /* all i-read */ 79 writel_relaxed(0xFFFF, OMAP34XX_VA_READPERM0); /* all i-read */
80 __raw_writel(0xFFFF, OMAP34XX_VA_WRITEPERM0); /* all i-write */ 80 writel_relaxed(0xFFFF, OMAP34XX_VA_WRITEPERM0); /* all i-write */
81 __raw_writel(0x0, OMAP34XX_VA_ADDR_MATCH2); 81 writel_relaxed(0x0, OMAP34XX_VA_ADDR_MATCH2);
82 __raw_writel(0xFFFFFFFF, OMAP34XX_VA_SMS_RG_ATT0); 82 writel_relaxed(0xFFFFFFFF, OMAP34XX_VA_SMS_RG_ATT0);
83 } 83 }
84 return 0; 84 return 0;
85 } else 85 } else
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
index 842b81f31957..43d03fbf4c0b 100644
--- a/arch/arm/mach-omap2/timer.c
+++ b/arch/arm/mach-omap2/timer.c
@@ -546,15 +546,15 @@ static void __init realtime_counter_init(void)
546 } 546 }
547 547
548 /* Program numerator and denumerator registers */ 548 /* Program numerator and denumerator registers */
549 reg = __raw_readl(base + INCREMENTER_NUMERATOR_OFFSET) & 549 reg = readl_relaxed(base + INCREMENTER_NUMERATOR_OFFSET) &
550 NUMERATOR_DENUMERATOR_MASK; 550 NUMERATOR_DENUMERATOR_MASK;
551 reg |= num; 551 reg |= num;
552 __raw_writel(reg, base + INCREMENTER_NUMERATOR_OFFSET); 552 writel_relaxed(reg, base + INCREMENTER_NUMERATOR_OFFSET);
553 553
554 reg = __raw_readl(base + INCREMENTER_DENUMERATOR_RELOAD_OFFSET) & 554 reg = readl_relaxed(base + INCREMENTER_DENUMERATOR_RELOAD_OFFSET) &
555 NUMERATOR_DENUMERATOR_MASK; 555 NUMERATOR_DENUMERATOR_MASK;
556 reg |= den; 556 reg |= den;
557 __raw_writel(reg, base + INCREMENTER_DENUMERATOR_RELOAD_OFFSET); 557 writel_relaxed(reg, base + INCREMENTER_DENUMERATOR_RELOAD_OFFSET);
558 558
559 arch_timer_freq = (rate / den) * num; 559 arch_timer_freq = (rate / den) * num;
560 set_cntfreq(); 560 set_cntfreq();
diff --git a/arch/arm/mach-omap2/vc.c b/arch/arm/mach-omap2/vc.c
index 49ac7977e03e..267f204559c3 100644
--- a/arch/arm/mach-omap2/vc.c
+++ b/arch/arm/mach-omap2/vc.c
@@ -462,7 +462,7 @@ static void omap4_set_timings(struct voltagedomain *voltdm, bool off_mode)
462 val |= omap4_usec_to_val_scrm(tshut, OMAP4_DOWNTIME_SHIFT, 462 val |= omap4_usec_to_val_scrm(tshut, OMAP4_DOWNTIME_SHIFT,
463 OMAP4_DOWNTIME_MASK); 463 OMAP4_DOWNTIME_MASK);
464 464
465 __raw_writel(val, OMAP4_SCRM_CLKSETUPTIME); 465 writel_relaxed(val, OMAP4_SCRM_CLKSETUPTIME);
466} 466}
467 467
468/* OMAP4 specific voltage init functions */ 468/* OMAP4 specific voltage init functions */
@@ -584,7 +584,7 @@ static void __init omap4_vc_i2c_timing_init(struct voltagedomain *voltdm)
584 val = i2c_data->loadbits << 25 | i2c_data->loadbits << 29; 584 val = i2c_data->loadbits << 25 | i2c_data->loadbits << 29;
585 585
586 /* Write to SYSCTRL_PADCONF_WKUP_CTRL_I2C_2 to setup I2C pull */ 586 /* Write to SYSCTRL_PADCONF_WKUP_CTRL_I2C_2 to setup I2C pull */
587 __raw_writel(val, OMAP2_L4_IO_ADDRESS(OMAP4_CTRL_MODULE_PAD_WKUP + 587 writel_relaxed(val, OMAP2_L4_IO_ADDRESS(OMAP4_CTRL_MODULE_PAD_WKUP +
588 OMAP4_CTRL_MODULE_PAD_WKUP_CONTROL_I2C_2)); 588 OMAP4_CTRL_MODULE_PAD_WKUP_CONTROL_I2C_2));
589 589
590 /* HSSCLH can always be zero */ 590 /* HSSCLH can always be zero */
diff --git a/arch/arm/mach-omap2/wd_timer.c b/arch/arm/mach-omap2/wd_timer.c
index d15c7bbab8e2..97d6607d447a 100644
--- a/arch/arm/mach-omap2/wd_timer.c
+++ b/arch/arm/mach-omap2/wd_timer.c
@@ -49,12 +49,12 @@ int omap2_wd_timer_disable(struct omap_hwmod *oh)
49 } 49 }
50 50
51 /* sequence required to disable watchdog */ 51 /* sequence required to disable watchdog */
52 __raw_writel(0xAAAA, base + OMAP_WDT_SPR); 52 writel_relaxed(0xAAAA, base + OMAP_WDT_SPR);
53 while (__raw_readl(base + OMAP_WDT_WPS) & 0x10) 53 while (readl_relaxed(base + OMAP_WDT_WPS) & 0x10)
54 cpu_relax(); 54 cpu_relax();
55 55
56 __raw_writel(0x5555, base + OMAP_WDT_SPR); 56 writel_relaxed(0x5555, base + OMAP_WDT_SPR);
57 while (__raw_readl(base + OMAP_WDT_WPS) & 0x10) 57 while (readl_relaxed(base + OMAP_WDT_WPS) & 0x10)
58 cpu_relax(); 58 cpu_relax();
59 59
60 return 0; 60 return 0;
diff --git a/arch/arm/mach-prima2/rstc.c b/arch/arm/mach-prima2/rstc.c
index 4887a2a4c698..3dffcb2d714e 100644
--- a/arch/arm/mach-prima2/rstc.c
+++ b/arch/arm/mach-prima2/rstc.c
@@ -36,27 +36,33 @@ static int sirfsoc_reset_module(struct reset_controller_dev *rcdev,
36 36
37 if (of_device_is_compatible(rcdev->of_node, "sirf,prima2-rstc")) { 37 if (of_device_is_compatible(rcdev->of_node, "sirf,prima2-rstc")) {
38 /* 38 /*
39 * Writing 1 to this bit resets corresponding block. Writing 0 to this 39 * Writing 1 to this bit resets corresponding block.
40 * bit de-asserts reset signal of the corresponding block. 40 * Writing 0 to this bit de-asserts reset signal of the
41 * datasheet doesn't require explicit delay between the set and clear 41 * corresponding block. datasheet doesn't require explicit
42 * of reset bit. it could be shorter if tests pass. 42 * delay between the set and clear of reset bit. it could
43 * be shorter if tests pass.
43 */ 44 */
44 writel(readl(sirfsoc_rstc_base + (reset_bit / 32) * 4) | (1 << reset_bit), 45 writel(readl(sirfsoc_rstc_base +
46 (reset_bit / 32) * 4) | (1 << reset_bit),
45 sirfsoc_rstc_base + (reset_bit / 32) * 4); 47 sirfsoc_rstc_base + (reset_bit / 32) * 4);
46 msleep(10); 48 msleep(20);
47 writel(readl(sirfsoc_rstc_base + (reset_bit / 32) * 4) & ~(1 << reset_bit), 49 writel(readl(sirfsoc_rstc_base +
50 (reset_bit / 32) * 4) & ~(1 << reset_bit),
48 sirfsoc_rstc_base + (reset_bit / 32) * 4); 51 sirfsoc_rstc_base + (reset_bit / 32) * 4);
49 } else { 52 } else {
50 /* 53 /*
51 * For MARCO and POLO 54 * For MARCO and POLO
52 * Writing 1 to SET register resets corresponding block. Writing 1 to CLEAR 55 * Writing 1 to SET register resets corresponding block.
53 * register de-asserts reset signal of the corresponding block. 56 * Writing 1 to CLEAR register de-asserts reset signal of the
54 * datasheet doesn't require explicit delay between the set and clear 57 * corresponding block.
55 * of reset bit. it could be shorter if tests pass. 58 * datasheet doesn't require explicit delay between the set and
59 * clear of reset bit. it could be shorter if tests pass.
56 */ 60 */
57 writel(1 << reset_bit, sirfsoc_rstc_base + (reset_bit / 32) * 8); 61 writel(1 << reset_bit,
58 msleep(10); 62 sirfsoc_rstc_base + (reset_bit / 32) * 8);
59 writel(1 << reset_bit, sirfsoc_rstc_base + (reset_bit / 32) * 8 + 4); 63 msleep(20);
64 writel(1 << reset_bit,
65 sirfsoc_rstc_base + (reset_bit / 32) * 8 + 4);
60 } 66 }
61 67
62 mutex_unlock(&rstc_lock); 68 mutex_unlock(&rstc_lock);
diff --git a/arch/arm/mach-qcom/Kconfig b/arch/arm/mach-qcom/Kconfig
index a028be234334..6aa22147cace 100644
--- a/arch/arm/mach-qcom/Kconfig
+++ b/arch/arm/mach-qcom/Kconfig
@@ -3,8 +3,6 @@ config ARCH_QCOM
3 select ARCH_REQUIRE_GPIOLIB 3 select ARCH_REQUIRE_GPIOLIB
4 select ARM_GIC 4 select ARM_GIC
5 select CLKSRC_OF 5 select CLKSRC_OF
6 select GENERIC_CLOCKEVENTS
7 select HAVE_SMP
8 select QCOM_SCM if SMP 6 select QCOM_SCM if SMP
9 help 7 help
10 Support for Qualcomm's devicetree based systems. 8 Support for Qualcomm's devicetree based systems.
diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c
index 1d5ee5c9a1dc..960b8dd78c44 100644
--- a/arch/arm/mach-realview/core.c
+++ b/arch/arm/mach-realview/core.c
@@ -148,6 +148,21 @@ struct platform_device realview_cf_device = {
148 }, 148 },
149}; 149};
150 150
151static struct resource realview_leds_resources[] = {
152 {
153 .start = REALVIEW_SYS_BASE + REALVIEW_SYS_LED_OFFSET,
154 .end = REALVIEW_SYS_BASE + REALVIEW_SYS_LED_OFFSET + 4,
155 .flags = IORESOURCE_MEM,
156 },
157};
158
159struct platform_device realview_leds_device = {
160 .name = "versatile-leds",
161 .id = -1,
162 .num_resources = ARRAY_SIZE(realview_leds_resources),
163 .resource = realview_leds_resources,
164};
165
151static struct resource realview_i2c_resource = { 166static struct resource realview_i2c_resource = {
152 .start = REALVIEW_I2C_BASE, 167 .start = REALVIEW_I2C_BASE,
153 .end = REALVIEW_I2C_BASE + SZ_4K - 1, 168 .end = REALVIEW_I2C_BASE + SZ_4K - 1,
diff --git a/arch/arm/mach-realview/core.h b/arch/arm/mach-realview/core.h
index 602ca5ec52c5..13dc830ef469 100644
--- a/arch/arm/mach-realview/core.h
+++ b/arch/arm/mach-realview/core.h
@@ -37,6 +37,7 @@ struct machine_desc;
37 37
38extern struct platform_device realview_flash_device; 38extern struct platform_device realview_flash_device;
39extern struct platform_device realview_cf_device; 39extern struct platform_device realview_cf_device;
40extern struct platform_device realview_leds_device;
40extern struct platform_device realview_i2c_device; 41extern struct platform_device realview_i2c_device;
41extern struct mmci_platform_data realview_mmc0_plat_data; 42extern struct mmci_platform_data realview_mmc0_plat_data;
42extern struct mmci_platform_data realview_mmc1_plat_data; 43extern struct mmci_platform_data realview_mmc1_plat_data;
diff --git a/arch/arm/mach-realview/realview_eb.c b/arch/arm/mach-realview/realview_eb.c
index c85ddb2a0ad0..6bb070e80128 100644
--- a/arch/arm/mach-realview/realview_eb.c
+++ b/arch/arm/mach-realview/realview_eb.c
@@ -452,6 +452,7 @@ static void __init realview_eb_init(void)
452 realview_flash_register(&realview_eb_flash_resource, 1); 452 realview_flash_register(&realview_eb_flash_resource, 1);
453 platform_device_register(&realview_i2c_device); 453 platform_device_register(&realview_i2c_device);
454 platform_device_register(&char_lcd_device); 454 platform_device_register(&char_lcd_device);
455 platform_device_register(&realview_leds_device);
455 eth_device_register(); 456 eth_device_register();
456 realview_usb_register(realview_eb_isp1761_resources); 457 realview_usb_register(realview_eb_isp1761_resources);
457 458
diff --git a/arch/arm/mach-realview/realview_pb1176.c b/arch/arm/mach-realview/realview_pb1176.c
index c5eade76461b..173f2c15de49 100644
--- a/arch/arm/mach-realview/realview_pb1176.c
+++ b/arch/arm/mach-realview/realview_pb1176.c
@@ -367,6 +367,7 @@ static void __init realview_pb1176_init(void)
367 realview_usb_register(realview_pb1176_isp1761_resources); 367 realview_usb_register(realview_pb1176_isp1761_resources);
368 platform_device_register(&pmu_device); 368 platform_device_register(&pmu_device);
369 platform_device_register(&char_lcd_device); 369 platform_device_register(&char_lcd_device);
370 platform_device_register(&realview_leds_device);
370 371
371 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) { 372 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
372 struct amba_device *d = amba_devs[i]; 373 struct amba_device *d = amba_devs[i];
diff --git a/arch/arm/mach-realview/realview_pb11mp.c b/arch/arm/mach-realview/realview_pb11mp.c
index f4b0962578fe..bde7e6b1fd44 100644
--- a/arch/arm/mach-realview/realview_pb11mp.c
+++ b/arch/arm/mach-realview/realview_pb11mp.c
@@ -347,6 +347,7 @@ static void __init realview_pb11mp_init(void)
347 realview_eth_register(NULL, realview_pb11mp_smsc911x_resources); 347 realview_eth_register(NULL, realview_pb11mp_smsc911x_resources);
348 platform_device_register(&realview_i2c_device); 348 platform_device_register(&realview_i2c_device);
349 platform_device_register(&realview_cf_device); 349 platform_device_register(&realview_cf_device);
350 platform_device_register(&realview_leds_device);
350 realview_usb_register(realview_pb11mp_isp1761_resources); 351 realview_usb_register(realview_pb11mp_isp1761_resources);
351 platform_device_register(&pmu_device); 352 platform_device_register(&pmu_device);
352 353
diff --git a/arch/arm/mach-realview/realview_pba8.c b/arch/arm/mach-realview/realview_pba8.c
index 10a3e1d76891..4e57a8599265 100644
--- a/arch/arm/mach-realview/realview_pba8.c
+++ b/arch/arm/mach-realview/realview_pba8.c
@@ -289,6 +289,7 @@ static void __init realview_pba8_init(void)
289 realview_eth_register(NULL, realview_pba8_smsc911x_resources); 289 realview_eth_register(NULL, realview_pba8_smsc911x_resources);
290 platform_device_register(&realview_i2c_device); 290 platform_device_register(&realview_i2c_device);
291 platform_device_register(&realview_cf_device); 291 platform_device_register(&realview_cf_device);
292 platform_device_register(&realview_leds_device);
292 realview_usb_register(realview_pba8_isp1761_resources); 293 realview_usb_register(realview_pba8_isp1761_resources);
293 platform_device_register(&pmu_device); 294 platform_device_register(&pmu_device);
294 295
diff --git a/arch/arm/mach-realview/realview_pbx.c b/arch/arm/mach-realview/realview_pbx.c
index 9d75493e3f0c..72c96caebefa 100644
--- a/arch/arm/mach-realview/realview_pbx.c
+++ b/arch/arm/mach-realview/realview_pbx.c
@@ -385,6 +385,7 @@ static void __init realview_pbx_init(void)
385 realview_eth_register(NULL, realview_pbx_smsc911x_resources); 385 realview_eth_register(NULL, realview_pbx_smsc911x_resources);
386 platform_device_register(&realview_i2c_device); 386 platform_device_register(&realview_i2c_device);
387 platform_device_register(&realview_cf_device); 387 platform_device_register(&realview_cf_device);
388 platform_device_register(&realview_leds_device);
388 realview_usb_register(realview_pbx_isp1761_resources); 389 realview_usb_register(realview_pbx_isp1761_resources);
389 390
390 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) { 391 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
diff --git a/arch/arm/mach-s3c24xx/Kconfig b/arch/arm/mach-s3c24xx/Kconfig
index 40cf50b9940c..45a7026e9419 100644
--- a/arch/arm/mach-s3c24xx/Kconfig
+++ b/arch/arm/mach-s3c24xx/Kconfig
@@ -18,6 +18,18 @@ config PLAT_S3C24XX
18 help 18 help
19 Base platform code for any Samsung S3C24XX device 19 Base platform code for any Samsung S3C24XX device
20 20
21config S3C2410_COMMON_CLK
22 bool
23 help
24 Build the s3c2410 clock driver based on the common clock framework.
25
26config S3C2410_COMMON_DCLK
27 bool
28 select REGMAP_MMIO
29 help
30 Temporary symbol to build the dclk driver based on the common clock
31 framework.
32
21menu "SAMSUNG S3C24XX SoCs Support" 33menu "SAMSUNG S3C24XX SoCs Support"
22 34
23comment "S3C24XX SoCs" 35comment "S3C24XX SoCs"
@@ -25,9 +37,9 @@ comment "S3C24XX SoCs"
25config CPU_S3C2410 37config CPU_S3C2410
26 bool "SAMSUNG S3C2410" 38 bool "SAMSUNG S3C2410"
27 default y 39 default y
40 select COMMON_CLK
28 select CPU_ARM920T 41 select CPU_ARM920T
29 select CPU_LLSERIAL_S3C2410 42 select S3C2410_COMMON_CLK
30 select S3C2410_CLOCK
31 select S3C2410_DMA if S3C24XX_DMA 43 select S3C2410_DMA if S3C24XX_DMA
32 select ARM_S3C2410_CPUFREQ if ARM_S3C24XX_CPUFREQ 44 select ARM_S3C2410_CPUFREQ if ARM_S3C24XX_CPUFREQ
33 select S3C2410_PM if PM 45 select S3C2410_PM if PM
@@ -38,8 +50,9 @@ config CPU_S3C2410
38 50
39config CPU_S3C2412 51config CPU_S3C2412
40 bool "SAMSUNG S3C2412" 52 bool "SAMSUNG S3C2412"
53 select COMMON_CLK
41 select CPU_ARM926T 54 select CPU_ARM926T
42 select CPU_LLSERIAL_S3C2440 55 select S3C2412_COMMON_CLK
43 select S3C2412_DMA if S3C24XX_DMA 56 select S3C2412_DMA if S3C24XX_DMA
44 select S3C2412_PM if PM 57 select S3C2412_PM if PM
45 help 58 help
@@ -47,20 +60,19 @@ config CPU_S3C2412
47 60
48config CPU_S3C2416 61config CPU_S3C2416
49 bool "SAMSUNG S3C2416/S3C2450" 62 bool "SAMSUNG S3C2416/S3C2450"
63 select COMMON_CLK
50 select CPU_ARM926T 64 select CPU_ARM926T
51 select CPU_LLSERIAL_S3C2440
52 select S3C2416_PM if PM 65 select S3C2416_PM if PM
53 select S3C2443_COMMON 66 select S3C2443_COMMON_CLK
54 select S3C2443_DMA if S3C24XX_DMA 67 select S3C2443_DMA if S3C24XX_DMA
55 select SAMSUNG_CLKSRC
56 help 68 help
57 Support for the S3C2416 SoC from the S3C24XX line 69 Support for the S3C2416 SoC from the S3C24XX line
58 70
59config CPU_S3C2440 71config CPU_S3C2440
60 bool "SAMSUNG S3C2440" 72 bool "SAMSUNG S3C2440"
73 select COMMON_CLK
61 select CPU_ARM920T 74 select CPU_ARM920T
62 select CPU_LLSERIAL_S3C2440 75 select S3C2410_COMMON_CLK
63 select S3C2410_CLOCK
64 select S3C2410_PM if PM 76 select S3C2410_PM if PM
65 select S3C2440_DMA if S3C24XX_DMA 77 select S3C2440_DMA if S3C24XX_DMA
66 help 78 help
@@ -68,9 +80,9 @@ config CPU_S3C2440
68 80
69config CPU_S3C2442 81config CPU_S3C2442
70 bool "SAMSUNG S3C2442" 82 bool "SAMSUNG S3C2442"
83 select COMMON_CLK
71 select CPU_ARM920T 84 select CPU_ARM920T
72 select CPU_LLSERIAL_S3C2440 85 select S3C2410_COMMON_CLK
73 select S3C2410_CLOCK
74 select S3C2410_DMA if S3C24XX_DMA 86 select S3C2410_DMA if S3C24XX_DMA
75 select S3C2410_PM if PM 87 select S3C2410_PM if PM
76 help 88 help
@@ -83,27 +95,15 @@ config CPU_S3C244X
83 95
84config CPU_S3C2443 96config CPU_S3C2443
85 bool "SAMSUNG S3C2443" 97 bool "SAMSUNG S3C2443"
98 select COMMON_CLK
86 select CPU_ARM920T 99 select CPU_ARM920T
87 select CPU_LLSERIAL_S3C2440 100 select S3C2443_COMMON_CLK
88 select S3C2443_COMMON
89 select S3C2443_DMA if S3C24XX_DMA 101 select S3C2443_DMA if S3C24XX_DMA
90 select SAMSUNG_CLKSRC
91 help 102 help
92 Support for the S3C2443 SoC from the S3C24XX line 103 Support for the S3C2443 SoC from the S3C24XX line
93 104
94# common code 105# common code
95 106
96config S3C2410_CLOCK
97 bool
98 help
99 Clock code for the S3C2410, and similar processors which
100 is currently includes the S3C2410, S3C2440, S3C2442.
101
102config S3C24XX_DCLK
103 bool
104 help
105 Clock code for supporting DCLK/CLKOUT on S3C24XX architectures
106
107config S3C24XX_SMDK 107config S3C24XX_SMDK
108 bool 108 bool
109 help 109 help
@@ -158,28 +158,6 @@ config S3C2410_PM
158 help 158 help
159 Power Management code common to S3C2410 and better 159 Power Management code common to S3C2410 and better
160 160
161# low-level serial option nodes
162
163config CPU_LLSERIAL_S3C2410_ONLY
164 bool
165 default y if CPU_LLSERIAL_S3C2410 && !CPU_LLSERIAL_S3C2440
166
167config CPU_LLSERIAL_S3C2440_ONLY
168 bool
169 default y if CPU_LLSERIAL_S3C2440 && !CPU_LLSERIAL_S3C2410
170
171config CPU_LLSERIAL_S3C2410
172 bool
173 help
174 Selected if there is an S3C2410 (or register compatible) serial
175 low-level implementation needed
176
177config CPU_LLSERIAL_S3C2440
178 bool
179 help
180 Selected if there is an S3C2440 (or register compatible) serial
181 low-level implementation needed
182
183config S3C24XX_PLL 161config S3C24XX_PLL
184 bool "Support CPUfreq changing of PLL frequency (EXPERIMENTAL)" 162 bool "Support CPUfreq changing of PLL frequency (EXPERIMENTAL)"
185 depends on ARM_S3C24XX_CPUFREQ 163 depends on ARM_S3C24XX_CPUFREQ
@@ -258,8 +236,8 @@ config ARCH_BAST
258 bool "Simtec Electronics BAST (EB2410ITX)" 236 bool "Simtec Electronics BAST (EB2410ITX)"
259 select ISA 237 select ISA
260 select MACH_BAST_IDE 238 select MACH_BAST_IDE
239 select S3C2410_COMMON_DCLK if COMMON_CLK
261 select S3C2410_IOTIMING if ARM_S3C2410_CPUFREQ 240 select S3C2410_IOTIMING if ARM_S3C2410_CPUFREQ
262 select S3C24XX_DCLK
263 select S3C24XX_SIMTEC_NOR 241 select S3C24XX_SIMTEC_NOR
264 select S3C24XX_SIMTEC_PM if PM 242 select S3C24XX_SIMTEC_PM if PM
265 select S3C24XX_SIMTEC_USB 243 select S3C24XX_SIMTEC_USB
@@ -340,7 +318,7 @@ config MACH_TCT_HAMMER
340config MACH_VR1000 318config MACH_VR1000
341 bool "Thorcom VR1000" 319 bool "Thorcom VR1000"
342 select MACH_BAST_IDE 320 select MACH_BAST_IDE
343 select S3C24XX_DCLK 321 select S3C2410_COMMON_DCLK if COMMON_CLK
344 select S3C24XX_SIMTEC_NOR 322 select S3C24XX_SIMTEC_NOR
345 select S3C24XX_SIMTEC_PM if PM 323 select S3C24XX_SIMTEC_PM if PM
346 select S3C24XX_SIMTEC_USB 324 select S3C24XX_SIMTEC_USB
@@ -359,6 +337,11 @@ config S3C2412_PM_SLEEP
359 337
360if CPU_S3C2412 338if CPU_S3C2412
361 339
340config S3C2412_COMMON_CLK
341 bool
342 help
343 Build the s3c2412 clock driver based on the common clock framework.
344
362config CPU_S3C2412_ONLY 345config CPU_S3C2412_ONLY
363 bool 346 bool
364 depends on !CPU_S3C2410 && !CPU_S3C2416 && !CPU_S3C2440 && \ 347 depends on !CPU_S3C2410 && !CPU_S3C2416 && !CPU_S3C2440 && \
@@ -519,8 +502,8 @@ comment "S3C2440 Boards"
519config MACH_ANUBIS 502config MACH_ANUBIS
520 bool "Simtec Electronics ANUBIS" 503 bool "Simtec Electronics ANUBIS"
521 select HAVE_PATA_PLATFORM 504 select HAVE_PATA_PLATFORM
505 select S3C2410_COMMON_DCLK if COMMON_CLK
522 select S3C2440_XTAL_12000000 506 select S3C2440_XTAL_12000000
523 select S3C24XX_DCLK
524 select S3C24XX_SIMTEC_PM if PM 507 select S3C24XX_SIMTEC_PM if PM
525 select S3C_DEV_USB_HOST 508 select S3C_DEV_USB_HOST
526 help 509 help
@@ -558,9 +541,9 @@ config MACH_NEXCODER_2440
558 541
559config MACH_OSIRIS 542config MACH_OSIRIS
560 bool "Simtec IM2440D20 (OSIRIS) module" 543 bool "Simtec IM2440D20 (OSIRIS) module"
544 select S3C2410_COMMON_DCLK if COMMON_CLK
561 select S3C2410_IOTIMING if ARM_S3C2440_CPUFREQ 545 select S3C2410_IOTIMING if ARM_S3C2440_CPUFREQ
562 select S3C2440_XTAL_12000000 546 select S3C2440_XTAL_12000000
563 select S3C24XX_DCLK
564 select S3C24XX_SIMTEC_PM if PM 547 select S3C24XX_SIMTEC_PM if PM
565 select S3C_DEV_NAND 548 select S3C_DEV_NAND
566 select S3C_DEV_USB_HOST 549 select S3C_DEV_USB_HOST
@@ -629,9 +612,9 @@ config MACH_RX1950
629 bool "HP iPAQ rx1950" 612 bool "HP iPAQ rx1950"
630 select I2C 613 select I2C
631 select PM_H1940 if PM 614 select PM_H1940 if PM
615 select S3C2410_COMMON_DCLK if COMMON_CLK
632 select S3C2410_IOTIMING if ARM_S3C2440_CPUFREQ 616 select S3C2410_IOTIMING if ARM_S3C2440_CPUFREQ
633 select S3C2440_XTAL_16934400 617 select S3C2440_XTAL_16934400
634 select S3C24XX_DCLK
635 select S3C24XX_PWM 618 select S3C24XX_PWM
636 select S3C_DEV_NAND 619 select S3C_DEV_NAND
637 help 620 help
@@ -641,11 +624,11 @@ endif # CPU_S3C2442
641 624
642if CPU_S3C2443 || CPU_S3C2416 625if CPU_S3C2443 || CPU_S3C2416
643 626
644config S3C2443_COMMON 627config S3C2443_COMMON_CLK
645 bool 628 bool
646 help 629 help
647 Common code for the S3C2443 and similar processors, which includes 630 Temporary symbol to build the clock driver based on the common clock
648 the S3C2416 and S3C2450. 631 framework.
649 632
650config S3C2443_DMA 633config S3C2443_DMA
651 bool 634 bool
diff --git a/arch/arm/mach-s3c24xx/Makefile b/arch/arm/mach-s3c24xx/Makefile
index 7f54e5b954ca..2235d0d3b38d 100644
--- a/arch/arm/mach-s3c24xx/Makefile
+++ b/arch/arm/mach-s3c24xx/Makefile
@@ -21,22 +21,22 @@ obj-$(CONFIG_S3C2410_DMA) += dma-s3c2410.o
21obj-$(CONFIG_S3C2410_PLL) += pll-s3c2410.o 21obj-$(CONFIG_S3C2410_PLL) += pll-s3c2410.o
22obj-$(CONFIG_S3C2410_PM) += pm-s3c2410.o sleep-s3c2410.o 22obj-$(CONFIG_S3C2410_PM) += pm-s3c2410.o sleep-s3c2410.o
23 23
24obj-$(CONFIG_CPU_S3C2412) += s3c2412.o clock-s3c2412.o 24obj-$(CONFIG_CPU_S3C2412) += s3c2412.o
25obj-$(CONFIG_S3C2412_DMA) += dma-s3c2412.o 25obj-$(CONFIG_S3C2412_DMA) += dma-s3c2412.o
26obj-$(CONFIG_S3C2412_PM) += pm-s3c2412.o 26obj-$(CONFIG_S3C2412_PM) += pm-s3c2412.o
27obj-$(CONFIG_S3C2412_PM_SLEEP) += sleep-s3c2412.o 27obj-$(CONFIG_S3C2412_PM_SLEEP) += sleep-s3c2412.o
28 28
29obj-$(CONFIG_CPU_S3C2416) += s3c2416.o clock-s3c2416.o 29obj-$(CONFIG_CPU_S3C2416) += s3c2416.o
30obj-$(CONFIG_S3C2416_PM) += pm-s3c2416.o 30obj-$(CONFIG_S3C2416_PM) += pm-s3c2416.o
31 31
32obj-$(CONFIG_CPU_S3C2440) += s3c2440.o clock-s3c2440.o 32obj-$(CONFIG_CPU_S3C2440) += s3c2440.o
33obj-$(CONFIG_CPU_S3C2442) += s3c2442.o 33obj-$(CONFIG_CPU_S3C2442) += s3c2442.o
34obj-$(CONFIG_CPU_S3C244X) += s3c244x.o clock-s3c244x.o 34obj-$(CONFIG_CPU_S3C244X) += s3c244x.o
35obj-$(CONFIG_S3C2440_DMA) += dma-s3c2440.o 35obj-$(CONFIG_S3C2440_DMA) += dma-s3c2440.o
36obj-$(CONFIG_S3C2440_PLL_12000000) += pll-s3c2440-12000000.o 36obj-$(CONFIG_S3C2440_PLL_12000000) += pll-s3c2440-12000000.o
37obj-$(CONFIG_S3C2440_PLL_16934400) += pll-s3c2440-16934400.o 37obj-$(CONFIG_S3C2440_PLL_16934400) += pll-s3c2440-16934400.o
38 38
39obj-$(CONFIG_CPU_S3C2443) += s3c2443.o clock-s3c2443.o 39obj-$(CONFIG_CPU_S3C2443) += s3c2443.o
40 40
41# PM 41# PM
42 42
@@ -44,16 +44,13 @@ obj-$(CONFIG_PM) += pm.o irq-pm.o sleep.o
44 44
45# common code 45# common code
46 46
47obj-$(CONFIG_S3C24XX_DCLK) += clock-dclk.o
48obj-$(CONFIG_S3C24XX_DMA) += dma.o 47obj-$(CONFIG_S3C24XX_DMA) += dma.o
49 48
50obj-$(CONFIG_S3C2410_CLOCK) += clock-s3c2410.o
51obj-$(CONFIG_S3C2410_CPUFREQ_UTILS) += cpufreq-utils.o 49obj-$(CONFIG_S3C2410_CPUFREQ_UTILS) += cpufreq-utils.o
52 50
53obj-$(CONFIG_S3C2410_IOTIMING) += iotiming-s3c2410.o 51obj-$(CONFIG_S3C2410_IOTIMING) += iotiming-s3c2410.o
54obj-$(CONFIG_S3C2412_IOTIMING) += iotiming-s3c2412.o 52obj-$(CONFIG_S3C2412_IOTIMING) += iotiming-s3c2412.o
55 53
56obj-$(CONFIG_S3C2443_COMMON) += common-s3c2443.o
57obj-$(CONFIG_S3C2443_DMA) += dma-s3c2443.o 54obj-$(CONFIG_S3C2443_DMA) += dma-s3c2443.o
58 55
59# 56#
diff --git a/arch/arm/mach-s3c24xx/clock-dclk.c b/arch/arm/mach-s3c24xx/clock-dclk.c
deleted file mode 100644
index 1edd9b2369c5..000000000000
--- a/arch/arm/mach-s3c24xx/clock-dclk.c
+++ /dev/null
@@ -1,195 +0,0 @@
1/*
2 * Copyright (c) 2004-2008 Simtec Electronics
3 * Ben Dooks <ben@simtec.co.uk>
4 * http://armlinux.simtec.co.uk/
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 *
10 * S3C24XX - definitions for DCLK and CLKOUT registers
11 */
12
13#include <linux/kernel.h>
14#include <linux/errno.h>
15#include <linux/clk.h>
16#include <linux/io.h>
17
18#include <mach/regs-clock.h>
19#include <mach/regs-gpio.h>
20
21#include <plat/clock.h>
22#include <plat/cpu.h>
23
24/* clocks that could be registered by external code */
25
26static int s3c24xx_dclk_enable(struct clk *clk, int enable)
27{
28 unsigned long dclkcon = __raw_readl(S3C24XX_DCLKCON);
29
30 if (enable)
31 dclkcon |= clk->ctrlbit;
32 else
33 dclkcon &= ~clk->ctrlbit;
34
35 __raw_writel(dclkcon, S3C24XX_DCLKCON);
36
37 return 0;
38}
39
40static int s3c24xx_dclk_setparent(struct clk *clk, struct clk *parent)
41{
42 unsigned long dclkcon;
43 unsigned int uclk;
44
45 if (parent == &clk_upll)
46 uclk = 1;
47 else if (parent == &clk_p)
48 uclk = 0;
49 else
50 return -EINVAL;
51
52 clk->parent = parent;
53
54 dclkcon = __raw_readl(S3C24XX_DCLKCON);
55
56 if (clk->ctrlbit == S3C2410_DCLKCON_DCLK0EN) {
57 if (uclk)
58 dclkcon |= S3C2410_DCLKCON_DCLK0_UCLK;
59 else
60 dclkcon &= ~S3C2410_DCLKCON_DCLK0_UCLK;
61 } else {
62 if (uclk)
63 dclkcon |= S3C2410_DCLKCON_DCLK1_UCLK;
64 else
65 dclkcon &= ~S3C2410_DCLKCON_DCLK1_UCLK;
66 }
67
68 __raw_writel(dclkcon, S3C24XX_DCLKCON);
69
70 return 0;
71}
72static unsigned long s3c24xx_calc_div(struct clk *clk, unsigned long rate)
73{
74 unsigned long div;
75
76 if ((rate == 0) || !clk->parent)
77 return 0;
78
79 div = clk_get_rate(clk->parent) / rate;
80 if (div < 2)
81 div = 2;
82 else if (div > 16)
83 div = 16;
84
85 return div;
86}
87
88static unsigned long s3c24xx_round_dclk_rate(struct clk *clk,
89 unsigned long rate)
90{
91 unsigned long div = s3c24xx_calc_div(clk, rate);
92
93 if (div == 0)
94 return 0;
95
96 return clk_get_rate(clk->parent) / div;
97}
98
99static int s3c24xx_set_dclk_rate(struct clk *clk, unsigned long rate)
100{
101 unsigned long mask, data, div = s3c24xx_calc_div(clk, rate);
102
103 if (div == 0)
104 return -EINVAL;
105
106 if (clk == &s3c24xx_dclk0) {
107 mask = S3C2410_DCLKCON_DCLK0_DIV_MASK |
108 S3C2410_DCLKCON_DCLK0_CMP_MASK;
109 data = S3C2410_DCLKCON_DCLK0_DIV(div) |
110 S3C2410_DCLKCON_DCLK0_CMP((div + 1) / 2);
111 } else if (clk == &s3c24xx_dclk1) {
112 mask = S3C2410_DCLKCON_DCLK1_DIV_MASK |
113 S3C2410_DCLKCON_DCLK1_CMP_MASK;
114 data = S3C2410_DCLKCON_DCLK1_DIV(div) |
115 S3C2410_DCLKCON_DCLK1_CMP((div + 1) / 2);
116 } else
117 return -EINVAL;
118
119 clk->rate = clk_get_rate(clk->parent) / div;
120 __raw_writel(((__raw_readl(S3C24XX_DCLKCON) & ~mask) | data),
121 S3C24XX_DCLKCON);
122 return clk->rate;
123}
124static int s3c24xx_clkout_setparent(struct clk *clk, struct clk *parent)
125{
126 unsigned long mask;
127 unsigned long source;
128
129 /* calculate the MISCCR setting for the clock */
130
131 if (parent == &clk_mpll)
132 source = S3C2410_MISCCR_CLK0_MPLL;
133 else if (parent == &clk_upll)
134 source = S3C2410_MISCCR_CLK0_UPLL;
135 else if (parent == &clk_f)
136 source = S3C2410_MISCCR_CLK0_FCLK;
137 else if (parent == &clk_h)
138 source = S3C2410_MISCCR_CLK0_HCLK;
139 else if (parent == &clk_p)
140 source = S3C2410_MISCCR_CLK0_PCLK;
141 else if (clk == &s3c24xx_clkout0 && parent == &s3c24xx_dclk0)
142 source = S3C2410_MISCCR_CLK0_DCLK0;
143 else if (clk == &s3c24xx_clkout1 && parent == &s3c24xx_dclk1)
144 source = S3C2410_MISCCR_CLK0_DCLK0;
145 else
146 return -EINVAL;
147
148 clk->parent = parent;
149
150 if (clk == &s3c24xx_clkout0)
151 mask = S3C2410_MISCCR_CLK0_MASK;
152 else {
153 source <<= 4;
154 mask = S3C2410_MISCCR_CLK1_MASK;
155 }
156
157 s3c2410_modify_misccr(mask, source);
158 return 0;
159}
160
161/* external clock definitions */
162
163static struct clk_ops dclk_ops = {
164 .set_parent = s3c24xx_dclk_setparent,
165 .set_rate = s3c24xx_set_dclk_rate,
166 .round_rate = s3c24xx_round_dclk_rate,
167};
168
169struct clk s3c24xx_dclk0 = {
170 .name = "dclk0",
171 .ctrlbit = S3C2410_DCLKCON_DCLK0EN,
172 .enable = s3c24xx_dclk_enable,
173 .ops = &dclk_ops,
174};
175
176struct clk s3c24xx_dclk1 = {
177 .name = "dclk1",
178 .ctrlbit = S3C2410_DCLKCON_DCLK1EN,
179 .enable = s3c24xx_dclk_enable,
180 .ops = &dclk_ops,
181};
182
183static struct clk_ops clkout_ops = {
184 .set_parent = s3c24xx_clkout_setparent,
185};
186
187struct clk s3c24xx_clkout0 = {
188 .name = "clkout0",
189 .ops = &clkout_ops,
190};
191
192struct clk s3c24xx_clkout1 = {
193 .name = "clkout1",
194 .ops = &clkout_ops,
195};
diff --git a/arch/arm/mach-s3c24xx/clock-s3c2410.c b/arch/arm/mach-s3c24xx/clock-s3c2410.c
deleted file mode 100644
index d1afcf9252d1..000000000000
--- a/arch/arm/mach-s3c24xx/clock-s3c2410.c
+++ /dev/null
@@ -1,284 +0,0 @@
1/*
2 * Copyright (c) 2006 Simtec Electronics
3 * Ben Dooks <ben@simtec.co.uk>
4 *
5 * S3C2410,S3C2440,S3C2442 Clock control support
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20*/
21
22#include <linux/init.h>
23#include <linux/module.h>
24#include <linux/kernel.h>
25#include <linux/list.h>
26#include <linux/errno.h>
27#include <linux/err.h>
28#include <linux/device.h>
29#include <linux/clk.h>
30#include <linux/mutex.h>
31#include <linux/delay.h>
32#include <linux/serial_core.h>
33#include <linux/serial_s3c.h>
34#include <linux/io.h>
35
36#include <asm/mach/map.h>
37
38#include <mach/hardware.h>
39#include <mach/regs-clock.h>
40#include <mach/regs-gpio.h>
41
42#include <plat/clock.h>
43#include <plat/cpu.h>
44
45int s3c2410_clkcon_enable(struct clk *clk, int enable)
46{
47 unsigned int clocks = clk->ctrlbit;
48 unsigned long clkcon;
49
50 clkcon = __raw_readl(S3C2410_CLKCON);
51
52 if (enable)
53 clkcon |= clocks;
54 else
55 clkcon &= ~clocks;
56
57 /* ensure none of the special function bits set */
58 clkcon &= ~(S3C2410_CLKCON_IDLE|S3C2410_CLKCON_POWER);
59
60 __raw_writel(clkcon, S3C2410_CLKCON);
61
62 return 0;
63}
64
65static int s3c2410_upll_enable(struct clk *clk, int enable)
66{
67 unsigned long clkslow = __raw_readl(S3C2410_CLKSLOW);
68 unsigned long orig = clkslow;
69
70 if (enable)
71 clkslow &= ~S3C2410_CLKSLOW_UCLK_OFF;
72 else
73 clkslow |= S3C2410_CLKSLOW_UCLK_OFF;
74
75 __raw_writel(clkslow, S3C2410_CLKSLOW);
76
77 /* if we started the UPLL, then allow to settle */
78
79 if (enable && (orig & S3C2410_CLKSLOW_UCLK_OFF))
80 udelay(200);
81
82 return 0;
83}
84
85/* standard clock definitions */
86
87static struct clk init_clocks_off[] = {
88 {
89 .name = "nand",
90 .parent = &clk_h,
91 .enable = s3c2410_clkcon_enable,
92 .ctrlbit = S3C2410_CLKCON_NAND,
93 }, {
94 .name = "sdi",
95 .parent = &clk_p,
96 .enable = s3c2410_clkcon_enable,
97 .ctrlbit = S3C2410_CLKCON_SDI,
98 }, {
99 .name = "adc",
100 .parent = &clk_p,
101 .enable = s3c2410_clkcon_enable,
102 .ctrlbit = S3C2410_CLKCON_ADC,
103 }, {
104 .name = "i2c",
105 .parent = &clk_p,
106 .enable = s3c2410_clkcon_enable,
107 .ctrlbit = S3C2410_CLKCON_IIC,
108 }, {
109 .name = "iis",
110 .parent = &clk_p,
111 .enable = s3c2410_clkcon_enable,
112 .ctrlbit = S3C2410_CLKCON_IIS,
113 }, {
114 .name = "spi",
115 .parent = &clk_p,
116 .enable = s3c2410_clkcon_enable,
117 .ctrlbit = S3C2410_CLKCON_SPI,
118 }
119};
120
121static struct clk clk_lcd = {
122 .name = "lcd",
123 .parent = &clk_h,
124 .enable = s3c2410_clkcon_enable,
125 .ctrlbit = S3C2410_CLKCON_LCDC,
126};
127
128static struct clk clk_gpio = {
129 .name = "gpio",
130 .parent = &clk_p,
131 .enable = s3c2410_clkcon_enable,
132 .ctrlbit = S3C2410_CLKCON_GPIO,
133};
134
135static struct clk clk_usb_host = {
136 .name = "usb-host",
137 .parent = &clk_h,
138 .enable = s3c2410_clkcon_enable,
139 .ctrlbit = S3C2410_CLKCON_USBH,
140};
141
142static struct clk clk_usb_device = {
143 .name = "usb-device",
144 .parent = &clk_h,
145 .enable = s3c2410_clkcon_enable,
146 .ctrlbit = S3C2410_CLKCON_USBD,
147};
148
149static struct clk clk_timers = {
150 .name = "timers",
151 .parent = &clk_p,
152 .enable = s3c2410_clkcon_enable,
153 .ctrlbit = S3C2410_CLKCON_PWMT,
154};
155
156struct clk s3c24xx_clk_uart0 = {
157 .name = "uart",
158 .devname = "s3c2410-uart.0",
159 .parent = &clk_p,
160 .enable = s3c2410_clkcon_enable,
161 .ctrlbit = S3C2410_CLKCON_UART0,
162};
163
164struct clk s3c24xx_clk_uart1 = {
165 .name = "uart",
166 .devname = "s3c2410-uart.1",
167 .parent = &clk_p,
168 .enable = s3c2410_clkcon_enable,
169 .ctrlbit = S3C2410_CLKCON_UART1,
170};
171
172struct clk s3c24xx_clk_uart2 = {
173 .name = "uart",
174 .devname = "s3c2410-uart.2",
175 .parent = &clk_p,
176 .enable = s3c2410_clkcon_enable,
177 .ctrlbit = S3C2410_CLKCON_UART2,
178};
179
180static struct clk clk_rtc = {
181 .name = "rtc",
182 .parent = &clk_p,
183 .enable = s3c2410_clkcon_enable,
184 .ctrlbit = S3C2410_CLKCON_RTC,
185};
186
187static struct clk clk_watchdog = {
188 .name = "watchdog",
189 .parent = &clk_p,
190 .ctrlbit = 0,
191};
192
193static struct clk clk_usb_bus_host = {
194 .name = "usb-bus-host",
195 .parent = &clk_usb_bus,
196};
197
198static struct clk clk_usb_bus_gadget = {
199 .name = "usb-bus-gadget",
200 .parent = &clk_usb_bus,
201};
202
203static struct clk *init_clocks[] = {
204 &clk_lcd,
205 &clk_gpio,
206 &clk_usb_host,
207 &clk_usb_device,
208 &clk_timers,
209 &s3c24xx_clk_uart0,
210 &s3c24xx_clk_uart1,
211 &s3c24xx_clk_uart2,
212 &clk_rtc,
213 &clk_watchdog,
214 &clk_usb_bus_host,
215 &clk_usb_bus_gadget,
216};
217
218/* s3c2410_baseclk_add()
219 *
220 * Add all the clocks used by the s3c2410 or compatible CPUs
221 * such as the S3C2440 and S3C2442.
222 *
223 * We cannot use a system device as we are needed before any
224 * of the init-calls that initialise the devices are actually
225 * done.
226*/
227
228int __init s3c2410_baseclk_add(void)
229{
230 unsigned long clkslow = __raw_readl(S3C2410_CLKSLOW);
231 unsigned long clkcon = __raw_readl(S3C2410_CLKCON);
232 struct clk *xtal;
233 int ret;
234 int ptr;
235
236 clk_upll.enable = s3c2410_upll_enable;
237
238 if (s3c24xx_register_clock(&clk_usb_bus) < 0)
239 printk(KERN_ERR "failed to register usb bus clock\n");
240
241 /* register clocks from clock array */
242
243 for (ptr = 0; ptr < ARRAY_SIZE(init_clocks); ptr++) {
244 struct clk *clkp = init_clocks[ptr];
245
246 /* ensure that we note the clock state */
247
248 clkp->usage = clkcon & clkp->ctrlbit ? 1 : 0;
249
250 ret = s3c24xx_register_clock(clkp);
251 if (ret < 0) {
252 printk(KERN_ERR "Failed to register clock %s (%d)\n",
253 clkp->name, ret);
254 }
255 }
256
257 /* We must be careful disabling the clocks we are not intending to
258 * be using at boot time, as subsystems such as the LCD which do
259 * their own DMA requests to the bus can cause the system to lockup
260 * if they where in the middle of requesting bus access.
261 *
262 * Disabling the LCD clock if the LCD is active is very dangerous,
263 * and therefore the bootloader should be careful to not enable
264 * the LCD clock if it is not needed.
265 */
266
267 /* install (and disable) the clocks we do not need immediately */
268
269 s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
270 s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
271
272 /* show the clock-slow value */
273
274 xtal = clk_get(NULL, "xtal");
275
276 printk("CLOCK: Slow mode (%ld.%ld MHz), %s, MPLL %s, UPLL %s\n",
277 print_mhz(clk_get_rate(xtal) /
278 ( 2 * S3C2410_CLKSLOW_GET_SLOWVAL(clkslow))),
279 (clkslow & S3C2410_CLKSLOW_SLOW) ? "slow" : "fast",
280 (clkslow & S3C2410_CLKSLOW_MPLL_OFF) ? "off" : "on",
281 (clkslow & S3C2410_CLKSLOW_UCLK_OFF) ? "off" : "on");
282
283 return 0;
284}
diff --git a/arch/arm/mach-s3c24xx/clock-s3c2412.c b/arch/arm/mach-s3c24xx/clock-s3c2412.c
deleted file mode 100644
index 192a5b2550b0..000000000000
--- a/arch/arm/mach-s3c24xx/clock-s3c2412.c
+++ /dev/null
@@ -1,760 +0,0 @@
1/* linux/arch/arm/mach-s3c2412/clock.c
2 *
3 * Copyright (c) 2006 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * S3C2412,S3C2413 Clock control support
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21*/
22
23#include <linux/init.h>
24#include <linux/module.h>
25#include <linux/kernel.h>
26#include <linux/list.h>
27#include <linux/errno.h>
28#include <linux/err.h>
29#include <linux/device.h>
30#include <linux/clk.h>
31#include <linux/mutex.h>
32#include <linux/delay.h>
33#include <linux/serial_core.h>
34#include <linux/serial_s3c.h>
35#include <linux/io.h>
36
37#include <asm/mach/map.h>
38
39#include <mach/hardware.h>
40#include <mach/regs-clock.h>
41#include <mach/regs-gpio.h>
42
43#include <plat/clock.h>
44#include <plat/cpu.h>
45
46/* We currently have to assume that the system is running
47 * from the XTPll input, and that all ***REFCLKs are being
48 * fed from it, as we cannot read the state of OM[4] from
49 * software.
50 *
51 * It would be possible for each board initialisation to
52 * set the correct muxing at initialisation
53*/
54
55static int s3c2412_clkcon_enable(struct clk *clk, int enable)
56{
57 unsigned int clocks = clk->ctrlbit;
58 unsigned long clkcon;
59
60 clkcon = __raw_readl(S3C2410_CLKCON);
61
62 if (enable)
63 clkcon |= clocks;
64 else
65 clkcon &= ~clocks;
66
67 __raw_writel(clkcon, S3C2410_CLKCON);
68
69 return 0;
70}
71
72static int s3c2412_upll_enable(struct clk *clk, int enable)
73{
74 unsigned long upllcon = __raw_readl(S3C2410_UPLLCON);
75 unsigned long orig = upllcon;
76
77 if (!enable)
78 upllcon |= S3C2412_PLLCON_OFF;
79 else
80 upllcon &= ~S3C2412_PLLCON_OFF;
81
82 __raw_writel(upllcon, S3C2410_UPLLCON);
83
84 /* allow ~150uS for the PLL to settle and lock */
85
86 if (enable && (orig & S3C2412_PLLCON_OFF))
87 udelay(150);
88
89 return 0;
90}
91
92/* clock selections */
93
94static struct clk clk_erefclk = {
95 .name = "erefclk",
96};
97
98static struct clk clk_urefclk = {
99 .name = "urefclk",
100};
101
102static int s3c2412_setparent_usysclk(struct clk *clk, struct clk *parent)
103{
104 unsigned long clksrc = __raw_readl(S3C2412_CLKSRC);
105
106 if (parent == &clk_urefclk)
107 clksrc &= ~S3C2412_CLKSRC_USYSCLK_UPLL;
108 else if (parent == &clk_upll)
109 clksrc |= S3C2412_CLKSRC_USYSCLK_UPLL;
110 else
111 return -EINVAL;
112
113 clk->parent = parent;
114
115 __raw_writel(clksrc, S3C2412_CLKSRC);
116 return 0;
117}
118
119static struct clk clk_usysclk = {
120 .name = "usysclk",
121 .parent = &clk_xtal,
122 .ops = &(struct clk_ops) {
123 .set_parent = s3c2412_setparent_usysclk,
124 },
125};
126
127static struct clk clk_mrefclk = {
128 .name = "mrefclk",
129 .parent = &clk_xtal,
130};
131
132static struct clk clk_mdivclk = {
133 .name = "mdivclk",
134 .parent = &clk_xtal,
135};
136
137static int s3c2412_setparent_usbsrc(struct clk *clk, struct clk *parent)
138{
139 unsigned long clksrc = __raw_readl(S3C2412_CLKSRC);
140
141 if (parent == &clk_usysclk)
142 clksrc &= ~S3C2412_CLKSRC_USBCLK_HCLK;
143 else if (parent == &clk_h)
144 clksrc |= S3C2412_CLKSRC_USBCLK_HCLK;
145 else
146 return -EINVAL;
147
148 clk->parent = parent;
149
150 __raw_writel(clksrc, S3C2412_CLKSRC);
151 return 0;
152}
153
154static unsigned long s3c2412_roundrate_usbsrc(struct clk *clk,
155 unsigned long rate)
156{
157 unsigned long parent_rate = clk_get_rate(clk->parent);
158 int div;
159
160 if (rate > parent_rate)
161 return parent_rate;
162
163 div = parent_rate / rate;
164 if (div > 2)
165 div = 2;
166
167 return parent_rate / div;
168}
169
170static unsigned long s3c2412_getrate_usbsrc(struct clk *clk)
171{
172 unsigned long parent_rate = clk_get_rate(clk->parent);
173 unsigned long div = __raw_readl(S3C2410_CLKDIVN);
174
175 return parent_rate / ((div & S3C2412_CLKDIVN_USB48DIV) ? 2 : 1);
176}
177
178static int s3c2412_setrate_usbsrc(struct clk *clk, unsigned long rate)
179{
180 unsigned long parent_rate = clk_get_rate(clk->parent);
181 unsigned long clkdivn = __raw_readl(S3C2410_CLKDIVN);
182
183 rate = s3c2412_roundrate_usbsrc(clk, rate);
184
185 if ((parent_rate / rate) == 2)
186 clkdivn |= S3C2412_CLKDIVN_USB48DIV;
187 else
188 clkdivn &= ~S3C2412_CLKDIVN_USB48DIV;
189
190 __raw_writel(clkdivn, S3C2410_CLKDIVN);
191 return 0;
192}
193
194static struct clk clk_usbsrc = {
195 .name = "usbsrc",
196 .ops = &(struct clk_ops) {
197 .get_rate = s3c2412_getrate_usbsrc,
198 .set_rate = s3c2412_setrate_usbsrc,
199 .round_rate = s3c2412_roundrate_usbsrc,
200 .set_parent = s3c2412_setparent_usbsrc,
201 },
202};
203
204static int s3c2412_setparent_msysclk(struct clk *clk, struct clk *parent)
205{
206 unsigned long clksrc = __raw_readl(S3C2412_CLKSRC);
207
208 if (parent == &clk_mdivclk)
209 clksrc &= ~S3C2412_CLKSRC_MSYSCLK_MPLL;
210 else if (parent == &clk_mpll)
211 clksrc |= S3C2412_CLKSRC_MSYSCLK_MPLL;
212 else
213 return -EINVAL;
214
215 clk->parent = parent;
216
217 __raw_writel(clksrc, S3C2412_CLKSRC);
218 return 0;
219}
220
221static struct clk clk_msysclk = {
222 .name = "msysclk",
223 .ops = &(struct clk_ops) {
224 .set_parent = s3c2412_setparent_msysclk,
225 },
226};
227
228static int s3c2412_setparent_armclk(struct clk *clk, struct clk *parent)
229{
230 unsigned long flags;
231 unsigned long clkdiv;
232 unsigned long dvs;
233
234 /* Note, we current equate fclk andf msysclk for S3C2412 */
235
236 if (parent == &clk_msysclk || parent == &clk_f)
237 dvs = 0;
238 else if (parent == &clk_h)
239 dvs = S3C2412_CLKDIVN_DVSEN;
240 else
241 return -EINVAL;
242
243 clk->parent = parent;
244
245 /* update this under irq lockdown, clkdivn is not protected
246 * by the clock system. */
247
248 local_irq_save(flags);
249
250 clkdiv = __raw_readl(S3C2410_CLKDIVN);
251 clkdiv &= ~S3C2412_CLKDIVN_DVSEN;
252 clkdiv |= dvs;
253 __raw_writel(clkdiv, S3C2410_CLKDIVN);
254
255 local_irq_restore(flags);
256
257 return 0;
258}
259
260static struct clk clk_armclk = {
261 .name = "armclk",
262 .parent = &clk_msysclk,
263 .ops = &(struct clk_ops) {
264 .set_parent = s3c2412_setparent_armclk,
265 },
266};
267
268/* these next clocks have an divider immediately after them,
269 * so we can register them with their divider and leave out the
270 * intermediate clock stage
271*/
272static unsigned long s3c2412_roundrate_clksrc(struct clk *clk,
273 unsigned long rate)
274{
275 unsigned long parent_rate = clk_get_rate(clk->parent);
276 int div;
277
278 if (rate > parent_rate)
279 return parent_rate;
280
281 /* note, we remove the +/- 1 calculations as they cancel out */
282
283 div = (rate / parent_rate);
284
285 if (div < 1)
286 div = 1;
287 else if (div > 16)
288 div = 16;
289
290 return parent_rate / div;
291}
292
293static int s3c2412_setparent_uart(struct clk *clk, struct clk *parent)
294{
295 unsigned long clksrc = __raw_readl(S3C2412_CLKSRC);
296
297 if (parent == &clk_erefclk)
298 clksrc &= ~S3C2412_CLKSRC_UARTCLK_MPLL;
299 else if (parent == &clk_mpll)
300 clksrc |= S3C2412_CLKSRC_UARTCLK_MPLL;
301 else
302 return -EINVAL;
303
304 clk->parent = parent;
305
306 __raw_writel(clksrc, S3C2412_CLKSRC);
307 return 0;
308}
309
310static unsigned long s3c2412_getrate_uart(struct clk *clk)
311{
312 unsigned long parent_rate = clk_get_rate(clk->parent);
313 unsigned long div = __raw_readl(S3C2410_CLKDIVN);
314
315 div &= S3C2412_CLKDIVN_UARTDIV_MASK;
316 div >>= S3C2412_CLKDIVN_UARTDIV_SHIFT;
317
318 return parent_rate / (div + 1);
319}
320
321static int s3c2412_setrate_uart(struct clk *clk, unsigned long rate)
322{
323 unsigned long parent_rate = clk_get_rate(clk->parent);
324 unsigned long clkdivn = __raw_readl(S3C2410_CLKDIVN);
325
326 rate = s3c2412_roundrate_clksrc(clk, rate);
327
328 clkdivn &= ~S3C2412_CLKDIVN_UARTDIV_MASK;
329 clkdivn |= ((parent_rate / rate) - 1) << S3C2412_CLKDIVN_UARTDIV_SHIFT;
330
331 __raw_writel(clkdivn, S3C2410_CLKDIVN);
332 return 0;
333}
334
335static struct clk clk_uart = {
336 .name = "uartclk",
337 .ops = &(struct clk_ops) {
338 .get_rate = s3c2412_getrate_uart,
339 .set_rate = s3c2412_setrate_uart,
340 .set_parent = s3c2412_setparent_uart,
341 .round_rate = s3c2412_roundrate_clksrc,
342 },
343};
344
345static int s3c2412_setparent_i2s(struct clk *clk, struct clk *parent)
346{
347 unsigned long clksrc = __raw_readl(S3C2412_CLKSRC);
348
349 if (parent == &clk_erefclk)
350 clksrc &= ~S3C2412_CLKSRC_I2SCLK_MPLL;
351 else if (parent == &clk_mpll)
352 clksrc |= S3C2412_CLKSRC_I2SCLK_MPLL;
353 else
354 return -EINVAL;
355
356 clk->parent = parent;
357
358 __raw_writel(clksrc, S3C2412_CLKSRC);
359 return 0;
360}
361
362static unsigned long s3c2412_getrate_i2s(struct clk *clk)
363{
364 unsigned long parent_rate = clk_get_rate(clk->parent);
365 unsigned long div = __raw_readl(S3C2410_CLKDIVN);
366
367 div &= S3C2412_CLKDIVN_I2SDIV_MASK;
368 div >>= S3C2412_CLKDIVN_I2SDIV_SHIFT;
369
370 return parent_rate / (div + 1);
371}
372
373static int s3c2412_setrate_i2s(struct clk *clk, unsigned long rate)
374{
375 unsigned long parent_rate = clk_get_rate(clk->parent);
376 unsigned long clkdivn = __raw_readl(S3C2410_CLKDIVN);
377
378 rate = s3c2412_roundrate_clksrc(clk, rate);
379
380 clkdivn &= ~S3C2412_CLKDIVN_I2SDIV_MASK;
381 clkdivn |= ((parent_rate / rate) - 1) << S3C2412_CLKDIVN_I2SDIV_SHIFT;
382
383 __raw_writel(clkdivn, S3C2410_CLKDIVN);
384 return 0;
385}
386
387static struct clk clk_i2s = {
388 .name = "i2sclk",
389 .ops = &(struct clk_ops) {
390 .get_rate = s3c2412_getrate_i2s,
391 .set_rate = s3c2412_setrate_i2s,
392 .set_parent = s3c2412_setparent_i2s,
393 .round_rate = s3c2412_roundrate_clksrc,
394 },
395};
396
397static int s3c2412_setparent_cam(struct clk *clk, struct clk *parent)
398{
399 unsigned long clksrc = __raw_readl(S3C2412_CLKSRC);
400
401 if (parent == &clk_usysclk)
402 clksrc &= ~S3C2412_CLKSRC_CAMCLK_HCLK;
403 else if (parent == &clk_h)
404 clksrc |= S3C2412_CLKSRC_CAMCLK_HCLK;
405 else
406 return -EINVAL;
407
408 clk->parent = parent;
409
410 __raw_writel(clksrc, S3C2412_CLKSRC);
411 return 0;
412}
413static unsigned long s3c2412_getrate_cam(struct clk *clk)
414{
415 unsigned long parent_rate = clk_get_rate(clk->parent);
416 unsigned long div = __raw_readl(S3C2410_CLKDIVN);
417
418 div &= S3C2412_CLKDIVN_CAMDIV_MASK;
419 div >>= S3C2412_CLKDIVN_CAMDIV_SHIFT;
420
421 return parent_rate / (div + 1);
422}
423
424static int s3c2412_setrate_cam(struct clk *clk, unsigned long rate)
425{
426 unsigned long parent_rate = clk_get_rate(clk->parent);
427 unsigned long clkdivn = __raw_readl(S3C2410_CLKDIVN);
428
429 rate = s3c2412_roundrate_clksrc(clk, rate);
430
431 clkdivn &= ~S3C2412_CLKDIVN_CAMDIV_MASK;
432 clkdivn |= ((parent_rate / rate) - 1) << S3C2412_CLKDIVN_CAMDIV_SHIFT;
433
434 __raw_writel(clkdivn, S3C2410_CLKDIVN);
435 return 0;
436}
437
438static struct clk clk_cam = {
439 .name = "camif-upll", /* same as 2440 name */
440 .ops = &(struct clk_ops) {
441 .get_rate = s3c2412_getrate_cam,
442 .set_rate = s3c2412_setrate_cam,
443 .set_parent = s3c2412_setparent_cam,
444 .round_rate = s3c2412_roundrate_clksrc,
445 },
446};
447
448/* standard clock definitions */
449
450static struct clk init_clocks_disable[] = {
451 {
452 .name = "nand",
453 .parent = &clk_h,
454 .enable = s3c2412_clkcon_enable,
455 .ctrlbit = S3C2412_CLKCON_NAND,
456 }, {
457 .name = "sdi",
458 .parent = &clk_p,
459 .enable = s3c2412_clkcon_enable,
460 .ctrlbit = S3C2412_CLKCON_SDI,
461 }, {
462 .name = "adc",
463 .parent = &clk_p,
464 .enable = s3c2412_clkcon_enable,
465 .ctrlbit = S3C2412_CLKCON_ADC,
466 }, {
467 .name = "i2c",
468 .parent = &clk_p,
469 .enable = s3c2412_clkcon_enable,
470 .ctrlbit = S3C2412_CLKCON_IIC,
471 }, {
472 .name = "iis",
473 .parent = &clk_p,
474 .enable = s3c2412_clkcon_enable,
475 .ctrlbit = S3C2412_CLKCON_IIS,
476 }, {
477 .name = "spi",
478 .parent = &clk_p,
479 .enable = s3c2412_clkcon_enable,
480 .ctrlbit = S3C2412_CLKCON_SPI,
481 }
482};
483
484static struct clk init_clocks[] = {
485 {
486 .name = "dma.0",
487 .parent = &clk_h,
488 .enable = s3c2412_clkcon_enable,
489 .ctrlbit = S3C2412_CLKCON_DMA0,
490 }, {
491 .name = "dma.1",
492 .parent = &clk_h,
493 .enable = s3c2412_clkcon_enable,
494 .ctrlbit = S3C2412_CLKCON_DMA1,
495 }, {
496 .name = "dma.2",
497 .parent = &clk_h,
498 .enable = s3c2412_clkcon_enable,
499 .ctrlbit = S3C2412_CLKCON_DMA2,
500 }, {
501 .name = "dma.3",
502 .parent = &clk_h,
503 .enable = s3c2412_clkcon_enable,
504 .ctrlbit = S3C2412_CLKCON_DMA3,
505 }, {
506 .name = "lcd",
507 .parent = &clk_h,
508 .enable = s3c2412_clkcon_enable,
509 .ctrlbit = S3C2412_CLKCON_LCDC,
510 }, {
511 .name = "gpio",
512 .parent = &clk_p,
513 .enable = s3c2412_clkcon_enable,
514 .ctrlbit = S3C2412_CLKCON_GPIO,
515 }, {
516 .name = "usb-host",
517 .parent = &clk_h,
518 .enable = s3c2412_clkcon_enable,
519 .ctrlbit = S3C2412_CLKCON_USBH,
520 }, {
521 .name = "usb-device",
522 .parent = &clk_h,
523 .enable = s3c2412_clkcon_enable,
524 .ctrlbit = S3C2412_CLKCON_USBD,
525 }, {
526 .name = "timers",
527 .parent = &clk_p,
528 .enable = s3c2412_clkcon_enable,
529 .ctrlbit = S3C2412_CLKCON_PWMT,
530 }, {
531 .name = "uart",
532 .devname = "s3c2412-uart.0",
533 .parent = &clk_p,
534 .enable = s3c2412_clkcon_enable,
535 .ctrlbit = S3C2412_CLKCON_UART0,
536 }, {
537 .name = "uart",
538 .devname = "s3c2412-uart.1",
539 .parent = &clk_p,
540 .enable = s3c2412_clkcon_enable,
541 .ctrlbit = S3C2412_CLKCON_UART1,
542 }, {
543 .name = "uart",
544 .devname = "s3c2412-uart.2",
545 .parent = &clk_p,
546 .enable = s3c2412_clkcon_enable,
547 .ctrlbit = S3C2412_CLKCON_UART2,
548 }, {
549 .name = "rtc",
550 .parent = &clk_p,
551 .enable = s3c2412_clkcon_enable,
552 .ctrlbit = S3C2412_CLKCON_RTC,
553 }, {
554 .name = "watchdog",
555 .parent = &clk_p,
556 .ctrlbit = 0,
557 }, {
558 .name = "usb-bus-gadget",
559 .parent = &clk_usb_bus,
560 .enable = s3c2412_clkcon_enable,
561 .ctrlbit = S3C2412_CLKCON_USB_DEV48,
562 }, {
563 .name = "usb-bus-host",
564 .parent = &clk_usb_bus,
565 .enable = s3c2412_clkcon_enable,
566 .ctrlbit = S3C2412_CLKCON_USB_HOST48,
567 }
568};
569
570/* clocks to add where we need to check their parentage */
571
572struct clk_init {
573 struct clk *clk;
574 unsigned int bit;
575 struct clk *src_0;
576 struct clk *src_1;
577};
578
579static struct clk_init clks_src[] __initdata = {
580 {
581 .clk = &clk_usysclk,
582 .bit = S3C2412_CLKSRC_USBCLK_HCLK,
583 .src_0 = &clk_urefclk,
584 .src_1 = &clk_upll,
585 }, {
586 .clk = &clk_i2s,
587 .bit = S3C2412_CLKSRC_I2SCLK_MPLL,
588 .src_0 = &clk_erefclk,
589 .src_1 = &clk_mpll,
590 }, {
591 .clk = &clk_cam,
592 .bit = S3C2412_CLKSRC_CAMCLK_HCLK,
593 .src_0 = &clk_usysclk,
594 .src_1 = &clk_h,
595 }, {
596 .clk = &clk_msysclk,
597 .bit = S3C2412_CLKSRC_MSYSCLK_MPLL,
598 .src_0 = &clk_mdivclk,
599 .src_1 = &clk_mpll,
600 }, {
601 .clk = &clk_uart,
602 .bit = S3C2412_CLKSRC_UARTCLK_MPLL,
603 .src_0 = &clk_erefclk,
604 .src_1 = &clk_mpll,
605 }, {
606 .clk = &clk_usbsrc,
607 .bit = S3C2412_CLKSRC_USBCLK_HCLK,
608 .src_0 = &clk_usysclk,
609 .src_1 = &clk_h,
610 /* here we assume OM[4] select xtal */
611 }, {
612 .clk = &clk_erefclk,
613 .bit = S3C2412_CLKSRC_EREFCLK_EXTCLK,
614 .src_0 = &clk_xtal,
615 .src_1 = &clk_ext,
616 }, {
617 .clk = &clk_urefclk,
618 .bit = S3C2412_CLKSRC_UREFCLK_EXTCLK,
619 .src_0 = &clk_xtal,
620 .src_1 = &clk_ext,
621 },
622};
623
624/* s3c2412_clk_initparents
625 *
626 * Initialise the parents for the clocks that we get at start-time
627*/
628
629static void __init s3c2412_clk_initparents(void)
630{
631 unsigned long clksrc = __raw_readl(S3C2412_CLKSRC);
632 struct clk_init *cip = clks_src;
633 struct clk *src;
634 int ptr;
635 int ret;
636
637 for (ptr = 0; ptr < ARRAY_SIZE(clks_src); ptr++, cip++) {
638 ret = s3c24xx_register_clock(cip->clk);
639 if (ret < 0) {
640 printk(KERN_ERR "Failed to register clock %s (%d)\n",
641 cip->clk->name, ret);
642 }
643
644 src = (clksrc & cip->bit) ? cip->src_1 : cip->src_0;
645
646 printk(KERN_INFO "%s: parent %s\n", cip->clk->name, src->name);
647 clk_set_parent(cip->clk, src);
648 }
649}
650
651/* clocks to add straight away */
652
653static struct clk *clks[] __initdata = {
654 &clk_ext,
655 &clk_usb_bus,
656 &clk_mrefclk,
657 &clk_armclk,
658};
659
660static struct clk_lookup s3c2412_clk_lookup[] = {
661 CLKDEV_INIT(NULL, "clk_uart_baud1", &s3c24xx_uclk),
662 CLKDEV_INIT(NULL, "clk_uart_baud2", &clk_p),
663 CLKDEV_INIT(NULL, "clk_uart_baud3", &clk_usysclk),
664};
665
666int __init s3c2412_baseclk_add(void)
667{
668 unsigned long clkcon = __raw_readl(S3C2410_CLKCON);
669 unsigned int dvs;
670 struct clk *clkp;
671 int ret;
672 int ptr;
673
674 clk_upll.enable = s3c2412_upll_enable;
675 clk_usb_bus.parent = &clk_usbsrc;
676 clk_usb_bus.rate = 0x0;
677
678 clk_f.parent = &clk_msysclk;
679
680 s3c2412_clk_initparents();
681
682 for (ptr = 0; ptr < ARRAY_SIZE(clks); ptr++) {
683 clkp = clks[ptr];
684
685 ret = s3c24xx_register_clock(clkp);
686 if (ret < 0) {
687 printk(KERN_ERR "Failed to register clock %s (%d)\n",
688 clkp->name, ret);
689 }
690 }
691
692 /* set the dvs state according to what we got at boot time */
693
694 dvs = __raw_readl(S3C2410_CLKDIVN) & S3C2412_CLKDIVN_DVSEN;
695
696 if (dvs)
697 clk_armclk.parent = &clk_h;
698
699 printk(KERN_INFO "S3C2412: DVS is %s\n", dvs ? "on" : "off");
700
701 /* ensure usb bus clock is within correct rate of 48MHz */
702
703 if (clk_get_rate(&clk_usb_bus) != (48 * 1000 * 1000)) {
704 printk(KERN_INFO "Warning: USB bus clock not at 48MHz\n");
705
706 /* for the moment, let's use the UPLL, and see if we can
707 * get 48MHz */
708
709 clk_set_parent(&clk_usysclk, &clk_upll);
710 clk_set_parent(&clk_usbsrc, &clk_usysclk);
711 clk_set_rate(&clk_usbsrc, 48*1000*1000);
712 }
713
714 printk("S3C2412: upll %s, %ld.%03ld MHz, usb-bus %ld.%03ld MHz\n",
715 (__raw_readl(S3C2410_UPLLCON) & S3C2412_PLLCON_OFF) ? "off":"on",
716 print_mhz(clk_get_rate(&clk_upll)),
717 print_mhz(clk_get_rate(&clk_usb_bus)));
718
719 /* register clocks from clock array */
720
721 clkp = init_clocks;
722 for (ptr = 0; ptr < ARRAY_SIZE(init_clocks); ptr++, clkp++) {
723 /* ensure that we note the clock state */
724
725 clkp->usage = clkcon & clkp->ctrlbit ? 1 : 0;
726
727 ret = s3c24xx_register_clock(clkp);
728 if (ret < 0) {
729 printk(KERN_ERR "Failed to register clock %s (%d)\n",
730 clkp->name, ret);
731 }
732 }
733
734 /* We must be careful disabling the clocks we are not intending to
735 * be using at boot time, as subsystems such as the LCD which do
736 * their own DMA requests to the bus can cause the system to lockup
737 * if they where in the middle of requesting bus access.
738 *
739 * Disabling the LCD clock if the LCD is active is very dangerous,
740 * and therefore the bootloader should be careful to not enable
741 * the LCD clock if it is not needed.
742 */
743
744 /* install (and disable) the clocks we do not need immediately */
745
746 clkp = init_clocks_disable;
747 for (ptr = 0; ptr < ARRAY_SIZE(init_clocks_disable); ptr++, clkp++) {
748
749 ret = s3c24xx_register_clock(clkp);
750 if (ret < 0) {
751 printk(KERN_ERR "Failed to register clock %s (%d)\n",
752 clkp->name, ret);
753 }
754
755 s3c2412_clkcon_enable(clkp, 0);
756 }
757
758 clkdev_add_table(s3c2412_clk_lookup, ARRAY_SIZE(s3c2412_clk_lookup));
759 return 0;
760}
diff --git a/arch/arm/mach-s3c24xx/clock-s3c2416.c b/arch/arm/mach-s3c24xx/clock-s3c2416.c
deleted file mode 100644
index d421a72920a5..000000000000
--- a/arch/arm/mach-s3c24xx/clock-s3c2416.c
+++ /dev/null
@@ -1,171 +0,0 @@
1/* linux/arch/arm/mach-s3c2416/clock.c
2 *
3 * Copyright (c) 2010 Simtec Electronics
4 * Copyright (c) 2010 Ben Dooks <ben-linux@fluff.org>
5 *
6 * S3C2416 Clock control support
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 */
13
14#include <linux/init.h>
15#include <linux/clk.h>
16
17#include <plat/clock.h>
18#include <plat/clock-clksrc.h>
19#include <plat/cpu.h>
20
21#include <plat/cpu-freq.h>
22#include <plat/pll.h>
23
24#include <asm/mach/map.h>
25
26#include <mach/regs-clock.h>
27#include <mach/regs-s3c2443-clock.h>
28
29/* armdiv
30 *
31 * this clock is sourced from msysclk and can have a number of
32 * divider values applied to it to then be fed into armclk.
33 * The real clock definition is done in s3c2443-clock.c,
34 * only the armdiv divisor table must be defined here.
35*/
36
37static unsigned int armdiv[8] = {
38 [0] = 1,
39 [1] = 2,
40 [2] = 3,
41 [3] = 4,
42 [5] = 6,
43 [7] = 8,
44};
45
46static struct clksrc_clk hsspi_eplldiv = {
47 .clk = {
48 .name = "hsspi-eplldiv",
49 .parent = &clk_esysclk.clk,
50 .ctrlbit = (1 << 14),
51 .enable = s3c2443_clkcon_enable_s,
52 },
53 .reg_div = { .reg = S3C2443_CLKDIV1, .size = 2, .shift = 24 },
54};
55
56static struct clk *hsspi_sources[] = {
57 [0] = &hsspi_eplldiv.clk,
58 [1] = NULL, /* to fix */
59};
60
61static struct clksrc_clk hsspi_mux = {
62 .clk = {
63 .name = "hsspi-if",
64 },
65 .sources = &(struct clksrc_sources) {
66 .sources = hsspi_sources,
67 .nr_sources = ARRAY_SIZE(hsspi_sources),
68 },
69 .reg_src = { .reg = S3C2443_CLKSRC, .size = 1, .shift = 18 },
70};
71
72static struct clksrc_clk hsmmc_div[] = {
73 [0] = {
74 .clk = {
75 .name = "hsmmc-div",
76 .devname = "s3c-sdhci.0",
77 .parent = &clk_esysclk.clk,
78 },
79 .reg_div = { .reg = S3C2416_CLKDIV2, .size = 2, .shift = 6 },
80 },
81 [1] = {
82 .clk = {
83 .name = "hsmmc-div",
84 .devname = "s3c-sdhci.1",
85 .parent = &clk_esysclk.clk,
86 },
87 .reg_div = { .reg = S3C2443_CLKDIV1, .size = 2, .shift = 6 },
88 },
89};
90
91static struct clksrc_clk hsmmc_mux0 = {
92 .clk = {
93 .name = "hsmmc-if",
94 .devname = "s3c-sdhci.0",
95 .ctrlbit = (1 << 6),
96 .enable = s3c2443_clkcon_enable_s,
97 },
98 .sources = &(struct clksrc_sources) {
99 .nr_sources = 2,
100 .sources = (struct clk * []) {
101 [0] = &hsmmc_div[0].clk,
102 [1] = NULL, /* to fix */
103 },
104 },
105 .reg_src = { .reg = S3C2443_CLKSRC, .size = 1, .shift = 16 },
106};
107
108static struct clksrc_clk hsmmc_mux1 = {
109 .clk = {
110 .name = "hsmmc-if",
111 .devname = "s3c-sdhci.1",
112 .ctrlbit = (1 << 12),
113 .enable = s3c2443_clkcon_enable_s,
114 },
115 .sources = &(struct clksrc_sources) {
116 .nr_sources = 2,
117 .sources = (struct clk * []) {
118 [0] = &hsmmc_div[1].clk,
119 [1] = NULL, /* to fix */
120 },
121 },
122 .reg_src = { .reg = S3C2443_CLKSRC, .size = 1, .shift = 17 },
123};
124
125static struct clk hsmmc0_clk = {
126 .name = "hsmmc",
127 .devname = "s3c-sdhci.0",
128 .parent = &clk_h,
129 .enable = s3c2443_clkcon_enable_h,
130 .ctrlbit = S3C2416_HCLKCON_HSMMC0,
131};
132
133static struct clksrc_clk *clksrcs[] __initdata = {
134 &hsspi_eplldiv,
135 &hsspi_mux,
136 &hsmmc_div[0],
137 &hsmmc_div[1],
138 &hsmmc_mux0,
139 &hsmmc_mux1,
140};
141
142static struct clk_lookup s3c2416_clk_lookup[] = {
143 CLKDEV_INIT("s3c-sdhci.0", "mmc_busclk.0", &hsmmc0_clk),
144 CLKDEV_INIT("s3c-sdhci.0", "mmc_busclk.2", &hsmmc_mux0.clk),
145 CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.2", &hsmmc_mux1.clk),
146 /* s3c2443-spi.0 is used on s3c2416 and s3c2450 as well */
147 CLKDEV_INIT("s3c2443-spi.0", "spi_busclk2", &hsspi_mux.clk),
148};
149
150void __init s3c2416_init_clocks(int xtal)
151{
152 u32 epllcon = __raw_readl(S3C2443_EPLLCON);
153 u32 epllcon1 = __raw_readl(S3C2443_EPLLCON+4);
154 int ptr;
155
156 /* s3c2416 EPLL compatible with s3c64xx */
157 clk_epll.rate = s3c_get_pll6553x(xtal, epllcon, epllcon1);
158
159 clk_epll.parent = &clk_epllref.clk;
160
161 s3c2443_common_init_clocks(xtal, s3c2416_get_pll,
162 armdiv, ARRAY_SIZE(armdiv),
163 S3C2416_CLKDIV0_ARMDIV_MASK);
164
165 for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++)
166 s3c_register_clksrc(clksrcs[ptr], 1);
167
168 s3c24xx_register_clock(&hsmmc0_clk);
169 clkdev_add_table(s3c2416_clk_lookup, ARRAY_SIZE(s3c2416_clk_lookup));
170
171}
diff --git a/arch/arm/mach-s3c24xx/clock-s3c2440.c b/arch/arm/mach-s3c24xx/clock-s3c2440.c
deleted file mode 100644
index 5527226fd61f..000000000000
--- a/arch/arm/mach-s3c24xx/clock-s3c2440.c
+++ /dev/null
@@ -1,217 +0,0 @@
1/* linux/arch/arm/mach-s3c2440/clock.c
2 *
3 * Copyright (c) 2004-2005 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * S3C2440 Clock support
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22*/
23
24#include <linux/init.h>
25#include <linux/module.h>
26#include <linux/kernel.h>
27#include <linux/list.h>
28#include <linux/errno.h>
29#include <linux/err.h>
30#include <linux/device.h>
31#include <linux/interrupt.h>
32#include <linux/ioport.h>
33#include <linux/mutex.h>
34#include <linux/clk.h>
35#include <linux/io.h>
36#include <linux/serial_core.h>
37#include <linux/serial_s3c.h>
38
39#include <mach/hardware.h>
40#include <linux/atomic.h>
41#include <asm/irq.h>
42
43#include <mach/regs-clock.h>
44
45#include <plat/clock.h>
46#include <plat/cpu.h>
47
48/* S3C2440 extended clock support */
49
50static unsigned long s3c2440_camif_upll_round(struct clk *clk,
51 unsigned long rate)
52{
53 unsigned long parent_rate = clk_get_rate(clk->parent);
54 int div;
55
56 if (rate > parent_rate)
57 return parent_rate;
58
59 /* note, we remove the +/- 1 calculations for the divisor */
60
61 div = (parent_rate / rate) / 2;
62
63 if (div < 1)
64 div = 1;
65 else if (div > 16)
66 div = 16;
67
68 return parent_rate / (div * 2);
69}
70
71static int s3c2440_camif_upll_setrate(struct clk *clk, unsigned long rate)
72{
73 unsigned long parent_rate = clk_get_rate(clk->parent);
74 unsigned long camdivn = __raw_readl(S3C2440_CAMDIVN);
75
76 rate = s3c2440_camif_upll_round(clk, rate);
77
78 camdivn &= ~(S3C2440_CAMDIVN_CAMCLK_SEL | S3C2440_CAMDIVN_CAMCLK_MASK);
79
80 if (rate != parent_rate) {
81 camdivn |= S3C2440_CAMDIVN_CAMCLK_SEL;
82 camdivn |= (((parent_rate / rate) / 2) - 1);
83 }
84
85 __raw_writel(camdivn, S3C2440_CAMDIVN);
86
87 return 0;
88}
89
90static unsigned long s3c2440_camif_upll_getrate(struct clk *clk)
91{
92 unsigned long parent_rate = clk_get_rate(clk->parent);
93 unsigned long camdivn = __raw_readl(S3C2440_CAMDIVN);
94
95 if (!(camdivn & S3C2440_CAMDIVN_CAMCLK_SEL))
96 return parent_rate;
97
98 camdivn &= S3C2440_CAMDIVN_CAMCLK_MASK;
99
100 return parent_rate / (camdivn + 1) / 2;
101}
102
103/* Extra S3C2440 clocks */
104
105static struct clk s3c2440_clk_cam = {
106 .name = "camif",
107 .enable = s3c2410_clkcon_enable,
108 .ctrlbit = S3C2440_CLKCON_CAMERA,
109};
110
111static struct clk s3c2440_clk_cam_upll = {
112 .name = "camif-upll",
113 .ops = &(struct clk_ops) {
114 .set_rate = s3c2440_camif_upll_setrate,
115 .get_rate = s3c2440_camif_upll_getrate,
116 .round_rate = s3c2440_camif_upll_round,
117 },
118};
119
120static struct clk s3c2440_clk_ac97 = {
121 .name = "ac97",
122 .enable = s3c2410_clkcon_enable,
123 .ctrlbit = S3C2440_CLKCON_AC97,
124};
125
126#define S3C24XX_VA_UART0 (S3C_VA_UART)
127#define S3C24XX_VA_UART1 (S3C_VA_UART + 0x4000 )
128#define S3C24XX_VA_UART2 (S3C_VA_UART + 0x8000 )
129#define S3C24XX_VA_UART3 (S3C_VA_UART + 0xC000 )
130
131static unsigned long s3c2440_fclk_n_getrate(struct clk *clk)
132{
133 unsigned long ucon0, ucon1, ucon2, divisor;
134
135 /* the fun of calculating the uart divisors on the s3c2440 */
136 ucon0 = __raw_readl(S3C24XX_VA_UART0 + S3C2410_UCON);
137 ucon1 = __raw_readl(S3C24XX_VA_UART1 + S3C2410_UCON);
138 ucon2 = __raw_readl(S3C24XX_VA_UART2 + S3C2410_UCON);
139
140 ucon0 &= S3C2440_UCON0_DIVMASK;
141 ucon1 &= S3C2440_UCON1_DIVMASK;
142 ucon2 &= S3C2440_UCON2_DIVMASK;
143
144 if (ucon0 != 0)
145 divisor = (ucon0 >> S3C2440_UCON_DIVSHIFT) + 6;
146 else if (ucon1 != 0)
147 divisor = (ucon1 >> S3C2440_UCON_DIVSHIFT) + 21;
148 else if (ucon2 != 0)
149 divisor = (ucon2 >> S3C2440_UCON_DIVSHIFT) + 36;
150 else
151 /* manual calims 44, seems to be 9 */
152 divisor = 9;
153
154 return clk_get_rate(clk->parent) / divisor;
155}
156
157static struct clk s3c2440_clk_fclk_n = {
158 .name = "fclk_n",
159 .parent = &clk_f,
160 .ops = &(struct clk_ops) {
161 .get_rate = s3c2440_fclk_n_getrate,
162 },
163};
164
165static struct clk_lookup s3c2440_clk_lookup[] = {
166 CLKDEV_INIT(NULL, "clk_uart_baud1", &s3c24xx_uclk),
167 CLKDEV_INIT(NULL, "clk_uart_baud2", &clk_p),
168 CLKDEV_INIT(NULL, "clk_uart_baud3", &s3c2440_clk_fclk_n),
169 CLKDEV_INIT("s3c2440-uart.0", "uart", &s3c24xx_clk_uart0),
170 CLKDEV_INIT("s3c2440-uart.1", "uart", &s3c24xx_clk_uart1),
171 CLKDEV_INIT("s3c2440-uart.2", "uart", &s3c24xx_clk_uart2),
172 CLKDEV_INIT("s3c2440-camif", "camera", &s3c2440_clk_cam_upll),
173};
174
175static int __init_refok s3c2440_clk_add(struct device *dev, struct subsys_interface *sif)
176{
177 struct clk *clock_upll;
178 struct clk *clock_h;
179 struct clk *clock_p;
180
181 clock_p = clk_get(NULL, "pclk");
182 clock_h = clk_get(NULL, "hclk");
183 clock_upll = clk_get(NULL, "upll");
184
185 if (IS_ERR(clock_p) || IS_ERR(clock_h) || IS_ERR(clock_upll)) {
186 printk(KERN_ERR "S3C2440: Failed to get parent clocks\n");
187 return -EINVAL;
188 }
189
190 s3c2440_clk_cam.parent = clock_h;
191 s3c2440_clk_ac97.parent = clock_p;
192 s3c2440_clk_cam_upll.parent = clock_upll;
193 s3c24xx_register_clock(&s3c2440_clk_fclk_n);
194
195 s3c24xx_register_clock(&s3c2440_clk_ac97);
196 s3c24xx_register_clock(&s3c2440_clk_cam);
197 s3c24xx_register_clock(&s3c2440_clk_cam_upll);
198 clkdev_add_table(s3c2440_clk_lookup, ARRAY_SIZE(s3c2440_clk_lookup));
199
200 clk_disable(&s3c2440_clk_ac97);
201 clk_disable(&s3c2440_clk_cam);
202
203 return 0;
204}
205
206static struct subsys_interface s3c2440_clk_interface = {
207 .name = "s3c2440_clk",
208 .subsys = &s3c2440_subsys,
209 .add_dev = s3c2440_clk_add,
210};
211
212static __init int s3c24xx_clk_init(void)
213{
214 return subsys_interface_register(&s3c2440_clk_interface);
215}
216
217arch_initcall(s3c24xx_clk_init);
diff --git a/arch/arm/mach-s3c24xx/clock-s3c2443.c b/arch/arm/mach-s3c24xx/clock-s3c2443.c
deleted file mode 100644
index 76cd31f7804e..000000000000
--- a/arch/arm/mach-s3c24xx/clock-s3c2443.c
+++ /dev/null
@@ -1,212 +0,0 @@
1/* linux/arch/arm/mach-s3c2443/clock.c
2 *
3 * Copyright (c) 2007, 2010 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * S3C2443 Clock control support
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21*/
22
23#include <linux/init.h>
24
25#include <linux/module.h>
26#include <linux/kernel.h>
27#include <linux/list.h>
28#include <linux/errno.h>
29#include <linux/err.h>
30#include <linux/device.h>
31#include <linux/clk.h>
32#include <linux/mutex.h>
33#include <linux/serial_core.h>
34#include <linux/io.h>
35
36#include <asm/mach/map.h>
37
38#include <mach/hardware.h>
39
40#include <mach/regs-s3c2443-clock.h>
41
42#include <plat/cpu-freq.h>
43
44#include <plat/clock.h>
45#include <plat/clock-clksrc.h>
46#include <plat/cpu.h>
47
48/* We currently have to assume that the system is running
49 * from the XTPll input, and that all ***REFCLKs are being
50 * fed from it, as we cannot read the state of OM[4] from
51 * software.
52 *
53 * It would be possible for each board initialisation to
54 * set the correct muxing at initialisation
55*/
56
57/* clock selections */
58
59/* armdiv
60 *
61 * this clock is sourced from msysclk and can have a number of
62 * divider values applied to it to then be fed into armclk.
63 * The real clock definition is done in s3c2443-clock.c,
64 * only the armdiv divisor table must be defined here.
65*/
66
67static unsigned int armdiv[16] = {
68 [S3C2443_CLKDIV0_ARMDIV_1 >> S3C2443_CLKDIV0_ARMDIV_SHIFT] = 1,
69 [S3C2443_CLKDIV0_ARMDIV_2 >> S3C2443_CLKDIV0_ARMDIV_SHIFT] = 2,
70 [S3C2443_CLKDIV0_ARMDIV_3 >> S3C2443_CLKDIV0_ARMDIV_SHIFT] = 3,
71 [S3C2443_CLKDIV0_ARMDIV_4 >> S3C2443_CLKDIV0_ARMDIV_SHIFT] = 4,
72 [S3C2443_CLKDIV0_ARMDIV_6 >> S3C2443_CLKDIV0_ARMDIV_SHIFT] = 6,
73 [S3C2443_CLKDIV0_ARMDIV_8 >> S3C2443_CLKDIV0_ARMDIV_SHIFT] = 8,
74 [S3C2443_CLKDIV0_ARMDIV_12 >> S3C2443_CLKDIV0_ARMDIV_SHIFT] = 12,
75 [S3C2443_CLKDIV0_ARMDIV_16 >> S3C2443_CLKDIV0_ARMDIV_SHIFT] = 16,
76};
77
78/* hsspi
79 *
80 * high-speed spi clock, sourced from esysclk
81*/
82
83static struct clksrc_clk clk_hsspi = {
84 .clk = {
85 .name = "hsspi-if",
86 .parent = &clk_esysclk.clk,
87 .ctrlbit = S3C2443_SCLKCON_HSSPICLK,
88 .enable = s3c2443_clkcon_enable_s,
89 },
90 .reg_div = { .reg = S3C2443_CLKDIV1, .size = 2, .shift = 4 },
91};
92
93
94/* clk_hsmcc_div
95 *
96 * this clock is sourced from epll, and is fed through a divider,
97 * to a mux controlled by sclkcon where either it or a extclk can
98 * be fed to the hsmmc block
99*/
100
101static struct clksrc_clk clk_hsmmc_div = {
102 .clk = {
103 .name = "hsmmc-div",
104 .devname = "s3c-sdhci.1",
105 .parent = &clk_esysclk.clk,
106 },
107 .reg_div = { .reg = S3C2443_CLKDIV1, .size = 2, .shift = 6 },
108};
109
110static int s3c2443_setparent_hsmmc(struct clk *clk, struct clk *parent)
111{
112 unsigned long clksrc = __raw_readl(S3C2443_SCLKCON);
113
114 clksrc &= ~(S3C2443_SCLKCON_HSMMCCLK_EXT |
115 S3C2443_SCLKCON_HSMMCCLK_EPLL);
116
117 if (parent == &clk_epll)
118 clksrc |= S3C2443_SCLKCON_HSMMCCLK_EPLL;
119 else if (parent == &clk_ext)
120 clksrc |= S3C2443_SCLKCON_HSMMCCLK_EXT;
121 else
122 return -EINVAL;
123
124 if (clk->usage > 0) {
125 __raw_writel(clksrc, S3C2443_SCLKCON);
126 }
127
128 clk->parent = parent;
129 return 0;
130}
131
132static int s3c2443_enable_hsmmc(struct clk *clk, int enable)
133{
134 return s3c2443_setparent_hsmmc(clk, clk->parent);
135}
136
137static struct clk clk_hsmmc = {
138 .name = "hsmmc-if",
139 .devname = "s3c-sdhci.1",
140 .parent = &clk_hsmmc_div.clk,
141 .enable = s3c2443_enable_hsmmc,
142 .ops = &(struct clk_ops) {
143 .set_parent = s3c2443_setparent_hsmmc,
144 },
145};
146
147/* standard clock definitions */
148
149static struct clk init_clocks_off[] = {
150 {
151 .name = "sdi",
152 .parent = &clk_p,
153 .enable = s3c2443_clkcon_enable_p,
154 .ctrlbit = S3C2443_PCLKCON_SDI,
155 }, {
156 .name = "spi",
157 .devname = "s3c2410-spi.0",
158 .parent = &clk_p,
159 .enable = s3c2443_clkcon_enable_p,
160 .ctrlbit = S3C2443_PCLKCON_SPI1,
161 }
162};
163
164/* clocks to add straight away */
165
166static struct clksrc_clk *clksrcs[] __initdata = {
167 &clk_hsspi,
168 &clk_hsmmc_div,
169};
170
171static struct clk *clks[] __initdata = {
172 &clk_hsmmc,
173};
174
175static struct clk_lookup s3c2443_clk_lookup[] = {
176 CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.2", &clk_hsmmc),
177 CLKDEV_INIT("s3c2443-spi.0", "spi_busclk2", &clk_hsspi.clk),
178};
179
180void __init s3c2443_init_clocks(int xtal)
181{
182 unsigned long epllcon = __raw_readl(S3C2443_EPLLCON);
183 int ptr;
184
185 clk_epll.rate = s3c2443_get_epll(epllcon, xtal);
186 clk_epll.parent = &clk_epllref.clk;
187
188 s3c2443_common_init_clocks(xtal, s3c2443_get_mpll,
189 armdiv, ARRAY_SIZE(armdiv),
190 S3C2443_CLKDIV0_ARMDIV_MASK);
191
192 s3c24xx_register_clocks(clks, ARRAY_SIZE(clks));
193
194 for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++)
195 s3c_register_clksrc(clksrcs[ptr], 1);
196
197 /* We must be careful disabling the clocks we are not intending to
198 * be using at boot time, as subsystems such as the LCD which do
199 * their own DMA requests to the bus can cause the system to lockup
200 * if they where in the middle of requesting bus access.
201 *
202 * Disabling the LCD clock if the LCD is active is very dangerous,
203 * and therefore the bootloader should be careful to not enable
204 * the LCD clock if it is not needed.
205 */
206
207 /* install (and disable) the clocks we do not need immediately */
208
209 s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
210 s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
211 clkdev_add_table(s3c2443_clk_lookup, ARRAY_SIZE(s3c2443_clk_lookup));
212}
diff --git a/arch/arm/mach-s3c24xx/clock-s3c244x.c b/arch/arm/mach-s3c24xx/clock-s3c244x.c
deleted file mode 100644
index 6d9b688c442b..000000000000
--- a/arch/arm/mach-s3c24xx/clock-s3c244x.c
+++ /dev/null
@@ -1,141 +0,0 @@
1/* linux/arch/arm/plat-s3c24xx/s3c24xx-clock.c
2 *
3 * Copyright (c) 2004-2008 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * S3C2440/S3C2442 Common clock support
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22*/
23
24#include <linux/init.h>
25#include <linux/module.h>
26#include <linux/kernel.h>
27#include <linux/list.h>
28#include <linux/errno.h>
29#include <linux/err.h>
30#include <linux/device.h>
31#include <linux/interrupt.h>
32#include <linux/ioport.h>
33#include <linux/clk.h>
34#include <linux/io.h>
35
36#include <mach/hardware.h>
37#include <linux/atomic.h>
38#include <asm/irq.h>
39
40#include <mach/regs-clock.h>
41
42#include <plat/clock.h>
43#include <plat/cpu.h>
44
45static int s3c2440_setparent_armclk(struct clk *clk, struct clk *parent)
46{
47 unsigned long camdivn;
48 unsigned long dvs;
49
50 if (parent == &clk_f)
51 dvs = 0;
52 else if (parent == &clk_h)
53 dvs = S3C2440_CAMDIVN_DVSEN;
54 else
55 return -EINVAL;
56
57 clk->parent = parent;
58
59 camdivn = __raw_readl(S3C2440_CAMDIVN);
60 camdivn &= ~S3C2440_CAMDIVN_DVSEN;
61 camdivn |= dvs;
62 __raw_writel(camdivn, S3C2440_CAMDIVN);
63
64 return 0;
65}
66
67static struct clk clk_arm = {
68 .name = "armclk",
69 .id = -1,
70 .ops = &(struct clk_ops) {
71 .set_parent = s3c2440_setparent_armclk,
72 },
73};
74
75static int s3c244x_clk_add(struct device *dev, struct subsys_interface *sif)
76{
77 unsigned long camdivn = __raw_readl(S3C2440_CAMDIVN);
78 unsigned long clkdivn;
79 struct clk *clock_upll;
80 int ret;
81
82 printk("S3C244X: Clock Support, DVS %s\n",
83 (camdivn & S3C2440_CAMDIVN_DVSEN) ? "on" : "off");
84
85 clk_arm.parent = (camdivn & S3C2440_CAMDIVN_DVSEN) ? &clk_h : &clk_f;
86
87 ret = s3c24xx_register_clock(&clk_arm);
88 if (ret < 0) {
89 printk(KERN_ERR "S3C24XX: Failed to add armclk (%d)\n", ret);
90 return ret;
91 }
92
93 clock_upll = clk_get(NULL, "upll");
94 if (IS_ERR(clock_upll)) {
95 printk(KERN_ERR "S3C244X: Failed to get upll clock\n");
96 return -ENOENT;
97 }
98
99 /* check rate of UPLL, and if it is near 96MHz, then change
100 * to using half the UPLL rate for the system */
101
102 if (clk_get_rate(clock_upll) > (94 * MHZ)) {
103 clk_usb_bus.rate = clk_get_rate(clock_upll) / 2;
104
105 spin_lock(&clocks_lock);
106
107 clkdivn = __raw_readl(S3C2410_CLKDIVN);
108 clkdivn |= S3C2440_CLKDIVN_UCLK;
109 __raw_writel(clkdivn, S3C2410_CLKDIVN);
110
111 spin_unlock(&clocks_lock);
112 }
113
114 return 0;
115}
116
117static struct subsys_interface s3c2440_clk_interface = {
118 .name = "s3c2440_clk",
119 .subsys = &s3c2440_subsys,
120 .add_dev = s3c244x_clk_add,
121};
122
123static int s3c2440_clk_init(void)
124{
125 return subsys_interface_register(&s3c2440_clk_interface);
126}
127
128arch_initcall(s3c2440_clk_init);
129
130static struct subsys_interface s3c2442_clk_interface = {
131 .name = "s3c2442_clk",
132 .subsys = &s3c2442_subsys,
133 .add_dev = s3c244x_clk_add,
134};
135
136static int s3c2442_clk_init(void)
137{
138 return subsys_interface_register(&s3c2442_clk_interface);
139}
140
141arch_initcall(s3c2442_clk_init);
diff --git a/arch/arm/mach-s3c24xx/common-s3c2443.c b/arch/arm/mach-s3c24xx/common-s3c2443.c
deleted file mode 100644
index 65d3eef73090..000000000000
--- a/arch/arm/mach-s3c24xx/common-s3c2443.c
+++ /dev/null
@@ -1,675 +0,0 @@
1/*
2 * Common code for SoCs starting with the S3C2443
3 *
4 * Copyright (c) 2007, 2010 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 */
17
18#include <linux/init.h>
19#include <linux/clk.h>
20#include <linux/io.h>
21
22#include <mach/regs-s3c2443-clock.h>
23
24#include <plat/clock.h>
25#include <plat/clock-clksrc.h>
26#include <plat/cpu.h>
27
28#include <plat/cpu-freq.h>
29
30
31static int s3c2443_gate(void __iomem *reg, struct clk *clk, int enable)
32{
33 u32 ctrlbit = clk->ctrlbit;
34 u32 con = __raw_readl(reg);
35
36 if (enable)
37 con |= ctrlbit;
38 else
39 con &= ~ctrlbit;
40
41 __raw_writel(con, reg);
42 return 0;
43}
44
45int s3c2443_clkcon_enable_h(struct clk *clk, int enable)
46{
47 return s3c2443_gate(S3C2443_HCLKCON, clk, enable);
48}
49
50int s3c2443_clkcon_enable_p(struct clk *clk, int enable)
51{
52 return s3c2443_gate(S3C2443_PCLKCON, clk, enable);
53}
54
55int s3c2443_clkcon_enable_s(struct clk *clk, int enable)
56{
57 return s3c2443_gate(S3C2443_SCLKCON, clk, enable);
58}
59
60/* mpllref is a direct descendant of clk_xtal by default, but it is not
61 * elided as the EPLL can be either sourced by the XTAL or EXTCLK and as
62 * such directly equating the two source clocks is impossible.
63 */
64static struct clk clk_mpllref = {
65 .name = "mpllref",
66 .parent = &clk_xtal,
67};
68
69static struct clk *clk_epllref_sources[] = {
70 [0] = &clk_mpllref,
71 [1] = &clk_mpllref,
72 [2] = &clk_xtal,
73 [3] = &clk_ext,
74};
75
76struct clksrc_clk clk_epllref = {
77 .clk = {
78 .name = "epllref",
79 },
80 .sources = &(struct clksrc_sources) {
81 .sources = clk_epllref_sources,
82 .nr_sources = ARRAY_SIZE(clk_epllref_sources),
83 },
84 .reg_src = { .reg = S3C2443_CLKSRC, .size = 2, .shift = 7 },
85};
86
87/* esysclk
88 *
89 * this is sourced from either the EPLL or the EPLLref clock
90*/
91
92static struct clk *clk_sysclk_sources[] = {
93 [0] = &clk_epllref.clk,
94 [1] = &clk_epll,
95};
96
97struct clksrc_clk clk_esysclk = {
98 .clk = {
99 .name = "esysclk",
100 .parent = &clk_epll,
101 },
102 .sources = &(struct clksrc_sources) {
103 .sources = clk_sysclk_sources,
104 .nr_sources = ARRAY_SIZE(clk_sysclk_sources),
105 },
106 .reg_src = { .reg = S3C2443_CLKSRC, .size = 1, .shift = 6 },
107};
108
109static unsigned long s3c2443_getrate_mdivclk(struct clk *clk)
110{
111 unsigned long parent_rate = clk_get_rate(clk->parent);
112 unsigned long div = __raw_readl(S3C2443_CLKDIV0);
113
114 div &= S3C2443_CLKDIV0_EXTDIV_MASK;
115 div >>= (S3C2443_CLKDIV0_EXTDIV_SHIFT-1); /* x2 */
116
117 return parent_rate / (div + 1);
118}
119
120static struct clk clk_mdivclk = {
121 .name = "mdivclk",
122 .parent = &clk_mpllref,
123 .ops = &(struct clk_ops) {
124 .get_rate = s3c2443_getrate_mdivclk,
125 },
126};
127
128static struct clk *clk_msysclk_sources[] = {
129 [0] = &clk_mpllref,
130 [1] = &clk_mpll,
131 [2] = &clk_mdivclk,
132 [3] = &clk_mpllref,
133};
134
135static struct clksrc_clk clk_msysclk = {
136 .clk = {
137 .name = "msysclk",
138 .parent = &clk_xtal,
139 },
140 .sources = &(struct clksrc_sources) {
141 .sources = clk_msysclk_sources,
142 .nr_sources = ARRAY_SIZE(clk_msysclk_sources),
143 },
144 .reg_src = { .reg = S3C2443_CLKSRC, .size = 2, .shift = 3 },
145};
146
147/* prediv
148 *
149 * this divides the msysclk down to pass to h/p/etc.
150 */
151
152static unsigned long s3c2443_prediv_getrate(struct clk *clk)
153{
154 unsigned long rate = clk_get_rate(clk->parent);
155 unsigned long clkdiv0 = __raw_readl(S3C2443_CLKDIV0);
156
157 clkdiv0 &= S3C2443_CLKDIV0_PREDIV_MASK;
158 clkdiv0 >>= S3C2443_CLKDIV0_PREDIV_SHIFT;
159
160 return rate / (clkdiv0 + 1);
161}
162
163static struct clk clk_prediv = {
164 .name = "prediv",
165 .parent = &clk_msysclk.clk,
166 .ops = &(struct clk_ops) {
167 .get_rate = s3c2443_prediv_getrate,
168 },
169};
170
171/* hclk divider
172 *
173 * divides the prediv and provides the hclk.
174 */
175
176static unsigned long s3c2443_hclkdiv_getrate(struct clk *clk)
177{
178 unsigned long rate = clk_get_rate(clk->parent);
179 unsigned long clkdiv0 = __raw_readl(S3C2443_CLKDIV0);
180
181 clkdiv0 &= S3C2443_CLKDIV0_HCLKDIV_MASK;
182
183 return rate / (clkdiv0 + 1);
184}
185
186static struct clk_ops clk_h_ops = {
187 .get_rate = s3c2443_hclkdiv_getrate,
188};
189
190/* pclk divider
191 *
192 * divides the hclk and provides the pclk.
193 */
194
195static unsigned long s3c2443_pclkdiv_getrate(struct clk *clk)
196{
197 unsigned long rate = clk_get_rate(clk->parent);
198 unsigned long clkdiv0 = __raw_readl(S3C2443_CLKDIV0);
199
200 clkdiv0 = ((clkdiv0 & S3C2443_CLKDIV0_HALF_PCLK) ? 1 : 0);
201
202 return rate / (clkdiv0 + 1);
203}
204
205static struct clk_ops clk_p_ops = {
206 .get_rate = s3c2443_pclkdiv_getrate,
207};
208
209/* armdiv
210 *
211 * this clock is sourced from msysclk and can have a number of
212 * divider values applied to it to then be fed into armclk.
213*/
214
215static unsigned int *armdiv;
216static int nr_armdiv;
217static int armdivmask;
218
219static unsigned long s3c2443_armclk_roundrate(struct clk *clk,
220 unsigned long rate)
221{
222 unsigned long parent = clk_get_rate(clk->parent);
223 unsigned long calc;
224 unsigned best = 256; /* bigger than any value */
225 unsigned div;
226 int ptr;
227
228 if (!nr_armdiv)
229 return -EINVAL;
230
231 for (ptr = 0; ptr < nr_armdiv; ptr++) {
232 div = armdiv[ptr];
233 if (div) {
234 /* cpufreq provides 266mhz as 266666000 not 266666666 */
235 calc = (parent / div / 1000) * 1000;
236 if (calc <= rate && div < best)
237 best = div;
238 }
239 }
240
241 return parent / best;
242}
243
244static unsigned long s3c2443_armclk_getrate(struct clk *clk)
245{
246 unsigned long rate = clk_get_rate(clk->parent);
247 unsigned long clkcon0;
248 int val;
249
250 if (!nr_armdiv || !armdivmask)
251 return -EINVAL;
252
253 clkcon0 = __raw_readl(S3C2443_CLKDIV0);
254 clkcon0 &= armdivmask;
255 val = clkcon0 >> S3C2443_CLKDIV0_ARMDIV_SHIFT;
256
257 return rate / armdiv[val];
258}
259
260static int s3c2443_armclk_setrate(struct clk *clk, unsigned long rate)
261{
262 unsigned long parent = clk_get_rate(clk->parent);
263 unsigned long calc;
264 unsigned div;
265 unsigned best = 256; /* bigger than any value */
266 int ptr;
267 int val = -1;
268
269 if (!nr_armdiv || !armdivmask)
270 return -EINVAL;
271
272 for (ptr = 0; ptr < nr_armdiv; ptr++) {
273 div = armdiv[ptr];
274 if (div) {
275 /* cpufreq provides 266mhz as 266666000 not 266666666 */
276 calc = (parent / div / 1000) * 1000;
277 if (calc <= rate && div < best) {
278 best = div;
279 val = ptr;
280 }
281 }
282 }
283
284 if (val >= 0) {
285 unsigned long clkcon0;
286
287 clkcon0 = __raw_readl(S3C2443_CLKDIV0);
288 clkcon0 &= ~armdivmask;
289 clkcon0 |= val << S3C2443_CLKDIV0_ARMDIV_SHIFT;
290 __raw_writel(clkcon0, S3C2443_CLKDIV0);
291 }
292
293 return (val == -1) ? -EINVAL : 0;
294}
295
296static struct clk clk_armdiv = {
297 .name = "armdiv",
298 .parent = &clk_msysclk.clk,
299 .ops = &(struct clk_ops) {
300 .round_rate = s3c2443_armclk_roundrate,
301 .get_rate = s3c2443_armclk_getrate,
302 .set_rate = s3c2443_armclk_setrate,
303 },
304};
305
306/* armclk
307 *
308 * this is the clock fed into the ARM core itself, from armdiv or from hclk.
309 */
310
311static struct clk *clk_arm_sources[] = {
312 [0] = &clk_armdiv,
313 [1] = &clk_h,
314};
315
316static struct clksrc_clk clk_arm = {
317 .clk = {
318 .name = "armclk",
319 },
320 .sources = &(struct clksrc_sources) {
321 .sources = clk_arm_sources,
322 .nr_sources = ARRAY_SIZE(clk_arm_sources),
323 },
324 .reg_src = { .reg = S3C2443_CLKDIV0, .size = 1, .shift = 13 },
325};
326
327/* usbhost
328 *
329 * usb host bus-clock, usually 48MHz to provide USB bus clock timing
330*/
331
332static struct clksrc_clk clk_usb_bus_host = {
333 .clk = {
334 .name = "usb-bus-host-parent",
335 .parent = &clk_esysclk.clk,
336 .ctrlbit = S3C2443_SCLKCON_USBHOST,
337 .enable = s3c2443_clkcon_enable_s,
338 },
339 .reg_div = { .reg = S3C2443_CLKDIV1, .size = 2, .shift = 4 },
340};
341
342/* common clksrc clocks */
343
344static struct clksrc_clk clksrc_clks[] = {
345 {
346 /* camera interface bus-clock, divided down from esysclk */
347 .clk = {
348 .name = "camif-upll", /* same as 2440 name */
349 .parent = &clk_esysclk.clk,
350 .ctrlbit = S3C2443_SCLKCON_CAMCLK,
351 .enable = s3c2443_clkcon_enable_s,
352 },
353 .reg_div = { .reg = S3C2443_CLKDIV1, .size = 4, .shift = 26 },
354 }, {
355 .clk = {
356 .name = "display-if",
357 .parent = &clk_esysclk.clk,
358 .ctrlbit = S3C2443_SCLKCON_DISPCLK,
359 .enable = s3c2443_clkcon_enable_s,
360 },
361 .reg_div = { .reg = S3C2443_CLKDIV1, .size = 8, .shift = 16 },
362 },
363};
364
365static struct clksrc_clk clk_esys_uart = {
366 /* ART baud-rate clock sourced from esysclk via a divisor */
367 .clk = {
368 .name = "uartclk",
369 .parent = &clk_esysclk.clk,
370 },
371 .reg_div = { .reg = S3C2443_CLKDIV1, .size = 4, .shift = 8 },
372};
373
374static struct clk clk_i2s_ext = {
375 .name = "i2s-ext",
376};
377
378/* i2s_eplldiv
379 *
380 * This clock is the output from the I2S divisor of ESYSCLK, and is separate
381 * from the mux that comes after it (cannot merge into one single clock)
382*/
383
384static struct clksrc_clk clk_i2s_eplldiv = {
385 .clk = {
386 .name = "i2s-eplldiv",
387 .parent = &clk_esysclk.clk,
388 },
389 .reg_div = { .reg = S3C2443_CLKDIV1, .size = 4, .shift = 12, },
390};
391
392/* i2s-ref
393 *
394 * i2s bus reference clock, selectable from external, esysclk or epllref
395 *
396 * Note, this used to be two clocks, but was compressed into one.
397*/
398
399static struct clk *clk_i2s_srclist[] = {
400 [0] = &clk_i2s_eplldiv.clk,
401 [1] = &clk_i2s_ext,
402 [2] = &clk_epllref.clk,
403 [3] = &clk_epllref.clk,
404};
405
406static struct clksrc_clk clk_i2s = {
407 .clk = {
408 .name = "i2s-if",
409 .ctrlbit = S3C2443_SCLKCON_I2SCLK,
410 .enable = s3c2443_clkcon_enable_s,
411
412 },
413 .sources = &(struct clksrc_sources) {
414 .sources = clk_i2s_srclist,
415 .nr_sources = ARRAY_SIZE(clk_i2s_srclist),
416 },
417 .reg_src = { .reg = S3C2443_CLKSRC, .size = 2, .shift = 14 },
418};
419
420static struct clk init_clocks_off[] = {
421 {
422 .name = "iis",
423 .parent = &clk_p,
424 .enable = s3c2443_clkcon_enable_p,
425 .ctrlbit = S3C2443_PCLKCON_IIS,
426 }, {
427 .name = "adc",
428 .parent = &clk_p,
429 .enable = s3c2443_clkcon_enable_p,
430 .ctrlbit = S3C2443_PCLKCON_ADC,
431 }, {
432 .name = "i2c",
433 .parent = &clk_p,
434 .enable = s3c2443_clkcon_enable_p,
435 .ctrlbit = S3C2443_PCLKCON_IIC,
436 }
437};
438
439static struct clk init_clocks[] = {
440 {
441 .name = "dma.0",
442 .parent = &clk_h,
443 .enable = s3c2443_clkcon_enable_h,
444 .ctrlbit = S3C2443_HCLKCON_DMA0,
445 }, {
446 .name = "dma.1",
447 .parent = &clk_h,
448 .enable = s3c2443_clkcon_enable_h,
449 .ctrlbit = S3C2443_HCLKCON_DMA1,
450 }, {
451 .name = "dma.2",
452 .parent = &clk_h,
453 .enable = s3c2443_clkcon_enable_h,
454 .ctrlbit = S3C2443_HCLKCON_DMA2,
455 }, {
456 .name = "dma.3",
457 .parent = &clk_h,
458 .enable = s3c2443_clkcon_enable_h,
459 .ctrlbit = S3C2443_HCLKCON_DMA3,
460 }, {
461 .name = "dma.4",
462 .parent = &clk_h,
463 .enable = s3c2443_clkcon_enable_h,
464 .ctrlbit = S3C2443_HCLKCON_DMA4,
465 }, {
466 .name = "dma.5",
467 .parent = &clk_h,
468 .enable = s3c2443_clkcon_enable_h,
469 .ctrlbit = S3C2443_HCLKCON_DMA5,
470 }, {
471 .name = "gpio",
472 .parent = &clk_p,
473 .enable = s3c2443_clkcon_enable_p,
474 .ctrlbit = S3C2443_PCLKCON_GPIO,
475 }, {
476 .name = "usb-host",
477 .parent = &clk_h,
478 .enable = s3c2443_clkcon_enable_h,
479 .ctrlbit = S3C2443_HCLKCON_USBH,
480 }, {
481 .name = "usb-device",
482 .parent = &clk_h,
483 .enable = s3c2443_clkcon_enable_h,
484 .ctrlbit = S3C2443_HCLKCON_USBD,
485 }, {
486 .name = "lcd",
487 .parent = &clk_h,
488 .enable = s3c2443_clkcon_enable_h,
489 .ctrlbit = S3C2443_HCLKCON_LCDC,
490
491 }, {
492 .name = "timers",
493 .parent = &clk_p,
494 .enable = s3c2443_clkcon_enable_p,
495 .ctrlbit = S3C2443_PCLKCON_PWMT,
496 }, {
497 .name = "cfc",
498 .parent = &clk_h,
499 .enable = s3c2443_clkcon_enable_h,
500 .ctrlbit = S3C2443_HCLKCON_CFC,
501 }, {
502 .name = "ssmc",
503 .parent = &clk_h,
504 .enable = s3c2443_clkcon_enable_h,
505 .ctrlbit = S3C2443_HCLKCON_SSMC,
506 }, {
507 .name = "uart",
508 .devname = "s3c2440-uart.0",
509 .parent = &clk_p,
510 .enable = s3c2443_clkcon_enable_p,
511 .ctrlbit = S3C2443_PCLKCON_UART0,
512 }, {
513 .name = "uart",
514 .devname = "s3c2440-uart.1",
515 .parent = &clk_p,
516 .enable = s3c2443_clkcon_enable_p,
517 .ctrlbit = S3C2443_PCLKCON_UART1,
518 }, {
519 .name = "uart",
520 .devname = "s3c2440-uart.2",
521 .parent = &clk_p,
522 .enable = s3c2443_clkcon_enable_p,
523 .ctrlbit = S3C2443_PCLKCON_UART2,
524 }, {
525 .name = "uart",
526 .devname = "s3c2440-uart.3",
527 .parent = &clk_p,
528 .enable = s3c2443_clkcon_enable_p,
529 .ctrlbit = S3C2443_PCLKCON_UART3,
530 }, {
531 .name = "rtc",
532 .parent = &clk_p,
533 .enable = s3c2443_clkcon_enable_p,
534 .ctrlbit = S3C2443_PCLKCON_RTC,
535 }, {
536 .name = "watchdog",
537 .parent = &clk_p,
538 .ctrlbit = S3C2443_PCLKCON_WDT,
539 }, {
540 .name = "ac97",
541 .parent = &clk_p,
542 .ctrlbit = S3C2443_PCLKCON_AC97,
543 }, {
544 .name = "nand",
545 .parent = &clk_h,
546 }, {
547 .name = "usb-bus-host",
548 .parent = &clk_usb_bus_host.clk,
549 }
550};
551
552static struct clk hsmmc1_clk = {
553 .name = "hsmmc",
554 .devname = "s3c-sdhci.1",
555 .parent = &clk_h,
556 .enable = s3c2443_clkcon_enable_h,
557 .ctrlbit = S3C2443_HCLKCON_HSMMC,
558};
559
560static struct clk hsspi_clk = {
561 .name = "spi",
562 .devname = "s3c2443-spi.0",
563 .parent = &clk_p,
564 .enable = s3c2443_clkcon_enable_p,
565 .ctrlbit = S3C2443_PCLKCON_HSSPI,
566};
567
568/* EPLLCON compatible enough to get on/off information */
569
570void __init_or_cpufreq s3c2443_common_setup_clocks(pll_fn get_mpll)
571{
572 unsigned long epllcon = __raw_readl(S3C2443_EPLLCON);
573 unsigned long mpllcon = __raw_readl(S3C2443_MPLLCON);
574 struct clk *xtal_clk;
575 unsigned long xtal;
576 unsigned long pll;
577 int ptr;
578
579 xtal_clk = clk_get(NULL, "xtal");
580 xtal = clk_get_rate(xtal_clk);
581 clk_put(xtal_clk);
582
583 pll = get_mpll(mpllcon, xtal);
584 clk_msysclk.clk.rate = pll;
585 clk_mpll.rate = pll;
586
587 printk("CPU: MPLL %s %ld.%03ld MHz, cpu %ld.%03ld MHz, mem %ld.%03ld MHz, pclk %ld.%03ld MHz\n",
588 (mpllcon & S3C2443_PLLCON_OFF) ? "off" : "on",
589 print_mhz(pll), print_mhz(clk_get_rate(&clk_armdiv)),
590 print_mhz(clk_get_rate(&clk_h)),
591 print_mhz(clk_get_rate(&clk_p)));
592
593 for (ptr = 0; ptr < ARRAY_SIZE(clksrc_clks); ptr++)
594 s3c_set_clksrc(&clksrc_clks[ptr], true);
595
596 /* ensure usb bus clock is within correct rate of 48MHz */
597
598 if (clk_get_rate(&clk_usb_bus_host.clk) != (48 * 1000 * 1000)) {
599 printk(KERN_INFO "Warning: USB host bus not at 48MHz\n");
600 clk_set_rate(&clk_usb_bus_host.clk, 48*1000*1000);
601 }
602
603 printk("CPU: EPLL %s %ld.%03ld MHz, usb-bus %ld.%03ld MHz\n",
604 (epllcon & S3C2443_PLLCON_OFF) ? "off" : "on",
605 print_mhz(clk_get_rate(&clk_epll)),
606 print_mhz(clk_get_rate(&clk_usb_bus)));
607}
608
609static struct clk *clks[] __initdata = {
610 &clk_prediv,
611 &clk_mpllref,
612 &clk_mdivclk,
613 &clk_ext,
614 &clk_epll,
615 &clk_usb_bus,
616 &clk_armdiv,
617 &hsmmc1_clk,
618 &hsspi_clk,
619};
620
621static struct clksrc_clk *clksrcs[] __initdata = {
622 &clk_i2s_eplldiv,
623 &clk_i2s,
624 &clk_usb_bus_host,
625 &clk_epllref,
626 &clk_esysclk,
627 &clk_msysclk,
628 &clk_arm,
629};
630
631static struct clk_lookup s3c2443_clk_lookup[] = {
632 CLKDEV_INIT(NULL, "clk_uart_baud1", &s3c24xx_uclk),
633 CLKDEV_INIT(NULL, "clk_uart_baud2", &clk_p),
634 CLKDEV_INIT(NULL, "clk_uart_baud3", &clk_esys_uart.clk),
635 CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.0", &hsmmc1_clk),
636 CLKDEV_INIT("s3c2443-spi.0", "spi_busclk0", &hsspi_clk),
637};
638
639void __init s3c2443_common_init_clocks(int xtal, pll_fn get_mpll,
640 unsigned int *divs, int nr_divs,
641 int divmask)
642{
643 int ptr;
644
645 armdiv = divs;
646 nr_armdiv = nr_divs;
647 armdivmask = divmask;
648
649 /* s3c2443 parents h clock from prediv */
650 clk_h.parent = &clk_prediv;
651 clk_h.ops = &clk_h_ops;
652
653 /* and p clock from h clock */
654 clk_p.parent = &clk_h;
655 clk_p.ops = &clk_p_ops;
656
657 clk_usb_bus.parent = &clk_usb_bus_host.clk;
658 clk_epll.parent = &clk_epllref.clk;
659
660 s3c24xx_register_baseclocks(xtal);
661 s3c24xx_register_clocks(clks, ARRAY_SIZE(clks));
662
663 for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++)
664 s3c_register_clksrc(clksrcs[ptr], 1);
665
666 s3c_register_clksrc(clksrc_clks, ARRAY_SIZE(clksrc_clks));
667 s3c_register_clocks(init_clocks, ARRAY_SIZE(init_clocks));
668
669 /* See s3c2443/etc notes on disabling clocks at init time */
670 s3c_register_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
671 s3c_disable_clocks(init_clocks_off, ARRAY_SIZE(init_clocks_off));
672 clkdev_add_table(s3c2443_clk_lookup, ARRAY_SIZE(s3c2443_clk_lookup));
673
674 s3c2443_common_setup_clocks(get_mpll);
675}
diff --git a/arch/arm/mach-s3c24xx/common.c b/arch/arm/mach-s3c24xx/common.c
index 1bc8e73c94f9..c0763b837745 100644
--- a/arch/arm/mach-s3c24xx/common.c
+++ b/arch/arm/mach-s3c24xx/common.c
@@ -53,6 +53,7 @@
53#include <plat/cpu-freq.h> 53#include <plat/cpu-freq.h>
54#include <plat/pll.h> 54#include <plat/pll.h>
55#include <plat/pwm-core.h> 55#include <plat/pwm-core.h>
56#include <plat/watchdog-reset.h>
56 57
57#include "common.h" 58#include "common.h"
58 59
@@ -73,7 +74,6 @@ static struct cpu_table cpu_ids[] __initdata = {
73 .idcode = 0x32410000, 74 .idcode = 0x32410000,
74 .idmask = 0xffffffff, 75 .idmask = 0xffffffff,
75 .map_io = s3c2410_map_io, 76 .map_io = s3c2410_map_io,
76 .init_clocks = s3c2410_init_clocks,
77 .init_uarts = s3c2410_init_uarts, 77 .init_uarts = s3c2410_init_uarts,
78 .init = s3c2410_init, 78 .init = s3c2410_init,
79 .name = name_s3c2410 79 .name = name_s3c2410
@@ -82,7 +82,6 @@ static struct cpu_table cpu_ids[] __initdata = {
82 .idcode = 0x32410002, 82 .idcode = 0x32410002,
83 .idmask = 0xffffffff, 83 .idmask = 0xffffffff,
84 .map_io = s3c2410_map_io, 84 .map_io = s3c2410_map_io,
85 .init_clocks = s3c2410_init_clocks,
86 .init_uarts = s3c2410_init_uarts, 85 .init_uarts = s3c2410_init_uarts,
87 .init = s3c2410a_init, 86 .init = s3c2410a_init,
88 .name = name_s3c2410a 87 .name = name_s3c2410a
@@ -91,7 +90,6 @@ static struct cpu_table cpu_ids[] __initdata = {
91 .idcode = 0x32440000, 90 .idcode = 0x32440000,
92 .idmask = 0xffffffff, 91 .idmask = 0xffffffff,
93 .map_io = s3c2440_map_io, 92 .map_io = s3c2440_map_io,
94 .init_clocks = s3c244x_init_clocks,
95 .init_uarts = s3c244x_init_uarts, 93 .init_uarts = s3c244x_init_uarts,
96 .init = s3c2440_init, 94 .init = s3c2440_init,
97 .name = name_s3c2440 95 .name = name_s3c2440
@@ -100,7 +98,6 @@ static struct cpu_table cpu_ids[] __initdata = {
100 .idcode = 0x32440001, 98 .idcode = 0x32440001,
101 .idmask = 0xffffffff, 99 .idmask = 0xffffffff,
102 .map_io = s3c2440_map_io, 100 .map_io = s3c2440_map_io,
103 .init_clocks = s3c244x_init_clocks,
104 .init_uarts = s3c244x_init_uarts, 101 .init_uarts = s3c244x_init_uarts,
105 .init = s3c2440_init, 102 .init = s3c2440_init,
106 .name = name_s3c2440a 103 .name = name_s3c2440a
@@ -109,7 +106,6 @@ static struct cpu_table cpu_ids[] __initdata = {
109 .idcode = 0x32440aaa, 106 .idcode = 0x32440aaa,
110 .idmask = 0xffffffff, 107 .idmask = 0xffffffff,
111 .map_io = s3c2442_map_io, 108 .map_io = s3c2442_map_io,
112 .init_clocks = s3c244x_init_clocks,
113 .init_uarts = s3c244x_init_uarts, 109 .init_uarts = s3c244x_init_uarts,
114 .init = s3c2442_init, 110 .init = s3c2442_init,
115 .name = name_s3c2442 111 .name = name_s3c2442
@@ -118,7 +114,6 @@ static struct cpu_table cpu_ids[] __initdata = {
118 .idcode = 0x32440aab, 114 .idcode = 0x32440aab,
119 .idmask = 0xffffffff, 115 .idmask = 0xffffffff,
120 .map_io = s3c2442_map_io, 116 .map_io = s3c2442_map_io,
121 .init_clocks = s3c244x_init_clocks,
122 .init_uarts = s3c244x_init_uarts, 117 .init_uarts = s3c244x_init_uarts,
123 .init = s3c2442_init, 118 .init = s3c2442_init,
124 .name = name_s3c2442b 119 .name = name_s3c2442b
@@ -127,7 +122,6 @@ static struct cpu_table cpu_ids[] __initdata = {
127 .idcode = 0x32412001, 122 .idcode = 0x32412001,
128 .idmask = 0xffffffff, 123 .idmask = 0xffffffff,
129 .map_io = s3c2412_map_io, 124 .map_io = s3c2412_map_io,
130 .init_clocks = s3c2412_init_clocks,
131 .init_uarts = s3c2412_init_uarts, 125 .init_uarts = s3c2412_init_uarts,
132 .init = s3c2412_init, 126 .init = s3c2412_init,
133 .name = name_s3c2412, 127 .name = name_s3c2412,
@@ -136,7 +130,6 @@ static struct cpu_table cpu_ids[] __initdata = {
136 .idcode = 0x32412003, 130 .idcode = 0x32412003,
137 .idmask = 0xffffffff, 131 .idmask = 0xffffffff,
138 .map_io = s3c2412_map_io, 132 .map_io = s3c2412_map_io,
139 .init_clocks = s3c2412_init_clocks,
140 .init_uarts = s3c2412_init_uarts, 133 .init_uarts = s3c2412_init_uarts,
141 .init = s3c2412_init, 134 .init = s3c2412_init,
142 .name = name_s3c2412, 135 .name = name_s3c2412,
@@ -145,7 +138,6 @@ static struct cpu_table cpu_ids[] __initdata = {
145 .idcode = 0x32450003, 138 .idcode = 0x32450003,
146 .idmask = 0xffffffff, 139 .idmask = 0xffffffff,
147 .map_io = s3c2416_map_io, 140 .map_io = s3c2416_map_io,
148 .init_clocks = s3c2416_init_clocks,
149 .init_uarts = s3c2416_init_uarts, 141 .init_uarts = s3c2416_init_uarts,
150 .init = s3c2416_init, 142 .init = s3c2416_init,
151 .name = name_s3c2416, 143 .name = name_s3c2416,
@@ -154,7 +146,6 @@ static struct cpu_table cpu_ids[] __initdata = {
154 .idcode = 0x32443001, 146 .idcode = 0x32443001,
155 .idmask = 0xffffffff, 147 .idmask = 0xffffffff,
156 .map_io = s3c2443_map_io, 148 .map_io = s3c2443_map_io,
157 .init_clocks = s3c2443_init_clocks,
158 .init_uarts = s3c2443_init_uarts, 149 .init_uarts = s3c2443_init_uarts,
159 .init = s3c2443_init, 150 .init = s3c2443_init,
160 .name = name_s3c2443, 151 .name = name_s3c2443,
@@ -316,21 +307,6 @@ struct s3c24xx_uart_resources s3c2410_uart_resources[] __initdata = {
316 }, 307 },
317}; 308};
318 309
319/* initialise all the clocks */
320
321void __init_or_cpufreq s3c24xx_setup_clocks(unsigned long fclk,
322 unsigned long hclk,
323 unsigned long pclk)
324{
325 clk_upll.rate = s3c24xx_get_pll(__raw_readl(S3C2410_UPLLCON),
326 clk_xtal.rate);
327
328 clk_mpll.rate = fclk;
329 clk_h.rate = hclk;
330 clk_p.rate = pclk;
331 clk_f.rate = fclk;
332}
333
334#if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2412) || \ 310#if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2412) || \
335 defined(CONFIG_CPU_S3C2440) || defined(CONFIG_CPU_S3C2442) 311 defined(CONFIG_CPU_S3C2440) || defined(CONFIG_CPU_S3C2442)
336static struct resource s3c2410_dma_resource[] = { 312static struct resource s3c2410_dma_resource[] = {
@@ -534,3 +510,62 @@ struct platform_device s3c2443_device_dma = {
534 }, 510 },
535}; 511};
536#endif 512#endif
513
514#if defined(CONFIG_COMMON_CLK) && defined(CONFIG_CPU_S3C2410)
515void __init s3c2410_init_clocks(int xtal)
516{
517 s3c2410_common_clk_init(NULL, xtal, 0, S3C24XX_VA_CLKPWR);
518 samsung_wdt_reset_init(S3C24XX_VA_WATCHDOG);
519}
520#endif
521
522#ifdef CONFIG_CPU_S3C2412
523void __init s3c2412_init_clocks(int xtal)
524{
525 s3c2412_common_clk_init(NULL, xtal, 0, S3C24XX_VA_CLKPWR);
526}
527#endif
528
529#ifdef CONFIG_CPU_S3C2416
530void __init s3c2416_init_clocks(int xtal)
531{
532 s3c2443_common_clk_init(NULL, xtal, 0, S3C24XX_VA_CLKPWR);
533}
534#endif
535
536#if defined(CONFIG_COMMON_CLK) && defined(CONFIG_CPU_S3C2440)
537void __init s3c2440_init_clocks(int xtal)
538{
539 s3c2410_common_clk_init(NULL, xtal, 1, S3C24XX_VA_CLKPWR);
540 samsung_wdt_reset_init(S3C24XX_VA_WATCHDOG);
541}
542#endif
543
544#if defined(CONFIG_COMMON_CLK) && defined(CONFIG_CPU_S3C2442)
545void __init s3c2442_init_clocks(int xtal)
546{
547 s3c2410_common_clk_init(NULL, xtal, 2, S3C24XX_VA_CLKPWR);
548 samsung_wdt_reset_init(S3C24XX_VA_WATCHDOG);
549}
550#endif
551
552#ifdef CONFIG_CPU_S3C2443
553void __init s3c2443_init_clocks(int xtal)
554{
555 s3c2443_common_clk_init(NULL, xtal, 1, S3C24XX_VA_CLKPWR);
556}
557#endif
558
559#if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2440) || \
560 defined(CONFIG_CPU_S3C2442)
561static struct resource s3c2410_dclk_resource[] = {
562 [0] = DEFINE_RES_MEM(0x56000084, 0x4),
563};
564
565struct platform_device s3c2410_device_dclk = {
566 .name = "s3c2410-dclk",
567 .id = 0,
568 .num_resources = ARRAY_SIZE(s3c2410_dclk_resource),
569 .resource = s3c2410_dclk_resource,
570};
571#endif
diff --git a/arch/arm/mach-s3c24xx/common.h b/arch/arm/mach-s3c24xx/common.h
index e46c10417216..ac3ff12a0601 100644
--- a/arch/arm/mach-s3c24xx/common.h
+++ b/arch/arm/mach-s3c24xx/common.h
@@ -67,16 +67,15 @@ extern struct syscore_ops s3c2416_irq_syscore_ops;
67#if defined(CONFIG_CPU_S3C2440) || defined(CONFIG_CPU_S3C2442) 67#if defined(CONFIG_CPU_S3C2440) || defined(CONFIG_CPU_S3C2442)
68extern void s3c244x_map_io(void); 68extern void s3c244x_map_io(void);
69extern void s3c244x_init_uarts(struct s3c2410_uartcfg *cfg, int no); 69extern void s3c244x_init_uarts(struct s3c2410_uartcfg *cfg, int no);
70extern void s3c244x_init_clocks(int xtal);
71extern void s3c244x_restart(enum reboot_mode mode, const char *cmd); 70extern void s3c244x_restart(enum reboot_mode mode, const char *cmd);
72#else 71#else
73#define s3c244x_init_clocks NULL
74#define s3c244x_init_uarts NULL 72#define s3c244x_init_uarts NULL
75#endif 73#endif
76 74
77#ifdef CONFIG_CPU_S3C2440 75#ifdef CONFIG_CPU_S3C2440
78extern int s3c2440_init(void); 76extern int s3c2440_init(void);
79extern void s3c2440_map_io(void); 77extern void s3c2440_map_io(void);
78extern void s3c2440_init_clocks(int xtal);
80extern void s3c2440_init_irq(void); 79extern void s3c2440_init_irq(void);
81#else 80#else
82#define s3c2440_init NULL 81#define s3c2440_init NULL
@@ -86,6 +85,7 @@ extern void s3c2440_init_irq(void);
86#ifdef CONFIG_CPU_S3C2442 85#ifdef CONFIG_CPU_S3C2442
87extern int s3c2442_init(void); 86extern int s3c2442_init(void);
88extern void s3c2442_map_io(void); 87extern void s3c2442_map_io(void);
88extern void s3c2442_init_clocks(int xtal);
89extern void s3c2442_init_irq(void); 89extern void s3c2442_init_irq(void);
90#else 90#else
91#define s3c2442_init NULL 91#define s3c2442_init NULL
@@ -114,4 +114,21 @@ extern struct platform_device s3c2412_device_dma;
114extern struct platform_device s3c2440_device_dma; 114extern struct platform_device s3c2440_device_dma;
115extern struct platform_device s3c2443_device_dma; 115extern struct platform_device s3c2443_device_dma;
116 116
117extern struct platform_device s3c2410_device_dclk;
118
119#ifdef CONFIG_S3C2410_COMMON_CLK
120void __init s3c2410_common_clk_init(struct device_node *np, unsigned long xti_f,
121 int current_soc,
122 void __iomem *reg_base);
123#endif
124#ifdef CONFIG_S3C2412_COMMON_CLK
125void __init s3c2412_common_clk_init(struct device_node *np, unsigned long xti_f,
126 unsigned long ext_f, void __iomem *reg_base);
127#endif
128#ifdef CONFIG_S3C2443_COMMON_CLK
129void __init s3c2443_common_clk_init(struct device_node *np, unsigned long xti_f,
130 int current_soc,
131 void __iomem *reg_base);
132#endif
133
117#endif /* __ARCH_ARM_MACH_S3C24XX_COMMON_H */ 134#endif /* __ARCH_ARM_MACH_S3C24XX_COMMON_H */
diff --git a/arch/arm/mach-s3c24xx/cpufreq-utils.c b/arch/arm/mach-s3c24xx/cpufreq-utils.c
index 2a0aa5684e72..d4d9514335f4 100644
--- a/arch/arm/mach-s3c24xx/cpufreq-utils.c
+++ b/arch/arm/mach-s3c24xx/cpufreq-utils.c
@@ -14,6 +14,7 @@
14#include <linux/errno.h> 14#include <linux/errno.h>
15#include <linux/cpufreq.h> 15#include <linux/cpufreq.h>
16#include <linux/io.h> 16#include <linux/io.h>
17#include <linux/clk.h>
17 18
18#include <mach/map.h> 19#include <mach/map.h>
19#include <mach/regs-clock.h> 20#include <mach/regs-clock.h>
@@ -60,5 +61,6 @@ void s3c2410_cpufreq_setrefresh(struct s3c_cpufreq_config *cfg)
60 */ 61 */
61void s3c2410_set_fvco(struct s3c_cpufreq_config *cfg) 62void s3c2410_set_fvco(struct s3c_cpufreq_config *cfg)
62{ 63{
63 __raw_writel(cfg->pll.driver_data, S3C2410_MPLLCON); 64 if (!IS_ERR(cfg->mpll))
65 clk_set_rate(cfg->mpll, cfg->pll.frequency);
64} 66}
diff --git a/arch/arm/mach-s3c24xx/include/mach/debug-macro.S b/arch/arm/mach-s3c24xx/include/mach/debug-macro.S
deleted file mode 100644
index 2f39737544c0..000000000000
--- a/arch/arm/mach-s3c24xx/include/mach/debug-macro.S
+++ /dev/null
@@ -1,101 +0,0 @@
1/* arch/arm/mach-s3c2410/include/mach/debug-macro.S
2 *
3 * Debugging macro include header
4 *
5 * Copyright (C) 1994-1999 Russell King
6 * Copyright (C) 2005 Simtec Electronics
7 *
8 * Moved from linux/arch/arm/kernel/debug.S by Ben Dooks
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#include <mach/map.h>
16#include <mach/regs-gpio.h>
17#include <linux/serial_s3c.h>
18
19#define S3C2410_UART1_OFF (0x4000)
20#define SHIFT_2440TXF (14-9)
21
22 .macro addruart, rp, rv, tmp
23 ldr \rp, = S3C24XX_PA_UART
24 ldr \rv, = S3C24XX_VA_UART
25#if CONFIG_DEBUG_S3C_UART != 0
26 add \rp, \rp, #(S3C2410_UART1_OFF * CONFIG_DEBUG_S3C_UART)
27 add \rv, \rv, #(S3C2410_UART1_OFF * CONFIG_DEBUG_S3C_UART)
28#endif
29 .endm
30
31 .macro fifo_full_s3c24xx rd, rx
32 @ check for arm920 vs arm926. currently assume all arm926
33 @ devices have an 64 byte FIFO identical to the s3c2440
34 mrc p15, 0, \rd, c0, c0
35 and \rd, \rd, #0xff0
36 teq \rd, #0x260
37 beq 1004f
38 mrc p15, 0, \rd, c1, c0
39 tst \rd, #1
40 addeq \rd, \rx, #(S3C24XX_PA_GPIO - S3C24XX_PA_UART)
41 addne \rd, \rx, #(S3C24XX_VA_GPIO - S3C24XX_VA_UART)
42 bic \rd, \rd, #0xff000
43 ldr \rd, [\rd, # S3C2410_GSTATUS1 - S3C2410_GPIOREG(0)]
44 and \rd, \rd, #0x00ff0000
45 teq \rd, #0x00440000 @ is it 2440?
461004:
47 ldr \rd, [\rx, # S3C2410_UFSTAT]
48 moveq \rd, \rd, lsr #SHIFT_2440TXF
49 tst \rd, #S3C2410_UFSTAT_TXFULL
50 .endm
51
52 .macro fifo_full_s3c2410 rd, rx
53 ldr \rd, [\rx, # S3C2410_UFSTAT]
54 tst \rd, #S3C2410_UFSTAT_TXFULL
55 .endm
56
57/* fifo level reading */
58
59 .macro fifo_level_s3c24xx rd, rx
60 @ check for arm920 vs arm926. currently assume all arm926
61 @ devices have an 64 byte FIFO identical to the s3c2440
62 mrc p15, 0, \rd, c0, c0
63 and \rd, \rd, #0xff0
64 teq \rd, #0x260
65 beq 10000f
66 mrc p15, 0, \rd, c1, c0
67 tst \rd, #1
68 addeq \rd, \rx, #(S3C24XX_PA_GPIO - S3C24XX_PA_UART)
69 addne \rd, \rx, #(S3C24XX_VA_GPIO - S3C24XX_VA_UART)
70 bic \rd, \rd, #0xff000
71 ldr \rd, [\rd, # S3C2410_GSTATUS1 - S3C2410_GPIOREG(0)]
72 and \rd, \rd, #0x00ff0000
73 teq \rd, #0x00440000 @ is it 2440?
74
7510000:
76 ldr \rd, [\rx, # S3C2410_UFSTAT]
77 andne \rd, \rd, #S3C2410_UFSTAT_TXMASK
78 andeq \rd, \rd, #S3C2440_UFSTAT_TXMASK
79 .endm
80
81 .macro fifo_level_s3c2410 rd, rx
82 ldr \rd, [\rx, # S3C2410_UFSTAT]
83 and \rd, \rd, #S3C2410_UFSTAT_TXMASK
84 .endm
85
86/* Select the correct implementation depending on the configuration. The
87 * S3C2440 will get selected by default, as these are the most widely
88 * used variants of these
89*/
90
91#if defined(CONFIG_CPU_LLSERIAL_S3C2410_ONLY)
92#define fifo_full fifo_full_s3c2410
93#define fifo_level fifo_level_s3c2410
94#elif !defined(CONFIG_CPU_LLSERIAL_S3C2440_ONLY)
95#define fifo_full fifo_full_s3c24xx
96#define fifo_level fifo_level_s3c24xx
97#endif
98
99/* include the reset of the code which will do the work */
100
101#include <debug/samsung.S>
diff --git a/arch/arm/mach-s3c24xx/include/mach/regs-clock.h b/arch/arm/mach-s3c24xx/include/mach/regs-clock.h
index 3415b60082d7..3db6c10de023 100644
--- a/arch/arm/mach-s3c24xx/include/mach/regs-clock.h
+++ b/arch/arm/mach-s3c24xx/include/mach/regs-clock.h
@@ -42,24 +42,6 @@
42#define S3C2410_CLKCON_IIS (1<<17) 42#define S3C2410_CLKCON_IIS (1<<17)
43#define S3C2410_CLKCON_SPI (1<<18) 43#define S3C2410_CLKCON_SPI (1<<18)
44 44
45/* DCLKCON register addresses in gpio.h */
46
47#define S3C2410_DCLKCON_DCLK0EN (1<<0)
48#define S3C2410_DCLKCON_DCLK0_PCLK (0<<1)
49#define S3C2410_DCLKCON_DCLK0_UCLK (1<<1)
50#define S3C2410_DCLKCON_DCLK0_DIV(x) (((x) - 1 )<<4)
51#define S3C2410_DCLKCON_DCLK0_CMP(x) (((x) - 1 )<<8)
52#define S3C2410_DCLKCON_DCLK0_DIV_MASK ((0xf)<<4)
53#define S3C2410_DCLKCON_DCLK0_CMP_MASK ((0xf)<<8)
54
55#define S3C2410_DCLKCON_DCLK1EN (1<<16)
56#define S3C2410_DCLKCON_DCLK1_PCLK (0<<17)
57#define S3C2410_DCLKCON_DCLK1_UCLK (1<<17)
58#define S3C2410_DCLKCON_DCLK1_DIV(x) (((x) - 1) <<20)
59#define S3C2410_DCLKCON_DCLK1_CMP(x) (((x) - 1) <<24)
60#define S3C2410_DCLKCON_DCLK1_DIV_MASK ((0xf) <<20)
61#define S3C2410_DCLKCON_DCLK1_CMP_MASK ((0xf) <<24)
62
63#define S3C2410_CLKDIVN_PDIVN (1<<0) 45#define S3C2410_CLKDIVN_PDIVN (1<<0)
64#define S3C2410_CLKDIVN_HDIVN (1<<1) 46#define S3C2410_CLKDIVN_HDIVN (1<<1)
65 47
diff --git a/arch/arm/mach-s3c24xx/include/mach/regs-gpio.h b/arch/arm/mach-s3c24xx/include/mach/regs-gpio.h
index c2ef016032ab..c6583cfa5835 100644
--- a/arch/arm/mach-s3c24xx/include/mach/regs-gpio.h
+++ b/arch/arm/mach-s3c24xx/include/mach/regs-gpio.h
@@ -457,9 +457,6 @@
457 457
458/* miscellaneous control */ 458/* miscellaneous control */
459#define S3C2410_MISCCR S3C2410_GPIOREG(0x80) 459#define S3C2410_MISCCR S3C2410_GPIOREG(0x80)
460#define S3C2410_DCLKCON S3C2410_GPIOREG(0x84)
461
462#define S3C24XX_DCLKCON S3C24XX_GPIOREG2(0x84)
463 460
464/* see clock.h for dclk definitions */ 461/* see clock.h for dclk definitions */
465 462
diff --git a/arch/arm/mach-s3c24xx/mach-amlm5900.c b/arch/arm/mach-s3c24xx/mach-amlm5900.c
index 8ac9554aa996..5157e250dd13 100644
--- a/arch/arm/mach-s3c24xx/mach-amlm5900.c
+++ b/arch/arm/mach-s3c24xx/mach-amlm5900.c
@@ -161,11 +161,16 @@ static struct platform_device *amlm5900_devices[] __initdata = {
161static void __init amlm5900_map_io(void) 161static void __init amlm5900_map_io(void)
162{ 162{
163 s3c24xx_init_io(amlm5900_iodesc, ARRAY_SIZE(amlm5900_iodesc)); 163 s3c24xx_init_io(amlm5900_iodesc, ARRAY_SIZE(amlm5900_iodesc));
164 s3c24xx_init_clocks(0);
165 s3c24xx_init_uarts(amlm5900_uartcfgs, ARRAY_SIZE(amlm5900_uartcfgs)); 164 s3c24xx_init_uarts(amlm5900_uartcfgs, ARRAY_SIZE(amlm5900_uartcfgs));
166 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 165 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
167} 166}
168 167
168static void __init amlm5900_init_time(void)
169{
170 s3c2410_init_clocks(12000000);
171 samsung_timer_init();
172}
173
169#ifdef CONFIG_FB_S3C2410 174#ifdef CONFIG_FB_S3C2410
170static struct s3c2410fb_display __initdata amlm5900_lcd_info = { 175static struct s3c2410fb_display __initdata amlm5900_lcd_info = {
171 .width = 160, 176 .width = 160,
@@ -241,6 +246,6 @@ MACHINE_START(AML_M5900, "AML_M5900")
241 .map_io = amlm5900_map_io, 246 .map_io = amlm5900_map_io,
242 .init_irq = s3c2410_init_irq, 247 .init_irq = s3c2410_init_irq,
243 .init_machine = amlm5900_init, 248 .init_machine = amlm5900_init,
244 .init_time = samsung_timer_init, 249 .init_time = amlm5900_init_time,
245 .restart = s3c2410_restart, 250 .restart = s3c2410_restart,
246MACHINE_END 251MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-anubis.c b/arch/arm/mach-s3c24xx/mach-anubis.c
index 81a270af2336..e053581cab0b 100644
--- a/arch/arm/mach-s3c24xx/mach-anubis.c
+++ b/arch/arm/mach-s3c24xx/mach-anubis.c
@@ -46,7 +46,6 @@
46 46
47#include <net/ax88796.h> 47#include <net/ax88796.h>
48 48
49#include <plat/clock.h>
50#include <plat/devs.h> 49#include <plat/devs.h>
51#include <plat/cpu.h> 50#include <plat/cpu.h>
52#include <linux/platform_data/asoc-s3c24xx_simtec.h> 51#include <linux/platform_data/asoc-s3c24xx_simtec.h>
@@ -352,6 +351,7 @@ static struct platform_device anubis_device_sm501 = {
352/* Standard Anubis devices */ 351/* Standard Anubis devices */
353 352
354static struct platform_device *anubis_devices[] __initdata = { 353static struct platform_device *anubis_devices[] __initdata = {
354 &s3c2410_device_dclk,
355 &s3c_device_ohci, 355 &s3c_device_ohci,
356 &s3c_device_wdt, 356 &s3c_device_wdt,
357 &s3c_device_adc, 357 &s3c_device_adc,
@@ -364,14 +364,6 @@ static struct platform_device *anubis_devices[] __initdata = {
364 &anubis_device_sm501, 364 &anubis_device_sm501,
365}; 365};
366 366
367static struct clk *anubis_clocks[] __initdata = {
368 &s3c24xx_dclk0,
369 &s3c24xx_dclk1,
370 &s3c24xx_clkout0,
371 &s3c24xx_clkout1,
372 &s3c24xx_uclk,
373};
374
375/* I2C devices. */ 367/* I2C devices. */
376 368
377static struct i2c_board_info anubis_i2c_devs[] __initdata = { 369static struct i2c_board_info anubis_i2c_devs[] __initdata = {
@@ -394,23 +386,7 @@ static struct s3c24xx_audio_simtec_pdata __initdata anubis_audio = {
394 386
395static void __init anubis_map_io(void) 387static void __init anubis_map_io(void)
396{ 388{
397 /* initialise the clocks */
398
399 s3c24xx_dclk0.parent = &clk_upll;
400 s3c24xx_dclk0.rate = 12*1000*1000;
401
402 s3c24xx_dclk1.parent = &clk_upll;
403 s3c24xx_dclk1.rate = 24*1000*1000;
404
405 s3c24xx_clkout0.parent = &s3c24xx_dclk0;
406 s3c24xx_clkout1.parent = &s3c24xx_dclk1;
407
408 s3c24xx_uclk.parent = &s3c24xx_clkout1;
409
410 s3c24xx_register_clocks(anubis_clocks, ARRAY_SIZE(anubis_clocks));
411
412 s3c24xx_init_io(anubis_iodesc, ARRAY_SIZE(anubis_iodesc)); 389 s3c24xx_init_io(anubis_iodesc, ARRAY_SIZE(anubis_iodesc));
413 s3c24xx_init_clocks(0);
414 s3c24xx_init_uarts(anubis_uartcfgs, ARRAY_SIZE(anubis_uartcfgs)); 390 s3c24xx_init_uarts(anubis_uartcfgs, ARRAY_SIZE(anubis_uartcfgs));
415 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 391 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
416 392
@@ -428,6 +404,12 @@ static void __init anubis_map_io(void)
428 } 404 }
429} 405}
430 406
407static void __init anubis_init_time(void)
408{
409 s3c2440_init_clocks(12000000);
410 samsung_timer_init();
411}
412
431static void __init anubis_init(void) 413static void __init anubis_init(void)
432{ 414{
433 s3c_i2c0_set_platdata(NULL); 415 s3c_i2c0_set_platdata(NULL);
@@ -447,6 +429,6 @@ MACHINE_START(ANUBIS, "Simtec-Anubis")
447 .map_io = anubis_map_io, 429 .map_io = anubis_map_io,
448 .init_machine = anubis_init, 430 .init_machine = anubis_init,
449 .init_irq = s3c2440_init_irq, 431 .init_irq = s3c2440_init_irq,
450 .init_time = samsung_timer_init, 432 .init_time = anubis_init_time,
451 .restart = s3c244x_restart, 433 .restart = s3c244x_restart,
452MACHINE_END 434MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-at2440evb.c b/arch/arm/mach-s3c24xx/mach-at2440evb.c
index d8f6bb1096cb..9db768f448a5 100644
--- a/arch/arm/mach-s3c24xx/mach-at2440evb.c
+++ b/arch/arm/mach-s3c24xx/mach-at2440evb.c
@@ -45,7 +45,6 @@
45#include <linux/mtd/nand_ecc.h> 45#include <linux/mtd/nand_ecc.h>
46#include <linux/mtd/partitions.h> 46#include <linux/mtd/partitions.h>
47 47
48#include <plat/clock.h>
49#include <plat/devs.h> 48#include <plat/devs.h>
50#include <plat/cpu.h> 49#include <plat/cpu.h>
51#include <linux/platform_data/mmc-s3cmci.h> 50#include <linux/platform_data/mmc-s3cmci.h>
@@ -192,11 +191,16 @@ static struct platform_device *at2440evb_devices[] __initdata = {
192static void __init at2440evb_map_io(void) 191static void __init at2440evb_map_io(void)
193{ 192{
194 s3c24xx_init_io(at2440evb_iodesc, ARRAY_SIZE(at2440evb_iodesc)); 193 s3c24xx_init_io(at2440evb_iodesc, ARRAY_SIZE(at2440evb_iodesc));
195 s3c24xx_init_clocks(16934400);
196 s3c24xx_init_uarts(at2440evb_uartcfgs, ARRAY_SIZE(at2440evb_uartcfgs)); 194 s3c24xx_init_uarts(at2440evb_uartcfgs, ARRAY_SIZE(at2440evb_uartcfgs));
197 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 195 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
198} 196}
199 197
198static void __init at2440evb_init_time(void)
199{
200 s3c2440_init_clocks(16934400);
201 samsung_timer_init();
202}
203
200static void __init at2440evb_init(void) 204static void __init at2440evb_init(void)
201{ 205{
202 s3c24xx_fb_set_platdata(&at2440evb_fb_info); 206 s3c24xx_fb_set_platdata(&at2440evb_fb_info);
@@ -213,6 +217,6 @@ MACHINE_START(AT2440EVB, "AT2440EVB")
213 .map_io = at2440evb_map_io, 217 .map_io = at2440evb_map_io,
214 .init_machine = at2440evb_init, 218 .init_machine = at2440evb_init,
215 .init_irq = s3c2440_init_irq, 219 .init_irq = s3c2440_init_irq,
216 .init_time = samsung_timer_init, 220 .init_time = at2440evb_init_time,
217 .restart = s3c244x_restart, 221 .restart = s3c244x_restart,
218MACHINE_END 222MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-bast.c b/arch/arm/mach-s3c24xx/mach-bast.c
index e371ff53a408..f9112b801a33 100644
--- a/arch/arm/mach-s3c24xx/mach-bast.c
+++ b/arch/arm/mach-s3c24xx/mach-bast.c
@@ -51,7 +51,6 @@
51#include <mach/regs-lcd.h> 51#include <mach/regs-lcd.h>
52#include <mach/gpio-samsung.h> 52#include <mach/gpio-samsung.h>
53 53
54#include <plat/clock.h>
55#include <plat/cpu.h> 54#include <plat/cpu.h>
56#include <plat/cpu-freq.h> 55#include <plat/cpu-freq.h>
57#include <plat/devs.h> 56#include <plat/devs.h>
@@ -523,6 +522,7 @@ static struct s3c_hwmon_pdata bast_hwmon_info = {
523// cat /sys/devices/platform/s3c24xx-adc/s3c-hwmon/in_0 522// cat /sys/devices/platform/s3c24xx-adc/s3c-hwmon/in_0
524 523
525static struct platform_device *bast_devices[] __initdata = { 524static struct platform_device *bast_devices[] __initdata = {
525 &s3c2410_device_dclk,
526 &s3c_device_ohci, 526 &s3c_device_ohci,
527 &s3c_device_lcd, 527 &s3c_device_lcd,
528 &s3c_device_wdt, 528 &s3c_device_wdt,
@@ -537,14 +537,6 @@ static struct platform_device *bast_devices[] __initdata = {
537 &bast_sio, 537 &bast_sio,
538}; 538};
539 539
540static struct clk *bast_clocks[] __initdata = {
541 &s3c24xx_dclk0,
542 &s3c24xx_dclk1,
543 &s3c24xx_clkout0,
544 &s3c24xx_clkout1,
545 &s3c24xx_uclk,
546};
547
548static struct s3c_cpufreq_board __initdata bast_cpufreq = { 540static struct s3c_cpufreq_board __initdata bast_cpufreq = {
549 .refresh = 7800, /* 7.8usec */ 541 .refresh = 7800, /* 7.8usec */
550 .auto_io = 1, 542 .auto_io = 1,
@@ -558,29 +550,19 @@ static struct s3c24xx_audio_simtec_pdata __initdata bast_audio = {
558 550
559static void __init bast_map_io(void) 551static void __init bast_map_io(void)
560{ 552{
561 /* initialise the clocks */
562
563 s3c24xx_dclk0.parent = &clk_upll;
564 s3c24xx_dclk0.rate = 12*1000*1000;
565
566 s3c24xx_dclk1.parent = &clk_upll;
567 s3c24xx_dclk1.rate = 24*1000*1000;
568
569 s3c24xx_clkout0.parent = &s3c24xx_dclk0;
570 s3c24xx_clkout1.parent = &s3c24xx_dclk1;
571
572 s3c24xx_uclk.parent = &s3c24xx_clkout1;
573
574 s3c24xx_register_clocks(bast_clocks, ARRAY_SIZE(bast_clocks));
575
576 s3c_hwmon_set_platdata(&bast_hwmon_info); 553 s3c_hwmon_set_platdata(&bast_hwmon_info);
577 554
578 s3c24xx_init_io(bast_iodesc, ARRAY_SIZE(bast_iodesc)); 555 s3c24xx_init_io(bast_iodesc, ARRAY_SIZE(bast_iodesc));
579 s3c24xx_init_clocks(0);
580 s3c24xx_init_uarts(bast_uartcfgs, ARRAY_SIZE(bast_uartcfgs)); 556 s3c24xx_init_uarts(bast_uartcfgs, ARRAY_SIZE(bast_uartcfgs));
581 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 557 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
582} 558}
583 559
560static void __init bast_init_time(void)
561{
562 s3c2410_init_clocks(12000000);
563 samsung_timer_init();
564}
565
584static void __init bast_init(void) 566static void __init bast_init(void)
585{ 567{
586 register_syscore_ops(&bast_pm_syscore_ops); 568 register_syscore_ops(&bast_pm_syscore_ops);
@@ -608,6 +590,6 @@ MACHINE_START(BAST, "Simtec-BAST")
608 .map_io = bast_map_io, 590 .map_io = bast_map_io,
609 .init_irq = s3c2410_init_irq, 591 .init_irq = s3c2410_init_irq,
610 .init_machine = bast_init, 592 .init_machine = bast_init,
611 .init_time = samsung_timer_init, 593 .init_time = bast_init_time,
612 .restart = s3c2410_restart, 594 .restart = s3c2410_restart,
613MACHINE_END 595MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-gta02.c b/arch/arm/mach-s3c24xx/mach-gta02.c
index dc4db849f0fd..fc3a08d0cb3f 100644
--- a/arch/arm/mach-s3c24xx/mach-gta02.c
+++ b/arch/arm/mach-s3c24xx/mach-gta02.c
@@ -501,7 +501,6 @@ static struct platform_device gta02_buttons_device = {
501static void __init gta02_map_io(void) 501static void __init gta02_map_io(void)
502{ 502{
503 s3c24xx_init_io(gta02_iodesc, ARRAY_SIZE(gta02_iodesc)); 503 s3c24xx_init_io(gta02_iodesc, ARRAY_SIZE(gta02_iodesc));
504 s3c24xx_init_clocks(12000000);
505 s3c24xx_init_uarts(gta02_uartcfgs, ARRAY_SIZE(gta02_uartcfgs)); 504 s3c24xx_init_uarts(gta02_uartcfgs, ARRAY_SIZE(gta02_uartcfgs));
506 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 505 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
507} 506}
@@ -585,6 +584,11 @@ static void __init gta02_machine_init(void)
585 regulator_has_full_constraints(); 584 regulator_has_full_constraints();
586} 585}
587 586
587static void __init gta02_init_time(void)
588{
589 s3c2442_init_clocks(12000000);
590 samsung_timer_init();
591}
588 592
589MACHINE_START(NEO1973_GTA02, "GTA02") 593MACHINE_START(NEO1973_GTA02, "GTA02")
590 /* Maintainer: Nelson Castillo <arhuaco@freaks-unidos.net> */ 594 /* Maintainer: Nelson Castillo <arhuaco@freaks-unidos.net> */
@@ -592,6 +596,6 @@ MACHINE_START(NEO1973_GTA02, "GTA02")
592 .map_io = gta02_map_io, 596 .map_io = gta02_map_io,
593 .init_irq = s3c2442_init_irq, 597 .init_irq = s3c2442_init_irq,
594 .init_machine = gta02_machine_init, 598 .init_machine = gta02_machine_init,
595 .init_time = samsung_timer_init, 599 .init_time = gta02_init_time,
596 .restart = s3c244x_restart, 600 .restart = s3c244x_restart,
597MACHINE_END 601MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-h1940.c b/arch/arm/mach-s3c24xx/mach-h1940.c
index e453acd92cbf..fbf5487ae5d1 100644
--- a/arch/arm/mach-s3c24xx/mach-h1940.c
+++ b/arch/arm/mach-s3c24xx/mach-h1940.c
@@ -57,7 +57,6 @@
57#include <mach/regs-lcd.h> 57#include <mach/regs-lcd.h>
58#include <mach/gpio-samsung.h> 58#include <mach/gpio-samsung.h>
59 59
60#include <plat/clock.h>
61#include <plat/cpu.h> 60#include <plat/cpu.h>
62#include <plat/devs.h> 61#include <plat/devs.h>
63#include <plat/gpio-cfg.h> 62#include <plat/gpio-cfg.h>
@@ -646,7 +645,6 @@ static struct platform_device *h1940_devices[] __initdata = {
646static void __init h1940_map_io(void) 645static void __init h1940_map_io(void)
647{ 646{
648 s3c24xx_init_io(h1940_iodesc, ARRAY_SIZE(h1940_iodesc)); 647 s3c24xx_init_io(h1940_iodesc, ARRAY_SIZE(h1940_iodesc));
649 s3c24xx_init_clocks(0);
650 s3c24xx_init_uarts(h1940_uartcfgs, ARRAY_SIZE(h1940_uartcfgs)); 648 s3c24xx_init_uarts(h1940_uartcfgs, ARRAY_SIZE(h1940_uartcfgs));
651 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 649 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
652 650
@@ -662,6 +660,12 @@ static void __init h1940_map_io(void)
662 WARN_ON(gpiochip_add(&h1940_latch_gpiochip)); 660 WARN_ON(gpiochip_add(&h1940_latch_gpiochip));
663} 661}
664 662
663static void __init h1940_init_time(void)
664{
665 s3c2410_init_clocks(12000000);
666 samsung_timer_init();
667}
668
665/* H1940 and RX3715 need to reserve this for suspend */ 669/* H1940 and RX3715 need to reserve this for suspend */
666static void __init h1940_reserve(void) 670static void __init h1940_reserve(void)
667{ 671{
@@ -739,6 +743,6 @@ MACHINE_START(H1940, "IPAQ-H1940")
739 .reserve = h1940_reserve, 743 .reserve = h1940_reserve,
740 .init_irq = s3c2410_init_irq, 744 .init_irq = s3c2410_init_irq,
741 .init_machine = h1940_init, 745 .init_machine = h1940_init,
742 .init_time = samsung_timer_init, 746 .init_time = h1940_init_time,
743 .restart = s3c2410_restart, 747 .restart = s3c2410_restart,
744MACHINE_END 748MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-jive.c b/arch/arm/mach-s3c24xx/mach-jive.c
index 5faa7239e7d6..e81ea82c55f9 100644
--- a/arch/arm/mach-s3c24xx/mach-jive.c
+++ b/arch/arm/mach-s3c24xx/mach-jive.c
@@ -507,11 +507,16 @@ static struct syscore_ops jive_pm_syscore_ops = {
507static void __init jive_map_io(void) 507static void __init jive_map_io(void)
508{ 508{
509 s3c24xx_init_io(jive_iodesc, ARRAY_SIZE(jive_iodesc)); 509 s3c24xx_init_io(jive_iodesc, ARRAY_SIZE(jive_iodesc));
510 s3c24xx_init_clocks(12000000);
511 s3c24xx_init_uarts(jive_uartcfgs, ARRAY_SIZE(jive_uartcfgs)); 510 s3c24xx_init_uarts(jive_uartcfgs, ARRAY_SIZE(jive_uartcfgs));
512 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 511 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
513} 512}
514 513
514static void __init jive_init_time(void)
515{
516 s3c2412_init_clocks(12000000);
517 samsung_timer_init();
518}
519
515static void jive_power_off(void) 520static void jive_power_off(void)
516{ 521{
517 printk(KERN_INFO "powering system down...\n"); 522 printk(KERN_INFO "powering system down...\n");
@@ -665,6 +670,6 @@ MACHINE_START(JIVE, "JIVE")
665 .init_irq = s3c2412_init_irq, 670 .init_irq = s3c2412_init_irq,
666 .map_io = jive_map_io, 671 .map_io = jive_map_io,
667 .init_machine = jive_machine_init, 672 .init_machine = jive_machine_init,
668 .init_time = samsung_timer_init, 673 .init_time = jive_init_time,
669 .restart = s3c2412_restart, 674 .restart = s3c2412_restart,
670MACHINE_END 675MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-mini2440.c b/arch/arm/mach-s3c24xx/mach-mini2440.c
index 9e57fd9f4f3b..5cc40ec1d254 100644
--- a/arch/arm/mach-s3c24xx/mach-mini2440.c
+++ b/arch/arm/mach-s3c24xx/mach-mini2440.c
@@ -54,7 +54,6 @@
54#include <linux/mtd/partitions.h> 54#include <linux/mtd/partitions.h>
55 55
56#include <plat/gpio-cfg.h> 56#include <plat/gpio-cfg.h>
57#include <plat/clock.h>
58#include <plat/devs.h> 57#include <plat/devs.h>
59#include <plat/cpu.h> 58#include <plat/cpu.h>
60#include <plat/samsung-time.h> 59#include <plat/samsung-time.h>
@@ -525,11 +524,16 @@ static struct platform_device *mini2440_devices[] __initdata = {
525static void __init mini2440_map_io(void) 524static void __init mini2440_map_io(void)
526{ 525{
527 s3c24xx_init_io(mini2440_iodesc, ARRAY_SIZE(mini2440_iodesc)); 526 s3c24xx_init_io(mini2440_iodesc, ARRAY_SIZE(mini2440_iodesc));
528 s3c24xx_init_clocks(12000000);
529 s3c24xx_init_uarts(mini2440_uartcfgs, ARRAY_SIZE(mini2440_uartcfgs)); 527 s3c24xx_init_uarts(mini2440_uartcfgs, ARRAY_SIZE(mini2440_uartcfgs));
530 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 528 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
531} 529}
532 530
531static void __init mini2440_init_time(void)
532{
533 s3c2440_init_clocks(12000000);
534 samsung_timer_init();
535}
536
533/* 537/*
534 * mini2440_features string 538 * mini2440_features string
535 * 539 *
@@ -690,6 +694,6 @@ MACHINE_START(MINI2440, "MINI2440")
690 .map_io = mini2440_map_io, 694 .map_io = mini2440_map_io,
691 .init_machine = mini2440_init, 695 .init_machine = mini2440_init,
692 .init_irq = s3c2440_init_irq, 696 .init_irq = s3c2440_init_irq,
693 .init_time = samsung_timer_init, 697 .init_time = mini2440_init_time,
694 .restart = s3c244x_restart, 698 .restart = s3c244x_restart,
695MACHINE_END 699MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-n30.c b/arch/arm/mach-s3c24xx/mach-n30.c
index 4cccaad34847..3ac2a54348d6 100644
--- a/arch/arm/mach-s3c24xx/mach-n30.c
+++ b/arch/arm/mach-s3c24xx/mach-n30.c
@@ -45,7 +45,6 @@
45 45
46#include <linux/platform_data/i2c-s3c2410.h> 46#include <linux/platform_data/i2c-s3c2410.h>
47 47
48#include <plat/clock.h>
49#include <plat/cpu.h> 48#include <plat/cpu.h>
50#include <plat/devs.h> 49#include <plat/devs.h>
51#include <linux/platform_data/mmc-s3cmci.h> 50#include <linux/platform_data/mmc-s3cmci.h>
@@ -535,11 +534,16 @@ static void __init n30_map_io(void)
535{ 534{
536 s3c24xx_init_io(n30_iodesc, ARRAY_SIZE(n30_iodesc)); 535 s3c24xx_init_io(n30_iodesc, ARRAY_SIZE(n30_iodesc));
537 n30_hwinit(); 536 n30_hwinit();
538 s3c24xx_init_clocks(0);
539 s3c24xx_init_uarts(n30_uartcfgs, ARRAY_SIZE(n30_uartcfgs)); 537 s3c24xx_init_uarts(n30_uartcfgs, ARRAY_SIZE(n30_uartcfgs));
540 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 538 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
541} 539}
542 540
541static void __init n30_init_time(void)
542{
543 s3c2410_init_clocks(12000000);
544 samsung_timer_init();
545}
546
543/* GPB3 is the line that controls the pull-up for the USB D+ line */ 547/* GPB3 is the line that controls the pull-up for the USB D+ line */
544 548
545static void __init n30_init(void) 549static void __init n30_init(void)
@@ -591,7 +595,7 @@ MACHINE_START(N30, "Acer-N30")
591 Ben Dooks <ben-linux@fluff.org> 595 Ben Dooks <ben-linux@fluff.org>
592 */ 596 */
593 .atag_offset = 0x100, 597 .atag_offset = 0x100,
594 .init_time = samsung_timer_init, 598 .init_time = n30_init_time,
595 .init_machine = n30_init, 599 .init_machine = n30_init,
596 .init_irq = s3c2410_init_irq, 600 .init_irq = s3c2410_init_irq,
597 .map_io = n30_map_io, 601 .map_io = n30_map_io,
@@ -602,7 +606,7 @@ MACHINE_START(N35, "Acer-N35")
602 /* Maintainer: Christer Weinigel <christer@weinigel.se> 606 /* Maintainer: Christer Weinigel <christer@weinigel.se>
603 */ 607 */
604 .atag_offset = 0x100, 608 .atag_offset = 0x100,
605 .init_time = samsung_timer_init, 609 .init_time = n30_init_time,
606 .init_machine = n30_init, 610 .init_machine = n30_init,
607 .init_irq = s3c2410_init_irq, 611 .init_irq = s3c2410_init_irq,
608 .map_io = n30_map_io, 612 .map_io = n30_map_io,
diff --git a/arch/arm/mach-s3c24xx/mach-nexcoder.c b/arch/arm/mach-s3c24xx/mach-nexcoder.c
index 3066851f584d..c82c281ce351 100644
--- a/arch/arm/mach-s3c24xx/mach-nexcoder.c
+++ b/arch/arm/mach-s3c24xx/mach-nexcoder.c
@@ -42,7 +42,6 @@
42#include <linux/platform_data/i2c-s3c2410.h> 42#include <linux/platform_data/i2c-s3c2410.h>
43 43
44#include <plat/gpio-cfg.h> 44#include <plat/gpio-cfg.h>
45#include <plat/clock.h>
46#include <plat/devs.h> 45#include <plat/devs.h>
47#include <plat/cpu.h> 46#include <plat/cpu.h>
48#include <plat/samsung-time.h> 47#include <plat/samsung-time.h>
@@ -135,13 +134,18 @@ static void __init nexcoder_sensorboard_init(void)
135static void __init nexcoder_map_io(void) 134static void __init nexcoder_map_io(void)
136{ 135{
137 s3c24xx_init_io(nexcoder_iodesc, ARRAY_SIZE(nexcoder_iodesc)); 136 s3c24xx_init_io(nexcoder_iodesc, ARRAY_SIZE(nexcoder_iodesc));
138 s3c24xx_init_clocks(0);
139 s3c24xx_init_uarts(nexcoder_uartcfgs, ARRAY_SIZE(nexcoder_uartcfgs)); 137 s3c24xx_init_uarts(nexcoder_uartcfgs, ARRAY_SIZE(nexcoder_uartcfgs));
140 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 138 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
141 139
142 nexcoder_sensorboard_init(); 140 nexcoder_sensorboard_init();
143} 141}
144 142
143static void __init nexcoder_init_time(void)
144{
145 s3c2440_init_clocks(12000000);
146 samsung_timer_init();
147}
148
145static void __init nexcoder_init(void) 149static void __init nexcoder_init(void)
146{ 150{
147 s3c_i2c0_set_platdata(NULL); 151 s3c_i2c0_set_platdata(NULL);
@@ -154,6 +158,6 @@ MACHINE_START(NEXCODER_2440, "NexVision - Nexcoder 2440")
154 .map_io = nexcoder_map_io, 158 .map_io = nexcoder_map_io,
155 .init_machine = nexcoder_init, 159 .init_machine = nexcoder_init,
156 .init_irq = s3c2440_init_irq, 160 .init_irq = s3c2440_init_irq,
157 .init_time = samsung_timer_init, 161 .init_time = nexcoder_init_time,
158 .restart = s3c244x_restart, 162 .restart = s3c244x_restart,
159MACHINE_END 163MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-osiris.c b/arch/arm/mach-s3c24xx/mach-osiris.c
index a4ae4bb3666d..189147b80eca 100644
--- a/arch/arm/mach-s3c24xx/mach-osiris.c
+++ b/arch/arm/mach-s3c24xx/mach-osiris.c
@@ -40,7 +40,6 @@
40#include <linux/mtd/nand_ecc.h> 40#include <linux/mtd/nand_ecc.h>
41#include <linux/mtd/partitions.h> 41#include <linux/mtd/partitions.h>
42 42
43#include <plat/clock.h>
44#include <plat/cpu.h> 43#include <plat/cpu.h>
45#include <plat/cpu-freq.h> 44#include <plat/cpu-freq.h>
46#include <plat/devs.h> 45#include <plat/devs.h>
@@ -344,20 +343,13 @@ static struct i2c_board_info osiris_i2c_devs[] __initdata = {
344/* Standard Osiris devices */ 343/* Standard Osiris devices */
345 344
346static struct platform_device *osiris_devices[] __initdata = { 345static struct platform_device *osiris_devices[] __initdata = {
346 &s3c2410_device_dclk,
347 &s3c_device_i2c0, 347 &s3c_device_i2c0,
348 &s3c_device_wdt, 348 &s3c_device_wdt,
349 &s3c_device_nand, 349 &s3c_device_nand,
350 &osiris_pcmcia, 350 &osiris_pcmcia,
351}; 351};
352 352
353static struct clk *osiris_clocks[] __initdata = {
354 &s3c24xx_dclk0,
355 &s3c24xx_dclk1,
356 &s3c24xx_clkout0,
357 &s3c24xx_clkout1,
358 &s3c24xx_uclk,
359};
360
361static struct s3c_cpufreq_board __initdata osiris_cpufreq = { 353static struct s3c_cpufreq_board __initdata osiris_cpufreq = {
362 .refresh = 7800, /* refresh period is 7.8usec */ 354 .refresh = 7800, /* refresh period is 7.8usec */
363 .auto_io = 1, 355 .auto_io = 1,
@@ -368,23 +360,7 @@ static void __init osiris_map_io(void)
368{ 360{
369 unsigned long flags; 361 unsigned long flags;
370 362
371 /* initialise the clocks */
372
373 s3c24xx_dclk0.parent = &clk_upll;
374 s3c24xx_dclk0.rate = 12*1000*1000;
375
376 s3c24xx_dclk1.parent = &clk_upll;
377 s3c24xx_dclk1.rate = 24*1000*1000;
378
379 s3c24xx_clkout0.parent = &s3c24xx_dclk0;
380 s3c24xx_clkout1.parent = &s3c24xx_dclk1;
381
382 s3c24xx_uclk.parent = &s3c24xx_clkout1;
383
384 s3c24xx_register_clocks(osiris_clocks, ARRAY_SIZE(osiris_clocks));
385
386 s3c24xx_init_io(osiris_iodesc, ARRAY_SIZE(osiris_iodesc)); 363 s3c24xx_init_io(osiris_iodesc, ARRAY_SIZE(osiris_iodesc));
387 s3c24xx_init_clocks(0);
388 s3c24xx_init_uarts(osiris_uartcfgs, ARRAY_SIZE(osiris_uartcfgs)); 364 s3c24xx_init_uarts(osiris_uartcfgs, ARRAY_SIZE(osiris_uartcfgs));
389 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 365 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
390 366
@@ -408,6 +384,12 @@ static void __init osiris_map_io(void)
408 local_irq_restore(flags); 384 local_irq_restore(flags);
409} 385}
410 386
387static void __init osiris_init_time(void)
388{
389 s3c2440_init_clocks(12000000);
390 samsung_timer_init();
391}
392
411static void __init osiris_init(void) 393static void __init osiris_init(void)
412{ 394{
413 register_syscore_ops(&osiris_pm_syscore_ops); 395 register_syscore_ops(&osiris_pm_syscore_ops);
@@ -429,6 +411,6 @@ MACHINE_START(OSIRIS, "Simtec-OSIRIS")
429 .map_io = osiris_map_io, 411 .map_io = osiris_map_io,
430 .init_irq = s3c2440_init_irq, 412 .init_irq = s3c2440_init_irq,
431 .init_machine = osiris_init, 413 .init_machine = osiris_init,
432 .init_time = samsung_timer_init, 414 .init_time = osiris_init_time,
433 .restart = s3c244x_restart, 415 .restart = s3c244x_restart,
434MACHINE_END 416MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-otom.c b/arch/arm/mach-s3c24xx/mach-otom.c
index bdb3faac2d9b..45833001186d 100644
--- a/arch/arm/mach-s3c24xx/mach-otom.c
+++ b/arch/arm/mach-s3c24xx/mach-otom.c
@@ -30,7 +30,6 @@
30#include <mach/hardware.h> 30#include <mach/hardware.h>
31#include <mach/regs-gpio.h> 31#include <mach/regs-gpio.h>
32 32
33#include <plat/clock.h>
34#include <plat/cpu.h> 33#include <plat/cpu.h>
35#include <plat/devs.h> 34#include <plat/devs.h>
36#include <plat/samsung-time.h> 35#include <plat/samsung-time.h>
@@ -100,11 +99,16 @@ static struct platform_device *otom11_devices[] __initdata = {
100static void __init otom11_map_io(void) 99static void __init otom11_map_io(void)
101{ 100{
102 s3c24xx_init_io(otom11_iodesc, ARRAY_SIZE(otom11_iodesc)); 101 s3c24xx_init_io(otom11_iodesc, ARRAY_SIZE(otom11_iodesc));
103 s3c24xx_init_clocks(0);
104 s3c24xx_init_uarts(otom11_uartcfgs, ARRAY_SIZE(otom11_uartcfgs)); 102 s3c24xx_init_uarts(otom11_uartcfgs, ARRAY_SIZE(otom11_uartcfgs));
105 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 103 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
106} 104}
107 105
106static void __init otom11_init_time(void)
107{
108 s3c2410_init_clocks(12000000);
109 samsung_timer_init();
110}
111
108static void __init otom11_init(void) 112static void __init otom11_init(void)
109{ 113{
110 s3c_i2c0_set_platdata(NULL); 114 s3c_i2c0_set_platdata(NULL);
@@ -117,6 +121,6 @@ MACHINE_START(OTOM, "Nex Vision - Otom 1.1")
117 .map_io = otom11_map_io, 121 .map_io = otom11_map_io,
118 .init_machine = otom11_init, 122 .init_machine = otom11_init,
119 .init_irq = s3c2410_init_irq, 123 .init_irq = s3c2410_init_irq,
120 .init_time = samsung_timer_init, 124 .init_time = otom11_init_time,
121 .restart = s3c2410_restart, 125 .restart = s3c2410_restart,
122MACHINE_END 126MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-qt2410.c b/arch/arm/mach-s3c24xx/mach-qt2410.c
index 8c12787a8fd3..228c9094519d 100644
--- a/arch/arm/mach-s3c24xx/mach-qt2410.c
+++ b/arch/arm/mach-s3c24xx/mach-qt2410.c
@@ -304,11 +304,16 @@ __setup("tft=", qt2410_tft_setup);
304static void __init qt2410_map_io(void) 304static void __init qt2410_map_io(void)
305{ 305{
306 s3c24xx_init_io(qt2410_iodesc, ARRAY_SIZE(qt2410_iodesc)); 306 s3c24xx_init_io(qt2410_iodesc, ARRAY_SIZE(qt2410_iodesc));
307 s3c24xx_init_clocks(12*1000*1000);
308 s3c24xx_init_uarts(smdk2410_uartcfgs, ARRAY_SIZE(smdk2410_uartcfgs)); 307 s3c24xx_init_uarts(smdk2410_uartcfgs, ARRAY_SIZE(smdk2410_uartcfgs));
309 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 308 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
310} 309}
311 310
311static void __init qt2410_init_time(void)
312{
313 s3c2410_init_clocks(12000000);
314 samsung_timer_init();
315}
316
312static void __init qt2410_machine_init(void) 317static void __init qt2410_machine_init(void)
313{ 318{
314 s3c_nand_set_platdata(&qt2410_nand_info); 319 s3c_nand_set_platdata(&qt2410_nand_info);
@@ -346,6 +351,6 @@ MACHINE_START(QT2410, "QT2410")
346 .map_io = qt2410_map_io, 351 .map_io = qt2410_map_io,
347 .init_irq = s3c2410_init_irq, 352 .init_irq = s3c2410_init_irq,
348 .init_machine = qt2410_machine_init, 353 .init_machine = qt2410_machine_init,
349 .init_time = samsung_timer_init, 354 .init_time = qt2410_init_time,
350 .restart = s3c2410_restart, 355 .restart = s3c2410_restart,
351MACHINE_END 356MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-rx1950.c b/arch/arm/mach-s3c24xx/mach-rx1950.c
index afb784e934c8..e2c6541909c1 100644
--- a/arch/arm/mach-s3c24xx/mach-rx1950.c
+++ b/arch/arm/mach-s3c24xx/mach-rx1950.c
@@ -54,7 +54,6 @@
54#include <mach/regs-lcd.h> 54#include <mach/regs-lcd.h>
55#include <mach/gpio-samsung.h> 55#include <mach/gpio-samsung.h>
56 56
57#include <plat/clock.h>
58#include <plat/cpu.h> 57#include <plat/cpu.h>
59#include <plat/devs.h> 58#include <plat/devs.h>
60#include <plat/pm.h> 59#include <plat/pm.h>
@@ -710,6 +709,7 @@ static struct i2c_board_info rx1950_i2c_devices[] = {
710}; 709};
711 710
712static struct platform_device *rx1950_devices[] __initdata = { 711static struct platform_device *rx1950_devices[] __initdata = {
712 &s3c2410_device_dclk,
713 &s3c_device_lcd, 713 &s3c_device_lcd,
714 &s3c_device_wdt, 714 &s3c_device_wdt,
715 &s3c_device_i2c0, 715 &s3c_device_i2c0,
@@ -728,20 +728,9 @@ static struct platform_device *rx1950_devices[] __initdata = {
728 &rx1950_leds, 728 &rx1950_leds,
729}; 729};
730 730
731static struct clk *rx1950_clocks[] __initdata = {
732 &s3c24xx_clkout0,
733 &s3c24xx_clkout1,
734};
735
736static void __init rx1950_map_io(void) 731static void __init rx1950_map_io(void)
737{ 732{
738 s3c24xx_clkout0.parent = &clk_h;
739 s3c24xx_clkout1.parent = &clk_f;
740
741 s3c24xx_register_clocks(rx1950_clocks, ARRAY_SIZE(rx1950_clocks));
742
743 s3c24xx_init_io(rx1950_iodesc, ARRAY_SIZE(rx1950_iodesc)); 733 s3c24xx_init_io(rx1950_iodesc, ARRAY_SIZE(rx1950_iodesc));
744 s3c24xx_init_clocks(16934000);
745 s3c24xx_init_uarts(rx1950_uartcfgs, ARRAY_SIZE(rx1950_uartcfgs)); 734 s3c24xx_init_uarts(rx1950_uartcfgs, ARRAY_SIZE(rx1950_uartcfgs));
746 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 735 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
747 736
@@ -754,6 +743,12 @@ static void __init rx1950_map_io(void)
754 s3c_pm_init(); 743 s3c_pm_init();
755} 744}
756 745
746static void __init rx1950_init_time(void)
747{
748 s3c2442_init_clocks(16934000);
749 samsung_timer_init();
750}
751
757static void __init rx1950_init_machine(void) 752static void __init rx1950_init_machine(void)
758{ 753{
759 int i; 754 int i;
@@ -816,6 +811,6 @@ MACHINE_START(RX1950, "HP iPAQ RX1950")
816 .reserve = rx1950_reserve, 811 .reserve = rx1950_reserve,
817 .init_irq = s3c2442_init_irq, 812 .init_irq = s3c2442_init_irq,
818 .init_machine = rx1950_init_machine, 813 .init_machine = rx1950_init_machine,
819 .init_time = samsung_timer_init, 814 .init_time = rx1950_init_time,
820 .restart = s3c244x_restart, 815 .restart = s3c244x_restart,
821MACHINE_END 816MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-rx3715.c b/arch/arm/mach-s3c24xx/mach-rx3715.c
index e6535ce1bc5c..6e749ec3a2ea 100644
--- a/arch/arm/mach-s3c24xx/mach-rx3715.c
+++ b/arch/arm/mach-s3c24xx/mach-rx3715.c
@@ -46,7 +46,6 @@
46#include <mach/regs-lcd.h> 46#include <mach/regs-lcd.h>
47#include <mach/gpio-samsung.h> 47#include <mach/gpio-samsung.h>
48 48
49#include <plat/clock.h>
50#include <plat/cpu.h> 49#include <plat/cpu.h>
51#include <plat/devs.h> 50#include <plat/devs.h>
52#include <plat/pm.h> 51#include <plat/pm.h>
@@ -179,11 +178,16 @@ static struct platform_device *rx3715_devices[] __initdata = {
179static void __init rx3715_map_io(void) 178static void __init rx3715_map_io(void)
180{ 179{
181 s3c24xx_init_io(rx3715_iodesc, ARRAY_SIZE(rx3715_iodesc)); 180 s3c24xx_init_io(rx3715_iodesc, ARRAY_SIZE(rx3715_iodesc));
182 s3c24xx_init_clocks(16934000);
183 s3c24xx_init_uarts(rx3715_uartcfgs, ARRAY_SIZE(rx3715_uartcfgs)); 181 s3c24xx_init_uarts(rx3715_uartcfgs, ARRAY_SIZE(rx3715_uartcfgs));
184 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 182 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
185} 183}
186 184
185static void __init rx3715_init_time(void)
186{
187 s3c2440_init_clocks(16934000);
188 samsung_timer_init();
189}
190
187/* H1940 and RX3715 need to reserve this for suspend */ 191/* H1940 and RX3715 need to reserve this for suspend */
188static void __init rx3715_reserve(void) 192static void __init rx3715_reserve(void)
189{ 193{
@@ -210,6 +214,6 @@ MACHINE_START(RX3715, "IPAQ-RX3715")
210 .reserve = rx3715_reserve, 214 .reserve = rx3715_reserve,
211 .init_irq = s3c2440_init_irq, 215 .init_irq = s3c2440_init_irq,
212 .init_machine = rx3715_init_machine, 216 .init_machine = rx3715_init_machine,
213 .init_time = samsung_timer_init, 217 .init_time = rx3715_init_time,
214 .restart = s3c244x_restart, 218 .restart = s3c244x_restart,
215MACHINE_END 219MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-s3c2416-dt.c b/arch/arm/mach-s3c24xx/mach-s3c2416-dt.c
index 70f0900d4bca..e4dcb9aa2ca2 100644
--- a/arch/arm/mach-s3c24xx/mach-s3c2416-dt.c
+++ b/arch/arm/mach-s3c24xx/mach-s3c2416-dt.c
@@ -18,7 +18,6 @@
18#include <linux/clocksource.h> 18#include <linux/clocksource.h>
19#include <linux/irqchip.h> 19#include <linux/irqchip.h>
20#include <linux/of_platform.h> 20#include <linux/of_platform.h>
21#include <linux/serial_core.h>
22#include <linux/serial_s3c.h> 21#include <linux/serial_s3c.h>
23 22
24#include <asm/mach/arch.h> 23#include <asm/mach/arch.h>
@@ -29,48 +28,14 @@
29 28
30#include "common.h" 29#include "common.h"
31 30
32/*
33 * The following lookup table is used to override device names when devices
34 * are registered from device tree. This is temporarily added to enable
35 * device tree support addition for the S3C2416 architecture.
36 *
37 * For drivers that require platform data to be provided from the machine
38 * file, a platform data pointer can also be supplied along with the
39 * devices names. Usually, the platform data elements that cannot be parsed
40 * from the device tree by the drivers (example: function pointers) are
41 * supplied. But it should be noted that this is a temporary mechanism and
42 * at some point, the drivers should be capable of parsing all the platform
43 * data from the device tree.
44 */
45static const struct of_dev_auxdata s3c2416_auxdata_lookup[] __initconst = {
46 OF_DEV_AUXDATA("samsung,s3c2440-uart", S3C24XX_PA_UART,
47 "s3c2440-uart.0", NULL),
48 OF_DEV_AUXDATA("samsung,s3c2440-uart", S3C24XX_PA_UART + 0x4000,
49 "s3c2440-uart.1", NULL),
50 OF_DEV_AUXDATA("samsung,s3c2440-uart", S3C24XX_PA_UART + 0x8000,
51 "s3c2440-uart.2", NULL),
52 OF_DEV_AUXDATA("samsung,s3c2440-uart", S3C24XX_PA_UART + 0xC000,
53 "s3c2440-uart.3", NULL),
54 OF_DEV_AUXDATA("samsung,s3c6410-sdhci", S3C_PA_HSMMC0,
55 "s3c-sdhci.0", NULL),
56 OF_DEV_AUXDATA("samsung,s3c6410-sdhci", S3C_PA_HSMMC1,
57 "s3c-sdhci.1", NULL),
58 OF_DEV_AUXDATA("samsung,s3c2440-i2c", S3C_PA_IIC,
59 "s3c2440-i2c.0", NULL),
60 {},
61};
62
63static void __init s3c2416_dt_map_io(void) 31static void __init s3c2416_dt_map_io(void)
64{ 32{
65 s3c24xx_init_io(NULL, 0); 33 s3c24xx_init_io(NULL, 0);
66 s3c24xx_init_clocks(12000000);
67} 34}
68 35
69static void __init s3c2416_dt_machine_init(void) 36static void __init s3c2416_dt_machine_init(void)
70{ 37{
71 of_platform_populate(NULL, of_default_bus_match_table, 38 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
72 s3c2416_auxdata_lookup, NULL);
73
74 s3c_pm_init(); 39 s3c_pm_init();
75} 40}
76 41
@@ -86,6 +51,5 @@ DT_MACHINE_START(S3C2416_DT, "Samsung S3C2416 (Flattened Device Tree)")
86 .map_io = s3c2416_dt_map_io, 51 .map_io = s3c2416_dt_map_io,
87 .init_irq = irqchip_init, 52 .init_irq = irqchip_init,
88 .init_machine = s3c2416_dt_machine_init, 53 .init_machine = s3c2416_dt_machine_init,
89 .init_time = clocksource_of_init,
90 .restart = s3c2416_restart, 54 .restart = s3c2416_restart,
91MACHINE_END 55MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2410.c b/arch/arm/mach-s3c24xx/mach-smdk2410.c
index f32924ee0e9f..419fadd6e446 100644
--- a/arch/arm/mach-s3c24xx/mach-smdk2410.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2410.c
@@ -99,11 +99,16 @@ static struct platform_device *smdk2410_devices[] __initdata = {
99static void __init smdk2410_map_io(void) 99static void __init smdk2410_map_io(void)
100{ 100{
101 s3c24xx_init_io(smdk2410_iodesc, ARRAY_SIZE(smdk2410_iodesc)); 101 s3c24xx_init_io(smdk2410_iodesc, ARRAY_SIZE(smdk2410_iodesc));
102 s3c24xx_init_clocks(0);
103 s3c24xx_init_uarts(smdk2410_uartcfgs, ARRAY_SIZE(smdk2410_uartcfgs)); 102 s3c24xx_init_uarts(smdk2410_uartcfgs, ARRAY_SIZE(smdk2410_uartcfgs));
104 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 103 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
105} 104}
106 105
106static void __init smdk2410_init_time(void)
107{
108 s3c2410_init_clocks(12000000);
109 samsung_timer_init();
110}
111
107static void __init smdk2410_init(void) 112static void __init smdk2410_init(void)
108{ 113{
109 s3c_i2c0_set_platdata(NULL); 114 s3c_i2c0_set_platdata(NULL);
@@ -118,6 +123,6 @@ MACHINE_START(SMDK2410, "SMDK2410") /* @TODO: request a new identifier and switc
118 .map_io = smdk2410_map_io, 123 .map_io = smdk2410_map_io,
119 .init_irq = s3c2410_init_irq, 124 .init_irq = s3c2410_init_irq,
120 .init_machine = smdk2410_init, 125 .init_machine = smdk2410_init,
121 .init_time = samsung_timer_init, 126 .init_time = smdk2410_init_time,
122 .restart = s3c2410_restart, 127 .restart = s3c2410_restart,
123MACHINE_END 128MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2413.c b/arch/arm/mach-s3c24xx/mach-smdk2413.c
index 233fe52d2015..a38f8a049e22 100644
--- a/arch/arm/mach-s3c24xx/mach-smdk2413.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2413.c
@@ -106,11 +106,16 @@ static void __init smdk2413_fixup(struct tag *tags, char **cmdline,
106static void __init smdk2413_map_io(void) 106static void __init smdk2413_map_io(void)
107{ 107{
108 s3c24xx_init_io(smdk2413_iodesc, ARRAY_SIZE(smdk2413_iodesc)); 108 s3c24xx_init_io(smdk2413_iodesc, ARRAY_SIZE(smdk2413_iodesc));
109 s3c24xx_init_clocks(12000000);
110 s3c24xx_init_uarts(smdk2413_uartcfgs, ARRAY_SIZE(smdk2413_uartcfgs)); 109 s3c24xx_init_uarts(smdk2413_uartcfgs, ARRAY_SIZE(smdk2413_uartcfgs));
111 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 110 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
112} 111}
113 112
113static void __init smdk2413_init_time(void)
114{
115 s3c2412_init_clocks(12000000);
116 samsung_timer_init();
117}
118
114static void __init smdk2413_machine_init(void) 119static void __init smdk2413_machine_init(void)
115{ /* Turn off suspend on both USB ports, and switch the 120{ /* Turn off suspend on both USB ports, and switch the
116 * selectable USB port to USB device mode. */ 121 * selectable USB port to USB device mode. */
@@ -159,6 +164,6 @@ MACHINE_START(SMDK2413, "SMDK2413")
159 .init_irq = s3c2412_init_irq, 164 .init_irq = s3c2412_init_irq,
160 .map_io = smdk2413_map_io, 165 .map_io = smdk2413_map_io,
161 .init_machine = smdk2413_machine_init, 166 .init_machine = smdk2413_machine_init,
162 .init_time = samsung_timer_init, 167 .init_time = smdk2413_init_time,
163 .restart = s3c2412_restart, 168 .restart = s3c2412_restart,
164MACHINE_END 169MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2416.c b/arch/arm/mach-s3c24xx/mach-smdk2416.c
index b3b54d8e1410..fa6f30d23601 100644
--- a/arch/arm/mach-s3c24xx/mach-smdk2416.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2416.c
@@ -219,10 +219,15 @@ static struct platform_device *smdk2416_devices[] __initdata = {
219 &s3c2443_device_dma, 219 &s3c2443_device_dma,
220}; 220};
221 221
222static void __init smdk2416_init_time(void)
223{
224 s3c2416_init_clocks(12000000);
225 samsung_timer_init();
226}
227
222static void __init smdk2416_map_io(void) 228static void __init smdk2416_map_io(void)
223{ 229{
224 s3c24xx_init_io(smdk2416_iodesc, ARRAY_SIZE(smdk2416_iodesc)); 230 s3c24xx_init_io(smdk2416_iodesc, ARRAY_SIZE(smdk2416_iodesc));
225 s3c24xx_init_clocks(12000000);
226 s3c24xx_init_uarts(smdk2416_uartcfgs, ARRAY_SIZE(smdk2416_uartcfgs)); 231 s3c24xx_init_uarts(smdk2416_uartcfgs, ARRAY_SIZE(smdk2416_uartcfgs));
227 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 232 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
228} 233}
@@ -257,6 +262,6 @@ MACHINE_START(SMDK2416, "SMDK2416")
257 .init_irq = s3c2416_init_irq, 262 .init_irq = s3c2416_init_irq,
258 .map_io = smdk2416_map_io, 263 .map_io = smdk2416_map_io,
259 .init_machine = smdk2416_machine_init, 264 .init_machine = smdk2416_machine_init,
260 .init_time = samsung_timer_init, 265 .init_time = smdk2416_init_time,
261 .restart = s3c2416_restart, 266 .restart = s3c2416_restart,
262MACHINE_END 267MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2440.c b/arch/arm/mach-s3c24xx/mach-smdk2440.c
index d071dcfea548..5fb89c0ae17a 100644
--- a/arch/arm/mach-s3c24xx/mach-smdk2440.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2440.c
@@ -38,7 +38,6 @@
38#include <mach/fb.h> 38#include <mach/fb.h>
39#include <linux/platform_data/i2c-s3c2410.h> 39#include <linux/platform_data/i2c-s3c2410.h>
40 40
41#include <plat/clock.h>
42#include <plat/devs.h> 41#include <plat/devs.h>
43#include <plat/cpu.h> 42#include <plat/cpu.h>
44#include <plat/samsung-time.h> 43#include <plat/samsung-time.h>
@@ -159,11 +158,16 @@ static struct platform_device *smdk2440_devices[] __initdata = {
159static void __init smdk2440_map_io(void) 158static void __init smdk2440_map_io(void)
160{ 159{
161 s3c24xx_init_io(smdk2440_iodesc, ARRAY_SIZE(smdk2440_iodesc)); 160 s3c24xx_init_io(smdk2440_iodesc, ARRAY_SIZE(smdk2440_iodesc));
162 s3c24xx_init_clocks(16934400);
163 s3c24xx_init_uarts(smdk2440_uartcfgs, ARRAY_SIZE(smdk2440_uartcfgs)); 161 s3c24xx_init_uarts(smdk2440_uartcfgs, ARRAY_SIZE(smdk2440_uartcfgs));
164 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 162 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
165} 163}
166 164
165static void __init smdk2440_init_time(void)
166{
167 s3c2440_init_clocks(16934400);
168 samsung_timer_init();
169}
170
167static void __init smdk2440_machine_init(void) 171static void __init smdk2440_machine_init(void)
168{ 172{
169 s3c24xx_fb_set_platdata(&smdk2440_fb_info); 173 s3c24xx_fb_set_platdata(&smdk2440_fb_info);
@@ -180,6 +184,6 @@ MACHINE_START(S3C2440, "SMDK2440")
180 .init_irq = s3c2440_init_irq, 184 .init_irq = s3c2440_init_irq,
181 .map_io = smdk2440_map_io, 185 .map_io = smdk2440_map_io,
182 .init_machine = smdk2440_machine_init, 186 .init_machine = smdk2440_machine_init,
183 .init_time = samsung_timer_init, 187 .init_time = smdk2440_init_time,
184 .restart = s3c244x_restart, 188 .restart = s3c244x_restart,
185MACHINE_END 189MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2443.c b/arch/arm/mach-s3c24xx/mach-smdk2443.c
index 06c4d77de3a5..ef5d5ea33182 100644
--- a/arch/arm/mach-s3c24xx/mach-smdk2443.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2443.c
@@ -121,11 +121,16 @@ static struct platform_device *smdk2443_devices[] __initdata = {
121static void __init smdk2443_map_io(void) 121static void __init smdk2443_map_io(void)
122{ 122{
123 s3c24xx_init_io(smdk2443_iodesc, ARRAY_SIZE(smdk2443_iodesc)); 123 s3c24xx_init_io(smdk2443_iodesc, ARRAY_SIZE(smdk2443_iodesc));
124 s3c24xx_init_clocks(12000000);
125 s3c24xx_init_uarts(smdk2443_uartcfgs, ARRAY_SIZE(smdk2443_uartcfgs)); 124 s3c24xx_init_uarts(smdk2443_uartcfgs, ARRAY_SIZE(smdk2443_uartcfgs));
126 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 125 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
127} 126}
128 127
128static void __init smdk2443_init_time(void)
129{
130 s3c2443_init_clocks(12000000);
131 samsung_timer_init();
132}
133
129static void __init smdk2443_machine_init(void) 134static void __init smdk2443_machine_init(void)
130{ 135{
131 s3c_i2c0_set_platdata(NULL); 136 s3c_i2c0_set_platdata(NULL);
@@ -145,6 +150,6 @@ MACHINE_START(SMDK2443, "SMDK2443")
145 .init_irq = s3c2443_init_irq, 150 .init_irq = s3c2443_init_irq,
146 .map_io = smdk2443_map_io, 151 .map_io = smdk2443_map_io,
147 .init_machine = smdk2443_machine_init, 152 .init_machine = smdk2443_machine_init,
148 .init_time = samsung_timer_init, 153 .init_time = smdk2443_init_time,
149 .restart = s3c2443_restart, 154 .restart = s3c2443_restart,
150MACHINE_END 155MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-tct_hammer.c b/arch/arm/mach-s3c24xx/mach-tct_hammer.c
index 4108b2f0cede..c616ca2d409e 100644
--- a/arch/arm/mach-s3c24xx/mach-tct_hammer.c
+++ b/arch/arm/mach-s3c24xx/mach-tct_hammer.c
@@ -135,11 +135,16 @@ static struct platform_device *tct_hammer_devices[] __initdata = {
135static void __init tct_hammer_map_io(void) 135static void __init tct_hammer_map_io(void)
136{ 136{
137 s3c24xx_init_io(tct_hammer_iodesc, ARRAY_SIZE(tct_hammer_iodesc)); 137 s3c24xx_init_io(tct_hammer_iodesc, ARRAY_SIZE(tct_hammer_iodesc));
138 s3c24xx_init_clocks(0);
139 s3c24xx_init_uarts(tct_hammer_uartcfgs, ARRAY_SIZE(tct_hammer_uartcfgs)); 138 s3c24xx_init_uarts(tct_hammer_uartcfgs, ARRAY_SIZE(tct_hammer_uartcfgs));
140 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 139 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
141} 140}
142 141
142static void __init tct_hammer_init_time(void)
143{
144 s3c2410_init_clocks(12000000);
145 samsung_timer_init();
146}
147
143static void __init tct_hammer_init(void) 148static void __init tct_hammer_init(void)
144{ 149{
145 s3c_i2c0_set_platdata(NULL); 150 s3c_i2c0_set_platdata(NULL);
@@ -151,6 +156,6 @@ MACHINE_START(TCT_HAMMER, "TCT_HAMMER")
151 .map_io = tct_hammer_map_io, 156 .map_io = tct_hammer_map_io,
152 .init_irq = s3c2410_init_irq, 157 .init_irq = s3c2410_init_irq,
153 .init_machine = tct_hammer_init, 158 .init_machine = tct_hammer_init,
154 .init_time = samsung_timer_init, 159 .init_time = tct_hammer_init_time,
155 .restart = s3c2410_restart, 160 .restart = s3c2410_restart,
156MACHINE_END 161MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-vr1000.c b/arch/arm/mach-s3c24xx/mach-vr1000.c
index 1cc5b1bd51cd..f88c584c3001 100644
--- a/arch/arm/mach-s3c24xx/mach-vr1000.c
+++ b/arch/arm/mach-s3c24xx/mach-vr1000.c
@@ -43,7 +43,6 @@
43#include <mach/regs-gpio.h> 43#include <mach/regs-gpio.h>
44#include <mach/gpio-samsung.h> 44#include <mach/gpio-samsung.h>
45 45
46#include <plat/clock.h>
47#include <plat/cpu.h> 46#include <plat/cpu.h>
48#include <plat/devs.h> 47#include <plat/devs.h>
49#include <plat/samsung-time.h> 48#include <plat/samsung-time.h>
@@ -286,6 +285,7 @@ static struct i2c_board_info vr1000_i2c_devs[] __initdata = {
286/* devices for this board */ 285/* devices for this board */
287 286
288static struct platform_device *vr1000_devices[] __initdata = { 287static struct platform_device *vr1000_devices[] __initdata = {
288 &s3c2410_device_dclk,
289 &s3c_device_ohci, 289 &s3c_device_ohci,
290 &s3c_device_lcd, 290 &s3c_device_lcd,
291 &s3c_device_wdt, 291 &s3c_device_wdt,
@@ -299,14 +299,6 @@ static struct platform_device *vr1000_devices[] __initdata = {
299 &vr1000_led3, 299 &vr1000_led3,
300}; 300};
301 301
302static struct clk *vr1000_clocks[] __initdata = {
303 &s3c24xx_dclk0,
304 &s3c24xx_dclk1,
305 &s3c24xx_clkout0,
306 &s3c24xx_clkout1,
307 &s3c24xx_uclk,
308};
309
310static void vr1000_power_off(void) 302static void vr1000_power_off(void)
311{ 303{
312 gpio_direction_output(S3C2410_GPB(9), 1); 304 gpio_direction_output(S3C2410_GPB(9), 1);
@@ -314,29 +306,19 @@ static void vr1000_power_off(void)
314 306
315static void __init vr1000_map_io(void) 307static void __init vr1000_map_io(void)
316{ 308{
317 /* initialise clock sources */
318
319 s3c24xx_dclk0.parent = &clk_upll;
320 s3c24xx_dclk0.rate = 12*1000*1000;
321
322 s3c24xx_dclk1.parent = NULL;
323 s3c24xx_dclk1.rate = 3692307;
324
325 s3c24xx_clkout0.parent = &s3c24xx_dclk0;
326 s3c24xx_clkout1.parent = &s3c24xx_dclk1;
327
328 s3c24xx_uclk.parent = &s3c24xx_clkout1;
329
330 s3c24xx_register_clocks(vr1000_clocks, ARRAY_SIZE(vr1000_clocks));
331
332 pm_power_off = vr1000_power_off; 309 pm_power_off = vr1000_power_off;
333 310
334 s3c24xx_init_io(vr1000_iodesc, ARRAY_SIZE(vr1000_iodesc)); 311 s3c24xx_init_io(vr1000_iodesc, ARRAY_SIZE(vr1000_iodesc));
335 s3c24xx_init_clocks(0);
336 s3c24xx_init_uarts(vr1000_uartcfgs, ARRAY_SIZE(vr1000_uartcfgs)); 312 s3c24xx_init_uarts(vr1000_uartcfgs, ARRAY_SIZE(vr1000_uartcfgs));
337 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 313 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
338} 314}
339 315
316static void __init vr1000_init_time(void)
317{
318 s3c2410_init_clocks(12000000);
319 samsung_timer_init();
320}
321
340static void __init vr1000_init(void) 322static void __init vr1000_init(void)
341{ 323{
342 s3c_i2c0_set_platdata(NULL); 324 s3c_i2c0_set_platdata(NULL);
@@ -357,6 +339,6 @@ MACHINE_START(VR1000, "Thorcom-VR1000")
357 .map_io = vr1000_map_io, 339 .map_io = vr1000_map_io,
358 .init_machine = vr1000_init, 340 .init_machine = vr1000_init,
359 .init_irq = s3c2410_init_irq, 341 .init_irq = s3c2410_init_irq,
360 .init_time = samsung_timer_init, 342 .init_time = vr1000_init_time,
361 .restart = s3c2410_restart, 343 .restart = s3c2410_restart,
362MACHINE_END 344MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/mach-vstms.c b/arch/arm/mach-s3c24xx/mach-vstms.c
index 40868c0e0a68..6b706c915387 100644
--- a/arch/arm/mach-s3c24xx/mach-vstms.c
+++ b/arch/arm/mach-s3c24xx/mach-vstms.c
@@ -142,11 +142,16 @@ static void __init vstms_fixup(struct tag *tags, char **cmdline,
142static void __init vstms_map_io(void) 142static void __init vstms_map_io(void)
143{ 143{
144 s3c24xx_init_io(vstms_iodesc, ARRAY_SIZE(vstms_iodesc)); 144 s3c24xx_init_io(vstms_iodesc, ARRAY_SIZE(vstms_iodesc));
145 s3c24xx_init_clocks(12000000);
146 s3c24xx_init_uarts(vstms_uartcfgs, ARRAY_SIZE(vstms_uartcfgs)); 145 s3c24xx_init_uarts(vstms_uartcfgs, ARRAY_SIZE(vstms_uartcfgs));
147 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); 146 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
148} 147}
149 148
149static void __init vstms_init_time(void)
150{
151 s3c2412_init_clocks(12000000);
152 samsung_timer_init();
153}
154
150static void __init vstms_init(void) 155static void __init vstms_init(void)
151{ 156{
152 s3c_i2c0_set_platdata(NULL); 157 s3c_i2c0_set_platdata(NULL);
@@ -162,6 +167,6 @@ MACHINE_START(VSTMS, "VSTMS")
162 .init_irq = s3c2412_init_irq, 167 .init_irq = s3c2412_init_irq,
163 .init_machine = vstms_init, 168 .init_machine = vstms_init,
164 .map_io = vstms_map_io, 169 .map_io = vstms_map_io,
165 .init_time = samsung_timer_init, 170 .init_time = vstms_init_time,
166 .restart = s3c2412_restart, 171 .restart = s3c2412_restart,
167MACHINE_END 172MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/pm.c b/arch/arm/mach-s3c24xx/pm.c
index 68ea5b7e5dc7..b19256ec8d40 100644
--- a/arch/arm/mach-s3c24xx/pm.c
+++ b/arch/arm/mach-s3c24xx/pm.c
@@ -51,9 +51,6 @@
51#define PFX "s3c24xx-pm: " 51#define PFX "s3c24xx-pm: "
52 52
53static struct sleep_save core_save[] = { 53static struct sleep_save core_save[] = {
54 SAVE_ITEM(S3C2410_LOCKTIME),
55 SAVE_ITEM(S3C2410_CLKCON),
56
57 /* we restore the timings here, with the proviso that the board 54 /* we restore the timings here, with the proviso that the board
58 * brings the system up in an slower, or equal frequency setting 55 * brings the system up in an slower, or equal frequency setting
59 * to the original system. 56 * to the original system.
@@ -69,18 +66,6 @@ static struct sleep_save core_save[] = {
69 SAVE_ITEM(S3C2410_BANKCON3), 66 SAVE_ITEM(S3C2410_BANKCON3),
70 SAVE_ITEM(S3C2410_BANKCON4), 67 SAVE_ITEM(S3C2410_BANKCON4),
71 SAVE_ITEM(S3C2410_BANKCON5), 68 SAVE_ITEM(S3C2410_BANKCON5),
72
73#ifndef CONFIG_CPU_FREQ
74 SAVE_ITEM(S3C2410_CLKDIVN),
75 SAVE_ITEM(S3C2410_MPLLCON),
76 SAVE_ITEM(S3C2410_REFRESH),
77#endif
78 SAVE_ITEM(S3C2410_UPLLCON),
79 SAVE_ITEM(S3C2410_CLKSLOW),
80};
81
82static struct sleep_save misc_save[] = {
83 SAVE_ITEM(S3C2410_DCLKCON),
84}; 69};
85 70
86/* s3c_pm_check_resume_pin 71/* s3c_pm_check_resume_pin
@@ -140,12 +125,10 @@ void s3c_pm_configure_extint(void)
140void s3c_pm_restore_core(void) 125void s3c_pm_restore_core(void)
141{ 126{
142 s3c_pm_do_restore_core(core_save, ARRAY_SIZE(core_save)); 127 s3c_pm_do_restore_core(core_save, ARRAY_SIZE(core_save));
143 s3c_pm_do_restore(misc_save, ARRAY_SIZE(misc_save));
144} 128}
145 129
146void s3c_pm_save_core(void) 130void s3c_pm_save_core(void)
147{ 131{
148 s3c_pm_do_save(misc_save, ARRAY_SIZE(misc_save));
149 s3c_pm_do_save(core_save, ARRAY_SIZE(core_save)); 132 s3c_pm_do_save(core_save, ARRAY_SIZE(core_save));
150} 133}
151 134
diff --git a/arch/arm/mach-s3c24xx/s3c2410.c b/arch/arm/mach-s3c24xx/s3c2410.c
index 04b58cb49888..7eab88829883 100644
--- a/arch/arm/mach-s3c24xx/s3c2410.c
+++ b/arch/arm/mach-s3c24xx/s3c2410.c
@@ -85,62 +85,6 @@ void __init s3c2410_map_io(void)
85 85
86void __init_or_cpufreq s3c2410_setup_clocks(void) 86void __init_or_cpufreq s3c2410_setup_clocks(void)
87{ 87{
88 struct clk *xtal_clk;
89 unsigned long tmp;
90 unsigned long xtal;
91 unsigned long fclk;
92 unsigned long hclk;
93 unsigned long pclk;
94
95 xtal_clk = clk_get(NULL, "xtal");
96 xtal = clk_get_rate(xtal_clk);
97 clk_put(xtal_clk);
98
99 /* now we've got our machine bits initialised, work out what
100 * clocks we've got */
101
102 fclk = s3c24xx_get_pll(__raw_readl(S3C2410_MPLLCON), xtal);
103
104 tmp = __raw_readl(S3C2410_CLKDIVN);
105
106 /* work out clock scalings */
107
108 hclk = fclk / ((tmp & S3C2410_CLKDIVN_HDIVN) ? 2 : 1);
109 pclk = hclk / ((tmp & S3C2410_CLKDIVN_PDIVN) ? 2 : 1);
110
111 /* print brieft summary of clocks, etc */
112
113 printk("S3C2410: core %ld.%03ld MHz, memory %ld.%03ld MHz, peripheral %ld.%03ld MHz\n",
114 print_mhz(fclk), print_mhz(hclk), print_mhz(pclk));
115
116 /* initialise the clocks here, to allow other things like the
117 * console to use them
118 */
119
120 s3c24xx_setup_clocks(fclk, hclk, pclk);
121}
122
123/* fake ARMCLK for use with cpufreq, etc. */
124
125static struct clk s3c2410_armclk = {
126 .name = "armclk",
127 .parent = &clk_f,
128 .id = -1,
129};
130
131static struct clk_lookup s3c2410_clk_lookup[] = {
132 CLKDEV_INIT(NULL, "clk_uart_baud0", &clk_p),
133 CLKDEV_INIT(NULL, "clk_uart_baud1", &s3c24xx_uclk),
134};
135
136void __init s3c2410_init_clocks(int xtal)
137{
138 s3c24xx_register_baseclocks(xtal);
139 s3c2410_setup_clocks();
140 s3c2410_baseclk_add();
141 s3c24xx_register_clock(&s3c2410_armclk);
142 clkdev_add_table(s3c2410_clk_lookup, ARRAY_SIZE(s3c2410_clk_lookup));
143 samsung_wdt_reset_init(S3C24XX_VA_WATCHDOG);
144} 88}
145 89
146struct bus_type s3c2410_subsys = { 90struct bus_type s3c2410_subsys = {
diff --git a/arch/arm/mach-s3c24xx/s3c2412.c b/arch/arm/mach-s3c24xx/s3c2412.c
index 657cbaca80ac..d49f52fbc842 100644
--- a/arch/arm/mach-s3c24xx/s3c2412.c
+++ b/arch/arm/mach-s3c24xx/s3c2412.c
@@ -173,49 +173,6 @@ void __init s3c2412_map_io(void)
173 173
174void __init_or_cpufreq s3c2412_setup_clocks(void) 174void __init_or_cpufreq s3c2412_setup_clocks(void)
175{ 175{
176 struct clk *xtal_clk;
177 unsigned long tmp;
178 unsigned long xtal;
179 unsigned long fclk;
180 unsigned long hclk;
181 unsigned long pclk;
182
183 xtal_clk = clk_get(NULL, "xtal");
184 xtal = clk_get_rate(xtal_clk);
185 clk_put(xtal_clk);
186
187 /* now we've got our machine bits initialised, work out what
188 * clocks we've got */
189
190 fclk = s3c24xx_get_pll(__raw_readl(S3C2410_MPLLCON), xtal * 2);
191
192 clk_mpll.rate = fclk;
193
194 tmp = __raw_readl(S3C2410_CLKDIVN);
195
196 /* work out clock scalings */
197
198 hclk = fclk / ((tmp & S3C2412_CLKDIVN_HDIVN_MASK) + 1);
199 hclk /= ((tmp & S3C2412_CLKDIVN_ARMDIVN) ? 2 : 1);
200 pclk = hclk / ((tmp & S3C2412_CLKDIVN_PDIVN) ? 2 : 1);
201
202 /* print brieft summary of clocks, etc */
203
204 printk("S3C2412: core %ld.%03ld MHz, memory %ld.%03ld MHz, peripheral %ld.%03ld MHz\n",
205 print_mhz(fclk), print_mhz(hclk), print_mhz(pclk));
206
207 s3c24xx_setup_clocks(fclk, hclk, pclk);
208}
209
210void __init s3c2412_init_clocks(int xtal)
211{
212 /* initialise the clocks here, to allow other things like the
213 * console to use them
214 */
215
216 s3c24xx_register_baseclocks(xtal);
217 s3c2412_setup_clocks();
218 s3c2412_baseclk_add();
219} 176}
220 177
221/* need to register the subsystem before we actually register the device, and 178/* need to register the subsystem before we actually register the device, and
diff --git a/arch/arm/mach-s3c24xx/s3c2442.c b/arch/arm/mach-s3c24xx/s3c2442.c
index 2c8adc028538..fb9da2b603a2 100644
--- a/arch/arm/mach-s3c24xx/s3c2442.c
+++ b/arch/arm/mach-s3c24xx/s3c2442.c
@@ -53,117 +53,6 @@
53 53
54#include "common.h" 54#include "common.h"
55 55
56/* S3C2442 extended clock support */
57
58static unsigned long s3c2442_camif_upll_round(struct clk *clk,
59 unsigned long rate)
60{
61 unsigned long parent_rate = clk_get_rate(clk->parent);
62 int div;
63
64 if (rate > parent_rate)
65 return parent_rate;
66
67 div = parent_rate / rate;
68
69 if (div == 3)
70 return parent_rate / 3;
71
72 /* note, we remove the +/- 1 calculations for the divisor */
73
74 div /= 2;
75
76 if (div < 1)
77 div = 1;
78 else if (div > 16)
79 div = 16;
80
81 return parent_rate / (div * 2);
82}
83
84static int s3c2442_camif_upll_setrate(struct clk *clk, unsigned long rate)
85{
86 unsigned long parent_rate = clk_get_rate(clk->parent);
87 unsigned long camdivn = __raw_readl(S3C2440_CAMDIVN);
88
89 rate = s3c2442_camif_upll_round(clk, rate);
90
91 camdivn &= ~S3C2442_CAMDIVN_CAMCLK_DIV3;
92
93 if (rate == parent_rate) {
94 camdivn &= ~S3C2440_CAMDIVN_CAMCLK_SEL;
95 } else if ((parent_rate / rate) == 3) {
96 camdivn |= S3C2440_CAMDIVN_CAMCLK_SEL;
97 camdivn |= S3C2442_CAMDIVN_CAMCLK_DIV3;
98 } else {
99 camdivn &= ~S3C2440_CAMDIVN_CAMCLK_MASK;
100 camdivn |= S3C2440_CAMDIVN_CAMCLK_SEL;
101 camdivn |= (((parent_rate / rate) / 2) - 1);
102 }
103
104 __raw_writel(camdivn, S3C2440_CAMDIVN);
105
106 return 0;
107}
108
109/* Extra S3C2442 clocks */
110
111static struct clk s3c2442_clk_cam = {
112 .name = "camif",
113 .id = -1,
114 .enable = s3c2410_clkcon_enable,
115 .ctrlbit = S3C2440_CLKCON_CAMERA,
116};
117
118static struct clk s3c2442_clk_cam_upll = {
119 .name = "camif-upll",
120 .id = -1,
121 .ops = &(struct clk_ops) {
122 .set_rate = s3c2442_camif_upll_setrate,
123 .round_rate = s3c2442_camif_upll_round,
124 },
125};
126
127static int s3c2442_clk_add(struct device *dev, struct subsys_interface *sif)
128{
129 struct clk *clock_upll;
130 struct clk *clock_h;
131 struct clk *clock_p;
132
133 clock_p = clk_get(NULL, "pclk");
134 clock_h = clk_get(NULL, "hclk");
135 clock_upll = clk_get(NULL, "upll");
136
137 if (IS_ERR(clock_p) || IS_ERR(clock_h) || IS_ERR(clock_upll)) {
138 printk(KERN_ERR "S3C2442: Failed to get parent clocks\n");
139 return -EINVAL;
140 }
141
142 s3c2442_clk_cam.parent = clock_h;
143 s3c2442_clk_cam_upll.parent = clock_upll;
144
145 s3c24xx_register_clock(&s3c2442_clk_cam);
146 s3c24xx_register_clock(&s3c2442_clk_cam_upll);
147
148 clk_disable(&s3c2442_clk_cam);
149
150 return 0;
151}
152
153static struct subsys_interface s3c2442_clk_interface = {
154 .name = "s3c2442_clk",
155 .subsys = &s3c2442_subsys,
156 .add_dev = s3c2442_clk_add,
157};
158
159static __init int s3c2442_clk_init(void)
160{
161 return subsys_interface_register(&s3c2442_clk_interface);
162}
163
164arch_initcall(s3c2442_clk_init);
165
166
167static struct device s3c2442_dev = { 56static struct device s3c2442_dev = {
168 .bus = &s3c2442_subsys, 57 .bus = &s3c2442_subsys,
169}; 58};
diff --git a/arch/arm/mach-s3c24xx/s3c244x.c b/arch/arm/mach-s3c24xx/s3c244x.c
index fe30ebb234d2..4a64bcc9eb51 100644
--- a/arch/arm/mach-s3c24xx/s3c244x.c
+++ b/arch/arm/mach-s3c24xx/s3c244x.c
@@ -46,6 +46,7 @@
46#include <plat/nand-core.h> 46#include <plat/nand-core.h>
47#include <plat/watchdog-reset.h> 47#include <plat/watchdog-reset.h>
48 48
49#include "common.h"
49#include "regs-dsc.h" 50#include "regs-dsc.h"
50 51
51static struct map_desc s3c244x_iodesc[] __initdata = { 52static struct map_desc s3c244x_iodesc[] __initdata = {
@@ -74,67 +75,11 @@ void __init s3c244x_map_io(void)
74 s3c_nand_setname("s3c2440-nand"); 75 s3c_nand_setname("s3c2440-nand");
75 s3c_device_ts.name = "s3c2440-ts"; 76 s3c_device_ts.name = "s3c2440-ts";
76 s3c_device_usbgadget.name = "s3c2440-usbgadget"; 77 s3c_device_usbgadget.name = "s3c2440-usbgadget";
78 s3c2410_device_dclk.name = "s3c2440-dclk";
77} 79}
78 80
79void __init_or_cpufreq s3c244x_setup_clocks(void) 81void __init_or_cpufreq s3c244x_setup_clocks(void)
80{ 82{
81 struct clk *xtal_clk;
82 unsigned long clkdiv;
83 unsigned long camdiv;
84 unsigned long xtal;
85 unsigned long hclk, fclk, pclk;
86 int hdiv = 1;
87
88 xtal_clk = clk_get(NULL, "xtal");
89 xtal = clk_get_rate(xtal_clk);
90 clk_put(xtal_clk);
91
92 fclk = s3c24xx_get_pll(__raw_readl(S3C2410_MPLLCON), xtal) * 2;
93
94 clkdiv = __raw_readl(S3C2410_CLKDIVN);
95 camdiv = __raw_readl(S3C2440_CAMDIVN);
96
97 /* work out clock scalings */
98
99 switch (clkdiv & S3C2440_CLKDIVN_HDIVN_MASK) {
100 case S3C2440_CLKDIVN_HDIVN_1:
101 hdiv = 1;
102 break;
103
104 case S3C2440_CLKDIVN_HDIVN_2:
105 hdiv = 2;
106 break;
107
108 case S3C2440_CLKDIVN_HDIVN_4_8:
109 hdiv = (camdiv & S3C2440_CAMDIVN_HCLK4_HALF) ? 8 : 4;
110 break;
111
112 case S3C2440_CLKDIVN_HDIVN_3_6:
113 hdiv = (camdiv & S3C2440_CAMDIVN_HCLK3_HALF) ? 6 : 3;
114 break;
115 }
116
117 hclk = fclk / hdiv;
118 pclk = hclk / ((clkdiv & S3C2440_CLKDIVN_PDIVN) ? 2 : 1);
119
120 /* print brief summary of clocks, etc */
121
122 printk("S3C244X: core %ld.%03ld MHz, memory %ld.%03ld MHz, peripheral %ld.%03ld MHz\n",
123 print_mhz(fclk), print_mhz(hclk), print_mhz(pclk));
124
125 s3c24xx_setup_clocks(fclk, hclk, pclk);
126}
127
128void __init s3c244x_init_clocks(int xtal)
129{
130 /* initialise the clocks here, to allow other things like the
131 * console to use them, and to add new ones after the initialisation
132 */
133
134 s3c24xx_register_baseclocks(xtal);
135 s3c244x_setup_clocks();
136 s3c2410_baseclk_add();
137 samsung_wdt_reset_init(S3C24XX_VA_WATCHDOG);
138} 83}
139 84
140/* Since the S3C2442 and S3C2440 share items, put both subsystems here */ 85/* Since the S3C2442 and S3C2440 share items, put both subsystems here */
diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
index 0f92ba8e7884..62eaa42cb13a 100644
--- a/arch/arm/mach-shmobile/Kconfig
+++ b/arch/arm/mach-shmobile/Kconfig
@@ -8,7 +8,6 @@ config ARCH_SHMOBILE_MULTI
8 select HAVE_ARM_SCU if SMP 8 select HAVE_ARM_SCU if SMP
9 select HAVE_ARM_TWD if SMP 9 select HAVE_ARM_TWD if SMP
10 select ARM_GIC 10 select ARM_GIC
11 select MIGHT_HAVE_PCI
12 select ARCH_DMA_ADDR_T_64BIT if ARM_LPAE 11 select ARCH_DMA_ADDR_T_64BIT if ARM_LPAE
13 select NO_IOPORT_MAP 12 select NO_IOPORT_MAP
14 select PINCTRL 13 select PINCTRL
@@ -205,8 +204,8 @@ config MACH_ARMADILLO800EVA_REFERENCE
205 select SND_SOC_WM8978 if SND_SIMPLE_CARD 204 select SND_SOC_WM8978 if SND_SIMPLE_CARD
206 select USE_OF 205 select USE_OF
207 ---help--- 206 ---help---
208 Use reference implementation of Aramdillo800 EVA board support 207 Use reference implementation of Armadillo800 EVA board support
209 which makes a greater use of device tree at the expense 208 which makes greater use of device tree at the expense
210 of not supporting a number of devices. 209 of not supporting a number of devices.
211 210
212 This is intended to aid developers 211 This is intended to aid developers
diff --git a/arch/arm/mach-shmobile/setup-r8a7740.c b/arch/arm/mach-shmobile/setup-r8a7740.c
index 8f3c68101d59..a177a7b3bdbd 100644
--- a/arch/arm/mach-shmobile/setup-r8a7740.c
+++ b/arch/arm/mach-shmobile/setup-r8a7740.c
@@ -765,7 +765,7 @@ static struct platform_device *r8a7740_late_devices[] __initdata = {
765 * "Media RAM (MERAM)" on r8a7740 documentation 765 * "Media RAM (MERAM)" on r8a7740 documentation
766 */ 766 */
767#define MEBUFCNTR 0xFE950098 767#define MEBUFCNTR 0xFE950098
768void r8a7740_meram_workaround(void) 768void __init r8a7740_meram_workaround(void)
769{ 769{
770 void __iomem *reg; 770 void __iomem *reg;
771 771
@@ -869,17 +869,6 @@ void __init r8a7740_add_early_devices(void)
869 869
870#ifdef CONFIG_USE_OF 870#ifdef CONFIG_USE_OF
871 871
872void __init r8a7740_add_early_devices_dt(void)
873{
874 shmobile_setup_delay(800, 1, 3); /* Cortex-A9 @ 800MHz */
875
876 early_platform_add_devices(r8a7740_early_devices,
877 ARRAY_SIZE(r8a7740_early_devices));
878
879 /* setup early console here as well */
880 shmobile_setup_console();
881}
882
883void __init r8a7740_add_standard_devices_dt(void) 872void __init r8a7740_add_standard_devices_dt(void)
884{ 873{
885 platform_add_devices(r8a7740_devices_dt, 874 platform_add_devices(r8a7740_devices_dt,
diff --git a/arch/arm/mach-shmobile/setup-sh7372.c b/arch/arm/mach-shmobile/setup-sh7372.c
index 27301278c208..f8176b051be4 100644
--- a/arch/arm/mach-shmobile/setup-sh7372.c
+++ b/arch/arm/mach-shmobile/setup-sh7372.c
@@ -1037,11 +1037,7 @@ void __init sh7372_add_early_devices_dt(void)
1037{ 1037{
1038 shmobile_setup_delay(800, 1, 3); /* Cortex-A8 @ 800MHz */ 1038 shmobile_setup_delay(800, 1, 3); /* Cortex-A8 @ 800MHz */
1039 1039
1040 early_platform_add_devices(sh7372_early_devices, 1040 sh7372_add_early_devices();
1041 ARRAY_SIZE(sh7372_early_devices));
1042
1043 /* setup early console here as well */
1044 shmobile_setup_console();
1045} 1041}
1046 1042
1047void __init sh7372_add_standard_devices_dt(void) 1043void __init sh7372_add_standard_devices_dt(void)
diff --git a/arch/arm/mach-tegra/Kconfig b/arch/arm/mach-tegra/Kconfig
index 55b305d51669..e16999e5b735 100644
--- a/arch/arm/mach-tegra/Kconfig
+++ b/arch/arm/mach-tegra/Kconfig
@@ -7,7 +7,6 @@ config ARCH_TEGRA
7 select CLKSRC_MMIO 7 select CLKSRC_MMIO
8 select HAVE_ARM_SCU if SMP 8 select HAVE_ARM_SCU if SMP
9 select HAVE_ARM_TWD if SMP 9 select HAVE_ARM_TWD if SMP
10 select MIGHT_HAVE_PCI
11 select PINCTRL 10 select PINCTRL
12 select ARCH_HAS_RESET_CONTROLLER 11 select ARCH_HAS_RESET_CONTROLLER
13 select RESET_CONTROLLER 12 select RESET_CONTROLLER
diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c
index f2c89fb8fca9..be83ba25f81b 100644
--- a/arch/arm/mach-versatile/core.c
+++ b/arch/arm/mach-versatile/core.c
@@ -310,6 +310,21 @@ static struct platform_device char_lcd_device = {
310 .resource = char_lcd_resources, 310 .resource = char_lcd_resources,
311}; 311};
312 312
313static struct resource leds_resources[] = {
314 {
315 .start = VERSATILE_SYS_BASE + VERSATILE_SYS_LED_OFFSET,
316 .end = VERSATILE_SYS_BASE + VERSATILE_SYS_LED_OFFSET + 4,
317 .flags = IORESOURCE_MEM,
318 },
319};
320
321static struct platform_device leds_device = {
322 .name = "versatile-leds",
323 .id = -1,
324 .num_resources = ARRAY_SIZE(leds_resources),
325 .resource = leds_resources,
326};
327
313/* 328/*
314 * Clock handling 329 * Clock handling
315 */ 330 */
@@ -795,6 +810,7 @@ void __init versatile_init(void)
795 platform_device_register(&versatile_i2c_device); 810 platform_device_register(&versatile_i2c_device);
796 platform_device_register(&smc91x_device); 811 platform_device_register(&smc91x_device);
797 platform_device_register(&char_lcd_device); 812 platform_device_register(&char_lcd_device);
813 platform_device_register(&leds_device);
798 814
799 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) { 815 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
800 struct amba_device *d = amba_devs[i]; 816 struct amba_device *d = amba_devs[i];
diff --git a/arch/arm/mach-vexpress/Kconfig b/arch/arm/mach-vexpress/Kconfig
index 657d52d0391f..b8ac752fd24b 100644
--- a/arch/arm/mach-vexpress/Kconfig
+++ b/arch/arm/mach-vexpress/Kconfig
@@ -18,6 +18,8 @@ config ARCH_VEXPRESS
18 select POWER_SUPPLY 18 select POWER_SUPPLY
19 select REGULATOR_FIXED_VOLTAGE if REGULATOR 19 select REGULATOR_FIXED_VOLTAGE if REGULATOR
20 select VEXPRESS_CONFIG 20 select VEXPRESS_CONFIG
21 select VEXPRESS_SYSCFG
22 select MFD_VEXPRESS_SYSREG
21 help 23 help
22 This option enables support for systems using Cortex processor based 24 This option enables support for systems using Cortex processor based
23 ARM core and logic (FPGA) tiles on the Versatile Express motherboard, 25 ARM core and logic (FPGA) tiles on the Versatile Express motherboard,
diff --git a/arch/arm/mach-vexpress/core.h b/arch/arm/mach-vexpress/core.h
index bde4374ab6d5..152fad91b3ae 100644
--- a/arch/arm/mach-vexpress/core.h
+++ b/arch/arm/mach-vexpress/core.h
@@ -4,10 +4,9 @@
4/* Tile's peripherals static mappings should start here */ 4/* Tile's peripherals static mappings should start here */
5#define V2T_PERIPH 0xf8200000 5#define V2T_PERIPH 0xf8200000
6 6
7void vexpress_dt_smp_map_io(void);
8
9bool vexpress_smp_init_ops(void); 7bool vexpress_smp_init_ops(void);
10 8
11extern struct smp_operations vexpress_smp_ops; 9extern struct smp_operations vexpress_smp_ops;
10extern struct smp_operations vexpress_smp_dt_ops;
12 11
13extern void vexpress_cpu_die(unsigned int cpu); 12extern void vexpress_cpu_die(unsigned int cpu);
diff --git a/arch/arm/mach-vexpress/ct-ca9x4.c b/arch/arm/mach-vexpress/ct-ca9x4.c
index 6f34497a4245..494d70bfddad 100644
--- a/arch/arm/mach-vexpress/ct-ca9x4.c
+++ b/arch/arm/mach-vexpress/ct-ca9x4.c
@@ -128,6 +128,10 @@ static struct platform_device pmu_device = {
128 .resource = pmu_resources, 128 .resource = pmu_resources,
129}; 129};
130 130
131static struct clk_lookup osc1_lookup = {
132 .dev_id = "ct:clcd",
133};
134
131static struct platform_device osc1_device = { 135static struct platform_device osc1_device = {
132 .name = "vexpress-osc", 136 .name = "vexpress-osc",
133 .id = 1, 137 .id = 1,
@@ -135,6 +139,7 @@ static struct platform_device osc1_device = {
135 .resource = (struct resource []) { 139 .resource = (struct resource []) {
136 VEXPRESS_RES_FUNC(0xf, 1), 140 VEXPRESS_RES_FUNC(0xf, 1),
137 }, 141 },
142 .dev.platform_data = &osc1_lookup,
138}; 143};
139 144
140static void __init ct_ca9x4_init(void) 145static void __init ct_ca9x4_init(void)
@@ -155,10 +160,7 @@ static void __init ct_ca9x4_init(void)
155 amba_device_register(ct_ca9x4_amba_devs[i], &iomem_resource); 160 amba_device_register(ct_ca9x4_amba_devs[i], &iomem_resource);
156 161
157 platform_device_register(&pmu_device); 162 platform_device_register(&pmu_device);
158 platform_device_register(&osc1_device); 163 vexpress_syscfg_device_register(&osc1_device);
159
160 WARN_ON(clk_register_clkdev(vexpress_osc_setup(&osc1_device.dev),
161 NULL, "ct:clcd"));
162} 164}
163 165
164#ifdef CONFIG_SMP 166#ifdef CONFIG_SMP
diff --git a/arch/arm/mach-vexpress/platsmp.c b/arch/arm/mach-vexpress/platsmp.c
index 993c9ae5dc5e..a1f3804fd5a5 100644
--- a/arch/arm/mach-vexpress/platsmp.c
+++ b/arch/arm/mach-vexpress/platsmp.c
@@ -12,8 +12,7 @@
12#include <linux/errno.h> 12#include <linux/errno.h>
13#include <linux/smp.h> 13#include <linux/smp.h>
14#include <linux/io.h> 14#include <linux/io.h>
15#include <linux/of.h> 15#include <linux/of_address.h>
16#include <linux/of_fdt.h>
17#include <linux/vexpress.h> 16#include <linux/vexpress.h>
18 17
19#include <asm/mcpm.h> 18#include <asm/mcpm.h>
@@ -26,154 +25,13 @@
26 25
27#include "core.h" 26#include "core.h"
28 27
29#if defined(CONFIG_OF)
30
31static enum {
32 GENERIC_SCU,
33 CORTEX_A9_SCU,
34} vexpress_dt_scu __initdata = GENERIC_SCU;
35
36static struct map_desc vexpress_dt_cortex_a9_scu_map __initdata = {
37 .virtual = V2T_PERIPH,
38 /* .pfn set in vexpress_dt_init_cortex_a9_scu() */
39 .length = SZ_128,
40 .type = MT_DEVICE,
41};
42
43static void *vexpress_dt_cortex_a9_scu_base __initdata;
44
45const static char *vexpress_dt_cortex_a9_match[] __initconst = {
46 "arm,cortex-a5-scu",
47 "arm,cortex-a9-scu",
48 NULL
49};
50
51static int __init vexpress_dt_find_scu(unsigned long node,
52 const char *uname, int depth, void *data)
53{
54 if (of_flat_dt_match(node, vexpress_dt_cortex_a9_match)) {
55 phys_addr_t phys_addr;
56 __be32 *reg = of_get_flat_dt_prop(node, "reg", NULL);
57
58 if (WARN_ON(!reg))
59 return -EINVAL;
60
61 phys_addr = be32_to_cpup(reg);
62 vexpress_dt_scu = CORTEX_A9_SCU;
63
64 vexpress_dt_cortex_a9_scu_map.pfn = __phys_to_pfn(phys_addr);
65 iotable_init(&vexpress_dt_cortex_a9_scu_map, 1);
66 vexpress_dt_cortex_a9_scu_base = ioremap(phys_addr, SZ_256);
67 if (WARN_ON(!vexpress_dt_cortex_a9_scu_base))
68 return -EFAULT;
69 }
70
71 return 0;
72}
73
74void __init vexpress_dt_smp_map_io(void)
75{
76 if (initial_boot_params)
77 WARN_ON(of_scan_flat_dt(vexpress_dt_find_scu, NULL));
78}
79
80static int __init vexpress_dt_cpus_num(unsigned long node, const char *uname,
81 int depth, void *data)
82{
83 static int prev_depth = -1;
84 static int nr_cpus = -1;
85
86 if (prev_depth > depth && nr_cpus > 0)
87 return nr_cpus;
88
89 if (nr_cpus < 0 && strcmp(uname, "cpus") == 0)
90 nr_cpus = 0;
91
92 if (nr_cpus >= 0) {
93 const char *device_type = of_get_flat_dt_prop(node,
94 "device_type", NULL);
95
96 if (device_type && strcmp(device_type, "cpu") == 0)
97 nr_cpus++;
98 }
99
100 prev_depth = depth;
101
102 return 0;
103}
104
105static void __init vexpress_dt_smp_init_cpus(void)
106{
107 int ncores = 0, i;
108
109 switch (vexpress_dt_scu) {
110 case GENERIC_SCU:
111 ncores = of_scan_flat_dt(vexpress_dt_cpus_num, NULL);
112 break;
113 case CORTEX_A9_SCU:
114 ncores = scu_get_core_count(vexpress_dt_cortex_a9_scu_base);
115 break;
116 default:
117 WARN_ON(1);
118 break;
119 }
120
121 if (ncores < 2)
122 return;
123
124 if (ncores > nr_cpu_ids) {
125 pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
126 ncores, nr_cpu_ids);
127 ncores = nr_cpu_ids;
128 }
129
130 for (i = 0; i < ncores; ++i)
131 set_cpu_possible(i, true);
132}
133
134static void __init vexpress_dt_smp_prepare_cpus(unsigned int max_cpus)
135{
136 int i;
137
138 switch (vexpress_dt_scu) {
139 case GENERIC_SCU:
140 for (i = 0; i < max_cpus; i++)
141 set_cpu_present(i, true);
142 break;
143 case CORTEX_A9_SCU:
144 scu_enable(vexpress_dt_cortex_a9_scu_base);
145 break;
146 default:
147 WARN_ON(1);
148 break;
149 }
150}
151
152#else
153
154static void __init vexpress_dt_smp_init_cpus(void)
155{
156 WARN_ON(1);
157}
158
159void __init vexpress_dt_smp_prepare_cpus(unsigned int max_cpus)
160{
161 WARN_ON(1);
162}
163
164#endif
165
166/* 28/*
167 * Initialise the CPU possible map early - this describes the CPUs 29 * Initialise the CPU possible map early - this describes the CPUs
168 * which may be present or become present in the system. 30 * which may be present or become present in the system.
169 */ 31 */
170static void __init vexpress_smp_init_cpus(void) 32static void __init vexpress_smp_init_cpus(void)
171{ 33{
172 if (ct_desc) 34 ct_desc->init_cpu_map();
173 ct_desc->init_cpu_map();
174 else
175 vexpress_dt_smp_init_cpus();
176
177} 35}
178 36
179static void __init vexpress_smp_prepare_cpus(unsigned int max_cpus) 37static void __init vexpress_smp_prepare_cpus(unsigned int max_cpus)
@@ -182,10 +40,7 @@ static void __init vexpress_smp_prepare_cpus(unsigned int max_cpus)
182 * Initialise the present map, which describes the set of CPUs 40 * Initialise the present map, which describes the set of CPUs
183 * actually populated at the present time. 41 * actually populated at the present time.
184 */ 42 */
185 if (ct_desc) 43 ct_desc->smp_enable(max_cpus);
186 ct_desc->smp_enable(max_cpus);
187 else
188 vexpress_dt_smp_prepare_cpus(max_cpus);
189 44
190 /* 45 /*
191 * Write the address of secondary startup into the 46 * Write the address of secondary startup into the
@@ -223,3 +78,39 @@ bool __init vexpress_smp_init_ops(void)
223#endif 78#endif
224 return false; 79 return false;
225} 80}
81
82#if defined(CONFIG_OF)
83
84static const struct of_device_id vexpress_smp_dt_scu_match[] __initconst = {
85 { .compatible = "arm,cortex-a5-scu", },
86 { .compatible = "arm,cortex-a9-scu", },
87 {}
88};
89
90static void __init vexpress_smp_dt_prepare_cpus(unsigned int max_cpus)
91{
92 struct device_node *scu = of_find_matching_node(NULL,
93 vexpress_smp_dt_scu_match);
94
95 if (scu)
96 scu_enable(of_iomap(scu, 0));
97
98 /*
99 * Write the address of secondary startup into the
100 * system-wide flags register. The boot monitor waits
101 * until it receives a soft interrupt, and then the
102 * secondary CPU branches to this address.
103 */
104 vexpress_flags_set(virt_to_phys(versatile_secondary_startup));
105}
106
107struct smp_operations __initdata vexpress_smp_dt_ops = {
108 .smp_prepare_cpus = vexpress_smp_dt_prepare_cpus,
109 .smp_secondary_init = versatile_secondary_init,
110 .smp_boot_secondary = versatile_boot_secondary,
111#ifdef CONFIG_HOTPLUG_CPU
112 .cpu_die = vexpress_cpu_die,
113#endif
114};
115
116#endif
diff --git a/arch/arm/mach-vexpress/v2m.c b/arch/arm/mach-vexpress/v2m.c
index 4f8b8cb17ff5..38f4f6f37770 100644
--- a/arch/arm/mach-vexpress/v2m.c
+++ b/arch/arm/mach-vexpress/v2m.c
@@ -201,8 +201,9 @@ static struct platform_device v2m_cf_device = {
201 201
202static struct mmci_platform_data v2m_mmci_data = { 202static struct mmci_platform_data v2m_mmci_data = {
203 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, 203 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
204 .gpio_wp = VEXPRESS_GPIO_MMC_WPROT, 204 .status = vexpress_get_mci_cardin,
205 .gpio_cd = VEXPRESS_GPIO_MMC_CARDIN, 205 .gpio_cd = -1,
206 .gpio_wp = -1,
206}; 207};
207 208
208static struct resource v2m_sysreg_resources[] = { 209static struct resource v2m_sysreg_resources[] = {
@@ -340,11 +341,6 @@ static void __init v2m_init(void)
340 regulator_register_fixed(0, v2m_eth_supplies, 341 regulator_register_fixed(0, v2m_eth_supplies,
341 ARRAY_SIZE(v2m_eth_supplies)); 342 ARRAY_SIZE(v2m_eth_supplies));
342 343
343 platform_device_register(&v2m_muxfpga_device);
344 platform_device_register(&v2m_shutdown_device);
345 platform_device_register(&v2m_reboot_device);
346 platform_device_register(&v2m_dvimode_device);
347
348 platform_device_register(&v2m_sysreg_device); 344 platform_device_register(&v2m_sysreg_device);
349 platform_device_register(&v2m_pcie_i2c_device); 345 platform_device_register(&v2m_pcie_i2c_device);
350 platform_device_register(&v2m_ddc_i2c_device); 346 platform_device_register(&v2m_ddc_i2c_device);
@@ -356,6 +352,11 @@ static void __init v2m_init(void)
356 for (i = 0; i < ARRAY_SIZE(v2m_amba_devs); i++) 352 for (i = 0; i < ARRAY_SIZE(v2m_amba_devs); i++)
357 amba_device_register(v2m_amba_devs[i], &iomem_resource); 353 amba_device_register(v2m_amba_devs[i], &iomem_resource);
358 354
355 vexpress_syscfg_device_register(&v2m_muxfpga_device);
356 vexpress_syscfg_device_register(&v2m_shutdown_device);
357 vexpress_syscfg_device_register(&v2m_reboot_device);
358 vexpress_syscfg_device_register(&v2m_dvimode_device);
359
359 ct_desc->init_tile(); 360 ct_desc->init_tile();
360} 361}
361 362
@@ -369,71 +370,10 @@ MACHINE_START(VEXPRESS, "ARM-Versatile Express")
369 .init_machine = v2m_init, 370 .init_machine = v2m_init,
370MACHINE_END 371MACHINE_END
371 372
372static struct map_desc v2m_rs1_io_desc __initdata = {
373 .virtual = V2M_PERIPH,
374 .pfn = __phys_to_pfn(0x1c000000),
375 .length = SZ_2M,
376 .type = MT_DEVICE,
377};
378
379static int __init v2m_dt_scan_memory_map(unsigned long node, const char *uname,
380 int depth, void *data)
381{
382 const char **map = data;
383
384 if (strcmp(uname, "motherboard") != 0)
385 return 0;
386
387 *map = of_get_flat_dt_prop(node, "arm,v2m-memory-map", NULL);
388
389 return 1;
390}
391
392void __init v2m_dt_map_io(void)
393{
394 const char *map = NULL;
395
396 of_scan_flat_dt(v2m_dt_scan_memory_map, &map);
397
398 if (map && strcmp(map, "rs1") == 0)
399 iotable_init(&v2m_rs1_io_desc, 1);
400 else
401 iotable_init(v2m_io_desc, ARRAY_SIZE(v2m_io_desc));
402
403#if defined(CONFIG_SMP)
404 vexpress_dt_smp_map_io();
405#endif
406}
407
408void __init v2m_dt_init_early(void)
409{
410 u32 dt_hbi;
411
412 vexpress_sysreg_of_early_init();
413
414 /* Confirm board type against DT property, if available */
415 if (of_property_read_u32(of_allnodes, "arm,hbi", &dt_hbi) == 0) {
416 u32 hbi = vexpress_get_hbi(VEXPRESS_SITE_MASTER);
417
418 if (WARN_ON(dt_hbi != hbi))
419 pr_warning("vexpress: DT HBI (%x) is not matching "
420 "hardware (%x)!\n", dt_hbi, hbi);
421 }
422
423 versatile_sched_clock_init(vexpress_get_24mhz_clock_base(), 24000000);
424}
425
426static const struct of_device_id v2m_dt_bus_match[] __initconst = {
427 { .compatible = "simple-bus", },
428 { .compatible = "arm,amba-bus", },
429 { .compatible = "arm,vexpress,config-bus", },
430 {}
431};
432
433static void __init v2m_dt_init(void) 373static void __init v2m_dt_init(void)
434{ 374{
435 l2x0_of_init(0x00400000, 0xfe0fffff); 375 l2x0_of_init(0x00400000, 0xfe0fffff);
436 of_platform_populate(NULL, v2m_dt_bus_match, NULL, NULL); 376 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
437} 377}
438 378
439static const char * const v2m_dt_match[] __initconst = { 379static const char * const v2m_dt_match[] __initconst = {
@@ -443,9 +383,7 @@ static const char * const v2m_dt_match[] __initconst = {
443 383
444DT_MACHINE_START(VEXPRESS_DT, "ARM-Versatile Express") 384DT_MACHINE_START(VEXPRESS_DT, "ARM-Versatile Express")
445 .dt_compat = v2m_dt_match, 385 .dt_compat = v2m_dt_match,
446 .smp = smp_ops(vexpress_smp_ops), 386 .smp = smp_ops(vexpress_smp_dt_ops),
447 .smp_init = smp_init_ops(vexpress_smp_init_ops), 387 .smp_init = smp_init_ops(vexpress_smp_init_ops),
448 .map_io = v2m_dt_map_io,
449 .init_early = v2m_dt_init_early,
450 .init_machine = v2m_dt_init, 388 .init_machine = v2m_dt_init,
451MACHINE_END 389MACHINE_END
diff --git a/arch/arm/plat-omap/counter_32k.c b/arch/arm/plat-omap/counter_32k.c
index 384a776d8eb2..61b4d705c267 100644
--- a/arch/arm/plat-omap/counter_32k.c
+++ b/arch/arm/plat-omap/counter_32k.c
@@ -40,7 +40,7 @@ static void __iomem *sync32k_cnt_reg;
40 40
41static u64 notrace omap_32k_read_sched_clock(void) 41static u64 notrace omap_32k_read_sched_clock(void)
42{ 42{
43 return sync32k_cnt_reg ? __raw_readl(sync32k_cnt_reg) : 0; 43 return sync32k_cnt_reg ? readl_relaxed(sync32k_cnt_reg) : 0;
44} 44}
45 45
46/** 46/**
@@ -64,7 +64,7 @@ static void omap_read_persistent_clock(struct timespec *ts)
64 spin_lock_irqsave(&read_persistent_clock_lock, flags); 64 spin_lock_irqsave(&read_persistent_clock_lock, flags);
65 65
66 last_cycles = cycles; 66 last_cycles = cycles;
67 cycles = sync32k_cnt_reg ? __raw_readl(sync32k_cnt_reg) : 0; 67 cycles = sync32k_cnt_reg ? readl_relaxed(sync32k_cnt_reg) : 0;
68 68
69 nsecs = clocksource_cyc2ns(cycles - last_cycles, 69 nsecs = clocksource_cyc2ns(cycles - last_cycles,
70 persistent_mult, persistent_shift); 70 persistent_mult, persistent_shift);
@@ -95,7 +95,7 @@ int __init omap_init_clocksource_32k(void __iomem *vbase)
95 * The 'SCHEME' bits(30-31) of the revision register is used 95 * The 'SCHEME' bits(30-31) of the revision register is used
96 * to identify the version. 96 * to identify the version.
97 */ 97 */
98 if (__raw_readl(vbase + OMAP2_32KSYNCNT_REV_OFF) & 98 if (readl_relaxed(vbase + OMAP2_32KSYNCNT_REV_OFF) &
99 OMAP2_32KSYNCNT_REV_SCHEME) 99 OMAP2_32KSYNCNT_REV_SCHEME)
100 sync32k_cnt_reg = vbase + OMAP2_32KSYNCNT_CR_OFF_HIGH; 100 sync32k_cnt_reg = vbase + OMAP2_32KSYNCNT_CR_OFF_HIGH;
101 else 101 else
diff --git a/arch/arm/plat-omap/debug-leds.c b/arch/arm/plat-omap/debug-leds.c
index aa7ebc6bcd65..48b69de89a5d 100644
--- a/arch/arm/plat-omap/debug-leds.c
+++ b/arch/arm/plat-omap/debug-leds.c
@@ -85,12 +85,12 @@ static void dbg_led_set(struct led_classdev *cdev,
85 struct dbg_led *led = container_of(cdev, struct dbg_led, cdev); 85 struct dbg_led *led = container_of(cdev, struct dbg_led, cdev);
86 u16 reg; 86 u16 reg;
87 87
88 reg = __raw_readw(&fpga->leds); 88 reg = readw_relaxed(&fpga->leds);
89 if (b != LED_OFF) 89 if (b != LED_OFF)
90 reg |= led->mask; 90 reg |= led->mask;
91 else 91 else
92 reg &= ~led->mask; 92 reg &= ~led->mask;
93 __raw_writew(reg, &fpga->leds); 93 writew_relaxed(reg, &fpga->leds);
94} 94}
95 95
96static enum led_brightness dbg_led_get(struct led_classdev *cdev) 96static enum led_brightness dbg_led_get(struct led_classdev *cdev)
@@ -98,7 +98,7 @@ static enum led_brightness dbg_led_get(struct led_classdev *cdev)
98 struct dbg_led *led = container_of(cdev, struct dbg_led, cdev); 98 struct dbg_led *led = container_of(cdev, struct dbg_led, cdev);
99 u16 reg; 99 u16 reg;
100 100
101 reg = __raw_readw(&fpga->leds); 101 reg = readw_relaxed(&fpga->leds);
102 return (reg & led->mask) ? LED_FULL : LED_OFF; 102 return (reg & led->mask) ? LED_FULL : LED_OFF;
103} 103}
104 104
@@ -112,7 +112,7 @@ static int fpga_probe(struct platform_device *pdev)
112 return -ENODEV; 112 return -ENODEV;
113 113
114 fpga = ioremap(iomem->start, resource_size(iomem)); 114 fpga = ioremap(iomem->start, resource_size(iomem));
115 __raw_writew(0xff, &fpga->leds); 115 writew_relaxed(0xff, &fpga->leds);
116 116
117 for (i = 0; i < ARRAY_SIZE(dbg_leds); i++) { 117 for (i = 0; i < ARRAY_SIZE(dbg_leds); i++) {
118 struct dbg_led *led; 118 struct dbg_led *led;
@@ -138,15 +138,15 @@ static int fpga_probe(struct platform_device *pdev)
138 138
139static int fpga_suspend_noirq(struct device *dev) 139static int fpga_suspend_noirq(struct device *dev)
140{ 140{
141 fpga_led_state = __raw_readw(&fpga->leds); 141 fpga_led_state = readw_relaxed(&fpga->leds);
142 __raw_writew(0xff, &fpga->leds); 142 writew_relaxed(0xff, &fpga->leds);
143 143
144 return 0; 144 return 0;
145} 145}
146 146
147static int fpga_resume_noirq(struct device *dev) 147static int fpga_resume_noirq(struct device *dev)
148{ 148{
149 __raw_writew(~fpga_led_state, &fpga->leds); 149 writew_relaxed(~fpga_led_state, &fpga->leds);
150 return 0; 150 return 0;
151} 151}
152 152
diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
index 869254cebf84..db10169a08de 100644
--- a/arch/arm/plat-omap/dmtimer.c
+++ b/arch/arm/plat-omap/dmtimer.c
@@ -103,7 +103,7 @@ static void omap_timer_restore_context(struct omap_dm_timer *timer)
103 timer->context.tmar); 103 timer->context.tmar);
104 omap_dm_timer_write_reg(timer, OMAP_TIMER_IF_CTRL_REG, 104 omap_dm_timer_write_reg(timer, OMAP_TIMER_IF_CTRL_REG,
105 timer->context.tsicr); 105 timer->context.tsicr);
106 __raw_writel(timer->context.tier, timer->irq_ena); 106 writel_relaxed(timer->context.tier, timer->irq_ena);
107 omap_dm_timer_write_reg(timer, OMAP_TIMER_CTRL_REG, 107 omap_dm_timer_write_reg(timer, OMAP_TIMER_CTRL_REG,
108 timer->context.tclr); 108 timer->context.tclr);
109} 109}
@@ -699,9 +699,9 @@ int omap_dm_timer_set_int_disable(struct omap_dm_timer *timer, u32 mask)
699 omap_dm_timer_enable(timer); 699 omap_dm_timer_enable(timer);
700 700
701 if (timer->revision == 1) 701 if (timer->revision == 1)
702 l = __raw_readl(timer->irq_ena) & ~mask; 702 l = readl_relaxed(timer->irq_ena) & ~mask;
703 703
704 __raw_writel(l, timer->irq_dis); 704 writel_relaxed(l, timer->irq_dis);
705 l = omap_dm_timer_read_reg(timer, OMAP_TIMER_WAKEUP_EN_REG) & ~mask; 705 l = omap_dm_timer_read_reg(timer, OMAP_TIMER_WAKEUP_EN_REG) & ~mask;
706 omap_dm_timer_write_reg(timer, OMAP_TIMER_WAKEUP_EN_REG, l); 706 omap_dm_timer_write_reg(timer, OMAP_TIMER_WAKEUP_EN_REG, l);
707 707
@@ -722,7 +722,7 @@ unsigned int omap_dm_timer_read_status(struct omap_dm_timer *timer)
722 return 0; 722 return 0;
723 } 723 }
724 724
725 l = __raw_readl(timer->irq_stat); 725 l = readl_relaxed(timer->irq_stat);
726 726
727 return l; 727 return l;
728} 728}
diff --git a/arch/arm/plat-omap/include/plat/dmtimer.h b/arch/arm/plat-omap/include/plat/dmtimer.h
index 2861b155485a..dd79f3005cdf 100644
--- a/arch/arm/plat-omap/include/plat/dmtimer.h
+++ b/arch/arm/plat-omap/include/plat/dmtimer.h
@@ -280,20 +280,20 @@ static inline u32 __omap_dm_timer_read(struct omap_dm_timer *timer, u32 reg,
280 int posted) 280 int posted)
281{ 281{
282 if (posted) 282 if (posted)
283 while (__raw_readl(timer->pend) & (reg >> WPSHIFT)) 283 while (readl_relaxed(timer->pend) & (reg >> WPSHIFT))
284 cpu_relax(); 284 cpu_relax();
285 285
286 return __raw_readl(timer->func_base + (reg & 0xff)); 286 return readl_relaxed(timer->func_base + (reg & 0xff));
287} 287}
288 288
289static inline void __omap_dm_timer_write(struct omap_dm_timer *timer, 289static inline void __omap_dm_timer_write(struct omap_dm_timer *timer,
290 u32 reg, u32 val, int posted) 290 u32 reg, u32 val, int posted)
291{ 291{
292 if (posted) 292 if (posted)
293 while (__raw_readl(timer->pend) & (reg >> WPSHIFT)) 293 while (readl_relaxed(timer->pend) & (reg >> WPSHIFT))
294 cpu_relax(); 294 cpu_relax();
295 295
296 __raw_writel(val, timer->func_base + (reg & 0xff)); 296 writel_relaxed(val, timer->func_base + (reg & 0xff));
297} 297}
298 298
299static inline void __omap_dm_timer_init_regs(struct omap_dm_timer *timer) 299static inline void __omap_dm_timer_init_regs(struct omap_dm_timer *timer)
@@ -301,7 +301,7 @@ static inline void __omap_dm_timer_init_regs(struct omap_dm_timer *timer)
301 u32 tidr; 301 u32 tidr;
302 302
303 /* Assume v1 ip if bits [31:16] are zero */ 303 /* Assume v1 ip if bits [31:16] are zero */
304 tidr = __raw_readl(timer->io_base); 304 tidr = readl_relaxed(timer->io_base);
305 if (!(tidr >> 16)) { 305 if (!(tidr >> 16)) {
306 timer->revision = 1; 306 timer->revision = 1;
307 timer->irq_stat = timer->io_base + OMAP_TIMER_V1_STAT_OFFSET; 307 timer->irq_stat = timer->io_base + OMAP_TIMER_V1_STAT_OFFSET;
@@ -385,7 +385,7 @@ static inline void __omap_dm_timer_stop(struct omap_dm_timer *timer,
385 } 385 }
386 386
387 /* Ack possibly pending interrupt */ 387 /* Ack possibly pending interrupt */
388 __raw_writel(OMAP_TIMER_INT_OVERFLOW, timer->irq_stat); 388 writel_relaxed(OMAP_TIMER_INT_OVERFLOW, timer->irq_stat);
389} 389}
390 390
391static inline void __omap_dm_timer_load_start(struct omap_dm_timer *timer, 391static inline void __omap_dm_timer_load_start(struct omap_dm_timer *timer,
@@ -399,7 +399,7 @@ static inline void __omap_dm_timer_load_start(struct omap_dm_timer *timer,
399static inline void __omap_dm_timer_int_enable(struct omap_dm_timer *timer, 399static inline void __omap_dm_timer_int_enable(struct omap_dm_timer *timer,
400 unsigned int value) 400 unsigned int value)
401{ 401{
402 __raw_writel(value, timer->irq_ena); 402 writel_relaxed(value, timer->irq_ena);
403 __omap_dm_timer_write(timer, OMAP_TIMER_WAKEUP_EN_REG, value, 0); 403 __omap_dm_timer_write(timer, OMAP_TIMER_WAKEUP_EN_REG, value, 0);
404} 404}
405 405
@@ -412,7 +412,7 @@ __omap_dm_timer_read_counter(struct omap_dm_timer *timer, int posted)
412static inline void __omap_dm_timer_write_status(struct omap_dm_timer *timer, 412static inline void __omap_dm_timer_write_status(struct omap_dm_timer *timer,
413 unsigned int value) 413 unsigned int value)
414{ 414{
415 __raw_writel(value, timer->irq_stat); 415 writel_relaxed(value, timer->irq_stat);
416} 416}
417 417
418#endif /* __ASM_ARCH_DMTIMER_H */ 418#endif /* __ASM_ARCH_DMTIMER_H */
diff --git a/arch/arm/plat-samsung/include/plat/cpu-freq-core.h b/arch/arm/plat-samsung/include/plat/cpu-freq-core.h
index 7231c8e4975e..72d4178ad23b 100644
--- a/arch/arm/plat-samsung/include/plat/cpu-freq-core.h
+++ b/arch/arm/plat-samsung/include/plat/cpu-freq-core.h
@@ -119,6 +119,7 @@ struct s3c_plltab {
119struct s3c_cpufreq_config { 119struct s3c_cpufreq_config {
120 struct s3c_freq freq; 120 struct s3c_freq freq;
121 struct s3c_freq max; 121 struct s3c_freq max;
122 struct clk *mpll;
122 struct cpufreq_frequency_table pll; 123 struct cpufreq_frequency_table pll;
123 struct s3c_clkdivs divs; 124 struct s3c_clkdivs divs;
124 struct s3c_cpufreq_info *info; /* for core, not drivers */ 125 struct s3c_cpufreq_info *info; /* for core, not drivers */
diff --git a/arch/arm/plat-samsung/include/plat/cpu.h b/arch/arm/plat-samsung/include/plat/cpu.h
index 5992b8dd9b89..5a237db9f9eb 100644
--- a/arch/arm/plat-samsung/include/plat/cpu.h
+++ b/arch/arm/plat-samsung/include/plat/cpu.h
@@ -43,16 +43,6 @@ extern unsigned long samsung_cpu_id;
43#define S5PV210_CPU_ID 0x43110000 43#define S5PV210_CPU_ID 0x43110000
44#define S5PV210_CPU_MASK 0xFFFFF000 44#define S5PV210_CPU_MASK 0xFFFFF000
45 45
46#define EXYNOS4210_CPU_ID 0x43210000
47#define EXYNOS4212_CPU_ID 0x43220000
48#define EXYNOS4412_CPU_ID 0xE4412200
49#define EXYNOS4_CPU_MASK 0xFFFE0000
50
51#define EXYNOS5250_SOC_ID 0x43520000
52#define EXYNOS5420_SOC_ID 0xE5420000
53#define EXYNOS5440_SOC_ID 0xE5440000
54#define EXYNOS5_SOC_MASK 0xFFFFF000
55
56#define IS_SAMSUNG_CPU(name, id, mask) \ 46#define IS_SAMSUNG_CPU(name, id, mask) \
57static inline int is_samsung_##name(void) \ 47static inline int is_samsung_##name(void) \
58{ \ 48{ \
@@ -68,12 +58,6 @@ IS_SAMSUNG_CPU(s5p6440, S5P6440_CPU_ID, S5P64XX_CPU_MASK)
68IS_SAMSUNG_CPU(s5p6450, S5P6450_CPU_ID, S5P64XX_CPU_MASK) 58IS_SAMSUNG_CPU(s5p6450, S5P6450_CPU_ID, S5P64XX_CPU_MASK)
69IS_SAMSUNG_CPU(s5pc100, S5PC100_CPU_ID, S5PC100_CPU_MASK) 59IS_SAMSUNG_CPU(s5pc100, S5PC100_CPU_ID, S5PC100_CPU_MASK)
70IS_SAMSUNG_CPU(s5pv210, S5PV210_CPU_ID, S5PV210_CPU_MASK) 60IS_SAMSUNG_CPU(s5pv210, S5PV210_CPU_ID, S5PV210_CPU_MASK)
71IS_SAMSUNG_CPU(exynos4210, EXYNOS4210_CPU_ID, EXYNOS4_CPU_MASK)
72IS_SAMSUNG_CPU(exynos4212, EXYNOS4212_CPU_ID, EXYNOS4_CPU_MASK)
73IS_SAMSUNG_CPU(exynos4412, EXYNOS4412_CPU_ID, EXYNOS4_CPU_MASK)
74IS_SAMSUNG_CPU(exynos5250, EXYNOS5250_SOC_ID, EXYNOS5_SOC_MASK)
75IS_SAMSUNG_CPU(exynos5420, EXYNOS5420_SOC_ID, EXYNOS5_SOC_MASK)
76IS_SAMSUNG_CPU(exynos5440, EXYNOS5440_SOC_ID, EXYNOS5_SOC_MASK)
77 61
78#if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2412) || \ 62#if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2412) || \
79 defined(CONFIG_CPU_S3C2416) || defined(CONFIG_CPU_S3C2440) || \ 63 defined(CONFIG_CPU_S3C2416) || defined(CONFIG_CPU_S3C2440) || \
@@ -126,50 +110,6 @@ IS_SAMSUNG_CPU(exynos5440, EXYNOS5440_SOC_ID, EXYNOS5_SOC_MASK)
126# define soc_is_s5pv210() 0 110# define soc_is_s5pv210() 0
127#endif 111#endif
128 112
129#if defined(CONFIG_CPU_EXYNOS4210)
130# define soc_is_exynos4210() is_samsung_exynos4210()
131#else
132# define soc_is_exynos4210() 0
133#endif
134
135#if defined(CONFIG_SOC_EXYNOS4212)
136# define soc_is_exynos4212() is_samsung_exynos4212()
137#else
138# define soc_is_exynos4212() 0
139#endif
140
141#if defined(CONFIG_SOC_EXYNOS4412)
142# define soc_is_exynos4412() is_samsung_exynos4412()
143#else
144# define soc_is_exynos4412() 0
145#endif
146
147#define EXYNOS4210_REV_0 (0x0)
148#define EXYNOS4210_REV_1_0 (0x10)
149#define EXYNOS4210_REV_1_1 (0x11)
150
151#if defined(CONFIG_SOC_EXYNOS5250)
152# define soc_is_exynos5250() is_samsung_exynos5250()
153#else
154# define soc_is_exynos5250() 0
155#endif
156
157#if defined(CONFIG_SOC_EXYNOS5420)
158# define soc_is_exynos5420() is_samsung_exynos5420()
159#else
160# define soc_is_exynos5420() 0
161#endif
162
163#if defined(CONFIG_SOC_EXYNOS5440)
164# define soc_is_exynos5440() is_samsung_exynos5440()
165#else
166# define soc_is_exynos5440() 0
167#endif
168
169#define soc_is_exynos4() (soc_is_exynos4210() || soc_is_exynos4212() || \
170 soc_is_exynos4412())
171#define soc_is_exynos5() (soc_is_exynos5250() || soc_is_exynos5420())
172
173#define IODESC_ENT(x) { (unsigned long)S3C24XX_VA_##x, __phys_to_pfn(S3C24XX_PA_##x), S3C24XX_SZ_##x, MT_DEVICE } 113#define IODESC_ENT(x) { (unsigned long)S3C24XX_VA_##x, __phys_to_pfn(S3C24XX_PA_##x), S3C24XX_SZ_##x, MT_DEVICE }
174 114
175#ifndef KHZ 115#ifndef KHZ
@@ -239,7 +179,6 @@ extern struct bus_type s3c2443_subsys;
239extern struct bus_type s3c6410_subsys; 179extern struct bus_type s3c6410_subsys;
240extern struct bus_type s5p64x0_subsys; 180extern struct bus_type s5p64x0_subsys;
241extern struct bus_type s5pv210_subsys; 181extern struct bus_type s5pv210_subsys;
242extern struct bus_type exynos_subsys;
243 182
244extern void (*s5pc1xx_idle)(void); 183extern void (*s5pc1xx_idle)(void);
245 184
diff --git a/arch/arm/plat-versatile/Kconfig b/arch/arm/plat-versatile/Kconfig
index 2c4332b9f948..fce41e93b6a4 100644
--- a/arch/arm/plat-versatile/Kconfig
+++ b/arch/arm/plat-versatile/Kconfig
@@ -6,12 +6,6 @@ config PLAT_VERSATILE_CLOCK
6config PLAT_VERSATILE_CLCD 6config PLAT_VERSATILE_CLCD
7 bool 7 bool
8 8
9config PLAT_VERSATILE_LEDS
10 def_bool y if NEW_LEDS
11 depends on ARCH_REALVIEW || ARCH_VERSATILE
12 select LEDS_CLASS
13 select LEDS_TRIGGERS
14
15config PLAT_VERSATILE_SCHED_CLOCK 9config PLAT_VERSATILE_SCHED_CLOCK
16 def_bool y 10 def_bool y
17 11
diff --git a/arch/arm/plat-versatile/Makefile b/arch/arm/plat-versatile/Makefile
index f88d448b629c..2e0c472958ae 100644
--- a/arch/arm/plat-versatile/Makefile
+++ b/arch/arm/plat-versatile/Makefile
@@ -2,6 +2,5 @@ ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include
2 2
3obj-$(CONFIG_PLAT_VERSATILE_CLOCK) += clock.o 3obj-$(CONFIG_PLAT_VERSATILE_CLOCK) += clock.o
4obj-$(CONFIG_PLAT_VERSATILE_CLCD) += clcd.o 4obj-$(CONFIG_PLAT_VERSATILE_CLCD) += clcd.o
5obj-$(CONFIG_PLAT_VERSATILE_LEDS) += leds.o
6obj-$(CONFIG_PLAT_VERSATILE_SCHED_CLOCK) += sched-clock.o 5obj-$(CONFIG_PLAT_VERSATILE_SCHED_CLOCK) += sched-clock.o
7obj-$(CONFIG_SMP) += headsmp.o platsmp.o 6obj-$(CONFIG_SMP) += headsmp.o platsmp.o
diff --git a/arch/arm/plat-versatile/leds.c b/arch/arm/plat-versatile/leds.c
deleted file mode 100644
index d2490d00b46c..000000000000
--- a/arch/arm/plat-versatile/leds.c
+++ /dev/null
@@ -1,103 +0,0 @@
1/*
2 * Driver for the 8 user LEDs found on the RealViews and Versatiles
3 * Based on DaVinci's DM365 board code
4 *
5 * License terms: GNU General Public License (GPL) version 2
6 * Author: Linus Walleij <triad@df.lth.se>
7 */
8#include <linux/kernel.h>
9#include <linux/init.h>
10#include <linux/io.h>
11#include <linux/slab.h>
12#include <linux/leds.h>
13
14#include <mach/hardware.h>
15#include <mach/platform.h>
16
17#ifdef VERSATILE_SYS_BASE
18#define LEDREG (__io_address(VERSATILE_SYS_BASE) + VERSATILE_SYS_LED_OFFSET)
19#endif
20
21#ifdef REALVIEW_SYS_BASE
22#define LEDREG (__io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_LED_OFFSET)
23#endif
24
25struct versatile_led {
26 struct led_classdev cdev;
27 u8 mask;
28};
29
30/*
31 * The triggers lines up below will only be used if the
32 * LED triggers are compiled in.
33 */
34static const struct {
35 const char *name;
36 const char *trigger;
37} versatile_leds[] = {
38 { "versatile:0", "heartbeat", },
39 { "versatile:1", "mmc0", },
40 { "versatile:2", "cpu0" },
41 { "versatile:3", "cpu1" },
42 { "versatile:4", "cpu2" },
43 { "versatile:5", "cpu3" },
44 { "versatile:6", },
45 { "versatile:7", },
46};
47
48static void versatile_led_set(struct led_classdev *cdev,
49 enum led_brightness b)
50{
51 struct versatile_led *led = container_of(cdev,
52 struct versatile_led, cdev);
53 u32 reg = readl(LEDREG);
54
55 if (b != LED_OFF)
56 reg |= led->mask;
57 else
58 reg &= ~led->mask;
59 writel(reg, LEDREG);
60}
61
62static enum led_brightness versatile_led_get(struct led_classdev *cdev)
63{
64 struct versatile_led *led = container_of(cdev,
65 struct versatile_led, cdev);
66 u32 reg = readl(LEDREG);
67
68 return (reg & led->mask) ? LED_FULL : LED_OFF;
69}
70
71static int __init versatile_leds_init(void)
72{
73 int i;
74
75 /* All ON */
76 writel(0xff, LEDREG);
77 for (i = 0; i < ARRAY_SIZE(versatile_leds); i++) {
78 struct versatile_led *led;
79
80 led = kzalloc(sizeof(*led), GFP_KERNEL);
81 if (!led)
82 break;
83
84 led->cdev.name = versatile_leds[i].name;
85 led->cdev.brightness_set = versatile_led_set;
86 led->cdev.brightness_get = versatile_led_get;
87 led->cdev.default_trigger = versatile_leds[i].trigger;
88 led->mask = BIT(i);
89
90 if (led_classdev_register(NULL, &led->cdev) < 0) {
91 kfree(led);
92 break;
93 }
94 }
95
96 return 0;
97}
98
99/*
100 * Since we may have triggers on any subsystem, defer registration
101 * until after subsystem_init.
102 */
103fs_initcall(versatile_leds_init);