aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-09-01 15:10:20 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-09-01 15:10:20 -0400
commitc5fc249862af862df027030188cc083e072ecd19 (patch)
tree1205eaa47b07fc06b79e8c742a15dca5bcb1066c
parent00e3fcc221f6fe6a890bf3e0e71c6b9944e58233 (diff)
parent97a2482d9891f0ad6a3710e0b6ae9949c140c7f1 (diff)
Merge tag 'armsoc-cleanup' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull ARM SoC cleanups from Olof Johansson: "A large cleanup branch this release, with a healthy 10k negative line delta. Most of this is removal of legacy (non-DT) support of shmobile platforms. There is also removal of two non-DT platforms on OMAP, and the plat-samsung directory is cleaned out by moving most of the previously shared-location-but-not-actually-shared files from there to the appropriate mach directories instead. There are other sets of changes in here as well: - Rob Herring removed use of set_irq_flags under all platforms and moved to genirq alternatives - a series of timer API conversions to set-state interface - ep93xx, nomadik and ux500 cleanups from Linus Walleij - __init annotation fixes from Nicolas Pitre + a bunch of other changes that all add up to a nice set of cleanups" * tag 'armsoc-cleanup' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (108 commits) ARM/fb: ep93xx: switch framebuffer to use modedb only ARM: gemini: Setup timer3 as free running timer ARM: gemini: Use timer1 for clockevent ARM: gemini: Add missing register definitions for gemini timer ARM: ep93xx/timer: Migrate to new 'set-state' interface ARM: nomadik: push accelerometer down to boards ARM: nomadik: move l2x0 setup to device tree ARM: nomadik: selectively enable UART0 on boards ARM: nomadik: move hog code to use DT hogs ARM: shmobile: Fix mismerges ARM: ux500: simplify secondary CPU boot ARM: SAMSUNG: remove keypad-core header in plat-samsung ARM: SAMSUNG: local watchdog-reset header in mach-s3c64xx ARM: SAMSUNG: local onenand-core header in mach-s3c64xx ARM: SAMSUNG: local irq-uart header in mach-s3c64xx ARM: SAMSUNG: local backlight header in mach-s3c64xx ARM: SAMSUNG: local ata-core header in mach-s3c64xx ARM: SAMSUNG: local regs-usb-hsotg-phy header in mach-s3c64xx ARM: SAMSUNG: local spi-core header in mach-s3c24xx ARM: SAMSUNG: local nand-core header in mach-s3c24xx ...
-rw-r--r--Documentation/devicetree/bindings/sound/nvidia,tegra30-hda.txt8
-rw-r--r--MAINTAINERS2
-rw-r--r--arch/arm/Kconfig11
-rw-r--r--arch/arm/boot/compressed/Makefile4
-rw-r--r--arch/arm/boot/compressed/head-shmobile.S71
-rw-r--r--arch/arm/boot/dts/Makefile5
-rw-r--r--arch/arm/boot/dts/ste-nomadik-nhk15.dts39
-rw-r--r--arch/arm/boot/dts/ste-nomadik-s8815.dts44
-rw-r--r--arch/arm/boot/dts/ste-nomadik-stn8815.dtsi22
-rw-r--r--arch/arm/common/it8152.c2
-rw-r--r--arch/arm/common/locomo.c11
-rw-r--r--arch/arm/common/sa1111.c9
-rw-r--r--arch/arm/configs/armadillo800eva_defconfig162
-rw-r--r--arch/arm/configs/kzm9g_defconfig154
-rw-r--r--arch/arm/kernel/irq.c4
-rw-r--r--arch/arm/kernel/psci.c2
-rw-r--r--arch/arm/kernel/smp_twd.c48
-rw-r--r--arch/arm/mach-at91/at91rm9200.c2
-rw-r--r--arch/arm/mach-at91/at91sam9.c6
-rw-r--r--arch/arm/mach-at91/pm.c2
-rw-r--r--arch/arm/mach-at91/sama5.c4
-rw-r--r--arch/arm/mach-bcm/Makefile4
-rw-r--r--arch/arm/mach-bcm/bcm63xx_headsmp.S23
-rw-r--r--arch/arm/mach-bcm/bcm63xx_smp.c4
-rw-r--r--arch/arm/mach-bcm/bcm63xx_smp.h1
-rw-r--r--arch/arm/mach-bcm/bcm_5301x.c2
-rw-r--r--arch/arm/mach-bcm/bcm_kona_smc.c2
-rw-r--r--arch/arm/mach-clps711x/board-autcpu12.c2
-rw-r--r--arch/arm/mach-cns3xxx/core.c59
-rw-r--r--arch/arm/mach-davinci/cp_intc.c2
-rw-r--r--arch/arm/mach-davinci/da850.c4
-rw-r--r--arch/arm/mach-davinci/da8xx-dt.c4
-rw-r--r--arch/arm/mach-davinci/time.c54
-rw-r--r--arch/arm/mach-digicolor/digicolor.c2
-rw-r--r--arch/arm/mach-dove/irq.c5
-rw-r--r--arch/arm/mach-ebsa110/core.c2
-rw-r--r--arch/arm/mach-ep93xx/Kconfig54
-rw-r--r--arch/arm/mach-ep93xx/Makefile2
-rw-r--r--arch/arm/mach-ep93xx/Makefile.boot15
-rw-r--r--arch/arm/mach-ep93xx/core.c116
-rw-r--r--arch/arm/mach-ep93xx/edb93xx.c2
-rw-r--r--arch/arm/mach-ep93xx/simone.c3
-rw-r--r--arch/arm/mach-ep93xx/snappercl15.c2
-rw-r--r--arch/arm/mach-ep93xx/timer-ep93xx.c143
-rw-r--r--arch/arm/mach-ep93xx/vision_ep9307.c63
-rw-r--r--arch/arm/mach-exynos/Kconfig5
-rw-r--r--arch/arm/mach-exynos/Makefile2
-rw-r--r--arch/arm/mach-exynos/common.h6
-rw-r--r--arch/arm/mach-exynos/firmware.c2
-rw-r--r--arch/arm/mach-exynos/pmu.c3
-rw-r--r--arch/arm/mach-exynos/regs-srom.h (renamed from arch/arm/plat-samsung/include/plat/regs-srom.h)3
-rw-r--r--arch/arm/mach-exynos/s5p-dev-mfc.c (renamed from arch/arm/plat-samsung/s5p-dev-mfc.c)0
-rw-r--r--arch/arm/mach-exynos/suspend.c8
-rw-r--r--arch/arm/mach-footbridge/common.c2
-rw-r--r--arch/arm/mach-footbridge/dc21285-timer.c48
-rw-r--r--arch/arm/mach-footbridge/isa-irq.c8
-rw-r--r--arch/arm/mach-gemini/gpio.c2
-rw-r--r--arch/arm/mach-gemini/include/mach/hardware.h3
-rw-r--r--arch/arm/mach-gemini/irq.c2
-rw-r--r--arch/arm/mach-gemini/time.c219
-rw-r--r--arch/arm/mach-imx/3ds_debugboard.c2
-rw-r--r--arch/arm/mach-imx/epit.c67
-rw-r--r--arch/arm/mach-imx/mach-imx7d.c2
-rw-r--r--arch/arm/mach-imx/mach-mx31ads.c2
-rw-r--r--arch/arm/mach-iop13xx/irq.c2
-rw-r--r--arch/arm/mach-iop32x/irq.c2
-rw-r--r--arch/arm/mach-iop33x/irq.c2
-rw-r--r--arch/arm/mach-ixp4xx/common.c70
-rw-r--r--arch/arm/mach-ks8695/irq.c2
-rw-r--r--arch/arm/mach-ks8695/time.c43
-rw-r--r--arch/arm/mach-lpc32xx/irq.c10
-rw-r--r--arch/arm/mach-lpc32xx/phy3250.c4
-rw-r--r--arch/arm/mach-lpc32xx/timer.c40
-rw-r--r--arch/arm/mach-mmp/mmp-dt.c4
-rw-r--r--arch/arm/mach-mmp/mmp2-dt.c2
-rw-r--r--arch/arm/mach-mmp/time.c29
-rw-r--r--arch/arm/mach-mvebu/pmsu.c4
-rw-r--r--arch/arm/mach-mxs/mach-mxs.c4
-rw-r--r--arch/arm/mach-netx/generic.c2
-rw-r--r--arch/arm/mach-netx/time.c61
-rw-r--r--arch/arm/mach-nomadik/cpu-8815.c41
-rw-r--r--arch/arm/mach-omap1/fpga.c2
-rw-r--r--arch/arm/mach-omap1/irq.c2
-rw-r--r--arch/arm/mach-omap1/time.c35
-rw-r--r--arch/arm/mach-omap1/timer32k.c33
-rw-r--r--arch/arm/mach-omap2/Kconfig20
-rw-r--r--arch/arm/mach-omap2/Makefile3
-rw-r--r--arch/arm/mach-omap2/board-omap3logic.c249
-rw-r--r--arch/arm/mach-omap2/board-omap3pandora.c633
-rw-r--r--arch/arm/mach-omap2/prm_common.c2
-rw-r--r--arch/arm/mach-omap2/timer.c48
-rw-r--r--arch/arm/mach-omap2/vc.c2
-rw-r--r--arch/arm/mach-omap2/voltagedomains3xxx_data.c2
-rw-r--r--arch/arm/mach-omap2/voltagedomains44xx_data.c2
-rw-r--r--arch/arm/mach-omap2/voltagedomains54xx_data.c2
-rw-r--r--arch/arm/mach-orion5x/dns323-setup.c4
-rw-r--r--arch/arm/mach-orion5x/tsx09-common.c4
-rw-r--r--arch/arm/mach-pxa/balloon3.c16
-rw-r--r--arch/arm/mach-pxa/cm-x2xx-pci.c3
-rw-r--r--arch/arm/mach-pxa/irq.c1
-rw-r--r--arch/arm/mach-pxa/lpd270.c5
-rw-r--r--arch/arm/mach-pxa/pcm990-baseboard.c5
-rw-r--r--arch/arm/mach-pxa/pxa-dt.c4
-rw-r--r--arch/arm/mach-pxa/pxa3xx.c2
-rw-r--r--arch/arm/mach-pxa/viper.c5
-rw-r--r--arch/arm/mach-pxa/zeus.c5
-rw-r--r--arch/arm/mach-realview/realview-dt.c2
-rw-r--r--arch/arm/mach-rpc/ecard.c2
-rw-r--r--arch/arm/mach-rpc/irq.c16
-rw-r--r--arch/arm/mach-s3c24xx/Kconfig5
-rw-r--r--arch/arm/mach-s3c24xx/Makefile1
-rw-r--r--arch/arm/mach-s3c24xx/bast-irq.c2
-rw-r--r--arch/arm/mach-s3c24xx/fb-core.h (renamed from arch/arm/plat-samsung/include/plat/fb-core.h)2
-rw-r--r--arch/arm/mach-s3c24xx/mach-s3c2416-dt.c2
-rw-r--r--arch/arm/mach-s3c24xx/nand-core.h (renamed from arch/arm/plat-samsung/include/plat/nand-core.h)3
-rw-r--r--arch/arm/mach-s3c24xx/s3c2412.c2
-rw-r--r--arch/arm/mach-s3c24xx/s3c2416.c6
-rw-r--r--arch/arm/mach-s3c24xx/s3c2443.c7
-rw-r--r--arch/arm/mach-s3c24xx/s3c244x.c2
-rw-r--r--arch/arm/mach-s3c24xx/setup-camif.c (renamed from arch/arm/plat-samsung/setup-camif.c)0
-rw-r--r--arch/arm/mach-s3c24xx/spi-core.h (renamed from arch/arm/plat-samsung/include/plat/spi-core.h)0
-rw-r--r--arch/arm/mach-s3c64xx/Kconfig6
-rw-r--r--arch/arm/mach-s3c64xx/Makefile2
-rw-r--r--arch/arm/mach-s3c64xx/ata-core.h (renamed from arch/arm/plat-samsung/include/plat/ata-core.h)3
-rw-r--r--arch/arm/mach-s3c64xx/backlight.h (renamed from arch/arm/plat-samsung/include/plat/backlight.h)3
-rw-r--r--arch/arm/mach-s3c64xx/common.c6
-rw-r--r--arch/arm/mach-s3c64xx/dev-backlight.c (renamed from arch/arm/plat-samsung/dev-backlight.c)6
-rw-r--r--arch/arm/mach-s3c64xx/irq-uart.h (renamed from arch/arm/plat-samsung/include/plat/irq-uart.h)3
-rw-r--r--arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c5
-rw-r--r--arch/arm/mach-s3c64xx/mach-smdk6410.c2
-rw-r--r--arch/arm/mach-s3c64xx/onenand-core.h (renamed from arch/arm/plat-samsung/include/plat/onenand-core.h)2
-rw-r--r--arch/arm/mach-s3c64xx/regs-usb-hsotg-phy.h (renamed from arch/arm/plat-samsung/include/plat/regs-usb-hsotg-phy.h)3
-rw-r--r--arch/arm/mach-s3c64xx/s3c6400.c2
-rw-r--r--arch/arm/mach-s3c64xx/s3c6410.c4
-rw-r--r--arch/arm/mach-s3c64xx/setup-usb-phy.c2
-rw-r--r--arch/arm/mach-s3c64xx/watchdog-reset.h (renamed from arch/arm/plat-samsung/include/plat/watchdog-reset.h)3
-rw-r--r--arch/arm/mach-sa1100/neponset.c4
-rw-r--r--arch/arm/mach-shmobile/Kconfig47
-rw-r--r--arch/arm/mach-shmobile/Makefile14
-rw-r--r--arch/arm/mach-shmobile/Makefile.boot3
-rw-r--r--arch/arm/mach-shmobile/board-armadillo800eva.c1365
-rw-r--r--arch/arm/mach-shmobile/board-bockw-reference.c2
-rw-r--r--arch/arm/mach-shmobile/board-bockw.c2
-rw-r--r--arch/arm/mach-shmobile/board-kzm9g.c916
-rw-r--r--arch/arm/mach-shmobile/board-marzen-reference.c56
-rw-r--r--arch/arm/mach-shmobile/board-marzen.c347
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7740.c675
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7779.c271
-rw-r--r--arch/arm/mach-shmobile/clock-sh73a0.c752
-rw-r--r--arch/arm/mach-shmobile/dma-register.h84
-rw-r--r--arch/arm/mach-shmobile/include/mach/head-kzm9g.txt410
-rw-r--r--arch/arm/mach-shmobile/include/mach/zboot.h19
-rw-r--r--arch/arm/mach-shmobile/include/mach/zboot_macros.h108
-rw-r--r--arch/arm/mach-shmobile/intc-sh73a0.c337
-rw-r--r--arch/arm/mach-shmobile/platsmp-apmu.c4
-rw-r--r--arch/arm/mach-shmobile/pm-r8a7740.c129
-rw-r--r--arch/arm/mach-shmobile/pm-r8a7779.c4
-rw-r--r--arch/arm/mach-shmobile/pm-rcar.c105
-rw-r--r--arch/arm/mach-shmobile/pm-rcar.h12
-rw-r--r--arch/arm/mach-shmobile/pm-rmobile.c49
-rw-r--r--arch/arm/mach-shmobile/pm-rmobile.h30
-rw-r--r--arch/arm/mach-shmobile/pm-sh73a0.c32
-rw-r--r--arch/arm/mach-shmobile/r8a7740.h58
-rw-r--r--arch/arm/mach-shmobile/r8a7779.h19
-rw-r--r--arch/arm/mach-shmobile/setup-r7s72100.c2
-rw-r--r--arch/arm/mach-shmobile/setup-r8a73a4.c2
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7740.c680
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7778.c2
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7779.c683
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7791.c2
-rw-r--r--arch/arm/mach-shmobile/setup-rcar-gen2.c2
-rw-r--r--arch/arm/mach-shmobile/setup-sh73a0.c741
-rw-r--r--arch/arm/mach-shmobile/sh73a0.h83
-rw-r--r--arch/arm/mach-shmobile/smp-r8a7779.c21
-rw-r--r--arch/arm/mach-shmobile/smp-r8a7790.c4
-rw-r--r--arch/arm/mach-shmobile/smp-sh73a0.c8
-rw-r--r--arch/arm/mach-shmobile/timer.c12
-rw-r--r--arch/arm/mach-spear/time.c91
-rw-r--r--arch/arm/mach-sti/board-dt.c2
-rw-r--r--arch/arm/mach-ux500/Makefile2
-rw-r--r--arch/arm/mach-ux500/cpu-db8500.c1
-rw-r--r--arch/arm/mach-ux500/headsmp.S37
-rw-r--r--arch/arm/mach-ux500/platsmp.c132
-rw-r--r--arch/arm/mach-ux500/setup.h1
-rw-r--r--arch/arm/mach-w90x900/irq.c2
-rw-r--r--arch/arm/mach-w90x900/time.c51
-rw-r--r--arch/arm/mach-zx/zx296702.c2
-rw-r--r--arch/arm/plat-iop/time.c70
-rw-r--r--arch/arm/plat-orion/gpio.c9
-rw-r--r--arch/arm/plat-orion/time.c93
-rw-r--r--arch/arm/plat-samsung/Kconfig17
-rw-r--r--arch/arm/plat-samsung/Makefile5
-rw-r--r--arch/arm/plat-samsung/include/plat/keypad-core.h31
-rw-r--r--drivers/irqchip/irq-sa11x0.c1
-rw-r--r--drivers/video/fbdev/ep93xx-fb.c30
-rw-r--r--include/linux/platform_data/video-ep93xx.h8
196 files changed, 1281 insertions, 10483 deletions
diff --git a/Documentation/devicetree/bindings/sound/nvidia,tegra30-hda.txt b/Documentation/devicetree/bindings/sound/nvidia,tegra30-hda.txt
index 13e2ef496724..275c6ea356f6 100644
--- a/Documentation/devicetree/bindings/sound/nvidia,tegra30-hda.txt
+++ b/Documentation/devicetree/bindings/sound/nvidia,tegra30-hda.txt
@@ -8,10 +8,10 @@ Required properties:
8- interrupts : The interrupt from the HDA controller. 8- interrupts : The interrupt from the HDA controller.
9- clocks : Must contain an entry for each required entry in clock-names. 9- clocks : Must contain an entry for each required entry in clock-names.
10 See ../clocks/clock-bindings.txt for details. 10 See ../clocks/clock-bindings.txt for details.
11- clock-names : Must include the following entries: hda, hdacodec_2x, hda2hdmi 11- clock-names : Must include the following entries: hda, hda2hdmi, hda2codec_2x
12- resets : Must contain an entry for each entry in reset-names. 12- resets : Must contain an entry for each entry in reset-names.
13 See ../reset/reset.txt for details. 13 See ../reset/reset.txt for details.
14- reset-names : Must include the following entries: hda, hdacodec_2x, hda2hdmi 14- reset-names : Must include the following entries: hda, hda2hdmi, hda2codec_2x
15 15
16Example: 16Example:
17 17
@@ -24,7 +24,7 @@ hda@0,70030000 {
24 <&tegra_car TEGRA124_CLK_HDA2CODEC_2X>; 24 <&tegra_car TEGRA124_CLK_HDA2CODEC_2X>;
25 clock-names = "hda", "hda2hdmi", "hda2codec_2x"; 25 clock-names = "hda", "hda2hdmi", "hda2codec_2x";
26 resets = <&tegra_car 125>, /* hda */ 26 resets = <&tegra_car 125>, /* hda */
27 <&tegra_car 128>; /* hda2hdmi */ 27 <&tegra_car 128>, /* hda2hdmi */
28 <&tegra_car 111>, /* hda2codec_2x */ 28 <&tegra_car 111>; /* hda2codec_2x */
29 reset-names = "hda", "hda2hdmi", "hda2codec_2x"; 29 reset-names = "hda", "hda2hdmi", "hda2codec_2x";
30}; 30};
diff --git a/MAINTAINERS b/MAINTAINERS
index 2a3ab9718b4b..671a8f8084ce 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1471,9 +1471,7 @@ F: arch/arm/boot/dts/emev2*
1471F: arch/arm/boot/dts/r7s* 1471F: arch/arm/boot/dts/r7s*
1472F: arch/arm/boot/dts/r8a* 1472F: arch/arm/boot/dts/r8a*
1473F: arch/arm/boot/dts/sh* 1473F: arch/arm/boot/dts/sh*
1474F: arch/arm/configs/armadillo800eva_defconfig
1475F: arch/arm/configs/bockw_defconfig 1474F: arch/arm/configs/bockw_defconfig
1476F: arch/arm/configs/kzm9g_defconfig
1477F: arch/arm/configs/marzen_defconfig 1475F: arch/arm/configs/marzen_defconfig
1478F: arch/arm/configs/shmobile_defconfig 1476F: arch/arm/configs/shmobile_defconfig
1479F: arch/arm/include/debug/renesas-scif.S 1477F: arch/arm/include/debug/renesas-scif.S
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index ede2526ecf1f..41cbb4a53066 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -268,7 +268,6 @@ config PHYS_OFFSET
268 depends on !ARM_PATCH_PHYS_VIRT 268 depends on !ARM_PATCH_PHYS_VIRT
269 default DRAM_BASE if !MMU 269 default DRAM_BASE if !MMU
270 default 0x00000000 if ARCH_EBSA110 || \ 270 default 0x00000000 if ARCH_EBSA110 || \
271 EP93XX_SDCE3_SYNC_PHYS_OFFSET || \
272 ARCH_FOOTBRIDGE || \ 271 ARCH_FOOTBRIDGE || \
273 ARCH_INTEGRATOR || \ 272 ARCH_INTEGRATOR || \
274 ARCH_IOP13XX || \ 273 ARCH_IOP13XX || \
@@ -277,10 +276,7 @@ config PHYS_OFFSET
277 default 0x10000000 if ARCH_OMAP1 || ARCH_RPC 276 default 0x10000000 if ARCH_OMAP1 || ARCH_RPC
278 default 0x20000000 if ARCH_S5PV210 277 default 0x20000000 if ARCH_S5PV210
279 default 0x70000000 if REALVIEW_HIGH_PHYS_OFFSET 278 default 0x70000000 if REALVIEW_HIGH_PHYS_OFFSET
280 default 0xc0000000 if EP93XX_SDCE0_PHYS_OFFSET || ARCH_SA1100 279 default 0xc0000000 if ARCH_SA1100
281 default 0xd0000000 if EP93XX_SDCE1_PHYS_OFFSET
282 default 0xe0000000 if EP93XX_SDCE2_PHYS_OFFSET
283 default 0xf0000000 if EP93XX_SDCE3_ASYNC_PHYS_OFFSET
284 help 280 help
285 Please provide the physical address corresponding to the 281 Please provide the physical address corresponding to the
286 location of main memory in your system. 282 location of main memory in your system.
@@ -418,11 +414,14 @@ config ARCH_EP93XX
418 bool "EP93xx-based" 414 bool "EP93xx-based"
419 select ARCH_HAS_HOLES_MEMORYMODEL 415 select ARCH_HAS_HOLES_MEMORYMODEL
420 select ARCH_REQUIRE_GPIOLIB 416 select ARCH_REQUIRE_GPIOLIB
421 select ARCH_USES_GETTIMEOFFSET
422 select ARM_AMBA 417 select ARM_AMBA
418 select ARM_PATCH_PHYS_VIRT
423 select ARM_VIC 419 select ARM_VIC
420 select AUTO_ZRELADDR
424 select CLKDEV_LOOKUP 421 select CLKDEV_LOOKUP
422 select CLKSRC_MMIO
425 select CPU_ARM920T 423 select CPU_ARM920T
424 select GENERIC_CLOCKEVENTS
426 help 425 help
427 This enables support for the Cirrus EP93xx series of CPUs. 426 This enables support for the Cirrus EP93xx series of CPUs.
428 427
diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile
index 7a13aebacf81..3f9a9ebc77c3 100644
--- a/arch/arm/boot/compressed/Makefile
+++ b/arch/arm/boot/compressed/Makefile
@@ -51,10 +51,6 @@ else
51endif 51endif
52endif 52endif
53 53
54ifeq ($(CONFIG_ARCH_SHMOBILE_LEGACY),y)
55OBJS += head-shmobile.o
56endif
57
58# 54#
59# We now have a PIC decompressor implementation. Decompressors running 55# We now have a PIC decompressor implementation. Decompressors running
60# from RAM should not define ZTEXTADDR. Decompressors running directly 56# from RAM should not define ZTEXTADDR. Decompressors running directly
diff --git a/arch/arm/boot/compressed/head-shmobile.S b/arch/arm/boot/compressed/head-shmobile.S
deleted file mode 100644
index 22a75259faa3..000000000000
--- a/arch/arm/boot/compressed/head-shmobile.S
+++ /dev/null
@@ -1,71 +0,0 @@
1/*
2 * The head-file for SH-Mobile ARM platforms
3 *
4 * Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
5 * Simon Horman <horms@verge.net.au>
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; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#ifdef CONFIG_ZBOOT_ROM
22
23 .section ".start", "ax"
24
25 /* load board-specific initialization code */
26#include <mach/zboot.h>
27
28 adr r0, dtb_info
29 ldmia r0, {r1, r3, r4, r5, r7}
30
31 sub r0, r0, r1 @ calculate the delta offset
32 add r5, r5, r0 @ _edata
33
34 ldr lr, [r5, #0] @ check if valid DTB is present
35 cmp lr, r3
36 bne 0f
37
38 add r9, r7, #31 @ rounded up to a multiple
39 bic r9, r9, #31 @ ... of 32 bytes
40
41 add r6, r9, r5 @ copy from _edata
42 add r9, r9, r4 @ to MEMORY_START
43
441: ldmdb r6!, {r0 - r3, r10 - r12, lr}
45 cmp r6, r5
46 stmdb r9!, {r0 - r3, r10 - r12, lr}
47 bhi 1b
48
49 /* Success: Zero board ID, pointer to start of memory for atag/dtb */
50 mov r7, #0
51 mov r8, r4
52 b 2f
53
54 .align 2
55dtb_info:
56 .word dtb_info
57#ifndef __ARMEB__
58 .word 0xedfe0dd0 @ sig is 0xd00dfeed big endian
59#else
60 .word 0xd00dfeed
61#endif
62 .word MEMORY_START
63 .word _edata
64 .word 0x4000 @ maximum DTB size
650:
66 /* Failure: Zero board ID, NULL atag/dtb */
67 mov r7, #0
68 mov r8, #0 @ pass null pointer as atag
692 :
70
71#endif /* CONFIG_ZBOOT_ROM */
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index 246473a244f6..917aa318929d 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -501,11 +501,8 @@ dtb-$(CONFIG_ARCH_S5PV210) += \
501 s5pv210-smdkv210.dtb \ 501 s5pv210-smdkv210.dtb \
502 s5pv210-torbreck.dtb 502 s5pv210-torbreck.dtb
503dtb-$(CONFIG_ARCH_SHMOBILE_LEGACY) += \ 503dtb-$(CONFIG_ARCH_SHMOBILE_LEGACY) += \
504 r8a7740-armadillo800eva.dtb \
505 r8a7778-bockw.dtb \ 504 r8a7778-bockw.dtb \
506 r8a7778-bockw-reference.dtb \ 505 r8a7778-bockw-reference.dtb
507 r8a7779-marzen.dtb \
508 sh73a0-kzm9g.dtb
509dtb-$(CONFIG_ARCH_SHMOBILE_MULTI) += \ 506dtb-$(CONFIG_ARCH_SHMOBILE_MULTI) += \
510 emev2-kzm9d.dtb \ 507 emev2-kzm9d.dtb \
511 r7s72100-genmai.dtb \ 508 r7s72100-genmai.dtb \
diff --git a/arch/arm/boot/dts/ste-nomadik-nhk15.dts b/arch/arm/boot/dts/ste-nomadik-nhk15.dts
index 3d25dba143a5..4a21c6492dbb 100644
--- a/arch/arm/boot/dts/ste-nomadik-nhk15.dts
+++ b/arch/arm/boot/dts/ste-nomadik-nhk15.dts
@@ -17,12 +17,22 @@
17 }; 17 };
18 18
19 aliases { 19 aliases {
20 serial0 = &uart0;
20 serial1 = &uart1; 21 serial1 = &uart1;
21 stmpe-i2c0 = &stmpe0; 22 stmpe-i2c0 = &stmpe0;
22 stmpe-i2c1 = &stmpe1; 23 stmpe-i2c1 = &stmpe1;
23 }; 24 };
24 25
25 pinctrl { 26 pinctrl {
27 uart0 {
28 uart0_nhk_mode: uart0_mux {
29 u0_default_mux {
30 function = "u0";
31 groups = "u0txrx_a_1", "u0ctsrts_a_1";
32 };
33 };
34 };
35
26 stmpe2401_1 { 36 stmpe2401_1 {
27 stmpe2401_1_nhk_mode: stmpe2401_1_nhk { 37 stmpe2401_1_nhk_mode: stmpe2401_1_nhk {
28 nhk_cfg1 { 38 nhk_cfg1 {
@@ -73,6 +83,11 @@
73 }; 83 };
74 84
75 i2c0 { 85 i2c0 {
86 lis3lv02dl@1d {
87 /* Accelerometer */
88 compatible = "st,lis3lv02dl-accel";
89 reg = <0x1d>;
90 };
76 stmpe0: stmpe2401@43 { 91 stmpe0: stmpe2401@43 {
77 compatible = "st,stmpe2401"; 92 compatible = "st,stmpe2401";
78 reg = <0x43>; 93 reg = <0x43>;
@@ -131,22 +146,30 @@
131 #gpio-cells = <2>; 146 #gpio-cells = <2>;
132 interrupt-controller; 147 interrupt-controller;
133 #interrupt-cells = <2>; 148 #interrupt-cells = <2>;
149 /*
150 * This will turn off SATA so that MMC/SD
151 * can thrive
152 */
153 mmcsd-gpio {
154 gpio-hog;
155 gpios = <2 0x0>;
156 output-low;
157 line-name = "SATA EN";
158 };
134 }; 159 };
135 }; 160 };
136 }; 161 };
137 162
138 amba { 163 amba {
164 /* Activate RX/TX and CTS/RTS on UART 0 */
165 uart0: uart@101fd000 {
166 pinctrl-names = "default";
167 pinctrl-0 = <&uart0_nhk_mode>;
168 status = "okay";
169 };
139 mmcsd: sdi@101f6000 { 170 mmcsd: sdi@101f6000 {
140 cd-gpios = <&stmpe_gpio44 7 GPIO_ACTIVE_LOW>; 171 cd-gpios = <&stmpe_gpio44 7 GPIO_ACTIVE_LOW>;
141 wp-gpios = <&stmpe_gpio44 18 GPIO_ACTIVE_HIGH>; 172 wp-gpios = <&stmpe_gpio44 18 GPIO_ACTIVE_HIGH>;
142 }; 173 };
143 }; 174 };
144
145 /* Custom board node with GPIO pins to active etc */
146 usb-s8815 {
147 /* This will turn off SATA so that MMC/SD can thrive */
148 mmcsd-gpio {
149 gpios = <&stmpe_gpio44 2 0x1>;
150 };
151 };
152}; 175};
diff --git a/arch/arm/boot/dts/ste-nomadik-s8815.dts b/arch/arm/boot/dts/ste-nomadik-s8815.dts
index 3c140d05f796..35282c0105c6 100644
--- a/arch/arm/boot/dts/ste-nomadik-s8815.dts
+++ b/arch/arm/boot/dts/ste-nomadik-s8815.dts
@@ -16,9 +16,20 @@
16 }; 16 };
17 17
18 aliases { 18 aliases {
19 serial0 = &uart0;
19 serial1 = &uart1; 20 serial1 = &uart1;
20 }; 21 };
21 22
23 gpio3: gpio@101e7000 {
24 /* This hog will bias the MMC/SD card detect line */
25 mmcsd-gpio {
26 gpio-hog;
27 gpios = <16 0x0>;
28 output-low;
29 line-name = "card detect bias";
30 };
31 };
32
22 src@101e0000 { 33 src@101e0000 {
23 /* These chrystal drivers are not used on this board */ 34 /* These chrystal drivers are not used on this board */
24 disable-sxtalo; 35 disable-sxtalo;
@@ -30,6 +41,15 @@
30 pinctrl-names = "default"; 41 pinctrl-names = "default";
31 pinctrl-0 = <&cd_default_mode>; 42 pinctrl-0 = <&cd_default_mode>;
32 43
44 uart0 {
45 /* Only use RX/TX pins */
46 uart0_s8815_mode: uart0_mux {
47 u0_default_mux {
48 function = "u0";
49 groups = "u0txrx_a_1";
50 };
51 };
52 };
33 mmcsd-cd { 53 mmcsd-cd {
34 cd_default_mode: cd_default { 54 cd_default_mode: cd_default {
35 cd_default_cfg1 { 55 cd_default_cfg1 {
@@ -85,6 +105,14 @@
85 }; 105 };
86 }; 106 };
87 107
108 i2c1 {
109 lis3lv02dl@1d {
110 /* Accelerometer */
111 compatible = "st,lis3lv02dl-accel";
112 reg = <0x1d>;
113 };
114 };
115
88 /* GPIO I2C connected to the USB portions of the STw4811 only */ 116 /* GPIO I2C connected to the USB portions of the STw4811 only */
89 gpio-i2c { 117 gpio-i2c {
90 compatible = "i2c-gpio"; 118 compatible = "i2c-gpio";
@@ -102,21 +130,19 @@
102 }; 130 };
103 131
104 132
105 /* Configure card detect for the uSD slot */
106 amba { 133 amba {
134 /* Activate RXTX on UART 0 */
135 uart0: uart@101fd000 {
136 pinctrl-names = "default";
137 pinctrl-0 = <&uart0_s8815_mode>;
138 status = "okay";
139 };
140 /* Configure card detect for the uSD slot */
107 mmcsd: sdi@101f6000 { 141 mmcsd: sdi@101f6000 {
108 cd-gpios = <&gpio3 15 GPIO_ACTIVE_LOW>; 142 cd-gpios = <&gpio3 15 GPIO_ACTIVE_LOW>;
109 }; 143 };
110 }; 144 };
111 145
112 /* Custom board node with GPIO pins to active etc */
113 usb-s8815 {
114 /* This will bias the MMC/SD card detect line */
115 mmcsd-gpio {
116 gpios = <&gpio3 16 0x1>;
117 };
118 };
119
120 /* The user LED on the board is set up to be used for heartbeat */ 146 /* The user LED on the board is set up to be used for heartbeat */
121 leds { 147 leds {
122 compatible = "gpio-leds"; 148 compatible = "gpio-leds";
diff --git a/arch/arm/boot/dts/ste-nomadik-stn8815.dtsi b/arch/arm/boot/dts/ste-nomadik-stn8815.dtsi
index ef794a33b4dc..176e332fc0bd 100644
--- a/arch/arm/boot/dts/ste-nomadik-stn8815.dtsi
+++ b/arch/arm/boot/dts/ste-nomadik-stn8815.dtsi
@@ -21,6 +21,13 @@
21 interrupts = <30>; 21 interrupts = <30>;
22 cache-unified; 22 cache-unified;
23 cache-level = <2>; 23 cache-level = <2>;
24 cache-size = <131072>;
25 cache-sets = <512>;
26 cache-line-size = <32>;
27 /* At full speed latency must be >=2 */
28 arm,tag-latency = <2>;
29 arm,data-latency = <2 2>;
30 arm,dirty-latency = <2>;
24 }; 31 };
25 32
26 mtu0: mtu@101e2000 { 33 mtu0: mtu@101e2000 {
@@ -97,14 +104,6 @@
97 pinctrl { 104 pinctrl {
98 compatible = "stericsson,stn8815-pinctrl"; 105 compatible = "stericsson,stn8815-pinctrl";
99 /* Pin configurations */ 106 /* Pin configurations */
100 uart0 {
101 uart0_default_mux: uart0_mux {
102 u0_default_mux {
103 function = "u0";
104 groups = "u0_a_1";
105 };
106 };
107 };
108 uart1 { 107 uart1 {
109 uart1_default_mux: uart1_mux { 108 uart1_default_mux: uart1_mux {
110 u1_default_mux { 109 u1_default_mux {
@@ -721,11 +720,6 @@
721 compatible = "st,stw5095"; 720 compatible = "st,stw5095";
722 reg = <0x1a>; 721 reg = <0x1a>;
723 }; 722 };
724 lis3lv02dl@1d {
725 /* Accelerometer */
726 compatible = "st,lis3lv02dl-accel";
727 reg = <0x1d>;
728 };
729 }; 723 };
730 724
731 amba { 725 amba {
@@ -755,8 +749,6 @@
755 interrupts = <12>; 749 interrupts = <12>;
756 clocks = <&uart0clk>, <&pclkuart0>; 750 clocks = <&uart0clk>, <&pclkuart0>;
757 clock-names = "uartclk", "apb_pclk"; 751 clock-names = "uartclk", "apb_pclk";
758 pinctrl-names = "default";
759 pinctrl-0 = <&uart0_default_mux>;
760 status = "disabled"; 752 status = "disabled";
761 }; 753 };
762 754
diff --git a/arch/arm/common/it8152.c b/arch/arm/common/it8152.c
index 5114b68e99d5..96dabcb6c621 100644
--- a/arch/arm/common/it8152.c
+++ b/arch/arm/common/it8152.c
@@ -91,7 +91,7 @@ void it8152_init_irq(void)
91 for (irq = IT8152_IRQ(0); irq <= IT8152_LAST_IRQ; irq++) { 91 for (irq = IT8152_IRQ(0); irq <= IT8152_LAST_IRQ; irq++) {
92 irq_set_chip_and_handler(irq, &it8152_irq_chip, 92 irq_set_chip_and_handler(irq, &it8152_irq_chip,
93 handle_level_irq); 93 handle_level_irq);
94 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); 94 irq_clear_status_flags(irq, IRQ_NOREQUEST | IRQ_NOPROBE);
95 } 95 }
96} 96}
97 97
diff --git a/arch/arm/common/locomo.c b/arch/arm/common/locomo.c
index b55c3625d7ee..304adea4bc52 100644
--- a/arch/arm/common/locomo.c
+++ b/arch/arm/common/locomo.c
@@ -138,9 +138,9 @@ static struct locomo_dev_info locomo_devices[] = {
138 }, 138 },
139}; 139};
140 140
141static void locomo_handler(unsigned int irq, struct irq_desc *desc) 141static void locomo_handler(unsigned int __irq, struct irq_desc *desc)
142{ 142{
143 struct locomo *lchip = irq_get_chip_data(irq); 143 struct locomo *lchip = irq_desc_get_chip_data(desc);
144 int req, i; 144 int req, i;
145 145
146 /* Acknowledge the parent IRQ */ 146 /* Acknowledge the parent IRQ */
@@ -150,6 +150,8 @@ static void locomo_handler(unsigned int irq, struct irq_desc *desc)
150 req = locomo_readl(lchip->base + LOCOMO_ICR) & 0x0f00; 150 req = locomo_readl(lchip->base + LOCOMO_ICR) & 0x0f00;
151 151
152 if (req) { 152 if (req) {
153 unsigned int irq;
154
153 /* generate the next interrupt(s) */ 155 /* generate the next interrupt(s) */
154 irq = lchip->irq_base; 156 irq = lchip->irq_base;
155 for (i = 0; i <= 3; i++, irq++) { 157 for (i = 0; i <= 3; i++, irq++) {
@@ -205,7 +207,7 @@ static void locomo_setup_irq(struct locomo *lchip)
205 for ( ; irq <= lchip->irq_base + 3; irq++) { 207 for ( ; irq <= lchip->irq_base + 3; irq++) {
206 irq_set_chip_and_handler(irq, &locomo_chip, handle_level_irq); 208 irq_set_chip_and_handler(irq, &locomo_chip, handle_level_irq);
207 irq_set_chip_data(irq, lchip); 209 irq_set_chip_data(irq, lchip);
208 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); 210 irq_clear_status_flags(irq, IRQ_NOREQUEST | IRQ_NOPROBE);
209 } 211 }
210} 212}
211 213
@@ -475,8 +477,7 @@ static void __locomo_remove(struct locomo *lchip)
475 device_for_each_child(lchip->dev, NULL, locomo_remove_child); 477 device_for_each_child(lchip->dev, NULL, locomo_remove_child);
476 478
477 if (lchip->irq != NO_IRQ) { 479 if (lchip->irq != NO_IRQ) {
478 irq_set_chained_handler(lchip->irq, NULL); 480 irq_set_chained_handler_and_data(lchip->irq, NULL, NULL);
479 irq_set_handler_data(lchip->irq, NULL);
480 } 481 }
481 482
482 iounmap(lchip->base); 483 iounmap(lchip->base);
diff --git a/arch/arm/common/sa1111.c b/arch/arm/common/sa1111.c
index 93ee70dbbdd3..4f290250fa93 100644
--- a/arch/arm/common/sa1111.c
+++ b/arch/arm/common/sa1111.c
@@ -197,10 +197,11 @@ static struct sa1111_dev_info sa1111_devices[] = {
197 * will call us again if there are more interrupts to process. 197 * will call us again if there are more interrupts to process.
198 */ 198 */
199static void 199static void
200sa1111_irq_handler(unsigned int irq, struct irq_desc *desc) 200sa1111_irq_handler(unsigned int __irq, struct irq_desc *desc)
201{ 201{
202 unsigned int irq = irq_desc_get_irq(desc);
202 unsigned int stat0, stat1, i; 203 unsigned int stat0, stat1, i;
203 struct sa1111 *sachip = irq_get_handler_data(irq); 204 struct sa1111 *sachip = irq_desc_get_handler_data(desc);
204 void __iomem *mapbase = sachip->base + SA1111_INTC; 205 void __iomem *mapbase = sachip->base + SA1111_INTC;
205 206
206 stat0 = sa1111_readl(mapbase + SA1111_INTSTATCLR0); 207 stat0 = sa1111_readl(mapbase + SA1111_INTSTATCLR0);
@@ -486,7 +487,7 @@ static int sa1111_setup_irq(struct sa1111 *sachip, unsigned irq_base)
486 irq_set_chip_and_handler(irq, &sa1111_low_chip, 487 irq_set_chip_and_handler(irq, &sa1111_low_chip,
487 handle_edge_irq); 488 handle_edge_irq);
488 irq_set_chip_data(irq, sachip); 489 irq_set_chip_data(irq, sachip);
489 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); 490 irq_clear_status_flags(irq, IRQ_NOREQUEST | IRQ_NOPROBE);
490 } 491 }
491 492
492 for (i = AUDXMTDMADONEA; i <= IRQ_S1_BVD1_STSCHG; i++) { 493 for (i = AUDXMTDMADONEA; i <= IRQ_S1_BVD1_STSCHG; i++) {
@@ -494,7 +495,7 @@ static int sa1111_setup_irq(struct sa1111 *sachip, unsigned irq_base)
494 irq_set_chip_and_handler(irq, &sa1111_high_chip, 495 irq_set_chip_and_handler(irq, &sa1111_high_chip,
495 handle_edge_irq); 496 handle_edge_irq);
496 irq_set_chip_data(irq, sachip); 497 irq_set_chip_data(irq, sachip);
497 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); 498 irq_clear_status_flags(irq, IRQ_NOREQUEST | IRQ_NOPROBE);
498 } 499 }
499 500
500 /* 501 /*
diff --git a/arch/arm/configs/armadillo800eva_defconfig b/arch/arm/configs/armadillo800eva_defconfig
deleted file mode 100644
index 5666e3700a82..000000000000
--- a/arch/arm/configs/armadillo800eva_defconfig
+++ /dev/null
@@ -1,162 +0,0 @@
1CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y
3CONFIG_IKCONFIG=y
4CONFIG_IKCONFIG_PROC=y
5CONFIG_LOG_BUF_SHIFT=16
6# CONFIG_UTS_NS is not set
7# CONFIG_IPC_NS is not set
8# CONFIG_PID_NS is not set
9CONFIG_CC_OPTIMIZE_FOR_SIZE=y
10CONFIG_PERF_EVENTS=y
11CONFIG_SLAB=y
12CONFIG_MODULES=y
13CONFIG_MODULE_UNLOAD=y
14CONFIG_MODULE_FORCE_UNLOAD=y
15# CONFIG_BLK_DEV_BSG is not set
16# CONFIG_IOSCHED_DEADLINE is not set
17# CONFIG_IOSCHED_CFQ is not set
18CONFIG_ARCH_SHMOBILE_LEGACY=y
19CONFIG_ARCH_R8A7740=y
20CONFIG_MACH_ARMADILLO800EVA=y
21# CONFIG_SH_TIMER_TMU is not set
22CONFIG_ARM_THUMB=y
23CONFIG_CACHE_L2X0=y
24CONFIG_ARM_ERRATA_430973=y
25CONFIG_ARM_ERRATA_458693=y
26CONFIG_ARM_ERRATA_460075=y
27CONFIG_PL310_ERRATA_588369=y
28CONFIG_ARM_ERRATA_720789=y
29CONFIG_PL310_ERRATA_727915=y
30CONFIG_ARM_ERRATA_743622=y
31CONFIG_ARM_ERRATA_751472=y
32CONFIG_PL310_ERRATA_753970=y
33CONFIG_ARM_ERRATA_754322=y
34CONFIG_PL310_ERRATA_769419=y
35CONFIG_ARM_ERRATA_775420=y
36CONFIG_AEABI=y
37# CONFIG_OABI_COMPAT is not set
38CONFIG_FORCE_MAX_ZONEORDER=13
39CONFIG_ZBOOT_ROM_TEXT=0x0
40CONFIG_ZBOOT_ROM_BSS=0x0
41CONFIG_ARM_APPENDED_DTB=y
42CONFIG_KEXEC=y
43CONFIG_VFP=y
44CONFIG_NEON=y
45# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
46CONFIG_PM=y
47CONFIG_NET=y
48CONFIG_PACKET=y
49CONFIG_UNIX=y
50CONFIG_INET=y
51CONFIG_IP_PNP=y
52CONFIG_IP_PNP_DHCP=y
53# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
54# CONFIG_INET_XFRM_MODE_TUNNEL is not set
55# CONFIG_INET_XFRM_MODE_BEET is not set
56# CONFIG_INET_LRO is not set
57# CONFIG_INET_DIAG is not set
58# CONFIG_IPV6 is not set
59# CONFIG_WIRELESS is not set
60CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
61CONFIG_DEVTMPFS=y
62CONFIG_DEVTMPFS_MOUNT=y
63CONFIG_SCSI=y
64CONFIG_BLK_DEV_SD=y
65CONFIG_MD=y
66CONFIG_BLK_DEV_DM=y
67CONFIG_NETDEVICES=y
68# CONFIG_NET_VENDOR_BROADCOM is not set
69# CONFIG_NET_VENDOR_CHELSIO is not set
70# CONFIG_NET_VENDOR_CIRRUS is not set
71# CONFIG_NET_VENDOR_FARADAY is not set
72# CONFIG_NET_VENDOR_INTEL is not set
73# CONFIG_NET_VENDOR_MARVELL is not set
74# CONFIG_NET_VENDOR_MICREL is not set
75# CONFIG_NET_VENDOR_NATSEMI is not set
76CONFIG_SH_ETH=y
77# CONFIG_NET_VENDOR_SEEQ is not set
78# CONFIG_NET_VENDOR_SMSC is not set
79# CONFIG_NET_VENDOR_STMICRO is not set
80# CONFIG_WLAN is not set
81# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
82CONFIG_INPUT_EVDEV=y
83# CONFIG_KEYBOARD_ATKBD is not set
84CONFIG_KEYBOARD_GPIO=y
85# CONFIG_INPUT_MOUSE is not set
86CONFIG_INPUT_TOUCHSCREEN=y
87CONFIG_TOUCHSCREEN_ST1232=y
88# CONFIG_SERIO is not set
89# CONFIG_LEGACY_PTYS is not set
90CONFIG_SERIAL_SH_SCI=y
91CONFIG_SERIAL_SH_SCI_NR_UARTS=9
92CONFIG_SERIAL_SH_SCI_CONSOLE=y
93# CONFIG_HW_RANDOM is not set
94CONFIG_I2C=y
95CONFIG_I2C_GPIO=y
96CONFIG_I2C_SH_MOBILE=y
97# CONFIG_HWMON is not set
98CONFIG_REGULATOR=y
99CONFIG_REGULATOR_GPIO=y
100CONFIG_MEDIA_SUPPORT=y
101CONFIG_VIDEO_DEV=y
102CONFIG_MEDIA_CAMERA_SUPPORT=y
103CONFIG_V4L_PLATFORM_DRIVERS=y
104CONFIG_SOC_CAMERA=y
105CONFIG_SOC_CAMERA_MT9T112=y
106CONFIG_VIDEO_SH_MOBILE_CEU=y
107CONFIG_FB=y
108CONFIG_FB_SH_MOBILE_LCDC=y
109CONFIG_FB_SH_MOBILE_HDMI=y
110CONFIG_LCD_CLASS_DEVICE=y
111CONFIG_BACKLIGHT_PWM=y
112CONFIG_FRAMEBUFFER_CONSOLE=y
113CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
114CONFIG_LOGO=y
115# CONFIG_LOGO_LINUX_MONO is not set
116# CONFIG_LOGO_LINUX_VGA16 is not set
117# CONFIG_SND_SUPPORT_OLD_API is not set
118# CONFIG_SND_VERBOSE_PROCFS is not set
119# CONFIG_SND_DRIVERS is not set
120# CONFIG_SND_ARM is not set
121CONFIG_SND_SOC_SH4_FSI=y
122# CONFIG_HID_SUPPORT is not set
123CONFIG_USB=y
124CONFIG_USB_RENESAS_USBHS=y
125CONFIG_USB_GADGET=y
126CONFIG_USB_RENESAS_USBHS_UDC=y
127CONFIG_USB_ETH=m
128CONFIG_MMC=y
129CONFIG_MMC_SDHI=y
130CONFIG_MMC_SH_MMCIF=y
131CONFIG_NEW_LEDS=y
132CONFIG_LEDS_CLASS=y
133CONFIG_LEDS_GPIO=y
134CONFIG_RTC_CLASS=y
135CONFIG_RTC_DRV_S35390A=y
136CONFIG_DMADEVICES=y
137CONFIG_SH_DMAE=y
138CONFIG_UIO=y
139CONFIG_UIO_PDRV_GENIRQ=y
140CONFIG_PWM=y
141CONFIG_PWM_RENESAS_TPU=y
142# CONFIG_DNOTIFY is not set
143CONFIG_MSDOS_FS=y
144CONFIG_VFAT_FS=y
145CONFIG_TMPFS=y
146# CONFIG_MISC_FILESYSTEMS is not set
147CONFIG_NFS_FS=y
148CONFIG_NFS_V3_ACL=y
149CONFIG_NFS_V4=y
150CONFIG_NFS_V4_1=y
151CONFIG_ROOT_NFS=y
152CONFIG_NLS_CODEPAGE_437=y
153CONFIG_NLS_ISO8859_1=y
154# CONFIG_ENABLE_WARN_DEPRECATED is not set
155# CONFIG_ENABLE_MUST_CHECK is not set
156# CONFIG_ARM_UNWIND is not set
157CONFIG_CRYPTO=y
158CONFIG_CRYPTO_CBC=y
159CONFIG_CRYPTO_MD5=y
160CONFIG_CRYPTO_DES=y
161CONFIG_CRYPTO_ANSI_CPRNG=y
162CONFIG_XZ_DEC=y
diff --git a/arch/arm/configs/kzm9g_defconfig b/arch/arm/configs/kzm9g_defconfig
deleted file mode 100644
index 23e8d146dc16..000000000000
--- a/arch/arm/configs/kzm9g_defconfig
+++ /dev/null
@@ -1,154 +0,0 @@
1# CONFIG_ARM_PATCH_PHYS_VIRT is not set
2CONFIG_EXPERIMENTAL=y
3# CONFIG_LOCALVERSION_AUTO is not set
4CONFIG_SYSVIPC=y
5CONFIG_IKCONFIG=y
6CONFIG_IKCONFIG_PROC=y
7CONFIG_LOG_BUF_SHIFT=16
8CONFIG_NAMESPACES=y
9# CONFIG_UTS_NS is not set
10# CONFIG_IPC_NS is not set
11# CONFIG_USER_NS is not set
12# CONFIG_PID_NS is not set
13# CONFIG_NET_NS is not set
14CONFIG_CC_OPTIMIZE_FOR_SIZE=y
15CONFIG_SYSCTL_SYSCALL=y
16CONFIG_EMBEDDED=y
17CONFIG_PERF_EVENTS=y
18CONFIG_SLAB=y
19CONFIG_MODULES=y
20CONFIG_MODULE_FORCE_LOAD=y
21CONFIG_MODULE_UNLOAD=y
22# CONFIG_BLK_DEV_BSG is not set
23# CONFIG_IOSCHED_DEADLINE is not set
24# CONFIG_IOSCHED_CFQ is not set
25CONFIG_ARCH_SHMOBILE_LEGACY=y
26CONFIG_ARCH_SH73A0=y
27CONFIG_MACH_KZM9G=y
28CONFIG_MEMORY_START=0x41000000
29CONFIG_MEMORY_SIZE=0x1f000000
30CONFIG_ARM_ERRATA_743622=y
31CONFIG_ARM_ERRATA_754322=y
32CONFIG_NO_HZ=y
33CONFIG_HIGH_RES_TIMERS=y
34CONFIG_SMP=y
35CONFIG_SCHED_MC=y
36CONFIG_AEABI=y
37# CONFIG_OABI_COMPAT is not set
38CONFIG_HIGHMEM=y
39CONFIG_ZBOOT_ROM_TEXT=0x0
40CONFIG_ZBOOT_ROM_BSS=0x0
41CONFIG_ARM_APPENDED_DTB=y
42CONFIG_KEXEC=y
43CONFIG_VFP=y
44CONFIG_NEON=y
45# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
46CONFIG_PM=y
47CONFIG_NET=y
48CONFIG_PACKET=y
49CONFIG_UNIX=y
50CONFIG_INET=y
51CONFIG_IP_PNP=y
52CONFIG_IP_PNP_DHCP=y
53# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
54# CONFIG_INET_XFRM_MODE_TUNNEL is not set
55# CONFIG_INET_XFRM_MODE_BEET is not set
56# CONFIG_INET_LRO is not set
57# CONFIG_INET_DIAG is not set
58# CONFIG_IPV6 is not set
59CONFIG_IRDA=y
60CONFIG_SH_IRDA=y
61# CONFIG_WIRELESS is not set
62CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
63CONFIG_DEVTMPFS=y
64CONFIG_DEVTMPFS_MOUNT=y
65CONFIG_SCSI=y
66CONFIG_BLK_DEV_SD=y
67CONFIG_NETDEVICES=y
68CONFIG_SMSC911X=y
69# CONFIG_WLAN is not set
70CONFIG_INPUT_SPARSEKMAP=y
71# CONFIG_INPUT_MOUSEDEV is not set
72CONFIG_INPUT_EVDEV=y
73# CONFIG_KEYBOARD_ATKBD is not set
74CONFIG_KEYBOARD_GPIO=y
75# CONFIG_INPUT_MOUSE is not set
76CONFIG_INPUT_TOUCHSCREEN=y
77CONFIG_TOUCHSCREEN_ST1232=y
78CONFIG_INPUT_MISC=y
79CONFIG_INPUT_ADXL34X=y
80# CONFIG_LEGACY_PTYS is not set
81CONFIG_SERIAL_SH_SCI=y
82CONFIG_SERIAL_SH_SCI_NR_UARTS=9
83CONFIG_SERIAL_SH_SCI_CONSOLE=y
84# CONFIG_HW_RANDOM is not set
85CONFIG_I2C_CHARDEV=y
86CONFIG_I2C_SH_MOBILE=y
87CONFIG_GPIO_PCF857X=y
88# CONFIG_HWMON is not set
89CONFIG_MFD_AS3711=y
90CONFIG_REGULATOR=y
91CONFIG_REGULATOR_AS3711=y
92CONFIG_FB=y
93CONFIG_FB_SH_MOBILE_LCDC=y
94CONFIG_BACKLIGHT_AS3711=y
95CONFIG_FRAMEBUFFER_CONSOLE=y
96CONFIG_LOGO=y
97CONFIG_FB_SH_MOBILE_MERAM=y
98CONFIG_SOUND=y
99CONFIG_SND=y
100# CONFIG_SND_SUPPORT_OLD_API is not set
101# CONFIG_SND_VERBOSE_PROCFS is not set
102# CONFIG_SND_DRIVERS is not set
103# CONFIG_SND_ARM is not set
104# CONFIG_SND_USB is not set
105CONFIG_SND_SOC=y
106CONFIG_SND_SOC_SH4_FSI=y
107# CONFIG_HID_SUPPORT is not set
108CONFIG_USB=y
109CONFIG_USB_R8A66597_HCD=y
110CONFIG_USB_RENESAS_USBHS=y
111CONFIG_USB_STORAGE=y
112CONFIG_USB_GADGET=y
113CONFIG_USB_RENESAS_USBHS_UDC=y
114CONFIG_USB_ETH=m
115CONFIG_USB_MASS_STORAGE=m
116CONFIG_MMC=y
117# CONFIG_MMC_BLOCK_BOUNCE is not set
118CONFIG_MMC_SDHI=y
119CONFIG_MMC_SH_MMCIF=y
120CONFIG_NEW_LEDS=y
121CONFIG_LEDS_CLASS=y
122CONFIG_LEDS_GPIO=y
123CONFIG_RTC_CLASS=y
124CONFIG_RTC_DRV_RS5C372=y
125CONFIG_DMADEVICES=y
126CONFIG_SH_DMAE=y
127CONFIG_ASYNC_TX_DMA=y
128CONFIG_STAGING=y
129CONFIG_IIO=y
130CONFIG_AK8975=y
131# CONFIG_DNOTIFY is not set
132CONFIG_VFAT_FS=y
133CONFIG_TMPFS=y
134# CONFIG_MISC_FILESYSTEMS is not set
135CONFIG_NFS_FS=y
136CONFIG_NFS_V3=y
137CONFIG_NFS_V3_ACL=y
138CONFIG_NFS_V4=y
139CONFIG_NFS_V4_1=y
140CONFIG_ROOT_NFS=y
141CONFIG_NLS_CODEPAGE_437=y
142CONFIG_NLS_ISO8859_1=y
143# CONFIG_ENABLE_WARN_DEPRECATED is not set
144# CONFIG_ENABLE_MUST_CHECK is not set
145# CONFIG_SCHED_DEBUG is not set
146# CONFIG_DEBUG_PREEMPT is not set
147# CONFIG_DEBUG_BUGVERBOSE is not set
148# CONFIG_FTRACE is not set
149# CONFIG_ARM_UNWIND is not set
150CONFIG_CRYPTO=y
151CONFIG_CRYPTO_CBC=y
152CONFIG_CRYPTO_MD5=y
153CONFIG_CRYPTO_DES=y
154CONFIG_CRC16=y
diff --git a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c
index 350f188c92d2..baf8edebe26f 100644
--- a/arch/arm/kernel/irq.c
+++ b/arch/arm/kernel/irq.c
@@ -140,7 +140,7 @@ int __init arch_probe_nr_irqs(void)
140static bool migrate_one_irq(struct irq_desc *desc) 140static bool migrate_one_irq(struct irq_desc *desc)
141{ 141{
142 struct irq_data *d = irq_desc_get_irq_data(desc); 142 struct irq_data *d = irq_desc_get_irq_data(desc);
143 const struct cpumask *affinity = d->affinity; 143 const struct cpumask *affinity = irq_data_get_affinity_mask(d);
144 struct irq_chip *c; 144 struct irq_chip *c;
145 bool ret = false; 145 bool ret = false;
146 146
@@ -160,7 +160,7 @@ static bool migrate_one_irq(struct irq_desc *desc)
160 if (!c->irq_set_affinity) 160 if (!c->irq_set_affinity)
161 pr_debug("IRQ%u: unable to set affinity\n", d->irq); 161 pr_debug("IRQ%u: unable to set affinity\n", d->irq);
162 else if (c->irq_set_affinity(d, affinity, false) == IRQ_SET_MASK_OK && ret) 162 else if (c->irq_set_affinity(d, affinity, false) == IRQ_SET_MASK_OK && ret)
163 cpumask_copy(d->affinity, affinity); 163 cpumask_copy(irq_data_get_affinity_mask(d), affinity);
164 164
165 return ret; 165 return ret;
166} 166}
diff --git a/arch/arm/kernel/psci.c b/arch/arm/kernel/psci.c
index f90fdf4ce7c7..2e6024334790 100644
--- a/arch/arm/kernel/psci.c
+++ b/arch/arm/kernel/psci.c
@@ -278,7 +278,7 @@ out_put_node:
278 return err; 278 return err;
279} 279}
280 280
281static const struct of_device_id psci_of_match[] __initconst = { 281static const struct of_device_id const psci_of_match[] __initconst = {
282 { .compatible = "arm,psci", .data = psci_0_1_init}, 282 { .compatible = "arm,psci", .data = psci_0_1_init},
283 { .compatible = "arm,psci-0.2", .data = psci_0_2_init}, 283 { .compatible = "arm,psci-0.2", .data = psci_0_2_init},
284 {}, 284 {},
diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c
index 172c6a05d27f..e9035cda1485 100644
--- a/arch/arm/kernel/smp_twd.c
+++ b/arch/arm/kernel/smp_twd.c
@@ -36,29 +36,30 @@ static DEFINE_PER_CPU(bool, percpu_setup_called);
36static struct clock_event_device __percpu *twd_evt; 36static struct clock_event_device __percpu *twd_evt;
37static int twd_ppi; 37static int twd_ppi;
38 38
39static void twd_set_mode(enum clock_event_mode mode, 39static int twd_shutdown(struct clock_event_device *clk)
40 struct clock_event_device *clk)
41{ 40{
42 unsigned long ctrl; 41 writel_relaxed(0, twd_base + TWD_TIMER_CONTROL);
43 42 return 0;
44 switch (mode) { 43}
45 case CLOCK_EVT_MODE_PERIODIC:
46 ctrl = TWD_TIMER_CONTROL_ENABLE | TWD_TIMER_CONTROL_IT_ENABLE
47 | TWD_TIMER_CONTROL_PERIODIC;
48 writel_relaxed(DIV_ROUND_CLOSEST(twd_timer_rate, HZ),
49 twd_base + TWD_TIMER_LOAD);
50 break;
51 case CLOCK_EVT_MODE_ONESHOT:
52 /* period set, and timer enabled in 'next_event' hook */
53 ctrl = TWD_TIMER_CONTROL_IT_ENABLE | TWD_TIMER_CONTROL_ONESHOT;
54 break;
55 case CLOCK_EVT_MODE_UNUSED:
56 case CLOCK_EVT_MODE_SHUTDOWN:
57 default:
58 ctrl = 0;
59 }
60 44
45static int twd_set_oneshot(struct clock_event_device *clk)
46{
47 /* period set, and timer enabled in 'next_event' hook */
48 writel_relaxed(TWD_TIMER_CONTROL_IT_ENABLE | TWD_TIMER_CONTROL_ONESHOT,
49 twd_base + TWD_TIMER_CONTROL);
50 return 0;
51}
52
53static int twd_set_periodic(struct clock_event_device *clk)
54{
55 unsigned long ctrl = TWD_TIMER_CONTROL_ENABLE |
56 TWD_TIMER_CONTROL_IT_ENABLE |
57 TWD_TIMER_CONTROL_PERIODIC;
58
59 writel_relaxed(DIV_ROUND_CLOSEST(twd_timer_rate, HZ),
60 twd_base + TWD_TIMER_LOAD);
61 writel_relaxed(ctrl, twd_base + TWD_TIMER_CONTROL); 61 writel_relaxed(ctrl, twd_base + TWD_TIMER_CONTROL);
62 return 0;
62} 63}
63 64
64static int twd_set_next_event(unsigned long evt, 65static int twd_set_next_event(unsigned long evt,
@@ -94,7 +95,7 @@ static void twd_timer_stop(void)
94{ 95{
95 struct clock_event_device *clk = raw_cpu_ptr(twd_evt); 96 struct clock_event_device *clk = raw_cpu_ptr(twd_evt);
96 97
97 twd_set_mode(CLOCK_EVT_MODE_UNUSED, clk); 98 twd_shutdown(clk);
98 disable_percpu_irq(clk->irq); 99 disable_percpu_irq(clk->irq);
99} 100}
100 101
@@ -296,7 +297,10 @@ static void twd_timer_setup(void)
296 clk->features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT | 297 clk->features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT |
297 CLOCK_EVT_FEAT_C3STOP; 298 CLOCK_EVT_FEAT_C3STOP;
298 clk->rating = 350; 299 clk->rating = 350;
299 clk->set_mode = twd_set_mode; 300 clk->set_state_shutdown = twd_shutdown;
301 clk->set_state_periodic = twd_set_periodic;
302 clk->set_state_oneshot = twd_set_oneshot;
303 clk->tick_resume = twd_shutdown;
300 clk->set_next_event = twd_set_next_event; 304 clk->set_next_event = twd_set_next_event;
301 clk->irq = twd_ppi; 305 clk->irq = twd_ppi;
302 clk->cpumask = cpumask_of(cpu); 306 clk->cpumask = cpumask_of(cpu);
diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-at91/at91rm9200.c
index 685826c4a710..c1a7c6cc00e1 100644
--- a/arch/arm/mach-at91/at91rm9200.c
+++ b/arch/arm/mach-at91/at91rm9200.c
@@ -37,7 +37,7 @@ static void __init at91rm9200_dt_device_init(void)
37 at91rm9200_pm_init(); 37 at91rm9200_pm_init();
38} 38}
39 39
40static const char *at91rm9200_dt_board_compat[] __initconst = { 40static const char *const at91rm9200_dt_board_compat[] __initconst = {
41 "atmel,at91rm9200", 41 "atmel,at91rm9200",
42 NULL 42 NULL
43}; 43};
diff --git a/arch/arm/mach-at91/at91sam9.c b/arch/arm/mach-at91/at91sam9.c
index e47a2093a0e7..7eb64f763034 100644
--- a/arch/arm/mach-at91/at91sam9.c
+++ b/arch/arm/mach-at91/at91sam9.c
@@ -72,7 +72,7 @@ static void __init at91sam9_dt_device_init(void)
72 at91sam9260_pm_init(); 72 at91sam9260_pm_init();
73} 73}
74 74
75static const char *at91_dt_board_compat[] __initconst = { 75static const char *const at91_dt_board_compat[] __initconst = {
76 "atmel,at91sam9", 76 "atmel,at91sam9",
77 NULL 77 NULL
78}; 78};
@@ -89,7 +89,7 @@ static void __init at91sam9g45_dt_device_init(void)
89 at91sam9g45_pm_init(); 89 at91sam9g45_pm_init();
90} 90}
91 91
92static const char *at91sam9g45_board_compat[] __initconst = { 92static const char *const at91sam9g45_board_compat[] __initconst = {
93 "atmel,at91sam9g45", 93 "atmel,at91sam9g45",
94 NULL 94 NULL
95}; 95};
@@ -106,7 +106,7 @@ static void __init at91sam9x5_dt_device_init(void)
106 at91sam9x5_pm_init(); 106 at91sam9x5_pm_init();
107} 107}
108 108
109static const char *at91sam9x5_board_compat[] __initconst = { 109static const char *const at91sam9x5_board_compat[] __initconst = {
110 "atmel,at91sam9x5", 110 "atmel,at91sam9x5",
111 "atmel,at91sam9n12", 111 "atmel,at91sam9n12",
112 NULL 112 NULL
diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
index e24df77abd79..265ffeb2037e 100644
--- a/arch/arm/mach-at91/pm.c
+++ b/arch/arm/mach-at91/pm.c
@@ -311,7 +311,7 @@ static void at91sam9_sdram_standby(void)
311 at91_ramc_write(1, AT91_SDRAMC_LPR, saved_lpr1); 311 at91_ramc_write(1, AT91_SDRAMC_LPR, saved_lpr1);
312} 312}
313 313
314static const struct of_device_id ramc_ids[] __initconst = { 314static const struct of_device_id const ramc_ids[] __initconst = {
315 { .compatible = "atmel,at91rm9200-sdramc", .data = at91rm9200_standby }, 315 { .compatible = "atmel,at91rm9200-sdramc", .data = at91rm9200_standby },
316 { .compatible = "atmel,at91sam9260-sdramc", .data = at91sam9_sdram_standby }, 316 { .compatible = "atmel,at91sam9260-sdramc", .data = at91sam9_sdram_standby },
317 { .compatible = "atmel,at91sam9g45-ddramc", .data = at91_ddr_standby }, 317 { .compatible = "atmel,at91sam9g45-ddramc", .data = at91_ddr_standby },
diff --git a/arch/arm/mach-at91/sama5.c b/arch/arm/mach-at91/sama5.c
index 41d829d8e7d5..8fc47630bbc8 100644
--- a/arch/arm/mach-at91/sama5.c
+++ b/arch/arm/mach-at91/sama5.c
@@ -52,7 +52,7 @@ static void __init sama5_dt_device_init(void)
52 at91sam9x5_pm_init(); 52 at91sam9x5_pm_init();
53} 53}
54 54
55static const char *sama5_dt_board_compat[] __initconst = { 55static const char *const sama5_dt_board_compat[] __initconst = {
56 "atmel,sama5", 56 "atmel,sama5",
57 NULL 57 NULL
58}; 58};
@@ -63,7 +63,7 @@ DT_MACHINE_START(sama5_dt, "Atmel SAMA5")
63 .dt_compat = sama5_dt_board_compat, 63 .dt_compat = sama5_dt_board_compat,
64MACHINE_END 64MACHINE_END
65 65
66static const char *sama5_alt_dt_board_compat[] __initconst = { 66static const char *const sama5_alt_dt_board_compat[] __initconst = {
67 "atmel,sama5d4", 67 "atmel,sama5d4",
68 NULL 68 NULL
69}; 69};
diff --git a/arch/arm/mach-bcm/Makefile b/arch/arm/mach-bcm/Makefile
index 4fb0da458e91..1780a3ff42f9 100644
--- a/arch/arm/mach-bcm/Makefile
+++ b/arch/arm/mach-bcm/Makefile
@@ -39,10 +39,8 @@ obj-$(CONFIG_ARCH_BCM_5301X) += bcm_5301x.o
39 39
40# BCM63XXx 40# BCM63XXx
41ifeq ($(CONFIG_ARCH_BCM_63XX),y) 41ifeq ($(CONFIG_ARCH_BCM_63XX),y)
42CFLAGS_bcm63xx_headsmp.o += -march=armv7-a
43obj-y += bcm63xx.o 42obj-y += bcm63xx.o
44obj-$(CONFIG_SMP) += bcm63xx_smp.o bcm63xx_headsmp.o \ 43obj-$(CONFIG_SMP) += bcm63xx_smp.o bcm63xx_pmb.o
45 bcm63xx_pmb.o
46endif 44endif
47 45
48ifeq ($(CONFIG_ARCH_BRCMSTB),y) 46ifeq ($(CONFIG_ARCH_BRCMSTB),y)
diff --git a/arch/arm/mach-bcm/bcm63xx_headsmp.S b/arch/arm/mach-bcm/bcm63xx_headsmp.S
deleted file mode 100644
index c7af397c7f14..000000000000
--- a/arch/arm/mach-bcm/bcm63xx_headsmp.S
+++ /dev/null
@@ -1,23 +0,0 @@
1/*
2 * Copyright (C) 2015, Broadcom Corporation
3 * All Rights Reserved
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 */
9#include <linux/linkage.h>
10#include <linux/init.h>
11#include <asm/assembler.h>
12
13ENTRY(bcm63138_secondary_startup)
14 ARM_BE8(setend be)
15 /*
16 * L1 cache does have unpredictable contents at power-up clean its
17 * contents without flushing
18 */
19 bl v7_invalidate_l1
20 nop
21
22 b secondary_startup
23ENDPROC(bcm63138_secondary_startup)
diff --git a/arch/arm/mach-bcm/bcm63xx_smp.c b/arch/arm/mach-bcm/bcm63xx_smp.c
index 3f014f18cea5..19be90421f4d 100644
--- a/arch/arm/mach-bcm/bcm63xx_smp.c
+++ b/arch/arm/mach-bcm/bcm63xx_smp.c
@@ -127,7 +127,7 @@ static int bcm63138_smp_boot_secondary(unsigned int cpu,
127 } 127 }
128 128
129 /* Locate the secondary CPU node */ 129 /* Locate the secondary CPU node */
130 dn = of_get_cpu_node(cpu_logical_map(cpu), NULL); 130 dn = of_get_cpu_node(cpu, NULL);
131 if (!dn) { 131 if (!dn) {
132 pr_err("SMP: failed to locate secondary CPU%d node\n", cpu); 132 pr_err("SMP: failed to locate secondary CPU%d node\n", cpu);
133 ret = -ENODEV; 133 ret = -ENODEV;
@@ -135,7 +135,7 @@ static int bcm63138_smp_boot_secondary(unsigned int cpu,
135 } 135 }
136 136
137 /* Write the secondary init routine to the BootLUT reset vector */ 137 /* Write the secondary init routine to the BootLUT reset vector */
138 val = virt_to_phys(bcm63138_secondary_startup); 138 val = virt_to_phys(secondary_startup);
139 writel_relaxed(val, bootlut_base + BOOTLUT_RESET_VECT); 139 writel_relaxed(val, bootlut_base + BOOTLUT_RESET_VECT);
140 140
141 /* Power up the core, will jump straight to its reset vector when we 141 /* Power up the core, will jump straight to its reset vector when we
diff --git a/arch/arm/mach-bcm/bcm63xx_smp.h b/arch/arm/mach-bcm/bcm63xx_smp.h
index 50b76044536e..9c6d50e2b111 100644
--- a/arch/arm/mach-bcm/bcm63xx_smp.h
+++ b/arch/arm/mach-bcm/bcm63xx_smp.h
@@ -3,7 +3,6 @@
3 3
4struct device_node; 4struct device_node;
5 5
6extern void bcm63138_secondary_startup(void);
7extern int bcm63xx_pmb_power_on_cpu(struct device_node *dn); 6extern int bcm63xx_pmb_power_on_cpu(struct device_node *dn);
8 7
9#endif /* __BCM63XX_SMP_H */ 8#endif /* __BCM63XX_SMP_H */
diff --git a/arch/arm/mach-bcm/bcm_5301x.c b/arch/arm/mach-bcm/bcm_5301x.c
index 7aef92720eb4..5478fe6bcce6 100644
--- a/arch/arm/mach-bcm/bcm_5301x.c
+++ b/arch/arm/mach-bcm/bcm_5301x.c
@@ -44,7 +44,7 @@ static void __init bcm5301x_init_early(void)
44 "imprecise external abort"); 44 "imprecise external abort");
45} 45}
46 46
47static const char __initconst *bcm5301x_dt_compat[] = { 47static const char *const bcm5301x_dt_compat[] __initconst = {
48 "brcm,bcm4708", 48 "brcm,bcm4708",
49 NULL, 49 NULL,
50}; 50};
diff --git a/arch/arm/mach-bcm/bcm_kona_smc.c b/arch/arm/mach-bcm/bcm_kona_smc.c
index a55a7ecf146a..cf3f8658f0e5 100644
--- a/arch/arm/mach-bcm/bcm_kona_smc.c
+++ b/arch/arm/mach-bcm/bcm_kona_smc.c
@@ -33,7 +33,7 @@ struct bcm_kona_smc_data {
33 unsigned result; 33 unsigned result;
34}; 34};
35 35
36static const struct of_device_id bcm_kona_smc_ids[] __initconst = { 36static const struct of_device_id const bcm_kona_smc_ids[] __initconst = {
37 {.compatible = "brcm,kona-smc"}, 37 {.compatible = "brcm,kona-smc"},
38 {.compatible = "bcm,kona-smc"}, /* deprecated name */ 38 {.compatible = "bcm,kona-smc"}, /* deprecated name */
39 {}, 39 {},
diff --git a/arch/arm/mach-clps711x/board-autcpu12.c b/arch/arm/mach-clps711x/board-autcpu12.c
index 45abf6bd5f68..c3d964221767 100644
--- a/arch/arm/mach-clps711x/board-autcpu12.c
+++ b/arch/arm/mach-clps711x/board-autcpu12.c
@@ -160,7 +160,7 @@ static struct platform_device autcpu12_mmgpio_pdev __initdata = {
160 }, 160 },
161}; 161};
162 162
163static const struct gpio autcpu12_gpios[] __initconst = { 163static const struct gpio const autcpu12_gpios[] __initconst = {
164 { AUTCPU12_DPOT_CS, GPIOF_OUT_INIT_HIGH, "DPOT CS" }, 164 { AUTCPU12_DPOT_CS, GPIOF_OUT_INIT_HIGH, "DPOT CS" },
165 { AUTCPU12_DPOT_CLK, GPIOF_OUT_INIT_LOW, "DPOT CLK" }, 165 { AUTCPU12_DPOT_CLK, GPIOF_OUT_INIT_LOW, "DPOT CLK" },
166 { AUTCPU12_DPOT_UD, GPIOF_OUT_INIT_LOW, "DPOT UD" }, 166 { AUTCPU12_DPOT_UD, GPIOF_OUT_INIT_LOW, "DPOT UD" },
diff --git a/arch/arm/mach-cns3xxx/core.c b/arch/arm/mach-cns3xxx/core.c
index 4e9837ded96d..9b1dc223d8d3 100644
--- a/arch/arm/mach-cns3xxx/core.c
+++ b/arch/arm/mach-cns3xxx/core.c
@@ -113,30 +113,33 @@ void cns3xxx_power_off(void)
113 */ 113 */
114static void __iomem *cns3xxx_tmr1; 114static void __iomem *cns3xxx_tmr1;
115 115
116static void cns3xxx_timer_set_mode(enum clock_event_mode mode, 116static int cns3xxx_shutdown(struct clock_event_device *clk)
117 struct clock_event_device *clk) 117{
118 writel(0, cns3xxx_tmr1 + TIMER1_2_CONTROL_OFFSET);
119 return 0;
120}
121
122static int cns3xxx_set_oneshot(struct clock_event_device *clk)
123{
124 unsigned long ctrl = readl(cns3xxx_tmr1 + TIMER1_2_CONTROL_OFFSET);
125
126 /* period set, and timer enabled in 'next_event' hook */
127 ctrl |= (1 << 2) | (1 << 9);
128 writel(ctrl, cns3xxx_tmr1 + TIMER1_2_CONTROL_OFFSET);
129 return 0;
130}
131
132static int cns3xxx_set_periodic(struct clock_event_device *clk)
118{ 133{
119 unsigned long ctrl = readl(cns3xxx_tmr1 + TIMER1_2_CONTROL_OFFSET); 134 unsigned long ctrl = readl(cns3xxx_tmr1 + TIMER1_2_CONTROL_OFFSET);
120 int pclk = cns3xxx_cpu_clock() / 8; 135 int pclk = cns3xxx_cpu_clock() / 8;
121 int reload; 136 int reload;
122 137
123 switch (mode) { 138 reload = pclk * 20 / (3 * HZ) * 0x25000;
124 case CLOCK_EVT_MODE_PERIODIC: 139 writel(reload, cns3xxx_tmr1 + TIMER1_AUTO_RELOAD_OFFSET);
125 reload = pclk * 20 / (3 * HZ) * 0x25000; 140 ctrl |= (1 << 0) | (1 << 2) | (1 << 9);
126 writel(reload, cns3xxx_tmr1 + TIMER1_AUTO_RELOAD_OFFSET);
127 ctrl |= (1 << 0) | (1 << 2) | (1 << 9);
128 break;
129 case CLOCK_EVT_MODE_ONESHOT:
130 /* period set, and timer enabled in 'next_event' hook */
131 ctrl |= (1 << 2) | (1 << 9);
132 break;
133 case CLOCK_EVT_MODE_UNUSED:
134 case CLOCK_EVT_MODE_SHUTDOWN:
135 default:
136 ctrl = 0;
137 }
138
139 writel(ctrl, cns3xxx_tmr1 + TIMER1_2_CONTROL_OFFSET); 141 writel(ctrl, cns3xxx_tmr1 + TIMER1_2_CONTROL_OFFSET);
142 return 0;
140} 143}
141 144
142static int cns3xxx_timer_set_next_event(unsigned long evt, 145static int cns3xxx_timer_set_next_event(unsigned long evt,
@@ -151,12 +154,16 @@ static int cns3xxx_timer_set_next_event(unsigned long evt,
151} 154}
152 155
153static struct clock_event_device cns3xxx_tmr1_clockevent = { 156static struct clock_event_device cns3xxx_tmr1_clockevent = {
154 .name = "cns3xxx timer1", 157 .name = "cns3xxx timer1",
155 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, 158 .features = CLOCK_EVT_FEAT_PERIODIC |
156 .set_mode = cns3xxx_timer_set_mode, 159 CLOCK_EVT_FEAT_ONESHOT,
157 .set_next_event = cns3xxx_timer_set_next_event, 160 .set_state_shutdown = cns3xxx_shutdown,
158 .rating = 350, 161 .set_state_periodic = cns3xxx_set_periodic,
159 .cpumask = cpu_all_mask, 162 .set_state_oneshot = cns3xxx_set_oneshot,
163 .tick_resume = cns3xxx_shutdown,
164 .set_next_event = cns3xxx_timer_set_next_event,
165 .rating = 350,
166 .cpumask = cpu_all_mask,
160}; 167};
161 168
162static void __init cns3xxx_clockevents_init(unsigned int timer_irq) 169static void __init cns3xxx_clockevents_init(unsigned int timer_irq)
@@ -339,7 +346,7 @@ static struct usb_ohci_pdata cns3xxx_usb_ohci_pdata = {
339 .power_off = csn3xxx_usb_power_off, 346 .power_off = csn3xxx_usb_power_off,
340}; 347};
341 348
342static struct of_dev_auxdata cns3xxx_auxdata[] __initconst = { 349static const struct of_dev_auxdata const cns3xxx_auxdata[] __initconst = {
343 { "intel,usb-ehci", CNS3XXX_USB_BASE, "ehci-platform", &cns3xxx_usb_ehci_pdata }, 350 { "intel,usb-ehci", CNS3XXX_USB_BASE, "ehci-platform", &cns3xxx_usb_ehci_pdata },
344 { "intel,usb-ohci", CNS3XXX_USB_OHCI_BASE, "ohci-platform", &cns3xxx_usb_ohci_pdata }, 351 { "intel,usb-ohci", CNS3XXX_USB_OHCI_BASE, "ohci-platform", &cns3xxx_usb_ohci_pdata },
345 { "cavium,cns3420-ahci", CNS3XXX_SATA2_BASE, "ahci", NULL }, 352 { "cavium,cns3420-ahci", CNS3XXX_SATA2_BASE, "ahci", NULL },
@@ -392,7 +399,7 @@ static void __init cns3xxx_init(void)
392 cns3xxx_auxdata, NULL); 399 cns3xxx_auxdata, NULL);
393} 400}
394 401
395static const char *cns3xxx_dt_compat[] __initdata = { 402static const char *const cns3xxx_dt_compat[] __initconst = {
396 "cavium,cns3410", 403 "cavium,cns3410",
397 "cavium,cns3420", 404 "cavium,cns3420",
398 NULL, 405 NULL,
diff --git a/arch/arm/mach-davinci/cp_intc.c b/arch/arm/mach-davinci/cp_intc.c
index 006dae8dfe44..bf12ce64407a 100644
--- a/arch/arm/mach-davinci/cp_intc.c
+++ b/arch/arm/mach-davinci/cp_intc.c
@@ -112,7 +112,7 @@ static int cp_intc_host_map(struct irq_domain *h, unsigned int virq,
112 pr_debug("cp_intc_host_map(%d, 0x%lx)\n", virq, hw); 112 pr_debug("cp_intc_host_map(%d, 0x%lx)\n", virq, hw);
113 113
114 irq_set_chip(virq, &cp_intc_irq_chip); 114 irq_set_chip(virq, &cp_intc_irq_chip);
115 set_irq_flags(virq, IRQF_VALID | IRQF_PROBE); 115 irq_set_probe(virq);
116 irq_set_handler(virq, handle_edge_irq); 116 irq_set_handler(virq, handle_edge_irq);
117 return 0; 117 return 0;
118} 118}
diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
index 3b8740c083c4..676997895e13 100644
--- a/arch/arm/mach-davinci/da850.c
+++ b/arch/arm/mach-davinci/da850.c
@@ -715,7 +715,7 @@ const short da850_lcdcntl_pins[] __initconst = {
715 -1 715 -1
716}; 716};
717 717
718const short da850_vpif_capture_pins[] __initdata = { 718const short da850_vpif_capture_pins[] __initconst = {
719 DA850_VPIF_DIN0, DA850_VPIF_DIN1, DA850_VPIF_DIN2, DA850_VPIF_DIN3, 719 DA850_VPIF_DIN0, DA850_VPIF_DIN1, DA850_VPIF_DIN2, DA850_VPIF_DIN3,
720 DA850_VPIF_DIN4, DA850_VPIF_DIN5, DA850_VPIF_DIN6, DA850_VPIF_DIN7, 720 DA850_VPIF_DIN4, DA850_VPIF_DIN5, DA850_VPIF_DIN6, DA850_VPIF_DIN7,
721 DA850_VPIF_DIN8, DA850_VPIF_DIN9, DA850_VPIF_DIN10, DA850_VPIF_DIN11, 721 DA850_VPIF_DIN8, DA850_VPIF_DIN9, DA850_VPIF_DIN10, DA850_VPIF_DIN11,
@@ -725,7 +725,7 @@ const short da850_vpif_capture_pins[] __initdata = {
725 -1 725 -1
726}; 726};
727 727
728const short da850_vpif_display_pins[] __initdata = { 728const short da850_vpif_display_pins[] __initconst = {
729 DA850_VPIF_DOUT0, DA850_VPIF_DOUT1, DA850_VPIF_DOUT2, DA850_VPIF_DOUT3, 729 DA850_VPIF_DOUT0, DA850_VPIF_DOUT1, DA850_VPIF_DOUT2, DA850_VPIF_DOUT3,
730 DA850_VPIF_DOUT4, DA850_VPIF_DOUT5, DA850_VPIF_DOUT6, DA850_VPIF_DOUT7, 730 DA850_VPIF_DOUT4, DA850_VPIF_DOUT5, DA850_VPIF_DOUT6, DA850_VPIF_DOUT7,
731 DA850_VPIF_DOUT8, DA850_VPIF_DOUT9, DA850_VPIF_DOUT10, 731 DA850_VPIF_DOUT8, DA850_VPIF_DOUT9, DA850_VPIF_DOUT10,
diff --git a/arch/arm/mach-davinci/da8xx-dt.c b/arch/arm/mach-davinci/da8xx-dt.c
index 438f68547f4c..06b6451225c1 100644
--- a/arch/arm/mach-davinci/da8xx-dt.c
+++ b/arch/arm/mach-davinci/da8xx-dt.c
@@ -20,7 +20,7 @@
20 20
21#define DA8XX_NUM_UARTS 3 21#define DA8XX_NUM_UARTS 3
22 22
23static const struct of_device_id da8xx_irq_match[] __initconst = { 23static const struct of_device_id const da8xx_irq_match[] __initconst = {
24 { .compatible = "ti,cp-intc", .data = cp_intc_of_init, }, 24 { .compatible = "ti,cp-intc", .data = cp_intc_of_init, },
25 { } 25 { }
26}; 26};
@@ -59,7 +59,7 @@ static void __init da850_init_machine(void)
59 59
60} 60}
61 61
62static const char *da850_boards_compat[] __initdata = { 62static const char *const da850_boards_compat[] __initconst = {
63 "enbw,cmc", 63 "enbw,cmc",
64 "ti,da850-evm", 64 "ti,da850-evm",
65 "ti,da850", 65 "ti,da850",
diff --git a/arch/arm/mach-davinci/time.c b/arch/arm/mach-davinci/time.c
index 160c9602f490..6c18445a4639 100644
--- a/arch/arm/mach-davinci/time.c
+++ b/arch/arm/mach-davinci/time.c
@@ -303,36 +303,42 @@ static int davinci_set_next_event(unsigned long cycles,
303 return 0; 303 return 0;
304} 304}
305 305
306static void davinci_set_mode(enum clock_event_mode mode, 306static int davinci_shutdown(struct clock_event_device *evt)
307 struct clock_event_device *evt)
308{ 307{
309 struct timer_s *t = &timers[TID_CLOCKEVENT]; 308 struct timer_s *t = &timers[TID_CLOCKEVENT];
310 309
311 switch (mode) { 310 t->opts &= ~TIMER_OPTS_STATE_MASK;
312 case CLOCK_EVT_MODE_PERIODIC: 311 t->opts |= TIMER_OPTS_DISABLED;
313 t->period = davinci_clock_tick_rate / (HZ); 312 return 0;
314 t->opts &= ~TIMER_OPTS_STATE_MASK; 313}
315 t->opts |= TIMER_OPTS_PERIODIC; 314
316 timer32_config(t); 315static int davinci_set_oneshot(struct clock_event_device *evt)
317 break; 316{
318 case CLOCK_EVT_MODE_ONESHOT: 317 struct timer_s *t = &timers[TID_CLOCKEVENT];
319 t->opts &= ~TIMER_OPTS_STATE_MASK; 318
320 t->opts |= TIMER_OPTS_ONESHOT; 319 t->opts &= ~TIMER_OPTS_STATE_MASK;
321 break; 320 t->opts |= TIMER_OPTS_ONESHOT;
322 case CLOCK_EVT_MODE_UNUSED: 321 return 0;
323 case CLOCK_EVT_MODE_SHUTDOWN: 322}
324 t->opts &= ~TIMER_OPTS_STATE_MASK; 323
325 t->opts |= TIMER_OPTS_DISABLED; 324static int davinci_set_periodic(struct clock_event_device *evt)
326 break; 325{
327 case CLOCK_EVT_MODE_RESUME: 326 struct timer_s *t = &timers[TID_CLOCKEVENT];
328 break; 327
329 } 328 t->period = davinci_clock_tick_rate / (HZ);
329 t->opts &= ~TIMER_OPTS_STATE_MASK;
330 t->opts |= TIMER_OPTS_PERIODIC;
331 timer32_config(t);
332 return 0;
330} 333}
331 334
332static struct clock_event_device clockevent_davinci = { 335static struct clock_event_device clockevent_davinci = {
333 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, 336 .features = CLOCK_EVT_FEAT_PERIODIC |
334 .set_next_event = davinci_set_next_event, 337 CLOCK_EVT_FEAT_ONESHOT,
335 .set_mode = davinci_set_mode, 338 .set_next_event = davinci_set_next_event,
339 .set_state_shutdown = davinci_shutdown,
340 .set_state_periodic = davinci_set_periodic,
341 .set_state_oneshot = davinci_set_oneshot,
336}; 342};
337 343
338 344
diff --git a/arch/arm/mach-digicolor/digicolor.c b/arch/arm/mach-digicolor/digicolor.c
index cfc88d1caa47..4d62f1bde4ed 100644
--- a/arch/arm/mach-digicolor/digicolor.c
+++ b/arch/arm/mach-digicolor/digicolor.c
@@ -8,7 +8,7 @@
8 8
9#include <asm/mach/arch.h> 9#include <asm/mach/arch.h>
10 10
11static const char *digicolor_dt_compat[] __initconst = { 11static const char *const digicolor_dt_compat[] __initconst = {
12 "cnxt,cx92755", 12 "cnxt,cx92755",
13 NULL, 13 NULL,
14}; 14};
diff --git a/arch/arm/mach-dove/irq.c b/arch/arm/mach-dove/irq.c
index df0223f76fa9..305d7c6242bb 100644
--- a/arch/arm/mach-dove/irq.c
+++ b/arch/arm/mach-dove/irq.c
@@ -69,8 +69,9 @@ static struct irq_chip pmu_irq_chip = {
69 .irq_ack = pmu_irq_ack, 69 .irq_ack = pmu_irq_ack,
70}; 70};
71 71
72static void pmu_irq_handler(unsigned int irq, struct irq_desc *desc) 72static void pmu_irq_handler(unsigned int __irq, struct irq_desc *desc)
73{ 73{
74 unsigned int irq = irq_desc_get_irq(desc);
74 unsigned long cause = readl(PMU_INTERRUPT_CAUSE); 75 unsigned long cause = readl(PMU_INTERRUPT_CAUSE);
75 76
76 cause &= readl(PMU_INTERRUPT_MASK); 77 cause &= readl(PMU_INTERRUPT_MASK);
@@ -172,7 +173,7 @@ void __init dove_init_irq(void)
172 for (i = IRQ_DOVE_PMU_START; i < NR_IRQS; i++) { 173 for (i = IRQ_DOVE_PMU_START; i < NR_IRQS; i++) {
173 irq_set_chip_and_handler(i, &pmu_irq_chip, handle_level_irq); 174 irq_set_chip_and_handler(i, &pmu_irq_chip, handle_level_irq);
174 irq_set_status_flags(i, IRQ_LEVEL); 175 irq_set_status_flags(i, IRQ_LEVEL);
175 set_irq_flags(i, IRQF_VALID); 176 irq_clear_status_flags(i, IRQ_NOREQUEST);
176 } 177 }
177 irq_set_chained_handler(IRQ_DOVE_PMU, pmu_irq_handler); 178 irq_set_chained_handler(IRQ_DOVE_PMU, pmu_irq_handler);
178} 179}
diff --git a/arch/arm/mach-ebsa110/core.c b/arch/arm/mach-ebsa110/core.c
index 8254e716b095..688e5fed49a7 100644
--- a/arch/arm/mach-ebsa110/core.c
+++ b/arch/arm/mach-ebsa110/core.c
@@ -65,7 +65,7 @@ static void __init ebsa110_init_irq(void)
65 for (irq = 0; irq < NR_IRQS; irq++) { 65 for (irq = 0; irq < NR_IRQS; irq++) {
66 irq_set_chip_and_handler(irq, &ebsa110_irq_chip, 66 irq_set_chip_and_handler(irq, &ebsa110_irq_chip,
67 handle_level_irq); 67 handle_level_irq);
68 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); 68 irq_clear_status_flags(irq, IRQ_NOREQUEST | IRQ_NOPROBE);
69 } 69 }
70} 70}
71 71
diff --git a/arch/arm/mach-ep93xx/Kconfig b/arch/arm/mach-ep93xx/Kconfig
index bec570ae6494..61a75ca3684e 100644
--- a/arch/arm/mach-ep93xx/Kconfig
+++ b/arch/arm/mach-ep93xx/Kconfig
@@ -15,45 +15,8 @@ config CRUNCH
15 15
16comment "EP93xx Platforms" 16comment "EP93xx Platforms"
17 17
18choice
19 prompt "EP93xx first SDRAM bank selection"
20 default EP93XX_SDCE3_SYNC_PHYS_OFFSET
21
22config EP93XX_SDCE3_SYNC_PHYS_OFFSET
23 bool "0x00000000 - SDCE3/SyncBoot"
24 help
25 Select this option if you want support for EP93xx boards with the
26 first SDRAM bank at 0x00000000.
27
28config EP93XX_SDCE0_PHYS_OFFSET
29 bool "0xc0000000 - SDCEO"
30 help
31 Select this option if you want support for EP93xx boards with the
32 first SDRAM bank at 0xc0000000.
33
34config EP93XX_SDCE1_PHYS_OFFSET
35 bool "0xd0000000 - SDCE1"
36 help
37 Select this option if you want support for EP93xx boards with the
38 first SDRAM bank at 0xd0000000.
39
40config EP93XX_SDCE2_PHYS_OFFSET
41 bool "0xe0000000 - SDCE2"
42 help
43 Select this option if you want support for EP93xx boards with the
44 first SDRAM bank at 0xe0000000.
45
46config EP93XX_SDCE3_ASYNC_PHYS_OFFSET
47 bool "0xf0000000 - SDCE3/AsyncBoot"
48 help
49 Select this option if you want support for EP93xx boards with the
50 first SDRAM bank at 0xf0000000.
51
52endchoice
53
54config MACH_ADSSPHERE 18config MACH_ADSSPHERE
55 bool "Support ADS Sphere" 19 bool "Support ADS Sphere"
56 depends on EP93XX_SDCE3_SYNC_PHYS_OFFSET
57 help 20 help
58 Say 'Y' here if you want your kernel to support the ADS 21 Say 'Y' here if you want your kernel to support the ADS
59 Sphere board. 22 Sphere board.
@@ -63,7 +26,6 @@ config MACH_EDB93XX
63 26
64config MACH_EDB9301 27config MACH_EDB9301
65 bool "Support Cirrus Logic EDB9301" 28 bool "Support Cirrus Logic EDB9301"
66 depends on EP93XX_SDCE3_SYNC_PHYS_OFFSET
67 select MACH_EDB93XX 29 select MACH_EDB93XX
68 help 30 help
69 Say 'Y' here if you want your kernel to support the Cirrus 31 Say 'Y' here if you want your kernel to support the Cirrus
@@ -71,7 +33,6 @@ config MACH_EDB9301
71 33
72config MACH_EDB9302 34config MACH_EDB9302
73 bool "Support Cirrus Logic EDB9302" 35 bool "Support Cirrus Logic EDB9302"
74 depends on EP93XX_SDCE3_SYNC_PHYS_OFFSET
75 select MACH_EDB93XX 36 select MACH_EDB93XX
76 help 37 help
77 Say 'Y' here if you want your kernel to support the Cirrus 38 Say 'Y' here if you want your kernel to support the Cirrus
@@ -79,7 +40,6 @@ config MACH_EDB9302
79 40
80config MACH_EDB9302A 41config MACH_EDB9302A
81 bool "Support Cirrus Logic EDB9302A" 42 bool "Support Cirrus Logic EDB9302A"
82 depends on EP93XX_SDCE0_PHYS_OFFSET
83 select MACH_EDB93XX 43 select MACH_EDB93XX
84 help 44 help
85 Say 'Y' here if you want your kernel to support the Cirrus 45 Say 'Y' here if you want your kernel to support the Cirrus
@@ -87,7 +47,6 @@ config MACH_EDB9302A
87 47
88config MACH_EDB9307 48config MACH_EDB9307
89 bool "Support Cirrus Logic EDB9307" 49 bool "Support Cirrus Logic EDB9307"
90 depends on EP93XX_SDCE3_SYNC_PHYS_OFFSET
91 select MACH_EDB93XX 50 select MACH_EDB93XX
92 help 51 help
93 Say 'Y' here if you want your kernel to support the Cirrus 52 Say 'Y' here if you want your kernel to support the Cirrus
@@ -95,7 +54,6 @@ config MACH_EDB9307
95 54
96config MACH_EDB9307A 55config MACH_EDB9307A
97 bool "Support Cirrus Logic EDB9307A" 56 bool "Support Cirrus Logic EDB9307A"
98 depends on EP93XX_SDCE0_PHYS_OFFSET
99 select MACH_EDB93XX 57 select MACH_EDB93XX
100 help 58 help
101 Say 'Y' here if you want your kernel to support the Cirrus 59 Say 'Y' here if you want your kernel to support the Cirrus
@@ -103,7 +61,6 @@ config MACH_EDB9307A
103 61
104config MACH_EDB9312 62config MACH_EDB9312
105 bool "Support Cirrus Logic EDB9312" 63 bool "Support Cirrus Logic EDB9312"
106 depends on EP93XX_SDCE3_SYNC_PHYS_OFFSET
107 select MACH_EDB93XX 64 select MACH_EDB93XX
108 help 65 help
109 Say 'Y' here if you want your kernel to support the Cirrus 66 Say 'Y' here if you want your kernel to support the Cirrus
@@ -111,7 +68,6 @@ config MACH_EDB9312
111 68
112config MACH_EDB9315 69config MACH_EDB9315
113 bool "Support Cirrus Logic EDB9315" 70 bool "Support Cirrus Logic EDB9315"
114 depends on EP93XX_SDCE3_SYNC_PHYS_OFFSET
115 select MACH_EDB93XX 71 select MACH_EDB93XX
116 help 72 help
117 Say 'Y' here if you want your kernel to support the Cirrus 73 Say 'Y' here if you want your kernel to support the Cirrus
@@ -119,14 +75,12 @@ config MACH_EDB9315
119 75
120config MACH_EDB9315A 76config MACH_EDB9315A
121 bool "Support Cirrus Logic EDB9315A" 77 bool "Support Cirrus Logic EDB9315A"
122 depends on EP93XX_SDCE0_PHYS_OFFSET
123 select MACH_EDB93XX 78 select MACH_EDB93XX
124 help 79 help
125 Say 'Y' here if you want your kernel to support the Cirrus 80 Say 'Y' here if you want your kernel to support the Cirrus
126 Logic EDB9315A Evaluation Board. 81 Logic EDB9315A Evaluation Board.
127 82
128config MACH_GESBC9312 83config MACH_GESBC9312
129 depends on EP93XX_SDCE3_SYNC_PHYS_OFFSET
130 bool "Support Glomation GESBC-9312-sx" 84 bool "Support Glomation GESBC-9312-sx"
131 help 85 help
132 Say 'Y' here if you want your kernel to support the Glomation 86 Say 'Y' here if you want your kernel to support the Glomation
@@ -137,7 +91,6 @@ config MACH_MICRO9
137 91
138config MACH_MICRO9H 92config MACH_MICRO9H
139 bool "Support Contec Micro9-High" 93 bool "Support Contec Micro9-High"
140 depends on EP93XX_SDCE3_SYNC_PHYS_OFFSET
141 select MACH_MICRO9 94 select MACH_MICRO9
142 help 95 help
143 Say 'Y' here if you want your kernel to support the 96 Say 'Y' here if you want your kernel to support the
@@ -145,7 +98,6 @@ config MACH_MICRO9H
145 98
146config MACH_MICRO9M 99config MACH_MICRO9M
147 bool "Support Contec Micro9-Mid" 100 bool "Support Contec Micro9-Mid"
148 depends on EP93XX_SDCE3_ASYNC_PHYS_OFFSET
149 select MACH_MICRO9 101 select MACH_MICRO9
150 help 102 help
151 Say 'Y' here if you want your kernel to support the 103 Say 'Y' here if you want your kernel to support the
@@ -153,7 +105,6 @@ config MACH_MICRO9M
153 105
154config MACH_MICRO9L 106config MACH_MICRO9L
155 bool "Support Contec Micro9-Lite" 107 bool "Support Contec Micro9-Lite"
156 depends on EP93XX_SDCE3_SYNC_PHYS_OFFSET
157 select MACH_MICRO9 108 select MACH_MICRO9
158 help 109 help
159 Say 'Y' here if you want your kernel to support the 110 Say 'Y' here if you want your kernel to support the
@@ -161,7 +112,6 @@ config MACH_MICRO9L
161 112
162config MACH_MICRO9S 113config MACH_MICRO9S
163 bool "Support Contec Micro9-Slim" 114 bool "Support Contec Micro9-Slim"
164 depends on EP93XX_SDCE3_ASYNC_PHYS_OFFSET
165 select MACH_MICRO9 115 select MACH_MICRO9
166 help 116 help
167 Say 'Y' here if you want your kernel to support the 117 Say 'Y' here if you want your kernel to support the
@@ -169,28 +119,24 @@ config MACH_MICRO9S
169 119
170config MACH_SIM_ONE 120config MACH_SIM_ONE
171 bool "Support Simplemachines Sim.One board" 121 bool "Support Simplemachines Sim.One board"
172 depends on EP93XX_SDCE0_PHYS_OFFSET
173 help 122 help
174 Say 'Y' here if you want your kernel to support the 123 Say 'Y' here if you want your kernel to support the
175 Simplemachines Sim.One board. 124 Simplemachines Sim.One board.
176 125
177config MACH_SNAPPER_CL15 126config MACH_SNAPPER_CL15
178 bool "Support Bluewater Systems Snapper CL15 Module" 127 bool "Support Bluewater Systems Snapper CL15 Module"
179 depends on EP93XX_SDCE0_PHYS_OFFSET
180 help 128 help
181 Say 'Y' here if you want your kernel to support the Bluewater 129 Say 'Y' here if you want your kernel to support the Bluewater
182 Systems Snapper CL15 Module. 130 Systems Snapper CL15 Module.
183 131
184config MACH_TS72XX 132config MACH_TS72XX
185 bool "Support Technologic Systems TS-72xx SBC" 133 bool "Support Technologic Systems TS-72xx SBC"
186 depends on EP93XX_SDCE3_SYNC_PHYS_OFFSET
187 help 134 help
188 Say 'Y' here if you want your kernel to support the 135 Say 'Y' here if you want your kernel to support the
189 Technologic Systems TS-72xx board. 136 Technologic Systems TS-72xx board.
190 137
191config MACH_VISION_EP9307 138config MACH_VISION_EP9307
192 bool "Support Vision Engraving Systems EP9307 SoM" 139 bool "Support Vision Engraving Systems EP9307 SoM"
193 depends on EP93XX_SDCE0_PHYS_OFFSET
194 help 140 help
195 Say 'Y' here if you want your kernel to support the 141 Say 'Y' here if you want your kernel to support the
196 Vision Engraving Systems EP9307 SoM. 142 Vision Engraving Systems EP9307 SoM.
diff --git a/arch/arm/mach-ep93xx/Makefile b/arch/arm/mach-ep93xx/Makefile
index 78d427b34b1f..b7ae4345ac08 100644
--- a/arch/arm/mach-ep93xx/Makefile
+++ b/arch/arm/mach-ep93xx/Makefile
@@ -1,7 +1,7 @@
1# 1#
2# Makefile for the linux kernel. 2# Makefile for the linux kernel.
3# 3#
4obj-y := core.o clock.o 4obj-y := core.o clock.o timer-ep93xx.o
5 5
6obj-$(CONFIG_EP93XX_DMA) += dma.o 6obj-$(CONFIG_EP93XX_DMA) += dma.o
7 7
diff --git a/arch/arm/mach-ep93xx/Makefile.boot b/arch/arm/mach-ep93xx/Makefile.boot
index d3113a71cb40..ed82ed7c949f 100644
--- a/arch/arm/mach-ep93xx/Makefile.boot
+++ b/arch/arm/mach-ep93xx/Makefile.boot
@@ -1,14 +1 @@
1 zreladdr-$(CONFIG_EP93XX_SDCE3_SYNC_PHYS_OFFSET) += 0x00008000 # Empty file waiting for deletion once Makefile.boot isn't needed any more.
2params_phys-$(CONFIG_EP93XX_SDCE3_SYNC_PHYS_OFFSET) := 0x00000100
3
4 zreladdr-$(CONFIG_EP93XX_SDCE0_PHYS_OFFSET) += 0xc0008000
5params_phys-$(CONFIG_EP93XX_SDCE0_PHYS_OFFSET) := 0xc0000100
6
7 zreladdr-$(CONFIG_EP93XX_SDCE1_PHYS_OFFSET) += 0xd0008000
8params_phys-$(CONFIG_EP93XX_SDCE1_PHYS_OFFSET) := 0xd0000100
9
10 zreladdr-$(CONFIG_EP93XX_SDCE2_PHYS_OFFSET) += 0xe0008000
11params_phys-$(CONFIG_EP93XX_SDCE2_PHYS_OFFSET) := 0xe0000100
12
13 zreladdr-$(CONFIG_EP93XX_SDCE3_ASYNC_PHYS_OFFSET) += 0xf0008000
14params_phys-$(CONFIG_EP93XX_SDCE3_ASYNC_PHYS_OFFSET) := 0xf0000100
diff --git a/arch/arm/mach-ep93xx/core.c b/arch/arm/mach-ep93xx/core.c
index 0e571f1749d6..c393b1b0310d 100644
--- a/arch/arm/mach-ep93xx/core.c
+++ b/arch/arm/mach-ep93xx/core.c
@@ -22,7 +22,6 @@
22#include <linux/interrupt.h> 22#include <linux/interrupt.h>
23#include <linux/dma-mapping.h> 23#include <linux/dma-mapping.h>
24#include <linux/sys_soc.h> 24#include <linux/sys_soc.h>
25#include <linux/timex.h>
26#include <linux/irq.h> 25#include <linux/irq.h>
27#include <linux/io.h> 26#include <linux/io.h>
28#include <linux/gpio.h> 27#include <linux/gpio.h>
@@ -38,6 +37,7 @@
38#include <linux/irqchip/arm-vic.h> 37#include <linux/irqchip/arm-vic.h>
39#include <linux/reboot.h> 38#include <linux/reboot.h>
40#include <linux/usb/ohci_pdriver.h> 39#include <linux/usb/ohci_pdriver.h>
40#include <linux/random.h>
41 41
42#include <mach/hardware.h> 42#include <mach/hardware.h>
43#include <linux/platform_data/video-ep93xx.h> 43#include <linux/platform_data/video-ep93xx.h>
@@ -47,7 +47,6 @@
47 47
48#include <asm/mach/arch.h> 48#include <asm/mach/arch.h>
49#include <asm/mach/map.h> 49#include <asm/mach/map.h>
50#include <asm/mach/time.h>
51 50
52#include "soc.h" 51#include "soc.h"
53 52
@@ -73,113 +72,6 @@ void __init ep93xx_map_io(void)
73 iotable_init(ep93xx_io_desc, ARRAY_SIZE(ep93xx_io_desc)); 72 iotable_init(ep93xx_io_desc, ARRAY_SIZE(ep93xx_io_desc));
74} 73}
75 74
76
77/*************************************************************************
78 * Timer handling for EP93xx
79 *************************************************************************
80 * The ep93xx has four internal timers. Timers 1, 2 (both 16 bit) and
81 * 3 (32 bit) count down at 508 kHz, are self-reloading, and can generate
82 * an interrupt on underflow. Timer 4 (40 bit) counts down at 983.04 kHz,
83 * is free-running, and can't generate interrupts.
84 *
85 * The 508 kHz timers are ideal for use for the timer interrupt, as the
86 * most common values of HZ divide 508 kHz nicely. We pick one of the 16
87 * bit timers (timer 1) since we don't need more than 16 bits of reload
88 * value as long as HZ >= 8.
89 *
90 * The higher clock rate of timer 4 makes it a better choice than the
91 * other timers for use in gettimeoffset(), while the fact that it can't
92 * generate interrupts means we don't have to worry about not being able
93 * to use this timer for something else. We also use timer 4 for keeping
94 * track of lost jiffies.
95 */
96#define EP93XX_TIMER_REG(x) (EP93XX_TIMER_BASE + (x))
97#define EP93XX_TIMER1_LOAD EP93XX_TIMER_REG(0x00)
98#define EP93XX_TIMER1_VALUE EP93XX_TIMER_REG(0x04)
99#define EP93XX_TIMER1_CONTROL EP93XX_TIMER_REG(0x08)
100#define EP93XX_TIMER123_CONTROL_ENABLE (1 << 7)
101#define EP93XX_TIMER123_CONTROL_MODE (1 << 6)
102#define EP93XX_TIMER123_CONTROL_CLKSEL (1 << 3)
103#define EP93XX_TIMER1_CLEAR EP93XX_TIMER_REG(0x0c)
104#define EP93XX_TIMER2_LOAD EP93XX_TIMER_REG(0x20)
105#define EP93XX_TIMER2_VALUE EP93XX_TIMER_REG(0x24)
106#define EP93XX_TIMER2_CONTROL EP93XX_TIMER_REG(0x28)
107#define EP93XX_TIMER2_CLEAR EP93XX_TIMER_REG(0x2c)
108#define EP93XX_TIMER4_VALUE_LOW EP93XX_TIMER_REG(0x60)
109#define EP93XX_TIMER4_VALUE_HIGH EP93XX_TIMER_REG(0x64)
110#define EP93XX_TIMER4_VALUE_HIGH_ENABLE (1 << 8)
111#define EP93XX_TIMER3_LOAD EP93XX_TIMER_REG(0x80)
112#define EP93XX_TIMER3_VALUE EP93XX_TIMER_REG(0x84)
113#define EP93XX_TIMER3_CONTROL EP93XX_TIMER_REG(0x88)
114#define EP93XX_TIMER3_CLEAR EP93XX_TIMER_REG(0x8c)
115
116#define EP93XX_TIMER123_CLOCK 508469
117#define EP93XX_TIMER4_CLOCK 983040
118
119#define TIMER1_RELOAD ((EP93XX_TIMER123_CLOCK / HZ) - 1)
120#define TIMER4_TICKS_PER_JIFFY DIV_ROUND_CLOSEST(EP93XX_TIMER4_CLOCK, HZ)
121
122static unsigned int last_jiffy_time;
123
124static irqreturn_t ep93xx_timer_interrupt(int irq, void *dev_id)
125{
126 /* Writing any value clears the timer interrupt */
127 __raw_writel(1, EP93XX_TIMER1_CLEAR);
128
129 /* Recover lost jiffies */
130 while ((signed long)
131 (__raw_readl(EP93XX_TIMER4_VALUE_LOW) - last_jiffy_time)
132 >= TIMER4_TICKS_PER_JIFFY) {
133 last_jiffy_time += TIMER4_TICKS_PER_JIFFY;
134 timer_tick();
135 }
136
137 return IRQ_HANDLED;
138}
139
140static struct irqaction ep93xx_timer_irq = {
141 .name = "ep93xx timer",
142 .flags = IRQF_TIMER | IRQF_IRQPOLL,
143 .handler = ep93xx_timer_interrupt,
144};
145
146static u32 ep93xx_gettimeoffset(void)
147{
148 int offset;
149
150 offset = __raw_readl(EP93XX_TIMER4_VALUE_LOW) - last_jiffy_time;
151
152 /*
153 * Timer 4 is based on a 983.04 kHz reference clock,
154 * so dividing by 983040 gives the fraction of a second,
155 * so dividing by 0.983040 converts to uS.
156 * Refactor the calculation to avoid overflow.
157 * Finally, multiply by 1000 to give nS.
158 */
159 return (offset + (53 * offset / 3072)) * 1000;
160}
161
162void __init ep93xx_timer_init(void)
163{
164 u32 tmode = EP93XX_TIMER123_CONTROL_MODE |
165 EP93XX_TIMER123_CONTROL_CLKSEL;
166
167 arch_gettimeoffset = ep93xx_gettimeoffset;
168
169 /* Enable periodic HZ timer. */
170 __raw_writel(tmode, EP93XX_TIMER1_CONTROL);
171 __raw_writel(TIMER1_RELOAD, EP93XX_TIMER1_LOAD);
172 __raw_writel(tmode | EP93XX_TIMER123_CONTROL_ENABLE,
173 EP93XX_TIMER1_CONTROL);
174
175 /* Enable lost jiffy timer. */
176 __raw_writel(EP93XX_TIMER4_VALUE_HIGH_ENABLE,
177 EP93XX_TIMER4_VALUE_HIGH);
178
179 setup_irq(IRQ_EP93XX_TIMER1, &ep93xx_timer_irq);
180}
181
182
183/************************************************************************* 75/*************************************************************************
184 * EP93xx IRQ handling 76 * EP93xx IRQ handling
185 *************************************************************************/ 77 *************************************************************************/
@@ -971,6 +863,12 @@ static const char __init *ep93xx_get_soc_id(void)
971 if (id != id2) 863 if (id != id2)
972 return "invalid"; 864 return "invalid";
973 865
866 /* Toss the unique ID into the entropy pool */
867 add_device_randomness(&id2, 4);
868 add_device_randomness(&id3, 4);
869 add_device_randomness(&id4, 4);
870 add_device_randomness(&id5, 4);
871
974 snprintf(ep93xx_soc_id, sizeof(ep93xx_soc_id), 872 snprintf(ep93xx_soc_id, sizeof(ep93xx_soc_id),
975 "%08x%08x%08x%08x", id2, id3, id4, id5); 873 "%08x%08x%08x%08x", id2, id3, id4, id5);
976 874
diff --git a/arch/arm/mach-ep93xx/edb93xx.c b/arch/arm/mach-ep93xx/edb93xx.c
index 27b14ae92c7e..ad92d9f7e4df 100644
--- a/arch/arm/mach-ep93xx/edb93xx.c
+++ b/arch/arm/mach-ep93xx/edb93xx.c
@@ -205,8 +205,6 @@ static void __init edb93xx_register_pwm(void)
205 * EDB93xx framebuffer 205 * EDB93xx framebuffer
206 *************************************************************************/ 206 *************************************************************************/
207static struct ep93xxfb_mach_info __initdata edb93xxfb_info = { 207static struct ep93xxfb_mach_info __initdata edb93xxfb_info = {
208 .num_modes = EP93XXFB_USE_MODEDB,
209 .bpp = 16,
210 .flags = 0, 208 .flags = 0,
211}; 209};
212 210
diff --git a/arch/arm/mach-ep93xx/simone.c b/arch/arm/mach-ep93xx/simone.c
index 3c950f5864f3..7bb540c421ee 100644
--- a/arch/arm/mach-ep93xx/simone.c
+++ b/arch/arm/mach-ep93xx/simone.c
@@ -40,8 +40,6 @@ static struct ep93xx_eth_data __initdata simone_eth_data = {
40}; 40};
41 41
42static struct ep93xxfb_mach_info __initdata simone_fb_info = { 42static struct ep93xxfb_mach_info __initdata simone_fb_info = {
43 .num_modes = EP93XXFB_USE_MODEDB,
44 .bpp = 16,
45 .flags = EP93XXFB_USE_SDCSN0 | EP93XXFB_PCLK_FALLING, 43 .flags = EP93XXFB_USE_SDCSN0 | EP93XXFB_PCLK_FALLING,
46}; 44};
47 45
@@ -169,6 +167,7 @@ static struct spi_board_info simone_spi_devices[] __initdata = {
169 167
170static struct ep93xx_spi_info simone_spi_info __initdata = { 168static struct ep93xx_spi_info simone_spi_info __initdata = {
171 .num_chipselect = ARRAY_SIZE(simone_spi_devices), 169 .num_chipselect = ARRAY_SIZE(simone_spi_devices),
170 .use_dma = 1,
172}; 171};
173 172
174static struct i2c_gpio_platform_data __initdata simone_i2c_gpio_data = { 173static struct i2c_gpio_platform_data __initdata simone_i2c_gpio_data = {
diff --git a/arch/arm/mach-ep93xx/snappercl15.c b/arch/arm/mach-ep93xx/snappercl15.c
index aa86f86638dd..c4904264256a 100644
--- a/arch/arm/mach-ep93xx/snappercl15.c
+++ b/arch/arm/mach-ep93xx/snappercl15.c
@@ -144,8 +144,6 @@ static struct i2c_board_info __initdata snappercl15_i2c_data[] = {
144}; 144};
145 145
146static struct ep93xxfb_mach_info __initdata snappercl15_fb_info = { 146static struct ep93xxfb_mach_info __initdata snappercl15_fb_info = {
147 .num_modes = EP93XXFB_USE_MODEDB,
148 .bpp = 16,
149}; 147};
150 148
151static struct platform_device snappercl15_audio_device = { 149static struct platform_device snappercl15_audio_device = {
diff --git a/arch/arm/mach-ep93xx/timer-ep93xx.c b/arch/arm/mach-ep93xx/timer-ep93xx.c
new file mode 100644
index 000000000000..e5f791145bd0
--- /dev/null
+++ b/arch/arm/mach-ep93xx/timer-ep93xx.c
@@ -0,0 +1,143 @@
1#include <linux/kernel.h>
2#include <linux/init.h>
3#include <linux/clocksource.h>
4#include <linux/clockchips.h>
5#include <linux/sched_clock.h>
6#include <linux/interrupt.h>
7#include <linux/irq.h>
8#include <linux/io.h>
9#include <asm/mach/time.h>
10#include "soc.h"
11
12/*************************************************************************
13 * Timer handling for EP93xx
14 *************************************************************************
15 * The ep93xx has four internal timers. Timers 1, 2 (both 16 bit) and
16 * 3 (32 bit) count down at 508 kHz, are self-reloading, and can generate
17 * an interrupt on underflow. Timer 4 (40 bit) counts down at 983.04 kHz,
18 * is free-running, and can't generate interrupts.
19 *
20 * The 508 kHz timers are ideal for use for the timer interrupt, as the
21 * most common values of HZ divide 508 kHz nicely. We pick the 32 bit
22 * timer (timer 3) to get as long sleep intervals as possible when using
23 * CONFIG_NO_HZ.
24 *
25 * The higher clock rate of timer 4 makes it a better choice than the
26 * other timers for use as clock source and for sched_clock(), providing
27 * a stable 40 bit time base.
28 *************************************************************************
29 */
30#define EP93XX_TIMER_REG(x) (EP93XX_TIMER_BASE + (x))
31#define EP93XX_TIMER1_LOAD EP93XX_TIMER_REG(0x00)
32#define EP93XX_TIMER1_VALUE EP93XX_TIMER_REG(0x04)
33#define EP93XX_TIMER1_CONTROL EP93XX_TIMER_REG(0x08)
34#define EP93XX_TIMER123_CONTROL_ENABLE (1 << 7)
35#define EP93XX_TIMER123_CONTROL_MODE (1 << 6)
36#define EP93XX_TIMER123_CONTROL_CLKSEL (1 << 3)
37#define EP93XX_TIMER1_CLEAR EP93XX_TIMER_REG(0x0c)
38#define EP93XX_TIMER2_LOAD EP93XX_TIMER_REG(0x20)
39#define EP93XX_TIMER2_VALUE EP93XX_TIMER_REG(0x24)
40#define EP93XX_TIMER2_CONTROL EP93XX_TIMER_REG(0x28)
41#define EP93XX_TIMER2_CLEAR EP93XX_TIMER_REG(0x2c)
42#define EP93XX_TIMER4_VALUE_LOW EP93XX_TIMER_REG(0x60)
43#define EP93XX_TIMER4_VALUE_HIGH EP93XX_TIMER_REG(0x64)
44#define EP93XX_TIMER4_VALUE_HIGH_ENABLE (1 << 8)
45#define EP93XX_TIMER3_LOAD EP93XX_TIMER_REG(0x80)
46#define EP93XX_TIMER3_VALUE EP93XX_TIMER_REG(0x84)
47#define EP93XX_TIMER3_CONTROL EP93XX_TIMER_REG(0x88)
48#define EP93XX_TIMER3_CLEAR EP93XX_TIMER_REG(0x8c)
49
50#define EP93XX_TIMER123_RATE 508469
51#define EP93XX_TIMER4_RATE 983040
52
53static u64 notrace ep93xx_read_sched_clock(void)
54{
55 u64 ret;
56
57 ret = readl(EP93XX_TIMER4_VALUE_LOW);
58 ret |= ((u64) (readl(EP93XX_TIMER4_VALUE_HIGH) & 0xff) << 32);
59 return ret;
60}
61
62cycle_t ep93xx_clocksource_read(struct clocksource *c)
63{
64 u64 ret;
65
66 ret = readl(EP93XX_TIMER4_VALUE_LOW);
67 ret |= ((u64) (readl(EP93XX_TIMER4_VALUE_HIGH) & 0xff) << 32);
68 return (cycle_t) ret;
69}
70
71static int ep93xx_clkevt_set_next_event(unsigned long next,
72 struct clock_event_device *evt)
73{
74 /* Default mode: periodic, off, 508 kHz */
75 u32 tmode = EP93XX_TIMER123_CONTROL_MODE |
76 EP93XX_TIMER123_CONTROL_CLKSEL;
77
78 /* Clear timer */
79 writel(tmode, EP93XX_TIMER3_CONTROL);
80
81 /* Set next event */
82 writel(next, EP93XX_TIMER3_LOAD);
83 writel(tmode | EP93XX_TIMER123_CONTROL_ENABLE,
84 EP93XX_TIMER3_CONTROL);
85 return 0;
86}
87
88
89static int ep93xx_clkevt_shutdown(struct clock_event_device *evt)
90{
91 /* Disable timer */
92 writel(0, EP93XX_TIMER3_CONTROL);
93
94 return 0;
95}
96
97static struct clock_event_device ep93xx_clockevent = {
98 .name = "timer1",
99 .features = CLOCK_EVT_FEAT_ONESHOT,
100 .set_state_shutdown = ep93xx_clkevt_shutdown,
101 .set_state_oneshot = ep93xx_clkevt_shutdown,
102 .tick_resume = ep93xx_clkevt_shutdown,
103 .set_next_event = ep93xx_clkevt_set_next_event,
104 .rating = 300,
105};
106
107static irqreturn_t ep93xx_timer_interrupt(int irq, void *dev_id)
108{
109 struct clock_event_device *evt = dev_id;
110
111 /* Writing any value clears the timer interrupt */
112 writel(1, EP93XX_TIMER3_CLEAR);
113
114 evt->event_handler(evt);
115
116 return IRQ_HANDLED;
117}
118
119static struct irqaction ep93xx_timer_irq = {
120 .name = "ep93xx timer",
121 .flags = IRQF_TIMER | IRQF_IRQPOLL,
122 .handler = ep93xx_timer_interrupt,
123 .dev_id = &ep93xx_clockevent,
124};
125
126void __init ep93xx_timer_init(void)
127{
128 /* Enable and register clocksource and sched_clock on timer 4 */
129 writel(EP93XX_TIMER4_VALUE_HIGH_ENABLE,
130 EP93XX_TIMER4_VALUE_HIGH);
131 clocksource_mmio_init(NULL, "timer4",
132 EP93XX_TIMER4_RATE, 200, 40,
133 ep93xx_clocksource_read);
134 sched_clock_register(ep93xx_read_sched_clock, 40,
135 EP93XX_TIMER4_RATE);
136
137 /* Set up clockevent on timer 3 */
138 setup_irq(IRQ_EP93XX_TIMER3, &ep93xx_timer_irq);
139 clockevents_config_and_register(&ep93xx_clockevent,
140 EP93XX_TIMER123_RATE,
141 1,
142 0xffffffffU);
143}
diff --git a/arch/arm/mach-ep93xx/vision_ep9307.c b/arch/arm/mach-ep93xx/vision_ep9307.c
index 6bc1c181581d..5cced5988498 100644
--- a/arch/arm/mach-ep93xx/vision_ep9307.c
+++ b/arch/arm/mach-ep93xx/vision_ep9307.c
@@ -29,6 +29,8 @@
29#include <linux/spi/mmc_spi.h> 29#include <linux/spi/mmc_spi.h>
30#include <linux/mmc/host.h> 30#include <linux/mmc/host.h>
31 31
32#include <sound/cs4271.h>
33
32#include <mach/hardware.h> 34#include <mach/hardware.h>
33#include <linux/platform_data/video-ep93xx.h> 35#include <linux/platform_data/video-ep93xx.h>
34#include <linux/platform_data/spi-ep93xx.h> 36#include <linux/platform_data/spi-ep93xx.h>
@@ -104,8 +106,6 @@ static void vision_lcd_blank(int blank_mode, struct fb_info *info)
104} 106}
105 107
106static struct ep93xxfb_mach_info ep93xxfb_info __initdata = { 108static struct ep93xxfb_mach_info ep93xxfb_info __initdata = {
107 .num_modes = EP93XXFB_USE_MODEDB,
108 .bpp = 16,
109 .flags = EP93XXFB_USE_SDCSN0 | EP93XXFB_PCLK_FALLING, 109 .flags = EP93XXFB_USE_SDCSN0 | EP93XXFB_PCLK_FALLING,
110 .setup = vision_lcd_setup, 110 .setup = vision_lcd_setup,
111 .teardown = vision_lcd_teardown, 111 .teardown = vision_lcd_teardown,
@@ -169,6 +169,35 @@ static struct i2c_board_info vision_i2c_info[] __initdata = {
169}; 169};
170 170
171/************************************************************************* 171/*************************************************************************
172 * SPI CS4271 Audio Codec
173 *************************************************************************/
174static struct cs4271_platform_data vision_cs4271_data = {
175 .gpio_nreset = EP93XX_GPIO_LINE_H(2),
176};
177
178static int vision_cs4271_hw_setup(struct spi_device *spi)
179{
180 return gpio_request_one(EP93XX_GPIO_LINE_EGPIO6,
181 GPIOF_OUT_INIT_HIGH, spi->modalias);
182}
183
184static void vision_cs4271_hw_cleanup(struct spi_device *spi)
185{
186 gpio_free(EP93XX_GPIO_LINE_EGPIO6);
187}
188
189static void vision_cs4271_hw_cs_control(struct spi_device *spi, int value)
190{
191 gpio_set_value(EP93XX_GPIO_LINE_EGPIO6, value);
192}
193
194static struct ep93xx_spi_chip_ops vision_cs4271_hw = {
195 .setup = vision_cs4271_hw_setup,
196 .cleanup = vision_cs4271_hw_cleanup,
197 .cs_control = vision_cs4271_hw_cs_control,
198};
199
200/*************************************************************************
172 * SPI Flash 201 * SPI Flash
173 *************************************************************************/ 202 *************************************************************************/
174#define VISION_SPI_FLASH_CS EP93XX_GPIO_LINE_EGPIO7 203#define VISION_SPI_FLASH_CS EP93XX_GPIO_LINE_EGPIO7
@@ -262,12 +291,20 @@ static struct ep93xx_spi_chip_ops vision_spi_mmc_hw = {
262 *************************************************************************/ 291 *************************************************************************/
263static struct spi_board_info vision_spi_board_info[] __initdata = { 292static struct spi_board_info vision_spi_board_info[] __initdata = {
264 { 293 {
294 .modalias = "cs4271",
295 .platform_data = &vision_cs4271_data,
296 .controller_data = &vision_cs4271_hw,
297 .max_speed_hz = 6000000,
298 .bus_num = 0,
299 .chip_select = 0,
300 .mode = SPI_MODE_3,
301 }, {
265 .modalias = "sst25l", 302 .modalias = "sst25l",
266 .platform_data = &vision_spi_flash_data, 303 .platform_data = &vision_spi_flash_data,
267 .controller_data = &vision_spi_flash_hw, 304 .controller_data = &vision_spi_flash_hw,
268 .max_speed_hz = 20000000, 305 .max_speed_hz = 20000000,
269 .bus_num = 0, 306 .bus_num = 0,
270 .chip_select = 0, 307 .chip_select = 1,
271 .mode = SPI_MODE_3, 308 .mode = SPI_MODE_3,
272 }, { 309 }, {
273 .modalias = "mmc_spi", 310 .modalias = "mmc_spi",
@@ -275,16 +312,31 @@ static struct spi_board_info vision_spi_board_info[] __initdata = {
275 .controller_data = &vision_spi_mmc_hw, 312 .controller_data = &vision_spi_mmc_hw,
276 .max_speed_hz = 20000000, 313 .max_speed_hz = 20000000,
277 .bus_num = 0, 314 .bus_num = 0,
278 .chip_select = 1, 315 .chip_select = 2,
279 .mode = SPI_MODE_3, 316 .mode = SPI_MODE_3,
280 }, 317 },
281}; 318};
282 319
283static struct ep93xx_spi_info vision_spi_master __initdata = { 320static struct ep93xx_spi_info vision_spi_master __initdata = {
284 .num_chipselect = ARRAY_SIZE(vision_spi_board_info), 321 .num_chipselect = ARRAY_SIZE(vision_spi_board_info),
322 .use_dma = 1,
285}; 323};
286 324
287/************************************************************************* 325/*************************************************************************
326 * I2S Audio
327 *************************************************************************/
328static struct platform_device vision_audio_device = {
329 .name = "edb93xx-audio",
330 .id = -1,
331};
332
333static void __init vision_register_i2s(void)
334{
335 ep93xx_register_i2s();
336 platform_device_register(&vision_audio_device);
337}
338
339/*************************************************************************
288 * Machine Initialization 340 * Machine Initialization
289 *************************************************************************/ 341 *************************************************************************/
290static void __init vision_init_machine(void) 342static void __init vision_init_machine(void)
@@ -309,6 +361,7 @@ static void __init vision_init_machine(void)
309 ARRAY_SIZE(vision_i2c_info)); 361 ARRAY_SIZE(vision_i2c_info));
310 ep93xx_register_spi(&vision_spi_master, vision_spi_board_info, 362 ep93xx_register_spi(&vision_spi_master, vision_spi_board_info,
311 ARRAY_SIZE(vision_spi_board_info)); 363 ARRAY_SIZE(vision_spi_board_info));
364 vision_register_i2s();
312} 365}
313 366
314MACHINE_START(VISION_EP9307, "Vision Engraving Systems EP9307") 367MACHINE_START(VISION_EP9307, "Vision Engraving Systems EP9307")
diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
index 81064cd61a0a..4c4858c566d8 100644
--- a/arch/arm/mach-exynos/Kconfig
+++ b/arch/arm/mach-exynos/Kconfig
@@ -30,6 +30,11 @@ menuconfig ARCH_EXYNOS
30 30
31if ARCH_EXYNOS 31if ARCH_EXYNOS
32 32
33config S5P_DEV_MFC
34 bool
35 help
36 Compile in setup memory (init) code for MFC
37
33config ARCH_EXYNOS3 38config ARCH_EXYNOS3
34 bool "SAMSUNG EXYNOS3" 39 bool "SAMSUNG EXYNOS3"
35 select ARM_CPU_SUSPEND if PM 40 select ARM_CPU_SUSPEND if PM
diff --git a/arch/arm/mach-exynos/Makefile b/arch/arm/mach-exynos/Makefile
index bcefb5473ee4..2f306767cdfe 100644
--- a/arch/arm/mach-exynos/Makefile
+++ b/arch/arm/mach-exynos/Makefile
@@ -23,3 +23,5 @@ AFLAGS_sleep.o :=-Wa,-march=armv7-a$(plus_sec)
23 23
24obj-$(CONFIG_EXYNOS5420_MCPM) += mcpm-exynos.o 24obj-$(CONFIG_EXYNOS5420_MCPM) += mcpm-exynos.o
25CFLAGS_mcpm-exynos.o += -march=armv7-a 25CFLAGS_mcpm-exynos.o += -march=armv7-a
26
27obj-$(CONFIG_S5P_DEV_MFC) += s5p-dev-mfc.o
diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h
index e3a9256ed55f..153492513c40 100644
--- a/arch/arm/mach-exynos/common.h
+++ b/arch/arm/mach-exynos/common.h
@@ -128,6 +128,12 @@ void exynos_firmware_init(void);
128 128
129/* CPU BOOT mode flag for Exynos3250 SoC bootloader */ 129/* CPU BOOT mode flag for Exynos3250 SoC bootloader */
130#define C2_STATE (1 << 3) 130#define C2_STATE (1 << 3)
131/*
132 * Magic values for bootloader indicating chosen low power mode.
133 * See also Documentation/arm/Samsung/Bootloader-interface.txt
134 */
135#define EXYNOS_SLEEP_MAGIC 0x00000bad
136#define EXYNOS_AFTR_MAGIC 0xfcba0d10
131 137
132void exynos_set_boot_flag(unsigned int cpu, unsigned int mode); 138void exynos_set_boot_flag(unsigned int cpu, unsigned int mode);
133void exynos_clear_boot_flag(unsigned int cpu, unsigned int mode); 139void exynos_clear_boot_flag(unsigned int cpu, unsigned int mode);
diff --git a/arch/arm/mach-exynos/firmware.c b/arch/arm/mach-exynos/firmware.c
index 245f6dec1ded..111cfbf66fdb 100644
--- a/arch/arm/mach-exynos/firmware.c
+++ b/arch/arm/mach-exynos/firmware.c
@@ -25,8 +25,6 @@
25#include "common.h" 25#include "common.h"
26#include "smc.h" 26#include "smc.h"
27 27
28#define EXYNOS_SLEEP_MAGIC 0x00000bad
29#define EXYNOS_AFTR_MAGIC 0xfcba0d10
30#define EXYNOS_BOOT_ADDR 0x8 28#define EXYNOS_BOOT_ADDR 0x8
31#define EXYNOS_BOOT_FLAG 0xc 29#define EXYNOS_BOOT_FLAG 0xc
32 30
diff --git a/arch/arm/mach-exynos/pmu.c b/arch/arm/mach-exynos/pmu.c
index e812c1c85624..de68938ee6aa 100644
--- a/arch/arm/mach-exynos/pmu.c
+++ b/arch/arm/mach-exynos/pmu.c
@@ -698,7 +698,7 @@ static void exynos_power_off(void)
698 ; 698 ;
699} 699}
700 700
701void exynos5420_powerdown_conf(enum sys_powerdown mode) 701static void exynos5420_powerdown_conf(enum sys_powerdown mode)
702{ 702{
703 u32 this_cluster; 703 u32 this_cluster;
704 704
@@ -991,7 +991,6 @@ static int exynos_pmu_probe(struct platform_device *pdev)
991static struct platform_driver exynos_pmu_driver = { 991static struct platform_driver exynos_pmu_driver = {
992 .driver = { 992 .driver = {
993 .name = "exynos-pmu", 993 .name = "exynos-pmu",
994 .owner = THIS_MODULE,
995 .of_match_table = exynos_pmu_of_device_ids, 994 .of_match_table = exynos_pmu_of_device_ids,
996 }, 995 },
997 .probe = exynos_pmu_probe, 996 .probe = exynos_pmu_probe,
diff --git a/arch/arm/plat-samsung/include/plat/regs-srom.h b/arch/arm/mach-exynos/regs-srom.h
index 9b6729c81cda..5c4d4427db7b 100644
--- a/arch/arm/plat-samsung/include/plat/regs-srom.h
+++ b/arch/arm/mach-exynos/regs-srom.h
@@ -1,5 +1,4 @@
1/* linux/arch/arm/plat-samsung/include/plat/regs-srom.h 1/*
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd. 2 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com 3 * http://www.samsung.com
5 * 4 *
diff --git a/arch/arm/plat-samsung/s5p-dev-mfc.c b/arch/arm/mach-exynos/s5p-dev-mfc.c
index 0b04b6b0fa30..0b04b6b0fa30 100644
--- a/arch/arm/plat-samsung/s5p-dev-mfc.c
+++ b/arch/arm/mach-exynos/s5p-dev-mfc.c
diff --git a/arch/arm/mach-exynos/suspend.c b/arch/arm/mach-exynos/suspend.c
index f572219c7a40..e00eb39453a4 100644
--- a/arch/arm/mach-exynos/suspend.c
+++ b/arch/arm/mach-exynos/suspend.c
@@ -32,13 +32,11 @@
32#include <asm/suspend.h> 32#include <asm/suspend.h>
33 33
34#include <plat/pm-common.h> 34#include <plat/pm-common.h>
35#include <plat/regs-srom.h>
36 35
37#include "common.h" 36#include "common.h"
38#include "regs-pmu.h"
39#include "exynos-pmu.h" 37#include "exynos-pmu.h"
40 38#include "regs-pmu.h"
41#define S5P_CHECK_SLEEP 0x00000BAD 39#include "regs-srom.h"
42 40
43#define REG_TABLE_END (-1U) 41#define REG_TABLE_END (-1U)
44 42
@@ -331,7 +329,7 @@ static void exynos_pm_enter_sleep_mode(void)
331{ 329{
332 /* Set value of power down register for sleep mode */ 330 /* Set value of power down register for sleep mode */
333 exynos_sys_powerdown_conf(SYS_SLEEP); 331 exynos_sys_powerdown_conf(SYS_SLEEP);
334 pmu_raw_writel(S5P_CHECK_SLEEP, S5P_INFORM1); 332 pmu_raw_writel(EXYNOS_SLEEP_MAGIC, S5P_INFORM1);
335} 333}
336 334
337static void exynos_pm_prepare(void) 335static void exynos_pm_prepare(void)
diff --git a/arch/arm/mach-footbridge/common.c b/arch/arm/mach-footbridge/common.c
index 9e8220e38398..0f0c9e040fcc 100644
--- a/arch/arm/mach-footbridge/common.c
+++ b/arch/arm/mach-footbridge/common.c
@@ -106,7 +106,7 @@ static void __init __fb_init_irq(void)
106 106
107 for (irq = _DC21285_IRQ(0); irq < _DC21285_IRQ(20); irq++) { 107 for (irq = _DC21285_IRQ(0); irq < _DC21285_IRQ(20); irq++) {
108 irq_set_chip_and_handler(irq, &fb_chip, handle_level_irq); 108 irq_set_chip_and_handler(irq, &fb_chip, handle_level_irq);
109 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); 109 irq_clear_status_flags(irq, IRQ_NOREQUEST | IRQ_NOPROBE);
110 } 110 }
111} 111}
112 112
diff --git a/arch/arm/mach-footbridge/dc21285-timer.c b/arch/arm/mach-footbridge/dc21285-timer.c
index bf7aa7d298e7..810edc78c817 100644
--- a/arch/arm/mach-footbridge/dc21285-timer.c
+++ b/arch/arm/mach-footbridge/dc21285-timer.c
@@ -57,34 +57,32 @@ static int ckevt_dc21285_set_next_event(unsigned long delta,
57 return 0; 57 return 0;
58} 58}
59 59
60static void ckevt_dc21285_set_mode(enum clock_event_mode mode, 60static int ckevt_dc21285_shutdown(struct clock_event_device *c)
61 struct clock_event_device *c)
62{ 61{
63 switch (mode) { 62 *CSR_TIMER1_CNTL = 0;
64 case CLOCK_EVT_MODE_RESUME: 63 return 0;
65 case CLOCK_EVT_MODE_PERIODIC: 64}
66 *CSR_TIMER1_CLR = 0; 65
67 *CSR_TIMER1_LOAD = (mem_fclk_21285 + 8 * HZ) / (16 * HZ); 66static int ckevt_dc21285_set_periodic(struct clock_event_device *c)
68 *CSR_TIMER1_CNTL = TIMER_CNTL_ENABLE | TIMER_CNTL_AUTORELOAD | 67{
69 TIMER_CNTL_DIV16; 68 *CSR_TIMER1_CLR = 0;
70 break; 69 *CSR_TIMER1_LOAD = (mem_fclk_21285 + 8 * HZ) / (16 * HZ);
71 70 *CSR_TIMER1_CNTL = TIMER_CNTL_ENABLE | TIMER_CNTL_AUTORELOAD |
72 case CLOCK_EVT_MODE_ONESHOT: 71 TIMER_CNTL_DIV16;
73 case CLOCK_EVT_MODE_UNUSED: 72 return 0;
74 case CLOCK_EVT_MODE_SHUTDOWN:
75 *CSR_TIMER1_CNTL = 0;
76 break;
77 }
78} 73}
79 74
80static struct clock_event_device ckevt_dc21285 = { 75static struct clock_event_device ckevt_dc21285 = {
81 .name = "dc21285_timer1", 76 .name = "dc21285_timer1",
82 .features = CLOCK_EVT_FEAT_PERIODIC | 77 .features = CLOCK_EVT_FEAT_PERIODIC |
83 CLOCK_EVT_FEAT_ONESHOT, 78 CLOCK_EVT_FEAT_ONESHOT,
84 .rating = 200, 79 .rating = 200,
85 .irq = IRQ_TIMER1, 80 .irq = IRQ_TIMER1,
86 .set_next_event = ckevt_dc21285_set_next_event, 81 .set_next_event = ckevt_dc21285_set_next_event,
87 .set_mode = ckevt_dc21285_set_mode, 82 .set_state_shutdown = ckevt_dc21285_shutdown,
83 .set_state_periodic = ckevt_dc21285_set_periodic,
84 .set_state_oneshot = ckevt_dc21285_shutdown,
85 .tick_resume = ckevt_dc21285_set_periodic,
88}; 86};
89 87
90static irqreturn_t timer1_interrupt(int irq, void *dev_id) 88static irqreturn_t timer1_interrupt(int irq, void *dev_id)
@@ -94,7 +92,7 @@ static irqreturn_t timer1_interrupt(int irq, void *dev_id)
94 *CSR_TIMER1_CLR = 0; 92 *CSR_TIMER1_CLR = 0;
95 93
96 /* Stop the timer if in one-shot mode */ 94 /* Stop the timer if in one-shot mode */
97 if (ce->mode == CLOCK_EVT_MODE_ONESHOT) 95 if (clockevent_state_oneshot(ce))
98 *CSR_TIMER1_CNTL = 0; 96 *CSR_TIMER1_CNTL = 0;
99 97
100 ce->event_handler(ce); 98 ce->event_handler(ce);
diff --git a/arch/arm/mach-footbridge/isa-irq.c b/arch/arm/mach-footbridge/isa-irq.c
index c3a0abbc9049..fcd79bc3a3e1 100644
--- a/arch/arm/mach-footbridge/isa-irq.c
+++ b/arch/arm/mach-footbridge/isa-irq.c
@@ -153,13 +153,13 @@ void __init isa_init_irq(unsigned int host_irq)
153 for (irq = _ISA_IRQ(0); irq < _ISA_IRQ(8); irq++) { 153 for (irq = _ISA_IRQ(0); irq < _ISA_IRQ(8); irq++) {
154 irq_set_chip_and_handler(irq, &isa_lo_chip, 154 irq_set_chip_and_handler(irq, &isa_lo_chip,
155 handle_level_irq); 155 handle_level_irq);
156 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); 156 irq_clear_status_flags(irq, IRQ_NOREQUEST | IRQ_NOPROBE);
157 } 157 }
158 158
159 for (irq = _ISA_IRQ(8); irq < _ISA_IRQ(16); irq++) { 159 for (irq = _ISA_IRQ(8); irq < _ISA_IRQ(16); irq++) {
160 irq_set_chip_and_handler(irq, &isa_hi_chip, 160 irq_set_chip_and_handler(irq, &isa_hi_chip,
161 handle_level_irq); 161 handle_level_irq);
162 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); 162 irq_clear_status_flags(irq, IRQ_NOREQUEST | IRQ_NOPROBE);
163 } 163 }
164 164
165 request_resource(&ioport_resource, &pic1_resource); 165 request_resource(&ioport_resource, &pic1_resource);
@@ -175,8 +175,8 @@ void __init isa_init_irq(unsigned int host_irq)
175 * resistor on this line. 175 * resistor on this line.
176 */ 176 */
177 if (machine_is_netwinder()) 177 if (machine_is_netwinder())
178 set_irq_flags(_ISA_IRQ(11), IRQF_VALID | 178 irq_modify_status(_ISA_IRQ(11),
179 IRQF_PROBE | IRQF_NOAUTOEN); 179 IRQ_NOREQUEST | IRQ_NOPROBE, IRQ_NOAUTOEN);
180 } 180 }
181} 181}
182 182
diff --git a/arch/arm/mach-gemini/gpio.c b/arch/arm/mach-gemini/gpio.c
index 3292f2e6ed6f..220333ed741d 100644
--- a/arch/arm/mach-gemini/gpio.c
+++ b/arch/arm/mach-gemini/gpio.c
@@ -220,7 +220,7 @@ void __init gemini_gpio_init(void)
220 j < GPIO_IRQ_BASE + (i + 1) * 32; j++) { 220 j < GPIO_IRQ_BASE + (i + 1) * 32; j++) {
221 irq_set_chip_and_handler(j, &gpio_irq_chip, 221 irq_set_chip_and_handler(j, &gpio_irq_chip,
222 handle_edge_irq); 222 handle_edge_irq);
223 set_irq_flags(j, IRQF_VALID); 223 irq_clear_status_flags(j, IRQ_NOREQUEST);
224 } 224 }
225 225
226 irq_set_chained_handler_and_data(IRQ_GPIO(i), gpio_irq_handler, 226 irq_set_chained_handler_and_data(IRQ_GPIO(i), gpio_irq_handler,
diff --git a/arch/arm/mach-gemini/include/mach/hardware.h b/arch/arm/mach-gemini/include/mach/hardware.h
index 98e7b0f286bf..f0390f184742 100644
--- a/arch/arm/mach-gemini/include/mach/hardware.h
+++ b/arch/arm/mach-gemini/include/mach/hardware.h
@@ -57,9 +57,6 @@
57#define GEMINI_USB1_BASE 0x69000000 57#define GEMINI_USB1_BASE 0x69000000
58#define GEMINI_BIG_ENDIAN_BASE 0x80000000 58#define GEMINI_BIG_ENDIAN_BASE 0x80000000
59 59
60#define GEMINI_TIMER1_BASE GEMINI_TIMER_BASE
61#define GEMINI_TIMER2_BASE (GEMINI_TIMER_BASE + 0x10)
62#define GEMINI_TIMER3_BASE (GEMINI_TIMER_BASE + 0x20)
63 60
64/* 61/*
65 * UART Clock when System clk is 150MHz 62 * UART Clock when System clk is 150MHz
diff --git a/arch/arm/mach-gemini/irq.c b/arch/arm/mach-gemini/irq.c
index 44f50dcb616d..d929b3ff18fd 100644
--- a/arch/arm/mach-gemini/irq.c
+++ b/arch/arm/mach-gemini/irq.c
@@ -92,7 +92,7 @@ void __init gemini_init_irq(void)
92 } else { 92 } else {
93 irq_set_handler(i, handle_level_irq); 93 irq_set_handler(i, handle_level_irq);
94 } 94 }
95 set_irq_flags(i, IRQF_VALID | IRQF_PROBE); 95 irq_clear_status_flags(i, IRQ_NOREQUEST | IRQ_NOPROBE);
96 } 96 }
97 97
98 /* Disable all interrupts */ 98 /* Disable all interrupts */
diff --git a/arch/arm/mach-gemini/time.c b/arch/arm/mach-gemini/time.c
index 0a63c4d25b64..f5f18df5aacd 100644
--- a/arch/arm/mach-gemini/time.c
+++ b/arch/arm/mach-gemini/time.c
@@ -15,93 +15,147 @@
15#include <asm/mach/time.h> 15#include <asm/mach/time.h>
16#include <linux/clockchips.h> 16#include <linux/clockchips.h>
17#include <linux/clocksource.h> 17#include <linux/clocksource.h>
18#include <linux/sched_clock.h>
18 19
19/* 20/*
20 * Register definitions for the timers 21 * Register definitions for the timers
21 */ 22 */
22#define TIMER_COUNT(BASE_ADDR) (BASE_ADDR + 0x00) 23
23#define TIMER_LOAD(BASE_ADDR) (BASE_ADDR + 0x04) 24#define TIMER1_BASE GEMINI_TIMER_BASE
24#define TIMER_MATCH1(BASE_ADDR) (BASE_ADDR + 0x08) 25#define TIMER2_BASE (GEMINI_TIMER_BASE + 0x10)
25#define TIMER_MATCH2(BASE_ADDR) (BASE_ADDR + 0x0C) 26#define TIMER3_BASE (GEMINI_TIMER_BASE + 0x20)
26#define TIMER_CR(BASE_ADDR) (BASE_ADDR + 0x30) 27
27 28#define TIMER_COUNT(BASE) (IO_ADDRESS(BASE) + 0x00)
28#define TIMER_1_CR_ENABLE (1 << 0) 29#define TIMER_LOAD(BASE) (IO_ADDRESS(BASE) + 0x04)
29#define TIMER_1_CR_CLOCK (1 << 1) 30#define TIMER_MATCH1(BASE) (IO_ADDRESS(BASE) + 0x08)
30#define TIMER_1_CR_INT (1 << 2) 31#define TIMER_MATCH2(BASE) (IO_ADDRESS(BASE) + 0x0C)
31#define TIMER_2_CR_ENABLE (1 << 3) 32#define TIMER_CR (IO_ADDRESS(GEMINI_TIMER_BASE) + 0x30)
32#define TIMER_2_CR_CLOCK (1 << 4) 33#define TIMER_INTR_STATE (IO_ADDRESS(GEMINI_TIMER_BASE) + 0x34)
33#define TIMER_2_CR_INT (1 << 5) 34#define TIMER_INTR_MASK (IO_ADDRESS(GEMINI_TIMER_BASE) + 0x38)
34#define TIMER_3_CR_ENABLE (1 << 6) 35
35#define TIMER_3_CR_CLOCK (1 << 7) 36#define TIMER_1_CR_ENABLE (1 << 0)
36#define TIMER_3_CR_INT (1 << 8) 37#define TIMER_1_CR_CLOCK (1 << 1)
38#define TIMER_1_CR_INT (1 << 2)
39#define TIMER_2_CR_ENABLE (1 << 3)
40#define TIMER_2_CR_CLOCK (1 << 4)
41#define TIMER_2_CR_INT (1 << 5)
42#define TIMER_3_CR_ENABLE (1 << 6)
43#define TIMER_3_CR_CLOCK (1 << 7)
44#define TIMER_3_CR_INT (1 << 8)
45#define TIMER_1_CR_UPDOWN (1 << 9)
46#define TIMER_2_CR_UPDOWN (1 << 10)
47#define TIMER_3_CR_UPDOWN (1 << 11)
48#define TIMER_DEFAULT_FLAGS (TIMER_1_CR_UPDOWN | \
49 TIMER_3_CR_ENABLE | \
50 TIMER_3_CR_UPDOWN)
51
52#define TIMER_1_INT_MATCH1 (1 << 0)
53#define TIMER_1_INT_MATCH2 (1 << 1)
54#define TIMER_1_INT_OVERFLOW (1 << 2)
55#define TIMER_2_INT_MATCH1 (1 << 3)
56#define TIMER_2_INT_MATCH2 (1 << 4)
57#define TIMER_2_INT_OVERFLOW (1 << 5)
58#define TIMER_3_INT_MATCH1 (1 << 6)
59#define TIMER_3_INT_MATCH2 (1 << 7)
60#define TIMER_3_INT_OVERFLOW (1 << 8)
61#define TIMER_INT_ALL_MASK 0x1ff
62
37 63
38static unsigned int tick_rate; 64static unsigned int tick_rate;
39 65
66static u64 notrace gemini_read_sched_clock(void)
67{
68 return readl(TIMER_COUNT(TIMER3_BASE));
69}
70
40static int gemini_timer_set_next_event(unsigned long cycles, 71static int gemini_timer_set_next_event(unsigned long cycles,
41 struct clock_event_device *evt) 72 struct clock_event_device *evt)
42{ 73{
43 u32 cr; 74 u32 cr;
44 75
45 cr = readl(TIMER_CR(IO_ADDRESS(GEMINI_TIMER_BASE))); 76 /* Setup the match register */
77 cr = readl(TIMER_COUNT(TIMER1_BASE));
78 writel(cr + cycles, TIMER_MATCH1(TIMER1_BASE));
79 if (readl(TIMER_COUNT(TIMER1_BASE)) - cr > cycles)
80 return -ETIME;
46 81
47 /* This may be overdoing it, feel free to test without this */ 82 return 0;
48 cr &= ~TIMER_2_CR_ENABLE; 83}
49 cr &= ~TIMER_2_CR_INT;
50 writel(cr, TIMER_CR(IO_ADDRESS(GEMINI_TIMER_BASE)));
51 84
52 /* Set next event */ 85static int gemini_timer_shutdown(struct clock_event_device *evt)
53 writel(cycles, TIMER_COUNT(IO_ADDRESS(GEMINI_TIMER2_BASE))); 86{
54 writel(cycles, TIMER_LOAD(IO_ADDRESS(GEMINI_TIMER2_BASE))); 87 u32 cr;
55 cr |= TIMER_2_CR_ENABLE; 88
56 cr |= TIMER_2_CR_INT; 89 /*
57 writel(cr, TIMER_CR(IO_ADDRESS(GEMINI_TIMER_BASE))); 90 * Disable also for oneshot: the set_next() call will arm the timer
91 * instead.
92 */
93 /* Stop timer and interrupt. */
94 cr = readl(TIMER_CR);
95 cr &= ~(TIMER_1_CR_ENABLE | TIMER_1_CR_INT);
96 writel(cr, TIMER_CR);
97
98 /* Setup counter start from 0 */
99 writel(0, TIMER_COUNT(TIMER1_BASE));
100 writel(0, TIMER_LOAD(TIMER1_BASE));
101
102 /* enable interrupt */
103 cr = readl(TIMER_INTR_MASK);
104 cr &= ~(TIMER_1_INT_OVERFLOW | TIMER_1_INT_MATCH2);
105 cr |= TIMER_1_INT_MATCH1;
106 writel(cr, TIMER_INTR_MASK);
107
108 /* start the timer */
109 cr = readl(TIMER_CR);
110 cr |= TIMER_1_CR_ENABLE;
111 writel(cr, TIMER_CR);
58 112
59 return 0; 113 return 0;
60} 114}
61 115
62static void gemini_timer_set_mode(enum clock_event_mode mode, 116static int gemini_timer_set_periodic(struct clock_event_device *evt)
63 struct clock_event_device *evt)
64{ 117{
65 u32 period = DIV_ROUND_CLOSEST(tick_rate, HZ); 118 u32 period = DIV_ROUND_CLOSEST(tick_rate, HZ);
66 u32 cr; 119 u32 cr;
67 120
68 switch (mode) { 121 /* Stop timer and interrupt */
69 case CLOCK_EVT_MODE_PERIODIC: 122 cr = readl(TIMER_CR);
70 /* Start the timer */ 123 cr &= ~(TIMER_1_CR_ENABLE | TIMER_1_CR_INT);
71 writel(period, 124 writel(cr, TIMER_CR);
72 TIMER_COUNT(IO_ADDRESS(GEMINI_TIMER2_BASE))); 125
73 writel(period, 126 /* Setup timer to fire at 1/HT intervals. */
74 TIMER_LOAD(IO_ADDRESS(GEMINI_TIMER2_BASE))); 127 cr = 0xffffffff - (period - 1);
75 cr = readl(TIMER_CR(IO_ADDRESS(GEMINI_TIMER_BASE))); 128 writel(cr, TIMER_COUNT(TIMER1_BASE));
76 cr |= TIMER_2_CR_ENABLE; 129 writel(cr, TIMER_LOAD(TIMER1_BASE));
77 cr |= TIMER_2_CR_INT; 130
78 writel(cr, TIMER_CR(IO_ADDRESS(GEMINI_TIMER_BASE))); 131 /* enable interrupt on overflow */
79 break; 132 cr = readl(TIMER_INTR_MASK);
80 case CLOCK_EVT_MODE_ONESHOT: 133 cr &= ~(TIMER_1_INT_MATCH1 | TIMER_1_INT_MATCH2);
81 case CLOCK_EVT_MODE_UNUSED: 134 cr |= TIMER_1_INT_OVERFLOW;
82 case CLOCK_EVT_MODE_SHUTDOWN: 135 writel(cr, TIMER_INTR_MASK);
83 case CLOCK_EVT_MODE_RESUME: 136
84 /* 137 /* Start the timer */
85 * Disable also for oneshot: the set_next() call will 138 cr = readl(TIMER_CR);
86 * arm the timer instead. 139 cr |= TIMER_1_CR_ENABLE;
87 */ 140 cr |= TIMER_1_CR_INT;
88 cr = readl(TIMER_CR(IO_ADDRESS(GEMINI_TIMER_BASE))); 141 writel(cr, TIMER_CR);
89 cr &= ~TIMER_2_CR_ENABLE; 142
90 cr &= ~TIMER_2_CR_INT; 143 return 0;
91 writel(cr, TIMER_CR(IO_ADDRESS(GEMINI_TIMER_BASE)));
92 break;
93 default:
94 break;
95 }
96} 144}
97 145
98/* Use TIMER2 as clock event */ 146/* Use TIMER1 as clock event */
99static struct clock_event_device gemini_clockevent = { 147static struct clock_event_device gemini_clockevent = {
100 .name = "TIMER2", 148 .name = "TIMER1",
101 .rating = 300, /* Reasonably fast and accurate clock event */ 149 /* Reasonably fast and accurate clock event */
102 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, 150 .rating = 300,
103 .set_next_event = gemini_timer_set_next_event, 151 .shift = 32,
104 .set_mode = gemini_timer_set_mode, 152 .features = CLOCK_EVT_FEAT_PERIODIC |
153 CLOCK_EVT_FEAT_ONESHOT,
154 .set_next_event = gemini_timer_set_next_event,
155 .set_state_shutdown = gemini_timer_shutdown,
156 .set_state_periodic = gemini_timer_set_periodic,
157 .set_state_oneshot = gemini_timer_shutdown,
158 .tick_resume = gemini_timer_shutdown,
105}; 159};
106 160
107/* 161/*
@@ -151,20 +205,35 @@ void __init gemini_timer_init(void)
151 } 205 }
152 206
153 /* 207 /*
154 * Make irqs happen for the system timer 208 * Reset the interrupt mask and status
155 */ 209 */
156 setup_irq(IRQ_TIMER2, &gemini_timer_irq); 210 writel(TIMER_INT_ALL_MASK, TIMER_INTR_MASK);
157 211 writel(0, TIMER_INTR_STATE);
158 /* Enable and use TIMER1 as clock source */ 212 writel(TIMER_DEFAULT_FLAGS, TIMER_CR);
159 writel(0xffffffff, TIMER_COUNT(IO_ADDRESS(GEMINI_TIMER1_BASE))); 213
160 writel(0xffffffff, TIMER_LOAD(IO_ADDRESS(GEMINI_TIMER1_BASE))); 214 /*
161 writel(TIMER_1_CR_ENABLE, TIMER_CR(IO_ADDRESS(GEMINI_TIMER_BASE))); 215 * Setup free-running clocksource timer (interrupts
162 if (clocksource_mmio_init(TIMER_COUNT(IO_ADDRESS(GEMINI_TIMER1_BASE)), 216 * disabled.)
163 "TIMER1", tick_rate, 300, 32, 217 */
164 clocksource_mmio_readl_up)) 218 writel(0, TIMER_COUNT(TIMER3_BASE));
165 pr_err("timer: failed to initialize gemini clock source\n"); 219 writel(0, TIMER_LOAD(TIMER3_BASE));
166 220 writel(0, TIMER_MATCH1(TIMER3_BASE));
167 /* Configure and register the clockevent */ 221 writel(0, TIMER_MATCH2(TIMER3_BASE));
222 clocksource_mmio_init(TIMER_COUNT(TIMER3_BASE),
223 "gemini_clocksource", tick_rate,
224 300, 32, clocksource_mmio_readl_up);
225 sched_clock_register(gemini_read_sched_clock, 32, tick_rate);
226
227 /*
228 * Setup clockevent timer (interrupt-driven.)
229 */
230 writel(0, TIMER_COUNT(TIMER1_BASE));
231 writel(0, TIMER_LOAD(TIMER1_BASE));
232 writel(0, TIMER_MATCH1(TIMER1_BASE));
233 writel(0, TIMER_MATCH2(TIMER1_BASE));
234 setup_irq(IRQ_TIMER1, &gemini_timer_irq);
235 gemini_clockevent.cpumask = cpumask_of(0);
168 clockevents_config_and_register(&gemini_clockevent, tick_rate, 236 clockevents_config_and_register(&gemini_clockevent, tick_rate,
169 1, 0xffffffff); 237 1, 0xffffffff);
238
170} 239}
diff --git a/arch/arm/mach-imx/3ds_debugboard.c b/arch/arm/mach-imx/3ds_debugboard.c
index 134377352966..45903be6e7b3 100644
--- a/arch/arm/mach-imx/3ds_debugboard.c
+++ b/arch/arm/mach-imx/3ds_debugboard.c
@@ -195,7 +195,7 @@ int __init mxc_expio_init(u32 base, u32 intr_gpio)
195 195
196 for (i = irq_base; i < irq_base + MXC_MAX_EXP_IO_LINES; i++) { 196 for (i = irq_base; i < irq_base + MXC_MAX_EXP_IO_LINES; i++) {
197 irq_set_chip_and_handler(i, &expio_irq_chip, handle_level_irq); 197 irq_set_chip_and_handler(i, &expio_irq_chip, handle_level_irq);
198 set_irq_flags(i, IRQF_VALID); 198 irq_clear_status_flags(i, IRQ_NOREQUEST);
199 } 199 }
200 irq_set_irq_type(p_irq, IRQF_TRIGGER_LOW); 200 irq_set_irq_type(p_irq, IRQF_TRIGGER_LOW);
201 irq_set_chained_handler(p_irq, mxc_expio_irq_handler); 201 irq_set_chained_handler(p_irq, mxc_expio_irq_handler);
diff --git a/arch/arm/mach-imx/epit.c b/arch/arm/mach-imx/epit.c
index 074b1a81ba76..08ce20771bb3 100644
--- a/arch/arm/mach-imx/epit.c
+++ b/arch/arm/mach-imx/epit.c
@@ -57,7 +57,6 @@
57#include "hardware.h" 57#include "hardware.h"
58 58
59static struct clock_event_device clockevent_epit; 59static struct clock_event_device clockevent_epit;
60static enum clock_event_mode clockevent_mode = CLOCK_EVT_MODE_UNUSED;
61 60
62static void __iomem *timer_base; 61static void __iomem *timer_base;
63 62
@@ -106,8 +105,8 @@ static int epit_set_next_event(unsigned long evt,
106 return 0; 105 return 0;
107} 106}
108 107
109static void epit_set_mode(enum clock_event_mode mode, 108/* Left event sources disabled, no more interrupts appear */
110 struct clock_event_device *evt) 109static int epit_shutdown(struct clock_event_device *evt)
111{ 110{
112 unsigned long flags; 111 unsigned long flags;
113 112
@@ -120,39 +119,41 @@ static void epit_set_mode(enum clock_event_mode mode,
120 /* Disable interrupt in GPT module */ 119 /* Disable interrupt in GPT module */
121 epit_irq_disable(); 120 epit_irq_disable();
122 121
123 if (mode != clockevent_mode) { 122 /* Clear pending interrupt */
124 /* Set event time into far-far future */ 123 epit_irq_acknowledge();
125
126 /* Clear pending interrupt */
127 epit_irq_acknowledge();
128 }
129 124
130 /* Remember timer mode */
131 clockevent_mode = mode;
132 local_irq_restore(flags); 125 local_irq_restore(flags);
133 126
134 switch (mode) { 127 return 0;
135 case CLOCK_EVT_MODE_PERIODIC: 128}
136 printk(KERN_ERR "epit_set_mode: Periodic mode is not " 129
137 "supported for i.MX EPIT\n"); 130static int epit_set_oneshot(struct clock_event_device *evt)
138 break; 131{
139 case CLOCK_EVT_MODE_ONESHOT: 132 unsigned long flags;
133
134 /*
135 * The timer interrupt generation is disabled at least
136 * for enough time to call epit_set_next_event()
137 */
138 local_irq_save(flags);
139
140 /* Disable interrupt in GPT module */
141 epit_irq_disable();
142
143 /* Clear pending interrupt, only while switching mode */
144 if (!clockevent_state_oneshot(evt))
145 epit_irq_acknowledge();
146
140 /* 147 /*
141 * Do not put overhead of interrupt enable/disable into 148 * Do not put overhead of interrupt enable/disable into
142 * epit_set_next_event(), the core has about 4 minutes 149 * epit_set_next_event(), the core has about 4 minutes
143 * to call epit_set_next_event() or shutdown clock after 150 * to call epit_set_next_event() or shutdown clock after
144 * mode switching 151 * mode switching
145 */ 152 */
146 local_irq_save(flags); 153 epit_irq_enable();
147 epit_irq_enable(); 154 local_irq_restore(flags);
148 local_irq_restore(flags); 155
149 break; 156 return 0;
150 case CLOCK_EVT_MODE_SHUTDOWN:
151 case CLOCK_EVT_MODE_UNUSED:
152 case CLOCK_EVT_MODE_RESUME:
153 /* Left event sources disabled, no more interrupts appear */
154 break;
155 }
156} 157}
157 158
158/* 159/*
@@ -176,11 +177,13 @@ static struct irqaction epit_timer_irq = {
176}; 177};
177 178
178static struct clock_event_device clockevent_epit = { 179static struct clock_event_device clockevent_epit = {
179 .name = "epit", 180 .name = "epit",
180 .features = CLOCK_EVT_FEAT_ONESHOT, 181 .features = CLOCK_EVT_FEAT_ONESHOT,
181 .set_mode = epit_set_mode, 182 .set_state_shutdown = epit_shutdown,
182 .set_next_event = epit_set_next_event, 183 .tick_resume = epit_shutdown,
183 .rating = 200, 184 .set_state_oneshot = epit_set_oneshot,
185 .set_next_event = epit_set_next_event,
186 .rating = 200,
184}; 187};
185 188
186static int __init epit_clockevent_init(struct clk *timer_clk) 189static int __init epit_clockevent_init(struct clk *timer_clk)
diff --git a/arch/arm/mach-imx/mach-imx7d.c b/arch/arm/mach-imx/mach-imx7d.c
index 4d4a19099a43..62f3437257f1 100644
--- a/arch/arm/mach-imx/mach-imx7d.c
+++ b/arch/arm/mach-imx/mach-imx7d.c
@@ -31,7 +31,7 @@ static void __init imx7d_init_irq(void)
31 irqchip_init(); 31 irqchip_init();
32} 32}
33 33
34static const char *imx7d_dt_compat[] __initconst = { 34static const char *const imx7d_dt_compat[] __initconst = {
35 "fsl,imx7d", 35 "fsl,imx7d",
36 NULL, 36 NULL,
37}; 37};
diff --git a/arch/arm/mach-imx/mach-mx31ads.c b/arch/arm/mach-imx/mach-mx31ads.c
index d08c37c696f6..2c0853560bd2 100644
--- a/arch/arm/mach-imx/mach-mx31ads.c
+++ b/arch/arm/mach-imx/mach-mx31ads.c
@@ -238,7 +238,7 @@ static void __init mx31ads_init_expio(void)
238 238
239 for (i = irq_base; i < irq_base + MXC_MAX_EXP_IO_LINES; i++) { 239 for (i = irq_base; i < irq_base + MXC_MAX_EXP_IO_LINES; i++) {
240 irq_set_chip_and_handler(i, &expio_irq_chip, handle_level_irq); 240 irq_set_chip_and_handler(i, &expio_irq_chip, handle_level_irq);
241 set_irq_flags(i, IRQF_VALID); 241 irq_clear_status_flags(i, IRQ_NOREQUEST);
242 } 242 }
243 irq = gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_GPIO1_4)); 243 irq = gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_GPIO1_4));
244 irq_set_irq_type(irq, IRQ_TYPE_LEVEL_HIGH); 244 irq_set_irq_type(irq, IRQ_TYPE_LEVEL_HIGH);
diff --git a/arch/arm/mach-iop13xx/irq.c b/arch/arm/mach-iop13xx/irq.c
index bc739701c301..623d85a4af2d 100644
--- a/arch/arm/mach-iop13xx/irq.c
+++ b/arch/arm/mach-iop13xx/irq.c
@@ -233,7 +233,7 @@ void __init iop13xx_init_irq(void)
233 irq_set_chip(i, &iop13xx_irqchip4); 233 irq_set_chip(i, &iop13xx_irqchip4);
234 234
235 irq_set_handler(i, handle_level_irq); 235 irq_set_handler(i, handle_level_irq);
236 set_irq_flags(i, IRQF_VALID | IRQF_PROBE); 236 irq_clear_status_flags(i, IRQ_NOREQUEST | IRQ_NOPROBE);
237 } 237 }
238 238
239 iop13xx_msi_init(); 239 iop13xx_msi_init();
diff --git a/arch/arm/mach-iop32x/irq.c b/arch/arm/mach-iop32x/irq.c
index d7ee2789d890..2d1f69a68cbc 100644
--- a/arch/arm/mach-iop32x/irq.c
+++ b/arch/arm/mach-iop32x/irq.c
@@ -69,6 +69,6 @@ void __init iop32x_init_irq(void)
69 69
70 for (i = 0; i < NR_IRQS; i++) { 70 for (i = 0; i < NR_IRQS; i++) {
71 irq_set_chip_and_handler(i, &ext_chip, handle_level_irq); 71 irq_set_chip_and_handler(i, &ext_chip, handle_level_irq);
72 set_irq_flags(i, IRQF_VALID | IRQF_PROBE); 72 irq_clear_status_flags(i, IRQ_NOREQUEST | IRQ_NOPROBE);
73 } 73 }
74} 74}
diff --git a/arch/arm/mach-iop33x/irq.c b/arch/arm/mach-iop33x/irq.c
index f7f5d3e451c7..c99ec8d0d285 100644
--- a/arch/arm/mach-iop33x/irq.c
+++ b/arch/arm/mach-iop33x/irq.c
@@ -113,6 +113,6 @@ void __init iop33x_init_irq(void)
113 irq_set_chip_and_handler(i, 113 irq_set_chip_and_handler(i,
114 (i < 32) ? &iop33x_irqchip1 : &iop33x_irqchip2, 114 (i < 32) ? &iop33x_irqchip1 : &iop33x_irqchip2,
115 handle_level_irq); 115 handle_level_irq);
116 set_irq_flags(i, IRQF_VALID | IRQF_PROBE); 116 irq_clear_status_flags(i, IRQ_NOREQUEST | IRQ_NOPROBE);
117 } 117 }
118} 118}
diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c
index 8537d4c41e34..1cb6f2f02880 100644
--- a/arch/arm/mach-ixp4xx/common.c
+++ b/arch/arm/mach-ixp4xx/common.c
@@ -296,7 +296,7 @@ void __init ixp4xx_init_irq(void)
296 for(i = 0; i < NR_IRQS; i++) { 296 for(i = 0; i < NR_IRQS; i++) {
297 irq_set_chip_and_handler(i, &ixp4xx_irq_chip, 297 irq_set_chip_and_handler(i, &ixp4xx_irq_chip,
298 handle_level_irq); 298 handle_level_irq);
299 set_irq_flags(i, IRQF_VALID); 299 irq_clear_status_flags(i, IRQ_NOREQUEST);
300 } 300 }
301} 301}
302 302
@@ -521,43 +521,55 @@ static int ixp4xx_set_next_event(unsigned long evt,
521 return 0; 521 return 0;
522} 522}
523 523
524static void ixp4xx_set_mode(enum clock_event_mode mode, 524static int ixp4xx_shutdown(struct clock_event_device *evt)
525 struct clock_event_device *evt)
526{ 525{
527 unsigned long opts = *IXP4XX_OSRT1 & IXP4XX_OST_RELOAD_MASK; 526 unsigned long opts = *IXP4XX_OSRT1 & IXP4XX_OST_RELOAD_MASK;
528 unsigned long osrt = *IXP4XX_OSRT1 & ~IXP4XX_OST_RELOAD_MASK; 527 unsigned long osrt = *IXP4XX_OSRT1 & ~IXP4XX_OST_RELOAD_MASK;
529 528
530 switch (mode) { 529 opts &= ~IXP4XX_OST_ENABLE;
531 case CLOCK_EVT_MODE_PERIODIC: 530 *IXP4XX_OSRT1 = osrt | opts;
532 osrt = IXP4XX_LATCH & ~IXP4XX_OST_RELOAD_MASK; 531 return 0;
533 opts = IXP4XX_OST_ENABLE; 532}
534 break;
535 case CLOCK_EVT_MODE_ONESHOT:
536 /* period set by 'set next_event' */
537 osrt = 0;
538 opts = IXP4XX_OST_ENABLE | IXP4XX_OST_ONE_SHOT;
539 break;
540 case CLOCK_EVT_MODE_SHUTDOWN:
541 opts &= ~IXP4XX_OST_ENABLE;
542 break;
543 case CLOCK_EVT_MODE_RESUME:
544 opts |= IXP4XX_OST_ENABLE;
545 break;
546 case CLOCK_EVT_MODE_UNUSED:
547 default:
548 osrt = opts = 0;
549 break;
550 }
551 533
534static int ixp4xx_set_oneshot(struct clock_event_device *evt)
535{
536 unsigned long opts = IXP4XX_OST_ENABLE | IXP4XX_OST_ONE_SHOT;
537 unsigned long osrt = 0;
538
539 /* period set by 'set next_event' */
552 *IXP4XX_OSRT1 = osrt | opts; 540 *IXP4XX_OSRT1 = osrt | opts;
541 return 0;
542}
543
544static int ixp4xx_set_periodic(struct clock_event_device *evt)
545{
546 unsigned long opts = IXP4XX_OST_ENABLE;
547 unsigned long osrt = IXP4XX_LATCH & ~IXP4XX_OST_RELOAD_MASK;
548
549 *IXP4XX_OSRT1 = osrt | opts;
550 return 0;
551}
552
553static int ixp4xx_resume(struct clock_event_device *evt)
554{
555 unsigned long opts = *IXP4XX_OSRT1 & IXP4XX_OST_RELOAD_MASK;
556 unsigned long osrt = *IXP4XX_OSRT1 & ~IXP4XX_OST_RELOAD_MASK;
557
558 opts |= IXP4XX_OST_ENABLE;
559 *IXP4XX_OSRT1 = osrt | opts;
560 return 0;
553} 561}
554 562
555static struct clock_event_device clockevent_ixp4xx = { 563static struct clock_event_device clockevent_ixp4xx = {
556 .name = "ixp4xx timer1", 564 .name = "ixp4xx timer1",
557 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, 565 .features = CLOCK_EVT_FEAT_PERIODIC |
558 .rating = 200, 566 CLOCK_EVT_FEAT_ONESHOT,
559 .set_mode = ixp4xx_set_mode, 567 .rating = 200,
560 .set_next_event = ixp4xx_set_next_event, 568 .set_state_shutdown = ixp4xx_shutdown,
569 .set_state_periodic = ixp4xx_set_periodic,
570 .set_state_oneshot = ixp4xx_set_oneshot,
571 .tick_resume = ixp4xx_resume,
572 .set_next_event = ixp4xx_set_next_event,
561}; 573};
562 574
563static void __init ixp4xx_clockevent_init(void) 575static void __init ixp4xx_clockevent_init(void)
diff --git a/arch/arm/mach-ks8695/irq.c b/arch/arm/mach-ks8695/irq.c
index 76802aac0f45..31439f2ee21e 100644
--- a/arch/arm/mach-ks8695/irq.c
+++ b/arch/arm/mach-ks8695/irq.c
@@ -172,6 +172,6 @@ void __init ks8695_init_irq(void)
172 handle_edge_irq); 172 handle_edge_irq);
173 } 173 }
174 174
175 set_irq_flags(irq, IRQF_VALID); 175 irq_clear_status_flags(irq, IRQ_NOREQUEST);
176 } 176 }
177} 177}
diff --git a/arch/arm/mach-ks8695/time.c b/arch/arm/mach-ks8695/time.c
index a197874bf382..18eb0fbd8d82 100644
--- a/arch/arm/mach-ks8695/time.c
+++ b/arch/arm/mach-ks8695/time.c
@@ -54,28 +54,25 @@
54/* Timer0 Timeout Counter Register */ 54/* Timer0 Timeout Counter Register */
55#define T0TC_WATCHDOG (0xff) /* Enable watchdog mode */ 55#define T0TC_WATCHDOG (0xff) /* Enable watchdog mode */
56 56
57static void ks8695_set_mode(enum clock_event_mode mode, 57static int ks8695_set_periodic(struct clock_event_device *evt)
58 struct clock_event_device *evt)
59{ 58{
59 u32 rate = DIV_ROUND_CLOSEST(KS8695_CLOCK_RATE, HZ);
60 u32 half = DIV_ROUND_CLOSEST(rate, 2);
60 u32 tmcon; 61 u32 tmcon;
61 62
62 if (mode == CLOCK_EVT_FEAT_PERIODIC) { 63 /* Disable timer 1 */
63 u32 rate = DIV_ROUND_CLOSEST(KS8695_CLOCK_RATE, HZ); 64 tmcon = readl_relaxed(KS8695_TMR_VA + KS8695_TMCON);
64 u32 half = DIV_ROUND_CLOSEST(rate, 2); 65 tmcon &= ~TMCON_T1EN;
65 66 writel_relaxed(tmcon, KS8695_TMR_VA + KS8695_TMCON);
66 /* Disable timer 1 */
67 tmcon = readl_relaxed(KS8695_TMR_VA + KS8695_TMCON);
68 tmcon &= ~TMCON_T1EN;
69 writel_relaxed(tmcon, KS8695_TMR_VA + KS8695_TMCON);
70 67
71 /* Both registers need to count down */ 68 /* Both registers need to count down */
72 writel_relaxed(half, KS8695_TMR_VA + KS8695_T1TC); 69 writel_relaxed(half, KS8695_TMR_VA + KS8695_T1TC);
73 writel_relaxed(half, KS8695_TMR_VA + KS8695_T1PD); 70 writel_relaxed(half, KS8695_TMR_VA + KS8695_T1PD);
74 71
75 /* Re-enable timer1 */ 72 /* Re-enable timer1 */
76 tmcon |= TMCON_T1EN; 73 tmcon |= TMCON_T1EN;
77 writel_relaxed(tmcon, KS8695_TMR_VA + KS8695_TMCON); 74 writel_relaxed(tmcon, KS8695_TMR_VA + KS8695_TMCON);
78 } 75 return 0;
79} 76}
80 77
81static int ks8695_set_next_event(unsigned long cycles, 78static int ks8695_set_next_event(unsigned long cycles,
@@ -102,11 +99,13 @@ static int ks8695_set_next_event(unsigned long cycles,
102} 99}
103 100
104static struct clock_event_device clockevent_ks8695 = { 101static struct clock_event_device clockevent_ks8695 = {
105 .name = "ks8695_t1tc", 102 .name = "ks8695_t1tc",
106 .rating = 300, /* Reasonably fast and accurate clock event */ 103 /* Reasonably fast and accurate clock event */
107 .features = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_PERIODIC, 104 .rating = 300,
108 .set_next_event = ks8695_set_next_event, 105 .features = CLOCK_EVT_FEAT_ONESHOT |
109 .set_mode = ks8695_set_mode, 106 CLOCK_EVT_FEAT_PERIODIC,
107 .set_next_event = ks8695_set_next_event,
108 .set_state_periodic = ks8695_set_periodic,
110}; 109};
111 110
112/* 111/*
diff --git a/arch/arm/mach-lpc32xx/irq.c b/arch/arm/mach-lpc32xx/irq.c
index d4f7dc87042b..cce4cef12b6e 100644
--- a/arch/arm/mach-lpc32xx/irq.c
+++ b/arch/arm/mach-lpc32xx/irq.c
@@ -283,25 +283,25 @@ static int lpc32xx_set_irq_type(struct irq_data *d, unsigned int type)
283 case IRQ_TYPE_EDGE_RISING: 283 case IRQ_TYPE_EDGE_RISING:
284 /* Rising edge sensitive */ 284 /* Rising edge sensitive */
285 __lpc32xx_set_irq_type(d->hwirq, 1, 1); 285 __lpc32xx_set_irq_type(d->hwirq, 1, 1);
286 __irq_set_handler_locked(d->irq, handle_edge_irq); 286 irq_set_handler_locked(d, handle_edge_irq);
287 break; 287 break;
288 288
289 case IRQ_TYPE_EDGE_FALLING: 289 case IRQ_TYPE_EDGE_FALLING:
290 /* Falling edge sensitive */ 290 /* Falling edge sensitive */
291 __lpc32xx_set_irq_type(d->hwirq, 0, 1); 291 __lpc32xx_set_irq_type(d->hwirq, 0, 1);
292 __irq_set_handler_locked(d->irq, handle_edge_irq); 292 irq_set_handler_locked(d, handle_edge_irq);
293 break; 293 break;
294 294
295 case IRQ_TYPE_LEVEL_LOW: 295 case IRQ_TYPE_LEVEL_LOW:
296 /* Low level sensitive */ 296 /* Low level sensitive */
297 __lpc32xx_set_irq_type(d->hwirq, 0, 0); 297 __lpc32xx_set_irq_type(d->hwirq, 0, 0);
298 __irq_set_handler_locked(d->irq, handle_level_irq); 298 irq_set_handler_locked(d, handle_level_irq);
299 break; 299 break;
300 300
301 case IRQ_TYPE_LEVEL_HIGH: 301 case IRQ_TYPE_LEVEL_HIGH:
302 /* High level sensitive */ 302 /* High level sensitive */
303 __lpc32xx_set_irq_type(d->hwirq, 1, 0); 303 __lpc32xx_set_irq_type(d->hwirq, 1, 0);
304 __irq_set_handler_locked(d->irq, handle_level_irq); 304 irq_set_handler_locked(d, handle_level_irq);
305 break; 305 break;
306 306
307 /* Other modes are not supported */ 307 /* Other modes are not supported */
@@ -434,7 +434,7 @@ void __init lpc32xx_init_irq(void)
434 for (i = 0; i < NR_IRQS; i++) { 434 for (i = 0; i < NR_IRQS; i++) {
435 irq_set_chip_and_handler(i, &lpc32xx_irq_chip, 435 irq_set_chip_and_handler(i, &lpc32xx_irq_chip,
436 handle_level_irq); 436 handle_level_irq);
437 set_irq_flags(i, IRQF_VALID); 437 irq_clear_status_flags(i, IRQ_NOREQUEST);
438 } 438 }
439 439
440 /* Set default mappings */ 440 /* Set default mappings */
diff --git a/arch/arm/mach-lpc32xx/phy3250.c b/arch/arm/mach-lpc32xx/phy3250.c
index 7858d5b6f6ce..77d6b1bab278 100644
--- a/arch/arm/mach-lpc32xx/phy3250.c
+++ b/arch/arm/mach-lpc32xx/phy3250.c
@@ -212,7 +212,7 @@ static struct lpc32xx_mlc_platform_data lpc32xx_mlc_data = {
212 .dma_filter = pl08x_filter_id, 212 .dma_filter = pl08x_filter_id,
213}; 213};
214 214
215static const struct of_dev_auxdata lpc32xx_auxdata_lookup[] __initconst = { 215static const struct of_dev_auxdata const lpc32xx_auxdata_lookup[] __initconst = {
216 OF_DEV_AUXDATA("arm,pl022", 0x20084000, "dev:ssp0", NULL), 216 OF_DEV_AUXDATA("arm,pl022", 0x20084000, "dev:ssp0", NULL),
217 OF_DEV_AUXDATA("arm,pl022", 0x2008C000, "dev:ssp1", NULL), 217 OF_DEV_AUXDATA("arm,pl022", 0x2008C000, "dev:ssp1", NULL),
218 OF_DEV_AUXDATA("arm,pl110", 0x31040000, "dev:clcd", &lpc32xx_clcd_data), 218 OF_DEV_AUXDATA("arm,pl110", 0x31040000, "dev:clcd", &lpc32xx_clcd_data),
@@ -248,7 +248,7 @@ static void __init lpc3250_machine_init(void)
248 lpc32xx_auxdata_lookup, NULL); 248 lpc32xx_auxdata_lookup, NULL);
249} 249}
250 250
251static char const *lpc32xx_dt_compat[] __initdata = { 251static const char *const lpc32xx_dt_compat[] __initconst = {
252 "nxp,lpc3220", 252 "nxp,lpc3220",
253 "nxp,lpc3230", 253 "nxp,lpc3230",
254 "nxp,lpc3240", 254 "nxp,lpc3240",
diff --git a/arch/arm/mach-lpc32xx/timer.c b/arch/arm/mach-lpc32xx/timer.c
index 4e5837299c04..ff3499d1fb1a 100644
--- a/arch/arm/mach-lpc32xx/timer.c
+++ b/arch/arm/mach-lpc32xx/timer.c
@@ -43,36 +43,24 @@ static int lpc32xx_clkevt_next_event(unsigned long delta,
43 return 0; 43 return 0;
44} 44}
45 45
46static void lpc32xx_clkevt_mode(enum clock_event_mode mode, 46static int lpc32xx_shutdown(struct clock_event_device *evt)
47 struct clock_event_device *dev)
48{ 47{
49 switch (mode) { 48 /*
50 case CLOCK_EVT_MODE_PERIODIC: 49 * Disable the timer. When using oneshot, we must also
51 WARN_ON(1); 50 * disable the timer to wait for the first call to
52 break; 51 * set_next_event().
53 52 */
54 case CLOCK_EVT_MODE_ONESHOT: 53 __raw_writel(0, LPC32XX_TIMER_TCR(LPC32XX_TIMER0_BASE));
55 case CLOCK_EVT_MODE_SHUTDOWN: 54 return 0;
56 /*
57 * Disable the timer. When using oneshot, we must also
58 * disable the timer to wait for the first call to
59 * set_next_event().
60 */
61 __raw_writel(0, LPC32XX_TIMER_TCR(LPC32XX_TIMER0_BASE));
62 break;
63
64 case CLOCK_EVT_MODE_UNUSED:
65 case CLOCK_EVT_MODE_RESUME:
66 break;
67 }
68} 55}
69 56
70static struct clock_event_device lpc32xx_clkevt = { 57static struct clock_event_device lpc32xx_clkevt = {
71 .name = "lpc32xx_clkevt", 58 .name = "lpc32xx_clkevt",
72 .features = CLOCK_EVT_FEAT_ONESHOT, 59 .features = CLOCK_EVT_FEAT_ONESHOT,
73 .rating = 300, 60 .rating = 300,
74 .set_next_event = lpc32xx_clkevt_next_event, 61 .set_next_event = lpc32xx_clkevt_next_event,
75 .set_mode = lpc32xx_clkevt_mode, 62 .set_state_shutdown = lpc32xx_shutdown,
63 .set_state_oneshot = lpc32xx_shutdown,
76}; 64};
77 65
78static irqreturn_t lpc32xx_timer_interrupt(int irq, void *dev_id) 66static irqreturn_t lpc32xx_timer_interrupt(int irq, void *dev_id)
diff --git a/arch/arm/mach-mmp/mmp-dt.c b/arch/arm/mach-mmp/mmp-dt.c
index b2296c9309b8..6e155f03b83c 100644
--- a/arch/arm/mach-mmp/mmp-dt.c
+++ b/arch/arm/mach-mmp/mmp-dt.c
@@ -20,12 +20,12 @@
20 20
21extern void __init mmp_dt_init_timer(void); 21extern void __init mmp_dt_init_timer(void);
22 22
23static const char *pxa168_dt_board_compat[] __initdata = { 23static const char *const pxa168_dt_board_compat[] __initconst = {
24 "mrvl,pxa168-aspenite", 24 "mrvl,pxa168-aspenite",
25 NULL, 25 NULL,
26}; 26};
27 27
28static const char *pxa910_dt_board_compat[] __initdata = { 28static const char *const pxa910_dt_board_compat[] __initconst = {
29 "mrvl,pxa910-dkb", 29 "mrvl,pxa910-dkb",
30 NULL, 30 NULL,
31}; 31};
diff --git a/arch/arm/mach-mmp/mmp2-dt.c b/arch/arm/mach-mmp/mmp2-dt.c
index 998c0f533abc..0341359b24a4 100644
--- a/arch/arm/mach-mmp/mmp2-dt.c
+++ b/arch/arm/mach-mmp/mmp2-dt.c
@@ -30,7 +30,7 @@ static void __init mmp_init_time(void)
30 of_clk_init(NULL); 30 of_clk_init(NULL);
31} 31}
32 32
33static const char *mmp2_dt_board_compat[] __initdata = { 33static const char *const mmp2_dt_board_compat[] __initconst = {
34 "mrvl,mmp2-brownstone", 34 "mrvl,mmp2-brownstone",
35 NULL, 35 NULL,
36}; 36};
diff --git a/arch/arm/mach-mmp/time.c b/arch/arm/mach-mmp/time.c
index 10bfa03e58d4..dbc697b2fda1 100644
--- a/arch/arm/mach-mmp/time.c
+++ b/arch/arm/mach-mmp/time.c
@@ -124,32 +124,25 @@ static int timer_set_next_event(unsigned long delta,
124 return 0; 124 return 0;
125} 125}
126 126
127static void timer_set_mode(enum clock_event_mode mode, 127static int timer_set_shutdown(struct clock_event_device *evt)
128 struct clock_event_device *dev)
129{ 128{
130 unsigned long flags; 129 unsigned long flags;
131 130
132 local_irq_save(flags); 131 local_irq_save(flags);
133 switch (mode) { 132 /* disable the matching interrupt */
134 case CLOCK_EVT_MODE_ONESHOT: 133 __raw_writel(0x00, mmp_timer_base + TMR_IER(0));
135 case CLOCK_EVT_MODE_UNUSED:
136 case CLOCK_EVT_MODE_SHUTDOWN:
137 /* disable the matching interrupt */
138 __raw_writel(0x00, mmp_timer_base + TMR_IER(0));
139 break;
140 case CLOCK_EVT_MODE_RESUME:
141 case CLOCK_EVT_MODE_PERIODIC:
142 break;
143 }
144 local_irq_restore(flags); 134 local_irq_restore(flags);
135
136 return 0;
145} 137}
146 138
147static struct clock_event_device ckevt = { 139static struct clock_event_device ckevt = {
148 .name = "clockevent", 140 .name = "clockevent",
149 .features = CLOCK_EVT_FEAT_ONESHOT, 141 .features = CLOCK_EVT_FEAT_ONESHOT,
150 .rating = 200, 142 .rating = 200,
151 .set_next_event = timer_set_next_event, 143 .set_next_event = timer_set_next_event,
152 .set_mode = timer_set_mode, 144 .set_state_shutdown = timer_set_shutdown,
145 .set_state_oneshot = timer_set_shutdown,
153}; 146};
154 147
155static cycle_t clksrc_read(struct clocksource *cs) 148static cycle_t clksrc_read(struct clocksource *cs)
diff --git a/arch/arm/mach-mvebu/pmsu.c b/arch/arm/mach-mvebu/pmsu.c
index 4f4e22206ae5..e8fdb9ceedf0 100644
--- a/arch/arm/mach-mvebu/pmsu.c
+++ b/arch/arm/mach-mvebu/pmsu.c
@@ -415,7 +415,7 @@ static __init int armada_38x_cpuidle_init(void)
415 void __iomem *mpsoc_base; 415 void __iomem *mpsoc_base;
416 u32 reg; 416 u32 reg;
417 417
418 pr_warn("CPU idle is currently broken on Armada 38x: disabling"); 418 pr_warn("CPU idle is currently broken on Armada 38x: disabling\n");
419 return 0; 419 return 0;
420 420
421 np = of_find_compatible_node(NULL, NULL, 421 np = of_find_compatible_node(NULL, NULL,
@@ -486,7 +486,7 @@ static int __init mvebu_v7_cpu_pm_init(void)
486 */ 486 */
487 if (of_machine_is_compatible("marvell,armada380")) { 487 if (of_machine_is_compatible("marvell,armada380")) {
488 cpu_hotplug_disable(); 488 cpu_hotplug_disable();
489 pr_warn("CPU hotplug support is currently broken on Armada 38x: disabling"); 489 pr_warn("CPU hotplug support is currently broken on Armada 38x: disabling\n");
490 } 490 }
491 491
492 if (of_machine_is_compatible("marvell,armadaxp")) 492 if (of_machine_is_compatible("marvell,armadaxp"))
diff --git a/arch/arm/mach-mxs/mach-mxs.c b/arch/arm/mach-mxs/mach-mxs.c
index 2e7cec86e50e..f1ea4700efcf 100644
--- a/arch/arm/mach-mxs/mach-mxs.c
+++ b/arch/arm/mach-mxs/mach-mxs.c
@@ -282,7 +282,7 @@ static void __init apx4devkit_init(void)
282#define TX28_FEC_PHY_RESET MXS_GPIO_NR(4, 13) 282#define TX28_FEC_PHY_RESET MXS_GPIO_NR(4, 13)
283#define TX28_FEC_nINT MXS_GPIO_NR(4, 5) 283#define TX28_FEC_nINT MXS_GPIO_NR(4, 5)
284 284
285static const struct gpio tx28_gpios[] __initconst = { 285static const struct gpio const tx28_gpios[] __initconst = {
286 { ENET0_MDC__GPIO_4_0, GPIOF_OUT_INIT_LOW, "GPIO_4_0" }, 286 { ENET0_MDC__GPIO_4_0, GPIOF_OUT_INIT_LOW, "GPIO_4_0" },
287 { ENET0_MDIO__GPIO_4_1, GPIOF_OUT_INIT_LOW, "GPIO_4_1" }, 287 { ENET0_MDIO__GPIO_4_1, GPIOF_OUT_INIT_LOW, "GPIO_4_1" },
288 { ENET0_RX_EN__GPIO_4_2, GPIOF_OUT_INIT_LOW, "GPIO_4_2" }, 288 { ENET0_RX_EN__GPIO_4_2, GPIOF_OUT_INIT_LOW, "GPIO_4_2" },
@@ -528,7 +528,7 @@ static void mxs_restart(enum reboot_mode mode, const char *cmd)
528 soft_restart(0); 528 soft_restart(0);
529} 529}
530 530
531static const char *mxs_dt_compat[] __initdata = { 531static const char *const mxs_dt_compat[] __initconst = {
532 "fsl,imx28", 532 "fsl,imx28",
533 "fsl,imx23", 533 "fsl,imx23",
534 NULL, 534 NULL,
diff --git a/arch/arm/mach-netx/generic.c b/arch/arm/mach-netx/generic.c
index db25b0cef3a7..6373e2bff203 100644
--- a/arch/arm/mach-netx/generic.c
+++ b/arch/arm/mach-netx/generic.c
@@ -174,7 +174,7 @@ void __init netx_init_irq(void)
174 for (irq = NETX_IRQ_HIF_CHAINED(0); irq <= NETX_IRQ_HIF_LAST; irq++) { 174 for (irq = NETX_IRQ_HIF_CHAINED(0); irq <= NETX_IRQ_HIF_LAST; irq++) {
175 irq_set_chip_and_handler(irq, &netx_hif_chip, 175 irq_set_chip_and_handler(irq, &netx_hif_chip,
176 handle_level_irq); 176 handle_level_irq);
177 set_irq_flags(irq, IRQF_VALID); 177 irq_clear_status_flags(irq, IRQ_NOREQUEST);
178 } 178 }
179 179
180 writel(NETX_DPMAS_INT_EN_GLB_EN, NETX_DPMAS_INT_EN); 180 writel(NETX_DPMAS_INT_EN_GLB_EN, NETX_DPMAS_INT_EN);
diff --git a/arch/arm/mach-netx/time.c b/arch/arm/mach-netx/time.c
index 5fb2a590ec17..054a8a61e379 100644
--- a/arch/arm/mach-netx/time.c
+++ b/arch/arm/mach-netx/time.c
@@ -34,40 +34,40 @@
34#define TIMER_CLOCKEVENT 0 34#define TIMER_CLOCKEVENT 0
35#define TIMER_CLOCKSOURCE 1 35#define TIMER_CLOCKSOURCE 1
36 36
37static void netx_set_mode(enum clock_event_mode mode, 37static inline void timer_shutdown(struct clock_event_device *evt)
38 struct clock_event_device *clk)
39{ 38{
40 u32 tmode;
41
42 /* disable timer */ 39 /* disable timer */
43 writel(0, NETX_GPIO_COUNTER_CTRL(TIMER_CLOCKEVENT)); 40 writel(0, NETX_GPIO_COUNTER_CTRL(TIMER_CLOCKEVENT));
41}
42
43static int netx_shutdown(struct clock_event_device *evt)
44{
45 timer_shutdown(evt);
46
47 return 0;
48}
49
50static int netx_set_oneshot(struct clock_event_device *evt)
51{
52 u32 tmode = NETX_GPIO_COUNTER_CTRL_IRQ_EN | NETX_GPIO_COUNTER_CTRL_RUN;
53
54 timer_shutdown(evt);
55 writel(0, NETX_GPIO_COUNTER_MAX(TIMER_CLOCKEVENT));
56 writel(tmode, NETX_GPIO_COUNTER_CTRL(TIMER_CLOCKEVENT));
44 57
45 switch (mode) { 58 return 0;
46 case CLOCK_EVT_MODE_PERIODIC: 59}
47 writel(NETX_LATCH, NETX_GPIO_COUNTER_MAX(TIMER_CLOCKEVENT));
48 tmode = NETX_GPIO_COUNTER_CTRL_RST_EN |
49 NETX_GPIO_COUNTER_CTRL_IRQ_EN |
50 NETX_GPIO_COUNTER_CTRL_RUN;
51 break;
52
53 case CLOCK_EVT_MODE_ONESHOT:
54 writel(0, NETX_GPIO_COUNTER_MAX(TIMER_CLOCKEVENT));
55 tmode = NETX_GPIO_COUNTER_CTRL_IRQ_EN |
56 NETX_GPIO_COUNTER_CTRL_RUN;
57 break;
58
59 default:
60 WARN(1, "%s: unhandled mode %d\n", __func__, mode);
61 /* fall through */
62
63 case CLOCK_EVT_MODE_SHUTDOWN:
64 case CLOCK_EVT_MODE_UNUSED:
65 case CLOCK_EVT_MODE_RESUME:
66 tmode = 0;
67 break;
68 }
69 60
61static int netx_set_periodic(struct clock_event_device *evt)
62{
63 u32 tmode = NETX_GPIO_COUNTER_CTRL_RST_EN |
64 NETX_GPIO_COUNTER_CTRL_IRQ_EN | NETX_GPIO_COUNTER_CTRL_RUN;
65
66 timer_shutdown(evt);
67 writel(NETX_LATCH, NETX_GPIO_COUNTER_MAX(TIMER_CLOCKEVENT));
70 writel(tmode, NETX_GPIO_COUNTER_CTRL(TIMER_CLOCKEVENT)); 68 writel(tmode, NETX_GPIO_COUNTER_CTRL(TIMER_CLOCKEVENT));
69
70 return 0;
71} 71}
72 72
73static int netx_set_next_event(unsigned long evt, 73static int netx_set_next_event(unsigned long evt,
@@ -81,7 +81,10 @@ static struct clock_event_device netx_clockevent = {
81 .name = "netx-timer" __stringify(TIMER_CLOCKEVENT), 81 .name = "netx-timer" __stringify(TIMER_CLOCKEVENT),
82 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, 82 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
83 .set_next_event = netx_set_next_event, 83 .set_next_event = netx_set_next_event,
84 .set_mode = netx_set_mode, 84 .set_state_shutdown = netx_shutdown,
85 .set_state_periodic = netx_set_periodic,
86 .set_state_oneshot = netx_set_oneshot,
87 .tick_resume = netx_shutdown,
85}; 88};
86 89
87/* 90/*
diff --git a/arch/arm/mach-nomadik/cpu-8815.c b/arch/arm/mach-nomadik/cpu-8815.c
index 9bda46f1fab7..0c612d95bd5c 100644
--- a/arch/arm/mach-nomadik/cpu-8815.c
+++ b/arch/arm/mach-nomadik/cpu-8815.c
@@ -26,10 +26,8 @@
26#include <linux/irq.h> 26#include <linux/irq.h>
27#include <linux/dma-mapping.h> 27#include <linux/dma-mapping.h>
28#include <linux/of_irq.h> 28#include <linux/of_irq.h>
29#include <linux/of_gpio.h>
30#include <linux/of_address.h> 29#include <linux/of_address.h>
31#include <linux/of_platform.h> 30#include <linux/of_platform.h>
32#include <linux/gpio.h>
33 31
34#include <asm/mach/arch.h> 32#include <asm/mach/arch.h>
35#include <asm/mach/map.h> 33#include <asm/mach/map.h>
@@ -109,40 +107,6 @@ static void cpu8815_restart(enum reboot_mode mode, const char *cmd)
109 writel(1, srcbase + 0x18); 107 writel(1, srcbase + 0x18);
110} 108}
111 109
112/*
113 * This GPIO pin turns on a line that is used to detect card insertion
114 * on this board.
115 */
116static int __init cpu8815_mmcsd_init(void)
117{
118 struct device_node *cdbias;
119 int gpio, err;
120
121 cdbias = of_find_node_by_path("/usb-s8815/mmcsd-gpio");
122 if (!cdbias) {
123 pr_info("could not find MMC/SD card detect bias node\n");
124 return 0;
125 }
126 gpio = of_get_gpio(cdbias, 0);
127 if (gpio < 0) {
128 pr_info("could not obtain MMC/SD card detect bias GPIO\n");
129 return 0;
130 }
131 err = gpio_request(gpio, "card detect bias");
132 if (err) {
133 pr_info("failed to request card detect bias GPIO %d\n", gpio);
134 return -ENODEV;
135 }
136 err = gpio_direction_output(gpio, 0);
137 if (err){
138 pr_info("failed to set GPIO %d as output, low\n", gpio);
139 return err;
140 }
141 pr_info("enabled USB-S8815 CD bias GPIO %d, low\n", gpio);
142 return 0;
143}
144device_initcall(cpu8815_mmcsd_init);
145
146static const char * cpu8815_board_compat[] = { 110static const char * cpu8815_board_compat[] = {
147 "st,nomadik-nhk-15", 111 "st,nomadik-nhk-15",
148 "calaosystems,usb-s8815", 112 "calaosystems,usb-s8815",
@@ -150,9 +114,8 @@ static const char * cpu8815_board_compat[] = {
150}; 114};
151 115
152DT_MACHINE_START(NOMADIK_DT, "Nomadik STn8815") 116DT_MACHINE_START(NOMADIK_DT, "Nomadik STn8815")
153 /* At full speed latency must be >=2, so 0x249 in low bits */ 117 .l2c_aux_val = 0,
154 .l2c_aux_val = 0x00700249, 118 .l2c_aux_mask = ~0,
155 .l2c_aux_mask = 0xfe0fefff,
156 .map_io = cpu8815_map_io, 119 .map_io = cpu8815_map_io,
157 .restart = cpu8815_restart, 120 .restart = cpu8815_restart,
158 .dt_compat = cpu8815_board_compat, 121 .dt_compat = cpu8815_board_compat,
diff --git a/arch/arm/mach-omap1/fpga.c b/arch/arm/mach-omap1/fpga.c
index 3c0e42219200..dfec671b1639 100644
--- a/arch/arm/mach-omap1/fpga.c
+++ b/arch/arm/mach-omap1/fpga.c
@@ -169,7 +169,7 @@ void omap1510_fpga_init_irq(void)
169 } 169 }
170 170
171 irq_set_handler(i, handle_edge_irq); 171 irq_set_handler(i, handle_edge_irq);
172 set_irq_flags(i, IRQF_VALID); 172 irq_clear_status_flags(i, IRQ_NOREQUEST);
173 } 173 }
174 174
175 /* 175 /*
diff --git a/arch/arm/mach-omap1/irq.c b/arch/arm/mach-omap1/irq.c
index f4d346fda9da..b11edc8a46f0 100644
--- a/arch/arm/mach-omap1/irq.c
+++ b/arch/arm/mach-omap1/irq.c
@@ -262,7 +262,7 @@ void __init omap1_init_irq(void)
262 262
263 irq_trigger = irq_banks[i].trigger_map >> IRQ_BIT(j); 263 irq_trigger = irq_banks[i].trigger_map >> IRQ_BIT(j);
264 omap_irq_set_cfg(j, 0, 0, irq_trigger); 264 omap_irq_set_cfg(j, 0, 0, irq_trigger);
265 set_irq_flags(j, IRQF_VALID); 265 irq_clear_status_flags(j, IRQ_NOREQUEST);
266 } 266 }
267 omap_alloc_gc(irq_banks[i].va, irq_base + i * 32, 32); 267 omap_alloc_gc(irq_banks[i].va, irq_base + i * 32, 32);
268 } 268 }
diff --git a/arch/arm/mach-omap1/time.c b/arch/arm/mach-omap1/time.c
index a7588cfd0286..524977a31a49 100644
--- a/arch/arm/mach-omap1/time.c
+++ b/arch/arm/mach-omap1/time.c
@@ -124,29 +124,26 @@ static int omap_mpu_set_next_event(unsigned long cycles,
124 return 0; 124 return 0;
125} 125}
126 126
127static void omap_mpu_set_mode(enum clock_event_mode mode, 127static int omap_mpu_set_oneshot(struct clock_event_device *evt)
128 struct clock_event_device *evt)
129{ 128{
130 switch (mode) { 129 omap_mpu_timer_stop(0);
131 case CLOCK_EVT_MODE_PERIODIC: 130 omap_mpu_remove_autoreset(0);
132 omap_mpu_set_autoreset(0); 131 return 0;
133 break; 132}
134 case CLOCK_EVT_MODE_ONESHOT: 133
135 omap_mpu_timer_stop(0); 134static int omap_mpu_set_periodic(struct clock_event_device *evt)
136 omap_mpu_remove_autoreset(0); 135{
137 break; 136 omap_mpu_set_autoreset(0);
138 case CLOCK_EVT_MODE_UNUSED: 137 return 0;
139 case CLOCK_EVT_MODE_SHUTDOWN:
140 case CLOCK_EVT_MODE_RESUME:
141 break;
142 }
143} 138}
144 139
145static struct clock_event_device clockevent_mpu_timer1 = { 140static struct clock_event_device clockevent_mpu_timer1 = {
146 .name = "mpu_timer1", 141 .name = "mpu_timer1",
147 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, 142 .features = CLOCK_EVT_FEAT_PERIODIC |
148 .set_next_event = omap_mpu_set_next_event, 143 CLOCK_EVT_FEAT_ONESHOT,
149 .set_mode = omap_mpu_set_mode, 144 .set_next_event = omap_mpu_set_next_event,
145 .set_state_periodic = omap_mpu_set_periodic,
146 .set_state_oneshot = omap_mpu_set_oneshot,
150}; 147};
151 148
152static irqreturn_t omap_mpu_timer1_interrupt(int irq, void *dev_id) 149static irqreturn_t omap_mpu_timer1_interrupt(int irq, void *dev_id)
diff --git a/arch/arm/mach-omap1/timer32k.c b/arch/arm/mach-omap1/timer32k.c
index 36bf174b3fac..0ae6c52a7d70 100644
--- a/arch/arm/mach-omap1/timer32k.c
+++ b/arch/arm/mach-omap1/timer32k.c
@@ -114,29 +114,28 @@ static int omap_32k_timer_set_next_event(unsigned long delta,
114 return 0; 114 return 0;
115} 115}
116 116
117static void omap_32k_timer_set_mode(enum clock_event_mode mode, 117static int omap_32k_timer_shutdown(struct clock_event_device *evt)
118 struct clock_event_device *evt)
119{ 118{
120 omap_32k_timer_stop(); 119 omap_32k_timer_stop();
120 return 0;
121}
121 122
122 switch (mode) { 123static int omap_32k_timer_set_periodic(struct clock_event_device *evt)
123 case CLOCK_EVT_MODE_PERIODIC: 124{
124 omap_32k_timer_start(OMAP_32K_TIMER_TICK_PERIOD); 125 omap_32k_timer_stop();
125 break; 126 omap_32k_timer_start(OMAP_32K_TIMER_TICK_PERIOD);
126 case CLOCK_EVT_MODE_ONESHOT: 127 return 0;
127 case CLOCK_EVT_MODE_UNUSED:
128 case CLOCK_EVT_MODE_SHUTDOWN:
129 break;
130 case CLOCK_EVT_MODE_RESUME:
131 break;
132 }
133} 128}
134 129
135static struct clock_event_device clockevent_32k_timer = { 130static struct clock_event_device clockevent_32k_timer = {
136 .name = "32k-timer", 131 .name = "32k-timer",
137 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, 132 .features = CLOCK_EVT_FEAT_PERIODIC |
138 .set_next_event = omap_32k_timer_set_next_event, 133 CLOCK_EVT_FEAT_ONESHOT,
139 .set_mode = omap_32k_timer_set_mode, 134 .set_next_event = omap_32k_timer_set_next_event,
135 .set_state_shutdown = omap_32k_timer_shutdown,
136 .set_state_periodic = omap_32k_timer_set_periodic,
137 .set_state_oneshot = omap_32k_timer_shutdown,
138 .tick_resume = omap_32k_timer_shutdown,
140}; 139};
141 140
142static irqreturn_t omap_32k_timer_interrupt(int irq, void *dev_id) 141static irqreturn_t omap_32k_timer_interrupt(int irq, void *dev_id)
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index 4a023e8d1bdb..9e2a68456b81 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -178,26 +178,6 @@ config MACH_OMAP_LDP
178 default y 178 default y
179 select OMAP_PACKAGE_CBB 179 select OMAP_PACKAGE_CBB
180 180
181config MACH_OMAP3530_LV_SOM
182 bool "OMAP3 Logic 3530 LV SOM board"
183 depends on ARCH_OMAP3
184 default y
185 select OMAP_PACKAGE_CBB
186 help
187 Support for the LogicPD OMAP3530 SOM Development kit
188 for full description please see the products webpage at
189 http://www.logicpd.com/products/development-kits/texas-instruments-zoom%E2%84%A2-omap35x-development-kit
190
191config MACH_OMAP3_TORPEDO
192 bool "OMAP3 Logic 35x Torpedo board"
193 depends on ARCH_OMAP3
194 default y
195 select OMAP_PACKAGE_CBB
196 help
197 Support for the LogicPD OMAP35x Torpedo Development kit
198 for full description please see the products webpage at
199 http://www.logicpd.com/products/development-kits/zoom-omap35x-torpedo-development-kit
200
201config MACH_OMAP3517EVM 181config MACH_OMAP3517EVM
202 bool "OMAP3517/ AM3517 EVM board" 182 bool "OMAP3517/ AM3517 EVM board"
203 depends on ARCH_OMAP3 183 depends on ARCH_OMAP3
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 7892c7d3b6f4..8a7a6065ec21 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -235,9 +235,6 @@ obj-$(CONFIG_SOC_OMAP2420) += msdi.o
235# Specific board support 235# Specific board support
236obj-$(CONFIG_MACH_OMAP_GENERIC) += board-generic.o pdata-quirks.o 236obj-$(CONFIG_MACH_OMAP_GENERIC) += board-generic.o pdata-quirks.o
237obj-$(CONFIG_MACH_OMAP_LDP) += board-ldp.o 237obj-$(CONFIG_MACH_OMAP_LDP) += board-ldp.o
238obj-$(CONFIG_MACH_OMAP3530_LV_SOM) += board-omap3logic.o
239obj-$(CONFIG_MACH_OMAP3_TORPEDO) += board-omap3logic.o
240obj-$(CONFIG_MACH_OMAP3_PANDORA) += board-omap3pandora.o
241obj-$(CONFIG_MACH_NOKIA_N8X0) += board-n8x0.o 238obj-$(CONFIG_MACH_NOKIA_N8X0) += board-n8x0.o
242obj-$(CONFIG_MACH_NOKIA_RX51) += board-rx51.o sdram-nokia.o 239obj-$(CONFIG_MACH_NOKIA_RX51) += board-rx51.o sdram-nokia.o
243obj-$(CONFIG_MACH_NOKIA_RX51) += board-rx51-peripherals.o 240obj-$(CONFIG_MACH_NOKIA_RX51) += board-rx51-peripherals.o
diff --git a/arch/arm/mach-omap2/board-omap3logic.c b/arch/arm/mach-omap2/board-omap3logic.c
deleted file mode 100644
index 6049f60a8813..000000000000
--- a/arch/arm/mach-omap2/board-omap3logic.c
+++ /dev/null
@@ -1,249 +0,0 @@
1/*
2 * linux/arch/arm/mach-omap2/board-omap3logic.c
3 *
4 * Copyright (C) 2010 Li-Pro.Net
5 * Stephan Linz <linz@li-pro.net>
6 *
7 * Copyright (C) 2010-2012 Logic Product Development, Inc.
8 * Peter Barada <peter.barada@logicpd.com>
9 * Ashwin BIhari <ashwin.bihari@logicpd.com>
10 *
11 * Modified from Beagle, EVM, and RX51
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License version 2 as
15 * published by the Free Software Foundation.
16 */
17
18#include <linux/kernel.h>
19#include <linux/init.h>
20#include <linux/platform_device.h>
21#include <linux/delay.h>
22#include <linux/err.h>
23#include <linux/clk.h>
24#include <linux/io.h>
25#include <linux/gpio.h>
26
27#include <linux/regulator/fixed.h>
28#include <linux/regulator/machine.h>
29
30#include <linux/i2c/twl.h>
31#include <linux/mmc/host.h>
32#include <linux/usb/phy.h>
33
34#include <asm/mach-types.h>
35#include <asm/mach/arch.h>
36#include <asm/mach/map.h>
37
38#include "common.h"
39#include "mux.h"
40#include "hsmmc.h"
41#include "control.h"
42#include "common-board-devices.h"
43#include "gpmc.h"
44#include "gpmc-smsc911x.h"
45
46#define OMAP3LOGIC_SMSC911X_CS 1
47
48#define OMAP3530_LV_SOM_MMC_GPIO_CD 110
49#define OMAP3530_LV_SOM_MMC_GPIO_WP 126
50#define OMAP3530_LV_SOM_SMSC911X_GPIO_IRQ 152
51
52#define OMAP3_TORPEDO_MMC_GPIO_CD 127
53#define OMAP3_TORPEDO_SMSC911X_GPIO_IRQ 129
54
55static struct regulator_consumer_supply omap3logic_vmmc1_supply[] = {
56 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"),
57};
58
59/* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */
60static struct regulator_init_data omap3logic_vmmc1 = {
61 .constraints = {
62 .name = "VMMC1",
63 .min_uV = 1850000,
64 .max_uV = 3150000,
65 .valid_modes_mask = REGULATOR_MODE_NORMAL
66 | REGULATOR_MODE_STANDBY,
67 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
68 | REGULATOR_CHANGE_MODE
69 | REGULATOR_CHANGE_STATUS,
70 },
71 .num_consumer_supplies = ARRAY_SIZE(omap3logic_vmmc1_supply),
72 .consumer_supplies = omap3logic_vmmc1_supply,
73};
74
75static struct twl4030_gpio_platform_data omap3logic_gpio_data = {
76 .use_leds = true,
77 .pullups = BIT(1),
78 .pulldowns = BIT(2) | BIT(6) | BIT(7) | BIT(8)
79 | BIT(13) | BIT(15) | BIT(16) | BIT(17),
80};
81
82static struct twl4030_usb_data omap3logic_usb_data = {
83 .usb_mode = T2_USB_MODE_ULPI,
84};
85
86
87static struct twl4030_platform_data omap3logic_twldata = {
88 /* platform_data for children goes here */
89 .gpio = &omap3logic_gpio_data,
90 .vmmc1 = &omap3logic_vmmc1,
91 .usb = &omap3logic_usb_data,
92};
93
94static int __init omap3logic_i2c_init(void)
95{
96 omap3_pmic_init("twl4030", &omap3logic_twldata);
97 return 0;
98}
99
100static struct omap2_hsmmc_info __initdata board_mmc_info[] = {
101 {
102 .name = "external",
103 .mmc = 1,
104 .caps = MMC_CAP_4_BIT_DATA,
105 .gpio_cd = -EINVAL,
106 .gpio_wp = -EINVAL,
107 },
108 {} /* Terminator */
109};
110
111static void __init board_mmc_init(void)
112{
113 if (machine_is_omap3530_lv_som()) {
114 /* OMAP3530 LV SOM board */
115 board_mmc_info[0].gpio_cd = OMAP3530_LV_SOM_MMC_GPIO_CD;
116 board_mmc_info[0].gpio_wp = OMAP3530_LV_SOM_MMC_GPIO_WP;
117 omap_mux_init_signal("gpio_110", OMAP_PIN_OUTPUT);
118 omap_mux_init_signal("gpio_126", OMAP_PIN_OUTPUT);
119 } else if (machine_is_omap3_torpedo()) {
120 /* OMAP3 Torpedo board */
121 board_mmc_info[0].gpio_cd = OMAP3_TORPEDO_MMC_GPIO_CD;
122 omap_mux_init_signal("gpio_127", OMAP_PIN_OUTPUT);
123 } else {
124 /* unsupported board */
125 printk(KERN_ERR "%s(): unknown machine type\n", __func__);
126 return;
127 }
128
129 omap_hsmmc_init(board_mmc_info);
130}
131
132static struct omap_smsc911x_platform_data __initdata board_smsc911x_data = {
133 .cs = OMAP3LOGIC_SMSC911X_CS,
134 .gpio_irq = -EINVAL,
135 .gpio_reset = -EINVAL,
136};
137
138/* TODO/FIXME (comment by Peter Barada, LogicPD):
139 * Fix the PBIAS voltage for Torpedo MMC1 pins that
140 * are used for other needs (IRQs, etc). */
141static void omap3torpedo_fix_pbias_voltage(void)
142{
143 u16 control_pbias_offset = OMAP343X_CONTROL_PBIAS_LITE;
144 u32 reg;
145
146 if (machine_is_omap3_torpedo())
147 {
148 /* Set the bias for the pin */
149 reg = omap_ctrl_readl(control_pbias_offset);
150
151 reg &= ~OMAP343X_PBIASLITEPWRDNZ1;
152 omap_ctrl_writel(reg, control_pbias_offset);
153
154 /* 100ms delay required for PBIAS configuration */
155 msleep(100);
156
157 reg |= OMAP343X_PBIASLITEVMODE1;
158 reg |= OMAP343X_PBIASLITEPWRDNZ1;
159 omap_ctrl_writel(reg | 0x300, control_pbias_offset);
160 }
161}
162
163static inline void __init board_smsc911x_init(void)
164{
165 if (machine_is_omap3530_lv_som()) {
166 /* OMAP3530 LV SOM board */
167 board_smsc911x_data.gpio_irq =
168 OMAP3530_LV_SOM_SMSC911X_GPIO_IRQ;
169 omap_mux_init_signal("gpio_152", OMAP_PIN_INPUT);
170 } else if (machine_is_omap3_torpedo()) {
171 /* OMAP3 Torpedo board */
172 board_smsc911x_data.gpio_irq = OMAP3_TORPEDO_SMSC911X_GPIO_IRQ;
173 omap_mux_init_signal("gpio_129", OMAP_PIN_INPUT);
174 } else {
175 /* unsupported board */
176 printk(KERN_ERR "%s(): unknown machine type\n", __func__);
177 return;
178 }
179
180 gpmc_smsc911x_init(&board_smsc911x_data);
181}
182
183#ifdef CONFIG_OMAP_MUX
184static struct omap_board_mux board_mux[] __initdata = {
185 /* mUSB */
186 OMAP3_MUX(HSUSB0_CLK, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
187 OMAP3_MUX(HSUSB0_STP, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
188 OMAP3_MUX(HSUSB0_DIR, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
189 OMAP3_MUX(HSUSB0_NXT, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
190 OMAP3_MUX(HSUSB0_DATA0, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
191 OMAP3_MUX(HSUSB0_DATA1, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
192 OMAP3_MUX(HSUSB0_DATA2, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
193 OMAP3_MUX(HSUSB0_DATA3, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
194 OMAP3_MUX(HSUSB0_DATA4, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
195 OMAP3_MUX(HSUSB0_DATA5, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
196 OMAP3_MUX(HSUSB0_DATA6, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
197 OMAP3_MUX(HSUSB0_DATA7, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
198
199 { .reg_offset = OMAP_MUX_TERMINATOR },
200};
201#endif
202
203static struct regulator_consumer_supply dummy_supplies[] = {
204 REGULATOR_SUPPLY("vddvario", "smsc911x.0"),
205 REGULATOR_SUPPLY("vdd33a", "smsc911x.0"),
206};
207
208static void __init omap3logic_init(void)
209{
210 regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies));
211 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
212 omap3torpedo_fix_pbias_voltage();
213 omap3logic_i2c_init();
214 omap_serial_init();
215 omap_sdrc_init(NULL, NULL);
216 board_mmc_init();
217 board_smsc911x_init();
218
219 usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb");
220 usb_musb_init(NULL);
221
222 /* Ensure SDRC pins are mux'd for self-refresh */
223 omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
224 omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT);
225}
226
227MACHINE_START(OMAP3_TORPEDO, "Logic OMAP3 Torpedo board")
228 .atag_offset = 0x100,
229 .reserve = omap_reserve,
230 .map_io = omap3_map_io,
231 .init_early = omap35xx_init_early,
232 .init_irq = omap3_init_irq,
233 .init_machine = omap3logic_init,
234 .init_late = omap35xx_init_late,
235 .init_time = omap3_sync32k_timer_init,
236 .restart = omap3xxx_restart,
237MACHINE_END
238
239MACHINE_START(OMAP3530_LV_SOM, "OMAP Logic 3530 LV SOM board")
240 .atag_offset = 0x100,
241 .reserve = omap_reserve,
242 .map_io = omap3_map_io,
243 .init_early = omap35xx_init_early,
244 .init_irq = omap3_init_irq,
245 .init_machine = omap3logic_init,
246 .init_late = omap35xx_init_late,
247 .init_time = omap3_sync32k_timer_init,
248 .restart = omap3xxx_restart,
249MACHINE_END
diff --git a/arch/arm/mach-omap2/board-omap3pandora.c b/arch/arm/mach-omap2/board-omap3pandora.c
deleted file mode 100644
index 969e1003dd92..000000000000
--- a/arch/arm/mach-omap2/board-omap3pandora.c
+++ /dev/null
@@ -1,633 +0,0 @@
1/*
2 * board-omap3pandora.c (Pandora Handheld Console)
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
6 * version 2 as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
16 * 02110-1301 USA
17 *
18 */
19
20#include <linux/init.h>
21#include <linux/kernel.h>
22#include <linux/platform_device.h>
23
24#include <linux/spi/spi.h>
25#include <linux/regulator/machine.h>
26#include <linux/i2c/twl.h>
27#include <linux/omap-gpmc.h>
28#include <linux/wl12xx.h>
29#include <linux/mtd/partitions.h>
30#include <linux/mtd/nand.h>
31#include <linux/leds.h>
32#include <linux/input.h>
33#include <linux/input/matrix_keypad.h>
34#include <linux/gpio.h>
35#include <linux/gpio_keys.h>
36#include <linux/mmc/host.h>
37#include <linux/mmc/card.h>
38#include <linux/regulator/fixed.h>
39#include <linux/usb/phy.h>
40#include <linux/platform_data/spi-omap2-mcspi.h>
41
42#include <asm/mach-types.h>
43#include <asm/mach/arch.h>
44#include <asm/mach/map.h>
45
46#include "common.h"
47#include <video/omapdss.h>
48#include <video/omap-panel-data.h>
49#include <linux/platform_data/mtd-nand-omap2.h>
50
51#include "mux.h"
52#include "sdram-micron-mt46h32m32lf-6.h"
53#include "hsmmc.h"
54#include "common-board-devices.h"
55
56#define PANDORA_WIFI_IRQ_GPIO 21
57#define PANDORA_WIFI_NRESET_GPIO 23
58#define OMAP3_PANDORA_TS_GPIO 94
59
60static struct mtd_partition omap3pandora_nand_partitions[] = {
61 {
62 .name = "xloader",
63 .offset = 0,
64 .size = 4 * NAND_BLOCK_SIZE,
65 .mask_flags = MTD_WRITEABLE
66 }, {
67 .name = "uboot",
68 .offset = MTDPART_OFS_APPEND,
69 .size = 15 * NAND_BLOCK_SIZE,
70 }, {
71 .name = "uboot-env",
72 .offset = MTDPART_OFS_APPEND,
73 .size = 1 * NAND_BLOCK_SIZE,
74 }, {
75 .name = "boot",
76 .offset = MTDPART_OFS_APPEND,
77 .size = 80 * NAND_BLOCK_SIZE,
78 }, {
79 .name = "rootfs",
80 .offset = MTDPART_OFS_APPEND,
81 .size = MTDPART_SIZ_FULL,
82 },
83};
84
85static struct omap_nand_platform_data pandora_nand_data = {
86 .cs = 0,
87 .devsize = NAND_BUSWIDTH_16,
88 .xfer_type = NAND_OMAP_PREFETCH_DMA,
89 .parts = omap3pandora_nand_partitions,
90 .nr_parts = ARRAY_SIZE(omap3pandora_nand_partitions),
91};
92
93static struct gpio_led pandora_gpio_leds[] = {
94 {
95 .name = "pandora::sd1",
96 .default_trigger = "mmc0",
97 .gpio = 128,
98 }, {
99 .name = "pandora::sd2",
100 .default_trigger = "mmc1",
101 .gpio = 129,
102 }, {
103 .name = "pandora::bluetooth",
104 .gpio = 158,
105 }, {
106 .name = "pandora::wifi",
107 .gpio = 159,
108 },
109};
110
111static struct gpio_led_platform_data pandora_gpio_led_data = {
112 .leds = pandora_gpio_leds,
113 .num_leds = ARRAY_SIZE(pandora_gpio_leds),
114};
115
116static struct platform_device pandora_leds_gpio = {
117 .name = "leds-gpio",
118 .id = -1,
119 .dev = {
120 .platform_data = &pandora_gpio_led_data,
121 },
122};
123
124static struct platform_device pandora_backlight = {
125 .name = "pandora-backlight",
126 .id = -1,
127};
128
129#define GPIO_BUTTON(gpio_num, ev_type, ev_code, act_low, descr) \
130{ \
131 .gpio = gpio_num, \
132 .type = ev_type, \
133 .code = ev_code, \
134 .active_low = act_low, \
135 .debounce_interval = 4, \
136 .desc = "btn " descr, \
137}
138
139#define GPIO_BUTTON_LOW(gpio_num, event_code, description) \
140 GPIO_BUTTON(gpio_num, EV_KEY, event_code, 1, description)
141
142static struct gpio_keys_button pandora_gpio_keys[] = {
143 GPIO_BUTTON_LOW(110, KEY_UP, "up"),
144 GPIO_BUTTON_LOW(103, KEY_DOWN, "down"),
145 GPIO_BUTTON_LOW(96, KEY_LEFT, "left"),
146 GPIO_BUTTON_LOW(98, KEY_RIGHT, "right"),
147 GPIO_BUTTON_LOW(109, KEY_PAGEUP, "game 1"),
148 GPIO_BUTTON_LOW(111, KEY_END, "game 2"),
149 GPIO_BUTTON_LOW(106, KEY_PAGEDOWN, "game 3"),
150 GPIO_BUTTON_LOW(101, KEY_HOME, "game 4"),
151 GPIO_BUTTON_LOW(102, KEY_RIGHTSHIFT, "l"),
152 GPIO_BUTTON_LOW(97, KEY_KPPLUS, "l2"),
153 GPIO_BUTTON_LOW(105, KEY_RIGHTCTRL, "r"),
154 GPIO_BUTTON_LOW(107, KEY_KPMINUS, "r2"),
155 GPIO_BUTTON_LOW(104, KEY_LEFTCTRL, "ctrl"),
156 GPIO_BUTTON_LOW(99, KEY_MENU, "menu"),
157 GPIO_BUTTON_LOW(176, KEY_COFFEE, "hold"),
158 GPIO_BUTTON(100, EV_KEY, KEY_LEFTALT, 0, "alt"),
159 GPIO_BUTTON(108, EV_SW, SW_LID, 1, "lid"),
160};
161
162static struct gpio_keys_platform_data pandora_gpio_key_info = {
163 .buttons = pandora_gpio_keys,
164 .nbuttons = ARRAY_SIZE(pandora_gpio_keys),
165};
166
167static struct platform_device pandora_keys_gpio = {
168 .name = "gpio-keys",
169 .id = -1,
170 .dev = {
171 .platform_data = &pandora_gpio_key_info,
172 },
173};
174
175static const uint32_t board_keymap[] = {
176 /* row, col, code */
177 KEY(0, 0, KEY_9),
178 KEY(0, 1, KEY_8),
179 KEY(0, 2, KEY_I),
180 KEY(0, 3, KEY_J),
181 KEY(0, 4, KEY_N),
182 KEY(0, 5, KEY_M),
183 KEY(1, 0, KEY_0),
184 KEY(1, 1, KEY_7),
185 KEY(1, 2, KEY_U),
186 KEY(1, 3, KEY_H),
187 KEY(1, 4, KEY_B),
188 KEY(1, 5, KEY_SPACE),
189 KEY(2, 0, KEY_BACKSPACE),
190 KEY(2, 1, KEY_6),
191 KEY(2, 2, KEY_Y),
192 KEY(2, 3, KEY_G),
193 KEY(2, 4, KEY_V),
194 KEY(2, 5, KEY_FN),
195 KEY(3, 0, KEY_O),
196 KEY(3, 1, KEY_5),
197 KEY(3, 2, KEY_T),
198 KEY(3, 3, KEY_F),
199 KEY(3, 4, KEY_C),
200 KEY(4, 0, KEY_P),
201 KEY(4, 1, KEY_4),
202 KEY(4, 2, KEY_R),
203 KEY(4, 3, KEY_D),
204 KEY(4, 4, KEY_X),
205 KEY(5, 0, KEY_K),
206 KEY(5, 1, KEY_3),
207 KEY(5, 2, KEY_E),
208 KEY(5, 3, KEY_S),
209 KEY(5, 4, KEY_Z),
210 KEY(6, 0, KEY_L),
211 KEY(6, 1, KEY_2),
212 KEY(6, 2, KEY_W),
213 KEY(6, 3, KEY_A),
214 KEY(6, 4, KEY_DOT),
215 KEY(7, 0, KEY_ENTER),
216 KEY(7, 1, KEY_1),
217 KEY(7, 2, KEY_Q),
218 KEY(7, 3, KEY_LEFTSHIFT),
219 KEY(7, 4, KEY_COMMA),
220};
221
222static struct matrix_keymap_data board_map_data = {
223 .keymap = board_keymap,
224 .keymap_size = ARRAY_SIZE(board_keymap),
225};
226
227static struct twl4030_keypad_data pandora_kp_data = {
228 .keymap_data = &board_map_data,
229 .rows = 8,
230 .cols = 6,
231 .rep = 1,
232};
233
234static struct connector_atv_platform_data pandora_tv_pdata = {
235 .name = "tv",
236 .source = "venc.0",
237 .connector_type = OMAP_DSS_VENC_TYPE_SVIDEO,
238 .invert_polarity = false,
239};
240
241static struct platform_device pandora_tv_connector_device = {
242 .name = "connector-analog-tv",
243 .id = 0,
244 .dev.platform_data = &pandora_tv_pdata,
245};
246
247static struct omap_dss_board_info pandora_dss_data = {
248 .default_display_name = "lcd",
249};
250
251static void pandora_wl1251_init_card(struct mmc_card *card)
252{
253 /*
254 * We have TI wl1251 attached to MMC3. Pass this information to
255 * SDIO core because it can't be probed by normal methods.
256 */
257 if (card->type == MMC_TYPE_SDIO || card->type == MMC_TYPE_SD_COMBO) {
258 card->quirks |= MMC_QUIRK_NONSTD_SDIO;
259 card->cccr.wide_bus = 1;
260 card->cis.vendor = 0x104c;
261 card->cis.device = 0x9066;
262 card->cis.blksize = 512;
263 card->cis.max_dtr = 20000000;
264 }
265}
266
267static struct omap2_hsmmc_info omap3pandora_mmc[] = {
268 {
269 .mmc = 1,
270 .caps = MMC_CAP_4_BIT_DATA,
271 .gpio_cd = -EINVAL,
272 .gpio_wp = 126,
273 .ext_clock = 0,
274 .deferred = true,
275 },
276 {
277 .mmc = 2,
278 .caps = MMC_CAP_4_BIT_DATA,
279 .gpio_cd = -EINVAL,
280 .gpio_wp = 127,
281 .ext_clock = 1,
282 .transceiver = true,
283 .deferred = true,
284 },
285 {
286 .mmc = 3,
287 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_POWER_OFF_CARD,
288 .gpio_cd = -EINVAL,
289 .gpio_wp = -EINVAL,
290 .init_card = pandora_wl1251_init_card,
291 },
292 {} /* Terminator */
293};
294
295static int omap3pandora_twl_gpio_setup(struct device *dev,
296 unsigned gpio, unsigned ngpio)
297{
298 int ret, gpio_32khz;
299
300 /* gpio + {0,1} is "mmc{0,1}_cd" (input/IRQ) */
301 omap3pandora_mmc[0].gpio_cd = gpio + 0;
302 omap3pandora_mmc[1].gpio_cd = gpio + 1;
303 omap_hsmmc_late_init(omap3pandora_mmc);
304
305 /* gpio + 13 drives 32kHz buffer for wifi module */
306 gpio_32khz = gpio + 13;
307 ret = gpio_request_one(gpio_32khz, GPIOF_OUT_INIT_HIGH, "wifi 32kHz");
308 if (ret < 0) {
309 pr_err("Cannot get GPIO line %d, ret=%d\n", gpio_32khz, ret);
310 return -ENODEV;
311 }
312
313 return 0;
314}
315
316static struct twl4030_gpio_platform_data omap3pandora_gpio_data = {
317 .setup = omap3pandora_twl_gpio_setup,
318};
319
320static struct regulator_consumer_supply pandora_vmmc1_supply[] = {
321 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"),
322};
323
324static struct regulator_consumer_supply pandora_vmmc2_supply[] = {
325 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1")
326};
327
328static struct regulator_consumer_supply pandora_vmmc3_supply[] = {
329 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.2"),
330};
331
332static struct regulator_consumer_supply pandora_vdds_supplies[] = {
333 REGULATOR_SUPPLY("vdds_sdi", "omapdss"),
334 REGULATOR_SUPPLY("vdds_dsi", "omapdss"),
335 REGULATOR_SUPPLY("vdds_dsi", "omapdss_dpi.0"),
336 REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi.0"),
337};
338
339static struct regulator_consumer_supply pandora_vcc_lcd_supply[] = {
340 REGULATOR_SUPPLY("vcc", "spi1.1"),
341};
342
343static struct regulator_consumer_supply pandora_usb_phy_supply[] = {
344 REGULATOR_SUPPLY("vcc", "usb_phy_gen_xceiv.2"), /* hsusb port 2 */
345};
346
347/* ads7846 on SPI and 2 nub controllers on I2C */
348static struct regulator_consumer_supply pandora_vaux4_supplies[] = {
349 REGULATOR_SUPPLY("vcc", "spi1.0"),
350 REGULATOR_SUPPLY("vcc", "3-0066"),
351 REGULATOR_SUPPLY("vcc", "3-0067"),
352};
353
354static struct regulator_consumer_supply pandora_adac_supply[] = {
355 REGULATOR_SUPPLY("vcc", "soc-audio"),
356};
357
358/* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */
359static struct regulator_init_data pandora_vmmc1 = {
360 .constraints = {
361 .min_uV = 1850000,
362 .max_uV = 3150000,
363 .valid_modes_mask = REGULATOR_MODE_NORMAL
364 | REGULATOR_MODE_STANDBY,
365 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
366 | REGULATOR_CHANGE_MODE
367 | REGULATOR_CHANGE_STATUS,
368 },
369 .num_consumer_supplies = ARRAY_SIZE(pandora_vmmc1_supply),
370 .consumer_supplies = pandora_vmmc1_supply,
371};
372
373/* VMMC2 for MMC2 pins CMD, CLK, DAT0..DAT3 (max 100 mA) */
374static struct regulator_init_data pandora_vmmc2 = {
375 .constraints = {
376 .min_uV = 1850000,
377 .max_uV = 3150000,
378 .valid_modes_mask = REGULATOR_MODE_NORMAL
379 | REGULATOR_MODE_STANDBY,
380 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
381 | REGULATOR_CHANGE_MODE
382 | REGULATOR_CHANGE_STATUS,
383 },
384 .num_consumer_supplies = ARRAY_SIZE(pandora_vmmc2_supply),
385 .consumer_supplies = pandora_vmmc2_supply,
386};
387
388/* VAUX1 for LCD */
389static struct regulator_init_data pandora_vaux1 = {
390 .constraints = {
391 .min_uV = 3000000,
392 .max_uV = 3000000,
393 .apply_uV = true,
394 .valid_modes_mask = REGULATOR_MODE_NORMAL
395 | REGULATOR_MODE_STANDBY,
396 .valid_ops_mask = REGULATOR_CHANGE_MODE
397 | REGULATOR_CHANGE_STATUS,
398 },
399 .num_consumer_supplies = ARRAY_SIZE(pandora_vcc_lcd_supply),
400 .consumer_supplies = pandora_vcc_lcd_supply,
401};
402
403/* VAUX2 for USB host PHY */
404static struct regulator_init_data pandora_vaux2 = {
405 .constraints = {
406 .min_uV = 1800000,
407 .max_uV = 1800000,
408 .apply_uV = true,
409 .valid_modes_mask = REGULATOR_MODE_NORMAL
410 | REGULATOR_MODE_STANDBY,
411 .valid_ops_mask = REGULATOR_CHANGE_MODE
412 | REGULATOR_CHANGE_STATUS,
413 },
414 .num_consumer_supplies = ARRAY_SIZE(pandora_usb_phy_supply),
415 .consumer_supplies = pandora_usb_phy_supply,
416};
417
418/* VAUX4 for ads7846 and nubs */
419static struct regulator_init_data pandora_vaux4 = {
420 .constraints = {
421 .min_uV = 2800000,
422 .max_uV = 2800000,
423 .apply_uV = true,
424 .valid_modes_mask = REGULATOR_MODE_NORMAL
425 | REGULATOR_MODE_STANDBY,
426 .valid_ops_mask = REGULATOR_CHANGE_MODE
427 | REGULATOR_CHANGE_STATUS,
428 },
429 .num_consumer_supplies = ARRAY_SIZE(pandora_vaux4_supplies),
430 .consumer_supplies = pandora_vaux4_supplies,
431};
432
433/* VSIM for audio DAC */
434static struct regulator_init_data pandora_vsim = {
435 .constraints = {
436 .min_uV = 2800000,
437 .max_uV = 2800000,
438 .apply_uV = true,
439 .valid_modes_mask = REGULATOR_MODE_NORMAL
440 | REGULATOR_MODE_STANDBY,
441 .valid_ops_mask = REGULATOR_CHANGE_MODE
442 | REGULATOR_CHANGE_STATUS,
443 },
444 .num_consumer_supplies = ARRAY_SIZE(pandora_adac_supply),
445 .consumer_supplies = pandora_adac_supply,
446};
447
448/* Fixed regulator internal to Wifi module */
449static struct regulator_init_data pandora_vmmc3 = {
450 .constraints = {
451 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
452 },
453 .num_consumer_supplies = ARRAY_SIZE(pandora_vmmc3_supply),
454 .consumer_supplies = pandora_vmmc3_supply,
455};
456
457static struct fixed_voltage_config pandora_vwlan = {
458 .supply_name = "vwlan",
459 .microvolts = 1800000, /* 1.8V */
460 .gpio = PANDORA_WIFI_NRESET_GPIO,
461 .startup_delay = 50000, /* 50ms */
462 .enable_high = 1,
463 .enabled_at_boot = 0,
464 .init_data = &pandora_vmmc3,
465};
466
467static struct platform_device pandora_vwlan_device = {
468 .name = "reg-fixed-voltage",
469 .id = 1,
470 .dev = {
471 .platform_data = &pandora_vwlan,
472 },
473};
474
475static struct twl4030_bci_platform_data pandora_bci_data;
476
477static struct twl4030_power_data pandora_power_data = {
478 .use_poweroff = true,
479};
480
481static struct twl4030_platform_data omap3pandora_twldata = {
482 .gpio = &omap3pandora_gpio_data,
483 .vmmc1 = &pandora_vmmc1,
484 .vmmc2 = &pandora_vmmc2,
485 .vaux1 = &pandora_vaux1,
486 .vaux2 = &pandora_vaux2,
487 .vaux4 = &pandora_vaux4,
488 .vsim = &pandora_vsim,
489 .keypad = &pandora_kp_data,
490 .bci = &pandora_bci_data,
491 .power = &pandora_power_data,
492};
493
494static struct i2c_board_info __initdata omap3pandora_i2c3_boardinfo[] = {
495 {
496 I2C_BOARD_INFO("bq27500", 0x55),
497 .flags = I2C_CLIENT_WAKE,
498 },
499};
500
501static int __init omap3pandora_i2c_init(void)
502{
503 omap3_pmic_get_config(&omap3pandora_twldata,
504 TWL_COMMON_PDATA_USB | TWL_COMMON_PDATA_AUDIO,
505 TWL_COMMON_REGULATOR_VDAC | TWL_COMMON_REGULATOR_VPLL2);
506
507 omap3pandora_twldata.vdac->constraints.apply_uV = true;
508
509 omap3pandora_twldata.vpll2->constraints.apply_uV = true;
510 omap3pandora_twldata.vpll2->num_consumer_supplies =
511 ARRAY_SIZE(pandora_vdds_supplies);
512 omap3pandora_twldata.vpll2->consumer_supplies = pandora_vdds_supplies;
513
514 omap3_pmic_init("tps65950", &omap3pandora_twldata);
515 /* i2c2 pins are not connected */
516 omap_register_i2c_bus(3, 100, omap3pandora_i2c3_boardinfo,
517 ARRAY_SIZE(omap3pandora_i2c3_boardinfo));
518 return 0;
519}
520
521static struct panel_tpo_td043mtea1_platform_data pandora_lcd_pdata = {
522 .name = "lcd",
523 .source = "dpi.0",
524
525 .data_lines = 24,
526 .nreset_gpio = 157,
527};
528
529static struct spi_board_info omap3pandora_spi_board_info[] __initdata = {
530 {
531 .modalias = "panel-tpo-td043mtea1",
532 .bus_num = 1,
533 .chip_select = 1,
534 .max_speed_hz = 375000,
535 .platform_data = &pandora_lcd_pdata,
536 }
537};
538
539static void __init pandora_wl1251_init(void)
540{
541 struct wl1251_platform_data pandora_wl1251_pdata;
542 int ret;
543
544 memset(&pandora_wl1251_pdata, 0, sizeof(pandora_wl1251_pdata));
545
546 pandora_wl1251_pdata.power_gpio = -1;
547
548 ret = gpio_request_one(PANDORA_WIFI_IRQ_GPIO, GPIOF_IN, "wl1251 irq");
549 if (ret < 0)
550 goto fail;
551
552 pandora_wl1251_pdata.irq = gpio_to_irq(PANDORA_WIFI_IRQ_GPIO);
553 if (pandora_wl1251_pdata.irq < 0)
554 goto fail_irq;
555
556 pandora_wl1251_pdata.use_eeprom = true;
557 ret = wl1251_set_platform_data(&pandora_wl1251_pdata);
558 if (ret < 0)
559 goto fail_irq;
560
561 return;
562
563fail_irq:
564 gpio_free(PANDORA_WIFI_IRQ_GPIO);
565fail:
566 printk(KERN_ERR "wl1251 board initialisation failed\n");
567}
568
569static struct usbhs_phy_data phy_data[] __initdata = {
570 {
571 .port = 2,
572 .reset_gpio = 16,
573 .vcc_gpio = -EINVAL,
574 },
575};
576
577static struct platform_device *omap3pandora_devices[] __initdata = {
578 &pandora_leds_gpio,
579 &pandora_keys_gpio,
580 &pandora_vwlan_device,
581 &pandora_backlight,
582 &pandora_tv_connector_device,
583};
584
585static struct usbhs_omap_platform_data usbhs_bdata __initdata = {
586 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
587};
588
589#ifdef CONFIG_OMAP_MUX
590static struct omap_board_mux board_mux[] __initdata = {
591 { .reg_offset = OMAP_MUX_TERMINATOR },
592};
593#endif
594
595static void __init omap3pandora_init(void)
596{
597 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
598 omap_hsmmc_init(omap3pandora_mmc);
599 omap3pandora_i2c_init();
600 pandora_wl1251_init();
601 platform_add_devices(omap3pandora_devices,
602 ARRAY_SIZE(omap3pandora_devices));
603 omap_display_init(&pandora_dss_data);
604 omap_serial_init();
605 omap_sdrc_init(mt46h32m32lf6_sdrc_params,
606 mt46h32m32lf6_sdrc_params);
607 spi_register_board_info(omap3pandora_spi_board_info,
608 ARRAY_SIZE(omap3pandora_spi_board_info));
609 omap_ads7846_init(1, OMAP3_PANDORA_TS_GPIO, 0, NULL);
610
611 usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data));
612 usbhs_init(&usbhs_bdata);
613
614 usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb");
615 usb_musb_init(NULL);
616 gpmc_nand_init(&pandora_nand_data, NULL);
617
618 /* Ensure SDRC pins are mux'd for self-refresh */
619 omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
620 omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT);
621}
622
623MACHINE_START(OMAP3_PANDORA, "Pandora Handheld Console")
624 .atag_offset = 0x100,
625 .reserve = omap_reserve,
626 .map_io = omap3_map_io,
627 .init_early = omap35xx_init_early,
628 .init_irq = omap3_init_irq,
629 .init_machine = omap3pandora_init,
630 .init_late = omap35xx_init_late,
631 .init_time = omap3_sync32k_timer_init,
632 .restart = omap3xxx_restart,
633MACHINE_END
diff --git a/arch/arm/mach-omap2/prm_common.c b/arch/arm/mach-omap2/prm_common.c
index 7add7994dbfc..f62f8326aa5f 100644
--- a/arch/arm/mach-omap2/prm_common.c
+++ b/arch/arm/mach-omap2/prm_common.c
@@ -705,7 +705,7 @@ static struct omap_prcm_init_data scrm_data __initdata = {
705}; 705};
706#endif 706#endif
707 707
708static const struct of_device_id omap_prcm_dt_match_table[] __initconst = { 708static const struct of_device_id const omap_prcm_dt_match_table[] __initconst = {
709#ifdef CONFIG_SOC_AM33XX 709#ifdef CONFIG_SOC_AM33XX
710 { .compatible = "ti,am3-prcm", .data = &am3_prm_data }, 710 { .compatible = "ti,am3-prcm", .data = &am3_prm_data },
711#endif 711#endif
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
index cac46d852da1..16b37e7196f5 100644
--- a/arch/arm/mach-omap2/timer.c
+++ b/arch/arm/mach-omap2/timer.c
@@ -102,38 +102,38 @@ static int omap2_gp_timer_set_next_event(unsigned long cycles,
102 return 0; 102 return 0;
103} 103}
104 104
105static void omap2_gp_timer_set_mode(enum clock_event_mode mode, 105static int omap2_gp_timer_shutdown(struct clock_event_device *evt)
106 struct clock_event_device *evt) 106{
107 __omap_dm_timer_stop(&clkev, OMAP_TIMER_POSTED, clkev.rate);
108 return 0;
109}
110
111static int omap2_gp_timer_set_periodic(struct clock_event_device *evt)
107{ 112{
108 u32 period; 113 u32 period;
109 114
110 __omap_dm_timer_stop(&clkev, OMAP_TIMER_POSTED, clkev.rate); 115 __omap_dm_timer_stop(&clkev, OMAP_TIMER_POSTED, clkev.rate);
111 116
112 switch (mode) { 117 period = clkev.rate / HZ;
113 case CLOCK_EVT_MODE_PERIODIC: 118 period -= 1;
114 period = clkev.rate / HZ; 119 /* Looks like we need to first set the load value separately */
115 period -= 1; 120 __omap_dm_timer_write(&clkev, OMAP_TIMER_LOAD_REG, 0xffffffff - period,
116 /* Looks like we need to first set the load value separately */ 121 OMAP_TIMER_POSTED);
117 __omap_dm_timer_write(&clkev, OMAP_TIMER_LOAD_REG, 122 __omap_dm_timer_load_start(&clkev,
118 0xffffffff - period, OMAP_TIMER_POSTED); 123 OMAP_TIMER_CTRL_AR | OMAP_TIMER_CTRL_ST,
119 __omap_dm_timer_load_start(&clkev, 124 0xffffffff - period, OMAP_TIMER_POSTED);
120 OMAP_TIMER_CTRL_AR | OMAP_TIMER_CTRL_ST, 125 return 0;
121 0xffffffff - period, OMAP_TIMER_POSTED);
122 break;
123 case CLOCK_EVT_MODE_ONESHOT:
124 break;
125 case CLOCK_EVT_MODE_UNUSED:
126 case CLOCK_EVT_MODE_SHUTDOWN:
127 case CLOCK_EVT_MODE_RESUME:
128 break;
129 }
130} 126}
131 127
132static struct clock_event_device clockevent_gpt = { 128static struct clock_event_device clockevent_gpt = {
133 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, 129 .features = CLOCK_EVT_FEAT_PERIODIC |
134 .rating = 300, 130 CLOCK_EVT_FEAT_ONESHOT,
135 .set_next_event = omap2_gp_timer_set_next_event, 131 .rating = 300,
136 .set_mode = omap2_gp_timer_set_mode, 132 .set_next_event = omap2_gp_timer_set_next_event,
133 .set_state_shutdown = omap2_gp_timer_shutdown,
134 .set_state_periodic = omap2_gp_timer_set_periodic,
135 .set_state_oneshot = omap2_gp_timer_shutdown,
136 .tick_resume = omap2_gp_timer_shutdown,
137}; 137};
138 138
139static struct property device_disabled = { 139static struct property device_disabled = {
diff --git a/arch/arm/mach-omap2/vc.c b/arch/arm/mach-omap2/vc.c
index 076fd20d7e5a..e5a35f6b83a7 100644
--- a/arch/arm/mach-omap2/vc.c
+++ b/arch/arm/mach-omap2/vc.c
@@ -563,7 +563,7 @@ struct i2c_init_data {
563 u8 hsscll_12; 563 u8 hsscll_12;
564}; 564};
565 565
566static const __initdata struct i2c_init_data omap4_i2c_timing_data[] = { 566static const struct i2c_init_data const omap4_i2c_timing_data[] __initconst = {
567 { 567 {
568 .load = 50, 568 .load = 50,
569 .loadbits = 0x3, 569 .loadbits = 0x3,
diff --git a/arch/arm/mach-omap2/voltagedomains3xxx_data.c b/arch/arm/mach-omap2/voltagedomains3xxx_data.c
index 261bb7cb4e60..307676d8c53c 100644
--- a/arch/arm/mach-omap2/voltagedomains3xxx_data.c
+++ b/arch/arm/mach-omap2/voltagedomains3xxx_data.c
@@ -95,7 +95,7 @@ static struct voltagedomain *voltagedomains_am35xx[] __initdata = {
95}; 95};
96 96
97 97
98static const char *sys_clk_name __initdata = "sys_ck"; 98static const char *const sys_clk_name __initconst = "sys_ck";
99 99
100void __init omap3xxx_voltagedomains_init(void) 100void __init omap3xxx_voltagedomains_init(void)
101{ 101{
diff --git a/arch/arm/mach-omap2/voltagedomains44xx_data.c b/arch/arm/mach-omap2/voltagedomains44xx_data.c
index 48b22a0a0c88..9b1f245b57d6 100644
--- a/arch/arm/mach-omap2/voltagedomains44xx_data.c
+++ b/arch/arm/mach-omap2/voltagedomains44xx_data.c
@@ -92,7 +92,7 @@ static struct voltagedomain *voltagedomains_omap4[] __initdata = {
92 NULL, 92 NULL,
93}; 93};
94 94
95static const char *sys_clk_name __initdata = "sys_clkin_ck"; 95static const char *const sys_clk_name __initconst = "sys_clkin_ck";
96 96
97void __init omap44xx_voltagedomains_init(void) 97void __init omap44xx_voltagedomains_init(void)
98{ 98{
diff --git a/arch/arm/mach-omap2/voltagedomains54xx_data.c b/arch/arm/mach-omap2/voltagedomains54xx_data.c
index 33d22b87252d..af5ff6496441 100644
--- a/arch/arm/mach-omap2/voltagedomains54xx_data.c
+++ b/arch/arm/mach-omap2/voltagedomains54xx_data.c
@@ -78,7 +78,7 @@ static struct voltagedomain *voltagedomains_omap5[] __initdata = {
78 NULL, 78 NULL,
79}; 79};
80 80
81static const char *sys_clk_name __initdata = "sys_clkin"; 81static const char *const sys_clk_name __initconst = "sys_clkin";
82 82
83void __init omap54xx_voltagedomains_init(void) 83void __init omap54xx_voltagedomains_init(void)
84{ 84{
diff --git a/arch/arm/mach-orion5x/dns323-setup.c b/arch/arm/mach-orion5x/dns323-setup.c
index 09d2a26985da..f267e58a8283 100644
--- a/arch/arm/mach-orion5x/dns323-setup.c
+++ b/arch/arm/mach-orion5x/dns323-setup.c
@@ -236,9 +236,7 @@ static int __init dns323_read_mac_addr(void)
236 } 236 }
237 237
238 iounmap(mac_page); 238 iounmap(mac_page);
239 printk("DNS-323: Found ethernet MAC address: "); 239 printk("DNS-323: Found ethernet MAC address: %pM\n", addr);
240 for (i = 0; i < 6; i++)
241 printk("%.2x%s", addr[i], (i < 5) ? ":" : ".\n");
242 240
243 memcpy(dns323_eth_data.mac_addr, addr, 6); 241 memcpy(dns323_eth_data.mac_addr, addr, 6);
244 242
diff --git a/arch/arm/mach-orion5x/tsx09-common.c b/arch/arm/mach-orion5x/tsx09-common.c
index 7189827d641d..24b2959719fa 100644
--- a/arch/arm/mach-orion5x/tsx09-common.c
+++ b/arch/arm/mach-orion5x/tsx09-common.c
@@ -101,9 +101,7 @@ static int __init qnap_tsx09_check_mac_addr(const char *addr_str)
101 addr[i] = byte; 101 addr[i] = byte;
102 } 102 }
103 103
104 printk(KERN_INFO "tsx09: found ethernet mac address "); 104 printk(KERN_INFO "tsx09: found ethernet mac address %pM\n", addr);
105 for (i = 0; i < 6; i++)
106 printk("%.2x%s", addr[i], (i < 5) ? ":" : ".\n");
107 105
108 memcpy(qnap_tsx09_eth_data.mac_addr, addr, 6); 106 memcpy(qnap_tsx09_eth_data.mac_addr, addr, 6);
109 107
diff --git a/arch/arm/mach-pxa/balloon3.c b/arch/arm/mach-pxa/balloon3.c
index d897292712eb..70366b35d299 100644
--- a/arch/arm/mach-pxa/balloon3.c
+++ b/arch/arm/mach-pxa/balloon3.c
@@ -496,18 +496,18 @@ static struct irq_chip balloon3_irq_chip = {
496 .irq_unmask = balloon3_unmask_irq, 496 .irq_unmask = balloon3_unmask_irq,
497}; 497};
498 498
499static void balloon3_irq_handler(unsigned int irq, struct irq_desc *desc) 499static void balloon3_irq_handler(unsigned int __irq, struct irq_desc *desc)
500{ 500{
501 unsigned long pending = __raw_readl(BALLOON3_INT_CONTROL_REG) & 501 unsigned long pending = __raw_readl(BALLOON3_INT_CONTROL_REG) &
502 balloon3_irq_enabled; 502 balloon3_irq_enabled;
503 do { 503 do {
504 /* clear useless edge notification */ 504 struct irq_data *d = irq_desc_get_irq_data(desc);
505 if (desc->irq_data.chip->irq_ack) { 505 struct irq_chip *chip = irq_data_get_chip(d);
506 struct irq_data *d; 506 unsigned int irq;
507 507
508 d = irq_get_irq_data(BALLOON3_AUX_NIRQ); 508 /* clear useless edge notification */
509 desc->irq_data.chip->irq_ack(d); 509 if (chip->irq_ack)
510 } 510 chip->irq_ack(d);
511 511
512 while (pending) { 512 while (pending) {
513 irq = BALLOON3_IRQ(0) + __ffs(pending); 513 irq = BALLOON3_IRQ(0) + __ffs(pending);
@@ -528,7 +528,7 @@ static void __init balloon3_init_irq(void)
528 for (irq = BALLOON3_IRQ(0); irq <= BALLOON3_IRQ(7); irq++) { 528 for (irq = BALLOON3_IRQ(0); irq <= BALLOON3_IRQ(7); irq++) {
529 irq_set_chip_and_handler(irq, &balloon3_irq_chip, 529 irq_set_chip_and_handler(irq, &balloon3_irq_chip,
530 handle_level_irq); 530 handle_level_irq);
531 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); 531 irq_clear_status_flags(irq, IRQ_NOREQUEST | IRQ_NOPROBE);
532 } 532 }
533 533
534 irq_set_chained_handler(BALLOON3_AUX_NIRQ, balloon3_irq_handler); 534 irq_set_chained_handler(BALLOON3_AUX_NIRQ, balloon3_irq_handler);
diff --git a/arch/arm/mach-pxa/cm-x2xx-pci.c b/arch/arm/mach-pxa/cm-x2xx-pci.c
index d8f816c24a2f..1fa79f1f832d 100644
--- a/arch/arm/mach-pxa/cm-x2xx-pci.c
+++ b/arch/arm/mach-pxa/cm-x2xx-pci.c
@@ -29,8 +29,9 @@
29void __iomem *it8152_base_address; 29void __iomem *it8152_base_address;
30static int cmx2xx_it8152_irq_gpio; 30static int cmx2xx_it8152_irq_gpio;
31 31
32static void cmx2xx_it8152_irq_demux(unsigned int irq, struct irq_desc *desc) 32static void cmx2xx_it8152_irq_demux(unsigned int __irq, struct irq_desc *desc)
33{ 33{
34 unsigned int irq = irq_desc_get_irq(desc);
34 /* clear our parent irq */ 35 /* clear our parent irq */
35 desc->irq_data.chip->irq_ack(&desc->irq_data); 36 desc->irq_data.chip->irq_ack(&desc->irq_data);
36 37
diff --git a/arch/arm/mach-pxa/irq.c b/arch/arm/mach-pxa/irq.c
index 98608c5575cb..9c10248fadcc 100644
--- a/arch/arm/mach-pxa/irq.c
+++ b/arch/arm/mach-pxa/irq.c
@@ -133,7 +133,6 @@ static int pxa_irq_map(struct irq_domain *h, unsigned int virq,
133 irq_set_chip_and_handler(virq, &pxa_internal_irq_chip, 133 irq_set_chip_and_handler(virq, &pxa_internal_irq_chip,
134 handle_level_irq); 134 handle_level_irq);
135 irq_set_chip_data(virq, base); 135 irq_set_chip_data(virq, base);
136 set_irq_flags(virq, IRQF_VALID);
137 136
138 return 0; 137 return 0;
139} 138}
diff --git a/arch/arm/mach-pxa/lpd270.c b/arch/arm/mach-pxa/lpd270.c
index eaee2c20b189..b070167deef2 100644
--- a/arch/arm/mach-pxa/lpd270.c
+++ b/arch/arm/mach-pxa/lpd270.c
@@ -120,8 +120,9 @@ static struct irq_chip lpd270_irq_chip = {
120 .irq_unmask = lpd270_unmask_irq, 120 .irq_unmask = lpd270_unmask_irq,
121}; 121};
122 122
123static void lpd270_irq_handler(unsigned int irq, struct irq_desc *desc) 123static void lpd270_irq_handler(unsigned int __irq, struct irq_desc *desc)
124{ 124{
125 unsigned int irq;
125 unsigned long pending; 126 unsigned long pending;
126 127
127 pending = __raw_readw(LPD270_INT_STATUS) & lpd270_irq_enabled; 128 pending = __raw_readw(LPD270_INT_STATUS) & lpd270_irq_enabled;
@@ -151,7 +152,7 @@ static void __init lpd270_init_irq(void)
151 for (irq = LPD270_IRQ(2); irq <= LPD270_IRQ(4); irq++) { 152 for (irq = LPD270_IRQ(2); irq <= LPD270_IRQ(4); irq++) {
152 irq_set_chip_and_handler(irq, &lpd270_irq_chip, 153 irq_set_chip_and_handler(irq, &lpd270_irq_chip,
153 handle_level_irq); 154 handle_level_irq);
154 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); 155 irq_clear_status_flags(irq, IRQ_NOREQUEST | IRQ_NOPROBE);
155 } 156 }
156 irq_set_chained_handler(PXA_GPIO_TO_IRQ(0), lpd270_irq_handler); 157 irq_set_chained_handler(PXA_GPIO_TO_IRQ(0), lpd270_irq_handler);
157 irq_set_irq_type(PXA_GPIO_TO_IRQ(0), IRQ_TYPE_EDGE_FALLING); 158 irq_set_irq_type(PXA_GPIO_TO_IRQ(0), IRQ_TYPE_EDGE_FALLING);
diff --git a/arch/arm/mach-pxa/pcm990-baseboard.c b/arch/arm/mach-pxa/pcm990-baseboard.c
index 2897da2a5df6..9a0c8affdadb 100644
--- a/arch/arm/mach-pxa/pcm990-baseboard.c
+++ b/arch/arm/mach-pxa/pcm990-baseboard.c
@@ -284,8 +284,9 @@ static struct irq_chip pcm990_irq_chip = {
284 .irq_unmask = pcm990_unmask_irq, 284 .irq_unmask = pcm990_unmask_irq,
285}; 285};
286 286
287static void pcm990_irq_handler(unsigned int irq, struct irq_desc *desc) 287static void pcm990_irq_handler(unsigned int __irq, struct irq_desc *desc)
288{ 288{
289 unsigned int irq;
289 unsigned long pending; 290 unsigned long pending;
290 291
291 pending = ~pcm990_cpld_readb(PCM990_CTRL_INTSETCLR); 292 pending = ~pcm990_cpld_readb(PCM990_CTRL_INTSETCLR);
@@ -311,7 +312,7 @@ static void __init pcm990_init_irq(void)
311 for (irq = PCM027_IRQ(0); irq <= PCM027_IRQ(3); irq++) { 312 for (irq = PCM027_IRQ(0); irq <= PCM027_IRQ(3); irq++) {
312 irq_set_chip_and_handler(irq, &pcm990_irq_chip, 313 irq_set_chip_and_handler(irq, &pcm990_irq_chip,
313 handle_level_irq); 314 handle_level_irq);
314 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); 315 irq_clear_status_flags(irq, IRQ_NOREQUEST | IRQ_NOPROBE);
315 } 316 }
316 317
317 /* disable all Interrupts */ 318 /* disable all Interrupts */
diff --git a/arch/arm/mach-pxa/pxa-dt.c b/arch/arm/mach-pxa/pxa-dt.c
index 7e0e5bd0c9de..8e0e62ccdced 100644
--- a/arch/arm/mach-pxa/pxa-dt.c
+++ b/arch/arm/mach-pxa/pxa-dt.c
@@ -19,7 +19,7 @@
19#include "generic.h" 19#include "generic.h"
20 20
21#ifdef CONFIG_PXA3xx 21#ifdef CONFIG_PXA3xx
22static const struct of_dev_auxdata pxa3xx_auxdata_lookup[] __initconst = { 22static const struct of_dev_auxdata const pxa3xx_auxdata_lookup[] __initconst = {
23 OF_DEV_AUXDATA("mrvl,pxa-uart", 0x40100000, "pxa2xx-uart.0", NULL), 23 OF_DEV_AUXDATA("mrvl,pxa-uart", 0x40100000, "pxa2xx-uart.0", NULL),
24 OF_DEV_AUXDATA("mrvl,pxa-uart", 0x40200000, "pxa2xx-uart.1", NULL), 24 OF_DEV_AUXDATA("mrvl,pxa-uart", 0x40200000, "pxa2xx-uart.1", NULL),
25 OF_DEV_AUXDATA("mrvl,pxa-uart", 0x40700000, "pxa2xx-uart.2", NULL), 25 OF_DEV_AUXDATA("mrvl,pxa-uart", 0x40700000, "pxa2xx-uart.2", NULL),
@@ -39,7 +39,7 @@ static void __init pxa3xx_dt_init(void)
39 pxa3xx_auxdata_lookup, NULL); 39 pxa3xx_auxdata_lookup, NULL);
40} 40}
41 41
42static const char *pxa3xx_dt_board_compat[] __initdata = { 42static const char *const pxa3xx_dt_board_compat[] __initconst = {
43 "marvell,pxa300", 43 "marvell,pxa300",
44 "marvell,pxa310", 44 "marvell,pxa310",
45 "marvell,pxa320", 45 "marvell,pxa320",
diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c
index bd4cbef15ccf..e1362c0eeafc 100644
--- a/arch/arm/mach-pxa/pxa3xx.c
+++ b/arch/arm/mach-pxa/pxa3xx.c
@@ -325,7 +325,7 @@ static void __init pxa_init_ext_wakeup_irq(int (*fn)(struct irq_data *,
325 for (irq = IRQ_WAKEUP0; irq <= IRQ_WAKEUP1; irq++) { 325 for (irq = IRQ_WAKEUP0; irq <= IRQ_WAKEUP1; irq++) {
326 irq_set_chip_and_handler(irq, &pxa_ext_wakeup_chip, 326 irq_set_chip_and_handler(irq, &pxa_ext_wakeup_chip,
327 handle_edge_irq); 327 handle_edge_irq);
328 set_irq_flags(irq, IRQF_VALID); 328 irq_clear_status_flags(irq, IRQ_NOREQUEST);
329 } 329 }
330 330
331 pxa_ext_wakeup_chip.irq_set_wake = fn; 331 pxa_ext_wakeup_chip.irq_set_wake = fn;
diff --git a/arch/arm/mach-pxa/viper.c b/arch/arm/mach-pxa/viper.c
index de3b08073fe7..4841d6cefe76 100644
--- a/arch/arm/mach-pxa/viper.c
+++ b/arch/arm/mach-pxa/viper.c
@@ -276,8 +276,9 @@ static inline unsigned long viper_irq_pending(void)
276 viper_irq_enabled_mask; 276 viper_irq_enabled_mask;
277} 277}
278 278
279static void viper_irq_handler(unsigned int irq, struct irq_desc *desc) 279static void viper_irq_handler(unsigned int __irq, struct irq_desc *desc)
280{ 280{
281 unsigned int irq;
281 unsigned long pending; 282 unsigned long pending;
282 283
283 pending = viper_irq_pending(); 284 pending = viper_irq_pending();
@@ -313,7 +314,7 @@ static void __init viper_init_irq(void)
313 isa_irq = viper_bit_to_irq(level); 314 isa_irq = viper_bit_to_irq(level);
314 irq_set_chip_and_handler(isa_irq, &viper_irq_chip, 315 irq_set_chip_and_handler(isa_irq, &viper_irq_chip,
315 handle_edge_irq); 316 handle_edge_irq);
316 set_irq_flags(isa_irq, IRQF_VALID | IRQF_PROBE); 317 irq_clear_status_flags(isa_irq, IRQ_NOREQUEST | IRQ_NOPROBE);
317 } 318 }
318 319
319 irq_set_chained_handler(gpio_to_irq(VIPER_CPLD_GPIO), 320 irq_set_chained_handler(gpio_to_irq(VIPER_CPLD_GPIO),
diff --git a/arch/arm/mach-pxa/zeus.c b/arch/arm/mach-pxa/zeus.c
index 6158566fa0f7..6f94dd7b4dee 100644
--- a/arch/arm/mach-pxa/zeus.c
+++ b/arch/arm/mach-pxa/zeus.c
@@ -105,8 +105,9 @@ static inline unsigned long zeus_irq_pending(void)
105 return __raw_readw(ZEUS_CPLD_ISA_IRQ) & zeus_irq_enabled_mask; 105 return __raw_readw(ZEUS_CPLD_ISA_IRQ) & zeus_irq_enabled_mask;
106} 106}
107 107
108static void zeus_irq_handler(unsigned int irq, struct irq_desc *desc) 108static void zeus_irq_handler(unsigned int __irq, struct irq_desc *desc)
109{ 109{
110 unsigned int irq;
110 unsigned long pending; 111 unsigned long pending;
111 112
112 pending = zeus_irq_pending(); 113 pending = zeus_irq_pending();
@@ -151,7 +152,7 @@ static void __init zeus_init_irq(void)
151 isa_irq = zeus_bit_to_irq(level); 152 isa_irq = zeus_bit_to_irq(level);
152 irq_set_chip_and_handler(isa_irq, &zeus_irq_chip, 153 irq_set_chip_and_handler(isa_irq, &zeus_irq_chip,
153 handle_edge_irq); 154 handle_edge_irq);
154 set_irq_flags(isa_irq, IRQF_VALID | IRQF_PROBE); 155 irq_clear_status_flags(isa_irq, IRQ_NOREQUEST | IRQ_NOPROBE);
155 } 156 }
156 157
157 irq_set_irq_type(gpio_to_irq(ZEUS_ISA_GPIO), IRQ_TYPE_EDGE_RISING); 158 irq_set_irq_type(gpio_to_irq(ZEUS_ISA_GPIO), IRQ_TYPE_EDGE_RISING);
diff --git a/arch/arm/mach-realview/realview-dt.c b/arch/arm/mach-realview/realview-dt.c
index cc28b89dd48f..382cc1b90519 100644
--- a/arch/arm/mach-realview/realview-dt.c
+++ b/arch/arm/mach-realview/realview-dt.c
@@ -13,7 +13,7 @@
13#include <asm/hardware/cache-l2x0.h> 13#include <asm/hardware/cache-l2x0.h>
14#include "core.h" 14#include "core.h"
15 15
16static const char *realview_dt_platform_compat[] __initconst = { 16static const char *const realview_dt_platform_compat[] __initconst = {
17 "arm,realview-eb", 17 "arm,realview-eb",
18 "arm,realview-pb1176", 18 "arm,realview-pb1176",
19 "arm,realview-pb11mp", 19 "arm,realview-pb11mp",
diff --git a/arch/arm/mach-rpc/ecard.c b/arch/arm/mach-rpc/ecard.c
index fcb1d59f7aec..f726d4c4e6dd 100644
--- a/arch/arm/mach-rpc/ecard.c
+++ b/arch/arm/mach-rpc/ecard.c
@@ -946,7 +946,7 @@ static int __init ecard_probe(int slot, unsigned irq, card_type_t type)
946 irq_set_chip_and_handler(ec->irq, &ecard_chip, 946 irq_set_chip_and_handler(ec->irq, &ecard_chip,
947 handle_level_irq); 947 handle_level_irq);
948 irq_set_chip_data(ec->irq, ec); 948 irq_set_chip_data(ec->irq, ec);
949 set_irq_flags(ec->irq, IRQF_VALID); 949 irq_clear_status_flags(ec->irq, IRQ_NOREQUEST);
950 } 950 }
951 951
952#ifdef CONFIG_ARCH_RPC 952#ifdef CONFIG_ARCH_RPC
diff --git a/arch/arm/mach-rpc/irq.c b/arch/arm/mach-rpc/irq.c
index 3e4fa849c64d..66502e6207fe 100644
--- a/arch/arm/mach-rpc/irq.c
+++ b/arch/arm/mach-rpc/irq.c
@@ -117,7 +117,7 @@ extern unsigned char rpc_default_fiq_start, rpc_default_fiq_end;
117 117
118void __init rpc_init_irq(void) 118void __init rpc_init_irq(void)
119{ 119{
120 unsigned int irq, flags; 120 unsigned int irq, clr, set = 0;
121 121
122 iomd_writeb(0, IOMD_IRQMASKA); 122 iomd_writeb(0, IOMD_IRQMASKA);
123 iomd_writeb(0, IOMD_IRQMASKB); 123 iomd_writeb(0, IOMD_IRQMASKB);
@@ -128,37 +128,37 @@ void __init rpc_init_irq(void)
128 &rpc_default_fiq_end - &rpc_default_fiq_start); 128 &rpc_default_fiq_end - &rpc_default_fiq_start);
129 129
130 for (irq = 0; irq < NR_IRQS; irq++) { 130 for (irq = 0; irq < NR_IRQS; irq++) {
131 flags = IRQF_VALID; 131 clr = IRQ_NOREQUEST;
132 132
133 if (irq <= 6 || (irq >= 9 && irq <= 15)) 133 if (irq <= 6 || (irq >= 9 && irq <= 15))
134 flags |= IRQF_PROBE; 134 clr |= IRQ_NOPROBE;
135 135
136 if (irq == 21 || (irq >= 16 && irq <= 19) || 136 if (irq == 21 || (irq >= 16 && irq <= 19) ||
137 irq == IRQ_KEYBOARDTX) 137 irq == IRQ_KEYBOARDTX)
138 flags |= IRQF_NOAUTOEN; 138 set |= IRQ_NOAUTOEN;
139 139
140 switch (irq) { 140 switch (irq) {
141 case 0 ... 7: 141 case 0 ... 7:
142 irq_set_chip_and_handler(irq, &iomd_a_chip, 142 irq_set_chip_and_handler(irq, &iomd_a_chip,
143 handle_level_irq); 143 handle_level_irq);
144 set_irq_flags(irq, flags); 144 irq_modify_status(irq, clr, set);
145 break; 145 break;
146 146
147 case 8 ... 15: 147 case 8 ... 15:
148 irq_set_chip_and_handler(irq, &iomd_b_chip, 148 irq_set_chip_and_handler(irq, &iomd_b_chip,
149 handle_level_irq); 149 handle_level_irq);
150 set_irq_flags(irq, flags); 150 irq_modify_status(irq, clr, set);
151 break; 151 break;
152 152
153 case 16 ... 21: 153 case 16 ... 21:
154 irq_set_chip_and_handler(irq, &iomd_dma_chip, 154 irq_set_chip_and_handler(irq, &iomd_dma_chip,
155 handle_level_irq); 155 handle_level_irq);
156 set_irq_flags(irq, flags); 156 irq_modify_status(irq, clr, set);
157 break; 157 break;
158 158
159 case 64 ... 71: 159 case 64 ... 71:
160 irq_set_chip(irq, &iomd_fiq_chip); 160 irq_set_chip(irq, &iomd_fiq_chip);
161 set_irq_flags(irq, IRQF_VALID); 161 irq_modify_status(irq, clr, set);
162 break; 162 break;
163 } 163 }
164 } 164 }
diff --git a/arch/arm/mach-s3c24xx/Kconfig b/arch/arm/mach-s3c24xx/Kconfig
index 23bec3a85b22..ef68ecb27396 100644
--- a/arch/arm/mach-s3c24xx/Kconfig
+++ b/arch/arm/mach-s3c24xx/Kconfig
@@ -124,6 +124,11 @@ config S3C24XX_PLL
124 This also means that the PLL tables for the selected CPU(s) will 124 This also means that the PLL tables for the selected CPU(s) will
125 be built which may increase the size of the kernel image. 125 be built which may increase the size of the kernel image.
126 126
127config S3C_SETUP_CAMIF
128 bool
129 help
130 Compile in common setup code for S3C CAMIF devices
131
127# cpu frequency items common between s3c2410 and s3c2440/s3c2442 132# cpu frequency items common between s3c2410 and s3c2440/s3c2442
128 133
129config S3C2410_IOTIMING 134config S3C2410_IOTIMING
diff --git a/arch/arm/mach-s3c24xx/Makefile b/arch/arm/mach-s3c24xx/Makefile
index 05920c8a5764..8ac2f58a3480 100644
--- a/arch/arm/mach-s3c24xx/Makefile
+++ b/arch/arm/mach-s3c24xx/Makefile
@@ -99,3 +99,4 @@ obj-$(CONFIG_S3C2416_SETUP_SDHCI_GPIO) += setup-sdhci-gpio.o
99obj-$(CONFIG_S3C2443_SETUP_SPI) += setup-spi.o 99obj-$(CONFIG_S3C2443_SETUP_SPI) += setup-spi.o
100obj-$(CONFIG_ARCH_S3C24XX) += setup-i2c.o 100obj-$(CONFIG_ARCH_S3C24XX) += setup-i2c.o
101obj-$(CONFIG_S3C24XX_SETUP_TS) += setup-ts.o 101obj-$(CONFIG_S3C24XX_SETUP_TS) += setup-ts.o
102obj-$(CONFIG_S3C_SETUP_CAMIF) += setup-camif.o
diff --git a/arch/arm/mach-s3c24xx/bast-irq.c b/arch/arm/mach-s3c24xx/bast-irq.c
index cb1b791954de..ced1ab86ac83 100644
--- a/arch/arm/mach-s3c24xx/bast-irq.c
+++ b/arch/arm/mach-s3c24xx/bast-irq.c
@@ -147,7 +147,7 @@ static __init int bast_irq_init(void)
147 147
148 irq_set_chip_and_handler(irqno, &bast_pc104_chip, 148 irq_set_chip_and_handler(irqno, &bast_pc104_chip,
149 handle_level_irq); 149 handle_level_irq);
150 set_irq_flags(irqno, IRQF_VALID); 150 irq_clear_status_flags(irqno, IRQ_NOREQUEST);
151 } 151 }
152 } 152 }
153 153
diff --git a/arch/arm/plat-samsung/include/plat/fb-core.h b/arch/arm/mach-s3c24xx/fb-core.h
index bca383efcf6d..103bdbaddd55 100644
--- a/arch/arm/plat-samsung/include/plat/fb-core.h
+++ b/arch/arm/mach-s3c24xx/fb-core.h
@@ -1,6 +1,4 @@
1/* 1/*
2 * arch/arm/plat-samsung/include/plat/fb-core.h
3 *
4 * Copyright 2010 Samsung Electronics Co., Ltd. 2 * Copyright 2010 Samsung Electronics Co., Ltd.
5 * Pawel Osciak <p.osciak@samsung.com> 3 * Pawel Osciak <p.osciak@samsung.com>
6 * 4 *
diff --git a/arch/arm/mach-s3c24xx/mach-s3c2416-dt.c b/arch/arm/mach-s3c24xx/mach-s3c2416-dt.c
index f886478b88c5..5f028ff84cfe 100644
--- a/arch/arm/mach-s3c24xx/mach-s3c2416-dt.c
+++ b/arch/arm/mach-s3c24xx/mach-s3c2416-dt.c
@@ -39,7 +39,7 @@ static void __init s3c2416_dt_machine_init(void)
39 s3c_pm_init(); 39 s3c_pm_init();
40} 40}
41 41
42static char const *s3c2416_dt_compat[] __initdata = { 42static const char *const s3c2416_dt_compat[] __initconst = {
43 "samsung,s3c2416", 43 "samsung,s3c2416",
44 "samsung,s3c2450", 44 "samsung,s3c2450",
45 NULL 45 NULL
diff --git a/arch/arm/plat-samsung/include/plat/nand-core.h b/arch/arm/mach-s3c24xx/nand-core.h
index 6de20789a95e..7e811fe1cf41 100644
--- a/arch/arm/plat-samsung/include/plat/nand-core.h
+++ b/arch/arm/mach-s3c24xx/nand-core.h
@@ -1,5 +1,4 @@
1/* arch/arm/plat-samsung/include/plat/nand-core.h 1/*
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd. 2 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/ 3 * http://www.samsung.com/
5 * 4 *
diff --git a/arch/arm/mach-s3c24xx/s3c2412.c b/arch/arm/mach-s3c24xx/s3c2412.c
index 64a13605cfc3..fb5ee8d38913 100644
--- a/arch/arm/mach-s3c24xx/s3c2412.c
+++ b/arch/arm/mach-s3c24xx/s3c2412.c
@@ -40,11 +40,11 @@
40#include <plat/cpu.h> 40#include <plat/cpu.h>
41#include <plat/cpu-freq.h> 41#include <plat/cpu-freq.h>
42#include <plat/devs.h> 42#include <plat/devs.h>
43#include <plat/nand-core.h>
44#include <plat/pm.h> 43#include <plat/pm.h>
45#include <plat/regs-spi.h> 44#include <plat/regs-spi.h>
46 45
47#include "common.h" 46#include "common.h"
47#include "nand-core.h"
48#include "regs-dsc.h" 48#include "regs-dsc.h"
49#include "s3c2412-power.h" 49#include "s3c2412-power.h"
50 50
diff --git a/arch/arm/mach-s3c24xx/s3c2416.c b/arch/arm/mach-s3c24xx/s3c2416.c
index 3f8ca2a3ef17..621b8648a7ef 100644
--- a/arch/arm/mach-s3c24xx/s3c2416.c
+++ b/arch/arm/mach-s3c24xx/s3c2416.c
@@ -59,12 +59,12 @@
59#include <plat/pm.h> 59#include <plat/pm.h>
60 60
61#include <plat/iic-core.h> 61#include <plat/iic-core.h>
62#include <plat/fb-core.h>
63#include <plat/nand-core.h>
64#include <plat/adc-core.h> 62#include <plat/adc-core.h>
65#include <plat/spi-core.h>
66 63
67#include "common.h" 64#include "common.h"
65#include "fb-core.h"
66#include "nand-core.h"
67#include "spi-core.h"
68 68
69static struct map_desc s3c2416_iodesc[] __initdata = { 69static struct map_desc s3c2416_iodesc[] __initdata = {
70 IODESC_ENT(WATCHDOG), 70 IODESC_ENT(WATCHDOG),
diff --git a/arch/arm/mach-s3c24xx/s3c2443.c b/arch/arm/mach-s3c24xx/s3c2443.c
index 87b6b89d8ee7..b559d378cf43 100644
--- a/arch/arm/mach-s3c24xx/s3c2443.c
+++ b/arch/arm/mach-s3c24xx/s3c2443.c
@@ -41,10 +41,11 @@
41#include <plat/gpio-cfg-helpers.h> 41#include <plat/gpio-cfg-helpers.h>
42#include <plat/devs.h> 42#include <plat/devs.h>
43#include <plat/cpu.h> 43#include <plat/cpu.h>
44#include <plat/fb-core.h>
45#include <plat/nand-core.h>
46#include <plat/adc-core.h> 44#include <plat/adc-core.h>
47#include <plat/spi-core.h> 45
46#include "fb-core.h"
47#include "nand-core.h"
48#include "spi-core.h"
48 49
49static struct map_desc s3c2443_iodesc[] __initdata = { 50static struct map_desc s3c2443_iodesc[] __initdata = {
50 IODESC_ENT(WATCHDOG), 51 IODESC_ENT(WATCHDOG),
diff --git a/arch/arm/mach-s3c24xx/s3c244x.c b/arch/arm/mach-s3c24xx/s3c244x.c
index b14119585dc7..31fd273269c2 100644
--- a/arch/arm/mach-s3c24xx/s3c244x.c
+++ b/arch/arm/mach-s3c24xx/s3c244x.c
@@ -41,9 +41,9 @@
41#include <plat/devs.h> 41#include <plat/devs.h>
42#include <plat/cpu.h> 42#include <plat/cpu.h>
43#include <plat/pm.h> 43#include <plat/pm.h>
44#include <plat/nand-core.h>
45 44
46#include "common.h" 45#include "common.h"
46#include "nand-core.h"
47#include "regs-dsc.h" 47#include "regs-dsc.h"
48 48
49static struct map_desc s3c244x_iodesc[] __initdata = { 49static struct map_desc s3c244x_iodesc[] __initdata = {
diff --git a/arch/arm/plat-samsung/setup-camif.c b/arch/arm/mach-s3c24xx/setup-camif.c
index 72d8edb8927a..72d8edb8927a 100644
--- a/arch/arm/plat-samsung/setup-camif.c
+++ b/arch/arm/mach-s3c24xx/setup-camif.c
diff --git a/arch/arm/plat-samsung/include/plat/spi-core.h b/arch/arm/mach-s3c24xx/spi-core.h
index 0b9428ab3fc3..0b9428ab3fc3 100644
--- a/arch/arm/plat-samsung/include/plat/spi-core.h
+++ b/arch/arm/mach-s3c24xx/spi-core.h
diff --git a/arch/arm/mach-s3c64xx/Kconfig b/arch/arm/mach-s3c64xx/Kconfig
index eff95e950d81..28c7097e8506 100644
--- a/arch/arm/mach-s3c64xx/Kconfig
+++ b/arch/arm/mach-s3c64xx/Kconfig
@@ -34,6 +34,12 @@ config S3C64XX_DEV_ONENAND1
34 help 34 help
35 Compile in platform device definition for OneNAND1 controller 35 Compile in platform device definition for OneNAND1 controller
36 36
37config SAMSUNG_DEV_BACKLIGHT
38 bool
39 depends on SAMSUNG_DEV_PWM
40 help
41 Compile in platform device definition LCD backlight with PWM Timer
42
37# platform specific device setup 43# platform specific device setup
38 44
39config S3C64XX_SETUP_I2C0 45config S3C64XX_SETUP_I2C0
diff --git a/arch/arm/mach-s3c64xx/Makefile b/arch/arm/mach-s3c64xx/Makefile
index 17f4b07ec763..bb233f342f31 100644
--- a/arch/arm/mach-s3c64xx/Makefile
+++ b/arch/arm/mach-s3c64xx/Makefile
@@ -40,6 +40,8 @@ obj-$(CONFIG_S3C64XX_SETUP_SDHCI_GPIO) += setup-sdhci-gpio.o
40obj-$(CONFIG_S3C64XX_SETUP_SPI) += setup-spi.o 40obj-$(CONFIG_S3C64XX_SETUP_SPI) += setup-spi.o
41obj-$(CONFIG_S3C64XX_SETUP_USB_PHY) += setup-usb-phy.o 41obj-$(CONFIG_S3C64XX_SETUP_USB_PHY) += setup-usb-phy.o
42 42
43obj-$(CONFIG_SAMSUNG_DEV_BACKLIGHT) += dev-backlight.o
44
43# Machine support 45# Machine support
44 46
45obj-$(CONFIG_MACH_ANW6410) += mach-anw6410.o 47obj-$(CONFIG_MACH_ANW6410) += mach-anw6410.o
diff --git a/arch/arm/plat-samsung/include/plat/ata-core.h b/arch/arm/mach-s3c64xx/ata-core.h
index f5a4ec7141b1..5951f24a9ec8 100644
--- a/arch/arm/plat-samsung/include/plat/ata-core.h
+++ b/arch/arm/mach-s3c64xx/ata-core.h
@@ -1,5 +1,4 @@
1/* linux/arch/arm/plat-samsung/include/plat/ata-core.h 1/*
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd. 2 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com 3 * http://www.samsung.com
5 * 4 *
diff --git a/arch/arm/plat-samsung/include/plat/backlight.h b/arch/arm/mach-s3c64xx/backlight.h
index ad530c78fe8c..8dcacac523a2 100644
--- a/arch/arm/plat-samsung/include/plat/backlight.h
+++ b/arch/arm/mach-s3c64xx/backlight.h
@@ -1,5 +1,4 @@
1/* linux/arch/arm/plat-samsung/include/plat/backlight.h 1/*
2 *
3 * Copyright (c) 2011 Samsung Electronics Co., Ltd. 2 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com 3 * http://www.samsung.com
5 * 4 *
diff --git a/arch/arm/mach-s3c64xx/common.c b/arch/arm/mach-s3c64xx/common.c
index 25d6676f8d6e..fd63ecfb2f81 100644
--- a/arch/arm/mach-s3c64xx/common.c
+++ b/arch/arm/mach-s3c64xx/common.c
@@ -47,12 +47,12 @@
47#include <plat/devs.h> 47#include <plat/devs.h>
48#include <plat/pm.h> 48#include <plat/pm.h>
49#include <plat/gpio-cfg.h> 49#include <plat/gpio-cfg.h>
50#include <plat/irq-uart.h>
51#include <plat/pwm-core.h> 50#include <plat/pwm-core.h>
52#include <plat/regs-irqtype.h> 51#include <plat/regs-irqtype.h>
53#include <plat/watchdog-reset.h>
54 52
55#include "common.h" 53#include "common.h"
54#include "irq-uart.h"
55#include "watchdog-reset.h"
56 56
57/* External clock frequency */ 57/* External clock frequency */
58static unsigned long xtal_f = 12000000, xusbxti_f = 48000000; 58static unsigned long xtal_f = 12000000, xusbxti_f = 48000000;
@@ -419,7 +419,7 @@ static int __init s3c64xx_init_irq_eint(void)
419 for (irq = IRQ_EINT(0); irq <= IRQ_EINT(27); irq++) { 419 for (irq = IRQ_EINT(0); irq <= IRQ_EINT(27); irq++) {
420 irq_set_chip_and_handler(irq, &s3c_irq_eint, handle_level_irq); 420 irq_set_chip_and_handler(irq, &s3c_irq_eint, handle_level_irq);
421 irq_set_chip_data(irq, (void *)eint_irq_to_bit(irq)); 421 irq_set_chip_data(irq, (void *)eint_irq_to_bit(irq));
422 set_irq_flags(irq, IRQF_VALID); 422 irq_clear_status_flags(irq, IRQ_NOREQUEST);
423 } 423 }
424 424
425 irq_set_chained_handler(IRQ_EINT0_3, s3c_irq_demux_eint0_3); 425 irq_set_chained_handler(IRQ_EINT0_3, s3c_irq_demux_eint0_3);
diff --git a/arch/arm/plat-samsung/dev-backlight.c b/arch/arm/mach-s3c64xx/dev-backlight.c
index 2157c5b539e6..38c323e68e3f 100644
--- a/arch/arm/plat-samsung/dev-backlight.c
+++ b/arch/arm/mach-s3c64xx/dev-backlight.c
@@ -1,5 +1,4 @@
1/* linux/arch/arm/plat-samsung/dev-backlight.c 1/*
2 *
3 * Copyright (c) 2011 Samsung Electronics Co., Ltd. 2 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com 3 * http://www.samsung.com
5 * 4 *
@@ -18,7 +17,8 @@
18 17
19#include <plat/devs.h> 18#include <plat/devs.h>
20#include <plat/gpio-cfg.h> 19#include <plat/gpio-cfg.h>
21#include <plat/backlight.h> 20
21#include "backlight.h"
22 22
23struct samsung_bl_drvdata { 23struct samsung_bl_drvdata {
24 struct platform_pwm_backlight_data plat_data; 24 struct platform_pwm_backlight_data plat_data;
diff --git a/arch/arm/plat-samsung/include/plat/irq-uart.h b/arch/arm/mach-s3c64xx/irq-uart.h
index a9331e49bea3..4b296132962f 100644
--- a/arch/arm/plat-samsung/include/plat/irq-uart.h
+++ b/arch/arm/mach-s3c64xx/irq-uart.h
@@ -1,5 +1,4 @@
1/* arch/arm/plat-samsung/include/plat/irq-uart.h 1/*
2 *
3 * Copyright (c) 2010 Simtec Electronics 2 * Copyright (c) 2010 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk> 3 * Ben Dooks <ben@simtec.co.uk>
5 * 4 *
diff --git a/arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c b/arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c
index 2fddf38192df..bbf74edd3dd9 100644
--- a/arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c
+++ b/arch/arm/mach-s3c64xx/mach-s3c64xx-dt.c
@@ -15,11 +15,10 @@
15#include <asm/system_misc.h> 15#include <asm/system_misc.h>
16 16
17#include <plat/cpu.h> 17#include <plat/cpu.h>
18#include <plat/watchdog-reset.h>
19
20#include <mach/map.h> 18#include <mach/map.h>
21 19
22#include "common.h" 20#include "common.h"
21#include "watchdog-reset.h"
23 22
24/* 23/*
25 * IO mapping for shared system controller IP. 24 * IO mapping for shared system controller IP.
@@ -61,7 +60,7 @@ static void s3c64xx_dt_restart(enum reboot_mode mode, const char *cmd)
61 soft_restart(0); 60 soft_restart(0);
62} 61}
63 62
64static char const *s3c64xx_dt_compat[] __initdata = { 63static const char *const s3c64xx_dt_compat[] __initconst = {
65 "samsung,s3c6400", 64 "samsung,s3c6400",
66 "samsung,s3c6410", 65 "samsung,s3c6410",
67 NULL 66 NULL
diff --git a/arch/arm/mach-s3c64xx/mach-smdk6410.c b/arch/arm/mach-s3c64xx/mach-smdk6410.c
index b7447a92276e..d590b88bd8a8 100644
--- a/arch/arm/mach-s3c64xx/mach-smdk6410.c
+++ b/arch/arm/mach-s3c64xx/mach-smdk6410.c
@@ -68,9 +68,9 @@
68#include <plat/adc.h> 68#include <plat/adc.h>
69#include <linux/platform_data/touchscreen-s3c2410.h> 69#include <linux/platform_data/touchscreen-s3c2410.h>
70#include <plat/keypad.h> 70#include <plat/keypad.h>
71#include <plat/backlight.h>
72#include <plat/samsung-time.h> 71#include <plat/samsung-time.h>
73 72
73#include "backlight.h"
74#include "common.h" 74#include "common.h"
75#include "regs-modem.h" 75#include "regs-modem.h"
76#include "regs-srom.h" 76#include "regs-srom.h"
diff --git a/arch/arm/plat-samsung/include/plat/onenand-core.h b/arch/arm/mach-s3c64xx/onenand-core.h
index 7701cb7020c8..925eb13bbb60 100644
--- a/arch/arm/plat-samsung/include/plat/onenand-core.h
+++ b/arch/arm/mach-s3c64xx/onenand-core.h
@@ -1,6 +1,4 @@
1/* 1/*
2 * linux/arch/arm/plat-samsung/onenand-core.h
3 *
4 * Copyright (c) 2010 Samsung Electronics 2 * Copyright (c) 2010 Samsung Electronics
5 * Kyungmin Park <kyungmin.park@samsung.com> 3 * Kyungmin Park <kyungmin.park@samsung.com>
6 * Marek Szyprowski <m.szyprowski@samsung.com> 4 * Marek Szyprowski <m.szyprowski@samsung.com>
diff --git a/arch/arm/plat-samsung/include/plat/regs-usb-hsotg-phy.h b/arch/arm/mach-s3c64xx/regs-usb-hsotg-phy.h
index fcf279662067..eae3c311e590 100644
--- a/arch/arm/plat-samsung/include/plat/regs-usb-hsotg-phy.h
+++ b/arch/arm/mach-s3c64xx/regs-usb-hsotg-phy.h
@@ -1,5 +1,4 @@
1/* arch/arm/plat-s3c/include/plat/regs-usb-hsotg-phy.h 1/*
2 *
3 * Copyright 2008 Openmoko, Inc. 2 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics 3 * Copyright 2008 Simtec Electronics
5 * http://armlinux.simtec.co.uk/ 4 * http://armlinux.simtec.co.uk/
diff --git a/arch/arm/mach-s3c64xx/s3c6400.c b/arch/arm/mach-s3c64xx/s3c6400.c
index 1ce48c54cd9c..33273abef669 100644
--- a/arch/arm/mach-s3c64xx/s3c6400.c
+++ b/arch/arm/mach-s3c64xx/s3c6400.c
@@ -41,9 +41,9 @@
41#include <plat/devs.h> 41#include <plat/devs.h>
42#include <plat/sdhci.h> 42#include <plat/sdhci.h>
43#include <plat/iic-core.h> 43#include <plat/iic-core.h>
44#include <plat/onenand-core.h>
45 44
46#include "common.h" 45#include "common.h"
46#include "onenand-core.h"
47 47
48void __init s3c6400_map_io(void) 48void __init s3c6400_map_io(void)
49{ 49{
diff --git a/arch/arm/mach-s3c64xx/s3c6410.c b/arch/arm/mach-s3c64xx/s3c6410.c
index b2a7930548d9..eadc48dee0e4 100644
--- a/arch/arm/mach-s3c64xx/s3c6410.c
+++ b/arch/arm/mach-s3c64xx/s3c6410.c
@@ -41,12 +41,12 @@
41#include <plat/cpu.h> 41#include <plat/cpu.h>
42#include <plat/devs.h> 42#include <plat/devs.h>
43#include <plat/sdhci.h> 43#include <plat/sdhci.h>
44#include <plat/ata-core.h>
45#include <plat/adc-core.h> 44#include <plat/adc-core.h>
46#include <plat/iic-core.h> 45#include <plat/iic-core.h>
47#include <plat/onenand-core.h>
48 46
47#include "ata-core.h"
49#include "common.h" 48#include "common.h"
49#include "onenand-core.h"
50 50
51void __init s3c6410_map_io(void) 51void __init s3c6410_map_io(void)
52{ 52{
diff --git a/arch/arm/mach-s3c64xx/setup-usb-phy.c b/arch/arm/mach-s3c64xx/setup-usb-phy.c
index ca960bda02fd..2b17b7f5152f 100644
--- a/arch/arm/mach-s3c64xx/setup-usb-phy.c
+++ b/arch/arm/mach-s3c64xx/setup-usb-phy.c
@@ -16,10 +16,10 @@
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <mach/map.h> 17#include <mach/map.h>
18#include <plat/cpu.h> 18#include <plat/cpu.h>
19#include <plat/regs-usb-hsotg-phy.h>
20#include <plat/usb-phy.h> 19#include <plat/usb-phy.h>
21 20
22#include "regs-sys.h" 21#include "regs-sys.h"
22#include "regs-usb-hsotg-phy.h"
23 23
24static int s3c_usb_otgphy_init(struct platform_device *pdev) 24static int s3c_usb_otgphy_init(struct platform_device *pdev)
25{ 25{
diff --git a/arch/arm/plat-samsung/include/plat/watchdog-reset.h b/arch/arm/mach-s3c64xx/watchdog-reset.h
index 0386b8f76623..42707dfbda9c 100644
--- a/arch/arm/plat-samsung/include/plat/watchdog-reset.h
+++ b/arch/arm/mach-s3c64xx/watchdog-reset.h
@@ -1,5 +1,4 @@
1/* arch/arm/plat-s3c/include/plat/watchdog-reset.h 1/*
2 *
3 * Copyright (c) 2008 Simtec Electronics 2 * Copyright (c) 2008 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk> 3 * Ben Dooks <ben@simtec.co.uk>
5 * 4 *
diff --git a/arch/arm/mach-sa1100/neponset.c b/arch/arm/mach-sa1100/neponset.c
index 99d9a3b1bf34..6d237b4f7a8e 100644
--- a/arch/arm/mach-sa1100/neponset.c
+++ b/arch/arm/mach-sa1100/neponset.c
@@ -320,10 +320,10 @@ static int neponset_probe(struct platform_device *dev)
320 320
321 irq_set_chip_and_handler(d->irq_base + NEP_IRQ_SMC91X, &nochip, 321 irq_set_chip_and_handler(d->irq_base + NEP_IRQ_SMC91X, &nochip,
322 handle_simple_irq); 322 handle_simple_irq);
323 set_irq_flags(d->irq_base + NEP_IRQ_SMC91X, IRQF_VALID | IRQF_PROBE); 323 irq_clear_status_flags(d->irq_base + NEP_IRQ_SMC91X, IRQ_NOREQUEST | IRQ_NOPROBE);
324 irq_set_chip_and_handler(d->irq_base + NEP_IRQ_USAR, &nochip, 324 irq_set_chip_and_handler(d->irq_base + NEP_IRQ_USAR, &nochip,
325 handle_simple_irq); 325 handle_simple_irq);
326 set_irq_flags(d->irq_base + NEP_IRQ_USAR, IRQF_VALID | IRQF_PROBE); 326 irq_clear_status_flags(d->irq_base + NEP_IRQ_USAR, IRQ_NOREQUEST | IRQ_NOPROBE);
327 irq_set_chip(d->irq_base + NEP_IRQ_SA1111, &nochip); 327 irq_set_chip(d->irq_base + NEP_IRQ_SA1111, &nochip);
328 328
329 irq_set_irq_type(irq, IRQ_TYPE_EDGE_RISING); 329 irq_set_irq_type(irq, IRQ_TYPE_EDGE_RISING);
diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
index 45006479d461..26505d4efa80 100644
--- a/arch/arm/mach-shmobile/Kconfig
+++ b/arch/arm/mach-shmobile/Kconfig
@@ -89,13 +89,6 @@ config ARCH_SH73A0
89 select ARCH_RMOBILE 89 select ARCH_RMOBILE
90 select RENESAS_INTC_IRQPIN 90 select RENESAS_INTC_IRQPIN
91 91
92comment "Renesas ARM SoCs Board Type"
93
94config MACH_MARZEN
95 bool "MARZEN board"
96 depends on ARCH_R8A7779
97 select REGULATOR_FIXED_VOLTAGE if REGULATOR
98
99comment "Renesas ARM SoCs System Configuration" 92comment "Renesas ARM SoCs System Configuration"
100endif 93endif
101 94
@@ -103,22 +96,6 @@ if ARCH_SHMOBILE_LEGACY
103 96
104comment "Renesas ARM SoCs System Type" 97comment "Renesas ARM SoCs System Type"
105 98
106config ARCH_SH73A0
107 bool "SH-Mobile AG5 (R8A73A00)"
108 select ARCH_RMOBILE
109 select ARCH_WANT_OPTIONAL_GPIOLIB
110 select ARM_GIC
111 select I2C
112 select SH_INTC
113 select RENESAS_INTC_IRQPIN
114
115config ARCH_R8A7740
116 bool "R-Mobile A1 (R8A77400)"
117 select ARCH_RMOBILE
118 select ARCH_WANT_OPTIONAL_GPIOLIB
119 select ARM_GIC
120 select RENESAS_INTC_IRQPIN
121
122config ARCH_R8A7778 99config ARCH_R8A7778
123 bool "R-Car M1A (R8A77781)" 100 bool "R-Car M1A (R8A77781)"
124 select ARCH_RCAR_GEN1 101 select ARCH_RCAR_GEN1
@@ -133,15 +110,6 @@ config ARCH_R8A7779
133 110
134comment "Renesas ARM SoCs Board Type" 111comment "Renesas ARM SoCs Board Type"
135 112
136config MACH_ARMADILLO800EVA
137 bool "Armadillo-800 EVA board"
138 depends on ARCH_R8A7740
139 select ARCH_REQUIRE_GPIOLIB
140 select REGULATOR_FIXED_VOLTAGE if REGULATOR
141 select SMSC_PHY if SH_ETH
142 select SND_SOC_WM8978 if SND_SIMPLE_CARD && I2C
143 select USE_OF
144
145config MACH_BOCKW 113config MACH_BOCKW
146 bool "BOCK-W platform" 114 bool "BOCK-W platform"
147 depends on ARCH_R8A7778 115 depends on ARCH_R8A7778
@@ -164,21 +132,6 @@ config MACH_BOCKW_REFERENCE
164 132
165 This is intended to aid developers 133 This is intended to aid developers
166 134
167config MACH_MARZEN
168 bool "MARZEN board"
169 depends on ARCH_R8A7779
170 select ARCH_REQUIRE_GPIOLIB
171 select REGULATOR_FIXED_VOLTAGE if REGULATOR
172 select USE_OF
173
174config MACH_KZM9G
175 bool "KZM-A9-GT board"
176 depends on ARCH_SH73A0
177 select ARCH_REQUIRE_GPIOLIB
178 select REGULATOR_FIXED_VOLTAGE if REGULATOR
179 select SND_SOC_AK4642 if SND_SIMPLE_CARD
180 select USE_OF
181
182comment "Renesas ARM SoCs System Configuration" 135comment "Renesas ARM SoCs System Configuration"
183 136
184config CPU_HAS_INTEVT 137config CPU_HAS_INTEVT
diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile
index 89e463de4479..9fd0fac92dd1 100644
--- a/arch/arm/mach-shmobile/Makefile
+++ b/arch/arm/mach-shmobile/Makefile
@@ -6,9 +6,9 @@
6obj-y := timer.o console.o 6obj-y := timer.o console.o
7 7
8# CPU objects 8# CPU objects
9obj-$(CONFIG_ARCH_SH73A0) += setup-sh73a0.o pm-sh73a0.o 9obj-$(CONFIG_ARCH_SH73A0) += setup-sh73a0.o
10obj-$(CONFIG_ARCH_R8A73A4) += setup-r8a73a4.o 10obj-$(CONFIG_ARCH_R8A73A4) += setup-r8a73a4.o
11obj-$(CONFIG_ARCH_R8A7740) += setup-r8a7740.o pm-r8a7740.o 11obj-$(CONFIG_ARCH_R8A7740) += setup-r8a7740.o
12obj-$(CONFIG_ARCH_R8A7778) += setup-r8a7778.o 12obj-$(CONFIG_ARCH_R8A7778) += setup-r8a7778.o
13obj-$(CONFIG_ARCH_R8A7779) += setup-r8a7779.o pm-r8a7779.o 13obj-$(CONFIG_ARCH_R8A7779) += setup-r8a7779.o pm-r8a7779.o
14obj-$(CONFIG_ARCH_R8A7790) += setup-r8a7790.o 14obj-$(CONFIG_ARCH_R8A7790) += setup-r8a7790.o
@@ -20,10 +20,7 @@ obj-$(CONFIG_ARCH_R7S72100) += setup-r7s72100.o
20# Clock objects 20# Clock objects
21ifndef CONFIG_COMMON_CLK 21ifndef CONFIG_COMMON_CLK
22obj-y += clock.o 22obj-y += clock.o
23obj-$(CONFIG_ARCH_SH73A0) += clock-sh73a0.o
24obj-$(CONFIG_ARCH_R8A7740) += clock-r8a7740.o
25obj-$(CONFIG_ARCH_R8A7778) += clock-r8a7778.o 23obj-$(CONFIG_ARCH_R8A7778) += clock-r8a7778.o
26obj-$(CONFIG_ARCH_R8A7779) += clock-r8a7779.o
27endif 24endif
28 25
29# CPU reset vector handling objects 26# CPU reset vector handling objects
@@ -51,14 +48,9 @@ obj-$(CONFIG_PM_RMOBILE) += pm-rmobile.o
51obj-$(CONFIG_ARCH_RCAR_GEN2) += pm-rcar-gen2.o 48obj-$(CONFIG_ARCH_RCAR_GEN2) += pm-rcar-gen2.o
52 49
53# Board objects 50# Board objects
54ifdef CONFIG_ARCH_SHMOBILE_MULTI 51ifndef CONFIG_ARCH_SHMOBILE_MULTI
55obj-$(CONFIG_MACH_MARZEN) += board-marzen-reference.o
56else
57obj-$(CONFIG_MACH_BOCKW) += board-bockw.o 52obj-$(CONFIG_MACH_BOCKW) += board-bockw.o
58obj-$(CONFIG_MACH_BOCKW_REFERENCE) += board-bockw-reference.o 53obj-$(CONFIG_MACH_BOCKW_REFERENCE) += board-bockw-reference.o
59obj-$(CONFIG_MACH_MARZEN) += board-marzen.o
60obj-$(CONFIG_MACH_ARMADILLO800EVA) += board-armadillo800eva.o
61obj-$(CONFIG_MACH_KZM9G) += board-kzm9g.o intc-sh73a0.o
62endif 54endif
63 55
64# Framework support 56# Framework support
diff --git a/arch/arm/mach-shmobile/Makefile.boot b/arch/arm/mach-shmobile/Makefile.boot
index e1ef19cef89c..a489fe9a76cd 100644
--- a/arch/arm/mach-shmobile/Makefile.boot
+++ b/arch/arm/mach-shmobile/Makefile.boot
@@ -1,10 +1,7 @@
1# per-board load address for uImage 1# per-board load address for uImage
2loadaddr-y := 2loadaddr-y :=
3loadaddr-$(CONFIG_MACH_ARMADILLO800EVA) += 0x40008000
4loadaddr-$(CONFIG_MACH_BOCKW) += 0x60008000 3loadaddr-$(CONFIG_MACH_BOCKW) += 0x60008000
5loadaddr-$(CONFIG_MACH_BOCKW_REFERENCE) += 0x60008000 4loadaddr-$(CONFIG_MACH_BOCKW_REFERENCE) += 0x60008000
6loadaddr-$(CONFIG_MACH_KZM9G) += 0x41008000
7loadaddr-$(CONFIG_MACH_MARZEN) += 0x60008000
8 5
9__ZRELADDR := $(sort $(loadaddr-y)) 6__ZRELADDR := $(sort $(loadaddr-y))
10 zreladdr-y += $(__ZRELADDR) 7 zreladdr-y += $(__ZRELADDR)
diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c
deleted file mode 100644
index bf37e3c532f6..000000000000
--- a/arch/arm/mach-shmobile/board-armadillo800eva.c
+++ /dev/null
@@ -1,1365 +0,0 @@
1/*
2 * armadillo 800 eva board support
3 *
4 * Copyright (C) 2012 Renesas Solutions Corp.
5 * Copyright (C) 2012 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16
17#include <linux/clk.h>
18#include <linux/delay.h>
19#include <linux/err.h>
20#include <linux/gpio.h>
21#include <linux/gpio_keys.h>
22#include <linux/i2c-gpio.h>
23#include <linux/input.h>
24#include <linux/irq.h>
25#include <linux/kernel.h>
26#include <linux/mfd/tmio.h>
27#include <linux/mmc/host.h>
28#include <linux/mmc/sh_mmcif.h>
29#include <linux/mmc/sh_mobile_sdhi.h>
30#include <linux/pinctrl/machine.h>
31#include <linux/platform_data/st1232_pdata.h>
32#include <linux/platform_device.h>
33#include <linux/pwm.h>
34#include <linux/pwm_backlight.h>
35#include <linux/reboot.h>
36#include <linux/regulator/driver.h>
37#include <linux/regulator/fixed.h>
38#include <linux/regulator/gpio-regulator.h>
39#include <linux/regulator/machine.h>
40#include <linux/sh_eth.h>
41#include <linux/usb/renesas_usbhs.h>
42#include <linux/videodev2.h>
43
44#include <asm/hardware/cache-l2x0.h>
45#include <asm/mach-types.h>
46#include <asm/mach/arch.h>
47#include <asm/mach/map.h>
48#include <asm/mach/time.h>
49#include <asm/page.h>
50#include <media/mt9t112.h>
51#include <media/sh_mobile_ceu.h>
52#include <media/soc_camera.h>
53#include <sound/sh_fsi.h>
54#include <sound/simple_card.h>
55#include <video/sh_mobile_hdmi.h>
56#include <video/sh_mobile_lcdc.h>
57
58#include "common.h"
59#include "irqs.h"
60#include "pm-rmobile.h"
61#include "r8a7740.h"
62#include "sh-gpio.h"
63
64/*
65 * CON1 Camera Module
66 * CON2 Extension Bus
67 * CON3 HDMI Output
68 * CON4 Composite Video Output
69 * CON5 H-UDI JTAG
70 * CON6 ARM JTAG
71 * CON7 SD1
72 * CON8 SD2
73 * CON9 RTC BackUp
74 * CON10 Monaural Mic Input
75 * CON11 Stereo Headphone Output
76 * CON12 Audio Line Output(L)
77 * CON13 Audio Line Output(R)
78 * CON14 AWL13 Module
79 * CON15 Extension
80 * CON16 LCD1
81 * CON17 LCD2
82 * CON19 Power Input
83 * CON20 USB1
84 * CON21 USB2
85 * CON22 Serial
86 * CON23 LAN
87 * CON24 USB3
88 * LED1 Camera LED(Yellow)
89 * LED2 Power LED (Green)
90 * ED3-LED6 User LED(Yellow)
91 * LED7 LAN link LED(Green)
92 * LED8 LAN activity LED(Yellow)
93 */
94
95/*
96 * DipSwitch
97 *
98 * SW1
99 *
100 * -12345678-+---------------+----------------------------
101 * 1 | boot | hermit
102 * 0 | boot | OS auto boot
103 * -12345678-+---------------+----------------------------
104 * 00 | boot device | eMMC
105 * 10 | boot device | SDHI0 (CON7)
106 * 01 | boot device | -
107 * 11 | boot device | Extension Buss (CS0)
108 * -12345678-+---------------+----------------------------
109 * 0 | Extension Bus | D8-D15 disable, eMMC enable
110 * 1 | Extension Bus | D8-D15 enable, eMMC disable
111 * -12345678-+---------------+----------------------------
112 * 0 | SDHI1 | COM8 disable, COM14 enable
113 * 1 | SDHI1 | COM8 enable, COM14 disable
114 * -12345678-+---------------+----------------------------
115 * 0 | USB0 | COM20 enable, COM24 disable
116 * 1 | USB0 | COM20 disable, COM24 enable
117 * -12345678-+---------------+----------------------------
118 * 00 | JTAG | SH-X2
119 * 10 | JTAG | ARM
120 * 01 | JTAG | -
121 * 11 | JTAG | Boundary Scan
122 *-----------+---------------+----------------------------
123 */
124
125/*
126 * FSI-WM8978
127 *
128 * this command is required when playback.
129 *
130 * # amixer set "Headphone" 50
131 *
132 * this command is required when capture.
133 *
134 * # amixer set "Input PGA" 15
135 * # amixer set "Left Input Mixer MicP" on
136 * # amixer set "Left Input Mixer MicN" on
137 * # amixer set "Right Input Mixer MicN" on
138 * # amixer set "Right Input Mixer MicP" on
139 */
140
141/*
142 * USB function
143 *
144 * When you use USB Function,
145 * set SW1.6 ON, and connect cable to CN24.
146 *
147 * USBF needs workaround on R8A7740 chip.
148 * These are a little bit complex.
149 * see
150 * usbhsf_power_ctrl()
151 */
152#define IRQ7 irq_pin(7)
153#define USBCR1 IOMEM(0xe605810a)
154#define USBH 0xC6700000
155#define USBH_USBCTR 0x10834
156
157struct usbhsf_private {
158 struct clk *phy;
159 struct clk *usb24;
160 struct clk *pci;
161 struct clk *func;
162 struct clk *host;
163 void __iomem *usbh_base;
164 struct renesas_usbhs_platform_info info;
165};
166
167#define usbhsf_get_priv(pdev) \
168 container_of(renesas_usbhs_get_info(pdev), \
169 struct usbhsf_private, info)
170
171static int usbhsf_get_id(struct platform_device *pdev)
172{
173 return USBHS_GADGET;
174}
175
176static int usbhsf_power_ctrl(struct platform_device *pdev,
177 void __iomem *base, int enable)
178{
179 struct usbhsf_private *priv = usbhsf_get_priv(pdev);
180
181 /*
182 * Work around for USB Function.
183 * It needs USB host clock, and settings
184 */
185 if (enable) {
186 /*
187 * enable all the related usb clocks
188 * for usb workaround
189 */
190 clk_enable(priv->usb24);
191 clk_enable(priv->pci);
192 clk_enable(priv->host);
193 clk_enable(priv->func);
194 clk_enable(priv->phy);
195
196 /*
197 * set USBCR1
198 *
199 * Port1 is driven by USB function,
200 * Port2 is driven by USB HOST
201 * One HOST (Port1 or Port2 is HOST)
202 * USB PLL input clock = 24MHz
203 */
204 __raw_writew(0xd750, USBCR1);
205 mdelay(1);
206
207 /*
208 * start USB Host
209 */
210 __raw_writel(0x0000000c, priv->usbh_base + USBH_USBCTR);
211 __raw_writel(0x00000008, priv->usbh_base + USBH_USBCTR);
212 mdelay(10);
213
214 /*
215 * USB PHY Power ON
216 */
217 __raw_writew(0xd770, USBCR1);
218 __raw_writew(0x4000, base + 0x102); /* USBF :: SUSPMODE */
219
220 } else {
221 __raw_writel(0x0000010f, priv->usbh_base + USBH_USBCTR);
222 __raw_writew(0xd7c0, USBCR1); /* GPIO */
223
224 clk_disable(priv->phy);
225 clk_disable(priv->func); /* usb work around */
226 clk_disable(priv->host); /* usb work around */
227 clk_disable(priv->pci); /* usb work around */
228 clk_disable(priv->usb24); /* usb work around */
229 }
230
231 return 0;
232}
233
234static int usbhsf_get_vbus(struct platform_device *pdev)
235{
236 return gpio_get_value(209);
237}
238
239static irqreturn_t usbhsf_interrupt(int irq, void *data)
240{
241 struct platform_device *pdev = data;
242
243 renesas_usbhs_call_notify_hotplug(pdev);
244
245 return IRQ_HANDLED;
246}
247
248static int usbhsf_hardware_exit(struct platform_device *pdev)
249{
250 struct usbhsf_private *priv = usbhsf_get_priv(pdev);
251
252 if (!IS_ERR(priv->phy))
253 clk_put(priv->phy);
254 if (!IS_ERR(priv->usb24))
255 clk_put(priv->usb24);
256 if (!IS_ERR(priv->pci))
257 clk_put(priv->pci);
258 if (!IS_ERR(priv->host))
259 clk_put(priv->host);
260 if (!IS_ERR(priv->func))
261 clk_put(priv->func);
262 if (priv->usbh_base)
263 iounmap(priv->usbh_base);
264
265 priv->phy = NULL;
266 priv->usb24 = NULL;
267 priv->pci = NULL;
268 priv->host = NULL;
269 priv->func = NULL;
270 priv->usbh_base = NULL;
271
272 free_irq(IRQ7, pdev);
273
274 return 0;
275}
276
277static int usbhsf_hardware_init(struct platform_device *pdev)
278{
279 struct usbhsf_private *priv = usbhsf_get_priv(pdev);
280 int ret;
281
282 priv->phy = clk_get(&pdev->dev, "phy");
283 priv->usb24 = clk_get(&pdev->dev, "usb24");
284 priv->pci = clk_get(&pdev->dev, "pci");
285 priv->func = clk_get(&pdev->dev, "func");
286 priv->host = clk_get(&pdev->dev, "host");
287 priv->usbh_base = ioremap_nocache(USBH, 0x20000);
288
289 if (IS_ERR(priv->phy) ||
290 IS_ERR(priv->usb24) ||
291 IS_ERR(priv->pci) ||
292 IS_ERR(priv->host) ||
293 IS_ERR(priv->func) ||
294 !priv->usbh_base) {
295 dev_err(&pdev->dev, "USB clock setting failed\n");
296 usbhsf_hardware_exit(pdev);
297 return -EIO;
298 }
299
300 ret = request_irq(IRQ7, usbhsf_interrupt, IRQF_TRIGGER_NONE,
301 dev_name(&pdev->dev), pdev);
302 if (ret) {
303 dev_err(&pdev->dev, "request_irq err\n");
304 return ret;
305 }
306 irq_set_irq_type(IRQ7, IRQ_TYPE_EDGE_BOTH);
307
308 /* usb24 use 1/1 of parent clock (= usb24s = 24MHz) */
309 clk_set_rate(priv->usb24,
310 clk_get_rate(clk_get_parent(priv->usb24)));
311
312 return 0;
313}
314
315static struct usbhsf_private usbhsf_private = {
316 .info = {
317 .platform_callback = {
318 .get_id = usbhsf_get_id,
319 .get_vbus = usbhsf_get_vbus,
320 .hardware_init = usbhsf_hardware_init,
321 .hardware_exit = usbhsf_hardware_exit,
322 .power_ctrl = usbhsf_power_ctrl,
323 },
324 .driver_param = {
325 .buswait_bwait = 5,
326 .detection_delay = 5,
327 .d0_rx_id = SHDMA_SLAVE_USBHS_RX,
328 .d1_tx_id = SHDMA_SLAVE_USBHS_TX,
329 },
330 }
331};
332
333static struct resource usbhsf_resources[] = {
334 {
335 .name = "USBHS",
336 .start = 0xe6890000,
337 .end = 0xe6890104 - 1,
338 .flags = IORESOURCE_MEM,
339 },
340 {
341 .start = gic_spi(51),
342 .flags = IORESOURCE_IRQ,
343 },
344};
345
346static struct platform_device usbhsf_device = {
347 .name = "renesas_usbhs",
348 .dev = {
349 .platform_data = &usbhsf_private.info,
350 },
351 .id = -1,
352 .num_resources = ARRAY_SIZE(usbhsf_resources),
353 .resource = usbhsf_resources,
354};
355
356/* Ether */
357static struct sh_eth_plat_data sh_eth_platdata = {
358 .phy = 0x00, /* LAN8710A */
359 .edmac_endian = EDMAC_LITTLE_ENDIAN,
360 .phy_interface = PHY_INTERFACE_MODE_MII,
361};
362
363static struct resource sh_eth_resources[] = {
364 {
365 .start = 0xe9a00000,
366 .end = 0xe9a00800 - 1,
367 .flags = IORESOURCE_MEM,
368 }, {
369 .start = 0xe9a01800,
370 .end = 0xe9a02000 - 1,
371 .flags = IORESOURCE_MEM,
372 }, {
373 .start = gic_spi(110),
374 .flags = IORESOURCE_IRQ,
375 },
376};
377
378static struct platform_device sh_eth_device = {
379 .name = "r8a7740-gether",
380 .id = -1,
381 .dev = {
382 .platform_data = &sh_eth_platdata,
383 .dma_mask = &sh_eth_device.dev.coherent_dma_mask,
384 .coherent_dma_mask = DMA_BIT_MASK(32),
385 },
386 .resource = sh_eth_resources,
387 .num_resources = ARRAY_SIZE(sh_eth_resources),
388};
389
390/* PWM */
391static struct resource pwm_resources[] = {
392 [0] = {
393 .start = 0xe6600000,
394 .end = 0xe66000ff,
395 .flags = IORESOURCE_MEM,
396 },
397};
398
399static struct platform_device pwm_device = {
400 .name = "renesas-tpu-pwm",
401 .id = -1,
402 .num_resources = ARRAY_SIZE(pwm_resources),
403 .resource = pwm_resources,
404};
405
406static struct pwm_lookup pwm_lookup[] = {
407 PWM_LOOKUP("renesas-tpu-pwm", 2, "pwm-backlight.0", NULL,
408 33333, PWM_POLARITY_INVERSED),
409};
410
411/* LCDC and backlight */
412static struct platform_pwm_backlight_data pwm_backlight_data = {
413 .lth_brightness = 50,
414 .max_brightness = 255,
415 .dft_brightness = 255,
416 .pwm_period_ns = 33333, /* 30kHz */
417 .enable_gpio = 61,
418};
419
420static struct platform_device pwm_backlight_device = {
421 .name = "pwm-backlight",
422 .dev = {
423 .platform_data = &pwm_backlight_data,
424 },
425};
426
427static struct fb_videomode lcdc0_mode = {
428 .name = "AMPIER/AM-800480",
429 .xres = 800,
430 .yres = 480,
431 .left_margin = 88,
432 .right_margin = 40,
433 .hsync_len = 128,
434 .upper_margin = 20,
435 .lower_margin = 5,
436 .vsync_len = 5,
437 .sync = 0,
438};
439
440static struct sh_mobile_lcdc_info lcdc0_info = {
441 .clock_source = LCDC_CLK_BUS,
442 .ch[0] = {
443 .chan = LCDC_CHAN_MAINLCD,
444 .fourcc = V4L2_PIX_FMT_RGB565,
445 .interface_type = RGB24,
446 .clock_divider = 5,
447 .flags = 0,
448 .lcd_modes = &lcdc0_mode,
449 .num_modes = 1,
450 .panel_cfg = {
451 .width = 111,
452 .height = 68,
453 },
454 },
455};
456
457static struct resource lcdc0_resources[] = {
458 [0] = {
459 .name = "LCD0",
460 .start = 0xfe940000,
461 .end = 0xfe943fff,
462 .flags = IORESOURCE_MEM,
463 },
464 [1] = {
465 .start = gic_spi(177),
466 .flags = IORESOURCE_IRQ,
467 },
468};
469
470static struct platform_device lcdc0_device = {
471 .name = "sh_mobile_lcdc_fb",
472 .num_resources = ARRAY_SIZE(lcdc0_resources),
473 .resource = lcdc0_resources,
474 .id = 0,
475 .dev = {
476 .platform_data = &lcdc0_info,
477 .coherent_dma_mask = DMA_BIT_MASK(32),
478 },
479};
480
481/*
482 * LCDC1/HDMI
483 */
484static struct sh_mobile_hdmi_info hdmi_info = {
485 .flags = HDMI_OUTPUT_PUSH_PULL |
486 HDMI_OUTPUT_POLARITY_HI |
487 HDMI_32BIT_REG |
488 HDMI_HAS_HTOP1 |
489 HDMI_SND_SRC_SPDIF,
490};
491
492static struct resource hdmi_resources[] = {
493 [0] = {
494 .name = "HDMI",
495 .start = 0xe6be0000,
496 .end = 0xe6be03ff,
497 .flags = IORESOURCE_MEM,
498 },
499 [1] = {
500 .start = gic_spi(131),
501 .flags = IORESOURCE_IRQ,
502 },
503 [2] = {
504 .name = "HDMI emma3pf",
505 .start = 0xe6be4000,
506 .end = 0xe6be43ff,
507 .flags = IORESOURCE_MEM,
508 },
509};
510
511static struct platform_device hdmi_device = {
512 .name = "sh-mobile-hdmi",
513 .num_resources = ARRAY_SIZE(hdmi_resources),
514 .resource = hdmi_resources,
515 .id = -1,
516 .dev = {
517 .platform_data = &hdmi_info,
518 },
519};
520
521static const struct fb_videomode lcdc1_mode = {
522 .name = "HDMI 720p",
523 .xres = 1280,
524 .yres = 720,
525 .pixclock = 13468,
526 .left_margin = 220,
527 .right_margin = 110,
528 .hsync_len = 40,
529 .upper_margin = 20,
530 .lower_margin = 5,
531 .vsync_len = 5,
532 .refresh = 60,
533 .sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT,
534};
535
536static struct sh_mobile_lcdc_info hdmi_lcdc_info = {
537 .clock_source = LCDC_CLK_PERIPHERAL, /* HDMI clock */
538 .ch[0] = {
539 .chan = LCDC_CHAN_MAINLCD,
540 .fourcc = V4L2_PIX_FMT_RGB565,
541 .interface_type = RGB24,
542 .clock_divider = 1,
543 .flags = LCDC_FLAGS_DWPOL,
544 .lcd_modes = &lcdc1_mode,
545 .num_modes = 1,
546 .tx_dev = &hdmi_device,
547 .panel_cfg = {
548 .width = 1280,
549 .height = 720,
550 },
551 },
552};
553
554static struct resource hdmi_lcdc_resources[] = {
555 [0] = {
556 .name = "LCDC1",
557 .start = 0xfe944000,
558 .end = 0xfe948000 - 1,
559 .flags = IORESOURCE_MEM,
560 },
561 [1] = {
562 .start = gic_spi(178),
563 .flags = IORESOURCE_IRQ,
564 },
565};
566
567static struct platform_device hdmi_lcdc_device = {
568 .name = "sh_mobile_lcdc_fb",
569 .num_resources = ARRAY_SIZE(hdmi_lcdc_resources),
570 .resource = hdmi_lcdc_resources,
571 .id = 1,
572 .dev = {
573 .platform_data = &hdmi_lcdc_info,
574 .coherent_dma_mask = DMA_BIT_MASK(32),
575 },
576};
577
578/* LEDS */
579static struct gpio_led gpio_leds[] = {
580 {
581 .name = "LED3",
582 .gpio = 102,
583 .default_state = LEDS_GPIO_DEFSTATE_ON,
584 }, {
585 .name = "LED4",
586 .gpio = 111,
587 .default_state = LEDS_GPIO_DEFSTATE_ON,
588 }, {
589 .name = "LED5",
590 .gpio = 110,
591 .default_state = LEDS_GPIO_DEFSTATE_ON,
592 }, {
593 .name = "LED6",
594 .gpio = 177,
595 .default_state = LEDS_GPIO_DEFSTATE_ON,
596 },
597};
598
599static struct gpio_led_platform_data leds_gpio_info = {
600 .leds = gpio_leds,
601 .num_leds = ARRAY_SIZE(gpio_leds),
602};
603
604static struct platform_device leds_gpio_device = {
605 .name = "leds-gpio",
606 .id = -1,
607 .dev = {
608 .platform_data = &leds_gpio_info,
609 },
610};
611
612/* GPIO KEY */
613#define GPIO_KEY(c, g, d, ...) \
614 { .code = c, .gpio = g, .desc = d, .active_low = 1, __VA_ARGS__ }
615
616static struct gpio_keys_button gpio_buttons[] = {
617 GPIO_KEY(KEY_POWER, 99, "SW3", .wakeup = 1),
618 GPIO_KEY(KEY_BACK, 100, "SW4"),
619 GPIO_KEY(KEY_MENU, 97, "SW5"),
620 GPIO_KEY(KEY_HOME, 98, "SW6"),
621};
622
623static struct gpio_keys_platform_data gpio_key_info = {
624 .buttons = gpio_buttons,
625 .nbuttons = ARRAY_SIZE(gpio_buttons),
626};
627
628static struct platform_device gpio_keys_device = {
629 .name = "gpio-keys",
630 .id = -1,
631 .dev = {
632 .platform_data = &gpio_key_info,
633 },
634};
635
636/* Fixed 3.3V regulator to be used by SDHI1, MMCIF */
637static struct regulator_consumer_supply fixed3v3_power_consumers[] = {
638 REGULATOR_SUPPLY("vmmc", "sh_mmcif"),
639 REGULATOR_SUPPLY("vqmmc", "sh_mmcif"),
640};
641
642/* Fixed 3.3V regulator used by LCD backlight */
643static struct regulator_consumer_supply fixed5v0_power_consumers[] = {
644 REGULATOR_SUPPLY("power", "pwm-backlight.0"),
645};
646
647/* Fixed 3.3V regulator to be used by SDHI0 */
648static struct regulator_consumer_supply vcc_sdhi0_consumers[] = {
649 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"),
650};
651
652static struct regulator_init_data vcc_sdhi0_init_data = {
653 .constraints = {
654 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
655 },
656 .num_consumer_supplies = ARRAY_SIZE(vcc_sdhi0_consumers),
657 .consumer_supplies = vcc_sdhi0_consumers,
658};
659
660static struct fixed_voltage_config vcc_sdhi0_info = {
661 .supply_name = "SDHI0 Vcc",
662 .microvolts = 3300000,
663 .gpio = 75,
664 .enable_high = 1,
665 .init_data = &vcc_sdhi0_init_data,
666};
667
668static struct platform_device vcc_sdhi0 = {
669 .name = "reg-fixed-voltage",
670 .id = 1,
671 .dev = {
672 .platform_data = &vcc_sdhi0_info,
673 },
674};
675
676/* 1.8 / 3.3V SDHI0 VccQ regulator */
677static struct regulator_consumer_supply vccq_sdhi0_consumers[] = {
678 REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.0"),
679};
680
681static struct regulator_init_data vccq_sdhi0_init_data = {
682 .constraints = {
683 .input_uV = 3300000,
684 .min_uV = 1800000,
685 .max_uV = 3300000,
686 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
687 REGULATOR_CHANGE_STATUS,
688 },
689 .num_consumer_supplies = ARRAY_SIZE(vccq_sdhi0_consumers),
690 .consumer_supplies = vccq_sdhi0_consumers,
691};
692
693static struct gpio vccq_sdhi0_gpios[] = {
694 {17, GPIOF_OUT_INIT_LOW, "vccq-sdhi0" },
695};
696
697static struct gpio_regulator_state vccq_sdhi0_states[] = {
698 { .value = 3300000, .gpios = (0 << 0) },
699 { .value = 1800000, .gpios = (1 << 0) },
700};
701
702static struct gpio_regulator_config vccq_sdhi0_info = {
703 .supply_name = "vqmmc",
704
705 .enable_gpio = 74,
706 .enable_high = 1,
707 .enabled_at_boot = 0,
708
709 .gpios = vccq_sdhi0_gpios,
710 .nr_gpios = ARRAY_SIZE(vccq_sdhi0_gpios),
711
712 .states = vccq_sdhi0_states,
713 .nr_states = ARRAY_SIZE(vccq_sdhi0_states),
714
715 .type = REGULATOR_VOLTAGE,
716 .init_data = &vccq_sdhi0_init_data,
717};
718
719static struct platform_device vccq_sdhi0 = {
720 .name = "gpio-regulator",
721 .id = -1,
722 .dev = {
723 .platform_data = &vccq_sdhi0_info,
724 },
725};
726
727/* Fixed 3.3V regulator to be used by SDHI1 */
728static struct regulator_consumer_supply vcc_sdhi1_consumers[] = {
729 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.1"),
730};
731
732static struct regulator_init_data vcc_sdhi1_init_data = {
733 .constraints = {
734 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
735 },
736 .num_consumer_supplies = ARRAY_SIZE(vcc_sdhi1_consumers),
737 .consumer_supplies = vcc_sdhi1_consumers,
738};
739
740static struct fixed_voltage_config vcc_sdhi1_info = {
741 .supply_name = "SDHI1 Vcc",
742 .microvolts = 3300000,
743 .gpio = 16,
744 .enable_high = 1,
745 .init_data = &vcc_sdhi1_init_data,
746};
747
748static struct platform_device vcc_sdhi1 = {
749 .name = "reg-fixed-voltage",
750 .id = 2,
751 .dev = {
752 .platform_data = &vcc_sdhi1_info,
753 },
754};
755
756/* SDHI0 */
757static struct tmio_mmc_data sdhi0_info = {
758 .chan_priv_tx = (void *)SHDMA_SLAVE_SDHI0_TX,
759 .chan_priv_rx = (void *)SHDMA_SLAVE_SDHI0_RX,
760 .capabilities = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
761 MMC_CAP_POWER_OFF_CARD,
762 .flags = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_USE_GPIO_CD,
763 .cd_gpio = 167,
764};
765
766static struct resource sdhi0_resources[] = {
767 {
768 .name = "SDHI0",
769 .start = 0xe6850000,
770 .end = 0xe6850100 - 1,
771 .flags = IORESOURCE_MEM,
772 },
773 /*
774 * no SH_MOBILE_SDHI_IRQ_CARD_DETECT here
775 */
776 {
777 .name = SH_MOBILE_SDHI_IRQ_SDCARD,
778 .start = gic_spi(118),
779 .flags = IORESOURCE_IRQ,
780 },
781 {
782 .name = SH_MOBILE_SDHI_IRQ_SDIO,
783 .start = gic_spi(119),
784 .flags = IORESOURCE_IRQ,
785 },
786};
787
788static struct platform_device sdhi0_device = {
789 .name = "sh_mobile_sdhi",
790 .id = 0,
791 .dev = {
792 .platform_data = &sdhi0_info,
793 },
794 .num_resources = ARRAY_SIZE(sdhi0_resources),
795 .resource = sdhi0_resources,
796};
797
798/* SDHI1 */
799static struct tmio_mmc_data sdhi1_info = {
800 .chan_priv_tx = (void *)SHDMA_SLAVE_SDHI1_TX,
801 .chan_priv_rx = (void *)SHDMA_SLAVE_SDHI1_RX,
802 .capabilities = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
803 MMC_CAP_POWER_OFF_CARD,
804 .flags = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_USE_GPIO_CD,
805 /* Port72 cannot generate IRQs, will be used in polling mode. */
806 .cd_gpio = 72,
807};
808
809static struct resource sdhi1_resources[] = {
810 [0] = {
811 .name = "SDHI1",
812 .start = 0xe6860000,
813 .end = 0xe6860100 - 1,
814 .flags = IORESOURCE_MEM,
815 },
816 [1] = {
817 .start = gic_spi(121),
818 .flags = IORESOURCE_IRQ,
819 },
820 [2] = {
821 .start = gic_spi(122),
822 .flags = IORESOURCE_IRQ,
823 },
824 [3] = {
825 .start = gic_spi(123),
826 .flags = IORESOURCE_IRQ,
827 },
828};
829
830static struct platform_device sdhi1_device = {
831 .name = "sh_mobile_sdhi",
832 .id = 1,
833 .dev = {
834 .platform_data = &sdhi1_info,
835 },
836 .num_resources = ARRAY_SIZE(sdhi1_resources),
837 .resource = sdhi1_resources,
838};
839
840static const struct pinctrl_map eva_sdhi1_pinctrl_map[] = {
841 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.1", "pfc-r8a7740",
842 "sdhi1_data4", "sdhi1"),
843 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.1", "pfc-r8a7740",
844 "sdhi1_ctrl", "sdhi1"),
845 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.1", "pfc-r8a7740",
846 "sdhi1_cd", "sdhi1"),
847 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.1", "pfc-r8a7740",
848 "sdhi1_wp", "sdhi1"),
849};
850
851/* MMCIF */
852static struct sh_mmcif_plat_data sh_mmcif_plat = {
853 .sup_pclk = 0,
854 .caps = MMC_CAP_4_BIT_DATA |
855 MMC_CAP_8_BIT_DATA |
856 MMC_CAP_NONREMOVABLE,
857 .ccs_unsupported = true,
858 .slave_id_tx = SHDMA_SLAVE_MMCIF_TX,
859 .slave_id_rx = SHDMA_SLAVE_MMCIF_RX,
860};
861
862static struct resource sh_mmcif_resources[] = {
863 [0] = {
864 .name = "MMCIF",
865 .start = 0xe6bd0000,
866 .end = 0xe6bd0100 - 1,
867 .flags = IORESOURCE_MEM,
868 },
869 [1] = {
870 /* MMC ERR */
871 .start = gic_spi(56),
872 .flags = IORESOURCE_IRQ,
873 },
874 [2] = {
875 /* MMC NOR */
876 .start = gic_spi(57),
877 .flags = IORESOURCE_IRQ,
878 },
879};
880
881static struct platform_device sh_mmcif_device = {
882 .name = "sh_mmcif",
883 .id = -1,
884 .dev = {
885 .platform_data = &sh_mmcif_plat,
886 },
887 .num_resources = ARRAY_SIZE(sh_mmcif_resources),
888 .resource = sh_mmcif_resources,
889};
890
891/* Camera */
892static int mt9t111_power(struct device *dev, int mode)
893{
894 struct clk *mclk = clk_get(NULL, "video1");
895
896 if (IS_ERR(mclk)) {
897 dev_err(dev, "can't get video1 clock\n");
898 return -EINVAL;
899 }
900
901 if (mode) {
902 /* video1 (= CON1 camera) expect 24MHz */
903 clk_set_rate(mclk, clk_round_rate(mclk, 24000000));
904 clk_enable(mclk);
905 gpio_set_value(158, 1);
906 } else {
907 gpio_set_value(158, 0);
908 clk_disable(mclk);
909 }
910
911 clk_put(mclk);
912
913 return 0;
914}
915
916static struct i2c_board_info i2c_camera_mt9t111 = {
917 I2C_BOARD_INFO("mt9t112", 0x3d),
918};
919
920static struct mt9t112_camera_info mt9t111_info = {
921 .divider = { 16, 0, 0, 7, 0, 10, 14, 7, 7 },
922};
923
924static struct soc_camera_link mt9t111_link = {
925 .i2c_adapter_id = 0,
926 .bus_id = 0,
927 .board_info = &i2c_camera_mt9t111,
928 .power = mt9t111_power,
929 .priv = &mt9t111_info,
930};
931
932static struct platform_device camera_device = {
933 .name = "soc-camera-pdrv",
934 .id = 0,
935 .dev = {
936 .platform_data = &mt9t111_link,
937 },
938};
939
940/* CEU0 */
941static struct sh_mobile_ceu_info sh_mobile_ceu0_info = {
942 .flags = SH_CEU_FLAG_LOWER_8BIT,
943};
944
945static struct resource ceu0_resources[] = {
946 [0] = {
947 .name = "CEU",
948 .start = 0xfe910000,
949 .end = 0xfe91009f,
950 .flags = IORESOURCE_MEM,
951 },
952 [1] = {
953 .start = gic_spi(160),
954 .flags = IORESOURCE_IRQ,
955 },
956 [2] = {
957 /* place holder for contiguous memory */
958 },
959};
960
961static struct platform_device ceu0_device = {
962 .name = "sh_mobile_ceu",
963 .id = 0,
964 .num_resources = ARRAY_SIZE(ceu0_resources),
965 .resource = ceu0_resources,
966 .dev = {
967 .platform_data = &sh_mobile_ceu0_info,
968 .coherent_dma_mask = 0xffffffff,
969 },
970};
971
972/* FSI */
973static struct sh_fsi_platform_info fsi_info = {
974 /* FSI-WM8978 */
975 .port_a = {
976 .tx_id = SHDMA_SLAVE_FSIA_TX,
977 },
978 /* FSI-HDMI */
979 .port_b = {
980 .flags = SH_FSI_FMT_SPDIF |
981 SH_FSI_ENABLE_STREAM_MODE |
982 SH_FSI_CLK_CPG,
983 .tx_id = SHDMA_SLAVE_FSIB_TX,
984 }
985};
986
987static struct resource fsi_resources[] = {
988 [0] = {
989 .name = "FSI",
990 .start = 0xfe1f0000,
991 .end = 0xfe1f0400 - 1,
992 .flags = IORESOURCE_MEM,
993 },
994 [1] = {
995 .start = gic_spi(9),
996 .flags = IORESOURCE_IRQ,
997 },
998};
999
1000static struct platform_device fsi_device = {
1001 .name = "sh_fsi2",
1002 .id = -1,
1003 .num_resources = ARRAY_SIZE(fsi_resources),
1004 .resource = fsi_resources,
1005 .dev = {
1006 .platform_data = &fsi_info,
1007 },
1008};
1009
1010/* FSI-WM8978 */
1011static struct asoc_simple_card_info fsi_wm8978_info = {
1012 .name = "wm8978",
1013 .card = "FSI2A-WM8978",
1014 .codec = "wm8978.0-001a",
1015 .platform = "sh_fsi2",
1016 .daifmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBM_CFM,
1017 .cpu_dai = {
1018 .name = "fsia-dai",
1019 },
1020 .codec_dai = {
1021 .name = "wm8978-hifi",
1022 .sysclk = 12288000,
1023 },
1024};
1025
1026static struct platform_device fsi_wm8978_device = {
1027 .name = "asoc-simple-card",
1028 .id = 0,
1029 .dev = {
1030 .platform_data = &fsi_wm8978_info,
1031 .coherent_dma_mask = DMA_BIT_MASK(32),
1032 .dma_mask = &fsi_wm8978_device.dev.coherent_dma_mask,
1033 },
1034};
1035
1036/* FSI-HDMI */
1037static struct asoc_simple_card_info fsi2_hdmi_info = {
1038 .name = "HDMI",
1039 .card = "FSI2B-HDMI",
1040 .codec = "sh-mobile-hdmi",
1041 .platform = "sh_fsi2",
1042 .daifmt = SND_SOC_DAIFMT_CBS_CFS,
1043 .cpu_dai = {
1044 .name = "fsib-dai",
1045 },
1046 .codec_dai = {
1047 .name = "sh_mobile_hdmi-hifi",
1048 },
1049};
1050
1051static struct platform_device fsi_hdmi_device = {
1052 .name = "asoc-simple-card",
1053 .id = 1,
1054 .dev = {
1055 .platform_data = &fsi2_hdmi_info,
1056 .coherent_dma_mask = DMA_BIT_MASK(32),
1057 .dma_mask = &fsi_hdmi_device.dev.coherent_dma_mask,
1058 },
1059};
1060
1061/* RTC: RTC connects i2c-gpio. */
1062static struct i2c_gpio_platform_data i2c_gpio_data = {
1063 .sda_pin = 208,
1064 .scl_pin = 91,
1065 .udelay = 5, /* 100 kHz */
1066};
1067
1068static struct platform_device i2c_gpio_device = {
1069 .name = "i2c-gpio",
1070 .id = 2,
1071 .dev = {
1072 .platform_data = &i2c_gpio_data,
1073 },
1074};
1075
1076/* I2C */
1077static struct st1232_pdata st1232_i2c0_pdata = {
1078 .reset_gpio = 166,
1079};
1080
1081static struct i2c_board_info i2c0_devices[] = {
1082 {
1083 I2C_BOARD_INFO("st1232-ts", 0x55),
1084 .irq = irq_pin(10),
1085 .platform_data = &st1232_i2c0_pdata,
1086 },
1087 {
1088 I2C_BOARD_INFO("wm8978", 0x1a),
1089 },
1090};
1091
1092static struct i2c_board_info i2c2_devices[] = {
1093 {
1094 I2C_BOARD_INFO("s35390a", 0x30),
1095 .type = "s35390a",
1096 },
1097};
1098
1099/*
1100 * board devices
1101 */
1102static struct platform_device *eva_devices[] __initdata = {
1103 &lcdc0_device,
1104 &pwm_device,
1105 &pwm_backlight_device,
1106 &leds_gpio_device,
1107 &gpio_keys_device,
1108 &sh_eth_device,
1109 &vcc_sdhi0,
1110 &vccq_sdhi0,
1111 &sdhi0_device,
1112 &sh_mmcif_device,
1113 &hdmi_device,
1114 &hdmi_lcdc_device,
1115 &camera_device,
1116 &ceu0_device,
1117 &fsi_device,
1118 &fsi_wm8978_device,
1119 &fsi_hdmi_device,
1120 &i2c_gpio_device,
1121};
1122
1123static const struct pinctrl_map eva_pinctrl_map[] = {
1124 /* CEU0 */
1125 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_ceu.0", "pfc-r8a7740",
1126 "ceu0_data_0_7", "ceu0"),
1127 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_ceu.0", "pfc-r8a7740",
1128 "ceu0_clk_0", "ceu0"),
1129 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_ceu.0", "pfc-r8a7740",
1130 "ceu0_sync", "ceu0"),
1131 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_ceu.0", "pfc-r8a7740",
1132 "ceu0_field", "ceu0"),
1133 /* FSIA */
1134 PIN_MAP_MUX_GROUP_DEFAULT("asoc-simple-card.0", "pfc-r8a7740",
1135 "fsia_sclk_in", "fsia"),
1136 PIN_MAP_MUX_GROUP_DEFAULT("asoc-simple-card.0", "pfc-r8a7740",
1137 "fsia_mclk_out", "fsia"),
1138 PIN_MAP_MUX_GROUP_DEFAULT("asoc-simple-card.0", "pfc-r8a7740",
1139 "fsia_data_in_1", "fsia"),
1140 PIN_MAP_MUX_GROUP_DEFAULT("asoc-simple-card.0", "pfc-r8a7740",
1141 "fsia_data_out_0", "fsia"),
1142 /* FSIB */
1143 PIN_MAP_MUX_GROUP_DEFAULT("asoc-simple-card.1", "pfc-r8a7740",
1144 "fsib_mclk_in", "fsib"),
1145 /* GETHER */
1146 PIN_MAP_MUX_GROUP_DEFAULT("r8a7740-gether", "pfc-r8a7740",
1147 "gether_mii", "gether"),
1148 PIN_MAP_MUX_GROUP_DEFAULT("r8a7740-gether", "pfc-r8a7740",
1149 "gether_int", "gether"),
1150 /* HDMI */
1151 PIN_MAP_MUX_GROUP_DEFAULT("sh-mobile-hdmi", "pfc-r8a7740",
1152 "hdmi", "hdmi"),
1153 /* LCD0 */
1154 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_lcdc_fb.0", "pfc-r8a7740",
1155 "lcd0_data24_0", "lcd0"),
1156 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_lcdc_fb.0", "pfc-r8a7740",
1157 "lcd0_lclk_1", "lcd0"),
1158 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_lcdc_fb.0", "pfc-r8a7740",
1159 "lcd0_sync", "lcd0"),
1160 /* MMCIF */
1161 PIN_MAP_MUX_GROUP_DEFAULT("sh_mmcif.0", "pfc-r8a7740",
1162 "mmc0_data8_1", "mmc0"),
1163 PIN_MAP_MUX_GROUP_DEFAULT("sh_mmcif.0", "pfc-r8a7740",
1164 "mmc0_ctrl_1", "mmc0"),
1165 /* SCIFA1 */
1166 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.1", "pfc-r8a7740",
1167 "scifa1_data", "scifa1"),
1168 /* SDHI0 */
1169 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7740",
1170 "sdhi0_data4", "sdhi0"),
1171 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7740",
1172 "sdhi0_ctrl", "sdhi0"),
1173 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7740",
1174 "sdhi0_wp", "sdhi0"),
1175 /* ST1232 */
1176 PIN_MAP_MUX_GROUP_DEFAULT("0-0055", "pfc-r8a7740",
1177 "intc_irq10", "intc"),
1178 /* TPU0 */
1179 PIN_MAP_MUX_GROUP_DEFAULT("renesas-tpu-pwm", "pfc-r8a7740",
1180 "tpu0_to2_1", "tpu0"),
1181 /* USBHS */
1182 PIN_MAP_MUX_GROUP_DEFAULT("renesas_usbhs", "pfc-r8a7740",
1183 "intc_irq7_1", "intc"),
1184};
1185
1186static void __init eva_clock_init(void)
1187{
1188 struct clk *system = clk_get(NULL, "system_clk");
1189 struct clk *xtal1 = clk_get(NULL, "extal1");
1190 struct clk *usb24s = clk_get(NULL, "usb24s");
1191 struct clk *fsibck = clk_get(NULL, "fsibck");
1192
1193 if (IS_ERR(system) ||
1194 IS_ERR(xtal1) ||
1195 IS_ERR(usb24s) ||
1196 IS_ERR(fsibck)) {
1197 pr_err("armadillo800eva board clock init failed\n");
1198 goto clock_error;
1199 }
1200
1201 /* armadillo 800 eva extal1 is 24MHz */
1202 clk_set_rate(xtal1, 24000000);
1203
1204 /* usb24s use extal1 (= system) clock (= 24MHz) */
1205 clk_set_parent(usb24s, system);
1206
1207 /* FSIBCK is 12.288MHz, and it is parent of FSI-B */
1208 clk_set_rate(fsibck, 12288000);
1209
1210clock_error:
1211 if (!IS_ERR(system))
1212 clk_put(system);
1213 if (!IS_ERR(xtal1))
1214 clk_put(xtal1);
1215 if (!IS_ERR(usb24s))
1216 clk_put(usb24s);
1217 if (!IS_ERR(fsibck))
1218 clk_put(fsibck);
1219}
1220
1221/*
1222 * board init
1223 */
1224#define GPIO_PORT7CR IOMEM(0xe6050007)
1225#define GPIO_PORT8CR IOMEM(0xe6050008)
1226static void __init eva_init(void)
1227{
1228 static struct pm_domain_device domain_devices[] __initdata = {
1229 { "A4LC", &lcdc0_device },
1230 { "A4LC", &hdmi_lcdc_device },
1231 { "A4MP", &hdmi_device },
1232 { "A4MP", &fsi_device },
1233 { "A4R", &ceu0_device },
1234 { "A4S", &sh_eth_device },
1235 { "A3SP", &pwm_device },
1236 { "A3SP", &sdhi0_device },
1237 { "A3SP", &sh_mmcif_device },
1238 };
1239 struct platform_device *usb = NULL, *sdhi1 = NULL;
1240
1241 regulator_register_always_on(0, "fixed-3.3V", fixed3v3_power_consumers,
1242 ARRAY_SIZE(fixed3v3_power_consumers), 3300000);
1243 regulator_register_always_on(3, "fixed-5.0V", fixed5v0_power_consumers,
1244 ARRAY_SIZE(fixed5v0_power_consumers), 5000000);
1245
1246 pinctrl_register_mappings(eva_pinctrl_map, ARRAY_SIZE(eva_pinctrl_map));
1247 pwm_add_table(pwm_lookup, ARRAY_SIZE(pwm_lookup));
1248
1249 r8a7740_pinmux_init();
1250 r8a7740_meram_workaround();
1251
1252 /* GETHER */
1253 gpio_request_one(18, GPIOF_OUT_INIT_HIGH, NULL); /* PHY_RST */
1254
1255 /* USB */
1256 gpio_request_one(159, GPIOF_IN, NULL); /* USB_DEVICE_MODE */
1257
1258 if (gpio_get_value(159)) {
1259 /* USB Host */
1260 } else {
1261 /* USB Func */
1262 /*
1263 * The USBHS interrupt handlers needs to read the IRQ pin value
1264 * (HI/LOW) to diffentiate USB connection and disconnection
1265 * events (usbhsf_get_vbus()). We thus need to select both the
1266 * intc_irq7_1 pin group and GPIO 209 here.
1267 */
1268 gpio_request_one(209, GPIOF_IN, NULL);
1269
1270 platform_device_register(&usbhsf_device);
1271 usb = &usbhsf_device;
1272 }
1273
1274 /* CON1/CON15 Camera */
1275 gpio_request_one(173, GPIOF_OUT_INIT_LOW, NULL); /* STANDBY */
1276 gpio_request_one(172, GPIOF_OUT_INIT_HIGH, NULL); /* RST */
1277 /* see mt9t111_power() */
1278 gpio_request_one(158, GPIOF_OUT_INIT_LOW, NULL); /* CAM_PON */
1279
1280 /* FSI-WM8978 */
1281 gpio_request(7, NULL);
1282 gpio_request(8, NULL);
1283 gpio_direction_none(GPIO_PORT7CR); /* FSIAOBT needs no direction */
1284 gpio_direction_none(GPIO_PORT8CR); /* FSIAOLR needs no direction */
1285
1286 /*
1287 * CAUTION
1288 *
1289 * DBGMD/LCDC0/FSIA MUX
1290 * DBGMD_SELECT_B should be set after setting PFC Function.
1291 */
1292 gpio_request_one(176, GPIOF_OUT_INIT_HIGH, NULL);
1293
1294 /*
1295 * We can switch CON8/CON14 by SW1.5,
1296 * but it needs after DBGMD_SELECT_B
1297 */
1298 gpio_request_one(6, GPIOF_IN, NULL);
1299 if (gpio_get_value(6)) {
1300 /* CON14 enable */
1301 } else {
1302 /* CON8 (SDHI1) enable */
1303 pinctrl_register_mappings(eva_sdhi1_pinctrl_map,
1304 ARRAY_SIZE(eva_sdhi1_pinctrl_map));
1305
1306 platform_device_register(&vcc_sdhi1);
1307 platform_device_register(&sdhi1_device);
1308 sdhi1 = &sdhi1_device;
1309 }
1310
1311
1312#ifdef CONFIG_CACHE_L2X0
1313 /* Shared attribute override enable, 32K*8way */
1314 l2x0_init(IOMEM(0xf0002000), 0x00400000, 0xc20f0fff);
1315#endif
1316
1317 i2c_register_board_info(0, i2c0_devices, ARRAY_SIZE(i2c0_devices));
1318 i2c_register_board_info(2, i2c2_devices, ARRAY_SIZE(i2c2_devices));
1319
1320 r8a7740_add_standard_devices();
1321
1322 platform_add_devices(eva_devices,
1323 ARRAY_SIZE(eva_devices));
1324
1325 rmobile_add_devices_to_domains(domain_devices,
1326 ARRAY_SIZE(domain_devices));
1327 if (usb)
1328 rmobile_add_device_to_domain("A3SP", usb);
1329 if (sdhi1)
1330 rmobile_add_device_to_domain("A3SP", sdhi1);
1331
1332 r8a7740_pm_init();
1333}
1334
1335static void __init eva_earlytimer_init(void)
1336{
1337 r8a7740_clock_init(MD_CK0 | MD_CK2);
1338 shmobile_earlytimer_init();
1339
1340 /* the rate of extal1 clock must be set before late_time_init */
1341 eva_clock_init();
1342}
1343
1344#define RESCNT2 IOMEM(0xe6188020)
1345static void eva_restart(enum reboot_mode mode, const char *cmd)
1346{
1347 /* Do soft power on reset */
1348 writel((1 << 31), RESCNT2);
1349}
1350
1351static const char *eva_boards_compat_dt[] __initdata = {
1352 "renesas,armadillo800eva",
1353 NULL,
1354};
1355
1356DT_MACHINE_START(ARMADILLO800EVA_DT, "armadillo800eva")
1357 .map_io = r8a7740_map_io,
1358 .init_early = r8a7740_add_early_devices,
1359 .init_irq = r8a7740_init_irq_of,
1360 .init_machine = eva_init,
1361 .init_late = shmobile_init_late,
1362 .init_time = eva_earlytimer_init,
1363 .dt_compat = eva_boards_compat_dt,
1364 .restart = eva_restart,
1365MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-bockw-reference.c b/arch/arm/mach-shmobile/board-bockw-reference.c
index 9a74efda3d18..4f78296f7d04 100644
--- a/arch/arm/mach-shmobile/board-bockw-reference.c
+++ b/arch/arm/mach-shmobile/board-bockw-reference.c
@@ -72,7 +72,7 @@ static void __init bockw_init(void)
72 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 72 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
73} 73}
74 74
75static const char *bockw_boards_compat_dt[] __initdata = { 75static const char *const bockw_boards_compat_dt[] __initconst = {
76 "renesas,bockw-reference", 76 "renesas,bockw-reference",
77 NULL, 77 NULL,
78}; 78};
diff --git a/arch/arm/mach-shmobile/board-bockw.c b/arch/arm/mach-shmobile/board-bockw.c
index 25558d1f417f..25a0e7233fe4 100644
--- a/arch/arm/mach-shmobile/board-bockw.c
+++ b/arch/arm/mach-shmobile/board-bockw.c
@@ -723,7 +723,7 @@ static void __init bockw_init_late(void)
723 ADD_USB_FUNC_DEVICE_IF_POSSIBLE(); 723 ADD_USB_FUNC_DEVICE_IF_POSSIBLE();
724} 724}
725 725
726static const char *bockw_boards_compat_dt[] __initdata = { 726static const char *const bockw_boards_compat_dt[] __initconst = {
727 "renesas,bockw", 727 "renesas,bockw",
728 NULL, 728 NULL,
729}; 729};
diff --git a/arch/arm/mach-shmobile/board-kzm9g.c b/arch/arm/mach-shmobile/board-kzm9g.c
deleted file mode 100644
index 260d8319fd82..000000000000
--- a/arch/arm/mach-shmobile/board-kzm9g.c
+++ /dev/null
@@ -1,916 +0,0 @@
1/*
2 * KZM-A9-GT board support
3 *
4 * Copyright (C) 2012 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#include <linux/delay.h>
17#include <linux/gpio.h>
18#include <linux/gpio_keys.h>
19#include <linux/io.h>
20#include <linux/irq.h>
21#include <linux/i2c.h>
22#include <linux/i2c/pcf857x.h>
23#include <linux/input.h>
24#include <linux/irqchip/arm-gic.h>
25#include <linux/mmc/host.h>
26#include <linux/mmc/sh_mmcif.h>
27#include <linux/mmc/sh_mobile_sdhi.h>
28#include <linux/mfd/as3711.h>
29#include <linux/mfd/tmio.h>
30#include <linux/pinctrl/machine.h>
31#include <linux/pinctrl/pinconf-generic.h>
32#include <linux/platform_device.h>
33#include <linux/reboot.h>
34#include <linux/regulator/fixed.h>
35#include <linux/regulator/machine.h>
36#include <linux/smsc911x.h>
37#include <linux/usb/r8a66597.h>
38#include <linux/usb/renesas_usbhs.h>
39#include <linux/videodev2.h>
40
41#include <sound/sh_fsi.h>
42#include <sound/simple_card.h>
43#include <asm/hardware/cache-l2x0.h>
44#include <asm/mach-types.h>
45#include <asm/mach/arch.h>
46#include <video/sh_mobile_lcdc.h>
47
48#include "common.h"
49#include "intc.h"
50#include "irqs.h"
51#include "sh73a0.h"
52
53/*
54 * external GPIO
55 */
56#define GPIO_PCF8575_BASE (310)
57#define GPIO_PCF8575_PORT10 (GPIO_PCF8575_BASE + 8)
58#define GPIO_PCF8575_PORT11 (GPIO_PCF8575_BASE + 9)
59#define GPIO_PCF8575_PORT12 (GPIO_PCF8575_BASE + 10)
60#define GPIO_PCF8575_PORT13 (GPIO_PCF8575_BASE + 11)
61#define GPIO_PCF8575_PORT14 (GPIO_PCF8575_BASE + 12)
62#define GPIO_PCF8575_PORT15 (GPIO_PCF8575_BASE + 13)
63#define GPIO_PCF8575_PORT16 (GPIO_PCF8575_BASE + 14)
64
65/* Dummy supplies, where voltage doesn't matter */
66static struct regulator_consumer_supply dummy_supplies[] = {
67 REGULATOR_SUPPLY("vddvario", "smsc911x.0"),
68 REGULATOR_SUPPLY("vdd33a", "smsc911x.0"),
69};
70
71/*
72 * FSI-AK4648
73 *
74 * this command is required when playback.
75 *
76 * # amixer set "LINEOUT Mixer DACL" on
77 */
78
79/* SMSC 9221 */
80static struct resource smsc9221_resources[] = {
81 [0] = {
82 .start = 0x10000000, /* CS4 */
83 .end = 0x100000ff,
84 .flags = IORESOURCE_MEM,
85 },
86 [1] = {
87 .start = irq_pin(3), /* IRQ3 */
88 .flags = IORESOURCE_IRQ,
89 },
90};
91
92static struct smsc911x_platform_config smsc9221_platdata = {
93 .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS,
94 .phy_interface = PHY_INTERFACE_MODE_MII,
95 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
96 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
97};
98
99static struct platform_device smsc_device = {
100 .name = "smsc911x",
101 .dev = {
102 .platform_data = &smsc9221_platdata,
103 },
104 .resource = smsc9221_resources,
105 .num_resources = ARRAY_SIZE(smsc9221_resources),
106};
107
108/* USB external chip */
109static struct r8a66597_platdata usb_host_data = {
110 .on_chip = 0,
111 .xtal = R8A66597_PLATDATA_XTAL_48MHZ,
112};
113
114static struct resource usb_resources[] = {
115 [0] = {
116 .start = 0x10010000,
117 .end = 0x1001ffff - 1,
118 .flags = IORESOURCE_MEM,
119 },
120 [1] = {
121 .start = irq_pin(1), /* IRQ1 */
122 .flags = IORESOURCE_IRQ,
123 },
124};
125
126static struct platform_device usb_host_device = {
127 .name = "r8a66597_hcd",
128 .dev = {
129 .platform_data = &usb_host_data,
130 .dma_mask = NULL,
131 .coherent_dma_mask = 0xffffffff,
132 },
133 .num_resources = ARRAY_SIZE(usb_resources),
134 .resource = usb_resources,
135};
136
137/* USB Func CN17 */
138struct usbhs_private {
139 void __iomem *phy;
140 void __iomem *cr2;
141 struct renesas_usbhs_platform_info info;
142};
143
144#define IRQ15 irq_pin(15)
145#define USB_PHY_MODE (1 << 4)
146#define USB_PHY_INT_EN ((1 << 3) | (1 << 2))
147#define USB_PHY_ON (1 << 1)
148#define USB_PHY_OFF (1 << 0)
149#define USB_PHY_INT_CLR (USB_PHY_ON | USB_PHY_OFF)
150
151#define usbhs_get_priv(pdev) \
152 container_of(renesas_usbhs_get_info(pdev), struct usbhs_private, info)
153
154static int usbhs_get_vbus(struct platform_device *pdev)
155{
156 struct usbhs_private *priv = usbhs_get_priv(pdev);
157
158 return !((1 << 7) & __raw_readw(priv->cr2));
159}
160
161static int usbhs_phy_reset(struct platform_device *pdev)
162{
163 struct usbhs_private *priv = usbhs_get_priv(pdev);
164
165 /* init phy */
166 __raw_writew(0x8a0a, priv->cr2);
167
168 return 0;
169}
170
171static int usbhs_get_id(struct platform_device *pdev)
172{
173 return USBHS_GADGET;
174}
175
176static irqreturn_t usbhs_interrupt(int irq, void *data)
177{
178 struct platform_device *pdev = data;
179 struct usbhs_private *priv = usbhs_get_priv(pdev);
180
181 renesas_usbhs_call_notify_hotplug(pdev);
182
183 /* clear status */
184 __raw_writew(__raw_readw(priv->phy) | USB_PHY_INT_CLR, priv->phy);
185
186 return IRQ_HANDLED;
187}
188
189static int usbhs_hardware_init(struct platform_device *pdev)
190{
191 struct usbhs_private *priv = usbhs_get_priv(pdev);
192 int ret;
193
194 /* clear interrupt status */
195 __raw_writew(USB_PHY_MODE | USB_PHY_INT_CLR, priv->phy);
196
197 ret = request_irq(IRQ15, usbhs_interrupt, IRQF_TRIGGER_HIGH,
198 dev_name(&pdev->dev), pdev);
199 if (ret) {
200 dev_err(&pdev->dev, "request_irq err\n");
201 return ret;
202 }
203
204 /* enable USB phy interrupt */
205 __raw_writew(USB_PHY_MODE | USB_PHY_INT_EN, priv->phy);
206
207 return 0;
208}
209
210static int usbhs_hardware_exit(struct platform_device *pdev)
211{
212 struct usbhs_private *priv = usbhs_get_priv(pdev);
213
214 /* clear interrupt status */
215 __raw_writew(USB_PHY_MODE | USB_PHY_INT_CLR, priv->phy);
216
217 free_irq(IRQ15, pdev);
218
219 return 0;
220}
221
222static u32 usbhs_pipe_cfg[] = {
223 USB_ENDPOINT_XFER_CONTROL,
224 USB_ENDPOINT_XFER_ISOC,
225 USB_ENDPOINT_XFER_ISOC,
226 USB_ENDPOINT_XFER_BULK,
227 USB_ENDPOINT_XFER_BULK,
228 USB_ENDPOINT_XFER_BULK,
229 USB_ENDPOINT_XFER_INT,
230 USB_ENDPOINT_XFER_INT,
231 USB_ENDPOINT_XFER_INT,
232 USB_ENDPOINT_XFER_BULK,
233 USB_ENDPOINT_XFER_BULK,
234 USB_ENDPOINT_XFER_BULK,
235 USB_ENDPOINT_XFER_BULK,
236 USB_ENDPOINT_XFER_BULK,
237 USB_ENDPOINT_XFER_BULK,
238 USB_ENDPOINT_XFER_BULK,
239};
240
241static struct usbhs_private usbhs_private = {
242 .phy = IOMEM(0xe60781e0), /* USBPHYINT */
243 .cr2 = IOMEM(0xe605810c), /* USBCR2 */
244 .info = {
245 .platform_callback = {
246 .hardware_init = usbhs_hardware_init,
247 .hardware_exit = usbhs_hardware_exit,
248 .get_id = usbhs_get_id,
249 .phy_reset = usbhs_phy_reset,
250 .get_vbus = usbhs_get_vbus,
251 },
252 .driver_param = {
253 .buswait_bwait = 4,
254 .has_otg = 1,
255 .pipe_type = usbhs_pipe_cfg,
256 .pipe_size = ARRAY_SIZE(usbhs_pipe_cfg),
257 },
258 },
259};
260
261static struct resource usbhs_resources[] = {
262 [0] = {
263 .start = 0xE6890000,
264 .end = 0xE68900e6 - 1,
265 .flags = IORESOURCE_MEM,
266 },
267 [1] = {
268 .start = gic_spi(62),
269 .end = gic_spi(62),
270 .flags = IORESOURCE_IRQ,
271 },
272};
273
274static struct platform_device usbhs_device = {
275 .name = "renesas_usbhs",
276 .id = -1,
277 .dev = {
278 .dma_mask = NULL,
279 .coherent_dma_mask = 0xffffffff,
280 .platform_data = &usbhs_private.info,
281 },
282 .num_resources = ARRAY_SIZE(usbhs_resources),
283 .resource = usbhs_resources,
284};
285
286/* LCDC */
287static struct fb_videomode kzm_lcdc_mode = {
288 .name = "WVGA Panel",
289 .xres = 800,
290 .yres = 480,
291 .left_margin = 220,
292 .right_margin = 110,
293 .hsync_len = 70,
294 .upper_margin = 20,
295 .lower_margin = 5,
296 .vsync_len = 5,
297 .sync = 0,
298};
299
300static struct sh_mobile_lcdc_info lcdc_info = {
301 .clock_source = LCDC_CLK_BUS,
302 .ch[0] = {
303 .chan = LCDC_CHAN_MAINLCD,
304 .fourcc = V4L2_PIX_FMT_RGB565,
305 .interface_type = RGB24,
306 .lcd_modes = &kzm_lcdc_mode,
307 .num_modes = 1,
308 .clock_divider = 5,
309 .flags = 0,
310 .panel_cfg = {
311 .width = 152,
312 .height = 91,
313 },
314 }
315};
316
317static struct resource lcdc_resources[] = {
318 [0] = {
319 .name = "LCDC",
320 .start = 0xfe940000,
321 .end = 0xfe943fff,
322 .flags = IORESOURCE_MEM,
323 },
324 [1] = {
325 .start = intcs_evt2irq(0x580),
326 .flags = IORESOURCE_IRQ,
327 },
328};
329
330static struct platform_device lcdc_device = {
331 .name = "sh_mobile_lcdc_fb",
332 .num_resources = ARRAY_SIZE(lcdc_resources),
333 .resource = lcdc_resources,
334 .dev = {
335 .platform_data = &lcdc_info,
336 .coherent_dma_mask = DMA_BIT_MASK(32),
337 },
338};
339
340/* Fixed 1.8V regulator to be used by MMCIF */
341static struct regulator_consumer_supply fixed1v8_power_consumers[] =
342{
343 REGULATOR_SUPPLY("vmmc", "sh_mmcif.0"),
344 REGULATOR_SUPPLY("vqmmc", "sh_mmcif.0"),
345};
346
347/* MMCIF */
348static struct resource sh_mmcif_resources[] = {
349 [0] = {
350 .name = "MMCIF",
351 .start = 0xe6bd0000,
352 .end = 0xe6bd00ff,
353 .flags = IORESOURCE_MEM,
354 },
355 [1] = {
356 .start = gic_spi(140),
357 .flags = IORESOURCE_IRQ,
358 },
359 [2] = {
360 .start = gic_spi(141),
361 .flags = IORESOURCE_IRQ,
362 },
363};
364
365static struct sh_mmcif_plat_data sh_mmcif_platdata = {
366 .ocr = MMC_VDD_165_195,
367 .caps = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE,
368 .ccs_unsupported = true,
369 .slave_id_tx = SHDMA_SLAVE_MMCIF_TX,
370 .slave_id_rx = SHDMA_SLAVE_MMCIF_RX,
371};
372
373static struct platform_device mmc_device = {
374 .name = "sh_mmcif",
375 .dev = {
376 .dma_mask = NULL,
377 .coherent_dma_mask = 0xffffffff,
378 .platform_data = &sh_mmcif_platdata,
379 },
380 .num_resources = ARRAY_SIZE(sh_mmcif_resources),
381 .resource = sh_mmcif_resources,
382};
383
384/* Fixed 3.3V regulators to be used by SDHI0 */
385static struct regulator_consumer_supply vcc_sdhi0_consumers[] =
386{
387 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"),
388};
389
390static struct regulator_init_data vcc_sdhi0_init_data = {
391 .constraints = {
392 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
393 },
394 .num_consumer_supplies = ARRAY_SIZE(vcc_sdhi0_consumers),
395 .consumer_supplies = vcc_sdhi0_consumers,
396};
397
398static struct fixed_voltage_config vcc_sdhi0_info = {
399 .supply_name = "SDHI0 Vcc",
400 .microvolts = 3300000,
401 .gpio = 15,
402 .enable_high = 1,
403 .init_data = &vcc_sdhi0_init_data,
404};
405
406static struct platform_device vcc_sdhi0 = {
407 .name = "reg-fixed-voltage",
408 .id = 0,
409 .dev = {
410 .platform_data = &vcc_sdhi0_info,
411 },
412};
413
414/* Fixed 3.3V regulators to be used by SDHI2 */
415static struct regulator_consumer_supply vcc_sdhi2_consumers[] =
416{
417 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.2"),
418};
419
420static struct regulator_init_data vcc_sdhi2_init_data = {
421 .constraints = {
422 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
423 },
424 .num_consumer_supplies = ARRAY_SIZE(vcc_sdhi2_consumers),
425 .consumer_supplies = vcc_sdhi2_consumers,
426};
427
428static struct fixed_voltage_config vcc_sdhi2_info = {
429 .supply_name = "SDHI2 Vcc",
430 .microvolts = 3300000,
431 .gpio = 14,
432 .enable_high = 1,
433 .init_data = &vcc_sdhi2_init_data,
434};
435
436static struct platform_device vcc_sdhi2 = {
437 .name = "reg-fixed-voltage",
438 .id = 1,
439 .dev = {
440 .platform_data = &vcc_sdhi2_info,
441 },
442};
443
444/* SDHI */
445static struct tmio_mmc_data sdhi0_info = {
446 .chan_priv_tx = (void *)SHDMA_SLAVE_SDHI0_TX,
447 .chan_priv_rx = (void *)SHDMA_SLAVE_SDHI0_RX,
448 .flags = TMIO_MMC_HAS_IDLE_WAIT,
449 .capabilities = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
450 MMC_CAP_POWER_OFF_CARD,
451};
452
453static struct resource sdhi0_resources[] = {
454 [0] = {
455 .name = "SDHI0",
456 .start = 0xee100000,
457 .end = 0xee1000ff,
458 .flags = IORESOURCE_MEM,
459 },
460 [1] = {
461 .name = SH_MOBILE_SDHI_IRQ_CARD_DETECT,
462 .start = gic_spi(83),
463 .flags = IORESOURCE_IRQ,
464 },
465 [2] = {
466 .name = SH_MOBILE_SDHI_IRQ_SDCARD,
467 .start = gic_spi(84),
468 .flags = IORESOURCE_IRQ,
469 },
470 [3] = {
471 .name = SH_MOBILE_SDHI_IRQ_SDIO,
472 .start = gic_spi(85),
473 .flags = IORESOURCE_IRQ,
474 },
475};
476
477static struct platform_device sdhi0_device = {
478 .name = "sh_mobile_sdhi",
479 .num_resources = ARRAY_SIZE(sdhi0_resources),
480 .resource = sdhi0_resources,
481 .dev = {
482 .platform_data = &sdhi0_info,
483 },
484};
485
486/* Micro SD */
487static struct tmio_mmc_data sdhi2_info = {
488 .chan_priv_tx = (void *)SHDMA_SLAVE_SDHI2_TX,
489 .chan_priv_rx = (void *)SHDMA_SLAVE_SDHI2_RX,
490 .flags = TMIO_MMC_HAS_IDLE_WAIT |
491 TMIO_MMC_USE_GPIO_CD |
492 TMIO_MMC_WRPROTECT_DISABLE,
493 .capabilities = MMC_CAP_SD_HIGHSPEED | MMC_CAP_POWER_OFF_CARD,
494 .cd_gpio = 13,
495};
496
497static struct resource sdhi2_resources[] = {
498 [0] = {
499 .name = "SDHI2",
500 .start = 0xee140000,
501 .end = 0xee1400ff,
502 .flags = IORESOURCE_MEM,
503 },
504 [1] = {
505 .name = SH_MOBILE_SDHI_IRQ_CARD_DETECT,
506 .start = gic_spi(103),
507 .flags = IORESOURCE_IRQ,
508 },
509 [2] = {
510 .name = SH_MOBILE_SDHI_IRQ_SDCARD,
511 .start = gic_spi(104),
512 .flags = IORESOURCE_IRQ,
513 },
514 [3] = {
515 .name = SH_MOBILE_SDHI_IRQ_SDIO,
516 .start = gic_spi(105),
517 .flags = IORESOURCE_IRQ,
518 },
519};
520
521static struct platform_device sdhi2_device = {
522 .name = "sh_mobile_sdhi",
523 .id = 2,
524 .num_resources = ARRAY_SIZE(sdhi2_resources),
525 .resource = sdhi2_resources,
526 .dev = {
527 .platform_data = &sdhi2_info,
528 },
529};
530
531/* KEY */
532#define GPIO_KEY(c, g, d) { .code = c, .gpio = g, .desc = d, .active_low = 1 }
533
534static struct gpio_keys_button gpio_buttons[] = {
535 GPIO_KEY(KEY_BACK, GPIO_PCF8575_PORT10, "SW3"),
536 GPIO_KEY(KEY_RIGHT, GPIO_PCF8575_PORT11, "SW2-R"),
537 GPIO_KEY(KEY_LEFT, GPIO_PCF8575_PORT12, "SW2-L"),
538 GPIO_KEY(KEY_ENTER, GPIO_PCF8575_PORT13, "SW2-P"),
539 GPIO_KEY(KEY_UP, GPIO_PCF8575_PORT14, "SW2-U"),
540 GPIO_KEY(KEY_DOWN, GPIO_PCF8575_PORT15, "SW2-D"),
541 GPIO_KEY(KEY_HOME, GPIO_PCF8575_PORT16, "SW1"),
542};
543
544static struct gpio_keys_platform_data gpio_key_info = {
545 .buttons = gpio_buttons,
546 .nbuttons = ARRAY_SIZE(gpio_buttons),
547};
548
549static struct platform_device gpio_keys_device = {
550 .name = "gpio-keys",
551 .dev = {
552 .platform_data = &gpio_key_info,
553 },
554};
555
556/* FSI-AK4648 */
557static struct sh_fsi_platform_info fsi_info = {
558 .port_a = {
559 .tx_id = SHDMA_SLAVE_FSI2A_TX,
560 },
561};
562
563static struct resource fsi_resources[] = {
564 [0] = {
565 .name = "FSI",
566 .start = 0xEC230000,
567 .end = 0xEC230400 - 1,
568 .flags = IORESOURCE_MEM,
569 },
570 [1] = {
571 .start = gic_spi(146),
572 .flags = IORESOURCE_IRQ,
573 },
574};
575
576static struct platform_device fsi_device = {
577 .name = "sh_fsi2",
578 .id = -1,
579 .num_resources = ARRAY_SIZE(fsi_resources),
580 .resource = fsi_resources,
581 .dev = {
582 .platform_data = &fsi_info,
583 },
584};
585
586static struct asoc_simple_card_info fsi2_ak4648_info = {
587 .name = "AK4648",
588 .card = "FSI2A-AK4648",
589 .codec = "ak4642-codec.0-0012",
590 .platform = "sh_fsi2",
591 .daifmt = SND_SOC_DAIFMT_LEFT_J | SND_SOC_DAIFMT_CBM_CFM,
592 .cpu_dai = {
593 .name = "fsia-dai",
594 },
595 .codec_dai = {
596 .name = "ak4642-hifi",
597 .sysclk = 11289600,
598 },
599};
600
601static struct platform_device fsi_ak4648_device = {
602 .name = "asoc-simple-card",
603 .dev = {
604 .platform_data = &fsi2_ak4648_info,
605 .coherent_dma_mask = DMA_BIT_MASK(32),
606 .dma_mask = &fsi_ak4648_device.dev.coherent_dma_mask,
607 },
608};
609
610/* I2C */
611
612/* StepDown1 is used to supply 1.315V to the CPU */
613static struct regulator_init_data as3711_sd1 = {
614 .constraints = {
615 .name = "1.315V CPU",
616 .boot_on = 1,
617 .always_on = 1,
618 .min_uV = 1315000,
619 .max_uV = 1335000,
620 },
621};
622
623/* StepDown2 is used to supply 1.8V to the CPU and to the board */
624static struct regulator_init_data as3711_sd2 = {
625 .constraints = {
626 .name = "1.8V",
627 .boot_on = 1,
628 .always_on = 1,
629 .min_uV = 1800000,
630 .max_uV = 1800000,
631 },
632};
633
634/*
635 * StepDown3 is switched in parallel with StepDown2, seems to be off,
636 * according to read-back pre-set register values
637 */
638
639/* StepDown4 is used to supply 1.215V to the CPU and to the board */
640static struct regulator_init_data as3711_sd4 = {
641 .constraints = {
642 .name = "1.215V",
643 .boot_on = 1,
644 .always_on = 1,
645 .min_uV = 1215000,
646 .max_uV = 1235000,
647 },
648};
649
650/* LDO1 is unused and unconnected */
651
652/* LDO2 is used to supply 2.8V to the CPU */
653static struct regulator_init_data as3711_ldo2 = {
654 .constraints = {
655 .name = "2.8V CPU",
656 .boot_on = 1,
657 .always_on = 1,
658 .min_uV = 2800000,
659 .max_uV = 2800000,
660 },
661};
662
663/* LDO3 is used to supply 3.0V to the CPU */
664static struct regulator_init_data as3711_ldo3 = {
665 .constraints = {
666 .name = "3.0V CPU",
667 .boot_on = 1,
668 .always_on = 1,
669 .min_uV = 3000000,
670 .max_uV = 3000000,
671 },
672};
673
674/* LDO4 is used to supply 2.8V to the board */
675static struct regulator_init_data as3711_ldo4 = {
676 .constraints = {
677 .name = "2.8V",
678 .boot_on = 1,
679 .always_on = 1,
680 .min_uV = 2800000,
681 .max_uV = 2800000,
682 },
683};
684
685/* LDO5 is switched parallel to LDO4, also set to 2.8V */
686static struct regulator_init_data as3711_ldo5 = {
687 .constraints = {
688 .name = "2.8V #2",
689 .boot_on = 1,
690 .always_on = 1,
691 .min_uV = 2800000,
692 .max_uV = 2800000,
693 },
694};
695
696/* LDO6 is unused and unconnected */
697
698/* LDO7 is used to supply 1.15V to the CPU */
699static struct regulator_init_data as3711_ldo7 = {
700 .constraints = {
701 .name = "1.15V CPU",
702 .boot_on = 1,
703 .always_on = 1,
704 .min_uV = 1150000,
705 .max_uV = 1150000,
706 },
707};
708
709/* LDO8 is switched parallel to LDO7, also set to 1.15V */
710static struct regulator_init_data as3711_ldo8 = {
711 .constraints = {
712 .name = "1.15V CPU #2",
713 .boot_on = 1,
714 .always_on = 1,
715 .min_uV = 1150000,
716 .max_uV = 1150000,
717 },
718};
719
720static struct as3711_platform_data as3711_pdata = {
721 .regulator = {
722 .init_data = {
723 [AS3711_REGULATOR_SD_1] = &as3711_sd1,
724 [AS3711_REGULATOR_SD_2] = &as3711_sd2,
725 [AS3711_REGULATOR_SD_4] = &as3711_sd4,
726 [AS3711_REGULATOR_LDO_2] = &as3711_ldo2,
727 [AS3711_REGULATOR_LDO_3] = &as3711_ldo3,
728 [AS3711_REGULATOR_LDO_4] = &as3711_ldo4,
729 [AS3711_REGULATOR_LDO_5] = &as3711_ldo5,
730 [AS3711_REGULATOR_LDO_7] = &as3711_ldo7,
731 [AS3711_REGULATOR_LDO_8] = &as3711_ldo8,
732 },
733 },
734 .backlight = {
735 .su2_fb = "sh_mobile_lcdc_fb.0",
736 .su2_max_uA = 36000,
737 .su2_feedback = AS3711_SU2_CURR_AUTO,
738 .su2_fbprot = AS3711_SU2_GPIO4,
739 .su2_auto_curr1 = true,
740 .su2_auto_curr2 = true,
741 .su2_auto_curr3 = true,
742 },
743};
744
745static struct pcf857x_platform_data pcf8575_pdata = {
746 .gpio_base = GPIO_PCF8575_BASE,
747};
748
749static struct i2c_board_info i2c0_devices[] = {
750 {
751 I2C_BOARD_INFO("ak4648", 0x12),
752 },
753 {
754 I2C_BOARD_INFO("r2025sd", 0x32),
755 },
756 {
757 I2C_BOARD_INFO("ak8975", 0x0c),
758 .irq = irq_pin(28), /* IRQ28 */
759 },
760 {
761 I2C_BOARD_INFO("adxl34x", 0x1d),
762 .irq = irq_pin(26), /* IRQ26 */
763 },
764 {
765 I2C_BOARD_INFO("as3711", 0x40),
766 .irq = intcs_evt2irq(0x3300), /* IRQ24 */
767 .platform_data = &as3711_pdata,
768 },
769};
770
771static struct i2c_board_info i2c1_devices[] = {
772 {
773 I2C_BOARD_INFO("st1232-ts", 0x55),
774 .irq = irq_pin(8), /* IRQ8 */
775 },
776};
777
778static struct i2c_board_info i2c3_devices[] = {
779 {
780 I2C_BOARD_INFO("pcf8575", 0x20),
781 .irq = irq_pin(19), /* IRQ19 */
782 .platform_data = &pcf8575_pdata,
783 },
784};
785
786static struct platform_device *kzm_devices[] __initdata = {
787 &smsc_device,
788 &usb_host_device,
789 &usbhs_device,
790 &lcdc_device,
791 &mmc_device,
792 &vcc_sdhi0,
793 &vcc_sdhi2,
794 &sdhi0_device,
795 &sdhi2_device,
796 &gpio_keys_device,
797 &fsi_device,
798 &fsi_ak4648_device,
799};
800
801static unsigned long pin_pullup_conf[] = {
802 PIN_CONF_PACKED(PIN_CONFIG_BIAS_PULL_UP, 0),
803};
804
805static const struct pinctrl_map kzm_pinctrl_map[] = {
806 /* FSIA (AK4648) */
807 PIN_MAP_MUX_GROUP_DEFAULT("sh_fsi2", "pfc-sh73a0",
808 "fsia_mclk_in", "fsia"),
809 PIN_MAP_MUX_GROUP_DEFAULT("sh_fsi2", "pfc-sh73a0",
810 "fsia_sclk_in", "fsia"),
811 PIN_MAP_MUX_GROUP_DEFAULT("sh_fsi2", "pfc-sh73a0",
812 "fsia_data_in", "fsia"),
813 PIN_MAP_MUX_GROUP_DEFAULT("sh_fsi2", "pfc-sh73a0",
814 "fsia_data_out", "fsia"),
815 /* I2C3 */
816 PIN_MAP_MUX_GROUP_DEFAULT("i2c-sh_mobile.3", "pfc-sh73a0",
817 "i2c3_1", "i2c3"),
818 /* LCD */
819 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_lcdc_fb.0", "pfc-sh73a0",
820 "lcd_data24", "lcd"),
821 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_lcdc_fb.0", "pfc-sh73a0",
822 "lcd_sync", "lcd"),
823 /* MMCIF */
824 PIN_MAP_MUX_GROUP_DEFAULT("sh_mmcif.0", "pfc-sh73a0",
825 "mmc0_data8_0", "mmc0"),
826 PIN_MAP_MUX_GROUP_DEFAULT("sh_mmcif.0", "pfc-sh73a0",
827 "mmc0_ctrl_0", "mmc0"),
828 PIN_MAP_CONFIGS_PIN_DEFAULT("sh_mmcif.0", "pfc-sh73a0",
829 "PORT279", pin_pullup_conf),
830 PIN_MAP_CONFIGS_GROUP_DEFAULT("sh_mmcif.0", "pfc-sh73a0",
831 "mmc0_data8_0", pin_pullup_conf),
832 /* SCIFA4 */
833 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.4", "pfc-sh73a0",
834 "scifa4_data", "scifa4"),
835 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.4", "pfc-sh73a0",
836 "scifa4_ctrl", "scifa4"),
837 /* SDHI0 */
838 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh73a0",
839 "sdhi0_data4", "sdhi0"),
840 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh73a0",
841 "sdhi0_ctrl", "sdhi0"),
842 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh73a0",
843 "sdhi0_cd", "sdhi0"),
844 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh73a0",
845 "sdhi0_wp", "sdhi0"),
846 /* SDHI2 */
847 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.2", "pfc-sh73a0",
848 "sdhi2_data4", "sdhi2"),
849 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.2", "pfc-sh73a0",
850 "sdhi2_ctrl", "sdhi2"),
851 /* SMSC */
852 PIN_MAP_MUX_GROUP_DEFAULT("smsc911x.0", "pfc-sh73a0",
853 "bsc_cs4", "bsc"),
854 /* USB */
855 PIN_MAP_MUX_GROUP_DEFAULT("renesas_usbhs", "pfc-sh73a0",
856 "usb_vbus", "usb"),
857};
858
859static void __init kzm_init(void)
860{
861 regulator_register_always_on(2, "fixed-1.8V", fixed1v8_power_consumers,
862 ARRAY_SIZE(fixed1v8_power_consumers), 1800000);
863 regulator_register_fixed(3, dummy_supplies, ARRAY_SIZE(dummy_supplies));
864
865 pinctrl_register_mappings(kzm_pinctrl_map, ARRAY_SIZE(kzm_pinctrl_map));
866
867 sh73a0_pinmux_init();
868
869 /* SMSC */
870 gpio_request_one(224, GPIOF_IN, NULL); /* IRQ3 */
871
872 /* LCDC */
873 gpio_request_one(222, GPIOF_OUT_INIT_HIGH, NULL); /* LCDCDON */
874 gpio_request_one(226, GPIOF_OUT_INIT_HIGH, NULL); /* SC */
875
876 /* Touchscreen */
877 gpio_request_one(223, GPIOF_IN, NULL); /* IRQ8 */
878
879#ifdef CONFIG_CACHE_L2X0
880 /* Shared attribute override enable, 64K*8way */
881 l2x0_init(IOMEM(0xf0100000), 0x00400000, 0xc20f0fff);
882#endif
883
884 i2c_register_board_info(0, i2c0_devices, ARRAY_SIZE(i2c0_devices));
885 i2c_register_board_info(1, i2c1_devices, ARRAY_SIZE(i2c1_devices));
886 i2c_register_board_info(3, i2c3_devices, ARRAY_SIZE(i2c3_devices));
887
888 sh73a0_add_standard_devices();
889 platform_add_devices(kzm_devices, ARRAY_SIZE(kzm_devices));
890
891 sh73a0_pm_init();
892}
893
894static void kzm9g_restart(enum reboot_mode mode, const char *cmd)
895{
896#define RESCNT2 IOMEM(0xe6188020)
897 /* Do soft power on reset */
898 writel((1 << 31), RESCNT2);
899}
900
901static const char *kzm9g_boards_compat_dt[] __initdata = {
902 "renesas,kzm9g",
903 NULL,
904};
905
906DT_MACHINE_START(KZM9G_DT, "kzm9g")
907 .smp = smp_ops(sh73a0_smp_ops),
908 .map_io = sh73a0_map_io,
909 .init_early = sh73a0_add_early_devices,
910 .init_irq = sh73a0_init_irq,
911 .init_machine = kzm_init,
912 .init_late = shmobile_init_late,
913 .init_time = sh73a0_earlytimer_init,
914 .restart = kzm9g_restart,
915 .dt_compat = kzm9g_boards_compat_dt,
916MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-marzen-reference.c b/arch/arm/mach-shmobile/board-marzen-reference.c
deleted file mode 100644
index b15eb923263f..000000000000
--- a/arch/arm/mach-shmobile/board-marzen-reference.c
+++ /dev/null
@@ -1,56 +0,0 @@
1/*
2 * marzen board support - Reference DT implementation
3 *
4 * Copyright (C) 2011 Renesas Solutions Corp.
5 * Copyright (C) 2011 Magnus Damm
6 * Copyright (C) 2013 Simon Horman
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; version 2 of the License.
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/clk/shmobile.h>
19#include <linux/clocksource.h>
20#include <linux/of_platform.h>
21
22#include <asm/irq.h>
23#include <asm/mach/arch.h>
24
25#include "common.h"
26#include "irqs.h"
27#include "r8a7779.h"
28
29static void __init marzen_init_timer(void)
30{
31 r8a7779_clocks_init(r8a7779_read_mode_pins());
32 clocksource_of_init();
33}
34
35static void __init marzen_init(void)
36{
37 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
38 r8a7779_init_irq_extpin_dt(1); /* IRQ1 as individual interrupt */
39}
40
41static const char *marzen_boards_compat_dt[] __initdata = {
42 "renesas,marzen",
43 "renesas,marzen-reference",
44 NULL,
45};
46
47DT_MACHINE_START(MARZEN, "marzen")
48 .smp = smp_ops(r8a7779_smp_ops),
49 .map_io = r8a7779_map_io,
50 .init_early = shmobile_init_delay,
51 .init_time = marzen_init_timer,
52 .init_irq = r8a7779_init_irq_dt,
53 .init_machine = marzen_init,
54 .init_late = shmobile_init_late,
55 .dt_compat = marzen_boards_compat_dt,
56MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-marzen.c b/arch/arm/mach-shmobile/board-marzen.c
deleted file mode 100644
index 51db288f192a..000000000000
--- a/arch/arm/mach-shmobile/board-marzen.c
+++ /dev/null
@@ -1,347 +0,0 @@
1/*
2 * marzen board support
3 *
4 * Copyright (C) 2011, 2013 Renesas Solutions Corp.
5 * Copyright (C) 2011 Magnus Damm
6 * Copyright (C) 2013 Cogent Embedded, Inc.
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; version 2 of the License.
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/kernel.h>
19#include <linux/init.h>
20#include <linux/interrupt.h>
21#include <linux/irq.h>
22#include <linux/platform_device.h>
23#include <linux/delay.h>
24#include <linux/io.h>
25#include <linux/leds.h>
26#include <linux/dma-mapping.h>
27#include <linux/pinctrl/machine.h>
28#include <linux/platform_data/camera-rcar.h>
29#include <linux/platform_data/gpio-rcar.h>
30#include <linux/platform_data/usb-rcar-phy.h>
31#include <linux/regulator/fixed.h>
32#include <linux/regulator/machine.h>
33#include <linux/smsc911x.h>
34#include <linux/spi/spi.h>
35#include <linux/spi/sh_hspi.h>
36#include <linux/mmc/host.h>
37#include <linux/mmc/sh_mobile_sdhi.h>
38#include <linux/mfd/tmio.h>
39
40#include <media/soc_camera.h>
41#include <asm/mach-types.h>
42#include <asm/mach/arch.h>
43#include <asm/traps.h>
44
45#include "common.h"
46#include "irqs.h"
47#include "r8a7779.h"
48
49/* Fixed 3.3V regulator to be used by SDHI0 */
50static struct regulator_consumer_supply fixed3v3_power_consumers[] = {
51 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"),
52 REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.0"),
53};
54
55/* Dummy supplies, where voltage doesn't matter */
56static struct regulator_consumer_supply dummy_supplies[] = {
57 REGULATOR_SUPPLY("vddvario", "smsc911x"),
58 REGULATOR_SUPPLY("vdd33a", "smsc911x"),
59};
60
61/* USB PHY */
62static struct resource usb_phy_resources[] = {
63 [0] = {
64 .start = 0xffe70800,
65 .end = 0xffe70900 - 1,
66 .flags = IORESOURCE_MEM,
67 },
68};
69
70static struct rcar_phy_platform_data usb_phy_platform_data;
71
72static struct platform_device usb_phy = {
73 .name = "rcar_usb_phy",
74 .id = -1,
75 .dev = {
76 .platform_data = &usb_phy_platform_data,
77 },
78 .resource = usb_phy_resources,
79 .num_resources = ARRAY_SIZE(usb_phy_resources),
80};
81
82/* SMSC LAN89218 */
83static struct resource smsc911x_resources[] = {
84 [0] = {
85 .start = 0x18000000, /* ExCS0 */
86 .end = 0x180000ff, /* A1->A7 */
87 .flags = IORESOURCE_MEM,
88 },
89 [1] = {
90 .start = irq_pin(1), /* IRQ 1 */
91 .flags = IORESOURCE_IRQ,
92 },
93};
94
95static struct smsc911x_platform_config smsc911x_platdata = {
96 .flags = SMSC911X_USE_32BIT, /* 32-bit SW on 16-bit HW bus */
97 .phy_interface = PHY_INTERFACE_MODE_MII,
98 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
99 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
100};
101
102static struct platform_device eth_device = {
103 .name = "smsc911x",
104 .id = -1,
105 .dev = {
106 .platform_data = &smsc911x_platdata,
107 },
108 .resource = smsc911x_resources,
109 .num_resources = ARRAY_SIZE(smsc911x_resources),
110};
111
112static struct resource sdhi0_resources[] = {
113 [0] = {
114 .name = "sdhi0",
115 .start = 0xffe4c000,
116 .end = 0xffe4c0ff,
117 .flags = IORESOURCE_MEM,
118 },
119 [1] = {
120 .start = gic_iid(0x88),
121 .flags = IORESOURCE_IRQ,
122 },
123};
124
125static struct tmio_mmc_data sdhi0_platform_data = {
126 .chan_priv_tx = (void *)HPBDMA_SLAVE_SDHI0_TX,
127 .chan_priv_rx = (void *)HPBDMA_SLAVE_SDHI0_RX,
128 .flags = TMIO_MMC_WRPROTECT_DISABLE | TMIO_MMC_HAS_IDLE_WAIT,
129 .capabilities = MMC_CAP_SD_HIGHSPEED,
130};
131
132static struct platform_device sdhi0_device = {
133 .name = "sh_mobile_sdhi",
134 .num_resources = ARRAY_SIZE(sdhi0_resources),
135 .resource = sdhi0_resources,
136 .id = 0,
137 .dev = {
138 .platform_data = &sdhi0_platform_data,
139 }
140};
141
142/* Thermal */
143static struct resource thermal_resources[] = {
144 [0] = {
145 .start = 0xFFC48000,
146 .end = 0xFFC48038 - 1,
147 .flags = IORESOURCE_MEM,
148 },
149};
150
151static struct platform_device thermal_device = {
152 .name = "rcar_thermal",
153 .resource = thermal_resources,
154 .num_resources = ARRAY_SIZE(thermal_resources),
155};
156
157/* HSPI */
158static struct resource hspi_resources[] = {
159 [0] = {
160 .start = 0xFFFC7000,
161 .end = 0xFFFC7018 - 1,
162 .flags = IORESOURCE_MEM,
163 },
164};
165
166static struct platform_device hspi_device = {
167 .name = "sh-hspi",
168 .id = 0,
169 .resource = hspi_resources,
170 .num_resources = ARRAY_SIZE(hspi_resources),
171};
172
173/* LEDS */
174static struct gpio_led marzen_leds[] = {
175 {
176 .name = "led2",
177 .gpio = RCAR_GP_PIN(4, 29),
178 .default_state = LEDS_GPIO_DEFSTATE_ON,
179 }, {
180 .name = "led3",
181 .gpio = RCAR_GP_PIN(4, 30),
182 .default_state = LEDS_GPIO_DEFSTATE_ON,
183 }, {
184 .name = "led4",
185 .gpio = RCAR_GP_PIN(4, 31),
186 .default_state = LEDS_GPIO_DEFSTATE_ON,
187 },
188};
189
190static struct gpio_led_platform_data marzen_leds_pdata = {
191 .leds = marzen_leds,
192 .num_leds = ARRAY_SIZE(marzen_leds),
193};
194
195static struct platform_device leds_device = {
196 .name = "leds-gpio",
197 .id = 0,
198 .dev = {
199 .platform_data = &marzen_leds_pdata,
200 },
201};
202
203/* VIN */
204static struct rcar_vin_platform_data vin_platform_data __initdata = {
205 .flags = RCAR_VIN_BT656,
206};
207
208#define MARZEN_VIN(idx) \
209static struct resource vin##idx##_resources[] __initdata = { \
210 DEFINE_RES_MEM(0xffc50000 + 0x1000 * (idx), 0x1000), \
211 DEFINE_RES_IRQ(gic_iid(0x5f + (idx))), \
212}; \
213 \
214static struct platform_device_info vin##idx##_info __initdata = { \
215 .name = "r8a7779-vin", \
216 .id = idx, \
217 .res = vin##idx##_resources, \
218 .num_res = ARRAY_SIZE(vin##idx##_resources), \
219 .dma_mask = DMA_BIT_MASK(32), \
220 .data = &vin_platform_data, \
221 .size_data = sizeof(vin_platform_data), \
222}
223MARZEN_VIN(1);
224MARZEN_VIN(3);
225
226#define MARZEN_CAMERA(idx) \
227static struct i2c_board_info camera##idx##_info = { \
228 I2C_BOARD_INFO("adv7180", 0x20 + (idx)), \
229}; \
230 \
231static struct soc_camera_link iclink##idx##_adv7180 = { \
232 .bus_id = 1 + 2 * (idx), \
233 .i2c_adapter_id = 0, \
234 .board_info = &camera##idx##_info, \
235}; \
236 \
237static struct platform_device camera##idx##_device = { \
238 .name = "soc-camera-pdrv", \
239 .id = idx, \
240 .dev = { \
241 .platform_data = &iclink##idx##_adv7180, \
242 }, \
243};
244
245MARZEN_CAMERA(0);
246MARZEN_CAMERA(1);
247
248static struct platform_device *marzen_devices[] __initdata = {
249 &eth_device,
250 &sdhi0_device,
251 &thermal_device,
252 &hspi_device,
253 &leds_device,
254 &usb_phy,
255 &camera0_device,
256 &camera1_device,
257};
258
259static const struct pinctrl_map marzen_pinctrl_map[] = {
260 /* DU (CN10: ARGB0, CN13: LVDS) */
261 PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7779", "pfc-r8a7779",
262 "du0_rgb888", "du0"),
263 PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7779", "pfc-r8a7779",
264 "du0_sync_1", "du0"),
265 PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7779", "pfc-r8a7779",
266 "du0_clk_out_0", "du0"),
267 PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7779", "pfc-r8a7779",
268 "du1_rgb666", "du1"),
269 PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7779", "pfc-r8a7779",
270 "du1_sync_1", "du1"),
271 PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7779", "pfc-r8a7779",
272 "du1_clk_out", "du1"),
273 /* HSPI0 */
274 PIN_MAP_MUX_GROUP_DEFAULT("sh-hspi.0", "pfc-r8a7779",
275 "hspi0", "hspi0"),
276 /* SCIF2 (CN18: DEBUG0) */
277 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.2", "pfc-r8a7779",
278 "scif2_data_c", "scif2"),
279 /* SCIF4 (CN19: DEBUG1) */
280 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.4", "pfc-r8a7779",
281 "scif4_data", "scif4"),
282 /* SDHI0 */
283 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7779",
284 "sdhi0_data4", "sdhi0"),
285 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7779",
286 "sdhi0_ctrl", "sdhi0"),
287 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7779",
288 "sdhi0_cd", "sdhi0"),
289 /* SMSC */
290 PIN_MAP_MUX_GROUP_DEFAULT("smsc911x", "pfc-r8a7779",
291 "intc_irq1_b", "intc"),
292 PIN_MAP_MUX_GROUP_DEFAULT("smsc911x", "pfc-r8a7779",
293 "lbsc_ex_cs0", "lbsc"),
294 /* USB0 */
295 PIN_MAP_MUX_GROUP_DEFAULT("ehci-platform.0", "pfc-r8a7779",
296 "usb0", "usb0"),
297 /* USB1 */
298 PIN_MAP_MUX_GROUP_DEFAULT("ehci-platform.0", "pfc-r8a7779",
299 "usb1", "usb1"),
300 /* USB2 */
301 PIN_MAP_MUX_GROUP_DEFAULT("ehci-platform.1", "pfc-r8a7779",
302 "usb2", "usb2"),
303 /* VIN1 */
304 PIN_MAP_MUX_GROUP_DEFAULT("r8a7779-vin.1", "pfc-r8a7779",
305 "vin1_clk", "vin1"),
306 PIN_MAP_MUX_GROUP_DEFAULT("r8a7779-vin.1", "pfc-r8a7779",
307 "vin1_data8", "vin1"),
308 /* VIN3 */
309 PIN_MAP_MUX_GROUP_DEFAULT("r8a7779-vin.3", "pfc-r8a7779",
310 "vin3_clk", "vin3"),
311 PIN_MAP_MUX_GROUP_DEFAULT("r8a7779-vin.3", "pfc-r8a7779",
312 "vin3_data8", "vin3"),
313};
314
315static void __init marzen_init(void)
316{
317 regulator_register_always_on(0, "fixed-3.3V", fixed3v3_power_consumers,
318 ARRAY_SIZE(fixed3v3_power_consumers), 3300000);
319 regulator_register_fixed(1, dummy_supplies,
320 ARRAY_SIZE(dummy_supplies));
321
322 pinctrl_register_mappings(marzen_pinctrl_map,
323 ARRAY_SIZE(marzen_pinctrl_map));
324 r8a7779_pinmux_init();
325 r8a7779_init_irq_extpin(1); /* IRQ1 as individual interrupt */
326
327 r8a7779_add_standard_devices();
328 platform_device_register_full(&vin1_info);
329 platform_device_register_full(&vin3_info);
330 platform_add_devices(marzen_devices, ARRAY_SIZE(marzen_devices));
331}
332
333static const char *marzen_boards_compat_dt[] __initdata = {
334 "renesas,marzen",
335 NULL,
336};
337
338DT_MACHINE_START(MARZEN, "marzen")
339 .smp = smp_ops(r8a7779_smp_ops),
340 .map_io = r8a7779_map_io,
341 .init_early = r8a7779_add_early_devices,
342 .init_irq = r8a7779_init_irq_dt,
343 .init_machine = marzen_init,
344 .init_late = r8a7779_init_late,
345 .dt_compat = marzen_boards_compat_dt,
346 .init_time = r8a7779_earlytimer_init,
347MACHINE_END
diff --git a/arch/arm/mach-shmobile/clock-r8a7740.c b/arch/arm/mach-shmobile/clock-r8a7740.c
deleted file mode 100644
index 9cac8247c72b..000000000000
--- a/arch/arm/mach-shmobile/clock-r8a7740.c
+++ /dev/null
@@ -1,675 +0,0 @@
1/*
2 * R8A7740 processor support
3 *
4 * Copyright (C) 2011 Renesas Solutions Corp.
5 * Copyright (C) 2011 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16#include <linux/init.h>
17#include <linux/kernel.h>
18#include <linux/io.h>
19#include <linux/sh_clk.h>
20#include <linux/clkdev.h>
21
22#include "clock.h"
23#include "common.h"
24#include "r8a7740.h"
25
26/*
27 * | MDx | XTAL1/EXTAL1 | System | EXTALR |
28 * Clock |-------+-----------------+ clock | 32.768 | RCLK
29 * Mode | 2/1/0 | src MHz | source | KHz | source
30 * -------+-------+-----------------+-----------+--------+----------
31 * 0 | 0 0 0 | External 20~50 | XTAL1 | O | EXTALR
32 * 1 | 0 0 1 | Crystal 20~30 | XTAL1 | O | EXTALR
33 * 2 | 0 1 0 | External 40~50 | XTAL1 / 2 | O | EXTALR
34 * 3 | 0 1 1 | Crystal 40~50 | XTAL1 / 2 | O | EXTALR
35 * 4 | 1 0 0 | External 20~50 | XTAL1 | x | XTAL1 / 1024
36 * 5 | 1 0 1 | Crystal 20~30 | XTAL1 | x | XTAL1 / 1024
37 * 6 | 1 1 0 | External 40~50 | XTAL1 / 2 | x | XTAL1 / 2048
38 * 7 | 1 1 1 | Crystal 40~50 | XTAL1 / 2 | x | XTAL1 / 2048
39 */
40
41/* CPG registers */
42#define FRQCRA IOMEM(0xe6150000)
43#define FRQCRB IOMEM(0xe6150004)
44#define VCLKCR1 IOMEM(0xE6150008)
45#define VCLKCR2 IOMEM(0xE615000c)
46#define FRQCRC IOMEM(0xe61500e0)
47#define FSIACKCR IOMEM(0xe6150018)
48#define PLLC01CR IOMEM(0xe6150028)
49
50#define SUBCKCR IOMEM(0xe6150080)
51#define USBCKCR IOMEM(0xe615008c)
52
53#define MSTPSR0 IOMEM(0xe6150030)
54#define MSTPSR1 IOMEM(0xe6150038)
55#define MSTPSR2 IOMEM(0xe6150040)
56#define MSTPSR3 IOMEM(0xe6150048)
57#define MSTPSR4 IOMEM(0xe615004c)
58#define FSIBCKCR IOMEM(0xe6150090)
59#define HDMICKCR IOMEM(0xe6150094)
60#define SMSTPCR0 IOMEM(0xe6150130)
61#define SMSTPCR1 IOMEM(0xe6150134)
62#define SMSTPCR2 IOMEM(0xe6150138)
63#define SMSTPCR3 IOMEM(0xe615013c)
64#define SMSTPCR4 IOMEM(0xe6150140)
65
66#define FSIDIVA IOMEM(0xFE1F8000)
67#define FSIDIVB IOMEM(0xFE1F8008)
68
69/* Fixed 32 KHz root clock from EXTALR pin */
70static struct clk extalr_clk = {
71 .rate = 32768,
72};
73
74/*
75 * 25MHz default rate for the EXTAL1 root input clock.
76 * If needed, reset this with clk_set_rate() from the platform code.
77 */
78static struct clk extal1_clk = {
79 .rate = 25000000,
80};
81
82/*
83 * 48MHz default rate for the EXTAL2 root input clock.
84 * If needed, reset this with clk_set_rate() from the platform code.
85 */
86static struct clk extal2_clk = {
87 .rate = 48000000,
88};
89
90/*
91 * 27MHz default rate for the DV_CLKI root input clock.
92 * If needed, reset this with clk_set_rate() from the platform code.
93 */
94static struct clk dv_clk = {
95 .rate = 27000000,
96};
97
98SH_CLK_RATIO(div2, 1, 2);
99SH_CLK_RATIO(div1k, 1, 1024);
100
101SH_FIXED_RATIO_CLK(extal1_div2_clk, extal1_clk, div2);
102SH_FIXED_RATIO_CLK(extal1_div1024_clk, extal1_clk, div1k);
103SH_FIXED_RATIO_CLK(extal1_div2048_clk, extal1_div2_clk, div1k);
104SH_FIXED_RATIO_CLK(extal2_div2_clk, extal2_clk, div2);
105
106static struct sh_clk_ops followparent_clk_ops = {
107 .recalc = followparent_recalc,
108};
109
110/* Main clock */
111static struct clk system_clk = {
112 .ops = &followparent_clk_ops,
113};
114
115SH_FIXED_RATIO_CLK(system_div2_clk, system_clk, div2);
116
117/* r_clk */
118static struct clk r_clk = {
119 .ops = &followparent_clk_ops,
120};
121
122/* PLLC0/PLLC1 */
123static unsigned long pllc01_recalc(struct clk *clk)
124{
125 unsigned long mult = 1;
126
127 if (__raw_readl(PLLC01CR) & (1 << 14))
128 mult = ((__raw_readl(clk->enable_reg) >> 24) & 0x7f) + 1;
129
130 return clk->parent->rate * mult;
131}
132
133static struct sh_clk_ops pllc01_clk_ops = {
134 .recalc = pllc01_recalc,
135};
136
137static struct clk pllc0_clk = {
138 .ops = &pllc01_clk_ops,
139 .flags = CLK_ENABLE_ON_INIT,
140 .parent = &system_clk,
141 .enable_reg = (void __iomem *)FRQCRC,
142};
143
144static struct clk pllc1_clk = {
145 .ops = &pllc01_clk_ops,
146 .flags = CLK_ENABLE_ON_INIT,
147 .parent = &system_div2_clk,
148 .enable_reg = (void __iomem *)FRQCRA,
149};
150
151/* PLLC1 / 2 */
152SH_FIXED_RATIO_CLK(pllc1_div2_clk, pllc1_clk, div2);
153
154/* USB clock */
155/*
156 * USBCKCR is controlling usb24 clock
157 * bit[7] : parent clock
158 * bit[6] : clock divide rate
159 * And this bit[7] is used as a "usb24s" from other devices.
160 * (Video clock / Sub clock / SPU clock)
161 * You can controll this clock as a below.
162 *
163 * struct clk *usb24 = clk_get(dev, "usb24");
164 * struct clk *usb24s = clk_get(NULL, "usb24s");
165 * struct clk *system = clk_get(NULL, "system_clk");
166 * int rate = clk_get_rate(system);
167 *
168 * clk_set_parent(usb24s, system); // for bit[7]
169 * clk_set_rate(usb24, rate / 2); // for bit[6]
170 */
171static struct clk *usb24s_parents[] = {
172 [0] = &system_clk,
173 [1] = &extal2_clk
174};
175
176static int usb24s_enable(struct clk *clk)
177{
178 __raw_writel(__raw_readl(USBCKCR) & ~(1 << 8), USBCKCR);
179
180 return 0;
181}
182
183static void usb24s_disable(struct clk *clk)
184{
185 __raw_writel(__raw_readl(USBCKCR) | (1 << 8), USBCKCR);
186}
187
188static int usb24s_set_parent(struct clk *clk, struct clk *parent)
189{
190 int i, ret;
191 u32 val;
192
193 if (!clk->parent_table || !clk->parent_num)
194 return -EINVAL;
195
196 /* Search the parent */
197 for (i = 0; i < clk->parent_num; i++)
198 if (clk->parent_table[i] == parent)
199 break;
200
201 if (i == clk->parent_num)
202 return -ENODEV;
203
204 ret = clk_reparent(clk, parent);
205 if (ret < 0)
206 return ret;
207
208 val = __raw_readl(USBCKCR);
209 val &= ~(1 << 7);
210 val |= i << 7;
211 __raw_writel(val, USBCKCR);
212
213 return 0;
214}
215
216static struct sh_clk_ops usb24s_clk_ops = {
217 .recalc = followparent_recalc,
218 .enable = usb24s_enable,
219 .disable = usb24s_disable,
220 .set_parent = usb24s_set_parent,
221};
222
223static struct clk usb24s_clk = {
224 .ops = &usb24s_clk_ops,
225 .parent_table = usb24s_parents,
226 .parent_num = ARRAY_SIZE(usb24s_parents),
227 .parent = &system_clk,
228};
229
230static unsigned long usb24_recalc(struct clk *clk)
231{
232 return clk->parent->rate /
233 ((__raw_readl(USBCKCR) & (1 << 6)) ? 1 : 2);
234};
235
236static int usb24_set_rate(struct clk *clk, unsigned long rate)
237{
238 u32 val;
239
240 /* closer to which ? parent->rate or parent->rate/2 */
241 val = __raw_readl(USBCKCR);
242 val &= ~(1 << 6);
243 val |= (rate > (clk->parent->rate / 4) * 3) << 6;
244 __raw_writel(val, USBCKCR);
245
246 return 0;
247}
248
249static struct sh_clk_ops usb24_clk_ops = {
250 .recalc = usb24_recalc,
251 .set_rate = usb24_set_rate,
252};
253
254static struct clk usb24_clk = {
255 .ops = &usb24_clk_ops,
256 .parent = &usb24s_clk,
257};
258
259/* External FSIACK/FSIBCK clock */
260static struct clk fsiack_clk = {
261};
262
263static struct clk fsibck_clk = {
264};
265
266static struct clk *main_clks[] = {
267 &extalr_clk,
268 &extal1_clk,
269 &extal2_clk,
270 &extal1_div2_clk,
271 &extal1_div1024_clk,
272 &extal1_div2048_clk,
273 &extal2_div2_clk,
274 &dv_clk,
275 &system_clk,
276 &system_div2_clk,
277 &r_clk,
278 &pllc0_clk,
279 &pllc1_clk,
280 &pllc1_div2_clk,
281 &usb24s_clk,
282 &usb24_clk,
283 &fsiack_clk,
284 &fsibck_clk,
285};
286
287/* DIV4 clocks */
288static void div4_kick(struct clk *clk)
289{
290 unsigned long value;
291
292 /* set KICK bit in FRQCRB to update hardware setting */
293 value = __raw_readl(FRQCRB);
294 value |= (1 << 31);
295 __raw_writel(value, FRQCRB);
296}
297
298static int divisors[] = { 2, 3, 4, 6, 8, 12, 16, 18,
299 24, 32, 36, 48, 0, 72, 96, 0 };
300
301static struct clk_div_mult_table div4_div_mult_table = {
302 .divisors = divisors,
303 .nr_divisors = ARRAY_SIZE(divisors),
304};
305
306static struct clk_div4_table div4_table = {
307 .div_mult_table = &div4_div_mult_table,
308 .kick = div4_kick,
309};
310
311enum {
312 DIV4_I, DIV4_ZG, DIV4_B, DIV4_M1, DIV4_HP,
313 DIV4_HPP, DIV4_USBP, DIV4_S, DIV4_ZB, DIV4_M3, DIV4_CP,
314 DIV4_NR
315};
316
317static struct clk div4_clks[DIV4_NR] = {
318 [DIV4_I] = SH_CLK_DIV4(&pllc1_clk, FRQCRA, 20, 0x6fff, CLK_ENABLE_ON_INIT),
319 [DIV4_ZG] = SH_CLK_DIV4(&pllc1_clk, FRQCRA, 16, 0x6fff, CLK_ENABLE_ON_INIT),
320 [DIV4_B] = SH_CLK_DIV4(&pllc1_clk, FRQCRA, 8, 0x6fff, CLK_ENABLE_ON_INIT),
321 [DIV4_M1] = SH_CLK_DIV4(&pllc1_clk, FRQCRA, 4, 0x6fff, CLK_ENABLE_ON_INIT),
322 [DIV4_HP] = SH_CLK_DIV4(&pllc1_clk, FRQCRB, 4, 0x6fff, 0),
323 [DIV4_HPP] = SH_CLK_DIV4(&pllc1_clk, FRQCRC, 20, 0x6fff, 0),
324 [DIV4_USBP] = SH_CLK_DIV4(&pllc1_clk, FRQCRC, 16, 0x6fff, 0),
325 [DIV4_S] = SH_CLK_DIV4(&pllc1_clk, FRQCRC, 12, 0x6fff, 0),
326 [DIV4_ZB] = SH_CLK_DIV4(&pllc1_clk, FRQCRC, 8, 0x6fff, 0),
327 [DIV4_M3] = SH_CLK_DIV4(&pllc1_clk, FRQCRC, 4, 0x6fff, 0),
328 [DIV4_CP] = SH_CLK_DIV4(&pllc1_clk, FRQCRC, 0, 0x6fff, 0),
329};
330
331/* DIV6 reparent */
332enum {
333 DIV6_HDMI,
334 DIV6_VCLK1, DIV6_VCLK2,
335 DIV6_FSIA, DIV6_FSIB,
336 DIV6_REPARENT_NR,
337};
338
339static struct clk *hdmi_parent[] = {
340 [0] = &pllc1_div2_clk,
341 [1] = &system_clk,
342 [2] = &dv_clk
343};
344
345static struct clk *vclk_parents[8] = {
346 [0] = &pllc1_div2_clk,
347 [2] = &dv_clk,
348 [3] = &usb24s_clk,
349 [4] = &extal1_div2_clk,
350 [5] = &extalr_clk,
351};
352
353static struct clk *fsia_parents[] = {
354 [0] = &pllc1_div2_clk,
355 [1] = &fsiack_clk, /* external clock */
356};
357
358static struct clk *fsib_parents[] = {
359 [0] = &pllc1_div2_clk,
360 [1] = &fsibck_clk, /* external clock */
361};
362
363static struct clk div6_reparent_clks[DIV6_REPARENT_NR] = {
364 [DIV6_HDMI] = SH_CLK_DIV6_EXT(HDMICKCR, 0,
365 hdmi_parent, ARRAY_SIZE(hdmi_parent), 6, 2),
366 [DIV6_VCLK1] = SH_CLK_DIV6_EXT(VCLKCR1, 0,
367 vclk_parents, ARRAY_SIZE(vclk_parents), 12, 3),
368 [DIV6_VCLK2] = SH_CLK_DIV6_EXT(VCLKCR2, 0,
369 vclk_parents, ARRAY_SIZE(vclk_parents), 12, 3),
370 [DIV6_FSIA] = SH_CLK_DIV6_EXT(FSIACKCR, 0,
371 fsia_parents, ARRAY_SIZE(fsia_parents), 6, 2),
372 [DIV6_FSIB] = SH_CLK_DIV6_EXT(FSIBCKCR, 0,
373 fsib_parents, ARRAY_SIZE(fsib_parents), 6, 2),
374};
375
376/* DIV6 clocks */
377enum {
378 DIV6_SUB,
379 DIV6_NR
380};
381
382static struct clk div6_clks[DIV6_NR] = {
383 [DIV6_SUB] = SH_CLK_DIV6(&pllc1_div2_clk, SUBCKCR, 0),
384};
385
386/* HDMI1/2 clock */
387static unsigned long hdmi12_recalc(struct clk *clk)
388{
389 u32 val = __raw_readl(HDMICKCR);
390 int shift = (int)clk->priv;
391
392 val >>= shift;
393 val &= 0x3;
394
395 return clk->parent->rate / (1 << val);
396};
397
398static int hdmi12_set_rate(struct clk *clk, unsigned long rate)
399{
400 u32 val, mask;
401 int i, shift;
402
403 for (i = 0; i < 3; i++)
404 if (rate == clk->parent->rate / (1 << i))
405 goto find;
406 return -ENODEV;
407
408find:
409 shift = (int)clk->priv;
410
411 val = __raw_readl(HDMICKCR);
412 mask = ~(0x3 << shift);
413 val = (val & mask) | i << shift;
414 __raw_writel(val, HDMICKCR);
415
416 return 0;
417};
418
419static struct sh_clk_ops hdmi12_clk_ops = {
420 .recalc = hdmi12_recalc,
421 .set_rate = hdmi12_set_rate,
422};
423
424static struct clk hdmi1_clk = {
425 .ops = &hdmi12_clk_ops,
426 .priv = (void *)9,
427 .parent = &div6_reparent_clks[DIV6_HDMI], /* late install */
428};
429
430static struct clk hdmi2_clk = {
431 .ops = &hdmi12_clk_ops,
432 .priv = (void *)11,
433 .parent = &div6_reparent_clks[DIV6_HDMI], /* late install */
434};
435
436static struct clk *late_main_clks[] = {
437 &hdmi1_clk,
438 &hdmi2_clk,
439};
440
441/* FSI DIV */
442enum { FSIDIV_A, FSIDIV_B, FSIDIV_REPARENT_NR };
443
444static struct clk fsidivs[] = {
445 [FSIDIV_A] = SH_CLK_FSIDIV(FSIDIVA, &div6_reparent_clks[DIV6_FSIA]),
446 [FSIDIV_B] = SH_CLK_FSIDIV(FSIDIVB, &div6_reparent_clks[DIV6_FSIB]),
447};
448
449/* MSTP */
450enum {
451 MSTP128, MSTP127, MSTP125,
452 MSTP116, MSTP111, MSTP100, MSTP117,
453
454 MSTP230, MSTP229,
455 MSTP222,
456 MSTP218, MSTP217, MSTP216, MSTP214,
457 MSTP207, MSTP206, MSTP204, MSTP203, MSTP202, MSTP201, MSTP200,
458
459 MSTP329, MSTP328, MSTP323, MSTP320,
460 MSTP314, MSTP313, MSTP312,
461 MSTP309, MSTP304,
462
463 MSTP416, MSTP415, MSTP407, MSTP406,
464
465 MSTP_NR
466};
467
468static struct clk mstp_clks[MSTP_NR] = {
469 [MSTP128] = SH_CLK_MSTP32(&div4_clks[DIV4_S], SMSTPCR1, 28, 0), /* CEU21 */
470 [MSTP127] = SH_CLK_MSTP32(&div4_clks[DIV4_S], SMSTPCR1, 27, 0), /* CEU20 */
471 [MSTP125] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR1, 25, 0), /* TMU0 */
472 [MSTP117] = SH_CLK_MSTP32(&div4_clks[DIV4_B], SMSTPCR1, 17, 0), /* LCDC1 */
473 [MSTP116] = SH_CLK_MSTP32(&div4_clks[DIV4_HPP], SMSTPCR1, 16, 0), /* IIC0 */
474 [MSTP111] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR1, 11, 0), /* TMU1 */
475 [MSTP100] = SH_CLK_MSTP32(&div4_clks[DIV4_B], SMSTPCR1, 0, 0), /* LCDC0 */
476
477 [MSTP230] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR2, 30, 0), /* SCIFA6 */
478 [MSTP229] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR2, 29, 0), /* INTCA */
479 [MSTP222] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR2, 22, 0), /* SCIFA7 */
480 [MSTP218] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR2, 18, 0), /* DMAC1 */
481 [MSTP217] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR2, 17, 0), /* DMAC2 */
482 [MSTP216] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR2, 16, 0), /* DMAC3 */
483 [MSTP214] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR2, 14, 0), /* USBDMAC */
484 [MSTP207] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR2, 7, 0), /* SCIFA5 */
485 [MSTP206] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR2, 6, 0), /* SCIFB */
486 [MSTP204] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR2, 4, 0), /* SCIFA0 */
487 [MSTP203] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR2, 3, 0), /* SCIFA1 */
488 [MSTP202] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR2, 2, 0), /* SCIFA2 */
489 [MSTP201] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR2, 1, 0), /* SCIFA3 */
490 [MSTP200] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR2, 0, 0), /* SCIFA4 */
491
492 [MSTP329] = SH_CLK_MSTP32(&r_clk, SMSTPCR3, 29, 0), /* CMT10 */
493 [MSTP328] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR3, 28, 0), /* FSI */
494 [MSTP323] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR3, 23, 0), /* IIC1 */
495 [MSTP320] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR3, 20, 0), /* USBF */
496 [MSTP314] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR3, 14, 0), /* SDHI0 */
497 [MSTP313] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR3, 13, 0), /* SDHI1 */
498 [MSTP312] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR3, 12, 0), /* MMC */
499 [MSTP309] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR3, 9, 0), /* GEther */
500 [MSTP304] = SH_CLK_MSTP32(&div4_clks[DIV4_CP], SMSTPCR3, 4, 0), /* TPU0 */
501
502 [MSTP416] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR4, 16, 0), /* USBHOST */
503 [MSTP415] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR4, 15, 0), /* SDHI2 */
504 [MSTP407] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR4, 7, 0), /* USB-Func */
505 [MSTP406] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR4, 6, 0), /* USB Phy */
506};
507
508static struct clk_lookup lookups[] = {
509 /* main clocks */
510 CLKDEV_CON_ID("extalr", &extalr_clk),
511 CLKDEV_CON_ID("extal1", &extal1_clk),
512 CLKDEV_CON_ID("extal2", &extal2_clk),
513 CLKDEV_CON_ID("extal1_div2", &extal1_div2_clk),
514 CLKDEV_CON_ID("extal1_div1024", &extal1_div1024_clk),
515 CLKDEV_CON_ID("extal1_div2048", &extal1_div2048_clk),
516 CLKDEV_CON_ID("extal2_div2", &extal2_div2_clk),
517 CLKDEV_CON_ID("dv_clk", &dv_clk),
518 CLKDEV_CON_ID("system_clk", &system_clk),
519 CLKDEV_CON_ID("system_div2_clk", &system_div2_clk),
520 CLKDEV_CON_ID("r_clk", &r_clk),
521 CLKDEV_CON_ID("pllc0_clk", &pllc0_clk),
522 CLKDEV_CON_ID("pllc1_clk", &pllc1_clk),
523 CLKDEV_CON_ID("pllc1_div2_clk", &pllc1_div2_clk),
524 CLKDEV_CON_ID("usb24s", &usb24s_clk),
525 CLKDEV_CON_ID("hdmi1", &hdmi1_clk),
526 CLKDEV_CON_ID("hdmi2", &hdmi2_clk),
527 CLKDEV_CON_ID("video1", &div6_reparent_clks[DIV6_VCLK1]),
528 CLKDEV_CON_ID("video2", &div6_reparent_clks[DIV6_VCLK2]),
529 CLKDEV_CON_ID("fsiack", &fsiack_clk),
530 CLKDEV_CON_ID("fsibck", &fsibck_clk),
531
532 /* DIV4 clocks */
533 CLKDEV_CON_ID("i_clk", &div4_clks[DIV4_I]),
534 CLKDEV_CON_ID("zg_clk", &div4_clks[DIV4_ZG]),
535 CLKDEV_CON_ID("b_clk", &div4_clks[DIV4_B]),
536 CLKDEV_CON_ID("m1_clk", &div4_clks[DIV4_M1]),
537 CLKDEV_CON_ID("hp_clk", &div4_clks[DIV4_HP]),
538 CLKDEV_CON_ID("hpp_clk", &div4_clks[DIV4_HPP]),
539 CLKDEV_CON_ID("s_clk", &div4_clks[DIV4_S]),
540 CLKDEV_CON_ID("zb_clk", &div4_clks[DIV4_ZB]),
541 CLKDEV_CON_ID("m3_clk", &div4_clks[DIV4_M3]),
542 CLKDEV_CON_ID("cp_clk", &div4_clks[DIV4_CP]),
543
544 /* DIV6 clocks */
545 CLKDEV_CON_ID("sub_clk", &div6_clks[DIV6_SUB]),
546
547 /* MSTP32 clocks */
548 CLKDEV_DEV_ID("sh_mobile_lcdc_fb.0", &mstp_clks[MSTP100]),
549 CLKDEV_DEV_ID("i2c-sh_mobile.0", &mstp_clks[MSTP116]),
550 CLKDEV_DEV_ID("fff20000.i2c", &mstp_clks[MSTP116]),
551 CLKDEV_DEV_ID("sh_mobile_lcdc_fb.1", &mstp_clks[MSTP117]),
552 CLKDEV_DEV_ID("sh_mobile_ceu.0", &mstp_clks[MSTP127]),
553 CLKDEV_DEV_ID("sh_mobile_ceu.1", &mstp_clks[MSTP128]),
554
555 CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP200]),
556 CLKDEV_DEV_ID("e6c80000.serial", &mstp_clks[MSTP200]),
557 CLKDEV_DEV_ID("sh-sci.3", &mstp_clks[MSTP201]),
558 CLKDEV_DEV_ID("e6c70000.serial", &mstp_clks[MSTP201]),
559 CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP202]),
560 CLKDEV_DEV_ID("e6c60000.serial", &mstp_clks[MSTP202]),
561 CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP203]),
562 CLKDEV_DEV_ID("e6c50000.serial", &mstp_clks[MSTP203]),
563 CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP204]),
564 CLKDEV_DEV_ID("e6c40000.serial", &mstp_clks[MSTP204]),
565 CLKDEV_DEV_ID("sh-sci.8", &mstp_clks[MSTP206]),
566 CLKDEV_DEV_ID("e6c30000.serial", &mstp_clks[MSTP206]),
567 CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP207]),
568 CLKDEV_DEV_ID("e6cb0000.serial", &mstp_clks[MSTP207]),
569 CLKDEV_DEV_ID("sh-dma-engine.3", &mstp_clks[MSTP214]),
570 CLKDEV_DEV_ID("sh-dma-engine.2", &mstp_clks[MSTP216]),
571 CLKDEV_DEV_ID("sh-dma-engine.1", &mstp_clks[MSTP217]),
572 CLKDEV_DEV_ID("sh-dma-engine.0", &mstp_clks[MSTP218]),
573 CLKDEV_DEV_ID("sh-sci.7", &mstp_clks[MSTP222]),
574 CLKDEV_DEV_ID("e6cd0000.serial", &mstp_clks[MSTP222]),
575 CLKDEV_DEV_ID("renesas_intc_irqpin.0", &mstp_clks[MSTP229]),
576 CLKDEV_DEV_ID("renesas_intc_irqpin.1", &mstp_clks[MSTP229]),
577 CLKDEV_DEV_ID("renesas_intc_irqpin.2", &mstp_clks[MSTP229]),
578 CLKDEV_DEV_ID("renesas_intc_irqpin.3", &mstp_clks[MSTP229]),
579 CLKDEV_DEV_ID("sh-sci.6", &mstp_clks[MSTP230]),
580 CLKDEV_DEV_ID("e6cc0000.serial", &mstp_clks[MSTP230]),
581
582 CLKDEV_DEV_ID("sh_fsi2", &mstp_clks[MSTP328]),
583 CLKDEV_DEV_ID("fe1f0000.sound", &mstp_clks[MSTP328]),
584 CLKDEV_DEV_ID("i2c-sh_mobile.1", &mstp_clks[MSTP323]),
585 CLKDEV_DEV_ID("e6c20000.i2c", &mstp_clks[MSTP323]),
586 CLKDEV_DEV_ID("renesas_usbhs", &mstp_clks[MSTP320]),
587 CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP314]),
588 CLKDEV_DEV_ID("e6850000.sd", &mstp_clks[MSTP314]),
589 CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP313]),
590 CLKDEV_DEV_ID("e6860000.sd", &mstp_clks[MSTP313]),
591 CLKDEV_DEV_ID("sh_mmcif", &mstp_clks[MSTP312]),
592 CLKDEV_DEV_ID("e6bd0000.mmc", &mstp_clks[MSTP312]),
593 CLKDEV_DEV_ID("r8a7740-gether", &mstp_clks[MSTP309]),
594 CLKDEV_DEV_ID("e9a00000.ethernet", &mstp_clks[MSTP309]),
595 CLKDEV_DEV_ID("renesas-tpu-pwm", &mstp_clks[MSTP304]),
596 CLKDEV_DEV_ID("e6600000.pwm", &mstp_clks[MSTP304]),
597
598 CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP415]),
599 CLKDEV_DEV_ID("e6870000.sd", &mstp_clks[MSTP415]),
600
601 /* ICK */
602 CLKDEV_ICK_ID("fck", "sh-tmu.1", &mstp_clks[MSTP111]),
603 CLKDEV_ICK_ID("fck", "fff90000.timer", &mstp_clks[MSTP111]),
604 CLKDEV_ICK_ID("fck", "sh-tmu.0", &mstp_clks[MSTP125]),
605 CLKDEV_ICK_ID("fck", "fff80000.timer", &mstp_clks[MSTP125]),
606 CLKDEV_ICK_ID("fck", "sh-cmt-48.1", &mstp_clks[MSTP329]),
607 CLKDEV_ICK_ID("fck", "e6138000.timer", &mstp_clks[MSTP329]),
608 CLKDEV_ICK_ID("host", "renesas_usbhs", &mstp_clks[MSTP416]),
609 CLKDEV_ICK_ID("func", "renesas_usbhs", &mstp_clks[MSTP407]),
610 CLKDEV_ICK_ID("phy", "renesas_usbhs", &mstp_clks[MSTP406]),
611 CLKDEV_ICK_ID("pci", "renesas_usbhs", &div4_clks[DIV4_USBP]),
612 CLKDEV_ICK_ID("usb24", "renesas_usbhs", &usb24_clk),
613 CLKDEV_ICK_ID("ick", "sh-mobile-hdmi", &div6_reparent_clks[DIV6_HDMI]),
614
615 CLKDEV_ICK_ID("icka", "sh_fsi2", &div6_reparent_clks[DIV6_FSIA]),
616 CLKDEV_ICK_ID("ickb", "sh_fsi2", &div6_reparent_clks[DIV6_FSIB]),
617 CLKDEV_ICK_ID("diva", "sh_fsi2", &fsidivs[FSIDIV_A]),
618 CLKDEV_ICK_ID("divb", "sh_fsi2", &fsidivs[FSIDIV_B]),
619 CLKDEV_ICK_ID("xcka", "sh_fsi2", &fsiack_clk),
620 CLKDEV_ICK_ID("xckb", "sh_fsi2", &fsibck_clk),
621};
622
623void __init r8a7740_clock_init(u8 md_ck)
624{
625 int k, ret = 0;
626
627 /* detect system clock parent */
628 if (md_ck & MD_CK1)
629 system_clk.parent = &extal1_div2_clk;
630 else
631 system_clk.parent = &extal1_clk;
632
633 /* detect RCLK parent */
634 switch (md_ck & (MD_CK2 | MD_CK1)) {
635 case MD_CK2 | MD_CK1:
636 r_clk.parent = &extal1_div2048_clk;
637 break;
638 case MD_CK2:
639 r_clk.parent = &extal1_div1024_clk;
640 break;
641 case MD_CK1:
642 default:
643 r_clk.parent = &extalr_clk;
644 break;
645 }
646
647 for (k = 0; !ret && (k < ARRAY_SIZE(main_clks)); k++)
648 ret = clk_register(main_clks[k]);
649
650 if (!ret)
651 ret = sh_clk_div4_register(div4_clks, DIV4_NR, &div4_table);
652
653 if (!ret)
654 ret = sh_clk_div6_register(div6_clks, DIV6_NR);
655
656 if (!ret)
657 ret = sh_clk_div6_reparent_register(div6_reparent_clks,
658 DIV6_REPARENT_NR);
659
660 if (!ret)
661 ret = sh_clk_mstp_register(mstp_clks, MSTP_NR);
662
663 for (k = 0; !ret && (k < ARRAY_SIZE(late_main_clks)); k++)
664 ret = clk_register(late_main_clks[k]);
665
666 if (!ret)
667 ret = sh_clk_fsidiv_register(fsidivs, FSIDIV_REPARENT_NR);
668
669 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
670
671 if (!ret)
672 shmobile_clk_init();
673 else
674 panic("failed to setup r8a7740 clocks\n");
675}
diff --git a/arch/arm/mach-shmobile/clock-r8a7779.c b/arch/arm/mach-shmobile/clock-r8a7779.c
deleted file mode 100644
index fa8ab2cc9187..000000000000
--- a/arch/arm/mach-shmobile/clock-r8a7779.c
+++ /dev/null
@@ -1,271 +0,0 @@
1/*
2 * r8a7779 clock framework support
3 *
4 * Copyright (C) 2011 Renesas Solutions Corp.
5 * Copyright (C) 2011 Magnus Damm
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
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16#include <linux/bitops.h>
17#include <linux/init.h>
18#include <linux/kernel.h>
19#include <linux/io.h>
20#include <linux/sh_clk.h>
21#include <linux/clkdev.h>
22#include <linux/sh_timer.h>
23
24#include "clock.h"
25#include "common.h"
26#include "r8a7779.h"
27
28/*
29 * MD1 = 1 MD1 = 0
30 * (PLLA = 1500) (PLLA = 1600)
31 * (MHz) (MHz)
32 *------------------------------------------------+--------------------
33 * clkz 1000 (2/3) 800 (1/2)
34 * clkzs 250 (1/6) 200 (1/8)
35 * clki 750 (1/2) 800 (1/2)
36 * clks 250 (1/6) 200 (1/8)
37 * clks1 125 (1/12) 100 (1/16)
38 * clks3 187.5 (1/8) 200 (1/8)
39 * clks4 93.7 (1/16) 100 (1/16)
40 * clkp 62.5 (1/24) 50 (1/32)
41 * clkg 62.5 (1/24) 66.6 (1/24)
42 * clkb, CLKOUT
43 * (MD2 = 0) 62.5 (1/24) 66.6 (1/24)
44 * (MD2 = 1) 41.6 (1/36) 50 (1/32)
45*/
46
47#define MD(nr) BIT(nr)
48
49#define MSTPCR0 IOMEM(0xffc80030)
50#define MSTPCR1 IOMEM(0xffc80034)
51#define MSTPCR3 IOMEM(0xffc8003c)
52#define MSTPSR1 IOMEM(0xffc80044)
53
54/* ioremap() through clock mapping mandatory to avoid
55 * collision with ARM coherent DMA virtual memory range.
56 */
57
58static struct clk_mapping cpg_mapping = {
59 .phys = 0xffc80000,
60 .len = 0x80,
61};
62
63/*
64 * Default rate for the root input clock, reset this with clk_set_rate()
65 * from the platform code.
66 */
67static struct clk plla_clk = {
68 /* .rate will be updated on r8a7779_clock_init() */
69 .mapping = &cpg_mapping,
70};
71
72/*
73 * clock ratio of these clock will be updated
74 * on r8a7779_clock_init()
75 */
76SH_FIXED_RATIO_CLK_SET(clkz_clk, plla_clk, 1, 1);
77SH_FIXED_RATIO_CLK_SET(clkzs_clk, plla_clk, 1, 1);
78SH_FIXED_RATIO_CLK_SET(clki_clk, plla_clk, 1, 1);
79SH_FIXED_RATIO_CLK_SET(clks_clk, plla_clk, 1, 1);
80SH_FIXED_RATIO_CLK_SET(clks1_clk, plla_clk, 1, 1);
81SH_FIXED_RATIO_CLK_SET(clks3_clk, plla_clk, 1, 1);
82SH_FIXED_RATIO_CLK_SET(clks4_clk, plla_clk, 1, 1);
83SH_FIXED_RATIO_CLK_SET(clkb_clk, plla_clk, 1, 1);
84SH_FIXED_RATIO_CLK_SET(clkout_clk, plla_clk, 1, 1);
85SH_FIXED_RATIO_CLK_SET(clkp_clk, plla_clk, 1, 1);
86SH_FIXED_RATIO_CLK_SET(clkg_clk, plla_clk, 1, 1);
87
88static struct clk *main_clks[] = {
89 &plla_clk,
90 &clkz_clk,
91 &clkzs_clk,
92 &clki_clk,
93 &clks_clk,
94 &clks1_clk,
95 &clks3_clk,
96 &clks4_clk,
97 &clkb_clk,
98 &clkout_clk,
99 &clkp_clk,
100 &clkg_clk,
101};
102
103enum { MSTP323, MSTP322, MSTP321, MSTP320,
104 MSTP120,
105 MSTP116, MSTP115, MSTP114,
106 MSTP110, MSTP109, MSTP108,
107 MSTP103, MSTP101, MSTP100,
108 MSTP030,
109 MSTP029, MSTP028, MSTP027, MSTP026, MSTP025, MSTP024, MSTP023, MSTP022, MSTP021,
110 MSTP016, MSTP015, MSTP014,
111 MSTP007,
112 MSTP_NR };
113
114static struct clk mstp_clks[MSTP_NR] = {
115 [MSTP323] = SH_CLK_MSTP32(&clkp_clk, MSTPCR3, 23, 0), /* SDHI0 */
116 [MSTP322] = SH_CLK_MSTP32(&clkp_clk, MSTPCR3, 22, 0), /* SDHI1 */
117 [MSTP321] = SH_CLK_MSTP32(&clkp_clk, MSTPCR3, 21, 0), /* SDHI2 */
118 [MSTP320] = SH_CLK_MSTP32(&clkp_clk, MSTPCR3, 20, 0), /* SDHI3 */
119 [MSTP120] = SH_CLK_MSTP32_STS(&clks_clk, MSTPCR1, 20, MSTPSR1, 0), /* VIN3 */
120 [MSTP116] = SH_CLK_MSTP32_STS(&clkp_clk, MSTPCR1, 16, MSTPSR1, 0), /* PCIe */
121 [MSTP115] = SH_CLK_MSTP32_STS(&clkp_clk, MSTPCR1, 15, MSTPSR1, 0), /* SATA */
122 [MSTP114] = SH_CLK_MSTP32_STS(&clkp_clk, MSTPCR1, 14, MSTPSR1, 0), /* Ether */
123 [MSTP110] = SH_CLK_MSTP32_STS(&clks_clk, MSTPCR1, 10, MSTPSR1, 0), /* VIN0 */
124 [MSTP109] = SH_CLK_MSTP32_STS(&clks_clk, MSTPCR1, 9, MSTPSR1, 0), /* VIN1 */
125 [MSTP108] = SH_CLK_MSTP32_STS(&clks_clk, MSTPCR1, 8, MSTPSR1, 0), /* VIN2 */
126 [MSTP103] = SH_CLK_MSTP32_STS(&clks_clk, MSTPCR1, 3, MSTPSR1, 0), /* DU */
127 [MSTP101] = SH_CLK_MSTP32_STS(&clkp_clk, MSTPCR1, 1, MSTPSR1, 0), /* USB2 */
128 [MSTP100] = SH_CLK_MSTP32_STS(&clkp_clk, MSTPCR1, 0, MSTPSR1, 0), /* USB0/1 */
129 [MSTP030] = SH_CLK_MSTP32(&clkp_clk, MSTPCR0, 30, 0), /* I2C0 */
130 [MSTP029] = SH_CLK_MSTP32(&clkp_clk, MSTPCR0, 29, 0), /* I2C1 */
131 [MSTP028] = SH_CLK_MSTP32(&clkp_clk, MSTPCR0, 28, 0), /* I2C2 */
132 [MSTP027] = SH_CLK_MSTP32(&clkp_clk, MSTPCR0, 27, 0), /* I2C3 */
133 [MSTP026] = SH_CLK_MSTP32(&clkp_clk, MSTPCR0, 26, 0), /* SCIF0 */
134 [MSTP025] = SH_CLK_MSTP32(&clkp_clk, MSTPCR0, 25, 0), /* SCIF1 */
135 [MSTP024] = SH_CLK_MSTP32(&clkp_clk, MSTPCR0, 24, 0), /* SCIF2 */
136 [MSTP023] = SH_CLK_MSTP32(&clkp_clk, MSTPCR0, 23, 0), /* SCIF3 */
137 [MSTP022] = SH_CLK_MSTP32(&clkp_clk, MSTPCR0, 22, 0), /* SCIF4 */
138 [MSTP021] = SH_CLK_MSTP32(&clkp_clk, MSTPCR0, 21, 0), /* SCIF5 */
139 [MSTP016] = SH_CLK_MSTP32(&clkp_clk, MSTPCR0, 16, 0), /* TMU0 */
140 [MSTP015] = SH_CLK_MSTP32(&clkp_clk, MSTPCR0, 15, 0), /* TMU1 */
141 [MSTP014] = SH_CLK_MSTP32(&clkp_clk, MSTPCR0, 14, 0), /* TMU2 */
142 [MSTP007] = SH_CLK_MSTP32(&clks_clk, MSTPCR0, 7, 0), /* HSPI */
143};
144
145static struct clk_lookup lookups[] = {
146 /* main clocks */
147 CLKDEV_CON_ID("plla_clk", &plla_clk),
148 CLKDEV_CON_ID("clkz_clk", &clkz_clk),
149 CLKDEV_CON_ID("clkzs_clk", &clkzs_clk),
150
151 /* DIV4 clocks */
152 CLKDEV_CON_ID("shyway_clk", &clks_clk),
153 CLKDEV_CON_ID("bus_clk", &clkout_clk),
154 CLKDEV_CON_ID("shyway4_clk", &clks4_clk),
155 CLKDEV_CON_ID("shyway3_clk", &clks3_clk),
156 CLKDEV_CON_ID("shyway1_clk", &clks1_clk),
157 CLKDEV_CON_ID("peripheral_clk", &clkp_clk),
158
159 /* MSTP32 clocks */
160 CLKDEV_DEV_ID("r8a7779-vin.3", &mstp_clks[MSTP120]), /* VIN3 */
161 CLKDEV_DEV_ID("rcar-pcie", &mstp_clks[MSTP116]), /* PCIe */
162 CLKDEV_DEV_ID("sata_rcar", &mstp_clks[MSTP115]), /* SATA */
163 CLKDEV_DEV_ID("fc600000.sata", &mstp_clks[MSTP115]), /* SATA w/DT */
164 CLKDEV_DEV_ID("r8a777x-ether", &mstp_clks[MSTP114]), /* Ether */
165 CLKDEV_DEV_ID("r8a7779-vin.0", &mstp_clks[MSTP110]), /* VIN0 */
166 CLKDEV_DEV_ID("r8a7779-vin.1", &mstp_clks[MSTP109]), /* VIN1 */
167 CLKDEV_DEV_ID("r8a7779-vin.2", &mstp_clks[MSTP108]), /* VIN2 */
168 CLKDEV_DEV_ID("ehci-platform.1", &mstp_clks[MSTP101]), /* USB EHCI port2 */
169 CLKDEV_DEV_ID("ohci-platform.1", &mstp_clks[MSTP101]), /* USB OHCI port2 */
170 CLKDEV_DEV_ID("ehci-platform.0", &mstp_clks[MSTP100]), /* USB EHCI port0/1 */
171 CLKDEV_DEV_ID("ohci-platform.0", &mstp_clks[MSTP100]), /* USB OHCI port0/1 */
172 CLKDEV_ICK_ID("fck", "sh-tmu.0", &mstp_clks[MSTP016]), /* TMU0 */
173 CLKDEV_DEV_ID("i2c-rcar.0", &mstp_clks[MSTP030]), /* I2C0 */
174 CLKDEV_DEV_ID("ffc70000.i2c", &mstp_clks[MSTP030]), /* I2C0 */
175 CLKDEV_DEV_ID("i2c-rcar.1", &mstp_clks[MSTP029]), /* I2C1 */
176 CLKDEV_DEV_ID("ffc71000.i2c", &mstp_clks[MSTP029]), /* I2C1 */
177 CLKDEV_DEV_ID("i2c-rcar.2", &mstp_clks[MSTP028]), /* I2C2 */
178 CLKDEV_DEV_ID("ffc72000.i2c", &mstp_clks[MSTP028]), /* I2C2 */
179 CLKDEV_DEV_ID("i2c-rcar.3", &mstp_clks[MSTP027]), /* I2C3 */
180 CLKDEV_DEV_ID("ffc73000.i2c", &mstp_clks[MSTP027]), /* I2C3 */
181 CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP026]), /* SCIF0 */
182 CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP025]), /* SCIF1 */
183 CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP024]), /* SCIF2 */
184 CLKDEV_DEV_ID("sh-sci.3", &mstp_clks[MSTP023]), /* SCIF3 */
185 CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP022]), /* SCIF4 */
186 CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP021]), /* SCIF6 */
187 CLKDEV_DEV_ID("sh-hspi.0", &mstp_clks[MSTP007]), /* HSPI0 */
188 CLKDEV_DEV_ID("fffc7000.spi", &mstp_clks[MSTP007]), /* HSPI0 */
189 CLKDEV_DEV_ID("sh-hspi.1", &mstp_clks[MSTP007]), /* HSPI1 */
190 CLKDEV_DEV_ID("fffc8000.spi", &mstp_clks[MSTP007]), /* HSPI1 */
191 CLKDEV_DEV_ID("sh-hspi.2", &mstp_clks[MSTP007]), /* HSPI2 */
192 CLKDEV_DEV_ID("fffc6000.spi", &mstp_clks[MSTP007]), /* HSPI2 */
193 CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP323]), /* SDHI0 */
194 CLKDEV_DEV_ID("ffe4c000.sd", &mstp_clks[MSTP323]), /* SDHI0 */
195 CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP322]), /* SDHI1 */
196 CLKDEV_DEV_ID("ffe4d000.sd", &mstp_clks[MSTP322]), /* SDHI1 */
197 CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP321]), /* SDHI2 */
198 CLKDEV_DEV_ID("ffe4e000.sd", &mstp_clks[MSTP321]), /* SDHI2 */
199 CLKDEV_DEV_ID("sh_mobile_sdhi.3", &mstp_clks[MSTP320]), /* SDHI3 */
200 CLKDEV_DEV_ID("ffe4f000.sd", &mstp_clks[MSTP320]), /* SDHI3 */
201 CLKDEV_DEV_ID("rcar-du-r8a7779", &mstp_clks[MSTP103]), /* DU */
202};
203
204void __init r8a7779_clock_init(void)
205{
206 u32 mode = r8a7779_read_mode_pins();
207 int k, ret = 0;
208
209 if (mode & MD(1)) {
210 plla_clk.rate = 1500000000;
211
212 SH_CLK_SET_RATIO(&clkz_clk_ratio, 2, 3);
213 SH_CLK_SET_RATIO(&clkzs_clk_ratio, 1, 6);
214 SH_CLK_SET_RATIO(&clki_clk_ratio, 1, 2);
215 SH_CLK_SET_RATIO(&clks_clk_ratio, 1, 6);
216 SH_CLK_SET_RATIO(&clks1_clk_ratio, 1, 12);
217 SH_CLK_SET_RATIO(&clks3_clk_ratio, 1, 8);
218 SH_CLK_SET_RATIO(&clks4_clk_ratio, 1, 16);
219 SH_CLK_SET_RATIO(&clkp_clk_ratio, 1, 24);
220 SH_CLK_SET_RATIO(&clkg_clk_ratio, 1, 24);
221 if (mode & MD(2)) {
222 SH_CLK_SET_RATIO(&clkb_clk_ratio, 1, 36);
223 SH_CLK_SET_RATIO(&clkout_clk_ratio, 1, 36);
224 } else {
225 SH_CLK_SET_RATIO(&clkb_clk_ratio, 1, 24);
226 SH_CLK_SET_RATIO(&clkout_clk_ratio, 1, 24);
227 }
228 } else {
229 plla_clk.rate = 1600000000;
230
231 SH_CLK_SET_RATIO(&clkz_clk_ratio, 1, 2);
232 SH_CLK_SET_RATIO(&clkzs_clk_ratio, 1, 8);
233 SH_CLK_SET_RATIO(&clki_clk_ratio, 1, 2);
234 SH_CLK_SET_RATIO(&clks_clk_ratio, 1, 8);
235 SH_CLK_SET_RATIO(&clks1_clk_ratio, 1, 16);
236 SH_CLK_SET_RATIO(&clks3_clk_ratio, 1, 8);
237 SH_CLK_SET_RATIO(&clks4_clk_ratio, 1, 16);
238 SH_CLK_SET_RATIO(&clkp_clk_ratio, 1, 32);
239 SH_CLK_SET_RATIO(&clkg_clk_ratio, 1, 24);
240 if (mode & MD(2)) {
241 SH_CLK_SET_RATIO(&clkb_clk_ratio, 1, 32);
242 SH_CLK_SET_RATIO(&clkout_clk_ratio, 1, 32);
243 } else {
244 SH_CLK_SET_RATIO(&clkb_clk_ratio, 1, 24);
245 SH_CLK_SET_RATIO(&clkout_clk_ratio, 1, 24);
246 }
247 }
248
249 for (k = 0; !ret && (k < ARRAY_SIZE(main_clks)); k++)
250 ret = clk_register(main_clks[k]);
251
252 if (!ret)
253 ret = sh_clk_mstp_register(mstp_clks, MSTP_NR);
254
255 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
256
257 if (!ret)
258 shmobile_clk_init();
259 else
260 panic("failed to setup r8a7779 clocks\n");
261}
262
263/* do nothing for !CONFIG_SMP or !CONFIG_HAVE_TWD */
264void __init __weak r8a7779_register_twd(void) { }
265
266void __init r8a7779_earlytimer_init(void)
267{
268 r8a7779_clock_init();
269 r8a7779_register_twd();
270 shmobile_earlytimer_init();
271}
diff --git a/arch/arm/mach-shmobile/clock-sh73a0.c b/arch/arm/mach-shmobile/clock-sh73a0.c
deleted file mode 100644
index 3855fb024fdb..000000000000
--- a/arch/arm/mach-shmobile/clock-sh73a0.c
+++ /dev/null
@@ -1,752 +0,0 @@
1/*
2 * sh73a0 clock framework support
3 *
4 * Copyright (C) 2010 Magnus Damm
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15#include <linux/init.h>
16#include <linux/kernel.h>
17#include <linux/io.h>
18#include <linux/sh_clk.h>
19#include <linux/clkdev.h>
20#include <asm/processor.h>
21#include "clock.h"
22#include "common.h"
23
24#define FRQCRA IOMEM(0xe6150000)
25#define FRQCRB IOMEM(0xe6150004)
26#define FRQCRD IOMEM(0xe61500e4)
27#define VCLKCR1 IOMEM(0xe6150008)
28#define VCLKCR2 IOMEM(0xe615000C)
29#define VCLKCR3 IOMEM(0xe615001C)
30#define ZBCKCR IOMEM(0xe6150010)
31#define FLCKCR IOMEM(0xe6150014)
32#define SD0CKCR IOMEM(0xe6150074)
33#define SD1CKCR IOMEM(0xe6150078)
34#define SD2CKCR IOMEM(0xe615007C)
35#define FSIACKCR IOMEM(0xe6150018)
36#define FSIBCKCR IOMEM(0xe6150090)
37#define SUBCKCR IOMEM(0xe6150080)
38#define SPUACKCR IOMEM(0xe6150084)
39#define SPUVCKCR IOMEM(0xe6150094)
40#define MSUCKCR IOMEM(0xe6150088)
41#define HSICKCR IOMEM(0xe615008C)
42#define MFCK1CR IOMEM(0xe6150098)
43#define MFCK2CR IOMEM(0xe615009C)
44#define DSITCKCR IOMEM(0xe6150060)
45#define DSI0PCKCR IOMEM(0xe6150064)
46#define DSI1PCKCR IOMEM(0xe6150068)
47#define DSI0PHYCR 0xe615006C
48#define DSI1PHYCR 0xe6150070
49#define PLLECR IOMEM(0xe61500d0)
50#define PLL0CR IOMEM(0xe61500d8)
51#define PLL1CR IOMEM(0xe6150028)
52#define PLL2CR IOMEM(0xe615002c)
53#define PLL3CR IOMEM(0xe61500dc)
54#define SMSTPCR0 IOMEM(0xe6150130)
55#define SMSTPCR1 IOMEM(0xe6150134)
56#define SMSTPCR2 IOMEM(0xe6150138)
57#define SMSTPCR3 IOMEM(0xe615013c)
58#define SMSTPCR4 IOMEM(0xe6150140)
59#define SMSTPCR5 IOMEM(0xe6150144)
60#define CKSCR IOMEM(0xe61500c0)
61
62/* Fixed 32 KHz root clock from EXTALR pin */
63static struct clk r_clk = {
64 .rate = 32768,
65};
66
67/*
68 * 26MHz default rate for the EXTAL1 root input clock.
69 * If needed, reset this with clk_set_rate() from the platform code.
70 */
71struct clk sh73a0_extal1_clk = {
72 .rate = 26000000,
73};
74
75/*
76 * 48MHz default rate for the EXTAL2 root input clock.
77 * If needed, reset this with clk_set_rate() from the platform code.
78 */
79struct clk sh73a0_extal2_clk = {
80 .rate = 48000000,
81};
82
83static struct sh_clk_ops main_clk_ops = {
84 .recalc = followparent_recalc,
85};
86
87/* Main clock */
88static struct clk main_clk = {
89 /* .parent wll be set on sh73a0_clock_init() */
90 .ops = &main_clk_ops,
91};
92
93/* PLL0, PLL1, PLL2, PLL3 */
94static unsigned long pll_recalc(struct clk *clk)
95{
96 unsigned long mult = 1;
97
98 if (__raw_readl(PLLECR) & (1 << clk->enable_bit)) {
99 mult = (((__raw_readl(clk->enable_reg) >> 24) & 0x3f) + 1);
100 /* handle CFG bit for PLL1 and PLL2 */
101 switch (clk->enable_bit) {
102 case 1:
103 case 2:
104 if (__raw_readl(clk->enable_reg) & (1 << 20))
105 mult *= 2;
106 }
107 }
108
109 return clk->parent->rate * mult;
110}
111
112static struct sh_clk_ops pll_clk_ops = {
113 .recalc = pll_recalc,
114};
115
116static struct clk pll0_clk = {
117 .ops = &pll_clk_ops,
118 .flags = CLK_ENABLE_ON_INIT,
119 .parent = &main_clk,
120 .enable_reg = (void __iomem *)PLL0CR,
121 .enable_bit = 0,
122};
123
124static struct clk pll1_clk = {
125 .ops = &pll_clk_ops,
126 .flags = CLK_ENABLE_ON_INIT,
127 .parent = &main_clk,
128 .enable_reg = (void __iomem *)PLL1CR,
129 .enable_bit = 1,
130};
131
132static struct clk pll2_clk = {
133 .ops = &pll_clk_ops,
134 .flags = CLK_ENABLE_ON_INIT,
135 .parent = &main_clk,
136 .enable_reg = (void __iomem *)PLL2CR,
137 .enable_bit = 2,
138};
139
140static struct clk pll3_clk = {
141 .ops = &pll_clk_ops,
142 .flags = CLK_ENABLE_ON_INIT,
143 .parent = &main_clk,
144 .enable_reg = (void __iomem *)PLL3CR,
145 .enable_bit = 3,
146};
147
148/* A fixed divide block */
149SH_CLK_RATIO(div2, 1, 2);
150SH_CLK_RATIO(div7, 1, 7);
151SH_CLK_RATIO(div13, 1, 13);
152
153SH_FIXED_RATIO_CLK(extal1_div2_clk, sh73a0_extal1_clk, div2);
154SH_FIXED_RATIO_CLK(extal2_div2_clk, sh73a0_extal2_clk, div2);
155SH_FIXED_RATIO_CLK(main_div2_clk, main_clk, div2);
156SH_FIXED_RATIO_CLK(pll1_div2_clk, pll1_clk, div2);
157SH_FIXED_RATIO_CLK(pll1_div7_clk, pll1_clk, div7);
158SH_FIXED_RATIO_CLK(pll1_div13_clk, pll1_clk, div13);
159
160/* External input clock */
161struct clk sh73a0_extcki_clk = {
162};
163
164struct clk sh73a0_extalr_clk = {
165};
166
167static struct clk *main_clks[] = {
168 &r_clk,
169 &sh73a0_extal1_clk,
170 &sh73a0_extal2_clk,
171 &extal1_div2_clk,
172 &extal2_div2_clk,
173 &main_clk,
174 &main_div2_clk,
175 &pll0_clk,
176 &pll1_clk,
177 &pll2_clk,
178 &pll3_clk,
179 &pll1_div2_clk,
180 &pll1_div7_clk,
181 &pll1_div13_clk,
182 &sh73a0_extcki_clk,
183 &sh73a0_extalr_clk,
184};
185
186static int frqcr_kick(void)
187{
188 int i;
189
190 /* set KICK bit in FRQCRB to update hardware setting, check success */
191 __raw_writel(__raw_readl(FRQCRB) | (1 << 31), FRQCRB);
192 for (i = 1000; i; i--)
193 if (__raw_readl(FRQCRB) & (1 << 31))
194 cpu_relax();
195 else
196 return i;
197
198 return -ETIMEDOUT;
199}
200
201static void div4_kick(struct clk *clk)
202{
203 frqcr_kick();
204}
205
206static int divisors[] = { 2, 3, 4, 6, 8, 12, 16, 18,
207 24, 0, 36, 48, 7 };
208
209static struct clk_div_mult_table div4_div_mult_table = {
210 .divisors = divisors,
211 .nr_divisors = ARRAY_SIZE(divisors),
212};
213
214static struct clk_div4_table div4_table = {
215 .div_mult_table = &div4_div_mult_table,
216 .kick = div4_kick,
217};
218
219enum { DIV4_I, DIV4_ZG, DIV4_M3, DIV4_B, DIV4_M1, DIV4_M2,
220 DIV4_Z, DIV4_ZX, DIV4_HP, DIV4_NR };
221
222#define DIV4(_reg, _bit, _mask, _flags) \
223 SH_CLK_DIV4(&pll1_clk, _reg, _bit, _mask, _flags)
224
225static struct clk div4_clks[DIV4_NR] = {
226 [DIV4_I] = DIV4(FRQCRA, 20, 0xdff, CLK_ENABLE_ON_INIT),
227 /*
228 * ZG clock is dividing PLL0 frequency to supply SGX. Make sure not to
229 * exceed maximum frequencies of 201.5MHz for VDD_DVFS=1.175 and
230 * 239.2MHz for VDD_DVFS=1.315V.
231 */
232 [DIV4_ZG] = SH_CLK_DIV4(&pll0_clk, FRQCRA, 16, 0xd7f, CLK_ENABLE_ON_INIT),
233 [DIV4_M3] = DIV4(FRQCRA, 12, 0x1dff, CLK_ENABLE_ON_INIT),
234 [DIV4_B] = DIV4(FRQCRA, 8, 0xdff, CLK_ENABLE_ON_INIT),
235 [DIV4_M1] = DIV4(FRQCRA, 4, 0x1dff, 0),
236 [DIV4_M2] = DIV4(FRQCRA, 0, 0x1dff, 0),
237 [DIV4_Z] = SH_CLK_DIV4(&pll0_clk, FRQCRB, 24, 0x97f, 0),
238 [DIV4_ZX] = DIV4(FRQCRB, 12, 0xdff, 0),
239 [DIV4_HP] = DIV4(FRQCRB, 4, 0xdff, 0),
240};
241
242static unsigned long twd_recalc(struct clk *clk)
243{
244 return clk_get_rate(clk->parent) / 4;
245}
246
247static struct sh_clk_ops twd_clk_ops = {
248 .recalc = twd_recalc,
249};
250
251static struct clk twd_clk = {
252 .parent = &div4_clks[DIV4_Z],
253 .ops = &twd_clk_ops,
254};
255
256static struct sh_clk_ops zclk_ops, kicker_ops;
257static const struct sh_clk_ops *div4_clk_ops;
258
259static int zclk_set_rate(struct clk *clk, unsigned long rate)
260{
261 int ret;
262
263 if (!clk->parent || !__clk_get(clk->parent))
264 return -ENODEV;
265
266 if (readl(FRQCRB) & (1 << 31))
267 return -EBUSY;
268
269 if (rate == clk_get_rate(clk->parent)) {
270 /* 1:1 - switch off divider */
271 __raw_writel(__raw_readl(FRQCRB) & ~(1 << 28), FRQCRB);
272 /* nullify the divider to prepare for the next time */
273 ret = div4_clk_ops->set_rate(clk, rate / 2);
274 if (!ret)
275 ret = frqcr_kick();
276 if (ret > 0)
277 ret = 0;
278 } else {
279 /* Enable the divider */
280 __raw_writel(__raw_readl(FRQCRB) | (1 << 28), FRQCRB);
281
282 ret = frqcr_kick();
283 if (ret >= 0)
284 /*
285 * set the divider - call the DIV4 method, it will kick
286 * FRQCRB too
287 */
288 ret = div4_clk_ops->set_rate(clk, rate);
289 if (ret < 0)
290 goto esetrate;
291 }
292
293esetrate:
294 __clk_put(clk->parent);
295 return ret;
296}
297
298static long zclk_round_rate(struct clk *clk, unsigned long rate)
299{
300 unsigned long div_freq = div4_clk_ops->round_rate(clk, rate),
301 parent_freq = clk_get_rate(clk->parent);
302
303 if (rate > div_freq && abs(parent_freq - rate) < rate - div_freq)
304 return parent_freq;
305
306 return div_freq;
307}
308
309static unsigned long zclk_recalc(struct clk *clk)
310{
311 /*
312 * Must recalculate frequencies in case PLL0 has been changed, even if
313 * the divisor is unused ATM!
314 */
315 unsigned long div_freq = div4_clk_ops->recalc(clk);
316
317 if (__raw_readl(FRQCRB) & (1 << 28))
318 return div_freq;
319
320 return clk_get_rate(clk->parent);
321}
322
323static int kicker_set_rate(struct clk *clk, unsigned long rate)
324{
325 if (__raw_readl(FRQCRB) & (1 << 31))
326 return -EBUSY;
327
328 return div4_clk_ops->set_rate(clk, rate);
329}
330
331static void div4_clk_extend(void)
332{
333 int i;
334
335 div4_clk_ops = div4_clks[0].ops;
336
337 /* Add a kicker-busy check before changing the rate */
338 kicker_ops = *div4_clk_ops;
339 /* We extend the DIV4 clock with a 1:1 pass-through case */
340 zclk_ops = *div4_clk_ops;
341
342 kicker_ops.set_rate = kicker_set_rate;
343 zclk_ops.set_rate = zclk_set_rate;
344 zclk_ops.round_rate = zclk_round_rate;
345 zclk_ops.recalc = zclk_recalc;
346
347 for (i = 0; i < DIV4_NR; i++)
348 div4_clks[i].ops = i == DIV4_Z ? &zclk_ops : &kicker_ops;
349}
350
351enum { DIV6_VCK1, DIV6_VCK2, DIV6_VCK3, DIV6_ZB1,
352 DIV6_FLCTL, DIV6_SDHI0, DIV6_SDHI1, DIV6_SDHI2,
353 DIV6_FSIA, DIV6_FSIB, DIV6_SUB,
354 DIV6_SPUA, DIV6_SPUV, DIV6_MSU,
355 DIV6_HSI, DIV6_MFG1, DIV6_MFG2,
356 DIV6_DSIT, DIV6_DSI0P, DIV6_DSI1P,
357 DIV6_NR };
358
359static struct clk *vck_parent[8] = {
360 [0] = &pll1_div2_clk,
361 [1] = &pll2_clk,
362 [2] = &sh73a0_extcki_clk,
363 [3] = &sh73a0_extal2_clk,
364 [4] = &main_div2_clk,
365 [5] = &sh73a0_extalr_clk,
366 [6] = &main_clk,
367};
368
369static struct clk *pll_parent[4] = {
370 [0] = &pll1_div2_clk,
371 [1] = &pll2_clk,
372 [2] = &pll1_div13_clk,
373};
374
375static struct clk *hsi_parent[4] = {
376 [0] = &pll1_div2_clk,
377 [1] = &pll2_clk,
378 [2] = &pll1_div7_clk,
379};
380
381static struct clk *pll_extal2_parent[] = {
382 [0] = &pll1_div2_clk,
383 [1] = &pll2_clk,
384 [2] = &sh73a0_extal2_clk,
385 [3] = &sh73a0_extal2_clk,
386};
387
388static struct clk *dsi_parent[8] = {
389 [0] = &pll1_div2_clk,
390 [1] = &pll2_clk,
391 [2] = &main_clk,
392 [3] = &sh73a0_extal2_clk,
393 [4] = &sh73a0_extcki_clk,
394};
395
396static struct clk div6_clks[DIV6_NR] = {
397 [DIV6_VCK1] = SH_CLK_DIV6_EXT(VCLKCR1, 0,
398 vck_parent, ARRAY_SIZE(vck_parent), 12, 3),
399 [DIV6_VCK2] = SH_CLK_DIV6_EXT(VCLKCR2, 0,
400 vck_parent, ARRAY_SIZE(vck_parent), 12, 3),
401 [DIV6_VCK3] = SH_CLK_DIV6_EXT(VCLKCR3, 0,
402 vck_parent, ARRAY_SIZE(vck_parent), 12, 3),
403 [DIV6_ZB1] = SH_CLK_DIV6_EXT(ZBCKCR, CLK_ENABLE_ON_INIT,
404 pll_parent, ARRAY_SIZE(pll_parent), 7, 1),
405 [DIV6_FLCTL] = SH_CLK_DIV6_EXT(FLCKCR, 0,
406 pll_parent, ARRAY_SIZE(pll_parent), 7, 1),
407 [DIV6_SDHI0] = SH_CLK_DIV6_EXT(SD0CKCR, 0,
408 pll_parent, ARRAY_SIZE(pll_parent), 6, 2),
409 [DIV6_SDHI1] = SH_CLK_DIV6_EXT(SD1CKCR, 0,
410 pll_parent, ARRAY_SIZE(pll_parent), 6, 2),
411 [DIV6_SDHI2] = SH_CLK_DIV6_EXT(SD2CKCR, 0,
412 pll_parent, ARRAY_SIZE(pll_parent), 6, 2),
413 [DIV6_FSIA] = SH_CLK_DIV6_EXT(FSIACKCR, 0,
414 pll_parent, ARRAY_SIZE(pll_parent), 6, 1),
415 [DIV6_FSIB] = SH_CLK_DIV6_EXT(FSIBCKCR, 0,
416 pll_parent, ARRAY_SIZE(pll_parent), 6, 1),
417 [DIV6_SUB] = SH_CLK_DIV6_EXT(SUBCKCR, 0,
418 pll_extal2_parent, ARRAY_SIZE(pll_extal2_parent), 6, 2),
419 [DIV6_SPUA] = SH_CLK_DIV6_EXT(SPUACKCR, 0,
420 pll_extal2_parent, ARRAY_SIZE(pll_extal2_parent), 6, 2),
421 [DIV6_SPUV] = SH_CLK_DIV6_EXT(SPUVCKCR, 0,
422 pll_extal2_parent, ARRAY_SIZE(pll_extal2_parent), 6, 2),
423 [DIV6_MSU] = SH_CLK_DIV6_EXT(MSUCKCR, 0,
424 pll_parent, ARRAY_SIZE(pll_parent), 7, 1),
425 [DIV6_HSI] = SH_CLK_DIV6_EXT(HSICKCR, 0,
426 hsi_parent, ARRAY_SIZE(hsi_parent), 6, 2),
427 [DIV6_MFG1] = SH_CLK_DIV6_EXT(MFCK1CR, 0,
428 pll_parent, ARRAY_SIZE(pll_parent), 7, 1),
429 [DIV6_MFG2] = SH_CLK_DIV6_EXT(MFCK2CR, 0,
430 pll_parent, ARRAY_SIZE(pll_parent), 7, 1),
431 [DIV6_DSIT] = SH_CLK_DIV6_EXT(DSITCKCR, 0,
432 pll_parent, ARRAY_SIZE(pll_parent), 7, 1),
433 [DIV6_DSI0P] = SH_CLK_DIV6_EXT(DSI0PCKCR, 0,
434 dsi_parent, ARRAY_SIZE(dsi_parent), 12, 3),
435 [DIV6_DSI1P] = SH_CLK_DIV6_EXT(DSI1PCKCR, 0,
436 dsi_parent, ARRAY_SIZE(dsi_parent), 12, 3),
437};
438
439/* DSI DIV */
440static unsigned long dsiphy_recalc(struct clk *clk)
441{
442 u32 value;
443
444 value = __raw_readl(clk->mapping->base);
445
446 /* FIXME */
447 if (!(value & 0x000B8000))
448 return clk->parent->rate;
449
450 value &= 0x3f;
451 value += 1;
452
453 if ((value < 12) ||
454 (value > 33)) {
455 pr_err("DSIPHY has wrong value (%d)", value);
456 return 0;
457 }
458
459 return clk->parent->rate / value;
460}
461
462static long dsiphy_round_rate(struct clk *clk, unsigned long rate)
463{
464 return clk_rate_mult_range_round(clk, 12, 33, rate);
465}
466
467static void dsiphy_disable(struct clk *clk)
468{
469 u32 value;
470
471 value = __raw_readl(clk->mapping->base);
472 value &= ~0x000B8000;
473
474 __raw_writel(value , clk->mapping->base);
475}
476
477static int dsiphy_enable(struct clk *clk)
478{
479 u32 value;
480 int multi;
481
482 value = __raw_readl(clk->mapping->base);
483 multi = (value & 0x3f) + 1;
484
485 if ((multi < 12) || (multi > 33))
486 return -EIO;
487
488 __raw_writel(value | 0x000B8000, clk->mapping->base);
489
490 return 0;
491}
492
493static int dsiphy_set_rate(struct clk *clk, unsigned long rate)
494{
495 u32 value;
496 int idx;
497
498 idx = rate / clk->parent->rate;
499 if ((idx < 12) || (idx > 33))
500 return -EINVAL;
501
502 idx += -1;
503
504 value = __raw_readl(clk->mapping->base);
505 value = (value & ~0x3f) + idx;
506
507 __raw_writel(value, clk->mapping->base);
508
509 return 0;
510}
511
512static struct sh_clk_ops dsiphy_clk_ops = {
513 .recalc = dsiphy_recalc,
514 .round_rate = dsiphy_round_rate,
515 .set_rate = dsiphy_set_rate,
516 .enable = dsiphy_enable,
517 .disable = dsiphy_disable,
518};
519
520static struct clk_mapping dsi0phy_clk_mapping = {
521 .phys = DSI0PHYCR,
522 .len = 4,
523};
524
525static struct clk_mapping dsi1phy_clk_mapping = {
526 .phys = DSI1PHYCR,
527 .len = 4,
528};
529
530static struct clk dsi0phy_clk = {
531 .ops = &dsiphy_clk_ops,
532 .parent = &div6_clks[DIV6_DSI0P], /* late install */
533 .mapping = &dsi0phy_clk_mapping,
534};
535
536static struct clk dsi1phy_clk = {
537 .ops = &dsiphy_clk_ops,
538 .parent = &div6_clks[DIV6_DSI1P], /* late install */
539 .mapping = &dsi1phy_clk_mapping,
540};
541
542static struct clk *late_main_clks[] = {
543 &dsi0phy_clk,
544 &dsi1phy_clk,
545 &twd_clk,
546};
547
548enum { MSTP001,
549 MSTP129, MSTP128, MSTP127, MSTP126, MSTP125, MSTP118, MSTP116, MSTP112, MSTP100,
550 MSTP219, MSTP218, MSTP217,
551 MSTP207, MSTP206, MSTP204, MSTP203, MSTP202, MSTP201, MSTP200,
552 MSTP331, MSTP329, MSTP328, MSTP325, MSTP323, MSTP322,
553 MSTP314, MSTP313, MSTP312, MSTP311,
554 MSTP304, MSTP303, MSTP302, MSTP301, MSTP300,
555 MSTP411, MSTP410, MSTP403,
556 MSTP508,
557 MSTP_NR };
558
559#define MSTP(_parent, _reg, _bit, _flags) \
560 SH_CLK_MSTP32(_parent, _reg, _bit, _flags)
561
562static struct clk mstp_clks[MSTP_NR] = {
563 [MSTP001] = MSTP(&div4_clks[DIV4_HP], SMSTPCR0, 1, 0), /* IIC2 */
564 [MSTP129] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 29, 0), /* CEU1 */
565 [MSTP128] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 28, 0), /* CSI2-RX1 */
566 [MSTP127] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 27, 0), /* CEU0 */
567 [MSTP126] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 26, 0), /* CSI2-RX0 */
568 [MSTP125] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR1, 25, 0), /* TMU0 */
569 [MSTP118] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 18, 0), /* DSITX0 */
570 [MSTP116] = MSTP(&div4_clks[DIV4_HP], SMSTPCR1, 16, 0), /* IIC0 */
571 [MSTP112] = MSTP(&div4_clks[DIV4_ZG], SMSTPCR1, 12, 0), /* SGX */
572 [MSTP100] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 0, 0), /* LCDC0 */
573 [MSTP219] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 19, 0), /* SCIFA7 */
574 [MSTP218] = MSTP(&div4_clks[DIV4_HP], SMSTPCR2, 18, 0), /* SY-DMAC */
575 [MSTP217] = MSTP(&div4_clks[DIV4_HP], SMSTPCR2, 17, 0), /* MP-DMAC */
576 [MSTP207] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 7, 0), /* SCIFA5 */
577 [MSTP206] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 6, 0), /* SCIFB */
578 [MSTP204] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 4, 0), /* SCIFA0 */
579 [MSTP203] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 3, 0), /* SCIFA1 */
580 [MSTP202] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 2, 0), /* SCIFA2 */
581 [MSTP201] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 1, 0), /* SCIFA3 */
582 [MSTP200] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 0, 0), /* SCIFA4 */
583 [MSTP331] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR3, 31, 0), /* SCIFA6 */
584 [MSTP329] = MSTP(&r_clk, SMSTPCR3, 29, 0), /* CMT10 */
585 [MSTP328] = MSTP(&div4_clks[DIV4_HP], SMSTPCR3, 28, 0), /*FSI*/
586 [MSTP325] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR3, 25, 0), /* IrDA */
587 [MSTP323] = MSTP(&div4_clks[DIV4_HP], SMSTPCR3, 23, 0), /* IIC1 */
588 [MSTP322] = MSTP(&div4_clks[DIV4_HP], SMSTPCR3, 22, 0), /* USB */
589 [MSTP314] = MSTP(&div6_clks[DIV6_SDHI0], SMSTPCR3, 14, 0), /* SDHI0 */
590 [MSTP313] = MSTP(&div6_clks[DIV6_SDHI1], SMSTPCR3, 13, 0), /* SDHI1 */
591 [MSTP312] = MSTP(&div4_clks[DIV4_HP], SMSTPCR3, 12, 0), /* MMCIF0 */
592 [MSTP311] = MSTP(&div6_clks[DIV6_SDHI2], SMSTPCR3, 11, 0), /* SDHI2 */
593 [MSTP304] = MSTP(&main_div2_clk, SMSTPCR3, 4, 0), /* TPU0 */
594 [MSTP303] = MSTP(&main_div2_clk, SMSTPCR3, 3, 0), /* TPU1 */
595 [MSTP302] = MSTP(&main_div2_clk, SMSTPCR3, 2, 0), /* TPU2 */
596 [MSTP301] = MSTP(&main_div2_clk, SMSTPCR3, 1, 0), /* TPU3 */
597 [MSTP300] = MSTP(&main_div2_clk, SMSTPCR3, 0, 0), /* TPU4 */
598 [MSTP411] = MSTP(&div4_clks[DIV4_HP], SMSTPCR4, 11, 0), /* IIC3 */
599 [MSTP410] = MSTP(&div4_clks[DIV4_HP], SMSTPCR4, 10, 0), /* IIC4 */
600 [MSTP403] = MSTP(&r_clk, SMSTPCR4, 3, 0), /* KEYSC */
601 [MSTP508] = MSTP(&div4_clks[DIV4_HP], SMSTPCR5, 8, 0), /* INTCA0 */
602};
603
604/* The lookups structure below includes duplicate entries for some clocks
605 * with alternate names.
606 * - The traditional name used when a device is initialised with platform data
607 * - The name used when a device is initialised using device tree
608 * The longer-term aim is to remove these duplicates, and indeed the
609 * lookups table entirely, by describing clocks using device tree.
610 */
611static struct clk_lookup lookups[] = {
612 /* main clocks */
613 CLKDEV_CON_ID("r_clk", &r_clk),
614 CLKDEV_DEV_ID("smp_twd", &twd_clk), /* smp_twd */
615
616 /* DIV4 clocks */
617 CLKDEV_DEV_ID("cpu0", &div4_clks[DIV4_Z]),
618
619 /* DIV6 clocks */
620 CLKDEV_CON_ID("vck1_clk", &div6_clks[DIV6_VCK1]),
621 CLKDEV_CON_ID("vck2_clk", &div6_clks[DIV6_VCK2]),
622 CLKDEV_CON_ID("vck3_clk", &div6_clks[DIV6_VCK3]),
623 CLKDEV_CON_ID("sdhi0_clk", &div6_clks[DIV6_SDHI0]),
624 CLKDEV_CON_ID("sdhi1_clk", &div6_clks[DIV6_SDHI1]),
625 CLKDEV_CON_ID("sdhi2_clk", &div6_clks[DIV6_SDHI2]),
626
627 /* MSTP32 clocks */
628 CLKDEV_DEV_ID("i2c-sh_mobile.2", &mstp_clks[MSTP001]), /* I2C2 */
629 CLKDEV_DEV_ID("e6824000.i2c", &mstp_clks[MSTP001]), /* I2C2 */
630 CLKDEV_DEV_ID("sh_mobile_ceu.1", &mstp_clks[MSTP129]), /* CEU1 */
631 CLKDEV_DEV_ID("sh-mobile-csi2.1", &mstp_clks[MSTP128]), /* CSI2-RX1 */
632 CLKDEV_DEV_ID("sh_mobile_ceu.0", &mstp_clks[MSTP127]), /* CEU0 */
633 CLKDEV_DEV_ID("sh-mobile-csi2.0", &mstp_clks[MSTP126]), /* CSI2-RX0 */
634 CLKDEV_DEV_ID("sh-mipi-dsi.0", &mstp_clks[MSTP118]), /* DSITX */
635 CLKDEV_DEV_ID("i2c-sh_mobile.0", &mstp_clks[MSTP116]), /* I2C0 */
636 CLKDEV_DEV_ID("e6820000.i2c", &mstp_clks[MSTP116]), /* I2C0 */
637 CLKDEV_DEV_ID("sh_mobile_lcdc_fb.0", &mstp_clks[MSTP100]), /* LCDC0 */
638 CLKDEV_DEV_ID("sh-sci.7", &mstp_clks[MSTP219]), /* SCIFA7 */
639 CLKDEV_DEV_ID("e6cd0000.serial", &mstp_clks[MSTP219]), /* SCIFA7 */
640 CLKDEV_DEV_ID("sh-dma-engine.0", &mstp_clks[MSTP218]), /* SY-DMAC */
641 CLKDEV_DEV_ID("sh-dma-engine.1", &mstp_clks[MSTP217]), /* MP-DMAC */
642 CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP207]), /* SCIFA5 */
643 CLKDEV_DEV_ID("e6cb0000.serial", &mstp_clks[MSTP207]), /* SCIFA5 */
644 CLKDEV_DEV_ID("sh-sci.8", &mstp_clks[MSTP206]), /* SCIFB */
645 CLKDEV_DEV_ID("e6c3000.serial", &mstp_clks[MSTP206]), /* SCIFB */
646 CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP204]), /* SCIFA0 */
647 CLKDEV_DEV_ID("e6c40000.serial", &mstp_clks[MSTP204]), /* SCIFA0 */
648 CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP203]), /* SCIFA1 */
649 CLKDEV_DEV_ID("e6c50000.serial", &mstp_clks[MSTP203]), /* SCIFA1 */
650 CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP202]), /* SCIFA2 */
651 CLKDEV_DEV_ID("e6c60000.serial", &mstp_clks[MSTP202]), /* SCIFA2 */
652 CLKDEV_DEV_ID("sh-sci.3", &mstp_clks[MSTP201]), /* SCIFA3 */
653 CLKDEV_DEV_ID("e6c70000.serial", &mstp_clks[MSTP201]), /* SCIFA3 */
654 CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP200]), /* SCIFA4 */
655 CLKDEV_DEV_ID("e6c80000.serial", &mstp_clks[MSTP200]), /* SCIFA4 */
656 CLKDEV_DEV_ID("sh-sci.6", &mstp_clks[MSTP331]), /* SCIFA6 */
657 CLKDEV_DEV_ID("e6cc0000.serial", &mstp_clks[MSTP331]), /* SCIFA6 */
658 CLKDEV_DEV_ID("sh_fsi2", &mstp_clks[MSTP328]), /* FSI */
659 CLKDEV_DEV_ID("ec230000.sound", &mstp_clks[MSTP328]), /* FSI */
660 CLKDEV_DEV_ID("sh_irda.0", &mstp_clks[MSTP325]), /* IrDA */
661 CLKDEV_DEV_ID("i2c-sh_mobile.1", &mstp_clks[MSTP323]), /* I2C1 */
662 CLKDEV_DEV_ID("e6822000.i2c", &mstp_clks[MSTP323]), /* I2C1 */
663 CLKDEV_DEV_ID("renesas_usbhs", &mstp_clks[MSTP322]), /* USB */
664 CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP314]), /* SDHI0 */
665 CLKDEV_DEV_ID("ee100000.sd", &mstp_clks[MSTP314]), /* SDHI0 */
666 CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP313]), /* SDHI1 */
667 CLKDEV_DEV_ID("ee120000.sd", &mstp_clks[MSTP313]), /* SDHI1 */
668 CLKDEV_DEV_ID("sh_mmcif.0", &mstp_clks[MSTP312]), /* MMCIF0 */
669 CLKDEV_DEV_ID("e6bd0000.mmc", &mstp_clks[MSTP312]), /* MMCIF0 */
670 CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP311]), /* SDHI2 */
671 CLKDEV_DEV_ID("ee140000.sd", &mstp_clks[MSTP311]), /* SDHI2 */
672 CLKDEV_DEV_ID("renesas-tpu-pwm.0", &mstp_clks[MSTP304]), /* TPU0 */
673 CLKDEV_DEV_ID("renesas-tpu-pwm.1", &mstp_clks[MSTP303]), /* TPU1 */
674 CLKDEV_DEV_ID("renesas-tpu-pwm.2", &mstp_clks[MSTP302]), /* TPU2 */
675 CLKDEV_DEV_ID("renesas-tpu-pwm.3", &mstp_clks[MSTP301]), /* TPU3 */
676 CLKDEV_DEV_ID("renesas-tpu-pwm.4", &mstp_clks[MSTP300]), /* TPU4 */
677 CLKDEV_DEV_ID("i2c-sh_mobile.3", &mstp_clks[MSTP411]), /* I2C3 */
678 CLKDEV_DEV_ID("e6826000.i2c", &mstp_clks[MSTP411]), /* I2C3 */
679 CLKDEV_DEV_ID("i2c-sh_mobile.4", &mstp_clks[MSTP410]), /* I2C4 */
680 CLKDEV_DEV_ID("e6828000.i2c", &mstp_clks[MSTP410]), /* I2C4 */
681 CLKDEV_DEV_ID("sh_keysc.0", &mstp_clks[MSTP403]), /* KEYSC */
682 CLKDEV_DEV_ID("renesas_intc_irqpin.0", &mstp_clks[MSTP508]), /* INTCA0 */
683 CLKDEV_DEV_ID("e6900000.irqpin", &mstp_clks[MSTP508]), /* INTCA0 */
684 CLKDEV_DEV_ID("renesas_intc_irqpin.1", &mstp_clks[MSTP508]), /* INTCA0 */
685 CLKDEV_DEV_ID("e6900004.irqpin", &mstp_clks[MSTP508]), /* INTCA0 */
686 CLKDEV_DEV_ID("renesas_intc_irqpin.2", &mstp_clks[MSTP508]), /* INTCA0 */
687 CLKDEV_DEV_ID("e6900008.irqpin", &mstp_clks[MSTP508]), /* INTCA0 */
688 CLKDEV_DEV_ID("renesas_intc_irqpin.3", &mstp_clks[MSTP508]), /* INTCA0 */
689 CLKDEV_DEV_ID("e690000c.irqpin", &mstp_clks[MSTP508]), /* INTCA0 */
690
691 /* ICK */
692 CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSIT]),
693 CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSIT]),
694 CLKDEV_ICK_ID("dsip_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSI0P]),
695 CLKDEV_ICK_ID("dsip_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSI1P]),
696 CLKDEV_ICK_ID("dsiphy_clk", "sh-mipi-dsi.0", &dsi0phy_clk),
697 CLKDEV_ICK_ID("dsiphy_clk", "sh-mipi-dsi.1", &dsi1phy_clk),
698 CLKDEV_ICK_ID("fck", "sh-cmt-48.1", &mstp_clks[MSTP329]), /* CMT1 */
699 CLKDEV_ICK_ID("fck", "e6138000.timer", &mstp_clks[MSTP329]), /* CMT1 */
700 CLKDEV_ICK_ID("fck", "sh-tmu.0", &mstp_clks[MSTP125]), /* TMU0 */
701};
702
703void __init sh73a0_clock_init(void)
704{
705 int k, ret = 0;
706
707 /* Set SDHI clocks to a known state */
708 __raw_writel(0x108, SD0CKCR);
709 __raw_writel(0x108, SD1CKCR);
710 __raw_writel(0x108, SD2CKCR);
711
712 /* detect main clock parent */
713 switch ((__raw_readl(CKSCR) >> 28) & 0x03) {
714 case 0:
715 main_clk.parent = &sh73a0_extal1_clk;
716 break;
717 case 1:
718 main_clk.parent = &extal1_div2_clk;
719 break;
720 case 2:
721 main_clk.parent = &sh73a0_extal2_clk;
722 break;
723 case 3:
724 main_clk.parent = &extal2_div2_clk;
725 break;
726 }
727
728 for (k = 0; !ret && (k < ARRAY_SIZE(main_clks)); k++)
729 ret = clk_register(main_clks[k]);
730
731 if (!ret) {
732 ret = sh_clk_div4_register(div4_clks, DIV4_NR, &div4_table);
733 if (!ret)
734 div4_clk_extend();
735 }
736
737 if (!ret)
738 ret = sh_clk_div6_reparent_register(div6_clks, DIV6_NR);
739
740 if (!ret)
741 ret = sh_clk_mstp_register(mstp_clks, MSTP_NR);
742
743 for (k = 0; !ret && (k < ARRAY_SIZE(late_main_clks)); k++)
744 ret = clk_register(late_main_clks[k]);
745
746 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
747
748 if (!ret)
749 shmobile_clk_init();
750 else
751 panic("failed to setup sh73a0 clocks\n");
752}
diff --git a/arch/arm/mach-shmobile/dma-register.h b/arch/arm/mach-shmobile/dma-register.h
deleted file mode 100644
index 52a2f66e600f..000000000000
--- a/arch/arm/mach-shmobile/dma-register.h
+++ /dev/null
@@ -1,84 +0,0 @@
1/*
2 * SH-ARM CPU-specific DMA definitions, used by both DMA drivers
3 *
4 * Copyright (C) 2012 Renesas Solutions Corp
5 *
6 * Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
7 *
8 * Based on arch/sh/include/cpu-sh4/cpu/dma-register.h
9 * Copyright (C) 2010 Guennadi Liakhovetski <g.liakhovetski@gmx.de>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14 */
15
16#ifndef DMA_REGISTER_H
17#define DMA_REGISTER_H
18
19/*
20 * Direct Memory Access Controller
21 */
22
23/* Transmit sizes and respective CHCR register values */
24enum {
25 XMIT_SZ_8BIT = 0,
26 XMIT_SZ_16BIT = 1,
27 XMIT_SZ_32BIT = 2,
28 XMIT_SZ_64BIT = 7,
29 XMIT_SZ_128BIT = 3,
30 XMIT_SZ_256BIT = 4,
31 XMIT_SZ_512BIT = 5,
32};
33
34/* log2(size / 8) - used to calculate number of transfers */
35static const unsigned int dma_ts_shift[] = {
36 [XMIT_SZ_8BIT] = 0,
37 [XMIT_SZ_16BIT] = 1,
38 [XMIT_SZ_32BIT] = 2,
39 [XMIT_SZ_64BIT] = 3,
40 [XMIT_SZ_128BIT] = 4,
41 [XMIT_SZ_256BIT] = 5,
42 [XMIT_SZ_512BIT] = 6,
43};
44
45#define TS_LOW_BIT 0x3 /* --xx */
46#define TS_HI_BIT 0xc /* xx-- */
47
48#define TS_LOW_SHIFT (3)
49#define TS_HI_SHIFT (20 - 2) /* 2 bits for shifted low TS */
50
51#define TS_INDEX2VAL(i) \
52 ((((i) & TS_LOW_BIT) << TS_LOW_SHIFT) |\
53 (((i) & TS_HI_BIT) << TS_HI_SHIFT))
54
55#define CHCR_TX(xmit_sz) (DM_FIX | SM_INC | RS_ERS | TS_INDEX2VAL((xmit_sz)))
56#define CHCR_RX(xmit_sz) (DM_INC | SM_FIX | RS_ERS | TS_INDEX2VAL((xmit_sz)))
57
58
59/*
60 * USB High-Speed DMAC
61 */
62/* Transmit sizes and respective CHCR register values */
63enum {
64 USBTS_XMIT_SZ_8BYTE = 0,
65 USBTS_XMIT_SZ_16BYTE = 1,
66 USBTS_XMIT_SZ_32BYTE = 2,
67};
68
69/* log2(size / 8) - used to calculate number of transfers */
70static const unsigned int dma_usbts_shift[] = {
71 [USBTS_XMIT_SZ_8BYTE] = 3,
72 [USBTS_XMIT_SZ_16BYTE] = 4,
73 [USBTS_XMIT_SZ_32BYTE] = 5,
74};
75
76#define USBTS_LOW_BIT 0x3 /* --xx */
77#define USBTS_HI_BIT 0x0 /* ---- */
78
79#define USBTS_LOW_SHIFT 6
80#define USBTS_HI_SHIFT 0
81
82#define USBTS_INDEX2VAL(i) (((i) & 3) << 6)
83
84#endif /* DMA_REGISTER_H */
diff --git a/arch/arm/mach-shmobile/include/mach/head-kzm9g.txt b/arch/arm/mach-shmobile/include/mach/head-kzm9g.txt
deleted file mode 100644
index 9531f46a822a..000000000000
--- a/arch/arm/mach-shmobile/include/mach/head-kzm9g.txt
+++ /dev/null
@@ -1,410 +0,0 @@
1LIST "KZM9G low-level initialization routine."
2LIST "Adapted from u-boot KZM9G support code."
3
4LIST "Copyright (C) 2013 Ulrich Hecht"
5
6LIST "This program is free software; you can redistribute it and/or modify"
7LIST "it under the terms of the GNU General Public License version 2 as"
8LIST "published by the Free Software Foundation."
9
10LIST "This program is distributed in the hope that it will be useful,"
11LIST "but WITHOUT ANY WARRANTY; without even the implied warranty of"
12LIST "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the"
13LIST "GNU General Public License for more details."
14
15
16LIST "Register definitions:"
17
18LIST "Secure control register"
19#define LIFEC_SEC_SRC (0xE6110008)
20
21LIST "RWDT"
22#define RWDT_BASE (0xE6020000)
23#define RWTCSRA0 (RWDT_BASE + 0x04)
24
25LIST "HPB Semaphore Control Registers"
26#define HPBSCR_BASE (0xE6000000)
27#define HPBCTRL6 (HPBSCR_BASE + 0x1030)
28
29#define SBSC1_BASE (0xFE400000)
30#define SDCR0A (SBSC1_BASE + 0x0008)
31#define SDCR1A (SBSC1_BASE + 0x000C)
32#define SDPCRA (SBSC1_BASE + 0x0010)
33#define SDCR0SA (SBSC1_BASE + 0x0018)
34#define SDCR1SA (SBSC1_BASE + 0x001C)
35#define RTCSRA (SBSC1_BASE + 0x0020)
36#define RTCORA (SBSC1_BASE + 0x0028)
37#define RTCORHA (SBSC1_BASE + 0x002C)
38#define SDWCRC0A (SBSC1_BASE + 0x0040)
39#define SDWCRC1A (SBSC1_BASE + 0x0044)
40#define SDWCR00A (SBSC1_BASE + 0x0048)
41#define SDWCR01A (SBSC1_BASE + 0x004C)
42#define SDWCR10A (SBSC1_BASE + 0x0050)
43#define SDWCR11A (SBSC1_BASE + 0x0054)
44#define SDWCR2A (SBSC1_BASE + 0x0060)
45#define SDWCRC2A (SBSC1_BASE + 0x0064)
46#define ZQCCRA (SBSC1_BASE + 0x0068)
47#define SDMRACR0A (SBSC1_BASE + 0x0084)
48#define SDMRTMPCRA (SBSC1_BASE + 0x008C)
49#define SDMRTMPMSKA (SBSC1_BASE + 0x0094)
50#define SDGENCNTA (SBSC1_BASE + 0x009C)
51#define SDDRVCR0A (SBSC1_BASE + 0x00B4)
52#define DLLCNT0A (SBSC1_BASE + 0x0354)
53
54#define SDMRA1 (0xFE500000)
55#define SDMRA2 (0xFE5C0000)
56#define SDMRA3 (0xFE504000)
57
58#define SBSC2_BASE (0xFB400000)
59#define SDCR0B (SBSC2_BASE + 0x0008)
60#define SDCR1B (SBSC2_BASE + 0x000C)
61#define SDPCRB (SBSC2_BASE + 0x0010)
62#define SDCR0SB (SBSC2_BASE + 0x0018)
63#define SDCR1SB (SBSC2_BASE + 0x001C)
64#define RTCSRB (SBSC2_BASE + 0x0020)
65#define RTCORB (SBSC2_BASE + 0x0028)
66#define RTCORHB (SBSC2_BASE + 0x002C)
67#define SDWCRC0B (SBSC2_BASE + 0x0040)
68#define SDWCRC1B (SBSC2_BASE + 0x0044)
69#define SDWCR00B (SBSC2_BASE + 0x0048)
70#define SDWCR01B (SBSC2_BASE + 0x004C)
71#define SDWCR10B (SBSC2_BASE + 0x0050)
72#define SDWCR11B (SBSC2_BASE + 0x0054)
73#define SDPDCR0B (SBSC2_BASE + 0x0058)
74#define SDWCR2B (SBSC2_BASE + 0x0060)
75#define SDWCRC2B (SBSC2_BASE + 0x0064)
76#define ZQCCRB (SBSC2_BASE + 0x0068)
77#define SDMRACR0B (SBSC2_BASE + 0x0084)
78#define SDMRTMPCRB (SBSC2_BASE + 0x008C)
79#define SDMRTMPMSKB (SBSC2_BASE + 0x0094)
80#define SDGENCNTB (SBSC2_BASE + 0x009C)
81#define DPHYCNT0B (SBSC2_BASE + 0x00A0)
82#define DPHYCNT1B (SBSC2_BASE + 0x00A4)
83#define DPHYCNT2B (SBSC2_BASE + 0x00A8)
84#define SDDRVCR0B (SBSC2_BASE + 0x00B4)
85#define DLLCNT0B (SBSC2_BASE + 0x0354)
86
87#define SDMRB1 (0xFB500000)
88#define SDMRB2 (0xFB5C0000)
89#define SDMRB3 (0xFB504000)
90
91#define CPG_BASE (0xE6150000)
92#define FRQCRA (CPG_BASE + 0x0000)
93#define FRQCRB (CPG_BASE + 0x0004)
94#define FRQCRD (CPG_BASE + 0x00E4)
95#define VCLKCR1 (CPG_BASE + 0x0008)
96#define VCLKCR2 (CPG_BASE + 0x000C)
97#define VCLKCR3 (CPG_BASE + 0x001C)
98#define ZBCKCR (CPG_BASE + 0x0010)
99#define FLCKCR (CPG_BASE + 0x0014)
100#define SD0CKCR (CPG_BASE + 0x0074)
101#define SD1CKCR (CPG_BASE + 0x0078)
102#define SD2CKCR (CPG_BASE + 0x007C)
103#define FSIACKCR (CPG_BASE + 0x0018)
104#define SUBCKCR (CPG_BASE + 0x0080)
105#define SPUACKCR (CPG_BASE + 0x0084)
106#define SPUVCKCR (CPG_BASE + 0x0094)
107#define MSUCKCR (CPG_BASE + 0x0088)
108#define HSICKCR (CPG_BASE + 0x008C)
109#define FSIBCKCR (CPG_BASE + 0x0090)
110#define MFCK1CR (CPG_BASE + 0x0098)
111#define MFCK2CR (CPG_BASE + 0x009C)
112#define DSITCKCR (CPG_BASE + 0x0060)
113#define DSI0PCKCR (CPG_BASE + 0x0064)
114#define DSI1PCKCR (CPG_BASE + 0x0068)
115#define DSI0PHYCR (CPG_BASE + 0x006C)
116#define DVFSCR3 (CPG_BASE + 0x0174)
117#define DVFSCR4 (CPG_BASE + 0x0178)
118#define DVFSCR5 (CPG_BASE + 0x017C)
119#define MPMODE (CPG_BASE + 0x00CC)
120
121#define PLLECR (CPG_BASE + 0x00D0)
122#define PLL0CR (CPG_BASE + 0x00D8)
123#define PLL1CR (CPG_BASE + 0x0028)
124#define PLL2CR (CPG_BASE + 0x002C)
125#define PLL3CR (CPG_BASE + 0x00DC)
126#define PLL0STPCR (CPG_BASE + 0x00F0)
127#define PLL1STPCR (CPG_BASE + 0x00C8)
128#define PLL2STPCR (CPG_BASE + 0x00F8)
129#define PLL3STPCR (CPG_BASE + 0x00FC)
130#define RMSTPCR0 (CPG_BASE + 0x0110)
131#define RMSTPCR1 (CPG_BASE + 0x0114)
132#define RMSTPCR2 (CPG_BASE + 0x0118)
133#define RMSTPCR3 (CPG_BASE + 0x011C)
134#define RMSTPCR4 (CPG_BASE + 0x0120)
135#define RMSTPCR5 (CPG_BASE + 0x0124)
136#define SMSTPCR0 (CPG_BASE + 0x0130)
137#define SMSTPCR2 (CPG_BASE + 0x0138)
138#define SMSTPCR3 (CPG_BASE + 0x013C)
139#define CPGXXCR4 (CPG_BASE + 0x0150)
140#define SRCR0 (CPG_BASE + 0x80A0)
141#define SRCR2 (CPG_BASE + 0x80B0)
142#define SRCR3 (CPG_BASE + 0x80A8)
143#define VREFCR (CPG_BASE + 0x00EC)
144#define PCLKCR (CPG_BASE + 0x1020)
145
146#define PORT32CR (0xE6051020)
147#define PORT33CR (0xE6051021)
148#define PORT34CR (0xE6051022)
149#define PORT35CR (0xE6051023)
150
151LIST "DRAM initialization code:"
152
153EW RWTCSRA0, 0xA507
154
155ED_AND LIFEC_SEC_SRC, 0xFFFF7FFF
156
157ED_AND SMSTPCR3,0xFFFF7FFF
158ED_AND SRCR3, 0xFFFF7FFF
159ED_AND SMSTPCR2,0xFFFBFFFF
160ED_AND SRCR2, 0xFFFBFFFF
161ED PLLECR, 0x00000000
162
163WAIT_MASK PLLECR, 0x00000F00, 0x00000000
164WAIT_MASK FRQCRB, 0x80000000, 0x00000000
165
166ED PLL0CR, 0x2D000000
167ED PLL1CR, 0x17100000
168ED FRQCRB, 0x96235880
169WAIT_MASK FRQCRB, 0x80000000, 0x00000000
170
171ED FLCKCR, 0x0000000B
172ED_AND SMSTPCR0, 0xFFFFFFFD
173
174ED_AND SRCR0, 0xFFFFFFFD
175ED 0xE6001628, 0x514
176ED 0xE6001648, 0x514
177ED 0xE6001658, 0x514
178ED 0xE6001678, 0x514
179
180ED DVFSCR4, 0x00092000
181ED DVFSCR5, 0x000000DC
182ED PLLECR, 0x00000000
183WAIT_MASK PLLECR, 0x00000F00, 0x00000000
184
185ED FRQCRA, 0x0012453C
186ED FRQCRB, 0x80431350
187WAIT_MASK FRQCRB, 0x80000000, 0x00000000
188ED FRQCRD, 0x00000B0B
189WAIT_MASK FRQCRD, 0x80000000, 0x00000000
190
191ED PCLKCR, 0x00000003
192ED VCLKCR1, 0x0000012F
193ED VCLKCR2, 0x00000119
194ED VCLKCR3, 0x00000119
195ED ZBCKCR, 0x00000002
196ED FLCKCR, 0x00000005
197ED SD0CKCR, 0x00000080
198ED SD1CKCR, 0x00000080
199ED SD2CKCR, 0x00000080
200ED FSIACKCR, 0x0000003F
201ED FSIBCKCR, 0x0000003F
202ED SUBCKCR, 0x00000080
203ED SPUACKCR, 0x0000000B
204ED SPUVCKCR, 0x0000000B
205ED MSUCKCR, 0x0000013F
206ED HSICKCR, 0x00000080
207ED MFCK1CR, 0x0000003F
208ED MFCK2CR, 0x0000003F
209ED DSITCKCR, 0x00000107
210ED DSI0PCKCR, 0x00000313
211ED DSI1PCKCR, 0x0000130D
212ED DSI0PHYCR, 0x2A800E0E
213ED PLL0CR, 0x1E000000
214ED PLL0CR, 0x2D000000
215ED PLL1CR, 0x17100000
216ED PLL2CR, 0x27000080
217ED PLL3CR, 0x1D000000
218ED PLL0STPCR, 0x00080000
219ED PLL1STPCR, 0x000120C0
220ED PLL2STPCR, 0x00012000
221ED PLL3STPCR, 0x00000030
222ED PLLECR, 0x0000000B
223WAIT_MASK PLLECR, 0x00000B00, 0x00000B00
224
225ED DVFSCR3, 0x000120F0
226ED MPMODE, 0x00000020
227ED VREFCR, 0x0000028A
228ED RMSTPCR0, 0xE4628087
229ED RMSTPCR1, 0xFFFFFFFF
230ED RMSTPCR2, 0x53FFFFFF
231ED RMSTPCR3, 0xFFFFFFFF
232ED RMSTPCR4, 0x00800D3D
233ED RMSTPCR5, 0xFFFFF3FF
234ED SMSTPCR2, 0x00000000
235ED SRCR2, 0x00040000
236ED_AND PLLECR, 0xFFFFFFF7
237WAIT_MASK PLLECR, 0x00000800, 0x00000000
238
239LIST "set SBSC operational"
240ED HPBCTRL6, 0x00000001
241WAIT_MASK HPBCTRL6, 0x00000001, 0x00000001
242
243LIST "set SBSC operating frequency"
244ED FRQCRD, 0x00001414
245WAIT_MASK FRQCRD, 0x80000000, 0x00000000
246ED PLL3CR, 0x1D000000
247ED_OR PLLECR, 0x00000008
248WAIT_MASK PLLECR, 0x00000800, 0x00000800
249
250LIST "enable DLL oscillation in DDRPHY"
251ED_OR DLLCNT0A, 0x00000002
252
253LIST "wait >= 100 ns"
254ED SDGENCNTA, 0x00000005
255WAIT_MASK SDGENCNTA, 0xFFFFFFFF, 0x00000000
256
257LIST "target LPDDR2 device settings"
258ED SDCR0A, 0xACC90159
259ED SDCR1A, 0x00010059
260ED SDWCRC0A, 0x50874114
261ED SDWCRC1A, 0x33199B37
262ED SDWCRC2A, 0x008F2313
263ED SDWCR00A, 0x31020707
264ED SDWCR01A, 0x0017040A
265ED SDWCR10A, 0x31020707
266ED SDWCR11A, 0x0017040A
267
268ED SDDRVCR0A, 0x055557ff
269
270ED SDWCR2A, 0x30000000
271
272LIST "drive CKE high"
273ED_OR SDPCRA, 0x00000080
274WAIT_MASK SDPCRA, 0x00000080, 0x00000080
275
276LIST "wait >= 200 us"
277ED SDGENCNTA, 0x00002710
278WAIT_MASK SDGENCNTA, 0xFFFFFFFF, 0x00000000
279
280LIST "issue reset command to LPDDR2 device"
281ED SDMRACR0A, 0x0000003F
282ED SDMRA1, 0x00000000
283
284LIST "wait >= 10 (or 1) us (docs inconsistent)"
285ED SDGENCNTA, 0x000001F4
286WAIT_MASK SDGENCNTA, 0xFFFFFFFF, 0x00000000
287
288LIST "MRW ZS initialization calibration command"
289ED SDMRACR0A, 0x0000FF0A
290ED SDMRA3, 0x00000000
291
292LIST "wait >= 1 us"
293ED SDGENCNTA, 0x00000032
294WAIT_MASK SDGENCNTA, 0xFFFFFFFF, 0x00000000
295
296LIST "specify operating mode in LPDDR2"
297ED SDMRACR0A, 0x00002201
298ED SDMRA1, 0x00000000
299ED SDMRACR0A, 0x00000402
300ED SDMRA1, 0x00000000
301ED SDMRACR0A, 0x00000203
302ED SDMRA1, 0x00000000
303
304LIST "initialize DDR interface"
305ED SDMRA2, 0x00000000
306
307LIST "temperature sensor control"
308ED SDMRTMPCRA, 0x88800004
309ED SDMRTMPMSKA,0x00000004
310
311LIST "auto-refreshing control"
312ED RTCORA, 0xA55A0032
313ED RTCORHA, 0xA55A000C
314ED RTCSRA, 0xA55A2048
315
316ED_OR SDCR0A, 0x00000800
317ED_OR SDCR1A, 0x00000400
318
319LIST "auto ZQ calibration control"
320ED ZQCCRA, 0xFFF20000
321
322ED_OR DLLCNT0B, 0x00000002
323ED SDGENCNTB, 0x00000005
324WAIT_MASK SDGENCNTB, 0xFFFFFFFF, 0x00000000
325
326ED SDCR0B, 0xACC90159
327ED SDCR1B, 0x00010059
328ED SDWCRC0B, 0x50874114
329ED SDWCRC1B, 0x33199B37
330ED SDWCRC2B, 0x008F2313
331ED SDWCR00B, 0x31020707
332ED SDWCR01B, 0x0017040A
333ED SDWCR10B, 0x31020707
334ED SDWCR11B, 0x0017040A
335ED SDDRVCR0B, 0x055557ff
336ED SDWCR2B, 0x30000000
337ED_OR SDPCRB, 0x00000080
338WAIT_MASK SDPCRB, 0x00000080, 0x00000080
339
340ED SDGENCNTB, 0x00002710
341WAIT_MASK SDGENCNTB, 0xFFFFFFFF, 0x00000000
342ED SDMRACR0B, 0x0000003F
343
344LIST "upstream u-boot writes to SDMRA1A for both SBSC 1 and 2, which does"
345LIST "not seem to make a lot of sense..."
346ED SDMRB1, 0x00000000
347
348ED SDGENCNTB, 0x000001F4
349WAIT_MASK SDGENCNTB, 0xFFFFFFFF, 0x00000000
350
351ED SDMRACR0B, 0x0000FF0A
352ED SDMRB3, 0x00000000
353ED SDGENCNTB, 0x00000032
354WAIT_MASK SDGENCNTB, 0xFFFFFFFF, 0x00000000
355
356ED SDMRACR0B, 0x00002201
357ED SDMRB1, 0x00000000
358ED SDMRACR0B, 0x00000402
359ED SDMRB1, 0x00000000
360ED SDMRACR0B, 0x00000203
361ED SDMRB1, 0x00000000
362ED SDMRB2, 0x00000000
363ED SDMRTMPCRB, 0x88800004
364ED SDMRTMPMSKB, 0x00000004
365ED RTCORB, 0xA55A0032
366ED RTCORHB, 0xA55A000C
367ED RTCSRB, 0xA55A2048
368ED_OR SDCR0B, 0x00000800
369ED_OR SDCR1B, 0x00000400
370ED ZQCCRB, 0xFFF20000
371ED_OR SDPDCR0B, 0x00030000
372ED DPHYCNT1B, 0xA5390000
373ED DPHYCNT0B, 0x00001200
374ED DPHYCNT1B, 0x07CE0000
375ED DPHYCNT0B, 0x00001247
376WAIT_MASK DPHYCNT2B, 0xFFFFFFFF, 0x07CE0000
377
378ED_AND SDPDCR0B, 0xFFFCFFFF
379
380ED FRQCRD, 0x00000B0B
381WAIT_MASK FRQCRD, 0x80000000, 0x00000000
382
383ED CPGXXCR4, 0xfffffffc
384
385LIST "Setup SCIF4 / workaround"
386EB PORT32CR, 0x12
387EB PORT33CR, 0x22
388EB PORT34CR, 0x12
389EB PORT35CR, 0x22
390
391EW 0xE6C80000, 0
392EB 0xE6C80004, 0x19
393EW 0xE6C80008, 0x0030
394EW 0xE6C80018, 0
395EW 0xE6C80030, 0x0014
396
397LIST "Magic to avoid hangs and corruption on DRAM writes."
398
399LIST "It has been observed that the system would most often hang while"
400LIST "decompressing the kernel, and if it didn't it would always write"
401LIST "a corrupt image to DRAM."
402LIST "This problem does not occur in u-boot, and the reason is that"
403LIST "u-boot performs an additional cache invalidation after setting up"
404LIST "the DRAM controller. Such an invalidation should not be necessary at"
405LIST "this point, and attempts at removing parts of the routine to arrive"
406LIST "at the minimal snippet of code necessary to avoid the DRAM stability"
407LIST "problem yielded the following:"
408
409MRC p15, 0, r0, c1, c0, 0
410MCR p15, 0, r0, c1, c0, 0
diff --git a/arch/arm/mach-shmobile/include/mach/zboot.h b/arch/arm/mach-shmobile/include/mach/zboot.h
deleted file mode 100644
index 175ee05465da..000000000000
--- a/arch/arm/mach-shmobile/include/mach/zboot.h
+++ /dev/null
@@ -1,19 +0,0 @@
1#ifndef ZBOOT_H
2#define ZBOOT_H
3
4#include <mach/zboot_macros.h>
5
6/**************************************************
7 *
8 * board specific settings
9 *
10 **************************************************/
11
12#ifdef CONFIG_MACH_KZM9G
13#define MEMORY_START 0x43000000
14#include "mach/head-kzm9g.txt"
15#else
16#error "unsupported board."
17#endif
18
19#endif /* ZBOOT_H */
diff --git a/arch/arm/mach-shmobile/include/mach/zboot_macros.h b/arch/arm/mach-shmobile/include/mach/zboot_macros.h
deleted file mode 100644
index 14fd3d538e9a..000000000000
--- a/arch/arm/mach-shmobile/include/mach/zboot_macros.h
+++ /dev/null
@@ -1,108 +0,0 @@
1#ifndef __ZBOOT_MACRO_H
2#define __ZBOOT_MACRO_H
3
4/* The LIST command is used to include comments in the script */
5.macro LIST comment
6.endm
7
8/* The ED command is used to write a 32-bit word */
9.macro ED, addr, data
10 LDR r0, 1f
11 LDR r1, 2f
12 STR r1, [r0]
13 B 3f
141 : .long \addr
152 : .long \data
163 :
17.endm
18
19/* The EW command is used to write a 16-bit word */
20.macro EW, addr, data
21 LDR r0, 1f
22 LDR r1, 2f
23 STRH r1, [r0]
24 B 3f
251 : .long \addr
262 : .long \data
273 :
28.endm
29
30/* The EB command is used to write an 8-bit word */
31.macro EB, addr, data
32 LDR r0, 1f
33 LDR r1, 2f
34 STRB r1, [r0]
35 B 3f
361 : .long \addr
372 : .long \data
383 :
39.endm
40
41/* The WAIT command is used to delay the execution */
42.macro WAIT, time, reg
43 LDR r1, 1f
44 LDR r0, 2f
45 STR r0, [r1]
4610 :
47 LDR r0, [r1]
48 CMP r0, #0x00000000
49 BNE 10b
50 NOP
51 B 3f
521 : .long \reg
532 : .long \time * 100
543 :
55.endm
56
57/* The DD command is used to read a 32-bit word */
58.macro DD, start, end
59 LDR r1, 1f
60 B 2f
611 : .long \start
622 :
63.endm
64
65/* loop until a given value has been read (with mask) */
66.macro WAIT_MASK, addr, data, cmp
67 LDR r0, 2f
68 LDR r1, 3f
69 LDR r2, 4f
701:
71 LDR r3, [r0, #0]
72 AND r3, r1, r3
73 CMP r2, r3
74 BNE 1b
75 B 5f
762: .long \addr
773: .long \data
784: .long \cmp
795:
80.endm
81
82/* read 32-bit value from addr, "or" an immediate and write back */
83.macro ED_OR, addr, data
84 LDR r4, 1f
85 LDR r5, 2f
86 LDR r6, [r4]
87 ORR r5, r6, r5
88 STR r5, [r4]
89 B 3f
901: .long \addr
912: .long \data
923:
93.endm
94
95/* read 32-bit value from addr, "and" an immediate and write back */
96.macro ED_AND, addr, data
97 LDR r4, 1f
98 LDR r5, 2f
99 LDR r6, [r4]
100 AND r5, r6, r5
101 STR r5, [r4]
102 B 3f
1031: .long \addr
1042: .long \data
1053:
106.endm
107
108#endif /* __ZBOOT_MACRO_H */
diff --git a/arch/arm/mach-shmobile/intc-sh73a0.c b/arch/arm/mach-shmobile/intc-sh73a0.c
deleted file mode 100644
index fd63ae6532fc..000000000000
--- a/arch/arm/mach-shmobile/intc-sh73a0.c
+++ /dev/null
@@ -1,337 +0,0 @@
1/*
2 * sh73a0 processor support - INTC hardware block
3 *
4 * Copyright (C) 2010 Magnus Damm
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15#include <linux/kernel.h>
16#include <linux/init.h>
17#include <linux/interrupt.h>
18#include <linux/module.h>
19#include <linux/irq.h>
20#include <linux/io.h>
21#include <linux/irqchip.h>
22#include <linux/irqchip/arm-gic.h>
23
24#include <asm/mach-types.h>
25#include <asm/mach/arch.h>
26
27#include "intc.h"
28#include "irqs.h"
29#include "sh73a0.h"
30
31enum {
32 UNUSED = 0,
33
34 /* interrupt sources INTCS */
35 PINTCS_PINT1, PINTCS_PINT2,
36 RTDMAC_0_DEI0, RTDMAC_0_DEI1, RTDMAC_0_DEI2, RTDMAC_0_DEI3,
37 CEU, MFI, BBIF2, VPU, TSIF1, _3DG_SGX543, _2DDMAC_2DDM0,
38 RTDMAC_1_DEI4, RTDMAC_1_DEI5, RTDMAC_1_DADERR,
39 KEYSC_KEY, VINT, MSIOF,
40 TMU0_TUNI00, TMU0_TUNI01, TMU0_TUNI02,
41 CMT0, TSIF0, CMT2, LMB, MSUG, MSU_MSU, MSU_MSU2,
42 CTI, RWDT0, ICB, PEP, ASA, JPU_JPEG, LCDC, LCRC,
43 RTDMAC_2_DEI6, RTDMAC_2_DEI7, RTDMAC_2_DEI8, RTDMAC_2_DEI9,
44 RTDMAC_3_DEI10, RTDMAC_3_DEI11,
45 FRC, GCU, LCDC1, CSIRX,
46 DSITX0_DSITX00, DSITX0_DSITX01,
47 SPU2_SPU0, SPU2_SPU1, FSI,
48 TMU1_TUNI10, TMU1_TUNI11, TMU1_TUNI12,
49 TSIF2, CMT4, MFIS2, CPORTS2R, TSG, DMASCH1, SCUW,
50 VIO60, VIO61, CEU21, CSI21, DSITX1_DSITX10, DSITX1_DSITX11,
51 DISP, DSRV, EMUX2_EMUX20I, EMUX2_EMUX21I,
52 MSTIF0_MST00I, MSTIF0_MST01I, MSTIF1_MST10I, MSTIF1_MST11I,
53 SPUV,
54
55 /* interrupt groups INTCS */
56 RTDMAC_0, RTDMAC_1, RTDMAC_2, RTDMAC_3,
57 DSITX0, SPU2, TMU1, MSU,
58};
59
60static struct intc_vect intcs_vectors[] = {
61 INTCS_VECT(PINTCS_PINT1, 0x0600), INTCS_VECT(PINTCS_PINT2, 0x0620),
62 INTCS_VECT(RTDMAC_0_DEI0, 0x0800), INTCS_VECT(RTDMAC_0_DEI1, 0x0820),
63 INTCS_VECT(RTDMAC_0_DEI2, 0x0840), INTCS_VECT(RTDMAC_0_DEI3, 0x0860),
64 INTCS_VECT(CEU, 0x0880), INTCS_VECT(MFI, 0x0900),
65 INTCS_VECT(BBIF2, 0x0960), INTCS_VECT(VPU, 0x0980),
66 INTCS_VECT(TSIF1, 0x09a0), INTCS_VECT(_3DG_SGX543, 0x09e0),
67 INTCS_VECT(_2DDMAC_2DDM0, 0x0a00),
68 INTCS_VECT(RTDMAC_1_DEI4, 0x0b80), INTCS_VECT(RTDMAC_1_DEI5, 0x0ba0),
69 INTCS_VECT(RTDMAC_1_DADERR, 0x0bc0),
70 INTCS_VECT(KEYSC_KEY, 0x0be0), INTCS_VECT(VINT, 0x0c80),
71 INTCS_VECT(MSIOF, 0x0d20),
72 INTCS_VECT(TMU0_TUNI00, 0x0e80), INTCS_VECT(TMU0_TUNI01, 0x0ea0),
73 INTCS_VECT(TMU0_TUNI02, 0x0ec0),
74 INTCS_VECT(CMT0, 0x0f00), INTCS_VECT(TSIF0, 0x0f20),
75 INTCS_VECT(CMT2, 0x0f40), INTCS_VECT(LMB, 0x0f60),
76 INTCS_VECT(MSUG, 0x0f80),
77 INTCS_VECT(MSU_MSU, 0x0fa0), INTCS_VECT(MSU_MSU2, 0x0fc0),
78 INTCS_VECT(CTI, 0x0400), INTCS_VECT(RWDT0, 0x0440),
79 INTCS_VECT(ICB, 0x0480), INTCS_VECT(PEP, 0x04a0),
80 INTCS_VECT(ASA, 0x04c0), INTCS_VECT(JPU_JPEG, 0x0560),
81 INTCS_VECT(LCDC, 0x0580), INTCS_VECT(LCRC, 0x05a0),
82 INTCS_VECT(RTDMAC_2_DEI6, 0x1300), INTCS_VECT(RTDMAC_2_DEI7, 0x1320),
83 INTCS_VECT(RTDMAC_2_DEI8, 0x1340), INTCS_VECT(RTDMAC_2_DEI9, 0x1360),
84 INTCS_VECT(RTDMAC_3_DEI10, 0x1380), INTCS_VECT(RTDMAC_3_DEI11, 0x13a0),
85 INTCS_VECT(FRC, 0x1700), INTCS_VECT(GCU, 0x1760),
86 INTCS_VECT(LCDC1, 0x1780), INTCS_VECT(CSIRX, 0x17a0),
87 INTCS_VECT(DSITX0_DSITX00, 0x17c0), INTCS_VECT(DSITX0_DSITX01, 0x17e0),
88 INTCS_VECT(SPU2_SPU0, 0x1800), INTCS_VECT(SPU2_SPU1, 0x1820),
89 INTCS_VECT(FSI, 0x1840),
90 INTCS_VECT(TMU1_TUNI10, 0x1900), INTCS_VECT(TMU1_TUNI11, 0x1920),
91 INTCS_VECT(TMU1_TUNI12, 0x1940),
92 INTCS_VECT(TSIF2, 0x1960), INTCS_VECT(CMT4, 0x1980),
93 INTCS_VECT(MFIS2, 0x1a00), INTCS_VECT(CPORTS2R, 0x1a20),
94 INTCS_VECT(TSG, 0x1ae0), INTCS_VECT(DMASCH1, 0x1b00),
95 INTCS_VECT(SCUW, 0x1b40),
96 INTCS_VECT(VIO60, 0x1b60), INTCS_VECT(VIO61, 0x1b80),
97 INTCS_VECT(CEU21, 0x1ba0), INTCS_VECT(CSI21, 0x1be0),
98 INTCS_VECT(DSITX1_DSITX10, 0x1c00), INTCS_VECT(DSITX1_DSITX11, 0x1c20),
99 INTCS_VECT(DISP, 0x1c40), INTCS_VECT(DSRV, 0x1c60),
100 INTCS_VECT(EMUX2_EMUX20I, 0x1c80), INTCS_VECT(EMUX2_EMUX21I, 0x1ca0),
101 INTCS_VECT(MSTIF0_MST00I, 0x1cc0), INTCS_VECT(MSTIF0_MST01I, 0x1ce0),
102 INTCS_VECT(MSTIF1_MST10I, 0x1d00), INTCS_VECT(MSTIF1_MST11I, 0x1d20),
103 INTCS_VECT(SPUV, 0x2300),
104};
105
106static struct intc_group intcs_groups[] __initdata = {
107 INTC_GROUP(RTDMAC_0, RTDMAC_0_DEI0, RTDMAC_0_DEI1,
108 RTDMAC_0_DEI2, RTDMAC_0_DEI3),
109 INTC_GROUP(RTDMAC_1, RTDMAC_1_DEI4, RTDMAC_1_DEI5, RTDMAC_1_DADERR),
110 INTC_GROUP(RTDMAC_2, RTDMAC_2_DEI6, RTDMAC_2_DEI7,
111 RTDMAC_2_DEI8, RTDMAC_2_DEI9),
112 INTC_GROUP(RTDMAC_3, RTDMAC_3_DEI10, RTDMAC_3_DEI11),
113 INTC_GROUP(TMU1, TMU1_TUNI12, TMU1_TUNI11, TMU1_TUNI10),
114 INTC_GROUP(DSITX0, DSITX0_DSITX00, DSITX0_DSITX01),
115 INTC_GROUP(SPU2, SPU2_SPU0, SPU2_SPU1),
116 INTC_GROUP(MSU, MSU_MSU, MSU_MSU2),
117};
118
119static struct intc_mask_reg intcs_mask_registers[] = {
120 { 0xffd20184, 0xffd201c4, 8, /* IMR1SA / IMCR1SA */
121 { 0, 0, 0, CEU,
122 0, 0, 0, 0 } },
123 { 0xffd20188, 0xffd201c8, 8, /* IMR2SA / IMCR2SA */
124 { 0, 0, 0, VPU,
125 BBIF2, 0, 0, MFI } },
126 { 0xffd2018c, 0xffd201cc, 8, /* IMR3SA / IMCR3SA */
127 { 0, 0, 0, _2DDMAC_2DDM0,
128 0, ASA, PEP, ICB } },
129 { 0xffd20190, 0xffd201d0, 8, /* IMR4SA / IMCR4SA */
130 { 0, 0, 0, CTI,
131 JPU_JPEG, 0, LCRC, LCDC } },
132 { 0xffd20194, 0xffd201d4, 8, /* IMR5SA / IMCR5SA */
133 { KEYSC_KEY, RTDMAC_1_DADERR, RTDMAC_1_DEI5, RTDMAC_1_DEI4,
134 RTDMAC_0_DEI3, RTDMAC_0_DEI2, RTDMAC_0_DEI1, RTDMAC_0_DEI0 } },
135 { 0xffd20198, 0xffd201d8, 8, /* IMR6SA / IMCR6SA */
136 { 0, 0, MSIOF, 0,
137 _3DG_SGX543, 0, 0, 0 } },
138 { 0xffd2019c, 0xffd201dc, 8, /* IMR7SA / IMCR7SA */
139 { 0, TMU0_TUNI02, TMU0_TUNI01, TMU0_TUNI00,
140 0, 0, 0, 0 } },
141 { 0xffd201a0, 0xffd201e0, 8, /* IMR8SA / IMCR8SA */
142 { 0, 0, 0, 0,
143 0, MSU_MSU, MSU_MSU2, MSUG } },
144 { 0xffd201a4, 0xffd201e4, 8, /* IMR9SA / IMCR9SA */
145 { 0, RWDT0, CMT2, CMT0,
146 0, 0, 0, 0 } },
147 { 0xffd201ac, 0xffd201ec, 8, /* IMR11SA / IMCR11SA */
148 { 0, 0, 0, 0,
149 0, TSIF1, LMB, TSIF0 } },
150 { 0xffd201b0, 0xffd201f0, 8, /* IMR12SA / IMCR12SA */
151 { 0, 0, 0, 0,
152 0, 0, PINTCS_PINT2, PINTCS_PINT1 } },
153 { 0xffd50180, 0xffd501c0, 8, /* IMR0SA3 / IMCR0SA3 */
154 { RTDMAC_2_DEI6, RTDMAC_2_DEI7, RTDMAC_2_DEI8, RTDMAC_2_DEI9,
155 RTDMAC_3_DEI10, RTDMAC_3_DEI11, 0, 0 } },
156 { 0xffd50190, 0xffd501d0, 8, /* IMR4SA3 / IMCR4SA3 */
157 { FRC, 0, 0, GCU,
158 LCDC1, CSIRX, DSITX0_DSITX00, DSITX0_DSITX01 } },
159 { 0xffd50194, 0xffd501d4, 8, /* IMR5SA3 / IMCR5SA3 */
160 { SPU2_SPU0, SPU2_SPU1, FSI, 0,
161 0, 0, 0, 0 } },
162 { 0xffd50198, 0xffd501d8, 8, /* IMR6SA3 / IMCR6SA3 */
163 { TMU1_TUNI10, TMU1_TUNI11, TMU1_TUNI12, 0,
164 TSIF2, CMT4, 0, 0 } },
165 { 0xffd5019c, 0xffd501dc, 8, /* IMR7SA3 / IMCR7SA3 */
166 { MFIS2, CPORTS2R, 0, 0,
167 0, 0, 0, TSG } },
168 { 0xffd501a0, 0xffd501e0, 8, /* IMR8SA3 / IMCR8SA3 */
169 { DMASCH1, 0, SCUW, VIO60,
170 VIO61, CEU21, 0, CSI21 } },
171 { 0xffd501a4, 0xffd501e4, 8, /* IMR9SA3 / IMCR9SA3 */
172 { DSITX1_DSITX10, DSITX1_DSITX11, DISP, DSRV,
173 EMUX2_EMUX20I, EMUX2_EMUX21I, MSTIF0_MST00I, MSTIF0_MST01I } },
174 { 0xffd501a8, 0xffd501e8, 8, /* IMR10SA3 / IMCR10SA3 */
175 { MSTIF0_MST00I, MSTIF0_MST01I, 0, 0,
176 0, 0, 0, 0 } },
177 { 0xffd60180, 0xffd601c0, 8, /* IMR0SA4 / IMCR0SA4 */
178 { SPUV, 0, 0, 0,
179 0, 0, 0, 0 } },
180};
181
182/* Priority is needed for INTCA to receive the INTCS interrupt */
183static struct intc_prio_reg intcs_prio_registers[] = {
184 { 0xffd20000, 0, 16, 4, /* IPRAS */ { CTI, 0, _2DDMAC_2DDM0, ICB } },
185 { 0xffd20004, 0, 16, 4, /* IPRBS */ { JPU_JPEG, LCDC, 0, LCRC } },
186 { 0xffd20008, 0, 16, 4, /* IPRCS */ { BBIF2, 0, 0, 0 } },
187 { 0xffd2000c, 0, 16, 4, /* IPRDS */ { PINTCS_PINT1, PINTCS_PINT2,
188 0, 0 } },
189 { 0xffd20010, 0, 16, 4, /* IPRES */ { RTDMAC_0, CEU, MFI, VPU } },
190 { 0xffd20014, 0, 16, 4, /* IPRFS */ { KEYSC_KEY, RTDMAC_1,
191 CMT2, CMT0 } },
192 { 0xffd20018, 0, 16, 4, /* IPRGS */ { TMU0_TUNI00, TMU0_TUNI01,
193 TMU0_TUNI02, TSIF1 } },
194 { 0xffd2001c, 0, 16, 4, /* IPRHS */ { VINT, 0, 0, 0 } },
195 { 0xffd20020, 0, 16, 4, /* IPRIS */ { 0, MSIOF, TSIF0, 0 } },
196 { 0xffd20024, 0, 16, 4, /* IPRJS */ { 0, _3DG_SGX543, MSUG, MSU } },
197 { 0xffd20028, 0, 16, 4, /* IPRKS */ { 0, ASA, LMB, PEP } },
198 { 0xffd20030, 0, 16, 4, /* IPRMS */ { 0, 0, 0, RWDT0 } },
199 { 0xffd50000, 0, 16, 4, /* IPRAS3 */ { RTDMAC_2, 0, 0, 0 } },
200 { 0xffd50004, 0, 16, 4, /* IPRBS3 */ { RTDMAC_3, 0, 0, 0 } },
201 { 0xffd50020, 0, 16, 4, /* IPRIS3 */ { FRC, 0, 0, 0 } },
202 { 0xffd50024, 0, 16, 4, /* IPRJS3 */ { LCDC1, CSIRX, DSITX0, 0 } },
203 { 0xffd50028, 0, 16, 4, /* IPRKS3 */ { SPU2, 0, FSI, 0 } },
204 { 0xffd50030, 0, 16, 4, /* IPRMS3 */ { TMU1, 0, 0, TSIF2 } },
205 { 0xffd50034, 0, 16, 4, /* IPRNS3 */ { CMT4, 0, 0, 0 } },
206 { 0xffd50038, 0, 16, 4, /* IPROS3 */ { MFIS2, CPORTS2R, 0, 0 } },
207 { 0xffd50040, 0, 16, 4, /* IPRQS3 */ { DMASCH1, 0, SCUW, VIO60 } },
208 { 0xffd50044, 0, 16, 4, /* IPRRS3 */ { VIO61, CEU21, 0, CSI21 } },
209 { 0xffd50048, 0, 16, 4, /* IPRSS3 */ { DSITX1_DSITX10, DSITX1_DSITX11,
210 DISP, DSRV } },
211 { 0xffd5004c, 0, 16, 4, /* IPRTS3 */ { EMUX2_EMUX20I, EMUX2_EMUX21I,
212 MSTIF0_MST00I, MSTIF0_MST01I } },
213 { 0xffd50050, 0, 16, 4, /* IPRUS3 */ { MSTIF1_MST10I, MSTIF1_MST11I,
214 0, 0 } },
215 { 0xffd60000, 0, 16, 4, /* IPRAS4 */ { SPUV, 0, 0, 0 } },
216};
217
218static struct resource intcs_resources[] __initdata = {
219 [0] = {
220 .start = 0xffd20000,
221 .end = 0xffd201ff,
222 .flags = IORESOURCE_MEM,
223 },
224 [1] = {
225 .start = 0xffd50000,
226 .end = 0xffd501ff,
227 .flags = IORESOURCE_MEM,
228 },
229 [2] = {
230 .start = 0xffd60000,
231 .end = 0xffd601ff,
232 .flags = IORESOURCE_MEM,
233 }
234};
235
236static struct intc_desc intcs_desc __initdata = {
237 .name = "sh73a0-intcs",
238 .resource = intcs_resources,
239 .num_resources = ARRAY_SIZE(intcs_resources),
240 .hw = INTC_HW_DESC(intcs_vectors, intcs_groups, intcs_mask_registers,
241 intcs_prio_registers, NULL, NULL),
242};
243
244static struct irqaction sh73a0_intcs_cascade;
245
246static irqreturn_t sh73a0_intcs_demux(int irq, void *dev_id)
247{
248 unsigned int evtcodeas = ioread32((void __iomem *)dev_id);
249
250 generic_handle_irq(intcs_evt2irq(evtcodeas));
251
252 return IRQ_HANDLED;
253}
254
255#define PINTER0_PHYS 0xe69000a0
256#define PINTER1_PHYS 0xe69000a4
257#define PINTER0_VIRT IOMEM(0xe69000a0)
258#define PINTER1_VIRT IOMEM(0xe69000a4)
259#define PINTRR0 IOMEM(0xe69000d0)
260#define PINTRR1 IOMEM(0xe69000d4)
261
262#define PINT0A_IRQ(n, irq) INTC_IRQ((n), SH73A0_PINT0_IRQ(irq))
263#define PINT0B_IRQ(n, irq) INTC_IRQ((n), SH73A0_PINT0_IRQ(irq + 8))
264#define PINT0C_IRQ(n, irq) INTC_IRQ((n), SH73A0_PINT0_IRQ(irq + 16))
265#define PINT0D_IRQ(n, irq) INTC_IRQ((n), SH73A0_PINT0_IRQ(irq + 24))
266#define PINT1E_IRQ(n, irq) INTC_IRQ((n), SH73A0_PINT1_IRQ(irq))
267
268INTC_PINT(intc_pint0, PINTER0_PHYS, 0xe69000b0, "sh73a0-pint0", \
269 INTC_PINT_E(A), INTC_PINT_E(B), INTC_PINT_E(C), INTC_PINT_E(D), \
270 INTC_PINT_V(A, PINT0A_IRQ), INTC_PINT_V(B, PINT0B_IRQ), \
271 INTC_PINT_V(C, PINT0C_IRQ), INTC_PINT_V(D, PINT0D_IRQ), \
272 INTC_PINT_E(A), INTC_PINT_E(B), INTC_PINT_E(C), INTC_PINT_E(D), \
273 INTC_PINT_E(A), INTC_PINT_E(B), INTC_PINT_E(C), INTC_PINT_E(D));
274
275INTC_PINT(intc_pint1, PINTER1_PHYS, 0xe69000c0, "sh73a0-pint1", \
276 INTC_PINT_E(E), INTC_PINT_E_EMPTY, INTC_PINT_E_EMPTY, INTC_PINT_E_EMPTY, \
277 INTC_PINT_V(E, PINT1E_IRQ), INTC_PINT_V_NONE, \
278 INTC_PINT_V_NONE, INTC_PINT_V_NONE, \
279 INTC_PINT_E_NONE, INTC_PINT_E_NONE, INTC_PINT_E_NONE, INTC_PINT_E(E), \
280 INTC_PINT_E(E), INTC_PINT_E_NONE, INTC_PINT_E_NONE, INTC_PINT_E_NONE);
281
282static struct irqaction sh73a0_pint0_cascade;
283static struct irqaction sh73a0_pint1_cascade;
284
285static void pint_demux(void __iomem *rr, void __iomem *er, int base_irq)
286{
287 unsigned long value = ioread32(rr) & ioread32(er);
288 int k;
289
290 for (k = 0; k < 32; k++) {
291 if (value & (1 << (31 - k))) {
292 generic_handle_irq(base_irq + k);
293 iowrite32(~(1 << (31 - k)), rr);
294 }
295 }
296}
297
298static irqreturn_t sh73a0_pint0_demux(int irq, void *dev_id)
299{
300 pint_demux(PINTRR0, PINTER0_VIRT, SH73A0_PINT0_IRQ(0));
301 return IRQ_HANDLED;
302}
303
304static irqreturn_t sh73a0_pint1_demux(int irq, void *dev_id)
305{
306 pint_demux(PINTRR1, PINTER1_VIRT, SH73A0_PINT1_IRQ(0));
307 return IRQ_HANDLED;
308}
309
310void __init sh73a0_init_irq(void)
311{
312 void __iomem *gic_dist_base = IOMEM(0xf0001000);
313 void __iomem *gic_cpu_base = IOMEM(0xf0000100);
314 void __iomem *intevtsa = ioremap_nocache(0xffd20100, PAGE_SIZE);
315
316 gic_set_irqchip_flags(IRQCHIP_SKIP_SET_WAKE);
317 gic_init(0, 29, gic_dist_base, gic_cpu_base);
318
319 register_intc_controller(&intcs_desc);
320 register_intc_controller(&intc_pint0_desc);
321 register_intc_controller(&intc_pint1_desc);
322
323 /* demux using INTEVTSA */
324 sh73a0_intcs_cascade.name = "INTCS cascade";
325 sh73a0_intcs_cascade.handler = sh73a0_intcs_demux;
326 sh73a0_intcs_cascade.dev_id = intevtsa;
327 setup_irq(gic_spi(50), &sh73a0_intcs_cascade);
328
329 /* PINT pins are sanely tied to the GIC as SPI */
330 sh73a0_pint0_cascade.name = "PINT0 cascade";
331 sh73a0_pint0_cascade.handler = sh73a0_pint0_demux;
332 setup_irq(gic_spi(33), &sh73a0_pint0_cascade);
333
334 sh73a0_pint1_cascade.name = "PINT1 cascade";
335 sh73a0_pint1_cascade.handler = sh73a0_pint1_demux;
336 setup_irq(gic_spi(34), &sh73a0_pint1_cascade);
337}
diff --git a/arch/arm/mach-shmobile/platsmp-apmu.c b/arch/arm/mach-shmobile/platsmp-apmu.c
index b0790fc32282..4e54512bee30 100644
--- a/arch/arm/mach-shmobile/platsmp-apmu.c
+++ b/arch/arm/mach-shmobile/platsmp-apmu.c
@@ -46,7 +46,7 @@ static int __maybe_unused apmu_power_on(void __iomem *p, int bit)
46 return 0; 46 return 0;
47} 47}
48 48
49static int apmu_power_off(void __iomem *p, int bit) 49static int __maybe_unused apmu_power_off(void __iomem *p, int bit)
50{ 50{
51 /* request Core Standby for next WFI */ 51 /* request Core Standby for next WFI */
52 writel_relaxed(3, p + CPUNCR_OFFS(bit)); 52 writel_relaxed(3, p + CPUNCR_OFFS(bit));
@@ -67,7 +67,7 @@ static int __maybe_unused apmu_power_off_poll(void __iomem *p, int bit)
67 return 0; 67 return 0;
68} 68}
69 69
70static int apmu_wrap(int cpu, int (*fn)(void __iomem *p, int cpu)) 70static int __maybe_unused apmu_wrap(int cpu, int (*fn)(void __iomem *p, int cpu))
71{ 71{
72 void __iomem *p = apmu_cpus[cpu].iomem; 72 void __iomem *p = apmu_cpus[cpu].iomem;
73 73
diff --git a/arch/arm/mach-shmobile/pm-r8a7740.c b/arch/arm/mach-shmobile/pm-r8a7740.c
deleted file mode 100644
index 34608fcf0648..000000000000
--- a/arch/arm/mach-shmobile/pm-r8a7740.c
+++ /dev/null
@@ -1,129 +0,0 @@
1/*
2 * r8a7740 power management support
3 *
4 * Copyright (C) 2012 Renesas Solutions Corp.
5 * Copyright (C) 2012 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive
9 * for more details.
10 */
11#include <linux/console.h>
12#include <linux/io.h>
13#include <linux/suspend.h>
14
15#include "common.h"
16#include "pm-rmobile.h"
17
18#define SYSC_BASE IOMEM(0xe6180000)
19
20#if defined(CONFIG_PM) && !defined(CONFIG_ARCH_MULTIPLATFORM)
21static int r8a7740_pd_a3sm_suspend(void)
22{
23 /*
24 * The A3SM domain contains the CPU core and therefore it should
25 * only be turned off if the CPU is not in use.
26 */
27 return -EBUSY;
28}
29
30static int r8a7740_pd_a3sp_suspend(void)
31{
32 /*
33 * Serial consoles make use of SCIF hardware located in A3SP,
34 * keep such power domain on if "no_console_suspend" is set.
35 */
36 return console_suspend_enabled ? 0 : -EBUSY;
37}
38
39static int r8a7740_pd_d4_suspend(void)
40{
41 /*
42 * The D4 domain contains the Coresight-ETM hardware block and
43 * therefore it should only be turned off if the debug module is
44 * not in use.
45 */
46 return -EBUSY;
47}
48
49static struct rmobile_pm_domain r8a7740_pm_domains[] = {
50 {
51 .genpd.name = "A4LC",
52 .base = SYSC_BASE,
53 .bit_shift = 1,
54 }, {
55 .genpd.name = "A4MP",
56 .base = SYSC_BASE,
57 .bit_shift = 2,
58 }, {
59 .genpd.name = "D4",
60 .base = SYSC_BASE,
61 .bit_shift = 3,
62 .gov = &pm_domain_always_on_gov,
63 .suspend = r8a7740_pd_d4_suspend,
64 }, {
65 .genpd.name = "A4R",
66 .base = SYSC_BASE,
67 .bit_shift = 5,
68 }, {
69 .genpd.name = "A3RV",
70 .base = SYSC_BASE,
71 .bit_shift = 6,
72 }, {
73 .genpd.name = "A4S",
74 .base = SYSC_BASE,
75 .bit_shift = 10,
76 .no_debug = true,
77 }, {
78 .genpd.name = "A3SP",
79 .base = SYSC_BASE,
80 .bit_shift = 11,
81 .gov = &pm_domain_always_on_gov,
82 .no_debug = true,
83 .suspend = r8a7740_pd_a3sp_suspend,
84 }, {
85 .genpd.name = "A3SM",
86 .base = SYSC_BASE,
87 .bit_shift = 12,
88 .gov = &pm_domain_always_on_gov,
89 .suspend = r8a7740_pd_a3sm_suspend,
90 }, {
91 .genpd.name = "A3SG",
92 .base = SYSC_BASE,
93 .bit_shift = 13,
94 }, {
95 .genpd.name = "A4SU",
96 .base = SYSC_BASE,
97 .bit_shift = 20,
98 },
99};
100
101void __init r8a7740_init_pm_domains(void)
102{
103 rmobile_init_domains(r8a7740_pm_domains, ARRAY_SIZE(r8a7740_pm_domains));
104 pm_genpd_add_subdomain_names("A4R", "A3RV");
105 pm_genpd_add_subdomain_names("A4S", "A3SP");
106 pm_genpd_add_subdomain_names("A4S", "A3SM");
107 pm_genpd_add_subdomain_names("A4S", "A3SG");
108}
109#endif /* CONFIG_PM && !CONFIG_ARCH_MULTIPLATFORM */
110
111#ifdef CONFIG_SUSPEND
112static int r8a7740_enter_suspend(suspend_state_t suspend_state)
113{
114 cpu_do_idle();
115 return 0;
116}
117
118static void r8a7740_suspend_init(void)
119{
120 shmobile_suspend_ops.enter = r8a7740_enter_suspend;
121}
122#else
123static void r8a7740_suspend_init(void) {}
124#endif
125
126void __init r8a7740_pm_init(void)
127{
128 r8a7740_suspend_init();
129}
diff --git a/arch/arm/mach-shmobile/pm-r8a7779.c b/arch/arm/mach-shmobile/pm-r8a7779.c
index 44a74c4c5a01..47a862e7f8ba 100644
--- a/arch/arm/mach-shmobile/pm-r8a7779.c
+++ b/arch/arm/mach-shmobile/pm-r8a7779.c
@@ -35,7 +35,8 @@ struct r8a7779_pm_domain {
35 struct rcar_sysc_ch ch; 35 struct rcar_sysc_ch ch;
36}; 36};
37 37
38static inline struct rcar_sysc_ch *to_r8a7779_ch(struct generic_pm_domain *d) 38static inline
39const struct rcar_sysc_ch *to_r8a7779_ch(struct generic_pm_domain *d)
39{ 40{
40 return &container_of(d, struct r8a7779_pm_domain, genpd)->ch; 41 return &container_of(d, struct r8a7779_pm_domain, genpd)->ch;
41} 42}
@@ -83,7 +84,6 @@ static void r8a7779_init_pm_domain(struct r8a7779_pm_domain *r8a7779_pd)
83{ 84{
84 struct generic_pm_domain *genpd = &r8a7779_pd->genpd; 85 struct generic_pm_domain *genpd = &r8a7779_pd->genpd;
85 86
86 genpd->flags = GENPD_FLAG_PM_CLK;
87 pm_genpd_init(genpd, NULL, false); 87 pm_genpd_init(genpd, NULL, false);
88 genpd->dev_ops.active_wakeup = pd_active_wakeup; 88 genpd->dev_ops.active_wakeup = pd_active_wakeup;
89 genpd->power_off = pd_power_down; 89 genpd->power_off = pd_power_down;
diff --git a/arch/arm/mach-shmobile/pm-rcar.c b/arch/arm/mach-shmobile/pm-rcar.c
index 00022ee56f80..4092ad16e0a4 100644
--- a/arch/arm/mach-shmobile/pm-rcar.c
+++ b/arch/arm/mach-shmobile/pm-rcar.c
@@ -15,32 +15,58 @@
15#include <asm/io.h> 15#include <asm/io.h>
16#include "pm-rcar.h" 16#include "pm-rcar.h"
17 17
18/* SYSC */ 18/* SYSC Common */
19#define SYSCSR 0x00 19#define SYSCSR 0x00 /* SYSC Status Register */
20#define SYSCISR 0x04 20#define SYSCISR 0x04 /* Interrupt Status Register */
21#define SYSCISCR 0x08 21#define SYSCISCR 0x08 /* Interrupt Status Clear Register */
22#define SYSCIER 0x0c /* Interrupt Enable Register */
23#define SYSCIMR 0x10 /* Interrupt Mask Register */
22 24
23#define PWRSR_OFFS 0x00 25/* SYSC Status Register */
24#define PWROFFCR_OFFS 0x04 26#define SYSCSR_PONENB 1 /* Ready for power resume requests */
25#define PWRONCR_OFFS 0x0c 27#define SYSCSR_POFFENB 0 /* Ready for power shutoff requests */
26#define PWRER_OFFS 0x14
27 28
28#define SYSCSR_RETRIES 100 29/*
29#define SYSCSR_DELAY_US 1 30 * Power Control Register Offsets inside the register block for each domain
31 * Note: The "CR" registers for ARM cores exist on H1 only
32 * Use WFI to power off, CPG/APMU to resume ARM cores on R-Car Gen2
33 */
34#define PWRSR_OFFS 0x00 /* Power Status Register */
35#define PWROFFCR_OFFS 0x04 /* Power Shutoff Control Register */
36#define PWROFFSR_OFFS 0x08 /* Power Shutoff Status Register */
37#define PWRONCR_OFFS 0x0c /* Power Resume Control Register */
38#define PWRONSR_OFFS 0x10 /* Power Resume Status Register */
39#define PWRER_OFFS 0x14 /* Power Shutoff/Resume Error */
40
41
42#define SYSCSR_RETRIES 100
43#define SYSCSR_DELAY_US 1
44
45#define PWRER_RETRIES 100
46#define PWRER_DELAY_US 1
30 47
31#define SYSCISR_RETRIES 1000 48#define SYSCISR_RETRIES 1000
32#define SYSCISR_DELAY_US 1 49#define SYSCISR_DELAY_US 1
33 50
34static void __iomem *rcar_sysc_base; 51static void __iomem *rcar_sysc_base;
35static DEFINE_SPINLOCK(rcar_sysc_lock); /* SMP CPUs + I/O devices */ 52static DEFINE_SPINLOCK(rcar_sysc_lock); /* SMP CPUs + I/O devices */
36 53
37static int rcar_sysc_pwr_on_off(struct rcar_sysc_ch *sysc_ch, 54static int rcar_sysc_pwr_on_off(const struct rcar_sysc_ch *sysc_ch, bool on)
38 int sr_bit, int reg_offs)
39{ 55{
56 unsigned int sr_bit, reg_offs;
40 int k; 57 int k;
41 58
59 if (on) {
60 sr_bit = SYSCSR_PONENB;
61 reg_offs = PWRONCR_OFFS;
62 } else {
63 sr_bit = SYSCSR_POFFENB;
64 reg_offs = PWROFFCR_OFFS;
65 }
66
67 /* Wait until SYSC is ready to accept a power request */
42 for (k = 0; k < SYSCSR_RETRIES; k++) { 68 for (k = 0; k < SYSCSR_RETRIES; k++) {
43 if (ioread32(rcar_sysc_base + SYSCSR) & (1 << sr_bit)) 69 if (ioread32(rcar_sysc_base + SYSCSR) & BIT(sr_bit))
44 break; 70 break;
45 udelay(SYSCSR_DELAY_US); 71 udelay(SYSCSR_DELAY_US);
46 } 72 }
@@ -48,27 +74,17 @@ static int rcar_sysc_pwr_on_off(struct rcar_sysc_ch *sysc_ch,
48 if (k == SYSCSR_RETRIES) 74 if (k == SYSCSR_RETRIES)
49 return -EAGAIN; 75 return -EAGAIN;
50 76
51 iowrite32(1 << sysc_ch->chan_bit, 77 /* Submit power shutoff or power resume request */
78 iowrite32(BIT(sysc_ch->chan_bit),
52 rcar_sysc_base + sysc_ch->chan_offs + reg_offs); 79 rcar_sysc_base + sysc_ch->chan_offs + reg_offs);
53 80
54 return 0; 81 return 0;
55} 82}
56 83
57static int rcar_sysc_pwr_off(struct rcar_sysc_ch *sysc_ch) 84static int rcar_sysc_power(const struct rcar_sysc_ch *sysc_ch, bool on)
58{
59 return rcar_sysc_pwr_on_off(sysc_ch, 0, PWROFFCR_OFFS);
60}
61
62static int rcar_sysc_pwr_on(struct rcar_sysc_ch *sysc_ch)
63{ 85{
64 return rcar_sysc_pwr_on_off(sysc_ch, 1, PWRONCR_OFFS); 86 unsigned int isr_mask = BIT(sysc_ch->isr_bit);
65} 87 unsigned int chan_mask = BIT(sysc_ch->chan_bit);
66
67static int rcar_sysc_update(struct rcar_sysc_ch *sysc_ch,
68 int (*on_off_fn)(struct rcar_sysc_ch *))
69{
70 unsigned int isr_mask = 1 << sysc_ch->isr_bit;
71 unsigned int chan_mask = 1 << sysc_ch->chan_bit;
72 unsigned int status; 88 unsigned int status;
73 unsigned long flags; 89 unsigned long flags;
74 int ret = 0; 90 int ret = 0;
@@ -78,15 +94,26 @@ static int rcar_sysc_update(struct rcar_sysc_ch *sysc_ch,
78 94
79 iowrite32(isr_mask, rcar_sysc_base + SYSCISCR); 95 iowrite32(isr_mask, rcar_sysc_base + SYSCISCR);
80 96
81 do { 97 /* Submit power shutoff or resume request until it was accepted */
82 ret = on_off_fn(sysc_ch); 98 for (k = 0; k < PWRER_RETRIES; k++) {
99 ret = rcar_sysc_pwr_on_off(sysc_ch, on);
83 if (ret) 100 if (ret)
84 goto out; 101 goto out;
85 102
86 status = ioread32(rcar_sysc_base + 103 status = ioread32(rcar_sysc_base +
87 sysc_ch->chan_offs + PWRER_OFFS); 104 sysc_ch->chan_offs + PWRER_OFFS);
88 } while (status & chan_mask); 105 if (!(status & chan_mask))
106 break;
107
108 udelay(PWRER_DELAY_US);
109 }
110
111 if (k == PWRER_RETRIES) {
112 ret = -EIO;
113 goto out;
114 }
89 115
116 /* Wait until the power shutoff or resume request has completed * */
90 for (k = 0; k < SYSCISR_RETRIES; k++) { 117 for (k = 0; k < SYSCISR_RETRIES; k++) {
91 if (ioread32(rcar_sysc_base + SYSCISR) & isr_mask) 118 if (ioread32(rcar_sysc_base + SYSCISR) & isr_mask)
92 break; 119 break;
@@ -106,22 +133,22 @@ static int rcar_sysc_update(struct rcar_sysc_ch *sysc_ch,
106 return ret; 133 return ret;
107} 134}
108 135
109int rcar_sysc_power_down(struct rcar_sysc_ch *sysc_ch) 136int rcar_sysc_power_down(const struct rcar_sysc_ch *sysc_ch)
110{ 137{
111 return rcar_sysc_update(sysc_ch, rcar_sysc_pwr_off); 138 return rcar_sysc_power(sysc_ch, false);
112} 139}
113 140
114int rcar_sysc_power_up(struct rcar_sysc_ch *sysc_ch) 141int rcar_sysc_power_up(const struct rcar_sysc_ch *sysc_ch)
115{ 142{
116 return rcar_sysc_update(sysc_ch, rcar_sysc_pwr_on); 143 return rcar_sysc_power(sysc_ch, true);
117} 144}
118 145
119bool rcar_sysc_power_is_off(struct rcar_sysc_ch *sysc_ch) 146bool rcar_sysc_power_is_off(const struct rcar_sysc_ch *sysc_ch)
120{ 147{
121 unsigned int st; 148 unsigned int st;
122 149
123 st = ioread32(rcar_sysc_base + sysc_ch->chan_offs + PWRSR_OFFS); 150 st = ioread32(rcar_sysc_base + sysc_ch->chan_offs + PWRSR_OFFS);
124 if (st & (1 << sysc_ch->chan_bit)) 151 if (st & BIT(sysc_ch->chan_bit))
125 return true; 152 return true;
126 153
127 return false; 154 return false;
diff --git a/arch/arm/mach-shmobile/pm-rcar.h b/arch/arm/mach-shmobile/pm-rcar.h
index ef3a1ef628f1..1b901db4a24c 100644
--- a/arch/arm/mach-shmobile/pm-rcar.h
+++ b/arch/arm/mach-shmobile/pm-rcar.h
@@ -2,14 +2,14 @@
2#define PM_RCAR_H 2#define PM_RCAR_H
3 3
4struct rcar_sysc_ch { 4struct rcar_sysc_ch {
5 unsigned long chan_offs; 5 u16 chan_offs;
6 unsigned int chan_bit; 6 u8 chan_bit;
7 unsigned int isr_bit; 7 u8 isr_bit;
8}; 8};
9 9
10int rcar_sysc_power_down(struct rcar_sysc_ch *sysc_ch); 10int rcar_sysc_power_down(const struct rcar_sysc_ch *sysc_ch);
11int rcar_sysc_power_up(struct rcar_sysc_ch *sysc_ch); 11int rcar_sysc_power_up(const struct rcar_sysc_ch *sysc_ch);
12bool rcar_sysc_power_is_off(struct rcar_sysc_ch *sysc_ch); 12bool rcar_sysc_power_is_off(const struct rcar_sysc_ch *sysc_ch);
13void __iomem *rcar_sysc_init(phys_addr_t base); 13void __iomem *rcar_sysc_init(phys_addr_t base);
14 14
15#endif /* PM_RCAR_H */ 15#endif /* PM_RCAR_H */
diff --git a/arch/arm/mach-shmobile/pm-rmobile.c b/arch/arm/mach-shmobile/pm-rmobile.c
index 95018209ff0b..a5b96b990aea 100644
--- a/arch/arm/mach-shmobile/pm-rmobile.c
+++ b/arch/arm/mach-shmobile/pm-rmobile.c
@@ -34,6 +34,12 @@
34#define PSTR_RETRIES 100 34#define PSTR_RETRIES 100
35#define PSTR_DELAY_US 10 35#define PSTR_DELAY_US 10
36 36
37static inline
38struct rmobile_pm_domain *to_rmobile_pd(struct generic_pm_domain *d)
39{
40 return container_of(d, struct rmobile_pm_domain, genpd);
41}
42
37static int rmobile_pd_power_down(struct generic_pm_domain *genpd) 43static int rmobile_pd_power_down(struct generic_pm_domain *genpd)
38{ 44{
39 struct rmobile_pm_domain *rmobile_pd = to_rmobile_pd(genpd); 45 struct rmobile_pm_domain *rmobile_pd = to_rmobile_pd(genpd);
@@ -42,7 +48,7 @@ static int rmobile_pd_power_down(struct generic_pm_domain *genpd)
42 if (rmobile_pd->bit_shift == ~0) 48 if (rmobile_pd->bit_shift == ~0)
43 return -EBUSY; 49 return -EBUSY;
44 50
45 mask = 1 << rmobile_pd->bit_shift; 51 mask = BIT(rmobile_pd->bit_shift);
46 if (rmobile_pd->suspend) { 52 if (rmobile_pd->suspend) {
47 int ret = rmobile_pd->suspend(); 53 int ret = rmobile_pd->suspend();
48 54
@@ -79,7 +85,7 @@ static int __rmobile_pd_power_up(struct rmobile_pm_domain *rmobile_pd,
79 if (rmobile_pd->bit_shift == ~0) 85 if (rmobile_pd->bit_shift == ~0)
80 return 0; 86 return 0;
81 87
82 mask = 1 << rmobile_pd->bit_shift; 88 mask = BIT(rmobile_pd->bit_shift);
83 if (__raw_readl(rmobile_pd->base + PSTR) & mask) 89 if (__raw_readl(rmobile_pd->base + PSTR) & mask)
84 goto out; 90 goto out;
85 91
@@ -163,43 +169,6 @@ static void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd)
163 __rmobile_pd_power_up(rmobile_pd, false); 169 __rmobile_pd_power_up(rmobile_pd, false);
164} 170}
165 171
166#ifdef CONFIG_ARCH_SHMOBILE_LEGACY
167
168void rmobile_init_domains(struct rmobile_pm_domain domains[], int num)
169{
170 int j;
171
172 for (j = 0; j < num; j++)
173 rmobile_init_pm_domain(&domains[j]);
174}
175
176void rmobile_add_device_to_domain_td(const char *domain_name,
177 struct platform_device *pdev,
178 struct gpd_timing_data *td)
179{
180 struct device *dev = &pdev->dev;
181
182 __pm_genpd_name_add_device(domain_name, dev, td);
183}
184
185void rmobile_add_devices_to_domains(struct pm_domain_device data[],
186 int size)
187{
188 struct gpd_timing_data latencies = {
189 .stop_latency_ns = DEFAULT_DEV_LATENCY_NS,
190 .start_latency_ns = DEFAULT_DEV_LATENCY_NS,
191 .save_state_latency_ns = DEFAULT_DEV_LATENCY_NS,
192 .restore_state_latency_ns = DEFAULT_DEV_LATENCY_NS,
193 };
194 int j;
195
196 for (j = 0; j < size; j++)
197 rmobile_add_device_to_domain_td(data[j].domain_name,
198 data[j].pdev, &latencies);
199}
200
201#else /* !CONFIG_ARCH_SHMOBILE_LEGACY */
202
203static int rmobile_pd_suspend_busy(void) 172static int rmobile_pd_suspend_busy(void)
204{ 173{
205 /* 174 /*
@@ -430,5 +399,3 @@ static int __init rmobile_init_pm_domains(void)
430} 399}
431 400
432core_initcall(rmobile_init_pm_domains); 401core_initcall(rmobile_init_pm_domains);
433
434#endif /* !CONFIG_ARCH_SHMOBILE_LEGACY */
diff --git a/arch/arm/mach-shmobile/pm-rmobile.h b/arch/arm/mach-shmobile/pm-rmobile.h
index 53219786f539..30a4a421ee31 100644
--- a/arch/arm/mach-shmobile/pm-rmobile.h
+++ b/arch/arm/mach-shmobile/pm-rmobile.h
@@ -26,39 +26,9 @@ struct rmobile_pm_domain {
26 bool no_debug; 26 bool no_debug;
27}; 27};
28 28
29static inline
30struct rmobile_pm_domain *to_rmobile_pd(struct generic_pm_domain *d)
31{
32 return container_of(d, struct rmobile_pm_domain, genpd);
33}
34
35struct pm_domain_device { 29struct pm_domain_device {
36 const char *domain_name; 30 const char *domain_name;
37 struct platform_device *pdev; 31 struct platform_device *pdev;
38}; 32};
39 33
40#if defined(CONFIG_PM_RMOBILE) && defined(CONFIG_ARCH_SHMOBILE_LEGACY)
41extern void rmobile_init_domains(struct rmobile_pm_domain domains[], int num);
42extern void rmobile_add_device_to_domain_td(const char *domain_name,
43 struct platform_device *pdev,
44 struct gpd_timing_data *td);
45
46static inline void rmobile_add_device_to_domain(const char *domain_name,
47 struct platform_device *pdev)
48{
49 rmobile_add_device_to_domain_td(domain_name, pdev, NULL);
50}
51
52extern void rmobile_add_devices_to_domains(struct pm_domain_device data[],
53 int size);
54#else
55
56#define rmobile_init_domains(domains, num) do { } while (0)
57#define rmobile_add_device_to_domain_td(name, pdev, td) do { } while (0)
58#define rmobile_add_device_to_domain(name, pdev) do { } while (0)
59
60static inline void rmobile_add_devices_to_domains(struct pm_domain_device d[],
61 int size) {}
62#endif /* CONFIG_PM_RMOBILE */
63
64#endif /* PM_RMOBILE_H */ 34#endif /* PM_RMOBILE_H */
diff --git a/arch/arm/mach-shmobile/pm-sh73a0.c b/arch/arm/mach-shmobile/pm-sh73a0.c
deleted file mode 100644
index a7e466817965..000000000000
--- a/arch/arm/mach-shmobile/pm-sh73a0.c
+++ /dev/null
@@ -1,32 +0,0 @@
1/*
2 * sh73a0 Power management support
3 *
4 * Copyright (C) 2012 Bastian Hecht <hechtb+renesas@gmail.com>
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10
11#include <linux/suspend.h>
12#include "common.h"
13
14#ifdef CONFIG_SUSPEND
15static int sh73a0_enter_suspend(suspend_state_t suspend_state)
16{
17 cpu_do_idle();
18 return 0;
19}
20
21static void sh73a0_suspend_init(void)
22{
23 shmobile_suspend_ops.enter = sh73a0_enter_suspend;
24}
25#else
26static void sh73a0_suspend_init(void) {}
27#endif
28
29void __init sh73a0_pm_init(void)
30{
31 sh73a0_suspend_init();
32}
diff --git a/arch/arm/mach-shmobile/r8a7740.h b/arch/arm/mach-shmobile/r8a7740.h
deleted file mode 100644
index ca7805ad7ea3..000000000000
--- a/arch/arm/mach-shmobile/r8a7740.h
+++ /dev/null
@@ -1,58 +0,0 @@
1/*
2 * Copyright (C) 2011 Renesas Solutions Corp.
3 * Copyright (C) 2011 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; version 2 of the License.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#ifndef __ASM_R8A7740_H__
16#define __ASM_R8A7740_H__
17
18/*
19 * MD_CKx pin
20 */
21#define MD_CK2 (1 << 2)
22#define MD_CK1 (1 << 1)
23#define MD_CK0 (1 << 0)
24
25/* DMA slave IDs */
26enum {
27 SHDMA_SLAVE_INVALID,
28 SHDMA_SLAVE_SDHI0_RX,
29 SHDMA_SLAVE_SDHI0_TX,
30 SHDMA_SLAVE_SDHI1_RX,
31 SHDMA_SLAVE_SDHI1_TX,
32 SHDMA_SLAVE_SDHI2_RX,
33 SHDMA_SLAVE_SDHI2_TX,
34 SHDMA_SLAVE_FSIA_RX,
35 SHDMA_SLAVE_FSIA_TX,
36 SHDMA_SLAVE_FSIB_TX,
37 SHDMA_SLAVE_USBHS_TX,
38 SHDMA_SLAVE_USBHS_RX,
39 SHDMA_SLAVE_MMCIF_TX,
40 SHDMA_SLAVE_MMCIF_RX,
41};
42
43extern void r8a7740_meram_workaround(void);
44extern void r8a7740_init_irq_of(void);
45extern void r8a7740_map_io(void);
46extern void r8a7740_add_early_devices(void);
47extern void r8a7740_add_standard_devices(void);
48extern void r8a7740_clock_init(u8 md_ck);
49extern void r8a7740_pinmux_init(void);
50extern void r8a7740_pm_init(void);
51
52#if defined(CONFIG_PM) && !defined(CONFIG_ARCH_MULTIPLATFORM)
53extern void __init r8a7740_init_pm_domains(void);
54#else
55static inline void r8a7740_init_pm_domains(void) {}
56#endif /* CONFIG_PM && !CONFIG_ARCH_MULTIPLATFORM */
57
58#endif /* __ASM_R8A7740_H__ */
diff --git a/arch/arm/mach-shmobile/r8a7779.h b/arch/arm/mach-shmobile/r8a7779.h
index 19f97046dd70..db303f76704e 100644
--- a/arch/arm/mach-shmobile/r8a7779.h
+++ b/arch/arm/mach-shmobile/r8a7779.h
@@ -3,26 +3,7 @@
3 3
4#include <linux/sh_clk.h> 4#include <linux/sh_clk.h>
5 5
6/* HPB-DMA slave IDs */
7enum {
8 HPBDMA_SLAVE_DUMMY,
9 HPBDMA_SLAVE_SDHI0_TX,
10 HPBDMA_SLAVE_SDHI0_RX,
11};
12
13extern void r8a7779_init_irq_extpin(int irlm);
14extern void r8a7779_init_irq_extpin_dt(int irlm);
15extern void r8a7779_init_irq_dt(void);
16extern void r8a7779_map_io(void);
17extern void r8a7779_earlytimer_init(void);
18extern void r8a7779_add_early_devices(void);
19extern void r8a7779_add_standard_devices(void);
20extern void r8a7779_init_late(void);
21extern u32 r8a7779_read_mode_pins(void);
22extern void r8a7779_clock_init(void);
23extern void r8a7779_pinmux_init(void);
24extern void r8a7779_pm_init(void); 6extern void r8a7779_pm_init(void);
25extern void r8a7779_register_twd(void);
26 7
27#ifdef CONFIG_PM 8#ifdef CONFIG_PM
28extern void __init r8a7779_init_pm_domains(void); 9extern void __init r8a7779_init_pm_domains(void);
diff --git a/arch/arm/mach-shmobile/setup-r7s72100.c b/arch/arm/mach-shmobile/setup-r7s72100.c
index 171174777b6f..d46639fc6849 100644
--- a/arch/arm/mach-shmobile/setup-r7s72100.c
+++ b/arch/arm/mach-shmobile/setup-r7s72100.c
@@ -20,7 +20,7 @@
20 20
21#include "common.h" 21#include "common.h"
22 22
23static const char *r7s72100_boards_compat_dt[] __initdata = { 23static const char *const r7s72100_boards_compat_dt[] __initconst = {
24 "renesas,r7s72100", 24 "renesas,r7s72100",
25 NULL, 25 NULL,
26}; 26};
diff --git a/arch/arm/mach-shmobile/setup-r8a73a4.c b/arch/arm/mach-shmobile/setup-r8a73a4.c
index 446cee611902..20173c4f415d 100644
--- a/arch/arm/mach-shmobile/setup-r8a73a4.c
+++ b/arch/arm/mach-shmobile/setup-r8a73a4.c
@@ -20,7 +20,7 @@
20 20
21#include "common.h" 21#include "common.h"
22 22
23static const char *r8a73a4_boards_compat_dt[] __initdata = { 23static const char *const r8a73a4_boards_compat_dt[] __initconst = {
24 "renesas,r8a73a4", 24 "renesas,r8a73a4",
25 NULL, 25 NULL,
26}; 26};
diff --git a/arch/arm/mach-shmobile/setup-r8a7740.c b/arch/arm/mach-shmobile/setup-r8a7740.c
index 00291cc1772d..0c8f80c5b04d 100644
--- a/arch/arm/mach-shmobile/setup-r8a7740.c
+++ b/arch/arm/mach-shmobile/setup-r8a7740.c
@@ -13,31 +13,19 @@
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details. 14 * GNU General Public License for more details.
15 */ 15 */
16#include <linux/dma-mapping.h>
17#include <linux/kernel.h> 16#include <linux/kernel.h>
18#include <linux/init.h> 17#include <linux/init.h>
19#include <linux/io.h> 18#include <linux/io.h>
20#include <linux/irqchip.h> 19#include <linux/irqchip.h>
21#include <linux/irqchip/arm-gic.h> 20#include <linux/irqchip/arm-gic.h>
22#include <linux/platform_data/irq-renesas-intc-irqpin.h>
23#include <linux/platform_device.h>
24#include <linux/of_platform.h> 21#include <linux/of_platform.h>
25#include <linux/serial_sci.h>
26#include <linux/sh_dma.h>
27#include <linux/sh_timer.h>
28#include <linux/platform_data/sh_ipmmu.h>
29 22
30#include <asm/mach-types.h>
31#include <asm/mach/map.h> 23#include <asm/mach/map.h>
32#include <asm/mach/arch.h> 24#include <asm/mach/arch.h>
33#include <asm/mach/time.h> 25#include <asm/mach/time.h>
34#include <asm/hardware/cache-l2x0.h> 26#include <asm/hardware/cache-l2x0.h>
35 27
36#include "common.h" 28#include "common.h"
37#include "dma-register.h"
38#include "irqs.h"
39#include "pm-rmobile.h"
40#include "r8a7740.h"
41 29
42static struct map_desc r8a7740_io_desc[] __initdata = { 30static struct map_desc r8a7740_io_desc[] __initdata = {
43 /* 31 /*
@@ -64,613 +52,12 @@ static struct map_desc r8a7740_io_desc[] __initdata = {
64#endif 52#endif
65}; 53};
66 54
67void __init r8a7740_map_io(void) 55static void __init r8a7740_map_io(void)
68{ 56{
69 debug_ll_io_init(); 57 debug_ll_io_init();
70 iotable_init(r8a7740_io_desc, ARRAY_SIZE(r8a7740_io_desc)); 58 iotable_init(r8a7740_io_desc, ARRAY_SIZE(r8a7740_io_desc));
71} 59}
72 60
73/* PFC */
74static const struct resource pfc_resources[] = {
75 DEFINE_RES_MEM(0xe6050000, 0x8000),
76 DEFINE_RES_MEM(0xe605800c, 0x0020),
77};
78
79void __init r8a7740_pinmux_init(void)
80{
81 platform_device_register_simple("pfc-r8a7740", -1, pfc_resources,
82 ARRAY_SIZE(pfc_resources));
83}
84
85static struct renesas_intc_irqpin_config irqpin0_platform_data = {
86 .irq_base = irq_pin(0), /* IRQ0 -> IRQ7 */
87};
88
89static struct resource irqpin0_resources[] = {
90 DEFINE_RES_MEM(0xe6900000, 4), /* ICR1A */
91 DEFINE_RES_MEM(0xe6900010, 4), /* INTPRI00A */
92 DEFINE_RES_MEM(0xe6900020, 1), /* INTREQ00A */
93 DEFINE_RES_MEM(0xe6900040, 1), /* INTMSK00A */
94 DEFINE_RES_MEM(0xe6900060, 1), /* INTMSKCLR00A */
95 DEFINE_RES_IRQ(gic_spi(149)), /* IRQ0 */
96 DEFINE_RES_IRQ(gic_spi(149)), /* IRQ1 */
97 DEFINE_RES_IRQ(gic_spi(149)), /* IRQ2 */
98 DEFINE_RES_IRQ(gic_spi(149)), /* IRQ3 */
99 DEFINE_RES_IRQ(gic_spi(149)), /* IRQ4 */
100 DEFINE_RES_IRQ(gic_spi(149)), /* IRQ5 */
101 DEFINE_RES_IRQ(gic_spi(149)), /* IRQ6 */
102 DEFINE_RES_IRQ(gic_spi(149)), /* IRQ7 */
103};
104
105static struct platform_device irqpin0_device = {
106 .name = "renesas_intc_irqpin",
107 .id = 0,
108 .resource = irqpin0_resources,
109 .num_resources = ARRAY_SIZE(irqpin0_resources),
110 .dev = {
111 .platform_data = &irqpin0_platform_data,
112 },
113};
114
115static struct renesas_intc_irqpin_config irqpin1_platform_data = {
116 .irq_base = irq_pin(8), /* IRQ8 -> IRQ15 */
117};
118
119static struct resource irqpin1_resources[] = {
120 DEFINE_RES_MEM(0xe6900004, 4), /* ICR2A */
121 DEFINE_RES_MEM(0xe6900014, 4), /* INTPRI10A */
122 DEFINE_RES_MEM(0xe6900024, 1), /* INTREQ10A */
123 DEFINE_RES_MEM(0xe6900044, 1), /* INTMSK10A */
124 DEFINE_RES_MEM(0xe6900064, 1), /* INTMSKCLR10A */
125 DEFINE_RES_IRQ(gic_spi(149)), /* IRQ8 */
126 DEFINE_RES_IRQ(gic_spi(149)), /* IRQ9 */
127 DEFINE_RES_IRQ(gic_spi(149)), /* IRQ10 */
128 DEFINE_RES_IRQ(gic_spi(149)), /* IRQ11 */
129 DEFINE_RES_IRQ(gic_spi(149)), /* IRQ12 */
130 DEFINE_RES_IRQ(gic_spi(149)), /* IRQ13 */
131 DEFINE_RES_IRQ(gic_spi(149)), /* IRQ14 */
132 DEFINE_RES_IRQ(gic_spi(149)), /* IRQ15 */
133};
134
135static struct platform_device irqpin1_device = {
136 .name = "renesas_intc_irqpin",
137 .id = 1,
138 .resource = irqpin1_resources,
139 .num_resources = ARRAY_SIZE(irqpin1_resources),
140 .dev = {
141 .platform_data = &irqpin1_platform_data,
142 },
143};
144
145static struct renesas_intc_irqpin_config irqpin2_platform_data = {
146 .irq_base = irq_pin(16), /* IRQ16 -> IRQ23 */
147};
148
149static struct resource irqpin2_resources[] = {
150 DEFINE_RES_MEM(0xe6900008, 4), /* ICR3A */
151 DEFINE_RES_MEM(0xe6900018, 4), /* INTPRI30A */
152 DEFINE_RES_MEM(0xe6900028, 1), /* INTREQ30A */
153 DEFINE_RES_MEM(0xe6900048, 1), /* INTMSK30A */
154 DEFINE_RES_MEM(0xe6900068, 1), /* INTMSKCLR30A */
155 DEFINE_RES_IRQ(gic_spi(149)), /* IRQ16 */
156 DEFINE_RES_IRQ(gic_spi(149)), /* IRQ17 */
157 DEFINE_RES_IRQ(gic_spi(149)), /* IRQ18 */
158 DEFINE_RES_IRQ(gic_spi(149)), /* IRQ19 */
159 DEFINE_RES_IRQ(gic_spi(149)), /* IRQ20 */
160 DEFINE_RES_IRQ(gic_spi(149)), /* IRQ21 */
161 DEFINE_RES_IRQ(gic_spi(149)), /* IRQ22 */
162 DEFINE_RES_IRQ(gic_spi(149)), /* IRQ23 */
163};
164
165static struct platform_device irqpin2_device = {
166 .name = "renesas_intc_irqpin",
167 .id = 2,
168 .resource = irqpin2_resources,
169 .num_resources = ARRAY_SIZE(irqpin2_resources),
170 .dev = {
171 .platform_data = &irqpin2_platform_data,
172 },
173};
174
175static struct renesas_intc_irqpin_config irqpin3_platform_data = {
176 .irq_base = irq_pin(24), /* IRQ24 -> IRQ31 */
177};
178
179static struct resource irqpin3_resources[] = {
180 DEFINE_RES_MEM(0xe690000c, 4), /* ICR3A */
181 DEFINE_RES_MEM(0xe690001c, 4), /* INTPRI30A */
182 DEFINE_RES_MEM(0xe690002c, 1), /* INTREQ30A */
183 DEFINE_RES_MEM(0xe690004c, 1), /* INTMSK30A */
184 DEFINE_RES_MEM(0xe690006c, 1), /* INTMSKCLR30A */
185 DEFINE_RES_IRQ(gic_spi(149)), /* IRQ24 */
186 DEFINE_RES_IRQ(gic_spi(149)), /* IRQ25 */
187 DEFINE_RES_IRQ(gic_spi(149)), /* IRQ26 */
188 DEFINE_RES_IRQ(gic_spi(149)), /* IRQ27 */
189 DEFINE_RES_IRQ(gic_spi(149)), /* IRQ28 */
190 DEFINE_RES_IRQ(gic_spi(149)), /* IRQ29 */
191 DEFINE_RES_IRQ(gic_spi(149)), /* IRQ30 */
192 DEFINE_RES_IRQ(gic_spi(149)), /* IRQ31 */
193};
194
195static struct platform_device irqpin3_device = {
196 .name = "renesas_intc_irqpin",
197 .id = 3,
198 .resource = irqpin3_resources,
199 .num_resources = ARRAY_SIZE(irqpin3_resources),
200 .dev = {
201 .platform_data = &irqpin3_platform_data,
202 },
203};
204
205/* SCIF */
206#define R8A7740_SCIF(scif_type, index, baseaddr, irq) \
207static struct plat_sci_port scif##index##_platform_data = { \
208 .type = scif_type, \
209 .flags = UPF_BOOT_AUTOCONF, \
210 .scscr = SCSCR_RE | SCSCR_TE, \
211}; \
212 \
213static struct resource scif##index##_resources[] = { \
214 DEFINE_RES_MEM(baseaddr, 0x100), \
215 DEFINE_RES_IRQ(irq), \
216}; \
217 \
218static struct platform_device scif##index##_device = { \
219 .name = "sh-sci", \
220 .id = index, \
221 .resource = scif##index##_resources, \
222 .num_resources = ARRAY_SIZE(scif##index##_resources), \
223 .dev = { \
224 .platform_data = &scif##index##_platform_data, \
225 }, \
226}
227
228R8A7740_SCIF(PORT_SCIFA, 0, 0xe6c40000, gic_spi(100));
229R8A7740_SCIF(PORT_SCIFA, 1, 0xe6c50000, gic_spi(101));
230R8A7740_SCIF(PORT_SCIFA, 2, 0xe6c60000, gic_spi(102));
231R8A7740_SCIF(PORT_SCIFA, 3, 0xe6c70000, gic_spi(103));
232R8A7740_SCIF(PORT_SCIFA, 4, 0xe6c80000, gic_spi(104));
233R8A7740_SCIF(PORT_SCIFA, 5, 0xe6cb0000, gic_spi(105));
234R8A7740_SCIF(PORT_SCIFA, 6, 0xe6cc0000, gic_spi(106));
235R8A7740_SCIF(PORT_SCIFA, 7, 0xe6cd0000, gic_spi(107));
236R8A7740_SCIF(PORT_SCIFB, 8, 0xe6c30000, gic_spi(108));
237
238/* CMT */
239static struct sh_timer_config cmt1_platform_data = {
240 .channels_mask = 0x3f,
241};
242
243static struct resource cmt1_resources[] = {
244 DEFINE_RES_MEM(0xe6138000, 0x170),
245 DEFINE_RES_IRQ(gic_spi(58)),
246};
247
248static struct platform_device cmt1_device = {
249 .name = "sh-cmt-48",
250 .id = 1,
251 .dev = {
252 .platform_data = &cmt1_platform_data,
253 },
254 .resource = cmt1_resources,
255 .num_resources = ARRAY_SIZE(cmt1_resources),
256};
257
258/* TMU */
259static struct sh_timer_config tmu0_platform_data = {
260 .channels_mask = 7,
261};
262
263static struct resource tmu0_resources[] = {
264 DEFINE_RES_MEM(0xfff80000, 0x2c),
265 DEFINE_RES_IRQ(gic_spi(198)),
266 DEFINE_RES_IRQ(gic_spi(199)),
267 DEFINE_RES_IRQ(gic_spi(200)),
268};
269
270static struct platform_device tmu0_device = {
271 .name = "sh-tmu",
272 .id = 0,
273 .dev = {
274 .platform_data = &tmu0_platform_data,
275 },
276 .resource = tmu0_resources,
277 .num_resources = ARRAY_SIZE(tmu0_resources),
278};
279
280/* IPMMUI (an IPMMU module for ICB/LMB) */
281static struct resource ipmmu_resources[] = {
282 [0] = {
283 .name = "IPMMUI",
284 .start = 0xfe951000,
285 .end = 0xfe9510ff,
286 .flags = IORESOURCE_MEM,
287 },
288};
289
290static const char * const ipmmu_dev_names[] = {
291 "sh_mobile_lcdc_fb.0",
292 "sh_mobile_lcdc_fb.1",
293 "sh_mobile_ceu.0",
294};
295
296static struct shmobile_ipmmu_platform_data ipmmu_platform_data = {
297 .dev_names = ipmmu_dev_names,
298 .num_dev_names = ARRAY_SIZE(ipmmu_dev_names),
299};
300
301static struct platform_device ipmmu_device = {
302 .name = "ipmmu",
303 .id = -1,
304 .dev = {
305 .platform_data = &ipmmu_platform_data,
306 },
307 .resource = ipmmu_resources,
308 .num_resources = ARRAY_SIZE(ipmmu_resources),
309};
310
311static struct platform_device *r8a7740_early_devices[] __initdata = {
312 &scif0_device,
313 &scif1_device,
314 &scif2_device,
315 &scif3_device,
316 &scif4_device,
317 &scif5_device,
318 &scif6_device,
319 &scif7_device,
320 &scif8_device,
321 &irqpin0_device,
322 &irqpin1_device,
323 &irqpin2_device,
324 &irqpin3_device,
325 &tmu0_device,
326 &ipmmu_device,
327 &cmt1_device,
328};
329
330/* DMA */
331static const struct sh_dmae_slave_config r8a7740_dmae_slaves[] = {
332 {
333 .slave_id = SHDMA_SLAVE_SDHI0_TX,
334 .addr = 0xe6850030,
335 .chcr = CHCR_TX(XMIT_SZ_16BIT),
336 .mid_rid = 0xc1,
337 }, {
338 .slave_id = SHDMA_SLAVE_SDHI0_RX,
339 .addr = 0xe6850030,
340 .chcr = CHCR_RX(XMIT_SZ_16BIT),
341 .mid_rid = 0xc2,
342 }, {
343 .slave_id = SHDMA_SLAVE_SDHI1_TX,
344 .addr = 0xe6860030,
345 .chcr = CHCR_TX(XMIT_SZ_16BIT),
346 .mid_rid = 0xc9,
347 }, {
348 .slave_id = SHDMA_SLAVE_SDHI1_RX,
349 .addr = 0xe6860030,
350 .chcr = CHCR_RX(XMIT_SZ_16BIT),
351 .mid_rid = 0xca,
352 }, {
353 .slave_id = SHDMA_SLAVE_SDHI2_TX,
354 .addr = 0xe6870030,
355 .chcr = CHCR_TX(XMIT_SZ_16BIT),
356 .mid_rid = 0xcd,
357 }, {
358 .slave_id = SHDMA_SLAVE_SDHI2_RX,
359 .addr = 0xe6870030,
360 .chcr = CHCR_RX(XMIT_SZ_16BIT),
361 .mid_rid = 0xce,
362 }, {
363 .slave_id = SHDMA_SLAVE_FSIA_TX,
364 .addr = 0xfe1f0024,
365 .chcr = CHCR_TX(XMIT_SZ_32BIT),
366 .mid_rid = 0xb1,
367 }, {
368 .slave_id = SHDMA_SLAVE_FSIA_RX,
369 .addr = 0xfe1f0020,
370 .chcr = CHCR_RX(XMIT_SZ_32BIT),
371 .mid_rid = 0xb2,
372 }, {
373 .slave_id = SHDMA_SLAVE_FSIB_TX,
374 .addr = 0xfe1f0064,
375 .chcr = CHCR_TX(XMIT_SZ_32BIT),
376 .mid_rid = 0xb5,
377 }, {
378 .slave_id = SHDMA_SLAVE_MMCIF_TX,
379 .addr = 0xe6bd0034,
380 .chcr = CHCR_TX(XMIT_SZ_32BIT),
381 .mid_rid = 0xd1,
382 }, {
383 .slave_id = SHDMA_SLAVE_MMCIF_RX,
384 .addr = 0xe6bd0034,
385 .chcr = CHCR_RX(XMIT_SZ_32BIT),
386 .mid_rid = 0xd2,
387 },
388};
389
390#define DMA_CHANNEL(a, b, c) \
391{ \
392 .offset = a, \
393 .dmars = b, \
394 .dmars_bit = c, \
395 .chclr_offset = (0x220 - 0x20) + a \
396}
397
398static const struct sh_dmae_channel r8a7740_dmae_channels[] = {
399 DMA_CHANNEL(0x00, 0, 0),
400 DMA_CHANNEL(0x10, 0, 8),
401 DMA_CHANNEL(0x20, 4, 0),
402 DMA_CHANNEL(0x30, 4, 8),
403 DMA_CHANNEL(0x50, 8, 0),
404 DMA_CHANNEL(0x60, 8, 8),
405};
406
407static struct sh_dmae_pdata dma_platform_data = {
408 .slave = r8a7740_dmae_slaves,
409 .slave_num = ARRAY_SIZE(r8a7740_dmae_slaves),
410 .channel = r8a7740_dmae_channels,
411 .channel_num = ARRAY_SIZE(r8a7740_dmae_channels),
412 .ts_low_shift = TS_LOW_SHIFT,
413 .ts_low_mask = TS_LOW_BIT << TS_LOW_SHIFT,
414 .ts_high_shift = TS_HI_SHIFT,
415 .ts_high_mask = TS_HI_BIT << TS_HI_SHIFT,
416 .ts_shift = dma_ts_shift,
417 .ts_shift_num = ARRAY_SIZE(dma_ts_shift),
418 .dmaor_init = DMAOR_DME,
419 .chclr_present = 1,
420};
421
422/* Resource order important! */
423static struct resource r8a7740_dmae0_resources[] = {
424 {
425 /* Channel registers and DMAOR */
426 .start = 0xfe008020,
427 .end = 0xfe00828f,
428 .flags = IORESOURCE_MEM,
429 },
430 {
431 /* DMARSx */
432 .start = 0xfe009000,
433 .end = 0xfe00900b,
434 .flags = IORESOURCE_MEM,
435 },
436 {
437 .name = "error_irq",
438 .start = gic_spi(34),
439 .end = gic_spi(34),
440 .flags = IORESOURCE_IRQ,
441 },
442 {
443 /* IRQ for channels 0-5 */
444 .start = gic_spi(28),
445 .end = gic_spi(33),
446 .flags = IORESOURCE_IRQ,
447 },
448};
449
450/* Resource order important! */
451static struct resource r8a7740_dmae1_resources[] = {
452 {
453 /* Channel registers and DMAOR */
454 .start = 0xfe018020,
455 .end = 0xfe01828f,
456 .flags = IORESOURCE_MEM,
457 },
458 {
459 /* DMARSx */
460 .start = 0xfe019000,
461 .end = 0xfe01900b,
462 .flags = IORESOURCE_MEM,
463 },
464 {
465 .name = "error_irq",
466 .start = gic_spi(41),
467 .end = gic_spi(41),
468 .flags = IORESOURCE_IRQ,
469 },
470 {
471 /* IRQ for channels 0-5 */
472 .start = gic_spi(35),
473 .end = gic_spi(40),
474 .flags = IORESOURCE_IRQ,
475 },
476};
477
478/* Resource order important! */
479static struct resource r8a7740_dmae2_resources[] = {
480 {
481 /* Channel registers and DMAOR */
482 .start = 0xfe028020,
483 .end = 0xfe02828f,
484 .flags = IORESOURCE_MEM,
485 },
486 {
487 /* DMARSx */
488 .start = 0xfe029000,
489 .end = 0xfe02900b,
490 .flags = IORESOURCE_MEM,
491 },
492 {
493 .name = "error_irq",
494 .start = gic_spi(48),
495 .end = gic_spi(48),
496 .flags = IORESOURCE_IRQ,
497 },
498 {
499 /* IRQ for channels 0-5 */
500 .start = gic_spi(42),
501 .end = gic_spi(47),
502 .flags = IORESOURCE_IRQ,
503 },
504};
505
506static struct platform_device dma0_device = {
507 .name = "sh-dma-engine",
508 .id = 0,
509 .resource = r8a7740_dmae0_resources,
510 .num_resources = ARRAY_SIZE(r8a7740_dmae0_resources),
511 .dev = {
512 .platform_data = &dma_platform_data,
513 },
514};
515
516static struct platform_device dma1_device = {
517 .name = "sh-dma-engine",
518 .id = 1,
519 .resource = r8a7740_dmae1_resources,
520 .num_resources = ARRAY_SIZE(r8a7740_dmae1_resources),
521 .dev = {
522 .platform_data = &dma_platform_data,
523 },
524};
525
526static struct platform_device dma2_device = {
527 .name = "sh-dma-engine",
528 .id = 2,
529 .resource = r8a7740_dmae2_resources,
530 .num_resources = ARRAY_SIZE(r8a7740_dmae2_resources),
531 .dev = {
532 .platform_data = &dma_platform_data,
533 },
534};
535
536/* USB-DMAC */
537static const struct sh_dmae_channel r8a7740_usb_dma_channels[] = {
538 {
539 .offset = 0,
540 }, {
541 .offset = 0x20,
542 },
543};
544
545static const struct sh_dmae_slave_config r8a7740_usb_dma_slaves[] = {
546 {
547 .slave_id = SHDMA_SLAVE_USBHS_TX,
548 .chcr = USBTS_INDEX2VAL(USBTS_XMIT_SZ_8BYTE),
549 }, {
550 .slave_id = SHDMA_SLAVE_USBHS_RX,
551 .chcr = USBTS_INDEX2VAL(USBTS_XMIT_SZ_8BYTE),
552 },
553};
554
555static struct sh_dmae_pdata usb_dma_platform_data = {
556 .slave = r8a7740_usb_dma_slaves,
557 .slave_num = ARRAY_SIZE(r8a7740_usb_dma_slaves),
558 .channel = r8a7740_usb_dma_channels,
559 .channel_num = ARRAY_SIZE(r8a7740_usb_dma_channels),
560 .ts_low_shift = USBTS_LOW_SHIFT,
561 .ts_low_mask = USBTS_LOW_BIT << USBTS_LOW_SHIFT,
562 .ts_high_shift = USBTS_HI_SHIFT,
563 .ts_high_mask = USBTS_HI_BIT << USBTS_HI_SHIFT,
564 .ts_shift = dma_usbts_shift,
565 .ts_shift_num = ARRAY_SIZE(dma_usbts_shift),
566 .dmaor_init = DMAOR_DME,
567 .chcr_offset = 0x14,
568 .chcr_ie_bit = 1 << 5,
569 .dmaor_is_32bit = 1,
570 .needs_tend_set = 1,
571 .no_dmars = 1,
572 .slave_only = 1,
573};
574
575static struct resource r8a7740_usb_dma_resources[] = {
576 {
577 /* Channel registers and DMAOR */
578 .start = 0xe68a0020,
579 .end = 0xe68a0064 - 1,
580 .flags = IORESOURCE_MEM,
581 },
582 {
583 /* VCR/SWR/DMICR */
584 .start = 0xe68a0000,
585 .end = 0xe68a0014 - 1,
586 .flags = IORESOURCE_MEM,
587 },
588 {
589 /* IRQ for channels */
590 .start = gic_spi(49),
591 .end = gic_spi(49),
592 .flags = IORESOURCE_IRQ,
593 },
594};
595
596static struct platform_device usb_dma_device = {
597 .name = "sh-dma-engine",
598 .id = 3,
599 .resource = r8a7740_usb_dma_resources,
600 .num_resources = ARRAY_SIZE(r8a7740_usb_dma_resources),
601 .dev = {
602 .platform_data = &usb_dma_platform_data,
603 },
604};
605
606/* I2C */
607static struct resource i2c0_resources[] = {
608 [0] = {
609 .name = "IIC0",
610 .start = 0xfff20000,
611 .end = 0xfff20425 - 1,
612 .flags = IORESOURCE_MEM,
613 },
614 [1] = {
615 .start = gic_spi(201),
616 .end = gic_spi(204),
617 .flags = IORESOURCE_IRQ,
618 },
619};
620
621static struct resource i2c1_resources[] = {
622 [0] = {
623 .name = "IIC1",
624 .start = 0xe6c20000,
625 .end = 0xe6c20425 - 1,
626 .flags = IORESOURCE_MEM,
627 },
628 [1] = {
629 .start = gic_spi(70), /* IIC1_ALI1 */
630 .end = gic_spi(73), /* IIC1_DTEI1 */
631 .flags = IORESOURCE_IRQ,
632 },
633};
634
635static struct platform_device i2c0_device = {
636 .name = "i2c-sh_mobile",
637 .id = 0,
638 .resource = i2c0_resources,
639 .num_resources = ARRAY_SIZE(i2c0_resources),
640};
641
642static struct platform_device i2c1_device = {
643 .name = "i2c-sh_mobile",
644 .id = 1,
645 .resource = i2c1_resources,
646 .num_resources = ARRAY_SIZE(i2c1_resources),
647};
648
649static struct resource pmu_resources[] = {
650 [0] = {
651 .start = gic_spi(83),
652 .end = gic_spi(83),
653 .flags = IORESOURCE_IRQ,
654 },
655};
656
657static struct platform_device pmu_device = {
658 .name = "armv7-pmu",
659 .id = -1,
660 .num_resources = ARRAY_SIZE(pmu_resources),
661 .resource = pmu_resources,
662};
663
664static struct platform_device *r8a7740_late_devices[] __initdata = {
665 &i2c0_device,
666 &i2c1_device,
667 &dma0_device,
668 &dma1_device,
669 &dma2_device,
670 &usb_dma_device,
671 &pmu_device,
672};
673
674/* 61/*
675 * r8a7740 chip has lasting errata on MERAM buffer. 62 * r8a7740 chip has lasting errata on MERAM buffer.
676 * this is work-around for it. 63 * this is work-around for it.
@@ -678,7 +65,7 @@ static struct platform_device *r8a7740_late_devices[] __initdata = {
678 * "Media RAM (MERAM)" on r8a7740 documentation 65 * "Media RAM (MERAM)" on r8a7740 documentation
679 */ 66 */
680#define MEBUFCNTR 0xFE950098 67#define MEBUFCNTR 0xFE950098
681void __init r8a7740_meram_workaround(void) 68static void __init r8a7740_meram_workaround(void)
682{ 69{
683 void __iomem *reg; 70 void __iomem *reg;
684 71
@@ -689,70 +76,13 @@ void __init r8a7740_meram_workaround(void)
689 } 76 }
690} 77}
691 78
692void __init r8a7740_add_standard_devices(void) 79static void __init r8a7740_init_irq_of(void)
693{
694 static struct pm_domain_device domain_devices[] __initdata = {
695 { "A4R", &tmu0_device },
696 { "A4R", &i2c0_device },
697 { "A4S", &irqpin0_device },
698 { "A4S", &irqpin1_device },
699 { "A4S", &irqpin2_device },
700 { "A4S", &irqpin3_device },
701 { "A3SP", &scif0_device },
702 { "A3SP", &scif1_device },
703 { "A3SP", &scif2_device },
704 { "A3SP", &scif3_device },
705 { "A3SP", &scif4_device },
706 { "A3SP", &scif5_device },
707 { "A3SP", &scif6_device },
708 { "A3SP", &scif7_device },
709 { "A3SP", &scif8_device },
710 { "A3SP", &i2c1_device },
711 { "A3SP", &ipmmu_device },
712 { "A3SP", &dma0_device },
713 { "A3SP", &dma1_device },
714 { "A3SP", &dma2_device },
715 { "A3SP", &usb_dma_device },
716 };
717
718 r8a7740_init_pm_domains();
719
720 /* add devices */
721 platform_add_devices(r8a7740_early_devices,
722 ARRAY_SIZE(r8a7740_early_devices));
723 platform_add_devices(r8a7740_late_devices,
724 ARRAY_SIZE(r8a7740_late_devices));
725
726 /* add devices to PM domain */
727 rmobile_add_devices_to_domains(domain_devices,
728 ARRAY_SIZE(domain_devices));
729}
730
731void __init r8a7740_add_early_devices(void)
732{
733 early_platform_add_devices(r8a7740_early_devices,
734 ARRAY_SIZE(r8a7740_early_devices));
735
736 /* setup early console here as well */
737 shmobile_setup_console();
738}
739
740#ifdef CONFIG_USE_OF
741
742void __init r8a7740_init_irq_of(void)
743{ 80{
744 void __iomem *intc_prio_base = ioremap_nocache(0xe6900010, 0x10); 81 void __iomem *intc_prio_base = ioremap_nocache(0xe6900010, 0x10);
745 void __iomem *intc_msk_base = ioremap_nocache(0xe6900040, 0x10); 82 void __iomem *intc_msk_base = ioremap_nocache(0xe6900040, 0x10);
746 void __iomem *pfc_inta_ctrl = ioremap_nocache(0xe605807c, 0x4); 83 void __iomem *pfc_inta_ctrl = ioremap_nocache(0xe605807c, 0x4);
747 84
748#ifdef CONFIG_ARCH_SHMOBILE_LEGACY
749 void __iomem *gic_dist_base = ioremap_nocache(0xc2800000, 0x1000);
750 void __iomem *gic_cpu_base = ioremap_nocache(0xc2000000, 0x1000);
751
752 gic_init(0, 29, gic_dist_base, gic_cpu_base);
753#else
754 irqchip_init(); 85 irqchip_init();
755#endif
756 86
757 /* route signals to GIC */ 87 /* route signals to GIC */
758 iowrite32(0x0, pfc_inta_ctrl); 88 iowrite32(0x0, pfc_inta_ctrl);
@@ -787,7 +117,7 @@ static void __init r8a7740_generic_init(void)
787 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 117 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
788} 118}
789 119
790static const char *r8a7740_boards_compat_dt[] __initdata = { 120static const char *const r8a7740_boards_compat_dt[] __initconst = {
791 "renesas,r8a7740", 121 "renesas,r8a7740",
792 NULL, 122 NULL,
793}; 123};
@@ -800,5 +130,3 @@ DT_MACHINE_START(R8A7740_DT, "Generic R8A7740 (Flattened Device Tree)")
800 .init_late = shmobile_init_late, 130 .init_late = shmobile_init_late,
801 .dt_compat = r8a7740_boards_compat_dt, 131 .dt_compat = r8a7740_boards_compat_dt,
802MACHINE_END 132MACHINE_END
803
804#endif /* CONFIG_USE_OF */
diff --git a/arch/arm/mach-shmobile/setup-r8a7778.c b/arch/arm/mach-shmobile/setup-r8a7778.c
index c49aa094fe17..b9116c81e54b 100644
--- a/arch/arm/mach-shmobile/setup-r8a7778.c
+++ b/arch/arm/mach-shmobile/setup-r8a7778.c
@@ -615,7 +615,7 @@ void __init r8a7778_init_irq_dt(void)
615 iounmap(base); 615 iounmap(base);
616} 616}
617 617
618static const char *r8a7778_compat_dt[] __initdata = { 618static const char *const r8a7778_compat_dt[] __initconst = {
619 "renesas,r8a7778", 619 "renesas,r8a7778",
620 NULL, 620 NULL,
621}; 621};
diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c
index c03e562be12b..7ca891999547 100644
--- a/arch/arm/mach-shmobile/setup-r8a7779.c
+++ b/arch/arm/mach-shmobile/setup-r8a7779.c
@@ -14,37 +14,17 @@
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details. 15 * GNU General Public License for more details.
16 */ 16 */
17#include <linux/kernel.h> 17#include <linux/clk/shmobile.h>
18#include <linux/clocksource.h>
18#include <linux/init.h> 19#include <linux/init.h>
19#include <linux/interrupt.h>
20#include <linux/irq.h> 20#include <linux/irq.h>
21#include <linux/irqchip.h> 21#include <linux/irqchip.h>
22#include <linux/irqchip/arm-gic.h> 22#include <linux/irqchip/arm-gic.h>
23#include <linux/of_platform.h>
24#include <linux/platform_data/dma-rcar-hpbdma.h>
25#include <linux/platform_data/gpio-rcar.h>
26#include <linux/platform_data/irq-renesas-intc-irqpin.h>
27#include <linux/platform_device.h>
28#include <linux/delay.h>
29#include <linux/input.h>
30#include <linux/io.h>
31#include <linux/serial_sci.h>
32#include <linux/sh_timer.h>
33#include <linux/dma-mapping.h>
34#include <linux/usb/otg.h>
35#include <linux/usb/hcd.h>
36#include <linux/usb/ehci_pdriver.h>
37#include <linux/usb/ohci_pdriver.h>
38#include <linux/pm_runtime.h>
39 23
40#include <asm/mach-types.h>
41#include <asm/mach/arch.h> 24#include <asm/mach/arch.h>
42#include <asm/mach/time.h>
43#include <asm/mach/map.h> 25#include <asm/mach/map.h>
44#include <asm/hardware/cache-l2x0.h>
45 26
46#include "common.h" 27#include "common.h"
47#include "irqs.h"
48#include "r8a7779.h" 28#include "r8a7779.h"
49 29
50static struct map_desc r8a7779_io_desc[] __initdata = { 30static struct map_desc r8a7779_io_desc[] __initdata = {
@@ -64,7 +44,7 @@ static struct map_desc r8a7779_io_desc[] __initdata = {
64 }, 44 },
65}; 45};
66 46
67void __init r8a7779_map_io(void) 47static void __init r8a7779_map_io(void)
68{ 48{
69 debug_ll_io_init(); 49 debug_ll_io_init();
70 iotable_init(r8a7779_io_desc, ARRAY_SIZE(r8a7779_io_desc)); 50 iotable_init(r8a7779_io_desc, ARRAY_SIZE(r8a7779_io_desc));
@@ -80,652 +60,12 @@ void __init r8a7779_map_io(void)
80#define INT2NTSR0 IOMEM(0xfe700060) 60#define INT2NTSR0 IOMEM(0xfe700060)
81#define INT2NTSR1 IOMEM(0xfe700064) 61#define INT2NTSR1 IOMEM(0xfe700064)
82 62
83static struct renesas_intc_irqpin_config irqpin0_platform_data __initdata = { 63static void __init r8a7779_init_irq_dt(void)
84 .irq_base = irq_pin(0), /* IRQ0 -> IRQ3 */
85 .sense_bitfield_width = 2,
86};
87
88static struct resource irqpin0_resources[] __initdata = {
89 DEFINE_RES_MEM(0xfe78001c, 4), /* ICR1 */
90 DEFINE_RES_MEM(0xfe780010, 4), /* INTPRI */
91 DEFINE_RES_MEM(0xfe780024, 4), /* INTREQ */
92 DEFINE_RES_MEM(0xfe780044, 4), /* INTMSK0 */
93 DEFINE_RES_MEM(0xfe780064, 4), /* INTMSKCLR0 */
94 DEFINE_RES_IRQ(gic_spi(27)), /* IRQ0 */
95 DEFINE_RES_IRQ(gic_spi(28)), /* IRQ1 */
96 DEFINE_RES_IRQ(gic_spi(29)), /* IRQ2 */
97 DEFINE_RES_IRQ(gic_spi(30)), /* IRQ3 */
98};
99
100void __init r8a7779_init_irq_extpin_dt(int irlm)
101{
102 void __iomem *icr0 = ioremap_nocache(0xfe780000, PAGE_SIZE);
103 u32 tmp;
104
105 if (!icr0) {
106 pr_warn("r8a7779: unable to setup external irq pin mode\n");
107 return;
108 }
109
110 tmp = ioread32(icr0);
111 if (irlm)
112 tmp |= 1 << 23; /* IRQ0 -> IRQ3 as individual pins */
113 else
114 tmp &= ~(1 << 23); /* IRL mode - not supported */
115 tmp |= (1 << 21); /* LVLMODE = 1 */
116 iowrite32(tmp, icr0);
117 iounmap(icr0);
118}
119
120void __init r8a7779_init_irq_extpin(int irlm)
121{ 64{
122 r8a7779_init_irq_extpin_dt(irlm);
123 if (irlm)
124 platform_device_register_resndata(
125 NULL, "renesas_intc_irqpin", -1,
126 irqpin0_resources, ARRAY_SIZE(irqpin0_resources),
127 &irqpin0_platform_data, sizeof(irqpin0_platform_data));
128}
129
130/* PFC/GPIO */
131static struct resource r8a7779_pfc_resources[] = {
132 DEFINE_RES_MEM(0xfffc0000, 0x023c),
133};
134
135static struct platform_device r8a7779_pfc_device = {
136 .name = "pfc-r8a7779",
137 .id = -1,
138 .resource = r8a7779_pfc_resources,
139 .num_resources = ARRAY_SIZE(r8a7779_pfc_resources),
140};
141
142#define R8A7779_GPIO(idx, npins) \
143static struct resource r8a7779_gpio##idx##_resources[] = { \
144 DEFINE_RES_MEM(0xffc40000 + (0x1000 * (idx)), 0x002c), \
145 DEFINE_RES_IRQ(gic_iid(0xad + (idx))), \
146}; \
147 \
148static struct gpio_rcar_config r8a7779_gpio##idx##_platform_data = { \
149 .gpio_base = 32 * (idx), \
150 .irq_base = 0, \
151 .number_of_pins = npins, \
152 .pctl_name = "pfc-r8a7779", \
153}; \
154 \
155static struct platform_device r8a7779_gpio##idx##_device = { \
156 .name = "gpio_rcar", \
157 .id = idx, \
158 .resource = r8a7779_gpio##idx##_resources, \
159 .num_resources = ARRAY_SIZE(r8a7779_gpio##idx##_resources), \
160 .dev = { \
161 .platform_data = &r8a7779_gpio##idx##_platform_data, \
162 }, \
163}
164
165R8A7779_GPIO(0, 32);
166R8A7779_GPIO(1, 32);
167R8A7779_GPIO(2, 32);
168R8A7779_GPIO(3, 32);
169R8A7779_GPIO(4, 32);
170R8A7779_GPIO(5, 32);
171R8A7779_GPIO(6, 9);
172
173static struct platform_device *r8a7779_pinctrl_devices[] __initdata = {
174 &r8a7779_pfc_device,
175 &r8a7779_gpio0_device,
176 &r8a7779_gpio1_device,
177 &r8a7779_gpio2_device,
178 &r8a7779_gpio3_device,
179 &r8a7779_gpio4_device,
180 &r8a7779_gpio5_device,
181 &r8a7779_gpio6_device,
182};
183
184void __init r8a7779_pinmux_init(void)
185{
186 platform_add_devices(r8a7779_pinctrl_devices,
187 ARRAY_SIZE(r8a7779_pinctrl_devices));
188}
189
190/* SCIF */
191#define R8A7779_SCIF(index, baseaddr, irq) \
192static struct plat_sci_port scif##index##_platform_data = { \
193 .type = PORT_SCIF, \
194 .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP, \
195 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1, \
196}; \
197 \
198static struct resource scif##index##_resources[] = { \
199 DEFINE_RES_MEM(baseaddr, 0x100), \
200 DEFINE_RES_IRQ(irq), \
201}; \
202 \
203static struct platform_device scif##index##_device = { \
204 .name = "sh-sci", \
205 .id = index, \
206 .resource = scif##index##_resources, \
207 .num_resources = ARRAY_SIZE(scif##index##_resources), \
208 .dev = { \
209 .platform_data = &scif##index##_platform_data, \
210 }, \
211}
212
213R8A7779_SCIF(0, 0xffe40000, gic_iid(0x78));
214R8A7779_SCIF(1, 0xffe41000, gic_iid(0x79));
215R8A7779_SCIF(2, 0xffe42000, gic_iid(0x7a));
216R8A7779_SCIF(3, 0xffe43000, gic_iid(0x7b));
217R8A7779_SCIF(4, 0xffe44000, gic_iid(0x7c));
218R8A7779_SCIF(5, 0xffe45000, gic_iid(0x7d));
219
220/* TMU */
221static struct sh_timer_config tmu0_platform_data = {
222 .channels_mask = 7,
223};
224
225static struct resource tmu0_resources[] = {
226 DEFINE_RES_MEM(0xffd80000, 0x30),
227 DEFINE_RES_IRQ(gic_iid(0x40)),
228 DEFINE_RES_IRQ(gic_iid(0x41)),
229 DEFINE_RES_IRQ(gic_iid(0x42)),
230};
231
232static struct platform_device tmu0_device = {
233 .name = "sh-tmu",
234 .id = 0,
235 .dev = {
236 .platform_data = &tmu0_platform_data,
237 },
238 .resource = tmu0_resources,
239 .num_resources = ARRAY_SIZE(tmu0_resources),
240};
241
242/* I2C */
243static struct resource rcar_i2c0_res[] = {
244 {
245 .start = 0xffc70000,
246 .end = 0xffc70fff,
247 .flags = IORESOURCE_MEM,
248 }, {
249 .start = gic_iid(0x6f),
250 .flags = IORESOURCE_IRQ,
251 },
252};
253
254static struct platform_device i2c0_device = {
255 .name = "i2c-rcar",
256 .id = 0,
257 .resource = rcar_i2c0_res,
258 .num_resources = ARRAY_SIZE(rcar_i2c0_res),
259};
260
261static struct resource rcar_i2c1_res[] = {
262 {
263 .start = 0xffc71000,
264 .end = 0xffc71fff,
265 .flags = IORESOURCE_MEM,
266 }, {
267 .start = gic_iid(0x72),
268 .flags = IORESOURCE_IRQ,
269 },
270};
271
272static struct platform_device i2c1_device = {
273 .name = "i2c-rcar",
274 .id = 1,
275 .resource = rcar_i2c1_res,
276 .num_resources = ARRAY_SIZE(rcar_i2c1_res),
277};
278
279static struct resource rcar_i2c2_res[] = {
280 {
281 .start = 0xffc72000,
282 .end = 0xffc72fff,
283 .flags = IORESOURCE_MEM,
284 }, {
285 .start = gic_iid(0x70),
286 .flags = IORESOURCE_IRQ,
287 },
288};
289
290static struct platform_device i2c2_device = {
291 .name = "i2c-rcar",
292 .id = 2,
293 .resource = rcar_i2c2_res,
294 .num_resources = ARRAY_SIZE(rcar_i2c2_res),
295};
296
297static struct resource rcar_i2c3_res[] = {
298 {
299 .start = 0xffc73000,
300 .end = 0xffc73fff,
301 .flags = IORESOURCE_MEM,
302 }, {
303 .start = gic_iid(0x71),
304 .flags = IORESOURCE_IRQ,
305 },
306};
307
308static struct platform_device i2c3_device = {
309 .name = "i2c-rcar",
310 .id = 3,
311 .resource = rcar_i2c3_res,
312 .num_resources = ARRAY_SIZE(rcar_i2c3_res),
313};
314
315static struct resource sata_resources[] = {
316 [0] = {
317 .name = "rcar-sata",
318 .start = 0xfc600000,
319 .end = 0xfc601fff,
320 .flags = IORESOURCE_MEM,
321 },
322 [1] = {
323 .start = gic_iid(0x84),
324 .flags = IORESOURCE_IRQ,
325 },
326};
327
328static struct platform_device sata_device = {
329 .name = "sata_rcar",
330 .id = -1,
331 .resource = sata_resources,
332 .num_resources = ARRAY_SIZE(sata_resources),
333 .dev = {
334 .dma_mask = &sata_device.dev.coherent_dma_mask,
335 .coherent_dma_mask = DMA_BIT_MASK(32),
336 },
337};
338
339/* USB */
340static struct usb_phy *phy;
341
342static int usb_power_on(struct platform_device *pdev)
343{
344 if (IS_ERR(phy))
345 return PTR_ERR(phy);
346
347 pm_runtime_enable(&pdev->dev);
348 pm_runtime_get_sync(&pdev->dev);
349
350 usb_phy_init(phy);
351
352 return 0;
353}
354
355static void usb_power_off(struct platform_device *pdev)
356{
357 if (IS_ERR(phy))
358 return;
359
360 usb_phy_shutdown(phy);
361
362 pm_runtime_put_sync(&pdev->dev);
363 pm_runtime_disable(&pdev->dev);
364}
365
366static int ehci_init_internal_buffer(struct usb_hcd *hcd)
367{
368 /*
369 * Below are recommended values from the datasheet;
370 * see [USB :: Setting of EHCI Internal Buffer].
371 */
372 /* EHCI IP internal buffer setting */
373 iowrite32(0x00ff0040, hcd->regs + 0x0094);
374 /* EHCI IP internal buffer enable */
375 iowrite32(0x00000001, hcd->regs + 0x009C);
376
377 return 0;
378}
379
380static struct usb_ehci_pdata ehcix_pdata = {
381 .power_on = usb_power_on,
382 .power_off = usb_power_off,
383 .power_suspend = usb_power_off,
384 .pre_setup = ehci_init_internal_buffer,
385};
386
387static struct resource ehci0_resources[] = {
388 [0] = {
389 .start = 0xffe70000,
390 .end = 0xffe70400 - 1,
391 .flags = IORESOURCE_MEM,
392 },
393 [1] = {
394 .start = gic_iid(0x4c),
395 .flags = IORESOURCE_IRQ,
396 },
397};
398
399static struct platform_device ehci0_device = {
400 .name = "ehci-platform",
401 .id = 0,
402 .dev = {
403 .dma_mask = &ehci0_device.dev.coherent_dma_mask,
404 .coherent_dma_mask = 0xffffffff,
405 .platform_data = &ehcix_pdata,
406 },
407 .num_resources = ARRAY_SIZE(ehci0_resources),
408 .resource = ehci0_resources,
409};
410
411static struct resource ehci1_resources[] = {
412 [0] = {
413 .start = 0xfff70000,
414 .end = 0xfff70400 - 1,
415 .flags = IORESOURCE_MEM,
416 },
417 [1] = {
418 .start = gic_iid(0x4d),
419 .flags = IORESOURCE_IRQ,
420 },
421};
422
423static struct platform_device ehci1_device = {
424 .name = "ehci-platform",
425 .id = 1,
426 .dev = {
427 .dma_mask = &ehci1_device.dev.coherent_dma_mask,
428 .coherent_dma_mask = 0xffffffff,
429 .platform_data = &ehcix_pdata,
430 },
431 .num_resources = ARRAY_SIZE(ehci1_resources),
432 .resource = ehci1_resources,
433};
434
435static struct usb_ohci_pdata ohcix_pdata = {
436 .power_on = usb_power_on,
437 .power_off = usb_power_off,
438 .power_suspend = usb_power_off,
439};
440
441static struct resource ohci0_resources[] = {
442 [0] = {
443 .start = 0xffe70400,
444 .end = 0xffe70800 - 1,
445 .flags = IORESOURCE_MEM,
446 },
447 [1] = {
448 .start = gic_iid(0x4c),
449 .flags = IORESOURCE_IRQ,
450 },
451};
452
453static struct platform_device ohci0_device = {
454 .name = "ohci-platform",
455 .id = 0,
456 .dev = {
457 .dma_mask = &ohci0_device.dev.coherent_dma_mask,
458 .coherent_dma_mask = 0xffffffff,
459 .platform_data = &ohcix_pdata,
460 },
461 .num_resources = ARRAY_SIZE(ohci0_resources),
462 .resource = ohci0_resources,
463};
464
465static struct resource ohci1_resources[] = {
466 [0] = {
467 .start = 0xfff70400,
468 .end = 0xfff70800 - 1,
469 .flags = IORESOURCE_MEM,
470 },
471 [1] = {
472 .start = gic_iid(0x4d),
473 .flags = IORESOURCE_IRQ,
474 },
475};
476
477static struct platform_device ohci1_device = {
478 .name = "ohci-platform",
479 .id = 1,
480 .dev = {
481 .dma_mask = &ohci1_device.dev.coherent_dma_mask,
482 .coherent_dma_mask = 0xffffffff,
483 .platform_data = &ohcix_pdata,
484 },
485 .num_resources = ARRAY_SIZE(ohci1_resources),
486 .resource = ohci1_resources,
487};
488
489/* HPB-DMA */
490
491/* Asynchronous mode register bits */
492#define HPB_DMAE_ASYNCMDR_ASMD43_MASK BIT(23) /* MMC1 */
493#define HPB_DMAE_ASYNCMDR_ASMD43_SINGLE BIT(23) /* MMC1 */
494#define HPB_DMAE_ASYNCMDR_ASMD43_MULTI 0 /* MMC1 */
495#define HPB_DMAE_ASYNCMDR_ASBTMD43_MASK BIT(22) /* MMC1 */
496#define HPB_DMAE_ASYNCMDR_ASBTMD43_BURST BIT(22) /* MMC1 */
497#define HPB_DMAE_ASYNCMDR_ASBTMD43_NBURST 0 /* MMC1 */
498#define HPB_DMAE_ASYNCMDR_ASMD24_MASK BIT(21) /* MMC0 */
499#define HPB_DMAE_ASYNCMDR_ASMD24_SINGLE BIT(21) /* MMC0 */
500#define HPB_DMAE_ASYNCMDR_ASMD24_MULTI 0 /* MMC0 */
501#define HPB_DMAE_ASYNCMDR_ASBTMD24_MASK BIT(20) /* MMC0 */
502#define HPB_DMAE_ASYNCMDR_ASBTMD24_BURST BIT(20) /* MMC0 */
503#define HPB_DMAE_ASYNCMDR_ASBTMD24_NBURST 0 /* MMC0 */
504#define HPB_DMAE_ASYNCMDR_ASMD41_MASK BIT(19) /* SDHI3 */
505#define HPB_DMAE_ASYNCMDR_ASMD41_SINGLE BIT(19) /* SDHI3 */
506#define HPB_DMAE_ASYNCMDR_ASMD41_MULTI 0 /* SDHI3 */
507#define HPB_DMAE_ASYNCMDR_ASBTMD41_MASK BIT(18) /* SDHI3 */
508#define HPB_DMAE_ASYNCMDR_ASBTMD41_BURST BIT(18) /* SDHI3 */
509#define HPB_DMAE_ASYNCMDR_ASBTMD41_NBURST 0 /* SDHI3 */
510#define HPB_DMAE_ASYNCMDR_ASMD40_MASK BIT(17) /* SDHI3 */
511#define HPB_DMAE_ASYNCMDR_ASMD40_SINGLE BIT(17) /* SDHI3 */
512#define HPB_DMAE_ASYNCMDR_ASMD40_MULTI 0 /* SDHI3 */
513#define HPB_DMAE_ASYNCMDR_ASBTMD40_MASK BIT(16) /* SDHI3 */
514#define HPB_DMAE_ASYNCMDR_ASBTMD40_BURST BIT(16) /* SDHI3 */
515#define HPB_DMAE_ASYNCMDR_ASBTMD40_NBURST 0 /* SDHI3 */
516#define HPB_DMAE_ASYNCMDR_ASMD39_MASK BIT(15) /* SDHI3 */
517#define HPB_DMAE_ASYNCMDR_ASMD39_SINGLE BIT(15) /* SDHI3 */
518#define HPB_DMAE_ASYNCMDR_ASMD39_MULTI 0 /* SDHI3 */
519#define HPB_DMAE_ASYNCMDR_ASBTMD39_MASK BIT(14) /* SDHI3 */
520#define HPB_DMAE_ASYNCMDR_ASBTMD39_BURST BIT(14) /* SDHI3 */
521#define HPB_DMAE_ASYNCMDR_ASBTMD39_NBURST 0 /* SDHI3 */
522#define HPB_DMAE_ASYNCMDR_ASMD27_MASK BIT(13) /* SDHI2 */
523#define HPB_DMAE_ASYNCMDR_ASMD27_SINGLE BIT(13) /* SDHI2 */
524#define HPB_DMAE_ASYNCMDR_ASMD27_MULTI 0 /* SDHI2 */
525#define HPB_DMAE_ASYNCMDR_ASBTMD27_MASK BIT(12) /* SDHI2 */
526#define HPB_DMAE_ASYNCMDR_ASBTMD27_BURST BIT(12) /* SDHI2 */
527#define HPB_DMAE_ASYNCMDR_ASBTMD27_NBURST 0 /* SDHI2 */
528#define HPB_DMAE_ASYNCMDR_ASMD26_MASK BIT(11) /* SDHI2 */
529#define HPB_DMAE_ASYNCMDR_ASMD26_SINGLE BIT(11) /* SDHI2 */
530#define HPB_DMAE_ASYNCMDR_ASMD26_MULTI 0 /* SDHI2 */
531#define HPB_DMAE_ASYNCMDR_ASBTMD26_MASK BIT(10) /* SDHI2 */
532#define HPB_DMAE_ASYNCMDR_ASBTMD26_BURST BIT(10) /* SDHI2 */
533#define HPB_DMAE_ASYNCMDR_ASBTMD26_NBURST 0 /* SDHI2 */
534#define HPB_DMAE_ASYNCMDR_ASMD25_MASK BIT(9) /* SDHI2 */
535#define HPB_DMAE_ASYNCMDR_ASMD25_SINGLE BIT(9) /* SDHI2 */
536#define HPB_DMAE_ASYNCMDR_ASMD25_MULTI 0 /* SDHI2 */
537#define HPB_DMAE_ASYNCMDR_ASBTMD25_MASK BIT(8) /* SDHI2 */
538#define HPB_DMAE_ASYNCMDR_ASBTMD25_BURST BIT(8) /* SDHI2 */
539#define HPB_DMAE_ASYNCMDR_ASBTMD25_NBURST 0 /* SDHI2 */
540#define HPB_DMAE_ASYNCMDR_ASMD23_MASK BIT(7) /* SDHI0 */
541#define HPB_DMAE_ASYNCMDR_ASMD23_SINGLE BIT(7) /* SDHI0 */
542#define HPB_DMAE_ASYNCMDR_ASMD23_MULTI 0 /* SDHI0 */
543#define HPB_DMAE_ASYNCMDR_ASBTMD23_MASK BIT(6) /* SDHI0 */
544#define HPB_DMAE_ASYNCMDR_ASBTMD23_BURST BIT(6) /* SDHI0 */
545#define HPB_DMAE_ASYNCMDR_ASBTMD23_NBURST 0 /* SDHI0 */
546#define HPB_DMAE_ASYNCMDR_ASMD22_MASK BIT(5) /* SDHI0 */
547#define HPB_DMAE_ASYNCMDR_ASMD22_SINGLE BIT(5) /* SDHI0 */
548#define HPB_DMAE_ASYNCMDR_ASMD22_MULTI 0 /* SDHI0 */
549#define HPB_DMAE_ASYNCMDR_ASBTMD22_MASK BIT(4) /* SDHI0 */
550#define HPB_DMAE_ASYNCMDR_ASBTMD22_BURST BIT(4) /* SDHI0 */
551#define HPB_DMAE_ASYNCMDR_ASBTMD22_NBURST 0 /* SDHI0 */
552#define HPB_DMAE_ASYNCMDR_ASMD21_MASK BIT(3) /* SDHI0 */
553#define HPB_DMAE_ASYNCMDR_ASMD21_SINGLE BIT(3) /* SDHI0 */
554#define HPB_DMAE_ASYNCMDR_ASMD21_MULTI 0 /* SDHI0 */
555#define HPB_DMAE_ASYNCMDR_ASBTMD21_MASK BIT(2) /* SDHI0 */
556#define HPB_DMAE_ASYNCMDR_ASBTMD21_BURST BIT(2) /* SDHI0 */
557#define HPB_DMAE_ASYNCMDR_ASBTMD21_NBURST 0 /* SDHI0 */
558#define HPB_DMAE_ASYNCMDR_ASMD20_MASK BIT(1) /* SDHI1 */
559#define HPB_DMAE_ASYNCMDR_ASMD20_SINGLE BIT(1) /* SDHI1 */
560#define HPB_DMAE_ASYNCMDR_ASMD20_MULTI 0 /* SDHI1 */
561#define HPB_DMAE_ASYNCMDR_ASBTMD20_MASK BIT(0) /* SDHI1 */
562#define HPB_DMAE_ASYNCMDR_ASBTMD20_BURST BIT(0) /* SDHI1 */
563#define HPB_DMAE_ASYNCMDR_ASBTMD20_NBURST 0 /* SDHI1 */
564
565static const struct hpb_dmae_slave_config hpb_dmae_slaves[] = {
566 {
567 .id = HPBDMA_SLAVE_SDHI0_TX,
568 .addr = 0xffe4c000 + 0x30,
569 .dcr = HPB_DMAE_DCR_SPDS_16BIT |
570 HPB_DMAE_DCR_DMDL |
571 HPB_DMAE_DCR_DPDS_16BIT,
572 .rstr = HPB_DMAE_ASYNCRSTR_ASRST21 |
573 HPB_DMAE_ASYNCRSTR_ASRST22 |
574 HPB_DMAE_ASYNCRSTR_ASRST23,
575 .mdr = HPB_DMAE_ASYNCMDR_ASMD21_SINGLE |
576 HPB_DMAE_ASYNCMDR_ASBTMD21_NBURST,
577 .mdm = HPB_DMAE_ASYNCMDR_ASMD21_MASK |
578 HPB_DMAE_ASYNCMDR_ASBTMD21_MASK,
579 .port = 0x0D0C,
580 .flags = HPB_DMAE_SET_ASYNC_RESET | HPB_DMAE_SET_ASYNC_MODE,
581 .dma_ch = 21,
582 }, {
583 .id = HPBDMA_SLAVE_SDHI0_RX,
584 .addr = 0xffe4c000 + 0x30,
585 .dcr = HPB_DMAE_DCR_SMDL |
586 HPB_DMAE_DCR_SPDS_16BIT |
587 HPB_DMAE_DCR_DPDS_16BIT,
588 .rstr = HPB_DMAE_ASYNCRSTR_ASRST21 |
589 HPB_DMAE_ASYNCRSTR_ASRST22 |
590 HPB_DMAE_ASYNCRSTR_ASRST23,
591 .mdr = HPB_DMAE_ASYNCMDR_ASMD22_SINGLE |
592 HPB_DMAE_ASYNCMDR_ASBTMD22_NBURST,
593 .mdm = HPB_DMAE_ASYNCMDR_ASMD22_MASK |
594 HPB_DMAE_ASYNCMDR_ASBTMD22_MASK,
595 .port = 0x0D0C,
596 .flags = HPB_DMAE_SET_ASYNC_RESET | HPB_DMAE_SET_ASYNC_MODE,
597 .dma_ch = 22,
598 },
599};
600
601static const struct hpb_dmae_channel hpb_dmae_channels[] = {
602 HPB_DMAE_CHANNEL(0x93, HPBDMA_SLAVE_SDHI0_TX), /* ch. 21 */
603 HPB_DMAE_CHANNEL(0x93, HPBDMA_SLAVE_SDHI0_RX), /* ch. 22 */
604};
605
606static struct hpb_dmae_pdata dma_platform_data __initdata = {
607 .slaves = hpb_dmae_slaves,
608 .num_slaves = ARRAY_SIZE(hpb_dmae_slaves),
609 .channels = hpb_dmae_channels,
610 .num_channels = ARRAY_SIZE(hpb_dmae_channels),
611 .ts_shift = {
612 [XMIT_SZ_8BIT] = 0,
613 [XMIT_SZ_16BIT] = 1,
614 [XMIT_SZ_32BIT] = 2,
615 },
616 .num_hw_channels = 44,
617};
618
619static struct resource hpb_dmae_resources[] __initdata = {
620 /* Channel registers */
621 DEFINE_RES_MEM(0xffc08000, 0x1000),
622 /* Common registers */
623 DEFINE_RES_MEM(0xffc09000, 0x170),
624 /* Asynchronous reset registers */
625 DEFINE_RES_MEM(0xffc00300, 4),
626 /* Asynchronous mode registers */
627 DEFINE_RES_MEM(0xffc00400, 4),
628 /* IRQ for DMA channels */
629 DEFINE_RES_NAMED(gic_iid(0x8e), 12, NULL, IORESOURCE_IRQ),
630};
631
632static void __init r8a7779_register_hpb_dmae(void)
633{
634 platform_device_register_resndata(NULL, "hpb-dma-engine",
635 -1, hpb_dmae_resources,
636 ARRAY_SIZE(hpb_dmae_resources),
637 &dma_platform_data,
638 sizeof(dma_platform_data));
639}
640
641static struct platform_device *r8a7779_early_devices[] __initdata = {
642 &tmu0_device,
643};
644
645static struct platform_device *r8a7779_standard_devices[] __initdata = {
646 &scif0_device,
647 &scif1_device,
648 &scif2_device,
649 &scif3_device,
650 &scif4_device,
651 &scif5_device,
652 &i2c0_device,
653 &i2c1_device,
654 &i2c2_device,
655 &i2c3_device,
656 &sata_device,
657};
658
659void __init r8a7779_add_standard_devices(void)
660{
661#ifdef CONFIG_CACHE_L2X0
662 /* Shared attribute override enable, 64K*16way */
663 l2x0_init(IOMEM(0xf0100000), 0x00400000, 0xc20f0fff);
664#endif
665 r8a7779_pm_init();
666
667 r8a7779_init_pm_domains();
668
669 platform_add_devices(r8a7779_early_devices,
670 ARRAY_SIZE(r8a7779_early_devices));
671 platform_add_devices(r8a7779_standard_devices,
672 ARRAY_SIZE(r8a7779_standard_devices));
673 r8a7779_register_hpb_dmae();
674}
675
676void __init r8a7779_add_early_devices(void)
677{
678 early_platform_add_devices(r8a7779_early_devices,
679 ARRAY_SIZE(r8a7779_early_devices));
680
681 /* Early serial console setup is not included here due to
682 * memory map collisions. The SCIF serial ports in r8a7779
683 * are difficult to identity map 1:1 due to collision with the
684 * virtual memory range used by the coherent DMA code on ARM.
685 *
686 * Anyone wanting to debug early can remove UPF_IOREMAP from
687 * the sh-sci serial console platform data, adjust mapbase
688 * to a static M:N virt:phys mapping that needs to be added to
689 * the mappings passed with iotable_init() above.
690 *
691 * Then add a call to shmobile_setup_console() from this function.
692 *
693 * As a final step pass earlyprint=sh-sci.2,115200 on the kernel
694 * command line in case of the marzen board.
695 */
696}
697
698static struct platform_device *r8a7779_late_devices[] __initdata = {
699 &ehci0_device,
700 &ehci1_device,
701 &ohci0_device,
702 &ohci1_device,
703};
704
705void __init r8a7779_init_late(void)
706{
707 /* get USB PHY */
708 phy = usb_get_phy(USB_PHY_TYPE_USB2);
709
710 shmobile_init_late();
711 platform_add_devices(r8a7779_late_devices,
712 ARRAY_SIZE(r8a7779_late_devices));
713}
714
715#ifdef CONFIG_USE_OF
716void __init r8a7779_init_irq_dt(void)
717{
718#ifdef CONFIG_ARCH_SHMOBILE_LEGACY
719 void __iomem *gic_dist_base = ioremap_nocache(0xf0001000, 0x1000);
720 void __iomem *gic_cpu_base = ioremap_nocache(0xf0000100, 0x1000);
721#endif
722 gic_set_irqchip_flags(IRQCHIP_SKIP_SET_WAKE); 65 gic_set_irqchip_flags(IRQCHIP_SKIP_SET_WAKE);
723 66
724#ifdef CONFIG_ARCH_SHMOBILE_LEGACY
725 gic_init(0, 29, gic_dist_base, gic_cpu_base);
726#else
727 irqchip_init(); 67 irqchip_init();
728#endif 68
729 /* route all interrupts to ARM */ 69 /* route all interrupts to ARM */
730 __raw_writel(0xffffffff, INT2NTSR0); 70 __raw_writel(0xffffffff, INT2NTSR0);
731 __raw_writel(0x3fffffff, INT2NTSR1); 71 __raw_writel(0x3fffffff, INT2NTSR1);
@@ -740,7 +80,7 @@ void __init r8a7779_init_irq_dt(void)
740 80
741#define MODEMR 0xffcc0020 81#define MODEMR 0xffcc0020
742 82
743u32 __init r8a7779_read_mode_pins(void) 83static u32 __init r8a7779_read_mode_pins(void)
744{ 84{
745 static u32 mode; 85 static u32 mode;
746 static bool mode_valid; 86 static bool mode_valid;
@@ -756,16 +96,23 @@ u32 __init r8a7779_read_mode_pins(void)
756 return mode; 96 return mode;
757} 97}
758 98
759static const char *r8a7779_compat_dt[] __initdata = { 99static void __init r8a7779_init_time(void)
100{
101 r8a7779_clocks_init(r8a7779_read_mode_pins());
102 clocksource_of_init();
103}
104
105static const char *const r8a7779_compat_dt[] __initconst = {
760 "renesas,r8a7779", 106 "renesas,r8a7779",
761 NULL, 107 NULL,
762}; 108};
763 109
764DT_MACHINE_START(R8A7779_DT, "Generic R8A7779 (Flattened Device Tree)") 110DT_MACHINE_START(R8A7779_DT, "Generic R8A7779 (Flattened Device Tree)")
111 .smp = smp_ops(r8a7779_smp_ops),
765 .map_io = r8a7779_map_io, 112 .map_io = r8a7779_map_io,
766 .init_early = shmobile_init_delay, 113 .init_early = shmobile_init_delay,
114 .init_time = r8a7779_init_time,
767 .init_irq = r8a7779_init_irq_dt, 115 .init_irq = r8a7779_init_irq_dt,
768 .init_late = shmobile_init_late, 116 .init_late = shmobile_init_late,
769 .dt_compat = r8a7779_compat_dt, 117 .dt_compat = r8a7779_compat_dt,
770MACHINE_END 118MACHINE_END
771#endif /* CONFIG_USE_OF */
diff --git a/arch/arm/mach-shmobile/setup-r8a7791.c b/arch/arm/mach-shmobile/setup-r8a7791.c
index ef8eb3af586d..3b8dbaf07777 100644
--- a/arch/arm/mach-shmobile/setup-r8a7791.c
+++ b/arch/arm/mach-shmobile/setup-r8a7791.c
@@ -23,7 +23,7 @@
23#include "r8a7791.h" 23#include "r8a7791.h"
24#include "rcar-gen2.h" 24#include "rcar-gen2.h"
25 25
26static const char *r8a7791_boards_compat_dt[] __initdata = { 26static const char *const r8a7791_boards_compat_dt[] __initconst = {
27 "renesas,r8a7791", 27 "renesas,r8a7791",
28 NULL, 28 NULL,
29}; 29};
diff --git a/arch/arm/mach-shmobile/setup-rcar-gen2.c b/arch/arm/mach-shmobile/setup-rcar-gen2.c
index 5d13595aa027..aa3339258d9c 100644
--- a/arch/arm/mach-shmobile/setup-rcar-gen2.c
+++ b/arch/arm/mach-shmobile/setup-rcar-gen2.c
@@ -128,9 +128,7 @@ void __init rcar_gen2_timer_init(void)
128#endif /* CONFIG_ARM_ARCH_TIMER */ 128#endif /* CONFIG_ARM_ARCH_TIMER */
129 129
130 rcar_gen2_clocks_init(mode); 130 rcar_gen2_clocks_init(mode);
131#ifdef CONFIG_ARCH_SHMOBILE_MULTI
132 clocksource_of_init(); 131 clocksource_of_init();
133#endif
134} 132}
135 133
136struct memory_reserve_config { 134struct memory_reserve_config {
diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c b/arch/arm/mach-shmobile/setup-sh73a0.c
index fb2ab7590af8..99a2004cac76 100644
--- a/arch/arm/mach-shmobile/setup-sh73a0.c
+++ b/arch/arm/mach-shmobile/setup-sh73a0.c
@@ -18,28 +18,17 @@
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/interrupt.h> 19#include <linux/interrupt.h>
20#include <linux/irq.h> 20#include <linux/irq.h>
21#include <linux/platform_device.h>
22#include <linux/of_platform.h> 21#include <linux/of_platform.h>
23#include <linux/delay.h> 22#include <linux/delay.h>
24#include <linux/input.h> 23#include <linux/input.h>
25#include <linux/i2c/i2c-sh_mobile.h>
26#include <linux/io.h> 24#include <linux/io.h>
27#include <linux/serial_sci.h>
28#include <linux/sh_dma.h>
29#include <linux/sh_timer.h>
30#include <linux/platform_data/sh_ipmmu.h>
31#include <linux/platform_data/irq-renesas-intc-irqpin.h>
32 25
33#include <asm/hardware/cache-l2x0.h> 26#include <asm/hardware/cache-l2x0.h>
34#include <asm/mach-types.h>
35#include <asm/mach/map.h> 27#include <asm/mach/map.h>
36#include <asm/mach/arch.h> 28#include <asm/mach/arch.h>
37#include <asm/mach/time.h> 29#include <asm/mach/time.h>
38 30
39#include "common.h" 31#include "common.h"
40#include "dma-register.h"
41#include "intc.h"
42#include "irqs.h"
43#include "sh73a0.h" 32#include "sh73a0.h"
44 33
45static struct map_desc sh73a0_io_desc[] __initdata = { 34static struct map_desc sh73a0_io_desc[] __initdata = {
@@ -54,737 +43,12 @@ static struct map_desc sh73a0_io_desc[] __initdata = {
54 }, 43 },
55}; 44};
56 45
57void __init sh73a0_map_io(void) 46static void __init sh73a0_map_io(void)
58{ 47{
59 debug_ll_io_init(); 48 debug_ll_io_init();
60 iotable_init(sh73a0_io_desc, ARRAY_SIZE(sh73a0_io_desc)); 49 iotable_init(sh73a0_io_desc, ARRAY_SIZE(sh73a0_io_desc));
61} 50}
62 51
63/* PFC */
64static struct resource pfc_resources[] __initdata = {
65 DEFINE_RES_MEM(0xe6050000, 0x8000),
66 DEFINE_RES_MEM(0xe605801c, 0x000c),
67};
68
69void __init sh73a0_pinmux_init(void)
70{
71 platform_device_register_simple("pfc-sh73a0", -1, pfc_resources,
72 ARRAY_SIZE(pfc_resources));
73}
74
75/* SCIF */
76#define SH73A0_SCIF(scif_type, index, baseaddr, irq) \
77static struct plat_sci_port scif##index##_platform_data = { \
78 .type = scif_type, \
79 .flags = UPF_BOOT_AUTOCONF, \
80 .scscr = SCSCR_RE | SCSCR_TE, \
81}; \
82 \
83static struct resource scif##index##_resources[] = { \
84 DEFINE_RES_MEM(baseaddr, 0x100), \
85 DEFINE_RES_IRQ(irq), \
86}; \
87 \
88static struct platform_device scif##index##_device = { \
89 .name = "sh-sci", \
90 .id = index, \
91 .resource = scif##index##_resources, \
92 .num_resources = ARRAY_SIZE(scif##index##_resources), \
93 .dev = { \
94 .platform_data = &scif##index##_platform_data, \
95 }, \
96}
97
98SH73A0_SCIF(PORT_SCIFA, 0, 0xe6c40000, gic_spi(72));
99SH73A0_SCIF(PORT_SCIFA, 1, 0xe6c50000, gic_spi(73));
100SH73A0_SCIF(PORT_SCIFA, 2, 0xe6c60000, gic_spi(74));
101SH73A0_SCIF(PORT_SCIFA, 3, 0xe6c70000, gic_spi(75));
102SH73A0_SCIF(PORT_SCIFA, 4, 0xe6c80000, gic_spi(78));
103SH73A0_SCIF(PORT_SCIFA, 5, 0xe6cb0000, gic_spi(79));
104SH73A0_SCIF(PORT_SCIFA, 6, 0xe6cc0000, gic_spi(156));
105SH73A0_SCIF(PORT_SCIFA, 7, 0xe6cd0000, gic_spi(143));
106SH73A0_SCIF(PORT_SCIFB, 8, 0xe6c30000, gic_spi(80));
107
108static struct sh_timer_config cmt1_platform_data = {
109 .channels_mask = 0x3f,
110};
111
112static struct resource cmt1_resources[] = {
113 DEFINE_RES_MEM(0xe6138000, 0x200),
114 DEFINE_RES_IRQ(gic_spi(65)),
115};
116
117static struct platform_device cmt1_device = {
118 .name = "sh-cmt-48",
119 .id = 1,
120 .dev = {
121 .platform_data = &cmt1_platform_data,
122 },
123 .resource = cmt1_resources,
124 .num_resources = ARRAY_SIZE(cmt1_resources),
125};
126
127/* TMU */
128static struct sh_timer_config tmu0_platform_data = {
129 .channels_mask = 7,
130};
131
132static struct resource tmu0_resources[] = {
133 DEFINE_RES_MEM(0xfff60000, 0x2c),
134 DEFINE_RES_IRQ(intcs_evt2irq(0xe80)),
135 DEFINE_RES_IRQ(intcs_evt2irq(0xea0)),
136 DEFINE_RES_IRQ(intcs_evt2irq(0xec0)),
137};
138
139static struct platform_device tmu0_device = {
140 .name = "sh-tmu",
141 .id = 0,
142 .dev = {
143 .platform_data = &tmu0_platform_data,
144 },
145 .resource = tmu0_resources,
146 .num_resources = ARRAY_SIZE(tmu0_resources),
147};
148
149static struct resource i2c0_resources[] = {
150 [0] = DEFINE_RES_MEM(0xe6820000, 0x426),
151 [1] = {
152 .start = gic_spi(167),
153 .end = gic_spi(170),
154 .flags = IORESOURCE_IRQ,
155 },
156};
157
158static struct resource i2c1_resources[] = {
159 [0] = DEFINE_RES_MEM(0xe6822000, 0x426),
160 [1] = {
161 .start = gic_spi(51),
162 .end = gic_spi(54),
163 .flags = IORESOURCE_IRQ,
164 },
165};
166
167static struct resource i2c2_resources[] = {
168 [0] = DEFINE_RES_MEM(0xe6824000, 0x426),
169 [1] = {
170 .start = gic_spi(171),
171 .end = gic_spi(174),
172 .flags = IORESOURCE_IRQ,
173 },
174};
175
176static struct resource i2c3_resources[] = {
177 [0] = DEFINE_RES_MEM(0xe6826000, 0x426),
178 [1] = {
179 .start = gic_spi(183),
180 .end = gic_spi(186),
181 .flags = IORESOURCE_IRQ,
182 },
183};
184
185static struct resource i2c4_resources[] = {
186 [0] = DEFINE_RES_MEM(0xe6828000, 0x426),
187 [1] = {
188 .start = gic_spi(187),
189 .end = gic_spi(190),
190 .flags = IORESOURCE_IRQ,
191 },
192};
193
194static struct i2c_sh_mobile_platform_data i2c_platform_data = {
195 .clks_per_count = 2,
196};
197
198static struct platform_device i2c0_device = {
199 .name = "i2c-sh_mobile",
200 .id = 0,
201 .resource = i2c0_resources,
202 .num_resources = ARRAY_SIZE(i2c0_resources),
203 .dev = {
204 .platform_data = &i2c_platform_data,
205 },
206};
207
208static struct platform_device i2c1_device = {
209 .name = "i2c-sh_mobile",
210 .id = 1,
211 .resource = i2c1_resources,
212 .num_resources = ARRAY_SIZE(i2c1_resources),
213 .dev = {
214 .platform_data = &i2c_platform_data,
215 },
216};
217
218static struct platform_device i2c2_device = {
219 .name = "i2c-sh_mobile",
220 .id = 2,
221 .resource = i2c2_resources,
222 .num_resources = ARRAY_SIZE(i2c2_resources),
223 .dev = {
224 .platform_data = &i2c_platform_data,
225 },
226};
227
228static struct platform_device i2c3_device = {
229 .name = "i2c-sh_mobile",
230 .id = 3,
231 .resource = i2c3_resources,
232 .num_resources = ARRAY_SIZE(i2c3_resources),
233 .dev = {
234 .platform_data = &i2c_platform_data,
235 },
236};
237
238static struct platform_device i2c4_device = {
239 .name = "i2c-sh_mobile",
240 .id = 4,
241 .resource = i2c4_resources,
242 .num_resources = ARRAY_SIZE(i2c4_resources),
243 .dev = {
244 .platform_data = &i2c_platform_data,
245 },
246};
247
248static const struct sh_dmae_slave_config sh73a0_dmae_slaves[] = {
249 {
250 .slave_id = SHDMA_SLAVE_SCIF0_TX,
251 .addr = 0xe6c40020,
252 .chcr = CHCR_TX(XMIT_SZ_8BIT),
253 .mid_rid = 0x21,
254 }, {
255 .slave_id = SHDMA_SLAVE_SCIF0_RX,
256 .addr = 0xe6c40024,
257 .chcr = CHCR_RX(XMIT_SZ_8BIT),
258 .mid_rid = 0x22,
259 }, {
260 .slave_id = SHDMA_SLAVE_SCIF1_TX,
261 .addr = 0xe6c50020,
262 .chcr = CHCR_TX(XMIT_SZ_8BIT),
263 .mid_rid = 0x25,
264 }, {
265 .slave_id = SHDMA_SLAVE_SCIF1_RX,
266 .addr = 0xe6c50024,
267 .chcr = CHCR_RX(XMIT_SZ_8BIT),
268 .mid_rid = 0x26,
269 }, {
270 .slave_id = SHDMA_SLAVE_SCIF2_TX,
271 .addr = 0xe6c60020,
272 .chcr = CHCR_TX(XMIT_SZ_8BIT),
273 .mid_rid = 0x29,
274 }, {
275 .slave_id = SHDMA_SLAVE_SCIF2_RX,
276 .addr = 0xe6c60024,
277 .chcr = CHCR_RX(XMIT_SZ_8BIT),
278 .mid_rid = 0x2a,
279 }, {
280 .slave_id = SHDMA_SLAVE_SCIF3_TX,
281 .addr = 0xe6c70020,
282 .chcr = CHCR_TX(XMIT_SZ_8BIT),
283 .mid_rid = 0x2d,
284 }, {
285 .slave_id = SHDMA_SLAVE_SCIF3_RX,
286 .addr = 0xe6c70024,
287 .chcr = CHCR_RX(XMIT_SZ_8BIT),
288 .mid_rid = 0x2e,
289 }, {
290 .slave_id = SHDMA_SLAVE_SCIF4_TX,
291 .addr = 0xe6c80020,
292 .chcr = CHCR_TX(XMIT_SZ_8BIT),
293 .mid_rid = 0x39,
294 }, {
295 .slave_id = SHDMA_SLAVE_SCIF4_RX,
296 .addr = 0xe6c80024,
297 .chcr = CHCR_RX(XMIT_SZ_8BIT),
298 .mid_rid = 0x3a,
299 }, {
300 .slave_id = SHDMA_SLAVE_SCIF5_TX,
301 .addr = 0xe6cb0020,
302 .chcr = CHCR_TX(XMIT_SZ_8BIT),
303 .mid_rid = 0x35,
304 }, {
305 .slave_id = SHDMA_SLAVE_SCIF5_RX,
306 .addr = 0xe6cb0024,
307 .chcr = CHCR_RX(XMIT_SZ_8BIT),
308 .mid_rid = 0x36,
309 }, {
310 .slave_id = SHDMA_SLAVE_SCIF6_TX,
311 .addr = 0xe6cc0020,
312 .chcr = CHCR_TX(XMIT_SZ_8BIT),
313 .mid_rid = 0x1d,
314 }, {
315 .slave_id = SHDMA_SLAVE_SCIF6_RX,
316 .addr = 0xe6cc0024,
317 .chcr = CHCR_RX(XMIT_SZ_8BIT),
318 .mid_rid = 0x1e,
319 }, {
320 .slave_id = SHDMA_SLAVE_SCIF7_TX,
321 .addr = 0xe6cd0020,
322 .chcr = CHCR_TX(XMIT_SZ_8BIT),
323 .mid_rid = 0x19,
324 }, {
325 .slave_id = SHDMA_SLAVE_SCIF7_RX,
326 .addr = 0xe6cd0024,
327 .chcr = CHCR_RX(XMIT_SZ_8BIT),
328 .mid_rid = 0x1a,
329 }, {
330 .slave_id = SHDMA_SLAVE_SCIF8_TX,
331 .addr = 0xe6c30040,
332 .chcr = CHCR_TX(XMIT_SZ_8BIT),
333 .mid_rid = 0x3d,
334 }, {
335 .slave_id = SHDMA_SLAVE_SCIF8_RX,
336 .addr = 0xe6c30060,
337 .chcr = CHCR_RX(XMIT_SZ_8BIT),
338 .mid_rid = 0x3e,
339 }, {
340 .slave_id = SHDMA_SLAVE_SDHI0_TX,
341 .addr = 0xee100030,
342 .chcr = CHCR_TX(XMIT_SZ_16BIT),
343 .mid_rid = 0xc1,
344 }, {
345 .slave_id = SHDMA_SLAVE_SDHI0_RX,
346 .addr = 0xee100030,
347 .chcr = CHCR_RX(XMIT_SZ_16BIT),
348 .mid_rid = 0xc2,
349 }, {
350 .slave_id = SHDMA_SLAVE_SDHI1_TX,
351 .addr = 0xee120030,
352 .chcr = CHCR_TX(XMIT_SZ_16BIT),
353 .mid_rid = 0xc9,
354 }, {
355 .slave_id = SHDMA_SLAVE_SDHI1_RX,
356 .addr = 0xee120030,
357 .chcr = CHCR_RX(XMIT_SZ_16BIT),
358 .mid_rid = 0xca,
359 }, {
360 .slave_id = SHDMA_SLAVE_SDHI2_TX,
361 .addr = 0xee140030,
362 .chcr = CHCR_TX(XMIT_SZ_16BIT),
363 .mid_rid = 0xcd,
364 }, {
365 .slave_id = SHDMA_SLAVE_SDHI2_RX,
366 .addr = 0xee140030,
367 .chcr = CHCR_RX(XMIT_SZ_16BIT),
368 .mid_rid = 0xce,
369 }, {
370 .slave_id = SHDMA_SLAVE_MMCIF_TX,
371 .addr = 0xe6bd0034,
372 .chcr = CHCR_TX(XMIT_SZ_32BIT),
373 .mid_rid = 0xd1,
374 }, {
375 .slave_id = SHDMA_SLAVE_MMCIF_RX,
376 .addr = 0xe6bd0034,
377 .chcr = CHCR_RX(XMIT_SZ_32BIT),
378 .mid_rid = 0xd2,
379 },
380};
381
382#define DMAE_CHANNEL(_offset) \
383 { \
384 .offset = _offset - 0x20, \
385 .dmars = _offset - 0x20 + 0x40, \
386 }
387
388static const struct sh_dmae_channel sh73a0_dmae_channels[] = {
389 DMAE_CHANNEL(0x8000),
390 DMAE_CHANNEL(0x8080),
391 DMAE_CHANNEL(0x8100),
392 DMAE_CHANNEL(0x8180),
393 DMAE_CHANNEL(0x8200),
394 DMAE_CHANNEL(0x8280),
395 DMAE_CHANNEL(0x8300),
396 DMAE_CHANNEL(0x8380),
397 DMAE_CHANNEL(0x8400),
398 DMAE_CHANNEL(0x8480),
399 DMAE_CHANNEL(0x8500),
400 DMAE_CHANNEL(0x8580),
401 DMAE_CHANNEL(0x8600),
402 DMAE_CHANNEL(0x8680),
403 DMAE_CHANNEL(0x8700),
404 DMAE_CHANNEL(0x8780),
405 DMAE_CHANNEL(0x8800),
406 DMAE_CHANNEL(0x8880),
407 DMAE_CHANNEL(0x8900),
408 DMAE_CHANNEL(0x8980),
409};
410
411static struct sh_dmae_pdata sh73a0_dmae_platform_data = {
412 .slave = sh73a0_dmae_slaves,
413 .slave_num = ARRAY_SIZE(sh73a0_dmae_slaves),
414 .channel = sh73a0_dmae_channels,
415 .channel_num = ARRAY_SIZE(sh73a0_dmae_channels),
416 .ts_low_shift = TS_LOW_SHIFT,
417 .ts_low_mask = TS_LOW_BIT << TS_LOW_SHIFT,
418 .ts_high_shift = TS_HI_SHIFT,
419 .ts_high_mask = TS_HI_BIT << TS_HI_SHIFT,
420 .ts_shift = dma_ts_shift,
421 .ts_shift_num = ARRAY_SIZE(dma_ts_shift),
422 .dmaor_init = DMAOR_DME,
423};
424
425static struct resource sh73a0_dmae_resources[] = {
426 DEFINE_RES_MEM(0xfe000020, 0x89e0),
427 {
428 .name = "error_irq",
429 .start = gic_spi(129),
430 .end = gic_spi(129),
431 .flags = IORESOURCE_IRQ,
432 },
433 {
434 /* IRQ for channels 0-19 */
435 .start = gic_spi(109),
436 .end = gic_spi(128),
437 .flags = IORESOURCE_IRQ,
438 },
439};
440
441static struct platform_device dma0_device = {
442 .name = "sh-dma-engine",
443 .id = 0,
444 .resource = sh73a0_dmae_resources,
445 .num_resources = ARRAY_SIZE(sh73a0_dmae_resources),
446 .dev = {
447 .platform_data = &sh73a0_dmae_platform_data,
448 },
449};
450
451/* MPDMAC */
452static const struct sh_dmae_slave_config sh73a0_mpdma_slaves[] = {
453 {
454 .slave_id = SHDMA_SLAVE_FSI2A_RX,
455 .addr = 0xec230020,
456 .chcr = CHCR_RX(XMIT_SZ_32BIT),
457 .mid_rid = 0xd6, /* CHECK ME */
458 }, {
459 .slave_id = SHDMA_SLAVE_FSI2A_TX,
460 .addr = 0xec230024,
461 .chcr = CHCR_TX(XMIT_SZ_32BIT),
462 .mid_rid = 0xd5, /* CHECK ME */
463 }, {
464 .slave_id = SHDMA_SLAVE_FSI2C_RX,
465 .addr = 0xec230060,
466 .chcr = CHCR_RX(XMIT_SZ_32BIT),
467 .mid_rid = 0xda, /* CHECK ME */
468 }, {
469 .slave_id = SHDMA_SLAVE_FSI2C_TX,
470 .addr = 0xec230064,
471 .chcr = CHCR_TX(XMIT_SZ_32BIT),
472 .mid_rid = 0xd9, /* CHECK ME */
473 }, {
474 .slave_id = SHDMA_SLAVE_FSI2B_RX,
475 .addr = 0xec240020,
476 .chcr = CHCR_RX(XMIT_SZ_32BIT),
477 .mid_rid = 0x8e, /* CHECK ME */
478 }, {
479 .slave_id = SHDMA_SLAVE_FSI2B_TX,
480 .addr = 0xec240024,
481 .chcr = CHCR_RX(XMIT_SZ_32BIT),
482 .mid_rid = 0x8d, /* CHECK ME */
483 }, {
484 .slave_id = SHDMA_SLAVE_FSI2D_RX,
485 .addr = 0xec240060,
486 .chcr = CHCR_RX(XMIT_SZ_32BIT),
487 .mid_rid = 0x9a, /* CHECK ME */
488 },
489};
490
491#define MPDMA_CHANNEL(a, b, c) \
492{ \
493 .offset = a, \
494 .dmars = b, \
495 .dmars_bit = c, \
496 .chclr_offset = (0x220 - 0x20) + a \
497}
498
499static const struct sh_dmae_channel sh73a0_mpdma_channels[] = {
500 MPDMA_CHANNEL(0x00, 0, 0),
501 MPDMA_CHANNEL(0x10, 0, 8),
502 MPDMA_CHANNEL(0x20, 4, 0),
503 MPDMA_CHANNEL(0x30, 4, 8),
504 MPDMA_CHANNEL(0x50, 8, 0),
505 MPDMA_CHANNEL(0x70, 8, 8),
506};
507
508static struct sh_dmae_pdata sh73a0_mpdma_platform_data = {
509 .slave = sh73a0_mpdma_slaves,
510 .slave_num = ARRAY_SIZE(sh73a0_mpdma_slaves),
511 .channel = sh73a0_mpdma_channels,
512 .channel_num = ARRAY_SIZE(sh73a0_mpdma_channels),
513 .ts_low_shift = TS_LOW_SHIFT,
514 .ts_low_mask = TS_LOW_BIT << TS_LOW_SHIFT,
515 .ts_high_shift = TS_HI_SHIFT,
516 .ts_high_mask = TS_HI_BIT << TS_HI_SHIFT,
517 .ts_shift = dma_ts_shift,
518 .ts_shift_num = ARRAY_SIZE(dma_ts_shift),
519 .dmaor_init = DMAOR_DME,
520 .chclr_present = 1,
521};
522
523/* Resource order important! */
524static struct resource sh73a0_mpdma_resources[] = {
525 /* Channel registers and DMAOR */
526 DEFINE_RES_MEM(0xec618020, 0x270),
527 /* DMARSx */
528 DEFINE_RES_MEM(0xec619000, 0xc),
529 {
530 .name = "error_irq",
531 .start = gic_spi(181),
532 .end = gic_spi(181),
533 .flags = IORESOURCE_IRQ,
534 },
535 {
536 /* IRQ for channels 0-5 */
537 .start = gic_spi(175),
538 .end = gic_spi(180),
539 .flags = IORESOURCE_IRQ,
540 },
541};
542
543static struct platform_device mpdma0_device = {
544 .name = "sh-dma-engine",
545 .id = 1,
546 .resource = sh73a0_mpdma_resources,
547 .num_resources = ARRAY_SIZE(sh73a0_mpdma_resources),
548 .dev = {
549 .platform_data = &sh73a0_mpdma_platform_data,
550 },
551};
552
553static struct resource pmu_resources[] = {
554 [0] = {
555 .start = gic_spi(55),
556 .end = gic_spi(55),
557 .flags = IORESOURCE_IRQ,
558 },
559 [1] = {
560 .start = gic_spi(56),
561 .end = gic_spi(56),
562 .flags = IORESOURCE_IRQ,
563 },
564};
565
566static struct platform_device pmu_device = {
567 .name = "armv7-pmu",
568 .id = -1,
569 .num_resources = ARRAY_SIZE(pmu_resources),
570 .resource = pmu_resources,
571};
572
573/* an IPMMU module for ICB */
574static struct resource ipmmu_resources[] = {
575 DEFINE_RES_MEM(0xfe951000, 0x100),
576};
577
578static const char * const ipmmu_dev_names[] = {
579 "sh_mobile_lcdc_fb.0",
580};
581
582static struct shmobile_ipmmu_platform_data ipmmu_platform_data = {
583 .dev_names = ipmmu_dev_names,
584 .num_dev_names = ARRAY_SIZE(ipmmu_dev_names),
585};
586
587static struct platform_device ipmmu_device = {
588 .name = "ipmmu",
589 .id = -1,
590 .dev = {
591 .platform_data = &ipmmu_platform_data,
592 },
593 .resource = ipmmu_resources,
594 .num_resources = ARRAY_SIZE(ipmmu_resources),
595};
596
597static struct renesas_intc_irqpin_config irqpin0_platform_data = {
598 .irq_base = irq_pin(0), /* IRQ0 -> IRQ7 */
599 .control_parent = true,
600};
601
602static struct resource irqpin0_resources[] = {
603 DEFINE_RES_MEM(0xe6900000, 4), /* ICR1A */
604 DEFINE_RES_MEM(0xe6900010, 4), /* INTPRI00A */
605 DEFINE_RES_MEM(0xe6900020, 1), /* INTREQ00A */
606 DEFINE_RES_MEM(0xe6900040, 1), /* INTMSK00A */
607 DEFINE_RES_MEM(0xe6900060, 1), /* INTMSKCLR00A */
608 DEFINE_RES_IRQ(gic_spi(1)), /* IRQ0 */
609 DEFINE_RES_IRQ(gic_spi(2)), /* IRQ1 */
610 DEFINE_RES_IRQ(gic_spi(3)), /* IRQ2 */
611 DEFINE_RES_IRQ(gic_spi(4)), /* IRQ3 */
612 DEFINE_RES_IRQ(gic_spi(5)), /* IRQ4 */
613 DEFINE_RES_IRQ(gic_spi(6)), /* IRQ5 */
614 DEFINE_RES_IRQ(gic_spi(7)), /* IRQ6 */
615 DEFINE_RES_IRQ(gic_spi(8)), /* IRQ7 */
616};
617
618static struct platform_device irqpin0_device = {
619 .name = "renesas_intc_irqpin",
620 .id = 0,
621 .resource = irqpin0_resources,
622 .num_resources = ARRAY_SIZE(irqpin0_resources),
623 .dev = {
624 .platform_data = &irqpin0_platform_data,
625 },
626};
627
628static struct renesas_intc_irqpin_config irqpin1_platform_data = {
629 .irq_base = irq_pin(8), /* IRQ8 -> IRQ15 */
630 .control_parent = true, /* Disable spurious IRQ10 */
631};
632
633static struct resource irqpin1_resources[] = {
634 DEFINE_RES_MEM(0xe6900004, 4), /* ICR2A */
635 DEFINE_RES_MEM(0xe6900014, 4), /* INTPRI10A */
636 DEFINE_RES_MEM(0xe6900024, 1), /* INTREQ10A */
637 DEFINE_RES_MEM(0xe6900044, 1), /* INTMSK10A */
638 DEFINE_RES_MEM(0xe6900064, 1), /* INTMSKCLR10A */
639 DEFINE_RES_IRQ(gic_spi(9)), /* IRQ8 */
640 DEFINE_RES_IRQ(gic_spi(10)), /* IRQ9 */
641 DEFINE_RES_IRQ(gic_spi(11)), /* IRQ10 */
642 DEFINE_RES_IRQ(gic_spi(12)), /* IRQ11 */
643 DEFINE_RES_IRQ(gic_spi(13)), /* IRQ12 */
644 DEFINE_RES_IRQ(gic_spi(14)), /* IRQ13 */
645 DEFINE_RES_IRQ(gic_spi(15)), /* IRQ14 */
646 DEFINE_RES_IRQ(gic_spi(16)), /* IRQ15 */
647};
648
649static struct platform_device irqpin1_device = {
650 .name = "renesas_intc_irqpin",
651 .id = 1,
652 .resource = irqpin1_resources,
653 .num_resources = ARRAY_SIZE(irqpin1_resources),
654 .dev = {
655 .platform_data = &irqpin1_platform_data,
656 },
657};
658
659static struct renesas_intc_irqpin_config irqpin2_platform_data = {
660 .irq_base = irq_pin(16), /* IRQ16 -> IRQ23 */
661 .control_parent = true,
662};
663
664static struct resource irqpin2_resources[] = {
665 DEFINE_RES_MEM(0xe6900008, 4), /* ICR3A */
666 DEFINE_RES_MEM(0xe6900018, 4), /* INTPRI20A */
667 DEFINE_RES_MEM(0xe6900028, 1), /* INTREQ20A */
668 DEFINE_RES_MEM(0xe6900048, 1), /* INTMSK20A */
669 DEFINE_RES_MEM(0xe6900068, 1), /* INTMSKCLR20A */
670 DEFINE_RES_IRQ(gic_spi(17)), /* IRQ16 */
671 DEFINE_RES_IRQ(gic_spi(18)), /* IRQ17 */
672 DEFINE_RES_IRQ(gic_spi(19)), /* IRQ18 */
673 DEFINE_RES_IRQ(gic_spi(20)), /* IRQ19 */
674 DEFINE_RES_IRQ(gic_spi(21)), /* IRQ20 */
675 DEFINE_RES_IRQ(gic_spi(22)), /* IRQ21 */
676 DEFINE_RES_IRQ(gic_spi(23)), /* IRQ22 */
677 DEFINE_RES_IRQ(gic_spi(24)), /* IRQ23 */
678};
679
680static struct platform_device irqpin2_device = {
681 .name = "renesas_intc_irqpin",
682 .id = 2,
683 .resource = irqpin2_resources,
684 .num_resources = ARRAY_SIZE(irqpin2_resources),
685 .dev = {
686 .platform_data = &irqpin2_platform_data,
687 },
688};
689
690static struct renesas_intc_irqpin_config irqpin3_platform_data = {
691 .irq_base = irq_pin(24), /* IRQ24 -> IRQ31 */
692 .control_parent = true,
693};
694
695static struct resource irqpin3_resources[] = {
696 DEFINE_RES_MEM(0xe690000c, 4), /* ICR4A */
697 DEFINE_RES_MEM(0xe690001c, 4), /* INTPRI30A */
698 DEFINE_RES_MEM(0xe690002c, 1), /* INTREQ30A */
699 DEFINE_RES_MEM(0xe690004c, 1), /* INTMSK30A */
700 DEFINE_RES_MEM(0xe690006c, 1), /* INTMSKCLR30A */
701 DEFINE_RES_IRQ(gic_spi(25)), /* IRQ24 */
702 DEFINE_RES_IRQ(gic_spi(26)), /* IRQ25 */
703 DEFINE_RES_IRQ(gic_spi(27)), /* IRQ26 */
704 DEFINE_RES_IRQ(gic_spi(28)), /* IRQ27 */
705 DEFINE_RES_IRQ(gic_spi(29)), /* IRQ28 */
706 DEFINE_RES_IRQ(gic_spi(30)), /* IRQ29 */
707 DEFINE_RES_IRQ(gic_spi(31)), /* IRQ30 */
708 DEFINE_RES_IRQ(gic_spi(32)), /* IRQ31 */
709};
710
711static struct platform_device irqpin3_device = {
712 .name = "renesas_intc_irqpin",
713 .id = 3,
714 .resource = irqpin3_resources,
715 .num_resources = ARRAY_SIZE(irqpin3_resources),
716 .dev = {
717 .platform_data = &irqpin3_platform_data,
718 },
719};
720
721static struct platform_device *sh73a0_early_devices[] __initdata = {
722 &scif0_device,
723 &scif1_device,
724 &scif2_device,
725 &scif3_device,
726 &scif4_device,
727 &scif5_device,
728 &scif6_device,
729 &scif7_device,
730 &scif8_device,
731 &tmu0_device,
732 &ipmmu_device,
733 &cmt1_device,
734};
735
736static struct platform_device *sh73a0_late_devices[] __initdata = {
737 &i2c0_device,
738 &i2c1_device,
739 &i2c2_device,
740 &i2c3_device,
741 &i2c4_device,
742 &dma0_device,
743 &mpdma0_device,
744 &pmu_device,
745 &irqpin0_device,
746 &irqpin1_device,
747 &irqpin2_device,
748 &irqpin3_device,
749};
750
751#define SRCR2 IOMEM(0xe61580b0)
752
753void __init sh73a0_add_standard_devices(void)
754{
755 /* Clear software reset bit on SY-DMAC module */
756 __raw_writel(__raw_readl(SRCR2) & ~(1 << 18), SRCR2);
757
758 platform_add_devices(sh73a0_early_devices,
759 ARRAY_SIZE(sh73a0_early_devices));
760 platform_add_devices(sh73a0_late_devices,
761 ARRAY_SIZE(sh73a0_late_devices));
762}
763
764/* do nothing for !CONFIG_SMP or !CONFIG_HAVE_TWD */
765void __init __weak sh73a0_register_twd(void) { }
766
767void __init sh73a0_earlytimer_init(void)
768{
769 shmobile_init_delay();
770#ifndef CONFIG_COMMON_CLK
771 sh73a0_clock_init();
772#endif
773 shmobile_earlytimer_init();
774 sh73a0_register_twd();
775}
776
777void __init sh73a0_add_early_devices(void)
778{
779 early_platform_add_devices(sh73a0_early_devices,
780 ARRAY_SIZE(sh73a0_early_devices));
781
782 /* setup early console here as well */
783 shmobile_setup_console();
784}
785
786#ifdef CONFIG_USE_OF
787
788static void __init sh73a0_generic_init(void) 52static void __init sh73a0_generic_init(void)
789{ 53{
790#ifdef CONFIG_CACHE_L2X0 54#ifdef CONFIG_CACHE_L2X0
@@ -794,7 +58,7 @@ static void __init sh73a0_generic_init(void)
794 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 58 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
795} 59}
796 60
797static const char *sh73a0_boards_compat_dt[] __initdata = { 61static const char *const sh73a0_boards_compat_dt[] __initconst = {
798 "renesas,sh73a0", 62 "renesas,sh73a0",
799 NULL, 63 NULL,
800}; 64};
@@ -807,4 +71,3 @@ DT_MACHINE_START(SH73A0_DT, "Generic SH73A0 (Flattened Device Tree)")
807 .init_late = shmobile_init_late, 71 .init_late = shmobile_init_late,
808 .dt_compat = sh73a0_boards_compat_dt, 72 .dt_compat = sh73a0_boards_compat_dt,
809MACHINE_END 73MACHINE_END
810#endif /* CONFIG_USE_OF */
diff --git a/arch/arm/mach-shmobile/sh73a0.h b/arch/arm/mach-shmobile/sh73a0.h
index 5a80f18b4fa0..39646806cf64 100644
--- a/arch/arm/mach-shmobile/sh73a0.h
+++ b/arch/arm/mach-shmobile/sh73a0.h
@@ -1,89 +1,6 @@
1#ifndef __ASM_SH73A0_H__ 1#ifndef __ASM_SH73A0_H__
2#define __ASM_SH73A0_H__ 2#define __ASM_SH73A0_H__
3 3
4/* DMA slave IDs */
5enum {
6 SHDMA_SLAVE_INVALID,
7 SHDMA_SLAVE_SCIF0_TX,
8 SHDMA_SLAVE_SCIF0_RX,
9 SHDMA_SLAVE_SCIF1_TX,
10 SHDMA_SLAVE_SCIF1_RX,
11 SHDMA_SLAVE_SCIF2_TX,
12 SHDMA_SLAVE_SCIF2_RX,
13 SHDMA_SLAVE_SCIF3_TX,
14 SHDMA_SLAVE_SCIF3_RX,
15 SHDMA_SLAVE_SCIF4_TX,
16 SHDMA_SLAVE_SCIF4_RX,
17 SHDMA_SLAVE_SCIF5_TX,
18 SHDMA_SLAVE_SCIF5_RX,
19 SHDMA_SLAVE_SCIF6_TX,
20 SHDMA_SLAVE_SCIF6_RX,
21 SHDMA_SLAVE_SCIF7_TX,
22 SHDMA_SLAVE_SCIF7_RX,
23 SHDMA_SLAVE_SCIF8_TX,
24 SHDMA_SLAVE_SCIF8_RX,
25 SHDMA_SLAVE_SDHI0_TX,
26 SHDMA_SLAVE_SDHI0_RX,
27 SHDMA_SLAVE_SDHI1_TX,
28 SHDMA_SLAVE_SDHI1_RX,
29 SHDMA_SLAVE_SDHI2_TX,
30 SHDMA_SLAVE_SDHI2_RX,
31 SHDMA_SLAVE_MMCIF_TX,
32 SHDMA_SLAVE_MMCIF_RX,
33 SHDMA_SLAVE_FSI2A_TX,
34 SHDMA_SLAVE_FSI2A_RX,
35 SHDMA_SLAVE_FSI2B_TX,
36 SHDMA_SLAVE_FSI2B_RX,
37 SHDMA_SLAVE_FSI2C_TX,
38 SHDMA_SLAVE_FSI2C_RX,
39 SHDMA_SLAVE_FSI2D_RX,
40};
41
42/*
43 * SH73A0 IRQ LOCATION TABLE
44 *
45 * 416 -----------------------------------------
46 * IRQ0-IRQ15
47 * 431 -----------------------------------------
48 * ...
49 * 448 -----------------------------------------
50 * sh73a0-intcs
51 * sh73a0-intca-irq-pins
52 * 680 -----------------------------------------
53 * ...
54 * 700 -----------------------------------------
55 * sh73a0-pint0
56 * 731 -----------------------------------------
57 * 732 -----------------------------------------
58 * sh73a0-pint1
59 * 739 -----------------------------------------
60 * ...
61 * 800 -----------------------------------------
62 * IRQ16-IRQ31
63 * 815 -----------------------------------------
64 * ...
65 * 928 -----------------------------------------
66 * sh73a0-intca-irq-pins
67 * 943 -----------------------------------------
68 */
69
70/* PINT interrupts are located at Linux IRQ 700 and up */
71#define SH73A0_PINT0_IRQ(irq) ((irq) + 700)
72#define SH73A0_PINT1_IRQ(irq) ((irq) + 732)
73
74extern void sh73a0_init_irq(void);
75extern void sh73a0_init_irq_dt(void);
76extern void sh73a0_map_io(void);
77extern void sh73a0_earlytimer_init(void);
78extern void sh73a0_add_early_devices(void);
79extern void sh73a0_add_standard_devices(void);
80extern void sh73a0_clock_init(void);
81extern void sh73a0_pinmux_init(void);
82extern void sh73a0_pm_init(void);
83extern struct clk sh73a0_extal1_clk;
84extern struct clk sh73a0_extal2_clk;
85extern struct clk sh73a0_extcki_clk;
86extern struct clk sh73a0_extalr_clk;
87extern struct smp_operations sh73a0_smp_ops; 4extern struct smp_operations sh73a0_smp_ops;
88 5
89#endif /* __ASM_SH73A0_H__ */ 6#endif /* __ASM_SH73A0_H__ */
diff --git a/arch/arm/mach-shmobile/smp-r8a7779.c b/arch/arm/mach-shmobile/smp-r8a7779.c
index 01f792fcb220..353562b8a5ee 100644
--- a/arch/arm/mach-shmobile/smp-r8a7779.c
+++ b/arch/arm/mach-shmobile/smp-r8a7779.c
@@ -23,7 +23,6 @@
23#include <asm/cacheflush.h> 23#include <asm/cacheflush.h>
24#include <asm/smp_plat.h> 24#include <asm/smp_plat.h>
25#include <asm/smp_scu.h> 25#include <asm/smp_scu.h>
26#include <asm/smp_twd.h>
27 26
28#include "common.h" 27#include "common.h"
29#include "pm-rcar.h" 28#include "pm-rcar.h"
@@ -32,41 +31,33 @@
32#define AVECR IOMEM(0xfe700040) 31#define AVECR IOMEM(0xfe700040)
33#define R8A7779_SCU_BASE 0xf0000000 32#define R8A7779_SCU_BASE 0xf0000000
34 33
35static struct rcar_sysc_ch r8a7779_ch_cpu1 = { 34static const struct rcar_sysc_ch r8a7779_ch_cpu1 = {
36 .chan_offs = 0x40, /* PWRSR0 .. PWRER0 */ 35 .chan_offs = 0x40, /* PWRSR0 .. PWRER0 */
37 .chan_bit = 1, /* ARM1 */ 36 .chan_bit = 1, /* ARM1 */
38 .isr_bit = 1, /* ARM1 */ 37 .isr_bit = 1, /* ARM1 */
39}; 38};
40 39
41static struct rcar_sysc_ch r8a7779_ch_cpu2 = { 40static const struct rcar_sysc_ch r8a7779_ch_cpu2 = {
42 .chan_offs = 0x40, /* PWRSR0 .. PWRER0 */ 41 .chan_offs = 0x40, /* PWRSR0 .. PWRER0 */
43 .chan_bit = 2, /* ARM2 */ 42 .chan_bit = 2, /* ARM2 */
44 .isr_bit = 2, /* ARM2 */ 43 .isr_bit = 2, /* ARM2 */
45}; 44};
46 45
47static struct rcar_sysc_ch r8a7779_ch_cpu3 = { 46static const struct rcar_sysc_ch r8a7779_ch_cpu3 = {
48 .chan_offs = 0x40, /* PWRSR0 .. PWRER0 */ 47 .chan_offs = 0x40, /* PWRSR0 .. PWRER0 */
49 .chan_bit = 3, /* ARM3 */ 48 .chan_bit = 3, /* ARM3 */
50 .isr_bit = 3, /* ARM3 */ 49 .isr_bit = 3, /* ARM3 */
51}; 50};
52 51
53static struct rcar_sysc_ch *r8a7779_ch_cpu[4] = { 52static const struct rcar_sysc_ch * const r8a7779_ch_cpu[4] = {
54 [1] = &r8a7779_ch_cpu1, 53 [1] = &r8a7779_ch_cpu1,
55 [2] = &r8a7779_ch_cpu2, 54 [2] = &r8a7779_ch_cpu2,
56 [3] = &r8a7779_ch_cpu3, 55 [3] = &r8a7779_ch_cpu3,
57}; 56};
58 57
59#if defined(CONFIG_HAVE_ARM_TWD) && !defined(CONFIG_ARCH_MULTIPLATFORM)
60static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, R8A7779_SCU_BASE + 0x600, 29);
61void __init r8a7779_register_twd(void)
62{
63 twd_local_timer_register(&twd_local_timer);
64}
65#endif
66
67static int r8a7779_platform_cpu_kill(unsigned int cpu) 58static int r8a7779_platform_cpu_kill(unsigned int cpu)
68{ 59{
69 struct rcar_sysc_ch *ch = NULL; 60 const struct rcar_sysc_ch *ch = NULL;
70 int ret = -EIO; 61 int ret = -EIO;
71 62
72 cpu = cpu_logical_map(cpu); 63 cpu = cpu_logical_map(cpu);
@@ -82,7 +73,7 @@ static int r8a7779_platform_cpu_kill(unsigned int cpu)
82 73
83static int r8a7779_boot_secondary(unsigned int cpu, struct task_struct *idle) 74static int r8a7779_boot_secondary(unsigned int cpu, struct task_struct *idle)
84{ 75{
85 struct rcar_sysc_ch *ch = NULL; 76 const struct rcar_sysc_ch *ch = NULL;
86 unsigned int lcpu = cpu_logical_map(cpu); 77 unsigned int lcpu = cpu_logical_map(cpu);
87 int ret; 78 int ret;
88 79
diff --git a/arch/arm/mach-shmobile/smp-r8a7790.c b/arch/arm/mach-shmobile/smp-r8a7790.c
index 930f45cbc08a..2ef0054ce934 100644
--- a/arch/arm/mach-shmobile/smp-r8a7790.c
+++ b/arch/arm/mach-shmobile/smp-r8a7790.c
@@ -26,12 +26,12 @@
26#include "rcar-gen2.h" 26#include "rcar-gen2.h"
27#include "r8a7790.h" 27#include "r8a7790.h"
28 28
29static struct rcar_sysc_ch r8a7790_ca15_scu = { 29static const struct rcar_sysc_ch r8a7790_ca15_scu = {
30 .chan_offs = 0x180, /* PWRSR5 .. PWRER5 */ 30 .chan_offs = 0x180, /* PWRSR5 .. PWRER5 */
31 .isr_bit = 12, /* CA15-SCU */ 31 .isr_bit = 12, /* CA15-SCU */
32}; 32};
33 33
34static struct rcar_sysc_ch r8a7790_ca7_scu = { 34static const struct rcar_sysc_ch r8a7790_ca7_scu = {
35 .chan_offs = 0x100, /* PWRSR3 .. PWRER3 */ 35 .chan_offs = 0x100, /* PWRSR3 .. PWRER3 */
36 .isr_bit = 21, /* CA7-SCU */ 36 .isr_bit = 21, /* CA7-SCU */
37}; 37};
diff --git a/arch/arm/mach-shmobile/smp-sh73a0.c b/arch/arm/mach-shmobile/smp-sh73a0.c
index 2106d6b76a06..d03aa11fb46d 100644
--- a/arch/arm/mach-shmobile/smp-sh73a0.c
+++ b/arch/arm/mach-shmobile/smp-sh73a0.c
@@ -33,14 +33,6 @@
33 33
34#define SH73A0_SCU_BASE 0xf0000000 34#define SH73A0_SCU_BASE 0xf0000000
35 35
36#if defined(CONFIG_HAVE_ARM_TWD) && !defined(CONFIG_ARCH_MULTIPLATFORM)
37static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, SH73A0_SCU_BASE + 0x600, 29);
38void __init sh73a0_register_twd(void)
39{
40 twd_local_timer_register(&twd_local_timer);
41}
42#endif
43
44static int sh73a0_boot_secondary(unsigned int cpu, struct task_struct *idle) 36static int sh73a0_boot_secondary(unsigned int cpu, struct task_struct *idle)
45{ 37{
46 unsigned int lcpu = cpu_logical_map(cpu); 38 unsigned int lcpu = cpu_logical_map(cpu);
diff --git a/arch/arm/mach-shmobile/timer.c b/arch/arm/mach-shmobile/timer.c
index 0edf2a6d2bbe..f1d027aa7a81 100644
--- a/arch/arm/mach-shmobile/timer.c
+++ b/arch/arm/mach-shmobile/timer.c
@@ -70,18 +70,6 @@ void __init shmobile_init_delay(void)
70 if (!max_freq) 70 if (!max_freq)
71 return; 71 return;
72 72
73#ifdef CONFIG_ARCH_SHMOBILE_LEGACY
74 /* Non-multiplatform r8a73a4 SoC cannot use arch timer due
75 * to GIC being initialized from C and arch timer via DT */
76 if (of_machine_is_compatible("renesas,r8a73a4"))
77 has_arch_timer = false;
78
79 /* Non-multiplatform r8a7790 SoC cannot use arch timer due
80 * to GIC being initialized from C and arch timer via DT */
81 if (of_machine_is_compatible("renesas,r8a7790"))
82 has_arch_timer = false;
83#endif
84
85 if (!has_arch_timer || !IS_ENABLED(CONFIG_ARM_ARCH_TIMER)) { 73 if (!has_arch_timer || !IS_ENABLED(CONFIG_ARM_ARCH_TIMER)) {
86 if (is_a7_a8_a9) 74 if (is_a7_a8_a9)
87 shmobile_setup_delay_hz(max_freq, 1, 3); 75 shmobile_setup_delay_hz(max_freq, 1, 3);
diff --git a/arch/arm/mach-spear/time.c b/arch/arm/mach-spear/time.c
index 26fda4ed4d51..9ccffc1d0f28 100644
--- a/arch/arm/mach-spear/time.c
+++ b/arch/arm/mach-spear/time.c
@@ -66,8 +66,6 @@
66static __iomem void *gpt_base; 66static __iomem void *gpt_base;
67static struct clk *gpt_clk; 67static struct clk *gpt_clk;
68 68
69static void clockevent_set_mode(enum clock_event_mode mode,
70 struct clock_event_device *clk_event_dev);
71static int clockevent_next_event(unsigned long evt, 69static int clockevent_next_event(unsigned long evt,
72 struct clock_event_device *clk_event_dev); 70 struct clock_event_device *clk_event_dev);
73 71
@@ -95,54 +93,67 @@ static void __init spear_clocksource_init(void)
95 200, 16, clocksource_mmio_readw_up); 93 200, 16, clocksource_mmio_readw_up);
96} 94}
97 95
98static struct clock_event_device clkevt = { 96static inline void timer_shutdown(struct clock_event_device *evt)
99 .name = "tmr0", 97{
100 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, 98 u16 val = readw(gpt_base + CR(CLKEVT));
101 .set_mode = clockevent_set_mode, 99
102 .set_next_event = clockevent_next_event, 100 /* stop the timer */
103 .shift = 0, /* to be computed */ 101 val &= ~CTRL_ENABLE;
104}; 102 writew(val, gpt_base + CR(CLKEVT));
103}
104
105static int spear_shutdown(struct clock_event_device *evt)
106{
107 timer_shutdown(evt);
108
109 return 0;
110}
111
112static int spear_set_oneshot(struct clock_event_device *evt)
113{
114 u16 val;
105 115
106static void clockevent_set_mode(enum clock_event_mode mode, 116 /* stop the timer */
107 struct clock_event_device *clk_event_dev) 117 timer_shutdown(evt);
118
119 val = readw(gpt_base + CR(CLKEVT));
120 val |= CTRL_ONE_SHOT;
121 writew(val, gpt_base + CR(CLKEVT));
122
123 return 0;
124}
125
126static int spear_set_periodic(struct clock_event_device *evt)
108{ 127{
109 u32 period; 128 u32 period;
110 u16 val; 129 u16 val;
111 130
112 /* stop the timer */ 131 /* stop the timer */
132 timer_shutdown(evt);
133
134 period = clk_get_rate(gpt_clk) / HZ;
135 period >>= CTRL_PRESCALER16;
136 writew(period, gpt_base + LOAD(CLKEVT));
137
113 val = readw(gpt_base + CR(CLKEVT)); 138 val = readw(gpt_base + CR(CLKEVT));
114 val &= ~CTRL_ENABLE; 139 val &= ~CTRL_ONE_SHOT;
140 val |= CTRL_ENABLE | CTRL_INT_ENABLE;
115 writew(val, gpt_base + CR(CLKEVT)); 141 writew(val, gpt_base + CR(CLKEVT));
116 142
117 switch (mode) { 143 return 0;
118 case CLOCK_EVT_MODE_PERIODIC:
119 period = clk_get_rate(gpt_clk) / HZ;
120 period >>= CTRL_PRESCALER16;
121 writew(period, gpt_base + LOAD(CLKEVT));
122
123 val = readw(gpt_base + CR(CLKEVT));
124 val &= ~CTRL_ONE_SHOT;
125 val |= CTRL_ENABLE | CTRL_INT_ENABLE;
126 writew(val, gpt_base + CR(CLKEVT));
127
128 break;
129 case CLOCK_EVT_MODE_ONESHOT:
130 val = readw(gpt_base + CR(CLKEVT));
131 val |= CTRL_ONE_SHOT;
132 writew(val, gpt_base + CR(CLKEVT));
133
134 break;
135 case CLOCK_EVT_MODE_UNUSED:
136 case CLOCK_EVT_MODE_SHUTDOWN:
137 case CLOCK_EVT_MODE_RESUME:
138
139 break;
140 default:
141 pr_err("Invalid mode requested\n");
142 break;
143 }
144} 144}
145 145
146static struct clock_event_device clkevt = {
147 .name = "tmr0",
148 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
149 .set_state_shutdown = spear_shutdown,
150 .set_state_periodic = spear_set_periodic,
151 .set_state_oneshot = spear_set_oneshot,
152 .tick_resume = spear_shutdown,
153 .set_next_event = clockevent_next_event,
154 .shift = 0, /* to be computed */
155};
156
146static int clockevent_next_event(unsigned long cycles, 157static int clockevent_next_event(unsigned long cycles,
147 struct clock_event_device *clk_event_dev) 158 struct clock_event_device *clk_event_dev)
148{ 159{
@@ -193,7 +204,7 @@ static void __init spear_clockevent_init(int irq)
193 setup_irq(irq, &spear_timer_irq); 204 setup_irq(irq, &spear_timer_irq);
194} 205}
195 206
196const static struct of_device_id timer_of_match[] __initconst = { 207static const struct of_device_id const timer_of_match[] __initconst = {
197 { .compatible = "st,spear-timer", }, 208 { .compatible = "st,spear-timer", },
198 { }, 209 { },
199}; 210};
diff --git a/arch/arm/mach-sti/board-dt.c b/arch/arm/mach-sti/board-dt.c
index b373acade338..ae10fb280a78 100644
--- a/arch/arm/mach-sti/board-dt.c
+++ b/arch/arm/mach-sti/board-dt.c
@@ -14,7 +14,7 @@
14 14
15#include "smp.h" 15#include "smp.h"
16 16
17static const char *stih41x_dt_match[] __initdata = { 17static const char *const stih41x_dt_match[] __initconst = {
18 "st,stih415", 18 "st,stih415",
19 "st,stih416", 19 "st,stih416",
20 "st,stih407", 20 "st,stih407",
diff --git a/arch/arm/mach-ux500/Makefile b/arch/arm/mach-ux500/Makefile
index 4418a5078833..c8643ac5db71 100644
--- a/arch/arm/mach-ux500/Makefile
+++ b/arch/arm/mach-ux500/Makefile
@@ -7,7 +7,7 @@ obj-$(CONFIG_CACHE_L2X0) += cache-l2x0.o
7obj-$(CONFIG_UX500_SOC_DB8500) += cpu-db8500.o 7obj-$(CONFIG_UX500_SOC_DB8500) += cpu-db8500.o
8obj-$(CONFIG_MACH_MOP500) += board-mop500-regulators.o \ 8obj-$(CONFIG_MACH_MOP500) += board-mop500-regulators.o \
9 board-mop500-audio.o 9 board-mop500-audio.o
10obj-$(CONFIG_SMP) += platsmp.o headsmp.o 10obj-$(CONFIG_SMP) += platsmp.o
11obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o 11obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
12obj-$(CONFIG_PM_GENERIC_DOMAINS) += pm_domains.o 12obj-$(CONFIG_PM_GENERIC_DOMAINS) += pm_domains.o
13 13
diff --git a/arch/arm/mach-ux500/cpu-db8500.c b/arch/arm/mach-ux500/cpu-db8500.c
index 16913800bbf9..ba708ce08616 100644
--- a/arch/arm/mach-ux500/cpu-db8500.c
+++ b/arch/arm/mach-ux500/cpu-db8500.c
@@ -154,7 +154,6 @@ static const char * stericsson_dt_platform_compat[] = {
154}; 154};
155 155
156DT_MACHINE_START(U8500_DT, "ST-Ericsson Ux5x0 platform (Device Tree Support)") 156DT_MACHINE_START(U8500_DT, "ST-Ericsson Ux5x0 platform (Device Tree Support)")
157 .smp = smp_ops(ux500_smp_ops),
158 .map_io = u8500_map_io, 157 .map_io = u8500_map_io,
159 .init_irq = ux500_init_irq, 158 .init_irq = ux500_init_irq,
160 /* we re-use nomadik timer here */ 159 /* we re-use nomadik timer here */
diff --git a/arch/arm/mach-ux500/headsmp.S b/arch/arm/mach-ux500/headsmp.S
deleted file mode 100644
index 9cdea049485d..000000000000
--- a/arch/arm/mach-ux500/headsmp.S
+++ /dev/null
@@ -1,37 +0,0 @@
1/*
2 * Copyright (c) 2009 ST-Ericsson
3 * This file is based ARM Realview platform
4 * Copyright (c) 2003 ARM Limited
5 * All Rights Reserved
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 version 2 as
9 * published by the Free Software Foundation.
10 */
11#include <linux/linkage.h>
12#include <linux/init.h>
13
14/*
15 * U8500 specific entry point for secondary CPUs.
16 */
17ENTRY(u8500_secondary_startup)
18 mrc p15, 0, r0, c0, c0, 5
19 and r0, r0, #15
20 adr r4, 1f
21 ldmia r4, {r5, r6}
22 sub r4, r4, r5
23 add r6, r6, r4
24pen: ldr r7, [r6]
25 cmp r7, r0
26 bne pen
27
28 /*
29 * we've been released from the holding pen: secondary_stack
30 * should now contain the SVC stack for this core
31 */
32 b secondary_startup
33ENDPROC(u8500_secondary_startup)
34
35 .align 2
361: .long .
37 .long pen_release
diff --git a/arch/arm/mach-ux500/platsmp.c b/arch/arm/mach-ux500/platsmp.c
index 62b1de922bd8..70766b963758 100644
--- a/arch/arm/mach-ux500/platsmp.c
+++ b/arch/arm/mach-ux500/platsmp.c
@@ -28,135 +28,81 @@
28#include "db8500-regs.h" 28#include "db8500-regs.h"
29#include "id.h" 29#include "id.h"
30 30
31static void __iomem *scu_base; 31/* Magic triggers in backup RAM */
32static void __iomem *backupram; 32#define UX500_CPU1_JUMPADDR_OFFSET 0x1FF4
33 33#define UX500_CPU1_WAKEMAGIC_OFFSET 0x1FF0
34/* This is called from headsmp.S to wakeup the secondary core */
35extern void u8500_secondary_startup(void);
36
37/*
38 * Write pen_release in a way that is guaranteed to be visible to all
39 * observers, irrespective of whether they're taking part in coherency
40 * or not. This is necessary for the hotplug code to work reliably.
41 */
42static void write_pen_release(int val)
43{
44 pen_release = val;
45 smp_wmb();
46 sync_cache_w(&pen_release);
47}
48
49static DEFINE_SPINLOCK(boot_lock);
50
51static void ux500_secondary_init(unsigned int cpu)
52{
53 /*
54 * let the primary processor know we're out of the
55 * pen, then head off into the C entry point
56 */
57 write_pen_release(-1);
58
59 /*
60 * Synchronise with the boot thread.
61 */
62 spin_lock(&boot_lock);
63 spin_unlock(&boot_lock);
64}
65 34
66static int ux500_boot_secondary(unsigned int cpu, struct task_struct *idle) 35static void wakeup_secondary(void)
67{ 36{
68 unsigned long timeout; 37 struct device_node *np;
69 38 static void __iomem *backupram;
70 /*
71 * set synchronisation state between this boot processor
72 * and the secondary one
73 */
74 spin_lock(&boot_lock);
75
76 /*
77 * The secondary processor is waiting to be released from
78 * the holding pen - release it, then wait for it to flag
79 * that it has been released by resetting pen_release.
80 */
81 write_pen_release(cpu_logical_map(cpu));
82
83 arch_send_wakeup_ipi_mask(cpumask_of(cpu));
84 39
85 timeout = jiffies + (1 * HZ); 40 np = of_find_compatible_node(NULL, NULL, "ste,dbx500-backupram");
86 while (time_before(jiffies, timeout)) { 41 if (!np) {
87 if (pen_release == -1) 42 pr_err("No backupram base address\n");
88 break; 43 return;
44 }
45 backupram = of_iomap(np, 0);
46 of_node_put(np);
47 if (!backupram) {
48 pr_err("No backupram remap\n");
49 return;
89 } 50 }
90 51
91 /* 52 /*
92 * now the secondary core is starting up let it run its
93 * calibrations, then wait for it to finish
94 */
95 spin_unlock(&boot_lock);
96
97 return pen_release != -1 ? -ENOSYS : 0;
98}
99
100static void __init wakeup_secondary(void)
101{
102 /*
103 * write the address of secondary startup into the backup ram register 53 * write the address of secondary startup into the backup ram register
104 * at offset 0x1FF4, then write the magic number 0xA1FEED01 to the 54 * at offset 0x1FF4, then write the magic number 0xA1FEED01 to the
105 * backup ram register at offset 0x1FF0, which is what boot rom code 55 * backup ram register at offset 0x1FF0, which is what boot rom code
106 * is waiting for. This would wake up the secondary core from WFE 56 * is waiting for. This will wake up the secondary core from WFE.
107 */ 57 */
108#define UX500_CPU1_JUMPADDR_OFFSET 0x1FF4 58 writel(virt_to_phys(secondary_startup),
109 __raw_writel(virt_to_phys(u8500_secondary_startup), 59 backupram + UX500_CPU1_JUMPADDR_OFFSET);
110 backupram + UX500_CPU1_JUMPADDR_OFFSET); 60 writel(0xA1FEED01,
111 61 backupram + UX500_CPU1_WAKEMAGIC_OFFSET);
112#define UX500_CPU1_WAKEMAGIC_OFFSET 0x1FF0
113 __raw_writel(0xA1FEED01,
114 backupram + UX500_CPU1_WAKEMAGIC_OFFSET);
115 62
116 /* make sure write buffer is drained */ 63 /* make sure write buffer is drained */
117 mb(); 64 mb();
65 iounmap(backupram);
118} 66}
119 67
120/* 68static void __init ux500_smp_prepare_cpus(unsigned int max_cpus)
121 * Initialise the CPU possible map early - this describes the CPUs
122 * which may be present or become present in the system.
123 */
124static void __init ux500_smp_init_cpus(void)
125{ 69{
126 unsigned int i, ncores;
127 struct device_node *np; 70 struct device_node *np;
71 static void __iomem *scu_base;
72 unsigned int ncores;
73 int i;
128 74
129 np = of_find_compatible_node(NULL, NULL, "arm,cortex-a9-scu"); 75 np = of_find_compatible_node(NULL, NULL, "arm,cortex-a9-scu");
76 if (!np) {
77 pr_err("No SCU base address\n");
78 return;
79 }
130 scu_base = of_iomap(np, 0); 80 scu_base = of_iomap(np, 0);
131 of_node_put(np); 81 of_node_put(np);
132 if (!scu_base) 82 if (!scu_base) {
83 pr_err("No SCU remap\n");
133 return; 84 return;
134 backupram = ioremap(U8500_BACKUPRAM0_BASE, SZ_8K);
135 ncores = scu_get_core_count(scu_base);
136
137 /* sanity check */
138 if (ncores > nr_cpu_ids) {
139 pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
140 ncores, nr_cpu_ids);
141 ncores = nr_cpu_ids;
142 } 85 }
143 86
87 scu_enable(scu_base);
88 ncores = scu_get_core_count(scu_base);
144 for (i = 0; i < ncores; i++) 89 for (i = 0; i < ncores; i++)
145 set_cpu_possible(i, true); 90 set_cpu_possible(i, true);
91 iounmap(scu_base);
146} 92}
147 93
148static void __init ux500_smp_prepare_cpus(unsigned int max_cpus) 94static int ux500_boot_secondary(unsigned int cpu, struct task_struct *idle)
149{ 95{
150 scu_enable(scu_base);
151 wakeup_secondary(); 96 wakeup_secondary();
97 arch_send_wakeup_ipi_mask(cpumask_of(cpu));
98 return 0;
152} 99}
153 100
154struct smp_operations ux500_smp_ops __initdata = { 101struct smp_operations ux500_smp_ops __initdata = {
155 .smp_init_cpus = ux500_smp_init_cpus,
156 .smp_prepare_cpus = ux500_smp_prepare_cpus, 102 .smp_prepare_cpus = ux500_smp_prepare_cpus,
157 .smp_secondary_init = ux500_secondary_init,
158 .smp_boot_secondary = ux500_boot_secondary, 103 .smp_boot_secondary = ux500_boot_secondary,
159#ifdef CONFIG_HOTPLUG_CPU 104#ifdef CONFIG_HOTPLUG_CPU
160 .cpu_die = ux500_cpu_die, 105 .cpu_die = ux500_cpu_die,
161#endif 106#endif
162}; 107};
108CPU_METHOD_OF_DECLARE(ux500_smp, "ste,dbx500-smp", &ux500_smp_ops);
diff --git a/arch/arm/mach-ux500/setup.h b/arch/arm/mach-ux500/setup.h
index 1fb6ad2789f1..65876eac0761 100644
--- a/arch/arm/mach-ux500/setup.h
+++ b/arch/arm/mach-ux500/setup.h
@@ -26,7 +26,6 @@ extern struct device *ux500_soc_device_init(const char *soc_id);
26 26
27extern void ux500_timer_init(void); 27extern void ux500_timer_init(void);
28 28
29extern struct smp_operations ux500_smp_ops;
30extern void ux500_cpu_die(unsigned int cpu); 29extern void ux500_cpu_die(unsigned int cpu);
31 30
32#endif /* __ASM_ARCH_SETUP_H */ 31#endif /* __ASM_ARCH_SETUP_H */
diff --git a/arch/arm/mach-w90x900/irq.c b/arch/arm/mach-w90x900/irq.c
index d66d43ae8df5..491b317daffa 100644
--- a/arch/arm/mach-w90x900/irq.c
+++ b/arch/arm/mach-w90x900/irq.c
@@ -211,6 +211,6 @@ void __init nuc900_init_irq(void)
211 for (irqno = IRQ_WDT; irqno <= IRQ_ADC; irqno++) { 211 for (irqno = IRQ_WDT; irqno <= IRQ_ADC; irqno++) {
212 irq_set_chip_and_handler(irqno, &nuc900_irq_chip, 212 irq_set_chip_and_handler(irqno, &nuc900_irq_chip,
213 handle_level_irq); 213 handle_level_irq);
214 set_irq_flags(irqno, IRQF_VALID); 214 irq_clear_status_flags(irqno, IRQ_NOREQUEST);
215 } 215 }
216} 216}
diff --git a/arch/arm/mach-w90x900/time.c b/arch/arm/mach-w90x900/time.c
index 9230d3725599..cd1966ec9143 100644
--- a/arch/arm/mach-w90x900/time.c
+++ b/arch/arm/mach-w90x900/time.c
@@ -48,31 +48,32 @@
48 48
49static unsigned int timer0_load; 49static unsigned int timer0_load;
50 50
51static void nuc900_clockevent_setmode(enum clock_event_mode mode, 51static int nuc900_clockevent_shutdown(struct clock_event_device *evt)
52 struct clock_event_device *clk)
53{ 52{
54 unsigned int val; 53 unsigned int val = __raw_readl(REG_TCSR0) & ~(0x03 << 27);
55 54
56 val = __raw_readl(REG_TCSR0); 55 __raw_writel(val, REG_TCSR0);
57 val &= ~(0x03 << 27); 56 return 0;
57}
58
59static int nuc900_clockevent_set_oneshot(struct clock_event_device *evt)
60{
61 unsigned int val = __raw_readl(REG_TCSR0) & ~(0x03 << 27);
58 62
59 switch (mode) { 63 val |= (ONESHOT | COUNTEN | INTEN | PRESCALE);
60 case CLOCK_EVT_MODE_PERIODIC:
61 __raw_writel(timer0_load, REG_TICR0);
62 val |= (PERIOD | COUNTEN | INTEN | PRESCALE);
63 break;
64 64
65 case CLOCK_EVT_MODE_ONESHOT: 65 __raw_writel(val, REG_TCSR0);
66 val |= (ONESHOT | COUNTEN | INTEN | PRESCALE); 66 return 0;
67 break; 67}
68 68
69 case CLOCK_EVT_MODE_UNUSED: 69static int nuc900_clockevent_set_periodic(struct clock_event_device *evt)
70 case CLOCK_EVT_MODE_SHUTDOWN: 70{
71 case CLOCK_EVT_MODE_RESUME: 71 unsigned int val = __raw_readl(REG_TCSR0) & ~(0x03 << 27);
72 break;
73 }
74 72
73 __raw_writel(timer0_load, REG_TICR0);
74 val |= (PERIOD | COUNTEN | INTEN | PRESCALE);
75 __raw_writel(val, REG_TCSR0); 75 __raw_writel(val, REG_TCSR0);
76 return 0;
76} 77}
77 78
78static int nuc900_clockevent_setnextevent(unsigned long evt, 79static int nuc900_clockevent_setnextevent(unsigned long evt,
@@ -90,11 +91,15 @@ static int nuc900_clockevent_setnextevent(unsigned long evt,
90} 91}
91 92
92static struct clock_event_device nuc900_clockevent_device = { 93static struct clock_event_device nuc900_clockevent_device = {
93 .name = "nuc900-timer0", 94 .name = "nuc900-timer0",
94 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, 95 .features = CLOCK_EVT_FEAT_PERIODIC |
95 .set_mode = nuc900_clockevent_setmode, 96 CLOCK_EVT_FEAT_ONESHOT,
96 .set_next_event = nuc900_clockevent_setnextevent, 97 .set_state_shutdown = nuc900_clockevent_shutdown,
97 .rating = 300, 98 .set_state_periodic = nuc900_clockevent_set_periodic,
99 .set_state_oneshot = nuc900_clockevent_set_oneshot,
100 .tick_resume = nuc900_clockevent_shutdown,
101 .set_next_event = nuc900_clockevent_setnextevent,
102 .rating = 300,
98}; 103};
99 104
100/*IRQ handler for the timer*/ 105/*IRQ handler for the timer*/
diff --git a/arch/arm/mach-zx/zx296702.c b/arch/arm/mach-zx/zx296702.c
index 60bb1a8e1bf1..a041e13ab0ac 100644
--- a/arch/arm/mach-zx/zx296702.c
+++ b/arch/arm/mach-zx/zx296702.c
@@ -13,7 +13,7 @@
13#include <linux/of_address.h> 13#include <linux/of_address.h>
14#include <linux/of_platform.h> 14#include <linux/of_platform.h>
15 15
16static const char *zx296702_dt_compat[] __initconst = { 16static const char *const zx296702_dt_compat[] __initconst = {
17 "zte,zx296702", 17 "zte,zx296702",
18 NULL, 18 NULL,
19}; 19};
diff --git a/arch/arm/plat-iop/time.c b/arch/arm/plat-iop/time.c
index 6ad65d8ae237..101e8f2c7abe 100644
--- a/arch/arm/plat-iop/time.c
+++ b/arch/arm/plat-iop/time.c
@@ -77,41 +77,57 @@ static int iop_set_next_event(unsigned long delta,
77 77
78static unsigned long ticks_per_jiffy; 78static unsigned long ticks_per_jiffy;
79 79
80static void iop_set_mode(enum clock_event_mode mode, 80static int iop_set_periodic(struct clock_event_device *evt)
81 struct clock_event_device *unused)
82{ 81{
83 u32 tmr = read_tmr0(); 82 u32 tmr = read_tmr0();
84 83
85 switch (mode) { 84 write_tmr0(tmr & ~IOP_TMR_EN);
86 case CLOCK_EVT_MODE_PERIODIC: 85 write_tcr0(ticks_per_jiffy - 1);
87 write_tmr0(tmr & ~IOP_TMR_EN); 86 write_trr0(ticks_per_jiffy - 1);
88 write_tcr0(ticks_per_jiffy - 1); 87 tmr |= (IOP_TMR_RELOAD | IOP_TMR_EN);
89 write_trr0(ticks_per_jiffy - 1);
90 tmr |= (IOP_TMR_RELOAD | IOP_TMR_EN);
91 break;
92 case CLOCK_EVT_MODE_ONESHOT:
93 /* ->set_next_event sets period and enables timer */
94 tmr &= ~(IOP_TMR_RELOAD | IOP_TMR_EN);
95 break;
96 case CLOCK_EVT_MODE_RESUME:
97 tmr |= IOP_TMR_EN;
98 break;
99 case CLOCK_EVT_MODE_SHUTDOWN:
100 case CLOCK_EVT_MODE_UNUSED:
101 default:
102 tmr &= ~IOP_TMR_EN;
103 break;
104 }
105 88
106 write_tmr0(tmr); 89 write_tmr0(tmr);
90 return 0;
91}
92
93static int iop_set_oneshot(struct clock_event_device *evt)
94{
95 u32 tmr = read_tmr0();
96
97 /* ->set_next_event sets period and enables timer */
98 tmr &= ~(IOP_TMR_RELOAD | IOP_TMR_EN);
99 write_tmr0(tmr);
100 return 0;
101}
102
103static int iop_shutdown(struct clock_event_device *evt)
104{
105 u32 tmr = read_tmr0();
106
107 tmr &= ~IOP_TMR_EN;
108 write_tmr0(tmr);
109 return 0;
110}
111
112static int iop_resume(struct clock_event_device *evt)
113{
114 u32 tmr = read_tmr0();
115
116 tmr |= IOP_TMR_EN;
117 write_tmr0(tmr);
118 return 0;
107} 119}
108 120
109static struct clock_event_device iop_clockevent = { 121static struct clock_event_device iop_clockevent = {
110 .name = "iop_timer0", 122 .name = "iop_timer0",
111 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, 123 .features = CLOCK_EVT_FEAT_PERIODIC |
112 .rating = 300, 124 CLOCK_EVT_FEAT_ONESHOT,
113 .set_next_event = iop_set_next_event, 125 .rating = 300,
114 .set_mode = iop_set_mode, 126 .set_next_event = iop_set_next_event,
127 .set_state_shutdown = iop_shutdown,
128 .set_state_periodic = iop_set_periodic,
129 .tick_resume = iop_resume,
130 .set_state_oneshot = iop_set_oneshot,
115}; 131};
116 132
117static irqreturn_t 133static irqreturn_t
diff --git a/arch/arm/plat-orion/gpio.c b/arch/arm/plat-orion/gpio.c
index 5168a52a17f9..79c33eca09a3 100644
--- a/arch/arm/plat-orion/gpio.c
+++ b/arch/arm/plat-orion/gpio.c
@@ -407,9 +407,9 @@ static int gpio_irq_set_type(struct irq_data *d, u32 type)
407 return 0; 407 return 0;
408} 408}
409 409
410static void gpio_irq_handler(unsigned irq, struct irq_desc *desc) 410static void gpio_irq_handler(unsigned __irq, struct irq_desc *desc)
411{ 411{
412 struct orion_gpio_chip *ochip = irq_get_handler_data(irq); 412 struct orion_gpio_chip *ochip = irq_desc_get_handler_data(desc);
413 u32 cause, type; 413 u32 cause, type;
414 int i; 414 int i;
415 415
@@ -582,8 +582,9 @@ void __init orion_gpio_init(struct device_node *np,
582 582
583 for (i = 0; i < 4; i++) { 583 for (i = 0; i < 4; i++) {
584 if (irqs[i]) { 584 if (irqs[i]) {
585 irq_set_handler_data(irqs[i], ochip); 585 irq_set_chained_handler_and_data(irqs[i],
586 irq_set_chained_handler(irqs[i], gpio_irq_handler); 586 gpio_irq_handler,
587 ochip);
587 } 588 }
588 } 589 }
589 590
diff --git a/arch/arm/plat-orion/time.c b/arch/arm/plat-orion/time.c
index 261258f717fc..8085a8aac812 100644
--- a/arch/arm/plat-orion/time.c
+++ b/arch/arm/plat-orion/time.c
@@ -106,60 +106,63 @@ orion_clkevt_next_event(unsigned long delta, struct clock_event_device *dev)
106 return 0; 106 return 0;
107} 107}
108 108
109static void 109static int orion_clkevt_shutdown(struct clock_event_device *evt)
110orion_clkevt_mode(enum clock_event_mode mode, struct clock_event_device *dev)
111{ 110{
112 unsigned long flags; 111 unsigned long flags;
113 u32 u; 112 u32 u;
114 113
115 local_irq_save(flags); 114 local_irq_save(flags);
116 if (mode == CLOCK_EVT_MODE_PERIODIC) { 115
117 /* 116 /* Disable timer */
118 * Setup timer to fire at 1/HZ intervals. 117 u = readl(timer_base + TIMER_CTRL_OFF);
119 */ 118 writel(u & ~TIMER1_EN, timer_base + TIMER_CTRL_OFF);
120 writel(ticks_per_jiffy - 1, timer_base + TIMER1_RELOAD_OFF); 119
121 writel(ticks_per_jiffy - 1, timer_base + TIMER1_VAL_OFF); 120 /* Disable timer interrupt */
122 121 u = readl(bridge_base + BRIDGE_MASK_OFF);
123 /* 122 writel(u & ~BRIDGE_INT_TIMER1, bridge_base + BRIDGE_MASK_OFF);
124 * Enable timer interrupt. 123
125 */ 124 /* ACK pending timer interrupt */
126 u = readl(bridge_base + BRIDGE_MASK_OFF); 125 writel(bridge_timer1_clr_mask, bridge_base + BRIDGE_CAUSE_OFF);
127 writel(u | BRIDGE_INT_TIMER1, bridge_base + BRIDGE_MASK_OFF); 126
128 127 local_irq_restore(flags);
129 /* 128
130 * Enable timer. 129 return 0;
131 */ 130}
132 u = readl(timer_base + TIMER_CTRL_OFF); 131
133 writel(u | TIMER1_EN | TIMER1_RELOAD_EN, 132static int orion_clkevt_set_periodic(struct clock_event_device *evt)
134 timer_base + TIMER_CTRL_OFF); 133{
135 } else { 134 unsigned long flags;
136 /* 135 u32 u;
137 * Disable timer. 136
138 */ 137 local_irq_save(flags);
139 u = readl(timer_base + TIMER_CTRL_OFF); 138
140 writel(u & ~TIMER1_EN, timer_base + TIMER_CTRL_OFF); 139 /* Setup timer to fire at 1/HZ intervals */
141 140 writel(ticks_per_jiffy - 1, timer_base + TIMER1_RELOAD_OFF);
142 /* 141 writel(ticks_per_jiffy - 1, timer_base + TIMER1_VAL_OFF);
143 * Disable timer interrupt. 142
144 */ 143 /* Enable timer interrupt */
145 u = readl(bridge_base + BRIDGE_MASK_OFF); 144 u = readl(bridge_base + BRIDGE_MASK_OFF);
146 writel(u & ~BRIDGE_INT_TIMER1, bridge_base + BRIDGE_MASK_OFF); 145 writel(u | BRIDGE_INT_TIMER1, bridge_base + BRIDGE_MASK_OFF);
147 146
148 /* 147 /* Enable timer */
149 * ACK pending timer interrupt. 148 u = readl(timer_base + TIMER_CTRL_OFF);
150 */ 149 writel(u | TIMER1_EN | TIMER1_RELOAD_EN, timer_base + TIMER_CTRL_OFF);
151 writel(bridge_timer1_clr_mask, bridge_base + BRIDGE_CAUSE_OFF); 150
152
153 }
154 local_irq_restore(flags); 151 local_irq_restore(flags);
152
153 return 0;
155} 154}
156 155
157static struct clock_event_device orion_clkevt = { 156static struct clock_event_device orion_clkevt = {
158 .name = "orion_tick", 157 .name = "orion_tick",
159 .features = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_PERIODIC, 158 .features = CLOCK_EVT_FEAT_ONESHOT |
160 .rating = 300, 159 CLOCK_EVT_FEAT_PERIODIC,
161 .set_next_event = orion_clkevt_next_event, 160 .rating = 300,
162 .set_mode = orion_clkevt_mode, 161 .set_next_event = orion_clkevt_next_event,
162 .set_state_shutdown = orion_clkevt_shutdown,
163 .set_state_periodic = orion_clkevt_set_periodic,
164 .set_state_oneshot = orion_clkevt_shutdown,
165 .tick_resume = orion_clkevt_shutdown,
163}; 166};
164 167
165static irqreturn_t orion_timer_interrupt(int irq, void *dev_id) 168static irqreturn_t orion_timer_interrupt(int irq, void *dev_id)
diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig
index cb8e3d655d1a..57729b915003 100644
--- a/arch/arm/plat-samsung/Kconfig
+++ b/arch/arm/plat-samsung/Kconfig
@@ -217,12 +217,6 @@ config SAMSUNG_DEV_PWM
217 help 217 help
218 Compile in platform device definition for PWM Timer 218 Compile in platform device definition for PWM Timer
219 219
220config SAMSUNG_DEV_BACKLIGHT
221 bool
222 depends on SAMSUNG_DEV_PWM
223 help
224 Compile in platform device definition LCD backlight with PWM Timer
225
226config S3C24XX_PWM 220config S3C24XX_PWM
227 bool "PWM device support" 221 bool "PWM device support"
228 select PWM 222 select PWM
@@ -231,25 +225,14 @@ config S3C24XX_PWM
231 Support for exporting the PWM timer blocks via the pwm device 225 Support for exporting the PWM timer blocks via the pwm device
232 system 226 system
233 227
234config S3C_SETUP_CAMIF
235 bool
236 help
237 Compile in common setup code for S3C CAMIF devices
238
239config SAMSUNG_PM_GPIO 228config SAMSUNG_PM_GPIO
240 bool 229 bool
241 default y if GPIO_SAMSUNG && PM 230 default y if GPIO_SAMSUNG && PM
242 help 231 help
243 Include legacy GPIO power management code for platforms not using 232 Include legacy GPIO power management code for platforms not using
244 pinctrl-samsung driver. 233 pinctrl-samsung driver.
245
246endif 234endif
247 235
248config S5P_DEV_MFC
249 bool
250 help
251 Compile in setup memory (init) code for MFC
252
253comment "Power management" 236comment "Power management"
254 237
255config SAMSUNG_PM_DEBUG 238config SAMSUNG_PM_DEBUG
diff --git a/arch/arm/plat-samsung/Makefile b/arch/arm/plat-samsung/Makefile
index 1a29ab1f446d..8c911760f55f 100644
--- a/arch/arm/plat-samsung/Makefile
+++ b/arch/arm/plat-samsung/Makefile
@@ -20,11 +20,6 @@ obj-$(CONFIG_SAMSUNG_ATAGS) += platformdata.o
20 20
21obj-$(CONFIG_SAMSUNG_ATAGS) += devs.o 21obj-$(CONFIG_SAMSUNG_ATAGS) += devs.o
22obj-$(CONFIG_SAMSUNG_ATAGS) += dev-uart.o 22obj-$(CONFIG_SAMSUNG_ATAGS) += dev-uart.o
23obj-$(CONFIG_S5P_DEV_MFC) += s5p-dev-mfc.o
24
25obj-$(CONFIG_SAMSUNG_DEV_BACKLIGHT) += dev-backlight.o
26
27obj-$(CONFIG_S3C_SETUP_CAMIF) += setup-camif.o
28 23
29# PM support 24# PM support
30 25
diff --git a/arch/arm/plat-samsung/include/plat/keypad-core.h b/arch/arm/plat-samsung/include/plat/keypad-core.h
deleted file mode 100644
index d513e1b3a31e..000000000000
--- a/arch/arm/plat-samsung/include/plat/keypad-core.h
+++ /dev/null
@@ -1,31 +0,0 @@
1/*
2 * linux/arch/arm/plat-samsung/include/plat/keypad-core.h
3 *
4 * Copyright (C) 2010 Samsung Electronics Co.Ltd
5 * Author: Joonyoung Shim <jy0922.shim@samsung.com>
6 *
7 * Samsung keypad controller core function
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 *
14 */
15
16#ifndef __ASM_ARCH_KEYPAD_CORE_H
17#define __ASM_ARCH_KEYPAD_CORE_H
18
19/* These function are only for use with the core support code, such as
20 * the cpu specific initialisation code
21 */
22
23/* re-define device name depending on support. */
24static inline void samsung_keypad_setname(char *name)
25{
26#ifdef CONFIG_SAMSUNG_DEV_KEYPAD
27 samsung_device_keypad.name = name;
28#endif
29}
30
31#endif /* __ASM_ARCH_KEYPAD_CORE_H */
diff --git a/drivers/irqchip/irq-sa11x0.c b/drivers/irqchip/irq-sa11x0.c
index 46df2875dc1c..61bb28d7b19b 100644
--- a/drivers/irqchip/irq-sa11x0.c
+++ b/drivers/irqchip/irq-sa11x0.c
@@ -70,7 +70,6 @@ static int sa1100_normal_irqdomain_map(struct irq_domain *d,
70{ 70{
71 irq_set_chip_and_handler(irq, &sa1100_normal_chip, 71 irq_set_chip_and_handler(irq, &sa1100_normal_chip,
72 handle_level_irq); 72 handle_level_irq);
73 set_irq_flags(irq, IRQF_VALID);
74 73
75 return 0; 74 return 0;
76} 75}
diff --git a/drivers/video/fbdev/ep93xx-fb.c b/drivers/video/fbdev/ep93xx-fb.c
index 7ec251cc9c03..5b1081030cbb 100644
--- a/drivers/video/fbdev/ep93xx-fb.c
+++ b/drivers/video/fbdev/ep93xx-fb.c
@@ -419,36 +419,15 @@ static struct fb_ops ep93xxfb_ops = {
419 .fb_mmap = ep93xxfb_mmap, 419 .fb_mmap = ep93xxfb_mmap,
420}; 420};
421 421
422static int ep93xxfb_calc_fbsize(struct ep93xxfb_mach_info *mach_info)
423{
424 int i, fb_size = 0;
425
426 if (mach_info->num_modes == EP93XXFB_USE_MODEDB) {
427 fb_size = EP93XXFB_MAX_XRES * EP93XXFB_MAX_YRES *
428 mach_info->bpp / 8;
429 } else {
430 for (i = 0; i < mach_info->num_modes; i++) {
431 const struct fb_videomode *mode;
432 int size;
433
434 mode = &mach_info->modes[i];
435 size = mode->xres * mode->yres * mach_info->bpp / 8;
436 if (size > fb_size)
437 fb_size = size;
438 }
439 }
440
441 return fb_size;
442}
443
444static int ep93xxfb_alloc_videomem(struct fb_info *info) 422static int ep93xxfb_alloc_videomem(struct fb_info *info)
445{ 423{
446 struct ep93xx_fbi *fbi = info->par;
447 char __iomem *virt_addr; 424 char __iomem *virt_addr;
448 dma_addr_t phys_addr; 425 dma_addr_t phys_addr;
449 unsigned int fb_size; 426 unsigned int fb_size;
450 427
451 fb_size = ep93xxfb_calc_fbsize(fbi->mach_info); 428 /* Maximum 16bpp -> used memory is maximum x*y*2 bytes */
429 fb_size = EP93XXFB_MAX_XRES * EP93XXFB_MAX_YRES * 2;
430
452 virt_addr = dma_alloc_writecombine(info->dev, fb_size, 431 virt_addr = dma_alloc_writecombine(info->dev, fb_size,
453 &phys_addr, GFP_KERNEL); 432 &phys_addr, GFP_KERNEL);
454 if (!virt_addr) 433 if (!virt_addr)
@@ -550,8 +529,7 @@ static int ep93xxfb_probe(struct platform_device *pdev)
550 529
551 fb_get_options("ep93xx-fb", &video_mode); 530 fb_get_options("ep93xx-fb", &video_mode);
552 err = fb_find_mode(&info->var, info, video_mode, 531 err = fb_find_mode(&info->var, info, video_mode,
553 fbi->mach_info->modes, fbi->mach_info->num_modes, 532 NULL, 0, NULL, 16);
554 fbi->mach_info->default_mode, fbi->mach_info->bpp);
555 if (err == 0) { 533 if (err == 0) {
556 dev_err(info->dev, "No suitable video mode found\n"); 534 dev_err(info->dev, "No suitable video mode found\n");
557 err = -EINVAL; 535 err = -EINVAL;
diff --git a/include/linux/platform_data/video-ep93xx.h b/include/linux/platform_data/video-ep93xx.h
index 92fc2b2232e7..699ac4109366 100644
--- a/include/linux/platform_data/video-ep93xx.h
+++ b/include/linux/platform_data/video-ep93xx.h
@@ -2,11 +2,8 @@
2#define __VIDEO_EP93XX_H 2#define __VIDEO_EP93XX_H
3 3
4struct platform_device; 4struct platform_device;
5struct fb_videomode;
6struct fb_info; 5struct fb_info;
7 6
8#define EP93XXFB_USE_MODEDB 0
9
10/* VideoAttributes flags */ 7/* VideoAttributes flags */
11#define EP93XXFB_STATE_MACHINE_ENABLE (1 << 0) 8#define EP93XXFB_STATE_MACHINE_ENABLE (1 << 0)
12#define EP93XXFB_PIXEL_CLOCK_ENABLE (1 << 1) 9#define EP93XXFB_PIXEL_CLOCK_ENABLE (1 << 1)
@@ -38,12 +35,7 @@ struct fb_info;
38 EP93XXFB_PIXEL_DATA_ENABLE) 35 EP93XXFB_PIXEL_DATA_ENABLE)
39 36
40struct ep93xxfb_mach_info { 37struct ep93xxfb_mach_info {
41 unsigned int num_modes;
42 const struct fb_videomode *modes;
43 const struct fb_videomode *default_mode;
44 int bpp;
45 unsigned int flags; 38 unsigned int flags;
46
47 int (*setup)(struct platform_device *pdev); 39 int (*setup)(struct platform_device *pdev);
48 void (*teardown)(struct platform_device *pdev); 40 void (*teardown)(struct platform_device *pdev);
49 void (*blank)(int blank_mode, struct fb_info *info); 41 void (*blank)(int blank_mode, struct fb_info *info);