aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2012-10-26 09:54:14 -0400
committerArnd Bergmann <arnd@arndb.de>2012-10-26 09:54:14 -0400
commit148a8698763130c96004ef419b5f0d44a93d413c (patch)
tree48a3ea5484e3fc9e485d7bb1b0e3d8795c67d368 /arch
parentddffeb8c4d0331609ef2581d84de4d763607bd37 (diff)
parente4c060db2c13f10de09101afc564763f9fd0019a (diff)
Merge tag 'omap-for-v3.8/cleanup-headers-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap into next/headers
From Tony Lindgren <tony@atomide.com>: This is the first set of omap cleanup patches for v3.8 merge window to remove most of the remaining plat includes to get us closer to ARM common zImage support. To avoid a huge amount of trivial merge conflicts with includes, this branch is based on several small topic branches coordinated with the driver subsystem maintainers. These branches are based on v3.7-rc1 and can also be merged into the related driver subsystem branches as needed: omap-for-v3.8/cleanup-headers-prepare few trivial driver changes omap-for-v3.8/cleanup-headers-dma move of the DMA header omap-for-v3.8/cleanup-headers-gpmc GPMC and MTD changes omap-for-v3.8/cleanup-headers-mmc MMC related changes omap-for-v3.8/cleanup-headers-dss DSS related changes omap-for-v3.8/cleanup-headers-asoc ASoC related changes Note that for the dma-omap.h, it was decided that it should be is completed. For the related discussion, please see: https://patchwork.kernel.org/patch/1519591/# After these patches we still have a few plat headers remaining that will be handled in later pull requests. * tag 'omap-for-v3.8/cleanup-headers-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap: (58 commits) ARM: OMAP: Split plat/cpu.h into local soc.h for mach-omap1 and mach-omap2 ARM: OMAP: clock: split plat/clkdev_omap.h into OMAP1/2 files ARM: OMAP: remove plat/clock.h ARM: OMAP: duplicate plat-omap/clock.c into mach-omap[12]/clock.c ARM: OMAP: Move plat/omap-secure.h locally to mach-omap2 ARM: OMAP2+: Move omap_reserve() locally to mach-omap2 ARM: OMAP1: Remove omap_reserve() callback for all omap1 boards ARM: OMAP: Make plat/omap-pm.h local to mach-omap2 ARM: OMAP: Merge plat/multi.h into plat/cpu.h ARM: OMAP: Make plat/omap_hwmod.h local to mach-omap2 ARM: OMAP: Make omap_device local to mach-omap2 ARM: OMAP: Make plat/sram.h local to plat-omap ARM: OMAP: Move plat/led.h to include/linux/platform_data ARM: OMAP: Make plat/common.h local to mach-omap1 and mach-omap2 ARM: OMAP: Split plat-omap/i2c.c into mach-omap1 and mach-omap2 ARM: OMAP2+: Make board-zoom.h local ARM: OMAP1: Move plat/tc.h to mach/tc.h for omap1 ARM: OMAP: Make plat/fpga.h local to arch/arm/plat-omap ARM: OMAP: move plat-omap/include/plat/sdrc.h into mach-omap2/sdrc.h OMAPFB: use omap_vrfb_supported() ... Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-omap1/board-ams-delta.c1
-rw-r--r--arch/arm/mach-omap1/board-fsample.c9
-rw-r--r--arch/arm/mach-omap1/board-generic.c1
-rw-r--r--arch/arm/mach-omap1/board-h2-mmc.c5
-rw-r--r--arch/arm/mach-omap1/board-h2.c6
-rw-r--r--arch/arm/mach-omap1/board-h3-mmc.c3
-rw-r--r--arch/arm/mach-omap1/board-h3.c5
-rw-r--r--arch/arm/mach-omap1/board-htcherald.c3
-rw-r--r--arch/arm/mach-omap1/board-innovator.c31
-rw-r--r--arch/arm/mach-omap1/board-nokia770.c5
-rw-r--r--arch/arm/mach-omap1/board-osk.c3
-rw-r--r--arch/arm/mach-omap1/board-palmte.c6
-rw-r--r--arch/arm/mach-omap1/board-palmtt.c8
-rw-r--r--arch/arm/mach-omap1/board-palmz71.c6
-rw-r--r--arch/arm/mach-omap1/board-perseus2.c9
-rw-r--r--arch/arm/mach-omap1/board-sx1-mmc.c3
-rw-r--r--arch/arm/mach-omap1/board-sx1.c6
-rw-r--r--arch/arm/mach-omap1/board-voiceblue.c3
-rw-r--r--arch/arm/mach-omap1/clock.c506
-rw-r--r--arch/arm/mach-omap1/clock.h178
-rw-r--r--arch/arm/mach-omap1/clock_data.c17
-rw-r--r--arch/arm/mach-omap1/common.h6
-rw-r--r--arch/arm/mach-omap1/devices.c15
-rw-r--r--arch/arm/mach-omap1/dma.c6
-rw-r--r--arch/arm/mach-omap1/dma.h83
-rw-r--r--arch/arm/mach-omap1/flash.c2
-rw-r--r--arch/arm/mach-omap1/fpga.c2
-rw-r--r--arch/arm/mach-omap1/i2c.c61
-rw-r--r--arch/arm/mach-omap1/id.c2
-rw-r--r--arch/arm/mach-omap1/include/mach/hardware.h4
-rw-r--r--arch/arm/mach-omap1/include/mach/memory.h2
-rw-r--r--arch/arm/mach-omap1/include/mach/omap1510.h113
-rw-r--r--arch/arm/mach-omap1/include/mach/tc.h (renamed from arch/arm/plat-omap/include/plat/tc.h)0
-rw-r--r--arch/arm/mach-omap1/io.c4
-rw-r--r--arch/arm/mach-omap1/irq.c2
-rw-r--r--arch/arm/mach-omap1/lcd_dma.c4
-rw-r--r--arch/arm/mach-omap1/mcbsp.c5
-rw-r--r--arch/arm/mach-omap1/mmc.h18
-rw-r--r--arch/arm/mach-omap1/opp_data.c2
-rw-r--r--arch/arm/mach-omap1/pm.c10
-rw-r--r--arch/arm/mach-omap1/pm_bus.c3
-rw-r--r--arch/arm/mach-omap1/serial.c1
-rw-r--r--arch/arm/mach-omap1/soc.h229
-rw-r--r--arch/arm/mach-omap2/Makefile3
-rw-r--r--arch/arm/mach-omap2/am35xx-emac.c2
-rw-r--r--arch/arm/mach-omap2/board-2430sdp.c2
-rw-r--r--arch/arm/mach-omap2/board-3430sdp.c5
-rw-r--r--arch/arm/mach-omap2/board-3630sdp.c2
-rw-r--r--arch/arm/mach-omap2/board-4430sdp.c2
-rw-r--r--arch/arm/mach-omap2/board-apollon.c4
-rw-r--r--arch/arm/mach-omap2/board-cm-t35.c5
-rw-r--r--arch/arm/mach-omap2/board-cm-t3517.c5
-rw-r--r--arch/arm/mach-omap2/board-devkit8000.c10
-rw-r--r--arch/arm/mach-omap2/board-flash.c52
-rw-r--r--arch/arm/mach-omap2/board-flash.h8
-rw-r--r--arch/arm/mach-omap2/board-h4.c4
-rw-r--r--arch/arm/mach-omap2/board-igep0020.c5
-rw-r--r--arch/arm/mach-omap2/board-ldp.c8
-rw-r--r--arch/arm/mach-omap2/board-n8x0.c3
-rw-r--r--arch/arm/mach-omap2/board-omap3beagle.c13
-rw-r--r--arch/arm/mach-omap2/board-omap3evm.c9
-rw-r--r--arch/arm/mach-omap2/board-omap3logic.c5
-rw-r--r--arch/arm/mach-omap2/board-omap3pandora.c3
-rw-r--r--arch/arm/mach-omap2/board-omap3stalker.c2
-rw-r--r--arch/arm/mach-omap2/board-omap3touchbook.c10
-rw-r--r--arch/arm/mach-omap2/board-omap4panda.c2
-rw-r--r--arch/arm/mach-omap2/board-overo.c9
-rw-r--r--arch/arm/mach-omap2/board-rm680.c6
-rw-r--r--arch/arm/mach-omap2/board-rx51-peripherals.c7
-rw-r--r--arch/arm/mach-omap2/board-rx51.c6
-rw-r--r--arch/arm/mach-omap2/board-zoom-debugboard.c4
-rw-r--r--arch/arm/mach-omap2/board-zoom-display.c3
-rw-r--r--arch/arm/mach-omap2/board-zoom-peripherals.c2
-rw-r--r--arch/arm/mach-omap2/board-zoom.c7
-rw-r--r--arch/arm/mach-omap2/board-zoom.h (renamed from arch/arm/mach-omap2/include/mach/board-zoom.h)0
-rw-r--r--arch/arm/mach-omap2/clkt2xxx_apll.c1
-rw-r--r--arch/arm/mach-omap2/clkt2xxx_dpll.c2
-rw-r--r--arch/arm/mach-omap2/clkt2xxx_dpllcore.c5
-rw-r--r--arch/arm/mach-omap2/clkt2xxx_osc.c2
-rw-r--r--arch/arm/mach-omap2/clkt2xxx_sys.c2
-rw-r--r--arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c5
-rw-r--r--arch/arm/mach-omap2/clkt34xx_dpll3m2.c4
-rw-r--r--arch/arm/mach-omap2/clkt_clksel.c2
-rw-r--r--arch/arm/mach-omap2/clkt_dpll.c2
-rw-r--r--arch/arm/mach-omap2/clkt_iclk.c1
-rw-r--r--arch/arm/mach-omap2/clock.c518
-rw-r--r--arch/arm/mach-omap2/clock.h317
-rw-r--r--arch/arm/mach-omap2/clock2420_data.c4
-rw-r--r--arch/arm/mach-omap2/clock2430.c2
-rw-r--r--arch/arm/mach-omap2/clock2430_data.c4
-rw-r--r--arch/arm/mach-omap2/clock2xxx.c2
-rw-r--r--arch/arm/mach-omap2/clock33xx_data.c5
-rw-r--r--arch/arm/mach-omap2/clock34xx.c2
-rw-r--r--arch/arm/mach-omap2/clock3517.c2
-rw-r--r--arch/arm/mach-omap2/clock36xx.c2
-rw-r--r--arch/arm/mach-omap2/clock3xxx.c2
-rw-r--r--arch/arm/mach-omap2/clock3xxx_data.c4
-rw-r--r--arch/arm/mach-omap2/clock44xx_data.c4
-rw-r--r--arch/arm/mach-omap2/clockdomain.c3
-rw-r--r--arch/arm/mach-omap2/clockdomain.h5
-rw-r--r--arch/arm/mach-omap2/clockdomain2xxx_3xxx.c2
-rw-r--r--arch/arm/mach-omap2/clockdomains2420_data.c1
-rw-r--r--arch/arm/mach-omap2/clockdomains2430_data.c1
-rw-r--r--arch/arm/mach-omap2/clockdomains3xxx_data.c1
-rw-r--r--arch/arm/mach-omap2/cm33xx.c2
-rw-r--r--arch/arm/mach-omap2/common-board-devices.c46
-rw-r--r--arch/arm/mach-omap2/common-board-devices.h1
-rw-r--r--arch/arm/mach-omap2/common.c22
-rw-r--r--arch/arm/mach-omap2/common.h9
-rw-r--r--arch/arm/mach-omap2/control.c4
-rw-r--r--arch/arm/mach-omap2/devices.c8
-rw-r--r--arch/arm/mach-omap2/display.c45
-rw-r--r--arch/arm/mach-omap2/dma.c8
-rw-r--r--arch/arm/mach-omap2/dma.h131
-rw-r--r--arch/arm/mach-omap2/dpll3xxx.c2
-rw-r--r--arch/arm/mach-omap2/dpll44xx.c2
-rw-r--r--arch/arm/mach-omap2/drm.c4
-rw-r--r--arch/arm/mach-omap2/dsp.c2
-rw-r--r--arch/arm/mach-omap2/gpio.c6
-rw-r--r--arch/arm/mach-omap2/gpmc-nand.c85
-rw-r--r--arch/arm/mach-omap2/gpmc-nand.h27
-rw-r--r--arch/arm/mach-omap2/gpmc-onenand.c214
-rw-r--r--arch/arm/mach-omap2/gpmc-onenand.h24
-rw-r--r--arch/arm/mach-omap2/gpmc-smc91x.c2
-rw-r--r--arch/arm/mach-omap2/gpmc-smsc911x.c2
-rw-r--r--arch/arm/mach-omap2/gpmc.c464
-rw-r--r--arch/arm/mach-omap2/gpmc.h (renamed from arch/arm/plat-omap/include/plat/gpmc.h)61
-rw-r--r--arch/arm/mach-omap2/hdq1w.c4
-rw-r--r--arch/arm/mach-omap2/hdq1w.h2
-rw-r--r--arch/arm/mach-omap2/hsmmc.c7
-rw-r--r--arch/arm/mach-omap2/hwspinlock.c4
-rw-r--r--arch/arm/mach-omap2/i2c.c53
-rw-r--r--arch/arm/mach-omap2/i2c.h (renamed from arch/arm/plat-omap/include/plat/i2c.h)25
-rw-r--r--arch/arm/mach-omap2/io.c12
-rw-r--r--arch/arm/mach-omap2/mcbsp.c7
-rw-r--r--arch/arm/mach-omap2/mmc.h23
-rw-r--r--arch/arm/mach-omap2/msdi.c7
-rw-r--r--arch/arm/mach-omap2/mux.c3
-rw-r--r--arch/arm/mach-omap2/omap-mpuss-lowpower.c1
-rw-r--r--arch/arm/mach-omap2/omap-pm.h (renamed from arch/arm/plat-omap/include/plat/omap-pm.h)0
-rw-r--r--arch/arm/mach-omap2/omap-secure.c1
-rw-r--r--arch/arm/mach-omap2/omap-secure.h7
-rw-r--r--arch/arm/mach-omap2/omap4-common.c7
-rw-r--r--arch/arm/mach-omap2/omap_device.c (renamed from arch/arm/plat-omap/omap_device.c)5
-rw-r--r--arch/arm/mach-omap2/omap_device.h (renamed from arch/arm/plat-omap/include/plat/omap_device.h)2
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.c4
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.h (renamed from arch/arm/plat-omap/include/plat/omap_hwmod.h)1
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2420_data.c12
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2430_data.c12
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_interconnect_data.c3
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_ipblock_data.c10
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2xxx_interconnect_data.c3
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c5
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_33xx_data.c10
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_3xxx_data.c13
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_44xx_data.c13
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_common_data.c2
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_common_data.h2
-rw-r--r--arch/arm/mach-omap2/omap_opp_data.h2
-rw-r--r--arch/arm/mach-omap2/omap_twl.c1
-rw-r--r--arch/arm/mach-omap2/opp.c2
-rw-r--r--arch/arm/mach-omap2/opp3xxx_data.c1
-rw-r--r--arch/arm/mach-omap2/pm-debug.c5
-rw-r--r--arch/arm/mach-omap2/pm.c5
-rw-r--r--arch/arm/mach-omap2/pm24xx.c8
-rw-r--r--arch/arm/mach-omap2/pm34xx.c9
-rw-r--r--arch/arm/mach-omap2/pm44xx.c1
-rw-r--r--arch/arm/mach-omap2/pmu.c5
-rw-r--r--arch/arm/mach-omap2/powerdomain.h2
-rw-r--r--arch/arm/mach-omap2/powerdomains2xxx_data.c1
-rw-r--r--arch/arm/mach-omap2/prcm.c1
-rw-r--r--arch/arm/mach-omap2/prm33xx.c2
-rw-r--r--arch/arm/mach-omap2/prm_common.c2
-rw-r--r--arch/arm/mach-omap2/sdram-hynix-h8mbx00u0mer-0em.h2
-rw-r--r--arch/arm/mach-omap2/sdram-micron-mt46h32m32lf-6.h2
-rw-r--r--arch/arm/mach-omap2/sdram-nokia.c4
-rw-r--r--arch/arm/mach-omap2/sdram-numonyx-m65kxxxxam.h2
-rw-r--r--arch/arm/mach-omap2/sdram-qimonda-hyb18m512160af-6.h2
-rw-r--r--arch/arm/mach-omap2/sdrc.c23
-rw-r--r--arch/arm/mach-omap2/sdrc.h146
-rw-r--r--arch/arm/mach-omap2/sdrc2xxx.c4
-rw-r--r--arch/arm/mach-omap2/serial.c11
-rw-r--r--arch/arm/mach-omap2/sleep34xx.S2
-rw-r--r--arch/arm/mach-omap2/soc.h468
-rw-r--r--arch/arm/mach-omap2/sr_device.c4
-rw-r--r--arch/arm/mach-omap2/timer.c6
-rw-r--r--arch/arm/mach-omap2/twl-common.c1
-rw-r--r--arch/arm/mach-omap2/usb-host.c3
-rw-r--r--arch/arm/mach-omap2/usb-musb.c5
-rw-r--r--arch/arm/mach-omap2/usb-tusb6010.c2
-rw-r--r--arch/arm/mach-omap2/wd_timer.c2
-rw-r--r--arch/arm/mach-omap2/wd_timer.h2
-rw-r--r--arch/arm/plat-omap/Makefile3
-rw-r--r--arch/arm/plat-omap/clock.c544
-rw-r--r--arch/arm/plat-omap/common.c25
-rw-r--r--arch/arm/plat-omap/common.h (renamed from arch/arm/plat-omap/include/plat/common.h)10
-rw-r--r--arch/arm/plat-omap/counter_32k.c3
-rw-r--r--arch/arm/plat-omap/debug-leds.c2
-rw-r--r--arch/arm/plat-omap/dma.c30
-rw-r--r--arch/arm/plat-omap/dmtimer.c3
-rw-r--r--arch/arm/plat-omap/fb.c61
-rw-r--r--arch/arm/plat-omap/fpga.h74
-rw-r--r--arch/arm/plat-omap/i2c.c133
-rw-r--r--arch/arm/plat-omap/i2c.h47
-rw-r--r--arch/arm/plat-omap/include/plat-omap/dma-omap.h (renamed from arch/arm/plat-omap/include/plat/dma.h)181
-rw-r--r--arch/arm/plat-omap/include/plat/clkdev_omap.h51
-rw-r--r--arch/arm/plat-omap/include/plat/clock.h309
-rw-r--r--arch/arm/plat-omap/include/plat/cpu.h468
-rw-r--r--arch/arm/plat-omap/include/plat/dma-44xx.h147
-rw-r--r--arch/arm/plat-omap/include/plat/fpga.h193
-rw-r--r--arch/arm/plat-omap/include/plat/led.h24
-rw-r--r--arch/arm/plat-omap/include/plat/mmc.h188
-rw-r--r--arch/arm/plat-omap/include/plat/multi.h120
-rw-r--r--arch/arm/plat-omap/include/plat/omap-secure.h14
-rw-r--r--arch/arm/plat-omap/include/plat/sdrc.h164
-rw-r--r--arch/arm/plat-omap/include/plat/sram.h105
-rw-r--r--arch/arm/plat-omap/include/plat/vrfb.h66
-rw-r--r--arch/arm/plat-omap/omap-pm-noop.c5
-rw-r--r--arch/arm/plat-omap/sram.c4
-rw-r--r--arch/arm/plat-omap/sram.h109
220 files changed, 3870 insertions, 3885 deletions
diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c
index 9518bf5996dc..e50b02249b32 100644
--- a/arch/arm/mach-omap1/board-ams-delta.c
+++ b/arch/arm/mach-omap1/board-ams-delta.c
@@ -613,7 +613,6 @@ MACHINE_START(AMS_DELTA, "Amstrad E3 (Delta)")
613 .atag_offset = 0x100, 613 .atag_offset = 0x100,
614 .map_io = ams_delta_map_io, 614 .map_io = ams_delta_map_io,
615 .init_early = omap1_init_early, 615 .init_early = omap1_init_early,
616 .reserve = omap_reserve,
617 .init_irq = omap1_init_irq, 616 .init_irq = omap1_init_irq,
618 .init_machine = ams_delta_init, 617 .init_machine = ams_delta_init,
619 .init_late = ams_delta_init_late, 618 .init_late = ams_delta_init_late,
diff --git a/arch/arm/mach-omap1/board-fsample.c b/arch/arm/mach-omap1/board-fsample.c
index 4b6de70c47a6..8b5800acf726 100644
--- a/arch/arm/mach-omap1/board-fsample.c
+++ b/arch/arm/mach-omap1/board-fsample.c
@@ -27,10 +27,10 @@
27#include <asm/mach/arch.h> 27#include <asm/mach/arch.h>
28#include <asm/mach/map.h> 28#include <asm/mach/map.h>
29 29
30#include <plat/tc.h> 30#include <mach/tc.h>
31#include <mach/mux.h> 31#include <mach/mux.h>
32#include <mach/flash.h> 32#include <mach/flash.h>
33#include <plat/fpga.h> 33#include <../plat-omap/fpga.h>
34#include <linux/platform_data/keypad-omap.h> 34#include <linux/platform_data/keypad-omap.h>
35 35
36#include <mach/hardware.h> 36#include <mach/hardware.h>
@@ -123,9 +123,9 @@ static struct resource smc91x_resources[] = {
123 123
124static void __init fsample_init_smc91x(void) 124static void __init fsample_init_smc91x(void)
125{ 125{
126 fpga_write(1, H2P2_DBG_FPGA_LAN_RESET); 126 __raw_writeb(1, H2P2_DBG_FPGA_LAN_RESET);
127 mdelay(50); 127 mdelay(50);
128 fpga_write(fpga_read(H2P2_DBG_FPGA_LAN_RESET) & ~1, 128 __raw_writeb(__raw_readb(H2P2_DBG_FPGA_LAN_RESET) & ~1,
129 H2P2_DBG_FPGA_LAN_RESET); 129 H2P2_DBG_FPGA_LAN_RESET);
130 mdelay(50); 130 mdelay(50);
131} 131}
@@ -362,7 +362,6 @@ MACHINE_START(OMAP_FSAMPLE, "OMAP730 F-Sample")
362 .atag_offset = 0x100, 362 .atag_offset = 0x100,
363 .map_io = omap_fsample_map_io, 363 .map_io = omap_fsample_map_io,
364 .init_early = omap1_init_early, 364 .init_early = omap1_init_early,
365 .reserve = omap_reserve,
366 .init_irq = omap1_init_irq, 365 .init_irq = omap1_init_irq,
367 .init_machine = omap_fsample_init, 366 .init_machine = omap_fsample_init,
368 .init_late = omap1_init_late, 367 .init_late = omap1_init_late,
diff --git a/arch/arm/mach-omap1/board-generic.c b/arch/arm/mach-omap1/board-generic.c
index 4ec579fdd366..608e7d2a2778 100644
--- a/arch/arm/mach-omap1/board-generic.c
+++ b/arch/arm/mach-omap1/board-generic.c
@@ -81,7 +81,6 @@ MACHINE_START(OMAP_GENERIC, "Generic OMAP1510/1610/1710")
81 .atag_offset = 0x100, 81 .atag_offset = 0x100,
82 .map_io = omap16xx_map_io, 82 .map_io = omap16xx_map_io,
83 .init_early = omap1_init_early, 83 .init_early = omap1_init_early,
84 .reserve = omap_reserve,
85 .init_irq = omap1_init_irq, 84 .init_irq = omap1_init_irq,
86 .init_machine = omap_generic_init, 85 .init_machine = omap_generic_init,
87 .init_late = omap1_init_late, 86 .init_late = omap1_init_late,
diff --git a/arch/arm/mach-omap1/board-h2-mmc.c b/arch/arm/mach-omap1/board-h2-mmc.c
index e1362ce48497..7119ef28e0ad 100644
--- a/arch/arm/mach-omap1/board-h2-mmc.c
+++ b/arch/arm/mach-omap1/board-h2-mmc.c
@@ -13,12 +13,11 @@
13 */ 13 */
14#include <linux/gpio.h> 14#include <linux/gpio.h>
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16 16#include <linux/platform_data/gpio-omap.h>
17#include <linux/i2c/tps65010.h> 17#include <linux/i2c/tps65010.h>
18 18
19#include <plat/mmc.h>
20
21#include "board-h2.h" 19#include "board-h2.h"
20#include "mmc.h"
22 21
23#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) 22#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
24 23
diff --git a/arch/arm/mach-omap1/board-h2.c b/arch/arm/mach-omap1/board-h2.c
index 376f7f29ef77..9134b646f01b 100644
--- a/arch/arm/mach-omap1/board-h2.c
+++ b/arch/arm/mach-omap1/board-h2.c
@@ -39,8 +39,8 @@
39#include <asm/mach/map.h> 39#include <asm/mach/map.h>
40 40
41#include <mach/mux.h> 41#include <mach/mux.h>
42#include <plat/dma.h> 42#include <plat-omap/dma-omap.h>
43#include <plat/tc.h> 43#include <mach/tc.h>
44#include <mach/irda.h> 44#include <mach/irda.h>
45#include <linux/platform_data/keypad-omap.h> 45#include <linux/platform_data/keypad-omap.h>
46#include <mach/flash.h> 46#include <mach/flash.h>
@@ -50,6 +50,7 @@
50 50
51#include "common.h" 51#include "common.h"
52#include "board-h2.h" 52#include "board-h2.h"
53#include "dma.h"
53 54
54/* At OMAP1610 Innovator the Ethernet is directly connected to CS1 */ 55/* At OMAP1610 Innovator the Ethernet is directly connected to CS1 */
55#define OMAP1610_ETHR_START 0x04000300 56#define OMAP1610_ETHR_START 0x04000300
@@ -458,7 +459,6 @@ MACHINE_START(OMAP_H2, "TI-H2")
458 .atag_offset = 0x100, 459 .atag_offset = 0x100,
459 .map_io = omap16xx_map_io, 460 .map_io = omap16xx_map_io,
460 .init_early = omap1_init_early, 461 .init_early = omap1_init_early,
461 .reserve = omap_reserve,
462 .init_irq = omap1_init_irq, 462 .init_irq = omap1_init_irq,
463 .init_machine = h2_init, 463 .init_machine = h2_init,
464 .init_late = omap1_init_late, 464 .init_late = omap1_init_late,
diff --git a/arch/arm/mach-omap1/board-h3-mmc.c b/arch/arm/mach-omap1/board-h3-mmc.c
index c74daace8cd6..17d77914d769 100644
--- a/arch/arm/mach-omap1/board-h3-mmc.c
+++ b/arch/arm/mach-omap1/board-h3-mmc.c
@@ -16,9 +16,8 @@
16 16
17#include <linux/i2c/tps65010.h> 17#include <linux/i2c/tps65010.h>
18 18
19#include <plat/mmc.h>
20
21#include "board-h3.h" 19#include "board-h3.h"
20#include "mmc.h"
22 21
23#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) 22#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
24 23
diff --git a/arch/arm/mach-omap1/board-h3.c b/arch/arm/mach-omap1/board-h3.c
index ededdb7ef28c..bf213d1d8075 100644
--- a/arch/arm/mach-omap1/board-h3.c
+++ b/arch/arm/mach-omap1/board-h3.c
@@ -41,9 +41,9 @@
41#include <asm/mach/map.h> 41#include <asm/mach/map.h>
42 42
43#include <mach/mux.h> 43#include <mach/mux.h>
44#include <plat/tc.h> 44#include <mach/tc.h>
45#include <linux/platform_data/keypad-omap.h> 45#include <linux/platform_data/keypad-omap.h>
46#include <plat/dma.h> 46#include <plat-omap/dma-omap.h>
47#include <mach/flash.h> 47#include <mach/flash.h>
48 48
49#include <mach/hardware.h> 49#include <mach/hardware.h>
@@ -452,7 +452,6 @@ MACHINE_START(OMAP_H3, "TI OMAP1710 H3 board")
452 .atag_offset = 0x100, 452 .atag_offset = 0x100,
453 .map_io = omap16xx_map_io, 453 .map_io = omap16xx_map_io,
454 .init_early = omap1_init_early, 454 .init_early = omap1_init_early,
455 .reserve = omap_reserve,
456 .init_irq = omap1_init_irq, 455 .init_irq = omap1_init_irq,
457 .init_machine = h3_init, 456 .init_machine = h3_init,
458 .init_late = omap1_init_late, 457 .init_late = omap1_init_late,
diff --git a/arch/arm/mach-omap1/board-htcherald.c b/arch/arm/mach-omap1/board-htcherald.c
index 87ab2086ef96..356f816c84a6 100644
--- a/arch/arm/mach-omap1/board-htcherald.c
+++ b/arch/arm/mach-omap1/board-htcherald.c
@@ -43,7 +43,7 @@
43#include <asm/mach/arch.h> 43#include <asm/mach/arch.h>
44 44
45#include <mach/omap7xx.h> 45#include <mach/omap7xx.h>
46#include <plat/mmc.h> 46#include "mmc.h"
47 47
48#include <mach/irqs.h> 48#include <mach/irqs.h>
49#include <mach/usb.h> 49#include <mach/usb.h>
@@ -600,7 +600,6 @@ MACHINE_START(HERALD, "HTC Herald")
600 .atag_offset = 0x100, 600 .atag_offset = 0x100,
601 .map_io = htcherald_map_io, 601 .map_io = htcherald_map_io,
602 .init_early = omap1_init_early, 602 .init_early = omap1_init_early,
603 .reserve = omap_reserve,
604 .init_irq = omap1_init_irq, 603 .init_irq = omap1_init_irq,
605 .init_machine = htcherald_init, 604 .init_machine = htcherald_init,
606 .init_late = omap1_init_late, 605 .init_late = omap1_init_late,
diff --git a/arch/arm/mach-omap1/board-innovator.c b/arch/arm/mach-omap1/board-innovator.c
index db5f7d2976e7..c66334f22471 100644
--- a/arch/arm/mach-omap1/board-innovator.c
+++ b/arch/arm/mach-omap1/board-innovator.c
@@ -33,16 +33,16 @@
33 33
34#include <mach/mux.h> 34#include <mach/mux.h>
35#include <mach/flash.h> 35#include <mach/flash.h>
36#include <plat/fpga.h> 36#include <../plat-omap/fpga.h>
37#include <plat/tc.h> 37#include <mach/tc.h>
38#include <linux/platform_data/keypad-omap.h> 38#include <linux/platform_data/keypad-omap.h>
39#include <plat/mmc.h>
40 39
41#include <mach/hardware.h> 40#include <mach/hardware.h>
42#include <mach/usb.h> 41#include <mach/usb.h>
43 42
44#include "iomap.h" 43#include "iomap.h"
45#include "common.h" 44#include "common.h"
45#include "mmc.h"
46 46
47/* At OMAP1610 Innovator the Ethernet is directly connected to CS1 */ 47/* At OMAP1610 Innovator the Ethernet is directly connected to CS1 */
48#define INNOVATOR1610_ETHR_START 0x04000300 48#define INNOVATOR1610_ETHR_START 0x04000300
@@ -215,7 +215,7 @@ static struct platform_device *innovator1510_devices[] __initdata = {
215 215
216static int innovator_get_pendown_state(void) 216static int innovator_get_pendown_state(void)
217{ 217{
218 return !(fpga_read(OMAP1510_FPGA_TOUCHSCREEN) & (1 << 5)); 218 return !(__raw_readb(OMAP1510_FPGA_TOUCHSCREEN) & (1 << 5));
219} 219}
220 220
221static const struct ads7846_platform_data innovator1510_ts_info = { 221static const struct ads7846_platform_data innovator1510_ts_info = {
@@ -279,7 +279,7 @@ static struct platform_device *innovator1610_devices[] __initdata = {
279static void __init innovator_init_smc91x(void) 279static void __init innovator_init_smc91x(void)
280{ 280{
281 if (cpu_is_omap1510()) { 281 if (cpu_is_omap1510()) {
282 fpga_write(fpga_read(OMAP1510_FPGA_RST) & ~1, 282 __raw_writeb(__raw_readb(OMAP1510_FPGA_RST) & ~1,
283 OMAP1510_FPGA_RST); 283 OMAP1510_FPGA_RST);
284 udelay(750); 284 udelay(750);
285 } else { 285 } else {
@@ -335,10 +335,10 @@ static int mmc_set_power(struct device *dev, int slot, int power_on,
335 int vdd) 335 int vdd)
336{ 336{
337 if (power_on) 337 if (power_on)
338 fpga_write(fpga_read(OMAP1510_FPGA_POWER) | (1 << 3), 338 __raw_writeb(__raw_readb(OMAP1510_FPGA_POWER) | (1 << 3),
339 OMAP1510_FPGA_POWER); 339 OMAP1510_FPGA_POWER);
340 else 340 else
341 fpga_write(fpga_read(OMAP1510_FPGA_POWER) & ~(1 << 3), 341 __raw_writeb(__raw_readb(OMAP1510_FPGA_POWER) & ~(1 << 3),
342 OMAP1510_FPGA_POWER); 342 OMAP1510_FPGA_POWER);
343 343
344 return 0; 344 return 0;
@@ -390,14 +390,14 @@ static void __init innovator_init(void)
390 omap_cfg_reg(UART3_TX); 390 omap_cfg_reg(UART3_TX);
391 omap_cfg_reg(UART3_RX); 391 omap_cfg_reg(UART3_RX);
392 392
393 reg = fpga_read(OMAP1510_FPGA_POWER); 393 reg = __raw_readb(OMAP1510_FPGA_POWER);
394 reg |= OMAP1510_FPGA_PCR_COM1_EN; 394 reg |= OMAP1510_FPGA_PCR_COM1_EN;
395 fpga_write(reg, OMAP1510_FPGA_POWER); 395 __raw_writeb(reg, OMAP1510_FPGA_POWER);
396 udelay(10); 396 udelay(10);
397 397
398 reg = fpga_read(OMAP1510_FPGA_POWER); 398 reg = __raw_readb(OMAP1510_FPGA_POWER);
399 reg |= OMAP1510_FPGA_PCR_COM2_EN; 399 reg |= OMAP1510_FPGA_PCR_COM2_EN;
400 fpga_write(reg, OMAP1510_FPGA_POWER); 400 __raw_writeb(reg, OMAP1510_FPGA_POWER);
401 udelay(10); 401 udelay(10);
402 402
403 platform_add_devices(innovator1510_devices, ARRAY_SIZE(innovator1510_devices)); 403 platform_add_devices(innovator1510_devices, ARRAY_SIZE(innovator1510_devices));
@@ -437,6 +437,7 @@ static void __init innovator_init(void)
437 */ 437 */
438static void __init innovator_map_io(void) 438static void __init innovator_map_io(void)
439{ 439{
440#ifdef CONFIG_ARCH_OMAP15XX
440 omap15xx_map_io(); 441 omap15xx_map_io();
441 442
442 iotable_init(innovator1510_io_desc, ARRAY_SIZE(innovator1510_io_desc)); 443 iotable_init(innovator1510_io_desc, ARRAY_SIZE(innovator1510_io_desc));
@@ -444,9 +445,10 @@ static void __init innovator_map_io(void)
444 445
445 /* Dump the Innovator FPGA rev early - useful info for support. */ 446 /* Dump the Innovator FPGA rev early - useful info for support. */
446 pr_debug("Innovator FPGA Rev %d.%d Board Rev %d\n", 447 pr_debug("Innovator FPGA Rev %d.%d Board Rev %d\n",
447 fpga_read(OMAP1510_FPGA_REV_HIGH), 448 __raw_readb(OMAP1510_FPGA_REV_HIGH),
448 fpga_read(OMAP1510_FPGA_REV_LOW), 449 __raw_readb(OMAP1510_FPGA_REV_LOW),
449 fpga_read(OMAP1510_FPGA_BOARD_REV)); 450 __raw_readb(OMAP1510_FPGA_BOARD_REV));
451#endif
450} 452}
451 453
452MACHINE_START(OMAP_INNOVATOR, "TI-Innovator") 454MACHINE_START(OMAP_INNOVATOR, "TI-Innovator")
@@ -454,7 +456,6 @@ MACHINE_START(OMAP_INNOVATOR, "TI-Innovator")
454 .atag_offset = 0x100, 456 .atag_offset = 0x100,
455 .map_io = innovator_map_io, 457 .map_io = innovator_map_io,
456 .init_early = omap1_init_early, 458 .init_early = omap1_init_early,
457 .reserve = omap_reserve,
458 .init_irq = omap1_init_irq, 459 .init_irq = omap1_init_irq,
459 .init_machine = innovator_init, 460 .init_machine = innovator_init,
460 .init_late = omap1_init_late, 461 .init_late = omap1_init_late,
diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c
index 7d5c06d6a52a..3e8ead67e459 100644
--- a/arch/arm/mach-omap1/board-nokia770.c
+++ b/arch/arm/mach-omap1/board-nokia770.c
@@ -29,13 +29,13 @@
29#include <asm/mach/map.h> 29#include <asm/mach/map.h>
30 30
31#include <mach/mux.h> 31#include <mach/mux.h>
32#include <plat/mmc.h>
33#include <plat/clock.h>
34 32
35#include <mach/hardware.h> 33#include <mach/hardware.h>
36#include <mach/usb.h> 34#include <mach/usb.h>
37 35
38#include "common.h" 36#include "common.h"
37#include "clock.h"
38#include "mmc.h"
39 39
40#define ADS7846_PENDOWN_GPIO 15 40#define ADS7846_PENDOWN_GPIO 15
41 41
@@ -251,7 +251,6 @@ MACHINE_START(NOKIA770, "Nokia 770")
251 .atag_offset = 0x100, 251 .atag_offset = 0x100,
252 .map_io = omap16xx_map_io, 252 .map_io = omap16xx_map_io,
253 .init_early = omap1_init_early, 253 .init_early = omap1_init_early,
254 .reserve = omap_reserve,
255 .init_irq = omap1_init_irq, 254 .init_irq = omap1_init_irq,
256 .init_machine = omap_nokia770_init, 255 .init_machine = omap_nokia770_init,
257 .init_late = omap1_init_late, 256 .init_late = omap1_init_late,
diff --git a/arch/arm/mach-omap1/board-osk.c b/arch/arm/mach-omap1/board-osk.c
index 5973945a8741..872ea47cd28a 100644
--- a/arch/arm/mach-omap1/board-osk.c
+++ b/arch/arm/mach-omap1/board-osk.c
@@ -48,7 +48,7 @@
48 48
49#include <mach/flash.h> 49#include <mach/flash.h>
50#include <mach/mux.h> 50#include <mach/mux.h>
51#include <plat/tc.h> 51#include <mach/tc.h>
52 52
53#include <mach/hardware.h> 53#include <mach/hardware.h>
54#include <mach/usb.h> 54#include <mach/usb.h>
@@ -606,7 +606,6 @@ MACHINE_START(OMAP_OSK, "TI-OSK")
606 .atag_offset = 0x100, 606 .atag_offset = 0x100,
607 .map_io = omap16xx_map_io, 607 .map_io = omap16xx_map_io,
608 .init_early = omap1_init_early, 608 .init_early = omap1_init_early,
609 .reserve = omap_reserve,
610 .init_irq = omap1_init_irq, 609 .init_irq = omap1_init_irq,
611 .init_machine = osk_init, 610 .init_machine = osk_init,
612 .init_late = omap1_init_late, 611 .init_late = omap1_init_late,
diff --git a/arch/arm/mach-omap1/board-palmte.c b/arch/arm/mach-omap1/board-palmte.c
index 1c578d58923a..584b6fab894b 100644
--- a/arch/arm/mach-omap1/board-palmte.c
+++ b/arch/arm/mach-omap1/board-palmte.c
@@ -36,8 +36,8 @@
36 36
37#include <mach/flash.h> 37#include <mach/flash.h>
38#include <mach/mux.h> 38#include <mach/mux.h>
39#include <plat/tc.h> 39#include <mach/tc.h>
40#include <plat/dma.h> 40#include <plat-omap/dma-omap.h>
41#include <mach/irda.h> 41#include <mach/irda.h>
42#include <linux/platform_data/keypad-omap.h> 42#include <linux/platform_data/keypad-omap.h>
43 43
@@ -45,6 +45,7 @@
45#include <mach/usb.h> 45#include <mach/usb.h>
46 46
47#include "common.h" 47#include "common.h"
48#include "dma.h"
48 49
49#define PALMTE_USBDETECT_GPIO 0 50#define PALMTE_USBDETECT_GPIO 0
50#define PALMTE_USB_OR_DC_GPIO 1 51#define PALMTE_USB_OR_DC_GPIO 1
@@ -264,7 +265,6 @@ MACHINE_START(OMAP_PALMTE, "OMAP310 based Palm Tungsten E")
264 .atag_offset = 0x100, 265 .atag_offset = 0x100,
265 .map_io = omap15xx_map_io, 266 .map_io = omap15xx_map_io,
266 .init_early = omap1_init_early, 267 .init_early = omap1_init_early,
267 .reserve = omap_reserve,
268 .init_irq = omap1_init_irq, 268 .init_irq = omap1_init_irq,
269 .init_machine = omap_palmte_init, 269 .init_machine = omap_palmte_init,
270 .init_late = omap1_init_late, 270 .init_late = omap1_init_late,
diff --git a/arch/arm/mach-omap1/board-palmtt.c b/arch/arm/mach-omap1/board-palmtt.c
index 97158095083c..fbc986bfe69e 100644
--- a/arch/arm/mach-omap1/board-palmtt.c
+++ b/arch/arm/mach-omap1/board-palmtt.c
@@ -28,16 +28,16 @@
28#include <linux/spi/spi.h> 28#include <linux/spi/spi.h>
29#include <linux/spi/ads7846.h> 29#include <linux/spi/ads7846.h>
30#include <linux/platform_data/omap1_bl.h> 30#include <linux/platform_data/omap1_bl.h>
31#include <linux/platform_data/leds-omap.h>
31 32
32#include <asm/mach-types.h> 33#include <asm/mach-types.h>
33#include <asm/mach/arch.h> 34#include <asm/mach/arch.h>
34#include <asm/mach/map.h> 35#include <asm/mach/map.h>
35 36
36#include <plat/led.h>
37#include <mach/flash.h> 37#include <mach/flash.h>
38#include <mach/mux.h> 38#include <mach/mux.h>
39#include <plat/dma.h> 39#include <plat-omap/dma-omap.h>
40#include <plat/tc.h> 40#include <mach/tc.h>
41#include <mach/irda.h> 41#include <mach/irda.h>
42#include <linux/platform_data/keypad-omap.h> 42#include <linux/platform_data/keypad-omap.h>
43 43
@@ -45,6 +45,7 @@
45#include <mach/usb.h> 45#include <mach/usb.h>
46 46
47#include "common.h" 47#include "common.h"
48#include "dma.h"
48 49
49#define PALMTT_USBDETECT_GPIO 0 50#define PALMTT_USBDETECT_GPIO 0
50#define PALMTT_CABLE_GPIO 1 51#define PALMTT_CABLE_GPIO 1
@@ -310,7 +311,6 @@ MACHINE_START(OMAP_PALMTT, "OMAP1510 based Palm Tungsten|T")
310 .atag_offset = 0x100, 311 .atag_offset = 0x100,
311 .map_io = omap15xx_map_io, 312 .map_io = omap15xx_map_io,
312 .init_early = omap1_init_early, 313 .init_early = omap1_init_early,
313 .reserve = omap_reserve,
314 .init_irq = omap1_init_irq, 314 .init_irq = omap1_init_irq,
315 .init_machine = omap_palmtt_init, 315 .init_machine = omap_palmtt_init,
316 .init_late = omap1_init_late, 316 .init_late = omap1_init_late,
diff --git a/arch/arm/mach-omap1/board-palmz71.c b/arch/arm/mach-omap1/board-palmz71.c
index e311032e7eeb..60d917a93763 100644
--- a/arch/arm/mach-omap1/board-palmz71.c
+++ b/arch/arm/mach-omap1/board-palmz71.c
@@ -38,8 +38,8 @@
38 38
39#include <mach/flash.h> 39#include <mach/flash.h>
40#include <mach/mux.h> 40#include <mach/mux.h>
41#include <plat/dma.h> 41#include <plat-omap/dma-omap.h>
42#include <plat/tc.h> 42#include <mach/tc.h>
43#include <mach/irda.h> 43#include <mach/irda.h>
44#include <linux/platform_data/keypad-omap.h> 44#include <linux/platform_data/keypad-omap.h>
45 45
@@ -47,6 +47,7 @@
47#include <mach/usb.h> 47#include <mach/usb.h>
48 48
49#include "common.h" 49#include "common.h"
50#include "dma.h"
50 51
51#define PALMZ71_USBDETECT_GPIO 0 52#define PALMZ71_USBDETECT_GPIO 0
52#define PALMZ71_PENIRQ_GPIO 6 53#define PALMZ71_PENIRQ_GPIO 6
@@ -326,7 +327,6 @@ MACHINE_START(OMAP_PALMZ71, "OMAP310 based Palm Zire71")
326 .atag_offset = 0x100, 327 .atag_offset = 0x100,
327 .map_io = omap15xx_map_io, 328 .map_io = omap15xx_map_io,
328 .init_early = omap1_init_early, 329 .init_early = omap1_init_early,
329 .reserve = omap_reserve,
330 .init_irq = omap1_init_irq, 330 .init_irq = omap1_init_irq,
331 .init_machine = omap_palmz71_init, 331 .init_machine = omap_palmz71_init,
332 .init_late = omap1_init_late, 332 .init_late = omap1_init_late,
diff --git a/arch/arm/mach-omap1/board-perseus2.c b/arch/arm/mach-omap1/board-perseus2.c
index 198b05417bfc..030bd48727be 100644
--- a/arch/arm/mach-omap1/board-perseus2.c
+++ b/arch/arm/mach-omap1/board-perseus2.c
@@ -28,9 +28,9 @@
28#include <asm/mach/arch.h> 28#include <asm/mach/arch.h>
29#include <asm/mach/map.h> 29#include <asm/mach/map.h>
30 30
31#include <plat/tc.h> 31#include <mach/tc.h>
32#include <mach/mux.h> 32#include <mach/mux.h>
33#include <plat/fpga.h> 33#include <../plat-omap/fpga.h>
34#include <mach/flash.h> 34#include <mach/flash.h>
35 35
36#include <mach/hardware.h> 36#include <mach/hardware.h>
@@ -231,9 +231,9 @@ static struct omap_lcd_config perseus2_lcd_config __initdata = {
231 231
232static void __init perseus2_init_smc91x(void) 232static void __init perseus2_init_smc91x(void)
233{ 233{
234 fpga_write(1, H2P2_DBG_FPGA_LAN_RESET); 234 __raw_writeb(1, H2P2_DBG_FPGA_LAN_RESET);
235 mdelay(50); 235 mdelay(50);
236 fpga_write(fpga_read(H2P2_DBG_FPGA_LAN_RESET) & ~1, 236 __raw_writeb(__raw_readb(H2P2_DBG_FPGA_LAN_RESET) & ~1,
237 H2P2_DBG_FPGA_LAN_RESET); 237 H2P2_DBG_FPGA_LAN_RESET);
238 mdelay(50); 238 mdelay(50);
239} 239}
@@ -324,7 +324,6 @@ MACHINE_START(OMAP_PERSEUS2, "OMAP730 Perseus2")
324 .atag_offset = 0x100, 324 .atag_offset = 0x100,
325 .map_io = omap_perseus2_map_io, 325 .map_io = omap_perseus2_map_io,
326 .init_early = omap1_init_early, 326 .init_early = omap1_init_early,
327 .reserve = omap_reserve,
328 .init_irq = omap1_init_irq, 327 .init_irq = omap1_init_irq,
329 .init_machine = omap_perseus2_init, 328 .init_machine = omap_perseus2_init,
330 .init_late = omap1_init_late, 329 .init_late = omap1_init_late,
diff --git a/arch/arm/mach-omap1/board-sx1-mmc.c b/arch/arm/mach-omap1/board-sx1-mmc.c
index 5932d56e17bf..4fcf19c78a08 100644
--- a/arch/arm/mach-omap1/board-sx1-mmc.c
+++ b/arch/arm/mach-omap1/board-sx1-mmc.c
@@ -16,9 +16,10 @@
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17 17
18#include <mach/hardware.h> 18#include <mach/hardware.h>
19#include <plat/mmc.h>
20#include <mach/board-sx1.h> 19#include <mach/board-sx1.h>
21 20
21#include "mmc.h"
22
22#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) 23#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
23 24
24static int mmc_set_power(struct device *dev, int slot, int power_on, 25static int mmc_set_power(struct device *dev, int slot, int power_on,
diff --git a/arch/arm/mach-omap1/board-sx1.c b/arch/arm/mach-omap1/board-sx1.c
index 13bf2cc56814..1ebc7e08d6e5 100644
--- a/arch/arm/mach-omap1/board-sx1.c
+++ b/arch/arm/mach-omap1/board-sx1.c
@@ -36,15 +36,16 @@
36 36
37#include <mach/flash.h> 37#include <mach/flash.h>
38#include <mach/mux.h> 38#include <mach/mux.h>
39#include <plat/dma.h> 39#include <plat-omap/dma-omap.h>
40#include <mach/irda.h> 40#include <mach/irda.h>
41#include <plat/tc.h> 41#include <mach/tc.h>
42#include <mach/board-sx1.h> 42#include <mach/board-sx1.h>
43 43
44#include <mach/hardware.h> 44#include <mach/hardware.h>
45#include <mach/usb.h> 45#include <mach/usb.h>
46 46
47#include "common.h" 47#include "common.h"
48#include "dma.h"
48 49
49/* Write to I2C device */ 50/* Write to I2C device */
50int sx1_i2c_write_byte(u8 devaddr, u8 regoffset, u8 value) 51int sx1_i2c_write_byte(u8 devaddr, u8 regoffset, u8 value)
@@ -403,7 +404,6 @@ MACHINE_START(SX1, "OMAP310 based Siemens SX1")
403 .atag_offset = 0x100, 404 .atag_offset = 0x100,
404 .map_io = omap15xx_map_io, 405 .map_io = omap15xx_map_io,
405 .init_early = omap1_init_early, 406 .init_early = omap1_init_early,
406 .reserve = omap_reserve,
407 .init_irq = omap1_init_irq, 407 .init_irq = omap1_init_irq,
408 .init_machine = omap_sx1_init, 408 .init_machine = omap_sx1_init,
409 .init_late = omap1_init_late, 409 .init_late = omap1_init_late,
diff --git a/arch/arm/mach-omap1/board-voiceblue.c b/arch/arm/mach-omap1/board-voiceblue.c
index ad75e3411d46..abf705f49b19 100644
--- a/arch/arm/mach-omap1/board-voiceblue.c
+++ b/arch/arm/mach-omap1/board-voiceblue.c
@@ -34,7 +34,7 @@
34#include <mach/board-voiceblue.h> 34#include <mach/board-voiceblue.h>
35#include <mach/flash.h> 35#include <mach/flash.h>
36#include <mach/mux.h> 36#include <mach/mux.h>
37#include <plat/tc.h> 37#include <mach/tc.h>
38 38
39#include <mach/hardware.h> 39#include <mach/hardware.h>
40#include <mach/usb.h> 40#include <mach/usb.h>
@@ -286,7 +286,6 @@ MACHINE_START(VOICEBLUE, "VoiceBlue OMAP5910")
286 .atag_offset = 0x100, 286 .atag_offset = 0x100,
287 .map_io = omap15xx_map_io, 287 .map_io = omap15xx_map_io,
288 .init_early = omap1_init_early, 288 .init_early = omap1_init_early,
289 .reserve = omap_reserve,
290 .init_irq = omap1_init_irq, 289 .init_irq = omap1_init_irq,
291 .init_machine = voiceblue_init, 290 .init_machine = voiceblue_init,
292 .init_late = omap1_init_late, 291 .init_late = omap1_init_late,
diff --git a/arch/arm/mach-omap1/clock.c b/arch/arm/mach-omap1/clock.c
index 638f4070fc70..9e74aa664acb 100644
--- a/arch/arm/mach-omap1/clock.c
+++ b/arch/arm/mach-omap1/clock.c
@@ -12,6 +12,7 @@
12 * published by the Free Software Foundation. 12 * published by the Free Software Foundation.
13 */ 13 */
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/export.h>
15#include <linux/list.h> 16#include <linux/list.h>
16#include <linux/errno.h> 17#include <linux/errno.h>
17#include <linux/err.h> 18#include <linux/err.h>
@@ -21,14 +22,13 @@
21 22
22#include <asm/mach-types.h> 23#include <asm/mach-types.h>
23 24
24#include <plat/cpu.h> 25#include "soc.h"
25#include <plat/usb.h> 26#include <plat/usb.h>
26#include <plat/clock.h>
27#include <plat/sram.h>
28#include <plat/clkdev_omap.h>
29 27
30#include <mach/hardware.h> 28#include <mach/hardware.h>
31 29
30#include "../plat-omap/sram.h"
31
32#include "iomap.h" 32#include "iomap.h"
33#include "clock.h" 33#include "clock.h"
34#include "opp.h" 34#include "opp.h"
@@ -36,6 +36,10 @@
36__u32 arm_idlect1_mask; 36__u32 arm_idlect1_mask;
37struct clk *api_ck_p, *ck_dpll1_p, *ck_ref_p; 37struct clk *api_ck_p, *ck_dpll1_p, *ck_ref_p;
38 38
39static LIST_HEAD(clocks);
40static DEFINE_MUTEX(clocks_mutex);
41static DEFINE_SPINLOCK(clockfw_lock);
42
39/* 43/*
40 * Omap1 specific clock functions 44 * Omap1 specific clock functions
41 */ 45 */
@@ -607,3 +611,497 @@ void omap1_clk_disable_unused(struct clk *clk)
607} 611}
608 612
609#endif 613#endif
614
615
616int clk_enable(struct clk *clk)
617{
618 unsigned long flags;
619 int ret;
620
621 if (clk == NULL || IS_ERR(clk))
622 return -EINVAL;
623
624 spin_lock_irqsave(&clockfw_lock, flags);
625 ret = omap1_clk_enable(clk);
626 spin_unlock_irqrestore(&clockfw_lock, flags);
627
628 return ret;
629}
630EXPORT_SYMBOL(clk_enable);
631
632void clk_disable(struct clk *clk)
633{
634 unsigned long flags;
635
636 if (clk == NULL || IS_ERR(clk))
637 return;
638
639 spin_lock_irqsave(&clockfw_lock, flags);
640 if (clk->usecount == 0) {
641 pr_err("Trying disable clock %s with 0 usecount\n",
642 clk->name);
643 WARN_ON(1);
644 goto out;
645 }
646
647 omap1_clk_disable(clk);
648
649out:
650 spin_unlock_irqrestore(&clockfw_lock, flags);
651}
652EXPORT_SYMBOL(clk_disable);
653
654unsigned long clk_get_rate(struct clk *clk)
655{
656 unsigned long flags;
657 unsigned long ret;
658
659 if (clk == NULL || IS_ERR(clk))
660 return 0;
661
662 spin_lock_irqsave(&clockfw_lock, flags);
663 ret = clk->rate;
664 spin_unlock_irqrestore(&clockfw_lock, flags);
665
666 return ret;
667}
668EXPORT_SYMBOL(clk_get_rate);
669
670/*
671 * Optional clock functions defined in include/linux/clk.h
672 */
673
674long clk_round_rate(struct clk *clk, unsigned long rate)
675{
676 unsigned long flags;
677 long ret;
678
679 if (clk == NULL || IS_ERR(clk))
680 return 0;
681
682 spin_lock_irqsave(&clockfw_lock, flags);
683 ret = omap1_clk_round_rate(clk, rate);
684 spin_unlock_irqrestore(&clockfw_lock, flags);
685
686 return ret;
687}
688EXPORT_SYMBOL(clk_round_rate);
689
690int clk_set_rate(struct clk *clk, unsigned long rate)
691{
692 unsigned long flags;
693 int ret = -EINVAL;
694
695 if (clk == NULL || IS_ERR(clk))
696 return ret;
697
698 spin_lock_irqsave(&clockfw_lock, flags);
699 ret = omap1_clk_set_rate(clk, rate);
700 if (ret == 0)
701 propagate_rate(clk);
702 spin_unlock_irqrestore(&clockfw_lock, flags);
703
704 return ret;
705}
706EXPORT_SYMBOL(clk_set_rate);
707
708int clk_set_parent(struct clk *clk, struct clk *parent)
709{
710 WARN_ONCE(1, "clk_set_parent() not implemented for OMAP1\n");
711
712 return -EINVAL;
713}
714EXPORT_SYMBOL(clk_set_parent);
715
716struct clk *clk_get_parent(struct clk *clk)
717{
718 return clk->parent;
719}
720EXPORT_SYMBOL(clk_get_parent);
721
722/*
723 * OMAP specific clock functions shared between omap1 and omap2
724 */
725
726int __initdata mpurate;
727
728/*
729 * By default we use the rate set by the bootloader.
730 * You can override this with mpurate= cmdline option.
731 */
732static int __init omap_clk_setup(char *str)
733{
734 get_option(&str, &mpurate);
735
736 if (!mpurate)
737 return 1;
738
739 if (mpurate < 1000)
740 mpurate *= 1000000;
741
742 return 1;
743}
744__setup("mpurate=", omap_clk_setup);
745
746/* Used for clocks that always have same value as the parent clock */
747unsigned long followparent_recalc(struct clk *clk)
748{
749 return clk->parent->rate;
750}
751
752/*
753 * Used for clocks that have the same value as the parent clock,
754 * divided by some factor
755 */
756unsigned long omap_fixed_divisor_recalc(struct clk *clk)
757{
758 WARN_ON(!clk->fixed_div);
759
760 return clk->parent->rate / clk->fixed_div;
761}
762
763void clk_reparent(struct clk *child, struct clk *parent)
764{
765 list_del_init(&child->sibling);
766 if (parent)
767 list_add(&child->sibling, &parent->children);
768 child->parent = parent;
769
770 /* now do the debugfs renaming to reattach the child
771 to the proper parent */
772}
773
774/* Propagate rate to children */
775void propagate_rate(struct clk *tclk)
776{
777 struct clk *clkp;
778
779 list_for_each_entry(clkp, &tclk->children, sibling) {
780 if (clkp->recalc)
781 clkp->rate = clkp->recalc(clkp);
782 propagate_rate(clkp);
783 }
784}
785
786static LIST_HEAD(root_clks);
787
788/**
789 * recalculate_root_clocks - recalculate and propagate all root clocks
790 *
791 * Recalculates all root clocks (clocks with no parent), which if the
792 * clock's .recalc is set correctly, should also propagate their rates.
793 * Called at init.
794 */
795void recalculate_root_clocks(void)
796{
797 struct clk *clkp;
798
799 list_for_each_entry(clkp, &root_clks, sibling) {
800 if (clkp->recalc)
801 clkp->rate = clkp->recalc(clkp);
802 propagate_rate(clkp);
803 }
804}
805
806/**
807 * clk_preinit - initialize any fields in the struct clk before clk init
808 * @clk: struct clk * to initialize
809 *
810 * Initialize any struct clk fields needed before normal clk initialization
811 * can run. No return value.
812 */
813void clk_preinit(struct clk *clk)
814{
815 INIT_LIST_HEAD(&clk->children);
816}
817
818int clk_register(struct clk *clk)
819{
820 if (clk == NULL || IS_ERR(clk))
821 return -EINVAL;
822
823 /*
824 * trap out already registered clocks
825 */
826 if (clk->node.next || clk->node.prev)
827 return 0;
828
829 mutex_lock(&clocks_mutex);
830 if (clk->parent)
831 list_add(&clk->sibling, &clk->parent->children);
832 else
833 list_add(&clk->sibling, &root_clks);
834
835 list_add(&clk->node, &clocks);
836 if (clk->init)
837 clk->init(clk);
838 mutex_unlock(&clocks_mutex);
839
840 return 0;
841}
842EXPORT_SYMBOL(clk_register);
843
844void clk_unregister(struct clk *clk)
845{
846 if (clk == NULL || IS_ERR(clk))
847 return;
848
849 mutex_lock(&clocks_mutex);
850 list_del(&clk->sibling);
851 list_del(&clk->node);
852 mutex_unlock(&clocks_mutex);
853}
854EXPORT_SYMBOL(clk_unregister);
855
856void clk_enable_init_clocks(void)
857{
858 struct clk *clkp;
859
860 list_for_each_entry(clkp, &clocks, node)
861 if (clkp->flags & ENABLE_ON_INIT)
862 clk_enable(clkp);
863}
864
865/**
866 * omap_clk_get_by_name - locate OMAP struct clk by its name
867 * @name: name of the struct clk to locate
868 *
869 * Locate an OMAP struct clk by its name. Assumes that struct clk
870 * names are unique. Returns NULL if not found or a pointer to the
871 * struct clk if found.
872 */
873struct clk *omap_clk_get_by_name(const char *name)
874{
875 struct clk *c;
876 struct clk *ret = NULL;
877
878 mutex_lock(&clocks_mutex);
879
880 list_for_each_entry(c, &clocks, node) {
881 if (!strcmp(c->name, name)) {
882 ret = c;
883 break;
884 }
885 }
886
887 mutex_unlock(&clocks_mutex);
888
889 return ret;
890}
891
892int omap_clk_enable_autoidle_all(void)
893{
894 struct clk *c;
895 unsigned long flags;
896
897 spin_lock_irqsave(&clockfw_lock, flags);
898
899 list_for_each_entry(c, &clocks, node)
900 if (c->ops->allow_idle)
901 c->ops->allow_idle(c);
902
903 spin_unlock_irqrestore(&clockfw_lock, flags);
904
905 return 0;
906}
907
908int omap_clk_disable_autoidle_all(void)
909{
910 struct clk *c;
911 unsigned long flags;
912
913 spin_lock_irqsave(&clockfw_lock, flags);
914
915 list_for_each_entry(c, &clocks, node)
916 if (c->ops->deny_idle)
917 c->ops->deny_idle(c);
918
919 spin_unlock_irqrestore(&clockfw_lock, flags);
920
921 return 0;
922}
923
924/*
925 * Low level helpers
926 */
927static int clkll_enable_null(struct clk *clk)
928{
929 return 0;
930}
931
932static void clkll_disable_null(struct clk *clk)
933{
934}
935
936const struct clkops clkops_null = {
937 .enable = clkll_enable_null,
938 .disable = clkll_disable_null,
939};
940
941/*
942 * Dummy clock
943 *
944 * Used for clock aliases that are needed on some OMAPs, but not others
945 */
946struct clk dummy_ck = {
947 .name = "dummy",
948 .ops = &clkops_null,
949};
950
951/*
952 *
953 */
954
955#ifdef CONFIG_OMAP_RESET_CLOCKS
956/*
957 * Disable any unused clocks left on by the bootloader
958 */
959static int __init clk_disable_unused(void)
960{
961 struct clk *ck;
962 unsigned long flags;
963
964 pr_info("clock: disabling unused clocks to save power\n");
965
966 spin_lock_irqsave(&clockfw_lock, flags);
967 list_for_each_entry(ck, &clocks, node) {
968 if (ck->ops == &clkops_null)
969 continue;
970
971 if (ck->usecount > 0 || !ck->enable_reg)
972 continue;
973
974 omap1_clk_disable_unused(ck);
975 }
976 spin_unlock_irqrestore(&clockfw_lock, flags);
977
978 return 0;
979}
980late_initcall(clk_disable_unused);
981late_initcall(omap_clk_enable_autoidle_all);
982#endif
983
984#if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS)
985/*
986 * debugfs support to trace clock tree hierarchy and attributes
987 */
988
989#include <linux/debugfs.h>
990#include <linux/seq_file.h>
991
992static struct dentry *clk_debugfs_root;
993
994static int clk_dbg_show_summary(struct seq_file *s, void *unused)
995{
996 struct clk *c;
997 struct clk *pa;
998
999 mutex_lock(&clocks_mutex);
1000 seq_printf(s, "%-30s %-30s %-10s %s\n",
1001 "clock-name", "parent-name", "rate", "use-count");
1002
1003 list_for_each_entry(c, &clocks, node) {
1004 pa = c->parent;
1005 seq_printf(s, "%-30s %-30s %-10lu %d\n",
1006 c->name, pa ? pa->name : "none", c->rate,
1007 c->usecount);
1008 }
1009 mutex_unlock(&clocks_mutex);
1010
1011 return 0;
1012}
1013
1014static int clk_dbg_open(struct inode *inode, struct file *file)
1015{
1016 return single_open(file, clk_dbg_show_summary, inode->i_private);
1017}
1018
1019static const struct file_operations debug_clock_fops = {
1020 .open = clk_dbg_open,
1021 .read = seq_read,
1022 .llseek = seq_lseek,
1023 .release = single_release,
1024};
1025
1026static int clk_debugfs_register_one(struct clk *c)
1027{
1028 int err;
1029 struct dentry *d;
1030 struct clk *pa = c->parent;
1031
1032 d = debugfs_create_dir(c->name, pa ? pa->dent : clk_debugfs_root);
1033 if (!d)
1034 return -ENOMEM;
1035 c->dent = d;
1036
1037 d = debugfs_create_u8("usecount", S_IRUGO, c->dent, (u8 *)&c->usecount);
1038 if (!d) {
1039 err = -ENOMEM;
1040 goto err_out;
1041 }
1042 d = debugfs_create_u32("rate", S_IRUGO, c->dent, (u32 *)&c->rate);
1043 if (!d) {
1044 err = -ENOMEM;
1045 goto err_out;
1046 }
1047 d = debugfs_create_x32("flags", S_IRUGO, c->dent, (u32 *)&c->flags);
1048 if (!d) {
1049 err = -ENOMEM;
1050 goto err_out;
1051 }
1052 return 0;
1053
1054err_out:
1055 debugfs_remove_recursive(c->dent);
1056 return err;
1057}
1058
1059static int clk_debugfs_register(struct clk *c)
1060{
1061 int err;
1062 struct clk *pa = c->parent;
1063
1064 if (pa && !pa->dent) {
1065 err = clk_debugfs_register(pa);
1066 if (err)
1067 return err;
1068 }
1069
1070 if (!c->dent) {
1071 err = clk_debugfs_register_one(c);
1072 if (err)
1073 return err;
1074 }
1075 return 0;
1076}
1077
1078static int __init clk_debugfs_init(void)
1079{
1080 struct clk *c;
1081 struct dentry *d;
1082 int err;
1083
1084 d = debugfs_create_dir("clock", NULL);
1085 if (!d)
1086 return -ENOMEM;
1087 clk_debugfs_root = d;
1088
1089 list_for_each_entry(c, &clocks, node) {
1090 err = clk_debugfs_register(c);
1091 if (err)
1092 goto err_out;
1093 }
1094
1095 d = debugfs_create_file("summary", S_IRUGO,
1096 d, NULL, &debug_clock_fops);
1097 if (!d)
1098 return -ENOMEM;
1099
1100 return 0;
1101err_out:
1102 debugfs_remove_recursive(clk_debugfs_root);
1103 return err;
1104}
1105late_initcall(clk_debugfs_init);
1106
1107#endif /* defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS) */
diff --git a/arch/arm/mach-omap1/clock.h b/arch/arm/mach-omap1/clock.h
index 3d04f4f67676..1e4918a3a5ee 100644
--- a/arch/arm/mach-omap1/clock.h
+++ b/arch/arm/mach-omap1/clock.h
@@ -14,8 +14,184 @@
14#define __ARCH_ARM_MACH_OMAP1_CLOCK_H 14#define __ARCH_ARM_MACH_OMAP1_CLOCK_H
15 15
16#include <linux/clk.h> 16#include <linux/clk.h>
17#include <linux/list.h>
17 18
18#include <plat/clock.h> 19#include <linux/clkdev.h>
20
21struct module;
22struct clk;
23
24struct omap_clk {
25 u16 cpu;
26 struct clk_lookup lk;
27};
28
29#define CLK(dev, con, ck, cp) \
30 { \
31 .cpu = cp, \
32 .lk = { \
33 .dev_id = dev, \
34 .con_id = con, \
35 .clk = ck, \
36 }, \
37 }
38
39/* Platform flags for the clkdev-OMAP integration code */
40#define CK_310 (1 << 0)
41#define CK_7XX (1 << 1) /* 7xx, 850 */
42#define CK_1510 (1 << 2)
43#define CK_16XX (1 << 3) /* 16xx, 17xx, 5912 */
44#define CK_1710 (1 << 4) /* 1710 extra for rate selection */
45
46
47/* Temporary, needed during the common clock framework conversion */
48#define __clk_get_name(clk) (clk->name)
49#define __clk_get_parent(clk) (clk->parent)
50#define __clk_get_rate(clk) (clk->rate)
51
52/**
53 * struct clkops - some clock function pointers
54 * @enable: fn ptr that enables the current clock in hardware
55 * @disable: fn ptr that enables the current clock in hardware
56 * @find_idlest: function returning the IDLEST register for the clock's IP blk
57 * @find_companion: function returning the "companion" clk reg for the clock
58 * @allow_idle: fn ptr that enables autoidle for the current clock in hardware
59 * @deny_idle: fn ptr that disables autoidle for the current clock in hardware
60 *
61 * A "companion" clk is an accompanying clock to the one being queried
62 * that must be enabled for the IP module connected to the clock to
63 * become accessible by the hardware. Neither @find_idlest nor
64 * @find_companion should be needed; that information is IP
65 * block-specific; the hwmod code has been created to handle this, but
66 * until hwmod data is ready and drivers have been converted to use PM
67 * runtime calls in place of clk_enable()/clk_disable(), @find_idlest and
68 * @find_companion must, unfortunately, remain.
69 */
70struct clkops {
71 int (*enable)(struct clk *);
72 void (*disable)(struct clk *);
73 void (*find_idlest)(struct clk *, void __iomem **,
74 u8 *, u8 *);
75 void (*find_companion)(struct clk *, void __iomem **,
76 u8 *);
77 void (*allow_idle)(struct clk *);
78 void (*deny_idle)(struct clk *);
79};
80
81/*
82 * struct clk.flags possibilities
83 *
84 * XXX document the rest of the clock flags here
85 *
86 * CLOCK_CLKOUTX2: (OMAP4 only) DPLL CLKOUT and CLKOUTX2 GATE_CTRL
87 * bits share the same register. This flag allows the
88 * omap4_dpllmx*() code to determine which GATE_CTRL bit field
89 * should be used. This is a temporary solution - a better approach
90 * would be to associate clock type-specific data with the clock,
91 * similar to the struct dpll_data approach.
92 */
93#define ENABLE_REG_32BIT (1 << 0) /* Use 32-bit access */
94#define CLOCK_IDLE_CONTROL (1 << 1)
95#define CLOCK_NO_IDLE_PARENT (1 << 2)
96#define ENABLE_ON_INIT (1 << 3) /* Enable upon framework init */
97#define INVERT_ENABLE (1 << 4) /* 0 enables, 1 disables */
98#define CLOCK_CLKOUTX2 (1 << 5)
99
100/**
101 * struct clk - OMAP struct clk
102 * @node: list_head connecting this clock into the full clock list
103 * @ops: struct clkops * for this clock
104 * @name: the name of the clock in the hardware (used in hwmod data and debug)
105 * @parent: pointer to this clock's parent struct clk
106 * @children: list_head connecting to the child clks' @sibling list_heads
107 * @sibling: list_head connecting this clk to its parent clk's @children
108 * @rate: current clock rate
109 * @enable_reg: register to write to enable the clock (see @enable_bit)
110 * @recalc: fn ptr that returns the clock's current rate
111 * @set_rate: fn ptr that can change the clock's current rate
112 * @round_rate: fn ptr that can round the clock's current rate
113 * @init: fn ptr to do clock-specific initialization
114 * @enable_bit: bitshift to write to enable/disable the clock (see @enable_reg)
115 * @usecount: number of users that have requested this clock to be enabled
116 * @fixed_div: when > 0, this clock's rate is its parent's rate / @fixed_div
117 * @flags: see "struct clk.flags possibilities" above
118 * @rate_offset: bitshift for rate selection bitfield (OMAP1 only)
119 * @src_offset: bitshift for source selection bitfield (OMAP1 only)
120 *
121 * XXX @rate_offset, @src_offset should probably be removed and OMAP1
122 * clock code converted to use clksel.
123 *
124 * XXX @usecount is poorly named. It should be "enable_count" or
125 * something similar. "users" in the description refers to kernel
126 * code (core code or drivers) that have called clk_enable() and not
127 * yet called clk_disable(); the usecount of parent clocks is also
128 * incremented by the clock code when clk_enable() is called on child
129 * clocks and decremented by the clock code when clk_disable() is
130 * called on child clocks.
131 *
132 * XXX @clkdm, @usecount, @children, @sibling should be marked for
133 * internal use only.
134 *
135 * @children and @sibling are used to optimize parent-to-child clock
136 * tree traversals. (child-to-parent traversals use @parent.)
137 *
138 * XXX The notion of the clock's current rate probably needs to be
139 * separated from the clock's target rate.
140 */
141struct clk {
142 struct list_head node;
143 const struct clkops *ops;
144 const char *name;
145 struct clk *parent;
146 struct list_head children;
147 struct list_head sibling; /* node for children */
148 unsigned long rate;
149 void __iomem *enable_reg;
150 unsigned long (*recalc)(struct clk *);
151 int (*set_rate)(struct clk *, unsigned long);
152 long (*round_rate)(struct clk *, unsigned long);
153 void (*init)(struct clk *);
154 u8 enable_bit;
155 s8 usecount;
156 u8 fixed_div;
157 u8 flags;
158 u8 rate_offset;
159 u8 src_offset;
160#if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS)
161 struct dentry *dent; /* For visible tree hierarchy */
162#endif
163};
164
165struct clk_functions {
166 int (*clk_enable)(struct clk *clk);
167 void (*clk_disable)(struct clk *clk);
168 long (*clk_round_rate)(struct clk *clk, unsigned long rate);
169 int (*clk_set_rate)(struct clk *clk, unsigned long rate);
170 int (*clk_set_parent)(struct clk *clk, struct clk *parent);
171 void (*clk_allow_idle)(struct clk *clk);
172 void (*clk_deny_idle)(struct clk *clk);
173 void (*clk_disable_unused)(struct clk *clk);
174};
175
176extern int mpurate;
177
178extern int clk_init(struct clk_functions *custom_clocks);
179extern void clk_preinit(struct clk *clk);
180extern int clk_register(struct clk *clk);
181extern void clk_reparent(struct clk *child, struct clk *parent);
182extern void clk_unregister(struct clk *clk);
183extern void propagate_rate(struct clk *clk);
184extern void recalculate_root_clocks(void);
185extern unsigned long followparent_recalc(struct clk *clk);
186extern void clk_enable_init_clocks(void);
187unsigned long omap_fixed_divisor_recalc(struct clk *clk);
188extern struct clk *omap_clk_get_by_name(const char *name);
189extern int omap_clk_enable_autoidle_all(void);
190extern int omap_clk_disable_autoidle_all(void);
191
192extern const struct clkops clkops_null;
193
194extern struct clk dummy_ck;
19 195
20int omap1_clk_init(void); 196int omap1_clk_init(void);
21void omap1_clk_late_init(void); 197void omap1_clk_late_init(void);
diff --git a/arch/arm/mach-omap1/clock_data.c b/arch/arm/mach-omap1/clock_data.c
index 9b45f4b0ee22..28aea55a412e 100644
--- a/arch/arm/mach-omap1/clock_data.c
+++ b/arch/arm/mach-omap1/clock_data.c
@@ -22,14 +22,13 @@
22 22
23#include <asm/mach-types.h> /* for machine_is_* */ 23#include <asm/mach-types.h> /* for machine_is_* */
24 24
25#include <plat/clock.h> 25#include "soc.h"
26#include <plat/cpu.h>
27#include <plat/clkdev_omap.h>
28#include <plat/sram.h> /* for omap_sram_reprogram_clock() */
29 26
30#include <mach/hardware.h> 27#include <mach/hardware.h>
31#include <mach/usb.h> /* for OTG_BASE */ 28#include <mach/usb.h> /* for OTG_BASE */
32 29
30#include "../plat-omap/sram.h"
31
33#include "iomap.h" 32#include "iomap.h"
34#include "clock.h" 33#include "clock.h"
35 34
@@ -765,14 +764,6 @@ static struct omap_clk omap_clks[] = {
765 * init 764 * init
766 */ 765 */
767 766
768static struct clk_functions omap1_clk_functions = {
769 .clk_enable = omap1_clk_enable,
770 .clk_disable = omap1_clk_disable,
771 .clk_round_rate = omap1_clk_round_rate,
772 .clk_set_rate = omap1_clk_set_rate,
773 .clk_disable_unused = omap1_clk_disable_unused,
774};
775
776static void __init omap1_show_rates(void) 767static void __init omap1_show_rates(void)
777{ 768{
778 pr_notice("Clocking rate (xtal/DPLL1/MPU): %ld.%01ld/%ld.%01ld/%ld.%01ld MHz\n", 769 pr_notice("Clocking rate (xtal/DPLL1/MPU): %ld.%01ld/%ld.%01ld/%ld.%01ld MHz\n",
@@ -803,8 +794,6 @@ int __init omap1_clk_init(void)
803 if (!cpu_is_omap15xx()) 794 if (!cpu_is_omap15xx())
804 omap_writew(0, SOFT_REQ_REG2); 795 omap_writew(0, SOFT_REQ_REG2);
805 796
806 clk_init(&omap1_clk_functions);
807
808 /* By default all idlect1 clocks are allowed to idle */ 797 /* By default all idlect1 clocks are allowed to idle */
809 arm_idlect1_mask = ~0; 798 arm_idlect1_mask = ~0;
810 799
diff --git a/arch/arm/mach-omap1/common.h b/arch/arm/mach-omap1/common.h
index c2552b24f9f2..26e19d3b7924 100644
--- a/arch/arm/mach-omap1/common.h
+++ b/arch/arm/mach-omap1/common.h
@@ -26,8 +26,11 @@
26#ifndef __ARCH_ARM_MACH_OMAP1_COMMON_H 26#ifndef __ARCH_ARM_MACH_OMAP1_COMMON_H
27#define __ARCH_ARM_MACH_OMAP1_COMMON_H 27#define __ARCH_ARM_MACH_OMAP1_COMMON_H
28 28
29#include <plat/common.h> 29#include "../plat-omap/common.h"
30#include <linux/mtd/mtd.h> 30#include <linux/mtd/mtd.h>
31#include <linux/i2c-omap.h>
32
33#include "../plat-omap/i2c.h"
31 34
32#if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850) 35#if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)
33void omap7xx_map_io(void); 36void omap7xx_map_io(void);
@@ -38,6 +41,7 @@ static inline void omap7xx_map_io(void)
38#endif 41#endif
39 42
40#ifdef CONFIG_ARCH_OMAP15XX 43#ifdef CONFIG_ARCH_OMAP15XX
44void omap1510_fpga_init_irq(void);
41void omap15xx_map_io(void); 45void omap15xx_map_io(void);
42#else 46#else
43static inline void omap15xx_map_io(void) 47static inline void omap15xx_map_io(void)
diff --git a/arch/arm/mach-omap1/devices.c b/arch/arm/mach-omap1/devices.c
index d3fec92c54cb..645668e2b1d5 100644
--- a/arch/arm/mach-omap1/devices.c
+++ b/arch/arm/mach-omap1/devices.c
@@ -19,17 +19,19 @@
19 19
20#include <asm/mach/map.h> 20#include <asm/mach/map.h>
21 21
22#include <plat/tc.h> 22#include <mach/tc.h>
23#include <mach/mux.h> 23#include <mach/mux.h>
24#include <plat/dma.h>
25#include <plat/mmc.h>
26 24
27#include <mach/omap7xx.h> 25#include <mach/omap7xx.h>
28#include <mach/camera.h> 26#include <mach/camera.h>
29#include <mach/hardware.h> 27#include <mach/hardware.h>
30 28
29#include "../plat-omap/sram.h"
30
31#include "common.h" 31#include "common.h"
32#include "clock.h" 32#include "clock.h"
33#include "dma.h"
34#include "mmc.h"
33 35
34#if defined(CONFIG_SND_SOC) || defined(CONFIG_SND_SOC_MODULE) 36#if defined(CONFIG_SND_SOC) || defined(CONFIG_SND_SOC_MODULE)
35 37
@@ -175,6 +177,13 @@ static int __init omap_mmc_add(const char *name, int id, unsigned long base,
175 res[3].name = "tx"; 177 res[3].name = "tx";
176 res[3].flags = IORESOURCE_DMA; 178 res[3].flags = IORESOURCE_DMA;
177 179
180 if (cpu_is_omap7xx())
181 data->slots[0].features = MMC_OMAP7XX;
182 if (cpu_is_omap15xx())
183 data->slots[0].features = MMC_OMAP15XX;
184 if (cpu_is_omap16xx())
185 data->slots[0].features = MMC_OMAP16XX;
186
178 ret = platform_device_add_resources(pdev, res, ARRAY_SIZE(res)); 187 ret = platform_device_add_resources(pdev, res, ARRAY_SIZE(res));
179 if (ret == 0) 188 if (ret == 0)
180 ret = platform_device_add_data(pdev, data, sizeof(*data)); 189 ret = platform_device_add_data(pdev, data, sizeof(*data));
diff --git a/arch/arm/mach-omap1/dma.c b/arch/arm/mach-omap1/dma.c
index 29007fef84cd..71305c15fbd5 100644
--- a/arch/arm/mach-omap1/dma.c
+++ b/arch/arm/mach-omap1/dma.c
@@ -25,11 +25,13 @@
25#include <linux/device.h> 25#include <linux/device.h>
26#include <linux/io.h> 26#include <linux/io.h>
27 27
28#include <plat/dma.h> 28#include <plat-omap/dma-omap.h>
29#include <plat/tc.h> 29#include <mach/tc.h>
30 30
31#include <mach/irqs.h> 31#include <mach/irqs.h>
32 32
33#include "dma.h"
34
33#define OMAP1_DMA_BASE (0xfffed800) 35#define OMAP1_DMA_BASE (0xfffed800)
34#define OMAP1_LOGICAL_DMA_CH_COUNT 17 36#define OMAP1_LOGICAL_DMA_CH_COUNT 17
35#define OMAP1_DMA_STRIDE 0x40 37#define OMAP1_DMA_STRIDE 0x40
diff --git a/arch/arm/mach-omap1/dma.h b/arch/arm/mach-omap1/dma.h
new file mode 100644
index 000000000000..da6345dab03f
--- /dev/null
+++ b/arch/arm/mach-omap1/dma.h
@@ -0,0 +1,83 @@
1/*
2 * OMAP1 DMA channel definitions
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
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 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19#ifndef __OMAP1_DMA_CHANNEL_H
20#define __OMAP1_DMA_CHANNEL_H
21
22/* DMA channels for omap1 */
23#define OMAP_DMA_NO_DEVICE 0
24#define OMAP_DMA_MCSI1_TX 1
25#define OMAP_DMA_MCSI1_RX 2
26#define OMAP_DMA_I2C_RX 3
27#define OMAP_DMA_I2C_TX 4
28#define OMAP_DMA_EXT_NDMA_REQ 5
29#define OMAP_DMA_EXT_NDMA_REQ2 6
30#define OMAP_DMA_UWIRE_TX 7
31#define OMAP_DMA_MCBSP1_TX 8
32#define OMAP_DMA_MCBSP1_RX 9
33#define OMAP_DMA_MCBSP3_TX 10
34#define OMAP_DMA_MCBSP3_RX 11
35#define OMAP_DMA_UART1_TX 12
36#define OMAP_DMA_UART1_RX 13
37#define OMAP_DMA_UART2_TX 14
38#define OMAP_DMA_UART2_RX 15
39#define OMAP_DMA_MCBSP2_TX 16
40#define OMAP_DMA_MCBSP2_RX 17
41#define OMAP_DMA_UART3_TX 18
42#define OMAP_DMA_UART3_RX 19
43#define OMAP_DMA_CAMERA_IF_RX 20
44#define OMAP_DMA_MMC_TX 21
45#define OMAP_DMA_MMC_RX 22
46#define OMAP_DMA_NAND 23
47#define OMAP_DMA_IRQ_LCD_LINE 24
48#define OMAP_DMA_MEMORY_STICK 25
49#define OMAP_DMA_USB_W2FC_RX0 26
50#define OMAP_DMA_USB_W2FC_RX1 27
51#define OMAP_DMA_USB_W2FC_RX2 28
52#define OMAP_DMA_USB_W2FC_TX0 29
53#define OMAP_DMA_USB_W2FC_TX1 30
54#define OMAP_DMA_USB_W2FC_TX2 31
55
56/* These are only for 1610 */
57#define OMAP_DMA_CRYPTO_DES_IN 32
58#define OMAP_DMA_SPI_TX 33
59#define OMAP_DMA_SPI_RX 34
60#define OMAP_DMA_CRYPTO_HASH 35
61#define OMAP_DMA_CCP_ATTN 36
62#define OMAP_DMA_CCP_FIFO_NOT_EMPTY 37
63#define OMAP_DMA_CMT_APE_TX_CHAN_0 38
64#define OMAP_DMA_CMT_APE_RV_CHAN_0 39
65#define OMAP_DMA_CMT_APE_TX_CHAN_1 40
66#define OMAP_DMA_CMT_APE_RV_CHAN_1 41
67#define OMAP_DMA_CMT_APE_TX_CHAN_2 42
68#define OMAP_DMA_CMT_APE_RV_CHAN_2 43
69#define OMAP_DMA_CMT_APE_TX_CHAN_3 44
70#define OMAP_DMA_CMT_APE_RV_CHAN_3 45
71#define OMAP_DMA_CMT_APE_TX_CHAN_4 46
72#define OMAP_DMA_CMT_APE_RV_CHAN_4 47
73#define OMAP_DMA_CMT_APE_TX_CHAN_5 48
74#define OMAP_DMA_CMT_APE_RV_CHAN_5 49
75#define OMAP_DMA_CMT_APE_TX_CHAN_6 50
76#define OMAP_DMA_CMT_APE_RV_CHAN_6 51
77#define OMAP_DMA_CMT_APE_TX_CHAN_7 52
78#define OMAP_DMA_CMT_APE_RV_CHAN_7 53
79#define OMAP_DMA_MMC2_TX 54
80#define OMAP_DMA_MMC2_RX 55
81#define OMAP_DMA_CRYPTO_DES_OUT 56
82
83#endif /* __OMAP1_DMA_CHANNEL_H */
diff --git a/arch/arm/mach-omap1/flash.c b/arch/arm/mach-omap1/flash.c
index 73ae6169aa4a..b3fb531af94e 100644
--- a/arch/arm/mach-omap1/flash.c
+++ b/arch/arm/mach-omap1/flash.c
@@ -10,7 +10,7 @@
10#include <linux/mtd/mtd.h> 10#include <linux/mtd/mtd.h>
11#include <linux/mtd/map.h> 11#include <linux/mtd/map.h>
12 12
13#include <plat/tc.h> 13#include <mach/tc.h>
14#include <mach/flash.h> 14#include <mach/flash.h>
15 15
16#include <mach/hardware.h> 16#include <mach/hardware.h>
diff --git a/arch/arm/mach-omap1/fpga.c b/arch/arm/mach-omap1/fpga.c
index 29ec50fc688d..4ec220d8da5c 100644
--- a/arch/arm/mach-omap1/fpga.c
+++ b/arch/arm/mach-omap1/fpga.c
@@ -27,7 +27,7 @@
27#include <asm/irq.h> 27#include <asm/irq.h>
28#include <asm/mach/irq.h> 28#include <asm/mach/irq.h>
29 29
30#include <plat/fpga.h> 30#include <../plat-omap/fpga.h>
31 31
32#include <mach/hardware.h> 32#include <mach/hardware.h>
33 33
diff --git a/arch/arm/mach-omap1/i2c.c b/arch/arm/mach-omap1/i2c.c
index a0551a6d7451..32bcbb8d6c73 100644
--- a/arch/arm/mach-omap1/i2c.c
+++ b/arch/arm/mach-omap1/i2c.c
@@ -19,11 +19,25 @@
19 * 19 *
20 */ 20 */
21 21
22#include <plat/i2c.h> 22#include <linux/i2c-omap.h>
23#include <mach/mux.h> 23#include <mach/mux.h>
24#include <plat/cpu.h> 24#include "soc.h"
25 25
26void __init omap1_i2c_mux_pins(int bus_id) 26#include "../plat-omap/i2c.h"
27
28#define OMAP_I2C_SIZE 0x3f
29#define OMAP1_I2C_BASE 0xfffb3800
30#define OMAP1_INT_I2C (32 + 4)
31
32static const char name[] = "omap_i2c";
33
34static struct resource i2c_resources[2] = {
35};
36
37static struct platform_device omap_i2c_devices[1] = {
38};
39
40static void __init omap1_i2c_mux_pins(int bus_id)
27{ 41{
28 if (cpu_is_omap7xx()) { 42 if (cpu_is_omap7xx()) {
29 omap_cfg_reg(I2C_7XX_SDA); 43 omap_cfg_reg(I2C_7XX_SDA);
@@ -33,3 +47,44 @@ void __init omap1_i2c_mux_pins(int bus_id)
33 omap_cfg_reg(I2C_SCL); 47 omap_cfg_reg(I2C_SCL);
34 } 48 }
35} 49}
50
51int __init omap_i2c_add_bus(struct omap_i2c_bus_platform_data *pdata,
52 int bus_id)
53{
54 struct platform_device *pdev;
55 struct resource *res;
56
57 omap1_i2c_mux_pins(bus_id);
58
59 pdev = &omap_i2c_devices[bus_id - 1];
60 pdev->id = bus_id;
61 pdev->name = name;
62 pdev->num_resources = ARRAY_SIZE(i2c_resources);
63 res = i2c_resources;
64 res[0].start = OMAP1_I2C_BASE;
65 res[0].end = res[0].start + OMAP_I2C_SIZE;
66 res[0].flags = IORESOURCE_MEM;
67 res[1].start = OMAP1_INT_I2C;
68 res[1].flags = IORESOURCE_IRQ;
69 pdev->resource = res;
70
71 /* all OMAP1 have IP version 1 register set */
72 pdata->rev = OMAP_I2C_IP_VERSION_1;
73
74 /* all OMAP1 I2C are implemented like this */
75 pdata->flags = OMAP_I2C_FLAG_NO_FIFO |
76 OMAP_I2C_FLAG_SIMPLE_CLOCK |
77 OMAP_I2C_FLAG_16BIT_DATA_REG |
78 OMAP_I2C_FLAG_ALWAYS_ARMXOR_CLK;
79
80 /* how the cpu bus is wired up differs for 7xx only */
81
82 if (cpu_is_omap7xx())
83 pdata->flags |= OMAP_I2C_FLAG_BUS_SHIFT_1;
84 else
85 pdata->flags |= OMAP_I2C_FLAG_BUS_SHIFT_2;
86
87 pdev->dev.platform_data = pdata;
88
89 return platform_device_register(pdev);
90}
diff --git a/arch/arm/mach-omap1/id.c b/arch/arm/mach-omap1/id.c
index a1b846aacdaf..52de382fc804 100644
--- a/arch/arm/mach-omap1/id.c
+++ b/arch/arm/mach-omap1/id.c
@@ -17,7 +17,7 @@
17#include <linux/io.h> 17#include <linux/io.h>
18#include <asm/system_info.h> 18#include <asm/system_info.h>
19 19
20#include <plat/cpu.h> 20#include "soc.h"
21 21
22#include <mach/hardware.h> 22#include <mach/hardware.h>
23 23
diff --git a/arch/arm/mach-omap1/include/mach/hardware.h b/arch/arm/mach-omap1/include/mach/hardware.h
index 84248d250adb..f9989d38c464 100644
--- a/arch/arm/mach-omap1/include/mach/hardware.h
+++ b/arch/arm/mach-omap1/include/mach/hardware.h
@@ -39,7 +39,7 @@
39#include <asm/sizes.h> 39#include <asm/sizes.h>
40#ifndef __ASSEMBLER__ 40#ifndef __ASSEMBLER__
41#include <asm/types.h> 41#include <asm/types.h>
42#include <plat/cpu.h> 42#include "../../mach-omap1/soc.h"
43 43
44/* 44/*
45 * NOTE: Please use ioremap + __raw_read/write where possible instead of these 45 * NOTE: Please use ioremap + __raw_read/write where possible instead of these
@@ -51,7 +51,7 @@ extern void omap_writeb(u8 v, u32 pa);
51extern void omap_writew(u16 v, u32 pa); 51extern void omap_writew(u16 v, u32 pa);
52extern void omap_writel(u32 v, u32 pa); 52extern void omap_writel(u32 v, u32 pa);
53 53
54#include <plat/tc.h> 54#include <mach/tc.h>
55 55
56/* Almost all documentation for chip and board memory maps assumes 56/* Almost all documentation for chip and board memory maps assumes
57 * BM is clear. Most devel boards have a switch to control booting 57 * BM is clear. Most devel boards have a switch to control booting
diff --git a/arch/arm/mach-omap1/include/mach/memory.h b/arch/arm/mach-omap1/include/mach/memory.h
index 901082def9bd..351ae4f2c514 100644
--- a/arch/arm/mach-omap1/include/mach/memory.h
+++ b/arch/arm/mach-omap1/include/mach/memory.h
@@ -19,7 +19,7 @@
19 * because of the strncmp(). 19 * because of the strncmp().
20 */ 20 */
21#if defined(CONFIG_ARCH_OMAP15XX) && !defined(__ASSEMBLER__) 21#if defined(CONFIG_ARCH_OMAP15XX) && !defined(__ASSEMBLER__)
22#include <plat/cpu.h> 22#include "../../mach-omap1/soc.h"
23 23
24/* 24/*
25 * OMAP-1510 Local Bus address offset 25 * OMAP-1510 Local Bus address offset
diff --git a/arch/arm/mach-omap1/include/mach/omap1510.h b/arch/arm/mach-omap1/include/mach/omap1510.h
index 8fe05d6137c0..3d235244bf5c 100644
--- a/arch/arm/mach-omap1/include/mach/omap1510.h
+++ b/arch/arm/mach-omap1/include/mach/omap1510.h
@@ -45,5 +45,118 @@
45 45
46#define OMAP1510_DSP_MMU_BASE (0xfffed200) 46#define OMAP1510_DSP_MMU_BASE (0xfffed200)
47 47
48/*
49 * ---------------------------------------------------------------------------
50 * OMAP-1510 FPGA
51 * ---------------------------------------------------------------------------
52 */
53#define OMAP1510_FPGA_BASE 0xE8000000 /* VA */
54#define OMAP1510_FPGA_SIZE SZ_4K
55#define OMAP1510_FPGA_START 0x08000000 /* PA */
56
57/* Revision */
58#define OMAP1510_FPGA_REV_LOW IOMEM(OMAP1510_FPGA_BASE + 0x0)
59#define OMAP1510_FPGA_REV_HIGH IOMEM(OMAP1510_FPGA_BASE + 0x1)
60#define OMAP1510_FPGA_LCD_PANEL_CONTROL IOMEM(OMAP1510_FPGA_BASE + 0x2)
61#define OMAP1510_FPGA_LED_DIGIT IOMEM(OMAP1510_FPGA_BASE + 0x3)
62#define INNOVATOR_FPGA_HID_SPI IOMEM(OMAP1510_FPGA_BASE + 0x4)
63#define OMAP1510_FPGA_POWER IOMEM(OMAP1510_FPGA_BASE + 0x5)
64
65/* Interrupt status */
66#define OMAP1510_FPGA_ISR_LO IOMEM(OMAP1510_FPGA_BASE + 0x6)
67#define OMAP1510_FPGA_ISR_HI IOMEM(OMAP1510_FPGA_BASE + 0x7)
68
69/* Interrupt mask */
70#define OMAP1510_FPGA_IMR_LO IOMEM(OMAP1510_FPGA_BASE + 0x8)
71#define OMAP1510_FPGA_IMR_HI IOMEM(OMAP1510_FPGA_BASE + 0x9)
72
73/* Reset registers */
74#define OMAP1510_FPGA_HOST_RESET IOMEM(OMAP1510_FPGA_BASE + 0xa)
75#define OMAP1510_FPGA_RST IOMEM(OMAP1510_FPGA_BASE + 0xb)
76
77#define OMAP1510_FPGA_AUDIO IOMEM(OMAP1510_FPGA_BASE + 0xc)
78#define OMAP1510_FPGA_DIP IOMEM(OMAP1510_FPGA_BASE + 0xe)
79#define OMAP1510_FPGA_FPGA_IO IOMEM(OMAP1510_FPGA_BASE + 0xf)
80#define OMAP1510_FPGA_UART1 IOMEM(OMAP1510_FPGA_BASE + 0x14)
81#define OMAP1510_FPGA_UART2 IOMEM(OMAP1510_FPGA_BASE + 0x15)
82#define OMAP1510_FPGA_OMAP1510_STATUS IOMEM(OMAP1510_FPGA_BASE + 0x16)
83#define OMAP1510_FPGA_BOARD_REV IOMEM(OMAP1510_FPGA_BASE + 0x18)
84#define INNOVATOR_FPGA_CAM_USB_CONTROL IOMEM(OMAP1510_FPGA_BASE + 0x20c)
85#define OMAP1510P1_PPT_DATA IOMEM(OMAP1510_FPGA_BASE + 0x100)
86#define OMAP1510P1_PPT_STATUS IOMEM(OMAP1510_FPGA_BASE + 0x101)
87#define OMAP1510P1_PPT_CONTROL IOMEM(OMAP1510_FPGA_BASE + 0x102)
88
89#define OMAP1510_FPGA_TOUCHSCREEN IOMEM(OMAP1510_FPGA_BASE + 0x204)
90
91#define INNOVATOR_FPGA_INFO IOMEM(OMAP1510_FPGA_BASE + 0x205)
92#define INNOVATOR_FPGA_LCD_BRIGHT_LO IOMEM(OMAP1510_FPGA_BASE + 0x206)
93#define INNOVATOR_FPGA_LCD_BRIGHT_HI IOMEM(OMAP1510_FPGA_BASE + 0x207)
94#define INNOVATOR_FPGA_LED_GRN_LO IOMEM(OMAP1510_FPGA_BASE + 0x208)
95#define INNOVATOR_FPGA_LED_GRN_HI IOMEM(OMAP1510_FPGA_BASE + 0x209)
96#define INNOVATOR_FPGA_LED_RED_LO IOMEM(OMAP1510_FPGA_BASE + 0x20a)
97#define INNOVATOR_FPGA_LED_RED_HI IOMEM(OMAP1510_FPGA_BASE + 0x20b)
98#define INNOVATOR_FPGA_EXP_CONTROL IOMEM(OMAP1510_FPGA_BASE + 0x20d)
99#define INNOVATOR_FPGA_ISR2 IOMEM(OMAP1510_FPGA_BASE + 0x20e)
100#define INNOVATOR_FPGA_IMR2 IOMEM(OMAP1510_FPGA_BASE + 0x210)
101
102#define OMAP1510_FPGA_ETHR_START (OMAP1510_FPGA_START + 0x300)
103
104/*
105 * Power up Giga UART driver, turn on HID clock.
106 * Turn off BT power, since we're not using it and it
107 * draws power.
108 */
109#define OMAP1510_FPGA_RESET_VALUE 0x42
110
111#define OMAP1510_FPGA_PCR_IF_PD0 (1 << 7)
112#define OMAP1510_FPGA_PCR_COM2_EN (1 << 6)
113#define OMAP1510_FPGA_PCR_COM1_EN (1 << 5)
114#define OMAP1510_FPGA_PCR_EXP_PD0 (1 << 4)
115#define OMAP1510_FPGA_PCR_EXP_PD1 (1 << 3)
116#define OMAP1510_FPGA_PCR_48MHZ_CLK (1 << 2)
117#define OMAP1510_FPGA_PCR_4MHZ_CLK (1 << 1)
118#define OMAP1510_FPGA_PCR_RSRVD_BIT0 (1 << 0)
119
120/*
121 * Innovator/OMAP1510 FPGA HID register bit definitions
122 */
123#define OMAP1510_FPGA_HID_SCLK (1<<0) /* output */
124#define OMAP1510_FPGA_HID_MOSI (1<<1) /* output */
125#define OMAP1510_FPGA_HID_nSS (1<<2) /* output 0/1 chip idle/select */
126#define OMAP1510_FPGA_HID_nHSUS (1<<3) /* output 0/1 host active/suspended */
127#define OMAP1510_FPGA_HID_MISO (1<<4) /* input */
128#define OMAP1510_FPGA_HID_ATN (1<<5) /* input 0/1 chip idle/ATN */
129#define OMAP1510_FPGA_HID_rsrvd (1<<6)
130#define OMAP1510_FPGA_HID_RESETn (1<<7) /* output - 0/1 USAR reset/run */
131
132/* The FPGA IRQ is cascaded through GPIO_13 */
133#define OMAP1510_INT_FPGA (IH_GPIO_BASE + 13)
134
135/* IRQ Numbers for interrupts muxed through the FPGA */
136#define OMAP1510_INT_FPGA_ATN (OMAP_FPGA_IRQ_BASE + 0)
137#define OMAP1510_INT_FPGA_ACK (OMAP_FPGA_IRQ_BASE + 1)
138#define OMAP1510_INT_FPGA2 (OMAP_FPGA_IRQ_BASE + 2)
139#define OMAP1510_INT_FPGA3 (OMAP_FPGA_IRQ_BASE + 3)
140#define OMAP1510_INT_FPGA4 (OMAP_FPGA_IRQ_BASE + 4)
141#define OMAP1510_INT_FPGA5 (OMAP_FPGA_IRQ_BASE + 5)
142#define OMAP1510_INT_FPGA6 (OMAP_FPGA_IRQ_BASE + 6)
143#define OMAP1510_INT_FPGA7 (OMAP_FPGA_IRQ_BASE + 7)
144#define OMAP1510_INT_FPGA8 (OMAP_FPGA_IRQ_BASE + 8)
145#define OMAP1510_INT_FPGA9 (OMAP_FPGA_IRQ_BASE + 9)
146#define OMAP1510_INT_FPGA10 (OMAP_FPGA_IRQ_BASE + 10)
147#define OMAP1510_INT_FPGA11 (OMAP_FPGA_IRQ_BASE + 11)
148#define OMAP1510_INT_FPGA12 (OMAP_FPGA_IRQ_BASE + 12)
149#define OMAP1510_INT_ETHER (OMAP_FPGA_IRQ_BASE + 13)
150#define OMAP1510_INT_FPGAUART1 (OMAP_FPGA_IRQ_BASE + 14)
151#define OMAP1510_INT_FPGAUART2 (OMAP_FPGA_IRQ_BASE + 15)
152#define OMAP1510_INT_FPGA_TS (OMAP_FPGA_IRQ_BASE + 16)
153#define OMAP1510_INT_FPGA17 (OMAP_FPGA_IRQ_BASE + 17)
154#define OMAP1510_INT_FPGA_CAM (OMAP_FPGA_IRQ_BASE + 18)
155#define OMAP1510_INT_FPGA_RTC_A (OMAP_FPGA_IRQ_BASE + 19)
156#define OMAP1510_INT_FPGA_RTC_B (OMAP_FPGA_IRQ_BASE + 20)
157#define OMAP1510_INT_FPGA_CD (OMAP_FPGA_IRQ_BASE + 21)
158#define OMAP1510_INT_FPGA22 (OMAP_FPGA_IRQ_BASE + 22)
159#define OMAP1510_INT_FPGA23 (OMAP_FPGA_IRQ_BASE + 23)
160
48#endif /* __ASM_ARCH_OMAP15XX_H */ 161#endif /* __ASM_ARCH_OMAP15XX_H */
49 162
diff --git a/arch/arm/plat-omap/include/plat/tc.h b/arch/arm/mach-omap1/include/mach/tc.h
index 1b4b2da86203..1b4b2da86203 100644
--- a/arch/arm/plat-omap/include/plat/tc.h
+++ b/arch/arm/mach-omap1/include/mach/tc.h
diff --git a/arch/arm/mach-omap1/io.c b/arch/arm/mach-omap1/io.c
index 6a5baab1f4cb..44389d7cd255 100644
--- a/arch/arm/mach-omap1/io.c
+++ b/arch/arm/mach-omap1/io.c
@@ -17,8 +17,8 @@
17#include <asm/mach/map.h> 17#include <asm/mach/map.h>
18 18
19#include <mach/mux.h> 19#include <mach/mux.h>
20#include <plat/tc.h> 20#include <mach/tc.h>
21#include <plat/dma.h> 21#include <plat-omap/dma-omap.h>
22 22
23#include "iomap.h" 23#include "iomap.h"
24#include "common.h" 24#include "common.h"
diff --git a/arch/arm/mach-omap1/irq.c b/arch/arm/mach-omap1/irq.c
index 6995fb6a3345..122ef67939a2 100644
--- a/arch/arm/mach-omap1/irq.c
+++ b/arch/arm/mach-omap1/irq.c
@@ -45,7 +45,7 @@
45#include <asm/irq.h> 45#include <asm/irq.h>
46#include <asm/mach/irq.h> 46#include <asm/mach/irq.h>
47 47
48#include <plat/cpu.h> 48#include "soc.h"
49 49
50#include <mach/hardware.h> 50#include <mach/hardware.h>
51 51
diff --git a/arch/arm/mach-omap1/lcd_dma.c b/arch/arm/mach-omap1/lcd_dma.c
index ed42628611bc..7ed8c1857d56 100644
--- a/arch/arm/mach-omap1/lcd_dma.c
+++ b/arch/arm/mach-omap1/lcd_dma.c
@@ -27,11 +27,13 @@
27#include <linux/interrupt.h> 27#include <linux/interrupt.h>
28#include <linux/io.h> 28#include <linux/io.h>
29 29
30#include <plat/dma.h> 30#include <plat-omap/dma-omap.h>
31 31
32#include <mach/hardware.h> 32#include <mach/hardware.h>
33#include <mach/lcdc.h> 33#include <mach/lcdc.h>
34 34
35#include "dma.h"
36
35int omap_lcd_dma_running(void) 37int omap_lcd_dma_running(void)
36{ 38{
37 /* 39 /*
diff --git a/arch/arm/mach-omap1/mcbsp.c b/arch/arm/mach-omap1/mcbsp.c
index bdc2e7541adb..c6d8fdf92e9c 100644
--- a/arch/arm/mach-omap1/mcbsp.c
+++ b/arch/arm/mach-omap1/mcbsp.c
@@ -19,14 +19,15 @@
19#include <linux/platform_device.h> 19#include <linux/platform_device.h>
20#include <linux/slab.h> 20#include <linux/slab.h>
21 21
22#include <plat/dma.h> 22#include <plat-omap/dma-omap.h>
23#include <mach/mux.h> 23#include <mach/mux.h>
24#include <plat/cpu.h> 24#include "soc.h"
25#include <linux/platform_data/asoc-ti-mcbsp.h> 25#include <linux/platform_data/asoc-ti-mcbsp.h>
26 26
27#include <mach/irqs.h> 27#include <mach/irqs.h>
28 28
29#include "iomap.h" 29#include "iomap.h"
30#include "dma.h"
30 31
31#define DPS_RSTCT2_PER_EN (1 << 0) 32#define DPS_RSTCT2_PER_EN (1 << 0)
32#define DSP_RSTCT2_WD_PER_EN (1 << 1) 33#define DSP_RSTCT2_WD_PER_EN (1 << 1)
diff --git a/arch/arm/mach-omap1/mmc.h b/arch/arm/mach-omap1/mmc.h
new file mode 100644
index 000000000000..39c2b13de884
--- /dev/null
+++ b/arch/arm/mach-omap1/mmc.h
@@ -0,0 +1,18 @@
1#include <linux/mmc/host.h>
2#include <linux/platform_data/mmc-omap.h>
3
4#define OMAP15XX_NR_MMC 1
5#define OMAP16XX_NR_MMC 2
6#define OMAP1_MMC_SIZE 0x080
7#define OMAP1_MMC1_BASE 0xfffb7800
8#define OMAP1_MMC2_BASE 0xfffb7c00 /* omap16xx only */
9
10#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
11void omap1_init_mmc(struct omap_mmc_platform_data **mmc_data,
12 int nr_controllers);
13#else
14static inline void omap1_init_mmc(struct omap_mmc_platform_data **mmc_data,
15 int nr_controllers)
16{
17}
18#endif
diff --git a/arch/arm/mach-omap1/opp_data.c b/arch/arm/mach-omap1/opp_data.c
index 9cd4ddb51397..8dcebe6d8882 100644
--- a/arch/arm/mach-omap1/opp_data.c
+++ b/arch/arm/mach-omap1/opp_data.c
@@ -10,7 +10,7 @@
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11 */ 11 */
12 12
13#include <plat/clkdev_omap.h> 13#include "clock.h"
14#include "opp.h" 14#include "opp.h"
15 15
16/*------------------------------------------------------------------------- 16/*-------------------------------------------------------------------------
diff --git a/arch/arm/mach-omap1/pm.c b/arch/arm/mach-omap1/pm.c
index 47ec16155483..b2c2328d7c18 100644
--- a/arch/arm/mach-omap1/pm.c
+++ b/arch/arm/mach-omap1/pm.c
@@ -49,17 +49,17 @@
49#include <asm/mach/time.h> 49#include <asm/mach/time.h>
50#include <asm/mach/irq.h> 50#include <asm/mach/irq.h>
51 51
52#include <plat/cpu.h> 52#include <mach/tc.h>
53#include <plat/clock.h>
54#include <plat/sram.h>
55#include <plat/tc.h>
56#include <mach/mux.h> 53#include <mach/mux.h>
57#include <plat/dma.h> 54#include <plat-omap/dma-omap.h>
58#include <plat/dmtimer.h> 55#include <plat/dmtimer.h>
59 56
60#include <mach/irqs.h> 57#include <mach/irqs.h>
61 58
59#include "../plat-omap/sram.h"
60
62#include "iomap.h" 61#include "iomap.h"
62#include "clock.h"
63#include "pm.h" 63#include "pm.h"
64 64
65static unsigned int arm_sleep_save[ARM_SLEEP_SAVE_SIZE]; 65static unsigned int arm_sleep_save[ARM_SLEEP_SAVE_SIZE];
diff --git a/arch/arm/mach-omap1/pm_bus.c b/arch/arm/mach-omap1/pm_bus.c
index 7868e75ad077..16bf2f95117c 100644
--- a/arch/arm/mach-omap1/pm_bus.c
+++ b/arch/arm/mach-omap1/pm_bus.c
@@ -19,9 +19,6 @@
19#include <linux/clk.h> 19#include <linux/clk.h>
20#include <linux/err.h> 20#include <linux/err.h>
21 21
22#include <plat/omap_device.h>
23#include <plat/omap-pm.h>
24
25#ifdef CONFIG_PM_RUNTIME 22#ifdef CONFIG_PM_RUNTIME
26static int omap1_pm_runtime_suspend(struct device *dev) 23static int omap1_pm_runtime_suspend(struct device *dev)
27{ 24{
diff --git a/arch/arm/mach-omap1/serial.c b/arch/arm/mach-omap1/serial.c
index b9d6834af835..d1ac08016f0b 100644
--- a/arch/arm/mach-omap1/serial.c
+++ b/arch/arm/mach-omap1/serial.c
@@ -23,7 +23,6 @@
23#include <asm/mach-types.h> 23#include <asm/mach-types.h>
24 24
25#include <mach/mux.h> 25#include <mach/mux.h>
26#include <plat/fpga.h>
27 26
28#include "pm.h" 27#include "pm.h"
29 28
diff --git a/arch/arm/mach-omap1/soc.h b/arch/arm/mach-omap1/soc.h
new file mode 100644
index 000000000000..6cf9c1cc2bef
--- /dev/null
+++ b/arch/arm/mach-omap1/soc.h
@@ -0,0 +1,229 @@
1/*
2 * OMAP cpu type detection
3 *
4 * Copyright (C) 2004, 2008 Nokia Corporation
5 *
6 * Copyright (C) 2009-11 Texas Instruments.
7 *
8 * Written by Tony Lindgren <tony.lindgren@nokia.com>
9 *
10 * Added OMAP4/5 specific defines - Santosh Shilimkar<santosh.shilimkar@ti.com>
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 *
26 */
27
28#ifndef __ASM_ARCH_OMAP_CPU_H
29#define __ASM_ARCH_OMAP_CPU_H
30
31#ifndef __ASSEMBLY__
32
33#include <linux/bitops.h>
34
35/*
36 * Test if multicore OMAP support is needed
37 */
38#undef MULTI_OMAP1
39#undef OMAP_NAME
40
41#ifdef CONFIG_ARCH_OMAP730
42# ifdef OMAP_NAME
43# undef MULTI_OMAP1
44# define MULTI_OMAP1
45# else
46# define OMAP_NAME omap730
47# endif
48#endif
49#ifdef CONFIG_ARCH_OMAP850
50# ifdef OMAP_NAME
51# undef MULTI_OMAP1
52# define MULTI_OMAP1
53# else
54# define OMAP_NAME omap850
55# endif
56#endif
57#ifdef CONFIG_ARCH_OMAP15XX
58# ifdef OMAP_NAME
59# undef MULTI_OMAP1
60# define MULTI_OMAP1
61# else
62# define OMAP_NAME omap1510
63# endif
64#endif
65#ifdef CONFIG_ARCH_OMAP16XX
66# ifdef OMAP_NAME
67# undef MULTI_OMAP1
68# define MULTI_OMAP1
69# else
70# define OMAP_NAME omap16xx
71# endif
72#endif
73
74/*
75 * omap_rev bits:
76 * CPU id bits (0730, 1510, 1710, 2422...) [31:16]
77 * CPU revision (See _REV_ defined in cpu.h) [15:08]
78 * CPU class bits (15xx, 16xx, 24xx, 34xx...) [07:00]
79 */
80unsigned int omap_rev(void);
81
82/*
83 * Get the CPU revision for OMAP devices
84 */
85#define GET_OMAP_REVISION() ((omap_rev() >> 8) & 0xff)
86
87/*
88 * Macros to group OMAP into cpu classes.
89 * These can be used in most places.
90 * cpu_is_omap7xx(): True for OMAP730, OMAP850
91 * cpu_is_omap15xx(): True for OMAP1510, OMAP5910 and OMAP310
92 * cpu_is_omap16xx(): True for OMAP1610, OMAP5912 and OMAP1710
93 */
94#define GET_OMAP_CLASS (omap_rev() & 0xff)
95
96#define IS_OMAP_CLASS(class, id) \
97static inline int is_omap ##class (void) \
98{ \
99 return (GET_OMAP_CLASS == (id)) ? 1 : 0; \
100}
101
102#define GET_OMAP_SUBCLASS ((omap_rev() >> 20) & 0x0fff)
103
104#define IS_OMAP_SUBCLASS(subclass, id) \
105static inline int is_omap ##subclass (void) \
106{ \
107 return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \
108}
109
110IS_OMAP_CLASS(7xx, 0x07)
111IS_OMAP_CLASS(15xx, 0x15)
112IS_OMAP_CLASS(16xx, 0x16)
113
114#define cpu_is_omap7xx() 0
115#define cpu_is_omap15xx() 0
116#define cpu_is_omap16xx() 0
117
118#if defined(MULTI_OMAP1)
119# if defined(CONFIG_ARCH_OMAP730)
120# undef cpu_is_omap7xx
121# define cpu_is_omap7xx() is_omap7xx()
122# endif
123# if defined(CONFIG_ARCH_OMAP850)
124# undef cpu_is_omap7xx
125# define cpu_is_omap7xx() is_omap7xx()
126# endif
127# if defined(CONFIG_ARCH_OMAP15XX)
128# undef cpu_is_omap15xx
129# define cpu_is_omap15xx() is_omap15xx()
130# endif
131# if defined(CONFIG_ARCH_OMAP16XX)
132# undef cpu_is_omap16xx
133# define cpu_is_omap16xx() is_omap16xx()
134# endif
135#else
136# if defined(CONFIG_ARCH_OMAP730)
137# undef cpu_is_omap7xx
138# define cpu_is_omap7xx() 1
139# endif
140# if defined(CONFIG_ARCH_OMAP850)
141# undef cpu_is_omap7xx
142# define cpu_is_omap7xx() 1
143# endif
144# if defined(CONFIG_ARCH_OMAP15XX)
145# undef cpu_is_omap15xx
146# define cpu_is_omap15xx() 1
147# endif
148# if defined(CONFIG_ARCH_OMAP16XX)
149# undef cpu_is_omap16xx
150# define cpu_is_omap16xx() 1
151# endif
152#endif
153
154/*
155 * Macros to detect individual cpu types.
156 * These are only rarely needed.
157 * cpu_is_omap310(): True for OMAP310
158 * cpu_is_omap1510(): True for OMAP1510
159 * cpu_is_omap1610(): True for OMAP1610
160 * cpu_is_omap1611(): True for OMAP1611
161 * cpu_is_omap5912(): True for OMAP5912
162 * cpu_is_omap1621(): True for OMAP1621
163 * cpu_is_omap1710(): True for OMAP1710
164 */
165#define GET_OMAP_TYPE ((omap_rev() >> 16) & 0xffff)
166
167#define IS_OMAP_TYPE(type, id) \
168static inline int is_omap ##type (void) \
169{ \
170 return (GET_OMAP_TYPE == (id)) ? 1 : 0; \
171}
172
173IS_OMAP_TYPE(310, 0x0310)
174IS_OMAP_TYPE(1510, 0x1510)
175IS_OMAP_TYPE(1610, 0x1610)
176IS_OMAP_TYPE(1611, 0x1611)
177IS_OMAP_TYPE(5912, 0x1611)
178IS_OMAP_TYPE(1621, 0x1621)
179IS_OMAP_TYPE(1710, 0x1710)
180
181#define cpu_is_omap310() 0
182#define cpu_is_omap1510() 0
183#define cpu_is_omap1610() 0
184#define cpu_is_omap5912() 0
185#define cpu_is_omap1611() 0
186#define cpu_is_omap1621() 0
187#define cpu_is_omap1710() 0
188
189/* These are needed to compile common code */
190#ifdef CONFIG_ARCH_OMAP1
191#define cpu_is_omap242x() 0
192#define cpu_is_omap2430() 0
193#define cpu_is_omap243x() 0
194#define cpu_is_omap24xx() 0
195#define cpu_is_omap34xx() 0
196#define cpu_is_omap44xx() 0
197#define soc_is_omap54xx() 0
198#define soc_is_am33xx() 0
199#define cpu_class_is_omap1() 1
200#define cpu_class_is_omap2() 0
201#endif
202
203/*
204 * Whether we have MULTI_OMAP1 or not, we still need to distinguish
205 * between 310 vs. 1510 and 1611B/5912 vs. 1710.
206 */
207
208#if defined(CONFIG_ARCH_OMAP15XX)
209# undef cpu_is_omap310
210# undef cpu_is_omap1510
211# define cpu_is_omap310() is_omap310()
212# define cpu_is_omap1510() is_omap1510()
213#endif
214
215#if defined(CONFIG_ARCH_OMAP16XX)
216# undef cpu_is_omap1610
217# undef cpu_is_omap1611
218# undef cpu_is_omap5912
219# undef cpu_is_omap1621
220# undef cpu_is_omap1710
221# define cpu_is_omap1610() is_omap1610()
222# define cpu_is_omap1611() is_omap1611()
223# define cpu_is_omap5912() is_omap5912()
224# define cpu_is_omap1621() is_omap1621()
225# define cpu_is_omap1710() is_omap1710()
226#endif
227
228#endif /* __ASSEMBLY__ */
229#endif
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index fe40d9e488c9..46d9071f0938 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -4,7 +4,8 @@
4 4
5# Common support 5# Common support
6obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer.o pm.o \ 6obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer.o pm.o \
7 common.o gpio.o dma.o wd_timer.o display.o i2c.o hdq1w.o omap_hwmod.o 7 common.o gpio.o dma.o wd_timer.o display.o i2c.o hdq1w.o omap_hwmod.o \
8 omap_device.o
8 9
9# INTCPS IP block support - XXX should be moved to drivers/ 10# INTCPS IP block support - XXX should be moved to drivers/
10obj-$(CONFIG_ARCH_OMAP2) += irq.o 11obj-$(CONFIG_ARCH_OMAP2) += irq.o
diff --git a/arch/arm/mach-omap2/am35xx-emac.c b/arch/arm/mach-omap2/am35xx-emac.c
index d0c54c573d34..af11dcdb7e2c 100644
--- a/arch/arm/mach-omap2/am35xx-emac.c
+++ b/arch/arm/mach-omap2/am35xx-emac.c
@@ -18,7 +18,7 @@
18#include <linux/err.h> 18#include <linux/err.h>
19#include <linux/davinci_emac.h> 19#include <linux/davinci_emac.h>
20#include <asm/system.h> 20#include <asm/system.h>
21#include <plat/omap_device.h> 21#include "omap_device.h"
22#include "am35xx.h" 22#include "am35xx.h"
23#include "control.h" 23#include "control.h"
24#include "am35xx-emac.h" 24#include "am35xx-emac.h"
diff --git a/arch/arm/mach-omap2/board-2430sdp.c b/arch/arm/mach-omap2/board-2430sdp.c
index 95b384d54f8a..49e49d0b7cf5 100644
--- a/arch/arm/mach-omap2/board-2430sdp.c
+++ b/arch/arm/mach-omap2/board-2430sdp.c
@@ -34,7 +34,7 @@
34#include <asm/mach/map.h> 34#include <asm/mach/map.h>
35 35
36#include "common.h" 36#include "common.h"
37#include <plat/gpmc.h> 37#include "gpmc.h"
38#include <plat/usb.h> 38#include <plat/usb.h>
39#include "gpmc-smc91x.h" 39#include "gpmc-smc91x.h"
40 40
diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c
index 96cd3693e1ae..d2a419fcfce3 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -32,13 +32,14 @@
32 32
33#include <plat/usb.h> 33#include <plat/usb.h>
34#include "common.h" 34#include "common.h"
35#include <plat/dma.h> 35#include <plat-omap/dma-omap.h>
36#include <plat/gpmc.h>
37#include <video/omapdss.h> 36#include <video/omapdss.h>
38#include <video/omap-panel-tfp410.h> 37#include <video/omap-panel-tfp410.h>
39 38
39#include "gpmc.h"
40#include "gpmc-smc91x.h" 40#include "gpmc-smc91x.h"
41 41
42#include "soc.h"
42#include "board-flash.h" 43#include "board-flash.h"
43#include "mux.h" 44#include "mux.h"
44#include "sdram-qimonda-hyb18m512160af-6.h" 45#include "sdram-qimonda-hyb18m512160af-6.h"
diff --git a/arch/arm/mach-omap2/board-3630sdp.c b/arch/arm/mach-omap2/board-3630sdp.c
index fc224ad86747..f1df60102a65 100644
--- a/arch/arm/mach-omap2/board-3630sdp.c
+++ b/arch/arm/mach-omap2/board-3630sdp.c
@@ -20,7 +20,7 @@
20#include "gpmc-smc91x.h" 20#include "gpmc-smc91x.h"
21#include <plat/usb.h> 21#include <plat/usb.h>
22 22
23#include <mach/board-zoom.h> 23#include "board-zoom.h"
24 24
25#include "board-flash.h" 25#include "board-flash.h"
26#include "mux.h" 26#include "mux.h"
diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
index 3669c120c7e8..2ab267ec3b75 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -35,7 +35,6 @@
35 35
36#include "common.h" 36#include "common.h"
37#include <plat/usb.h> 37#include <plat/usb.h>
38#include <plat/mmc.h>
39#include "omap4-keypad.h" 38#include "omap4-keypad.h"
40#include <video/omapdss.h> 39#include <video/omapdss.h>
41#include <video/omap-panel-nokia-dsi.h> 40#include <video/omap-panel-nokia-dsi.h>
@@ -45,6 +44,7 @@
45 44
46#include "soc.h" 45#include "soc.h"
47#include "mux.h" 46#include "mux.h"
47#include "mmc.h"
48#include "hsmmc.h" 48#include "hsmmc.h"
49#include "control.h" 49#include "control.h"
50#include "common-board-devices.h" 50#include "common-board-devices.h"
diff --git a/arch/arm/mach-omap2/board-apollon.c b/arch/arm/mach-omap2/board-apollon.c
index cea3abace815..64cf1bde0f3b 100644
--- a/arch/arm/mach-omap2/board-apollon.c
+++ b/arch/arm/mach-omap2/board-apollon.c
@@ -28,14 +28,14 @@
28#include <linux/clk.h> 28#include <linux/clk.h>
29#include <linux/smc91x.h> 29#include <linux/smc91x.h>
30#include <linux/gpio.h> 30#include <linux/gpio.h>
31#include <linux/platform_data/leds-omap.h>
31 32
32#include <asm/mach-types.h> 33#include <asm/mach-types.h>
33#include <asm/mach/arch.h> 34#include <asm/mach/arch.h>
34#include <asm/mach/flash.h> 35#include <asm/mach/flash.h>
35 36
36#include <plat/led.h>
37#include "common.h" 37#include "common.h"
38#include <plat/gpmc.h> 38#include "gpmc.h"
39 39
40#include <video/omapdss.h> 40#include <video/omapdss.h>
41#include <video/omap-panel-generic-dpi.h> 41#include <video/omap-panel-generic-dpi.h>
diff --git a/arch/arm/mach-omap2/board-cm-t35.c b/arch/arm/mach-omap2/board-cm-t35.c
index 376d26eb601c..73e2ba9b343b 100644
--- a/arch/arm/mach-omap2/board-cm-t35.c
+++ b/arch/arm/mach-omap2/board-cm-t35.c
@@ -40,7 +40,7 @@
40 40
41#include "common.h" 41#include "common.h"
42#include <linux/platform_data/mtd-nand-omap2.h> 42#include <linux/platform_data/mtd-nand-omap2.h>
43#include <plat/gpmc.h> 43#include "gpmc.h"
44#include <plat/usb.h> 44#include <plat/usb.h>
45#include <video/omapdss.h> 45#include <video/omapdss.h>
46#include <video/omap-panel-generic-dpi.h> 46#include <video/omap-panel-generic-dpi.h>
@@ -53,6 +53,7 @@
53#include "sdram-micron-mt46h32m32lf-6.h" 53#include "sdram-micron-mt46h32m32lf-6.h"
54#include "hsmmc.h" 54#include "hsmmc.h"
55#include "common-board-devices.h" 55#include "common-board-devices.h"
56#include "gpmc-nand.h"
56 57
57#define CM_T35_GPIO_PENDOWN 57 58#define CM_T35_GPIO_PENDOWN 57
58#define SB_T35_USB_HUB_RESET_GPIO 167 59#define SB_T35_USB_HUB_RESET_GPIO 167
@@ -181,7 +182,7 @@ static struct omap_nand_platform_data cm_t35_nand_data = {
181 182
182static void __init cm_t35_init_nand(void) 183static void __init cm_t35_init_nand(void)
183{ 184{
184 if (gpmc_nand_init(&cm_t35_nand_data) < 0) 185 if (gpmc_nand_init(&cm_t35_nand_data, NULL) < 0)
185 pr_err("CM-T35: Unable to register NAND device\n"); 186 pr_err("CM-T35: Unable to register NAND device\n");
186} 187}
187#else 188#else
diff --git a/arch/arm/mach-omap2/board-cm-t3517.c b/arch/arm/mach-omap2/board-cm-t3517.c
index 59c0a45f75b0..b5495e415024 100644
--- a/arch/arm/mach-omap2/board-cm-t3517.c
+++ b/arch/arm/mach-omap2/board-cm-t3517.c
@@ -41,7 +41,7 @@
41#include "common.h" 41#include "common.h"
42#include <plat/usb.h> 42#include <plat/usb.h>
43#include <linux/platform_data/mtd-nand-omap2.h> 43#include <linux/platform_data/mtd-nand-omap2.h>
44#include <plat/gpmc.h> 44#include "gpmc.h"
45 45
46#include "am35xx.h" 46#include "am35xx.h"
47 47
@@ -49,6 +49,7 @@
49#include "control.h" 49#include "control.h"
50#include "common-board-devices.h" 50#include "common-board-devices.h"
51#include "am35xx-emac.h" 51#include "am35xx-emac.h"
52#include "gpmc-nand.h"
52 53
53#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE) 54#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
54static struct gpio_led cm_t3517_leds[] = { 55static struct gpio_led cm_t3517_leds[] = {
@@ -240,7 +241,7 @@ static struct omap_nand_platform_data cm_t3517_nand_data = {
240 241
241static void __init cm_t3517_init_nand(void) 242static void __init cm_t3517_init_nand(void)
242{ 243{
243 if (gpmc_nand_init(&cm_t3517_nand_data) < 0) 244 if (gpmc_nand_init(&cm_t3517_nand_data, NULL) < 0)
244 pr_err("CM-T3517: NAND initialization failed\n"); 245 pr_err("CM-T3517: NAND initialization failed\n");
245} 246}
246#else 247#else
diff --git a/arch/arm/mach-omap2/board-devkit8000.c b/arch/arm/mach-omap2/board-devkit8000.c
index 1fd161e934c7..3eedb8fd0370 100644
--- a/arch/arm/mach-omap2/board-devkit8000.c
+++ b/arch/arm/mach-omap2/board-devkit8000.c
@@ -39,7 +39,7 @@
39#include <asm/mach/flash.h> 39#include <asm/mach/flash.h>
40 40
41#include "common.h" 41#include "common.h"
42#include <plat/gpmc.h> 42#include "gpmc.h"
43#include <linux/platform_data/mtd-nand-omap2.h> 43#include <linux/platform_data/mtd-nand-omap2.h>
44#include <plat/usb.h> 44#include <plat/usb.h>
45#include <video/omapdss.h> 45#include <video/omapdss.h>
@@ -55,8 +55,11 @@
55#include "sdram-micron-mt46h32m32lf-6.h" 55#include "sdram-micron-mt46h32m32lf-6.h"
56#include "mux.h" 56#include "mux.h"
57#include "hsmmc.h" 57#include "hsmmc.h"
58#include "board-flash.h"
58#include "common-board-devices.h" 59#include "common-board-devices.h"
59 60
61#define NAND_CS 0
62
60#define OMAP_DM9000_GPIO_IRQ 25 63#define OMAP_DM9000_GPIO_IRQ 25
61#define OMAP3_DEVKIT_TS_GPIO 27 64#define OMAP3_DEVKIT_TS_GPIO 27
62 65
@@ -621,8 +624,9 @@ static void __init devkit8000_init(void)
621 624
622 usb_musb_init(NULL); 625 usb_musb_init(NULL);
623 usbhs_init(&usbhs_bdata); 626 usbhs_init(&usbhs_bdata);
624 omap_nand_flash_init(NAND_BUSWIDTH_16, devkit8000_nand_partitions, 627 board_nand_init(devkit8000_nand_partitions,
625 ARRAY_SIZE(devkit8000_nand_partitions)); 628 ARRAY_SIZE(devkit8000_nand_partitions), NAND_CS,
629 NAND_BUSWIDTH_16, NULL);
626 omap_twl4030_audio_init("omap3beagle"); 630 omap_twl4030_audio_init("omap3beagle");
627 631
628 /* Ensure SDRC pins are mux'd for self-refresh */ 632 /* Ensure SDRC pins are mux'd for self-refresh */
diff --git a/arch/arm/mach-omap2/board-flash.c b/arch/arm/mach-omap2/board-flash.c
index e642acf9cad0..c33adea0247c 100644
--- a/arch/arm/mach-omap2/board-flash.c
+++ b/arch/arm/mach-omap2/board-flash.c
@@ -17,14 +17,14 @@
17#include <linux/mtd/physmap.h> 17#include <linux/mtd/physmap.h>
18#include <linux/io.h> 18#include <linux/io.h>
19 19
20#include <plat/cpu.h>
21#include <plat/gpmc.h>
22#include <linux/platform_data/mtd-nand-omap2.h> 20#include <linux/platform_data/mtd-nand-omap2.h>
23#include <linux/platform_data/mtd-onenand-omap2.h> 21#include <linux/platform_data/mtd-onenand-omap2.h>
24#include <plat/tc.h>
25 22
23#include "soc.h"
26#include "common.h" 24#include "common.h"
27#include "board-flash.h" 25#include "board-flash.h"
26#include "gpmc-onenand.h"
27#include "gpmc-nand.h"
28 28
29#define REG_FPGA_REV 0x10 29#define REG_FPGA_REV 0x10
30#define REG_FPGA_DIP_SWITCH_INPUT2 0x60 30#define REG_FPGA_DIP_SWITCH_INPUT2 0x60
@@ -104,36 +104,35 @@ __init board_onenand_init(struct mtd_partition *onenand_parts,
104 defined(CONFIG_MTD_NAND_OMAP2_MODULE) 104 defined(CONFIG_MTD_NAND_OMAP2_MODULE)
105 105
106/* Note that all values in this struct are in nanoseconds */ 106/* Note that all values in this struct are in nanoseconds */
107static struct gpmc_timings nand_timings = { 107struct gpmc_timings nand_default_timings[1] = {
108 {
109 .sync_clk = 0,
108 110
109 .sync_clk = 0, 111 .cs_on = 0,
112 .cs_rd_off = 36,
113 .cs_wr_off = 36,
110 114
111 .cs_on = 0, 115 .adv_on = 6,
112 .cs_rd_off = 36, 116 .adv_rd_off = 24,
113 .cs_wr_off = 36, 117 .adv_wr_off = 36,
114 118
115 .adv_on = 6, 119 .we_off = 30,
116 .adv_rd_off = 24, 120 .oe_off = 48,
117 .adv_wr_off = 36,
118 121
119 .we_off = 30, 122 .access = 54,
120 .oe_off = 48, 123 .rd_cycle = 72,
124 .wr_cycle = 72,
121 125
122 .access = 54, 126 .wr_access = 30,
123 .rd_cycle = 72, 127 .wr_data_mux_bus = 0,
124 .wr_cycle = 72, 128 },
125
126 .wr_access = 30,
127 .wr_data_mux_bus = 0,
128}; 129};
129 130
130static struct omap_nand_platform_data board_nand_data = { 131static struct omap_nand_platform_data board_nand_data;
131 .gpmc_t = &nand_timings,
132};
133 132
134void 133void
135__init board_nand_init(struct mtd_partition *nand_parts, 134__init board_nand_init(struct mtd_partition *nand_parts, u8 nr_parts, u8 cs,
136 u8 nr_parts, u8 cs, int nand_type) 135 int nand_type, struct gpmc_timings *gpmc_t)
137{ 136{
138 board_nand_data.cs = cs; 137 board_nand_data.cs = cs;
139 board_nand_data.parts = nand_parts; 138 board_nand_data.parts = nand_parts;
@@ -141,7 +140,7 @@ __init board_nand_init(struct mtd_partition *nand_parts,
141 board_nand_data.devsize = nand_type; 140 board_nand_data.devsize = nand_type;
142 141
143 board_nand_data.ecc_opt = OMAP_ECC_HAMMING_CODE_DEFAULT; 142 board_nand_data.ecc_opt = OMAP_ECC_HAMMING_CODE_DEFAULT;
144 gpmc_nand_init(&board_nand_data); 143 gpmc_nand_init(&board_nand_data, gpmc_t);
145} 144}
146#endif /* CONFIG_MTD_NAND_OMAP2 || CONFIG_MTD_NAND_OMAP2_MODULE */ 145#endif /* CONFIG_MTD_NAND_OMAP2 || CONFIG_MTD_NAND_OMAP2_MODULE */
147 146
@@ -238,5 +237,6 @@ void __init board_flash_init(struct flash_partitions partition_info[],
238 pr_err("NAND: Unable to find configuration in GPMC\n"); 237 pr_err("NAND: Unable to find configuration in GPMC\n");
239 else 238 else
240 board_nand_init(partition_info[2].parts, 239 board_nand_init(partition_info[2].parts,
241 partition_info[2].nr_parts, nandcs, nand_type); 240 partition_info[2].nr_parts, nandcs,
241 nand_type, nand_default_timings);
242} 242}
diff --git a/arch/arm/mach-omap2/board-flash.h b/arch/arm/mach-omap2/board-flash.h
index c44b70d52021..2fb5d41a9fae 100644
--- a/arch/arm/mach-omap2/board-flash.h
+++ b/arch/arm/mach-omap2/board-flash.h
@@ -12,7 +12,7 @@
12 */ 12 */
13#include <linux/mtd/mtd.h> 13#include <linux/mtd/mtd.h>
14#include <linux/mtd/partitions.h> 14#include <linux/mtd/partitions.h>
15#include <plat/gpmc.h> 15#include "gpmc.h"
16 16
17#define PDC_NOR 1 17#define PDC_NOR 1
18#define PDC_NAND 2 18#define PDC_NAND 2
@@ -40,12 +40,14 @@ static inline void board_flash_init(struct flash_partitions part[],
40#if defined(CONFIG_MTD_NAND_OMAP2) || \ 40#if defined(CONFIG_MTD_NAND_OMAP2) || \
41 defined(CONFIG_MTD_NAND_OMAP2_MODULE) 41 defined(CONFIG_MTD_NAND_OMAP2_MODULE)
42extern void board_nand_init(struct mtd_partition *nand_parts, 42extern void board_nand_init(struct mtd_partition *nand_parts,
43 u8 nr_parts, u8 cs, int nand_type); 43 u8 nr_parts, u8 cs, int nand_type, struct gpmc_timings *gpmc_t);
44extern struct gpmc_timings nand_default_timings[];
44#else 45#else
45static inline void board_nand_init(struct mtd_partition *nand_parts, 46static inline void board_nand_init(struct mtd_partition *nand_parts,
46 u8 nr_parts, u8 cs, int nand_type) 47 u8 nr_parts, u8 cs, int nand_type, struct gpmc_timings *gpmc_t)
47{ 48{
48} 49}
50#define nand_default_timings NULL
49#endif 51#endif
50 52
51#if defined(CONFIG_MTD_ONENAND_OMAP2) || \ 53#if defined(CONFIG_MTD_ONENAND_OMAP2) || \
diff --git a/arch/arm/mach-omap2/board-h4.c b/arch/arm/mach-omap2/board-h4.c
index 8d04bf851af4..366ebd93ae24 100644
--- a/arch/arm/mach-omap2/board-h4.c
+++ b/arch/arm/mach-omap2/board-h4.c
@@ -32,8 +32,7 @@
32#include <asm/mach/map.h> 32#include <asm/mach/map.h>
33 33
34#include <plat/menelaus.h> 34#include <plat/menelaus.h>
35#include <plat/dma.h> 35#include <plat-omap/dma-omap.h>
36#include <plat/gpmc.h>
37#include "debug-devices.h" 36#include "debug-devices.h"
38 37
39#include <video/omapdss.h> 38#include <video/omapdss.h>
@@ -42,6 +41,7 @@
42#include "common.h" 41#include "common.h"
43#include "mux.h" 42#include "mux.h"
44#include "control.h" 43#include "control.h"
44#include "gpmc.h"
45 45
46#define H4_FLASH_CS 0 46#define H4_FLASH_CS 0
47#define H4_SMC91X_CS 1 47#define H4_SMC91X_CS 1
diff --git a/arch/arm/mach-omap2/board-igep0020.c b/arch/arm/mach-omap2/board-igep0020.c
index 48d5e41dfbfa..9a9a9b5f78b6 100644
--- a/arch/arm/mach-omap2/board-igep0020.c
+++ b/arch/arm/mach-omap2/board-igep0020.c
@@ -30,7 +30,7 @@
30#include <asm/mach/arch.h> 30#include <asm/mach/arch.h>
31 31
32#include "common.h" 32#include "common.h"
33#include <plat/gpmc.h> 33#include "gpmc.h"
34#include <plat/usb.h> 34#include <plat/usb.h>
35 35
36#include <video/omapdss.h> 36#include <video/omapdss.h>
@@ -43,6 +43,7 @@
43#include "common-board-devices.h" 43#include "common-board-devices.h"
44#include "board-flash.h" 44#include "board-flash.h"
45#include "control.h" 45#include "control.h"
46#include "gpmc-onenand.h"
46 47
47#define IGEP2_SMSC911X_CS 5 48#define IGEP2_SMSC911X_CS 5
48#define IGEP2_SMSC911X_GPIO 176 49#define IGEP2_SMSC911X_GPIO 176
@@ -175,7 +176,7 @@ static void __init igep_flash_init(void)
175 pr_info("IGEP: initializing NAND memory device\n"); 176 pr_info("IGEP: initializing NAND memory device\n");
176 board_nand_init(igep_flash_partitions, 177 board_nand_init(igep_flash_partitions,
177 ARRAY_SIZE(igep_flash_partitions), 178 ARRAY_SIZE(igep_flash_partitions),
178 0, NAND_BUSWIDTH_16); 179 0, NAND_BUSWIDTH_16, nand_default_timings);
179 } else if (mux == IGEP_SYSBOOT_ONENAND) { 180 } else if (mux == IGEP_SYSBOOT_ONENAND) {
180 pr_info("IGEP: initializing OneNAND memory device\n"); 181 pr_info("IGEP: initializing OneNAND memory device\n");
181 board_onenand_init(igep_flash_partitions, 182 board_onenand_init(igep_flash_partitions,
diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c
index ee8c3cfb95b3..35ee018d9289 100644
--- a/arch/arm/mach-omap2/board-ldp.c
+++ b/arch/arm/mach-omap2/board-ldp.c
@@ -35,8 +35,8 @@
35#include <asm/mach/map.h> 35#include <asm/mach/map.h>
36 36
37#include "common.h" 37#include "common.h"
38#include <plat/gpmc.h> 38#include "gpmc.h"
39#include <mach/board-zoom.h> 39#include "board-zoom.h"
40#include <plat/usb.h> 40#include <plat/usb.h>
41#include "gpmc-smsc911x.h" 41#include "gpmc-smsc911x.h"
42 42
@@ -420,8 +420,8 @@ static void __init omap_ldp_init(void)
420 omap_serial_init(); 420 omap_serial_init();
421 omap_sdrc_init(NULL, NULL); 421 omap_sdrc_init(NULL, NULL);
422 usb_musb_init(NULL); 422 usb_musb_init(NULL);
423 board_nand_init(ldp_nand_partitions, 423 board_nand_init(ldp_nand_partitions, ARRAY_SIZE(ldp_nand_partitions),
424 ARRAY_SIZE(ldp_nand_partitions), ZOOM_NAND_CS, 0); 424 ZOOM_NAND_CS, 0, nand_default_timings);
425 425
426 omap_hsmmc_init(mmc); 426 omap_hsmmc_init(mmc);
427 ldp_display_init(); 427 ldp_display_init();
diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c
index d95f727ca39a..cea433b9b7b9 100644
--- a/arch/arm/mach-omap2/board-n8x0.c
+++ b/arch/arm/mach-omap2/board-n8x0.c
@@ -29,9 +29,10 @@
29 29
30#include "common.h" 30#include "common.h"
31#include <plat/menelaus.h> 31#include <plat/menelaus.h>
32#include <plat/mmc.h> 32#include "mmc.h"
33 33
34#include "mux.h" 34#include "mux.h"
35#include "gpmc-onenand.h"
35 36
36#define TUSB6010_ASYNC_CS 1 37#define TUSB6010_ASYNC_CS 1
37#define TUSB6010_SYNC_CS 4 38#define TUSB6010_SYNC_CS 4
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index 388c431c745a..a5497ce0a6c8 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -41,16 +41,20 @@
41#include "common.h" 41#include "common.h"
42#include <video/omapdss.h> 42#include <video/omapdss.h>
43#include <video/omap-panel-tfp410.h> 43#include <video/omap-panel-tfp410.h>
44#include <plat/gpmc.h> 44#include "gpmc.h"
45#include <linux/platform_data/mtd-nand-omap2.h> 45#include <linux/platform_data/mtd-nand-omap2.h>
46#include <plat/usb.h> 46#include <plat/usb.h>
47#include <plat/omap_device.h> 47#include "omap_device.h"
48 48
49#include "soc.h"
49#include "mux.h" 50#include "mux.h"
50#include "hsmmc.h" 51#include "hsmmc.h"
51#include "pm.h" 52#include "pm.h"
53#include "board-flash.h"
52#include "common-board-devices.h" 54#include "common-board-devices.h"
53 55
56#define NAND_CS 0
57
54/* 58/*
55 * OMAP3 Beagle revision 59 * OMAP3 Beagle revision
56 * Run time detection of Beagle revision is done by reading GPIO. 60 * Run time detection of Beagle revision is done by reading GPIO.
@@ -512,8 +516,9 @@ static void __init omap3_beagle_init(void)
512 516
513 usb_musb_init(NULL); 517 usb_musb_init(NULL);
514 usbhs_init(&usbhs_bdata); 518 usbhs_init(&usbhs_bdata);
515 omap_nand_flash_init(NAND_BUSWIDTH_16, omap3beagle_nand_partitions, 519 board_nand_init(omap3beagle_nand_partitions,
516 ARRAY_SIZE(omap3beagle_nand_partitions)); 520 ARRAY_SIZE(omap3beagle_nand_partitions), NAND_CS,
521 NAND_BUSWIDTH_16, NULL);
517 omap_twl4030_audio_init("omap3beagle"); 522 omap_twl4030_audio_init("omap3beagle");
518 523
519 /* Ensure msecure is mux'd to be able to set the RTC. */ 524 /* Ensure msecure is mux'd to be able to set the RTC. */
diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
index b9b776b6c954..8479779fd346 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -52,10 +52,14 @@
52#include <video/omapdss.h> 52#include <video/omapdss.h>
53#include <video/omap-panel-tfp410.h> 53#include <video/omap-panel-tfp410.h>
54 54
55#include "soc.h"
55#include "mux.h" 56#include "mux.h"
56#include "sdram-micron-mt46h32m32lf-6.h" 57#include "sdram-micron-mt46h32m32lf-6.h"
57#include "hsmmc.h" 58#include "hsmmc.h"
58#include "common-board-devices.h" 59#include "common-board-devices.h"
60#include "board-flash.h"
61
62#define NAND_CS 0
59 63
60#define OMAP3_EVM_TS_GPIO 175 64#define OMAP3_EVM_TS_GPIO 175
61#define OMAP3_EVM_EHCI_VBUS 22 65#define OMAP3_EVM_EHCI_VBUS 22
@@ -731,8 +735,9 @@ static void __init omap3_evm_init(void)
731 } 735 }
732 usb_musb_init(&musb_board_data); 736 usb_musb_init(&musb_board_data);
733 usbhs_init(&usbhs_bdata); 737 usbhs_init(&usbhs_bdata);
734 omap_nand_flash_init(NAND_BUSWIDTH_16, omap3evm_nand_partitions, 738 board_nand_init(omap3evm_nand_partitions,
735 ARRAY_SIZE(omap3evm_nand_partitions)); 739 ARRAY_SIZE(omap3evm_nand_partitions), NAND_CS,
740 NAND_BUSWIDTH_16, NULL);
736 741
737 omap_ads7846_init(1, OMAP3_EVM_TS_GPIO, 310, NULL); 742 omap_ads7846_init(1, OMAP3_EVM_TS_GPIO, 310, NULL);
738 omap3evm_init_smsc911x(); 743 omap3evm_init_smsc911x();
diff --git a/arch/arm/mach-omap2/board-omap3logic.c b/arch/arm/mach-omap2/board-omap3logic.c
index 7bd8253b5d1d..6f58cad5bf74 100644
--- a/arch/arm/mach-omap2/board-omap3logic.c
+++ b/arch/arm/mach-omap2/board-omap3logic.c
@@ -34,9 +34,6 @@
34#include <asm/mach/arch.h> 34#include <asm/mach/arch.h>
35#include <asm/mach/map.h> 35#include <asm/mach/map.h>
36 36
37#include "gpmc-smsc911x.h"
38#include <plat/gpmc.h>
39#include <plat/sdrc.h>
40#include <plat/usb.h> 37#include <plat/usb.h>
41 38
42#include "common.h" 39#include "common.h"
@@ -44,6 +41,8 @@
44#include "hsmmc.h" 41#include "hsmmc.h"
45#include "control.h" 42#include "control.h"
46#include "common-board-devices.h" 43#include "common-board-devices.h"
44#include "gpmc.h"
45#include "gpmc-smsc911x.h"
47 46
48#define OMAP3LOGIC_SMSC911X_CS 1 47#define OMAP3LOGIC_SMSC911X_CS 1
49 48
diff --git a/arch/arm/mach-omap2/board-omap3pandora.c b/arch/arm/mach-omap2/board-omap3pandora.c
index 00a1f4ae6e44..f286b4b4bd5b 100644
--- a/arch/arm/mach-omap2/board-omap3pandora.c
+++ b/arch/arm/mach-omap2/board-omap3pandora.c
@@ -50,6 +50,7 @@
50#include "sdram-micron-mt46h32m32lf-6.h" 50#include "sdram-micron-mt46h32m32lf-6.h"
51#include "hsmmc.h" 51#include "hsmmc.h"
52#include "common-board-devices.h" 52#include "common-board-devices.h"
53#include "gpmc-nand.h"
53 54
54#define PANDORA_WIFI_IRQ_GPIO 21 55#define PANDORA_WIFI_IRQ_GPIO 21
55#define PANDORA_WIFI_NRESET_GPIO 23 56#define PANDORA_WIFI_NRESET_GPIO 23
@@ -602,7 +603,7 @@ static void __init omap3pandora_init(void)
602 omap_ads7846_init(1, OMAP3_PANDORA_TS_GPIO, 0, NULL); 603 omap_ads7846_init(1, OMAP3_PANDORA_TS_GPIO, 0, NULL);
603 usbhs_init(&usbhs_bdata); 604 usbhs_init(&usbhs_bdata);
604 usb_musb_init(NULL); 605 usb_musb_init(NULL);
605 gpmc_nand_init(&pandora_nand_data); 606 gpmc_nand_init(&pandora_nand_data, NULL);
606 607
607 /* Ensure SDRC pins are mux'd for self-refresh */ 608 /* Ensure SDRC pins are mux'd for self-refresh */
608 omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT); 609 omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
diff --git a/arch/arm/mach-omap2/board-omap3stalker.c b/arch/arm/mach-omap2/board-omap3stalker.c
index 731235eb319e..3c83b9fbff45 100644
--- a/arch/arm/mach-omap2/board-omap3stalker.c
+++ b/arch/arm/mach-omap2/board-omap3stalker.c
@@ -40,7 +40,7 @@
40#include <asm/mach/flash.h> 40#include <asm/mach/flash.h>
41 41
42#include "common.h" 42#include "common.h"
43#include <plat/gpmc.h> 43#include "gpmc.h"
44#include <linux/platform_data/mtd-nand-omap2.h> 44#include <linux/platform_data/mtd-nand-omap2.h>
45#include <plat/usb.h> 45#include <plat/usb.h>
46#include <video/omapdss.h> 46#include <video/omapdss.h>
diff --git a/arch/arm/mach-omap2/board-omap3touchbook.c b/arch/arm/mach-omap2/board-omap3touchbook.c
index 944ffc436577..cd282ae0856b 100644
--- a/arch/arm/mach-omap2/board-omap3touchbook.c
+++ b/arch/arm/mach-omap2/board-omap3touchbook.c
@@ -44,12 +44,13 @@
44#include <asm/system_info.h> 44#include <asm/system_info.h>
45 45
46#include "common.h" 46#include "common.h"
47#include <plat/gpmc.h> 47#include "gpmc.h"
48#include <linux/platform_data/mtd-nand-omap2.h> 48#include <linux/platform_data/mtd-nand-omap2.h>
49#include <plat/usb.h> 49#include <plat/usb.h>
50 50
51#include "mux.h" 51#include "mux.h"
52#include "hsmmc.h" 52#include "hsmmc.h"
53#include "board-flash.h"
53#include "common-board-devices.h" 54#include "common-board-devices.h"
54 55
55#include <asm/setup.h> 56#include <asm/setup.h>
@@ -59,6 +60,8 @@
59#define TB_BL_PWM_TIMER 9 60#define TB_BL_PWM_TIMER 9
60#define TB_KILL_POWER_GPIO 168 61#define TB_KILL_POWER_GPIO 168
61 62
63#define NAND_CS 0
64
62static unsigned long touchbook_revision; 65static unsigned long touchbook_revision;
63 66
64static struct mtd_partition omap3touchbook_nand_partitions[] = { 67static struct mtd_partition omap3touchbook_nand_partitions[] = {
@@ -365,8 +368,9 @@ static void __init omap3_touchbook_init(void)
365 omap_ads7846_init(4, OMAP3_TS_GPIO, 310, &ads7846_pdata); 368 omap_ads7846_init(4, OMAP3_TS_GPIO, 310, &ads7846_pdata);
366 usb_musb_init(NULL); 369 usb_musb_init(NULL);
367 usbhs_init(&usbhs_bdata); 370 usbhs_init(&usbhs_bdata);
368 omap_nand_flash_init(NAND_BUSWIDTH_16, omap3touchbook_nand_partitions, 371 board_nand_init(omap3touchbook_nand_partitions,
369 ARRAY_SIZE(omap3touchbook_nand_partitions)); 372 ARRAY_SIZE(omap3touchbook_nand_partitions), NAND_CS,
373 NAND_BUSWIDTH_16, NULL);
370 374
371 /* Ensure SDRC pins are mux'd for self-refresh */ 375 /* Ensure SDRC pins are mux'd for self-refresh */
372 omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT); 376 omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c
index bfcd397e233c..e9ce9fb9ffac 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -40,10 +40,10 @@
40 40
41#include "common.h" 41#include "common.h"
42#include <plat/usb.h> 42#include <plat/usb.h>
43#include <plat/mmc.h>
44#include <video/omap-panel-tfp410.h> 43#include <video/omap-panel-tfp410.h>
45 44
46#include "soc.h" 45#include "soc.h"
46#include "mmc.h"
47#include "hsmmc.h" 47#include "hsmmc.h"
48#include "control.h" 48#include "control.h"
49#include "mux.h" 49#include "mux.h"
diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c
index b700685762b5..3a9d1fa8bebd 100644
--- a/arch/arm/mach-omap2/board-overo.c
+++ b/arch/arm/mach-omap2/board-overo.c
@@ -49,14 +49,17 @@
49#include <video/omapdss.h> 49#include <video/omapdss.h>
50#include <video/omap-panel-generic-dpi.h> 50#include <video/omap-panel-generic-dpi.h>
51#include <video/omap-panel-tfp410.h> 51#include <video/omap-panel-tfp410.h>
52#include <plat/gpmc.h> 52#include "gpmc.h"
53#include <plat/usb.h> 53#include <plat/usb.h>
54 54
55#include "mux.h" 55#include "mux.h"
56#include "sdram-micron-mt46h32m32lf-6.h" 56#include "sdram-micron-mt46h32m32lf-6.h"
57#include "hsmmc.h" 57#include "hsmmc.h"
58#include "board-flash.h"
58#include "common-board-devices.h" 59#include "common-board-devices.h"
59 60
61#define NAND_CS 0
62
60#define OVERO_GPIO_BT_XGATE 15 63#define OVERO_GPIO_BT_XGATE 15
61#define OVERO_GPIO_W2W_NRESET 16 64#define OVERO_GPIO_W2W_NRESET 16
62#define OVERO_GPIO_PENDOWN 114 65#define OVERO_GPIO_PENDOWN 114
@@ -495,8 +498,8 @@ static void __init overo_init(void)
495 omap_serial_init(); 498 omap_serial_init();
496 omap_sdrc_init(mt46h32m32lf6_sdrc_params, 499 omap_sdrc_init(mt46h32m32lf6_sdrc_params,
497 mt46h32m32lf6_sdrc_params); 500 mt46h32m32lf6_sdrc_params);
498 omap_nand_flash_init(0, overo_nand_partitions, 501 board_nand_init(overo_nand_partitions,
499 ARRAY_SIZE(overo_nand_partitions)); 502 ARRAY_SIZE(overo_nand_partitions), NAND_CS, 0, NULL);
500 usb_musb_init(NULL); 503 usb_musb_init(NULL);
501 usbhs_init(&usbhs_bdata); 504 usbhs_init(&usbhs_bdata);
502 overo_spi_init(); 505 overo_spi_init();
diff --git a/arch/arm/mach-omap2/board-rm680.c b/arch/arm/mach-omap2/board-rm680.c
index 45997bfbcbd2..d42ecfe56096 100644
--- a/arch/arm/mach-omap2/board-rm680.c
+++ b/arch/arm/mach-omap2/board-rm680.c
@@ -22,17 +22,17 @@
22#include <asm/mach/arch.h> 22#include <asm/mach/arch.h>
23#include <asm/mach-types.h> 23#include <asm/mach-types.h>
24 24
25#include <plat/i2c.h>
26#include <plat/mmc.h>
27#include <plat/usb.h> 25#include <plat/usb.h>
28#include <plat/gpmc.h> 26#include "gpmc.h"
29#include "common.h" 27#include "common.h"
30#include <plat/serial.h> 28#include <plat/serial.h>
31 29
32#include "mux.h" 30#include "mux.h"
31#include "mmc.h"
33#include "hsmmc.h" 32#include "hsmmc.h"
34#include "sdram-nokia.h" 33#include "sdram-nokia.h"
35#include "common-board-devices.h" 34#include "common-board-devices.h"
35#include "gpmc-onenand.h"
36 36
37static struct regulator_consumer_supply rm680_vemmc_consumers[] = { 37static struct regulator_consumer_supply rm680_vemmc_consumers[] = {
38 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"), 38 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"),
diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c
index 020e03c95bfe..07005fe40a2a 100644
--- a/arch/arm/mach-omap2/board-rx51-peripherals.c
+++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
@@ -31,9 +31,7 @@
31#include <asm/system_info.h> 31#include <asm/system_info.h>
32 32
33#include "common.h" 33#include "common.h"
34#include <plat/dma.h> 34#include <plat-omap/dma-omap.h>
35#include <plat/gpmc.h>
36#include <plat/omap-pm.h>
37#include "gpmc-smc91x.h" 35#include "gpmc-smc91x.h"
38 36
39#include "board-rx51.h" 37#include "board-rx51.h"
@@ -52,8 +50,11 @@
52#endif 50#endif
53 51
54#include "mux.h" 52#include "mux.h"
53#include "omap-pm.h"
55#include "hsmmc.h" 54#include "hsmmc.h"
56#include "common-board-devices.h" 55#include "common-board-devices.h"
56#include "gpmc.h"
57#include "gpmc-onenand.h"
57 58
58#define SYSTEM_REV_B_USES_VAUX3 0x1699 59#define SYSTEM_REV_B_USES_VAUX3 0x1699
59#define SYSTEM_REV_S_USES_VAUX3 0x8 60#define SYSTEM_REV_S_USES_VAUX3 0x8
diff --git a/arch/arm/mach-omap2/board-rx51.c b/arch/arm/mach-omap2/board-rx51.c
index 7bbb05d9689b..63b33c63bd94 100644
--- a/arch/arm/mach-omap2/board-rx51.c
+++ b/arch/arm/mach-omap2/board-rx51.c
@@ -23,12 +23,12 @@
23#include <asm/mach/arch.h> 23#include <asm/mach/arch.h>
24#include <asm/mach/map.h> 24#include <asm/mach/map.h>
25 25
26#include "common.h" 26#include <plat-omap/dma-omap.h>
27#include <plat/dma.h>
28#include <plat/gpmc.h>
29#include <plat/usb.h> 27#include <plat/usb.h>
30 28
29#include "common.h"
31#include "mux.h" 30#include "mux.h"
31#include "gpmc.h"
32#include "pm.h" 32#include "pm.h"
33#include "sdram-nokia.h" 33#include "sdram-nokia.h"
34 34
diff --git a/arch/arm/mach-omap2/board-zoom-debugboard.c b/arch/arm/mach-omap2/board-zoom-debugboard.c
index afb2278a29f6..42e5f231a799 100644
--- a/arch/arm/mach-omap2/board-zoom-debugboard.c
+++ b/arch/arm/mach-omap2/board-zoom-debugboard.c
@@ -17,10 +17,10 @@
17#include <linux/regulator/fixed.h> 17#include <linux/regulator/fixed.h>
18#include <linux/regulator/machine.h> 18#include <linux/regulator/machine.h>
19 19
20#include <plat/gpmc.h> 20#include "gpmc.h"
21#include "gpmc-smsc911x.h" 21#include "gpmc-smsc911x.h"
22 22
23#include <mach/board-zoom.h> 23#include "board-zoom.h"
24 24
25#include "soc.h" 25#include "soc.h"
26#include "common.h" 26#include "common.h"
diff --git a/arch/arm/mach-omap2/board-zoom-display.c b/arch/arm/mach-omap2/board-zoom-display.c
index b940ab2259fb..1c7c834a5b5f 100644
--- a/arch/arm/mach-omap2/board-zoom-display.c
+++ b/arch/arm/mach-omap2/board-zoom-display.c
@@ -16,8 +16,9 @@
16#include <linux/spi/spi.h> 16#include <linux/spi/spi.h>
17#include <linux/platform_data/spi-omap2-mcspi.h> 17#include <linux/platform_data/spi-omap2-mcspi.h>
18#include <video/omapdss.h> 18#include <video/omapdss.h>
19#include <mach/board-zoom.h> 19#include "board-zoom.h"
20 20
21#include "soc.h"
21#include "common.h" 22#include "common.h"
22 23
23#define LCD_PANEL_RESET_GPIO_PROD 96 24#define LCD_PANEL_RESET_GPIO_PROD 96
diff --git a/arch/arm/mach-omap2/board-zoom-peripherals.c b/arch/arm/mach-omap2/board-zoom-peripherals.c
index c166fe1fdff9..74ac565ca9d0 100644
--- a/arch/arm/mach-omap2/board-zoom-peripherals.c
+++ b/arch/arm/mach-omap2/board-zoom-peripherals.c
@@ -28,7 +28,7 @@
28#include "common.h" 28#include "common.h"
29#include <plat/usb.h> 29#include <plat/usb.h>
30 30
31#include <mach/board-zoom.h> 31#include "board-zoom.h"
32 32
33#include "mux.h" 33#include "mux.h"
34#include "hsmmc.h" 34#include "hsmmc.h"
diff --git a/arch/arm/mach-omap2/board-zoom.c b/arch/arm/mach-omap2/board-zoom.c
index 4994438e1f46..50e98795b09c 100644
--- a/arch/arm/mach-omap2/board-zoom.c
+++ b/arch/arm/mach-omap2/board-zoom.c
@@ -24,7 +24,7 @@
24#include "common.h" 24#include "common.h"
25#include <plat/usb.h> 25#include <plat/usb.h>
26 26
27#include <mach/board-zoom.h> 27#include "board-zoom.h"
28 28
29#include "board-flash.h" 29#include "board-flash.h"
30#include "mux.h" 30#include "mux.h"
@@ -113,8 +113,9 @@ static void __init omap_zoom_init(void)
113 usbhs_init(&usbhs_bdata); 113 usbhs_init(&usbhs_bdata);
114 } 114 }
115 115
116 board_nand_init(zoom_nand_partitions, ARRAY_SIZE(zoom_nand_partitions), 116 board_nand_init(zoom_nand_partitions,
117 ZOOM_NAND_CS, NAND_BUSWIDTH_16); 117 ARRAY_SIZE(zoom_nand_partitions), ZOOM_NAND_CS,
118 NAND_BUSWIDTH_16, nand_default_timings);
118 zoom_debugboard_init(); 119 zoom_debugboard_init();
119 zoom_peripherals_init(); 120 zoom_peripherals_init();
120 121
diff --git a/arch/arm/mach-omap2/include/mach/board-zoom.h b/arch/arm/mach-omap2/board-zoom.h
index 2e9486940ead..2e9486940ead 100644
--- a/arch/arm/mach-omap2/include/mach/board-zoom.h
+++ b/arch/arm/mach-omap2/board-zoom.h
diff --git a/arch/arm/mach-omap2/clkt2xxx_apll.c b/arch/arm/mach-omap2/clkt2xxx_apll.c
index c2d15212d64d..73a1414b89b0 100644
--- a/arch/arm/mach-omap2/clkt2xxx_apll.c
+++ b/arch/arm/mach-omap2/clkt2xxx_apll.c
@@ -21,7 +21,6 @@
21#include <linux/clk.h> 21#include <linux/clk.h>
22#include <linux/io.h> 22#include <linux/io.h>
23 23
24#include <plat/clock.h>
25#include <plat/prcm.h> 24#include <plat/prcm.h>
26 25
27#include "clock.h" 26#include "clock.h"
diff --git a/arch/arm/mach-omap2/clkt2xxx_dpll.c b/arch/arm/mach-omap2/clkt2xxx_dpll.c
index 1502a7bc20bb..0890ba94a282 100644
--- a/arch/arm/mach-omap2/clkt2xxx_dpll.c
+++ b/arch/arm/mach-omap2/clkt2xxx_dpll.c
@@ -14,8 +14,6 @@
14#include <linux/clk.h> 14#include <linux/clk.h>
15#include <linux/io.h> 15#include <linux/io.h>
16 16
17#include <plat/clock.h>
18
19#include "clock.h" 17#include "clock.h"
20#include "cm2xxx_3xxx.h" 18#include "cm2xxx_3xxx.h"
21#include "cm-regbits-24xx.h" 19#include "cm-regbits-24xx.h"
diff --git a/arch/arm/mach-omap2/clkt2xxx_dpllcore.c b/arch/arm/mach-omap2/clkt2xxx_dpllcore.c
index 4ae439222085..3432f913f743 100644
--- a/arch/arm/mach-omap2/clkt2xxx_dpllcore.c
+++ b/arch/arm/mach-omap2/clkt2xxx_dpllcore.c
@@ -25,15 +25,14 @@
25#include <linux/clk.h> 25#include <linux/clk.h>
26#include <linux/io.h> 26#include <linux/io.h>
27 27
28#include <plat/clock.h> 28#include "../plat-omap/sram.h"
29#include <plat/sram.h>
30#include <plat/sdrc.h>
31 29
32#include "clock.h" 30#include "clock.h"
33#include "clock2xxx.h" 31#include "clock2xxx.h"
34#include "opp2xxx.h" 32#include "opp2xxx.h"
35#include "cm2xxx_3xxx.h" 33#include "cm2xxx_3xxx.h"
36#include "cm-regbits-24xx.h" 34#include "cm-regbits-24xx.h"
35#include "sdrc.h"
37 36
38/* #define DOWN_VARIABLE_DPLL 1 */ /* Experimental */ 37/* #define DOWN_VARIABLE_DPLL 1 */ /* Experimental */
39 38
diff --git a/arch/arm/mach-omap2/clkt2xxx_osc.c b/arch/arm/mach-omap2/clkt2xxx_osc.c
index c3460928b5e0..e1777371bb5e 100644
--- a/arch/arm/mach-omap2/clkt2xxx_osc.c
+++ b/arch/arm/mach-omap2/clkt2xxx_osc.c
@@ -23,8 +23,6 @@
23#include <linux/clk.h> 23#include <linux/clk.h>
24#include <linux/io.h> 24#include <linux/io.h>
25 25
26#include <plat/clock.h>
27
28#include "clock.h" 26#include "clock.h"
29#include "clock2xxx.h" 27#include "clock2xxx.h"
30#include "prm2xxx_3xxx.h" 28#include "prm2xxx_3xxx.h"
diff --git a/arch/arm/mach-omap2/clkt2xxx_sys.c b/arch/arm/mach-omap2/clkt2xxx_sys.c
index 8693cfdac49a..46683b3c2461 100644
--- a/arch/arm/mach-omap2/clkt2xxx_sys.c
+++ b/arch/arm/mach-omap2/clkt2xxx_sys.c
@@ -22,8 +22,6 @@
22#include <linux/clk.h> 22#include <linux/clk.h>
23#include <linux/io.h> 23#include <linux/io.h>
24 24
25#include <plat/clock.h>
26
27#include "clock.h" 25#include "clock.h"
28#include "clock2xxx.h" 26#include "clock2xxx.h"
29#include "prm2xxx_3xxx.h" 27#include "prm2xxx_3xxx.h"
diff --git a/arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c b/arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c
index 3524f0e7b6d5..c66276b2bf0a 100644
--- a/arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c
+++ b/arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c
@@ -33,9 +33,7 @@
33#include <linux/cpufreq.h> 33#include <linux/cpufreq.h>
34#include <linux/slab.h> 34#include <linux/slab.h>
35 35
36#include <plat/clock.h> 36#include "../plat-omap/sram.h"
37#include <plat/sram.h>
38#include <plat/sdrc.h>
39 37
40#include "soc.h" 38#include "soc.h"
41#include "clock.h" 39#include "clock.h"
@@ -43,6 +41,7 @@
43#include "opp2xxx.h" 41#include "opp2xxx.h"
44#include "cm2xxx_3xxx.h" 42#include "cm2xxx_3xxx.h"
45#include "cm-regbits-24xx.h" 43#include "cm-regbits-24xx.h"
44#include "sdrc.h"
46 45
47const struct prcm_config *curr_prcm_set; 46const struct prcm_config *curr_prcm_set;
48const struct prcm_config *rate_table; 47const struct prcm_config *rate_table;
diff --git a/arch/arm/mach-omap2/clkt34xx_dpll3m2.c b/arch/arm/mach-omap2/clkt34xx_dpll3m2.c
index 7c6da2f731dc..5510d92abe6e 100644
--- a/arch/arm/mach-omap2/clkt34xx_dpll3m2.c
+++ b/arch/arm/mach-omap2/clkt34xx_dpll3m2.c
@@ -21,9 +21,7 @@
21#include <linux/clk.h> 21#include <linux/clk.h>
22#include <linux/io.h> 22#include <linux/io.h>
23 23
24#include <plat/clock.h> 24#include "../plat-omap/sram.h"
25#include <plat/sram.h>
26#include <plat/sdrc.h>
27 25
28#include "clock.h" 26#include "clock.h"
29#include "clock3xxx.h" 27#include "clock3xxx.h"
diff --git a/arch/arm/mach-omap2/clkt_clksel.c b/arch/arm/mach-omap2/clkt_clksel.c
index 3ff22114d702..53646facda45 100644
--- a/arch/arm/mach-omap2/clkt_clksel.c
+++ b/arch/arm/mach-omap2/clkt_clksel.c
@@ -45,8 +45,6 @@
45#include <linux/io.h> 45#include <linux/io.h>
46#include <linux/bug.h> 46#include <linux/bug.h>
47 47
48#include <plat/clock.h>
49
50#include "clock.h" 48#include "clock.h"
51 49
52/* Private functions */ 50/* Private functions */
diff --git a/arch/arm/mach-omap2/clkt_dpll.c b/arch/arm/mach-omap2/clkt_dpll.c
index 80411142f482..8463cc356245 100644
--- a/arch/arm/mach-omap2/clkt_dpll.c
+++ b/arch/arm/mach-omap2/clkt_dpll.c
@@ -21,8 +21,6 @@
21 21
22#include <asm/div64.h> 22#include <asm/div64.h>
23 23
24#include <plat/clock.h>
25
26#include "soc.h" 24#include "soc.h"
27#include "clock.h" 25#include "clock.h"
28#include "cm-regbits-24xx.h" 26#include "cm-regbits-24xx.h"
diff --git a/arch/arm/mach-omap2/clkt_iclk.c b/arch/arm/mach-omap2/clkt_iclk.c
index 3d43fba2542f..7c8d41e49834 100644
--- a/arch/arm/mach-omap2/clkt_iclk.c
+++ b/arch/arm/mach-omap2/clkt_iclk.c
@@ -14,7 +14,6 @@
14#include <linux/clk.h> 14#include <linux/clk.h>
15#include <linux/io.h> 15#include <linux/io.h>
16 16
17#include <plat/clock.h>
18#include <plat/prcm.h> 17#include <plat/prcm.h>
19 18
20#include "clock.h" 19#include "clock.h"
diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
index 961ac8f7e13d..8b30759f8f9e 100644
--- a/arch/arm/mach-omap2/clock.c
+++ b/arch/arm/mach-omap2/clock.c
@@ -15,6 +15,7 @@
15#undef DEBUG 15#undef DEBUG
16 16
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/export.h>
18#include <linux/list.h> 19#include <linux/list.h>
19#include <linux/errno.h> 20#include <linux/errno.h>
20#include <linux/err.h> 21#include <linux/err.h>
@@ -25,7 +26,6 @@
25 26
26#include <asm/cpu.h> 27#include <asm/cpu.h>
27 28
28#include <plat/clock.h>
29#include <plat/prcm.h> 29#include <plat/prcm.h>
30 30
31#include <trace/events/power.h> 31#include <trace/events/power.h>
@@ -47,6 +47,10 @@ u16 cpu_mask;
47 */ 47 */
48static bool clkdm_control = true; 48static bool clkdm_control = true;
49 49
50static LIST_HEAD(clocks);
51static DEFINE_MUTEX(clocks_mutex);
52static DEFINE_SPINLOCK(clockfw_lock);
53
50/* 54/*
51 * OMAP2+ specific clock functions 55 * OMAP2+ specific clock functions
52 */ 56 */
@@ -512,12 +516,510 @@ void __init omap2_clk_print_new_rates(const char *hfclkin_ck_name,
512 516
513/* Common data */ 517/* Common data */
514 518
515struct clk_functions omap2_clk_functions = { 519int clk_enable(struct clk *clk)
516 .clk_enable = omap2_clk_enable, 520{
517 .clk_disable = omap2_clk_disable, 521 unsigned long flags;
518 .clk_round_rate = omap2_clk_round_rate, 522 int ret;
519 .clk_set_rate = omap2_clk_set_rate, 523
520 .clk_set_parent = omap2_clk_set_parent, 524 if (clk == NULL || IS_ERR(clk))
521 .clk_disable_unused = omap2_clk_disable_unused, 525 return -EINVAL;
526
527 spin_lock_irqsave(&clockfw_lock, flags);
528 ret = omap2_clk_enable(clk);
529 spin_unlock_irqrestore(&clockfw_lock, flags);
530
531 return ret;
532}
533EXPORT_SYMBOL(clk_enable);
534
535void clk_disable(struct clk *clk)
536{
537 unsigned long flags;
538
539 if (clk == NULL || IS_ERR(clk))
540 return;
541
542 spin_lock_irqsave(&clockfw_lock, flags);
543 if (clk->usecount == 0) {
544 pr_err("Trying disable clock %s with 0 usecount\n",
545 clk->name);
546 WARN_ON(1);
547 goto out;
548 }
549
550 omap2_clk_disable(clk);
551
552out:
553 spin_unlock_irqrestore(&clockfw_lock, flags);
554}
555EXPORT_SYMBOL(clk_disable);
556
557unsigned long clk_get_rate(struct clk *clk)
558{
559 unsigned long flags;
560 unsigned long ret;
561
562 if (clk == NULL || IS_ERR(clk))
563 return 0;
564
565 spin_lock_irqsave(&clockfw_lock, flags);
566 ret = clk->rate;
567 spin_unlock_irqrestore(&clockfw_lock, flags);
568
569 return ret;
570}
571EXPORT_SYMBOL(clk_get_rate);
572
573/*
574 * Optional clock functions defined in include/linux/clk.h
575 */
576
577long clk_round_rate(struct clk *clk, unsigned long rate)
578{
579 unsigned long flags;
580 long ret;
581
582 if (clk == NULL || IS_ERR(clk))
583 return 0;
584
585 spin_lock_irqsave(&clockfw_lock, flags);
586 ret = omap2_clk_round_rate(clk, rate);
587 spin_unlock_irqrestore(&clockfw_lock, flags);
588
589 return ret;
590}
591EXPORT_SYMBOL(clk_round_rate);
592
593int clk_set_rate(struct clk *clk, unsigned long rate)
594{
595 unsigned long flags;
596 int ret = -EINVAL;
597
598 if (clk == NULL || IS_ERR(clk))
599 return ret;
600
601 spin_lock_irqsave(&clockfw_lock, flags);
602 ret = omap2_clk_set_rate(clk, rate);
603 if (ret == 0)
604 propagate_rate(clk);
605 spin_unlock_irqrestore(&clockfw_lock, flags);
606
607 return ret;
608}
609EXPORT_SYMBOL(clk_set_rate);
610
611int clk_set_parent(struct clk *clk, struct clk *parent)
612{
613 unsigned long flags;
614 int ret = -EINVAL;
615
616 if (clk == NULL || IS_ERR(clk) || parent == NULL || IS_ERR(parent))
617 return ret;
618
619 spin_lock_irqsave(&clockfw_lock, flags);
620 if (clk->usecount == 0) {
621 ret = omap2_clk_set_parent(clk, parent);
622 if (ret == 0)
623 propagate_rate(clk);
624 } else {
625 ret = -EBUSY;
626 }
627 spin_unlock_irqrestore(&clockfw_lock, flags);
628
629 return ret;
630}
631EXPORT_SYMBOL(clk_set_parent);
632
633struct clk *clk_get_parent(struct clk *clk)
634{
635 return clk->parent;
636}
637EXPORT_SYMBOL(clk_get_parent);
638
639/*
640 * OMAP specific clock functions shared between omap1 and omap2
641 */
642
643int __initdata mpurate;
644
645/*
646 * By default we use the rate set by the bootloader.
647 * You can override this with mpurate= cmdline option.
648 */
649static int __init omap_clk_setup(char *str)
650{
651 get_option(&str, &mpurate);
652
653 if (!mpurate)
654 return 1;
655
656 if (mpurate < 1000)
657 mpurate *= 1000000;
658
659 return 1;
660}
661__setup("mpurate=", omap_clk_setup);
662
663/* Used for clocks that always have same value as the parent clock */
664unsigned long followparent_recalc(struct clk *clk)
665{
666 return clk->parent->rate;
667}
668
669/*
670 * Used for clocks that have the same value as the parent clock,
671 * divided by some factor
672 */
673unsigned long omap_fixed_divisor_recalc(struct clk *clk)
674{
675 WARN_ON(!clk->fixed_div);
676
677 return clk->parent->rate / clk->fixed_div;
678}
679
680void clk_reparent(struct clk *child, struct clk *parent)
681{
682 list_del_init(&child->sibling);
683 if (parent)
684 list_add(&child->sibling, &parent->children);
685 child->parent = parent;
686
687 /* now do the debugfs renaming to reattach the child
688 to the proper parent */
689}
690
691/* Propagate rate to children */
692void propagate_rate(struct clk *tclk)
693{
694 struct clk *clkp;
695
696 list_for_each_entry(clkp, &tclk->children, sibling) {
697 if (clkp->recalc)
698 clkp->rate = clkp->recalc(clkp);
699 propagate_rate(clkp);
700 }
701}
702
703static LIST_HEAD(root_clks);
704
705/**
706 * recalculate_root_clocks - recalculate and propagate all root clocks
707 *
708 * Recalculates all root clocks (clocks with no parent), which if the
709 * clock's .recalc is set correctly, should also propagate their rates.
710 * Called at init.
711 */
712void recalculate_root_clocks(void)
713{
714 struct clk *clkp;
715
716 list_for_each_entry(clkp, &root_clks, sibling) {
717 if (clkp->recalc)
718 clkp->rate = clkp->recalc(clkp);
719 propagate_rate(clkp);
720 }
721}
722
723/**
724 * clk_preinit - initialize any fields in the struct clk before clk init
725 * @clk: struct clk * to initialize
726 *
727 * Initialize any struct clk fields needed before normal clk initialization
728 * can run. No return value.
729 */
730void clk_preinit(struct clk *clk)
731{
732 INIT_LIST_HEAD(&clk->children);
733}
734
735int clk_register(struct clk *clk)
736{
737 if (clk == NULL || IS_ERR(clk))
738 return -EINVAL;
739
740 /*
741 * trap out already registered clocks
742 */
743 if (clk->node.next || clk->node.prev)
744 return 0;
745
746 mutex_lock(&clocks_mutex);
747 if (clk->parent)
748 list_add(&clk->sibling, &clk->parent->children);
749 else
750 list_add(&clk->sibling, &root_clks);
751
752 list_add(&clk->node, &clocks);
753 if (clk->init)
754 clk->init(clk);
755 mutex_unlock(&clocks_mutex);
756
757 return 0;
758}
759EXPORT_SYMBOL(clk_register);
760
761void clk_unregister(struct clk *clk)
762{
763 if (clk == NULL || IS_ERR(clk))
764 return;
765
766 mutex_lock(&clocks_mutex);
767 list_del(&clk->sibling);
768 list_del(&clk->node);
769 mutex_unlock(&clocks_mutex);
770}
771EXPORT_SYMBOL(clk_unregister);
772
773void clk_enable_init_clocks(void)
774{
775 struct clk *clkp;
776
777 list_for_each_entry(clkp, &clocks, node)
778 if (clkp->flags & ENABLE_ON_INIT)
779 clk_enable(clkp);
780}
781
782/**
783 * omap_clk_get_by_name - locate OMAP struct clk by its name
784 * @name: name of the struct clk to locate
785 *
786 * Locate an OMAP struct clk by its name. Assumes that struct clk
787 * names are unique. Returns NULL if not found or a pointer to the
788 * struct clk if found.
789 */
790struct clk *omap_clk_get_by_name(const char *name)
791{
792 struct clk *c;
793 struct clk *ret = NULL;
794
795 mutex_lock(&clocks_mutex);
796
797 list_for_each_entry(c, &clocks, node) {
798 if (!strcmp(c->name, name)) {
799 ret = c;
800 break;
801 }
802 }
803
804 mutex_unlock(&clocks_mutex);
805
806 return ret;
807}
808
809int omap_clk_enable_autoidle_all(void)
810{
811 struct clk *c;
812 unsigned long flags;
813
814 spin_lock_irqsave(&clockfw_lock, flags);
815
816 list_for_each_entry(c, &clocks, node)
817 if (c->ops->allow_idle)
818 c->ops->allow_idle(c);
819
820 spin_unlock_irqrestore(&clockfw_lock, flags);
821
822 return 0;
823}
824
825int omap_clk_disable_autoidle_all(void)
826{
827 struct clk *c;
828 unsigned long flags;
829
830 spin_lock_irqsave(&clockfw_lock, flags);
831
832 list_for_each_entry(c, &clocks, node)
833 if (c->ops->deny_idle)
834 c->ops->deny_idle(c);
835
836 spin_unlock_irqrestore(&clockfw_lock, flags);
837
838 return 0;
839}
840
841/*
842 * Low level helpers
843 */
844static int clkll_enable_null(struct clk *clk)
845{
846 return 0;
847}
848
849static void clkll_disable_null(struct clk *clk)
850{
851}
852
853const struct clkops clkops_null = {
854 .enable = clkll_enable_null,
855 .disable = clkll_disable_null,
856};
857
858/*
859 * Dummy clock
860 *
861 * Used for clock aliases that are needed on some OMAPs, but not others
862 */
863struct clk dummy_ck = {
864 .name = "dummy",
865 .ops = &clkops_null,
866};
867
868/*
869 *
870 */
871
872#ifdef CONFIG_OMAP_RESET_CLOCKS
873/*
874 * Disable any unused clocks left on by the bootloader
875 */
876static int __init clk_disable_unused(void)
877{
878 struct clk *ck;
879 unsigned long flags;
880
881 pr_info("clock: disabling unused clocks to save power\n");
882
883 spin_lock_irqsave(&clockfw_lock, flags);
884 list_for_each_entry(ck, &clocks, node) {
885 if (ck->ops == &clkops_null)
886 continue;
887
888 if (ck->usecount > 0 || !ck->enable_reg)
889 continue;
890
891 omap2_clk_disable_unused(ck);
892 }
893 spin_unlock_irqrestore(&clockfw_lock, flags);
894
895 return 0;
896}
897late_initcall(clk_disable_unused);
898late_initcall(omap_clk_enable_autoidle_all);
899#endif
900
901#if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS)
902/*
903 * debugfs support to trace clock tree hierarchy and attributes
904 */
905
906#include <linux/debugfs.h>
907#include <linux/seq_file.h>
908
909static struct dentry *clk_debugfs_root;
910
911static int clk_dbg_show_summary(struct seq_file *s, void *unused)
912{
913 struct clk *c;
914 struct clk *pa;
915
916 mutex_lock(&clocks_mutex);
917 seq_printf(s, "%-30s %-30s %-10s %s\n",
918 "clock-name", "parent-name", "rate", "use-count");
919
920 list_for_each_entry(c, &clocks, node) {
921 pa = c->parent;
922 seq_printf(s, "%-30s %-30s %-10lu %d\n",
923 c->name, pa ? pa->name : "none", c->rate,
924 c->usecount);
925 }
926 mutex_unlock(&clocks_mutex);
927
928 return 0;
929}
930
931static int clk_dbg_open(struct inode *inode, struct file *file)
932{
933 return single_open(file, clk_dbg_show_summary, inode->i_private);
934}
935
936static const struct file_operations debug_clock_fops = {
937 .open = clk_dbg_open,
938 .read = seq_read,
939 .llseek = seq_lseek,
940 .release = single_release,
522}; 941};
523 942
943static int clk_debugfs_register_one(struct clk *c)
944{
945 int err;
946 struct dentry *d;
947 struct clk *pa = c->parent;
948
949 d = debugfs_create_dir(c->name, pa ? pa->dent : clk_debugfs_root);
950 if (!d)
951 return -ENOMEM;
952 c->dent = d;
953
954 d = debugfs_create_u8("usecount", S_IRUGO, c->dent, (u8 *)&c->usecount);
955 if (!d) {
956 err = -ENOMEM;
957 goto err_out;
958 }
959 d = debugfs_create_u32("rate", S_IRUGO, c->dent, (u32 *)&c->rate);
960 if (!d) {
961 err = -ENOMEM;
962 goto err_out;
963 }
964 d = debugfs_create_x32("flags", S_IRUGO, c->dent, (u32 *)&c->flags);
965 if (!d) {
966 err = -ENOMEM;
967 goto err_out;
968 }
969 return 0;
970
971err_out:
972 debugfs_remove_recursive(c->dent);
973 return err;
974}
975
976static int clk_debugfs_register(struct clk *c)
977{
978 int err;
979 struct clk *pa = c->parent;
980
981 if (pa && !pa->dent) {
982 err = clk_debugfs_register(pa);
983 if (err)
984 return err;
985 }
986
987 if (!c->dent) {
988 err = clk_debugfs_register_one(c);
989 if (err)
990 return err;
991 }
992 return 0;
993}
994
995static int __init clk_debugfs_init(void)
996{
997 struct clk *c;
998 struct dentry *d;
999 int err;
1000
1001 d = debugfs_create_dir("clock", NULL);
1002 if (!d)
1003 return -ENOMEM;
1004 clk_debugfs_root = d;
1005
1006 list_for_each_entry(c, &clocks, node) {
1007 err = clk_debugfs_register(c);
1008 if (err)
1009 goto err_out;
1010 }
1011
1012 d = debugfs_create_file("summary", S_IRUGO,
1013 d, NULL, &debug_clock_fops);
1014 if (!d)
1015 return -ENOMEM;
1016
1017 return 0;
1018err_out:
1019 debugfs_remove_recursive(clk_debugfs_root);
1020 return err;
1021}
1022late_initcall(clk_debugfs_init);
1023
1024#endif /* defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS) */
1025
diff --git a/arch/arm/mach-omap2/clock.h b/arch/arm/mach-omap2/clock.h
index 35ec5f3d9a73..cfba1ffe5cc2 100644
--- a/arch/arm/mach-omap2/clock.h
+++ b/arch/arm/mach-omap2/clock.h
@@ -17,8 +17,323 @@
17#define __ARCH_ARM_MACH_OMAP2_CLOCK_H 17#define __ARCH_ARM_MACH_OMAP2_CLOCK_H
18 18
19#include <linux/kernel.h> 19#include <linux/kernel.h>
20#include <linux/list.h>
21
22#include <linux/clkdev.h>
23
24struct omap_clk {
25 u16 cpu;
26 struct clk_lookup lk;
27};
28
29#define CLK(dev, con, ck, cp) \
30 { \
31 .cpu = cp, \
32 .lk = { \
33 .dev_id = dev, \
34 .con_id = con, \
35 .clk = ck, \
36 }, \
37 }
38
39/* Platform flags for the clkdev-OMAP integration code */
40#define CK_242X (1 << 0)
41#define CK_243X (1 << 1) /* 243x, 253x */
42#define CK_3430ES1 (1 << 2) /* 34xxES1 only */
43#define CK_3430ES2PLUS (1 << 3) /* 34xxES2, ES3, non-Sitara 35xx only */
44#define CK_AM35XX (1 << 4) /* Sitara AM35xx */
45#define CK_36XX (1 << 5) /* 36xx/37xx-specific clocks */
46#define CK_443X (1 << 6)
47#define CK_TI816X (1 << 7)
48#define CK_446X (1 << 8)
49#define CK_AM33XX (1 << 9) /* AM33xx specific clocks */
50
51
52#define CK_34XX (CK_3430ES1 | CK_3430ES2PLUS)
53#define CK_3XXX (CK_34XX | CK_AM35XX | CK_36XX)
54
55struct module;
56struct clk;
57struct clockdomain;
58
59/* Temporary, needed during the common clock framework conversion */
60#define __clk_get_name(clk) (clk->name)
61#define __clk_get_parent(clk) (clk->parent)
62#define __clk_get_rate(clk) (clk->rate)
63
64/**
65 * struct clkops - some clock function pointers
66 * @enable: fn ptr that enables the current clock in hardware
67 * @disable: fn ptr that enables the current clock in hardware
68 * @find_idlest: function returning the IDLEST register for the clock's IP blk
69 * @find_companion: function returning the "companion" clk reg for the clock
70 * @allow_idle: fn ptr that enables autoidle for the current clock in hardware
71 * @deny_idle: fn ptr that disables autoidle for the current clock in hardware
72 *
73 * A "companion" clk is an accompanying clock to the one being queried
74 * that must be enabled for the IP module connected to the clock to
75 * become accessible by the hardware. Neither @find_idlest nor
76 * @find_companion should be needed; that information is IP
77 * block-specific; the hwmod code has been created to handle this, but
78 * until hwmod data is ready and drivers have been converted to use PM
79 * runtime calls in place of clk_enable()/clk_disable(), @find_idlest and
80 * @find_companion must, unfortunately, remain.
81 */
82struct clkops {
83 int (*enable)(struct clk *);
84 void (*disable)(struct clk *);
85 void (*find_idlest)(struct clk *, void __iomem **,
86 u8 *, u8 *);
87 void (*find_companion)(struct clk *, void __iomem **,
88 u8 *);
89 void (*allow_idle)(struct clk *);
90 void (*deny_idle)(struct clk *);
91};
92
93/* struct clksel_rate.flags possibilities */
94#define RATE_IN_242X (1 << 0)
95#define RATE_IN_243X (1 << 1)
96#define RATE_IN_3430ES1 (1 << 2) /* 3430ES1 rates only */
97#define RATE_IN_3430ES2PLUS (1 << 3) /* 3430 ES >= 2 rates only */
98#define RATE_IN_36XX (1 << 4)
99#define RATE_IN_4430 (1 << 5)
100#define RATE_IN_TI816X (1 << 6)
101#define RATE_IN_4460 (1 << 7)
102#define RATE_IN_AM33XX (1 << 8)
103#define RATE_IN_TI814X (1 << 9)
104
105#define RATE_IN_24XX (RATE_IN_242X | RATE_IN_243X)
106#define RATE_IN_34XX (RATE_IN_3430ES1 | RATE_IN_3430ES2PLUS)
107#define RATE_IN_3XXX (RATE_IN_34XX | RATE_IN_36XX)
108#define RATE_IN_44XX (RATE_IN_4430 | RATE_IN_4460)
109
110/* RATE_IN_3430ES2PLUS_36XX includes 34xx/35xx with ES >=2, and all 36xx/37xx */
111#define RATE_IN_3430ES2PLUS_36XX (RATE_IN_3430ES2PLUS | RATE_IN_36XX)
112
113
114/**
115 * struct clksel_rate - register bitfield values corresponding to clk divisors
116 * @val: register bitfield value (shifted to bit 0)
117 * @div: clock divisor corresponding to @val
118 * @flags: (see "struct clksel_rate.flags possibilities" above)
119 *
120 * @val should match the value of a read from struct clk.clksel_reg
121 * AND'ed with struct clk.clksel_mask, shifted right to bit 0.
122 *
123 * @div is the divisor that should be applied to the parent clock's rate
124 * to produce the current clock's rate.
125 */
126struct clksel_rate {
127 u32 val;
128 u8 div;
129 u16 flags;
130};
131
132/**
133 * struct clksel - available parent clocks, and a pointer to their divisors
134 * @parent: struct clk * to a possible parent clock
135 * @rates: available divisors for this parent clock
136 *
137 * A struct clksel is always associated with one or more struct clks
138 * and one or more struct clksel_rates.
139 */
140struct clksel {
141 struct clk *parent;
142 const struct clksel_rate *rates;
143};
144
145/**
146 * struct dpll_data - DPLL registers and integration data
147 * @mult_div1_reg: register containing the DPLL M and N bitfields
148 * @mult_mask: mask of the DPLL M bitfield in @mult_div1_reg
149 * @div1_mask: mask of the DPLL N bitfield in @mult_div1_reg
150 * @clk_bypass: struct clk pointer to the clock's bypass clock input
151 * @clk_ref: struct clk pointer to the clock's reference clock input
152 * @control_reg: register containing the DPLL mode bitfield
153 * @enable_mask: mask of the DPLL mode bitfield in @control_reg
154 * @last_rounded_rate: cache of the last rate result of omap2_dpll_round_rate()
155 * @last_rounded_m: cache of the last M result of omap2_dpll_round_rate()
156 * @max_multiplier: maximum valid non-bypass multiplier value (actual)
157 * @last_rounded_n: cache of the last N result of omap2_dpll_round_rate()
158 * @min_divider: minimum valid non-bypass divider value (actual)
159 * @max_divider: maximum valid non-bypass divider value (actual)
160 * @modes: possible values of @enable_mask
161 * @autoidle_reg: register containing the DPLL autoidle mode bitfield
162 * @idlest_reg: register containing the DPLL idle status bitfield
163 * @autoidle_mask: mask of the DPLL autoidle mode bitfield in @autoidle_reg
164 * @freqsel_mask: mask of the DPLL jitter correction bitfield in @control_reg
165 * @idlest_mask: mask of the DPLL idle status bitfield in @idlest_reg
166 * @auto_recal_bit: bitshift of the driftguard enable bit in @control_reg
167 * @recal_en_bit: bitshift of the PRM_IRQENABLE_* bit for recalibration IRQs
168 * @recal_st_bit: bitshift of the PRM_IRQSTATUS_* bit for recalibration IRQs
169 * @flags: DPLL type/features (see below)
170 *
171 * Possible values for @flags:
172 * DPLL_J_TYPE: "J-type DPLL" (only some 36xx, 4xxx DPLLs)
173 *
174 * @freqsel_mask is only used on the OMAP34xx family and AM35xx.
175 *
176 * XXX Some DPLLs have multiple bypass inputs, so it's not technically
177 * correct to only have one @clk_bypass pointer.
178 *
179 * XXX The runtime-variable fields (@last_rounded_rate, @last_rounded_m,
180 * @last_rounded_n) should be separated from the runtime-fixed fields
181 * and placed into a different structure, so that the runtime-fixed data
182 * can be placed into read-only space.
183 */
184struct dpll_data {
185 void __iomem *mult_div1_reg;
186 u32 mult_mask;
187 u32 div1_mask;
188 struct clk *clk_bypass;
189 struct clk *clk_ref;
190 void __iomem *control_reg;
191 u32 enable_mask;
192 unsigned long last_rounded_rate;
193 u16 last_rounded_m;
194 u16 max_multiplier;
195 u8 last_rounded_n;
196 u8 min_divider;
197 u16 max_divider;
198 u8 modes;
199 void __iomem *autoidle_reg;
200 void __iomem *idlest_reg;
201 u32 autoidle_mask;
202 u32 freqsel_mask;
203 u32 idlest_mask;
204 u32 dco_mask;
205 u32 sddiv_mask;
206 u8 auto_recal_bit;
207 u8 recal_en_bit;
208 u8 recal_st_bit;
209 u8 flags;
210};
211
212/*
213 * struct clk.flags possibilities
214 *
215 * XXX document the rest of the clock flags here
216 *
217 * CLOCK_CLKOUTX2: (OMAP4 only) DPLL CLKOUT and CLKOUTX2 GATE_CTRL
218 * bits share the same register. This flag allows the
219 * omap4_dpllmx*() code to determine which GATE_CTRL bit field
220 * should be used. This is a temporary solution - a better approach
221 * would be to associate clock type-specific data with the clock,
222 * similar to the struct dpll_data approach.
223 */
224#define ENABLE_REG_32BIT (1 << 0) /* Use 32-bit access */
225#define CLOCK_IDLE_CONTROL (1 << 1)
226#define CLOCK_NO_IDLE_PARENT (1 << 2)
227#define ENABLE_ON_INIT (1 << 3) /* Enable upon framework init */
228#define INVERT_ENABLE (1 << 4) /* 0 enables, 1 disables */
229#define CLOCK_CLKOUTX2 (1 << 5)
230
231/**
232 * struct clk - OMAP struct clk
233 * @node: list_head connecting this clock into the full clock list
234 * @ops: struct clkops * for this clock
235 * @name: the name of the clock in the hardware (used in hwmod data and debug)
236 * @parent: pointer to this clock's parent struct clk
237 * @children: list_head connecting to the child clks' @sibling list_heads
238 * @sibling: list_head connecting this clk to its parent clk's @children
239 * @rate: current clock rate
240 * @enable_reg: register to write to enable the clock (see @enable_bit)
241 * @recalc: fn ptr that returns the clock's current rate
242 * @set_rate: fn ptr that can change the clock's current rate
243 * @round_rate: fn ptr that can round the clock's current rate
244 * @init: fn ptr to do clock-specific initialization
245 * @enable_bit: bitshift to write to enable/disable the clock (see @enable_reg)
246 * @usecount: number of users that have requested this clock to be enabled
247 * @fixed_div: when > 0, this clock's rate is its parent's rate / @fixed_div
248 * @flags: see "struct clk.flags possibilities" above
249 * @clksel_reg: for clksel clks, register va containing src/divisor select
250 * @clksel_mask: bitmask in @clksel_reg for the src/divisor selector
251 * @clksel: for clksel clks, pointer to struct clksel for this clock
252 * @dpll_data: for DPLLs, pointer to struct dpll_data for this clock
253 * @clkdm_name: clockdomain name that this clock is contained in
254 * @clkdm: pointer to struct clockdomain, resolved from @clkdm_name at runtime
255 * @rate_offset: bitshift for rate selection bitfield (OMAP1 only)
256 * @src_offset: bitshift for source selection bitfield (OMAP1 only)
257 *
258 * XXX @rate_offset, @src_offset should probably be removed and OMAP1
259 * clock code converted to use clksel.
260 *
261 * XXX @usecount is poorly named. It should be "enable_count" or
262 * something similar. "users" in the description refers to kernel
263 * code (core code or drivers) that have called clk_enable() and not
264 * yet called clk_disable(); the usecount of parent clocks is also
265 * incremented by the clock code when clk_enable() is called on child
266 * clocks and decremented by the clock code when clk_disable() is
267 * called on child clocks.
268 *
269 * XXX @clkdm, @usecount, @children, @sibling should be marked for
270 * internal use only.
271 *
272 * @children and @sibling are used to optimize parent-to-child clock
273 * tree traversals. (child-to-parent traversals use @parent.)
274 *
275 * XXX The notion of the clock's current rate probably needs to be
276 * separated from the clock's target rate.
277 */
278struct clk {
279 struct list_head node;
280 const struct clkops *ops;
281 const char *name;
282 struct clk *parent;
283 struct list_head children;
284 struct list_head sibling; /* node for children */
285 unsigned long rate;
286 void __iomem *enable_reg;
287 unsigned long (*recalc)(struct clk *);
288 int (*set_rate)(struct clk *, unsigned long);
289 long (*round_rate)(struct clk *, unsigned long);
290 void (*init)(struct clk *);
291 u8 enable_bit;
292 s8 usecount;
293 u8 fixed_div;
294 u8 flags;
295 void __iomem *clksel_reg;
296 u32 clksel_mask;
297 const struct clksel *clksel;
298 struct dpll_data *dpll_data;
299 const char *clkdm_name;
300 struct clockdomain *clkdm;
301#if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS)
302 struct dentry *dent; /* For visible tree hierarchy */
303#endif
304};
305
306struct clk_functions {
307 int (*clk_enable)(struct clk *clk);
308 void (*clk_disable)(struct clk *clk);
309 long (*clk_round_rate)(struct clk *clk, unsigned long rate);
310 int (*clk_set_rate)(struct clk *clk, unsigned long rate);
311 int (*clk_set_parent)(struct clk *clk, struct clk *parent);
312 void (*clk_allow_idle)(struct clk *clk);
313 void (*clk_deny_idle)(struct clk *clk);
314 void (*clk_disable_unused)(struct clk *clk);
315};
316
317extern int mpurate;
318
319extern int clk_init(struct clk_functions *custom_clocks);
320extern void clk_preinit(struct clk *clk);
321extern int clk_register(struct clk *clk);
322extern void clk_reparent(struct clk *child, struct clk *parent);
323extern void clk_unregister(struct clk *clk);
324extern void propagate_rate(struct clk *clk);
325extern void recalculate_root_clocks(void);
326extern unsigned long followparent_recalc(struct clk *clk);
327extern void clk_enable_init_clocks(void);
328unsigned long omap_fixed_divisor_recalc(struct clk *clk);
329extern struct clk *omap_clk_get_by_name(const char *name);
330extern int omap_clk_enable_autoidle_all(void);
331extern int omap_clk_disable_autoidle_all(void);
332
333extern const struct clkops clkops_null;
334
335extern struct clk dummy_ck;
20 336
21#include <plat/clock.h>
22 337
23/* CM_CLKSEL2_PLL.CORE_CLK_SRC bits (2XXX) */ 338/* CM_CLKSEL2_PLL.CORE_CLK_SRC bits (2XXX) */
24#define CORE_CLK_SRC_32K 0x0 339#define CORE_CLK_SRC_32K 0x0
diff --git a/arch/arm/mach-omap2/clock2420_data.c b/arch/arm/mach-omap2/clock2420_data.c
index c3cde1a2b6de..ff47a6c2611d 100644
--- a/arch/arm/mach-omap2/clock2420_data.c
+++ b/arch/arm/mach-omap2/clock2420_data.c
@@ -18,8 +18,6 @@
18#include <linux/clk.h> 18#include <linux/clk.h>
19#include <linux/list.h> 19#include <linux/list.h>
20 20
21#include <plat/clkdev_omap.h>
22
23#include "soc.h" 21#include "soc.h"
24#include "iomap.h" 22#include "iomap.h"
25#include "clock.h" 23#include "clock.h"
@@ -1935,8 +1933,6 @@ int __init omap2420_clk_init(void)
1935 cpu_mask = RATE_IN_242X; 1933 cpu_mask = RATE_IN_242X;
1936 rate_table = omap2420_rate_table; 1934 rate_table = omap2420_rate_table;
1937 1935
1938 clk_init(&omap2_clk_functions);
1939
1940 for (c = omap2420_clks; c < omap2420_clks + ARRAY_SIZE(omap2420_clks); 1936 for (c = omap2420_clks; c < omap2420_clks + ARRAY_SIZE(omap2420_clks);
1941 c++) 1937 c++)
1942 clk_preinit(c->lk.clk); 1938 clk_preinit(c->lk.clk);
diff --git a/arch/arm/mach-omap2/clock2430.c b/arch/arm/mach-omap2/clock2430.c
index a8e326177466..850f83e8954f 100644
--- a/arch/arm/mach-omap2/clock2430.c
+++ b/arch/arm/mach-omap2/clock2430.c
@@ -21,8 +21,6 @@
21#include <linux/clk.h> 21#include <linux/clk.h>
22#include <linux/io.h> 22#include <linux/io.h>
23 23
24#include <plat/clock.h>
25
26#include "soc.h" 24#include "soc.h"
27#include "iomap.h" 25#include "iomap.h"
28#include "clock.h" 26#include "clock.h"
diff --git a/arch/arm/mach-omap2/clock2430_data.c b/arch/arm/mach-omap2/clock2430_data.c
index 22404fe435e7..cab8e9c52d6e 100644
--- a/arch/arm/mach-omap2/clock2430_data.c
+++ b/arch/arm/mach-omap2/clock2430_data.c
@@ -17,8 +17,6 @@
17#include <linux/clk.h> 17#include <linux/clk.h>
18#include <linux/list.h> 18#include <linux/list.h>
19 19
20#include <plat/clkdev_omap.h>
21
22#include "soc.h" 20#include "soc.h"
23#include "iomap.h" 21#include "iomap.h"
24#include "clock.h" 22#include "clock.h"
@@ -2034,8 +2032,6 @@ int __init omap2430_clk_init(void)
2034 cpu_mask = RATE_IN_243X; 2032 cpu_mask = RATE_IN_243X;
2035 rate_table = omap2430_rate_table; 2033 rate_table = omap2430_rate_table;
2036 2034
2037 clk_init(&omap2_clk_functions);
2038
2039 for (c = omap2430_clks; c < omap2430_clks + ARRAY_SIZE(omap2430_clks); 2035 for (c = omap2430_clks; c < omap2430_clks + ARRAY_SIZE(omap2430_clks);
2040 c++) 2036 c++)
2041 clk_preinit(c->lk.clk); 2037 clk_preinit(c->lk.clk);
diff --git a/arch/arm/mach-omap2/clock2xxx.c b/arch/arm/mach-omap2/clock2xxx.c
index e92be1fc1a00..5feee16fee0e 100644
--- a/arch/arm/mach-omap2/clock2xxx.c
+++ b/arch/arm/mach-omap2/clock2xxx.c
@@ -22,8 +22,6 @@
22#include <linux/clk.h> 22#include <linux/clk.h>
23#include <linux/io.h> 23#include <linux/io.h>
24 24
25#include <plat/clock.h>
26
27#include "soc.h" 25#include "soc.h"
28#include "clock.h" 26#include "clock.h"
29#include "clock2xxx.h" 27#include "clock2xxx.h"
diff --git a/arch/arm/mach-omap2/clock33xx_data.c b/arch/arm/mach-omap2/clock33xx_data.c
index 114ab4b8e0e3..1cb79cc58089 100644
--- a/arch/arm/mach-omap2/clock33xx_data.c
+++ b/arch/arm/mach-omap2/clock33xx_data.c
@@ -17,9 +17,8 @@
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/list.h> 18#include <linux/list.h>
19#include <linux/clk.h> 19#include <linux/clk.h>
20#include <plat/clkdev_omap.h>
21 20
22#include "am33xx.h" 21#include "soc.h"
23#include "iomap.h" 22#include "iomap.h"
24#include "control.h" 23#include "control.h"
25#include "clock.h" 24#include "clock.h"
@@ -1085,8 +1084,6 @@ int __init am33xx_clk_init(void)
1085 cpu_clkflg = CK_AM33XX; 1084 cpu_clkflg = CK_AM33XX;
1086 } 1085 }
1087 1086
1088 clk_init(&omap2_clk_functions);
1089
1090 for (c = am33xx_clks; c < am33xx_clks + ARRAY_SIZE(am33xx_clks); c++) 1087 for (c = am33xx_clks; c < am33xx_clks + ARRAY_SIZE(am33xx_clks); c++)
1091 clk_preinit(c->lk.clk); 1088 clk_preinit(c->lk.clk);
1092 1089
diff --git a/arch/arm/mach-omap2/clock34xx.c b/arch/arm/mach-omap2/clock34xx.c
index 1fc96b9ee330..baaaa4258708 100644
--- a/arch/arm/mach-omap2/clock34xx.c
+++ b/arch/arm/mach-omap2/clock34xx.c
@@ -21,8 +21,6 @@
21#include <linux/clk.h> 21#include <linux/clk.h>
22#include <linux/io.h> 22#include <linux/io.h>
23 23
24#include <plat/clock.h>
25
26#include "clock.h" 24#include "clock.h"
27#include "clock34xx.h" 25#include "clock34xx.h"
28#include "cm2xxx_3xxx.h" 26#include "cm2xxx_3xxx.h"
diff --git a/arch/arm/mach-omap2/clock3517.c b/arch/arm/mach-omap2/clock3517.c
index 2e97d08f0e56..80209050cd7a 100644
--- a/arch/arm/mach-omap2/clock3517.c
+++ b/arch/arm/mach-omap2/clock3517.c
@@ -21,8 +21,6 @@
21#include <linux/clk.h> 21#include <linux/clk.h>
22#include <linux/io.h> 22#include <linux/io.h>
23 23
24#include <plat/clock.h>
25
26#include "clock.h" 24#include "clock.h"
27#include "clock3517.h" 25#include "clock3517.h"
28#include "cm2xxx_3xxx.h" 26#include "cm2xxx_3xxx.h"
diff --git a/arch/arm/mach-omap2/clock36xx.c b/arch/arm/mach-omap2/clock36xx.c
index 0c5e25ed8879..0e1e9e4e2fa4 100644
--- a/arch/arm/mach-omap2/clock36xx.c
+++ b/arch/arm/mach-omap2/clock36xx.c
@@ -22,8 +22,6 @@
22#include <linux/clk.h> 22#include <linux/clk.h>
23#include <linux/io.h> 23#include <linux/io.h>
24 24
25#include <plat/clock.h>
26
27#include "clock.h" 25#include "clock.h"
28#include "clock36xx.h" 26#include "clock36xx.h"
29 27
diff --git a/arch/arm/mach-omap2/clock3xxx.c b/arch/arm/mach-omap2/clock3xxx.c
index 83bb01427d40..3e8aca2b1b61 100644
--- a/arch/arm/mach-omap2/clock3xxx.c
+++ b/arch/arm/mach-omap2/clock3xxx.c
@@ -21,8 +21,6 @@
21#include <linux/clk.h> 21#include <linux/clk.h>
22#include <linux/io.h> 22#include <linux/io.h>
23 23
24#include <plat/clock.h>
25
26#include "soc.h" 24#include "soc.h"
27#include "clock.h" 25#include "clock.h"
28#include "clock3xxx.h" 26#include "clock3xxx.h"
diff --git a/arch/arm/mach-omap2/clock3xxx_data.c b/arch/arm/mach-omap2/clock3xxx_data.c
index 1f42c9d5ecf3..a02d158568e8 100644
--- a/arch/arm/mach-omap2/clock3xxx_data.c
+++ b/arch/arm/mach-omap2/clock3xxx_data.c
@@ -21,8 +21,6 @@
21#include <linux/list.h> 21#include <linux/list.h>
22#include <linux/io.h> 22#include <linux/io.h>
23 23
24#include <plat/clkdev_omap.h>
25
26#include "soc.h" 24#include "soc.h"
27#include "iomap.h" 25#include "iomap.h"
28#include "clock.h" 26#include "clock.h"
@@ -3573,8 +3571,6 @@ int __init omap3xxx_clk_init(void)
3573 else 3571 else
3574 dpll4_dd = dpll4_dd_34xx; 3572 dpll4_dd = dpll4_dd_34xx;
3575 3573
3576 clk_init(&omap2_clk_functions);
3577
3578 for (c = omap3xxx_clks; c < omap3xxx_clks + ARRAY_SIZE(omap3xxx_clks); 3574 for (c = omap3xxx_clks; c < omap3xxx_clks + ARRAY_SIZE(omap3xxx_clks);
3579 c++) 3575 c++)
3580 clk_preinit(c->lk.clk); 3576 clk_preinit(c->lk.clk);
diff --git a/arch/arm/mach-omap2/clock44xx_data.c b/arch/arm/mach-omap2/clock44xx_data.c
index d661d138f270..a66eeae3bc5d 100644
--- a/arch/arm/mach-omap2/clock44xx_data.c
+++ b/arch/arm/mach-omap2/clock44xx_data.c
@@ -28,8 +28,6 @@
28#include <linux/clk.h> 28#include <linux/clk.h>
29#include <linux/io.h> 29#include <linux/io.h>
30 30
31#include <plat/clkdev_omap.h>
32
33#include "soc.h" 31#include "soc.h"
34#include "iomap.h" 32#include "iomap.h"
35#include "clock.h" 33#include "clock.h"
@@ -3366,8 +3364,6 @@ int __init omap4xxx_clk_init(void)
3366 return 0; 3364 return 0;
3367 } 3365 }
3368 3366
3369 clk_init(&omap2_clk_functions);
3370
3371 /* 3367 /*
3372 * Must stay commented until all OMAP SoC drivers are 3368 * Must stay commented until all OMAP SoC drivers are
3373 * converted to runtime PM, or drivers may start crashing 3369 * converted to runtime PM, or drivers may start crashing
diff --git a/arch/arm/mach-omap2/clockdomain.c b/arch/arm/mach-omap2/clockdomain.c
index cbb879139c51..467567ad526a 100644
--- a/arch/arm/mach-omap2/clockdomain.c
+++ b/arch/arm/mach-omap2/clockdomain.c
@@ -27,7 +27,8 @@
27 27
28#include <linux/bitops.h> 28#include <linux/bitops.h>
29 29
30#include <plat/clock.h> 30#include "soc.h"
31#include "clock.h"
31#include "clockdomain.h" 32#include "clockdomain.h"
32 33
33/* clkdm_list contains all registered struct clockdomains */ 34/* clkdm_list contains all registered struct clockdomains */
diff --git a/arch/arm/mach-omap2/clockdomain.h b/arch/arm/mach-omap2/clockdomain.h
index 629576be7444..bc42446e23ab 100644
--- a/arch/arm/mach-omap2/clockdomain.h
+++ b/arch/arm/mach-omap2/clockdomain.h
@@ -18,9 +18,8 @@
18#include <linux/spinlock.h> 18#include <linux/spinlock.h>
19 19
20#include "powerdomain.h" 20#include "powerdomain.h"
21#include <plat/clock.h> 21#include "clock.h"
22#include <plat/omap_hwmod.h> 22#include "omap_hwmod.h"
23#include <plat/cpu.h>
24 23
25/* 24/*
26 * Clockdomain flags 25 * Clockdomain flags
diff --git a/arch/arm/mach-omap2/clockdomain2xxx_3xxx.c b/arch/arm/mach-omap2/clockdomain2xxx_3xxx.c
index 70294f54e35a..3e4e9209b2df 100644
--- a/arch/arm/mach-omap2/clockdomain2xxx_3xxx.c
+++ b/arch/arm/mach-omap2/clockdomain2xxx_3xxx.c
@@ -14,6 +14,8 @@
14 14
15#include <linux/types.h> 15#include <linux/types.h>
16#include <plat/prcm.h> 16#include <plat/prcm.h>
17
18#include "soc.h"
17#include "prm.h" 19#include "prm.h"
18#include "prm2xxx_3xxx.h" 20#include "prm2xxx_3xxx.h"
19#include "cm.h" 21#include "cm.h"
diff --git a/arch/arm/mach-omap2/clockdomains2420_data.c b/arch/arm/mach-omap2/clockdomains2420_data.c
index 5c741852fac0..7e76becf3a4a 100644
--- a/arch/arm/mach-omap2/clockdomains2420_data.c
+++ b/arch/arm/mach-omap2/clockdomains2420_data.c
@@ -35,6 +35,7 @@
35#include <linux/kernel.h> 35#include <linux/kernel.h>
36#include <linux/io.h> 36#include <linux/io.h>
37 37
38#include "soc.h"
38#include "clockdomain.h" 39#include "clockdomain.h"
39#include "prm2xxx_3xxx.h" 40#include "prm2xxx_3xxx.h"
40#include "cm2xxx_3xxx.h" 41#include "cm2xxx_3xxx.h"
diff --git a/arch/arm/mach-omap2/clockdomains2430_data.c b/arch/arm/mach-omap2/clockdomains2430_data.c
index f09617555e15..b923007e45d0 100644
--- a/arch/arm/mach-omap2/clockdomains2430_data.c
+++ b/arch/arm/mach-omap2/clockdomains2430_data.c
@@ -35,6 +35,7 @@
35#include <linux/kernel.h> 35#include <linux/kernel.h>
36#include <linux/io.h> 36#include <linux/io.h>
37 37
38#include "soc.h"
38#include "clockdomain.h" 39#include "clockdomain.h"
39#include "prm2xxx_3xxx.h" 40#include "prm2xxx_3xxx.h"
40#include "cm2xxx_3xxx.h" 41#include "cm2xxx_3xxx.h"
diff --git a/arch/arm/mach-omap2/clockdomains3xxx_data.c b/arch/arm/mach-omap2/clockdomains3xxx_data.c
index 933a35cd124a..e6b91e552d3d 100644
--- a/arch/arm/mach-omap2/clockdomains3xxx_data.c
+++ b/arch/arm/mach-omap2/clockdomains3xxx_data.c
@@ -33,6 +33,7 @@
33#include <linux/kernel.h> 33#include <linux/kernel.h>
34#include <linux/io.h> 34#include <linux/io.h>
35 35
36#include "soc.h"
36#include "clockdomain.h" 37#include "clockdomain.h"
37#include "prm2xxx_3xxx.h" 38#include "prm2xxx_3xxx.h"
38#include "cm2xxx_3xxx.h" 39#include "cm2xxx_3xxx.h"
diff --git a/arch/arm/mach-omap2/cm33xx.c b/arch/arm/mach-omap2/cm33xx.c
index 13f56eafef03..b4938abf28cc 100644
--- a/arch/arm/mach-omap2/cm33xx.c
+++ b/arch/arm/mach-omap2/cm33xx.c
@@ -22,7 +22,7 @@
22#include <linux/err.h> 22#include <linux/err.h>
23#include <linux/io.h> 23#include <linux/io.h>
24 24
25#include <plat/common.h> 25#include "../plat-omap/common.h"
26 26
27#include "cm.h" 27#include "cm.h"
28#include "cm33xx.h" 28#include "cm33xx.h"
diff --git a/arch/arm/mach-omap2/common-board-devices.c b/arch/arm/mach-omap2/common-board-devices.c
index 48daac2581b4..ad856092c06a 100644
--- a/arch/arm/mach-omap2/common-board-devices.c
+++ b/arch/arm/mach-omap2/common-board-devices.c
@@ -25,7 +25,6 @@
25#include <linux/spi/ads7846.h> 25#include <linux/spi/ads7846.h>
26 26
27#include <linux/platform_data/spi-omap2-mcspi.h> 27#include <linux/platform_data/spi-omap2-mcspi.h>
28#include <linux/platform_data/mtd-nand-omap2.h>
29 28
30#include "common.h" 29#include "common.h"
31#include "common-board-devices.h" 30#include "common-board-devices.h"
@@ -96,48 +95,3 @@ void __init omap_ads7846_init(int bus_num, int gpio_pendown, int gpio_debounce,
96{ 95{
97} 96}
98#endif 97#endif
99
100#if defined(CONFIG_MTD_NAND_OMAP2) || defined(CONFIG_MTD_NAND_OMAP2_MODULE)
101static struct omap_nand_platform_data nand_data;
102
103void __init omap_nand_flash_init(int options, struct mtd_partition *parts,
104 int nr_parts)
105{
106 u8 cs = 0;
107 u8 nandcs = GPMC_CS_NUM + 1;
108
109 /* find out the chip-select on which NAND exists */
110 while (cs < GPMC_CS_NUM) {
111 u32 ret = 0;
112 ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
113
114 if ((ret & 0xC00) == 0x800) {
115 printk(KERN_INFO "Found NAND on CS%d\n", cs);
116 if (nandcs > GPMC_CS_NUM)
117 nandcs = cs;
118 }
119 cs++;
120 }
121
122 if (nandcs > GPMC_CS_NUM) {
123 pr_info("NAND: Unable to find configuration in GPMC\n");
124 return;
125 }
126
127 if (nandcs < GPMC_CS_NUM) {
128 nand_data.cs = nandcs;
129 nand_data.parts = parts;
130 nand_data.nr_parts = nr_parts;
131 nand_data.devsize = options;
132
133 printk(KERN_INFO "Registering NAND on CS%d\n", nandcs);
134 if (gpmc_nand_init(&nand_data) < 0)
135 printk(KERN_ERR "Unable to register NAND device\n");
136 }
137}
138#else
139void __init omap_nand_flash_init(int options, struct mtd_partition *parts,
140 int nr_parts)
141{
142}
143#endif
diff --git a/arch/arm/mach-omap2/common-board-devices.h b/arch/arm/mach-omap2/common-board-devices.h
index a0b4a42836ab..72bb41b3fd25 100644
--- a/arch/arm/mach-omap2/common-board-devices.h
+++ b/arch/arm/mach-omap2/common-board-devices.h
@@ -10,6 +10,5 @@ struct ads7846_platform_data;
10 10
11void omap_ads7846_init(int bus_num, int gpio_pendown, int gpio_debounce, 11void omap_ads7846_init(int bus_num, int gpio_pendown, int gpio_debounce,
12 struct ads7846_platform_data *board_pdata); 12 struct ads7846_platform_data *board_pdata);
13void omap_nand_flash_init(int opts, struct mtd_partition *parts, int n_parts);
14 13
15#endif /* __OMAP_COMMON_BOARD_DEVICES__ */ 14#endif /* __OMAP_COMMON_BOARD_DEVICES__ */
diff --git a/arch/arm/mach-omap2/common.c b/arch/arm/mach-omap2/common.c
index 17950c6e130b..34fb5b95859b 100644
--- a/arch/arm/mach-omap2/common.c
+++ b/arch/arm/mach-omap2/common.c
@@ -16,14 +16,17 @@
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/clk.h> 17#include <linux/clk.h>
18#include <linux/io.h> 18#include <linux/io.h>
19#include <linux/platform_data/dsp-omap.h>
19 20
20#include <plat/clock.h> 21#include <plat/vram.h>
21 22
22#include "soc.h" 23#include "soc.h"
23#include "iomap.h" 24#include "iomap.h"
24#include "common.h" 25#include "common.h"
26#include "clock.h"
25#include "sdrc.h" 27#include "sdrc.h"
26#include "control.h" 28#include "control.h"
29#include "omap-secure.h"
27 30
28/* Global address base setup code */ 31/* Global address base setup code */
29 32
@@ -200,3 +203,20 @@ void __init omap5_map_io(void)
200 omap5_map_common_io(); 203 omap5_map_common_io();
201} 204}
202#endif 205#endif
206
207/*
208 * Stub function for OMAP2 so that common files
209 * continue to build when custom builds are used
210 */
211int __weak omap_secure_ram_reserve_memblock(void)
212{
213 return 0;
214}
215
216void __init omap_reserve(void)
217{
218 omap_vram_reserve_sdram_memblock();
219 omap_dsp_reserve_sdram_memblock();
220 omap_secure_ram_reserve_memblock();
221 omap_barrier_reserve_memblock();
222}
diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h
index 7045e4d61ac3..d135d551d124 100644
--- a/arch/arm/mach-omap2/common.h
+++ b/arch/arm/mach-omap2/common.h
@@ -28,13 +28,17 @@
28 28
29#include <linux/irq.h> 29#include <linux/irq.h>
30#include <linux/delay.h> 30#include <linux/delay.h>
31#include <linux/i2c.h>
31#include <linux/i2c/twl.h> 32#include <linux/i2c/twl.h>
33#include <linux/i2c-omap.h>
32 34
33#include <asm/proc-fns.h> 35#include <asm/proc-fns.h>
34 36
35#include <plat/cpu.h>
36#include <plat/serial.h> 37#include <plat/serial.h>
37#include <plat/common.h> 38
39#include "../plat-omap/common.h"
40
41#include "i2c.h"
38 42
39#define OMAP_INTC_START NR_IRQS 43#define OMAP_INTC_START NR_IRQS
40 44
@@ -338,6 +342,7 @@ extern void omap_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
338 struct omap_sdrc_params *sdrc_cs1); 342 struct omap_sdrc_params *sdrc_cs1);
339struct omap2_hsmmc_info; 343struct omap2_hsmmc_info;
340extern int omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers); 344extern int omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers);
345extern void omap_reserve(void);
341 346
342#endif /* __ASSEMBLER__ */ 347#endif /* __ASSEMBLER__ */
343#endif /* __ARCH_ARM_MACH_OMAP2PLUS_COMMON_H */ 348#endif /* __ARCH_ARM_MACH_OMAP2PLUS_COMMON_H */
diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c
index d1ff8399a222..bf2be5c5468d 100644
--- a/arch/arm/mach-omap2/control.c
+++ b/arch/arm/mach-omap2/control.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * OMAP2/3 System Control Module register access 2 * OMAP2/3 System Control Module register access
3 * 3 *
4 * Copyright (C) 2007 Texas Instruments, Inc. 4 * Copyright (C) 2007, 2012 Texas Instruments, Inc.
5 * Copyright (C) 2007 Nokia Corporation 5 * Copyright (C) 2007 Nokia Corporation
6 * 6 *
7 * Written by Paul Walmsley 7 * Written by Paul Walmsley
@@ -15,8 +15,6 @@
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/io.h> 16#include <linux/io.h>
17 17
18#include <plat/sdrc.h>
19
20#include "soc.h" 18#include "soc.h"
21#include "iomap.h" 19#include "iomap.h"
22#include "common.h" 20#include "common.h"
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index c8c211731d26..86a5e13c9f59 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -23,10 +23,11 @@
23#include <asm/mach-types.h> 23#include <asm/mach-types.h>
24#include <asm/mach/map.h> 24#include <asm/mach/map.h>
25 25
26#include <plat-omap/dma-omap.h>
27
26#include "iomap.h" 28#include "iomap.h"
27#include <plat/dma.h> 29#include "omap_hwmod.h"
28#include <plat/omap_hwmod.h> 30#include "omap_device.h"
29#include <plat/omap_device.h>
30#include "omap4-keypad.h" 31#include "omap4-keypad.h"
31 32
32#include "soc.h" 33#include "soc.h"
@@ -34,6 +35,7 @@
34#include "mux.h" 35#include "mux.h"
35#include "control.h" 36#include "control.h"
36#include "devices.h" 37#include "devices.h"
38#include "dma.h"
37 39
38#define L3_MODULES_MAX_LEN 12 40#define L3_MODULES_MAX_LEN 12
39#define L3_MODULES 3 41#define L3_MODULES 3
diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
index 1011995f150a..89c57129357a 100644
--- a/arch/arm/mach-omap2/display.c
+++ b/arch/arm/mach-omap2/display.c
@@ -25,11 +25,12 @@
25#include <linux/delay.h> 25#include <linux/delay.h>
26 26
27#include <video/omapdss.h> 27#include <video/omapdss.h>
28#include <plat/omap_hwmod.h> 28#include "omap_hwmod.h"
29#include <plat/omap_device.h> 29#include "omap_device.h"
30#include <plat/omap-pm.h> 30#include "omap-pm.h"
31#include "common.h" 31#include "common.h"
32 32
33#include "soc.h"
33#include "iomap.h" 34#include "iomap.h"
34#include "mux.h" 35#include "mux.h"
35#include "control.h" 36#include "control.h"
@@ -284,6 +285,35 @@ err:
284 return ERR_PTR(r); 285 return ERR_PTR(r);
285} 286}
286 287
288static enum omapdss_version __init omap_display_get_version(void)
289{
290 if (cpu_is_omap24xx())
291 return OMAPDSS_VER_OMAP24xx;
292 else if (cpu_is_omap3630())
293 return OMAPDSS_VER_OMAP3630;
294 else if (cpu_is_omap34xx()) {
295 if (soc_is_am35xx()) {
296 return OMAPDSS_VER_AM35xx;
297 } else {
298 if (omap_rev() < OMAP3430_REV_ES3_0)
299 return OMAPDSS_VER_OMAP34xx_ES1;
300 else
301 return OMAPDSS_VER_OMAP34xx_ES3;
302 }
303 } else if (omap_rev() == OMAP4430_REV_ES1_0)
304 return OMAPDSS_VER_OMAP4430_ES1;
305 else if (omap_rev() == OMAP4430_REV_ES2_0 ||
306 omap_rev() == OMAP4430_REV_ES2_1 ||
307 omap_rev() == OMAP4430_REV_ES2_2)
308 return OMAPDSS_VER_OMAP4430_ES2;
309 else if (cpu_is_omap44xx())
310 return OMAPDSS_VER_OMAP4;
311 else if (soc_is_omap54xx())
312 return OMAPDSS_VER_OMAP5;
313 else
314 return OMAPDSS_VER_UNKNOWN;
315}
316
287int __init omap_display_init(struct omap_dss_board_info *board_data) 317int __init omap_display_init(struct omap_dss_board_info *board_data)
288{ 318{
289 int r = 0; 319 int r = 0;
@@ -291,9 +321,18 @@ int __init omap_display_init(struct omap_dss_board_info *board_data)
291 int i, oh_count; 321 int i, oh_count;
292 const struct omap_dss_hwmod_data *curr_dss_hwmod; 322 const struct omap_dss_hwmod_data *curr_dss_hwmod;
293 struct platform_device *dss_pdev; 323 struct platform_device *dss_pdev;
324 enum omapdss_version ver;
294 325
295 /* create omapdss device */ 326 /* create omapdss device */
296 327
328 ver = omap_display_get_version();
329
330 if (ver == OMAPDSS_VER_UNKNOWN) {
331 pr_err("DSS not supported on this SoC\n");
332 return -ENODEV;
333 }
334
335 board_data->version = ver;
297 board_data->dsi_enable_pads = omap_dsi_enable_pads; 336 board_data->dsi_enable_pads = omap_dsi_enable_pads;
298 board_data->dsi_disable_pads = omap_dsi_disable_pads; 337 board_data->dsi_disable_pads = omap_dsi_disable_pads;
299 board_data->get_context_loss_count = omap_pm_get_dev_context_loss_count; 338 board_data->get_context_loss_count = omap_pm_get_dev_context_loss_count;
diff --git a/arch/arm/mach-omap2/dma.c b/arch/arm/mach-omap2/dma.c
index ff75abe60af2..b1926cd70468 100644
--- a/arch/arm/mach-omap2/dma.c
+++ b/arch/arm/mach-omap2/dma.c
@@ -28,9 +28,11 @@
28#include <linux/init.h> 28#include <linux/init.h>
29#include <linux/device.h> 29#include <linux/device.h>
30 30
31#include <plat/omap_hwmod.h> 31#include <plat-omap/dma-omap.h>
32#include <plat/omap_device.h> 32
33#include <plat/dma.h> 33#include "soc.h"
34#include "omap_hwmod.h"
35#include "omap_device.h"
34 36
35#define OMAP2_DMA_STRIDE 0x60 37#define OMAP2_DMA_STRIDE 0x60
36 38
diff --git a/arch/arm/mach-omap2/dma.h b/arch/arm/mach-omap2/dma.h
new file mode 100644
index 000000000000..eba80dbc5218
--- /dev/null
+++ b/arch/arm/mach-omap2/dma.h
@@ -0,0 +1,131 @@
1/*
2 * OMAP2PLUS DMA channel definitions
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
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 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19#ifndef __OMAP2PLUS_DMA_CHANNEL_H
20#define __OMAP2PLUS_DMA_CHANNEL_H
21
22
23/* DMA channels for 24xx */
24#define OMAP24XX_DMA_NO_DEVICE 0
25#define OMAP24XX_DMA_XTI_DMA 1 /* S_DMA_0 */
26#define OMAP24XX_DMA_EXT_DMAREQ0 2 /* S_DMA_1 */
27#define OMAP24XX_DMA_EXT_DMAREQ1 3 /* S_DMA_2 */
28#define OMAP24XX_DMA_GPMC 4 /* S_DMA_3 */
29#define OMAP24XX_DMA_GFX 5 /* S_DMA_4 */
30#define OMAP24XX_DMA_DSS 6 /* S_DMA_5 */
31#define OMAP242X_DMA_VLYNQ_TX 7 /* S_DMA_6 */
32#define OMAP24XX_DMA_EXT_DMAREQ2 7 /* S_DMA_6 */
33#define OMAP24XX_DMA_CWT 8 /* S_DMA_7 */
34#define OMAP24XX_DMA_AES_TX 9 /* S_DMA_8 */
35#define OMAP24XX_DMA_AES_RX 10 /* S_DMA_9 */
36#define OMAP24XX_DMA_DES_TX 11 /* S_DMA_10 */
37#define OMAP24XX_DMA_DES_RX 12 /* S_DMA_11 */
38#define OMAP24XX_DMA_SHA1MD5_RX 13 /* S_DMA_12 */
39#define OMAP34XX_DMA_SHA2MD5_RX 13 /* S_DMA_12 */
40#define OMAP242X_DMA_EXT_DMAREQ2 14 /* S_DMA_13 */
41#define OMAP242X_DMA_EXT_DMAREQ3 15 /* S_DMA_14 */
42#define OMAP242X_DMA_EXT_DMAREQ4 16 /* S_DMA_15 */
43#define OMAP242X_DMA_EAC_AC_RD 17 /* S_DMA_16 */
44#define OMAP242X_DMA_EAC_AC_WR 18 /* S_DMA_17 */
45#define OMAP242X_DMA_EAC_MD_UL_RD 19 /* S_DMA_18 */
46#define OMAP242X_DMA_EAC_MD_UL_WR 20 /* S_DMA_19 */
47#define OMAP242X_DMA_EAC_MD_DL_RD 21 /* S_DMA_20 */
48#define OMAP242X_DMA_EAC_MD_DL_WR 22 /* S_DMA_21 */
49#define OMAP242X_DMA_EAC_BT_UL_RD 23 /* S_DMA_22 */
50#define OMAP242X_DMA_EAC_BT_UL_WR 24 /* S_DMA_23 */
51#define OMAP242X_DMA_EAC_BT_DL_RD 25 /* S_DMA_24 */
52#define OMAP242X_DMA_EAC_BT_DL_WR 26 /* S_DMA_25 */
53#define OMAP243X_DMA_EXT_DMAREQ3 14 /* S_DMA_13 */
54#define OMAP24XX_DMA_SPI3_TX0 15 /* S_DMA_14 */
55#define OMAP24XX_DMA_SPI3_RX0 16 /* S_DMA_15 */
56#define OMAP24XX_DMA_MCBSP3_TX 17 /* S_DMA_16 */
57#define OMAP24XX_DMA_MCBSP3_RX 18 /* S_DMA_17 */
58#define OMAP24XX_DMA_MCBSP4_TX 19 /* S_DMA_18 */
59#define OMAP24XX_DMA_MCBSP4_RX 20 /* S_DMA_19 */
60#define OMAP24XX_DMA_MCBSP5_TX 21 /* S_DMA_20 */
61#define OMAP24XX_DMA_MCBSP5_RX 22 /* S_DMA_21 */
62#define OMAP24XX_DMA_SPI3_TX1 23 /* S_DMA_22 */
63#define OMAP24XX_DMA_SPI3_RX1 24 /* S_DMA_23 */
64#define OMAP243X_DMA_EXT_DMAREQ4 25 /* S_DMA_24 */
65#define OMAP243X_DMA_EXT_DMAREQ5 26 /* S_DMA_25 */
66#define OMAP34XX_DMA_I2C3_TX 25 /* S_DMA_24 */
67#define OMAP34XX_DMA_I2C3_RX 26 /* S_DMA_25 */
68#define OMAP24XX_DMA_I2C1_TX 27 /* S_DMA_26 */
69#define OMAP24XX_DMA_I2C1_RX 28 /* S_DMA_27 */
70#define OMAP24XX_DMA_I2C2_TX 29 /* S_DMA_28 */
71#define OMAP24XX_DMA_I2C2_RX 30 /* S_DMA_29 */
72#define OMAP24XX_DMA_MCBSP1_TX 31 /* S_DMA_30 */
73#define OMAP24XX_DMA_MCBSP1_RX 32 /* S_DMA_31 */
74#define OMAP24XX_DMA_MCBSP2_TX 33 /* S_DMA_32 */
75#define OMAP24XX_DMA_MCBSP2_RX 34 /* S_DMA_33 */
76#define OMAP24XX_DMA_SPI1_TX0 35 /* S_DMA_34 */
77#define OMAP24XX_DMA_SPI1_RX0 36 /* S_DMA_35 */
78#define OMAP24XX_DMA_SPI1_TX1 37 /* S_DMA_36 */
79#define OMAP24XX_DMA_SPI1_RX1 38 /* S_DMA_37 */
80#define OMAP24XX_DMA_SPI1_TX2 39 /* S_DMA_38 */
81#define OMAP24XX_DMA_SPI1_RX2 40 /* S_DMA_39 */
82#define OMAP24XX_DMA_SPI1_TX3 41 /* S_DMA_40 */
83#define OMAP24XX_DMA_SPI1_RX3 42 /* S_DMA_41 */
84#define OMAP24XX_DMA_SPI2_TX0 43 /* S_DMA_42 */
85#define OMAP24XX_DMA_SPI2_RX0 44 /* S_DMA_43 */
86#define OMAP24XX_DMA_SPI2_TX1 45 /* S_DMA_44 */
87#define OMAP24XX_DMA_SPI2_RX1 46 /* S_DMA_45 */
88#define OMAP24XX_DMA_MMC2_TX 47 /* S_DMA_46 */
89#define OMAP24XX_DMA_MMC2_RX 48 /* S_DMA_47 */
90#define OMAP24XX_DMA_UART1_TX 49 /* S_DMA_48 */
91#define OMAP24XX_DMA_UART1_RX 50 /* S_DMA_49 */
92#define OMAP24XX_DMA_UART2_TX 51 /* S_DMA_50 */
93#define OMAP24XX_DMA_UART2_RX 52 /* S_DMA_51 */
94#define OMAP24XX_DMA_UART3_TX 53 /* S_DMA_52 */
95#define OMAP24XX_DMA_UART3_RX 54 /* S_DMA_53 */
96#define OMAP24XX_DMA_USB_W2FC_TX0 55 /* S_DMA_54 */
97#define OMAP24XX_DMA_USB_W2FC_RX0 56 /* S_DMA_55 */
98#define OMAP24XX_DMA_USB_W2FC_TX1 57 /* S_DMA_56 */
99#define OMAP24XX_DMA_USB_W2FC_RX1 58 /* S_DMA_57 */
100#define OMAP24XX_DMA_USB_W2FC_TX2 59 /* S_DMA_58 */
101#define OMAP24XX_DMA_USB_W2FC_RX2 60 /* S_DMA_59 */
102#define OMAP24XX_DMA_MMC1_TX 61 /* S_DMA_60 */
103#define OMAP24XX_DMA_MMC1_RX 62 /* S_DMA_61 */
104#define OMAP24XX_DMA_MS 63 /* S_DMA_62 */
105#define OMAP242X_DMA_EXT_DMAREQ5 64 /* S_DMA_63 */
106#define OMAP243X_DMA_EXT_DMAREQ6 64 /* S_DMA_63 */
107#define OMAP34XX_DMA_EXT_DMAREQ3 64 /* S_DMA_63 */
108#define OMAP34XX_DMA_AES2_TX 65 /* S_DMA_64 */
109#define OMAP34XX_DMA_AES2_RX 66 /* S_DMA_65 */
110#define OMAP34XX_DMA_DES2_TX 67 /* S_DMA_66 */
111#define OMAP34XX_DMA_DES2_RX 68 /* S_DMA_67 */
112#define OMAP34XX_DMA_SHA1MD5_RX 69 /* S_DMA_68 */
113#define OMAP34XX_DMA_SPI4_TX0 70 /* S_DMA_69 */
114#define OMAP34XX_DMA_SPI4_RX0 71 /* S_DMA_70 */
115#define OMAP34XX_DSS_DMA0 72 /* S_DMA_71 */
116#define OMAP34XX_DSS_DMA1 73 /* S_DMA_72 */
117#define OMAP34XX_DSS_DMA2 74 /* S_DMA_73 */
118#define OMAP34XX_DSS_DMA3 75 /* S_DMA_74 */
119#define OMAP34XX_DMA_MMC3_TX 77 /* S_DMA_76 */
120#define OMAP34XX_DMA_MMC3_RX 78 /* S_DMA_77 */
121#define OMAP34XX_DMA_USIM_TX 79 /* S_DMA_78 */
122#define OMAP34XX_DMA_USIM_RX 80 /* S_DMA_79 */
123
124#define OMAP36XX_DMA_UART4_TX 81 /* S_DMA_80 */
125#define OMAP36XX_DMA_UART4_RX 82 /* S_DMA_81 */
126
127/* Only for AM35xx */
128#define AM35XX_DMA_UART4_TX 54
129#define AM35XX_DMA_UART4_RX 55
130
131#endif /* __OMAP2PLUS_DMA_CHANNEL_H */
diff --git a/arch/arm/mach-omap2/dpll3xxx.c b/arch/arm/mach-omap2/dpll3xxx.c
index 814e1808e158..eacf51f2bc27 100644
--- a/arch/arm/mach-omap2/dpll3xxx.c
+++ b/arch/arm/mach-omap2/dpll3xxx.c
@@ -28,8 +28,6 @@
28#include <linux/bitops.h> 28#include <linux/bitops.h>
29#include <linux/clkdev.h> 29#include <linux/clkdev.h>
30 30
31#include <plat/clock.h>
32
33#include "soc.h" 31#include "soc.h"
34#include "clock.h" 32#include "clock.h"
35#include "cm2xxx_3xxx.h" 33#include "cm2xxx_3xxx.h"
diff --git a/arch/arm/mach-omap2/dpll44xx.c b/arch/arm/mach-omap2/dpll44xx.c
index 09d0ccccb861..5854da168a9c 100644
--- a/arch/arm/mach-omap2/dpll44xx.c
+++ b/arch/arm/mach-omap2/dpll44xx.c
@@ -15,8 +15,6 @@
15#include <linux/io.h> 15#include <linux/io.h>
16#include <linux/bitops.h> 16#include <linux/bitops.h>
17 17
18#include <plat/clock.h>
19
20#include "soc.h" 18#include "soc.h"
21#include "clock.h" 19#include "clock.h"
22#include "clock44xx.h" 20#include "clock44xx.h"
diff --git a/arch/arm/mach-omap2/drm.c b/arch/arm/mach-omap2/drm.c
index 72e0f01b715c..6282cc826613 100644
--- a/arch/arm/mach-omap2/drm.c
+++ b/arch/arm/mach-omap2/drm.c
@@ -24,8 +24,8 @@
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/dma-mapping.h> 25#include <linux/dma-mapping.h>
26 26
27#include <plat/omap_device.h> 27#include "omap_device.h"
28#include <plat/omap_hwmod.h> 28#include "omap_hwmod.h"
29 29
30#if defined(CONFIG_DRM_OMAP) || (CONFIG_DRM_OMAP_MODULE) 30#if defined(CONFIG_DRM_OMAP) || (CONFIG_DRM_OMAP_MODULE)
31 31
diff --git a/arch/arm/mach-omap2/dsp.c b/arch/arm/mach-omap2/dsp.c
index 98388109f22a..b155500e84a8 100644
--- a/arch/arm/mach-omap2/dsp.c
+++ b/arch/arm/mach-omap2/dsp.c
@@ -27,7 +27,7 @@
27#include "cm2xxx_3xxx.h" 27#include "cm2xxx_3xxx.h"
28#include "prm2xxx_3xxx.h" 28#include "prm2xxx_3xxx.h"
29#ifdef CONFIG_BRIDGE_DVFS 29#ifdef CONFIG_BRIDGE_DVFS
30#include <plat/omap-pm.h> 30#include "omap-pm.h"
31#endif 31#endif
32 32
33#include <linux/platform_data/dsp-omap.h> 33#include <linux/platform_data/dsp-omap.h>
diff --git a/arch/arm/mach-omap2/gpio.c b/arch/arm/mach-omap2/gpio.c
index d1058f16fb40..399acabc3d0b 100644
--- a/arch/arm/mach-omap2/gpio.c
+++ b/arch/arm/mach-omap2/gpio.c
@@ -23,9 +23,9 @@
23#include <linux/of.h> 23#include <linux/of.h>
24#include <linux/platform_data/gpio-omap.h> 24#include <linux/platform_data/gpio-omap.h>
25 25
26#include <plat/omap_hwmod.h> 26#include "omap_hwmod.h"
27#include <plat/omap_device.h> 27#include "omap_device.h"
28#include <plat/omap-pm.h> 28#include "omap-pm.h"
29 29
30#include "powerdomain.h" 30#include "powerdomain.h"
31 31
diff --git a/arch/arm/mach-omap2/gpmc-nand.c b/arch/arm/mach-omap2/gpmc-nand.c
index 4acf497faeb3..8607735b3ab3 100644
--- a/arch/arm/mach-omap2/gpmc-nand.c
+++ b/arch/arm/mach-omap2/gpmc-nand.c
@@ -17,9 +17,12 @@
17 17
18#include <asm/mach/flash.h> 18#include <asm/mach/flash.h>
19 19
20#include <plat/gpmc.h> 20#include "gpmc.h"
21
22#include "soc.h" 21#include "soc.h"
22#include "gpmc-nand.h"
23
24/* minimum size for IO mapping */
25#define NAND_IO_SIZE 4
23 26
24static struct resource gpmc_nand_resource[] = { 27static struct resource gpmc_nand_resource[] = {
25 { 28 {
@@ -40,41 +43,36 @@ static struct platform_device gpmc_nand_device = {
40 .resource = gpmc_nand_resource, 43 .resource = gpmc_nand_resource,
41}; 44};
42 45
43static int omap2_nand_gpmc_retime(struct omap_nand_platform_data *gpmc_nand_data) 46static int omap2_nand_gpmc_retime(
47 struct omap_nand_platform_data *gpmc_nand_data,
48 struct gpmc_timings *gpmc_t)
44{ 49{
45 struct gpmc_timings t; 50 struct gpmc_timings t;
46 int err; 51 int err;
47 52
48 if (!gpmc_nand_data->gpmc_t)
49 return 0;
50
51 memset(&t, 0, sizeof(t)); 53 memset(&t, 0, sizeof(t));
52 t.sync_clk = gpmc_nand_data->gpmc_t->sync_clk; 54 t.sync_clk = gpmc_t->sync_clk;
53 t.cs_on = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->cs_on); 55 t.cs_on = gpmc_round_ns_to_ticks(gpmc_t->cs_on);
54 t.adv_on = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->adv_on); 56 t.adv_on = gpmc_round_ns_to_ticks(gpmc_t->adv_on);
55 57
56 /* Read */ 58 /* Read */
57 t.adv_rd_off = gpmc_round_ns_to_ticks( 59 t.adv_rd_off = gpmc_round_ns_to_ticks(gpmc_t->adv_rd_off);
58 gpmc_nand_data->gpmc_t->adv_rd_off);
59 t.oe_on = t.adv_on; 60 t.oe_on = t.adv_on;
60 t.access = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->access); 61 t.access = gpmc_round_ns_to_ticks(gpmc_t->access);
61 t.oe_off = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->oe_off); 62 t.oe_off = gpmc_round_ns_to_ticks(gpmc_t->oe_off);
62 t.cs_rd_off = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->cs_rd_off); 63 t.cs_rd_off = gpmc_round_ns_to_ticks(gpmc_t->cs_rd_off);
63 t.rd_cycle = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->rd_cycle); 64 t.rd_cycle = gpmc_round_ns_to_ticks(gpmc_t->rd_cycle);
64 65
65 /* Write */ 66 /* Write */
66 t.adv_wr_off = gpmc_round_ns_to_ticks( 67 t.adv_wr_off = gpmc_round_ns_to_ticks(gpmc_t->adv_wr_off);
67 gpmc_nand_data->gpmc_t->adv_wr_off);
68 t.we_on = t.oe_on; 68 t.we_on = t.oe_on;
69 if (cpu_is_omap34xx()) { 69 if (cpu_is_omap34xx()) {
70 t.wr_data_mux_bus = gpmc_round_ns_to_ticks( 70 t.wr_data_mux_bus = gpmc_round_ns_to_ticks(gpmc_t->wr_data_mux_bus);
71 gpmc_nand_data->gpmc_t->wr_data_mux_bus); 71 t.wr_access = gpmc_round_ns_to_ticks(gpmc_t->wr_access);
72 t.wr_access = gpmc_round_ns_to_ticks(
73 gpmc_nand_data->gpmc_t->wr_access);
74 } 72 }
75 t.we_off = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->we_off); 73 t.we_off = gpmc_round_ns_to_ticks(gpmc_t->we_off);
76 t.cs_wr_off = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->cs_wr_off); 74 t.cs_wr_off = gpmc_round_ns_to_ticks(gpmc_t->cs_wr_off);
77 t.wr_cycle = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->wr_cycle); 75 t.wr_cycle = gpmc_round_ns_to_ticks(gpmc_t->wr_cycle);
78 76
79 /* Configure GPMC */ 77 /* Configure GPMC */
80 if (gpmc_nand_data->devsize == NAND_BUSWIDTH_16) 78 if (gpmc_nand_data->devsize == NAND_BUSWIDTH_16)
@@ -91,7 +89,29 @@ static int omap2_nand_gpmc_retime(struct omap_nand_platform_data *gpmc_nand_data
91 return 0; 89 return 0;
92} 90}
93 91
94int __init gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data) 92static bool __init gpmc_hwecc_bch_capable(enum omap_ecc ecc_opt)
93{
94 /* support only OMAP3 class */
95 if (!cpu_is_omap34xx()) {
96 pr_err("BCH ecc is not supported on this CPU\n");
97 return 0;
98 }
99
100 /*
101 * For now, assume 4-bit mode is only supported on OMAP3630 ES1.x, x>=1.
102 * Other chips may be added if confirmed to work.
103 */
104 if ((ecc_opt == OMAP_ECC_BCH4_CODE_HW) &&
105 (!cpu_is_omap3630() || (GET_OMAP_REVISION() == 0))) {
106 pr_err("BCH 4-bit mode is not supported on this CPU\n");
107 return 0;
108 }
109
110 return 1;
111}
112
113int __init gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data,
114 struct gpmc_timings *gpmc_t)
95{ 115{
96 int err = 0; 116 int err = 0;
97 struct device *dev = &gpmc_nand_device.dev; 117 struct device *dev = &gpmc_nand_device.dev;
@@ -112,11 +132,13 @@ int __init gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data)
112 gpmc_get_client_irq(GPMC_IRQ_FIFOEVENTENABLE); 132 gpmc_get_client_irq(GPMC_IRQ_FIFOEVENTENABLE);
113 gpmc_nand_resource[2].start = 133 gpmc_nand_resource[2].start =
114 gpmc_get_client_irq(GPMC_IRQ_COUNT_EVENT); 134 gpmc_get_client_irq(GPMC_IRQ_COUNT_EVENT);
115 /* Set timings in GPMC */ 135
116 err = omap2_nand_gpmc_retime(gpmc_nand_data); 136 if (gpmc_t) {
117 if (err < 0) { 137 err = omap2_nand_gpmc_retime(gpmc_nand_data, gpmc_t);
118 dev_err(dev, "Unable to set gpmc timings: %d\n", err); 138 if (err < 0) {
119 return err; 139 dev_err(dev, "Unable to set gpmc timings: %d\n", err);
140 return err;
141 }
120 } 142 }
121 143
122 /* Enable RD PIN Monitoring Reg */ 144 /* Enable RD PIN Monitoring Reg */
@@ -126,6 +148,9 @@ int __init gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data)
126 148
127 gpmc_update_nand_reg(&gpmc_nand_data->reg, gpmc_nand_data->cs); 149 gpmc_update_nand_reg(&gpmc_nand_data->reg, gpmc_nand_data->cs);
128 150
151 if (!gpmc_hwecc_bch_capable(gpmc_nand_data->ecc_opt))
152 return -EINVAL;
153
129 err = platform_device_register(&gpmc_nand_device); 154 err = platform_device_register(&gpmc_nand_device);
130 if (err < 0) { 155 if (err < 0) {
131 dev_err(dev, "Unable to register NAND device\n"); 156 dev_err(dev, "Unable to register NAND device\n");
diff --git a/arch/arm/mach-omap2/gpmc-nand.h b/arch/arm/mach-omap2/gpmc-nand.h
new file mode 100644
index 000000000000..d59e1281e851
--- /dev/null
+++ b/arch/arm/mach-omap2/gpmc-nand.h
@@ -0,0 +1,27 @@
1/*
2 * arch/arm/mach-omap2/gpmc-nand.h
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 */
9
10#ifndef __OMAP2_GPMC_NAND_H
11#define __OMAP2_GPMC_NAND_H
12
13#include "gpmc.h"
14#include <linux/platform_data/mtd-nand-omap2.h>
15
16#if IS_ENABLED(CONFIG_MTD_NAND_OMAP2)
17extern int gpmc_nand_init(struct omap_nand_platform_data *d,
18 struct gpmc_timings *gpmc_t);
19#else
20static inline int gpmc_nand_init(struct omap_nand_platform_data *d,
21 struct gpmc_timings *gpmc_t)
22{
23 return 0;
24}
25#endif
26
27#endif
diff --git a/arch/arm/mach-omap2/gpmc-onenand.c b/arch/arm/mach-omap2/gpmc-onenand.c
index 916716e1da3b..d102183ed9a5 100644
--- a/arch/arm/mach-omap2/gpmc-onenand.c
+++ b/arch/arm/mach-omap2/gpmc-onenand.c
@@ -16,15 +16,25 @@
16#include <linux/mtd/onenand_regs.h> 16#include <linux/mtd/onenand_regs.h>
17#include <linux/io.h> 17#include <linux/io.h>
18#include <linux/platform_data/mtd-onenand-omap2.h> 18#include <linux/platform_data/mtd-onenand-omap2.h>
19#include <linux/err.h>
19 20
20#include <asm/mach/flash.h> 21#include <asm/mach/flash.h>
21 22
22#include <plat/gpmc.h> 23#include "gpmc.h"
23
24#include "soc.h" 24#include "soc.h"
25#include "gpmc-onenand.h"
25 26
26#define ONENAND_IO_SIZE SZ_128K 27#define ONENAND_IO_SIZE SZ_128K
27 28
29#define ONENAND_FLAG_SYNCREAD (1 << 0)
30#define ONENAND_FLAG_SYNCWRITE (1 << 1)
31#define ONENAND_FLAG_HF (1 << 2)
32#define ONENAND_FLAG_VHF (1 << 3)
33
34static unsigned onenand_flags;
35static unsigned latency;
36static int fclk_offset;
37
28static struct omap_onenand_platform_data *gpmc_onenand_data; 38static struct omap_onenand_platform_data *gpmc_onenand_data;
29 39
30static struct resource gpmc_onenand_resource = { 40static struct resource gpmc_onenand_resource = {
@@ -38,11 +48,9 @@ static struct platform_device gpmc_onenand_device = {
38 .resource = &gpmc_onenand_resource, 48 .resource = &gpmc_onenand_resource,
39}; 49};
40 50
41static int omap2_onenand_set_async_mode(int cs, void __iomem *onenand_base) 51static struct gpmc_timings omap2_onenand_calc_async_timings(void)
42{ 52{
43 struct gpmc_timings t; 53 struct gpmc_timings t;
44 u32 reg;
45 int err;
46 54
47 const int t_cer = 15; 55 const int t_cer = 15;
48 const int t_avdp = 12; 56 const int t_avdp = 12;
@@ -55,11 +63,6 @@ static int omap2_onenand_set_async_mode(int cs, void __iomem *onenand_base)
55 const int t_wpl = 40; 63 const int t_wpl = 40;
56 const int t_wph = 30; 64 const int t_wph = 30;
57 65
58 /* Ensure sync read and sync write are disabled */
59 reg = readw(onenand_base + ONENAND_REG_SYS_CFG1);
60 reg &= ~ONENAND_SYS_CFG1_SYNC_READ & ~ONENAND_SYS_CFG1_SYNC_WRITE;
61 writew(reg, onenand_base + ONENAND_REG_SYS_CFG1);
62
63 memset(&t, 0, sizeof(t)); 66 memset(&t, 0, sizeof(t));
64 t.sync_clk = 0; 67 t.sync_clk = 0;
65 t.cs_on = 0; 68 t.cs_on = 0;
@@ -86,25 +89,30 @@ static int omap2_onenand_set_async_mode(int cs, void __iomem *onenand_base)
86 t.cs_wr_off = t.we_off + gpmc_round_ns_to_ticks(t_wph); 89 t.cs_wr_off = t.we_off + gpmc_round_ns_to_ticks(t_wph);
87 t.wr_cycle = t.cs_wr_off + gpmc_round_ns_to_ticks(t_cez); 90 t.wr_cycle = t.cs_wr_off + gpmc_round_ns_to_ticks(t_cez);
88 91
92 return t;
93}
94
95static int gpmc_set_async_mode(int cs, struct gpmc_timings *t)
96{
89 /* Configure GPMC for asynchronous read */ 97 /* Configure GPMC for asynchronous read */
90 gpmc_cs_write_reg(cs, GPMC_CS_CONFIG1, 98 gpmc_cs_write_reg(cs, GPMC_CS_CONFIG1,
91 GPMC_CONFIG1_DEVICESIZE_16 | 99 GPMC_CONFIG1_DEVICESIZE_16 |
92 GPMC_CONFIG1_MUXADDDATA); 100 GPMC_CONFIG1_MUXADDDATA);
93 101
94 err = gpmc_cs_set_timings(cs, &t); 102 return gpmc_cs_set_timings(cs, t);
95 if (err) 103}
96 return err; 104
105static void omap2_onenand_set_async_mode(void __iomem *onenand_base)
106{
107 u32 reg;
97 108
98 /* Ensure sync read and sync write are disabled */ 109 /* Ensure sync read and sync write are disabled */
99 reg = readw(onenand_base + ONENAND_REG_SYS_CFG1); 110 reg = readw(onenand_base + ONENAND_REG_SYS_CFG1);
100 reg &= ~ONENAND_SYS_CFG1_SYNC_READ & ~ONENAND_SYS_CFG1_SYNC_WRITE; 111 reg &= ~ONENAND_SYS_CFG1_SYNC_READ & ~ONENAND_SYS_CFG1_SYNC_WRITE;
101 writew(reg, onenand_base + ONENAND_REG_SYS_CFG1); 112 writew(reg, onenand_base + ONENAND_REG_SYS_CFG1);
102
103 return 0;
104} 113}
105 114
106static void set_onenand_cfg(void __iomem *onenand_base, int latency, 115static void set_onenand_cfg(void __iomem *onenand_base)
107 int sync_read, int sync_write, int hf, int vhf)
108{ 116{
109 u32 reg; 117 u32 reg;
110 118
@@ -112,19 +120,19 @@ static void set_onenand_cfg(void __iomem *onenand_base, int latency,
112 reg &= ~((0x7 << ONENAND_SYS_CFG1_BRL_SHIFT) | (0x7 << 9)); 120 reg &= ~((0x7 << ONENAND_SYS_CFG1_BRL_SHIFT) | (0x7 << 9));
113 reg |= (latency << ONENAND_SYS_CFG1_BRL_SHIFT) | 121 reg |= (latency << ONENAND_SYS_CFG1_BRL_SHIFT) |
114 ONENAND_SYS_CFG1_BL_16; 122 ONENAND_SYS_CFG1_BL_16;
115 if (sync_read) 123 if (onenand_flags & ONENAND_FLAG_SYNCREAD)
116 reg |= ONENAND_SYS_CFG1_SYNC_READ; 124 reg |= ONENAND_SYS_CFG1_SYNC_READ;
117 else 125 else
118 reg &= ~ONENAND_SYS_CFG1_SYNC_READ; 126 reg &= ~ONENAND_SYS_CFG1_SYNC_READ;
119 if (sync_write) 127 if (onenand_flags & ONENAND_FLAG_SYNCWRITE)
120 reg |= ONENAND_SYS_CFG1_SYNC_WRITE; 128 reg |= ONENAND_SYS_CFG1_SYNC_WRITE;
121 else 129 else
122 reg &= ~ONENAND_SYS_CFG1_SYNC_WRITE; 130 reg &= ~ONENAND_SYS_CFG1_SYNC_WRITE;
123 if (hf) 131 if (onenand_flags & ONENAND_FLAG_HF)
124 reg |= ONENAND_SYS_CFG1_HF; 132 reg |= ONENAND_SYS_CFG1_HF;
125 else 133 else
126 reg &= ~ONENAND_SYS_CFG1_HF; 134 reg &= ~ONENAND_SYS_CFG1_HF;
127 if (vhf) 135 if (onenand_flags & ONENAND_FLAG_VHF)
128 reg |= ONENAND_SYS_CFG1_VHF; 136 reg |= ONENAND_SYS_CFG1_VHF;
129 else 137 else
130 reg &= ~ONENAND_SYS_CFG1_VHF; 138 reg &= ~ONENAND_SYS_CFG1_VHF;
@@ -132,21 +140,10 @@ static void set_onenand_cfg(void __iomem *onenand_base, int latency,
132} 140}
133 141
134static int omap2_onenand_get_freq(struct omap_onenand_platform_data *cfg, 142static int omap2_onenand_get_freq(struct omap_onenand_platform_data *cfg,
135 void __iomem *onenand_base, bool *clk_dep) 143 void __iomem *onenand_base)
136{ 144{
137 u16 ver = readw(onenand_base + ONENAND_REG_VERSION_ID); 145 u16 ver = readw(onenand_base + ONENAND_REG_VERSION_ID);
138 int freq = 0; 146 int freq;
139
140 if (cfg->get_freq) {
141 struct onenand_freq_info fi;
142
143 fi.maf_id = readw(onenand_base + ONENAND_REG_MANUFACTURER_ID);
144 fi.dev_id = readw(onenand_base + ONENAND_REG_DEVICE_ID);
145 fi.ver_id = ver;
146 freq = cfg->get_freq(&fi, clk_dep);
147 if (freq)
148 return freq;
149 }
150 147
151 switch ((ver >> 4) & 0xf) { 148 switch ((ver >> 4) & 0xf) {
152 case 0: 149 case 0:
@@ -172,9 +169,9 @@ static int omap2_onenand_get_freq(struct omap_onenand_platform_data *cfg,
172 return freq; 169 return freq;
173} 170}
174 171
175static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg, 172static struct gpmc_timings
176 void __iomem *onenand_base, 173omap2_onenand_calc_sync_timings(struct omap_onenand_platform_data *cfg,
177 int *freq_ptr) 174 int freq)
178{ 175{
179 struct gpmc_timings t; 176 struct gpmc_timings t;
180 const int t_cer = 15; 177 const int t_cer = 15;
@@ -184,29 +181,15 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg,
184 const int t_wpl = 40; 181 const int t_wpl = 40;
185 const int t_wph = 30; 182 const int t_wph = 30;
186 int min_gpmc_clk_period, t_ces, t_avds, t_avdh, t_ach, t_aavdh, t_rdyo; 183 int min_gpmc_clk_period, t_ces, t_avds, t_avdh, t_ach, t_aavdh, t_rdyo;
187 int div, fclk_offset_ns, fclk_offset, gpmc_clk_ns, latency;
188 int first_time = 0, hf = 0, vhf = 0, sync_read = 0, sync_write = 0;
189 int err, ticks_cez;
190 int cs = cfg->cs, freq = *freq_ptr;
191 u32 reg; 184 u32 reg;
192 bool clk_dep = false; 185 int div, fclk_offset_ns, gpmc_clk_ns;
186 int ticks_cez;
187 int cs = cfg->cs;
193 188
194 if (cfg->flags & ONENAND_SYNC_READ) { 189 if (cfg->flags & ONENAND_SYNC_READ)
195 sync_read = 1; 190 onenand_flags = ONENAND_FLAG_SYNCREAD;
196 } else if (cfg->flags & ONENAND_SYNC_READWRITE) { 191 else if (cfg->flags & ONENAND_SYNC_READWRITE)
197 sync_read = 1; 192 onenand_flags = ONENAND_FLAG_SYNCREAD | ONENAND_FLAG_SYNCWRITE;
198 sync_write = 1;
199 } else
200 return omap2_onenand_set_async_mode(cs, onenand_base);
201
202 if (!freq) {
203 /* Very first call freq is not known */
204 err = omap2_onenand_set_async_mode(cs, onenand_base);
205 if (err)
206 return err;
207 freq = omap2_onenand_get_freq(cfg, onenand_base, &clk_dep);
208 first_time = 1;
209 }
210 193
211 switch (freq) { 194 switch (freq) {
212 case 104: 195 case 104:
@@ -244,44 +227,31 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg,
244 t_ach = 9; 227 t_ach = 9;
245 t_aavdh = 7; 228 t_aavdh = 7;
246 t_rdyo = 15; 229 t_rdyo = 15;
247 sync_write = 0; 230 onenand_flags &= ~ONENAND_FLAG_SYNCWRITE;
248 break; 231 break;
249 } 232 }
250 233
251 div = gpmc_cs_calc_divider(cs, min_gpmc_clk_period); 234 div = gpmc_calc_divider(min_gpmc_clk_period);
252 gpmc_clk_ns = gpmc_ticks_to_ns(div); 235 gpmc_clk_ns = gpmc_ticks_to_ns(div);
253 if (gpmc_clk_ns < 15) /* >66Mhz */ 236 if (gpmc_clk_ns < 15) /* >66Mhz */
254 hf = 1; 237 onenand_flags |= ONENAND_FLAG_HF;
238 else
239 onenand_flags &= ~ONENAND_FLAG_HF;
255 if (gpmc_clk_ns < 12) /* >83Mhz */ 240 if (gpmc_clk_ns < 12) /* >83Mhz */
256 vhf = 1; 241 onenand_flags |= ONENAND_FLAG_VHF;
257 if (vhf) 242 else
243 onenand_flags &= ~ONENAND_FLAG_VHF;
244 if (onenand_flags & ONENAND_FLAG_VHF)
258 latency = 8; 245 latency = 8;
259 else if (hf) 246 else if (onenand_flags & ONENAND_FLAG_HF)
260 latency = 6; 247 latency = 6;
261 else if (gpmc_clk_ns >= 25) /* 40 MHz*/ 248 else if (gpmc_clk_ns >= 25) /* 40 MHz*/
262 latency = 3; 249 latency = 3;
263 else 250 else
264 latency = 4; 251 latency = 4;
265 252
266 if (clk_dep) { 253 /* Set synchronous read timings */
267 if (gpmc_clk_ns < 12) { /* >83Mhz */ 254 memset(&t, 0, sizeof(t));
268 t_ces = 3;
269 t_avds = 4;
270 } else if (gpmc_clk_ns < 15) { /* >66Mhz */
271 t_ces = 5;
272 t_avds = 4;
273 } else if (gpmc_clk_ns < 25) { /* >40Mhz */
274 t_ces = 6;
275 t_avds = 5;
276 } else {
277 t_ces = 7;
278 t_avds = 7;
279 }
280 }
281
282 if (first_time)
283 set_onenand_cfg(onenand_base, latency,
284 sync_read, sync_write, hf, vhf);
285 255
286 if (div == 1) { 256 if (div == 1) {
287 reg = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG2); 257 reg = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG2);
@@ -307,8 +277,6 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg,
307 gpmc_cs_write_reg(cs, GPMC_CS_CONFIG4, reg); 277 gpmc_cs_write_reg(cs, GPMC_CS_CONFIG4, reg);
308 } 278 }
309 279
310 /* Set synchronous read timings */
311 memset(&t, 0, sizeof(t));
312 t.sync_clk = min_gpmc_clk_period; 280 t.sync_clk = min_gpmc_clk_period;
313 t.cs_on = 0; 281 t.cs_on = 0;
314 t.adv_on = 0; 282 t.adv_on = 0;
@@ -330,7 +298,7 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg,
330 ticks_cez); 298 ticks_cez);
331 299
332 /* Write */ 300 /* Write */
333 if (sync_write) { 301 if (onenand_flags & ONENAND_FLAG_SYNCWRITE) {
334 t.adv_wr_off = t.adv_rd_off; 302 t.adv_wr_off = t.adv_rd_off;
335 t.we_on = 0; 303 t.we_on = 0;
336 t.we_off = t.cs_rd_off; 304 t.we_off = t.cs_rd_off;
@@ -355,6 +323,14 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg,
355 } 323 }
356 } 324 }
357 325
326 return t;
327}
328
329static int gpmc_set_sync_mode(int cs, struct gpmc_timings *t)
330{
331 unsigned sync_read = onenand_flags & ONENAND_FLAG_SYNCREAD;
332 unsigned sync_write = onenand_flags & ONENAND_FLAG_SYNCWRITE;
333
358 /* Configure GPMC for synchronous read */ 334 /* Configure GPMC for synchronous read */
359 gpmc_cs_write_reg(cs, GPMC_CS_CONFIG1, 335 gpmc_cs_write_reg(cs, GPMC_CS_CONFIG1,
360 GPMC_CONFIG1_WRAPBURST_SUPP | 336 GPMC_CONFIG1_WRAPBURST_SUPP |
@@ -371,11 +347,45 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg,
371 GPMC_CONFIG1_DEVICETYPE_NOR | 347 GPMC_CONFIG1_DEVICETYPE_NOR |
372 GPMC_CONFIG1_MUXADDDATA); 348 GPMC_CONFIG1_MUXADDDATA);
373 349
374 err = gpmc_cs_set_timings(cs, &t); 350 return gpmc_cs_set_timings(cs, t);
375 if (err) 351}
376 return err; 352
353static int omap2_onenand_setup_async(void __iomem *onenand_base)
354{
355 struct gpmc_timings t;
356 int ret;
357
358 omap2_onenand_set_async_mode(onenand_base);
377 359
378 set_onenand_cfg(onenand_base, latency, sync_read, sync_write, hf, vhf); 360 t = omap2_onenand_calc_async_timings();
361
362 ret = gpmc_set_async_mode(gpmc_onenand_data->cs, &t);
363 if (IS_ERR_VALUE(ret))
364 return ret;
365
366 omap2_onenand_set_async_mode(onenand_base);
367
368 return 0;
369}
370
371static int omap2_onenand_setup_sync(void __iomem *onenand_base, int *freq_ptr)
372{
373 int ret, freq = *freq_ptr;
374 struct gpmc_timings t;
375
376 if (!freq) {
377 /* Very first call freq is not known */
378 freq = omap2_onenand_get_freq(gpmc_onenand_data, onenand_base);
379 set_onenand_cfg(onenand_base);
380 }
381
382 t = omap2_onenand_calc_sync_timings(gpmc_onenand_data, freq);
383
384 ret = gpmc_set_sync_mode(gpmc_onenand_data->cs, &t);
385 if (IS_ERR_VALUE(ret))
386 return ret;
387
388 set_onenand_cfg(onenand_base);
379 389
380 *freq_ptr = freq; 390 *freq_ptr = freq;
381 391
@@ -385,15 +395,22 @@ static int omap2_onenand_set_sync_mode(struct omap_onenand_platform_data *cfg,
385static int gpmc_onenand_setup(void __iomem *onenand_base, int *freq_ptr) 395static int gpmc_onenand_setup(void __iomem *onenand_base, int *freq_ptr)
386{ 396{
387 struct device *dev = &gpmc_onenand_device.dev; 397 struct device *dev = &gpmc_onenand_device.dev;
398 unsigned l = ONENAND_SYNC_READ | ONENAND_SYNC_READWRITE;
399 int ret;
388 400
389 /* Set sync timings in GPMC */ 401 ret = omap2_onenand_setup_async(onenand_base);
390 if (omap2_onenand_set_sync_mode(gpmc_onenand_data, onenand_base, 402 if (ret) {
391 freq_ptr) < 0) { 403 dev_err(dev, "unable to set to async mode\n");
392 dev_err(dev, "Unable to set synchronous mode\n"); 404 return ret;
393 return -EINVAL;
394 } 405 }
395 406
396 return 0; 407 if (!(gpmc_onenand_data->flags & l))
408 return 0;
409
410 ret = omap2_onenand_setup_sync(onenand_base, freq_ptr);
411 if (ret)
412 dev_err(dev, "unable to set to sync mode\n");
413 return ret;
397} 414}
398 415
399void __init gpmc_onenand_init(struct omap_onenand_platform_data *_onenand_data) 416void __init gpmc_onenand_init(struct omap_onenand_platform_data *_onenand_data)
@@ -411,6 +428,11 @@ void __init gpmc_onenand_init(struct omap_onenand_platform_data *_onenand_data)
411 gpmc_onenand_data->flags |= ONENAND_SYNC_READ; 428 gpmc_onenand_data->flags |= ONENAND_SYNC_READ;
412 } 429 }
413 430
431 if (cpu_is_omap34xx())
432 gpmc_onenand_data->flags |= ONENAND_IN_OMAP34XX;
433 else
434 gpmc_onenand_data->flags &= ~ONENAND_IN_OMAP34XX;
435
414 err = gpmc_cs_request(gpmc_onenand_data->cs, ONENAND_IO_SIZE, 436 err = gpmc_cs_request(gpmc_onenand_data->cs, ONENAND_IO_SIZE,
415 (unsigned long *)&gpmc_onenand_resource.start); 437 (unsigned long *)&gpmc_onenand_resource.start);
416 if (err < 0) { 438 if (err < 0) {
diff --git a/arch/arm/mach-omap2/gpmc-onenand.h b/arch/arm/mach-omap2/gpmc-onenand.h
new file mode 100644
index 000000000000..216f23a8b45c
--- /dev/null
+++ b/arch/arm/mach-omap2/gpmc-onenand.h
@@ -0,0 +1,24 @@
1/*
2 * arch/arm/mach-omap2/gpmc-onenand.h
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 */
9
10#ifndef __OMAP2_GPMC_ONENAND_H
11#define __OMAP2_GPMC_ONENAND_H
12
13#include <linux/platform_data/mtd-onenand-omap2.h>
14
15#if IS_ENABLED(CONFIG_MTD_ONENAND_OMAP2)
16extern void gpmc_onenand_init(struct omap_onenand_platform_data *d);
17#else
18#define board_onenand_data NULL
19static inline void gpmc_onenand_init(struct omap_onenand_platform_data *d)
20{
21}
22#endif
23
24#endif
diff --git a/arch/arm/mach-omap2/gpmc-smc91x.c b/arch/arm/mach-omap2/gpmc-smc91x.c
index 565475310374..6eed907d594c 100644
--- a/arch/arm/mach-omap2/gpmc-smc91x.c
+++ b/arch/arm/mach-omap2/gpmc-smc91x.c
@@ -17,7 +17,7 @@
17#include <linux/io.h> 17#include <linux/io.h>
18#include <linux/smc91x.h> 18#include <linux/smc91x.h>
19 19
20#include <plat/gpmc.h> 20#include "gpmc.h"
21#include "gpmc-smc91x.h" 21#include "gpmc-smc91x.h"
22 22
23#include "soc.h" 23#include "soc.h"
diff --git a/arch/arm/mach-omap2/gpmc-smsc911x.c b/arch/arm/mach-omap2/gpmc-smsc911x.c
index 249a0b440cd6..ef990118d32b 100644
--- a/arch/arm/mach-omap2/gpmc-smsc911x.c
+++ b/arch/arm/mach-omap2/gpmc-smsc911x.c
@@ -20,7 +20,7 @@
20#include <linux/io.h> 20#include <linux/io.h>
21#include <linux/smsc911x.h> 21#include <linux/smsc911x.h>
22 22
23#include <plat/gpmc.h> 23#include "gpmc.h"
24#include "gpmc-smsc911x.h" 24#include "gpmc-smsc911x.h"
25 25
26static struct resource gpmc_smsc911x_resources[] = { 26static struct resource gpmc_smsc911x_resources[] = {
diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
index 5ac5cf30406a..6af1a5d98e6f 100644
--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
@@ -26,16 +26,14 @@
26#include <linux/interrupt.h> 26#include <linux/interrupt.h>
27#include <linux/platform_device.h> 27#include <linux/platform_device.h>
28 28
29#include <asm/mach-types.h> 29#include <linux/platform_data/mtd-nand-omap2.h>
30#include <plat/gpmc.h>
31 30
32#include <plat/cpu.h> 31#include <asm/mach-types.h>
33#include <plat/gpmc.h>
34#include <plat/sdrc.h>
35#include <plat/omap_device.h>
36 32
37#include "soc.h" 33#include "soc.h"
38#include "common.h" 34#include "common.h"
35#include "omap_device.h"
36#include "gpmc.h"
39 37
40#define DEVICE_NAME "omap-gpmc" 38#define DEVICE_NAME "omap-gpmc"
41 39
@@ -59,6 +57,9 @@
59#define GPMC_ECC_SIZE_CONFIG 0x1fc 57#define GPMC_ECC_SIZE_CONFIG 0x1fc
60#define GPMC_ECC1_RESULT 0x200 58#define GPMC_ECC1_RESULT 0x200
61#define GPMC_ECC_BCH_RESULT_0 0x240 /* not available on OMAP2 */ 59#define GPMC_ECC_BCH_RESULT_0 0x240 /* not available on OMAP2 */
60#define GPMC_ECC_BCH_RESULT_1 0x244 /* not available on OMAP2 */
61#define GPMC_ECC_BCH_RESULT_2 0x248 /* not available on OMAP2 */
62#define GPMC_ECC_BCH_RESULT_3 0x24c /* not available on OMAP2 */
62 63
63/* GPMC ECC control settings */ 64/* GPMC ECC control settings */
64#define GPMC_ECC_CTRL_ECCCLEAR 0x100 65#define GPMC_ECC_CTRL_ECCCLEAR 0x100
@@ -75,6 +76,7 @@
75 76
76#define GPMC_CS0_OFFSET 0x60 77#define GPMC_CS0_OFFSET 0x60
77#define GPMC_CS_SIZE 0x30 78#define GPMC_CS_SIZE 0x30
79#define GPMC_BCH_SIZE 0x10
78 80
79#define GPMC_MEM_START 0x00000000 81#define GPMC_MEM_START 0x00000000
80#define GPMC_MEM_END 0x3FFFFFFF 82#define GPMC_MEM_END 0x3FFFFFFF
@@ -137,7 +139,6 @@ static struct resource gpmc_mem_root;
137static struct resource gpmc_cs_mem[GPMC_CS_NUM]; 139static struct resource gpmc_cs_mem[GPMC_CS_NUM];
138static DEFINE_SPINLOCK(gpmc_mem_lock); 140static DEFINE_SPINLOCK(gpmc_mem_lock);
139static unsigned int gpmc_cs_map; /* flag for cs which are initialized */ 141static unsigned int gpmc_cs_map; /* flag for cs which are initialized */
140static int gpmc_ecc_used = -EINVAL; /* cs using ecc engine */
141static struct device *gpmc_dev; 142static struct device *gpmc_dev;
142static int gpmc_irq; 143static int gpmc_irq;
143static resource_size_t phys_base, mem_size; 144static resource_size_t phys_base, mem_size;
@@ -158,22 +159,6 @@ static u32 gpmc_read_reg(int idx)
158 return __raw_readl(gpmc_base + idx); 159 return __raw_readl(gpmc_base + idx);
159} 160}
160 161
161static void gpmc_cs_write_byte(int cs, int idx, u8 val)
162{
163 void __iomem *reg_addr;
164
165 reg_addr = gpmc_base + GPMC_CS0_OFFSET + (cs * GPMC_CS_SIZE) + idx;
166 __raw_writeb(val, reg_addr);
167}
168
169static u8 gpmc_cs_read_byte(int cs, int idx)
170{
171 void __iomem *reg_addr;
172
173 reg_addr = gpmc_base + GPMC_CS0_OFFSET + (cs * GPMC_CS_SIZE) + idx;
174 return __raw_readb(reg_addr);
175}
176
177void gpmc_cs_write_reg(int cs, int idx, u32 val) 162void gpmc_cs_write_reg(int cs, int idx, u32 val)
178{ 163{
179 void __iomem *reg_addr; 164 void __iomem *reg_addr;
@@ -288,7 +273,7 @@ static int set_gpmc_timing_reg(int cs, int reg, int st_bit, int end_bit,
288 return -1 273 return -1
289#endif 274#endif
290 275
291int gpmc_cs_calc_divider(int cs, unsigned int sync_clk) 276int gpmc_calc_divider(unsigned int sync_clk)
292{ 277{
293 int div; 278 int div;
294 u32 l; 279 u32 l;
@@ -308,7 +293,7 @@ int gpmc_cs_set_timings(int cs, const struct gpmc_timings *t)
308 int div; 293 int div;
309 u32 l; 294 u32 l;
310 295
311 div = gpmc_cs_calc_divider(cs, t->sync_clk); 296 div = gpmc_calc_divider(t->sync_clk);
312 if (div < 0) 297 if (div < 0)
313 return div; 298 return div;
314 299
@@ -509,44 +494,6 @@ void gpmc_cs_free(int cs)
509EXPORT_SYMBOL(gpmc_cs_free); 494EXPORT_SYMBOL(gpmc_cs_free);
510 495
511/** 496/**
512 * gpmc_read_status - read access request to get the different gpmc status
513 * @cmd: command type
514 * @return status
515 */
516int gpmc_read_status(int cmd)
517{
518 int status = -EINVAL;
519 u32 regval = 0;
520
521 switch (cmd) {
522 case GPMC_GET_IRQ_STATUS:
523 status = gpmc_read_reg(GPMC_IRQSTATUS);
524 break;
525
526 case GPMC_PREFETCH_FIFO_CNT:
527 regval = gpmc_read_reg(GPMC_PREFETCH_STATUS);
528 status = GPMC_PREFETCH_STATUS_FIFO_CNT(regval);
529 break;
530
531 case GPMC_PREFETCH_COUNT:
532 regval = gpmc_read_reg(GPMC_PREFETCH_STATUS);
533 status = GPMC_PREFETCH_STATUS_COUNT(regval);
534 break;
535
536 case GPMC_STATUS_BUFFER:
537 regval = gpmc_read_reg(GPMC_STATUS);
538 /* 1 : buffer is available to write */
539 status = regval & GPMC_STATUS_BUFF_EMPTY;
540 break;
541
542 default:
543 printk(KERN_ERR "gpmc_read_status: Not supported\n");
544 }
545 return status;
546}
547EXPORT_SYMBOL(gpmc_read_status);
548
549/**
550 * gpmc_cs_configure - write request to configure gpmc 497 * gpmc_cs_configure - write request to configure gpmc
551 * @cs: chip select number 498 * @cs: chip select number
552 * @cmd: command type 499 * @cmd: command type
@@ -614,121 +561,10 @@ int gpmc_cs_configure(int cs, int cmd, int wval)
614} 561}
615EXPORT_SYMBOL(gpmc_cs_configure); 562EXPORT_SYMBOL(gpmc_cs_configure);
616 563
617/**
618 * gpmc_nand_read - nand specific read access request
619 * @cs: chip select number
620 * @cmd: command type
621 */
622int gpmc_nand_read(int cs, int cmd)
623{
624 int rval = -EINVAL;
625
626 switch (cmd) {
627 case GPMC_NAND_DATA:
628 rval = gpmc_cs_read_byte(cs, GPMC_CS_NAND_DATA);
629 break;
630
631 default:
632 printk(KERN_ERR "gpmc_read_nand_ctrl: Not supported\n");
633 }
634 return rval;
635}
636EXPORT_SYMBOL(gpmc_nand_read);
637
638/**
639 * gpmc_nand_write - nand specific write request
640 * @cs: chip select number
641 * @cmd: command type
642 * @wval: value to write
643 */
644int gpmc_nand_write(int cs, int cmd, int wval)
645{
646 int err = 0;
647
648 switch (cmd) {
649 case GPMC_NAND_COMMAND:
650 gpmc_cs_write_byte(cs, GPMC_CS_NAND_COMMAND, wval);
651 break;
652
653 case GPMC_NAND_ADDRESS:
654 gpmc_cs_write_byte(cs, GPMC_CS_NAND_ADDRESS, wval);
655 break;
656
657 case GPMC_NAND_DATA:
658 gpmc_cs_write_byte(cs, GPMC_CS_NAND_DATA, wval);
659
660 default:
661 printk(KERN_ERR "gpmc_write_nand_ctrl: Not supported\n");
662 err = -EINVAL;
663 }
664 return err;
665}
666EXPORT_SYMBOL(gpmc_nand_write);
667
668
669
670/**
671 * gpmc_prefetch_enable - configures and starts prefetch transfer
672 * @cs: cs (chip select) number
673 * @fifo_th: fifo threshold to be used for read/ write
674 * @dma_mode: dma mode enable (1) or disable (0)
675 * @u32_count: number of bytes to be transferred
676 * @is_write: prefetch read(0) or write post(1) mode
677 */
678int gpmc_prefetch_enable(int cs, int fifo_th, int dma_mode,
679 unsigned int u32_count, int is_write)
680{
681
682 if (fifo_th > PREFETCH_FIFOTHRESHOLD_MAX) {
683 pr_err("gpmc: fifo threshold is not supported\n");
684 return -1;
685 } else if (!(gpmc_read_reg(GPMC_PREFETCH_CONTROL))) {
686 /* Set the amount of bytes to be prefetched */
687 gpmc_write_reg(GPMC_PREFETCH_CONFIG2, u32_count);
688
689 /* Set dma/mpu mode, the prefetch read / post write and
690 * enable the engine. Set which cs is has requested for.
691 */
692 gpmc_write_reg(GPMC_PREFETCH_CONFIG1, ((cs << CS_NUM_SHIFT) |
693 PREFETCH_FIFOTHRESHOLD(fifo_th) |
694 ENABLE_PREFETCH |
695 (dma_mode << DMA_MPU_MODE) |
696 (0x1 & is_write)));
697
698 /* Start the prefetch engine */
699 gpmc_write_reg(GPMC_PREFETCH_CONTROL, 0x1);
700 } else {
701 return -EBUSY;
702 }
703
704 return 0;
705}
706EXPORT_SYMBOL(gpmc_prefetch_enable);
707
708/**
709 * gpmc_prefetch_reset - disables and stops the prefetch engine
710 */
711int gpmc_prefetch_reset(int cs)
712{
713 u32 config1;
714
715 /* check if the same module/cs is trying to reset */
716 config1 = gpmc_read_reg(GPMC_PREFETCH_CONFIG1);
717 if (((config1 >> CS_NUM_SHIFT) & 0x7) != cs)
718 return -EINVAL;
719
720 /* Stop the PFPW engine */
721 gpmc_write_reg(GPMC_PREFETCH_CONTROL, 0x0);
722
723 /* Reset/disable the PFPW engine */
724 gpmc_write_reg(GPMC_PREFETCH_CONFIG1, 0x0);
725
726 return 0;
727}
728EXPORT_SYMBOL(gpmc_prefetch_reset);
729
730void gpmc_update_nand_reg(struct gpmc_nand_regs *reg, int cs) 564void gpmc_update_nand_reg(struct gpmc_nand_regs *reg, int cs)
731{ 565{
566 int i;
567
732 reg->gpmc_status = gpmc_base + GPMC_STATUS; 568 reg->gpmc_status = gpmc_base + GPMC_STATUS;
733 reg->gpmc_nand_command = gpmc_base + GPMC_CS0_OFFSET + 569 reg->gpmc_nand_command = gpmc_base + GPMC_CS0_OFFSET +
734 GPMC_CS_NAND_COMMAND + GPMC_CS_SIZE * cs; 570 GPMC_CS_NAND_COMMAND + GPMC_CS_SIZE * cs;
@@ -744,7 +580,17 @@ void gpmc_update_nand_reg(struct gpmc_nand_regs *reg, int cs)
744 reg->gpmc_ecc_control = gpmc_base + GPMC_ECC_CONTROL; 580 reg->gpmc_ecc_control = gpmc_base + GPMC_ECC_CONTROL;
745 reg->gpmc_ecc_size_config = gpmc_base + GPMC_ECC_SIZE_CONFIG; 581 reg->gpmc_ecc_size_config = gpmc_base + GPMC_ECC_SIZE_CONFIG;
746 reg->gpmc_ecc1_result = gpmc_base + GPMC_ECC1_RESULT; 582 reg->gpmc_ecc1_result = gpmc_base + GPMC_ECC1_RESULT;
747 reg->gpmc_bch_result0 = gpmc_base + GPMC_ECC_BCH_RESULT_0; 583
584 for (i = 0; i < GPMC_BCH_NUM_REMAINDER; i++) {
585 reg->gpmc_bch_result0[i] = gpmc_base + GPMC_ECC_BCH_RESULT_0 +
586 GPMC_BCH_SIZE * i;
587 reg->gpmc_bch_result1[i] = gpmc_base + GPMC_ECC_BCH_RESULT_1 +
588 GPMC_BCH_SIZE * i;
589 reg->gpmc_bch_result2[i] = gpmc_base + GPMC_ECC_BCH_RESULT_2 +
590 GPMC_BCH_SIZE * i;
591 reg->gpmc_bch_result3[i] = gpmc_base + GPMC_ECC_BCH_RESULT_3 +
592 GPMC_BCH_SIZE * i;
593 }
748} 594}
749 595
750int gpmc_get_client_irq(unsigned irq_config) 596int gpmc_get_client_irq(unsigned irq_config)
@@ -1079,267 +925,3 @@ void omap3_gpmc_restore_context(void)
1079 } 925 }
1080} 926}
1081#endif /* CONFIG_ARCH_OMAP3 */ 927#endif /* CONFIG_ARCH_OMAP3 */
1082
1083/**
1084 * gpmc_enable_hwecc - enable hardware ecc functionality
1085 * @cs: chip select number
1086 * @mode: read/write mode
1087 * @dev_width: device bus width(1 for x16, 0 for x8)
1088 * @ecc_size: bytes for which ECC will be generated
1089 */
1090int gpmc_enable_hwecc(int cs, int mode, int dev_width, int ecc_size)
1091{
1092 unsigned int val;
1093
1094 /* check if ecc module is in used */
1095 if (gpmc_ecc_used != -EINVAL)
1096 return -EINVAL;
1097
1098 gpmc_ecc_used = cs;
1099
1100 /* clear ecc and enable bits */
1101 gpmc_write_reg(GPMC_ECC_CONTROL,
1102 GPMC_ECC_CTRL_ECCCLEAR |
1103 GPMC_ECC_CTRL_ECCREG1);
1104
1105 /* program ecc and result sizes */
1106 val = ((((ecc_size >> 1) - 1) << 22) | (0x0000000F));
1107 gpmc_write_reg(GPMC_ECC_SIZE_CONFIG, val);
1108
1109 switch (mode) {
1110 case GPMC_ECC_READ:
1111 case GPMC_ECC_WRITE:
1112 gpmc_write_reg(GPMC_ECC_CONTROL,
1113 GPMC_ECC_CTRL_ECCCLEAR |
1114 GPMC_ECC_CTRL_ECCREG1);
1115 break;
1116 case GPMC_ECC_READSYN:
1117 gpmc_write_reg(GPMC_ECC_CONTROL,
1118 GPMC_ECC_CTRL_ECCCLEAR |
1119 GPMC_ECC_CTRL_ECCDISABLE);
1120 break;
1121 default:
1122 printk(KERN_INFO "Error: Unrecognized Mode[%d]!\n", mode);
1123 break;
1124 }
1125
1126 /* (ECC 16 or 8 bit col) | ( CS ) | ECC Enable */
1127 val = (dev_width << 7) | (cs << 1) | (0x1);
1128 gpmc_write_reg(GPMC_ECC_CONFIG, val);
1129 return 0;
1130}
1131EXPORT_SYMBOL_GPL(gpmc_enable_hwecc);
1132
1133/**
1134 * gpmc_calculate_ecc - generate non-inverted ecc bytes
1135 * @cs: chip select number
1136 * @dat: data pointer over which ecc is computed
1137 * @ecc_code: ecc code buffer
1138 *
1139 * Using non-inverted ECC is considered ugly since writing a blank
1140 * page (padding) will clear the ECC bytes. This is not a problem as long
1141 * no one is trying to write data on the seemingly unused page. Reading
1142 * an erased page will produce an ECC mismatch between generated and read
1143 * ECC bytes that has to be dealt with separately.
1144 */
1145int gpmc_calculate_ecc(int cs, const u_char *dat, u_char *ecc_code)
1146{
1147 unsigned int val = 0x0;
1148
1149 if (gpmc_ecc_used != cs)
1150 return -EINVAL;
1151
1152 /* read ecc result */
1153 val = gpmc_read_reg(GPMC_ECC1_RESULT);
1154 *ecc_code++ = val; /* P128e, ..., P1e */
1155 *ecc_code++ = val >> 16; /* P128o, ..., P1o */
1156 /* P2048o, P1024o, P512o, P256o, P2048e, P1024e, P512e, P256e */
1157 *ecc_code++ = ((val >> 8) & 0x0f) | ((val >> 20) & 0xf0);
1158
1159 gpmc_ecc_used = -EINVAL;
1160 return 0;
1161}
1162EXPORT_SYMBOL_GPL(gpmc_calculate_ecc);
1163
1164#ifdef CONFIG_ARCH_OMAP3
1165
1166/**
1167 * gpmc_init_hwecc_bch - initialize hardware BCH ecc functionality
1168 * @cs: chip select number
1169 * @nsectors: how many 512-byte sectors to process
1170 * @nerrors: how many errors to correct per sector (4 or 8)
1171 *
1172 * This function must be executed before any call to gpmc_enable_hwecc_bch.
1173 */
1174int gpmc_init_hwecc_bch(int cs, int nsectors, int nerrors)
1175{
1176 /* check if ecc module is in use */
1177 if (gpmc_ecc_used != -EINVAL)
1178 return -EINVAL;
1179
1180 /* support only OMAP3 class */
1181 if (!cpu_is_omap34xx()) {
1182 printk(KERN_ERR "BCH ecc is not supported on this CPU\n");
1183 return -EINVAL;
1184 }
1185
1186 /*
1187 * For now, assume 4-bit mode is only supported on OMAP3630 ES1.x, x>=1.
1188 * Other chips may be added if confirmed to work.
1189 */
1190 if ((nerrors == 4) &&
1191 (!cpu_is_omap3630() || (GET_OMAP_REVISION() == 0))) {
1192 printk(KERN_ERR "BCH 4-bit mode is not supported on this CPU\n");
1193 return -EINVAL;
1194 }
1195
1196 /* sanity check */
1197 if (nsectors > 8) {
1198 printk(KERN_ERR "BCH cannot process %d sectors (max is 8)\n",
1199 nsectors);
1200 return -EINVAL;
1201 }
1202
1203 return 0;
1204}
1205EXPORT_SYMBOL_GPL(gpmc_init_hwecc_bch);
1206
1207/**
1208 * gpmc_enable_hwecc_bch - enable hardware BCH ecc functionality
1209 * @cs: chip select number
1210 * @mode: read/write mode
1211 * @dev_width: device bus width(1 for x16, 0 for x8)
1212 * @nsectors: how many 512-byte sectors to process
1213 * @nerrors: how many errors to correct per sector (4 or 8)
1214 */
1215int gpmc_enable_hwecc_bch(int cs, int mode, int dev_width, int nsectors,
1216 int nerrors)
1217{
1218 unsigned int val;
1219
1220 /* check if ecc module is in use */
1221 if (gpmc_ecc_used != -EINVAL)
1222 return -EINVAL;
1223
1224 gpmc_ecc_used = cs;
1225
1226 /* clear ecc and enable bits */
1227 gpmc_write_reg(GPMC_ECC_CONTROL, 0x1);
1228
1229 /*
1230 * When using BCH, sector size is hardcoded to 512 bytes.
1231 * Here we are using wrapping mode 6 both for reading and writing, with:
1232 * size0 = 0 (no additional protected byte in spare area)
1233 * size1 = 32 (skip 32 nibbles = 16 bytes per sector in spare area)
1234 */
1235 gpmc_write_reg(GPMC_ECC_SIZE_CONFIG, (32 << 22) | (0 << 12));
1236
1237 /* BCH configuration */
1238 val = ((1 << 16) | /* enable BCH */
1239 (((nerrors == 8) ? 1 : 0) << 12) | /* 8 or 4 bits */
1240 (0x06 << 8) | /* wrap mode = 6 */
1241 (dev_width << 7) | /* bus width */
1242 (((nsectors-1) & 0x7) << 4) | /* number of sectors */
1243 (cs << 1) | /* ECC CS */
1244 (0x1)); /* enable ECC */
1245
1246 gpmc_write_reg(GPMC_ECC_CONFIG, val);
1247 gpmc_write_reg(GPMC_ECC_CONTROL, 0x101);
1248 return 0;
1249}
1250EXPORT_SYMBOL_GPL(gpmc_enable_hwecc_bch);
1251
1252/**
1253 * gpmc_calculate_ecc_bch4 - Generate 7 ecc bytes per sector of 512 data bytes
1254 * @cs: chip select number
1255 * @dat: The pointer to data on which ecc is computed
1256 * @ecc: The ecc output buffer
1257 */
1258int gpmc_calculate_ecc_bch4(int cs, const u_char *dat, u_char *ecc)
1259{
1260 int i;
1261 unsigned long nsectors, reg, val1, val2;
1262
1263 if (gpmc_ecc_used != cs)
1264 return -EINVAL;
1265
1266 nsectors = ((gpmc_read_reg(GPMC_ECC_CONFIG) >> 4) & 0x7) + 1;
1267
1268 for (i = 0; i < nsectors; i++) {
1269
1270 reg = GPMC_ECC_BCH_RESULT_0 + 16*i;
1271
1272 /* Read hw-computed remainder */
1273 val1 = gpmc_read_reg(reg + 0);
1274 val2 = gpmc_read_reg(reg + 4);
1275
1276 /*
1277 * Add constant polynomial to remainder, in order to get an ecc
1278 * sequence of 0xFFs for a buffer filled with 0xFFs; and
1279 * left-justify the resulting polynomial.
1280 */
1281 *ecc++ = 0x28 ^ ((val2 >> 12) & 0xFF);
1282 *ecc++ = 0x13 ^ ((val2 >> 4) & 0xFF);
1283 *ecc++ = 0xcc ^ (((val2 & 0xF) << 4)|((val1 >> 28) & 0xF));
1284 *ecc++ = 0x39 ^ ((val1 >> 20) & 0xFF);
1285 *ecc++ = 0x96 ^ ((val1 >> 12) & 0xFF);
1286 *ecc++ = 0xac ^ ((val1 >> 4) & 0xFF);
1287 *ecc++ = 0x7f ^ ((val1 & 0xF) << 4);
1288 }
1289
1290 gpmc_ecc_used = -EINVAL;
1291 return 0;
1292}
1293EXPORT_SYMBOL_GPL(gpmc_calculate_ecc_bch4);
1294
1295/**
1296 * gpmc_calculate_ecc_bch8 - Generate 13 ecc bytes per block of 512 data bytes
1297 * @cs: chip select number
1298 * @dat: The pointer to data on which ecc is computed
1299 * @ecc: The ecc output buffer
1300 */
1301int gpmc_calculate_ecc_bch8(int cs, const u_char *dat, u_char *ecc)
1302{
1303 int i;
1304 unsigned long nsectors, reg, val1, val2, val3, val4;
1305
1306 if (gpmc_ecc_used != cs)
1307 return -EINVAL;
1308
1309 nsectors = ((gpmc_read_reg(GPMC_ECC_CONFIG) >> 4) & 0x7) + 1;
1310
1311 for (i = 0; i < nsectors; i++) {
1312
1313 reg = GPMC_ECC_BCH_RESULT_0 + 16*i;
1314
1315 /* Read hw-computed remainder */
1316 val1 = gpmc_read_reg(reg + 0);
1317 val2 = gpmc_read_reg(reg + 4);
1318 val3 = gpmc_read_reg(reg + 8);
1319 val4 = gpmc_read_reg(reg + 12);
1320
1321 /*
1322 * Add constant polynomial to remainder, in order to get an ecc
1323 * sequence of 0xFFs for a buffer filled with 0xFFs.
1324 */
1325 *ecc++ = 0xef ^ (val4 & 0xFF);
1326 *ecc++ = 0x51 ^ ((val3 >> 24) & 0xFF);
1327 *ecc++ = 0x2e ^ ((val3 >> 16) & 0xFF);
1328 *ecc++ = 0x09 ^ ((val3 >> 8) & 0xFF);
1329 *ecc++ = 0xed ^ (val3 & 0xFF);
1330 *ecc++ = 0x93 ^ ((val2 >> 24) & 0xFF);
1331 *ecc++ = 0x9a ^ ((val2 >> 16) & 0xFF);
1332 *ecc++ = 0xc2 ^ ((val2 >> 8) & 0xFF);
1333 *ecc++ = 0x97 ^ (val2 & 0xFF);
1334 *ecc++ = 0x79 ^ ((val1 >> 24) & 0xFF);
1335 *ecc++ = 0xe5 ^ ((val1 >> 16) & 0xFF);
1336 *ecc++ = 0x24 ^ ((val1 >> 8) & 0xFF);
1337 *ecc++ = 0xb5 ^ (val1 & 0xFF);
1338 }
1339
1340 gpmc_ecc_used = -EINVAL;
1341 return 0;
1342}
1343EXPORT_SYMBOL_GPL(gpmc_calculate_ecc_bch8);
1344
1345#endif /* CONFIG_ARCH_OMAP3 */
diff --git a/arch/arm/plat-omap/include/plat/gpmc.h b/arch/arm/mach-omap2/gpmc.h
index 2e6e2597178c..79f4dfc2adb3 100644
--- a/arch/arm/plat-omap/include/plat/gpmc.h
+++ b/arch/arm/mach-omap2/gpmc.h
@@ -11,6 +11,8 @@
11#ifndef __OMAP2_GPMC_H 11#ifndef __OMAP2_GPMC_H
12#define __OMAP2_GPMC_H 12#define __OMAP2_GPMC_H
13 13
14#include <linux/platform_data/mtd-nand-omap2.h>
15
14/* Maximum Number of Chip Selects */ 16/* Maximum Number of Chip Selects */
15#define GPMC_CS_NUM 8 17#define GPMC_CS_NUM 8
16 18
@@ -32,15 +34,6 @@
32#define GPMC_SET_IRQ_STATUS 0x00000004 34#define GPMC_SET_IRQ_STATUS 0x00000004
33#define GPMC_CONFIG_WP 0x00000005 35#define GPMC_CONFIG_WP 0x00000005
34 36
35#define GPMC_GET_IRQ_STATUS 0x00000006
36#define GPMC_PREFETCH_FIFO_CNT 0x00000007 /* bytes available in FIFO for r/w */
37#define GPMC_PREFETCH_COUNT 0x00000008 /* remaining bytes to be read/write*/
38#define GPMC_STATUS_BUFFER 0x00000009 /* 1: buffer is available to write */
39
40#define GPMC_NAND_COMMAND 0x0000000a
41#define GPMC_NAND_ADDRESS 0x0000000b
42#define GPMC_NAND_DATA 0x0000000c
43
44#define GPMC_ENABLE_IRQ 0x0000000d 37#define GPMC_ENABLE_IRQ 0x0000000d
45 38
46/* ECC commands */ 39/* ECC commands */
@@ -76,25 +69,10 @@
76#define GPMC_DEVICETYPE_NOR 0 69#define GPMC_DEVICETYPE_NOR 0
77#define GPMC_DEVICETYPE_NAND 2 70#define GPMC_DEVICETYPE_NAND 2
78#define GPMC_CONFIG_WRITEPROTECT 0x00000010 71#define GPMC_CONFIG_WRITEPROTECT 0x00000010
79#define GPMC_STATUS_BUFF_EMPTY 0x00000001
80#define WR_RD_PIN_MONITORING 0x00600000 72#define WR_RD_PIN_MONITORING 0x00600000
81#define GPMC_PREFETCH_STATUS_FIFO_CNT(val) ((val >> 24) & 0x7F)
82#define GPMC_PREFETCH_STATUS_COUNT(val) (val & 0x00003fff)
83#define GPMC_IRQ_FIFOEVENTENABLE 0x01 73#define GPMC_IRQ_FIFOEVENTENABLE 0x01
84#define GPMC_IRQ_COUNT_EVENT 0x02 74#define GPMC_IRQ_COUNT_EVENT 0x02
85 75
86#define PREFETCH_FIFOTHRESHOLD_MAX 0x40
87#define PREFETCH_FIFOTHRESHOLD(val) ((val) << 8)
88
89enum omap_ecc {
90 /* 1-bit ecc: stored at end of spare area */
91 OMAP_ECC_HAMMING_CODE_DEFAULT = 0, /* Default, s/w method */
92 OMAP_ECC_HAMMING_CODE_HW, /* gpmc to detect the error */
93 /* 1-bit ecc: stored at beginning of spare area as romcode */
94 OMAP_ECC_HAMMING_CODE_HW_ROMCODE, /* gpmc method & romcode layout */
95 OMAP_ECC_BCH4_CODE_HW, /* 4-bit BCH ecc code */
96 OMAP_ECC_BCH8_CODE_HW, /* 8-bit BCH ecc code */
97};
98 76
99/* 77/*
100 * Note that all values in this struct are in nanoseconds except sync_clk 78 * Note that all values in this struct are in nanoseconds except sync_clk
@@ -133,22 +111,6 @@ struct gpmc_timings {
133 u16 wr_data_mux_bus; /* WRDATAONADMUXBUS */ 111 u16 wr_data_mux_bus; /* WRDATAONADMUXBUS */
134}; 112};
135 113
136struct gpmc_nand_regs {
137 void __iomem *gpmc_status;
138 void __iomem *gpmc_nand_command;
139 void __iomem *gpmc_nand_address;
140 void __iomem *gpmc_nand_data;
141 void __iomem *gpmc_prefetch_config1;
142 void __iomem *gpmc_prefetch_config2;
143 void __iomem *gpmc_prefetch_control;
144 void __iomem *gpmc_prefetch_status;
145 void __iomem *gpmc_ecc_config;
146 void __iomem *gpmc_ecc_control;
147 void __iomem *gpmc_ecc_size_config;
148 void __iomem *gpmc_ecc1_result;
149 void __iomem *gpmc_bch_result0;
150};
151
152extern void gpmc_update_nand_reg(struct gpmc_nand_regs *reg, int cs); 114extern void gpmc_update_nand_reg(struct gpmc_nand_regs *reg, int cs);
153extern int gpmc_get_client_irq(unsigned irq_config); 115extern int gpmc_get_client_irq(unsigned irq_config);
154 116
@@ -160,31 +122,14 @@ extern unsigned long gpmc_get_fclk_period(void);
160 122
161extern void gpmc_cs_write_reg(int cs, int idx, u32 val); 123extern void gpmc_cs_write_reg(int cs, int idx, u32 val);
162extern u32 gpmc_cs_read_reg(int cs, int idx); 124extern u32 gpmc_cs_read_reg(int cs, int idx);
163extern int gpmc_cs_calc_divider(int cs, unsigned int sync_clk); 125extern int gpmc_calc_divider(unsigned int sync_clk);
164extern int gpmc_cs_set_timings(int cs, const struct gpmc_timings *t); 126extern int gpmc_cs_set_timings(int cs, const struct gpmc_timings *t);
165extern int gpmc_cs_request(int cs, unsigned long size, unsigned long *base); 127extern int gpmc_cs_request(int cs, unsigned long size, unsigned long *base);
166extern void gpmc_cs_free(int cs); 128extern void gpmc_cs_free(int cs);
167extern int gpmc_cs_set_reserved(int cs, int reserved); 129extern int gpmc_cs_set_reserved(int cs, int reserved);
168extern int gpmc_cs_reserved(int cs); 130extern int gpmc_cs_reserved(int cs);
169extern int gpmc_prefetch_enable(int cs, int fifo_th, int dma_mode,
170 unsigned int u32_count, int is_write);
171extern int gpmc_prefetch_reset(int cs);
172extern void omap3_gpmc_save_context(void); 131extern void omap3_gpmc_save_context(void);
173extern void omap3_gpmc_restore_context(void); 132extern void omap3_gpmc_restore_context(void);
174extern int gpmc_read_status(int cmd);
175extern int gpmc_cs_configure(int cs, int cmd, int wval); 133extern int gpmc_cs_configure(int cs, int cmd, int wval);
176extern int gpmc_nand_read(int cs, int cmd);
177extern int gpmc_nand_write(int cs, int cmd, int wval);
178
179int gpmc_enable_hwecc(int cs, int mode, int dev_width, int ecc_size);
180int gpmc_calculate_ecc(int cs, const u_char *dat, u_char *ecc_code);
181
182#ifdef CONFIG_ARCH_OMAP3
183int gpmc_init_hwecc_bch(int cs, int nsectors, int nerrors);
184int gpmc_enable_hwecc_bch(int cs, int mode, int dev_width, int nsectors,
185 int nerrors);
186int gpmc_calculate_ecc_bch4(int cs, const u_char *dat, u_char *ecc);
187int gpmc_calculate_ecc_bch8(int cs, const u_char *dat, u_char *ecc);
188#endif /* CONFIG_ARCH_OMAP3 */
189 134
190#endif 135#endif
diff --git a/arch/arm/mach-omap2/hdq1w.c b/arch/arm/mach-omap2/hdq1w.c
index e003f2bba30c..3da8900598c8 100644
--- a/arch/arm/mach-omap2/hdq1w.c
+++ b/arch/arm/mach-omap2/hdq1w.c
@@ -27,8 +27,8 @@
27#include <linux/err.h> 27#include <linux/err.h>
28#include <linux/platform_device.h> 28#include <linux/platform_device.h>
29 29
30#include <plat/omap_hwmod.h> 30#include "omap_hwmod.h"
31#include <plat/omap_device.h> 31#include "omap_device.h"
32#include "hdq1w.h" 32#include "hdq1w.h"
33 33
34#include "common.h" 34#include "common.h"
diff --git a/arch/arm/mach-omap2/hdq1w.h b/arch/arm/mach-omap2/hdq1w.h
index 0c1efc846d8d..c7e08d2a7a46 100644
--- a/arch/arm/mach-omap2/hdq1w.h
+++ b/arch/arm/mach-omap2/hdq1w.h
@@ -21,7 +21,7 @@
21#ifndef ARCH_ARM_MACH_OMAP2_HDQ1W_H 21#ifndef ARCH_ARM_MACH_OMAP2_HDQ1W_H
22#define ARCH_ARM_MACH_OMAP2_HDQ1W_H 22#define ARCH_ARM_MACH_OMAP2_HDQ1W_H
23 23
24#include <plat/omap_hwmod.h> 24#include "omap_hwmod.h"
25 25
26/* 26/*
27 * XXX A future cleanup patch should modify 27 * XXX A future cleanup patch should modify
diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c
index 4d3a6324155f..e3406dce59be 100644
--- a/arch/arm/mach-omap2/hsmmc.c
+++ b/arch/arm/mach-omap2/hsmmc.c
@@ -17,11 +17,12 @@
17#include <mach/hardware.h> 17#include <mach/hardware.h>
18#include <linux/platform_data/gpio-omap.h> 18#include <linux/platform_data/gpio-omap.h>
19 19
20#include <plat/mmc.h> 20#include "soc.h"
21#include <plat/omap-pm.h> 21#include "omap_device.h"
22#include <plat/omap_device.h> 22#include "omap-pm.h"
23 23
24#include "mux.h" 24#include "mux.h"
25#include "mmc.h"
25#include "hsmmc.h" 26#include "hsmmc.h"
26#include "control.h" 27#include "control.h"
27 28
diff --git a/arch/arm/mach-omap2/hwspinlock.c b/arch/arm/mach-omap2/hwspinlock.c
index 8763c8520dc2..1df9b5feda16 100644
--- a/arch/arm/mach-omap2/hwspinlock.c
+++ b/arch/arm/mach-omap2/hwspinlock.c
@@ -21,8 +21,8 @@
21#include <linux/err.h> 21#include <linux/err.h>
22#include <linux/hwspinlock.h> 22#include <linux/hwspinlock.h>
23 23
24#include <plat/omap_hwmod.h> 24#include "omap_hwmod.h"
25#include <plat/omap_device.h> 25#include "omap_device.h"
26 26
27static struct hwspinlock_pdata omap_hwspinlock_pdata __initdata = { 27static struct hwspinlock_pdata omap_hwspinlock_pdata __initdata = {
28 .base_id = 0, 28 .base_id = 0,
diff --git a/arch/arm/mach-omap2/i2c.c b/arch/arm/mach-omap2/i2c.c
index fc57e67b321f..ad55b943108f 100644
--- a/arch/arm/mach-omap2/i2c.c
+++ b/arch/arm/mach-omap2/i2c.c
@@ -19,11 +19,13 @@
19 * 19 *
20 */ 20 */
21 21
22#include <plat/i2c.h> 22#include "soc.h"
23#include "common.h" 23#include "common.h"
24#include <plat/omap_hwmod.h> 24#include "omap_hwmod.h"
25#include "omap_device.h"
25 26
26#include "mux.h" 27#include "mux.h"
28#include "i2c.h"
27 29
28/* In register I2C_CON, Bit 15 is the I2C enable bit */ 30/* In register I2C_CON, Bit 15 is the I2C enable bit */
29#define I2C_EN BIT(15) 31#define I2C_EN BIT(15)
@@ -33,7 +35,9 @@
33/* Maximum microseconds to wait for OMAP module to softreset */ 35/* Maximum microseconds to wait for OMAP module to softreset */
34#define MAX_MODULE_SOFTRESET_WAIT 10000 36#define MAX_MODULE_SOFTRESET_WAIT 10000
35 37
36void __init omap2_i2c_mux_pins(int bus_id) 38#define MAX_OMAP_I2C_HWMOD_NAME_LEN 16
39
40static void __init omap2_i2c_mux_pins(int bus_id)
37{ 41{
38 char mux_name[sizeof("i2c2_scl.i2c2_scl")]; 42 char mux_name[sizeof("i2c2_scl.i2c2_scl")];
39 43
@@ -104,3 +108,46 @@ int omap_i2c_reset(struct omap_hwmod *oh)
104 108
105 return 0; 109 return 0;
106} 110}
111
112static const char name[] = "omap_i2c";
113
114int __init omap_i2c_add_bus(struct omap_i2c_bus_platform_data *i2c_pdata,
115 int bus_id)
116{
117 int l;
118 struct omap_hwmod *oh;
119 struct platform_device *pdev;
120 char oh_name[MAX_OMAP_I2C_HWMOD_NAME_LEN];
121 struct omap_i2c_bus_platform_data *pdata;
122 struct omap_i2c_dev_attr *dev_attr;
123
124 omap2_i2c_mux_pins(bus_id);
125
126 l = snprintf(oh_name, MAX_OMAP_I2C_HWMOD_NAME_LEN, "i2c%d", bus_id);
127 WARN(l >= MAX_OMAP_I2C_HWMOD_NAME_LEN,
128 "String buffer overflow in I2C%d device setup\n", bus_id);
129 oh = omap_hwmod_lookup(oh_name);
130 if (!oh) {
131 pr_err("Could not look up %s\n", oh_name);
132 return -EEXIST;
133 }
134
135 pdata = i2c_pdata;
136 /*
137 * pass the hwmod class's CPU-specific knowledge of I2C IP revision in
138 * use, and functionality implementation flags, up to the OMAP I2C
139 * driver via platform data
140 */
141 pdata->rev = oh->class->rev;
142
143 dev_attr = (struct omap_i2c_dev_attr *)oh->dev_attr;
144 pdata->flags = dev_attr->flags;
145
146 pdev = omap_device_build(name, bus_id, oh, pdata,
147 sizeof(struct omap_i2c_bus_platform_data),
148 NULL, 0, 0);
149 WARN(IS_ERR(pdev), "Could not build omap_device for %s\n", name);
150
151 return PTR_RET(pdev);
152}
153
diff --git a/arch/arm/plat-omap/include/plat/i2c.h b/arch/arm/mach-omap2/i2c.h
index 7c22b9e10dc3..81dbb992a6bc 100644
--- a/arch/arm/plat-omap/include/plat/i2c.h
+++ b/arch/arm/mach-omap2/i2c.h
@@ -18,24 +18,11 @@
18 * 02110-1301 USA 18 * 02110-1301 USA
19 * 19 *
20 */ 20 */
21#ifndef __ASM__ARCH_OMAP_I2C_H
22#define __ASM__ARCH_OMAP_I2C_H
23 21
24#include <linux/i2c.h> 22#include "../plat-omap/i2c.h"
25#include <linux/i2c-omap.h>
26 23
27#if defined(CONFIG_I2C_OMAP) || defined(CONFIG_I2C_OMAP_MODULE) 24#ifndef __MACH_OMAP2_I2C_H
28extern int omap_register_i2c_bus(int bus_id, u32 clkrate, 25#define __MACH_OMAP2_I2C_H
29 struct i2c_board_info const *info,
30 unsigned len);
31#else
32static inline int omap_register_i2c_bus(int bus_id, u32 clkrate,
33 struct i2c_board_info const *info,
34 unsigned len)
35{
36 return 0;
37}
38#endif
39 26
40/** 27/**
41 * i2c_dev_attr - OMAP I2C controller device attributes for omap_hwmod 28 * i2c_dev_attr - OMAP I2C controller device attributes for omap_hwmod
@@ -50,10 +37,6 @@ struct omap_i2c_dev_attr {
50 u32 flags; 37 u32 flags;
51}; 38};
52 39
53void __init omap1_i2c_mux_pins(int bus_id);
54void __init omap2_i2c_mux_pins(int bus_id);
55
56struct omap_hwmod;
57int omap_i2c_reset(struct omap_hwmod *oh); 40int omap_i2c_reset(struct omap_hwmod *oh);
58 41
59#endif /* __ASM__ARCH_OMAP_I2C_H */ 42#endif /* __MACH_OMAP2_I2C_H */
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index 4234d28dc171..80d1cf17af8c 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -25,14 +25,12 @@
25#include <asm/tlb.h> 25#include <asm/tlb.h>
26#include <asm/mach/map.h> 26#include <asm/mach/map.h>
27 27
28#include <plat/sram.h>
29#include <plat/sdrc.h>
30#include <plat/serial.h> 28#include <plat/serial.h>
31#include <plat/omap-pm.h> 29#include <plat-omap/dma-omap.h>
32#include <plat/omap_hwmod.h>
33#include <plat/multi.h>
34#include <plat/dma.h>
35 30
31#include "../plat-omap/sram.h"
32
33#include "omap_hwmod.h"
36#include "soc.h" 34#include "soc.h"
37#include "iomap.h" 35#include "iomap.h"
38#include "voltage.h" 36#include "voltage.h"
@@ -43,6 +41,8 @@
43#include "clock2xxx.h" 41#include "clock2xxx.h"
44#include "clock3xxx.h" 42#include "clock3xxx.h"
45#include "clock44xx.h" 43#include "clock44xx.h"
44#include "omap-pm.h"
45#include "sdrc.h"
46 46
47/* 47/*
48 * The machine specific code may provide the extra mapping besides the 48 * The machine specific code may provide the extra mapping besides the
diff --git a/arch/arm/mach-omap2/mcbsp.c b/arch/arm/mach-omap2/mcbsp.c
index 37f8f948047b..a106c75c5338 100644
--- a/arch/arm/mach-omap2/mcbsp.c
+++ b/arch/arm/mach-omap2/mcbsp.c
@@ -19,11 +19,12 @@
19#include <linux/platform_device.h> 19#include <linux/platform_device.h>
20#include <linux/slab.h> 20#include <linux/slab.h>
21#include <linux/platform_data/asoc-ti-mcbsp.h> 21#include <linux/platform_data/asoc-ti-mcbsp.h>
22
23#include <plat/dma.h>
24#include <plat/omap_device.h>
25#include <linux/pm_runtime.h> 22#include <linux/pm_runtime.h>
26 23
24#include <plat-omap/dma-omap.h>
25
26#include "omap_device.h"
27
27/* 28/*
28 * FIXME: Find a mechanism to enable/disable runtime the McBSP ICLK autoidle. 29 * FIXME: Find a mechanism to enable/disable runtime the McBSP ICLK autoidle.
29 * Sidetone needs non-gated ICLK and sidetone autoidle is broken. 30 * Sidetone needs non-gated ICLK and sidetone autoidle is broken.
diff --git a/arch/arm/mach-omap2/mmc.h b/arch/arm/mach-omap2/mmc.h
new file mode 100644
index 000000000000..0cd4b089da9c
--- /dev/null
+++ b/arch/arm/mach-omap2/mmc.h
@@ -0,0 +1,23 @@
1#include <linux/mmc/host.h>
2#include <linux/platform_data/mmc-omap.h>
3
4#define OMAP24XX_NR_MMC 2
5#define OMAP2420_MMC_SIZE OMAP1_MMC_SIZE
6#define OMAP2_MMC1_BASE 0x4809c000
7
8#define OMAP4_MMC_REG_OFFSET 0x100
9
10#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
11void omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data);
12#else
13static inline void omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data)
14{
15}
16#endif
17
18struct omap_hwmod;
19int omap_msdi_reset(struct omap_hwmod *oh);
20
21/* called from board-specific card detection service routine */
22extern void omap_mmc_notify_cover_event(struct device *dev, int slot,
23 int is_closed);
diff --git a/arch/arm/mach-omap2/msdi.c b/arch/arm/mach-omap2/msdi.c
index 9e57b4aadb06..627e97e30743 100644
--- a/arch/arm/mach-omap2/msdi.c
+++ b/arch/arm/mach-omap2/msdi.c
@@ -25,13 +25,12 @@
25#include <linux/err.h> 25#include <linux/err.h>
26#include <linux/platform_data/gpio-omap.h> 26#include <linux/platform_data/gpio-omap.h>
27 27
28#include <plat/omap_hwmod.h>
29#include <plat/omap_device.h>
30#include <plat/mmc.h>
31
32#include "common.h" 28#include "common.h"
33#include "control.h" 29#include "control.h"
30#include "omap_hwmod.h"
31#include "omap_device.h"
34#include "mux.h" 32#include "mux.h"
33#include "mmc.h"
35 34
36/* 35/*
37 * MSDI_CON_OFFSET: offset in bytes of the MSDI IP block's CON register 36 * MSDI_CON_OFFSET: offset in bytes of the MSDI IP block's CON register
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c
index 701e17cba468..26126343d6ac 100644
--- a/arch/arm/mach-omap2/mux.c
+++ b/arch/arm/mach-omap2/mux.c
@@ -36,8 +36,9 @@
36#include <linux/interrupt.h> 36#include <linux/interrupt.h>
37 37
38 38
39#include <plat/omap_hwmod.h> 39#include "omap_hwmod.h"
40 40
41#include "soc.h"
41#include "control.h" 42#include "control.h"
42#include "mux.h" 43#include "mux.h"
43#include "prm.h" 44#include "prm.h"
diff --git a/arch/arm/mach-omap2/omap-mpuss-lowpower.c b/arch/arm/mach-omap2/omap-mpuss-lowpower.c
index ff4e6a0e9c7c..3f5fd7e3549d 100644
--- a/arch/arm/mach-omap2/omap-mpuss-lowpower.c
+++ b/arch/arm/mach-omap2/omap-mpuss-lowpower.c
@@ -50,6 +50,7 @@
50#include <asm/suspend.h> 50#include <asm/suspend.h>
51#include <asm/hardware/cache-l2x0.h> 51#include <asm/hardware/cache-l2x0.h>
52 52
53#include "soc.h"
53#include "common.h" 54#include "common.h"
54#include "omap44xx.h" 55#include "omap44xx.h"
55#include "omap4-sar-layout.h" 56#include "omap4-sar-layout.h"
diff --git a/arch/arm/plat-omap/include/plat/omap-pm.h b/arch/arm/mach-omap2/omap-pm.h
index 67faa7b8fe92..67faa7b8fe92 100644
--- a/arch/arm/plat-omap/include/plat/omap-pm.h
+++ b/arch/arm/mach-omap2/omap-pm.h
diff --git a/arch/arm/mach-omap2/omap-secure.c b/arch/arm/mach-omap2/omap-secure.c
index e089e4d1ae38..b970440cffca 100644
--- a/arch/arm/mach-omap2/omap-secure.c
+++ b/arch/arm/mach-omap2/omap-secure.c
@@ -18,7 +18,6 @@
18#include <asm/cacheflush.h> 18#include <asm/cacheflush.h>
19#include <asm/memblock.h> 19#include <asm/memblock.h>
20 20
21#include <plat/omap-secure.h>
22#include "omap-secure.h" 21#include "omap-secure.h"
23 22
24static phys_addr_t omap_secure_memblock_base; 23static phys_addr_t omap_secure_memblock_base;
diff --git a/arch/arm/mach-omap2/omap-secure.h b/arch/arm/mach-omap2/omap-secure.h
index c90a43589abe..0e729170c46b 100644
--- a/arch/arm/mach-omap2/omap-secure.h
+++ b/arch/arm/mach-omap2/omap-secure.h
@@ -52,6 +52,13 @@ extern u32 omap_secure_dispatcher(u32 idx, u32 flag, u32 nargs,
52 u32 arg1, u32 arg2, u32 arg3, u32 arg4); 52 u32 arg1, u32 arg2, u32 arg3, u32 arg4);
53extern u32 omap_smc2(u32 id, u32 falg, u32 pargs); 53extern u32 omap_smc2(u32 id, u32 falg, u32 pargs);
54extern phys_addr_t omap_secure_ram_mempool_base(void); 54extern phys_addr_t omap_secure_ram_mempool_base(void);
55extern int omap_secure_ram_reserve_memblock(void);
55 56
57#ifdef CONFIG_OMAP4_ERRATA_I688
58extern int omap_barrier_reserve_memblock(void);
59#else
60static inline void omap_barrier_reserve_memblock(void)
61{ }
62#endif
56#endif /* __ASSEMBLER__ */ 63#endif /* __ASSEMBLER__ */
57#endif /* OMAP_ARCH_OMAP_SECURE_H */ 64#endif /* OMAP_ARCH_OMAP_SECURE_H */
diff --git a/arch/arm/mach-omap2/omap4-common.c b/arch/arm/mach-omap2/omap4-common.c
index e1f289748c5d..d25845c471da 100644
--- a/arch/arm/mach-omap2/omap4-common.c
+++ b/arch/arm/mach-omap2/omap4-common.c
@@ -25,16 +25,15 @@
25#include <asm/mach/map.h> 25#include <asm/mach/map.h>
26#include <asm/memblock.h> 26#include <asm/memblock.h>
27 27
28#include <plat/sram.h> 28#include "../plat-omap/sram.h"
29#include <plat/omap-secure.h>
30#include <plat/mmc.h>
31 29
32#include "omap-wakeupgen.h" 30#include "omap-wakeupgen.h"
33
34#include "soc.h" 31#include "soc.h"
35#include "common.h" 32#include "common.h"
33#include "mmc.h"
36#include "hsmmc.h" 34#include "hsmmc.h"
37#include "omap4-sar-layout.h" 35#include "omap4-sar-layout.h"
36#include "omap-secure.h"
38 37
39#ifdef CONFIG_CACHE_L2X0 38#ifdef CONFIG_CACHE_L2X0
40static void __iomem *l2cache_base; 39static void __iomem *l2cache_base;
diff --git a/arch/arm/plat-omap/omap_device.c b/arch/arm/mach-omap2/omap_device.c
index 7a7d1f2a65e9..0ef934fec364 100644
--- a/arch/arm/plat-omap/omap_device.c
+++ b/arch/arm/mach-omap2/omap_device.c
@@ -89,9 +89,8 @@
89#include <linux/of.h> 89#include <linux/of.h>
90#include <linux/notifier.h> 90#include <linux/notifier.h>
91 91
92#include <plat/omap_device.h> 92#include "omap_device.h"
93#include <plat/omap_hwmod.h> 93#include "omap_hwmod.h"
94#include <plat/clock.h>
95 94
96/* These parameters are passed to _omap_device_{de,}activate() */ 95/* These parameters are passed to _omap_device_{de,}activate() */
97#define USE_WAKEUP_LAT 0 96#define USE_WAKEUP_LAT 0
diff --git a/arch/arm/plat-omap/include/plat/omap_device.h b/arch/arm/mach-omap2/omap_device.h
index 106f50665804..0933c599bf89 100644
--- a/arch/arm/plat-omap/include/plat/omap_device.h
+++ b/arch/arm/mach-omap2/omap_device.h
@@ -34,7 +34,7 @@
34#include <linux/kernel.h> 34#include <linux/kernel.h>
35#include <linux/platform_device.h> 35#include <linux/platform_device.h>
36 36
37#include <plat/omap_hwmod.h> 37#include "omap_hwmod.h"
38 38
39extern struct dev_pm_domain omap_device_pm_domain; 39extern struct dev_pm_domain omap_device_pm_domain;
40 40
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index b969ab1d258b..87eee3b62a3c 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -139,8 +139,8 @@
139#include <linux/slab.h> 139#include <linux/slab.h>
140#include <linux/bootmem.h> 140#include <linux/bootmem.h>
141 141
142#include <plat/clock.h> 142#include "clock.h"
143#include <plat/omap_hwmod.h> 143#include "omap_hwmod.h"
144#include <plat/prcm.h> 144#include <plat/prcm.h>
145 145
146#include "soc.h" 146#include "soc.h"
diff --git a/arch/arm/plat-omap/include/plat/omap_hwmod.h b/arch/arm/mach-omap2/omap_hwmod.h
index b3349f7b1a2c..87b59b45c678 100644
--- a/arch/arm/plat-omap/include/plat/omap_hwmod.h
+++ b/arch/arm/mach-omap2/omap_hwmod.h
@@ -35,7 +35,6 @@
35#include <linux/list.h> 35#include <linux/list.h>
36#include <linux/ioport.h> 36#include <linux/ioport.h>
37#include <linux/spinlock.h> 37#include <linux/spinlock.h>
38#include <plat/cpu.h>
39 38
40struct omap_device; 39struct omap_device;
41 40
diff --git a/arch/arm/mach-omap2/omap_hwmod_2420_data.c b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
index b5db6007c523..3efed3d633d1 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2420_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
@@ -12,21 +12,23 @@
12 * XXX handle crossbar/shared link difference for L3? 12 * XXX handle crossbar/shared link difference for L3?
13 * XXX these should be marked initdata for multi-OMAP kernels 13 * XXX these should be marked initdata for multi-OMAP kernels
14 */ 14 */
15
16#include <linux/i2c-omap.h>
15#include <linux/platform_data/spi-omap2-mcspi.h> 17#include <linux/platform_data/spi-omap2-mcspi.h>
16 18
17#include <plat/omap_hwmod.h> 19#include <plat-omap/dma-omap.h>
18#include <plat/dma.h>
19#include <plat/serial.h>
20#include <plat/i2c.h>
21#include <plat/dmtimer.h> 20#include <plat/dmtimer.h>
21
22#include "omap_hwmod.h"
22#include "l3_2xxx.h" 23#include "l3_2xxx.h"
23#include "l4_2xxx.h" 24#include "l4_2xxx.h"
24#include <plat/mmc.h>
25 25
26#include "omap_hwmod_common_data.h" 26#include "omap_hwmod_common_data.h"
27 27
28#include "cm-regbits-24xx.h" 28#include "cm-regbits-24xx.h"
29#include "prm-regbits-24xx.h" 29#include "prm-regbits-24xx.h"
30#include "i2c.h"
31#include "mmc.h"
30#include "wd_timer.h" 32#include "wd_timer.h"
31 33
32/* 34/*
diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
index c455e41b0237..dc768c50e523 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
@@ -12,21 +12,23 @@
12 * XXX handle crossbar/shared link difference for L3? 12 * XXX handle crossbar/shared link difference for L3?
13 * XXX these should be marked initdata for multi-OMAP kernels 13 * XXX these should be marked initdata for multi-OMAP kernels
14 */ 14 */
15
16#include <linux/i2c-omap.h>
15#include <linux/platform_data/asoc-ti-mcbsp.h> 17#include <linux/platform_data/asoc-ti-mcbsp.h>
16#include <linux/platform_data/spi-omap2-mcspi.h> 18#include <linux/platform_data/spi-omap2-mcspi.h>
17 19
18#include <plat/omap_hwmod.h> 20#include <plat-omap/dma-omap.h>
19#include <plat/dma.h>
20#include <plat/serial.h>
21#include <plat/i2c.h>
22#include <plat/dmtimer.h> 21#include <plat/dmtimer.h>
23#include <plat/mmc.h> 22
23#include "omap_hwmod.h"
24#include "mmc.h"
24#include "l3_2xxx.h" 25#include "l3_2xxx.h"
25 26
26#include "soc.h" 27#include "soc.h"
27#include "omap_hwmod_common_data.h" 28#include "omap_hwmod_common_data.h"
28#include "prm-regbits-24xx.h" 29#include "prm-regbits-24xx.h"
29#include "cm-regbits-24xx.h" 30#include "cm-regbits-24xx.h"
31#include "i2c.h"
30#include "wd_timer.h" 32#include "wd_timer.h"
31 33
32/* 34/*
diff --git a/arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_interconnect_data.c b/arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_interconnect_data.c
index cbb4ef6544ad..74ae76767510 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_interconnect_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_interconnect_data.c
@@ -13,9 +13,10 @@
13 */ 13 */
14#include <asm/sizes.h> 14#include <asm/sizes.h>
15 15
16#include <plat/omap_hwmod.h>
17#include <plat/serial.h> 16#include <plat/serial.h>
18 17
18#include "omap_hwmod.h"
19
19#include "omap_hwmod_common_data.h" 20#include "omap_hwmod_common_data.h"
20 21
21struct omap_hwmod_addr_space omap2430_mmc1_addr_space[] = { 22struct omap_hwmod_addr_space omap2430_mmc1_addr_space[] = {
diff --git a/arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_ipblock_data.c b/arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_ipblock_data.c
index 8851bbb6bb24..57fc2f95584d 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_ipblock_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2xxx_3xxx_ipblock_data.c
@@ -9,13 +9,17 @@
9 * it under the terms of the GNU General Public License version 2 as 9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11 */ 11 */
12#include <plat/omap_hwmod.h> 12
13#include <plat/serial.h> 13#include <plat/serial.h>
14#include <plat/dma.h> 14#include <plat-omap/dma-omap.h>
15#include <plat/common.h> 15
16#include "../plat-omap/common.h"
17
18#include "omap_hwmod.h"
16#include "hdq1w.h" 19#include "hdq1w.h"
17 20
18#include "omap_hwmod_common_data.h" 21#include "omap_hwmod_common_data.h"
22#include "dma.h"
19 23
20/* UART */ 24/* UART */
21 25
diff --git a/arch/arm/mach-omap2/omap_hwmod_2xxx_interconnect_data.c b/arch/arm/mach-omap2/omap_hwmod_2xxx_interconnect_data.c
index 1a1287d62648..dd3809c8f409 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2xxx_interconnect_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2xxx_interconnect_data.c
@@ -13,8 +13,9 @@
13 */ 13 */
14#include <asm/sizes.h> 14#include <asm/sizes.h>
15 15
16#include <plat/omap_hwmod.h>
17#include <plat/serial.h> 16#include <plat/serial.h>
17
18#include "omap_hwmod.h"
18#include "l3_2xxx.h" 19#include "l3_2xxx.h"
19#include "l4_2xxx.h" 20#include "l4_2xxx.h"
20 21
diff --git a/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c b/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c
index bd9220ed5ab9..27bdff46fda0 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c
@@ -8,13 +8,14 @@
8 * it under the terms of the GNU General Public License version 2 as 8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation. 9 * published by the Free Software Foundation.
10 */ 10 */
11#include <plat/omap_hwmod.h> 11
12#include <plat/serial.h> 12#include <plat/serial.h>
13#include <linux/platform_data/gpio-omap.h> 13#include <linux/platform_data/gpio-omap.h>
14#include <plat/dma.h> 14#include <plat-omap/dma-omap.h>
15#include <plat/dmtimer.h> 15#include <plat/dmtimer.h>
16#include <linux/platform_data/spi-omap2-mcspi.h> 16#include <linux/platform_data/spi-omap2-mcspi.h>
17 17
18#include "omap_hwmod.h"
18#include "omap_hwmod_common_data.h" 19#include "omap_hwmod_common_data.h"
19#include "cm-regbits-24xx.h" 20#include "cm-regbits-24xx.h"
20#include "prm-regbits-24xx.h" 21#include "prm-regbits-24xx.h"
diff --git a/arch/arm/mach-omap2/omap_hwmod_33xx_data.c b/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
index 59d5c1cd316d..ad8d43b33273 100644
--- a/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
@@ -14,13 +14,11 @@
14 * GNU General Public License for more details. 14 * GNU General Public License for more details.
15 */ 15 */
16 16
17#include <plat/omap_hwmod.h> 17#include <linux/i2c-omap.h>
18#include <plat/cpu.h> 18
19#include "omap_hwmod.h"
19#include <linux/platform_data/gpio-omap.h> 20#include <linux/platform_data/gpio-omap.h>
20#include <linux/platform_data/spi-omap2-mcspi.h> 21#include <linux/platform_data/spi-omap2-mcspi.h>
21#include <plat/dma.h>
22#include <plat/mmc.h>
23#include <plat/i2c.h>
24 22
25#include "omap_hwmod_common_data.h" 23#include "omap_hwmod_common_data.h"
26 24
@@ -28,6 +26,8 @@
28#include "cm33xx.h" 26#include "cm33xx.h"
29#include "prm33xx.h" 27#include "prm33xx.h"
30#include "prm-regbits-33xx.h" 28#include "prm-regbits-33xx.h"
29#include "i2c.h"
30#include "mmc.h"
31 31
32/* 32/*
33 * IP blocks 33 * IP blocks
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
index f67b7ee07dd4..d5d52a776278 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -14,16 +14,16 @@
14 * 14 *
15 * XXX these should be marked initdata for multi-OMAP kernels 15 * XXX these should be marked initdata for multi-OMAP kernels
16 */ 16 */
17
18#include <linux/i2c-omap.h>
17#include <linux/power/smartreflex.h> 19#include <linux/power/smartreflex.h>
18#include <linux/platform_data/gpio-omap.h> 20#include <linux/platform_data/gpio-omap.h>
19 21
20#include <plat/omap_hwmod.h> 22#include <plat-omap/dma-omap.h>
21#include <plat/dma.h>
22#include <plat/serial.h> 23#include <plat/serial.h>
24
23#include "l3_3xxx.h" 25#include "l3_3xxx.h"
24#include "l4_3xxx.h" 26#include "l4_3xxx.h"
25#include <plat/i2c.h>
26#include <plat/mmc.h>
27#include <linux/platform_data/asoc-ti-mcbsp.h> 27#include <linux/platform_data/asoc-ti-mcbsp.h>
28#include <linux/platform_data/spi-omap2-mcspi.h> 28#include <linux/platform_data/spi-omap2-mcspi.h>
29#include <plat/dmtimer.h> 29#include <plat/dmtimer.h>
@@ -32,9 +32,14 @@
32#include "am35xx.h" 32#include "am35xx.h"
33 33
34#include "soc.h" 34#include "soc.h"
35#include "omap_hwmod.h"
35#include "omap_hwmod_common_data.h" 36#include "omap_hwmod_common_data.h"
36#include "prm-regbits-34xx.h" 37#include "prm-regbits-34xx.h"
37#include "cm-regbits-34xx.h" 38#include "cm-regbits-34xx.h"
39
40#include "dma.h"
41#include "i2c.h"
42#include "mmc.h"
38#include "wd_timer.h" 43#include "wd_timer.h"
39 44
40/* 45/*
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index 652d0285bd6d..5b9be734709c 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -21,22 +21,25 @@
21#include <linux/io.h> 21#include <linux/io.h>
22#include <linux/platform_data/gpio-omap.h> 22#include <linux/platform_data/gpio-omap.h>
23#include <linux/power/smartreflex.h> 23#include <linux/power/smartreflex.h>
24#include <linux/i2c-omap.h>
25
26#include <plat-omap/dma-omap.h>
24 27
25#include <plat/omap_hwmod.h>
26#include <plat/i2c.h>
27#include <plat/dma.h>
28#include <linux/platform_data/spi-omap2-mcspi.h> 28#include <linux/platform_data/spi-omap2-mcspi.h>
29#include <linux/platform_data/asoc-ti-mcbsp.h> 29#include <linux/platform_data/asoc-ti-mcbsp.h>
30#include <plat/mmc.h>
31#include <plat/dmtimer.h> 30#include <plat/dmtimer.h>
32#include <plat/common.h>
33#include <plat/iommu.h> 31#include <plat/iommu.h>
34 32
33#include "../plat-omap/common.h"
34
35#include "omap_hwmod.h"
35#include "omap_hwmod_common_data.h" 36#include "omap_hwmod_common_data.h"
36#include "cm1_44xx.h" 37#include "cm1_44xx.h"
37#include "cm2_44xx.h" 38#include "cm2_44xx.h"
38#include "prm44xx.h" 39#include "prm44xx.h"
39#include "prm-regbits-44xx.h" 40#include "prm-regbits-44xx.h"
41#include "i2c.h"
42#include "mmc.h"
40#include "wd_timer.h" 43#include "wd_timer.h"
41 44
42/* Base offset for all OMAP4 interrupts external to MPUSS */ 45/* Base offset for all OMAP4 interrupts external to MPUSS */
diff --git a/arch/arm/mach-omap2/omap_hwmod_common_data.c b/arch/arm/mach-omap2/omap_hwmod_common_data.c
index 9f1ccdc8cc8c..79d623b83e49 100644
--- a/arch/arm/mach-omap2/omap_hwmod_common_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_common_data.c
@@ -16,7 +16,7 @@
16 * data and their integration with other OMAP modules and Linux. 16 * data and their integration with other OMAP modules and Linux.
17 */ 17 */
18 18
19#include <plat/omap_hwmod.h> 19#include "omap_hwmod.h"
20 20
21#include "omap_hwmod_common_data.h" 21#include "omap_hwmod_common_data.h"
22 22
diff --git a/arch/arm/mach-omap2/omap_hwmod_common_data.h b/arch/arm/mach-omap2/omap_hwmod_common_data.h
index 2bc8f1705d4a..cfcce299177c 100644
--- a/arch/arm/mach-omap2/omap_hwmod_common_data.h
+++ b/arch/arm/mach-omap2/omap_hwmod_common_data.h
@@ -13,7 +13,7 @@
13#ifndef __ARCH_ARM_MACH_OMAP2_OMAP_HWMOD_COMMON_DATA_H 13#ifndef __ARCH_ARM_MACH_OMAP2_OMAP_HWMOD_COMMON_DATA_H
14#define __ARCH_ARM_MACH_OMAP2_OMAP_HWMOD_COMMON_DATA_H 14#define __ARCH_ARM_MACH_OMAP2_OMAP_HWMOD_COMMON_DATA_H
15 15
16#include <plat/omap_hwmod.h> 16#include "omap_hwmod.h"
17 17
18#include "common.h" 18#include "common.h"
19#include "display.h" 19#include "display.h"
diff --git a/arch/arm/mach-omap2/omap_opp_data.h b/arch/arm/mach-omap2/omap_opp_data.h
index c784c12f98a1..7e437bf6024c 100644
--- a/arch/arm/mach-omap2/omap_opp_data.h
+++ b/arch/arm/mach-omap2/omap_opp_data.h
@@ -19,7 +19,7 @@
19#ifndef __ARCH_ARM_MACH_OMAP2_OMAP_OPP_DATA_H 19#ifndef __ARCH_ARM_MACH_OMAP2_OMAP_OPP_DATA_H
20#define __ARCH_ARM_MACH_OMAP2_OMAP_OPP_DATA_H 20#define __ARCH_ARM_MACH_OMAP2_OMAP_OPP_DATA_H
21 21
22#include <plat/omap_hwmod.h> 22#include "omap_hwmod.h"
23 23
24#include "voltage.h" 24#include "voltage.h"
25 25
diff --git a/arch/arm/mach-omap2/omap_twl.c b/arch/arm/mach-omap2/omap_twl.c
index f515a1a056d5..2bf35dc091be 100644
--- a/arch/arm/mach-omap2/omap_twl.c
+++ b/arch/arm/mach-omap2/omap_twl.c
@@ -18,6 +18,7 @@
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/i2c/twl.h> 19#include <linux/i2c/twl.h>
20 20
21#include "soc.h"
21#include "voltage.h" 22#include "voltage.h"
22 23
23#include "pm.h" 24#include "pm.h"
diff --git a/arch/arm/mach-omap2/opp.c b/arch/arm/mach-omap2/opp.c
index 58e16aef40bb..bd41d59a7cab 100644
--- a/arch/arm/mach-omap2/opp.c
+++ b/arch/arm/mach-omap2/opp.c
@@ -20,7 +20,7 @@
20#include <linux/opp.h> 20#include <linux/opp.h>
21#include <linux/cpu.h> 21#include <linux/cpu.h>
22 22
23#include <plat/omap_device.h> 23#include "omap_device.h"
24 24
25#include "omap_opp_data.h" 25#include "omap_opp_data.h"
26 26
diff --git a/arch/arm/mach-omap2/opp3xxx_data.c b/arch/arm/mach-omap2/opp3xxx_data.c
index 75cef5f67a8a..62772e0e0d69 100644
--- a/arch/arm/mach-omap2/opp3xxx_data.c
+++ b/arch/arm/mach-omap2/opp3xxx_data.c
@@ -19,6 +19,7 @@
19 */ 19 */
20#include <linux/module.h> 20#include <linux/module.h>
21 21
22#include "soc.h"
22#include "control.h" 23#include "control.h"
23#include "omap_opp_data.h" 24#include "omap_opp_data.h"
24#include "pm.h" 25#include "pm.h"
diff --git a/arch/arm/mach-omap2/pm-debug.c b/arch/arm/mach-omap2/pm-debug.c
index 46092cd806fa..3cf4fdfd7ab0 100644
--- a/arch/arm/mach-omap2/pm-debug.c
+++ b/arch/arm/mach-omap2/pm-debug.c
@@ -27,12 +27,13 @@
27#include <linux/module.h> 27#include <linux/module.h>
28#include <linux/slab.h> 28#include <linux/slab.h>
29 29
30#include <plat/clock.h> 30#include "clock.h"
31#include "powerdomain.h" 31#include "powerdomain.h"
32#include "clockdomain.h" 32#include "clockdomain.h"
33#include <plat/dmtimer.h> 33#include <plat/dmtimer.h>
34#include <plat/omap-pm.h> 34#include "omap-pm.h"
35 35
36#include "soc.h"
36#include "cm2xxx_3xxx.h" 37#include "cm2xxx_3xxx.h"
37#include "prm2xxx_3xxx.h" 38#include "prm2xxx_3xxx.h"
38#include "pm.h" 39#include "pm.h"
diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
index ea61c32957bd..331478f9b864 100644
--- a/arch/arm/mach-omap2/pm.c
+++ b/arch/arm/mach-omap2/pm.c
@@ -20,10 +20,11 @@
20 20
21#include <asm/system_misc.h> 21#include <asm/system_misc.h>
22 22
23#include <plat/omap-pm.h> 23#include "omap-pm.h"
24#include <plat/omap_device.h> 24#include "omap_device.h"
25#include "common.h" 25#include "common.h"
26 26
27#include "soc.h"
27#include "prcm-common.h" 28#include "prcm-common.h"
28#include "voltage.h" 29#include "voltage.h"
29#include "powerdomain.h" 30#include "powerdomain.h"
diff --git a/arch/arm/mach-omap2/pm24xx.c b/arch/arm/mach-omap2/pm24xx.c
index 8af6cd6ac331..6d17e044ffb8 100644
--- a/arch/arm/mach-omap2/pm24xx.c
+++ b/arch/arm/mach-omap2/pm24xx.c
@@ -36,11 +36,13 @@
36#include <asm/mach-types.h> 36#include <asm/mach-types.h>
37#include <asm/system_misc.h> 37#include <asm/system_misc.h>
38 38
39#include <plat/clock.h> 39#include <plat-omap/dma-omap.h>
40#include <plat/sram.h>
41#include <plat/dma.h>
42 40
41#include "../plat-omap/sram.h"
42
43#include "soc.h"
43#include "common.h" 44#include "common.h"
45#include "clock.h"
44#include "prm2xxx_3xxx.h" 46#include "prm2xxx_3xxx.h"
45#include "prm-regbits-24xx.h" 47#include "prm-regbits-24xx.h"
46#include "cm2xxx_3xxx.h" 48#include "cm2xxx_3xxx.h"
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index ba670db1fd37..160fa250c41e 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -35,17 +35,18 @@
35#include <asm/suspend.h> 35#include <asm/suspend.h>
36#include <asm/system_misc.h> 36#include <asm/system_misc.h>
37 37
38#include <plat/sram.h>
39#include "clockdomain.h" 38#include "clockdomain.h"
40#include "powerdomain.h" 39#include "powerdomain.h"
41#include <plat/sdrc.h>
42#include <plat/prcm.h> 40#include <plat/prcm.h>
43#include <plat/gpmc.h> 41#include <plat-omap/dma-omap.h>
44#include <plat/dma.h>
45 42
43#include "../plat-omap/sram.h"
44
45#include "soc.h"
46#include "common.h" 46#include "common.h"
47#include "cm2xxx_3xxx.h" 47#include "cm2xxx_3xxx.h"
48#include "cm-regbits-34xx.h" 48#include "cm-regbits-34xx.h"
49#include "gpmc.h"
49#include "prm-regbits-34xx.h" 50#include "prm-regbits-34xx.h"
50 51
51#include "prm2xxx_3xxx.h" 52#include "prm2xxx_3xxx.h"
diff --git a/arch/arm/mach-omap2/pm44xx.c b/arch/arm/mach-omap2/pm44xx.c
index 04922d149068..7da75aed1514 100644
--- a/arch/arm/mach-omap2/pm44xx.c
+++ b/arch/arm/mach-omap2/pm44xx.c
@@ -18,6 +18,7 @@
18#include <linux/slab.h> 18#include <linux/slab.h>
19#include <asm/system_misc.h> 19#include <asm/system_misc.h>
20 20
21#include "soc.h"
21#include "common.h" 22#include "common.h"
22#include "clockdomain.h" 23#include "clockdomain.h"
23#include "powerdomain.h" 24#include "powerdomain.h"
diff --git a/arch/arm/mach-omap2/pmu.c b/arch/arm/mach-omap2/pmu.c
index 2a791766283d..3cf79b54ce61 100644
--- a/arch/arm/mach-omap2/pmu.c
+++ b/arch/arm/mach-omap2/pmu.c
@@ -15,8 +15,9 @@
15 15
16#include <asm/pmu.h> 16#include <asm/pmu.h>
17 17
18#include <plat/omap_hwmod.h> 18#include "soc.h"
19#include <plat/omap_device.h> 19#include "omap_hwmod.h"
20#include "omap_device.h"
20 21
21static char *omap2_pmu_oh_names[] = {"mpu"}; 22static char *omap2_pmu_oh_names[] = {"mpu"};
22static char *omap3_pmu_oh_names[] = {"mpu", "debugss"}; 23static char *omap3_pmu_oh_names[] = {"mpu", "debugss"};
diff --git a/arch/arm/mach-omap2/powerdomain.h b/arch/arm/mach-omap2/powerdomain.h
index baee90608d11..5277d56eb37f 100644
--- a/arch/arm/mach-omap2/powerdomain.h
+++ b/arch/arm/mach-omap2/powerdomain.h
@@ -22,8 +22,6 @@
22 22
23#include <linux/atomic.h> 23#include <linux/atomic.h>
24 24
25#include <plat/cpu.h>
26
27#include "voltage.h" 25#include "voltage.h"
28 26
29/* Powerdomain basic power states */ 27/* Powerdomain basic power states */
diff --git a/arch/arm/mach-omap2/powerdomains2xxx_data.c b/arch/arm/mach-omap2/powerdomains2xxx_data.c
index 2385c1f009ee..ba520d4f7c7b 100644
--- a/arch/arm/mach-omap2/powerdomains2xxx_data.c
+++ b/arch/arm/mach-omap2/powerdomains2xxx_data.c
@@ -14,6 +14,7 @@
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/init.h> 15#include <linux/init.h>
16 16
17#include "soc.h"
17#include "powerdomain.h" 18#include "powerdomain.h"
18#include "powerdomains2xxx_3xxx_data.h" 19#include "powerdomains2xxx_3xxx_data.h"
19 20
diff --git a/arch/arm/mach-omap2/prcm.c b/arch/arm/mach-omap2/prcm.c
index 0f51e034e0aa..cff270a178c5 100644
--- a/arch/arm/mach-omap2/prcm.c
+++ b/arch/arm/mach-omap2/prcm.c
@@ -28,6 +28,7 @@
28#include "common.h" 28#include "common.h"
29#include <plat/prcm.h> 29#include <plat/prcm.h>
30 30
31#include "soc.h"
31#include "clock.h" 32#include "clock.h"
32#include "clock2xxx.h" 33#include "clock2xxx.h"
33#include "cm2xxx_3xxx.h" 34#include "cm2xxx_3xxx.h"
diff --git a/arch/arm/mach-omap2/prm33xx.c b/arch/arm/mach-omap2/prm33xx.c
index e7dbb6cf1255..624ade5c3c33 100644
--- a/arch/arm/mach-omap2/prm33xx.c
+++ b/arch/arm/mach-omap2/prm33xx.c
@@ -19,7 +19,7 @@
19#include <linux/err.h> 19#include <linux/err.h>
20#include <linux/io.h> 20#include <linux/io.h>
21 21
22#include <plat/common.h> 22#include "../plat-omap/common.h"
23 23
24#include "common.h" 24#include "common.h"
25#include "prm33xx.h" 25#include "prm33xx.h"
diff --git a/arch/arm/mach-omap2/prm_common.c b/arch/arm/mach-omap2/prm_common.c
index 6b4d332be2f6..6fabbd816d6b 100644
--- a/arch/arm/mach-omap2/prm_common.c
+++ b/arch/arm/mach-omap2/prm_common.c
@@ -24,7 +24,7 @@
24#include <linux/interrupt.h> 24#include <linux/interrupt.h>
25#include <linux/slab.h> 25#include <linux/slab.h>
26 26
27#include <plat/common.h> 27#include "../plat-omap/common.h"
28#include <plat/prcm.h> 28#include <plat/prcm.h>
29 29
30#include "prm2xxx_3xxx.h" 30#include "prm2xxx_3xxx.h"
diff --git a/arch/arm/mach-omap2/sdram-hynix-h8mbx00u0mer-0em.h b/arch/arm/mach-omap2/sdram-hynix-h8mbx00u0mer-0em.h
index 8bfaf342a028..1ee58c281a31 100644
--- a/arch/arm/mach-omap2/sdram-hynix-h8mbx00u0mer-0em.h
+++ b/arch/arm/mach-omap2/sdram-hynix-h8mbx00u0mer-0em.h
@@ -11,7 +11,7 @@
11#ifndef __ARCH_ARM_MACH_OMAP2_SDRAM_HYNIX_H8MBX00U0MER0EM 11#ifndef __ARCH_ARM_MACH_OMAP2_SDRAM_HYNIX_H8MBX00U0MER0EM
12#define __ARCH_ARM_MACH_OMAP2_SDRAM_HYNIX_H8MBX00U0MER0EM 12#define __ARCH_ARM_MACH_OMAP2_SDRAM_HYNIX_H8MBX00U0MER0EM
13 13
14#include <plat/sdrc.h> 14#include "sdrc.h"
15 15
16/* Hynix H8MBX00U0MER-0EM */ 16/* Hynix H8MBX00U0MER-0EM */
17static struct omap_sdrc_params h8mbx00u0mer0em_sdrc_params[] = { 17static struct omap_sdrc_params h8mbx00u0mer0em_sdrc_params[] = {
diff --git a/arch/arm/mach-omap2/sdram-micron-mt46h32m32lf-6.h b/arch/arm/mach-omap2/sdram-micron-mt46h32m32lf-6.h
index a391b4939f74..85cccc004c06 100644
--- a/arch/arm/mach-omap2/sdram-micron-mt46h32m32lf-6.h
+++ b/arch/arm/mach-omap2/sdram-micron-mt46h32m32lf-6.h
@@ -14,7 +14,7 @@
14#ifndef ARCH_ARM_MACH_OMAP2_SDRAM_MICRON_MT46H32M32LF 14#ifndef ARCH_ARM_MACH_OMAP2_SDRAM_MICRON_MT46H32M32LF
15#define ARCH_ARM_MACH_OMAP2_SDRAM_MICRON_MT46H32M32LF 15#define ARCH_ARM_MACH_OMAP2_SDRAM_MICRON_MT46H32M32LF
16 16
17#include <plat/sdrc.h> 17#include "sdrc.h"
18 18
19/* Micron MT46H32M32LF-6 */ 19/* Micron MT46H32M32LF-6 */
20/* XXX Using ARE = 0x1 (no autorefresh burst) -- can this be changed? */ 20/* XXX Using ARE = 0x1 (no autorefresh burst) -- can this be changed? */
diff --git a/arch/arm/mach-omap2/sdram-nokia.c b/arch/arm/mach-omap2/sdram-nokia.c
index 845c4fd2b125..0fa7ffa9b5ed 100644
--- a/arch/arm/mach-omap2/sdram-nokia.c
+++ b/arch/arm/mach-omap2/sdram-nokia.c
@@ -18,10 +18,8 @@
18#include <linux/io.h> 18#include <linux/io.h>
19 19
20#include "common.h" 20#include "common.h"
21#include <plat/clock.h>
22#include <plat/sdrc.h>
23
24#include "sdram-nokia.h" 21#include "sdram-nokia.h"
22#include "sdrc.h"
25 23
26/* In picoseconds, except for tREF (ns), tXP, tCKE, tWTR (clks) */ 24/* In picoseconds, except for tREF (ns), tXP, tCKE, tWTR (clks) */
27struct sdram_timings { 25struct sdram_timings {
diff --git a/arch/arm/mach-omap2/sdram-numonyx-m65kxxxxam.h b/arch/arm/mach-omap2/sdram-numonyx-m65kxxxxam.h
index cd4352917022..003f7bf4e2e3 100644
--- a/arch/arm/mach-omap2/sdram-numonyx-m65kxxxxam.h
+++ b/arch/arm/mach-omap2/sdram-numonyx-m65kxxxxam.h
@@ -11,7 +11,7 @@
11#ifndef __ARCH_ARM_MACH_OMAP2_SDRAM_NUMONYX_M65KXXXXAM 11#ifndef __ARCH_ARM_MACH_OMAP2_SDRAM_NUMONYX_M65KXXXXAM
12#define __ARCH_ARM_MACH_OMAP2_SDRAM_NUMONYX_M65KXXXXAM 12#define __ARCH_ARM_MACH_OMAP2_SDRAM_NUMONYX_M65KXXXXAM
13 13
14#include <plat/sdrc.h> 14#include "sdrc.h"
15 15
16/* Numonyx M65KXXXXAM */ 16/* Numonyx M65KXXXXAM */
17static struct omap_sdrc_params m65kxxxxam_sdrc_params[] = { 17static struct omap_sdrc_params m65kxxxxam_sdrc_params[] = {
diff --git a/arch/arm/mach-omap2/sdram-qimonda-hyb18m512160af-6.h b/arch/arm/mach-omap2/sdram-qimonda-hyb18m512160af-6.h
index 0e518a72831f..8dc3de5ebb5b 100644
--- a/arch/arm/mach-omap2/sdram-qimonda-hyb18m512160af-6.h
+++ b/arch/arm/mach-omap2/sdram-qimonda-hyb18m512160af-6.h
@@ -14,7 +14,7 @@
14#ifndef ARCH_ARM_MACH_OMAP2_SDRAM_QIMONDA_HYB18M512160AF6 14#ifndef ARCH_ARM_MACH_OMAP2_SDRAM_QIMONDA_HYB18M512160AF6
15#define ARCH_ARM_MACH_OMAP2_SDRAM_QIMONDA_HYB18M512160AF6 15#define ARCH_ARM_MACH_OMAP2_SDRAM_QIMONDA_HYB18M512160AF6
16 16
17#include <plat/sdrc.h> 17#include "sdrc.h"
18 18
19/* Qimonda HYB18M512160AF-6 */ 19/* Qimonda HYB18M512160AF-6 */
20static struct omap_sdrc_params hyb18m512160af6_sdrc_params[] = { 20static struct omap_sdrc_params hyb18m512160af6_sdrc_params[] = {
diff --git a/arch/arm/mach-omap2/sdrc.c b/arch/arm/mach-omap2/sdrc.c
index e3d345f46409..94d4082f87ed 100644
--- a/arch/arm/mach-omap2/sdrc.c
+++ b/arch/arm/mach-omap2/sdrc.c
@@ -23,11 +23,10 @@
23#include <linux/clk.h> 23#include <linux/clk.h>
24#include <linux/io.h> 24#include <linux/io.h>
25 25
26#include "common.h" 26#include "../plat-omap/sram.h"
27#include <plat/clock.h>
28#include <plat/sram.h>
29 27
30#include <plat/sdrc.h> 28#include "common.h"
29#include "clock.h"
31#include "sdrc.h" 30#include "sdrc.h"
32 31
33static struct omap_sdrc_params *sdrc_init_params_cs0, *sdrc_init_params_cs1; 32static struct omap_sdrc_params *sdrc_init_params_cs0, *sdrc_init_params_cs1;
@@ -160,19 +159,3 @@ void __init omap2_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
160 sdrc_write_reg(l, SDRC_POWER); 159 sdrc_write_reg(l, SDRC_POWER);
161 omap2_sms_save_context(); 160 omap2_sms_save_context();
162} 161}
163
164void omap2_sms_write_rot_control(u32 val, unsigned ctx)
165{
166 sms_write_reg(val, SMS_ROT_CONTROL(ctx));
167}
168
169void omap2_sms_write_rot_size(u32 val, unsigned ctx)
170{
171 sms_write_reg(val, SMS_ROT_SIZE(ctx));
172}
173
174void omap2_sms_write_rot_physical_ba(u32 val, unsigned ctx)
175{
176 sms_write_reg(val, SMS_ROT_PHYSICAL_BA(ctx));
177}
178
diff --git a/arch/arm/mach-omap2/sdrc.h b/arch/arm/mach-omap2/sdrc.h
index b3f83799e6cf..69c4b329452e 100644
--- a/arch/arm/mach-omap2/sdrc.h
+++ b/arch/arm/mach-omap2/sdrc.h
@@ -2,12 +2,14 @@
2#define __ARCH_ARM_MACH_OMAP2_SDRC_H 2#define __ARCH_ARM_MACH_OMAP2_SDRC_H
3 3
4/* 4/*
5 * OMAP2 SDRC register definitions 5 * OMAP2/3 SDRC/SMS macros and prototypes
6 * 6 *
7 * Copyright (C) 2007 Texas Instruments, Inc. 7 * Copyright (C) 2007-2008, 2012 Texas Instruments, Inc.
8 * Copyright (C) 2007 Nokia Corporation 8 * Copyright (C) 2007-2008 Nokia Corporation
9 * 9 *
10 * Written by Paul Walmsley 10 * Paul Walmsley
11 * Tony Lindgren
12 * Richard Woodruff
11 * 13 *
12 * This program is free software; you can redistribute it and/or modify 14 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2 as 15 * it under the terms of the GNU General Public License version 2 as
@@ -15,8 +17,6 @@
15 */ 17 */
16#undef DEBUG 18#undef DEBUG
17 19
18#include <plat/sdrc.h>
19
20#ifndef __ASSEMBLER__ 20#ifndef __ASSEMBLER__
21 21
22#include <linux/io.h> 22#include <linux/io.h>
@@ -50,6 +50,58 @@ static inline u32 sms_read_reg(u16 reg)
50{ 50{
51 return __raw_readl(OMAP_SMS_REGADDR(reg)); 51 return __raw_readl(OMAP_SMS_REGADDR(reg));
52} 52}
53
54
55/**
56 * struct omap_sdrc_params - SDRC parameters for a given SDRC clock rate
57 * @rate: SDRC clock rate (in Hz)
58 * @actim_ctrla: Value to program to SDRC_ACTIM_CTRLA for this rate
59 * @actim_ctrlb: Value to program to SDRC_ACTIM_CTRLB for this rate
60 * @rfr_ctrl: Value to program to SDRC_RFR_CTRL for this rate
61 * @mr: Value to program to SDRC_MR for this rate
62 *
63 * This structure holds a pre-computed set of register values for the
64 * SDRC for a given SDRC clock rate and SDRAM chip. These are
65 * intended to be pre-computed and specified in an array in the board-*.c
66 * files. The structure is keyed off the 'rate' field.
67 */
68struct omap_sdrc_params {
69 unsigned long rate;
70 u32 actim_ctrla;
71 u32 actim_ctrlb;
72 u32 rfr_ctrl;
73 u32 mr;
74};
75
76#ifdef CONFIG_SOC_HAS_OMAP2_SDRC
77void omap2_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
78 struct omap_sdrc_params *sdrc_cs1);
79#else
80static inline void __init omap2_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
81 struct omap_sdrc_params *sdrc_cs1) {};
82#endif
83
84int omap2_sdrc_get_params(unsigned long r,
85 struct omap_sdrc_params **sdrc_cs0,
86 struct omap_sdrc_params **sdrc_cs1);
87void omap2_sms_save_context(void);
88void omap2_sms_restore_context(void);
89
90struct memory_timings {
91 u32 m_type; /* ddr = 1, sdr = 0 */
92 u32 dll_mode; /* use lock mode = 1, unlock mode = 0 */
93 u32 slow_dll_ctrl; /* unlock mode, dll value for slow speed */
94 u32 fast_dll_ctrl; /* unlock mode, dll value for fast speed */
95 u32 base_cs; /* base chip select to use for calculations */
96};
97
98extern void omap2xxx_sdrc_init_params(u32 force_lock_to_unlock_mode);
99struct omap_sdrc_params *rx51_get_sdram_timings(void);
100
101u32 omap2xxx_sdrc_dll_is_unlocked(void);
102u32 omap2xxx_sdrc_reprogram(u32 level, u32 force);
103
104
53#else 105#else
54#define OMAP242X_SDRC_REGADDR(reg) \ 106#define OMAP242X_SDRC_REGADDR(reg) \
55 OMAP2_L3_IO_ADDRESS(OMAP2420_SDRC_BASE + (reg)) 107 OMAP2_L3_IO_ADDRESS(OMAP2420_SDRC_BASE + (reg))
@@ -57,6 +109,7 @@ static inline u32 sms_read_reg(u16 reg)
57 OMAP2_L3_IO_ADDRESS(OMAP243X_SDRC_BASE + (reg)) 109 OMAP2_L3_IO_ADDRESS(OMAP243X_SDRC_BASE + (reg))
58#define OMAP34XX_SDRC_REGADDR(reg) \ 110#define OMAP34XX_SDRC_REGADDR(reg) \
59 OMAP2_L3_IO_ADDRESS(OMAP343X_SDRC_BASE + (reg)) 111 OMAP2_L3_IO_ADDRESS(OMAP343X_SDRC_BASE + (reg))
112
60#endif /* __ASSEMBLER__ */ 113#endif /* __ASSEMBLER__ */
61 114
62/* Minimum frequency that the SDRC DLL can lock at */ 115/* Minimum frequency that the SDRC DLL can lock at */
@@ -74,4 +127,85 @@ static inline u32 sms_read_reg(u16 reg)
74 */ 127 */
75#define SDRC_MPURATE_LOOPS 96 128#define SDRC_MPURATE_LOOPS 96
76 129
130/* SDRC register offsets - read/write with sdrc_{read,write}_reg() */
131
132#define SDRC_SYSCONFIG 0x010
133#define SDRC_CS_CFG 0x040
134#define SDRC_SHARING 0x044
135#define SDRC_ERR_TYPE 0x04C
136#define SDRC_DLLA_CTRL 0x060
137#define SDRC_DLLA_STATUS 0x064
138#define SDRC_DLLB_CTRL 0x068
139#define SDRC_DLLB_STATUS 0x06C
140#define SDRC_POWER 0x070
141#define SDRC_MCFG_0 0x080
142#define SDRC_MR_0 0x084
143#define SDRC_EMR2_0 0x08c
144#define SDRC_ACTIM_CTRL_A_0 0x09c
145#define SDRC_ACTIM_CTRL_B_0 0x0a0
146#define SDRC_RFR_CTRL_0 0x0a4
147#define SDRC_MANUAL_0 0x0a8
148#define SDRC_MCFG_1 0x0B0
149#define SDRC_MR_1 0x0B4
150#define SDRC_EMR2_1 0x0BC
151#define SDRC_ACTIM_CTRL_A_1 0x0C4
152#define SDRC_ACTIM_CTRL_B_1 0x0C8
153#define SDRC_RFR_CTRL_1 0x0D4
154#define SDRC_MANUAL_1 0x0D8
155
156#define SDRC_POWER_AUTOCOUNT_SHIFT 8
157#define SDRC_POWER_AUTOCOUNT_MASK (0xffff << SDRC_POWER_AUTOCOUNT_SHIFT)
158#define SDRC_POWER_CLKCTRL_SHIFT 4
159#define SDRC_POWER_CLKCTRL_MASK (0x3 << SDRC_POWER_CLKCTRL_SHIFT)
160#define SDRC_SELF_REFRESH_ON_AUTOCOUNT (0x2 << SDRC_POWER_CLKCTRL_SHIFT)
161
162/*
163 * These values represent the number of memory clock cycles between
164 * autorefresh initiation. They assume 1 refresh per 64 ms (JEDEC), 8192
165 * rows per device, and include a subtraction of a 50 cycle window in the
166 * event that the autorefresh command is delayed due to other SDRC activity.
167 * The '| 1' sets the ARE field to send one autorefresh when the autorefresh
168 * counter reaches 0.
169 *
170 * These represent optimal values for common parts, it won't work for all.
171 * As long as you scale down, most parameters are still work, they just
172 * become sub-optimal. The RFR value goes in the opposite direction. If you
173 * don't adjust it down as your clock period increases the refresh interval
174 * will not be met. Setting all parameters for complete worst case may work,
175 * but may cut memory performance by 2x. Due to errata the DLLs need to be
176 * unlocked and their value needs run time calibration. A dynamic call is
177 * need for that as no single right value exists acorss production samples.
178 *
179 * Only the FULL speed values are given. Current code is such that rate
180 * changes must be made at DPLLoutx2. The actual value adjustment for low
181 * frequency operation will be handled by omap_set_performance()
182 *
183 * By having the boot loader boot up in the fastest L4 speed available likely
184 * will result in something which you can switch between.
185 */
186#define SDRC_RFR_CTRL_165MHz (0x00044c00 | 1)
187#define SDRC_RFR_CTRL_133MHz (0x0003de00 | 1)
188#define SDRC_RFR_CTRL_100MHz (0x0002da01 | 1)
189#define SDRC_RFR_CTRL_110MHz (0x0002da01 | 1) /* Need to calc */
190#define SDRC_RFR_CTRL_BYPASS (0x00005000 | 1) /* Need to calc */
191
192
193/*
194 * SMS register access
195 */
196
197#define OMAP242X_SMS_REGADDR(reg) \
198 (void __iomem *)OMAP2_L3_IO_ADDRESS(OMAP2420_SMS_BASE + reg)
199#define OMAP243X_SMS_REGADDR(reg) \
200 (void __iomem *)OMAP2_L3_IO_ADDRESS(OMAP243X_SMS_BASE + reg)
201#define OMAP343X_SMS_REGADDR(reg) \
202 (void __iomem *)OMAP2_L3_IO_ADDRESS(OMAP343X_SMS_BASE + reg)
203
204/* SMS register offsets - read/write with sms_{read,write}_reg() */
205
206#define SMS_SYSCONFIG 0x010
207/* REVISIT: fill in other SMS registers here */
208
209
210
77#endif 211#endif
diff --git a/arch/arm/mach-omap2/sdrc2xxx.c b/arch/arm/mach-omap2/sdrc2xxx.c
index 73e55e485329..3b8bfdf848d5 100644
--- a/arch/arm/mach-omap2/sdrc2xxx.c
+++ b/arch/arm/mach-omap2/sdrc2xxx.c
@@ -24,9 +24,7 @@
24#include <linux/clk.h> 24#include <linux/clk.h>
25#include <linux/io.h> 25#include <linux/io.h>
26 26
27#include <plat/clock.h> 27#include "../plat-omap/sram.h"
28#include <plat/sram.h>
29#include <plat/sdrc.h>
30 28
31#include "soc.h" 29#include "soc.h"
32#include "iomap.h" 30#include "iomap.h"
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
index 0405c8190803..12363f313f08 100644
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -28,13 +28,14 @@
28#include <linux/console.h> 28#include <linux/console.h>
29 29
30#include <plat/omap-serial.h> 30#include <plat/omap-serial.h>
31#include "common.h" 31#include <plat-omap/dma-omap.h>
32#include <plat/dma.h>
33#include <plat/omap_hwmod.h>
34#include <plat/omap_device.h>
35#include <plat/omap-pm.h>
36#include <plat/serial.h> 32#include <plat/serial.h>
37 33
34#include "common.h"
35#include "omap_hwmod.h"
36#include "omap_device.h"
37#include "omap-pm.h"
38#include "soc.h"
38#include "prm2xxx_3xxx.h" 39#include "prm2xxx_3xxx.h"
39#include "pm.h" 40#include "pm.h"
40#include "cm2xxx_3xxx.h" 41#include "cm2xxx_3xxx.h"
diff --git a/arch/arm/mach-omap2/sleep34xx.S b/arch/arm/mach-omap2/sleep34xx.S
index 506987979c1c..75afe11207ff 100644
--- a/arch/arm/mach-omap2/sleep34xx.S
+++ b/arch/arm/mach-omap2/sleep34xx.S
@@ -26,7 +26,7 @@
26 26
27#include <asm/assembler.h> 27#include <asm/assembler.h>
28 28
29#include <plat/sram.h> 29#include "../plat-omap/sram.h"
30 30
31#include "omap34xx.h" 31#include "omap34xx.h"
32#include "iomap.h" 32#include "iomap.h"
diff --git a/arch/arm/mach-omap2/soc.h b/arch/arm/mach-omap2/soc.h
index fc9b96daf851..070096496e20 100644
--- a/arch/arm/mach-omap2/soc.h
+++ b/arch/arm/mach-omap2/soc.h
@@ -1,7 +1,473 @@
1#include <plat/cpu.h> 1/*
2 * OMAP cpu type detection
3 *
4 * Copyright (C) 2004, 2008 Nokia Corporation
5 *
6 * Copyright (C) 2009-11 Texas Instruments.
7 *
8 * Written by Tony Lindgren <tony.lindgren@nokia.com>
9 *
10 * Added OMAP4/5 specific defines - Santosh Shilimkar<santosh.shilimkar@ti.com>
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 *
26 */
27
2#include "omap24xx.h" 28#include "omap24xx.h"
3#include "omap34xx.h" 29#include "omap34xx.h"
4#include "omap44xx.h" 30#include "omap44xx.h"
5#include "ti81xx.h" 31#include "ti81xx.h"
6#include "am33xx.h" 32#include "am33xx.h"
7#include "omap54xx.h" 33#include "omap54xx.h"
34
35#ifndef __ASSEMBLY__
36
37#include <linux/bitops.h>
38
39/*
40 * Test if multicore OMAP support is needed
41 */
42#undef MULTI_OMAP2
43#undef OMAP_NAME
44
45#ifdef CONFIG_SOC_OMAP2420
46# ifdef OMAP_NAME
47# undef MULTI_OMAP2
48# define MULTI_OMAP2
49# else
50# define OMAP_NAME omap2420
51# endif
52#endif
53#ifdef CONFIG_SOC_OMAP2430
54# ifdef OMAP_NAME
55# undef MULTI_OMAP2
56# define MULTI_OMAP2
57# else
58# define OMAP_NAME omap2430
59# endif
60#endif
61#ifdef CONFIG_ARCH_OMAP3
62# ifdef OMAP_NAME
63# undef MULTI_OMAP2
64# define MULTI_OMAP2
65# else
66# define OMAP_NAME omap3
67# endif
68#endif
69#ifdef CONFIG_ARCH_OMAP4
70# ifdef OMAP_NAME
71# undef MULTI_OMAP2
72# define MULTI_OMAP2
73# else
74# define OMAP_NAME omap4
75# endif
76#endif
77
78#ifdef CONFIG_SOC_OMAP5
79# ifdef OMAP_NAME
80# undef MULTI_OMAP2
81# define MULTI_OMAP2
82# else
83# define OMAP_NAME omap5
84# endif
85#endif
86
87#ifdef CONFIG_SOC_AM33XX
88# ifdef OMAP_NAME
89# undef MULTI_OMAP2
90# define MULTI_OMAP2
91# else
92# define OMAP_NAME am33xx
93# endif
94#endif
95
96/*
97 * Omap device type i.e. EMU/HS/TST/GP/BAD
98 */
99#define OMAP2_DEVICE_TYPE_TEST 0
100#define OMAP2_DEVICE_TYPE_EMU 1
101#define OMAP2_DEVICE_TYPE_SEC 2
102#define OMAP2_DEVICE_TYPE_GP 3
103#define OMAP2_DEVICE_TYPE_BAD 4
104
105int omap_type(void);
106
107/*
108 * omap_rev bits:
109 * CPU id bits (0730, 1510, 1710, 2422...) [31:16]
110 * CPU revision (See _REV_ defined in cpu.h) [15:08]
111 * CPU class bits (15xx, 16xx, 24xx, 34xx...) [07:00]
112 */
113unsigned int omap_rev(void);
114
115/*
116 * Get the CPU revision for OMAP devices
117 */
118#define GET_OMAP_REVISION() ((omap_rev() >> 8) & 0xff)
119
120/*
121 * Macros to group OMAP into cpu classes.
122 * These can be used in most places.
123 * cpu_is_omap24xx(): True for OMAP2420, OMAP2422, OMAP2423, OMAP2430
124 * cpu_is_omap242x(): True for OMAP2420, OMAP2422, OMAP2423
125 * cpu_is_omap243x(): True for OMAP2430
126 * cpu_is_omap343x(): True for OMAP3430
127 * cpu_is_omap443x(): True for OMAP4430
128 * cpu_is_omap446x(): True for OMAP4460
129 * cpu_is_omap447x(): True for OMAP4470
130 * soc_is_omap543x(): True for OMAP5430, OMAP5432
131 */
132#define GET_OMAP_CLASS (omap_rev() & 0xff)
133
134#define IS_OMAP_CLASS(class, id) \
135static inline int is_omap ##class (void) \
136{ \
137 return (GET_OMAP_CLASS == (id)) ? 1 : 0; \
138}
139
140#define GET_AM_CLASS ((omap_rev() >> 24) & 0xff)
141
142#define IS_AM_CLASS(class, id) \
143static inline int is_am ##class (void) \
144{ \
145 return (GET_AM_CLASS == (id)) ? 1 : 0; \
146}
147
148#define GET_TI_CLASS ((omap_rev() >> 24) & 0xff)
149
150#define IS_TI_CLASS(class, id) \
151static inline int is_ti ##class (void) \
152{ \
153 return (GET_TI_CLASS == (id)) ? 1 : 0; \
154}
155
156#define GET_OMAP_SUBCLASS ((omap_rev() >> 20) & 0x0fff)
157
158#define IS_OMAP_SUBCLASS(subclass, id) \
159static inline int is_omap ##subclass (void) \
160{ \
161 return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \
162}
163
164#define IS_TI_SUBCLASS(subclass, id) \
165static inline int is_ti ##subclass (void) \
166{ \
167 return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \
168}
169
170#define IS_AM_SUBCLASS(subclass, id) \
171static inline int is_am ##subclass (void) \
172{ \
173 return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \
174}
175
176IS_OMAP_CLASS(24xx, 0x24)
177IS_OMAP_CLASS(34xx, 0x34)
178IS_OMAP_CLASS(44xx, 0x44)
179IS_AM_CLASS(35xx, 0x35)
180IS_OMAP_CLASS(54xx, 0x54)
181IS_AM_CLASS(33xx, 0x33)
182
183IS_TI_CLASS(81xx, 0x81)
184
185IS_OMAP_SUBCLASS(242x, 0x242)
186IS_OMAP_SUBCLASS(243x, 0x243)
187IS_OMAP_SUBCLASS(343x, 0x343)
188IS_OMAP_SUBCLASS(363x, 0x363)
189IS_OMAP_SUBCLASS(443x, 0x443)
190IS_OMAP_SUBCLASS(446x, 0x446)
191IS_OMAP_SUBCLASS(447x, 0x447)
192IS_OMAP_SUBCLASS(543x, 0x543)
193
194IS_TI_SUBCLASS(816x, 0x816)
195IS_TI_SUBCLASS(814x, 0x814)
196IS_AM_SUBCLASS(335x, 0x335)
197
198#define cpu_is_omap24xx() 0
199#define cpu_is_omap242x() 0
200#define cpu_is_omap243x() 0
201#define cpu_is_omap34xx() 0
202#define cpu_is_omap343x() 0
203#define cpu_is_ti81xx() 0
204#define cpu_is_ti816x() 0
205#define cpu_is_ti814x() 0
206#define soc_is_am35xx() 0
207#define soc_is_am33xx() 0
208#define soc_is_am335x() 0
209#define cpu_is_omap44xx() 0
210#define cpu_is_omap443x() 0
211#define cpu_is_omap446x() 0
212#define cpu_is_omap447x() 0
213#define soc_is_omap54xx() 0
214#define soc_is_omap543x() 0
215
216#if defined(MULTI_OMAP2)
217# if defined(CONFIG_ARCH_OMAP2)
218# undef cpu_is_omap24xx
219# define cpu_is_omap24xx() is_omap24xx()
220# endif
221# if defined (CONFIG_SOC_OMAP2420)
222# undef cpu_is_omap242x
223# define cpu_is_omap242x() is_omap242x()
224# endif
225# if defined (CONFIG_SOC_OMAP2430)
226# undef cpu_is_omap243x
227# define cpu_is_omap243x() is_omap243x()
228# endif
229# if defined(CONFIG_ARCH_OMAP3)
230# undef cpu_is_omap34xx
231# undef cpu_is_omap343x
232# define cpu_is_omap34xx() is_omap34xx()
233# define cpu_is_omap343x() is_omap343x()
234# endif
235#else
236# if defined(CONFIG_ARCH_OMAP2)
237# undef cpu_is_omap24xx
238# define cpu_is_omap24xx() 1
239# endif
240# if defined(CONFIG_SOC_OMAP2420)
241# undef cpu_is_omap242x
242# define cpu_is_omap242x() 1
243# endif
244# if defined(CONFIG_SOC_OMAP2430)
245# undef cpu_is_omap243x
246# define cpu_is_omap243x() 1
247# endif
248# if defined(CONFIG_ARCH_OMAP3)
249# undef cpu_is_omap34xx
250# define cpu_is_omap34xx() 1
251# endif
252# if defined(CONFIG_SOC_OMAP3430)
253# undef cpu_is_omap343x
254# define cpu_is_omap343x() 1
255# endif
256#endif
257
258/*
259 * Macros to detect individual cpu types.
260 * These are only rarely needed.
261 * cpu_is_omap2420(): True for OMAP2420
262 * cpu_is_omap2422(): True for OMAP2422
263 * cpu_is_omap2423(): True for OMAP2423
264 * cpu_is_omap2430(): True for OMAP2430
265 * cpu_is_omap3430(): True for OMAP3430
266 */
267#define GET_OMAP_TYPE ((omap_rev() >> 16) & 0xffff)
268
269#define IS_OMAP_TYPE(type, id) \
270static inline int is_omap ##type (void) \
271{ \
272 return (GET_OMAP_TYPE == (id)) ? 1 : 0; \
273}
274
275IS_OMAP_TYPE(2420, 0x2420)
276IS_OMAP_TYPE(2422, 0x2422)
277IS_OMAP_TYPE(2423, 0x2423)
278IS_OMAP_TYPE(2430, 0x2430)
279IS_OMAP_TYPE(3430, 0x3430)
280
281#define cpu_is_omap2420() 0
282#define cpu_is_omap2422() 0
283#define cpu_is_omap2423() 0
284#define cpu_is_omap2430() 0
285#define cpu_is_omap3430() 0
286#define cpu_is_omap3630() 0
287#define soc_is_omap5430() 0
288
289/* These are needed for the common code */
290#ifdef CONFIG_ARCH_OMAP2PLUS
291#define cpu_is_omap7xx() 0
292#define cpu_is_omap15xx() 0
293#define cpu_is_omap16xx() 0
294#define cpu_is_omap1510() 0
295#define cpu_is_omap1610() 0
296#define cpu_is_omap1611() 0
297#define cpu_is_omap1621() 0
298#define cpu_is_omap1710() 0
299#define cpu_class_is_omap1() 0
300#define cpu_class_is_omap2() 1
301#endif
302
303#if defined(CONFIG_ARCH_OMAP2)
304# undef cpu_is_omap2420
305# undef cpu_is_omap2422
306# undef cpu_is_omap2423
307# undef cpu_is_omap2430
308# define cpu_is_omap2420() is_omap2420()
309# define cpu_is_omap2422() is_omap2422()
310# define cpu_is_omap2423() is_omap2423()
311# define cpu_is_omap2430() is_omap2430()
312#endif
313
314#if defined(CONFIG_ARCH_OMAP3)
315# undef cpu_is_omap3430
316# undef cpu_is_ti81xx
317# undef cpu_is_ti816x
318# undef cpu_is_ti814x
319# undef soc_is_am35xx
320# define cpu_is_omap3430() is_omap3430()
321# undef cpu_is_omap3630
322# define cpu_is_omap3630() is_omap363x()
323# define cpu_is_ti81xx() is_ti81xx()
324# define cpu_is_ti816x() is_ti816x()
325# define cpu_is_ti814x() is_ti814x()
326# define soc_is_am35xx() is_am35xx()
327#endif
328
329# if defined(CONFIG_SOC_AM33XX)
330# undef soc_is_am33xx
331# undef soc_is_am335x
332# define soc_is_am33xx() is_am33xx()
333# define soc_is_am335x() is_am335x()
334#endif
335
336# if defined(CONFIG_ARCH_OMAP4)
337# undef cpu_is_omap44xx
338# undef cpu_is_omap443x
339# undef cpu_is_omap446x
340# undef cpu_is_omap447x
341# define cpu_is_omap44xx() is_omap44xx()
342# define cpu_is_omap443x() is_omap443x()
343# define cpu_is_omap446x() is_omap446x()
344# define cpu_is_omap447x() is_omap447x()
345# endif
346
347# if defined(CONFIG_SOC_OMAP5)
348# undef soc_is_omap54xx
349# undef soc_is_omap543x
350# define soc_is_omap54xx() is_omap54xx()
351# define soc_is_omap543x() is_omap543x()
352#endif
353
354/* Various silicon revisions for omap2 */
355#define OMAP242X_CLASS 0x24200024
356#define OMAP2420_REV_ES1_0 OMAP242X_CLASS
357#define OMAP2420_REV_ES2_0 (OMAP242X_CLASS | (0x1 << 8))
358
359#define OMAP243X_CLASS 0x24300024
360#define OMAP2430_REV_ES1_0 OMAP243X_CLASS
361
362#define OMAP343X_CLASS 0x34300034
363#define OMAP3430_REV_ES1_0 OMAP343X_CLASS
364#define OMAP3430_REV_ES2_0 (OMAP343X_CLASS | (0x1 << 8))
365#define OMAP3430_REV_ES2_1 (OMAP343X_CLASS | (0x2 << 8))
366#define OMAP3430_REV_ES3_0 (OMAP343X_CLASS | (0x3 << 8))
367#define OMAP3430_REV_ES3_1 (OMAP343X_CLASS | (0x4 << 8))
368#define OMAP3430_REV_ES3_1_2 (OMAP343X_CLASS | (0x5 << 8))
369
370#define OMAP363X_CLASS 0x36300034
371#define OMAP3630_REV_ES1_0 OMAP363X_CLASS
372#define OMAP3630_REV_ES1_1 (OMAP363X_CLASS | (0x1 << 8))
373#define OMAP3630_REV_ES1_2 (OMAP363X_CLASS | (0x2 << 8))
374
375#define TI816X_CLASS 0x81600034
376#define TI8168_REV_ES1_0 TI816X_CLASS
377#define TI8168_REV_ES1_1 (TI816X_CLASS | (0x1 << 8))
378
379#define TI814X_CLASS 0x81400034
380#define TI8148_REV_ES1_0 TI814X_CLASS
381#define TI8148_REV_ES2_0 (TI814X_CLASS | (0x1 << 8))
382#define TI8148_REV_ES2_1 (TI814X_CLASS | (0x2 << 8))
383
384#define AM35XX_CLASS 0x35170034
385#define AM35XX_REV_ES1_0 AM35XX_CLASS
386#define AM35XX_REV_ES1_1 (AM35XX_CLASS | (0x1 << 8))
387
388#define AM335X_CLASS 0x33500033
389#define AM335X_REV_ES1_0 AM335X_CLASS
390
391#define OMAP443X_CLASS 0x44300044
392#define OMAP4430_REV_ES1_0 (OMAP443X_CLASS | (0x10 << 8))
393#define OMAP4430_REV_ES2_0 (OMAP443X_CLASS | (0x20 << 8))
394#define OMAP4430_REV_ES2_1 (OMAP443X_CLASS | (0x21 << 8))
395#define OMAP4430_REV_ES2_2 (OMAP443X_CLASS | (0x22 << 8))
396#define OMAP4430_REV_ES2_3 (OMAP443X_CLASS | (0x23 << 8))
397
398#define OMAP446X_CLASS 0x44600044
399#define OMAP4460_REV_ES1_0 (OMAP446X_CLASS | (0x10 << 8))
400#define OMAP4460_REV_ES1_1 (OMAP446X_CLASS | (0x11 << 8))
401
402#define OMAP447X_CLASS 0x44700044
403#define OMAP4470_REV_ES1_0 (OMAP447X_CLASS | (0x10 << 8))
404
405#define OMAP54XX_CLASS 0x54000054
406#define OMAP5430_REV_ES1_0 (OMAP54XX_CLASS | (0x30 << 16) | (0x10 << 8))
407#define OMAP5432_REV_ES1_0 (OMAP54XX_CLASS | (0x32 << 16) | (0x10 << 8))
408
409void omap2xxx_check_revision(void);
410void omap3xxx_check_revision(void);
411void omap4xxx_check_revision(void);
412void omap5xxx_check_revision(void);
413void omap3xxx_check_features(void);
414void ti81xx_check_features(void);
415void omap4xxx_check_features(void);
416
417/*
418 * Runtime detection of OMAP3 features
419 *
420 * OMAP3_HAS_IO_CHAIN_CTRL: Some later members of the OMAP3 chip
421 * family have OS-level control over the I/O chain clock. This is
422 * to avoid a window during which wakeups could potentially be lost
423 * during powerdomain transitions. If this bit is set, it
424 * indicates that the chip does support OS-level control of this
425 * feature.
426 */
427extern u32 omap_features;
428
429#define OMAP3_HAS_L2CACHE BIT(0)
430#define OMAP3_HAS_IVA BIT(1)
431#define OMAP3_HAS_SGX BIT(2)
432#define OMAP3_HAS_NEON BIT(3)
433#define OMAP3_HAS_ISP BIT(4)
434#define OMAP3_HAS_192MHZ_CLK BIT(5)
435#define OMAP3_HAS_IO_WAKEUP BIT(6)
436#define OMAP3_HAS_SDRC BIT(7)
437#define OMAP3_HAS_IO_CHAIN_CTRL BIT(8)
438#define OMAP4_HAS_MPU_1GHZ BIT(9)
439#define OMAP4_HAS_MPU_1_2GHZ BIT(10)
440#define OMAP4_HAS_MPU_1_5GHZ BIT(11)
441
442
443#define OMAP3_HAS_FEATURE(feat,flag) \
444static inline unsigned int omap3_has_ ##feat(void) \
445{ \
446 return omap_features & OMAP3_HAS_ ##flag; \
447} \
448
449OMAP3_HAS_FEATURE(l2cache, L2CACHE)
450OMAP3_HAS_FEATURE(sgx, SGX)
451OMAP3_HAS_FEATURE(iva, IVA)
452OMAP3_HAS_FEATURE(neon, NEON)
453OMAP3_HAS_FEATURE(isp, ISP)
454OMAP3_HAS_FEATURE(192mhz_clk, 192MHZ_CLK)
455OMAP3_HAS_FEATURE(io_wakeup, IO_WAKEUP)
456OMAP3_HAS_FEATURE(sdrc, SDRC)
457OMAP3_HAS_FEATURE(io_chain_ctrl, IO_CHAIN_CTRL)
458
459/*
460 * Runtime detection of OMAP4 features
461 */
462#define OMAP4_HAS_FEATURE(feat, flag) \
463static inline unsigned int omap4_has_ ##feat(void) \
464{ \
465 return omap_features & OMAP4_HAS_ ##flag; \
466} \
467
468OMAP4_HAS_FEATURE(mpu_1ghz, MPU_1GHZ)
469OMAP4_HAS_FEATURE(mpu_1_2ghz, MPU_1_2GHZ)
470OMAP4_HAS_FEATURE(mpu_1_5ghz, MPU_1_5GHZ)
471
472#endif /* __ASSEMBLY__ */
473
diff --git a/arch/arm/mach-omap2/sr_device.c b/arch/arm/mach-omap2/sr_device.c
index f8217a5a4a26..b0e77a407047 100644
--- a/arch/arm/mach-omap2/sr_device.c
+++ b/arch/arm/mach-omap2/sr_device.c
@@ -23,8 +23,8 @@
23#include <linux/slab.h> 23#include <linux/slab.h>
24#include <linux/io.h> 24#include <linux/io.h>
25 25
26#include <plat/omap_device.h> 26#include "soc.h"
27 27#include "omap_device.h"
28#include "voltage.h" 28#include "voltage.h"
29#include "control.h" 29#include "control.h"
30#include "pm.h" 30#include "pm.h"
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
index 44f9aa7ec0c0..45598ac819be 100644
--- a/arch/arm/mach-omap2/timer.c
+++ b/arch/arm/mach-omap2/timer.c
@@ -43,10 +43,10 @@
43#include <asm/sched_clock.h> 43#include <asm/sched_clock.h>
44 44
45#include <asm/arch_timer.h> 45#include <asm/arch_timer.h>
46#include <plat/omap_hwmod.h> 46#include "omap_hwmod.h"
47#include <plat/omap_device.h> 47#include "omap_device.h"
48#include <plat/dmtimer.h> 48#include <plat/dmtimer.h>
49#include <plat/omap-pm.h> 49#include "omap-pm.h"
50 50
51#include "soc.h" 51#include "soc.h"
52#include "common.h" 52#include "common.h"
diff --git a/arch/arm/mach-omap2/twl-common.c b/arch/arm/mach-omap2/twl-common.c
index 635e109f5ad3..1a0739d397f3 100644
--- a/arch/arm/mach-omap2/twl-common.c
+++ b/arch/arm/mach-omap2/twl-common.c
@@ -26,7 +26,6 @@
26#include <linux/regulator/machine.h> 26#include <linux/regulator/machine.h>
27#include <linux/regulator/fixed.h> 27#include <linux/regulator/fixed.h>
28 28
29#include <plat/i2c.h>
30#include <plat/usb.h> 29#include <plat/usb.h>
31 30
32#include "soc.h" 31#include "soc.h"
diff --git a/arch/arm/mach-omap2/usb-host.c b/arch/arm/mach-omap2/usb-host.c
index 3c434498e12e..4fe67129643d 100644
--- a/arch/arm/mach-omap2/usb-host.c
+++ b/arch/arm/mach-omap2/usb-host.c
@@ -26,7 +26,8 @@
26#include <asm/io.h> 26#include <asm/io.h>
27 27
28#include <plat/usb.h> 28#include <plat/usb.h>
29#include <plat/omap_device.h> 29#include "soc.h"
30#include "omap_device.h"
30 31
31#include "mux.h" 32#include "mux.h"
32 33
diff --git a/arch/arm/mach-omap2/usb-musb.c b/arch/arm/mach-omap2/usb-musb.c
index 51da21cb78f1..07f385a2900c 100644
--- a/arch/arm/mach-omap2/usb-musb.c
+++ b/arch/arm/mach-omap2/usb-musb.c
@@ -26,10 +26,9 @@
26#include <linux/usb/musb.h> 26#include <linux/usb/musb.h>
27 27
28#include <plat/usb.h> 28#include <plat/usb.h>
29#include <plat/omap_device.h> 29#include "omap_device.h"
30
31#include "am35xx.h"
32 30
31#include "soc.h"
33#include "mux.h" 32#include "mux.h"
34 33
35static struct musb_hdrc_config musb_config = { 34static struct musb_hdrc_config musb_config = {
diff --git a/arch/arm/mach-omap2/usb-tusb6010.c b/arch/arm/mach-omap2/usb-tusb6010.c
index 805bea6edf17..6064425ed47b 100644
--- a/arch/arm/mach-omap2/usb-tusb6010.c
+++ b/arch/arm/mach-omap2/usb-tusb6010.c
@@ -18,7 +18,7 @@
18 18
19#include <linux/usb/musb.h> 19#include <linux/usb/musb.h>
20 20
21#include <plat/gpmc.h> 21#include "gpmc.h"
22 22
23#include "mux.h" 23#include "mux.h"
24 24
diff --git a/arch/arm/mach-omap2/wd_timer.c b/arch/arm/mach-omap2/wd_timer.c
index b2f1c67043a2..f6b6c37ac3f4 100644
--- a/arch/arm/mach-omap2/wd_timer.c
+++ b/arch/arm/mach-omap2/wd_timer.c
@@ -11,7 +11,7 @@
11#include <linux/io.h> 11#include <linux/io.h>
12#include <linux/err.h> 12#include <linux/err.h>
13 13
14#include <plat/omap_hwmod.h> 14#include "omap_hwmod.h"
15 15
16#include "wd_timer.h" 16#include "wd_timer.h"
17#include "common.h" 17#include "common.h"
diff --git a/arch/arm/mach-omap2/wd_timer.h b/arch/arm/mach-omap2/wd_timer.h
index f6bbba73b535..a78f81034a9f 100644
--- a/arch/arm/mach-omap2/wd_timer.h
+++ b/arch/arm/mach-omap2/wd_timer.h
@@ -10,7 +10,7 @@
10#ifndef __ARCH_ARM_MACH_OMAP2_WD_TIMER_H 10#ifndef __ARCH_ARM_MACH_OMAP2_WD_TIMER_H
11#define __ARCH_ARM_MACH_OMAP2_WD_TIMER_H 11#define __ARCH_ARM_MACH_OMAP2_WD_TIMER_H
12 12
13#include <plat/omap_hwmod.h> 13#include "omap_hwmod.h"
14 14
15extern int omap2_wd_timer_disable(struct omap_hwmod *oh); 15extern int omap2_wd_timer_disable(struct omap_hwmod *oh);
16extern int omap2_wd_timer_reset(struct omap_hwmod *oh); 16extern int omap2_wd_timer_reset(struct omap_hwmod *oh);
diff --git a/arch/arm/plat-omap/Makefile b/arch/arm/plat-omap/Makefile
index dacaee009a4e..4bd0ace20e98 100644
--- a/arch/arm/plat-omap/Makefile
+++ b/arch/arm/plat-omap/Makefile
@@ -3,13 +3,12 @@
3# 3#
4 4
5# Common support 5# Common support
6obj-y := common.o sram.o clock.o dma.o fb.o counter_32k.o 6obj-y := common.o sram.o dma.o fb.o counter_32k.o
7obj-m := 7obj-m :=
8obj-n := 8obj-n :=
9obj- := 9obj- :=
10 10
11# omap_device support (OMAP2+ only at the moment) 11# omap_device support (OMAP2+ only at the moment)
12obj-$(CONFIG_ARCH_OMAP2PLUS) += omap_device.o
13 12
14obj-$(CONFIG_OMAP_DM_TIMER) += dmtimer.o 13obj-$(CONFIG_OMAP_DM_TIMER) += dmtimer.o
15obj-$(CONFIG_OMAP_DEBUG_DEVICES) += debug-devices.o 14obj-$(CONFIG_OMAP_DEBUG_DEVICES) += debug-devices.o
diff --git a/arch/arm/plat-omap/clock.c b/arch/arm/plat-omap/clock.c
deleted file mode 100644
index 9d7ac20ef8f9..000000000000
--- a/arch/arm/plat-omap/clock.c
+++ /dev/null
@@ -1,544 +0,0 @@
1/*
2 * linux/arch/arm/plat-omap/clock.c
3 *
4 * Copyright (C) 2004 - 2008 Nokia corporation
5 * Written by Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com>
6 *
7 * Modified for omap shared clock framework by Tony Lindgren <tony@atomide.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13#include <linux/kernel.h>
14#include <linux/init.h>
15#include <linux/list.h>
16#include <linux/errno.h>
17#include <linux/export.h>
18#include <linux/err.h>
19#include <linux/string.h>
20#include <linux/clk.h>
21#include <linux/mutex.h>
22#include <linux/cpufreq.h>
23#include <linux/io.h>
24
25#include <plat/clock.h>
26
27static LIST_HEAD(clocks);
28static DEFINE_MUTEX(clocks_mutex);
29static DEFINE_SPINLOCK(clockfw_lock);
30
31static struct clk_functions *arch_clock;
32
33/*
34 * Standard clock functions defined in include/linux/clk.h
35 */
36
37int clk_enable(struct clk *clk)
38{
39 unsigned long flags;
40 int ret;
41
42 if (clk == NULL || IS_ERR(clk))
43 return -EINVAL;
44
45 if (!arch_clock || !arch_clock->clk_enable)
46 return -EINVAL;
47
48 spin_lock_irqsave(&clockfw_lock, flags);
49 ret = arch_clock->clk_enable(clk);
50 spin_unlock_irqrestore(&clockfw_lock, flags);
51
52 return ret;
53}
54EXPORT_SYMBOL(clk_enable);
55
56void clk_disable(struct clk *clk)
57{
58 unsigned long flags;
59
60 if (clk == NULL || IS_ERR(clk))
61 return;
62
63 if (!arch_clock || !arch_clock->clk_disable)
64 return;
65
66 spin_lock_irqsave(&clockfw_lock, flags);
67 if (clk->usecount == 0) {
68 pr_err("Trying disable clock %s with 0 usecount\n",
69 clk->name);
70 WARN_ON(1);
71 goto out;
72 }
73
74 arch_clock->clk_disable(clk);
75
76out:
77 spin_unlock_irqrestore(&clockfw_lock, flags);
78}
79EXPORT_SYMBOL(clk_disable);
80
81unsigned long clk_get_rate(struct clk *clk)
82{
83 unsigned long flags;
84 unsigned long ret;
85
86 if (clk == NULL || IS_ERR(clk))
87 return 0;
88
89 spin_lock_irqsave(&clockfw_lock, flags);
90 ret = clk->rate;
91 spin_unlock_irqrestore(&clockfw_lock, flags);
92
93 return ret;
94}
95EXPORT_SYMBOL(clk_get_rate);
96
97/*
98 * Optional clock functions defined in include/linux/clk.h
99 */
100
101long clk_round_rate(struct clk *clk, unsigned long rate)
102{
103 unsigned long flags;
104 long ret;
105
106 if (clk == NULL || IS_ERR(clk))
107 return 0;
108
109 if (!arch_clock || !arch_clock->clk_round_rate)
110 return 0;
111
112 spin_lock_irqsave(&clockfw_lock, flags);
113 ret = arch_clock->clk_round_rate(clk, rate);
114 spin_unlock_irqrestore(&clockfw_lock, flags);
115
116 return ret;
117}
118EXPORT_SYMBOL(clk_round_rate);
119
120int clk_set_rate(struct clk *clk, unsigned long rate)
121{
122 unsigned long flags;
123 int ret = -EINVAL;
124
125 if (clk == NULL || IS_ERR(clk))
126 return ret;
127
128 if (!arch_clock || !arch_clock->clk_set_rate)
129 return ret;
130
131 spin_lock_irqsave(&clockfw_lock, flags);
132 ret = arch_clock->clk_set_rate(clk, rate);
133 if (ret == 0)
134 propagate_rate(clk);
135 spin_unlock_irqrestore(&clockfw_lock, flags);
136
137 return ret;
138}
139EXPORT_SYMBOL(clk_set_rate);
140
141int clk_set_parent(struct clk *clk, struct clk *parent)
142{
143 unsigned long flags;
144 int ret = -EINVAL;
145
146 if (clk == NULL || IS_ERR(clk) || parent == NULL || IS_ERR(parent))
147 return ret;
148
149 if (!arch_clock || !arch_clock->clk_set_parent)
150 return ret;
151
152 spin_lock_irqsave(&clockfw_lock, flags);
153 if (clk->usecount == 0) {
154 ret = arch_clock->clk_set_parent(clk, parent);
155 if (ret == 0)
156 propagate_rate(clk);
157 } else
158 ret = -EBUSY;
159 spin_unlock_irqrestore(&clockfw_lock, flags);
160
161 return ret;
162}
163EXPORT_SYMBOL(clk_set_parent);
164
165struct clk *clk_get_parent(struct clk *clk)
166{
167 return clk->parent;
168}
169EXPORT_SYMBOL(clk_get_parent);
170
171/*
172 * OMAP specific clock functions shared between omap1 and omap2
173 */
174
175int __initdata mpurate;
176
177/*
178 * By default we use the rate set by the bootloader.
179 * You can override this with mpurate= cmdline option.
180 */
181static int __init omap_clk_setup(char *str)
182{
183 get_option(&str, &mpurate);
184
185 if (!mpurate)
186 return 1;
187
188 if (mpurate < 1000)
189 mpurate *= 1000000;
190
191 return 1;
192}
193__setup("mpurate=", omap_clk_setup);
194
195/* Used for clocks that always have same value as the parent clock */
196unsigned long followparent_recalc(struct clk *clk)
197{
198 return clk->parent->rate;
199}
200
201/*
202 * Used for clocks that have the same value as the parent clock,
203 * divided by some factor
204 */
205unsigned long omap_fixed_divisor_recalc(struct clk *clk)
206{
207 WARN_ON(!clk->fixed_div);
208
209 return clk->parent->rate / clk->fixed_div;
210}
211
212void clk_reparent(struct clk *child, struct clk *parent)
213{
214 list_del_init(&child->sibling);
215 if (parent)
216 list_add(&child->sibling, &parent->children);
217 child->parent = parent;
218
219 /* now do the debugfs renaming to reattach the child
220 to the proper parent */
221}
222
223/* Propagate rate to children */
224void propagate_rate(struct clk *tclk)
225{
226 struct clk *clkp;
227
228 list_for_each_entry(clkp, &tclk->children, sibling) {
229 if (clkp->recalc)
230 clkp->rate = clkp->recalc(clkp);
231 propagate_rate(clkp);
232 }
233}
234
235static LIST_HEAD(root_clks);
236
237/**
238 * recalculate_root_clocks - recalculate and propagate all root clocks
239 *
240 * Recalculates all root clocks (clocks with no parent), which if the
241 * clock's .recalc is set correctly, should also propagate their rates.
242 * Called at init.
243 */
244void recalculate_root_clocks(void)
245{
246 struct clk *clkp;
247
248 list_for_each_entry(clkp, &root_clks, sibling) {
249 if (clkp->recalc)
250 clkp->rate = clkp->recalc(clkp);
251 propagate_rate(clkp);
252 }
253}
254
255/**
256 * clk_preinit - initialize any fields in the struct clk before clk init
257 * @clk: struct clk * to initialize
258 *
259 * Initialize any struct clk fields needed before normal clk initialization
260 * can run. No return value.
261 */
262void clk_preinit(struct clk *clk)
263{
264 INIT_LIST_HEAD(&clk->children);
265}
266
267int clk_register(struct clk *clk)
268{
269 if (clk == NULL || IS_ERR(clk))
270 return -EINVAL;
271
272 /*
273 * trap out already registered clocks
274 */
275 if (clk->node.next || clk->node.prev)
276 return 0;
277
278 mutex_lock(&clocks_mutex);
279 if (clk->parent)
280 list_add(&clk->sibling, &clk->parent->children);
281 else
282 list_add(&clk->sibling, &root_clks);
283
284 list_add(&clk->node, &clocks);
285 if (clk->init)
286 clk->init(clk);
287 mutex_unlock(&clocks_mutex);
288
289 return 0;
290}
291EXPORT_SYMBOL(clk_register);
292
293void clk_unregister(struct clk *clk)
294{
295 if (clk == NULL || IS_ERR(clk))
296 return;
297
298 mutex_lock(&clocks_mutex);
299 list_del(&clk->sibling);
300 list_del(&clk->node);
301 mutex_unlock(&clocks_mutex);
302}
303EXPORT_SYMBOL(clk_unregister);
304
305void clk_enable_init_clocks(void)
306{
307 struct clk *clkp;
308
309 list_for_each_entry(clkp, &clocks, node) {
310 if (clkp->flags & ENABLE_ON_INIT)
311 clk_enable(clkp);
312 }
313}
314
315int omap_clk_enable_autoidle_all(void)
316{
317 struct clk *c;
318 unsigned long flags;
319
320 spin_lock_irqsave(&clockfw_lock, flags);
321
322 list_for_each_entry(c, &clocks, node)
323 if (c->ops->allow_idle)
324 c->ops->allow_idle(c);
325
326 spin_unlock_irqrestore(&clockfw_lock, flags);
327
328 return 0;
329}
330
331int omap_clk_disable_autoidle_all(void)
332{
333 struct clk *c;
334 unsigned long flags;
335
336 spin_lock_irqsave(&clockfw_lock, flags);
337
338 list_for_each_entry(c, &clocks, node)
339 if (c->ops->deny_idle)
340 c->ops->deny_idle(c);
341
342 spin_unlock_irqrestore(&clockfw_lock, flags);
343
344 return 0;
345}
346
347/*
348 * Low level helpers
349 */
350static int clkll_enable_null(struct clk *clk)
351{
352 return 0;
353}
354
355static void clkll_disable_null(struct clk *clk)
356{
357}
358
359const struct clkops clkops_null = {
360 .enable = clkll_enable_null,
361 .disable = clkll_disable_null,
362};
363
364/*
365 * Dummy clock
366 *
367 * Used for clock aliases that are needed on some OMAPs, but not others
368 */
369struct clk dummy_ck = {
370 .name = "dummy",
371 .ops = &clkops_null,
372};
373
374/*
375 *
376 */
377
378#ifdef CONFIG_OMAP_RESET_CLOCKS
379/*
380 * Disable any unused clocks left on by the bootloader
381 */
382static int __init clk_disable_unused(void)
383{
384 struct clk *ck;
385 unsigned long flags;
386
387 if (!arch_clock || !arch_clock->clk_disable_unused)
388 return 0;
389
390 pr_info("clock: disabling unused clocks to save power\n");
391
392 spin_lock_irqsave(&clockfw_lock, flags);
393 list_for_each_entry(ck, &clocks, node) {
394 if (ck->ops == &clkops_null)
395 continue;
396
397 if (ck->usecount > 0 || !ck->enable_reg)
398 continue;
399
400 arch_clock->clk_disable_unused(ck);
401 }
402 spin_unlock_irqrestore(&clockfw_lock, flags);
403
404 return 0;
405}
406late_initcall(clk_disable_unused);
407late_initcall(omap_clk_enable_autoidle_all);
408#endif
409
410int __init clk_init(struct clk_functions * custom_clocks)
411{
412 if (!custom_clocks) {
413 pr_err("No custom clock functions registered\n");
414 BUG();
415 }
416
417 arch_clock = custom_clocks;
418
419 return 0;
420}
421
422#if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS)
423/*
424 * debugfs support to trace clock tree hierarchy and attributes
425 */
426
427#include <linux/debugfs.h>
428#include <linux/seq_file.h>
429
430static struct dentry *clk_debugfs_root;
431
432static int clk_dbg_show_summary(struct seq_file *s, void *unused)
433{
434 struct clk *c;
435 struct clk *pa;
436
437 mutex_lock(&clocks_mutex);
438 seq_printf(s, "%-30s %-30s %-10s %s\n",
439 "clock-name", "parent-name", "rate", "use-count");
440
441 list_for_each_entry(c, &clocks, node) {
442 pa = c->parent;
443 seq_printf(s, "%-30s %-30s %-10lu %d\n",
444 c->name, pa ? pa->name : "none", c->rate, c->usecount);
445 }
446 mutex_unlock(&clocks_mutex);
447
448 return 0;
449}
450
451static int clk_dbg_open(struct inode *inode, struct file *file)
452{
453 return single_open(file, clk_dbg_show_summary, inode->i_private);
454}
455
456static const struct file_operations debug_clock_fops = {
457 .open = clk_dbg_open,
458 .read = seq_read,
459 .llseek = seq_lseek,
460 .release = single_release,
461};
462
463static int clk_debugfs_register_one(struct clk *c)
464{
465 int err;
466 struct dentry *d;
467 struct clk *pa = c->parent;
468
469 d = debugfs_create_dir(c->name, pa ? pa->dent : clk_debugfs_root);
470 if (!d)
471 return -ENOMEM;
472 c->dent = d;
473
474 d = debugfs_create_u8("usecount", S_IRUGO, c->dent, (u8 *)&c->usecount);
475 if (!d) {
476 err = -ENOMEM;
477 goto err_out;
478 }
479 d = debugfs_create_u32("rate", S_IRUGO, c->dent, (u32 *)&c->rate);
480 if (!d) {
481 err = -ENOMEM;
482 goto err_out;
483 }
484 d = debugfs_create_x32("flags", S_IRUGO, c->dent, (u32 *)&c->flags);
485 if (!d) {
486 err = -ENOMEM;
487 goto err_out;
488 }
489 return 0;
490
491err_out:
492 debugfs_remove_recursive(c->dent);
493 return err;
494}
495
496static int clk_debugfs_register(struct clk *c)
497{
498 int err;
499 struct clk *pa = c->parent;
500
501 if (pa && !pa->dent) {
502 err = clk_debugfs_register(pa);
503 if (err)
504 return err;
505 }
506
507 if (!c->dent) {
508 err = clk_debugfs_register_one(c);
509 if (err)
510 return err;
511 }
512 return 0;
513}
514
515static int __init clk_debugfs_init(void)
516{
517 struct clk *c;
518 struct dentry *d;
519 int err;
520
521 d = debugfs_create_dir("clock", NULL);
522 if (!d)
523 return -ENOMEM;
524 clk_debugfs_root = d;
525
526 list_for_each_entry(c, &clocks, node) {
527 err = clk_debugfs_register(c);
528 if (err)
529 goto err_out;
530 }
531
532 d = debugfs_create_file("summary", S_IRUGO,
533 d, NULL, &debug_clock_fops);
534 if (!d)
535 return -ENOMEM;
536
537 return 0;
538err_out:
539 debugfs_remove_recursive(clk_debugfs_root);
540 return err;
541}
542late_initcall(clk_debugfs_init);
543
544#endif /* defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS) */
diff --git a/arch/arm/plat-omap/common.c b/arch/arm/plat-omap/common.c
index 111315a69354..a1555e028123 100644
--- a/arch/arm/plat-omap/common.c
+++ b/arch/arm/plat-omap/common.c
@@ -16,20 +16,8 @@
16#include <linux/io.h> 16#include <linux/io.h>
17#include <linux/dma-mapping.h> 17#include <linux/dma-mapping.h>
18 18
19#include <plat/common.h> 19#include "common.h"
20#include <plat/vram.h> 20#include <plat-omap/dma-omap.h>
21#include <linux/platform_data/dsp-omap.h>
22#include <plat/dma.h>
23
24#include <plat/omap-secure.h>
25
26void __init omap_reserve(void)
27{
28 omap_vram_reserve_sdram_memblock();
29 omap_dsp_reserve_sdram_memblock();
30 omap_secure_ram_reserve_memblock();
31 omap_barrier_reserve_memblock();
32}
33 21
34void __init omap_init_consistent_dma_size(void) 22void __init omap_init_consistent_dma_size(void)
35{ 23{
@@ -37,12 +25,3 @@ void __init omap_init_consistent_dma_size(void)
37 init_consistent_dma_size(CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE << 20); 25 init_consistent_dma_size(CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE << 20);
38#endif 26#endif
39} 27}
40
41/*
42 * Stub function for OMAP2 so that common files
43 * continue to build when custom builds are used
44 */
45int __weak omap_secure_ram_reserve_memblock(void)
46{
47 return 0;
48}
diff --git a/arch/arm/plat-omap/include/plat/common.h b/arch/arm/plat-omap/common.h
index d1cb6f527b7e..8ae0542a37d9 100644
--- a/arch/arm/plat-omap/include/plat/common.h
+++ b/arch/arm/plat-omap/common.h
@@ -1,7 +1,5 @@
1/* 1/*
2 * arch/arm/plat-omap/include/mach/common.h 2 * Header for shared OMAP code in plat-omap.
3 *
4 * Header for code common to all OMAP machines.
5 * 3 *
6 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the 5 * under the terms of the GNU General Public License as published by the
@@ -27,16 +25,12 @@
27#ifndef __ARCH_ARM_MACH_OMAP_COMMON_H 25#ifndef __ARCH_ARM_MACH_OMAP_COMMON_H
28#define __ARCH_ARM_MACH_OMAP_COMMON_H 26#define __ARCH_ARM_MACH_OMAP_COMMON_H
29 27
30#include <plat/i2c.h>
31#include <plat/omap_hwmod.h>
32
33extern int __init omap_init_clocksource_32k(void __iomem *vbase); 28extern int __init omap_init_clocksource_32k(void __iomem *vbase);
34 29
35extern void __init omap_check_revision(void); 30extern void __init omap_check_revision(void);
36 31
37extern void omap_reserve(void); 32extern void omap_reserve(void);
33struct omap_hwmod;
38extern int omap_dss_reset(struct omap_hwmod *); 34extern int omap_dss_reset(struct omap_hwmod *);
39 35
40void omap_sram_init(void);
41
42#endif /* __ARCH_ARM_MACH_OMAP_COMMON_H */ 36#endif /* __ARCH_ARM_MACH_OMAP_COMMON_H */
diff --git a/arch/arm/plat-omap/counter_32k.c b/arch/arm/plat-omap/counter_32k.c
index 87ba8dd0d791..66bf3f9324fe 100644
--- a/arch/arm/plat-omap/counter_32k.c
+++ b/arch/arm/plat-omap/counter_32k.c
@@ -22,8 +22,7 @@
22#include <asm/mach/time.h> 22#include <asm/mach/time.h>
23#include <asm/sched_clock.h> 23#include <asm/sched_clock.h>
24 24
25#include <plat/common.h> 25#include "common.h"
26#include <plat/clock.h>
27 26
28/* OMAP2_32KSYNCNT_CR_OFF: offset of 32ksync counter register */ 27/* OMAP2_32KSYNCNT_CR_OFF: offset of 32ksync counter register */
29#define OMAP2_32KSYNCNT_REV_OFF 0x0 28#define OMAP2_32KSYNCNT_REV_OFF 0x0
diff --git a/arch/arm/plat-omap/debug-leds.c b/arch/arm/plat-omap/debug-leds.c
index ea29bbe8e5cf..feca128bc8ed 100644
--- a/arch/arm/plat-omap/debug-leds.c
+++ b/arch/arm/plat-omap/debug-leds.c
@@ -20,7 +20,7 @@
20#include <mach/hardware.h> 20#include <mach/hardware.h>
21#include <asm/mach-types.h> 21#include <asm/mach-types.h>
22 22
23#include <plat/fpga.h> 23#include "fpga.h"
24 24
25/* Many OMAP development platforms reuse the same "debug board"; these 25/* Many OMAP development platforms reuse the same "debug board"; these
26 * platforms include H2, H3, H4, and Perseus2. There are 16 LEDs on the 26 * platforms include H2, H3, H4, and Perseus2. There are 16 LEDs on the
diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c
index c76ed8bff838..49803cc18787 100644
--- a/arch/arm/plat-omap/dma.c
+++ b/arch/arm/plat-omap/dma.c
@@ -36,9 +36,10 @@
36#include <linux/slab.h> 36#include <linux/slab.h>
37#include <linux/delay.h> 37#include <linux/delay.h>
38 38
39#include <plat/cpu.h> 39#include <plat-omap/dma-omap.h>
40#include <plat/dma.h> 40
41#include <plat/tc.h> 41#include "../mach-omap1/soc.h"
42#include "../mach-omap2/soc.h"
42 43
43/* 44/*
44 * MAX_LOGICAL_DMA_CH_COUNT: the maximum number of logical DMA 45 * MAX_LOGICAL_DMA_CH_COUNT: the maximum number of logical DMA
@@ -175,6 +176,7 @@ static inline void set_gdma_dev(int req, int dev)
175#define omap_writel(val, reg) do {} while (0) 176#define omap_writel(val, reg) do {} while (0)
176#endif 177#endif
177 178
179#ifdef CONFIG_ARCH_OMAP1
178void omap_set_dma_priority(int lch, int dst_port, int priority) 180void omap_set_dma_priority(int lch, int dst_port, int priority)
179{ 181{
180 unsigned long reg; 182 unsigned long reg;
@@ -203,18 +205,22 @@ void omap_set_dma_priority(int lch, int dst_port, int priority)
203 l |= (priority & 0xf) << 8; 205 l |= (priority & 0xf) << 8;
204 omap_writel(l, reg); 206 omap_writel(l, reg);
205 } 207 }
208}
209#endif
206 210
207 if (cpu_class_is_omap2()) { 211#ifdef CONFIG_ARCH_OMAP2PLUS
208 u32 ccr; 212void omap_set_dma_priority(int lch, int dst_port, int priority)
213{
214 u32 ccr;
209 215
210 ccr = p->dma_read(CCR, lch); 216 ccr = p->dma_read(CCR, lch);
211 if (priority) 217 if (priority)
212 ccr |= (1 << 6); 218 ccr |= (1 << 6);
213 else 219 else
214 ccr &= ~(1 << 6); 220 ccr &= ~(1 << 6);
215 p->dma_write(ccr, CCR, lch); 221 p->dma_write(ccr, CCR, lch);
216 }
217} 222}
223#endif
218EXPORT_SYMBOL(omap_set_dma_priority); 224EXPORT_SYMBOL(omap_set_dma_priority);
219 225
220void omap_set_dma_transfer_params(int lch, int data_type, int elem_count, 226void omap_set_dma_transfer_params(int lch, int data_type, int elem_count,
diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
index 938b50a33439..4a0b30a4ebda 100644
--- a/arch/arm/plat-omap/dmtimer.c
+++ b/arch/arm/plat-omap/dmtimer.c
@@ -42,10 +42,11 @@
42#include <linux/pm_runtime.h> 42#include <linux/pm_runtime.h>
43 43
44#include <plat/dmtimer.h> 44#include <plat/dmtimer.h>
45#include <plat/omap-pm.h>
46 45
47#include <mach/hardware.h> 46#include <mach/hardware.h>
48 47
48#include "../mach-omap2/omap-pm.h"
49
49static u32 omap_reserved_systimers; 50static u32 omap_reserved_systimers;
50static LIST_HEAD(omap_timer_list); 51static LIST_HEAD(omap_timer_list);
51static DEFINE_SPINLOCK(dm_timer_lock); 52static DEFINE_SPINLOCK(dm_timer_lock);
diff --git a/arch/arm/plat-omap/fb.c b/arch/arm/plat-omap/fb.c
index bcbb9d5dc293..f868caeedfd6 100644
--- a/arch/arm/plat-omap/fb.c
+++ b/arch/arm/plat-omap/fb.c
@@ -33,6 +33,67 @@
33#include <mach/hardware.h> 33#include <mach/hardware.h>
34#include <asm/mach/map.h> 34#include <asm/mach/map.h>
35 35
36#include <plat/cpu.h>
37
38#ifdef CONFIG_OMAP2_VRFB
39
40/*
41 * The first memory resource is the register region for VRFB,
42 * the rest are VRFB virtual memory areas for each VRFB context.
43 */
44
45static const struct resource omap2_vrfb_resources[] = {
46 DEFINE_RES_MEM_NAMED(0x68008000u, 0x40, "vrfb-regs"),
47 DEFINE_RES_MEM_NAMED(0x70000000u, 0x4000000, "vrfb-area-0"),
48 DEFINE_RES_MEM_NAMED(0x74000000u, 0x4000000, "vrfb-area-1"),
49 DEFINE_RES_MEM_NAMED(0x78000000u, 0x4000000, "vrfb-area-2"),
50 DEFINE_RES_MEM_NAMED(0x7c000000u, 0x4000000, "vrfb-area-3"),
51};
52
53static const struct resource omap3_vrfb_resources[] = {
54 DEFINE_RES_MEM_NAMED(0x6C000180u, 0xc0, "vrfb-regs"),
55 DEFINE_RES_MEM_NAMED(0x70000000u, 0x4000000, "vrfb-area-0"),
56 DEFINE_RES_MEM_NAMED(0x74000000u, 0x4000000, "vrfb-area-1"),
57 DEFINE_RES_MEM_NAMED(0x78000000u, 0x4000000, "vrfb-area-2"),
58 DEFINE_RES_MEM_NAMED(0x7c000000u, 0x4000000, "vrfb-area-3"),
59 DEFINE_RES_MEM_NAMED(0xe0000000u, 0x4000000, "vrfb-area-4"),
60 DEFINE_RES_MEM_NAMED(0xe4000000u, 0x4000000, "vrfb-area-5"),
61 DEFINE_RES_MEM_NAMED(0xe8000000u, 0x4000000, "vrfb-area-6"),
62 DEFINE_RES_MEM_NAMED(0xec000000u, 0x4000000, "vrfb-area-7"),
63 DEFINE_RES_MEM_NAMED(0xf0000000u, 0x4000000, "vrfb-area-8"),
64 DEFINE_RES_MEM_NAMED(0xf4000000u, 0x4000000, "vrfb-area-9"),
65 DEFINE_RES_MEM_NAMED(0xf8000000u, 0x4000000, "vrfb-area-10"),
66 DEFINE_RES_MEM_NAMED(0xfc000000u, 0x4000000, "vrfb-area-11"),
67};
68
69static int __init omap_init_vrfb(void)
70{
71 struct platform_device *pdev;
72 const struct resource *res;
73 unsigned int num_res;
74
75 if (cpu_is_omap24xx()) {
76 res = omap2_vrfb_resources;
77 num_res = ARRAY_SIZE(omap2_vrfb_resources);
78 } else if (cpu_is_omap34xx()) {
79 res = omap3_vrfb_resources;
80 num_res = ARRAY_SIZE(omap3_vrfb_resources);
81 } else {
82 return 0;
83 }
84
85 pdev = platform_device_register_resndata(NULL, "omapvrfb", -1,
86 res, num_res, NULL, 0);
87
88 if (IS_ERR(pdev))
89 return PTR_ERR(pdev);
90 else
91 return 0;
92}
93
94arch_initcall(omap_init_vrfb);
95#endif
96
36#if defined(CONFIG_FB_OMAP) || defined(CONFIG_FB_OMAP_MODULE) 97#if defined(CONFIG_FB_OMAP) || defined(CONFIG_FB_OMAP_MODULE)
37 98
38static bool omapfb_lcd_configured; 99static bool omapfb_lcd_configured;
diff --git a/arch/arm/plat-omap/fpga.h b/arch/arm/plat-omap/fpga.h
new file mode 100644
index 000000000000..54faaa93e6f4
--- /dev/null
+++ b/arch/arm/plat-omap/fpga.h
@@ -0,0 +1,74 @@
1/*
2 * arch/arm/plat-omap/include/mach/fpga.h
3 *
4 * Interrupt handler for OMAP-1510 FPGA
5 *
6 * Copyright (C) 2001 RidgeRun, Inc.
7 * Author: Greg Lonnon <glonnon@ridgerun.com>
8 *
9 * Copyright (C) 2002 MontaVista Software, Inc.
10 *
11 * Separated FPGA interrupts from innovator1510.c and cleaned up for 2.6
12 * Copyright (C) 2004 Nokia Corporation by Tony Lindrgen <tony@atomide.com>
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License version 2 as
16 * published by the Free Software Foundation.
17 */
18
19#ifndef __ASM_ARCH_OMAP_FPGA_H
20#define __ASM_ARCH_OMAP_FPGA_H
21
22/*
23 * ---------------------------------------------------------------------------
24 * H2/P2 Debug board FPGA
25 * ---------------------------------------------------------------------------
26 */
27/* maps in the FPGA registers and the ETHR registers */
28#define H2P2_DBG_FPGA_BASE 0xE8000000 /* VA */
29#define H2P2_DBG_FPGA_SIZE SZ_4K /* SIZE */
30#define H2P2_DBG_FPGA_START 0x04000000 /* PA */
31
32#define H2P2_DBG_FPGA_ETHR_START (H2P2_DBG_FPGA_START + 0x300)
33#define H2P2_DBG_FPGA_FPGA_REV IOMEM(H2P2_DBG_FPGA_BASE + 0x10) /* FPGA Revision */
34#define H2P2_DBG_FPGA_BOARD_REV IOMEM(H2P2_DBG_FPGA_BASE + 0x12) /* Board Revision */
35#define H2P2_DBG_FPGA_GPIO IOMEM(H2P2_DBG_FPGA_BASE + 0x14) /* GPIO outputs */
36#define H2P2_DBG_FPGA_LEDS IOMEM(H2P2_DBG_FPGA_BASE + 0x16) /* LEDs outputs */
37#define H2P2_DBG_FPGA_MISC_INPUTS IOMEM(H2P2_DBG_FPGA_BASE + 0x18) /* Misc inputs */
38#define H2P2_DBG_FPGA_LAN_STATUS IOMEM(H2P2_DBG_FPGA_BASE + 0x1A) /* LAN Status line */
39#define H2P2_DBG_FPGA_LAN_RESET IOMEM(H2P2_DBG_FPGA_BASE + 0x1C) /* LAN Reset line */
40
41/* NOTE: most boards don't have a static mapping for the FPGA ... */
42struct h2p2_dbg_fpga {
43 /* offset 0x00 */
44 u16 smc91x[8];
45 /* offset 0x10 */
46 u16 fpga_rev;
47 u16 board_rev;
48 u16 gpio_outputs;
49 u16 leds;
50 /* offset 0x18 */
51 u16 misc_inputs;
52 u16 lan_status;
53 u16 lan_reset;
54 u16 reserved0;
55 /* offset 0x20 */
56 u16 ps2_data;
57 u16 ps2_ctrl;
58 /* plus also 4 rs232 ports ... */
59};
60
61/* LEDs definition on debug board (16 LEDs, all physically green) */
62#define H2P2_DBG_FPGA_LED_GREEN (1 << 15)
63#define H2P2_DBG_FPGA_LED_AMBER (1 << 14)
64#define H2P2_DBG_FPGA_LED_RED (1 << 13)
65#define H2P2_DBG_FPGA_LED_BLUE (1 << 12)
66/* cpu0 load-meter LEDs */
67#define H2P2_DBG_FPGA_LOAD_METER (1 << 0) // A bit of fun on our board ...
68#define H2P2_DBG_FPGA_LOAD_METER_SIZE 11
69#define H2P2_DBG_FPGA_LOAD_METER_MASK ((1 << H2P2_DBG_FPGA_LOAD_METER_SIZE) - 1)
70
71#define H2P2_DBG_FPGA_P2_LED_TIMER (1 << 0)
72#define H2P2_DBG_FPGA_P2_LED_IDLE (1 << 1)
73
74#endif
diff --git a/arch/arm/plat-omap/i2c.c b/arch/arm/plat-omap/i2c.c
index a5683a84c6ee..be6deb7c12ec 100644
--- a/arch/arm/plat-omap/i2c.c
+++ b/arch/arm/plat-omap/i2c.c
@@ -26,52 +26,20 @@
26#include <linux/kernel.h> 26#include <linux/kernel.h>
27#include <linux/platform_device.h> 27#include <linux/platform_device.h>
28#include <linux/i2c.h> 28#include <linux/i2c.h>
29#include <linux/i2c-omap.h>
29#include <linux/slab.h> 30#include <linux/slab.h>
30#include <linux/err.h> 31#include <linux/err.h>
31#include <linux/clk.h> 32#include <linux/clk.h>
32 33
33#include <mach/irqs.h> 34#include <mach/irqs.h>
34#include <plat/i2c.h>
35#include <plat/omap_device.h>
36 35
37#define OMAP_I2C_SIZE 0x3f 36#include "../mach-omap1/soc.h"
38#define OMAP1_I2C_BASE 0xfffb3800 37#include "../mach-omap2/soc.h"
39#define OMAP1_INT_I2C (32 + 4)
40 38
41static const char name[] = "omap_i2c"; 39#include "i2c.h"
42 40
43#define I2C_RESOURCE_BUILDER(base, irq) \
44 { \
45 .start = (base), \
46 .end = (base) + OMAP_I2C_SIZE, \
47 .flags = IORESOURCE_MEM, \
48 }, \
49 { \
50 .start = (irq), \
51 .flags = IORESOURCE_IRQ, \
52 },
53
54static struct resource i2c_resources[][2] = {
55 { I2C_RESOURCE_BUILDER(0, 0) },
56};
57
58#define I2C_DEV_BUILDER(bus_id, res, data) \
59 { \
60 .id = (bus_id), \
61 .name = name, \
62 .num_resources = ARRAY_SIZE(res), \
63 .resource = (res), \
64 .dev = { \
65 .platform_data = (data), \
66 }, \
67 }
68
69#define MAX_OMAP_I2C_HWMOD_NAME_LEN 16
70#define OMAP_I2C_MAX_CONTROLLERS 4 41#define OMAP_I2C_MAX_CONTROLLERS 4
71static struct omap_i2c_bus_platform_data i2c_pdata[OMAP_I2C_MAX_CONTROLLERS]; 42static struct omap_i2c_bus_platform_data i2c_pdata[OMAP_I2C_MAX_CONTROLLERS];
72static struct platform_device omap_i2c_devices[] = {
73 I2C_DEV_BUILDER(1, i2c_resources[0], &i2c_pdata[0]),
74};
75 43
76#define OMAP_I2C_CMDLINE_SETUP (BIT(31)) 44#define OMAP_I2C_CMDLINE_SETUP (BIT(31))
77 45
@@ -91,95 +59,6 @@ static int __init omap_i2c_nr_ports(void)
91 return ports; 59 return ports;
92} 60}
93 61
94static inline int omap1_i2c_add_bus(int bus_id)
95{
96 struct platform_device *pdev;
97 struct omap_i2c_bus_platform_data *pdata;
98 struct resource *res;
99
100 omap1_i2c_mux_pins(bus_id);
101
102 pdev = &omap_i2c_devices[bus_id - 1];
103 res = pdev->resource;
104 res[0].start = OMAP1_I2C_BASE;
105 res[0].end = res[0].start + OMAP_I2C_SIZE;
106 res[1].start = OMAP1_INT_I2C;
107 pdata = &i2c_pdata[bus_id - 1];
108
109 /* all OMAP1 have IP version 1 register set */
110 pdata->rev = OMAP_I2C_IP_VERSION_1;
111
112 /* all OMAP1 I2C are implemented like this */
113 pdata->flags = OMAP_I2C_FLAG_NO_FIFO |
114 OMAP_I2C_FLAG_SIMPLE_CLOCK |
115 OMAP_I2C_FLAG_16BIT_DATA_REG |
116 OMAP_I2C_FLAG_ALWAYS_ARMXOR_CLK;
117
118 /* how the cpu bus is wired up differs for 7xx only */
119
120 if (cpu_is_omap7xx())
121 pdata->flags |= OMAP_I2C_FLAG_BUS_SHIFT_1;
122 else
123 pdata->flags |= OMAP_I2C_FLAG_BUS_SHIFT_2;
124
125 return platform_device_register(pdev);
126}
127
128
129#ifdef CONFIG_ARCH_OMAP2PLUS
130static inline int omap2_i2c_add_bus(int bus_id)
131{
132 int l;
133 struct omap_hwmod *oh;
134 struct platform_device *pdev;
135 char oh_name[MAX_OMAP_I2C_HWMOD_NAME_LEN];
136 struct omap_i2c_bus_platform_data *pdata;
137 struct omap_i2c_dev_attr *dev_attr;
138
139 omap2_i2c_mux_pins(bus_id);
140
141 l = snprintf(oh_name, MAX_OMAP_I2C_HWMOD_NAME_LEN, "i2c%d", bus_id);
142 WARN(l >= MAX_OMAP_I2C_HWMOD_NAME_LEN,
143 "String buffer overflow in I2C%d device setup\n", bus_id);
144 oh = omap_hwmod_lookup(oh_name);
145 if (!oh) {
146 pr_err("Could not look up %s\n", oh_name);
147 return -EEXIST;
148 }
149
150 pdata = &i2c_pdata[bus_id - 1];
151 /*
152 * pass the hwmod class's CPU-specific knowledge of I2C IP revision in
153 * use, and functionality implementation flags, up to the OMAP I2C
154 * driver via platform data
155 */
156 pdata->rev = oh->class->rev;
157
158 dev_attr = (struct omap_i2c_dev_attr *)oh->dev_attr;
159 pdata->flags = dev_attr->flags;
160
161 pdev = omap_device_build(name, bus_id, oh, pdata,
162 sizeof(struct omap_i2c_bus_platform_data),
163 NULL, 0, 0);
164 WARN(IS_ERR(pdev), "Could not build omap_device for %s\n", name);
165
166 return PTR_RET(pdev);
167}
168#else
169static inline int omap2_i2c_add_bus(int bus_id)
170{
171 return 0;
172}
173#endif
174
175static int __init omap_i2c_add_bus(int bus_id)
176{
177 if (cpu_class_is_omap1())
178 return omap1_i2c_add_bus(bus_id);
179 else
180 return omap2_i2c_add_bus(bus_id);
181}
182
183/** 62/**
184 * omap_i2c_bus_setup - Process command line options for the I2C bus speed 63 * omap_i2c_bus_setup - Process command line options for the I2C bus speed
185 * @str: String of options 64 * @str: String of options
@@ -218,7 +97,7 @@ static int __init omap_register_i2c_bus_cmdline(void)
218 for (i = 0; i < ARRAY_SIZE(i2c_pdata); i++) 97 for (i = 0; i < ARRAY_SIZE(i2c_pdata); i++)
219 if (i2c_pdata[i].clkrate & OMAP_I2C_CMDLINE_SETUP) { 98 if (i2c_pdata[i].clkrate & OMAP_I2C_CMDLINE_SETUP) {
220 i2c_pdata[i].clkrate &= ~OMAP_I2C_CMDLINE_SETUP; 99 i2c_pdata[i].clkrate &= ~OMAP_I2C_CMDLINE_SETUP;
221 err = omap_i2c_add_bus(i + 1); 100 err = omap_i2c_add_bus(&i2c_pdata[i], i + 1);
222 if (err) 101 if (err)
223 goto out; 102 goto out;
224 } 103 }
@@ -256,5 +135,5 @@ int __init omap_register_i2c_bus(int bus_id, u32 clkrate,
256 135
257 i2c_pdata[bus_id - 1].clkrate &= ~OMAP_I2C_CMDLINE_SETUP; 136 i2c_pdata[bus_id - 1].clkrate &= ~OMAP_I2C_CMDLINE_SETUP;
258 137
259 return omap_i2c_add_bus(bus_id); 138 return omap_i2c_add_bus(&i2c_pdata[bus_id - 1], bus_id);
260} 139}
diff --git a/arch/arm/plat-omap/i2c.h b/arch/arm/plat-omap/i2c.h
new file mode 100644
index 000000000000..7a9028cb5a75
--- /dev/null
+++ b/arch/arm/plat-omap/i2c.h
@@ -0,0 +1,47 @@
1/*
2 * Helper module for board specific I2C bus registration
3 *
4 * Copyright (C) 2009 Nokia Corporation.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * version 2 as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18 * 02110-1301 USA
19 *
20 */
21
22#ifndef __PLAT_OMAP_I2C_H
23#define __PLAT_OMAP_I2C_H
24
25struct i2c_board_info;
26struct omap_i2c_bus_platform_data;
27
28int omap_i2c_add_bus(struct omap_i2c_bus_platform_data *i2c_pdata,
29 int bus_id);
30
31#if defined(CONFIG_I2C_OMAP) || defined(CONFIG_I2C_OMAP_MODULE)
32extern int omap_register_i2c_bus(int bus_id, u32 clkrate,
33 struct i2c_board_info const *info,
34 unsigned len);
35#else
36static inline int omap_register_i2c_bus(int bus_id, u32 clkrate,
37 struct i2c_board_info const *info,
38 unsigned len)
39{
40 return 0;
41}
42#endif
43
44struct omap_hwmod;
45int omap_i2c_reset(struct omap_hwmod *oh);
46
47#endif /* __PLAT_OMAP_I2C_H */
diff --git a/arch/arm/plat-omap/include/plat/dma.h b/arch/arm/plat-omap/include/plat-omap/dma-omap.h
index 0a87b052f8f7..222be7e934e5 100644
--- a/arch/arm/plat-omap/include/plat/dma.h
+++ b/arch/arm/plat-omap/include/plat-omap/dma-omap.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * arch/arm/plat-omap/include/mach/dma.h 2 * OMAP DMA handling defines and function
3 * 3 *
4 * Copyright (C) 2003 Nokia Corporation 4 * Copyright (C) 2003 Nokia Corporation
5 * Author: Juha Yrjölä <juha.yrjola@nokia.com> 5 * Author: Juha Yrjölä <juha.yrjola@nokia.com>
@@ -23,187 +23,8 @@
23 23
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25 25
26/*
27 * TODO: These dma channel defines should go away once all
28 * the omap drivers hwmod adapted.
29 */
30
31/* Move omap4 specific defines to dma-44xx.h */
32#include "dma-44xx.h"
33
34#define INT_DMA_LCD 25 26#define INT_DMA_LCD 25
35 27
36/* DMA channels for omap1 */
37#define OMAP_DMA_NO_DEVICE 0
38#define OMAP_DMA_MCSI1_TX 1
39#define OMAP_DMA_MCSI1_RX 2
40#define OMAP_DMA_I2C_RX 3
41#define OMAP_DMA_I2C_TX 4
42#define OMAP_DMA_EXT_NDMA_REQ 5
43#define OMAP_DMA_EXT_NDMA_REQ2 6
44#define OMAP_DMA_UWIRE_TX 7
45#define OMAP_DMA_MCBSP1_TX 8
46#define OMAP_DMA_MCBSP1_RX 9
47#define OMAP_DMA_MCBSP3_TX 10
48#define OMAP_DMA_MCBSP3_RX 11
49#define OMAP_DMA_UART1_TX 12
50#define OMAP_DMA_UART1_RX 13
51#define OMAP_DMA_UART2_TX 14
52#define OMAP_DMA_UART2_RX 15
53#define OMAP_DMA_MCBSP2_TX 16
54#define OMAP_DMA_MCBSP2_RX 17
55#define OMAP_DMA_UART3_TX 18
56#define OMAP_DMA_UART3_RX 19
57#define OMAP_DMA_CAMERA_IF_RX 20
58#define OMAP_DMA_MMC_TX 21
59#define OMAP_DMA_MMC_RX 22
60#define OMAP_DMA_NAND 23
61#define OMAP_DMA_IRQ_LCD_LINE 24
62#define OMAP_DMA_MEMORY_STICK 25
63#define OMAP_DMA_USB_W2FC_RX0 26
64#define OMAP_DMA_USB_W2FC_RX1 27
65#define OMAP_DMA_USB_W2FC_RX2 28
66#define OMAP_DMA_USB_W2FC_TX0 29
67#define OMAP_DMA_USB_W2FC_TX1 30
68#define OMAP_DMA_USB_W2FC_TX2 31
69
70/* These are only for 1610 */
71#define OMAP_DMA_CRYPTO_DES_IN 32
72#define OMAP_DMA_SPI_TX 33
73#define OMAP_DMA_SPI_RX 34
74#define OMAP_DMA_CRYPTO_HASH 35
75#define OMAP_DMA_CCP_ATTN 36
76#define OMAP_DMA_CCP_FIFO_NOT_EMPTY 37
77#define OMAP_DMA_CMT_APE_TX_CHAN_0 38
78#define OMAP_DMA_CMT_APE_RV_CHAN_0 39
79#define OMAP_DMA_CMT_APE_TX_CHAN_1 40
80#define OMAP_DMA_CMT_APE_RV_CHAN_1 41
81#define OMAP_DMA_CMT_APE_TX_CHAN_2 42
82#define OMAP_DMA_CMT_APE_RV_CHAN_2 43
83#define OMAP_DMA_CMT_APE_TX_CHAN_3 44
84#define OMAP_DMA_CMT_APE_RV_CHAN_3 45
85#define OMAP_DMA_CMT_APE_TX_CHAN_4 46
86#define OMAP_DMA_CMT_APE_RV_CHAN_4 47
87#define OMAP_DMA_CMT_APE_TX_CHAN_5 48
88#define OMAP_DMA_CMT_APE_RV_CHAN_5 49
89#define OMAP_DMA_CMT_APE_TX_CHAN_6 50
90#define OMAP_DMA_CMT_APE_RV_CHAN_6 51
91#define OMAP_DMA_CMT_APE_TX_CHAN_7 52
92#define OMAP_DMA_CMT_APE_RV_CHAN_7 53
93#define OMAP_DMA_MMC2_TX 54
94#define OMAP_DMA_MMC2_RX 55
95#define OMAP_DMA_CRYPTO_DES_OUT 56
96
97/* DMA channels for 24xx */
98#define OMAP24XX_DMA_NO_DEVICE 0
99#define OMAP24XX_DMA_XTI_DMA 1 /* S_DMA_0 */
100#define OMAP24XX_DMA_EXT_DMAREQ0 2 /* S_DMA_1 */
101#define OMAP24XX_DMA_EXT_DMAREQ1 3 /* S_DMA_2 */
102#define OMAP24XX_DMA_GPMC 4 /* S_DMA_3 */
103#define OMAP24XX_DMA_GFX 5 /* S_DMA_4 */
104#define OMAP24XX_DMA_DSS 6 /* S_DMA_5 */
105#define OMAP242X_DMA_VLYNQ_TX 7 /* S_DMA_6 */
106#define OMAP24XX_DMA_EXT_DMAREQ2 7 /* S_DMA_6 */
107#define OMAP24XX_DMA_CWT 8 /* S_DMA_7 */
108#define OMAP24XX_DMA_AES_TX 9 /* S_DMA_8 */
109#define OMAP24XX_DMA_AES_RX 10 /* S_DMA_9 */
110#define OMAP24XX_DMA_DES_TX 11 /* S_DMA_10 */
111#define OMAP24XX_DMA_DES_RX 12 /* S_DMA_11 */
112#define OMAP24XX_DMA_SHA1MD5_RX 13 /* S_DMA_12 */
113#define OMAP34XX_DMA_SHA2MD5_RX 13 /* S_DMA_12 */
114#define OMAP242X_DMA_EXT_DMAREQ2 14 /* S_DMA_13 */
115#define OMAP242X_DMA_EXT_DMAREQ3 15 /* S_DMA_14 */
116#define OMAP242X_DMA_EXT_DMAREQ4 16 /* S_DMA_15 */
117#define OMAP242X_DMA_EAC_AC_RD 17 /* S_DMA_16 */
118#define OMAP242X_DMA_EAC_AC_WR 18 /* S_DMA_17 */
119#define OMAP242X_DMA_EAC_MD_UL_RD 19 /* S_DMA_18 */
120#define OMAP242X_DMA_EAC_MD_UL_WR 20 /* S_DMA_19 */
121#define OMAP242X_DMA_EAC_MD_DL_RD 21 /* S_DMA_20 */
122#define OMAP242X_DMA_EAC_MD_DL_WR 22 /* S_DMA_21 */
123#define OMAP242X_DMA_EAC_BT_UL_RD 23 /* S_DMA_22 */
124#define OMAP242X_DMA_EAC_BT_UL_WR 24 /* S_DMA_23 */
125#define OMAP242X_DMA_EAC_BT_DL_RD 25 /* S_DMA_24 */
126#define OMAP242X_DMA_EAC_BT_DL_WR 26 /* S_DMA_25 */
127#define OMAP243X_DMA_EXT_DMAREQ3 14 /* S_DMA_13 */
128#define OMAP24XX_DMA_SPI3_TX0 15 /* S_DMA_14 */
129#define OMAP24XX_DMA_SPI3_RX0 16 /* S_DMA_15 */
130#define OMAP24XX_DMA_MCBSP3_TX 17 /* S_DMA_16 */
131#define OMAP24XX_DMA_MCBSP3_RX 18 /* S_DMA_17 */
132#define OMAP24XX_DMA_MCBSP4_TX 19 /* S_DMA_18 */
133#define OMAP24XX_DMA_MCBSP4_RX 20 /* S_DMA_19 */
134#define OMAP24XX_DMA_MCBSP5_TX 21 /* S_DMA_20 */
135#define OMAP24XX_DMA_MCBSP5_RX 22 /* S_DMA_21 */
136#define OMAP24XX_DMA_SPI3_TX1 23 /* S_DMA_22 */
137#define OMAP24XX_DMA_SPI3_RX1 24 /* S_DMA_23 */
138#define OMAP243X_DMA_EXT_DMAREQ4 25 /* S_DMA_24 */
139#define OMAP243X_DMA_EXT_DMAREQ5 26 /* S_DMA_25 */
140#define OMAP34XX_DMA_I2C3_TX 25 /* S_DMA_24 */
141#define OMAP34XX_DMA_I2C3_RX 26 /* S_DMA_25 */
142#define OMAP24XX_DMA_I2C1_TX 27 /* S_DMA_26 */
143#define OMAP24XX_DMA_I2C1_RX 28 /* S_DMA_27 */
144#define OMAP24XX_DMA_I2C2_TX 29 /* S_DMA_28 */
145#define OMAP24XX_DMA_I2C2_RX 30 /* S_DMA_29 */
146#define OMAP24XX_DMA_MCBSP1_TX 31 /* S_DMA_30 */
147#define OMAP24XX_DMA_MCBSP1_RX 32 /* S_DMA_31 */
148#define OMAP24XX_DMA_MCBSP2_TX 33 /* S_DMA_32 */
149#define OMAP24XX_DMA_MCBSP2_RX 34 /* S_DMA_33 */
150#define OMAP24XX_DMA_SPI1_TX0 35 /* S_DMA_34 */
151#define OMAP24XX_DMA_SPI1_RX0 36 /* S_DMA_35 */
152#define OMAP24XX_DMA_SPI1_TX1 37 /* S_DMA_36 */
153#define OMAP24XX_DMA_SPI1_RX1 38 /* S_DMA_37 */
154#define OMAP24XX_DMA_SPI1_TX2 39 /* S_DMA_38 */
155#define OMAP24XX_DMA_SPI1_RX2 40 /* S_DMA_39 */
156#define OMAP24XX_DMA_SPI1_TX3 41 /* S_DMA_40 */
157#define OMAP24XX_DMA_SPI1_RX3 42 /* S_DMA_41 */
158#define OMAP24XX_DMA_SPI2_TX0 43 /* S_DMA_42 */
159#define OMAP24XX_DMA_SPI2_RX0 44 /* S_DMA_43 */
160#define OMAP24XX_DMA_SPI2_TX1 45 /* S_DMA_44 */
161#define OMAP24XX_DMA_SPI2_RX1 46 /* S_DMA_45 */
162#define OMAP24XX_DMA_MMC2_TX 47 /* S_DMA_46 */
163#define OMAP24XX_DMA_MMC2_RX 48 /* S_DMA_47 */
164#define OMAP24XX_DMA_UART1_TX 49 /* S_DMA_48 */
165#define OMAP24XX_DMA_UART1_RX 50 /* S_DMA_49 */
166#define OMAP24XX_DMA_UART2_TX 51 /* S_DMA_50 */
167#define OMAP24XX_DMA_UART2_RX 52 /* S_DMA_51 */
168#define OMAP24XX_DMA_UART3_TX 53 /* S_DMA_52 */
169#define OMAP24XX_DMA_UART3_RX 54 /* S_DMA_53 */
170#define OMAP24XX_DMA_USB_W2FC_TX0 55 /* S_DMA_54 */
171#define OMAP24XX_DMA_USB_W2FC_RX0 56 /* S_DMA_55 */
172#define OMAP24XX_DMA_USB_W2FC_TX1 57 /* S_DMA_56 */
173#define OMAP24XX_DMA_USB_W2FC_RX1 58 /* S_DMA_57 */
174#define OMAP24XX_DMA_USB_W2FC_TX2 59 /* S_DMA_58 */
175#define OMAP24XX_DMA_USB_W2FC_RX2 60 /* S_DMA_59 */
176#define OMAP24XX_DMA_MMC1_TX 61 /* S_DMA_60 */
177#define OMAP24XX_DMA_MMC1_RX 62 /* S_DMA_61 */
178#define OMAP24XX_DMA_MS 63 /* S_DMA_62 */
179#define OMAP242X_DMA_EXT_DMAREQ5 64 /* S_DMA_63 */
180#define OMAP243X_DMA_EXT_DMAREQ6 64 /* S_DMA_63 */
181#define OMAP34XX_DMA_EXT_DMAREQ3 64 /* S_DMA_63 */
182#define OMAP34XX_DMA_AES2_TX 65 /* S_DMA_64 */
183#define OMAP34XX_DMA_AES2_RX 66 /* S_DMA_65 */
184#define OMAP34XX_DMA_DES2_TX 67 /* S_DMA_66 */
185#define OMAP34XX_DMA_DES2_RX 68 /* S_DMA_67 */
186#define OMAP34XX_DMA_SHA1MD5_RX 69 /* S_DMA_68 */
187#define OMAP34XX_DMA_SPI4_TX0 70 /* S_DMA_69 */
188#define OMAP34XX_DMA_SPI4_RX0 71 /* S_DMA_70 */
189#define OMAP34XX_DSS_DMA0 72 /* S_DMA_71 */
190#define OMAP34XX_DSS_DMA1 73 /* S_DMA_72 */
191#define OMAP34XX_DSS_DMA2 74 /* S_DMA_73 */
192#define OMAP34XX_DSS_DMA3 75 /* S_DMA_74 */
193#define OMAP34XX_DMA_MMC3_TX 77 /* S_DMA_76 */
194#define OMAP34XX_DMA_MMC3_RX 78 /* S_DMA_77 */
195#define OMAP34XX_DMA_USIM_TX 79 /* S_DMA_78 */
196#define OMAP34XX_DMA_USIM_RX 80 /* S_DMA_79 */
197
198#define OMAP36XX_DMA_UART4_TX 81 /* S_DMA_80 */
199#define OMAP36XX_DMA_UART4_RX 82 /* S_DMA_81 */
200
201/* Only for AM35xx */
202#define AM35XX_DMA_UART4_TX 54
203#define AM35XX_DMA_UART4_RX 55
204
205/*----------------------------------------------------------------------------*/
206
207#define OMAP1_DMA_TOUT_IRQ (1 << 0) 28#define OMAP1_DMA_TOUT_IRQ (1 << 0)
208#define OMAP_DMA_DROP_IRQ (1 << 1) 29#define OMAP_DMA_DROP_IRQ (1 << 1)
209#define OMAP_DMA_HALF_IRQ (1 << 2) 30#define OMAP_DMA_HALF_IRQ (1 << 2)
diff --git a/arch/arm/plat-omap/include/plat/clkdev_omap.h b/arch/arm/plat-omap/include/plat/clkdev_omap.h
deleted file mode 100644
index 025d85a3ee86..000000000000
--- a/arch/arm/plat-omap/include/plat/clkdev_omap.h
+++ /dev/null
@@ -1,51 +0,0 @@
1/*
2 * clkdev <-> OMAP integration
3 *
4 * Russell King <linux@arm.linux.org.uk>
5 *
6 */
7
8#ifndef __ARCH_ARM_PLAT_OMAP_INCLUDE_PLAT_CLKDEV_OMAP_H
9#define __ARCH_ARM_PLAT_OMAP_INCLUDE_PLAT_CLKDEV_OMAP_H
10
11#include <linux/clkdev.h>
12
13struct omap_clk {
14 u16 cpu;
15 struct clk_lookup lk;
16};
17
18#define CLK(dev, con, ck, cp) \
19 { \
20 .cpu = cp, \
21 .lk = { \
22 .dev_id = dev, \
23 .con_id = con, \
24 .clk = ck, \
25 }, \
26 }
27
28/* Platform flags for the clkdev-OMAP integration code */
29#define CK_310 (1 << 0)
30#define CK_7XX (1 << 1) /* 7xx, 850 */
31#define CK_1510 (1 << 2)
32#define CK_16XX (1 << 3) /* 16xx, 17xx, 5912 */
33#define CK_242X (1 << 4)
34#define CK_243X (1 << 5) /* 243x, 253x */
35#define CK_3430ES1 (1 << 6) /* 34xxES1 only */
36#define CK_3430ES2PLUS (1 << 7) /* 34xxES2, ES3, non-Sitara 35xx only */
37#define CK_AM35XX (1 << 9) /* Sitara AM35xx */
38#define CK_36XX (1 << 10) /* 36xx/37xx-specific clocks */
39#define CK_443X (1 << 11)
40#define CK_TI816X (1 << 12)
41#define CK_446X (1 << 13)
42#define CK_AM33XX (1 << 14) /* AM33xx specific clocks */
43#define CK_1710 (1 << 15) /* 1710 extra for rate selection */
44
45
46#define CK_34XX (CK_3430ES1 | CK_3430ES2PLUS)
47#define CK_3XXX (CK_34XX | CK_AM35XX | CK_36XX)
48
49
50#endif
51
diff --git a/arch/arm/plat-omap/include/plat/clock.h b/arch/arm/plat-omap/include/plat/clock.h
deleted file mode 100644
index e2e2d045e428..000000000000
--- a/arch/arm/plat-omap/include/plat/clock.h
+++ /dev/null
@@ -1,309 +0,0 @@
1/*
2 * OMAP clock: data structure definitions, function prototypes, shared macros
3 *
4 * Copyright (C) 2004-2005, 2008-2010 Nokia Corporation
5 * Written by Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com>
6 * Based on clocks.h by Tony Lindgren, Gordon McNutt and RidgeRun, 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 version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#ifndef __ARCH_ARM_OMAP_CLOCK_H
14#define __ARCH_ARM_OMAP_CLOCK_H
15
16#include <linux/list.h>
17
18struct module;
19struct clk;
20struct clockdomain;
21
22/* Temporary, needed during the common clock framework conversion */
23#define __clk_get_name(clk) (clk->name)
24#define __clk_get_parent(clk) (clk->parent)
25#define __clk_get_rate(clk) (clk->rate)
26
27/**
28 * struct clkops - some clock function pointers
29 * @enable: fn ptr that enables the current clock in hardware
30 * @disable: fn ptr that enables the current clock in hardware
31 * @find_idlest: function returning the IDLEST register for the clock's IP blk
32 * @find_companion: function returning the "companion" clk reg for the clock
33 * @allow_idle: fn ptr that enables autoidle for the current clock in hardware
34 * @deny_idle: fn ptr that disables autoidle for the current clock in hardware
35 *
36 * A "companion" clk is an accompanying clock to the one being queried
37 * that must be enabled for the IP module connected to the clock to
38 * become accessible by the hardware. Neither @find_idlest nor
39 * @find_companion should be needed; that information is IP
40 * block-specific; the hwmod code has been created to handle this, but
41 * until hwmod data is ready and drivers have been converted to use PM
42 * runtime calls in place of clk_enable()/clk_disable(), @find_idlest and
43 * @find_companion must, unfortunately, remain.
44 */
45struct clkops {
46 int (*enable)(struct clk *);
47 void (*disable)(struct clk *);
48 void (*find_idlest)(struct clk *, void __iomem **,
49 u8 *, u8 *);
50 void (*find_companion)(struct clk *, void __iomem **,
51 u8 *);
52 void (*allow_idle)(struct clk *);
53 void (*deny_idle)(struct clk *);
54};
55
56#ifdef CONFIG_ARCH_OMAP2PLUS
57
58/* struct clksel_rate.flags possibilities */
59#define RATE_IN_242X (1 << 0)
60#define RATE_IN_243X (1 << 1)
61#define RATE_IN_3430ES1 (1 << 2) /* 3430ES1 rates only */
62#define RATE_IN_3430ES2PLUS (1 << 3) /* 3430 ES >= 2 rates only */
63#define RATE_IN_36XX (1 << 4)
64#define RATE_IN_4430 (1 << 5)
65#define RATE_IN_TI816X (1 << 6)
66#define RATE_IN_4460 (1 << 7)
67#define RATE_IN_AM33XX (1 << 8)
68#define RATE_IN_TI814X (1 << 9)
69
70#define RATE_IN_24XX (RATE_IN_242X | RATE_IN_243X)
71#define RATE_IN_34XX (RATE_IN_3430ES1 | RATE_IN_3430ES2PLUS)
72#define RATE_IN_3XXX (RATE_IN_34XX | RATE_IN_36XX)
73#define RATE_IN_44XX (RATE_IN_4430 | RATE_IN_4460)
74
75/* RATE_IN_3430ES2PLUS_36XX includes 34xx/35xx with ES >=2, and all 36xx/37xx */
76#define RATE_IN_3430ES2PLUS_36XX (RATE_IN_3430ES2PLUS | RATE_IN_36XX)
77
78
79/**
80 * struct clksel_rate - register bitfield values corresponding to clk divisors
81 * @val: register bitfield value (shifted to bit 0)
82 * @div: clock divisor corresponding to @val
83 * @flags: (see "struct clksel_rate.flags possibilities" above)
84 *
85 * @val should match the value of a read from struct clk.clksel_reg
86 * AND'ed with struct clk.clksel_mask, shifted right to bit 0.
87 *
88 * @div is the divisor that should be applied to the parent clock's rate
89 * to produce the current clock's rate.
90 */
91struct clksel_rate {
92 u32 val;
93 u8 div;
94 u16 flags;
95};
96
97/**
98 * struct clksel - available parent clocks, and a pointer to their divisors
99 * @parent: struct clk * to a possible parent clock
100 * @rates: available divisors for this parent clock
101 *
102 * A struct clksel is always associated with one or more struct clks
103 * and one or more struct clksel_rates.
104 */
105struct clksel {
106 struct clk *parent;
107 const struct clksel_rate *rates;
108};
109
110/**
111 * struct dpll_data - DPLL registers and integration data
112 * @mult_div1_reg: register containing the DPLL M and N bitfields
113 * @mult_mask: mask of the DPLL M bitfield in @mult_div1_reg
114 * @div1_mask: mask of the DPLL N bitfield in @mult_div1_reg
115 * @clk_bypass: struct clk pointer to the clock's bypass clock input
116 * @clk_ref: struct clk pointer to the clock's reference clock input
117 * @control_reg: register containing the DPLL mode bitfield
118 * @enable_mask: mask of the DPLL mode bitfield in @control_reg
119 * @last_rounded_rate: cache of the last rate result of omap2_dpll_round_rate()
120 * @last_rounded_m: cache of the last M result of omap2_dpll_round_rate()
121 * @max_multiplier: maximum valid non-bypass multiplier value (actual)
122 * @last_rounded_n: cache of the last N result of omap2_dpll_round_rate()
123 * @min_divider: minimum valid non-bypass divider value (actual)
124 * @max_divider: maximum valid non-bypass divider value (actual)
125 * @modes: possible values of @enable_mask
126 * @autoidle_reg: register containing the DPLL autoidle mode bitfield
127 * @idlest_reg: register containing the DPLL idle status bitfield
128 * @autoidle_mask: mask of the DPLL autoidle mode bitfield in @autoidle_reg
129 * @freqsel_mask: mask of the DPLL jitter correction bitfield in @control_reg
130 * @idlest_mask: mask of the DPLL idle status bitfield in @idlest_reg
131 * @auto_recal_bit: bitshift of the driftguard enable bit in @control_reg
132 * @recal_en_bit: bitshift of the PRM_IRQENABLE_* bit for recalibration IRQs
133 * @recal_st_bit: bitshift of the PRM_IRQSTATUS_* bit for recalibration IRQs
134 * @flags: DPLL type/features (see below)
135 *
136 * Possible values for @flags:
137 * DPLL_J_TYPE: "J-type DPLL" (only some 36xx, 4xxx DPLLs)
138 *
139 * @freqsel_mask is only used on the OMAP34xx family and AM35xx.
140 *
141 * XXX Some DPLLs have multiple bypass inputs, so it's not technically
142 * correct to only have one @clk_bypass pointer.
143 *
144 * XXX The runtime-variable fields (@last_rounded_rate, @last_rounded_m,
145 * @last_rounded_n) should be separated from the runtime-fixed fields
146 * and placed into a different structure, so that the runtime-fixed data
147 * can be placed into read-only space.
148 */
149struct dpll_data {
150 void __iomem *mult_div1_reg;
151 u32 mult_mask;
152 u32 div1_mask;
153 struct clk *clk_bypass;
154 struct clk *clk_ref;
155 void __iomem *control_reg;
156 u32 enable_mask;
157 unsigned long last_rounded_rate;
158 u16 last_rounded_m;
159 u16 max_multiplier;
160 u8 last_rounded_n;
161 u8 min_divider;
162 u16 max_divider;
163 u8 modes;
164 void __iomem *autoidle_reg;
165 void __iomem *idlest_reg;
166 u32 autoidle_mask;
167 u32 freqsel_mask;
168 u32 idlest_mask;
169 u32 dco_mask;
170 u32 sddiv_mask;
171 u8 auto_recal_bit;
172 u8 recal_en_bit;
173 u8 recal_st_bit;
174 u8 flags;
175};
176
177#endif
178
179/*
180 * struct clk.flags possibilities
181 *
182 * XXX document the rest of the clock flags here
183 *
184 * CLOCK_CLKOUTX2: (OMAP4 only) DPLL CLKOUT and CLKOUTX2 GATE_CTRL
185 * bits share the same register. This flag allows the
186 * omap4_dpllmx*() code to determine which GATE_CTRL bit field
187 * should be used. This is a temporary solution - a better approach
188 * would be to associate clock type-specific data with the clock,
189 * similar to the struct dpll_data approach.
190 */
191#define ENABLE_REG_32BIT (1 << 0) /* Use 32-bit access */
192#define CLOCK_IDLE_CONTROL (1 << 1)
193#define CLOCK_NO_IDLE_PARENT (1 << 2)
194#define ENABLE_ON_INIT (1 << 3) /* Enable upon framework init */
195#define INVERT_ENABLE (1 << 4) /* 0 enables, 1 disables */
196#define CLOCK_CLKOUTX2 (1 << 5)
197
198/**
199 * struct clk - OMAP struct clk
200 * @node: list_head connecting this clock into the full clock list
201 * @ops: struct clkops * for this clock
202 * @name: the name of the clock in the hardware (used in hwmod data and debug)
203 * @parent: pointer to this clock's parent struct clk
204 * @children: list_head connecting to the child clks' @sibling list_heads
205 * @sibling: list_head connecting this clk to its parent clk's @children
206 * @rate: current clock rate
207 * @enable_reg: register to write to enable the clock (see @enable_bit)
208 * @recalc: fn ptr that returns the clock's current rate
209 * @set_rate: fn ptr that can change the clock's current rate
210 * @round_rate: fn ptr that can round the clock's current rate
211 * @init: fn ptr to do clock-specific initialization
212 * @enable_bit: bitshift to write to enable/disable the clock (see @enable_reg)
213 * @usecount: number of users that have requested this clock to be enabled
214 * @fixed_div: when > 0, this clock's rate is its parent's rate / @fixed_div
215 * @flags: see "struct clk.flags possibilities" above
216 * @clksel_reg: for clksel clks, register va containing src/divisor select
217 * @clksel_mask: bitmask in @clksel_reg for the src/divisor selector
218 * @clksel: for clksel clks, pointer to struct clksel for this clock
219 * @dpll_data: for DPLLs, pointer to struct dpll_data for this clock
220 * @clkdm_name: clockdomain name that this clock is contained in
221 * @clkdm: pointer to struct clockdomain, resolved from @clkdm_name at runtime
222 * @rate_offset: bitshift for rate selection bitfield (OMAP1 only)
223 * @src_offset: bitshift for source selection bitfield (OMAP1 only)
224 *
225 * XXX @rate_offset, @src_offset should probably be removed and OMAP1
226 * clock code converted to use clksel.
227 *
228 * XXX @usecount is poorly named. It should be "enable_count" or
229 * something similar. "users" in the description refers to kernel
230 * code (core code or drivers) that have called clk_enable() and not
231 * yet called clk_disable(); the usecount of parent clocks is also
232 * incremented by the clock code when clk_enable() is called on child
233 * clocks and decremented by the clock code when clk_disable() is
234 * called on child clocks.
235 *
236 * XXX @clkdm, @usecount, @children, @sibling should be marked for
237 * internal use only.
238 *
239 * @children and @sibling are used to optimize parent-to-child clock
240 * tree traversals. (child-to-parent traversals use @parent.)
241 *
242 * XXX The notion of the clock's current rate probably needs to be
243 * separated from the clock's target rate.
244 */
245struct clk {
246 struct list_head node;
247 const struct clkops *ops;
248 const char *name;
249 struct clk *parent;
250 struct list_head children;
251 struct list_head sibling; /* node for children */
252 unsigned long rate;
253 void __iomem *enable_reg;
254 unsigned long (*recalc)(struct clk *);
255 int (*set_rate)(struct clk *, unsigned long);
256 long (*round_rate)(struct clk *, unsigned long);
257 void (*init)(struct clk *);
258 u8 enable_bit;
259 s8 usecount;
260 u8 fixed_div;
261 u8 flags;
262#ifdef CONFIG_ARCH_OMAP2PLUS
263 void __iomem *clksel_reg;
264 u32 clksel_mask;
265 const struct clksel *clksel;
266 struct dpll_data *dpll_data;
267 const char *clkdm_name;
268 struct clockdomain *clkdm;
269#else
270 u8 rate_offset;
271 u8 src_offset;
272#endif
273#if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS)
274 struct dentry *dent; /* For visible tree hierarchy */
275#endif
276};
277
278struct clk_functions {
279 int (*clk_enable)(struct clk *clk);
280 void (*clk_disable)(struct clk *clk);
281 long (*clk_round_rate)(struct clk *clk, unsigned long rate);
282 int (*clk_set_rate)(struct clk *clk, unsigned long rate);
283 int (*clk_set_parent)(struct clk *clk, struct clk *parent);
284 void (*clk_allow_idle)(struct clk *clk);
285 void (*clk_deny_idle)(struct clk *clk);
286 void (*clk_disable_unused)(struct clk *clk);
287};
288
289extern int mpurate;
290
291extern int clk_init(struct clk_functions *custom_clocks);
292extern void clk_preinit(struct clk *clk);
293extern int clk_register(struct clk *clk);
294extern void clk_reparent(struct clk *child, struct clk *parent);
295extern void clk_unregister(struct clk *clk);
296extern void propagate_rate(struct clk *clk);
297extern void recalculate_root_clocks(void);
298extern unsigned long followparent_recalc(struct clk *clk);
299extern void clk_enable_init_clocks(void);
300unsigned long omap_fixed_divisor_recalc(struct clk *clk);
301extern struct clk *omap_clk_get_by_name(const char *name);
302extern int omap_clk_enable_autoidle_all(void);
303extern int omap_clk_disable_autoidle_all(void);
304
305extern const struct clkops clkops_null;
306
307extern struct clk dummy_ck;
308
309#endif
diff --git a/arch/arm/plat-omap/include/plat/cpu.h b/arch/arm/plat-omap/include/plat/cpu.h
index 67da857783ce..ba542ec8d513 100644
--- a/arch/arm/plat-omap/include/plat/cpu.h
+++ b/arch/arm/plat-omap/include/plat/cpu.h
@@ -1,6 +1,4 @@
1/* 1/*
2 * arch/arm/plat-omap/include/mach/cpu.h
3 *
4 * OMAP cpu type detection 2 * OMAP cpu type detection
5 * 3 *
6 * Copyright (C) 2004, 2008 Nokia Corporation 4 * Copyright (C) 2004, 2008 Nokia Corporation
@@ -30,470 +28,12 @@
30#ifndef __ASM_ARCH_OMAP_CPU_H 28#ifndef __ASM_ARCH_OMAP_CPU_H
31#define __ASM_ARCH_OMAP_CPU_H 29#define __ASM_ARCH_OMAP_CPU_H
32 30
33#ifndef __ASSEMBLY__ 31#ifdef CONFIG_ARCH_OMAP1
34 32#include "../../mach-omap1/soc.h"
35#include <linux/bitops.h>
36#include <plat/multi.h>
37
38/*
39 * Omap device type i.e. EMU/HS/TST/GP/BAD
40 */
41#define OMAP2_DEVICE_TYPE_TEST 0
42#define OMAP2_DEVICE_TYPE_EMU 1
43#define OMAP2_DEVICE_TYPE_SEC 2
44#define OMAP2_DEVICE_TYPE_GP 3
45#define OMAP2_DEVICE_TYPE_BAD 4
46
47int omap_type(void);
48
49/*
50 * omap_rev bits:
51 * CPU id bits (0730, 1510, 1710, 2422...) [31:16]
52 * CPU revision (See _REV_ defined in cpu.h) [15:08]
53 * CPU class bits (15xx, 16xx, 24xx, 34xx...) [07:00]
54 */
55unsigned int omap_rev(void);
56
57/*
58 * Get the CPU revision for OMAP devices
59 */
60#define GET_OMAP_REVISION() ((omap_rev() >> 8) & 0xff)
61
62/*
63 * Macros to group OMAP into cpu classes.
64 * These can be used in most places.
65 * cpu_is_omap7xx(): True for OMAP730, OMAP850
66 * cpu_is_omap15xx(): True for OMAP1510, OMAP5910 and OMAP310
67 * cpu_is_omap16xx(): True for OMAP1610, OMAP5912 and OMAP1710
68 * cpu_is_omap24xx(): True for OMAP2420, OMAP2422, OMAP2423, OMAP2430
69 * cpu_is_omap242x(): True for OMAP2420, OMAP2422, OMAP2423
70 * cpu_is_omap243x(): True for OMAP2430
71 * cpu_is_omap343x(): True for OMAP3430
72 * cpu_is_omap443x(): True for OMAP4430
73 * cpu_is_omap446x(): True for OMAP4460
74 * cpu_is_omap447x(): True for OMAP4470
75 * soc_is_omap543x(): True for OMAP5430, OMAP5432
76 */
77#define GET_OMAP_CLASS (omap_rev() & 0xff)
78
79#define IS_OMAP_CLASS(class, id) \
80static inline int is_omap ##class (void) \
81{ \
82 return (GET_OMAP_CLASS == (id)) ? 1 : 0; \
83}
84
85#define GET_AM_CLASS ((omap_rev() >> 24) & 0xff)
86
87#define IS_AM_CLASS(class, id) \
88static inline int is_am ##class (void) \
89{ \
90 return (GET_AM_CLASS == (id)) ? 1 : 0; \
91}
92
93#define GET_TI_CLASS ((omap_rev() >> 24) & 0xff)
94
95#define IS_TI_CLASS(class, id) \
96static inline int is_ti ##class (void) \
97{ \
98 return (GET_TI_CLASS == (id)) ? 1 : 0; \
99}
100
101#define GET_OMAP_SUBCLASS ((omap_rev() >> 20) & 0x0fff)
102
103#define IS_OMAP_SUBCLASS(subclass, id) \
104static inline int is_omap ##subclass (void) \
105{ \
106 return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \
107}
108
109#define IS_TI_SUBCLASS(subclass, id) \
110static inline int is_ti ##subclass (void) \
111{ \
112 return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \
113}
114
115#define IS_AM_SUBCLASS(subclass, id) \
116static inline int is_am ##subclass (void) \
117{ \
118 return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \
119}
120
121IS_OMAP_CLASS(7xx, 0x07)
122IS_OMAP_CLASS(15xx, 0x15)
123IS_OMAP_CLASS(16xx, 0x16)
124IS_OMAP_CLASS(24xx, 0x24)
125IS_OMAP_CLASS(34xx, 0x34)
126IS_OMAP_CLASS(44xx, 0x44)
127IS_AM_CLASS(35xx, 0x35)
128IS_OMAP_CLASS(54xx, 0x54)
129IS_AM_CLASS(33xx, 0x33)
130
131IS_TI_CLASS(81xx, 0x81)
132
133IS_OMAP_SUBCLASS(242x, 0x242)
134IS_OMAP_SUBCLASS(243x, 0x243)
135IS_OMAP_SUBCLASS(343x, 0x343)
136IS_OMAP_SUBCLASS(363x, 0x363)
137IS_OMAP_SUBCLASS(443x, 0x443)
138IS_OMAP_SUBCLASS(446x, 0x446)
139IS_OMAP_SUBCLASS(447x, 0x447)
140IS_OMAP_SUBCLASS(543x, 0x543)
141
142IS_TI_SUBCLASS(816x, 0x816)
143IS_TI_SUBCLASS(814x, 0x814)
144IS_AM_SUBCLASS(335x, 0x335)
145
146#define cpu_is_omap7xx() 0
147#define cpu_is_omap15xx() 0
148#define cpu_is_omap16xx() 0
149#define cpu_is_omap24xx() 0
150#define cpu_is_omap242x() 0
151#define cpu_is_omap243x() 0
152#define cpu_is_omap34xx() 0
153#define cpu_is_omap343x() 0
154#define cpu_is_ti81xx() 0
155#define cpu_is_ti816x() 0
156#define cpu_is_ti814x() 0
157#define soc_is_am35xx() 0
158#define soc_is_am33xx() 0
159#define soc_is_am335x() 0
160#define cpu_is_omap44xx() 0
161#define cpu_is_omap443x() 0
162#define cpu_is_omap446x() 0
163#define cpu_is_omap447x() 0
164#define soc_is_omap54xx() 0
165#define soc_is_omap543x() 0
166
167#if defined(MULTI_OMAP1)
168# if defined(CONFIG_ARCH_OMAP730)
169# undef cpu_is_omap7xx
170# define cpu_is_omap7xx() is_omap7xx()
171# endif
172# if defined(CONFIG_ARCH_OMAP850)
173# undef cpu_is_omap7xx
174# define cpu_is_omap7xx() is_omap7xx()
175# endif
176# if defined(CONFIG_ARCH_OMAP15XX)
177# undef cpu_is_omap15xx
178# define cpu_is_omap15xx() is_omap15xx()
179# endif
180# if defined(CONFIG_ARCH_OMAP16XX)
181# undef cpu_is_omap16xx
182# define cpu_is_omap16xx() is_omap16xx()
183# endif
184#else
185# if defined(CONFIG_ARCH_OMAP730)
186# undef cpu_is_omap7xx
187# define cpu_is_omap7xx() 1
188# endif
189# if defined(CONFIG_ARCH_OMAP850)
190# undef cpu_is_omap7xx
191# define cpu_is_omap7xx() 1
192# endif
193# if defined(CONFIG_ARCH_OMAP15XX)
194# undef cpu_is_omap15xx
195# define cpu_is_omap15xx() 1
196# endif
197# if defined(CONFIG_ARCH_OMAP16XX)
198# undef cpu_is_omap16xx
199# define cpu_is_omap16xx() 1
200# endif
201#endif
202
203#if defined(MULTI_OMAP2)
204# if defined(CONFIG_ARCH_OMAP2)
205# undef cpu_is_omap24xx
206# define cpu_is_omap24xx() is_omap24xx()
207# endif
208# if defined (CONFIG_SOC_OMAP2420)
209# undef cpu_is_omap242x
210# define cpu_is_omap242x() is_omap242x()
211# endif
212# if defined (CONFIG_SOC_OMAP2430)
213# undef cpu_is_omap243x
214# define cpu_is_omap243x() is_omap243x()
215# endif
216# if defined(CONFIG_ARCH_OMAP3)
217# undef cpu_is_omap34xx
218# undef cpu_is_omap343x
219# define cpu_is_omap34xx() is_omap34xx()
220# define cpu_is_omap343x() is_omap343x()
221# endif
222#else
223# if defined(CONFIG_ARCH_OMAP2)
224# undef cpu_is_omap24xx
225# define cpu_is_omap24xx() 1
226# endif
227# if defined(CONFIG_SOC_OMAP2420)
228# undef cpu_is_omap242x
229# define cpu_is_omap242x() 1
230# endif
231# if defined(CONFIG_SOC_OMAP2430)
232# undef cpu_is_omap243x
233# define cpu_is_omap243x() 1
234# endif
235# if defined(CONFIG_ARCH_OMAP3)
236# undef cpu_is_omap34xx
237# define cpu_is_omap34xx() 1
238# endif
239# if defined(CONFIG_SOC_OMAP3430)
240# undef cpu_is_omap343x
241# define cpu_is_omap343x() 1
242# endif
243#endif
244
245/*
246 * Macros to detect individual cpu types.
247 * These are only rarely needed.
248 * cpu_is_omap310(): True for OMAP310
249 * cpu_is_omap1510(): True for OMAP1510
250 * cpu_is_omap1610(): True for OMAP1610
251 * cpu_is_omap1611(): True for OMAP1611
252 * cpu_is_omap5912(): True for OMAP5912
253 * cpu_is_omap1621(): True for OMAP1621
254 * cpu_is_omap1710(): True for OMAP1710
255 * cpu_is_omap2420(): True for OMAP2420
256 * cpu_is_omap2422(): True for OMAP2422
257 * cpu_is_omap2423(): True for OMAP2423
258 * cpu_is_omap2430(): True for OMAP2430
259 * cpu_is_omap3430(): True for OMAP3430
260 */
261#define GET_OMAP_TYPE ((omap_rev() >> 16) & 0xffff)
262
263#define IS_OMAP_TYPE(type, id) \
264static inline int is_omap ##type (void) \
265{ \
266 return (GET_OMAP_TYPE == (id)) ? 1 : 0; \
267}
268
269IS_OMAP_TYPE(310, 0x0310)
270IS_OMAP_TYPE(1510, 0x1510)
271IS_OMAP_TYPE(1610, 0x1610)
272IS_OMAP_TYPE(1611, 0x1611)
273IS_OMAP_TYPE(5912, 0x1611)
274IS_OMAP_TYPE(1621, 0x1621)
275IS_OMAP_TYPE(1710, 0x1710)
276IS_OMAP_TYPE(2420, 0x2420)
277IS_OMAP_TYPE(2422, 0x2422)
278IS_OMAP_TYPE(2423, 0x2423)
279IS_OMAP_TYPE(2430, 0x2430)
280IS_OMAP_TYPE(3430, 0x3430)
281
282#define cpu_is_omap310() 0
283#define cpu_is_omap1510() 0
284#define cpu_is_omap1610() 0
285#define cpu_is_omap5912() 0
286#define cpu_is_omap1611() 0
287#define cpu_is_omap1621() 0
288#define cpu_is_omap1710() 0
289#define cpu_is_omap2420() 0
290#define cpu_is_omap2422() 0
291#define cpu_is_omap2423() 0
292#define cpu_is_omap2430() 0
293#define cpu_is_omap3430() 0
294#define cpu_is_omap3630() 0
295#define soc_is_omap5430() 0
296
297/*
298 * Whether we have MULTI_OMAP1 or not, we still need to distinguish
299 * between 310 vs. 1510 and 1611B/5912 vs. 1710.
300 */
301
302#if defined(CONFIG_ARCH_OMAP15XX)
303# undef cpu_is_omap310
304# undef cpu_is_omap1510
305# define cpu_is_omap310() is_omap310()
306# define cpu_is_omap1510() is_omap1510()
307#endif
308
309#if defined(CONFIG_ARCH_OMAP16XX)
310# undef cpu_is_omap1610
311# undef cpu_is_omap1611
312# undef cpu_is_omap5912
313# undef cpu_is_omap1621
314# undef cpu_is_omap1710
315# define cpu_is_omap1610() is_omap1610()
316# define cpu_is_omap1611() is_omap1611()
317# define cpu_is_omap5912() is_omap5912()
318# define cpu_is_omap1621() is_omap1621()
319# define cpu_is_omap1710() is_omap1710()
320#endif
321
322#if defined(CONFIG_ARCH_OMAP2)
323# undef cpu_is_omap2420
324# undef cpu_is_omap2422
325# undef cpu_is_omap2423
326# undef cpu_is_omap2430
327# define cpu_is_omap2420() is_omap2420()
328# define cpu_is_omap2422() is_omap2422()
329# define cpu_is_omap2423() is_omap2423()
330# define cpu_is_omap2430() is_omap2430()
331#endif
332
333#if defined(CONFIG_ARCH_OMAP3)
334# undef cpu_is_omap3430
335# undef cpu_is_ti81xx
336# undef cpu_is_ti816x
337# undef cpu_is_ti814x
338# undef soc_is_am35xx
339# define cpu_is_omap3430() is_omap3430()
340# undef cpu_is_omap3630
341# define cpu_is_omap3630() is_omap363x()
342# define cpu_is_ti81xx() is_ti81xx()
343# define cpu_is_ti816x() is_ti816x()
344# define cpu_is_ti814x() is_ti814x()
345# define soc_is_am35xx() is_am35xx()
346#endif 33#endif
347 34
348# if defined(CONFIG_SOC_AM33XX) 35#ifdef CONFIG_ARCH_OMAP2PLUS
349# undef soc_is_am33xx 36#include "../../mach-omap2/soc.h"
350# undef soc_is_am335x
351# define soc_is_am33xx() is_am33xx()
352# define soc_is_am335x() is_am335x()
353#endif 37#endif
354 38
355# if defined(CONFIG_ARCH_OMAP4)
356# undef cpu_is_omap44xx
357# undef cpu_is_omap443x
358# undef cpu_is_omap446x
359# undef cpu_is_omap447x
360# define cpu_is_omap44xx() is_omap44xx()
361# define cpu_is_omap443x() is_omap443x()
362# define cpu_is_omap446x() is_omap446x()
363# define cpu_is_omap447x() is_omap447x()
364# endif
365
366# if defined(CONFIG_SOC_OMAP5)
367# undef soc_is_omap54xx
368# undef soc_is_omap543x
369# define soc_is_omap54xx() is_omap54xx()
370# define soc_is_omap543x() is_omap543x()
371#endif
372
373/* Macros to detect if we have OMAP1 or OMAP2 */
374#define cpu_class_is_omap1() (cpu_is_omap7xx() || cpu_is_omap15xx() || \
375 cpu_is_omap16xx())
376#define cpu_class_is_omap2() (cpu_is_omap24xx() || cpu_is_omap34xx() || \
377 cpu_is_omap44xx() || soc_is_omap54xx() || \
378 soc_is_am33xx())
379
380/* Various silicon revisions for omap2 */
381#define OMAP242X_CLASS 0x24200024
382#define OMAP2420_REV_ES1_0 OMAP242X_CLASS
383#define OMAP2420_REV_ES2_0 (OMAP242X_CLASS | (0x1 << 8))
384
385#define OMAP243X_CLASS 0x24300024
386#define OMAP2430_REV_ES1_0 OMAP243X_CLASS
387
388#define OMAP343X_CLASS 0x34300034
389#define OMAP3430_REV_ES1_0 OMAP343X_CLASS
390#define OMAP3430_REV_ES2_0 (OMAP343X_CLASS | (0x1 << 8))
391#define OMAP3430_REV_ES2_1 (OMAP343X_CLASS | (0x2 << 8))
392#define OMAP3430_REV_ES3_0 (OMAP343X_CLASS | (0x3 << 8))
393#define OMAP3430_REV_ES3_1 (OMAP343X_CLASS | (0x4 << 8))
394#define OMAP3430_REV_ES3_1_2 (OMAP343X_CLASS | (0x5 << 8))
395
396#define OMAP363X_CLASS 0x36300034
397#define OMAP3630_REV_ES1_0 OMAP363X_CLASS
398#define OMAP3630_REV_ES1_1 (OMAP363X_CLASS | (0x1 << 8))
399#define OMAP3630_REV_ES1_2 (OMAP363X_CLASS | (0x2 << 8))
400
401#define TI816X_CLASS 0x81600034
402#define TI8168_REV_ES1_0 TI816X_CLASS
403#define TI8168_REV_ES1_1 (TI816X_CLASS | (0x1 << 8))
404
405#define TI814X_CLASS 0x81400034
406#define TI8148_REV_ES1_0 TI814X_CLASS
407#define TI8148_REV_ES2_0 (TI814X_CLASS | (0x1 << 8))
408#define TI8148_REV_ES2_1 (TI814X_CLASS | (0x2 << 8))
409
410#define AM35XX_CLASS 0x35170034
411#define AM35XX_REV_ES1_0 AM35XX_CLASS
412#define AM35XX_REV_ES1_1 (AM35XX_CLASS | (0x1 << 8))
413
414#define AM335X_CLASS 0x33500033
415#define AM335X_REV_ES1_0 AM335X_CLASS
416
417#define OMAP443X_CLASS 0x44300044
418#define OMAP4430_REV_ES1_0 (OMAP443X_CLASS | (0x10 << 8))
419#define OMAP4430_REV_ES2_0 (OMAP443X_CLASS | (0x20 << 8))
420#define OMAP4430_REV_ES2_1 (OMAP443X_CLASS | (0x21 << 8))
421#define OMAP4430_REV_ES2_2 (OMAP443X_CLASS | (0x22 << 8))
422#define OMAP4430_REV_ES2_3 (OMAP443X_CLASS | (0x23 << 8))
423
424#define OMAP446X_CLASS 0x44600044
425#define OMAP4460_REV_ES1_0 (OMAP446X_CLASS | (0x10 << 8))
426#define OMAP4460_REV_ES1_1 (OMAP446X_CLASS | (0x11 << 8))
427
428#define OMAP447X_CLASS 0x44700044
429#define OMAP4470_REV_ES1_0 (OMAP447X_CLASS | (0x10 << 8))
430
431#define OMAP54XX_CLASS 0x54000054
432#define OMAP5430_REV_ES1_0 (OMAP54XX_CLASS | (0x30 << 16) | (0x10 << 8))
433#define OMAP5432_REV_ES1_0 (OMAP54XX_CLASS | (0x32 << 16) | (0x10 << 8))
434
435void omap2xxx_check_revision(void);
436void omap3xxx_check_revision(void);
437void omap4xxx_check_revision(void);
438void omap5xxx_check_revision(void);
439void omap3xxx_check_features(void);
440void ti81xx_check_features(void);
441void omap4xxx_check_features(void);
442
443/*
444 * Runtime detection of OMAP3 features
445 *
446 * OMAP3_HAS_IO_CHAIN_CTRL: Some later members of the OMAP3 chip
447 * family have OS-level control over the I/O chain clock. This is
448 * to avoid a window during which wakeups could potentially be lost
449 * during powerdomain transitions. If this bit is set, it
450 * indicates that the chip does support OS-level control of this
451 * feature.
452 */
453extern u32 omap_features;
454
455#define OMAP3_HAS_L2CACHE BIT(0)
456#define OMAP3_HAS_IVA BIT(1)
457#define OMAP3_HAS_SGX BIT(2)
458#define OMAP3_HAS_NEON BIT(3)
459#define OMAP3_HAS_ISP BIT(4)
460#define OMAP3_HAS_192MHZ_CLK BIT(5)
461#define OMAP3_HAS_IO_WAKEUP BIT(6)
462#define OMAP3_HAS_SDRC BIT(7)
463#define OMAP3_HAS_IO_CHAIN_CTRL BIT(8)
464#define OMAP4_HAS_MPU_1GHZ BIT(9)
465#define OMAP4_HAS_MPU_1_2GHZ BIT(10)
466#define OMAP4_HAS_MPU_1_5GHZ BIT(11)
467
468
469#define OMAP3_HAS_FEATURE(feat,flag) \
470static inline unsigned int omap3_has_ ##feat(void) \
471{ \
472 return omap_features & OMAP3_HAS_ ##flag; \
473} \
474
475OMAP3_HAS_FEATURE(l2cache, L2CACHE)
476OMAP3_HAS_FEATURE(sgx, SGX)
477OMAP3_HAS_FEATURE(iva, IVA)
478OMAP3_HAS_FEATURE(neon, NEON)
479OMAP3_HAS_FEATURE(isp, ISP)
480OMAP3_HAS_FEATURE(192mhz_clk, 192MHZ_CLK)
481OMAP3_HAS_FEATURE(io_wakeup, IO_WAKEUP)
482OMAP3_HAS_FEATURE(sdrc, SDRC)
483OMAP3_HAS_FEATURE(io_chain_ctrl, IO_CHAIN_CTRL)
484
485/*
486 * Runtime detection of OMAP4 features
487 */
488#define OMAP4_HAS_FEATURE(feat, flag) \
489static inline unsigned int omap4_has_ ##feat(void) \
490{ \
491 return omap_features & OMAP4_HAS_ ##flag; \
492} \
493
494OMAP4_HAS_FEATURE(mpu_1ghz, MPU_1GHZ)
495OMAP4_HAS_FEATURE(mpu_1_2ghz, MPU_1_2GHZ)
496OMAP4_HAS_FEATURE(mpu_1_5ghz, MPU_1_5GHZ)
497
498#endif /* __ASSEMBLY__ */
499#endif 39#endif
diff --git a/arch/arm/plat-omap/include/plat/dma-44xx.h b/arch/arm/plat-omap/include/plat/dma-44xx.h
deleted file mode 100644
index 1f767cb2f38a..000000000000
--- a/arch/arm/plat-omap/include/plat/dma-44xx.h
+++ /dev/null
@@ -1,147 +0,0 @@
1/*
2 * OMAP4 SDMA channel definitions
3 *
4 * Copyright (C) 2009-2010 Texas Instruments, Inc.
5 * Copyright (C) 2009-2010 Nokia Corporation
6 *
7 * Santosh Shilimkar (santosh.shilimkar@ti.com)
8 * Benoit Cousson (b-cousson@ti.com)
9 * Paul Walmsley (paul@pwsan.com)
10 *
11 * This file is automatically generated from the OMAP hardware databases.
12 * We respectfully ask that any modifications to this file be coordinated
13 * with the public linux-omap@vger.kernel.org mailing list and the
14 * authors above to ensure that the autogeneration scripts are kept
15 * up-to-date with the file contents.
16 *
17 * This program is free software; you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License version 2 as
19 * published by the Free Software Foundation.
20 */
21
22#ifndef __ARCH_ARM_MACH_OMAP2_OMAP44XX_DMA_H
23#define __ARCH_ARM_MACH_OMAP2_OMAP44XX_DMA_H
24
25#define OMAP44XX_DMA_SYS_REQ0 2
26#define OMAP44XX_DMA_SYS_REQ1 3
27#define OMAP44XX_DMA_GPMC 4
28#define OMAP44XX_DMA_DSS_DISPC_REQ 6
29#define OMAP44XX_DMA_SYS_REQ2 7
30#define OMAP44XX_DMA_MCASP1_AXEVT 8
31#define OMAP44XX_DMA_ISS_REQ1 9
32#define OMAP44XX_DMA_ISS_REQ2 10
33#define OMAP44XX_DMA_MCASP1_AREVT 11
34#define OMAP44XX_DMA_ISS_REQ3 12
35#define OMAP44XX_DMA_ISS_REQ4 13
36#define OMAP44XX_DMA_DSS_RFBI_REQ 14
37#define OMAP44XX_DMA_SPI3_TX0 15
38#define OMAP44XX_DMA_SPI3_RX0 16
39#define OMAP44XX_DMA_MCBSP2_TX 17
40#define OMAP44XX_DMA_MCBSP2_RX 18
41#define OMAP44XX_DMA_MCBSP3_TX 19
42#define OMAP44XX_DMA_MCBSP3_RX 20
43#define OMAP44XX_DMA_C2C_SSCM_GPO0 21
44#define OMAP44XX_DMA_C2C_SSCM_GPO1 22
45#define OMAP44XX_DMA_SPI3_TX1 23
46#define OMAP44XX_DMA_SPI3_RX1 24
47#define OMAP44XX_DMA_I2C3_TX 25
48#define OMAP44XX_DMA_I2C3_RX 26
49#define OMAP44XX_DMA_I2C1_TX 27
50#define OMAP44XX_DMA_I2C1_RX 28
51#define OMAP44XX_DMA_I2C2_TX 29
52#define OMAP44XX_DMA_I2C2_RX 30
53#define OMAP44XX_DMA_MCBSP4_TX 31
54#define OMAP44XX_DMA_MCBSP4_RX 32
55#define OMAP44XX_DMA_MCBSP1_TX 33
56#define OMAP44XX_DMA_MCBSP1_RX 34
57#define OMAP44XX_DMA_SPI1_TX0 35
58#define OMAP44XX_DMA_SPI1_RX0 36
59#define OMAP44XX_DMA_SPI1_TX1 37
60#define OMAP44XX_DMA_SPI1_RX1 38
61#define OMAP44XX_DMA_SPI1_TX2 39
62#define OMAP44XX_DMA_SPI1_RX2 40
63#define OMAP44XX_DMA_SPI1_TX3 41
64#define OMAP44XX_DMA_SPI1_RX3 42
65#define OMAP44XX_DMA_SPI2_TX0 43
66#define OMAP44XX_DMA_SPI2_RX0 44
67#define OMAP44XX_DMA_SPI2_TX1 45
68#define OMAP44XX_DMA_SPI2_RX1 46
69#define OMAP44XX_DMA_MMC2_TX 47
70#define OMAP44XX_DMA_MMC2_RX 48
71#define OMAP44XX_DMA_UART1_TX 49
72#define OMAP44XX_DMA_UART1_RX 50
73#define OMAP44XX_DMA_UART2_TX 51
74#define OMAP44XX_DMA_UART2_RX 52
75#define OMAP44XX_DMA_UART3_TX 53
76#define OMAP44XX_DMA_UART3_RX 54
77#define OMAP44XX_DMA_UART4_TX 55
78#define OMAP44XX_DMA_UART4_RX 56
79#define OMAP44XX_DMA_MMC4_TX 57
80#define OMAP44XX_DMA_MMC4_RX 58
81#define OMAP44XX_DMA_MMC5_TX 59
82#define OMAP44XX_DMA_MMC5_RX 60
83#define OMAP44XX_DMA_MMC1_TX 61
84#define OMAP44XX_DMA_MMC1_RX 62
85#define OMAP44XX_DMA_SYS_REQ3 64
86#define OMAP44XX_DMA_MCPDM_UP 65
87#define OMAP44XX_DMA_MCPDM_DL 66
88#define OMAP44XX_DMA_DMIC_REQ 67
89#define OMAP44XX_DMA_C2C_SSCM_GPO2 68
90#define OMAP44XX_DMA_C2C_SSCM_GPO3 69
91#define OMAP44XX_DMA_SPI4_TX0 70
92#define OMAP44XX_DMA_SPI4_RX0 71
93#define OMAP44XX_DMA_DSS_DSI1_REQ0 72
94#define OMAP44XX_DMA_DSS_DSI1_REQ1 73
95#define OMAP44XX_DMA_DSS_DSI1_REQ2 74
96#define OMAP44XX_DMA_DSS_DSI1_REQ3 75
97#define OMAP44XX_DMA_DSS_HDMI_REQ 76
98#define OMAP44XX_DMA_MMC3_TX 77
99#define OMAP44XX_DMA_MMC3_RX 78
100#define OMAP44XX_DMA_USIM_TX 79
101#define OMAP44XX_DMA_USIM_RX 80
102#define OMAP44XX_DMA_DSS_DSI2_REQ0 81
103#define OMAP44XX_DMA_DSS_DSI2_REQ1 82
104#define OMAP44XX_DMA_DSS_DSI2_REQ2 83
105#define OMAP44XX_DMA_DSS_DSI2_REQ3 84
106#define OMAP44XX_DMA_SLIMBUS1_TX0 85
107#define OMAP44XX_DMA_SLIMBUS1_TX1 86
108#define OMAP44XX_DMA_SLIMBUS1_TX2 87
109#define OMAP44XX_DMA_SLIMBUS1_TX3 88
110#define OMAP44XX_DMA_SLIMBUS1_RX0 89
111#define OMAP44XX_DMA_SLIMBUS1_RX1 90
112#define OMAP44XX_DMA_SLIMBUS1_RX2 91
113#define OMAP44XX_DMA_SLIMBUS1_RX3 92
114#define OMAP44XX_DMA_SLIMBUS2_TX0 93
115#define OMAP44XX_DMA_SLIMBUS2_TX1 94
116#define OMAP44XX_DMA_SLIMBUS2_TX2 95
117#define OMAP44XX_DMA_SLIMBUS2_TX3 96
118#define OMAP44XX_DMA_SLIMBUS2_RX0 97
119#define OMAP44XX_DMA_SLIMBUS2_RX1 98
120#define OMAP44XX_DMA_SLIMBUS2_RX2 99
121#define OMAP44XX_DMA_SLIMBUS2_RX3 100
122#define OMAP44XX_DMA_ABE_REQ_0 101
123#define OMAP44XX_DMA_ABE_REQ_1 102
124#define OMAP44XX_DMA_ABE_REQ_2 103
125#define OMAP44XX_DMA_ABE_REQ_3 104
126#define OMAP44XX_DMA_ABE_REQ_4 105
127#define OMAP44XX_DMA_ABE_REQ_5 106
128#define OMAP44XX_DMA_ABE_REQ_6 107
129#define OMAP44XX_DMA_ABE_REQ_7 108
130#define OMAP44XX_DMA_AES1_P_CTX_IN_REQ 109
131#define OMAP44XX_DMA_AES1_P_DATA_IN_REQ 110
132#define OMAP44XX_DMA_AES1_P_DATA_OUT_REQ 111
133#define OMAP44XX_DMA_AES2_P_CTX_IN_REQ 112
134#define OMAP44XX_DMA_AES2_P_DATA_IN_REQ 113
135#define OMAP44XX_DMA_AES2_P_DATA_OUT_REQ 114
136#define OMAP44XX_DMA_DES_P_CTX_IN_REQ 115
137#define OMAP44XX_DMA_DES_P_DATA_IN_REQ 116
138#define OMAP44XX_DMA_DES_P_DATA_OUT_REQ 117
139#define OMAP44XX_DMA_SHA2_CTXIN_P 118
140#define OMAP44XX_DMA_SHA2_DIN_P 119
141#define OMAP44XX_DMA_SHA2_CTXOUT_P 120
142#define OMAP44XX_DMA_AES1_P_CONTEXT_OUT_REQ 121
143#define OMAP44XX_DMA_AES2_P_CONTEXT_OUT_REQ 122
144#define OMAP44XX_DMA_I2C4_TX 124
145#define OMAP44XX_DMA_I2C4_RX 125
146
147#endif
diff --git a/arch/arm/plat-omap/include/plat/fpga.h b/arch/arm/plat-omap/include/plat/fpga.h
deleted file mode 100644
index bd3c6324ae1f..000000000000
--- a/arch/arm/plat-omap/include/plat/fpga.h
+++ /dev/null
@@ -1,193 +0,0 @@
1/*
2 * arch/arm/plat-omap/include/mach/fpga.h
3 *
4 * Interrupt handler for OMAP-1510 FPGA
5 *
6 * Copyright (C) 2001 RidgeRun, Inc.
7 * Author: Greg Lonnon <glonnon@ridgerun.com>
8 *
9 * Copyright (C) 2002 MontaVista Software, Inc.
10 *
11 * Separated FPGA interrupts from innovator1510.c and cleaned up for 2.6
12 * Copyright (C) 2004 Nokia Corporation by Tony Lindrgen <tony@atomide.com>
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License version 2 as
16 * published by the Free Software Foundation.
17 */
18
19#ifndef __ASM_ARCH_OMAP_FPGA_H
20#define __ASM_ARCH_OMAP_FPGA_H
21
22extern void omap1510_fpga_init_irq(void);
23
24#define fpga_read(reg) __raw_readb(reg)
25#define fpga_write(val, reg) __raw_writeb(val, reg)
26
27/*
28 * ---------------------------------------------------------------------------
29 * H2/P2 Debug board FPGA
30 * ---------------------------------------------------------------------------
31 */
32/* maps in the FPGA registers and the ETHR registers */
33#define H2P2_DBG_FPGA_BASE 0xE8000000 /* VA */
34#define H2P2_DBG_FPGA_SIZE SZ_4K /* SIZE */
35#define H2P2_DBG_FPGA_START 0x04000000 /* PA */
36
37#define H2P2_DBG_FPGA_ETHR_START (H2P2_DBG_FPGA_START + 0x300)
38#define H2P2_DBG_FPGA_FPGA_REV IOMEM(H2P2_DBG_FPGA_BASE + 0x10) /* FPGA Revision */
39#define H2P2_DBG_FPGA_BOARD_REV IOMEM(H2P2_DBG_FPGA_BASE + 0x12) /* Board Revision */
40#define H2P2_DBG_FPGA_GPIO IOMEM(H2P2_DBG_FPGA_BASE + 0x14) /* GPIO outputs */
41#define H2P2_DBG_FPGA_LEDS IOMEM(H2P2_DBG_FPGA_BASE + 0x16) /* LEDs outputs */
42#define H2P2_DBG_FPGA_MISC_INPUTS IOMEM(H2P2_DBG_FPGA_BASE + 0x18) /* Misc inputs */
43#define H2P2_DBG_FPGA_LAN_STATUS IOMEM(H2P2_DBG_FPGA_BASE + 0x1A) /* LAN Status line */
44#define H2P2_DBG_FPGA_LAN_RESET IOMEM(H2P2_DBG_FPGA_BASE + 0x1C) /* LAN Reset line */
45
46/* NOTE: most boards don't have a static mapping for the FPGA ... */
47struct h2p2_dbg_fpga {
48 /* offset 0x00 */
49 u16 smc91x[8];
50 /* offset 0x10 */
51 u16 fpga_rev;
52 u16 board_rev;
53 u16 gpio_outputs;
54 u16 leds;
55 /* offset 0x18 */
56 u16 misc_inputs;
57 u16 lan_status;
58 u16 lan_reset;
59 u16 reserved0;
60 /* offset 0x20 */
61 u16 ps2_data;
62 u16 ps2_ctrl;
63 /* plus also 4 rs232 ports ... */
64};
65
66/* LEDs definition on debug board (16 LEDs, all physically green) */
67#define H2P2_DBG_FPGA_LED_GREEN (1 << 15)
68#define H2P2_DBG_FPGA_LED_AMBER (1 << 14)
69#define H2P2_DBG_FPGA_LED_RED (1 << 13)
70#define H2P2_DBG_FPGA_LED_BLUE (1 << 12)
71/* cpu0 load-meter LEDs */
72#define H2P2_DBG_FPGA_LOAD_METER (1 << 0) // A bit of fun on our board ...
73#define H2P2_DBG_FPGA_LOAD_METER_SIZE 11
74#define H2P2_DBG_FPGA_LOAD_METER_MASK ((1 << H2P2_DBG_FPGA_LOAD_METER_SIZE) - 1)
75
76#define H2P2_DBG_FPGA_P2_LED_TIMER (1 << 0)
77#define H2P2_DBG_FPGA_P2_LED_IDLE (1 << 1)
78
79/*
80 * ---------------------------------------------------------------------------
81 * OMAP-1510 FPGA
82 * ---------------------------------------------------------------------------
83 */
84#define OMAP1510_FPGA_BASE 0xE8000000 /* VA */
85#define OMAP1510_FPGA_SIZE SZ_4K
86#define OMAP1510_FPGA_START 0x08000000 /* PA */
87
88/* Revision */
89#define OMAP1510_FPGA_REV_LOW IOMEM(OMAP1510_FPGA_BASE + 0x0)
90#define OMAP1510_FPGA_REV_HIGH IOMEM(OMAP1510_FPGA_BASE + 0x1)
91
92#define OMAP1510_FPGA_LCD_PANEL_CONTROL IOMEM(OMAP1510_FPGA_BASE + 0x2)
93#define OMAP1510_FPGA_LED_DIGIT IOMEM(OMAP1510_FPGA_BASE + 0x3)
94#define INNOVATOR_FPGA_HID_SPI IOMEM(OMAP1510_FPGA_BASE + 0x4)
95#define OMAP1510_FPGA_POWER IOMEM(OMAP1510_FPGA_BASE + 0x5)
96
97/* Interrupt status */
98#define OMAP1510_FPGA_ISR_LO IOMEM(OMAP1510_FPGA_BASE + 0x6)
99#define OMAP1510_FPGA_ISR_HI IOMEM(OMAP1510_FPGA_BASE + 0x7)
100
101/* Interrupt mask */
102#define OMAP1510_FPGA_IMR_LO IOMEM(OMAP1510_FPGA_BASE + 0x8)
103#define OMAP1510_FPGA_IMR_HI IOMEM(OMAP1510_FPGA_BASE + 0x9)
104
105/* Reset registers */
106#define OMAP1510_FPGA_HOST_RESET IOMEM(OMAP1510_FPGA_BASE + 0xa)
107#define OMAP1510_FPGA_RST IOMEM(OMAP1510_FPGA_BASE + 0xb)
108
109#define OMAP1510_FPGA_AUDIO IOMEM(OMAP1510_FPGA_BASE + 0xc)
110#define OMAP1510_FPGA_DIP IOMEM(OMAP1510_FPGA_BASE + 0xe)
111#define OMAP1510_FPGA_FPGA_IO IOMEM(OMAP1510_FPGA_BASE + 0xf)
112#define OMAP1510_FPGA_UART1 IOMEM(OMAP1510_FPGA_BASE + 0x14)
113#define OMAP1510_FPGA_UART2 IOMEM(OMAP1510_FPGA_BASE + 0x15)
114#define OMAP1510_FPGA_OMAP1510_STATUS IOMEM(OMAP1510_FPGA_BASE + 0x16)
115#define OMAP1510_FPGA_BOARD_REV IOMEM(OMAP1510_FPGA_BASE + 0x18)
116#define OMAP1510P1_PPT_DATA IOMEM(OMAP1510_FPGA_BASE + 0x100)
117#define OMAP1510P1_PPT_STATUS IOMEM(OMAP1510_FPGA_BASE + 0x101)
118#define OMAP1510P1_PPT_CONTROL IOMEM(OMAP1510_FPGA_BASE + 0x102)
119
120#define OMAP1510_FPGA_TOUCHSCREEN IOMEM(OMAP1510_FPGA_BASE + 0x204)
121
122#define INNOVATOR_FPGA_INFO IOMEM(OMAP1510_FPGA_BASE + 0x205)
123#define INNOVATOR_FPGA_LCD_BRIGHT_LO IOMEM(OMAP1510_FPGA_BASE + 0x206)
124#define INNOVATOR_FPGA_LCD_BRIGHT_HI IOMEM(OMAP1510_FPGA_BASE + 0x207)
125#define INNOVATOR_FPGA_LED_GRN_LO IOMEM(OMAP1510_FPGA_BASE + 0x208)
126#define INNOVATOR_FPGA_LED_GRN_HI IOMEM(OMAP1510_FPGA_BASE + 0x209)
127#define INNOVATOR_FPGA_LED_RED_LO IOMEM(OMAP1510_FPGA_BASE + 0x20a)
128#define INNOVATOR_FPGA_LED_RED_HI IOMEM(OMAP1510_FPGA_BASE + 0x20b)
129#define INNOVATOR_FPGA_CAM_USB_CONTROL IOMEM(OMAP1510_FPGA_BASE + 0x20c)
130#define INNOVATOR_FPGA_EXP_CONTROL IOMEM(OMAP1510_FPGA_BASE + 0x20d)
131#define INNOVATOR_FPGA_ISR2 IOMEM(OMAP1510_FPGA_BASE + 0x20e)
132#define INNOVATOR_FPGA_IMR2 IOMEM(OMAP1510_FPGA_BASE + 0x210)
133
134#define OMAP1510_FPGA_ETHR_START (OMAP1510_FPGA_START + 0x300)
135
136/*
137 * Power up Giga UART driver, turn on HID clock.
138 * Turn off BT power, since we're not using it and it
139 * draws power.
140 */
141#define OMAP1510_FPGA_RESET_VALUE 0x42
142
143#define OMAP1510_FPGA_PCR_IF_PD0 (1 << 7)
144#define OMAP1510_FPGA_PCR_COM2_EN (1 << 6)
145#define OMAP1510_FPGA_PCR_COM1_EN (1 << 5)
146#define OMAP1510_FPGA_PCR_EXP_PD0 (1 << 4)
147#define OMAP1510_FPGA_PCR_EXP_PD1 (1 << 3)
148#define OMAP1510_FPGA_PCR_48MHZ_CLK (1 << 2)
149#define OMAP1510_FPGA_PCR_4MHZ_CLK (1 << 1)
150#define OMAP1510_FPGA_PCR_RSRVD_BIT0 (1 << 0)
151
152/*
153 * Innovator/OMAP1510 FPGA HID register bit definitions
154 */
155#define OMAP1510_FPGA_HID_SCLK (1<<0) /* output */
156#define OMAP1510_FPGA_HID_MOSI (1<<1) /* output */
157#define OMAP1510_FPGA_HID_nSS (1<<2) /* output 0/1 chip idle/select */
158#define OMAP1510_FPGA_HID_nHSUS (1<<3) /* output 0/1 host active/suspended */
159#define OMAP1510_FPGA_HID_MISO (1<<4) /* input */
160#define OMAP1510_FPGA_HID_ATN (1<<5) /* input 0/1 chip idle/ATN */
161#define OMAP1510_FPGA_HID_rsrvd (1<<6)
162#define OMAP1510_FPGA_HID_RESETn (1<<7) /* output - 0/1 USAR reset/run */
163
164/* The FPGA IRQ is cascaded through GPIO_13 */
165#define OMAP1510_INT_FPGA (IH_GPIO_BASE + 13)
166
167/* IRQ Numbers for interrupts muxed through the FPGA */
168#define OMAP1510_INT_FPGA_ATN (OMAP_FPGA_IRQ_BASE + 0)
169#define OMAP1510_INT_FPGA_ACK (OMAP_FPGA_IRQ_BASE + 1)
170#define OMAP1510_INT_FPGA2 (OMAP_FPGA_IRQ_BASE + 2)
171#define OMAP1510_INT_FPGA3 (OMAP_FPGA_IRQ_BASE + 3)
172#define OMAP1510_INT_FPGA4 (OMAP_FPGA_IRQ_BASE + 4)
173#define OMAP1510_INT_FPGA5 (OMAP_FPGA_IRQ_BASE + 5)
174#define OMAP1510_INT_FPGA6 (OMAP_FPGA_IRQ_BASE + 6)
175#define OMAP1510_INT_FPGA7 (OMAP_FPGA_IRQ_BASE + 7)
176#define OMAP1510_INT_FPGA8 (OMAP_FPGA_IRQ_BASE + 8)
177#define OMAP1510_INT_FPGA9 (OMAP_FPGA_IRQ_BASE + 9)
178#define OMAP1510_INT_FPGA10 (OMAP_FPGA_IRQ_BASE + 10)
179#define OMAP1510_INT_FPGA11 (OMAP_FPGA_IRQ_BASE + 11)
180#define OMAP1510_INT_FPGA12 (OMAP_FPGA_IRQ_BASE + 12)
181#define OMAP1510_INT_ETHER (OMAP_FPGA_IRQ_BASE + 13)
182#define OMAP1510_INT_FPGAUART1 (OMAP_FPGA_IRQ_BASE + 14)
183#define OMAP1510_INT_FPGAUART2 (OMAP_FPGA_IRQ_BASE + 15)
184#define OMAP1510_INT_FPGA_TS (OMAP_FPGA_IRQ_BASE + 16)
185#define OMAP1510_INT_FPGA17 (OMAP_FPGA_IRQ_BASE + 17)
186#define OMAP1510_INT_FPGA_CAM (OMAP_FPGA_IRQ_BASE + 18)
187#define OMAP1510_INT_FPGA_RTC_A (OMAP_FPGA_IRQ_BASE + 19)
188#define OMAP1510_INT_FPGA_RTC_B (OMAP_FPGA_IRQ_BASE + 20)
189#define OMAP1510_INT_FPGA_CD (OMAP_FPGA_IRQ_BASE + 21)
190#define OMAP1510_INT_FPGA22 (OMAP_FPGA_IRQ_BASE + 22)
191#define OMAP1510_INT_FPGA23 (OMAP_FPGA_IRQ_BASE + 23)
192
193#endif
diff --git a/arch/arm/plat-omap/include/plat/led.h b/arch/arm/plat-omap/include/plat/led.h
deleted file mode 100644
index 25e451e7e2fd..000000000000
--- a/arch/arm/plat-omap/include/plat/led.h
+++ /dev/null
@@ -1,24 +0,0 @@
1/*
2 * arch/arm/plat-omap/include/mach/led.h
3 *
4 * Copyright (C) 2006 Samsung Electronics
5 * Kyungmin Park <kyungmin.park@samsung.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 version 2 as
9 * published by the Free Software Foundation.
10 */
11#ifndef ASMARM_ARCH_LED_H
12#define ASMARM_ARCH_LED_H
13
14struct omap_led_config {
15 struct led_classdev cdev;
16 s16 gpio;
17};
18
19struct omap_led_platform_data {
20 s16 nr_leds;
21 struct omap_led_config *leds;
22};
23
24#endif
diff --git a/arch/arm/plat-omap/include/plat/mmc.h b/arch/arm/plat-omap/include/plat/mmc.h
deleted file mode 100644
index 8b4e4f2da2f5..000000000000
--- a/arch/arm/plat-omap/include/plat/mmc.h
+++ /dev/null
@@ -1,188 +0,0 @@
1/*
2 * MMC definitions for OMAP2
3 *
4 * Copyright (C) 2006 Nokia Corporation
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __OMAP2_MMC_H
12#define __OMAP2_MMC_H
13
14#include <linux/types.h>
15#include <linux/device.h>
16#include <linux/mmc/host.h>
17
18#include <plat/omap_hwmod.h>
19
20#define OMAP15XX_NR_MMC 1
21#define OMAP16XX_NR_MMC 2
22#define OMAP1_MMC_SIZE 0x080
23#define OMAP1_MMC1_BASE 0xfffb7800
24#define OMAP1_MMC2_BASE 0xfffb7c00 /* omap16xx only */
25
26#define OMAP24XX_NR_MMC 2
27#define OMAP2420_MMC_SIZE OMAP1_MMC_SIZE
28#define OMAP2_MMC1_BASE 0x4809c000
29
30#define OMAP4_MMC_REG_OFFSET 0x100
31
32#define OMAP_MMC_MAX_SLOTS 2
33
34/*
35 * struct omap_mmc_dev_attr.flags possibilities
36 *
37 * OMAP_HSMMC_SUPPORTS_DUAL_VOLT: Some HSMMC controller instances can
38 * operate with either 1.8Vdc or 3.0Vdc card voltages; this flag
39 * should be set if this is the case. See for example Section 22.5.3
40 * "MMC/SD/SDIO1 Bus Voltage Selection" of the OMAP34xx Multimedia
41 * Device Silicon Revision 3.1.x Revision ZR (July 2011) (SWPU223R).
42 *
43 * OMAP_HSMMC_BROKEN_MULTIBLOCK_READ: Multiple-block read transfers
44 * don't work correctly on some MMC controller instances on some
45 * OMAP3 SoCs; this flag should be set if this is the case. See
46 * for example Advisory 2.1.1.128 "MMC: Multiple Block Read
47 * Operation Issue" in _OMAP3530/3525/3515/3503 Silicon Errata_
48 * Revision F (October 2010) (SPRZ278F).
49 */
50#define OMAP_HSMMC_SUPPORTS_DUAL_VOLT BIT(0)
51#define OMAP_HSMMC_BROKEN_MULTIBLOCK_READ BIT(1)
52
53struct omap_mmc_dev_attr {
54 u8 flags;
55};
56
57struct omap_mmc_platform_data {
58 /* back-link to device */
59 struct device *dev;
60
61 /* number of slots per controller */
62 unsigned nr_slots:2;
63
64 /* set if your board has components or wiring that limits the
65 * maximum frequency on the MMC bus */
66 unsigned int max_freq;
67
68 /* switch the bus to a new slot */
69 int (*switch_slot)(struct device *dev, int slot);
70 /* initialize board-specific MMC functionality, can be NULL if
71 * not supported */
72 int (*init)(struct device *dev);
73 void (*cleanup)(struct device *dev);
74 void (*shutdown)(struct device *dev);
75
76 /* To handle board related suspend/resume functionality for MMC */
77 int (*suspend)(struct device *dev, int slot);
78 int (*resume)(struct device *dev, int slot);
79
80 /* Return context loss count due to PM states changing */
81 int (*get_context_loss_count)(struct device *dev);
82
83 /* Integrating attributes from the omap_hwmod layer */
84 u8 controller_flags;
85
86 /* Register offset deviation */
87 u16 reg_offset;
88
89 struct omap_mmc_slot_data {
90
91 /*
92 * 4/8 wires and any additional host capabilities
93 * need to OR'd all capabilities (ref. linux/mmc/host.h)
94 */
95 u8 wires; /* Used for the MMC driver on omap1 and 2420 */
96 u32 caps; /* Used for the MMC driver on 2430 and later */
97 u32 pm_caps; /* PM capabilities of the mmc */
98
99 /*
100 * nomux means "standard" muxing is wrong on this board, and
101 * that board-specific code handled it before common init logic.
102 */
103 unsigned nomux:1;
104
105 /* switch pin can be for card detect (default) or card cover */
106 unsigned cover:1;
107
108 /* use the internal clock */
109 unsigned internal_clock:1;
110
111 /* nonremovable e.g. eMMC */
112 unsigned nonremovable:1;
113
114 /* Try to sleep or power off when possible */
115 unsigned power_saving:1;
116
117 /* If using power_saving and the MMC power is not to go off */
118 unsigned no_off:1;
119
120 /* eMMC does not handle power off when not in sleep state */
121 unsigned no_regulator_off_init:1;
122
123 /* Regulator off remapped to sleep */
124 unsigned vcc_aux_disable_is_sleep:1;
125
126 /* we can put the features above into this variable */
127#define HSMMC_HAS_PBIAS (1 << 0)
128#define HSMMC_HAS_UPDATED_RESET (1 << 1)
129 unsigned features;
130
131 int switch_pin; /* gpio (card detect) */
132 int gpio_wp; /* gpio (write protect) */
133
134 int (*set_bus_mode)(struct device *dev, int slot, int bus_mode);
135 int (*set_power)(struct device *dev, int slot,
136 int power_on, int vdd);
137 int (*get_ro)(struct device *dev, int slot);
138 void (*remux)(struct device *dev, int slot, int power_on);
139 /* Call back before enabling / disabling regulators */
140 void (*before_set_reg)(struct device *dev, int slot,
141 int power_on, int vdd);
142 /* Call back after enabling / disabling regulators */
143 void (*after_set_reg)(struct device *dev, int slot,
144 int power_on, int vdd);
145 /* if we have special card, init it using this callback */
146 void (*init_card)(struct mmc_card *card);
147
148 /* return MMC cover switch state, can be NULL if not supported.
149 *
150 * possible return values:
151 * 0 - closed
152 * 1 - open
153 */
154 int (*get_cover_state)(struct device *dev, int slot);
155
156 const char *name;
157 u32 ocr_mask;
158
159 /* Card detection IRQs */
160 int card_detect_irq;
161 int (*card_detect)(struct device *dev, int slot);
162
163 unsigned int ban_openended:1;
164
165 } slots[OMAP_MMC_MAX_SLOTS];
166};
167
168/* called from board-specific card detection service routine */
169extern void omap_mmc_notify_cover_event(struct device *dev, int slot,
170 int is_closed);
171
172#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
173void omap1_init_mmc(struct omap_mmc_platform_data **mmc_data,
174 int nr_controllers);
175void omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data);
176#else
177static inline void omap1_init_mmc(struct omap_mmc_platform_data **mmc_data,
178 int nr_controllers)
179{
180}
181static inline void omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data)
182{
183}
184#endif
185
186extern int omap_msdi_reset(struct omap_hwmod *oh);
187
188#endif
diff --git a/arch/arm/plat-omap/include/plat/multi.h b/arch/arm/plat-omap/include/plat/multi.h
deleted file mode 100644
index 324d31b14852..000000000000
--- a/arch/arm/plat-omap/include/plat/multi.h
+++ /dev/null
@@ -1,120 +0,0 @@
1/*
2 * Support for compiling in multiple OMAP processors
3 *
4 * Copyright (C) 2010 Nokia Corporation
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20 */
21
22#ifndef __PLAT_OMAP_MULTI_H
23#define __PLAT_OMAP_MULTI_H
24
25/*
26 * Test if multicore OMAP support is needed
27 */
28#undef MULTI_OMAP1
29#undef MULTI_OMAP2
30#undef OMAP_NAME
31
32#ifdef CONFIG_ARCH_OMAP730
33# ifdef OMAP_NAME
34# undef MULTI_OMAP1
35# define MULTI_OMAP1
36# else
37# define OMAP_NAME omap730
38# endif
39#endif
40#ifdef CONFIG_ARCH_OMAP850
41# ifdef OMAP_NAME
42# undef MULTI_OMAP1
43# define MULTI_OMAP1
44# else
45# define OMAP_NAME omap850
46# endif
47#endif
48#ifdef CONFIG_ARCH_OMAP15XX
49# ifdef OMAP_NAME
50# undef MULTI_OMAP1
51# define MULTI_OMAP1
52# else
53# define OMAP_NAME omap1510
54# endif
55#endif
56#ifdef CONFIG_ARCH_OMAP16XX
57# ifdef OMAP_NAME
58# undef MULTI_OMAP1
59# define MULTI_OMAP1
60# else
61# define OMAP_NAME omap16xx
62# endif
63#endif
64#ifdef CONFIG_ARCH_OMAP2PLUS
65# if (defined(OMAP_NAME) || defined(MULTI_OMAP1))
66# error "OMAP1 and OMAP2PLUS can't be selected at the same time"
67# endif
68#endif
69#ifdef CONFIG_SOC_OMAP2420
70# ifdef OMAP_NAME
71# undef MULTI_OMAP2
72# define MULTI_OMAP2
73# else
74# define OMAP_NAME omap2420
75# endif
76#endif
77#ifdef CONFIG_SOC_OMAP2430
78# ifdef OMAP_NAME
79# undef MULTI_OMAP2
80# define MULTI_OMAP2
81# else
82# define OMAP_NAME omap2430
83# endif
84#endif
85#ifdef CONFIG_ARCH_OMAP3
86# ifdef OMAP_NAME
87# undef MULTI_OMAP2
88# define MULTI_OMAP2
89# else
90# define OMAP_NAME omap3
91# endif
92#endif
93#ifdef CONFIG_ARCH_OMAP4
94# ifdef OMAP_NAME
95# undef MULTI_OMAP2
96# define MULTI_OMAP2
97# else
98# define OMAP_NAME omap4
99# endif
100#endif
101
102#ifdef CONFIG_SOC_OMAP5
103# ifdef OMAP_NAME
104# undef MULTI_OMAP2
105# define MULTI_OMAP2
106# else
107# define OMAP_NAME omap5
108# endif
109#endif
110
111#ifdef CONFIG_SOC_AM33XX
112# ifdef OMAP_NAME
113# undef MULTI_OMAP2
114# define MULTI_OMAP2
115# else
116# define OMAP_NAME am33xx
117# endif
118#endif
119
120#endif /* __PLAT_OMAP_MULTI_H */
diff --git a/arch/arm/plat-omap/include/plat/omap-secure.h b/arch/arm/plat-omap/include/plat/omap-secure.h
deleted file mode 100644
index 0e4acd2d2deb..000000000000
--- a/arch/arm/plat-omap/include/plat/omap-secure.h
+++ /dev/null
@@ -1,14 +0,0 @@
1#ifndef __OMAP_SECURE_H__
2#define __OMAP_SECURE_H__
3
4#include <linux/types.h>
5
6extern int omap_secure_ram_reserve_memblock(void);
7
8#ifdef CONFIG_OMAP4_ERRATA_I688
9extern int omap_barrier_reserve_memblock(void);
10#else
11static inline void omap_barrier_reserve_memblock(void)
12{ }
13#endif
14#endif /* __OMAP_SECURE_H__ */
diff --git a/arch/arm/plat-omap/include/plat/sdrc.h b/arch/arm/plat-omap/include/plat/sdrc.h
deleted file mode 100644
index 36d6a7666216..000000000000
--- a/arch/arm/plat-omap/include/plat/sdrc.h
+++ /dev/null
@@ -1,164 +0,0 @@
1#ifndef ____ASM_ARCH_SDRC_H
2#define ____ASM_ARCH_SDRC_H
3
4/*
5 * OMAP2/3 SDRC/SMS register definitions
6 *
7 * Copyright (C) 2007-2008 Texas Instruments, Inc.
8 * Copyright (C) 2007-2008 Nokia Corporation
9 *
10 * Tony Lindgren
11 * Paul Walmsley
12 * Richard Woodruff
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License version 2 as
16 * published by the Free Software Foundation.
17 */
18
19
20/* SDRC register offsets - read/write with sdrc_{read,write}_reg() */
21
22#define SDRC_SYSCONFIG 0x010
23#define SDRC_CS_CFG 0x040
24#define SDRC_SHARING 0x044
25#define SDRC_ERR_TYPE 0x04C
26#define SDRC_DLLA_CTRL 0x060
27#define SDRC_DLLA_STATUS 0x064
28#define SDRC_DLLB_CTRL 0x068
29#define SDRC_DLLB_STATUS 0x06C
30#define SDRC_POWER 0x070
31#define SDRC_MCFG_0 0x080
32#define SDRC_MR_0 0x084
33#define SDRC_EMR2_0 0x08c
34#define SDRC_ACTIM_CTRL_A_0 0x09c
35#define SDRC_ACTIM_CTRL_B_0 0x0a0
36#define SDRC_RFR_CTRL_0 0x0a4
37#define SDRC_MANUAL_0 0x0a8
38#define SDRC_MCFG_1 0x0B0
39#define SDRC_MR_1 0x0B4
40#define SDRC_EMR2_1 0x0BC
41#define SDRC_ACTIM_CTRL_A_1 0x0C4
42#define SDRC_ACTIM_CTRL_B_1 0x0C8
43#define SDRC_RFR_CTRL_1 0x0D4
44#define SDRC_MANUAL_1 0x0D8
45
46#define SDRC_POWER_AUTOCOUNT_SHIFT 8
47#define SDRC_POWER_AUTOCOUNT_MASK (0xffff << SDRC_POWER_AUTOCOUNT_SHIFT)
48#define SDRC_POWER_CLKCTRL_SHIFT 4
49#define SDRC_POWER_CLKCTRL_MASK (0x3 << SDRC_POWER_CLKCTRL_SHIFT)
50#define SDRC_SELF_REFRESH_ON_AUTOCOUNT (0x2 << SDRC_POWER_CLKCTRL_SHIFT)
51
52/*
53 * These values represent the number of memory clock cycles between
54 * autorefresh initiation. They assume 1 refresh per 64 ms (JEDEC), 8192
55 * rows per device, and include a subtraction of a 50 cycle window in the
56 * event that the autorefresh command is delayed due to other SDRC activity.
57 * The '| 1' sets the ARE field to send one autorefresh when the autorefresh
58 * counter reaches 0.
59 *
60 * These represent optimal values for common parts, it won't work for all.
61 * As long as you scale down, most parameters are still work, they just
62 * become sub-optimal. The RFR value goes in the opposite direction. If you
63 * don't adjust it down as your clock period increases the refresh interval
64 * will not be met. Setting all parameters for complete worst case may work,
65 * but may cut memory performance by 2x. Due to errata the DLLs need to be
66 * unlocked and their value needs run time calibration. A dynamic call is
67 * need for that as no single right value exists acorss production samples.
68 *
69 * Only the FULL speed values are given. Current code is such that rate
70 * changes must be made at DPLLoutx2. The actual value adjustment for low
71 * frequency operation will be handled by omap_set_performance()
72 *
73 * By having the boot loader boot up in the fastest L4 speed available likely
74 * will result in something which you can switch between.
75 */
76#define SDRC_RFR_CTRL_165MHz (0x00044c00 | 1)
77#define SDRC_RFR_CTRL_133MHz (0x0003de00 | 1)
78#define SDRC_RFR_CTRL_100MHz (0x0002da01 | 1)
79#define SDRC_RFR_CTRL_110MHz (0x0002da01 | 1) /* Need to calc */
80#define SDRC_RFR_CTRL_BYPASS (0x00005000 | 1) /* Need to calc */
81
82
83/*
84 * SMS register access
85 */
86
87#define OMAP242X_SMS_REGADDR(reg) \
88 (void __iomem *)OMAP2_L3_IO_ADDRESS(OMAP2420_SMS_BASE + reg)
89#define OMAP243X_SMS_REGADDR(reg) \
90 (void __iomem *)OMAP2_L3_IO_ADDRESS(OMAP243X_SMS_BASE + reg)
91#define OMAP343X_SMS_REGADDR(reg) \
92 (void __iomem *)OMAP2_L3_IO_ADDRESS(OMAP343X_SMS_BASE + reg)
93
94/* SMS register offsets - read/write with sms_{read,write}_reg() */
95
96#define SMS_SYSCONFIG 0x010
97#define SMS_ROT_CONTROL(context) (0x180 + 0x10 * context)
98#define SMS_ROT_SIZE(context) (0x184 + 0x10 * context)
99#define SMS_ROT_PHYSICAL_BA(context) (0x188 + 0x10 * context)
100/* REVISIT: fill in other SMS registers here */
101
102
103#ifndef __ASSEMBLER__
104
105/**
106 * struct omap_sdrc_params - SDRC parameters for a given SDRC clock rate
107 * @rate: SDRC clock rate (in Hz)
108 * @actim_ctrla: Value to program to SDRC_ACTIM_CTRLA for this rate
109 * @actim_ctrlb: Value to program to SDRC_ACTIM_CTRLB for this rate
110 * @rfr_ctrl: Value to program to SDRC_RFR_CTRL for this rate
111 * @mr: Value to program to SDRC_MR for this rate
112 *
113 * This structure holds a pre-computed set of register values for the
114 * SDRC for a given SDRC clock rate and SDRAM chip. These are
115 * intended to be pre-computed and specified in an array in the board-*.c
116 * files. The structure is keyed off the 'rate' field.
117 */
118struct omap_sdrc_params {
119 unsigned long rate;
120 u32 actim_ctrla;
121 u32 actim_ctrlb;
122 u32 rfr_ctrl;
123 u32 mr;
124};
125
126#ifdef CONFIG_SOC_HAS_OMAP2_SDRC
127void omap2_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
128 struct omap_sdrc_params *sdrc_cs1);
129#else
130static inline void __init omap2_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
131 struct omap_sdrc_params *sdrc_cs1) {};
132#endif
133
134int omap2_sdrc_get_params(unsigned long r,
135 struct omap_sdrc_params **sdrc_cs0,
136 struct omap_sdrc_params **sdrc_cs1);
137void omap2_sms_save_context(void);
138void omap2_sms_restore_context(void);
139
140void omap2_sms_write_rot_control(u32 val, unsigned ctx);
141void omap2_sms_write_rot_size(u32 val, unsigned ctx);
142void omap2_sms_write_rot_physical_ba(u32 val, unsigned ctx);
143
144#ifdef CONFIG_ARCH_OMAP2
145
146struct memory_timings {
147 u32 m_type; /* ddr = 1, sdr = 0 */
148 u32 dll_mode; /* use lock mode = 1, unlock mode = 0 */
149 u32 slow_dll_ctrl; /* unlock mode, dll value for slow speed */
150 u32 fast_dll_ctrl; /* unlock mode, dll value for fast speed */
151 u32 base_cs; /* base chip select to use for calculations */
152};
153
154extern void omap2xxx_sdrc_init_params(u32 force_lock_to_unlock_mode);
155struct omap_sdrc_params *rx51_get_sdram_timings(void);
156
157u32 omap2xxx_sdrc_dll_is_unlocked(void);
158u32 omap2xxx_sdrc_reprogram(u32 level, u32 force);
159
160#endif /* CONFIG_ARCH_OMAP2 */
161
162#endif /* __ASSEMBLER__ */
163
164#endif
diff --git a/arch/arm/plat-omap/include/plat/sram.h b/arch/arm/plat-omap/include/plat/sram.h
deleted file mode 100644
index 227ae2657554..000000000000
--- a/arch/arm/plat-omap/include/plat/sram.h
+++ /dev/null
@@ -1,105 +0,0 @@
1/*
2 * arch/arm/plat-omap/include/mach/sram.h
3 *
4 * Interface for functions that need to be run in internal SRAM
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __ARCH_ARM_OMAP_SRAM_H
12#define __ARCH_ARM_OMAP_SRAM_H
13
14#ifndef __ASSEMBLY__
15#include <asm/fncpy.h>
16
17extern void *omap_sram_push_address(unsigned long size);
18
19/* Macro to push a function to the internal SRAM, using the fncpy API */
20#define omap_sram_push(funcp, size) ({ \
21 typeof(&(funcp)) _res = NULL; \
22 void *_sram_address = omap_sram_push_address(size); \
23 if (_sram_address) \
24 _res = fncpy(_sram_address, &(funcp), size); \
25 _res; \
26})
27
28extern void omap_sram_reprogram_clock(u32 dpllctl, u32 ckctl);
29
30extern void omap2_sram_ddr_init(u32 *slow_dll_ctrl, u32 fast_dll_ctrl,
31 u32 base_cs, u32 force_unlock);
32extern void omap2_sram_reprogram_sdrc(u32 perf_level, u32 dll_val,
33 u32 mem_type);
34extern u32 omap2_set_prcm(u32 dpll_ctrl_val, u32 sdrc_rfr_val, int bypass);
35
36extern u32 omap3_configure_core_dpll(
37 u32 m2, u32 unlock_dll, u32 f, u32 inc,
38 u32 sdrc_rfr_ctrl_0, u32 sdrc_actim_ctrl_a_0,
39 u32 sdrc_actim_ctrl_b_0, u32 sdrc_mr_0,
40 u32 sdrc_rfr_ctrl_1, u32 sdrc_actim_ctrl_a_1,
41 u32 sdrc_actim_ctrl_b_1, u32 sdrc_mr_1);
42extern void omap3_sram_restore_context(void);
43
44/* Do not use these */
45extern void omap1_sram_reprogram_clock(u32 ckctl, u32 dpllctl);
46extern unsigned long omap1_sram_reprogram_clock_sz;
47
48extern void omap24xx_sram_reprogram_clock(u32 ckctl, u32 dpllctl);
49extern unsigned long omap24xx_sram_reprogram_clock_sz;
50
51extern void omap242x_sram_ddr_init(u32 *slow_dll_ctrl, u32 fast_dll_ctrl,
52 u32 base_cs, u32 force_unlock);
53extern unsigned long omap242x_sram_ddr_init_sz;
54
55extern u32 omap242x_sram_set_prcm(u32 dpll_ctrl_val, u32 sdrc_rfr_val,
56 int bypass);
57extern unsigned long omap242x_sram_set_prcm_sz;
58
59extern void omap242x_sram_reprogram_sdrc(u32 perf_level, u32 dll_val,
60 u32 mem_type);
61extern unsigned long omap242x_sram_reprogram_sdrc_sz;
62
63
64extern void omap243x_sram_ddr_init(u32 *slow_dll_ctrl, u32 fast_dll_ctrl,
65 u32 base_cs, u32 force_unlock);
66extern unsigned long omap243x_sram_ddr_init_sz;
67
68extern u32 omap243x_sram_set_prcm(u32 dpll_ctrl_val, u32 sdrc_rfr_val,
69 int bypass);
70extern unsigned long omap243x_sram_set_prcm_sz;
71
72extern void omap243x_sram_reprogram_sdrc(u32 perf_level, u32 dll_val,
73 u32 mem_type);
74extern unsigned long omap243x_sram_reprogram_sdrc_sz;
75
76extern u32 omap3_sram_configure_core_dpll(
77 u32 m2, u32 unlock_dll, u32 f, u32 inc,
78 u32 sdrc_rfr_ctrl_0, u32 sdrc_actim_ctrl_a_0,
79 u32 sdrc_actim_ctrl_b_0, u32 sdrc_mr_0,
80 u32 sdrc_rfr_ctrl_1, u32 sdrc_actim_ctrl_a_1,
81 u32 sdrc_actim_ctrl_b_1, u32 sdrc_mr_1);
82extern unsigned long omap3_sram_configure_core_dpll_sz;
83
84#ifdef CONFIG_PM
85extern void omap_push_sram_idle(void);
86#else
87static inline void omap_push_sram_idle(void) {}
88#endif /* CONFIG_PM */
89
90#endif /* __ASSEMBLY__ */
91
92/*
93 * OMAP2+: define the SRAM PA addresses.
94 * Used by the SRAM management code and the idle sleep code.
95 */
96#define OMAP2_SRAM_PA 0x40200000
97#define OMAP3_SRAM_PA 0x40200000
98#ifdef CONFIG_OMAP4_ERRATA_I688
99#define OMAP4_SRAM_PA 0x40304000
100#define OMAP4_SRAM_VA 0xfe404000
101#else
102#define OMAP4_SRAM_PA 0x40300000
103#endif
104#define AM33XX_SRAM_PA 0x40300000
105#endif
diff --git a/arch/arm/plat-omap/include/plat/vrfb.h b/arch/arm/plat-omap/include/plat/vrfb.h
deleted file mode 100644
index 3792bdea2f6d..000000000000
--- a/arch/arm/plat-omap/include/plat/vrfb.h
+++ /dev/null
@@ -1,66 +0,0 @@
1/*
2 * VRFB Rotation Engine
3 *
4 * Copyright (C) 2009 Nokia Corporation
5 * Author: Tomi Valkeinen <tomi.valkeinen@nokia.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 version 2 as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 */
20
21#ifndef __OMAP_VRFB_H__
22#define __OMAP_VRFB_H__
23
24#define OMAP_VRFB_LINE_LEN 2048
25
26struct vrfb {
27 u8 context;
28 void __iomem *vaddr[4];
29 unsigned long paddr[4];
30 u16 xres;
31 u16 yres;
32 u16 xoffset;
33 u16 yoffset;
34 u8 bytespp;
35 bool yuv_mode;
36};
37
38#ifdef CONFIG_OMAP2_VRFB
39extern int omap_vrfb_request_ctx(struct vrfb *vrfb);
40extern void omap_vrfb_release_ctx(struct vrfb *vrfb);
41extern void omap_vrfb_adjust_size(u16 *width, u16 *height,
42 u8 bytespp);
43extern u32 omap_vrfb_min_phys_size(u16 width, u16 height, u8 bytespp);
44extern u16 omap_vrfb_max_height(u32 phys_size, u16 width, u8 bytespp);
45extern void omap_vrfb_setup(struct vrfb *vrfb, unsigned long paddr,
46 u16 width, u16 height,
47 unsigned bytespp, bool yuv_mode);
48extern int omap_vrfb_map_angle(struct vrfb *vrfb, u16 height, u8 rot);
49extern void omap_vrfb_restore_context(void);
50
51#else
52static inline int omap_vrfb_request_ctx(struct vrfb *vrfb) { return 0; }
53static inline void omap_vrfb_release_ctx(struct vrfb *vrfb) {}
54static inline void omap_vrfb_adjust_size(u16 *width, u16 *height,
55 u8 bytespp) {}
56static inline u32 omap_vrfb_min_phys_size(u16 width, u16 height, u8 bytespp)
57 { return 0; }
58static inline u16 omap_vrfb_max_height(u32 phys_size, u16 width, u8 bytespp)
59 { return 0; }
60static inline void omap_vrfb_setup(struct vrfb *vrfb, unsigned long paddr,
61 u16 width, u16 height, unsigned bytespp, bool yuv_mode) {}
62static inline int omap_vrfb_map_angle(struct vrfb *vrfb, u16 height, u8 rot)
63 { return 0; }
64static inline void omap_vrfb_restore_context(void) {}
65#endif
66#endif /* __VRFB_H */
diff --git a/arch/arm/plat-omap/omap-pm-noop.c b/arch/arm/plat-omap/omap-pm-noop.c
index 9722f418ae1f..198685b894b0 100644
--- a/arch/arm/plat-omap/omap-pm-noop.c
+++ b/arch/arm/plat-omap/omap-pm-noop.c
@@ -22,9 +22,8 @@
22#include <linux/device.h> 22#include <linux/device.h>
23#include <linux/platform_device.h> 23#include <linux/platform_device.h>
24 24
25/* Interface documentation is in mach/omap-pm.h */ 25#include "../mach-omap2/omap_device.h"
26#include <plat/omap-pm.h> 26#include "../mach-omap2/omap-pm.h"
27#include <plat/omap_device.h>
28 27
29static bool off_mode_enabled; 28static bool off_mode_enabled;
30static int dummy_context_loss_counter; 29static int dummy_context_loss_counter;
diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c
index 28acb383e7df..70dcc225157f 100644
--- a/arch/arm/plat-omap/sram.c
+++ b/arch/arm/plat-omap/sram.c
@@ -25,8 +25,8 @@
25 25
26#include <asm/mach/map.h> 26#include <asm/mach/map.h>
27 27
28#include <plat/sram.h> 28#include "../mach-omap1/soc.h"
29#include <plat/cpu.h> 29#include "../mach-omap2/soc.h"
30 30
31#include "sram.h" 31#include "sram.h"
32 32
diff --git a/arch/arm/plat-omap/sram.h b/arch/arm/plat-omap/sram.h
index 29b43ef97f20..cefda2e09869 100644
--- a/arch/arm/plat-omap/sram.h
+++ b/arch/arm/plat-omap/sram.h
@@ -1,6 +1,107 @@
1#ifndef __PLAT_OMAP_SRAM_H__ 1/*
2#define __PLAT_OMAP_SRAM_H__ 2 * arch/arm/plat-omap/include/mach/sram.h
3 *
4 * Interface for functions that need to be run in internal SRAM
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
3 10
4extern int __init omap_sram_init(void); 11#ifndef __ARCH_ARM_OMAP_SRAM_H
12#define __ARCH_ARM_OMAP_SRAM_H
5 13
6#endif /* __PLAT_OMAP_SRAM_H__ */ 14#ifndef __ASSEMBLY__
15#include <asm/fncpy.h>
16
17int __init omap_sram_init(void);
18
19extern void *omap_sram_push_address(unsigned long size);
20
21/* Macro to push a function to the internal SRAM, using the fncpy API */
22#define omap_sram_push(funcp, size) ({ \
23 typeof(&(funcp)) _res = NULL; \
24 void *_sram_address = omap_sram_push_address(size); \
25 if (_sram_address) \
26 _res = fncpy(_sram_address, &(funcp), size); \
27 _res; \
28})
29
30extern void omap_sram_reprogram_clock(u32 dpllctl, u32 ckctl);
31
32extern void omap2_sram_ddr_init(u32 *slow_dll_ctrl, u32 fast_dll_ctrl,
33 u32 base_cs, u32 force_unlock);
34extern void omap2_sram_reprogram_sdrc(u32 perf_level, u32 dll_val,
35 u32 mem_type);
36extern u32 omap2_set_prcm(u32 dpll_ctrl_val, u32 sdrc_rfr_val, int bypass);
37
38extern u32 omap3_configure_core_dpll(
39 u32 m2, u32 unlock_dll, u32 f, u32 inc,
40 u32 sdrc_rfr_ctrl_0, u32 sdrc_actim_ctrl_a_0,
41 u32 sdrc_actim_ctrl_b_0, u32 sdrc_mr_0,
42 u32 sdrc_rfr_ctrl_1, u32 sdrc_actim_ctrl_a_1,
43 u32 sdrc_actim_ctrl_b_1, u32 sdrc_mr_1);
44extern void omap3_sram_restore_context(void);
45
46/* Do not use these */
47extern void omap1_sram_reprogram_clock(u32 ckctl, u32 dpllctl);
48extern unsigned long omap1_sram_reprogram_clock_sz;
49
50extern void omap24xx_sram_reprogram_clock(u32 ckctl, u32 dpllctl);
51extern unsigned long omap24xx_sram_reprogram_clock_sz;
52
53extern void omap242x_sram_ddr_init(u32 *slow_dll_ctrl, u32 fast_dll_ctrl,
54 u32 base_cs, u32 force_unlock);
55extern unsigned long omap242x_sram_ddr_init_sz;
56
57extern u32 omap242x_sram_set_prcm(u32 dpll_ctrl_val, u32 sdrc_rfr_val,
58 int bypass);
59extern unsigned long omap242x_sram_set_prcm_sz;
60
61extern void omap242x_sram_reprogram_sdrc(u32 perf_level, u32 dll_val,
62 u32 mem_type);
63extern unsigned long omap242x_sram_reprogram_sdrc_sz;
64
65
66extern void omap243x_sram_ddr_init(u32 *slow_dll_ctrl, u32 fast_dll_ctrl,
67 u32 base_cs, u32 force_unlock);
68extern unsigned long omap243x_sram_ddr_init_sz;
69
70extern u32 omap243x_sram_set_prcm(u32 dpll_ctrl_val, u32 sdrc_rfr_val,
71 int bypass);
72extern unsigned long omap243x_sram_set_prcm_sz;
73
74extern void omap243x_sram_reprogram_sdrc(u32 perf_level, u32 dll_val,
75 u32 mem_type);
76extern unsigned long omap243x_sram_reprogram_sdrc_sz;
77
78extern u32 omap3_sram_configure_core_dpll(
79 u32 m2, u32 unlock_dll, u32 f, u32 inc,
80 u32 sdrc_rfr_ctrl_0, u32 sdrc_actim_ctrl_a_0,
81 u32 sdrc_actim_ctrl_b_0, u32 sdrc_mr_0,
82 u32 sdrc_rfr_ctrl_1, u32 sdrc_actim_ctrl_a_1,
83 u32 sdrc_actim_ctrl_b_1, u32 sdrc_mr_1);
84extern unsigned long omap3_sram_configure_core_dpll_sz;
85
86#ifdef CONFIG_PM
87extern void omap_push_sram_idle(void);
88#else
89static inline void omap_push_sram_idle(void) {}
90#endif /* CONFIG_PM */
91
92#endif /* __ASSEMBLY__ */
93
94/*
95 * OMAP2+: define the SRAM PA addresses.
96 * Used by the SRAM management code and the idle sleep code.
97 */
98#define OMAP2_SRAM_PA 0x40200000
99#define OMAP3_SRAM_PA 0x40200000
100#ifdef CONFIG_OMAP4_ERRATA_I688
101#define OMAP4_SRAM_PA 0x40304000
102#define OMAP4_SRAM_VA 0xfe404000
103#else
104#define OMAP4_SRAM_PA 0x40300000
105#endif
106#define AM33XX_SRAM_PA 0x40300000
107#endif